@univerjs/sheets-formula-ui 0.7.0 → 0.8.0-beta.1

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.
Files changed (51) hide show
  1. package/lib/cjs/index.js +6 -9
  2. package/lib/cjs/locale/en-US.js +2 -2
  3. package/lib/cjs/locale/fa-IR.js +2 -2
  4. package/lib/cjs/locale/fr-FR.js +2 -2
  5. package/lib/cjs/locale/ru-RU.js +2 -2
  6. package/lib/cjs/locale/vi-VN.js +2 -2
  7. package/lib/cjs/locale/zh-CN.js +2 -2
  8. package/lib/cjs/locale/zh-TW.js +2 -2
  9. package/lib/es/index.js +1483 -1411
  10. package/lib/es/locale/en-US.js +10 -5
  11. package/lib/es/locale/fa-IR.js +10 -5
  12. package/lib/es/locale/fr-FR.js +10 -5
  13. package/lib/es/locale/ru-RU.js +10 -5
  14. package/lib/es/locale/vi-VN.js +19 -0
  15. package/lib/es/locale/zh-CN.js +10 -5
  16. package/lib/es/locale/zh-TW.js +10 -5
  17. package/lib/index.css +1 -1
  18. package/lib/index.js +1483 -1411
  19. package/lib/locale/en-US.js +10 -5
  20. package/lib/locale/fa-IR.js +10 -5
  21. package/lib/locale/fr-FR.js +10 -5
  22. package/lib/locale/ru-RU.js +10 -5
  23. package/lib/locale/vi-VN.js +19 -0
  24. package/lib/locale/zh-CN.js +10 -5
  25. package/lib/locale/zh-TW.js +10 -5
  26. package/lib/types/controllers/menu.d.ts +6 -0
  27. package/lib/types/controllers/shortcuts/quick-sum.shortcut.d.ts +2 -0
  28. package/lib/types/locale/en-US.d.ts +7 -2
  29. package/lib/types/locale/fa-IR.d.ts +7 -2
  30. package/lib/types/locale/fr-FR.d.ts +7 -2
  31. package/lib/types/locale/function-list/lookup/en-US.d.ts +2 -2
  32. package/lib/types/locale/function-list/lookup/fr-FR.d.ts +2 -2
  33. package/lib/types/locale/function-list/lookup/ja-JP.d.ts +2 -2
  34. package/lib/types/locale/function-list/lookup/vi-VN.d.ts +18 -0
  35. package/lib/types/locale/function-list/lookup/zh-CN.d.ts +2 -2
  36. package/lib/types/locale/function-list/lookup/zh-TW.d.ts +2 -2
  37. package/lib/types/locale/ru-RU.d.ts +7 -2
  38. package/lib/types/locale/vi-VN.d.ts +23 -0
  39. package/lib/types/locale/zh-CN.d.ts +7 -2
  40. package/lib/types/locale/zh-TW.d.ts +7 -2
  41. package/lib/types/views/formula-editor/search-function/SearchFunction.d.ts +1 -2
  42. package/lib/types/views/more-functions/function-params/FunctionParams.d.ts +3 -3
  43. package/lib/umd/index.js +6 -9
  44. package/lib/umd/locale/en-US.js +2 -2
  45. package/lib/umd/locale/fa-IR.js +2 -2
  46. package/lib/umd/locale/fr-FR.js +2 -2
  47. package/lib/umd/locale/ru-RU.js +2 -2
  48. package/lib/umd/locale/vi-VN.js +2 -2
  49. package/lib/umd/locale/zh-CN.js +2 -2
  50. package/lib/umd/locale/zh-TW.js +2 -2
  51. package/package.json +14 -14
package/lib/es/index.js CHANGED
@@ -1,44 +1,44 @@
1
- var $r = Object.defineProperty;
2
- var Ur = (e, t, n) => t in e ? $r(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var j = (e, t, n) => Ur(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { CommandType as ye, ICommandService as ue, createIdentifier as Vr, IContextService as zt, IUniverInstanceService as ee, Rectangle as Vn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Zt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Wn, DEFAULT_EMPTY_DOCUMENT_VALUE as Hn, isRealNum as Wr, CellValueType as vn, getCellValueType as Hr, LocaleService as tt, Tools as Je, Inject as B, Injector as dt, ThemeService as ht, toDisposable as Bn, DisposableCollection as We, RANGE_TYPE as me, UniverInstanceType as J, ColorKit as Xt, getBodySlice as pn, Direction as ce, EDITOR_ACTIVATED as pt, createInternalEditorID as Br, generateRandomId as jr, BuildTextUtils as qr, RichTextBuilder as Kr, Disposable as nt, ObjectMatrix as ke, Range as Yr, isFormulaString as Ie, isFormulaId as He, FOCUSING_DOC as Gr, FOCUSING_UNIVER_EDITOR as zr, isICellData as Zr, ILogService as Xr, RxDisposable as Qr, InterceptorEffectEnum as Jr, DependentOn as eo, IConfigService as to, Plugin as no, merge as ro, registerDependencies as oo, touchDependencies as so } from "@univerjs/core";
5
- import { SheetPasteCommand as io, PREDEFINED_HOOK_NAME as Xe, IEditorBridgeService as Qt, SetCellEditVisibleOperation as jn, SheetSkeletonManagerService as At, BaseSelectionRenderService as co, getCoordByOffset as Cn, checkInHeaderRanges as _n, getAllSelection as lo, genNormalSelectionStyle as qn, getSheetObject as ao, attachSelectionWithCoord as Bt, SelectionControl as Kn, MoveSelectionCommand as Rn, JumpOver as bn, ExpandSelectionCommand as En, EMBEDDING_FORMULA_EDITOR as uo, IMarkSelectionService as ho, HoverManagerService as fo, CellAlertManagerService as go, CellAlertType as mo, IAutoFillService as So, APPLY_TYPE as vo, DATA_TYPE as In, ISheetClipboardService as po, COPY_TYPE as Yn, SELECTION_SHAPE_DEPTH as Co, useActiveWorkbook as _o, getCurrentRangeDisable$ as Gn, PASTE_SPECIAL_MENU_ID as Ro, whenFormulaEditorActivated as ft, SheetsUIPart as bo, RANGE_SELECTOR_COMPONENT_KEY as Eo, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Io } from "@univerjs/sheets-ui";
6
- import { sequenceNodeType as z, serializeRange as Se, LexerTreeBuilder as Ce, deserializeRangeWithSheetWithCache as yo, matchRefDrawToken as To, isFormulaLexerToken as xo, matchToken as et, deserializeRangeWithSheet as rt, serializeRangeToRefString as Oo, serializeRangeWithSheet as at, generateStringWithSequence as No, operatorToken as zn, FormulaDataModel as gt, ERROR_TYPE_SET as Mo, ErrorType as ie, SetFormulaCalculationResultMutation as wo, SetArrayFormulaDataMutation as Ao, SetFormulaCalculationStopMutation as ko, FunctionType as Fo, UniverFormulaEnginePlugin as Do } from "@univerjs/engine-formula";
7
- import { Subject as st, BehaviorSubject as Zn, throttleTime as Lo, debounceTime as Jt, filter as jt, map as Xn, distinctUntilChanged as Po, merge as $o, combineLatestWith as Uo, switchMap as Vo, of as yn, Observable as Wo } from "rxjs";
8
- import { IEditorService as Be, DocSelectionRenderService as Qn, ReplaceTextRunsCommand as Tn, MoveSelectionOperation as Ho, MoveCursorOperation as Bo, useKeyboardEvent as jo, useResize as qo, DocBackScrollRenderController as Ko, RichTextEditor as Yo } from "@univerjs/docs-ui";
9
- import { DeviceInputEventType as Te, ScrollTimerType as Ut, SHEET_VIEWPORT_KEY as xn, Vector2 as On, IRenderManagerService as xe } from "@univerjs/engine-render";
10
- import { SheetsSelectionsService as en, getSheetCommandTarget as Jn, getCellAtRowCol as Go, SetSelectionsOperation as tn, IRefSelectionsService as kt, SelectionMoveType as Vt, convertSelectionDataToRange as zo, setEndForRange as Zo, REF_SELECTIONS_ENABLED as Nn, SetWorksheetActiveOperation as Mn, SheetInterceptorService as nn, ReorderRangeCommand as Xo, SetRangeValuesMutation as bt, SetRangeValuesUndoMutationFactory as Qo, BEFORE_CELL_EDIT as Jo, SetWorksheetRowAutoHeightMutation as es, INTERCEPTOR_POINT as ts, WorksheetSetCellValuePermission as er, WorksheetEditPermission as tr, RangeProtectionPermissionEditPoint as nr, WorkbookEditablePermission as rr } from "@univerjs/sheets";
11
- import { InsertFunctionCommand as ns, IDescriptionService as Ft, TriggerCalculationController as rs, UniverSheetsFormulaPlugin as os } from "@univerjs/sheets-formula";
12
- import { ISidebarService as rn, useDependency as T, useEvent as Q, useObservable as ve, RectPopup as qt, IShortcutService as Dt, KeyCode as L, MetaKeys as W, IContextMenuService as ss, useUpdateEffect as is, IZenZoneService as cs, ProgressBar as ls, MenuItemType as on, getMenuHiddenObservable as as, IClipboardInterfaceService as wn, RibbonStartGroup as us, IMenuManagerService as ds, IUIPartsService as or, ComponentManager as sr, connectInjector as ir, BuiltInUIPart as hs } from "@univerjs/ui";
13
- import { jsx as O, jsxs as V, Fragment as fs } from "react/jsx-runtime";
14
- import { clsx as pe, borderTopClassName as gs, borderClassName as sn, scrollbarClassName as cr, Tooltip as ms, Dialog as Ss, Input as lr, Button as Qe, borderLeftClassName as vs, Select as ps } from "@univerjs/design";
15
- import { forwardRef as Oe, useRef as Y, createElement as je, useEffect as P, useMemo as oe, useState as U, useCallback as Et, useLayoutEffect as It, useImperativeHandle as Cs } from "react";
16
- import { DocSelectionManagerService as ar } from "@univerjs/docs";
17
- import { debounceTime as _s } from "rxjs/operators";
18
- const cn = {
1
+ var Vr = Object.defineProperty;
2
+ var Wr = (e, t, n) => t in e ? Vr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var j = (e, t, n) => Wr(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { CommandType as Te, ICommandService as de, createIdentifier as Hr, IContextService as on, IUniverInstanceService as ee, Rectangle as Gn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as sn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Zn, DEFAULT_EMPTY_DOCUMENT_VALUE as zn, isRealNum as Br, CellValueType as bn, getCellValueType as jr, LocaleService as lt, Tools as it, Inject as B, Injector as _t, ThemeService as Rt, toDisposable as Xn, DisposableCollection as He, RANGE_TYPE as ve, UniverInstanceType as q, ColorKit as cn, getBodySlice as yn, Direction as ae, EDITOR_ACTIVATED as xt, createInternalEditorID as qr, generateRandomId as Kr, BuildTextUtils as Yr, RichTextBuilder as Gr, Disposable as ut, ObjectMatrix as Fe, Range as Zr, isFormulaString as ye, isFormulaId as Be, FOCUSING_DOC as zr, FOCUSING_UNIVER_EDITOR as Xr, isICellData as Qr, ILogService as Jr, RxDisposable as eo, InterceptorEffectEnum as to, DependentOn as no, IConfigService as ro, Plugin as oo, merge as so, registerDependencies as io, touchDependencies as co } from "@univerjs/core";
5
+ import { SheetPasteCommand as ao, PREDEFINED_HOOK_NAME as ot, IEditorBridgeService as an, SetCellEditVisibleOperation as Qn, SheetSkeletonManagerService as Wt, BaseSelectionRenderService as lo, getCoordByOffset as Tn, checkInHeaderRanges as xn, getAllSelection as uo, genNormalSelectionStyle as Jn, getSheetObject as ho, attachSelectionWithCoord as Qt, SelectionControl as er, MoveSelectionCommand as On, JumpOver as Nn, ExpandSelectionCommand as Mn, EMBEDDING_FORMULA_EDITOR as fo, IMarkSelectionService as go, HoverManagerService as mo, CellAlertManagerService as po, CellAlertType as vo, IAutoFillService as So, APPLY_TYPE as Co, DATA_TYPE as wn, ISheetClipboardService as _o, COPY_TYPE as tr, SELECTION_SHAPE_DEPTH as Ro, useActiveWorkbook as Eo, getCurrentRangeDisable$ as je, PASTE_SPECIAL_MENU_ID as Io, whenFormulaEditorActivated as Et, whenSheetEditorFocused as bo, SheetsUIPart as yo, RANGE_SELECTOR_COMPONENT_KEY as To, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as xo } from "@univerjs/sheets-ui";
6
+ import { sequenceNodeType as z, serializeRange as Se, LexerTreeBuilder as _e, deserializeRangeWithSheetWithCache as Oo, matchRefDrawToken as No, isFormulaLexerToken as Mo, matchToken as ct, deserializeRangeWithSheet as dt, serializeRangeToRefString as wo, serializeRangeWithSheet as St, generateStringWithSequence as ko, operatorToken as nr, FormulaDataModel as It, ERROR_TYPE_SET as Ao, ErrorType as ce, SetFormulaCalculationResultMutation as Fo, SetArrayFormulaDataMutation as Do, SetFormulaCalculationStopMutation as Lo, FunctionType as $o, UniverFormulaEnginePlugin as Po } from "@univerjs/engine-formula";
7
+ import { Subject as gt, BehaviorSubject as rr, throttleTime as Uo, debounceTime as ln, filter as Jt, map as or, distinctUntilChanged as Vo, merge as Wo, combineLatestWith as Ho, switchMap as Bo, of as kn, Observable as jo } from "rxjs";
8
+ import { IEditorService as qe, DocSelectionRenderService as sr, ReplaceTextRunsCommand as An, MoveSelectionOperation as qo, MoveCursorOperation as Ko, useKeyboardEvent as Yo, useResize as Go, DocBackScrollRenderController as Zo, RichTextEditor as zo } from "@univerjs/docs-ui";
9
+ import { DeviceInputEventType as xe, ScrollTimerType as Gt, SHEET_VIEWPORT_KEY as Fn, Vector2 as Dn, IRenderManagerService as Oe } from "@univerjs/engine-render";
10
+ import { SheetsSelectionsService as un, getSheetCommandTarget as ir, getCellAtRowCol as Xo, SetSelectionsOperation as dn, IRefSelectionsService as Ht, SelectionMoveType as Zt, convertSelectionDataToRange as Qo, setEndForRange as Jo, REF_SELECTIONS_ENABLED as Ln, SetWorksheetActiveOperation as $n, SheetInterceptorService as hn, ReorderRangeCommand as es, SetRangeValuesMutation as wt, SetRangeValuesUndoMutationFactory as ts, BEFORE_CELL_EDIT as ns, SetWorksheetRowAutoHeightMutation as rs, INTERCEPTOR_POINT as os, WorksheetSetCellValuePermission as Ke, WorksheetEditPermission as Ye, RangeProtectionPermissionEditPoint as Ge, WorkbookEditablePermission as Ze } from "@univerjs/sheets";
11
+ import { InsertFunctionCommand as ss, IDescriptionService as Bt, TriggerCalculationController as is, QuickSumCommand as cs, UniverSheetsFormulaPlugin as as } from "@univerjs/sheets-formula";
12
+ import { ISidebarService as fn, useDependency as T, useEvent as J, useObservable as Ce, RectPopup as en, IShortcutService as jt, KeyCode as D, MetaKeys as P, IContextMenuService as ls, useUpdateEffect as us, IZenZoneService as ds, ProgressBar as hs, MenuItemType as ze, getMenuHiddenObservable as ht, IClipboardInterfaceService as Pn, RibbonFormulasGroup as Un, IMenuManagerService as fs, IUIPartsService as cr, ComponentManager as ar, connectInjector as lr, BuiltInUIPart as gs } from "@univerjs/ui";
13
+ import { jsx as O, jsxs as W, Fragment as ms } from "react/jsx-runtime";
14
+ import { clsx as ne, borderTopClassName as ps, scrollbarClassName as at, borderClassName as gn, Tooltip as vs, Dialog as Ss, Input as ur, Button as st, borderLeftClassName as Cs, Select as _s } from "@univerjs/design";
15
+ import { forwardRef as Ne, useRef as G, createElement as Xe, useEffect as $, useMemo as se, useState as V, useCallback as kt, useLayoutEffect as At, useImperativeHandle as Rs } from "react";
16
+ import { DocSelectionManagerService as dr } from "@univerjs/docs";
17
+ import { debounceTime as Es } from "rxjs/operators";
18
+ const mn = {
19
19
  id: "sheet.command.paste-formula",
20
- type: ye.COMMAND,
21
- handler: async (e) => e.get(ue).executeCommand(io.id, {
22
- value: Xe.SPECIAL_PASTE_FORMULA
20
+ type: Te.COMMAND,
21
+ handler: async (e) => e.get(de).executeCommand(ao.id, {
22
+ value: ot.SPECIAL_PASTE_FORMULA
23
23
  })
24
- }, ot = {
24
+ }, ft = {
25
25
  id: "formula-ui.operation.select-editor-formula",
26
- type: ye.OPERATION,
26
+ type: Te.OPERATION,
27
27
  handler: (e, t) => !0
28
28
  };
29
- var Rs = Object.getOwnPropertyDescriptor, bs = (e, t, n, o) => {
30
- for (var r = o > 1 ? void 0 : o ? Rs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
29
+ var Is = Object.getOwnPropertyDescriptor, bs = (e, t, n, o) => {
30
+ for (var r = o > 1 ? void 0 : o ? Is(t, n) : t, s = e.length - 1, c; s >= 0; s--)
31
31
  (c = e[s]) && (r = c(r) || r);
32
32
  return r;
33
- }, Es = (e, t) => (n, o) => t(n, o, e);
34
- const Is = "FORMULA_PROMPT_ACTIVATED", ln = Vr("formula-ui.prompt-service");
35
- let Kt = class {
33
+ }, ys = (e, t) => (n, o) => t(n, o, e);
34
+ const Ts = "FORMULA_PROMPT_ACTIVATED", pn = Hr("formula-ui.prompt-service");
35
+ let tn = class {
36
36
  constructor(e) {
37
- j(this, "_search$", new st());
38
- j(this, "_help$", new st());
39
- j(this, "_navigate$", new st());
40
- j(this, "_accept$", new st());
41
- j(this, "_acceptFormulaName$", new st());
37
+ j(this, "_search$", new gt());
38
+ j(this, "_help$", new gt());
39
+ j(this, "_navigate$", new gt());
40
+ j(this, "_accept$", new gt());
41
+ j(this, "_acceptFormulaName$", new gt());
42
42
  j(this, "search$", this._search$.asObservable());
43
43
  j(this, "help$", this._help$.asObservable());
44
44
  j(this, "navigate$", this._navigate$.asObservable());
@@ -55,7 +55,7 @@ let Kt = class {
55
55
  this._search$.complete(), this._help$.complete(), this._navigate$.complete(), this._accept$.complete(), this._acceptFormulaName$.complete(), this._sequenceNodes = [];
56
56
  }
57
57
  search(e) {
58
- this._contextService.setContextValue(Is, e.visible), this._searching = e.visible, this._search$.next(e);
58
+ this._contextService.setContextValue(Ts, e.visible), this._searching = e.visible, this._search$.next(e);
59
59
  }
60
60
  isSearching() {
61
61
  return this._searching;
@@ -125,8 +125,8 @@ let Kt = class {
125
125
  const i = this._sequenceNodes[s];
126
126
  if (typeof i == "string")
127
127
  continue;
128
- const a = { ...i };
129
- a.startIndex += o, a.endIndex += o, this._sequenceNodes[s] = a;
128
+ const l = { ...i };
129
+ l.startIndex += o, l.endIndex += o, this._sequenceNodes[s] = l;
130
130
  }
131
131
  }
132
132
  /**
@@ -164,8 +164,8 @@ let Kt = class {
164
164
  const i = this._sequenceNodes[s];
165
165
  if (typeof i == "string")
166
166
  continue;
167
- const a = { ...i };
168
- a.startIndex += r, a.endIndex += r, this._sequenceNodes[s] = a;
167
+ const l = { ...i };
168
+ l.startIndex += r, l.endIndex += r, this._sequenceNodes[s] = l;
169
169
  }
170
170
  }
171
171
  enableLockedSelectionChange() {
@@ -187,97 +187,97 @@ let Kt = class {
187
187
  return this._isLockedOnSelectionInsertRefString;
188
188
  }
189
189
  };
190
- Kt = bs([
191
- Es(0, zt)
192
- ], Kt);
193
- const ys = {
190
+ tn = bs([
191
+ ys(0, on)
192
+ ], tn);
193
+ const xs = {
194
194
  id: "formula-ui.operation.help-function",
195
- type: ye.OPERATION,
196
- handler: async (e, t) => (e.get(ln).help(t), !0)
197
- }, an = {
195
+ type: Te.OPERATION,
196
+ handler: async (e, t) => (e.get(pn).help(t), !0)
197
+ }, fe = {
198
198
  id: "formula-ui.operation.insert-function",
199
- type: ye.OPERATION,
199
+ type: Te.OPERATION,
200
200
  // eslint-disable-next-line
201
201
  handler: async (e, t) => {
202
- var p, _;
203
- const n = e.get(en), o = e.get(Be), r = n.getCurrentSelections();
202
+ var S, _;
203
+ const n = e.get(un), o = e.get(qe), r = n.getCurrentSelections();
204
204
  if (!r || !r.length)
205
205
  return !1;
206
- const s = Jn(e.get(ee));
206
+ const s = ir(e.get(ee));
207
207
  if (!s) return !1;
208
- const { worksheet: c, unitId: i, subUnitId: a } = s, f = c.getCellMatrix(), { value: h } = t, m = e.get(ue);
209
- e.get(Qt);
208
+ const { worksheet: c, unitId: i, subUnitId: l } = s, f = c.getCellMatrix(), { value: h } = t, m = e.get(de);
209
+ e.get(an);
210
210
  const u = [], d = [];
211
- let l = null, v = 0, g = 0, S = "";
212
- if (r.length === 1 && (Os(r[0].range) || Ns(r[0].range) && kn(f, r[0].range))) {
213
- const { range: R, primary: C } = r[0], y = (p = C == null ? void 0 : C.actualRow) != null ? p : R.startRow, N = (_ = C == null ? void 0 : C.actualColumn) != null ? _ : R.startColumn;
214
- l = R, v = y, g = N;
215
- const k = An(f, y, N);
216
- k && (S = Se(k));
211
+ let a = null, v = 0, g = 0, p = "";
212
+ if (r.length === 1 && (Ms(r[0].range) || ws(r[0].range) && Wn(f, r[0].range))) {
213
+ const { range: R, primary: C } = r[0], y = (S = C == null ? void 0 : C.actualRow) != null ? S : R.startRow, N = (_ = C == null ? void 0 : C.actualColumn) != null ? _ : R.startColumn;
214
+ a = R, v = y, g = N;
215
+ const A = Vn(f, y, N);
216
+ A && (p = Se(A));
217
217
  } else
218
218
  r.some((R) => {
219
- var N, k;
219
+ var N, A;
220
220
  const { range: C, primary: y } = R;
221
- if (kn(f, C)) {
222
- const F = (N = y == null ? void 0 : y.actualRow) != null ? N : C.startRow, x = (k = y == null ? void 0 : y.actualColumn) != null ? k : C.startColumn, w = An(f, F, x);
221
+ if (Wn(f, C)) {
222
+ const F = (N = y == null ? void 0 : y.actualRow) != null ? N : C.startRow, x = (A = y == null ? void 0 : y.actualColumn) != null ? A : C.startColumn, w = Vn(f, F, x);
223
223
  if (!w)
224
- return l = C, v = F, g = x, !0;
225
- const M = Se(w), E = `=${h}(${M})`;
224
+ return a = C, v = F, g = x, !0;
225
+ const M = Se(w), I = `=${h}(${M})`;
226
226
  u.push({
227
227
  range: C,
228
228
  primary: {
229
229
  row: F,
230
230
  column: x
231
231
  },
232
- formula: E
232
+ formula: I
233
233
  });
234
234
  } else {
235
235
  const { startRow: F, startColumn: x, endRow: w, endColumn: M } = C;
236
236
  if (F === w) {
237
- const E = Ms(f, F, M, c.getColumnCount() - 1), b = E === M ? M - 1 : M, I = Se({
237
+ const I = ks(f, F, M, c.getColumnCount() - 1), E = I === M ? M - 1 : M, b = Se({
238
238
  startRow: F,
239
239
  endRow: w,
240
240
  startColumn: x,
241
- endColumn: b
242
- }), A = `=${h}(${I})`;
241
+ endColumn: E
242
+ }), k = `=${h}(${b})`;
243
243
  d.push({
244
244
  range: C,
245
245
  primary: {
246
246
  row: F,
247
- column: E
247
+ column: I
248
248
  },
249
- formula: A
249
+ formula: k
250
250
  });
251
251
  } else {
252
- let E = -1;
253
- for (let I = x; I <= M; I++) {
254
- const A = ws(f, I, w, c.getRowCount() - 1);
255
- E = Math.max(E, A);
252
+ let I = -1;
253
+ for (let b = x; b <= M; b++) {
254
+ const k = As(f, b, w, c.getRowCount() - 1);
255
+ I = Math.max(I, k);
256
256
  }
257
- const b = E === w ? w - 1 : w;
258
- for (let I = x; I <= M; I++) {
259
- const A = Se({
257
+ const E = I === w ? w - 1 : w;
258
+ for (let b = x; b <= M; b++) {
259
+ const k = Se({
260
260
  startRow: F,
261
- endRow: b,
262
- startColumn: I,
263
- endColumn: I
264
- }), D = `=${h}(${A})`;
261
+ endRow: E,
262
+ startColumn: b,
263
+ endColumn: b
264
+ }), L = `=${h}(${k})`;
265
265
  d.push({
266
266
  range: C,
267
267
  primary: {
268
- row: E,
269
- column: I
268
+ row: I,
269
+ column: b
270
270
  },
271
- formula: D
271
+ formula: L
272
272
  });
273
273
  }
274
274
  }
275
275
  }
276
276
  return !1;
277
277
  });
278
- if (l) {
279
- const R = Go(v, g, c), C = {
280
- range: Vn.clone(l),
278
+ if (a) {
279
+ const R = Xo(v, g, c), C = {
280
+ range: Gn.clone(a),
281
281
  primary: {
282
282
  startRow: R.startRow,
283
283
  startColumn: R.startColumn,
@@ -290,27 +290,27 @@ const ys = {
290
290
  }
291
291
  }, y = {
292
292
  unitId: i,
293
- subUnitId: a,
293
+ subUnitId: l,
294
294
  selections: [C]
295
295
  };
296
- await m.executeCommand(tn.id, y);
297
- const N = o.getEditor(Zt), k = o.getEditor(Wn);
298
- m.syncExecuteCommand(jn.id, {
296
+ await m.executeCommand(dn.id, y);
297
+ const N = o.getEditor(sn), A = o.getEditor(Zn);
298
+ m.syncExecuteCommand(Qn.id, {
299
299
  visible: !0,
300
300
  unitId: i,
301
- eventType: Te.Dblclick
301
+ eventType: xe.Dblclick
302
302
  });
303
- const F = `=${h}(${S}`;
304
- N == null || N.replaceText(F), k == null || k.replaceText(F, !1);
303
+ const F = `=${h}(${p}`;
304
+ N == null || N.replaceText(F), A == null || A.replaceText(F, !1);
305
305
  }
306
- return u.length === 0 && d.length === 0 ? !1 : m.executeCommand(ns.id, {
306
+ return u.length === 0 && d.length === 0 ? !1 : m.executeCommand(ss.id, {
307
307
  list: u,
308
308
  listOfRangeHasNumber: d
309
309
  });
310
310
  }
311
311
  };
312
- function An(e, t, n) {
313
- const o = Ts(e, t, n);
312
+ function Vn(e, t, n) {
313
+ const o = Os(e, t, n);
314
314
  if (o !== t)
315
315
  return {
316
316
  startRow: o,
@@ -318,7 +318,7 @@ function An(e, t, n) {
318
318
  startColumn: n,
319
319
  endColumn: n
320
320
  };
321
- const r = xs(e, t, n);
321
+ const r = Ns(e, t, n);
322
322
  return r !== n ? {
323
323
  startRow: t,
324
324
  endRow: t,
@@ -326,16 +326,16 @@ function An(e, t, n) {
326
326
  endColumn: n - 1
327
327
  } : null;
328
328
  }
329
- function Ts(e, t, n) {
329
+ function Os(e, t, n) {
330
330
  let o = !1;
331
331
  if (t === 0) return t;
332
332
  for (let r = t - 1; r >= 0; r--) {
333
333
  const s = e.getValue(r, n);
334
- if (ut(s) && !o) {
334
+ if (Ct(s) && !o) {
335
335
  if (r === 0) return 0;
336
336
  o = !0;
337
337
  } else {
338
- if (o && !ut(s))
338
+ if (o && !Ct(s))
339
339
  return r + 1;
340
340
  if (o && r === 0)
341
341
  return 0;
@@ -343,16 +343,16 @@ function Ts(e, t, n) {
343
343
  }
344
344
  return t;
345
345
  }
346
- function xs(e, t, n) {
346
+ function Ns(e, t, n) {
347
347
  let o = !1;
348
348
  if (n === 0) return n;
349
349
  for (let r = n - 1; r >= 0; r--) {
350
350
  const s = e.getValue(t, r);
351
- if (ut(s) && !o) {
351
+ if (Ct(s) && !o) {
352
352
  if (r === 0) return 0;
353
353
  o = !0;
354
354
  } else {
355
- if (o && !ut(s))
355
+ if (o && !Ct(s))
356
356
  return r + 1;
357
357
  if (o && r === 0)
358
358
  return 0;
@@ -360,57 +360,57 @@ function xs(e, t, n) {
360
360
  }
361
361
  return n;
362
362
  }
363
- function ut(e) {
363
+ function Ct(e) {
364
364
  if (e != null && e.p) {
365
365
  const t = e == null ? void 0 : e.p.body;
366
366
  if (t == null)
367
367
  return !1;
368
- const n = t.dataStream, r = n.substring(n.length - 2, n.length) === Hn ? n.substring(0, n.length - 2) : n;
369
- return Wr(r);
368
+ const n = t.dataStream, r = n.substring(n.length - 2, n.length) === zn ? n.substring(0, n.length - 2) : n;
369
+ return Br(r);
370
370
  }
371
- return e && (e.t === vn.NUMBER || Hr(e) === vn.NUMBER);
371
+ return e && (e.t === bn.NUMBER || jr(e) === bn.NUMBER);
372
372
  }
373
- function Os(e) {
373
+ function Ms(e) {
374
374
  return e.startRow === e.endRow && e.startColumn === e.endColumn;
375
375
  }
376
- function Ns(e) {
376
+ function ws(e) {
377
377
  return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
378
378
  }
379
- function kn(e, t) {
379
+ function Wn(e, t) {
380
380
  for (let n = t.startRow; n <= t.endRow; n++)
381
381
  for (let o = t.startColumn; o <= t.endColumn; o++)
382
- if (ut(e.getValue(n, o)))
382
+ if (Ct(e.getValue(n, o)))
383
383
  return !1;
384
384
  return !0;
385
385
  }
386
- function Ms(e, t, n, o) {
386
+ function ks(e, t, n, o) {
387
387
  for (let r = n; r <= o; r++)
388
388
  if (!e.getValue(t, r))
389
389
  return r;
390
390
  return o;
391
391
  }
392
- function ws(e, t, n, o) {
392
+ function As(e, t, n, o) {
393
393
  for (let r = n; r <= o; r++)
394
394
  if (!e.getValue(r, t))
395
395
  return r;
396
396
  return o;
397
397
  }
398
- const ur = "SHEET_FORMULA_UI_PLUGIN", dr = `${ur}_MORE_FUNCTIONS_COMPONENT`, un = {
398
+ const hr = "SHEET_FORMULA_UI_PLUGIN", fr = `${hr}_MORE_FUNCTIONS_COMPONENT`, vn = {
399
399
  id: "formula-ui.operation.more-functions",
400
- type: ye.OPERATION,
401
- handler: async (e) => (e.get(rn).open({
400
+ type: Te.OPERATION,
401
+ handler: async (e) => (e.get(fn).open({
402
402
  header: { title: "formula.insert.tooltip" },
403
- children: { label: dr }
403
+ children: { label: fr }
404
404
  }), !0)
405
- }, hr = {
405
+ }, gr = {
406
406
  id: "formula-ui.operation.change-ref-to-absolute",
407
- type: ye.OPERATION,
407
+ type: Te.OPERATION,
408
408
  handler: async (e) => !0
409
- }, As = {
409
+ }, Fs = {
410
410
  id: "formula-ui.operation.search-function",
411
- type: ye.OPERATION,
412
- handler: async (e, t) => (e.get(ln).search(t), !0)
413
- }, dn = (e, t, n = !0) => {
411
+ type: Te.OPERATION,
412
+ handler: async (e, t) => (e.get(pn).search(t), !0)
413
+ }, Sn = (e, t, n = !0) => {
414
414
  let o = -1;
415
415
  return e.reduce((r, s, c) => {
416
416
  if (r.isFinish)
@@ -419,12 +419,12 @@ const ur = "SHEET_FORMULA_UI_PLUGIN", dr = `${ur}_MORE_FUNCTIONS_COMPONENT`, un
419
419
  if (typeof s != "string")
420
420
  r.currentIndex += s.token.length;
421
421
  else {
422
- const a = s.length;
423
- r.currentIndex += a;
422
+ const l = s.length;
423
+ r.currentIndex += l;
424
424
  }
425
425
  return (n ? r.currentIndex === t : t > i && t <= r.currentIndex) && (o = c, r.isFinish = !0), r;
426
426
  }, { currentIndex: 0, isFinish: !1 }), o;
427
- }, fr = (e, t) => {
427
+ }, mr = (e, t) => {
428
428
  const n = e[t];
429
429
  let o = -1;
430
430
  if (!n || typeof n == "string" || n.nodeType !== z.REFERENCE) return -1;
@@ -434,32 +434,32 @@ const ur = "SHEET_FORMULA_UI_PLUGIN", dr = `${ur}_MORE_FUNCTIONS_COMPONENT`, un
434
434
  }
435
435
  return o;
436
436
  };
437
- var ae = function() {
438
- return ae = Object.assign || function(e) {
437
+ var ue = function() {
438
+ return ue = Object.assign || function(e) {
439
439
  for (var t, n = 1, o = arguments.length; n < o; n++) {
440
440
  t = arguments[n];
441
441
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
442
442
  }
443
443
  return e;
444
- }, ae.apply(this, arguments);
445
- }, ks = function(e, t) {
444
+ }, ue.apply(this, arguments);
445
+ }, Ds = function(e, t) {
446
446
  var n = {};
447
447
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
448
448
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
449
449
  for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
450
450
  t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]);
451
451
  return n;
452
- }, qe = Oe(function(e, t) {
453
- var n = e.icon, o = e.id, r = e.className, s = e.extend, c = ks(e, ["icon", "id", "className", "extend"]), i = "univerjs-icon univerjs-icon-".concat(o, " ").concat(r || "").trim(), a = Y("_".concat(Ls()));
454
- return gr(n, "".concat(o), { defIds: n.defIds, idSuffix: a.current }, ae({ ref: t, className: i }, c), s);
452
+ }, Qe = Ne(function(e, t) {
453
+ var n = e.icon, o = e.id, r = e.className, s = e.extend, c = Ds(e, ["icon", "id", "className", "extend"]), i = "univerjs-icon univerjs-icon-".concat(o, " ").concat(r || "").trim(), l = G("_".concat(Ps()));
454
+ return pr(n, "".concat(o), { defIds: n.defIds, idSuffix: l.current }, ue({ ref: t, className: i }, c), s);
455
455
  });
456
- function gr(e, t, n, o, r) {
457
- return je(e.tag, ae(ae({ key: t }, Fs(e, n, r)), o), (Ds(e, n).children || []).map(function(s, c) {
458
- return gr(s, "".concat(t, "-").concat(e.tag, "-").concat(c), n, void 0, r);
456
+ function pr(e, t, n, o, r) {
457
+ return Xe(e.tag, ue(ue({ key: t }, Ls(e, n, r)), o), ($s(e, n).children || []).map(function(s, c) {
458
+ return pr(s, "".concat(t, "-").concat(e.tag, "-").concat(c), n, void 0, r);
459
459
  }));
460
460
  }
461
- function Fs(e, t, n) {
462
- var o = ae({}, e.attrs);
461
+ function Ls(e, t, n) {
462
+ var o = ue({}, e.attrs);
463
463
  n != null && n.colorChannel1 && o.fill === "colorChannel1" && (o.fill = n.colorChannel1), e.tag === "mask" && o.id && (o.id = o.id + t.idSuffix), Object.entries(o).forEach(function(s) {
464
464
  var c = s[0], i = s[1];
465
465
  c === "mask" && typeof i == "string" && (o[c] = i.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
@@ -470,71 +470,71 @@ function Fs(e, t, n) {
470
470
  typeof i == "string" && (o[c] = i.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
471
471
  })), o;
472
472
  }
473
- function Ds(e, t) {
473
+ function $s(e, t) {
474
474
  var n, o = t.defIds;
475
- return !o || o.length === 0 ? e : e.tag === "defs" && (!((n = e.children) === null || n === void 0) && n.length) ? ae(ae({}, e), { children: e.children.map(function(r) {
476
- return typeof r.attrs.id == "string" && o && o.indexOf(r.attrs.id) > -1 ? ae(ae({}, r), { attrs: ae(ae({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
475
+ return !o || o.length === 0 ? e : e.tag === "defs" && (!((n = e.children) === null || n === void 0) && n.length) ? ue(ue({}, e), { children: e.children.map(function(r) {
476
+ return typeof r.attrs.id == "string" && o && o.includes(r.attrs.id) ? ue(ue({}, r), { attrs: ue(ue({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
477
477
  }) }) : e;
478
478
  }
479
- function Ls() {
479
+ function Ps() {
480
480
  return Math.random().toString(36).substring(2, 8);
481
481
  }
482
- qe.displayName = "UniverIcon";
483
- var Ps = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, mr = Oe(function(e, t) {
484
- return je(qe, Object.assign({}, e, {
485
- id: "check-mark-single",
482
+ Qe.displayName = "UniverIcon";
483
+ var Us = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, vr = Ne(function(e, t) {
484
+ return Xe(Qe, Object.assign({}, e, {
485
+ id: "check-mark-icon",
486
486
  ref: t,
487
- icon: Ps
487
+ icon: Us
488
488
  }));
489
489
  });
490
- mr.displayName = "CheckMarkSingle";
491
- var $s = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, Sr = Oe(function(e, t) {
492
- return je(qe, Object.assign({}, e, {
493
- id: "close-single",
490
+ vr.displayName = "CheckMarkIcon";
491
+ var Vs = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, Sr = Ne(function(e, t) {
492
+ return Xe(Qe, Object.assign({}, e, {
493
+ id: "close-icon",
494
494
  ref: t,
495
- icon: $s
495
+ icon: Vs
496
496
  }));
497
497
  });
498
- Sr.displayName = "CloseSingle";
499
- var Us = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, vr = Oe(function(e, t) {
500
- return je(qe, Object.assign({}, e, {
501
- id: "delete-single",
498
+ Sr.displayName = "CloseIcon";
499
+ var Ws = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Cr = Ne(function(e, t) {
500
+ return Xe(Qe, Object.assign({}, e, {
501
+ id: "delete-icon",
502
502
  ref: t,
503
- icon: Us
503
+ icon: Ws
504
504
  }));
505
505
  });
506
- vr.displayName = "DeleteSingle";
507
- var Vs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, pr = Oe(function(e, t) {
508
- return je(qe, Object.assign({}, e, {
509
- id: "increase-single",
506
+ Cr.displayName = "DeleteIcon";
507
+ var Hs = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, _r = Ne(function(e, t) {
508
+ return Xe(Qe, Object.assign({}, e, {
509
+ id: "increase-icon",
510
510
  ref: t,
511
- icon: Vs
511
+ icon: Hs
512
512
  }));
513
513
  });
514
- pr.displayName = "IncreaseSingle";
515
- var Ws = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.90913 3.57564C6.14345 3.34132 6.52335 3.34132 6.75766 3.57564L10.7577 7.57564C10.992 7.80995 10.992 8.18985 10.7577 8.42417L6.75766 12.4242C6.52335 12.6585 6.14345 12.6585 5.90913 12.4242C5.67482 12.1899 5.67482 11.81 5.90913 11.5756L9.48487 7.9999L5.90913 4.42417C5.67482 4.18985 5.67482 3.80995 5.90913 3.57564Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Cr = Oe(function(e, t) {
516
- return je(qe, Object.assign({}, e, {
517
- id: "more-single",
514
+ _r.displayName = "IncreaseIcon";
515
+ var Bs = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.90913 3.57564C6.14345 3.34132 6.52335 3.34132 6.75766 3.57564L10.7577 7.57564C10.992 7.80995 10.992 8.18985 10.7577 8.42417L6.75766 12.4242C6.52335 12.6585 6.14345 12.6585 5.90913 12.4242C5.67482 12.1899 5.67482 11.81 5.90913 11.5756L9.48487 7.9999L5.90913 4.42417C5.67482 4.18985 5.67482 3.80995 5.90913 3.57564Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Rr = Ne(function(e, t) {
516
+ return Xe(Qe, Object.assign({}, e, {
517
+ id: "more-icon",
518
518
  ref: t,
519
- icon: Ws
519
+ icon: Bs
520
520
  }));
521
521
  });
522
- Cr.displayName = "MoreSingle";
523
- var Hs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6185 12.4423C12.5907 12.2749 12.7773 12.15 12.9343 12.2308L15.4242 13.5126C15.6102 13.6084 15.5544 13.8745 15.3439 13.8955L14.2456 14.184L13.4521 15.1286C13.3495 15.2939 13.085 15.2463 13.0534 15.0568L12.6185 12.4423Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1 3.6C1 2.16406 2.16406 1 3.6 1H12.3C13.7359 1 14.9 2.16406 14.9 3.6V5.81156C14.9003 5.81881 14.9004 5.82609 14.9004 5.8334C14.9004 5.84071 14.9003 5.84799 14.9 5.85524V10.045C14.9003 10.0522 14.9004 10.0595 14.9004 10.0668C14.9004 10.3982 14.6318 10.6668 14.3004 10.6668H11.1668C10.8907 10.6668 10.6668 10.8907 10.6668 11.1668V14.3C10.6668 14.6314 10.3982 14.9 10.0668 14.9L10.05 14.8998L3.6 14.9C2.16406 14.9 1 13.7359 1 12.3V3.6ZM13.2 5.2334C13.4761 5.2334 13.7 5.00954 13.7 4.7334V3.6C13.7 2.8268 13.0732 2.2 12.3 2.2H11.1668C10.8907 2.2 10.6668 2.42386 10.6668 2.7V4.7334C10.6668 5.00954 10.8907 5.2334 11.1668 5.2334H13.2ZM10.6668 6.9334C10.6668 6.65726 10.8907 6.4334 11.1668 6.4334H13.2C13.4761 6.4334 13.7 6.65726 13.7 6.9334V8.9668C13.7 9.24294 13.4761 9.4668 13.2 9.4668H11.1668C10.8907 9.4668 10.6668 9.24294 10.6668 8.9668V6.9334ZM8.9668 5.2334C9.24294 5.2334 9.4668 5.00954 9.4668 4.7334V2.7C9.4668 2.42386 9.24294 2.2 8.9668 2.2H6.9334C6.65726 2.2 6.4334 2.42386 6.4334 2.7V4.7334C6.4334 5.00954 6.65726 5.2334 6.9334 5.2334L8.9668 5.2334ZM6.4334 6.9334C6.4334 6.65726 6.65726 6.4334 6.9334 6.4334L8.9668 6.4334C9.24294 6.4334 9.4668 6.65726 9.4668 6.9334V8.9668C9.4668 9.24294 9.24294 9.4668 8.9668 9.4668L6.9334 9.4668C6.65726 9.4668 6.4334 9.24294 6.4334 8.9668V6.9334ZM4.7334 5.2334C5.00954 5.2334 5.2334 5.00954 5.2334 4.7334V2.7C5.2334 2.42386 5.00954 2.2 4.7334 2.2H3.6C2.8268 2.2 2.2 2.8268 2.2 3.6V4.7334C2.2 5.00954 2.42386 5.2334 2.7 5.2334H4.7334ZM2.2 6.9334C2.2 6.65726 2.42386 6.4334 2.7 6.4334H4.7334C5.00954 6.4334 5.2334 6.65725 5.2334 6.9334V8.9668C5.2334 9.24294 5.00954 9.4668 4.7334 9.4668H2.7C2.42386 9.4668 2.2 9.24294 2.2 8.9668V6.9334ZM5.2334 11.1668C5.2334 10.8907 5.00954 10.6668 4.7334 10.6668H2.7C2.42386 10.6668 2.2 10.8907 2.2 11.1668V12.3C2.2 13.0732 2.8268 13.7 3.6 13.7H4.7334C5.00954 13.7 5.2334 13.4761 5.2334 13.2V11.1668ZM9.4668 11.1668C9.4668 10.8907 9.24294 10.6668 8.9668 10.6668H6.9334C6.65726 10.6668 6.4334 10.8907 6.4334 11.1668V13.2C6.4334 13.4761 6.65726 13.7 6.9334 13.7H8.9668C9.24294 13.7 9.4668 13.4761 9.4668 13.2V11.1668Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, _r = Oe(function(e, t) {
524
- return je(qe, Object.assign({}, e, {
525
- id: "select-range-single",
522
+ Rr.displayName = "MoreIcon";
523
+ var js = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6185 12.4423C12.5907 12.2749 12.7773 12.15 12.9343 12.2308L15.4242 13.5126C15.6102 13.6084 15.5544 13.8745 15.3439 13.8955L14.2456 14.184L13.4521 15.1286C13.3495 15.2939 13.085 15.2463 13.0534 15.0568L12.6185 12.4423Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1 3.6C1 2.16406 2.16406 1 3.6 1H12.3C13.7359 1 14.9 2.16406 14.9 3.6V5.81156C14.9003 5.81881 14.9004 5.82609 14.9004 5.8334C14.9004 5.84071 14.9003 5.84799 14.9 5.85524V10.045C14.9003 10.0522 14.9004 10.0595 14.9004 10.0668C14.9004 10.3982 14.6318 10.6668 14.3004 10.6668H11.1668C10.8907 10.6668 10.6668 10.8907 10.6668 11.1668V14.3C10.6668 14.6314 10.3982 14.9 10.0668 14.9L10.05 14.8998L3.6 14.9C2.16406 14.9 1 13.7359 1 12.3V3.6ZM13.2 5.2334C13.4761 5.2334 13.7 5.00954 13.7 4.7334V3.6C13.7 2.8268 13.0732 2.2 12.3 2.2H11.1668C10.8907 2.2 10.6668 2.42386 10.6668 2.7V4.7334C10.6668 5.00954 10.8907 5.2334 11.1668 5.2334H13.2ZM10.6668 6.9334C10.6668 6.65726 10.8907 6.4334 11.1668 6.4334H13.2C13.4761 6.4334 13.7 6.65726 13.7 6.9334V8.9668C13.7 9.24294 13.4761 9.4668 13.2 9.4668H11.1668C10.8907 9.4668 10.6668 9.24294 10.6668 8.9668V6.9334ZM8.9668 5.2334C9.24294 5.2334 9.4668 5.00954 9.4668 4.7334V2.7C9.4668 2.42386 9.24294 2.2 8.9668 2.2H6.9334C6.65726 2.2 6.4334 2.42386 6.4334 2.7V4.7334C6.4334 5.00954 6.65726 5.2334 6.9334 5.2334L8.9668 5.2334ZM6.4334 6.9334C6.4334 6.65726 6.65726 6.4334 6.9334 6.4334L8.9668 6.4334C9.24294 6.4334 9.4668 6.65726 9.4668 6.9334V8.9668C9.4668 9.24294 9.24294 9.4668 8.9668 9.4668L6.9334 9.4668C6.65726 9.4668 6.4334 9.24294 6.4334 8.9668V6.9334ZM4.7334 5.2334C5.00954 5.2334 5.2334 5.00954 5.2334 4.7334V2.7C5.2334 2.42386 5.00954 2.2 4.7334 2.2H3.6C2.8268 2.2 2.2 2.8268 2.2 3.6V4.7334C2.2 5.00954 2.42386 5.2334 2.7 5.2334H4.7334ZM2.2 6.9334C2.2 6.65726 2.42386 6.4334 2.7 6.4334H4.7334C5.00954 6.4334 5.2334 6.65725 5.2334 6.9334V8.9668C5.2334 9.24294 5.00954 9.4668 4.7334 9.4668H2.7C2.42386 9.4668 2.2 9.24294 2.2 8.9668V6.9334ZM5.2334 11.1668C5.2334 10.8907 5.00954 10.6668 4.7334 10.6668H2.7C2.42386 10.6668 2.2 10.8907 2.2 11.1668V12.3C2.2 13.0732 2.8268 13.7 3.6 13.7H4.7334C5.00954 13.7 5.2334 13.4761 5.2334 13.2V11.1668ZM9.4668 11.1668C9.4668 10.8907 9.24294 10.6668 8.9668 10.6668H6.9334C6.65726 10.6668 6.4334 10.8907 6.4334 11.1668V13.2C6.4334 13.4761 6.65726 13.7 6.9334 13.7H8.9668C9.24294 13.7 9.4668 13.4761 9.4668 13.2V11.1668Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Er = Ne(function(e, t) {
524
+ return Xe(Qe, Object.assign({}, e, {
525
+ id: "select-range-icon",
526
526
  ref: t,
527
- icon: Hs
527
+ icon: js
528
528
  }));
529
529
  });
530
- _r.displayName = "SelectRangeSingle";
531
- function Bs(e, t) {
530
+ Er.displayName = "SelectRangeIcon";
531
+ function qs(e, t) {
532
532
  return Object.keys(e).filter((n) => isNaN(Number(n)) && n !== "DefinedName").map((n) => ({
533
533
  label: t.t(`formula.functionType.${n.toLocaleLowerCase()}`),
534
534
  value: `${e[n]}`
535
535
  }));
536
536
  }
537
- function Rr(e) {
537
+ function Ir(e) {
538
538
  if (!e.require && !e.repeat)
539
539
  return `[${e.name}]`;
540
540
  if (e.require && !e.repeat)
@@ -544,8 +544,8 @@ function Rr(e) {
544
544
  if (e.require && e.repeat)
545
545
  return `${e.name},...`;
546
546
  }
547
- const js = (e, t = 100) => {
548
- P(() => {
547
+ const Ks = (e, t = 100) => {
548
+ $(() => {
549
549
  let n = null;
550
550
  const o = () => {
551
551
  n === null && (n = window.setTimeout(() => {
@@ -558,84 +558,84 @@ const js = (e, t = 100) => {
558
558
  }, [e, t]);
559
559
  };
560
560
  function br(e, t, n) {
561
- const o = T(Be), r = oe(() => new Zn({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = T(rn), c = T(ee), i = Q(() => {
561
+ const o = T(qe), r = se(() => new rr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = T(fn), c = T(ee), i = J(() => {
562
562
  var _;
563
- const a = o.getEditor(e);
564
- if (!a)
563
+ const l = o.getEditor(e);
564
+ if (!l)
565
565
  return;
566
- const f = a.getBoundingClientRect(), { marginTop: h = 0, marginBottom: m = 0 } = a.getDocumentData().documentStyle, u = a.getSkeleton();
566
+ const f = l.getBoundingClientRect(), { marginTop: h = 0, marginBottom: m = 0 } = l.getDocumentData().documentStyle, u = l.getSkeleton();
567
567
  if (!u) return;
568
568
  const d = (_ = u.getSkeletonData()) == null ? void 0 : _.pages[0].height;
569
- let { left: l, top: v, right: g, bottom: S } = f;
570
- v = v + h, S = d ? v + d : S - m;
571
- const p = r.getValue();
572
- if (!(p.left === l && p.top === v && p.right === g && p.bottom === S))
573
- return r.next({ left: l - 1, right: g + 1, top: v - 1, bottom: S + 1 }), f;
569
+ let { left: a, top: v, right: g, bottom: p } = f;
570
+ v = v + h, p = d ? v + d : p - m;
571
+ const S = r.getValue();
572
+ if (!(S.left === a && S.top === v && S.right === g && S.bottom === p))
573
+ return r.next({ left: a - 1, right: g + 1, top: v - 1, bottom: p + 1 }), f;
574
574
  });
575
- return P(() => {
575
+ return $(() => {
576
576
  t && i();
577
- }, [e, o, c.unitAdded$, i, t, ...n != null ? n : []]), js(i), P(() => {
578
- const a = s.scrollEvent$.pipe(Lo(100)).subscribe(i);
577
+ }, [e, o, c.unitAdded$, i, t, ...n != null ? n : []]), Ks(i), $(() => {
578
+ const l = s.scrollEvent$.pipe(Uo(100)).subscribe(i);
579
579
  return () => {
580
- a.unsubscribe();
580
+ l.unsubscribe();
581
581
  };
582
582
  }, []), [r, i];
583
583
  }
584
- const Ke = (e) => {
585
- const t = Y(e);
584
+ const Je = (e) => {
585
+ const t = G(e);
586
586
  return t.current = e, t;
587
- }, qs = (e, t, n) => {
588
- const o = T(Ft), r = T(Ce), [s, c] = U(), [i, a] = U(-1), [f, h] = U(!0), m = Ke(f), u = Y(t);
587
+ }, Ys = (e, t, n) => {
588
+ const o = T(Bt), r = T(_e), [s, c] = V(), [i, l] = V(-1), [f, h] = V(!0), m = Je(f), u = G(t);
589
589
  u.current = t;
590
590
  const d = () => {
591
- c(void 0), a(-1), h(!1);
591
+ c(void 0), l(-1), h(!1);
592
592
  };
593
- return P(() => {
593
+ return $(() => {
594
594
  if (n && e) {
595
- const l = n.selectionChange$.pipe(Jt(50)).subscribe((g) => {
595
+ const a = n.selectionChange$.pipe(ln(50)).subscribe((g) => {
596
596
  if (g.textRanges.length === 1) {
597
- const [S] = g.textRanges;
598
- if (S.collapsed && m.current) {
599
- const p = r.getFunctionAndParameter(`${u.current}A`, S.startOffset - 1);
600
- if (p) {
601
- const { functionName: _, paramIndex: R } = p, C = o.getFunctionInfo(_);
602
- c(C), a(R);
597
+ const [p] = g.textRanges;
598
+ if (p.collapsed && m.current) {
599
+ const S = r.getFunctionAndParameter(`${u.current}A`, p.startOffset - 1);
600
+ if (S) {
601
+ const { functionName: _, paramIndex: R } = S, C = o.getFunctionInfo(_);
602
+ c(C), l(R);
603
603
  return;
604
604
  }
605
605
  }
606
606
  }
607
- c(void 0), a(-1);
607
+ c(void 0), l(-1);
608
608
  }), v = n.selectionChange$.pipe(
609
- jt((g) => g.isEditing),
610
- jt((g) => g.textRanges.length === 1),
611
- Xn((g) => g.textRanges[0].startOffset),
612
- Po()
609
+ Jt((g) => g.isEditing),
610
+ Jt((g) => g.textRanges.length === 1),
611
+ or((g) => g.textRanges[0].startOffset),
612
+ Vo()
613
613
  ).subscribe(() => {
614
614
  h(!0);
615
615
  });
616
616
  return () => {
617
- l.unsubscribe(), v.unsubscribe();
617
+ a.unsubscribe(), v.unsubscribe();
618
618
  };
619
619
  }
620
- }, [n, e]), P(() => {
620
+ }, [n, e]), $(() => {
621
621
  e || d();
622
622
  }, [e]), {
623
623
  functionInfo: s,
624
624
  paramIndex: i,
625
625
  reset: d
626
626
  };
627
- }, Ks = ({ onClick: e }) => /* @__PURE__ */ O(
627
+ }, Gs = ({ onClick: e }) => /* @__PURE__ */ O(
628
628
  "div",
629
629
  {
630
630
  className: "univer-z-[15] univer-box-border univer-h-[18px] univer-cursor-pointer univer-overflow-visible univer-whitespace-nowrap univer-rounded-l univer-border univer-border-r-0 univer-border-gray-600 univer-bg-primary-600 univer-p-0.5 univer-text-xs univer-font-bold univer-leading-[13px] univer-text-white",
631
631
  onClick: e,
632
632
  children: "?"
633
633
  }
634
- ), Wt = ({ className: e, title: t, value: n }) => /* @__PURE__ */ V("div", { className: "univer-my-2", children: [
634
+ ), zt = ({ className: e, title: t, value: n }) => /* @__PURE__ */ W("div", { className: "univer-my-2", children: [
635
635
  /* @__PURE__ */ O(
636
636
  "div",
637
637
  {
638
- className: pe("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:univer-text-white", e),
638
+ className: ne("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
639
639
  children: t
640
640
  }
641
641
  ),
@@ -646,50 +646,50 @@ const Ke = (e) => {
646
646
  children: n
647
647
  }
648
648
  )
649
- ] }), Ys = (e) => {
649
+ ] }), Zs = (e) => {
650
650
  const { prefix: t, value: n, active: o, onClick: r } = e;
651
- return /* @__PURE__ */ V("div", { children: [
652
- /* @__PURE__ */ V("span", { children: [
651
+ return /* @__PURE__ */ W("div", { children: [
652
+ /* @__PURE__ */ W("span", { children: [
653
653
  t,
654
654
  "("
655
655
  ] }),
656
- n && n.map((s, c) => /* @__PURE__ */ V("span", { children: [
656
+ n && n.map((s, c) => /* @__PURE__ */ W("span", { children: [
657
657
  /* @__PURE__ */ O(
658
658
  "span",
659
659
  {
660
660
  className: o === c ? "univer-text-primary-500" : "",
661
661
  onClick: () => r(c),
662
- children: Rr(s)
662
+ children: Ir(s)
663
663
  }
664
664
  ),
665
665
  c === n.length - 1 ? "" : ","
666
666
  ] }, s.name)),
667
667
  ")"
668
668
  ] });
669
- }, Fn = () => {
669
+ }, Hn = () => {
670
670
  };
671
- function Gs(e) {
672
- const { onParamsSwitch: t = Fn, onClose: n = Fn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: c, paramIndex: i, reset: a } = qs(o, s, r), f = oe(() => !!c && i >= 0, [c, i]), h = T(Qt), m = !ve(h.helpFunctionVisible$), [u, d] = U(!0), l = T(tt), v = l.t("formula.prompt.required"), g = l.t("formula.prompt.optional"), S = r.getEditorId(), [p] = br(S, f, [c, i]);
671
+ function zs(e) {
672
+ const { onParamsSwitch: t = Hn, onClose: n = Hn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: c, paramIndex: i, reset: l } = Ys(o, s, r), f = se(() => !!c && i >= 0, [c, i]), h = T(an), m = !Ce(h.helpFunctionVisible$), [u, d] = V(!0), a = T(lt), v = a.t("formula.prompt.required"), g = a.t("formula.prompt.optional"), p = r.getEditorId(), [S] = br(p, f, [c, i]);
673
673
  function _(y) {
674
674
  t && t(y);
675
675
  }
676
- const R = Q((y) => {
676
+ const R = J((y) => {
677
677
  h.helpFunctionVisible$.next(!y);
678
678
  }), C = () => {
679
679
  R(!0), n();
680
680
  };
681
- return f && c ? m ? /* @__PURE__ */ O(qt, { portal: !0, anchorRect$: p, direction: "left-center", children: /* @__PURE__ */ O(Ks, { onClick: () => R(!1) }) }, "hidden") : /* @__PURE__ */ O(qt, { portal: !0, onClickOutside: () => a(), anchorRect$: p, direction: "vertical", children: /* @__PURE__ */ V(
681
+ return f && c ? m ? /* @__PURE__ */ O(en, { portal: !0, anchorRect$: S, direction: "left-center", children: /* @__PURE__ */ O(Gs, { onClick: () => R(!1) }) }, "hidden") : /* @__PURE__ */ O(en, { portal: !0, onClickOutside: () => l(), anchorRect$: S, direction: "vertical", children: /* @__PURE__ */ W(
682
682
  "div",
683
683
  {
684
- className: pe("univer-m-0 univer-box-border univer-w-[250px] univer-select-none univer-list-none univer-rounded-lg univer-bg-white univer-leading-5 univer-shadow-md univer-outline-none", sn),
684
+ className: ne("univer-m-0 univer-box-border univer-w-[250px] univer-select-none univer-list-none univer-rounded-lg univer-bg-white univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", gn),
685
685
  children: [
686
- /* @__PURE__ */ V(
686
+ /* @__PURE__ */ W(
687
687
  "div",
688
688
  {
689
- className: pe("univer-box-border univer-flex univer-items-center univer-justify-between univer-px-4 univer-py-3 univer-text-xs univer-font-medium univer-text-gray-900 univer-wrap-anywhere dark:univer-text-white", gs),
689
+ className: ne("univer-box-border univer-flex univer-items-center univer-justify-between univer-px-4 univer-py-3 univer-text-xs univer-font-medium univer-text-gray-900 univer-wrap-anywhere dark:!univer-text-white", ps),
690
690
  children: [
691
691
  /* @__PURE__ */ O(
692
- Ys,
692
+ Zs,
693
693
  {
694
694
  prefix: c.functionName,
695
695
  value: c.functionParameter,
@@ -697,20 +697,20 @@ function Gs(e) {
697
697
  onClick: _
698
698
  }
699
699
  ),
700
- /* @__PURE__ */ V("div", { className: "univer-flex", children: [
700
+ /* @__PURE__ */ W("div", { className: "univer-flex", children: [
701
701
  /* @__PURE__ */ O(
702
702
  "div",
703
703
  {
704
- className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-500 univer-outline-none univer-transition-colors hover:univer-bg-gray-200",
704
+ className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-500 univer-outline-none univer-transition-colors dark:hover:!univer-bg-gray-600 hover:univer-bg-gray-200",
705
705
  style: { transform: u ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
706
706
  onClick: () => d(!u),
707
- children: /* @__PURE__ */ O(Cr, {})
707
+ children: /* @__PURE__ */ O(Rr, {})
708
708
  }
709
709
  ),
710
710
  /* @__PURE__ */ O(
711
711
  "div",
712
712
  {
713
- className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-600 univer-outline-none univer-transition-colors dark:univer-text-gray-200 hover:univer-bg-gray-300",
713
+ className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-600 univer-outline-none univer-transition-colors dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-600 hover:univer-bg-gray-300",
714
714
  onClick: C,
715
715
  children: /* @__PURE__ */ O(Sr, {})
716
716
  }
@@ -722,28 +722,28 @@ function Gs(e) {
722
722
  /* @__PURE__ */ O(
723
723
  "div",
724
724
  {
725
- className: "univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0",
725
+ className: ne("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", at),
726
726
  style: {
727
727
  height: u ? "unset" : 0,
728
728
  padding: u ? "revert-layer" : 0
729
729
  },
730
- children: /* @__PURE__ */ V("div", { className: "univer-mt-3", children: [
730
+ children: /* @__PURE__ */ W("div", { className: "univer-mt-3", children: [
731
731
  /* @__PURE__ */ O(
732
- Wt,
732
+ zt,
733
733
  {
734
- title: l.t("formula.prompt.helpExample"),
734
+ title: a.t("formula.prompt.helpExample"),
735
735
  value: `${c.functionName}(${c.functionParameter.map((y) => y.example).join(",")})`
736
736
  }
737
737
  ),
738
738
  /* @__PURE__ */ O(
739
- Wt,
739
+ zt,
740
740
  {
741
- title: l.t("formula.prompt.helpAbstract"),
741
+ title: a.t("formula.prompt.helpAbstract"),
742
742
  value: c.description
743
743
  }
744
744
  ),
745
745
  c && c.functionParameter && c.functionParameter.map((y, N) => /* @__PURE__ */ O(
746
- Wt,
746
+ zt,
747
747
  {
748
748
  className: i === N ? "univer-text-primary-500" : "",
749
749
  title: y.name,
@@ -758,30 +758,30 @@ function Gs(e) {
758
758
  }
759
759
  ) }, "show") : null;
760
760
  }
761
- const zs = (e) => {
762
- const t = T(Be);
763
- return Q((o) => {
761
+ const Xs = (e) => {
762
+ const t = T(qe);
763
+ return J((o) => {
764
764
  var r, s;
765
765
  if (e) {
766
766
  t.focus(e.getEditorId());
767
767
  const c = [...e.getSelectionRanges()];
768
- if (Je.isDefine(o))
768
+ if (it.isDefine(o))
769
769
  e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
770
770
  else if (!c.length && !e.docSelectionRenderService.isOnPointerEvent) {
771
771
  const i = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
772
- `, a = Math.max(i.length - 2, 0);
773
- e.setSelectionRanges([{ startOffset: a, endOffset: a }]);
772
+ `, l = Math.max(i.length - 2, 0);
773
+ e.setSelectionRanges([{ startOffset: l, endOffset: l }]);
774
774
  } else
775
775
  e.setSelectionRanges(c);
776
776
  }
777
777
  });
778
778
  };
779
- var Zs = Object.getOwnPropertyDescriptor, Xs = (e, t, n, o) => {
780
- for (var r = o > 1 ? void 0 : o ? Zs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
779
+ var Qs = Object.getOwnPropertyDescriptor, Js = (e, t, n, o) => {
780
+ for (var r = o > 1 ? void 0 : o ? Qs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
781
781
  (c = e[s]) && (r = c(r) || r);
782
782
  return r;
783
- }, Ze = (e, t) => (n, o) => t(n, o, e);
784
- let Fe = class extends co {
783
+ }, rt = (e, t) => (n, o) => t(n, o, e);
784
+ let De = class extends lo {
785
785
  constructor(t, n, o, r, s, c, i) {
786
786
  super(
787
787
  n,
@@ -792,7 +792,7 @@ let Fe = class extends co {
792
792
  );
793
793
  j(this, "_workbookSelections");
794
794
  j(this, "_eventDisposables");
795
- this._context = t, this._contextService = c, this._refSelectionsService = i, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(Qs(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
795
+ this._context = t, this._contextService = c, this._refSelectionsService = i, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(ei(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
796
796
  }
797
797
  getLocation() {
798
798
  return this._skeleton.getLocation();
@@ -816,7 +816,7 @@ let Fe = class extends co {
816
816
  * Call this method and user will be able to select on the canvas to update selections.
817
817
  */
818
818
  enableSelectionChanging() {
819
- return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), Bn(() => this._disableSelectionChanging());
819
+ return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), Xn(() => this._disableSelectionChanging());
820
820
  }
821
821
  _disableSelectionChanging() {
822
822
  var t;
@@ -826,27 +826,27 @@ let Fe = class extends co {
826
826
  this._disableSelectionChanging();
827
827
  }
828
828
  _initCanvasEventListeners() {
829
- const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: c } = this._context, i = new We();
830
- return i.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, f) => {
831
- this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, me.NORMAL, this._getActiveViewport(a)), a.button !== 2 && f.stopPropagation());
829
+ const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: c } = this._context, i = new He();
830
+ return i.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((l, f) => {
831
+ this.inRefSelectionMode() && (this._onPointerDown(l, r.zIndex + 1, ve.NORMAL, this._getActiveViewport(l)), l.button !== 2 && f.stopPropagation());
832
832
  })), i.add(
833
- n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, f) => {
833
+ n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, f) => {
834
834
  if (!this.inRefSelectionMode()) return;
835
- const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Cn(a.offsetX, a.offsetY, c, h);
836
- _n(this._workbookSelections.getCurrentSelections(), m, me.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, me.ROW, this._getActiveViewport(a), Ut.Y), a.button !== 2 && f.stopPropagation());
835
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Tn(l.offsetX, l.offsetY, c, h);
836
+ xn(this._workbookSelections.getCurrentSelections(), m, ve.ROW) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.ROW, this._getActiveViewport(l), Gt.Y), l.button !== 2 && f.stopPropagation());
837
837
  })
838
- ), i.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, f) => {
838
+ ), i.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, f) => {
839
839
  if (!this.inRefSelectionMode()) return;
840
- const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Cn(a.offsetX, a.offsetY, c, h);
841
- _n(this._workbookSelections.getCurrentSelections(), m, me.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, me.COLUMN, this._getActiveViewport(a), Ut.X), a.button !== 2 && f.stopPropagation());
842
- })), i.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, f) => {
840
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Tn(l.offsetX, l.offsetY, c, h);
841
+ xn(this._workbookSelections.getCurrentSelections(), m, ve.COLUMN) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.COLUMN, this._getActiveViewport(l), Gt.X), l.button !== 2 && f.stopPropagation());
842
+ })), i.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, f) => {
843
843
  if (this._reset(), !this.inRefSelectionMode()) return;
844
- const h = this._sheetSkeletonManagerService.getCurrent().skeleton, m = lo(h);
844
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, m = uo(h);
845
845
  this._addSelectionControlByModelData(m), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
846
846
  const u = c.onPointerUp$.subscribeEvent(() => {
847
847
  u.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
848
848
  });
849
- a.button !== 2 && f.stopPropagation();
849
+ l.button !== 2 && f.stopPropagation();
850
850
  })), i;
851
851
  }
852
852
  /**
@@ -856,7 +856,7 @@ let Fe = class extends co {
856
856
  */
857
857
  _addSelectionControlByModelData(t) {
858
858
  var c;
859
- const n = this._skeleton, o = (c = t.style) != null ? c : qn(this._themeService), r = this._scene;
859
+ const n = this._skeleton, o = (c = t.style) != null ? c : Jn(this._themeService), r = this._scene;
860
860
  return t.style = o, this.newSelectionControl(r, n, t);
861
861
  }
862
862
  _initSelectionChangeListener() {
@@ -869,18 +869,18 @@ let Fe = class extends co {
869
869
  */
870
870
  _initUserActionSyncListener() {
871
871
  this.disposeWithMe(this.selectionMoveStart$.subscribe((t) => {
872
- this._updateSelections(t, Vt.MOVE_START);
872
+ this._updateSelections(t, Zt.MOVE_START);
873
873
  })), this.disposeWithMe(this.selectionMoving$.subscribe((t) => {
874
- this._updateSelections(t, Vt.MOVING);
874
+ this._updateSelections(t, Zt.MOVING);
875
875
  })), this.disposeWithMe(this.selectionMoveEnd$.subscribe((t) => {
876
- this._updateSelections(t, Vt.MOVE_END);
876
+ this._updateSelections(t, Zt.MOVE_END);
877
877
  }));
878
878
  }
879
879
  _updateSelections(t, n) {
880
880
  const r = this._context.unit.getActiveSheet().getSheetId();
881
881
  t.length !== 0 && this._workbookSelections.setSelections(
882
882
  r,
883
- t.map((s) => zo(s)),
883
+ t.map((s) => Qo(s)),
884
884
  n
885
885
  );
886
886
  }
@@ -888,7 +888,7 @@ let Fe = class extends co {
888
888
  this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((t) => {
889
889
  if (!t)
890
890
  return;
891
- const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(xn.VIEW_MAIN);
891
+ const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Fn.VIEW_MAIN);
892
892
  this._skeleton && this._skeleton.worksheet.getSheetId() !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
893
893
  const s = this._workbookSelections.getCurrentSelections();
894
894
  this.resetSelectionsByModelData(s);
@@ -896,10 +896,10 @@ let Fe = class extends co {
896
896
  }
897
897
  _getActiveViewport(t) {
898
898
  const n = this._getSheetObject();
899
- return n == null ? void 0 : n.scene.getActiveViewportByCoord(On.FromArray([t.offsetX, t.offsetY]));
899
+ return n == null ? void 0 : n.scene.getActiveViewportByCoord(Dn.FromArray([t.offsetX, t.offsetY]));
900
900
  }
901
901
  _getSheetObject() {
902
- return ao(this._context.unit, this._context);
902
+ return ho(this._context.unit, this._context);
903
903
  }
904
904
  /**
905
905
  * Handle pointer down event, bind pointermove & pointerup handler.
@@ -912,40 +912,40 @@ let Fe = class extends co {
912
912
  * @param scrollTimerType
913
913
  */
914
914
  // eslint-disable-next-line complexity, max-lines-per-function
915
- _onPointerDown(t, n = 0, o = me.NORMAL, r, s = Ut.ALL) {
915
+ _onPointerDown(t, n = 0, o = ve.NORMAL, r, s = Gt.ALL) {
916
916
  var x;
917
917
  this._rangeType = o;
918
918
  const c = this._skeleton, i = this._scene;
919
919
  if (!i || !c)
920
920
  return;
921
921
  r && (this._activeViewport = r);
922
- const { offsetX: a, offsetY: f } = t, h = i.getViewport(xn.VIEW_MAIN);
922
+ const { offsetX: l, offsetY: f } = t, h = i.getViewport(Fn.VIEW_MAIN);
923
923
  if (!h) return;
924
- const m = i.getCoordRelativeToViewport(On.FromArray([a, f])), { x: u, y: d } = m;
924
+ const m = i.getCoordRelativeToViewport(Dn.FromArray([l, f])), { x: u, y: d } = m;
925
925
  this._startViewportPosX = u, this._startViewportPosY = d;
926
- const l = i.getScrollXYInfoByViewport(m), { scaleX: v, scaleY: g } = i.getAncestorScale(), S = this._skeleton.getCellByOffset(u, d, v, g, l);
927
- if (!S) return;
926
+ const a = i.getScrollXYInfoByViewport(m), { scaleX: v, scaleY: g } = i.getAncestorScale(), p = this._skeleton.getCellByOffset(u, d, v, g, a);
927
+ if (!p) return;
928
928
  switch (o) {
929
- case me.NORMAL:
929
+ case ve.NORMAL:
930
930
  break;
931
- case me.ROW:
932
- S.startColumn = 0, S.endColumn = this._skeleton.getColumnCount() - 1;
931
+ case ve.ROW:
932
+ p.startColumn = 0, p.endColumn = this._skeleton.getColumnCount() - 1;
933
933
  break;
934
- case me.COLUMN:
935
- S.startRow = 0, S.endRow = this._skeleton.getRowCount() - 1;
934
+ case ve.COLUMN:
935
+ p.startRow = 0, p.endRow = this._skeleton.getRowCount() - 1;
936
936
  break;
937
- case me.ALL:
938
- S.startRow = 0, S.startColumn = 0, S.endRow = this._skeleton.getRowCount() - 1, S.endColumn = this._skeleton.getColumnCount() - 1;
937
+ case ve.ALL:
938
+ p.startRow = 0, p.startColumn = 0, p.endRow = this._skeleton.getRowCount() - 1, p.endColumn = this._skeleton.getColumnCount() - 1;
939
939
  }
940
- const p = { range: S, primary: S, style: null };
941
- p.range.rangeType = o;
942
- const _ = Bt(p, this._skeleton);
940
+ const S = { range: p, primary: p, style: null };
941
+ S.range.rangeType = o;
942
+ const _ = Qt(S, this._skeleton);
943
943
  this._startRangeWhenPointerDown = { ..._.rangeWithCoord };
944
944
  const R = { ..._.rangeWithCoord, rangeType: o };
945
945
  let C = this.getActiveSelectionControl();
946
946
  const y = this.getSelectionControls();
947
947
  for (const w of y) {
948
- if (t.button === 2 && Vn.contains(w.model, R)) {
948
+ if (t.button === 2 && Gn.contains(w.model, R)) {
949
949
  C = w;
950
950
  return;
951
951
  }
@@ -955,15 +955,15 @@ let Fe = class extends co {
955
955
  }
956
956
  }
957
957
  this._checkClearPreviousControls(t);
958
- const N = C == null ? void 0 : C.model.currentCell, k = t.shiftKey && N, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
959
- k && N ? this._makeSelectionByTwoCells(
958
+ const N = C == null ? void 0 : C.model.currentCell, A = t.shiftKey && N, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
959
+ A && N ? this._makeSelectionByTwoCells(
960
960
  N,
961
961
  R,
962
962
  c,
963
963
  o,
964
964
  C
965
965
  // Get updated in this method
966
- ) : F && C ? C.updateRangeBySelectionWithCoord(_) : C = this.newSelectionControl(i, c, p);
966
+ ) : F && C ? C.updateRangeBySelectionWithCoord(_) : C = this.newSelectionControl(i, c, S);
967
967
  for (let w = 0; w < this.getSelectionControls().length - 1; w++)
968
968
  this.getSelectionControls()[w].clearHighlight();
969
969
  this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), i.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (x = i.getTransformer()) == null || x.clearSelectedObjects(), this._setupPointerMoveListener(h, C, o, s, u, d), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = i.onPointerUp$.subscribeEvent(() => {
@@ -979,13 +979,13 @@ let Fe = class extends co {
979
979
  * @returns {SelectionControl} selectionControl just created
980
980
  */
981
981
  newSelectionControl(t, n, o) {
982
- const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: c } = n, i = new Kn(t, r, this._themeService, {
982
+ const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: c } = n, i = new er(t, r, this._themeService, {
983
983
  highlightHeader: this._highlightHeader,
984
984
  enableAutoFill: !1,
985
985
  rowHeaderWidth: s,
986
986
  columnHeaderHeight: c
987
- }), a = Bt(o, n);
988
- return i.updateRangeBySelectionWithCoord(a), this._selectionControls.push(i), i.setControlExtension({
987
+ }), l = Qt(o, n);
988
+ return i.updateRangeBySelectionWithCoord(l), this._selectionControls.push(i), i.setControlExtension({
989
989
  skeleton: n,
990
990
  scene: t,
991
991
  themeService: this._themeService,
@@ -998,51 +998,51 @@ let Fe = class extends co {
998
998
  }), i;
999
999
  }
1000
1000
  };
1001
- Fe = Xs([
1002
- Ze(1, B(dt)),
1003
- Ze(2, B(ht)),
1004
- Ze(3, Dt),
1005
- Ze(4, B(At)),
1006
- Ze(5, zt),
1007
- Ze(6, kt)
1008
- ], Fe);
1009
- function Qs(e) {
1010
- const t = qn(e);
1001
+ De = Js([
1002
+ rt(1, B(_t)),
1003
+ rt(2, B(Rt)),
1004
+ rt(3, jt),
1005
+ rt(4, B(Wt)),
1006
+ rt(5, on),
1007
+ rt(6, Ht)
1008
+ ], De);
1009
+ function ei(e) {
1010
+ const t = Jn(e);
1011
1011
  return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
1012
1012
  }
1013
- function Js(e) {
1013
+ function ti(e) {
1014
1014
  var r, s;
1015
1015
  const n = e.get(ee).getCurrentUniverDocInstance();
1016
1016
  return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
1017
1017
  }
1018
1018
  var Ae = /* @__PURE__ */ ((e) => (e[e.NOT_SELECT = 0] = "NOT_SELECT", e[e.NEED_ADD = 1] = "NEED_ADD", e[e.CAN_EDIT = 2] = "CAN_EDIT", e[e.EDIT_OTHER_SHEET_REFERENCE = 3] = "EDIT_OTHER_SHEET_REFERENCE", e))(Ae || {});
1019
- function ei(e) {
1019
+ function ni(e) {
1020
1020
  var N;
1021
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, c = T(xe), i = T(ee), a = c.getRenderById(r), f = c.getRenderById(t), h = f == null ? void 0 : f.with(Qn), m = T(ar), u = T(dt), [d, l] = U(
1021
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, c = T(Oe), i = T(ee), l = c.getRenderById(r), f = c.getRenderById(t), h = f == null ? void 0 : f.with(sr), m = T(dr), u = T(_t), [d, a] = V(
1022
1022
  0
1023
1023
  /* NOT_SELECT */
1024
- ), v = T(Ce), g = Y(!0), S = a == null ? void 0 : a.with(Fe), p = Ke(d), _ = i.getUnit(r, J.UNIVER_SHEET), R = _ == null ? void 0 : _.getSheetBySheetId(s), C = Q((k) => {
1025
- S && S.setSkipLastEnabled(
1026
- k === 1 || k === 3
1024
+ ), v = T(_e), g = G(!0), p = l == null ? void 0 : l.with(De), S = Je(d), _ = i.getUnit(r, q.UNIVER_SHEET), R = _ == null ? void 0 : _.getSheetBySheetId(s), C = J((A) => {
1025
+ p && p.setSkipLastEnabled(
1026
+ A === 1 || A === 3
1027
1027
  /* EDIT_OTHER_SHEET_REFERENCE */
1028
- ), p.current = k, l(k);
1029
- }), y = Q(() => {
1030
- var H, se;
1028
+ ), S.current = A, a(A);
1029
+ }), y = J(() => {
1030
+ var H, ie;
1031
1031
  if (!_) return;
1032
- const k = _.getActiveSheet(), F = h == null ? void 0 : h.getActiveTextRange(), x = F != null && F.collapsed ? F.startOffset : -1, w = Js(u);
1032
+ const A = _.getActiveSheet(), F = h == null ? void 0 : h.getActiveTextRange(), x = F != null && F.collapsed ? F.startOffset : -1, w = ti(u);
1033
1033
  if (!w) return;
1034
- const M = (H = w == null ? void 0 : w.dataStream) == null ? void 0 : H.slice(0, -2), E = ((se = v.sequenceNodesBuilder(M)) != null ? se : []).map((q) => typeof q == "object" ? q.nodeType === z.REFERENCE ? {
1035
- ...q,
1036
- range: yo(q.token)
1034
+ const M = (H = w == null ? void 0 : w.dataStream) == null ? void 0 : H.slice(0, -2), I = ((ie = v.sequenceNodesBuilder(M)) != null ? ie : []).map((K) => typeof K == "object" ? K.nodeType === z.REFERENCE ? {
1035
+ ...K,
1036
+ range: Oo(K.token)
1037
1037
  } : {
1038
- ...q,
1038
+ ...K,
1039
1039
  range: void 0
1040
- } : q), b = M[x - 1], I = M[x], A = E.find((q) => typeof q == "object" && q.nodeType === z.REFERENCE && x === q.endIndex + 2), D = b && To(b) && (!I || xo(I) && I !== et.OPEN_BRACKET), $ = !!A;
1041
- if ((M == null ? void 0 : M.substring(0, 1)) === "=" && (D || $))
1042
- if ($) {
1040
+ } : K), E = M[x - 1], b = M[x], k = I.find((K) => typeof K == "object" && K.nodeType === z.REFERENCE && x === K.endIndex + 2), L = E && No(E) && (!b || Mo(b) && b !== ct.OPEN_BRACKET), U = !!k;
1041
+ if ((M == null ? void 0 : M.substring(0, 1)) === "=" && (L || U))
1042
+ if (U) {
1043
1043
  if (g.current)
1044
1044
  return;
1045
- !A.range.sheetName && k.getSheetId() === (R == null ? void 0 : R.getSheetId()) || A.range.sheetName === k.getName() ? C(
1045
+ !k.range.sheetName && A.getSheetId() === (R == null ? void 0 : R.getSheetId()) || k.range.sheetName === A.getName() ? C(
1046
1046
  2
1047
1047
  /* CAN_EDIT */
1048
1048
  ) : C(
@@ -1060,40 +1060,40 @@ function ei(e) {
1060
1060
  /* NOT_SELECT */
1061
1061
  );
1062
1062
  });
1063
- return P(() => {
1064
- const k = m.textSelection$.pipe(jt((F) => F.unitId === t)).subscribe(() => {
1063
+ return $(() => {
1064
+ const A = m.textSelection$.pipe(Jt((F) => F.unitId === t)).subscribe(() => {
1065
1065
  y();
1066
1066
  });
1067
- return () => k.unsubscribe();
1068
- }, [y, m.textSelection$, t]), P(() => {
1067
+ return () => A.unsubscribe();
1068
+ }, [y, m.textSelection$, t]), $(() => {
1069
1069
  n || (C(
1070
1070
  0
1071
1071
  /* NOT_SELECT */
1072
1072
  ), g.current = !0);
1073
- }, [n, C]), P(() => {
1073
+ }, [n, C]), $(() => {
1074
1074
  var F;
1075
1075
  if (!o) return;
1076
- const k = (F = f == null ? void 0 : f.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
1076
+ const A = (F = f == null ? void 0 : f.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
1077
1077
  C(
1078
1078
  0
1079
1079
  /* NOT_SELECT */
1080
1080
  ), g.current = !0;
1081
1081
  });
1082
- return () => k == null ? void 0 : k.unsubscribe();
1083
- }, [o, (N = f == null ? void 0 : f.mainComponent) == null ? void 0 : N.onPointerDown$, C]), P(() => {
1082
+ return () => A == null ? void 0 : A.unsubscribe();
1083
+ }, [o, (N = f == null ? void 0 : f.mainComponent) == null ? void 0 : N.onPointerDown$, C]), $(() => {
1084
1084
  if (!n) return;
1085
- const k = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
1085
+ const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
1086
1086
  y();
1087
1087
  });
1088
- return () => k == null ? void 0 : k.unsubscribe();
1089
- }, [y, n, _ == null ? void 0 : _.activeSheet$]), { isSelecting: d, isSelectingRef: p };
1088
+ return () => A == null ? void 0 : A.unsubscribe();
1089
+ }, [y, n, _ == null ? void 0 : _.activeSheet$]), { isSelecting: d, isSelectingRef: S };
1090
1090
  }
1091
- const ti = () => {
1092
- const e = T(Ce);
1093
- return Et((n) => e.sequenceNodesBuilder(n) || [], [e]);
1091
+ const ri = () => {
1092
+ const e = T(_e);
1093
+ return kt((n) => e.sequenceNodesBuilder(n) || [], [e]);
1094
1094
  };
1095
- function ni(e, t, n) {
1096
- const o = new Xt(t).setAlpha(0.05).toRgbString();
1095
+ function oi(e, t, n) {
1096
+ const o = new cn(t).setAlpha(0.05).toRgbString();
1097
1097
  return {
1098
1098
  id: n,
1099
1099
  strokeWidth: 1,
@@ -1105,7 +1105,7 @@ function ni(e, t, n) {
1105
1105
  widgetStroke: e.getColorFromTheme("white")
1106
1106
  };
1107
1107
  }
1108
- function Er(e) {
1108
+ function yr(e) {
1109
1109
  var _, R, C;
1110
1110
  const {
1111
1111
  unitId: t,
@@ -1115,42 +1115,42 @@ function Er(e) {
1115
1115
  editor: s,
1116
1116
  refSelectionsService: c,
1117
1117
  refSelectionsRenderService: i,
1118
- sheetSkeletonManagerService: a,
1118
+ sheetSkeletonManagerService: l,
1119
1119
  themeService: f,
1120
1120
  univerInstanceService: h
1121
- } = e, m = o.getUnitId(), u = h.getUnit(t, J.UNIVER_SHEET), d = u == null ? void 0 : u.getActiveSheet(), l = [];
1121
+ } = e, m = o.getUnitId(), u = h.getUnit(t, q.UNIVER_SHEET), d = u == null ? void 0 : u.getActiveSheet(), a = [];
1122
1122
  if (!u || !d) {
1123
- c.setSelections(l);
1123
+ c.setSelections(a);
1124
1124
  return;
1125
1125
  }
1126
1126
  const v = d.getSheetId(), g = (y) => {
1127
1127
  var N;
1128
1128
  return (N = u == null ? void 0 : u.getSheetBySheetName(y)) == null ? void 0 : N.getSheetId();
1129
1129
  };
1130
- if (!((_ = a == null ? void 0 : a.getWorksheetSkeleton(v)) == null ? void 0 : _.skeleton)) return;
1131
- const p = [];
1130
+ if (!((_ = l == null ? void 0 : l.getWorksheetSkeleton(v)) == null ? void 0 : _.skeleton)) return;
1131
+ const S = [];
1132
1132
  for (let y = 0, N = r.length; y < N; y++) {
1133
- const k = r[y], { themeColor: F, token: x, refIndex: w, endIndex: M } = k, E = rt(x), { unitId: b, sheetName: I, range: A } = E, D = g(I);
1134
- if (m !== t && b !== m || b && b !== m || D && D !== v || !D && v !== n)
1133
+ const A = r[y], { themeColor: F, token: x, refIndex: w, endIndex: M } = A, I = dt(x), { unitId: E, sheetName: b, range: k } = I, L = g(b);
1134
+ if (m !== t && E !== m || E && E !== m || L && L !== v || !L && v !== n)
1135
1135
  continue;
1136
- const $ = Zo(A, d.getRowCount(), d.getColumnCount());
1137
- $.unitId = t, $.sheetId = v, l.push({
1138
- range: $,
1136
+ const U = Jo(k, d.getRowCount(), d.getColumnCount());
1137
+ U.unitId = t, U.sheetId = v, a.push({
1138
+ range: U,
1139
1139
  primary: null,
1140
- style: ni(f, F, w.toString())
1141
- }), p.push(M);
1140
+ style: oi(f, F, w.toString())
1141
+ }), S.push(M);
1142
1142
  }
1143
1143
  if (s) {
1144
- const y = (C = (R = s.getSelectionRanges()) == null ? void 0 : R[0]) == null ? void 0 : C.startOffset, N = p.findIndex((k) => k + 2 === y);
1144
+ const y = (C = (R = s.getSelectionRanges()) == null ? void 0 : R[0]) == null ? void 0 : C.startOffset, N = S.findIndex((A) => A + 2 === y);
1145
1145
  N !== -1 ? i == null || i.setActiveSelectionIndex(N) : i == null || i.resetActiveSelectionIndex();
1146
1146
  }
1147
- return l;
1147
+ return a;
1148
1148
  }
1149
- function ri(e, t) {
1150
- const n = T(ee), o = T(ht), r = T(kt), c = T(xe).getRenderById(e), i = c == null ? void 0 : c.with(Fe), a = c == null ? void 0 : c.with(At), f = Q((h, m) => {
1151
- const u = n.getCurrentUnitOfType(J.UNIVER_SHEET);
1149
+ function si(e, t) {
1150
+ const n = T(ee), o = T(Rt), r = T(Ht), c = T(Oe).getRenderById(e), i = c == null ? void 0 : c.with(De), l = c == null ? void 0 : c.with(Wt), f = J((h, m) => {
1151
+ const u = n.getCurrentUnitOfType(q.UNIVER_SHEET);
1152
1152
  if (!u || i != null && i.selectionMoving) return;
1153
- const d = Er({
1153
+ const d = yr({
1154
1154
  unitId: e,
1155
1155
  subUnitId: t,
1156
1156
  currentWorkbook: u,
@@ -1158,60 +1158,60 @@ function ri(e, t) {
1158
1158
  editor: m,
1159
1159
  refSelectionsService: r,
1160
1160
  refSelectionsRenderService: i,
1161
- sheetSkeletonManagerService: a,
1161
+ sheetSkeletonManagerService: l,
1162
1162
  themeService: o,
1163
1163
  univerInstanceService: n
1164
1164
  });
1165
1165
  if (!d) return;
1166
1166
  ((i == null ? void 0 : i.getSelectionControls()) || []).length === d.length ? i == null || i.resetSelectionsByModelData(d) : r.setSelections(d);
1167
1167
  });
1168
- return P(() => () => {
1168
+ return $(() => () => {
1169
1169
  i == null || i.resetActiveSelectionIndex();
1170
1170
  }, [i]), f;
1171
1171
  }
1172
- function Ir(e = "") {
1173
- const t = T(Ft), n = oi(), o = T(ue), r = oe(() => e.length, [e]);
1174
- return Q((c, i, a = !0, f) => {
1172
+ function Tr(e = "") {
1173
+ const t = T(Bt), n = ii(), o = T(de), r = se(() => e.length, [e]);
1174
+ return J((c, i, l = !0, f) => {
1175
1175
  const h = c.getDocumentData(), m = c.getEditorId();
1176
1176
  if (!h)
1177
1177
  return [];
1178
1178
  const u = h.body;
1179
1179
  if (!u)
1180
1180
  return [];
1181
- const d = u.dataStream.slice(0, u.dataStream.length - 2), l = { dataStream: "", ...h.body };
1181
+ const d = u.dataStream.slice(0, u.dataStream.length - 2), a = { dataStream: "", ...h.body };
1182
1182
  if (!d.startsWith(e)) return [];
1183
1183
  if (i == null || i.length === 0)
1184
- return l.textRuns = [], o.syncExecuteCommand(Tn.id, {
1184
+ return a.textRuns = [], o.syncExecuteCommand(An.id, {
1185
1185
  unitId: m,
1186
- body: pn(l, 0, l.dataStream.length - 2)
1186
+ body: yn(a, 0, a.dataStream.length - 2)
1187
1187
  }), [];
1188
1188
  {
1189
- const { textRuns: v, refSelections: g } = si(t, n, i);
1189
+ const { textRuns: v, refSelections: g } = ci(t, n, i);
1190
1190
  r && v.forEach((_) => {
1191
1191
  _.ed = _.ed + r, _.st = _.st + r;
1192
- }), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...v];
1193
- const S = i.reduce((_, R) => typeof R == "string" ? `${_}${R}` : `${_}${R.token}`, "");
1194
- l.dataStream = `${e}${S}\r
1192
+ }), a.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...v];
1193
+ const p = i.reduce((_, R) => typeof R == "string" ? `${_}${R}` : `${_}${R.token}`, "");
1194
+ a.dataStream = `${e}${p}\r
1195
1195
  `;
1196
- let p;
1197
- if (a) {
1198
- p = c.getSelectionRanges();
1199
- const _ = l.dataStream.length - 2 + r;
1200
- p.forEach((R) => {
1196
+ let S;
1197
+ if (l) {
1198
+ S = c.getSelectionRanges();
1199
+ const _ = a.dataStream.length - 2 + r;
1200
+ S.forEach((R) => {
1201
1201
  R.startOffset = Math.max(0, Math.min(R.startOffset, _)), R.endOffset = Math.max(0, Math.min(R.endOffset, _));
1202
1202
  });
1203
1203
  }
1204
- return o.syncExecuteCommand(Tn.id, {
1204
+ return o.syncExecuteCommand(An.id, {
1205
1205
  unitId: m,
1206
- body: pn(l, 0, l.dataStream.length - 2),
1207
- textRanges: f != null ? f : p
1206
+ body: yn(a, 0, a.dataStream.length - 2),
1207
+ textRanges: f != null ? f : S
1208
1208
  }), g;
1209
1209
  }
1210
1210
  });
1211
1211
  }
1212
- function oi() {
1213
- const e = T(ht), t = e.getCurrentTheme();
1214
- return oe(() => {
1212
+ function ii() {
1213
+ const e = T(Rt), t = e.getCurrentTheme();
1214
+ return se(() => {
1215
1215
  const o = [
1216
1216
  e.getColorFromTheme("loop-color.1"),
1217
1217
  e.getColorFromTheme("loop-color.2"),
@@ -1229,8 +1229,8 @@ function oi() {
1229
1229
  return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: c };
1230
1230
  }, [t]);
1231
1231
  }
1232
- function si(e, t, n) {
1233
- const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: c } = t, i = [], a = [], f = /* @__PURE__ */ new Map();
1232
+ function ci(e, t, n) {
1233
+ const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: c } = t, i = [], l = [], f = /* @__PURE__ */ new Map();
1234
1234
  let h = 0;
1235
1235
  for (let m = 0, u = n.length; m < u; m++) {
1236
1236
  const d = n[m];
@@ -1261,35 +1261,35 @@ function si(e, t, n) {
1261
1261
  });
1262
1262
  continue;
1263
1263
  }
1264
- const { startIndex: l, endIndex: v, nodeType: g, token: S } = d;
1265
- let p = "";
1264
+ const { startIndex: a, endIndex: v, nodeType: g, token: p } = d;
1265
+ let S = "";
1266
1266
  if (g === z.REFERENCE) {
1267
- if (f.has(S))
1268
- p = f.get(S);
1267
+ if (f.has(p))
1268
+ S = f.get(p);
1269
1269
  else {
1270
1270
  const _ = h % o.length;
1271
- p = o[_], f.set(S, p), h++;
1271
+ S = o[_], f.set(p, S), h++;
1272
1272
  }
1273
- a.push({
1273
+ l.push({
1274
1274
  refIndex: m,
1275
- themeColor: p,
1276
- token: S,
1275
+ themeColor: S,
1276
+ token: p,
1277
1277
  startIndex: d.startIndex,
1278
1278
  endIndex: d.endIndex,
1279
- index: a.length
1279
+ index: l.length
1280
1280
  });
1281
- } else g === z.NUMBER ? p = r : (g === z.STRING || g === z.ARRAY) && (p = s);
1282
- p && p.length > 0 ? i.push({
1283
- st: l,
1281
+ } else g === z.NUMBER ? S = r : (g === z.STRING || g === z.ARRAY) && (S = s);
1282
+ S && S.length > 0 ? i.push({
1283
+ st: a,
1284
1284
  ed: v + 1,
1285
1285
  ts: {
1286
1286
  cl: {
1287
- rgb: p
1287
+ rgb: S
1288
1288
  },
1289
1289
  fs: 11
1290
1290
  }
1291
1291
  }) : i.push({
1292
- st: l,
1292
+ st: a,
1293
1293
  ed: v + 1,
1294
1294
  ts: {
1295
1295
  cl: {
@@ -1299,276 +1299,276 @@ function si(e, t, n) {
1299
1299
  }
1300
1300
  });
1301
1301
  }
1302
- return { textRuns: i, refSelections: a };
1302
+ return { textRuns: i, refSelections: l };
1303
1303
  }
1304
- const ii = (e, t, n, o) => {
1305
- const r = T(ue), s = T(Dt), c = Y(t);
1304
+ const ai = (e, t, n, o) => {
1305
+ const r = T(de), s = T(jt), c = G(t);
1306
1306
  c.current = t;
1307
- const i = Y(o);
1308
- i.current = o, P(() => {
1307
+ const i = G(o);
1308
+ i.current = o, $(() => {
1309
1309
  if (!n || !e)
1310
1310
  return;
1311
- const f = `sheet.formula-embedding-editor.${n.getEditorId()}`, h = new We(), m = (l, v) => {
1311
+ const f = `sheet.formula-embedding-editor.${n.getEditorId()}`, h = new He(), m = (a, v) => {
1312
1312
  if (i.current) {
1313
- i.current(l, v);
1313
+ i.current(a, v);
1314
1314
  return;
1315
1315
  }
1316
- let g = ce.LEFT;
1317
- l === L.ARROW_DOWN ? g = ce.DOWN : l === L.ARROW_UP ? g = ce.UP : l === L.ARROW_RIGHT && (g = ce.RIGHT), v === W.SHIFT ? r.executeCommand(Ho.id, {
1316
+ let g = ae.LEFT;
1317
+ a === D.ARROW_DOWN ? g = ae.DOWN : a === D.ARROW_UP ? g = ae.UP : a === D.ARROW_RIGHT && (g = ae.RIGHT), v === P.SHIFT ? r.executeCommand(qo.id, {
1318
1318
  direction: g
1319
- }) : r.executeCommand(Bo.id, {
1319
+ }) : r.executeCommand(Ko.id, {
1320
1320
  direction: g
1321
1321
  });
1322
- }, u = (l, v) => {
1323
- let g = ce.DOWN;
1324
- l === L.ARROW_DOWN ? g = ce.DOWN : l === L.ARROW_UP ? g = ce.UP : l === L.ARROW_LEFT ? g = ce.LEFT : l === L.ARROW_RIGHT && (g = ce.RIGHT), c.current ? v === W.CTRL_COMMAND ? r.executeCommand(Rn.id, {
1322
+ }, u = (a, v) => {
1323
+ let g = ae.DOWN;
1324
+ a === D.ARROW_DOWN ? g = ae.DOWN : a === D.ARROW_UP ? g = ae.UP : a === D.ARROW_LEFT ? g = ae.LEFT : a === D.ARROW_RIGHT && (g = ae.RIGHT), c.current ? v === P.CTRL_COMMAND ? r.executeCommand(On.id, {
1325
1325
  direction: g,
1326
- jumpOver: bn.moveGap,
1326
+ jumpOver: Nn.moveGap,
1327
1327
  extra: "formula-editor",
1328
1328
  fromCurrentSelection: c.current === Ae.NEED_ADD || c.current === Ae.EDIT_OTHER_SHEET_REFERENCE
1329
- }) : v === W.SHIFT ? r.executeCommand(En.id, {
1329
+ }) : v === P.SHIFT ? r.executeCommand(Mn.id, {
1330
1330
  direction: g,
1331
1331
  extra: "formula-editor"
1332
- }) : v === (W.CTRL_COMMAND | W.SHIFT) ? r.executeCommand(En.id, {
1332
+ }) : v === (P.CTRL_COMMAND | P.SHIFT) ? r.executeCommand(Mn.id, {
1333
1333
  direction: g,
1334
- jumpOver: bn.moveGap,
1334
+ jumpOver: Nn.moveGap,
1335
1335
  extra: "formula-editor"
1336
- }) : r.executeCommand(Rn.id, {
1336
+ }) : r.executeCommand(On.id, {
1337
1337
  direction: g,
1338
1338
  extra: "formula-editor",
1339
1339
  fromCurrentSelection: c.current === Ae.NEED_ADD || c.current === Ae.EDIT_OTHER_SHEET_REFERENCE
1340
- }) : m(l, v);
1340
+ }) : m(a, v);
1341
1341
  };
1342
1342
  return h.add(r.registerCommand({
1343
1343
  id: f,
1344
- type: ye.OPERATION,
1345
- handler(l, v) {
1346
- const { keyCode: g, metaKey: S } = v;
1347
- u(g, S);
1344
+ type: Te.OPERATION,
1345
+ handler(a, v) {
1346
+ const { keyCode: g, metaKey: p } = v;
1347
+ u(g, p);
1348
1348
  }
1349
1349
  })), [
1350
- { keyCode: L.ARROW_DOWN },
1351
- { keyCode: L.ARROW_LEFT },
1352
- { keyCode: L.ARROW_RIGHT },
1353
- { keyCode: L.ARROW_UP },
1354
- { keyCode: L.ARROW_DOWN, metaKey: W.SHIFT },
1355
- { keyCode: L.ARROW_LEFT, metaKey: W.SHIFT },
1356
- { keyCode: L.ARROW_RIGHT, metaKey: W.SHIFT },
1357
- { keyCode: L.ARROW_UP, metaKey: W.SHIFT },
1358
- { keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND },
1359
- { keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND },
1360
- { keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND },
1361
- { keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND },
1362
- { keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND | W.SHIFT },
1363
- { keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND | W.SHIFT },
1364
- { keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND | W.SHIFT },
1365
- { keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND | W.SHIFT }
1366
- ].map(({ keyCode: l, metaKey: v }) => ({
1350
+ { keyCode: D.ARROW_DOWN },
1351
+ { keyCode: D.ARROW_LEFT },
1352
+ { keyCode: D.ARROW_RIGHT },
1353
+ { keyCode: D.ARROW_UP },
1354
+ { keyCode: D.ARROW_DOWN, metaKey: P.SHIFT },
1355
+ { keyCode: D.ARROW_LEFT, metaKey: P.SHIFT },
1356
+ { keyCode: D.ARROW_RIGHT, metaKey: P.SHIFT },
1357
+ { keyCode: D.ARROW_UP, metaKey: P.SHIFT },
1358
+ { keyCode: D.ARROW_DOWN, metaKey: P.CTRL_COMMAND },
1359
+ { keyCode: D.ARROW_LEFT, metaKey: P.CTRL_COMMAND },
1360
+ { keyCode: D.ARROW_RIGHT, metaKey: P.CTRL_COMMAND },
1361
+ { keyCode: D.ARROW_UP, metaKey: P.CTRL_COMMAND },
1362
+ { keyCode: D.ARROW_DOWN, metaKey: P.CTRL_COMMAND | P.SHIFT },
1363
+ { keyCode: D.ARROW_LEFT, metaKey: P.CTRL_COMMAND | P.SHIFT },
1364
+ { keyCode: D.ARROW_RIGHT, metaKey: P.CTRL_COMMAND | P.SHIFT },
1365
+ { keyCode: D.ARROW_UP, metaKey: P.CTRL_COMMAND | P.SHIFT }
1366
+ ].map(({ keyCode: a, metaKey: v }) => ({
1367
1367
  id: f,
1368
- binding: v ? l | v : l,
1368
+ binding: v ? a | v : a,
1369
1369
  preconditions: () => !0,
1370
1370
  priority: 900,
1371
1371
  staticParameters: {
1372
- eventType: Te.Keyboard,
1373
- keyCode: l,
1372
+ eventType: xe.Keyboard,
1373
+ keyCode: a,
1374
1374
  metaKey: v
1375
1375
  }
1376
- })).forEach((l) => {
1377
- h.add(s.registerShortcut(l));
1376
+ })).forEach((a) => {
1377
+ h.add(s.registerShortcut(a));
1378
1378
  }), () => {
1379
1379
  h.dispose();
1380
1380
  };
1381
1381
  }, [r, n, e, s]);
1382
- }, ci = (e, t, n, o = !0) => {
1382
+ }, li = (e, t, n, o = !0) => {
1383
1383
  var u;
1384
- const r = T(xe), s = T(zt), c = T(ss), i = T(kt), a = T(ee), f = ve(oe(() => a.getCurrentTypeOfUnit$(J.UNIVER_SHEET), [a])), h = r.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), m = h == null ? void 0 : h.with(Fe);
1385
- It(() => {
1384
+ const r = T(Oe), s = T(on), c = T(ls), i = T(Ht), l = T(ee), f = Ce(se(() => l.getCurrentTypeOfUnit$(q.UNIVER_SHEET), [l])), h = r.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), m = h == null ? void 0 : h.with(De);
1385
+ At(() => {
1386
1386
  if (e)
1387
- return s.setContextValue(pt, !0), () => {
1388
- s.setContextValue(pt, !1), i.clear();
1387
+ return s.setContextValue(xt, !0), () => {
1388
+ s.setContextValue(xt, !1), i.clear();
1389
1389
  };
1390
- }, [s, e, i]), It(() => {
1390
+ }, [s, e, i]), At(() => {
1391
1391
  if (e && t) {
1392
1392
  const d = m == null ? void 0 : m.enableSelectionChanging();
1393
- return s.setContextValue(Nn, !0), () => {
1394
- s.setContextValue(Nn, !1), d == null || d.dispose();
1393
+ return s.setContextValue(Ln, !0), () => {
1394
+ s.setContextValue(Ln, !1), d == null || d.dispose();
1395
1395
  };
1396
1396
  }
1397
- }, [s, e, m, t]), P(() => {
1397
+ }, [s, e, m, t]), $(() => {
1398
1398
  if (e)
1399
- return s.setContextValue(pt, !0), o && c.disable(), () => {
1400
- s.setContextValue(pt, !1), o && c.enable();
1399
+ return s.setContextValue(xt, !0), o && c.disable(), () => {
1400
+ s.setContextValue(xt, !1), o && c.enable();
1401
1401
  };
1402
- }, [c, s, e, o]), P(() => {
1402
+ }, [c, s, e, o]), $(() => {
1403
1403
  e && (m == null || m.setSkipLastEnabled(!1));
1404
1404
  }, [e, m]);
1405
- }, li = (e, t, n) => {
1406
- const o = T(ee), r = T(en);
1407
- return Et(() => {
1405
+ }, ui = (e, t, n) => {
1406
+ const o = T(ee), r = T(un);
1407
+ return kt(() => {
1408
1408
  if (e) {
1409
- const c = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], i = o.getCurrentUnitForType(J.UNIVER_SHEET), a = i == null ? void 0 : i.getActiveSheet();
1410
- (i == null ? void 0 : i.getUnitId()) !== t && o.setCurrentUnitForType(t), a && a.getSheetId() === n && r.setSelections(c);
1409
+ const c = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], i = o.getCurrentUnitForType(q.UNIVER_SHEET), l = i == null ? void 0 : i.getActiveSheet();
1410
+ (i == null ? void 0 : i.getUnitId()) !== t && o.setCurrentUnitForType(t), l && l.getSheetId() === n && r.setSelections(c);
1411
1411
  }
1412
1412
  }, [e, r, n, t, o]);
1413
- }, ai = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), Yt = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Ct = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Se(r.range)) : e.map((r) => o ? Oo(r) : r.sheetName !== "" && r.sheetName !== n ? at(r.sheetName, r.range) : Se(r.range)), ui = (e) => {
1413
+ }, di = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), nn = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Ot = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Se(r.range)) : e.map((r) => o ? wo(r) : r.sheetName !== "" && r.sheetName !== n ? St(r.sheetName, r.range) : Se(r.range)), hi = (e) => {
1414
1414
  var h, m, u;
1415
1415
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
1416
1416
  if ((o == null ? void 0 : o.length) !== 1)
1417
1417
  return;
1418
1418
  const s = o[0].startOffset - 1, c = ((m = (h = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : h.dataStream) != null ? m : `\r
1419
- `).slice(0, -2), i = (u = n.sequenceNodesBuilder(c.slice(1))) != null ? u : [], a = dn(i, s, !1), f = fr(i, a);
1419
+ `).slice(0, -2), i = (u = n.sequenceNodesBuilder(c.slice(1))) != null ? u : [], l = Sn(i, s, !1), f = mr(i, l);
1420
1420
  return {
1421
- nodeIndex: a,
1421
+ nodeIndex: l,
1422
1422
  updatingRefIndex: f,
1423
1423
  sequenceNodes: i,
1424
1424
  offset: s
1425
1425
  };
1426
- }, di = () => {
1427
- }, hi = (e, t, n, o, r, s, c, i, a, f = di) => {
1426
+ }, fi = () => {
1427
+ }, gi = (e, t, n, o, r, s, c, i, l, f = fi) => {
1428
1428
  var w;
1429
- const h = T(xe), m = T(ee), u = T(ue), d = T(ar), l = T(ht), v = T(Ce), g = m.getUnit(o), S = Q((M) => {
1430
- var E, b;
1431
- return (b = (E = g == null ? void 0 : g.getSheetBySheetId(M)) == null ? void 0 : E.getName()) != null ? b : "";
1432
- }), p = oe(() => S(r), [S, r]), _ = ve(g == null ? void 0 : g.activeSheet$), R = Ke({ activeSheet: _, sheetName: p }), C = ve(oe(() => m.getCurrentTypeOfUnit$(J.UNIVER_SHEET), [m])), y = h.getRenderById((w = C == null ? void 0 : C.getUnitId()) != null ? w : ""), N = y == null ? void 0 : y.with(Fe), k = y == null ? void 0 : y.with(At), F = T(kt), x = Q((M, E) => {
1433
- var H, se, q, _e, Ye, ne;
1434
- const b = ui({ editor: a, lexerTreeBuilder: v });
1435
- if (!b) return;
1436
- const { nodeIndex: I, updatingRefIndex: A, sequenceNodes: D, offset: $ } = b;
1429
+ const h = T(Oe), m = T(ee), u = T(de), d = T(dr), a = T(Rt), v = T(_e), g = m.getUnit(o), p = J((M) => {
1430
+ var I, E;
1431
+ return (E = (I = g == null ? void 0 : g.getSheetBySheetId(M)) == null ? void 0 : I.getName()) != null ? E : "";
1432
+ }), S = se(() => p(r), [p, r]), _ = Ce(g == null ? void 0 : g.activeSheet$), R = Je({ activeSheet: _, sheetName: S }), C = Ce(se(() => m.getCurrentTypeOfUnit$(q.UNIVER_SHEET), [m])), y = h.getRenderById((w = C == null ? void 0 : C.getUnitId()) != null ? w : ""), N = y == null ? void 0 : y.with(De), A = y == null ? void 0 : y.with(Wt), F = T(Ht), x = J((M, I) => {
1433
+ var H, ie, K, Re, et, re;
1434
+ const E = hi({ editor: l, lexerTreeBuilder: v });
1435
+ if (!E) return;
1436
+ const { nodeIndex: b, updatingRefIndex: k, sequenceNodes: L, offset: U } = E;
1437
1437
  if (n.current === Ae.NEED_ADD)
1438
- if ($ !== 0) {
1439
- if (I === -1 && D.length)
1438
+ if (U !== 0) {
1439
+ if (b === -1 && L.length)
1440
1440
  return;
1441
- const Z = M[M.length - 1], X = D.splice(I + 1), he = (H = Z.sheetId) != null ? H : r, te = {
1442
- range: Z,
1443
- unitId: (se = Z.unitId) != null ? se : C.getUnitId(),
1444
- sheetName: S(he)
1445
- }, fe = he !== r, le = (C == null ? void 0 : C.getUnitId()) !== o, Ge = Ct([te], c && (fe || le), p, le);
1446
- D.push({ token: Ge[0], nodeType: z.REFERENCE });
1447
- const De = [...D, ...X], de = Yt(De);
1448
- f(de, ai(D), E);
1441
+ const X = M[M.length - 1], Q = L.splice(b + 1), ge = (H = X.sheetId) != null ? H : r, te = {
1442
+ range: X,
1443
+ unitId: (ie = X.unitId) != null ? ie : C.getUnitId(),
1444
+ sheetName: p(ge)
1445
+ }, me = ge !== r, le = (C == null ? void 0 : C.getUnitId()) !== o, tt = Ot([te], c && (me || le), S, le);
1446
+ L.push({ token: tt[0], nodeType: z.REFERENCE });
1447
+ const Le = [...L, ...Q], he = nn(Le);
1448
+ f(he, di(L), I);
1449
1449
  } else {
1450
- const Z = M[M.length - 1], X = (q = Z.sheetId) != null ? q : r, he = {
1451
- range: Z,
1452
- unitId: (_e = Z.unitId) != null ? _e : o,
1453
- sheetName: S(X)
1454
- }, fe = Ct([he], c && X !== r);
1455
- D.unshift({ token: fe[0], nodeType: z.REFERENCE });
1456
- const le = Yt(D);
1457
- f(le, fe[0].length, E);
1450
+ const X = M[M.length - 1], Q = (K = X.sheetId) != null ? K : r, ge = {
1451
+ range: X,
1452
+ unitId: (Re = X.unitId) != null ? Re : o,
1453
+ sheetName: p(Q)
1454
+ }, me = Ot([ge], c && Q !== r);
1455
+ L.unshift({ token: me[0], nodeType: z.REFERENCE });
1456
+ const le = nn(L);
1457
+ f(le, me[0].length, I);
1458
1458
  }
1459
1459
  else if (n.current === Ae.EDIT_OTHER_SHEET_REFERENCE) {
1460
- const Z = M.pop();
1461
- if (!Z) return;
1462
- const X = D[I];
1463
- if (typeof X == "object" && X.nodeType === z.REFERENCE) {
1464
- const he = X.token;
1465
- X.token = p === (_ == null ? void 0 : _.getName()) ? Se(Z) : at(_.getName(), Z);
1466
- const te = $ + (X.token.length - he.length);
1467
- f(No(D), te, E);
1460
+ const X = M.pop();
1461
+ if (!X) return;
1462
+ const Q = L[b];
1463
+ if (typeof Q == "object" && Q.nodeType === z.REFERENCE) {
1464
+ const ge = Q.token;
1465
+ Q.token = S === (_ == null ? void 0 : _.getName()) ? Se(X) : St(_.getName(), X);
1466
+ const te = U + (Q.token.length - ge.length);
1467
+ f(ko(L), te, I);
1468
1468
  }
1469
1469
  } else {
1470
- const Z = [...M];
1471
- if (A !== -1) {
1472
- const G = Z.pop();
1473
- G && Z.splice(A, 0, G);
1470
+ const X = [...M];
1471
+ if (k !== -1) {
1472
+ const Z = X.pop();
1473
+ Z && X.splice(k, 0, Z);
1474
1474
  }
1475
- let X = 0;
1476
- const he = D.map((G) => {
1477
- var ge, Re, Ne;
1478
- if (typeof G == "string")
1479
- return G;
1480
- if (G.nodeType === z.REFERENCE) {
1481
- const Le = rt(G.token);
1482
- if (Le.sheetName || (Le.sheetName = p), c && ((ge = R.current.activeSheet) == null ? void 0 : ge.getName()) !== Le.sheetName)
1483
- return G.token;
1484
- const be = Z[X];
1485
- if (X++, !be)
1475
+ let Q = 0;
1476
+ const ge = L.map((Z) => {
1477
+ var pe, Ee, Me;
1478
+ if (typeof Z == "string")
1479
+ return Z;
1480
+ if (Z.nodeType === z.REFERENCE) {
1481
+ const $e = dt(Z.token);
1482
+ if ($e.sheetName || ($e.sheetName = S), c && ((pe = R.current.activeSheet) == null ? void 0 : pe.getName()) !== $e.sheetName)
1483
+ return Z.token;
1484
+ const Ie = X[Q];
1485
+ if (Q++, !Ie)
1486
1486
  return "";
1487
- const Pt = (Re = be.sheetId) != null ? Re : r, $t = {
1488
- range: be,
1489
- unitId: (Ne = be.unitId) != null ? Ne : o,
1490
- sheetName: S(Pt)
1487
+ const Kt = (Ee = Ie.sheetId) != null ? Ee : r, Yt = {
1488
+ range: Ie,
1489
+ unitId: (Me = Ie.unitId) != null ? Me : o,
1490
+ sheetName: p(Kt)
1491
1491
  };
1492
- return Ct([$t], c, p)[0];
1492
+ return Ot([Yt], c, S)[0];
1493
1493
  }
1494
- return G.token;
1494
+ return Z.token;
1495
1495
  });
1496
- let te = "", fe;
1497
- he.forEach((G, ge) => {
1498
- te += G, ge === I && (fe = te.length);
1496
+ let te = "", me;
1497
+ ge.forEach((Z, pe) => {
1498
+ te += Z, pe === b && (me = te.length);
1499
1499
  });
1500
1500
  const le = [];
1501
- for (let G = X; G <= M.length - 1; G++) {
1502
- const ge = M[G], Re = (Ye = ge.sheetId) != null ? Ye : r, Ne = {
1503
- range: ge,
1504
- unitId: (ne = ge.unitId) != null ? ne : o,
1505
- sheetName: S(Re)
1506
- }, be = Ct([Ne], c && Re !== r, p);
1507
- le.push(be[0]);
1501
+ for (let Z = Q; Z <= M.length - 1; Z++) {
1502
+ const pe = M[Z], Ee = (et = pe.sheetId) != null ? et : r, Me = {
1503
+ range: pe,
1504
+ unitId: (re = pe.unitId) != null ? re : o,
1505
+ sheetName: p(Ee)
1506
+ }, Ie = Ot([Me], c && Ee !== r, S);
1507
+ le.push(Ie[0]);
1508
1508
  }
1509
- const Ge = D[D.length - 1], De = Ge && (typeof Ge == "string" ? !1 : Ge.nodeType === z.REFERENCE), de = `${te}${le.length && De ? "," : ""}${le.join(",")}`;
1510
- f(de, !le.length && fe ? fe : de.length, E);
1509
+ const tt = L[L.length - 1], Le = tt && (typeof tt == "string" ? !1 : tt.nodeType === z.REFERENCE), he = `${te}${le.length && Le ? "," : ""}${le.join(",")}`;
1510
+ f(he, !le.length && me ? me : he.length, I);
1511
1511
  }
1512
1512
  });
1513
- P(() => {
1513
+ $(() => {
1514
1514
  if (N && e) {
1515
1515
  let M = !0;
1516
- const E = (I, A) => {
1516
+ const I = (b, k) => {
1517
1517
  if (M) {
1518
1518
  M = !1;
1519
1519
  return;
1520
1520
  }
1521
- x(I.map((D) => D.rangeWithCoord), A);
1522
- }, b = new We();
1523
- return b.add(N.selectionMoving$.subscribe((I) => {
1524
- E(I, !1);
1525
- })), b.add(N.selectionMoveEnd$.subscribe((I) => {
1526
- E(I, !0);
1521
+ x(b.map((L) => L.rangeWithCoord), k);
1522
+ }, E = new He();
1523
+ return E.add(N.selectionMoving$.subscribe((b) => {
1524
+ I(b, !1);
1525
+ })), E.add(N.selectionMoveEnd$.subscribe((b) => {
1526
+ I(b, !0);
1527
1527
  })), () => {
1528
- b.dispose();
1528
+ E.dispose();
1529
1529
  };
1530
1530
  }
1531
- }, [e, x, N]), P(() => {
1532
- if (t && N && a) {
1533
- const M = new We(), E = () => {
1534
- M.dispose(), N.getSelectionControls().forEach((A, D) => {
1531
+ }, [e, x, N]), $(() => {
1532
+ if (t && N && l) {
1533
+ const M = new He(), I = () => {
1534
+ M.dispose(), N.getSelectionControls().forEach((k, L) => {
1535
1535
  M.add(
1536
- A.selectionScaling$.subscribe(($) => {
1537
- const H = N.getSelectionDataWithStyle().map((q) => q.rangeWithCoord), se = H[D];
1538
- $.sheetId = se.sheetId, $.unitId = se.unitId, H[D] = $, x(H, !1);
1536
+ k.selectionScaling$.subscribe((U) => {
1537
+ const H = N.getSelectionDataWithStyle().map((K) => K.rangeWithCoord), ie = H[L];
1538
+ U.sheetId = ie.sheetId, U.unitId = ie.unitId, H[L] = U, x(H, !1);
1539
1539
  })
1540
1540
  ), M.add(
1541
- A.selectionMoving$.subscribe(($) => {
1542
- const H = N.getSelectionDataWithStyle().map((q) => q.rangeWithCoord), se = H[D];
1543
- $.sheetId = se.sheetId, $.unitId = se.unitId, H[D] = $, x(H, !0);
1541
+ k.selectionMoving$.subscribe((U) => {
1542
+ const H = N.getSelectionDataWithStyle().map((K) => K.rangeWithCoord), ie = H[L];
1543
+ U.sheetId = ie.sheetId, U.unitId = ie.unitId, H[L] = U, x(H, !0);
1544
1544
  })
1545
1545
  );
1546
1546
  });
1547
- }, b = $o(
1548
- a.input$,
1547
+ }, E = Wo(
1548
+ l.input$,
1549
1549
  F.selectionSet$,
1550
1550
  N.selectionMoveEnd$
1551
1551
  ).pipe(
1552
- _s(50)
1552
+ Es(50)
1553
1553
  ).subscribe(() => {
1554
- E();
1554
+ I();
1555
1555
  });
1556
1556
  return () => {
1557
- b.unsubscribe(), M.dispose();
1557
+ E.unsubscribe(), M.dispose();
1558
1558
  };
1559
1559
  }
1560
- }, [a, t, x, N, F.selectionSet$]), N == null || N.getSelectionDataWithStyle(), P(() => {
1560
+ }, [l, t, x, N, F.selectionSet$]), N == null || N.getSelectionDataWithStyle(), $(() => {
1561
1561
  if (i) {
1562
- const M = u.onCommandExecuted((E) => {
1563
- var I;
1564
- if (E.id !== tn.id)
1562
+ const M = u.onCommandExecuted((I) => {
1563
+ var b;
1564
+ if (I.id !== dn.id)
1565
1565
  return;
1566
- const b = E.params;
1567
- if (b.extra === "formula-editor" && b.selections.length) {
1568
- const A = b.selections[b.selections.length - 1];
1569
- if (A) {
1570
- const D = n.current === Ae.NEED_ADD, $ = ((I = N == null ? void 0 : N.getSelectionDataWithStyle()) != null ? I : []).map((H) => H.rangeWithCoord);
1571
- D ? $.push(A.range) : $[$.length - 1] = A.range, x($, !0);
1566
+ const E = I.params;
1567
+ if (E.extra === "formula-editor" && E.selections.length) {
1568
+ const k = E.selections[E.selections.length - 1];
1569
+ if (k) {
1570
+ const L = n.current === Ae.NEED_ADD, U = ((b = N == null ? void 0 : N.getSelectionDataWithStyle()) != null ? b : []).map((H) => H.rangeWithCoord);
1571
+ L ? U.push(k.range) : U[U.length - 1] = k.range, x(U, !0);
1572
1572
  }
1573
1573
  }
1574
1574
  });
@@ -1576,28 +1576,28 @@ const ii = (e, t, n, o) => {
1576
1576
  M.dispose();
1577
1577
  };
1578
1578
  }
1579
- }, [u, a, n, v, i, x, N]), P(() => {
1580
- if (!a)
1579
+ }, [u, l, n, v, i, x, N]), $(() => {
1580
+ if (!l)
1581
1581
  return;
1582
- const M = d.textSelection$.subscribe((E) => {
1583
- E.unitId === a.getEditorId() && Er({
1582
+ const M = d.textSelection$.subscribe((I) => {
1583
+ I.unitId === l.getEditorId() && yr({
1584
1584
  unitId: o,
1585
1585
  subUnitId: r,
1586
1586
  refSelections: s.current,
1587
- editor: a,
1587
+ editor: l,
1588
1588
  refSelectionsService: F,
1589
1589
  refSelectionsRenderService: N,
1590
- sheetSkeletonManagerService: k,
1591
- themeService: l,
1590
+ sheetSkeletonManagerService: A,
1591
+ themeService: a,
1592
1592
  univerInstanceService: m,
1593
1593
  currentWorkbook: C
1594
1594
  });
1595
1595
  });
1596
1596
  return () => M.unsubscribe();
1597
- }, [d.textSelection$, a, s, N, F, k, r, l, o, m]);
1598
- }, fi = (e, t, n, o, r, s) => {
1599
- const c = T(ue), i = T(Be), f = T(xe).getRenderById(t), h = T(ee), m = f == null ? void 0 : f.with(Fe);
1600
- P(() => {
1597
+ }, [d.textSelection$, l, s, N, F, A, r, a, o, m]);
1598
+ }, mi = (e, t, n, o, r, s) => {
1599
+ const c = T(de), i = T(qe), f = T(Oe).getRenderById(t), h = T(ee), m = f == null ? void 0 : f.with(De);
1600
+ $(() => {
1601
1601
  if (e && m)
1602
1602
  if (n) {
1603
1603
  const u = () => {
@@ -1608,19 +1608,19 @@ const ii = (e, t, n, o) => {
1608
1608
  s();
1609
1609
  }, 30);
1610
1610
  }, d = c.onCommandExecuted((v) => {
1611
- v.id === Mn.id && u();
1612
- }), l = h.getCurrentTypeOfUnit$(J.UNIVER_SHEET).subscribe((v) => {
1611
+ v.id === $n.id && u();
1612
+ }), a = h.getCurrentTypeOfUnit$(q.UNIVER_SHEET).subscribe((v) => {
1613
1613
  u();
1614
1614
  });
1615
1615
  return () => {
1616
- d.dispose(), l.unsubscribe();
1616
+ d.dispose(), a.unsubscribe();
1617
1617
  };
1618
1618
  } else {
1619
1619
  const u = c.beforeCommandExecuted((d) => {
1620
- if (d.id === Mn.id) {
1620
+ if (d.id === $n.id) {
1621
1621
  o(!1), r(), s();
1622
- const l = i.getEditor(Zt);
1623
- l == null || l.focus();
1622
+ const a = i.getEditor(sn);
1623
+ a == null || a.focus();
1624
1624
  }
1625
1625
  });
1626
1626
  return () => {
@@ -1628,9 +1628,9 @@ const ii = (e, t, n, o) => {
1628
1628
  };
1629
1629
  }
1630
1630
  }, [e, m]);
1631
- }, gi = (e, t, n) => {
1632
- const o = T(Ce), r = Y(!0);
1633
- P(() => {
1631
+ }, pi = (e, t, n) => {
1632
+ const o = T(_e), r = G(!0);
1633
+ $(() => {
1634
1634
  if (e) {
1635
1635
  const s = setTimeout(() => {
1636
1636
  r.current = !1;
@@ -1639,95 +1639,95 @@ const ii = (e, t, n, o) => {
1639
1639
  clearTimeout(s);
1640
1640
  };
1641
1641
  }
1642
- }, [e]), P(() => {
1642
+ }, [e]), $(() => {
1643
1643
  if (!r.current && t) {
1644
1644
  const s = o.checkIfAddBracket(n);
1645
- t(s === 0 && n.startsWith(zn.EQUALS), `${n}`);
1645
+ t(s === 0 && n.startsWith(nr.EQUALS), `${n}`);
1646
1646
  }
1647
1647
  }, [n, t]);
1648
- }, mi = (e, t = [], n) => {
1649
- const o = T(Ft), [r, s] = U([]), [c, i] = U(""), a = Y(-1), f = Ke({ nodes: t }), h = () => {
1650
- s([]), i(""), a.current = -1;
1648
+ }, vi = (e, t = [], n) => {
1649
+ const o = T(Bt), [r, s] = V([]), [c, i] = V(""), l = G(-1), f = Je({ nodes: t }), h = () => {
1650
+ s([]), i(""), l.current = -1;
1651
1651
  };
1652
- return P(() => {
1652
+ return $(() => {
1653
1653
  if (n && e) {
1654
- const u = n.input$.pipe(Jt(300)).subscribe(() => {
1654
+ const u = n.input$.pipe(ln(300)).subscribe(() => {
1655
1655
  const d = n.getSelectionRanges();
1656
1656
  if (d.length === 1) {
1657
- const l = f.current.nodes, v = d[0];
1657
+ const a = f.current.nodes, v = d[0];
1658
1658
  if (v.collapsed) {
1659
- const g = dn(l, v.startOffset - 1, !1);
1660
- a.current = g;
1661
- const S = l[g];
1662
- if (S && typeof S != "string" && S.nodeType === z.FUNCTION) {
1663
- a.current = g;
1664
- const p = S.token, _ = o.getSearchListByNameFirstLetter(p);
1665
- s(_), i(p);
1659
+ const g = Sn(a, v.startOffset - 1, !1);
1660
+ l.current = g;
1661
+ const p = a[g];
1662
+ if (p && typeof p != "string" && p.nodeType === z.FUNCTION) {
1663
+ l.current = g;
1664
+ const S = p.token, _ = o.getSearchListByNameFirstLetter(S);
1665
+ s(_), i(S);
1666
1666
  return;
1667
1667
  }
1668
1668
  }
1669
1669
  }
1670
- a.current = -1, i(""), s((l) => l != null && l.length ? [] : l);
1670
+ l.current = -1, i(""), s((a) => a != null && a.length ? [] : a);
1671
1671
  });
1672
1672
  return () => {
1673
1673
  u.unsubscribe();
1674
1674
  };
1675
1675
  }
1676
- }, [n, e]), P(() => {
1676
+ }, [n, e]), $(() => {
1677
1677
  e || h();
1678
1678
  }, [e]), {
1679
1679
  searchList: r,
1680
1680
  searchText: c,
1681
1681
  handlerFormulaReplace: (u) => {
1682
1682
  const d = [...f.current.nodes];
1683
- if (a.current !== -1) {
1684
- const l = d.splice(a.current + 1), v = d.pop() || "";
1683
+ if (l.current !== -1) {
1684
+ const a = d.splice(l.current + 1), v = d.pop() || "";
1685
1685
  let g = (typeof v == "string" ? v.length : v.token.length) - u.length;
1686
- return d.push(u), l[0] !== et.OPEN_BRACKET && (d.push(et.OPEN_BRACKET), g--), { text: Yt([...d, ...l]), offset: g };
1686
+ return d.push(u), a[0] !== ct.OPEN_BRACKET && (d.push(ct.OPEN_BRACKET), g--), { text: nn([...d, ...a]), offset: g };
1687
1687
  }
1688
1688
  },
1689
1689
  reset: h
1690
1690
  };
1691
1691
  }, Si = () => {
1692
- }, vi = Oe(pi);
1693
- function pi(e, t) {
1694
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: c = Si } = e, i = s.getEditorId(), a = T(Dt), f = T(ue), { searchList: h, searchText: m, handlerFormulaReplace: u, reset: d } = mi(n, o, s), l = oe(() => !!h.length, [h]), v = Y(void 0), [g, S] = U(0), p = Y(!1), [_] = br(i, l, [m, h]), R = Ke({ searchList: h, active: g }), C = (x) => {
1692
+ }, Ci = Ne(_i);
1693
+ function _i(e, t) {
1694
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: c = Si } = e, i = s.getEditorId(), l = T(jt), f = T(de), { searchList: h, searchText: m, handlerFormulaReplace: u, reset: d } = vi(n, o, s), a = se(() => !!h.length, [h]), v = G(void 0), [g, p] = V(0), S = G(!1), [_] = br(i, a, [m, h]), R = Je({ searchList: h, active: g }), C = (x) => {
1695
1695
  const w = u(x);
1696
1696
  w && (d(), r(w));
1697
1697
  };
1698
1698
  function y(x) {
1699
- p.current && S(x);
1699
+ S.current && p(x);
1700
1700
  }
1701
1701
  function N() {
1702
- p.current && S(-1);
1702
+ S.current && p(-1);
1703
1703
  }
1704
- P(() => {
1704
+ $(() => {
1705
1705
  if (!h.length)
1706
1706
  return;
1707
- const x = `sheet.formula-embedding-editor.search_function.${i}`, w = new We(), M = (E) => {
1708
- const { searchList: b, active: I } = R.current;
1709
- switch (E) {
1710
- case L.ARROW_UP: {
1711
- S((A) => {
1712
- const D = Math.max(0, A - 1);
1713
- return k(D), D;
1707
+ const x = `sheet.formula-embedding-editor.search_function.${i}`, w = new He(), M = (I) => {
1708
+ const { searchList: E, active: b } = R.current;
1709
+ switch (I) {
1710
+ case D.ARROW_UP: {
1711
+ p((k) => {
1712
+ const L = Math.max(0, k - 1);
1713
+ return A(L), L;
1714
1714
  });
1715
1715
  break;
1716
1716
  }
1717
- case L.ARROW_DOWN: {
1718
- S((A) => {
1719
- const D = Math.min(b.length - 1, A + 1);
1720
- return k(D), D;
1717
+ case D.ARROW_DOWN: {
1718
+ p((k) => {
1719
+ const L = Math.min(E.length - 1, k + 1);
1720
+ return A(L), L;
1721
1721
  });
1722
1722
  break;
1723
1723
  }
1724
- case L.TAB:
1725
- case L.ENTER: {
1726
- const A = b[I];
1727
- C(A.name);
1724
+ case D.TAB:
1725
+ case D.ENTER: {
1726
+ const k = E[b];
1727
+ C(k.name);
1728
1728
  break;
1729
1729
  }
1730
- case L.ESC: {
1730
+ case D.ESC: {
1731
1731
  d(), c();
1732
1732
  break;
1733
1733
  }
@@ -1735,60 +1735,61 @@ function pi(e, t) {
1735
1735
  };
1736
1736
  return w.add(f.registerCommand({
1737
1737
  id: x,
1738
- type: ye.OPERATION,
1739
- handler(E, b) {
1740
- const { keyCode: I } = b;
1741
- M(I);
1738
+ type: Te.OPERATION,
1739
+ handler(I, E) {
1740
+ const { keyCode: b } = E;
1741
+ M(b);
1742
1742
  }
1743
- })), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((E) => ({
1743
+ })), [D.ARROW_UP, D.ARROW_DOWN, D.ENTER, D.ESC, D.TAB].map((I) => ({
1744
1744
  id: x,
1745
- binding: E,
1745
+ binding: I,
1746
1746
  preconditions: () => !0,
1747
1747
  priority: 1e3,
1748
1748
  staticParameters: {
1749
- eventType: Te.Keyboard,
1750
- keyCode: E
1749
+ eventType: xe.Keyboard,
1750
+ keyCode: I
1751
1751
  }
1752
- })).forEach((E) => {
1753
- w.add(a.registerShortcut(E));
1752
+ })).forEach((I) => {
1753
+ w.add(l.registerShortcut(I));
1754
1754
  }), () => {
1755
1755
  w.dispose();
1756
1756
  };
1757
1757
  }, [h]);
1758
- function k(x) {
1758
+ function A(x) {
1759
1759
  const w = v.current;
1760
1760
  if (!w) return;
1761
1761
  const M = w.children[x];
1762
1762
  if (!M) return;
1763
- const b = w.getBoundingClientRect().top, I = w.offsetHeight, A = M.getBoundingClientRect(), D = A.top, $ = A.height;
1764
- if (D >= 0 && D > b && D - b + $ <= I)
1763
+ const E = w.getBoundingClientRect().top, b = w.offsetHeight, k = M.getBoundingClientRect(), L = k.top, U = k.height;
1764
+ if (L >= 0 && L > E && L - E + U <= b)
1765
1765
  return;
1766
- const H = M.offsetTop - (I - $) / 2;
1766
+ const H = M.offsetTop - (b - U) / 2;
1767
1767
  w.scrollTo({
1768
1768
  top: H,
1769
1769
  behavior: "smooth"
1770
1770
  });
1771
1771
  }
1772
- const F = oe(() => {
1772
+ const F = se(() => {
1773
1773
  let x = "";
1774
1774
  return () => {
1775
- clearTimeout(x), p.current = !0, x = setTimeout(() => {
1776
- p.current = !1;
1775
+ clearTimeout(x), S.current = !0, x = setTimeout(() => {
1776
+ S.current = !1;
1777
1777
  }, 300);
1778
1778
  };
1779
1779
  }, []);
1780
- return h.length > 0 && l && /* @__PURE__ */ O(qt, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ O(
1780
+ return h.length > 0 && a && /* @__PURE__ */ O(en, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ O(
1781
1781
  "ul",
1782
1782
  {
1783
1783
  ref: (x) => {
1784
1784
  v.current = x, t && (t.current = x);
1785
1785
  },
1786
- className: pe("univer-m-0 univer-box-border univer-max-h-[400px] univer-w-[250px] univer-list-none univer-overflow-y-auto univer-rounded-lg univer-bg-white univer-p-2 univer-leading-5 univer-shadow-md univer-outline-none", sn, cr),
1787
- children: h.map((x, w) => /* @__PURE__ */ V(
1786
+ "data-u-comp": "sheets-formula-editor",
1787
+ className: ne("univer-m-0 univer-box-border univer-max-h-[400px] univer-w-[250px] univer-list-none univer-overflow-y-auto univer-rounded-lg univer-bg-white univer-p-2 univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", gn, at),
1788
+ children: h.map((x, w) => /* @__PURE__ */ W(
1788
1789
  "li",
1789
1790
  {
1790
- className: pe("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-1 univer-text-gray-900 univer-transition-colors dark:univer-text-white", {
1791
- "univer-bg-gray-200 dark:univer-bg-gray-600": g === w
1791
+ className: ne("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-1 univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
1792
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": g === w
1792
1793
  }),
1793
1794
  onMouseEnter: () => y(w),
1794
1795
  onMouseLeave: N,
@@ -1797,7 +1798,7 @@ function pi(e, t) {
1797
1798
  C(x.name), s && s.focus();
1798
1799
  },
1799
1800
  children: [
1800
- /* @__PURE__ */ V("span", { className: "univer-text-xs", children: [
1801
+ /* @__PURE__ */ W("span", { className: "univer-text-xs", children: [
1801
1802
  /* @__PURE__ */ O("span", { className: "univer-text-red-500", children: x.name.substring(0, m.length) }),
1802
1803
  /* @__PURE__ */ O("span", { children: x.name.slice(m.length) })
1803
1804
  ] }),
@@ -1815,9 +1816,9 @@ function pi(e, t) {
1815
1816
  }
1816
1817
  ) });
1817
1818
  }
1818
- const Ci = (e) => e.startsWith(zn.EQUALS) ? e.slice(1) : "", Dn = () => {
1819
- }, _i = Oe((e, t) => {
1820
- var fn, gn;
1819
+ const Ri = (e) => e.startsWith(nr.EQUALS) ? e.slice(1) : "", Bn = () => {
1820
+ }, Ei = Ne((e, t) => {
1821
+ var _n, Rn;
1821
1822
  const {
1822
1823
  errorText: n,
1823
1824
  initValue: o,
@@ -1825,70 +1826,70 @@ const Ci = (e) => e.startsWith(zn.EQUALS) ? e.slice(1) : "", Dn = () => {
1825
1826
  subUnitId: s,
1826
1827
  isFocus: c = !0,
1827
1828
  isSupportAcrossSheet: i = !1,
1828
- onFocus: a = Dn,
1829
- onBlur: f = Dn,
1829
+ onFocus: l = Bn,
1830
+ onBlur: f = Bn,
1830
1831
  onChange: h,
1831
1832
  onVerify: m,
1832
1833
  className: u,
1833
1834
  editorId: d,
1834
- moveCursor: l = !0,
1835
+ moveCursor: a = !0,
1835
1836
  onFormulaSelectingChange: v,
1836
1837
  keyboardEventConfig: g,
1837
- onMoveInEditor: S,
1838
- resetSelectionOnBlur: p = !0,
1838
+ onMoveInEditor: p,
1839
+ resetSelectionOnBlur: S = !0,
1839
1840
  autoScrollbar: _ = !0,
1840
1841
  isSingle: R = !0,
1841
1842
  disableSelectionOnClick: C = !1,
1842
1843
  autofocus: y = !0,
1843
1844
  disableContextMenu: N,
1844
- style: k
1845
- } = e, F = T(Be), x = Y(null), w = Q(h);
1846
- Cs(t, () => ({
1847
- isClickOutSide: (K) => x.current ? !x.current.contains(K.target) : !1
1845
+ style: A
1846
+ } = e, F = T(qe), x = G(null), w = J(h);
1847
+ Rs(t, () => ({
1848
+ isClickOutSide: (Y) => x.current ? !x.current.contains(Y.target) : !1
1848
1849
  }));
1849
- const M = Q(v), E = Y(null), b = Y(void 0), I = b.current, [A, D] = U(c), $ = Y(null), H = oe(() => d != null ? d : Br(`${uo}-${jr(4)}`), []), se = oe(() => n !== void 0, [n]), q = T(ee), _e = q.getUnit(H);
1850
- ve(_e == null ? void 0 : _e.change$);
1851
- const Ye = ti(), ne = qr.transform.getPlainText((gn = (fn = _e == null ? void 0 : _e.getBody()) == null ? void 0 : fn.dataStream) != null ? gn : ""), Z = Ke(ne), X = oe(() => Ci(ne), [ne]), he = oe(() => Ye(X), [X, Ye]), { isSelecting: te, isSelectingRef: fe } = ei({ unitId: r, subUnitId: s, editorId: H, isFocus: A, disableOnClick: C }), le = Y(""), De = T(xe).getRenderById(H), de = De == null ? void 0 : De.with(Qn), G = de == null ? void 0 : de.isFocusing, ge = oe(() => q.getCurrentTypeOfUnit$(J.UNIVER_DOC), [q]), Re = ve(ge), Ne = (Re == null ? void 0 : Re.getUnitId()) === H, Le = Y([]), be = te;
1852
- is(() => {
1853
- w(ne);
1854
- }, [ne, w]);
1855
- const Pt = Ir("="), $t = ri(r, s), Pe = Q((K, re = !0, Me, Ee) => {
1856
- if (!b.current) return;
1857
- le.current = K;
1858
- const mt = K[0] === "=" ? K.slice(1) : "", we = Ye(mt), Dr = we.reduce(($e, vt) => typeof vt == "object" ? `${$e}${vt.token}` : `${$e}${vt}`, ""), St = Pt(
1859
- b.current,
1860
- Dr === mt ? we : [],
1861
- re,
1862
- Ee
1850
+ const M = J(v), I = G(null), E = G(void 0), b = E.current, [k, L] = V(c), U = G(null), H = se(() => d != null ? d : qr(`${fo}-${Kr(4)}`), []), ie = se(() => n !== void 0, [n]), K = T(ee), Re = K.getUnit(H);
1851
+ Ce(Re == null ? void 0 : Re.change$);
1852
+ const et = ri(), re = Yr.transform.getPlainText((Rn = (_n = Re == null ? void 0 : Re.getBody()) == null ? void 0 : _n.dataStream) != null ? Rn : ""), X = Je(re), Q = se(() => Ri(re), [re]), ge = se(() => et(Q), [Q, et]), { isSelecting: te, isSelectingRef: me } = ni({ unitId: r, subUnitId: s, editorId: H, isFocus: k, disableOnClick: C }), le = G(""), Le = T(Oe).getRenderById(H), he = Le == null ? void 0 : Le.with(sr), Z = he == null ? void 0 : he.isFocusing, pe = se(() => K.getCurrentTypeOfUnit$(q.UNIVER_DOC), [K]), Ee = Ce(pe), Me = (Ee == null ? void 0 : Ee.getUnitId()) === H, $e = G([]), Ie = te;
1853
+ us(() => {
1854
+ w(re);
1855
+ }, [re, w]);
1856
+ const Kt = Tr("="), Yt = si(r, s), Pe = J((Y, oe = !0, we, be) => {
1857
+ if (!E.current) return;
1858
+ le.current = Y;
1859
+ const bt = Y[0] === "=" ? Y.slice(1) : "", ke = et(bt), $r = ke.reduce((Ue, Tt) => typeof Tt == "object" ? `${Ue}${Tt.token}` : `${Ue}${Tt}`, ""), yt = Kt(
1860
+ E.current,
1861
+ $r === bt ? ke : [],
1862
+ oe,
1863
+ be
1863
1864
  );
1864
- if (Le.current = St, Me) {
1865
- const $e = Ee != null ? Ee : I == null ? void 0 : I.getSelectionRanges();
1866
- if (($e == null ? void 0 : $e.length) !== 1)
1865
+ if ($e.current = yt, we) {
1866
+ const Ue = be != null ? be : b == null ? void 0 : b.getSelectionRanges();
1867
+ if ((Ue == null ? void 0 : Ue.length) !== 1)
1867
1868
  return;
1868
- const Lr = $e[0].startOffset - 1, Pr = dn(we, Lr, !1), mn = fr(we, Pr);
1869
- if (mn >= 0) {
1870
- const Sn = St.splice(mn, 1)[0];
1871
- Sn && St.push(Sn);
1869
+ const Pr = Ue[0].startOffset - 1, Ur = Sn(ke, Pr, !1), En = mr(ke, Ur);
1870
+ if (En >= 0) {
1871
+ const In = yt.splice(En, 1)[0];
1872
+ In && yt.push(In);
1872
1873
  }
1873
- $t(A ? St : [], b.current);
1874
+ Yt(k ? yt : [], E.current);
1874
1875
  }
1875
1876
  });
1876
- P(() => {
1877
- A && Pe(ne, !1, !0);
1878
- }, [A]), P(() => {
1879
- if (A) {
1880
- if (le.current === ne) return;
1881
- Pe(ne, !1, !0);
1877
+ $(() => {
1878
+ k && Pe(re, !1, !0);
1879
+ }, [k]), $(() => {
1880
+ if (k) {
1881
+ if (le.current === re) return;
1882
+ Pe(re, !1, !0);
1882
1883
  }
1883
- }, [ne]), gi(A, m, ne);
1884
- const ze = zs(I), hn = li(A, r, s);
1885
- P(() => {
1886
- var K;
1887
- M(te, (K = de == null ? void 0 : de.isFocusing) != null ? K : !0);
1888
- }, [M, te]), jo(A, g, I), It(() => {
1889
- let K;
1890
- if ($.current) {
1891
- K = F.register({
1884
+ }, [re]), pi(k, m, re);
1885
+ const nt = Xs(b), Cn = ui(k, r, s);
1886
+ $(() => {
1887
+ var Y;
1888
+ M(te, (Y = he == null ? void 0 : he.isFocusing) != null ? Y : !0);
1889
+ }, [M, te]), Yo(k, g, b), At(() => {
1890
+ let Y;
1891
+ if (U.current) {
1892
+ Y = F.register({
1892
1893
  autofocus: y,
1893
1894
  editorUnitId: H,
1894
1895
  initialSnapshot: {
@@ -1903,117 +1904,117 @@ const Ci = (e) => e.startsWith(zn.EQUALS) ? e.slice(1) : "", Dn = () => {
1903
1904
  },
1904
1905
  documentStyle: {}
1905
1906
  }
1906
- }, $.current);
1907
- const re = F.getEditor(H);
1908
- b.current = re, Pe(o, !1, !0);
1907
+ }, U.current);
1908
+ const oe = F.getEditor(H);
1909
+ E.current = oe, Pe(o, !1, !0);
1909
1910
  }
1910
1911
  return () => {
1911
- K == null || K.dispose();
1912
+ Y == null || Y.dispose();
1912
1913
  };
1913
- }, []), It(() => {
1914
- c ? (D(c), ze()) : (p && (I == null || I.blur(), hn()), D(c));
1915
- }, [c, I, ze, hn, p]);
1916
- const { checkScrollBar: wr } = qo(I, R, _);
1917
- ci(A, !!(te && Ne), r, N), ii(!!(A && G && l), be, I, S);
1918
- const Ar = Q((K, re, Me) => {
1919
- if (!G)
1914
+ }, []), At(() => {
1915
+ c ? (L(c), nt()) : (S && (b == null || b.blur(), Cn()), L(c));
1916
+ }, [c, b, nt, Cn, S]);
1917
+ const { checkScrollBar: Ar } = Go(b, R, _);
1918
+ li(k, !!(te && Me), r, N), ai(!!(k && Z && a), Ie, b, p);
1919
+ const Fr = J((Y, oe, we) => {
1920
+ if (!Z)
1920
1921
  return;
1921
- const Ee = re !== -1 ? [{ startOffset: re + 1, endOffset: re + 1, collapsed: !0 }] : void 0;
1922
- Pe(`=${K}`, !0, Me, Ee), Me && (ze(), re !== -1 && setTimeout(() => {
1923
- const mt = { startOffset: re + 1, endOffset: re + 1 }, we = I == null ? void 0 : I.render.with(Ko);
1924
- we == null || we.scrollToRange({ ...mt, collapsed: !0 });
1925
- }, 50), wr());
1922
+ const be = oe !== -1 ? [{ startOffset: oe + 1, endOffset: oe + 1, collapsed: !0 }] : void 0;
1923
+ Pe(`=${Y}`, !0, we, be), we && (nt(), oe !== -1 && setTimeout(() => {
1924
+ const bt = { startOffset: oe + 1, endOffset: oe + 1 }, ke = b == null ? void 0 : b.render.with(Zo);
1925
+ ke == null || ke.scrollToRange({ ...bt, collapsed: !0 });
1926
+ }, 50), Ar());
1926
1927
  });
1927
- hi(
1928
- A && !!(te && Ne),
1929
- A,
1930
- fe,
1928
+ gi(
1929
+ k && !!(te && Me),
1930
+ k,
1931
+ me,
1931
1932
  r,
1932
1933
  s,
1933
- Le,
1934
+ $e,
1934
1935
  i,
1935
- !!be,
1936
- I,
1937
- Ar
1938
- ), fi(A && !!(te && Ne), r, i, D, f, () => {
1939
- Pe(Z.current, !1, !0);
1936
+ !!Ie,
1937
+ b,
1938
+ Fr
1939
+ ), mi(k && !!(te && Me), r, i, L, f, () => {
1940
+ Pe(X.current, !1, !0);
1940
1941
  });
1941
- const kr = (K) => {
1942
- if (K) {
1943
- const re = I == null ? void 0 : I.getSelectionRanges();
1944
- if (re && re.length === 1) {
1945
- const Me = re[0];
1946
- if (Me.collapsed) {
1947
- const Ee = K.offset;
1942
+ const Dr = (Y) => {
1943
+ if (Y) {
1944
+ const oe = b == null ? void 0 : b.getSelectionRanges();
1945
+ if (oe && oe.length === 1) {
1946
+ const we = oe[0];
1947
+ if (we.collapsed) {
1948
+ const be = Y.offset;
1948
1949
  setTimeout(() => {
1949
- I == null || I.setSelectionRanges([{ startOffset: Me.startOffset - Ee, endOffset: Me.endOffset - Ee }]);
1950
+ b == null || b.setSelectionRanges([{ startOffset: we.startOffset - be, endOffset: we.endOffset - be }]);
1950
1951
  }, 30);
1951
1952
  }
1952
1953
  }
1953
- ze(), Pe(`=${K.text}`);
1954
+ nt(), Pe(`=${Y.text}`);
1954
1955
  }
1955
- }, Fr = () => {
1956
- D(!0), a(), ze();
1956
+ }, Lr = () => {
1957
+ L(!0), l(), nt();
1957
1958
  };
1958
- return /* @__PURE__ */ V("div", { className: u, children: [
1959
+ return /* @__PURE__ */ W("div", { className: u, children: [
1959
1960
  /* @__PURE__ */ O(
1960
1961
  "div",
1961
1962
  {
1962
- className: pe(
1963
+ className: ne(
1963
1964
  `
1964
1965
  univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-items-center
1965
1966
  univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1
1966
1967
  `,
1967
1968
  {
1968
- "univer-ring-primary-500": A,
1969
- "univer-ring-red-500": se
1969
+ "univer-ring-primary-500": k,
1970
+ "univer-ring-red-500": ie
1970
1971
  }
1971
1972
  ),
1972
1973
  ref: x,
1973
1974
  children: /* @__PURE__ */ O(
1974
1975
  "div",
1975
1976
  {
1976
- ref: $,
1977
+ ref: U,
1977
1978
  className: "univer-relative univer-h-full univer-w-full",
1978
- onMouseUp: Fr
1979
+ onMouseUp: Lr
1979
1980
  }
1980
1981
  )
1981
1982
  }
1982
1983
  ),
1983
1984
  n !== void 0 ? /* @__PURE__ */ O("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }) : null,
1984
- I ? /* @__PURE__ */ O(
1985
- Gs,
1985
+ b ? /* @__PURE__ */ O(
1986
+ zs,
1986
1987
  {
1987
- editor: I,
1988
- isFocus: A,
1989
- formulaText: ne,
1990
- onClose: () => ze()
1988
+ editor: b,
1989
+ isFocus: k,
1990
+ formulaText: re,
1991
+ onClose: () => nt()
1991
1992
  }
1992
1993
  ) : null,
1993
- I ? /* @__PURE__ */ O(
1994
- vi,
1994
+ b ? /* @__PURE__ */ O(
1995
+ Ci,
1995
1996
  {
1996
- isFocus: A,
1997
- sequenceNodes: he,
1998
- onSelect: kr,
1999
- ref: E,
2000
- editor: I
1997
+ isFocus: k,
1998
+ sequenceNodes: ge,
1999
+ onSelect: Dr,
2000
+ ref: I,
2001
+ editor: b
2001
2002
  }
2002
2003
  ) : null
2003
2004
  ] });
2004
2005
  });
2005
- function Ri(e, t, n, o) {
2006
- const r = T(Ce), s = Ir(""), c = ve(e == null ? void 0 : e.getDocumentDataModel().change$), [i, a] = U([]), f = T(ho), h = Y(""), m = T(ee);
2007
- return P(() => {
2006
+ function Ii(e, t, n, o) {
2007
+ const r = T(_e), s = Tr(""), c = Ce(e == null ? void 0 : e.getDocumentDataModel().change$), [i, l] = V([]), f = T(go), h = G(""), m = T(ee);
2008
+ return $(() => {
2008
2009
  if (!e) return;
2009
2010
  const u = e.getDocumentDataModel().getPlainText();
2010
2011
  if (h.current === u)
2011
2012
  return;
2012
2013
  h.current = u;
2013
2014
  const d = r.sequenceNodesBuilder(u);
2014
- a(d != null ? d : []);
2015
- }, [c, e, r]), P(() => {
2016
- var l, v;
2015
+ l(d != null ? d : []);
2016
+ }, [c, e, r]), $(() => {
2017
+ var a, v;
2017
2018
  if (!e) return;
2018
2019
  if (!t) {
2019
2020
  const g = e.getDocumentData();
@@ -2021,19 +2022,19 @@ function Ri(e, t, n, o) {
2021
2022
  ...g,
2022
2023
  body: {
2023
2024
  ...g.body,
2024
- dataStream: (v = (l = g.body) == null ? void 0 : l.dataStream) != null ? v : "",
2025
+ dataStream: (v = (a = g.body) == null ? void 0 : a.dataStream) != null ? v : "",
2025
2026
  textRuns: []
2026
2027
  }
2027
2028
  });
2028
2029
  return;
2029
2030
  }
2030
- const u = s(e, i, !1), d = new We();
2031
+ const u = s(e, i, !1), d = new He();
2031
2032
  return u.forEach((g) => {
2032
- const S = rt(g.token), p = m.getCurrentUnitForType(J.UNIVER_SHEET), _ = p == null ? void 0 : p.getActiveSheet();
2033
- if (!S.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || S.sheetName && (_ == null ? void 0 : _.getName()) !== S.sheetName)
2033
+ const p = dt(g.token), S = m.getCurrentUnitForType(q.UNIVER_SHEET), _ = S == null ? void 0 : S.getActiveSheet();
2034
+ if (!p.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || p.sheetName && (_ == null ? void 0 : _.getName()) !== p.sheetName)
2034
2035
  return;
2035
- const R = new Xt(g.themeColor).toRgb(), C = f.addShape({
2036
- range: S.range,
2036
+ const R = new cn(g.themeColor).toRgb(), C = f.addShape({
2037
+ range: p.range,
2037
2038
  style: {
2038
2039
  stroke: g.themeColor,
2039
2040
  fill: `rgba(${R.r}, ${R.g}, ${R.b}, 0.1)`,
@@ -2048,18 +2049,18 @@ function Ri(e, t, n, o) {
2048
2049
  }, [e, t, s, f, i]), { sequenceNodes: i };
2049
2050
  }
2050
2051
  function bi(e) {
2051
- const t = T(en), { supportAcrossSheet: n = !1, unitId: o, subUnitId: r, onChange: s } = e, i = T(ee).getUnit(o, J.UNIVER_SHEET), a = Q(s), f = Q((h, m) => {
2052
+ const t = T(un), { supportAcrossSheet: n = !1, unitId: o, subUnitId: r, onChange: s } = e, i = T(ee).getUnit(o, q.UNIVER_SHEET), l = J(s), f = J((h, m) => {
2052
2053
  const u = i == null ? void 0 : i.getActiveSheet();
2053
2054
  if (!u || !n && u.getSheetId() !== r || !(h != null && h.length)) return;
2054
- const d = h.map((l) => ({
2055
- range: l.range,
2055
+ const d = h.map((a) => ({
2056
+ range: a.range,
2056
2057
  unitId: o,
2057
2058
  sheetName: u.getSheetId() === r ? "" : u.getName()
2058
2059
  }));
2059
- a(d, m);
2060
+ l(d, m);
2060
2061
  });
2061
- P(() => {
2062
- const h = new We();
2062
+ $(() => {
2063
+ const h = new He();
2063
2064
  return h.add(t.selectionMoveStart$.subscribe((m) => {
2064
2065
  f(m, !0);
2065
2066
  })), h.add(t.selectionMoving$.subscribe((m) => {
@@ -2071,14 +2072,14 @@ function bi(e) {
2071
2072
  };
2072
2073
  }, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
2073
2074
  }
2074
- const Ln = (e) => !e.some((n) => {
2075
+ const jn = (e) => !e.some((n) => {
2075
2076
  if (typeof n == "string") {
2076
- if (n !== et.COMMA)
2077
+ if (n !== ct.COMMA)
2077
2078
  return !0;
2078
2079
  } else if (n.nodeType !== z.REFERENCE)
2079
2080
  return !0;
2080
2081
  return !1;
2081
- }), Ei = (e) => {
2082
+ }), yi = (e) => {
2082
2083
  if (e.endColumn < e.startColumn) {
2083
2084
  const t = e.endColumn;
2084
2085
  e.endColumn = e.startColumn, e.startColumn = t;
@@ -2089,7 +2090,7 @@ const Ln = (e) => !e.some((n) => {
2089
2090
  }
2090
2091
  return e;
2091
2092
  };
2092
- function Ii(e) {
2093
+ function Ti(e) {
2093
2094
  const {
2094
2095
  visible: t,
2095
2096
  initialValue: n,
@@ -2098,20 +2099,20 @@ function Ii(e) {
2098
2099
  maxRangeCount: s = 1 / 0,
2099
2100
  supportAcrossSheet: c,
2100
2101
  onConfirm: i,
2101
- onClose: a,
2102
+ onClose: l,
2102
2103
  onShowBySelection: f
2103
- } = e, h = T(tt), m = T(Ce), [u, d] = U([]), [l, v] = U(0), g = Y(null);
2104
- P(() => {
2104
+ } = e, h = T(lt), m = T(_e), [u, d] = V([]), [a, v] = V(0), g = G(null);
2105
+ $(() => {
2105
2106
  if (t && n.length) {
2106
- const R = n.map((C) => C.sheetName ? at(C.sheetName, C.range) : Se(C.range));
2107
+ const R = n.map((C) => C.sheetName ? St(C.sheetName, C.range) : Se(C.range));
2107
2108
  d(R), v(R.length - 1);
2108
2109
  } else
2109
2110
  d([""]), v(0);
2110
2111
  }, [t]);
2111
- const S = (R, C) => {
2112
+ const p = (R, C) => {
2112
2113
  const y = [...u];
2113
2114
  y[R] = C, d(y);
2114
- }, p = () => {
2115
+ }, S = () => {
2115
2116
  d([...u, ""]), v(u.length);
2116
2117
  }, _ = (R) => {
2117
2118
  u.splice(R, 1), d([...u]);
@@ -2123,20 +2124,20 @@ function Ii(e) {
2123
2124
  onChange: (R, C) => {
2124
2125
  if (!t && f != null && f(R))
2125
2126
  return;
2126
- const y = new Set(u), N = R.map((x) => x.sheetName ? at(x.sheetName, x.range) : Se(x.range)), k = N.filter((x) => !y.has(x));
2127
- if (!k.length) return;
2127
+ const y = new Set(u), N = R.map((x) => x.sheetName ? St(x.sheetName, x.range) : Se(x.range)), A = N.filter((x) => !y.has(x));
2128
+ if (!A.length) return;
2128
2129
  const F = [...u];
2129
2130
  if (N.length > 1) {
2130
- C || F.splice(l, 1), F.push(...k);
2131
+ C || F.splice(a, 1), F.push(...A);
2131
2132
  const x = F.slice(0, s);
2132
2133
  d(x), v(x.length - 1), requestAnimationFrame(() => {
2133
2134
  var w;
2134
2135
  (w = g.current) == null || w.scrollTo({ top: g.current.scrollHeight });
2135
2136
  });
2136
2137
  } else {
2137
- F.splice(l, 1, ...k);
2138
+ F.splice(a, 1, ...A);
2138
2139
  const x = F.slice(0, s);
2139
- d(x), v(l + k.length - 1);
2140
+ d(x), v(a + A.length - 1);
2140
2141
  }
2141
2142
  }
2142
2143
  }), /* @__PURE__ */ O(
@@ -2148,50 +2149,50 @@ function Ii(e) {
2148
2149
  draggable: !0,
2149
2150
  mask: !1,
2150
2151
  maskClosable: !1,
2151
- footer: /* @__PURE__ */ V("footer", { children: [
2152
- /* @__PURE__ */ O(Qe, { onClick: a, children: h.t("rangeSelector.cancel") }),
2152
+ footer: /* @__PURE__ */ W("footer", { className: "univer-flex univer-gap-2", children: [
2153
+ /* @__PURE__ */ O(st, { onClick: l, children: h.t("rangeSelector.cancel") }),
2153
2154
  /* @__PURE__ */ O(
2154
- Qe,
2155
+ st,
2155
2156
  {
2156
- style: { marginLeft: 10 },
2157
2157
  variant: "primary",
2158
2158
  onClick: () => {
2159
2159
  i(
2160
2160
  u.filter((R) => {
2161
2161
  const C = m.sequenceNodesBuilder(R);
2162
2162
  return C && C.length === 1 && typeof C[0] != "string" && C[0].nodeType === z.REFERENCE;
2163
- }).map((R) => rt(R)).map((R) => ({ ...R, range: Ei(R.range) }))
2163
+ }).map((R) => dt(R)).map((R) => ({ ...R, range: yi(R.range) }))
2164
2164
  );
2165
2165
  },
2166
2166
  children: h.t("rangeSelector.confirm")
2167
2167
  }
2168
2168
  )
2169
2169
  ] }),
2170
- onClose: a,
2171
- children: /* @__PURE__ */ V(
2170
+ onClose: l,
2171
+ children: /* @__PURE__ */ W(
2172
2172
  "div",
2173
2173
  {
2174
2174
  ref: g,
2175
- className: pe("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", cr),
2175
+ className: ne("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", at),
2176
2176
  children: [
2177
- u.map((R, C) => /* @__PURE__ */ V(
2177
+ u.map((R, C) => /* @__PURE__ */ W(
2178
2178
  "div",
2179
2179
  {
2180
2180
  className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
2181
2181
  children: [
2182
2182
  /* @__PURE__ */ O(
2183
- lr,
2183
+ ur,
2184
2184
  {
2185
- className: "univer-w-full",
2185
+ className: ne("univer-w-full", {
2186
+ "univer-border-primary-600": a === C
2187
+ }),
2186
2188
  placeholder: h.t("rangeSelector.placeHolder"),
2187
2189
  onFocus: () => v(C),
2188
2190
  value: R,
2189
- onChange: (y) => S(C, y),
2190
- style: { borderColor: l === C ? "rgb(var(--primary-color))" : void 0 }
2191
+ onChange: (y) => p(C, y)
2191
2192
  }
2192
2193
  ),
2193
2194
  u.length > 1 && /* @__PURE__ */ O(
2194
- vr,
2195
+ Cr,
2195
2196
  {
2196
2197
  className: "univer-cursor-pointer",
2197
2198
  onClick: () => _(C)
@@ -2201,8 +2202,8 @@ function Ii(e) {
2201
2202
  },
2202
2203
  C
2203
2204
  )),
2204
- u.length < s && /* @__PURE__ */ O("div", { children: /* @__PURE__ */ V(Qe, { variant: "link", onClick: p, children: [
2205
- /* @__PURE__ */ O(pr, {}),
2205
+ u.length < s && /* @__PURE__ */ O("div", { children: /* @__PURE__ */ W(st, { variant: "link", onClick: S, children: [
2206
+ /* @__PURE__ */ O(_r, {}),
2206
2207
  /* @__PURE__ */ O("span", { children: h.t("rangeSelector.addAnotherRange") })
2207
2208
  ] }) })
2208
2209
  ]
@@ -2211,112 +2212,118 @@ function Ii(e) {
2211
2212
  }
2212
2213
  );
2213
2214
  }
2214
- function yi(e) {
2215
- return e.split(et.COMMA).filter((t) => !!t).map((t) => rt(t));
2215
+ function xi(e) {
2216
+ return e.split(ct.COMMA).filter((t) => !!t).map((t) => dt(t));
2216
2217
  }
2217
- function Ti(e) {
2218
- return e.map((t) => t.sheetName ? at(t.sheetName, t.range) : Se(t.range)).join(et.COMMA);
2218
+ function Oi(e) {
2219
+ return e.map((t) => t.sheetName ? St(t.sheetName, t.range) : Se(t.range)).join(ct.COMMA);
2219
2220
  }
2220
- function yr(e) {
2221
- const [t, n] = U(null), {
2221
+ function xr(e) {
2222
+ const [t, n] = V(null), {
2222
2223
  onVerify: o,
2223
2224
  selectorRef: r,
2224
2225
  unitId: s,
2225
2226
  subUnitId: c,
2226
2227
  maxRangeCount: i,
2227
- supportAcrossSheet: a,
2228
+ supportAcrossSheet: l,
2228
2229
  autoFocus: f,
2229
2230
  onChange: h,
2230
2231
  onRangeSelectorDialogVisibleChange: m,
2231
2232
  onClickOutside: u,
2232
2233
  onFocusChange: d,
2233
- forceShowDialogWhenSelectionChanged: l,
2234
+ forceShowDialogWhenSelectionChanged: a,
2234
2235
  hideEditor: v,
2235
2236
  resetRange: g
2236
- } = e, [S, p] = U(f != null ? f : !1), [_, R] = U(!1), [C, y] = U([]), N = T(tt), k = T(Be), { sequenceNodes: F } = Ri(t, S, s, c), x = Ke(F), w = T(ue), M = Q(() => {
2237
- t == null || t.setSelectionRanges([]), t == null || t.blur(), k.blur();
2238
- }), E = Q(() => {
2239
- var b;
2240
- M(), y(yi((b = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? b : "")), R(!0);
2237
+ } = e, [p, S] = V(f != null ? f : !1), [_, R] = V(!1), [C, y] = V([]), N = T(lt), A = T(qe), { sequenceNodes: F } = Ii(t, p, s, c), x = Je(F), w = T(de), M = J(() => {
2238
+ t == null || t.setSelectionRanges([]), t == null || t.blur(), A.blur();
2239
+ }), I = J(() => {
2240
+ var E;
2241
+ M(), y(xi((E = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? E : "")), R(!0);
2241
2242
  });
2242
- return P(() => {
2243
+ return $(() => {
2243
2244
  r && (r.current = {
2244
2245
  get editor() {
2245
2246
  return t;
2246
2247
  },
2247
2248
  focus() {
2248
- k.focus(t.getEditorId());
2249
+ A.focus(t.getEditorId());
2249
2250
  },
2250
2251
  blur: M,
2251
- verify: () => Ln(x.current),
2252
- showDialog: (b) => {
2253
- M(), y(b), R(!0);
2252
+ verify: () => jn(x.current),
2253
+ showDialog: (E) => {
2254
+ M(), y(E), R(!0);
2254
2255
  },
2255
2256
  hideDialog: () => {
2256
2257
  y([]), R(!1);
2257
2258
  },
2258
2259
  getValue: () => {
2259
- var b;
2260
- return (b = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? b : "";
2260
+ var E;
2261
+ return (E = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? E : "";
2261
2262
  }
2262
2263
  });
2263
- }, [M, t, k, r, x]), P(() => {
2264
- var b;
2265
- o == null || o(Ln(F), (b = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? b : "");
2266
- }, [F]), P(() => {
2264
+ }, [M, t, A, r, x]), $(() => {
2265
+ var E;
2266
+ o == null || o(jn(F), (E = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? E : "");
2267
+ }, [F]), $(() => {
2267
2268
  m == null || m(_);
2268
- }, [_]), P(() => {
2269
+ }, [_]), $(() => {
2269
2270
  if (_ && g)
2270
2271
  return () => {
2271
- const b = {
2272
+ const E = {
2272
2273
  unitId: s,
2273
2274
  subUnitId: c,
2274
2275
  selections: g
2275
2276
  };
2276
- w.executeCommand(tn.id, b);
2277
+ w.executeCommand(dn.id, E);
2277
2278
  };
2278
- }, [_]), /* @__PURE__ */ V(fs, { children: [
2279
+ }, [_]), /* @__PURE__ */ W(ms, { children: [
2279
2280
  v ? null : /* @__PURE__ */ O(
2280
- Yo,
2281
+ zo,
2281
2282
  {
2282
2283
  isSingle: !0,
2283
2284
  ...e,
2284
- onFocusChange: (b, I) => {
2285
- p(b), d == null || d(b, I);
2285
+ onFocusChange: (E, b) => {
2286
+ S(E), d == null || d(E, b);
2286
2287
  },
2287
2288
  editorRef: n,
2288
2289
  onClickOutside: () => {
2289
- p(!1), M(), u == null || u();
2290
+ S(!1), M(), u == null || u();
2290
2291
  },
2291
- icon: /* @__PURE__ */ O(ms, { title: N.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ O(_r, { className: "univer-cursor-pointer", onClick: E }) })
2292
+ icon: /* @__PURE__ */ O(vs, { title: N.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ O(
2293
+ Er,
2294
+ {
2295
+ className: "univer-cursor-pointer dark:!univer-text-gray-300",
2296
+ onClick: I
2297
+ }
2298
+ ) })
2292
2299
  }
2293
2300
  ),
2294
2301
  /* @__PURE__ */ O(
2295
- Ii,
2302
+ Ti,
2296
2303
  {
2297
2304
  initialValue: C,
2298
2305
  unitId: s,
2299
2306
  subUnitId: c,
2300
2307
  visible: _,
2301
2308
  maxRangeCount: i,
2302
- onConfirm: (b) => {
2303
- const I = Ti(b), A = Kr.newEmptyData();
2304
- A.body.dataStream = I, t == null || t.replaceText(I, !1), h == null || h(A, I), R(!1), y([]), requestAnimationFrame(() => {
2309
+ onConfirm: (E) => {
2310
+ const b = Oi(E), k = Gr.newEmptyData();
2311
+ k.body.dataStream = b, t == null || t.replaceText(b, !1), h == null || h(k, b), R(!1), y([]), requestAnimationFrame(() => {
2305
2312
  M();
2306
2313
  });
2307
2314
  },
2308
2315
  onClose: () => {
2309
2316
  R(!1), y([]);
2310
2317
  },
2311
- supportAcrossSheet: a,
2312
- onShowBySelection: (b) => S || l ? (y(b), R(!0), !1) : !0
2318
+ supportAcrossSheet: l,
2319
+ onShowBySelection: (E) => p || a ? (y(E), R(!0), !1) : !0
2313
2320
  }
2314
2321
  )
2315
2322
  ] });
2316
2323
  }
2317
- class Tr {
2324
+ class Or {
2318
2325
  constructor() {
2319
- j(this, "_currentSelector$", new Zn(null));
2326
+ j(this, "_currentSelector$", new rr(null));
2320
2327
  j(this, "currentSelector$", this._currentSelector$.asObservable());
2321
2328
  }
2322
2329
  showRangeSelectorDialog(t) {
@@ -2328,56 +2335,56 @@ class Tr {
2328
2335
  return this._currentSelector$.next(t), o;
2329
2336
  }
2330
2337
  }
2331
- var xi = Object.getOwnPropertyDescriptor, Oi = (e, t, n, o) => {
2332
- for (var r = o > 1 ? void 0 : o ? xi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2338
+ var Ni = Object.getOwnPropertyDescriptor, Mi = (e, t, n, o) => {
2339
+ for (var r = o > 1 ? void 0 : o ? Ni(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2333
2340
  (c = e[s]) && (r = c(r) || r);
2334
2341
  return r;
2335
- }, _t = (e, t) => (n, o) => t(n, o, e);
2336
- let yt = class extends nt {
2342
+ }, Nt = (e, t) => (n, o) => t(n, o, e);
2343
+ let Ft = class extends ut {
2337
2344
  constructor(e, t, n, o) {
2338
2345
  super(), this._sheetInterceptorService = e, this._univerInstanceService = t, this._formulaDataModel = n, this._lexerTreeBuilder = o, this._initialize();
2339
2346
  }
2340
2347
  _initialize() {
2341
2348
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2342
- getMutations: (e) => e.id === Xo.id ? this._reorderFormula(e.params) : {
2349
+ getMutations: (e) => e.id === es.id ? this._reorderFormula(e.params) : {
2343
2350
  redos: [],
2344
2351
  undos: []
2345
2352
  }
2346
2353
  }));
2347
2354
  }
2348
2355
  _reorderFormula(e) {
2349
- const t = [], n = [], { unitId: o, subUnitId: r, range: s, order: c } = e, i = this._univerInstanceService.getUniverSheetInstance(o), a = i == null ? void 0 : i.getSheetBySheetId(r);
2350
- if (!a)
2356
+ const t = [], n = [], { unitId: o, subUnitId: r, range: s, order: c } = e, i = this._univerInstanceService.getUniverSheetInstance(o), l = i == null ? void 0 : i.getSheetBySheetId(r);
2357
+ if (!l)
2351
2358
  return {
2352
2359
  redos: t,
2353
2360
  undos: n
2354
2361
  };
2355
- const f = a.getCellMatrix(), h = new ke(), m = new ke();
2362
+ const f = l.getCellMatrix(), h = new Fe(), m = new Fe();
2356
2363
  let u = !1;
2357
- return Yr.foreach(s, (d, l) => {
2364
+ return Zr.foreach(s, (d, a) => {
2358
2365
  let v = d;
2359
2366
  c.hasOwnProperty(d) && (v = c[d]);
2360
- const g = f.getValue(v, l);
2367
+ const g = f.getValue(v, a);
2361
2368
  if (g != null && g.f || g != null && g.si) {
2362
2369
  u = !0;
2363
- const S = this._formulaDataModel.getFormulaStringByCell(v, l, r, o), p = this._lexerTreeBuilder.moveFormulaRefOffset(
2364
- S,
2370
+ const p = this._formulaDataModel.getFormulaStringByCell(v, a, r, o), S = this._lexerTreeBuilder.moveFormulaRefOffset(
2371
+ p,
2365
2372
  0,
2366
2373
  d - v
2367
- ), _ = Je.deepClone(g);
2368
- _.f = p, _.si = null, h.setValue(d, l, _);
2374
+ ), _ = it.deepClone(g);
2375
+ _.f = S, _.si = null, h.setValue(d, a, _);
2369
2376
  } else
2370
- h.setValue(d, l, g);
2371
- m.setValue(d, l, f.getValue(d, l));
2377
+ h.setValue(d, a, g);
2378
+ m.setValue(d, a, f.getValue(d, a));
2372
2379
  }), u ? (t.push({
2373
- id: bt.id,
2380
+ id: wt.id,
2374
2381
  params: {
2375
2382
  unitId: o,
2376
2383
  subUnitId: r,
2377
2384
  cellValue: h.getMatrix()
2378
2385
  }
2379
2386
  }), n.push({
2380
- id: bt.id,
2387
+ id: wt.id,
2381
2388
  params: {
2382
2389
  unitId: o,
2383
2390
  subUnitId: r,
@@ -2392,39 +2399,39 @@ let yt = class extends nt {
2392
2399
  };
2393
2400
  }
2394
2401
  };
2395
- yt = Oi([
2396
- _t(0, B(nn)),
2397
- _t(1, B(ee)),
2398
- _t(2, B(gt)),
2399
- _t(3, B(Ce))
2400
- ], yt);
2401
- const Ni = "sheets-formula-ui.base.config", Pn = {};
2402
- function Mi(e) {
2403
- return e.getContextValue(Gr) && e.getContextValue(zr);
2404
- }
2405
- function xr(e, t = !1) {
2406
- return !t && !(Ie(e == null ? void 0 : e.f) || He(e == null ? void 0 : e.si)) ? null : typeof (e == null ? void 0 : e.v) == "string" && Mo.has(e.v) ? e.v : null;
2407
- }
2408
- var wi = Object.getOwnPropertyDescriptor, Ai = (e, t, n, o) => {
2409
- for (var r = o > 1 ? void 0 : o ? wi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2402
+ Ft = Mi([
2403
+ Nt(0, B(hn)),
2404
+ Nt(1, B(ee)),
2405
+ Nt(2, B(It)),
2406
+ Nt(3, B(_e))
2407
+ ], Ft);
2408
+ const wi = "sheets-formula-ui.base.config", qn = {};
2409
+ function ki(e) {
2410
+ return e.getContextValue(zr) && e.getContextValue(Xr);
2411
+ }
2412
+ function Nr(e, t = !1) {
2413
+ return !t && !(ye(e == null ? void 0 : e.f) || Be(e == null ? void 0 : e.si)) ? null : typeof (e == null ? void 0 : e.v) == "string" && Ao.has(e.v) ? e.v : null;
2414
+ }
2415
+ var Ai = Object.getOwnPropertyDescriptor, Fi = (e, t, n, o) => {
2416
+ for (var r = o > 1 ? void 0 : o ? Ai(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2410
2417
  (c = e[s]) && (r = c(r) || r);
2411
2418
  return r;
2412
- }, it = (e, t) => (n, o) => t(n, o, e);
2413
- const Ht = "SHEET_FORMULA_ALERT", ki = {
2414
- [ie.DIV_BY_ZERO]: "divByZero",
2415
- [ie.NAME]: "name",
2416
- [ie.VALUE]: "value",
2417
- [ie.NUM]: "num",
2418
- [ie.NA]: "na",
2419
- [ie.CYCLE]: "cycle",
2420
- [ie.REF]: "ref",
2421
- [ie.SPILL]: "spill",
2422
- [ie.CALC]: "calc",
2423
- [ie.ERROR]: "error",
2424
- [ie.CONNECT]: "connect",
2425
- [ie.NULL]: "null"
2419
+ }, mt = (e, t) => (n, o) => t(n, o, e);
2420
+ const Xt = "SHEET_FORMULA_ALERT", Di = {
2421
+ [ce.DIV_BY_ZERO]: "divByZero",
2422
+ [ce.NAME]: "name",
2423
+ [ce.VALUE]: "value",
2424
+ [ce.NUM]: "num",
2425
+ [ce.NA]: "na",
2426
+ [ce.CYCLE]: "cycle",
2427
+ [ce.REF]: "ref",
2428
+ [ce.SPILL]: "spill",
2429
+ [ce.CALC]: "calc",
2430
+ [ce.ERROR]: "error",
2431
+ [ce.CONNECT]: "connect",
2432
+ [ce.NULL]: "null"
2426
2433
  };
2427
- let Gt = class extends nt {
2434
+ let rn = class extends ut {
2428
2435
  constructor(e, t, n, o, r, s) {
2429
2436
  super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = n, this._localeService = o, this._formulaDataModel = r, this._zenZoneService = s, this._init();
2430
2437
  }
@@ -2432,29 +2439,29 @@ let Gt = class extends nt {
2432
2439
  this._initCellAlertPopup(), this._initZenService();
2433
2440
  }
2434
2441
  _initCellAlertPopup() {
2435
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Jt(100)).subscribe((e) => {
2442
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ln(100)).subscribe((e) => {
2436
2443
  var t, n, o, r, s;
2437
2444
  if (e) {
2438
2445
  const i = this._context.unit.getActiveSheet();
2439
2446
  if (!i) return;
2440
- const a = i.getCell(e.location.row, e.location.col), f = (r = (o = (n = (t = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : t[e.location.unitId]) == null ? void 0 : n[e.location.subUnitId]) == null ? void 0 : o[e.location.row]) == null ? void 0 : r[e.location.col];
2441
- if (Zr(a)) {
2442
- const h = xr(a, !!f);
2447
+ const l = i.getCell(e.location.row, e.location.col), f = (r = (o = (n = (t = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : t[e.location.unitId]) == null ? void 0 : n[e.location.subUnitId]) == null ? void 0 : o[e.location.row]) == null ? void 0 : r[e.location.col];
2448
+ if (Qr(l)) {
2449
+ const h = Nr(l, !!f);
2443
2450
  if (!h) {
2444
2451
  this._hideAlert();
2445
2452
  return;
2446
2453
  }
2447
- const m = this._cellAlertManagerService.currentAlert.get(Ht), u = (s = m == null ? void 0 : m.alert) == null ? void 0 : s.location;
2454
+ const m = this._cellAlertManagerService.currentAlert.get(Xt), u = (s = m == null ? void 0 : m.alert) == null ? void 0 : s.location;
2448
2455
  if (u && u.row === e.location.row && u.col === e.location.col && u.subUnitId === e.location.subUnitId && u.unitId === e.location.unitId)
2449
2456
  return;
2450
2457
  this._cellAlertManagerService.showAlert({
2451
- type: mo.ERROR,
2458
+ type: vo.ERROR,
2452
2459
  title: this._localeService.t("formula.error.title"),
2453
- message: this._localeService.t(`formula.error.${ki[h]}`),
2460
+ message: this._localeService.t(`formula.error.${Di[h]}`),
2454
2461
  location: e.location,
2455
2462
  width: 200,
2456
2463
  height: 74,
2457
- key: Ht
2464
+ key: Xt
2458
2465
  });
2459
2466
  return;
2460
2467
  }
@@ -2468,33 +2475,33 @@ let Gt = class extends nt {
2468
2475
  }));
2469
2476
  }
2470
2477
  _hideAlert() {
2471
- this._cellAlertManagerService.removeAlert(Ht);
2478
+ this._cellAlertManagerService.removeAlert(Xt);
2472
2479
  }
2473
2480
  };
2474
- Gt = Ai([
2475
- it(1, B(fo)),
2476
- it(2, B(go)),
2477
- it(3, B(tt)),
2478
- it(4, B(gt)),
2479
- it(5, cs)
2480
- ], Gt);
2481
- var Fi = Object.getOwnPropertyDescriptor, Di = (e, t, n, o) => {
2482
- for (var r = o > 1 ? void 0 : o ? Fi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2481
+ rn = Fi([
2482
+ mt(1, B(mo)),
2483
+ mt(2, B(po)),
2484
+ mt(3, B(lt)),
2485
+ mt(4, B(It)),
2486
+ mt(5, ds)
2487
+ ], rn);
2488
+ var Li = Object.getOwnPropertyDescriptor, $i = (e, t, n, o) => {
2489
+ for (var r = o > 1 ? void 0 : o ? Li(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2483
2490
  (c = e[s]) && (r = c(r) || r);
2484
2491
  return r;
2485
- }, $n = (e, t) => (n, o) => t(n, o, e);
2486
- let Tt = class extends nt {
2492
+ }, Kn = (e, t) => (n, o) => t(n, o, e);
2493
+ let Dt = class extends ut {
2487
2494
  constructor(e, t) {
2488
2495
  super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
2489
2496
  }
2490
2497
  _registerAutoFill() {
2491
2498
  const e = {
2492
- type: In.FORMULA,
2499
+ type: wn.FORMULA,
2493
2500
  priority: 1001,
2494
- match: (t) => Ie(t == null ? void 0 : t.f) || He(t == null ? void 0 : t.si),
2495
- isContinue: (t, n) => t.type === In.FORMULA,
2501
+ match: (t) => ye(t == null ? void 0 : t.f) || Be(t == null ? void 0 : t.si),
2502
+ isContinue: (t, n) => t.type === wn.FORMULA,
2496
2503
  applyFunctions: {
2497
- [vo.COPY]: (t, n, o, r, s) => {
2504
+ [Co.COPY]: (t, n, o, r, s) => {
2498
2505
  const { data: c, index: i } = t;
2499
2506
  return this._fillCopyFormula(c, n, o, i, r, s);
2500
2507
  }
@@ -2504,57 +2511,57 @@ let Tt = class extends nt {
2504
2511
  }
2505
2512
  _fillCopyFormula(e, t, n, o, r, s) {
2506
2513
  var f, h;
2507
- const c = Pi(r), i = [], a = /* @__PURE__ */ new Map();
2514
+ const c = Ui(r), i = [], l = /* @__PURE__ */ new Map();
2508
2515
  for (let m = 1; m <= t; m++) {
2509
- const u = (m - 1) % e.length, d = o[u], l = Je.deepClone(e[u]);
2510
- if (l) {
2511
- const v = ((f = e[u]) == null ? void 0 : f.f) || "", g = ((h = e[u]) == null ? void 0 : h.si) || "", S = Ie(v);
2512
- if (He(g))
2513
- l.si = g, l.f = null, l.v = null, l.p = null, l.t = null, i.push(l);
2514
- else if (S) {
2515
- let _ = a.get(u);
2516
+ const u = (m - 1) % e.length, d = o[u], a = it.deepClone(e[u]);
2517
+ if (a) {
2518
+ const v = ((f = e[u]) == null ? void 0 : f.f) || "", g = ((h = e[u]) == null ? void 0 : h.si) || "", p = ye(v);
2519
+ if (Be(g))
2520
+ a.si = g, a.f = null, a.v = null, a.p = null, a.t = null, i.push(a);
2521
+ else if (p) {
2522
+ let _ = l.get(u);
2516
2523
  if (_)
2517
- l.si = _, l.f = null, l.v = null, l.p = null, l.t = null;
2524
+ a.si = _, a.f = null, a.v = null, a.p = null, a.t = null;
2518
2525
  else {
2519
- _ = Je.generateRandomId(6), a.set(u, _);
2520
- const { offsetX: R, offsetY: C } = Li(c, t, n, s, d), y = this._lexerTreeBuilder.moveFormulaRefOffset(
2526
+ _ = it.generateRandomId(6), l.set(u, _);
2527
+ const { offsetX: R, offsetY: C } = Pi(c, t, n, s, d), y = this._lexerTreeBuilder.moveFormulaRefOffset(
2521
2528
  v,
2522
2529
  R,
2523
2530
  C
2524
2531
  );
2525
- l.si = _, l.f = y, l.v = null, l.p = null, l.t = null;
2532
+ a.si = _, a.f = y, a.v = null, a.p = null, a.t = null;
2526
2533
  }
2527
- i.push(l);
2534
+ i.push(a);
2528
2535
  }
2529
2536
  }
2530
2537
  }
2531
2538
  return i;
2532
2539
  }
2533
2540
  };
2534
- Tt = Di([
2535
- $n(0, So),
2536
- $n(1, B(Ce))
2537
- ], Tt);
2538
- function Li(e, t, n, o, r) {
2539
- const { source: s, target: c } = o, { rows: i } = c, { rows: a } = s;
2541
+ Dt = $i([
2542
+ Kn(0, So),
2543
+ Kn(1, B(_e))
2544
+ ], Dt);
2545
+ function Pi(e, t, n, o, r) {
2546
+ const { source: s, target: c } = o, { rows: i } = c, { rows: l } = s;
2540
2547
  let f = 0, h = 0;
2541
2548
  switch (n) {
2542
- case ce.UP:
2543
- h = i[r] - a[r];
2549
+ case ae.UP:
2550
+ h = i[r] - l[r];
2544
2551
  break;
2545
- case ce.RIGHT:
2552
+ case ae.RIGHT:
2546
2553
  f = e;
2547
2554
  break;
2548
- case ce.DOWN:
2549
- h = i[r] - a[r];
2555
+ case ae.DOWN:
2556
+ h = i[r] - l[r];
2550
2557
  break;
2551
- case ce.LEFT:
2558
+ case ae.LEFT:
2552
2559
  f = -e * t;
2553
2560
  break;
2554
2561
  }
2555
2562
  return { offsetX: f, offsetY: h };
2556
2563
  }
2557
- function Pi(e) {
2564
+ function Ui(e) {
2558
2565
  let t = 0;
2559
2566
  for (const n in e)
2560
2567
  e[n].forEach((o) => {
@@ -2562,13 +2569,13 @@ function Pi(e) {
2562
2569
  });
2563
2570
  return t;
2564
2571
  }
2565
- var $i = Object.getOwnPropertyDescriptor, Ui = (e, t, n, o) => {
2566
- for (var r = o > 1 ? void 0 : o ? $i(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2572
+ var Vi = Object.getOwnPropertyDescriptor, Wi = (e, t, n, o) => {
2573
+ for (var r = o > 1 ? void 0 : o ? Vi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2567
2574
  (c = e[s]) && (r = c(r) || r);
2568
2575
  return r;
2569
- }, ct = (e, t) => (n, o) => t(n, o, e);
2570
- const Vi = "default-paste-formula";
2571
- let xt = class extends nt {
2576
+ }, pt = (e, t) => (n, o) => t(n, o, e);
2577
+ const Hi = "default-paste-formula";
2578
+ let Lt = class extends ut {
2572
2579
  constructor(e, t, n, o, r) {
2573
2580
  super(), this._currentUniverSheet = e, this._lexerTreeBuilder = t, this._sheetClipboardService = n, this._injector = o, this._formulaDataModel = r, this._initialize();
2574
2581
  }
@@ -2580,7 +2587,7 @@ let xt = class extends nt {
2580
2587
  }
2581
2588
  _pasteFormulaHook() {
2582
2589
  return {
2583
- id: Xe.SPECIAL_PASTE_FORMULA,
2590
+ id: ot.SPECIAL_PASTE_FORMULA,
2584
2591
  priority: 10,
2585
2592
  specialPasteInfo: { label: "specialPaste.formula" },
2586
2593
  onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !0)
@@ -2588,7 +2595,7 @@ let xt = class extends nt {
2588
2595
  }
2589
2596
  _pasteWithFormulaHook() {
2590
2597
  return {
2591
- id: Vi,
2598
+ id: Hi,
2592
2599
  priority: 10,
2593
2600
  onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !1)
2594
2601
  };
@@ -2596,27 +2603,27 @@ let xt = class extends nt {
2596
2603
  _onPasteCells(e, t, n, o, r) {
2597
2604
  var u;
2598
2605
  if ([
2599
- Xe.SPECIAL_PASTE_FORMAT,
2600
- Xe.SPECIAL_PASTE_COL_WIDTH
2606
+ ot.SPECIAL_PASTE_FORMAT,
2607
+ ot.SPECIAL_PASTE_COL_WIDTH
2601
2608
  ].includes(o.pasteType))
2602
2609
  return {
2603
2610
  undos: [],
2604
2611
  redos: []
2605
2612
  };
2606
- const c = this._currentUniverSheet.getCurrentUnitForType(J.UNIVER_SHEET), i = t.unitId || c.getUnitId(), a = t.subUnitId || ((u = c.getActiveSheet()) == null ? void 0 : u.getSheetId());
2607
- if (!i || !a)
2613
+ const c = this._currentUniverSheet.getCurrentUnitForType(q.UNIVER_SHEET), i = t.unitId || c.getUnitId(), l = t.subUnitId || ((u = c.getActiveSheet()) == null ? void 0 : u.getSheetId());
2614
+ if (!i || !l)
2608
2615
  return {
2609
2616
  undos: [],
2610
2617
  redos: []
2611
2618
  };
2612
2619
  const f = t.range, h = n, m = {
2613
- copyType: o.copyType || Yn.COPY,
2620
+ copyType: o.copyType || tr.COPY,
2614
2621
  copyRange: e == null ? void 0 : e.range,
2615
2622
  pasteType: o.pasteType
2616
2623
  };
2617
- return this._injector.invoke((d) => Wi(
2624
+ return this._injector.invoke((d) => Bi(
2618
2625
  i,
2619
- a,
2626
+ l,
2620
2627
  f,
2621
2628
  h,
2622
2629
  d,
@@ -2628,15 +2635,15 @@ let xt = class extends nt {
2628
2635
  ));
2629
2636
  }
2630
2637
  };
2631
- xt = Ui([
2632
- ct(0, ee),
2633
- ct(1, B(Ce)),
2634
- ct(2, po),
2635
- ct(3, B(dt)),
2636
- ct(4, B(gt))
2637
- ], xt);
2638
- function Wi(e, t, n, o, r, s, c, i, a = !1, f) {
2639
- const h = [], m = [], u = Hi(e, t, n, o, s, c, i, f);
2638
+ Lt = Wi([
2639
+ pt(0, ee),
2640
+ pt(1, B(_e)),
2641
+ pt(2, _o),
2642
+ pt(3, B(_t)),
2643
+ pt(4, B(It))
2644
+ ], Lt);
2645
+ function Bi(e, t, n, o, r, s, c, i, l = !1, f) {
2646
+ const h = [], m = [], u = ji(e, t, n, o, s, c, i, f);
2640
2647
  if (!u.hasValue())
2641
2648
  return {
2642
2649
  undos: [],
@@ -2648,112 +2655,112 @@ function Wi(e, t, n, o, r, s, c, i, a = !1, f) {
2648
2655
  cellValue: u.getData()
2649
2656
  };
2650
2657
  h.push({
2651
- id: bt.id,
2658
+ id: wt.id,
2652
2659
  params: d
2653
2660
  });
2654
- const l = Qo(
2661
+ const a = ts(
2655
2662
  r,
2656
2663
  d
2657
2664
  );
2658
2665
  return m.push({
2659
- id: bt.id,
2660
- params: l
2666
+ id: wt.id,
2667
+ params: a
2661
2668
  }), {
2662
2669
  undos: m,
2663
2670
  redos: h
2664
2671
  };
2665
2672
  }
2666
- function Hi(e, t, n, o, r, s, c, i) {
2667
- return i ? r.pasteType === Xe.SPECIAL_PASTE_VALUE ? ji(e, t, n, o, c, i) : r.pasteType === Xe.SPECIAL_PASTE_FORMULA ? qi(e, t, n, o, s, c, i) : Ki(e, t, n, o, r.copyType, s, c, i) : Bi(e, t, n, o, c);
2673
+ function ji(e, t, n, o, r, s, c, i) {
2674
+ return i ? r.pasteType === ot.SPECIAL_PASTE_VALUE ? Ki(e, t, n, o, c, i) : r.pasteType === ot.SPECIAL_PASTE_FORMULA ? Yi(e, t, n, o, s, c, i) : Gi(e, t, n, o, r.copyType, s, c, i) : qi(e, t, n, o, c);
2668
2675
  }
2669
- function Bi(e, t, n, o, r) {
2670
- const s = new ke(), c = r.getSheetFormulaData(e, t);
2671
- return o.forValue((i, a, f) => {
2676
+ function qi(e, t, n, o, r) {
2677
+ const s = new Fe(), c = r.getSheetFormulaData(e, t);
2678
+ return o.forValue((i, l, f) => {
2672
2679
  var d;
2673
- const h = n.rows[i], m = n.cols[a], u = {};
2674
- Ie(f.v) ? (u.v = null, u.f = `${f.v}`, u.si = null, u.p = null, s.setValue(h, m, u)) : (d = c == null ? void 0 : c[h]) != null && d[m] && (u.v = f.v, u.f = null, u.si = null, u.p = null, s.setValue(h, m, u));
2680
+ const h = n.rows[i], m = n.cols[l], u = {};
2681
+ ye(f.v) ? (u.v = null, u.f = `${f.v}`, u.si = null, u.p = null, s.setValue(h, m, u)) : (d = c == null ? void 0 : c[h]) != null && d[m] && (u.v = f.v, u.f = null, u.si = null, u.p = null, s.setValue(h, m, u));
2675
2682
  }), s;
2676
2683
  }
2677
- function ji(e, t, n, o, r, s) {
2684
+ function Ki(e, t, n, o, r, s) {
2678
2685
  var f, h;
2679
- const c = new ke(), i = (h = (f = r.getArrayFormulaCellData()) == null ? void 0 : f[s.unitId]) == null ? void 0 : h[s.subUnitId], a = r.getSheetFormulaData(e, t);
2686
+ const c = new Fe(), i = (h = (f = r.getArrayFormulaCellData()) == null ? void 0 : f[s.unitId]) == null ? void 0 : h[s.subUnitId], l = r.getSheetFormulaData(e, t);
2680
2687
  return o.forValue((m, u, d) => {
2681
2688
  var _, R;
2682
- const l = s.range.rows[m % s.range.rows.length], v = s.range.cols[u % s.range.cols.length], g = n.rows[m], S = n.cols[u], p = {};
2683
- if (Ie(d.f) || He(d.si))
2684
- p.v = d.v, p.f = null, p.si = null, p.p = null, c.setValue(g, S, p);
2685
- else if ((_ = i == null ? void 0 : i[l]) != null && _[v]) {
2686
- const C = i[l][v];
2687
- p.v = C.v, p.f = null, p.si = null, p.p = null, c.setValue(g, S, p);
2688
- } else if ((R = a == null ? void 0 : a[g]) != null && R[S]) {
2689
- if (p.v = d.v, p.f = null, p.si = null, p.p = null, d.p) {
2690
- const C = Or(d);
2691
- C && (p.v = C);
2689
+ const a = s.range.rows[m % s.range.rows.length], v = s.range.cols[u % s.range.cols.length], g = n.rows[m], p = n.cols[u], S = {};
2690
+ if (ye(d.f) || Be(d.si))
2691
+ S.v = d.v, S.f = null, S.si = null, S.p = null, c.setValue(g, p, S);
2692
+ else if ((_ = i == null ? void 0 : i[a]) != null && _[v]) {
2693
+ const C = i[a][v];
2694
+ S.v = C.v, S.f = null, S.si = null, S.p = null, c.setValue(g, p, S);
2695
+ } else if ((R = l == null ? void 0 : l[g]) != null && R[p]) {
2696
+ if (S.v = d.v, S.f = null, S.si = null, S.p = null, d.p) {
2697
+ const C = Mr(d);
2698
+ C && (S.v = C);
2692
2699
  }
2693
- c.setValue(g, S, p);
2700
+ c.setValue(g, p, S);
2694
2701
  }
2695
2702
  }), c;
2696
2703
  }
2697
- function qi(e, t, n, o, r, s, c) {
2698
- const i = new ke(), a = /* @__PURE__ */ new Map();
2704
+ function Yi(e, t, n, o, r, s, c) {
2705
+ const i = new Fe(), l = /* @__PURE__ */ new Map();
2699
2706
  return o.forValue((f, h, m) => {
2700
- const u = n.rows[f], d = n.cols[h], l = {};
2701
- if (He(m.si)) {
2707
+ const u = n.rows[f], d = n.cols[h], a = {};
2708
+ if (Be(m.si)) {
2702
2709
  if (c.unitId !== e || c.subUnitId !== t) {
2703
2710
  const v = s.getFormulaStringByCell(
2704
2711
  c.range.rows[f % c.range.rows.length],
2705
2712
  c.range.cols[h % c.range.cols.length],
2706
2713
  c.subUnitId,
2707
2714
  c.unitId
2708
- ), g = n.cols[h] - c.range.cols[h % c.range.cols.length], S = n.rows[f] - c.range.rows[f % c.range.rows.length], p = r.moveFormulaRefOffset(v || "", g, S);
2709
- l.si = null, l.f = p;
2715
+ ), g = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[f] - c.range.rows[f % c.range.rows.length], S = r.moveFormulaRefOffset(v || "", g, p);
2716
+ a.si = null, a.f = S;
2710
2717
  } else
2711
- l.si = m.si, l.f = null;
2712
- l.v = null, l.p = null, i.setValue(u, d, l);
2713
- } else if (Ie(m.f)) {
2718
+ a.si = m.si, a.f = null;
2719
+ a.v = null, a.p = null, i.setValue(u, d, a);
2720
+ } else if (ye(m.f)) {
2714
2721
  const v = `${f % c.range.rows.length}_${h % c.range.cols.length}`;
2715
- let g = a.get(v);
2722
+ let g = l.get(v);
2716
2723
  if (g)
2717
- l.si = g, l.f = null;
2724
+ a.si = g, a.f = null;
2718
2725
  else {
2719
- g = Je.generateRandomId(6), a.set(v, g);
2720
- const S = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[f] - c.range.rows[f % c.range.rows.length], _ = r.moveFormulaRefOffset(m.f || "", S, p);
2721
- l.si = g, l.f = _;
2726
+ g = it.generateRandomId(6), l.set(v, g);
2727
+ const p = n.cols[h] - c.range.cols[h % c.range.cols.length], S = n.rows[f] - c.range.rows[f % c.range.rows.length], _ = r.moveFormulaRefOffset(m.f || "", p, S);
2728
+ a.si = g, a.f = _;
2722
2729
  }
2723
- l.v = null, l.p = null, i.setValue(u, d, l);
2730
+ a.v = null, a.p = null, i.setValue(u, d, a);
2724
2731
  } else {
2725
- if (l.v = m.v, l.f = null, l.si = null, l.p = null, m.p) {
2726
- const v = Or(m);
2727
- v && (l.v = v);
2732
+ if (a.v = m.v, a.f = null, a.si = null, a.p = null, m.p) {
2733
+ const v = Mr(m);
2734
+ v && (a.v = v);
2728
2735
  }
2729
- i.setValue(u, d, l);
2736
+ i.setValue(u, d, a);
2730
2737
  }
2731
2738
  }), i;
2732
2739
  }
2733
- function Ki(e, t, n, o, r, s, c, i) {
2734
- const a = new ke(), f = /* @__PURE__ */ new Map(), h = c.getSheetFormulaData(e, t), m = [];
2735
- return r === Yn.CUT ? o.forValue((u, d, l) => {
2736
- const v = n.rows[u], g = n.cols[d], S = {};
2737
- if (He(l.si)) {
2738
- if (Ie(l.f))
2739
- m.push(l.si), S.f = l.f, S.si = l.si;
2740
- else if (m.includes(l.si))
2741
- S.f = null, S.si = l.si;
2740
+ function Gi(e, t, n, o, r, s, c, i) {
2741
+ const l = new Fe(), f = /* @__PURE__ */ new Map(), h = c.getSheetFormulaData(e, t), m = [];
2742
+ return r === tr.CUT ? o.forValue((u, d, a) => {
2743
+ const v = n.rows[u], g = n.cols[d], p = {};
2744
+ if (Be(a.si)) {
2745
+ if (ye(a.f))
2746
+ m.push(a.si), p.f = a.f, p.si = a.si;
2747
+ else if (m.includes(a.si))
2748
+ p.f = null, p.si = a.si;
2742
2749
  else {
2743
- const p = c.getFormulaStringByCell(
2750
+ const S = c.getFormulaStringByCell(
2744
2751
  i.range.rows[u % i.range.rows.length],
2745
2752
  i.range.cols[d % i.range.cols.length],
2746
2753
  i.subUnitId,
2747
2754
  i.unitId
2748
2755
  );
2749
- S.f = p, S.si = null;
2756
+ p.f = S, p.si = null;
2750
2757
  }
2751
- S.v = null, S.p = null, a.setValue(v, g, S);
2752
- } else Ie(l.f) && (S.f = l.f, S.si = null, S.v = null, S.p = null, a.setValue(v, g, S));
2753
- }) : o.forValue((u, d, l) => {
2754
- var p;
2755
- const v = n.rows[u], g = n.cols[d], S = {};
2756
- if (He(l.si)) {
2758
+ p.v = null, p.p = null, l.setValue(v, g, p);
2759
+ } else ye(a.f) && (p.f = a.f, p.si = null, p.v = null, p.p = null, l.setValue(v, g, p));
2760
+ }) : o.forValue((u, d, a) => {
2761
+ var S;
2762
+ const v = n.rows[u], g = n.cols[d], p = {};
2763
+ if (Be(a.si)) {
2757
2764
  if (i.unitId !== e || i.subUnitId !== t) {
2758
2765
  const _ = c.getFormulaStringByCell(
2759
2766
  i.range.rows[u % i.range.rows.length],
@@ -2761,59 +2768,59 @@ function Ki(e, t, n, o, r, s, c, i) {
2761
2768
  i.subUnitId,
2762
2769
  i.unitId
2763
2770
  ), R = n.cols[d] - i.range.cols[d % i.range.cols.length], C = n.rows[u] - i.range.rows[u % i.range.rows.length], y = s.moveFormulaRefOffset(_ || "", R, C);
2764
- S.si = null, S.f = y;
2771
+ p.si = null, p.f = y;
2765
2772
  } else
2766
- S.si = l.si, S.f = null;
2767
- S.v = null, S.p = null, a.setValue(v, g, S);
2768
- } else if (Ie(l.f)) {
2773
+ p.si = a.si, p.f = null;
2774
+ p.v = null, p.p = null, l.setValue(v, g, p);
2775
+ } else if (ye(a.f)) {
2769
2776
  const _ = `${u % i.range.rows.length}_${d % i.range.cols.length}`;
2770
2777
  let R = f.get(_);
2771
2778
  if (R)
2772
- S.si = R, S.f = null;
2779
+ p.si = R, p.f = null;
2773
2780
  else {
2774
- R = Je.generateRandomId(6), f.set(_, R);
2775
- const C = n.cols[d] - i.range.cols[d % i.range.cols.length], y = n.rows[u] - i.range.rows[u % i.range.rows.length], N = s.moveFormulaRefOffset(l.f || "", C, y);
2776
- S.si = R, S.f = N;
2781
+ R = it.generateRandomId(6), f.set(_, R);
2782
+ const C = n.cols[d] - i.range.cols[d % i.range.cols.length], y = n.rows[u] - i.range.rows[u % i.range.rows.length], N = s.moveFormulaRefOffset(a.f || "", C, y);
2783
+ p.si = R, p.f = N;
2777
2784
  }
2778
- S.v = null, S.p = null, a.setValue(v, g, S);
2779
- } else (p = h == null ? void 0 : h[v]) != null && p[g] && (S.v = l.v, S.f = null, S.si = null, S.p = l.p, a.setValue(v, g, S));
2780
- }), m.length > 0 && new ke(h).forValue((u, d, l) => {
2781
- if (!(i.range.rows.includes(u) && i.range.cols.includes(d)) && !(n.rows.includes(u) && n.cols.includes(d)) && m.includes(l == null ? void 0 : l.si)) {
2785
+ p.v = null, p.p = null, l.setValue(v, g, p);
2786
+ } else (S = h == null ? void 0 : h[v]) != null && S[g] && (p.v = a.v, p.f = null, p.si = null, p.p = a.p, l.setValue(v, g, p));
2787
+ }), m.length > 0 && new Fe(h).forValue((u, d, a) => {
2788
+ if (!(i.range.rows.includes(u) && i.range.cols.includes(d)) && !(n.rows.includes(u) && n.cols.includes(d)) && m.includes(a == null ? void 0 : a.si)) {
2782
2789
  const v = c.getFormulaStringByCell(
2783
2790
  u,
2784
2791
  d,
2785
2792
  i.subUnitId,
2786
2793
  i.unitId
2787
2794
  );
2788
- a.setValue(u, d, {
2795
+ l.setValue(u, d, {
2789
2796
  f: v,
2790
2797
  si: null,
2791
2798
  v: null,
2792
2799
  p: null
2793
2800
  });
2794
2801
  }
2795
- }), a;
2802
+ }), l;
2796
2803
  }
2797
- function Or(e) {
2804
+ function Mr(e) {
2798
2805
  if (e != null && e.p) {
2799
2806
  const t = e == null ? void 0 : e.p.body;
2800
2807
  if (t == null)
2801
2808
  return;
2802
2809
  const n = t.dataStream;
2803
- return n.substring(n.length - 2, n.length) === Hn ? n.substring(0, n.length - 2) : n;
2810
+ return n.substring(n.length - 2, n.length) === zn ? n.substring(0, n.length - 2) : n;
2804
2811
  }
2805
2812
  }
2806
- var Yi = Object.getOwnPropertyDescriptor, Gi = (e, t, n, o) => {
2807
- for (var r = o > 1 ? void 0 : o ? Yi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2813
+ var Zi = Object.getOwnPropertyDescriptor, zi = (e, t, n, o) => {
2814
+ for (var r = o > 1 ? void 0 : o ? Zi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2808
2815
  (c = e[s]) && (r = c(r) || r);
2809
2816
  return r;
2810
- }, Ue = (e, t) => (n, o) => t(n, o, e);
2811
- let Ot = class extends nt {
2812
- constructor(t, n, o, r, s, c, i, a) {
2817
+ }, Ve = (e, t) => (n, o) => t(n, o, e);
2818
+ let $t = class extends ut {
2819
+ constructor(t, n, o, r, s, c, i, l) {
2813
2820
  super();
2814
2821
  j(this, "_previousShape");
2815
2822
  j(this, "_skeleton");
2816
- this._context = t, this._sheetInterceptorService = n, this._formulaDataModel = o, this._themeService = r, this._renderManagerService = s, this._sheetSkeletonManagerService = c, this._commandService = i, this._logService = a, this._initSkeletonChangeListener(), this._initInterceptorEditorStart(), this._commandExecutedListener();
2823
+ this._context = t, this._sheetInterceptorService = n, this._formulaDataModel = o, this._themeService = r, this._renderManagerService = s, this._sheetSkeletonManagerService = c, this._commandService = i, this._logService = l, this._initSkeletonChangeListener(), this._initInterceptorEditorStart(), this._commandExecutedListener();
2817
2824
  }
2818
2825
  _initSkeletonChangeListener() {
2819
2826
  this.disposeWithMe(
@@ -2838,19 +2845,19 @@ let Ot = class extends nt {
2838
2845
  }
2839
2846
  _initInterceptorEditorStart() {
2840
2847
  this.disposeWithMe(
2841
- Bn(
2842
- this._sheetInterceptorService.writeCellInterceptor.intercept(Jo, {
2848
+ Xn(
2849
+ this._sheetInterceptorService.writeCellInterceptor.intercept(ns, {
2843
2850
  handler: (t, n, o) => {
2844
- var l, v, g, S;
2845
- const { row: r, col: s, unitId: c, subUnitId: i, worksheet: a } = n, f = this._formulaDataModel.getArrayFormulaRange(), h = this._formulaDataModel.getArrayFormulaCellData();
2851
+ var a, v, g, p;
2852
+ const { row: r, col: s, unitId: c, subUnitId: i, worksheet: l } = n, f = this._formulaDataModel.getArrayFormulaRange(), h = this._formulaDataModel.getArrayFormulaCellData();
2846
2853
  if (this._removeArrayFormulaRangeShape(), t == null)
2847
2854
  return o(t);
2848
2855
  let m = null;
2849
2856
  const u = this._formulaDataModel.getFormulaStringByCell(r, s, i, c);
2850
- if (u !== null && (m = { f: u }), t.v != null && t.v !== "" && ((g = (v = (l = h[c]) == null ? void 0 : l[i]) == null ? void 0 : v[r]) == null ? void 0 : g[s]) == null)
2857
+ if (u !== null && (m = { f: u }), t.v != null && t.v !== "" && ((g = (v = (a = h[c]) == null ? void 0 : a[i]) == null ? void 0 : v[r]) == null ? void 0 : g[s]) == null)
2851
2858
  return m ? { ...t, ...m } : o(t);
2852
- const d = (S = f == null ? void 0 : f[c]) == null ? void 0 : S[i];
2853
- return d != null && (m = this._displayArrayFormulaRangeShape(d, r, s, c, i, a, m)), m ? { ...t, ...m } : o(t);
2859
+ const d = (p = f == null ? void 0 : f[c]) == null ? void 0 : p[i];
2860
+ return d != null && (m = this._displayArrayFormulaRangeShape(d, r, s, c, i, l, m)), m ? { ...t, ...m } : o(t);
2854
2861
  }
2855
2862
  })
2856
2863
  )
@@ -2858,10 +2865,10 @@ let Ot = class extends nt {
2858
2865
  }
2859
2866
  _commandExecutedListener() {
2860
2867
  this.disposeWithMe(this._commandService.onCommandExecuted((t, n) => {
2861
- (t.id === wo.id || t.id === Ao.id && n && n.remove) && this._removeArrayFormulaRangeShape();
2868
+ (t.id === Fo.id || t.id === Do.id && n && n.remove) && this._removeArrayFormulaRangeShape();
2862
2869
  })), this.disposeWithMe(
2863
2870
  this._commandService.beforeCommandExecuted((t) => {
2864
- es.id === t.id && requestIdleCallback(() => {
2871
+ rs.id === t.id && requestIdleCallback(() => {
2865
2872
  const n = t.params, { unitId: o, subUnitId: r, rowsAutoHeightInfo: s } = n;
2866
2873
  this._refreshArrayFormulaRangeShapeByRow(o, r, s);
2867
2874
  });
@@ -2869,21 +2876,21 @@ let Ot = class extends nt {
2869
2876
  );
2870
2877
  }
2871
2878
  _displayArrayFormulaRangeShape(t, n, o, r, s, c, i) {
2872
- const a = this._formulaDataModel.getSheetFormulaData(r, s);
2873
- return new ke(t).forValue((f, h, m) => {
2879
+ const l = this._formulaDataModel.getSheetFormulaData(r, s);
2880
+ return new Fe(t).forValue((f, h, m) => {
2874
2881
  var g;
2875
2882
  if (m == null)
2876
2883
  return !0;
2877
- const { startRow: u, startColumn: d, endRow: l, endColumn: v } = m;
2884
+ const { startRow: u, startColumn: d, endRow: a, endColumn: v } = m;
2878
2885
  if (f === n && h === o)
2879
2886
  return this._createArrayFormulaRangeShape(m, r), !1;
2880
- if (n >= u && n <= l && o >= d && o <= v) {
2881
- const S = c.getCell(u, d);
2882
- if ((S == null ? void 0 : S.v) === ie.SPILL)
2887
+ if (n >= u && n <= a && o >= d && o <= v) {
2888
+ const p = c.getCell(u, d);
2889
+ if ((p == null ? void 0 : p.v) === ce.SPILL)
2883
2890
  return;
2884
- const p = (g = a == null ? void 0 : a[f]) == null ? void 0 : g[h];
2885
- return p == null || p.f == null ? !0 : (i == null && (i = {
2886
- f: p.f,
2891
+ const S = (g = l == null ? void 0 : l[f]) == null ? void 0 : g[h];
2892
+ return S == null || S.f == null ? !0 : (i == null && (i = {
2893
+ f: S.f,
2887
2894
  isInArrayFormulaRange: !0
2888
2895
  }), this._createArrayFormulaRangeShape(m, r), !1);
2889
2896
  }
@@ -2900,12 +2907,12 @@ let Ot = class extends nt {
2900
2907
  style: {
2901
2908
  strokeWidth: 1,
2902
2909
  stroke: this._themeService.getColorFromTheme("primary.600"),
2903
- fill: new Xt(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
2910
+ fill: new cn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
2904
2911
  widgets: {}
2905
2912
  }
2906
- }, i = Bt(c, r), { rowHeaderWidth: a, columnHeaderHeight: f } = r, h = new Kn(s, Co.FORMULA_EDITOR_SHOW, this._themeService, {
2913
+ }, i = Qt(c, r), { rowHeaderWidth: l, columnHeaderHeight: f } = r, h = new er(s, Ro.FORMULA_EDITOR_SHOW, this._themeService, {
2907
2914
  highlightHeader: !1,
2908
- rowHeaderWidth: a,
2915
+ rowHeaderWidth: l,
2909
2916
  columnHeaderHeight: f
2910
2917
  });
2911
2918
  h.updateRangeBySelectionWithCoord(i), h.setEvent(!1), this._previousShape = h;
@@ -2931,8 +2938,8 @@ let Ot = class extends nt {
2931
2938
  _refreshArrayFormulaRangeShapeByRow(t, n, o) {
2932
2939
  if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
2933
2940
  const { startRow: r, endRow: s, startColumn: c, endColumn: i } = this._previousShape.getRange();
2934
- for (let a = 0; a < o.length; a++) {
2935
- const { row: f } = o[a];
2941
+ for (let l = 0; l < o.length; l++) {
2942
+ const { row: f } = o[l];
2936
2943
  if (r >= f) {
2937
2944
  const h = {
2938
2945
  startRow: r,
@@ -2946,174 +2953,168 @@ let Ot = class extends nt {
2946
2953
  }
2947
2954
  }
2948
2955
  };
2949
- Ot = Gi([
2950
- Ue(1, B(nn)),
2951
- Ue(2, B(gt)),
2952
- Ue(3, B(ht)),
2953
- Ue(4, xe),
2954
- Ue(5, B(At)),
2955
- Ue(6, ue),
2956
- Ue(7, Xr)
2957
- ], Ot);
2958
- var zi = Object.getOwnPropertyDescriptor, Zi = (e, t, n, o) => {
2959
- for (var r = o > 1 ? void 0 : o ? zi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2956
+ $t = zi([
2957
+ Ve(1, B(hn)),
2958
+ Ve(2, B(It)),
2959
+ Ve(3, B(Rt)),
2960
+ Ve(4, Oe),
2961
+ Ve(5, B(Wt)),
2962
+ Ve(6, de),
2963
+ Ve(7, Jr)
2964
+ ], $t);
2965
+ var Xi = Object.getOwnPropertyDescriptor, Qi = (e, t, n, o) => {
2966
+ for (var r = o > 1 ? void 0 : o ? Xi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
2960
2967
  (c = e[s]) && (r = c(r) || r);
2961
2968
  return r;
2962
- }, Un = (e, t) => (n, o) => t(n, o, e);
2963
- const Xi = {
2969
+ }, Yn = (e, t) => (n, o) => t(n, o, e);
2970
+ const Ji = {
2964
2971
  tl: {
2965
2972
  size: 6,
2966
2973
  color: "#409f11"
2967
2974
  }
2968
2975
  };
2969
- let Nt = class extends Qr {
2976
+ let Pt = class extends eo {
2970
2977
  constructor(e, t) {
2971
2978
  super(), this._sheetInterceptorService = e, this._formulaDataModel = t, this.disposeWithMe(this._sheetInterceptorService.intercept(
2972
- ts.CELL_CONTENT,
2979
+ os.CELL_CONTENT,
2973
2980
  {
2974
- effect: Jr.Style,
2981
+ effect: to.Style,
2975
2982
  handler: (n, o, r) => {
2976
- var i, a, f, h;
2977
- const s = (h = (f = (a = (i = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : i[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : f[o.row]) == null ? void 0 : h[o.col];
2978
- return xr(n, !!s) ? r({
2979
- ...n,
2980
- markers: {
2981
- ...n == null ? void 0 : n.markers,
2982
- ...Xi
2983
- }
2984
- }) : r(n);
2983
+ var i, l, f, h;
2984
+ const s = (h = (f = (l = (i = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : i[o.unitId]) == null ? void 0 : l[o.subUnitId]) == null ? void 0 : f[o.row]) == null ? void 0 : h[o.col];
2985
+ return !Nr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
2986
+ ...n == null ? void 0 : n.markers,
2987
+ ...Ji
2988
+ }), r(n);
2985
2989
  },
2986
2990
  priority: 10
2987
2991
  }
2988
2992
  ));
2989
2993
  }
2990
2994
  };
2991
- Nt = Zi([
2992
- Un(0, B(nn)),
2993
- Un(1, B(gt))
2994
- ], Nt);
2995
- function Qi() {
2996
- const e = T(rs), t = T(ue), n = ve(e.progress$), o = Et(() => {
2997
- t.executeCommand(ko.id);
2998
- }, [t]), r = Et(() => {
2995
+ Pt = Qi([
2996
+ Yn(0, B(hn)),
2997
+ Yn(1, B(It))
2998
+ ], Pt);
2999
+ function ec() {
3000
+ const e = T(is), t = T(de), n = Ce(e.progress$), o = kt(() => {
3001
+ t.executeCommand(Lo.id);
3002
+ }, [t]), r = kt(() => {
2999
3003
  e.clearProgress();
3000
3004
  }, [e]);
3001
- return /* @__PURE__ */ O(ls, { progress: n, onTerminate: o, onClearProgress: r });
3005
+ return /* @__PURE__ */ O(hs, { progress: n, onTerminate: o, onClearProgress: r });
3002
3006
  }
3003
- function Nr(e) {
3007
+ function wr(e) {
3004
3008
  const { prefix: t, value: n } = e;
3005
- return /* @__PURE__ */ V("div", { children: [
3006
- /* @__PURE__ */ V("span", { children: [
3009
+ return /* @__PURE__ */ W("div", { children: [
3010
+ /* @__PURE__ */ W("span", { children: [
3007
3011
  t,
3008
3012
  "("
3009
3013
  ] }),
3010
- n && n.map((o, r) => /* @__PURE__ */ V("span", { children: [
3011
- /* @__PURE__ */ O("span", { children: Rr(o) }),
3014
+ n && n.map((o, r) => /* @__PURE__ */ W("span", { children: [
3015
+ /* @__PURE__ */ O("span", { children: Ir(o) }),
3012
3016
  r === n.length - 1 ? "" : ","
3013
3017
  ] }, r)),
3014
3018
  ")"
3015
3019
  ] });
3016
3020
  }
3017
- function lt(e) {
3021
+ function vt(e) {
3018
3022
  const { className: t, value: n, title: o } = e;
3019
- return /* @__PURE__ */ V("div", { className: "univer-mb-2 univer-text-xs", children: [
3023
+ return /* @__PURE__ */ W("div", { className: "univer-mb-2 univer-text-xs", children: [
3020
3024
  /* @__PURE__ */ O(
3021
3025
  "div",
3022
3026
  {
3023
- className: `
3024
- univer-mb-2 univer-font-medium univer-text-gray-500
3025
- ${t}
3026
- `,
3027
+ className: ne("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
3027
3028
  children: o
3028
3029
  }
3029
3030
  ),
3030
3031
  /* @__PURE__ */ O(
3031
3032
  "div",
3032
3033
  {
3033
- className: "univer-text-gray-900 dark:univer-text-white",
3034
+ className: "univer-break-all univer-text-gray-900 dark:!univer-text-white",
3034
3035
  children: n
3035
3036
  }
3036
3037
  )
3037
3038
  ] });
3038
3039
  }
3039
- function Ji(e) {
3040
+ function tc(e) {
3040
3041
  const { functionInfo: t, onChange: n } = e;
3041
3042
  if (!t) return null;
3042
- const [o, r] = U([]), [s, c] = U(t.functionParameter), [i, a] = U(-1);
3043
- return /* @__PURE__ */ V("div", { children: [
3044
- /* @__PURE__ */ O("div", { className: "univer-h-[364px] univer-overflow-y-auto", children: s.map((f, h) => /* @__PURE__ */ V("div", { children: [
3043
+ const [o, r] = V([]), [s, c] = V(t.functionParameter), [i, l] = V(-1);
3044
+ return /* @__PURE__ */ W("div", { children: [
3045
+ /* @__PURE__ */ O("div", { className: ne("univer-h-[364px] univer-overflow-y-auto", at), children: s.map((f, h) => /* @__PURE__ */ W("div", { children: [
3045
3046
  /* @__PURE__ */ O("div", { className: "univer-text-sm", children: f.name }),
3046
3047
  /* @__PURE__ */ O("div", { className: "univer-mb-2 univer-mt-1" })
3047
3048
  ] }, h)) }),
3048
- /* @__PURE__ */ O("div", { className: pe("univer-flex-1 univer-p-3", vs), children: /* @__PURE__ */ O(
3049
- lt,
3049
+ /* @__PURE__ */ O("div", { className: ne("univer-flex-1 univer-p-3", Cs), children: /* @__PURE__ */ O(
3050
+ vt,
3050
3051
  {
3051
- title: i === -1 ? /* @__PURE__ */ O(Nr, { prefix: t.functionName, value: s }) : s[i].name,
3052
+ title: i === -1 ? /* @__PURE__ */ O(wr, { prefix: t.functionName, value: s }) : s[i].name,
3052
3053
  value: i === -1 ? t.description : s[i].detail
3053
3054
  }
3054
3055
  ) })
3055
3056
  ] });
3056
3057
  }
3057
- function ec(e) {
3058
- const { onChange: t } = e, n = "-1", [o, r] = U(""), [s, c] = U([]), [i, a] = U(0), [f, h] = U(n), [m, u] = U(0), [d, l] = U(null), v = T(Ft), g = T(tt), S = T(rn), p = ve(S.sidebarOptions$), _ = Bs(Fo, g);
3058
+ function nc(e) {
3059
+ const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, c] = V([]), [i, l] = V(0), [f, h] = V(n), [m, u] = V(0), [d, a] = V(null), v = T(Bt), g = T(lt), p = T(fn), S = Ce(p.sidebarOptions$), _ = qs($o, g);
3059
3060
  _.unshift({
3060
3061
  label: g.t("formula.moreFunctions.allFunctions"),
3061
3062
  value: n
3062
3063
  });
3063
3064
  const R = g.t("formula.prompt.required"), C = g.t("formula.prompt.optional");
3064
- P(() => {
3065
- k(n);
3066
- }, []), P(() => {
3065
+ $(() => {
3066
+ A(n);
3067
+ }, []), $(() => {
3067
3068
  N(0);
3068
- }, [s]), P(() => {
3069
- p != null && p.visible && (r(""), c([]), a(0), h(n), u(0), l(null), k(n));
3070
- }, [p]);
3071
- const y = (E) => {
3072
- if (o.trim() === "") return E;
3073
- const b = new RegExp(`(${o.toLocaleUpperCase()})`);
3074
- return E.split(b).filter(Boolean).map((A, D) => A.match(b) ? /* @__PURE__ */ O("span", { className: "univer-text-red-500", children: A }, D) : A);
3075
- }, N = (E) => {
3069
+ }, [s]), $(() => {
3070
+ S != null && S.visible && (r(""), c([]), l(0), h(n), u(0), a(null), A(n));
3071
+ }, [S]);
3072
+ const y = (I) => {
3073
+ if (o.trim() === "") return I;
3074
+ const E = new RegExp(`(${o.toLocaleUpperCase()})`);
3075
+ return I.split(E).filter(Boolean).map((k, L) => k.match(E) ? /* @__PURE__ */ O("span", { className: "univer-text-red-500", children: k }, L) : k);
3076
+ }, N = (I) => {
3076
3077
  if (s.length === 0) {
3077
- l(null);
3078
+ a(null);
3078
3079
  return;
3079
3080
  }
3080
- u(E);
3081
- const b = v.getFunctionInfo(s[E].name);
3082
- if (!b) {
3083
- l(null);
3081
+ u(I);
3082
+ const E = v.getFunctionInfo(s[I].name);
3083
+ if (!E) {
3084
+ a(null);
3084
3085
  return;
3085
3086
  }
3086
- l(b), t(b);
3087
+ a(E), t(E);
3087
3088
  };
3088
- function k(E) {
3089
- h(E);
3090
- const b = v.getSearchListByType(+E);
3091
- c(b);
3092
- }
3093
- function F(E) {
3094
- r(E);
3095
- const b = v.getSearchListByName(E);
3096
- c(b);
3097
- }
3098
- function x(E) {
3099
- if (E.stopPropagation(), E.key === "ArrowDown") {
3100
- const b = i + 1;
3101
- a(b === s.length ? 0 : b);
3102
- } else if (E.key === "ArrowUp") {
3103
- const b = i - 1;
3104
- a(b === -1 ? s.length - 1 : b);
3105
- } else E.key === "Enter" && N(i);
3106
- }
3107
- const w = (E) => {
3108
- a(E);
3089
+ function A(I) {
3090
+ h(I);
3091
+ const E = v.getSearchListByType(+I);
3092
+ c(E);
3093
+ }
3094
+ function F(I) {
3095
+ r(I);
3096
+ const E = v.getSearchListByName(I);
3097
+ c(E);
3098
+ }
3099
+ function x(I) {
3100
+ if (I.stopPropagation(), I.key === "ArrowDown") {
3101
+ const E = i + 1;
3102
+ l(E === s.length ? 0 : E);
3103
+ } else if (I.key === "ArrowUp") {
3104
+ const E = i - 1;
3105
+ l(E === -1 ? s.length - 1 : E);
3106
+ } else I.key === "Enter" && N(i);
3107
+ }
3108
+ const w = (I) => {
3109
+ l(I);
3109
3110
  }, M = () => {
3110
- a(-1);
3111
+ l(-1);
3111
3112
  };
3112
- return /* @__PURE__ */ V("div", { children: [
3113
- /* @__PURE__ */ V("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-[10%]", children: [
3114
- /* @__PURE__ */ O(ps, { value: f, options: _, onChange: k }),
3113
+ return /* @__PURE__ */ W("div", { children: [
3114
+ /* @__PURE__ */ W("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
3115
+ /* @__PURE__ */ O(_s, { value: f, options: _, onChange: A }),
3115
3116
  /* @__PURE__ */ O(
3116
- lr,
3117
+ ur,
3117
3118
  {
3118
3119
  placeholder: g.t("formula.moreFunctions.searchFunctionPlaceholder"),
3119
3120
  onKeyDown: x,
@@ -3124,91 +3125,92 @@ function ec(e) {
3124
3125
  }
3125
3126
  )
3126
3127
  ] }),
3127
- /* @__PURE__ */ O(
3128
+ s.length > 0 && /* @__PURE__ */ O(
3128
3129
  "ul",
3129
3130
  {
3130
- className: pe("univer-mx-0 univer-mb-0 univer-mt-2 univer-box-border univer-max-h-[364px] univer-w-full univer-select-none univer-list-none univer-overflow-y-auto univer-rounded univer-p-3 univer-outline-none", sn),
3131
+ className: ne("univer-m-0 univer-mt-2 univer-box-border univer-max-h-72 univer-w-full univer-select-none univer-list-none univer-overflow-y-auto univer-rounded univer-p-3 univer-outline-none", gn, at),
3131
3132
  onKeyDown: x,
3132
3133
  tabIndex: -1,
3133
- children: s.map(({ name: E }, b) => /* @__PURE__ */ V(
3134
+ children: s.map(({ name: I }, E) => /* @__PURE__ */ W(
3134
3135
  "li",
3135
3136
  {
3136
- className: pe("univer-relative univer-box-border univer-cursor-pointer univer-rounded univer-px-7 univer-py-1 univer-text-sm univer-text-gray-900 univer-transition-colors dark:univer-text-white", {
3137
- "univer-bg-gray-200": i === b
3137
+ className: ne("univer-relative univer-box-border univer-cursor-pointer univer-rounded univer-px-7 univer-py-1 univer-text-sm univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
3138
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": i === E
3138
3139
  }),
3139
- onMouseEnter: () => w(b),
3140
+ onMouseEnter: () => w(E),
3140
3141
  onMouseLeave: M,
3141
- onClick: () => N(b),
3142
+ onClick: () => N(E),
3142
3143
  children: [
3143
- m === b && /* @__PURE__ */ O(
3144
- mr,
3144
+ m === E && /* @__PURE__ */ O(
3145
+ vr,
3145
3146
  {
3146
3147
  className: "univer-absolute univer-left-1.5 univer-top-1/2 univer-inline-flex -univer-translate-y-1/2 univer-text-base univer-text-primary-600"
3147
3148
  }
3148
3149
  ),
3149
- /* @__PURE__ */ O("span", { className: "univer-block", children: y(E) })
3150
+ /* @__PURE__ */ O("span", { className: "univer-block", children: y(I) })
3150
3151
  ]
3151
3152
  },
3152
- b
3153
+ E
3153
3154
  ))
3154
3155
  }
3155
3156
  ),
3156
- d && /* @__PURE__ */ V("div", { className: "univer-mx-0 univer-my-2 univer-max-h-[307px] univer-overflow-y-auto", children: [
3157
- /* @__PURE__ */ O(lt, { title: d.functionName, value: d.description }),
3157
+ d && /* @__PURE__ */ W("div", { className: ne("univer-mx-0 univer-my-2 univer-max-h-80 univer-overflow-y-auto", at), children: [
3158
+ /* @__PURE__ */ O(vt, { title: d.functionName, value: d.description }),
3158
3159
  /* @__PURE__ */ O(
3159
- lt,
3160
+ vt,
3160
3161
  {
3161
3162
  title: g.t("formula.moreFunctions.syntax"),
3162
- value: /* @__PURE__ */ O(Nr, { prefix: d.functionName, value: d.functionParameter })
3163
+ value: /* @__PURE__ */ O(wr, { prefix: d.functionName, value: d.functionParameter })
3163
3164
  }
3164
3165
  ),
3165
3166
  /* @__PURE__ */ O(
3166
- lt,
3167
+ vt,
3167
3168
  {
3168
3169
  title: g.t("formula.prompt.helpExample"),
3169
- value: `${d.functionName}(${d.functionParameter.map((E) => E.example).join(",")})`
3170
+ value: `${d.functionName}(${d.functionParameter.map((I) => I.example).join(",")})`
3170
3171
  }
3171
3172
  ),
3172
- d.functionParameter && d.functionParameter.map((E) => /* @__PURE__ */ O(
3173
- lt,
3173
+ d.functionParameter && d.functionParameter.map((I) => /* @__PURE__ */ O(
3174
+ vt,
3174
3175
  {
3175
- title: E.name,
3176
- value: `${E.require ? R : C} ${E.detail}`
3176
+ title: I.name,
3177
+ value: `${I.require ? R : C} ${I.detail}`
3177
3178
  },
3178
- E.name
3179
+ I.name
3179
3180
  ))
3180
3181
  ] })
3181
3182
  ] });
3182
3183
  }
3183
- function tc() {
3184
- const e = _o(), [t, n] = U(!0), [o, r] = U(!1), [s, c] = U(null);
3185
- T(Qt);
3186
- const i = T(tt), a = T(Be), f = T(ee), h = T(ue);
3184
+ function rc() {
3185
+ const e = Eo(), [t, n] = V(!0), [o, r] = V(!1), [s, c] = V(null);
3186
+ T(an);
3187
+ const i = T(lt), l = T(qe), f = T(ee), h = T(de);
3187
3188
  function m() {
3188
3189
  n(!t), r(!o);
3189
3190
  }
3190
3191
  function u() {
3191
- const d = Jn(f);
3192
+ const d = ir(f);
3192
3193
  if (!d) return;
3193
- h.executeCommand(jn.id, {
3194
+ h.executeCommand(Qn.id, {
3194
3195
  visible: !0,
3195
3196
  unitId: d.unitId,
3196
- eventType: Te.Dblclick
3197
+ eventType: xe.Dblclick
3197
3198
  });
3198
- const l = a.getEditor(Zt), v = a.getEditor(Wn), g = `=${s == null ? void 0 : s.functionName}(`;
3199
- l == null || l.replaceText(g), v == null || v.replaceText(g, !1);
3200
- }
3201
- return /* @__PURE__ */ V("div", { className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-leading-5", children: [
3202
- t && /* @__PURE__ */ O(ec, { onChange: c }),
3203
- o && /* @__PURE__ */ O(Ji, { functionInfo: s, onChange: () => {
3204
- } }),
3205
- /* @__PURE__ */ V(
3206
- "div",
3207
- {
3208
- className: "univer-flex univer-justify-end",
3209
- children: [
3199
+ const a = l.getEditor(sn), v = l.getEditor(Zn), g = `=${s == null ? void 0 : s.functionName}(`;
3200
+ a == null || a.replaceText(g), v == null || v.replaceText(g, !1);
3201
+ }
3202
+ return /* @__PURE__ */ W(
3203
+ "div",
3204
+ {
3205
+ "data-u-comp": "sheets-formula-functions-panel",
3206
+ className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
3207
+ children: [
3208
+ t && /* @__PURE__ */ O(nc, { onChange: c }),
3209
+ o && /* @__PURE__ */ O(tc, { functionInfo: s, onChange: () => {
3210
+ } }),
3211
+ /* @__PURE__ */ W("div", { className: "univer-flex univer-justify-end", children: [
3210
3212
  o && /* @__PURE__ */ O(
3211
- Qe,
3213
+ st,
3212
3214
  {
3213
3215
  variant: "primary",
3214
3216
  onClick: m,
@@ -3216,9 +3218,9 @@ function tc() {
3216
3218
  children: i.t("formula.moreFunctions.next")
3217
3219
  }
3218
3220
  ),
3219
- o && /* @__PURE__ */ O(Qe, { onClick: m, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: i.t("formula.moreFunctions.prev") }),
3221
+ o && /* @__PURE__ */ O(st, { onClick: m, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: i.t("formula.moreFunctions.prev") }),
3220
3222
  t && !!e && /* @__PURE__ */ O(
3221
- Qe,
3223
+ st,
3222
3224
  {
3223
3225
  variant: "primary",
3224
3226
  onClick: u,
@@ -3226,194 +3228,263 @@ function tc() {
3226
3228
  children: i.t("formula.moreFunctions.confirm")
3227
3229
  }
3228
3230
  )
3229
- ]
3230
- }
3231
- )
3232
- ] });
3231
+ ] })
3232
+ ]
3233
+ }
3234
+ );
3233
3235
  }
3234
- function nc(e) {
3236
+ function oc(e) {
3235
3237
  return {
3236
- id: an.id,
3237
- icon: "FunctionSingle",
3238
- tooltip: "formula.insert.tooltip",
3239
- type: on.SELECTOR,
3240
- selections: [
3241
- {
3242
- label: {
3243
- name: "SUM",
3244
- selectable: !1
3245
- },
3246
- value: "SUM",
3247
- icon: "SumSingle"
3248
- },
3249
- {
3250
- label: {
3251
- name: "AVERAGE",
3252
- selectable: !1
3253
- },
3254
- value: "AVERAGE",
3255
- icon: "AvgSingle"
3256
- },
3257
- {
3258
- label: {
3259
- name: "COUNT",
3260
- selectable: !1
3261
- },
3262
- value: "COUNT",
3263
- icon: "CntSingle"
3264
- },
3265
- {
3266
- label: {
3267
- name: "MAX",
3268
- selectable: !1
3269
- },
3270
- value: "MAX",
3271
- icon: "MaxSingle"
3272
- },
3273
- {
3274
- label: {
3275
- name: "MIN",
3276
- selectable: !1
3277
- },
3278
- value: "MIN",
3279
- icon: "MinSingle"
3280
- }
3281
- ],
3282
- hidden$: as(e, J.UNIVER_SHEET),
3283
- disabled$: Gn(e, { workbookTypes: [rr], worksheetTypes: [tr, er], rangeTypes: [nr] })
3238
+ id: fe.id,
3239
+ title: "SUM",
3240
+ icon: "SumIcon",
3241
+ type: ze.BUTTON,
3242
+ params: {
3243
+ value: "SUM"
3244
+ },
3245
+ hidden$: ht(e, q.UNIVER_SHEET),
3246
+ disabled$: je(e, {
3247
+ workbookTypes: [Ze],
3248
+ worksheetTypes: [Ye, Ke],
3249
+ rangeTypes: [Ge]
3250
+ })
3251
+ };
3252
+ }
3253
+ function sc(e) {
3254
+ return {
3255
+ id: fe.id,
3256
+ title: "COUNT",
3257
+ icon: "CntIcon",
3258
+ type: ze.BUTTON,
3259
+ params: {
3260
+ value: "COUNT"
3261
+ },
3262
+ hidden$: ht(e, q.UNIVER_SHEET),
3263
+ disabled$: je(e, {
3264
+ workbookTypes: [Ze],
3265
+ worksheetTypes: [Ye, Ke],
3266
+ rangeTypes: [Ge]
3267
+ })
3268
+ };
3269
+ }
3270
+ function ic(e) {
3271
+ return {
3272
+ id: fe.id,
3273
+ title: "AVERAGE",
3274
+ icon: "AvgIcon",
3275
+ type: ze.BUTTON,
3276
+ params: {
3277
+ value: "AVERAGE"
3278
+ },
3279
+ hidden$: ht(e, q.UNIVER_SHEET),
3280
+ disabled$: je(e, {
3281
+ workbookTypes: [Ze],
3282
+ worksheetTypes: [Ye, Ke],
3283
+ rangeTypes: [Ge]
3284
+ })
3284
3285
  };
3285
3286
  }
3286
- function rc(e) {
3287
+ function cc(e) {
3287
3288
  return {
3288
- id: un.id,
3289
+ id: fe.id,
3290
+ title: "MAX",
3291
+ icon: "MaxIcon",
3292
+ type: ze.BUTTON,
3293
+ params: {
3294
+ value: "MAX"
3295
+ },
3296
+ hidden$: ht(e, q.UNIVER_SHEET),
3297
+ disabled$: je(e, {
3298
+ workbookTypes: [Ze],
3299
+ worksheetTypes: [Ye, Ke],
3300
+ rangeTypes: [Ge]
3301
+ })
3302
+ };
3303
+ }
3304
+ function ac(e) {
3305
+ return {
3306
+ id: fe.id,
3307
+ title: "MIN",
3308
+ icon: "MinIcon",
3309
+ type: ze.BUTTON,
3310
+ params: {
3311
+ value: "MIN"
3312
+ },
3313
+ hidden$: ht(e, q.UNIVER_SHEET),
3314
+ disabled$: je(e, {
3315
+ workbookTypes: [Ze],
3316
+ worksheetTypes: [Ye, Ke],
3317
+ rangeTypes: [Ge]
3318
+ })
3319
+ };
3320
+ }
3321
+ function lc(e) {
3322
+ return {
3323
+ id: vn.id,
3289
3324
  title: "formula.insert.more",
3290
- type: on.BUTTON
3325
+ type: ze.BUTTON,
3326
+ hidden$: ht(e, q.UNIVER_SHEET),
3327
+ disabled$: je(e, {
3328
+ workbookTypes: [Ze],
3329
+ worksheetTypes: [Ye, Ke],
3330
+ rangeTypes: [Ge]
3331
+ })
3291
3332
  };
3292
3333
  }
3293
- function oc(e) {
3294
- return e.get(ee).getCurrentTypeOfUnit$(J.UNIVER_SHEET).pipe(
3295
- Vo((o) => o ? e.get(wn) ? new Wo((s) => s.next(!e.get(wn).supportClipboard)) : yn(!0) : yn(!0))
3334
+ function uc(e) {
3335
+ return e.get(ee).getCurrentTypeOfUnit$(q.UNIVER_SHEET).pipe(
3336
+ Bo((o) => o ? e.get(Pn) ? new jo((s) => s.next(!e.get(Pn).supportClipboard)) : kn(!0) : kn(!0))
3296
3337
  );
3297
3338
  }
3298
- function sc(e) {
3339
+ function dc(e) {
3299
3340
  return {
3300
- id: cn.id,
3301
- type: on.BUTTON,
3341
+ id: mn.id,
3342
+ type: ze.BUTTON,
3302
3343
  title: "formula.operation.pasteFormula",
3303
- disabled$: oc(e).pipe(
3304
- Uo(Gn(e, { workbookTypes: [rr], rangeTypes: [nr], worksheetTypes: [er, tr] })),
3305
- Xn(([t, n]) => t || n)
3344
+ disabled$: uc(e).pipe(
3345
+ Ho(je(e, {
3346
+ workbookTypes: [Ze],
3347
+ rangeTypes: [Ge],
3348
+ worksheetTypes: [Ke, Ye]
3349
+ })),
3350
+ or(([t, n]) => t || n)
3306
3351
  )
3307
3352
  };
3308
3353
  }
3309
- const ic = {
3310
- [us.FORMULAS_INSERT]: {
3311
- [an.id]: {
3354
+ const hc = {
3355
+ [Un.BASIC]: {
3356
+ [`${fe.id}.sum`]: {
3357
+ order: 0,
3358
+ menuItemFactory: oc
3359
+ },
3360
+ [`${fe.id}.count`]: {
3312
3361
  order: 1,
3313
- menuItemFactory: nc,
3314
- [un.id]: {
3315
- order: 1,
3316
- menuItemFactory: rc
3317
- }
3362
+ menuItemFactory: sc
3363
+ },
3364
+ [`${fe.id}.average`]: {
3365
+ order: 2,
3366
+ menuItemFactory: ic
3367
+ },
3368
+ [`${fe.id}.max`]: {
3369
+ order: 3,
3370
+ menuItemFactory: cc
3371
+ },
3372
+ [`${fe.id}.min`]: {
3373
+ order: 4,
3374
+ menuItemFactory: ac
3318
3375
  }
3319
3376
  },
3320
- [Ro]: {
3321
- [cn.id]: {
3377
+ [Un.OTHERS]: {
3378
+ [vn.id]: {
3379
+ order: 0,
3380
+ menuItemFactory: lc
3381
+ }
3382
+ },
3383
+ [Io]: {
3384
+ [mn.id]: {
3322
3385
  order: 4,
3323
- menuItemFactory: sc
3386
+ menuItemFactory: dc
3324
3387
  }
3325
3388
  }
3326
- }, cc = "meta_key_ctrl_And_Shift", Lt = [
3327
- L.ARROW_DOWN,
3328
- L.ARROW_UP,
3329
- L.ARROW_LEFT,
3330
- L.ARROW_RIGHT
3331
- ], lc = [...Lt, L.ENTER, L.TAB, L.ESC];
3332
- function ac() {
3389
+ }, fc = "meta_key_ctrl_And_Shift", qt = [
3390
+ D.ARROW_DOWN,
3391
+ D.ARROW_UP,
3392
+ D.ARROW_LEFT,
3393
+ D.ARROW_RIGHT
3394
+ ], gc = [...qt, D.ENTER, D.TAB, D.ESC];
3395
+ function mc() {
3333
3396
  const e = [];
3334
- for (const t of lc)
3397
+ for (const t of gc)
3335
3398
  e.push({
3336
- id: ot.id,
3399
+ id: ft.id,
3337
3400
  binding: t,
3338
- preconditions: (n) => ft(n),
3401
+ preconditions: (n) => Et(n),
3339
3402
  staticParameters: {
3340
- eventType: Te.Keyboard,
3403
+ eventType: xe.Keyboard,
3341
3404
  keycode: t
3342
3405
  }
3343
3406
  });
3344
3407
  return e;
3345
3408
  }
3346
- function uc() {
3409
+ function pc() {
3347
3410
  const e = [];
3348
- for (const t of Lt)
3411
+ for (const t of qt)
3349
3412
  e.push({
3350
- id: ot.id,
3351
- binding: t | W.SHIFT,
3352
- preconditions: (n) => ft(n),
3413
+ id: ft.id,
3414
+ binding: t | P.SHIFT,
3415
+ preconditions: (n) => Et(n),
3353
3416
  staticParameters: {
3354
- eventType: Te.Keyboard,
3417
+ eventType: xe.Keyboard,
3355
3418
  keycode: t,
3356
- metaKey: W.SHIFT
3419
+ metaKey: P.SHIFT
3357
3420
  }
3358
3421
  });
3359
3422
  return e;
3360
3423
  }
3361
- function dc() {
3424
+ function vc() {
3362
3425
  const e = [];
3363
- for (const t of Lt)
3426
+ for (const t of qt)
3364
3427
  e.push({
3365
- id: ot.id,
3366
- binding: t | W.CTRL_COMMAND,
3367
- preconditions: (n) => ft(n),
3428
+ id: ft.id,
3429
+ binding: t | P.CTRL_COMMAND,
3430
+ preconditions: (n) => Et(n),
3368
3431
  staticParameters: {
3369
- eventType: Te.Keyboard,
3432
+ eventType: xe.Keyboard,
3370
3433
  keycode: t,
3371
- metaKey: W.CTRL_COMMAND
3434
+ metaKey: P.CTRL_COMMAND
3372
3435
  }
3373
3436
  });
3374
3437
  return e;
3375
3438
  }
3376
- function hc() {
3439
+ function Sc() {
3377
3440
  const e = [];
3378
- for (const t of Lt)
3441
+ for (const t of qt)
3379
3442
  e.push({
3380
- id: ot.id,
3381
- binding: t | W.SHIFT | W.CTRL_COMMAND,
3382
- preconditions: (n) => ft(n),
3443
+ id: ft.id,
3444
+ binding: t | P.SHIFT | P.CTRL_COMMAND,
3445
+ preconditions: (n) => Et(n),
3383
3446
  staticParameters: {
3384
- eventType: Te.Keyboard,
3447
+ eventType: xe.Keyboard,
3385
3448
  keycode: t,
3386
- metaKey: cc
3449
+ metaKey: fc
3387
3450
  }
3388
3451
  });
3389
3452
  return e;
3390
3453
  }
3391
- const fc = {
3392
- id: hr.id,
3393
- binding: L.F4,
3394
- preconditions: (e) => ft(e)
3454
+ const Cc = {
3455
+ id: gr.id,
3456
+ binding: D.F4,
3457
+ preconditions: (e) => Et(e)
3395
3458
  };
3396
- function gc() {
3459
+ function _c() {
3397
3460
  const e = [];
3398
- for (const t of [L.ENTER, L.TAB, L.ARROW_DOWN, L.ARROW_UP])
3461
+ for (const t of [D.ENTER, D.TAB, D.ARROW_DOWN, D.ARROW_UP])
3399
3462
  e.push({
3400
- id: ot.id,
3463
+ id: ft.id,
3401
3464
  binding: t,
3402
- preconditions: (n) => Mi(n),
3465
+ preconditions: (n) => ki(n),
3403
3466
  staticParameters: {
3404
- eventType: Te.Keyboard,
3467
+ eventType: xe.Keyboard,
3405
3468
  keycode: t,
3406
3469
  isSingleEditor: !0
3407
3470
  }
3408
3471
  });
3409
3472
  return e;
3410
3473
  }
3411
- var mc = Object.getOwnPropertyDescriptor, Sc = (e, t, n, o) => {
3412
- for (var r = o > 1 ? void 0 : o ? mc(t, n) : t, s = e.length - 1, c; s >= 0; s--)
3474
+ const Rc = {
3475
+ id: cs.id,
3476
+ binding: P.ALT | D.EQUAL,
3477
+ preconditions: bo,
3478
+ mac: P.CTRL_COMMAND | P.ALT | D.EQUAL,
3479
+ description: "shortcut.sheets-formula-ui.quick-sum",
3480
+ group: "4_sheet-edit"
3481
+ };
3482
+ var Ec = Object.getOwnPropertyDescriptor, Ic = (e, t, n, o) => {
3483
+ for (var r = o > 1 ? void 0 : o ? Ec(t, n) : t, s = e.length - 1, c; s >= 0; s--)
3413
3484
  (c = e[s]) && (r = c(r) || r);
3414
3485
  return r;
3415
- }, Ve = (e, t) => (n, o) => t(n, o, e);
3416
- let Mt = class extends nt {
3486
+ }, We = (e, t) => (n, o) => t(n, o, e);
3487
+ let Ut = class extends ut {
3417
3488
  constructor(e, t, n, o, r, s, c) {
3418
3489
  super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = c, this._initialize();
3419
3490
  }
@@ -3421,51 +3492,52 @@ let Mt = class extends nt {
3421
3492
  this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
3422
3493
  }
3423
3494
  _registerMenus() {
3424
- this._menuManagerService.mergeMenu(ic);
3495
+ this._menuManagerService.mergeMenu(hc);
3425
3496
  }
3426
3497
  _registerCommands() {
3427
3498
  [
3428
- cn,
3429
- an,
3430
- un,
3431
- As,
3432
- ys,
3433
- ot,
3434
- hr
3499
+ mn,
3500
+ fe,
3501
+ vn,
3502
+ Fs,
3503
+ xs,
3504
+ ft,
3505
+ gr
3435
3506
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
3436
3507
  }
3437
3508
  _registerShortcuts() {
3438
3509
  [
3439
- ...ac(),
3440
- ...uc(),
3441
- ...dc(),
3442
- ...hc(),
3443
- ...gc(),
3444
- fc
3510
+ ...mc(),
3511
+ ...pc(),
3512
+ ...vc(),
3513
+ ...Sc(),
3514
+ ..._c(),
3515
+ Rc,
3516
+ Cc
3445
3517
  ].forEach((e) => {
3446
3518
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
3447
3519
  });
3448
3520
  }
3449
3521
  _registerComponents() {
3450
- this.disposeWithMe(this._uiPartsService.registerComponent(bo.FORMULA_AUX, () => ir(Qi, this._injector))), this._componentManager.register(dr, tc);
3522
+ this.disposeWithMe(this._uiPartsService.registerComponent(yo.FORMULA_AUX, () => lr(ec, this._injector))), this._componentManager.register(fr, rc);
3451
3523
  }
3452
3524
  _registerRenderModules() {
3453
- this.disposeWithMe(this._renderManagerService.registerRenderModule(J.UNIVER_SHEET, [Ot]));
3525
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(q.UNIVER_SHEET, [$t]));
3454
3526
  }
3455
3527
  };
3456
- Mt = Sc([
3457
- Ve(0, B(dt)),
3458
- Ve(1, ds),
3459
- Ve(2, ue),
3460
- Ve(3, Dt),
3461
- Ve(4, or),
3462
- Ve(5, xe),
3463
- Ve(6, B(sr))
3464
- ], Mt);
3465
- const vc = () => {
3528
+ Ut = Ic([
3529
+ We(0, B(_t)),
3530
+ We(1, fs),
3531
+ We(2, de),
3532
+ We(3, jt),
3533
+ We(4, cr),
3534
+ We(5, Oe),
3535
+ We(6, B(ar))
3536
+ ], Ut);
3537
+ const bc = () => {
3466
3538
  var o, r;
3467
- const e = T(Tr), t = ve(e.currentSelector$), n = Y(null);
3468
- return P(() => {
3539
+ const e = T(Or), t = Ce(e.currentSelector$), n = G(null);
3540
+ return $(() => {
3469
3541
  var s, c;
3470
3542
  if (t)
3471
3543
  return (c = n.current) == null || c.showDialog((s = t.initialValue) != null ? s : []), () => {
@@ -3473,7 +3545,7 @@ const vc = () => {
3473
3545
  (i = n.current) == null || i.hideDialog();
3474
3546
  };
3475
3547
  }, [t]), /* @__PURE__ */ O(
3476
- yr,
3548
+ xr,
3477
3549
  {
3478
3550
  unitId: (o = t == null ? void 0 : t.unitId) != null ? o : "",
3479
3551
  subUnitId: (r = t == null ? void 0 : t.subUnitId) != null ? r : "",
@@ -3481,86 +3553,86 @@ const vc = () => {
3481
3553
  selectorRef: n,
3482
3554
  onChange: (s, c) => {
3483
3555
  var i;
3484
- t == null || t.callback((i = c == null ? void 0 : c.split(",").map((a) => rt(a))) != null ? i : []);
3556
+ t == null || t.callback((i = c == null ? void 0 : c.split(",").map((l) => dt(l))) != null ? i : []);
3485
3557
  }
3486
3558
  }
3487
3559
  );
3488
3560
  };
3489
- var pc = Object.defineProperty, Cc = Object.getOwnPropertyDescriptor, _c = (e, t, n) => t in e ? pc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Rc = (e, t, n, o) => {
3490
- for (var r = o > 1 ? void 0 : o ? Cc(t, n) : t, s = e.length - 1, c; s >= 0; s--)
3561
+ var yc = Object.defineProperty, Tc = Object.getOwnPropertyDescriptor, xc = (e, t, n) => t in e ? yc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Oc = (e, t, n, o) => {
3562
+ for (var r = o > 1 ? void 0 : o ? Tc(t, n) : t, s = e.length - 1, c; s >= 0; s--)
3491
3563
  (c = e[s]) && (r = c(r) || r);
3492
3564
  return r;
3493
- }, Rt = (e, t) => (n, o) => t(n, o, e), Mr = (e, t, n) => _c(e, typeof t != "symbol" ? t + "" : t, n);
3494
- let wt = class extends no {
3495
- constructor(e = Pn, t, n, o, r) {
3565
+ }, Mt = (e, t) => (n, o) => t(n, o, e), kr = (e, t, n) => xc(e, typeof t != "symbol" ? t + "" : t, n);
3566
+ let Vt = class extends oo {
3567
+ constructor(e = qn, t, n, o, r) {
3496
3568
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3497
- const { menu: s, ...c } = ro(
3498
- Pn,
3569
+ const { menu: s, ...c } = so(
3570
+ qn,
3499
3571
  this._config
3500
3572
  );
3501
- s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(Ni, c, { merge: !0 });
3573
+ s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(wi, c, { merge: !0 });
3502
3574
  }
3503
3575
  onStarting() {
3504
- oo(this._injector, [
3505
- [ln, { useClass: Kt }],
3506
- [Tr],
3507
- [Mt],
3508
- [Tt],
3509
- [xt],
3510
- [Ot],
3511
- [Nt],
3512
- [yt]
3576
+ io(this._injector, [
3577
+ [pn, { useClass: tn }],
3578
+ [Or],
3579
+ [Ut],
3580
+ [Dt],
3581
+ [Lt],
3582
+ [$t],
3583
+ [Pt],
3584
+ [Ft]
3513
3585
  ]), this._initUIPart();
3514
3586
  }
3515
3587
  onReady() {
3516
3588
  [
3517
- [Fe]
3589
+ [De]
3518
3590
  ].forEach((e) => {
3519
- this.disposeWithMe(this._renderManagerService.registerRenderModule(J.UNIVER_SHEET, e));
3591
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(q.UNIVER_SHEET, e));
3520
3592
  });
3521
3593
  }
3522
3594
  onRendered() {
3523
3595
  [
3524
- [Gt]
3596
+ [rn]
3525
3597
  ].forEach((e) => {
3526
- this.disposeWithMe(this._renderManagerService.registerRenderModule(J.UNIVER_SHEET, e));
3527
- }), so(this._injector, [
3528
- [Mt],
3598
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(q.UNIVER_SHEET, e));
3599
+ }), co(this._injector, [
3600
+ [Ut],
3529
3601
  // FormulaProgressBar relies on TriggerCalculationController, but it is necessary to ensure that the formula calculation is done after rendered.
3530
- [xt],
3531
- [Nt]
3602
+ [Lt],
3603
+ [Pt]
3532
3604
  ]);
3533
3605
  }
3534
3606
  onSteady() {
3535
- this._injector.get(Tt), this._injector.get(yt);
3607
+ this._injector.get(Dt), this._injector.get(Ft);
3536
3608
  }
3537
3609
  _initUIPart() {
3538
- const e = this._injector.get(sr);
3539
- this.disposeWithMe(e.register(Eo, yr)), this.disposeWithMe(e.register(Io, _i)), this.disposeWithMe(this._uiPartsService.registerComponent(hs.GLOBAL, () => ir(vc, this._injector)));
3610
+ const e = this._injector.get(ar);
3611
+ this.disposeWithMe(e.register(To, xr)), this.disposeWithMe(e.register(xo, Ei)), this.disposeWithMe(this._uiPartsService.registerComponent(gs.GLOBAL, () => lr(bc, this._injector)));
3540
3612
  }
3541
3613
  };
3542
- Mr(wt, "pluginName", ur);
3543
- Mr(wt, "type", J.UNIVER_SHEET);
3544
- wt = Rc([
3545
- eo(Do, os),
3546
- Rt(1, B(dt)),
3547
- Rt(2, xe),
3548
- Rt(3, to),
3549
- Rt(4, or)
3550
- ], wt);
3614
+ kr(Vt, "pluginName", hr);
3615
+ kr(Vt, "type", q.UNIVER_SHEET);
3616
+ Vt = Oc([
3617
+ no(Po, as),
3618
+ Mt(1, B(_t)),
3619
+ Mt(2, Oe),
3620
+ Mt(3, ro),
3621
+ Mt(4, cr)
3622
+ ], Vt);
3551
3623
  export {
3552
- Is as FORMULA_PROMPT_ACTIVATED,
3553
- _i as FormulaEditor,
3554
- yt as FormulaReorderController,
3555
- Tr as GlobalRangeSelectorService,
3556
- ys as HelpFunctionOperation,
3557
- an as InsertFunctionOperation,
3558
- un as MoreFunctionsOperation,
3559
- yr as RangeSelector,
3560
- Fe as RefSelectionsRenderService,
3561
- hr as ReferenceAbsoluteOperation,
3562
- As as SearchFunctionOperation,
3563
- ot as SelectEditorFormulaOperation,
3564
- cn as SheetOnlyPasteFormulaCommand,
3565
- wt as UniverSheetsFormulaUIPlugin
3624
+ Ts as FORMULA_PROMPT_ACTIVATED,
3625
+ Ei as FormulaEditor,
3626
+ Ft as FormulaReorderController,
3627
+ Or as GlobalRangeSelectorService,
3628
+ xs as HelpFunctionOperation,
3629
+ fe as InsertFunctionOperation,
3630
+ vn as MoreFunctionsOperation,
3631
+ xr as RangeSelector,
3632
+ De as RefSelectionsRenderService,
3633
+ gr as ReferenceAbsoluteOperation,
3634
+ Fs as SearchFunctionOperation,
3635
+ ft as SelectEditorFormulaOperation,
3636
+ mn as SheetOnlyPasteFormulaCommand,
3637
+ Vt as UniverSheetsFormulaUIPlugin
3566
3638
  };