@univerjs/sheets-formula 0.6.3 → 0.6.4

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/es/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var Va = Object.defineProperty;
2
- var Ga = (a, e, n) => e in a ? Va(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
- var w = (a, e, n) => Ga(a, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as ua, ICommandService as de, ObjectMatrix as W, Tools as Ne, Rectangle as De, isFormulaString as be, isFormulaId as ma, cellToRange as fa, Direction as He, getIntersectRange as Ve, RANGE_TYPE as Y, IUniverInstanceService as xe, Inject as X, Disposable as te, UniverInstanceType as ee, LifecycleService as Ha, ILogService as Ya, IConfigService as _e, LocaleService as Ot, Injector as at, createIdentifier as Mt, toDisposable as le, moveRangeByOffset as Et, DisposableCollection as Ye, AbsoluteRefType as Xe, Optional as Xa, InterceptorEffectEnum as wa, CellValueType as Bt, isRealNum as Wa, DependentOn as ca, Plugin as la, merge as sa, touchDependencies as qe, isNodeEnv as vt } from "@univerjs/core";
5
- import { SetRangeValuesCommand as Ka, SetRangeValuesMutation as ne, handleMoveCols as pa, EffectRefRangId as G, runRefRangeMutations as H, handleMoveRows as da, handleMoveRange as La, handleInsertRangeMoveRight as Pa, handleInsertRangeMoveDown as Ta, handleDeleteRangeMoveUp as Ea, handleDeleteRangeMoveLeft as Ia, handleIRemoveCol as Na, handleIRemoveRow as Ra, handleInsertCol as Aa, handleInsertRow as Sa, RemoveDefinedNameCommand as Ca, SetDefinedNameCommand as Da, RemoveSheetCommand as ka, SetWorksheetNameCommand as Qa, DeleteRangeMoveLeftCommand as $a, DeleteRangeMoveUpCommand as ja, RemoveColCommand as za, RemoveRowCommand as Za, InsertRangeMoveDownCommand as Ja, InsertRangeMoveRightCommand as en, InsertColCommand as tn, InsertRowCommand as an, MoveColsCommand as nn, MoveRowsCommand as rn, MoveRangeCommand as on, SheetInterceptorService as xt, SetStyleCommand as _t, SetBorderCommand as ba, ClearSelectionFormatCommand as Oa, RemoveSheetMutation as It, InsertSheetMutation as Nt, RefRangeService as un, handleDefaultRangeChangeWithEffectRefCommands as Vt, getSeparateEffectedRangesOnCommand as mn, handleCommonDefaultRangeChangeWithEffectRefCommands as fn, MoveRangeMutation as Gt, MoveRowsMutation as Ht, MoveColsMutation as Yt, ReorderRangeMutation as Xt, RemoveRowMutation as wt, RemoveColMutation as Wt, InsertColMutation as Kt, InsertRowMutation as kt, INTERCEPTOR_POINT as cn, SetWorksheetActiveOperation as ln, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as mt, UniverSheetsPlugin as sn } from "@univerjs/sheets";
6
- import { sequenceNodeType as J, deserializeRangeWithSheetWithCache as se, serializeRangeToRefString as nt, ErrorType as j, IDefinedNamesService as yt, LexerTreeBuilder as qt, generateStringWithSequence as we, SetDefinedNameMutation as Me, IActiveDirtyManagerService as gt, SetFormulaCalculationResultMutation as pn, RemoveOtherFormulaMutation as dn, SetOtherFormulaMutation as Ln, FormulaDataModel as it, SetFormulaCalculationStartMutation as Se, SetFormulaCalculationStopMutation as Qt, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as $t, SetFormulaCalculationNotificationMutation as Pn, FormulaExecuteStageType as ge, FormulaExecutedStateType as Re, IFormulaCurrentConfigService as Tn, Lexer as En, AstTreeBuilder as In, Interpreter as Nn, generateExecuteAstNodeData as Rn, getObjectValue as An, SetFormulaDataMutation as he, SetArrayFormulaDataMutation as Rt, initSheetFormulaData as jt, FunctionType as t, FUNCTION_NAMES_ARRAY as zt, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as fe, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as B, FUNCTION_NAMES_ENGINEERING as A, FUNCTION_NAMES_FINANCIAL as C, FUNCTION_NAMES_INFORMATION as v, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as y, FUNCTION_NAMES_MATH as L, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as D, FUNCTION_NAMES_WEB as ft, IFunctionService as ht, isReferenceStrings as Sn, functionArray as Cn, functionCompatibility as Dn, functionCube as bn, functionDatabase as On, functionDate as Mn, functionEngineering as xn, functionFinancial as _n, functionInformation as yn, functionLogical as qn, functionLookup as gn, functionMath as hn, functionMeta as Un, functionStatistical as Fn, functionText as Bn, functionUniver as vn, functionWeb as Vn, serializeRangeWithSpreadsheet as Zt, serializeRangeWithSheet as Jt, serializeRange as ea, CustomFunction as At, AsyncCustomFunction as Ma, RemoveDefinedNameMutation as St, stripErrorMargin as Gn, UniverFormulaEnginePlugin as xa } from "@univerjs/engine-formula";
7
- import { Subject as ta, BehaviorSubject as _a, bufferWhen as Hn, filter as aa, map as Yn } from "rxjs";
8
- import { IRPCChannelService as ya, fromModule as Xn, toModule as wn } from "@univerjs/rpc";
9
- const Wn = {
1
+ var Ha = Object.defineProperty;
2
+ var wa = (a, e, n) => e in a ? Ha(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
+ var X = (a, e, n) => wa(a, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as fa, ICommandService as pe, ObjectMatrix as W, Tools as Ae, Rectangle as be, isFormulaString as Oe, isFormulaId as ca, cellToRange as la, Direction as He, getIntersectRange as Ge, RANGE_TYPE as w, IUniverInstanceService as _e, Inject as Y, Disposable as te, UniverInstanceType as ee, LifecycleService as Ya, ILogService as Xa, IConfigService as ye, LocaleService as Ot, Injector as at, createIdentifier as Mt, toDisposable as ne, moveRangeByOffset as Et, DisposableCollection as we, AbsoluteRefType as Ye, Optional as Wa, InterceptorEffectEnum as Ka, CellValueType as Bt, isRealNum as ka, DependentOn as sa, Plugin as da, merge as pa, touchDependencies as ge, isNodeEnv as vt } from "@univerjs/core";
5
+ import { SetRangeValuesCommand as Qa, SetRangeValuesMutation as ie, handleMoveCols as La, EffectRefRangId as G, runRefRangeMutations as H, handleMoveRows as Pa, handleMoveRange as Ta, handleInsertRangeMoveRight as Ea, handleInsertRangeMoveDown as Ia, handleDeleteRangeMoveUp as Na, handleDeleteRangeMoveLeft as Ra, handleIRemoveCol as Aa, handleIRemoveRow as Sa, handleInsertCol as Ca, handleInsertRow as Da, RemoveDefinedNameCommand as ba, SetDefinedNameCommand as Oa, RemoveSheetCommand as $a, SetWorksheetNameCommand as ja, DeleteRangeMoveLeftCommand as za, DeleteRangeMoveUpCommand as Za, RemoveColCommand as Ja, RemoveRowCommand as en, InsertRangeMoveDownCommand as tn, InsertRangeMoveRightCommand as an, InsertColCommand as nn, InsertRowCommand as rn, MoveColsCommand as on, MoveRowsCommand as un, MoveRangeCommand as mn, SheetInterceptorService as xt, SetStyleCommand as _t, SetBorderCommand as Ma, ClearSelectionFormatCommand as xa, RemoveSheetMutation as It, InsertSheetMutation as Nt, RefRangeService as fn, handleDefaultRangeChangeWithEffectRefCommands as Vt, getSeparateEffectedRangesOnCommand as cn, handleCommonDefaultRangeChangeWithEffectRefCommands as ln, MoveRangeMutation as Gt, MoveRowsMutation as Ht, MoveColsMutation as wt, ReorderRangeMutation as Yt, RemoveRowMutation as Xt, RemoveColMutation as Wt, InsertColMutation as Kt, InsertRowMutation as kt, SetRowHiddenMutation as Qt, SetRowVisibleMutation as $t, INTERCEPTOR_POINT as sn, SetWorksheetActiveOperation as dn, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as mt, UniverSheetsPlugin as pn } from "@univerjs/sheets";
6
+ import { sequenceNodeType as J, deserializeRangeWithSheetWithCache as se, serializeRangeToRefString as nt, ErrorType as j, IDefinedNamesService as yt, LexerTreeBuilder as qt, generateStringWithSequence as Xe, SetDefinedNameMutation as xe, IActiveDirtyManagerService as gt, SetFormulaCalculationResultMutation as Ln, RemoveOtherFormulaMutation as Pn, SetOtherFormulaMutation as Tn, FormulaDataModel as it, SetFormulaCalculationStartMutation as Ee, SetFormulaCalculationStopMutation as jt, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as zt, SetFormulaCalculationNotificationMutation as En, FormulaExecuteStageType as he, FormulaExecutedStateType as Se, IFormulaCurrentConfigService as In, Lexer as Nn, AstTreeBuilder as Rn, Interpreter as An, generateExecuteAstNodeData as Sn, getObjectValue as Cn, SetFormulaDataMutation as Ue, SetArrayFormulaDataMutation as Rt, initSheetFormulaData as Zt, FunctionType as t, FUNCTION_NAMES_ARRAY as Jt, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as ce, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as B, FUNCTION_NAMES_ENGINEERING as A, FUNCTION_NAMES_FINANCIAL as C, FUNCTION_NAMES_INFORMATION as v, FUNCTION_NAMES_LOGICAL as K, FUNCTION_NAMES_LOOKUP as y, FUNCTION_NAMES_MATH as L, FUNCTION_NAMES_STATISTICAL as l, FUNCTION_NAMES_TEXT as D, FUNCTION_NAMES_WEB as ft, IFunctionService as ht, isReferenceStrings as Dn, functionArray as bn, functionCompatibility as On, functionCube as Mn, functionDatabase as xn, functionDate as _n, functionEngineering as yn, functionFinancial as qn, functionInformation as gn, functionLogical as hn, functionLookup as Un, functionMath as Fn, functionMeta as Bn, functionStatistical as vn, functionText as Vn, functionUniver as Gn, functionWeb as Hn, serializeRangeWithSpreadsheet as ea, serializeRangeWithSheet as ta, serializeRange as aa, CustomFunction as At, AsyncCustomFunction as _a, RemoveDefinedNameMutation as St, stripErrorMargin as wn, UniverFormulaEnginePlugin as ya } from "@univerjs/engine-formula";
7
+ import { Subject as na, BehaviorSubject as qa, bufferWhen as Yn, filter as ia, map as Xn } from "rxjs";
8
+ import { IRPCChannelService as ga, fromModule as Wn, toModule as Kn } from "@univerjs/rpc";
9
+ const kn = {
10
10
  id: "formula.command.insert-function",
11
- type: ua.COMMAND,
11
+ type: fa.COMMAND,
12
12
  handler: async (a, e) => {
13
- const { list: n, listOfRangeHasNumber: i } = e, r = a.get(de), o = new W();
13
+ const { list: n, listOfRangeHasNumber: i } = e, r = a.get(pe), o = new W();
14
14
  n.forEach((m) => {
15
- const { range: f, primary: s, formula: p } = m, { row: T, column: P } = s, E = Ne.generateRandomId(6);
15
+ const { range: f, primary: s, formula: d } = m, { row: T, column: P } = s, E = Ae.generateRandomId(6);
16
16
  o.setValue(T, P, {
17
- f: p,
17
+ f: d,
18
18
  si: E
19
19
  });
20
20
  const { startRow: I, startColumn: S, endRow: c, endColumn: N } = f;
21
21
  for (let R = I; R <= c; R++)
22
- for (let d = S; d <= N; d++)
23
- (R !== T || d !== P) && o.setValue(R, d, {
22
+ for (let p = S; p <= N; p++)
23
+ (R !== T || p !== P) && o.setValue(R, p, {
24
24
  si: E
25
25
  });
26
26
  }), i && i.length > 0 && i.forEach((m) => {
@@ -32,16 +32,16 @@ const Wn = {
32
32
  const u = {
33
33
  value: o.getData()
34
34
  };
35
- return r.executeCommand(Ka.id, u);
35
+ return r.executeCommand(Qa.id, u);
36
36
  }
37
- }, Ge = {
38
- type: ua.MUTATION,
37
+ }, De = {
38
+ type: fa.MUTATION,
39
39
  id: "sheet.mutation.data-validation-formula-mark-dirty",
40
40
  handler() {
41
41
  return !0;
42
42
  }
43
43
  };
44
- function Kn(a, e, n) {
44
+ function Qn(a, e, n) {
45
45
  var i;
46
46
  return a == null || a[e] == null || ((i = a[e]) == null ? void 0 : i[n]) == null;
47
47
  }
@@ -60,38 +60,38 @@ function ct(a, e, n) {
60
60
  };
61
61
  }
62
62
  var q = /* @__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))(q || {});
63
- const kn = [
63
+ const $n = [
64
64
  11,
65
65
  12,
66
66
  13,
67
67
  14
68
68
  /* RemoveDefinedName */
69
69
  ];
70
- function Qn(a, e, n) {
70
+ function jn(a, e, n) {
71
71
  const { type: i } = n;
72
- return kn.includes(i) ? $n(a, e) : jn(a, e, n);
72
+ return $n.includes(i) ? zn(a, e) : Zn(a, e, n);
73
73
  }
74
- function $n(a, e) {
74
+ function zn(a, e) {
75
75
  const n = [], i = [];
76
76
  return Object.keys(e).forEach((r) => {
77
77
  const o = e[r], u = a[r];
78
78
  if (o == null || u == null)
79
79
  return !0;
80
80
  Object.keys(o).forEach((m) => {
81
- const f = new W(o[m] || {}), s = new W(u[m] || {}), p = new W(), T = new W();
81
+ const f = new W(o[m] || {}), s = new W(u[m] || {}), d = new W(), T = new W();
82
82
  if (f.forValue((c, N, R) => {
83
83
  if (R == null)
84
84
  return !0;
85
- const d = rt(R);
86
- d !== null && (p.setValue(c, N, d), T.setValue(c, N, s.getValue(c, N)));
87
- }), p.getSizeOf() === 0)
85
+ const p = rt(R);
86
+ p !== null && (d.setValue(c, N, p), T.setValue(c, N, s.getValue(c, N)));
87
+ }), d.getSizeOf() === 0)
88
88
  return;
89
89
  const P = {
90
90
  subUnitId: m,
91
91
  unitId: r,
92
- cellValue: p.getMatrix()
92
+ cellValue: d.getMatrix()
93
93
  }, E = {
94
- id: ne.id,
94
+ id: ie.id,
95
95
  params: P
96
96
  };
97
97
  i.push(E);
@@ -100,7 +100,7 @@ function $n(a, e) {
100
100
  unitId: r,
101
101
  cellValue: T.getMatrix()
102
102
  }, S = {
103
- id: ne.id,
103
+ id: ie.id,
104
104
  params: I
105
105
  };
106
106
  n.push(S);
@@ -110,9 +110,9 @@ function $n(a, e) {
110
110
  redos: i
111
111
  };
112
112
  }
113
- function jn(a, e, n) {
114
- const { redoFormulaData: i, undoFormulaData: r } = zn(a, e, n);
115
- if (Ne.diffValue(i, r))
113
+ function Zn(a, e, n) {
114
+ const { redoFormulaData: i, undoFormulaData: r } = Jn(a, e, n);
115
+ if (Ae.diffValue(i, r))
116
116
  return {
117
117
  undos: [],
118
118
  redos: []
@@ -125,11 +125,11 @@ function jn(a, e, n) {
125
125
  subUnitId: f,
126
126
  unitId: m,
127
127
  cellValue: i[m][f]
128
- }, p = {
129
- id: ne.id,
128
+ }, d = {
129
+ id: ie.id,
130
130
  params: s
131
131
  };
132
- o.push(p);
132
+ o.push(d);
133
133
  }
134
134
  });
135
135
  }), Object.keys(r).forEach((m) => {
@@ -139,11 +139,11 @@ function jn(a, e, n) {
139
139
  subUnitId: f,
140
140
  unitId: m,
141
141
  cellValue: r[m][f]
142
- }, p = {
143
- id: ne.id,
142
+ }, d = {
143
+ id: ie.id,
144
144
  params: s
145
145
  };
146
- u.push(p);
146
+ u.push(d);
147
147
  }
148
148
  });
149
149
  }), {
@@ -151,10 +151,10 @@ function jn(a, e, n) {
151
151
  redos: o
152
152
  };
153
153
  }
154
- function zn(a, e, n) {
155
- const i = {}, r = {}, { type: o, unitId: u, sheetId: m, range: f, from: s, to: p } = n;
154
+ function Jn(a, e, n) {
155
+ const i = {}, r = {}, { type: o, unitId: u, sheetId: m, range: f, from: s, to: d } = n;
156
156
  return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((P) => {
157
- if (Kn(a, P, m))
157
+ if (Qn(a, P, m))
158
158
  return;
159
159
  (/* @__PURE__ */ new Set([
160
160
  ...Object.keys(a[P] || {}),
@@ -162,9 +162,9 @@ function zn(a, e, n) {
162
162
  ])).forEach((I) => {
163
163
  var F, U;
164
164
  const S = (F = a[P]) == null ? void 0 : F[I], c = (U = e[P]) == null ? void 0 : U[I], N = new W(S || {}), R = new W(c || {});
165
- let d = [];
166
- P !== u || I !== m ? d = Jn(R) : d = Zn(N, o, s, p, f);
167
- const O = pi(d, N, R), M = di(d, N);
165
+ let p = [];
166
+ P !== u || I !== m ? p = ti(R) : p = ei(N, o, s, d, f);
167
+ const O = Li(p, N, R), M = Pi(p, N);
168
168
  i[P] || (i[P] = {}), r[P] || (r[P] = {}), i[P][I] = {
169
169
  ...i[P][I],
170
170
  ...O
@@ -178,80 +178,80 @@ function zn(a, e, n) {
178
178
  undoFormulaData: r
179
179
  };
180
180
  }
181
- function Zn(a, e, n, i, r) {
181
+ function ei(a, e, n, i, r) {
182
182
  const o = [];
183
183
  return a.forValue((u, m, f) => {
184
- if (f == null || !qa(f)) return !0;
185
- const s = fa(u, m);
186
- let p = null, T = !1;
184
+ if (f == null || !ha(f)) return !0;
185
+ const s = la(u, m);
186
+ let d = null, T = !1;
187
187
  if ([
188
188
  0,
189
189
  1,
190
190
  2
191
191
  /* MoveCols */
192
192
  ].includes(e))
193
- p = ei(e, n, i, s);
193
+ d = ai(e, n, i, s);
194
194
  else if (r != null) {
195
- const P = ti(e, r, s);
196
- p = P.newCell, T = P.isReverse;
195
+ const P = ni(e, r, s);
196
+ d = P.newCell, T = P.isReverse;
197
197
  }
198
- T ? o.unshift({ oldCell: s, newCell: p }) : o.push({ oldCell: s, newCell: p });
198
+ T ? o.unshift({ oldCell: s, newCell: d }) : o.push({ oldCell: s, newCell: d });
199
199
  }), o;
200
200
  }
201
- function Jn(a) {
201
+ function ti(a) {
202
202
  const e = [];
203
203
  return a.forValue((n, i, r) => {
204
- if (r == null || !qa(r)) return !0;
205
- const o = fa(n, i);
204
+ if (r == null || !ha(r)) return !0;
205
+ const o = la(n, i);
206
206
  e.push({ oldCell: o, newCell: o });
207
207
  }), e;
208
208
  }
209
- function ei(a, e, n, i) {
209
+ function ai(a, e, n, i) {
210
210
  if (e == null || n == null)
211
211
  return null;
212
212
  switch (a) {
213
213
  case 0:
214
- return ai(e, n, i);
214
+ return ii(e, n, i);
215
215
  case 1:
216
- return ni(e, n, i);
216
+ return ri(e, n, i);
217
217
  case 2:
218
- return ii(e, n, i);
218
+ return oi(e, n, i);
219
219
  default:
220
220
  return null;
221
221
  }
222
222
  }
223
- function ti(a, e, n) {
223
+ function ni(a, e, n) {
224
224
  let i = null, r = !1;
225
225
  switch (a) {
226
226
  case 3:
227
- i = ri(e, n), r = !0;
227
+ i = ui(e, n), r = !0;
228
228
  break;
229
229
  case 4:
230
- i = oi(e, n), r = !0;
230
+ i = mi(e, n), r = !0;
231
231
  break;
232
232
  case 5:
233
- i = ui(e, n);
233
+ i = fi(e, n);
234
234
  break;
235
235
  case 6:
236
- i = mi(e, n);
236
+ i = ci(e, n);
237
237
  break;
238
238
  case 7:
239
- i = fi(e, n);
239
+ i = li(e, n);
240
240
  break;
241
241
  case 8:
242
- i = ci(e, n);
242
+ i = si(e, n);
243
243
  break;
244
244
  case 9:
245
- i = li(e, n), r = !0;
245
+ i = di(e, n), r = !0;
246
246
  break;
247
247
  case 10:
248
- i = si(e, n), r = !0;
248
+ i = pi(e, n), r = !0;
249
249
  break;
250
250
  }
251
251
  return { newCell: i, isReverse: r };
252
252
  }
253
- function ai(a, e, n) {
254
- const i = La(
253
+ function ii(a, e, n) {
254
+ const i = Ta(
255
255
  {
256
256
  id: G.MoveRangeCommandId,
257
257
  params: { toRange: e, fromRange: a }
@@ -260,8 +260,8 @@ function ai(a, e, n) {
260
260
  );
261
261
  return H(i, n);
262
262
  }
263
- function ni(a, e, n) {
264
- const i = da(
263
+ function ri(a, e, n) {
264
+ const i = Pa(
265
265
  {
266
266
  id: G.MoveRowsCommandId,
267
267
  params: { toRange: e, fromRange: a }
@@ -270,8 +270,8 @@ function ni(a, e, n) {
270
270
  );
271
271
  return H(i, n);
272
272
  }
273
- function ii(a, e, n) {
274
- const i = pa(
273
+ function oi(a, e, n) {
274
+ const i = La(
275
275
  {
276
276
  id: G.MoveColsCommandId,
277
277
  params: { toRange: e, fromRange: a }
@@ -280,8 +280,8 @@ function ii(a, e, n) {
280
280
  );
281
281
  return H(i, n);
282
282
  }
283
- function ri(a, e) {
284
- const n = Sa(
283
+ function ui(a, e) {
284
+ const n = Da(
285
285
  {
286
286
  id: G.InsertRowCommandId,
287
287
  params: { range: a, unitId: "", subUnitId: "", direction: He.DOWN }
@@ -290,8 +290,8 @@ function ri(a, e) {
290
290
  );
291
291
  return H(n, e);
292
292
  }
293
- function oi(a, e) {
294
- const n = Aa(
293
+ function mi(a, e) {
294
+ const n = Ca(
295
295
  {
296
296
  id: G.InsertColCommandId,
297
297
  params: { range: a, unitId: "", subUnitId: "", direction: He.RIGHT }
@@ -300,8 +300,8 @@ function oi(a, e) {
300
300
  );
301
301
  return H(n, e);
302
302
  }
303
- function ui(a, e) {
304
- const n = Ra(
303
+ function fi(a, e) {
304
+ const n = Sa(
305
305
  {
306
306
  id: G.RemoveRowCommandId,
307
307
  params: { range: a }
@@ -310,8 +310,8 @@ function ui(a, e) {
310
310
  );
311
311
  return H(n, e);
312
312
  }
313
- function mi(a, e) {
314
- const n = Na(
313
+ function ci(a, e) {
314
+ const n = Aa(
315
315
  {
316
316
  id: G.RemoveColCommandId,
317
317
  params: { range: a }
@@ -320,8 +320,8 @@ function mi(a, e) {
320
320
  );
321
321
  return H(n, e);
322
322
  }
323
- function fi(a, e) {
324
- const n = Ia(
323
+ function li(a, e) {
324
+ const n = Ra(
325
325
  {
326
326
  id: G.DeleteRangeMoveLeftCommandId,
327
327
  params: { range: a }
@@ -330,8 +330,8 @@ function fi(a, e) {
330
330
  );
331
331
  return H(n, e);
332
332
  }
333
- function ci(a, e) {
334
- const n = Ea(
333
+ function si(a, e) {
334
+ const n = Na(
335
335
  {
336
336
  id: G.DeleteRangeMoveUpCommandId,
337
337
  params: { range: a }
@@ -340,8 +340,8 @@ function ci(a, e) {
340
340
  );
341
341
  return H(n, e);
342
342
  }
343
- function li(a, e) {
344
- const n = Ta(
343
+ function di(a, e) {
344
+ const n = Ia(
345
345
  {
346
346
  id: G.InsertRangeMoveDownCommandId,
347
347
  params: { range: a }
@@ -350,8 +350,8 @@ function li(a, e) {
350
350
  );
351
351
  return H(n, e);
352
352
  }
353
- function si(a, e) {
354
- const n = Pa(
353
+ function pi(a, e) {
354
+ const n = Ea(
355
355
  {
356
356
  id: G.InsertRangeMoveRightCommandId,
357
357
  params: { range: a }
@@ -360,23 +360,23 @@ function si(a, e) {
360
360
  );
361
361
  return H(n, e);
362
362
  }
363
- function pi(a, e, n) {
363
+ function Li(a, e, n) {
364
364
  const i = new W({});
365
365
  return a.forEach((r) => {
366
- const { oldCell: o, newCell: u } = r, { startRow: m, startColumn: f } = o, s = n.getValue(m, f) || e.getValue(m, f), p = rt(s);
366
+ const { oldCell: o, newCell: u } = r, { startRow: m, startColumn: f } = o, s = n.getValue(m, f) || e.getValue(m, f), d = rt(s);
367
367
  if (i.setValue(m, f, { f: null, si: null }), u) {
368
368
  const { startRow: T, startColumn: P } = u;
369
- i.setValue(T, P, p);
369
+ i.setValue(T, P, d);
370
370
  }
371
371
  }), i.getMatrix();
372
372
  }
373
- function di(a, e) {
373
+ function Pi(a, e) {
374
374
  const n = new W({});
375
375
  return a.reverse().forEach((i) => {
376
376
  const { oldCell: r, newCell: o } = i, { startRow: u, startColumn: m } = r, f = e.getValue(u, m), s = rt(f);
377
377
  if (o) {
378
- const { startRow: p, startColumn: T } = o;
379
- n.setValue(p, T, { f: null, si: null });
378
+ const { startRow: d, startColumn: T } = o;
379
+ n.setValue(d, T, { f: null, si: null });
380
380
  }
381
381
  n.setValue(u, m, s);
382
382
  }), n.getMatrix();
@@ -384,7 +384,7 @@ function di(a, e) {
384
384
  function rt(a) {
385
385
  if (a == null)
386
386
  return;
387
- const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = be(e), u = ma(n);
387
+ const { f: e, si: n, x: i = 0, y: r = 0 } = a, o = Oe(e), u = ca(n);
388
388
  if (!o && !u)
389
389
  return {
390
390
  f: null,
@@ -393,18 +393,18 @@ function rt(a) {
393
393
  const m = {};
394
394
  return u && (m.si = n), o && i === 0 && r === 0 && (m.f = e), m.f === void 0 && (m.f = null), m.si === void 0 && (m.si = null), m;
395
395
  }
396
- function Li(a) {
396
+ function Ti(a) {
397
397
  const e = new W({});
398
398
  return new W(a).forValue((i, r, o) => {
399
399
  const u = rt(o);
400
400
  u && e.setValue(i, r, u);
401
401
  }), e.getMatrix();
402
402
  }
403
- function qa(a) {
404
- const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = be(e), r = ma(n);
403
+ function ha(a) {
404
+ const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = Oe(e), r = ca(n);
405
405
  return !!(i || r);
406
406
  }
407
- function ga(a, e, n, i, r, o) {
407
+ function Ua(a, e, n, i, r, o) {
408
408
  if ((r == null || r.length === 0) && (o == null || o.length === 0)) {
409
409
  if (a === n && e === i)
410
410
  return !0;
@@ -412,7 +412,7 @@ function ga(a, e, n, i, r, o) {
412
412
  return !0;
413
413
  return !1;
414
414
  }
415
- function ha(a, e, n = 0, i = 0) {
415
+ function Fa(a, e, n = 0, i = 0) {
416
416
  const r = [];
417
417
  for (let o = 0, u = a.length; o < u; o++) {
418
418
  const m = a[o];
@@ -420,7 +420,7 @@ function ha(a, e, n = 0, i = 0) {
420
420
  r.push(m);
421
421
  continue;
422
422
  }
423
- const { token: f } = m, s = se(f), { range: p, sheetName: T, unitId: P } = s, E = De.moveOffset(p, n, i);
423
+ const { token: f } = m, s = se(f), { range: d, sheetName: T, unitId: P } = s, E = be.moveOffset(d, n, i);
424
424
  r.push({
425
425
  ...m,
426
426
  token: nt({
@@ -432,16 +432,16 @@ function ha(a, e, n = 0, i = 0) {
432
432
  }
433
433
  return r;
434
434
  }
435
- function Ua(a, e, n, i) {
435
+ function Ba(a, e, n, i) {
436
436
  const { type: r, unitId: o, sheetId: u, range: m, from: f, to: s } = e, {
437
- range: p,
437
+ range: d,
438
438
  sheetId: T,
439
439
  unitId: P,
440
440
  sheetName: E,
441
441
  refOffsetX: I,
442
442
  refOffsetY: S
443
443
  } = a;
444
- if (!ga(
444
+ if (!Ua(
445
445
  o,
446
446
  u,
447
447
  n,
@@ -450,176 +450,176 @@ function Ua(a, e, n, i) {
450
450
  T
451
451
  ))
452
452
  return;
453
- const c = De.moveOffset(p, I, S);
453
+ const c = be.moveOffset(d, I, S);
454
454
  let N = null;
455
455
  if (r === q.MoveRange) {
456
456
  if (f == null || s == null)
457
457
  return;
458
- const R = st(c, f), d = Ve(c, f);
459
- if (d == null || R !== 4)
458
+ const R = st(c, f), p = Ge(c, f);
459
+ if (p == null || R !== 4)
460
460
  return;
461
- const O = La(
461
+ const O = Ta(
462
462
  { id: G.MoveRangeCommandId, params: { toRange: s, fromRange: f } },
463
- d
464
- ), M = H(O, d);
463
+ p
464
+ ), M = H(O, p);
465
465
  if (M == null)
466
466
  return j.REF;
467
- N = lt(R, M, f, s, c, d);
467
+ N = lt(R, M, f, s, c, p);
468
468
  } else if (r === q.MoveRows) {
469
469
  if (f == null || s == null)
470
470
  return;
471
471
  const R = st(c, f);
472
- let d = Ve(c, f);
473
- if (d == null && (f.endRow < c.startRow && s.endRow < c.startRow || f.startRow > c.endRow && s.startRow > c.endRow))
472
+ let p = Ge(c, f);
473
+ if (p == null && (f.endRow < c.startRow && s.endRow < c.startRow || f.startRow > c.endRow && s.startRow > c.endRow))
474
474
  return;
475
- d == null && (d = {
475
+ p == null && (p = {
476
476
  startRow: c.startRow,
477
477
  endRow: c.endRow,
478
478
  startColumn: c.startColumn,
479
479
  endColumn: c.endColumn,
480
- rangeType: Y.NORMAL
480
+ rangeType: w.NORMAL
481
481
  });
482
- const O = da(
482
+ const O = Pa(
483
483
  { id: G.MoveRowsCommandId, params: { toRange: s, fromRange: f } },
484
- d
485
- ), M = H(O, d);
484
+ p
485
+ ), M = H(O, p);
486
486
  if (M == null)
487
487
  return j.REF;
488
- N = lt(R, M, f, s, c, d);
488
+ N = lt(R, M, f, s, c, p);
489
489
  } else if (r === q.MoveCols) {
490
490
  if (f == null || s == null)
491
491
  return;
492
492
  const R = st(c, f);
493
- let d = Ve(c, f);
494
- if (d == null && (f.endColumn < c.startColumn && s.endColumn < c.startColumn || f.startColumn > c.endColumn && s.startColumn > c.endColumn))
493
+ let p = Ge(c, f);
494
+ if (p == null && (f.endColumn < c.startColumn && s.endColumn < c.startColumn || f.startColumn > c.endColumn && s.startColumn > c.endColumn))
495
495
  return;
496
- d == null && (d = {
496
+ p == null && (p = {
497
497
  startRow: c.startRow,
498
498
  endRow: c.endRow,
499
499
  startColumn: c.startColumn,
500
500
  endColumn: c.endColumn,
501
- rangeType: Y.NORMAL
501
+ rangeType: w.NORMAL
502
502
  });
503
- const O = pa(
503
+ const O = La(
504
504
  { id: G.MoveColsCommandId, params: { toRange: s, fromRange: f } },
505
- d
506
- ), M = H(O, d);
505
+ p
506
+ ), M = H(O, p);
507
507
  if (M == null)
508
508
  return j.REF;
509
- N = lt(R, M, f, s, c, d);
509
+ N = lt(R, M, f, s, c, p);
510
510
  }
511
511
  if (m != null) {
512
512
  if (r === q.InsertRow) {
513
- const R = Sa(
513
+ const R = Da(
514
514
  {
515
515
  id: G.InsertRowCommandId,
516
516
  params: { range: m, unitId: "", subUnitId: "", direction: He.DOWN }
517
517
  },
518
518
  c
519
- ), d = H(R, c);
520
- if (d == null)
519
+ ), p = H(R, c);
520
+ if (p == null)
521
521
  return;
522
522
  N = {
523
523
  ...c,
524
- ...d
524
+ ...p
525
525
  };
526
526
  } else if (r === q.InsertColumn) {
527
- const R = Aa(
527
+ const R = Ca(
528
528
  {
529
529
  id: G.InsertColCommandId,
530
530
  params: { range: m, unitId: "", subUnitId: "", direction: He.RIGHT }
531
531
  },
532
532
  c
533
- ), d = H(R, c);
534
- if (d == null)
533
+ ), p = H(R, c);
534
+ if (p == null)
535
535
  return;
536
536
  N = {
537
537
  ...c,
538
- ...d
538
+ ...p
539
539
  };
540
540
  } else if (r === q.RemoveRow) {
541
- const R = Ra(
541
+ const R = Sa(
542
542
  {
543
543
  id: G.RemoveRowCommandId,
544
544
  params: { range: m }
545
545
  },
546
546
  c
547
- ), d = H(R, c);
548
- if (d == null)
547
+ ), p = H(R, c);
548
+ if (p == null)
549
549
  return j.REF;
550
550
  N = {
551
551
  ...c,
552
- ...d
552
+ ...p
553
553
  };
554
554
  } else if (r === q.RemoveColumn) {
555
- const R = Na(
555
+ const R = Aa(
556
556
  {
557
557
  id: G.RemoveColCommandId,
558
558
  params: { range: m }
559
559
  },
560
560
  c
561
- ), d = H(R, c);
562
- if (d == null)
561
+ ), p = H(R, c);
562
+ if (p == null)
563
563
  return j.REF;
564
564
  N = {
565
565
  ...c,
566
- ...d
566
+ ...p
567
567
  };
568
568
  } else if (r === q.DeleteMoveLeft) {
569
- const R = Ia(
569
+ const R = Ra(
570
570
  {
571
571
  id: G.DeleteRangeMoveLeftCommandId,
572
572
  params: { range: m }
573
573
  },
574
574
  c
575
- ), d = H(R, c);
576
- if (d == null)
575
+ ), p = H(R, c);
576
+ if (p == null)
577
577
  return j.REF;
578
578
  N = {
579
579
  ...c,
580
- ...d
580
+ ...p
581
581
  };
582
582
  } else if (r === q.DeleteMoveUp) {
583
- const R = Ea(
583
+ const R = Na(
584
584
  {
585
585
  id: G.DeleteRangeMoveUpCommandId,
586
586
  params: { range: m }
587
587
  },
588
588
  c
589
- ), d = H(R, c);
590
- if (d == null)
589
+ ), p = H(R, c);
590
+ if (p == null)
591
591
  return j.REF;
592
592
  N = {
593
593
  ...c,
594
- ...d
594
+ ...p
595
595
  };
596
596
  } else if (r === q.InsertMoveDown) {
597
- const R = Ta(
597
+ const R = Ia(
598
598
  {
599
599
  id: G.InsertRangeMoveDownCommandId,
600
600
  params: { range: m }
601
601
  },
602
602
  c
603
- ), d = H(R, c);
604
- if (d == null)
603
+ ), p = H(R, c);
604
+ if (p == null)
605
605
  return;
606
606
  N = {
607
607
  ...c,
608
- ...d
608
+ ...p
609
609
  };
610
610
  } else if (r === q.InsertMoveRight) {
611
- const R = Pa(
611
+ const R = Ea(
612
612
  {
613
613
  id: G.InsertRangeMoveRightCommandId,
614
614
  params: { range: m }
615
615
  },
616
616
  c
617
- ), d = H(R, c);
618
- if (d == null)
617
+ ), p = H(R, c);
618
+ if (p == null)
619
619
  return;
620
620
  N = {
621
621
  ...c,
622
- ...d
622
+ ...p
623
623
  };
624
624
  }
625
625
  }
@@ -631,29 +631,29 @@ function Ua(a, e, n, i) {
631
631
  });
632
632
  }
633
633
  function lt(a, e, n, i, r, o) {
634
- const { startRow: u, endRow: m, startColumn: f, endColumn: s, rangeType: p } = Ae(e), {
634
+ const { startRow: u, endRow: m, startColumn: f, endColumn: s, rangeType: d } = Ce(e), {
635
635
  startRow: T,
636
636
  startColumn: P,
637
637
  endRow: E,
638
638
  endColumn: I,
639
- rangeType: S = Y.NORMAL
640
- } = Ae(n), { startRow: c, startColumn: N, endRow: R, endColumn: d } = Ae(i), {
639
+ rangeType: S = w.NORMAL
640
+ } = Ce(n), { startRow: c, startColumn: N, endRow: R, endColumn: p } = Ce(i), {
641
641
  startRow: O,
642
642
  endRow: M,
643
643
  startColumn: F,
644
644
  endColumn: U
645
- } = Ae(o), {
645
+ } = Ce(o), {
646
646
  startRow: g,
647
647
  endRow: x,
648
648
  startColumn: h,
649
649
  endColumn: V,
650
- rangeType: Q = Y.NORMAL
651
- } = Ae(r), b = { ...r };
650
+ rangeType: Q = w.NORMAL
651
+ } = Ce(r), b = { ...r };
652
652
  function Le() {
653
- return p === Y.COLUMN && Q === Y.COLUMN ? !0 : f >= h && s <= V;
653
+ return d === w.COLUMN && Q === w.COLUMN ? !0 : f >= h && s <= V;
654
654
  }
655
655
  function ae() {
656
- return p === Y.ROW && Q === Y.ROW ? !0 : u >= g && m <= x;
656
+ return d === w.ROW && Q === w.ROW ? !0 : u >= g && m <= x;
657
657
  }
658
658
  if (a === 0)
659
659
  if (Le())
@@ -695,86 +695,86 @@ function lt(a, e, n, i, r, o) {
695
695
  return;
696
696
  else
697
697
  return;
698
- else a === 4 ? (b.startRow = u, b.startColumn = f, b.endRow = m, b.endColumn = s) : P <= h && I >= V || S === Y.ROW && Q === Y.ROW ? n.endRow < g ? (c >= g && (b.startRow -= E - T + 1), c >= x && (b.endRow -= E - T + 1)) : n.startRow > x ? (R <= x && (b.endRow += E - T + 1), R <= g && (b.startRow += E - T + 1)) : n.startRow >= g && n.endRow <= x && (c <= g ? b.startRow += E - T + 1 : c >= x && (b.endRow -= E - T + 1)) : T <= g && E >= x || S === Y.COLUMN && Q === Y.COLUMN ? n.endColumn < h ? (N >= h && (b.startColumn -= I - P + 1), N >= V && (b.endColumn -= I - P + 1)) : n.startColumn > V ? (d <= V && (b.endColumn += I - P + 1), d <= h && (b.startColumn += I - P + 1)) : n.startColumn >= h && n.endColumn <= V && (N <= h ? b.startColumn += I - P + 1 : N >= V && (b.endColumn -= I - P + 1)) : ((N <= U + 1 && d >= V || N <= h && d >= F - 1) && c <= g && R >= x || (c <= M + 1 && R >= x || c <= g && R >= O - 1) && N <= h && d >= V, b.startRow = u, b.startColumn = f, b.endRow = m, b.endColumn = s);
698
+ else a === 4 ? (b.startRow = u, b.startColumn = f, b.endRow = m, b.endColumn = s) : P <= h && I >= V || S === w.ROW && Q === w.ROW ? n.endRow < g ? (c >= g && (b.startRow -= E - T + 1), c >= x && (b.endRow -= E - T + 1)) : n.startRow > x ? (R <= x && (b.endRow += E - T + 1), R <= g && (b.startRow += E - T + 1)) : n.startRow >= g && n.endRow <= x && (c <= g ? b.startRow += E - T + 1 : c >= x && (b.endRow -= E - T + 1)) : T <= g && E >= x || S === w.COLUMN && Q === w.COLUMN ? n.endColumn < h ? (N >= h && (b.startColumn -= I - P + 1), N >= V && (b.endColumn -= I - P + 1)) : n.startColumn > V ? (p <= V && (b.endColumn += I - P + 1), p <= h && (b.startColumn += I - P + 1)) : n.startColumn >= h && n.endColumn <= V && (N <= h ? b.startColumn += I - P + 1 : N >= V && (b.endColumn -= I - P + 1)) : ((N <= U + 1 && p >= V || N <= h && p >= F - 1) && c <= g && R >= x || (c <= M + 1 && R >= x || c <= g && R >= O - 1) && N <= h && p >= V, b.startRow = u, b.startColumn = f, b.endRow = m, b.endColumn = s);
699
699
  return b;
700
700
  }
701
701
  function st(a, e) {
702
- const n = Ee(a.startRow), i = Ie(a.endRow), r = Ee(a.startColumn), o = Ie(a.endColumn), u = Ee(e.startRow), m = Ie(e.endRow), f = Ee(e.startColumn), s = Ie(e.endColumn);
703
- function p() {
704
- return a.rangeType === Y.COLUMN && e.rangeType === Y.COLUMN ? !0 : n >= u && i <= m;
702
+ const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow), m = Re(e.endRow), f = Ne(e.startColumn), s = Re(e.endColumn);
703
+ function d() {
704
+ return a.rangeType === w.COLUMN && e.rangeType === w.COLUMN ? !0 : n >= u && i <= m;
705
705
  }
706
706
  function T() {
707
- return a.rangeType === Y.ROW && e.rangeType === Y.ROW ? !0 : r >= f && o <= s;
707
+ return a.rangeType === w.ROW && e.rangeType === w.ROW ? !0 : r >= f && o <= s;
708
708
  }
709
709
  function P() {
710
- return a.rangeType === Y.ALL && e.rangeType === Y.ALL;
710
+ return a.rangeType === w.ALL && e.rangeType === w.ALL;
711
711
  }
712
- return p() && T() || P() ? 4 : T() && n >= u && n <= m && i > m ? 0 : T() && i >= u && i <= m && n < u ? 1 : p() && r >= f && r <= s && o > s ? 2 : p() && o >= f && o <= s && r < f ? 3 : null;
712
+ return d() && T() || P() ? 4 : T() && n >= u && n <= m && i > m ? 0 : T() && i >= u && i <= m && n < u ? 1 : d() && r >= f && r <= s && o > s ? 2 : d() && o >= f && o <= s && r < f ? 3 : null;
713
713
  }
714
- function Ee(a) {
714
+ function Ne(a) {
715
715
  return isNaN(a) ? -1 / 0 : a;
716
716
  }
717
- function Ie(a) {
717
+ function Re(a) {
718
718
  return isNaN(a) ? 1 / 0 : a;
719
719
  }
720
- function Ae(a) {
720
+ function Ce(a) {
721
721
  const { startRow: e, endRow: n, startColumn: i, endColumn: r } = a;
722
722
  return {
723
723
  ...a,
724
- startRow: Ee(e),
725
- endRow: Ie(n),
726
- startColumn: Ee(i),
727
- endColumn: Ie(r)
724
+ startRow: Ne(e),
725
+ endRow: Re(n),
726
+ startColumn: Ne(i),
727
+ endColumn: Re(r)
728
728
  };
729
729
  }
730
- function Fa(a, e) {
730
+ function va(a, e) {
731
731
  const { id: n } = e;
732
732
  let i = null;
733
733
  switch (n) {
734
+ case mn.id:
735
+ i = Ei(e, a);
736
+ break;
737
+ case un.id:
738
+ i = Ii(e, a);
739
+ break;
734
740
  case on.id:
735
- i = Pi(e, a);
741
+ i = Ni(e, a);
736
742
  break;
737
743
  case rn.id:
738
- i = Ti(e, a);
744
+ i = Ri(e);
739
745
  break;
740
746
  case nn.id:
741
- i = Ei(e, a);
747
+ i = Ai(e);
742
748
  break;
743
749
  case an.id:
744
- i = Ii(e);
750
+ i = Si(e, a);
745
751
  break;
746
752
  case tn.id:
747
- i = Ni(e);
753
+ i = Ci(e, a);
748
754
  break;
749
755
  case en.id:
750
- i = Ri(e, a);
756
+ i = Di(e, a);
751
757
  break;
752
758
  case Ja.id:
753
- i = Ai(e, a);
759
+ i = bi(e, a);
754
760
  break;
755
761
  case Za.id:
756
- i = Si(e, a);
762
+ i = Oi(e, a);
757
763
  break;
758
764
  case za.id:
759
- i = Ci(e, a);
765
+ i = Mi(e, a);
760
766
  break;
761
767
  case ja.id:
762
- i = Di(e, a);
768
+ i = xi(e, a);
763
769
  break;
764
770
  case $a.id:
765
- i = bi(e, a);
766
- break;
767
- case Qa.id:
768
- i = Oi(e, a);
769
- break;
770
- case ka.id:
771
- i = Mi(e, a);
771
+ i = _i(e, a);
772
772
  break;
773
- case Da.id:
774
- i = xi(e, a);
773
+ case Oa.id:
774
+ i = yi(e, a);
775
775
  break;
776
- case Ca.id:
777
- i = _i(e, a);
776
+ case ba.id:
777
+ i = qi(e, a);
778
778
  break;
779
779
  }
780
780
  return i;
@@ -787,7 +787,7 @@ function Z(a) {
787
787
  sheetId: n
788
788
  };
789
789
  }
790
- function Pi(a, e) {
790
+ function Ei(a, e) {
791
791
  const { params: n } = a;
792
792
  if (!n) return null;
793
793
  const { fromRange: i, toRange: r } = n;
@@ -801,7 +801,7 @@ function Pi(a, e) {
801
801
  sheetId: u
802
802
  };
803
803
  }
804
- function Ti(a, e) {
804
+ function Ii(a, e) {
805
805
  const { params: n } = a;
806
806
  if (!n) return null;
807
807
  const {
@@ -809,28 +809,28 @@ function Ti(a, e) {
809
809
  toRange: { startRow: o, endRow: u }
810
810
  } = n, m = e.getUnitId(), f = e.getActiveSheet();
811
811
  if (!f) return null;
812
- const s = f.getSheetId(), p = {
812
+ const s = f.getSheetId(), d = {
813
813
  startRow: i,
814
814
  startColumn: 0,
815
815
  endRow: r,
816
816
  endColumn: f.getColumnCount() - 1,
817
- rangeType: Y.ROW
817
+ rangeType: w.ROW
818
818
  }, T = {
819
819
  startRow: o,
820
820
  startColumn: 0,
821
821
  endRow: u,
822
822
  endColumn: f.getColumnCount() - 1,
823
- rangeType: Y.ROW
823
+ rangeType: w.ROW
824
824
  };
825
825
  return {
826
826
  type: q.MoveRows,
827
- from: p,
827
+ from: d,
828
828
  to: T,
829
829
  unitId: m,
830
830
  sheetId: s
831
831
  };
832
832
  }
833
- function Ei(a, e) {
833
+ function Ni(a, e) {
834
834
  const { params: n } = a;
835
835
  if (!n) return null;
836
836
  const {
@@ -838,28 +838,28 @@ function Ei(a, e) {
838
838
  toRange: { startColumn: o, endColumn: u }
839
839
  } = n, m = e.getUnitId(), f = e.getActiveSheet();
840
840
  if (!f) return null;
841
- const s = f.getSheetId(), p = {
841
+ const s = f.getSheetId(), d = {
842
842
  startRow: 0,
843
843
  startColumn: i,
844
844
  endRow: f.getRowCount() - 1,
845
845
  endColumn: r,
846
- rangeType: Y.COLUMN
846
+ rangeType: w.COLUMN
847
847
  }, T = {
848
848
  startRow: 0,
849
849
  startColumn: o,
850
850
  endRow: f.getRowCount() - 1,
851
851
  endColumn: u,
852
- rangeType: Y.COLUMN
852
+ rangeType: w.COLUMN
853
853
  };
854
854
  return {
855
855
  type: q.MoveCols,
856
- from: p,
856
+ from: d,
857
857
  to: T,
858
858
  unitId: m,
859
859
  sheetId: s
860
860
  };
861
861
  }
862
- function Ii(a) {
862
+ function Ri(a) {
863
863
  const { params: e } = a;
864
864
  if (!e) return null;
865
865
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -870,7 +870,7 @@ function Ii(a) {
870
870
  sheetId: r
871
871
  };
872
872
  }
873
- function Ni(a) {
873
+ function Ai(a) {
874
874
  const { params: e } = a;
875
875
  if (!e) return null;
876
876
  const { range: n, unitId: i, subUnitId: r } = e;
@@ -881,7 +881,7 @@ function Ni(a) {
881
881
  sheetId: r
882
882
  };
883
883
  }
884
- function Ri(a, e) {
884
+ function Si(a, e) {
885
885
  const { params: n } = a;
886
886
  if (!n) return null;
887
887
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -892,7 +892,7 @@ function Ri(a, e) {
892
892
  sheetId: o
893
893
  };
894
894
  }
895
- function Ai(a, e) {
895
+ function Ci(a, e) {
896
896
  const { params: n } = a;
897
897
  if (!n) return null;
898
898
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -903,7 +903,7 @@ function Ai(a, e) {
903
903
  sheetId: o
904
904
  };
905
905
  }
906
- function Si(a, e) {
906
+ function Di(a, e) {
907
907
  const { params: n } = a;
908
908
  if (!n) return null;
909
909
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -914,7 +914,7 @@ function Si(a, e) {
914
914
  sheetId: o
915
915
  };
916
916
  }
917
- function Ci(a, e) {
917
+ function bi(a, e) {
918
918
  const { params: n } = a;
919
919
  if (!n) return null;
920
920
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -925,7 +925,7 @@ function Ci(a, e) {
925
925
  sheetId: o
926
926
  };
927
927
  }
928
- function Di(a, e) {
928
+ function Oi(a, e) {
929
929
  const { params: n } = a;
930
930
  if (!n) return null;
931
931
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -936,7 +936,7 @@ function Di(a, e) {
936
936
  sheetId: o
937
937
  };
938
938
  }
939
- function bi(a, e) {
939
+ function Mi(a, e) {
940
940
  const { params: n } = a;
941
941
  if (!n) return null;
942
942
  const { range: i } = n, { unitId: r, sheetId: o } = Z(e);
@@ -947,7 +947,7 @@ function bi(a, e) {
947
947
  sheetId: o
948
948
  };
949
949
  }
950
- function Oi(a, e) {
950
+ function xi(a, e) {
951
951
  const { params: n } = a;
952
952
  if (!n) return null;
953
953
  const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: m } = Z(e);
@@ -958,7 +958,7 @@ function Oi(a, e) {
958
958
  sheetName: o
959
959
  };
960
960
  }
961
- function Mi(a, e) {
961
+ function _i(a, e) {
962
962
  const { params: n } = a;
963
963
  if (!n) return null;
964
964
  const { unitId: i, subUnitId: r } = n, { unitId: o, sheetId: u } = Z(e);
@@ -968,7 +968,7 @@ function Mi(a, e) {
968
968
  sheetId: r || u
969
969
  };
970
970
  }
971
- function xi(a, e) {
971
+ function yi(a, e) {
972
972
  const { params: n } = a;
973
973
  if (!n) return null;
974
974
  const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
@@ -980,7 +980,7 @@ function xi(a, e) {
980
980
  definedNameId: o
981
981
  };
982
982
  }
983
- function _i(a, e) {
983
+ function qi(a, e) {
984
984
  const { params: n } = a;
985
985
  if (!n) return null;
986
986
  const { unitId: i, name: r, id: o } = n, { sheetId: u } = Z(e);
@@ -992,11 +992,11 @@ function _i(a, e) {
992
992
  definedNameId: o
993
993
  };
994
994
  }
995
- var yi = Object.getOwnPropertyDescriptor, qi = (a, e, n, i) => {
996
- for (var r = i > 1 ? void 0 : i ? yi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
995
+ var gi = Object.getOwnPropertyDescriptor, hi = (a, e, n, i) => {
996
+ for (var r = i > 1 ? void 0 : i ? gi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
997
997
  (u = a[o]) && (r = u(r) || r);
998
998
  return r;
999
- }, Ue = (a, e) => (n, i) => e(n, i, a);
999
+ }, Fe = (a, e) => (n, i) => e(n, i, a);
1000
1000
  let We = class extends te {
1001
1001
  constructor(a, e, n, i) {
1002
1002
  super(), this._definedNamesService = a, this._univerInstanceService = e, this._sheetInterceptorService = n, this._lexerTreeBuilder = i, this._initialize();
@@ -1008,7 +1008,7 @@ let We = class extends te {
1008
1008
  this.disposeWithMe(
1009
1009
  this._sheetInterceptorService.interceptCommand({
1010
1010
  getMutations: (a) => {
1011
- if (a.id === Da.id || a.id === Ca.id)
1011
+ if (a.id === Oa.id || a.id === ba.id)
1012
1012
  return {
1013
1013
  redos: [],
1014
1014
  undos: []
@@ -1019,7 +1019,7 @@ let We = class extends te {
1019
1019
  redos: [],
1020
1020
  undos: []
1021
1021
  };
1022
- const n = Fa(e, a);
1022
+ const n = va(e, a);
1023
1023
  return n ? this._getUpdateDefinedNameMutations(e, n) : {
1024
1024
  redos: [],
1025
1025
  undos: []
@@ -1039,16 +1039,16 @@ let We = class extends te {
1039
1039
  const u = [], m = [];
1040
1040
  return Object.values(o).forEach((f) => {
1041
1041
  var c;
1042
- const { formulaOrRefString: s } = f, p = this._lexerTreeBuilder.sequenceNodesBuilder(s);
1043
- if (p == null)
1042
+ const { formulaOrRefString: s } = f, d = this._lexerTreeBuilder.sequenceNodesBuilder(s);
1043
+ if (d == null)
1044
1044
  return !0;
1045
1045
  let T = !1;
1046
1046
  const P = [];
1047
- for (let N = 0, R = p.length; N < R; N++) {
1048
- const d = p[N];
1049
- if (typeof d == "string" || d.nodeType !== J.REFERENCE)
1047
+ for (let N = 0, R = d.length; N < R; N++) {
1048
+ const p = d[N];
1049
+ if (typeof p == "string" || p.nodeType !== J.REFERENCE)
1050
1050
  continue;
1051
- const { token: O } = d, M = se(O), { range: F, sheetName: U, unitId: g } = M, x = ((c = a.getSheetBySheetName(U)) == null ? void 0 : c.getSheetId()) || "", h = {
1051
+ const { token: O } = p, M = se(O), { range: F, sheetName: U, unitId: g } = M, x = ((c = a.getSheetBySheetName(U)) == null ? void 0 : c.getSheetId()) || "", h = {
1052
1052
  range: F,
1053
1053
  sheetId: x,
1054
1054
  unitId: g,
@@ -1072,21 +1072,21 @@ let We = class extends te {
1072
1072
  unitId: g
1073
1073
  });
1074
1074
  } else
1075
- V = Ua(
1075
+ V = Ba(
1076
1076
  h,
1077
1077
  e,
1078
1078
  i,
1079
1079
  r
1080
1080
  );
1081
- V != null && (p[N] = {
1082
- ...d,
1081
+ V != null && (d[N] = {
1082
+ ...p,
1083
1083
  token: V
1084
1084
  }, T = !0, P.push(N));
1085
1085
  }
1086
1086
  if (!T)
1087
1087
  return !0;
1088
- const E = we(ha(p, P)), I = {
1089
- id: Me.id,
1088
+ const E = Xe(Fa(d, P)), I = {
1089
+ id: xe.id,
1090
1090
  params: {
1091
1091
  unitId: i,
1092
1092
  ...f,
@@ -1095,7 +1095,7 @@ let We = class extends te {
1095
1095
  };
1096
1096
  u.push(I);
1097
1097
  const S = {
1098
- id: Me.id,
1098
+ id: xe.id,
1099
1099
  params: {
1100
1100
  unitId: i,
1101
1101
  ...f
@@ -1113,27 +1113,27 @@ let We = class extends te {
1113
1113
  return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? j.REF : null;
1114
1114
  }
1115
1115
  };
1116
- We = qi([
1117
- Ue(0, yt),
1118
- Ue(1, xe),
1119
- Ue(2, X(xt)),
1120
- Ue(3, X(qt))
1116
+ We = hi([
1117
+ Fe(0, yt),
1118
+ Fe(1, _e),
1119
+ Fe(2, Y(xt)),
1120
+ Fe(3, Y(qt))
1121
1121
  ], We);
1122
- var Ce = /* @__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))(Ce || {}), gi = Object.getOwnPropertyDescriptor, hi = (a, e, n, i) => {
1123
- for (var r = i > 1 ? void 0 : i ? gi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1122
+ 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 || {}), Ui = Object.getOwnPropertyDescriptor, Fi = (a, e, n, i) => {
1123
+ for (var r = i > 1 ? void 0 : i ? Ui(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1124
1124
  (u = a[o]) && (r = u(r) || r);
1125
1125
  return r;
1126
- }, pt = (a, e) => (n, i) => e(n, i, a);
1126
+ }, dt = (a, e) => (n, i) => e(n, i, a);
1127
1127
  let Ke = class extends te {
1128
1128
  constructor(e, n, i) {
1129
1129
  super();
1130
- w(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
1131
- w(this, "_formulaChangeWithRange$", new ta());
1132
- w(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
1130
+ X(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
1131
+ X(this, "_formulaChangeWithRange$", new na());
1132
+ X(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
1133
1133
  // FIXME: this design could be improved.
1134
- w(this, "_formulaResult$", new ta());
1135
- w(this, "formulaResult$", this._formulaResult$.asObservable());
1136
- w(this, "calculateStarted$", new _a(!1));
1134
+ X(this, "_formulaResult$", new na());
1135
+ X(this, "formulaResult$", this._formulaResult$.asObservable());
1136
+ X(this, "calculateStarted$", new qa(!1));
1137
1137
  this._commandService = e, this._activeDirtyManagerService = n, this._lifecycleService = i, this._initFormulaRegister(), this._initFormulaCalculationResultChange();
1138
1138
  }
1139
1139
  dispose() {
@@ -1146,13 +1146,13 @@ let Ke = class extends te {
1146
1146
  return r || (r = /* @__PURE__ */ new Map(), i.set(n, r)), r;
1147
1147
  }
1148
1148
  _createFormulaId(e, n) {
1149
- return `formula.${e}_${n}_${Ne.generateRandomId(8)}`;
1149
+ return `formula.${e}_${n}_${Ae.generateRandomId(8)}`;
1150
1150
  }
1151
1151
  _initFormulaRegister() {
1152
1152
  this._activeDirtyManagerService.register(
1153
- Ge.id,
1153
+ De.id,
1154
1154
  {
1155
- commandId: Ge.id,
1155
+ commandId: De.id,
1156
1156
  getDirtyData(n) {
1157
1157
  return {
1158
1158
  dirtyUnitOtherFormulaMap: n.params
@@ -1174,40 +1174,40 @@ let Ke = class extends te {
1174
1174
  }
1175
1175
  }
1176
1176
  };
1177
- this._commandService.executeCommand(Ln.id, s).then(() => {
1177
+ this._commandService.executeCommand(Tn.id, s).then(() => {
1178
1178
  this._commandService.executeCommand(
1179
- Ge.id,
1179
+ De.id,
1180
1180
  { [i]: { [r]: { [u]: !0 } } }
1181
1181
  );
1182
1182
  });
1183
1183
  };
1184
1184
  this.disposeWithMe(
1185
- this._formulaChangeWithRange$.pipe(Hn(() => this.calculateStarted$.pipe(aa((n) => n)))).subscribe((n) => n.forEach(e))
1185
+ this._formulaChangeWithRange$.pipe(Yn(() => this.calculateStarted$.pipe(ia((n) => n)))).subscribe((n) => n.forEach(e))
1186
1186
  ), this.disposeWithMe(
1187
- this._formulaChangeWithRange$.pipe(aa(() => this.calculateStarted$.getValue())).subscribe(e)
1187
+ this._formulaChangeWithRange$.pipe(ia(() => this.calculateStarted$.getValue())).subscribe(e)
1188
1188
  );
1189
1189
  }
1190
1190
  _initFormulaCalculationResultChange() {
1191
1191
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1192
- if (e.id === pn.id) {
1192
+ if (e.id === Ln.id) {
1193
1193
  const n = e.params, { unitOtherData: i } = n, r = {};
1194
1194
  for (const o in i) {
1195
1195
  const u = i[o], m = {};
1196
1196
  r[o] = m;
1197
1197
  for (const f in u) {
1198
- const s = this._ensureCacheMap(o, f), p = u[f], T = [];
1198
+ const s = this._ensureCacheMap(o, f), d = u[f], T = [];
1199
1199
  m[f] = T;
1200
- for (const P in p) {
1201
- const E = p[P];
1200
+ for (const P in d) {
1201
+ const E = d[P];
1202
1202
  if (s.has(P)) {
1203
1203
  const I = s.get(P);
1204
1204
  if (!I)
1205
1205
  continue;
1206
1206
  I.result || (I.result = {});
1207
1207
  const S = new W(E), c = new W(I.result);
1208
- S.forValue((N, R, d) => {
1209
- c.setValue(N, R, d);
1210
- }), I.status = Ce.SUCCESS, I.callbacks.forEach((N) => {
1208
+ S.forValue((N, R, p) => {
1209
+ c.setValue(N, R, p);
1210
+ }), I.status = Ie.SUCCESS, I.callbacks.forEach((N) => {
1211
1211
  N(E);
1212
1212
  }), I.callbacks.clear(), T.push(I);
1213
1213
  }
@@ -1222,7 +1222,7 @@ let Ke = class extends te {
1222
1222
  const u = this._createFormulaId(e, n);
1223
1223
  return this._ensureCacheMap(e, n).set(u, {
1224
1224
  result: void 0,
1225
- status: Ce.WAIT,
1225
+ status: Ie.WAIT,
1226
1226
  formulaId: u,
1227
1227
  callbacks: /* @__PURE__ */ new Set(),
1228
1228
  extra: o
@@ -1240,13 +1240,13 @@ let Ke = class extends te {
1240
1240
  subUnitId: n,
1241
1241
  formulaIdList: i
1242
1242
  };
1243
- this._commandService.executeCommand(dn.id, r);
1243
+ this._commandService.executeCommand(Pn.id, r);
1244
1244
  const o = this._ensureCacheMap(e, n);
1245
1245
  i.forEach((u) => o.delete(u));
1246
1246
  }
1247
1247
  getFormulaValue(e, n, i) {
1248
1248
  const r = this._ensureCacheMap(e, n), o = r.get(i);
1249
- return o ? o.status === Ce.SUCCESS || o.status === Ce.ERROR ? Promise.resolve(o) : new Promise((u) => {
1249
+ return o ? o.status === Ie.SUCCESS || o.status === Ie.ERROR ? Promise.resolve(o) : new Promise((u) => {
1250
1250
  o.callbacks.add(() => {
1251
1251
  u(r.get(i));
1252
1252
  });
@@ -1255,26 +1255,33 @@ let Ke = class extends te {
1255
1255
  getFormulaValueSync(e, n, i) {
1256
1256
  return this._ensureCacheMap(e, n).get(i);
1257
1257
  }
1258
+ markFormulaDirty(e, n, i) {
1259
+ const r = this.getFormulaValueSync(e, n, i);
1260
+ r && (r.status = Ie.WAIT, this._commandService.executeCommand(
1261
+ De.id,
1262
+ { [e]: { [n]: { [i]: !0 } } }
1263
+ ));
1264
+ }
1258
1265
  };
1259
- Ke = hi([
1260
- pt(0, de),
1261
- pt(1, gt),
1262
- pt(2, X(Ha))
1266
+ Ke = Fi([
1267
+ dt(0, pe),
1268
+ dt(1, gt),
1269
+ dt(2, Y(Ya))
1263
1270
  ], Ke);
1264
1271
  const ot = "sheets-formula.base.config";
1265
- 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 || {});
1266
- const na = {}, Ui = "sheets-formula.remote.config", ia = {};
1267
- var Fi = Object.getOwnPropertyDescriptor, Bi = (a, e, n, i) => {
1268
- for (var r = i > 1 ? void 0 : i ? Fi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1272
+ var de = /* @__PURE__ */ ((a) => (a[a.FORCED = 0] = "FORCED", a[a.WHEN_EMPTY = 1] = "WHEN_EMPTY", a[a.NO_CALCULATION = 2] = "NO_CALCULATION", a))(de || {});
1273
+ const ra = {}, Bi = "sheets-formula.remote.config", oa = {};
1274
+ var vi = Object.getOwnPropertyDescriptor, Vi = (a, e, n, i) => {
1275
+ for (var r = i > 1 ? void 0 : i ? vi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1269
1276
  (u = a[o]) && (r = u(r) || r);
1270
1277
  return r;
1271
- }, ce = (a, e) => (n, i) => e(n, i, a);
1272
- const ra = { done: 0, count: 0 }, dt = { onlyLocal: !0 };
1273
- let Oe = class extends te {
1278
+ }, le = (a, e) => (n, i) => e(n, i, a);
1279
+ const ua = { done: 0, count: 0 }, pt = { onlyLocal: !0 };
1280
+ let Me = class extends te {
1274
1281
  constructor(e, n, i, r, o, u, m) {
1275
1282
  super();
1276
- w(this, "_waitingCommandQueue", []);
1277
- w(this, "_executingDirtyData", {
1283
+ X(this, "_waitingCommandQueue", []);
1284
+ X(this, "_executingDirtyData", {
1278
1285
  forceCalculation: !1,
1279
1286
  dirtyRanges: [],
1280
1287
  dirtyNameMap: {},
@@ -1283,18 +1290,18 @@ let Oe = class extends te {
1283
1290
  dirtyUnitOtherFormulaMap: {},
1284
1291
  clearDependencyTreeCache: {}
1285
1292
  });
1286
- w(this, "_setTimeoutKey", -1);
1287
- w(this, "_startExecutionTime", 0);
1288
- w(this, "_totalCalculationTaskCount", 0);
1289
- w(this, "_doneCalculationTaskCount", 0);
1290
- w(this, "_executionInProgressParams", null);
1291
- w(this, "_restartCalculation", !1);
1293
+ X(this, "_setTimeoutKey", -1);
1294
+ X(this, "_startExecutionTime", 0);
1295
+ X(this, "_totalCalculationTaskCount", 0);
1296
+ X(this, "_doneCalculationTaskCount", 0);
1297
+ X(this, "_executionInProgressParams", null);
1298
+ X(this, "_restartCalculation", !1);
1292
1299
  /**
1293
1300
  * The mark of forced calculation. If a new mutation triggers dirty area calculation during the forced calculation process, forced calculation is still required.
1294
1301
  */
1295
- w(this, "_forceCalculating", !1);
1296
- w(this, "_progress$", new _a(ra));
1297
- w(this, "progress$", this._progress$.asObservable());
1302
+ X(this, "_forceCalculating", !1);
1303
+ X(this, "_progress$", new qa(ua));
1304
+ X(this, "progress$", this._progress$.asObservable());
1298
1305
  this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = m, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
1299
1306
  }
1300
1307
  _emitProgress(e) {
@@ -1322,25 +1329,32 @@ let Oe = class extends te {
1322
1329
  this._doneCalculationTaskCount = 0, this._totalCalculationTaskCount = 0, this._emitProgress();
1323
1330
  }
1324
1331
  dispose() {
1325
- super.dispose(), this._progress$.next(ra), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
1332
+ super.dispose(), this._progress$.next(ua), this._progress$.complete(), clearTimeout(this._setTimeoutKey);
1326
1333
  }
1327
1334
  _getCalculationMode() {
1328
1335
  var n;
1329
1336
  const e = this._configService.getConfig(ot);
1330
- return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : pe.WHEN_EMPTY;
1337
+ return (n = e == null ? void 0 : e.initialFormulaComputing) != null ? n : de.WHEN_EMPTY;
1331
1338
  }
1332
1339
  _commandExecutedListener() {
1333
1340
  this.disposeWithMe(
1341
+ this._commandService.beforeCommandExecuted((e) => {
1342
+ if (e.id === Ee.id) {
1343
+ const n = e.params;
1344
+ n.rowData = this._formulaDataModel.getHiddenRowsFiltered();
1345
+ }
1346
+ })
1347
+ ), this.disposeWithMe(
1334
1348
  this._commandService.onCommandExecuted((e, n) => {
1335
1349
  if (this._activeDirtyManagerService.get(e.id)) {
1336
- if (e.id === ne.id) {
1350
+ if (e.id === ie.id) {
1337
1351
  const i = e.params;
1338
- if (n && n.onlyLocal === !0 || i.trigger === _t.id || i.trigger === ba.id || i.trigger === Oa.id)
1352
+ if (n && n.onlyLocal === !0 || i.trigger === _t.id || i.trigger === Ma.id || i.trigger === xa.id)
1339
1353
  return;
1340
1354
  }
1341
1355
  this._waitingCommandQueue.push(e), clearTimeout(this._setTimeoutKey), this._setTimeoutKey = setTimeout(() => {
1342
1356
  const i = this._generateDirty(this._waitingCommandQueue);
1343
- this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Se.id, { ...this._executingDirtyData }, dt) : (this._restartCalculation = !0, this._commandService.executeCommand(Qt.id, {})), this._waitingCommandQueue = [];
1357
+ this._executingDirtyData = this._mergeDirty(this._executingDirtyData, i), this._executionInProgressParams == null ? this._commandService.executeCommand(Ee.id, { ...this._executingDirtyData }, pt) : (this._restartCalculation = !0, this._commandService.executeCommand(jt.id, {})), this._waitingCommandQueue = [];
1344
1358
  }, 100);
1345
1359
  }
1346
1360
  })
@@ -1352,7 +1366,7 @@ let Oe = class extends te {
1352
1366
  const s = this._activeDirtyManagerService.get(f.id);
1353
1367
  if (s == null)
1354
1368
  continue;
1355
- const p = s.getDirtyData(f), { dirtyRanges: T, dirtyNameMap: P, dirtyDefinedNameMap: E, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: c } = p;
1369
+ const d = s.getDirtyData(f), { dirtyRanges: T, dirtyNameMap: P, dirtyDefinedNameMap: E, dirtyUnitFeatureMap: I, dirtyUnitOtherFormulaMap: S, clearDependencyTreeCache: c } = d;
1356
1370
  T != null && this._mergeDirtyRanges(n, T), P != null && this._mergeDirtyNameMap(i, P), E != null && this._mergeDirtyNameMap(r, E), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, I), S != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, S), c != null && this._mergeDirtyNameMap(m, c);
1357
1371
  }
1358
1372
  return {
@@ -1363,7 +1377,7 @@ let Oe = class extends te {
1363
1377
  dirtyUnitOtherFormulaMap: u,
1364
1378
  forceCalculation: !1,
1365
1379
  clearDependencyTreeCache: m,
1366
- maxIteration: this._configService.getConfig($t)
1380
+ maxIteration: this._configService.getConfig(zt)
1367
1381
  // numfmtItemMap,
1368
1382
  };
1369
1383
  }
@@ -1392,8 +1406,8 @@ let Oe = class extends te {
1392
1406
  let r = !1;
1393
1407
  for (const o of e)
1394
1408
  if (i.unitId === o.unitId && i.sheetId === o.sheetId) {
1395
- const { startRow: u, startColumn: m, endRow: f, endColumn: s } = i.range, { startRow: p, startColumn: T, endRow: P, endColumn: E } = o.range;
1396
- if (u === p && m === T && f === P && s === E) {
1409
+ const { startRow: u, startColumn: m, endRow: f, endColumn: s } = i.range, { startRow: d, startColumn: T, endRow: P, endColumn: E } = o.range;
1410
+ if (u === d && m === T && f === P && s === E) {
1397
1411
  r = !0;
1398
1412
  break;
1399
1413
  }
@@ -1424,32 +1438,32 @@ let Oe = class extends te {
1424
1438
  this.disposeWithMe(
1425
1439
  // eslint-disable-next-line max-lines-per-function, complexity
1426
1440
  this._commandService.onCommandExecuted((i) => {
1427
- if (i.id === Se.id) {
1441
+ if (i.id === Ee.id) {
1428
1442
  const { forceCalculation: o = !1 } = i.params;
1429
1443
  o && (this._forceCalculating = !0);
1430
- } else i.id === Qt.id && this.clearProgress();
1431
- if (i.id !== Pn.id)
1444
+ } else i.id === jt.id && this.clearProgress();
1445
+ if (i.id !== En.id)
1432
1446
  return;
1433
1447
  const r = i.params;
1434
1448
  if (r.stageInfo != null) {
1435
1449
  const {
1436
1450
  stage: o
1437
1451
  } = r.stageInfo;
1438
- if (o === ge.START)
1452
+ if (o === he.START)
1439
1453
  n === 0 && (this._startExecutionTime = performance.now()), n++, e !== null && (clearTimeout(e), e = null), e = setTimeout(() => {
1440
1454
  e = null, this._startProgress();
1441
1455
  }, 1e3);
1442
- else if (o === ge.CURRENTLY_CALCULATING) {
1456
+ else if (o === he.CURRENTLY_CALCULATING) {
1443
1457
  if (this._executionInProgressParams = r.stageInfo, e === null) {
1444
1458
  const u = this._localeService.t("formula.progress.calculating");
1445
1459
  this._calculateProgress(u);
1446
1460
  }
1447
- } else if (o === ge.START_DEPENDENCY_ARRAY_FORMULA) {
1461
+ } else if (o === he.START_DEPENDENCY_ARRAY_FORMULA) {
1448
1462
  if (this._executionInProgressParams = r.stageInfo, e === null) {
1449
1463
  const u = this._localeService.t("formula.progress.array-analysis");
1450
1464
  this._calculateProgress(u);
1451
1465
  }
1452
- } else if (o === ge.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
1466
+ } else if (o === he.CURRENTLY_CALCULATING_ARRAY_FORMULA && (this._executionInProgressParams = r.stageInfo, e === null)) {
1453
1467
  const u = this._localeService.t("formula.progress.array-calculation");
1454
1468
  this._calculateProgress(u);
1455
1469
  }
@@ -1457,25 +1471,25 @@ let Oe = class extends te {
1457
1471
  const o = r.functionsExecutedState;
1458
1472
  let u = "";
1459
1473
  switch (n--, o) {
1460
- case Re.NOT_EXECUTED:
1474
+ case Se.NOT_EXECUTED:
1461
1475
  u = "No tasks are being executed anymore", this._resetExecutingDirtyData();
1462
1476
  break;
1463
- case Re.STOP_EXECUTION:
1477
+ case Se.STOP_EXECUTION:
1464
1478
  u = "The execution of the formula has been stopped", n = 0;
1465
1479
  break;
1466
- case Re.SUCCESS:
1480
+ case Se.SUCCESS:
1467
1481
  u = "Formula calculation succeeded", (n === 0 || n === -1) && (u += `. Total time consumed: ${performance.now() - this._startExecutionTime} ms`), this._resetExecutingDirtyData();
1468
1482
  break;
1469
- case Re.INITIAL:
1483
+ case Se.INITIAL:
1470
1484
  u = "Waiting for calculation", this._resetExecutingDirtyData();
1471
1485
  break;
1472
1486
  }
1473
- (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 === Re.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
1474
- Se.id,
1487
+ (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 === Se.STOP_EXECUTION && this._restartCalculation ? (this._restartCalculation = !1, this._commandService.executeCommand(
1488
+ Ee.id,
1475
1489
  {
1476
1490
  ...this._executingDirtyData
1477
1491
  },
1478
- dt
1492
+ pt
1479
1493
  )) : this._executionInProgressParams = null, this._logService.debug("[TriggerCalculationController]", u);
1480
1494
  }
1481
1495
  })
@@ -1494,10 +1508,10 @@ let Oe = class extends te {
1494
1508
  }
1495
1509
  _initialExecuteFormula() {
1496
1510
  const e = this._getCalculationMode(), n = this._getDirtyDataByCalculationMode(e);
1497
- this._commandService.executeCommand(Se.id, n, dt), this._registerOtherFormulaService.calculateStarted$.next(!0);
1511
+ this._commandService.executeCommand(Ee.id, n, pt), this._registerOtherFormulaService.calculateStarted$.next(!0);
1498
1512
  }
1499
1513
  _getDirtyDataByCalculationMode(e) {
1500
- const n = e === pe.FORCED, i = e === pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1514
+ const n = e === de.FORCED, i = e === de.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1501
1515
  return {
1502
1516
  forceCalculation: n,
1503
1517
  dirtyRanges: i,
@@ -1506,21 +1520,21 @@ let Oe = class extends te {
1506
1520
  dirtyUnitFeatureMap: {},
1507
1521
  dirtyUnitOtherFormulaMap: {},
1508
1522
  clearDependencyTreeCache: {},
1509
- maxIteration: this._configService.getConfig($t)
1523
+ maxIteration: this._configService.getConfig(zt)
1510
1524
  };
1511
1525
  }
1512
1526
  };
1513
- Oe = Bi([
1514
- ce(0, de),
1515
- ce(1, gt),
1516
- ce(2, Ya),
1517
- ce(3, _e),
1518
- ce(4, X(it)),
1519
- ce(5, X(Ot)),
1520
- ce(6, X(Ke))
1521
- ], Oe);
1522
- function hr(a, e, n, i) {
1523
- const r = a.get(Tn), o = a.get(En), u = a.get(In), m = a.get(Nn);
1527
+ Me = Vi([
1528
+ le(0, pe),
1529
+ le(1, gt),
1530
+ le(2, Xa),
1531
+ le(3, ye),
1532
+ le(4, Y(it)),
1533
+ le(5, Y(Ot)),
1534
+ le(6, Y(Ke))
1535
+ ], Me);
1536
+ function Fr(a, e, n, i) {
1537
+ const r = a.get(In), o = a.get(Nn), u = a.get(Rn), m = a.get(An);
1524
1538
  r.load({
1525
1539
  formulaData: {},
1526
1540
  arrayFormulaCellData: {},
@@ -1536,14 +1550,14 @@ function hr(a, e, n, i) {
1536
1550
  },
1537
1551
  dirtyUnitOtherFormulaMap: {}
1538
1552
  });
1539
- const f = o.treeBuilder(e), s = u.parse(f), p = m.execute(Rn(s));
1540
- return An(p);
1553
+ const f = o.treeBuilder(e), s = u.parse(f), d = m.execute(Sn(s));
1554
+ return Cn(d);
1541
1555
  }
1542
- var vi = Object.getOwnPropertyDescriptor, Vi = (a, e, n, i) => {
1543
- for (var r = i > 1 ? void 0 : i ? vi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1556
+ var Gi = Object.getOwnPropertyDescriptor, Hi = (a, e, n, i) => {
1557
+ for (var r = i > 1 ? void 0 : i ? Gi(e, n) : e, o = a.length - 1, u; o >= 0; o--)
1544
1558
  (u = a[o]) && (r = u(r) || r);
1545
1559
  return r;
1546
- }, ue = (a, e) => (n, i) => e(n, i, a);
1560
+ }, me = (a, e) => (n, i) => e(n, i, a);
1547
1561
  let ke = class extends te {
1548
1562
  constructor(a, e, n, i, r, o, u, m) {
1549
1563
  super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector = m, this._commandExecutedListener();
@@ -1561,14 +1575,14 @@ let ke = class extends te {
1561
1575
  })
1562
1576
  ), this.disposeWithMe(
1563
1577
  this._commandService.beforeCommandExecuted((a, e) => {
1564
- if (a.id === ne.id) {
1578
+ if (a.id === ie.id) {
1565
1579
  const n = a.params;
1566
- if (e && e.onlyLocal === !0 || n.trigger === _t.id || n.trigger === ba.id || n.trigger === Oa.id)
1580
+ if (e && e.onlyLocal === !0 || n.trigger === _t.id || n.trigger === Ma.id || n.trigger === xa.id)
1567
1581
  return;
1568
1582
  this._handleSetRangeValuesMutation(n);
1569
1583
  }
1570
1584
  })
1571
- ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ee.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ee.UNIVER_SHEET).pipe(Yn((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1585
+ ), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ee.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ee.UNIVER_SHEET).pipe(Xn((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
1572
1586
  }
1573
1587
  _handleSetRangeValuesMutation(a) {
1574
1588
  const { subUnitId: e, unitId: n, cellValue: i } = a;
@@ -1580,18 +1594,18 @@ let ke = class extends te {
1580
1594
  }
1581
1595
  };
1582
1596
  this._commandService.executeCommand(
1583
- ne.id,
1597
+ ie.id,
1584
1598
  {
1585
1599
  unitId: n,
1586
1600
  subUnitId: e,
1587
- cellValue: Li(r)
1601
+ cellValue: Ti(r)
1588
1602
  },
1589
1603
  {
1590
1604
  onlyLocal: !0,
1591
1605
  fromFormula: !0
1592
1606
  }
1593
1607
  ), this._formulaDataModel.updateArrayFormulaCellData(n, e, i), this._formulaDataModel.updateArrayFormulaRange(n, e, i), this._commandService.executeCommand(
1594
- he.id,
1608
+ Ue.id,
1595
1609
  {
1596
1610
  formulaData: o
1597
1611
  },
@@ -1614,7 +1628,7 @@ let ke = class extends te {
1614
1628
  _handleWorkbookDisposed(a, e) {
1615
1629
  const n = this._formulaDataModel.getFormulaData(), i = ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), m = ct(u, a, e);
1616
1630
  i && this._commandService.executeCommand(
1617
- he.id,
1631
+ Ue.id,
1618
1632
  {
1619
1633
  formulaData: i
1620
1634
  },
@@ -1633,9 +1647,9 @@ let ke = class extends te {
1633
1647
  );
1634
1648
  }
1635
1649
  _handleInsertSheetMutation(a) {
1636
- const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new W(o), m = jt(i, n, r, u);
1650
+ const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new W(o), m = Zt(i, n, r, u);
1637
1651
  this._commandService.executeCommand(
1638
- he.id,
1652
+ Ue.id,
1639
1653
  {
1640
1654
  formulaData: m
1641
1655
  },
@@ -1649,14 +1663,14 @@ let ke = class extends te {
1649
1663
  const e = {}, n = a.getUnitId(), i = { [n]: {} };
1650
1664
  a.getSheets().forEach((s) => {
1651
1665
  var E;
1652
- const p = s.getCellMatrix(), T = s.getSheetId(), P = jt(e, n, T, p);
1666
+ const d = s.getCellMatrix(), T = s.getSheetId(), P = Zt(e, n, T, d);
1653
1667
  i[n][T] = (E = P[n]) == null ? void 0 : E[T];
1654
- }), this._commandService.executeCommand(he.id, { formulaData: i }, { onlyLocal: !0 });
1655
- const o = this._configService.getConfig(ot), u = (f = o == null ? void 0 : o.initialFormulaComputing) != null ? f : pe.WHEN_EMPTY, m = this._getDiryDataByCalculationMode(u);
1656
- this._commandService.executeCommand(Se.id, m, { onlyLocal: !0 });
1668
+ }), this._commandService.executeCommand(Ue.id, { formulaData: i }, { onlyLocal: !0 });
1669
+ const o = this._configService.getConfig(ot), u = (f = o == null ? void 0 : o.initialFormulaComputing) != null ? f : de.WHEN_EMPTY, m = this._getDirtyDataByCalculationMode(u);
1670
+ this._commandService.executeCommand(Ee.id, m, { onlyLocal: !0 });
1657
1671
  }
1658
- _getDiryDataByCalculationMode(a) {
1659
- const e = a === pe.FORCED, n = a === pe.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1672
+ _getDirtyDataByCalculationMode(a) {
1673
+ const e = a === de.FORCED, n = a === de.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
1660
1674
  return {
1661
1675
  forceCalculation: e,
1662
1676
  dirtyRanges: n,
@@ -1674,13 +1688,13 @@ let ke = class extends te {
1674
1688
  undos: [],
1675
1689
  redos: []
1676
1690
  };
1677
- const n = Fa(e, a);
1691
+ const n = va(e, a);
1678
1692
  if (n) {
1679
1693
  const { unitSheetNameMap: i } = this._formulaDataModel.getCalculateData(), r = this._formulaDataModel.getFormulaData(), { newFormulaData: o } = this._getFormulaReferenceMoveInfo(
1680
1694
  r,
1681
1695
  i,
1682
1696
  n
1683
- ), { undos: u, redos: m } = Qn(r, o, n);
1697
+ ), { undos: u, redos: m } = jn(r, o, n);
1684
1698
  return {
1685
1699
  undos: u,
1686
1700
  redos: m
@@ -1693,7 +1707,7 @@ let ke = class extends te {
1693
1707
  }
1694
1708
  // eslint-disable-next-line max-lines-per-function
1695
1709
  _getFormulaReferenceMoveInfo(a, e, n) {
1696
- if (!Ne.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1710
+ if (!Ae.isDefine(a)) return { newFormulaData: {}, oldFormulaData: {} };
1697
1711
  const i = Object.keys(a);
1698
1712
  if (i.length === 0) return { newFormulaData: {}, oldFormulaData: {} };
1699
1713
  const r = {}, o = {};
@@ -1702,19 +1716,19 @@ let ke = class extends te {
1702
1716
  if (m == null)
1703
1717
  continue;
1704
1718
  const f = Object.keys(m);
1705
- Ne.isDefine(r[u]) || (r[u] = {}), Ne.isDefine(o[u]) || (o[u] = {});
1719
+ Ae.isDefine(r[u]) || (r[u] = {}), Ae.isDefine(o[u]) || (o[u] = {});
1706
1720
  for (const s of f) {
1707
- const p = new W(m[s] || {}), T = new W();
1708
- p.forValue((P, E, I) => {
1721
+ const d = new W(m[s] || {}), T = new W();
1722
+ d.forValue((P, E, I) => {
1709
1723
  var U;
1710
1724
  if (!I) return !0;
1711
- const { f: S, x: c, y: N, si: R } = I, d = this._lexerTreeBuilder.sequenceNodesBuilder(S);
1712
- if (d == null)
1725
+ const { f: S, x: c, y: N, si: R } = I, p = this._lexerTreeBuilder.sequenceNodesBuilder(S);
1726
+ if (p == null)
1713
1727
  return !0;
1714
1728
  let O = !1;
1715
1729
  const M = [];
1716
- for (let g = 0, x = d.length; g < x; g++) {
1717
- const h = d[g];
1730
+ for (let g = 0, x = p.length; g < x; g++) {
1731
+ const h = p[g];
1718
1732
  if (typeof h == "string")
1719
1733
  continue;
1720
1734
  const { token: V, nodeType: Q } = h, { type: b } = n;
@@ -1722,18 +1736,18 @@ let ke = class extends te {
1722
1736
  const { definedNameId: Pe, definedName: Te } = n;
1723
1737
  if (Pe === void 0 || Te === void 0)
1724
1738
  continue;
1725
- const me = this._definedNamesService.getValueById(u, Pe);
1726
- if (me == null || me.name !== V)
1739
+ const fe = this._definedNamesService.getValueById(u, Pe);
1740
+ if (fe == null || fe.name !== V)
1727
1741
  continue;
1728
- d[g] = {
1742
+ p[g] = {
1729
1743
  ...h,
1730
1744
  token: b === q.SetDefinedName ? Te : j.REF
1731
1745
  }, O = !0, M.push(g);
1732
1746
  continue;
1733
1747
  } else if (Q !== J.REFERENCE)
1734
1748
  continue;
1735
- const Le = se(V), { range: ae, sheetName: ie, unitId: k } = Le, re = k == null || k.length === 0 ? u : k, z = ((U = e == null ? void 0 : e[re]) == null ? void 0 : U[ie]) || "";
1736
- if (!ga(
1749
+ const Le = se(V), { range: ae, sheetName: re, unitId: k } = Le, oe = k == null || k.length === 0 ? u : k, z = ((U = e == null ? void 0 : e[oe]) == null ? void 0 : U[re]) || "";
1750
+ if (!Ua(
1737
1751
  n.unitId,
1738
1752
  n.sheetId,
1739
1753
  u,
@@ -1742,53 +1756,53 @@ let ke = class extends te {
1742
1756
  z
1743
1757
  ))
1744
1758
  continue;
1745
- const ye = {
1759
+ const qe = {
1746
1760
  range: ae,
1747
1761
  sheetId: z,
1748
1762
  unitId: k,
1749
- sheetName: ie,
1763
+ sheetName: re,
1750
1764
  refOffsetX: c || 0,
1751
1765
  refOffsetY: N || 0
1752
1766
  };
1753
- let oe = null;
1767
+ let ue = null;
1754
1768
  if (b === q.SetName) {
1755
1769
  const {
1756
1770
  unitId: Pe,
1757
1771
  sheetId: Te,
1758
- sheetName: me
1772
+ sheetName: fe
1759
1773
  } = n;
1760
- if (me == null || z == null || z.length === 0 || Te !== z)
1774
+ if (fe == null || z == null || z.length === 0 || Te !== z)
1761
1775
  continue;
1762
- oe = nt({
1776
+ ue = nt({
1763
1777
  range: ae,
1764
- sheetName: me,
1778
+ sheetName: fe,
1765
1779
  unitId: k
1766
1780
  });
1767
1781
  } else if (b === q.RemoveSheet) {
1768
1782
  const {
1769
1783
  unitId: Pe,
1770
1784
  sheetId: Te,
1771
- sheetName: me
1785
+ sheetName: fe
1772
1786
  } = n;
1773
1787
  if (z == null || z.length === 0 || Te !== z)
1774
1788
  continue;
1775
- oe = j.REF;
1776
- } else b !== q.SetDefinedName && (oe = Ua(
1777
- ye,
1789
+ ue = j.REF;
1790
+ } else b !== q.SetDefinedName && (ue = Ba(
1791
+ qe,
1778
1792
  n,
1779
1793
  u,
1780
1794
  s
1781
1795
  ));
1782
- oe != null && (d[g] = {
1796
+ ue != null && (p[g] = {
1783
1797
  ...h,
1784
- token: oe
1798
+ token: ue
1785
1799
  }, O = !0, M.push(g));
1786
1800
  }
1787
1801
  if (!O)
1788
1802
  return !0;
1789
- const F = ha(d, M, c, N);
1803
+ const F = Fa(p, M, c, N);
1790
1804
  T.setValue(P, E, {
1791
- f: `=${we(F)}`
1805
+ f: `=${Xe(F)}`
1792
1806
  });
1793
1807
  }), o[u] && (o[u][s] = T.getData());
1794
1808
  }
@@ -1796,19 +1810,19 @@ let ke = class extends te {
1796
1810
  return { newFormulaData: o };
1797
1811
  }
1798
1812
  };
1799
- ke = Vi([
1800
- ue(0, xe),
1801
- ue(1, de),
1802
- ue(2, X(qt)),
1803
- ue(3, X(it)),
1804
- ue(4, X(xt)),
1805
- ue(5, yt),
1806
- ue(6, _e),
1807
- ue(7, X(at))
1813
+ ke = Hi([
1814
+ me(0, _e),
1815
+ me(1, pe),
1816
+ me(2, Y(qt)),
1817
+ me(3, Y(it)),
1818
+ me(4, Y(xt)),
1819
+ me(5, yt),
1820
+ me(6, ye),
1821
+ me(7, Y(at))
1808
1822
  ], ke);
1809
- const Gi = [
1823
+ const wi = [
1810
1824
  {
1811
- functionName: zt.ARRAY_CONSTRAIN,
1825
+ functionName: Jt.ARRAY_CONSTRAIN,
1812
1826
  functionType: t.Array,
1813
1827
  description: "formula.functionList.ARRAY_CONSTRAIN.description",
1814
1828
  abstract: "formula.functionList.ARRAY_CONSTRAIN.abstract",
@@ -1837,7 +1851,7 @@ const Gi = [
1837
1851
  ]
1838
1852
  },
1839
1853
  {
1840
- functionName: zt.FLATTEN,
1854
+ functionName: Jt.FLATTEN,
1841
1855
  functionType: t.Array,
1842
1856
  description: "formula.functionList.FLATTEN.description",
1843
1857
  abstract: "formula.functionList.FLATTEN.abstract",
@@ -1858,7 +1872,7 @@ const Gi = [
1858
1872
  }
1859
1873
  ]
1860
1874
  }
1861
- ], Hi = [
1875
+ ], Yi = [
1862
1876
  {
1863
1877
  functionName: _.BETADIST,
1864
1878
  functionType: t.Compatibility,
@@ -2912,9 +2926,9 @@ const Gi = [
2912
2926
  }
2913
2927
  ]
2914
2928
  }
2915
- ], Yi = [
2929
+ ], Xi = [
2916
2930
  {
2917
- functionName: fe.CUBEKPIMEMBER,
2931
+ functionName: ce.CUBEKPIMEMBER,
2918
2932
  functionType: t.Cube,
2919
2933
  description: "formula.functionList.CUBEKPIMEMBER.description",
2920
2934
  abstract: "formula.functionList.CUBEKPIMEMBER.abstract",
@@ -2936,7 +2950,7 @@ const Gi = [
2936
2950
  ]
2937
2951
  },
2938
2952
  {
2939
- functionName: fe.CUBEMEMBER,
2953
+ functionName: ce.CUBEMEMBER,
2940
2954
  functionType: t.Cube,
2941
2955
  description: "formula.functionList.CUBEMEMBER.description",
2942
2956
  abstract: "formula.functionList.CUBEMEMBER.abstract",
@@ -2958,7 +2972,7 @@ const Gi = [
2958
2972
  ]
2959
2973
  },
2960
2974
  {
2961
- functionName: fe.CUBEMEMBERPROPERTY,
2975
+ functionName: ce.CUBEMEMBERPROPERTY,
2962
2976
  functionType: t.Cube,
2963
2977
  description: "formula.functionList.CUBEMEMBERPROPERTY.description",
2964
2978
  abstract: "formula.functionList.CUBEMEMBERPROPERTY.abstract",
@@ -2980,7 +2994,7 @@ const Gi = [
2980
2994
  ]
2981
2995
  },
2982
2996
  {
2983
- functionName: fe.CUBERANKEDMEMBER,
2997
+ functionName: ce.CUBERANKEDMEMBER,
2984
2998
  functionType: t.Cube,
2985
2999
  description: "formula.functionList.CUBERANKEDMEMBER.description",
2986
3000
  abstract: "formula.functionList.CUBERANKEDMEMBER.abstract",
@@ -3002,7 +3016,7 @@ const Gi = [
3002
3016
  ]
3003
3017
  },
3004
3018
  {
3005
- functionName: fe.CUBESET,
3019
+ functionName: ce.CUBESET,
3006
3020
  functionType: t.Cube,
3007
3021
  description: "formula.functionList.CUBESET.description",
3008
3022
  abstract: "formula.functionList.CUBESET.abstract",
@@ -3024,7 +3038,7 @@ const Gi = [
3024
3038
  ]
3025
3039
  },
3026
3040
  {
3027
- functionName: fe.CUBESETCOUNT,
3041
+ functionName: ce.CUBESETCOUNT,
3028
3042
  functionType: t.Cube,
3029
3043
  description: "formula.functionList.CUBESETCOUNT.description",
3030
3044
  abstract: "formula.functionList.CUBESETCOUNT.abstract",
@@ -3046,7 +3060,7 @@ const Gi = [
3046
3060
  ]
3047
3061
  },
3048
3062
  {
3049
- functionName: fe.CUBEVALUE,
3063
+ functionName: ce.CUBEVALUE,
3050
3064
  functionType: t.Cube,
3051
3065
  description: "formula.functionList.CUBEVALUE.description",
3052
3066
  abstract: "formula.functionList.CUBEVALUE.abstract",
@@ -3067,7 +3081,7 @@ const Gi = [
3067
3081
  }
3068
3082
  ]
3069
3083
  }
3070
- ], Xi = [
3084
+ ], Wi = [
3071
3085
  {
3072
3086
  functionName: $.DAVERAGE,
3073
3087
  functionType: t.Database,
@@ -3416,7 +3430,7 @@ const Gi = [
3416
3430
  }
3417
3431
  ]
3418
3432
  }
3419
- ], wi = [
3433
+ ], Ki = [
3420
3434
  {
3421
3435
  functionName: B.DATE,
3422
3436
  functionType: t.Date,
@@ -3988,7 +4002,7 @@ const Gi = [
3988
4002
  }
3989
4003
  ]
3990
4004
  }
3991
- ], Wi = [
4005
+ ], ki = [
3992
4006
  {
3993
4007
  functionName: A.BESSELI,
3994
4008
  functionType: t.Engineering,
@@ -5061,7 +5075,7 @@ const Gi = [
5061
5075
  }
5062
5076
  ]
5063
5077
  }
5064
- ], Ki = [
5078
+ ], Qi = [
5065
5079
  {
5066
5080
  functionName: C.ACCRINT,
5067
5081
  functionType: t.Financial,
@@ -7322,7 +7336,7 @@ const Gi = [
7322
7336
  }
7323
7337
  ]
7324
7338
  }
7325
- ], ki = [
7339
+ ], $i = [
7326
7340
  {
7327
7341
  functionName: v.CELL,
7328
7342
  functionType: t.Information,
@@ -7731,7 +7745,7 @@ const Gi = [
7731
7745
  }
7732
7746
  ]
7733
7747
  }
7734
- ], Qi = [
7748
+ ], ji = [
7735
7749
  {
7736
7750
  functionName: K.AND,
7737
7751
  functionType: t.Logical,
@@ -8205,7 +8219,7 @@ const Gi = [
8205
8219
  }
8206
8220
  ]
8207
8221
  }
8208
- ], $i = [
8222
+ ], zi = [
8209
8223
  {
8210
8224
  functionName: y.ADDRESS,
8211
8225
  functionType: t.Lookup,
@@ -9237,7 +9251,7 @@ const Gi = [
9237
9251
  }
9238
9252
  ]
9239
9253
  }
9240
- ], ji = [
9254
+ ], Zi = [
9241
9255
  {
9242
9256
  functionName: L.ABS,
9243
9257
  functionType: t.Math,
@@ -10875,7 +10889,7 @@ const Gi = [
10875
10889
  }
10876
10890
  ]
10877
10891
  }
10878
- ], zi = [
10892
+ ], Ji = [
10879
10893
  {
10880
10894
  functionName: l.AVEDEV,
10881
10895
  functionType: t.Statistical,
@@ -13817,7 +13831,7 @@ const Gi = [
13817
13831
  }
13818
13832
  ]
13819
13833
  }
13820
- ], Zi = [
13834
+ ], er = [
13821
13835
  {
13822
13836
  functionName: D.ASC,
13823
13837
  functionType: t.Text,
@@ -15031,7 +15045,7 @@ const Gi = [
15031
15045
  }
15032
15046
  ]
15033
15047
  }
15034
- ], Ji = [], er = [
15048
+ ], tr = [], ar = [
15035
15049
  {
15036
15050
  functionName: ft.ENCODEURL,
15037
15051
  functionType: t.Web,
@@ -15091,36 +15105,36 @@ const Gi = [
15091
15105
  }
15092
15106
  ]
15093
15107
  }
15094
- ], tr = [
15108
+ ], nr = [
15109
+ ...Qi,
15095
15110
  ...Ki,
15096
- ...wi,
15097
- ...ji,
15111
+ ...Zi,
15112
+ ...Ji,
15098
15113
  ...zi,
15114
+ ...Wi,
15115
+ ...er,
15116
+ ...ji,
15099
15117
  ...$i,
15100
- ...Xi,
15101
- ...Zi,
15102
- ...Qi,
15103
15118
  ...ki,
15104
- ...Wi,
15119
+ ...Xi,
15105
15120
  ...Yi,
15106
- ...Hi,
15107
- ...er,
15108
- ...Gi,
15109
- ...Ji
15121
+ ...ar,
15122
+ ...wi,
15123
+ ...tr
15110
15124
  ];
15111
- function ar(a, e) {
15125
+ function ir(a, e) {
15112
15126
  let n = "";
15113
15127
  return a.aliasFunctionName ? (n = e.t(a.aliasFunctionName), n === a.aliasFunctionName && (n = a.functionName)) : n = a.functionName, n;
15114
15128
  }
15115
- var nr = Object.getOwnPropertyDescriptor, ir = (a, e, n, i) => {
15116
- for (var r = i > 1 ? void 0 : i ? nr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15129
+ var rr = Object.getOwnPropertyDescriptor, or = (a, e, n, i) => {
15130
+ for (var r = i > 1 ? void 0 : i ? rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15117
15131
  (u = a[o]) && (r = u(r) || r);
15118
15132
  return r;
15119
15133
  }, Lt = (a, e) => (n, i) => e(n, i, a);
15120
15134
  const Ut = Mt("formula.description-service");
15121
15135
  let Ct = class {
15122
15136
  constructor(a, e, n) {
15123
- w(this, "_descriptions", []);
15137
+ X(this, "_descriptions", []);
15124
15138
  this._functionService = a, this._localeService = e, this._configService = n, this._initialize();
15125
15139
  }
15126
15140
  dispose() {
@@ -15157,7 +15171,7 @@ let Ct = class {
15157
15171
  }), e;
15158
15172
  }
15159
15173
  registerDescriptions(a) {
15160
- return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), le(() => {
15174
+ return this._descriptions = this._descriptions.concat(a), this._registerDescriptions(), ne(() => {
15161
15175
  const e = a.map((n) => n.functionName);
15162
15176
  this.unregisterDescriptions(e);
15163
15177
  });
@@ -15176,7 +15190,7 @@ let Ct = class {
15176
15190
  if (e.length === 0)
15177
15191
  return !1;
15178
15192
  const n = e[0].description;
15179
- return !Sn(n);
15193
+ return !Dn(n);
15180
15194
  }
15181
15195
  _initialize() {
15182
15196
  this._localeService.localeChanged$.subscribe(() => {
@@ -15186,8 +15200,6 @@ let Ct = class {
15186
15200
  _initDescription() {
15187
15201
  var i;
15188
15202
  const a = [
15189
- ...Cn,
15190
- ...Dn,
15191
15203
  ...bn,
15192
15204
  ...On,
15193
15205
  ...Mn,
@@ -15201,13 +15213,15 @@ let Ct = class {
15201
15213
  ...Fn,
15202
15214
  ...Bn,
15203
15215
  ...vn,
15204
- ...Vn
15205
- ].map((r) => r[1]), e = tr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ot);
15216
+ ...Vn,
15217
+ ...Gn,
15218
+ ...Hn
15219
+ ].map((r) => r[1]), e = nr.filter((r) => a.includes(r.functionName)), n = this._configService.getConfig(ot);
15206
15220
  this._descriptions = e.concat((i = n == null ? void 0 : n.description) != null ? i : []);
15207
15221
  }
15208
15222
  _registerDescriptions() {
15209
15223
  const a = this._localeService, e = this._descriptions.map((n) => ({
15210
- functionName: ar(n, a),
15224
+ functionName: ir(n, a),
15211
15225
  functionType: n.functionType,
15212
15226
  description: a.t(n.description),
15213
15227
  abstract: a.t(n.abstract),
@@ -15222,17 +15236,17 @@ let Ct = class {
15222
15236
  this._functionService.registerDescriptions(...e);
15223
15237
  }
15224
15238
  };
15225
- Ct = ir([
15239
+ Ct = or([
15226
15240
  Lt(0, ht),
15227
- Lt(1, X(Ot)),
15228
- Lt(2, _e)
15241
+ Lt(1, Y(Ot)),
15242
+ Lt(2, ye)
15229
15243
  ], Ct);
15230
- var rr = Object.getOwnPropertyDescriptor, or = (a, e, n, i) => {
15231
- for (var r = i > 1 ? void 0 : i ? rr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15244
+ var ur = Object.getOwnPropertyDescriptor, mr = (a, e, n, i) => {
15245
+ for (var r = i > 1 ? void 0 : i ? ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15232
15246
  (u = a[o]) && (r = u(r) || r);
15233
15247
  return r;
15234
- }, Fe = (a, e) => (n, i) => e(n, i, a);
15235
- function oa(a, e, n, i) {
15248
+ }, Be = (a, e) => (n, i) => e(n, i, a);
15249
+ function ma(a, e, n, i) {
15236
15250
  const r = a.sequenceNodesBuilder(e);
15237
15251
  if (r == null)
15238
15252
  return e;
@@ -15241,9 +15255,9 @@ function oa(a, e, n, i) {
15241
15255
  const f = r[u];
15242
15256
  if (typeof f == "string" || f.nodeType !== J.REFERENCE)
15243
15257
  continue;
15244
- const { token: s } = f, p = se(s), { sheetName: T, unitId: P } = p;
15245
- let E = p.range;
15246
- E.startAbsoluteRefType === Xe.ALL && E.endAbsoluteRefType === Xe.ALL || (E = Et(E, n, i), o.push({
15258
+ const { token: s } = f, d = se(s), { sheetName: T, unitId: P } = d;
15259
+ let E = d.range;
15260
+ E.startAbsoluteRefType === Ye.ALL && E.endAbsoluteRefType === Ye.ALL || (E = Et(E, n, i), o.push({
15247
15261
  unitId: P,
15248
15262
  sheetName: T,
15249
15263
  range: E
@@ -15256,33 +15270,33 @@ let Dt = class extends te {
15256
15270
  super(), this._refRangeService = a, this._lexerTreeBuilder = e, this._univerInstanceService = n, this._injector = i;
15257
15271
  }
15258
15272
  transformFormulaByEffectCommand(a, e, n, i) {
15259
- const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(ee.UNIVER_SHEET), u = o.getActiveSheet(), m = o.getUnitId(), f = u.getSheetId(), s = r == null ? void 0 : r.map((p) => {
15260
- if (typeof p == "object" && p.nodeType === J.REFERENCE) {
15261
- const T = se(p.token), { range: P, unitId: E, sheetName: I } = T, S = this._univerInstanceService.getUnit(E || a), c = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
15273
+ const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(ee.UNIVER_SHEET), u = o.getActiveSheet(), m = o.getUnitId(), f = u.getSheetId(), s = r == null ? void 0 : r.map((d) => {
15274
+ if (typeof d == "object" && d.nodeType === J.REFERENCE) {
15275
+ const T = se(d.token), { range: P, unitId: E, sheetName: I } = T, S = this._univerInstanceService.getUnit(E || a), c = I ? S == null ? void 0 : S.getSheetBySheetName(I) : S == null ? void 0 : S.getSheetBySheetId(e);
15262
15276
  if (!c)
15263
15277
  throw new Error("Sheet not found");
15264
15278
  const N = S.getUnitId(), R = c.getSheetId();
15265
15279
  if (N !== m || R !== f)
15266
- return p;
15267
- const d = Vt(P, i);
15280
+ return d;
15281
+ const p = Vt(P, i);
15268
15282
  let O = "";
15269
- if (d) {
15270
- const M = d.startColumn - P.startColumn, F = d.startRow - P.startRow, U = Et(P, M, F);
15271
- E && I ? O = Zt(E, I, U) : I ? O = Jt(I, U) : O = ea(U);
15283
+ if (p) {
15284
+ const M = p.startColumn - P.startColumn, F = p.startRow - P.startRow, U = Et(P, M, F);
15285
+ E && I ? O = ea(E, I, U) : I ? O = ta(I, U) : O = aa(U);
15272
15286
  } else
15273
15287
  O = j.REF;
15274
15288
  return {
15275
- ...p,
15289
+ ...d,
15276
15290
  token: O
15277
15291
  };
15278
15292
  } else
15279
- return p;
15293
+ return d;
15280
15294
  });
15281
- return s ? `=${we(s)}` : "";
15295
+ return s ? `=${Xe(s)}` : "";
15282
15296
  }
15283
15297
  registerFormula(a, e, n, i) {
15284
- const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new Ye(), m = (f) => {
15285
- const s = this._univerInstanceService.getCurrentUnitForType(ee.UNIVER_SHEET), p = s.getActiveSheet(), T = s.getUnitId(), P = p.getSheetId(), E = o == null ? void 0 : o.map((S) => {
15298
+ const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new we(), m = (f) => {
15299
+ const s = this._univerInstanceService.getCurrentUnitForType(ee.UNIVER_SHEET), d = s.getActiveSheet(), T = s.getUnitId(), P = d.getSheetId(), E = o == null ? void 0 : o.map((S) => {
15286
15300
  if (typeof S == "object" && S.nodeType === J.REFERENCE) {
15287
15301
  const c = r.get(S.token);
15288
15302
  if (c.unitId !== T || c.subUnitId !== P)
@@ -15290,8 +15304,8 @@ let Dt = class extends te {
15290
15304
  const N = Vt(c.range, f);
15291
15305
  let R = "";
15292
15306
  if (N) {
15293
- const d = N.startColumn - c.range.startColumn, O = N.startRow - c.range.startRow, M = Et(c.range, d, O);
15294
- c.unitId && c.sheetName ? R = Zt(c.unitId, c.sheetName, M) : c.sheetName ? R = Jt(c.sheetName, M) : R = ea(M);
15307
+ const p = N.startColumn - c.range.startColumn, O = N.startRow - c.range.startRow, M = Et(c.range, p, O);
15308
+ c.unitId && c.sheetName ? R = ea(c.unitId, c.sheetName, M) : c.sheetName ? R = ta(c.sheetName, M) : R = aa(M);
15295
15309
  } else
15296
15310
  R = j.REF;
15297
15311
  return {
@@ -15300,35 +15314,35 @@ let Dt = class extends te {
15300
15314
  };
15301
15315
  } else
15302
15316
  return S;
15303
- }), I = E && we(E);
15317
+ }), I = E && Xe(E);
15304
15318
  return i(`=${I}`);
15305
15319
  };
15306
15320
  return o == null || o.forEach((f) => {
15307
15321
  if (typeof f == "object" && f.nodeType === J.REFERENCE) {
15308
- const s = se(f.token), { range: p, unitId: T, sheetName: P } = s, E = this._univerInstanceService.getUnit(T || a), I = P ? E == null ? void 0 : E.getSheetBySheetName(P) : E == null ? void 0 : E.getSheetBySheetId(e);
15322
+ const s = se(f.token), { range: d, unitId: T, sheetName: P } = s, E = this._univerInstanceService.getUnit(T || a), I = P ? E == null ? void 0 : E.getSheetBySheetName(P) : E == null ? void 0 : E.getSheetBySheetId(e);
15309
15323
  if (!I)
15310
15324
  return;
15311
15325
  const S = E.getUnitId(), c = I.getSheetId(), N = {
15312
15326
  unitId: S,
15313
15327
  subUnitId: c,
15314
- range: p,
15328
+ range: d,
15315
15329
  sheetName: P
15316
15330
  };
15317
- r.set(f.token, N), u.add(this._refRangeService.registerRefRange(p, m, S, c));
15331
+ r.set(f.token, N), u.add(this._refRangeService.registerRefRange(d, m, S, c));
15318
15332
  }
15319
15333
  }), u;
15320
15334
  }
15321
15335
  _getFormulaDependcy(a, e, n, i) {
15322
- const r = be(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
15336
+ const r = Oe(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
15323
15337
  return r == null || r.forEach((u) => {
15324
15338
  if (typeof u == "object" && u.nodeType === J.REFERENCE) {
15325
- const m = se(u.token), { range: f, unitId: s, sheetName: p } = m;
15326
- if (f.startAbsoluteRefType === Xe.ALL && f.endAbsoluteRefType === Xe.ALL)
15339
+ const m = se(u.token), { range: f, unitId: s, sheetName: d } = m;
15340
+ if (f.startAbsoluteRefType === Ye.ALL && f.endAbsoluteRefType === Ye.ALL)
15327
15341
  return;
15328
- const T = this._univerInstanceService.getUnit(s || a), P = p ? T == null ? void 0 : T.getSheetBySheetName(p) : T == null ? void 0 : T.getSheetBySheetId(e);
15342
+ const T = this._univerInstanceService.getUnit(s || a), P = d ? T == null ? void 0 : T.getSheetBySheetName(d) : T == null ? void 0 : T.getSheetBySheetId(e);
15329
15343
  if (!P)
15330
15344
  return;
15331
- const E = T.getUnitId(), I = P.getSheetId(), S = i[0].startRow, c = i[0].startColumn, N = f.startRow, R = f.startColumn, d = i.map((O) => ({
15345
+ const E = T.getUnitId(), I = P.getSheetId(), S = i[0].startRow, c = i[0].startColumn, N = f.startRow, R = f.startColumn, p = i.map((O) => ({
15332
15346
  startRow: O.startRow - S + N,
15333
15347
  endRow: O.endRow - S + N,
15334
15348
  startColumn: O.startColumn - c + R,
@@ -15337,20 +15351,20 @@ let Dt = class extends te {
15337
15351
  o.push({
15338
15352
  unitId: E,
15339
15353
  subUnitId: I,
15340
- ranges: d
15354
+ ranges: p
15341
15355
  });
15342
15356
  }
15343
15357
  }), o;
15344
15358
  }
15345
15359
  // eslint-disable-next-line max-lines-per-function
15346
15360
  registerRangeFormula(a, e, n, i, r) {
15347
- const o = new Ye(), u = i.map((f) => this._getFormulaDependcy(a, e, f, n)), m = (f) => {
15348
- const s = n[0].startRow, p = n[0].startColumn, T = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], P = [], E = mn(this._injector, f);
15361
+ const o = new we(), u = i.map((f) => this._getFormulaDependcy(a, e, f, n)), m = (f) => {
15362
+ const s = n[0].startRow, d = n[0].startColumn, T = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], P = [], E = cn(this._injector, f);
15349
15363
  for (const { unitId: I, subUnitId: S, ranges: c } of T)
15350
15364
  if (I === E.unitId && S === E.subUnitId) {
15351
- const N = [], R = c[0].startRow, d = c[0].startColumn, O = R - s, M = d - p;
15365
+ const N = [], R = c[0].startRow, p = c[0].startColumn, O = R - s, M = p - d;
15352
15366
  for (const F of E.ranges) {
15353
- const U = c.map((g) => Ve(F, g)).filter(Boolean);
15367
+ const U = c.map((g) => Ge(F, g)).filter(Boolean);
15354
15368
  U.length > 0 && N.push(...U);
15355
15369
  }
15356
15370
  N.length > 0 && P.push(
@@ -15363,35 +15377,35 @@ let Dt = class extends te {
15363
15377
  );
15364
15378
  }
15365
15379
  if (P.length > 0) {
15366
- const I = De.splitIntoGrid([...P.flat()]), S = De.subtractMulti(n, I);
15380
+ const I = be.splitIntoGrid([...P.flat()]), S = be.subtractMulti(n, I);
15367
15381
  S.sort((O, M) => O.startRow - M.startRow || O.startColumn - M.startColumn);
15368
15382
  const c = /* @__PURE__ */ new Map();
15369
15383
  for (let O = 0; O < I.length; O++) {
15370
- const M = I[O], F = M.startRow, U = M.startColumn, g = F - s, x = U - p, h = fn(M, f).sort((k, re) => k.startRow - re.startRow || k.startColumn - re.startColumn);
15384
+ const M = I[O], F = M.startRow, U = M.startColumn, g = F - s, x = U - d, h = ln(M, f).sort((k, oe) => k.startRow - oe.startRow || k.startColumn - oe.startColumn);
15371
15385
  if (!h.length)
15372
15386
  continue;
15373
- const V = h[0].startRow, Q = h[0].startColumn, b = V - s, Le = Q - p, ae = [];
15387
+ const V = h[0].startRow, Q = h[0].startColumn, b = V - s, Le = Q - d, ae = [];
15374
15388
  for (let k = 0; k < i.length; k++) {
15375
- const re = i[k], z = be(re), ye = z ? this._lexerTreeBuilder.moveFormulaRefOffset(re, x, g) : re, oe = z ? this.transformFormulaByEffectCommand(a, e, ye, f) : ye, Pe = oa(this._lexerTreeBuilder, oe, -Le, -b);
15389
+ const oe = i[k], z = Oe(oe), qe = z ? this._lexerTreeBuilder.moveFormulaRefOffset(oe, x, g) : oe, ue = z ? this.transformFormulaByEffectCommand(a, e, qe, f) : qe, Pe = ma(this._lexerTreeBuilder, ue, -Le, -b);
15376
15390
  ae.push({
15377
- newFormula: oe,
15391
+ newFormula: ue,
15378
15392
  orginFormula: Pe
15379
15393
  });
15380
15394
  }
15381
- const ie = {
15395
+ const re = {
15382
15396
  formulas: ae,
15383
15397
  ranges: h,
15384
15398
  key: ae.map((k) => k.orginFormula).join("_")
15385
15399
  };
15386
- c.has(ie.key) ? c.get(ie.key).push(ie) : c.set(ie.key, [ie]);
15400
+ c.has(re.key) ? c.get(re.key).push(re) : c.set(re.key, [re]);
15387
15401
  }
15388
- const N = i.map((O) => oa(this._lexerTreeBuilder, O, 0, 0)).join("_");
15402
+ const N = i.map((O) => ma(this._lexerTreeBuilder, O, 0, 0)).join("_");
15389
15403
  if (S.length > 0) {
15390
15404
  const O = S[0].startRow, M = S[0].startColumn, F = [];
15391
15405
  for (let g = 0; g < i.length; g++) {
15392
15406
  const x = i[g];
15393
15407
  F.push({
15394
- newFormula: be(x) ? this._lexerTreeBuilder.moveFormulaRefOffset(x, M - p, O - s) : x,
15408
+ newFormula: Oe(x) ? this._lexerTreeBuilder.moveFormulaRefOffset(x, M - d, O - s) : x,
15395
15409
  orginFormula: x
15396
15410
  });
15397
15411
  }
@@ -15402,12 +15416,12 @@ let Dt = class extends te {
15402
15416
  };
15403
15417
  c.has(U.key) ? c.get(U.key).push(U) : c.set(U.key, [U]);
15404
15418
  }
15405
- const R = [], d = Array.from(c.keys());
15406
- for (let O = d.length - 1; O >= 0; O--) {
15407
- const M = d[O], F = c.get(M).sort((x, h) => x.ranges[0].startRow - h.ranges[0].startRow || x.ranges[0].startColumn - h.ranges[0].startColumn), U = [];
15419
+ const R = [], p = Array.from(c.keys());
15420
+ for (let O = p.length - 1; O >= 0; O--) {
15421
+ const M = p[O], F = c.get(M).sort((x, h) => x.ranges[0].startRow - h.ranges[0].startRow || x.ranges[0].startColumn - h.ranges[0].startColumn), U = [];
15408
15422
  for (let x = 0; x < F[0].formulas.length; x++)
15409
15423
  U.push(F[0].formulas[x].newFormula);
15410
- const g = De.mergeRanges(F.map((x) => x.ranges).flat());
15424
+ const g = be.mergeRanges(F.map((x) => x.ranges).flat());
15411
15425
  g.sort((x, h) => x.startRow - h.startRow || x.startColumn - h.startColumn), R.push({
15412
15426
  formulas: U,
15413
15427
  ranges: g
@@ -15423,59 +15437,59 @@ let Dt = class extends te {
15423
15437
  return n.forEach((f) => {
15424
15438
  const s = this._refRangeService.registerRefRange(f, m, a, e);
15425
15439
  o.add(s);
15426
- }), [...u.flat()].forEach(({ unitId: f, subUnitId: s, ranges: p }) => {
15427
- p.forEach((T) => {
15440
+ }), [...u.flat()].forEach(({ unitId: f, subUnitId: s, ranges: d }) => {
15441
+ d.forEach((T) => {
15428
15442
  const P = this._refRangeService.registerRefRange(T, m, f, s);
15429
15443
  o.add(P);
15430
15444
  });
15431
15445
  }), o;
15432
15446
  }
15433
15447
  };
15434
- Dt = or([
15435
- Fe(0, X(un)),
15436
- Fe(1, X(qt)),
15437
- Fe(2, xe),
15438
- Fe(3, X(at))
15448
+ Dt = mr([
15449
+ Be(0, Y(fn)),
15450
+ Be(1, Y(qt)),
15451
+ Be(2, _e),
15452
+ Be(3, Y(at))
15439
15453
  ], Dt);
15440
- var ur = Object.getOwnPropertyDescriptor, mr = (a, e, n, i) => {
15441
- for (var r = i > 1 ? void 0 : i ? ur(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15454
+ var fr = Object.getOwnPropertyDescriptor, cr = (a, e, n, i) => {
15455
+ for (var r = i > 1 ? void 0 : i ? fr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15442
15456
  (u = a[o]) && (r = u(r) || r);
15443
15457
  return r;
15444
- }, fr = (a, e) => (n, i) => e(n, i, a);
15445
- const Ft = "sheets-formula.remote-register-function.service", Ba = Mt(Ft);
15458
+ }, lr = (a, e) => (n, i) => e(n, i, a);
15459
+ const Ft = "sheets-formula.remote-register-function.service", Va = Mt(Ft);
15446
15460
  let Qe = class {
15447
15461
  constructor(a) {
15448
15462
  this._functionService = a;
15449
15463
  }
15450
15464
  async registerFunctions(a) {
15451
- const e = a.map(([n, i]) => cr(n, i));
15465
+ const e = a.map(([n, i]) => sr(n, i));
15452
15466
  this._functionService.registerExecutors(...e);
15453
15467
  }
15454
15468
  async registerAsyncFunctions(a) {
15455
- const e = a.map(([n, i]) => lr(n, i));
15469
+ const e = a.map(([n, i]) => dr(n, i));
15456
15470
  this._functionService.registerExecutors(...e);
15457
15471
  }
15458
15472
  async unregisterFunctions(a) {
15459
- this._functionService.unregisterDescriptions(...a);
15473
+ this._functionService.unregisterExecutors(...a), this._functionService.unregisterDescriptions(...a), this._functionService.deleteFormulaAstCacheKey(...a);
15460
15474
  }
15461
15475
  };
15462
- Qe = mr([
15463
- fr(0, ht)
15476
+ Qe = cr([
15477
+ lr(0, ht)
15464
15478
  ], Qe);
15465
- function cr(a, e) {
15479
+ function sr(a, e) {
15466
15480
  const n = new At(e), i = new Function(`return ${a}`)();
15467
15481
  return n.calculateCustom = i, n;
15468
15482
  }
15469
- function lr(a, e) {
15470
- const n = new Ma(e), i = new Function(`return ${a}`)();
15483
+ function dr(a, e) {
15484
+ const n = new _a(e), i = new Function(`return ${a}`)();
15471
15485
  return n.calculateCustom = i, n;
15472
15486
  }
15473
- var sr = Object.getOwnPropertyDescriptor, pr = (a, e, n, i) => {
15474
- for (var r = i > 1 ? void 0 : i ? sr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15487
+ var pr = Object.getOwnPropertyDescriptor, Lr = (a, e, n, i) => {
15488
+ for (var r = i > 1 ? void 0 : i ? pr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15475
15489
  (u = a[o]) && (r = u(r) || r);
15476
15490
  return r;
15477
- }, Be = (a, e) => (n, i) => e(n, i, a);
15478
- const dr = Mt(
15491
+ }, ve = (a, e) => (n, i) => e(n, i, a);
15492
+ const Pr = Mt(
15479
15493
  "sheets-formula.register-function-service"
15480
15494
  );
15481
15495
  let bt = class extends te {
@@ -15491,7 +15505,7 @@ let bt = class extends te {
15491
15505
  registerFunctions(a) {
15492
15506
  const { locales: e, description: n, calculate: i } = a;
15493
15507
  e && this._localeService.load(e);
15494
- const r = new Ye();
15508
+ const r = new we();
15495
15509
  if (n)
15496
15510
  r.add(this._descriptionService.registerDescriptions(n));
15497
15511
  else {
@@ -15507,7 +15521,7 @@ let bt = class extends te {
15507
15521
  return r.add(this._registerLocalExecutors(i)), this._remoteRegisterFunctionService && r.add(this._registerRemoteExecutors(i)), r;
15508
15522
  }
15509
15523
  _registerSingleFunction(a) {
15510
- const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new Ye();
15524
+ const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new we();
15511
15525
  if (r && this._localeService.load(r), typeof i == "string") {
15512
15526
  const f = {
15513
15527
  functionName: e,
@@ -15519,9 +15533,9 @@ let bt = class extends te {
15519
15533
  u.add(this._descriptionService.registerDescriptions([f]));
15520
15534
  } else
15521
15535
  u.add(this._descriptionService.registerDescriptions([i]));
15522
- const m = o ? new Ma(e) : new At(e);
15523
- return m.calculateCustom = n, this._functionService.registerExecutors(m), u.add(le(() => this._functionService.unregisterExecutors(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
15524
- le(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
15536
+ const m = o ? new _a(e) : new At(e);
15537
+ return m.calculateCustom = n, this._functionService.registerExecutors(m), u.add(ne(() => this._functionService.unregisterExecutors(e))), u.add(ne(() => this._functionService.unregisterDescriptions(e))), u.add(ne(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
15538
+ ne(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
15525
15539
  )), u;
15526
15540
  }
15527
15541
  _registerLocalExecutors(a) {
@@ -15529,22 +15543,22 @@ let bt = class extends te {
15529
15543
  const o = new At(r);
15530
15544
  return o.calculateCustom = i, o;
15531
15545
  });
15532
- return this._functionService.registerExecutors(...n), le(() => this._functionService.unregisterExecutors(...e));
15546
+ return this._functionService.registerExecutors(...n), ne(() => this._functionService.unregisterExecutors(...e));
15533
15547
  }
15534
15548
  _registerRemoteExecutors(a) {
15535
15549
  const e = [], n = a.map(([i, r]) => (e.push(r), [i.toString(), r]));
15536
- return this._remoteRegisterFunctionService.registerFunctions(n), le(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
15550
+ return this._remoteRegisterFunctionService.registerFunctions(n), ne(() => this._remoteRegisterFunctionService.unregisterFunctions(e));
15537
15551
  }
15538
15552
  };
15539
- bt = pr([
15540
- Be(0, X(Ot)),
15541
- Be(1, X(Ut)),
15542
- Be(2, ht),
15543
- Be(3, Xa(Ba))
15553
+ bt = Lr([
15554
+ ve(0, Y(Ot)),
15555
+ ve(1, Y(Ut)),
15556
+ ve(2, ht),
15557
+ ve(3, Wa(Va))
15544
15558
  ], bt);
15545
- const Lr = "SHEETS_FORMULA_PLUGIN";
15546
- var Pr = Object.getOwnPropertyDescriptor, Tr = (a, e, n, i) => {
15547
- for (var r = i > 1 ? void 0 : i ? Pr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15559
+ const Tr = "SHEETS_FORMULA_PLUGIN";
15560
+ var Er = Object.getOwnPropertyDescriptor, Ir = (a, e, n, i) => {
15561
+ for (var r = i > 1 ? void 0 : i ? Er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15548
15562
  (u = a[o]) && (r = u(r) || r);
15549
15563
  return r;
15550
15564
  }, Pt = (a, e) => (n, i) => e(n, i, a);
@@ -15556,15 +15570,15 @@ let $e = class extends te {
15556
15570
  this._initialConversion();
15557
15571
  }
15558
15572
  _initialConversion() {
15559
- this._activeDirtyManagerService.register(ne.id, {
15560
- commandId: ne.id,
15573
+ this._activeDirtyManagerService.register(ie.id, {
15574
+ commandId: ie.id,
15561
15575
  getDirtyData: (a) => {
15562
15576
  const e = a.params;
15563
15577
  return e.trigger === _t.id ? {} : {
15564
15578
  dirtyRanges: this._getSetRangeValuesMutationDirtyRange(e)
15565
15579
  };
15566
15580
  }
15567
- }), this._initialMove(), this._initialRowAndColumn(), this._initialSheet(), this._initialDefinedName();
15581
+ }), this._initialMove(), this._initialRowAndColumn(), this._initialHideRow(), this._initialSheet(), this._initialDefinedName();
15568
15582
  }
15569
15583
  _initialMove() {
15570
15584
  this._activeDirtyManagerService.register(Gt.id, {
@@ -15594,8 +15608,8 @@ let $e = class extends te {
15594
15608
  }
15595
15609
  };
15596
15610
  }
15597
- }), this._activeDirtyManagerService.register(Yt.id, {
15598
- commandId: Yt.id,
15611
+ }), this._activeDirtyManagerService.register(wt.id, {
15612
+ commandId: wt.id,
15599
15613
  getDirtyData: (a) => {
15600
15614
  const e = a.params;
15601
15615
  return {
@@ -15607,8 +15621,8 @@ let $e = class extends te {
15607
15621
  }
15608
15622
  };
15609
15623
  }
15610
- }), this._activeDirtyManagerService.register(Xt.id, {
15611
- commandId: Xt.id,
15624
+ }), this._activeDirtyManagerService.register(Yt.id, {
15625
+ commandId: Yt.id,
15612
15626
  getDirtyData: (a) => {
15613
15627
  const e = a.params;
15614
15628
  return {
@@ -15623,8 +15637,8 @@ let $e = class extends te {
15623
15637
  });
15624
15638
  }
15625
15639
  _initialRowAndColumn() {
15626
- this._activeDirtyManagerService.register(wt.id, {
15627
- commandId: wt.id,
15640
+ this._activeDirtyManagerService.register(Xt.id, {
15641
+ commandId: Xt.id,
15628
15642
  getDirtyData: (a) => {
15629
15643
  const e = a.params;
15630
15644
  return {
@@ -15675,6 +15689,35 @@ let $e = class extends te {
15675
15689
  }
15676
15690
  });
15677
15691
  }
15692
+ _initialHideRow() {
15693
+ this._activeDirtyManagerService.register(Qt.id, {
15694
+ commandId: Qt.id,
15695
+ getDirtyData: (a) => {
15696
+ const e = a.params;
15697
+ return {
15698
+ dirtyRanges: this._getHideRowMutation(e),
15699
+ clearDependencyTreeCache: {
15700
+ [e.unitId]: {
15701
+ [e.subUnitId]: "1"
15702
+ }
15703
+ }
15704
+ };
15705
+ }
15706
+ }), this._activeDirtyManagerService.register($t.id, {
15707
+ commandId: $t.id,
15708
+ getDirtyData: (a) => {
15709
+ const e = a.params;
15710
+ return {
15711
+ dirtyRanges: this._getHideRowMutation(e),
15712
+ clearDependencyTreeCache: {
15713
+ [e.unitId]: {
15714
+ [e.subUnitId]: "1"
15715
+ }
15716
+ }
15717
+ };
15718
+ }
15719
+ });
15720
+ }
15678
15721
  _initialSheet() {
15679
15722
  this._activeDirtyManagerService.register(It.id, {
15680
15723
  commandId: It.id,
@@ -15700,8 +15743,8 @@ let $e = class extends te {
15700
15743
  });
15701
15744
  }
15702
15745
  _initialDefinedName() {
15703
- this._activeDirtyManagerService.register(Me.id, {
15704
- commandId: Me.id,
15746
+ this._activeDirtyManagerService.register(xe.id, {
15747
+ commandId: xe.id,
15705
15748
  getDirtyData: (a) => {
15706
15749
  const e = a.params;
15707
15750
  return { dirtyDefinedNameMap: this._getDefinedNameMutation(e) };
@@ -15736,22 +15779,29 @@ let $e = class extends te {
15736
15779
  }
15737
15780
  _getRemoveRowOrColumnMutation(a, e = !0) {
15738
15781
  const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i), m = u == null ? void 0 : u.getSheetBySheetId(n), f = (m == null ? void 0 : m.getRowCount()) || 0, s = (m == null ? void 0 : m.getColumnCount()) || 0;
15739
- let p = null;
15782
+ let d = null;
15740
15783
  const { startRow: T, endRow: P, startColumn: E, endColumn: I } = r;
15741
- e === !0 ? p = this._rangeToMatrix({
15784
+ e === !0 ? d = this._rangeToMatrix({
15742
15785
  startRow: T,
15743
15786
  startColumn: 0,
15744
15787
  endRow: P,
15745
15788
  endColumn: s - 1
15746
- }) : p = this._rangeToMatrix({
15789
+ }) : d = this._rangeToMatrix({
15747
15790
  startRow: 0,
15748
15791
  startColumn: E,
15749
15792
  endRow: f,
15750
15793
  endColumn: I
15751
15794
  });
15752
- const S = p.getData();
15795
+ const S = d.getData();
15753
15796
  return o.push(...this._getDirtyRangesByCellValue(i, n, S)), o.push(...this._getDirtyRangesForArrayFormula(i, n, S)), o;
15754
15797
  }
15798
+ _getHideRowMutation(a) {
15799
+ const { subUnitId: e, unitId: n, ranges: i } = a, r = [];
15800
+ return i.forEach((o) => {
15801
+ const u = this._rangeToMatrix(o).getMatrix();
15802
+ r.push(...this._getDirtyRangesByCellValue(n, e, u));
15803
+ }), r;
15804
+ }
15755
15805
  _getRemoveSheetMutation(a) {
15756
15806
  const e = {}, { subUnitId: n, unitId: i, subUnitName: r } = a;
15757
15807
  return e[i] == null && (e[i] = {}), e[i][n] = r, e;
@@ -15785,12 +15835,12 @@ let $e = class extends te {
15785
15835
  const r = new W(n), o = this._formulaDataModel.getArrayFormulaRange();
15786
15836
  if ((u = o == null ? void 0 : o[a]) != null && u[e]) {
15787
15837
  const f = new W((m = o == null ? void 0 : o[a]) == null ? void 0 : m[e]);
15788
- r.forValue((s, p) => {
15838
+ r.forValue((s, d) => {
15789
15839
  f.forValue((T, P, E) => {
15790
15840
  if (E == null)
15791
15841
  return !0;
15792
15842
  const { startRow: I, startColumn: S, endRow: c, endColumn: N } = E;
15793
- s >= I && s <= c && p >= S && p <= N && i.push({
15843
+ s >= I && s <= c && d >= S && d <= N && i.push({
15794
15844
  unitId: a,
15795
15845
  sheetId: e,
15796
15846
  range: {
@@ -15806,13 +15856,13 @@ let $e = class extends te {
15806
15856
  return i;
15807
15857
  }
15808
15858
  };
15809
- $e = Tr([
15859
+ $e = Ir([
15810
15860
  Pt(0, gt),
15811
- Pt(1, xe),
15812
- Pt(2, X(it))
15861
+ Pt(1, _e),
15862
+ Pt(2, Y(it))
15813
15863
  ], $e);
15814
- var Er = Object.getOwnPropertyDescriptor, Ir = (a, e, n, i) => {
15815
- for (var r = i > 1 ? void 0 : i ? Er(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15864
+ var Nr = Object.getOwnPropertyDescriptor, Rr = (a, e, n, i) => {
15865
+ for (var r = i > 1 ? void 0 : i ? Nr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15816
15866
  (u = a[o]) && (r = u(r) || r);
15817
15867
  return r;
15818
15868
  }, Tt = (a, e) => (n, i) => e(n, i, a);
@@ -15838,20 +15888,20 @@ let je = class extends te {
15838
15888
  }
15839
15889
  _initInterceptorCellContent() {
15840
15890
  this.disposeWithMe(
15841
- this._sheetInterceptorService.intercept(cn.CELL_CONTENT, {
15891
+ this._sheetInterceptorService.intercept(sn.CELL_CONTENT, {
15842
15892
  priority: 100,
15843
- effect: wa.Value,
15893
+ effect: Ka.Value,
15844
15894
  handler: (a, e, n) => {
15845
- var s, p, T;
15846
- const { unitId: i, subUnitId: r, row: o, col: u } = e, m = this._formulaDataModel.getArrayFormulaCellData(), f = (T = (p = (s = m == null ? void 0 : m[i]) == null ? void 0 : s[r]) == null ? void 0 : p[o]) == null ? void 0 : T[u];
15895
+ var s, d, T;
15896
+ const { unitId: i, subUnitId: r, row: o, col: u } = e, m = this._formulaDataModel.getArrayFormulaCellData(), f = (T = (d = (s = m == null ? void 0 : m[i]) == null ? void 0 : s[r]) == null ? void 0 : d[o]) == null ? void 0 : T[u];
15847
15897
  return f == null ? n(a) : f.v == null && f.t == null ? n({
15848
15898
  ...a,
15849
15899
  v: 0,
15850
15900
  // Default value for empty cell
15851
15901
  t: Bt.NUMBER
15852
- }) : (a == null ? void 0 : a.t) === Bt.NUMBER && a.v !== void 0 && a.v !== null && Wa(a.v) ? n({
15902
+ }) : (a == null ? void 0 : a.t) === Bt.NUMBER && a.v !== void 0 && a.v !== null && ka(a.v) ? n({
15853
15903
  ...a,
15854
- v: Gn(Number(a.v))
15904
+ v: wn(Number(a.v))
15855
15905
  }) : n({
15856
15906
  ...a,
15857
15907
  v: f.v,
@@ -15862,34 +15912,34 @@ let je = class extends te {
15862
15912
  );
15863
15913
  }
15864
15914
  };
15865
- je = Ir([
15866
- Tt(0, de),
15867
- Tt(1, X(xt)),
15868
- Tt(2, X(it))
15915
+ je = Rr([
15916
+ Tt(0, pe),
15917
+ Tt(1, Y(xt)),
15918
+ Tt(2, Y(it))
15869
15919
  ], je);
15870
- var Nr = Object.getOwnPropertyDescriptor, Rr = (a, e, n, i) => {
15871
- for (var r = i > 1 ? void 0 : i ? Nr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15920
+ var Ar = Object.getOwnPropertyDescriptor, Sr = (a, e, n, i) => {
15921
+ for (var r = i > 1 ? void 0 : i ? Ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15872
15922
  (u = a[o]) && (r = u(r) || r);
15873
15923
  return r;
15874
- }, ve = (a, e) => (n, i) => e(n, i, a);
15924
+ }, Ve = (a, e) => (n, i) => e(n, i, a);
15875
15925
  let ze = class extends te {
15876
15926
  constructor(e, n, i, r) {
15877
15927
  super();
15878
- w(this, "_preUnitId", null);
15928
+ X(this, "_preUnitId", null);
15879
15929
  this._descriptionService = e, this._definedNamesService = n, this._univerInstanceService = i, this._commandService = r, this._initialize();
15880
15930
  }
15881
15931
  _initialize() {
15882
15932
  this._descriptionListener(), this._changeUnitListener(), this._changeSheetListener();
15883
15933
  }
15884
15934
  _descriptionListener() {
15885
- le(
15935
+ ne(
15886
15936
  this._definedNamesService.update$.subscribe(() => {
15887
15937
  this._registerDescriptions();
15888
15938
  })
15889
15939
  );
15890
15940
  }
15891
15941
  _changeUnitListener() {
15892
- le(
15942
+ ne(
15893
15943
  this._univerInstanceService.getCurrentTypeOfUnit$(ee.UNIVER_SHEET).subscribe(() => {
15894
15944
  this._unRegisterDescriptions(), this._registerDescriptions();
15895
15945
  })
@@ -15899,9 +15949,9 @@ let ze = class extends te {
15899
15949
  this.disposeWithMe(
15900
15950
  this._commandService.onCommandExecuted((e, n) => {
15901
15951
  if (!(n != null && n.fromCollab)) {
15902
- if (e.id === ln.id)
15952
+ if (e.id === dn.id)
15903
15953
  this._unregisterDescriptionsForNotInSheetId(), this._registerDescriptions();
15904
- else if (e.id === Me.id) {
15954
+ else if (e.id === xe.id) {
15905
15955
  const i = e.params;
15906
15956
  this._registerDescription(i);
15907
15957
  } else if (e.id === St.id) {
@@ -15984,132 +16034,132 @@ let ze = class extends te {
15984
16034
  }), this._descriptionService.unregisterDescriptions(r);
15985
16035
  }
15986
16036
  };
15987
- ze = Rr([
15988
- ve(0, Ut),
15989
- ve(1, yt),
15990
- ve(2, xe),
15991
- ve(3, de)
16037
+ ze = Sr([
16038
+ Ve(0, Ut),
16039
+ Ve(1, yt),
16040
+ Ve(2, _e),
16041
+ Ve(3, pe)
15992
16042
  ], ze);
15993
- var Ar = Object.getOwnPropertyDescriptor, Sr = (a, e, n, i) => {
15994
- for (var r = i > 1 ? void 0 : i ? Ar(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16043
+ var Cr = Object.getOwnPropertyDescriptor, Dr = (a, e, n, i) => {
16044
+ for (var r = i > 1 ? void 0 : i ? Cr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
15995
16045
  (u = a[o]) && (r = u(r) || r);
15996
16046
  return r;
15997
- }, Cr = (a, e) => (n, i) => e(n, i, a);
16047
+ }, br = (a, e) => (n, i) => e(n, i, a);
15998
16048
  let Ze = class extends te {
15999
16049
  constructor(a) {
16000
16050
  super(), this._commandService = a, [
16001
- Wn,
16002
- Ge
16051
+ kn,
16052
+ De
16003
16053
  ].forEach((e) => this._commandService.registerCommand(e));
16004
16054
  }
16005
16055
  };
16006
- Ze = Sr([
16007
- Cr(0, de)
16056
+ Ze = Dr([
16057
+ br(0, pe)
16008
16058
  ], Ze);
16009
- var Dr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Or = (a, e, n) => e in a ? Dr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, va = (a, e, n, i) => {
16010
- for (var r = i > 1 ? void 0 : i ? br(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16059
+ var Or = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, xr = (a, e, n) => e in a ? Or(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, Ga = (a, e, n, i) => {
16060
+ for (var r = i > 1 ? void 0 : i ? Mr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
16011
16061
  (u = a[o]) && (r = u(r) || r);
16012
16062
  return r;
16013
- }, Je = (a, e) => (n, i) => e(n, i, a), ut = (a, e, n) => Or(a, typeof e != "symbol" ? e + "" : e, n);
16014
- let et = class extends la {
16015
- constructor(a = ia, e, n) {
16063
+ }, Je = (a, e) => (n, i) => e(n, i, a), ut = (a, e, n) => xr(a, typeof e != "symbol" ? e + "" : e, n);
16064
+ let et = class extends da {
16065
+ constructor(a = oa, e, n) {
16016
16066
  super(), this._config = a, this._injector = e, this._configService = n;
16017
- const { ...i } = sa(
16067
+ const { ...i } = pa(
16018
16068
  {},
16019
- ia,
16069
+ oa,
16020
16070
  this._config
16021
16071
  );
16022
- this._configService.setConfig(Ui, i);
16072
+ this._configService.setConfig(Bi, i);
16023
16073
  }
16024
16074
  onStarting() {
16025
- this._injector.add([Qe]), this._injector.get(ya).registerChannel(
16075
+ this._injector.add([Qe]), this._injector.get(ga).registerChannel(
16026
16076
  Ft,
16027
- Xn(this._injector.get(Qe))
16077
+ Wn(this._injector.get(Qe))
16028
16078
  );
16029
16079
  }
16030
16080
  };
16031
16081
  ut(et, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
16032
16082
  ut(et, "type", ee.UNIVER_SHEET);
16033
- et = va([
16034
- ca(xa),
16035
- Je(1, X(at)),
16036
- Je(2, _e)
16083
+ et = Ga([
16084
+ sa(ya),
16085
+ Je(1, Y(at)),
16086
+ Je(2, ye)
16037
16087
  ], et);
16038
- let tt = class extends la {
16039
- constructor(a = na, e, n) {
16088
+ let tt = class extends da {
16089
+ constructor(a = ra, e, n) {
16040
16090
  super(), this._config = a, this._injector = e, this._configService = n;
16041
- const { ...i } = sa(
16091
+ const { ...i } = pa(
16042
16092
  {},
16043
- na,
16093
+ ra,
16044
16094
  this._config
16045
16095
  );
16046
16096
  this._configService.setConfig(ot, i, { merge: !0 });
16047
16097
  }
16048
16098
  onStarting() {
16049
16099
  const a = this._injector, e = [
16050
- [dr, { useClass: bt }],
16100
+ [Pr, { useClass: bt }],
16051
16101
  [Ut, { useClass: Ct }],
16052
16102
  [Ze],
16053
16103
  [Dt],
16054
16104
  [Ke],
16055
16105
  [je],
16056
- [Oe],
16106
+ [Me],
16057
16107
  [ke],
16058
16108
  [$e],
16059
16109
  [ze],
16060
16110
  [We]
16061
16111
  ];
16062
16112
  if (this._config.notExecuteFormula) {
16063
- const n = a.get(ya);
16064
- e.push([Ba, {
16065
- useFactory: () => wn(n.requestChannel(Ft))
16113
+ const n = a.get(ga);
16114
+ e.push([Va, {
16115
+ useFactory: () => Kn(n.requestChannel(Ft))
16066
16116
  }]);
16067
16117
  }
16068
16118
  e.forEach((n) => a.add(n));
16069
16119
  }
16070
16120
  onReady() {
16071
- qe(this._injector, [
16121
+ ge(this._injector, [
16072
16122
  [Ze],
16073
16123
  [$e],
16074
16124
  [je],
16075
16125
  [ke],
16076
16126
  [We]
16077
- ]), vt() && qe(this._injector, [
16078
- [Oe]
16127
+ ]), vt() && ge(this._injector, [
16128
+ [Me]
16079
16129
  ]);
16080
16130
  }
16081
16131
  onRendered() {
16082
- qe(this._injector, [
16132
+ ge(this._injector, [
16083
16133
  [ze]
16084
- ]), vt() || qe(this._injector, [
16085
- [Oe]
16134
+ ]), vt() || ge(this._injector, [
16135
+ [Me]
16086
16136
  ]);
16087
16137
  }
16088
16138
  };
16089
- ut(tt, "pluginName", Lr);
16139
+ ut(tt, "pluginName", Tr);
16090
16140
  ut(tt, "type", ee.UNIVER_SHEET);
16091
- tt = va([
16092
- ca(xa, sn),
16093
- Je(1, X(at)),
16094
- Je(2, _e)
16141
+ tt = Ga([
16142
+ sa(ya, pn),
16143
+ Je(1, Y(at)),
16144
+ Je(2, ye)
16095
16145
  ], tt);
16096
16146
  export {
16097
- pe as CalculationMode,
16147
+ de as CalculationMode,
16098
16148
  Ct as DescriptionService,
16099
16149
  Dt as FormulaRefRangeService,
16100
16150
  Ut as IDescriptionService,
16101
- dr as IRegisterFunctionService,
16102
- Ba as IRemoteRegisterFunctionService,
16103
- Wn as InsertFunctionCommand,
16104
- Ge as OtherFormulaMarkDirty,
16151
+ Pr as IRegisterFunctionService,
16152
+ Va as IRemoteRegisterFunctionService,
16153
+ kn as InsertFunctionCommand,
16154
+ De as OtherFormulaMarkDirty,
16105
16155
  ot as PLUGIN_CONFIG_KEY_BASE,
16106
16156
  bt as RegisterFunctionService,
16107
16157
  Ke as RegisterOtherFormulaService,
16108
16158
  Qe as RemoteRegisterFunctionService,
16109
- Oe as TriggerCalculationController,
16159
+ Me as TriggerCalculationController,
16110
16160
  et as UniverRemoteSheetsFormulaPlugin,
16111
16161
  tt as UniverSheetsFormulaPlugin,
16112
16162
  We as UpdateDefinedNameController,
16113
16163
  ke as UpdateFormulaController,
16114
- hr as calculateFormula
16164
+ Fr as calculateFormula
16115
16165
  };