@univerjs/sheets 0.1.0-beta.5 → 0.1.2

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,9 +1,9 @@
1
1
  var uo = Object.defineProperty;
2
2
  var lo = (t, e, o) => e in t ? uo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
3
  var F = (t, e, o) => (lo(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- import { ThemeService as go, createInterceptorKey as It, OnLifecycle as De, LifecycleStages as Me, Disposable as ke, toDisposable as le, remove as nn, composeInterceptors as ho, DisposableCollection as At, IUniverInstanceService as C, CommandType as I, ObjectMatrix as ne, CellValueType as _e, Tools as D, ICommandService as M, IUndoRedoService as B, sequenceExecute as q, LocaleService as Lt, selectionToArray as mo, Rectangle as E, RANGE_TYPE as G, ErrorService as Rt, Range as ge, isICellData as fo, Dimension as ue, getArrayLength as fn, insertMatrixArray as ft, spliceArray as vn, sliceMatrixArray as Cn, concatMatrixArray as Sn, ILogService as Vt, BooleanNumber as X, Direction as $e, mergeWorksheetSnapshotWithDefault as vo, moveMatrixArray as In, BorderType as re, BorderStyleTypes as Co, FontWeight as So, FontItalic as Io, runOnLifecycle as Ro, IConfigService as po, InterceptorManager as wo, IResourceManagerService as Mo, RefAlias as Ut, PermissionPoint as _o, IPermissionService as yo, UniverEditablePermissionPoint as on, getTypeFromPermissionItemList as bo, Plugin as Uo, PluginType as Do, ColorKit as ko, makeCellRangeToRangeData as Oo } from "@univerjs/core";
5
- import { Inject as te, createIdentifier as Po, Injector as Rn } from "@wendellhu/redi";
6
- import { Subject as Et, BehaviorSubject as pn, Observable as Ao } from "rxjs";
4
+ import { ThemeService as go, createInterceptorKey as Rt, OnLifecycle as De, LifecycleStages as Me, Disposable as ke, toDisposable as le, remove as on, composeInterceptors as ho, DisposableCollection as Et, IUniverInstanceService as C, CommandType as I, ObjectMatrix as ne, CellValueType as ye, Tools as b, ICommandService as M, IUndoRedoService as B, sequenceExecute as q, LocaleService as Vt, selectionToArray as mo, Rectangle as E, RANGE_TYPE as G, ErrorService as pt, Range as ge, isICellData as fo, Dimension as ue, getArrayLength as vn, insertMatrixArray as vt, spliceArray as Cn, sliceMatrixArray as Sn, concatMatrixArray as In, ILogService as Bt, BooleanNumber as X, Direction as $e, mergeWorksheetSnapshotWithDefault as vo, moveMatrixArray as Rn, BorderType as re, BorderStyleTypes as Co, FontWeight as So, FontItalic as Io, runOnLifecycle as Ro, IConfigService as po, InterceptorManager as wo, IResourceManagerService as Mo, RefAlias as Dt, PermissionPoint as yo, IPermissionService as _o, UniverEditablePermissionPoint as rn, getTypeFromPermissionItemList as bo, Plugin as Uo, PluginType as Do, ColorKit as ko, makeCellRangeToRangeData as Oo } from "@univerjs/core";
5
+ import { Inject as te, createIdentifier as Ao, Injector as pn } from "@wendellhu/redi";
6
+ import { Subject as Nt, BehaviorSubject as wn, Observable as Po } from "rxjs";
7
7
  import { SetFormulaCalculationResultMutation as Eo, FormulaDataModel as No, IFeatureCalculationManagerService as xo } from "@univerjs/engine-formula";
8
8
  import { map as To } from "rxjs/operators";
9
9
  import { getCellInfoInMergeData as Lo } from "@univerjs/engine-render";
@@ -24,11 +24,11 @@ let L = class {
24
24
  constructor(t) {
25
25
  F(this, "_selectionInfo", /* @__PURE__ */ new Map());
26
26
  F(this, "_currentSelection", null);
27
- F(this, "_selectionMoveStart$", new Et());
27
+ F(this, "_selectionMoveStart$", new Nt());
28
28
  F(this, "selectionMoveStart$", this._selectionMoveStart$.asObservable());
29
- F(this, "_selectionMoving$", new Et());
29
+ F(this, "_selectionMoving$", new Nt());
30
30
  F(this, "selectionMoving$", this._selectionMoving$.asObservable());
31
- F(this, "_selectionMoveEnd$", new pn(null));
31
+ F(this, "_selectionMoveEnd$", new wn(null));
32
32
  F(this, "selectionMoveEnd$", this._selectionMoveEnd$.asObservable());
33
33
  F(this, "_dirty", !0);
34
34
  this._themeService = t;
@@ -238,7 +238,7 @@ let L = class {
238
238
  L = Wo([
239
239
  jo(0, te(go))
240
240
  ], L);
241
- const $o = It("CELL_CONTENT"), Ho = It("PERMISSION"), qe = {
241
+ const $o = Rt("CELL_CONTENT"), Ho = Rt("PERMISSION"), qe = {
242
242
  CELL_CONTENT: $o,
243
243
  PERMISSION: Ho
244
244
  };
@@ -286,7 +286,7 @@ let $ = class extends ke {
286
286
  return this._commandInterceptors.push(e), this._commandInterceptors.sort((o, n) => {
287
287
  var r, i;
288
288
  return ((r = n.priority) != null ? r : 0) - ((i = o.priority) != null ? i : 0);
289
- }), this.disposeWithMe(le(() => nn(this._commandInterceptors, e)));
289
+ }), this.disposeWithMe(le(() => on(this._commandInterceptors, e)));
290
290
  }
291
291
  /**
292
292
  * When command is executing, call this method to gether undo redo mutations from upper features.
@@ -310,24 +310,24 @@ let $ = class extends ke {
310
310
  var a, c;
311
311
  return ((a = s.priority) != null ? a : 0) - ((c = i.priority) != null ? c : 0);
312
312
  })
313
- ), this.disposeWithMe(le(() => nn(this._interceptorsByName.get(n), o)));
313
+ ), this.disposeWithMe(le(() => on(this._interceptorsByName.get(n), o)));
314
314
  }
315
315
  fetchThroughInterceptors(e) {
316
316
  const o = e, n = this._interceptorsByName.get(o);
317
317
  return ho(n || []);
318
318
  }
319
319
  _interceptWorkbook(e) {
320
- const o = new At(), n = e.getUnitId(), r = this, i = (s) => {
320
+ const o = new Et(), n = e.getUnitId(), r = this, i = (s) => {
321
321
  const a = s.getSheetId();
322
322
  s.__interceptViewModel((c) => {
323
- const l = new At(), u = c.registerCellContentInterceptor({
324
- getCell(d, g) {
323
+ const d = new Et(), u = c.registerCellContentInterceptor({
324
+ getCell(l, g) {
325
325
  return r.fetchThroughInterceptors(qe.CELL_CONTENT)(
326
- s.getCellRaw(d, g),
326
+ s.getCellRaw(l, g),
327
327
  {
328
328
  unitId: n,
329
329
  subUnitId: a,
330
- row: d,
330
+ row: l,
331
331
  col: g,
332
332
  worksheet: s,
333
333
  workbook: e
@@ -335,7 +335,7 @@ let $ = class extends ke {
335
335
  );
336
336
  }
337
337
  });
338
- l.add(u), r._worksheetDisposables.set(rn(n, s), l);
338
+ d.add(u), r._worksheetDisposables.set(sn(n, s), d);
339
339
  });
340
340
  };
341
341
  e.getSheets().forEach((s) => i(s)), o.add(le(e.sheetCreated$.subscribe((s) => i(s)))), o.add(
@@ -353,7 +353,7 @@ let $ = class extends ke {
353
353
  n && (n.dispose(), this._workbookDisposables.delete(o));
354
354
  }
355
355
  _disposeSheetInterceptor(e, o) {
356
- const n = rn(e, o), r = this._worksheetDisposables.get(n);
356
+ const n = sn(e, o), r = this._worksheetDisposables.get(n);
357
357
  r && (r.dispose(), this._worksheetDisposables.delete(n));
358
358
  }
359
359
  };
@@ -361,7 +361,7 @@ $ = qo([
361
361
  De(Me.Starting, $),
362
362
  Ko(0, C)
363
363
  ], $);
364
- function rn(t, e) {
364
+ function sn(t, e) {
365
365
  return `${t}|${e.getSheetId()}`;
366
366
  }
367
367
  const Oe = (t, e) => {
@@ -371,9 +371,9 @@ const Oe = (t, e) => {
371
371
  const a = s.getSheetBySheetId(n);
372
372
  if (a == null)
373
373
  throw new Error("worksheet is null error!");
374
- const c = a.getCellMatrix(), l = s.getStyles(), u = new ne();
374
+ const c = a.getCellMatrix(), d = s.getStyles(), u = new ne();
375
375
  return new ne(r).forValue((g, m, h) => {
376
- const f = D.deepClone(c == null ? void 0 : c.getValue(g, m)) || {}, v = l.getStyleByCell(f), S = Yo(v, h && h.s ? h.s : null);
376
+ const f = b.deepClone(c == null ? void 0 : c.getValue(g, m)) || {}, v = d.getStyleByCell(f), S = Yo(v, h && h.s ? h.s : null);
377
377
  f.s = S, u.setValue(g, m, Jo(f));
378
378
  }), {
379
379
  ...e,
@@ -394,25 +394,25 @@ const Q = {
394
394
  const a = s.getSheetBySheetId(n);
395
395
  if (!a)
396
396
  return !1;
397
- const c = a.getCellMatrix(), l = s.getStyles();
398
- return new ne(o).forValue((d, g, m) => {
397
+ const c = a.getCellMatrix(), d = s.getStyles();
398
+ return new ne(o).forValue((l, g, m) => {
399
399
  if (!m)
400
- c == null || c.setValue(d, g, {});
400
+ c == null || c.setValue(l, g, {});
401
401
  else {
402
- const h = c.getValue(d, g) || {}, f = m.t === _e.FORCE_STRING ? m.t : Xo(m.v === void 0 ? h.v : m.v);
403
- if (m.f !== void 0 && (h.f = m.f), m.si !== void 0 && (h.si = m.si), m.p !== void 0 && (h.p = m.p), m.v !== void 0 && (h.v = f === _e.NUMBER ? Number(m.v) : m.v), h.v !== void 0 && (h.t = f), m.s !== void 0) {
404
- const v = l.getStyleByCell(h);
405
- v == null && delete h.s, typeof m.s == "string" && (m.s = l.get(m.s));
406
- const S = wn(v, m.s ? m.s : null);
407
- S && D.removeNull(S), D.isEmptyObject(S) ? delete h.s : h.s = l.setValue(S), !m.p && h.p && er(h.p, m.s ? m.s : null);
402
+ const h = c.getValue(l, g) || {}, f = m.t === ye.FORCE_STRING ? m.t : Xo(m.v === void 0 ? h.v : m.v);
403
+ if (m.f !== void 0 && (h.f = m.f), m.si !== void 0 && (h.si = m.si), m.p !== void 0 && (h.p = m.p), m.v !== void 0 && (h.v = f === ye.NUMBER ? Number(m.v) : m.v), h.v !== void 0 && (h.t = f), m.s !== void 0) {
404
+ const v = d.getStyleByCell(h);
405
+ v == null && delete h.s, typeof m.s == "string" && (m.s = d.get(m.s));
406
+ const S = ct(v, m.s ? m.s : null);
407
+ S && b.removeNull(S), b.isEmptyObject(S) ? delete h.s : h.s = d.setValue(S), !m.p && h.p && er(h.p, m.s ? m.s : null);
408
408
  }
409
- c.setValue(d, g, D.removeNull(h));
409
+ c.setValue(l, g, b.removeNull(h));
410
410
  }
411
411
  }), !0;
412
412
  }
413
413
  };
414
414
  function Xo(t) {
415
- return t === null ? null : typeof t == "string" ? nr(t) ? _e.NUMBER : or(t) ? _e.BOOLEAN : _e.STRING : typeof t == "number" ? _e.NUMBER : typeof t == "boolean" ? _e.BOOLEAN : _e.FORCE_STRING;
415
+ return t === null ? null : typeof t == "string" ? nr(t) ? ye.NUMBER : or(t) ? ye.BOOLEAN : ye.STRING : typeof t == "number" ? ye.NUMBER : typeof t == "boolean" ? ye.BOOLEAN : ye.FORCE_STRING;
416
416
  }
417
417
  function Yo(t, e) {
418
418
  return Zo(t, e);
@@ -432,12 +432,12 @@ function Qo(t, e) {
432
432
  o in t || (t[o] = null);
433
433
  return t;
434
434
  }
435
- function wn(t, e, o = !1) {
435
+ function ct(t, e, o = !1) {
436
436
  if (e === null)
437
437
  return e;
438
438
  if (e === void 0)
439
439
  return t;
440
- const n = D.deepClone(t) || {};
440
+ const n = b.deepClone(t) || {};
441
441
  if (n) {
442
442
  for (const r in e)
443
443
  o && ["bd", "tr", "td", "ht", "vt", "tb", "pd"].includes(r) || (r in n && r === "bd" ? n[r] = Object.assign(n[r], e[r]) : n[r] = e[r]);
@@ -445,12 +445,35 @@ function wn(t, e, o = !1) {
445
445
  }
446
446
  }
447
447
  function er(t, e) {
448
- var o, n;
449
- (n = (o = t.body) == null ? void 0 : o.textRuns) == null || n.forEach((r) => {
450
- r.ts || (r.ts = {});
451
- const i = r.ts || {}, s = wn(i, e, !0);
452
- s && D.removeNull(s), D.isEmptyObject(s) ? delete r.ts : r.ts = s;
453
- });
448
+ if (t.body == null)
449
+ return;
450
+ Array.isArray(t.body.textRuns) || (t.body.textRuns = []);
451
+ let o = 0;
452
+ const n = [];
453
+ for (const i of t.body.textRuns) {
454
+ const { st: s, ed: a, ts: c = {} } = i;
455
+ if (o !== s) {
456
+ const d = {
457
+ st: o,
458
+ ed: s
459
+ }, u = ct({}, e, !0);
460
+ u && b.removeNull(u), b.isEmptyObject(u) || (d.ts = u), n.push(d);
461
+ } else {
462
+ const d = ct(c, e, !0);
463
+ d && b.removeNull(d), b.isEmptyObject(d) ? delete i.ts : i.ts = d, n.push(i);
464
+ }
465
+ o = a;
466
+ }
467
+ const r = t.body.dataStream.endsWith(`\r
468
+ `) ? t.body.dataStream.length - 2 : t.body.dataStream.length;
469
+ if (o !== r) {
470
+ const i = {
471
+ st: o,
472
+ ed: r
473
+ }, s = ct({}, e, !0);
474
+ s && b.removeNull(s), b.isEmptyObject(s) || (i.ts = s), n.push(i);
475
+ }
476
+ t.body.textRuns = n;
454
477
  }
455
478
  function tr(t) {
456
479
  return /^-?\d+(\.\d+)?$/.test(t);
@@ -461,35 +484,35 @@ function nr(t) {
461
484
  function or(t) {
462
485
  return t.toUpperCase() === "TRUE" || t.toUpperCase() === "FALSE";
463
486
  }
464
- const Bt = {
487
+ const Wt = {
465
488
  id: "sheet.command.clear-selection-all",
466
489
  type: I.COMMAND,
467
490
  handler: async (t) => {
468
- const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), l = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
491
+ const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), d = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
469
492
  if (!(u != null && u.length))
470
493
  return !1;
471
- const d = [], g = [], m = {
472
- subUnitId: l,
494
+ const l = [], g = [], m = {
495
+ subUnitId: d,
473
496
  unitId: a,
474
497
  cellValue: rr(u)
475
498
  }, h = Oe(
476
499
  t,
477
500
  m
478
501
  );
479
- d.push({
502
+ l.push({
480
503
  id: Q.id,
481
504
  params: m
482
505
  }), g.push({
483
506
  id: Q.id,
484
507
  params: h
485
508
  });
486
- const f = i.onCommandExecute({ id: Bt.id });
487
- return d.push(...f.redos), g.unshift(...f.undos), q(d, o) ? (r.pushUndoRedo({
509
+ const f = i.onCommandExecute({ id: Wt.id });
510
+ return l.push(...f.redos), g.unshift(...f.undos), q(l, o) ? (r.pushUndoRedo({
488
511
  // If there are multiple mutations that form an encapsulated project, they must be encapsulated in the same undo redo element.
489
512
  // Hooks can be used to hook the code of external controllers to add new actions.
490
513
  unitID: a,
491
514
  undoMutations: g,
492
- redoMutations: d
515
+ redoMutations: l
493
516
  }), !0) : !1;
494
517
  }
495
518
  };
@@ -506,17 +529,17 @@ const Mn = {
506
529
  id: "sheet.command.clear-selection-content",
507
530
  type: I.COMMAND,
508
531
  handler: async (t) => {
509
- const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), l = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
532
+ const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), d = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
510
533
  if (!(u != null && u.length))
511
534
  return !1;
512
- const d = {
513
- subUnitId: l,
535
+ const l = {
536
+ subUnitId: d,
514
537
  unitId: a,
515
538
  cellValue: sr(u)
516
539
  }, g = Oe(
517
540
  t,
518
- d
519
- ), m = i.onCommandExecute({ id: Mn.id }), h = [{ id: Q.id, params: d }, ...m.redos], f = [...m.undos, { id: Q.id, params: g }];
541
+ l
542
+ ), m = i.onCommandExecute({ id: Mn.id }), h = [{ id: Q.id, params: l }, ...m.redos], f = [...m.undos, { id: Q.id, params: g }];
520
543
  return q(h, o).result ? (r.pushUndoRedo({
521
544
  // If there are multiple mutations that form an encapsulated project, they must be encapsulated in the same undo redo element.
522
545
  // Hooks can be used to hook the code of external controllers to add new actions.
@@ -540,35 +563,35 @@ function sr(t) {
540
563
  });
541
564
  }), e.getData();
542
565
  }
543
- const Wt = {
566
+ const jt = {
544
567
  id: "sheet.command.clear-selection-format",
545
568
  type: I.COMMAND,
546
569
  handler: async (t) => {
547
- const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), l = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
570
+ const e = t.get(C), o = t.get(M), n = t.get(L), r = t.get(B), i = t.get($), s = e.getCurrentUniverSheetInstance(), a = s.getUnitId(), d = s.getActiveSheet().getSheetId(), u = n.getSelectionRanges();
548
571
  if (!(u != null && u.length))
549
572
  return !1;
550
- const d = [], g = [], m = {
551
- subUnitId: l,
573
+ const l = [], g = [], m = {
574
+ subUnitId: d,
552
575
  unitId: a,
553
576
  cellValue: ir(u)
554
577
  }, h = Oe(
555
578
  t,
556
579
  m
557
580
  );
558
- d.push({
581
+ l.push({
559
582
  id: Q.id,
560
583
  params: m
561
584
  }), g.push({
562
585
  id: Q.id,
563
586
  params: h
564
587
  });
565
- const f = i.onCommandExecute({ id: Wt.id });
566
- return d.push(...f.redos), g.unshift(...f.undos), q(d, o) ? (r.pushUndoRedo({
588
+ const f = i.onCommandExecute({ id: jt.id });
589
+ return l.push(...f.redos), g.unshift(...f.undos), q(l, o) ? (r.pushUndoRedo({
567
590
  // If there are multiple mutations that form an encapsulated project, they must be encapsulated in the same undo redo element.
568
591
  // Hooks can be used to hook the code of external controllers to add new actions.
569
592
  unitID: a,
570
593
  undoMutations: g,
571
- redoMutations: d
594
+ redoMutations: l
572
595
  }), !0) : !1;
573
596
  }
574
597
  };
@@ -583,7 +606,7 @@ function ir(t) {
583
606
  });
584
607
  }), e.getData();
585
608
  }
586
- const _n = (t, e) => ({
609
+ const yn = (t, e) => ({
587
610
  subUnitId: e.sheet.id,
588
611
  unitId: e.unitId,
589
612
  subUnitName: e.sheet.name
@@ -597,11 +620,11 @@ const _n = (t, e) => ({
597
620
  }, ar = (t, e) => {
598
621
  const n = t.get(C).getCurrentUniverSheetInstance(), { subUnitId: r, unitId: i } = e, s = n.getSheetBySheetId(r).getConfig();
599
622
  return {
600
- index: n.getConfig().sheetOrder.findIndex((l) => l === r),
623
+ index: n.getConfig().sheetOrder.findIndex((d) => d === r),
601
624
  sheet: s,
602
625
  unitId: i
603
626
  };
604
- }, pt = {
627
+ }, wt = {
605
628
  id: "sheet.mutation.remove-sheet",
606
629
  type: I.MUTATION,
607
630
  handler: (t, e) => {
@@ -613,32 +636,32 @@ const _n = (t, e) => ({
613
636
  id: "sheet.command.copy-sheet",
614
637
  handler: async (t, e) => {
615
638
  var f, v;
616
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Lt);
639
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Vt);
617
640
  let s = r.getCurrentUniverSheetInstance().getUnitId(), a = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
618
641
  e && (s = (f = e.unitId) != null ? f : s, a = (v = e.subUnitId) != null ? v : a);
619
642
  const c = r.getUniverSheetInstance(s);
620
643
  if (!c)
621
644
  return !1;
622
- const l = c.getSheetBySheetId(a);
623
- if (!l)
645
+ const d = c.getSheetBySheetId(a);
646
+ if (!d)
624
647
  return !1;
625
- const u = D.deepClone(l.getConfig());
626
- u.name += i.t("sheets.sheetCopy"), u.id = D.generateRandomId();
648
+ const u = b.deepClone(d.getConfig());
649
+ u.name += i.t("sheets.sheetCopy"), u.id = b.generateRandomId();
627
650
  const g = {
628
- index: c.getSheetIndex(l) + 1,
651
+ index: c.getSheetIndex(d) + 1,
629
652
  sheet: u,
630
653
  unitId: s
631
- }, m = _n(
654
+ }, m = yn(
632
655
  t,
633
656
  g
634
657
  );
635
658
  return o.syncExecuteCommand(Le.id, g) ? (n.pushUndoRedo({
636
659
  unitID: s,
637
- undoMutations: [{ id: pt.id, params: m }],
660
+ undoMutations: [{ id: wt.id, params: m }],
638
661
  redoMutations: [{ id: Le.id, params: g }]
639
662
  }), !0) : !1;
640
663
  }
641
- }, vt = {
664
+ }, Ct = {
642
665
  id: "sheet.mutation.move-range",
643
666
  type: I.MUTATION,
644
667
  handler: (t, e) => {
@@ -651,11 +674,11 @@ const _n = (t, e) => ({
651
674
  const s = i.getSheetBySheetId(e.from.subUnitId), a = i.getSheetBySheetId(e.to.subUnitId);
652
675
  if (!s || !a)
653
676
  return !1;
654
- const c = s.getCellMatrix(), l = a.getCellMatrix();
655
- return new ne(o.value).forValue((u, d, g) => {
656
- c.setValue(u, d, g);
657
- }), new ne(n.value).forValue((u, d, g) => {
658
- l.setValue(u, d, g);
677
+ const c = s.getCellMatrix(), d = a.getCellMatrix();
678
+ return new ne(o.value).forValue((u, l, g) => {
679
+ c.setValue(u, l, g);
680
+ }), new ne(n.value).forValue((u, l, g) => {
681
+ d.setValue(u, l, g);
659
682
  }), !0;
660
683
  }
661
684
  }, oe = {
@@ -669,22 +692,22 @@ const _n = (t, e) => ({
669
692
  return o.replace(n, r), !0;
670
693
  }
671
694
  };
672
- function wt(t, e, o = !0) {
695
+ function Mt(t, e, o = !0) {
673
696
  const n = e.getMatrixWithMergedCells(...mo(t)), r = [];
674
697
  if (n.forValue((s, a, c) => {
675
698
  if (c.colSpan !== void 0 && c.rowSpan !== void 0) {
676
- const l = {
699
+ const d = {
677
700
  startRow: s,
678
701
  startColumn: a,
679
702
  endRow: s + c.rowSpan - 1,
680
703
  endColumn: a + c.colSpan - 1
681
704
  };
682
- E.contains(t, l) || r.push(l);
705
+ E.contains(t, d) || r.push(d);
683
706
  }
684
707
  }), r.length === 0)
685
708
  return t;
686
709
  const i = E.union(t, ...r);
687
- return o ? wt(i, e, o) : i;
710
+ return o ? Mt(i, e, o) : i;
688
711
  }
689
712
  function ai(t, e, o) {
690
713
  let n = null;
@@ -731,7 +754,7 @@ function he(t, e) {
731
754
  isMergedMainCell: !1
732
755
  };
733
756
  }
734
- const Pe = (t, e, o) => ({
757
+ const Ae = (t, e, o) => ({
735
758
  id: oe.id,
736
759
  params: {
737
760
  unitId: e.getUnitId(),
@@ -739,19 +762,19 @@ const Pe = (t, e, o) => ({
739
762
  pluginName: se,
740
763
  selections: [{ range: t, primary: he(t, o) }]
741
764
  }
742
- }), yn = "sheet.command.move-range", jt = {
765
+ }), _n = "sheet.command.move-range", Ft = {
743
766
  type: I.COMMAND,
744
- id: yn,
767
+ id: _n,
745
768
  handler: (t, e) => {
746
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Rt), s = r.getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), l = a.getSheetId(), u = Ft(
769
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(pt), s = r.getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), d = a.getSheetId(), u = $t(
747
770
  t,
748
- { unitId: c, subUnitId: l, range: e.fromRange },
749
- { unitId: c, subUnitId: l, range: e.toRange }
771
+ { unitId: c, subUnitId: d, range: e.fromRange },
772
+ { unitId: c, subUnitId: d, range: e.toRange }
750
773
  );
751
774
  if (u === null)
752
775
  return i.emit("Across a merged cell."), !1;
753
776
  const g = t.get($).onCommandExecute({
754
- id: jt.id,
777
+ id: Ft.id,
755
778
  params: { ...e }
756
779
  }), m = [
757
780
  ...u.redos,
@@ -760,7 +783,7 @@ const Pe = (t, e, o) => ({
760
783
  id: oe.id,
761
784
  params: {
762
785
  unitId: c,
763
- subUnitId: l,
786
+ subUnitId: d,
764
787
  pluginName: se,
765
788
  selections: [{ range: e.toRange, primary: he(e.toRange, a) }]
766
789
  }
@@ -770,7 +793,7 @@ const Pe = (t, e, o) => ({
770
793
  id: oe.id,
771
794
  params: {
772
795
  unitId: c,
773
- subUnitId: l,
796
+ subUnitId: d,
774
797
  pluginName: se,
775
798
  selections: [{ range: e.fromRange, primary: he(e.fromRange, a) }]
776
799
  }
@@ -785,52 +808,52 @@ const Pe = (t, e, o) => ({
785
808
  }), !0) : !1;
786
809
  }
787
810
  };
788
- function Ft(t, e, o, n = !1) {
789
- const r = [], i = [], { range: s, subUnitId: a, unitId: c } = e, { range: l, subUnitId: u } = o, g = t.get(C).getUniverSheetInstance(c), m = g == null ? void 0 : g.getSheetBySheetId(u), h = g == null ? void 0 : g.getSheetBySheetId(a), f = m == null ? void 0 : m.getCellMatrix(), v = h == null ? void 0 : h.getCellMatrix();
811
+ function $t(t, e, o, n = !1) {
812
+ const r = [], i = [], { range: s, subUnitId: a, unitId: c } = e, { range: d, subUnitId: u } = o, g = t.get(C).getUniverSheetInstance(c), m = g == null ? void 0 : g.getSheetBySheetId(u), h = g == null ? void 0 : g.getSheetBySheetId(a), f = m == null ? void 0 : m.getCellMatrix(), v = h == null ? void 0 : h.getCellMatrix();
790
813
  if (m && h && f && v) {
791
- const S = wt(l, m, !1);
792
- if (!E.equals(l, S) && !n)
814
+ const S = Mt(d, m, !1);
815
+ if (!E.equals(d, S) && !n)
793
816
  return null;
794
- const w = new ne(), p = new ne(), _ = (k, b) => ({
817
+ const w = new ne(), p = new ne(), y = (k, U) => ({
795
818
  startRow: k,
796
819
  endRow: k,
797
- startColumn: b,
798
- endColumn: b
820
+ startColumn: U,
821
+ endColumn: U
799
822
  });
800
- ge.foreach(s, (k, b) => {
801
- w.setValue(k, b, v.getValue(k, b)), p.setValue(k, b, null);
823
+ ge.foreach(s, (k, U) => {
824
+ w.setValue(k, U, v.getValue(k, U)), p.setValue(k, U, null);
802
825
  });
803
- const y = new ne();
804
- ge.foreach(l, (k, b) => {
805
- y.setValue(k, b, f.getValue(k, b));
826
+ const _ = new ne();
827
+ ge.foreach(d, (k, U) => {
828
+ _.setValue(k, U, f.getValue(k, U));
806
829
  });
807
- const A = new ne();
808
- ge.foreach(s, (k, b) => {
809
- const j = _(k, b), R = E.getRelativeRange(j, s), ee = E.getPositionRange(R, l);
810
- A.setValue(ee.startRow, ee.startColumn, v.getValue(k, b));
830
+ const P = new ne();
831
+ ge.foreach(s, (k, U) => {
832
+ const j = y(k, U), R = E.getRelativeRange(j, s), ee = E.getPositionRange(R, d);
833
+ P.setValue(ee.startRow, ee.startColumn, v.getValue(k, U));
811
834
  });
812
- const U = {
835
+ const D = {
813
836
  from: {
814
837
  value: p.getMatrix(),
815
838
  subUnitId: a
816
839
  },
817
840
  to: {
818
- value: A.getMatrix(),
841
+ value: P.getMatrix(),
819
842
  subUnitId: u
820
843
  },
821
844
  unitId: c
822
- }, P = {
845
+ }, A = {
823
846
  from: {
824
847
  value: w.getMatrix(),
825
848
  subUnitId: a
826
849
  },
827
850
  to: {
828
- value: y.getMatrix(),
851
+ value: _.getMatrix(),
829
852
  subUnitId: u
830
853
  },
831
854
  unitId: c
832
855
  };
833
- r.push({ id: vt.id, params: U }), i.push({ id: vt.id, params: P });
856
+ r.push({ id: Ct.id, params: D }), i.push({ id: Ct.id, params: A });
834
857
  }
835
858
  return {
836
859
  redos: r,
@@ -844,32 +867,32 @@ const Ve = {
844
867
  const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(L), s = t.get($), {
845
868
  value: a,
846
869
  range: c,
847
- unitId: l = r.getCurrentUniverSheetInstance().getUnitId(),
870
+ unitId: d = r.getCurrentUniverSheetInstance().getUnitId(),
848
871
  subUnitId: u = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId()
849
- } = e, d = c ? [c] : i.getSelectionRanges();
850
- if (!d || !d.length)
872
+ } = e, l = c ? [c] : i.getSelectionRanges();
873
+ if (!l || !l.length)
851
874
  return !1;
852
875
  const g = new ne();
853
876
  let m;
854
- if (D.isArray(a))
855
- for (let _ = 0; _ < d.length; _++) {
856
- const { startRow: y, startColumn: A, endRow: U, endColumn: P } = d[_];
857
- for (let k = 0; k <= U - y; k++)
858
- for (let b = 0; b <= P - A; b++)
859
- g.setValue(k + y, b + A, a[k][b]);
877
+ if (b.isArray(a))
878
+ for (let y = 0; y < l.length; y++) {
879
+ const { startRow: _, startColumn: P, endRow: D, endColumn: A } = l[y];
880
+ for (let k = 0; k <= D - _; k++)
881
+ for (let U = 0; U <= A - P; U++)
882
+ g.setValue(k + _, U + P, a[k][U]);
860
883
  }
861
884
  else if (fo(a))
862
- for (let _ = 0; _ < d.length; _++) {
863
- const { startRow: y, startColumn: A, endRow: U, endColumn: P } = d[_];
864
- for (let k = y; k <= U; k++)
865
- for (let b = A; b <= P; b++)
866
- g.setValue(k, b, a);
885
+ for (let y = 0; y < l.length; y++) {
886
+ const { startRow: _, startColumn: P, endRow: D, endColumn: A } = l[y];
887
+ for (let k = _; k <= D; k++)
888
+ for (let U = P; U <= A; U++)
889
+ g.setValue(k, U, a);
867
890
  }
868
891
  else
869
892
  m = a;
870
893
  const h = {
871
894
  subUnitId: u,
872
- unitId: l,
895
+ unitId: d,
873
896
  cellValue: m != null ? m : g.getMatrix()
874
897
  }, f = Oe(
875
898
  t,
@@ -885,70 +908,70 @@ const Ve = {
885
908
  h
886
909
  ), { undos: S, redos: w } = s.onCommandExecute({
887
910
  id: Ve.id,
888
- params: { ...h, range: d }
911
+ params: { ...h, range: l }
889
912
  }), p = await q([...w], o);
890
913
  return v && p.result ? (n.pushUndoRedo({
891
- unitID: l,
914
+ unitID: d,
892
915
  undoMutations: [{ id: Q.id, params: f }, ...S],
893
916
  redoMutations: [{ id: Q.id, params: h }, ...w]
894
917
  }), !0) : !1;
895
918
  }
896
919
  };
897
920
  function bn(t, e) {
898
- const o = [], n = [], { unitId: r, subUnitId: i, range: s, shiftDimension: a, cellValue: c = {} } = e, l = t.get(C), u = t.get($), d = l.getUniverSheetInstance(r), g = d == null ? void 0 : d.getSheetBySheetId(i);
921
+ const o = [], n = [], { unitId: r, subUnitId: i, range: s, shiftDimension: a, cellValue: c = {} } = e, d = t.get(C), u = t.get($), l = d.getUniverSheetInstance(r), g = l == null ? void 0 : l.getSheetBySheetId(i);
899
922
  if (g) {
900
923
  const m = g.getCellMatrix(), h = m.getDataRange();
901
924
  if (s.startColumn <= h.endColumn || s.startRow <= h.endRow) {
902
- let p, _;
925
+ let p, y;
903
926
  if (a === ue.COLUMNS) {
904
- const A = Math.min(s.endRow, h.endRow);
905
- let U = 0;
906
- for (let k = s.startRow; k <= A; k++) {
907
- const b = m.getRow(k), j = b ? fn(b) - 1 : 0;
908
- U = Math.max(U, j);
927
+ const P = Math.min(s.endRow, h.endRow);
928
+ let D = 0;
929
+ for (let k = s.startRow; k <= P; k++) {
930
+ const U = m.getRow(k), j = U ? vn(U) - 1 : 0;
931
+ D = Math.max(D, j);
909
932
  }
910
933
  p = {
911
934
  startRow: s.startRow,
912
935
  startColumn: s.startColumn,
913
- endRow: A,
914
- endColumn: U
936
+ endRow: P,
937
+ endColumn: D
915
938
  };
916
- const P = s.endColumn - s.startColumn + 1;
917
- _ = {
939
+ const A = s.endColumn - s.startColumn + 1;
940
+ y = {
918
941
  startRow: s.startRow,
919
- startColumn: p.startColumn + P,
920
- endRow: A,
921
- endColumn: p.endColumn + P
942
+ startColumn: p.startColumn + A,
943
+ endRow: P,
944
+ endColumn: p.endColumn + A
922
945
  };
923
946
  } else {
924
- const A = Math.min(s.endColumn, h.endColumn), U = h.endRow;
947
+ const P = Math.min(s.endColumn, h.endColumn), D = h.endRow;
925
948
  p = {
926
949
  startRow: s.startRow,
927
950
  startColumn: s.startColumn,
928
- endRow: U,
929
- endColumn: A
951
+ endRow: D,
952
+ endColumn: P
930
953
  };
931
- const P = s.endRow - s.startRow + 1;
932
- _ = {
933
- startRow: p.startRow + P,
954
+ const A = s.endRow - s.startRow + 1;
955
+ y = {
956
+ startRow: p.startRow + A,
934
957
  startColumn: s.startColumn,
935
- endRow: p.endRow + P,
936
- endColumn: A
958
+ endRow: p.endRow + A,
959
+ endColumn: P
937
960
  };
938
961
  }
939
- const y = Ft(
962
+ const _ = $t(
940
963
  t,
941
964
  { unitId: r, subUnitId: i, range: p },
942
- { unitId: r, subUnitId: i, range: _ },
965
+ { unitId: r, subUnitId: i, range: y },
943
966
  !0
944
967
  );
945
- y && (o.push(...y.redos), n.push(...y.undos));
968
+ _ && (o.push(..._.redos), n.push(..._.undos));
946
969
  }
947
970
  if (Object.entries(c).length === 0)
948
971
  for (let p = s.startRow; p <= s.endRow; p++) {
949
972
  c[p] || (c[p] = {});
950
- for (let _ = s.startColumn; _ <= s.endColumn; _++)
951
- c[p][_] = null;
973
+ for (let y = s.startColumn; y <= s.endColumn; y++)
974
+ c[p][y] = null;
952
975
  }
953
976
  const f = {
954
977
  subUnitId: i,
@@ -969,16 +992,16 @@ function bn(t, e) {
969
992
  };
970
993
  }
971
994
  function Un(t, e) {
972
- const o = [], n = [], { unitId: r, subUnitId: i, range: s, shiftDimension: a } = e, c = t.get(C), l = t.get($), u = c.getUniverSheetInstance(r), d = u == null ? void 0 : u.getSheetBySheetId(i);
973
- if (d) {
974
- const g = d.getCellMatrix(), m = g.getDataRange(), h = {
995
+ const o = [], n = [], { unitId: r, subUnitId: i, range: s, shiftDimension: a } = e, c = t.get(C), d = t.get($), u = c.getUniverSheetInstance(r), l = u == null ? void 0 : u.getSheetBySheetId(i);
996
+ if (l) {
997
+ const g = l.getCellMatrix(), m = g.getDataRange(), h = {
975
998
  subUnitId: i,
976
999
  unitId: r,
977
1000
  cellValue: ur([s])
978
1001
  }, f = Oe(
979
1002
  t,
980
1003
  h
981
- ), v = l.onCommandExecute({
1004
+ ), v = d.onCommandExecute({
982
1005
  id: Ve.id,
983
1006
  params: h
984
1007
  });
@@ -989,43 +1012,43 @@ function Un(t, e) {
989
1012
  let S = null, w = null;
990
1013
  if (a === ue.COLUMNS && s.endColumn < m.endColumn) {
991
1014
  const p = Math.min(s.endRow, m.endRow);
992
- let _ = 0;
993
- for (let A = s.startRow; A <= p; A++) {
994
- const U = g.getRow(A), P = U ? fn(U) - 1 : 0;
995
- _ = Math.max(_, P);
1015
+ let y = 0;
1016
+ for (let P = s.startRow; P <= p; P++) {
1017
+ const D = g.getRow(P), A = D ? vn(D) - 1 : 0;
1018
+ y = Math.max(y, A);
996
1019
  }
997
1020
  S = {
998
1021
  startRow: s.startRow,
999
1022
  startColumn: s.endColumn + 1,
1000
1023
  endRow: p,
1001
- endColumn: _
1024
+ endColumn: y
1002
1025
  };
1003
- const y = s.endColumn - s.startColumn + 1;
1026
+ const _ = s.endColumn - s.startColumn + 1;
1004
1027
  w = {
1005
1028
  startRow: s.startRow,
1006
- startColumn: S.startColumn - y,
1029
+ startColumn: S.startColumn - _,
1007
1030
  endRow: p,
1008
- endColumn: S.endColumn - y
1031
+ endColumn: S.endColumn - _
1009
1032
  };
1010
1033
  }
1011
1034
  if (a === ue.ROWS && s.endRow < m.endRow) {
1012
- const p = Math.min(s.endColumn, m.endColumn), _ = m.endRow;
1035
+ const p = Math.min(s.endColumn, m.endColumn), y = m.endRow;
1013
1036
  S = {
1014
1037
  startRow: s.endRow + 1,
1015
1038
  startColumn: s.startColumn,
1016
- endRow: _,
1039
+ endRow: y,
1017
1040
  endColumn: p
1018
1041
  };
1019
- const y = s.endRow - s.startRow + 1;
1042
+ const _ = s.endRow - s.startRow + 1;
1020
1043
  w = {
1021
- startRow: S.startRow - y,
1044
+ startRow: S.startRow - _,
1022
1045
  startColumn: s.startColumn,
1023
- endRow: S.endRow - y,
1046
+ endRow: S.endRow - _,
1024
1047
  endColumn: p
1025
1048
  };
1026
1049
  }
1027
1050
  if (S && w) {
1028
- const p = Ft(
1051
+ const p = $t(
1029
1052
  t,
1030
1053
  { unitId: r, subUnitId: i, range: S },
1031
1054
  { unitId: r, subUnitId: i, range: w },
@@ -1041,42 +1064,42 @@ function Un(t, e) {
1041
1064
  };
1042
1065
  }
1043
1066
  function ci(t, e, o, n, r, i) {
1044
- const { startRow: s, endRow: a, startColumn: c, endColumn: l } = e;
1067
+ const { startRow: s, endRow: a, startColumn: c, endColumn: d } = e;
1045
1068
  if (r === ue.ROWS) {
1046
1069
  const u = a - s + 1;
1047
- for (let d = o; d >= s; d--)
1048
- for (let g = c; g <= l; g++) {
1049
- const m = t.getValue(d, g);
1050
- m == null ? t.realDeleteValue(d + u, g) : t.setValue(d + u, g, m);
1070
+ for (let l = o; l >= s; l--)
1071
+ for (let g = c; g <= d; g++) {
1072
+ const m = t.getValue(l, g);
1073
+ m == null ? t.realDeleteValue(l + u, g) : t.setValue(l + u, g, m);
1051
1074
  }
1052
- for (let d = a; d >= s; d--)
1053
- for (let g = c; g <= l; g++)
1054
- i && i[d] && i[d][g] ? t.setValue(d, g, i[d][g]) : t.realDeleteValue(d, g);
1075
+ for (let l = a; l >= s; l--)
1076
+ for (let g = c; g <= d; g++)
1077
+ i && i[l] && i[l][g] ? t.setValue(l, g, i[l][g]) : t.realDeleteValue(l, g);
1055
1078
  } else if (r === ue.COLUMNS) {
1056
- const u = l - c + 1;
1057
- for (let d = s; d <= a; d++)
1079
+ const u = d - c + 1;
1080
+ for (let l = s; l <= a; l++)
1058
1081
  for (let g = n; g >= c; g--) {
1059
- const m = t.getValue(d, g);
1060
- m == null ? t.realDeleteValue(d, g + u) : t.setValue(d, g + u, m);
1082
+ const m = t.getValue(l, g);
1083
+ m == null ? t.realDeleteValue(l, g + u) : t.setValue(l, g + u, m);
1061
1084
  }
1062
- for (let d = s; d <= a; d++)
1063
- for (let g = l; g >= c; g--)
1064
- i && i[d] && i[d][g] ? t.setValue(d, g, i[d][g]) : t.realDeleteValue(d, g);
1085
+ for (let l = s; l <= a; l++)
1086
+ for (let g = d; g >= c; g--)
1087
+ i && i[l] && i[l][g] ? t.setValue(l, g, i[l][g]) : t.realDeleteValue(l, g);
1065
1088
  }
1066
1089
  }
1067
1090
  function ui(t, e, o, n, r) {
1068
- const { startRow: i, endRow: s, startColumn: a, endColumn: c } = e, l = s - i + 1, u = c - a + 1;
1091
+ const { startRow: i, endRow: s, startColumn: a, endColumn: c } = e, d = s - i + 1, u = c - a + 1;
1069
1092
  if (r === ue.ROWS)
1070
- for (let d = i; d <= o; d++)
1093
+ for (let l = i; l <= o; l++)
1071
1094
  for (let g = a; g <= c; g++) {
1072
- const m = t.getValue(d + l, g);
1073
- m == null ? t.realDeleteValue(d, g) : t.setValue(d, g, m);
1095
+ const m = t.getValue(l + d, g);
1096
+ m == null ? t.realDeleteValue(l, g) : t.setValue(l, g, m);
1074
1097
  }
1075
1098
  else if (r === ue.COLUMNS)
1076
- for (let d = i; d <= s; d++)
1099
+ for (let l = i; l <= s; l++)
1077
1100
  for (let g = a; g <= n; g++) {
1078
- const m = t.getValue(d, g + u);
1079
- m == null ? t.realDeleteValue(d, g) : t.setValue(d, g, m);
1101
+ const m = t.getValue(l, g + u);
1102
+ m == null ? t.realDeleteValue(l, g) : t.setValue(l, g, m);
1080
1103
  }
1081
1104
  }
1082
1105
  function ur(t) {
@@ -1088,34 +1111,34 @@ function ur(t) {
1088
1111
  e.setValue(a, c, null);
1089
1112
  }), e.getData();
1090
1113
  }
1091
- const Dn = "sheet.command.delete-range-move-left", $t = {
1114
+ const Dn = "sheet.command.delete-range-move-left", Ht = {
1092
1115
  type: I.COMMAND,
1093
1116
  id: Dn,
1094
1117
  handler: async (t, e) => {
1095
1118
  var p;
1096
1119
  const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(L), s = t.get($), a = r.getCurrentUniverSheetInstance().getUnitId(), c = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1097
- let l = e == null ? void 0 : e.range;
1098
- if (l || (l = (p = i.getLast()) == null ? void 0 : p.range), !l)
1120
+ let d = e == null ? void 0 : e.range;
1121
+ if (d || (d = (p = i.getLast()) == null ? void 0 : p.range), !d)
1099
1122
  return !1;
1100
1123
  const u = r.getUniverSheetInstance(a);
1101
1124
  if (!u)
1102
1125
  return !1;
1103
- const d = u.getSheetBySheetId(c);
1104
- if (!d)
1126
+ const l = u.getSheetBySheetId(c);
1127
+ if (!l)
1105
1128
  return !1;
1106
1129
  const g = {
1107
- range: l,
1130
+ range: d,
1108
1131
  subUnitId: c,
1109
1132
  unitId: a,
1110
1133
  shiftDimension: ue.COLUMNS
1111
1134
  }, m = s.onCommandExecute({
1112
- id: $t.id,
1113
- params: { range: l }
1135
+ id: Ht.id,
1136
+ params: { range: d }
1114
1137
  }), { redo: h, undo: f } = Un(
1115
1138
  t,
1116
1139
  g
1117
1140
  ), v = [...h], S = [...f];
1118
- return v.push(...m.redos), v.push(Pe(l, u, d)), S.push(...m.undos), q(v, o).result ? (n.pushUndoRedo({
1141
+ return v.push(...m.redos), v.push(Ae(d, u, l)), S.push(...m.undos), q(v, o).result ? (n.pushUndoRedo({
1119
1142
  unitID: a,
1120
1143
  undoMutations: S.reverse(),
1121
1144
  redoMutations: v
@@ -1123,34 +1146,34 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1123
1146
  }
1124
1147
  // all subsequent mutations should succeed inorder to make the whole process succeed
1125
1148
  // Promise.all([]).then(() => true),
1126
- }, kn = "sheet.command.delete-range-move-up", Ht = {
1149
+ }, kn = "sheet.command.delete-range-move-up", zt = {
1127
1150
  type: I.COMMAND,
1128
1151
  id: kn,
1129
1152
  handler: async (t, e) => {
1130
1153
  var p;
1131
1154
  const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(L), s = t.get($), a = r.getCurrentUniverSheetInstance().getUnitId(), c = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1132
- let l = e == null ? void 0 : e.range;
1133
- if (l || (l = (p = i.getLast()) == null ? void 0 : p.range), !l)
1155
+ let d = e == null ? void 0 : e.range;
1156
+ if (d || (d = (p = i.getLast()) == null ? void 0 : p.range), !d)
1134
1157
  return !1;
1135
1158
  const u = r.getUniverSheetInstance(a);
1136
1159
  if (!u)
1137
1160
  return !1;
1138
- const d = u.getSheetBySheetId(c);
1139
- if (!d)
1161
+ const l = u.getSheetBySheetId(c);
1162
+ if (!l)
1140
1163
  return !1;
1141
1164
  const g = {
1142
- range: l,
1165
+ range: d,
1143
1166
  subUnitId: c,
1144
1167
  unitId: a,
1145
1168
  shiftDimension: ue.ROWS
1146
1169
  }, m = s.onCommandExecute({
1147
- id: Ht.id,
1148
- params: { range: l }
1170
+ id: zt.id,
1171
+ params: { range: d }
1149
1172
  }), { redo: h, undo: f } = Un(
1150
1173
  t,
1151
1174
  g
1152
1175
  ), v = [...h], S = [...f];
1153
- return v.push(...m.redos), v.push(Pe(l, u, d)), S.push(...m.undos), await q(v, o).result ? (n.pushUndoRedo({
1176
+ return v.push(...m.redos), v.push(Ae(d, u, l)), S.push(...m.undos), await q(v, o).result ? (n.pushUndoRedo({
1154
1177
  unitID: a,
1155
1178
  undoMutations: S.reverse(),
1156
1179
  redoMutations: v
@@ -1177,15 +1200,15 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1177
1200
  const c = a.getSheetBySheetId(n);
1178
1201
  if (c == null)
1179
1202
  throw new Error("worksheet is null error!");
1180
- const l = c.getRowManager().getRowData(), u = {
1203
+ const d = c.getRowManager().getRowData(), u = {
1181
1204
  h: c.getConfig().defaultRowHeight,
1182
1205
  hd: 0
1183
- }, d = r.startRow, g = r.endRow - r.startRow + 1;
1184
- for (let f = d; f < d + g; f++)
1185
- i ? ft(f, (h = i[f - r.startRow]) != null ? h : u, l) : ft(f, u, l);
1206
+ }, l = r.startRow, g = r.endRow - r.startRow + 1;
1207
+ for (let f = l; f < l + g; f++)
1208
+ i ? vt(f, (h = i[f - r.startRow]) != null ? h : u, d) : vt(f, u, d);
1186
1209
  return c.setRowCount(c.getRowCount() + r.endRow - r.startRow + 1), c.getCellMatrix().insertRows(r.startRow, g), !0;
1187
1210
  }
1188
- }, Pn = (t, e) => {
1211
+ }, An = (t, e) => {
1189
1212
  if (t.get(C).getUniverSheetInstance(e.unitId) == null)
1190
1213
  throw new Error("universheet is null error!");
1191
1214
  return {
@@ -1204,18 +1227,18 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1204
1227
  const r = n.getSheetBySheetId(e.subUnitId);
1205
1228
  if (!r)
1206
1229
  return !1;
1207
- const i = r.getColumnManager(), { range: s, colInfo: a } = e, l = i.getColumnData(), u = s.startColumn, d = s.endColumn - s.startColumn + 1, g = r.getConfig().defaultColumnWidth;
1208
- for (let f = u; f < u + d; f++) {
1230
+ const i = r.getColumnManager(), { range: s, colInfo: a } = e, d = i.getColumnData(), u = s.startColumn, l = s.endColumn - s.startColumn + 1, g = r.getConfig().defaultColumnWidth;
1231
+ for (let f = u; f < u + l; f++) {
1209
1232
  const v = {
1210
1233
  w: g,
1211
1234
  hd: 0
1212
1235
  };
1213
- a ? ft(f, (h = a[f - s.startColumn]) != null ? h : v, l) : ft(f, v, l);
1236
+ a ? vt(f, (h = a[f - s.startColumn]) != null ? h : v, d) : vt(f, v, d);
1214
1237
  }
1215
- return r.setColumnCount(r.getColumnCount() + s.endColumn - s.startColumn + 1), r.getCellMatrix().insertColumns(s.startColumn, d), !0;
1238
+ return r.setColumnCount(r.getColumnCount() + s.endColumn - s.startColumn + 1), r.getCellMatrix().insertColumns(s.startColumn, l), !0;
1216
1239
  }
1217
1240
  }, dr = (t, e) => {
1218
- const r = e.getRowManager().getRowData(), i = {}, s = t.range, a = Cn(s.startRow, s.endRow, r), c = Sn(i, a);
1241
+ const r = e.getRowManager().getRowData(), i = {}, s = t.range, a = Sn(s.startRow, s.endRow, r), c = In(i, a);
1219
1242
  return {
1220
1243
  unitId: t.unitId,
1221
1244
  subUnitId: t.subUnitId,
@@ -1233,7 +1256,7 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1233
1256
  if (!r)
1234
1257
  return !1;
1235
1258
  const i = e.range, a = r.getRowManager().getRowData(), c = i.endRow - i.startRow + 1;
1236
- return vn(i.startRow, c, a), r.getCellMatrix().removeRows(i.startRow, c), r.setRowCount(r.getRowCount() - c), !0;
1259
+ return Cn(i.startRow, c, a), r.getCellMatrix().removeRows(i.startRow, c), r.setRowCount(r.getRowCount() - c), !0;
1237
1260
  }
1238
1261
  }, lr = (t, e) => {
1239
1262
  const n = t.get(C).getUniverSheetInstance(e.unitId);
@@ -1242,12 +1265,12 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1242
1265
  const r = n.getSheetBySheetId(e.subUnitId);
1243
1266
  if (r == null)
1244
1267
  throw new Error("worksheet is null error!");
1245
- const a = r.getColumnManager().getColumnData(), c = {}, l = e.range, u = Cn(l.startColumn, l.endColumn, a), d = Sn(c, u);
1268
+ const a = r.getColumnManager().getColumnData(), c = {}, d = e.range, u = Sn(d.startColumn, d.endColumn, a), l = In(c, u);
1246
1269
  return {
1247
1270
  unitId: e.unitId,
1248
1271
  subUnitId: e.subUnitId,
1249
1272
  range: e.range,
1250
- colInfo: d
1273
+ colInfo: l
1251
1274
  };
1252
1275
  }, Fe = {
1253
1276
  id: "sheet.mutation.remove-col",
@@ -1260,31 +1283,31 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1260
1283
  if (!r)
1261
1284
  return !1;
1262
1285
  const i = e.range, a = r.getColumnManager().getColumnData(), c = i.endColumn - i.startColumn + 1;
1263
- return vn(i.startColumn, c, a), r.setColumnCount(r.getColumnCount() - c), r.getCellMatrix().removeColumns(i.startColumn, c), !0;
1286
+ return Cn(i.startColumn, c, a), r.setColumnCount(r.getColumnCount() - c), r.getCellMatrix().removeColumns(i.startColumn, c), !0;
1264
1287
  }
1265
- }, gr = "sheet.command.insert-range-move-down", zt = {
1288
+ }, gr = "sheet.command.insert-range-move-down", Gt = {
1266
1289
  type: I.COMMAND,
1267
1290
  id: "sheet.command.insert-range-move-down",
1268
1291
  handler: async (t, e) => {
1269
- var b;
1270
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Vt), s = t.get(L), a = t.get($);
1292
+ var U;
1293
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Bt), s = t.get(L), a = t.get($);
1271
1294
  if (s.isOverlapping())
1272
1295
  return i.error("Cannot use that command on overlapping selections."), !1;
1273
- const c = r.getCurrentUniverSheetInstance().getUnitId(), l = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1296
+ const c = r.getCurrentUniverSheetInstance().getUnitId(), d = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1274
1297
  let u = e == null ? void 0 : e.range;
1275
- if (u || (u = (b = s.getLast()) == null ? void 0 : b.range), !u)
1298
+ if (u || (u = (U = s.getLast()) == null ? void 0 : U.range), !u)
1276
1299
  return !1;
1277
- const d = r.getUniverSheetInstance(c);
1278
- if (!d)
1300
+ const l = r.getUniverSheetInstance(c);
1301
+ if (!l)
1279
1302
  return !1;
1280
- const g = d.getSheetBySheetId(l);
1303
+ const g = l.getSheetBySheetId(d);
1281
1304
  if (!g)
1282
1305
  return !1;
1283
1306
  const m = [], h = [], f = g.getCellMatrix(), v = f.getDataRange(), w = f.getSlice(v.startRow, v.endRow, u.startColumn, u.endColumn).getDataRange().endRow, p = Math.max(w + (u.endRow - u.startRow + 1) - v.endRow, 0);
1284
1307
  if (p > 0) {
1285
1308
  const j = u.startRow - 1, R = g.getRowHeight(j), ee = {
1286
1309
  unitId: c,
1287
- subUnitId: l,
1310
+ subUnitId: d,
1288
1311
  range: {
1289
1312
  startRow: v.endRow + 1,
1290
1313
  endRow: v.endRow + p,
@@ -1300,33 +1323,33 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1300
1323
  id: Be.id,
1301
1324
  params: ee
1302
1325
  });
1303
- const Ae = On(
1326
+ const Pe = On(
1304
1327
  t,
1305
1328
  ee
1306
1329
  );
1307
- h.push({ id: je.id, params: Ae });
1330
+ h.push({ id: je.id, params: Pe });
1308
1331
  }
1309
- const _ = {};
1332
+ const y = {};
1310
1333
  ge.foreach(u, (j, R) => {
1311
1334
  const ee = g.getCell(j, R);
1312
- ee && (_[j] || (_[j] = {}), _[j][R] = { s: ee.s });
1335
+ ee && (y[j] || (y[j] = {}), y[j][R] = { s: ee.s });
1313
1336
  });
1314
- const y = {
1337
+ const _ = {
1315
1338
  range: u,
1316
- subUnitId: l,
1339
+ subUnitId: d,
1317
1340
  unitId: c,
1318
1341
  shiftDimension: ue.ROWS,
1319
- cellValue: _
1320
- }, { redo: A, undo: U } = bn(
1342
+ cellValue: y
1343
+ }, { redo: P, undo: D } = bn(
1321
1344
  t,
1322
- y
1345
+ _
1323
1346
  );
1324
- m.push(...A), h.push(...U);
1325
- const P = a.onCommandExecute({
1326
- id: zt.id,
1347
+ m.push(...P), h.push(...D);
1348
+ const A = a.onCommandExecute({
1349
+ id: Gt.id,
1327
1350
  params: { range: u }
1328
1351
  });
1329
- return m.push(...P.redos), m.push(Pe(u, d, g)), h.push(...P.undos), q(m, o) ? (n.pushUndoRedo({
1352
+ return m.push(...A.redos), m.push(Ae(u, l, g)), h.push(...A.undos), q(m, o) ? (n.pushUndoRedo({
1330
1353
  unitID: c,
1331
1354
  undoMutations: h.reverse(),
1332
1355
  redoMutations: m
@@ -1334,22 +1357,22 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1334
1357
  }
1335
1358
  // all subsequent mutations should succeed inorder to make the whole process succeed
1336
1359
  // Promise.all([]).then(() => true),
1337
- }, An = "sheet.command.insert-range-move-right", Gt = {
1360
+ }, Pn = "sheet.command.insert-range-move-right", qt = {
1338
1361
  type: I.COMMAND,
1339
- id: An,
1362
+ id: Pn,
1340
1363
  handler: async (t, e) => {
1341
- var b;
1342
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Vt), s = t.get(L), a = t.get($);
1364
+ var U;
1365
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Bt), s = t.get(L), a = t.get($);
1343
1366
  if (s.isOverlapping())
1344
1367
  return i.error("Cannot use that command on overlapping selections."), !1;
1345
- const c = r.getCurrentUniverSheetInstance().getUnitId(), l = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1368
+ const c = r.getCurrentUniverSheetInstance().getUnitId(), d = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
1346
1369
  let u = e == null ? void 0 : e.range;
1347
- if (u || (u = (b = s.getLast()) == null ? void 0 : b.range), !u)
1370
+ if (u || (u = (U = s.getLast()) == null ? void 0 : U.range), !u)
1348
1371
  return !1;
1349
- const d = r.getUniverSheetInstance(c);
1350
- if (!d)
1372
+ const l = r.getUniverSheetInstance(c);
1373
+ if (!l)
1351
1374
  return !1;
1352
- const g = d.getSheetBySheetId(l);
1375
+ const g = l.getSheetBySheetId(d);
1353
1376
  if (!g)
1354
1377
  return !1;
1355
1378
  const m = [], h = [], f = g.getCellMatrix(), v = f.getDataRange(), w = f.getSlice(u.startRow, u.endRow, v.startColumn, v.endColumn).getDataRange().endColumn, p = Math.max(
@@ -1359,7 +1382,7 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1359
1382
  if (p > 0) {
1360
1383
  const j = u.startColumn - 1, R = g.getColumnWidth(j), ee = {
1361
1384
  unitId: c,
1362
- subUnitId: l,
1385
+ subUnitId: d,
1363
1386
  range: {
1364
1387
  startRow: v.startRow + 1,
1365
1388
  endRow: v.endRow,
@@ -1375,33 +1398,33 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1375
1398
  id: We.id,
1376
1399
  params: ee
1377
1400
  });
1378
- const Ae = Pn(
1401
+ const Pe = An(
1379
1402
  t,
1380
1403
  ee
1381
1404
  );
1382
- h.push({ id: Fe.id, params: Ae });
1405
+ h.push({ id: Fe.id, params: Pe });
1383
1406
  }
1384
- const _ = {};
1407
+ const y = {};
1385
1408
  ge.foreach(u, (j, R) => {
1386
1409
  const ee = g.getCell(j, R);
1387
- !ee || !ee.s || (_[j] || (_[j] = {}), _[j][R] = { s: ee.s });
1410
+ !ee || !ee.s || (y[j] || (y[j] = {}), y[j][R] = { s: ee.s });
1388
1411
  });
1389
- const y = {
1412
+ const _ = {
1390
1413
  range: u,
1391
- subUnitId: l,
1414
+ subUnitId: d,
1392
1415
  unitId: c,
1393
1416
  shiftDimension: ue.COLUMNS,
1394
- cellValue: _
1395
- }, { redo: A, undo: U } = bn(
1417
+ cellValue: y
1418
+ }, { redo: P, undo: D } = bn(
1396
1419
  t,
1397
- y
1420
+ _
1398
1421
  );
1399
- m.push(...A), h.push(...U);
1400
- const P = a.onCommandExecute({
1401
- id: Gt.id,
1422
+ m.push(...P), h.push(...D);
1423
+ const A = a.onCommandExecute({
1424
+ id: qt.id,
1402
1425
  params: { range: u }
1403
1426
  });
1404
- return m.push(...P.redos), m.push(Pe(u, d, g)), h.push(...P.undos), q(m, o).result ? (n.pushUndoRedo({
1427
+ return m.push(...A.redos), m.push(Ae(u, l, g)), h.push(...A.undos), q(m, o).result ? (n.pushUndoRedo({
1405
1428
  unitID: c,
1406
1429
  undoMutations: h.reverse(),
1407
1430
  redoMutations: m
@@ -1413,9 +1436,9 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1413
1436
  type: I.COMMAND,
1414
1437
  id: En,
1415
1438
  handler: async (t, e) => {
1416
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get($), s = r.getUniverSheetInstance(e.unitId), a = s.getSheetBySheetId(e.subUnitId), { range: c, direction: l, unitId: u, subUnitId: d } = e, { startRow: g, endRow: m } = c, h = l === $e.UP ? g : g - 1, f = a.getRowHeight(h), v = {
1439
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get($), s = r.getUniverSheetInstance(e.unitId), a = s.getSheetBySheetId(e.subUnitId), { range: c, direction: d, unitId: u, subUnitId: l } = e, { startRow: g, endRow: m } = c, h = d === $e.UP ? g : g - 1, f = a.getRowHeight(h), v = {
1417
1440
  unitId: u,
1418
- subUnitId: d,
1441
+ subUnitId: l,
1419
1442
  range: c,
1420
1443
  rowInfo: new Array(m - g + 1).fill(void 0).map(() => ({
1421
1444
  h: f,
@@ -1433,13 +1456,13 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1433
1456
  [
1434
1457
  { id: Be.id, params: v },
1435
1458
  ...w.redos,
1436
- Pe(c, s, a)
1459
+ Ae(c, s, a)
1437
1460
  ],
1438
1461
  o
1439
1462
  ).result ? (n.pushUndoRedo({
1440
1463
  unitID: e.unitId,
1441
- undoMutations: [{ id: je.id, params: S }, ...w.redos],
1442
- redoMutations: [...w.undos, { id: Be.id, params: v }]
1464
+ undoMutations: [...w.undos, { id: je.id, params: S }],
1465
+ redoMutations: [{ id: Be.id, params: v }, ...w.redos]
1443
1466
  }), !0) : !1;
1444
1467
  }
1445
1468
  }, hr = {
@@ -1459,31 +1482,31 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1459
1482
  const s = i.getActiveSheet();
1460
1483
  if (!s)
1461
1484
  return !1;
1462
- const a = i.getUnitId(), c = s.getSheetId(), l = n.endRow - n.startRow + 1, u = {};
1485
+ const a = i.getUnitId(), c = s.getSheetId(), d = n.endRow - n.startRow + 1, u = {};
1463
1486
  ge.foreach(n, (m, h) => {
1464
1487
  const f = s.getCell(m, h);
1465
1488
  !f || !f.s || (u[m] || (u[m] = {}), u[m][h] = { s: f.s });
1466
1489
  });
1467
- const d = {
1490
+ const l = {
1468
1491
  unitId: a,
1469
1492
  subUnitId: c,
1470
1493
  direction: $e.UP,
1471
1494
  range: {
1472
1495
  startRow: n.startRow,
1473
- endRow: n.startRow + l - 1,
1496
+ endRow: n.startRow + d - 1,
1474
1497
  startColumn: 0,
1475
1498
  endColumn: s.getColumnCount() - 1
1476
1499
  },
1477
1500
  cellValue: u
1478
1501
  };
1479
- return t.get(M).executeCommand(et.id, d);
1502
+ return t.get(M).executeCommand(et.id, l);
1480
1503
  }
1481
1504
  }, mr = {
1482
1505
  type: I.COMMAND,
1483
1506
  id: "sheet.command.insert-row-after",
1484
1507
  handler: async (t) => {
1485
- var d;
1486
- const o = (d = t.get(L).getSelections()) == null ? void 0 : d.map((g) => g.range);
1508
+ var l;
1509
+ const o = (l = t.get(L).getSelections()) == null ? void 0 : l.map((g) => g.range);
1487
1510
  let n;
1488
1511
  if ((o == null ? void 0 : o.length) === 1)
1489
1512
  n = o[0];
@@ -1495,13 +1518,13 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1495
1518
  const s = i.getActiveSheet();
1496
1519
  if (!s)
1497
1520
  return !1;
1498
- const a = i.getUnitId(), c = s.getSheetId(), l = n.endRow - n.startRow + 1, u = {
1521
+ const a = i.getUnitId(), c = s.getSheetId(), d = n.endRow - n.startRow + 1, u = {
1499
1522
  unitId: a,
1500
1523
  subUnitId: c,
1501
1524
  direction: $e.DOWN,
1502
1525
  range: {
1503
1526
  startRow: n.endRow + 1,
1504
- endRow: n.endRow + l,
1527
+ endRow: n.endRow + d,
1505
1528
  startColumn: 0,
1506
1529
  endColumn: s.getColumnCount() - 1
1507
1530
  }
@@ -1512,15 +1535,15 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1512
1535
  type: I.COMMAND,
1513
1536
  id: Nn,
1514
1537
  handler: async (t, e) => {
1515
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get($), { range: s, direction: a, subUnitId: c, unitId: l, cellValue: u } = e, { startColumn: d, endColumn: g } = e.range, m = r.getUniverSheetInstance(e.unitId), h = m.getSheetBySheetId(e.subUnitId), f = a === $e.LEFT ? d : d - 1, v = h.getColumnWidth(f), S = {
1516
- unitId: l,
1538
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get($), { range: s, direction: a, subUnitId: c, unitId: d, cellValue: u } = e, { startColumn: l, endColumn: g } = e.range, m = r.getUniverSheetInstance(e.unitId), h = m.getSheetBySheetId(e.subUnitId), f = a === $e.LEFT ? l : l - 1, v = h.getColumnWidth(f), S = {
1539
+ unitId: d,
1517
1540
  subUnitId: c,
1518
1541
  range: s,
1519
- colInfo: new Array(g - d + 1).fill(void 0).map(() => ({
1542
+ colInfo: new Array(g - l + 1).fill(void 0).map(() => ({
1520
1543
  w: v,
1521
1544
  hd: X.FALSE
1522
1545
  }))
1523
- }, w = Pn(
1546
+ }, w = An(
1524
1547
  t,
1525
1548
  S
1526
1549
  );
@@ -1533,7 +1556,7 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1533
1556
  [
1534
1557
  { id: We.id, params: S },
1535
1558
  ...p.redos,
1536
- Pe(s, m, h)
1559
+ Ae(s, m, h)
1537
1560
  ],
1538
1561
  o
1539
1562
  ).result ? (n.pushUndoRedo({
@@ -1564,24 +1587,24 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1564
1587
  const s = i.getActiveSheet();
1565
1588
  if (!s)
1566
1589
  return !1;
1567
- const a = i.getUnitId(), c = s.getSheetId(), l = n.endColumn - n.startColumn + 1, u = {};
1590
+ const a = i.getUnitId(), c = s.getSheetId(), d = n.endColumn - n.startColumn + 1, u = {};
1568
1591
  ge.foreach(n, (g, m) => {
1569
1592
  const h = s.getCell(g, m);
1570
1593
  !h || !h.s || (u[g] || (u[g] = {}), u[g][m] = { s: h.s });
1571
1594
  });
1572
- const d = {
1595
+ const l = {
1573
1596
  unitId: a,
1574
1597
  subUnitId: c,
1575
1598
  direction: $e.LEFT,
1576
1599
  range: {
1577
1600
  startColumn: n.startColumn,
1578
- endColumn: n.startColumn + l - 1,
1601
+ endColumn: n.startColumn + d - 1,
1579
1602
  startRow: 0,
1580
1603
  endRow: s.getLastRowWithContent()
1581
1604
  },
1582
1605
  cellValue: u
1583
1606
  };
1584
- return t.get(M).executeCommand(tt.id, d);
1607
+ return t.get(M).executeCommand(tt.id, l);
1585
1608
  }
1586
1609
  }, vr = {
1587
1610
  type: I.COMMAND,
@@ -1599,13 +1622,13 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1599
1622
  const s = i.getActiveSheet();
1600
1623
  if (!s)
1601
1624
  return !1;
1602
- const a = i.getUnitId(), c = s.getSheetId(), l = n.endColumn - n.startColumn + 1, u = {
1625
+ const a = i.getUnitId(), c = s.getSheetId(), d = n.endColumn - n.startColumn + 1, u = {
1603
1626
  unitId: a,
1604
1627
  subUnitId: c,
1605
1628
  direction: $e.RIGHT,
1606
1629
  range: {
1607
1630
  startColumn: n.endColumn + 1,
1608
- endColumn: n.endColumn + l,
1631
+ endColumn: n.endColumn + d,
1609
1632
  startRow: 0,
1610
1633
  endRow: s.getLastRowWithContent()
1611
1634
  }
@@ -1617,22 +1640,22 @@ const Dn = "sheet.command.delete-range-move-left", $t = {
1617
1640
  type: I.COMMAND,
1618
1641
  handler: (t, e) => {
1619
1642
  var m, h;
1620
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Lt), s = (m = e == null ? void 0 : e.unitId) != null ? m : r.getCurrentUniverSheetInstance().getUnitId(), a = r.getUniverSheetInstance(s);
1643
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Vt), s = (m = e == null ? void 0 : e.unitId) != null ? m : r.getCurrentUniverSheetInstance().getUnitId(), a = r.getUniverSheetInstance(s);
1621
1644
  if (!a)
1622
1645
  return !1;
1623
- let c = a.getSheets().length, l = vo({});
1624
- e ? (c = (h = e.index) != null ? h : c, e.sheet ? l = e.sheet : (l.id = D.generateRandomId(), l.name = a.generateNewSheetName(`${i.t("sheets.sheet")}`))) : (l.id = D.generateRandomId(), l.name = a.generateNewSheetName(`${i.t("sheets.sheet")}`));
1646
+ let c = a.getSheets().length, d = vo({});
1647
+ e ? (c = (h = e.index) != null ? h : c, e.sheet ? d = e.sheet : (d.id = b.generateRandomId(), d.name = a.generateNewSheetName(`${i.t("sheets.sheet")}`))) : (d.id = b.generateRandomId(), d.name = a.generateNewSheetName(`${i.t("sheets.sheet")}`));
1625
1648
  const u = {
1626
1649
  index: c,
1627
- sheet: l,
1650
+ sheet: d,
1628
1651
  unitId: s
1629
- }, d = _n(
1652
+ }, l = yn(
1630
1653
  t,
1631
1654
  u
1632
1655
  );
1633
1656
  return o.syncExecuteCommand(Le.id, u) ? (n.pushUndoRedo({
1634
1657
  unitID: s,
1635
- undoMutations: [{ id: pt.id, params: d }],
1658
+ undoMutations: [{ id: wt.id, params: l }],
1636
1659
  redoMutations: [{ id: Le.id, params: u }]
1637
1660
  }), !0) : !1;
1638
1661
  }
@@ -1659,7 +1682,7 @@ function Sr(t, e) {
1659
1682
  }
1660
1683
  };
1661
1684
  }
1662
- const Ct = {
1685
+ const St = {
1663
1686
  id: "sheet.mutation.move-rows",
1664
1687
  type: I.MUTATION,
1665
1688
  handler: (t, e) => {
@@ -1669,8 +1692,8 @@ const Ct = {
1669
1692
  const c = a.getSheetBySheetId(n);
1670
1693
  if (!c)
1671
1694
  throw new Error("[MoveRowMutation] worksheet is null!");
1672
- const l = r.startRow, u = r.endRow - r.startRow + 1, d = i.startRow, g = c.getRowManager().getRowData();
1673
- return In(l, u, d, g), c.getCellMatrix().moveRows(l, u, d), !0;
1695
+ const d = r.startRow, u = r.endRow - r.startRow + 1, l = i.startRow, g = c.getRowManager().getRowData();
1696
+ return Rn(d, u, l, g), c.getCellMatrix().moveRows(d, u, l), !0;
1674
1697
  }
1675
1698
  };
1676
1699
  function Ir(t, e) {
@@ -1695,7 +1718,7 @@ function Ir(t, e) {
1695
1718
  }
1696
1719
  };
1697
1720
  }
1698
- const St = {
1721
+ const It = {
1699
1722
  id: "sheet.mutation.move-columns",
1700
1723
  type: I.MUTATION,
1701
1724
  handler: (t, e) => {
@@ -1705,8 +1728,8 @@ const St = {
1705
1728
  const c = a.getSheetBySheetId(n);
1706
1729
  if (!c)
1707
1730
  throw new Error("[MoveColumnMutation] worksheet is null!");
1708
- const l = r.startColumn, u = r.endColumn - r.startColumn + 1, d = i.startColumn, g = c.getColumnManager().getColumnData();
1709
- return In(l, u, d, g), c.getCellMatrix().moveColumns(l, u, d), !0;
1731
+ const d = r.startColumn, u = r.endColumn - r.startColumn + 1, l = i.startColumn, g = c.getColumnManager().getColumnData();
1732
+ return Rn(d, u, l, g), c.getCellMatrix().moveColumns(d, u, l), !0;
1710
1733
  }
1711
1734
  };
1712
1735
  function Rr(t, e) {
@@ -1727,13 +1750,13 @@ const xn = "sheet.command.move-rows", Tn = {
1727
1750
  );
1728
1751
  if ((s == null ? void 0 : s.length) !== 1)
1729
1752
  return !1;
1730
- const a = t.get($), l = t.get(C).getCurrentUniverSheetInstance();
1731
- if (!l)
1753
+ const a = t.get($), d = t.get(C).getCurrentUniverSheetInstance();
1754
+ if (!d)
1732
1755
  return !1;
1733
- const u = l.getActiveSheet();
1756
+ const u = d.getActiveSheet();
1734
1757
  if (!u)
1735
1758
  return !1;
1736
- const d = l.getUnitId(), g = u.getSheetId(), m = t.get(Rt), h = s[0].range, f = s[0].primary, v = wt(h, u, !1);
1759
+ const l = d.getUnitId(), g = u.getSheetId(), m = t.get(pt), h = s[0].range, f = s[0].primary, v = Mt(h, u, !1);
1737
1760
  if (!E.equals(h, v))
1738
1761
  return m.emit("Only part of a merged cell is selected."), !1;
1739
1762
  if (Rr(i, u))
@@ -1743,35 +1766,35 @@ const xn = "sheet.command.move-rows", Tn = {
1743
1766
  startRow: i,
1744
1767
  endRow: i + h.endRow - h.startRow
1745
1768
  }, w = {
1746
- unitId: d,
1769
+ unitId: l,
1747
1770
  subUnitId: g,
1748
1771
  sourceRange: h,
1749
1772
  targetRange: S
1750
- }, p = Sr(t, w), y = i - r < 0, A = h.endRow - h.startRow + 1, U = y ? S : {
1773
+ }, p = Sr(t, w), _ = i - r < 0, P = h.endRow - h.startRow + 1, D = _ ? S : {
1751
1774
  ...S,
1752
- startRow: S.startRow - A,
1753
- endRow: S.endRow - A
1754
- }, P = {
1755
- unitId: d,
1775
+ startRow: S.startRow - P,
1776
+ endRow: S.endRow - P
1777
+ }, A = {
1778
+ unitId: l,
1756
1779
  subUnitId: g,
1757
1780
  pluginName: se,
1758
- selections: [{ range: U, primary: he(U, u), style: null }]
1781
+ selections: [{ range: D, primary: he(D, u), style: null }]
1759
1782
  }, k = {
1760
- unitId: d,
1783
+ unitId: l,
1761
1784
  subUnitId: g,
1762
1785
  pluginName: se,
1763
1786
  selections: [{ range: h, primary: f, style: null }]
1764
- }, b = t.get(M), j = a.onCommandExecute({ id: Tn.id, params: e }), R = [
1765
- { id: Ct.id, params: w },
1766
- { id: oe.id, params: P },
1787
+ }, U = t.get(M), j = a.onCommandExecute({ id: Tn.id, params: e }), R = [
1788
+ { id: St.id, params: w },
1789
+ { id: oe.id, params: A },
1767
1790
  ...j.redos
1768
1791
  ], ee = [
1769
- { id: Ct.id, params: p },
1792
+ { id: St.id, params: p },
1770
1793
  { id: oe.id, params: k },
1771
1794
  ...j.undos
1772
1795
  ];
1773
- return q(R, b).result ? (t.get(B).pushUndoRedo({
1774
- unitID: d,
1796
+ return q(R, U).result ? (t.get(B).pushUndoRedo({
1797
+ unitID: l,
1775
1798
  undoMutations: ee,
1776
1799
  redoMutations: R
1777
1800
  }), !0) : !1;
@@ -1788,13 +1811,13 @@ const xn = "sheet.command.move-rows", Tn = {
1788
1811
  );
1789
1812
  if ((s == null ? void 0 : s.length) !== 1)
1790
1813
  return !1;
1791
- const a = t.get($), l = t.get(C).getCurrentUniverSheetInstance();
1792
- if (!l)
1814
+ const a = t.get($), d = t.get(C).getCurrentUniverSheetInstance();
1815
+ if (!d)
1793
1816
  return !1;
1794
- const u = l.getActiveSheet();
1817
+ const u = d.getActiveSheet();
1795
1818
  if (!u)
1796
1819
  return !1;
1797
- const d = l.getUnitId(), g = u.getSheetId(), m = t.get(Rt), h = s[0].range, f = s[0].primary, v = wt(h, u, !1);
1820
+ const l = d.getUnitId(), g = u.getSheetId(), m = t.get(pt), h = s[0].range, f = s[0].primary, v = Mt(h, u, !1);
1798
1821
  if (!E.equals(h, v))
1799
1822
  return m.emit("Only part of a merged cell is selected."), !1;
1800
1823
  if (pr(i, u))
@@ -1804,40 +1827,40 @@ const xn = "sheet.command.move-rows", Tn = {
1804
1827
  startColumn: i,
1805
1828
  endColumn: i + h.endColumn - h.startColumn
1806
1829
  }, w = {
1807
- unitId: d,
1830
+ unitId: l,
1808
1831
  subUnitId: g,
1809
1832
  sourceRange: h,
1810
1833
  targetRange: S
1811
- }, p = Ir(t, w), _ = h.endColumn - h.startColumn + 1, U = i - r < 0 ? S : {
1834
+ }, p = Ir(t, w), y = h.endColumn - h.startColumn + 1, D = i - r < 0 ? S : {
1812
1835
  ...S,
1813
- startColumn: S.startColumn - _,
1814
- endColumn: S.endColumn - _
1815
- }, P = {
1816
- unitId: d,
1836
+ startColumn: S.startColumn - y,
1837
+ endColumn: S.endColumn - y
1838
+ }, A = {
1839
+ unitId: l,
1817
1840
  subUnitId: g,
1818
1841
  pluginName: se,
1819
- selections: [{ range: U, primary: he(U, u), style: null }]
1842
+ selections: [{ range: D, primary: he(D, u), style: null }]
1820
1843
  }, k = {
1821
- unitId: d,
1844
+ unitId: l,
1822
1845
  subUnitId: g,
1823
1846
  pluginName: se,
1824
1847
  selections: [{ range: h, primary: f, style: null }]
1825
- }, b = t.get(M), j = a.onCommandExecute({ id: Vn.id, params: e }), R = [
1826
- { id: St.id, params: w },
1827
- { id: oe.id, params: P },
1848
+ }, U = t.get(M), j = a.onCommandExecute({ id: Vn.id, params: e }), R = [
1849
+ { id: It.id, params: w },
1850
+ { id: oe.id, params: A },
1828
1851
  ...j.redos
1829
1852
  ], ee = [
1830
- { id: St.id, params: p },
1853
+ { id: It.id, params: p },
1831
1854
  { id: oe.id, params: k },
1832
1855
  ...j.undos
1833
1856
  ];
1834
- return q(R, b).result && t.get(B).pushUndoRedo({
1835
- unitID: d,
1857
+ return q(R, U).result && t.get(B).pushUndoRedo({
1858
+ unitID: l,
1836
1859
  undoMutations: ee,
1837
1860
  redoMutations: R
1838
1861
  }), !0;
1839
1862
  }
1840
- }, Bn = "sheet.command.remove-row", qt = {
1863
+ }, Bn = "sheet.command.remove-row", Kt = {
1841
1864
  type: I.COMMAND,
1842
1865
  id: Bn,
1843
1866
  handler: async (t, e) => {
@@ -1846,7 +1869,7 @@ const xn = "sheet.command.move-rows", Tn = {
1846
1869
  let r = e == null ? void 0 : e.range;
1847
1870
  if (r || (r = (f = o.getLast()) == null ? void 0 : f.range), !r)
1848
1871
  return !1;
1849
- const s = t.get(C).getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), l = a.getSheetId();
1872
+ const s = t.get(C).getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), d = a.getSheetId();
1850
1873
  r = {
1851
1874
  ...r,
1852
1875
  startColumn: 0,
@@ -1854,29 +1877,29 @@ const xn = "sheet.command.move-rows", Tn = {
1854
1877
  };
1855
1878
  const u = {
1856
1879
  unitId: c,
1857
- subUnitId: l,
1880
+ subUnitId: d,
1858
1881
  range: r
1859
- }, d = dr(
1882
+ }, l = dr(
1860
1883
  u,
1861
1884
  a
1862
1885
  ), g = n.onCommandExecute({
1863
- id: qt.id,
1886
+ id: Kt.id,
1864
1887
  params: { range: r }
1865
1888
  }), m = t.get(M);
1866
1889
  return q(
1867
1890
  [
1868
1891
  { id: je.id, params: u },
1869
1892
  ...g.redos,
1870
- Pe(r, s, a)
1893
+ Ae(r, s, a)
1871
1894
  ],
1872
1895
  m
1873
1896
  ).result ? (t.get(B).pushUndoRedo({
1874
1897
  unitID: c,
1875
- undoMutations: [...g.undos, { id: Be.id, params: d }],
1898
+ undoMutations: [...g.undos, { id: Be.id, params: l }],
1876
1899
  redoMutations: [{ id: je.id, params: u }, ...g.redos]
1877
1900
  }), !0) : !1;
1878
1901
  }
1879
- }, Wn = "sheet.command.remove-col", Kt = {
1902
+ }, Wn = "sheet.command.remove-col", Jt = {
1880
1903
  type: I.COMMAND,
1881
1904
  id: Wn,
1882
1905
  handler: async (t, e) => {
@@ -1885,7 +1908,7 @@ const xn = "sheet.command.move-rows", Tn = {
1885
1908
  let r = e == null ? void 0 : e.range;
1886
1909
  if (r || (r = (f = o.getLast()) == null ? void 0 : f.range), !r)
1887
1910
  return !1;
1888
- const s = t.get(C).getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), l = a.getSheetId();
1911
+ const s = t.get(C).getCurrentUniverSheetInstance(), a = s.getActiveSheet(), c = s.getUnitId(), d = a.getSheetId();
1889
1912
  r = {
1890
1913
  ...r,
1891
1914
  startRow: 0,
@@ -1893,22 +1916,22 @@ const xn = "sheet.command.move-rows", Tn = {
1893
1916
  };
1894
1917
  const u = {
1895
1918
  unitId: c,
1896
- subUnitId: l,
1919
+ subUnitId: d,
1897
1920
  range: r
1898
- }, d = lr(t, u), g = n.onCommandExecute({
1899
- id: Kt.id,
1921
+ }, l = lr(t, u), g = n.onCommandExecute({
1922
+ id: Jt.id,
1900
1923
  params: { range: r }
1901
1924
  }), m = t.get(M);
1902
1925
  return q(
1903
1926
  [
1904
1927
  { id: Fe.id, params: u },
1905
1928
  ...g.redos,
1906
- Pe(r, s, a)
1929
+ Ae(r, s, a)
1907
1930
  ],
1908
1931
  m
1909
1932
  ).result ? (t.get(B).pushUndoRedo({
1910
1933
  unitID: c,
1911
- undoMutations: [...g.undos, { id: We.id, params: d }],
1934
+ undoMutations: [...g.undos, { id: We.id, params: l }],
1912
1935
  redoMutations: [{ id: Fe.id, params: u }, ...g.redos]
1913
1936
  }), !0) : !1;
1914
1937
  }
@@ -1923,22 +1946,22 @@ const xn = "sheet.command.move-rows", Tn = {
1923
1946
  const c = r.getUniverSheetInstance(s);
1924
1947
  if (!c)
1925
1948
  return !1;
1926
- const l = c.getSheetBySheetId(a);
1927
- if (!l || c.getSheets().length <= 1)
1949
+ const d = c.getSheetBySheetId(a);
1950
+ if (!d || c.getSheets().length <= 1)
1928
1951
  return !1;
1929
- const u = c.getSheetIndex(l);
1952
+ const u = c.getSheetIndex(d);
1930
1953
  c.getConfig().sheetOrder[u + 1];
1931
- const d = {
1954
+ const l = {
1932
1955
  subUnitId: a,
1933
1956
  unitId: s,
1934
- subUnitName: l.getName()
1957
+ subUnitName: d.getName()
1935
1958
  }, g = ar(
1936
1959
  t,
1937
- d
1960
+ l
1938
1961
  ), m = i.onCommandExecute({
1939
1962
  id: jn.id,
1940
1963
  params: { unitId: s, subUnitId: a }
1941
- }), h = [{ id: pt.id, params: d }, ...m.redos], f = [...m.undos, { id: Le.id, params: g }];
1964
+ }), h = [{ id: wt.id, params: l }, ...m.redos], f = [...m.undos, { id: Le.id, params: g }];
1942
1965
  return q(h, o) ? (n.pushUndoRedo({
1943
1966
  unitID: s,
1944
1967
  undoMutations: f,
@@ -1976,10 +1999,10 @@ const xn = "sheet.command.move-rows", Tn = {
1976
1999
  if (r == null)
1977
2000
  throw new Error("worksheet is null error!");
1978
2001
  const s = r.getConfig().mergeData, a = e.ranges, c = [];
1979
- for (let l = 0; l < a.length; l++)
2002
+ for (let d = 0; d < a.length; d++)
1980
2003
  for (let u = s.length - 1; u >= 0; u--) {
1981
- const d = s[u], g = a[l];
1982
- E.intersects(d, g) && c.push(s[u]);
2004
+ const l = s[u], g = a[d];
2005
+ E.intersects(l, g) && c.push(s[u]);
1983
2006
  }
1984
2007
  return {
1985
2008
  unitId: e.unitId,
@@ -1998,9 +2021,9 @@ const xn = "sheet.command.move-rows", Tn = {
1998
2021
  return !1;
1999
2022
  const s = r.getConfig().mergeData, a = e.ranges;
2000
2023
  for (let c = 0; c < a.length; c++)
2001
- for (let l = s.length - 1; l >= 0; l--) {
2002
- const u = s[l], d = a[c];
2003
- E.intersects(u, d) && s.splice(l, 1);
2024
+ for (let d = s.length - 1; d >= 0; d--) {
2025
+ const u = s[d], l = a[c];
2026
+ E.intersects(u, l) && s.splice(d, 1);
2004
2027
  }
2005
2028
  return !0;
2006
2029
  }
@@ -2014,21 +2037,21 @@ const xn = "sheet.command.move-rows", Tn = {
2014
2037
  const s = r.getCurrentUniverSheetInstance().getUnitId(), a = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), c = r.getUniverSheetInstance(s);
2015
2038
  if (!c)
2016
2039
  return !1;
2017
- const l = c.getSheetBySheetId(a);
2018
- if (!l)
2040
+ const d = c.getSheetBySheetId(a);
2041
+ if (!d)
2019
2042
  return !1;
2020
2043
  const u = {
2021
2044
  unitId: s,
2022
2045
  subUnitId: a,
2023
2046
  ranges: i
2024
2047
  };
2025
- let d = !1;
2026
- const g = l.getConfig().mergeData;
2048
+ let l = !1;
2049
+ const g = d.getConfig().mergeData;
2027
2050
  if (i.forEach((f) => {
2028
2051
  g.forEach((v) => {
2029
- E.intersects(f, v) && (d = !0);
2052
+ E.intersects(f, v) && (l = !0);
2030
2053
  });
2031
- }), !d)
2054
+ }), !l)
2032
2055
  return !1;
2033
2056
  const m = ve(
2034
2057
  t,
@@ -2049,7 +2072,7 @@ class He {
2049
2072
  style: Co.THIN,
2050
2073
  activeBorderType: !1
2051
2074
  });
2052
- F(this, "_borderInfo$", new pn(this._borderInfo));
2075
+ F(this, "_borderInfo$", new wn(this._borderInfo));
2053
2076
  F(this, "borderInfo$", this._borderInfo$.asObservable());
2054
2077
  }
2055
2078
  dispose() {
@@ -2094,17 +2117,17 @@ function rt(t, e) {
2094
2117
  for (let a = n; a <= i; a++)
2095
2118
  e(s, a);
2096
2119
  }
2097
- const _r = {
2120
+ const yr = {
2098
2121
  id: "sheet.command.set-border-basic",
2099
2122
  type: I.COMMAND,
2100
2123
  handler: async (t, e) => {
2101
- const { unitId: o, subUnitId: n, value: r } = e, { type: i, color: s, style: a } = r, c = t.get(M), l = t.get(He);
2102
- return l.setType(i), l.setColor(s), l.setStyle(a), c.executeCommand(nt.id, {
2124
+ const { unitId: o, subUnitId: n, value: r } = e, { type: i, color: s, style: a } = r, c = t.get(M), d = t.get(He);
2125
+ return d.setType(i), d.setColor(s), d.setStyle(a), c.executeCommand(nt.id, {
2103
2126
  unitId: o,
2104
2127
  subUnitId: n
2105
2128
  });
2106
2129
  }
2107
- }, yr = {
2130
+ }, _r = {
2108
2131
  id: "sheet.command.set-border-position",
2109
2132
  type: I.COMMAND,
2110
2133
  handler: async (t, e) => {
@@ -2131,22 +2154,22 @@ const _r = {
2131
2154
  id: "sheet.command.set-border",
2132
2155
  type: I.COMMAND,
2133
2156
  handler: async (t, e) => {
2134
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(L), s = t.get(He), { worksheet: a, unitId: c, subUnitId: l } = Mr(
2157
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(L), s = t.get(He), { worksheet: a, unitId: c, subUnitId: d } = Mr(
2135
2158
  r,
2136
2159
  e == null ? void 0 : e.unitId,
2137
2160
  e == null ? void 0 : e.subUnitId
2138
- ), u = i.getSelectionRanges(), d = a.getConfig().mergeData;
2161
+ ), u = i.getSelectionRanges(), l = a.getConfig().mergeData;
2139
2162
  if (!(u != null && u.length))
2140
2163
  return !1;
2141
2164
  const { style: g, color: m, type: h, activeBorderType: f } = s.getBorderInfo();
2142
2165
  if (!f)
2143
2166
  return !1;
2144
- const v = h === re.TOP || h === re.ALL || h === re.OUTSIDE, S = h === re.LEFT || h === re.ALL || h === re.OUTSIDE, w = h === re.BOTTOM || h === re.ALL || h === re.OUTSIDE, p = h === re.RIGHT || h === re.ALL || h === re.OUTSIDE, _ = h === re.VERTICAL || h === re.ALL || h === re.INSIDE, y = h === re.HORIZONTAL || h === re.ALL || h === re.INSIDE, A = h.indexOf("tlbr") > -1, U = h.indexOf("tlbc") > -1, P = h.indexOf("tlmr") > -1, k = h.indexOf("bltr") > -1, b = h.indexOf("mltr") > -1, j = h.indexOf("bctr") > -1, R = u[0], ee = {
2167
+ const v = h === re.TOP || h === re.ALL || h === re.OUTSIDE, S = h === re.LEFT || h === re.ALL || h === re.OUTSIDE, w = h === re.BOTTOM || h === re.ALL || h === re.OUTSIDE, p = h === re.RIGHT || h === re.ALL || h === re.OUTSIDE, y = h === re.VERTICAL || h === re.ALL || h === re.INSIDE, _ = h === re.HORIZONTAL || h === re.ALL || h === re.INSIDE, P = h.indexOf("tlbr") > -1, D = h.indexOf("tlbc") > -1, A = h.indexOf("tlmr") > -1, k = h.indexOf("bltr") > -1, U = h.indexOf("mltr") > -1, j = h.indexOf("bctr") > -1, R = u[0], ee = {
2145
2168
  startRow: R.startRow - 1,
2146
2169
  startColumn: R.startColumn,
2147
2170
  endRow: R.startRow - 1,
2148
2171
  endColumn: R.endColumn
2149
- }, Ae = {
2172
+ }, Pe = {
2150
2173
  startRow: R.startRow,
2151
2174
  startColumn: R.startColumn - 1,
2152
2175
  endRow: R.endRow,
@@ -2161,22 +2184,22 @@ const _r = {
2161
2184
  startColumn: R.endColumn + 1,
2162
2185
  endRow: R.endRow,
2163
2186
  endColumn: R.endColumn + 1
2164
- }, Yt = {
2187
+ }, Zt = {
2165
2188
  startRow: R.startRow,
2166
2189
  startColumn: R.startColumn,
2167
2190
  endRow: R.startRow,
2168
2191
  endColumn: R.endColumn
2169
- }, Zt = {
2192
+ }, Qt = {
2170
2193
  startRow: R.startRow,
2171
2194
  startColumn: R.startColumn,
2172
2195
  endRow: R.endRow,
2173
2196
  endColumn: R.startColumn
2174
- }, Qt = {
2197
+ }, en = {
2175
2198
  startRow: R.endRow,
2176
2199
  startColumn: R.startColumn,
2177
2200
  endRow: R.endRow,
2178
2201
  endColumn: R.endColumn
2179
- }, en = {
2202
+ }, tn = {
2180
2203
  startRow: R.startRow,
2181
2204
  startColumn: R.endColumn,
2182
2205
  endRow: R.endRow,
@@ -2188,7 +2211,7 @@ const _r = {
2188
2211
  }
2189
2212
  }, ot = (x, N) => {
2190
2213
  let W = null;
2191
- return d.forEach((ae) => {
2214
+ return l.forEach((ae) => {
2192
2215
  E.intersects(ae, {
2193
2216
  startColumn: N,
2194
2217
  endColumn: N,
@@ -2204,7 +2227,7 @@ const _r = {
2204
2227
  let de = N;
2205
2228
  if (ce) {
2206
2229
  if (W) {
2207
- const fe = D.deepClone(
2230
+ const fe = b.deepClone(
2208
2231
  (O = V.getValue(ce.startRow, ce.startColumn)) == null ? void 0 : O.s
2209
2232
  );
2210
2233
  de = fe != null && fe.bd ? Object.assign(fe.bd, N) : N;
@@ -2216,14 +2239,14 @@ const _r = {
2216
2239
  });
2217
2240
  } else {
2218
2241
  if (W) {
2219
- const fe = D.deepClone((Ge = V.getValue(ae, me)) == null ? void 0 : Ge.s);
2242
+ const fe = b.deepClone((Ge = V.getValue(ae, me)) == null ? void 0 : Ge.s);
2220
2243
  de = fe != null && fe.bd ? Object.assign(fe.bd, N) : N;
2221
2244
  }
2222
2245
  V.setValue(ae, me, { s: { bd: de } });
2223
2246
  }
2224
2247
  });
2225
2248
  }
2226
- v && Y(Yt, { t: D.deepClone(K) }, !0), w && Y(Qt, { b: D.deepClone(K) }, !0), S && Y(Zt, { l: D.deepClone(K) }, !0), p && Y(en, { r: D.deepClone(K) }, !0), A && Y(R, { tl_br: D.deepClone(K) }, !0), U && Y(R, { tl_bc: D.deepClone(K) }, !0), P && Y(R, { tl_mr: D.deepClone(K) }, !0), k && Y(R, { bl_tr: D.deepClone(K) }, !0), b && Y(R, { ml_tr: D.deepClone(K) }, !0), j && Y(R, { bc_tr: D.deepClone(K) }, !0), _ && rt(R, (x, N) => {
2249
+ v && Y(Zt, { t: b.deepClone(K) }, !0), w && Y(en, { b: b.deepClone(K) }, !0), S && Y(Qt, { l: b.deepClone(K) }, !0), p && Y(tn, { r: b.deepClone(K) }, !0), P && Y(R, { tl_br: b.deepClone(K) }, !0), D && Y(R, { tl_bc: b.deepClone(K) }, !0), A && Y(R, { tl_mr: b.deepClone(K) }, !0), k && Y(R, { bl_tr: b.deepClone(K) }, !0), U && Y(R, { ml_tr: b.deepClone(K) }, !0), j && Y(R, { bc_tr: b.deepClone(K) }, !0), y && rt(R, (x, N) => {
2227
2250
  var ae, me, ce, de;
2228
2251
  const W = ot(x, N);
2229
2252
  if (W) {
@@ -2231,7 +2254,7 @@ const _r = {
2231
2254
  const O = (ae = V.getValue(W.startRow, W.startColumn)) == null ? void 0 : ae.s;
2232
2255
  V.setValue(x, N, {
2233
2256
  s: {
2234
- bd: O != null && O.bd ? Object.assign(O.bd, { r: D.deepClone(K) }) : { r: D.deepClone(K) }
2257
+ bd: O != null && O.bd ? Object.assign(O.bd, { r: b.deepClone(K) }) : { r: b.deepClone(K) }
2235
2258
  }
2236
2259
  });
2237
2260
  }
@@ -2239,7 +2262,7 @@ const _r = {
2239
2262
  const O = (me = V.getValue(W.startRow, W.startColumn)) == null ? void 0 : me.s;
2240
2263
  V.setValue(x, N, {
2241
2264
  s: {
2242
- bd: O != null && O.bd ? Object.assign(O.bd, { l: D.deepClone(K) }) : { l: D.deepClone(K) }
2265
+ bd: O != null && O.bd ? Object.assign(O.bd, { l: b.deepClone(K) }) : { l: b.deepClone(K) }
2243
2266
  }
2244
2267
  });
2245
2268
  }
@@ -2248,7 +2271,7 @@ const _r = {
2248
2271
  const O = (ce = V.getValue(x, N)) == null ? void 0 : ce.s;
2249
2272
  V.setValue(x, N, {
2250
2273
  s: {
2251
- bd: O != null && O.bd ? Object.assign(O.bd, { r: D.deepClone(K) }) : { r: D.deepClone(K) }
2274
+ bd: O != null && O.bd ? Object.assign(O.bd, { r: b.deepClone(K) }) : { r: b.deepClone(K) }
2252
2275
  }
2253
2276
  });
2254
2277
  }
@@ -2256,12 +2279,12 @@ const _r = {
2256
2279
  const O = (de = V.getValue(x, N)) == null ? void 0 : de.s;
2257
2280
  V.setValue(x, N, {
2258
2281
  s: {
2259
- bd: O != null && O.bd ? Object.assign(O.bd, { l: D.deepClone(K) }) : { l: D.deepClone(K) }
2282
+ bd: O != null && O.bd ? Object.assign(O.bd, { l: b.deepClone(K) }) : { l: b.deepClone(K) }
2260
2283
  }
2261
2284
  });
2262
2285
  }
2263
2286
  }
2264
- }), y && rt(R, (x, N) => {
2287
+ }), _ && rt(R, (x, N) => {
2265
2288
  var ae, me, ce, de;
2266
2289
  const W = ot(x, N);
2267
2290
  if (W) {
@@ -2269,7 +2292,7 @@ const _r = {
2269
2292
  const O = (ae = V.getValue(W.startRow, W.startColumn)) == null ? void 0 : ae.s;
2270
2293
  V.setValue(x, N, {
2271
2294
  s: {
2272
- bd: O != null && O.bd ? Object.assign(O.bd, { b: D.deepClone(K) }) : { b: D.deepClone(K) }
2295
+ bd: O != null && O.bd ? Object.assign(O.bd, { b: b.deepClone(K) }) : { b: b.deepClone(K) }
2273
2296
  }
2274
2297
  });
2275
2298
  }
@@ -2277,7 +2300,7 @@ const _r = {
2277
2300
  const O = (me = V.getValue(W.startRow, W.startColumn)) == null ? void 0 : me.s;
2278
2301
  V.setValue(x, N, {
2279
2302
  s: {
2280
- bd: O != null && O.bd ? Object.assign(O.bd, { t: D.deepClone(K) }) : { t: D.deepClone(K) }
2303
+ bd: O != null && O.bd ? Object.assign(O.bd, { t: b.deepClone(K) }) : { t: b.deepClone(K) }
2281
2304
  }
2282
2305
  });
2283
2306
  }
@@ -2286,7 +2309,7 @@ const _r = {
2286
2309
  const O = (ce = V.getValue(x, N)) == null ? void 0 : ce.s;
2287
2310
  V.setValue(x, N, {
2288
2311
  s: {
2289
- bd: O != null && O.bd ? Object.assign(O.bd, { b: D.deepClone(K) }) : { b: D.deepClone(K) }
2312
+ bd: O != null && O.bd ? Object.assign(O.bd, { b: b.deepClone(K) }) : { b: b.deepClone(K) }
2290
2313
  }
2291
2314
  });
2292
2315
  }
@@ -2294,13 +2317,13 @@ const _r = {
2294
2317
  const O = (de = V.getValue(x, N)) == null ? void 0 : de.s;
2295
2318
  V.setValue(x, N, {
2296
2319
  s: {
2297
- bd: O != null && O.bd ? Object.assign(O.bd, { t: D.deepClone(K) }) : { t: D.deepClone(K) }
2320
+ bd: O != null && O.bd ? Object.assign(O.bd, { t: b.deepClone(K) }) : { t: b.deepClone(K) }
2298
2321
  }
2299
2322
  });
2300
2323
  }
2301
2324
  }
2302
- }), !v && !w && !S && !p && !_ && !y && !A && !U && !P && !k && !b && !j && (Y(ee, { b: null }), Y(Yt, { t: null }, !0), Y(Ce, { t: null }), Y(Qt, { b: null }, !0), Y(Ae, { r: null }), Y(Zt, { l: null }, !0), Y(ao, { l: null }), Y(en, { r: null }, !0), Y(R, { tl_br: null }, !0), Y(R, { tl_bc: null }, !0), Y(R, { tl_mr: null }, !0), Y(R, { bl_tr: null }, !0), Y(R, { ml_tr: null }, !0), Y(R, { bc_tr: null }, !0), rt(R, (x, N) => {
2303
- var ae, me, ce, de, O, Ge, fe, tn;
2325
+ }), !v && !w && !S && !p && !y && !_ && !P && !D && !A && !k && !U && !j && (Y(ee, { b: null }), Y(Zt, { t: null }, !0), Y(Ce, { t: null }), Y(en, { b: null }, !0), Y(Pe, { r: null }), Y(Qt, { l: null }, !0), Y(ao, { l: null }), Y(tn, { r: null }, !0), Y(R, { tl_br: null }, !0), Y(R, { tl_bc: null }, !0), Y(R, { tl_mr: null }, !0), Y(R, { bl_tr: null }, !0), Y(R, { ml_tr: null }, !0), Y(R, { bc_tr: null }, !0), rt(R, (x, N) => {
2326
+ var ae, me, ce, de, O, Ge, fe, nn;
2304
2327
  const W = ot(x, N);
2305
2328
  if (W) {
2306
2329
  if (W.endColumn !== R.endColumn) {
@@ -2361,7 +2384,7 @@ const _r = {
2361
2384
  });
2362
2385
  }
2363
2386
  if (x !== R.startRow) {
2364
- const T = (tn = V.getValue(x, N)) == null ? void 0 : tn.s;
2387
+ const T = (nn = V.getValue(x, N)) == null ? void 0 : nn.s;
2365
2388
  V.setValue(x, N, {
2366
2389
  s: {
2367
2390
  bd: T != null && T.bd ? Object.assign(T.bd, { t: null }) : { t: null }
@@ -2370,18 +2393,18 @@ const _r = {
2370
2393
  }
2371
2394
  }
2372
2395
  }));
2373
- const bt = {
2396
+ const Ut = {
2374
2397
  unitId: c,
2375
- subUnitId: l,
2398
+ subUnitId: d,
2376
2399
  cellValue: V.getData()
2377
2400
  }, co = Oe(
2378
2401
  t,
2379
- bt
2402
+ Ut
2380
2403
  );
2381
- return o.syncExecuteCommand(Q.id, bt) ? (n.pushUndoRedo({
2404
+ return o.syncExecuteCommand(Q.id, Ut) ? (n.pushUndoRedo({
2382
2405
  unitID: c,
2383
2406
  undoMutations: [{ id: Q.id, params: co }],
2384
- redoMutations: [{ id: Q.id, params: bt }]
2407
+ redoMutations: [{ id: Q.id, params: Ut }]
2385
2408
  }), !0) : !1;
2386
2409
  }
2387
2410
  }, Dr = (t, e) => {
@@ -2447,7 +2470,7 @@ const _r = {
2447
2470
  subUnitId: n,
2448
2471
  pluginName: se,
2449
2472
  selections: r.map((g) => ({ range: g, primary: he(g, i), style: null }))
2450
- }, l = {
2473
+ }, d = {
2451
2474
  unitId: o,
2452
2475
  subUnitId: n,
2453
2476
  pluginName: se,
@@ -2467,7 +2490,7 @@ const _r = {
2467
2490
  unitID: o,
2468
2491
  undoMutations: [
2469
2492
  { id: Xe.id, params: a },
2470
- { id: oe.id, params: l }
2493
+ { id: oe.id, params: d }
2471
2494
  ],
2472
2495
  redoMutations: [
2473
2496
  { id: Ye.id, params: s },
@@ -2479,8 +2502,8 @@ const _r = {
2479
2502
  type: I.COMMAND,
2480
2503
  id: "sheet.command.set-selected-cols-visible",
2481
2504
  handler: async (t) => {
2482
- var l;
2483
- const o = (l = t.get(L).getSelections()) == null ? void 0 : l.map((u) => u.range).filter((u) => u.rangeType === G.COLUMN);
2505
+ var d;
2506
+ const o = (d = t.get(L).getSelections()) == null ? void 0 : d.map((u) => u.range).filter((u) => u.rangeType === G.COLUMN);
2484
2507
  if (!(o != null && o.length))
2485
2508
  return !1;
2486
2509
  const r = t.get(C).getCurrentUniverSheetInstance();
@@ -2496,7 +2519,7 @@ const _r = {
2496
2519
  ranges: c
2497
2520
  });
2498
2521
  }
2499
- }, Pr = {
2522
+ }, Ar = {
2500
2523
  type: I.COMMAND,
2501
2524
  id: "sheet.command.set-col-hidden",
2502
2525
  handler: async (t) => {
@@ -2514,7 +2537,7 @@ const _r = {
2514
2537
  unitId: s,
2515
2538
  subUnitId: a,
2516
2539
  ranges: o
2517
- }, l = {
2540
+ }, d = {
2518
2541
  unitId: s,
2519
2542
  subUnitId: a,
2520
2543
  pluginName: se,
@@ -2532,13 +2555,13 @@ const _r = {
2532
2555
  primary: he(h, i),
2533
2556
  style: null
2534
2557
  }))
2535
- }, d = t.get(M);
2558
+ }, l = t.get(M);
2536
2559
  if (q(
2537
2560
  [
2538
2561
  { id: Xe.id, params: c },
2539
- { id: oe.id, params: l }
2562
+ { id: oe.id, params: d }
2540
2563
  ],
2541
- d
2564
+ l
2542
2565
  ).result) {
2543
2566
  const h = t.get(B), f = Dr(t, c);
2544
2567
  return h.pushUndoRedo({
@@ -2549,7 +2572,7 @@ const _r = {
2549
2572
  ],
2550
2573
  redoMutations: [
2551
2574
  { id: Xe.id, params: c },
2552
- { id: oe.id, params: l }
2575
+ { id: oe.id, params: d }
2553
2576
  ]
2554
2577
  }), !0;
2555
2578
  }
@@ -2557,7 +2580,7 @@ const _r = {
2557
2580
  }
2558
2581
  };
2559
2582
  function $n(t) {
2560
- return Ar(t).map((o) => {
2583
+ return Pr(t).map((o) => {
2561
2584
  const n = o.startColumn === 0 ? o.endColumn + 1 : o.startColumn - 1;
2562
2585
  return {
2563
2586
  ...o,
@@ -2566,7 +2589,7 @@ function $n(t) {
2566
2589
  };
2567
2590
  });
2568
2591
  }
2569
- function Ar(t) {
2592
+ function Pr(t) {
2570
2593
  const e = [];
2571
2594
  let o;
2572
2595
  return t.sort((n, r) => n.startColumn - r.startColumn).forEach((n) => {
@@ -2600,8 +2623,8 @@ const Hn = (t, e) => {
2600
2623
  const r = n.getSheetBySheetId(e.subUnitId);
2601
2624
  if (!r)
2602
2625
  return !1;
2603
- const i = r.getConfig(), { startRow: s, startColumn: a, ySplit: c, xSplit: l } = e;
2604
- return i.freeze = { startRow: s, startColumn: a, ySplit: c, xSplit: l }, !0;
2626
+ const i = r.getConfig(), { startRow: s, startColumn: a, ySplit: c, xSplit: d } = e;
2627
+ return i.freeze = { startRow: s, startColumn: a, ySplit: c, xSplit: d }, !0;
2605
2628
  }
2606
2629
  }, Er = {
2607
2630
  type: I.COMMAND,
@@ -2613,8 +2636,8 @@ const Hn = (t, e) => {
2613
2636
  const c = a.getSheetBySheetId(s);
2614
2637
  if (!c)
2615
2638
  return !1;
2616
- const { startColumn: l, startRow: u, xSplit: d, ySplit: g } = e;
2617
- if (u >= c.getRowCount() || l >= c.getColumnCount() || d >= c.getColumnCount() || g >= c.getRowCount())
2639
+ const { startColumn: d, startRow: u, xSplit: l, ySplit: g } = e;
2640
+ if (u >= c.getRowCount() || d >= c.getColumnCount() || l >= c.getColumnCount() || g >= c.getRowCount())
2618
2641
  return !1;
2619
2642
  const m = {
2620
2643
  unitId: i,
@@ -2641,10 +2664,10 @@ const Hn = (t, e) => {
2641
2664
  startColumn: -1,
2642
2665
  ySplit: 0,
2643
2666
  xSplit: 0
2644
- }, l = Hn(t, c);
2667
+ }, d = Hn(t, c);
2645
2668
  return e.syncExecuteCommand(Ee.id, c) ? (o.pushUndoRedo({
2646
2669
  unitID: r,
2647
- undoMutations: [{ id: Ee.id, params: l }],
2670
+ undoMutations: [{ id: Ee.id, params: d }],
2648
2671
  redoMutations: [{ id: Ee.id, params: c }]
2649
2672
  }), !0) : !1;
2650
2673
  }
@@ -2706,7 +2729,7 @@ const Hn = (t, e) => {
2706
2729
  unitId: o,
2707
2730
  subUnitId: n,
2708
2731
  ranges: r
2709
- }, l = xr(t, c), u = {
2732
+ }, d = xr(t, c), u = {
2710
2733
  unitId: o,
2711
2734
  subUnitId: n,
2712
2735
  pluginName: se,
@@ -2715,7 +2738,7 @@ const Hn = (t, e) => {
2715
2738
  primary: he(m, a),
2716
2739
  style: null
2717
2740
  }))
2718
- }, d = {
2741
+ }, l = {
2719
2742
  unitId: o,
2720
2743
  subUnitId: n,
2721
2744
  pluginName: se,
@@ -2734,8 +2757,8 @@ const Hn = (t, e) => {
2734
2757
  ).result && s.pushUndoRedo({
2735
2758
  unitID: o,
2736
2759
  undoMutations: [
2737
- { id: Qe.id, params: l },
2738
- { id: oe.id, params: d }
2760
+ { id: Qe.id, params: d },
2761
+ { id: oe.id, params: l }
2739
2762
  ],
2740
2763
  redoMutations: [
2741
2764
  { id: Ze.id, params: c },
@@ -2747,8 +2770,8 @@ const Hn = (t, e) => {
2747
2770
  type: I.COMMAND,
2748
2771
  id: "sheet.command.set-selected-rows-visible",
2749
2772
  handler: async (t) => {
2750
- var l;
2751
- const e = t.get(L), o = t.get(C), n = (l = e.getSelections()) == null ? void 0 : l.map((u) => u.range).filter((u) => u.rangeType === G.ROW);
2773
+ var d;
2774
+ const e = t.get(L), o = t.get(C), n = (d = e.getSelections()) == null ? void 0 : d.map((u) => u.range).filter((u) => u.rangeType === G.ROW);
2752
2775
  if (!(n != null && n.length))
2753
2776
  return !1;
2754
2777
  const r = o.getCurrentUniverSheetInstance();
@@ -2775,20 +2798,20 @@ const Hn = (t, e) => {
2775
2798
  const s = r.getCurrentUniverSheetInstance().getUnitId(), a = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), c = r.getUniverSheetInstance(s);
2776
2799
  if (!c)
2777
2800
  return !1;
2778
- const l = c.getSheetBySheetId(a);
2779
- if (!l)
2801
+ const d = c.getSheetBySheetId(a);
2802
+ if (!d)
2780
2803
  return !1;
2781
2804
  const u = {
2782
2805
  unitId: s,
2783
2806
  subUnitId: a,
2784
2807
  ranges: i
2785
- }, d = {
2808
+ }, l = {
2786
2809
  unitId: s,
2787
2810
  subUnitId: a,
2788
2811
  pluginName: se,
2789
2812
  selections: Gn(i).map((v) => ({
2790
2813
  range: v,
2791
- primary: he(v, l),
2814
+ primary: he(v, d),
2792
2815
  style: null
2793
2816
  }))
2794
2817
  }, g = {
@@ -2797,14 +2820,14 @@ const Hn = (t, e) => {
2797
2820
  pluginName: se,
2798
2821
  selections: i.map((v) => ({
2799
2822
  range: v,
2800
- primary: he(v, l),
2823
+ primary: he(v, d),
2801
2824
  style: null
2802
2825
  }))
2803
2826
  }, m = Tr(t, u);
2804
2827
  return q(
2805
2828
  [
2806
2829
  { id: Qe.id, params: u },
2807
- { id: oe.id, params: d }
2830
+ { id: oe.id, params: l }
2808
2831
  ],
2809
2832
  o
2810
2833
  ).result && n.pushUndoRedo({
@@ -2815,7 +2838,7 @@ const Hn = (t, e) => {
2815
2838
  ],
2816
2839
  redoMutations: [
2817
2840
  { id: Qe.id, params: u },
2818
- { id: oe.id, params: d }
2841
+ { id: oe.id, params: l }
2819
2842
  ]
2820
2843
  }), !0;
2821
2844
  }
@@ -2850,34 +2873,34 @@ const ie = {
2850
2873
  subUnitId: r = o.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),
2851
2874
  range: i,
2852
2875
  style: s
2853
- } = e, a = t.get(M), c = t.get(B), l = t.get(L), u = i ? [i] : l.getSelectionRanges();
2876
+ } = e, a = t.get(M), c = t.get(B), d = t.get(L), u = i ? [i] : d.getSelectionRanges();
2854
2877
  if (!(u != null && u.length))
2855
2878
  return !1;
2856
- const d = o.getUniverSheetInstance(n);
2857
- if ((d == null ? void 0 : d.getSheetBySheetId(r)) == null)
2879
+ const l = o.getUniverSheetInstance(n);
2880
+ if ((l == null ? void 0 : l.getSheetBySheetId(r)) == null)
2858
2881
  return !1;
2859
2882
  const m = new ne();
2860
- if (D.isArray(s.value))
2861
- for (let _ = 0; _ < u.length; _++) {
2862
- const { startRow: y, endRow: A, startColumn: U, endColumn: P } = u[_];
2863
- for (let k = 0; k <= A - y; k++)
2864
- for (let b = 0; b <= P - U; b++)
2865
- m.setValue(k + y, b + U, {
2883
+ if (b.isArray(s.value))
2884
+ for (let y = 0; y < u.length; y++) {
2885
+ const { startRow: _, endRow: P, startColumn: D, endColumn: A } = u[y];
2886
+ for (let k = 0; k <= P - _; k++)
2887
+ for (let U = 0; U <= A - D; U++)
2888
+ m.setValue(k + _, U + D, {
2866
2889
  s: {
2867
- [s.type]: s.value[k][b]
2890
+ [s.type]: s.value[k][U]
2868
2891
  }
2869
2892
  });
2870
2893
  }
2871
2894
  else
2872
- for (let _ = 0; _ < u.length; _++) {
2873
- const { startRow: y, endRow: A, startColumn: U, endColumn: P } = u[_], k = {
2895
+ for (let y = 0; y < u.length; y++) {
2896
+ const { startRow: _, endRow: P, startColumn: D, endColumn: A } = u[y], k = {
2874
2897
  s: {
2875
2898
  [s.type]: s.value
2876
2899
  }
2877
2900
  };
2878
- for (let b = y; b <= A; b++)
2879
- for (let j = U; j <= P; j++)
2880
- m.setValue(b, j, k);
2901
+ for (let U = _; U <= P; U++)
2902
+ for (let j = D; j <= A; j++)
2903
+ m.setValue(U, j, k);
2881
2904
  }
2882
2905
  const h = {
2883
2906
  subUnitId: r,
@@ -3124,10 +3147,10 @@ const mi = {
3124
3147
  }, Kr = (t, e) => {
3125
3148
  const i = t.get(C).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;
3126
3149
  return {
3127
- ...D.deepClone(e),
3150
+ ...b.deepClone(e),
3128
3151
  color: i
3129
3152
  };
3130
- }, ct = {
3153
+ }, ut = {
3131
3154
  id: "sheet.mutation.set-tab-color",
3132
3155
  type: I.MUTATION,
3133
3156
  handler: (t, e) => {
@@ -3144,18 +3167,18 @@ const mi = {
3144
3167
  const o = t.get(M), n = t.get(B), r = t.get(C), i = r.getCurrentUniverSheetInstance().getUnitId(), s = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), a = r.getUniverSheetInstance(i);
3145
3168
  if (!a || !a.getSheetBySheetId(s))
3146
3169
  return !1;
3147
- const l = {
3170
+ const d = {
3148
3171
  color: e.value,
3149
3172
  unitId: i,
3150
3173
  subUnitId: s
3151
- }, u = Kr(t, l);
3152
- return o.syncExecuteCommand(ct.id, l) ? (n.pushUndoRedo({
3174
+ }, u = Kr(t, d);
3175
+ return o.syncExecuteCommand(ut.id, d) ? (n.pushUndoRedo({
3153
3176
  unitID: i,
3154
- undoMutations: [{ id: ct.id, params: u }],
3155
- redoMutations: [{ id: ct.id, params: l }]
3177
+ undoMutations: [{ id: ut.id, params: u }],
3178
+ redoMutations: [{ id: ut.id, params: d }]
3156
3179
  }), !0) : !1;
3157
3180
  }
3158
- }, Mt = {
3181
+ }, yt = {
3159
3182
  id: "sheet.operation.set-worksheet-active",
3160
3183
  type: I.OPERATION,
3161
3184
  handler: (t, e) => {
@@ -3180,7 +3203,7 @@ const mi = {
3180
3203
  unitId: r,
3181
3204
  subUnitId: i
3182
3205
  };
3183
- return o.syncExecuteCommand(Mt.id, s);
3206
+ return o.syncExecuteCommand(yt.id, s);
3184
3207
  }
3185
3208
  }, Kn = (t, e) => {
3186
3209
  const n = t.get(C).getUniverSheetInstance(e.unitId);
@@ -3191,10 +3214,10 @@ const mi = {
3191
3214
  throw new Error("universheet is null error!");
3192
3215
  const i = {}, s = r.getColumnManager(), a = e.ranges;
3193
3216
  for (let c = 0; c < a.length; c++) {
3194
- const l = a[c];
3195
- for (let u = l.startColumn; u < l.endColumn + 1; u++) {
3196
- const d = s.getColumnOrCreate(u);
3197
- i[u] = d.w;
3217
+ const d = a[c];
3218
+ for (let u = d.startColumn; u < d.endColumn + 1; u++) {
3219
+ const l = s.getColumnOrCreate(u);
3220
+ i[u] = l.w;
3198
3221
  }
3199
3222
  }
3200
3223
  return {
@@ -3203,7 +3226,7 @@ const mi = {
3203
3226
  ranges: e.ranges,
3204
3227
  colWidth: i
3205
3228
  };
3206
- }, ye = {
3229
+ }, _e = {
3207
3230
  id: "sheet.mutation.set-worksheet-col-width",
3208
3231
  type: I.MUTATION,
3209
3232
  handler: (t, e) => {
@@ -3215,11 +3238,11 @@ const mi = {
3215
3238
  if (!r)
3216
3239
  return !1;
3217
3240
  const i = r.getConfig().defaultColumnWidth, s = r.getColumnManager(), a = e.ranges;
3218
- for (let l = 0; l < a.length; l++) {
3219
- const u = a[l];
3220
- for (let d = u.startColumn; d < u.endColumn + 1; d++) {
3221
- const g = s.getColumnOrCreate(d);
3222
- typeof e.colWidth == "number" ? g.w = e.colWidth : g.w = (c = e.colWidth[d - u.startColumn]) != null ? c : i;
3241
+ for (let d = 0; d < a.length; d++) {
3242
+ const u = a[d];
3243
+ for (let l = u.startColumn; l < u.endColumn + 1; l++) {
3244
+ const g = s.getColumnOrCreate(l);
3245
+ typeof e.colWidth == "number" ? g.w = e.colWidth : g.w = (c = e.colWidth[l - u.startColumn]) != null ? c : i;
3223
3246
  }
3224
3247
  }
3225
3248
  return !0;
@@ -3231,54 +3254,54 @@ const mi = {
3231
3254
  const n = t.get(L).getSelections();
3232
3255
  if (!(n != null && n.length))
3233
3256
  return !1;
3234
- const r = t.get(M), i = t.get(B), a = t.get(C).getCurrentUniverSheetInstance(), c = a.getActiveSheet(), l = a.getUnitId(), u = c.getSheetId(), { anchorCol: d, deltaX: g } = e, h = c.getColumnWidth(d) + g, f = n.length === 1 && n[0].range.rangeType === G.ALL, v = n.filter((P) => P.range.rangeType === G.COLUMN), S = f ? G.ALL : v.some(({ range: P }) => {
3235
- const { startColumn: k, endColumn: b } = P;
3236
- return k <= d && d <= b;
3257
+ const r = t.get(M), i = t.get(B), a = t.get(C).getCurrentUniverSheetInstance(), c = a.getActiveSheet(), d = a.getUnitId(), u = c.getSheetId(), { anchorCol: l, deltaX: g } = e, h = c.getColumnWidth(l) + g, f = n.length === 1 && n[0].range.rangeType === G.ALL, v = n.filter((A) => A.range.rangeType === G.COLUMN), S = f ? G.ALL : v.some(({ range: A }) => {
3258
+ const { startColumn: k, endColumn: U } = A;
3259
+ return k <= l && l <= U;
3237
3260
  }) ? G.COLUMN : G.NORMAL;
3238
3261
  let w;
3239
3262
  if (S === G.ALL) {
3240
- const P = c.getRowCount(), k = new Array(c.getColumnCount()).fill(void 0).map(
3241
- (b, j) => ({ startRow: 0, endRow: P - 1, startColumn: j, endColumn: j })
3263
+ const A = c.getRowCount(), k = new Array(c.getColumnCount()).fill(void 0).map(
3264
+ (U, j) => ({ startRow: 0, endRow: A - 1, startColumn: j, endColumn: j })
3242
3265
  );
3243
3266
  w = {
3244
3267
  subUnitId: u,
3245
- unitId: l,
3268
+ unitId: d,
3246
3269
  colWidth: h,
3247
3270
  ranges: k
3248
3271
  };
3249
3272
  } else
3250
3273
  S === G.COLUMN ? w = {
3251
3274
  subUnitId: u,
3252
- unitId: l,
3253
- ranges: v.map((P) => E.clone(P.range)),
3275
+ unitId: d,
3276
+ ranges: v.map((A) => E.clone(A.range)),
3254
3277
  colWidth: h
3255
3278
  } : w = {
3256
3279
  subUnitId: u,
3257
- unitId: l,
3280
+ unitId: d,
3258
3281
  colWidth: h,
3259
3282
  ranges: [
3260
3283
  {
3261
3284
  startRow: 0,
3262
3285
  endRow: c.getMaxRows() - 1,
3263
- startColumn: d,
3264
- endColumn: d
3286
+ startColumn: l,
3287
+ endColumn: l
3265
3288
  }
3266
3289
  ]
3267
3290
  };
3268
3291
  const p = Kn(
3269
3292
  t,
3270
3293
  w
3271
- ), _ = r.syncExecuteCommand(
3272
- ye.id,
3294
+ ), y = r.syncExecuteCommand(
3295
+ _e.id,
3273
3296
  w
3274
- ), { undos: y, redos: A } = t.get($).onCommandExecute({
3297
+ ), { undos: _, redos: P } = t.get($).onCommandExecute({
3275
3298
  id: Jn.id,
3276
3299
  params: w
3277
- }), U = q([...A], r);
3278
- return _ && U.result && i.pushUndoRedo({
3279
- unitID: l,
3280
- undoMutations: [{ id: ye.id, params: p }, ...y],
3281
- redoMutations: [{ id: ye.id, params: w }, ...A]
3300
+ }), D = q([...P], r);
3301
+ return y && D.result && i.pushUndoRedo({
3302
+ unitID: d,
3303
+ undoMutations: [{ id: _e.id, params: p }, ..._],
3304
+ redoMutations: [{ id: _e.id, params: w }, ...P]
3282
3305
  }), !0;
3283
3306
  }
3284
3307
  }, Xn = {
@@ -3288,25 +3311,25 @@ const mi = {
3288
3311
  const o = t.get(L), n = t.get(M), r = t.get(B), i = t.get(C), s = o.getSelectionRanges();
3289
3312
  if (!(s != null && s.length))
3290
3313
  return !1;
3291
- const a = i.getCurrentUniverSheetInstance().getUnitId(), l = {
3314
+ const a = i.getCurrentUniverSheetInstance().getUnitId(), d = {
3292
3315
  subUnitId: i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),
3293
3316
  unitId: a,
3294
3317
  ranges: s,
3295
3318
  colWidth: e.value
3296
3319
  }, u = Kn(
3297
3320
  t,
3298
- l
3299
- ), d = n.syncExecuteCommand(
3300
- ye.id,
3301
- l
3321
+ d
3322
+ ), l = n.syncExecuteCommand(
3323
+ _e.id,
3324
+ d
3302
3325
  ), { undos: g, redos: m } = t.get($).onCommandExecute({
3303
3326
  id: Xn.id,
3304
- params: l
3327
+ params: d
3305
3328
  }), h = q([...m], n);
3306
- return d && h.result ? (r.pushUndoRedo({
3329
+ return l && h.result ? (r.pushUndoRedo({
3307
3330
  unitID: a,
3308
- undoMutations: [{ id: ye.id, params: u }, ...g],
3309
- redoMutations: [{ id: ye.id, params: l }, ...m]
3331
+ undoMutations: [{ id: _e.id, params: u }, ...g],
3332
+ redoMutations: [{ id: _e.id, params: d }, ...m]
3310
3333
  }), !0) : !1;
3311
3334
  }
3312
3335
  }, Yn = (t, e) => {
@@ -3333,24 +3356,24 @@ const mi = {
3333
3356
  id: "sheet.command.set-worksheet-hidden",
3334
3357
  handler: async (t, e) => {
3335
3358
  var v;
3336
- const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(Rt), s = r.getCurrentUniverSheetInstance().getUnitId();
3359
+ const o = t.get(M), n = t.get(B), r = t.get(C), i = t.get(pt), s = r.getCurrentUniverSheetInstance().getUnitId();
3337
3360
  let a = r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
3338
3361
  e && (a = (v = e.subUnitId) != null ? v : a);
3339
3362
  const c = r.getUniverSheetInstance(s);
3340
3363
  if (!c)
3341
3364
  return !1;
3342
- const l = c.getSheetBySheetId(a);
3343
- if (!l || l.getConfig().hidden === X.TRUE)
3365
+ const d = c.getSheetBySheetId(a);
3366
+ if (!d || d.getConfig().hidden === X.TRUE)
3344
3367
  return !1;
3345
- const d = {
3368
+ const l = {
3346
3369
  unitId: s,
3347
3370
  subUnitId: a,
3348
3371
  hidden: X.TRUE
3349
- }, g = Yn(t, d);
3350
- return c.getSheets().filter((S) => S.getConfig().hidden === X.FALSE).length === 1 ? (i.emit("No visible sheet after you hide this."), !1) : o.syncExecuteCommand(Ne.id, d) ? (n.pushUndoRedo({
3372
+ }, g = Yn(t, l);
3373
+ return c.getSheets().filter((S) => S.getConfig().hidden === X.FALSE).length === 1 ? (i.emit("No visible sheet after you hide this."), !1) : o.syncExecuteCommand(Ne.id, l) ? (n.pushUndoRedo({
3351
3374
  unitID: s,
3352
3375
  undoMutations: [{ id: Ne.id, params: g }],
3353
- redoMutations: [{ id: Ne.id, params: d }]
3376
+ redoMutations: [{ id: Ne.id, params: l }]
3354
3377
  }), !0) : !1;
3355
3378
  }
3356
3379
  }, Yr = (t, e) => {
@@ -3362,7 +3385,7 @@ const mi = {
3362
3385
  name: n.getName(),
3363
3386
  subUnitId: n.getSheetId()
3364
3387
  };
3365
- }, Nt = {
3388
+ }, xt = {
3366
3389
  id: "sheet.mutation.set-worksheet-name",
3367
3390
  type: I.MUTATION,
3368
3391
  handler: (t, e) => {
@@ -3380,26 +3403,26 @@ const mi = {
3380
3403
  subUnitId: e.subUnitId || r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),
3381
3404
  name: e.name,
3382
3405
  unitId: s
3383
- }, l = Yr(
3406
+ }, d = Yr(
3384
3407
  t,
3385
3408
  c
3386
3409
  ), u = i.onCommandExecute({
3387
3410
  id: Zn.id,
3388
3411
  params: e
3389
- }), d = [{ id: Nt.id, params: c }, ...u.redos], g = [...u.undos, { id: Nt.id, params: l }];
3390
- return await q(d, o).result ? (n.pushUndoRedo({
3412
+ }), l = [{ id: xt.id, params: c }, ...u.redos], g = [...u.undos, { id: xt.id, params: d }];
3413
+ return await q(l, o).result ? (n.pushUndoRedo({
3391
3414
  unitID: s,
3392
3415
  undoMutations: g,
3393
- redoMutations: d
3416
+ redoMutations: l
3394
3417
  }), !0) : !1;
3395
3418
  }
3396
3419
  }, Zr = (t, e) => {
3397
3420
  const r = t.get(C).getUniverSheetInstance(e.unitId).getConfig().sheetOrder.findIndex((i) => i === e.subUnitId);
3398
3421
  return {
3399
- ...D.deepClone(e),
3422
+ ...b.deepClone(e),
3400
3423
  order: r
3401
3424
  };
3402
- }, ut = {
3425
+ }, dt = {
3403
3426
  id: "sheet.mutation.set-worksheet-order",
3404
3427
  type: I.MUTATION,
3405
3428
  handler: (t, e) => {
@@ -3416,25 +3439,25 @@ const mi = {
3416
3439
  const o = t.get(M), n = t.get(B), r = t.get(C), i = e.unitId || r.getCurrentUniverSheetInstance().getUnitId(), s = e.subUnitId || r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(), a = r.getUniverSheetInstance(i);
3417
3440
  if (!a || !a.getSheetBySheetId(s))
3418
3441
  return !1;
3419
- const l = {
3442
+ const d = {
3420
3443
  order: e.order,
3421
3444
  unitId: i,
3422
3445
  subUnitId: s
3423
- }, u = Zr(t, l);
3424
- return o.syncExecuteCommand(ut.id, l) ? (n.pushUndoRedo({
3446
+ }, u = Zr(t, d);
3447
+ return o.syncExecuteCommand(dt.id, d) ? (n.pushUndoRedo({
3425
3448
  unitID: i,
3426
- undoMutations: [{ id: ut.id, params: u }],
3427
- redoMutations: [{ id: ut.id, params: l }]
3449
+ undoMutations: [{ id: dt.id, params: u }],
3450
+ redoMutations: [{ id: dt.id, params: d }]
3428
3451
  }), !0) : !1;
3429
3452
  }
3430
3453
  }, es = 2e3, Qn = (t, e) => {
3431
3454
  const { unitId: o, subUnitId: n, ranges: r } = e, s = t.get(C).getUniverSheetInstance(o), a = s == null ? void 0 : s.getSheetBySheetId(n);
3432
3455
  if (a == null)
3433
3456
  throw new Error("worksheet is null error!");
3434
- const c = {}, l = a.getRowManager();
3435
- for (const { startRow: u, endRow: d } of r)
3436
- for (let g = u; g < d + 1; g++) {
3437
- const m = l.getRowOrCreate(g);
3457
+ const c = {}, d = a.getRowManager();
3458
+ for (const { startRow: u, endRow: l } of r)
3459
+ for (let g = u; g < l + 1; g++) {
3460
+ const m = d.getRowOrCreate(g);
3438
3461
  c[g] = m.h;
3439
3462
  }
3440
3463
  return {
@@ -3443,11 +3466,11 @@ const mi = {
3443
3466
  ranges: r,
3444
3467
  rowHeight: c
3445
3468
  };
3446
- }, Jt = (t, e) => {
3447
- const { unitId: o, subUnitId: n, ranges: r } = e, a = t.get(C).getUniverSheetInstance(o).getSheetBySheetId(n), c = {}, l = a.getRowManager();
3448
- for (const { startRow: u, endRow: d } of r)
3449
- for (let g = u; g <= d; g++) {
3450
- const m = l.getRowOrCreate(g);
3469
+ }, Xt = (t, e) => {
3470
+ const { unitId: o, subUnitId: n, ranges: r } = e, a = t.get(C).getUniverSheetInstance(o).getSheetBySheetId(n), c = {}, d = a.getRowManager();
3471
+ for (const { startRow: u, endRow: l } of r)
3472
+ for (let g = u; g <= l; g++) {
3473
+ const m = d.getRowOrCreate(g);
3451
3474
  c[g] = m.ia;
3452
3475
  }
3453
3476
  return {
@@ -3457,11 +3480,11 @@ const mi = {
3457
3480
  autoHeightInfo: c
3458
3481
  };
3459
3482
  }, vi = (t, e) => {
3460
- const { unitId: o, subUnitId: n, rowsAutoHeightInfo: r } = e, s = t.get(C).getUniverSheetInstance(o), a = s == null ? void 0 : s.getSheetBySheetId(n), c = [], l = a.getRowManager();
3483
+ const { unitId: o, subUnitId: n, rowsAutoHeightInfo: r } = e, s = t.get(C).getUniverSheetInstance(o), a = s == null ? void 0 : s.getSheetBySheetId(n), c = [], d = a.getRowManager();
3461
3484
  for (const u of r) {
3462
- const { row: d } = u, { ah: g } = l.getRowOrCreate(d);
3485
+ const { row: l } = u, { ah: g } = d.getRowOrCreate(l);
3463
3486
  c.push({
3464
- row: d,
3487
+ row: l,
3465
3488
  autoHeight: g
3466
3489
  });
3467
3490
  }
@@ -3474,15 +3497,15 @@ const mi = {
3474
3497
  id: "sheet.mutation.set-worksheet-row-height",
3475
3498
  type: I.MUTATION,
3476
3499
  handler: (t, e) => {
3477
- var d;
3500
+ var l;
3478
3501
  const { unitId: o, subUnitId: n, ranges: r, rowHeight: i } = e, a = t.get(C).getUniverSheetInstance(o), c = a == null ? void 0 : a.getSheetBySheetId(n);
3479
3502
  if (!c)
3480
3503
  return !1;
3481
- const l = c.getConfig().defaultRowHeight, u = c.getRowManager();
3504
+ const d = c.getConfig().defaultRowHeight, u = c.getRowManager();
3482
3505
  for (const { startRow: g, endRow: m } of r)
3483
3506
  for (let h = g; h <= m; h++) {
3484
3507
  const f = u.getRowOrCreate(h);
3485
- typeof i == "number" ? f.h = i : f.h = (d = i[h]) != null ? d : l, f.h = Math.min(es, f.h);
3508
+ typeof i == "number" ? f.h = i : f.h = (l = i[h]) != null ? l : d, f.h = Math.min(es, f.h);
3486
3509
  }
3487
3510
  return !0;
3488
3511
  }
@@ -3490,15 +3513,15 @@ const mi = {
3490
3513
  id: "sheet.mutation.set-worksheet-row-is-auto-height",
3491
3514
  type: I.MUTATION,
3492
3515
  handler: (t, e) => {
3493
- var d;
3516
+ var l;
3494
3517
  const { unitId: o, subUnitId: n, ranges: r, autoHeightInfo: i } = e, a = t.get(C).getUniverSheetInstance(o), c = a == null ? void 0 : a.getSheetBySheetId(n);
3495
3518
  if (!c)
3496
3519
  return !1;
3497
- const l = void 0, u = c.getRowManager();
3520
+ const d = void 0, u = c.getRowManager();
3498
3521
  for (const { startRow: g, endRow: m } of r)
3499
3522
  for (let h = g; h <= m; h++) {
3500
3523
  const f = u.getRowOrCreate(h);
3501
- typeof i == "number" ? f.ia = i : f.ia = (d = i[h - g]) != null ? d : l;
3524
+ typeof i == "number" ? f.ia = i : f.ia = (l = i[h - g]) != null ? l : d;
3502
3525
  }
3503
3526
  return !0;
3504
3527
  }
@@ -3510,9 +3533,9 @@ const mi = {
3510
3533
  if (!a || !s)
3511
3534
  return !1;
3512
3535
  const c = a.getRowManager();
3513
- for (const { row: l, autoHeight: u } of r) {
3514
- const d = c.getRowOrCreate(l);
3515
- d.ah = u;
3536
+ for (const { row: d, autoHeight: u } of r) {
3537
+ const l = c.getRowOrCreate(d);
3538
+ l.ah = u;
3516
3539
  }
3517
3540
  return !0;
3518
3541
  }
@@ -3523,26 +3546,26 @@ const mi = {
3523
3546
  const n = t.get(L).getSelections();
3524
3547
  if (!(n != null && n.length))
3525
3548
  return !1;
3526
- const i = t.get(C).getCurrentUniverSheetInstance(), s = i.getActiveSheet(), a = i.getUnitId(), c = s.getSheetId(), { anchorRow: l, deltaY: u } = e, g = s.getRowHeight(l) + u, m = n.length === 1 && n[0].range.rangeType === G.ALL, h = n.filter((U) => U.range.rangeType === G.ROW), f = m ? G.ALL : h.some(({ range: U }) => {
3527
- const { startRow: P, endRow: k } = U;
3528
- return P <= l && l <= k;
3549
+ const i = t.get(C).getCurrentUniverSheetInstance(), s = i.getActiveSheet(), a = i.getUnitId(), c = s.getSheetId(), { anchorRow: d, deltaY: u } = e, g = s.getRowHeight(d) + u, m = n.length === 1 && n[0].range.rangeType === G.ALL, h = n.filter((D) => D.range.rangeType === G.ROW), f = m ? G.ALL : h.some(({ range: D }) => {
3550
+ const { startRow: A, endRow: k } = D;
3551
+ return A <= d && d <= k;
3529
3552
  }) ? G.ROW : G.NORMAL;
3530
3553
  let v;
3531
3554
  if (f === G.ALL) {
3532
- const U = s.getRowCount(), P = new Array(s.getColumnCount()).fill(void 0).map(
3533
- (k, b) => ({ startRow: b, endRow: b, startColumn: 0, endColumn: U - 1 })
3555
+ const D = s.getRowCount(), A = new Array(s.getColumnCount()).fill(void 0).map(
3556
+ (k, U) => ({ startRow: U, endRow: U, startColumn: 0, endColumn: D - 1 })
3534
3557
  );
3535
3558
  v = {
3536
3559
  subUnitId: c,
3537
3560
  unitId: a,
3538
3561
  rowHeight: g,
3539
- ranges: P
3562
+ ranges: A
3540
3563
  };
3541
3564
  } else
3542
3565
  f === G.ROW ? v = {
3543
3566
  subUnitId: c,
3544
3567
  unitId: a,
3545
- ranges: h.map((U) => E.clone(U.range)),
3568
+ ranges: h.map((D) => E.clone(D.range)),
3546
3569
  rowHeight: g
3547
3570
  } : v = {
3548
3571
  subUnitId: c,
@@ -3550,8 +3573,8 @@ const mi = {
3550
3573
  rowHeight: g,
3551
3574
  ranges: [
3552
3575
  {
3553
- startRow: l,
3554
- endRow: l,
3576
+ startRow: d,
3577
+ endRow: d,
3555
3578
  startColumn: 0,
3556
3579
  endColumn: s.getMaxColumns() - 1
3557
3580
  }
@@ -3565,7 +3588,7 @@ const mi = {
3565
3588
  subUnitId: c,
3566
3589
  ranges: v.ranges,
3567
3590
  autoHeightInfo: X.FALSE
3568
- }, p = Jt(t, w), _ = t.get(M), y = t.get(B);
3591
+ }, p = Xt(t, w), y = t.get(M), _ = t.get(B);
3569
3592
  return q(
3570
3593
  [
3571
3594
  {
@@ -3577,8 +3600,8 @@ const mi = {
3577
3600
  params: w
3578
3601
  }
3579
3602
  ],
3580
- _
3581
- ).result ? (y.pushUndoRedo({
3603
+ y
3604
+ ).result ? (_.pushUndoRedo({
3582
3605
  unitID: a,
3583
3606
  undoMutations: [
3584
3607
  {
@@ -3609,20 +3632,20 @@ const mi = {
3609
3632
  const o = t.get(L), n = t.get(M), r = t.get(B), i = t.get(C), s = o.getSelectionRanges();
3610
3633
  if (!(s != null && s.length))
3611
3634
  return !1;
3612
- const a = i.getCurrentUniverSheetInstance(), c = a.getUnitId(), l = a.getActiveSheet().getSheetId(), u = {
3613
- subUnitId: l,
3635
+ const a = i.getCurrentUniverSheetInstance(), c = a.getUnitId(), d = a.getActiveSheet().getSheetId(), u = {
3636
+ subUnitId: d,
3614
3637
  unitId: c,
3615
3638
  ranges: s,
3616
3639
  rowHeight: e.value
3617
- }, d = Qn(
3640
+ }, l = Qn(
3618
3641
  t,
3619
3642
  u
3620
3643
  ), g = {
3621
3644
  unitId: c,
3622
- subUnitId: l,
3645
+ subUnitId: d,
3623
3646
  ranges: u.ranges,
3624
3647
  autoHeightInfo: X.FALSE
3625
- }, m = Jt(t, g);
3648
+ }, m = Xt(t, g);
3626
3649
  return q(
3627
3650
  [
3628
3651
  {
@@ -3640,7 +3663,7 @@ const mi = {
3640
3663
  undoMutations: [
3641
3664
  {
3642
3665
  id: be.id,
3643
- params: d
3666
+ params: l
3644
3667
  },
3645
3668
  {
3646
3669
  id: Re.id,
@@ -3663,33 +3686,33 @@ const mi = {
3663
3686
  type: I.COMMAND,
3664
3687
  id: "sheet.command.set-row-is-auto-height",
3665
3688
  handler: async (t, e) => {
3666
- const o = t.get(M), n = t.get(B), r = t.get(L), i = t.get(C), s = i.getCurrentUniverSheetInstance().getUnitId(), a = i.getCurrentUniverSheetInstance().getActiveSheet(), c = a.getSheetId(), { anchorRow: l } = e != null ? e : {}, u = l != null ? [
3689
+ const o = t.get(M), n = t.get(B), r = t.get(L), i = t.get(C), s = i.getCurrentUniverSheetInstance().getUnitId(), a = i.getCurrentUniverSheetInstance().getActiveSheet(), c = a.getSheetId(), { anchorRow: d } = e != null ? e : {}, u = d != null ? [
3667
3690
  {
3668
- startRow: l,
3669
- endRow: l,
3691
+ startRow: d,
3692
+ endRow: d,
3670
3693
  startColumn: 0,
3671
3694
  endColumn: a.getMaxColumns() - 1
3672
3695
  }
3673
3696
  ] : r.getSelectionRanges();
3674
3697
  if (!(u != null && u.length))
3675
3698
  return !1;
3676
- const d = {
3699
+ const l = {
3677
3700
  unitId: s,
3678
3701
  subUnitId: c,
3679
3702
  ranges: u,
3680
3703
  autoHeightInfo: X.TRUE
3681
3704
  // Hard code first, maybe it will change by the menu item in the future.
3682
- }, g = Jt(t, d), m = o.syncExecuteCommand(
3705
+ }, g = Xt(t, l), m = o.syncExecuteCommand(
3683
3706
  Re.id,
3684
- d
3707
+ l
3685
3708
  ), { undos: h, redos: f } = t.get($).onCommandExecute({
3686
3709
  id: to.id,
3687
- params: d
3710
+ params: l
3688
3711
  }), v = q([...f], o);
3689
3712
  return m && v.result ? (n.pushUndoRedo({
3690
3713
  unitID: s,
3691
3714
  undoMutations: [{ id: Re.id, params: g }, ...h],
3692
- redoMutations: [{ id: Re.id, params: d }, ...f]
3715
+ redoMutations: [{ id: Re.id, params: l }, ...f]
3693
3716
  }), !0) : !1;
3694
3717
  }
3695
3718
  }, os = {
@@ -3710,17 +3733,17 @@ const mi = {
3710
3733
  unitId: i,
3711
3734
  subUnitId: s,
3712
3735
  hidden: X.FALSE
3713
- }, d = Yn(t, u), g = o.syncExecuteCommand(Ne.id, u), m = {
3736
+ }, l = Yn(t, u), g = o.syncExecuteCommand(Ne.id, u), m = {
3714
3737
  unitId: i,
3715
3738
  subUnitId: s
3716
3739
  }, h = o.syncExecuteCommand(
3717
- Mt.id,
3740
+ yt.id,
3718
3741
  m
3719
3742
  );
3720
3743
  return g && h ? (n.pushUndoRedo({
3721
3744
  unitID: i,
3722
3745
  undoMutations: [
3723
- { id: Ne.id, params: d }
3746
+ { id: Ne.id, params: l }
3724
3747
  // { id: SetWorksheetActiveOperation.id, params: unActiveMutationParams },
3725
3748
  ],
3726
3749
  redoMutations: [
@@ -3739,7 +3762,7 @@ const mi = {
3739
3762
  const r = e.getValue(o - 1, n);
3740
3763
  r && e.setValue(o, n, r + 1);
3741
3764
  }), e;
3742
- }, sn = (t) => {
3765
+ }, an = (t) => {
3743
3766
  const e = {
3744
3767
  area: 0
3745
3768
  }, o = (n, r) => e.area < n ? (e.area = n, e.range = r, !0) : !1;
@@ -3757,10 +3780,10 @@ const mi = {
3757
3780
  startColumn: 0,
3758
3781
  endColumn: r
3759
3782
  };
3760
- for (let l = r - 1; l >= 0 && t.getValue(n, l); l--) {
3761
- a = Math.min(t.getValue(n, l) || 0, a), s++;
3783
+ for (let d = r - 1; d >= 0 && t.getValue(n, d); d--) {
3784
+ a = Math.min(t.getValue(n, d) || 0, a), s++;
3762
3785
  const u = a * s;
3763
- c.startColumn = l, c.startRow = n - a + 1, o(u, c);
3786
+ c.startColumn = d, c.startRow = n - a + 1, o(u, c);
3764
3787
  }
3765
3788
  }), e;
3766
3789
  }, ss = (t, e) => (ge.foreach(e, (o, n) => {
@@ -3770,9 +3793,9 @@ const mi = {
3770
3793
  t.setValue(r, n, i - 1), r += 1, i = t.getValue(r, n) || 0;
3771
3794
  }), t), is = (t) => {
3772
3795
  const e = [];
3773
- let o = sn(t);
3796
+ let o = an(t);
3774
3797
  for (; o.area > 0; )
3775
- o.range && (e.push(o.range), ss(t, o.range)), o = sn(t);
3798
+ o.range && (e.push(o.range), ss(t, o.range)), o = an(t);
3776
3799
  return e;
3777
3800
  }, no = (t) => {
3778
3801
  const e = rs(t);
@@ -3788,7 +3811,7 @@ const mi = {
3788
3811
  return function() {
3789
3812
  return e++;
3790
3813
  };
3791
- }, ze = Po("INumfmtService");
3814
+ }, ze = Ao("INumfmtService");
3792
3815
  Ro(Me.Rendered, ze);
3793
3816
  const Ci = (t, e) => {
3794
3817
  const o = t.get(ze), { values: n, unitId: r, subUnitId: i } = e, s = [], a = [], c = o.getModel(r, i) || void 0;
@@ -3805,37 +3828,37 @@ const Ci = (t, e) => {
3805
3828
  });
3806
3829
  });
3807
3830
  });
3808
- const l = [];
3831
+ const d = [];
3809
3832
  if (s.length) {
3810
- const u = xt(r, i, s);
3811
- Object.keys(u.values).forEach((d) => {
3812
- const g = u.values[d];
3833
+ const u = Tt(r, i, s);
3834
+ Object.keys(u.values).forEach((l) => {
3835
+ const g = u.values[l];
3813
3836
  g.ranges = no(g.ranges);
3814
- }), l.push({
3815
- id: Xt.id,
3816
- params: xt(r, i, s)
3837
+ }), d.push({
3838
+ id: Yt.id,
3839
+ params: Tt(r, i, s)
3817
3840
  });
3818
3841
  }
3819
- return a.length && l.push({
3842
+ return a.length && d.push({
3820
3843
  id: oo.id,
3821
3844
  params: {
3822
3845
  unitId: r,
3823
3846
  subUnitId: i,
3824
3847
  ranges: a
3825
3848
  }
3826
- }), l;
3827
- }, Xt = {
3849
+ }), d;
3850
+ }, Yt = {
3828
3851
  id: "sheet.mutation.set.numfmt",
3829
3852
  type: I.MUTATION,
3830
3853
  handler: (t, e) => {
3831
3854
  if (!e)
3832
3855
  return !1;
3833
3856
  const { values: o, refMap: n } = e, r = t.get(ze), i = e.unitId, s = e.subUnitId, a = Object.keys(o).reduce(
3834
- (c, l) => {
3835
- const u = n[l], d = o[l].ranges;
3857
+ (c, d) => {
3858
+ const u = n[d], l = o[d].ranges;
3836
3859
  return u && c.push({
3837
3860
  ...u,
3838
- ranges: d
3861
+ ranges: l
3839
3862
  }), c;
3840
3863
  },
3841
3864
  []
@@ -3853,32 +3876,32 @@ const Ci = (t, e) => {
3853
3876
  }
3854
3877
  }, Si = (t, e) => {
3855
3878
  const o = t.get(ze), { ranges: n, unitId: r, subUnitId: i } = e, s = [], a = o.getModel(r, i) || void 0;
3856
- if (n.forEach((l) => {
3857
- ge.foreach(l, (u, d) => {
3858
- const g = o.getValue(r, i, u, d, a);
3879
+ if (n.forEach((d) => {
3880
+ ge.foreach(d, (u, l) => {
3881
+ const g = o.getValue(r, i, u, l, a);
3859
3882
  g && s.push({
3860
3883
  pattern: g.pattern,
3861
3884
  type: g.type,
3862
3885
  row: u,
3863
- col: d
3886
+ col: l
3864
3887
  });
3865
3888
  });
3866
3889
  }), !s.length)
3867
3890
  return [];
3868
- const c = xt(r, i, s);
3869
- return Object.keys(c.values).forEach((l) => {
3870
- const u = c.values[l];
3891
+ const c = Tt(r, i, s);
3892
+ return Object.keys(c.values).forEach((d) => {
3893
+ const u = c.values[d];
3871
3894
  u.ranges = no(u.ranges);
3872
- }), [{ id: Xt.id, params: c }];
3873
- }, xt = (t, e, o) => {
3895
+ }), [{ id: Yt.id, params: c }];
3896
+ }, Tt = (t, e, o) => {
3874
3897
  const n = as(o, "pattern"), r = {}, i = {}, s = cs();
3875
3898
  return Object.keys(n).forEach((a) => {
3876
- const c = n[a], l = c[0], u = s();
3899
+ const c = n[a], d = c[0], u = s();
3877
3900
  r[u] = {
3878
3901
  pattern: a,
3879
- type: l.type
3880
- }, c.forEach((d) => {
3881
- i[u] || (i[u] = { ranges: [] }), i[u].ranges.push(us(d.row, d.col));
3902
+ type: d.type
3903
+ }, c.forEach((l) => {
3904
+ i[u] || (i[u] = { ranges: [] }), i[u].ranges.push(us(l.row, l.col));
3882
3905
  });
3883
3906
  }), { unitId: t, subUnitId: e, refMap: r, values: i };
3884
3907
  }, us = (t, e) => ({
@@ -3891,25 +3914,25 @@ var gs = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ms = (t, e
3891
3914
  for (var r = n > 1 ? void 0 : n ? hs(e, o) : e, i = t.length - 1, s; i >= 0; i--)
3892
3915
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
3893
3916
  return n && r && gs(e, o, r), r;
3894
- }, an = (t, e) => (o, n) => e(o, n, t);
3895
- let dt = class extends ke {
3917
+ }, cn = (t, e) => (o, n) => e(o, n, t);
3918
+ let lt = class extends ke {
3896
3919
  constructor(t, e) {
3897
3920
  super(), this._commandService = t, this._configService = e, [
3898
3921
  H,
3899
- Bt,
3900
- Mn,
3901
3922
  Wt,
3923
+ Mn,
3924
+ jt,
3902
3925
  cr,
3903
- $t,
3904
3926
  Ht,
3927
+ zt,
3905
3928
  Jn,
3906
3929
  ts,
3907
3930
  vr,
3908
3931
  fr,
3909
3932
  tt,
3910
3933
  We,
3911
- zt,
3912
3934
  Gt,
3935
+ qt,
3913
3936
  mr,
3914
3937
  hr,
3915
3938
  et,
@@ -3917,28 +3940,28 @@ let dt = class extends ke {
3917
3940
  Cr,
3918
3941
  Le,
3919
3942
  Vn,
3920
- St,
3921
- jt,
3922
- vt,
3923
- Tn,
3943
+ It,
3944
+ Ft,
3924
3945
  Ct,
3925
- Kt,
3946
+ Tn,
3947
+ St,
3948
+ Jt,
3926
3949
  Fe,
3927
- qt,
3950
+ Kt,
3928
3951
  je,
3929
3952
  jn,
3930
- pt,
3953
+ wt,
3931
3954
  wr,
3932
3955
  z,
3933
3956
  $r,
3934
3957
  jr,
3935
3958
  Fr,
3936
- _r,
3959
+ yr,
3937
3960
  Ur,
3938
3961
  nt,
3939
- yr,
3962
+ _r,
3940
3963
  br,
3941
- Pr,
3964
+ Ar,
3942
3965
  Xe,
3943
3966
  Ye,
3944
3967
  Xn,
@@ -3958,42 +3981,42 @@ let dt = class extends ke {
3958
3981
  zn,
3959
3982
  ie,
3960
3983
  Jr,
3961
- ct,
3984
+ ut,
3962
3985
  Wr,
3963
3986
  qr,
3964
3987
  Gr,
3965
3988
  Hr,
3966
3989
  qn,
3967
- Mt,
3968
- ye,
3990
+ yt,
3991
+ _e,
3969
3992
  Xr,
3970
3993
  Ne,
3971
3994
  Zn,
3972
- Nt,
3995
+ xt,
3973
3996
  Qr,
3974
- ut,
3997
+ dt,
3975
3998
  eo,
3976
3999
  be,
3977
4000
  to,
3978
4001
  Re,
3979
4002
  os,
3980
- Xt,
4003
+ Yt,
3981
4004
  oe,
3982
4005
  oo
3983
4006
  ].forEach((o) => this.disposeWithMe(this._commandService.registerCommand(o))), this._configService.setConfig(ds, ls);
3984
4007
  }
3985
4008
  };
3986
- dt = ms([
3987
- De(Me.Starting, dt),
3988
- an(0, M),
3989
- an(1, po)
3990
- ], dt);
4009
+ lt = ms([
4010
+ De(Me.Starting, lt),
4011
+ cn(0, M),
4012
+ cn(1, po)
4013
+ ], lt);
3991
4014
  var fs = Object.defineProperty, vs = Object.getOwnPropertyDescriptor, Cs = (t, e, o, n) => {
3992
4015
  for (var r = n > 1 ? void 0 : n ? vs(e, o) : e, i = t.length - 1, s; i >= 0; i--)
3993
4016
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
3994
4017
  return n && r && fs(e, o, r), r;
3995
4018
  }, Ss = (t, e) => (o, n) => e(o, n, t);
3996
- let lt = class extends ke {
4019
+ let gt = class extends ke {
3997
4020
  constructor(t) {
3998
4021
  super(), this._commandService = t, this._initialize();
3999
4022
  }
@@ -4011,13 +4034,13 @@ let lt = class extends ke {
4011
4034
  if (c == null)
4012
4035
  return !0;
4013
4036
  Object.keys(c).forEach((u) => {
4014
- const d = c[u];
4015
- if (d == null)
4037
+ const l = c[u];
4038
+ if (l == null)
4016
4039
  return !0;
4017
4040
  const g = {
4018
4041
  subUnitId: u,
4019
4042
  unitId: a,
4020
- cellValue: d.getData()
4043
+ cellValue: l.getData()
4021
4044
  };
4022
4045
  i.push({
4023
4046
  id: Q.id,
@@ -4033,16 +4056,16 @@ let lt = class extends ke {
4033
4056
  );
4034
4057
  }
4035
4058
  };
4036
- lt = Cs([
4037
- De(Me.Ready, lt),
4059
+ gt = Cs([
4060
+ De(Me.Ready, gt),
4038
4061
  Ss(0, M)
4039
- ], lt);
4062
+ ], gt);
4040
4063
  var Is = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, ps = (t, e, o, n) => {
4041
4064
  for (var r = n > 1 ? void 0 : n ? Rs(e, o) : e, i = t.length - 1, s; i >= 0; i--)
4042
4065
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
4043
4066
  return n && r && Is(e, o, r), r;
4044
4067
  }, st = (t, e) => (o, n) => e(o, n, t);
4045
- let gt = class extends ke {
4068
+ let ht = class extends ke {
4046
4069
  constructor(t, e, o, n) {
4047
4070
  super(), this._commandService = t, this._featureCalculationManagerService = e, this._currentUniverService = o, this._formulaDataModel = n;
4048
4071
  }
@@ -4099,15 +4122,15 @@ let gt = class extends ke {
4099
4122
  });
4100
4123
  }
4101
4124
  };
4102
- gt = ps([
4103
- De(Me.Ready, gt),
4125
+ ht = ps([
4126
+ De(Me.Ready, ht),
4104
4127
  st(0, M),
4105
4128
  st(1, xo),
4106
4129
  st(2, C),
4107
4130
  st(3, te(No))
4108
- ], gt);
4131
+ ], ht);
4109
4132
  const J = {
4110
- MoveRangeCommandId: yn,
4133
+ MoveRangeCommandId: _n,
4111
4134
  InsertRowCommandId: En,
4112
4135
  InsertColCommandId: Nn,
4113
4136
  RemoveColCommandId: Wn,
@@ -4115,39 +4138,39 @@ const J = {
4115
4138
  DeleteRangeMoveLeftCommandId: Dn,
4116
4139
  DeleteRangeMoveUpCommandId: kn,
4117
4140
  InsertRangeMoveDownCommandId: gr,
4118
- InsertRangeMoveRightCommandId: An,
4141
+ InsertRangeMoveRightCommandId: Pn,
4119
4142
  MoveColsCommandId: Ln,
4120
4143
  MoveRowsCommandId: xn
4121
4144
  };
4122
- var Z = /* @__PURE__ */ ((t) => (t[t.Set = 0] = "Set", t[t.Delete = 1] = "Delete", t[t.HorizontalMove = 2] = "HorizontalMove", t[t.VerticalMove = 3] = "VerticalMove", t[t.Unknown = 4] = "Unknown", t))(Z || {}), ws = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, _s = (t, e, o, n) => {
4145
+ var Z = /* @__PURE__ */ ((t) => (t[t.Set = 0] = "Set", t[t.Delete = 1] = "Delete", t[t.HorizontalMove = 2] = "HorizontalMove", t[t.VerticalMove = 3] = "VerticalMove", t[t.Unknown = 4] = "Unknown", t))(Z || {}), ws = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, ys = (t, e, o, n) => {
4123
4146
  for (var r = n > 1 ? void 0 : n ? Ms(e, o) : e, i = t.length - 1, s; i >= 0; i--)
4124
4147
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
4125
4148
  return n && r && ws(e, o, r), r;
4126
- }, Dt = (t, e) => (o, n) => e(o, n, t);
4127
- const ys = It("MERGE_REDO"), bs = It("MERGE_UNDO");
4149
+ }, kt = (t, e) => (o, n) => e(o, n, t);
4150
+ const _s = Rt("MERGE_REDO"), bs = Rt("MERGE_UNDO");
4128
4151
  let Ke = class extends ke {
4129
4152
  constructor(e, o, n) {
4130
4153
  super();
4131
- F(this, "interceptor", new wo({ MERGE_REDO: ys, MERGE_UNDO: bs }));
4154
+ F(this, "interceptor", new wo({ MERGE_REDO: _s, MERGE_UNDO: bs }));
4132
4155
  F(this, "_refRangeManagerMap", /* @__PURE__ */ new Map());
4133
4156
  F(this, "_serializer", Us());
4134
4157
  F(this, "_onRefRangeChange", () => {
4135
4158
  this._sheetInterceptorService.interceptCommand({
4136
4159
  getMutations: (e) => {
4137
- const o = this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet(), n = cn(this._univerInstanceService), r = un(this._univerInstanceService), a = ((() => {
4160
+ const o = this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet(), n = un(this._univerInstanceService), r = dn(this._univerInstanceService), a = ((() => {
4138
4161
  switch (e.id) {
4139
4162
  case J.MoveColsCommandId: {
4140
- const u = e.params, d = Math.min(u.fromRange.startColumn, u.toRange.startColumn);
4163
+ const u = e.params, l = Math.min(u.fromRange.startColumn, u.toRange.startColumn);
4141
4164
  return this._checkRange(
4142
- [{ ...u.fromRange, startColumn: d, endColumn: o.getColumnCount() - 1 }],
4165
+ [{ ...u.fromRange, startColumn: l, endColumn: o.getColumnCount() - 1 }],
4143
4166
  n,
4144
4167
  r
4145
4168
  );
4146
4169
  }
4147
4170
  case J.MoveRowsCommandId: {
4148
- const u = e.params, d = Math.min(u.fromRange.startRow, u.toRange.startRow);
4171
+ const u = e.params, l = Math.min(u.fromRange.startRow, u.toRange.startRow);
4149
4172
  return this._checkRange(
4150
- [{ ...u.fromRange, startRow: d, endRow: o.getRowCount() - 1 }],
4173
+ [{ ...u.fromRange, startRow: l, endRow: o.getRowCount() - 1 }],
4151
4174
  n,
4152
4175
  r
4153
4176
  );
@@ -4170,10 +4193,10 @@ let Ke = class extends ke {
4170
4193
  return this._checkRange([g], n, r);
4171
4194
  }
4172
4195
  case J.InsertColCommandId: {
4173
- const d = e.params.range.startColumn, g = {
4196
+ const l = e.params.range.startColumn, g = {
4174
4197
  startRow: 0,
4175
4198
  endRow: o.getRowCount() - 1,
4176
- startColumn: d,
4199
+ startColumn: l,
4177
4200
  endColumn: o.getColumnCount() - 1
4178
4201
  };
4179
4202
  return this._checkRange([g], n, r);
@@ -4188,63 +4211,63 @@ let Ke = class extends ke {
4188
4211
  return this._checkRange([g], n, r);
4189
4212
  }
4190
4213
  case J.RemoveColCommandId: {
4191
- const d = e.params.range.startColumn, g = {
4214
+ const l = e.params.range.startColumn, g = {
4192
4215
  startRow: 0,
4193
4216
  endRow: o.getRowCount() - 1,
4194
- startColumn: d,
4217
+ startColumn: l,
4195
4218
  endColumn: o.getColumnCount() - 1
4196
4219
  };
4197
4220
  return this._checkRange([g], n, r);
4198
4221
  }
4199
4222
  case J.DeleteRangeMoveUpCommandId:
4200
4223
  case J.InsertRangeMoveDownCommandId: {
4201
- const d = e.params.range || dn(this._selectionManagerService)[0], g = {
4202
- startRow: d.startRow,
4203
- startColumn: d.startColumn,
4204
- endColumn: d.endColumn,
4224
+ const l = e.params.range || ln(this._selectionManagerService)[0], g = {
4225
+ startRow: l.startRow,
4226
+ startColumn: l.startColumn,
4227
+ endColumn: l.endColumn,
4205
4228
  endRow: o.getRowCount() - 1
4206
4229
  };
4207
4230
  return this._checkRange([g], n, r);
4208
4231
  }
4209
4232
  case J.DeleteRangeMoveLeftCommandId:
4210
4233
  case J.InsertRangeMoveRightCommandId: {
4211
- const d = e.params.range || dn(this._selectionManagerService)[0], g = {
4212
- startRow: d.startRow,
4213
- startColumn: d.startColumn,
4234
+ const l = e.params.range || ln(this._selectionManagerService)[0], g = {
4235
+ startRow: l.startRow,
4236
+ startColumn: l.startColumn,
4214
4237
  endColumn: o.getColumnCount() - 1,
4215
- endRow: d.endRow
4238
+ endRow: l.endRow
4216
4239
  };
4217
4240
  return this._checkRange([g], n, r);
4218
4241
  }
4219
4242
  }
4220
4243
  })() || []).reduce(
4221
- (u, d) => {
4222
- const g = d(e);
4244
+ (u, l) => {
4245
+ const g = l(e);
4223
4246
  return u.push(g), u;
4224
4247
  },
4225
4248
  []
4226
4249
  ).reduce(
4227
- (u, d) => (u.redos.push(...d.redos), u.undos.push(...d.undos), u),
4250
+ (u, l) => (u.redos.push(...l.redos), u.undos.push(...l.undos), u),
4228
4251
  { redos: [], undos: [] }
4229
4252
  ), c = this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(
4230
4253
  a.redos,
4231
4254
  null
4232
- ) || [], l = this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(
4255
+ ) || [], d = this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(
4233
4256
  a.undos,
4234
4257
  null
4235
4258
  ) || [];
4236
- return { redos: c, undos: l };
4259
+ return { redos: c, undos: d };
4237
4260
  }
4238
4261
  });
4239
4262
  });
4240
4263
  F(this, "_checkRange", (e, o, n) => {
4241
- const r = ln(o, n), i = this._refRangeManagerMap.get(r);
4264
+ const r = gn(o, n), i = this._refRangeManagerMap.get(r);
4242
4265
  if (i) {
4243
4266
  const s = /* @__PURE__ */ new Set();
4244
4267
  return [...i.keys()].forEach((c) => {
4245
- const l = i.get(c), u = this._serializer.deserialize(c);
4246
- e.some((d) => E.intersects(d, u)) && l && l.forEach((d) => {
4247
- s.add(d);
4268
+ const d = i.get(c), u = this._serializer.deserialize(c);
4269
+ e.some((l) => E.intersects(l, u)) && d && d.forEach((l) => {
4270
+ s.add(l);
4248
4271
  });
4249
4272
  }), [...s];
4250
4273
  }
@@ -4259,13 +4282,13 @@ let Ke = class extends ke {
4259
4282
  * @memberof RefRangeService
4260
4283
  */
4261
4284
  F(this, "registerRefRange", (e, o, n, r) => {
4262
- const i = n || cn(this._univerInstanceService), s = r || un(this._univerInstanceService), a = ln(i, s), c = this._serializer.serialize(e);
4263
- let l = this._refRangeManagerMap.get(a);
4264
- l || (l = /* @__PURE__ */ new Map(), this._refRangeManagerMap.set(a, l));
4265
- const u = l.get(c);
4266
- return u ? u.add(o) : l.set(c, /* @__PURE__ */ new Set([o])), le(() => {
4267
- const d = l.get(c);
4268
- d && (d.delete(o), d.size || (l.delete(c), l.size || this._refRangeManagerMap.delete(a)));
4285
+ const i = n || un(this._univerInstanceService), s = r || dn(this._univerInstanceService), a = gn(i, s), c = this._serializer.serialize(e);
4286
+ let d = this._refRangeManagerMap.get(a);
4287
+ d || (d = /* @__PURE__ */ new Map(), this._refRangeManagerMap.set(a, d));
4288
+ const u = d.get(c);
4289
+ return u ? u.add(o) : d.set(c, /* @__PURE__ */ new Set([o])), le(() => {
4290
+ const l = d.get(c);
4291
+ l && (l.delete(o), l.size || (d.delete(c), d.size || this._refRangeManagerMap.delete(a)));
4269
4292
  });
4270
4293
  });
4271
4294
  this._sheetInterceptorService = e, this._univerInstanceService = o, this._selectionManagerService = n, this._onRefRangeChange(), this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_REDO, {
@@ -4277,22 +4300,22 @@ let Ke = class extends ke {
4277
4300
  });
4278
4301
  }
4279
4302
  };
4280
- Ke = _s([
4303
+ Ke = ys([
4281
4304
  De(Me.Steady, Ke),
4282
- Dt(0, te($)),
4283
- Dt(1, te(C)),
4284
- Dt(2, te(L))
4305
+ kt(0, te($)),
4306
+ kt(1, te(C)),
4307
+ kt(2, te(L))
4285
4308
  ], Ke);
4286
- function cn(t) {
4309
+ function un(t) {
4287
4310
  return t.getCurrentUniverSheetInstance().getUnitId();
4288
4311
  }
4289
- function un(t) {
4312
+ function dn(t) {
4290
4313
  return t.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
4291
4314
  }
4292
- function dn(t) {
4315
+ function ln(t) {
4293
4316
  return t.getSelectionRanges() || [];
4294
4317
  }
4295
- function ln(t, e) {
4318
+ function gn(t, e) {
4296
4319
  return `${t}_${e}`;
4297
4320
  }
4298
4321
  function Us() {
@@ -4335,12 +4358,12 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4335
4358
  }), c = (f, v) => ({
4336
4359
  start: v.start + f.start,
4337
4360
  end: v.start + f.start + f.end - f.start
4338
- }), l = e.start > t.start;
4339
- if (l) {
4361
+ }), d = e.start > t.start;
4362
+ if (d) {
4340
4363
  const f = Math.min(t.end, e.start) - t.start + 1;
4341
4364
  r.start -= f, r.end -= f;
4342
4365
  }
4343
- const u = s(t), d = u, g = i(t, n), m = g && s(g) >= s(n);
4366
+ const u = s(t), l = u, g = i(t, n), m = g && s(g) >= s(n);
4344
4367
  if (t.end < n.start)
4345
4368
  n.start -= u, n.end -= u;
4346
4369
  else if (g) {
@@ -4349,16 +4372,16 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4349
4372
  const v = a(n, t), S = c(v, r);
4350
4373
  n.start = S.start, n.end = S.end;
4351
4374
  } else
4352
- g.start > t.start || l ? n.end -= f : (n.start -= u, n.end -= u + f);
4375
+ g.start > t.start || d ? n.end -= f : (n.start -= u, n.end -= u + f);
4353
4376
  }
4354
4377
  const h = i(r, n);
4355
4378
  if (r.start <= n.start && !m)
4356
- n.start += d, n.end += d;
4379
+ n.start += l, n.end += l;
4357
4380
  else if (h) {
4358
4381
  const f = r.start;
4359
4382
  if (s(h) <= s(n))
4360
4383
  return { step: n.start - o.start, length: 0 };
4361
- f < n.start ? (n.start += d, n.end += d) : f >= n.start && f <= n.end && (n.end += d, n.start += d);
4384
+ f < n.start ? (n.start += l, n.end += l) : f >= n.start && f <= n.end && (n.end += l, n.start += l);
4362
4385
  }
4363
4386
  return {
4364
4387
  step: n.start - o.start,
@@ -4484,7 +4507,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4484
4507
  });
4485
4508
  }
4486
4509
  return n;
4487
- }, yt = (t, e) => {
4510
+ }, bt = (t, e) => {
4488
4511
  const o = we(t), n = we(e), r = (i) => i.endColumn - i.startColumn + 1;
4489
4512
  if (o.startRow <= n.startRow && o.endRow >= n.endRow) {
4490
4513
  if (
@@ -4502,23 +4525,23 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4502
4525
  return { step: r(o), length: 0 };
4503
4526
  }
4504
4527
  return { step: 0, length: 0 };
4505
- }, Ps = (t, e) => {
4528
+ }, As = (t, e) => {
4506
4529
  var a;
4507
4530
  const o = (a = t.params) == null ? void 0 : a.range;
4508
4531
  if (!o)
4509
4532
  return [];
4510
- const n = [], r = yt(Ue(o), Ue(e)), { step: i, length: s } = r;
4533
+ const n = [], r = bt(Ue(o), Ue(e)), { step: i, length: s } = r;
4511
4534
  return n.push({
4512
4535
  type: Z.VerticalMove,
4513
4536
  step: i,
4514
4537
  length: s
4515
4538
  }), n;
4516
- }, As = (t, e) => {
4539
+ }, Ps = (t, e) => {
4517
4540
  var a;
4518
4541
  const o = (a = t.params) == null ? void 0 : a.range;
4519
4542
  if (!o)
4520
4543
  return [];
4521
- const n = [], r = yt(o, e), { step: i, length: s } = r;
4544
+ const n = [], r = bt(o, e), { step: i, length: s } = r;
4522
4545
  return n.push({
4523
4546
  type: Z.HorizontalMove,
4524
4547
  step: i,
@@ -4529,7 +4552,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4529
4552
  const o = (a = t.params) == null ? void 0 : a.range;
4530
4553
  if (!o)
4531
4554
  return [];
4532
- const n = [], r = yt(Ue(o), Ue(e)), { step: i, length: s } = r;
4555
+ const n = [], r = bt(Ue(o), Ue(e)), { step: i, length: s } = r;
4533
4556
  return n.push({
4534
4557
  type: Z.VerticalMove,
4535
4558
  step: i,
@@ -4540,7 +4563,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4540
4563
  const o = (a = t.params) == null ? void 0 : a.range;
4541
4564
  if (!o)
4542
4565
  return [];
4543
- const n = [], r = yt(o, e), { step: i, length: s } = r;
4566
+ const n = [], r = bt(o, e), { step: i, length: s } = r;
4544
4567
  return n.push({
4545
4568
  type: Z.HorizontalMove,
4546
4569
  step: i,
@@ -4580,7 +4603,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4580
4603
  });
4581
4604
  }
4582
4605
  return n;
4583
- }, Tt = (t, e) => {
4606
+ }, Lt = (t, e) => {
4584
4607
  let o = { ...e };
4585
4608
  return t.forEach((n) => {
4586
4609
  switch (n.type) {
@@ -4618,7 +4641,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4618
4641
  break;
4619
4642
  }
4620
4643
  case J.InsertColCommandId: {
4621
- o = As(e, t);
4644
+ o = Ps(e, t);
4622
4645
  break;
4623
4646
  }
4624
4647
  case J.InsertRangeMoveDownCommandId: {
@@ -4630,7 +4653,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4630
4653
  break;
4631
4654
  }
4632
4655
  case J.InsertRowCommandId: {
4633
- o = Ps(e, t);
4656
+ o = As(e, t);
4634
4657
  break;
4635
4658
  }
4636
4659
  case J.MoveColsCommandId: {
@@ -4654,7 +4677,7 @@ const it = Number.MAX_SAFE_INTEGER, we = (t) => {
4654
4677
  break;
4655
4678
  }
4656
4679
  }
4657
- return Tt(o, t);
4680
+ return Lt(o, t);
4658
4681
  };
4659
4682
  var Ls = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, Bs = (t, e, o, n) => {
4660
4683
  for (var r = n > 1 ? void 0 : n ? Vs(e, o) : e, i = t.length - 1, s; i >= 0; i--)
@@ -4668,22 +4691,22 @@ function Ws(t, e) {
4668
4691
  for (let r = 0; r < o.length; r++) {
4669
4692
  const { startRow: i, endRow: s, startColumn: a, endColumn: c } = o[r];
4670
4693
  if (e === ue.ROWS)
4671
- for (let l = i; l <= s; l++) {
4694
+ for (let d = i; d <= s; d++) {
4672
4695
  const u = {
4673
- startRow: l,
4674
- endRow: l,
4696
+ startRow: d,
4697
+ endRow: d,
4675
4698
  startColumn: a,
4676
4699
  endColumn: c
4677
4700
  };
4678
4701
  n.push(u);
4679
4702
  }
4680
4703
  else if (e === ue.COLUMNS)
4681
- for (let l = a; l <= c; l++) {
4704
+ for (let d = a; d <= c; d++) {
4682
4705
  const u = {
4683
4706
  startRow: i,
4684
4707
  endRow: s,
4685
- startColumn: l,
4686
- endColumn: l
4708
+ startColumn: d,
4709
+ endColumn: d
4687
4710
  };
4688
4711
  n.push(u);
4689
4712
  }
@@ -4692,7 +4715,7 @@ function Ws(t, e) {
4692
4715
  }
4693
4716
  return o;
4694
4717
  }
4695
- let ht = class extends ke {
4718
+ let mt = class extends ke {
4696
4719
  constructor(t, e, o, n, r, i) {
4697
4720
  super(), this._commandService = t, this._refRangeService = e, this._univerInstanceService = o, this._injector = n, this._sheetInterceptorService = r, this._selectionManagerService = i, this._onRefRangeChange(), this._initCommandInterceptor();
4698
4721
  }
@@ -4701,22 +4724,22 @@ let ht = class extends ke {
4701
4724
  this._sheetInterceptorService.interceptCommand({
4702
4725
  getMutations(e) {
4703
4726
  switch (e.id) {
4704
- case Bt.id:
4705
- case Wt.id: {
4727
+ case Wt.id:
4728
+ case jt.id: {
4706
4729
  const o = t._univerInstanceService.getCurrentUniverSheetInstance(), n = o.getUnitId(), r = o.getActiveSheet(), i = r.getSheetId(), s = r.getConfig().mergeData, a = t._selectionManagerService.getSelectionRanges();
4707
4730
  if (a && a.length > 0 && a.some(
4708
- (l) => s.some((u) => E.intersects(u, l))
4731
+ (d) => s.some((u) => E.intersects(u, d))
4709
4732
  )) {
4710
- const l = {
4733
+ const d = {
4711
4734
  unitId: n,
4712
4735
  subUnitId: i,
4713
4736
  ranges: a
4714
- }, u = ve(t._injector, l), d = [
4715
- { id: z.id, params: l }
4737
+ }, u = ve(t._injector, d), l = [
4738
+ { id: z.id, params: d }
4716
4739
  ], g = [
4717
4740
  { id: H.id, params: u }
4718
4741
  ];
4719
- return { redos: d, undos: g };
4742
+ return { redos: l, undos: g };
4720
4743
  }
4721
4744
  }
4722
4745
  }
@@ -4725,7 +4748,7 @@ let ht = class extends ke {
4725
4748
  });
4726
4749
  }
4727
4750
  _onRefRangeChange() {
4728
- const t = new At(), e = (r, i) => {
4751
+ const t = new Et(), e = (r, i) => {
4729
4752
  const s = this._univerInstanceService.getUniverSheetInstance(r);
4730
4753
  if (!s)
4731
4754
  return;
@@ -4733,57 +4756,57 @@ let ht = class extends ke {
4733
4756
  if (!a)
4734
4757
  return;
4735
4758
  t.dispose();
4736
- const c = a.getMergeData(), l = (u) => {
4759
+ const c = a.getMergeData(), d = (u) => {
4737
4760
  switch (u.id) {
4738
- case jt.id: {
4739
- const d = u.params;
4740
- return this._handleMoveRangeCommand(d, r, i);
4761
+ case Ft.id: {
4762
+ const l = u.params;
4763
+ return this._handleMoveRangeCommand(l, r, i);
4741
4764
  }
4742
4765
  case et.id: {
4743
- const d = u.params, g = d.unitId || r, m = d.subUnitId || i;
4744
- return this._handleInsertRowCommand(d, g, m);
4766
+ const l = u.params, g = l.unitId || r, m = l.subUnitId || i;
4767
+ return this._handleInsertRowCommand(l, g, m);
4745
4768
  }
4746
4769
  case tt.id: {
4747
- const d = u.params, g = d.unitId || r, m = d.subUnitId || i;
4748
- return this._handleInsertColCommand(d, g, m);
4770
+ const l = u.params, g = l.unitId || r, m = l.subUnitId || i;
4771
+ return this._handleInsertColCommand(l, g, m);
4772
+ }
4773
+ case Jt.id: {
4774
+ const l = u.params;
4775
+ return this._handleRemoveColCommand(l, r, i);
4749
4776
  }
4750
4777
  case Kt.id: {
4751
- const d = u.params;
4752
- return this._handleRemoveColCommand(d, r, i);
4778
+ const l = u.params;
4779
+ return this._handleRemoveRowCommand(l, r, i);
4753
4780
  }
4754
4781
  case qt.id: {
4755
- const d = u.params;
4756
- return this._handleRemoveRowCommand(d, r, i);
4782
+ const l = u.params;
4783
+ return this._handleInsertRangeMoveRightCommand(l, r, i);
4757
4784
  }
4758
4785
  case Gt.id: {
4759
- const d = u.params;
4760
- return this._handleInsertRangeMoveRightCommand(d, r, i);
4786
+ const l = u.params;
4787
+ return this._handleInsertRangeMoveDownCommand(l, r, i);
4761
4788
  }
4762
4789
  case zt.id: {
4763
- const d = u.params;
4764
- return this._handleInsertRangeMoveDownCommand(d, r, i);
4790
+ const l = u.params;
4791
+ return this._handleDeleteRangeMoveUpCommand(l, r, i);
4765
4792
  }
4766
4793
  case Ht.id: {
4767
- const d = u.params;
4768
- return this._handleDeleteRangeMoveUpCommand(d, r, i);
4769
- }
4770
- case $t.id: {
4771
- const d = u.params;
4772
- return this._handleDeleteRangeMoveLeftCommand(d, r, i);
4794
+ const l = u.params;
4795
+ return this._handleDeleteRangeMoveLeftCommand(l, r, i);
4773
4796
  }
4774
4797
  case J.MoveColsCommandId: {
4775
- const d = u.params;
4776
- return this._handleMoveColsCommand(d, r, i);
4798
+ const l = u.params;
4799
+ return this._handleMoveColsCommand(l, r, i);
4777
4800
  }
4778
4801
  case J.MoveRowsCommandId: {
4779
- const d = u.params;
4780
- return this._handleMoveRowsCommand(d, r, i);
4802
+ const l = u.params;
4803
+ return this._handleMoveRowsCommand(l, r, i);
4781
4804
  }
4782
4805
  }
4783
4806
  return { redos: [], undos: [] };
4784
4807
  };
4785
4808
  c.forEach((u) => {
4786
- t.add(this._refRangeService.registerRefRange(u, l, r, i));
4809
+ t.add(this._refRangeService.registerRefRange(u, d, r, i));
4787
4810
  });
4788
4811
  };
4789
4812
  this.disposeWithMe(
@@ -4814,10 +4837,10 @@ let ht = class extends ke {
4814
4837
  return this._handleNull();
4815
4838
  const i = [...r.getMergeData()], s = { unitId: e, subUnitId: o, ranges: i }, a = { unitId: e, subUnitId: o, ranges: [] };
4816
4839
  i.forEach((u) => {
4817
- const d = so({ id: J.MoveRowsCommandId, params: t }, u), g = Tt(d, u);
4840
+ const l = so({ id: J.MoveRowsCommandId, params: t }, u), g = Lt(l, u);
4818
4841
  g && a.ranges.push(g);
4819
4842
  });
4820
- const c = ve(this._injector, s), l = pe(this._injector, a);
4843
+ const c = ve(this._injector, s), d = pe(this._injector, a);
4821
4844
  return {
4822
4845
  redos: [
4823
4846
  { id: z.id, params: s },
@@ -4827,7 +4850,7 @@ let ht = class extends ke {
4827
4850
  }
4828
4851
  ],
4829
4852
  undos: [
4830
- { id: z.id, params: l },
4853
+ { id: z.id, params: d },
4831
4854
  {
4832
4855
  id: H.id,
4833
4856
  params: c
@@ -4844,10 +4867,10 @@ let ht = class extends ke {
4844
4867
  return this._handleNull();
4845
4868
  const i = [...r.getMergeData()], s = { unitId: e, subUnitId: o, ranges: i }, a = { unitId: e, subUnitId: o, ranges: [] };
4846
4869
  i.forEach((u) => {
4847
- const d = io({ id: J.MoveColsCommandId, params: t }, u), g = Tt(d, u);
4870
+ const l = io({ id: J.MoveColsCommandId, params: t }, u), g = Lt(l, u);
4848
4871
  g && a.ranges.push(g);
4849
4872
  });
4850
- const c = ve(this._injector, s), l = pe(this._injector, a);
4873
+ const c = ve(this._injector, s), d = pe(this._injector, a);
4851
4874
  return {
4852
4875
  redos: [
4853
4876
  { id: z.id, params: s },
@@ -4857,7 +4880,7 @@ let ht = class extends ke {
4857
4880
  }
4858
4881
  ],
4859
4882
  undos: [
4860
- { id: z.id, params: l },
4883
+ { id: z.id, params: d },
4861
4884
  {
4862
4885
  id: H.id,
4863
4886
  params: c
@@ -4872,7 +4895,7 @@ let ht = class extends ke {
4872
4895
  const r = Ie(n, o);
4873
4896
  if (!r)
4874
4897
  return this._handleNull();
4875
- const i = r.getMergeData(), s = i.filter((g) => E.intersects(g, t.fromRange)), a = i.filter((g) => E.intersects(g, t.toRange)), c = s.map((g) => E.getRelativeRange(g, t.fromRange)).map((g) => E.getPositionRange(g, t.toRange)), l = Ws(c).filter(
4898
+ const i = r.getMergeData(), s = i.filter((g) => E.intersects(g, t.fromRange)), a = i.filter((g) => E.intersects(g, t.toRange)), c = s.map((g) => E.getRelativeRange(g, t.fromRange)).map((g) => E.getPositionRange(g, t.toRange)), d = Ws(c).filter(
4876
4899
  (g) => !i.some((m) => E.equals(g, m))
4877
4900
  ), u = [
4878
4901
  {
@@ -4896,16 +4919,16 @@ let ht = class extends ke {
4896
4919
  params: {
4897
4920
  unitId: e,
4898
4921
  subUnitId: o,
4899
- ranges: l
4922
+ ranges: d
4900
4923
  }
4901
4924
  }
4902
- ], d = [
4925
+ ], l = [
4903
4926
  {
4904
4927
  id: z.id,
4905
4928
  params: {
4906
4929
  unitId: e,
4907
4930
  subUnitId: o,
4908
- ranges: l
4931
+ ranges: d
4909
4932
  }
4910
4933
  },
4911
4934
  {
@@ -4925,7 +4948,7 @@ let ht = class extends ke {
4925
4948
  }
4926
4949
  }
4927
4950
  ];
4928
- return { redos: u, undos: d };
4951
+ return { redos: u, undos: l };
4929
4952
  }
4930
4953
  _handleInsertRowCommand(t, e, o) {
4931
4954
  const n = Se(this._univerInstanceService, e);
@@ -4934,20 +4957,20 @@ let ht = class extends ke {
4934
4957
  const r = Ie(n, o);
4935
4958
  if (!r)
4936
4959
  return this._handleNull();
4937
- const { range: i } = t, { startRow: s, endRow: a } = i, c = D.deepClone(r.getMergeData()), l = D.deepClone(r.getMergeData()).map((v) => {
4960
+ const { range: i } = t, { startRow: s, endRow: a } = i, c = b.deepClone(r.getMergeData()), d = b.deepClone(r.getMergeData()).map((v) => {
4938
4961
  const S = a - s + 1;
4939
4962
  return s > v.endRow ? v : s <= v.startRow ? E.moveVertical(v, S) : (v.endRow += S, v);
4940
4963
  }), u = {
4941
4964
  unitId: e,
4942
4965
  subUnitId: o,
4943
4966
  ranges: c
4944
- }, d = ve(
4967
+ }, l = ve(
4945
4968
  this._injector,
4946
4969
  u
4947
4970
  ), g = {
4948
4971
  unitId: e,
4949
4972
  subUnitId: o,
4950
- ranges: l
4973
+ ranges: d
4951
4974
  }, m = pe(
4952
4975
  this._injector,
4953
4976
  g
@@ -4956,7 +4979,7 @@ let ht = class extends ke {
4956
4979
  { id: H.id, params: g }
4957
4980
  ], f = [
4958
4981
  { id: z.id, params: m },
4959
- { id: H.id, params: d }
4982
+ { id: H.id, params: l }
4960
4983
  ];
4961
4984
  return { redos: h, undos: f };
4962
4985
  }
@@ -4967,20 +4990,20 @@ let ht = class extends ke {
4967
4990
  const i = Ie(r, o);
4968
4991
  if (!i)
4969
4992
  return this._handleNull();
4970
- const { startColumn: s, endColumn: a } = n, c = D.deepClone(i.getMergeData()), l = D.deepClone(i.getMergeData()).map((v) => {
4993
+ const { startColumn: s, endColumn: a } = n, c = b.deepClone(i.getMergeData()), d = b.deepClone(i.getMergeData()).map((v) => {
4971
4994
  const S = a - s + 1;
4972
4995
  return s > v.endColumn ? v : s <= v.startColumn ? E.moveHorizontal(v, S) : (v.endColumn += S, v);
4973
4996
  }), u = {
4974
4997
  unitId: e,
4975
4998
  subUnitId: o,
4976
4999
  ranges: c
4977
- }, d = ve(
5000
+ }, l = ve(
4978
5001
  this._injector,
4979
5002
  u
4980
5003
  ), g = {
4981
5004
  unitId: e,
4982
5005
  subUnitId: o,
4983
- ranges: l
5006
+ ranges: d
4984
5007
  }, m = pe(
4985
5008
  this._injector,
4986
5009
  g
@@ -4989,7 +5012,7 @@ let ht = class extends ke {
4989
5012
  { id: H.id, params: g }
4990
5013
  ], f = [
4991
5014
  { id: z.id, params: m },
4992
- { id: H.id, params: d }
5015
+ { id: H.id, params: l }
4993
5016
  ];
4994
5017
  return { redos: h, undos: f };
4995
5018
  }
@@ -5000,44 +5023,44 @@ let ht = class extends ke {
5000
5023
  const r = Ie(n, o);
5001
5024
  if (!r)
5002
5025
  return this._handleNull();
5003
- const { range: i } = t, s = D.deepClone(r.getMergeData());
5026
+ const { range: i } = t, s = b.deepClone(r.getMergeData());
5004
5027
  for (let m = 0; m < s.length; m++) {
5005
- const h = s[m], { startColumn: f, endColumn: v } = h, S = v - f + 1, { startColumn: w, endColumn: p } = i, _ = p - w + 1;
5028
+ const h = s[m], { startColumn: f, endColumn: v } = h, S = v - f + 1, { startColumn: w, endColumn: p } = i, y = p - w + 1;
5006
5029
  if (p < h.startColumn)
5007
- h.startColumn -= _, h.endColumn -= _;
5030
+ h.startColumn -= y, h.endColumn -= y;
5008
5031
  else {
5009
5032
  if (w > h.endColumn)
5010
5033
  continue;
5011
5034
  if (w <= h.startColumn && p >= h.endColumn)
5012
5035
  s.splice(m, 1), m--;
5013
5036
  else {
5014
- const y = E.getIntersects(i, h), A = y.endColumn - y.startColumn + 1, U = y.endRow - y.startRow === 0;
5015
- A === S - 1 && U ? (s.splice(m, 1), m--) : h.endColumn -= y.endColumn - y.startColumn + 1;
5037
+ const _ = E.getIntersects(i, h), P = _.endColumn - _.startColumn + 1, D = _.endRow - _.startRow === 0;
5038
+ P === S - 1 && D ? (s.splice(m, 1), m--) : h.endColumn -= _.endColumn - _.startColumn + 1;
5016
5039
  }
5017
5040
  }
5018
5041
  }
5019
5042
  const a = {
5020
5043
  unitId: e,
5021
5044
  subUnitId: o,
5022
- ranges: D.deepClone(r.getMergeData())
5045
+ ranges: b.deepClone(r.getMergeData())
5023
5046
  }, c = ve(
5024
5047
  this._injector,
5025
5048
  a
5026
- ), l = {
5049
+ ), d = {
5027
5050
  unitId: e,
5028
5051
  subUnitId: o,
5029
5052
  ranges: s
5030
5053
  }, u = pe(
5031
5054
  this._injector,
5032
- l
5033
- ), d = [
5055
+ d
5056
+ ), l = [
5034
5057
  { id: z.id, params: a },
5035
- { id: H.id, params: l }
5058
+ { id: H.id, params: d }
5036
5059
  ], g = [
5037
5060
  { id: z.id, params: u },
5038
5061
  { id: H.id, params: c }
5039
5062
  ];
5040
- return { redos: d, undos: g };
5063
+ return { redos: l, undos: g };
5041
5064
  }
5042
5065
  _handleRemoveRowCommand(t, e, o) {
5043
5066
  const { range: n } = t, r = Se(this._univerInstanceService, e);
@@ -5046,44 +5069,44 @@ let ht = class extends ke {
5046
5069
  const i = Ie(r, o);
5047
5070
  if (!i)
5048
5071
  return this._handleNull();
5049
- const s = D.deepClone(i.getMergeData());
5072
+ const s = b.deepClone(i.getMergeData());
5050
5073
  for (let m = 0; m < s.length; m++) {
5051
- const h = s[m], { startRow: f, endRow: v } = h, S = v - f + 1, { startRow: w, endRow: p } = n, _ = p - w + 1;
5074
+ const h = s[m], { startRow: f, endRow: v } = h, S = v - f + 1, { startRow: w, endRow: p } = n, y = p - w + 1;
5052
5075
  if (p < f)
5053
- h.startRow -= _, h.endRow -= _;
5076
+ h.startRow -= y, h.endRow -= y;
5054
5077
  else {
5055
5078
  if (w > v)
5056
5079
  continue;
5057
5080
  if (w <= f && p >= v)
5058
5081
  s.splice(m, 1), m--;
5059
5082
  else {
5060
- const y = E.getIntersects(n, h), A = y.endRow - y.startRow + 1, U = y.endColumn - y.startColumn === 0;
5061
- A === S - 1 && U ? (s.splice(m, 1), m--) : h.endRow -= y.endRow - y.startRow + 1;
5083
+ const _ = E.getIntersects(n, h), P = _.endRow - _.startRow + 1, D = _.endColumn - _.startColumn === 0;
5084
+ P === S - 1 && D ? (s.splice(m, 1), m--) : h.endRow -= _.endRow - _.startRow + 1;
5062
5085
  }
5063
5086
  }
5064
5087
  }
5065
5088
  const a = {
5066
5089
  unitId: e,
5067
5090
  subUnitId: o,
5068
- ranges: D.deepClone(i.getMergeData())
5091
+ ranges: b.deepClone(i.getMergeData())
5069
5092
  }, c = ve(
5070
5093
  this._injector,
5071
5094
  a
5072
- ), l = {
5095
+ ), d = {
5073
5096
  unitId: e,
5074
5097
  subUnitId: o,
5075
5098
  ranges: s
5076
5099
  }, u = pe(
5077
5100
  this._injector,
5078
- l
5079
- ), d = [
5101
+ d
5102
+ ), l = [
5080
5103
  { id: z.id, params: a },
5081
- { id: H.id, params: l }
5104
+ { id: H.id, params: d }
5082
5105
  ], g = [
5083
5106
  { id: z.id, params: u },
5084
5107
  { id: H.id, params: c }
5085
5108
  ];
5086
- return { redos: d, undos: g };
5109
+ return { redos: l, undos: g };
5087
5110
  }
5088
5111
  _handleInsertRangeMoveRightCommand(t, e, o) {
5089
5112
  const n = Se(this._univerInstanceService, e);
@@ -5092,7 +5115,7 @@ let ht = class extends ke {
5092
5115
  const r = Ie(n, o);
5093
5116
  if (!r)
5094
5117
  return this._handleNull();
5095
- const i = t.range, s = r.getMaxColumns() - 1, a = r.getMergeData(), c = [], l = [];
5118
+ const i = t.range, s = r.getMaxColumns() - 1, a = r.getMergeData(), c = [], d = [];
5096
5119
  a.forEach((h) => {
5097
5120
  const { startRow: f, endRow: v, startColumn: S, endColumn: w } = i;
5098
5121
  if (E.intersects(
@@ -5112,12 +5135,12 @@ let ht = class extends ke {
5112
5135
  },
5113
5136
  h
5114
5137
  ))) {
5115
- const y = w - S + 1;
5116
- l.push({
5138
+ const _ = w - S + 1;
5139
+ d.push({
5117
5140
  startRow: h.startRow,
5118
- startColumn: h.startColumn + y,
5141
+ startColumn: h.startColumn + _,
5119
5142
  endRow: h.endRow,
5120
- endColumn: h.endColumn + y
5143
+ endColumn: h.endColumn + _
5121
5144
  });
5122
5145
  }
5123
5146
  });
@@ -5125,13 +5148,13 @@ let ht = class extends ke {
5125
5148
  unitId: e,
5126
5149
  subUnitId: o,
5127
5150
  ranges: c
5128
- }, d = ve(
5151
+ }, l = ve(
5129
5152
  this._injector,
5130
5153
  u
5131
5154
  ), g = {
5132
5155
  unitId: e,
5133
5156
  subUnitId: o,
5134
- ranges: l
5157
+ ranges: d
5135
5158
  }, m = pe(
5136
5159
  this._injector,
5137
5160
  g
@@ -5147,7 +5170,7 @@ let ht = class extends ke {
5147
5170
  undos: [
5148
5171
  {
5149
5172
  id: H.id,
5150
- params: d
5173
+ params: l
5151
5174
  },
5152
5175
  { id: z.id, params: m }
5153
5176
  ]
@@ -5160,15 +5183,15 @@ let ht = class extends ke {
5160
5183
  const r = Ie(n, o);
5161
5184
  if (!r)
5162
5185
  return this._handleNull();
5163
- const i = t.range, s = r.getMaxRows() - 1, a = r.getMergeData(), c = [], l = [];
5186
+ const i = t.range, s = r.getMaxRows() - 1, a = r.getMergeData(), c = [], d = [];
5164
5187
  a.forEach((v) => {
5165
- const { startRow: S, startColumn: w, endColumn: p, endRow: _ } = i;
5188
+ const { startRow: S, startColumn: w, endColumn: p, endRow: y } = i;
5166
5189
  if (E.intersects({ startRow: S, startColumn: w, endRow: s, endColumn: p }, v) && (c.push(v), E.contains({ startRow: S, startColumn: w, endRow: s, endColumn: p }, v))) {
5167
- const U = _ - S + 1;
5168
- l.push({
5169
- startRow: v.startRow + U,
5190
+ const D = y - S + 1;
5191
+ d.push({
5192
+ startRow: v.startRow + D,
5170
5193
  startColumn: v.startColumn,
5171
- endRow: v.endRow + U,
5194
+ endRow: v.endRow + D,
5172
5195
  endColumn: v.endColumn
5173
5196
  });
5174
5197
  }
@@ -5177,13 +5200,13 @@ let ht = class extends ke {
5177
5200
  unitId: e,
5178
5201
  subUnitId: o,
5179
5202
  ranges: c
5180
- }, d = ve(
5203
+ }, l = ve(
5181
5204
  this._injector,
5182
5205
  u
5183
5206
  ), g = {
5184
5207
  unitId: e,
5185
5208
  subUnitId: o,
5186
- ranges: l
5209
+ ranges: d
5187
5210
  }, m = pe(
5188
5211
  this._injector,
5189
5212
  g
@@ -5199,7 +5222,7 @@ let ht = class extends ke {
5199
5222
  ], f = [
5200
5223
  {
5201
5224
  id: H.id,
5202
- params: d
5225
+ params: l
5203
5226
  },
5204
5227
  {
5205
5228
  id: z.id,
@@ -5215,25 +5238,25 @@ let ht = class extends ke {
5215
5238
  const r = Ie(n, o);
5216
5239
  if (!r)
5217
5240
  return this._handleNull();
5218
- const i = t.range, s = r.getMaxRows() - 1, a = r.getMergeData(), c = [], l = [];
5241
+ const i = t.range, s = r.getMaxRows() - 1, a = r.getMergeData(), c = [], d = [];
5219
5242
  a.forEach((v) => {
5220
- const { startRow: S, startColumn: w, endColumn: p, endRow: _ } = i;
5243
+ const { startRow: S, startColumn: w, endColumn: p, endRow: y } = i;
5221
5244
  if (E.intersects({ startRow: S, startColumn: w, endRow: s, endColumn: p }, v) && (c.push(v), E.contains({ startRow: S, startColumn: w, endRow: s, endColumn: p }, v))) {
5222
- const U = _ - S + 1, P = E.moveVertical(v, -U);
5223
- l.push(P);
5245
+ const D = y - S + 1, A = E.moveVertical(v, -D);
5246
+ d.push(A);
5224
5247
  }
5225
5248
  });
5226
5249
  const u = {
5227
5250
  unitId: e,
5228
5251
  subUnitId: o,
5229
5252
  ranges: c
5230
- }, d = ve(
5253
+ }, l = ve(
5231
5254
  this._injector,
5232
5255
  u
5233
5256
  ), g = {
5234
5257
  unitId: e,
5235
5258
  subUnitId: o,
5236
- ranges: l
5259
+ ranges: d
5237
5260
  }, m = pe(
5238
5261
  this._injector,
5239
5262
  g
@@ -5249,7 +5272,7 @@ let ht = class extends ke {
5249
5272
  ], f = [
5250
5273
  {
5251
5274
  id: H.id,
5252
- params: d
5275
+ params: l
5253
5276
  },
5254
5277
  {
5255
5278
  id: z.id,
@@ -5265,7 +5288,7 @@ let ht = class extends ke {
5265
5288
  const r = Ie(n, o);
5266
5289
  if (!r)
5267
5290
  return this._handleNull();
5268
- const i = t.range, s = r.getMaxColumns() - 1, a = r.getMergeData(), c = [], l = [];
5291
+ const i = t.range, s = r.getMaxColumns() - 1, a = r.getMergeData(), c = [], d = [];
5269
5292
  a.forEach((h) => {
5270
5293
  const { startRow: f, endRow: v, startColumn: S, endColumn: w } = i;
5271
5294
  if (E.intersects(
@@ -5285,12 +5308,12 @@ let ht = class extends ke {
5285
5308
  },
5286
5309
  h
5287
5310
  ))) {
5288
- const y = w - S + 1;
5289
- l.push({
5311
+ const _ = w - S + 1;
5312
+ d.push({
5290
5313
  startRow: h.startRow,
5291
- startColumn: h.startColumn - y,
5314
+ startColumn: h.startColumn - _,
5292
5315
  endRow: h.endRow,
5293
- endColumn: h.endColumn - y
5316
+ endColumn: h.endColumn - _
5294
5317
  });
5295
5318
  }
5296
5319
  });
@@ -5298,13 +5321,13 @@ let ht = class extends ke {
5298
5321
  unitId: e,
5299
5322
  subUnitId: o,
5300
5323
  ranges: c
5301
- }, d = ve(
5324
+ }, l = ve(
5302
5325
  this._injector,
5303
5326
  u
5304
5327
  ), g = {
5305
5328
  unitId: e,
5306
5329
  subUnitId: o,
5307
- ranges: l
5330
+ ranges: d
5308
5331
  }, m = pe(
5309
5332
  this._injector,
5310
5333
  g
@@ -5320,7 +5343,7 @@ let ht = class extends ke {
5320
5343
  undos: [
5321
5344
  {
5322
5345
  id: H.id,
5323
- params: d
5346
+ params: l
5324
5347
  },
5325
5348
  { id: z.id, params: m }
5326
5349
  ]
@@ -5330,15 +5353,15 @@ let ht = class extends ke {
5330
5353
  return { redos: [], undos: [] };
5331
5354
  }
5332
5355
  };
5333
- ht = Bs([
5334
- De(Me.Steady, ht),
5356
+ mt = Bs([
5357
+ De(Me.Steady, mt),
5335
5358
  xe(0, te(M)),
5336
5359
  xe(1, te(Ke)),
5337
5360
  xe(2, te(C)),
5338
- xe(3, te(Rn)),
5361
+ xe(3, te(pn)),
5339
5362
  xe(4, te($)),
5340
5363
  xe(5, te(L))
5341
- ], ht);
5364
+ ], mt);
5342
5365
  function Se(t, e) {
5343
5366
  return e ? t.getUniverSheetInstance(e) : t.getCurrentUniverSheetInstance();
5344
5367
  }
@@ -5361,8 +5384,8 @@ var Fs = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, Hs = (t, e
5361
5384
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
5362
5385
  return n && r && Fs(e, o, r), r;
5363
5386
  }, at = (t, e) => (o, n) => e(o, n, t);
5364
- const gn = "SHEET_NUMFMT_PLUGIN";
5365
- let mt = class extends ke {
5387
+ const hn = "SHEET_NUMFMT_PLUGIN";
5388
+ let ft = class extends ke {
5366
5389
  constructor(e, o, n, r) {
5367
5390
  super();
5368
5391
  /**
@@ -5372,7 +5395,7 @@ let mt = class extends ke {
5372
5395
  */
5373
5396
  F(this, "_numfmtModel", /* @__PURE__ */ new Map());
5374
5397
  F(this, "_refAliasModel", /* @__PURE__ */ new Map());
5375
- F(this, "_modelReplace$", new Et());
5398
+ F(this, "_modelReplace$", new Nt());
5376
5399
  F(this, "modelReplace$", this._modelReplace$.asObservable());
5377
5400
  this._commandService = e, this._resourceManagerService = o, this._univerInstanceService = n, this._logService = r, this._initModel(), this.disposeWithMe(
5378
5401
  le(() => {
@@ -5384,18 +5407,18 @@ let mt = class extends ke {
5384
5407
  const e = (n) => {
5385
5408
  const r = n.getUnitId();
5386
5409
  this.disposeWithMe(
5387
- this._resourceManagerService.registerPluginResource(r, gn, {
5410
+ this._resourceManagerService.registerPluginResource(r, hn, {
5388
5411
  toJson: (i) => this._toJson(i),
5389
5412
  parseJson: (i) => this._parseJson(i),
5390
5413
  onChange: (i, s) => {
5391
5414
  const { model: a, refModel: c } = s;
5392
5415
  if (a) {
5393
- const l = Object.keys(a).reduce((u, d) => (u.set(d, new ne(a[d])), u), /* @__PURE__ */ new Map());
5394
- this._numfmtModel.set(i, l);
5416
+ const d = Object.keys(a).reduce((u, l) => (u.set(l, new ne(a[l])), u), /* @__PURE__ */ new Map());
5417
+ this._numfmtModel.set(i, d);
5395
5418
  }
5396
5419
  c && this._refAliasModel.set(
5397
5420
  i,
5398
- new Ut(c, ["pattern", "i"])
5421
+ new Dt(c, ["pattern", "i"])
5399
5422
  ), this._modelReplace$.next(i);
5400
5423
  }
5401
5424
  })
@@ -5405,7 +5428,7 @@ let mt = class extends ke {
5405
5428
  le(
5406
5429
  this._univerInstanceService.sheetDisposed$.subscribe((n) => {
5407
5430
  const r = n.getUnitId();
5408
- this._numfmtModel.get(r) && this._numfmtModel.delete(r), this._refAliasModel.get(r) && this._refAliasModel.delete(r), this._resourceManagerService.disposePluginResource(r, gn);
5431
+ this._numfmtModel.get(r) && this._numfmtModel.delete(r), this._refAliasModel.get(r) && this._refAliasModel.delete(r), this._resourceManagerService.disposePluginResource(r, hn);
5409
5432
  })
5410
5433
  )
5411
5434
  );
@@ -5418,8 +5441,8 @@ let mt = class extends ke {
5418
5441
  return "";
5419
5442
  const r = [...o.keys()].reduce(
5420
5443
  (a, c) => {
5421
- const l = o.get(c);
5422
- return a[c] = l.toJSON(), a;
5444
+ const d = o.get(c);
5445
+ return a[c] = d.toJSON(), a;
5423
5446
  },
5424
5447
  {}
5425
5448
  ), i = n.getValues().filter((a) => a.count > 0);
@@ -5458,10 +5481,10 @@ let mt = class extends ke {
5458
5481
  return null;
5459
5482
  const a = this._refAliasModel.get(e), c = s.getValue(n, r);
5460
5483
  if (c && a) {
5461
- const l = a.getValue(c == null ? void 0 : c.i);
5462
- return l ? {
5463
- pattern: l.pattern,
5464
- type: l.type
5484
+ const d = a.getValue(c == null ? void 0 : c.i);
5485
+ return d ? {
5486
+ pattern: d.pattern,
5487
+ type: d.type
5465
5488
  } : (this._logService.error("[Numfmt Service]:", "RefAliasModel is not match model"), null);
5466
5489
  }
5467
5490
  return null;
@@ -5469,11 +5492,11 @@ let mt = class extends ke {
5469
5492
  deleteValues(e, o, n) {
5470
5493
  let r = this._refAliasModel.get(e);
5471
5494
  const i = this.getModel(e, o);
5472
- r || (r = new Ut([], ["pattern", "i"]), this._refAliasModel.set(e, r)), n.forEach((s) => {
5495
+ r || (r = new Dt([], ["pattern", "i"]), this._refAliasModel.set(e, r)), n.forEach((s) => {
5473
5496
  ge.foreach(s, (a, c) => {
5474
- const l = this.getValue(e, o, a, c, i);
5475
- if (l && l.pattern) {
5476
- const u = r.getValue(l.pattern);
5497
+ const d = this.getValue(e, o, a, c, i);
5498
+ if (d && d.pattern) {
5499
+ const u = r.getValue(d.pattern);
5477
5500
  u && u.count--;
5478
5501
  }
5479
5502
  this._setValue(e, o, a, c, null);
@@ -5483,7 +5506,7 @@ let mt = class extends ke {
5483
5506
  setValues(e, o, n) {
5484
5507
  const r = this.getModel(e, o);
5485
5508
  let i = this._refAliasModel.get(e);
5486
- i || (i = new Ut([], ["pattern", "i"]), this._refAliasModel.set(e, i)), n.forEach((s) => {
5509
+ i || (i = new Dt([], ["pattern", "i"]), this._refAliasModel.set(e, i)), n.forEach((s) => {
5487
5510
  let a = i.getValue(s.pattern);
5488
5511
  a || (a = {
5489
5512
  count: 0,
@@ -5491,15 +5514,15 @@ let mt = class extends ke {
5491
5514
  pattern: s.pattern,
5492
5515
  type: n[0].type
5493
5516
  }, i.addValue(a)), s.ranges.forEach((c) => {
5494
- ge.foreach(c, (l, u) => {
5517
+ ge.foreach(c, (d, u) => {
5495
5518
  if (r) {
5496
- const d = this.getValue(e, o, l, u, r);
5497
- if (d && d.pattern) {
5498
- const g = i.getValue(d.pattern);
5519
+ const l = this.getValue(e, o, d, u, r);
5520
+ if (l && l.pattern) {
5521
+ const g = i.getValue(l.pattern);
5499
5522
  g && g.count--;
5500
5523
  }
5501
5524
  }
5502
- this._setValue(e, o, l, u, {
5525
+ this._setValue(e, o, d, u, {
5503
5526
  i: a.i
5504
5527
  }), a.count++;
5505
5528
  });
@@ -5514,28 +5537,28 @@ let mt = class extends ke {
5514
5537
  return this._refAliasModel.get(e);
5515
5538
  }
5516
5539
  };
5517
- mt = Hs([
5518
- De(Me.Starting, mt),
5540
+ ft = Hs([
5541
+ De(Me.Starting, ft),
5519
5542
  at(0, te(M)),
5520
5543
  at(1, te(Mo)),
5521
5544
  at(2, te(C)),
5522
- at(3, te(Vt))
5523
- ], mt);
5524
- const hn = "univer.sheet.editable";
5525
- class Te extends _o {
5545
+ at(3, te(Bt))
5546
+ ], ft);
5547
+ const mn = "univer.sheet.editable";
5548
+ class Te extends yo {
5526
5549
  constructor(o, n) {
5527
5550
  super();
5528
- F(this, "id", hn);
5551
+ F(this, "id", mn);
5529
5552
  F(this, "value", !0);
5530
5553
  F(this, "unitID");
5531
- this._unitId = o, this._subUnitId = n, this.unitID = o, this.id = `${hn}_${o}_${n}`;
5554
+ this._unitId = o, this._subUnitId = n, this.unitID = o, this.id = `${mn}_${o}_${n}`;
5532
5555
  }
5533
5556
  }
5534
5557
  var zs = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, qs = (t, e, o, n) => {
5535
5558
  for (var r = n > 1 ? void 0 : n ? Gs(e, o) : e, i = t.length - 1, s; i >= 0; i--)
5536
5559
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
5537
5560
  return n && r && zs(e, o, r), r;
5538
- }, kt = (t, e) => (o, n) => e(o, n, t);
5561
+ }, Ot = (t, e) => (o, n) => e(o, n, t);
5539
5562
  let Je = class extends ke {
5540
5563
  constructor(t, e, o) {
5541
5564
  super(), this._permissionService = t, this._univerInstanceService = e, this._sheetInterceptorService = o, this._init(), this._interceptCommandPermission();
@@ -5580,16 +5603,16 @@ let Je = class extends ke {
5580
5603
  }
5581
5604
  getEditable$(t, e) {
5582
5605
  const o = this._univerInstanceService.getCurrentUniverSheetInstance(), n = t || o.getUnitId(), r = o.getActiveSheet(), i = e || r.getSheetId(), s = new Te(n, i);
5583
- return this._permissionService.composePermission$(n, [on, s.id]).pipe(
5606
+ return this._permissionService.composePermission$(n, [rn, s.id]).pipe(
5584
5607
  To(([a, c]) => {
5585
- const l = a.value && c.value, u = bo([a, c]);
5586
- return { value: l, status: u };
5608
+ const d = a.value && c.value, u = bo([a, c]);
5609
+ return { value: d, status: u };
5587
5610
  })
5588
5611
  );
5589
5612
  }
5590
5613
  getSheetEditable(t, e) {
5591
5614
  const o = this._univerInstanceService.getCurrentUniverSheetInstance(), n = t || o.getUnitId(), r = o.getActiveSheet(), i = e || r.getSheetId(), s = new Te(n, i);
5592
- return this._permissionService.composePermission(n, [on, s.id]).every((a) => a.value);
5615
+ return this._permissionService.composePermission(n, [rn, s.id]).every((a) => a.value);
5593
5616
  }
5594
5617
  setSheetEditable(t, e, o) {
5595
5618
  const n = this._univerInstanceService.getCurrentUniverSheetInstance(), r = e || n.getUnitId(), i = n.getActiveSheet(), s = o || i.getSheetId(), a = new Te(r, s);
@@ -5598,13 +5621,13 @@ let Je = class extends ke {
5598
5621
  };
5599
5622
  Je = qs([
5600
5623
  De(Me.Ready, Je),
5601
- kt(0, te(yo)),
5602
- kt(1, te(C)),
5603
- kt(2, te($))
5624
+ Ot(0, te(_o)),
5625
+ Ot(1, te(C)),
5626
+ Ot(2, te($))
5604
5627
  ], Je);
5605
5628
  function pi(t) {
5606
5629
  const e = t.get(C), o = t.get(Je), n = e.getCurrentUniverSheetInstance().getUnitId(), r = e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
5607
- return new Ao((i) => {
5630
+ return new Po((i) => {
5608
5631
  var a;
5609
5632
  const s = (a = o.getEditable$(n, r)) == null ? void 0 : a.subscribe((c) => {
5610
5633
  i.next(!c.value);
@@ -5618,10 +5641,10 @@ var Ks = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, Xs = (t, e
5618
5641
  for (var r = n > 1 ? void 0 : n ? Js(e, o) : e, i = t.length - 1, s; i >= 0; i--)
5619
5642
  (s = t[i]) && (r = (n ? s(e, o, r) : s(r)) || r);
5620
5643
  return n && r && Ks(e, o, r), r;
5621
- }, Ot = (t, e) => (o, n) => e(o, n, t);
5644
+ }, At = (t, e) => (o, n) => e(o, n, t);
5622
5645
  const Ys = "sheet";
5623
5646
  var Pt;
5624
- let mn = (Pt = class extends Uo {
5647
+ let fn = (Pt = class extends Uo {
5625
5648
  constructor(t, e, o, n) {
5626
5649
  super(Ys), this._config = t, this._commandService = e, this._localeService = o, this._injector = n, this._initializeDependencies(n);
5627
5650
  }
@@ -5638,30 +5661,30 @@ let mn = (Pt = class extends Uo {
5638
5661
  [L],
5639
5662
  [Ke],
5640
5663
  [Je],
5641
- [ze, { useClass: mt }],
5664
+ [ze, { useClass: ft }],
5642
5665
  [$],
5643
5666
  // controllers
5644
- [dt],
5645
- [ht]
5667
+ [lt],
5668
+ [mt]
5646
5669
  ];
5647
- (o = this._config) != null && o.notExecuteFormula || e.push([lt], [gt]), e.forEach((n) => {
5670
+ (o = this._config) != null && o.notExecuteFormula || e.push([gt], [ht]), e.forEach((n) => {
5648
5671
  t.add(n);
5649
5672
  });
5650
5673
  }
5651
5674
  }, F(Pt, "type", Do.Sheet), Pt);
5652
- mn = Xs([
5653
- Ot(1, M),
5654
- Ot(2, te(Lt)),
5655
- Ot(3, te(Rn))
5656
- ], mn);
5675
+ fn = Xs([
5676
+ At(1, M),
5677
+ At(2, te(Vt)),
5678
+ At(3, te(pn))
5679
+ ], fn);
5657
5680
  const wi = [
5658
5681
  be.id,
5659
5682
  Re.id,
5660
5683
  eo.id,
5661
- ye.id,
5662
- Mt.id,
5663
- Ct.id,
5684
+ _e.id,
5685
+ yt.id,
5664
5686
  St.id,
5687
+ It.id,
5665
5688
  Xe.id,
5666
5689
  Ye.id,
5667
5690
  Qe.id,
@@ -5672,10 +5695,10 @@ const wi = [
5672
5695
  je.id
5673
5696
  ], Mi = [
5674
5697
  Q.id,
5675
- vt.id,
5698
+ Ct.id,
5676
5699
  z.id,
5677
5700
  H.id
5678
- ], _i = 1.5, yi = "rgba(255,255,255, 0.01)";
5701
+ ], yi = 1.5, _i = "rgba(255,255,255, 0.01)";
5679
5702
  function bi(t) {
5680
5703
  const e = t.getCurrentTheme(), o = new ko(e.colorBlack).setAlpha(0.1).toRgbString();
5681
5704
  return {
@@ -5749,12 +5772,12 @@ export {
5749
5772
  He as BorderStyleManagerService,
5750
5773
  wi as COMMAND_LISTENER_SKELETON_CHANGE,
5751
5774
  Mi as COMMAND_LISTENER_VALUE_CHANGE,
5752
- Bt as ClearSelectionAllCommand,
5775
+ Wt as ClearSelectionAllCommand,
5753
5776
  Mn as ClearSelectionContentCommand,
5754
- Wt as ClearSelectionFormatCommand,
5777
+ jt as ClearSelectionFormatCommand,
5755
5778
  cr as CopySheetCommand,
5756
- $t as DeleteRangeMoveLeftCommand,
5757
- Ht as DeleteRangeMoveUpCommand,
5779
+ Ht as DeleteRangeMoveLeftCommand,
5780
+ zt as DeleteRangeMoveUpCommand,
5758
5781
  Jn as DeltaColumnWidthCommand,
5759
5782
  ts as DeltaRowHeightCommand,
5760
5783
  J as EffectRefRangId,
@@ -5765,9 +5788,9 @@ export {
5765
5788
  fr as InsertColBeforeCommand,
5766
5789
  tt as InsertColCommand,
5767
5790
  We as InsertColMutation,
5768
- Pn as InsertColMutationUndoFactory,
5769
- zt as InsertRangeMoveDownCommand,
5770
- Gt as InsertRangeMoveRightCommand,
5791
+ An as InsertColMutationUndoFactory,
5792
+ Gt as InsertRangeMoveDownCommand,
5793
+ qt as InsertRangeMoveRightCommand,
5771
5794
  mr as InsertRowAfterCommand,
5772
5795
  hr as InsertRowBeforeCommand,
5773
5796
  et as InsertRowCommand,
@@ -5775,44 +5798,44 @@ export {
5775
5798
  On as InsertRowMutationUndoFactory,
5776
5799
  Cr as InsertSheetCommand,
5777
5800
  Le as InsertSheetMutation,
5778
- _n as InsertSheetUndoMutationFactory,
5801
+ yn as InsertSheetUndoMutationFactory,
5779
5802
  ds as MAX_CELL_PER_SHEET_KEY,
5780
- ht as MergeCellController,
5803
+ mt as MergeCellController,
5781
5804
  Vn as MoveColsCommand,
5782
- St as MoveColsMutation,
5783
- jt as MoveRangeCommand,
5784
- vt as MoveRangeMutation,
5805
+ It as MoveColsMutation,
5806
+ Ft as MoveRangeCommand,
5807
+ Ct as MoveRangeMutation,
5785
5808
  Tn as MoveRowsCommand,
5786
- Ct as MoveRowsMutation,
5809
+ St as MoveRowsMutation,
5787
5810
  se as NORMAL_SELECTION_PLUGIN_NAME,
5788
- mt as NumfmtService,
5811
+ ft as NumfmtService,
5789
5812
  Z as OperatorType,
5790
5813
  Ke as RefRangeService,
5791
- Kt as RemoveColCommand,
5814
+ Jt as RemoveColCommand,
5792
5815
  Fe as RemoveColMutation,
5793
5816
  ve as RemoveMergeUndoMutationFactory,
5794
5817
  oo as RemoveNumfmtMutation,
5795
- qt as RemoveRowCommand,
5818
+ Kt as RemoveRowCommand,
5796
5819
  je as RemoveRowMutation,
5797
5820
  jn as RemoveSheetCommand,
5798
- pt as RemoveSheetMutation,
5821
+ wt as RemoveSheetMutation,
5799
5822
  ar as RemoveSheetUndoMutationFactory,
5800
5823
  wr as RemoveWorksheetMergeCommand,
5801
5824
  z as RemoveWorksheetMergeMutation,
5802
5825
  $r as ResetBackgroundColorCommand,
5803
5826
  jr as ResetTextColorCommand,
5804
- yi as SELECTION_CONTROL_BORDER_BUFFER_COLOR,
5805
- _i as SELECTION_CONTROL_BORDER_BUFFER_WIDTH,
5827
+ _i as SELECTION_CONTROL_BORDER_BUFFER_COLOR,
5828
+ yi as SELECTION_CONTROL_BORDER_BUFFER_WIDTH,
5806
5829
  L as SelectionManagerService,
5807
5830
  Fo as SelectionMoveType,
5808
5831
  Fr as SetBackgroundColorCommand,
5809
5832
  di as SetBoldCommand,
5810
- _r as SetBorderBasicCommand,
5833
+ yr as SetBorderBasicCommand,
5811
5834
  Ur as SetBorderColorCommand,
5812
5835
  nt as SetBorderCommand,
5813
- yr as SetBorderPositionCommand,
5836
+ _r as SetBorderPositionCommand,
5814
5837
  br as SetBorderStyleCommand,
5815
- Pr as SetColHiddenCommand,
5838
+ Ar as SetColHiddenCommand,
5816
5839
  Xe as SetColHiddenMutation,
5817
5840
  Ye as SetColVisibleMutation,
5818
5841
  Xn as SetColWidthCommand,
@@ -5823,7 +5846,7 @@ export {
5823
5846
  Hn as SetFrozenMutationFactory,
5824
5847
  zr as SetHorizontalTextAlignCommand,
5825
5848
  li as SetItalicCommand,
5826
- Xt as SetNumfmtMutation,
5849
+ Yt as SetNumfmtMutation,
5827
5850
  Ve as SetRangeValuesCommand,
5828
5851
  Q as SetRangeValuesMutation,
5829
5852
  Oe as SetRangeValuesUndoMutationFactory,
@@ -5839,22 +5862,22 @@ export {
5839
5862
  hi as SetStrikeThroughCommand,
5840
5863
  ie as SetStyleCommand,
5841
5864
  Jr as SetTabColorCommand,
5842
- ct as SetTabColorMutation,
5865
+ ut as SetTabColorMutation,
5843
5866
  Wr as SetTextColorCommand,
5844
5867
  qr as SetTextRotationCommand,
5845
5868
  Gr as SetTextWrapCommand,
5846
5869
  gi as SetUnderlineCommand,
5847
5870
  Hr as SetVerticalTextAlignCommand,
5848
5871
  qn as SetWorksheetActivateCommand,
5849
- Mt as SetWorksheetActiveOperation,
5850
- ye as SetWorksheetColWidthMutation,
5872
+ yt as SetWorksheetActiveOperation,
5873
+ _e as SetWorksheetColWidthMutation,
5851
5874
  Kn as SetWorksheetColWidthMutationFactory,
5852
5875
  Xr as SetWorksheetHideCommand,
5853
5876
  Ne as SetWorksheetHideMutation,
5854
5877
  Zn as SetWorksheetNameCommand,
5855
- Nt as SetWorksheetNameMutation,
5878
+ xt as SetWorksheetNameMutation,
5856
5879
  Qr as SetWorksheetOrderCommand,
5857
- ut as SetWorksheetOrderMutation,
5880
+ dt as SetWorksheetOrderMutation,
5858
5881
  eo as SetWorksheetRowAutoHeightMutation,
5859
5882
  vi as SetWorksheetRowAutoHeightMutationFactory,
5860
5883
  be as SetWorksheetRowHeightMutation,
@@ -5864,14 +5887,14 @@ export {
5864
5887
  Te as SheetEditablePermission,
5865
5888
  $ as SheetInterceptorService,
5866
5889
  Je as SheetPermissionService,
5867
- mn as UniverSheetsPlugin,
5868
- wt as alignToMergedCellsBorders,
5890
+ fn as UniverSheetsPlugin,
5891
+ Mt as alignToMergedCellsBorders,
5869
5892
  Zs as convertPrimaryWithCoordToPrimary,
5870
5893
  Ui as convertSelectionDataToRange,
5871
5894
  Ri as enUS,
5872
5895
  Si as factoryRemoveNumfmtUndoMutation,
5873
5896
  Ci as factorySetNumfmtUndoMutation,
5874
- Pe as followSelectionOperation,
5897
+ Ae as followSelectionOperation,
5875
5898
  Ws as getAddMergeMutationRangeByType,
5876
5899
  ai as getCellAtRowCol,
5877
5900
  pi as getCurrentSheetDisabled$,
@@ -5879,7 +5902,7 @@ export {
5879
5902
  bi as getNormalSelectionStyle,
5880
5903
  he as getPrimaryForRange,
5881
5904
  Un as getRemoveRangeMutations,
5882
- yt as handleBaseInsertRange,
5905
+ bt as handleBaseInsertRange,
5883
5906
  ro as handleBaseMoveRowsCols,
5884
5907
  _t as handleBaseRemoveRange,
5885
5908
  Ii as handleDefaultRangeChangeWithEffectRefCommands,
@@ -5888,18 +5911,18 @@ export {
5888
5911
  ui as handleDeleteRangeMutation,
5889
5912
  ks as handleIRemoveCol,
5890
5913
  Os as handleIRemoveRow,
5891
- As as handleInsertCol,
5914
+ Ps as handleInsertCol,
5892
5915
  Es as handleInsertRangeMoveDown,
5893
5916
  Ns as handleInsertRangeMoveRight,
5894
5917
  ci as handleInsertRangeMutation,
5895
- Ps as handleInsertRow,
5918
+ As as handleInsertRow,
5896
5919
  io as handleMoveCols,
5897
5920
  Ds as handleMoveRange,
5898
5921
  so as handleMoveRows,
5899
5922
  no as rangeMerge,
5900
5923
  Ue as rotateRange,
5901
- Tt as runRefRangeMutations,
5924
+ Lt as runRefRangeMutations,
5902
5925
  Di as transformCellDataToSelectionData,
5903
- xt as transformCellsToRange,
5926
+ Tt as transformCellsToRange,
5904
5927
  js as zhCN
5905
5928
  };