@univerjs/sheets-formula 0.15.0 → 0.15.1-insiders.20260117-8ce4a01

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/lib/index.js CHANGED
@@ -1,31 +1,31 @@
1
1
  var Wa = Object.defineProperty;
2
2
  var Ka = (a, e, n) => e in a ? Wa(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
3
  var K = (a, e, n) => Ka(a, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, ILogService as nn, IConfigService as Ce, LocaleService as Gt, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as $, Injector as ct, isRealNum as rn, createIdentifier as Ht, toDisposable as J, moveRangeByOffset as yt, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as on, DependentOn as pa, Plugin as La, merge as Pa, touchDependencies as Ue, isNodeEnv as Xt } from "@univerjs/core";
5
- import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as Q, SetStyleCommand as wt, SetBorderCommand as Ia, ClearSelectionFormatCommand as Na, handleMoveCols as Ra, EffectRefRangId as w, runRefRangeMutations as Y, handleMoveRows as Sa, handleMoveRange as Aa, handleInsertRangeMoveRight as Ca, handleInsertRangeMoveDown as Da, handleDeleteRangeMoveUp as ba, handleDeleteRangeMoveLeft as Oa, handleIRemoveCol as Ma, handleIRemoveRow as xa, handleInsertCol as _a, handleInsertRow as ya, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as qa, RemoveSheetCommand as dn, SetWorksheetNameCommand as pn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Pn, RemoveColCommand as Tn, RemoveRowCommand as En, InsertRangeMoveDownCommand as In, InsertRangeMoveRightCommand as Nn, InsertColCommand as Rn, InsertRowCommand as Sn, MoveColsCommand as An, MoveRowsCommand as Cn, MoveRangeCommand as Dn, RemoveSheetMutation as gt, InsertSheetMutation as qt, MoveRangeMutation as Wt, MoveRowsMutation as Kt, MoveColsMutation as kt, ReorderRangeMutation as Qt, RemoveRowMutation as jt, RemoveColMutation as $t, InsertColMutation as zt, InsertRowMutation as Zt, SetRowHiddenMutation as Jt, SetRowVisibleMutation as ea, SetWorksheetActiveOperation as ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as bn, handleDefaultRangeChangeWithEffectRefCommands as ta, getSeparateEffectedRangesOnCommand as On, handleCommonDefaultRangeChangeWithEffectRefCommands as Mn, UniverSheetsPlugin as xn } from "@univerjs/sheets";
6
- import { serializeRange as Se, FormulaDataModel as ye, ErrorType as k, SetImageFormulaDataMutation as _n, IActiveDirtyManagerService as Ua, RegisterOtherFormulaService as yn, SetFormulaCalculationStartMutation as Fe, SetFormulaStringBatchCalculationMutation as gn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as qn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as hn, SetFormulaCalculationStopMutation as aa, SetFormulaCalculationNotificationMutation as Un, FormulaExecuteStageType as Be, FormulaExecutedStateType as be, SetTriggerFormulaCalculationStartMutation as je, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, IDefinedNamesService as dt, LexerTreeBuilder as pt, generateStringWithSequence as $e, SetDefinedNameMutation as Ae, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as ht, initSheetFormulaData as na, RemoveDefinedNameMutation as Ut, IFunctionService as Lt, SetFormulaCalculationResultMutation as Fn, stripErrorMargin as Bn, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as j, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as W, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as vn, functionArray as Vn, functionCompatibility as Gn, functionCube as Hn, functionDatabase as wn, functionDate as Yn, functionEngineering as Xn, functionFinancial as Wn, functionInformation as Kn, functionLogical as kn, functionLookup as Qn, functionMath as jn, functionMeta as $n, functionStatistical as zn, functionText as Zn, functionUniver as Jn, functionWeb as ei, OtherFormulaMarkDirty as ti, SetSuperTableMutation as ai, RemoveSuperTableMutation as ni, serializeRangeWithSheet as ze, ISuperTableService as ii, serializeRangeWithSpreadsheet as ra, CustomFunction as Ft, AsyncCustomFunction as Fa, UniverFormulaEnginePlugin as ri, IFormulaCurrentConfigService as oi, Lexer as ui, AstTreeBuilder as mi, Interpreter as fi, generateExecuteAstNodeData as ci, getObjectValue as li } from "@univerjs/engine-formula";
7
- import { BehaviorSubject as si, map as di } from "rxjs";
8
- import { IRPCChannelService as Ba, fromModule as pi, toModule as Li } from "@univerjs/rpc";
9
- const Pi = {
4
+ import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, ILogService as nn, IConfigService as Ce, LocaleService as Gt, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as k, Injector as ct, isRealNum as rn, createIdentifier as Ht, toDisposable as J, moveRangeByOffset as yt, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as on, DependentOn as pa, Plugin as La, merge as Pa, touchDependencies as Ue, isNodeEnv as Xt } from "@univerjs/core";
5
+ import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as j, SetStyleCommand as wt, SetBorderCommand as Ia, ClearSelectionFormatCommand as Na, handleMoveCols as Ra, EffectRefRangId as w, runRefRangeMutations as Y, handleMoveRows as Sa, handleMoveRange as Aa, handleInsertRangeMoveRight as Ca, handleInsertRangeMoveDown as Da, handleDeleteRangeMoveUp as ba, handleDeleteRangeMoveLeft as Oa, handleIRemoveCol as Ma, handleIRemoveRow as xa, handleInsertCol as _a, handleInsertRow as ya, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as qa, RemoveSheetCommand as dn, SetWorksheetNameCommand as pn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Pn, RemoveColCommand as Tn, RemoveRowCommand as En, InsertRangeMoveDownCommand as In, InsertRangeMoveRightCommand as Nn, InsertColCommand as Rn, InsertRowCommand as Sn, MoveColsCommand as An, MoveRowsCommand as Cn, MoveRangeCommand as Dn, RemoveSheetMutation as gt, InsertSheetMutation as qt, SetRangeCustomMetadataCommand as bn, MoveRangeMutation as Wt, MoveRowsMutation as Kt, MoveColsMutation as kt, ReorderRangeMutation as Qt, RemoveRowMutation as jt, RemoveColMutation as $t, InsertColMutation as zt, InsertRowMutation as Zt, SetRowHiddenMutation as Jt, SetRowVisibleMutation as ea, SetWorksheetActiveOperation as ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as On, handleDefaultRangeChangeWithEffectRefCommands as ta, getSeparateEffectedRangesOnCommand as Mn, handleCommonDefaultRangeChangeWithEffectRefCommands as xn, UniverSheetsPlugin as _n } from "@univerjs/sheets";
6
+ import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn, IActiveDirtyManagerService as Ua, RegisterOtherFormulaService as gn, SetFormulaCalculationStartMutation as Fe, SetFormulaStringBatchCalculationMutation as qn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as hn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as Un, SetFormulaCalculationStopMutation as aa, SetFormulaCalculationNotificationMutation as Fn, FormulaExecuteStageType as Be, FormulaExecutedStateType as be, SetTriggerFormulaCalculationStartMutation as je, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, IDefinedNamesService as dt, LexerTreeBuilder as pt, generateStringWithSequence as $e, SetDefinedNameMutation as Ae, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as ht, initSheetFormulaData as na, RemoveDefinedNameMutation as Ut, IFunctionService as Lt, SetFormulaCalculationResultMutation as Bn, stripErrorMargin as vn, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as W, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as Vn, functionArray as Gn, functionCompatibility as Hn, functionCube as wn, functionDatabase as Yn, functionDate as Xn, functionEngineering as Wn, functionFinancial as Kn, functionInformation as kn, functionLogical as Qn, functionLookup as jn, functionMath as $n, functionMeta as zn, functionStatistical as Zn, functionText as Jn, functionUniver as ei, functionWeb as ti, OtherFormulaMarkDirty as ai, SetSuperTableMutation as ni, RemoveSuperTableMutation as ii, serializeRangeWithSheet as ze, ISuperTableService as ri, serializeRangeWithSpreadsheet as ra, CustomFunction as Ft, AsyncCustomFunction as Fa, UniverFormulaEnginePlugin as oi, IFormulaCurrentConfigService as ui, Lexer as mi, AstTreeBuilder as fi, Interpreter as ci, generateExecuteAstNodeData as li, getObjectValue as si } from "@univerjs/engine-formula";
7
+ import { BehaviorSubject as di, map as pi } from "rxjs";
8
+ import { IRPCChannelService as Ba, fromModule as Li, toModule as Pi } from "@univerjs/rpc";
9
+ const Ti = {
10
10
  id: "formula.command.insert-function",
11
11
  type: ca.COMMAND,
12
12
  handler: async (a, e) => {
13
13
  const { list: n, listOfRangeHasNumber: i } = e, r = a.get(ue), o = new V();
14
- n.forEach((f) => {
15
- const { range: m, primary: c, formula: l } = f, { row: L, column: E } = c, p = la(6);
14
+ n.forEach((m) => {
15
+ const { range: f, primary: c, formula: l } = m, { row: L, column: E } = c, p = la(6);
16
16
  o.setValue(L, E, {
17
17
  f: l,
18
18
  si: p
19
19
  });
20
- const { startRow: S, startColumn: A, endRow: I, endColumn: d } = m;
20
+ const { startRow: S, startColumn: A, endRow: I, endColumn: d } = f;
21
21
  for (let R = S; R <= I; R++)
22
22
  for (let N = A; N <= d; N++)
23
23
  (R !== L || N !== E) && o.setValue(R, N, {
24
24
  si: p
25
25
  });
26
- }), i && i.length > 0 && i.forEach((f) => {
27
- const { primary: m, formula: c } = f;
28
- o.setValue(m.row, m.column, {
26
+ }), i && i.length > 0 && i.forEach((m) => {
27
+ const { primary: f, formula: c } = m;
28
+ o.setValue(f.row, f.column, {
29
29
  f: c
30
30
  });
31
31
  });
@@ -34,7 +34,7 @@ const Pi = {
34
34
  };
35
35
  return r.executeCommand(Ta.id, u);
36
36
  }
37
- }, Ti = {
37
+ }, Ei = {
38
38
  id: "sheets-formula.command.quick-sum",
39
39
  type: ca.COMMAND,
40
40
  handler: async (a) => {
@@ -43,41 +43,41 @@ const Pi = {
43
43
  const i = a.get(Ee), r = mn(i);
44
44
  if (!r) return !1;
45
45
  const o = n.range, { worksheet: u } = r;
46
- let f = fn(o, u);
47
- if (!f) return !1;
48
- f = It(f, u);
49
- const m = cn({
50
- startRow: f.startRow,
51
- startColumn: f.startColumn,
46
+ let m = fn(o, u);
47
+ if (!m) return !1;
48
+ m = It(m, u);
49
+ const f = cn({
50
+ startRow: m.startRow,
51
+ startColumn: m.startColumn,
52
52
  endRow: o.endRow,
53
53
  endColumn: o.endColumn
54
54
  }, { left: !0, right: !0, up: !0, down: !0 }, u), c = new V(), l = It({
55
- startRow: m.endRow,
56
- endRow: m.endRow,
57
- startColumn: m.startColumn,
58
- endColumn: m.endColumn
55
+ startRow: f.endRow,
56
+ endRow: f.endRow,
57
+ startColumn: f.startColumn,
58
+ endColumn: f.endColumn
59
59
  }, u);
60
- if (!fe.equals(l, m))
60
+ if (!fe.equals(l, f))
61
61
  for (const p of u.iterateByColumn(l))
62
62
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
63
63
  f: `=SUM(${Se({
64
64
  startColumn: p.col,
65
65
  endColumn: p.col,
66
- startRow: m.startRow,
66
+ startRow: f.startRow,
67
67
  endRow: p.row - 1
68
68
  })})`
69
69
  });
70
70
  const L = It({
71
- startRow: m.startRow,
72
- startColumn: m.endColumn,
73
- endRow: m.endRow,
74
- endColumn: m.endColumn
71
+ startRow: f.startRow,
72
+ startColumn: f.endColumn,
73
+ endRow: f.endRow,
74
+ endColumn: f.endColumn
75
75
  }, u);
76
- if (!fe.equals(L, m))
76
+ if (!fe.equals(L, f))
77
77
  for (const p of u.iterateByRow(L))
78
78
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
79
79
  f: `=SUM(${Se({
80
- startColumn: m.startColumn,
80
+ startColumn: f.startColumn,
81
81
  endColumn: p.col - 1,
82
82
  startRow: p.row,
83
83
  endRow: p.row
@@ -88,7 +88,7 @@ const Pi = {
88
88
  {
89
89
  id: Ta.id,
90
90
  params: {
91
- range: m,
91
+ range: f,
92
92
  value: c.getMatrix()
93
93
  }
94
94
  },
@@ -98,8 +98,8 @@ const Pi = {
98
98
  unitId: r.unitId,
99
99
  subUnitId: r.subUnitId,
100
100
  selections: [{
101
- range: m,
102
- primary: fe.contains(m, n.primary) ? n.primary : { ...f, actualRow: f.startRow, actualColumn: f.startColumn },
101
+ range: f,
102
+ primary: fe.contains(f, n.primary) ? n.primary : { ...m, actualRow: m.startRow, actualColumn: m.startColumn },
103
103
  style: null
104
104
  }]
105
105
  }
@@ -108,9 +108,9 @@ const Pi = {
108
108
  }
109
109
  }, ge = "sheets-formula.base.config";
110
110
  var Te = /* @__PURE__ */ ((a) => (a[a.FORCED = 0] = "FORCED", a[a.WHEN_EMPTY = 1] = "WHEN_EMPTY", a[a.NO_CALCULATION = 2] = "NO_CALCULATION", a))(Te || {});
111
- const oa = {}, Ei = "sheets-formula.remote.config", ua = {};
112
- var Ii = Object.getOwnPropertyDescriptor, Ni = (a, e, n, i) => {
113
- for (var r = i > 1 ? void 0 : i ? Ii(e, n) : e, o = a.length - 1, u; o >= 0; o--)
111
+ const oa = {}, Ii = "sheets-formula.remote.config", ua = {};
112
+ var Ni = Object.getOwnPropertyDescriptor, Ri = (a, e, n, i) => {
113
+ for (var r = i > 1 ? void 0 : i ? Ni(e, n) : e, o = a.length - 1, u; o >= 0; o--)
114
114
  (u = a[o]) && (r = u(r) || r);
115
115
  return r;
116
116
  }, St = (a, e) => (n, i) => e(n, i, a);
@@ -118,7 +118,7 @@ let Ze = class extends ee {
118
118
  constructor(e, n, i) {
119
119
  super();
120
120
  K(this, "_errorValueCell", {
121
- v: k.VALUE,
121
+ v: Q.VALUE,
122
122
  t: xt.STRING
123
123
  });
124
124
  K(this, "_refreshRender");
@@ -130,7 +130,7 @@ let Ze = class extends ee {
130
130
  _commandExecutedListener() {
131
131
  this.disposeWithMe(
132
132
  this._commandService.onCommandExecuted(async (e) => {
133
- if (e.id === _n.id) {
133
+ if (e.id === yn.id) {
134
134
  const n = e.params;
135
135
  if (!n) return;
136
136
  const { imageFormulaData: i } = n;
@@ -139,8 +139,8 @@ let Ze = class extends ee {
139
139
  i.map((u) => this._getImageNatureSize(u))
140
140
  ), o = {};
141
141
  r.forEach((u) => {
142
- const { unitId: f, sheetId: m, row: c, column: l, ...L } = u;
143
- o[f] || (o[f] = {}), o[f][m] || (o[f][m] = new V()), o[f][m].setValue(c, l, L);
142
+ const { unitId: m, sheetId: f, row: c, column: l, ...L } = u;
143
+ o[m] || (o[m] = {}), o[m][f] || (o[m][f] = new V()), o[m][f].setValue(c, l, L);
144
144
  }), this._formulaDataModel.mergeUnitImageFormulaData(o), this._refreshRender();
145
145
  }
146
146
  })
@@ -155,7 +155,7 @@ let Ze = class extends ee {
155
155
  // eslint-disable-next-line max-lines-per-function
156
156
  handler: (e, n, i) => {
157
157
  var q, M;
158
- const { unitId: r, subUnitId: o, row: u, col: f } = n, m = this._formulaDataModel.getUnitImageFormulaData(), c = (M = (q = m == null ? void 0 : m[r]) == null ? void 0 : q[o]) == null ? void 0 : M.getValue(u, f);
158
+ const { unitId: r, subUnitId: o, row: u, col: m } = n, f = this._formulaDataModel.getUnitImageFormulaData(), c = (M = (q = f == null ? void 0 : f[r]) == null ? void 0 : q[o]) == null ? void 0 : M.getValue(u, m);
159
159
  if (!c)
160
160
  return i(e);
161
161
  const {
@@ -256,19 +256,19 @@ let Ze = class extends ee {
256
256
  this._refreshRender = e;
257
257
  }
258
258
  };
259
- Ze = Ni([
259
+ Ze = Ri([
260
260
  St(0, ue),
261
261
  St(1, H(lt)),
262
262
  St(2, H(ye))
263
263
  ], Ze);
264
- var Ri = Object.getOwnPropertyDescriptor, Si = (a, e, n, i) => {
265
- for (var r = i > 1 ? void 0 : i ? Ri(e, n) : e, o = a.length - 1, u; o >= 0; o--)
264
+ var Si = Object.getOwnPropertyDescriptor, Ai = (a, e, n, i) => {
265
+ for (var r = i > 1 ? void 0 : i ? Si(e, n) : e, o = a.length - 1, u; o >= 0; o--)
266
266
  (u = a[o]) && (r = u(r) || r);
267
267
  return r;
268
268
  }, pe = (a, e) => (n, i) => e(n, i, a);
269
269
  const ma = { done: 0, count: 0 }, At = { onlyLocal: !0 };
270
270
  let xe = class extends ee {
271
- constructor(e, n, i, r, o, u, f) {
271
+ constructor(e, n, i, r, o, u, m) {
272
272
  super();
273
273
  K(this, "_waitingCommandQueue", []);
274
274
  K(this, "_executingDirtyData", {
@@ -286,9 +286,9 @@ let xe = class extends ee {
286
286
  K(this, "_doneCalculationTaskCount", 0);
287
287
  K(this, "_executionInProgressParams", null);
288
288
  K(this, "_restartCalculation", !1);
289
- K(this, "_progress$", new si(ma));
289
+ K(this, "_progress$", new di(ma));
290
290
  K(this, "progress$", this._progress$.asObservable());
291
- this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = f, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
291
+ this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = m, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
292
292
  }
293
293
  _emitProgress(e) {
294
294
  this._progress$.next({ done: this._doneCalculationTaskCount, count: this._totalCalculationTaskCount, label: e });
@@ -325,19 +325,19 @@ let xe = class extends ee {
325
325
  _commandExecutedListener() {
326
326
  this.disposeWithMe(
327
327
  this._commandService.beforeCommandExecuted((e) => {
328
- if (e.id === Fe.id || e.id === gn.id) {
328
+ if (e.id === Fe.id || e.id === qn.id) {
329
329
  const n = e.params;
330
330
  if (e.id === Fe.id) {
331
- const i = this._configService.getConfig(qn) || !1;
331
+ const i = this._configService.getConfig(hn) || !1;
332
332
  n.isCalculateTreeModel = i;
333
333
  }
334
- n.maxIteration = this._configService.getConfig(hn), n.rowData = this._formulaDataModel.getHiddenRowsFiltered();
334
+ n.maxIteration = this._configService.getConfig(Un), n.rowData = this._formulaDataModel.getHiddenRowsFiltered();
335
335
  }
336
336
  })
337
337
  ), this.disposeWithMe(
338
338
  this._commandService.onCommandExecuted((e, n) => {
339
339
  if (this._activeDirtyManagerService.get(e.id)) {
340
- if (e.id === Q.id) {
340
+ if (e.id === j.id) {
341
341
  const i = e.params;
342
342
  if (n && n.onlyLocal === !0 || i.trigger === wt.id || i.trigger === Ia.id || i.trigger === Na.id)
343
343
  return;
@@ -351,14 +351,14 @@ let xe = class extends ee {
351
351
  );
352
352
  }
353
353
  _generateDirty(e) {
354
- const n = [], i = {}, r = {}, o = {}, u = {}, f = {};
355
- let m = !1;
354
+ const n = [], i = {}, r = {}, o = {}, u = {}, m = {};
355
+ let f = !1;
356
356
  for (const c of e) {
357
357
  const l = this._activeDirtyManagerService.get(c.id);
358
358
  if (l == null)
359
359
  continue;
360
360
  const L = l.getDirtyData(c), { dirtyRanges: E, dirtyNameMap: p, dirtyDefinedNameMap: S, dirtyUnitFeatureMap: A, dirtyUnitOtherFormulaMap: I, clearDependencyTreeCache: d, forceCalculation: R = !1 } = L;
361
- E != null && this._mergeDirtyRanges(n, E), p != null && this._mergeDirtyNameMap(i, p), S != null && this._mergeDirtyNameMap(r, S), A != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, A), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, I), d != null && this._mergeDirtyNameMap(f, d), m = m || R;
361
+ E != null && this._mergeDirtyRanges(n, E), p != null && this._mergeDirtyNameMap(i, p), S != null && this._mergeDirtyNameMap(r, S), A != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, A), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, I), d != null && this._mergeDirtyNameMap(m, d), f = f || R;
362
362
  }
363
363
  return {
364
364
  dirtyRanges: n,
@@ -366,23 +366,23 @@ let xe = class extends ee {
366
366
  dirtyDefinedNameMap: r,
367
367
  dirtyUnitFeatureMap: o,
368
368
  dirtyUnitOtherFormulaMap: u,
369
- forceCalculation: m,
370
- clearDependencyTreeCache: f
369
+ forceCalculation: f,
370
+ clearDependencyTreeCache: m
371
371
  // numfmtItemMap,
372
372
  };
373
373
  }
374
374
  _mergeDirty(e, n) {
375
- const i = [...e.dirtyRanges, ...n.dirtyRanges], r = { ...e.dirtyNameMap }, o = { ...e.dirtyDefinedNameMap }, u = { ...e.dirtyUnitFeatureMap }, f = { ...e.dirtyUnitOtherFormulaMap }, m = { ...e.clearDependencyTreeCache };
376
- this._mergeDirtyNameMap(r, n.dirtyNameMap), this._mergeDirtyNameMap(o, n.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, n.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(f, n.dirtyUnitOtherFormulaMap), this._mergeDirtyNameMap(m, n.clearDependencyTreeCache);
375
+ const i = [...e.dirtyRanges, ...n.dirtyRanges], r = { ...e.dirtyNameMap }, o = { ...e.dirtyDefinedNameMap }, u = { ...e.dirtyUnitFeatureMap }, m = { ...e.dirtyUnitOtherFormulaMap }, f = { ...e.clearDependencyTreeCache };
376
+ this._mergeDirtyNameMap(r, n.dirtyNameMap), this._mergeDirtyNameMap(o, n.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, n.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(m, n.dirtyUnitOtherFormulaMap), this._mergeDirtyNameMap(f, n.clearDependencyTreeCache);
377
377
  const c = e.forceCalculation || n.forceCalculation;
378
378
  return {
379
379
  dirtyRanges: i,
380
380
  dirtyNameMap: r,
381
381
  dirtyDefinedNameMap: o,
382
382
  dirtyUnitFeatureMap: u,
383
- dirtyUnitOtherFormulaMap: f,
383
+ dirtyUnitOtherFormulaMap: m,
384
384
  forceCalculation: c,
385
- clearDependencyTreeCache: m
385
+ clearDependencyTreeCache: f
386
386
  };
387
387
  }
388
388
  /**
@@ -395,8 +395,8 @@ let xe = class extends ee {
395
395
  let r = !1;
396
396
  for (const o of e)
397
397
  if (i.unitId === o.unitId && i.sheetId === o.sheetId) {
398
- const { startRow: u, startColumn: f, endRow: m, endColumn: c } = i.range, { startRow: l, startColumn: L, endRow: E, endColumn: p } = o.range;
399
- if (u === l && f === L && m === E && c === p) {
398
+ const { startRow: u, startColumn: m, endRow: f, endColumn: c } = i.range, { startRow: l, startColumn: L, endRow: E, endColumn: p } = o.range;
399
+ if (u === l && m === L && f === E && c === p) {
400
400
  r = !0;
401
401
  break;
402
402
  }
@@ -427,7 +427,7 @@ let xe = class extends ee {
427
427
  this.disposeWithMe(
428
428
  // eslint-disable-next-line max-lines-per-function, complexity
429
429
  this._commandService.onCommandExecuted((i) => {
430
- if (i.id === aa.id && this.clearProgress(), i.id !== Un.id)
430
+ if (i.id === aa.id && this.clearProgress(), i.id !== Fn.id)
431
431
  return;
432
432
  const r = i.params;
433
433
  if (r.stageInfo != null) {
@@ -508,16 +508,16 @@ let xe = class extends ee {
508
508
  };
509
509
  }
510
510
  };
511
- xe = Si([
511
+ xe = Ai([
512
512
  pe(0, ue),
513
513
  pe(1, Ua),
514
514
  pe(2, nn),
515
515
  pe(3, Ce),
516
516
  pe(4, H(ye)),
517
517
  pe(5, H(Gt)),
518
- pe(6, H(yn))
518
+ pe(6, H(gn))
519
519
  ], xe);
520
- function Ai(a, e, n) {
520
+ function Ci(a, e, n) {
521
521
  var i;
522
522
  return a == null || a[e] == null || ((i = a[e]) == null ? void 0 : i[n]) == null;
523
523
  }
@@ -536,26 +536,26 @@ function Ct(a, e, n) {
536
536
  };
537
537
  }
538
538
  var y = /* @__PURE__ */ ((a) => (a[a.MoveRange = 0] = "MoveRange", a[a.MoveRows = 1] = "MoveRows", a[a.MoveCols = 2] = "MoveCols", a[a.InsertRow = 3] = "InsertRow", a[a.InsertColumn = 4] = "InsertColumn", a[a.RemoveRow = 5] = "RemoveRow", a[a.RemoveColumn = 6] = "RemoveColumn", a[a.DeleteMoveLeft = 7] = "DeleteMoveLeft", a[a.DeleteMoveUp = 8] = "DeleteMoveUp", a[a.InsertMoveDown = 9] = "InsertMoveDown", a[a.InsertMoveRight = 10] = "InsertMoveRight", a[a.SetName = 11] = "SetName", a[a.RemoveSheet = 12] = "RemoveSheet", a[a.SetDefinedName = 13] = "SetDefinedName", a[a.RemoveDefinedName = 14] = "RemoveDefinedName", a))(y || {});
539
- const Ci = [
539
+ const Di = [
540
540
  11,
541
541
  12,
542
542
  13,
543
543
  14
544
544
  /* RemoveDefinedName */
545
545
  ];
546
- function Di(a, e, n) {
546
+ function bi(a, e, n) {
547
547
  const { type: i } = n;
548
- return Ci.includes(i) ? bi(a, e) : Oi(a, e, n);
548
+ return Di.includes(i) ? Oi(a, e) : Mi(a, e, n);
549
549
  }
550
- function bi(a, e) {
550
+ function Oi(a, e) {
551
551
  const n = [], i = [];
552
552
  return Object.keys(e).forEach((r) => {
553
553
  const o = e[r], u = a[r];
554
554
  if (o == null || u == null)
555
555
  return !0;
556
- Object.keys(o).forEach((f) => {
557
- const m = new V(o[f] || {}), c = new V(u[f] || {}), l = new V(), L = new V();
558
- if (m.forValue((I, d, R) => {
556
+ Object.keys(o).forEach((m) => {
557
+ const f = new V(o[m] || {}), c = new V(u[m] || {}), l = new V(), L = new V();
558
+ if (f.forValue((I, d, R) => {
559
559
  if (R == null)
560
560
  return !0;
561
561
  const N = _e(R);
@@ -563,20 +563,20 @@ function bi(a, e) {
563
563
  }), l.getSizeOf() === 0)
564
564
  return;
565
565
  const E = {
566
- subUnitId: f,
566
+ subUnitId: m,
567
567
  unitId: r,
568
568
  cellValue: l.getMatrix()
569
569
  }, p = {
570
- id: Q.id,
570
+ id: j.id,
571
571
  params: E
572
572
  };
573
573
  i.push(p);
574
574
  const S = {
575
- subUnitId: f,
575
+ subUnitId: m,
576
576
  unitId: r,
577
577
  cellValue: L.getMatrix()
578
578
  }, A = {
579
- id: Q.id,
579
+ id: j.id,
580
580
  params: S
581
581
  };
582
582
  n.push(A);
@@ -586,31 +586,31 @@ function bi(a, e) {
586
586
  redos: i
587
587
  };
588
588
  }
589
- function Oi(a, e, n) {
590
- const { redoFormulaData: i, undoFormulaData: r } = Mi(a, e, n), o = [], u = [];
591
- return Object.keys(i).forEach((f) => {
592
- Object.keys(i[f]).forEach((m) => {
593
- if (Object.keys(i[f][m]).length !== 0) {
589
+ function Mi(a, e, n) {
590
+ const { redoFormulaData: i, undoFormulaData: r } = xi(a, e, n), o = [], u = [];
591
+ return Object.keys(i).forEach((m) => {
592
+ Object.keys(i[m]).forEach((f) => {
593
+ if (Object.keys(i[m][f]).length !== 0) {
594
594
  const c = {
595
- subUnitId: m,
596
- unitId: f,
597
- cellValue: i[f][m]
595
+ subUnitId: f,
596
+ unitId: m,
597
+ cellValue: i[m][f]
598
598
  }, l = {
599
- id: Q.id,
599
+ id: j.id,
600
600
  params: c
601
601
  };
602
602
  o.push(l);
603
603
  }
604
604
  });
605
- }), Object.keys(r).forEach((f) => {
606
- Object.keys(r[f]).forEach((m) => {
607
- if (Object.keys(r[f][m]).length !== 0) {
605
+ }), Object.keys(r).forEach((m) => {
606
+ Object.keys(r[m]).forEach((f) => {
607
+ if (Object.keys(r[m][f]).length !== 0) {
608
608
  const c = {
609
- subUnitId: m,
610
- unitId: f,
611
- cellValue: r[f][m]
609
+ subUnitId: f,
610
+ unitId: m,
611
+ cellValue: r[m][f]
612
612
  }, l = {
613
- id: Q.id,
613
+ id: j.id,
614
614
  params: c
615
615
  };
616
616
  u.push(l);
@@ -621,25 +621,25 @@ function Oi(a, e, n) {
621
621
  redos: o
622
622
  };
623
623
  }
624
- function Mi(a, e, n) {
624
+ function xi(a, e, n) {
625
625
  const i = {}, r = {}, { unitId: o, sheetId: u } = n;
626
- return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((m) => {
627
- if (Ai(a, m, u))
626
+ return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((f) => {
627
+ if (Ci(a, f, u))
628
628
  return;
629
629
  (/* @__PURE__ */ new Set([
630
- ...Object.keys(a[m] || {}),
631
- ...Object.keys(e[m] || {})
630
+ ...Object.keys(a[f] || {}),
631
+ ...Object.keys(e[f] || {})
632
632
  ])).forEach((l) => {
633
633
  var R, N;
634
- const L = (R = a[m]) == null ? void 0 : R[l], E = (N = e[m]) == null ? void 0 : N[l], p = new V(L || {}), S = new V(E || {});
634
+ const L = (R = a[f]) == null ? void 0 : R[l], E = (N = e[f]) == null ? void 0 : N[l], p = new V(L || {}), S = new V(E || {});
635
635
  let A = [];
636
- m !== o || l !== u ? A = _i(S) : A = xi(p, S, n);
637
- const I = Xi(A, p, S), d = Wi(A, p);
638
- i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][l] = {
639
- ...i[m][l],
636
+ f !== o || l !== u ? A = yi(S) : A = _i(p, S, n);
637
+ const I = Wi(A, p, S), d = Ki(A, p);
638
+ i[f] || (i[f] = {}), r[f] || (r[f] = {}), i[f][l] = {
639
+ ...i[f][l],
640
640
  ...I
641
- }, r[m][l] = {
642
- ...r[m][l],
641
+ }, r[f][l] = {
642
+ ...r[f][l],
643
643
  ...d
644
644
  };
645
645
  });
@@ -648,11 +648,11 @@ function Mi(a, e, n) {
648
648
  undoFormulaData: r
649
649
  };
650
650
  }
651
- function xi(a, e, n) {
652
- const { type: i, from: r, to: o, range: u } = n, f = [];
653
- return a.forValue((m, c, l) => {
651
+ function _i(a, e, n) {
652
+ const { type: i, from: r, to: o, range: u } = n, m = [];
653
+ return a.forValue((f, c, l) => {
654
654
  if (l == null || !va(l)) return !0;
655
- const L = da(m, c);
655
+ const L = da(f, c);
656
656
  let E = null, p = !1;
657
657
  if ([
658
658
  0,
@@ -660,17 +660,17 @@ function xi(a, e, n) {
660
660
  2
661
661
  /* MoveCols */
662
662
  ].includes(i))
663
- E = yi(i, r, o, L);
663
+ E = gi(i, r, o, L);
664
664
  else if (u != null) {
665
- const S = gi(L, n);
665
+ const S = qi(L, n);
666
666
  E = S.newCell, p = S.isReverse;
667
667
  }
668
- if (Xe.diffValue(L, E) && !e.getValue(m, c))
668
+ if (Xe.diffValue(L, E) && !e.getValue(f, c))
669
669
  return !0;
670
- p ? f.unshift({ oldCell: L, newCell: E }) : f.push({ oldCell: L, newCell: E });
671
- }), f;
670
+ p ? m.unshift({ oldCell: L, newCell: E }) : m.push({ oldCell: L, newCell: E });
671
+ }), m;
672
672
  }
673
- function _i(a) {
673
+ function yi(a) {
674
674
  const e = [];
675
675
  return a.forValue((n, i, r) => {
676
676
  if (r == null || !va(r)) return !0;
@@ -678,52 +678,52 @@ function _i(a) {
678
678
  e.push({ oldCell: o, newCell: o });
679
679
  }), e;
680
680
  }
681
- function yi(a, e, n, i) {
681
+ function gi(a, e, n, i) {
682
682
  if (e == null || n == null)
683
683
  return null;
684
684
  switch (a) {
685
685
  case 0:
686
- return qi(e, n, i);
687
- case 1:
688
686
  return hi(e, n, i);
689
- case 2:
687
+ case 1:
690
688
  return Ui(e, n, i);
689
+ case 2:
690
+ return Fi(e, n, i);
691
691
  default:
692
692
  return null;
693
693
  }
694
694
  }
695
- function gi(a, e) {
695
+ function qi(a, e) {
696
696
  const { type: n, rangeFilteredRows: i } = e, r = e.range;
697
697
  let o = null, u = !1;
698
698
  switch (n) {
699
699
  case 3:
700
- o = Fi(r, a), u = !0;
700
+ o = Bi(r, a), u = !0;
701
701
  break;
702
702
  case 4:
703
- o = Bi(r, a), u = !0;
703
+ o = vi(r, a), u = !0;
704
704
  break;
705
705
  case 5:
706
- o = vi(r, a, i);
706
+ o = Vi(r, a, i);
707
707
  break;
708
708
  case 6:
709
- o = Vi(r, a);
709
+ o = Gi(r, a);
710
710
  break;
711
711
  case 7:
712
- o = Gi(r, a);
712
+ o = Hi(r, a);
713
713
  break;
714
714
  case 8:
715
- o = Hi(r, a);
715
+ o = wi(r, a);
716
716
  break;
717
717
  case 9:
718
- o = wi(r, a), u = !0;
718
+ o = Yi(r, a), u = !0;
719
719
  break;
720
720
  case 10:
721
- o = Yi(r, a), u = !0;
721
+ o = Xi(r, a), u = !0;
722
722
  break;
723
723
  }
724
724
  return { newCell: o, isReverse: u };
725
725
  }
726
- function qi(a, e, n) {
726
+ function hi(a, e, n) {
727
727
  const i = Aa(
728
728
  {
729
729
  id: w.MoveRangeCommandId,
@@ -733,7 +733,7 @@ function qi(a, e, n) {
733
733
  );
734
734
  return Y(i, n);
735
735
  }
736
- function hi(a, e, n) {
736
+ function Ui(a, e, n) {
737
737
  const i = Sa(
738
738
  {
739
739
  id: w.MoveRowsCommandId,
@@ -743,7 +743,7 @@ function hi(a, e, n) {
743
743
  );
744
744
  return Y(i, n);
745
745
  }
746
- function Ui(a, e, n) {
746
+ function Fi(a, e, n) {
747
747
  const i = Ra(
748
748
  {
749
749
  id: w.MoveColsCommandId,
@@ -753,7 +753,7 @@ function Ui(a, e, n) {
753
753
  );
754
754
  return Y(i, n);
755
755
  }
756
- function Fi(a, e) {
756
+ function Bi(a, e) {
757
757
  const n = ya(
758
758
  {
759
759
  id: w.InsertRowCommandId,
@@ -763,7 +763,7 @@ function Fi(a, e) {
763
763
  );
764
764
  return Y(n, e);
765
765
  }
766
- function Bi(a, e) {
766
+ function vi(a, e) {
767
767
  const n = _a(
768
768
  {
769
769
  id: w.InsertColCommandId,
@@ -773,7 +773,7 @@ function Bi(a, e) {
773
773
  );
774
774
  return Y(n, e);
775
775
  }
776
- function vi(a, e, n) {
776
+ function Vi(a, e, n) {
777
777
  const i = xa(
778
778
  {
779
779
  id: w.RemoveRowCommandId,
@@ -784,7 +784,7 @@ function vi(a, e, n) {
784
784
  );
785
785
  return Y(i, e);
786
786
  }
787
- function Vi(a, e) {
787
+ function Gi(a, e) {
788
788
  const n = Ma(
789
789
  {
790
790
  id: w.RemoveColCommandId,
@@ -794,7 +794,7 @@ function Vi(a, e) {
794
794
  );
795
795
  return Y(n, e);
796
796
  }
797
- function Gi(a, e) {
797
+ function Hi(a, e) {
798
798
  const n = Oa(
799
799
  {
800
800
  id: w.DeleteRangeMoveLeftCommandId,
@@ -804,7 +804,7 @@ function Gi(a, e) {
804
804
  );
805
805
  return Y(n, e);
806
806
  }
807
- function Hi(a, e) {
807
+ function wi(a, e) {
808
808
  const n = ba(
809
809
  {
810
810
  id: w.DeleteRangeMoveUpCommandId,
@@ -814,7 +814,7 @@ function Hi(a, e) {
814
814
  );
815
815
  return Y(n, e);
816
816
  }
817
- function wi(a, e) {
817
+ function Yi(a, e) {
818
818
  const n = Da(
819
819
  {
820
820
  id: w.InsertRangeMoveDownCommandId,
@@ -824,7 +824,7 @@ function wi(a, e) {
824
824
  );
825
825
  return Y(n, e);
826
826
  }
827
- function Yi(a, e) {
827
+ function Xi(a, e) {
828
828
  const n = Ca(
829
829
  {
830
830
  id: w.InsertRangeMoveRightCommandId,
@@ -834,31 +834,33 @@ function Yi(a, e) {
834
834
  );
835
835
  return Y(n, e);
836
836
  }
837
- function Xi(a, e, n) {
837
+ function Wi(a, e, n) {
838
838
  var r, o, u;
839
839
  const i = new V({});
840
- for (let f = 0; f < a.length; f++) {
841
- const { oldCell: m, newCell: c } = a[f];
842
- if ((r = i.getValue(m.startRow, m.startColumn)) != null && r.f || (o = i.getValue(m.startRow, m.startColumn)) != null && o.si || i.setValue(m.startRow, m.startColumn, { f: null, si: null }), c) {
843
- const l = (u = n.getValue(m.startRow, m.startColumn)) != null ? u : e.getValue(m.startRow, m.startColumn), L = _e(l);
840
+ for (let m = 0; m < a.length; m++) {
841
+ const { oldCell: f, newCell: c } = a[m];
842
+ if ((r = i.getValue(f.startRow, f.startColumn)) != null && r.f || (o = i.getValue(f.startRow, f.startColumn)) != null && o.si || i.setValue(f.startRow, f.startColumn, { f: null, si: null }), c) {
843
+ const l = (u = n.getValue(f.startRow, f.startColumn)) != null ? u : e.getValue(f.startRow, f.startColumn), L = _e(l);
844
844
  i.setValue(c.startRow, c.startColumn, L);
845
845
  }
846
846
  }
847
847
  return i.getMatrix();
848
848
  }
849
- function Wi(a, e) {
849
+ function Ki(a, e) {
850
850
  const n = new V({});
851
851
  for (let i = a.length - 1; i >= 0; i--) {
852
- const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), f = _e(u);
853
- if (n.setValue(r.startRow, r.startColumn, f), o) {
854
- const m = e.getValue(o.startRow, o.startColumn), c = _e(m);
852
+ const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), m = _e(u);
853
+ if (n.setValue(r.startRow, r.startColumn, m), o) {
854
+ const f = e.getValue(o.startRow, o.startColumn), c = _e(f);
855
855
  n.setValue(o.startRow, o.startColumn, c != null ? c : { f: null, si: null });
856
856
  }
857
857
  }
858
858
  return n.getMatrix();
859
859
  }
860
860
  function _e(a) {
861
- if (a == null)
861
+ if (a === void 0)
862
+ return;
863
+ if (a === null)
862
864
  return {
863
865
  f: null,
864
866
  si: null
@@ -869,15 +871,16 @@ function _e(a) {
869
871
  f: null,
870
872
  si: null
871
873
  };
872
- const f = {};
873
- return u && (f.si = n), o && i === 0 && r === 0 && (f.f = e), f.f === void 0 && (f.f = null), f.si === void 0 && (f.si = null), f;
874
+ const m = {};
875
+ return u && (m.si = n), o && i === 0 && r === 0 && (m.f = e), m.f === void 0 && (m.f = null), m.si === void 0 && (m.si = null), m;
874
876
  }
875
- function Ki(a) {
876
- const e = new V({});
877
- return new V(a).forValue((i, r, o) => {
878
- const u = _e(o);
879
- u !== void 0 && e.setValue(i, r, u);
880
- }), e.getMatrix();
877
+ function ki(a, e) {
878
+ const n = new V({});
879
+ return new V(a).forValue((r, o, u) => {
880
+ var f;
881
+ const m = _e(u);
882
+ m !== void 0 && (e && ((f = e[r]) != null && f[o]) && (m != null && m.f || m != null && m.si) && (m.v = null, m.t = null), n.setValue(r, o, m));
883
+ }), n.getMatrix();
881
884
  }
882
885
  function va(a) {
883
886
  const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = Me(e), r = sa(n);
@@ -894,14 +897,14 @@ function Va(a, e, n, i, r, o) {
894
897
  function Ga(a, e, n = 0, i = 0) {
895
898
  const r = [];
896
899
  for (let o = 0, u = a.length; o < u; o++) {
897
- const f = a[o];
898
- if (typeof f == "string" || f.nodeType !== ie.REFERENCE || e.includes(o)) {
899
- r.push(f);
900
+ const m = a[o];
901
+ if (typeof m == "string" || m.nodeType !== ie.REFERENCE || e.includes(o)) {
902
+ r.push(m);
900
903
  continue;
901
904
  }
902
- const { token: m } = f, c = Pe(m), { range: l, sheetName: L, unitId: E } = c, p = fe.moveOffset(l, n, i);
905
+ const { token: f } = m, c = Pe(f), { range: l, sheetName: L, unitId: E } = c, p = fe.moveOffset(l, n, i);
903
906
  r.push({
904
- ...f,
907
+ ...m,
905
908
  token: st({
906
909
  range: p,
907
910
  unitId: E,
@@ -912,7 +915,7 @@ function Ga(a, e, n = 0, i = 0) {
912
915
  return r;
913
916
  }
914
917
  function Ha(a, e, n, i) {
915
- const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: l } = e, {
918
+ const { type: r, unitId: o, sheetId: u, range: m, from: f, to: c, rangeFilteredRows: l } = e, {
916
919
  range: L,
917
920
  sheetId: E,
918
921
  unitId: p,
@@ -932,24 +935,24 @@ function Ha(a, e, n, i) {
932
935
  const d = fe.moveOffset(L, A, I);
933
936
  let R = null;
934
937
  if (r === y.MoveRange) {
935
- if (m == null || c == null)
938
+ if (f == null || c == null)
936
939
  return;
937
- const N = bt(d, m), P = We(d, m);
940
+ const N = bt(d, f), P = We(d, f);
938
941
  if (P == null || N !== 4)
939
942
  return;
940
943
  const q = Aa(
941
- { id: w.MoveRangeCommandId, params: { toRange: c, fromRange: m } },
944
+ { id: w.MoveRangeCommandId, params: { toRange: c, fromRange: f } },
942
945
  P
943
946
  ), M = Y(q, P);
944
947
  if (M == null)
945
- return k.REF;
946
- R = Dt(N, M, m, c, d, P);
948
+ return Q.REF;
949
+ R = Dt(N, M, f, c, d, P);
947
950
  } else if (r === y.MoveRows) {
948
- if (m == null || c == null)
951
+ if (f == null || c == null)
949
952
  return;
950
- const N = bt(d, m);
951
- let P = We(d, m);
952
- if (P == null && (m.endRow < d.startRow && c.endRow <= d.startRow || m.startRow > d.endRow && c.startRow > d.endRow))
953
+ const N = bt(d, f);
954
+ let P = We(d, f);
955
+ if (P == null && (f.endRow < d.startRow && c.endRow <= d.startRow || f.startRow > d.endRow && c.startRow > d.endRow))
953
956
  return;
954
957
  P == null && (P = {
955
958
  startRow: d.startRow,
@@ -959,18 +962,18 @@ function Ha(a, e, n, i) {
959
962
  rangeType: X.NORMAL
960
963
  });
961
964
  const q = Sa(
962
- { id: w.MoveRowsCommandId, params: { toRange: c, fromRange: m } },
965
+ { id: w.MoveRowsCommandId, params: { toRange: c, fromRange: f } },
963
966
  P
964
967
  ), M = Y(q, P);
965
968
  if (M == null)
966
- return k.REF;
967
- R = Dt(N, M, m, c, d, P);
969
+ return Q.REF;
970
+ R = Dt(N, M, f, c, d, P);
968
971
  } else if (r === y.MoveCols) {
969
- if (m == null || c == null)
972
+ if (f == null || c == null)
970
973
  return;
971
- const N = bt(d, m);
972
- let P = We(d, m);
973
- if (P == null && (m.endColumn < d.startColumn && c.endColumn <= d.startColumn || m.startColumn > d.endColumn && c.startColumn > d.endColumn))
974
+ const N = bt(d, f);
975
+ let P = We(d, f);
976
+ if (P == null && (f.endColumn < d.startColumn && c.endColumn <= d.startColumn || f.startColumn > d.endColumn && c.startColumn > d.endColumn))
974
977
  return;
975
978
  P == null && (P = {
976
979
  startRow: d.startRow,
@@ -980,19 +983,19 @@ function Ha(a, e, n, i) {
980
983
  rangeType: X.NORMAL
981
984
  });
982
985
  const q = Ra(
983
- { id: w.MoveColsCommandId, params: { toRange: c, fromRange: m } },
986
+ { id: w.MoveColsCommandId, params: { toRange: c, fromRange: f } },
984
987
  P
985
988
  ), M = Y(q, P);
986
989
  if (M == null)
987
- return k.REF;
988
- R = Dt(N, M, m, c, d, P);
990
+ return Q.REF;
991
+ R = Dt(N, M, f, c, d, P);
989
992
  }
990
- if (f != null) {
993
+ if (m != null) {
991
994
  if (r === y.InsertRow) {
992
995
  const N = ya(
993
996
  {
994
997
  id: w.InsertRowCommandId,
995
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.DOWN }
998
+ params: { range: m, unitId: "", subUnitId: "", direction: Ke.DOWN }
996
999
  },
997
1000
  d
998
1001
  ), P = Y(N, d);
@@ -1006,7 +1009,7 @@ function Ha(a, e, n, i) {
1006
1009
  const N = _a(
1007
1010
  {
1008
1011
  id: w.InsertColCommandId,
1009
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.RIGHT }
1012
+ params: { range: m, unitId: "", subUnitId: "", direction: Ke.RIGHT }
1010
1013
  },
1011
1014
  d
1012
1015
  ), P = Y(N, d);
@@ -1020,13 +1023,13 @@ function Ha(a, e, n, i) {
1020
1023
  const N = xa(
1021
1024
  {
1022
1025
  id: w.RemoveRowCommandId,
1023
- params: { range: f }
1026
+ params: { range: m }
1024
1027
  },
1025
1028
  d,
1026
1029
  l
1027
1030
  ), P = Y(N, d);
1028
1031
  if (P == null)
1029
- return k.REF;
1032
+ return Q.REF;
1030
1033
  R = {
1031
1034
  ...d,
1032
1035
  ...P
@@ -1035,12 +1038,12 @@ function Ha(a, e, n, i) {
1035
1038
  const N = Ma(
1036
1039
  {
1037
1040
  id: w.RemoveColCommandId,
1038
- params: { range: f }
1041
+ params: { range: m }
1039
1042
  },
1040
1043
  d
1041
1044
  ), P = Y(N, d);
1042
1045
  if (P == null)
1043
- return k.REF;
1046
+ return Q.REF;
1044
1047
  R = {
1045
1048
  ...d,
1046
1049
  ...P
@@ -1049,12 +1052,12 @@ function Ha(a, e, n, i) {
1049
1052
  const N = Oa(
1050
1053
  {
1051
1054
  id: w.DeleteRangeMoveLeftCommandId,
1052
- params: { range: f }
1055
+ params: { range: m }
1053
1056
  },
1054
1057
  d
1055
1058
  ), P = Y(N, d);
1056
1059
  if (P == null)
1057
- return k.REF;
1060
+ return Q.REF;
1058
1061
  R = {
1059
1062
  ...d,
1060
1063
  ...P
@@ -1063,12 +1066,12 @@ function Ha(a, e, n, i) {
1063
1066
  const N = ba(
1064
1067
  {
1065
1068
  id: w.DeleteRangeMoveUpCommandId,
1066
- params: { range: f }
1069
+ params: { range: m }
1067
1070
  },
1068
1071
  d
1069
1072
  ), P = Y(N, d);
1070
1073
  if (P == null)
1071
- return k.REF;
1074
+ return Q.REF;
1072
1075
  R = {
1073
1076
  ...d,
1074
1077
  ...P
@@ -1077,7 +1080,7 @@ function Ha(a, e, n, i) {
1077
1080
  const N = Da(
1078
1081
  {
1079
1082
  id: w.InsertRangeMoveDownCommandId,
1080
- params: { range: f }
1083
+ params: { range: m }
1081
1084
  },
1082
1085
  d
1083
1086
  ), P = Y(N, d);
@@ -1091,7 +1094,7 @@ function Ha(a, e, n, i) {
1091
1094
  const N = Ca(
1092
1095
  {
1093
1096
  id: w.InsertRangeMoveRightCommandId,
1094
- params: { range: f }
1097
+ params: { range: m }
1095
1098
  },
1096
1099
  d
1097
1100
  ), P = Y(N, d);
@@ -1111,7 +1114,7 @@ function Ha(a, e, n, i) {
1111
1114
  });
1112
1115
  }
1113
1116
  function Dt(a, e, n, i, r, o) {
1114
- const { startRow: u, endRow: f, startColumn: m, endColumn: c, rangeType: l } = Oe(e), {
1117
+ const { startRow: u, endRow: m, startColumn: f, endColumn: c, rangeType: l } = Oe(e), {
1115
1118
  startRow: L,
1116
1119
  startColumn: E,
1117
1120
  endRow: p,
@@ -1130,10 +1133,10 @@ function Dt(a, e, n, i, r, o) {
1130
1133
  rangeType: ae = X.NORMAL
1131
1134
  } = Oe(r), O = { ...r };
1132
1135
  function ce() {
1133
- return l === X.COLUMN && ae === X.COLUMN ? !0 : m >= F && c <= B;
1136
+ return l === X.COLUMN && ae === X.COLUMN ? !0 : f >= F && c <= B;
1134
1137
  }
1135
1138
  function ne() {
1136
- return l === X.ROW && ae === X.ROW ? !0 : u >= h && f <= x;
1139
+ return l === X.ROW && ae === X.ROW ? !0 : u >= h && m <= x;
1137
1140
  }
1138
1141
  if (a === 0)
1139
1142
  if (ce())
@@ -1147,9 +1150,9 @@ function Dt(a, e, n, i, r, o) {
1147
1150
  return;
1148
1151
  else if (a === 1)
1149
1152
  if (ce())
1150
- if (f > x)
1151
- O.endRow = f;
1152
- else if (f <= h)
1153
+ if (m > x)
1154
+ O.endRow = m;
1155
+ else if (m <= h)
1153
1156
  O.startRow += x - L + 1;
1154
1157
  else
1155
1158
  return;
@@ -1157,9 +1160,9 @@ function Dt(a, e, n, i, r, o) {
1157
1160
  return;
1158
1161
  else if (a === 2)
1159
1162
  if (ne())
1160
- if (m < F)
1161
- O.startColumn = m;
1162
- else if (m >= B)
1163
+ if (f < F)
1164
+ O.startColumn = f;
1165
+ else if (f >= B)
1163
1166
  O.endColumn -= S + 1 - F;
1164
1167
  else
1165
1168
  return;
@@ -1175,21 +1178,21 @@ function Dt(a, e, n, i, r, o) {
1175
1178
  return;
1176
1179
  else
1177
1180
  return;
1178
- else a === 4 ? (O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c) : E <= F && S >= B || A === X.ROW && ae === X.ROW ? n.endRow < h ? (I >= h && (O.startRow -= p - L + 1), I >= x && (O.endRow -= p - L + 1)) : n.startRow > x ? (R <= x && (O.endRow += p - L + 1), R <= h && (O.startRow += p - L + 1)) : n.startRow >= h && n.endRow <= x && (I <= h ? O.startRow += p - L + 1 : I >= x && (O.endRow -= p - L + 1)) : L <= h && p >= x || A === X.COLUMN && ae === X.COLUMN ? n.endColumn < F ? (d >= F && (O.startColumn -= S - E + 1), d >= B && (O.endColumn -= S - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += S - E + 1), N <= F && (O.startColumn += S - E + 1)) : n.startColumn >= F && n.endColumn <= B && (d <= F ? O.startColumn += S - E + 1 : d >= B && (O.endColumn -= S - E + 1)) : ((d <= U + 1 && N >= B || d <= F && N >= M - 1) && I <= h && R >= x || (I <= q + 1 && R >= x || I <= h && R >= P - 1) && d <= F && N >= B, O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c);
1181
+ else a === 4 ? (O.startRow = u, O.startColumn = f, O.endRow = m, O.endColumn = c) : E <= F && S >= B || A === X.ROW && ae === X.ROW ? n.endRow < h ? (I >= h && (O.startRow -= p - L + 1), I >= x && (O.endRow -= p - L + 1)) : n.startRow > x ? (R <= x && (O.endRow += p - L + 1), R <= h && (O.startRow += p - L + 1)) : n.startRow >= h && n.endRow <= x && (I <= h ? O.startRow += p - L + 1 : I >= x && (O.endRow -= p - L + 1)) : L <= h && p >= x || A === X.COLUMN && ae === X.COLUMN ? n.endColumn < F ? (d >= F && (O.startColumn -= S - E + 1), d >= B && (O.endColumn -= S - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += S - E + 1), N <= F && (O.startColumn += S - E + 1)) : n.startColumn >= F && n.endColumn <= B && (d <= F ? O.startColumn += S - E + 1 : d >= B && (O.endColumn -= S - E + 1)) : ((d <= U + 1 && N >= B || d <= F && N >= M - 1) && I <= h && R >= x || (I <= q + 1 && R >= x || I <= h && R >= P - 1) && d <= F && N >= B, O.startRow = u, O.startColumn = f, O.endRow = m, O.endColumn = c);
1179
1182
  return O;
1180
1183
  }
1181
1184
  function bt(a, e) {
1182
- const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow), f = Re(e.endRow), m = Ne(e.startColumn), c = Re(e.endColumn);
1185
+ const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow), m = Re(e.endRow), f = Ne(e.startColumn), c = Re(e.endColumn);
1183
1186
  function l() {
1184
- return a.rangeType === X.COLUMN && e.rangeType === X.COLUMN ? !0 : n >= u && i <= f;
1187
+ return a.rangeType === X.COLUMN && e.rangeType === X.COLUMN ? !0 : n >= u && i <= m;
1185
1188
  }
1186
1189
  function L() {
1187
- return a.rangeType === X.ROW && e.rangeType === X.ROW ? !0 : r >= m && o <= c;
1190
+ return a.rangeType === X.ROW && e.rangeType === X.ROW ? !0 : r >= f && o <= c;
1188
1191
  }
1189
1192
  function E() {
1190
1193
  return a.rangeType === X.ALL && e.rangeType === X.ALL;
1191
1194
  }
1192
- return l() && L() || E() ? 4 : L() && n >= u && n <= f && i > f ? 0 : L() && i >= u && i <= f && n < u ? 1 : l() && r >= m && r <= c && o > c ? 2 : l() && o >= m && o <= c && r < m ? 3 : null;
1195
+ return l() && L() || E() ? 4 : L() && n >= u && n <= m && i > m ? 0 : L() && i >= u && i <= m && n < u ? 1 : l() && r >= f && r <= c && o > c ? 2 : l() && o >= f && o <= c && r < f ? 3 : null;
1193
1196
  }
1194
1197
  function Ne(a) {
1195
1198
  return isNaN(a) ? -1 / 0 : a;
@@ -1212,49 +1215,49 @@ function wa(a, e) {
1212
1215
  let i = null;
1213
1216
  switch (n) {
1214
1217
  case Dn.id:
1215
- i = ki(e, a);
1218
+ i = Qi(e, a);
1216
1219
  break;
1217
1220
  case Cn.id:
1218
- i = Qi(e, a);
1221
+ i = ji(e, a);
1219
1222
  break;
1220
1223
  case An.id:
1221
- i = ji(e, a);
1224
+ i = $i(e, a);
1222
1225
  break;
1223
1226
  case Sn.id:
1224
- i = $i(e);
1227
+ i = zi(e);
1225
1228
  break;
1226
1229
  case Rn.id:
1227
- i = zi(e);
1230
+ i = Zi(e);
1228
1231
  break;
1229
1232
  case Nn.id:
1230
- i = Zi(e, a);
1233
+ i = Ji(e, a);
1231
1234
  break;
1232
1235
  case In.id:
1233
- i = Ji(e, a);
1236
+ i = er(e, a);
1234
1237
  break;
1235
1238
  case En.id:
1236
- i = er(e, a);
1239
+ i = tr(e, a);
1237
1240
  break;
1238
1241
  case Tn.id:
1239
- i = tr(e, a);
1242
+ i = ar(e, a);
1240
1243
  break;
1241
1244
  case Pn.id:
1242
- i = ar(e, a);
1245
+ i = nr(e, a);
1243
1246
  break;
1244
1247
  case Ln.id:
1245
- i = nr(e, a);
1248
+ i = ir(e, a);
1246
1249
  break;
1247
1250
  case pn.id:
1248
- i = ir(e, a);
1251
+ i = rr(e, a);
1249
1252
  break;
1250
1253
  case dn.id:
1251
- i = rr(e, a);
1254
+ i = or(e, a);
1252
1255
  break;
1253
1256
  case qa.id:
1254
- i = or(e, a);
1257
+ i = ur(e, a);
1255
1258
  break;
1256
1259
  case ga.id:
1257
- i = ur(e, a);
1260
+ i = mr(e, a);
1258
1261
  break;
1259
1262
  }
1260
1263
  return i;
@@ -1267,7 +1270,7 @@ function te(a) {
1267
1270
  sheetId: n
1268
1271
  };
1269
1272
  }
1270
- function ki(a, e) {
1273
+ function Qi(a, e) {
1271
1274
  const { params: n } = a;
1272
1275
  if (!n) return null;
1273
1276
  const { fromRange: i, toRange: r } = n;
@@ -1281,53 +1284,53 @@ function ki(a, e) {
1281
1284
  sheetId: u
1282
1285
  };
1283
1286
  }
1284
- function Qi(a, e) {
1287
+ function ji(a, e) {
1285
1288
  const { params: n } = a;
1286
1289
  if (!n) return null;
1287
1290
  const {
1288
1291
  fromRange: { startRow: i, endRow: r },
1289
1292
  toRange: { startRow: o, endRow: u }
1290
- } = n, f = e.getUnitId(), m = e.getActiveSheet();
1291
- if (!m) return null;
1292
- const c = m.getSheetId(), l = {
1293
+ } = n, m = e.getUnitId(), f = e.getActiveSheet();
1294
+ if (!f) return null;
1295
+ const c = f.getSheetId(), l = {
1293
1296
  startRow: i,
1294
1297
  startColumn: 0,
1295
1298
  endRow: r,
1296
- endColumn: m.getColumnCount() - 1,
1299
+ endColumn: f.getColumnCount() - 1,
1297
1300
  rangeType: X.ROW
1298
1301
  }, L = {
1299
1302
  startRow: o,
1300
1303
  startColumn: 0,
1301
1304
  endRow: u,
1302
- endColumn: m.getColumnCount() - 1,
1305
+ endColumn: f.getColumnCount() - 1,
1303
1306
  rangeType: X.ROW
1304
1307
  };
1305
1308
  return {
1306
1309
  type: y.MoveRows,
1307
1310
  from: l,
1308
1311
  to: L,
1309
- unitId: f,
1312
+ unitId: m,
1310
1313
  sheetId: c
1311
1314
  };
1312
1315
  }
1313
- function ji(a, e) {
1316
+ function $i(a, e) {
1314
1317
  const { params: n } = a;
1315
1318
  if (!n) return null;
1316
1319
  const {
1317
1320
  fromRange: { startColumn: i, endColumn: r },
1318
1321
  toRange: { startColumn: o, endColumn: u }
1319
- } = n, f = e.getUnitId(), m = e.getActiveSheet();
1320
- if (!m) return null;
1321
- const c = m.getSheetId(), l = {
1322
+ } = n, m = e.getUnitId(), f = e.getActiveSheet();
1323
+ if (!f) return null;
1324
+ const c = f.getSheetId(), l = {
1322
1325
  startRow: 0,
1323
1326
  startColumn: i,
1324
- endRow: m.getRowCount() - 1,
1327
+ endRow: f.getRowCount() - 1,
1325
1328
  endColumn: r,
1326
1329
  rangeType: X.COLUMN
1327
1330
  }, L = {
1328
1331
  startRow: 0,
1329
1332
  startColumn: o,
1330
- endRow: m.getRowCount() - 1,
1333
+ endRow: f.getRowCount() - 1,
1331
1334
  endColumn: u,
1332
1335
  rangeType: X.COLUMN
1333
1336
  };
@@ -1335,11 +1338,11 @@ function ji(a, e) {
1335
1338
  type: y.MoveCols,
1336
1339
  from: l,
1337
1340
  to: L,
1338
- unitId: f,
1341
+ unitId: m,
1339
1342
  sheetId: c
1340
1343
  };
1341
1344
  }
1342
- function $i(a) {
1345
+ function zi(a) {
1343
1346
  const { params: e } = a;
1344
1347
  if (!e) return null;
1345
1348
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1350,7 +1353,7 @@ function $i(a) {
1350
1353
  sheetId: r
1351
1354
  };
1352
1355
  }
1353
- function zi(a) {
1356
+ function Zi(a) {
1354
1357
  const { params: e } = a;
1355
1358
  if (!e) return null;
1356
1359
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1361,7 +1364,7 @@ function zi(a) {
1361
1364
  sheetId: r
1362
1365
  };
1363
1366
  }
1364
- function Zi(a, e) {
1367
+ function Ji(a, e) {
1365
1368
  const { params: n } = a;
1366
1369
  if (!n) return null;
1367
1370
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1372,7 +1375,7 @@ function Zi(a, e) {
1372
1375
  sheetId: o
1373
1376
  };
1374
1377
  }
1375
- function Ji(a, e) {
1378
+ function er(a, e) {
1376
1379
  const { params: n } = a;
1377
1380
  if (!n) return null;
1378
1381
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1383,8 +1386,8 @@ function Ji(a, e) {
1383
1386
  sheetId: o
1384
1387
  };
1385
1388
  }
1386
- function er(a, e) {
1387
- var u, f;
1389
+ function tr(a, e) {
1390
+ var u, m;
1388
1391
  const { params: n } = a;
1389
1392
  if (!n) return null;
1390
1393
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1393,10 +1396,10 @@ function er(a, e) {
1393
1396
  range: i,
1394
1397
  unitId: r,
1395
1398
  sheetId: o,
1396
- rangeFilteredRows: (f = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? f : []
1399
+ rangeFilteredRows: (m = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? m : []
1397
1400
  };
1398
1401
  }
1399
- function tr(a, e) {
1402
+ function ar(a, e) {
1400
1403
  const { params: n } = a;
1401
1404
  if (!n) return null;
1402
1405
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1407,7 +1410,7 @@ function tr(a, e) {
1407
1410
  sheetId: o
1408
1411
  };
1409
1412
  }
1410
- function ar(a, e) {
1413
+ function nr(a, e) {
1411
1414
  const { params: n } = a;
1412
1415
  if (!n) return null;
1413
1416
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1418,7 +1421,7 @@ function ar(a, e) {
1418
1421
  sheetId: o
1419
1422
  };
1420
1423
  }
1421
- function nr(a, e) {
1424
+ function ir(a, e) {
1422
1425
  const { params: n } = a;
1423
1426
  if (!n) return null;
1424
1427
  const { range: i } = n, { unitId: r, sheetId: o } = te(e);
@@ -1429,18 +1432,18 @@ function nr(a, e) {
1429
1432
  sheetId: o
1430
1433
  };
1431
1434
  }
1432
- function ir(a, e) {
1435
+ function rr(a, e) {
1433
1436
  const { params: n } = a;
1434
1437
  if (!n) return null;
1435
- const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: f } = te(e);
1438
+ const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: m } = te(e);
1436
1439
  return {
1437
1440
  type: y.SetName,
1438
1441
  unitId: i || u,
1439
- sheetId: r || f,
1442
+ sheetId: r || m,
1440
1443
  sheetName: o
1441
1444
  };
1442
1445
  }
1443
- function rr(a, e) {
1446
+ function or(a, e) {
1444
1447
  const { params: n } = a;
1445
1448
  if (!n) return null;
1446
1449
  const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = te(e);
@@ -1450,7 +1453,7 @@ function rr(a, e) {
1450
1453
  sheetId: r || u
1451
1454
  };
1452
1455
  }
1453
- function or(a, e) {
1456
+ function ur(a, e) {
1454
1457
  const { params: n } = a;
1455
1458
  if (!n) return null;
1456
1459
  const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
@@ -1462,7 +1465,7 @@ function or(a, e) {
1462
1465
  definedNameId: o
1463
1466
  };
1464
1467
  }
1465
- function ur(a, e) {
1468
+ function mr(a, e) {
1466
1469
  const { params: n } = a;
1467
1470
  if (!n) return null;
1468
1471
  const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
@@ -1474,8 +1477,8 @@ function ur(a, e) {
1474
1477
  definedNameId: o
1475
1478
  };
1476
1479
  }
1477
- var mr = Object.getOwnPropertyDescriptor, fr = (a, e, n, i) => {
1478
- for (var r = i > 1 ? void 0 : i ? mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1480
+ var fr = Object.getOwnPropertyDescriptor, cr = (a, e, n, i) => {
1481
+ for (var r = i > 1 ? void 0 : i ? fr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1479
1482
  (u = a[o]) && (r = u(r) || r);
1480
1483
  return r;
1481
1484
  }, Ve = (a, e) => (n, i) => e(n, i, a);
@@ -1495,7 +1498,7 @@ let Je = class extends ee {
1495
1498
  redos: [],
1496
1499
  undos: []
1497
1500
  };
1498
- const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
1501
+ const e = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET);
1499
1502
  if (e == null)
1500
1503
  return {
1501
1504
  redos: [],
@@ -1518,10 +1521,10 @@ let Je = class extends ee {
1518
1521
  redos: [],
1519
1522
  undos: []
1520
1523
  };
1521
- const u = [], f = [];
1522
- return Object.values(o).forEach((m) => {
1524
+ const u = [], m = [];
1525
+ return Object.values(o).forEach((f) => {
1523
1526
  var I;
1524
- const { formulaOrRefString: c } = m, l = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1527
+ const { formulaOrRefString: c } = f, l = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1525
1528
  if (l == null)
1526
1529
  return !0;
1527
1530
  let L = !1;
@@ -1540,7 +1543,7 @@ let Je = class extends ee {
1540
1543
  };
1541
1544
  let B = null;
1542
1545
  if (n === y.RemoveSheet)
1543
- B = this._removeSheet(m, i, r);
1546
+ B = this._removeSheet(f, i, r);
1544
1547
  else if (n === y.SetName) {
1545
1548
  const {
1546
1549
  sheetId: ae,
@@ -1571,7 +1574,7 @@ let Je = class extends ee {
1571
1574
  id: Ae.id,
1572
1575
  params: {
1573
1576
  unitId: i,
1574
- ...m,
1577
+ ...f,
1575
1578
  formulaOrRefString: p
1576
1579
  }
1577
1580
  };
@@ -1580,35 +1583,35 @@ let Je = class extends ee {
1580
1583
  id: Ae.id,
1581
1584
  params: {
1582
1585
  unitId: i,
1583
- ...m
1586
+ ...f
1584
1587
  }
1585
1588
  };
1586
- f.push(A);
1589
+ m.push(A);
1587
1590
  }), {
1588
1591
  redos: u,
1589
- undos: f
1592
+ undos: m
1590
1593
  };
1591
1594
  }
1592
1595
  _removeSheet(a, e, n) {
1593
1596
  var o;
1594
1597
  const { formulaOrRefString: i } = a;
1595
- return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? k.REF : null;
1598
+ return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? Q.REF : null;
1596
1599
  }
1597
1600
  };
1598
- Je = fr([
1601
+ Je = cr([
1599
1602
  Ve(0, dt),
1600
1603
  Ve(1, Ee),
1601
1604
  Ve(2, H(lt)),
1602
1605
  Ve(3, H(pt))
1603
1606
  ], Je);
1604
- var cr = Object.getOwnPropertyDescriptor, lr = (a, e, n, i) => {
1605
- for (var r = i > 1 ? void 0 : i ? cr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1607
+ var lr = Object.getOwnPropertyDescriptor, sr = (a, e, n, i) => {
1608
+ for (var r = i > 1 ? void 0 : i ? lr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1606
1609
  (u = a[o]) && (r = u(r) || r);
1607
1610
  return r;
1608
1611
  }, me = (a, e) => (n, i) => e(n, i, a);
1609
1612
  let et = class extends ee {
1610
- constructor(a, e, n, i, r, o, u, f) {
1611
- super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector = f, this._commandExecutedListener();
1613
+ constructor(a, e, n, i, r, o, u, m) {
1614
+ super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector = m, this._commandExecutedListener();
1612
1615
  }
1613
1616
  _commandExecutedListener() {
1614
1617
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
@@ -1623,14 +1626,14 @@ let et = class extends ee {
1623
1626
  })
1624
1627
  ), this.disposeWithMe(
1625
1628
  this._commandService.beforeCommandExecuted((a, e) => {
1626
- if (a.id === Q.id) {
1629
+ if (a.id === j.id) {
1627
1630
  const n = a.params;
1628
- if (e && e.onlyLocal === !0 || e && e.syncOnly === !0 || n.trigger === wt.id || n.trigger === Ia.id || n.trigger === Na.id)
1631
+ if (e && e.onlyLocal === !0 || e && e.syncOnly === !0 || n.trigger === wt.id || n.trigger === Ia.id || n.trigger === Na.id || n.trigger === bn.id)
1629
1632
  return;
1630
1633
  this._handleSetRangeValuesMutation(n);
1631
1634
  }
1632
1635
  })
1633
- ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($.UNIVER_SHEET).pipe(di((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1636
+ ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(k.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(k.UNIVER_SHEET).pipe(pi((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1634
1637
  }
1635
1638
  _handleSetRangeValuesMutation(a) {
1636
1639
  const { subUnitId: e, unitId: n, cellValue: i } = a;
@@ -1645,11 +1648,11 @@ let et = class extends ee {
1645
1648
  }
1646
1649
  };
1647
1650
  this._commandService.executeCommand(
1648
- Q.id,
1651
+ j.id,
1649
1652
  {
1650
1653
  unitId: n,
1651
1654
  subUnitId: e,
1652
- cellValue: Ki(r)
1655
+ cellValue: ki(r, i)
1653
1656
  },
1654
1657
  {
1655
1658
  onlyLocal: !0,
@@ -1677,7 +1680,7 @@ let et = class extends ee {
1677
1680
  );
1678
1681
  }
1679
1682
  _handleWorkbookDisposed(a, e) {
1680
- const n = this._formulaDataModel.getFormulaData(), i = Ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), f = Ct(u, a, e);
1683
+ const n = this._formulaDataModel.getFormulaData(), i = Ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), m = Ct(u, a, e);
1681
1684
  i && this._commandService.executeCommand(
1682
1685
  ve.id,
1683
1686
  {
@@ -1686,7 +1689,7 @@ let et = class extends ee {
1686
1689
  {
1687
1690
  onlyLocal: !0
1688
1691
  }
1689
- ), o && f && this._commandService.executeCommand(
1692
+ ), o && m && this._commandService.executeCommand(
1690
1693
  ht.id,
1691
1694
  {
1692
1695
  arrayFormulaRange: r,
@@ -1698,11 +1701,11 @@ let et = class extends ee {
1698
1701
  );
1699
1702
  }
1700
1703
  _handleInsertSheetMutation(a) {
1701
- const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o), f = na(i, n, r, u);
1704
+ const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o), m = na(i, n, r, u);
1702
1705
  this._commandService.executeCommand(
1703
1706
  ve.id,
1704
1707
  {
1705
- formulaData: f
1708
+ formulaData: m
1706
1709
  },
1707
1710
  {
1708
1711
  onlyLocal: !0
@@ -1710,15 +1713,15 @@ let et = class extends ee {
1710
1713
  );
1711
1714
  }
1712
1715
  _handleWorkbookAdded(a) {
1713
- var m;
1716
+ var f;
1714
1717
  const e = {}, n = a.getUnitId(), i = { [n]: {} };
1715
1718
  a.getSheets().forEach((c) => {
1716
1719
  var p;
1717
1720
  const l = c.getCellMatrix(), L = c.getSheetId(), E = na(e, n, L, l);
1718
1721
  i[n][L] = (p = E[n]) == null ? void 0 : p[L];
1719
1722
  }), this._commandService.executeCommand(ve.id, { formulaData: i }, { onlyLocal: !0 });
1720
- const o = this._configService.getConfig(ge), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Te.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1721
- this._commandService.executeCommand(je.id, f, { onlyLocal: !0 });
1723
+ const o = this._configService.getConfig(ge), u = (f = o == null ? void 0 : o.initialFormulaComputing) != null ? f : Te.WHEN_EMPTY, m = this._getDirtyDataByCalculationMode(u);
1724
+ this._commandService.executeCommand(je.id, m, { onlyLocal: !0 });
1722
1725
  }
1723
1726
  _getDirtyDataByCalculationMode(a) {
1724
1727
  const e = a === Te.FORCED, n = a === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
@@ -1733,7 +1736,7 @@ let et = class extends ee {
1733
1736
  };
1734
1737
  }
1735
1738
  _getUpdateFormula(a) {
1736
- const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
1739
+ const e = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET);
1737
1740
  if (!e)
1738
1741
  return {
1739
1742
  undos: [],
@@ -1745,10 +1748,10 @@ let et = class extends ee {
1745
1748
  r,
1746
1749
  i,
1747
1750
  n
1748
- ), { undos: u, redos: f } = Di(r, o, n);
1751
+ ), { undos: u, redos: m } = bi(r, o, n);
1749
1752
  return {
1750
1753
  undos: u,
1751
- redos: f
1754
+ redos: m
1752
1755
  };
1753
1756
  }
1754
1757
  return {
@@ -1763,13 +1766,13 @@ let et = class extends ee {
1763
1766
  if (i.length === 0) return { newFormulaData: {}, oldFormulaData: {} };
1764
1767
  const r = {}, o = {};
1765
1768
  for (const u of i) {
1766
- const f = a[u];
1767
- if (f == null)
1769
+ const m = a[u];
1770
+ if (m == null)
1768
1771
  continue;
1769
- const m = Object.keys(f);
1772
+ const f = Object.keys(m);
1770
1773
  Xe.isDefine(r[u]) || (r[u] = {}), Xe.isDefine(o[u]) || (o[u] = {});
1771
- for (const c of m) {
1772
- const l = new V(f[c] || {}), L = new V(), E = [];
1774
+ for (const c of f) {
1775
+ const l = new V(m[c] || {}), L = new V(), E = [];
1773
1776
  l.forValue((p, S, A) => {
1774
1777
  var F;
1775
1778
  if (!A) return !0;
@@ -1792,7 +1795,7 @@ let et = class extends ee {
1792
1795
  continue;
1793
1796
  P[B] = {
1794
1797
  ...O,
1795
- token: U === y.SetDefinedName ? Ie : k.REF
1798
+ token: U === y.SetDefinedName ? Ie : Q.REF
1796
1799
  }, q = !0, M.push(B);
1797
1800
  continue;
1798
1801
  } else if (ne !== ie.REFERENCE)
@@ -1837,7 +1840,7 @@ let et = class extends ee {
1837
1840
  } = n;
1838
1841
  if (Z == null || Z.length === 0 || Ie !== Z)
1839
1842
  continue;
1840
- De = k.REF;
1843
+ De = Q.REF;
1841
1844
  } else U !== y.SetDefinedName && (De = Ha(
1842
1845
  Et,
1843
1846
  n,
@@ -1867,7 +1870,7 @@ let et = class extends ee {
1867
1870
  return { newFormulaData: o };
1868
1871
  }
1869
1872
  };
1870
- et = lr([
1873
+ et = sr([
1871
1874
  me(0, Ee),
1872
1875
  me(1, ue),
1873
1876
  me(2, H(pt)),
@@ -1877,9 +1880,9 @@ et = lr([
1877
1880
  me(6, Ce),
1878
1881
  me(7, H(ct))
1879
1882
  ], et);
1880
- const sr = "SHEETS_FORMULA_PLUGIN";
1881
- var dr = Object.getOwnPropertyDescriptor, pr = (a, e, n, i) => {
1882
- for (var r = i > 1 ? void 0 : i ? dr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1883
+ const dr = "SHEETS_FORMULA_PLUGIN";
1884
+ var pr = Object.getOwnPropertyDescriptor, Lr = (a, e, n, i) => {
1885
+ for (var r = i > 1 ? void 0 : i ? pr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1883
1886
  (u = a[o]) && (r = u(r) || r);
1884
1887
  return r;
1885
1888
  }, Ot = (a, e) => (n, i) => e(n, i, a);
@@ -1891,8 +1894,8 @@ let tt = class extends ee {
1891
1894
  this._initialConversion();
1892
1895
  }
1893
1896
  _initialConversion() {
1894
- this._activeDirtyManagerService.register(Q.id, {
1895
- commandId: Q.id,
1897
+ this._activeDirtyManagerService.register(j.id, {
1898
+ commandId: j.id,
1896
1899
  getDirtyData: (a) => {
1897
1900
  const e = a.params;
1898
1901
  return e.trigger === wt.id ? {} : {
@@ -2096,15 +2099,15 @@ let tt = class extends ee {
2096
2099
  return r.push(...this._getDirtyRangesByCellValue(e, n.subUnitId, n.value)), r.push(...this._getDirtyRangesByCellValue(e, i.subUnitId, i.value)), r.push(...this._getDirtyRangesForArrayFormula(e, i.subUnitId, i.value)), r;
2097
2100
  }
2098
2101
  _getMoveRowsMutationDirtyRange(a) {
2099
- const { subUnitId: e, unitId: n, sourceRange: i, targetRange: r } = a, o = [], u = this._rangeToMatrix(i).getData(), f = this._rangeToMatrix(r).getData();
2100
- return o.push(...this._getDirtyRangesByCellValue(n, e, u)), o.push(...this._getDirtyRangesByCellValue(n, e, f)), o.push(...this._getDirtyRangesForArrayFormula(n, e, f)), o;
2102
+ const { subUnitId: e, unitId: n, sourceRange: i, targetRange: r } = a, o = [], u = this._rangeToMatrix(i).getData(), m = this._rangeToMatrix(r).getData();
2103
+ return o.push(...this._getDirtyRangesByCellValue(n, e, u)), o.push(...this._getDirtyRangesByCellValue(n, e, m)), o.push(...this._getDirtyRangesForArrayFormula(n, e, m)), o;
2101
2104
  }
2102
2105
  _getReorderRangeMutationDirtyRange(a) {
2103
2106
  const { unitId: e, subUnitId: n, range: i } = a, r = this._rangeToMatrix(i).getData(), o = [];
2104
2107
  return o.push(...this._getDirtyRangesByCellValue(e, n, r)), o.push(...this._getDirtyRangesForArrayFormula(e, n, r)), o;
2105
2108
  }
2106
2109
  _getRemoveRowOrColumnMutation(a, e = !0) {
2107
- const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i), f = u == null ? void 0 : u.getSheetBySheetId(n), m = (f == null ? void 0 : f.getRowCount()) || 0, c = (f == null ? void 0 : f.getColumnCount()) || 0;
2110
+ const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i), m = u == null ? void 0 : u.getSheetBySheetId(n), f = (m == null ? void 0 : m.getRowCount()) || 0, c = (m == null ? void 0 : m.getColumnCount()) || 0;
2108
2111
  let l = null;
2109
2112
  const { startRow: L, endRow: E, startColumn: p, endColumn: S } = r;
2110
2113
  e === !0 ? l = this._rangeToMatrix({
@@ -2115,7 +2118,7 @@ let tt = class extends ee {
2115
2118
  }) : l = this._rangeToMatrix({
2116
2119
  startRow: 0,
2117
2120
  startColumn: p,
2118
- endRow: m,
2121
+ endRow: f,
2119
2122
  endColumn: S
2120
2123
  });
2121
2124
  const A = l.getData();
@@ -2139,8 +2142,8 @@ let tt = class extends ee {
2139
2142
  _rangeToMatrix(a) {
2140
2143
  const e = new V(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
2141
2144
  for (let u = n; u <= r; u++)
2142
- for (let f = i; f <= o; f++)
2143
- e.setValue(u, f, {});
2145
+ for (let m = i; m <= o; m++)
2146
+ e.setValue(u, m, {});
2144
2147
  return e;
2145
2148
  }
2146
2149
  _getDirtyRangesByCellValue(a, e, n) {
@@ -2154,15 +2157,15 @@ let tt = class extends ee {
2154
2157
  * All other positions, apart from the top-left corner, need to be marked as dirty.
2155
2158
  */
2156
2159
  _getDirtyRangesForArrayFormula(a, e, n) {
2157
- var u, f;
2160
+ var u, m;
2158
2161
  const i = [];
2159
2162
  if (n == null)
2160
2163
  return i;
2161
2164
  const r = new V(n), o = this._formulaDataModel.getArrayFormulaRange();
2162
2165
  if ((u = o == null ? void 0 : o[a]) != null && u[e]) {
2163
- const m = new V((f = o == null ? void 0 : o[a]) == null ? void 0 : f[e]);
2166
+ const f = new V((m = o == null ? void 0 : o[a]) == null ? void 0 : m[e]);
2164
2167
  r.forValue((c, l) => {
2165
- m.forValue((L, E, p) => {
2168
+ f.forValue((L, E, p) => {
2166
2169
  if (p == null)
2167
2170
  return !0;
2168
2171
  const { startRow: S, startColumn: A, endRow: I, endColumn: d } = p;
@@ -2182,13 +2185,13 @@ let tt = class extends ee {
2182
2185
  return i;
2183
2186
  }
2184
2187
  };
2185
- tt = pr([
2188
+ tt = Lr([
2186
2189
  Ot(0, Ua),
2187
2190
  Ot(1, Ee),
2188
2191
  Ot(2, H(ye))
2189
2192
  ], tt);
2190
- var Lr = Object.getOwnPropertyDescriptor, Pr = (a, e, n, i) => {
2191
- for (var r = i > 1 ? void 0 : i ? Lr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2193
+ var Pr = Object.getOwnPropertyDescriptor, Tr = (a, e, n, i) => {
2194
+ for (var r = i > 1 ? void 0 : i ? Pr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2192
2195
  (u = a[o]) && (r = u(r) || r);
2193
2196
  return r;
2194
2197
  }, Le = (a, e) => (n, i) => e(n, i, a);
@@ -2210,7 +2213,7 @@ let at = class extends ee {
2210
2213
  return;
2211
2214
  const { arrayFormulaRange: r, arrayFormulaCellData: o, arrayFormulaEmbedded: u } = i;
2212
2215
  this._formulaDataModel.setArrayFormulaRange(r), this._formulaDataModel.setArrayFormulaCellData(o), e && this._writeArrayFormulaToSnapshot(r, o, u);
2213
- } else a.id === Fn.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2216
+ } else a.id === Bn.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2214
2217
  })
2215
2218
  );
2216
2219
  }
@@ -2240,18 +2243,18 @@ let at = class extends ee {
2240
2243
  if (!o)
2241
2244
  return;
2242
2245
  const u = new V();
2243
- new V(o).forValue((m, c, l) => {
2246
+ new V(o).forValue((f, c, l) => {
2244
2247
  const L = l == null ? void 0 : l.f;
2245
2248
  if ((l == null ? void 0 : l.x) != null || !L || L.length === 0)
2246
2249
  return;
2247
2250
  if (e.has(L)) {
2248
2251
  const p = e.get(L);
2249
- u.setValue(m, c, { xf: p });
2252
+ u.setValue(f, c, { xf: p });
2250
2253
  return;
2251
2254
  }
2252
2255
  const E = this._lexerTreeBuilder.getNewFormulaWithPrefix(L, this._functionService.hasExecutor.bind(this._functionService));
2253
- E && (u.setValue(m, c, { xf: E }), e.set(L, E));
2254
- }), this._commandService.executeCommand(Q.id, {
2256
+ E && (u.setValue(f, c, { xf: E }), e.set(L, E));
2257
+ }), this._commandService.executeCommand(j.id, {
2255
2258
  unitId: n,
2256
2259
  subUnitId: r,
2257
2260
  cellValue: u.getMatrix()
@@ -2265,13 +2268,13 @@ let at = class extends ee {
2265
2268
  _writeArrayFormulaToSnapshot(a, e, n) {
2266
2269
  a && Object.entries(a).forEach(([i, r]) => {
2267
2270
  r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2268
- const f = new V();
2271
+ const m = new V();
2269
2272
  new V(u).forValue((c, l, L) => {
2270
- f.setValue(c, l, { ref: Se(L) });
2271
- }), this._commandService.executeCommand(Q.id, {
2273
+ m.setValue(c, l, { ref: Se(L) });
2274
+ }), this._commandService.executeCommand(j.id, {
2272
2275
  unitId: i,
2273
2276
  subUnitId: o,
2274
- cellValue: f.getMatrix()
2277
+ cellValue: m.getMatrix()
2275
2278
  }, {
2276
2279
  onlyLocal: !0,
2277
2280
  fromFormula: !0
@@ -2279,10 +2282,10 @@ let at = class extends ee {
2279
2282
  });
2280
2283
  }), n && Object.entries(n).forEach(([i, r]) => {
2281
2284
  r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2282
- const f = new V();
2285
+ const m = new V();
2283
2286
  new V(u).forValue((c, l) => {
2284
2287
  var E, p, S;
2285
- (S = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && S[l] || f.setValue(c, l, {
2288
+ (S = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && S[l] || m.setValue(c, l, {
2286
2289
  ref: Se({
2287
2290
  startRow: c,
2288
2291
  endRow: c,
@@ -2290,10 +2293,10 @@ let at = class extends ee {
2290
2293
  endColumn: l
2291
2294
  })
2292
2295
  });
2293
- }), this._commandService.executeCommand(Q.id, {
2296
+ }), this._commandService.executeCommand(j.id, {
2294
2297
  unitId: i,
2295
2298
  subUnitId: o,
2296
- cellValue: f.getMatrix()
2299
+ cellValue: m.getMatrix()
2297
2300
  }, {
2298
2301
  onlyLocal: !0,
2299
2302
  fromFormula: !0
@@ -2301,7 +2304,7 @@ let at = class extends ee {
2301
2304
  });
2302
2305
  }), e && Object.entries(e).forEach(([i, r]) => {
2303
2306
  r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2304
- this._commandService.executeCommand(Q.id, {
2307
+ this._commandService.executeCommand(j.id, {
2305
2308
  unitId: i,
2306
2309
  subUnitId: o,
2307
2310
  cellValue: u
@@ -2320,14 +2323,14 @@ let at = class extends ee {
2320
2323
  handler: (a, e, n) => {
2321
2324
  var l, L, E;
2322
2325
  let i = a;
2323
- const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (L = (l = m == null ? void 0 : m[r]) == null ? void 0 : l[o]) == null ? void 0 : L[u]) == null ? void 0 : E[f];
2324
- return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = xt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === xt.NUMBER && i.v !== void 0 && i.v !== null && rn(i.v) ? (i.v = Bn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2326
+ const { unitId: r, subUnitId: o, row: u, col: m } = e, f = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (L = (l = f == null ? void 0 : f[r]) == null ? void 0 : l[o]) == null ? void 0 : L[u]) == null ? void 0 : E[m];
2327
+ return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = xt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === xt.NUMBER && i.v !== void 0 && i.v !== null && rn(i.v) ? (i.v = vn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2325
2328
  }
2326
2329
  })
2327
2330
  );
2328
2331
  }
2329
2332
  };
2330
- at = Pr([
2333
+ at = Tr([
2331
2334
  Le(0, ue),
2332
2335
  Le(1, Ce),
2333
2336
  Le(2, H(lt)),
@@ -2336,7 +2339,7 @@ at = Pr([
2336
2339
  Le(5, Lt),
2337
2340
  Le(6, dt)
2338
2341
  ], at);
2339
- const Tr = [
2342
+ const Er = [
2340
2343
  {
2341
2344
  functionName: ia.ARRAY_CONSTRAIN,
2342
2345
  functionType: t.Array,
@@ -2388,7 +2391,7 @@ const Tr = [
2388
2391
  }
2389
2392
  ]
2390
2393
  }
2391
- ], Er = [
2394
+ ], Ir = [
2392
2395
  {
2393
2396
  functionName: _.BETADIST,
2394
2397
  functionType: t.Compatibility,
@@ -3442,7 +3445,7 @@ const Tr = [
3442
3445
  }
3443
3446
  ]
3444
3447
  }
3445
- ], Ir = [
3448
+ ], Nr = [
3446
3449
  {
3447
3450
  functionName: de.CUBEKPIMEMBER,
3448
3451
  functionType: t.Cube,
@@ -3597,9 +3600,9 @@ const Tr = [
3597
3600
  }
3598
3601
  ]
3599
3602
  }
3600
- ], Nr = [
3603
+ ], Rr = [
3601
3604
  {
3602
- functionName: j.DAVERAGE,
3605
+ functionName: $.DAVERAGE,
3603
3606
  functionType: t.Database,
3604
3607
  description: "formula.functionList.DAVERAGE.description",
3605
3608
  abstract: "formula.functionList.DAVERAGE.abstract",
@@ -3628,7 +3631,7 @@ const Tr = [
3628
3631
  ]
3629
3632
  },
3630
3633
  {
3631
- functionName: j.DCOUNT,
3634
+ functionName: $.DCOUNT,
3632
3635
  functionType: t.Database,
3633
3636
  description: "formula.functionList.DCOUNT.description",
3634
3637
  abstract: "formula.functionList.DCOUNT.abstract",
@@ -3657,7 +3660,7 @@ const Tr = [
3657
3660
  ]
3658
3661
  },
3659
3662
  {
3660
- functionName: j.DCOUNTA,
3663
+ functionName: $.DCOUNTA,
3661
3664
  functionType: t.Database,
3662
3665
  description: "formula.functionList.DCOUNTA.description",
3663
3666
  abstract: "formula.functionList.DCOUNTA.abstract",
@@ -3686,7 +3689,7 @@ const Tr = [
3686
3689
  ]
3687
3690
  },
3688
3691
  {
3689
- functionName: j.DGET,
3692
+ functionName: $.DGET,
3690
3693
  functionType: t.Database,
3691
3694
  description: "formula.functionList.DGET.description",
3692
3695
  abstract: "formula.functionList.DGET.abstract",
@@ -3715,7 +3718,7 @@ const Tr = [
3715
3718
  ]
3716
3719
  },
3717
3720
  {
3718
- functionName: j.DMAX,
3721
+ functionName: $.DMAX,
3719
3722
  functionType: t.Database,
3720
3723
  description: "formula.functionList.DMAX.description",
3721
3724
  abstract: "formula.functionList.DMAX.abstract",
@@ -3744,7 +3747,7 @@ const Tr = [
3744
3747
  ]
3745
3748
  },
3746
3749
  {
3747
- functionName: j.DMIN,
3750
+ functionName: $.DMIN,
3748
3751
  functionType: t.Database,
3749
3752
  description: "formula.functionList.DMIN.description",
3750
3753
  abstract: "formula.functionList.DMIN.abstract",
@@ -3773,7 +3776,7 @@ const Tr = [
3773
3776
  ]
3774
3777
  },
3775
3778
  {
3776
- functionName: j.DPRODUCT,
3779
+ functionName: $.DPRODUCT,
3777
3780
  functionType: t.Database,
3778
3781
  description: "formula.functionList.DPRODUCT.description",
3779
3782
  abstract: "formula.functionList.DPRODUCT.abstract",
@@ -3802,7 +3805,7 @@ const Tr = [
3802
3805
  ]
3803
3806
  },
3804
3807
  {
3805
- functionName: j.DSTDEV,
3808
+ functionName: $.DSTDEV,
3806
3809
  functionType: t.Database,
3807
3810
  description: "formula.functionList.DSTDEV.description",
3808
3811
  abstract: "formula.functionList.DSTDEV.abstract",
@@ -3831,7 +3834,7 @@ const Tr = [
3831
3834
  ]
3832
3835
  },
3833
3836
  {
3834
- functionName: j.DSTDEVP,
3837
+ functionName: $.DSTDEVP,
3835
3838
  functionType: t.Database,
3836
3839
  description: "formula.functionList.DSTDEVP.description",
3837
3840
  abstract: "formula.functionList.DSTDEVP.abstract",
@@ -3860,7 +3863,7 @@ const Tr = [
3860
3863
  ]
3861
3864
  },
3862
3865
  {
3863
- functionName: j.DSUM,
3866
+ functionName: $.DSUM,
3864
3867
  functionType: t.Database,
3865
3868
  description: "formula.functionList.DSUM.description",
3866
3869
  abstract: "formula.functionList.DSUM.abstract",
@@ -3889,7 +3892,7 @@ const Tr = [
3889
3892
  ]
3890
3893
  },
3891
3894
  {
3892
- functionName: j.DVAR,
3895
+ functionName: $.DVAR,
3893
3896
  functionType: t.Database,
3894
3897
  description: "formula.functionList.DVAR.description",
3895
3898
  abstract: "formula.functionList.DVAR.abstract",
@@ -3918,7 +3921,7 @@ const Tr = [
3918
3921
  ]
3919
3922
  },
3920
3923
  {
3921
- functionName: j.DVARP,
3924
+ functionName: $.DVARP,
3922
3925
  functionType: t.Database,
3923
3926
  description: "formula.functionList.DVARP.description",
3924
3927
  abstract: "formula.functionList.DVARP.abstract",
@@ -3946,7 +3949,7 @@ const Tr = [
3946
3949
  }
3947
3950
  ]
3948
3951
  }
3949
- ], Rr = [
3952
+ ], Sr = [
3950
3953
  {
3951
3954
  functionName: v.DATE,
3952
3955
  functionType: t.Date,
@@ -4518,7 +4521,7 @@ const Tr = [
4518
4521
  }
4519
4522
  ]
4520
4523
  }
4521
- ], Sr = [
4524
+ ], Ar = [
4522
4525
  {
4523
4526
  functionName: C.BESSELI,
4524
4527
  functionType: t.Engineering,
@@ -5591,7 +5594,7 @@ const Tr = [
5591
5594
  }
5592
5595
  ]
5593
5596
  }
5594
- ], Ar = [
5597
+ ], Cr = [
5595
5598
  {
5596
5599
  functionName: D.ACCRINT,
5597
5600
  functionType: t.Financial,
@@ -7852,7 +7855,7 @@ const Tr = [
7852
7855
  }
7853
7856
  ]
7854
7857
  }
7855
- ], Cr = [
7858
+ ], Dr = [
7856
7859
  {
7857
7860
  functionName: G.CELL,
7858
7861
  functionType: t.Information,
@@ -8261,7 +8264,7 @@ const Tr = [
8261
8264
  }
8262
8265
  ]
8263
8266
  }
8264
- ], Dr = [
8267
+ ], br = [
8265
8268
  {
8266
8269
  functionName: W.AND,
8267
8270
  functionType: t.Logical,
@@ -8735,7 +8738,7 @@ const Tr = [
8735
8738
  }
8736
8739
  ]
8737
8740
  }
8738
- ], br = [
8741
+ ], Or = [
8739
8742
  {
8740
8743
  functionName: g.ADDRESS,
8741
8744
  functionType: t.Lookup,
@@ -9788,7 +9791,7 @@ const Tr = [
9788
9791
  }
9789
9792
  ]
9790
9793
  }
9791
- ], Or = [
9794
+ ], Mr = [
9792
9795
  {
9793
9796
  functionName: T.ABS,
9794
9797
  functionType: t.Math,
@@ -11440,7 +11443,7 @@ const Tr = [
11440
11443
  }
11441
11444
  ]
11442
11445
  }
11443
- ], Mr = [
11446
+ ], xr = [
11444
11447
  {
11445
11448
  functionName: s.AVEDEV,
11446
11449
  functionType: t.Statistical,
@@ -14382,7 +14385,7 @@ const Tr = [
14382
14385
  }
14383
14386
  ]
14384
14387
  }
14385
- ], xr = [
14388
+ ], _r = [
14386
14389
  {
14387
14390
  functionName: b.ASC,
14388
14391
  functionType: t.Text,
@@ -15596,7 +15599,7 @@ const Tr = [
15596
15599
  }
15597
15600
  ]
15598
15601
  }
15599
- ], _r = [], yr = [
15602
+ ], yr = [], gr = [
15600
15603
  {
15601
15604
  functionName: Rt.ENCODEURL,
15602
15605
  functionType: t.Web,
@@ -15656,29 +15659,29 @@ const Tr = [
15656
15659
  }
15657
15660
  ]
15658
15661
  }
15659
- ], gr = [
15660
- ...Ar,
15661
- ...Rr,
15662
- ...Or,
15662
+ ], qr = [
15663
+ ...Cr,
15664
+ ...Sr,
15663
15665
  ...Mr,
15664
- ...br,
15665
- ...Nr,
15666
15666
  ...xr,
15667
+ ...Or,
15668
+ ...Rr,
15669
+ ..._r,
15670
+ ...br,
15667
15671
  ...Dr,
15668
- ...Cr,
15669
- ...Sr,
15672
+ ...Ar,
15673
+ ...Nr,
15670
15674
  ...Ir,
15675
+ ...gr,
15671
15676
  ...Er,
15672
- ...yr,
15673
- ...Tr,
15674
- ..._r
15677
+ ...yr
15675
15678
  ];
15676
- function qr(a, e) {
15679
+ function hr(a, e) {
15677
15680
  let n = "";
15678
15681
  return a.aliasFunctionName ? (n = e.t(a.aliasFunctionName), n === a.aliasFunctionName && (n = a.functionName)) : n = a.functionName, n;
15679
15682
  }
15680
- var hr = Object.getOwnPropertyDescriptor, Ur = (a, e, n, i) => {
15681
- for (var r = i > 1 ? void 0 : i ? hr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15683
+ var Ur = Object.getOwnPropertyDescriptor, Fr = (a, e, n, i) => {
15684
+ for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15682
15685
  (u = a[o]) && (r = u(r) || r);
15683
15686
  return r;
15684
15687
  }, Mt = (a, e) => (n, i) => e(n, i, a);
@@ -15703,15 +15706,15 @@ let Bt = class {
15703
15706
  getSearchListByName(a) {
15704
15707
  const e = [], n = this._functionService.getDescriptions(), i = a.toLocaleUpperCase().trim();
15705
15708
  return n.forEach((r) => {
15706
- const { functionName: o, abstract: u, functionType: f } = r;
15707
- o.toLocaleUpperCase().indexOf(i) > -1 && f !== t.DefinedName && e.push({ name: o, desc: u });
15709
+ const { functionName: o, abstract: u, functionType: m } = r;
15710
+ o.toLocaleUpperCase().indexOf(i) > -1 && m !== t.DefinedName && e.push({ name: o, desc: u });
15708
15711
  }), e;
15709
15712
  }
15710
15713
  getSearchListByNameFirstLetter(a) {
15711
15714
  const e = [], n = this._functionService.getDescriptions(), i = a.toLocaleUpperCase().trim();
15712
15715
  return n.forEach((r) => {
15713
- const { functionName: o, abstract: u, functionType: f } = r;
15714
- o.toLocaleUpperCase().indexOf(i) === 0 && e.push({ name: o, desc: u, functionType: f });
15716
+ const { functionName: o, abstract: u, functionType: m } = r;
15717
+ o.toLocaleUpperCase().indexOf(i) === 0 && e.push({ name: o, desc: u, functionType: m });
15715
15718
  }), e;
15716
15719
  }
15717
15720
  getSearchListByType(a) {
@@ -15741,7 +15744,7 @@ let Bt = class {
15741
15744
  if (e.length === 0)
15742
15745
  return !1;
15743
15746
  const n = e[0].description;
15744
- return !vn(n);
15747
+ return !Vn(n);
15745
15748
  }
15746
15749
  _initialize() {
15747
15750
  this._localeService.localeChanged$.subscribe(() => {
@@ -15751,7 +15754,6 @@ let Bt = class {
15751
15754
  _initDescription() {
15752
15755
  var i;
15753
15756
  const a = [
15754
- ...Vn,
15755
15757
  ...Gn,
15756
15758
  ...Hn,
15757
15759
  ...wn,
@@ -15766,13 +15768,14 @@ let Bt = class {
15766
15768
  ...zn,
15767
15769
  ...Zn,
15768
15770
  ...Jn,
15769
- ...ei
15770
- ].map((r) => r[1]), e = gr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ge);
15771
+ ...ei,
15772
+ ...ti
15773
+ ].map((r) => r[1]), e = qr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ge);
15771
15774
  this._descriptions = e.concat((i = n == null ? void 0 : n.description) != null ? i : []);
15772
15775
  }
15773
15776
  _registerDescriptions() {
15774
15777
  const a = this._localeService, e = this._descriptions.map((n) => ({
15775
- functionName: qr(n, a),
15778
+ functionName: hr(n, a),
15776
15779
  functionType: n.functionType,
15777
15780
  description: a.t(n.description),
15778
15781
  abstract: a.t(n.abstract),
@@ -15787,13 +15790,13 @@ let Bt = class {
15787
15790
  this._functionService.registerDescriptions(...e);
15788
15791
  }
15789
15792
  };
15790
- Bt = Ur([
15793
+ Bt = Fr([
15791
15794
  Mt(0, Lt),
15792
15795
  Mt(1, H(Gt)),
15793
15796
  Mt(2, Ce)
15794
15797
  ], Bt);
15795
- var Fr = Object.getOwnPropertyDescriptor, Br = (a, e, n, i) => {
15796
- for (var r = i > 1 ? void 0 : i ? Fr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15798
+ var Br = Object.getOwnPropertyDescriptor, vr = (a, e, n, i) => {
15799
+ for (var r = i > 1 ? void 0 : i ? Br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15797
15800
  (u = a[o]) && (r = u(r) || r);
15798
15801
  return r;
15799
15802
  }, Ge = (a, e) => (n, i) => e(n, i, a);
@@ -15815,8 +15818,8 @@ let nt = class extends ee {
15815
15818
  }
15816
15819
  _changeUnitListener() {
15817
15820
  J(
15818
- this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).subscribe(() => {
15819
- this._unRegisterDescriptions(), this._registerDescriptions();
15821
+ this._univerInstanceService.getCurrentTypeOfUnit$(k.UNIVER_SHEET).subscribe((e) => {
15822
+ this._unRegisterDescriptions(), e && this._registerDescriptions();
15820
15823
  })
15821
15824
  );
15822
15825
  }
@@ -15838,11 +15841,10 @@ let nt = class extends ee {
15838
15841
  );
15839
15842
  }
15840
15843
  _registerDescription(e) {
15841
- const { unitId: n, sheetId: i } = this._getUnitIdAndSheetId();
15842
- if (n == null || i == null)
15843
- return;
15844
- const { name: r, comment: o, formulaOrRefString: u, localSheetId: f } = e;
15845
- !this._descriptionService.hasDescription(r) && (f == null || f === Nt || f === i) && this._descriptionService.registerDescriptions([{
15844
+ const n = this._getUnitIdAndSheetId(e);
15845
+ if (!n) return;
15846
+ const { sheetId: i } = n, { name: r, comment: o, formulaOrRefString: u, localSheetId: m } = e;
15847
+ !this._descriptionService.hasDescription(r) && (m == null || m === Nt || m === i) && this._descriptionService.registerDescriptions([{
15846
15848
  functionName: r,
15847
15849
  description: u + (o || ""),
15848
15850
  abstract: u,
@@ -15866,74 +15868,71 @@ let nt = class extends ee {
15866
15868
  n.push(r);
15867
15869
  }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
15868
15870
  }
15869
- _getUnitIdAndSheetId() {
15870
- const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
15871
- if (e == null)
15872
- return {};
15873
- const n = e.getActiveSheet();
15874
- return n == null ? {} : {
15875
- unitId: e.getUnitId(),
15876
- sheetId: n.getSheetId()
15877
- };
15871
+ _getUnitIdAndSheetId(e = {}) {
15872
+ const { unitId: n, subUnitId: i } = e, r = n ? this._univerInstanceService.getUnit(n, k.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(k.UNIVER_SHEET);
15873
+ if (!r) return null;
15874
+ const o = i ? r.getSheetBySheetId(i) : r.getActiveSheet(!0);
15875
+ return o ? {
15876
+ unitId: r.getUnitId(),
15877
+ sheetId: o.getSheetId()
15878
+ } : null;
15878
15879
  }
15879
15880
  _registerDescriptions() {
15880
- const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
15881
- if (e == null || n == null)
15881
+ const e = this._getUnitIdAndSheetId();
15882
+ if (!e) return;
15883
+ const { unitId: n, sheetId: i } = e, r = this._definedNamesService.getDefinedNameMap(n);
15884
+ if (!r)
15882
15885
  return;
15883
- const i = this._definedNamesService.getDefinedNameMap(e);
15884
- if (!i)
15885
- return;
15886
- const r = [];
15887
- this._preUnitId = e, Array.from(Object.values(i)).forEach((o) => {
15888
- const { name: u, comment: f, formulaOrRefString: m, localSheetId: c } = o;
15889
- !this._descriptionService.hasDescription(u) && (c == null || c === Nt || c === n) && r.push({
15890
- functionName: u,
15891
- description: m + (f || ""),
15892
- abstract: m,
15886
+ const o = [];
15887
+ this._preUnitId = n, Array.from(Object.values(r)).forEach((u) => {
15888
+ const { name: m, comment: f, formulaOrRefString: c, localSheetId: l } = u;
15889
+ !this._descriptionService.hasDescription(m) && (l == null || l === Nt || l === i) && o.push({
15890
+ functionName: m,
15891
+ description: c + (f || ""),
15892
+ abstract: c,
15893
15893
  functionType: t.DefinedName,
15894
15894
  functionParameter: []
15895
15895
  });
15896
- }), this._descriptionService.registerDescriptions(r);
15896
+ }), this._descriptionService.registerDescriptions(o);
15897
15897
  }
15898
15898
  _unregisterDescriptionsForNotInSheetId() {
15899
- const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
15900
- if (e == null || n == null)
15901
- return;
15902
- const i = this._definedNamesService.getDefinedNameMap(e);
15903
- if (!i)
15899
+ const e = this._getUnitIdAndSheetId();
15900
+ if (!e) return;
15901
+ const { unitId: n, sheetId: i } = e, r = this._definedNamesService.getDefinedNameMap(n);
15902
+ if (!r)
15904
15903
  return;
15905
- const r = [];
15906
- Array.from(Object.values(i)).forEach((o) => {
15907
- const { name: u, localSheetId: f } = o;
15908
- f !== Nt && f !== n && r.push(u);
15909
- }), this._descriptionService.unregisterDescriptions(r);
15904
+ const o = [];
15905
+ Array.from(Object.values(r)).forEach((u) => {
15906
+ const { name: m, localSheetId: f } = u;
15907
+ f !== Nt && f !== i && o.push(m);
15908
+ }), this._descriptionService.unregisterDescriptions(o);
15910
15909
  }
15911
15910
  };
15912
- nt = Br([
15911
+ nt = vr([
15913
15912
  Ge(0, Pt),
15914
15913
  Ge(1, dt),
15915
15914
  Ge(2, Ee),
15916
15915
  Ge(3, ue)
15917
15916
  ], nt);
15918
- var vr = Object.getOwnPropertyDescriptor, Vr = (a, e, n, i) => {
15919
- for (var r = i > 1 ? void 0 : i ? vr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15917
+ var Vr = Object.getOwnPropertyDescriptor, Gr = (a, e, n, i) => {
15918
+ for (var r = i > 1 ? void 0 : i ? Vr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15920
15919
  (u = a[o]) && (r = u(r) || r);
15921
15920
  return r;
15922
- }, Gr = (a, e) => (n, i) => e(n, i, a);
15921
+ }, Hr = (a, e) => (n, i) => e(n, i, a);
15923
15922
  let it = class extends ee {
15924
15923
  constructor(a) {
15925
15924
  super(), this._commandService = a, [
15926
- Pi,
15927
15925
  Ti,
15928
- ti
15926
+ Ei,
15927
+ ai
15929
15928
  ].forEach((e) => this._commandService.registerCommand(e));
15930
15929
  }
15931
15930
  };
15932
- it = Vr([
15933
- Gr(0, ue)
15931
+ it = Gr([
15932
+ Hr(0, ue)
15934
15933
  ], it);
15935
- var Hr = Object.getOwnPropertyDescriptor, wr = (a, e, n, i) => {
15936
- for (var r = i > 1 ? void 0 : i ? Hr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15934
+ var wr = Object.getOwnPropertyDescriptor, Yr = (a, e, n, i) => {
15935
+ for (var r = i > 1 ? void 0 : i ? wr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15937
15936
  (u = a[o]) && (r = u(r) || r);
15938
15937
  return r;
15939
15938
  }, He = (a, e) => (n, i) => e(n, i, a);
@@ -15955,8 +15954,8 @@ let rt = class extends ee {
15955
15954
  }
15956
15955
  _changeUnitListener() {
15957
15956
  J(
15958
- this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).subscribe(() => {
15959
- this._unRegisterDescriptions(), this._registerDescriptions();
15957
+ this._univerInstanceService.getCurrentTypeOfUnit$(k.UNIVER_SHEET).subscribe((e) => {
15958
+ this._unRegisterDescriptions(), e && this._registerDescriptions();
15960
15959
  })
15961
15960
  );
15962
15961
  }
@@ -15966,10 +15965,10 @@ let rt = class extends ee {
15966
15965
  if (!(n != null && n.fromCollab)) {
15967
15966
  if (e.id === ha.id)
15968
15967
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15969
- else if (e.id === ai.id) {
15968
+ else if (e.id === ni.id) {
15970
15969
  const i = e.params;
15971
15970
  this._registerDescription(i);
15972
- } else if (e.id === ni.id) {
15971
+ } else if (e.id === ii.id) {
15973
15972
  const i = e.params;
15974
15973
  this._unregisterDescription(i);
15975
15974
  }
@@ -15978,13 +15977,12 @@ let rt = class extends ee {
15978
15977
  );
15979
15978
  }
15980
15979
  _registerDescription(e) {
15981
- var u, f;
15982
- const { unitId: n, sheetId: i } = this._getUnitIdAndSheetId();
15983
- if (n == null || i == null)
15984
- return;
15985
- const { tableName: r, reference: o } = e;
15980
+ var u, m;
15981
+ const n = this._getUnitIdAndSheetId(e);
15982
+ if (!n) return;
15983
+ const { unitId: i } = n, { tableName: r, reference: o } = e;
15986
15984
  if (!this._descriptionService.hasDescription(r)) {
15987
- const m = ((f = (u = this._univerInstanceService.getUnit(n)) == null ? void 0 : u.getSheetBySheetId(o.sheetId)) == null ? void 0 : f.getName()) || "", c = ze(m, o.range);
15985
+ const f = ((m = (u = this._univerInstanceService.getUnit(i)) == null ? void 0 : u.getSheetBySheetId(o.sheetId)) == null ? void 0 : m.getName()) || "", c = ze(f, o.range);
15988
15986
  this._descriptionService.registerDescriptions([{
15989
15987
  functionName: r,
15990
15988
  description: c,
@@ -16009,41 +16007,38 @@ let rt = class extends ee {
16009
16007
  n.push(r);
16010
16008
  }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
16011
16009
  }
16012
- _getUnitIdAndSheetId() {
16013
- const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
16014
- if (e == null)
16015
- return {};
16016
- const n = e.getActiveSheet();
16017
- return n == null ? {} : {
16018
- unitId: e.getUnitId(),
16019
- sheetId: n.getSheetId()
16020
- };
16010
+ _getUnitIdAndSheetId(e = {}) {
16011
+ const { unitId: n, subUnitId: i } = e, r = n ? this._univerInstanceService.getUnit(n, k.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(k.UNIVER_SHEET);
16012
+ if (!r) return null;
16013
+ const o = i ? r.getSheetBySheetId(i) : r.getActiveSheet(!0);
16014
+ return o ? {
16015
+ unitId: r.getUnitId(),
16016
+ sheetId: o.getSheetId()
16017
+ } : null;
16021
16018
  }
16022
16019
  _registerDescriptions() {
16023
- const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
16024
- if (e == null || n == null)
16025
- return;
16026
- const i = this._superTableService.getTableMap(e);
16020
+ const e = this._getUnitIdAndSheetId();
16021
+ if (!e) return;
16022
+ const { unitId: n } = e, i = this._superTableService.getTableMap(n);
16027
16023
  if (!i)
16028
16024
  return;
16029
16025
  const r = [];
16030
- this._preUnitId = e, i.forEach((o, u) => {
16026
+ this._preUnitId = n, i.forEach((o, u) => {
16031
16027
  var c, l;
16032
- const f = ((l = (c = this._univerInstanceService.getUnit(e)) == null ? void 0 : c.getSheetBySheetId(o.sheetId)) == null ? void 0 : l.getName()) || "", m = ze(f, o.range);
16028
+ const m = ((l = (c = this._univerInstanceService.getUnit(n)) == null ? void 0 : c.getSheetBySheetId(o.sheetId)) == null ? void 0 : l.getName()) || "", f = ze(m, o.range);
16033
16029
  this._descriptionService.hasDescription(u) || r.push({
16034
16030
  functionName: u,
16035
- description: m,
16036
- abstract: m,
16031
+ description: f,
16032
+ abstract: f,
16037
16033
  functionType: t.Table,
16038
16034
  functionParameter: []
16039
16035
  });
16040
16036
  }), this._descriptionService.registerDescriptions(r);
16041
16037
  }
16042
16038
  _unregisterDescriptionsForNotInSheetId() {
16043
- const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
16044
- if (e == null || n == null)
16045
- return;
16046
- const i = this._superTableService.getTableMap(e);
16039
+ const e = this._getUnitIdAndSheetId();
16040
+ if (!e) return;
16041
+ const { unitId: n } = e, i = this._superTableService.getTableMap(n);
16047
16042
  if (!i)
16048
16043
  return;
16049
16044
  const r = [];
@@ -16052,14 +16047,14 @@ let rt = class extends ee {
16052
16047
  }), this._descriptionService.unregisterDescriptions(r);
16053
16048
  }
16054
16049
  };
16055
- rt = wr([
16050
+ rt = Yr([
16056
16051
  He(0, Pt),
16057
16052
  He(1, Ee),
16058
16053
  He(2, ue),
16059
- He(3, ii)
16054
+ He(3, ri)
16060
16055
  ], rt);
16061
- var Yr = Object.getOwnPropertyDescriptor, Xr = (a, e, n, i) => {
16062
- for (var r = i > 1 ? void 0 : i ? Yr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16056
+ var Xr = Object.getOwnPropertyDescriptor, Wr = (a, e, n, i) => {
16057
+ for (var r = i > 1 ? void 0 : i ? Xr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16063
16058
  (u = a[o]) && (r = u(r) || r);
16064
16059
  return r;
16065
16060
  }, we = (a, e) => (n, i) => e(n, i, a);
@@ -16068,11 +16063,11 @@ function fa(a, e, n, i) {
16068
16063
  if (r == null)
16069
16064
  return e;
16070
16065
  const o = [];
16071
- for (let u = 0, f = r.length; u < f; u++) {
16072
- const m = r[u];
16073
- if (typeof m == "string" || m.nodeType !== ie.REFERENCE)
16066
+ for (let u = 0, m = r.length; u < m; u++) {
16067
+ const f = r[u];
16068
+ if (typeof f == "string" || f.nodeType !== ie.REFERENCE)
16074
16069
  continue;
16075
- const { token: c } = m, l = Pe(c), { sheetName: L, unitId: E } = l;
16070
+ const { token: c } = f, l = Pe(c), { sheetName: L, unitId: E } = l;
16076
16071
  let p = l.range;
16077
16072
  p.startAbsoluteRefType === Qe.ALL && p.endAbsoluteRefType === Qe.ALL || (p = yt(p, n, i), o.push({
16078
16073
  unitId: E,
@@ -16087,13 +16082,13 @@ let vt = class extends ee {
16087
16082
  super(), this._refRangeService = a, this._lexerTreeBuilder = e, this._univerInstanceService = n, this._injector = i;
16088
16083
  }
16089
16084
  transformFormulaByEffectCommand(a, e, n, i) {
16090
- const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((l) => {
16085
+ const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET), u = o.getActiveSheet(), m = o.getUnitId(), f = u.getSheetId(), c = r == null ? void 0 : r.map((l) => {
16091
16086
  if (typeof l == "object" && l.nodeType === ie.REFERENCE) {
16092
16087
  const L = Pe(l.token), { range: E, unitId: p, sheetName: S } = L, A = this._univerInstanceService.getUnit(p || a), I = S ? A == null ? void 0 : A.getSheetBySheetName(S) : A == null ? void 0 : A.getSheetBySheetId(e);
16093
16088
  if (!I)
16094
16089
  throw new Error("Sheet not found");
16095
16090
  const d = A.getUnitId(), R = I.getSheetId();
16096
- if (d !== f || R !== m)
16091
+ if (d !== m || R !== f)
16097
16092
  return l;
16098
16093
  const N = ta(E, i);
16099
16094
  let P = "";
@@ -16101,7 +16096,7 @@ let vt = class extends ee {
16101
16096
  const q = N.startColumn - E.startColumn, M = N.startRow - E.startRow, U = yt(E, q, M);
16102
16097
  p && S ? P = ra(p, S, U) : S ? P = ze(S, U) : P = Se(U);
16103
16098
  } else
16104
- P = k.REF;
16099
+ P = Q.REF;
16105
16100
  return {
16106
16101
  ...l,
16107
16102
  token: P
@@ -16112,19 +16107,19 @@ let vt = class extends ee {
16112
16107
  return c ? `=${$e(c)}` : "";
16113
16108
  }
16114
16109
  registerFormula(a, e, n, i) {
16115
- const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(), f = (m) => {
16116
- const c = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), l = c.getActiveSheet(), L = c.getUnitId(), E = l.getSheetId(), p = o == null ? void 0 : o.map((A) => {
16110
+ const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(), m = (f) => {
16111
+ const c = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET), l = c.getActiveSheet(), L = c.getUnitId(), E = l.getSheetId(), p = o == null ? void 0 : o.map((A) => {
16117
16112
  if (typeof A == "object" && A.nodeType === ie.REFERENCE) {
16118
16113
  const I = r.get(A.token);
16119
16114
  if (I.unitId !== L || I.subUnitId !== E)
16120
16115
  return A;
16121
- const d = ta(I.range, m);
16116
+ const d = ta(I.range, f);
16122
16117
  let R = "";
16123
16118
  if (d) {
16124
16119
  const N = d.startColumn - I.range.startColumn, P = d.startRow - I.range.startRow, q = yt(I.range, N, P);
16125
16120
  I.unitId && I.sheetName ? R = ra(I.unitId, I.sheetName, q) : I.sheetName ? R = ze(I.sheetName, q) : R = Se(q);
16126
16121
  } else
16127
- R = k.REF;
16122
+ R = Q.REF;
16128
16123
  return {
16129
16124
  ...A,
16130
16125
  token: R
@@ -16134,9 +16129,9 @@ let vt = class extends ee {
16134
16129
  }), S = p && $e(p);
16135
16130
  return i(`=${S}`);
16136
16131
  };
16137
- return o == null || o.forEach((m) => {
16138
- if (typeof m == "object" && m.nodeType === ie.REFERENCE) {
16139
- const c = Pe(m.token), { range: l, unitId: L, sheetName: E } = c, p = this._univerInstanceService.getUnit(L || a), S = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
16132
+ return o == null || o.forEach((f) => {
16133
+ if (typeof f == "object" && f.nodeType === ie.REFERENCE) {
16134
+ const c = Pe(f.token), { range: l, unitId: L, sheetName: E } = c, p = this._univerInstanceService.getUnit(L || a), S = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
16140
16135
  if (!S)
16141
16136
  return;
16142
16137
  const A = p.getUnitId(), I = S.getSheetId(), d = {
@@ -16145,7 +16140,7 @@ let vt = class extends ee {
16145
16140
  range: l,
16146
16141
  sheetName: E
16147
16142
  };
16148
- r.set(m.token, d), u.add(this._refRangeService.registerRefRange(l, f, A, I));
16143
+ r.set(f.token, d), u.add(this._refRangeService.registerRefRange(l, m, A, I));
16149
16144
  }
16150
16145
  }), u;
16151
16146
  }
@@ -16153,13 +16148,13 @@ let vt = class extends ee {
16153
16148
  const r = Me(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
16154
16149
  return r == null || r.forEach((u) => {
16155
16150
  if (typeof u == "object" && u.nodeType === ie.REFERENCE) {
16156
- const f = Pe(u.token), { range: m, unitId: c, sheetName: l } = f;
16157
- if (m.startAbsoluteRefType === Qe.ALL && m.endAbsoluteRefType === Qe.ALL)
16151
+ const m = Pe(u.token), { range: f, unitId: c, sheetName: l } = m;
16152
+ if (f.startAbsoluteRefType === Qe.ALL && f.endAbsoluteRefType === Qe.ALL)
16158
16153
  return;
16159
16154
  const L = this._univerInstanceService.getUnit(c || a), E = l ? L == null ? void 0 : L.getSheetBySheetName(l) : L == null ? void 0 : L.getSheetBySheetId(e);
16160
16155
  if (!E)
16161
16156
  return;
16162
- const p = L.getUnitId(), S = E.getSheetId(), A = i[0].startRow, I = i[0].startColumn, d = m.startRow, R = m.startColumn, N = i.map((P) => ({
16157
+ const p = L.getUnitId(), S = E.getSheetId(), A = i[0].startRow, I = i[0].startColumn, d = f.startRow, R = f.startColumn, N = i.map((P) => ({
16163
16158
  startRow: P.startRow - A + d,
16164
16159
  endRow: P.endRow - A + d,
16165
16160
  startColumn: P.startColumn - I + R,
@@ -16175,8 +16170,8 @@ let vt = class extends ee {
16175
16170
  }
16176
16171
  // eslint-disable-next-line max-lines-per-function
16177
16172
  registerRangeFormula(a, e, n, i, r) {
16178
- const o = new ke(), u = i.map((m) => this._getFormulaDependcy(a, e, m, n)), f = (m) => {
16179
- const c = n[0].startRow, l = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = On(this._injector, m);
16173
+ const o = new ke(), u = i.map((f) => this._getFormulaDependcy(a, e, f, n)), m = (f) => {
16174
+ const c = n[0].startRow, l = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Mn(this._injector, f);
16180
16175
  for (const { unitId: S, subUnitId: A, ranges: I } of L)
16181
16176
  if (S === p.unitId && A === p.subUnitId) {
16182
16177
  const d = [], R = I[0].startRow, N = I[0].startColumn, P = R - c, q = N - l;
@@ -16198,12 +16193,12 @@ let vt = class extends ee {
16198
16193
  A.sort((P, q) => P.startRow - q.startRow || P.startColumn - q.startColumn);
16199
16194
  const I = /* @__PURE__ */ new Map();
16200
16195
  for (let P = 0; P < S.length; P++) {
16201
- const q = S[P], M = q.startRow, U = q.startColumn, h = M - c, x = U - l, F = Mn(q, m).sort((z, re) => z.startRow - re.startRow || z.startColumn - re.startColumn);
16196
+ const q = S[P], M = q.startRow, U = q.startColumn, h = M - c, x = U - l, F = xn(q, f).sort((z, re) => z.startRow - re.startRow || z.startColumn - re.startColumn);
16202
16197
  if (!F.length)
16203
16198
  continue;
16204
16199
  const B = F[0].startRow, ae = F[0].startColumn, O = B - c, ce = ae - l, ne = [];
16205
16200
  for (let z = 0; z < i.length; z++) {
16206
- const re = i[z], oe = Me(re), qe = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, x, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, qe, m) : qe, Et = fa(this._lexerTreeBuilder, Z, -ce, -O);
16201
+ const re = i[z], oe = Me(re), qe = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, x, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, qe, f) : qe, Et = fa(this._lexerTreeBuilder, Z, -ce, -O);
16207
16202
  ne.push({
16208
16203
  newFormula: Z,
16209
16204
  orginFormula: Et
@@ -16251,62 +16246,62 @@ let vt = class extends ee {
16251
16246
  redos: []
16252
16247
  };
16253
16248
  };
16254
- return n.forEach((m) => {
16255
- const c = this._refRangeService.registerRefRange(m, f, a, e);
16249
+ return n.forEach((f) => {
16250
+ const c = this._refRangeService.registerRefRange(f, m, a, e);
16256
16251
  o.add(c);
16257
- }), [...u.flat()].forEach(({ unitId: m, subUnitId: c, ranges: l }) => {
16252
+ }), [...u.flat()].forEach(({ unitId: f, subUnitId: c, ranges: l }) => {
16258
16253
  l.forEach((L) => {
16259
- const E = this._refRangeService.registerRefRange(L, f, m, c);
16254
+ const E = this._refRangeService.registerRefRange(L, m, f, c);
16260
16255
  o.add(E);
16261
16256
  });
16262
16257
  }), o;
16263
16258
  }
16264
16259
  };
16265
- vt = Xr([
16266
- we(0, H(bn)),
16260
+ vt = Wr([
16261
+ we(0, H(On)),
16267
16262
  we(1, H(pt)),
16268
16263
  we(2, Ee),
16269
16264
  we(3, H(ct))
16270
16265
  ], vt);
16271
- var Wr = Object.getOwnPropertyDescriptor, Kr = (a, e, n, i) => {
16272
- for (var r = i > 1 ? void 0 : i ? Wr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16266
+ var Kr = Object.getOwnPropertyDescriptor, kr = (a, e, n, i) => {
16267
+ for (var r = i > 1 ? void 0 : i ? Kr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16273
16268
  (u = a[o]) && (r = u(r) || r);
16274
16269
  return r;
16275
- }, kr = (a, e) => (n, i) => e(n, i, a);
16270
+ }, Qr = (a, e) => (n, i) => e(n, i, a);
16276
16271
  const Yt = "sheets-formula.remote-register-function.service", Ya = Ht(Yt);
16277
16272
  let ot = class {
16278
16273
  constructor(a) {
16279
16274
  this._functionService = a;
16280
16275
  }
16281
16276
  async registerFunctions(a) {
16282
- const e = a.map(([n, i]) => Qr(n, i));
16277
+ const e = a.map(([n, i]) => jr(n, i));
16283
16278
  this._functionService.registerExecutors(...e);
16284
16279
  }
16285
16280
  async registerAsyncFunctions(a) {
16286
- const e = a.map(([n, i]) => jr(n, i));
16281
+ const e = a.map(([n, i]) => $r(n, i));
16287
16282
  this._functionService.registerExecutors(...e);
16288
16283
  }
16289
16284
  async unregisterFunctions(a) {
16290
16285
  this._functionService.unregisterExecutors(...a), this._functionService.unregisterDescriptions(...a), this._functionService.deleteFormulaAstCacheKey(...a);
16291
16286
  }
16292
16287
  };
16293
- ot = Kr([
16294
- kr(0, Lt)
16288
+ ot = kr([
16289
+ Qr(0, Lt)
16295
16290
  ], ot);
16296
- function Qr(a, e) {
16291
+ function jr(a, e) {
16297
16292
  const n = new Ft(e), i = new Function(`return ${a}`)();
16298
16293
  return n.calculateCustom = i, n;
16299
16294
  }
16300
- function jr(a, e) {
16295
+ function $r(a, e) {
16301
16296
  const n = new Fa(e), i = new Function(`return ${a}`)();
16302
16297
  return n.calculateCustom = i, n;
16303
16298
  }
16304
- var $r = Object.getOwnPropertyDescriptor, zr = (a, e, n, i) => {
16305
- for (var r = i > 1 ? void 0 : i ? $r(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16299
+ var zr = Object.getOwnPropertyDescriptor, Zr = (a, e, n, i) => {
16300
+ for (var r = i > 1 ? void 0 : i ? zr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16306
16301
  (u = a[o]) && (r = u(r) || r);
16307
16302
  return r;
16308
16303
  }, Ye = (a, e) => (n, i) => e(n, i, a);
16309
- const Zr = Ht(
16304
+ const Jr = Ht(
16310
16305
  "sheets-formula.register-function-service"
16311
16306
  );
16312
16307
  let Vt = class extends ee {
@@ -16326,11 +16321,11 @@ let Vt = class extends ee {
16326
16321
  if (n)
16327
16322
  r.add(this._descriptionService.registerDescriptions(n));
16328
16323
  else {
16329
- const o = i.map(([u, f, m]) => ({
16330
- functionName: f,
16324
+ const o = i.map(([u, m, f]) => ({
16325
+ functionName: m,
16331
16326
  functionType: t.User,
16332
16327
  description: "",
16333
- abstract: m || "",
16328
+ abstract: f || "",
16334
16329
  functionParameter: []
16335
16330
  }));
16336
16331
  r.add(this._functionService.registerDescriptions(...o));
@@ -16340,18 +16335,18 @@ let Vt = class extends ee {
16340
16335
  _registerSingleFunction(a) {
16341
16336
  const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new ke();
16342
16337
  if (r && this._localeService.load(r), typeof i == "string") {
16343
- const m = {
16338
+ const f = {
16344
16339
  functionName: e,
16345
16340
  functionType: t.User,
16346
16341
  description: i,
16347
16342
  abstract: i || "",
16348
16343
  functionParameter: []
16349
16344
  };
16350
- u.add(this._descriptionService.registerDescriptions([m]));
16345
+ u.add(this._descriptionService.registerDescriptions([f]));
16351
16346
  } else
16352
16347
  u.add(this._descriptionService.registerDescriptions([i]));
16353
- const f = o ? new Fa(e) : new Ft(e);
16354
- return f.calculateCustom = n, this._functionService.registerExecutors(f), u.add(J(() => this._functionService.unregisterExecutors(e))), u.add(J(() => this._functionService.unregisterDescriptions(e))), u.add(J(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
16348
+ const m = o ? new Fa(e) : new Ft(e);
16349
+ return m.calculateCustom = n, this._functionService.registerExecutors(m), u.add(J(() => this._functionService.unregisterExecutors(e))), u.add(J(() => this._functionService.unregisterDescriptions(e))), u.add(J(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
16355
16350
  J(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16356
16351
  )), u;
16357
16352
  }
@@ -16367,17 +16362,17 @@ let Vt = class extends ee {
16367
16362
  return this._remoteRegisterFunctionService.registerFunctions(n), J(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16368
16363
  }
16369
16364
  };
16370
- Vt = zr([
16365
+ Vt = Zr([
16371
16366
  Ye(0, H(Gt)),
16372
16367
  Ye(1, H(Pt)),
16373
16368
  Ye(2, Lt),
16374
16369
  Ye(3, on(Ya))
16375
16370
  ], Vt);
16376
- var Jr = Object.defineProperty, eo = Object.getOwnPropertyDescriptor, to = (a, e, n) => e in a ? Jr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, Xa = (a, e, n, i) => {
16377
- for (var r = i > 1 ? void 0 : i ? eo(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16371
+ var eo = Object.defineProperty, to = Object.getOwnPropertyDescriptor, ao = (a, e, n) => e in a ? eo(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, Xa = (a, e, n, i) => {
16372
+ for (var r = i > 1 ? void 0 : i ? to(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16378
16373
  (u = a[o]) && (r = u(r) || r);
16379
16374
  return r;
16380
- }, ut = (a, e) => (n, i) => e(n, i, a), Tt = (a, e, n) => to(a, typeof e != "symbol" ? e + "" : e, n);
16375
+ }, ut = (a, e) => (n, i) => e(n, i, a), Tt = (a, e, n) => ao(a, typeof e != "symbol" ? e + "" : e, n);
16381
16376
  let mt = class extends La {
16382
16377
  constructor(a = ua, e, n) {
16383
16378
  super(), this._config = a, this._injector = e, this._configService = n;
@@ -16386,19 +16381,19 @@ let mt = class extends La {
16386
16381
  ua,
16387
16382
  this._config
16388
16383
  );
16389
- this._configService.setConfig(Ei, i);
16384
+ this._configService.setConfig(Ii, i);
16390
16385
  }
16391
16386
  onStarting() {
16392
16387
  this._injector.add([ot]), this._injector.get(Ba).registerChannel(
16393
16388
  Yt,
16394
- pi(this._injector.get(ot))
16389
+ Li(this._injector.get(ot))
16395
16390
  );
16396
16391
  }
16397
16392
  };
16398
16393
  Tt(mt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16399
- Tt(mt, "type", $.UNIVER_SHEET);
16394
+ Tt(mt, "type", k.UNIVER_SHEET);
16400
16395
  mt = Xa([
16401
- pa(ri),
16396
+ pa(oi),
16402
16397
  ut(1, H(ct)),
16403
16398
  ut(2, Ce)
16404
16399
  ], mt);
@@ -16414,7 +16409,7 @@ let ft = class extends La {
16414
16409
  }
16415
16410
  onStarting() {
16416
16411
  const a = this._injector, e = [
16417
- [Zr, { useClass: Vt }],
16412
+ [Jr, { useClass: Vt }],
16418
16413
  [Pt, { useClass: Bt }],
16419
16414
  [it],
16420
16415
  [vt],
@@ -16430,7 +16425,7 @@ let ft = class extends La {
16430
16425
  if (this._config.notExecuteFormula) {
16431
16426
  const n = a.get(Ba);
16432
16427
  e.push([Ya, {
16433
- useFactory: () => Li(n.requestChannel(Yt))
16428
+ useFactory: () => Pi(n.requestChannel(Yt))
16434
16429
  }]);
16435
16430
  }
16436
16431
  e.forEach((n) => a.add(n));
@@ -16456,15 +16451,15 @@ let ft = class extends La {
16456
16451
  ]);
16457
16452
  }
16458
16453
  };
16459
- Tt(ft, "pluginName", sr);
16460
- Tt(ft, "type", $.UNIVER_SHEET);
16454
+ Tt(ft, "pluginName", dr);
16455
+ Tt(ft, "type", k.UNIVER_SHEET);
16461
16456
  ft = Xa([
16462
- pa(xn),
16457
+ pa(_n),
16463
16458
  ut(1, H(ct)),
16464
16459
  ut(2, Ce)
16465
16460
  ], ft);
16466
- function mo(a, e, n, i) {
16467
- const r = a.get(oi), o = a.get(ui), u = a.get(mi), f = a.get(fi);
16461
+ function fo(a, e, n, i) {
16462
+ const r = a.get(ui), o = a.get(mi), u = a.get(fi), m = a.get(ci);
16468
16463
  r.load({
16469
16464
  formulaData: {},
16470
16465
  arrayFormulaCellData: {},
@@ -16480,20 +16475,20 @@ function mo(a, e, n, i) {
16480
16475
  },
16481
16476
  dirtyUnitOtherFormulaMap: {}
16482
16477
  });
16483
- const m = o.treeBuilder(e), c = u.parse(m), l = f.execute(ci(c));
16484
- return li(l);
16478
+ const f = o.treeBuilder(e), c = u.parse(f), l = m.execute(li(c));
16479
+ return si(l);
16485
16480
  }
16486
16481
  export {
16487
16482
  Te as CalculationMode,
16488
16483
  Bt as DescriptionService,
16489
16484
  vt as FormulaRefRangeService,
16490
16485
  Pt as IDescriptionService,
16491
- Zr as IRegisterFunctionService,
16486
+ Jr as IRegisterFunctionService,
16492
16487
  Ya as IRemoteRegisterFunctionService,
16493
16488
  Ze as ImageFormulaCellInterceptorController,
16494
- Pi as InsertFunctionCommand,
16489
+ Ti as InsertFunctionCommand,
16495
16490
  ge as PLUGIN_CONFIG_KEY_BASE,
16496
- Ti as QuickSumCommand,
16491
+ Ei as QuickSumCommand,
16497
16492
  Vt as RegisterFunctionService,
16498
16493
  ot as RemoteRegisterFunctionService,
16499
16494
  xe as TriggerCalculationController,
@@ -16501,5 +16496,5 @@ export {
16501
16496
  ft as UniverSheetsFormulaPlugin,
16502
16497
  Je as UpdateDefinedNameController,
16503
16498
  et as UpdateFormulaController,
16504
- mo as calculateFormula
16499
+ fo as calculateFormula
16505
16500
  };