@univerjs/sheets-formula-ui 0.15.0-insiders.20260110-48b77c8 → 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,27 +1,27 @@
1
1
  var Xr = Object.defineProperty;
2
2
  var Qr = (e, t, n) => t in e ? Xr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
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 or, DEFAULT_EMPTY_DOCUMENT_VALUE as sr, isRealNum as eo, CellValueType as Dn, 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 V, ThemeService as Et, ILogService as oo, toDisposable as ir, ColorKit as mn, RxDisposable as so, InterceptorEffectEnum as io, FOCUSING_DOC as co, FOCUSING_UNIVER_EDITOR as lo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as Ln, EDITOR_ACTIVATED as $n, createInternalEditorID as ao, BuildTextUtils as uo, IConfigService as cr, 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 pn, SetCellEditVisibleOperation as ur, HoverManagerService as Co, CellAlertManagerService as _o, CellAlertType as Ro, IAutoFillService as Io, APPLY_TYPE as Eo, DATA_TYPE as Pn, 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 Un, checkInHeaderRanges as Vn, getAllSelection as ko, genNormalSelectionStyle as fr, getSheetObject as Ao, MoveSelectionCommand as Wn, JumpOver as Hn, ExpandSelectionCommand as Bn, 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";
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
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 Sn, 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 qn, MoveSelectionOperation as Xo, MoveCursorOperation as Qo, useKeyboardEvent as Jo, useResize as es, DocBackScrollRenderController as ts, RichTextEditor as ns } from "@univerjs/docs-ui";
9
- import { DeviceInputEventType as xe, IRenderManagerService as Te, ScrollTimerType as en, SHEET_VIEWPORT_KEY as jn, Vector2 as Kn } from "@univerjs/engine-render";
10
- import { SheetsSelectionsService as vn, getSheetCommandTarget as Rr, getCellAtRowCol as rs, SetSelectionsOperation as Cn, SheetInterceptorService as _n, 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 Yn, SetWorksheetActiveOperation as Gn } from "@univerjs/sheets";
11
- import { InsertFunctionCommand as gs, TriggerCalculationController as ms, IDescriptionService as Zt, QuickSumCommand as ps, ImageFormulaCellInterceptorController as Ss, UniverSheetsFormulaPlugin as vs } from "@univerjs/sheets-formula";
12
- import { ISidebarService as Rn, IZenZoneService as Cs, useDependency as O, useObservable as _e, ProgressBar as _s, getMenuHiddenObservable as Pe, MenuItemType as Ue, RibbonFormulasGroup as Zn, KeyCode as $, MetaKeys as U, IMenuManagerService as Rs, IShortcutService as zt, IUIPartsService as Ir, ComponentManager as Er, connectInjector as br, useEvent as ee, RectPopup as cn, IContextMenuService as Is, useUpdateEffect as Es, BuiltInUIPart as bs } from "@univerjs/ui";
13
- import { jsx as w, jsxs as B, Fragment as ys } 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 Ts } from "react";
15
- import { clsx as se, scrollbarClassName as ut, borderLeftClassName as Os, Select as Ns, Input as yr, borderClassName as In, Button as at, borderTopClassName as Ms, Tooltip as xs, Dialog as ws } from "@univerjs/design";
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
+ 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 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
16
  import { DocSelectionManagerService as Tr } from "@univerjs/docs";
17
- import { debounceTime as ks } from "rxjs/operators";
18
- const En = {
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
21
  handler: async (e) => e.get(lr).copy({
22
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
27
  handler: async (e) => e.get(pe).executeCommand(vo.id, {
@@ -32,12 +32,12 @@ const En = {
32
32
  type: be.OPERATION,
33
33
  handler: (e, t) => !0
34
34
  };
35
- var As = Object.getOwnPropertyDescriptor, Fs = (e, t, n, o) => {
36
- for (var r = o > 1 ? void 0 : o ? As(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
- }, Ds = (e, t) => (n, o) => t(n, o, e);
40
- const Ls = "FORMULA_PROMPT_ACTIVATED", Xt = Jr("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(Ls, 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 = Fs([
197
- Ds(0, dn)
196
+ ln = Ds([
197
+ Ls(0, dn)
198
198
  ], ln);
199
- const $s = {
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 $s = {
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
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 && (Vs(r[0].range) || Ws(r[0].range) && Xn(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 = zn(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 (Xn(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 = zn(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 = Hs(h, F, k, i.getColumnCount() - 1), x = 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: x
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 = Bs(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 x = I === M ? M - 1 : M;
264
- for (let R = N; R <= k; R++) {
265
- const T = Ee({
266
- startRow: F,
267
- endRow: x,
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 $s = {
282
282
  return !1;
283
283
  });
284
284
  if (l) {
285
- const E = rs(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(or);
302
+ await m.executeCommand(_n.id, b);
303
+ const T = o.getEditor(fn), F = o.getEditor(sr);
304
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(gs.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 zn(e, t, n) {
319
- const o = Ps(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 zn(e, t, n) {
324
324
  startColumn: n,
325
325
  endColumn: n
326
326
  };
327
- const r = Us(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 zn(e, t, n) {
332
332
  endColumn: n - 1
333
333
  } : null;
334
334
  }
335
- function Ps(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 Ps(e, t, n) {
349
349
  }
350
350
  return t;
351
351
  }
352
- function Us(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,40 +371,40 @@ 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) === sr ? n.substring(0, n.length - 2) : n;
374
+ const n = t.dataStream, r = n.substring(n.length - 2, n.length) === ir ? n.substring(0, n.length - 2) : n;
375
375
  return eo(r);
376
376
  }
377
- return e && (e.t === Dn.NUMBER || to(e) === Dn.NUMBER);
377
+ return e && (e.t === Ln.NUMBER || to(e) === Ln.NUMBER);
378
378
  }
379
- function Vs(e) {
379
+ function Ws(e) {
380
380
  return e.startRow === e.endRow && e.startColumn === e.endColumn;
381
381
  }
382
- function Ws(e) {
382
+ function Hs(e) {
383
383
  return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
384
384
  }
385
- function Xn(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 Hs(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 Bs(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 Or = "SHEET_FORMULA_UI_PLUGIN", Nr = `${Or}_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
409
  children: { label: Nr }
410
410
  }), !0)
@@ -412,13 +412,13 @@ const Or = "SHEET_FORMULA_UI_PLUGIN", Nr = `${Or}_MORE_FUNCTIONS_COMPONENT`, yn
412
412
  id: "formula-ui.operation.change-ref-to-absolute",
413
413
  type: be.OPERATION,
414
414
  handler: async (e) => !0
415
- }, qs = {
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 js = Object.getOwnPropertyDescriptor, Ks = (e, t, n, o) => {
421
- for (var r = o > 1 ? void 0 : o ? js(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);
@@ -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 no.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 = Ks([
485
- At(0, q(_n)),
484
+ Ut = Ys([
485
+ At(0, q(Rn)),
486
486
  At(1, q(ne)),
487
487
  At(2, q(Tt)),
488
488
  At(3, q(ye))
489
489
  ], Ut);
490
- const xr = "sheets-formula-ui.base.config", Qn = {};
491
- var Ys = Object.getOwnPropertyDescriptor, Gs = (e, t, n, o) => {
492
- for (var r = o > 1 ? void 0 : o ? Ys(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", Zs = {
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];
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
524
  if (ro(a)) {
525
- const f = gr(a, !!h);
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
536
  type: Ro.ERROR,
537
537
  title: this._localeService.t("formula.error.title"),
538
- message: this._localeService.t(`formula.error.${Zs[f]}`),
538
+ message: this._localeService.t(`formula.error.${zs[f]}`),
539
539
  location: e.location,
540
540
  width: 200,
541
541
  height: 74,
@@ -556,28 +556,28 @@ let an = class extends Ze {
556
556
  this._cellAlertManagerService.removeAlert(nn);
557
557
  }
558
558
  };
559
- an = Gs([
559
+ an = Zs([
560
560
  St(1, q(Co)),
561
561
  St(2, q(_o)),
562
562
  St(3, q(dt)),
563
563
  St(4, q(Tt)),
564
- St(5, Cs)
564
+ St(5, _s)
565
565
  ], an);
566
- var zs = Object.getOwnPropertyDescriptor, Xs = (e, t, n, o) => {
567
- for (var r = o > 1 ? void 0 : o ? zs(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
- }, Jn = (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
582
  [Eo.COPY]: (t, n, o, r, s) => {
583
583
  const { data: i, index: c } = t;
@@ -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 = Js(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 } = Qs(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 = Xs([
620
- Jn(0, Io),
621
- Jn(1, q(ye))
619
+ Vt = Qs([
620
+ er(0, Io),
621
+ er(1, q(ye))
622
622
  ], Vt);
623
- function Qs(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 Js(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 Js(e) {
647
647
  });
648
648
  return t;
649
649
  }
650
- var ei = Object.getOwnPropertyDescriptor, ti = (e, t, n, o) => {
651
- for (var r = o > 1 ? void 0 : o ? ei(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 ni = "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();
@@ -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: ni,
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, V.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(V.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 = {
746
+ const d = t.range, f = n, m = {
747
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) => ri(
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 = ti([
765
+ Wt = ni([
766
766
  vt(0, ne),
767
767
  vt(1, q(ye)),
768
768
  vt(2, lr),
769
769
  vt(3, q(It)),
770
770
  vt(4, q(Tt))
771
771
  ], Wt);
772
- function ri(e, t, n, o, r, s, i, c, a = !1, h) {
773
- const f = [], m = [], d = oi(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
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 ri(e, t, n, o, r, s, i, c, a = !1, h) {
797
797
  redos: f
798
798
  };
799
799
  }
800
- function oi(e, t, n, o, r, s, i, c) {
801
- return c ? r.pasteType === lt.SPECIAL_PASTE_VALUE ? ii(e, t, n, o, i, c) : r.pasteType === lt.SPECIAL_PASTE_FORMULA ? ci(e, t, n, o, s, i, c) : li(e, t, n, o, r.copyType, s, i, c) : si(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 si(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 ii(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 = wr(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 ci(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 = wr(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 li(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 === dr.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 li(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
@@ -934,11 +934,11 @@ function wr(e) {
934
934
  if (t == null)
935
935
  return;
936
936
  const n = t.dataStream;
937
- return n.substring(n.length - 2, n.length) === sr ? 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 ai = Object.getOwnPropertyDescriptor, ui = (e, t, n, o) => {
941
- for (var r = o > 1 ? void 0 : o ? ai(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
- ir(
975
+ cr(
976
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
  )
@@ -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 hr(s, bo.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,8 +1075,8 @@ let Ht = class extends Ze {
1075
1075
  }
1076
1076
  }
1077
1077
  };
1078
- Ht = ui([
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),
@@ -1084,12 +1084,12 @@ Ht = ui([
1084
1084
  je(6, pe),
1085
1085
  je(7, oo)
1086
1086
  ], Ht);
1087
- var di = Object.getOwnPropertyDescriptor, hi = (e, t, n, o) => {
1088
- for (var r = o > 1 ? void 0 : o ? di(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
- }, er = (e, t) => (n, o) => t(n, o, e);
1092
- const fi = {
1091
+ }, tr = (e, t) => (n, o) => t(n, o, e);
1092
+ const gi = {
1093
1093
  tl: {
1094
1094
  size: 6,
1095
1095
  color: "#409f11"
@@ -1102,11 +1102,11 @@ let Bt = class extends so {
1102
1102
  {
1103
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];
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
1107
  return !gr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1108
1108
  ...n == null ? void 0 : n.markers,
1109
- ...fi
1109
+ ...gi
1110
1110
  }), r(n);
1111
1111
  },
1112
1112
  priority: 10
@@ -1114,22 +1114,22 @@ let Bt = class extends so {
1114
1114
  ));
1115
1115
  }
1116
1116
  };
1117
- Bt = hi([
1118
- er(0, q(_n)),
1119
- er(1, q(Tt))
1117
+ Bt = fi([
1118
+ tr(0, q(Rn)),
1119
+ tr(1, q(Tt))
1120
1120
  ], Bt);
1121
- function gi() {
1122
- const e = O(ms), t = O(pe), n = _e(e.progress$), o = $t(() => {
1121
+ function mi() {
1122
+ const e = y(ms), t = y(pe), n = _e(e.progress$), o = $t(() => {
1123
1123
  t.executeCommand(Vo.id);
1124
1124
  }, [t]), r = $t(() => {
1125
1125
  e.clearProgress();
1126
1126
  }, [e]);
1127
- return /* @__PURE__ */ w(_s, { progress: n, onTerminate: o, onClearProgress: r });
1127
+ return /* @__PURE__ */ x(Rs, { progress: n, onTerminate: o, onClearProgress: r });
1128
1128
  }
1129
- function mi(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
1135
  function kr(e) {
@@ -1150,7 +1150,7 @@ function Ar(e) {
1150
1150
  "("
1151
1151
  ] }),
1152
1152
  n && n.map((o, r) => /* @__PURE__ */ B("span", { children: [
1153
- /* @__PURE__ */ w("span", { children: kr(o) }),
1153
+ /* @__PURE__ */ x("span", { children: kr(o) }),
1154
1154
  r === n.length - 1 ? "" : ","
1155
1155
  ] }, r)),
1156
1156
  ")"
@@ -1159,14 +1159,14 @@ function Ar(e) {
1159
1159
  function Ct(e) {
1160
1160
  const { className: t, value: n, title: o } = e;
1161
1161
  return /* @__PURE__ */ B("div", { className: "univer-mb-2 univer-text-xs", children: [
1162
- /* @__PURE__ */ w(
1162
+ /* @__PURE__ */ x(
1163
1163
  "div",
1164
1164
  {
1165
1165
  className: se("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
1166
1166
  children: o
1167
1167
  }
1168
1168
  ),
1169
- /* @__PURE__ */ w(
1169
+ /* @__PURE__ */ x(
1170
1170
  "div",
1171
1171
  {
1172
1172
  className: "univer-break-all univer-text-gray-900 dark:!univer-text-white",
@@ -1175,26 +1175,26 @@ function Ct(e) {
1175
1175
  )
1176
1176
  ] });
1177
1177
  }
1178
- function pi(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__ */ w("div", { className: se("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((h, f) => /* @__PURE__ */ B("div", { children: [
1184
- /* @__PURE__ */ w("div", { className: "univer-text-sm", children: h.name }),
1185
- /* @__PURE__ */ w("div", { className: "univer-mb-2 univer-mt-1" })
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
+ /* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
1186
1186
  ] }, f)) }),
1187
- /* @__PURE__ */ w("div", { className: se("univer-flex-1 univer-p-3", Os), children: /* @__PURE__ */ w(
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__ */ w(Ar, { 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(`_${Ci()}`);
1197
+ const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${_i()}`);
1198
1198
  return Fr(n, `${o}`, {
1199
1199
  defIds: n.defIds,
1200
1200
  idSuffix: a.current
@@ -1207,11 +1207,11 @@ function nt({ ref: e, ...t }) {
1207
1207
  function Fr(e, t, n, o, r) {
1208
1208
  return tt(e.tag, {
1209
1209
  key: t,
1210
- ...Si(e, n, r),
1210
+ ...vi(e, n, r),
1211
1211
  ...o
1212
- }, (vi(e, n).children || []).map((s, i) => Fr(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 Si(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 Si(e, t, n) {
1221
1221
  typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
1222
1222
  })), o;
1223
1223
  }
1224
- function vi(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 vi(e, t) {
1235
1235
  } : r)
1236
1236
  } : e;
1237
1237
  }
1238
- function Ci() {
1238
+ function _i() {
1239
1239
  return Math.random().toString(36).substring(2, 8);
1240
1240
  }
1241
1241
  nt.displayName = "UniverIcon";
1242
- const _i = {
1242
+ const Ri = {
1243
1243
  tag: "svg",
1244
1244
  attrs: {
1245
1245
  xmlns: "http://www.w3.org/2000/svg",
@@ -1261,11 +1261,11 @@ const _i = {
1261
1261
  return tt(nt, Object.assign({}, t, {
1262
1262
  id: "check-mark-icon",
1263
1263
  ref: n,
1264
- icon: _i
1264
+ icon: Ri
1265
1265
  }));
1266
1266
  });
1267
1267
  Dr.displayName = "CheckMarkIcon";
1268
- const Ri = {
1268
+ const Ii = {
1269
1269
  tag: "svg",
1270
1270
  attrs: {
1271
1271
  xmlns: "http://www.w3.org/2000/svg",
@@ -1285,11 +1285,11 @@ const Ri = {
1285
1285
  return tt(nt, Object.assign({}, t, {
1286
1286
  id: "close-icon",
1287
1287
  ref: n,
1288
- icon: Ri
1288
+ icon: Ii
1289
1289
  }));
1290
1290
  });
1291
1291
  Lr.displayName = "CloseIcon";
1292
- const Ii = {
1292
+ const Ei = {
1293
1293
  tag: "svg",
1294
1294
  attrs: {
1295
1295
  xmlns: "http://www.w3.org/2000/svg",
@@ -1334,11 +1334,11 @@ const Ii = {
1334
1334
  return tt(nt, Object.assign({}, t, {
1335
1335
  id: "delete-icon",
1336
1336
  ref: n,
1337
- icon: Ii
1337
+ icon: Ei
1338
1338
  }));
1339
1339
  });
1340
1340
  $r.displayName = "DeleteIcon";
1341
- const Ei = {
1341
+ const bi = {
1342
1342
  tag: "svg",
1343
1343
  attrs: {
1344
1344
  xmlns: "http://www.w3.org/2000/svg",
@@ -1358,11 +1358,11 @@ const Ei = {
1358
1358
  return tt(nt, Object.assign({}, t, {
1359
1359
  id: "increase-icon",
1360
1360
  ref: n,
1361
- icon: Ei
1361
+ icon: bi
1362
1362
  }));
1363
1363
  });
1364
1364
  Pr.displayName = "IncreaseIcon";
1365
- const bi = {
1365
+ const yi = {
1366
1366
  tag: "svg",
1367
1367
  attrs: {
1368
1368
  xmlns: "http://www.w3.org/2000/svg",
@@ -1384,11 +1384,11 @@ const bi = {
1384
1384
  return tt(nt, Object.assign({}, t, {
1385
1385
  id: "more-icon",
1386
1386
  ref: n,
1387
- icon: bi
1387
+ icon: yi
1388
1388
  }));
1389
1389
  });
1390
1390
  Ur.displayName = "MoreIcon";
1391
- const yi = {
1391
+ const Ti = {
1392
1392
  tag: "svg",
1393
1393
  attrs: {
1394
1394
  xmlns: "http://www.w3.org/2000/svg",
@@ -1416,153 +1416,154 @@ const yi = {
1416
1416
  return tt(nt, Object.assign({}, t, {
1417
1417
  id: "select-range-icon",
1418
1418
  ref: n,
1419
- icon: yi
1419
+ icon: Ti
1420
1420
  }));
1421
1421
  });
1422
1422
  Vr.displayName = "SelectRangeIcon";
1423
- function Ti(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$), _ = mi(mr, S);
1425
- _.unshift({
1426
- label: S.t("formula.moreFunctions.allFunctions"),
1427
- value: n
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 x = new RegExp(`(${o.toLocaleUpperCase()})`);
1440
- return I.split(x).filter(Boolean).map((T, D) => T.match(x) ? /* @__PURE__ */ w("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 x = v.getFunctionInfo(s[I].name);
1448
- if (!x) {
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(x), t(x);
1453
+ v(O), o(O);
1453
1454
  };
1454
- function A(I) {
1455
- f(I);
1456
- const x = v.getSearchListByType(+I);
1457
- i(x);
1458
- }
1459
- function F(I) {
1460
- r(I);
1461
- const x = v.getSearchListByName(I);
1462
- i(x);
1463
- }
1464
- function N(I) {
1465
- if (I.stopPropagation(), I.key === "ArrowDown") {
1466
- const x = c + 1;
1467
- a(x === s.length ? 0 : x);
1468
- } else if (I.key === "ArrowUp") {
1469
- const x = c - 1;
1470
- a(x === -1 ? s.length - 1 : x);
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__ */ w(Ns, { value: h, options: _, onChange: A }),
1481
- /* @__PURE__ */ w(
1481
+ /* @__PURE__ */ x(Ms, { value: m, options: p, onChange: N }),
1482
+ /* @__PURE__ */ x(
1482
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__ */ w(
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 }, x) => /* @__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 === x
1504
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": d === O
1504
1505
  }),
1505
- onMouseEnter: () => M(x),
1506
- onMouseLeave: k,
1507
- onClick: () => y(x),
1506
+ onMouseEnter: () => k(O),
1507
+ onMouseLeave: $,
1508
+ onClick: () => A(O),
1508
1509
  children: [
1509
- m === x && /* @__PURE__ */ w(
1510
+ h === O && /* @__PURE__ */ x(
1510
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__ */ w("span", { className: "univer-block", children: b(I) })
1516
+ /* @__PURE__ */ x("span", { className: "univer-block", children: F(_) })
1516
1517
  ]
1517
1518
  },
1518
- x
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__ */ w(Ct, { title: u.functionName, value: u.description }),
1524
- /* @__PURE__ */ w(
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 }),
1525
+ /* @__PURE__ */ x(
1525
1526
  Ct,
1526
1527
  {
1527
- title: S.t("formula.moreFunctions.syntax"),
1528
- value: /* @__PURE__ */ w(Ar, { 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
- /* @__PURE__ */ w(
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__ */ w(
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 Oi() {
1550
+ function Ni() {
1550
1551
  const e = yo(), [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(ne), f = O(pe);
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 = Rr(h);
1558
- if (!u) return;
1557
+ function u() {
1558
+ const h = Rr(d);
1559
+ if (!h) return;
1559
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(or), 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,11 +1571,11 @@ function Oi() {
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__ */ w(Ti, { onChange: i }),
1574
- o && /* @__PURE__ */ w(pi, { 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
- o && /* @__PURE__ */ w(
1578
+ o && /* @__PURE__ */ x(
1578
1579
  at,
1579
1580
  {
1580
1581
  variant: "primary",
@@ -1583,12 +1584,13 @@ function Oi() {
1583
1584
  children: c.t("formula.moreFunctions.next")
1584
1585
  }
1585
1586
  ),
1586
- o && /* @__PURE__ */ w(at, { onClick: m, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
1587
- t && !!e && /* @__PURE__ */ w(
1587
+ o && /* @__PURE__ */ x(at, { onClick: m, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
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 Oi() {
1598
1600
  }
1599
1601
  );
1600
1602
  }
1601
- function Ni(e) {
1603
+ function Mi(e) {
1602
1604
  return {
1603
1605
  id: ve.id,
1604
1606
  title: "SUM",
@@ -1607,7 +1609,7 @@ function Ni(e) {
1607
1609
  params: {
1608
1610
  value: "SUM"
1609
1611
  },
1610
- hidden$: Pe(e, V.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 Ni(e) {
1615
1617
  })
1616
1618
  };
1617
1619
  }
1618
- function Mi(e) {
1620
+ function xi(e) {
1619
1621
  return {
1620
1622
  id: ve.id,
1621
1623
  title: "COUNT",
@@ -1624,7 +1626,7 @@ function Mi(e) {
1624
1626
  params: {
1625
1627
  value: "COUNT"
1626
1628
  },
1627
- hidden$: Pe(e, V.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 Mi(e) {
1632
1634
  })
1633
1635
  };
1634
1636
  }
1635
- function xi(e) {
1637
+ function wi(e) {
1636
1638
  return {
1637
1639
  id: ve.id,
1638
1640
  title: "AVERAGE",
@@ -1641,7 +1643,7 @@ function xi(e) {
1641
1643
  params: {
1642
1644
  value: "AVERAGE"
1643
1645
  },
1644
- hidden$: Pe(e, V.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 xi(e) {
1649
1651
  })
1650
1652
  };
1651
1653
  }
1652
- function wi(e) {
1654
+ function ki(e) {
1653
1655
  return {
1654
1656
  id: ve.id,
1655
1657
  title: "MAX",
@@ -1658,7 +1660,7 @@ function wi(e) {
1658
1660
  params: {
1659
1661
  value: "MAX"
1660
1662
  },
1661
- hidden$: Pe(e, V.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 wi(e) {
1666
1668
  })
1667
1669
  };
1668
1670
  }
1669
- function ki(e) {
1671
+ function Ai(e) {
1670
1672
  return {
1671
1673
  id: ve.id,
1672
1674
  title: "MIN",
@@ -1675,7 +1677,7 @@ function ki(e) {
1675
1677
  params: {
1676
1678
  value: "MIN"
1677
1679
  },
1678
- hidden$: Pe(e, V.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 ki(e) {
1683
1685
  })
1684
1686
  };
1685
1687
  }
1686
- function Ai(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, V.UNIVER_SHEET),
1694
+ hidden$: Pe(e, W.UNIVER_SHEET),
1693
1695
  disabled$: $e(e, {
1694
1696
  workbookTypes: [et],
1695
1697
  worksheetTypes: [Qe, Xe],
@@ -1697,9 +1699,9 @@ function Ai(e) {
1697
1699
  })
1698
1700
  };
1699
1701
  }
1700
- function Fi(e) {
1702
+ function Di(e) {
1701
1703
  return {
1702
- id: En.id,
1704
+ id: bn.id,
1703
1705
  type: Ue.BUTTON,
1704
1706
  title: "formula.operation.copyFormulaOnly",
1705
1707
  disabled$: $e(e, {
@@ -1707,12 +1709,12 @@ function Fi(e) {
1707
1709
  worksheetTypes: [us],
1708
1710
  rangeTypes: [as]
1709
1711
  }),
1710
- hidden$: Pe(e, V.UNIVER_SHEET)
1712
+ hidden$: Pe(e, W.UNIVER_SHEET)
1711
1713
  };
1712
1714
  }
1713
- function Di(e) {
1715
+ function Li(e) {
1714
1716
  return {
1715
- id: bn.id,
1717
+ id: yn.id,
1716
1718
  type: Ue.BUTTON,
1717
1719
  title: "formula.operation.pasteFormula",
1718
1720
  disabled$: To(e).pipe(
@@ -1723,63 +1725,63 @@ function Di(e) {
1723
1725
  })),
1724
1726
  Sr(([t, n]) => t || n)
1725
1727
  ),
1726
- hidden$: Pe(e, V.UNIVER_SHEET)
1728
+ hidden$: Pe(e, W.UNIVER_SHEET)
1727
1729
  };
1728
1730
  }
1729
- const Li = {
1730
- [Zn.BASIC]: {
1731
+ const $i = {
1732
+ [zn.BASIC]: {
1731
1733
  [`${ve.id}.sum`]: {
1732
1734
  order: 0,
1733
- menuItemFactory: Ni
1735
+ menuItemFactory: Mi
1734
1736
  },
1735
1737
  [`${ve.id}.count`]: {
1736
1738
  order: 1,
1737
- menuItemFactory: Mi
1739
+ menuItemFactory: xi
1738
1740
  },
1739
1741
  [`${ve.id}.average`]: {
1740
1742
  order: 2,
1741
- menuItemFactory: xi
1743
+ menuItemFactory: wi
1742
1744
  },
1743
1745
  [`${ve.id}.max`]: {
1744
1746
  order: 3,
1745
- menuItemFactory: wi
1747
+ menuItemFactory: ki
1746
1748
  },
1747
1749
  [`${ve.id}.min`]: {
1748
1750
  order: 4,
1749
- menuItemFactory: ki
1751
+ menuItemFactory: Ai
1750
1752
  }
1751
1753
  },
1752
- [Zn.OTHERS]: {
1753
- [yn.id]: {
1754
+ [zn.OTHERS]: {
1755
+ [Tn.id]: {
1754
1756
  order: 0,
1755
- menuItemFactory: Ai
1757
+ menuItemFactory: Fi
1756
1758
  }
1757
1759
  },
1758
1760
  [No]: {
1759
- [En.id]: {
1761
+ [bn.id]: {
1760
1762
  order: 0,
1761
- menuItemFactory: Fi
1763
+ menuItemFactory: Di
1762
1764
  }
1763
1765
  },
1764
1766
  [Oo]: {
1765
- [bn.id]: {
1767
+ [yn.id]: {
1766
1768
  order: 4,
1767
- menuItemFactory: Di
1769
+ menuItemFactory: Li
1768
1770
  }
1769
1771
  }
1770
- }, $i = "meta_key_ctrl_And_Shift";
1771
- function Pi(e) {
1772
+ }, Pi = "meta_key_ctrl_And_Shift";
1773
+ function Ui(e) {
1772
1774
  return e.getContextValue(co) && e.getContextValue(lo);
1773
1775
  }
1774
1776
  const Qt = [
1775
- $.ARROW_DOWN,
1776
- $.ARROW_UP,
1777
- $.ARROW_LEFT,
1778
- $.ARROW_RIGHT
1779
- ], Ui = [...Qt, $.ENTER, $.TAB, $.ESC];
1780
- function Vi() {
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() {
1781
1783
  const e = [];
1782
- for (const t of Ui)
1784
+ for (const t of Vi)
1783
1785
  e.push({
1784
1786
  id: ft.id,
1785
1787
  binding: t,
@@ -1791,63 +1793,63 @@ function Vi() {
1791
1793
  });
1792
1794
  return e;
1793
1795
  }
1794
- function Wi() {
1796
+ function Hi() {
1795
1797
  const e = [];
1796
1798
  for (const t of Qt)
1797
1799
  e.push({
1798
1800
  id: ft.id,
1799
- binding: t | U.SHIFT,
1801
+ binding: t | V.SHIFT,
1800
1802
  preconditions: (n) => yt(n),
1801
1803
  staticParameters: {
1802
1804
  eventType: xe.Keyboard,
1803
1805
  keycode: t,
1804
- metaKey: U.SHIFT
1806
+ metaKey: V.SHIFT
1805
1807
  }
1806
1808
  });
1807
1809
  return e;
1808
1810
  }
1809
- function Hi() {
1811
+ function Bi() {
1810
1812
  const e = [];
1811
1813
  for (const t of Qt)
1812
1814
  e.push({
1813
1815
  id: ft.id,
1814
- binding: t | U.CTRL_COMMAND,
1816
+ binding: t | V.CTRL_COMMAND,
1815
1817
  preconditions: (n) => yt(n),
1816
1818
  staticParameters: {
1817
1819
  eventType: xe.Keyboard,
1818
1820
  keycode: t,
1819
- metaKey: U.CTRL_COMMAND
1821
+ metaKey: V.CTRL_COMMAND
1820
1822
  }
1821
1823
  });
1822
1824
  return e;
1823
1825
  }
1824
- function Bi() {
1826
+ function qi() {
1825
1827
  const e = [];
1826
1828
  for (const t of Qt)
1827
1829
  e.push({
1828
1830
  id: ft.id,
1829
- binding: t | U.SHIFT | U.CTRL_COMMAND,
1831
+ binding: t | V.SHIFT | V.CTRL_COMMAND,
1830
1832
  preconditions: (n) => yt(n),
1831
1833
  staticParameters: {
1832
1834
  eventType: xe.Keyboard,
1833
1835
  keycode: t,
1834
- metaKey: $i
1836
+ metaKey: Pi
1835
1837
  }
1836
1838
  });
1837
1839
  return e;
1838
1840
  }
1839
- const qi = {
1841
+ const ji = {
1840
1842
  id: Mr.id,
1841
- binding: $.F4,
1843
+ binding: L.F4,
1842
1844
  preconditions: (e) => yt(e)
1843
1845
  };
1844
- function ji() {
1846
+ function Ki() {
1845
1847
  const e = [];
1846
- 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])
1847
1849
  e.push({
1848
1850
  id: ft.id,
1849
1851
  binding: t,
1850
- preconditions: (n) => Pi(n),
1852
+ preconditions: (n) => Ui(n),
1851
1853
  staticParameters: {
1852
1854
  eventType: xe.Keyboard,
1853
1855
  keycode: t,
@@ -1856,16 +1858,16 @@ function ji() {
1856
1858
  });
1857
1859
  return e;
1858
1860
  }
1859
- const Ki = {
1860
- id: ps.id,
1861
- binding: U.ALT | $.EQUAL,
1861
+ const Yi = {
1862
+ id: Ss.id,
1863
+ binding: V.ALT | L.EQUAL,
1862
1864
  preconditions: Mo,
1863
- mac: U.CTRL_COMMAND | U.ALT | $.EQUAL,
1865
+ mac: V.CTRL_COMMAND | V.ALT | L.EQUAL,
1864
1866
  description: "shortcut.sheets-formula-ui.quick-sum",
1865
1867
  group: "4_sheet-edit"
1866
1868
  };
1867
- var Yi = Object.getOwnPropertyDescriptor, Gi = (e, t, n, o) => {
1868
- for (var r = o > 1 ? void 0 : o ? Yi(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--)
1869
1871
  (i = e[s]) && (r = i(r) || r);
1870
1872
  return r;
1871
1873
  }, Ke = (e, t) => (n, o) => t(n, o, e);
@@ -1877,58 +1879,58 @@ let qt = class extends Ze {
1877
1879
  this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
1878
1880
  }
1879
1881
  _registerMenus() {
1880
- this._menuManagerService.mergeMenu(Li);
1882
+ this._menuManagerService.mergeMenu($i);
1881
1883
  }
1882
1884
  _registerCommands() {
1883
1885
  [
1884
- En,
1885
1886
  bn,
1886
- ve,
1887
1887
  yn,
1888
- qs,
1889
- $s,
1888
+ ve,
1889
+ Tn,
1890
+ js,
1891
+ Ps,
1890
1892
  ft,
1891
1893
  Mr
1892
1894
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
1893
1895
  }
1894
1896
  _registerShortcuts() {
1895
1897
  [
1896
- ...Vi(),
1897
1898
  ...Wi(),
1898
1899
  ...Hi(),
1899
1900
  ...Bi(),
1900
- ...ji(),
1901
- Ki,
1902
- qi
1901
+ ...qi(),
1902
+ ...Ki(),
1903
+ Yi,
1904
+ ji
1903
1905
  ].forEach((e) => {
1904
1906
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
1905
1907
  });
1906
1908
  }
1907
1909
  _registerComponents() {
1908
- this.disposeWithMe(this._uiPartsService.registerComponent(xo.FORMULA_AUX, () => br(gi, this._injector))), this._componentManager.register(Nr, Oi);
1910
+ this.disposeWithMe(this._uiPartsService.registerComponent(xo.FORMULA_AUX, () => br(mi, this._injector))), this._componentManager.register(Nr, Ni);
1909
1911
  }
1910
1912
  _registerRenderModules() {
1911
- this.disposeWithMe(this._renderManagerService.registerRenderModule(V.UNIVER_SHEET, [Ht]));
1913
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, [Ht]));
1912
1914
  }
1913
1915
  };
1914
- qt = Gi([
1916
+ qt = Zi([
1915
1917
  Ke(0, q(It)),
1916
- Ke(1, Rs),
1918
+ Ke(1, Is),
1917
1919
  Ke(2, pe),
1918
1920
  Ke(3, zt),
1919
1921
  Ke(4, Ir),
1920
1922
  Ke(5, Te),
1921
1923
  Ke(6, q(Er))
1922
1924
  ], qt);
1923
- var Zi = Object.getOwnPropertyDescriptor, zi = (e, t, n, o) => {
1924
- for (var r = o > 1 ? void 0 : o ? Zi(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--)
1925
1927
  (i = e[s]) && (r = i(r) || r);
1926
1928
  return r;
1927
1929
  }, rn = (e, t) => (n, o) => t(n, o, e);
1928
1930
  let jt = class extends Ze {
1929
1931
  constructor(e, t, n) {
1930
1932
  super(), this._imageFormulaCellInterceptorController = e, this._renderManagerService = t, this._univerInstanceService = n, this._imageFormulaCellInterceptorController.registerRefreshRenderFunction(() => {
1931
- const o = this._univerInstanceService.getCurrentUnitOfType(V.UNIVER_SHEET);
1933
+ const o = this._univerInstanceService.getCurrentUnitOfType(W.UNIVER_SHEET);
1932
1934
  if (!o) return;
1933
1935
  const r = this._renderManagerService.getRenderById(o.getUnitId());
1934
1936
  if (!r) return;
@@ -1938,8 +1940,8 @@ let jt = class extends Ze {
1938
1940
  });
1939
1941
  }
1940
1942
  };
1941
- jt = zi([
1942
- rn(0, q(Ss)),
1943
+ jt = Xi([
1944
+ rn(0, q(vs)),
1943
1945
  rn(1, Te),
1944
1946
  rn(2, ne)
1945
1947
  ], jt);
@@ -1957,8 +1959,8 @@ class Wr {
1957
1959
  return this._currentSelector$.next(t), o;
1958
1960
  }
1959
1961
  }
1960
- var Xi = Object.getOwnPropertyDescriptor, Qi = (e, t, n, o) => {
1961
- for (var r = o > 1 ? void 0 : o ? Xi(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--)
1962
1964
  (i = e[s]) && (r = i(r) || r);
1963
1965
  return r;
1964
1966
  }, ct = (e, t) => (n, o) => t(n, o, e);
@@ -1973,7 +1975,7 @@ let Le = class extends wo {
1973
1975
  );
1974
1976
  j(this, "_workbookSelections");
1975
1977
  j(this, "_eventDisposables");
1976
- 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(Ji(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;
1977
1979
  }
1978
1980
  getLocation() {
1979
1981
  return this._skeleton.getLocation();
@@ -1997,7 +1999,7 @@ let Le = class extends wo {
1997
1999
  * Call this method and user will be able to select on the canvas to update selections.
1998
2000
  */
1999
2001
  enableSelectionChanging() {
2000
- return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), ir(() => this._disableSelectionChanging());
2002
+ return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), cr(() => this._disableSelectionChanging());
2001
2003
  }
2002
2004
  _disableSelectionChanging() {
2003
2005
  var t;
@@ -2008,26 +2010,26 @@ let Le = class extends wo {
2008
2010
  }
2009
2011
  _initCanvasEventListeners() {
2010
2012
  const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new Ye();
2011
- return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, h) => {
2012
- 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());
2013
2015
  })), c.add(
2014
- n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, h) => {
2016
+ n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, d) => {
2015
2017
  if (!this.inRefSelectionMode()) return;
2016
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Un(a.offsetX, a.offsetY, i, f);
2017
- 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());
2018
2020
  })
2019
- ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, h) => {
2021
+ ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, d) => {
2020
2022
  if (!this.inRefSelectionMode()) return;
2021
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Un(a.offsetX, a.offsetY, i, f);
2022
- 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());
2023
- })), 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) => {
2024
2026
  if (this._reset(), !this.inRefSelectionMode()) return;
2025
2027
  const f = this._sheetSkeletonManagerService.getCurrent().skeleton, m = ko(f);
2026
2028
  this._addSelectionControlByModelData(m), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
2027
- const d = i.onPointerUp$.subscribeEvent(() => {
2028
- d.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
2029
+ const u = i.onPointerUp$.subscribeEvent(() => {
2030
+ u.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
2029
2031
  });
2030
- a.button !== 2 && h.stopPropagation();
2032
+ a.button !== 2 && d.stopPropagation();
2031
2033
  })), c;
2032
2034
  }
2033
2035
  /**
@@ -2070,7 +2072,7 @@ let Le = class extends wo {
2070
2072
  var i;
2071
2073
  if (!t)
2072
2074
  return;
2073
- const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(jn.VIEW_MAIN);
2075
+ const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Kn.VIEW_MAIN);
2074
2076
  this._skeleton && ((i = this._skeleton.worksheet) == null ? void 0 : i.getSheetId()) !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
2075
2077
  const s = this._workbookSelections.getCurrentSelections();
2076
2078
  this.resetSelectionsByModelData(s);
@@ -2078,7 +2080,7 @@ let Le = class extends wo {
2078
2080
  }
2079
2081
  _getActiveViewport(t) {
2080
2082
  const n = this._getSheetObject();
2081
- return n == null ? void 0 : n.scene.getActiveViewportByCoord(Kn.FromArray([t.offsetX, t.offsetY]));
2083
+ return n == null ? void 0 : n.scene.getActiveViewportByCoord(Yn.FromArray([t.offsetX, t.offsetY]));
2082
2084
  }
2083
2085
  _getSheetObject() {
2084
2086
  return Ao(this._context.unit, this._context);
@@ -2101,11 +2103,11 @@ let Le = class extends wo {
2101
2103
  if (!c || !i)
2102
2104
  return;
2103
2105
  r && (this._activeViewport = r);
2104
- const { offsetX: a, offsetY: h } = t, f = c.getViewport(jn.VIEW_MAIN);
2106
+ const { offsetX: a, offsetY: d } = t, f = c.getViewport(Kn.VIEW_MAIN);
2105
2107
  if (!f) return;
2106
- const m = c.getCoordRelativeToViewport(Kn.FromArray([a, h])), { x: d, y: u } = m;
2107
- this._startViewportPosX = d, this._startViewportPosY = u;
2108
- 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);
2109
2111
  if (!g) return;
2110
2112
  switch (o) {
2111
2113
  case Ie.NORMAL:
@@ -2139,9 +2141,9 @@ let Le = class extends wo {
2139
2141
  },
2140
2142
  style: null
2141
2143
  }), C.range.rangeType = o;
2142
- const _ = sn(C, this._skeleton);
2143
- this._startRangeWhenPointerDown = { ..._.rangeWithCoord };
2144
- const E = { ..._.rangeWithCoord, rangeType: o };
2144
+ const R = sn(C, this._skeleton);
2145
+ this._startRangeWhenPointerDown = { ...R.rangeWithCoord };
2146
+ const E = { ...R.rangeWithCoord, rangeType: o };
2145
2147
  let p = this.getActiveSelectionControl();
2146
2148
  const b = this.getSelectionControls();
2147
2149
  for (const M of b) {
@@ -2155,18 +2157,18 @@ let Le = class extends wo {
2155
2157
  }
2156
2158
  }
2157
2159
  this._checkClearPreviousControls(t);
2158
- const y = p == null ? void 0 : p.model.currentCell, A = t.shiftKey && y, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2159
- A && y ? this._makeSelectionByTwoCells(
2160
- 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,
2161
2163
  E,
2162
2164
  i,
2163
2165
  o,
2164
2166
  p
2165
2167
  // Get updated in this method
2166
- ) : F && p ? p.updateRangeBySelectionWithCoord(_) : p = this.newSelectionControl(c, i, C);
2168
+ ) : A && p ? p.updateRangeBySelectionWithCoord(R) : p = this.newSelectionControl(c, i, C);
2167
2169
  for (let M = 0; M < this.getSelectionControls().length - 1; M++)
2168
2170
  this.getSelectionControls()[M].clearHighlight();
2169
- 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(() => {
2170
2172
  var M;
2171
2173
  this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (M = this._escapeShortcutDisposable) == null || M.dispose(), this._escapeShortcutDisposable = null;
2172
2174
  });
@@ -2198,7 +2200,7 @@ let Le = class extends wo {
2198
2200
  }), c;
2199
2201
  }
2200
2202
  };
2201
- Le = Qi([
2203
+ Le = Ji([
2202
2204
  ct(1, q(It)),
2203
2205
  ct(2, q(Et)),
2204
2206
  ct(3, zt),
@@ -2206,11 +2208,11 @@ Le = Qi([
2206
2208
  ct(5, dn),
2207
2209
  ct(6, Gt)
2208
2210
  ], Le);
2209
- function Ji(e) {
2211
+ function ec(e) {
2210
2212
  const t = fr(e);
2211
2213
  return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
2212
2214
  }
2213
- const Tn = (e, t, n = !0) => {
2215
+ const On = (e, t, n = !0) => {
2214
2216
  let o = -1;
2215
2217
  return e.reduce((r, s, i) => {
2216
2218
  if (r.isFinish)
@@ -2233,7 +2235,7 @@ const Tn = (e, t, n = !0) => {
2233
2235
  typeof s != "string" && s.nodeType === Q.REFERENCE && o++;
2234
2236
  }
2235
2237
  return o;
2236
- }, ec = (e, t = 100) => {
2238
+ }, tc = (e, t = 100) => {
2237
2239
  P(() => {
2238
2240
  let n = null;
2239
2241
  const o = () => {
@@ -2247,23 +2249,23 @@ const Tn = (e, t, n = !0) => {
2247
2249
  }, [e, t]);
2248
2250
  };
2249
2251
  function Br(e, t, n) {
2250
- const o = O(ze), r = le(() => new vr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = O(Rn), i = O(ne), c = ee(() => {
2251
- var _;
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;
2252
2254
  const a = o.getEditor(e);
2253
2255
  if (!a)
2254
2256
  return;
2255
- const h = a.getBoundingClientRect(), { marginTop: f = 0, marginBottom: m = 0 } = a.getDocumentData().documentStyle, d = a.getSkeleton();
2256
- if (!d) return;
2257
- const u = (_ = d.getSkeletonData()) == null ? void 0 : _.pages[0].height;
2258
- let { left: l, top: v, right: S, bottom: g } = h;
2259
- 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;
2260
2262
  const C = r.getValue();
2261
- if (!(C.left === l && C.top === v && C.right === S && C.bottom === g))
2262
- 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;
2263
2265
  });
2264
2266
  return P(() => {
2265
2267
  t && c();
2266
- }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), ec(c), P(() => {
2268
+ }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), tc(c), P(() => {
2267
2269
  const a = s.scrollEvent$.pipe(Go(100)).subscribe(c);
2268
2270
  return () => {
2269
2271
  a.unsubscribe();
@@ -2271,41 +2273,41 @@ function Br(e, t, n) {
2271
2273
  }, []), [r, c];
2272
2274
  }
2273
2275
  const rt = (e) => {
2274
- const t = z(e);
2276
+ const t = X(e);
2275
2277
  return t.current = e, t;
2276
- }, tc = (e, t, n) => {
2277
- 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);
2278
- 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;
2279
2281
  const l = () => {
2280
- c(void 0), h(-1), m(!1);
2282
+ c(void 0), d(-1), m(!1);
2281
2283
  };
2282
2284
  return P(() => {
2283
- const v = s.sequenceNodesBuilder(t.slice(1));
2284
- o.setSequenceNodes(v != null ? v : []);
2285
+ const S = s.sequenceNodesBuilder(t.slice(1));
2286
+ o.setSequenceNodes(S != null ? S : []);
2285
2287
  }, [t]), P(() => {
2286
2288
  if (n && e) {
2287
- const v = n.selectionChange$.pipe(Sn(50)).subscribe((g) => {
2289
+ const S = n.selectionChange$.pipe(vn(50)).subscribe((g) => {
2288
2290
  if (g.textRanges.length === 1) {
2289
2291
  const [C] = g.textRanges;
2290
- if (C.collapsed && d.current) {
2291
- 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);
2292
2294
  if (p)
2293
2295
  if (typeof p != "string" && p.nodeType === 3 && !r.hasDefinedNameDescription(p.token.trim()) && b === Ge.OPEN_BRACKET) {
2294
- const y = r.getFunctionInfo(p.token);
2295
- c(y), h(-1);
2296
+ const T = r.getFunctionInfo(p.token);
2297
+ c(T), d(-1);
2296
2298
  return;
2297
2299
  } else {
2298
- const y = s.getFunctionAndParameter(`${u.current}A`, _ - 1);
2299
- if (y) {
2300
- const { functionName: A, paramIndex: F } = y, N = r.getFunctionInfo(A);
2301
- 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);
2302
2304
  return;
2303
2305
  }
2304
2306
  }
2305
2307
  }
2306
2308
  }
2307
- c(void 0), h(-1);
2308
- }), S = n.selectionChange$.pipe(
2309
+ c(void 0), d(-1);
2310
+ }), v = n.selectionChange$.pipe(
2309
2311
  Cr((g) => g.textRanges.length === 1),
2310
2312
  Sr((g) => g.textRanges[0].startOffset),
2311
2313
  Zo()
@@ -2313,7 +2315,7 @@ const rt = (e) => {
2313
2315
  m(!0);
2314
2316
  });
2315
2317
  return () => {
2316
- v.unsubscribe(), S.unsubscribe();
2318
+ S.unsubscribe(), v.unsubscribe();
2317
2319
  };
2318
2320
  }
2319
2321
  }, [n, e]), P(() => {
@@ -2323,7 +2325,7 @@ const rt = (e) => {
2323
2325
  paramIndex: a,
2324
2326
  reset: l
2325
2327
  };
2326
- }, nc = ({ onClick: e }) => /* @__PURE__ */ w(
2328
+ }, rc = ({ onClick: e }) => /* @__PURE__ */ x(
2327
2329
  "div",
2328
2330
  {
2329
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",
@@ -2331,21 +2333,21 @@ const rt = (e) => {
2331
2333
  children: "?"
2332
2334
  }
2333
2335
  ), on = ({ className: e, title: t, value: n }) => /* @__PURE__ */ B("div", { className: "univer-my-2", children: [
2334
- /* @__PURE__ */ w(
2336
+ /* @__PURE__ */ x(
2335
2337
  "div",
2336
2338
  {
2337
2339
  className: se("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
2338
2340
  children: t
2339
2341
  }
2340
2342
  ),
2341
- /* @__PURE__ */ w(
2343
+ /* @__PURE__ */ x(
2342
2344
  "div",
2343
2345
  {
2344
2346
  className: "univer-whitespace-pre-wrap univer-break-words univer-text-xs univer-text-gray-500",
2345
2347
  children: n
2346
2348
  }
2347
2349
  )
2348
- ] }), rc = (e) => {
2350
+ ] }), oc = (e) => {
2349
2351
  const { prefix: t, value: n, active: o, onClick: r } = e;
2350
2352
  return /* @__PURE__ */ B("div", { children: [
2351
2353
  /* @__PURE__ */ B("span", { children: [
@@ -2353,7 +2355,7 @@ const rt = (e) => {
2353
2355
  "("
2354
2356
  ] }),
2355
2357
  n && n.map((s, i) => /* @__PURE__ */ B("span", { children: [
2356
- /* @__PURE__ */ w(
2358
+ /* @__PURE__ */ x(
2357
2359
  "span",
2358
2360
  {
2359
2361
  className: o === i ? "univer-text-primary-500" : "",
@@ -2365,30 +2367,30 @@ const rt = (e) => {
2365
2367
  ] }, s.name)),
2366
2368
  ")"
2367
2369
  ] });
2368
- }, tr = () => {
2370
+ }, nr = () => {
2369
2371
  };
2370
- function oc(e) {
2371
- const { onParamsSwitch: t = tr, onClose: n = tr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = tc(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] = Br(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]);
2372
2374
  function C(p) {
2373
2375
  t && t(p);
2374
2376
  }
2375
- const _ = ee((p) => {
2376
- h.helpFunctionVisible$.next(!p);
2377
+ const R = ee((p) => {
2378
+ d.helpFunctionVisible$.next(!p);
2377
2379
  }), E = () => {
2378
- _(!0), n();
2380
+ R(!0), n();
2379
2381
  };
2380
- return i ? f ? /* @__PURE__ */ w(cn, { portal: !0, anchorRect$: g, direction: "left-center", children: /* @__PURE__ */ w(nc, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ w(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(
2381
2383
  "div",
2382
2384
  {
2383
- 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),
2384
2386
  children: [
2385
2387
  /* @__PURE__ */ B(
2386
2388
  "div",
2387
2389
  {
2388
- 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", Ms),
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),
2389
2391
  children: [
2390
- /* @__PURE__ */ w(
2391
- rc,
2392
+ /* @__PURE__ */ x(
2393
+ oc,
2392
2394
  {
2393
2395
  prefix: i.functionName,
2394
2396
  value: i.functionParameter,
@@ -2397,28 +2399,28 @@ function oc(e) {
2397
2399
  }
2398
2400
  ),
2399
2401
  /* @__PURE__ */ B("div", { className: "univer-flex", children: [
2400
- /* @__PURE__ */ w(
2402
+ /* @__PURE__ */ x(
2401
2403
  "div",
2402
2404
  {
2403
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",
2404
2406
  style: { transform: m ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2405
- onClick: () => d(!m),
2406
- children: /* @__PURE__ */ w(Ur, {})
2407
+ onClick: () => u(!m),
2408
+ children: /* @__PURE__ */ x(Ur, {})
2407
2409
  }
2408
2410
  ),
2409
- /* @__PURE__ */ w(
2411
+ /* @__PURE__ */ x(
2410
2412
  "div",
2411
2413
  {
2412
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",
2413
2415
  onClick: E,
2414
- children: /* @__PURE__ */ w(Lr, {})
2416
+ children: /* @__PURE__ */ x(Lr, {})
2415
2417
  }
2416
2418
  )
2417
2419
  ] })
2418
2420
  ]
2419
2421
  }
2420
2422
  ),
2421
- /* @__PURE__ */ w(
2423
+ /* @__PURE__ */ x(
2422
2424
  "div",
2423
2425
  {
2424
2426
  className: se("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ut),
@@ -2427,26 +2429,26 @@ function oc(e) {
2427
2429
  padding: m ? "revert-layer" : 0
2428
2430
  },
2429
2431
  children: /* @__PURE__ */ B("div", { className: "univer-mt-3", children: [
2430
- /* @__PURE__ */ w(
2432
+ /* @__PURE__ */ x(
2431
2433
  on,
2432
2434
  {
2433
- title: u.t("formula.prompt.helpExample"),
2435
+ title: h.t("formula.prompt.helpExample"),
2434
2436
  value: `${i.functionName}(${i.functionParameter.map((p) => p.example).join(",")})`
2435
2437
  }
2436
2438
  ),
2437
- /* @__PURE__ */ w(
2439
+ /* @__PURE__ */ x(
2438
2440
  on,
2439
2441
  {
2440
- title: u.t("formula.prompt.helpAbstract"),
2442
+ title: h.t("formula.prompt.helpAbstract"),
2441
2443
  value: i.description
2442
2444
  }
2443
2445
  ),
2444
- i && i.functionParameter && i.functionParameter.map((p, b) => /* @__PURE__ */ w(
2446
+ i && i.functionParameter && i.functionParameter.map((p, b) => /* @__PURE__ */ x(
2445
2447
  on,
2446
2448
  {
2447
2449
  className: c === b ? "univer-text-primary-500" : "",
2448
2450
  title: p.name,
2449
- value: `${p.require ? l : v} ${p.detail}`
2451
+ value: `${p.require ? l : S} ${p.detail}`
2450
2452
  },
2451
2453
  b
2452
2454
  ))
@@ -2457,8 +2459,8 @@ function oc(e) {
2457
2459
  }
2458
2460
  ) }, "show") : null;
2459
2461
  }
2460
- const sc = (e) => {
2461
- const t = O(ze);
2462
+ const ic = (e) => {
2463
+ const t = y(ze);
2462
2464
  return ee((o) => {
2463
2465
  var r, s;
2464
2466
  if (e) {
@@ -2475,44 +2477,44 @@ const sc = (e) => {
2475
2477
  }
2476
2478
  });
2477
2479
  };
2478
- function ic(e) {
2480
+ function cc(e) {
2479
2481
  var r, s;
2480
2482
  const n = e.get(ne).getCurrentUniverDocInstance();
2481
2483
  return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
2482
2484
  }
2483
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 || {});
2484
- function cc(e) {
2485
- var y;
2486
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = O(Te), c = O(ne), a = i.getRenderById(r), h = i.getRenderById(t), f = h == null ? void 0 : h.with(_r), m = O(Tr), 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(
2487
2489
  0
2488
2490
  /* NOT_SELECT */
2489
- ), v = O(ye), S = z(!0), g = a == null ? void 0 : a.with(Le), C = rt(u), _ = c.getUnit(r, V.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) => {
2490
2492
  g && g.setSkipLastEnabled(
2491
- A === 1 || A === 3 || A === 4
2493
+ F === 1 || F === 3 || F === 4
2492
2494
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2493
- ), C.current = A, l(A);
2495
+ ), C.current = F, l(F);
2494
2496
  }), b = ee(() => {
2495
- var X, re, he;
2496
- const A = c.getCurrentUnitOfType(V.UNIVER_SHEET);
2497
- if (!A) return;
2498
- const F = A.getActiveSheet(), N = f == null ? void 0 : f.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, k = ic(d);
2499
- if (!k) return;
2500
- const I = (X = k == null ? void 0 : k.dataStream) == null ? void 0 : X.slice(0, -2), x = ((re = v.sequenceNodesBuilder(I)) != null ? re : []).map((Y) => typeof Y == "object" ? Y.nodeType === Q.REFERENCE ? {
2501
- ...Y,
2502
- range: Wo(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)
2503
2505
  } : {
2504
- ...Y,
2506
+ ...G,
2505
2507
  range: void 0
2506
- } : Y), R = I[M - 1], T = I[M], D = x.find((Y) => typeof Y == "object" && Y.nodeType === Q.REFERENCE && M === Y.endIndex + 2), L = R && Ho(R) && (!T || Bo(T) && T !== Ge.OPEN_BRACKET), W = !!D;
2507
- if ((I == null ? void 0 : I.substring(0, 1)) === "=" && (L || W))
2508
- if (W) {
2509
- 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)
2510
2512
  return;
2511
- const { sheetName: Y, unitId: J } = D.range, ot = (he = c.getCurrentUnitOfType(V.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();
2512
2514
  J && J !== ot ? p(
2513
2515
  4
2514
2516
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2515
- ) : !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(
2516
2518
  2
2517
2519
  /* CAN_EDIT */
2518
2520
  ) : p(
@@ -2520,7 +2522,7 @@ function cc(e) {
2520
2522
  /* EDIT_OTHER_SHEET_REFERENCE */
2521
2523
  );
2522
2524
  } else
2523
- S.current = !1, p(
2525
+ v.current = !1, p(
2524
2526
  1
2525
2527
  /* NEED_ADD */
2526
2528
  );
@@ -2531,42 +2533,42 @@ function cc(e) {
2531
2533
  );
2532
2534
  });
2533
2535
  return P(() => {
2534
- const A = m.textSelection$.pipe(Cr((F) => F.unitId === t)).subscribe(() => {
2536
+ const F = m.textSelection$.pipe(Cr((A) => A.unitId === t)).subscribe(() => {
2535
2537
  b();
2536
2538
  });
2537
- return () => A.unsubscribe();
2539
+ return () => F.unsubscribe();
2538
2540
  }, [b, m.textSelection$, t]), P(() => {
2539
2541
  n || (p(
2540
2542
  0
2541
2543
  /* NOT_SELECT */
2542
- ), S.current = !0);
2544
+ ), v.current = !0);
2543
2545
  }, [n, p]), P(() => {
2544
- var F;
2546
+ var A;
2545
2547
  if (!o) return;
2546
- 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(() => {
2547
2549
  p(
2548
2550
  0
2549
2551
  /* NOT_SELECT */
2550
- ), S.current = !0;
2552
+ ), v.current = !0;
2551
2553
  });
2552
- return () => A == null ? void 0 : A.unsubscribe();
2553
- }, [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(() => {
2554
2556
  if (!n) return;
2555
- const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
2557
+ const F = R == null ? void 0 : R.activeSheet$.subscribe(() => {
2556
2558
  b();
2557
- }), F = c.getCurrentTypeOfUnit$(V.UNIVER_SHEET).subscribe(() => {
2559
+ }), A = c.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe(() => {
2558
2560
  b();
2559
2561
  });
2560
2562
  return () => {
2561
- A == null || A.unsubscribe(), F == null || F.unsubscribe();
2563
+ F == null || F.unsubscribe(), A == null || A.unsubscribe();
2562
2564
  };
2563
- }, [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 };
2564
2566
  }
2565
- const lc = () => {
2566
- const e = O(ye);
2567
+ const ac = () => {
2568
+ const e = y(ye);
2567
2569
  return $t((n) => e.sequenceNodesBuilder(n) || [], [e]);
2568
2570
  };
2569
- function ac(e, t, n) {
2571
+ function uc(e, t, n) {
2570
2572
  const o = new mn(t).setAlpha(0.05).toRgbString();
2571
2573
  return {
2572
2574
  id: n,
@@ -2580,7 +2582,7 @@ function ac(e, t, n) {
2580
2582
  };
2581
2583
  }
2582
2584
  function qr(e) {
2583
- var _, E, p;
2585
+ var R, E, p;
2584
2586
  const {
2585
2587
  unitId: t,
2586
2588
  subUnitId: n,
@@ -2590,49 +2592,49 @@ function qr(e) {
2590
2592
  refSelectionsService: i,
2591
2593
  refSelectionsRenderService: c,
2592
2594
  sheetSkeletonManagerService: a,
2593
- themeService: h,
2595
+ themeService: d,
2594
2596
  univerInstanceService: f
2595
- } = e, m = o.getUnitId(), d = f.getUnit(t, V.UNIVER_SHEET), u = d == null ? void 0 : d.getActiveSheet(), l = [];
2596
- 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) {
2597
2599
  i.setSelections(l);
2598
2600
  return;
2599
2601
  }
2600
- const v = u.getSheetId(), S = (b) => {
2601
- var y;
2602
- 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();
2603
2605
  };
2604
- 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;
2605
2607
  const C = [];
2606
- for (let b = 0, y = r.length; b < y; b++) {
2607
- const A = r[b], { themeColor: F, token: N, refIndex: M, endIndex: k } = A, I = ht(N), { unitId: x, sheetName: R, range: T } = I, D = S(R);
2608
- if (!D && R || m !== t && x !== m || x && x !== 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)
2609
2611
  continue;
2610
- const L = fs(T, u.getRowCount(), u.getColumnCount());
2611
- L.unitId = t, L.sheetId = v, l.push({
2612
- range: L,
2612
+ const D = fs(_, h.getRowCount(), h.getColumnCount());
2613
+ D.unitId = t, D.sheetId = S, l.push({
2614
+ range: D,
2613
2615
  primary: null,
2614
- style: ac(h, F, M.toString())
2615
- }), C.push(k);
2616
+ style: uc(d, A, M.toString())
2617
+ }), C.push(w);
2616
2618
  }
2617
2619
  if (s) {
2618
- const b = (p = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : p.startOffset, y = C.findIndex((A) => A + 2 === b);
2619
- 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();
2620
2622
  }
2621
2623
  return l;
2622
2624
  }
2623
- function uc(e, t) {
2624
- const n = O(ne), o = O(Et), r = O(Gt), s = O(Te), i = _e(le(() => n.getCurrentTypeOfUnit$(V.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) => {
2625
- const u = n.getCurrentUnitOfType(V.UNIVER_SHEET);
2626
- if (!u || a != null && a.selectionMoving) return;
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;
2627
2629
  const l = qr({
2628
2630
  unitId: e,
2629
2631
  subUnitId: t,
2630
- currentWorkbook: u,
2632
+ currentWorkbook: h,
2631
2633
  refSelections: m,
2632
- editor: d,
2634
+ editor: u,
2633
2635
  refSelectionsService: r,
2634
2636
  refSelectionsRenderService: a,
2635
- sheetSkeletonManagerService: h,
2637
+ sheetSkeletonManagerService: d,
2636
2638
  themeService: o,
2637
2639
  univerInstanceService: n
2638
2640
  });
@@ -2644,47 +2646,47 @@ function uc(e, t) {
2644
2646
  }, [a]), f;
2645
2647
  }
2646
2648
  function jr(e = "") {
2647
- const t = O(Zt), n = dc(), o = O(pe), r = le(() => e.length, [e]);
2648
- return ee((i, c, a = !0, h) => {
2649
+ const t = y(Zt), n = hc(), o = y(pe), r = le(() => e.length, [e]);
2650
+ return ee((i, c, a = !0, d) => {
2649
2651
  const f = i.getDocumentData(), m = i.getEditorId();
2650
2652
  if (!f)
2651
2653
  return [];
2652
- const d = f.body;
2653
- if (!d)
2654
+ const u = f.body;
2655
+ if (!u)
2654
2656
  return [];
2655
- const u = d.dataStream.slice(0, d.dataStream.length - 2), l = { dataStream: "", ...f.body };
2656
- 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 [];
2657
2659
  if (c == null || c.length === 0)
2658
- return l.textRuns = [], o.syncExecuteCommand(qn.id, {
2660
+ return l.textRuns = [], o.syncExecuteCommand(jn.id, {
2659
2661
  unitId: m,
2660
- body: Ln(l, 0, l.dataStream.length - 2)
2662
+ body: $n(l, 0, l.dataStream.length - 2)
2661
2663
  }), [];
2662
2664
  {
2663
- const { textRuns: v, refSelections: S } = hc(t, n, c);
2664
- r && v.forEach((_) => {
2665
- _.ed = _.ed + r, _.st = _.st + r;
2666
- }), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...v];
2667
- 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}`, "");
2668
2670
  l.dataStream = `${e}${g}\r
2669
2671
  `;
2670
2672
  let C;
2671
2673
  if (a) {
2672
2674
  C = i.getSelectionRanges();
2673
- const _ = l.dataStream.length - 2 + r;
2675
+ const R = l.dataStream.length - 2 + r;
2674
2676
  C.forEach((E) => {
2675
- 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));
2676
2678
  });
2677
2679
  }
2678
- return o.syncExecuteCommand(qn.id, {
2680
+ return o.syncExecuteCommand(jn.id, {
2679
2681
  unitId: m,
2680
- body: Ln(l, 0, l.dataStream.length - 2),
2681
- textRanges: h != null ? h : C
2682
- }), S;
2682
+ body: $n(l, 0, l.dataStream.length - 2),
2683
+ textRanges: d != null ? d : C
2684
+ }), v;
2683
2685
  }
2684
2686
  });
2685
2687
  }
2686
- function dc() {
2687
- const e = O(Et), t = e.getCurrentTheme();
2688
+ function hc() {
2689
+ const e = y(Et), t = e.getCurrentTheme();
2688
2690
  return le(() => {
2689
2691
  const o = [
2690
2692
  e.getColorFromTheme("loop-color.1"),
@@ -2703,13 +2705,13 @@ function dc() {
2703
2705
  return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i };
2704
2706
  }, [t]);
2705
2707
  }
2706
- function hc(e, t, n) {
2707
- 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();
2708
2710
  let f = 0;
2709
- for (let m = 0, d = n.length; m < d; m++) {
2710
- const u = n[m];
2711
- if (typeof u == "string") {
2712
- 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;
2713
2715
  c.push({
2714
2716
  st: E,
2715
2717
  ed: p,
@@ -2722,10 +2724,10 @@ function hc(e, t, n) {
2722
2724
  });
2723
2725
  continue;
2724
2726
  }
2725
- if (e.hasDefinedNameDescription(u.token.trim())) {
2727
+ if (e.hasDefinedNameDescription(h.token.trim())) {
2726
2728
  c.push({
2727
- st: u.startIndex,
2728
- ed: u.endIndex + 1,
2729
+ st: h.startIndex,
2730
+ ed: h.endIndex + 1,
2729
2731
  ts: {
2730
2732
  cl: {
2731
2733
  rgb: i
@@ -2735,27 +2737,27 @@ function hc(e, t, n) {
2735
2737
  });
2736
2738
  continue;
2737
2739
  }
2738
- const { startIndex: l, endIndex: v, nodeType: S, token: g } = u;
2740
+ const { startIndex: l, endIndex: S, nodeType: v, token: g } = h;
2739
2741
  let C = "";
2740
- if (S === Q.REFERENCE) {
2741
- if (h.has(g))
2742
- C = h.get(g);
2742
+ if (v === Q.REFERENCE) {
2743
+ if (d.has(g))
2744
+ C = d.get(g);
2743
2745
  else {
2744
- const _ = f % o.length;
2745
- C = o[_], h.set(g, C), f++;
2746
+ const R = f % o.length;
2747
+ C = o[R], d.set(g, C), f++;
2746
2748
  }
2747
2749
  a.push({
2748
2750
  refIndex: m,
2749
2751
  themeColor: C,
2750
2752
  token: g,
2751
- startIndex: u.startIndex,
2752
- endIndex: u.endIndex,
2753
+ startIndex: h.startIndex,
2754
+ endIndex: h.endIndex,
2753
2755
  index: a.length
2754
2756
  });
2755
- } 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);
2756
2758
  C && C.length > 0 ? c.push({
2757
2759
  st: l,
2758
- ed: v + 1,
2760
+ ed: S + 1,
2759
2761
  ts: {
2760
2762
  cl: {
2761
2763
  rgb: C
@@ -2764,7 +2766,7 @@ function hc(e, t, n) {
2764
2766
  }
2765
2767
  }) : c.push({
2766
2768
  st: l,
2767
- ed: v + 1,
2769
+ ed: S + 1,
2768
2770
  ts: {
2769
2771
  cl: {
2770
2772
  rgb: i
@@ -2775,77 +2777,77 @@ function hc(e, t, n) {
2775
2777
  }
2776
2778
  return { textRuns: c, refSelections: a };
2777
2779
  }
2778
- const fc = (e, t, n, o) => {
2779
- 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);
2780
2782
  i.current = t;
2781
- const c = z(o);
2783
+ const c = X(o);
2782
2784
  c.current = o, P(() => {
2783
2785
  if (!n || !e)
2784
2786
  return;
2785
- 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) => {
2786
2788
  if (c.current) {
2787
- c.current(l, v);
2789
+ c.current(l, S);
2788
2790
  return;
2789
2791
  }
2790
- let S = de.LEFT;
2791
- l === $.ARROW_DOWN ? S = de.DOWN : l === $.ARROW_UP ? S = de.UP : l === $.ARROW_RIGHT && (S = de.RIGHT), v === U.SHIFT ? r.executeCommand(Xo.id, {
2792
- 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
2793
2795
  }) : r.executeCommand(Qo.id, {
2794
- direction: S
2796
+ direction: v
2795
2797
  });
2796
- }, d = (l, v) => {
2797
- let S = de.DOWN;
2798
- 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 === U.CTRL_COMMAND ? r.executeCommand(Wn.id, {
2799
- direction: S,
2800
- 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,
2801
2803
  extra: "formula-editor",
2802
2804
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2803
- }) : v === U.SHIFT ? r.executeCommand(Bn.id, {
2804
- direction: S,
2805
+ }) : S === V.SHIFT ? r.executeCommand(qn.id, {
2806
+ direction: v,
2805
2807
  extra: "formula-editor"
2806
- }) : v === (U.CTRL_COMMAND | U.SHIFT) ? r.executeCommand(Bn.id, {
2807
- direction: S,
2808
- jumpOver: Hn.moveGap,
2808
+ }) : S === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(qn.id, {
2809
+ direction: v,
2810
+ jumpOver: Bn.moveGap,
2809
2811
  extra: "formula-editor"
2810
- }) : r.executeCommand(Wn.id, {
2811
- direction: S,
2812
+ }) : r.executeCommand(Hn.id, {
2813
+ direction: v,
2812
2814
  extra: "formula-editor",
2813
2815
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2814
- }) : m(l, v);
2816
+ }) : m(l, S);
2815
2817
  };
2816
2818
  return f.add(r.registerCommand({
2817
- id: h,
2819
+ id: d,
2818
2820
  type: be.OPERATION,
2819
- handler(l, v) {
2820
- const { keyCode: S, metaKey: g } = v;
2821
- d(S, g);
2821
+ handler(l, S) {
2822
+ const { keyCode: v, metaKey: g } = S;
2823
+ u(v, g);
2822
2824
  }
2823
2825
  })), [
2824
- { keyCode: $.ARROW_DOWN },
2825
- { keyCode: $.ARROW_LEFT },
2826
- { keyCode: $.ARROW_RIGHT },
2827
- { keyCode: $.ARROW_UP },
2828
- { keyCode: $.ARROW_DOWN, metaKey: U.SHIFT },
2829
- { keyCode: $.ARROW_LEFT, metaKey: U.SHIFT },
2830
- { keyCode: $.ARROW_RIGHT, metaKey: U.SHIFT },
2831
- { keyCode: $.ARROW_UP, metaKey: U.SHIFT },
2832
- { keyCode: $.ARROW_DOWN, metaKey: U.CTRL_COMMAND },
2833
- { keyCode: $.ARROW_LEFT, metaKey: U.CTRL_COMMAND },
2834
- { keyCode: $.ARROW_RIGHT, metaKey: U.CTRL_COMMAND },
2835
- { keyCode: $.ARROW_UP, metaKey: U.CTRL_COMMAND },
2836
- { keyCode: $.ARROW_DOWN, metaKey: U.CTRL_COMMAND | U.SHIFT },
2837
- { keyCode: $.ARROW_LEFT, metaKey: U.CTRL_COMMAND | U.SHIFT },
2838
- { keyCode: $.ARROW_RIGHT, metaKey: U.CTRL_COMMAND | U.SHIFT },
2839
- { keyCode: $.ARROW_UP, metaKey: U.CTRL_COMMAND | U.SHIFT }
2840
- ].map(({ keyCode: l, metaKey: v }) => ({
2841
- id: h,
2842
- 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,
2843
2845
  preconditions: () => !0,
2844
2846
  priority: 900,
2845
2847
  staticParameters: {
2846
2848
  eventType: xe.Keyboard,
2847
2849
  keyCode: l,
2848
- metaKey: v
2850
+ metaKey: S
2849
2851
  }
2850
2852
  })).forEach((l) => {
2851
2853
  f.add(s.registerShortcut(l));
@@ -2853,104 +2855,104 @@ const fc = (e, t, n, o) => {
2853
2855
  f.dispose();
2854
2856
  };
2855
2857
  }, [r, n, e, s]);
2856
- }, gc = (e, t, n, o, r = !0) => {
2857
- var u;
2858
- const s = O(Te), i = O(dn), c = O(Is), a = O(Gt), h = O(ne), f = _e(le(() => h.getCurrentTypeOfUnit$(V.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);
2859
2861
  Pt(() => {
2860
2862
  if (e)
2861
- return i.setContextValue($n, !0), r && c.disable(), () => {
2862
- const l = h.getCurrentUnitOfType(V.UNIVER_DOC);
2863
- (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();
2864
2866
  };
2865
2867
  }, [i, e, a, r, o]), Pt(() => {
2866
2868
  if (e && t) {
2867
- const l = d == null ? void 0 : d.enableSelectionChanging();
2868
- return i.setContextValue(Yn, !0), () => {
2869
- i.setContextValue(Yn, !1), l == null || l.dispose();
2869
+ const l = u == null ? void 0 : u.enableSelectionChanging();
2870
+ return i.setContextValue(Gn, !0), () => {
2871
+ i.setContextValue(Gn, !1), l == null || l.dispose();
2870
2872
  };
2871
2873
  }
2872
- }, [i, e, d, t]), P(() => {
2873
- e && (d == null || d.setSkipLastEnabled(!1));
2874
- }, [e, d]);
2875
- }, mc = (e, t, n) => {
2876
- const o = O(ne), 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);
2877
2879
  return $t(() => {
2878
2880
  if (e) {
2879
- const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(V.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();
2880
2882
  (c == null ? void 0 : c.getUnitId()) !== t && o.setCurrentUnitForType(t), a && a.getSheetId() === n && r.setSelections(i);
2881
2883
  }
2882
2884
  }, [e, r, n, t, o]);
2883
- }, pc = (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)), Sc = (e) => {
2884
- 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;
2885
2887
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
2886
2888
  if ((o == null ? void 0 : o.length) !== 1)
2887
2889
  return;
2888
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
2889
- `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], a = Tn(c, s, !1), h = Hr(c, a);
2891
+ `).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a = On(c, s, !1), d = Hr(c, a);
2890
2892
  return {
2891
2893
  nodeIndex: a,
2892
- updatingRefIndex: h,
2894
+ updatingRefIndex: d,
2893
2895
  sequenceNodes: c,
2894
2896
  offset: s
2895
2897
  };
2896
- }, vc = (() => {
2897
- }), Cc = (e, t, n, o, r, s, i, c, a, h = vc) => {
2898
+ }, Cc = (() => {
2899
+ }), _c = (e, t, n, o, r, s, i, c, a, d = Cc) => {
2898
2900
  var M;
2899
- const f = O(Te), m = O(ne), d = O(pe), u = O(Tr), l = O(Et), v = O(ye), S = m.getUnit(o), g = ee((k, I) => {
2900
- var x, R, T;
2901
- return (T = (R = (x = m.getUnit(k)) == null ? void 0 : x.getSheetBySheetId(I)) == null ? void 0 : R.getName()) != null ? T : "";
2902
- }), 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$(V.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, x) => {
2903
- var X, re, he, Y, J, ot, st, Ot, Oe, Nt;
2904
- const R = Sc({ editor: a, lexerTreeBuilder: v });
2905
- if (!R) return;
2906
- 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;
2907
2909
  if (n.current === Me.NEED_ADD)
2908
- if (W !== 0) {
2909
- if (T === -1 && L.length)
2910
+ if (U !== 0) {
2911
+ if (_ === -1 && D.length)
2910
2912
  return;
2911
- const K = k[k.length - 1], te = 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 = {
2912
2914
  range: K,
2913
2915
  unitId: (re = K.unitId) != null ? re : p.getUnitId(),
2914
2916
  sheetName: g((he = K.unitId) != null ? he : p.getUnitId(), fe)
2915
2917
  }, ae = fe !== r, ge = (p == null ? void 0 : p.getUnitId()) !== o, Se = Ft([oe], i && (ae || ge), C, ge);
2916
- L.push({ token: Se[0], nodeType: Q.REFERENCE });
2917
- const We = [...L, ...te], He = un(We);
2918
- h(He, pc(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);
2919
2921
  } else {
2920
- const K = k[k.length - 1], te = (Y = K.sheetId) != null ? Y : r, fe = {
2922
+ const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r, fe = {
2921
2923
  range: K,
2922
2924
  unitId: (J = K.unitId) != null ? J : p.getUnitId(),
2923
2925
  sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), te)
2924
2926
  }, oe = te !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (oe || ae), C, ae);
2925
- L.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2926
- const Se = un(L);
2927
- h(Se, ge[0].length, I);
2927
+ D.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2928
+ const Se = un(D);
2929
+ d(Se, ge[0].length, k);
2928
2930
  }
2929
2931
  else if (n.current === Me.EDIT_OTHER_SHEET_REFERENCE || n.current === Me.EDIT_OTHER_WORKBOOK_REFERENCE) {
2930
- const K = k.pop();
2932
+ const K = w.pop();
2931
2933
  if (!K) return;
2932
- const te = L[T];
2934
+ const te = D[_];
2933
2935
  if (typeof te == "object" && te.nodeType === Q.REFERENCE) {
2934
2936
  const fe = te.token;
2935
- (p == null ? void 0 : p.getUnitId()) !== o ? te.token = jo((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : te.token = C === (_ == null ? void 0 : _.getName()) ? Ee(K) : _t(_.getName(), K);
2936
- const ae = W + (te.token.length - fe.length);
2937
- h(Ko(L), ae, I);
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);
2938
2940
  }
2939
2941
  } else {
2940
- const K = [...k];
2941
- if (!x && D !== -1) {
2942
- const G = K.pop();
2943
- 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);
2944
2946
  }
2945
2947
  let te = 0;
2946
- const fe = L.map((G) => {
2948
+ const fe = D.map((Z) => {
2947
2949
  var Re, we, it, Be;
2948
- if (typeof G == "string")
2949
- return G;
2950
- if (G.nodeType === Q.REFERENCE) {
2951
- 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);
2952
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)
2953
- return G.token;
2955
+ return Z.token;
2954
2956
  const ie = K[te];
2955
2957
  if (te++, !ie)
2956
2958
  return "";
@@ -2961,148 +2963,148 @@ const fc = (e, t, n, o) => {
2961
2963
  }, Mt = (p == null ? void 0 : p.getUnitId()) !== o;
2962
2964
  return Ft([Jt], i && (gt !== r || Mt), C, Mt)[0];
2963
2965
  }
2964
- return G.token;
2966
+ return Z.token;
2965
2967
  });
2966
2968
  let oe = "", ae;
2967
- fe.forEach((G, Re) => {
2968
- oe += G, Re === T && (ae = oe.length);
2969
+ fe.forEach((Z, Re) => {
2970
+ oe += Z, Re === _ && (ae = oe.length);
2969
2971
  });
2970
2972
  const ge = [];
2971
- for (let G = te; G <= k.length - 1; G++) {
2972
- 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 = {
2973
2975
  range: Re,
2974
2976
  unitId: (Oe = Re.unitId) != null ? Oe : p.getUnitId(),
2975
2977
  sheetName: g((Nt = Re.unitId) != null ? Nt : p.getUnitId(), we)
2976
2978
  }, Be = (p == null ? void 0 : p.getUnitId()) !== o, ie = Ft([it], i && (we !== r || Be), C, Be);
2977
2979
  ge.push(ie[0]);
2978
2980
  }
2979
- const Se = L[L.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === Q.REFERENCE), He = `${oe}${ge.length && We ? "," : ""}${ge.join(",")}`;
2980
- 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);
2981
2983
  }
2982
2984
  });
2983
2985
  P(() => {
2984
- if (y && e) {
2985
- let k = !0, I = 0;
2986
- const x = (T, D) => {
2987
- if (k) {
2988
- 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;
2989
2991
  return;
2990
2992
  }
2991
- const L = T.length > I;
2992
- D && (I = T.length), N(T.map((W) => W.rangeWithCoord), D, L);
2993
- }, R = new Ye();
2994
- return R.add(y.selectionMoving$.subscribe((T) => {
2995
- x(T, !1);
2996
- })), R.add(y.selectionMoveEnd$.subscribe((T) => {
2997
- x(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);
2998
3000
  })), () => {
2999
- R.dispose();
3001
+ I.dispose();
3000
3002
  };
3001
3003
  }
3002
- }, [e, N, y]), P(() => {
3003
- if (t && y && a) {
3004
- const k = new Ye(), I = () => {
3005
- k.dispose(), y.getSelectionControls().forEach((T, D) => {
3006
- k.add(
3007
- T.selectionScaling$.subscribe((L) => {
3008
- const W = y.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), X = W[D];
3009
- 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);
3010
3012
  })
3011
- ), k.add(
3012
- T.selectionMoving$.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, !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);
3015
3017
  })
3016
3018
  );
3017
3019
  });
3018
- }, x = zo(
3020
+ }, $ = zo(
3019
3021
  a.input$,
3020
- F.selectionSet$,
3021
- y.selectionMoveEnd$
3022
+ A.selectionSet$,
3023
+ T.selectionMoveEnd$
3022
3024
  ).pipe(
3023
- ks(50)
3025
+ As(50)
3024
3026
  ).subscribe(() => {
3025
- I();
3027
+ k();
3026
3028
  });
3027
3029
  return () => {
3028
- x.unsubscribe(), k.dispose();
3030
+ $.unsubscribe(), w.dispose();
3029
3031
  };
3030
3032
  }
3031
- }, [a, t, N, y, F.selectionSet$]), y == null || y.getSelectionDataWithStyle(), P(() => {
3033
+ }, [a, t, N, T, A.selectionSet$]), T == null || T.getSelectionDataWithStyle(), P(() => {
3032
3034
  if (c) {
3033
- const k = d.onCommandExecuted((I) => {
3034
- var R;
3035
- if (I.id !== Cn.id)
3035
+ const w = u.onCommandExecuted((k) => {
3036
+ var I;
3037
+ if (k.id !== _n.id)
3036
3038
  return;
3037
- const x = I.params;
3038
- if (x.extra === "formula-editor" && x.selections.length) {
3039
- const T = x.selections[x.selections.length - 1];
3040
- if (T) {
3041
- const { range: D, primary: L } = T;
3042
- (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), D.unitId = x.unitId, D.sheetId = x.subUnitId;
3043
- const W = n.current === Me.NEED_ADD, X = ((R = y == null ? void 0 : y.getSelectionDataWithStyle()) != null ? R : []).map((re) => re.rangeWithCoord);
3044
- 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);
3045
3047
  }
3046
3048
  }
3047
3049
  });
3048
3050
  return () => {
3049
- k.dispose();
3051
+ w.dispose();
3050
3052
  };
3051
3053
  }
3052
- }, [d, a, n, v, c, N, y]), P(() => {
3054
+ }, [u, a, n, S, c, N, T]), P(() => {
3053
3055
  if (!a)
3054
3056
  return;
3055
- const k = u.textSelection$.subscribe((I) => {
3056
- I.unitId === a.getEditorId() && qr({
3057
+ const w = h.textSelection$.subscribe((k) => {
3058
+ k.unitId === a.getEditorId() && qr({
3057
3059
  unitId: o,
3058
3060
  subUnitId: r,
3059
3061
  refSelections: s.current,
3060
3062
  editor: a,
3061
- refSelectionsService: F,
3062
- refSelectionsRenderService: y,
3063
- sheetSkeletonManagerService: A,
3063
+ refSelectionsService: A,
3064
+ refSelectionsRenderService: T,
3065
+ sheetSkeletonManagerService: F,
3064
3066
  themeService: l,
3065
3067
  univerInstanceService: m,
3066
3068
  currentWorkbook: p
3067
3069
  });
3068
3070
  });
3069
- return () => k.unsubscribe();
3070
- }, [u.textSelection$, a, s, y, F, A, r, l, o, m]);
3071
- }, _c = (e, t, n, o, r, s) => {
3072
- const i = O(pe), c = O(ze), h = O(Te).getRenderById(t), f = O(ne), 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);
3073
3075
  P(() => {
3074
3076
  if (e && m)
3075
3077
  if (n) {
3076
- const d = () => {
3077
- const v = m.getSelectionControls().length;
3078
- for (let S = 1; S <= v; S++)
3078
+ const u = () => {
3079
+ const S = m.getSelectionControls().length;
3080
+ for (let v = 1; v <= S; v++)
3079
3081
  m.clearLastSelection();
3080
3082
  return setTimeout(() => {
3081
3083
  s();
3082
3084
  }, 30);
3083
- }, u = i.onCommandExecuted((v) => {
3084
- v.id === Gn.id && d();
3085
- }), l = f.getCurrentTypeOfUnit$(V.UNIVER_SHEET).subscribe((v) => {
3086
- d();
3085
+ }, h = i.onCommandExecuted((S) => {
3086
+ S.id === Zn.id && u();
3087
+ }), l = f.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe((S) => {
3088
+ u();
3087
3089
  });
3088
3090
  return () => {
3089
- u.dispose(), l.unsubscribe();
3091
+ h.dispose(), l.unsubscribe();
3090
3092
  };
3091
3093
  } else {
3092
- const d = i.beforeCommandExecuted((u) => {
3093
- if (u.id === Gn.id) {
3094
+ const u = i.beforeCommandExecuted((h) => {
3095
+ if (h.id === Zn.id) {
3094
3096
  o(!1), r(), s();
3095
3097
  const l = c.getEditor(fn);
3096
3098
  l == null || l.focus();
3097
3099
  }
3098
3100
  });
3099
3101
  return () => {
3100
- d.dispose();
3102
+ u.dispose();
3101
3103
  };
3102
3104
  }
3103
3105
  }, [e, m]);
3104
- }, Rc = (e, t, n) => {
3105
- const o = O(ye), r = z(!0);
3106
+ }, Ic = (e, t, n) => {
3107
+ const o = y(ye), r = X(!0);
3106
3108
  P(() => {
3107
3109
  if (e) {
3108
3110
  const s = setTimeout(() => {
@@ -3118,24 +3120,24 @@ const fc = (e, t, n, o) => {
3118
3120
  t(s === 0 && n.startsWith(pr.EQUALS), `${n}`);
3119
3121
  }
3120
3122
  }, [n, t]);
3121
- }, Ic = (e, t = [], n) => {
3122
- 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 = () => {
3123
3125
  s([]), c(""), a.current = -1;
3124
3126
  };
3125
3127
  return P(() => {
3126
3128
  if (n && e) {
3127
- const d = n.input$.pipe(Sn(300)).subscribe(() => {
3128
- const u = n.getSelectionRanges();
3129
- if (u.length === 1) {
3130
- const l = h.current.nodes, v = u[0];
3131
- if (v.collapsed) {
3132
- const S = Tn(l, v.startOffset - 1, !1);
3133
- a.current = S;
3134
- 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];
3135
3137
  if (g && typeof g != "string" && g.nodeType === Q.FUNCTION) {
3136
- a.current = S;
3137
- const C = g.token, _ = o.getSearchListByNameFirstLetter(C);
3138
- s(_), c(C);
3138
+ a.current = v;
3139
+ const C = g.token, R = o.getSearchListByNameFirstLetter(C);
3140
+ s(R), c(C);
3139
3141
  return;
3140
3142
  }
3141
3143
  }
@@ -3143,7 +3145,7 @@ const fc = (e, t, n, o) => {
3143
3145
  a.current = -1, c(""), s((l) => l != null && l.length ? [] : l);
3144
3146
  });
3145
3147
  return () => {
3146
- d.unsubscribe();
3148
+ u.unsubscribe();
3147
3149
  };
3148
3150
  }
3149
3151
  }, [n, e]), P(() => {
@@ -3151,98 +3153,98 @@ const fc = (e, t, n, o) => {
3151
3153
  }, [e]), {
3152
3154
  searchList: r,
3153
3155
  searchText: i,
3154
- handlerFormulaReplace: (d, u) => {
3155
- const l = [...h.current.nodes];
3156
+ handlerFormulaReplace: (u, h) => {
3157
+ const l = [...d.current.nodes];
3156
3158
  if (a.current !== -1) {
3157
- const v = l.splice(a.current + 1), S = l.pop() || "";
3158
- let g = (typeof S == "string" ? S.length : S.token.length) - d.length;
3159
- return l.push(d), v[0] !== Ge.OPEN_BRACKET && u !== mr.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 };
3160
3162
  }
3161
3163
  },
3162
3164
  reset: f
3163
3165
  };
3164
- }, Ec = () => {
3165
- }, bc = Ve(yc);
3166
- function yc(e, t) {
3167
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = Ec } = e, c = s.getEditorId(), a = O(zt), h = O(pe), { searchList: f, searchText: m, handlerFormulaReplace: d, reset: u } = Ic(n, o, s), l = le(() => !!f.length, [f]), v = z(void 0), [S, g] = H(0), C = z(!1), [_] = Br(c, l, [m, f]), E = rt({ searchList: f, active: S }), p = (N, M) => {
3168
- const k = d(N, M);
3169
- 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));
3170
3172
  };
3171
3173
  function b(N) {
3172
3174
  C.current && g(N);
3173
3175
  }
3174
- function y() {
3176
+ function T() {
3175
3177
  C.current && g(-1);
3176
3178
  }
3177
3179
  P(() => {
3178
3180
  if (!f.length)
3179
3181
  return;
3180
- const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), k = (I) => {
3181
- const { searchList: x, active: R } = E.current;
3182
- switch (I) {
3183
- case $.ARROW_UP: {
3184
- g((T) => {
3185
- const D = Math.max(0, T - 1);
3186
- 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;
3187
3189
  });
3188
3190
  break;
3189
3191
  }
3190
- case $.ARROW_DOWN: {
3191
- g((T) => {
3192
- const D = Math.min(x.length - 1, T + 1);
3193
- return A(D), D;
3192
+ case L.ARROW_DOWN: {
3193
+ g((_) => {
3194
+ const O = Math.min($.length - 1, _ + 1);
3195
+ return F(O), O;
3194
3196
  });
3195
3197
  break;
3196
3198
  }
3197
- case $.TAB:
3198
- case $.ENTER: {
3199
- const T = x[R];
3200
- p(T.name, T.functionType);
3199
+ case L.TAB:
3200
+ case L.ENTER: {
3201
+ const _ = $[I];
3202
+ p(_.name, _.functionType);
3201
3203
  break;
3202
3204
  }
3203
- case $.ESC: {
3204
- u(), i();
3205
+ case L.ESC: {
3206
+ h(), i();
3205
3207
  break;
3206
3208
  }
3207
3209
  }
3208
3210
  };
3209
- return M.add(h.registerCommand({
3211
+ return M.add(d.registerCommand({
3210
3212
  id: N,
3211
3213
  type: be.OPERATION,
3212
- handler(I, x) {
3213
- const { keyCode: R } = x;
3214
- k(R);
3214
+ handler(k, $) {
3215
+ const { keyCode: I } = $;
3216
+ w(I);
3215
3217
  }
3216
- })), [$.ARROW_UP, $.ARROW_DOWN, $.ENTER, $.ESC, $.TAB].map((I) => ({
3218
+ })), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((k) => ({
3217
3219
  id: N,
3218
- binding: I,
3220
+ binding: k,
3219
3221
  preconditions: () => !0,
3220
3222
  priority: 1e3,
3221
3223
  staticParameters: {
3222
3224
  eventType: xe.Keyboard,
3223
- keyCode: I
3225
+ keyCode: k
3224
3226
  }
3225
- })).forEach((I) => {
3226
- M.add(a.registerShortcut(I));
3227
+ })).forEach((k) => {
3228
+ M.add(a.registerShortcut(k));
3227
3229
  }), () => {
3228
3230
  M.dispose();
3229
3231
  };
3230
3232
  }, [f]);
3231
- function A(N) {
3232
- const M = v.current;
3233
+ function F(N) {
3234
+ const M = S.current;
3233
3235
  if (!M) return;
3234
- const k = M.children[N];
3235
- if (!k) return;
3236
- const x = M.getBoundingClientRect().top, R = M.offsetHeight, T = k.getBoundingClientRect(), D = T.top, L = T.height;
3237
- if (D >= 0 && D > x && D - x + 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)
3238
3240
  return;
3239
- const W = k.offsetTop - (R - L) / 2;
3241
+ const U = w.offsetTop - (I - D) / 2;
3240
3242
  M.scrollTo({
3241
- top: W,
3243
+ top: U,
3242
3244
  behavior: "smooth"
3243
3245
  });
3244
3246
  }
3245
- const F = le(() => {
3247
+ const A = le(() => {
3246
3248
  let N = "";
3247
3249
  return () => {
3248
3250
  clearTimeout(N), C.current = !0, N = setTimeout(() => {
@@ -3250,32 +3252,32 @@ function yc(e, t) {
3250
3252
  }, 300);
3251
3253
  };
3252
3254
  }, []);
3253
- return f.length > 0 && l && /* @__PURE__ */ w(cn, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ w(
3255
+ return f.length > 0 && l && /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: R, direction: "vertical", children: /* @__PURE__ */ x(
3254
3256
  "ul",
3255
3257
  {
3256
3258
  ref: (N) => {
3257
- v.current = N, t && (t.current = N);
3259
+ S.current = N, t && (t.current = N);
3258
3260
  },
3259
3261
  "data-u-comp": "sheets-formula-editor",
3260
- 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),
3261
3263
  children: f.map((N, M) => /* @__PURE__ */ B(
3262
3264
  "li",
3263
3265
  {
3264
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", {
3265
- "univer-bg-gray-200 dark:!univer-bg-gray-600": S === M
3267
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": v === M
3266
3268
  }),
3267
3269
  onMouseEnter: () => b(M),
3268
- onMouseLeave: y,
3269
- onMouseMove: F,
3270
+ onMouseLeave: T,
3271
+ onMouseMove: A,
3270
3272
  onClick: () => {
3271
3273
  p(N.name, N.functionType), s && s.focus();
3272
3274
  },
3273
3275
  children: [
3274
3276
  /* @__PURE__ */ B("span", { className: "univer-block univer-truncate univer-text-xs", children: [
3275
- /* @__PURE__ */ w("span", { className: "univer-text-red-500", children: N.name.substring(0, m.length) }),
3276
- /* @__PURE__ */ w("span", { children: N.name.slice(m.length) })
3277
+ /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: N.name.substring(0, m.length) }),
3278
+ /* @__PURE__ */ x("span", { children: N.name.slice(m.length) })
3277
3279
  ] }),
3278
- /* @__PURE__ */ w(
3280
+ /* @__PURE__ */ x(
3279
3281
  "span",
3280
3282
  {
3281
3283
  className: "univer-block univer-text-xs univer-text-gray-400",
@@ -3289,9 +3291,9 @@ function yc(e, t) {
3289
3291
  }
3290
3292
  ) });
3291
3293
  }
3292
- const Tc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", nr = () => {
3293
- }, Oc = Ve((e, t) => {
3294
- 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;
3295
3297
  const {
3296
3298
  errorText: n,
3297
3299
  initValue: o,
@@ -3299,74 +3301,74 @@ const Tc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", nr = () => {
3299
3301
  subUnitId: s,
3300
3302
  isFocus: i = !0,
3301
3303
  isSupportAcrossSheet: c = !1,
3302
- onFocus: a = nr,
3303
- onBlur: h = nr,
3304
+ onFocus: a = rr,
3305
+ onBlur: d = rr,
3304
3306
  onChange: f,
3305
3307
  onVerify: m,
3306
- className: d,
3307
- editorId: u,
3308
+ className: u,
3309
+ editorId: h,
3308
3310
  moveCursor: l = !0,
3309
- onFormulaSelectingChange: v,
3310
- keyboardEventConfig: S,
3311
+ onFormulaSelectingChange: S,
3312
+ keyboardEventConfig: v,
3311
3313
  onMoveInEditor: g,
3312
3314
  resetSelectionOnBlur: C = !0,
3313
- autoScrollbar: _ = !0,
3315
+ autoScrollbar: R = !0,
3314
3316
  isSingle: E = !0,
3315
3317
  disableSelectionOnClick: p = !1,
3316
3318
  autofocus: b = !0,
3317
- disableContextMenu: y,
3318
- style: A
3319
- } = e, F = O(ze), N = z(null), M = ee(f);
3320
- Ts(t, () => ({
3321
- 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
3322
3324
  }));
3323
- const k = ee(v), I = z(null), x = z(void 0), R = x.current, [T, D] = H(i), L = z(null), W = le(() => u != null ? u : ao(`${Fo}-${Yt(4)}`), []), X = le(() => n !== void 0, [n]), re = O(ne), 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);
3324
3326
  _e(he == null ? void 0 : he.change$);
3325
- const Y = lc(), J = uo.transform.getPlainText((xn = (Mn = he == null ? void 0 : he.getBody()) == null ? void 0 : Mn.dataStream) != null ? xn : ""), ot = rt(J), st = le(() => Tc(J), [J]), Ot = le(() => Y(st), [st, Y]), { isSelecting: Oe, isSelectingRef: Nt } = cc({ unitId: r, subUnitId: s, editorId: W, isFocus: T, disableOnClick: p }), K = z(""), fe = O(Te).getRenderById(W), oe = fe == null ? void 0 : fe.with(_r), ae = oe == null ? void 0 : oe.isFocusing, ge = le(() => re.getCurrentTypeOfUnit$(V.UNIVER_DOC), [re]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === W, He = z([]), G = Oe, we = (kn = (wn = O(cr).getConfig(xr)) == null ? void 0 : wn.functionScreenTips) != null ? kn : !0;
3326
- Es(() => {
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(() => {
3327
3329
  M(J);
3328
3330
  }, [J, M]);
3329
- const it = jr("="), Be = uc(r, s), me = ee((Z, ce = !0, ke, Ne) => {
3330
- if (!x.current) return;
3331
- K.current = Z;
3332
- const xt = Z[0] === "=" ? Z.slice(1) : "", Ae = Y(xt), Gr = Ae.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), wt = it(
3333
- x.current,
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,
3334
3336
  Gr === xt ? Ae : [],
3335
3337
  ce,
3336
3338
  Ne
3337
3339
  );
3338
3340
  if (He.current = wt, ke) {
3339
- const qe = Ne != null ? Ne : R == null ? void 0 : R.getSelectionRanges();
3341
+ const qe = Ne != null ? Ne : I == null ? void 0 : I.getSelectionRanges();
3340
3342
  if ((qe == null ? void 0 : qe.length) !== 1)
3341
3343
  return;
3342
- const Zr = qe[0].startOffset - 1, zr = Tn(Ae, Zr, !1), An = Hr(Ae, zr);
3343
- if (An >= 0) {
3344
- const Fn = wt.splice(An, 1)[0];
3345
- 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);
3346
3348
  }
3347
- Be(T ? wt : [], x.current);
3349
+ Be(_ ? wt : [], $.current);
3348
3350
  }
3349
3351
  });
3350
3352
  P(() => {
3351
- T && me(J, !1, !0);
3352
- }, [T]), P(() => {
3353
- if (T) {
3353
+ _ && me(J, !1, !0);
3354
+ }, [_]), P(() => {
3355
+ if (_) {
3354
3356
  if (K.current === J) return;
3355
3357
  me(J, !1, !0);
3356
3358
  }
3357
- }, [J]), Rc(T, m, J);
3358
- const ie = sc(R), gt = mc(T, r, s);
3359
+ }, [J]), Ic(_, m, J);
3360
+ const ie = ic(I), gt = pc(_, r, s);
3359
3361
  P(() => {
3360
- var Z;
3361
- k(Oe, (Z = oe == null ? void 0 : oe.isFocusing) != null ? Z : !0);
3362
- }, [k, Oe]), Jo(T, S, R), Pt(() => {
3363
- let Z;
3364
- if (L.current) {
3365
- 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({
3366
3368
  autofocus: b,
3367
- editorUnitId: W,
3369
+ editorUnitId: U,
3368
3370
  initialSnapshot: {
3369
- id: W,
3371
+ id: U,
3370
3372
  body: {
3371
3373
  dataStream: `${o}\r
3372
3374
  `,
@@ -3377,176 +3379,176 @@ const Tc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", nr = () => {
3377
3379
  },
3378
3380
  documentStyle: {}
3379
3381
  }
3380
- }, L.current);
3381
- const ce = F.getEditor(W);
3382
- x.current = ce, me(o, !1, !0);
3382
+ }, D.current);
3383
+ const ce = A.getEditor(U);
3384
+ $.current = ce, me(o, !1, !0);
3383
3385
  }
3384
3386
  return () => {
3385
- Z == null || Z.dispose();
3387
+ z == null || z.dispose();
3386
3388
  };
3387
3389
  }, []), Pt(() => {
3388
- i ? (D(i), ie()) : (C && (R == null || R.blur(), gt()), D(i));
3389
- }, [i, R, ie, gt, C]);
3390
- const { checkScrollBar: Jt } = es(R, E, _);
3391
- gc(T, !!(Oe && We), r, W, y), fc(!!(T && ae && l), G, R, g);
3392
- 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) => {
3393
3395
  if (!ae)
3394
3396
  return;
3395
3397
  const Ne = ce !== -1 ? [{ startOffset: ce + 1, endOffset: ce + 1, collapsed: !0 }] : void 0;
3396
- me(`=${Z}`, !0, ke, Ne), ke && (ie(), ce !== -1 && setTimeout(() => {
3397
- const xt = { startOffset: ce + 1, endOffset: ce + 1 }, Ae = R == null ? void 0 : R.render.with(ts);
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);
3398
3400
  Ae == null || Ae.scrollToRange({ ...xt, collapsed: !0 });
3399
3401
  }, 50), Jt());
3400
3402
  });
3401
- Cc(
3402
- T && !!(Oe && We),
3403
- T,
3403
+ _c(
3404
+ _ && !!(Oe && We),
3405
+ _,
3404
3406
  Nt,
3405
3407
  r,
3406
3408
  s,
3407
3409
  He,
3408
3410
  c,
3409
- !!G,
3410
- R,
3411
+ !!Z,
3412
+ I,
3411
3413
  Mt
3412
- ), _c(T && !!(Oe && We), r, c, D, h, () => {
3414
+ ), Rc(_ && !!(Oe && We), r, c, O, d, () => {
3413
3415
  me(ot.current, !1, !0);
3414
3416
  });
3415
- const On = (Z) => {
3416
- if (Z) {
3417
- const ce = R == null ? void 0 : R.getSelectionRanges();
3417
+ const Nn = (z) => {
3418
+ if (z) {
3419
+ const ce = I == null ? void 0 : I.getSelectionRanges();
3418
3420
  if (ce && ce.length === 1) {
3419
3421
  const ke = ce[0];
3420
3422
  if (ke.collapsed) {
3421
- const Ne = Z.offset;
3423
+ const Ne = z.offset;
3422
3424
  setTimeout(() => {
3423
- 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 }]);
3424
3426
  }, 30);
3425
3427
  }
3426
3428
  }
3427
- ie(), me(`=${Z.text}`);
3429
+ ie(), me(`=${z.text}`);
3428
3430
  }
3429
- }, Nn = () => {
3430
- D(!0), a(), ie();
3431
+ }, Mn = () => {
3432
+ O(!0), a(), ie();
3431
3433
  };
3432
- return /* @__PURE__ */ B("div", { className: d, children: [
3433
- /* @__PURE__ */ w(
3434
+ return /* @__PURE__ */ B("div", { className: u, children: [
3435
+ /* @__PURE__ */ x(
3434
3436
  "div",
3435
3437
  {
3436
3438
  ref: N,
3437
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", {
3438
- "univer-ring-primary-500": T,
3439
- "univer-ring-red-500": X
3440
+ "univer-ring-primary-500": _,
3441
+ "univer-ring-red-500": Y
3440
3442
  }),
3441
- children: /* @__PURE__ */ w(
3443
+ children: /* @__PURE__ */ x(
3442
3444
  "div",
3443
3445
  {
3444
- ref: L,
3446
+ ref: D,
3445
3447
  className: "univer-relative univer-h-full univer-w-full",
3446
- onMouseUp: Nn
3448
+ onMouseUp: Mn
3447
3449
  }
3448
3450
  )
3449
3451
  }
3450
3452
  ),
3451
- n !== void 0 && /* @__PURE__ */ w("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }),
3452
- we && R && st !== "" && /* @__PURE__ */ w(
3453
- oc,
3453
+ n !== void 0 && /* @__PURE__ */ x("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }),
3454
+ we && I && st !== "" && /* @__PURE__ */ x(
3455
+ sc,
3454
3456
  {
3455
- editor: R,
3456
- isFocus: T,
3457
+ editor: I,
3458
+ isFocus: _,
3457
3459
  formulaText: J,
3458
3460
  onClose: () => ie()
3459
3461
  }
3460
3462
  ),
3461
- we && !!R && /* @__PURE__ */ w(
3462
- bc,
3463
+ we && !!I && /* @__PURE__ */ x(
3464
+ yc,
3463
3465
  {
3464
- isFocus: T,
3466
+ isFocus: _,
3465
3467
  sequenceNodes: Ot,
3466
- onSelect: On,
3467
- ref: I,
3468
- editor: R
3468
+ onSelect: Nn,
3469
+ ref: k,
3470
+ editor: I
3469
3471
  }
3470
3472
  )
3471
3473
  ] });
3472
3474
  });
3473
- function Nc(e, t, n, o) {
3474
- const r = O(ye), s = jr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), h = O(Do), f = z(""), m = O(ne);
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);
3475
3477
  return P(() => {
3476
3478
  if (!e) return;
3477
- const d = e.getDocumentDataModel().getPlainText();
3478
- if (f.current === d)
3479
+ const u = e.getDocumentDataModel().getPlainText();
3480
+ if (f.current === u)
3479
3481
  return;
3480
- f.current = d;
3481
- const u = r.sequenceNodesBuilder(d);
3482
- a(u != null ? u : []);
3482
+ f.current = u;
3483
+ const h = r.sequenceNodesBuilder(u);
3484
+ a(h != null ? h : []);
3483
3485
  }, [i, e, r]), P(() => {
3484
- var l, v;
3486
+ var l, S;
3485
3487
  if (!e) return;
3486
3488
  if (!t) {
3487
- const S = e.getDocumentData();
3489
+ const v = e.getDocumentData();
3488
3490
  e.setDocumentData({
3489
- ...S,
3491
+ ...v,
3490
3492
  body: {
3491
- ...S.body,
3492
- 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 : "",
3493
3495
  textRuns: []
3494
3496
  }
3495
3497
  });
3496
3498
  return;
3497
3499
  }
3498
- const d = s(e, c, !1), u = new Ye();
3499
- return d.forEach((S) => {
3500
- const g = ht(S.token), C = m.getCurrentUnitForType(V.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3501
- 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)
3502
3504
  return;
3503
- const E = new mn(S.themeColor).toRgb(), p = h.addShape({
3505
+ const E = new mn(v.themeColor).toRgb(), p = d.addShape({
3504
3506
  range: g.range,
3505
3507
  style: {
3506
- stroke: S.themeColor,
3508
+ stroke: v.themeColor,
3507
3509
  fill: `rgba(${E.r}, ${E.g}, ${E.b}, 0.1)`,
3508
3510
  strokeDash: 12
3509
3511
  },
3510
3512
  primary: null
3511
3513
  });
3512
- p && u.add(() => h.removeShape(p));
3514
+ p && h.add(() => d.removeShape(p));
3513
3515
  }), () => {
3514
- u.dispose();
3516
+ h.dispose();
3515
3517
  };
3516
- }, [e, t, s, h, c]), { sequenceNodes: c };
3517
- }
3518
- function Mc(e) {
3519
- const t = O(vn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = O(ne).getUnit(r, V.UNIVER_SHEET), h = ee(i), f = ee((m, d) => {
3520
- const u = a == null ? void 0 : a.getActiveSheet();
3521
- if (!u || !n && u.getSheetId() !== s || !(m != null && m.length)) return;
3522
- const l = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), v = m.map((S) => ({
3523
- 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,
3524
3526
  unitId: r,
3525
3527
  sheetName: l
3526
3528
  }));
3527
- h(v, d);
3529
+ d(S, u);
3528
3530
  });
3529
3531
  P(() => {
3530
3532
  const m = new Ye();
3531
- return m.add(t.selectionMoveStart$.subscribe((d) => {
3532
- f(d, !0);
3533
- })), m.add(t.selectionMoving$.subscribe((d) => {
3534
- f(d, !1);
3535
- })), m.add(t.selectionMoveEnd$.subscribe((d) => {
3536
- 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);
3537
3539
  })), () => {
3538
3540
  m.dispose();
3539
3541
  };
3540
3542
  }, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3541
3543
  }
3542
- const rr = (e) => !e.some((n) => {
3544
+ const or = (e) => !e.some((n) => {
3543
3545
  if (typeof n == "string") {
3544
3546
  if (n !== Ge.COMMA)
3545
3547
  return !0;
3546
3548
  } else if (n.nodeType !== Q.REFERENCE)
3547
3549
  return !0;
3548
3550
  return !1;
3549
- }), xc = (e) => {
3551
+ }), wc = (e) => {
3550
3552
  if (e.endColumn < e.startColumn) {
3551
3553
  const t = e.endColumn;
3552
3554
  e.endColumn = e.startColumn, e.startColumn = t;
@@ -3557,7 +3559,7 @@ const rr = (e) => !e.some((n) => {
3557
3559
  }
3558
3560
  return e;
3559
3561
  };
3560
- function wc(e) {
3562
+ function kc(e) {
3561
3563
  const {
3562
3564
  visible: t,
3563
3565
  initialValue: n,
@@ -3567,25 +3569,25 @@ function wc(e) {
3567
3569
  supportAcrossSheet: i,
3568
3570
  keepSheetReference: c,
3569
3571
  onConfirm: a,
3570
- onClose: h,
3572
+ onClose: d,
3571
3573
  onShowBySelection: f
3572
- } = 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);
3573
3575
  P(() => {
3574
3576
  if (t && n.length) {
3575
3577
  const p = n.map((b) => b.sheetName ? _t(b.sheetName, b.range) : Ee(b.range));
3576
- l(p), S(p.length - 1);
3578
+ l(p), v(p.length - 1);
3577
3579
  } else
3578
- l([""]), S(0);
3580
+ l([""]), v(0);
3579
3581
  }, [t]);
3580
3582
  const C = (p, b) => {
3581
- const y = [...u];
3582
- y[p] = b, l(y);
3583
- }, _ = () => {
3584
- l([...u, ""]), S(u.length);
3583
+ const T = [...h];
3584
+ T[p] = b, l(T);
3585
+ }, R = () => {
3586
+ l([...h, ""]), v(h.length);
3585
3587
  }, E = (p) => {
3586
- u.splice(p, 1), l([...u]);
3588
+ h.splice(p, 1), l([...h]);
3587
3589
  };
3588
- return Mc({
3590
+ return xc({
3589
3591
  unitId: o,
3590
3592
  subUnitId: r,
3591
3593
  supportAcrossSheet: i,
@@ -3593,24 +3595,24 @@ function wc(e) {
3593
3595
  onChange: (p, b) => {
3594
3596
  if (!t && f != null && f(p))
3595
3597
  return;
3596
- 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));
3597
- if (!F.length) return;
3598
- const N = [...u];
3599
- if (A.length > 1) {
3600
- 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);
3601
3603
  const M = N.slice(0, s);
3602
- l(M), S(M.length - 1), requestAnimationFrame(() => {
3603
- var k;
3604
- (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 });
3605
3607
  });
3606
3608
  } else {
3607
- N.splice(v, 1, ...F);
3609
+ N.splice(S, 1, ...A);
3608
3610
  const M = N.slice(0, s);
3609
- l(M), S(v + F.length - 1);
3611
+ l(M), v(S + A.length - 1);
3610
3612
  }
3611
3613
  }
3612
- }), /* @__PURE__ */ w(
3613
- ws,
3614
+ }), /* @__PURE__ */ x(
3615
+ ks,
3614
3616
  {
3615
3617
  width: "328px",
3616
3618
  open: t,
@@ -3619,48 +3621,48 @@ function wc(e) {
3619
3621
  mask: !1,
3620
3622
  maskClosable: !1,
3621
3623
  footer: /* @__PURE__ */ B("footer", { className: "univer-flex univer-gap-2", children: [
3622
- /* @__PURE__ */ w(at, { onClick: h, children: m.t("rangeSelector.cancel") }),
3623
- /* @__PURE__ */ w(
3624
+ /* @__PURE__ */ x(at, { onClick: d, children: m.t("rangeSelector.cancel") }),
3625
+ /* @__PURE__ */ x(
3624
3626
  at,
3625
3627
  {
3626
3628
  variant: "primary",
3627
3629
  onClick: () => {
3628
3630
  a(
3629
- u.filter((p) => {
3630
- const b = d.sequenceNodesBuilder(p);
3631
+ h.filter((p) => {
3632
+ const b = u.sequenceNodesBuilder(p);
3631
3633
  return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === Q.REFERENCE;
3632
- }).map((p) => ht(p)).map((p) => ({ ...p, range: xc(p.range) }))
3634
+ }).map((p) => ht(p)).map((p) => ({ ...p, range: wc(p.range) }))
3633
3635
  );
3634
3636
  },
3635
3637
  children: m.t("rangeSelector.confirm")
3636
3638
  }
3637
3639
  )
3638
3640
  ] }),
3639
- onClose: h,
3641
+ onClose: d,
3640
3642
  children: /* @__PURE__ */ B(
3641
3643
  "div",
3642
3644
  {
3643
3645
  ref: g,
3644
3646
  className: se("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3645
3647
  children: [
3646
- u.map((p, b) => /* @__PURE__ */ B(
3648
+ h.map((p, b) => /* @__PURE__ */ B(
3647
3649
  "div",
3648
3650
  {
3649
3651
  className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
3650
3652
  children: [
3651
- /* @__PURE__ */ w(
3653
+ /* @__PURE__ */ x(
3652
3654
  yr,
3653
3655
  {
3654
3656
  className: se("univer-w-full", {
3655
- "univer-border-primary-600": v === b
3657
+ "univer-border-primary-600": S === b
3656
3658
  }),
3657
3659
  placeholder: m.t("rangeSelector.placeHolder"),
3658
- onFocus: () => S(b),
3660
+ onFocus: () => v(b),
3659
3661
  value: p,
3660
- onChange: (y) => C(b, y)
3662
+ onChange: (T) => C(b, T)
3661
3663
  }
3662
3664
  ),
3663
- u.length > 1 && /* @__PURE__ */ w(
3665
+ h.length > 1 && /* @__PURE__ */ x(
3664
3666
  $r,
3665
3667
  {
3666
3668
  className: "univer-cursor-pointer",
@@ -3671,9 +3673,9 @@ function wc(e) {
3671
3673
  },
3672
3674
  b
3673
3675
  )),
3674
- u.length < s && /* @__PURE__ */ w("div", { children: /* @__PURE__ */ B(at, { variant: "link", onClick: _, children: [
3675
- /* @__PURE__ */ w(Pr, {}),
3676
- /* @__PURE__ */ w("span", { children: m.t("rangeSelector.addAnotherRange") })
3676
+ h.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ B(at, { variant: "link", onClick: R, children: [
3677
+ /* @__PURE__ */ x(Pr, {}),
3678
+ /* @__PURE__ */ x("span", { children: m.t("rangeSelector.addAnotherRange") })
3677
3679
  ] }) })
3678
3680
  ]
3679
3681
  }
@@ -3681,10 +3683,10 @@ function wc(e) {
3681
3683
  }
3682
3684
  );
3683
3685
  }
3684
- function kc(e) {
3686
+ function Ac(e) {
3685
3687
  return e.split(Ge.COMMA).filter((t) => !!t).map((t) => ht(t));
3686
3688
  }
3687
- function Ac(e) {
3689
+ function Fc(e) {
3688
3690
  return e.map((t) => t.sheetName ? _t(t.sheetName, t.range) : Ee(t.range)).join(Ge.COMMA);
3689
3691
  }
3690
3692
  function Kr(e) {
@@ -3695,20 +3697,20 @@ function Kr(e) {
3695
3697
  subUnitId: i,
3696
3698
  maxRangeCount: c,
3697
3699
  supportAcrossSheet: a,
3698
- keepSheetReference: h,
3700
+ keepSheetReference: d,
3699
3701
  autoFocus: f,
3700
3702
  onChange: m,
3701
- onRangeSelectorDialogVisibleChange: d,
3702
- onClickOutside: u,
3703
+ onRangeSelectorDialogVisibleChange: u,
3704
+ onClickOutside: h,
3703
3705
  onFocusChange: l,
3704
- forceShowDialogWhenSelectionChanged: v,
3705
- hideEditor: S,
3706
+ forceShowDialogWhenSelectionChanged: S,
3707
+ hideEditor: v,
3706
3708
  resetRange: g
3707
- } = e, [C, _] = H(f != null ? f : !1), [E, p] = H(!1), [b, y] = H([]), A = O(dt), F = O(ze), { sequenceNodes: N } = Nc(t, C, s, i), M = rt(N), k = O(pe), I = ee(() => {
3708
- t == null || t.setSelectionRanges([]), t == null || t.blur(), F.blur();
3709
- }), x = ee(() => {
3710
- var R;
3711
- I(), y(kc((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);
3712
3714
  });
3713
3715
  return P(() => {
3714
3716
  r && (r.current = {
@@ -3716,85 +3718,85 @@ function Kr(e) {
3716
3718
  return t;
3717
3719
  },
3718
3720
  focus() {
3719
- F.focus(t.getEditorId());
3721
+ A.focus(t.getEditorId());
3720
3722
  },
3721
- blur: I,
3722
- verify: () => rr(M.current),
3723
- showDialog: (R) => {
3724
- I(), y(R), p(!0);
3723
+ blur: k,
3724
+ verify: () => or(M.current),
3725
+ showDialog: (I) => {
3726
+ k(), T(I), p(!0);
3725
3727
  },
3726
3728
  hideDialog: () => {
3727
- y([]), p(!1);
3729
+ T([]), p(!1);
3728
3730
  },
3729
3731
  getValue: () => {
3730
- var R;
3731
- 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 : "";
3732
3734
  }
3733
3735
  });
3734
- }, [I, t, F, r, M]), P(() => {
3735
- var R;
3736
- o == null || o(rr(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 : "");
3737
3739
  }, [N]), P(() => {
3738
- d == null || d(E);
3740
+ u == null || u(E);
3739
3741
  }, [E]), P(() => {
3740
3742
  if (E && g)
3741
3743
  return () => {
3742
- const R = {
3744
+ const I = {
3743
3745
  unitId: s,
3744
3746
  subUnitId: i,
3745
3747
  selections: g
3746
3748
  };
3747
- k.executeCommand(Cn.id, R);
3749
+ w.executeCommand(_n.id, I);
3748
3750
  };
3749
- }, [E]), /* @__PURE__ */ B(ys, { children: [
3750
- S ? null : /* @__PURE__ */ w(
3751
+ }, [E]), /* @__PURE__ */ B(Ts, { children: [
3752
+ v ? null : /* @__PURE__ */ x(
3751
3753
  ns,
3752
3754
  {
3753
3755
  isSingle: !0,
3754
3756
  ...e,
3755
- onFocusChange: (R, T) => {
3756
- _(R), l == null || l(R, T);
3757
+ onFocusChange: (I, _) => {
3758
+ R(I), l == null || l(I, _);
3757
3759
  },
3758
3760
  editorRef: n,
3759
3761
  onClickOutside: () => {
3760
- _(!1), I(), u == null || u();
3762
+ R(!1), k(), h == null || h();
3761
3763
  },
3762
- icon: /* @__PURE__ */ w(xs, { title: A.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ w(
3764
+ icon: /* @__PURE__ */ x(ws, { title: F.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
3763
3765
  Vr,
3764
3766
  {
3765
3767
  className: "univer-cursor-pointer dark:!univer-text-gray-300",
3766
- onClick: x
3768
+ onClick: $
3767
3769
  }
3768
3770
  ) })
3769
3771
  }
3770
3772
  ),
3771
- /* @__PURE__ */ w(
3772
- wc,
3773
+ /* @__PURE__ */ x(
3774
+ kc,
3773
3775
  {
3774
3776
  initialValue: b,
3775
3777
  unitId: s,
3776
3778
  subUnitId: i,
3777
3779
  visible: E,
3778
3780
  maxRangeCount: c,
3779
- onConfirm: (R) => {
3780
- const T = Ac(R), D = ho.newEmptyData();
3781
- D.body.dataStream = T, t == null || t.replaceText(T, !1), m == null || m(D, T), p(!1), y([]), requestAnimationFrame(() => {
3782
- 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();
3783
3785
  });
3784
3786
  },
3785
3787
  onClose: () => {
3786
- p(!1), y([]);
3788
+ p(!1), T([]);
3787
3789
  },
3788
3790
  supportAcrossSheet: a,
3789
- keepSheetReference: h,
3790
- onShowBySelection: (R) => C || v ? (y(R), p(!0), !1) : !0
3791
+ keepSheetReference: d,
3792
+ onShowBySelection: (I) => C || S ? (T(I), p(!0), !1) : !0
3791
3793
  }
3792
3794
  )
3793
3795
  ] });
3794
3796
  }
3795
- const Fc = () => {
3797
+ const Dc = () => {
3796
3798
  var o, r;
3797
- const e = O(Wr), t = _e(e.currentSelector$), n = z(null);
3799
+ const e = y(Wr), t = _e(e.currentSelector$), n = X(null);
3798
3800
  return P(() => {
3799
3801
  var s, i;
3800
3802
  if (t)
@@ -3802,7 +3804,7 @@ const Fc = () => {
3802
3804
  var c;
3803
3805
  (c = n.current) == null || c.hideDialog();
3804
3806
  };
3805
- }, [t]), /* @__PURE__ */ w(
3807
+ }, [t]), /* @__PURE__ */ x(
3806
3808
  Kr,
3807
3809
  {
3808
3810
  unitId: (o = t == null ? void 0 : t.unitId) != null ? o : "",
@@ -3816,16 +3818,16 @@ const Fc = () => {
3816
3818
  }
3817
3819
  );
3818
3820
  };
3819
- var Dc = Object.defineProperty, Lc = Object.getOwnPropertyDescriptor, $c = (e, t, n) => t in e ? Dc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Pc = (e, t, n, o) => {
3820
- for (var r = o > 1 ? void 0 : o ? Lc(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--)
3821
3823
  (i = e[s]) && (r = i(r) || r);
3822
3824
  return r;
3823
- }, Dt = (e, t) => (n, o) => t(n, o, e), Yr = (e, t, n) => $c(e, typeof t != "symbol" ? t + "" : t, n);
3825
+ }, Dt = (e, t) => (n, o) => t(n, o, e), Yr = (e, t, n) => Pc(e, typeof t != "symbol" ? t + "" : t, n);
3824
3826
  let Kt = class extends go {
3825
- constructor(e = Qn, t, n, o, r) {
3827
+ constructor(e = Jn, t, n, o, r) {
3826
3828
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3827
3829
  const { menu: s, ...i } = mo(
3828
- Qn,
3830
+ Jn,
3829
3831
  this._config
3830
3832
  );
3831
3833
  s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(xr, i, { merge: !0 });
@@ -3847,14 +3849,14 @@ let Kt = class extends go {
3847
3849
  [
3848
3850
  [Le]
3849
3851
  ].forEach((e) => {
3850
- this.disposeWithMe(this._renderManagerService.registerRenderModule(V.UNIVER_SHEET, e));
3852
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3851
3853
  });
3852
3854
  }
3853
3855
  onRendered() {
3854
3856
  [
3855
3857
  [an]
3856
3858
  ].forEach((e) => {
3857
- this.disposeWithMe(this._renderManagerService.registerRenderModule(V.UNIVER_SHEET, e));
3859
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(W.UNIVER_SHEET, e));
3858
3860
  }), So(this._injector, [
3859
3861
  [qt],
3860
3862
  // FormulaProgressBar relies on TriggerCalculationController, but it is necessary to ensure that the formula calculation is done after rendered.
@@ -3868,32 +3870,32 @@ let Kt = class extends go {
3868
3870
  }
3869
3871
  _initUIPart() {
3870
3872
  const e = this._injector.get(Er);
3871
- this.disposeWithMe(e.register(Lo, Kr)), this.disposeWithMe(e.register($o, Oc)), this.disposeWithMe(this._uiPartsService.registerComponent(bs.GLOBAL, () => br(Fc, this._injector)));
3873
+ this.disposeWithMe(e.register(Lo, Kr)), this.disposeWithMe(e.register($o, Nc)), this.disposeWithMe(this._uiPartsService.registerComponent(ys.GLOBAL, () => br(Dc, this._injector)));
3872
3874
  }
3873
3875
  };
3874
3876
  Yr(Kt, "pluginName", Or);
3875
- Yr(Kt, "type", V.UNIVER_SHEET);
3876
- Kt = Pc([
3877
- fo(vs),
3877
+ Yr(Kt, "type", W.UNIVER_SHEET);
3878
+ Kt = Uc([
3879
+ fo(Cs),
3878
3880
  Dt(1, q(It)),
3879
3881
  Dt(2, Te),
3880
- Dt(3, cr),
3882
+ Dt(3, pn),
3881
3883
  Dt(4, Ir)
3882
3884
  ], Kt);
3883
3885
  export {
3884
- Ls as FORMULA_PROMPT_ACTIVATED,
3885
- Oc as FormulaEditor,
3886
+ $s as FORMULA_PROMPT_ACTIVATED,
3887
+ Nc as FormulaEditor,
3886
3888
  Ut as FormulaReorderController,
3887
3889
  Wr as GlobalRangeSelectorService,
3888
- $s as HelpFunctionOperation,
3890
+ Ps as HelpFunctionOperation,
3889
3891
  ve as InsertFunctionOperation,
3890
- yn as MoreFunctionsOperation,
3892
+ Tn as MoreFunctionsOperation,
3891
3893
  Kr as RangeSelector,
3892
3894
  Le as RefSelectionsRenderService,
3893
3895
  Mr as ReferenceAbsoluteOperation,
3894
- qs as SearchFunctionOperation,
3896
+ js as SearchFunctionOperation,
3895
3897
  ft as SelectEditorFormulaOperation,
3896
- En as SheetCopyFormulaOnlyCommand,
3897
- bn as SheetOnlyPasteFormulaCommand,
3898
+ bn as SheetCopyFormulaOnlyCommand,
3899
+ yn as SheetOnlyPasteFormulaCommand,
3898
3900
  Kt as UniverSheetsFormulaUIPlugin
3899
3901
  };