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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,30 +1,30 @@
1
- var Jr = Object.defineProperty;
2
- var eo = (e, t, n) => t in e ? Jr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var j = (e, t, n) => eo(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { CommandType as be, ICommandService as pe, createIdentifier as to, IContextService as dn, IUniverInstanceService as te, Rectangle as hn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as fn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ir, DEFAULT_EMPTY_DOCUMENT_VALUE as cr, isRealNum as no, CellValueType as Dn, getCellValueType as ro, Inject as q, Disposable as Ze, ObjectMatrix as Fe, Range as oo, Tools as gn, LocaleService as dt, isICellData as so, isFormulaString as Ce, isFormulaId as De, generateRandomId as Yt, Direction as de, Injector as It, getEmptyCell as mt, UniverInstanceType as U, ThemeService as Et, ILogService as io, toDisposable as lr, ColorKit as mn, RxDisposable as co, InterceptorEffectEnum as lo, FOCUSING_DOC as ao, FOCUSING_UNIVER_EDITOR as uo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as Ln, EDITOR_ACTIVATED as $n, createInternalEditorID as ho, BuildTextUtils as fo, IConfigService as ar, RichTextBuilder as go, DependentOn as mo, Plugin as po, merge as So, registerDependencies as vo, touchDependencies as Co } from "@univerjs/core";
5
- import { ISheetClipboardService as ur, PREDEFINED_HOOK_NAME_COPY as dr, SheetPasteCommand as _o, PREDEFINED_HOOK_NAME_PASTE as lt, IEditorBridgeService as pn, SetCellEditVisibleOperation as hr, HoverManagerService as Ro, CellAlertManagerService as Io, CellAlertType as Eo, IAutoFillService as bo, APPLY_TYPE as yo, DATA_TYPE as Pn, COPY_TYPE as fr, SheetSkeletonManagerService as bt, attachSelectionWithCoord as sn, SelectionControl as gr, SELECTION_SHAPE_DEPTH as To, useActiveWorkbook as Oo, getCurrentRangeDisable$ as $e, PASTE_SPECIAL_MENU_ID as No, COPY_SPECIAL_MENU_ID as Mo, whenFormulaEditorActivated as yt, whenSheetEditorFocused as xo, SheetsUIPart as wo, BaseSelectionRenderService as ko, getCoordByOffset as Un, checkInHeaderRanges as Vn, getAllSelection as Ao, genNormalSelectionStyle as mr, getSheetObject as Fo, MoveSelectionCommand as Wn, JumpOver as Hn, ExpandSelectionCommand as Bn, EMBEDDING_FORMULA_EDITOR as Do, IMarkSelectionService as Lo, RANGE_SELECTOR_COMPONENT_KEY as $o, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Po } from "@univerjs/sheets-ui";
6
- import { sequenceNodeType as Q, serializeRange as Ee, FormulaDataModel as Tt, LexerTreeBuilder as ye, ErrorType as ue, extractFormulaError as pr, SetFormulaCalculationResultMutation as Uo, SetArrayFormulaDataMutation as Vo, SetFormulaCalculationStopMutation as Wo, FunctionType as Sr, matchToken as Ge, deserializeRangeWithSheetWithCache as Ho, matchRefDrawToken as Bo, isFormulaLexerToken as qo, deserializeRangeWithSheet as ht, serializeRangeToRefString as jo, serializeRangeWithSheet as _t, serializeRangeWithSpreadsheet as Ko, generateStringWithSequence as Yo, operatorToken as vr } from "@univerjs/engine-formula";
7
- import { Subject as pt, debounceTime as Sn, combineLatestWith as Go, map as Cr, switchMap as Zo, of as qn, Observable as zo, BehaviorSubject as _r, throttleTime as Xo, filter as Rr, distinctUntilChanged as Qo, merge as Jo } from "rxjs";
8
- import { IEditorService as ze, DocSelectionRenderService as Ir, ReplaceTextRunsCommand as jn, MoveSelectionOperation as es, MoveCursorOperation as ts, useKeyboardEvent as ns, useResize as rs, DocBackScrollRenderController as os, RichTextEditor as ss } from "@univerjs/docs-ui";
1
+ var Xr = Object.defineProperty;
2
+ var Qr = (e, t, n) => t in e ? Xr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var j = (e, t, n) => Qr(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { CommandType as be, ICommandService as pe, createIdentifier as Jr, IContextService as dn, IUniverInstanceService as ne, Rectangle as hn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as fn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as sr, DEFAULT_EMPTY_DOCUMENT_VALUE as ir, isRealNum as eo, CellValueType as Ln, getCellValueType as to, Inject as q, Disposable as Ze, ObjectMatrix as Fe, Range as no, Tools as gn, LocaleService as dt, isICellData as ro, isFormulaString as Ce, isFormulaId as De, generateRandomId as Yt, Direction as de, Injector as It, getEmptyCell as mt, UniverInstanceType as W, ThemeService as Et, ILogService as oo, toDisposable as cr, ColorKit as mn, RxDisposable as so, InterceptorEffectEnum as io, IConfigService as pn, FOCUSING_DOC as co, FOCUSING_UNIVER_EDITOR as lo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as $n, EDITOR_ACTIVATED as Pn, createInternalEditorID as ao, BuildTextUtils as uo, RichTextBuilder as ho, DependentOn as fo, Plugin as go, merge as mo, registerDependencies as po, touchDependencies as So } from "@univerjs/core";
5
+ import { ISheetClipboardService as lr, PREDEFINED_HOOK_NAME_COPY as ar, SheetPasteCommand as vo, PREDEFINED_HOOK_NAME_PASTE as lt, IEditorBridgeService as Sn, SetCellEditVisibleOperation as ur, HoverManagerService as Co, CellAlertManagerService as _o, CellAlertType as Ro, IAutoFillService as Io, APPLY_TYPE as Eo, DATA_TYPE as Un, COPY_TYPE as dr, SheetSkeletonManagerService as bt, attachSelectionWithCoord as sn, SelectionControl as hr, SELECTION_SHAPE_DEPTH as bo, useActiveWorkbook as yo, menuClipboardDisabledObservable as To, getCurrentRangeDisable$ as $e, PASTE_SPECIAL_MENU_ID as Oo, COPY_SPECIAL_MENU_ID as No, whenFormulaEditorActivated as yt, whenSheetEditorFocused as Mo, SheetsUIPart as xo, BaseSelectionRenderService as wo, getCoordByOffset as Vn, checkInHeaderRanges as Wn, getAllSelection as ko, genNormalSelectionStyle as fr, getSheetObject as Ao, MoveSelectionCommand as Hn, JumpOver as Bn, ExpandSelectionCommand as qn, EMBEDDING_FORMULA_EDITOR as Fo, IMarkSelectionService as Do, RANGE_SELECTOR_COMPONENT_KEY as Lo, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as $o } from "@univerjs/sheets-ui";
6
+ import { sequenceNodeType as Q, serializeRange as Ee, FormulaDataModel as Tt, LexerTreeBuilder as ye, ErrorType as ue, extractFormulaError as gr, SetFormulaCalculationResultMutation as Po, SetArrayFormulaDataMutation as Uo, SetFormulaCalculationStopMutation as Vo, FunctionType as mr, matchToken as Ge, deserializeRangeWithSheetWithCache as Wo, matchRefDrawToken as Ho, isFormulaLexerToken as Bo, deserializeRangeWithSheet as ht, serializeRangeToRefString as qo, serializeRangeWithSheet as _t, serializeRangeWithSpreadsheet as jo, generateStringWithSequence as Ko, operatorToken as pr } from "@univerjs/engine-formula";
7
+ import { Subject as pt, debounceTime as vn, combineLatestWith as Yo, map as Sr, BehaviorSubject as vr, throttleTime as Go, filter as Cr, distinctUntilChanged as Zo, merge as zo } from "rxjs";
8
+ import { IEditorService as ze, DocSelectionRenderService as _r, ReplaceTextRunsCommand as jn, MoveSelectionOperation as Xo, MoveCursorOperation as Qo, useKeyboardEvent as Jo, useResize as es, DocBackScrollRenderController as ts, RichTextEditor as ns } from "@univerjs/docs-ui";
9
9
  import { DeviceInputEventType as xe, IRenderManagerService as Te, ScrollTimerType as en, SHEET_VIEWPORT_KEY as Kn, Vector2 as Yn } from "@univerjs/engine-render";
10
- import { SheetsSelectionsService as vn, getSheetCommandTarget as Er, getCellAtRowCol as is, SetSelectionsOperation as Cn, SheetInterceptorService as _n, ReorderRangeCommand as cs, SetRangeValuesMutation as Lt, SetRangeValuesUndoMutationFactory as ls, BEFORE_CELL_EDIT as as, SetWorksheetRowAutoHeightMutation as us, INTERCEPTOR_POINT as ds, WorksheetSetCellValuePermission as Xe, WorksheetEditPermission as Qe, RangeProtectionPermissionEditPoint as Je, WorkbookEditablePermission as et, RangeProtectionPermissionViewPoint as hs, WorksheetCopyPermission as fs, WorkbookCopyPermission as gs, IRefSelectionsService as Gt, SelectionMoveType as tn, convertSelectionDataToRange as ms, setEndForRange as ps, REF_SELECTIONS_ENABLED as Gn, SetWorksheetActiveOperation as Zn } from "@univerjs/sheets";
11
- import { InsertFunctionCommand as Ss, TriggerCalculationController as vs, IDescriptionService as Zt, QuickSumCommand as Cs, ImageFormulaCellInterceptorController as _s, UniverSheetsFormulaPlugin as Rs } from "@univerjs/sheets-formula";
12
- import { ISidebarService as Rn, IZenZoneService as Is, useDependency as O, useObservable as _e, ProgressBar as Es, getMenuHiddenObservable as Pe, MenuItemType as Ue, IClipboardInterfaceService as zn, RibbonFormulasGroup as Xn, KeyCode as $, MetaKeys as V, IMenuManagerService as bs, IShortcutService as zt, IUIPartsService as br, ComponentManager as yr, connectInjector as Tr, useEvent as ee, RectPopup as cn, IContextMenuService as ys, useUpdateEffect as Ts, BuiltInUIPart as Os } from "@univerjs/ui";
13
- import { jsx as x, jsxs as B, Fragment as Ns } from "react/jsx-runtime";
14
- import { useCallback as $t, useState as H, useRef as z, createElement as tt, forwardRef as Ve, useEffect as P, useMemo as le, useLayoutEffect as Pt, useImperativeHandle as Ms } from "react";
15
- import { clsx as se, scrollbarClassName as ut, borderLeftClassName as xs, Select as ws, Input as Or, borderClassName as In, Button as at, borderTopClassName as ks, Tooltip as As, Dialog as Fs } from "@univerjs/design";
16
- import { DocSelectionManagerService as Nr } from "@univerjs/docs";
17
- import { debounceTime as Ds } from "rxjs/operators";
18
- const En = {
10
+ import { SheetsSelectionsService as Cn, getSheetCommandTarget as Rr, getCellAtRowCol as rs, SetSelectionsOperation as _n, SheetInterceptorService as Rn, ReorderRangeCommand as os, SetRangeValuesMutation as Lt, SetRangeValuesUndoMutationFactory as ss, BEFORE_CELL_EDIT as is, SetWorksheetRowAutoHeightMutation as cs, INTERCEPTOR_POINT as ls, WorksheetSetCellValuePermission as Xe, WorksheetEditPermission as Qe, RangeProtectionPermissionEditPoint as Je, WorkbookEditablePermission as et, RangeProtectionPermissionViewPoint as as, WorksheetCopyPermission as us, WorkbookCopyPermission as ds, IRefSelectionsService as Gt, SelectionMoveType as tn, convertSelectionDataToRange as hs, setEndForRange as fs, REF_SELECTIONS_ENABLED as Gn, SetWorksheetActiveOperation as Zn } from "@univerjs/sheets";
11
+ import { InsertFunctionCommand as gs, TriggerCalculationController as ms, PLUGIN_CONFIG_KEY_BASE as ps, IDescriptionService as Zt, QuickSumCommand as Ss, ImageFormulaCellInterceptorController as vs, UniverSheetsFormulaPlugin as Cs } from "@univerjs/sheets-formula";
12
+ import { ISidebarService as In, IZenZoneService as _s, useDependency as y, useObservable as _e, ProgressBar as Rs, getMenuHiddenObservable as Pe, MenuItemType as Ue, RibbonFormulasGroup as zn, KeyCode as L, MetaKeys as V, IMenuManagerService as Is, IShortcutService as zt, IUIPartsService as Ir, ComponentManager as Er, connectInjector as br, useEvent as ee, RectPopup as cn, IContextMenuService as Es, useUpdateEffect as bs, BuiltInUIPart as ys } from "@univerjs/ui";
13
+ import { jsx as x, jsxs as B, Fragment as Ts } from "react/jsx-runtime";
14
+ import { useCallback as $t, useState as H, useRef as X, createElement as tt, forwardRef as Ve, useEffect as P, useMemo as le, useLayoutEffect as Pt, useImperativeHandle as Os } from "react";
15
+ import { clsx as se, scrollbarClassName as ut, borderLeftClassName as Ns, Select as Ms, Input as yr, borderClassName as En, Button as at, borderTopClassName as xs, Tooltip as ws, Dialog as ks } from "@univerjs/design";
16
+ import { DocSelectionManagerService as Tr } from "@univerjs/docs";
17
+ import { debounceTime as As } from "rxjs/operators";
18
+ const bn = {
19
19
  id: "sheet.command.copy-formula-only",
20
20
  type: be.COMMAND,
21
- handler: async (e) => e.get(ur).copy({
22
- copyHookType: dr.SPECIAL_COPY_FORMULA_ONLY
21
+ handler: async (e) => e.get(lr).copy({
22
+ copyHookType: ar.SPECIAL_COPY_FORMULA_ONLY
23
23
  })
24
- }, bn = {
24
+ }, yn = {
25
25
  id: "sheet.command.paste-formula",
26
26
  type: be.COMMAND,
27
- handler: async (e) => e.get(pe).executeCommand(_o.id, {
27
+ handler: async (e) => e.get(pe).executeCommand(vo.id, {
28
28
  value: lt.SPECIAL_PASTE_FORMULA
29
29
  })
30
30
  }, ft = {
@@ -32,12 +32,12 @@ const En = {
32
32
  type: be.OPERATION,
33
33
  handler: (e, t) => !0
34
34
  };
35
- var Ls = Object.getOwnPropertyDescriptor, $s = (e, t, n, o) => {
36
- for (var r = o > 1 ? void 0 : o ? Ls(t, n) : t, s = e.length - 1, i; s >= 0; s--)
35
+ var Fs = Object.getOwnPropertyDescriptor, Ds = (e, t, n, o) => {
36
+ for (var r = o > 1 ? void 0 : o ? Fs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
37
37
  (i = e[s]) && (r = i(r) || r);
38
38
  return r;
39
- }, Ps = (e, t) => (n, o) => t(n, o, e);
40
- const Us = "FORMULA_PROMPT_ACTIVATED", Xt = to("formula-ui.prompt-service");
39
+ }, Ls = (e, t) => (n, o) => t(n, o, e);
40
+ const $s = "FORMULA_PROMPT_ACTIVATED", Xt = Jr("formula-ui.prompt-service");
41
41
  let ln = class {
42
42
  constructor(e) {
43
43
  j(this, "_search$", new pt());
@@ -61,7 +61,7 @@ let ln = class {
61
61
  this._search$.complete(), this._help$.complete(), this._navigate$.complete(), this._accept$.complete(), this._acceptFormulaName$.complete(), this._sequenceNodes = [];
62
62
  }
63
63
  search(e) {
64
- this._contextService.setContextValue(Us, e.visible), this._searching = e.visible, this._search$.next(e);
64
+ this._contextService.setContextValue($s, e.visible), this._searching = e.visible, this._search$.next(e);
65
65
  }
66
66
  isSearching() {
67
67
  return this._searching;
@@ -193,10 +193,10 @@ let ln = class {
193
193
  return this._isLockedOnSelectionInsertRefString;
194
194
  }
195
195
  };
196
- ln = $s([
197
- Ps(0, dn)
196
+ ln = Ds([
197
+ Ls(0, dn)
198
198
  ], ln);
199
- const Vs = {
199
+ const Ps = {
200
200
  id: "formula-ui.operation.help-function",
201
201
  type: be.OPERATION,
202
202
  handler: async (e, t) => (e.get(Xt).help(t), !0)
@@ -205,76 +205,76 @@ const Vs = {
205
205
  type: be.OPERATION,
206
206
  // eslint-disable-next-line
207
207
  handler: async (e, t) => {
208
- var C, _;
209
- const n = e.get(vn), o = e.get(ze), r = n.getCurrentSelections();
208
+ var C, R;
209
+ const n = e.get(Cn), o = e.get(ze), r = n.getCurrentSelections();
210
210
  if (!r || !r.length)
211
211
  return !1;
212
- const s = Er(e.get(te));
212
+ const s = Rr(e.get(ne));
213
213
  if (!s) return !1;
214
- const { worksheet: i, unitId: c, subUnitId: a } = s, h = i.getCellMatrix(), { value: f } = t, m = e.get(pe);
215
- e.get(pn);
216
- const d = [], u = [];
217
- let l = null, v = 0, S = 0, g = "";
218
- if (r.length === 1 && (Bs(r[0].range) || qs(r[0].range) && Jn(h, r[0].range))) {
219
- const { range: E, primary: p } = r[0], b = (C = p == null ? void 0 : p.actualRow) != null ? C : E.startRow, y = (_ = p == null ? void 0 : p.actualColumn) != null ? _ : E.startColumn;
220
- l = E, v = b, S = y;
221
- const A = Qn(h, b, y);
222
- A && (g = Ee(A));
214
+ const { worksheet: i, unitId: c, subUnitId: a } = s, d = i.getCellMatrix(), { value: f } = t, m = e.get(pe);
215
+ e.get(Sn);
216
+ const u = [], h = [];
217
+ let l = null, S = 0, v = 0, g = "";
218
+ if (r.length === 1 && (Ws(r[0].range) || Hs(r[0].range) && Qn(d, r[0].range))) {
219
+ const { range: E, primary: p } = r[0], b = (C = p == null ? void 0 : p.actualRow) != null ? C : E.startRow, T = (R = p == null ? void 0 : p.actualColumn) != null ? R : E.startColumn;
220
+ l = E, S = b, v = T;
221
+ const F = Xn(d, b, T);
222
+ F && (g = Ee(F));
223
223
  } else
224
224
  r.some((E) => {
225
- var y, A;
225
+ var T, F;
226
226
  const { range: p, primary: b } = E;
227
- if (Jn(h, p)) {
228
- const F = (y = b == null ? void 0 : b.actualRow) != null ? y : p.startRow, N = (A = b == null ? void 0 : b.actualColumn) != null ? A : p.startColumn, M = Qn(h, F, N);
227
+ if (Qn(d, p)) {
228
+ const A = (T = b == null ? void 0 : b.actualRow) != null ? T : p.startRow, N = (F = b == null ? void 0 : b.actualColumn) != null ? F : p.startColumn, M = Xn(d, A, N);
229
229
  if (!M)
230
- return l = p, v = F, S = N, !0;
231
- const k = Ee(M), I = `=${f}(${k})`;
232
- d.push({
230
+ return l = p, S = A, v = N, !0;
231
+ const w = Ee(M), k = `=${f}(${w})`;
232
+ u.push({
233
233
  range: p,
234
234
  primary: {
235
- row: F,
235
+ row: A,
236
236
  column: N
237
237
  },
238
- formula: I
238
+ formula: k
239
239
  });
240
240
  } else {
241
- const { startRow: F, startColumn: N, endRow: M, endColumn: k } = p;
242
- if (F === M) {
243
- const I = js(h, F, k, i.getColumnCount() - 1), w = I === k ? k - 1 : k, R = Ee({
244
- startRow: F,
241
+ const { startRow: A, startColumn: N, endRow: M, endColumn: w } = p;
242
+ if (A === M) {
243
+ const k = Bs(d, A, w, i.getColumnCount() - 1), $ = k === w ? w - 1 : w, I = Ee({
244
+ startRow: A,
245
245
  endRow: M,
246
246
  startColumn: N,
247
- endColumn: w
248
- }), T = `=${f}(${R})`;
249
- u.push({
247
+ endColumn: $
248
+ }), _ = `=${f}(${I})`;
249
+ h.push({
250
250
  range: p,
251
251
  primary: {
252
- row: F,
253
- column: I
252
+ row: A,
253
+ column: k
254
254
  },
255
- formula: T
255
+ formula: _
256
256
  });
257
257
  } else {
258
- let I = -1;
259
- for (let R = N; R <= k; R++) {
260
- const T = Ks(h, R, M, i.getRowCount() - 1);
261
- I = Math.max(I, T);
258
+ let k = -1;
259
+ for (let I = N; I <= w; I++) {
260
+ const _ = qs(d, I, M, i.getRowCount() - 1);
261
+ k = Math.max(k, _);
262
262
  }
263
- const w = I === M ? M - 1 : M;
264
- for (let R = N; R <= k; R++) {
265
- const T = Ee({
266
- startRow: F,
267
- endRow: w,
268
- startColumn: R,
269
- endColumn: R
270
- }), D = `=${f}(${T})`;
271
- u.push({
263
+ const $ = k === M ? M - 1 : M;
264
+ for (let I = N; I <= w; I++) {
265
+ const _ = Ee({
266
+ startRow: A,
267
+ endRow: $,
268
+ startColumn: I,
269
+ endColumn: I
270
+ }), O = `=${f}(${_})`;
271
+ h.push({
272
272
  range: p,
273
273
  primary: {
274
- row: I,
275
- column: R
274
+ row: k,
275
+ column: I
276
276
  },
277
- formula: D
277
+ formula: O
278
278
  });
279
279
  }
280
280
  }
@@ -282,41 +282,41 @@ const Vs = {
282
282
  return !1;
283
283
  });
284
284
  if (l) {
285
- const E = is(v, S, i), p = {
285
+ const E = rs(S, v, i), p = {
286
286
  range: hn.clone(l),
287
287
  primary: {
288
288
  startRow: E.startRow,
289
289
  startColumn: E.startColumn,
290
290
  endRow: E.endRow,
291
291
  endColumn: E.endColumn,
292
- actualRow: v,
293
- actualColumn: S,
292
+ actualRow: S,
293
+ actualColumn: v,
294
294
  isMerged: E.isMerged,
295
- isMergedMainCell: E.startRow === v && E.startColumn === S
295
+ isMergedMainCell: E.startRow === S && E.startColumn === v
296
296
  }
297
297
  }, b = {
298
298
  unitId: c,
299
299
  subUnitId: a,
300
300
  selections: [p]
301
301
  };
302
- await m.executeCommand(Cn.id, b);
303
- const y = o.getEditor(fn), A = o.getEditor(ir);
304
- m.syncExecuteCommand(hr.id, {
302
+ await m.executeCommand(_n.id, b);
303
+ const T = o.getEditor(fn), F = o.getEditor(sr);
304
+ m.syncExecuteCommand(ur.id, {
305
305
  visible: !0,
306
306
  unitId: c,
307
307
  eventType: xe.Dblclick
308
308
  });
309
- const F = `=${f}(${g}`;
310
- y == null || y.replaceText(F), A == null || A.replaceText(F, !1);
309
+ const A = `=${f}(${g}`;
310
+ T == null || T.replaceText(A), F == null || F.replaceText(A, !1);
311
311
  }
312
- return d.length === 0 && u.length === 0 ? !1 : m.executeCommand(Ss.id, {
313
- list: d,
314
- listOfRangeHasNumber: u
312
+ return u.length === 0 && h.length === 0 ? !1 : m.executeCommand(gs.id, {
313
+ list: u,
314
+ listOfRangeHasNumber: h
315
315
  });
316
316
  }
317
317
  };
318
- function Qn(e, t, n) {
319
- const o = Ws(e, t, n);
318
+ function Xn(e, t, n) {
319
+ const o = Us(e, t, n);
320
320
  if (o !== t)
321
321
  return {
322
322
  startRow: o,
@@ -324,7 +324,7 @@ function Qn(e, t, n) {
324
324
  startColumn: n,
325
325
  endColumn: n
326
326
  };
327
- const r = Hs(e, t, n);
327
+ const r = Vs(e, t, n);
328
328
  return r !== n ? {
329
329
  startRow: t,
330
330
  endRow: t,
@@ -332,7 +332,7 @@ function Qn(e, t, n) {
332
332
  endColumn: n - 1
333
333
  } : null;
334
334
  }
335
- function Ws(e, t, n) {
335
+ function Us(e, t, n) {
336
336
  let o = !1;
337
337
  if (t === 0) return t;
338
338
  for (let r = t - 1; r >= 0; r--) {
@@ -349,7 +349,7 @@ function Ws(e, t, n) {
349
349
  }
350
350
  return t;
351
351
  }
352
- function Hs(e, t, n) {
352
+ function Vs(e, t, n) {
353
353
  let o = !1;
354
354
  if (n === 0) return n;
355
355
  for (let r = n - 1; r >= 0; r--) {
@@ -371,54 +371,54 @@ function Rt(e) {
371
371
  const t = e == null ? void 0 : e.p.body;
372
372
  if (t == null)
373
373
  return !1;
374
- const n = t.dataStream, r = n.substring(n.length - 2, n.length) === cr ? n.substring(0, n.length - 2) : n;
375
- return no(r);
374
+ const n = t.dataStream, r = n.substring(n.length - 2, n.length) === ir ? n.substring(0, n.length - 2) : n;
375
+ return eo(r);
376
376
  }
377
- return e && (e.t === Dn.NUMBER || ro(e) === Dn.NUMBER);
377
+ return e && (e.t === Ln.NUMBER || to(e) === Ln.NUMBER);
378
378
  }
379
- function Bs(e) {
379
+ function Ws(e) {
380
380
  return e.startRow === e.endRow && e.startColumn === e.endColumn;
381
381
  }
382
- function qs(e) {
382
+ function Hs(e) {
383
383
  return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
384
384
  }
385
- function Jn(e, t) {
385
+ function Qn(e, t) {
386
386
  for (let n = t.startRow; n <= t.endRow; n++)
387
387
  for (let o = t.startColumn; o <= t.endColumn; o++)
388
388
  if (Rt(e.getValue(n, o)))
389
389
  return !1;
390
390
  return !0;
391
391
  }
392
- function js(e, t, n, o) {
392
+ function Bs(e, t, n, o) {
393
393
  for (let r = n; r <= o; r++)
394
394
  if (!e.getValue(t, r))
395
395
  return r;
396
396
  return o;
397
397
  }
398
- function Ks(e, t, n, o) {
398
+ function qs(e, t, n, o) {
399
399
  for (let r = n; r <= o; r++)
400
400
  if (!e.getValue(r, t))
401
401
  return r;
402
402
  return o;
403
403
  }
404
- const Mr = "SHEET_FORMULA_UI_PLUGIN", xr = `${Mr}_MORE_FUNCTIONS_COMPONENT`, yn = {
404
+ const Or = "SHEET_FORMULA_UI_PLUGIN", Nr = `${Or}_MORE_FUNCTIONS_COMPONENT`, Tn = {
405
405
  id: "formula-ui.operation.more-functions",
406
406
  type: be.OPERATION,
407
- handler: async (e) => (e.get(Rn).open({
407
+ handler: async (e) => (e.get(In).open({
408
408
  header: { title: "formula.insert.tooltip" },
409
- children: { label: xr }
409
+ children: { label: Nr }
410
410
  }), !0)
411
- }, wr = {
411
+ }, Mr = {
412
412
  id: "formula-ui.operation.change-ref-to-absolute",
413
413
  type: be.OPERATION,
414
414
  handler: async (e) => !0
415
- }, Ys = {
415
+ }, js = {
416
416
  id: "formula-ui.operation.search-function",
417
417
  type: be.OPERATION,
418
418
  handler: async (e, t) => (e.get(Xt).search(t), !0)
419
419
  };
420
- var Gs = Object.getOwnPropertyDescriptor, Zs = (e, t, n, o) => {
421
- for (var r = o > 1 ? void 0 : o ? Gs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
420
+ var Ks = Object.getOwnPropertyDescriptor, Ys = (e, t, n, o) => {
421
+ for (var r = o > 1 ? void 0 : o ? Ks(t, n) : t, s = e.length - 1, i; s >= 0; s--)
422
422
  (i = e[s]) && (r = i(r) || r);
423
423
  return r;
424
424
  }, At = (e, t) => (n, o) => t(n, o, e);
@@ -428,7 +428,7 @@ let Ut = class extends Ze {
428
428
  }
429
429
  _initialize() {
430
430
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
431
- getMutations: (e) => e.id === cs.id ? this._reorderFormula(e.params) : {
431
+ getMutations: (e) => e.id === os.id ? this._reorderFormula(e.params) : {
432
432
  redos: [],
433
433
  undos: []
434
434
  }
@@ -441,24 +441,24 @@ let Ut = class extends Ze {
441
441
  redos: t,
442
442
  undos: n
443
443
  };
444
- const h = a.getCellMatrix(), f = new Fe(), m = new Fe();
445
- let d = !1;
446
- return oo.foreach(s, (u, l) => {
447
- let v = u;
448
- i.hasOwnProperty(u) && (v = i[u]);
449
- const S = h.getValue(v, l);
450
- if (S != null && S.f || S != null && S.si) {
451
- d = !0;
452
- const g = this._formulaDataModel.getFormulaStringByCell(v, l, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
444
+ const d = a.getCellMatrix(), f = new Fe(), m = new Fe();
445
+ let u = !1;
446
+ return no.foreach(s, (h, l) => {
447
+ let S = h;
448
+ i.hasOwnProperty(h) && (S = i[h]);
449
+ const v = d.getValue(S, l);
450
+ if (v != null && v.f || v != null && v.si) {
451
+ u = !0;
452
+ const g = this._formulaDataModel.getFormulaStringByCell(S, l, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
453
453
  g,
454
454
  0,
455
- u - v
456
- ), _ = gn.deepClone(S);
457
- _.f = C, _.si = null, f.setValue(u, l, _);
455
+ h - S
456
+ ), R = gn.deepClone(v);
457
+ R.f = C, R.si = null, f.setValue(h, l, R);
458
458
  } else
459
- f.setValue(u, l, S);
460
- m.setValue(u, l, h.getValue(u, l));
461
- }), d ? (t.push({
459
+ f.setValue(h, l, v);
460
+ m.setValue(h, l, d.getValue(h, l));
461
+ }), u ? (t.push({
462
462
  id: Lt.id,
463
463
  params: {
464
464
  unitId: o,
@@ -481,19 +481,19 @@ let Ut = class extends Ze {
481
481
  };
482
482
  }
483
483
  };
484
- Ut = Zs([
485
- At(0, q(_n)),
486
- At(1, q(te)),
484
+ Ut = Ys([
485
+ At(0, q(Rn)),
486
+ At(1, q(ne)),
487
487
  At(2, q(Tt)),
488
488
  At(3, q(ye))
489
489
  ], Ut);
490
- const kr = "sheets-formula-ui.base.config", er = {};
491
- var zs = Object.getOwnPropertyDescriptor, Xs = (e, t, n, o) => {
492
- for (var r = o > 1 ? void 0 : o ? zs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
490
+ const xr = "sheets-formula-ui.base.config", Jn = {};
491
+ var Gs = Object.getOwnPropertyDescriptor, Zs = (e, t, n, o) => {
492
+ for (var r = o > 1 ? void 0 : o ? Gs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
493
493
  (i = e[s]) && (r = i(r) || r);
494
494
  return r;
495
495
  }, St = (e, t) => (n, o) => t(n, o, e);
496
- const nn = "SHEET_FORMULA_ALERT", Qs = {
496
+ const nn = "SHEET_FORMULA_ALERT", zs = {
497
497
  [ue.DIV_BY_ZERO]: "divByZero",
498
498
  [ue.NAME]: "name",
499
499
  [ue.VALUE]: "value",
@@ -515,27 +515,27 @@ let an = class extends Ze {
515
515
  this._initCellAlertPopup(), this._initZenService();
516
516
  }
517
517
  _initCellAlertPopup() {
518
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Sn(100)).subscribe((e) => {
518
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(vn(100)).subscribe((e) => {
519
519
  var t, n, o, r, s;
520
520
  if (e) {
521
521
  const c = this._context.unit.getActiveSheet();
522
522
  if (!c) return this._hideAlert();
523
- const a = c.getCell(e.location.row, e.location.col), h = (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];
524
- if (so(a)) {
525
- const f = pr(a, !!h);
523
+ const a = c.getCell(e.location.row, e.location.col), d = (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];
524
+ if (ro(a)) {
525
+ const f = gr(a, !!d);
526
526
  if (!f) {
527
527
  this._hideAlert();
528
528
  return;
529
529
  }
530
- const m = this._cellAlertManagerService.currentAlert.get(nn), d = (s = m == null ? void 0 : m.alert) == null ? void 0 : s.location;
531
- if (d && d.row === e.location.row && d.col === e.location.col && d.subUnitId === e.location.subUnitId && d.unitId === e.location.unitId) {
530
+ const m = this._cellAlertManagerService.currentAlert.get(nn), u = (s = m == null ? void 0 : m.alert) == null ? void 0 : s.location;
531
+ if (u && u.row === e.location.row && u.col === e.location.col && u.subUnitId === e.location.subUnitId && u.unitId === e.location.unitId) {
532
532
  this._hideAlert();
533
533
  return;
534
534
  }
535
535
  this._cellAlertManagerService.showAlert({
536
- type: Eo.ERROR,
536
+ type: Ro.ERROR,
537
537
  title: this._localeService.t("formula.error.title"),
538
- message: this._localeService.t(`formula.error.${Qs[f]}`),
538
+ message: this._localeService.t(`formula.error.${zs[f]}`),
539
539
  location: e.location,
540
540
  width: 200,
541
541
  height: 74,
@@ -556,30 +556,30 @@ let an = class extends Ze {
556
556
  this._cellAlertManagerService.removeAlert(nn);
557
557
  }
558
558
  };
559
- an = Xs([
560
- St(1, q(Ro)),
561
- St(2, q(Io)),
559
+ an = Zs([
560
+ St(1, q(Co)),
561
+ St(2, q(_o)),
562
562
  St(3, q(dt)),
563
563
  St(4, q(Tt)),
564
- St(5, Is)
564
+ St(5, _s)
565
565
  ], an);
566
- var Js = Object.getOwnPropertyDescriptor, ei = (e, t, n, o) => {
567
- for (var r = o > 1 ? void 0 : o ? Js(t, n) : t, s = e.length - 1, i; s >= 0; s--)
566
+ var Xs = Object.getOwnPropertyDescriptor, Qs = (e, t, n, o) => {
567
+ for (var r = o > 1 ? void 0 : o ? Xs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
568
568
  (i = e[s]) && (r = i(r) || r);
569
569
  return r;
570
- }, tr = (e, t) => (n, o) => t(n, o, e);
570
+ }, er = (e, t) => (n, o) => t(n, o, e);
571
571
  let Vt = class extends Ze {
572
572
  constructor(e, t) {
573
573
  super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
574
574
  }
575
575
  _registerAutoFill() {
576
576
  const e = {
577
- type: Pn.FORMULA,
577
+ type: Un.FORMULA,
578
578
  priority: 1001,
579
579
  match: (t) => Ce(t == null ? void 0 : t.f) || De(t == null ? void 0 : t.si),
580
- isContinue: (t, n) => t.type === Pn.FORMULA,
580
+ isContinue: (t, n) => t.type === Un.FORMULA,
581
581
  applyFunctions: {
582
- [yo.COPY]: (t, n, o, r, s) => {
582
+ [Eo.COPY]: (t, n, o, r, s) => {
583
583
  const { data: i, index: c } = t;
584
584
  return this._fillCopyFormula(i, n, o, c, r, s);
585
585
  }
@@ -588,26 +588,26 @@ let Vt = class extends Ze {
588
588
  this._autoFillService.registerRule(e);
589
589
  }
590
590
  _fillCopyFormula(e, t, n, o, r, s) {
591
- var h, f;
592
- const i = ni(r), c = [], a = /* @__PURE__ */ new Map();
591
+ var d, f;
592
+ const i = ei(r), c = [], a = /* @__PURE__ */ new Map();
593
593
  for (let m = 1; m <= t; m++) {
594
- const d = (m - 1) % e.length, u = o[d], l = gn.deepClone(e[d]);
594
+ const u = (m - 1) % e.length, h = o[u], l = gn.deepClone(e[u]);
595
595
  if (l) {
596
- const v = ((h = e[d]) == null ? void 0 : h.f) || "", S = ((f = e[d]) == null ? void 0 : f.si) || "", g = Ce(v);
597
- if (De(S))
598
- l.si = S, l.f = null, l.v = null, l.p = null, l.t = null, c.push(l);
596
+ const S = ((d = e[u]) == null ? void 0 : d.f) || "", v = ((f = e[u]) == null ? void 0 : f.si) || "", g = Ce(S);
597
+ if (De(v))
598
+ l.si = v, l.f = null, l.v = null, l.p = null, l.t = null, c.push(l);
599
599
  else if (g) {
600
- let _ = a.get(d);
601
- if (_)
602
- l.si = _, l.f = null, l.v = null, l.p = null, l.t = null;
600
+ let R = a.get(u);
601
+ if (R)
602
+ l.si = R, l.f = null, l.v = null, l.p = null, l.t = null;
603
603
  else {
604
- _ = Yt(6), a.set(d, _);
605
- const { offsetX: E, offsetY: p } = ti(i, t, n, s, u), b = this._lexerTreeBuilder.moveFormulaRefOffset(
606
- v,
604
+ R = Yt(6), a.set(u, R);
605
+ const { offsetX: E, offsetY: p } = Js(i, t, n, s, h), b = this._lexerTreeBuilder.moveFormulaRefOffset(
606
+ S,
607
607
  E,
608
608
  p
609
609
  );
610
- l.si = _, l.f = b, l.v = null, l.p = null, l.t = null;
610
+ l.si = R, l.f = b, l.v = null, l.p = null, l.t = null;
611
611
  }
612
612
  c.push(l);
613
613
  }
@@ -616,30 +616,30 @@ let Vt = class extends Ze {
616
616
  return c;
617
617
  }
618
618
  };
619
- Vt = ei([
620
- tr(0, bo),
621
- tr(1, q(ye))
619
+ Vt = Qs([
620
+ er(0, Io),
621
+ er(1, q(ye))
622
622
  ], Vt);
623
- function ti(e, t, n, o, r) {
623
+ function Js(e, t, n, o, r) {
624
624
  const { source: s, target: i } = o, { rows: c } = i, { rows: a } = s;
625
- let h = 0, f = 0;
625
+ let d = 0, f = 0;
626
626
  switch (n) {
627
627
  case de.UP:
628
628
  f = c[r] - a[r];
629
629
  break;
630
630
  case de.RIGHT:
631
- h = e;
631
+ d = e;
632
632
  break;
633
633
  case de.DOWN:
634
634
  f = c[r] - a[r];
635
635
  break;
636
636
  case de.LEFT:
637
- h = -e * t;
637
+ d = -e * t;
638
638
  break;
639
639
  }
640
- return { offsetX: h, offsetY: f };
640
+ return { offsetX: d, offsetY: f };
641
641
  }
642
- function ni(e) {
642
+ function ei(e) {
643
643
  let t = 0;
644
644
  for (const n in e)
645
645
  e[n].forEach((o) => {
@@ -647,12 +647,12 @@ function ni(e) {
647
647
  });
648
648
  return t;
649
649
  }
650
- var ri = Object.getOwnPropertyDescriptor, oi = (e, t, n, o) => {
651
- for (var r = o > 1 ? void 0 : o ? ri(t, n) : t, s = e.length - 1, i; s >= 0; s--)
650
+ var ti = Object.getOwnPropertyDescriptor, ni = (e, t, n, o) => {
651
+ for (var r = o > 1 ? void 0 : o ? ti(t, n) : t, s = e.length - 1, i; s >= 0; s--)
652
652
  (i = e[s]) && (r = i(r) || r);
653
653
  return r;
654
654
  }, vt = (e, t) => (n, o) => t(n, o, e);
655
- const si = "default-paste-formula";
655
+ const ri = "default-paste-formula";
656
656
  let Wt = class extends Ze {
657
657
  constructor(e, t, n, o, r) {
658
658
  super(), this._univerInstanceService = e, this._lexerTreeBuilder = t, this._sheetClipboardService = n, this._injector = o, this._formulaDataModel = r, this._initialize();
@@ -667,7 +667,7 @@ let Wt = class extends Ze {
667
667
  const e = this;
668
668
  let t = null;
669
669
  return {
670
- id: dr.SPECIAL_COPY_FORMULA_ONLY,
670
+ id: ar.SPECIAL_COPY_FORMULA_ONLY,
671
671
  priority: 10,
672
672
  onBeforeCopy(n, o) {
673
673
  t = e._getWorksheet(n, o);
@@ -684,14 +684,14 @@ let Wt = class extends Ze {
684
684
  const s = e._getWorksheet(n, o);
685
685
  if (!s) return [];
686
686
  const { startRow: i, endRow: c } = r, a = [];
687
- for (let h = i; h <= c; h++)
688
- s.getRowFiltered(h) && a.push(h);
687
+ for (let d = i; d <= c; d++)
688
+ s.getRowFiltered(d) && a.push(d);
689
689
  return a;
690
690
  },
691
691
  handleMatrixOnCell(n, o, r, s, i, c, a) {
692
- const h = i.getValue(n, o);
693
- if (t && h && (Ce(h.f) || De(h.si))) {
694
- const f = Ce(h.f) ? h.f : e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId());
692
+ const d = i.getValue(n, o);
693
+ if (t && d && (Ce(d.f) || De(d.si))) {
694
+ const f = Ce(d.f) ? d.f : e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId());
695
695
  c.setValue(r, s, {
696
696
  ...mt(),
697
697
  f
@@ -715,20 +715,20 @@ let Wt = class extends Ze {
715
715
  }
716
716
  _pasteWithFormulaHook() {
717
717
  return {
718
- id: si,
718
+ id: ri,
719
719
  priority: 10,
720
720
  onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !1)
721
721
  };
722
722
  }
723
723
  _getWorkbook(e) {
724
- return e ? this._univerInstanceService.getUnit(e, U.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(U.UNIVER_SHEET);
724
+ return e ? this._univerInstanceService.getUnit(e, W.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(W.UNIVER_SHEET);
725
725
  }
726
726
  _getWorksheet(e, t) {
727
727
  const n = this._getWorkbook(e);
728
728
  return t ? n == null ? void 0 : n.getSheetBySheetId(t) : n == null ? void 0 : n.getActiveSheet();
729
729
  }
730
730
  _onPasteCells(e, t, n, o, r) {
731
- var d;
731
+ var u;
732
732
  if ([
733
733
  lt.SPECIAL_PASTE_FORMAT,
734
734
  lt.SPECIAL_PASTE_COL_WIDTH
@@ -737,23 +737,23 @@ let Wt = class extends Ze {
737
737
  undos: [],
738
738
  redos: []
739
739
  };
740
- const i = this._getWorkbook(), c = t.unitId || (i == null ? void 0 : i.getUnitId()), a = t.subUnitId || ((d = i == null ? void 0 : i.getActiveSheet()) == null ? void 0 : d.getSheetId());
740
+ const i = this._getWorkbook(), c = t.unitId || (i == null ? void 0 : i.getUnitId()), a = t.subUnitId || ((u = i == null ? void 0 : i.getActiveSheet()) == null ? void 0 : u.getSheetId());
741
741
  if (!c || !a)
742
742
  return {
743
743
  undos: [],
744
744
  redos: []
745
745
  };
746
- const h = t.range, f = n, m = {
747
- copyType: o.copyType || fr.COPY,
746
+ const d = t.range, f = n, m = {
747
+ copyType: o.copyType || dr.COPY,
748
748
  copyRange: e == null ? void 0 : e.range,
749
749
  pasteType: o.pasteType
750
750
  };
751
- return this._injector.invoke((u) => ii(
751
+ return this._injector.invoke((h) => oi(
752
752
  c,
753
753
  a,
754
- h,
754
+ d,
755
755
  f,
756
- u,
756
+ h,
757
757
  m,
758
758
  this._lexerTreeBuilder,
759
759
  this._formulaDataModel,
@@ -762,32 +762,32 @@ let Wt = class extends Ze {
762
762
  ));
763
763
  }
764
764
  };
765
- Wt = oi([
766
- vt(0, te),
765
+ Wt = ni([
766
+ vt(0, ne),
767
767
  vt(1, q(ye)),
768
- vt(2, ur),
768
+ vt(2, lr),
769
769
  vt(3, q(It)),
770
770
  vt(4, q(Tt))
771
771
  ], Wt);
772
- function ii(e, t, n, o, r, s, i, c, a = !1, h) {
773
- const f = [], m = [], d = ci(e, t, n, o, s, i, c, h);
774
- if (!d.hasValue())
772
+ function oi(e, t, n, o, r, s, i, c, a = !1, d) {
773
+ const f = [], m = [], u = si(e, t, n, o, s, i, c, d);
774
+ if (!u.hasValue())
775
775
  return {
776
776
  undos: [],
777
777
  redos: []
778
778
  };
779
- const u = {
779
+ const h = {
780
780
  unitId: e,
781
781
  subUnitId: t,
782
- cellValue: d.getData()
782
+ cellValue: u.getData()
783
783
  };
784
784
  f.push({
785
785
  id: Lt.id,
786
- params: u
786
+ params: h
787
787
  });
788
- const l = ls(
788
+ const l = ss(
789
789
  r,
790
- u
790
+ h
791
791
  );
792
792
  return m.push({
793
793
  id: Lt.id,
@@ -797,77 +797,77 @@ function ii(e, t, n, o, r, s, i, c, a = !1, h) {
797
797
  redos: f
798
798
  };
799
799
  }
800
- function ci(e, t, n, o, r, s, i, c) {
801
- return c ? r.pasteType === lt.SPECIAL_PASTE_VALUE ? ai(e, t, n, o, i, c) : r.pasteType === lt.SPECIAL_PASTE_FORMULA ? ui(e, t, n, o, s, i, c) : di(e, t, n, o, r.copyType, s, i, c) : li(e, t, n, o, i);
800
+ function si(e, t, n, o, r, s, i, c) {
801
+ return c ? r.pasteType === lt.SPECIAL_PASTE_VALUE ? ci(e, t, n, o, i, c) : r.pasteType === lt.SPECIAL_PASTE_FORMULA ? li(e, t, n, o, s, i, c) : ai(e, t, n, o, r.copyType, s, i, c) : ii(e, t, n, o, i);
802
802
  }
803
- function li(e, t, n, o, r) {
803
+ function ii(e, t, n, o, r) {
804
804
  const s = new Fe(), i = r.getSheetFormulaData(e, t);
805
- return o.forValue((c, a, h) => {
806
- var u;
807
- const f = n.rows[c], m = n.cols[a], d = {};
808
- Ce(h.v) ? (d.v = null, d.f = `${h.v}`, d.si = null, d.p = null, s.setValue(f, m, d)) : (u = i == null ? void 0 : i[f]) != null && u[m] && (d.v = h.v, d.f = null, d.si = null, d.p = null, s.setValue(f, m, d));
805
+ return o.forValue((c, a, d) => {
806
+ var h;
807
+ const f = n.rows[c], m = n.cols[a], u = {};
808
+ Ce(d.v) ? (u.v = null, u.f = `${d.v}`, u.si = null, u.p = null, s.setValue(f, m, u)) : (h = i == null ? void 0 : i[f]) != null && h[m] && (u.v = d.v, u.f = null, u.si = null, u.p = null, s.setValue(f, m, u));
809
809
  }), s;
810
810
  }
811
- function ai(e, t, n, o, r, s) {
812
- var h, f;
813
- const i = new Fe(), c = (f = (h = r.getArrayFormulaCellData()) == null ? void 0 : h[s.unitId]) == null ? void 0 : f[s.subUnitId], a = r.getSheetFormulaData(e, t);
814
- return o.forValue((m, d, u) => {
815
- var _, E;
816
- const l = s.range.rows[m % s.range.rows.length], v = s.range.cols[d % s.range.cols.length], S = n.rows[m], g = n.cols[d], C = {};
817
- if (Ce(u.f) || De(u.si))
818
- C.v = u.v, C.f = null, C.si = null, C.p = null, i.setValue(S, g, C);
819
- else if ((_ = c == null ? void 0 : c[l]) != null && _[v]) {
820
- const p = c[l][v];
821
- C.v = p.v, C.f = null, C.si = null, C.p = null, i.setValue(S, g, C);
822
- } else if ((E = a == null ? void 0 : a[S]) != null && E[g]) {
823
- if (C.v = u.v, C.f = null, C.si = null, C.p = null, u.p) {
824
- const p = Ar(u);
811
+ function ci(e, t, n, o, r, s) {
812
+ var d, f;
813
+ const i = new Fe(), c = (f = (d = r.getArrayFormulaCellData()) == null ? void 0 : d[s.unitId]) == null ? void 0 : f[s.subUnitId], a = r.getSheetFormulaData(e, t);
814
+ return o.forValue((m, u, h) => {
815
+ var R, E;
816
+ const l = s.range.rows[m % s.range.rows.length], S = s.range.cols[u % s.range.cols.length], v = n.rows[m], g = n.cols[u], C = {};
817
+ if (Ce(h.f) || De(h.si))
818
+ C.v = h.v, C.f = null, C.si = null, C.p = null, i.setValue(v, g, C);
819
+ else if ((R = c == null ? void 0 : c[l]) != null && R[S]) {
820
+ const p = c[l][S];
821
+ C.v = p.v, C.f = null, C.si = null, C.p = null, i.setValue(v, g, C);
822
+ } else if ((E = a == null ? void 0 : a[v]) != null && E[g]) {
823
+ if (C.v = h.v, C.f = null, C.si = null, C.p = null, h.p) {
824
+ const p = wr(h);
825
825
  p && (C.v = p);
826
826
  }
827
- i.setValue(S, g, C);
827
+ i.setValue(v, g, C);
828
828
  }
829
829
  }), i;
830
830
  }
831
- function ui(e, t, n, o, r, s, i) {
831
+ function li(e, t, n, o, r, s, i) {
832
832
  const c = new Fe(), a = /* @__PURE__ */ new Map();
833
- return o.forValue((h, f, m) => {
834
- const d = n.rows[h], u = n.cols[f], l = {};
833
+ return o.forValue((d, f, m) => {
834
+ const u = n.rows[d], h = n.cols[f], l = {};
835
835
  if (De(m.si)) {
836
836
  if (i.unitId !== e || i.subUnitId !== t) {
837
- const v = s.getFormulaStringByCell(
838
- i.range.rows[h % i.range.rows.length],
837
+ const S = s.getFormulaStringByCell(
838
+ i.range.rows[d % i.range.rows.length],
839
839
  i.range.cols[f % i.range.cols.length],
840
840
  i.subUnitId,
841
841
  i.unitId
842
- ), S = n.cols[f] - i.range.cols[f % i.range.cols.length], g = n.rows[h] - i.range.rows[h % i.range.rows.length], C = r.moveFormulaRefOffset(v || "", S, g);
842
+ ), v = n.cols[f] - i.range.cols[f % i.range.cols.length], g = n.rows[d] - i.range.rows[d % i.range.rows.length], C = r.moveFormulaRefOffset(S || "", v, g);
843
843
  l.si = null, l.f = C;
844
844
  } else
845
845
  l.si = m.si, l.f = null;
846
- l.v = null, l.p = null, c.setValue(d, u, l);
846
+ l.v = null, l.p = null, c.setValue(u, h, l);
847
847
  } else if (Ce(m.f)) {
848
- const v = `${h % i.range.rows.length}_${f % i.range.cols.length}`;
849
- let S = a.get(v);
850
- if (S)
851
- l.si = S, l.f = null;
848
+ const S = `${d % i.range.rows.length}_${f % i.range.cols.length}`;
849
+ let v = a.get(S);
850
+ if (v)
851
+ l.si = v, l.f = null;
852
852
  else {
853
- S = Yt(6), a.set(v, S);
854
- const g = n.cols[f] - i.range.cols[f % i.range.cols.length], C = n.rows[h] - i.range.rows[h % i.range.rows.length], _ = r.moveFormulaRefOffset(m.f || "", g, C);
855
- l.si = S, l.f = _;
853
+ v = Yt(6), a.set(S, v);
854
+ const g = n.cols[f] - i.range.cols[f % i.range.cols.length], C = n.rows[d] - i.range.rows[d % i.range.rows.length], R = r.moveFormulaRefOffset(m.f || "", g, C);
855
+ l.si = v, l.f = R;
856
856
  }
857
- l.v = null, l.p = null, c.setValue(d, u, l);
857
+ l.v = null, l.p = null, c.setValue(u, h, l);
858
858
  } else {
859
859
  if (l.v = m.v, l.f = null, l.si = null, l.p = null, m.p) {
860
- const v = Ar(m);
861
- v && (l.v = v);
860
+ const S = wr(m);
861
+ S && (l.v = S);
862
862
  }
863
- c.setValue(d, u, l);
863
+ c.setValue(u, h, l);
864
864
  }
865
865
  }), c;
866
866
  }
867
- function di(e, t, n, o, r, s, i, c) {
868
- const a = new Fe(), h = /* @__PURE__ */ new Map(), f = i.getSheetFormulaData(e, t), m = [];
869
- return r === fr.CUT ? o.forValue((d, u, l) => {
870
- const v = n.rows[d], S = n.cols[u], g = {};
867
+ function ai(e, t, n, o, r, s, i, c) {
868
+ const a = new Fe(), d = /* @__PURE__ */ new Map(), f = i.getSheetFormulaData(e, t), m = [];
869
+ return r === dr.CUT ? o.forValue((u, h, l) => {
870
+ const S = n.rows[u], v = n.cols[h], g = {};
871
871
  if (De(l.si)) {
872
872
  if (Ce(l.f))
873
873
  m.push(l.si), g.f = l.f, g.si = l.si;
@@ -875,52 +875,52 @@ function di(e, t, n, o, r, s, i, c) {
875
875
  g.f = null, g.si = l.si;
876
876
  else {
877
877
  const C = i.getFormulaStringByCell(
878
- c.range.rows[d % c.range.rows.length],
879
- c.range.cols[u % c.range.cols.length],
878
+ c.range.rows[u % c.range.rows.length],
879
+ c.range.cols[h % c.range.cols.length],
880
880
  c.subUnitId,
881
881
  c.unitId
882
882
  );
883
883
  g.f = C, g.si = null;
884
884
  }
885
- g.v = null, g.p = null, a.setValue(v, S, g);
886
- } else Ce(l.f) && (g.f = l.f, g.si = null, g.v = null, g.p = null, a.setValue(v, S, g));
887
- }) : o.forValue((d, u, l) => {
885
+ g.v = null, g.p = null, a.setValue(S, v, g);
886
+ } else Ce(l.f) && (g.f = l.f, g.si = null, g.v = null, g.p = null, a.setValue(S, v, g));
887
+ }) : o.forValue((u, h, l) => {
888
888
  var C;
889
- const v = n.rows[d], S = n.cols[u], g = {};
889
+ const S = n.rows[u], v = n.cols[h], g = {};
890
890
  if (De(l.si)) {
891
891
  if (c.unitId !== e || c.subUnitId !== t) {
892
- const _ = i.getFormulaStringByCell(
893
- c.range.rows[d % c.range.rows.length],
894
- c.range.cols[u % c.range.cols.length],
892
+ const R = i.getFormulaStringByCell(
893
+ c.range.rows[u % c.range.rows.length],
894
+ c.range.cols[h % c.range.cols.length],
895
895
  c.subUnitId,
896
896
  c.unitId
897
- ), E = n.cols[u] - c.range.cols[u % c.range.cols.length], p = n.rows[d] - c.range.rows[d % c.range.rows.length], b = s.moveFormulaRefOffset(_ || "", E, p);
897
+ ), E = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[u] - c.range.rows[u % c.range.rows.length], b = s.moveFormulaRefOffset(R || "", E, p);
898
898
  g.si = null, g.f = b;
899
899
  } else
900
900
  g.si = l.si, g.f = null;
901
- g.v = null, g.p = null, a.setValue(v, S, g);
901
+ g.v = null, g.p = null, a.setValue(S, v, g);
902
902
  } else if (Ce(l.f)) {
903
- const _ = `${d % c.range.rows.length}_${u % c.range.cols.length}`;
904
- let E = h.get(_);
903
+ const R = `${u % c.range.rows.length}_${h % c.range.cols.length}`;
904
+ let E = d.get(R);
905
905
  if (E)
906
906
  g.si = E, g.f = null;
907
907
  else {
908
- E = Yt(6), h.set(_, E);
909
- const p = n.cols[u] - c.range.cols[u % c.range.cols.length], b = n.rows[d] - c.range.rows[d % c.range.rows.length], y = s.moveFormulaRefOffset(l.f || "", p, b);
910
- g.si = E, g.f = y;
908
+ E = Yt(6), d.set(R, E);
909
+ const p = n.cols[h] - c.range.cols[h % c.range.cols.length], b = n.rows[u] - c.range.rows[u % c.range.rows.length], T = s.moveFormulaRefOffset(l.f || "", p, b);
910
+ g.si = E, g.f = T;
911
911
  }
912
- g.v = null, g.p = null, a.setValue(v, S, g);
913
- } else (C = f == null ? void 0 : f[v]) != null && C[S] && (g.v = l.v, g.f = null, g.si = null, g.p = l.p, a.setValue(v, S, g));
914
- }), m.length > 0 && new Fe(f).forValue((d, u, l) => {
915
- if (!(c.range.rows.includes(d) && c.range.cols.includes(u)) && !(n.rows.includes(d) && n.cols.includes(u)) && m.includes(l == null ? void 0 : l.si)) {
916
- const v = i.getFormulaStringByCell(
917
- d,
912
+ g.v = null, g.p = null, a.setValue(S, v, g);
913
+ } else (C = f == null ? void 0 : f[S]) != null && C[v] && (g.v = l.v, g.f = null, g.si = null, g.p = l.p, a.setValue(S, v, g));
914
+ }), m.length > 0 && new Fe(f).forValue((u, h, l) => {
915
+ if (!(c.range.rows.includes(u) && c.range.cols.includes(h)) && !(n.rows.includes(u) && n.cols.includes(h)) && m.includes(l == null ? void 0 : l.si)) {
916
+ const S = i.getFormulaStringByCell(
918
917
  u,
918
+ h,
919
919
  c.subUnitId,
920
920
  c.unitId
921
921
  );
922
- a.setValue(d, u, {
923
- f: v,
922
+ a.setValue(u, h, {
923
+ f: S,
924
924
  si: null,
925
925
  v: null,
926
926
  p: null
@@ -928,17 +928,17 @@ function di(e, t, n, o, r, s, i, c) {
928
928
  }
929
929
  }), a;
930
930
  }
931
- function Ar(e) {
931
+ function wr(e) {
932
932
  if (e != null && e.p) {
933
933
  const t = e == null ? void 0 : e.p.body;
934
934
  if (t == null)
935
935
  return;
936
936
  const n = t.dataStream;
937
- return n.substring(n.length - 2, n.length) === cr ? n.substring(0, n.length - 2) : n;
937
+ return n.substring(n.length - 2, n.length) === ir ? n.substring(0, n.length - 2) : n;
938
938
  }
939
939
  }
940
- var hi = Object.getOwnPropertyDescriptor, fi = (e, t, n, o) => {
941
- for (var r = o > 1 ? void 0 : o ? hi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
940
+ var ui = Object.getOwnPropertyDescriptor, di = (e, t, n, o) => {
941
+ for (var r = o > 1 ? void 0 : o ? ui(t, n) : t, s = e.length - 1, i; s >= 0; s--)
942
942
  (i = e[s]) && (r = i(r) || r);
943
943
  return r;
944
944
  }, je = (e, t) => (n, o) => t(n, o, e);
@@ -972,19 +972,19 @@ let Ht = class extends Ze {
972
972
  }
973
973
  _initInterceptorEditorStart() {
974
974
  this.disposeWithMe(
975
- lr(
976
- this._sheetInterceptorService.writeCellInterceptor.intercept(as, {
975
+ cr(
976
+ this._sheetInterceptorService.writeCellInterceptor.intercept(is, {
977
977
  handler: (t, n, o) => {
978
- var l, v, S, g;
979
- const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n, h = this._formulaDataModel.getArrayFormulaRange(), f = this._formulaDataModel.getArrayFormulaCellData();
978
+ var l, S, v, g;
979
+ const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n, d = this._formulaDataModel.getArrayFormulaRange(), f = this._formulaDataModel.getArrayFormulaCellData();
980
980
  if (this._removeArrayFormulaRangeShape(), t == null)
981
981
  return o(t);
982
982
  let m = null;
983
- const d = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
984
- if (d !== null && (m = { f: d }), t.v != null && t.v !== "" && ((S = (v = (l = f[i]) == null ? void 0 : l[c]) == null ? void 0 : v[r]) == null ? void 0 : S[s]) == null)
983
+ const u = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
984
+ if (u !== null && (m = { f: u }), t.v != null && t.v !== "" && ((v = (S = (l = f[i]) == null ? void 0 : l[c]) == null ? void 0 : S[r]) == null ? void 0 : v[s]) == null)
985
985
  return m ? { ...t, ...m } : o(t);
986
- const u = (g = h == null ? void 0 : h[i]) == null ? void 0 : g[c];
987
- return u != null && (m = this._displayArrayFormulaRangeShape(u, r, s, i, c, a, m)), m ? { ...t, ...m } : o(t);
986
+ const h = (g = d == null ? void 0 : d[i]) == null ? void 0 : g[c];
987
+ return h != null && (m = this._displayArrayFormulaRangeShape(h, r, s, i, c, a, m)), m ? { ...t, ...m } : o(t);
988
988
  }
989
989
  })
990
990
  )
@@ -992,10 +992,10 @@ let Ht = class extends Ze {
992
992
  }
993
993
  _commandExecutedListener() {
994
994
  this.disposeWithMe(this._commandService.onCommandExecuted((t, n) => {
995
- (t.id === Uo.id || t.id === Vo.id && n && n.remove) && this._removeArrayFormulaRangeShape();
995
+ (t.id === Po.id || t.id === Uo.id && n && n.remove) && this._removeArrayFormulaRangeShape();
996
996
  })), this.disposeWithMe(
997
997
  this._commandService.beforeCommandExecuted((t) => {
998
- us.id === t.id && requestIdleCallback(() => {
998
+ cs.id === t.id && requestIdleCallback(() => {
999
999
  const n = t.params, { unitId: o, subUnitId: r, rowsAutoHeightInfo: s } = n;
1000
1000
  this._refreshArrayFormulaRangeShapeByRow(o, r, s);
1001
1001
  });
@@ -1003,16 +1003,16 @@ let Ht = class extends Ze {
1003
1003
  );
1004
1004
  }
1005
1005
  _displayArrayFormulaRangeShape(t, n, o, r, s, i, c) {
1006
- return new Fe(t).forValue((a, h, f) => {
1006
+ return new Fe(t).forValue((a, d, f) => {
1007
1007
  if (f == null)
1008
1008
  return !0;
1009
- const { startRow: m, startColumn: d, endRow: u, endColumn: l } = f;
1010
- if (a === n && h === o)
1009
+ const { startRow: m, startColumn: u, endRow: h, endColumn: l } = f;
1010
+ if (a === n && d === o)
1011
1011
  return this._createArrayFormulaRangeShape(f, r), !1;
1012
- if (n >= m && n <= u && o >= d && o <= l) {
1013
- const v = i.getCell(m, d);
1014
- return (v == null ? void 0 : v.v) === ue.SPILL || (v == null ? void 0 : v.f) == null ? void 0 : (c == null && (c = {
1015
- f: v.f,
1012
+ if (n >= m && n <= h && o >= u && o <= l) {
1013
+ const S = i.getCell(m, u);
1014
+ return (S == null ? void 0 : S.v) === ue.SPILL || (S == null ? void 0 : S.f) == null ? void 0 : (c == null && (c = {
1015
+ f: S.f,
1016
1016
  isInArrayFormulaRange: !0
1017
1017
  }), this._createArrayFormulaRangeShape(f, r), !1);
1018
1018
  }
@@ -1032,10 +1032,10 @@ let Ht = class extends Ze {
1032
1032
  fill: new mn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
1033
1033
  widgets: {}
1034
1034
  }
1035
- }, c = sn(i, r), { rowHeaderWidth: a, columnHeaderHeight: h } = r, f = new gr(s, To.FORMULA_EDITOR_SHOW, this._themeService, {
1035
+ }, c = sn(i, r), { rowHeaderWidth: a, columnHeaderHeight: d } = r, f = new hr(s, bo.FORMULA_EDITOR_SHOW, this._themeService, {
1036
1036
  highlightHeader: !1,
1037
1037
  rowHeaderWidth: a,
1038
- columnHeaderHeight: h
1038
+ columnHeaderHeight: d
1039
1039
  });
1040
1040
  f.updateRangeBySelectionWithCoord(c), f.setEvent(!1), this._previousShape = f;
1041
1041
  }
@@ -1061,8 +1061,8 @@ let Ht = class extends Ze {
1061
1061
  if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
1062
1062
  const { startRow: r, endRow: s, startColumn: i, endColumn: c } = this._previousShape.getRange();
1063
1063
  for (let a = 0; a < o.length; a++) {
1064
- const { row: h } = o[a];
1065
- if (r >= h) {
1064
+ const { row: d } = o[a];
1065
+ if (r >= d) {
1066
1066
  const f = {
1067
1067
  startRow: r,
1068
1068
  endRow: s,
@@ -1075,38 +1075,38 @@ let Ht = class extends Ze {
1075
1075
  }
1076
1076
  }
1077
1077
  };
1078
- Ht = fi([
1079
- je(1, q(_n)),
1078
+ Ht = di([
1079
+ je(1, q(Rn)),
1080
1080
  je(2, q(Tt)),
1081
1081
  je(3, q(Et)),
1082
1082
  je(4, Te),
1083
1083
  je(5, q(bt)),
1084
1084
  je(6, pe),
1085
- je(7, io)
1085
+ je(7, oo)
1086
1086
  ], Ht);
1087
- var gi = Object.getOwnPropertyDescriptor, mi = (e, t, n, o) => {
1088
- for (var r = o > 1 ? void 0 : o ? gi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1087
+ var hi = Object.getOwnPropertyDescriptor, fi = (e, t, n, o) => {
1088
+ for (var r = o > 1 ? void 0 : o ? hi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1089
1089
  (i = e[s]) && (r = i(r) || r);
1090
1090
  return r;
1091
- }, nr = (e, t) => (n, o) => t(n, o, e);
1092
- const pi = {
1091
+ }, tr = (e, t) => (n, o) => t(n, o, e);
1092
+ const gi = {
1093
1093
  tl: {
1094
1094
  size: 6,
1095
1095
  color: "#409f11"
1096
1096
  }
1097
1097
  };
1098
- let Bt = class extends co {
1098
+ let Bt = class extends so {
1099
1099
  constructor(e, t) {
1100
1100
  super(), this._sheetInterceptorService = e, this._formulaDataModel = t, this.disposeWithMe(this._sheetInterceptorService.intercept(
1101
- ds.CELL_CONTENT,
1101
+ ls.CELL_CONTENT,
1102
1102
  {
1103
- effect: lo.Style,
1103
+ effect: io.Style,
1104
1104
  handler: (n, o, r) => {
1105
- var c, a, h, f;
1106
- const s = (f = (h = (a = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : h[o.row]) == null ? void 0 : f[o.col];
1107
- return !pr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1105
+ var c, a, d, f;
1106
+ const s = (f = (d = (a = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : d[o.row]) == null ? void 0 : f[o.col];
1107
+ return !gr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1108
1108
  ...n == null ? void 0 : n.markers,
1109
- ...pi
1109
+ ...gi
1110
1110
  }), r(n);
1111
1111
  },
1112
1112
  priority: 10
@@ -1114,25 +1114,25 @@ let Bt = class extends co {
1114
1114
  ));
1115
1115
  }
1116
1116
  };
1117
- Bt = mi([
1118
- nr(0, q(_n)),
1119
- nr(1, q(Tt))
1117
+ Bt = fi([
1118
+ tr(0, q(Rn)),
1119
+ tr(1, q(Tt))
1120
1120
  ], Bt);
1121
- function Si() {
1122
- const e = O(vs), t = O(pe), n = _e(e.progress$), o = $t(() => {
1123
- t.executeCommand(Wo.id);
1121
+ function mi() {
1122
+ const e = y(ms), t = y(pe), n = _e(e.progress$), o = $t(() => {
1123
+ t.executeCommand(Vo.id);
1124
1124
  }, [t]), r = $t(() => {
1125
1125
  e.clearProgress();
1126
1126
  }, [e]);
1127
- return /* @__PURE__ */ x(Es, { progress: n, onTerminate: o, onClearProgress: r });
1127
+ return /* @__PURE__ */ x(Rs, { progress: n, onTerminate: o, onClearProgress: r });
1128
1128
  }
1129
- function vi(e, t) {
1130
- return Object.keys(e).filter((n) => isNaN(Number(n)) && n !== "DefinedName" && n !== "Table").map((n) => ({
1131
- label: t.t(`formula.functionType.${n.toLocaleLowerCase()}`),
1132
- value: `${e[n]}`
1129
+ function pi(e, t, n) {
1130
+ return Object.keys(e).filter((o) => isNaN(Number(o)) && o !== "DefinedName" && o !== "Table" && (n || o !== "User")).map((o) => ({
1131
+ label: t.t(`formula.functionType.${o.toLocaleLowerCase()}`),
1132
+ value: `${e[o]}`
1133
1133
  }));
1134
1134
  }
1135
- function Fr(e) {
1135
+ function kr(e) {
1136
1136
  if (!e.require && !e.repeat)
1137
1137
  return `[${e.name}]`;
1138
1138
  if (e.require && !e.repeat)
@@ -1142,7 +1142,7 @@ function Fr(e) {
1142
1142
  if (e.require && e.repeat)
1143
1143
  return `${e.name},...`;
1144
1144
  }
1145
- function Dr(e) {
1145
+ function Ar(e) {
1146
1146
  const { prefix: t, value: n } = e;
1147
1147
  return /* @__PURE__ */ B("div", { children: [
1148
1148
  /* @__PURE__ */ B("span", { children: [
@@ -1150,7 +1150,7 @@ function Dr(e) {
1150
1150
  "("
1151
1151
  ] }),
1152
1152
  n && n.map((o, r) => /* @__PURE__ */ B("span", { children: [
1153
- /* @__PURE__ */ x("span", { children: Fr(o) }),
1153
+ /* @__PURE__ */ x("span", { children: kr(o) }),
1154
1154
  r === n.length - 1 ? "" : ","
1155
1155
  ] }, r)),
1156
1156
  ")"
@@ -1175,27 +1175,27 @@ function Ct(e) {
1175
1175
  )
1176
1176
  ] });
1177
1177
  }
1178
- function Ci(e) {
1178
+ function Si(e) {
1179
1179
  const { functionInfo: t, onChange: n } = e;
1180
1180
  if (!t) return null;
1181
1181
  const [o, r] = H([]), [s, i] = H(t.functionParameter), [c, a] = H(-1);
1182
1182
  return /* @__PURE__ */ B("div", { children: [
1183
- /* @__PURE__ */ x("div", { className: se("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((h, f) => /* @__PURE__ */ B("div", { children: [
1184
- /* @__PURE__ */ x("div", { className: "univer-text-sm", children: h.name }),
1183
+ /* @__PURE__ */ x("div", { className: se("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((d, f) => /* @__PURE__ */ B("div", { children: [
1184
+ /* @__PURE__ */ x("div", { className: "univer-text-sm", children: d.name }),
1185
1185
  /* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
1186
1186
  ] }, f)) }),
1187
- /* @__PURE__ */ x("div", { className: se("univer-flex-1 univer-p-3", xs), children: /* @__PURE__ */ x(
1187
+ /* @__PURE__ */ x("div", { className: se("univer-flex-1 univer-p-3", Ns), children: /* @__PURE__ */ x(
1188
1188
  Ct,
1189
1189
  {
1190
- title: c === -1 ? /* @__PURE__ */ x(Dr, { prefix: t.functionName, value: s }) : s[c].name,
1190
+ title: c === -1 ? /* @__PURE__ */ x(Ar, { prefix: t.functionName, value: s }) : s[c].name,
1191
1191
  value: c === -1 ? t.description : s[c].detail
1192
1192
  }
1193
1193
  ) })
1194
1194
  ] });
1195
1195
  }
1196
1196
  function nt({ ref: e, ...t }) {
1197
- const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = z(`_${Ii()}`);
1198
- return Lr(n, `${o}`, {
1197
+ const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${_i()}`);
1198
+ return Fr(n, `${o}`, {
1199
1199
  defIds: n.defIds,
1200
1200
  idSuffix: a.current
1201
1201
  }, {
@@ -1204,14 +1204,14 @@ function nt({ ref: e, ...t }) {
1204
1204
  ...i
1205
1205
  }, s);
1206
1206
  }
1207
- function Lr(e, t, n, o, r) {
1207
+ function Fr(e, t, n, o, r) {
1208
1208
  return tt(e.tag, {
1209
1209
  key: t,
1210
- ..._i(e, n, r),
1210
+ ...vi(e, n, r),
1211
1211
  ...o
1212
- }, (Ri(e, n).children || []).map((s, i) => Lr(s, `${t}-${e.tag}-${i}`, n, void 0, r)));
1212
+ }, (Ci(e, n).children || []).map((s, i) => Fr(s, `${t}-${e.tag}-${i}`, n, void 0, r)));
1213
1213
  }
1214
- function _i(e, t, n) {
1214
+ function vi(e, t, n) {
1215
1215
  const o = { ...e.attrs };
1216
1216
  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(([s, i]) => {
1217
1217
  s === "mask" && typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
@@ -1221,7 +1221,7 @@ function _i(e, t, n) {
1221
1221
  typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
1222
1222
  })), o;
1223
1223
  }
1224
- function Ri(e, t) {
1224
+ function Ci(e, t) {
1225
1225
  var o;
1226
1226
  const { defIds: n } = t;
1227
1227
  return !n || n.length === 0 ? e : e.tag === "defs" && ((o = e.children) != null && o.length) ? {
@@ -1235,11 +1235,11 @@ function Ri(e, t) {
1235
1235
  } : r)
1236
1236
  } : e;
1237
1237
  }
1238
- function Ii() {
1238
+ function _i() {
1239
1239
  return Math.random().toString(36).substring(2, 8);
1240
1240
  }
1241
1241
  nt.displayName = "UniverIcon";
1242
- const Ei = {
1242
+ const Ri = {
1243
1243
  tag: "svg",
1244
1244
  attrs: {
1245
1245
  xmlns: "http://www.w3.org/2000/svg",
@@ -1257,15 +1257,15 @@ const Ei = {
1257
1257
  clipRule: "evenodd"
1258
1258
  }
1259
1259
  }]
1260
- }, $r = Ve(function(t, n) {
1260
+ }, Dr = Ve(function(t, n) {
1261
1261
  return tt(nt, Object.assign({}, t, {
1262
1262
  id: "check-mark-icon",
1263
1263
  ref: n,
1264
- icon: Ei
1264
+ icon: Ri
1265
1265
  }));
1266
1266
  });
1267
- $r.displayName = "CheckMarkIcon";
1268
- const bi = {
1267
+ Dr.displayName = "CheckMarkIcon";
1268
+ const Ii = {
1269
1269
  tag: "svg",
1270
1270
  attrs: {
1271
1271
  xmlns: "http://www.w3.org/2000/svg",
@@ -1281,15 +1281,15 @@ const bi = {
1281
1281
  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"
1282
1282
  }
1283
1283
  }]
1284
- }, Pr = Ve(function(t, n) {
1284
+ }, Lr = Ve(function(t, n) {
1285
1285
  return tt(nt, Object.assign({}, t, {
1286
1286
  id: "close-icon",
1287
1287
  ref: n,
1288
- icon: bi
1288
+ icon: Ii
1289
1289
  }));
1290
1290
  });
1291
- Pr.displayName = "CloseIcon";
1292
- const yi = {
1291
+ Lr.displayName = "CloseIcon";
1292
+ const Ei = {
1293
1293
  tag: "svg",
1294
1294
  attrs: {
1295
1295
  xmlns: "http://www.w3.org/2000/svg",
@@ -1330,15 +1330,15 @@ const yi = {
1330
1330
  }
1331
1331
  }
1332
1332
  ]
1333
- }, Ur = Ve(function(t, n) {
1333
+ }, $r = Ve(function(t, n) {
1334
1334
  return tt(nt, Object.assign({}, t, {
1335
1335
  id: "delete-icon",
1336
1336
  ref: n,
1337
- icon: yi
1337
+ icon: Ei
1338
1338
  }));
1339
1339
  });
1340
- Ur.displayName = "DeleteIcon";
1341
- const Ti = {
1340
+ $r.displayName = "DeleteIcon";
1341
+ const bi = {
1342
1342
  tag: "svg",
1343
1343
  attrs: {
1344
1344
  xmlns: "http://www.w3.org/2000/svg",
@@ -1354,15 +1354,15 @@ const Ti = {
1354
1354
  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"
1355
1355
  }
1356
1356
  }]
1357
- }, Vr = Ve(function(t, n) {
1357
+ }, Pr = Ve(function(t, n) {
1358
1358
  return tt(nt, Object.assign({}, t, {
1359
1359
  id: "increase-icon",
1360
1360
  ref: n,
1361
- icon: Ti
1361
+ icon: bi
1362
1362
  }));
1363
1363
  });
1364
- Vr.displayName = "IncreaseIcon";
1365
- const Oi = {
1364
+ Pr.displayName = "IncreaseIcon";
1365
+ const yi = {
1366
1366
  tag: "svg",
1367
1367
  attrs: {
1368
1368
  xmlns: "http://www.w3.org/2000/svg",
@@ -1380,15 +1380,15 @@ const Oi = {
1380
1380
  clipRule: "evenodd"
1381
1381
  }
1382
1382
  }]
1383
- }, Wr = Ve(function(t, n) {
1383
+ }, Ur = Ve(function(t, n) {
1384
1384
  return tt(nt, Object.assign({}, t, {
1385
1385
  id: "more-icon",
1386
1386
  ref: n,
1387
- icon: Oi
1387
+ icon: yi
1388
1388
  }));
1389
1389
  });
1390
- Wr.displayName = "MoreIcon";
1391
- const Ni = {
1390
+ Ur.displayName = "MoreIcon";
1391
+ const Ti = {
1392
1392
  tag: "svg",
1393
1393
  attrs: {
1394
1394
  xmlns: "http://www.w3.org/2000/svg",
@@ -1412,157 +1412,158 @@ const Ni = {
1412
1412
  clipRule: "evenodd"
1413
1413
  }
1414
1414
  }]
1415
- }, Hr = Ve(function(t, n) {
1415
+ }, Vr = Ve(function(t, n) {
1416
1416
  return tt(nt, Object.assign({}, t, {
1417
1417
  id: "select-range-icon",
1418
1418
  ref: n,
1419
- icon: Ni
1419
+ icon: Ti
1420
1420
  }));
1421
1421
  });
1422
- Hr.displayName = "SelectRangeIcon";
1423
- function Mi(e) {
1424
- const { onChange: t } = e, n = "-1", [o, r] = H(""), [s, i] = H([]), [c, a] = H(0), [h, f] = H(n), [m, d] = H(0), [u, l] = H(null), v = O(Zt), S = O(dt), g = O(Rn), C = _e(g.sidebarOptions$), _ = vi(Sr, S);
1425
- _.unshift({
1426
- label: S.t("formula.moreFunctions.allFunctions"),
1427
- value: n
1422
+ Vr.displayName = "SelectRangeIcon";
1423
+ function Oi(e) {
1424
+ var I;
1425
+ const n = (I = y(pn).getConfig(ps)) == null ? void 0 : I.function, { onChange: o } = e, r = "-1", [s, i] = H(""), [c, a] = H([]), [d, f] = H(0), [m, u] = H(r), [h, l] = H(0), [S, v] = H(null), g = y(Zt), C = y(dt), R = y(In), E = _e(R.sidebarOptions$), p = pi(mr, C, !!n);
1426
+ p.unshift({
1427
+ label: C.t("formula.moreFunctions.allFunctions"),
1428
+ value: r
1428
1429
  });
1429
- const E = S.t("formula.prompt.required"), p = S.t("formula.prompt.optional");
1430
+ const b = C.t("formula.prompt.required"), T = C.t("formula.prompt.optional");
1430
1431
  P(() => {
1431
- A(n);
1432
+ N(r);
1432
1433
  }, []), P(() => {
1433
- y(0);
1434
- }, [s]), P(() => {
1435
- C != null && C.visible && (r(""), i([]), a(0), f(n), d(0), l(null), A(n));
1436
- }, [C]);
1437
- const b = (I) => {
1438
- if (o.trim() === "") return I;
1439
- const w = new RegExp(`(${o.toLocaleUpperCase()})`);
1440
- return I.split(w).filter(Boolean).map((T, D) => T.match(w) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: T }, D) : T);
1441
- }, y = (I) => {
1442
- if (s.length === 0) {
1443
- l(null);
1434
+ A(0);
1435
+ }, [c]), P(() => {
1436
+ E != null && E.visible && (i(""), a([]), f(0), u(r), l(0), v(null), N(r));
1437
+ }, [E]);
1438
+ const F = (_) => {
1439
+ if (s.trim() === "") return _;
1440
+ const O = new RegExp(`(${s.toLocaleUpperCase()})`);
1441
+ return _.split(O).filter(Boolean).map((U, Y) => U.match(O) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: U }, Y) : U);
1442
+ }, A = (_) => {
1443
+ if (c.length === 0) {
1444
+ v(null), o(null);
1444
1445
  return;
1445
1446
  }
1446
- d(I);
1447
- const w = v.getFunctionInfo(s[I].name);
1448
- if (!w) {
1449
- l(null);
1447
+ l(_);
1448
+ const O = g.getFunctionInfo(c[_].name);
1449
+ if (!O) {
1450
+ v(null), o(null);
1450
1451
  return;
1451
1452
  }
1452
- l(w), t(w);
1453
+ v(O), o(O);
1453
1454
  };
1454
- function A(I) {
1455
- f(I);
1456
- const w = v.getSearchListByType(+I);
1457
- i(w);
1458
- }
1459
- function F(I) {
1460
- r(I);
1461
- const w = v.getSearchListByName(I);
1462
- i(w);
1463
- }
1464
- function N(I) {
1465
- if (I.stopPropagation(), I.key === "ArrowDown") {
1466
- const w = c + 1;
1467
- a(w === s.length ? 0 : w);
1468
- } else if (I.key === "ArrowUp") {
1469
- const w = c - 1;
1470
- a(w === -1 ? s.length - 1 : w);
1471
- } else I.key === "Enter" && y(c);
1472
- }
1473
- const M = (I) => {
1474
- a(I);
1475
- }, k = () => {
1476
- a(-1);
1455
+ function N(_) {
1456
+ u(_);
1457
+ const O = g.getSearchListByType(+_);
1458
+ a(O);
1459
+ }
1460
+ function M(_) {
1461
+ i(_);
1462
+ const O = g.getSearchListByName(_);
1463
+ a(O);
1464
+ }
1465
+ function w(_) {
1466
+ if (_.stopPropagation(), _.key === "ArrowDown") {
1467
+ const O = d + 1;
1468
+ f(O === c.length ? 0 : O);
1469
+ } else if (_.key === "ArrowUp") {
1470
+ const O = d - 1;
1471
+ f(O === -1 ? c.length - 1 : O);
1472
+ } else _.key === "Enter" && A(d);
1473
+ }
1474
+ const k = (_) => {
1475
+ f(_);
1476
+ }, $ = () => {
1477
+ f(-1);
1477
1478
  };
1478
1479
  return /* @__PURE__ */ B("div", { children: [
1479
1480
  /* @__PURE__ */ B("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
1480
- /* @__PURE__ */ x(ws, { value: h, options: _, onChange: A }),
1481
+ /* @__PURE__ */ x(Ms, { value: m, options: p, onChange: N }),
1481
1482
  /* @__PURE__ */ x(
1482
- Or,
1483
+ yr,
1483
1484
  {
1484
- placeholder: S.t("formula.moreFunctions.searchFunctionPlaceholder"),
1485
- onKeyDown: N,
1486
- value: o,
1487
- onChange: F,
1485
+ placeholder: C.t("formula.moreFunctions.searchFunctionPlaceholder"),
1486
+ onKeyDown: w,
1487
+ value: s,
1488
+ onChange: M,
1488
1489
  size: "small",
1489
1490
  allowClear: !0
1490
1491
  }
1491
1492
  )
1492
1493
  ] }),
1493
- s.length > 0 && /* @__PURE__ */ x(
1494
+ c.length > 0 && /* @__PURE__ */ x(
1494
1495
  "ul",
1495
1496
  {
1496
- className: se("univer-mb-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", In, ut),
1497
- onKeyDown: N,
1497
+ className: se("univer-mb-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", En, ut),
1498
+ onKeyDown: w,
1498
1499
  tabIndex: -1,
1499
- children: s.map(({ name: I }, w) => /* @__PURE__ */ B(
1500
+ children: c.map(({ name: _ }, O) => /* @__PURE__ */ B(
1500
1501
  "li",
1501
1502
  {
1502
1503
  className: se("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", {
1503
- "univer-bg-gray-200 dark:!univer-bg-gray-600": c === w
1504
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": d === O
1504
1505
  }),
1505
- onMouseEnter: () => M(w),
1506
- onMouseLeave: k,
1507
- onClick: () => y(w),
1506
+ onMouseEnter: () => k(O),
1507
+ onMouseLeave: $,
1508
+ onClick: () => A(O),
1508
1509
  children: [
1509
- m === w && /* @__PURE__ */ x(
1510
- $r,
1510
+ h === O && /* @__PURE__ */ x(
1511
+ Dr,
1511
1512
  {
1512
1513
  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"
1513
1514
  }
1514
1515
  ),
1515
- /* @__PURE__ */ x("span", { className: "univer-block", children: b(I) })
1516
+ /* @__PURE__ */ x("span", { className: "univer-block", children: F(_) })
1516
1517
  ]
1517
1518
  },
1518
- w
1519
+ O
1519
1520
  ))
1520
1521
  }
1521
1522
  ),
1522
- u && /* @__PURE__ */ B("div", { className: se("univer-mx-0 univer-my-2 univer-overflow-y-auto", ut), children: [
1523
- /* @__PURE__ */ x(Ct, { title: u.functionName, value: u.description }),
1523
+ S && /* @__PURE__ */ B("div", { className: se("univer-mx-0 univer-my-2 univer-overflow-y-auto", ut), children: [
1524
+ /* @__PURE__ */ x(Ct, { title: S.functionName, value: S.description }),
1524
1525
  /* @__PURE__ */ x(
1525
1526
  Ct,
1526
1527
  {
1527
- title: S.t("formula.moreFunctions.syntax"),
1528
- value: /* @__PURE__ */ x(Dr, { prefix: u.functionName, value: u.functionParameter })
1528
+ title: C.t("formula.moreFunctions.syntax"),
1529
+ value: /* @__PURE__ */ x(Ar, { prefix: S.functionName, value: S.functionParameter })
1529
1530
  }
1530
1531
  ),
1531
1532
  /* @__PURE__ */ x(
1532
1533
  Ct,
1533
1534
  {
1534
- title: S.t("formula.prompt.helpExample"),
1535
- value: `${u.functionName}(${u.functionParameter.map((I) => I.example).join(",")})`
1535
+ title: C.t("formula.prompt.helpExample"),
1536
+ value: `${S.functionName}(${S.functionParameter.map((_) => _.example).join(",")})`
1536
1537
  }
1537
1538
  ),
1538
- u.functionParameter && u.functionParameter.map((I) => /* @__PURE__ */ x(
1539
+ S.functionParameter && S.functionParameter.map((_) => /* @__PURE__ */ x(
1539
1540
  Ct,
1540
1541
  {
1541
- title: I.name,
1542
- value: `${I.require ? E : p} ${I.detail}`
1542
+ title: _.name,
1543
+ value: `${_.require ? b : T} ${_.detail}`
1543
1544
  },
1544
- I.name
1545
+ _.name
1545
1546
  ))
1546
1547
  ] })
1547
1548
  ] });
1548
1549
  }
1549
- function xi() {
1550
- const e = Oo(), [t, n] = H(!0), [o, r] = H(!1), [s, i] = H(null);
1551
- O(pn);
1552
- const c = O(dt), a = O(ze), h = O(te), f = O(pe);
1550
+ function Ni() {
1551
+ const e = yo(), [t, n] = H(!0), [o, r] = H(!1), [s, i] = H(null);
1552
+ y(Sn);
1553
+ const c = y(dt), a = y(ze), d = y(ne), f = y(pe);
1553
1554
  function m() {
1554
1555
  n(!t), r(!o);
1555
1556
  }
1556
- function d() {
1557
- const u = Er(h);
1558
- if (!u) return;
1559
- f.executeCommand(hr.id, {
1557
+ function u() {
1558
+ const h = Rr(d);
1559
+ if (!h) return;
1560
+ f.executeCommand(ur.id, {
1560
1561
  visible: !0,
1561
- unitId: u.unitId,
1562
+ unitId: h.unitId,
1562
1563
  eventType: xe.Dblclick
1563
1564
  });
1564
- const l = a.getEditor(fn), v = a.getEditor(ir), S = `=${s == null ? void 0 : s.functionName}(`;
1565
- l == null || l.replaceText(S), v == null || v.replaceText(S, !1);
1565
+ const l = a.getEditor(fn), S = a.getEditor(sr), v = `=${s == null ? void 0 : s.functionName}(`;
1566
+ l == null || l.replaceText(v), S == null || S.replaceText(v, !1);
1566
1567
  }
1567
1568
  return /* @__PURE__ */ B(
1568
1569
  "div",
@@ -1570,8 +1571,8 @@ function xi() {
1570
1571
  "data-u-comp": "sheets-formula-functions-panel",
1571
1572
  className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
1572
1573
  children: [
1573
- t && /* @__PURE__ */ x(Mi, { onChange: i }),
1574
- o && /* @__PURE__ */ x(Ci, { functionInfo: s, onChange: () => {
1574
+ t && /* @__PURE__ */ x(Oi, { onChange: i }),
1575
+ o && /* @__PURE__ */ x(Si, { functionInfo: s, onChange: () => {
1575
1576
  } }),
1576
1577
  /* @__PURE__ */ B("div", { className: "univer-flex univer-justify-end", children: [
1577
1578
  o && /* @__PURE__ */ x(
@@ -1587,8 +1588,9 @@ function xi() {
1587
1588
  t && !!e && /* @__PURE__ */ x(
1588
1589
  at,
1589
1590
  {
1591
+ disabled: !s,
1590
1592
  variant: "primary",
1591
- onClick: d,
1593
+ onClick: u,
1592
1594
  className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
1593
1595
  children: c.t("formula.moreFunctions.confirm")
1594
1596
  }
@@ -1598,7 +1600,7 @@ function xi() {
1598
1600
  }
1599
1601
  );
1600
1602
  }
1601
- function wi(e) {
1603
+ function Mi(e) {
1602
1604
  return {
1603
1605
  id: ve.id,
1604
1606
  title: "SUM",
@@ -1607,7 +1609,7 @@ function wi(e) {
1607
1609
  params: {
1608
1610
  value: "SUM"
1609
1611
  },
1610
- hidden$: Pe(e, U.UNIVER_SHEET),
1612
+ hidden$: Pe(e, W.UNIVER_SHEET),
1611
1613
  disabled$: $e(e, {
1612
1614
  workbookTypes: [et],
1613
1615
  worksheetTypes: [Qe, Xe],
@@ -1615,7 +1617,7 @@ function wi(e) {
1615
1617
  })
1616
1618
  };
1617
1619
  }
1618
- function ki(e) {
1620
+ function xi(e) {
1619
1621
  return {
1620
1622
  id: ve.id,
1621
1623
  title: "COUNT",
@@ -1624,7 +1626,7 @@ function ki(e) {
1624
1626
  params: {
1625
1627
  value: "COUNT"
1626
1628
  },
1627
- hidden$: Pe(e, U.UNIVER_SHEET),
1629
+ hidden$: Pe(e, W.UNIVER_SHEET),
1628
1630
  disabled$: $e(e, {
1629
1631
  workbookTypes: [et],
1630
1632
  worksheetTypes: [Qe, Xe],
@@ -1632,7 +1634,7 @@ function ki(e) {
1632
1634
  })
1633
1635
  };
1634
1636
  }
1635
- function Ai(e) {
1637
+ function wi(e) {
1636
1638
  return {
1637
1639
  id: ve.id,
1638
1640
  title: "AVERAGE",
@@ -1641,7 +1643,7 @@ function Ai(e) {
1641
1643
  params: {
1642
1644
  value: "AVERAGE"
1643
1645
  },
1644
- hidden$: Pe(e, U.UNIVER_SHEET),
1646
+ hidden$: Pe(e, W.UNIVER_SHEET),
1645
1647
  disabled$: $e(e, {
1646
1648
  workbookTypes: [et],
1647
1649
  worksheetTypes: [Qe, Xe],
@@ -1649,7 +1651,7 @@ function Ai(e) {
1649
1651
  })
1650
1652
  };
1651
1653
  }
1652
- function Fi(e) {
1654
+ function ki(e) {
1653
1655
  return {
1654
1656
  id: ve.id,
1655
1657
  title: "MAX",
@@ -1658,7 +1660,7 @@ function Fi(e) {
1658
1660
  params: {
1659
1661
  value: "MAX"
1660
1662
  },
1661
- hidden$: Pe(e, U.UNIVER_SHEET),
1663
+ hidden$: Pe(e, W.UNIVER_SHEET),
1662
1664
  disabled$: $e(e, {
1663
1665
  workbookTypes: [et],
1664
1666
  worksheetTypes: [Qe, Xe],
@@ -1666,7 +1668,7 @@ function Fi(e) {
1666
1668
  })
1667
1669
  };
1668
1670
  }
1669
- function Di(e) {
1671
+ function Ai(e) {
1670
1672
  return {
1671
1673
  id: ve.id,
1672
1674
  title: "MIN",
@@ -1675,7 +1677,7 @@ function Di(e) {
1675
1677
  params: {
1676
1678
  value: "MIN"
1677
1679
  },
1678
- hidden$: Pe(e, U.UNIVER_SHEET),
1680
+ hidden$: Pe(e, W.UNIVER_SHEET),
1679
1681
  disabled$: $e(e, {
1680
1682
  workbookTypes: [et],
1681
1683
  worksheetTypes: [Qe, Xe],
@@ -1683,13 +1685,13 @@ function Di(e) {
1683
1685
  })
1684
1686
  };
1685
1687
  }
1686
- function Li(e) {
1688
+ function Fi(e) {
1687
1689
  return {
1688
- id: yn.id,
1690
+ id: Tn.id,
1689
1691
  title: "formula.insert.more",
1690
1692
  tooltip: "formula.insert.tooltip",
1691
1693
  type: Ue.BUTTON,
1692
- hidden$: Pe(e, U.UNIVER_SHEET),
1694
+ hidden$: Pe(e, W.UNIVER_SHEET),
1693
1695
  disabled$: $e(e, {
1694
1696
  workbookTypes: [et],
1695
1697
  worksheetTypes: [Qe, Xe],
@@ -1697,94 +1699,89 @@ function Li(e) {
1697
1699
  })
1698
1700
  };
1699
1701
  }
1700
- function $i(e) {
1701
- return e.get(te).getCurrentTypeOfUnit$(U.UNIVER_SHEET).pipe(
1702
- Zo((o) => o ? e.get(zn) ? new zo((s) => s.next(!e.get(zn).supportClipboard)) : qn(!0) : qn(!0))
1703
- );
1704
- }
1705
- function Pi(e) {
1702
+ function Di(e) {
1706
1703
  return {
1707
- id: En.id,
1704
+ id: bn.id,
1708
1705
  type: Ue.BUTTON,
1709
1706
  title: "formula.operation.copyFormulaOnly",
1710
1707
  disabled$: $e(e, {
1711
- workbookTypes: [gs],
1712
- worksheetTypes: [fs],
1713
- rangeTypes: [hs]
1708
+ workbookTypes: [ds],
1709
+ worksheetTypes: [us],
1710
+ rangeTypes: [as]
1714
1711
  }),
1715
- hidden$: Pe(e, U.UNIVER_SHEET)
1712
+ hidden$: Pe(e, W.UNIVER_SHEET)
1716
1713
  };
1717
1714
  }
1718
- function Ui(e) {
1715
+ function Li(e) {
1719
1716
  return {
1720
- id: bn.id,
1717
+ id: yn.id,
1721
1718
  type: Ue.BUTTON,
1722
1719
  title: "formula.operation.pasteFormula",
1723
- disabled$: $i(e).pipe(
1724
- Go($e(e, {
1720
+ disabled$: To(e).pipe(
1721
+ Yo($e(e, {
1725
1722
  workbookTypes: [et],
1726
1723
  rangeTypes: [Je],
1727
1724
  worksheetTypes: [Xe, Qe]
1728
1725
  })),
1729
- Cr(([t, n]) => t || n)
1726
+ Sr(([t, n]) => t || n)
1730
1727
  ),
1731
- hidden$: Pe(e, U.UNIVER_SHEET)
1728
+ hidden$: Pe(e, W.UNIVER_SHEET)
1732
1729
  };
1733
1730
  }
1734
- const Vi = {
1735
- [Xn.BASIC]: {
1731
+ const $i = {
1732
+ [zn.BASIC]: {
1736
1733
  [`${ve.id}.sum`]: {
1737
1734
  order: 0,
1738
- menuItemFactory: wi
1735
+ menuItemFactory: Mi
1739
1736
  },
1740
1737
  [`${ve.id}.count`]: {
1741
1738
  order: 1,
1742
- menuItemFactory: ki
1739
+ menuItemFactory: xi
1743
1740
  },
1744
1741
  [`${ve.id}.average`]: {
1745
1742
  order: 2,
1746
- menuItemFactory: Ai
1743
+ menuItemFactory: wi
1747
1744
  },
1748
1745
  [`${ve.id}.max`]: {
1749
1746
  order: 3,
1750
- menuItemFactory: Fi
1747
+ menuItemFactory: ki
1751
1748
  },
1752
1749
  [`${ve.id}.min`]: {
1753
1750
  order: 4,
1754
- menuItemFactory: Di
1751
+ menuItemFactory: Ai
1755
1752
  }
1756
1753
  },
1757
- [Xn.OTHERS]: {
1758
- [yn.id]: {
1754
+ [zn.OTHERS]: {
1755
+ [Tn.id]: {
1759
1756
  order: 0,
1760
- menuItemFactory: Li
1757
+ menuItemFactory: Fi
1761
1758
  }
1762
1759
  },
1763
- [Mo]: {
1764
- [En.id]: {
1760
+ [No]: {
1761
+ [bn.id]: {
1765
1762
  order: 0,
1766
- menuItemFactory: Pi
1763
+ menuItemFactory: Di
1767
1764
  }
1768
1765
  },
1769
- [No]: {
1770
- [bn.id]: {
1766
+ [Oo]: {
1767
+ [yn.id]: {
1771
1768
  order: 4,
1772
- menuItemFactory: Ui
1769
+ menuItemFactory: Li
1773
1770
  }
1774
1771
  }
1775
- }, Wi = "meta_key_ctrl_And_Shift";
1776
- function Hi(e) {
1777
- return e.getContextValue(ao) && e.getContextValue(uo);
1772
+ }, Pi = "meta_key_ctrl_And_Shift";
1773
+ function Ui(e) {
1774
+ return e.getContextValue(co) && e.getContextValue(lo);
1778
1775
  }
1779
1776
  const Qt = [
1780
- $.ARROW_DOWN,
1781
- $.ARROW_UP,
1782
- $.ARROW_LEFT,
1783
- $.ARROW_RIGHT
1784
- ], Bi = [...Qt, $.ENTER, $.TAB, $.ESC];
1785
- function qi() {
1777
+ L.ARROW_DOWN,
1778
+ L.ARROW_UP,
1779
+ L.ARROW_LEFT,
1780
+ L.ARROW_RIGHT
1781
+ ], Vi = [...Qt, L.ENTER, L.TAB, L.ESC];
1782
+ function Wi() {
1786
1783
  const e = [];
1787
- for (const t of Bi)
1784
+ for (const t of Vi)
1788
1785
  e.push({
1789
1786
  id: ft.id,
1790
1787
  binding: t,
@@ -1796,7 +1793,7 @@ function qi() {
1796
1793
  });
1797
1794
  return e;
1798
1795
  }
1799
- function ji() {
1796
+ function Hi() {
1800
1797
  const e = [];
1801
1798
  for (const t of Qt)
1802
1799
  e.push({
@@ -1811,7 +1808,7 @@ function ji() {
1811
1808
  });
1812
1809
  return e;
1813
1810
  }
1814
- function Ki() {
1811
+ function Bi() {
1815
1812
  const e = [];
1816
1813
  for (const t of Qt)
1817
1814
  e.push({
@@ -1826,7 +1823,7 @@ function Ki() {
1826
1823
  });
1827
1824
  return e;
1828
1825
  }
1829
- function Yi() {
1826
+ function qi() {
1830
1827
  const e = [];
1831
1828
  for (const t of Qt)
1832
1829
  e.push({
@@ -1836,23 +1833,23 @@ function Yi() {
1836
1833
  staticParameters: {
1837
1834
  eventType: xe.Keyboard,
1838
1835
  keycode: t,
1839
- metaKey: Wi
1836
+ metaKey: Pi
1840
1837
  }
1841
1838
  });
1842
1839
  return e;
1843
1840
  }
1844
- const Gi = {
1845
- id: wr.id,
1846
- binding: $.F4,
1841
+ const ji = {
1842
+ id: Mr.id,
1843
+ binding: L.F4,
1847
1844
  preconditions: (e) => yt(e)
1848
1845
  };
1849
- function Zi() {
1846
+ function Ki() {
1850
1847
  const e = [];
1851
- for (const t of [$.ENTER, $.TAB, $.ARROW_DOWN, $.ARROW_UP])
1848
+ for (const t of [L.ENTER, L.TAB, L.ARROW_DOWN, L.ARROW_UP])
1852
1849
  e.push({
1853
1850
  id: ft.id,
1854
1851
  binding: t,
1855
- preconditions: (n) => Hi(n),
1852
+ preconditions: (n) => Ui(n),
1856
1853
  staticParameters: {
1857
1854
  eventType: xe.Keyboard,
1858
1855
  keycode: t,
@@ -1861,16 +1858,16 @@ function Zi() {
1861
1858
  });
1862
1859
  return e;
1863
1860
  }
1864
- const zi = {
1865
- id: Cs.id,
1866
- binding: V.ALT | $.EQUAL,
1867
- preconditions: xo,
1868
- mac: V.CTRL_COMMAND | V.ALT | $.EQUAL,
1861
+ const Yi = {
1862
+ id: Ss.id,
1863
+ binding: V.ALT | L.EQUAL,
1864
+ preconditions: Mo,
1865
+ mac: V.CTRL_COMMAND | V.ALT | L.EQUAL,
1869
1866
  description: "shortcut.sheets-formula-ui.quick-sum",
1870
1867
  group: "4_sheet-edit"
1871
1868
  };
1872
- var Xi = Object.getOwnPropertyDescriptor, Qi = (e, t, n, o) => {
1873
- for (var r = o > 1 ? void 0 : o ? Xi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1869
+ var Gi = Object.getOwnPropertyDescriptor, Zi = (e, t, n, o) => {
1870
+ for (var r = o > 1 ? void 0 : o ? Gi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1874
1871
  (i = e[s]) && (r = i(r) || r);
1875
1872
  return r;
1876
1873
  }, Ke = (e, t) => (n, o) => t(n, o, e);
@@ -1882,58 +1879,58 @@ let qt = class extends Ze {
1882
1879
  this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
1883
1880
  }
1884
1881
  _registerMenus() {
1885
- this._menuManagerService.mergeMenu(Vi);
1882
+ this._menuManagerService.mergeMenu($i);
1886
1883
  }
1887
1884
  _registerCommands() {
1888
1885
  [
1889
- En,
1890
1886
  bn,
1891
- ve,
1892
1887
  yn,
1893
- Ys,
1894
- Vs,
1888
+ ve,
1889
+ Tn,
1890
+ js,
1891
+ Ps,
1895
1892
  ft,
1896
- wr
1893
+ Mr
1897
1894
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
1898
1895
  }
1899
1896
  _registerShortcuts() {
1900
1897
  [
1898
+ ...Wi(),
1899
+ ...Hi(),
1900
+ ...Bi(),
1901
1901
  ...qi(),
1902
- ...ji(),
1903
1902
  ...Ki(),
1904
- ...Yi(),
1905
- ...Zi(),
1906
- zi,
1907
- Gi
1903
+ Yi,
1904
+ ji
1908
1905
  ].forEach((e) => {
1909
1906
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
1910
1907
  });
1911
1908
  }
1912
1909
  _registerComponents() {
1913
- this.disposeWithMe(this._uiPartsService.registerComponent(wo.FORMULA_AUX, () => Tr(Si, this._injector))), this._componentManager.register(xr, xi);
1910
+ this.disposeWithMe(this._uiPartsService.registerComponent(xo.FORMULA_AUX, () => br(mi, this._injector))), this._componentManager.register(Nr, Ni);
1914
1911
  }
1915
1912
  _registerRenderModules() {
1916
- this.disposeWithMe(this._renderManagerService.registerRenderModule(U.UNIVER_SHEET, [Ht]));
1913
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, [Ht]));
1917
1914
  }
1918
1915
  };
1919
- qt = Qi([
1916
+ qt = Zi([
1920
1917
  Ke(0, q(It)),
1921
- Ke(1, bs),
1918
+ Ke(1, Is),
1922
1919
  Ke(2, pe),
1923
1920
  Ke(3, zt),
1924
- Ke(4, br),
1921
+ Ke(4, Ir),
1925
1922
  Ke(5, Te),
1926
- Ke(6, q(yr))
1923
+ Ke(6, q(Er))
1927
1924
  ], qt);
1928
- var Ji = Object.getOwnPropertyDescriptor, ec = (e, t, n, o) => {
1929
- for (var r = o > 1 ? void 0 : o ? Ji(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1925
+ var zi = Object.getOwnPropertyDescriptor, Xi = (e, t, n, o) => {
1926
+ for (var r = o > 1 ? void 0 : o ? zi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1930
1927
  (i = e[s]) && (r = i(r) || r);
1931
1928
  return r;
1932
1929
  }, rn = (e, t) => (n, o) => t(n, o, e);
1933
1930
  let jt = class extends Ze {
1934
1931
  constructor(e, t, n) {
1935
1932
  super(), this._imageFormulaCellInterceptorController = e, this._renderManagerService = t, this._univerInstanceService = n, this._imageFormulaCellInterceptorController.registerRefreshRenderFunction(() => {
1936
- const o = this._univerInstanceService.getCurrentUnitOfType(U.UNIVER_SHEET);
1933
+ const o = this._univerInstanceService.getCurrentUnitOfType(W.UNIVER_SHEET);
1937
1934
  if (!o) return;
1938
1935
  const r = this._renderManagerService.getRenderById(o.getUnitId());
1939
1936
  if (!r) return;
@@ -1943,14 +1940,14 @@ let jt = class extends Ze {
1943
1940
  });
1944
1941
  }
1945
1942
  };
1946
- jt = ec([
1947
- rn(0, q(_s)),
1943
+ jt = Xi([
1944
+ rn(0, q(vs)),
1948
1945
  rn(1, Te),
1949
- rn(2, te)
1946
+ rn(2, ne)
1950
1947
  ], jt);
1951
- class Br {
1948
+ class Wr {
1952
1949
  constructor() {
1953
- j(this, "_currentSelector$", new _r(null));
1950
+ j(this, "_currentSelector$", new vr(null));
1954
1951
  j(this, "currentSelector$", this._currentSelector$.asObservable());
1955
1952
  }
1956
1953
  showRangeSelectorDialog(t) {
@@ -1962,12 +1959,12 @@ class Br {
1962
1959
  return this._currentSelector$.next(t), o;
1963
1960
  }
1964
1961
  }
1965
- var tc = Object.getOwnPropertyDescriptor, nc = (e, t, n, o) => {
1966
- for (var r = o > 1 ? void 0 : o ? tc(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1962
+ var Qi = Object.getOwnPropertyDescriptor, Ji = (e, t, n, o) => {
1963
+ for (var r = o > 1 ? void 0 : o ? Qi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1967
1964
  (i = e[s]) && (r = i(r) || r);
1968
1965
  return r;
1969
1966
  }, ct = (e, t) => (n, o) => t(n, o, e);
1970
- let Le = class extends ko {
1967
+ let Le = class extends wo {
1971
1968
  constructor(t, n, o, r, s, i, c) {
1972
1969
  super(
1973
1970
  n,
@@ -1978,7 +1975,7 @@ let Le = class extends ko {
1978
1975
  );
1979
1976
  j(this, "_workbookSelections");
1980
1977
  j(this, "_eventDisposables");
1981
- this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(rc(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1978
+ this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(ec(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1982
1979
  }
1983
1980
  getLocation() {
1984
1981
  return this._skeleton.getLocation();
@@ -2002,7 +1999,7 @@ let Le = class extends ko {
2002
1999
  * Call this method and user will be able to select on the canvas to update selections.
2003
2000
  */
2004
2001
  enableSelectionChanging() {
2005
- return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), lr(() => this._disableSelectionChanging());
2002
+ return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), cr(() => this._disableSelectionChanging());
2006
2003
  }
2007
2004
  _disableSelectionChanging() {
2008
2005
  var t;
@@ -2013,26 +2010,26 @@ let Le = class extends ko {
2013
2010
  }
2014
2011
  _initCanvasEventListeners() {
2015
2012
  const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new Ye();
2016
- return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, h) => {
2017
- this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, Ie.NORMAL, this._getActiveViewport(a)), a.button !== 2 && h.stopPropagation());
2013
+ return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, d) => {
2014
+ this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, Ie.NORMAL, this._getActiveViewport(a)), a.button !== 2 && d.stopPropagation());
2018
2015
  })), c.add(
2019
- n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, h) => {
2016
+ n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, d) => {
2020
2017
  if (!this.inRefSelectionMode()) return;
2021
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Un(a.offsetX, a.offsetY, i, f);
2022
- Vn(this._workbookSelections.getCurrentSelections(), m, Ie.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.ROW, this._getActiveViewport(a), en.Y), a.button !== 2 && h.stopPropagation());
2018
+ const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Vn(a.offsetX, a.offsetY, i, f);
2019
+ Wn(this._workbookSelections.getCurrentSelections(), m, Ie.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.ROW, this._getActiveViewport(a), en.Y), a.button !== 2 && d.stopPropagation());
2023
2020
  })
2024
- ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, h) => {
2021
+ ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, d) => {
2025
2022
  if (!this.inRefSelectionMode()) return;
2026
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Un(a.offsetX, a.offsetY, i, f);
2027
- Vn(this._workbookSelections.getCurrentSelections(), m, Ie.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.COLUMN, this._getActiveViewport(a), en.X), a.button !== 2 && h.stopPropagation());
2028
- })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, h) => {
2023
+ const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Vn(a.offsetX, a.offsetY, i, f);
2024
+ Wn(this._workbookSelections.getCurrentSelections(), m, Ie.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.COLUMN, this._getActiveViewport(a), en.X), a.button !== 2 && d.stopPropagation());
2025
+ })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, d) => {
2029
2026
  if (this._reset(), !this.inRefSelectionMode()) return;
2030
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, m = Ao(f);
2027
+ const f = this._sheetSkeletonManagerService.getCurrent().skeleton, m = ko(f);
2031
2028
  this._addSelectionControlByModelData(m), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
2032
- const d = i.onPointerUp$.subscribeEvent(() => {
2033
- d.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
2029
+ const u = i.onPointerUp$.subscribeEvent(() => {
2030
+ u.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
2034
2031
  });
2035
- a.button !== 2 && h.stopPropagation();
2032
+ a.button !== 2 && d.stopPropagation();
2036
2033
  })), c;
2037
2034
  }
2038
2035
  /**
@@ -2042,7 +2039,7 @@ let Le = class extends ko {
2042
2039
  */
2043
2040
  _addSelectionControlByModelData(t) {
2044
2041
  var i;
2045
- const n = this._skeleton, o = (i = t.style) != null ? i : mr(this._themeService), r = this._scene;
2042
+ const n = this._skeleton, o = (i = t.style) != null ? i : fr(this._themeService), r = this._scene;
2046
2043
  return t.style = o, this.newSelectionControl(r, n, t);
2047
2044
  }
2048
2045
  _initSelectionChangeListener() {
@@ -2066,7 +2063,7 @@ let Le = class extends ko {
2066
2063
  const r = this._context.unit.getActiveSheet().getSheetId();
2067
2064
  t.length !== 0 && this._workbookSelections.setSelections(
2068
2065
  r,
2069
- t.map((s) => ms(s)),
2066
+ t.map((s) => hs(s)),
2070
2067
  n
2071
2068
  );
2072
2069
  }
@@ -2086,7 +2083,7 @@ let Le = class extends ko {
2086
2083
  return n == null ? void 0 : n.scene.getActiveViewportByCoord(Yn.FromArray([t.offsetX, t.offsetY]));
2087
2084
  }
2088
2085
  _getSheetObject() {
2089
- return Fo(this._context.unit, this._context);
2086
+ return Ao(this._context.unit, this._context);
2090
2087
  }
2091
2088
  /**
2092
2089
  * Handle pointer down event, bind pointermove & pointerup handler.
@@ -2106,11 +2103,11 @@ let Le = class extends ko {
2106
2103
  if (!c || !i)
2107
2104
  return;
2108
2105
  r && (this._activeViewport = r);
2109
- const { offsetX: a, offsetY: h } = t, f = c.getViewport(Kn.VIEW_MAIN);
2106
+ const { offsetX: a, offsetY: d } = t, f = c.getViewport(Kn.VIEW_MAIN);
2110
2107
  if (!f) return;
2111
- const m = c.getCoordRelativeToViewport(Yn.FromArray([a, h])), { x: d, y: u } = m;
2112
- this._startViewportPosX = d, this._startViewportPosY = u;
2113
- const l = c.getScrollXYInfoByViewport(m), { scaleX: v, scaleY: S } = c.getAncestorScale(), g = this._skeleton.getCellByOffset(d, u, v, S, l);
2108
+ const m = c.getCoordRelativeToViewport(Yn.FromArray([a, d])), { x: u, y: h } = m;
2109
+ this._startViewportPosX = u, this._startViewportPosY = h;
2110
+ const l = c.getScrollXYInfoByViewport(m), { scaleX: S, scaleY: v } = c.getAncestorScale(), g = this._skeleton.getCellByOffset(u, h, S, v, l);
2114
2111
  if (!g) return;
2115
2112
  switch (o) {
2116
2113
  case Ie.NORMAL:
@@ -2144,9 +2141,9 @@ let Le = class extends ko {
2144
2141
  },
2145
2142
  style: null
2146
2143
  }), C.range.rangeType = o;
2147
- const _ = sn(C, this._skeleton);
2148
- this._startRangeWhenPointerDown = { ..._.rangeWithCoord };
2149
- const E = { ..._.rangeWithCoord, rangeType: o };
2144
+ const R = sn(C, this._skeleton);
2145
+ this._startRangeWhenPointerDown = { ...R.rangeWithCoord };
2146
+ const E = { ...R.rangeWithCoord, rangeType: o };
2150
2147
  let p = this.getActiveSelectionControl();
2151
2148
  const b = this.getSelectionControls();
2152
2149
  for (const M of b) {
@@ -2160,18 +2157,18 @@ let Le = class extends ko {
2160
2157
  }
2161
2158
  }
2162
2159
  this._checkClearPreviousControls(t);
2163
- const y = p == null ? void 0 : p.model.currentCell, A = t.shiftKey && y, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2164
- A && y ? this._makeSelectionByTwoCells(
2165
- y,
2160
+ const T = p == null ? void 0 : p.model.currentCell, F = t.shiftKey && T, A = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2161
+ F && T ? this._makeSelectionByTwoCells(
2162
+ T,
2166
2163
  E,
2167
2164
  i,
2168
2165
  o,
2169
2166
  p
2170
2167
  // Get updated in this method
2171
- ) : F && p ? p.updateRangeBySelectionWithCoord(_) : p = this.newSelectionControl(c, i, C);
2168
+ ) : A && p ? p.updateRangeBySelectionWithCoord(R) : p = this.newSelectionControl(c, i, C);
2172
2169
  for (let M = 0; M < this.getSelectionControls().length - 1; M++)
2173
2170
  this.getSelectionControls()[M].clearHighlight();
2174
- this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(f, p, o, s, d, u), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2171
+ this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(f, p, o, s, u, h), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2175
2172
  var M;
2176
2173
  this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (M = this._escapeShortcutDisposable) == null || M.dispose(), this._escapeShortcutDisposable = null;
2177
2174
  });
@@ -2184,7 +2181,7 @@ let Le = class extends ko {
2184
2181
  * @returns {SelectionControl} selectionControl just created
2185
2182
  */
2186
2183
  newSelectionControl(t, n, o) {
2187
- const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new gr(t, r, this._themeService, {
2184
+ const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new hr(t, r, this._themeService, {
2188
2185
  highlightHeader: this._highlightHeader,
2189
2186
  enableAutoFill: !1,
2190
2187
  rowHeaderWidth: s,
@@ -2203,7 +2200,7 @@ let Le = class extends ko {
2203
2200
  }), c;
2204
2201
  }
2205
2202
  };
2206
- Le = nc([
2203
+ Le = Ji([
2207
2204
  ct(1, q(It)),
2208
2205
  ct(2, q(Et)),
2209
2206
  ct(3, zt),
@@ -2211,11 +2208,11 @@ Le = nc([
2211
2208
  ct(5, dn),
2212
2209
  ct(6, Gt)
2213
2210
  ], Le);
2214
- function rc(e) {
2215
- const t = mr(e);
2211
+ function ec(e) {
2212
+ const t = fr(e);
2216
2213
  return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
2217
2214
  }
2218
- const Tn = (e, t, n = !0) => {
2215
+ const On = (e, t, n = !0) => {
2219
2216
  let o = -1;
2220
2217
  return e.reduce((r, s, i) => {
2221
2218
  if (r.isFinish)
@@ -2229,7 +2226,7 @@ const Tn = (e, t, n = !0) => {
2229
2226
  }
2230
2227
  return (n ? r.currentIndex === t : t > c && t <= r.currentIndex) && (o = i, r.isFinish = !0), r;
2231
2228
  }, { currentIndex: 0, isFinish: !1 }), o;
2232
- }, qr = (e, t) => {
2229
+ }, Hr = (e, t) => {
2233
2230
  const n = e[t];
2234
2231
  let o = -1;
2235
2232
  if (!n || typeof n == "string" || n.nodeType !== Q.REFERENCE) return -1;
@@ -2238,7 +2235,7 @@ const Tn = (e, t, n = !0) => {
2238
2235
  typeof s != "string" && s.nodeType === Q.REFERENCE && o++;
2239
2236
  }
2240
2237
  return o;
2241
- }, oc = (e, t = 100) => {
2238
+ }, tc = (e, t = 100) => {
2242
2239
  P(() => {
2243
2240
  let n = null;
2244
2241
  const o = () => {
@@ -2251,74 +2248,74 @@ const Tn = (e, t, n = !0) => {
2251
2248
  };
2252
2249
  }, [e, t]);
2253
2250
  };
2254
- function jr(e, t, n) {
2255
- const o = O(ze), r = le(() => new _r({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = O(Rn), i = O(te), c = ee(() => {
2256
- var _;
2251
+ function Br(e, t, n) {
2252
+ const o = y(ze), r = le(() => new vr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = y(In), i = y(ne), c = ee(() => {
2253
+ var R;
2257
2254
  const a = o.getEditor(e);
2258
2255
  if (!a)
2259
2256
  return;
2260
- const h = a.getBoundingClientRect(), { marginTop: f = 0, marginBottom: m = 0 } = a.getDocumentData().documentStyle, d = a.getSkeleton();
2261
- if (!d) return;
2262
- const u = (_ = d.getSkeletonData()) == null ? void 0 : _.pages[0].height;
2263
- let { left: l, top: v, right: S, bottom: g } = h;
2264
- v = v + f, g = u ? v + u : g - m;
2257
+ const d = a.getBoundingClientRect(), { marginTop: f = 0, marginBottom: m = 0 } = a.getDocumentData().documentStyle, u = a.getSkeleton();
2258
+ if (!u) return;
2259
+ const h = (R = u.getSkeletonData()) == null ? void 0 : R.pages[0].height;
2260
+ let { left: l, top: S, right: v, bottom: g } = d;
2261
+ S = S + f, g = h ? S + h : g - m;
2265
2262
  const C = r.getValue();
2266
- if (!(C.left === l && C.top === v && C.right === S && C.bottom === g))
2267
- return r.next({ left: l - 1, right: S + 1, top: v - 1, bottom: g + 1 }), h;
2263
+ if (!(C.left === l && C.top === S && C.right === v && C.bottom === g))
2264
+ return r.next({ left: l - 1, right: v + 1, top: S - 1, bottom: g + 1 }), d;
2268
2265
  });
2269
2266
  return P(() => {
2270
2267
  t && c();
2271
- }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), oc(c), P(() => {
2272
- const a = s.scrollEvent$.pipe(Xo(100)).subscribe(c);
2268
+ }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), tc(c), P(() => {
2269
+ const a = s.scrollEvent$.pipe(Go(100)).subscribe(c);
2273
2270
  return () => {
2274
2271
  a.unsubscribe();
2275
2272
  };
2276
2273
  }, []), [r, c];
2277
2274
  }
2278
2275
  const rt = (e) => {
2279
- const t = z(e);
2276
+ const t = X(e);
2280
2277
  return t.current = e, t;
2281
- }, sc = (e, t, n) => {
2282
- const o = O(Xt), r = O(Zt), s = O(ye), [i, c] = H(), [a, h] = H(-1), [f, m] = H(!0), d = rt(f), u = z(t);
2283
- u.current = t;
2278
+ }, nc = (e, t, n) => {
2279
+ const o = y(Xt), r = y(Zt), s = y(ye), [i, c] = H(), [a, d] = H(-1), [f, m] = H(!0), u = rt(f), h = X(t);
2280
+ h.current = t;
2284
2281
  const l = () => {
2285
- c(void 0), h(-1), m(!1);
2282
+ c(void 0), d(-1), m(!1);
2286
2283
  };
2287
2284
  return P(() => {
2288
- const v = s.sequenceNodesBuilder(t.slice(1));
2289
- o.setSequenceNodes(v != null ? v : []);
2285
+ const S = s.sequenceNodesBuilder(t.slice(1));
2286
+ o.setSequenceNodes(S != null ? S : []);
2290
2287
  }, [t]), P(() => {
2291
2288
  if (n && e) {
2292
- const v = n.selectionChange$.pipe(Sn(50)).subscribe((g) => {
2289
+ const S = n.selectionChange$.pipe(vn(50)).subscribe((g) => {
2293
2290
  if (g.textRanges.length === 1) {
2294
2291
  const [C] = g.textRanges;
2295
- if (C.collapsed && d.current) {
2296
- const { startOffset: _ } = C, E = o.getCurrentSequenceNodeIndex(_ - 2), p = o.getCurrentSequenceNodeByIndex(E), b = o.getCurrentSequenceNodeByIndex(E + 1);
2292
+ if (C.collapsed && u.current) {
2293
+ const { startOffset: R } = C, E = o.getCurrentSequenceNodeIndex(R - 2), p = o.getCurrentSequenceNodeByIndex(E), b = o.getCurrentSequenceNodeByIndex(E + 1);
2297
2294
  if (p)
2298
2295
  if (typeof p != "string" && p.nodeType === 3 && !r.hasDefinedNameDescription(p.token.trim()) && b === Ge.OPEN_BRACKET) {
2299
- const y = r.getFunctionInfo(p.token);
2300
- c(y), h(-1);
2296
+ const T = r.getFunctionInfo(p.token);
2297
+ c(T), d(-1);
2301
2298
  return;
2302
2299
  } else {
2303
- const y = s.getFunctionAndParameter(`${u.current}A`, _ - 1);
2304
- if (y) {
2305
- const { functionName: A, paramIndex: F } = y, N = r.getFunctionInfo(A);
2306
- c(N), h(F);
2300
+ const T = s.getFunctionAndParameter(`${h.current}A`, R - 1);
2301
+ if (T) {
2302
+ const { functionName: F, paramIndex: A } = T, N = r.getFunctionInfo(F);
2303
+ c(N), d(A);
2307
2304
  return;
2308
2305
  }
2309
2306
  }
2310
2307
  }
2311
2308
  }
2312
- c(void 0), h(-1);
2313
- }), S = n.selectionChange$.pipe(
2314
- Rr((g) => g.textRanges.length === 1),
2315
- Cr((g) => g.textRanges[0].startOffset),
2316
- Qo()
2309
+ c(void 0), d(-1);
2310
+ }), v = n.selectionChange$.pipe(
2311
+ Cr((g) => g.textRanges.length === 1),
2312
+ Sr((g) => g.textRanges[0].startOffset),
2313
+ Zo()
2317
2314
  ).subscribe(() => {
2318
2315
  m(!0);
2319
2316
  });
2320
2317
  return () => {
2321
- v.unsubscribe(), S.unsubscribe();
2318
+ S.unsubscribe(), v.unsubscribe();
2322
2319
  };
2323
2320
  }
2324
2321
  }, [n, e]), P(() => {
@@ -2328,7 +2325,7 @@ const rt = (e) => {
2328
2325
  paramIndex: a,
2329
2326
  reset: l
2330
2327
  };
2331
- }, ic = ({ onClick: e }) => /* @__PURE__ */ x(
2328
+ }, rc = ({ onClick: e }) => /* @__PURE__ */ x(
2332
2329
  "div",
2333
2330
  {
2334
2331
  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",
@@ -2350,7 +2347,7 @@ const rt = (e) => {
2350
2347
  children: n
2351
2348
  }
2352
2349
  )
2353
- ] }), cc = (e) => {
2350
+ ] }), oc = (e) => {
2354
2351
  const { prefix: t, value: n, active: o, onClick: r } = e;
2355
2352
  return /* @__PURE__ */ B("div", { children: [
2356
2353
  /* @__PURE__ */ B("span", { children: [
@@ -2363,37 +2360,37 @@ const rt = (e) => {
2363
2360
  {
2364
2361
  className: o === i ? "univer-text-primary-500" : "",
2365
2362
  onClick: () => r(i),
2366
- children: Fr(s)
2363
+ children: kr(s)
2367
2364
  }
2368
2365
  ),
2369
2366
  i === n.length - 1 ? "" : ","
2370
2367
  ] }, s.name)),
2371
2368
  ")"
2372
2369
  ] });
2373
- }, rr = () => {
2370
+ }, nr = () => {
2374
2371
  };
2375
- function lc(e) {
2376
- const { onParamsSwitch: t = rr, onClose: n = rr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = sc(o, s, r), h = O(pn), f = !_e(h.helpFunctionVisible$), [m, d] = H(!0), u = O(dt), l = u.t("formula.prompt.required"), v = u.t("formula.prompt.optional"), S = r.getEditorId(), [g] = jr(S, !!i, [i, c]);
2372
+ function sc(e) {
2373
+ const { onParamsSwitch: t = nr, onClose: n = nr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = nc(o, s, r), d = y(Sn), f = !_e(d.helpFunctionVisible$), [m, u] = H(!1), h = y(dt), l = h.t("formula.prompt.required"), S = h.t("formula.prompt.optional"), v = r.getEditorId(), [g] = Br(v, !!i, [i, c]);
2377
2374
  function C(p) {
2378
2375
  t && t(p);
2379
2376
  }
2380
- const _ = ee((p) => {
2381
- h.helpFunctionVisible$.next(!p);
2377
+ const R = ee((p) => {
2378
+ d.helpFunctionVisible$.next(!p);
2382
2379
  }), E = () => {
2383
- _(!0), n();
2380
+ R(!0), n();
2384
2381
  };
2385
- return i ? f ? /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: g, direction: "left-center", children: /* @__PURE__ */ x(ic, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ x(cn, { portal: !0, onClickOutside: () => a(), anchorRect$: g, direction: "vertical", children: /* @__PURE__ */ B(
2382
+ return i ? f ? /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: g, direction: "left-center", children: /* @__PURE__ */ x(rc, { onClick: () => R(!1) }) }, "hidden") : /* @__PURE__ */ x(cn, { portal: !0, onClickOutside: () => a(), anchorRect$: g, direction: "vertical", children: /* @__PURE__ */ B(
2386
2383
  "div",
2387
2384
  {
2388
- className: se("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", In),
2385
+ className: se("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", En),
2389
2386
  children: [
2390
2387
  /* @__PURE__ */ B(
2391
2388
  "div",
2392
2389
  {
2393
- className: se("univer-wrap-anywhere 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 dark:!univer-text-white", ks),
2390
+ className: se("univer-wrap-anywhere 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 dark:!univer-text-white", xs),
2394
2391
  children: [
2395
2392
  /* @__PURE__ */ x(
2396
- cc,
2393
+ oc,
2397
2394
  {
2398
2395
  prefix: i.functionName,
2399
2396
  value: i.functionParameter,
@@ -2407,8 +2404,8 @@ function lc(e) {
2407
2404
  {
2408
2405
  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 dark:hover:!univer-bg-gray-600",
2409
2406
  style: { transform: m ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2410
- onClick: () => d(!m),
2411
- children: /* @__PURE__ */ x(Wr, {})
2407
+ onClick: () => u(!m),
2408
+ children: /* @__PURE__ */ x(Ur, {})
2412
2409
  }
2413
2410
  ),
2414
2411
  /* @__PURE__ */ x(
@@ -2416,7 +2413,7 @@ function lc(e) {
2416
2413
  {
2417
2414
  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 hover:univer-bg-gray-300 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-600",
2418
2415
  onClick: E,
2419
- children: /* @__PURE__ */ x(Pr, {})
2416
+ children: /* @__PURE__ */ x(Lr, {})
2420
2417
  }
2421
2418
  )
2422
2419
  ] })
@@ -2435,14 +2432,14 @@ function lc(e) {
2435
2432
  /* @__PURE__ */ x(
2436
2433
  on,
2437
2434
  {
2438
- title: u.t("formula.prompt.helpExample"),
2435
+ title: h.t("formula.prompt.helpExample"),
2439
2436
  value: `${i.functionName}(${i.functionParameter.map((p) => p.example).join(",")})`
2440
2437
  }
2441
2438
  ),
2442
2439
  /* @__PURE__ */ x(
2443
2440
  on,
2444
2441
  {
2445
- title: u.t("formula.prompt.helpAbstract"),
2442
+ title: h.t("formula.prompt.helpAbstract"),
2446
2443
  value: i.description
2447
2444
  }
2448
2445
  ),
@@ -2451,7 +2448,7 @@ function lc(e) {
2451
2448
  {
2452
2449
  className: c === b ? "univer-text-primary-500" : "",
2453
2450
  title: p.name,
2454
- value: `${p.require ? l : v} ${p.detail}`
2451
+ value: `${p.require ? l : S} ${p.detail}`
2455
2452
  },
2456
2453
  b
2457
2454
  ))
@@ -2462,8 +2459,8 @@ function lc(e) {
2462
2459
  }
2463
2460
  ) }, "show") : null;
2464
2461
  }
2465
- const ac = (e) => {
2466
- const t = O(ze);
2462
+ const ic = (e) => {
2463
+ const t = y(ze);
2467
2464
  return ee((o) => {
2468
2465
  var r, s;
2469
2466
  if (e) {
@@ -2480,44 +2477,44 @@ const ac = (e) => {
2480
2477
  }
2481
2478
  });
2482
2479
  };
2483
- function uc(e) {
2480
+ function cc(e) {
2484
2481
  var r, s;
2485
- const n = e.get(te).getCurrentUniverDocInstance();
2482
+ const n = e.get(ne).getCurrentUniverDocInstance();
2486
2483
  return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
2487
2484
  }
2488
2485
  var Me = /* @__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[e.EDIT_OTHER_WORKBOOK_REFERENCE = 4] = "EDIT_OTHER_WORKBOOK_REFERENCE", e))(Me || {});
2489
- function dc(e) {
2490
- var y;
2491
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = O(Te), c = O(te), a = i.getRenderById(r), h = i.getRenderById(t), f = h == null ? void 0 : h.with(Ir), m = O(Nr), d = O(It), [u, l] = H(
2486
+ function lc(e) {
2487
+ var T;
2488
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = y(Te), c = y(ne), a = i.getRenderById(r), d = i.getRenderById(t), f = d == null ? void 0 : d.with(_r), m = y(Tr), u = y(It), [h, l] = H(
2492
2489
  0
2493
2490
  /* NOT_SELECT */
2494
- ), v = O(ye), S = z(!0), g = a == null ? void 0 : a.with(Le), C = rt(u), _ = c.getUnit(r, U.UNIVER_SHEET), E = _ == null ? void 0 : _.getSheetBySheetId(s), p = ee((A) => {
2491
+ ), S = y(ye), v = X(!0), g = a == null ? void 0 : a.with(Le), C = rt(h), R = c.getUnit(r, W.UNIVER_SHEET), E = R == null ? void 0 : R.getSheetBySheetId(s), p = ee((F) => {
2495
2492
  g && g.setSkipLastEnabled(
2496
- A === 1 || A === 3 || A === 4
2493
+ F === 1 || F === 3 || F === 4
2497
2494
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2498
- ), C.current = A, l(A);
2495
+ ), C.current = F, l(F);
2499
2496
  }), b = ee(() => {
2500
- var X, re, he;
2501
- const A = c.getCurrentUnitOfType(U.UNIVER_SHEET);
2502
- if (!A) return;
2503
- const F = A.getActiveSheet(), N = f == null ? void 0 : f.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, k = uc(d);
2504
- if (!k) return;
2505
- const I = (X = k == null ? void 0 : k.dataStream) == null ? void 0 : X.slice(0, -2), w = ((re = v.sequenceNodesBuilder(I)) != null ? re : []).map((Y) => typeof Y == "object" ? Y.nodeType === Q.REFERENCE ? {
2506
- ...Y,
2507
- range: Ho(Y.token)
2497
+ var Y, re, he;
2498
+ const F = c.getCurrentUnitOfType(W.UNIVER_SHEET);
2499
+ if (!F) return;
2500
+ const A = F.getActiveSheet(), N = f == null ? void 0 : f.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, w = cc(u);
2501
+ if (!w) return;
2502
+ const k = (Y = w == null ? void 0 : w.dataStream) == null ? void 0 : Y.slice(0, -2), $ = ((re = S.sequenceNodesBuilder(k)) != null ? re : []).map((G) => typeof G == "object" ? G.nodeType === Q.REFERENCE ? {
2503
+ ...G,
2504
+ range: Wo(G.token)
2508
2505
  } : {
2509
- ...Y,
2506
+ ...G,
2510
2507
  range: void 0
2511
- } : Y), R = I[M - 1], T = I[M], D = w.find((Y) => typeof Y == "object" && Y.nodeType === Q.REFERENCE && M === Y.endIndex + 2), L = R && Bo(R) && (!T || qo(T) && T !== Ge.OPEN_BRACKET), W = !!D;
2512
- if ((I == null ? void 0 : I.substring(0, 1)) === "=" && (L || W))
2513
- if (W) {
2514
- if (S.current)
2508
+ } : G), I = k[M - 1], _ = k[M], O = $.find((G) => typeof G == "object" && G.nodeType === Q.REFERENCE && M === G.endIndex + 2), D = I && Ho(I) && (!_ || Bo(_) && _ !== Ge.OPEN_BRACKET), U = !!O;
2509
+ if ((k == null ? void 0 : k.substring(0, 1)) === "=" && (D || U))
2510
+ if (U) {
2511
+ if (v.current)
2515
2512
  return;
2516
- const { sheetName: Y, unitId: J } = D.range, ot = (he = c.getCurrentUnitOfType(U.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2513
+ const { sheetName: G, unitId: J } = O.range, ot = (he = c.getCurrentUnitOfType(W.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2517
2514
  J && J !== ot ? p(
2518
2515
  4
2519
2516
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2520
- ) : !Y && F.getSheetId() === (E == null ? void 0 : E.getSheetId()) || Y === F.getName() ? p(
2517
+ ) : !G && A.getSheetId() === (E == null ? void 0 : E.getSheetId()) || G === A.getName() ? p(
2521
2518
  2
2522
2519
  /* CAN_EDIT */
2523
2520
  ) : p(
@@ -2525,7 +2522,7 @@ function dc(e) {
2525
2522
  /* EDIT_OTHER_SHEET_REFERENCE */
2526
2523
  );
2527
2524
  } else
2528
- S.current = !1, p(
2525
+ v.current = !1, p(
2529
2526
  1
2530
2527
  /* NEED_ADD */
2531
2528
  );
@@ -2536,42 +2533,42 @@ function dc(e) {
2536
2533
  );
2537
2534
  });
2538
2535
  return P(() => {
2539
- const A = m.textSelection$.pipe(Rr((F) => F.unitId === t)).subscribe(() => {
2536
+ const F = m.textSelection$.pipe(Cr((A) => A.unitId === t)).subscribe(() => {
2540
2537
  b();
2541
2538
  });
2542
- return () => A.unsubscribe();
2539
+ return () => F.unsubscribe();
2543
2540
  }, [b, m.textSelection$, t]), P(() => {
2544
2541
  n || (p(
2545
2542
  0
2546
2543
  /* NOT_SELECT */
2547
- ), S.current = !0);
2544
+ ), v.current = !0);
2548
2545
  }, [n, p]), P(() => {
2549
- var F;
2546
+ var A;
2550
2547
  if (!o) return;
2551
- const A = (F = h == null ? void 0 : h.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
2548
+ const F = (A = d == null ? void 0 : d.mainComponent) == null ? void 0 : A.onPointerDown$.subscribeEvent(() => {
2552
2549
  p(
2553
2550
  0
2554
2551
  /* NOT_SELECT */
2555
- ), S.current = !0;
2552
+ ), v.current = !0;
2556
2553
  });
2557
- return () => A == null ? void 0 : A.unsubscribe();
2558
- }, [o, (y = h == null ? void 0 : h.mainComponent) == null ? void 0 : y.onPointerDown$, p]), P(() => {
2554
+ return () => F == null ? void 0 : F.unsubscribe();
2555
+ }, [o, (T = d == null ? void 0 : d.mainComponent) == null ? void 0 : T.onPointerDown$, p]), P(() => {
2559
2556
  if (!n) return;
2560
- const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
2557
+ const F = R == null ? void 0 : R.activeSheet$.subscribe(() => {
2561
2558
  b();
2562
- }), F = c.getCurrentTypeOfUnit$(U.UNIVER_SHEET).subscribe(() => {
2559
+ }), A = c.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe(() => {
2563
2560
  b();
2564
2561
  });
2565
2562
  return () => {
2566
- A == null || A.unsubscribe(), F == null || F.unsubscribe();
2563
+ F == null || F.unsubscribe(), A == null || A.unsubscribe();
2567
2564
  };
2568
- }, [b, n, _ == null ? void 0 : _.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: u, isSelectingRef: C };
2565
+ }, [b, n, R == null ? void 0 : R.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: h, isSelectingRef: C };
2569
2566
  }
2570
- const hc = () => {
2571
- const e = O(ye);
2567
+ const ac = () => {
2568
+ const e = y(ye);
2572
2569
  return $t((n) => e.sequenceNodesBuilder(n) || [], [e]);
2573
2570
  };
2574
- function fc(e, t, n) {
2571
+ function uc(e, t, n) {
2575
2572
  const o = new mn(t).setAlpha(0.05).toRgbString();
2576
2573
  return {
2577
2574
  id: n,
@@ -2584,8 +2581,8 @@ function fc(e, t, n) {
2584
2581
  widgetStroke: e.getColorFromTheme("white")
2585
2582
  };
2586
2583
  }
2587
- function Kr(e) {
2588
- var _, E, p;
2584
+ function qr(e) {
2585
+ var R, E, p;
2589
2586
  const {
2590
2587
  unitId: t,
2591
2588
  subUnitId: n,
@@ -2595,49 +2592,49 @@ function Kr(e) {
2595
2592
  refSelectionsService: i,
2596
2593
  refSelectionsRenderService: c,
2597
2594
  sheetSkeletonManagerService: a,
2598
- themeService: h,
2595
+ themeService: d,
2599
2596
  univerInstanceService: f
2600
- } = e, m = o.getUnitId(), d = f.getUnit(t, U.UNIVER_SHEET), u = d == null ? void 0 : d.getActiveSheet(), l = [];
2601
- if (!d || !u) {
2597
+ } = e, m = o.getUnitId(), u = f.getUnit(t, W.UNIVER_SHEET), h = u == null ? void 0 : u.getActiveSheet(), l = [];
2598
+ if (!u || !h) {
2602
2599
  i.setSelections(l);
2603
2600
  return;
2604
2601
  }
2605
- const v = u.getSheetId(), S = (b) => {
2606
- var y;
2607
- return (y = d == null ? void 0 : d.getSheetBySheetName(b)) == null ? void 0 : y.getSheetId();
2602
+ const S = h.getSheetId(), v = (b) => {
2603
+ var T;
2604
+ return (T = u == null ? void 0 : u.getSheetBySheetName(b)) == null ? void 0 : T.getSheetId();
2608
2605
  };
2609
- if (!((_ = a == null ? void 0 : a.getWorksheetSkeleton(v)) == null ? void 0 : _.skeleton)) return;
2606
+ if (!((R = a == null ? void 0 : a.getWorksheetSkeleton(S)) == null ? void 0 : R.skeleton)) return;
2610
2607
  const C = [];
2611
- for (let b = 0, y = r.length; b < y; b++) {
2612
- const A = r[b], { themeColor: F, token: N, refIndex: M, endIndex: k } = A, I = ht(N), { unitId: w, sheetName: R, range: T } = I, D = S(R);
2613
- if (!D && R || m !== t && w !== m || w && w !== m || D && D !== v || !D && v !== n)
2608
+ for (let b = 0, T = r.length; b < T; b++) {
2609
+ const F = r[b], { themeColor: A, token: N, refIndex: M, endIndex: w } = F, k = ht(N), { unitId: $, sheetName: I, range: _ } = k, O = v(I);
2610
+ if (!O && I || m !== t && $ !== m || $ && $ !== m || O && O !== S || !O && S !== n)
2614
2611
  continue;
2615
- const L = ps(T, u.getRowCount(), u.getColumnCount());
2616
- L.unitId = t, L.sheetId = v, l.push({
2617
- range: L,
2612
+ const D = fs(_, h.getRowCount(), h.getColumnCount());
2613
+ D.unitId = t, D.sheetId = S, l.push({
2614
+ range: D,
2618
2615
  primary: null,
2619
- style: fc(h, F, M.toString())
2620
- }), C.push(k);
2616
+ style: uc(d, A, M.toString())
2617
+ }), C.push(w);
2621
2618
  }
2622
2619
  if (s) {
2623
- const b = (p = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : p.startOffset, y = C.findIndex((A) => A + 2 === b);
2624
- y !== -1 ? c == null || c.setActiveSelectionIndex(y) : c == null || c.resetActiveSelectionIndex();
2620
+ const b = (p = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : p.startOffset, T = C.findIndex((F) => F + 2 === b);
2621
+ T !== -1 ? c == null || c.setActiveSelectionIndex(T) : c == null || c.resetActiveSelectionIndex();
2625
2622
  }
2626
2623
  return l;
2627
2624
  }
2628
- function gc(e, t) {
2629
- const n = O(te), o = O(Et), r = O(Gt), s = O(Te), i = _e(le(() => n.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Le), h = c == null ? void 0 : c.with(bt), f = ee((m, d) => {
2630
- const u = n.getCurrentUnitOfType(U.UNIVER_SHEET);
2631
- if (!u || a != null && a.selectionMoving) return;
2632
- const l = Kr({
2625
+ function dc(e, t) {
2626
+ const n = y(ne), o = y(Et), r = y(Gt), s = y(Te), i = _e(le(() => n.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Le), d = c == null ? void 0 : c.with(bt), f = ee((m, u) => {
2627
+ const h = n.getCurrentUnitOfType(W.UNIVER_SHEET);
2628
+ if (!h || a != null && a.selectionMoving) return;
2629
+ const l = qr({
2633
2630
  unitId: e,
2634
2631
  subUnitId: t,
2635
- currentWorkbook: u,
2632
+ currentWorkbook: h,
2636
2633
  refSelections: m,
2637
- editor: d,
2634
+ editor: u,
2638
2635
  refSelectionsService: r,
2639
2636
  refSelectionsRenderService: a,
2640
- sheetSkeletonManagerService: h,
2637
+ sheetSkeletonManagerService: d,
2641
2638
  themeService: o,
2642
2639
  univerInstanceService: n
2643
2640
  });
@@ -2648,48 +2645,48 @@ function gc(e, t) {
2648
2645
  a == null || a.resetActiveSelectionIndex();
2649
2646
  }, [a]), f;
2650
2647
  }
2651
- function Yr(e = "") {
2652
- const t = O(Zt), n = mc(), o = O(pe), r = le(() => e.length, [e]);
2653
- return ee((i, c, a = !0, h) => {
2648
+ function jr(e = "") {
2649
+ const t = y(Zt), n = hc(), o = y(pe), r = le(() => e.length, [e]);
2650
+ return ee((i, c, a = !0, d) => {
2654
2651
  const f = i.getDocumentData(), m = i.getEditorId();
2655
2652
  if (!f)
2656
2653
  return [];
2657
- const d = f.body;
2658
- if (!d)
2654
+ const u = f.body;
2655
+ if (!u)
2659
2656
  return [];
2660
- const u = d.dataStream.slice(0, d.dataStream.length - 2), l = { dataStream: "", ...f.body };
2661
- if (!u.startsWith(e)) return [];
2657
+ const h = u.dataStream.slice(0, u.dataStream.length - 2), l = { dataStream: "", ...f.body };
2658
+ if (!h.startsWith(e)) return [];
2662
2659
  if (c == null || c.length === 0)
2663
2660
  return l.textRuns = [], o.syncExecuteCommand(jn.id, {
2664
2661
  unitId: m,
2665
- body: Ln(l, 0, l.dataStream.length - 2)
2662
+ body: $n(l, 0, l.dataStream.length - 2)
2666
2663
  }), [];
2667
2664
  {
2668
- const { textRuns: v, refSelections: S } = pc(t, n, c);
2669
- r && v.forEach((_) => {
2670
- _.ed = _.ed + r, _.st = _.st + r;
2671
- }), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...v];
2672
- const g = c.reduce((_, E) => typeof E == "string" ? `${_}${E}` : `${_}${E.token}`, "");
2665
+ const { textRuns: S, refSelections: v } = fc(t, n, c);
2666
+ r && S.forEach((R) => {
2667
+ R.ed = R.ed + r, R.st = R.st + r;
2668
+ }), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...S];
2669
+ const g = c.reduce((R, E) => typeof E == "string" ? `${R}${E}` : `${R}${E.token}`, "");
2673
2670
  l.dataStream = `${e}${g}\r
2674
2671
  `;
2675
2672
  let C;
2676
2673
  if (a) {
2677
2674
  C = i.getSelectionRanges();
2678
- const _ = l.dataStream.length - 2 + r;
2675
+ const R = l.dataStream.length - 2 + r;
2679
2676
  C.forEach((E) => {
2680
- E.startOffset = Math.max(0, Math.min(E.startOffset, _)), E.endOffset = Math.max(0, Math.min(E.endOffset, _));
2677
+ E.startOffset = Math.max(0, Math.min(E.startOffset, R)), E.endOffset = Math.max(0, Math.min(E.endOffset, R));
2681
2678
  });
2682
2679
  }
2683
2680
  return o.syncExecuteCommand(jn.id, {
2684
2681
  unitId: m,
2685
- body: Ln(l, 0, l.dataStream.length - 2),
2686
- textRanges: h != null ? h : C
2687
- }), S;
2682
+ body: $n(l, 0, l.dataStream.length - 2),
2683
+ textRanges: d != null ? d : C
2684
+ }), v;
2688
2685
  }
2689
2686
  });
2690
2687
  }
2691
- function mc() {
2692
- const e = O(Et), t = e.getCurrentTheme();
2688
+ function hc() {
2689
+ const e = y(Et), t = e.getCurrentTheme();
2693
2690
  return le(() => {
2694
2691
  const o = [
2695
2692
  e.getColorFromTheme("loop-color.1"),
@@ -2708,13 +2705,13 @@ function mc() {
2708
2705
  return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i };
2709
2706
  }, [t]);
2710
2707
  }
2711
- function pc(e, t, n) {
2712
- const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [], h = /* @__PURE__ */ new Map();
2708
+ function fc(e, t, n) {
2709
+ const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [], d = /* @__PURE__ */ new Map();
2713
2710
  let f = 0;
2714
- for (let m = 0, d = n.length; m < d; m++) {
2715
- const u = n[m];
2716
- if (typeof u == "string") {
2717
- const _ = c[c.length - 1], E = _ ? _.ed : 0, p = E + u.length;
2711
+ for (let m = 0, u = n.length; m < u; m++) {
2712
+ const h = n[m];
2713
+ if (typeof h == "string") {
2714
+ const R = c[c.length - 1], E = R ? R.ed : 0, p = E + h.length;
2718
2715
  c.push({
2719
2716
  st: E,
2720
2717
  ed: p,
@@ -2727,10 +2724,10 @@ function pc(e, t, n) {
2727
2724
  });
2728
2725
  continue;
2729
2726
  }
2730
- if (e.hasDefinedNameDescription(u.token.trim())) {
2727
+ if (e.hasDefinedNameDescription(h.token.trim())) {
2731
2728
  c.push({
2732
- st: u.startIndex,
2733
- ed: u.endIndex + 1,
2729
+ st: h.startIndex,
2730
+ ed: h.endIndex + 1,
2734
2731
  ts: {
2735
2732
  cl: {
2736
2733
  rgb: i
@@ -2740,27 +2737,27 @@ function pc(e, t, n) {
2740
2737
  });
2741
2738
  continue;
2742
2739
  }
2743
- const { startIndex: l, endIndex: v, nodeType: S, token: g } = u;
2740
+ const { startIndex: l, endIndex: S, nodeType: v, token: g } = h;
2744
2741
  let C = "";
2745
- if (S === Q.REFERENCE) {
2746
- if (h.has(g))
2747
- C = h.get(g);
2742
+ if (v === Q.REFERENCE) {
2743
+ if (d.has(g))
2744
+ C = d.get(g);
2748
2745
  else {
2749
- const _ = f % o.length;
2750
- C = o[_], h.set(g, C), f++;
2746
+ const R = f % o.length;
2747
+ C = o[R], d.set(g, C), f++;
2751
2748
  }
2752
2749
  a.push({
2753
2750
  refIndex: m,
2754
2751
  themeColor: C,
2755
2752
  token: g,
2756
- startIndex: u.startIndex,
2757
- endIndex: u.endIndex,
2753
+ startIndex: h.startIndex,
2754
+ endIndex: h.endIndex,
2758
2755
  index: a.length
2759
2756
  });
2760
- } else S === Q.NUMBER ? C = r : (S === Q.STRING || S === Q.ARRAY) && (C = s);
2757
+ } else v === Q.NUMBER ? C = r : (v === Q.STRING || v === Q.ARRAY) && (C = s);
2761
2758
  C && C.length > 0 ? c.push({
2762
2759
  st: l,
2763
- ed: v + 1,
2760
+ ed: S + 1,
2764
2761
  ts: {
2765
2762
  cl: {
2766
2763
  rgb: C
@@ -2769,7 +2766,7 @@ function pc(e, t, n) {
2769
2766
  }
2770
2767
  }) : c.push({
2771
2768
  st: l,
2772
- ed: v + 1,
2769
+ ed: S + 1,
2773
2770
  ts: {
2774
2771
  cl: {
2775
2772
  rgb: i
@@ -2780,77 +2777,77 @@ function pc(e, t, n) {
2780
2777
  }
2781
2778
  return { textRuns: c, refSelections: a };
2782
2779
  }
2783
- const Sc = (e, t, n, o) => {
2784
- const r = O(pe), s = O(zt), i = z(t);
2780
+ const gc = (e, t, n, o) => {
2781
+ const r = y(pe), s = y(zt), i = X(t);
2785
2782
  i.current = t;
2786
- const c = z(o);
2783
+ const c = X(o);
2787
2784
  c.current = o, P(() => {
2788
2785
  if (!n || !e)
2789
2786
  return;
2790
- const h = `sheet.formula-embedding-editor.${n.getEditorId()}`, f = new Ye(), m = (l, v) => {
2787
+ const d = `sheet.formula-embedding-editor.${n.getEditorId()}`, f = new Ye(), m = (l, S) => {
2791
2788
  if (c.current) {
2792
- c.current(l, v);
2789
+ c.current(l, S);
2793
2790
  return;
2794
2791
  }
2795
- let S = de.LEFT;
2796
- l === $.ARROW_DOWN ? S = de.DOWN : l === $.ARROW_UP ? S = de.UP : l === $.ARROW_RIGHT && (S = de.RIGHT), v === V.SHIFT ? r.executeCommand(es.id, {
2797
- direction: S
2798
- }) : r.executeCommand(ts.id, {
2799
- direction: S
2792
+ let v = de.LEFT;
2793
+ l === L.ARROW_DOWN ? v = de.DOWN : l === L.ARROW_UP ? v = de.UP : l === L.ARROW_RIGHT && (v = de.RIGHT), S === V.SHIFT ? r.executeCommand(Xo.id, {
2794
+ direction: v
2795
+ }) : r.executeCommand(Qo.id, {
2796
+ direction: v
2800
2797
  });
2801
- }, d = (l, v) => {
2802
- let S = de.DOWN;
2803
- l === $.ARROW_DOWN ? S = de.DOWN : l === $.ARROW_UP ? S = de.UP : l === $.ARROW_LEFT ? S = de.LEFT : l === $.ARROW_RIGHT && (S = de.RIGHT), i.current ? v === V.CTRL_COMMAND ? r.executeCommand(Wn.id, {
2804
- direction: S,
2805
- jumpOver: Hn.moveGap,
2798
+ }, u = (l, S) => {
2799
+ let v = de.DOWN;
2800
+ l === L.ARROW_DOWN ? v = de.DOWN : l === L.ARROW_UP ? v = de.UP : l === L.ARROW_LEFT ? v = de.LEFT : l === L.ARROW_RIGHT && (v = de.RIGHT), i.current ? S === V.CTRL_COMMAND ? r.executeCommand(Hn.id, {
2801
+ direction: v,
2802
+ jumpOver: Bn.moveGap,
2806
2803
  extra: "formula-editor",
2807
2804
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2808
- }) : v === V.SHIFT ? r.executeCommand(Bn.id, {
2809
- direction: S,
2805
+ }) : S === V.SHIFT ? r.executeCommand(qn.id, {
2806
+ direction: v,
2810
2807
  extra: "formula-editor"
2811
- }) : v === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(Bn.id, {
2812
- direction: S,
2813
- jumpOver: Hn.moveGap,
2808
+ }) : S === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(qn.id, {
2809
+ direction: v,
2810
+ jumpOver: Bn.moveGap,
2814
2811
  extra: "formula-editor"
2815
- }) : r.executeCommand(Wn.id, {
2816
- direction: S,
2812
+ }) : r.executeCommand(Hn.id, {
2813
+ direction: v,
2817
2814
  extra: "formula-editor",
2818
2815
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2819
- }) : m(l, v);
2816
+ }) : m(l, S);
2820
2817
  };
2821
2818
  return f.add(r.registerCommand({
2822
- id: h,
2819
+ id: d,
2823
2820
  type: be.OPERATION,
2824
- handler(l, v) {
2825
- const { keyCode: S, metaKey: g } = v;
2826
- d(S, g);
2821
+ handler(l, S) {
2822
+ const { keyCode: v, metaKey: g } = S;
2823
+ u(v, g);
2827
2824
  }
2828
2825
  })), [
2829
- { keyCode: $.ARROW_DOWN },
2830
- { keyCode: $.ARROW_LEFT },
2831
- { keyCode: $.ARROW_RIGHT },
2832
- { keyCode: $.ARROW_UP },
2833
- { keyCode: $.ARROW_DOWN, metaKey: V.SHIFT },
2834
- { keyCode: $.ARROW_LEFT, metaKey: V.SHIFT },
2835
- { keyCode: $.ARROW_RIGHT, metaKey: V.SHIFT },
2836
- { keyCode: $.ARROW_UP, metaKey: V.SHIFT },
2837
- { keyCode: $.ARROW_DOWN, metaKey: V.CTRL_COMMAND },
2838
- { keyCode: $.ARROW_LEFT, metaKey: V.CTRL_COMMAND },
2839
- { keyCode: $.ARROW_RIGHT, metaKey: V.CTRL_COMMAND },
2840
- { keyCode: $.ARROW_UP, metaKey: V.CTRL_COMMAND },
2841
- { keyCode: $.ARROW_DOWN, metaKey: V.CTRL_COMMAND | V.SHIFT },
2842
- { keyCode: $.ARROW_LEFT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2843
- { keyCode: $.ARROW_RIGHT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2844
- { keyCode: $.ARROW_UP, metaKey: V.CTRL_COMMAND | V.SHIFT }
2845
- ].map(({ keyCode: l, metaKey: v }) => ({
2846
- id: h,
2847
- binding: v ? l | v : l,
2826
+ { keyCode: L.ARROW_DOWN },
2827
+ { keyCode: L.ARROW_LEFT },
2828
+ { keyCode: L.ARROW_RIGHT },
2829
+ { keyCode: L.ARROW_UP },
2830
+ { keyCode: L.ARROW_DOWN, metaKey: V.SHIFT },
2831
+ { keyCode: L.ARROW_LEFT, metaKey: V.SHIFT },
2832
+ { keyCode: L.ARROW_RIGHT, metaKey: V.SHIFT },
2833
+ { keyCode: L.ARROW_UP, metaKey: V.SHIFT },
2834
+ { keyCode: L.ARROW_DOWN, metaKey: V.CTRL_COMMAND },
2835
+ { keyCode: L.ARROW_LEFT, metaKey: V.CTRL_COMMAND },
2836
+ { keyCode: L.ARROW_RIGHT, metaKey: V.CTRL_COMMAND },
2837
+ { keyCode: L.ARROW_UP, metaKey: V.CTRL_COMMAND },
2838
+ { keyCode: L.ARROW_DOWN, metaKey: V.CTRL_COMMAND | V.SHIFT },
2839
+ { keyCode: L.ARROW_LEFT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2840
+ { keyCode: L.ARROW_RIGHT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2841
+ { keyCode: L.ARROW_UP, metaKey: V.CTRL_COMMAND | V.SHIFT }
2842
+ ].map(({ keyCode: l, metaKey: S }) => ({
2843
+ id: d,
2844
+ binding: S ? l | S : l,
2848
2845
  preconditions: () => !0,
2849
2846
  priority: 900,
2850
2847
  staticParameters: {
2851
2848
  eventType: xe.Keyboard,
2852
2849
  keyCode: l,
2853
- metaKey: v
2850
+ metaKey: S
2854
2851
  }
2855
2852
  })).forEach((l) => {
2856
2853
  f.add(s.registerShortcut(l));
@@ -2858,106 +2855,106 @@ const Sc = (e, t, n, o) => {
2858
2855
  f.dispose();
2859
2856
  };
2860
2857
  }, [r, n, e, s]);
2861
- }, vc = (e, t, n, o, r = !0) => {
2862
- var u;
2863
- const s = O(Te), i = O(dn), c = O(ys), a = O(Gt), h = O(te), f = _e(le(() => h.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [h])), m = s.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), d = m == null ? void 0 : m.with(Le);
2858
+ }, mc = (e, t, n, o, r = !0) => {
2859
+ var h;
2860
+ const s = y(Te), i = y(dn), c = y(Es), a = y(Gt), d = y(ne), f = _e(le(() => d.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [d])), m = s.getRenderById((h = f == null ? void 0 : f.getUnitId()) != null ? h : ""), u = m == null ? void 0 : m.with(Le);
2864
2861
  Pt(() => {
2865
2862
  if (e)
2866
- return i.setContextValue($n, !0), r && c.disable(), () => {
2867
- const l = h.getCurrentUnitOfType(U.UNIVER_DOC);
2868
- (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue($n, !1), r && c.enable(), a.clear();
2863
+ return i.setContextValue(Pn, !0), r && c.disable(), () => {
2864
+ const l = d.getCurrentUnitOfType(W.UNIVER_DOC);
2865
+ (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(Pn, !1), r && c.enable(), a.clear();
2869
2866
  };
2870
2867
  }, [i, e, a, r, o]), Pt(() => {
2871
2868
  if (e && t) {
2872
- const l = d == null ? void 0 : d.enableSelectionChanging();
2869
+ const l = u == null ? void 0 : u.enableSelectionChanging();
2873
2870
  return i.setContextValue(Gn, !0), () => {
2874
2871
  i.setContextValue(Gn, !1), l == null || l.dispose();
2875
2872
  };
2876
2873
  }
2877
- }, [i, e, d, t]), P(() => {
2878
- e && (d == null || d.setSkipLastEnabled(!1));
2879
- }, [e, d]);
2880
- }, Cc = (e, t, n) => {
2881
- const o = O(te), r = O(vn);
2874
+ }, [i, e, u, t]), P(() => {
2875
+ e && (u == null || u.setSkipLastEnabled(!1));
2876
+ }, [e, u]);
2877
+ }, pc = (e, t, n) => {
2878
+ const o = y(ne), r = y(Cn);
2882
2879
  return $t(() => {
2883
2880
  if (e) {
2884
- const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(U.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
2881
+ const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(W.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
2885
2882
  (c == null ? void 0 : c.getUnitId()) !== t && o.setCurrentUnitForType(t), a && a.getSheetId() === n && r.setSelections(i);
2886
2883
  }
2887
2884
  }, [e, r, n, t, o]);
2888
- }, _c = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), un = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Ft = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Ee(r.range)) : e.map((r) => o ? jo(r) : r.sheetName !== "" && r.sheetName !== n ? _t(r.sheetName, r.range) : Ee(r.range)), Rc = (e) => {
2889
- var f, m, d;
2885
+ }, Sc = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), un = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Ft = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Ee(r.range)) : e.map((r) => o ? qo(r) : r.sheetName !== "" && r.sheetName !== n ? _t(r.sheetName, r.range) : Ee(r.range)), vc = (e) => {
2886
+ var f, m, u;
2890
2887
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
2891
2888
  if ((o == null ? void 0 : o.length) !== 1)
2892
2889
  return;
2893
2890
  const s = o[0].startOffset - 1, i = ((m = (f = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? m : `\r
2894
- `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], a = Tn(c, s, !1), h = qr(c, a);
2891
+ `).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a = On(c, s, !1), d = Hr(c, a);
2895
2892
  return {
2896
2893
  nodeIndex: a,
2897
- updatingRefIndex: h,
2894
+ updatingRefIndex: d,
2898
2895
  sequenceNodes: c,
2899
2896
  offset: s
2900
2897
  };
2901
- }, Ic = (() => {
2902
- }), Ec = (e, t, n, o, r, s, i, c, a, h = Ic) => {
2898
+ }, Cc = (() => {
2899
+ }), _c = (e, t, n, o, r, s, i, c, a, d = Cc) => {
2903
2900
  var M;
2904
- const f = O(Te), m = O(te), d = O(pe), u = O(Nr), l = O(Et), v = O(ye), S = m.getUnit(o), g = ee((k, I) => {
2905
- var w, R, T;
2906
- return (T = (R = (w = m.getUnit(k)) == null ? void 0 : w.getSheetBySheetId(I)) == null ? void 0 : R.getName()) != null ? T : "";
2907
- }), C = le(() => g(o, r), [g, r, o]), _ = _e(S == null ? void 0 : S.activeSheet$), E = rt({ activeSheet: _, sheetName: C }), p = _e(le(() => m.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [m])), b = f.getRenderById((M = p == null ? void 0 : p.getUnitId()) != null ? M : ""), y = b == null ? void 0 : b.with(Le), A = b == null ? void 0 : b.with(bt), F = O(Gt), N = ee((k, I, w) => {
2908
- var X, re, he, Y, J, ot, st, Ot, Oe, Nt;
2909
- const R = Rc({ editor: a, lexerTreeBuilder: v });
2910
- if (!R) return;
2911
- const { nodeIndex: T, updatingRefIndex: D, sequenceNodes: L, offset: W } = R;
2901
+ const f = y(Te), m = y(ne), u = y(pe), h = y(Tr), l = y(Et), S = y(ye), v = m.getUnit(o), g = ee((w, k) => {
2902
+ var $, I, _;
2903
+ return (_ = (I = ($ = m.getUnit(w)) == null ? void 0 : $.getSheetBySheetId(k)) == null ? void 0 : I.getName()) != null ? _ : "";
2904
+ }), C = le(() => g(o, r), [g, r, o]), R = _e(v == null ? void 0 : v.activeSheet$), E = rt({ activeSheet: R, sheetName: C }), p = _e(le(() => m.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [m])), b = f.getRenderById((M = p == null ? void 0 : p.getUnitId()) != null ? M : ""), T = b == null ? void 0 : b.with(Le), F = b == null ? void 0 : b.with(bt), A = y(Gt), N = ee((w, k, $) => {
2905
+ var Y, re, he, G, J, ot, st, Ot, Oe, Nt;
2906
+ const I = vc({ editor: a, lexerTreeBuilder: S });
2907
+ if (!I) return;
2908
+ const { nodeIndex: _, updatingRefIndex: O, sequenceNodes: D, offset: U } = I;
2912
2909
  if (n.current === Me.NEED_ADD)
2913
- if (W !== 0) {
2914
- if (T === -1 && L.length)
2910
+ if (U !== 0) {
2911
+ if (_ === -1 && D.length)
2915
2912
  return;
2916
- const K = k[k.length - 1], ne = L.splice(T + 1), fe = (X = K.sheetId) != null ? X : r, oe = {
2913
+ const K = w[w.length - 1], te = D.splice(_ + 1), fe = (Y = K.sheetId) != null ? Y : r, oe = {
2917
2914
  range: K,
2918
2915
  unitId: (re = K.unitId) != null ? re : p.getUnitId(),
2919
2916
  sheetName: g((he = K.unitId) != null ? he : p.getUnitId(), fe)
2920
2917
  }, ae = fe !== r, ge = (p == null ? void 0 : p.getUnitId()) !== o, Se = Ft([oe], i && (ae || ge), C, ge);
2921
- L.push({ token: Se[0], nodeType: Q.REFERENCE });
2922
- const We = [...L, ...ne], He = un(We);
2923
- h(He, _c(L), I);
2918
+ D.push({ token: Se[0], nodeType: Q.REFERENCE });
2919
+ const We = [...D, ...te], He = un(We);
2920
+ d(He, Sc(D), k);
2924
2921
  } else {
2925
- const K = k[k.length - 1], ne = (Y = K.sheetId) != null ? Y : r, fe = {
2922
+ const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r, fe = {
2926
2923
  range: K,
2927
2924
  unitId: (J = K.unitId) != null ? J : p.getUnitId(),
2928
- sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), ne)
2929
- }, oe = ne !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (oe || ae), C, ae);
2930
- L.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2931
- const Se = un(L);
2932
- h(Se, ge[0].length, I);
2925
+ sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), te)
2926
+ }, oe = te !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (oe || ae), C, ae);
2927
+ D.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2928
+ const Se = un(D);
2929
+ d(Se, ge[0].length, k);
2933
2930
  }
2934
2931
  else if (n.current === Me.EDIT_OTHER_SHEET_REFERENCE || n.current === Me.EDIT_OTHER_WORKBOOK_REFERENCE) {
2935
- const K = k.pop();
2932
+ const K = w.pop();
2936
2933
  if (!K) return;
2937
- const ne = L[T];
2938
- if (typeof ne == "object" && ne.nodeType === Q.REFERENCE) {
2939
- const fe = ne.token;
2940
- (p == null ? void 0 : p.getUnitId()) !== o ? ne.token = Ko((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : ne.token = C === (_ == null ? void 0 : _.getName()) ? Ee(K) : _t(_.getName(), K);
2941
- const ae = W + (ne.token.length - fe.length);
2942
- h(Yo(L), ae, I);
2934
+ const te = D[_];
2935
+ if (typeof te == "object" && te.nodeType === Q.REFERENCE) {
2936
+ const fe = te.token;
2937
+ (p == null ? void 0 : p.getUnitId()) !== o ? te.token = jo((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : te.token = C === (R == null ? void 0 : R.getName()) ? Ee(K) : _t(R.getName(), K);
2938
+ const ae = U + (te.token.length - fe.length);
2939
+ d(Ko(D), ae, k);
2943
2940
  }
2944
2941
  } else {
2945
- const K = [...k];
2946
- if (!w && D !== -1) {
2947
- const G = K.pop();
2948
- G && K.splice(D, 0, G);
2942
+ const K = [...w];
2943
+ if (!$ && O !== -1) {
2944
+ const Z = K.pop();
2945
+ Z && K.splice(O, 0, Z);
2949
2946
  }
2950
- let ne = 0;
2951
- const fe = L.map((G) => {
2947
+ let te = 0;
2948
+ const fe = D.map((Z) => {
2952
2949
  var Re, we, it, Be;
2953
- if (typeof G == "string")
2954
- return G;
2955
- if (G.nodeType === Q.REFERENCE) {
2956
- const me = ht(G.token);
2950
+ if (typeof Z == "string")
2951
+ return Z;
2952
+ if (Z.nodeType === Q.REFERENCE) {
2953
+ const me = ht(Z.token);
2957
2954
  if (me.sheetName || (me.sheetName = C), (me.unitId || o) !== (p == null ? void 0 : p.getUnitId()) || i && ((Re = E.current.activeSheet) == null ? void 0 : Re.getName()) !== me.sheetName)
2958
- return G.token;
2959
- const ie = K[ne];
2960
- if (ne++, !ie)
2955
+ return Z.token;
2956
+ const ie = K[te];
2957
+ if (te++, !ie)
2961
2958
  return "";
2962
2959
  const gt = (we = ie.sheetId) != null ? we : r, Jt = {
2963
2960
  range: ie,
@@ -2966,148 +2963,148 @@ const Sc = (e, t, n, o) => {
2966
2963
  }, Mt = (p == null ? void 0 : p.getUnitId()) !== o;
2967
2964
  return Ft([Jt], i && (gt !== r || Mt), C, Mt)[0];
2968
2965
  }
2969
- return G.token;
2966
+ return Z.token;
2970
2967
  });
2971
2968
  let oe = "", ae;
2972
- fe.forEach((G, Re) => {
2973
- oe += G, Re === T && (ae = oe.length);
2969
+ fe.forEach((Z, Re) => {
2970
+ oe += Z, Re === _ && (ae = oe.length);
2974
2971
  });
2975
2972
  const ge = [];
2976
- for (let G = ne; G <= k.length - 1; G++) {
2977
- const Re = k[G], we = (Ot = Re.sheetId) != null ? Ot : r, it = {
2973
+ for (let Z = te; Z <= w.length - 1; Z++) {
2974
+ const Re = w[Z], we = (Ot = Re.sheetId) != null ? Ot : r, it = {
2978
2975
  range: Re,
2979
2976
  unitId: (Oe = Re.unitId) != null ? Oe : p.getUnitId(),
2980
2977
  sheetName: g((Nt = Re.unitId) != null ? Nt : p.getUnitId(), we)
2981
2978
  }, Be = (p == null ? void 0 : p.getUnitId()) !== o, ie = Ft([it], i && (we !== r || Be), C, Be);
2982
2979
  ge.push(ie[0]);
2983
2980
  }
2984
- const Se = L[L.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === Q.REFERENCE), He = `${oe}${ge.length && We ? "," : ""}${ge.join(",")}`;
2985
- h(He, !ge.length && ae ? ae : He.length, I);
2981
+ const Se = D[D.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === Q.REFERENCE), He = `${oe}${ge.length && We ? "," : ""}${ge.join(",")}`;
2982
+ d(He, !ge.length && ae ? ae : He.length, k);
2986
2983
  }
2987
2984
  });
2988
2985
  P(() => {
2989
- if (y && e) {
2990
- let k = !0, I = 0;
2991
- const w = (T, D) => {
2992
- if (k) {
2993
- k = !1, I = T.length;
2986
+ if (T && e) {
2987
+ let w = !0, k = 0;
2988
+ const $ = (_, O) => {
2989
+ if (w) {
2990
+ w = !1, k = _.length;
2994
2991
  return;
2995
2992
  }
2996
- const L = T.length > I;
2997
- D && (I = T.length), N(T.map((W) => W.rangeWithCoord), D, L);
2998
- }, R = new Ye();
2999
- return R.add(y.selectionMoving$.subscribe((T) => {
3000
- w(T, !1);
3001
- })), R.add(y.selectionMoveEnd$.subscribe((T) => {
3002
- w(T, !0);
2993
+ const D = _.length > k;
2994
+ O && (k = _.length), N(_.map((U) => U.rangeWithCoord), O, D);
2995
+ }, I = new Ye();
2996
+ return I.add(T.selectionMoving$.subscribe((_) => {
2997
+ $(_, !1);
2998
+ })), I.add(T.selectionMoveEnd$.subscribe((_) => {
2999
+ $(_, !0);
3003
3000
  })), () => {
3004
- R.dispose();
3001
+ I.dispose();
3005
3002
  };
3006
3003
  }
3007
- }, [e, N, y]), P(() => {
3008
- if (t && y && a) {
3009
- const k = new Ye(), I = () => {
3010
- k.dispose(), y.getSelectionControls().forEach((T, D) => {
3011
- k.add(
3012
- T.selectionScaling$.subscribe((L) => {
3013
- const W = y.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), X = W[D];
3014
- L.sheetId = X.sheetId, L.unitId = X.unitId, W[D] = L, N(W, !1);
3004
+ }, [e, N, T]), P(() => {
3005
+ if (t && T && a) {
3006
+ const w = new Ye(), k = () => {
3007
+ w.dispose(), T.getSelectionControls().forEach((_, O) => {
3008
+ w.add(
3009
+ _.selectionScaling$.subscribe((D) => {
3010
+ const U = T.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), Y = U[O];
3011
+ D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !1);
3015
3012
  })
3016
- ), k.add(
3017
- T.selectionMoving$.subscribe((L) => {
3018
- const W = y.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), X = W[D];
3019
- L.sheetId = X.sheetId, L.unitId = X.unitId, W[D] = L, N(W, !0);
3013
+ ), w.add(
3014
+ _.selectionMoving$.subscribe((D) => {
3015
+ const U = T.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), Y = U[O];
3016
+ D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !0);
3020
3017
  })
3021
3018
  );
3022
3019
  });
3023
- }, w = Jo(
3020
+ }, $ = zo(
3024
3021
  a.input$,
3025
- F.selectionSet$,
3026
- y.selectionMoveEnd$
3022
+ A.selectionSet$,
3023
+ T.selectionMoveEnd$
3027
3024
  ).pipe(
3028
- Ds(50)
3025
+ As(50)
3029
3026
  ).subscribe(() => {
3030
- I();
3027
+ k();
3031
3028
  });
3032
3029
  return () => {
3033
- w.unsubscribe(), k.dispose();
3030
+ $.unsubscribe(), w.dispose();
3034
3031
  };
3035
3032
  }
3036
- }, [a, t, N, y, F.selectionSet$]), y == null || y.getSelectionDataWithStyle(), P(() => {
3033
+ }, [a, t, N, T, A.selectionSet$]), T == null || T.getSelectionDataWithStyle(), P(() => {
3037
3034
  if (c) {
3038
- const k = d.onCommandExecuted((I) => {
3039
- var R;
3040
- if (I.id !== Cn.id)
3035
+ const w = u.onCommandExecuted((k) => {
3036
+ var I;
3037
+ if (k.id !== _n.id)
3041
3038
  return;
3042
- const w = I.params;
3043
- if (w.extra === "formula-editor" && w.selections.length) {
3044
- const T = w.selections[w.selections.length - 1];
3045
- if (T) {
3046
- const { range: D, primary: L } = T;
3047
- (L != null && L.isMergedMainCell || L != null && L.isMerged) && hn.contains(L, D) && (D.startRow = L.startRow, D.endRow = L.startRow, D.startColumn = L.startColumn, D.endColumn = L.startColumn);
3048
- const W = n.current === Me.NEED_ADD, X = ((R = y == null ? void 0 : y.getSelectionDataWithStyle()) != null ? R : []).map((re) => re.rangeWithCoord);
3049
- W ? X.push(D) : X[X.length - 1] = D, N(X, !0);
3039
+ const $ = k.params;
3040
+ if ($.extra === "formula-editor" && $.selections.length) {
3041
+ const _ = $.selections[$.selections.length - 1];
3042
+ if (_) {
3043
+ const { range: O, primary: D } = _;
3044
+ (D != null && D.isMergedMainCell || D != null && D.isMerged) && hn.contains(D, O) && (O.startRow = D.startRow, O.endRow = D.startRow, O.startColumn = D.startColumn, O.endColumn = D.startColumn), O.unitId = $.unitId, O.sheetId = $.subUnitId;
3045
+ const U = n.current === Me.NEED_ADD, Y = ((I = T == null ? void 0 : T.getSelectionDataWithStyle()) != null ? I : []).map((re) => re.rangeWithCoord);
3046
+ U ? Y.push(O) : Y[Y.length - 1] = O, N(Y, !0);
3050
3047
  }
3051
3048
  }
3052
3049
  });
3053
3050
  return () => {
3054
- k.dispose();
3051
+ w.dispose();
3055
3052
  };
3056
3053
  }
3057
- }, [d, a, n, v, c, N, y]), P(() => {
3054
+ }, [u, a, n, S, c, N, T]), P(() => {
3058
3055
  if (!a)
3059
3056
  return;
3060
- const k = u.textSelection$.subscribe((I) => {
3061
- I.unitId === a.getEditorId() && Kr({
3057
+ const w = h.textSelection$.subscribe((k) => {
3058
+ k.unitId === a.getEditorId() && qr({
3062
3059
  unitId: o,
3063
3060
  subUnitId: r,
3064
3061
  refSelections: s.current,
3065
3062
  editor: a,
3066
- refSelectionsService: F,
3067
- refSelectionsRenderService: y,
3068
- sheetSkeletonManagerService: A,
3063
+ refSelectionsService: A,
3064
+ refSelectionsRenderService: T,
3065
+ sheetSkeletonManagerService: F,
3069
3066
  themeService: l,
3070
3067
  univerInstanceService: m,
3071
3068
  currentWorkbook: p
3072
3069
  });
3073
3070
  });
3074
- return () => k.unsubscribe();
3075
- }, [u.textSelection$, a, s, y, F, A, r, l, o, m]);
3076
- }, bc = (e, t, n, o, r, s) => {
3077
- const i = O(pe), c = O(ze), h = O(Te).getRenderById(t), f = O(te), m = h == null ? void 0 : h.with(Le);
3071
+ return () => w.unsubscribe();
3072
+ }, [h.textSelection$, a, s, T, A, F, r, l, o, m]);
3073
+ }, Rc = (e, t, n, o, r, s) => {
3074
+ const i = y(pe), c = y(ze), d = y(Te).getRenderById(t), f = y(ne), m = d == null ? void 0 : d.with(Le);
3078
3075
  P(() => {
3079
3076
  if (e && m)
3080
3077
  if (n) {
3081
- const d = () => {
3082
- const v = m.getSelectionControls().length;
3083
- for (let S = 1; S <= v; S++)
3078
+ const u = () => {
3079
+ const S = m.getSelectionControls().length;
3080
+ for (let v = 1; v <= S; v++)
3084
3081
  m.clearLastSelection();
3085
3082
  return setTimeout(() => {
3086
3083
  s();
3087
3084
  }, 30);
3088
- }, u = i.onCommandExecuted((v) => {
3089
- v.id === Zn.id && d();
3090
- }), l = f.getCurrentTypeOfUnit$(U.UNIVER_SHEET).subscribe((v) => {
3091
- d();
3085
+ }, h = i.onCommandExecuted((S) => {
3086
+ S.id === Zn.id && u();
3087
+ }), l = f.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe((S) => {
3088
+ u();
3092
3089
  });
3093
3090
  return () => {
3094
- u.dispose(), l.unsubscribe();
3091
+ h.dispose(), l.unsubscribe();
3095
3092
  };
3096
3093
  } else {
3097
- const d = i.beforeCommandExecuted((u) => {
3098
- if (u.id === Zn.id) {
3094
+ const u = i.beforeCommandExecuted((h) => {
3095
+ if (h.id === Zn.id) {
3099
3096
  o(!1), r(), s();
3100
3097
  const l = c.getEditor(fn);
3101
3098
  l == null || l.focus();
3102
3099
  }
3103
3100
  });
3104
3101
  return () => {
3105
- d.dispose();
3102
+ u.dispose();
3106
3103
  };
3107
3104
  }
3108
3105
  }, [e, m]);
3109
- }, yc = (e, t, n) => {
3110
- const o = O(ye), r = z(!0);
3106
+ }, Ic = (e, t, n) => {
3107
+ const o = y(ye), r = X(!0);
3111
3108
  P(() => {
3112
3109
  if (e) {
3113
3110
  const s = setTimeout(() => {
@@ -3120,27 +3117,27 @@ const Sc = (e, t, n, o) => {
3120
3117
  }, [e]), P(() => {
3121
3118
  if (!r.current && t) {
3122
3119
  const s = o.checkIfAddBracket(n);
3123
- t(s === 0 && n.startsWith(vr.EQUALS), `${n}`);
3120
+ t(s === 0 && n.startsWith(pr.EQUALS), `${n}`);
3124
3121
  }
3125
3122
  }, [n, t]);
3126
- }, Tc = (e, t = [], n) => {
3127
- const o = O(Zt), [r, s] = H([]), [i, c] = H(""), a = z(-1), h = rt({ nodes: t }), f = () => {
3123
+ }, Ec = (e, t = [], n) => {
3124
+ const o = y(Zt), [r, s] = H([]), [i, c] = H(""), a = X(-1), d = rt({ nodes: t }), f = () => {
3128
3125
  s([]), c(""), a.current = -1;
3129
3126
  };
3130
3127
  return P(() => {
3131
3128
  if (n && e) {
3132
- const d = n.input$.pipe(Sn(300)).subscribe(() => {
3133
- const u = n.getSelectionRanges();
3134
- if (u.length === 1) {
3135
- const l = h.current.nodes, v = u[0];
3136
- if (v.collapsed) {
3137
- const S = Tn(l, v.startOffset - 1, !1);
3138
- a.current = S;
3139
- const g = l[S];
3129
+ const u = n.input$.pipe(vn(300)).subscribe(() => {
3130
+ const h = n.getSelectionRanges();
3131
+ if (h.length === 1) {
3132
+ const l = d.current.nodes, S = h[0];
3133
+ if (S.collapsed) {
3134
+ const v = On(l, S.startOffset - 1, !1);
3135
+ a.current = v;
3136
+ const g = l[v];
3140
3137
  if (g && typeof g != "string" && g.nodeType === Q.FUNCTION) {
3141
- a.current = S;
3142
- const C = g.token, _ = o.getSearchListByNameFirstLetter(C);
3143
- s(_), c(C);
3138
+ a.current = v;
3139
+ const C = g.token, R = o.getSearchListByNameFirstLetter(C);
3140
+ s(R), c(C);
3144
3141
  return;
3145
3142
  }
3146
3143
  }
@@ -3148,7 +3145,7 @@ const Sc = (e, t, n, o) => {
3148
3145
  a.current = -1, c(""), s((l) => l != null && l.length ? [] : l);
3149
3146
  });
3150
3147
  return () => {
3151
- d.unsubscribe();
3148
+ u.unsubscribe();
3152
3149
  };
3153
3150
  }
3154
3151
  }, [n, e]), P(() => {
@@ -3156,98 +3153,98 @@ const Sc = (e, t, n, o) => {
3156
3153
  }, [e]), {
3157
3154
  searchList: r,
3158
3155
  searchText: i,
3159
- handlerFormulaReplace: (d, u) => {
3160
- const l = [...h.current.nodes];
3156
+ handlerFormulaReplace: (u, h) => {
3157
+ const l = [...d.current.nodes];
3161
3158
  if (a.current !== -1) {
3162
- const v = l.splice(a.current + 1), S = l.pop() || "";
3163
- let g = (typeof S == "string" ? S.length : S.token.length) - d.length;
3164
- return l.push(d), v[0] !== Ge.OPEN_BRACKET && u !== Sr.DefinedName && (l.push(Ge.OPEN_BRACKET), g--), { text: un([...l, ...v]), offset: g };
3159
+ const S = l.splice(a.current + 1), v = l.pop() || "";
3160
+ let g = (typeof v == "string" ? v.length : v.token.length) - u.length;
3161
+ return l.push(u), S[0] !== Ge.OPEN_BRACKET && h !== mr.DefinedName && (l.push(Ge.OPEN_BRACKET), g--), { text: un([...l, ...S]), offset: g };
3165
3162
  }
3166
3163
  },
3167
3164
  reset: f
3168
3165
  };
3169
- }, Oc = () => {
3170
- }, Nc = Ve(Mc);
3171
- function Mc(e, t) {
3172
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = Oc } = e, c = s.getEditorId(), a = O(zt), h = O(pe), { searchList: f, searchText: m, handlerFormulaReplace: d, reset: u } = Tc(n, o, s), l = le(() => !!f.length, [f]), v = z(void 0), [S, g] = H(0), C = z(!1), [_] = jr(c, l, [m, f]), E = rt({ searchList: f, active: S }), p = (N, M) => {
3173
- const k = d(N, M);
3174
- k && (u(), r(k));
3166
+ }, bc = () => {
3167
+ }, yc = Ve(Tc);
3168
+ function Tc(e, t) {
3169
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = bc } = e, c = s.getEditorId(), a = y(zt), d = y(pe), { searchList: f, searchText: m, handlerFormulaReplace: u, reset: h } = Ec(n, o, s), l = le(() => !!f.length, [f]), S = X(void 0), [v, g] = H(0), C = X(!1), [R] = Br(c, l, [m, f]), E = rt({ searchList: f, active: v }), p = (N, M) => {
3170
+ const w = u(N, M);
3171
+ w && (h(), r(w));
3175
3172
  };
3176
3173
  function b(N) {
3177
3174
  C.current && g(N);
3178
3175
  }
3179
- function y() {
3176
+ function T() {
3180
3177
  C.current && g(-1);
3181
3178
  }
3182
3179
  P(() => {
3183
3180
  if (!f.length)
3184
3181
  return;
3185
- const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), k = (I) => {
3186
- const { searchList: w, active: R } = E.current;
3187
- switch (I) {
3188
- case $.ARROW_UP: {
3189
- g((T) => {
3190
- const D = Math.max(0, T - 1);
3191
- return A(D), D;
3182
+ const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), w = (k) => {
3183
+ const { searchList: $, active: I } = E.current;
3184
+ switch (k) {
3185
+ case L.ARROW_UP: {
3186
+ g((_) => {
3187
+ const O = Math.max(0, _ - 1);
3188
+ return F(O), O;
3192
3189
  });
3193
3190
  break;
3194
3191
  }
3195
- case $.ARROW_DOWN: {
3196
- g((T) => {
3197
- const D = Math.min(w.length - 1, T + 1);
3198
- return A(D), D;
3192
+ case L.ARROW_DOWN: {
3193
+ g((_) => {
3194
+ const O = Math.min($.length - 1, _ + 1);
3195
+ return F(O), O;
3199
3196
  });
3200
3197
  break;
3201
3198
  }
3202
- case $.TAB:
3203
- case $.ENTER: {
3204
- const T = w[R];
3205
- p(T.name, T.functionType);
3199
+ case L.TAB:
3200
+ case L.ENTER: {
3201
+ const _ = $[I];
3202
+ p(_.name, _.functionType);
3206
3203
  break;
3207
3204
  }
3208
- case $.ESC: {
3209
- u(), i();
3205
+ case L.ESC: {
3206
+ h(), i();
3210
3207
  break;
3211
3208
  }
3212
3209
  }
3213
3210
  };
3214
- return M.add(h.registerCommand({
3211
+ return M.add(d.registerCommand({
3215
3212
  id: N,
3216
3213
  type: be.OPERATION,
3217
- handler(I, w) {
3218
- const { keyCode: R } = w;
3219
- k(R);
3214
+ handler(k, $) {
3215
+ const { keyCode: I } = $;
3216
+ w(I);
3220
3217
  }
3221
- })), [$.ARROW_UP, $.ARROW_DOWN, $.ENTER, $.ESC, $.TAB].map((I) => ({
3218
+ })), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((k) => ({
3222
3219
  id: N,
3223
- binding: I,
3220
+ binding: k,
3224
3221
  preconditions: () => !0,
3225
3222
  priority: 1e3,
3226
3223
  staticParameters: {
3227
3224
  eventType: xe.Keyboard,
3228
- keyCode: I
3225
+ keyCode: k
3229
3226
  }
3230
- })).forEach((I) => {
3231
- M.add(a.registerShortcut(I));
3227
+ })).forEach((k) => {
3228
+ M.add(a.registerShortcut(k));
3232
3229
  }), () => {
3233
3230
  M.dispose();
3234
3231
  };
3235
3232
  }, [f]);
3236
- function A(N) {
3237
- const M = v.current;
3233
+ function F(N) {
3234
+ const M = S.current;
3238
3235
  if (!M) return;
3239
- const k = M.children[N];
3240
- if (!k) return;
3241
- const w = M.getBoundingClientRect().top, R = M.offsetHeight, T = k.getBoundingClientRect(), D = T.top, L = T.height;
3242
- if (D >= 0 && D > w && D - w + L <= R)
3236
+ const w = M.children[N];
3237
+ if (!w) return;
3238
+ const $ = M.getBoundingClientRect().top, I = M.offsetHeight, _ = w.getBoundingClientRect(), O = _.top, D = _.height;
3239
+ if (O >= 0 && O > $ && O - $ + D <= I)
3243
3240
  return;
3244
- const W = k.offsetTop - (R - L) / 2;
3241
+ const U = w.offsetTop - (I - D) / 2;
3245
3242
  M.scrollTo({
3246
- top: W,
3243
+ top: U,
3247
3244
  behavior: "smooth"
3248
3245
  });
3249
3246
  }
3250
- const F = le(() => {
3247
+ const A = le(() => {
3251
3248
  let N = "";
3252
3249
  return () => {
3253
3250
  clearTimeout(N), C.current = !0, N = setTimeout(() => {
@@ -3255,23 +3252,23 @@ function Mc(e, t) {
3255
3252
  }, 300);
3256
3253
  };
3257
3254
  }, []);
3258
- return f.length > 0 && l && /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ x(
3255
+ return f.length > 0 && l && /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: R, direction: "vertical", children: /* @__PURE__ */ x(
3259
3256
  "ul",
3260
3257
  {
3261
3258
  ref: (N) => {
3262
- v.current = N, t && (t.current = N);
3259
+ S.current = N, t && (t.current = N);
3263
3260
  },
3264
3261
  "data-u-comp": "sheets-formula-editor",
3265
- className: se("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", In, ut),
3262
+ className: se("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", En, ut),
3266
3263
  children: f.map((N, M) => /* @__PURE__ */ B(
3267
3264
  "li",
3268
3265
  {
3269
3266
  className: se("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", {
3270
- "univer-bg-gray-200 dark:!univer-bg-gray-600": S === M
3267
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": v === M
3271
3268
  }),
3272
3269
  onMouseEnter: () => b(M),
3273
- onMouseLeave: y,
3274
- onMouseMove: F,
3270
+ onMouseLeave: T,
3271
+ onMouseMove: A,
3275
3272
  onClick: () => {
3276
3273
  p(N.name, N.functionType), s && s.focus();
3277
3274
  },
@@ -3294,9 +3291,9 @@ function Mc(e, t) {
3294
3291
  }
3295
3292
  ) });
3296
3293
  }
3297
- const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", or = () => {
3298
- }, wc = Ve((e, t) => {
3299
- var Mn, xn, wn, kn;
3294
+ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", rr = () => {
3295
+ }, Nc = Ve((e, t) => {
3296
+ var xn, wn, kn, An;
3300
3297
  const {
3301
3298
  errorText: n,
3302
3299
  initValue: o,
@@ -3304,74 +3301,74 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", or = () => {
3304
3301
  subUnitId: s,
3305
3302
  isFocus: i = !0,
3306
3303
  isSupportAcrossSheet: c = !1,
3307
- onFocus: a = or,
3308
- onBlur: h = or,
3304
+ onFocus: a = rr,
3305
+ onBlur: d = rr,
3309
3306
  onChange: f,
3310
3307
  onVerify: m,
3311
- className: d,
3312
- editorId: u,
3308
+ className: u,
3309
+ editorId: h,
3313
3310
  moveCursor: l = !0,
3314
- onFormulaSelectingChange: v,
3315
- keyboardEventConfig: S,
3311
+ onFormulaSelectingChange: S,
3312
+ keyboardEventConfig: v,
3316
3313
  onMoveInEditor: g,
3317
3314
  resetSelectionOnBlur: C = !0,
3318
- autoScrollbar: _ = !0,
3315
+ autoScrollbar: R = !0,
3319
3316
  isSingle: E = !0,
3320
3317
  disableSelectionOnClick: p = !1,
3321
3318
  autofocus: b = !0,
3322
- disableContextMenu: y,
3323
- style: A
3324
- } = e, F = O(ze), N = z(null), M = ee(f);
3325
- Ms(t, () => ({
3326
- isClickOutSide: (Z) => N.current ? !N.current.contains(Z.target) : !1
3319
+ disableContextMenu: T,
3320
+ style: F
3321
+ } = e, A = y(ze), N = X(null), M = ee(f);
3322
+ Os(t, () => ({
3323
+ isClickOutSide: (z) => N.current ? !N.current.contains(z.target) : !1
3327
3324
  }));
3328
- const k = ee(v), I = z(null), w = z(void 0), R = w.current, [T, D] = H(i), L = z(null), W = le(() => u != null ? u : ho(`${Do}-${Yt(4)}`), []), X = le(() => n !== void 0, [n]), re = O(te), he = re.getUnit(W);
3325
+ const w = ee(S), k = X(null), $ = X(void 0), I = $.current, [_, O] = H(i), D = X(null), U = le(() => h != null ? h : ao(`${Fo}-${Yt(4)}`), []), Y = le(() => n !== void 0, [n]), re = y(ne), he = re.getUnit(U);
3329
3326
  _e(he == null ? void 0 : he.change$);
3330
- const Y = hc(), J = fo.transform.getPlainText((xn = (Mn = he == null ? void 0 : he.getBody()) == null ? void 0 : Mn.dataStream) != null ? xn : ""), ot = rt(J), st = le(() => xc(J), [J]), Ot = le(() => Y(st), [st, Y]), { isSelecting: Oe, isSelectingRef: Nt } = dc({ unitId: r, subUnitId: s, editorId: W, isFocus: T, disableOnClick: p }), K = z(""), fe = O(Te).getRenderById(W), oe = fe == null ? void 0 : fe.with(Ir), ae = oe == null ? void 0 : oe.isFocusing, ge = le(() => re.getCurrentTypeOfUnit$(U.UNIVER_DOC), [re]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === W, He = z([]), G = Oe, we = (kn = (wn = O(ar).getConfig(kr)) == null ? void 0 : wn.functionScreenTips) != null ? kn : !0;
3331
- Ts(() => {
3327
+ const G = ac(), J = uo.transform.getPlainText((wn = (xn = he == null ? void 0 : he.getBody()) == null ? void 0 : xn.dataStream) != null ? wn : ""), ot = rt(J), st = le(() => Oc(J), [J]), Ot = le(() => G(st), [st, G]), { isSelecting: Oe, isSelectingRef: Nt } = lc({ unitId: r, subUnitId: s, editorId: U, isFocus: _, disableOnClick: p }), K = X(""), fe = y(Te).getRenderById(U), oe = fe == null ? void 0 : fe.with(_r), ae = oe == null ? void 0 : oe.isFocusing, ge = le(() => re.getCurrentTypeOfUnit$(W.UNIVER_DOC), [re]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === U, He = X([]), Z = Oe, we = (An = (kn = y(pn).getConfig(xr)) == null ? void 0 : kn.functionScreenTips) != null ? An : !0;
3328
+ bs(() => {
3332
3329
  M(J);
3333
3330
  }, [J, M]);
3334
- const it = Yr("="), Be = gc(r, s), me = ee((Z, ce = !0, ke, Ne) => {
3335
- if (!w.current) return;
3336
- K.current = Z;
3337
- const xt = Z[0] === "=" ? Z.slice(1) : "", Ae = Y(xt), zr = Ae.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), wt = it(
3338
- w.current,
3339
- zr === xt ? Ae : [],
3331
+ const it = jr("="), Be = dc(r, s), me = ee((z, ce = !0, ke, Ne) => {
3332
+ if (!$.current) return;
3333
+ K.current = z;
3334
+ const xt = z[0] === "=" ? z.slice(1) : "", Ae = G(xt), Gr = Ae.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), wt = it(
3335
+ $.current,
3336
+ Gr === xt ? Ae : [],
3340
3337
  ce,
3341
3338
  Ne
3342
3339
  );
3343
3340
  if (He.current = wt, ke) {
3344
- const qe = Ne != null ? Ne : R == null ? void 0 : R.getSelectionRanges();
3341
+ const qe = Ne != null ? Ne : I == null ? void 0 : I.getSelectionRanges();
3345
3342
  if ((qe == null ? void 0 : qe.length) !== 1)
3346
3343
  return;
3347
- const Xr = qe[0].startOffset - 1, Qr = Tn(Ae, Xr, !1), An = qr(Ae, Qr);
3348
- if (An >= 0) {
3349
- const Fn = wt.splice(An, 1)[0];
3350
- Fn && wt.push(Fn);
3344
+ const Zr = qe[0].startOffset - 1, zr = On(Ae, Zr, !1), Fn = Hr(Ae, zr);
3345
+ if (Fn >= 0) {
3346
+ const Dn = wt.splice(Fn, 1)[0];
3347
+ Dn && wt.push(Dn);
3351
3348
  }
3352
- Be(T ? wt : [], w.current);
3349
+ Be(_ ? wt : [], $.current);
3353
3350
  }
3354
3351
  });
3355
3352
  P(() => {
3356
- T && me(J, !1, !0);
3357
- }, [T]), P(() => {
3358
- if (T) {
3353
+ _ && me(J, !1, !0);
3354
+ }, [_]), P(() => {
3355
+ if (_) {
3359
3356
  if (K.current === J) return;
3360
3357
  me(J, !1, !0);
3361
3358
  }
3362
- }, [J]), yc(T, m, J);
3363
- const ie = ac(R), gt = Cc(T, r, s);
3359
+ }, [J]), Ic(_, m, J);
3360
+ const ie = ic(I), gt = pc(_, r, s);
3364
3361
  P(() => {
3365
- var Z;
3366
- k(Oe, (Z = oe == null ? void 0 : oe.isFocusing) != null ? Z : !0);
3367
- }, [k, Oe]), ns(T, S, R), Pt(() => {
3368
- let Z;
3369
- if (L.current) {
3370
- Z = F.register({
3362
+ var z;
3363
+ w(Oe, (z = oe == null ? void 0 : oe.isFocusing) != null ? z : !0);
3364
+ }, [w, Oe]), Jo(_, v, I), Pt(() => {
3365
+ let z;
3366
+ if (D.current) {
3367
+ z = A.register({
3371
3368
  autofocus: b,
3372
- editorUnitId: W,
3369
+ editorUnitId: U,
3373
3370
  initialSnapshot: {
3374
- id: W,
3371
+ id: U,
3375
3372
  body: {
3376
3373
  dataStream: `${o}\r
3377
3374
  `,
@@ -3382,176 +3379,176 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", or = () => {
3382
3379
  },
3383
3380
  documentStyle: {}
3384
3381
  }
3385
- }, L.current);
3386
- const ce = F.getEditor(W);
3387
- w.current = ce, me(o, !1, !0);
3382
+ }, D.current);
3383
+ const ce = A.getEditor(U);
3384
+ $.current = ce, me(o, !1, !0);
3388
3385
  }
3389
3386
  return () => {
3390
- Z == null || Z.dispose();
3387
+ z == null || z.dispose();
3391
3388
  };
3392
3389
  }, []), Pt(() => {
3393
- i ? (D(i), ie()) : (C && (R == null || R.blur(), gt()), D(i));
3394
- }, [i, R, ie, gt, C]);
3395
- const { checkScrollBar: Jt } = rs(R, E, _);
3396
- vc(T, !!(Oe && We), r, W, y), Sc(!!(T && ae && l), G, R, g);
3397
- const Mt = ee((Z, ce, ke) => {
3390
+ i ? (O(i), ie()) : (C && (I == null || I.blur(), gt()), O(i));
3391
+ }, [i, I, ie, gt, C]);
3392
+ const { checkScrollBar: Jt } = es(I, E, R);
3393
+ mc(_, !!(Oe && We), r, U, T), gc(!!(_ && ae && l), Z, I, g);
3394
+ const Mt = ee((z, ce, ke) => {
3398
3395
  if (!ae)
3399
3396
  return;
3400
3397
  const Ne = ce !== -1 ? [{ startOffset: ce + 1, endOffset: ce + 1, collapsed: !0 }] : void 0;
3401
- me(`=${Z}`, !0, ke, Ne), ke && (ie(), ce !== -1 && setTimeout(() => {
3402
- const xt = { startOffset: ce + 1, endOffset: ce + 1 }, Ae = R == null ? void 0 : R.render.with(os);
3398
+ me(`=${z}`, !0, ke, Ne), ke && (ie(), ce !== -1 && setTimeout(() => {
3399
+ const xt = { startOffset: ce + 1, endOffset: ce + 1 }, Ae = I == null ? void 0 : I.render.with(ts);
3403
3400
  Ae == null || Ae.scrollToRange({ ...xt, collapsed: !0 });
3404
3401
  }, 50), Jt());
3405
3402
  });
3406
- Ec(
3407
- T && !!(Oe && We),
3408
- T,
3403
+ _c(
3404
+ _ && !!(Oe && We),
3405
+ _,
3409
3406
  Nt,
3410
3407
  r,
3411
3408
  s,
3412
3409
  He,
3413
3410
  c,
3414
- !!G,
3415
- R,
3411
+ !!Z,
3412
+ I,
3416
3413
  Mt
3417
- ), bc(T && !!(Oe && We), r, c, D, h, () => {
3414
+ ), Rc(_ && !!(Oe && We), r, c, O, d, () => {
3418
3415
  me(ot.current, !1, !0);
3419
3416
  });
3420
- const On = (Z) => {
3421
- if (Z) {
3422
- const ce = R == null ? void 0 : R.getSelectionRanges();
3417
+ const Nn = (z) => {
3418
+ if (z) {
3419
+ const ce = I == null ? void 0 : I.getSelectionRanges();
3423
3420
  if (ce && ce.length === 1) {
3424
3421
  const ke = ce[0];
3425
3422
  if (ke.collapsed) {
3426
- const Ne = Z.offset;
3423
+ const Ne = z.offset;
3427
3424
  setTimeout(() => {
3428
- R == null || R.setSelectionRanges([{ startOffset: ke.startOffset - Ne, endOffset: ke.endOffset - Ne }]);
3425
+ I == null || I.setSelectionRanges([{ startOffset: ke.startOffset - Ne, endOffset: ke.endOffset - Ne }]);
3429
3426
  }, 30);
3430
3427
  }
3431
3428
  }
3432
- ie(), me(`=${Z.text}`);
3429
+ ie(), me(`=${z.text}`);
3433
3430
  }
3434
- }, Nn = () => {
3435
- D(!0), a(), ie();
3431
+ }, Mn = () => {
3432
+ O(!0), a(), ie();
3436
3433
  };
3437
- return /* @__PURE__ */ B("div", { className: d, children: [
3434
+ return /* @__PURE__ */ B("div", { className: u, children: [
3438
3435
  /* @__PURE__ */ x(
3439
3436
  "div",
3440
3437
  {
3441
3438
  ref: N,
3442
3439
  className: se("univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
3443
- "univer-ring-primary-500": T,
3444
- "univer-ring-red-500": X
3440
+ "univer-ring-primary-500": _,
3441
+ "univer-ring-red-500": Y
3445
3442
  }),
3446
3443
  children: /* @__PURE__ */ x(
3447
3444
  "div",
3448
3445
  {
3449
- ref: L,
3446
+ ref: D,
3450
3447
  className: "univer-relative univer-h-full univer-w-full",
3451
- onMouseUp: Nn
3448
+ onMouseUp: Mn
3452
3449
  }
3453
3450
  )
3454
3451
  }
3455
3452
  ),
3456
3453
  n !== void 0 && /* @__PURE__ */ x("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }),
3457
- we && R && st !== "" && /* @__PURE__ */ x(
3458
- lc,
3454
+ we && I && st !== "" && /* @__PURE__ */ x(
3455
+ sc,
3459
3456
  {
3460
- editor: R,
3461
- isFocus: T,
3457
+ editor: I,
3458
+ isFocus: _,
3462
3459
  formulaText: J,
3463
3460
  onClose: () => ie()
3464
3461
  }
3465
3462
  ),
3466
- we && !!R && /* @__PURE__ */ x(
3467
- Nc,
3463
+ we && !!I && /* @__PURE__ */ x(
3464
+ yc,
3468
3465
  {
3469
- isFocus: T,
3466
+ isFocus: _,
3470
3467
  sequenceNodes: Ot,
3471
- onSelect: On,
3472
- ref: I,
3473
- editor: R
3468
+ onSelect: Nn,
3469
+ ref: k,
3470
+ editor: I
3474
3471
  }
3475
3472
  )
3476
3473
  ] });
3477
3474
  });
3478
- function kc(e, t, n, o) {
3479
- const r = O(ye), s = Yr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), h = O(Lo), f = z(""), m = O(te);
3475
+ function Mc(e, t, n, o) {
3476
+ const r = y(ye), s = jr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), d = y(Do), f = X(""), m = y(ne);
3480
3477
  return P(() => {
3481
3478
  if (!e) return;
3482
- const d = e.getDocumentDataModel().getPlainText();
3483
- if (f.current === d)
3479
+ const u = e.getDocumentDataModel().getPlainText();
3480
+ if (f.current === u)
3484
3481
  return;
3485
- f.current = d;
3486
- const u = r.sequenceNodesBuilder(d);
3487
- a(u != null ? u : []);
3482
+ f.current = u;
3483
+ const h = r.sequenceNodesBuilder(u);
3484
+ a(h != null ? h : []);
3488
3485
  }, [i, e, r]), P(() => {
3489
- var l, v;
3486
+ var l, S;
3490
3487
  if (!e) return;
3491
3488
  if (!t) {
3492
- const S = e.getDocumentData();
3489
+ const v = e.getDocumentData();
3493
3490
  e.setDocumentData({
3494
- ...S,
3491
+ ...v,
3495
3492
  body: {
3496
- ...S.body,
3497
- dataStream: (v = (l = S.body) == null ? void 0 : l.dataStream) != null ? v : "",
3493
+ ...v.body,
3494
+ dataStream: (S = (l = v.body) == null ? void 0 : l.dataStream) != null ? S : "",
3498
3495
  textRuns: []
3499
3496
  }
3500
3497
  });
3501
3498
  return;
3502
3499
  }
3503
- const d = s(e, c, !1), u = new Ye();
3504
- return d.forEach((S) => {
3505
- const g = ht(S.token), C = m.getCurrentUnitForType(U.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3506
- if (!g.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || g.sheetName && (_ == null ? void 0 : _.getName()) !== g.sheetName)
3500
+ const u = s(e, c, !1), h = new Ye();
3501
+ return u.forEach((v) => {
3502
+ const g = ht(v.token), C = m.getCurrentUnitForType(W.UNIVER_SHEET), R = C == null ? void 0 : C.getActiveSheet();
3503
+ if (!g.sheetName && o !== (R == null ? void 0 : R.getSheetId()) || g.sheetName && (R == null ? void 0 : R.getName()) !== g.sheetName)
3507
3504
  return;
3508
- const E = new mn(S.themeColor).toRgb(), p = h.addShape({
3505
+ const E = new mn(v.themeColor).toRgb(), p = d.addShape({
3509
3506
  range: g.range,
3510
3507
  style: {
3511
- stroke: S.themeColor,
3508
+ stroke: v.themeColor,
3512
3509
  fill: `rgba(${E.r}, ${E.g}, ${E.b}, 0.1)`,
3513
3510
  strokeDash: 12
3514
3511
  },
3515
3512
  primary: null
3516
3513
  });
3517
- p && u.add(() => h.removeShape(p));
3514
+ p && h.add(() => d.removeShape(p));
3518
3515
  }), () => {
3519
- u.dispose();
3516
+ h.dispose();
3520
3517
  };
3521
- }, [e, t, s, h, c]), { sequenceNodes: c };
3522
- }
3523
- function Ac(e) {
3524
- const t = O(vn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = O(te).getUnit(r, U.UNIVER_SHEET), h = ee(i), f = ee((m, d) => {
3525
- const u = a == null ? void 0 : a.getActiveSheet();
3526
- if (!u || !n && u.getSheetId() !== s || !(m != null && m.length)) return;
3527
- const l = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), v = m.map((S) => ({
3528
- range: S.range,
3518
+ }, [e, t, s, d, c]), { sequenceNodes: c };
3519
+ }
3520
+ function xc(e) {
3521
+ const t = y(Cn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = y(ne).getUnit(r, W.UNIVER_SHEET), d = ee(i), f = ee((m, u) => {
3522
+ const h = a == null ? void 0 : a.getActiveSheet();
3523
+ if (!h || !n && h.getSheetId() !== s || !(m != null && m.length)) return;
3524
+ const l = o ? h.getName() : h.getSheetId() === s ? "" : h.getName(), S = m.map((v) => ({
3525
+ range: v.range,
3529
3526
  unitId: r,
3530
3527
  sheetName: l
3531
3528
  }));
3532
- h(v, d);
3529
+ d(S, u);
3533
3530
  });
3534
3531
  P(() => {
3535
3532
  const m = new Ye();
3536
- return m.add(t.selectionMoveStart$.subscribe((d) => {
3537
- f(d, !0);
3538
- })), m.add(t.selectionMoving$.subscribe((d) => {
3539
- f(d, !1);
3540
- })), m.add(t.selectionMoveEnd$.subscribe((d) => {
3541
- f(d, !1);
3533
+ return m.add(t.selectionMoveStart$.subscribe((u) => {
3534
+ f(u, !0);
3535
+ })), m.add(t.selectionMoving$.subscribe((u) => {
3536
+ f(u, !1);
3537
+ })), m.add(t.selectionMoveEnd$.subscribe((u) => {
3538
+ f(u, !1);
3542
3539
  })), () => {
3543
3540
  m.dispose();
3544
3541
  };
3545
3542
  }, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3546
3543
  }
3547
- const sr = (e) => !e.some((n) => {
3544
+ const or = (e) => !e.some((n) => {
3548
3545
  if (typeof n == "string") {
3549
3546
  if (n !== Ge.COMMA)
3550
3547
  return !0;
3551
3548
  } else if (n.nodeType !== Q.REFERENCE)
3552
3549
  return !0;
3553
3550
  return !1;
3554
- }), Fc = (e) => {
3551
+ }), wc = (e) => {
3555
3552
  if (e.endColumn < e.startColumn) {
3556
3553
  const t = e.endColumn;
3557
3554
  e.endColumn = e.startColumn, e.startColumn = t;
@@ -3562,7 +3559,7 @@ const sr = (e) => !e.some((n) => {
3562
3559
  }
3563
3560
  return e;
3564
3561
  };
3565
- function Dc(e) {
3562
+ function kc(e) {
3566
3563
  const {
3567
3564
  visible: t,
3568
3565
  initialValue: n,
@@ -3572,25 +3569,25 @@ function Dc(e) {
3572
3569
  supportAcrossSheet: i,
3573
3570
  keepSheetReference: c,
3574
3571
  onConfirm: a,
3575
- onClose: h,
3572
+ onClose: d,
3576
3573
  onShowBySelection: f
3577
- } = e, m = O(dt), d = O(ye), [u, l] = H([]), [v, S] = H(0), g = z(null);
3574
+ } = e, m = y(dt), u = y(ye), [h, l] = H([]), [S, v] = H(0), g = X(null);
3578
3575
  P(() => {
3579
3576
  if (t && n.length) {
3580
3577
  const p = n.map((b) => b.sheetName ? _t(b.sheetName, b.range) : Ee(b.range));
3581
- l(p), S(p.length - 1);
3578
+ l(p), v(p.length - 1);
3582
3579
  } else
3583
- l([""]), S(0);
3580
+ l([""]), v(0);
3584
3581
  }, [t]);
3585
3582
  const C = (p, b) => {
3586
- const y = [...u];
3587
- y[p] = b, l(y);
3588
- }, _ = () => {
3589
- l([...u, ""]), S(u.length);
3583
+ const T = [...h];
3584
+ T[p] = b, l(T);
3585
+ }, R = () => {
3586
+ l([...h, ""]), v(h.length);
3590
3587
  }, E = (p) => {
3591
- u.splice(p, 1), l([...u]);
3588
+ h.splice(p, 1), l([...h]);
3592
3589
  };
3593
- return Ac({
3590
+ return xc({
3594
3591
  unitId: o,
3595
3592
  subUnitId: r,
3596
3593
  supportAcrossSheet: i,
@@ -3598,24 +3595,24 @@ function Dc(e) {
3598
3595
  onChange: (p, b) => {
3599
3596
  if (!t && f != null && f(p))
3600
3597
  return;
3601
- const y = new Set(u), A = p.map((M) => M.sheetName ? _t(M.sheetName, M.range) : Ee(M.range)), F = A.filter((M) => !y.has(M));
3602
- if (!F.length) return;
3603
- const N = [...u];
3604
- if (A.length > 1) {
3605
- b || N.splice(v, 1), N.push(...F);
3598
+ const T = new Set(h), F = p.map((M) => M.sheetName ? _t(M.sheetName, M.range) : Ee(M.range)), A = F.filter((M) => !T.has(M));
3599
+ if (!A.length) return;
3600
+ const N = [...h];
3601
+ if (F.length > 1) {
3602
+ b || N.splice(S, 1), N.push(...A);
3606
3603
  const M = N.slice(0, s);
3607
- l(M), S(M.length - 1), requestAnimationFrame(() => {
3608
- var k;
3609
- (k = g.current) == null || k.scrollTo({ top: g.current.scrollHeight });
3604
+ l(M), v(M.length - 1), requestAnimationFrame(() => {
3605
+ var w;
3606
+ (w = g.current) == null || w.scrollTo({ top: g.current.scrollHeight });
3610
3607
  });
3611
3608
  } else {
3612
- N.splice(v, 1, ...F);
3609
+ N.splice(S, 1, ...A);
3613
3610
  const M = N.slice(0, s);
3614
- l(M), S(v + F.length - 1);
3611
+ l(M), v(S + A.length - 1);
3615
3612
  }
3616
3613
  }
3617
3614
  }), /* @__PURE__ */ x(
3618
- Fs,
3615
+ ks,
3619
3616
  {
3620
3617
  width: "328px",
3621
3618
  open: t,
@@ -3624,49 +3621,49 @@ function Dc(e) {
3624
3621
  mask: !1,
3625
3622
  maskClosable: !1,
3626
3623
  footer: /* @__PURE__ */ B("footer", { className: "univer-flex univer-gap-2", children: [
3627
- /* @__PURE__ */ x(at, { onClick: h, children: m.t("rangeSelector.cancel") }),
3624
+ /* @__PURE__ */ x(at, { onClick: d, children: m.t("rangeSelector.cancel") }),
3628
3625
  /* @__PURE__ */ x(
3629
3626
  at,
3630
3627
  {
3631
3628
  variant: "primary",
3632
3629
  onClick: () => {
3633
3630
  a(
3634
- u.filter((p) => {
3635
- const b = d.sequenceNodesBuilder(p);
3631
+ h.filter((p) => {
3632
+ const b = u.sequenceNodesBuilder(p);
3636
3633
  return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === Q.REFERENCE;
3637
- }).map((p) => ht(p)).map((p) => ({ ...p, range: Fc(p.range) }))
3634
+ }).map((p) => ht(p)).map((p) => ({ ...p, range: wc(p.range) }))
3638
3635
  );
3639
3636
  },
3640
3637
  children: m.t("rangeSelector.confirm")
3641
3638
  }
3642
3639
  )
3643
3640
  ] }),
3644
- onClose: h,
3641
+ onClose: d,
3645
3642
  children: /* @__PURE__ */ B(
3646
3643
  "div",
3647
3644
  {
3648
3645
  ref: g,
3649
3646
  className: se("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3650
3647
  children: [
3651
- u.map((p, b) => /* @__PURE__ */ B(
3648
+ h.map((p, b) => /* @__PURE__ */ B(
3652
3649
  "div",
3653
3650
  {
3654
3651
  className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
3655
3652
  children: [
3656
3653
  /* @__PURE__ */ x(
3657
- Or,
3654
+ yr,
3658
3655
  {
3659
3656
  className: se("univer-w-full", {
3660
- "univer-border-primary-600": v === b
3657
+ "univer-border-primary-600": S === b
3661
3658
  }),
3662
3659
  placeholder: m.t("rangeSelector.placeHolder"),
3663
- onFocus: () => S(b),
3660
+ onFocus: () => v(b),
3664
3661
  value: p,
3665
- onChange: (y) => C(b, y)
3662
+ onChange: (T) => C(b, T)
3666
3663
  }
3667
3664
  ),
3668
- u.length > 1 && /* @__PURE__ */ x(
3669
- Ur,
3665
+ h.length > 1 && /* @__PURE__ */ x(
3666
+ $r,
3670
3667
  {
3671
3668
  className: "univer-cursor-pointer",
3672
3669
  onClick: () => E(b)
@@ -3676,8 +3673,8 @@ function Dc(e) {
3676
3673
  },
3677
3674
  b
3678
3675
  )),
3679
- u.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ B(at, { variant: "link", onClick: _, children: [
3680
- /* @__PURE__ */ x(Vr, {}),
3676
+ h.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ B(at, { variant: "link", onClick: R, children: [
3677
+ /* @__PURE__ */ x(Pr, {}),
3681
3678
  /* @__PURE__ */ x("span", { children: m.t("rangeSelector.addAnotherRange") })
3682
3679
  ] }) })
3683
3680
  ]
@@ -3686,13 +3683,13 @@ function Dc(e) {
3686
3683
  }
3687
3684
  );
3688
3685
  }
3689
- function Lc(e) {
3686
+ function Ac(e) {
3690
3687
  return e.split(Ge.COMMA).filter((t) => !!t).map((t) => ht(t));
3691
3688
  }
3692
- function $c(e) {
3689
+ function Fc(e) {
3693
3690
  return e.map((t) => t.sheetName ? _t(t.sheetName, t.range) : Ee(t.range)).join(Ge.COMMA);
3694
3691
  }
3695
- function Gr(e) {
3692
+ function Kr(e) {
3696
3693
  const [t, n] = H(null), {
3697
3694
  onVerify: o,
3698
3695
  selectorRef: r,
@@ -3700,20 +3697,20 @@ function Gr(e) {
3700
3697
  subUnitId: i,
3701
3698
  maxRangeCount: c,
3702
3699
  supportAcrossSheet: a,
3703
- keepSheetReference: h,
3700
+ keepSheetReference: d,
3704
3701
  autoFocus: f,
3705
3702
  onChange: m,
3706
- onRangeSelectorDialogVisibleChange: d,
3707
- onClickOutside: u,
3703
+ onRangeSelectorDialogVisibleChange: u,
3704
+ onClickOutside: h,
3708
3705
  onFocusChange: l,
3709
- forceShowDialogWhenSelectionChanged: v,
3710
- hideEditor: S,
3706
+ forceShowDialogWhenSelectionChanged: S,
3707
+ hideEditor: v,
3711
3708
  resetRange: g
3712
- } = e, [C, _] = H(f != null ? f : !1), [E, p] = H(!1), [b, y] = H([]), A = O(dt), F = O(ze), { sequenceNodes: N } = kc(t, C, s, i), M = rt(N), k = O(pe), I = ee(() => {
3713
- t == null || t.setSelectionRanges([]), t == null || t.blur(), F.blur();
3714
- }), w = ee(() => {
3715
- var R;
3716
- I(), y(Lc((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), p(!0);
3709
+ } = e, [C, R] = H(f != null ? f : !1), [E, p] = H(!1), [b, T] = H([]), F = y(dt), A = y(ze), { sequenceNodes: N } = Mc(t, C, s, i), M = rt(N), w = y(pe), k = ee(() => {
3710
+ t == null || t.setSelectionRanges([]), t == null || t.blur(), A.blur();
3711
+ }), $ = ee(() => {
3712
+ var I;
3713
+ k(), T(Ac((I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "")), p(!0);
3717
3714
  });
3718
3715
  return P(() => {
3719
3716
  r && (r.current = {
@@ -3721,85 +3718,85 @@ function Gr(e) {
3721
3718
  return t;
3722
3719
  },
3723
3720
  focus() {
3724
- F.focus(t.getEditorId());
3721
+ A.focus(t.getEditorId());
3725
3722
  },
3726
- blur: I,
3727
- verify: () => sr(M.current),
3728
- showDialog: (R) => {
3729
- I(), y(R), p(!0);
3723
+ blur: k,
3724
+ verify: () => or(M.current),
3725
+ showDialog: (I) => {
3726
+ k(), T(I), p(!0);
3730
3727
  },
3731
3728
  hideDialog: () => {
3732
- y([]), p(!1);
3729
+ T([]), p(!1);
3733
3730
  },
3734
3731
  getValue: () => {
3735
- var R;
3736
- return (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "";
3732
+ var I;
3733
+ return (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "";
3737
3734
  }
3738
3735
  });
3739
- }, [I, t, F, r, M]), P(() => {
3740
- var R;
3741
- o == null || o(sr(N), (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "");
3736
+ }, [k, t, A, r, M]), P(() => {
3737
+ var I;
3738
+ o == null || o(or(N), (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "");
3742
3739
  }, [N]), P(() => {
3743
- d == null || d(E);
3740
+ u == null || u(E);
3744
3741
  }, [E]), P(() => {
3745
3742
  if (E && g)
3746
3743
  return () => {
3747
- const R = {
3744
+ const I = {
3748
3745
  unitId: s,
3749
3746
  subUnitId: i,
3750
3747
  selections: g
3751
3748
  };
3752
- k.executeCommand(Cn.id, R);
3749
+ w.executeCommand(_n.id, I);
3753
3750
  };
3754
- }, [E]), /* @__PURE__ */ B(Ns, { children: [
3755
- S ? null : /* @__PURE__ */ x(
3756
- ss,
3751
+ }, [E]), /* @__PURE__ */ B(Ts, { children: [
3752
+ v ? null : /* @__PURE__ */ x(
3753
+ ns,
3757
3754
  {
3758
3755
  isSingle: !0,
3759
3756
  ...e,
3760
- onFocusChange: (R, T) => {
3761
- _(R), l == null || l(R, T);
3757
+ onFocusChange: (I, _) => {
3758
+ R(I), l == null || l(I, _);
3762
3759
  },
3763
3760
  editorRef: n,
3764
3761
  onClickOutside: () => {
3765
- _(!1), I(), u == null || u();
3762
+ R(!1), k(), h == null || h();
3766
3763
  },
3767
- icon: /* @__PURE__ */ x(As, { title: A.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
3768
- Hr,
3764
+ icon: /* @__PURE__ */ x(ws, { title: F.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
3765
+ Vr,
3769
3766
  {
3770
3767
  className: "univer-cursor-pointer dark:!univer-text-gray-300",
3771
- onClick: w
3768
+ onClick: $
3772
3769
  }
3773
3770
  ) })
3774
3771
  }
3775
3772
  ),
3776
3773
  /* @__PURE__ */ x(
3777
- Dc,
3774
+ kc,
3778
3775
  {
3779
3776
  initialValue: b,
3780
3777
  unitId: s,
3781
3778
  subUnitId: i,
3782
3779
  visible: E,
3783
3780
  maxRangeCount: c,
3784
- onConfirm: (R) => {
3785
- const T = $c(R), D = go.newEmptyData();
3786
- D.body.dataStream = T, t == null || t.replaceText(T, !1), m == null || m(D, T), p(!1), y([]), requestAnimationFrame(() => {
3787
- I();
3781
+ onConfirm: (I) => {
3782
+ const _ = Fc(I), O = ho.newEmptyData();
3783
+ O.body.dataStream = _, t == null || t.replaceText(_, !1), m == null || m(O, _), p(!1), T([]), requestAnimationFrame(() => {
3784
+ k();
3788
3785
  });
3789
3786
  },
3790
3787
  onClose: () => {
3791
- p(!1), y([]);
3788
+ p(!1), T([]);
3792
3789
  },
3793
3790
  supportAcrossSheet: a,
3794
- keepSheetReference: h,
3795
- onShowBySelection: (R) => C || v ? (y(R), p(!0), !1) : !0
3791
+ keepSheetReference: d,
3792
+ onShowBySelection: (I) => C || S ? (T(I), p(!0), !1) : !0
3796
3793
  }
3797
3794
  )
3798
3795
  ] });
3799
3796
  }
3800
- const Pc = () => {
3797
+ const Dc = () => {
3801
3798
  var o, r;
3802
- const e = O(Br), t = _e(e.currentSelector$), n = z(null);
3799
+ const e = y(Wr), t = _e(e.currentSelector$), n = X(null);
3803
3800
  return P(() => {
3804
3801
  var s, i;
3805
3802
  if (t)
@@ -3808,7 +3805,7 @@ const Pc = () => {
3808
3805
  (c = n.current) == null || c.hideDialog();
3809
3806
  };
3810
3807
  }, [t]), /* @__PURE__ */ x(
3811
- Gr,
3808
+ Kr,
3812
3809
  {
3813
3810
  unitId: (o = t == null ? void 0 : t.unitId) != null ? o : "",
3814
3811
  subUnitId: (r = t == null ? void 0 : t.subUnitId) != null ? r : "",
@@ -3821,24 +3818,24 @@ const Pc = () => {
3821
3818
  }
3822
3819
  );
3823
3820
  };
3824
- var Uc = Object.defineProperty, Vc = Object.getOwnPropertyDescriptor, Wc = (e, t, n) => t in e ? Uc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Hc = (e, t, n, o) => {
3825
- for (var r = o > 1 ? void 0 : o ? Vc(t, n) : t, s = e.length - 1, i; s >= 0; s--)
3821
+ var Lc = Object.defineProperty, $c = Object.getOwnPropertyDescriptor, Pc = (e, t, n) => t in e ? Lc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Uc = (e, t, n, o) => {
3822
+ for (var r = o > 1 ? void 0 : o ? $c(t, n) : t, s = e.length - 1, i; s >= 0; s--)
3826
3823
  (i = e[s]) && (r = i(r) || r);
3827
3824
  return r;
3828
- }, Dt = (e, t) => (n, o) => t(n, o, e), Zr = (e, t, n) => Wc(e, typeof t != "symbol" ? t + "" : t, n);
3829
- let Kt = class extends po {
3830
- constructor(e = er, t, n, o, r) {
3825
+ }, Dt = (e, t) => (n, o) => t(n, o, e), Yr = (e, t, n) => Pc(e, typeof t != "symbol" ? t + "" : t, n);
3826
+ let Kt = class extends go {
3827
+ constructor(e = Jn, t, n, o, r) {
3831
3828
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3832
- const { menu: s, ...i } = So(
3833
- er,
3829
+ const { menu: s, ...i } = mo(
3830
+ Jn,
3834
3831
  this._config
3835
3832
  );
3836
- s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(kr, i, { merge: !0 });
3833
+ s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(xr, i, { merge: !0 });
3837
3834
  }
3838
3835
  onStarting() {
3839
- vo(this._injector, [
3836
+ po(this._injector, [
3840
3837
  [Xt, { useClass: ln }],
3841
- [Br],
3838
+ [Wr],
3842
3839
  [qt],
3843
3840
  [Vt],
3844
3841
  [Wt],
@@ -3852,15 +3849,15 @@ let Kt = class extends po {
3852
3849
  [
3853
3850
  [Le]
3854
3851
  ].forEach((e) => {
3855
- this.disposeWithMe(this._renderManagerService.registerRenderModule(U.UNIVER_SHEET, e));
3852
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3856
3853
  });
3857
3854
  }
3858
3855
  onRendered() {
3859
3856
  [
3860
3857
  [an]
3861
3858
  ].forEach((e) => {
3862
- this.disposeWithMe(this._renderManagerService.registerRenderModule(U.UNIVER_SHEET, e));
3863
- }), Co(this._injector, [
3859
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3860
+ }), So(this._injector, [
3864
3861
  [qt],
3865
3862
  // FormulaProgressBar relies on TriggerCalculationController, but it is necessary to ensure that the formula calculation is done after rendered.
3866
3863
  [Wt],
@@ -3872,33 +3869,33 @@ let Kt = class extends po {
3872
3869
  this._injector.get(Vt), this._injector.get(Ut);
3873
3870
  }
3874
3871
  _initUIPart() {
3875
- const e = this._injector.get(yr);
3876
- this.disposeWithMe(e.register($o, Gr)), this.disposeWithMe(e.register(Po, wc)), this.disposeWithMe(this._uiPartsService.registerComponent(Os.GLOBAL, () => Tr(Pc, this._injector)));
3872
+ const e = this._injector.get(Er);
3873
+ this.disposeWithMe(e.register(Lo, Kr)), this.disposeWithMe(e.register($o, Nc)), this.disposeWithMe(this._uiPartsService.registerComponent(ys.GLOBAL, () => br(Dc, this._injector)));
3877
3874
  }
3878
3875
  };
3879
- Zr(Kt, "pluginName", Mr);
3880
- Zr(Kt, "type", U.UNIVER_SHEET);
3881
- Kt = Hc([
3882
- mo(Rs),
3876
+ Yr(Kt, "pluginName", Or);
3877
+ Yr(Kt, "type", W.UNIVER_SHEET);
3878
+ Kt = Uc([
3879
+ fo(Cs),
3883
3880
  Dt(1, q(It)),
3884
3881
  Dt(2, Te),
3885
- Dt(3, ar),
3886
- Dt(4, br)
3882
+ Dt(3, pn),
3883
+ Dt(4, Ir)
3887
3884
  ], Kt);
3888
3885
  export {
3889
- Us as FORMULA_PROMPT_ACTIVATED,
3890
- wc as FormulaEditor,
3886
+ $s as FORMULA_PROMPT_ACTIVATED,
3887
+ Nc as FormulaEditor,
3891
3888
  Ut as FormulaReorderController,
3892
- Br as GlobalRangeSelectorService,
3893
- Vs as HelpFunctionOperation,
3889
+ Wr as GlobalRangeSelectorService,
3890
+ Ps as HelpFunctionOperation,
3894
3891
  ve as InsertFunctionOperation,
3895
- yn as MoreFunctionsOperation,
3896
- Gr as RangeSelector,
3892
+ Tn as MoreFunctionsOperation,
3893
+ Kr as RangeSelector,
3897
3894
  Le as RefSelectionsRenderService,
3898
- wr as ReferenceAbsoluteOperation,
3899
- Ys as SearchFunctionOperation,
3895
+ Mr as ReferenceAbsoluteOperation,
3896
+ js as SearchFunctionOperation,
3900
3897
  ft as SelectEditorFormulaOperation,
3901
- En as SheetCopyFormulaOnlyCommand,
3902
- bn as SheetOnlyPasteFormulaCommand,
3898
+ bn as SheetCopyFormulaOnlyCommand,
3899
+ yn as SheetOnlyPasteFormulaCommand,
3903
3900
  Kt as UniverSheetsFormulaUIPlugin
3904
3901
  };