@sheetxl/sdk 0.8.0-beta.11 → 0.8.0-beta.12
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/esm/{BpgskG1Er_lGQ_yS.mjs → -Jx-jNHmtIQQfLvK.mjs} +1 -1
- package/browser/esm/{BLoUBId2xZpXAK_H.mjs → 2WuhYrIpYmOR5H73.mjs} +15 -15
- package/browser/esm/{Ctjb0SsxV4K4MMqG.mjs → 2mIwPy2D2JUX-9wx.mjs} +2 -2
- package/browser/esm/{CkxWugaJFjDGZNZ-.mjs → B3wf5vZCsWfWsDbj.mjs} +1 -1
- package/browser/esm/{BjkCiv5Jz6WYKZeu.mjs → BIHrHjRGWVlJglcp.mjs} +2 -2
- package/browser/esm/{BtvLTTfSBdAKplVG.mjs → BTFBedJMRWGvZyCE.mjs} +1 -1
- package/browser/esm/{C4MqfLn9Dm-l3OIk.mjs → BdCJNawfifyPupCP.mjs} +1 -1
- package/browser/esm/{CV5EGEjG5_-CPpP0.mjs → Bg5Di9GLNAkbqQ1P.mjs} +3 -3
- package/browser/esm/{C2VbEI_XVAoseAwa.mjs → BnC4-27Igwb8oDf2.mjs} +2 -2
- package/browser/esm/{CQYjO777cmAznUzK.mjs → Bt8_m94tBdks209L.mjs} +1 -1
- package/browser/esm/{C16ycKja6zG0crV_.mjs → BudSIfXBAsTxvu-K.mjs} +17836 -15712
- package/browser/esm/{DvAaxH6z_tGvrRzl.mjs → C9u8FUewte5ugUjH.mjs} +686 -686
- package/browser/esm/{DEiPS3Dr-s4fPbVZ.mjs → CBYMTDzMf1Vh7pkw.mjs} +1 -1
- package/browser/esm/{Dyq_ivuHvlXLwPCl.mjs → CNdjyofiRu6CYOrr.mjs} +1106 -1102
- package/browser/esm/{PcHFjNzQsE54POri.mjs → CRkYR-siY2C994KV.mjs} +1 -1
- package/browser/esm/{C5E6zSGAALWf61n4.mjs → CTe2qfmIUEad6FJv.mjs} +2 -2
- package/browser/esm/{BoV6zPBnfqCBCqZ7.mjs → CUzYuYTTGsChC_kZ.mjs} +3841 -3148
- package/browser/esm/CdEO8CEee6lEhabA.mjs +117 -0
- package/browser/esm/{S2dNNx1a5ydRnARM.mjs → CfRqiPDg6RBTg1EN.mjs} +2 -2
- package/browser/esm/{ClbvFbFzFzXLBKNN.mjs → CndRBvVfQUJIYRRj.mjs} +50 -50
- package/browser/esm/{BnG31I6Oj_HEtSPS.mjs → CwOPLXU3-9ZHGyOT.mjs} +1 -1
- package/browser/esm/{CHU6iu_WGlm7fLET.mjs → Cxjxk0ncRKx80I-w.mjs} +1 -1
- package/browser/esm/D2RZh0O9neOsyLAE.mjs +281 -0
- package/browser/esm/{BkBhLS0l6z8sxI6D.mjs → D64dM68B1pKYFzdP.mjs} +2 -2
- package/browser/esm/{BVDiOXGMc5_FMGfy.mjs → D9xNz46kAfXMZzp4.mjs} +2 -2
- package/browser/esm/{zlLuW405RSguy4Kn.mjs → DK899HhWX1HINMC1.mjs} +53 -53
- package/browser/esm/{B7aUIvgUjncMMD_i.mjs → DPhGQLNGmDZwODwJ.mjs} +5 -4
- package/browser/esm/{gssVX_FH1XFN-twD.mjs → DVroRnhi-5IDXNgM.mjs} +1 -1
- package/{node/esm/CZICGK_ss0HoGHCP.mjs → browser/esm/DZiivy0NmO1Vnyzk.mjs} +2 -2
- package/browser/esm/{ClPfI4lODvCece29.mjs → DgrAuRD2qr2DvFeJ.mjs} +61 -61
- package/browser/esm/{CU3DmJ-YnVVrC1_k.mjs → DobHLF6VjHr7Xi40.mjs} +1 -1
- package/browser/esm/{CaB7J-xgfKO2uAkG.mjs → DwZCT7DZiiXoTweg.mjs} +2 -2
- package/browser/esm/{BMyDRQ716j79h_bH.mjs → DwwR3O2sEZApPSTF.mjs} +6 -6
- package/browser/esm/{DLLE0FZNsKxbBzRn.mjs → Tah7cnFb_HNZdLtj.mjs} +45 -45
- package/browser/esm/{Dlmig06rIo7cInRk.mjs → fXWUMDhZ5yMSO629.mjs} +1 -1
- package/browser/esm/{DWNzqw7DUKwoxjri.mjs → hCQJcmIzPDxDEv2q.mjs} +2 -2
- package/browser/esm/index.mjs +679 -542
- package/browser/esm/{BFagR2JeWs74iAG3.mjs → qO-ujUrgq6H3TQix.mjs} +1 -1
- package/browser/esm/w6Jea0TiclPrYZ2M.mjs +1703 -0
- package/browser/esm/yuhcOYw6SHQ-RCm3.mjs +114 -0
- package/node/esm/-TA0MneBDKdGhsib.mjs +8668 -0
- package/node/esm/{B21JjOLghRoDOrkx.mjs → B-HUPAcqvK0eeeCz.mjs} +1 -1
- package/node/esm/{DNRhGK-8Tr9xcRyc.mjs → BL2iiEoqxDEV2Xrg.mjs} +3 -3
- package/node/esm/{D1TKBVmoKGAXf37B.mjs → BNXLOEddJ6O9gYws.mjs} +2 -2
- package/node/esm/{BrCKGFRsX_ezFJ4B.mjs → BSvOluusoDM4z_dx.mjs} +15 -15
- package/node/esm/{BIwObuhTJYf0jpUa.mjs → BskP3b8vUoIOGLY6.mjs} +2 -2
- package/node/esm/{2Kihw_-5lVTEnwMa.mjs → Btw4148Ot8ifhNc1.mjs} +1 -1
- package/node/esm/{BqiexuA89caYnAPz.mjs → C14-R6tifRh7pc0p.mjs} +1 -1
- package/node/esm/{DUTskXCXref-IJnI.mjs → C99zzq8DImQXi4BQ.mjs} +47 -47
- package/node/esm/{D8zEN-6ZdDqDvTxM.mjs → CBuEu5Jk-LfaDy-H.mjs} +61 -61
- package/node/esm/{yavzZOiZW_EjG9lE.mjs → CG-qBU5BAaVz7e-P.mjs} +1 -1
- package/node/esm/CPI58duc0j0a-HpJ.mjs +115 -0
- package/node/esm/{CCN5vD410obwdz38.mjs → CRt3vXe6YmXzqk3H.mjs} +15 -14
- package/node/esm/{CzXT00vrQa1_gvW9.mjs → C_aL7CGS1lrNn1Ng.mjs} +1 -1
- package/node/esm/{CZiqiay42tFTrLI4.mjs → C_xf5Bz30VqiJjXn.mjs} +1 -1
- package/node/esm/{BIRq1kT7lLRzns9t.mjs → CiIymQN6aJCul62g.mjs} +9 -9
- package/node/esm/{CNCNJNg890KdgkWh.mjs → Ci_zLYmCD7e-C79O.mjs} +1 -1
- package/{browser/esm/D5np__Jb1euAyaLw.mjs → node/esm/CkRYLed8Mmn3giNg.mjs} +2 -2
- package/node/esm/D3ptRKzASqBut1DE.mjs +117 -0
- package/node/esm/{cGwrLA1RCE-WhJ7w.mjs → D4ROK9UwDpS6jO3Z.mjs} +1 -1
- package/node/esm/{mFiBSM7XgBHV9AY7.mjs → D8hO07ToAibIuniw.mjs} +1535 -1531
- package/node/esm/{CDHdgJXH2vS71WMc.mjs → DUTmDHbFbhLDT4F3.mjs} +1 -1
- package/node/esm/{CGp6VZL-gZa9Uezx.mjs → DV5CU37aEbFbWFL0.mjs} +1 -1
- package/node/esm/{De2IONBxQhz-Qbyh.mjs → DdoiuKg9BKubtF1V.mjs} +1 -1
- package/node/esm/{Db0v7zXNnyjBIjjI.mjs → DggQ23jKMpwhENfa.mjs} +2 -2
- package/node/esm/{CwePQwTILHHjGDkZ.mjs → DhS6yWjrrSNIJMsn.mjs} +204 -204
- package/node/esm/{D_t5AUxSm7_icjzq.mjs → DhTya_mhmN53vskv.mjs} +1 -1
- package/node/esm/{DOU54VsOjG-m-NyQ.mjs → Dn1M7YWi25DeeYUb.mjs} +1 -1
- package/node/esm/{DkwIPzKc3UwdUIfM.mjs → DrCf6ITcBhVOFpRj.mjs} +6 -6
- package/node/esm/{D2KBymQJd1XhpeQD.mjs → DxazKtROyaI51dWl.mjs} +1 -1
- package/node/esm/{D6e2z7eZpxOJXHc7.mjs → Q_S1g46ZOTrdhTae.mjs} +1 -1
- package/node/esm/{OVfaSb506tNSIvbv.mjs → Vocy-I9dKzZMr0Ct.mjs} +19038 -16822
- package/node/esm/ZXPFcsT2zrALCZux.mjs +289 -0
- package/node/esm/{857CIBgQgGpnqrXk.mjs → eimUGjiIP-b8HiM6.mjs} +55 -55
- package/node/esm/{Bbf1Pm9Gk7YpLTvg.mjs → icn2nX5Z8e_3mNAv.mjs} +1 -1
- package/node/esm/index.mjs +740 -603
- package/node/esm/{Ct3h15sCus4Tgt6M.mjs → lGJ42sHqg5if2bba.mjs} +624 -616
- package/node/esm/{CdJHUJSBRHZoryPe.mjs → pYtP7wPyS96NQyXS.mjs} +59 -59
- package/package.json +6 -6
- package/resources/locales/de/model.msg.json +8 -2
- package/resources/locales/en/model.msg.json +9 -2
- package/types/scripting-api.json +10619 -10446
- package/types/scripting-enums.json +20 -1
- package/types/scripting.d.ts +1233 -296
- package/types/src/{sheet → anomalies}/_Anomalies.d.ts +3 -3
- package/types/src/anomalies/_FocusTable.d.ts +11 -0
- package/types/src/{sheet/_AnomalyFormulaChecks.d.ts → anomalies/_FormulaChecks.d.ts} +10 -2
- package/types/src/{sheet/_AnomalyLabelChecks.d.ts → anomalies/_LabelChecks.d.ts} +1 -1
- package/types/src/anomalies/_LiteralChecks.d.ts +35 -0
- package/types/src/anomalies/_SeriesChecks.d.ts +13 -0
- package/types/src/calculation/Calculation.d.ts +47 -9
- package/types/src/calculation/ExternalBookBindings.d.ts +2 -3
- package/types/src/calculation/ICalculation.d.ts +96 -9
- package/types/src/calculation/NamedFormulaCollection.d.ts +104 -8
- package/types/src/calculation/_CloneBoundary.d.ts +1 -1
- package/types/src/calculation/compiler/ASTTypes.d.ts +6 -2
- package/types/src/calculation/compiler/Types.d.ts +8 -0
- package/types/src/calculation/engine/CalcBackend.d.ts +104 -6
- package/types/src/calculation/executor/CalcExecutor.d.ts +73 -22
- package/types/src/calculation/executor/CalcExecutorUtils.d.ts +17 -1
- package/types/src/calculation/executor/_WhatIf.d.ts +50 -0
- package/types/src/calculation/formula/FormulaBlock.d.ts +4 -3
- package/types/src/calculation/formula/IFormulaBlock.d.ts +5 -0
- package/types/src/calculation/functions/_DataTableFunction.d.ts +14 -0
- package/types/src/calculation/grid/CalcGrid.d.ts +4 -6
- package/types/src/calculation/grid/CalcGridBackend.d.ts +5 -27
- package/types/src/calculation/grid/CalcGridProxy.d.ts +0 -2
- package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
- package/types/src/calculation/grid/ICalcGrid.d.ts +16 -12
- package/types/src/calculation/grid/_CalcRequest.d.ts +17 -5
- package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
- package/types/src/calculation/spatial/SpillEntry.d.ts +16 -2
- package/types/src/calculation/state/CalcNode.d.ts +0 -1
- package/types/src/calculation/state/CalcScope.d.ts +29 -0
- package/types/src/calculation/state/CalcState.d.ts +26 -4
- package/types/src/calculation/state/CalculationContext.d.ts +28 -1
- package/types/src/calculation/state/DeferredCalls.d.ts +260 -0
- package/types/src/calculation/state/IContextContainer.d.ts +20 -0
- package/types/src/calculation/state/_PendingOverlayGrid.d.ts +6 -0
- package/types/src/calculation/state/_WhatIfLayer.d.ts +91 -0
- package/types/src/cell/ICell.d.ts +53 -34
- package/types/src/cellControl/CellControl.d.ts +67 -0
- package/types/src/cellControl/CellControlCollection.d.ts +29 -0
- package/types/src/cellControl/CellControlRegistry.d.ts +47 -0
- package/types/src/cellControl/ICellControl.d.ts +99 -0
- package/types/src/cellControl/ICellControlCollection.d.ts +67 -0
- package/types/src/cellControl/index.d.ts +4 -0
- package/types/src/cellRange/ICellRange.d.ts +207 -59
- package/types/src/cellRange/ICellRanges.d.ts +4 -3
- package/types/src/chart/layout/ChartLayout.d.ts +5 -1
- package/types/src/chart/resolve/_Resolve.d.ts +10 -0
- package/types/src/chart/resolve/_ResolvedChart.d.ts +5 -2
- package/types/src/collections/ISparseGrid.d.ts +11 -2
- package/types/src/collections/MixedTypedArrayList.d.ts +8 -2
- package/types/src/collections/SparseGrid.d.ts +3 -8
- package/types/src/condition/AnchoredConditional.d.ts +2 -2
- package/types/src/externalBook/IExternalBook.d.ts +3 -4
- package/types/src/fetch/Fetcher.d.ts +15 -0
- package/types/src/fetch/IFetcher.d.ts +47 -0
- package/types/src/fetch/_WorkbookFetch.d.ts +43 -0
- package/types/src/fetch/index.d.ts +3 -0
- package/types/src/fill/PaintUtils.d.ts +3 -1
- package/types/src/hyperlink/IHyperlink.d.ts +10 -0
- package/types/src/hyperlink/_Hyperlink.d.ts +4 -1
- package/types/src/index.d.ts +2 -1
- package/types/src/named/INamedCollection.d.ts +36 -0
- package/types/src/named/NamedCollection.d.ts +18 -0
- package/types/src/primitives/AsyncValue.d.ts +58 -0
- package/types/src/resource/IResource.d.ts +9 -0
- package/types/src/resource/IResourceCollection.d.ts +4 -0
- package/types/src/resource/Resource.d.ts +2 -0
- package/types/src/resource/_AddResource.d.ts +13 -0
- package/types/src/richData/CellImage.d.ts +95 -0
- package/types/src/richData/Hyperlink.d.ts +49 -0
- package/types/src/richData/IRichDataCollection.d.ts +76 -0
- package/types/src/richData/IRichDataKind.d.ts +55 -11
- package/types/src/richData/RichArray.d.ts +42 -0
- package/types/src/richData/RichDataCollection.d.ts +23 -0
- package/types/src/richData/RichDataRegistry.d.ts +46 -14
- package/types/src/richData/RichDataValues.d.ts +20 -0
- package/types/src/richData/RichRecord.d.ts +68 -0
- package/types/src/richData/RichText.d.ts +5 -5
- package/types/src/richData/index.d.ts +6 -0
- package/types/src/scripting/FunctionArguments.d.ts +17 -1
- package/types/src/scripting/FunctionCollection.d.ts +8 -0
- package/types/src/scripting/Scripts.d.ts +10 -0
- package/types/src/scripting/TypedFunction.d.ts +2 -0
- package/types/src/sheet/ICellContainerOptions.d.ts +6 -0
- package/types/src/sheet/IWorksheet.d.ts +24 -17
- package/types/src/sheet/SheetCell.d.ts +17 -1
- package/types/src/sheet/SheetRange.d.ts +8 -2
- package/types/src/sheet/SheetRanges.d.ts +2 -2
- package/types/src/sheet/Worksheet.d.ts +110 -56
- package/types/src/sheet/_ListenerAnchor.d.ts +7 -1
- package/types/src/sheet/_ScalarListFactory.d.ts +54 -6
- package/types/src/sheet/_SheetMutations.d.ts +4 -1
- package/types/src/sheet/_SheetStateTypes.d.ts +23 -11
- package/types/src/workbook/IWorkbook.d.ts +40 -1
- package/types/src/workbook/Workbook.d.ts +25 -3
- package/types/src/workbook/WorkbookRanges.d.ts +1 -1
- package/browser/esm/BGOFfpxr2jPIdqmV.mjs +0 -40
- package/browser/esm/f1IoRb7tEb0QmCSt.mjs +0 -110
- package/browser/esm/nvU0ClAbf0g94YBK.mjs +0 -1695
- package/node/esm/B084DssTcdBheTp_.mjs +0 -7966
- package/node/esm/Df1bL6VFvrqIdSLB.mjs +0 -40
- package/node/esm/DrTZbfemSLq2mseG.mjs +0 -111
- package/types/src/dataTable/DataTable.d.ts +0 -67
- package/types/src/dataTable/DataTableCollection.d.ts +0 -19
- package/types/src/dataTable/IDataTable.d.ts +0 -99
- package/types/src/dataTable/IDataTableCollection.d.ts +0 -18
- package/types/src/dataTable/index.d.ts +0 -6
package/browser/esm/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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.12
|
|
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 { a as e, l as t, o as n, t as r, u as i } from "./
|
|
8
|
-
import {
|
|
9
|
-
import { $t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { t as
|
|
7
|
+
import { a as e, l as t, o as n, t as r, u as i } from "./DobHLF6VjHr7Xi40.mjs";
|
|
8
|
+
import { $t as a, A as o, Ai as s, Ar as c, Br as l, Bt as u, C as d, Ci as f, Cr as p, Ct as m, D as h, Di as g, Dt as _, E as v, Ei as y, Et as b, F as x, Fi as S, Fr as C, Ft as w, Gr as ee, Hr as te, Ht as ne, I as re, Ii as ie, Ir as ae, It as oe, Jr as se, Jt as ce, Kr as le, Kt as ue, L as de, Li as fe, Lr as pe, Mi as me, Mn as he, Mr as ge, Ni as _e, Nn as ve, Nr as ye, Nt as be, O as xe, Oi as Se, Ot as Ce, P as we, Pi as Te, Pr as Ee, Pt as De, Qt as Oe, Ri as ke, Rr as Ae, Rt as je, S as Me, Si as Ne, Sr as Pe, T as Fe, Ti as Ie, Tn as Le, Tt as Re, Ur as ze, Ut as Be, Vr as Ve, Vt as He, Wr as Ue, Wt as We, Xt as Ge, Yr as Ke, Yt as qe, Zt as Je, _a as Ye, _i as T, a as Xe, b as E, bi as Ze, ca as Qe, cn as D, da as $e, di as et, dn as tt, en as nt, fa as rt, fi as it, fn as at, ga as O, ha as ot, i as st, j as ct, jn as lt, jr as ut, k as dt, ki as ft, kr as pt, kt as mt, la as ht, ma as gt, nn as _t, oa as vt, on as yt, pa as bt, pn as xt, qr as St, qt as Ct, r as wt, ri as Tt, si as Et, sn as Dt, ta as Ot, ti as kt, tn as k, ua as At, ui as jt, un as Mt, v as Nt, va as Pt, vi as Ft, w as A, wi as It, wn as Lt, wt as Rt, x as zt, xi as Bt, xr as Vt, y as j, ya as Ht, yi as Ut, zi as Wt, zr as Gt, zt as Kt } from "./BudSIfXBAsTxvu-K.mjs";
|
|
9
|
+
import { $t as qt, B as Jt, Ct as Yt, E as Xt, Gt as Zt, H as Qt, I as $t, Kt as en, L as tn, O as nn, Qt as rn, R as an, St as on, V as sn, W as cn, Yt as M, at as ln, ct as un, dt as dn, en as N, ft as P, lt as fn, ot as pn, qt as F, rt as mn, st as hn, ut as gn, z as _n } from "./Bg5Di9GLNAkbqQ1P.mjs";
|
|
10
|
+
import { n as vn, t as yn } from "./DwwR3O2sEZApPSTF.mjs";
|
|
11
|
+
import { t as bn } from "./DVroRnhi-5IDXNgM.mjs";
|
|
12
12
|
import { FormulaError as I, ScalarType as L } from "@sheetxl/primitives";
|
|
13
|
-
import { BufferUtils as
|
|
13
|
+
import { BufferUtils as xn, CommonUtils as R, CoordUtils as z, DOMUtils as Sn, DefaultLanguagePackService as Cn, ExpectedError as B, InvalidPasswordError as wn, MimeType as Tn, Notifier as En, NullNotAllowedError as Dn, OutOfBoundsError as V, PasswordRequiredError as On, ProtectedError as H, UndoManager as kn, messageKey as U, t as W } from "@sheetxl/utils";
|
|
14
14
|
export * from "@sheetxl/primitives";
|
|
15
15
|
export * from "@sheetxl/utils";
|
|
16
|
-
var
|
|
16
|
+
var An, jn = class extends kn {
|
|
17
17
|
constructor(e, t = 50) {
|
|
18
18
|
super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
|
|
19
19
|
}
|
|
@@ -98,14 +98,14 @@ var vn, yn = class extends _n {
|
|
|
98
98
|
return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
|
|
99
99
|
}
|
|
100
100
|
getUndoEntries() {
|
|
101
|
-
return this._undoCommits().map(
|
|
101
|
+
return this._undoCommits().map(Nn);
|
|
102
102
|
}
|
|
103
103
|
getRedoEntries() {
|
|
104
|
-
let e = this._redoCommits().map(
|
|
104
|
+
let e = this._redoCommits().map(Nn);
|
|
105
105
|
return e.length === 0 && this._repeatOperation !== null && e.push({
|
|
106
106
|
description: this._repeatOperation.description,
|
|
107
107
|
author: null,
|
|
108
|
-
meta:
|
|
108
|
+
meta: Mn
|
|
109
109
|
}), Object.freeze(e);
|
|
110
110
|
}
|
|
111
111
|
addUndoOperation() {
|
|
@@ -117,11 +117,11 @@ var vn, yn = class extends _n {
|
|
|
117
117
|
close() {
|
|
118
118
|
this._removeListener?.();
|
|
119
119
|
}
|
|
120
|
-
},
|
|
120
|
+
}, Mn = Object.freeze({}), Nn = (e) => ({
|
|
121
121
|
description: e.getDescription(),
|
|
122
122
|
author: e.getAuthor(),
|
|
123
|
-
meta: e.getMeta() ??
|
|
124
|
-
}),
|
|
123
|
+
meta: e.getMeta() ?? Mn
|
|
124
|
+
}), Pn = class {
|
|
125
125
|
constructor(t, n) {
|
|
126
126
|
this._dirty = !1, this._store = t, this._savedCommitId = t.getCurrentCommit()?.getId() ?? null, this._emitter = new e(this);
|
|
127
127
|
let r = this;
|
|
@@ -159,8 +159,8 @@ var vn, yn = class extends _n {
|
|
|
159
159
|
this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
|
-
|
|
163
|
-
var
|
|
162
|
+
An ||= {};
|
|
163
|
+
var Fn, G = class t {
|
|
164
164
|
constructor(n, r = {}) {
|
|
165
165
|
this._password = null, this._emitter = new e(this), this._path = n ?? null, this._name = r.name ?? null, this._format = r.format ?? null, this._size = r.size ?? null, this._lastModified = r.lastModified ?? null, this._canWrite = r.canWrite ?? t._defaultCanWrite(this._path), this._encryption = r.encryption ?? null;
|
|
166
166
|
}
|
|
@@ -173,7 +173,7 @@ var Cn, K = class t {
|
|
|
173
173
|
getName() {
|
|
174
174
|
if (this._name !== null && this._name !== void 0) return this._name;
|
|
175
175
|
let e = this._cleanPath();
|
|
176
|
-
return e &&
|
|
176
|
+
return e && ot(e) || null;
|
|
177
177
|
}
|
|
178
178
|
getPath() {
|
|
179
179
|
return this._path;
|
|
@@ -184,7 +184,7 @@ var Cn, K = class t {
|
|
|
184
184
|
getExtension() {
|
|
185
185
|
let e = this._cleanPath();
|
|
186
186
|
if (!e) return null;
|
|
187
|
-
let t =
|
|
187
|
+
let t = O(e);
|
|
188
188
|
return t ? t.toLowerCase() : null;
|
|
189
189
|
}
|
|
190
190
|
getEncryption() {
|
|
@@ -234,26 +234,26 @@ var Cn, K = class t {
|
|
|
234
234
|
];
|
|
235
235
|
return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
|
|
236
236
|
}
|
|
237
|
-
},
|
|
237
|
+
}, K = /* @__PURE__ */ new WeakMap(), In = /* @__PURE__ */ new Set(), Ln = (e) => K.get(e) ?? null, Rn = () => Array.from(In, (e) => e.getOrigin()), zn = class t {
|
|
238
238
|
constructor(n) {
|
|
239
|
-
this._released = !1, t._assertFree(n), this._emitter = new e(this), this._origin = n,
|
|
239
|
+
this._released = !1, t._assertFree(n), this._emitter = new e(this), this._origin = n, K.set(n, this), In.add(this);
|
|
240
240
|
}
|
|
241
241
|
getOrigin() {
|
|
242
242
|
return this._origin;
|
|
243
243
|
}
|
|
244
244
|
setOrigin(e) {
|
|
245
|
-
e !== this._origin && (t._assertFree(e), this._released || (
|
|
245
|
+
e !== this._origin && (t._assertFree(e), this._released || (K.delete(this._origin), K.set(e, this)), this._origin = e, this._emitter.notify("onOriginChange"));
|
|
246
246
|
}
|
|
247
247
|
release() {
|
|
248
|
-
this._released || (this._released = !0,
|
|
248
|
+
this._released || (this._released = !0, K.get(this._origin) === this && K.delete(this._origin), In.delete(this));
|
|
249
249
|
}
|
|
250
250
|
addListeners(e, t) {
|
|
251
251
|
return this._emitter.addListeners(e, t);
|
|
252
252
|
}
|
|
253
253
|
static _assertFree(e) {
|
|
254
|
-
if (
|
|
254
|
+
if (K.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
|
|
255
255
|
}
|
|
256
|
-
},
|
|
256
|
+
}, Bn = class {
|
|
257
257
|
constructor() {
|
|
258
258
|
this._defaultStringSourceType = "filepath";
|
|
259
259
|
}
|
|
@@ -271,10 +271,10 @@ var Cn, K = class t {
|
|
|
271
271
|
}
|
|
272
272
|
switch (o) {
|
|
273
273
|
case "file": {
|
|
274
|
-
let e = n, r = e?.name, o = r ? `${
|
|
274
|
+
let e = n, r = e?.name, o = r ? `${ot(r)}` : "";
|
|
275
275
|
s = await e.arrayBuffer(), c = {
|
|
276
276
|
format: a,
|
|
277
|
-
ext:
|
|
277
|
+
ext: O(r),
|
|
278
278
|
name: o,
|
|
279
279
|
absolutePath: r,
|
|
280
280
|
size: e.size,
|
|
@@ -298,7 +298,7 @@ var Cn, K = class t {
|
|
|
298
298
|
let [, t] = n.split(",");
|
|
299
299
|
e = t;
|
|
300
300
|
} else e = n;
|
|
301
|
-
s =
|
|
301
|
+
s = xn.base64ToArrayBuffer(e), c = {
|
|
302
302
|
format: a,
|
|
303
303
|
size: e.length
|
|
304
304
|
};
|
|
@@ -314,7 +314,7 @@ var Cn, K = class t {
|
|
|
314
314
|
e = i.input, t = i.init, r = i.timeout;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d =
|
|
317
|
+
let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d = O(u);
|
|
318
318
|
try {
|
|
319
319
|
let n = await fetch(e, {
|
|
320
320
|
...t,
|
|
@@ -326,7 +326,7 @@ var Cn, K = class t {
|
|
|
326
326
|
s = r, c = {
|
|
327
327
|
format: a,
|
|
328
328
|
ext: d,
|
|
329
|
-
name:
|
|
329
|
+
name: ot(u, !0),
|
|
330
330
|
absolutePath: u
|
|
331
331
|
};
|
|
332
332
|
} catch (e) {
|
|
@@ -366,7 +366,7 @@ var Cn, K = class t {
|
|
|
366
366
|
return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
|
|
367
367
|
}
|
|
368
368
|
findOpenPath(e, t) {
|
|
369
|
-
return
|
|
369
|
+
return Rn().find((n) => {
|
|
370
370
|
if (n === t || !n.canWrite()) return !1;
|
|
371
371
|
let r = n.getPath();
|
|
372
372
|
return !!r && this.isSamePath(r, e);
|
|
@@ -397,21 +397,21 @@ var Cn, K = class t {
|
|
|
397
397
|
}
|
|
398
398
|
if (typeof File < "u" && e instanceof File) return "file";
|
|
399
399
|
if (typeof Blob < "u" && e instanceof Blob) return "blob";
|
|
400
|
-
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r =
|
|
400
|
+
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = xn.isNodeBuffer(e);
|
|
401
401
|
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;
|
|
402
402
|
}
|
|
403
|
-
},
|
|
403
|
+
}, Vn = class extends Bn {
|
|
404
404
|
constructor(e, t) {
|
|
405
405
|
super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
|
|
406
406
|
}
|
|
407
407
|
async fileFromHandle(e) {
|
|
408
|
-
return
|
|
408
|
+
return Un(e) ? e.getFile() : null;
|
|
409
409
|
}
|
|
410
410
|
async resolveSource() {
|
|
411
411
|
let e = await this._getReadFormats?.() ?? [];
|
|
412
412
|
if (typeof globalThis.showOpenFilePicker == "function") try {
|
|
413
413
|
let t = function(e) {
|
|
414
|
-
let t =
|
|
414
|
+
let t = Hn(e);
|
|
415
415
|
if (t.length <= 1) return t;
|
|
416
416
|
let n = /* @__PURE__ */ new Set(), r = {};
|
|
417
417
|
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));
|
|
@@ -426,13 +426,13 @@ var Cn, K = class t {
|
|
|
426
426
|
throw e;
|
|
427
427
|
}
|
|
428
428
|
let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
|
|
429
|
-
return
|
|
429
|
+
return Sn.openFileDialog(t);
|
|
430
430
|
}
|
|
431
431
|
async findOpenOrigin(e) {
|
|
432
|
-
return
|
|
432
|
+
return Un(e) ? this._findOpenHandle(e) : null;
|
|
433
433
|
}
|
|
434
434
|
async _findOpenHandle(e, t) {
|
|
435
|
-
for (let n of
|
|
435
|
+
for (let n of Rn()) {
|
|
436
436
|
if (n === t || !n.canWrite()) continue;
|
|
437
437
|
let r = this._handleCache.get(n);
|
|
438
438
|
if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
|
|
@@ -440,7 +440,7 @@ var Cn, K = class t {
|
|
|
440
440
|
return null;
|
|
441
441
|
}
|
|
442
442
|
async onWorkbookRead(e, t) {
|
|
443
|
-
if (!
|
|
443
|
+
if (!Un(t)) return;
|
|
444
444
|
let n = e.getOrigin?.();
|
|
445
445
|
n?.canWrite() && this._handleCache.set(n, t);
|
|
446
446
|
}
|
|
@@ -467,18 +467,18 @@ var Cn, K = class t {
|
|
|
467
467
|
if (!a) {
|
|
468
468
|
c = await globalThis.showSaveFilePicker({
|
|
469
469
|
suggestedName: n,
|
|
470
|
-
types:
|
|
470
|
+
types: Hn(o)
|
|
471
471
|
});
|
|
472
472
|
let t = await this._findOpenHandle(c, e.workbook?.getOrigin?.());
|
|
473
|
-
if (t) throw new B(
|
|
473
|
+
if (t) throw new B(W("error.io.openElsewhere", { name: t.getName() ?? c.name ?? "" }));
|
|
474
474
|
}
|
|
475
|
-
let s =
|
|
475
|
+
let s = Gn(c.name ?? n), l = o.find((e) => e.exts.some((e) => e.toLowerCase() === s)) ?? r, u = a ? t : new G(c.name ?? n, {
|
|
476
476
|
format: l.key,
|
|
477
477
|
canWrite: !0
|
|
478
478
|
}), d = await i(l.key, u);
|
|
479
479
|
if (!d) return null;
|
|
480
|
-
let f = new Blob([
|
|
481
|
-
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof
|
|
480
|
+
let f = new Blob([Wn(d)], { type: l.mimeType || "application/octet-stream" }), p = await c.createWritable();
|
|
481
|
+
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof G) {
|
|
482
482
|
let e = await Promise.resolve(c.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
|
|
483
483
|
u.update({
|
|
484
484
|
size: f.size,
|
|
@@ -490,19 +490,19 @@ var Cn, K = class t {
|
|
|
490
490
|
if (e?.name === "AbortError") return null;
|
|
491
491
|
if (e instanceof B) throw e;
|
|
492
492
|
}
|
|
493
|
-
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() ===
|
|
493
|
+
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() === Gn(u)) ? u : n, f = l !== d || t.canWrite() ? new G(d, {
|
|
494
494
|
format: r.key,
|
|
495
495
|
canWrite: !1
|
|
496
496
|
}) : t, p = await i(r.key, f);
|
|
497
497
|
if (!p) return null;
|
|
498
|
-
let m = new Blob([
|
|
498
|
+
let m = new Blob([Wn(p)], { type: r.mimeType || "application/octet-stream" });
|
|
499
499
|
return function(e, t) {
|
|
500
500
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
501
501
|
r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
502
|
-
}(m, d), f instanceof
|
|
502
|
+
}(m, d), f instanceof G && f.update({ size: m.size }), f;
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
|
-
function
|
|
505
|
+
function Hn(e) {
|
|
506
506
|
return e.map((e) => {
|
|
507
507
|
let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
|
|
508
508
|
return {
|
|
@@ -511,27 +511,27 @@ function An(e) {
|
|
|
511
511
|
};
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function Un(e) {
|
|
515
515
|
return !!e && e.kind === "file" && typeof e.getFile == "function";
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Wn(e) {
|
|
518
518
|
if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
|
|
519
519
|
let t = new ArrayBuffer(e.byteLength);
|
|
520
520
|
return new Uint8Array(t).set(new Uint8Array(e)), t;
|
|
521
521
|
}
|
|
522
522
|
return e;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function Gn(e) {
|
|
525
525
|
let t = e.lastIndexOf(".");
|
|
526
526
|
return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
527
527
|
}
|
|
528
|
-
(
|
|
528
|
+
(Fn ||= {}).SortOn = {
|
|
529
529
|
Value: "value",
|
|
530
530
|
FillColor: "fillColor",
|
|
531
531
|
FontColor: "fontColor",
|
|
532
532
|
Icon: "icon"
|
|
533
533
|
};
|
|
534
|
-
var
|
|
534
|
+
var Kn = {
|
|
535
535
|
TopLeft: "tl",
|
|
536
536
|
Top: "t",
|
|
537
537
|
TopRight: "tr",
|
|
@@ -541,53 +541,53 @@ var Pn = {
|
|
|
541
541
|
BottomLeft: "bl",
|
|
542
542
|
Bottom: "b",
|
|
543
543
|
BottomRight: "br"
|
|
544
|
-
},
|
|
545
|
-
[
|
|
546
|
-
[
|
|
547
|
-
[
|
|
548
|
-
[
|
|
549
|
-
[
|
|
550
|
-
[
|
|
551
|
-
[
|
|
552
|
-
[
|
|
553
|
-
[
|
|
554
|
-
[
|
|
555
|
-
[
|
|
556
|
-
[
|
|
557
|
-
[
|
|
558
|
-
[
|
|
559
|
-
[
|
|
560
|
-
[
|
|
561
|
-
[
|
|
562
|
-
[
|
|
563
|
-
[
|
|
564
|
-
[
|
|
565
|
-
[
|
|
566
|
-
},
|
|
567
|
-
function
|
|
568
|
-
let t =
|
|
544
|
+
}, q = ln.BuiltInName, qn = {
|
|
545
|
+
[q.Normal]: U("style.builtin.normal"),
|
|
546
|
+
[q.Comma]: U("style.builtin.comma"),
|
|
547
|
+
[q.Currency]: U("style.builtin.currency"),
|
|
548
|
+
[q.Percent]: U("style.builtin.percent"),
|
|
549
|
+
[q.Comma0]: U("style.builtin.comma0"),
|
|
550
|
+
[q.Currency0]: U("style.builtin.currency0"),
|
|
551
|
+
[q.Hyperlink]: U("style.builtin.hyperlink"),
|
|
552
|
+
[q.FollowedHyperlink]: U("style.builtin.followedHyperlink"),
|
|
553
|
+
[q.Note]: U("style.builtin.note"),
|
|
554
|
+
[q.WarningText]: U("style.builtin.warningText"),
|
|
555
|
+
[q.Title]: U("style.builtin.title"),
|
|
556
|
+
[q.Input]: U("style.builtin.input"),
|
|
557
|
+
[q.Output]: U("style.builtin.output"),
|
|
558
|
+
[q.Calculation]: U("style.builtin.calculation"),
|
|
559
|
+
[q.CheckCell]: U("style.builtin.checkCell"),
|
|
560
|
+
[q.LinkedCell]: U("style.builtin.linkedCell"),
|
|
561
|
+
[q.Total]: U("style.builtin.total"),
|
|
562
|
+
[q.Good]: U("style.builtin.good"),
|
|
563
|
+
[q.Bad]: U("style.builtin.bad"),
|
|
564
|
+
[q.Neutral]: U("style.builtin.neutral"),
|
|
565
|
+
[q.ExplanatoryText]: U("style.builtin.explanatoryText")
|
|
566
|
+
}, Jn = U("style.builtin.heading"), Yn = U("style.builtin.accent"), Xn = U("style.builtin.accentTint"), Zn = /^Heading ([1-4])$/, Qn = /^Accent([1-6])$/, $n = /^(20|40|60)% - Accent([1-6])$/;
|
|
567
|
+
function er(e) {
|
|
568
|
+
let t = qn[e];
|
|
569
569
|
if (t) return { key: t };
|
|
570
|
-
let n =
|
|
570
|
+
let n = Zn.exec(e);
|
|
571
571
|
return n ? {
|
|
572
|
-
key:
|
|
572
|
+
key: Jn,
|
|
573
573
|
params: { n: +n[1] }
|
|
574
|
-
} : (n =
|
|
575
|
-
key:
|
|
574
|
+
} : (n = Qn.exec(e), n ? {
|
|
575
|
+
key: Yn,
|
|
576
576
|
params: { n: +n[1] }
|
|
577
|
-
} : (n =
|
|
578
|
-
key:
|
|
577
|
+
} : (n = $n.exec(e), n ? {
|
|
578
|
+
key: Xn,
|
|
579
579
|
params: {
|
|
580
580
|
pct: +n[1],
|
|
581
581
|
n: +n[2]
|
|
582
582
|
}
|
|
583
583
|
} : null));
|
|
584
584
|
}
|
|
585
|
-
var
|
|
585
|
+
var tr, nr, rr, ir, ar = (e, t, n, r, i) => {
|
|
586
586
|
let a = JSON.parse(JSON.stringify(e.definition));
|
|
587
587
|
a.adjs ||= [];
|
|
588
588
|
let o = "", s = 0, c = 0;
|
|
589
|
-
t > 0 ? (c = t, s = 100 - t, o =
|
|
590
|
-
let l = new
|
|
589
|
+
t > 0 ? (c = t, s = 100 - t, o = W("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = W("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [dn.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [dn.AdjustmentType.LumOff]: c });
|
|
590
|
+
let l = new fn({
|
|
591
591
|
val: a.val,
|
|
592
592
|
adjs: a.adjs
|
|
593
593
|
}, n), u = l.toString();
|
|
@@ -598,14 +598,14 @@ var Un, Wn, Gn, Kn, qn = (e, t, n, r, i) => {
|
|
|
598
598
|
definition: a
|
|
599
599
|
};
|
|
600
600
|
};
|
|
601
|
-
function
|
|
601
|
+
function or(e, t, n, r) {
|
|
602
602
|
let i = [];
|
|
603
603
|
for (let a = 0; a < e.length; a++) {
|
|
604
604
|
let o = [];
|
|
605
605
|
i.push(o);
|
|
606
606
|
let s = (i) => {
|
|
607
|
-
for (let s = 0; s < i.length; s++) o.push(
|
|
608
|
-
}, c = new
|
|
607
|
+
for (let s = 0; s < i.length; s++) o.push(ar(e[a], i[s], t, n, r));
|
|
608
|
+
}, c = new fn({
|
|
609
609
|
val: e[a].definition.val,
|
|
610
610
|
adjs: e[a].definition.adjs
|
|
611
611
|
}, t).toHSLA().lum;
|
|
@@ -643,28 +643,28 @@ function Jn(e, t, n, r) {
|
|
|
643
643
|
}
|
|
644
644
|
return i;
|
|
645
645
|
}
|
|
646
|
-
(
|
|
647
|
-
var
|
|
648
|
-
function
|
|
649
|
-
if (!
|
|
650
|
-
let e = import("./
|
|
646
|
+
(tr ||= {}).buildPalette = or, nr ||= {}, rr ||= {}, ir ||= {};
|
|
647
|
+
var sr, J = null;
|
|
648
|
+
function cr() {
|
|
649
|
+
if (!J) {
|
|
650
|
+
let e = import("./Tah7cnFb_HNZdLtj.mjs").then(({ initializeFunctions: e }) => {
|
|
651
651
|
let t = e(() => null);
|
|
652
652
|
return Object.freeze(Array.from(t.keys()));
|
|
653
653
|
});
|
|
654
654
|
e.catch(() => {
|
|
655
|
-
|
|
656
|
-
}),
|
|
655
|
+
J = null;
|
|
656
|
+
}), J = e;
|
|
657
657
|
}
|
|
658
|
-
return
|
|
658
|
+
return J;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
return
|
|
660
|
+
function lr(e) {
|
|
661
|
+
return ve.peek()?.readFormulaLiteral(e);
|
|
662
662
|
}
|
|
663
|
-
function
|
|
664
|
-
let n =
|
|
663
|
+
function ur(e, t) {
|
|
664
|
+
let n = dr(e), r = dr(t);
|
|
665
665
|
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 : I.isError(e) && I.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function dr(e) {
|
|
668
668
|
if (e === null) return 0;
|
|
669
669
|
switch (typeof e) {
|
|
670
670
|
case "number": return 1;
|
|
@@ -675,13 +675,13 @@ function $n(e) {
|
|
|
675
675
|
}
|
|
676
676
|
(function(e) {
|
|
677
677
|
function t(e) {
|
|
678
|
-
return
|
|
678
|
+
return ve.peek()?.getFunctionDeclaration(e) ?? null;
|
|
679
679
|
}
|
|
680
680
|
e.get = t, e.has = function(e) {
|
|
681
681
|
return t(e) !== null;
|
|
682
682
|
};
|
|
683
|
-
})(
|
|
684
|
-
var
|
|
683
|
+
})(sr ||= {});
|
|
684
|
+
var fr = class {
|
|
685
685
|
constructor(e) {
|
|
686
686
|
this._children = e;
|
|
687
687
|
}
|
|
@@ -726,19 +726,19 @@ var er = class {
|
|
|
726
726
|
let n = t[e].getSortedNumbers().getValues();
|
|
727
727
|
n.length > 0 && r.push(n);
|
|
728
728
|
}
|
|
729
|
-
e = new
|
|
729
|
+
e = new wt(function(e) {
|
|
730
730
|
let t = e.length;
|
|
731
|
-
if (t === 0) return
|
|
731
|
+
if (t === 0) return pr;
|
|
732
732
|
if (t === 1) return e[0];
|
|
733
733
|
let n = e[0];
|
|
734
|
-
for (let r = 1; r < t; r++) n =
|
|
734
|
+
for (let r = 1; r < t; r++) n = mr(n, e[r]);
|
|
735
735
|
return Object.freeze(n);
|
|
736
736
|
}(r)), this._sortedNumbers = e;
|
|
737
737
|
}
|
|
738
738
|
return e;
|
|
739
739
|
}
|
|
740
740
|
getRanked(e) {
|
|
741
|
-
return
|
|
741
|
+
return st(this._children, e, ur)[Symbol.iterator]();
|
|
742
742
|
}
|
|
743
743
|
getFrequencies(e) {
|
|
744
744
|
if (e) return this._mergeFrequencies(e);
|
|
@@ -746,7 +746,7 @@ var er = class {
|
|
|
746
746
|
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
747
747
|
}
|
|
748
748
|
_mergeFrequencies(e) {
|
|
749
|
-
let t = e?.keyFn ??
|
|
749
|
+
let t = e?.keyFn ?? p, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
|
|
750
750
|
for (let l = 0; l < a; l++) {
|
|
751
751
|
let a = i[l].getFrequencies(e);
|
|
752
752
|
o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
|
|
@@ -759,7 +759,7 @@ var er = class {
|
|
|
759
759
|
}) : c = !0, d = u.next();
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
return
|
|
762
|
+
return Pe.fromGroups(r, t, e, ur, o, s, c);
|
|
763
763
|
}
|
|
764
764
|
getTypedCounts(e) {
|
|
765
765
|
let t = this._typedCounts;
|
|
@@ -809,24 +809,24 @@ var er = class {
|
|
|
809
809
|
let a = n.numericalCount;
|
|
810
810
|
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));
|
|
811
811
|
}
|
|
812
|
-
return
|
|
812
|
+
return Xe(r);
|
|
813
813
|
}
|
|
814
|
-
},
|
|
815
|
-
function
|
|
814
|
+
}, pr = Object.freeze([]);
|
|
815
|
+
function mr(e, t) {
|
|
816
816
|
let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
|
|
817
817
|
for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
|
|
818
818
|
for (; a < n;) i[s++] = e[a++];
|
|
819
819
|
for (; o < r;) i[s++] = t[o++];
|
|
820
820
|
return i;
|
|
821
821
|
}
|
|
822
|
-
var
|
|
822
|
+
var hr, gr = class {
|
|
823
823
|
constructor(e, t) {
|
|
824
824
|
this._source = null, this.cacheId = e, this.part = t;
|
|
825
825
|
}
|
|
826
826
|
_hold(e) {
|
|
827
827
|
let t = this.part?.xml;
|
|
828
828
|
if (!t || this._source) return;
|
|
829
|
-
let n =
|
|
829
|
+
let n = Oe(t, "worksheetSource", "ref"), r = Oe(t, "worksheetSource", "sheet");
|
|
830
830
|
if (!n || !r || n.includes("#REF!")) return;
|
|
831
831
|
let i = e(r);
|
|
832
832
|
if (!i) return;
|
|
@@ -835,7 +835,7 @@ var rr, ir = class {
|
|
|
835
835
|
wired: null,
|
|
836
836
|
last: null
|
|
837
837
|
};
|
|
838
|
-
this._source = a, i(`${
|
|
838
|
+
this._source = a, i(`${et(r)}!${Je(n)}`, (e) => {
|
|
839
839
|
a.formula = e.formula;
|
|
840
840
|
let t = e.formula.getExpression();
|
|
841
841
|
a.wired ??= t, e.formula.hasRefError() || (a.last = t);
|
|
@@ -846,18 +846,18 @@ var rr, ir = class {
|
|
|
846
846
|
if (!e || !t?.formula) return e;
|
|
847
847
|
let n = t.formula.hasRefError() ? t.last : t.formula.getExpression();
|
|
848
848
|
if (n === null || n === t.wired) return e;
|
|
849
|
-
let r =
|
|
850
|
-
return r ?
|
|
849
|
+
let r = v(n);
|
|
850
|
+
return r ? nt(nt(e, "worksheetSource", "ref", a(r.reference)), "worksheetSource", "sheet", r.sheet) : nt(e, "worksheetSource", "ref", a(n));
|
|
851
851
|
}
|
|
852
852
|
toJSON(e) {
|
|
853
|
-
let t = { cacheId: this.cacheId }, n =
|
|
853
|
+
let t = { cacheId: this.cacheId }, n = k.toJSON(this.part, e);
|
|
854
854
|
if (n) {
|
|
855
855
|
let e = this.getXML();
|
|
856
856
|
e !== null && (n.xml = e), t.part = n;
|
|
857
857
|
}
|
|
858
858
|
return t;
|
|
859
859
|
}
|
|
860
|
-
},
|
|
860
|
+
}, _r = class {
|
|
861
861
|
constructor(e, t) {
|
|
862
862
|
this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
|
|
863
863
|
}
|
|
@@ -891,7 +891,7 @@ var rr, ir = class {
|
|
|
891
891
|
get isIPerson() {
|
|
892
892
|
return !0;
|
|
893
893
|
}
|
|
894
|
-
},
|
|
894
|
+
}, vr = class extends Ht {
|
|
895
895
|
constructor(e) {
|
|
896
896
|
super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
|
|
897
897
|
}
|
|
@@ -912,7 +912,7 @@ var rr, ir = class {
|
|
|
912
912
|
let e = this._byDisplayName.get(r);
|
|
913
913
|
if (e) return e;
|
|
914
914
|
}
|
|
915
|
-
let i = new
|
|
915
|
+
let i = new _r({
|
|
916
916
|
...t,
|
|
917
917
|
displayName: r,
|
|
918
918
|
id: n ?? R.uuidV4().toUpperCase()
|
|
@@ -955,7 +955,7 @@ var rr, ir = class {
|
|
|
955
955
|
get isIPersonCollection() {
|
|
956
956
|
return !0;
|
|
957
957
|
}
|
|
958
|
-
},
|
|
958
|
+
}, yr = (e, t) => {
|
|
959
959
|
let n = [0];
|
|
960
960
|
for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
|
|
961
961
|
let r = t.map((e) => ` ${((e) => {
|
|
@@ -967,7 +967,7 @@ var rr, ir = class {
|
|
|
967
967
|
return `${t + 1}:${e - n[t] + 1}`;
|
|
968
968
|
})(e.start)} ${e.code}: ${e.message}`), i = t.length;
|
|
969
969
|
return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
|
|
970
|
-
},
|
|
970
|
+
}, br = class {
|
|
971
971
|
constructor(t) {
|
|
972
972
|
this._options = t, this._emitter = new e(this), this._initState();
|
|
973
973
|
}
|
|
@@ -992,7 +992,7 @@ var rr, ir = class {
|
|
|
992
992
|
minify: !0,
|
|
993
993
|
...e
|
|
994
994
|
});
|
|
995
|
-
return t.module ? await D(
|
|
995
|
+
return t.module ? await D(tt.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
996
996
|
}
|
|
997
997
|
addModule(e, t, n) {
|
|
998
998
|
this._modules.add(e, t, n);
|
|
@@ -1014,7 +1014,7 @@ var rr, ir = class {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
async run(e, t) {
|
|
1016
1016
|
try {
|
|
1017
|
-
let n = typeof e == "string" ? await this.createModule({ source: e }) : await D(
|
|
1017
|
+
let n = typeof e == "string" ? await this.createModule({ source: e }) : await D(tt.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
|
|
1018
1018
|
return await this._runModule(n, r, t);
|
|
1019
1019
|
} catch (e) {
|
|
1020
1020
|
return {
|
|
@@ -1031,7 +1031,7 @@ var rr, ir = class {
|
|
|
1031
1031
|
};
|
|
1032
1032
|
let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
|
|
1033
1033
|
if (a.length > 0) {
|
|
1034
|
-
let e = Error(
|
|
1034
|
+
let e = Error(yr(t, a));
|
|
1035
1035
|
return e.diagnostics = a, {
|
|
1036
1036
|
ok: !1,
|
|
1037
1037
|
error: e,
|
|
@@ -1082,17 +1082,38 @@ var rr, ir = class {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
if (!i || i.length === 0) return R.EmptyArray;
|
|
1084
1084
|
let o = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1085
|
-
return o ?
|
|
1085
|
+
return o ? Mt(i, o) : i.sort((e, t) => {
|
|
1086
1086
|
let n = e.getName().toUpperCase(), r = t.getName().toUpperCase();
|
|
1087
1087
|
return n < r ? -1 : +(n > r);
|
|
1088
1088
|
}), n !== void 0 && i.length > n ? i.slice(0, n) : i;
|
|
1089
1089
|
}
|
|
1090
1090
|
async start() {
|
|
1091
|
-
|
|
1091
|
+
return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
|
|
1092
1092
|
this._startPromise = void 0;
|
|
1093
1093
|
})), this._startPromise;
|
|
1094
1094
|
}
|
|
1095
|
+
_load() {
|
|
1096
|
+
return this._loadPromise || (this._loadPromise = this._doLoad(), this._loadPromise.catch(() => {
|
|
1097
|
+
this._loadPromise = void 0;
|
|
1098
|
+
})), this._loadPromise;
|
|
1099
|
+
}
|
|
1095
1100
|
async _doStart() {
|
|
1101
|
+
await this._load();
|
|
1102
|
+
let e = this._options?.workbook, t = this._modules.getItems(), n = t.length;
|
|
1103
|
+
for (let r = 0; r < n; r++) {
|
|
1104
|
+
let n = t[r];
|
|
1105
|
+
try {
|
|
1106
|
+
let t = n.getFunctions().getItems({
|
|
1107
|
+
type: "autoRun",
|
|
1108
|
+
includeHidden: !0
|
|
1109
|
+
}), r = t.length;
|
|
1110
|
+
for (let n = 0; n < r; n++) await t[n].execute(e);
|
|
1111
|
+
} catch (e) {
|
|
1112
|
+
En.error("Error executing autoRun script:", e);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
async _doLoad() {
|
|
1096
1117
|
let e = this._options?.workbook, t = this._options?.json, n = {};
|
|
1097
1118
|
if (t) {
|
|
1098
1119
|
let r = Object.keys(t);
|
|
@@ -1101,11 +1122,11 @@ var rr, ir = class {
|
|
|
1101
1122
|
try {
|
|
1102
1123
|
n[a] = await D(a, o, !1, [], o?.scope === "workbook" ? e : null);
|
|
1103
1124
|
} catch (e) {
|
|
1104
|
-
|
|
1125
|
+
En.error(`Could not load script '${a}'; it will be unavailable.`, e);
|
|
1105
1126
|
}
|
|
1106
1127
|
}
|
|
1107
1128
|
}
|
|
1108
|
-
let r = this, i = new
|
|
1129
|
+
let r = this, i = new Lt({
|
|
1109
1130
|
transactions: this._options?.transactions,
|
|
1110
1131
|
initial: n,
|
|
1111
1132
|
isReadOnly: () => r.isReadOnly(),
|
|
@@ -1117,21 +1138,6 @@ var rr, ir = class {
|
|
|
1117
1138
|
}
|
|
1118
1139
|
});
|
|
1119
1140
|
this._modules = i;
|
|
1120
|
-
let a = i.getItems();
|
|
1121
|
-
if (a.length === 0) return Promise.resolve(R.EmptyArray);
|
|
1122
|
-
let o = a.length;
|
|
1123
|
-
for (let t = 0; t < o; t++) {
|
|
1124
|
-
let n = a[t];
|
|
1125
|
-
try {
|
|
1126
|
-
let t = n.getFunctions().getItems({
|
|
1127
|
-
type: "autoRun",
|
|
1128
|
-
includeHidden: !0
|
|
1129
|
-
}), r = t.length;
|
|
1130
|
-
for (let n = 0; n < r; n++) await t[n].execute(e);
|
|
1131
|
-
} catch (e) {
|
|
1132
|
-
V.error("Error executing autoRun script:", e);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
1141
|
}
|
|
1136
1142
|
addListeners(e, t) {
|
|
1137
1143
|
return this._emitter.addListeners(e, t);
|
|
@@ -1148,7 +1154,108 @@ var rr, ir = class {
|
|
|
1148
1154
|
get isIScript() {
|
|
1149
1155
|
return !0;
|
|
1150
1156
|
}
|
|
1151
|
-
},
|
|
1157
|
+
}, xr = /^([a-z][a-z0-9+.-]*):/i, Sr = (e) => {
|
|
1158
|
+
let t = e.toLowerCase();
|
|
1159
|
+
return t.endsWith(":") ? t : t + ":";
|
|
1160
|
+
}, Cr = (e, t) => globalThis.fetch(e, t), wr = class {
|
|
1161
|
+
constructor() {
|
|
1162
|
+
this._handlers = /* @__PURE__ */ new Map([["http:", Cr], ["https:", Cr]]);
|
|
1163
|
+
}
|
|
1164
|
+
fetch(e, t) {
|
|
1165
|
+
let n = xr.exec(e)?.[1], r = this._handlers.get(n ? Sr(n) : "https:");
|
|
1166
|
+
if (!r) return Promise.reject(/* @__PURE__ */ TypeError(`No fetcher serves '${n}:'.`));
|
|
1167
|
+
try {
|
|
1168
|
+
return r(e, t);
|
|
1169
|
+
} catch (e) {
|
|
1170
|
+
return Promise.reject(e);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
register(e, t) {
|
|
1174
|
+
let n = Sr(e), r = this._handlers.get(n);
|
|
1175
|
+
return this._handlers.set(n, t), () => {
|
|
1176
|
+
this._handlers.get(n) === t && (r ? this._handlers.set(n, r) : this._handlers.delete(n));
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
get isIFetcher() {
|
|
1180
|
+
return !0;
|
|
1181
|
+
}
|
|
1182
|
+
}, Tr = /* @__PURE__ */ new Set([
|
|
1183
|
+
101,
|
|
1184
|
+
103,
|
|
1185
|
+
204,
|
|
1186
|
+
205,
|
|
1187
|
+
304
|
|
1188
|
+
]), Y = (e) => new Response(Tr.has(e.status) ? null : e.body, {
|
|
1189
|
+
status: e.status,
|
|
1190
|
+
statusText: e.statusText,
|
|
1191
|
+
headers: e.headers
|
|
1192
|
+
}), Er = class {
|
|
1193
|
+
constructor(e, t) {
|
|
1194
|
+
this._kept = /* @__PURE__ */ new Map(), this._cached = /* @__PURE__ */ new Map(), this._inFlight = /* @__PURE__ */ new Map(), this._resources = e, this._fetcher = t;
|
|
1195
|
+
}
|
|
1196
|
+
getFetcher() {
|
|
1197
|
+
return this._fetcher;
|
|
1198
|
+
}
|
|
1199
|
+
async fetch(e, t) {
|
|
1200
|
+
if (((e) => !e || (!e.method || e.method.toUpperCase() === "GET") && !e.body)(t) && t?.cache !== "reload") {
|
|
1201
|
+
let n = this._kept.get(e) ?? this._findHeld(e);
|
|
1202
|
+
if (n && !n.isClosed()) return this._fromKept(n);
|
|
1203
|
+
let r = this._cached.get(e);
|
|
1204
|
+
if (r) return Y(r);
|
|
1205
|
+
let i = this._inFlight.get(e);
|
|
1206
|
+
return i || (i = this._request(e, {
|
|
1207
|
+
...t,
|
|
1208
|
+
signal: void 0
|
|
1209
|
+
}).finally(() => {
|
|
1210
|
+
this._inFlight.delete(e);
|
|
1211
|
+
}), this._inFlight.set(e, i)), Y(await ((e, t) => t ? t.aborted ? Promise.reject(t.reason) : new Promise((n, r) => {
|
|
1212
|
+
let i = () => r(t.reason);
|
|
1213
|
+
t.addEventListener("abort", i, { once: !0 }), e.then(n, r).finally(() => t.removeEventListener("abort", i));
|
|
1214
|
+
}) : e)(i, t?.signal));
|
|
1215
|
+
}
|
|
1216
|
+
return Y(await this._request(e, t));
|
|
1217
|
+
}
|
|
1218
|
+
adopt(e) {
|
|
1219
|
+
for (let t of e) {
|
|
1220
|
+
let e = t.getFetchedFrom();
|
|
1221
|
+
e && !t.isClosed() && this.keep(e, t);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
keep(e, t) {
|
|
1225
|
+
let n = this._kept.get(e);
|
|
1226
|
+
n !== t && (t.addReference(this), this._kept.set(e, t), n && !n.isClosed() && n.deleteReference(this));
|
|
1227
|
+
}
|
|
1228
|
+
_findHeld(e) {
|
|
1229
|
+
for (let t of this._resources.getItems()) if (t.getFetchedFrom() === e && !t.isClosed()) return this.keep(e, t), t;
|
|
1230
|
+
return null;
|
|
1231
|
+
}
|
|
1232
|
+
async _fromKept(e) {
|
|
1233
|
+
let [t, n] = await Promise.all([e.toBuffer(), e.getType()]);
|
|
1234
|
+
return Y({
|
|
1235
|
+
status: 200,
|
|
1236
|
+
statusText: "OK",
|
|
1237
|
+
headers: n ? [["content-type", n.mime]] : [],
|
|
1238
|
+
body: t
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
async _request(e, t) {
|
|
1242
|
+
let n = await this._fetcher.fetch(e, t), r = Tr.has(n.status) ? null : await n.arrayBuffer(), i = [];
|
|
1243
|
+
n.headers.forEach((e, t) => {
|
|
1244
|
+
i.push([t, e]);
|
|
1245
|
+
});
|
|
1246
|
+
let a = {
|
|
1247
|
+
status: n.status,
|
|
1248
|
+
statusText: n.statusText,
|
|
1249
|
+
headers: i,
|
|
1250
|
+
body: r
|
|
1251
|
+
};
|
|
1252
|
+
if (n.ok && r && r.byteLength > 0) {
|
|
1253
|
+
let t = await new C({ source: { buffer: r } }).getType();
|
|
1254
|
+
t?.mime.startsWith("image/") ? (a.headers = i.filter(([e]) => e.toLowerCase() !== "content-type"), a.headers.push(["content-type", t.mime])) : this._cached.set(e, a);
|
|
1255
|
+
}
|
|
1256
|
+
return a;
|
|
1257
|
+
}
|
|
1258
|
+
}, Dr = class {
|
|
1152
1259
|
constructor(e, t, n, r) {
|
|
1153
1260
|
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? z.EmptyCell, this._sheet = new A({
|
|
1154
1261
|
runtime: e,
|
|
@@ -1171,28 +1278,28 @@ var rr, ir = class {
|
|
|
1171
1278
|
e.includes(r) && delete i[r];
|
|
1172
1279
|
}
|
|
1173
1280
|
}
|
|
1174
|
-
let a =
|
|
1281
|
+
let a = sn(i.fontFamily);
|
|
1175
1282
|
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;
|
|
1176
|
-
let o =
|
|
1177
|
-
r.font.underline = o.underline, r.font.strike = o.strike ? M.StrikeStyle.Single : M.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline =
|
|
1283
|
+
let o = an(i.textDecoration);
|
|
1284
|
+
r.font.underline = o.underline, r.font.strike = o.strike ? M.StrikeStyle.Single : M.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline = _n(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = tn(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = N.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = N.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = N.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.baseline = F.Baseline.Superscript : i.verticalAlign.toLowerCase() === "sub" ? r.font.baseline = F.Baseline.Subscript : r.alignment.vertical = Jt(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = N.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" ? N.Overflow.Visible : N.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = N.Overflow.Shrink);
|
|
1178
1285
|
let s = null;
|
|
1179
1286
|
if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
|
|
1180
|
-
let e =
|
|
1181
|
-
e && (e.patternType ===
|
|
1287
|
+
let e = cn(i.msoPattern);
|
|
1288
|
+
e && (e.patternType === un.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== un.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
|
|
1182
1289
|
}
|
|
1183
|
-
i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation =
|
|
1290
|
+
i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = $t(i.msoRotate));
|
|
1184
1291
|
let c = (e, t) => {
|
|
1185
1292
|
e && (r.borders ||= {}, r.borders[e] = t);
|
|
1186
1293
|
};
|
|
1187
1294
|
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);
|
|
1188
1295
|
let l = r.numberFormat;
|
|
1189
|
-
i.msoNumberFormat && (l =
|
|
1296
|
+
i.msoNumberFormat && (l = mn(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = P.Styles.lookupStyle(r.numberFormat).formatType === P.Type.Number ? null : P.Type.Number : l === "Percent" && (l = P.Styles.lookupStyle(r.numberFormat).formatType === P.Type.Percentage ? null : P.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
|
|
1190
1297
|
}
|
|
1191
1298
|
onCell(e, t, n, r, i) {
|
|
1192
1299
|
let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
|
|
1193
1300
|
if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), typeof o.value == "string" && /^#+$/.test(o.value)) {
|
|
1194
1301
|
let e = o.style?.numberFormat;
|
|
1195
|
-
e && (
|
|
1302
|
+
e && (on(e) || Yt(e)) && (o.value = I.BuiltIn.Num);
|
|
1196
1303
|
}
|
|
1197
1304
|
if (i?.tagName.toUpperCase() === "TD") {
|
|
1198
1305
|
let e = o.style, t = e?.font ?? {};
|
|
@@ -1243,8 +1350,8 @@ var rr, ir = class {
|
|
|
1243
1350
|
let i = n(r);
|
|
1244
1351
|
if (i.msoHeightSource !== "userset" || !r) return;
|
|
1245
1352
|
let a = r.getAttribute("height") ?? i.height, o = null;
|
|
1246
|
-
if (a && (o =
|
|
1247
|
-
let t = r.cells[e], i = t.getAttribute("height") ?? n(t).height, a =
|
|
1353
|
+
if (a && (o = Qt(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
|
|
1354
|
+
let t = r.cells[e], i = t.getAttribute("height") ?? n(t).height, a = Qt(i, this._styles.getNormal().getFont().getSize(), "px");
|
|
1248
1355
|
a !== null && (o = Math.max(a, o ?? 0));
|
|
1249
1356
|
}
|
|
1250
1357
|
o !== null && this._rowsReading.push({
|
|
@@ -1259,7 +1366,7 @@ var rr, ir = class {
|
|
|
1259
1366
|
let i = n(r);
|
|
1260
1367
|
if (i.msoWidthSource !== "userset" || !r) return;
|
|
1261
1368
|
let a = r.getAttribute("width") ?? i.width, o = null;
|
|
1262
|
-
a && (o =
|
|
1369
|
+
a && (o = Qt(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
|
|
1263
1370
|
address: {
|
|
1264
1371
|
min: this._topLeft.colIndex + e,
|
|
1265
1372
|
max: this._topLeft.colIndex + e + t - 1
|
|
@@ -1275,9 +1382,9 @@ var rr, ir = class {
|
|
|
1275
1382
|
sheet() {
|
|
1276
1383
|
return this._sheet;
|
|
1277
1384
|
}
|
|
1278
|
-
},
|
|
1385
|
+
}, Or = class {
|
|
1279
1386
|
constructor(e) {
|
|
1280
|
-
if (!e) throw new
|
|
1387
|
+
if (!e) throw new Dn("snapshot is required.");
|
|
1281
1388
|
this._snapshot = e;
|
|
1282
1389
|
}
|
|
1283
1390
|
getItemType() {
|
|
@@ -1307,9 +1414,9 @@ var rr, ir = class {
|
|
|
1307
1414
|
get isClipboardItem() {
|
|
1308
1415
|
return !0;
|
|
1309
1416
|
}
|
|
1310
|
-
},
|
|
1417
|
+
}, kr = class {
|
|
1311
1418
|
constructor(e, t, n, r, i) {
|
|
1312
|
-
if (this._parsed = void 0, this._runtime = e, !t) throw new
|
|
1419
|
+
if (this._parsed = void 0, this._runtime = e, !t) throw new Dn("nativeItems are required.");
|
|
1313
1420
|
this._topLeft = n ?? z.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
|
|
1314
1421
|
}
|
|
1315
1422
|
getItemType() {
|
|
@@ -1355,15 +1462,15 @@ var rr, ir = class {
|
|
|
1355
1462
|
async parse() {
|
|
1356
1463
|
let e, t = this._native?.text, n = this._native.html;
|
|
1357
1464
|
if (n === null && t && t.includes("<table")) try {
|
|
1358
|
-
let e = new DOMParser().parseFromString(t,
|
|
1465
|
+
let e = new DOMParser().parseFromString(t, Tn.Html), r = e.querySelector("parsererror");
|
|
1359
1466
|
if (r) throw new B("Unable to parse: " + r);
|
|
1360
1467
|
n = e, t = null;
|
|
1361
1468
|
} catch {
|
|
1362
1469
|
console.warn("Discovered text as html table but could could not parse.");
|
|
1363
1470
|
}
|
|
1364
1471
|
try {
|
|
1365
|
-
let r = new
|
|
1366
|
-
if (
|
|
1472
|
+
let r = new Dr(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), i = await Promise.resolve(t ? re(t) : [[]]), a;
|
|
1473
|
+
if (x(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) {
|
|
1367
1474
|
let t = a.getSnapshot();
|
|
1368
1475
|
return this._parsed = {
|
|
1369
1476
|
prepare: (e, n) => t.prepare?.(e, n),
|
|
@@ -1385,7 +1492,7 @@ var rr, ir = class {
|
|
|
1385
1492
|
sheet: r,
|
|
1386
1493
|
options: await r.getMovables()._preparePicture({ source: { buffer: e } }, {
|
|
1387
1494
|
type: "picture",
|
|
1388
|
-
description:
|
|
1495
|
+
description: U("op.copyImageFromClipboard"),
|
|
1389
1496
|
autoSelect: !0
|
|
1390
1497
|
})
|
|
1391
1498
|
};
|
|
@@ -1403,7 +1510,7 @@ var rr, ir = class {
|
|
|
1403
1510
|
get isClipboardItem() {
|
|
1404
1511
|
return !0;
|
|
1405
1512
|
}
|
|
1406
|
-
},
|
|
1513
|
+
}, Ar = class {
|
|
1407
1514
|
constructor(t) {
|
|
1408
1515
|
this._closed = !1, this._kind = t.kind, this._id = t.id, this._part = t.part, this._styles = t.styles, this._tabColor = t.tabColor ? this._styles.parseColor(t.tabColor) : null, this._transactions = t.transactions, this._workbook = t.workbook ?? null, this._container = t.container, this._emitter = new e(this, this._transactions);
|
|
1409
1516
|
}
|
|
@@ -1420,11 +1527,11 @@ var rr, ir = class {
|
|
|
1420
1527
|
return this._assertOpen(), this._container.setName(e, t), this;
|
|
1421
1528
|
}
|
|
1422
1529
|
getVisibility() {
|
|
1423
|
-
return this._closed ?
|
|
1530
|
+
return this._closed ? T.Visibility.VeryHidden : this._container.getVisibility();
|
|
1424
1531
|
}
|
|
1425
1532
|
setVisibility(e = !0, t) {
|
|
1426
1533
|
let n;
|
|
1427
|
-
return this._assertOpen(), n = !0 === e ?
|
|
1534
|
+
return this._assertOpen(), n = !0 === e ? T.Visibility.Visible : !1 === e ? T.Visibility.Hidden : e, this._container.setVisibility(n, t), this;
|
|
1428
1535
|
}
|
|
1429
1536
|
getIndex() {
|
|
1430
1537
|
return this._container.getIndex();
|
|
@@ -1446,12 +1553,12 @@ var rr, ir = class {
|
|
|
1446
1553
|
}
|
|
1447
1554
|
delete() {
|
|
1448
1555
|
if (this._closed) return;
|
|
1449
|
-
let e = this._transactions.beginCommit({ description:
|
|
1556
|
+
let e = this._transactions.beginCommit({ description: W("op.deleteSheet", { name: this.getName() }) });
|
|
1450
1557
|
try {
|
|
1451
1558
|
try {
|
|
1452
1559
|
this._notify("onBeforeDelete");
|
|
1453
1560
|
} catch (e) {
|
|
1454
|
-
throw e instanceof Error ? e : new B(e?.message ??
|
|
1561
|
+
throw e instanceof Error ? e : new B(e?.message ?? W("error.sheet.modelDelete"));
|
|
1455
1562
|
}
|
|
1456
1563
|
this._notify("onDelete"), e.commit();
|
|
1457
1564
|
} catch (t) {
|
|
@@ -1477,7 +1584,7 @@ var rr, ir = class {
|
|
|
1477
1584
|
this._emitter.notify(e);
|
|
1478
1585
|
}
|
|
1479
1586
|
_assertOpen() {
|
|
1480
|
-
if (this._closed) throw Error(
|
|
1587
|
+
if (this._closed) throw Error(W("error.sheet.modelClosed"));
|
|
1481
1588
|
}
|
|
1482
1589
|
get [Symbol.toStringTag]() {
|
|
1483
1590
|
return "[OpaqueSheet]";
|
|
@@ -1492,12 +1599,12 @@ var rr, ir = class {
|
|
|
1492
1599
|
return !0;
|
|
1493
1600
|
}
|
|
1494
1601
|
};
|
|
1495
|
-
(
|
|
1602
|
+
(hr ||= {}).Visibility = {
|
|
1496
1603
|
Visible: "visible",
|
|
1497
1604
|
Hidden: "hidden",
|
|
1498
1605
|
VeryHidden: "veryHidden"
|
|
1499
1606
|
};
|
|
1500
|
-
var X,
|
|
1607
|
+
var X, jr = {
|
|
1501
1608
|
showFormulaBar: !0,
|
|
1502
1609
|
showTabs: !0,
|
|
1503
1610
|
tabRatio: 600,
|
|
@@ -1508,11 +1615,11 @@ var X, pr = {
|
|
|
1508
1615
|
firstTab: 0,
|
|
1509
1616
|
windowBounds: null,
|
|
1510
1617
|
minimized: !1,
|
|
1511
|
-
visibility:
|
|
1618
|
+
visibility: hr.Visibility.Visible,
|
|
1512
1619
|
autoFilterDateGrouping: !0
|
|
1513
|
-
},
|
|
1620
|
+
}, Mr = class {
|
|
1514
1621
|
constructor(t) {
|
|
1515
|
-
this._id = R.uuidV4(), this._emitter = new e(this), this._state = { ...
|
|
1622
|
+
this._id = R.uuidV4(), this._emitter = new e(this), this._state = { ...jr }, t?.json && this._fromJSON(t?.json);
|
|
1516
1623
|
}
|
|
1517
1624
|
getId() {
|
|
1518
1625
|
return this._id;
|
|
@@ -1600,7 +1707,7 @@ var X, pr = {
|
|
|
1600
1707
|
let e = {}, t = Object.keys(this._state), n = t.length;
|
|
1601
1708
|
for (let r = 0; r < n; r++) {
|
|
1602
1709
|
let n = t[r], i = this._state[n];
|
|
1603
|
-
i != null && i !==
|
|
1710
|
+
i != null && i !== jr[n] && (e[n] = i);
|
|
1604
1711
|
}
|
|
1605
1712
|
return Object.keys(e).length === 0 && (e = null), e;
|
|
1606
1713
|
}
|
|
@@ -1610,7 +1717,7 @@ var X, pr = {
|
|
|
1610
1717
|
}
|
|
1611
1718
|
update(e, t = !0) {
|
|
1612
1719
|
this._state = {
|
|
1613
|
-
...
|
|
1720
|
+
...jr,
|
|
1614
1721
|
...this._state,
|
|
1615
1722
|
...e
|
|
1616
1723
|
}, t && this._emitter.notify("onViewChange");
|
|
@@ -1625,13 +1732,13 @@ var X, pr = {
|
|
|
1625
1732
|
get isIWorkbookView() {
|
|
1626
1733
|
return !0;
|
|
1627
1734
|
}
|
|
1628
|
-
},
|
|
1735
|
+
}, Nr = Object.freeze({
|
|
1629
1736
|
structure: !1,
|
|
1630
1737
|
windows: !1,
|
|
1631
1738
|
revision: !0,
|
|
1632
1739
|
password: null,
|
|
1633
1740
|
revisionsPassword: null
|
|
1634
|
-
}),
|
|
1741
|
+
}), Pr = class extends Ae {
|
|
1635
1742
|
isWindowsAllowed() {
|
|
1636
1743
|
return this._isPropertyAllowed("windows");
|
|
1637
1744
|
}
|
|
@@ -1653,7 +1760,7 @@ var X, pr = {
|
|
|
1653
1760
|
let n = Object.keys(t), r = n.length;
|
|
1654
1761
|
for (let i = 0; i < r; i++) {
|
|
1655
1762
|
let r = n[i], a = t[r];
|
|
1656
|
-
a != null && a !==
|
|
1763
|
+
a != null && a !== Nr[r] && (e[r] = a);
|
|
1657
1764
|
}
|
|
1658
1765
|
}
|
|
1659
1766
|
return super._toJSON(e);
|
|
@@ -1672,7 +1779,7 @@ var X, pr = {
|
|
|
1672
1779
|
String: "string",
|
|
1673
1780
|
Float: "float"
|
|
1674
1781
|
};
|
|
1675
|
-
var
|
|
1782
|
+
var Fr = (e) => {
|
|
1676
1783
|
if (typeof e == "string") return {
|
|
1677
1784
|
type: X.Type.String,
|
|
1678
1785
|
value: e
|
|
@@ -1696,7 +1803,7 @@ var _r = (e) => {
|
|
|
1696
1803
|
};
|
|
1697
1804
|
}
|
|
1698
1805
|
throw Error("A custom property value must be a string, number, boolean or Date.");
|
|
1699
|
-
},
|
|
1806
|
+
}, Ir = class {
|
|
1700
1807
|
constructor(e, t) {
|
|
1701
1808
|
this._json = e, this._owner = t;
|
|
1702
1809
|
}
|
|
@@ -1716,7 +1823,7 @@ var _r = (e) => {
|
|
|
1716
1823
|
setValue(e) {
|
|
1717
1824
|
this._owner._assertCustomEditable(this), this._json = {
|
|
1718
1825
|
...this._json,
|
|
1719
|
-
...
|
|
1826
|
+
...Fr(e)
|
|
1720
1827
|
};
|
|
1721
1828
|
}
|
|
1722
1829
|
delete() {
|
|
@@ -1725,7 +1832,7 @@ var _r = (e) => {
|
|
|
1725
1832
|
toJSON() {
|
|
1726
1833
|
return { ...this._json };
|
|
1727
1834
|
}
|
|
1728
|
-
},
|
|
1835
|
+
}, Lr = class {
|
|
1729
1836
|
constructor(e) {
|
|
1730
1837
|
this._json = {}, this._custom = [], this._assertOpen = e;
|
|
1731
1838
|
}
|
|
@@ -1815,9 +1922,9 @@ var _r = (e) => {
|
|
|
1815
1922
|
if (this._assertOpen(), typeof e != "string" || e === "") throw Error("A custom property needs a name.");
|
|
1816
1923
|
let n = this.getCustomProperty(e);
|
|
1817
1924
|
if (n) return n.setValue(t), n;
|
|
1818
|
-
let r = new
|
|
1925
|
+
let r = new Ir({
|
|
1819
1926
|
key: e,
|
|
1820
|
-
...
|
|
1927
|
+
...Fr(t)
|
|
1821
1928
|
}, this);
|
|
1822
1929
|
return this._custom.push(r), r;
|
|
1823
1930
|
}
|
|
@@ -1832,26 +1939,26 @@ var _r = (e) => {
|
|
|
1832
1939
|
}
|
|
1833
1940
|
fromJSON(e) {
|
|
1834
1941
|
let { custom: t, ...n } = e ?? {};
|
|
1835
|
-
this._json = n, this._custom = (t ?? []).map((e) => new
|
|
1942
|
+
this._json = n, this._custom = (t ?? []).map((e) => new Ir({ ...e }, this));
|
|
1836
1943
|
}
|
|
1837
1944
|
toJSON() {
|
|
1838
1945
|
let e = { ...this._json };
|
|
1839
1946
|
return this._custom.length > 0 && (e.custom = this._custom.map((e) => e.toJSON())), e;
|
|
1840
1947
|
}
|
|
1841
1948
|
};
|
|
1842
|
-
function
|
|
1843
|
-
return
|
|
1949
|
+
function Rr(e) {
|
|
1950
|
+
return W("error.workbook.invalidSheetKey", { key: e });
|
|
1844
1951
|
}
|
|
1845
|
-
function
|
|
1846
|
-
return
|
|
1952
|
+
function zr(e) {
|
|
1953
|
+
return W("error.workbook.sheetNameNotFound", { sheetName: e });
|
|
1847
1954
|
}
|
|
1848
|
-
function
|
|
1849
|
-
return
|
|
1955
|
+
function Br(e, t) {
|
|
1956
|
+
return W(t === "chart" ? "error.workbook.sheetIsChart" : t === "macro" ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
|
|
1850
1957
|
}
|
|
1851
|
-
function
|
|
1852
|
-
return t === "chart" ?
|
|
1958
|
+
function Vr(e, t) {
|
|
1959
|
+
return t === "chart" ? W("error.workbook.selectedIsChart", { sheetName: e }) : t === "macro" ? W("error.workbook.selectedIsMacro", { sheetName: e }) : t === "dialog" ? W("error.workbook.selectedIsDialog", { sheetName: e }) : W("error.workbook.noWorksheet");
|
|
1853
1960
|
}
|
|
1854
|
-
var
|
|
1961
|
+
var Hr = class extends Ht {
|
|
1855
1962
|
constructor(e, t, n, r) {
|
|
1856
1963
|
super(), this._add = e, this._get = t, this._addListeners = n, this._getSelected = r;
|
|
1857
1964
|
}
|
|
@@ -1882,39 +1989,39 @@ var wr = class extends ke {
|
|
|
1882
1989
|
get isIWorksheetCollection() {
|
|
1883
1990
|
return !0;
|
|
1884
1991
|
}
|
|
1885
|
-
},
|
|
1886
|
-
function
|
|
1887
|
-
let t =
|
|
1992
|
+
}, Ur = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Wr = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
|
|
1993
|
+
function Gr(e) {
|
|
1994
|
+
let t = W(U("workbook.defaultSheetName"), { n: e + 1 });
|
|
1888
1995
|
return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
|
|
1889
1996
|
}
|
|
1890
|
-
function
|
|
1997
|
+
function Kr(e, t) {
|
|
1891
1998
|
return {
|
|
1892
|
-
...
|
|
1999
|
+
...zt,
|
|
1893
2000
|
getWorksheet: () => null,
|
|
1894
|
-
toString: () =>
|
|
2001
|
+
toString: () => Tt(e, t)
|
|
1895
2002
|
};
|
|
1896
2003
|
}
|
|
1897
|
-
function
|
|
1898
|
-
if (!e) throw Error(
|
|
1899
|
-
if (
|
|
2004
|
+
function qr(e, t = !1) {
|
|
2005
|
+
if (!e) throw Error(W("error.workbook.sheetNameBlank"));
|
|
2006
|
+
if (Ur.test(e)) {
|
|
1900
2007
|
if (!t) throw Error(function(e) {
|
|
1901
|
-
return e ?
|
|
2008
|
+
return e ? W("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : W("error.workbook.sheetNameInvalidChars");
|
|
1902
2009
|
}(e));
|
|
1903
|
-
e = e.replace(
|
|
2010
|
+
e = e.replace(Ur, "");
|
|
1904
2011
|
}
|
|
1905
|
-
if (e.length === 0) throw Error(
|
|
2012
|
+
if (e.length === 0) throw Error(W("error.workbook.sheetNameBlank"));
|
|
1906
2013
|
let n = e.length;
|
|
1907
2014
|
if (n > 31) {
|
|
1908
|
-
if (!t) throw Error(
|
|
2015
|
+
if (!t) throw Error(W("error.workbook.sheetNameTooLong"));
|
|
1909
2016
|
e = e.substring(0, 31);
|
|
1910
2017
|
}
|
|
1911
2018
|
if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
|
|
1912
|
-
if (!t) throw Error(
|
|
2019
|
+
if (!t) throw Error(W("error.workbook.sheetNameQuotes"));
|
|
1913
2020
|
e = e.replace(/^'|'$/g, "");
|
|
1914
2021
|
}
|
|
1915
2022
|
return e;
|
|
1916
2023
|
}
|
|
1917
|
-
var
|
|
2024
|
+
var Jr, Yr = "workbook.activeSheet", Xr = class e extends d {
|
|
1918
2025
|
constructor(e, t, n, r) {
|
|
1919
2026
|
super(e, t, r), this._workbook = n;
|
|
1920
2027
|
}
|
|
@@ -1925,24 +2032,24 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
1925
2032
|
let r = this._options;
|
|
1926
2033
|
return n && (r = {
|
|
1927
2034
|
...this._options,
|
|
1928
|
-
getOptions:
|
|
2035
|
+
getOptions: E(this._options?.getOptions, n)
|
|
1929
2036
|
}), new e(t, this._internal, this._workbook, r);
|
|
1930
2037
|
}
|
|
1931
2038
|
_createRange(e, t) {
|
|
1932
|
-
let n = e ? { ...e } : null, r = this._workbook, i = n ? r._getSheetRef(n.scope,
|
|
1933
|
-
if (i && !i.sheet.isIWorksheet) throw new B(
|
|
2039
|
+
let n = e ? { ...e } : null, r = this._workbook, i = n ? r._getSheetRef(n.scope, T.Visibility.VeryHidden) : null;
|
|
2040
|
+
if (i && !i.sheet.isIWorksheet) throw new B(Br(i.name, i.sheet.getKind()));
|
|
1934
2041
|
if (!i) {
|
|
1935
2042
|
let e = r._anchorWorksheet();
|
|
1936
|
-
return delete n?.scope,
|
|
1937
|
-
scope:
|
|
2043
|
+
return delete n?.scope, Kr(n, n ? {
|
|
2044
|
+
scope: Ke,
|
|
1938
2045
|
...e.getEntireRange().getCoords()
|
|
1939
2046
|
} : null);
|
|
1940
2047
|
}
|
|
1941
2048
|
let a = this._options;
|
|
1942
2049
|
return t && (a = {
|
|
1943
2050
|
...this._options,
|
|
1944
|
-
getOptions:
|
|
1945
|
-
}), new
|
|
2051
|
+
getOptions: E(this._options.getOptions, t)
|
|
2052
|
+
}), new Zr(e, j(i.sheet), this._workbook, a);
|
|
1946
2053
|
}
|
|
1947
2054
|
async select(e) {
|
|
1948
2055
|
let t = [], n = null, r = this.getCoords();
|
|
@@ -1966,15 +2073,15 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
1966
2073
|
}
|
|
1967
2074
|
getAddress(e) {
|
|
1968
2075
|
let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
|
|
1969
|
-
return
|
|
2076
|
+
return kt(this.getCoords(), {
|
|
1970
2077
|
...n,
|
|
1971
2078
|
scope: t.getName()
|
|
1972
|
-
},
|
|
2079
|
+
}, Tt, jt, e);
|
|
1973
2080
|
}
|
|
1974
2081
|
toString() {
|
|
1975
2082
|
return this.getAddress();
|
|
1976
2083
|
}
|
|
1977
|
-
},
|
|
2084
|
+
}, Zr = class e extends De {
|
|
1978
2085
|
constructor(e, t, n, r) {
|
|
1979
2086
|
super(e, t, r), this._workbook = n;
|
|
1980
2087
|
}
|
|
@@ -1982,17 +2089,17 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
1982
2089
|
let n = this._options;
|
|
1983
2090
|
return t && (n = {
|
|
1984
2091
|
...this._options,
|
|
1985
|
-
getOptions:
|
|
1986
|
-
}), new
|
|
2092
|
+
getOptions: E(this._options?.getOptions, t)
|
|
2093
|
+
}), new Xr(e, this._internal, this._workbook, n);
|
|
1987
2094
|
}
|
|
1988
2095
|
_createRange(t, n) {
|
|
1989
2096
|
let r = this._internal;
|
|
1990
|
-
if (!t) return
|
|
1991
|
-
if (r.validateCoords(t), r.getSheet().isClosed()) return
|
|
2097
|
+
if (!t) return Nt(r.getSheet(), r.getSheet().getEntireCoords());
|
|
2098
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return Nt(null, r.getSheet().getEntireCoords(), t);
|
|
1992
2099
|
let i = this._options;
|
|
1993
2100
|
return n && (i = {
|
|
1994
2101
|
...this._options,
|
|
1995
|
-
getOptions:
|
|
2102
|
+
getOptions: E(this._options?.getOptions, n)
|
|
1996
2103
|
}), new e(t, this._internal, this._workbook, i);
|
|
1997
2104
|
}
|
|
1998
2105
|
addListener(e, t) {
|
|
@@ -2005,7 +2112,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2005
2112
|
}
|
|
2006
2113
|
getAddress(e) {
|
|
2007
2114
|
let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
|
|
2008
|
-
return
|
|
2115
|
+
return Tt(this.getCoords(), {
|
|
2009
2116
|
...n,
|
|
2010
2117
|
scope: t.getName()
|
|
2011
2118
|
});
|
|
@@ -2013,13 +2120,13 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2013
2120
|
toString() {
|
|
2014
2121
|
return this.getAddress();
|
|
2015
2122
|
}
|
|
2016
|
-
},
|
|
2123
|
+
}, Qr = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", $r = class {
|
|
2017
2124
|
constructor(t) {
|
|
2018
|
-
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
|
|
2125
|
+
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 Ge(() => {
|
|
2019
2126
|
let e = [];
|
|
2020
2127
|
for (let t of this.getWorksheets()) e.push(...t.getPivotTables());
|
|
2021
2128
|
return e;
|
|
2022
|
-
}), this._people = new
|
|
2129
|
+
}), this._people = new vr(), this._commentCollection = new Kt(null, (e, t, n) => {
|
|
2023
2130
|
let r = [];
|
|
2024
2131
|
for (let i of this.getWorksheets()) r.push(...i.getComments().getItems(e ? {
|
|
2025
2132
|
address: e,
|
|
@@ -2032,23 +2139,23 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2032
2139
|
return r;
|
|
2033
2140
|
}, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
|
|
2034
2141
|
e.onCollectionChange(this._commentCollection);
|
|
2035
|
-
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new
|
|
2036
|
-
if (this._closed) throw Error(
|
|
2037
|
-
}), this._locale = null, this._localeOverrides = null;
|
|
2142
|
+
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new Lr(() => {
|
|
2143
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2144
|
+
}), this._locale = null, this._localeOverrides = null, this._startModules = /* @__PURE__ */ new WeakSet();
|
|
2038
2145
|
let n = typeof t == "string" ? { origin: t } : { ...t }, r = n.origin;
|
|
2039
|
-
this._ownOriginProvider = !
|
|
2146
|
+
this._ownOriginProvider = !Qr(r), this._originProvider = Qr(r) ? r : new zn(typeof r == "string" ? new G(null, { name: r }) : r ?? new G(null)), delete n.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
|
|
2040
2147
|
let a = n.json;
|
|
2041
|
-
delete n.json, this._transactions = n.transactions ?? new i(), this._id = this._transactions.create(), this._ownTransactions = !n.transactions, this._emitter = new e(this, this._transactions), this._runtime = n.runtime ?? new
|
|
2148
|
+
delete n.json, this._transactions = n.transactions ?? new i(), this._id = this._transactions.create(), this._ownTransactions = !n.transactions, this._emitter = new e(this, this._transactions), this._runtime = n.runtime ?? new Qe("Workbook Runtime", {
|
|
2042
2149
|
isDate1904: () => this._isDate1904,
|
|
2043
2150
|
getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
|
|
2044
|
-
getLocale: () => this._locale ??
|
|
2151
|
+
getLocale: () => this._locale ?? At() ?? ht(),
|
|
2045
2152
|
getLocaleOverrides: () => this._localeOverrides
|
|
2046
|
-
}), this._listenerLanguage =
|
|
2153
|
+
}), this._listenerLanguage = Cn.addChangeListener(() => {
|
|
2047
2154
|
this._closed || this._notifyAllChange();
|
|
2048
2155
|
});
|
|
2049
|
-
let o = this,
|
|
2156
|
+
let o = this, s = this._beginCommit({ description: U(a ? "op.openWorkbook" : "op.newWorkbook") });
|
|
2050
2157
|
try {
|
|
2051
|
-
this._strings = n.strings ?? new
|
|
2158
|
+
this._strings = n.strings ?? new ye(), this._ownStrings = !n.strings, this._richValues = n.richData ?? new ue(), this._resources = n.resources ?? new Ee(), this._ownResources = !n.resources, this._fetch = new Er(this._resources, n.fetcher ?? new wr()), this._createSheetName = n.createSheetNameCallback ?? Gr;
|
|
2052
2159
|
let e = n.createWorksheetCallback;
|
|
2053
2160
|
e ||= (e) => new A(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, a, s, c) => {
|
|
2054
2161
|
let l = null, u = {
|
|
@@ -2059,6 +2166,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2059
2166
|
transactions: o._transactions,
|
|
2060
2167
|
styles: o._styles,
|
|
2061
2168
|
strings: o._strings,
|
|
2169
|
+
richData: o._richValues,
|
|
2062
2170
|
resources: o._resources,
|
|
2063
2171
|
names: o._names,
|
|
2064
2172
|
workbook: o,
|
|
@@ -2069,7 +2177,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2069
2177
|
l = e, o._addSheetRef({
|
|
2070
2178
|
name: n,
|
|
2071
2179
|
id: t,
|
|
2072
|
-
visibility: r ??
|
|
2180
|
+
visibility: r ?? T.Visibility.Visible,
|
|
2073
2181
|
sheetId: a,
|
|
2074
2182
|
sheet: e
|
|
2075
2183
|
}, i);
|
|
@@ -2086,7 +2194,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2086
2194
|
},
|
|
2087
2195
|
getVisibility: () => {
|
|
2088
2196
|
let e = o._getSheetRef(l);
|
|
2089
|
-
return e ? e.visibility :
|
|
2197
|
+
return e ? e.visibility : T.Visibility.Visible;
|
|
2090
2198
|
},
|
|
2091
2199
|
setVisibility: (e, t) => {
|
|
2092
2200
|
o._setSheetVisibility(l, e, t);
|
|
@@ -2097,10 +2205,10 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2097
2205
|
duplicate: () => o._duplicateSheet(l),
|
|
2098
2206
|
getIndex: () => {
|
|
2099
2207
|
let e = o._getSheetRef(l);
|
|
2100
|
-
return e ? o._getOffsetForId(e.id, o._getSheetRefs(
|
|
2208
|
+
return e ? o._getOffsetForId(e.id, o._getSheetRefs(T.Visibility.VeryHidden)) : i;
|
|
2101
2209
|
},
|
|
2102
2210
|
setIndex: (e, t) => {
|
|
2103
|
-
let n = o._getSheetRef(l,
|
|
2211
|
+
let n = o._getSheetRef(l, T.Visibility.VeryHidden);
|
|
2104
2212
|
return !!n && (o._moveSheet(n, e, t), !0);
|
|
2105
2213
|
},
|
|
2106
2214
|
setIndexCallback: (e) => {
|
|
@@ -2110,16 +2218,16 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2110
2218
|
}
|
|
2111
2219
|
};
|
|
2112
2220
|
return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, i, r), l;
|
|
2113
|
-
}, this._namedTableSource = new
|
|
2221
|
+
}, this._namedTableSource = new ut({
|
|
2114
2222
|
getSheets: () => o._sheets ? o.getWorksheets().getItems() : R.EmptyArray,
|
|
2115
2223
|
addSheetsListener: (e, t) => o.addListeners({ onSheetsChange: e }, t)
|
|
2116
|
-
}), this._names = n.names ?? new
|
|
2224
|
+
}), this._names = n.names ?? new _t({
|
|
2117
2225
|
addressToRanges: (e) => o.getRanges(e),
|
|
2118
2226
|
getCurrentScope: () => o.getSelectedWorksheet()?.getName() ?? null,
|
|
2119
2227
|
isReadOnly: () => (o._options.readonly ?? !1) || o._isStructureProtected(),
|
|
2120
2228
|
transactions: o._transactions,
|
|
2121
2229
|
getSources: () => o._calculation ? [o._calculation.getNamedFormulas(), o._namedTableSource] : R.EmptyArray
|
|
2122
|
-
}), this._ownNames = !n.names, this._calculation = n.calculation ?? new
|
|
2230
|
+
}), this._ownNames = !n.names, this._calculation = n.calculation ?? new h({
|
|
2123
2231
|
runtime: o._runtime,
|
|
2124
2232
|
functions: n.functions,
|
|
2125
2233
|
json: a?.calc,
|
|
@@ -2138,19 +2246,19 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2138
2246
|
getSheetIndex: (e) => {
|
|
2139
2247
|
if (e === void 0) {
|
|
2140
2248
|
let e = o.getSelectedSheet();
|
|
2141
|
-
return e ? this._getSheetRefs(
|
|
2249
|
+
return e ? this._getSheetRefs(T.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
2142
2250
|
}
|
|
2143
|
-
let t = this._getSheetRefs(
|
|
2251
|
+
let t = this._getSheetRefs(T.Visibility.VeryHidden);
|
|
2144
2252
|
e = e.toLowerCase();
|
|
2145
2253
|
let n = t.length;
|
|
2146
2254
|
for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
2147
2255
|
try {
|
|
2148
|
-
|
|
2149
|
-
let t = this._names.getItems(
|
|
2256
|
+
ei.address = e;
|
|
2257
|
+
let t = this._names.getItems(ei);
|
|
2150
2258
|
if (!t || t.length === 0) return -1;
|
|
2151
2259
|
let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
|
|
2152
2260
|
if (!n) return -1;
|
|
2153
|
-
let r = this._getSheetRefs(
|
|
2261
|
+
let r = this._getSheetRefs(T.Visibility.VeryHidden);
|
|
2154
2262
|
n = n.toLowerCase();
|
|
2155
2263
|
let i = r.length;
|
|
2156
2264
|
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
|
|
@@ -2159,32 +2267,37 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2159
2267
|
}
|
|
2160
2268
|
return -1;
|
|
2161
2269
|
},
|
|
2162
|
-
getSheetCount: () => o._getSheetRefs(
|
|
2270
|
+
getSheetCount: () => o._getSheetRefs(T.Visibility.VeryHidden).length,
|
|
2163
2271
|
externalBooks: a?.externalBooks,
|
|
2164
2272
|
externalBookResolver: n.externalBookResolver,
|
|
2165
2273
|
namedCollection: o._names,
|
|
2166
2274
|
strings: o._strings,
|
|
2275
|
+
get resources() {
|
|
2276
|
+
return o._resources;
|
|
2277
|
+
},
|
|
2278
|
+
fetch: (e, t) => o._fetch.fetch(e, t),
|
|
2279
|
+
startFunctions: () => o._startFunctions(),
|
|
2167
2280
|
transactions: o._transactions,
|
|
2168
2281
|
names: a?.names
|
|
2169
2282
|
}), this._ownCalculation = !n.calculation, this._scripts = this._createScripts(a?.modules), this._ownNames = !n.names, this._options = Object.freeze({ ...n });
|
|
2170
2283
|
let t = a?.sheets?.length ? a.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" + R.uuidV4()), i = (e) => {
|
|
2171
2284
|
let t = a?.sheets?.[e]?.kind;
|
|
2172
|
-
return !!t && t !==
|
|
2285
|
+
return !!t && t !== T.Kind.Worksheet;
|
|
2173
2286
|
};
|
|
2174
2287
|
this._calculation._setSheets(t.map((e, t) => i(t) ? [
|
|
2175
2288
|
r[t],
|
|
2176
2289
|
e,
|
|
2177
2290
|
!0
|
|
2178
2291
|
] : [r[t], e]));
|
|
2179
|
-
let
|
|
2292
|
+
let c = n.calcOnLoad ?? "auto", l = !1, u = (async () => {
|
|
2180
2293
|
try {
|
|
2181
|
-
if (this._ownCalculation &&
|
|
2294
|
+
if (this._ownCalculation && c !== "none" && (c === "full" || c === "auto" && !0 === a?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
|
|
2182
2295
|
await this._scripts.start();
|
|
2183
2296
|
} finally {
|
|
2184
2297
|
l = !0, this._starting = null;
|
|
2185
2298
|
}
|
|
2186
2299
|
})();
|
|
2187
|
-
l || (this._starting = u), this._starting?.catch(() => {}), a ? this._fromJSON(a, r) : (this._initState(), this._addSheet(!1, t[0], null, r[0])), this._sheets = new
|
|
2300
|
+
l || (this._starting = u), this._starting?.catch(() => {}), a ? this._fromJSON(a, r) : (this._initState(), this._addSheet(!1, t[0], null, r[0])), this._sheets = new Hr((e) => o._addSheetOptions(e), (e, t) => {
|
|
2188
2301
|
if (e) {
|
|
2189
2302
|
let n = this._getSheetRef(e, t);
|
|
2190
2303
|
return n && Z(n) ? [n.sheet] : R.EmptyArray;
|
|
@@ -2200,9 +2313,9 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2200
2313
|
r(o._sheets);
|
|
2201
2314
|
} : void 0
|
|
2202
2315
|
}, t);
|
|
2203
|
-
}, () => o.getSelectedWorksheet()), this._ownCalculation && (n.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ?
|
|
2316
|
+
}, () => o.getSelectedWorksheet()), this._ownCalculation && (n.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? s.amend() : s.commit();
|
|
2204
2317
|
} catch (e) {
|
|
2205
|
-
throw
|
|
2318
|
+
throw s.rollback(), e;
|
|
2206
2319
|
}
|
|
2207
2320
|
this._initializing = !1;
|
|
2208
2321
|
}
|
|
@@ -2210,13 +2323,13 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2210
2323
|
let e = this._getSheetRefs();
|
|
2211
2324
|
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
2212
2325
|
let t = this._options;
|
|
2213
|
-
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new
|
|
2326
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new St().getDefaultTheme(), this._styles = t?.styles ?? new Gt(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Mr()), this._listenerProtection?.(), this._protection = new Pr(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2214
2327
|
n._emitter.notify("onProtectionChange");
|
|
2215
2328
|
} });
|
|
2216
2329
|
let n = this;
|
|
2217
2330
|
this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
|
|
2218
2331
|
async onAfterStateChange(e, t, r, i, a) {
|
|
2219
|
-
let o = n._view, s = a?.[
|
|
2332
|
+
let o = n._view, s = a?.[Yr], 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;
|
|
2220
2333
|
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");
|
|
2221
2334
|
},
|
|
2222
2335
|
onRestoreOrRevert() {
|
|
@@ -2271,8 +2384,8 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2271
2384
|
return this._view;
|
|
2272
2385
|
}
|
|
2273
2386
|
setView(e) {
|
|
2274
|
-
if (this._closed) throw Error(
|
|
2275
|
-
if (!e) throw new B(
|
|
2387
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2388
|
+
if (!e) throw new B(W("error.sheet.emptyView"));
|
|
2276
2389
|
this._listenerWorkbookView?.();
|
|
2277
2390
|
let t = this, n = -1;
|
|
2278
2391
|
return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
|
|
@@ -2284,7 +2397,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2284
2397
|
return this._runtime;
|
|
2285
2398
|
}
|
|
2286
2399
|
setDate1904(e) {
|
|
2287
|
-
if (this._closed) throw Error(
|
|
2400
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2288
2401
|
return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
|
|
2289
2402
|
}
|
|
2290
2403
|
getLocale() {
|
|
@@ -2294,11 +2407,11 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2294
2407
|
return this._locale;
|
|
2295
2408
|
}
|
|
2296
2409
|
setLocale(e) {
|
|
2297
|
-
if (this._closed) throw Error(
|
|
2410
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2298
2411
|
if (e) try {
|
|
2299
2412
|
new Intl.Locale(e);
|
|
2300
2413
|
} catch {
|
|
2301
|
-
throw Error(
|
|
2414
|
+
throw Error(W("error.workbook.invalidLocale", { locale: e }));
|
|
2302
2415
|
}
|
|
2303
2416
|
return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
|
|
2304
2417
|
}
|
|
@@ -2306,7 +2419,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2306
2419
|
return this._localeOverrides;
|
|
2307
2420
|
}
|
|
2308
2421
|
setLocaleOverrides(e) {
|
|
2309
|
-
if (this._closed) throw Error(
|
|
2422
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2310
2423
|
let t = e && Object.keys(e).length > 0 ? e : null;
|
|
2311
2424
|
return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
|
|
2312
2425
|
}
|
|
@@ -2316,11 +2429,17 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2316
2429
|
getResources() {
|
|
2317
2430
|
return this._resources;
|
|
2318
2431
|
}
|
|
2432
|
+
getFetcher() {
|
|
2433
|
+
return this._fetch.getFetcher();
|
|
2434
|
+
}
|
|
2435
|
+
fetch(e, t) {
|
|
2436
|
+
return this._fetch.fetch(e, t);
|
|
2437
|
+
}
|
|
2319
2438
|
getTransactions() {
|
|
2320
2439
|
return this._transactions;
|
|
2321
2440
|
}
|
|
2322
2441
|
getChanges(e) {
|
|
2323
|
-
let t = this._transactions, [n, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], a = this.getWorksheets().getItems({ visibility:
|
|
2442
|
+
let t = this._transactions, [n, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], a = this.getWorksheets().getItems({ visibility: T.Visibility.VeryHidden });
|
|
2324
2443
|
for (let e = 0; e < a.length; e++) {
|
|
2325
2444
|
let t = a[e];
|
|
2326
2445
|
t instanceof A && i.push(...t._changeEventsOf(n, r ?? null));
|
|
@@ -2337,7 +2456,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2337
2456
|
return this._updateLinks;
|
|
2338
2457
|
}
|
|
2339
2458
|
setUpdateLinks(e) {
|
|
2340
|
-
if (this._closed) throw Error(
|
|
2459
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2341
2460
|
return this._updateLinks = e, this;
|
|
2342
2461
|
}
|
|
2343
2462
|
getPivotTables() {
|
|
@@ -2353,8 +2472,8 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2353
2472
|
return this._theme;
|
|
2354
2473
|
}
|
|
2355
2474
|
setTheme(e) {
|
|
2356
|
-
if (this._closed) throw Error(
|
|
2357
|
-
if (!e) throw new B(
|
|
2475
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2476
|
+
if (!e) throw new B(W("error.workbook.notSetValue"));
|
|
2358
2477
|
let t = this._theme;
|
|
2359
2478
|
return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
|
|
2360
2479
|
}
|
|
@@ -2376,30 +2495,30 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2376
2495
|
return this.getSelectedWorksheet();
|
|
2377
2496
|
}
|
|
2378
2497
|
getSheets(e) {
|
|
2379
|
-
let t = this._getSheetRefs(e?.visibility ??
|
|
2498
|
+
let t = this._getSheetRefs(e?.visibility ?? T.Visibility.Visible), n = Array(t.length);
|
|
2380
2499
|
for (let e = 0; e < t.length; e++) n[e] = t[e].sheet;
|
|
2381
2500
|
return n;
|
|
2382
2501
|
}
|
|
2383
2502
|
getSheet(e) {
|
|
2384
2503
|
if (e === void 0) return this.getSelectedSheet();
|
|
2385
|
-
if (!e) throw Error(
|
|
2504
|
+
if (!e) throw Error(W("error.workbook.sheetNameNotProvided"));
|
|
2386
2505
|
let t = this._getSheetRef(e);
|
|
2387
|
-
if (!t) throw new
|
|
2506
|
+
if (!t) throw new V(zr(e));
|
|
2388
2507
|
return t.sheet;
|
|
2389
2508
|
}
|
|
2390
|
-
getWorksheet(e, t =
|
|
2509
|
+
getWorksheet(e, t = T.Visibility.Visible) {
|
|
2391
2510
|
if (typeof e == "number") return this.getWorksheetAt(e, t);
|
|
2392
2511
|
if (e === void 0) return this._requireSelectedWorksheet();
|
|
2393
|
-
if (!e) throw Error(
|
|
2512
|
+
if (!e) throw Error(W("error.workbook.sheetNameNotProvided"));
|
|
2394
2513
|
let n = this._getSheetRef(e, t);
|
|
2395
|
-
if (!n) throw new
|
|
2396
|
-
if (!Z(n)) throw new
|
|
2514
|
+
if (!n) throw new V(zr(e));
|
|
2515
|
+
if (!Z(n)) throw new V(Br(n.name, n.sheet.getKind()));
|
|
2397
2516
|
return n.sheet;
|
|
2398
2517
|
}
|
|
2399
|
-
getWorksheetAt(e, t =
|
|
2518
|
+
getWorksheetAt(e, t = T.Visibility.Visible) {
|
|
2400
2519
|
let n = this._getWorksheets(t)[e];
|
|
2401
|
-
if (!n) throw new
|
|
2402
|
-
return
|
|
2520
|
+
if (!n) throw new V(function(e) {
|
|
2521
|
+
return W("error.workbook.sheetIndexNotFound", { index: e });
|
|
2403
2522
|
}(e));
|
|
2404
2523
|
return n;
|
|
2405
2524
|
}
|
|
@@ -2407,10 +2526,10 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2407
2526
|
let e = this.getSelectedWorksheet();
|
|
2408
2527
|
if (e) return e;
|
|
2409
2528
|
let t = this.getSelectedSheet();
|
|
2410
|
-
throw new B(
|
|
2529
|
+
throw new B(Vr(t?.getName() ?? "", t?.getKind() ?? T.Kind.Worksheet));
|
|
2411
2530
|
}
|
|
2412
2531
|
_anchorWorksheet() {
|
|
2413
|
-
return this.getSelectedWorksheet() || (this._getWorksheets(
|
|
2532
|
+
return this.getSelectedWorksheet() || (this._getWorksheets(T.Visibility.VeryHidden)[0] ?? null);
|
|
2414
2533
|
}
|
|
2415
2534
|
getWorksheets() {
|
|
2416
2535
|
return this._sheets;
|
|
@@ -2418,7 +2537,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2418
2537
|
addWorksheet(e) {
|
|
2419
2538
|
return this.getWorksheets().add(e);
|
|
2420
2539
|
}
|
|
2421
|
-
_getWorksheets(e =
|
|
2540
|
+
_getWorksheets(e = T.Visibility.Visible) {
|
|
2422
2541
|
let t = this._getSheetRefs(e), n = [], r = t.length;
|
|
2423
2542
|
for (let e = 0; e < r; e++) {
|
|
2424
2543
|
let r = t[e];
|
|
@@ -2426,27 +2545,27 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2426
2545
|
}
|
|
2427
2546
|
return n;
|
|
2428
2547
|
}
|
|
2429
|
-
_getSheetRefs(e =
|
|
2548
|
+
_getSheetRefs(e = T.Visibility.Visible) {
|
|
2430
2549
|
let t = this._getState();
|
|
2431
|
-
return t ? e ===
|
|
2550
|
+
return t ? e === T.Visibility.Visible ? t.sheetRefsVisible : e === T.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === T.Visibility.VeryHidden ? t.sheetRefsAll : R.EmptyArray : [];
|
|
2432
2551
|
}
|
|
2433
|
-
_getSheetRef(e, t =
|
|
2552
|
+
_getSheetRef(e, t = T.Visibility.Visible) {
|
|
2434
2553
|
let n = null;
|
|
2435
2554
|
return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : !0 === e?.isISheet ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
|
|
2436
2555
|
}
|
|
2437
2556
|
_validateNewSheetName(e, t = !0) {
|
|
2438
2557
|
if (e == null) return e;
|
|
2439
|
-
if (
|
|
2558
|
+
if (qr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new B(W("error.workbook.nameTaken"));
|
|
2440
2559
|
return e.substring(0, 31);
|
|
2441
2560
|
}
|
|
2442
2561
|
findValidSheetName(e) {
|
|
2443
|
-
e &&=
|
|
2562
|
+
e &&= qr(e, !0);
|
|
2444
2563
|
try {
|
|
2445
2564
|
return function(e, t) {
|
|
2446
2565
|
try {
|
|
2447
2566
|
if (t(e)) return e;
|
|
2448
2567
|
} catch {}
|
|
2449
|
-
let n, r, i =
|
|
2568
|
+
let n, r, i = Wr.exec(e);
|
|
2450
2569
|
for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
|
|
2451
2570
|
r++;
|
|
2452
2571
|
let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
|
|
@@ -2461,25 +2580,25 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2461
2580
|
}
|
|
2462
2581
|
}
|
|
2463
2582
|
isValidSheetNameCharacter(e) {
|
|
2464
|
-
return !
|
|
2583
|
+
return !Ur.test(e);
|
|
2465
2584
|
}
|
|
2466
2585
|
_isStructureProtected() {
|
|
2467
2586
|
return !this._initializing && !this.getProtection().isStructureAllowed();
|
|
2468
2587
|
}
|
|
2469
2588
|
_addSheetOptions(e) {
|
|
2470
|
-
if (this._closed) throw Error(
|
|
2471
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2589
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2590
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
2472
2591
|
let t, n = null;
|
|
2473
2592
|
t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
|
|
2474
2593
|
...t,
|
|
2475
|
-
description: t?.description ??
|
|
2594
|
+
description: t?.description ?? U("op.addSheet")
|
|
2476
2595
|
};
|
|
2477
2596
|
let r = this.beginCommit(t);
|
|
2478
2597
|
try {
|
|
2479
2598
|
let e = t?.autoSelect ?? !1;
|
|
2480
2599
|
n = this._addSheet(!0, t.name, t.index ?? null);
|
|
2481
2600
|
let i = this.getView().getActiveSheetId();
|
|
2482
|
-
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description:
|
|
2601
|
+
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description: W("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
|
|
2483
2602
|
let t = typeof e == "boolean" ? void 0 : e;
|
|
2484
2603
|
n.select(t);
|
|
2485
2604
|
}
|
|
@@ -2491,7 +2610,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2491
2610
|
_nextSheetName(e = null) {
|
|
2492
2611
|
let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
|
|
2493
2612
|
if (e && r.has(t)) throw new B(function(e) {
|
|
2494
|
-
return
|
|
2613
|
+
return W("error.workbook.nameDuplicate", { sheetName: e });
|
|
2495
2614
|
}(e));
|
|
2496
2615
|
t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
|
|
2497
2616
|
let i = n.lastId + 1;
|
|
@@ -2503,13 +2622,13 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2503
2622
|
}
|
|
2504
2623
|
_addSheet(e, t = null, n = null, r) {
|
|
2505
2624
|
t = this._nextSheetName(t);
|
|
2506
|
-
let i = this._getState(), a = this._createSheet(i.lastId, t,
|
|
2507
|
-
if (!a) throw new B(
|
|
2625
|
+
let i = this._getState(), a = this._createSheet(i.lastId, t, T.Visibility.Visible, n, void 0, null, r);
|
|
2626
|
+
if (!a) throw new B(W("error.workbook.sheetNameBlank"));
|
|
2508
2627
|
return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), a;
|
|
2509
2628
|
}
|
|
2510
2629
|
_createOpaqueSheet(e, t, n, r, i, a, o, s, c) {
|
|
2511
2630
|
let l = this, u = null;
|
|
2512
|
-
return u = new
|
|
2631
|
+
return u = new Ar({
|
|
2513
2632
|
kind: a,
|
|
2514
2633
|
id: c ?? t + "-" + R.uuidV4(),
|
|
2515
2634
|
part: o,
|
|
@@ -2522,25 +2641,25 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2522
2641
|
setName: (e, t) => {
|
|
2523
2642
|
l._setSheetName(u, e, t);
|
|
2524
2643
|
},
|
|
2525
|
-
getVisibility: () => l._getSheetRef(u,
|
|
2644
|
+
getVisibility: () => l._getSheetRef(u, T.Visibility.VeryHidden)?.visibility ?? T.Visibility.Visible,
|
|
2526
2645
|
setVisibility: (e, t) => {
|
|
2527
2646
|
l._setSheetVisibility(u, e, t);
|
|
2528
2647
|
},
|
|
2529
2648
|
getIndex: () => {
|
|
2530
|
-
let e = l._getSheetRef(u,
|
|
2531
|
-
return e ? l._getOffsetForId(e.id, l._getSheetRefs(
|
|
2649
|
+
let e = l._getSheetRef(u, T.Visibility.VeryHidden);
|
|
2650
|
+
return e ? l._getOffsetForId(e.id, l._getSheetRefs(T.Visibility.VeryHidden)) : -1;
|
|
2532
2651
|
},
|
|
2533
2652
|
setIndex: (e, t) => {
|
|
2534
|
-
let n = l._getSheetRef(u,
|
|
2653
|
+
let n = l._getSheetRef(u, T.Visibility.VeryHidden);
|
|
2535
2654
|
n && l._moveSheet(n, e, t);
|
|
2536
2655
|
},
|
|
2537
2656
|
requestSelect: () => l._requestSelect(u),
|
|
2538
|
-
isAttached: () => !!l._getSheetRef(u,
|
|
2657
|
+
isAttached: () => !!l._getSheetRef(u, T.Visibility.VeryHidden)
|
|
2539
2658
|
}
|
|
2540
2659
|
}), this._sheetOnNameChange.set(e, () => u._notify("onNameChange")), this._sheetOnVisibilityChange.set(e, () => u._notify("onVisibilityChange")), this._sheetOnIndexChange.set(e, () => u._notify("onIndexChange")), this._addSheetRef({
|
|
2541
2660
|
name: t,
|
|
2542
2661
|
id: e,
|
|
2543
|
-
visibility: n ??
|
|
2662
|
+
visibility: n ?? T.Visibility.Visible,
|
|
2544
2663
|
sheetId: i,
|
|
2545
2664
|
sheet: u
|
|
2546
2665
|
}, r), u;
|
|
@@ -2553,10 +2672,10 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2553
2672
|
}), this.getSelectedSheet() === e;
|
|
2554
2673
|
}
|
|
2555
2674
|
_updateSheetRefStates(e) {
|
|
2556
|
-
if (this._closed) throw Error(
|
|
2557
|
-
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new
|
|
2675
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2676
|
+
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
2558
2677
|
let t = e, n = [], r = [], i = t.length;
|
|
2559
|
-
for (let e = 0; e < i; e++) t[e].visibility ===
|
|
2678
|
+
for (let e = 0; e < i; e++) t[e].visibility === T.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === T.Visibility.Hidden && r.push(t[e]);
|
|
2560
2679
|
this._updateState({
|
|
2561
2680
|
sheetRefsAll: t,
|
|
2562
2681
|
sheetRefsVisible: n,
|
|
@@ -2596,9 +2715,9 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2596
2715
|
p._validateDeleteSheet(e);
|
|
2597
2716
|
},
|
|
2598
2717
|
onDelete(e) {
|
|
2599
|
-
let t = p._getSheetRef(e,
|
|
2718
|
+
let t = p._getSheetRef(e, T.Visibility.VeryHidden);
|
|
2600
2719
|
if (!t) return;
|
|
2601
|
-
let n = p._beginCommit({ description:
|
|
2720
|
+
let n = p._beginCommit({ description: W("op.deleteSheet", { name: t.name }) });
|
|
2602
2721
|
try {
|
|
2603
2722
|
let r = p._getState(), i = r.sheetRefsAll, a = p._getOffsetForId(t.id, i), s = [...i];
|
|
2604
2723
|
s.splice(a, 1), p._updateSheetRefStates(s);
|
|
@@ -2652,7 +2771,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2652
2771
|
}
|
|
2653
2772
|
_recordActiveSheet(e, t, n) {
|
|
2654
2773
|
let r = this.getView().getId();
|
|
2655
|
-
e.setIntent(
|
|
2774
|
+
e.setIntent(Yr, (e) => ({
|
|
2656
2775
|
viewId: r,
|
|
2657
2776
|
before: e?.before ?? t,
|
|
2658
2777
|
after: n
|
|
@@ -2682,27 +2801,27 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2682
2801
|
let n = this._view.getActiveSheetId();
|
|
2683
2802
|
n ??= (this._view.setActiveSheetId(t), t);
|
|
2684
2803
|
let r = e.refsById.get(n);
|
|
2685
|
-
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility ===
|
|
2804
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === T.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
|
|
2686
2805
|
}
|
|
2687
2806
|
_validateDeleteSheet(e) {
|
|
2688
|
-
if (this._closed) throw Error(
|
|
2689
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2807
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2808
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
2690
2809
|
let t = this._getSheetRef(e);
|
|
2691
2810
|
if (!t) throw new B(function(e) {
|
|
2692
|
-
return
|
|
2811
|
+
return W("error.workbook.deleteKey", { key: e });
|
|
2693
2812
|
}(e));
|
|
2694
2813
|
let n = this._getState().sheetRefsVisible;
|
|
2695
|
-
if (n.length === 1 && n[0].id === t.id) throw new B(
|
|
2814
|
+
if (n.length === 1 && n[0].id === t.id) throw new B(W("error.workbook.sheetOne"));
|
|
2696
2815
|
}
|
|
2697
2816
|
_getOffsetForId(e, t) {
|
|
2698
2817
|
let n = t.length;
|
|
2699
2818
|
for (let r = 0; r < n; r++) if (t[r].id === e) return r;
|
|
2700
|
-
throw new B(
|
|
2819
|
+
throw new B(W("error.workbook.noVisibleRefs"));
|
|
2701
2820
|
}
|
|
2702
2821
|
find(e) {
|
|
2703
|
-
if (this._closed) throw Error(
|
|
2822
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2704
2823
|
let t = this._getWorksheets();
|
|
2705
|
-
if (t.length === 0) return { next: () =>
|
|
2824
|
+
if (t.length === 0) return { next: () => vt };
|
|
2706
2825
|
if (t.length === 1) return t[0].find(e);
|
|
2707
2826
|
typeof e == "string" && (e = { text: e });
|
|
2708
2827
|
let n = !e?.reverse, r = e?.disableWrap ?? !1, i = this._worksheetOffsetFrom(this.getSelectedSheetIndex(), t), a = i, o = t[a], s = !1;
|
|
@@ -2728,7 +2847,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2728
2847
|
}
|
|
2729
2848
|
if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
|
|
2730
2849
|
let e = u;
|
|
2731
|
-
return u =
|
|
2850
|
+
return u = vt, e;
|
|
2732
2851
|
}
|
|
2733
2852
|
let p = u;
|
|
2734
2853
|
return u = l.next(), p;
|
|
@@ -2740,7 +2859,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2740
2859
|
} };
|
|
2741
2860
|
}
|
|
2742
2861
|
replace(e, t, n) {
|
|
2743
|
-
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ?
|
|
2862
|
+
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? gt(t) : null, u = n?.description ?? U("op.replace"), d = this._transactions.beginCommit({ description: u });
|
|
2744
2863
|
try {
|
|
2745
2864
|
let u = null, f = null, p = e.next();
|
|
2746
2865
|
for (; !p.done && r < o;) {
|
|
@@ -2752,10 +2871,10 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2752
2871
|
let c = a ? t(o) : t;
|
|
2753
2872
|
c !== void 0 && c !== o && (f.push(o, c), r++, i = o), p = e.next();
|
|
2754
2873
|
}
|
|
2755
|
-
f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({ description: n?.description ?? (s ? l === null ?
|
|
2874
|
+
f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({ description: n?.description ?? (s ? l === null ? U("op.replaceAll") : W("op.replaceAllWith", { value: l }) : c ? l === null ? W("op.replaceAt", { address: c }) : W("op.replaceAtWith", {
|
|
2756
2875
|
address: c,
|
|
2757
2876
|
value: l
|
|
2758
|
-
}) : l === null ?
|
|
2877
|
+
}) : l === null ? U("op.replace") : W("op.replaceWith", { value: l })) });
|
|
2759
2878
|
} catch (e) {
|
|
2760
2879
|
throw d.rollback(), e;
|
|
2761
2880
|
}
|
|
@@ -2783,89 +2902,89 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2783
2902
|
return 0;
|
|
2784
2903
|
}
|
|
2785
2904
|
getNextSheet(e) {
|
|
2786
|
-
if (this._closed) throw Error(
|
|
2905
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2787
2906
|
let t = this._getSheetRefs();
|
|
2788
2907
|
return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
|
|
2789
2908
|
}
|
|
2790
2909
|
getPreviousSheet(e) {
|
|
2791
|
-
if (this._closed) throw Error(
|
|
2910
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2792
2911
|
let t = this._getSheetRefs();
|
|
2793
2912
|
return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
|
|
2794
2913
|
}
|
|
2795
2914
|
async _duplicateSheet(e) {
|
|
2796
|
-
if (this._closed) throw Error(
|
|
2797
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2915
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2916
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
2798
2917
|
let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
|
|
2799
2918
|
if (e) {
|
|
2800
|
-
if (r = this._getSheetRef(e), !r) throw new B(
|
|
2919
|
+
if (r = this._getSheetRef(e), !r) throw new B(Rr(r));
|
|
2801
2920
|
} else r = t[n];
|
|
2802
2921
|
if (!r) return null;
|
|
2803
|
-
if (!Z(r)) throw new B((i = r.name,
|
|
2922
|
+
if (!Z(r)) throw new B((i = r.name, W("error.workbook.sheetNotDuplicable", { sheetName: i })));
|
|
2804
2923
|
var i;
|
|
2805
|
-
let a = r.sheet, o = this._strings.beginPersist(), s = this.getResources().beginPersist(), c = this.getStyles().beginPersist(), l =
|
|
2924
|
+
let a = r.sheet, o = this._strings.beginPersist(), s = this.getResources().beginPersist(), c = this.getStyles().beginPersist(), l = this._richValues.beginPersist(), u = null, d = this.beginCommit(W("op.duplicateNamed", { name: a.getName() }));
|
|
2806
2925
|
try {
|
|
2807
2926
|
let e = this._getState().refsByInstance.get(a), r = await a.toJSON(), i = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(i, o, e.visibility, n, void 0, r);
|
|
2808
|
-
this._tellSheets(), this._emitter.notify("onSheetsChange"),
|
|
2927
|
+
this._tellSheets(), this._emitter.notify("onSheetsChange"), u = s, d.commit();
|
|
2809
2928
|
} catch (e) {
|
|
2810
|
-
throw
|
|
2929
|
+
throw d.rollback(), e;
|
|
2811
2930
|
} finally {
|
|
2812
|
-
c.endPersist(), s.endPersist(), o.endPersist();
|
|
2931
|
+
l.endPersist(), c.endPersist(), s.endPersist(), o.endPersist();
|
|
2813
2932
|
}
|
|
2814
|
-
return
|
|
2933
|
+
return u;
|
|
2815
2934
|
}
|
|
2816
2935
|
_createRange(e, t) {
|
|
2817
|
-
let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope,
|
|
2818
|
-
if (r && !Z(r)) throw new B(
|
|
2936
|
+
let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, T.Visibility.VeryHidden) : null;
|
|
2937
|
+
if (r && !Z(r)) throw new B(Br(r.name, r.sheet.getKind()));
|
|
2819
2938
|
if (!r) {
|
|
2820
2939
|
let e = this._anchorWorksheet();
|
|
2821
|
-
return e ? (delete n?.scope,
|
|
2822
|
-
scope:
|
|
2940
|
+
return e ? (delete n?.scope, Kr(n, n ? {
|
|
2941
|
+
scope: Ke,
|
|
2823
2942
|
...e.getEntireRange().getCoords()
|
|
2824
|
-
} : null)) : void console.warn(
|
|
2943
|
+
} : null)) : void console.warn(W("error.workbook.noVisibleRefs"));
|
|
2825
2944
|
}
|
|
2826
2945
|
let i = r.sheet, a = null;
|
|
2827
|
-
return t && (a = { getOptions: t }), new
|
|
2946
|
+
return t && (a = { getOptions: t }), new Zr(e, j(i), this, a);
|
|
2828
2947
|
}
|
|
2829
2948
|
_createRanges(e, t) {
|
|
2830
2949
|
let n = this._anchorWorksheet();
|
|
2831
|
-
if (!n) throw new B(
|
|
2950
|
+
if (!n) throw new B(Vr("", T.Kind.Worksheet));
|
|
2832
2951
|
let r = null;
|
|
2833
|
-
return t && (r = { getOptions: t }), new
|
|
2952
|
+
return t && (r = { getOptions: t }), new Xr(e, j(n), this, r);
|
|
2834
2953
|
}
|
|
2835
2954
|
getRange(e, t) {
|
|
2836
2955
|
if (e === void 0) return this.getSelectedRange(t);
|
|
2837
2956
|
try {
|
|
2838
2957
|
let n = this._rangesAddressToCoords(e);
|
|
2839
|
-
if (n.length !== 1) throw new B(
|
|
2958
|
+
if (n.length !== 1) throw new B(W("error.address.singleRangeOnlyAlt"));
|
|
2840
2959
|
return this._createRange(n[0], t);
|
|
2841
2960
|
} catch (t) {
|
|
2842
|
-
throw t instanceof
|
|
2961
|
+
throw t instanceof V ? new V(t.message) : new B(t.message ?? pe(e));
|
|
2843
2962
|
}
|
|
2844
2963
|
}
|
|
2845
2964
|
getCell(e) {
|
|
2846
2965
|
if (e === void 0) return this.getSelectedCell();
|
|
2847
2966
|
let t = this.getRange(e);
|
|
2848
|
-
if (t.size > 1) throw new B(
|
|
2967
|
+
if (t.size > 1) throw new B(W("error.address.singleCellOnly"));
|
|
2849
2968
|
return t.getCell();
|
|
2850
2969
|
}
|
|
2851
2970
|
getRanges(e, t) {
|
|
2852
2971
|
let n = this._rangesAddressToCoords(e);
|
|
2853
|
-
if (n.length === 0) throw new B(
|
|
2972
|
+
if (n.length === 0) throw new B(pe(e));
|
|
2854
2973
|
return this._createRanges(n, t);
|
|
2855
2974
|
}
|
|
2856
2975
|
_createGraphRanges(e, t) {
|
|
2857
2976
|
let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
|
|
2858
2977
|
for (let e = 0; e < t.length; e++) {
|
|
2859
|
-
let i = t[e], a = i.sheetName ? this._getSheetRef(i.sheetName,
|
|
2860
|
-
o && n.push(new
|
|
2978
|
+
let i = t[e], a = i.sheetName ? this._getSheetRef(i.sheetName, T.Visibility.VeryHidden) : null, o = a && Z(a) ? a.sheet : this._anchorWorksheet();
|
|
2979
|
+
o && n.push(new be(i, r, j(o), null));
|
|
2861
2980
|
}
|
|
2862
2981
|
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2863
2982
|
let i = this._anchorWorksheet();
|
|
2864
|
-
return n.length !== 0 && i ? new
|
|
2983
|
+
return n.length !== 0 && i ? new Xr(n, j(i), this, null) : null;
|
|
2865
2984
|
}
|
|
2866
2985
|
getAnomalies(e) {
|
|
2867
|
-
if (this._closed) throw Error(
|
|
2868
|
-
let t =
|
|
2986
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2987
|
+
let t = oe(e), n = this._getWorksheets(T.Visibility.VeryHidden).map((e) => {
|
|
2869
2988
|
let t = j(e);
|
|
2870
2989
|
return {
|
|
2871
2990
|
bounds: t.getSheet().getEntireCoords(),
|
|
@@ -2873,15 +2992,15 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2873
2992
|
qualified: !0
|
|
2874
2993
|
};
|
|
2875
2994
|
});
|
|
2876
|
-
return new
|
|
2995
|
+
return new w(n, () => (this.getSelectedWorksheet() ?? this._getWorksheets(T.Visibility.VeryHidden)[0]).getEntireRange(), t);
|
|
2877
2996
|
}
|
|
2878
2997
|
getStats(e) {
|
|
2879
|
-
if (this._closed) throw Error(
|
|
2880
|
-
let t = this._getWorksheets(
|
|
2998
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
2999
|
+
let t = this._getWorksheets(T.Visibility.VeryHidden), n = t.length;
|
|
2881
3000
|
if (n === 1) return t[0].getStats(e);
|
|
2882
3001
|
let r = Array(n);
|
|
2883
3002
|
for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
|
|
2884
|
-
return new
|
|
3003
|
+
return new fr(r);
|
|
2885
3004
|
}
|
|
2886
3005
|
_activeRangeCoords() {
|
|
2887
3006
|
let e = this._requireSelectedWorksheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
|
|
@@ -2906,21 +3025,21 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2906
3025
|
getSelectedCell() {
|
|
2907
3026
|
return this._requireSelectedWorksheet().getSelectedCell();
|
|
2908
3027
|
}
|
|
2909
|
-
_rangesAddressToCoords(e, t = !0, n =
|
|
2910
|
-
if (!e) throw new B(
|
|
2911
|
-
let r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() },
|
|
2912
|
-
if (
|
|
3028
|
+
_rangesAddressToCoords(e, t = !0, n = T.Visibility.Hidden) {
|
|
3029
|
+
if (!e) throw new B(W("error.address.noAddress"));
|
|
3030
|
+
let r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() }, a = r?.getName();
|
|
3031
|
+
if (a && (i.scope = a), typeof e == "string") {
|
|
2913
3032
|
let t = e.trim().toLowerCase();
|
|
2914
3033
|
if (t === "r" || t === "c") {
|
|
2915
3034
|
let n = this.getSelectedCell().getCoords(), r = {};
|
|
2916
3035
|
t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
|
|
2917
3036
|
}
|
|
2918
3037
|
}
|
|
2919
|
-
let s = this, c =
|
|
3038
|
+
let s = this, c = Et(e, i, it, (e) => {
|
|
2920
3039
|
if (!t) return null;
|
|
2921
3040
|
if (typeof e == "string") {
|
|
2922
|
-
let t =
|
|
2923
|
-
getTable: (e) =>
|
|
3041
|
+
let t = ct(e, {
|
|
3042
|
+
getTable: (e) => o(s.getNames().getByName(e)),
|
|
2924
3043
|
getAnchor: () => r ? {
|
|
2925
3044
|
sheet: r,
|
|
2926
3045
|
coords: r.getSelectedCell().getCoords()
|
|
@@ -2935,11 +3054,11 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2935
3054
|
for (let e = 0; e < l; e++) this._validateCoords(c[e], n);
|
|
2936
3055
|
return c;
|
|
2937
3056
|
}
|
|
2938
|
-
_validateCoords(e, t =
|
|
3057
|
+
_validateCoords(e, t = T.Visibility.Visible, n = W("error.sheet.oobRange")) {
|
|
2939
3058
|
if (e === null) return;
|
|
2940
3059
|
let r = this.getWorksheet(e.scope ?? void 0, t).getEntireRange().getCoords();
|
|
2941
|
-
if (!z.isRangeWithinRange(e, r)) throw new
|
|
2942
|
-
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new B(
|
|
3060
|
+
if (!z.isRangeWithinRange(e, r)) throw new V(n);
|
|
3061
|
+
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new B(W("error.address.invalidRangeInverted"));
|
|
2943
3062
|
}
|
|
2944
3063
|
_updateSheetRef(e, t) {
|
|
2945
3064
|
let n = this._getState(), r = [...n.sheetRefsAll];
|
|
@@ -2959,16 +3078,16 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2959
3078
|
}), this._tellSheets(), t;
|
|
2960
3079
|
}
|
|
2961
3080
|
_setSheetName(e, t, n) {
|
|
2962
|
-
if (this._closed) throw Error(
|
|
2963
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
3081
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3082
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
2964
3083
|
let r = this._getSheetRef(e);
|
|
2965
|
-
if (!r) throw new B(
|
|
3084
|
+
if (!r) throw new B(Rr(e));
|
|
2966
3085
|
if (t === r.name) return r.sheet;
|
|
2967
|
-
if ((t = this._validateNewSheetName(t)) == null) throw new B(
|
|
3086
|
+
if ((t = this._validateNewSheetName(t)) == null) throw new B(W("error.workbook.sheetNameNotProvided"));
|
|
2968
3087
|
let i = Object.freeze({
|
|
2969
3088
|
...r,
|
|
2970
3089
|
name: t
|
|
2971
|
-
}), a = null, o = this.beginCommit(
|
|
3090
|
+
}), a = null, o = this.beginCommit(U("op.renameSheet"));
|
|
2972
3091
|
try {
|
|
2973
3092
|
let e = this._updateSheetRef(r, i);
|
|
2974
3093
|
this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
|
|
@@ -2979,23 +3098,23 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
2979
3098
|
}
|
|
2980
3099
|
return a;
|
|
2981
3100
|
}
|
|
2982
|
-
_setSheetVisibility(e, t =
|
|
2983
|
-
if (this._closed) throw Error(
|
|
2984
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2985
|
-
let r = this._getSheetRef(e,
|
|
3101
|
+
_setSheetVisibility(e, t = T.Visibility.Visible, n) {
|
|
3102
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3103
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
3104
|
+
let r = this._getSheetRef(e, T.Visibility.VeryHidden);
|
|
2986
3105
|
if (!r) return null;
|
|
2987
3106
|
if (t === r.visibility) return;
|
|
2988
3107
|
let i = null, a = "";
|
|
2989
|
-
t ===
|
|
3108
|
+
t === T.Visibility.Visible ? a = U("op.unhideSheet") : t === T.Visibility.Hidden ? a = U("op.hideSheet") : t === T.Visibility.VeryHidden && (a = U("op.veryHideSheet"));
|
|
2990
3109
|
let o = this.beginCommit(a);
|
|
2991
3110
|
try {
|
|
2992
3111
|
let e = this._getState().sheetRefsVisible;
|
|
2993
|
-
if (t !==
|
|
3112
|
+
if (t !== T.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new B(W("error.workbook.sheetOne"));
|
|
2994
3113
|
let a = {
|
|
2995
3114
|
...r,
|
|
2996
3115
|
visibility: t
|
|
2997
3116
|
}, s = -1;
|
|
2998
|
-
t !==
|
|
3117
|
+
t !== T.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== T.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
|
|
2999
3118
|
} catch (e) {
|
|
3000
3119
|
throw o.rollback(), e;
|
|
3001
3120
|
}
|
|
@@ -3004,9 +3123,9 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3004
3123
|
}), this._emitter.notify("onSheetsChange"), i;
|
|
3005
3124
|
}
|
|
3006
3125
|
_moveSheet(e, t, n) {
|
|
3007
|
-
if (this._closed) throw Error(
|
|
3008
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
3009
|
-
let r = null, i = this.beginCommit(
|
|
3126
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3127
|
+
if (!this.getProtection().isStructureAllowed()) throw new H(W("error.workbook.protection"));
|
|
3128
|
+
let r = null, i = this.beginCommit(W("op.moveSheetNamed", { name: e.name }));
|
|
3010
3129
|
try {
|
|
3011
3130
|
let a = this._getState(), o = a.sheetRefsVisible;
|
|
3012
3131
|
if (t < 0 || t > o.length - 1) throw new B(`Invalid to index: ${t}`);
|
|
@@ -3022,11 +3141,11 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3022
3141
|
return r;
|
|
3023
3142
|
}
|
|
3024
3143
|
_setSelectedSheet(e) {
|
|
3025
|
-
if (this._closed) throw Error(
|
|
3144
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3026
3145
|
let t = this._getSheetRef(e);
|
|
3027
|
-
if (!t) throw new B(
|
|
3146
|
+
if (!t) throw new B(Rr(e));
|
|
3028
3147
|
let n = null;
|
|
3029
|
-
return t.visibility !==
|
|
3148
|
+
return t.visibility !== T.Visibility.Visible && this._setSheetVisibility(t, T.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
|
|
3030
3149
|
}
|
|
3031
3150
|
getProtection() {
|
|
3032
3151
|
return this._protection;
|
|
@@ -3044,7 +3163,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3044
3163
|
return this._calculation;
|
|
3045
3164
|
}
|
|
3046
3165
|
getFonts() {
|
|
3047
|
-
return
|
|
3166
|
+
return me.getShared();
|
|
3048
3167
|
}
|
|
3049
3168
|
createFormula(e, t, n) {
|
|
3050
3169
|
return this.getCalculation().createFormula(e, t, n);
|
|
@@ -3075,39 +3194,35 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3075
3194
|
return this._emitter.addListeners(e, t);
|
|
3076
3195
|
}
|
|
3077
3196
|
_sheetToWBEvent(e) {
|
|
3078
|
-
let t = this
|
|
3079
|
-
|
|
3080
|
-
let
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
let n = e.getCoords(), r = e.getWorksheet().getName();
|
|
3096
|
-
return t.getRange({
|
|
3097
|
-
...n,
|
|
3098
|
-
scope: r
|
|
3099
|
-
});
|
|
3100
|
-
}
|
|
3101
|
-
};
|
|
3197
|
+
let t = this, n = (e) => {
|
|
3198
|
+
if (e.isInvalid()) return e;
|
|
3199
|
+
let n = e.getWorksheet().getName();
|
|
3200
|
+
if (e.isICellRanges) {
|
|
3201
|
+
let r = e.getCoords().map((e) => e.scope ? e : {
|
|
3202
|
+
...e,
|
|
3203
|
+
scope: n
|
|
3204
|
+
});
|
|
3205
|
+
return t.getRanges(r);
|
|
3206
|
+
}
|
|
3207
|
+
let r = e.getCoords();
|
|
3208
|
+
return t.getRange(r.scope ? r : {
|
|
3209
|
+
...r,
|
|
3210
|
+
scope: n
|
|
3211
|
+
});
|
|
3212
|
+
};
|
|
3213
|
+
return (t) => {
|
|
3102
3214
|
e({
|
|
3103
|
-
getSource:
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3215
|
+
getSource: () => n(t.getSource()),
|
|
3216
|
+
getRanges: () => {
|
|
3217
|
+
let e = t.getRanges();
|
|
3218
|
+
return e ? n(e) : null;
|
|
3219
|
+
},
|
|
3220
|
+
getPreviousAddress: () => t.getPreviousAddress(),
|
|
3221
|
+
getTrigger: () => t.getTrigger(),
|
|
3222
|
+
isUndo: () => t.isUndo(),
|
|
3223
|
+
getCommit: () => t.getCommit(),
|
|
3224
|
+
toString: () => `WorkbookRangeEvent: ('${t.getTrigger()}', ${n(t.getSource()).toString()})`,
|
|
3225
|
+
getTimeStamp: () => t.getTimeStamp()
|
|
3111
3226
|
});
|
|
3112
3227
|
};
|
|
3113
3228
|
}
|
|
@@ -3121,67 +3236,83 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3121
3236
|
for (let n = 0; n < e.length; n++) e[n]._hold(t);
|
|
3122
3237
|
}
|
|
3123
3238
|
_fromJSON(e, t) {
|
|
3124
|
-
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new B(
|
|
3125
|
-
e.theme && (this._theme = new
|
|
3126
|
-
let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
|
|
3239
|
+
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new B(W("error.workbook.sheetOne"));
|
|
3240
|
+
e.theme && (this._theme = new le(e.theme), this._styles.setTheme(this._theme));
|
|
3241
|
+
let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist(), a = this._richValues.beginPersist();
|
|
3127
3242
|
try {
|
|
3128
|
-
n.fromJSON(e.strings), r.fromJSON(e.resources),
|
|
3129
|
-
|
|
3130
|
-
|
|
3243
|
+
n.fromJSON(e.strings), r.fromJSON(e.resources), this._fetch.adopt(this._resources.getItems()), i.fromJSON(e.styles), a.fromJSON(e.richData, {
|
|
3244
|
+
resources: this._resources,
|
|
3245
|
+
strings: this._strings,
|
|
3246
|
+
fromResourceId: (e) => r.fromResourceId(e) ?? null
|
|
3247
|
+
}, e.richTypes), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, this._documentProperties.fromJSON(e.properties), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
|
|
3248
|
+
let o = [], s = e.pivotCaches;
|
|
3249
|
+
if (s) {
|
|
3131
3250
|
let e = r.fromResourceId.bind(r);
|
|
3132
|
-
for (let t = 0; t <
|
|
3133
|
-
let n =
|
|
3134
|
-
n && typeof n.cacheId == "number" &&
|
|
3251
|
+
for (let t = 0; t < s.length; t++) {
|
|
3252
|
+
let n = s[t];
|
|
3253
|
+
n && typeof n.cacheId == "number" && o.push(new gr(n.cacheId, k.fromJSON(n.part, e)));
|
|
3135
3254
|
}
|
|
3136
3255
|
}
|
|
3137
|
-
this._pivotCaches =
|
|
3138
|
-
let
|
|
3139
|
-
|
|
3140
|
-
let
|
|
3256
|
+
this._pivotCaches = o, this._people.fromJSON(e.people);
|
|
3257
|
+
let c = e.sheets, l = c.length, u = e.view.activeSheetId ?? null;
|
|
3258
|
+
u !== null && (u = Math.min(Math.max(0, u), l - 1));
|
|
3259
|
+
let d = null, f = null;
|
|
3141
3260
|
this._isLoadingSheets = !0;
|
|
3142
|
-
for (let e = 0; e <
|
|
3143
|
-
let n =
|
|
3144
|
-
|
|
3261
|
+
for (let e = 0; e < l; e++) {
|
|
3262
|
+
let n = c[e], i = n.visibility || T.Visibility.Visible, a = e;
|
|
3263
|
+
f = a, i === T.Visibility.Visible ? d === null && (d = a) : u !== null && u === a && (u = null);
|
|
3145
3264
|
try {
|
|
3146
|
-
let o = n.kind ??
|
|
3147
|
-
if (o !==
|
|
3148
|
-
let s = n.sheet, c =
|
|
3149
|
-
if (!c) throw new B(
|
|
3265
|
+
let o = n.kind ?? T.Kind.Worksheet;
|
|
3266
|
+
if (o !== T.Kind.Worksheet) {
|
|
3267
|
+
let s = n.sheet, c = k.fromJSON(s?.part, r.fromResourceId.bind(r));
|
|
3268
|
+
if (!c) throw new B(W("error.workbook.sheetPartMissing", { sheetName: n.name }));
|
|
3150
3269
|
this._createOpaqueSheet(a, n.name, i, e, n.sheetId, o, c, s?.tabColor ?? null, t?.[e]);
|
|
3151
3270
|
} else this._createSheet(a, n.name, i, e, n.sheetId, n.sheet, t?.[e]);
|
|
3152
3271
|
} catch (e) {
|
|
3153
3272
|
throw this._isLoadingSheets = !1, e;
|
|
3154
3273
|
}
|
|
3155
3274
|
}
|
|
3156
|
-
this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId:
|
|
3157
|
-
let
|
|
3158
|
-
this._protection = new
|
|
3159
|
-
|
|
3275
|
+
this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId: f }), e.view.activeSheetId = u ?? d, this.setView(new Mr({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
3276
|
+
let p = this;
|
|
3277
|
+
this._protection = new Pr(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
3278
|
+
p._emitter.notify("onProtectionChange", { source: e });
|
|
3160
3279
|
} }), this._emitter.notify("onLoad");
|
|
3161
3280
|
} finally {
|
|
3162
|
-
i.endPersist(), r.endPersist(), n.endPersist();
|
|
3281
|
+
a.endPersist(), i.endPersist(), r.endPersist(), n.endPersist();
|
|
3163
3282
|
}
|
|
3164
3283
|
}
|
|
3284
|
+
async _startFunctions() {
|
|
3285
|
+
let e = this._scripts;
|
|
3286
|
+
if (!e) return R.EmptyArray;
|
|
3287
|
+
await e._load();
|
|
3288
|
+
let t = [];
|
|
3289
|
+
for (let n of e.getModules().getItems()) this._startModules.add(n), t.push(...n.getFunctions().getItems({
|
|
3290
|
+
type: "formula",
|
|
3291
|
+
includeHidden: !0
|
|
3292
|
+
}));
|
|
3293
|
+
return t;
|
|
3294
|
+
}
|
|
3165
3295
|
_createScripts(e) {
|
|
3166
3296
|
let t = this;
|
|
3167
|
-
return new
|
|
3297
|
+
return new br({
|
|
3168
3298
|
transactions: this._transactions,
|
|
3169
3299
|
json: e,
|
|
3170
3300
|
workbook: t,
|
|
3171
3301
|
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
3172
3302
|
onAdd: (e, n) => {
|
|
3173
3303
|
let r = t._calculation;
|
|
3174
|
-
r.getStatus() !==
|
|
3304
|
+
r.getStatus() !== Vt.Status.Off && r.start().then(async () => {
|
|
3305
|
+
if (t._startModules.has(n)) return;
|
|
3175
3306
|
let e = n.getFunctions().getItems({
|
|
3176
3307
|
type: "formula",
|
|
3177
3308
|
includeHidden: !0
|
|
3178
|
-
}),
|
|
3179
|
-
for (let
|
|
3180
|
-
let
|
|
3309
|
+
}), r = e.length;
|
|
3310
|
+
for (let t = 0; t < r; t++) {
|
|
3311
|
+
let n = e[t];
|
|
3181
3312
|
try {
|
|
3182
|
-
await this._calculation.getFunctions().add(
|
|
3313
|
+
await this._calculation.getFunctions().add(n);
|
|
3183
3314
|
} catch (e) {
|
|
3184
|
-
|
|
3315
|
+
En.error(e?.message ?? String(e), e);
|
|
3185
3316
|
}
|
|
3186
3317
|
}
|
|
3187
3318
|
}).catch(() => {});
|
|
@@ -3190,10 +3321,10 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3190
3321
|
});
|
|
3191
3322
|
}
|
|
3192
3323
|
async toJSON(e) {
|
|
3193
|
-
if (this._closed) throw Error(
|
|
3324
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3194
3325
|
await Promise.resolve(this._starting);
|
|
3195
3326
|
let t = this.getCalculation();
|
|
3196
|
-
t.getStatus() !==
|
|
3327
|
+
t.getStatus() !== Vt.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
3197
3328
|
let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
|
|
3198
3329
|
if (!r) {
|
|
3199
3330
|
let e = this._theme.toJSON();
|
|
@@ -3206,56 +3337,62 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3206
3337
|
this._isDate1904 && (n.date1904 = !0), this._codeName && (n.codeName = this._codeName), this._updateLinks && (n.updateLinks = this._updateLinks);
|
|
3207
3338
|
let i = this._documentProperties.toJSON();
|
|
3208
3339
|
Object.keys(i).length > 0 && (n.properties = i), this._locale && (n.locale = this._locale), this._localeOverrides && (n.localeOverrides = this._localeOverrides);
|
|
3209
|
-
let a = e?.resources ?? "embed", o = a === "ignore", s = this._strings.beginPersist(), c = o ? null : this._resources.beginPersist(), l = this._styles.beginPersist();
|
|
3340
|
+
let a = e?.resources ?? "embed", o = a === "ignore", s = this._strings.beginPersist(), c = o ? null : this._resources.beginPersist(), l = this._styles.beginPersist(), u = this._richValues.beginPersist();
|
|
3210
3341
|
try {
|
|
3211
|
-
let t = this._getSheetRef(this.getSelectedSheetIndex()).id, i = t,
|
|
3212
|
-
for (let r = 0; r <
|
|
3213
|
-
let a =
|
|
3342
|
+
let t = this._getSheetRef(this.getSelectedSheetIndex()).id, i = t, d = null, f = this._getState(), p = f.sheetRefsAll, m = f.sheetsById, h = p.length;
|
|
3343
|
+
for (let r = 0; r < h; r++) {
|
|
3344
|
+
let a = p[r], o = r + 1, s, l = m.get(a.id);
|
|
3214
3345
|
if (Z(a)) s = {
|
|
3215
3346
|
name: a.name,
|
|
3216
3347
|
sheet: await a.sheet.toJSON(e)
|
|
3217
3348
|
};
|
|
3218
3349
|
else {
|
|
3219
|
-
let e = l, t = c ? c.toResourceId.bind(c) : () => null, n = { part:
|
|
3350
|
+
let e = l, t = c ? c.toResourceId.bind(c) : () => null, n = { part: k.toJSON(e._getPart(), t) }, r = e.getTabColor();
|
|
3220
3351
|
r && (n.tabColor = r.toString()), s = {
|
|
3221
3352
|
name: a.name,
|
|
3222
3353
|
kind: e.getKind(),
|
|
3223
3354
|
sheet: n
|
|
3224
3355
|
};
|
|
3225
3356
|
}
|
|
3226
|
-
a.sheetId !== void 0 && (s.sheetId = a.sheetId), a.visibility ===
|
|
3357
|
+
a.sheetId !== void 0 && (s.sheetId = a.sheetId), a.visibility === T.Visibility.Visible ? d === null && (d = o) : s.visibility = a.visibility, a.id === t && (i = o), n.sheets.push(s);
|
|
3227
3358
|
}
|
|
3228
3359
|
if (!r) {
|
|
3229
3360
|
let e = l.toJSON();
|
|
3230
3361
|
e && Object.keys(e).length > 0 && (n.styles = e);
|
|
3231
3362
|
}
|
|
3232
|
-
let
|
|
3233
|
-
|
|
3234
|
-
let
|
|
3235
|
-
Object.keys(
|
|
3236
|
-
let
|
|
3237
|
-
|
|
3238
|
-
let
|
|
3239
|
-
v && (n.externalBooks = v);
|
|
3240
|
-
let y = this._pivotCaches;
|
|
3363
|
+
let g = this.getProtection().toJSON();
|
|
3364
|
+
g && (n.protection = g);
|
|
3365
|
+
let _ = this._calculation.toJSON();
|
|
3366
|
+
Object.keys(_).length > 0 && (n.calc = _);
|
|
3367
|
+
let v = await s.toJSONAsync();
|
|
3368
|
+
v && v.length > 0 && (n.strings = v);
|
|
3369
|
+
let y = await u.toJSONAsync(c ? c.toResourceId.bind(c) : void 0);
|
|
3241
3370
|
if (y.length > 0) {
|
|
3371
|
+
n.richData = y;
|
|
3372
|
+
let e = u.toKindsJSON();
|
|
3373
|
+
e.length > 0 && (n.richTypes = e);
|
|
3374
|
+
}
|
|
3375
|
+
let b = this._calculation.getExternalBooks().toJSON();
|
|
3376
|
+
b && (n.externalBooks = b);
|
|
3377
|
+
let x = this._pivotCaches;
|
|
3378
|
+
if (x.length > 0) {
|
|
3242
3379
|
let e = c ? c.toResourceId.bind(c) : () => null, t = /* @__PURE__ */ new Set();
|
|
3243
3380
|
for (let e of this.getPivotTables()) t.add(e.getCacheId());
|
|
3244
3381
|
let r = [];
|
|
3245
|
-
for (let n = 0; n <
|
|
3382
|
+
for (let n = 0; n < x.length; n++) t.has(x[n].cacheId) && r.push(x[n].toJSON(e));
|
|
3246
3383
|
r.length > 0 && (n.pivotCaches = r);
|
|
3247
3384
|
}
|
|
3248
|
-
let
|
|
3249
|
-
if (
|
|
3385
|
+
let S = this._people.toJSON();
|
|
3386
|
+
if (S && (n.people = S), !o) {
|
|
3250
3387
|
let e = await c.toJSONAsync(typeof a == "function" ? a : void 0);
|
|
3251
3388
|
e && e.length > 0 && (n.resources = e);
|
|
3252
3389
|
}
|
|
3253
|
-
let
|
|
3254
|
-
|
|
3255
|
-
let
|
|
3256
|
-
|
|
3390
|
+
let C = this._calculation.getNamedFormulas().toJSON();
|
|
3391
|
+
C && C.length > 0 && (n.names = C);
|
|
3392
|
+
let w = this._view.toJSON();
|
|
3393
|
+
w && (i === d ? delete w.activeSheetId : w.activeSheetId = i, Object.keys(w).length > 0 && (n.view = w));
|
|
3257
3394
|
} finally {
|
|
3258
|
-
l.endPersist(), o || c.endPersist(), s.endPersist();
|
|
3395
|
+
u.endPersist(), l.endPersist(), o || c.endPersist(), s.endPersist();
|
|
3259
3396
|
}
|
|
3260
3397
|
return this._emitter.notify("onSave", { params: n }), n;
|
|
3261
3398
|
}
|
|
@@ -3275,16 +3412,16 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3275
3412
|
} catch (e) {
|
|
3276
3413
|
console.warn("error on close", e);
|
|
3277
3414
|
}
|
|
3278
|
-
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
|
|
3415
|
+
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 zn && this._originProvider.release(), this._closed = !0;
|
|
3279
3416
|
}
|
|
3280
3417
|
beginCommit(e) {
|
|
3281
|
-
if (this._closed) throw Error(
|
|
3418
|
+
if (this._closed) throw Error(W("error.workbook.modelClosed"));
|
|
3282
3419
|
return this._beginCommit(typeof e == "string" ? { description: e } : e);
|
|
3283
3420
|
}
|
|
3284
3421
|
doBatch(e, t) {
|
|
3285
3422
|
let r = this;
|
|
3286
3423
|
t = typeof t == "string" ? { description: t } : {
|
|
3287
|
-
description:
|
|
3424
|
+
description: U("op.updateWorkbook"),
|
|
3288
3425
|
...t
|
|
3289
3426
|
};
|
|
3290
3427
|
let i = n.bind(this._transactions, this, e);
|
|
@@ -3304,7 +3441,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3304
3441
|
_getState() {
|
|
3305
3442
|
return this._transactions.getState(this._id);
|
|
3306
3443
|
}
|
|
3307
|
-
_updateState(e, t =
|
|
3444
|
+
_updateState(e, t = U("op.updateWorkbook"), n) {
|
|
3308
3445
|
if (!e) return;
|
|
3309
3446
|
let r = this._beginCommit(t);
|
|
3310
3447
|
try {
|
|
@@ -3325,7 +3462,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3325
3462
|
get isIWorkbook() {
|
|
3326
3463
|
return !0;
|
|
3327
3464
|
}
|
|
3328
|
-
},
|
|
3465
|
+
}, ei = { address: null }, Z = (e) => e.sheet.getKind() === T.Kind.Worksheet, ti = class {
|
|
3329
3466
|
constructor() {
|
|
3330
3467
|
this._readFormats = [], this._writeFormats = [], this._encryptions = [];
|
|
3331
3468
|
}
|
|
@@ -3399,9 +3536,9 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3399
3536
|
return !0;
|
|
3400
3537
|
});
|
|
3401
3538
|
}
|
|
3402
|
-
},
|
|
3539
|
+
}, ni = /* @__PURE__ */ new WeakMap(), ri = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", ii = class {
|
|
3403
3540
|
constructor() {
|
|
3404
|
-
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new e(this), this._registry = new
|
|
3541
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new e(this), this._registry = new ti(), this._defaultStore = new Vn(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
3405
3542
|
}
|
|
3406
3543
|
getBackingStore() {
|
|
3407
3544
|
return this._backingStore ?? this._defaultStore;
|
|
@@ -3436,15 +3573,15 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3436
3573
|
return this._registry.getWriteFormats(e);
|
|
3437
3574
|
}
|
|
3438
3575
|
getOrigin(e) {
|
|
3439
|
-
return new
|
|
3576
|
+
return new G(e);
|
|
3440
3577
|
}
|
|
3441
3578
|
async read(e) {
|
|
3442
3579
|
let t = null;
|
|
3443
3580
|
if (typeof e == "string") e = { source: e };
|
|
3444
|
-
else if (
|
|
3581
|
+
else if (ri(e)) {
|
|
3445
3582
|
let n = e.getPath();
|
|
3446
3583
|
if (!n) throw Error("Cannot read from an unbound origin (no path).");
|
|
3447
|
-
|
|
3584
|
+
Ln(e) ? e = {
|
|
3448
3585
|
source: n,
|
|
3449
3586
|
asCopy: !0
|
|
3450
3587
|
} : (t = e, e = { source: n });
|
|
@@ -3463,20 +3600,20 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3463
3600
|
search: i,
|
|
3464
3601
|
ext: a
|
|
3465
3602
|
}))[0];
|
|
3466
|
-
if (!o) throw new B(
|
|
3603
|
+
if (!o) throw new B(W("error.io.readFormatUnavailable", { format: i ?? a }));
|
|
3467
3604
|
let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
|
|
3468
3605
|
...n,
|
|
3469
3606
|
...c === void 0 ? void 0 : s[c]
|
|
3470
3607
|
};
|
|
3471
3608
|
delete l.typedCreateWorkbookOptions, delete l.source, delete l.asCopy;
|
|
3472
|
-
let u = r ?? new
|
|
3609
|
+
let u = r ?? new G(t.absolutePath ?? null, {
|
|
3473
3610
|
name: t.name ?? null,
|
|
3474
3611
|
format: o.key,
|
|
3475
3612
|
size: t.size ?? null,
|
|
3476
3613
|
lastModified: t.lastModified ?? null,
|
|
3477
3614
|
canWrite: t.canWrite ?? !1
|
|
3478
3615
|
});
|
|
3479
|
-
r instanceof
|
|
3616
|
+
r instanceof G && r.update({
|
|
3480
3617
|
format: o.key,
|
|
3481
3618
|
size: t.size ?? null,
|
|
3482
3619
|
lastModified: t.lastModified ?? null
|
|
@@ -3510,7 +3647,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3510
3647
|
}
|
|
3511
3648
|
async _decrypt(e, t, n) {
|
|
3512
3649
|
let r = await this._registry.detectEncryption(e);
|
|
3513
|
-
if (t instanceof
|
|
3650
|
+
if (t instanceof G && t.update({ encryption: r ? r.key : null }), !r) return {
|
|
3514
3651
|
bytes: e,
|
|
3515
3652
|
password: null
|
|
3516
3653
|
};
|
|
@@ -3518,7 +3655,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3518
3655
|
try {
|
|
3519
3656
|
return i = await r.decode(e, t), !0;
|
|
3520
3657
|
} catch (e) {
|
|
3521
|
-
if (!(e instanceof
|
|
3658
|
+
if (!(e instanceof wn)) throw e;
|
|
3522
3659
|
return !1;
|
|
3523
3660
|
}
|
|
3524
3661
|
};
|
|
@@ -3528,7 +3665,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3528
3665
|
};
|
|
3529
3666
|
if (!n?.onPassword) {
|
|
3530
3667
|
let e = t.getName();
|
|
3531
|
-
throw new
|
|
3668
|
+
throw new On(e ? W("error.io.passwordRequired", { name: e }) : W("error.io.passwordRequiredUnnamed"));
|
|
3532
3669
|
}
|
|
3533
3670
|
let o = await Promise.resolve(n.onPassword({
|
|
3534
3671
|
origin: t,
|
|
@@ -3540,16 +3677,16 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3540
3677
|
bytes: i,
|
|
3541
3678
|
password: o
|
|
3542
3679
|
};
|
|
3543
|
-
throw new
|
|
3680
|
+
throw new wn(W("error.io.passwordIncorrect"));
|
|
3544
3681
|
}
|
|
3545
3682
|
async writeArrayBuffer(e, t) {
|
|
3546
3683
|
if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3547
3684
|
let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
|
|
3548
|
-
if (!n) throw new B(
|
|
3685
|
+
if (!n) throw new B(W("error.io.writeFormatUnavailable", { format: t.format }));
|
|
3549
3686
|
return this._writeArrayBuffer(e, n, t);
|
|
3550
3687
|
}
|
|
3551
3688
|
async write(e, t, n) {
|
|
3552
|
-
return typeof t == "string" ||
|
|
3689
|
+
return typeof t == "string" || ri(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
|
|
3553
3690
|
}
|
|
3554
3691
|
async writeAs(e, t, n) {
|
|
3555
3692
|
if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
@@ -3559,13 +3696,13 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3559
3696
|
if (!e) throw Error("Workbook must be provided.");
|
|
3560
3697
|
if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
|
|
3561
3698
|
let i = typeof t == "string" ? this.getOrigin(t) : t, a = i.getFormat(), o;
|
|
3562
|
-
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 B(
|
|
3699
|
+
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 B(W("error.io.writeFormatUnresolved"));
|
|
3563
3700
|
let s = i.getExtension();
|
|
3564
3701
|
if (r?.format && s && i.getPath() && i.canWrite() && !o.exts.includes(s)) {
|
|
3565
3702
|
let e = (await this._registry.getWriteFormats({ ext: s }))[0];
|
|
3566
3703
|
if (e && e.key !== o.key) {
|
|
3567
3704
|
let e = i.getPath().split(/[/\\]/).pop();
|
|
3568
|
-
throw new B(
|
|
3705
|
+
throw new B(W("error.io.writeFormatMismatch", {
|
|
3569
3706
|
format: r.format,
|
|
3570
3707
|
file: e
|
|
3571
3708
|
}));
|
|
@@ -3573,16 +3710,16 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3573
3710
|
}
|
|
3574
3711
|
if (typeof t == "string") {
|
|
3575
3712
|
let e = i.getPath();
|
|
3576
|
-
i = new
|
|
3713
|
+
i = new G(O(e) ? e : `${e}.${o.exts[0]}`, { format: o.key });
|
|
3577
3714
|
}
|
|
3578
|
-
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof
|
|
3715
|
+
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof G ? i.getPassword() : null) ?? (l instanceof G ? l.getPassword() : null), d = i.isEncrypted() || (l?.isEncrypted() ?? !1), f = r?.password === void 0 ? u ?? (d ? void 0 : null) : r.password, p = null;
|
|
3579
3716
|
if (f === void 0) {
|
|
3580
3717
|
if (d) {
|
|
3581
3718
|
let e = i.getName();
|
|
3582
|
-
throw new
|
|
3719
|
+
throw new On(e ? W("error.io.passwordRequiredSave", { name: e }) : W("error.io.passwordRequiredSaveUnnamed"));
|
|
3583
3720
|
}
|
|
3584
|
-
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new B(
|
|
3585
|
-
let m = `${i.getName() ??
|
|
3721
|
+
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new B(W("error.io.encryptionUnavailable"));
|
|
3722
|
+
let m = `${i.getName() ?? W("workbook.defaultName")}.${o.exts[0]}`, h = r?.progress, g = !i.getPath() || !i.canWrite() || !!r?.prompt, _ = !1, v = this, y = null, b = [], x = {
|
|
3586
3723
|
workbook: e,
|
|
3587
3724
|
format: o,
|
|
3588
3725
|
origin: i,
|
|
@@ -3607,7 +3744,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3607
3744
|
}))(h, l), d = await v._writeArrayBuffer(e, c, {
|
|
3608
3745
|
...r,
|
|
3609
3746
|
progress: u
|
|
3610
|
-
}), m =
|
|
3747
|
+
}), m = ni.get(s);
|
|
3611
3748
|
if (l.some((e) => !m?.has(e.message)) && r?.onWarnings) {
|
|
3612
3749
|
let t = await Promise.resolve(r.onWarnings({
|
|
3613
3750
|
workbook: e,
|
|
@@ -3620,37 +3757,37 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3620
3757
|
}
|
|
3621
3758
|
return b = l, p ? p.encode(d, f) : d;
|
|
3622
3759
|
}
|
|
3623
|
-
},
|
|
3760
|
+
}, S = null;
|
|
3624
3761
|
try {
|
|
3625
3762
|
let t = this.getBackingStore();
|
|
3626
3763
|
if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
|
|
3627
|
-
if (
|
|
3628
|
-
if (f !== void 0 &&
|
|
3629
|
-
let e =
|
|
3764
|
+
if (S = await t.write(x), S) {
|
|
3765
|
+
if (f !== void 0 && S instanceof G && (S.setPassword(f), S.update({ encryption: p ? p.key : null })), b.length) {
|
|
3766
|
+
let e = ni.get(S) ?? /* @__PURE__ */ new Set();
|
|
3630
3767
|
for (let t of b) e.add(t.message);
|
|
3631
|
-
|
|
3768
|
+
ni.set(S, e);
|
|
3632
3769
|
}
|
|
3633
|
-
n &&
|
|
3770
|
+
n && S !== e.getOrigin() && Ln(e.getOrigin())?.setOrigin(S);
|
|
3634
3771
|
let t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
|
|
3635
3772
|
this._emitter.notify("onWrite", {
|
|
3636
3773
|
params: {
|
|
3637
3774
|
workbook: e,
|
|
3638
|
-
origin:
|
|
3775
|
+
origin: S,
|
|
3639
3776
|
commitId: t?.getId() ?? null,
|
|
3640
3777
|
save: n
|
|
3641
3778
|
},
|
|
3642
3779
|
transactional: !1
|
|
3643
3780
|
});
|
|
3644
3781
|
}
|
|
3645
|
-
h?.onComplete && await Promise.resolve(h.onComplete(
|
|
3782
|
+
h?.onComplete && await Promise.resolve(h.onComplete(S));
|
|
3646
3783
|
} catch (e) {
|
|
3647
3784
|
let t = e instanceof Error ? e : Error(String(e));
|
|
3648
|
-
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof B ? t : Error(
|
|
3785
|
+
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof B ? t : Error(W("error.io.writeFailed", { reason: t.message }), { cause: e });
|
|
3649
3786
|
}
|
|
3650
|
-
return
|
|
3787
|
+
return S;
|
|
3651
3788
|
}
|
|
3652
3789
|
_stripExtension(e) {
|
|
3653
|
-
let t =
|
|
3790
|
+
let t = O(e);
|
|
3654
3791
|
return t ? e.slice(0, e.length - t.length - 1) : e;
|
|
3655
3792
|
}
|
|
3656
3793
|
_baseName(e) {
|
|
@@ -3670,24 +3807,24 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3670
3807
|
async _readArrayBuffer(e, t, n) {
|
|
3671
3808
|
if (!e) throw Error("ArrayBuffer must be specified.");
|
|
3672
3809
|
if (!t) throw Error("format must be specified.");
|
|
3673
|
-
if (e.byteLength === 0) return new
|
|
3810
|
+
if (e.byteLength === 0) return new $r(n?.createWorkbookOptions);
|
|
3674
3811
|
let r = t.handler;
|
|
3675
3812
|
if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
|
|
3676
3813
|
let i;
|
|
3677
3814
|
try {
|
|
3678
3815
|
i = await r(e, n);
|
|
3679
3816
|
} catch (e) {
|
|
3680
|
-
throw e instanceof B ? e : new B(
|
|
3817
|
+
throw e instanceof B ? e : new B(W("error.io.readFailed", {
|
|
3681
3818
|
format: t.description ?? t.key,
|
|
3682
3819
|
reason: e?.message ?? String(e)
|
|
3683
3820
|
}), { cause: e });
|
|
3684
3821
|
}
|
|
3685
|
-
return await
|
|
3822
|
+
return await yt(), i;
|
|
3686
3823
|
}
|
|
3687
3824
|
get isIWorkbookIO() {
|
|
3688
3825
|
return !0;
|
|
3689
3826
|
}
|
|
3690
|
-
},
|
|
3827
|
+
}, ai = new ii(), oi = class {
|
|
3691
3828
|
constructor() {
|
|
3692
3829
|
this._buffer = null, this._formatKey = null;
|
|
3693
3830
|
}
|
|
@@ -3701,7 +3838,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3701
3838
|
async read(e) {
|
|
3702
3839
|
return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
|
|
3703
3840
|
}
|
|
3704
|
-
},
|
|
3841
|
+
}, si = "locales", ci = "fonts", li = {
|
|
3705
3842
|
suffix: ".msg.json",
|
|
3706
3843
|
async extract(e) {
|
|
3707
3844
|
let t = e.relPath.split("/");
|
|
@@ -3711,7 +3848,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3711
3848
|
} : null;
|
|
3712
3849
|
},
|
|
3713
3850
|
place: (e, t) => t ? `${t}/${e}` : null
|
|
3714
|
-
},
|
|
3851
|
+
}, ui = [
|
|
3715
3852
|
".woff2",
|
|
3716
3853
|
".woff",
|
|
3717
3854
|
".ttf",
|
|
@@ -3721,7 +3858,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3721
3858
|
].map((e) => ({
|
|
3722
3859
|
suffix: e,
|
|
3723
3860
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3724
|
-
})),
|
|
3861
|
+
})), di = {
|
|
3725
3862
|
suffix: ".metrics.json",
|
|
3726
3863
|
async extract(e) {
|
|
3727
3864
|
let t = await e.readJson();
|
|
@@ -3732,13 +3869,13 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3732
3869
|
} : null;
|
|
3733
3870
|
},
|
|
3734
3871
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3735
|
-
},
|
|
3736
|
-
kind:
|
|
3737
|
-
files: [
|
|
3872
|
+
}, fi = [{
|
|
3873
|
+
kind: si,
|
|
3874
|
+
files: [li]
|
|
3738
3875
|
}, {
|
|
3739
|
-
kind:
|
|
3876
|
+
kind: ci,
|
|
3740
3877
|
files: [
|
|
3741
|
-
|
|
3878
|
+
di,
|
|
3742
3879
|
{
|
|
3743
3880
|
suffix: ".hinted.json",
|
|
3744
3881
|
async extract(e) {
|
|
@@ -3750,7 +3887,7 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3750
3887
|
hinted: !0
|
|
3751
3888
|
} : null;
|
|
3752
3889
|
},
|
|
3753
|
-
place:
|
|
3890
|
+
place: di.place
|
|
3754
3891
|
},
|
|
3755
3892
|
{
|
|
3756
3893
|
suffix: ".rows.json",
|
|
@@ -3763,40 +3900,40 @@ var Ar, jr = "workbook.activeSheet", Mr = class e extends l {
|
|
|
3763
3900
|
rows: !0
|
|
3764
3901
|
} : null;
|
|
3765
3902
|
},
|
|
3766
|
-
place:
|
|
3903
|
+
place: di.place
|
|
3767
3904
|
},
|
|
3768
|
-
...
|
|
3905
|
+
...ui
|
|
3769
3906
|
]
|
|
3770
3907
|
}];
|
|
3771
|
-
async function
|
|
3772
|
-
let { Chart: n } = await import("./
|
|
3908
|
+
async function pi(e, t) {
|
|
3909
|
+
let { Chart: n } = await import("./CNdjyofiRu6CYOrr.mjs");
|
|
3773
3910
|
return new n({
|
|
3774
3911
|
json: e,
|
|
3775
3912
|
getStyles: t?.getStyles
|
|
3776
3913
|
});
|
|
3777
3914
|
}
|
|
3778
|
-
|
|
3915
|
+
Jr ||= {};
|
|
3779
3916
|
var Q = null;
|
|
3780
|
-
function
|
|
3917
|
+
function mi() {
|
|
3781
3918
|
if (!Q) {
|
|
3782
|
-
let e = import("./
|
|
3919
|
+
let e = import("./hCQJcmIzPDxDEv2q.mjs").then((e) => e.loadScriptingDeclarations());
|
|
3783
3920
|
e.catch(() => {
|
|
3784
3921
|
Q = null;
|
|
3785
3922
|
}), Q = e;
|
|
3786
3923
|
}
|
|
3787
3924
|
return Q;
|
|
3788
3925
|
}
|
|
3789
|
-
var
|
|
3790
|
-
function
|
|
3926
|
+
var hi, gi, _i, $ = null;
|
|
3927
|
+
function vi() {
|
|
3791
3928
|
if (!$) {
|
|
3792
|
-
let e = import("./
|
|
3929
|
+
let e = import("./hCQJcmIzPDxDEv2q.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
|
|
3793
3930
|
e.catch(() => {
|
|
3794
3931
|
$ = null;
|
|
3795
3932
|
}), $ = e;
|
|
3796
3933
|
}
|
|
3797
3934
|
return $;
|
|
3798
3935
|
}
|
|
3799
|
-
|
|
3936
|
+
hi ||= {}, (gi ||= {}).Type = {
|
|
3800
3937
|
Button: "button",
|
|
3801
3938
|
CheckBox: "checkBox",
|
|
3802
3939
|
OptionButton: "optionButton",
|
|
@@ -3809,12 +3946,12 @@ Zr ||= {}, (Qr ||= {}).Type = {
|
|
|
3809
3946
|
EditBox: "editBox",
|
|
3810
3947
|
Dialog: "dialog",
|
|
3811
3948
|
Unknown: "formControl"
|
|
3812
|
-
}, (
|
|
3949
|
+
}, (_i ||= {}).DropStyle = {
|
|
3813
3950
|
Combo: "combo",
|
|
3814
3951
|
ComboEdit: "comboEdit",
|
|
3815
3952
|
Simple: "simple"
|
|
3816
3953
|
};
|
|
3817
|
-
var
|
|
3954
|
+
var yi = class extends Le {
|
|
3818
3955
|
constructor(e) {
|
|
3819
3956
|
super(e);
|
|
3820
3957
|
}
|
|
@@ -3827,8 +3964,8 @@ var ti = class extends qe {
|
|
|
3827
3964
|
colEnd: (e?.size?.width ?? 5) - 1,
|
|
3828
3965
|
rowEnd: (e?.size?.height ?? 5) - 1
|
|
3829
3966
|
},
|
|
3830
|
-
getRanges: (e) => new
|
|
3967
|
+
getRanges: (e) => new Me(null)
|
|
3831
3968
|
}, super._initializeOptions(e);
|
|
3832
3969
|
}
|
|
3833
|
-
},
|
|
3834
|
-
export {
|
|
3970
|
+
}, bi = "0.8.0-beta.12", xi = "2026-10-29T20:28:05.246Z";
|
|
3971
|
+
export { Ht as AbstractCollection, r as AbstractMovableContent, We as AddressUtils, oi as ArrayBackingStore, we as AutoFill, xi as BUILD_DATE, u as CellControlRegistry, It as CellImage, Ie as CellImageKind, dt as ChartElementSelection, yn as ChartKinds, He as CheckboxKind, fn as Color, lt as Condition, Ft as DateUtils, ii as DefaultWorkbookIO, m as EXTERNAL_LINK_PATH_REL_TYPE, kr as ExternalRangeClipboardItem, ci as FONTS_KIND, wr as Fetcher, en as FontUtils, he as FormulaText, sr as FunctionDeclarations, de as GeomUtils, y as Hyperlink, g as HyperlinkKind, ge as IAnchored, Zt as IBorders, Vt as ICalculation, qe as ICell, ir as ICellHeaderRange, c as ICellRange, rr as ICellRanges, ln as ICellStyle, dn as IColor, pt as ICondition, Be as IConditionalFormat, X as ICustomProperty, ne as IDataValidation, _i as IDropDown, pn as IEffect, un as IFill, M as IFont, me as IFontCollection, F as IFontStyle, gi as IFormControl, bn as IGeometry, hi as IMovable, xe as IPageLayout, Jr as IPicture, nr as IResource, s as IRichDataKind, tt as IScript, nn as IShape, T as ISheet, l as ISlicerStyle, Fn as ISort, hn as IStroke, ee as ITable, Ue as ITableStyle, Ye as IText, N as ITextFrame, tr as ITheme, se as IThemeCollection, An as IWorkbookIO, hr as IWorkbookView, je as IWorksheetView, si as LOCALES_KIND, ae as LicenseManager, Dt as MovableContentRegistry, ze as NamedStyleCollection, P as NumberFormat, vn as PaintUtils, vr as PersonCollection, Or as RangeClipboardItem, Kn as RectAlignment, Pt as Registry, C as Resource, Ee as ResourceCollection, Ne as RichArray, f as RichArrayKind, ue as RichDataCollection, Ze as RichDataRegistry, Bt as RichRecord, Se as RichText, ft as RichTextKind, fi as SHEETXL_RESOURCE_KINDS, gn as SYSTEM_COLOR_CSS_PREFIX, Xt as ShapeStyleUtils, _e as SimpleFontFace, Ve as SlicerStyleCollection, Ut as Sort, ye as StringCollection, Gt as StyleCollection, yi as Table, te as TableStyleCollection, rt as TextRotation, $e as TextStacked, bt as TextUtils, le as Theme, St as ThemeCollection, t as TransactionConflictError, Pn as TransactionSaveStateManager, i as TransactionStore, jn as TransactionUndoManager, Ot as Tuple, bi as VERSION, $r as Workbook, ai as WorkbookIO, G as WorkbookOrigin, Mr as WorkbookView, A as Worksheet, er as builtInStyleNameDisplay, Fe as createCellRangeCounts, pi as createChart, Rt as externalBookClosedName, Re as externalBookFileName, b as externalBookLocation, _ as externalBookOpenName, Ct as findLabel, cr as getBuiltInFunctionNames, S as getLanguagePack, rn as getLocaleProfile, at as getScriptRuntime, vi as getScriptingApi, mi as getScriptingDeclarations, ie as localizeBoolean, fe as localizeErrorLabel, qt as makeLocaleProfile, ce as normalizeLabel, ke as parseBooleanLocal, Wt as parseErrorLocal, Ce as parseExternalScope, lr as parseFormulaLiteral, Te as registerSdkLocales, mt as sourceEntryFromPath, xt as withScriptRuntime };
|