@univerjs/sheets-formula 0.10.14 → 0.11.0-nightly.202511151013

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,26 +1,26 @@
1
- var Ka = Object.defineProperty;
2
- var ka = (a, e, n) => e in a ? Ka(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
- var W = (a, e, n) => ka(a, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as yt, ICommandService as fe, ObjectMatrix as G, generateRandomId as da, IUniverInstanceService as Se, Rectangle as me, sequenceExecuteAsync as Qa, Inject as X, LifecycleService as $a, Disposable as ne, ILogService as ja, IConfigService as Ae, LocaleService as qt, isFormulaString as Me, isFormulaId as pa, cellToRange as La, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as Y, UniverInstanceType as ae, Injector as ut, InterceptorEffectEnum as za, CellValueType as wt, isRealNum as Za, createIdentifier as gt, toDisposable as oe, moveRangeByOffset as St, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as Ja, DependentOn as Pa, Plugin as Ta, merge as Ea, touchDependencies as Fe, isNodeEnv as Yt } from "@univerjs/core";
5
- import { SetRangeValuesCommand as Ia, SheetsSelectionsService as en, getSheetCommandTarget as tn, findFirstNonEmptyCell as an, alignToMergedCellsBorders as st, expandToContinuousRange as nn, SetSelectionsOperation as rn, SetRangeValuesMutation as z, SetStyleCommand as ht, SetBorderCommand as Na, ClearSelectionFormatCommand as Ra, handleMoveCols as Sa, EffectRefRangId as H, runRefRangeMutations as w, handleMoveRows as Aa, handleMoveRange as Ca, handleInsertRangeMoveRight as Da, handleInsertRangeMoveDown as ba, handleDeleteRangeMoveUp as Oa, handleDeleteRangeMoveLeft as Ma, handleIRemoveCol as xa, handleIRemoveRow as _a, handleInsertCol as ya, handleInsertRow as qa, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as ha, RemoveSheetCommand as on, SetWorksheetNameCommand as un, DeleteRangeMoveLeftCommand as mn, DeleteRangeMoveUpCommand as fn, RemoveColCommand as cn, RemoveRowCommand as ln, InsertRangeMoveDownCommand as sn, InsertRangeMoveRightCommand as dn, InsertColCommand as pn, InsertRowCommand as Ln, MoveColsCommand as Pn, MoveRowsCommand as Tn, MoveRangeCommand as En, SheetInterceptorService as Ut, RemoveSheetMutation as At, InsertSheetMutation as Ct, MoveRangeMutation as Xt, MoveRowsMutation as Wt, MoveColsMutation as Kt, ReorderRangeMutation as kt, RemoveRowMutation as Qt, RemoveColMutation as $t, InsertColMutation as jt, InsertRowMutation as zt, SetRowHiddenMutation as Zt, SetRowVisibleMutation as Jt, INTERCEPTOR_POINT as In, SetWorksheetActiveOperation as Nn, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as dt, RefRangeService as Rn, handleDefaultRangeChangeWithEffectRefCommands as ea, getSeparateEffectedRangesOnCommand as Sn, handleCommonDefaultRangeChangeWithEffectRefCommands as An, UniverSheetsPlugin as Cn } from "@univerjs/sheets";
6
- import { serializeRange as _e, IActiveDirtyManagerService as Ft, SetFormulaCalculationResultMutation as Dn, RemoveOtherFormulaMutation as bn, SetOtherFormulaMutation as On, FormulaDataModel as mt, SetFormulaCalculationStartMutation as Ee, SetFormulaCalculationStopMutation as ta, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as aa, SetFormulaCalculationNotificationMutation as Mn, FormulaExecuteStageType as Be, FormulaExecutedStateType as De, sequenceNodeType as te, deserializeRangeWithSheetWithCache as Le, serializeRangeToRefString as ft, ErrorType as Q, IDefinedNamesService as Bt, LexerTreeBuilder as vt, generateStringWithSequence as $e, SetDefinedNameMutation as ye, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as Dt, initSheetFormulaData as na, RemoveDefinedNameMutation as bt, stripErrorMargin as xn, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as x, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as k, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as V, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as y, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as pt, IFunctionService as Vt, isReferenceStrings as _n, functionArray as yn, functionCompatibility as qn, functionCube as gn, functionDatabase as hn, functionDate as Un, functionEngineering as Fn, functionFinancial as Bn, functionInformation as vn, functionLogical as Vn, functionLookup as Gn, functionMath as Hn, functionMeta as wn, functionStatistical as Yn, functionText as Xn, functionUniver as Wn, functionWeb as Kn, serializeRangeWithSpreadsheet as ra, serializeRangeWithSheet as oa, CustomFunction as Ot, AsyncCustomFunction as Ua, UniverFormulaEnginePlugin as Fa, IFormulaCurrentConfigService as kn, Lexer as Qn, AstTreeBuilder as $n, Interpreter as jn, generateExecuteAstNodeData as zn, getObjectValue as Zn } from "@univerjs/engine-formula";
7
- import { Subject as ua, BehaviorSubject as Ba, bufferWhen as Jn, filter as ma, map as ei } from "rxjs";
8
- import { IRPCChannelService as va, fromModule as ti, toModule as ai } from "@univerjs/rpc";
9
- const ni = {
1
+ var ja = Object.defineProperty;
2
+ var za = (a, e, n) => e in a ? ja(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
+ var W = (a, e, n) => za(a, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as vt, ICommandService as ue, ObjectMatrix as V, generateRandomId as La, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as Za, Inject as X, LifecycleService as Ja, Disposable as ee, ILogService as en, IConfigService as be, LocaleService as Vt, isFormulaString as ye, isFormulaId as Pa, cellToRange as Ta, Tools as We, Direction as ke, getIntersectRange as Ke, RANGE_TYPE as Y, UniverInstanceType as j, Injector as ct, InterceptorEffectEnum as tn, CellValueType as Wt, isRealNum as an, createIdentifier as Gt, toDisposable as J, moveRangeByOffset as xt, DisposableCollection as Qe, AbsoluteRefType as $e, Optional as nn, DependentOn as Ea, Plugin as Ia, merge as Na, touchDependencies as Be, isNodeEnv as Kt } from "@univerjs/core";
5
+ import { SetRangeValuesCommand as Ra, SheetsSelectionsService as rn, getSheetCommandTarget as on, findFirstNonEmptyCell as un, alignToMergedCellsBorders as It, expandToContinuousRange as mn, SetSelectionsOperation as fn, SetRangeValuesMutation as k, SetStyleCommand as Ht, SetBorderCommand as Sa, ClearSelectionFormatCommand as Aa, handleMoveCols as Ca, EffectRefRangId as H, runRefRangeMutations as w, handleMoveRows as Da, handleMoveRange as ba, handleInsertRangeMoveRight as Oa, handleInsertRangeMoveDown as Ma, handleDeleteRangeMoveUp as xa, handleDeleteRangeMoveLeft as _a, handleIRemoveCol as ya, handleIRemoveRow as qa, handleInsertCol as ga, handleInsertRow as ha, RemoveDefinedNameCommand as Ua, SetDefinedNameCommand as Fa, RemoveSheetCommand as cn, SetWorksheetNameCommand as ln, DeleteRangeMoveLeftCommand as sn, DeleteRangeMoveUpCommand as dn, RemoveColCommand as pn, RemoveRowCommand as Ln, InsertRangeMoveDownCommand as Pn, InsertRangeMoveRightCommand as Tn, InsertColCommand as En, InsertRowCommand as In, MoveColsCommand as Nn, MoveRowsCommand as Rn, MoveRangeCommand as Sn, SheetInterceptorService as wt, RemoveSheetMutation as _t, InsertSheetMutation as yt, MoveRangeMutation as kt, MoveRowsMutation as Qt, MoveColsMutation as $t, ReorderRangeMutation as jt, RemoveRowMutation as zt, RemoveColMutation as Zt, InsertColMutation as Jt, InsertRowMutation as ea, SetRowHiddenMutation as ta, SetRowVisibleMutation as aa, INTERCEPTOR_POINT as An, SetWorksheetActiveOperation as Ba, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as Cn, handleDefaultRangeChangeWithEffectRefCommands as na, getSeparateEffectedRangesOnCommand as Dn, handleCommonDefaultRangeChangeWithEffectRefCommands as bn, UniverSheetsPlugin as On } from "@univerjs/sheets";
6
+ import { serializeRange as Ce, IActiveDirtyManagerService as Yt, SetFormulaCalculationResultMutation as va, RemoveOtherFormulaMutation as Mn, SetOtherFormulaMutation as xn, FormulaDataModel as lt, SetFormulaCalculationStartMutation as Ne, SetFormulaCalculationStopMutation as ia, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as ra, SetFormulaCalculationNotificationMutation as _n, FormulaExecuteStageType as ve, FormulaExecutedStateType as Me, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, ErrorType as $, IDefinedNamesService as dt, LexerTreeBuilder as pt, generateStringWithSequence as je, SetDefinedNameMutation as De, SetFormulaDataMutation as Ve, SetArrayFormulaDataMutation as qt, initSheetFormulaData as oa, RemoveDefinedNameMutation as gt, IFunctionService as Lt, stripErrorMargin as yn, FunctionType as t, FUNCTION_NAMES_ARRAY as ua, FUNCTION_NAMES_COMPATIBILITY as x, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as Q, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as y, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as qn, functionArray as gn, functionCompatibility as hn, functionCube as Un, functionDatabase as Fn, functionDate as Bn, functionEngineering as vn, functionFinancial as Vn, functionInformation as Gn, functionLogical as Hn, functionLookup as wn, functionMath as Yn, functionMeta as Xn, functionStatistical as Wn, functionText as Kn, functionUniver as kn, functionWeb as Qn, SetSuperTableMutation as $n, RemoveSuperTableMutation as jn, serializeRangeWithSheet as ze, ISuperTableService as zn, serializeRangeWithSpreadsheet as ma, CustomFunction as ht, AsyncCustomFunction as Va, UniverFormulaEnginePlugin as Ga, IFormulaCurrentConfigService as Zn, Lexer as Jn, AstTreeBuilder as ei, Interpreter as ti, generateExecuteAstNodeData as ai, getObjectValue as ni } from "@univerjs/engine-formula";
7
+ import { Subject as fa, BehaviorSubject as Ha, bufferWhen as ii, filter as ca, map as ri } from "rxjs";
8
+ import { IRPCChannelService as wa, fromModule as oi, toModule as ui } from "@univerjs/rpc";
9
+ const mi = {
10
10
  id: "formula.command.insert-function",
11
- type: yt.COMMAND,
11
+ type: vt.COMMAND,
12
12
  handler: async (a, e) => {
13
- const { list: n, listOfRangeHasNumber: i } = e, r = a.get(fe), o = new G();
13
+ const { list: n, listOfRangeHasNumber: i } = e, r = a.get(ue), o = new V();
14
14
  n.forEach((f) => {
15
- const { range: m, primary: c, formula: d } = f, { row: P, column: E } = c, p = da(6);
16
- o.setValue(P, E, {
17
- f: d,
15
+ const { range: m, primary: c, formula: s } = f, { row: L, column: E } = c, p = La(6);
16
+ o.setValue(L, E, {
17
+ f: s,
18
18
  si: p
19
19
  });
20
- const { startRow: I, startColumn: S, endRow: R, endColumn: s } = m;
20
+ const { startRow: I, startColumn: S, endRow: R, endColumn: d } = m;
21
21
  for (let A = I; A <= R; A++)
22
- for (let N = S; N <= s; N++)
23
- (A !== P || N !== E) && o.setValue(A, N, {
22
+ for (let N = S; N <= d; N++)
23
+ (A !== L || N !== E) && o.setValue(A, N, {
24
24
  si: p
25
25
  });
26
26
  }), i && i.length > 0 && i.forEach((f) => {
@@ -32,104 +32,104 @@ const ni = {
32
32
  const u = {
33
33
  value: o.getData()
34
34
  };
35
- return r.executeCommand(Ia.id, u);
35
+ return r.executeCommand(Ra.id, u);
36
36
  }
37
- }, ii = {
37
+ }, fi = {
38
38
  id: "sheets-formula.command.quick-sum",
39
- type: yt.COMMAND,
39
+ type: vt.COMMAND,
40
40
  handler: async (a) => {
41
- const n = a.get(en).getCurrentLastSelection();
41
+ const n = a.get(rn).getCurrentLastSelection();
42
42
  if (!n) return !1;
43
- const i = a.get(Se), r = tn(i);
43
+ const i = a.get(Ee), r = on(i);
44
44
  if (!r) return !1;
45
45
  const o = n.range, { worksheet: u } = r;
46
- let f = an(o, u);
46
+ let f = un(o, u);
47
47
  if (!f) return !1;
48
- f = st(f, u);
49
- const m = nn({
48
+ f = It(f, u);
49
+ const m = mn({
50
50
  startRow: f.startRow,
51
51
  startColumn: f.startColumn,
52
52
  endRow: o.endRow,
53
53
  endColumn: o.endColumn
54
- }, { left: !0, right: !0, up: !0, down: !0 }, u), c = new G(), d = st({
54
+ }, { left: !0, right: !0, up: !0, down: !0 }, u), c = new V(), s = It({
55
55
  startRow: m.endRow,
56
56
  endRow: m.endRow,
57
57
  startColumn: m.startColumn,
58
58
  endColumn: m.endColumn
59
59
  }, u);
60
- if (!me.equals(d, m))
61
- for (const p of u.iterateByColumn(d))
60
+ if (!fe.equals(s, m))
61
+ for (const p of u.iterateByColumn(s))
62
62
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
63
- f: `=SUM(${_e({
63
+ f: `=SUM(${Ce({
64
64
  startColumn: p.col,
65
65
  endColumn: p.col,
66
66
  startRow: m.startRow,
67
67
  endRow: p.row - 1
68
68
  })})`
69
69
  });
70
- const P = st({
70
+ const L = It({
71
71
  startRow: m.startRow,
72
72
  startColumn: m.endColumn,
73
73
  endRow: m.endRow,
74
74
  endColumn: m.endColumn
75
75
  }, u);
76
- if (!me.equals(P, m))
77
- for (const p of u.iterateByRow(P))
76
+ if (!fe.equals(L, m))
77
+ for (const p of u.iterateByRow(L))
78
78
  (!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
79
- f: `=SUM(${_e({
79
+ f: `=SUM(${Ce({
80
80
  startColumn: m.startColumn,
81
81
  endColumn: p.col - 1,
82
82
  startRow: p.row,
83
83
  endRow: p.row
84
84
  })})`
85
85
  });
86
- const E = a.get(fe);
87
- return (await Qa([
86
+ const E = a.get(ue);
87
+ return (await Za([
88
88
  {
89
- id: Ia.id,
89
+ id: Ra.id,
90
90
  params: {
91
91
  range: m,
92
92
  value: c.getMatrix()
93
93
  }
94
94
  },
95
95
  {
96
- id: rn.id,
96
+ id: fn.id,
97
97
  params: {
98
98
  unitId: r.unitId,
99
99
  subUnitId: r.subUnitId,
100
100
  selections: [{
101
101
  range: m,
102
- primary: me.contains(m, n.primary) ? n.primary : { ...f, actualRow: f.startRow, actualColumn: f.startColumn },
102
+ primary: fe.contains(m, n.primary) ? n.primary : { ...f, actualRow: f.startRow, actualColumn: f.startColumn },
103
103
  style: null
104
104
  }]
105
105
  }
106
106
  }
107
107
  ], E)).result;
108
108
  }
109
- }, Oe = {
110
- type: yt.MUTATION,
109
+ }, _e = {
110
+ type: vt.MUTATION,
111
111
  id: "sheet.mutation.data-validation-formula-mark-dirty",
112
112
  handler() {
113
113
  return !0;
114
114
  }
115
- }, ge = "sheets-formula.base.config";
116
- var Pe = /* @__PURE__ */ ((a) => (a[a.FORCED = 0] = "FORCED", a[a.WHEN_EMPTY = 1] = "WHEN_EMPTY", a[a.NO_CALCULATION = 2] = "NO_CALCULATION", a))(Pe || {});
117
- const fa = {}, ri = "sheets-formula.remote.config", ca = {};
118
- var Ie = /* @__PURE__ */ ((a) => (a[a.NOT_REGISTER = 1] = "NOT_REGISTER", a[a.SUCCESS = 2] = "SUCCESS", a[a.WAIT = 3] = "WAIT", a[a.ERROR = 4] = "ERROR", a))(Ie || {}), oi = Object.getOwnPropertyDescriptor, ui = (a, e, n, i) => {
119
- for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
115
+ }, he = "sheets-formula.base.config";
116
+ 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 || {});
117
+ const la = {}, ci = "sheets-formula.remote.config", sa = {};
118
+ var Re = /* @__PURE__ */ ((a) => (a[a.NOT_REGISTER = 1] = "NOT_REGISTER", a[a.SUCCESS = 2] = "SUCCESS", a[a.WAIT = 3] = "WAIT", a[a.ERROR = 4] = "ERROR", a))(Re || {}), li = Object.getOwnPropertyDescriptor, si = (a, e, n, i) => {
119
+ for (var r = i > 1 ? void 0 : i ? li(e, n) : e, o = a.length - 1, u; o >= 0; o--)
120
120
  (u = a[o]) && (r = u(r) || r);
121
121
  return r;
122
- }, Lt = (a, e) => (n, i) => e(n, i, a);
123
- let je = class extends ne {
122
+ }, St = (a, e) => (n, i) => e(n, i, a);
123
+ let Ze = class extends ee {
124
124
  constructor(e, n, i) {
125
125
  super();
126
126
  W(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
127
- W(this, "_formulaChangeWithRange$", new ua());
127
+ W(this, "_formulaChangeWithRange$", new fa());
128
128
  W(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
129
129
  // FIXME: this design could be improved.
130
- W(this, "_formulaResult$", new ua());
130
+ W(this, "_formulaResult$", new fa());
131
131
  W(this, "formulaResult$", this._formulaResult$.asObservable());
132
- W(this, "calculateStarted$", new Ba(!1));
132
+ W(this, "calculateStarted$", new Ha(!1));
133
133
  this._commandService = e, this._activeDirtyManagerService = n, this._lifecycleService = i, this._initFormulaRegister(), this._initFormulaCalculationResultChange();
134
134
  }
135
135
  dispose() {
@@ -142,13 +142,13 @@ let je = class extends ne {
142
142
  return r || (r = /* @__PURE__ */ new Map(), i.set(n, r)), r;
143
143
  }
144
144
  _createFormulaId(e, n) {
145
- return `formula.${e}_${n}_${da(8)}`;
145
+ return `formula.${e}_${n}_${La(8)}`;
146
146
  }
147
147
  _initFormulaRegister() {
148
148
  this._activeDirtyManagerService.register(
149
- Oe.id,
149
+ _e.id,
150
150
  {
151
- commandId: Oe.id,
151
+ commandId: _e.id,
152
152
  getDirtyData(n) {
153
153
  return {
154
154
  dirtyUnitOtherFormulaMap: n.params
@@ -170,42 +170,42 @@ let je = class extends ne {
170
170
  }
171
171
  }
172
172
  };
173
- this._commandService.executeCommand(On.id, c).then(() => {
173
+ this._commandService.executeCommand(xn.id, c).then(() => {
174
174
  this._commandService.executeCommand(
175
- Oe.id,
175
+ _e.id,
176
176
  { [i]: { [r]: { [u]: !0 } } }
177
177
  );
178
178
  });
179
179
  };
180
180
  this.disposeWithMe(
181
- this._formulaChangeWithRange$.pipe(Jn(() => this.calculateStarted$.pipe(ma((n) => n)))).subscribe((n) => n.forEach(e))
181
+ this._formulaChangeWithRange$.pipe(ii(() => this.calculateStarted$.pipe(ca((n) => n)))).subscribe((n) => n.forEach(e))
182
182
  ), this.disposeWithMe(
183
- this._formulaChangeWithRange$.pipe(ma(() => this.calculateStarted$.getValue())).subscribe(e)
183
+ this._formulaChangeWithRange$.pipe(ca(() => this.calculateStarted$.getValue())).subscribe(e)
184
184
  );
185
185
  }
186
186
  _initFormulaCalculationResultChange() {
187
187
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
188
- if (e.id === Dn.id) {
188
+ if (e.id === va.id) {
189
189
  const n = e.params, { unitOtherData: i } = n, r = {};
190
190
  for (const o in i) {
191
191
  const u = i[o], f = {};
192
192
  r[o] = f;
193
193
  for (const m in u) {
194
- const c = this._ensureCacheMap(o, m), d = u[m], P = [];
195
- f[m] = P;
196
- for (const E in d) {
197
- const p = d[E];
194
+ const c = this._ensureCacheMap(o, m), s = u[m], L = [];
195
+ f[m] = L;
196
+ for (const E in s) {
197
+ const p = s[E];
198
198
  if (c.has(E)) {
199
199
  const I = c.get(E);
200
200
  if (!I)
201
201
  continue;
202
202
  I.result || (I.result = {});
203
- const S = new G(p), R = new G(I.result);
204
- S.forValue((s, A, N) => {
205
- R.setValue(s, A, N);
206
- }), I.status = Ie.SUCCESS, I.callbacks.forEach((s) => {
207
- s(p);
208
- }), I.callbacks.clear(), P.push(I);
203
+ const S = new V(p), R = new V(I.result);
204
+ S.forValue((d, A, N) => {
205
+ R.setValue(d, A, N);
206
+ }), I.status = Re.SUCCESS, I.callbacks.forEach((d) => {
207
+ d(p);
208
+ }), I.callbacks.clear(), L.push(I);
209
209
  }
210
210
  }
211
211
  }
@@ -218,7 +218,7 @@ let je = class extends ne {
218
218
  const u = this._createFormulaId(e, n);
219
219
  return this._ensureCacheMap(e, n).set(u, {
220
220
  result: void 0,
221
- status: Ie.WAIT,
221
+ status: Re.WAIT,
222
222
  formulaId: u,
223
223
  callbacks: /* @__PURE__ */ new Set(),
224
224
  extra: o
@@ -236,13 +236,13 @@ let je = class extends ne {
236
236
  subUnitId: n,
237
237
  formulaIdList: i
238
238
  };
239
- this._commandService.executeCommand(bn.id, r);
239
+ this._commandService.executeCommand(Mn.id, r);
240
240
  const o = this._ensureCacheMap(e, n);
241
241
  i.forEach((u) => o.delete(u));
242
242
  }
243
243
  getFormulaValue(e, n, i) {
244
244
  const r = this._ensureCacheMap(e, n), o = r.get(i);
245
- return o ? o.status === Ie.SUCCESS || o.status === Ie.ERROR ? Promise.resolve(o) : new Promise((u) => {
245
+ return o ? o.status === Re.SUCCESS || o.status === Re.ERROR ? Promise.resolve(o) : new Promise((u) => {
246
246
  o.callbacks.add(() => {
247
247
  u(r.get(i));
248
248
  });
@@ -253,24 +253,24 @@ let je = class extends ne {
253
253
  }
254
254
  markFormulaDirty(e, n, i) {
255
255
  const r = this.getFormulaValueSync(e, n, i);
256
- r && (r.status = Ie.WAIT, this._commandService.executeCommand(
257
- Oe.id,
256
+ r && (r.status = Re.WAIT, this._commandService.executeCommand(
257
+ _e.id,
258
258
  { [e]: { [n]: { [i]: !0 } } }
259
259
  ));
260
260
  }
261
261
  };
262
- je = ui([
263
- Lt(0, fe),
264
- Lt(1, Ft),
265
- Lt(2, X($a))
266
- ], je);
267
- var mi = Object.getOwnPropertyDescriptor, fi = (a, e, n, i) => {
268
- for (var r = i > 1 ? void 0 : i ? mi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
262
+ Ze = si([
263
+ St(0, ue),
264
+ St(1, Yt),
265
+ St(2, X(Ja))
266
+ ], Ze);
267
+ var di = Object.getOwnPropertyDescriptor, pi = (a, e, n, i) => {
268
+ for (var r = i > 1 ? void 0 : i ? di(e, n) : e, o = a.length - 1, u; o >= 0; o--)
269
269
  (u = a[o]) && (r = u(r) || r);
270
270
  return r;
271
271
  }, pe = (a, e) => (n, i) => e(n, i, a);
272
- const la = { done: 0, count: 0 }, Pt = { onlyLocal: !0 };
273
- let xe = class extends ne {
272
+ const da = { done: 0, count: 0 }, At = { onlyLocal: !0 };
273
+ let qe = class extends ee {
274
274
  constructor(e, n, i, r, o, u, f) {
275
275
  super();
276
276
  W(this, "_waitingCommandQueue", []);
@@ -293,7 +293,7 @@ let xe = class extends ne {
293
293
  * The mark of forced calculation. If a new mutation triggers dirty area calculation during the forced calculation process, forced calculation is still required.
294
294
  */
295
295
  W(this, "_forceCalculating", !1);
296
- W(this, "_progress$", new Ba(la));
296
+ W(this, "_progress$", new Ha(da));
297
297
  W(this, "progress$", this._progress$.asObservable());
298
298
  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();
299
299
  }
@@ -322,17 +322,17 @@ let xe = class extends ne {
322
322
  this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._emitProgress();
323
323
  }
324
324
  dispose() {
325
- super.dispose(), this._progress$.next(la), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
325
+ super.dispose(), this._progress$.next(da), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
326
326
  }
327
327
  _getCalculationMode() {
328
328
  var n;
329
- const e = this._configService.getConfig(ge);
330
- return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : Pe.WHEN_EMPTY;
329
+ const e = this._configService.getConfig(he);
330
+ return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : Te.WHEN_EMPTY;
331
331
  }
332
332
  _commandExecutedListener() {
333
333
  this.disposeWithMe(
334
334
  this._commandService.beforeCommandExecuted((e) => {
335
- if (e.id === Ee.id) {
335
+ if (e.id === Ne.id) {
336
336
  const n = e.params;
337
337
  n.rowData = this._formulaDataModel.getHiddenRowsFiltered();
338
338
  }
@@ -340,14 +340,14 @@ let xe = class extends ne {
340
340
  ), this.disposeWithMe(
341
341
  this._commandService.onCommandExecuted((e, n) => {
342
342
  if (this._activeDirtyManagerService.get(e.id)) {
343
- if (e.id === z.id) {
343
+ if (e.id === k.id) {
344
344
  const i = e.params;
345
- if (n && n.onlyLocal === !0 || i.trigger === ht.id || i.trigger === Na.id || i.trigger === Ra.id)
345
+ if (n && n.onlyLocal === !0 || i.trigger === Ht.id || i.trigger === Sa.id || i.trigger === Aa.id)
346
346
  return;
347
347
  }
348
348
  this._waitingCommandQueue.push(e), clearTimeout(this._setTimeoutKey), this._setTimeoutKey = setTimeout(() => {
349
349
  const i = this._generateDirty(this._waitingCommandQueue);
350
- this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ee.id, { ...this._executingDirtyData }, Pt) : (this._restartCalculation = !0, this._commandService.executeCommand(ta.id, {})), this._waitingCommandQueue = [];
350
+ this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ne.id, { ...this._executingDirtyData }, At) : (this._restartCalculation = !0, this._commandService.executeCommand(ia.id, {})), this._waitingCommandQueue = [];
351
351
  }, 100);
352
352
  }
353
353
  })
@@ -359,8 +359,8 @@ let xe = class extends ne {
359
359
  const c = this._activeDirtyManagerService.get(m.id);
360
360
  if (c == null)
361
361
  continue;
362
- const d = c.getDirtyData(m), { dirtyRanges: P, dirtyNameMap: E, dirtyDefinedNameMap: p, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: R } = d;
363
- P != null && this._mergeDirtyRanges(n, P), E != null && this._mergeDirtyNameMap(i, E), p != null && this._mergeDirtyNameMap(r, p), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, I), S != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, S), R != null && this._mergeDirtyNameMap(f, R);
362
+ const s = c.getDirtyData(m), { dirtyRanges: L, dirtyNameMap: E, dirtyDefinedNameMap: p, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: R } = s;
363
+ L != null && this._mergeDirtyRanges(n, L), E != null && this._mergeDirtyNameMap(i, E), p != null && this._mergeDirtyNameMap(r, p), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, I), S != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, S), R != null && this._mergeDirtyNameMap(f, R);
364
364
  }
365
365
  return {
366
366
  dirtyRanges: n,
@@ -370,7 +370,7 @@ let xe = class extends ne {
370
370
  dirtyUnitOtherFormulaMap: u,
371
371
  forceCalculation: !1,
372
372
  clearDependencyTreeCache: f,
373
- maxIteration: this._configService.getConfig(aa)
373
+ maxIteration: this._configService.getConfig(ra)
374
374
  // numfmtItemMap,
375
375
  };
376
376
  }
@@ -399,8 +399,8 @@ let xe = class extends ne {
399
399
  let r = !1;
400
400
  for (const o of e)
401
401
  if (i.unitId === o.unitId && i.sheetId === o.sheetId) {
402
- const { startRow: u, startColumn: f, endRow: m, endColumn: c } = i.range, { startRow: d, startColumn: P, endRow: E, endColumn: p } = o.range;
403
- if (u === d && f === P && m === E && c === p) {
402
+ const { startRow: u, startColumn: f, endRow: m, endColumn: c } = i.range, { startRow: s, startColumn: L, endRow: E, endColumn: p } = o.range;
403
+ if (u === s && f === L && m === E && c === p) {
404
404
  r = !0;
405
405
  break;
406
406
  }
@@ -431,32 +431,32 @@ let xe = class extends ne {
431
431
  this.disposeWithMe(
432
432
  // eslint-disable-next-line max-lines-per-function, complexity
433
433
  this._commandService.onCommandExecuted((i) => {
434
- if (i.id === Ee.id) {
434
+ if (i.id === Ne.id) {
435
435
  const { forceCalculation: o = !1 } = i.params;
436
436
  o && (this._forceCalculating = !0);
437
- } else i.id === ta.id && this.clearProgress();
438
- if (i.id !== Mn.id)
437
+ } else i.id === ia.id && this.clearProgress();
438
+ if (i.id !== _n.id)
439
439
  return;
440
440
  const r = i.params;
441
441
  if (r.stageInfo != null) {
442
442
  const {
443
443
  stage: o
444
444
  } = r.stageInfo;
445
- if (o === Be.START)
445
+ if (o === ve.START)
446
446
  n === 0 && (this._startExecutionTime = performance.now()), n++, e !== null && (clearTimeout(e), e = null), e = setTimeout(() => {
447
447
  e = null, this._startProgress();
448
448
  }, 1e3);
449
- else if (o === Be.CURRENTLY_CALCULATING) {
449
+ else if (o === ve.CURRENTLY_CALCULATING) {
450
450
  if (this._executionInProgressParams = r.stageInfo, e === null) {
451
451
  const u = this._localeService.t("formula.progress.calculating");
452
452
  this._calculateProgress(u);
453
453
  }
454
- } else if (o === Be.START_DEPENDENCY_ARRAY_FORMULA) {
454
+ } else if (o === ve.START_DEPENDENCY_ARRAY_FORMULA) {
455
455
  if (this._executionInProgressParams = r.stageInfo, e === null) {
456
456
  const u = this._localeService.t("formula.progress.array-analysis");
457
457
  this._calculateProgress(u);
458
458
  }
459
- } else if (o === Be.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
459
+ } else if (o === ve.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
460
460
  const u = this._localeService.t("formula.progress.array-calculation");
461
461
  this._calculateProgress(u);
462
462
  }
@@ -464,25 +464,25 @@ let xe = class extends ne {
464
464
  const o = r.functionsExecutedState;
465
465
  let u = "";
466
466
  switch (n--, o) {
467
- case De.NOT_EXECUTED:
467
+ case Me.NOT_EXECUTED:
468
468
  u = "No tasks are being executed anymore", this._resetExecutingDirtyData();
469
469
  break;
470
- case De.STOP_EXECUTION:
470
+ case Me.STOP_EXECUTION:
471
471
  u = "The execution of the formula has been stopped", n = 0;
472
472
  break;
473
- case De.SUCCESS:
473
+ case Me.SUCCESS:
474
474
  u = "Formula calculation succeeded", (n === 0 || n === -1) && (u += `. Total time consumed: ${performance.now() - this._startExecutionTime} ms`), this._resetExecutingDirtyData();
475
475
  break;
476
- case De.INITIAL:
476
+ case Me.INITIAL:
477
477
  u = "Waiting for calculation", this._resetExecutingDirtyData();
478
478
  break;
479
479
  }
480
- (n === 0 || n === -1) && (e ? (clearTimeout(e), e = null, this.clearProgress()) : this._completeProgress(), n = 0, this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._forceCalculating = !1), o === De.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
481
- Ee.id,
480
+ (n === 0 || n === -1) && (e ? (clearTimeout(e), e = null, this.clearProgress()) : this._completeProgress(), n = 0, this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._forceCalculating = !1), o === Me.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
481
+ Ne.id,
482
482
  {
483
483
  ...this._executingDirtyData
484
484
  },
485
- Pt
485
+ At
486
486
  )) : this._executionInProgressParams = null, this._logService.debug("[TriggerCalculationController]", u);
487
487
  }
488
488
  })
@@ -501,10 +501,10 @@ let xe = class extends ne {
501
501
  }
502
502
  _initialExecuteFormula() {
503
503
  const e = this._getCalculationMode(), n = this._getDirtyDataByCalculationMode(e);
504
- this._commandService.executeCommand(Ee.id, n, Pt), this._registerOtherFormulaService.calculateStarted$.next(!0);
504
+ this._commandService.executeCommand(Ne.id, n, At), this._registerOtherFormulaService.calculateStarted$.next(!0);
505
505
  }
506
506
  _getDirtyDataByCalculationMode(e) {
507
- const n = e === Pe.FORCED, i = e === Pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
507
+ const n = e === Te.FORCED, i = e === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
508
508
  return {
509
509
  forceCalculation: n,
510
510
  dirtyRanges: i,
@@ -513,24 +513,24 @@ let xe = class extends ne {
513
513
  dirtyUnitFeatureMap: {},
514
514
  dirtyUnitOtherFormulaMap: {},
515
515
  clearDependencyTreeCache: {},
516
- maxIteration: this._configService.getConfig(aa)
516
+ maxIteration: this._configService.getConfig(ra)
517
517
  };
518
518
  }
519
519
  };
520
- xe = fi([
521
- pe(0, fe),
522
- pe(1, Ft),
523
- pe(2, ja),
524
- pe(3, Ae),
525
- pe(4, X(mt)),
526
- pe(5, X(qt)),
527
- pe(6, X(je))
528
- ], xe);
529
- function ci(a, e, n) {
520
+ qe = pi([
521
+ pe(0, ue),
522
+ pe(1, Yt),
523
+ pe(2, en),
524
+ pe(3, be),
525
+ pe(4, X(lt)),
526
+ pe(5, X(Vt)),
527
+ pe(6, X(Ze))
528
+ ], qe);
529
+ function Li(a, e, n) {
530
530
  var i;
531
531
  return a == null || a[e] == null || ((i = a[e]) == null ? void 0 : i[n]) == null;
532
532
  }
533
- function Tt(a, e, n) {
533
+ function Ct(a, e, n) {
534
534
  var i;
535
535
  if (n) {
536
536
  if (a && a[e] && ((i = a[e]) != null && i[n]))
@@ -545,47 +545,47 @@ function Tt(a, e, n) {
545
545
  };
546
546
  }
547
547
  var _ = /* @__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))(_ || {});
548
- const li = [
548
+ const Pi = [
549
549
  11,
550
550
  12,
551
551
  13,
552
552
  14
553
553
  /* RemoveDefinedName */
554
554
  ];
555
- function si(a, e, n) {
555
+ function Ti(a, e, n) {
556
556
  const { type: i } = n;
557
- return li.includes(i) ? di(a, e) : pi(a, e, n);
557
+ return Pi.includes(i) ? Ei(a, e) : Ii(a, e, n);
558
558
  }
559
- function di(a, e) {
559
+ function Ei(a, e) {
560
560
  const n = [], i = [];
561
561
  return Object.keys(e).forEach((r) => {
562
562
  const o = e[r], u = a[r];
563
563
  if (o == null || u == null)
564
564
  return !0;
565
565
  Object.keys(o).forEach((f) => {
566
- const m = new G(o[f] || {}), c = new G(u[f] || {}), d = new G(), P = new G();
567
- if (m.forValue((R, s, A) => {
566
+ const m = new V(o[f] || {}), c = new V(u[f] || {}), s = new V(), L = new V();
567
+ if (m.forValue((R, d, A) => {
568
568
  if (A == null)
569
569
  return !0;
570
- const N = qe(A);
571
- N !== null && (d.setValue(R, s, N), P.setValue(R, s, c.getValue(R, s)));
572
- }), d.getSizeOf() === 0)
570
+ const N = ge(A);
571
+ N !== null && (s.setValue(R, d, N), L.setValue(R, d, c.getValue(R, d)));
572
+ }), s.getSizeOf() === 0)
573
573
  return;
574
574
  const E = {
575
575
  subUnitId: f,
576
576
  unitId: r,
577
- cellValue: d.getMatrix()
577
+ cellValue: s.getMatrix()
578
578
  }, p = {
579
- id: z.id,
579
+ id: k.id,
580
580
  params: E
581
581
  };
582
582
  i.push(p);
583
583
  const I = {
584
584
  subUnitId: f,
585
585
  unitId: r,
586
- cellValue: P.getMatrix()
586
+ cellValue: L.getMatrix()
587
587
  }, S = {
588
- id: z.id,
588
+ id: k.id,
589
589
  params: I
590
590
  };
591
591
  n.push(S);
@@ -595,8 +595,8 @@ function di(a, e) {
595
595
  redos: i
596
596
  };
597
597
  }
598
- function pi(a, e, n) {
599
- const { redoFormulaData: i, undoFormulaData: r } = Li(a, e, n), o = [], u = [];
598
+ function Ii(a, e, n) {
599
+ const { redoFormulaData: i, undoFormulaData: r } = Ni(a, e, n), o = [], u = [];
600
600
  return Object.keys(i).forEach((f) => {
601
601
  Object.keys(i[f]).forEach((m) => {
602
602
  if (Object.keys(i[f][m]).length !== 0) {
@@ -604,11 +604,11 @@ function pi(a, e, n) {
604
604
  subUnitId: m,
605
605
  unitId: f,
606
606
  cellValue: i[f][m]
607
- }, d = {
608
- id: z.id,
607
+ }, s = {
608
+ id: k.id,
609
609
  params: c
610
610
  };
611
- o.push(d);
611
+ o.push(s);
612
612
  }
613
613
  });
614
614
  }), Object.keys(r).forEach((f) => {
@@ -618,11 +618,11 @@ function pi(a, e, n) {
618
618
  subUnitId: m,
619
619
  unitId: f,
620
620
  cellValue: r[f][m]
621
- }, d = {
622
- id: z.id,
621
+ }, s = {
622
+ id: k.id,
623
623
  params: c
624
624
  };
625
- u.push(d);
625
+ u.push(s);
626
626
  }
627
627
  });
628
628
  }), {
@@ -630,26 +630,26 @@ function pi(a, e, n) {
630
630
  redos: o
631
631
  };
632
632
  }
633
- function Li(a, e, n) {
633
+ function Ni(a, e, n) {
634
634
  const i = {}, r = {}, { unitId: o, sheetId: u } = n;
635
635
  return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((m) => {
636
- if (ci(a, m, u))
636
+ if (Li(a, m, u))
637
637
  return;
638
638
  (/* @__PURE__ */ new Set([
639
639
  ...Object.keys(a[m] || {}),
640
640
  ...Object.keys(e[m] || {})
641
- ])).forEach((d) => {
641
+ ])).forEach((s) => {
642
642
  var A, N;
643
- const P = (A = a[m]) == null ? void 0 : A[d], E = (N = e[m]) == null ? void 0 : N[d], p = new G(P || {}), I = new G(E || {});
643
+ const L = (A = a[m]) == null ? void 0 : A[s], E = (N = e[m]) == null ? void 0 : N[s], p = new V(L || {}), I = new V(E || {});
644
644
  let S = [];
645
- m !== o || d !== u ? S = Ti(I) : S = Pi(p, I, n);
646
- const R = yi(S, p, I), s = qi(S, p);
647
- i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][d] = {
648
- ...i[m][d],
645
+ m !== o || s !== u ? S = Si(I) : S = Ri(p, I, n);
646
+ const R = Fi(S, p, I), d = Bi(S, p);
647
+ i[m] || (i[m] = {}), r[m] || (r[m] = {}), i[m][s] = {
648
+ ...i[m][s],
649
649
  ...R
650
- }, r[m][d] = {
651
- ...r[m][d],
652
- ...s
650
+ }, r[m][s] = {
651
+ ...r[m][s],
652
+ ...d
653
653
  };
654
654
  });
655
655
  }), {
@@ -657,11 +657,11 @@ function Li(a, e, n) {
657
657
  undoFormulaData: r
658
658
  };
659
659
  }
660
- function Pi(a, e, n) {
660
+ function Ri(a, e, n) {
661
661
  const { type: i, from: r, to: o, range: u } = n, f = [];
662
- return a.forValue((m, c, d) => {
663
- if (d == null || !Va(d)) return !0;
664
- const P = La(m, c);
662
+ return a.forValue((m, c, s) => {
663
+ if (s == null || !Ya(s)) return !0;
664
+ const L = Ta(m, c);
665
665
  let E = null, p = !1;
666
666
  if ([
667
667
  0,
@@ -669,71 +669,71 @@ function Pi(a, e, n) {
669
669
  2
670
670
  /* MoveCols */
671
671
  ].includes(i))
672
- E = Ei(i, r, o, P);
672
+ E = Ai(i, r, o, L);
673
673
  else if (u != null) {
674
- const I = Ii(P, n);
674
+ const I = Ci(L, n);
675
675
  E = I.newCell, p = I.isReverse;
676
676
  }
677
- if (Xe.diffValue(P, E) && !e.getValue(m, c))
677
+ if (We.diffValue(L, E) && !e.getValue(m, c))
678
678
  return !0;
679
- p ? f.unshift({ oldCell: P, newCell: E }) : f.push({ oldCell: P, newCell: E });
679
+ p ? f.unshift({ oldCell: L, newCell: E }) : f.push({ oldCell: L, newCell: E });
680
680
  }), f;
681
681
  }
682
- function Ti(a) {
682
+ function Si(a) {
683
683
  const e = [];
684
684
  return a.forValue((n, i, r) => {
685
- if (r == null || !Va(r)) return !0;
686
- const o = La(n, i);
685
+ if (r == null || !Ya(r)) return !0;
686
+ const o = Ta(n, i);
687
687
  e.push({ oldCell: o, newCell: o });
688
688
  }), e;
689
689
  }
690
- function Ei(a, e, n, i) {
690
+ function Ai(a, e, n, i) {
691
691
  if (e == null || n == null)
692
692
  return null;
693
693
  switch (a) {
694
694
  case 0:
695
- return Ni(e, n, i);
695
+ return Di(e, n, i);
696
696
  case 1:
697
- return Ri(e, n, i);
697
+ return bi(e, n, i);
698
698
  case 2:
699
- return Si(e, n, i);
699
+ return Oi(e, n, i);
700
700
  default:
701
701
  return null;
702
702
  }
703
703
  }
704
- function Ii(a, e) {
704
+ function Ci(a, e) {
705
705
  const { type: n, rangeFilteredRows: i } = e, r = e.range;
706
706
  let o = null, u = !1;
707
707
  switch (n) {
708
708
  case 3:
709
- o = Ai(r, a), u = !0;
709
+ o = Mi(r, a), u = !0;
710
710
  break;
711
711
  case 4:
712
- o = Ci(r, a), u = !0;
712
+ o = xi(r, a), u = !0;
713
713
  break;
714
714
  case 5:
715
- o = Di(r, a, i);
715
+ o = _i(r, a, i);
716
716
  break;
717
717
  case 6:
718
- o = bi(r, a);
718
+ o = yi(r, a);
719
719
  break;
720
720
  case 7:
721
- o = Oi(r, a);
721
+ o = qi(r, a);
722
722
  break;
723
723
  case 8:
724
- o = Mi(r, a);
724
+ o = gi(r, a);
725
725
  break;
726
726
  case 9:
727
- o = xi(r, a), u = !0;
727
+ o = hi(r, a), u = !0;
728
728
  break;
729
729
  case 10:
730
- o = _i(r, a), u = !0;
730
+ o = Ui(r, a), u = !0;
731
731
  break;
732
732
  }
733
733
  return { newCell: o, isReverse: u };
734
734
  }
735
- function Ni(a, e, n) {
736
- const i = Ca(
735
+ function Di(a, e, n) {
736
+ const i = ba(
737
737
  {
738
738
  id: H.MoveRangeCommandId,
739
739
  params: { toRange: e, fromRange: a }
@@ -742,8 +742,8 @@ function Ni(a, e, n) {
742
742
  );
743
743
  return w(i, n);
744
744
  }
745
- function Ri(a, e, n) {
746
- const i = Aa(
745
+ function bi(a, e, n) {
746
+ const i = Da(
747
747
  {
748
748
  id: H.MoveRowsCommandId,
749
749
  params: { toRange: e, fromRange: a }
@@ -752,8 +752,8 @@ function Ri(a, e, n) {
752
752
  );
753
753
  return w(i, n);
754
754
  }
755
- function Si(a, e, n) {
756
- const i = Sa(
755
+ function Oi(a, e, n) {
756
+ const i = Ca(
757
757
  {
758
758
  id: H.MoveColsCommandId,
759
759
  params: { toRange: e, fromRange: a }
@@ -762,28 +762,28 @@ function Si(a, e, n) {
762
762
  );
763
763
  return w(i, n);
764
764
  }
765
- function Ai(a, e) {
766
- const n = qa(
765
+ function Mi(a, e) {
766
+ const n = ha(
767
767
  {
768
768
  id: H.InsertRowCommandId,
769
- params: { range: a, unitId: "", subUnitId: "", direction: Ke.DOWN }
769
+ params: { range: a, unitId: "", subUnitId: "", direction: ke.DOWN }
770
770
  },
771
771
  e
772
772
  );
773
773
  return w(n, e);
774
774
  }
775
- function Ci(a, e) {
776
- const n = ya(
775
+ function xi(a, e) {
776
+ const n = ga(
777
777
  {
778
778
  id: H.InsertColCommandId,
779
- params: { range: a, unitId: "", subUnitId: "", direction: Ke.RIGHT }
779
+ params: { range: a, unitId: "", subUnitId: "", direction: ke.RIGHT }
780
780
  },
781
781
  e
782
782
  );
783
783
  return w(n, e);
784
784
  }
785
- function Di(a, e, n) {
786
- const i = _a(
785
+ function _i(a, e, n) {
786
+ const i = qa(
787
787
  {
788
788
  id: H.RemoveRowCommandId,
789
789
  params: { range: a }
@@ -793,8 +793,8 @@ function Di(a, e, n) {
793
793
  );
794
794
  return w(i, e);
795
795
  }
796
- function bi(a, e) {
797
- const n = xa(
796
+ function yi(a, e) {
797
+ const n = ya(
798
798
  {
799
799
  id: H.RemoveColCommandId,
800
800
  params: { range: a }
@@ -803,8 +803,8 @@ function bi(a, e) {
803
803
  );
804
804
  return w(n, e);
805
805
  }
806
- function Oi(a, e) {
807
- const n = Ma(
806
+ function qi(a, e) {
807
+ const n = _a(
808
808
  {
809
809
  id: H.DeleteRangeMoveLeftCommandId,
810
810
  params: { range: a }
@@ -813,8 +813,8 @@ function Oi(a, e) {
813
813
  );
814
814
  return w(n, e);
815
815
  }
816
- function Mi(a, e) {
817
- const n = Oa(
816
+ function gi(a, e) {
817
+ const n = xa(
818
818
  {
819
819
  id: H.DeleteRangeMoveUpCommandId,
820
820
  params: { range: a }
@@ -823,8 +823,8 @@ function Mi(a, e) {
823
823
  );
824
824
  return w(n, e);
825
825
  }
826
- function xi(a, e) {
827
- const n = ba(
826
+ function hi(a, e) {
827
+ const n = Ma(
828
828
  {
829
829
  id: H.InsertRangeMoveDownCommandId,
830
830
  params: { range: a }
@@ -833,8 +833,8 @@ function xi(a, e) {
833
833
  );
834
834
  return w(n, e);
835
835
  }
836
- function _i(a, e) {
837
- const n = Da(
836
+ function Ui(a, e) {
837
+ const n = Oa(
838
838
  {
839
839
  id: H.InsertRangeMoveRightCommandId,
840
840
  params: { range: a }
@@ -843,33 +843,33 @@ function _i(a, e) {
843
843
  );
844
844
  return w(n, e);
845
845
  }
846
- function yi(a, e, n) {
846
+ function Fi(a, e, n) {
847
847
  var r, o, u;
848
- const i = new G({});
848
+ const i = new V({});
849
849
  for (let f = 0; f < a.length; f++) {
850
850
  const { oldCell: m, newCell: c } = a[f];
851
851
  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) {
852
- const d = (u = n.getValue(m.startRow, m.startColumn)) != null ? u : e.getValue(m.startRow, m.startColumn), P = qe(d);
853
- i.setValue(c.startRow, c.startColumn, P);
852
+ const s = (u = n.getValue(m.startRow, m.startColumn)) != null ? u : e.getValue(m.startRow, m.startColumn), L = ge(s);
853
+ i.setValue(c.startRow, c.startColumn, L);
854
854
  }
855
855
  }
856
856
  return i.getMatrix();
857
857
  }
858
- function qi(a, e) {
859
- const n = new G({});
858
+ function Bi(a, e) {
859
+ const n = new V({});
860
860
  for (let i = a.length - 1; i >= 0; i--) {
861
- const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), f = qe(u);
861
+ const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), f = ge(u);
862
862
  if (n.setValue(r.startRow, r.startColumn, f), o) {
863
- const m = e.getValue(o.startRow, o.startColumn), c = qe(m);
863
+ const m = e.getValue(o.startRow, o.startColumn), c = ge(m);
864
864
  n.setValue(o.startRow, o.startColumn, c != null ? c : { f: null, si: null });
865
865
  }
866
866
  }
867
867
  return n.getMatrix();
868
868
  }
869
- function qe(a) {
869
+ function ge(a) {
870
870
  if (a == null)
871
- return;
872
- const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = Me(e), u = pa(n);
871
+ return null;
872
+ const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = ye(e), u = Pa(n);
873
873
  if (!o && !u)
874
874
  return {
875
875
  f: null,
@@ -878,18 +878,18 @@ function qe(a) {
878
878
  const f = {};
879
879
  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;
880
880
  }
881
- function gi(a) {
882
- const e = new G({});
883
- return new G(a).forValue((i, r, o) => {
884
- const u = qe(o);
885
- u && e.setValue(i, r, u);
881
+ function vi(a) {
882
+ const e = new V({});
883
+ return new V(a).forValue((i, r, o) => {
884
+ const u = ge(o);
885
+ u !== void 0 && e.setValue(i, r, u);
886
886
  }), e.getMatrix();
887
887
  }
888
- function Va(a) {
889
- const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = Me(e), r = pa(n);
888
+ function Ya(a) {
889
+ const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = ye(e), r = Pa(n);
890
890
  return !!(i || r);
891
891
  }
892
- function Ga(a, e, n, i, r, o) {
892
+ function Xa(a, e, n, i, r, o) {
893
893
  if ((r == null || r.length === 0) && (o == null || o.length === 0)) {
894
894
  if (a === n && e === i)
895
895
  return !0;
@@ -897,36 +897,36 @@ function Ga(a, e, n, i, r, o) {
897
897
  return !0;
898
898
  return !1;
899
899
  }
900
- function Ha(a, e, n = 0, i = 0) {
900
+ function Wa(a, e, n = 0, i = 0) {
901
901
  const r = [];
902
902
  for (let o = 0, u = a.length; o < u; o++) {
903
903
  const f = a[o];
904
- if (typeof f == "string" || f.nodeType !== te.REFERENCE || e.includes(o)) {
904
+ if (typeof f == "string" || f.nodeType !== ie.REFERENCE || e.includes(o)) {
905
905
  r.push(f);
906
906
  continue;
907
907
  }
908
- const { token: m } = f, c = Le(m), { range: d, sheetName: P, unitId: E } = c, p = me.moveOffset(d, n, i);
908
+ const { token: m } = f, c = Pe(m), { range: s, sheetName: L, unitId: E } = c, p = fe.moveOffset(s, n, i);
909
909
  r.push({
910
910
  ...f,
911
- token: ft({
911
+ token: st({
912
912
  range: p,
913
913
  unitId: E,
914
- sheetName: P
914
+ sheetName: L
915
915
  })
916
916
  });
917
917
  }
918
918
  return r;
919
919
  }
920
- function wa(a, e, n, i) {
921
- const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: d } = e, {
922
- range: P,
920
+ function Ka(a, e, n, i) {
921
+ const { type: r, unitId: o, sheetId: u, range: f, from: m, to: c, rangeFilteredRows: s } = e, {
922
+ range: L,
923
923
  sheetId: E,
924
924
  unitId: p,
925
925
  sheetName: I,
926
926
  refOffsetX: S,
927
927
  refOffsetY: R
928
928
  } = a;
929
- if (!Ga(
929
+ if (!Xa(
930
930
  o,
931
931
  u,
932
932
  n,
@@ -935,211 +935,211 @@ function wa(a, e, n, i) {
935
935
  E
936
936
  ))
937
937
  return;
938
- const s = me.moveOffset(P, S, R);
938
+ const d = fe.moveOffset(L, S, R);
939
939
  let A = null;
940
940
  if (r === _.MoveRange) {
941
941
  if (m == null || c == null)
942
942
  return;
943
- const N = It(s, m), L = We(s, m);
944
- if (L == null || N !== 4)
943
+ const N = bt(d, m), P = Ke(d, m);
944
+ if (P == null || N !== 4)
945
945
  return;
946
- const g = Ca(
946
+ const g = ba(
947
947
  { id: H.MoveRangeCommandId, params: { toRange: c, fromRange: m } },
948
- L
949
- ), q = w(g, L);
948
+ P
949
+ ), q = w(g, P);
950
950
  if (q == null)
951
- return Q.REF;
952
- A = Et(N, q, m, c, s, L);
951
+ return $.REF;
952
+ A = Dt(N, q, m, c, d, P);
953
953
  } else if (r === _.MoveRows) {
954
954
  if (m == null || c == null)
955
955
  return;
956
- const N = It(s, m);
957
- let L = We(s, m);
958
- if (L == null && (m.endRow < s.startRow && c.endRow <= s.startRow || m.startRow > s.endRow && c.startRow > s.endRow))
956
+ const N = bt(d, m);
957
+ let P = Ke(d, m);
958
+ if (P == null && (m.endRow < d.startRow && c.endRow <= d.startRow || m.startRow > d.endRow && c.startRow > d.endRow))
959
959
  return;
960
- L == null && (L = {
961
- startRow: s.startRow,
962
- endRow: s.endRow,
963
- startColumn: s.startColumn,
964
- endColumn: s.endColumn,
960
+ P == null && (P = {
961
+ startRow: d.startRow,
962
+ endRow: d.endRow,
963
+ startColumn: d.startColumn,
964
+ endColumn: d.endColumn,
965
965
  rangeType: Y.NORMAL
966
966
  });
967
- const g = Aa(
967
+ const g = Da(
968
968
  { id: H.MoveRowsCommandId, params: { toRange: c, fromRange: m } },
969
- L
970
- ), q = w(g, L);
969
+ P
970
+ ), q = w(g, P);
971
971
  if (q == null)
972
- return Q.REF;
973
- A = Et(N, q, m, c, s, L);
972
+ return $.REF;
973
+ A = Dt(N, q, m, c, d, P);
974
974
  } else if (r === _.MoveCols) {
975
975
  if (m == null || c == null)
976
976
  return;
977
- const N = It(s, m);
978
- let L = We(s, m);
979
- if (L == null && (m.endColumn < s.startColumn && c.endColumn <= s.startColumn || m.startColumn > s.endColumn && c.startColumn > s.endColumn))
977
+ const N = bt(d, m);
978
+ let P = Ke(d, m);
979
+ if (P == null && (m.endColumn < d.startColumn && c.endColumn <= d.startColumn || m.startColumn > d.endColumn && c.startColumn > d.endColumn))
980
980
  return;
981
- L == null && (L = {
982
- startRow: s.startRow,
983
- endRow: s.endRow,
984
- startColumn: s.startColumn,
985
- endColumn: s.endColumn,
981
+ P == null && (P = {
982
+ startRow: d.startRow,
983
+ endRow: d.endRow,
984
+ startColumn: d.startColumn,
985
+ endColumn: d.endColumn,
986
986
  rangeType: Y.NORMAL
987
987
  });
988
- const g = Sa(
988
+ const g = Ca(
989
989
  { id: H.MoveColsCommandId, params: { toRange: c, fromRange: m } },
990
- L
991
- ), q = w(g, L);
990
+ P
991
+ ), q = w(g, P);
992
992
  if (q == null)
993
- return Q.REF;
994
- A = Et(N, q, m, c, s, L);
993
+ return $.REF;
994
+ A = Dt(N, q, m, c, d, P);
995
995
  }
996
996
  if (f != null) {
997
997
  if (r === _.InsertRow) {
998
- const N = qa(
998
+ const N = ha(
999
999
  {
1000
1000
  id: H.InsertRowCommandId,
1001
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.DOWN }
1001
+ params: { range: f, unitId: "", subUnitId: "", direction: ke.DOWN }
1002
1002
  },
1003
- s
1004
- ), L = w(N, s);
1005
- if (L == null)
1003
+ d
1004
+ ), P = w(N, d);
1005
+ if (P == null)
1006
1006
  return;
1007
1007
  A = {
1008
- ...s,
1009
- ...L
1008
+ ...d,
1009
+ ...P
1010
1010
  };
1011
1011
  } else if (r === _.InsertColumn) {
1012
- const N = ya(
1012
+ const N = ga(
1013
1013
  {
1014
1014
  id: H.InsertColCommandId,
1015
- params: { range: f, unitId: "", subUnitId: "", direction: Ke.RIGHT }
1015
+ params: { range: f, unitId: "", subUnitId: "", direction: ke.RIGHT }
1016
1016
  },
1017
- s
1018
- ), L = w(N, s);
1019
- if (L == null)
1017
+ d
1018
+ ), P = w(N, d);
1019
+ if (P == null)
1020
1020
  return;
1021
1021
  A = {
1022
- ...s,
1023
- ...L
1022
+ ...d,
1023
+ ...P
1024
1024
  };
1025
1025
  } else if (r === _.RemoveRow) {
1026
- const N = _a(
1026
+ const N = qa(
1027
1027
  {
1028
1028
  id: H.RemoveRowCommandId,
1029
1029
  params: { range: f }
1030
1030
  },
1031
- s,
1032
- d
1033
- ), L = w(N, s);
1034
- if (L == null)
1035
- return Q.REF;
1031
+ d,
1032
+ s
1033
+ ), P = w(N, d);
1034
+ if (P == null)
1035
+ return $.REF;
1036
1036
  A = {
1037
- ...s,
1038
- ...L
1037
+ ...d,
1038
+ ...P
1039
1039
  };
1040
1040
  } else if (r === _.RemoveColumn) {
1041
- const N = xa(
1041
+ const N = ya(
1042
1042
  {
1043
1043
  id: H.RemoveColCommandId,
1044
1044
  params: { range: f }
1045
1045
  },
1046
- s
1047
- ), L = w(N, s);
1048
- if (L == null)
1049
- return Q.REF;
1046
+ d
1047
+ ), P = w(N, d);
1048
+ if (P == null)
1049
+ return $.REF;
1050
1050
  A = {
1051
- ...s,
1052
- ...L
1051
+ ...d,
1052
+ ...P
1053
1053
  };
1054
1054
  } else if (r === _.DeleteMoveLeft) {
1055
- const N = Ma(
1055
+ const N = _a(
1056
1056
  {
1057
1057
  id: H.DeleteRangeMoveLeftCommandId,
1058
1058
  params: { range: f }
1059
1059
  },
1060
- s
1061
- ), L = w(N, s);
1062
- if (L == null)
1063
- return Q.REF;
1060
+ d
1061
+ ), P = w(N, d);
1062
+ if (P == null)
1063
+ return $.REF;
1064
1064
  A = {
1065
- ...s,
1066
- ...L
1065
+ ...d,
1066
+ ...P
1067
1067
  };
1068
1068
  } else if (r === _.DeleteMoveUp) {
1069
- const N = Oa(
1069
+ const N = xa(
1070
1070
  {
1071
1071
  id: H.DeleteRangeMoveUpCommandId,
1072
1072
  params: { range: f }
1073
1073
  },
1074
- s
1075
- ), L = w(N, s);
1076
- if (L == null)
1077
- return Q.REF;
1074
+ d
1075
+ ), P = w(N, d);
1076
+ if (P == null)
1077
+ return $.REF;
1078
1078
  A = {
1079
- ...s,
1080
- ...L
1079
+ ...d,
1080
+ ...P
1081
1081
  };
1082
1082
  } else if (r === _.InsertMoveDown) {
1083
- const N = ba(
1083
+ const N = Ma(
1084
1084
  {
1085
1085
  id: H.InsertRangeMoveDownCommandId,
1086
1086
  params: { range: f }
1087
1087
  },
1088
- s
1089
- ), L = w(N, s);
1090
- if (L == null)
1088
+ d
1089
+ ), P = w(N, d);
1090
+ if (P == null)
1091
1091
  return;
1092
1092
  A = {
1093
- ...s,
1094
- ...L
1093
+ ...d,
1094
+ ...P
1095
1095
  };
1096
1096
  } else if (r === _.InsertMoveRight) {
1097
- const N = Da(
1097
+ const N = Oa(
1098
1098
  {
1099
1099
  id: H.InsertRangeMoveRightCommandId,
1100
1100
  params: { range: f }
1101
1101
  },
1102
- s
1103
- ), L = w(N, s);
1104
- if (L == null)
1102
+ d
1103
+ ), P = w(N, d);
1104
+ if (P == null)
1105
1105
  return;
1106
1106
  A = {
1107
- ...s,
1108
- ...L
1107
+ ...d,
1108
+ ...P
1109
1109
  };
1110
1110
  }
1111
1111
  }
1112
1112
  if (A != null)
1113
- return ft({
1113
+ return st({
1114
1114
  range: A,
1115
1115
  sheetName: I,
1116
1116
  unitId: p
1117
1117
  });
1118
1118
  }
1119
- function Et(a, e, n, i, r, o) {
1120
- const { startRow: u, endRow: f, startColumn: m, endColumn: c, rangeType: d } = be(e), {
1121
- startRow: P,
1119
+ function Dt(a, e, n, i, r, o) {
1120
+ const { startRow: u, endRow: f, startColumn: m, endColumn: c, rangeType: s } = xe(e), {
1121
+ startRow: L,
1122
1122
  startColumn: E,
1123
1123
  endRow: p,
1124
1124
  endColumn: I,
1125
1125
  rangeType: S = Y.NORMAL
1126
- } = be(n), { startRow: R, startColumn: s, endRow: A, endColumn: N } = be(i), {
1127
- startRow: L,
1126
+ } = xe(n), { startRow: R, startColumn: d, endRow: A, endColumn: N } = xe(i), {
1127
+ startRow: P,
1128
1128
  endRow: g,
1129
1129
  startColumn: q,
1130
1130
  endColumn: U
1131
- } = be(o), {
1131
+ } = xe(o), {
1132
1132
  startRow: h,
1133
1133
  endRow: M,
1134
1134
  startColumn: F,
1135
1135
  endColumn: B,
1136
- rangeType: J = Y.NORMAL
1137
- } = be(r), O = { ...r };
1136
+ rangeType: ae = Y.NORMAL
1137
+ } = xe(r), O = { ...r };
1138
1138
  function ce() {
1139
- return d === Y.COLUMN && J === Y.COLUMN ? !0 : m >= F && c <= B;
1139
+ return s === Y.COLUMN && ae === Y.COLUMN ? !0 : m >= F && c <= B;
1140
1140
  }
1141
- function ee() {
1142
- return d === Y.ROW && J === Y.ROW ? !0 : u >= h && f <= M;
1141
+ function ne() {
1142
+ return s === Y.ROW && ae === Y.ROW ? !0 : u >= h && f <= M;
1143
1143
  }
1144
1144
  if (a === 0)
1145
1145
  if (ce())
@@ -1156,13 +1156,13 @@ function Et(a, e, n, i, r, o) {
1156
1156
  if (f > M)
1157
1157
  O.endRow = f;
1158
1158
  else if (f <= h)
1159
- O.startRow += M - P + 1;
1159
+ O.startRow += M - L + 1;
1160
1160
  else
1161
1161
  return;
1162
1162
  else
1163
1163
  return;
1164
1164
  else if (a === 2)
1165
- if (ee())
1165
+ if (ne())
1166
1166
  if (m < F)
1167
1167
  O.startColumn = m;
1168
1168
  else if (m >= B)
@@ -1172,7 +1172,7 @@ function Et(a, e, n, i, r, o) {
1172
1172
  else
1173
1173
  return;
1174
1174
  else if (a === 3)
1175
- if (ee())
1175
+ if (ne())
1176
1176
  if (c > B)
1177
1177
  O.endColumn = c;
1178
1178
  else if (c <= F)
@@ -1181,91 +1181,91 @@ function Et(a, e, n, i, r, o) {
1181
1181
  return;
1182
1182
  else
1183
1183
  return;
1184
- else a === 4 ? (O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c) : E <= F && I >= B || S === Y.ROW && J === Y.ROW ? n.endRow < h ? (R >= h && (O.startRow -= p - P + 1), R >= M && (O.endRow -= p - P + 1)) : n.startRow > M ? (A <= M && (O.endRow += p - P + 1), A <= h && (O.startRow += p - P + 1)) : n.startRow >= h && n.endRow <= M && (R <= h ? O.startRow += p - P + 1 : R >= M && (O.endRow -= p - P + 1)) : P <= h && p >= M || S === Y.COLUMN && J === Y.COLUMN ? n.endColumn < F ? (s >= F && (O.startColumn -= I - E + 1), s >= B && (O.endColumn -= I - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += I - E + 1), N <= F && (O.startColumn += I - E + 1)) : n.startColumn >= F && n.endColumn <= B && (s <= F ? O.startColumn += I - E + 1 : s >= B && (O.endColumn -= I - E + 1)) : ((s <= U + 1 && N >= B || s <= F && N >= q - 1) && R <= h && A >= M || (R <= g + 1 && A >= M || R <= h && A >= L - 1) && s <= F && N >= B, O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c);
1184
+ else a === 4 ? (O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c) : E <= F && I >= B || S === Y.ROW && ae === Y.ROW ? n.endRow < h ? (R >= h && (O.startRow -= p - L + 1), R >= M && (O.endRow -= p - L + 1)) : n.startRow > M ? (A <= M && (O.endRow += p - L + 1), A <= h && (O.startRow += p - L + 1)) : n.startRow >= h && n.endRow <= M && (R <= h ? O.startRow += p - L + 1 : R >= M && (O.endRow -= p - L + 1)) : L <= h && p >= M || S === Y.COLUMN && ae === Y.COLUMN ? n.endColumn < F ? (d >= F && (O.startColumn -= I - E + 1), d >= B && (O.endColumn -= I - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += I - E + 1), N <= F && (O.startColumn += I - E + 1)) : n.startColumn >= F && n.endColumn <= B && (d <= F ? O.startColumn += I - E + 1 : d >= B && (O.endColumn -= I - E + 1)) : ((d <= U + 1 && N >= B || d <= F && N >= q - 1) && R <= h && A >= M || (R <= g + 1 && A >= M || R <= h && A >= P - 1) && d <= F && N >= B, O.startRow = u, O.startColumn = m, O.endRow = f, O.endColumn = c);
1185
1185
  return O;
1186
1186
  }
1187
- function It(a, e) {
1188
- 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);
1189
- function d() {
1187
+ function bt(a, e) {
1188
+ const n = Se(a.startRow), i = Ae(a.endRow), r = Se(a.startColumn), o = Ae(a.endColumn), u = Se(e.startRow), f = Ae(e.endRow), m = Se(e.startColumn), c = Ae(e.endColumn);
1189
+ function s() {
1190
1190
  return a.rangeType === Y.COLUMN && e.rangeType === Y.COLUMN ? !0 : n >= u && i <= f;
1191
1191
  }
1192
- function P() {
1192
+ function L() {
1193
1193
  return a.rangeType === Y.ROW && e.rangeType === Y.ROW ? !0 : r >= m && o <= c;
1194
1194
  }
1195
1195
  function E() {
1196
1196
  return a.rangeType === Y.ALL && e.rangeType === Y.ALL;
1197
1197
  }
1198
- return d() && P() || E() ? 4 : P() && n >= u && n <= f && i > f ? 0 : P() && i >= u && i <= f && n < u ? 1 : d() && r >= m && r <= c && o > c ? 2 : d() && o >= m && o <= c && r < m ? 3 : null;
1198
+ return s() && L() || E() ? 4 : L() && n >= u && n <= f && i > f ? 0 : L() && i >= u && i <= f && n < u ? 1 : s() && r >= m && r <= c && o > c ? 2 : s() && o >= m && o <= c && r < m ? 3 : null;
1199
1199
  }
1200
- function Ne(a) {
1200
+ function Se(a) {
1201
1201
  return isNaN(a) ? -1 / 0 : a;
1202
1202
  }
1203
- function Re(a) {
1203
+ function Ae(a) {
1204
1204
  return isNaN(a) ? 1 / 0 : a;
1205
1205
  }
1206
- function be(a) {
1206
+ function xe(a) {
1207
1207
  const { startRow: e, endRow: n, startColumn: i, endColumn: r } = a;
1208
1208
  return {
1209
1209
  ...a,
1210
- startRow: Ne(e),
1211
- endRow: Re(n),
1212
- startColumn: Ne(i),
1213
- endColumn: Re(r)
1210
+ startRow: Se(e),
1211
+ endRow: Ae(n),
1212
+ startColumn: Se(i),
1213
+ endColumn: Ae(r)
1214
1214
  };
1215
1215
  }
1216
- function Ya(a, e) {
1216
+ function ka(a, e) {
1217
1217
  const { id: n } = e;
1218
1218
  let i = null;
1219
1219
  switch (n) {
1220
+ case Sn.id:
1221
+ i = Vi(e, a);
1222
+ break;
1223
+ case Rn.id:
1224
+ i = Gi(e, a);
1225
+ break;
1226
+ case Nn.id:
1227
+ i = Hi(e, a);
1228
+ break;
1229
+ case In.id:
1230
+ i = wi(e);
1231
+ break;
1220
1232
  case En.id:
1221
- i = hi(e, a);
1233
+ i = Yi(e);
1222
1234
  break;
1223
1235
  case Tn.id:
1224
- i = Ui(e, a);
1236
+ i = Xi(e, a);
1225
1237
  break;
1226
1238
  case Pn.id:
1227
- i = Fi(e, a);
1239
+ i = Wi(e, a);
1228
1240
  break;
1229
1241
  case Ln.id:
1230
- i = Bi(e);
1242
+ i = Ki(e, a);
1231
1243
  break;
1232
1244
  case pn.id:
1233
- i = vi(e);
1245
+ i = ki(e, a);
1234
1246
  break;
1235
1247
  case dn.id:
1236
- i = Vi(e, a);
1248
+ i = Qi(e, a);
1237
1249
  break;
1238
1250
  case sn.id:
1239
- i = Gi(e, a);
1251
+ i = $i(e, a);
1240
1252
  break;
1241
1253
  case ln.id:
1242
- i = Hi(e, a);
1254
+ i = ji(e, a);
1243
1255
  break;
1244
1256
  case cn.id:
1245
- i = wi(e, a);
1246
- break;
1247
- case fn.id:
1248
- i = Yi(e, a);
1249
- break;
1250
- case mn.id:
1251
- i = Xi(e, a);
1257
+ i = zi(e, a);
1252
1258
  break;
1253
- case un.id:
1254
- i = Wi(e, a);
1259
+ case Fa.id:
1260
+ i = Zi(e, a);
1255
1261
  break;
1256
- case on.id:
1257
- i = Ki(e, a);
1258
- break;
1259
- case ha.id:
1260
- i = ki(e, a);
1261
- break;
1262
- case ga.id:
1263
- i = Qi(e, a);
1262
+ case Ua.id:
1263
+ i = Ji(e, a);
1264
1264
  break;
1265
1265
  }
1266
1266
  return i;
1267
1267
  }
1268
- function Z(a) {
1268
+ function te(a) {
1269
1269
  var i;
1270
1270
  const e = a.getUnitId(), n = ((i = a.getActiveSheet()) == null ? void 0 : i.getSheetId()) || "";
1271
1271
  return {
@@ -1273,12 +1273,12 @@ function Z(a) {
1273
1273
  sheetId: n
1274
1274
  };
1275
1275
  }
1276
- function hi(a, e) {
1276
+ function Vi(a, e) {
1277
1277
  const { params: n } = a;
1278
1278
  if (!n) return null;
1279
1279
  const { fromRange: i, toRange: r } = n;
1280
1280
  if (!i || !r) return null;
1281
- const { unitId: o, sheetId: u } = Z(e);
1281
+ const { unitId: o, sheetId: u } = te(e);
1282
1282
  return {
1283
1283
  type: _.MoveRange,
1284
1284
  from: i,
@@ -1287,7 +1287,7 @@ function hi(a, e) {
1287
1287
  sheetId: u
1288
1288
  };
1289
1289
  }
1290
- function Ui(a, e) {
1290
+ function Gi(a, e) {
1291
1291
  const { params: n } = a;
1292
1292
  if (!n) return null;
1293
1293
  const {
@@ -1295,13 +1295,13 @@ function Ui(a, e) {
1295
1295
  toRange: { startRow: o, endRow: u }
1296
1296
  } = n, f = e.getUnitId(), m = e.getActiveSheet();
1297
1297
  if (!m) return null;
1298
- const c = m.getSheetId(), d = {
1298
+ const c = m.getSheetId(), s = {
1299
1299
  startRow: i,
1300
1300
  startColumn: 0,
1301
1301
  endRow: r,
1302
1302
  endColumn: m.getColumnCount() - 1,
1303
1303
  rangeType: Y.ROW
1304
- }, P = {
1304
+ }, L = {
1305
1305
  startRow: o,
1306
1306
  startColumn: 0,
1307
1307
  endRow: u,
@@ -1310,13 +1310,13 @@ function Ui(a, e) {
1310
1310
  };
1311
1311
  return {
1312
1312
  type: _.MoveRows,
1313
- from: d,
1314
- to: P,
1313
+ from: s,
1314
+ to: L,
1315
1315
  unitId: f,
1316
1316
  sheetId: c
1317
1317
  };
1318
1318
  }
1319
- function Fi(a, e) {
1319
+ function Hi(a, e) {
1320
1320
  const { params: n } = a;
1321
1321
  if (!n) return null;
1322
1322
  const {
@@ -1324,13 +1324,13 @@ function Fi(a, e) {
1324
1324
  toRange: { startColumn: o, endColumn: u }
1325
1325
  } = n, f = e.getUnitId(), m = e.getActiveSheet();
1326
1326
  if (!m) return null;
1327
- const c = m.getSheetId(), d = {
1327
+ const c = m.getSheetId(), s = {
1328
1328
  startRow: 0,
1329
1329
  startColumn: i,
1330
1330
  endRow: m.getRowCount() - 1,
1331
1331
  endColumn: r,
1332
1332
  rangeType: Y.COLUMN
1333
- }, P = {
1333
+ }, L = {
1334
1334
  startRow: 0,
1335
1335
  startColumn: o,
1336
1336
  endRow: m.getRowCount() - 1,
@@ -1339,13 +1339,13 @@ function Fi(a, e) {
1339
1339
  };
1340
1340
  return {
1341
1341
  type: _.MoveCols,
1342
- from: d,
1343
- to: P,
1342
+ from: s,
1343
+ to: L,
1344
1344
  unitId: f,
1345
1345
  sheetId: c
1346
1346
  };
1347
1347
  }
1348
- function Bi(a) {
1348
+ function wi(a) {
1349
1349
  const { params: e } = a;
1350
1350
  if (!e) return null;
1351
1351
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1356,7 +1356,7 @@ function Bi(a) {
1356
1356
  sheetId: r
1357
1357
  };
1358
1358
  }
1359
- function vi(a) {
1359
+ function Yi(a) {
1360
1360
  const { params: e } = a;
1361
1361
  if (!e) return null;
1362
1362
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -1367,10 +1367,10 @@ function vi(a) {
1367
1367
  sheetId: r
1368
1368
  };
1369
1369
  }
1370
- function Vi(a, e) {
1370
+ function Xi(a, e) {
1371
1371
  const { params: n } = a;
1372
1372
  if (!n) return null;
1373
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1373
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1374
1374
  return {
1375
1375
  type: _.InsertMoveRight,
1376
1376
  range: i,
@@ -1378,10 +1378,10 @@ function Vi(a, e) {
1378
1378
  sheetId: o
1379
1379
  };
1380
1380
  }
1381
- function Gi(a, e) {
1381
+ function Wi(a, e) {
1382
1382
  const { params: n } = a;
1383
1383
  if (!n) return null;
1384
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1384
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1385
1385
  return {
1386
1386
  type: _.InsertMoveDown,
1387
1387
  range: i,
@@ -1389,11 +1389,11 @@ function Gi(a, e) {
1389
1389
  sheetId: o
1390
1390
  };
1391
1391
  }
1392
- function Hi(a, e) {
1392
+ function Ki(a, e) {
1393
1393
  var u, f;
1394
1394
  const { params: n } = a;
1395
1395
  if (!n) return null;
1396
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1396
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1397
1397
  return {
1398
1398
  type: _.RemoveRow,
1399
1399
  range: i,
@@ -1402,10 +1402,10 @@ function Hi(a, e) {
1402
1402
  rangeFilteredRows: (f = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? f : []
1403
1403
  };
1404
1404
  }
1405
- function wi(a, e) {
1405
+ function ki(a, e) {
1406
1406
  const { params: n } = a;
1407
1407
  if (!n) return null;
1408
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1408
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1409
1409
  return {
1410
1410
  type: _.RemoveColumn,
1411
1411
  range: i,
@@ -1413,10 +1413,10 @@ function wi(a, e) {
1413
1413
  sheetId: o
1414
1414
  };
1415
1415
  }
1416
- function Yi(a, e) {
1416
+ function Qi(a, e) {
1417
1417
  const { params: n } = a;
1418
1418
  if (!n) return null;
1419
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1419
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1420
1420
  return {
1421
1421
  type: _.DeleteMoveUp,
1422
1422
  range: i,
@@ -1424,10 +1424,10 @@ function Yi(a, e) {
1424
1424
  sheetId: o
1425
1425
  };
1426
1426
  }
1427
- function Xi(a, e) {
1427
+ function $i(a, e) {
1428
1428
  const { params: n } = a;
1429
1429
  if (!n) return null;
1430
- const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
1430
+ const { range: i } = n, { unitId: r, sheetId: o } = te(e);
1431
1431
  return {
1432
1432
  type: _.DeleteMoveLeft,
1433
1433
  range: i,
@@ -1435,10 +1435,10 @@ function Xi(a, e) {
1435
1435
  sheetId: o
1436
1436
  };
1437
1437
  }
1438
- function Wi(a, e) {
1438
+ function ji(a, e) {
1439
1439
  const { params: n } = a;
1440
1440
  if (!n) return null;
1441
- const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: f } = Z(e);
1441
+ const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: f } = te(e);
1442
1442
  return {
1443
1443
  type: _.SetName,
1444
1444
  unitId: i || u,
@@ -1446,20 +1446,20 @@ function Wi(a, e) {
1446
1446
  sheetName: o
1447
1447
  };
1448
1448
  }
1449
- function Ki(a, e) {
1449
+ function zi(a, e) {
1450
1450
  const { params: n } = a;
1451
1451
  if (!n) return null;
1452
- const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = Z(e);
1452
+ const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = te(e);
1453
1453
  return {
1454
1454
  type: _.RemoveSheet,
1455
1455
  unitId: i || o,
1456
1456
  sheetId: r || u
1457
1457
  };
1458
1458
  }
1459
- function ki(a, e) {
1459
+ function Zi(a, e) {
1460
1460
  const { params: n } = a;
1461
1461
  if (!n) return null;
1462
- const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
1462
+ const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
1463
1463
  return {
1464
1464
  type: _.SetDefinedName,
1465
1465
  unitId: i,
@@ -1468,10 +1468,10 @@ function ki(a, e) {
1468
1468
  definedNameId: o
1469
1469
  };
1470
1470
  }
1471
- function Qi(a, e) {
1471
+ function Ji(a, e) {
1472
1472
  const { params: n } = a;
1473
1473
  if (!n) return null;
1474
- const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
1474
+ const { unitId: i, name: r, id: o } = n, { sheetId: u } = te(e);
1475
1475
  return {
1476
1476
  type: _.RemoveDefinedName,
1477
1477
  unitId: i,
@@ -1480,12 +1480,12 @@ function Qi(a, e) {
1480
1480
  definedNameId: o
1481
1481
  };
1482
1482
  }
1483
- var $i = Object.getOwnPropertyDescriptor, ji = (a, e, n, i) => {
1484
- for (var r = i > 1 ? void 0 : i ? $i(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1483
+ var er = Object.getOwnPropertyDescriptor, tr = (a, e, n, i) => {
1484
+ for (var r = i > 1 ? void 0 : i ? er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1485
1485
  (u = a[o]) && (r = u(r) || r);
1486
1486
  return r;
1487
- }, Ve = (a, e) => (n, i) => e(n, i, a);
1488
- let ze = class extends ne {
1487
+ }, Ge = (a, e) => (n, i) => e(n, i, a);
1488
+ let Je = class extends ee {
1489
1489
  constructor(a, e, n, i) {
1490
1490
  super(), this._definedNamesService = a, this._univerInstanceService = e, this._sheetInterceptorService = n, this._lexerTreeBuilder = i, this._initialize();
1491
1491
  }
@@ -1496,18 +1496,18 @@ let ze = class extends ne {
1496
1496
  this.disposeWithMe(
1497
1497
  this._sheetInterceptorService.interceptCommand({
1498
1498
  getMutations: (a) => {
1499
- if (a.id === ha.id || a.id === ga.id)
1499
+ if (a.id === Fa.id || a.id === Ua.id)
1500
1500
  return {
1501
1501
  redos: [],
1502
1502
  undos: []
1503
1503
  };
1504
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
1504
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
1505
1505
  if (e == null)
1506
1506
  return {
1507
1507
  redos: [],
1508
1508
  undos: []
1509
1509
  };
1510
- const n = Ya(e, a);
1510
+ const n = ka(e, a);
1511
1511
  return n ? this._getUpdateDefinedNameMutations(e, n) : {
1512
1512
  redos: [],
1513
1513
  undos: []
@@ -1527,16 +1527,16 @@ let ze = class extends ne {
1527
1527
  const u = [], f = [];
1528
1528
  return Object.values(o).forEach((m) => {
1529
1529
  var R;
1530
- const { formulaOrRefString: c } = m, d = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1531
- if (d == null)
1530
+ const { formulaOrRefString: c } = m, s = this._lexerTreeBuilder.sequenceNodesBuilder(c);
1531
+ if (s == null)
1532
1532
  return !0;
1533
- let P = !1;
1533
+ let L = !1;
1534
1534
  const E = [];
1535
- for (let s = 0, A = d.length; s < A; s++) {
1536
- const N = d[s];
1537
- if (typeof N == "string" || N.nodeType !== te.REFERENCE)
1535
+ for (let d = 0, A = s.length; d < A; d++) {
1536
+ const N = s[d];
1537
+ if (typeof N == "string" || N.nodeType !== ie.REFERENCE)
1538
1538
  continue;
1539
- const { token: L } = N, g = Le(L), { range: q, sheetName: U, unitId: h } = g, M = ((R = a.getSheetBySheetName(U)) == null ? void 0 : R.getSheetId()) || "", F = {
1539
+ const { token: P } = N, g = Pe(P), { range: q, sheetName: U, unitId: h } = g, M = ((R = a.getSheetBySheetName(U)) == null ? void 0 : R.getSheetId()) || "", F = {
1540
1540
  range: q,
1541
1541
  sheetId: M,
1542
1542
  unitId: h,
@@ -1549,32 +1549,32 @@ let ze = class extends ne {
1549
1549
  B = this._removeSheet(m, i, r);
1550
1550
  else if (n === _.SetName) {
1551
1551
  const {
1552
- sheetId: J,
1552
+ sheetId: ae,
1553
1553
  sheetName: O
1554
1554
  } = e;
1555
- if (O == null || M == null || M.length === 0 || J !== M)
1555
+ if (O == null || M == null || M.length === 0 || ae !== M)
1556
1556
  continue;
1557
- B = ft({
1557
+ B = st({
1558
1558
  range: q,
1559
1559
  sheetName: O,
1560
1560
  unitId: h
1561
1561
  });
1562
1562
  } else
1563
- B = wa(
1563
+ B = Ka(
1564
1564
  F,
1565
1565
  e,
1566
1566
  i,
1567
1567
  r
1568
1568
  );
1569
- B != null && (d[s] = {
1569
+ B != null && (s[d] = {
1570
1570
  ...N,
1571
1571
  token: B
1572
- }, P = !0, E.push(s));
1572
+ }, L = !0, E.push(d));
1573
1573
  }
1574
- if (!P)
1574
+ if (!L)
1575
1575
  return !0;
1576
- const p = $e(Ha(d, E)), I = {
1577
- id: ye.id,
1576
+ const p = je(Wa(s, E)), I = {
1577
+ id: De.id,
1578
1578
  params: {
1579
1579
  unitId: i,
1580
1580
  ...m,
@@ -1583,7 +1583,7 @@ let ze = class extends ne {
1583
1583
  };
1584
1584
  u.push(I);
1585
1585
  const S = {
1586
- id: ye.id,
1586
+ id: De.id,
1587
1587
  params: {
1588
1588
  unitId: i,
1589
1589
  ...m
@@ -1598,21 +1598,21 @@ let ze = class extends ne {
1598
1598
  _removeSheet(a, e, n) {
1599
1599
  var o;
1600
1600
  const { formulaOrRefString: i } = a;
1601
- return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? Q.REF : null;
1601
+ return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? $.REF : null;
1602
1602
  }
1603
1603
  };
1604
- ze = ji([
1605
- Ve(0, Bt),
1606
- Ve(1, Se),
1607
- Ve(2, X(Ut)),
1608
- Ve(3, X(vt))
1609
- ], ze);
1610
- var zi = Object.getOwnPropertyDescriptor, Zi = (a, e, n, i) => {
1611
- for (var r = i > 1 ? void 0 : i ? zi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1604
+ Je = tr([
1605
+ Ge(0, dt),
1606
+ Ge(1, Ee),
1607
+ Ge(2, X(wt)),
1608
+ Ge(3, X(pt))
1609
+ ], Je);
1610
+ var ar = Object.getOwnPropertyDescriptor, nr = (a, e, n, i) => {
1611
+ for (var r = i > 1 ? void 0 : i ? ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1612
1612
  (u = a[o]) && (r = u(r) || r);
1613
1613
  return r;
1614
- }, ue = (a, e) => (n, i) => e(n, i, a);
1615
- let Ze = class extends ne {
1614
+ }, me = (a, e) => (n, i) => e(n, i, a);
1615
+ let et = class extends ee {
1616
1616
  constructor(a, e, n, i, r, o, u, f) {
1617
1617
  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();
1618
1618
  }
@@ -1622,44 +1622,47 @@ let Ze = class extends ne {
1622
1622
  })), this.disposeWithMe(
1623
1623
  this._commandService.onCommandExecuted((a) => {
1624
1624
  if (a.params)
1625
- if (a.id === At.id) {
1625
+ if (a.id === _t.id) {
1626
1626
  const { subUnitId: e, unitId: n } = a.params;
1627
1627
  this._handleWorkbookDisposed(n, e);
1628
- } else a.id === Ct.id && this._handleInsertSheetMutation(a.params);
1628
+ } else a.id === yt.id && this._handleInsertSheetMutation(a.params);
1629
1629
  })
1630
1630
  ), this.disposeWithMe(
1631
1631
  this._commandService.beforeCommandExecuted((a, e) => {
1632
- if (a.id === z.id) {
1632
+ if (a.id === k.id) {
1633
1633
  const n = a.params;
1634
- if (e && e.onlyLocal === !0 || n.trigger === ht.id || n.trigger === Na.id || n.trigger === Ra.id)
1634
+ if (e && e.onlyLocal === !0 || n.trigger === Ht.id || n.trigger === Sa.id || n.trigger === Aa.id)
1635
1635
  return;
1636
1636
  this._handleSetRangeValuesMutation(n);
1637
1637
  }
1638
1638
  })
1639
- ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ae.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ae.UNIVER_SHEET).pipe(ei((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1639
+ ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(j.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(j.UNIVER_SHEET).pipe(ri((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1640
1640
  }
1641
1641
  _handleSetRangeValuesMutation(a) {
1642
1642
  const { subUnitId: e, unitId: n, cellValue: i } = a;
1643
1643
  if (i == null)
1644
1644
  return;
1645
- const r = this._formulaDataModel.updateFormulaData(n, e, i), o = {
1645
+ const r = this._formulaDataModel.updateFormulaData(n, e, i);
1646
+ if (Object.keys(r).length === 0)
1647
+ return;
1648
+ const o = {
1646
1649
  [n]: {
1647
1650
  [e]: r
1648
1651
  }
1649
1652
  };
1650
1653
  this._commandService.executeCommand(
1651
- z.id,
1654
+ k.id,
1652
1655
  {
1653
1656
  unitId: n,
1654
1657
  subUnitId: e,
1655
- cellValue: gi(r)
1658
+ cellValue: vi(r)
1656
1659
  },
1657
1660
  {
1658
1661
  onlyLocal: !0,
1659
1662
  fromFormula: !0
1660
1663
  }
1661
1664
  ), this._formulaDataModel.updateArrayFormulaCellData(n, e, i), this._formulaDataModel.updateArrayFormulaRange(n, e, i), this._commandService.executeCommand(
1662
- ve.id,
1665
+ Ve.id,
1663
1666
  {
1664
1667
  formulaData: o
1665
1668
  },
@@ -1667,7 +1670,7 @@ let Ze = class extends ne {
1667
1670
  onlyLocal: !0
1668
1671
  }
1669
1672
  ), this._commandService.executeCommand(
1670
- Dt.id,
1673
+ qt.id,
1671
1674
  {
1672
1675
  arrayFormulaRange: this._formulaDataModel.getArrayFormulaRange(),
1673
1676
  arrayFormulaCellData: this._formulaDataModel.getArrayFormulaCellData()
@@ -1680,9 +1683,9 @@ let Ze = class extends ne {
1680
1683
  );
1681
1684
  }
1682
1685
  _handleWorkbookDisposed(a, e) {
1683
- const n = this._formulaDataModel.getFormulaData(), i = Tt(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Tt(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), f = Tt(u, a, e);
1686
+ 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);
1684
1687
  i && this._commandService.executeCommand(
1685
- ve.id,
1688
+ Ve.id,
1686
1689
  {
1687
1690
  formulaData: i
1688
1691
  },
@@ -1690,7 +1693,7 @@ let Ze = class extends ne {
1690
1693
  onlyLocal: !0
1691
1694
  }
1692
1695
  ), o && f && this._commandService.executeCommand(
1693
- Dt.id,
1696
+ qt.id,
1694
1697
  {
1695
1698
  arrayFormulaRange: r,
1696
1699
  arrayFormulaCellData: u
@@ -1701,9 +1704,9 @@ let Ze = class extends ne {
1701
1704
  );
1702
1705
  }
1703
1706
  _handleInsertSheetMutation(a) {
1704
- const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new G(o), f = na(i, n, r, u);
1707
+ const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o), f = oa(i, n, r, u);
1705
1708
  this._commandService.executeCommand(
1706
- ve.id,
1709
+ Ve.id,
1707
1710
  {
1708
1711
  formulaData: f
1709
1712
  },
@@ -1717,14 +1720,14 @@ let Ze = class extends ne {
1717
1720
  const e = {}, n = a.getUnitId(), i = { [n]: {} };
1718
1721
  a.getSheets().forEach((c) => {
1719
1722
  var p;
1720
- const d = c.getCellMatrix(), P = c.getSheetId(), E = na(e, n, P, d);
1721
- i[n][P] = (p = E[n]) == null ? void 0 : p[P];
1722
- }), this._commandService.executeCommand(ve.id, { formulaData: i }, { onlyLocal: !0 });
1723
- const o = this._configService.getConfig(ge), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Pe.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1724
- this._commandService.executeCommand(Ee.id, f, { onlyLocal: !0 });
1723
+ const s = c.getCellMatrix(), L = c.getSheetId(), E = oa(e, n, L, s);
1724
+ i[n][L] = (p = E[n]) == null ? void 0 : p[L];
1725
+ }), this._commandService.executeCommand(Ve.id, { formulaData: i }, { onlyLocal: !0 });
1726
+ const o = this._configService.getConfig(he), u = (m = o == null ? void 0 : o.initialFormulaComputing) != null ? m : Te.WHEN_EMPTY, f = this._getDirtyDataByCalculationMode(u);
1727
+ this._commandService.executeCommand(Ne.id, f, { onlyLocal: !0 });
1725
1728
  }
1726
1729
  _getDirtyDataByCalculationMode(a) {
1727
- const e = a === Pe.FORCED, n = a === Pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1730
+ const e = a === Te.FORCED, n = a === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1728
1731
  return {
1729
1732
  forceCalculation: e,
1730
1733
  dirtyRanges: n,
@@ -1736,19 +1739,19 @@ let Ze = class extends ne {
1736
1739
  };
1737
1740
  }
1738
1741
  _getUpdateFormula(a) {
1739
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
1742
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
1740
1743
  if (!e)
1741
1744
  return {
1742
1745
  undos: [],
1743
1746
  redos: []
1744
1747
  };
1745
- const n = Ya(e, a);
1748
+ const n = ka(e, a);
1746
1749
  if (n) {
1747
1750
  const { unitSheetNameMap: i } = this._formulaDataModel.getCalculateData(), r = this._formulaDataModel.getFormulaData(), { newFormulaData: o } = this._getFormulaReferenceMoveInfo(
1748
1751
  r,
1749
1752
  i,
1750
1753
  n
1751
- ), { undos: u, redos: f } = si(r, o, n);
1754
+ ), { undos: u, redos: f } = Ti(r, o, n);
1752
1755
  return {
1753
1756
  undos: u,
1754
1757
  redos: f
@@ -1761,7 +1764,7 @@ let Ze = class extends ne {
1761
1764
  }
1762
1765
  // eslint-disable-next-line max-lines-per-function
1763
1766
  _getFormulaReferenceMoveInfo(a, e, n) {
1764
- if (!Xe.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1767
+ if (!We.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1765
1768
  const i = Object.keys(a);
1766
1769
  if (i.length === 0) return { newFormulaData: {}, oldFormulaData: {} };
1767
1770
  const r = {}, o = {};
@@ -1770,123 +1773,123 @@ let Ze = class extends ne {
1770
1773
  if (f == null)
1771
1774
  continue;
1772
1775
  const m = Object.keys(f);
1773
- Xe.isDefine(r[u]) || (r[u] = {}), Xe.isDefine(o[u]) || (o[u] = {});
1776
+ We.isDefine(r[u]) || (r[u] = {}), We.isDefine(o[u]) || (o[u] = {});
1774
1777
  for (const c of m) {
1775
- const d = new G(f[c] || {}), P = new G(), E = [];
1776
- d.forValue((p, I, S) => {
1778
+ const s = new V(f[c] || {}), L = new V(), E = [];
1779
+ s.forValue((p, I, S) => {
1777
1780
  var F;
1778
1781
  if (!S) return !0;
1779
- const { f: R, x: s, y: A, si: N } = S, L = this._lexerTreeBuilder.sequenceNodesBuilder(R);
1780
- if (L == null)
1782
+ const { f: R, x: d, y: A, si: N } = S, P = this._lexerTreeBuilder.sequenceNodesBuilder(R);
1783
+ if (P == null)
1781
1784
  return !0;
1782
1785
  let g = !1;
1783
1786
  const q = [], { type: U, from: h } = n;
1784
- for (let B = 0, J = L.length; B < J; B++) {
1785
- const O = L[B];
1787
+ for (let B = 0, ae = P.length; B < ae; B++) {
1788
+ const O = P[B];
1786
1789
  if (typeof O == "string")
1787
1790
  continue;
1788
- const { token: ce, nodeType: ee } = O;
1789
- if ((U === _.SetDefinedName || U === _.RemoveDefinedName) && (ee === te.DEFINED_NAME || ee === te.FUNCTION)) {
1790
- const { definedNameId: Ue, definedName: Te } = n;
1791
- if (Ue === void 0 || Te === void 0)
1791
+ const { token: ce, nodeType: ne } = O;
1792
+ if ((U === _.SetDefinedName || U === _.RemoveDefinedName) && (ne === ie.DEFINED_NAME || ne === ie.FUNCTION)) {
1793
+ const { definedNameId: Fe, definedName: Ie } = n;
1794
+ if (Fe === void 0 || Ie === void 0)
1792
1795
  continue;
1793
- const se = this._definedNamesService.getValueById(u, Ue);
1796
+ const se = this._definedNamesService.getValueById(u, Fe);
1794
1797
  if (se == null || se.name !== ce)
1795
1798
  continue;
1796
- L[B] = {
1799
+ P[B] = {
1797
1800
  ...O,
1798
- token: U === _.SetDefinedName ? Te : Q.REF
1801
+ token: U === _.SetDefinedName ? Ie : $.REF
1799
1802
  }, g = !0, q.push(B);
1800
1803
  continue;
1801
- } else if (ee !== te.REFERENCE)
1804
+ } else if (ne !== ie.REFERENCE)
1802
1805
  continue;
1803
- const le = Le(ce), { range: $, sheetName: ie, unitId: re } = le, he = re == null || re.length === 0 ? u : re, j = ((F = e == null ? void 0 : e[he]) == null ? void 0 : F[ie]) || "";
1804
- if (!Ga(
1806
+ const le = Pe(ce), { range: z, sheetName: re, unitId: oe } = le, Ue = oe == null || oe.length === 0 ? u : oe, Z = ((F = e == null ? void 0 : e[Ue]) == null ? void 0 : F[re]) || "";
1807
+ if (!Xa(
1805
1808
  n.unitId,
1806
1809
  n.sheetId,
1807
1810
  u,
1808
1811
  c,
1809
- re,
1810
- j
1812
+ oe,
1813
+ Z
1811
1814
  ))
1812
1815
  continue;
1813
- const lt = {
1814
- range: $,
1815
- sheetId: j,
1816
- unitId: re,
1817
- sheetName: ie,
1818
- refOffsetX: s || 0,
1816
+ const Et = {
1817
+ range: z,
1818
+ sheetId: Z,
1819
+ unitId: oe,
1820
+ sheetName: re,
1821
+ refOffsetX: d || 0,
1819
1822
  refOffsetY: A || 0
1820
1823
  };
1821
- let Ce = null;
1824
+ let Oe = null;
1822
1825
  if (U === _.SetName) {
1823
1826
  const {
1824
- unitId: Ue,
1825
- sheetId: Te,
1827
+ unitId: Fe,
1828
+ sheetId: Ie,
1826
1829
  sheetName: se
1827
1830
  } = n;
1828
- if (se == null || j == null || j.length === 0 || Te !== j)
1831
+ if (se == null || Z == null || Z.length === 0 || Ie !== Z)
1829
1832
  continue;
1830
- Ce = ft({
1831
- range: $,
1833
+ Oe = st({
1834
+ range: z,
1832
1835
  sheetName: se,
1833
- unitId: re
1836
+ unitId: oe
1834
1837
  });
1835
1838
  } else if (U === _.RemoveSheet) {
1836
1839
  const {
1837
- unitId: Ue,
1838
- sheetId: Te,
1840
+ unitId: Fe,
1841
+ sheetId: Ie,
1839
1842
  sheetName: se
1840
1843
  } = n;
1841
- if (j == null || j.length === 0 || Te !== j)
1844
+ if (Z == null || Z.length === 0 || Ie !== Z)
1842
1845
  continue;
1843
- Ce = Q.REF;
1844
- } else U !== _.SetDefinedName && (Ce = wa(
1845
- lt,
1846
+ Oe = $.REF;
1847
+ } else U !== _.SetDefinedName && (Oe = Ka(
1848
+ Et,
1846
1849
  n,
1847
1850
  u,
1848
1851
  c
1849
1852
  ));
1850
- Ce != null && (L[B] = {
1853
+ Oe != null && (P[B] = {
1851
1854
  ...O,
1852
- token: Ce
1853
- }, g = !0, q.push(B), N && (s != null ? s : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N));
1855
+ token: Oe
1856
+ }, g = !0, q.push(B), N && (d != null ? d : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N));
1854
1857
  }
1855
1858
  if (!g)
1856
1859
  if (N && [_.MoveRows, _.MoveCols, _.MoveRange].includes(U)) {
1857
1860
  if (h && h.startRow <= p && p <= h.endRow && h.startColumn <= I && I <= h.endColumn)
1858
- (s != null ? s : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N);
1861
+ (d != null ? d : 0) === 0 && (A != null ? A : 0) === 0 && E.push(N);
1859
1862
  else if (!E.includes(N))
1860
1863
  return !0;
1861
1864
  } else
1862
1865
  return !0;
1863
- const M = Ha(L, q, s, A);
1864
- P.setValue(p, I, {
1865
- f: `=${$e(M)}`
1866
+ const M = Wa(P, q, d, A);
1867
+ L.setValue(p, I, {
1868
+ f: `=${je(M)}`
1866
1869
  });
1867
- }), o[u] && (o[u][c] = P.getData());
1870
+ }), o[u] && (o[u][c] = L.getData());
1868
1871
  }
1869
1872
  }
1870
1873
  return { newFormulaData: o };
1871
1874
  }
1872
1875
  };
1873
- Ze = Zi([
1874
- ue(0, Se),
1875
- ue(1, fe),
1876
- ue(2, X(vt)),
1877
- ue(3, X(mt)),
1878
- ue(4, X(Ut)),
1879
- ue(5, Bt),
1880
- ue(6, Ae),
1881
- ue(7, X(ut))
1882
- ], Ze);
1883
- const Ji = "SHEETS_FORMULA_PLUGIN";
1884
- var er = Object.getOwnPropertyDescriptor, tr = (a, e, n, i) => {
1885
- for (var r = i > 1 ? void 0 : i ? er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1876
+ et = nr([
1877
+ me(0, Ee),
1878
+ me(1, ue),
1879
+ me(2, X(pt)),
1880
+ me(3, X(lt)),
1881
+ me(4, X(wt)),
1882
+ me(5, dt),
1883
+ me(6, be),
1884
+ me(7, X(ct))
1885
+ ], et);
1886
+ const ir = "SHEETS_FORMULA_PLUGIN";
1887
+ var rr = Object.getOwnPropertyDescriptor, or = (a, e, n, i) => {
1888
+ for (var r = i > 1 ? void 0 : i ? rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1886
1889
  (u = a[o]) && (r = u(r) || r);
1887
1890
  return r;
1888
- }, Nt = (a, e) => (n, i) => e(n, i, a);
1889
- let Je = class extends ne {
1891
+ }, Ot = (a, e) => (n, i) => e(n, i, a);
1892
+ let tt = class extends ee {
1890
1893
  constructor(a, e, n) {
1891
1894
  super(), this._activeDirtyManagerService = a, this._univerInstanceService = e, this._formulaDataModel = n, this._initialize();
1892
1895
  }
@@ -1894,19 +1897,19 @@ let Je = class extends ne {
1894
1897
  this._initialConversion();
1895
1898
  }
1896
1899
  _initialConversion() {
1897
- this._activeDirtyManagerService.register(z.id, {
1898
- commandId: z.id,
1900
+ this._activeDirtyManagerService.register(k.id, {
1901
+ commandId: k.id,
1899
1902
  getDirtyData: (a) => {
1900
1903
  const e = a.params;
1901
- return e.trigger === ht.id ? {} : {
1904
+ return e.trigger === Ht.id ? {} : {
1902
1905
  dirtyRanges: this._getSetRangeValuesMutationDirtyRange(e)
1903
1906
  };
1904
1907
  }
1905
1908
  }), this._initialMove(), this._initialRowAndColumn(), this._initialHideRow(), this._initialSheet(), this._initialDefinedName();
1906
1909
  }
1907
1910
  _initialMove() {
1908
- this._activeDirtyManagerService.register(Xt.id, {
1909
- commandId: Xt.id,
1911
+ this._activeDirtyManagerService.register(kt.id, {
1912
+ commandId: kt.id,
1910
1913
  getDirtyData: (a) => {
1911
1914
  const e = a.params;
1912
1915
  return {
@@ -1919,8 +1922,8 @@ let Je = class extends ne {
1919
1922
  }
1920
1923
  };
1921
1924
  }
1922
- }), this._activeDirtyManagerService.register(Wt.id, {
1923
- commandId: Wt.id,
1925
+ }), this._activeDirtyManagerService.register(Qt.id, {
1926
+ commandId: Qt.id,
1924
1927
  getDirtyData: (a) => {
1925
1928
  const e = a.params;
1926
1929
  return {
@@ -1932,8 +1935,8 @@ let Je = class extends ne {
1932
1935
  }
1933
1936
  };
1934
1937
  }
1935
- }), this._activeDirtyManagerService.register(Kt.id, {
1936
- commandId: Kt.id,
1938
+ }), this._activeDirtyManagerService.register($t.id, {
1939
+ commandId: $t.id,
1937
1940
  getDirtyData: (a) => {
1938
1941
  const e = a.params;
1939
1942
  return {
@@ -1945,8 +1948,8 @@ let Je = class extends ne {
1945
1948
  }
1946
1949
  };
1947
1950
  }
1948
- }), this._activeDirtyManagerService.register(kt.id, {
1949
- commandId: kt.id,
1951
+ }), this._activeDirtyManagerService.register(jt.id, {
1952
+ commandId: jt.id,
1950
1953
  getDirtyData: (a) => {
1951
1954
  const e = a.params;
1952
1955
  return {
@@ -1961,8 +1964,8 @@ let Je = class extends ne {
1961
1964
  });
1962
1965
  }
1963
1966
  _initialRowAndColumn() {
1964
- this._activeDirtyManagerService.register(Qt.id, {
1965
- commandId: Qt.id,
1967
+ this._activeDirtyManagerService.register(zt.id, {
1968
+ commandId: zt.id,
1966
1969
  getDirtyData: (a) => {
1967
1970
  const e = a.params;
1968
1971
  return {
@@ -1974,8 +1977,8 @@ let Je = class extends ne {
1974
1977
  }
1975
1978
  };
1976
1979
  }
1977
- }), this._activeDirtyManagerService.register($t.id, {
1978
- commandId: $t.id,
1980
+ }), this._activeDirtyManagerService.register(Zt.id, {
1981
+ commandId: Zt.id,
1979
1982
  getDirtyData: (a) => {
1980
1983
  const e = a.params;
1981
1984
  return {
@@ -1987,8 +1990,8 @@ let Je = class extends ne {
1987
1990
  }
1988
1991
  };
1989
1992
  }
1990
- }), this._activeDirtyManagerService.register(jt.id, {
1991
- commandId: jt.id,
1993
+ }), this._activeDirtyManagerService.register(Jt.id, {
1994
+ commandId: Jt.id,
1992
1995
  getDirtyData: (a) => {
1993
1996
  const e = a.params;
1994
1997
  return {
@@ -1999,8 +2002,8 @@ let Je = class extends ne {
1999
2002
  }
2000
2003
  };
2001
2004
  }
2002
- }), this._activeDirtyManagerService.register(zt.id, {
2003
- commandId: zt.id,
2005
+ }), this._activeDirtyManagerService.register(ea.id, {
2006
+ commandId: ea.id,
2004
2007
  getDirtyData: (a) => {
2005
2008
  const e = a.params;
2006
2009
  return {
@@ -2014,8 +2017,8 @@ let Je = class extends ne {
2014
2017
  });
2015
2018
  }
2016
2019
  _initialHideRow() {
2017
- this._activeDirtyManagerService.register(Zt.id, {
2018
- commandId: Zt.id,
2020
+ this._activeDirtyManagerService.register(ta.id, {
2021
+ commandId: ta.id,
2019
2022
  getDirtyData: (a) => {
2020
2023
  const e = a.params;
2021
2024
  return {
@@ -2027,8 +2030,8 @@ let Je = class extends ne {
2027
2030
  }
2028
2031
  };
2029
2032
  }
2030
- }), this._activeDirtyManagerService.register(Jt.id, {
2031
- commandId: Jt.id,
2033
+ }), this._activeDirtyManagerService.register(aa.id, {
2034
+ commandId: aa.id,
2032
2035
  getDirtyData: (a) => {
2033
2036
  const e = a.params;
2034
2037
  return {
@@ -2043,8 +2046,8 @@ let Je = class extends ne {
2043
2046
  });
2044
2047
  }
2045
2048
  _initialSheet() {
2046
- this._activeDirtyManagerService.register(At.id, {
2047
- commandId: At.id,
2049
+ this._activeDirtyManagerService.register(_t.id, {
2050
+ commandId: _t.id,
2048
2051
  getDirtyData: (a) => {
2049
2052
  const e = a.params;
2050
2053
  return {
@@ -2056,8 +2059,8 @@ let Je = class extends ne {
2056
2059
  }
2057
2060
  };
2058
2061
  }
2059
- }), this._activeDirtyManagerService.register(Ct.id, {
2060
- commandId: Ct.id,
2062
+ }), this._activeDirtyManagerService.register(yt.id, {
2063
+ commandId: yt.id,
2061
2064
  getDirtyData: (a) => {
2062
2065
  const e = a.params;
2063
2066
  return {
@@ -2067,14 +2070,14 @@ let Je = class extends ne {
2067
2070
  });
2068
2071
  }
2069
2072
  _initialDefinedName() {
2070
- this._activeDirtyManagerService.register(ye.id, {
2071
- commandId: ye.id,
2073
+ this._activeDirtyManagerService.register(De.id, {
2074
+ commandId: De.id,
2072
2075
  getDirtyData: (a) => {
2073
2076
  const e = a.params;
2074
2077
  return { dirtyDefinedNameMap: this._getDefinedNameMutation(e) };
2075
2078
  }
2076
- }), this._activeDirtyManagerService.register(bt.id, {
2077
- commandId: bt.id,
2079
+ }), this._activeDirtyManagerService.register(gt.id, {
2080
+ commandId: gt.id,
2078
2081
  getDirtyData: (a) => {
2079
2082
  const e = a.params;
2080
2083
  return { dirtyDefinedNameMap: this._getDefinedNameMutation(e) };
@@ -2103,20 +2106,20 @@ let Je = class extends ne {
2103
2106
  }
2104
2107
  _getRemoveRowOrColumnMutation(a, e = !0) {
2105
2108
  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;
2106
- let d = null;
2107
- const { startRow: P, endRow: E, startColumn: p, endColumn: I } = r;
2108
- e === !0 ? d = this._rangeToMatrix({
2109
- startRow: P,
2109
+ let s = null;
2110
+ const { startRow: L, endRow: E, startColumn: p, endColumn: I } = r;
2111
+ e === !0 ? s = this._rangeToMatrix({
2112
+ startRow: L,
2110
2113
  startColumn: 0,
2111
2114
  endRow: E,
2112
2115
  endColumn: c - 1
2113
- }) : d = this._rangeToMatrix({
2116
+ }) : s = this._rangeToMatrix({
2114
2117
  startRow: 0,
2115
2118
  startColumn: p,
2116
2119
  endRow: m,
2117
2120
  endColumn: I
2118
2121
  });
2119
- const S = d.getData();
2122
+ const S = s.getData();
2120
2123
  return o.push(...this._getDirtyRangesByCellValue(i, n, S)), o.push(...this._getDirtyRangesForArrayFormula(i, n, S)), o;
2121
2124
  }
2122
2125
  _getHideRowMutation(a) {
@@ -2135,7 +2138,7 @@ let Je = class extends ne {
2135
2138
  return e[i] == null && (e[i] = {}), e[i][n.id] = n.name, e;
2136
2139
  }
2137
2140
  _rangeToMatrix(a) {
2138
- const e = new G(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
2141
+ const e = new V(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
2139
2142
  for (let u = n; u <= r; u++)
2140
2143
  for (let f = i; f <= o; f++)
2141
2144
  e.setValue(u, f, {});
@@ -2143,7 +2146,7 @@ let Je = class extends ne {
2143
2146
  }
2144
2147
  _getDirtyRangesByCellValue(a, e, n) {
2145
2148
  const i = [];
2146
- return n == null || new G(n).getDiscreteRanges().forEach((u) => {
2149
+ return n == null || new V(n).getDiscreteRanges().forEach((u) => {
2147
2150
  i.push({ unitId: a, sheetId: e, range: u });
2148
2151
  }), i;
2149
2152
  }
@@ -2156,15 +2159,15 @@ let Je = class extends ne {
2156
2159
  const i = [];
2157
2160
  if (n == null)
2158
2161
  return i;
2159
- const r = new G(n), o = this._formulaDataModel.getArrayFormulaRange();
2162
+ const r = new V(n), o = this._formulaDataModel.getArrayFormulaRange();
2160
2163
  if ((u = o == null ? void 0 : o[a]) != null && u[e]) {
2161
- const m = new G((f = o == null ? void 0 : o[a]) == null ? void 0 : f[e]);
2162
- r.forValue((c, d) => {
2163
- m.forValue((P, E, p) => {
2164
+ const m = new V((f = o == null ? void 0 : o[a]) == null ? void 0 : f[e]);
2165
+ r.forValue((c, s) => {
2166
+ m.forValue((L, E, p) => {
2164
2167
  if (p == null)
2165
2168
  return !0;
2166
- const { startRow: I, startColumn: S, endRow: R, endColumn: s } = p;
2167
- c >= I && c <= R && d >= S && d <= s && i.push({
2169
+ const { startRow: I, startColumn: S, endRow: R, endColumn: d } = p;
2170
+ c >= I && c <= R && s >= S && s <= d && i.push({
2168
2171
  unitId: a,
2169
2172
  sheetId: e,
2170
2173
  range: {
@@ -2180,19 +2183,19 @@ let Je = class extends ne {
2180
2183
  return i;
2181
2184
  }
2182
2185
  };
2183
- Je = tr([
2184
- Nt(0, Ft),
2185
- Nt(1, Se),
2186
- Nt(2, X(mt))
2187
- ], Je);
2188
- var ar = Object.getOwnPropertyDescriptor, nr = (a, e, n, i) => {
2189
- for (var r = i > 1 ? void 0 : i ? ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2186
+ tt = or([
2187
+ Ot(0, Yt),
2188
+ Ot(1, Ee),
2189
+ Ot(2, X(lt))
2190
+ ], tt);
2191
+ var ur = Object.getOwnPropertyDescriptor, mr = (a, e, n, i) => {
2192
+ for (var r = i > 1 ? void 0 : i ? ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
2190
2193
  (u = a[o]) && (r = u(r) || r);
2191
2194
  return r;
2192
- }, Ge = (a, e) => (n, i) => e(n, i, a);
2193
- let et = class extends ne {
2194
- constructor(a, e, n, i) {
2195
- super(), this._commandService = a, this._configService = e, this._sheetInterceptorService = n, this._formulaDataModel = i, this._initialize();
2195
+ }, Le = (a, e) => (n, i) => e(n, i, a);
2196
+ let at = class extends ee {
2197
+ constructor(a, e, n, i, r, o, u) {
2198
+ super(), this._commandService = a, this._configService = e, this._sheetInterceptorService = n, this._formulaDataModel = i, this._lexerTreeBuilder = r, this._functionService = o, this._definedNamesService = u, this._initialize();
2196
2199
  }
2197
2200
  _initialize() {
2198
2201
  this._commandExecutedListener(), this._initInterceptorCellContent();
@@ -2200,24 +2203,56 @@ let et = class extends ne {
2200
2203
  _commandExecutedListener() {
2201
2204
  this.disposeWithMe(
2202
2205
  this._commandService.onCommandExecuted((a) => {
2203
- var r;
2204
- if (a.id !== Dt.id)
2205
- return;
2206
- const e = a.params;
2207
- if (e == null)
2208
- return;
2209
- const { arrayFormulaRange: n, arrayFormulaCellData: i } = e;
2210
- this._formulaDataModel.setArrayFormulaRange(n), this._formulaDataModel.setArrayFormulaCellData(i), (r = this._configService.getConfig(ge)) != null && r.writeArrayFormulaToSnapshot && this._writeArrayFormulaToSnapshot(n, i);
2206
+ var n;
2207
+ const e = (n = this._configService.getConfig(he)) == null ? void 0 : n.writeArrayFormulaToSnapshot;
2208
+ if (a.id === qt.id) {
2209
+ const i = a.params;
2210
+ if (i == null)
2211
+ return;
2212
+ const { arrayFormulaRange: r, arrayFormulaCellData: o, arrayFormulaEmbedded: u } = i;
2213
+ this._formulaDataModel.setArrayFormulaRange(r), this._formulaDataModel.setArrayFormulaCellData(o), e && this._writeArrayFormulaToSnapshot(r, o, u);
2214
+ } else a.id === va.id && e && (this._addPrefixToFunctionSnapshot(), this._addPrefixToDefinedNamesFunctionSnapshot());
2211
2215
  })
2212
2216
  );
2213
2217
  }
2214
- _writeArrayFormulaToSnapshot(a, e) {
2218
+ _addPrefixToDefinedNamesFunctionSnapshot() {
2219
+ const a = this._definedNamesService.getAllDefinedNames();
2220
+ Object.entries(a).forEach(([e, n]) => {
2221
+ n && Array.from(Object.entries(n)).forEach(([i, r]) => {
2222
+ const { formulaOrRefString: o } = r;
2223
+ if (o.substring(0, 1) === "=") {
2224
+ const u = this._lexerTreeBuilder.getNewFormulaWithPrefix(o, this._functionService.hasExecutor.bind(this._functionService));
2225
+ u && this._commandService.executeCommand(De.id, {
2226
+ ...r,
2227
+ unitId: e,
2228
+ formulaOrRefStringWithPrefix: u
2229
+ }, {
2230
+ onlyLocal: !0,
2231
+ fromFormula: !0
2232
+ });
2233
+ }
2234
+ });
2235
+ });
2236
+ }
2237
+ _addPrefixToFunctionSnapshot() {
2238
+ const a = this._formulaDataModel.getFormulaData(), e = /* @__PURE__ */ new Map();
2215
2239
  Object.entries(a).forEach(([n, i]) => {
2216
2240
  i && Array.from(Object.entries(i)).forEach(([r, o]) => {
2217
- const u = new G();
2218
- new G(o).forValue((m, c, d) => {
2219
- u.setValue(m, c, { ref: _e(d) });
2220
- }), this._commandService.executeCommand(z.id, {
2241
+ if (!o)
2242
+ return;
2243
+ const u = new V();
2244
+ new V(o).forValue((m, c, s) => {
2245
+ const L = s == null ? void 0 : s.f;
2246
+ if ((s == null ? void 0 : s.x) != null || !L || L.length === 0)
2247
+ return;
2248
+ if (e.has(L)) {
2249
+ const p = e.get(L);
2250
+ u.setValue(m, c, { xf: p });
2251
+ return;
2252
+ }
2253
+ const E = this._lexerTreeBuilder.getNewFormulaWithPrefix(L, this._functionService.hasExecutor.bind(this._functionService));
2254
+ E && (u.setValue(m, c, { xf: E }), e.set(L, E));
2255
+ }), this._commandService.executeCommand(k.id, {
2221
2256
  unitId: n,
2222
2257
  subUnitId: r,
2223
2258
  cellValue: u.getMatrix()
@@ -2226,12 +2261,51 @@ let et = class extends ne {
2226
2261
  fromFormula: !0
2227
2262
  });
2228
2263
  });
2229
- }), Array.from(Object.entries(e)).forEach(([n, i]) => {
2230
- i && Array.from(Object.entries(i)).forEach(([r, o]) => {
2231
- this._commandService.executeCommand(z.id, {
2232
- unitId: n,
2233
- subUnitId: r,
2234
- cellValue: o
2264
+ }), e.clear();
2265
+ }
2266
+ _writeArrayFormulaToSnapshot(a, e, n) {
2267
+ a && Object.entries(a).forEach(([i, r]) => {
2268
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2269
+ const f = new V();
2270
+ new V(u).forValue((c, s, L) => {
2271
+ f.setValue(c, s, { ref: Ce(L) });
2272
+ }), this._commandService.executeCommand(k.id, {
2273
+ unitId: i,
2274
+ subUnitId: o,
2275
+ cellValue: f.getMatrix()
2276
+ }, {
2277
+ onlyLocal: !0,
2278
+ fromFormula: !0
2279
+ });
2280
+ });
2281
+ }), n && Object.entries(n).forEach(([i, r]) => {
2282
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2283
+ const f = new V();
2284
+ new V(u).forValue((c, s) => {
2285
+ var E, p, I;
2286
+ (I = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && I[s] || f.setValue(c, s, {
2287
+ ref: Ce({
2288
+ startRow: c,
2289
+ endRow: c,
2290
+ startColumn: s,
2291
+ endColumn: s
2292
+ })
2293
+ });
2294
+ }), this._commandService.executeCommand(k.id, {
2295
+ unitId: i,
2296
+ subUnitId: o,
2297
+ cellValue: f.getMatrix()
2298
+ }, {
2299
+ onlyLocal: !0,
2300
+ fromFormula: !0
2301
+ });
2302
+ });
2303
+ }), e && Object.entries(e).forEach(([i, r]) => {
2304
+ r && Array.from(Object.entries(r)).forEach(([o, u]) => {
2305
+ this._commandService.executeCommand(k.id, {
2306
+ unitId: i,
2307
+ subUnitId: o,
2308
+ cellValue: u
2235
2309
  }, {
2236
2310
  onlyLocal: !0,
2237
2311
  fromFormula: !0
@@ -2241,28 +2315,31 @@ let et = class extends ne {
2241
2315
  }
2242
2316
  _initInterceptorCellContent() {
2243
2317
  this.disposeWithMe(
2244
- this._sheetInterceptorService.intercept(In.CELL_CONTENT, {
2318
+ this._sheetInterceptorService.intercept(An.CELL_CONTENT, {
2245
2319
  priority: 100,
2246
- effect: za.Value,
2320
+ effect: tn.Value,
2247
2321
  handler: (a, e, n) => {
2248
- var d, P, E;
2322
+ var s, L, E;
2249
2323
  let i = a;
2250
- const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (P = (d = m == null ? void 0 : m[r]) == null ? void 0 : d[o]) == null ? void 0 : P[u]) == null ? void 0 : E[f];
2251
- return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = wt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === wt.NUMBER && i.v !== void 0 && i.v !== null && Za(i.v) ? (i.v = xn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2324
+ const { unitId: r, subUnitId: o, row: u, col: f } = e, m = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (L = (s = m == null ? void 0 : m[r]) == null ? void 0 : s[o]) == null ? void 0 : L[u]) == null ? void 0 : E[f];
2325
+ return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = Wt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === Wt.NUMBER && i.v !== void 0 && i.v !== null && an(i.v) ? (i.v = yn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
2252
2326
  }
2253
2327
  })
2254
2328
  );
2255
2329
  }
2256
2330
  };
2257
- et = nr([
2258
- Ge(0, fe),
2259
- Ge(1, Ae),
2260
- Ge(2, X(Ut)),
2261
- Ge(3, X(mt))
2262
- ], et);
2263
- const ir = [
2331
+ at = mr([
2332
+ Le(0, ue),
2333
+ Le(1, be),
2334
+ Le(2, X(wt)),
2335
+ Le(3, X(lt)),
2336
+ Le(4, X(pt)),
2337
+ Le(5, Lt),
2338
+ Le(6, dt)
2339
+ ], at);
2340
+ const fr = [
2264
2341
  {
2265
- functionName: ia.ARRAY_CONSTRAIN,
2342
+ functionName: ua.ARRAY_CONSTRAIN,
2266
2343
  functionType: t.Array,
2267
2344
  description: "formula.functionList.ARRAY_CONSTRAIN.description",
2268
2345
  abstract: "formula.functionList.ARRAY_CONSTRAIN.abstract",
@@ -2291,7 +2368,7 @@ const ir = [
2291
2368
  ]
2292
2369
  },
2293
2370
  {
2294
- functionName: ia.FLATTEN,
2371
+ functionName: ua.FLATTEN,
2295
2372
  functionType: t.Array,
2296
2373
  description: "formula.functionList.FLATTEN.description",
2297
2374
  abstract: "formula.functionList.FLATTEN.abstract",
@@ -2312,7 +2389,7 @@ const ir = [
2312
2389
  }
2313
2390
  ]
2314
2391
  }
2315
- ], rr = [
2392
+ ], cr = [
2316
2393
  {
2317
2394
  functionName: x.BETADIST,
2318
2395
  functionType: t.Compatibility,
@@ -3366,7 +3443,7 @@ const ir = [
3366
3443
  }
3367
3444
  ]
3368
3445
  }
3369
- ], or = [
3446
+ ], lr = [
3370
3447
  {
3371
3448
  functionName: de.CUBEKPIMEMBER,
3372
3449
  functionType: t.Cube,
@@ -3521,9 +3598,9 @@ const ir = [
3521
3598
  }
3522
3599
  ]
3523
3600
  }
3524
- ], ur = [
3601
+ ], sr = [
3525
3602
  {
3526
- functionName: k.DAVERAGE,
3603
+ functionName: Q.DAVERAGE,
3527
3604
  functionType: t.Database,
3528
3605
  description: "formula.functionList.DAVERAGE.description",
3529
3606
  abstract: "formula.functionList.DAVERAGE.abstract",
@@ -3552,7 +3629,7 @@ const ir = [
3552
3629
  ]
3553
3630
  },
3554
3631
  {
3555
- functionName: k.DCOUNT,
3632
+ functionName: Q.DCOUNT,
3556
3633
  functionType: t.Database,
3557
3634
  description: "formula.functionList.DCOUNT.description",
3558
3635
  abstract: "formula.functionList.DCOUNT.abstract",
@@ -3581,7 +3658,7 @@ const ir = [
3581
3658
  ]
3582
3659
  },
3583
3660
  {
3584
- functionName: k.DCOUNTA,
3661
+ functionName: Q.DCOUNTA,
3585
3662
  functionType: t.Database,
3586
3663
  description: "formula.functionList.DCOUNTA.description",
3587
3664
  abstract: "formula.functionList.DCOUNTA.abstract",
@@ -3610,7 +3687,7 @@ const ir = [
3610
3687
  ]
3611
3688
  },
3612
3689
  {
3613
- functionName: k.DGET,
3690
+ functionName: Q.DGET,
3614
3691
  functionType: t.Database,
3615
3692
  description: "formula.functionList.DGET.description",
3616
3693
  abstract: "formula.functionList.DGET.abstract",
@@ -3639,7 +3716,7 @@ const ir = [
3639
3716
  ]
3640
3717
  },
3641
3718
  {
3642
- functionName: k.DMAX,
3719
+ functionName: Q.DMAX,
3643
3720
  functionType: t.Database,
3644
3721
  description: "formula.functionList.DMAX.description",
3645
3722
  abstract: "formula.functionList.DMAX.abstract",
@@ -3668,7 +3745,7 @@ const ir = [
3668
3745
  ]
3669
3746
  },
3670
3747
  {
3671
- functionName: k.DMIN,
3748
+ functionName: Q.DMIN,
3672
3749
  functionType: t.Database,
3673
3750
  description: "formula.functionList.DMIN.description",
3674
3751
  abstract: "formula.functionList.DMIN.abstract",
@@ -3697,7 +3774,7 @@ const ir = [
3697
3774
  ]
3698
3775
  },
3699
3776
  {
3700
- functionName: k.DPRODUCT,
3777
+ functionName: Q.DPRODUCT,
3701
3778
  functionType: t.Database,
3702
3779
  description: "formula.functionList.DPRODUCT.description",
3703
3780
  abstract: "formula.functionList.DPRODUCT.abstract",
@@ -3726,7 +3803,7 @@ const ir = [
3726
3803
  ]
3727
3804
  },
3728
3805
  {
3729
- functionName: k.DSTDEV,
3806
+ functionName: Q.DSTDEV,
3730
3807
  functionType: t.Database,
3731
3808
  description: "formula.functionList.DSTDEV.description",
3732
3809
  abstract: "formula.functionList.DSTDEV.abstract",
@@ -3755,7 +3832,7 @@ const ir = [
3755
3832
  ]
3756
3833
  },
3757
3834
  {
3758
- functionName: k.DSTDEVP,
3835
+ functionName: Q.DSTDEVP,
3759
3836
  functionType: t.Database,
3760
3837
  description: "formula.functionList.DSTDEVP.description",
3761
3838
  abstract: "formula.functionList.DSTDEVP.abstract",
@@ -3784,7 +3861,7 @@ const ir = [
3784
3861
  ]
3785
3862
  },
3786
3863
  {
3787
- functionName: k.DSUM,
3864
+ functionName: Q.DSUM,
3788
3865
  functionType: t.Database,
3789
3866
  description: "formula.functionList.DSUM.description",
3790
3867
  abstract: "formula.functionList.DSUM.abstract",
@@ -3813,7 +3890,7 @@ const ir = [
3813
3890
  ]
3814
3891
  },
3815
3892
  {
3816
- functionName: k.DVAR,
3893
+ functionName: Q.DVAR,
3817
3894
  functionType: t.Database,
3818
3895
  description: "formula.functionList.DVAR.description",
3819
3896
  abstract: "formula.functionList.DVAR.abstract",
@@ -3842,7 +3919,7 @@ const ir = [
3842
3919
  ]
3843
3920
  },
3844
3921
  {
3845
- functionName: k.DVARP,
3922
+ functionName: Q.DVARP,
3846
3923
  functionType: t.Database,
3847
3924
  description: "formula.functionList.DVARP.description",
3848
3925
  abstract: "formula.functionList.DVARP.abstract",
@@ -3870,7 +3947,7 @@ const ir = [
3870
3947
  }
3871
3948
  ]
3872
3949
  }
3873
- ], mr = [
3950
+ ], dr = [
3874
3951
  {
3875
3952
  functionName: v.DATE,
3876
3953
  functionType: t.Date,
@@ -4442,7 +4519,7 @@ const ir = [
4442
4519
  }
4443
4520
  ]
4444
4521
  }
4445
- ], fr = [
4522
+ ], pr = [
4446
4523
  {
4447
4524
  functionName: C.BESSELI,
4448
4525
  functionType: t.Engineering,
@@ -5515,7 +5592,7 @@ const ir = [
5515
5592
  }
5516
5593
  ]
5517
5594
  }
5518
- ], cr = [
5595
+ ], Lr = [
5519
5596
  {
5520
5597
  functionName: D.ACCRINT,
5521
5598
  functionType: t.Financial,
@@ -7776,9 +7853,9 @@ const ir = [
7776
7853
  }
7777
7854
  ]
7778
7855
  }
7779
- ], lr = [
7856
+ ], Pr = [
7780
7857
  {
7781
- functionName: V.CELL,
7858
+ functionName: G.CELL,
7782
7859
  functionType: t.Information,
7783
7860
  description: "formula.functionList.CELL.description",
7784
7861
  abstract: "formula.functionList.CELL.abstract",
@@ -7800,7 +7877,7 @@ const ir = [
7800
7877
  ]
7801
7878
  },
7802
7879
  {
7803
- functionName: V.ERROR_TYPE,
7880
+ functionName: G.ERROR_TYPE,
7804
7881
  functionType: t.Information,
7805
7882
  description: "formula.functionList.ERROR_TYPE.description",
7806
7883
  abstract: "formula.functionList.ERROR_TYPE.abstract",
@@ -7815,7 +7892,7 @@ const ir = [
7815
7892
  ]
7816
7893
  },
7817
7894
  {
7818
- functionName: V.INFO,
7895
+ functionName: G.INFO,
7819
7896
  functionType: t.Information,
7820
7897
  description: "formula.functionList.INFO.description",
7821
7898
  abstract: "formula.functionList.INFO.abstract",
@@ -7837,7 +7914,7 @@ const ir = [
7837
7914
  ]
7838
7915
  },
7839
7916
  {
7840
- functionName: V.ISBETWEEN,
7917
+ functionName: G.ISBETWEEN,
7841
7918
  functionType: t.Information,
7842
7919
  description: "formula.functionList.ISBETWEEN.description",
7843
7920
  abstract: "formula.functionList.ISBETWEEN.abstract",
@@ -7880,7 +7957,7 @@ const ir = [
7880
7957
  ]
7881
7958
  },
7882
7959
  {
7883
- functionName: V.ISBLANK,
7960
+ functionName: G.ISBLANK,
7884
7961
  functionType: t.Information,
7885
7962
  description: "formula.functionList.ISBLANK.description",
7886
7963
  abstract: "formula.functionList.ISBLANK.abstract",
@@ -7895,7 +7972,7 @@ const ir = [
7895
7972
  ]
7896
7973
  },
7897
7974
  {
7898
- functionName: V.ISDATE,
7975
+ functionName: G.ISDATE,
7899
7976
  functionType: t.Information,
7900
7977
  description: "formula.functionList.ISDATE.description",
7901
7978
  abstract: "formula.functionList.ISDATE.abstract",
@@ -7910,7 +7987,7 @@ const ir = [
7910
7987
  ]
7911
7988
  },
7912
7989
  {
7913
- functionName: V.ISEMAIL,
7990
+ functionName: G.ISEMAIL,
7914
7991
  functionType: t.Information,
7915
7992
  description: "formula.functionList.ISEMAIL.description",
7916
7993
  abstract: "formula.functionList.ISEMAIL.abstract",
@@ -7925,7 +8002,7 @@ const ir = [
7925
8002
  ]
7926
8003
  },
7927
8004
  {
7928
- functionName: V.ISERR,
8005
+ functionName: G.ISERR,
7929
8006
  functionType: t.Information,
7930
8007
  description: "formula.functionList.ISERR.description",
7931
8008
  abstract: "formula.functionList.ISERR.abstract",
@@ -7940,7 +8017,7 @@ const ir = [
7940
8017
  ]
7941
8018
  },
7942
8019
  {
7943
- functionName: V.ISERROR,
8020
+ functionName: G.ISERROR,
7944
8021
  functionType: t.Information,
7945
8022
  description: "formula.functionList.ISERROR.description",
7946
8023
  abstract: "formula.functionList.ISERROR.abstract",
@@ -7955,7 +8032,7 @@ const ir = [
7955
8032
  ]
7956
8033
  },
7957
8034
  {
7958
- functionName: V.ISEVEN,
8035
+ functionName: G.ISEVEN,
7959
8036
  functionType: t.Information,
7960
8037
  description: "formula.functionList.ISEVEN.description",
7961
8038
  abstract: "formula.functionList.ISEVEN.abstract",
@@ -7970,7 +8047,7 @@ const ir = [
7970
8047
  ]
7971
8048
  },
7972
8049
  {
7973
- functionName: V.ISFORMULA,
8050
+ functionName: G.ISFORMULA,
7974
8051
  functionType: t.Information,
7975
8052
  description: "formula.functionList.ISFORMULA.description",
7976
8053
  abstract: "formula.functionList.ISFORMULA.abstract",
@@ -7985,7 +8062,7 @@ const ir = [
7985
8062
  ]
7986
8063
  },
7987
8064
  {
7988
- functionName: V.ISLOGICAL,
8065
+ functionName: G.ISLOGICAL,
7989
8066
  functionType: t.Information,
7990
8067
  description: "formula.functionList.ISLOGICAL.description",
7991
8068
  abstract: "formula.functionList.ISLOGICAL.abstract",
@@ -8000,7 +8077,7 @@ const ir = [
8000
8077
  ]
8001
8078
  },
8002
8079
  {
8003
- functionName: V.ISNA,
8080
+ functionName: G.ISNA,
8004
8081
  functionType: t.Information,
8005
8082
  description: "formula.functionList.ISNA.description",
8006
8083
  abstract: "formula.functionList.ISNA.abstract",
@@ -8015,7 +8092,7 @@ const ir = [
8015
8092
  ]
8016
8093
  },
8017
8094
  {
8018
- functionName: V.ISNONTEXT,
8095
+ functionName: G.ISNONTEXT,
8019
8096
  functionType: t.Information,
8020
8097
  description: "formula.functionList.ISNONTEXT.description",
8021
8098
  abstract: "formula.functionList.ISNONTEXT.abstract",
@@ -8030,7 +8107,7 @@ const ir = [
8030
8107
  ]
8031
8108
  },
8032
8109
  {
8033
- functionName: V.ISNUMBER,
8110
+ functionName: G.ISNUMBER,
8034
8111
  functionType: t.Information,
8035
8112
  description: "formula.functionList.ISNUMBER.description",
8036
8113
  abstract: "formula.functionList.ISNUMBER.abstract",
@@ -8045,7 +8122,7 @@ const ir = [
8045
8122
  ]
8046
8123
  },
8047
8124
  {
8048
- functionName: V.ISODD,
8125
+ functionName: G.ISODD,
8049
8126
  functionType: t.Information,
8050
8127
  description: "formula.functionList.ISODD.description",
8051
8128
  abstract: "formula.functionList.ISODD.abstract",
@@ -8060,7 +8137,7 @@ const ir = [
8060
8137
  ]
8061
8138
  },
8062
8139
  {
8063
- functionName: V.ISOMITTED,
8140
+ functionName: G.ISOMITTED,
8064
8141
  functionType: t.Information,
8065
8142
  description: "formula.functionList.ISOMITTED.description",
8066
8143
  abstract: "formula.functionList.ISOMITTED.abstract",
@@ -8082,7 +8159,7 @@ const ir = [
8082
8159
  ]
8083
8160
  },
8084
8161
  {
8085
- functionName: V.ISREF,
8162
+ functionName: G.ISREF,
8086
8163
  functionType: t.Information,
8087
8164
  description: "formula.functionList.ISREF.description",
8088
8165
  abstract: "formula.functionList.ISREF.abstract",
@@ -8097,7 +8174,7 @@ const ir = [
8097
8174
  ]
8098
8175
  },
8099
8176
  {
8100
- functionName: V.ISTEXT,
8177
+ functionName: G.ISTEXT,
8101
8178
  functionType: t.Information,
8102
8179
  description: "formula.functionList.ISTEXT.description",
8103
8180
  abstract: "formula.functionList.ISTEXT.abstract",
@@ -8112,7 +8189,7 @@ const ir = [
8112
8189
  ]
8113
8190
  },
8114
8191
  {
8115
- functionName: V.ISURL,
8192
+ functionName: G.ISURL,
8116
8193
  functionType: t.Information,
8117
8194
  description: "formula.functionList.ISURL.description",
8118
8195
  abstract: "formula.functionList.ISURL.abstract",
@@ -8127,7 +8204,7 @@ const ir = [
8127
8204
  ]
8128
8205
  },
8129
8206
  {
8130
- functionName: V.N,
8207
+ functionName: G.N,
8131
8208
  functionType: t.Information,
8132
8209
  description: "formula.functionList.N.description",
8133
8210
  abstract: "formula.functionList.N.abstract",
@@ -8142,14 +8219,14 @@ const ir = [
8142
8219
  ]
8143
8220
  },
8144
8221
  {
8145
- functionName: V.NA,
8222
+ functionName: G.NA,
8146
8223
  functionType: t.Information,
8147
8224
  description: "formula.functionList.NA.description",
8148
8225
  abstract: "formula.functionList.NA.abstract",
8149
8226
  functionParameter: []
8150
8227
  },
8151
8228
  {
8152
- functionName: V.SHEET,
8229
+ functionName: G.SHEET,
8153
8230
  functionType: t.Information,
8154
8231
  description: "formula.functionList.SHEET.description",
8155
8232
  abstract: "formula.functionList.SHEET.abstract",
@@ -8164,14 +8241,14 @@ const ir = [
8164
8241
  ]
8165
8242
  },
8166
8243
  {
8167
- functionName: V.SHEETS,
8244
+ functionName: G.SHEETS,
8168
8245
  functionType: t.Information,
8169
8246
  description: "formula.functionList.SHEETS.description",
8170
8247
  abstract: "formula.functionList.SHEETS.abstract",
8171
8248
  functionParameter: []
8172
8249
  },
8173
8250
  {
8174
- functionName: V.TYPE,
8251
+ functionName: G.TYPE,
8175
8252
  functionType: t.Information,
8176
8253
  description: "formula.functionList.TYPE.description",
8177
8254
  abstract: "formula.functionList.TYPE.abstract",
@@ -8185,7 +8262,7 @@ const ir = [
8185
8262
  }
8186
8263
  ]
8187
8264
  }
8188
- ], sr = [
8265
+ ], Tr = [
8189
8266
  {
8190
8267
  functionName: K.AND,
8191
8268
  functionType: t.Logical,
@@ -8659,7 +8736,7 @@ const ir = [
8659
8736
  }
8660
8737
  ]
8661
8738
  }
8662
- ], dr = [
8739
+ ], Er = [
8663
8740
  {
8664
8741
  functionName: y.ADDRESS,
8665
8742
  functionType: t.Lookup,
@@ -9691,7 +9768,7 @@ const ir = [
9691
9768
  }
9692
9769
  ]
9693
9770
  }
9694
- ], pr = [
9771
+ ], Ir = [
9695
9772
  {
9696
9773
  functionName: T.ABS,
9697
9774
  functionType: t.Math,
@@ -11329,7 +11406,7 @@ const ir = [
11329
11406
  }
11330
11407
  ]
11331
11408
  }
11332
- ], Lr = [
11409
+ ], Nr = [
11333
11410
  {
11334
11411
  functionName: l.AVEDEV,
11335
11412
  functionType: t.Statistical,
@@ -14271,7 +14348,7 @@ const ir = [
14271
14348
  }
14272
14349
  ]
14273
14350
  }
14274
- ], Pr = [
14351
+ ], Rr = [
14275
14352
  {
14276
14353
  functionName: b.ASC,
14277
14354
  functionType: t.Text,
@@ -15485,9 +15562,9 @@ const ir = [
15485
15562
  }
15486
15563
  ]
15487
15564
  }
15488
- ], Tr = [], Er = [
15565
+ ], Sr = [], Ar = [
15489
15566
  {
15490
- functionName: pt.ENCODEURL,
15567
+ functionName: Rt.ENCODEURL,
15491
15568
  functionType: t.Web,
15492
15569
  description: "formula.functionList.ENCODEURL.description",
15493
15570
  abstract: "formula.functionList.ENCODEURL.abstract",
@@ -15502,7 +15579,7 @@ const ir = [
15502
15579
  ]
15503
15580
  },
15504
15581
  {
15505
- functionName: pt.FILTERXML,
15582
+ functionName: Rt.FILTERXML,
15506
15583
  functionType: t.Web,
15507
15584
  description: "formula.functionList.FILTERXML.description",
15508
15585
  abstract: "formula.functionList.FILTERXML.abstract",
@@ -15524,7 +15601,7 @@ const ir = [
15524
15601
  ]
15525
15602
  },
15526
15603
  {
15527
- functionName: pt.WEBSERVICE,
15604
+ functionName: Rt.WEBSERVICE,
15528
15605
  functionType: t.Web,
15529
15606
  description: "formula.functionList.WEBSERVICE.description",
15530
15607
  abstract: "formula.functionList.WEBSERVICE.abstract",
@@ -15545,34 +15622,34 @@ const ir = [
15545
15622
  }
15546
15623
  ]
15547
15624
  }
15548
- ], Ir = [
15549
- ...cr,
15550
- ...mr,
15551
- ...pr,
15625
+ ], Cr = [
15552
15626
  ...Lr,
15553
15627
  ...dr,
15554
- ...ur,
15555
- ...Pr,
15628
+ ...Ir,
15629
+ ...Nr,
15630
+ ...Er,
15556
15631
  ...sr,
15632
+ ...Rr,
15633
+ ...Tr,
15634
+ ...Pr,
15635
+ ...pr,
15557
15636
  ...lr,
15637
+ ...cr,
15638
+ ...Ar,
15558
15639
  ...fr,
15559
- ...or,
15560
- ...rr,
15561
- ...Er,
15562
- ...ir,
15563
- ...Tr
15640
+ ...Sr
15564
15641
  ];
15565
- function Nr(a, e) {
15642
+ function Dr(a, e) {
15566
15643
  let n = "";
15567
15644
  return a.aliasFunctionName ? (n = e.t(a.aliasFunctionName), n === a.aliasFunctionName && (n = a.functionName)) : n = a.functionName, n;
15568
15645
  }
15569
- var Rr = Object.getOwnPropertyDescriptor, Sr = (a, e, n, i) => {
15570
- for (var r = i > 1 ? void 0 : i ? Rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15646
+ var br = Object.getOwnPropertyDescriptor, Or = (a, e, n, i) => {
15647
+ for (var r = i > 1 ? void 0 : i ? br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15571
15648
  (u = a[o]) && (r = u(r) || r);
15572
15649
  return r;
15573
- }, Rt = (a, e) => (n, i) => e(n, i, a);
15574
- const Gt = gt("formula.description-service");
15575
- let Mt = class {
15650
+ }, Mt = (a, e) => (n, i) => e(n, i, a);
15651
+ const Pt = Gt("formula.description-service");
15652
+ let Ut = class {
15576
15653
  constructor(a, e, n) {
15577
15654
  W(this, "_descriptions", []);
15578
15655
  this._functionService = a, this._localeService = e, this._configService = n, this._initialize();
@@ -15611,7 +15688,7 @@ let Mt = class {
15611
15688
  }), e;
15612
15689
  }
15613
15690
  registerDescriptions(a) {
15614
- return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), oe(() => {
15691
+ return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), J(() => {
15615
15692
  const e = a.map((n) => n.functionName);
15616
15693
  this.unregisterDescriptions(e);
15617
15694
  });
@@ -15630,7 +15707,7 @@ let Mt = class {
15630
15707
  if (e.length === 0)
15631
15708
  return !1;
15632
15709
  const n = e[0].description;
15633
- return !_n(n);
15710
+ return !qn(n);
15634
15711
  }
15635
15712
  _initialize() {
15636
15713
  this._localeService.localeChanged$.subscribe(() => {
@@ -15640,8 +15717,6 @@ let Mt = class {
15640
15717
  _initDescription() {
15641
15718
  var i;
15642
15719
  const a = [
15643
- ...yn,
15644
- ...qn,
15645
15720
  ...gn,
15646
15721
  ...hn,
15647
15722
  ...Un,
@@ -15655,13 +15730,15 @@ let Mt = class {
15655
15730
  ...Yn,
15656
15731
  ...Xn,
15657
15732
  ...Wn,
15658
- ...Kn
15659
- ].map((r) => r[1]), e = Ir.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ge);
15733
+ ...Kn,
15734
+ ...kn,
15735
+ ...Qn
15736
+ ].map((r) => r[1]), e = Cr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(he);
15660
15737
  this._descriptions = e.concat((i = n == null ? void 0 : n.description) != null ? i : []);
15661
15738
  }
15662
15739
  _registerDescriptions() {
15663
15740
  const a = this._localeService, e = this._descriptions.map((n) => ({
15664
- functionName: Nr(n, a),
15741
+ functionName: Dr(n, a),
15665
15742
  functionType: n.functionType,
15666
15743
  description: a.t(n.description),
15667
15744
  abstract: a.t(n.abstract),
@@ -15676,17 +15753,17 @@ let Mt = class {
15676
15753
  this._functionService.registerDescriptions(...e);
15677
15754
  }
15678
15755
  };
15679
- Mt = Sr([
15680
- Rt(0, Vt),
15681
- Rt(1, X(qt)),
15682
- Rt(2, Ae)
15683
- ], Mt);
15684
- var Ar = Object.getOwnPropertyDescriptor, Cr = (a, e, n, i) => {
15685
- for (var r = i > 1 ? void 0 : i ? Ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15756
+ Ut = Or([
15757
+ Mt(0, Lt),
15758
+ Mt(1, X(Vt)),
15759
+ Mt(2, be)
15760
+ ], Ut);
15761
+ var Mr = Object.getOwnPropertyDescriptor, xr = (a, e, n, i) => {
15762
+ for (var r = i > 1 ? void 0 : i ? Mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15686
15763
  (u = a[o]) && (r = u(r) || r);
15687
15764
  return r;
15688
15765
  }, He = (a, e) => (n, i) => e(n, i, a);
15689
- let tt = class extends ne {
15766
+ let nt = class extends ee {
15690
15767
  constructor(e, n, i, r) {
15691
15768
  super();
15692
15769
  W(this, "_preUnitId", null);
@@ -15696,15 +15773,15 @@ let tt = class extends ne {
15696
15773
  this._descriptionListener(), this._changeUnitListener(), this._changeSheetListener();
15697
15774
  }
15698
15775
  _descriptionListener() {
15699
- oe(
15776
+ J(
15700
15777
  this._definedNamesService.update$.subscribe(() => {
15701
15778
  this._registerDescriptions();
15702
15779
  })
15703
15780
  );
15704
15781
  }
15705
15782
  _changeUnitListener() {
15706
- oe(
15707
- this._univerInstanceService.getCurrentTypeOfUnit$(ae.UNIVER_SHEET).subscribe(() => {
15783
+ J(
15784
+ this._univerInstanceService.getCurrentTypeOfUnit$(j.UNIVER_SHEET).subscribe(() => {
15708
15785
  this._unRegisterDescriptions(), this._registerDescriptions();
15709
15786
  })
15710
15787
  );
@@ -15713,12 +15790,12 @@ let tt = class extends ne {
15713
15790
  this.disposeWithMe(
15714
15791
  this._commandService.onCommandExecuted((e, n) => {
15715
15792
  if (!(n != null && n.fromCollab)) {
15716
- if (e.id === Nn.id)
15793
+ if (e.id === Ba.id)
15717
15794
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15718
- else if (e.id === ye.id) {
15795
+ else if (e.id === De.id) {
15719
15796
  const i = e.params;
15720
15797
  this._registerDescription(i);
15721
- } else if (e.id === bt.id) {
15798
+ } else if (e.id === gt.id) {
15722
15799
  const i = e.params;
15723
15800
  this._unregisterDescription(i);
15724
15801
  }
@@ -15731,7 +15808,7 @@ let tt = class extends ne {
15731
15808
  if (n == null || i == null)
15732
15809
  return;
15733
15810
  const { name: r, comment: o, formulaOrRefString: u, localSheetId: f } = e;
15734
- !this._descriptionService.hasDescription(r) && (f == null || f === dt || f === i) && this._descriptionService.registerDescriptions([{
15811
+ !this._descriptionService.hasDescription(r) && (f == null || f === Nt || f === i) && this._descriptionService.registerDescriptions([{
15735
15812
  functionName: r,
15736
15813
  description: u + (o || ""),
15737
15814
  abstract: u,
@@ -15756,7 +15833,7 @@ let tt = class extends ne {
15756
15833
  }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
15757
15834
  }
15758
15835
  _getUnitIdAndSheetId() {
15759
- const e = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET);
15836
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
15760
15837
  if (e == null)
15761
15838
  return {};
15762
15839
  const n = e.getActiveSheet();
@@ -15775,7 +15852,7 @@ let tt = class extends ne {
15775
15852
  const r = [];
15776
15853
  this._preUnitId = e, Array.from(Object.values(i)).forEach((o) => {
15777
15854
  const { name: u, comment: f, formulaOrRefString: m, localSheetId: c } = o;
15778
- !this._descriptionService.hasDescription(u) && (c == null || c === dt || c === n) && r.push({
15855
+ !this._descriptionService.hasDescription(u) && (c == null || c === Nt || c === n) && r.push({
15779
15856
  functionName: u,
15780
15857
  description: m + (f || ""),
15781
15858
  abstract: m,
@@ -15794,139 +15871,265 @@ let tt = class extends ne {
15794
15871
  const r = [];
15795
15872
  Array.from(Object.values(i)).forEach((o) => {
15796
15873
  const { name: u, localSheetId: f } = o;
15797
- f !== dt && f !== n && r.push(u);
15874
+ f !== Nt && f !== n && r.push(u);
15798
15875
  }), this._descriptionService.unregisterDescriptions(r);
15799
15876
  }
15800
15877
  };
15801
- tt = Cr([
15802
- He(0, Gt),
15803
- He(1, Bt),
15804
- He(2, Se),
15805
- He(3, fe)
15806
- ], tt);
15807
- var Dr = Object.getOwnPropertyDescriptor, br = (a, e, n, i) => {
15808
- for (var r = i > 1 ? void 0 : i ? Dr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15878
+ nt = xr([
15879
+ He(0, Pt),
15880
+ He(1, dt),
15881
+ He(2, Ee),
15882
+ He(3, ue)
15883
+ ], nt);
15884
+ var _r = Object.getOwnPropertyDescriptor, yr = (a, e, n, i) => {
15885
+ for (var r = i > 1 ? void 0 : i ? _r(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15809
15886
  (u = a[o]) && (r = u(r) || r);
15810
15887
  return r;
15811
- }, Or = (a, e) => (n, i) => e(n, i, a);
15812
- let at = class extends ne {
15888
+ }, qr = (a, e) => (n, i) => e(n, i, a);
15889
+ let it = class extends ee {
15813
15890
  constructor(a) {
15814
15891
  super(), this._commandService = a, [
15815
- ni,
15816
- ii,
15817
- Oe
15892
+ mi,
15893
+ fi,
15894
+ _e
15818
15895
  ].forEach((e) => this._commandService.registerCommand(e));
15819
15896
  }
15820
15897
  };
15821
- at = br([
15822
- Or(0, fe)
15823
- ], at);
15824
- var Mr = Object.getOwnPropertyDescriptor, xr = (a, e, n, i) => {
15825
- for (var r = i > 1 ? void 0 : i ? Mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15898
+ it = yr([
15899
+ qr(0, ue)
15900
+ ], it);
15901
+ var gr = Object.getOwnPropertyDescriptor, hr = (a, e, n, i) => {
15902
+ for (var r = i > 1 ? void 0 : i ? gr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15826
15903
  (u = a[o]) && (r = u(r) || r);
15827
15904
  return r;
15828
15905
  }, we = (a, e) => (n, i) => e(n, i, a);
15829
- function sa(a, e, n, i) {
15906
+ let rt = class extends ee {
15907
+ constructor(e, n, i, r) {
15908
+ super();
15909
+ W(this, "_preUnitId", null);
15910
+ this._descriptionService = e, this._univerInstanceService = n, this._commandService = i, this._superTableService = r, this._initialize();
15911
+ }
15912
+ _initialize() {
15913
+ this._descriptionListener(), this._changeUnitListener(), this._changeSheetListener();
15914
+ }
15915
+ _descriptionListener() {
15916
+ J(
15917
+ this._superTableService.update$.subscribe(() => {
15918
+ this._registerDescriptions();
15919
+ })
15920
+ );
15921
+ }
15922
+ _changeUnitListener() {
15923
+ J(
15924
+ this._univerInstanceService.getCurrentTypeOfUnit$(j.UNIVER_SHEET).subscribe(() => {
15925
+ this._unRegisterDescriptions(), this._registerDescriptions();
15926
+ })
15927
+ );
15928
+ }
15929
+ _changeSheetListener() {
15930
+ this.disposeWithMe(
15931
+ this._commandService.onCommandExecuted((e, n) => {
15932
+ if (!(n != null && n.fromCollab)) {
15933
+ if (e.id === Ba.id)
15934
+ this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15935
+ else if (e.id === $n.id) {
15936
+ const i = e.params;
15937
+ this._registerDescription(i);
15938
+ } else if (e.id === jn.id) {
15939
+ const i = e.params;
15940
+ this._unregisterDescription(i);
15941
+ }
15942
+ }
15943
+ })
15944
+ );
15945
+ }
15946
+ _registerDescription(e) {
15947
+ var u, f;
15948
+ const { unitId: n, sheetId: i } = this._getUnitIdAndSheetId();
15949
+ if (n == null || i == null)
15950
+ return;
15951
+ const { tableName: r, reference: o } = e;
15952
+ if (!this._descriptionService.hasDescription(r)) {
15953
+ 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);
15954
+ this._descriptionService.registerDescriptions([{
15955
+ functionName: r,
15956
+ description: c,
15957
+ abstract: c,
15958
+ functionType: t.Table,
15959
+ functionParameter: []
15960
+ }]);
15961
+ }
15962
+ }
15963
+ _unregisterDescription(e) {
15964
+ const { tableName: n } = e;
15965
+ this._descriptionService.unregisterDescriptions([n]);
15966
+ }
15967
+ _unRegisterDescriptions() {
15968
+ if (this._preUnitId == null)
15969
+ return;
15970
+ const e = this._superTableService.getTableMap(this._preUnitId);
15971
+ if (e == null)
15972
+ return;
15973
+ const n = [];
15974
+ e.forEach((i, r) => {
15975
+ n.push(r);
15976
+ }), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
15977
+ }
15978
+ _getUnitIdAndSheetId() {
15979
+ const e = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET);
15980
+ if (e == null)
15981
+ return {};
15982
+ const n = e.getActiveSheet();
15983
+ return n == null ? {} : {
15984
+ unitId: e.getUnitId(),
15985
+ sheetId: n.getSheetId()
15986
+ };
15987
+ }
15988
+ _registerDescriptions() {
15989
+ const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
15990
+ if (e == null || n == null)
15991
+ return;
15992
+ const i = this._superTableService.getTableMap(e);
15993
+ if (!i)
15994
+ return;
15995
+ const r = [];
15996
+ this._preUnitId = e, i.forEach((o, u) => {
15997
+ var c, s;
15998
+ const f = ((s = (c = this._univerInstanceService.getUnit(e)) == null ? void 0 : c.getSheetBySheetId(o.sheetId)) == null ? void 0 : s.getName()) || "", m = ze(f, o.range);
15999
+ this._descriptionService.hasDescription(u) || r.push({
16000
+ functionName: u,
16001
+ description: m,
16002
+ abstract: m,
16003
+ functionType: t.Table,
16004
+ functionParameter: []
16005
+ });
16006
+ }), this._descriptionService.registerDescriptions(r);
16007
+ }
16008
+ _unregisterDescriptionsForNotInSheetId() {
16009
+ const { unitId: e, sheetId: n } = this._getUnitIdAndSheetId();
16010
+ if (e == null || n == null)
16011
+ return;
16012
+ const i = this._superTableService.getTableMap(e);
16013
+ if (!i)
16014
+ return;
16015
+ const r = [];
16016
+ i.forEach((o, u) => {
16017
+ r.push(u);
16018
+ }), this._descriptionService.unregisterDescriptions(r);
16019
+ }
16020
+ };
16021
+ rt = hr([
16022
+ we(0, Pt),
16023
+ we(1, Ee),
16024
+ we(2, ue),
16025
+ we(3, zn)
16026
+ ], rt);
16027
+ var Ur = Object.getOwnPropertyDescriptor, Fr = (a, e, n, i) => {
16028
+ for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16029
+ (u = a[o]) && (r = u(r) || r);
16030
+ return r;
16031
+ }, Ye = (a, e) => (n, i) => e(n, i, a);
16032
+ function pa(a, e, n, i) {
15830
16033
  const r = a.sequenceNodesBuilder(e);
15831
16034
  if (r == null)
15832
16035
  return e;
15833
16036
  const o = [];
15834
16037
  for (let u = 0, f = r.length; u < f; u++) {
15835
16038
  const m = r[u];
15836
- if (typeof m == "string" || m.nodeType !== te.REFERENCE)
16039
+ if (typeof m == "string" || m.nodeType !== ie.REFERENCE)
15837
16040
  continue;
15838
- const { token: c } = m, d = Le(c), { sheetName: P, unitId: E } = d;
15839
- let p = d.range;
15840
- p.startAbsoluteRefType === Qe.ALL && p.endAbsoluteRefType === Qe.ALL || (p = St(p, n, i), o.push({
16041
+ const { token: c } = m, s = Pe(c), { sheetName: L, unitId: E } = s;
16042
+ let p = s.range;
16043
+ p.startAbsoluteRefType === $e.ALL && p.endAbsoluteRefType === $e.ALL || (p = xt(p, n, i), o.push({
15841
16044
  unitId: E,
15842
- sheetName: P,
16045
+ sheetName: L,
15843
16046
  range: p
15844
16047
  }));
15845
16048
  }
15846
16049
  return o.map((u) => `${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|");
15847
16050
  }
15848
- let xt = class extends ne {
16051
+ let Ft = class extends ee {
15849
16052
  constructor(a, e, n, i) {
15850
16053
  super(), this._refRangeService = a, this._lexerTreeBuilder = e, this._univerInstanceService = n, this._injector = i;
15851
16054
  }
15852
16055
  transformFormulaByEffectCommand(a, e, n, i) {
15853
- const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((d) => {
15854
- if (typeof d == "object" && d.nodeType === te.REFERENCE) {
15855
- const P = Le(d.token), { range: E, unitId: p, sheetName: I } = P, S = this._univerInstanceService.getUnit(p || a), R = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
16056
+ const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), u = o.getActiveSheet(), f = o.getUnitId(), m = u.getSheetId(), c = r == null ? void 0 : r.map((s) => {
16057
+ if (typeof s == "object" && s.nodeType === ie.REFERENCE) {
16058
+ const L = Pe(s.token), { range: E, unitId: p, sheetName: I } = L, S = this._univerInstanceService.getUnit(p || a), R = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
15856
16059
  if (!R)
15857
16060
  throw new Error("Sheet not found");
15858
- const s = S.getUnitId(), A = R.getSheetId();
15859
- if (s !== f || A !== m)
15860
- return d;
15861
- const N = ea(E, i);
15862
- let L = "";
16061
+ const d = S.getUnitId(), A = R.getSheetId();
16062
+ if (d !== f || A !== m)
16063
+ return s;
16064
+ const N = na(E, i);
16065
+ let P = "";
15863
16066
  if (N) {
15864
- const g = N.startColumn - E.startColumn, q = N.startRow - E.startRow, U = St(E, g, q);
15865
- p && I ? L = ra(p, I, U) : I ? L = oa(I, U) : L = _e(U);
16067
+ const g = N.startColumn - E.startColumn, q = N.startRow - E.startRow, U = xt(E, g, q);
16068
+ p && I ? P = ma(p, I, U) : I ? P = ze(I, U) : P = Ce(U);
15866
16069
  } else
15867
- L = Q.REF;
16070
+ P = $.REF;
15868
16071
  return {
15869
- ...d,
15870
- token: L
16072
+ ...s,
16073
+ token: P
15871
16074
  };
15872
16075
  } else
15873
- return d;
16076
+ return s;
15874
16077
  });
15875
- return c ? `=${$e(c)}` : "";
16078
+ return c ? `=${je(c)}` : "";
15876
16079
  }
15877
16080
  registerFormula(a, e, n, i) {
15878
- const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(), f = (m) => {
15879
- const c = this._univerInstanceService.getCurrentUnitForType(ae.UNIVER_SHEET), d = c.getActiveSheet(), P = c.getUnitId(), E = d.getSheetId(), p = o == null ? void 0 : o.map((S) => {
15880
- if (typeof S == "object" && S.nodeType === te.REFERENCE) {
16081
+ const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new Qe(), f = (m) => {
16082
+ const c = this._univerInstanceService.getCurrentUnitForType(j.UNIVER_SHEET), s = c.getActiveSheet(), L = c.getUnitId(), E = s.getSheetId(), p = o == null ? void 0 : o.map((S) => {
16083
+ if (typeof S == "object" && S.nodeType === ie.REFERENCE) {
15881
16084
  const R = r.get(S.token);
15882
- if (R.unitId !== P || R.subUnitId !== E)
16085
+ if (R.unitId !== L || R.subUnitId !== E)
15883
16086
  return S;
15884
- const s = ea(R.range, m);
16087
+ const d = na(R.range, m);
15885
16088
  let A = "";
15886
- if (s) {
15887
- const N = s.startColumn - R.range.startColumn, L = s.startRow - R.range.startRow, g = St(R.range, N, L);
15888
- R.unitId && R.sheetName ? A = ra(R.unitId, R.sheetName, g) : R.sheetName ? A = oa(R.sheetName, g) : A = _e(g);
16089
+ if (d) {
16090
+ const N = d.startColumn - R.range.startColumn, P = d.startRow - R.range.startRow, g = xt(R.range, N, P);
16091
+ R.unitId && R.sheetName ? A = ma(R.unitId, R.sheetName, g) : R.sheetName ? A = ze(R.sheetName, g) : A = Ce(g);
15889
16092
  } else
15890
- A = Q.REF;
16093
+ A = $.REF;
15891
16094
  return {
15892
16095
  ...S,
15893
16096
  token: A
15894
16097
  };
15895
16098
  } else
15896
16099
  return S;
15897
- }), I = p && $e(p);
16100
+ }), I = p && je(p);
15898
16101
  return i(`=${I}`);
15899
16102
  };
15900
16103
  return o == null || o.forEach((m) => {
15901
- if (typeof m == "object" && m.nodeType === te.REFERENCE) {
15902
- const c = Le(m.token), { range: d, unitId: P, sheetName: E } = c, p = this._univerInstanceService.getUnit(P || a), I = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
16104
+ if (typeof m == "object" && m.nodeType === ie.REFERENCE) {
16105
+ const c = Pe(m.token), { range: s, unitId: L, sheetName: E } = c, p = this._univerInstanceService.getUnit(L || a), I = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
15903
16106
  if (!I)
15904
16107
  return;
15905
- const S = p.getUnitId(), R = I.getSheetId(), s = {
16108
+ const S = p.getUnitId(), R = I.getSheetId(), d = {
15906
16109
  unitId: S,
15907
16110
  subUnitId: R,
15908
- range: d,
16111
+ range: s,
15909
16112
  sheetName: E
15910
16113
  };
15911
- r.set(m.token, s), u.add(this._refRangeService.registerRefRange(d, f, S, R));
16114
+ r.set(m.token, d), u.add(this._refRangeService.registerRefRange(s, f, S, R));
15912
16115
  }
15913
16116
  }), u;
15914
16117
  }
15915
16118
  _getFormulaDependcy(a, e, n, i) {
15916
- const r = Me(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
16119
+ const r = ye(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
15917
16120
  return r == null || r.forEach((u) => {
15918
- if (typeof u == "object" && u.nodeType === te.REFERENCE) {
15919
- const f = Le(u.token), { range: m, unitId: c, sheetName: d } = f;
15920
- if (m.startAbsoluteRefType === Qe.ALL && m.endAbsoluteRefType === Qe.ALL)
16121
+ if (typeof u == "object" && u.nodeType === ie.REFERENCE) {
16122
+ const f = Pe(u.token), { range: m, unitId: c, sheetName: s } = f;
16123
+ if (m.startAbsoluteRefType === $e.ALL && m.endAbsoluteRefType === $e.ALL)
15921
16124
  return;
15922
- const P = this._univerInstanceService.getUnit(c || a), E = d ? P == null ? void 0 : P.getSheetBySheetName(d) : P == null ? void 0 : P.getSheetBySheetId(e);
16125
+ const L = this._univerInstanceService.getUnit(c || a), E = s ? L == null ? void 0 : L.getSheetBySheetName(s) : L == null ? void 0 : L.getSheetBySheetId(e);
15923
16126
  if (!E)
15924
16127
  return;
15925
- const p = P.getUnitId(), I = E.getSheetId(), S = i[0].startRow, R = i[0].startColumn, s = m.startRow, A = m.startColumn, N = i.map((L) => ({
15926
- startRow: L.startRow - S + s,
15927
- endRow: L.endRow - S + s,
15928
- startColumn: L.startColumn - R + A,
15929
- endColumn: L.endColumn - R + A
16128
+ const p = L.getUnitId(), I = E.getSheetId(), S = i[0].startRow, R = i[0].startColumn, d = m.startRow, A = m.startColumn, N = i.map((P) => ({
16129
+ startRow: P.startRow - S + d,
16130
+ endRow: P.endRow - S + d,
16131
+ startColumn: P.startColumn - R + A,
16132
+ endColumn: P.endColumn - R + A
15930
16133
  }));
15931
16134
  o.push({
15932
16135
  unitId: p,
@@ -15938,70 +16141,70 @@ let xt = class extends ne {
15938
16141
  }
15939
16142
  // eslint-disable-next-line max-lines-per-function
15940
16143
  registerRangeFormula(a, e, n, i, r) {
15941
- const o = new ke(), u = i.map((m) => this._getFormulaDependcy(a, e, m, n)), f = (m) => {
15942
- const c = n[0].startRow, d = n[0].startColumn, P = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Sn(this._injector, m);
15943
- for (const { unitId: I, subUnitId: S, ranges: R } of P)
16144
+ const o = new Qe(), u = i.map((m) => this._getFormulaDependcy(a, e, m, n)), f = (m) => {
16145
+ const c = n[0].startRow, s = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Dn(this._injector, m);
16146
+ for (const { unitId: I, subUnitId: S, ranges: R } of L)
15944
16147
  if (I === p.unitId && S === p.subUnitId) {
15945
- const s = [], A = R[0].startRow, N = R[0].startColumn, L = A - c, g = N - d;
16148
+ const d = [], A = R[0].startRow, N = R[0].startColumn, P = A - c, g = N - s;
15946
16149
  for (const q of p.ranges) {
15947
- const U = R.map((h) => We(q, h)).filter(Boolean);
15948
- U.length > 0 && s.push(...U);
16150
+ const U = R.map((h) => Ke(q, h)).filter(Boolean);
16151
+ U.length > 0 && d.push(...U);
15949
16152
  }
15950
- s.length > 0 && E.push(
15951
- s.map((q) => ({
15952
- startRow: q.startRow - L,
15953
- endRow: q.endRow - L,
16153
+ d.length > 0 && E.push(
16154
+ d.map((q) => ({
16155
+ startRow: q.startRow - P,
16156
+ endRow: q.endRow - P,
15954
16157
  startColumn: q.startColumn - g,
15955
16158
  endColumn: q.endColumn - g
15956
16159
  }))
15957
16160
  );
15958
16161
  }
15959
16162
  if (E.length > 0) {
15960
- const I = me.splitIntoGrid([...E.flat()]), S = me.subtractMulti(n, I);
15961
- S.sort((L, g) => L.startRow - g.startRow || L.startColumn - g.startColumn);
16163
+ const I = fe.splitIntoGrid([...E.flat()]), S = fe.subtractMulti(n, I);
16164
+ S.sort((P, g) => P.startRow - g.startRow || P.startColumn - g.startColumn);
15962
16165
  const R = /* @__PURE__ */ new Map();
15963
- for (let L = 0; L < I.length; L++) {
15964
- const g = I[L], q = g.startRow, U = g.startColumn, h = q - c, M = U - d, F = An(g, m).sort(($, ie) => $.startRow - ie.startRow || $.startColumn - ie.startColumn);
16166
+ for (let P = 0; P < I.length; P++) {
16167
+ const g = I[P], q = g.startRow, U = g.startColumn, h = q - c, M = U - s, F = bn(g, m).sort((z, re) => z.startRow - re.startRow || z.startColumn - re.startColumn);
15965
16168
  if (!F.length)
15966
16169
  continue;
15967
- const B = F[0].startRow, J = F[0].startColumn, O = B - c, ce = J - d, ee = [];
15968
- for (let $ = 0; $ < i.length; $++) {
15969
- const ie = i[$], re = Me(ie), he = re ? this._lexerTreeBuilder.moveFormulaRefOffset(ie, M, h) : ie, j = re ? this.transformFormulaByEffectCommand(a, e, he, m) : he, lt = sa(this._lexerTreeBuilder, j, -ce, -O);
15970
- ee.push({
15971
- newFormula: j,
15972
- orginFormula: lt
16170
+ const B = F[0].startRow, ae = F[0].startColumn, O = B - c, ce = ae - s, ne = [];
16171
+ for (let z = 0; z < i.length; z++) {
16172
+ const re = i[z], oe = ye(re), Ue = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, M, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, Ue, m) : Ue, Et = pa(this._lexerTreeBuilder, Z, -ce, -O);
16173
+ ne.push({
16174
+ newFormula: Z,
16175
+ orginFormula: Et
15973
16176
  });
15974
16177
  }
15975
16178
  const le = {
15976
- formulas: ee,
16179
+ formulas: ne,
15977
16180
  ranges: F,
15978
- key: ee.map(($) => $.orginFormula).join("_")
16181
+ key: ne.map((z) => z.orginFormula).join("_")
15979
16182
  };
15980
16183
  R.has(le.key) ? R.get(le.key).push(le) : R.set(le.key, [le]);
15981
16184
  }
15982
- const s = i.map((L) => sa(this._lexerTreeBuilder, L, 0, 0)).join("_");
16185
+ const d = i.map((P) => pa(this._lexerTreeBuilder, P, 0, 0)).join("_");
15983
16186
  if (S.length > 0) {
15984
- const L = S[0].startRow, g = S[0].startColumn, q = [];
16187
+ const P = S[0].startRow, g = S[0].startColumn, q = [];
15985
16188
  for (let h = 0; h < i.length; h++) {
15986
16189
  const M = i[h];
15987
16190
  q.push({
15988
- newFormula: Me(M) ? this._lexerTreeBuilder.moveFormulaRefOffset(M, g - d, L - c) : M,
16191
+ newFormula: ye(M) ? this._lexerTreeBuilder.moveFormulaRefOffset(M, g - s, P - c) : M,
15989
16192
  orginFormula: M
15990
16193
  });
15991
16194
  }
15992
16195
  const U = {
15993
16196
  formulas: q,
15994
16197
  ranges: S,
15995
- key: s
16198
+ key: d
15996
16199
  };
15997
16200
  R.has(U.key) ? R.get(U.key).push(U) : R.set(U.key, [U]);
15998
16201
  }
15999
16202
  const A = [], N = Array.from(R.keys());
16000
- for (let L = N.length - 1; L >= 0; L--) {
16001
- const g = N[L], q = R.get(g).sort((M, F) => M.ranges[0].startRow - F.ranges[0].startRow || M.ranges[0].startColumn - F.ranges[0].startColumn), U = [];
16203
+ for (let P = N.length - 1; P >= 0; P--) {
16204
+ const g = N[P], q = R.get(g).sort((M, F) => M.ranges[0].startRow - F.ranges[0].startRow || M.ranges[0].startColumn - F.ranges[0].startColumn), U = [];
16002
16205
  for (let M = 0; M < q[0].formulas.length; M++)
16003
16206
  U.push(q[0].formulas[M].newFormula);
16004
- const h = me.mergeRanges(q.map((M) => M.ranges).flat());
16207
+ const h = fe.mergeRanges(q.map((M) => M.ranges).flat());
16005
16208
  h.sort((M, F) => M.startRow - F.startRow || M.startColumn - F.startColumn), A.push({
16006
16209
  formulas: U,
16007
16210
  ranges: h
@@ -16017,62 +16220,62 @@ let xt = class extends ne {
16017
16220
  return n.forEach((m) => {
16018
16221
  const c = this._refRangeService.registerRefRange(m, f, a, e);
16019
16222
  o.add(c);
16020
- }), [...u.flat()].forEach(({ unitId: m, subUnitId: c, ranges: d }) => {
16021
- d.forEach((P) => {
16022
- const E = this._refRangeService.registerRefRange(P, f, m, c);
16223
+ }), [...u.flat()].forEach(({ unitId: m, subUnitId: c, ranges: s }) => {
16224
+ s.forEach((L) => {
16225
+ const E = this._refRangeService.registerRefRange(L, f, m, c);
16023
16226
  o.add(E);
16024
16227
  });
16025
16228
  }), o;
16026
16229
  }
16027
16230
  };
16028
- xt = xr([
16029
- we(0, X(Rn)),
16030
- we(1, X(vt)),
16031
- we(2, Se),
16032
- we(3, X(ut))
16033
- ], xt);
16034
- var _r = Object.getOwnPropertyDescriptor, yr = (a, e, n, i) => {
16035
- for (var r = i > 1 ? void 0 : i ? _r(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16231
+ Ft = Fr([
16232
+ Ye(0, X(Cn)),
16233
+ Ye(1, X(pt)),
16234
+ Ye(2, Ee),
16235
+ Ye(3, X(ct))
16236
+ ], Ft);
16237
+ var Br = Object.getOwnPropertyDescriptor, vr = (a, e, n, i) => {
16238
+ for (var r = i > 1 ? void 0 : i ? Br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16036
16239
  (u = a[o]) && (r = u(r) || r);
16037
16240
  return r;
16038
- }, qr = (a, e) => (n, i) => e(n, i, a);
16039
- const Ht = "sheets-formula.remote-register-function.service", Xa = gt(Ht);
16040
- let nt = class {
16241
+ }, Vr = (a, e) => (n, i) => e(n, i, a);
16242
+ const Xt = "sheets-formula.remote-register-function.service", Qa = Gt(Xt);
16243
+ let ot = class {
16041
16244
  constructor(a) {
16042
16245
  this._functionService = a;
16043
16246
  }
16044
16247
  async registerFunctions(a) {
16045
- const e = a.map(([n, i]) => gr(n, i));
16248
+ const e = a.map(([n, i]) => Gr(n, i));
16046
16249
  this._functionService.registerExecutors(...e);
16047
16250
  }
16048
16251
  async registerAsyncFunctions(a) {
16049
- const e = a.map(([n, i]) => hr(n, i));
16252
+ const e = a.map(([n, i]) => Hr(n, i));
16050
16253
  this._functionService.registerExecutors(...e);
16051
16254
  }
16052
16255
  async unregisterFunctions(a) {
16053
16256
  this._functionService.unregisterExecutors(...a), this._functionService.unregisterDescriptions(...a), this._functionService.deleteFormulaAstCacheKey(...a);
16054
16257
  }
16055
16258
  };
16056
- nt = yr([
16057
- qr(0, Vt)
16058
- ], nt);
16059
- function gr(a, e) {
16060
- const n = new Ot(e), i = new Function(`return ${a}`)();
16259
+ ot = vr([
16260
+ Vr(0, Lt)
16261
+ ], ot);
16262
+ function Gr(a, e) {
16263
+ const n = new ht(e), i = new Function(`return ${a}`)();
16061
16264
  return n.calculateCustom = i, n;
16062
16265
  }
16063
- function hr(a, e) {
16064
- const n = new Ua(e), i = new Function(`return ${a}`)();
16266
+ function Hr(a, e) {
16267
+ const n = new Va(e), i = new Function(`return ${a}`)();
16065
16268
  return n.calculateCustom = i, n;
16066
16269
  }
16067
- var Ur = Object.getOwnPropertyDescriptor, Fr = (a, e, n, i) => {
16068
- for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16270
+ var wr = Object.getOwnPropertyDescriptor, Yr = (a, e, n, i) => {
16271
+ for (var r = i > 1 ? void 0 : i ? wr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16069
16272
  (u = a[o]) && (r = u(r) || r);
16070
16273
  return r;
16071
- }, Ye = (a, e) => (n, i) => e(n, i, a);
16072
- const Br = gt(
16274
+ }, Xe = (a, e) => (n, i) => e(n, i, a);
16275
+ const Xr = Gt(
16073
16276
  "sheets-formula.register-function-service"
16074
16277
  );
16075
- let _t = class extends ne {
16278
+ let Bt = class extends ee {
16076
16279
  constructor(a, e, n, i) {
16077
16280
  super(), this._localeService = a, this._descriptionService = e, this._functionService = n, this._remoteRegisterFunctionService = i;
16078
16281
  }
@@ -16085,7 +16288,7 @@ let _t = class extends ne {
16085
16288
  registerFunctions(a) {
16086
16289
  const { locales: e, description: n, calculate: i } = a;
16087
16290
  e && this._localeService.load(e);
16088
- const r = new ke();
16291
+ const r = new Qe();
16089
16292
  if (n)
16090
16293
  r.add(this._descriptionService.registerDescriptions(n));
16091
16294
  else {
@@ -16101,7 +16304,7 @@ let _t = class extends ne {
16101
16304
  return r.add(this._registerLocalExecutors(i)), this._remoteRegisterFunctionService && r.add(this._registerRemoteExecutors(i)), r;
16102
16305
  }
16103
16306
  _registerSingleFunction(a) {
16104
- const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new ke();
16307
+ const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new Qe();
16105
16308
  if (r && this._localeService.load(r), typeof i == "string") {
16106
16309
  const m = {
16107
16310
  functionName: e,
@@ -16113,118 +16316,120 @@ let _t = class extends ne {
16113
16316
  u.add(this._descriptionService.registerDescriptions([m]));
16114
16317
  } else
16115
16318
  u.add(this._descriptionService.registerDescriptions([i]));
16116
- const f = o ? new Ua(e) : new Ot(e);
16117
- return f.calculateCustom = n, this._functionService.registerExecutors(f), u.add(oe(() => this._functionService.unregisterExecutors(e))), u.add(oe(() => this._functionService.unregisterDescriptions(e))), u.add(oe(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
16118
- oe(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16319
+ const f = o ? new Va(e) : new ht(e);
16320
+ 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(
16321
+ J(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
16119
16322
  )), u;
16120
16323
  }
16121
16324
  _registerLocalExecutors(a) {
16122
16325
  const e = a.map(([i, r]) => r), n = a.map(([i, r]) => {
16123
- const o = new Ot(r);
16326
+ const o = new ht(r);
16124
16327
  return o.calculateCustom = i, o;
16125
16328
  });
16126
- return this._functionService.registerExecutors(...n), oe(() => this._functionService.unregisterExecutors(...e));
16329
+ return this._functionService.registerExecutors(...n), J(() => this._functionService.unregisterExecutors(...e));
16127
16330
  }
16128
16331
  _registerRemoteExecutors(a) {
16129
16332
  const e = [], n = a.map(([i, r]) => (e.push(r), [i.toString(), r]));
16130
- return this._remoteRegisterFunctionService.registerFunctions(n), oe(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16333
+ return this._remoteRegisterFunctionService.registerFunctions(n), J(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
16131
16334
  }
16132
16335
  };
16133
- _t = Fr([
16134
- Ye(0, X(qt)),
16135
- Ye(1, X(Gt)),
16136
- Ye(2, Vt),
16137
- Ye(3, Ja(Xa))
16138
- ], _t);
16139
- var vr = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Gr = (a, e, n) => e in a ? vr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, Wa = (a, e, n, i) => {
16140
- for (var r = i > 1 ? void 0 : i ? Vr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16336
+ Bt = Yr([
16337
+ Xe(0, X(Vt)),
16338
+ Xe(1, X(Pt)),
16339
+ Xe(2, Lt),
16340
+ Xe(3, nn(Qa))
16341
+ ], Bt);
16342
+ var Wr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, kr = (a, e, n) => e in a ? Wr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, $a = (a, e, n, i) => {
16343
+ for (var r = i > 1 ? void 0 : i ? Kr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16141
16344
  (u = a[o]) && (r = u(r) || r);
16142
16345
  return r;
16143
- }, it = (a, e) => (n, i) => e(n, i, a), ct = (a, e, n) => Gr(a, typeof e != "symbol" ? e + "" : e, n);
16144
- let rt = class extends Ta {
16145
- constructor(a = ca, e, n) {
16346
+ }, ut = (a, e) => (n, i) => e(n, i, a), Tt = (a, e, n) => kr(a, typeof e != "symbol" ? e + "" : e, n);
16347
+ let mt = class extends Ia {
16348
+ constructor(a = sa, e, n) {
16146
16349
  super(), this._config = a, this._injector = e, this._configService = n;
16147
- const { ...i } = Ea(
16350
+ const { ...i } = Na(
16148
16351
  {},
16149
- ca,
16352
+ sa,
16150
16353
  this._config
16151
16354
  );
16152
- this._configService.setConfig(ri, i);
16355
+ this._configService.setConfig(ci, i);
16153
16356
  }
16154
16357
  onStarting() {
16155
- this._injector.add([nt]), this._injector.get(va).registerChannel(
16156
- Ht,
16157
- ti(this._injector.get(nt))
16358
+ this._injector.add([ot]), this._injector.get(wa).registerChannel(
16359
+ Xt,
16360
+ oi(this._injector.get(ot))
16158
16361
  );
16159
16362
  }
16160
16363
  };
16161
- ct(rt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16162
- ct(rt, "type", ae.UNIVER_SHEET);
16163
- rt = Wa([
16164
- Pa(Fa),
16165
- it(1, X(ut)),
16166
- it(2, Ae)
16167
- ], rt);
16168
- let ot = class extends Ta {
16169
- constructor(a = fa, e, n) {
16364
+ Tt(mt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16365
+ Tt(mt, "type", j.UNIVER_SHEET);
16366
+ mt = $a([
16367
+ Ea(Ga),
16368
+ ut(1, X(ct)),
16369
+ ut(2, be)
16370
+ ], mt);
16371
+ let ft = class extends Ia {
16372
+ constructor(a = la, e, n) {
16170
16373
  super(), this._config = a, this._injector = e, this._configService = n;
16171
- const { ...i } = Ea(
16374
+ const { ...i } = Na(
16172
16375
  {},
16173
- fa,
16376
+ la,
16174
16377
  this._config
16175
16378
  );
16176
- this._configService.setConfig(ge, i, { merge: !0 });
16379
+ this._configService.setConfig(he, i, { merge: !0 });
16177
16380
  }
16178
16381
  onStarting() {
16179
16382
  const a = this._injector, e = [
16180
- [Br, { useClass: _t }],
16181
- [Gt, { useClass: Mt }],
16383
+ [Xr, { useClass: Bt }],
16384
+ [Pt, { useClass: Ut }],
16385
+ [it],
16386
+ [Ft],
16387
+ [Ze],
16182
16388
  [at],
16183
- [xt],
16184
- [je],
16389
+ [qe],
16185
16390
  [et],
16186
- [xe],
16187
- [Ze],
16188
- [Je],
16189
16391
  [tt],
16190
- [ze]
16392
+ [nt],
16393
+ [Je],
16394
+ [rt]
16191
16395
  ];
16192
16396
  if (this._config.notExecuteFormula) {
16193
- const n = a.get(va);
16194
- e.push([Xa, {
16195
- useFactory: () => ai(n.requestChannel(Ht))
16397
+ const n = a.get(wa);
16398
+ e.push([Qa, {
16399
+ useFactory: () => ui(n.requestChannel(Xt))
16196
16400
  }]);
16197
16401
  }
16198
16402
  e.forEach((n) => a.add(n));
16199
16403
  }
16200
16404
  onReady() {
16201
- Fe(this._injector, [
16405
+ Be(this._injector, [
16406
+ [it],
16407
+ [tt],
16202
16408
  [at],
16203
- [Je],
16204
16409
  [et],
16205
- [Ze],
16206
- [ze]
16207
- ]), Yt() && Fe(this._injector, [
16208
- [xe]
16410
+ [Je]
16411
+ ]), Kt() && Be(this._injector, [
16412
+ [qe]
16209
16413
  ]);
16210
16414
  }
16211
16415
  onRendered() {
16212
- Fe(this._injector, [
16213
- [tt]
16214
- ]), Yt() || Fe(this._injector, [
16215
- [xe]
16416
+ Be(this._injector, [
16417
+ [nt],
16418
+ [rt]
16419
+ ]), Kt() || Be(this._injector, [
16420
+ [qe]
16216
16421
  ]);
16217
16422
  }
16218
16423
  };
16219
- ct(ot, "pluginName", Ji);
16220
- ct(ot, "type", ae.UNIVER_SHEET);
16221
- ot = Wa([
16222
- Pa(Fa, Cn),
16223
- it(1, X(ut)),
16224
- it(2, Ae)
16225
- ], ot);
16226
- function kr(a, e, n, i) {
16227
- const r = a.get(kn), o = a.get(Qn), u = a.get($n), f = a.get(jn);
16424
+ Tt(ft, "pluginName", ir);
16425
+ Tt(ft, "type", j.UNIVER_SHEET);
16426
+ ft = $a([
16427
+ Ea(Ga, On),
16428
+ ut(1, X(ct)),
16429
+ ut(2, be)
16430
+ ], ft);
16431
+ function eo(a, e, n, i) {
16432
+ const r = a.get(Zn), o = a.get(Jn), u = a.get(ei), f = a.get(ti);
16228
16433
  r.load({
16229
16434
  formulaData: {},
16230
16435
  arrayFormulaCellData: {},
@@ -16240,27 +16445,27 @@ function kr(a, e, n, i) {
16240
16445
  },
16241
16446
  dirtyUnitOtherFormulaMap: {}
16242
16447
  });
16243
- const m = o.treeBuilder(e), c = u.parse(m), d = f.execute(zn(c));
16244
- return Zn(d);
16448
+ const m = o.treeBuilder(e), c = u.parse(m), s = f.execute(ai(c));
16449
+ return ni(s);
16245
16450
  }
16246
16451
  export {
16247
- Pe as CalculationMode,
16248
- Mt as DescriptionService,
16249
- xt as FormulaRefRangeService,
16250
- Gt as IDescriptionService,
16251
- Br as IRegisterFunctionService,
16252
- Xa as IRemoteRegisterFunctionService,
16253
- ni as InsertFunctionCommand,
16254
- Oe as OtherFormulaMarkDirty,
16255
- ge as PLUGIN_CONFIG_KEY_BASE,
16256
- ii as QuickSumCommand,
16257
- _t as RegisterFunctionService,
16258
- je as RegisterOtherFormulaService,
16259
- nt as RemoteRegisterFunctionService,
16260
- xe as TriggerCalculationController,
16261
- rt as UniverRemoteSheetsFormulaPlugin,
16262
- ot as UniverSheetsFormulaPlugin,
16263
- ze as UpdateDefinedNameController,
16264
- Ze as UpdateFormulaController,
16265
- kr as calculateFormula
16452
+ Te as CalculationMode,
16453
+ Ut as DescriptionService,
16454
+ Ft as FormulaRefRangeService,
16455
+ Pt as IDescriptionService,
16456
+ Xr as IRegisterFunctionService,
16457
+ Qa as IRemoteRegisterFunctionService,
16458
+ mi as InsertFunctionCommand,
16459
+ _e as OtherFormulaMarkDirty,
16460
+ he as PLUGIN_CONFIG_KEY_BASE,
16461
+ fi as QuickSumCommand,
16462
+ Bt as RegisterFunctionService,
16463
+ Ze as RegisterOtherFormulaService,
16464
+ ot as RemoteRegisterFunctionService,
16465
+ qe as TriggerCalculationController,
16466
+ mt as UniverRemoteSheetsFormulaPlugin,
16467
+ ft as UniverSheetsFormulaPlugin,
16468
+ Je as UpdateDefinedNameController,
16469
+ et as UpdateFormulaController,
16470
+ eo as calculateFormula
16266
16471
  };