@univerjs/sheets-drawing-ui 0.5.0 → 0.5.1-nightly.202411301606

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,67 +1,69 @@
1
- var mn = Object.defineProperty;
2
- var fn = (i, e, n) => e in i ? mn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
- var V = (i, e, n) => fn(i, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as H, ICommandService as B, IUndoRedoService as ue, sequenceExecute as It, LocaleService as Be, IUniverInstanceService as fe, useDependency as ae, Inject as W, Injector as Rt, IContextService as Dt, RxDisposable as pn, UniverInstanceType as Y, connectInjector as wn, toDisposable as _n, FOCUSING_COMMON_DRAWINGS as me, Disposable as ie, Direction as te, FOCUSING_FX_BAR_EDITOR as vn, EDITOR_ACTIVATED as Sn, FOCUSING_PANEL_EDITOR as Cn, Tools as ge, UserManagerService as In, IPermissionService as Rn, Rectangle as Dn, LifecycleService as Mn, LifecycleStages as bn, DisposableCollection as yn, fromEventSubject as On, generateRandomId as Pn, DependentOn as Tn, Plugin as En, registerDependencies as Un, touchDependencies as Xe, IConfigService as An } from "@univerjs/core";
5
- import { IDrawingManagerService as K, IImageIoService as Mt, DrawingTypeEnum as k, ArrangeTypeEnum as ve, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Nn, DRAWING_IMAGE_COUNT_LIMIT as mt, ImageUploadStatusType as He, DRAWING_IMAGE_ALLOW_SIZE as jn, getImageSize as Wn, DRAWING_IMAGE_WIDTH_LIMIT as ft, DRAWING_IMAGE_HEIGHT_LIMIT as pt, getDrawingShapeKeyByDrawingSearch as ze, UniverDrawingPlugin as xn } from "@univerjs/drawing";
6
- import { ImageCropperObject as $n, COMPONENT_IMAGE_POPUP_MENU as Ln, OpenImageCropOperation as Bn, ImageResetSizeOperation as Gn, DrawingCommonPanel as Vn, DrawingRenderService as kn, UniverDrawingUIPlugin as Yn } from "@univerjs/drawing-ui";
7
- import { IRenderManagerService as J, precisionTo as ne, getGroupState as Fn, transformObjectOutOfGroup as Xn, RENDER_CLASS_TYPE as de, Rect as wt, ObjectType as Hn, DRAWING_OBJECT_LAYER_INDEX as zn, SHEET_VIEWPORT_KEY as Kn } from "@univerjs/engine-render";
8
- import { ISheetDrawingService as F, SetDrawingApplyMutation as P, DrawingApplyType as T, SheetDrawingAnchorType as y, UniverSheetsDrawingPlugin as Jn } from "@univerjs/sheets-drawing";
9
- import { SheetCanvasPopManagerService as Zn, attachRangeWithCoord as Te, ISheetSelectionRenderService as pe, SheetSkeletonManagerService as q, getCurrentRangeDisable$ as qn, COPY_TYPE as _t, PREDEFINED_HOOK_NAME as Se, virtualizeDiscreteRanges as Qn, ISheetClipboardService as er, SheetPrintInterceptorService as tr, VIEWPORT_KEY as nr, SetZoomRatioOperation as rr } from "@univerjs/sheets-ui";
10
- import { ISidebarService as ir, IUIPartsService as sr, BuiltInUIPart as or, ILocalFileService as ar, IMessageService as cr, MenuItemType as bt, getMenuHiddenObservable as yt, RibbonStartGroup as dr, KeyCode as le, ComponentManager as lr, IMenuManagerService as ur, IShortcutService as hr, CanvasFloatDomService as gr } from "@univerjs/ui";
11
- import { takeUntil as vt, combineLatest as Ce, map as Ee, filter as re, distinctUntilChanged as Ie, Subject as Ke, take as mr, BehaviorSubject as fr, switchMap as St } from "rxjs";
12
- import { SheetInterceptorService as at, getSheetCommandTarget as ce, SheetsSelectionsService as pr, WorkbookEditablePermission as tt, WorksheetEditPermission as Pe, RangeProtectionPermissionEditPoint as wr, WorkbookViewPermission as Ct, WorksheetViewPermission as Je, InsertRowCommand as Ot, InsertColCommand as Pt, RemoveRowCommand as Tt, RemoveColCommand as Et, DeleteRangeMoveLeftCommand as Ut, DeleteRangeMoveUpCommand as At, InsertRangeMoveDownCommand as Nt, InsertRangeMoveRightCommand as jt, DeltaRowHeightCommand as nt, SetRowHeightCommand as rt, DeltaColumnWidthCommand as Wt, SetColWidthCommand as xt, SetRowHiddenCommand as $t, SetSpecificRowsVisibleCommand as Lt, SetSpecificColsVisibleCommand as Bt, SetColHiddenCommand as Gt, MoveColsCommand as Vt, MoveRowsCommand as kt, MoveRangeCommand as Yt, SetRowVisibleMutation as _r, SetRowHiddenMutation as vr, SetColVisibleMutation as Sr, SetColHiddenMutation as Cr, SetWorksheetRowHeightMutation as Ir, SetWorksheetColWidthMutation as Rr, SetWorksheetActiveOperation as Dr, SetFrozenMutation as Mr } from "@univerjs/sheets";
13
- import Ft, { useEffect as ct, forwardRef as Xt, useRef as br, createElement as Ht, useState as it } from "react";
14
- import { MessageType as Re, RadioGroup as yr, Radio as Ze } from "@univerjs/design";
15
- const Or = "sheets-drawing-ui.config", Pr = {}, j = {
1
+ var Nn = Object.defineProperty;
2
+ var jn = (i, e, n) => e in i ? Nn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
+ var F = (i, e, n) => jn(i, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as Y, ICommandService as G, IUndoRedoService as me, sequenceExecute as Lt, LocaleService as Je, IUniverInstanceService as fe, useDependency as le, Inject as N, Injector as Ie, IContextService as Gt, RxDisposable as Wn, UniverInstanceType as L, connectInjector as xn, toDisposable as $n, FOCUSING_COMMON_DRAWINGS as ve, DrawingTypeEnum as V, Disposable as Z, ArrangeTypeEnum as De, createDocumentModelWithStyle as Bn, ObjectRelativeFromH as Ln, ObjectRelativeFromV as Gn, BooleanNumber as Fn, PositionedObjectLayoutType as Vn, WrapTextType as kn, BuildTextUtils as Hn, Range as Yn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as be, DOCS_ZEN_EDITOR_UNIT_ID_KEY as ye, InterceptorEffectEnum as Xn, ObjectMatrix as zn, Tools as _e, UserManagerService as Kn, IPermissionService as Jn, Rectangle as qn, Direction as re, FOCUSING_FX_BAR_EDITOR as Zn, EDITOR_ACTIVATED as Qn, FOCUSING_PANEL_EDITOR as er, LifecycleService as tr, LifecycleStages as nr, DisposableCollection as rr, fromEventSubject as ir, generateRandomId as sr, DependentOn as or, Plugin as ar, registerDependencies as cr, touchDependencies as nt, IConfigService as dr } from "@univerjs/core";
5
+ import { IDrawingManagerService as q, IImageIoService as Ft, DRAWING_IMAGE_ALLOW_IMAGE_LIST as bt, DRAWING_IMAGE_COUNT_LIMIT as yt, ImageUploadStatusType as ue, DRAWING_IMAGE_ALLOW_SIZE as Ot, getImageSize as Tt, DRAWING_IMAGE_WIDTH_LIMIT as Et, DRAWING_IMAGE_HEIGHT_LIMIT as Pt, getDrawingShapeKeyByDrawingSearch as rt, UniverDrawingPlugin as lr } from "@univerjs/drawing";
6
+ import { ImageCropperObject as ur, COMPONENT_IMAGE_POPUP_MENU as hr, OpenImageCropOperation as gr, ImageResetSizeOperation as mr, DrawingRenderService as Vt, DrawingCommonPanel as fr, UniverDrawingUIPlugin as pr } from "@univerjs/drawing-ui";
7
+ import { IRenderManagerService as X, precisionTo as ie, getGroupState as wr, transformObjectOutOfGroup as _r, RENDER_CLASS_TYPE as he, Rect as Ut, ObjectType as vr, DRAWING_OBJECT_LAYER_INDEX as Sr, SHEET_VIEWPORT_KEY as kt } from "@univerjs/engine-render";
8
+ import { ISheetDrawingService as z, SetDrawingApplyMutation as T, DrawingApplyType as E, SheetDrawingAnchorType as y, UniverSheetsDrawingPlugin as Ir } from "@univerjs/sheets-drawing";
9
+ import { SheetCanvasPopManagerService as Cr, attachRangeWithCoord as $e, ISheetSelectionRenderService as Ce, SheetSkeletonManagerService as Q, IEditorBridgeService as Rr, IAutoFillService as Mr, HoverManagerService as Dr, COPY_TYPE as At, PREDEFINED_HOOK_NAME as Oe, virtualizeDiscreteRanges as br, ISheetClipboardService as yr, SheetPrintInterceptorService as Or, getCurrentRangeDisable$ as Tr, SetZoomRatioOperation as Er } from "@univerjs/sheets-ui";
10
+ import { ISidebarService as Pr, IUIPartsService as Ur, BuiltInUIPart as Ar, ILocalFileService as Nr, IMessageService as jr, MenuItemType as _t, getMenuHiddenObservable as Ht, RibbonStartGroup as Wr, KeyCode as ge, ComponentManager as xr, IMenuManagerService as $r, IShortcutService as Br, CanvasFloatDomService as Lr } from "@univerjs/ui";
11
+ import { takeUntil as Nt, combineLatest as Te, map as Be, filter as se, distinctUntilChanged as Ee, Subject as it, take as Gr, BehaviorSubject as Fr, switchMap as jt } from "rxjs";
12
+ import { SheetInterceptorService as qe, getSheetCommandTarget as H, SheetsSelectionsService as Yt, SetRangeValuesCommand as Vr, SetWorksheetRowHeightMutation as Xt, SetWorksheetColWidthMutation as zt, SetWorksheetRowIsAutoHeightMutation as kr, SetWorksheetRowAutoHeightMutation as Hr, AddWorksheetMergeMutation as Yr, RemoveWorksheetMergeMutation as Xr, AFTER_CELL_EDIT as zr, INTERCEPTOR_POINT as Kr, InterceptCellContentPriority as Jr, WorkbookViewPermission as Wt, WorksheetViewPermission as st, WorkbookEditablePermission as ut, WorksheetEditPermission as xe, InsertRowCommand as Kt, InsertColCommand as Jt, RemoveRowCommand as qt, RemoveColCommand as Zt, DeleteRangeMoveLeftCommand as Qt, DeleteRangeMoveUpCommand as en, InsertRangeMoveDownCommand as tn, InsertRangeMoveRightCommand as nn, DeltaRowHeightCommand as ht, SetRowHeightCommand as gt, DeltaColumnWidthCommand as rn, SetColWidthCommand as sn, SetRowHiddenCommand as on, SetSpecificRowsVisibleCommand as an, SetSpecificColsVisibleCommand as cn, SetColHiddenCommand as dn, MoveColsCommand as ln, MoveRowsCommand as un, MoveRangeCommand as hn, SetRowVisibleMutation as qr, SetRowHiddenMutation as Zr, SetColVisibleMutation as Qr, SetColHiddenMutation as ei, SetWorksheetActiveOperation as ti, RangeProtectionPermissionEditPoint as ni, SetFrozenMutation as ri } from "@univerjs/sheets";
13
+ import gn, { useEffect as vt, forwardRef as mn, useRef as ii, createElement as fn, useState as mt } from "react";
14
+ import { DocDrawingController as si } from "@univerjs/docs-drawing";
15
+ import { docDrawingPositionToTransform as oi, ReplaceSnapshotCommand as ai } from "@univerjs/docs-ui";
16
+ import { MessageType as oe, RadioGroup as ci, Radio as ot } from "@univerjs/design";
17
+ const di = "sheets-drawing-ui.config", li = {}, W = {
16
18
  id: "sheet.operation.clear-drawing-transformer",
17
- type: H.MUTATION,
19
+ type: Y.MUTATION,
18
20
  handler: (i, e) => {
19
- const n = i.get(J);
21
+ const n = i.get(X);
20
22
  return e.forEach((t) => {
21
23
  var r, s;
22
24
  (s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
23
25
  }), !0;
24
26
  }
25
- }, Ge = {
27
+ }, Ze = {
26
28
  id: "sheet.command.remove-sheet-image",
27
- type: H.COMMAND,
29
+ type: Y.COMMAND,
28
30
  handler: (i, e) => {
29
- var S, v, R;
30
- const n = i.get(B), t = i.get(ue), r = i.get(at), s = i.get(F);
31
+ var I, S, R;
32
+ const n = i.get(G), t = i.get(me), r = i.get(qe), s = i.get(z);
31
33
  if (!e) return !1;
32
34
  const { drawings: o } = e, d = [];
33
35
  o.forEach((_) => {
34
- const { unitId: I } = _;
35
- d.push(I);
36
+ const { unitId: C } = _;
37
+ d.push(C);
36
38
  });
37
- const l = s.getBatchRemoveOp(o), { unitId: g, subUnitId: c, undo: a, redo: h, objects: u } = l, m = r.onCommandExecute({ id: Ge.id, params: e }), f = { id: P.id, params: { unitId: g, subUnitId: c, op: h, objects: u, type: T.REMOVE } }, p = { id: P.id, params: { unitId: g, subUnitId: c, op: a, objects: u, type: T.INSERT } };
38
- return It([...(S = m.preRedos) != null ? S : [], f, ...m.redos], n) ? (t.pushUndoRedo({
39
+ const l = s.getBatchRemoveOp(o), { unitId: g, subUnitId: c, undo: a, redo: h, objects: u } = l, m = r.onCommandExecute({ id: Ze.id, params: e }), f = { id: T.id, params: { unitId: g, subUnitId: c, op: h, objects: u, type: E.REMOVE } }, p = { id: T.id, params: { unitId: g, subUnitId: c, op: a, objects: u, type: E.INSERT } };
40
+ return Lt([...(I = m.preRedos) != null ? I : [], f, ...m.redos], n) ? (t.pushUndoRedo({
39
41
  unitID: g,
40
42
  undoMutations: [
41
- ...(v = m.preUndos) != null ? v : [],
43
+ ...(S = m.preUndos) != null ? S : [],
42
44
  p,
43
45
  ...m.undos,
44
- { id: j.id, params: d }
46
+ { id: W.id, params: d }
45
47
  ],
46
48
  redoMutations: [
47
49
  ...(R = m.preRedos) != null ? R : [],
48
50
  f,
49
51
  ...m.redos,
50
- { id: j.id, params: d }
52
+ { id: W.id, params: d }
51
53
  ]
52
54
  }), !0) : !1;
53
55
  }
54
- }, zt = "COMPONENT_SHEET_DRAWING_PANEL", Kt = {
56
+ }, pn = "COMPONENT_SHEET_DRAWING_PANEL", wn = {
55
57
  id: "sidebar.operation.sheet-image",
56
- type: H.COMMAND,
58
+ type: Y.COMMAND,
57
59
  handler: async (i, e) => {
58
- const n = i.get(ir), t = i.get(Be), r = i.get(fe), s = i.get(K);
59
- if (!ce(r)) return !1;
60
+ const n = i.get(Pr), t = i.get(Je), r = i.get(fe), s = i.get(q);
61
+ if (!H(r)) return !1;
60
62
  switch (e.value) {
61
63
  case "open":
62
64
  n.open({
63
65
  header: { title: t.t("sheetImage.panel.title") },
64
- children: { label: zt },
66
+ children: { label: pn },
65
67
  onClose: () => {
66
68
  s.focusDrawing(null);
67
69
  },
@@ -75,15 +77,15 @@ const Or = "sheets-drawing-ui.config", Pr = {}, j = {
75
77
  }
76
78
  return !0;
77
79
  }
78
- }, Jt = {
80
+ }, _n = {
79
81
  id: "sheet.operation.edit-sheet-image",
80
- type: H.OPERATION,
82
+ type: Y.OPERATION,
81
83
  handler: (i, e) => {
82
- const n = i.get(K), t = i.get(B);
83
- return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Kt.id, { value: "open" }), !0);
84
+ const n = i.get(q), t = i.get(G);
85
+ return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(wn.id, { value: "open" }), !0);
84
86
  }
85
87
  };
86
- var Zt = { exports: {} }, Ve = {};
88
+ var at = { exports: {} }, pe = {};
87
89
  /**
88
90
  * @license React
89
91
  * react-jsx-runtime.production.min.js
@@ -93,52 +95,58 @@ var Zt = { exports: {} }, Ve = {};
93
95
  * This source code is licensed under the MIT license found in the
94
96
  * LICENSE file in the root directory of this source tree.
95
97
  */
96
- var Tr = Ft, Er = Symbol.for("react.element"), Ur = Symbol.for("react.fragment"), Ar = Object.prototype.hasOwnProperty, Nr = Tr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, jr = { key: !0, ref: !0, __self: !0, __source: !0 };
97
- function qt(i, e, n) {
98
- var t, r = {}, s = null, o = null;
99
- n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
100
- for (t in e) Ar.call(e, t) && !jr.hasOwnProperty(t) && (r[t] = e[t]);
101
- if (i && i.defaultProps) for (t in e = i.defaultProps, e) r[t] === void 0 && (r[t] = e[t]);
102
- return { $$typeof: Er, type: i, key: s, ref: o, props: r, _owner: Nr.current };
98
+ var xt;
99
+ function ui() {
100
+ if (xt) return pe;
101
+ xt = 1;
102
+ var i = gn, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
103
+ function o(d, l, g) {
104
+ var c, a = {}, h = null, u = null;
105
+ g !== void 0 && (h = "" + g), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (u = l.ref);
106
+ for (c in l) t.call(l, c) && !s.hasOwnProperty(c) && (a[c] = l[c]);
107
+ if (d && d.defaultProps) for (c in l = d.defaultProps, l) a[c] === void 0 && (a[c] = l[c]);
108
+ return { $$typeof: e, type: d, key: h, ref: u, props: a, _owner: r.current };
109
+ }
110
+ return pe.Fragment = n, pe.jsx = o, pe.jsxs = o, pe;
103
111
  }
104
- Ve.Fragment = Ur;
105
- Ve.jsx = qt;
106
- Ve.jsxs = qt;
107
- Zt.exports = Ve;
108
- var $ = Zt.exports;
109
- const Wr = "univer-upload-loading", xr = "univer-upload-loading-body", $r = "univer-upload-loading-body-animation", Lr = "univer-UniverCircleAnimation", Br = "univer-upload-loading-body-text", De = {
110
- uploadLoading: Wr,
111
- uploadLoadingBody: xr,
112
- uploadLoadingBodyAnimation: $r,
113
- univerCircleAnimation: Lr,
114
- uploadLoadingBodyText: Br
115
- }, Gr = () => {
116
- const i = ae(Mt), e = ae(Be), [n, t] = Ft.useState(0);
117
- return ct(() => {
112
+ var $t;
113
+ function hi() {
114
+ return $t || ($t = 1, at.exports = ui()), at.exports;
115
+ }
116
+ var $ = hi();
117
+ const gi = "univer-upload-loading", mi = "univer-upload-loading-body", fi = "univer-upload-loading-body-animation", pi = "univer-UniverCircleAnimation", wi = "univer-upload-loading-body-text", Pe = {
118
+ uploadLoading: gi,
119
+ uploadLoadingBody: mi,
120
+ uploadLoadingBodyAnimation: fi,
121
+ univerCircleAnimation: pi,
122
+ uploadLoadingBodyText: wi
123
+ }, _i = () => {
124
+ const i = le(Ft), e = le(Je), [n, t] = gn.useState(0);
125
+ return vt(() => {
118
126
  const r = i.change$.subscribe((s) => {
119
127
  t(s);
120
128
  });
121
129
  return () => {
122
130
  r.unsubscribe();
123
131
  };
124
- }, [i]), /* @__PURE__ */ $.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: De.uploadLoading, children: /* @__PURE__ */ $.jsxs("div", { className: De.uploadLoadingBody, children: [
125
- /* @__PURE__ */ $.jsx("div", { className: De.uploadLoadingBodyAnimation }),
126
- /* @__PURE__ */ $.jsx("div", { className: De.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` })
132
+ }, [i]), /* @__PURE__ */ $.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: Pe.uploadLoading, children: /* @__PURE__ */ $.jsxs("div", { className: Pe.uploadLoadingBody, children: [
133
+ /* @__PURE__ */ $.jsx("div", { className: Pe.uploadLoadingBodyAnimation }),
134
+ /* @__PURE__ */ $.jsx("div", { className: Pe.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` })
127
135
  ] }) });
128
136
  };
129
- var Vr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, Yr = (i, e, n, t) => {
130
- for (var r = t > 1 ? void 0 : t ? kr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
137
+ var vi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, Ii = (i, e, n, t) => {
138
+ for (var r = t > 1 ? void 0 : t ? Si(e, n) : e, s = i.length - 1, o; s >= 0; s--)
131
139
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
132
- return t && r && Vr(e, n, r), r;
133
- }, se = (i, e) => (n, t) => e(n, t, i);
134
- let Ue = class extends pn {
140
+ return t && r && vi(e, n, r), r;
141
+ }, ae = (i, e) => (n, t) => e(n, t, i);
142
+ let Le = class extends Wn {
135
143
  constructor(e, n, t, r, s, o, d) {
136
144
  super();
137
- V(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
145
+ F(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
138
146
  this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = d, this._init();
139
147
  }
140
148
  _init() {
141
- this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(vt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Y.UNIVER_SHEET).pipe(vt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Y.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(or.CONTENT, () => wn(Gr, this._injector));
149
+ this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET).pipe(Nt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(L.UNIVER_SHEET).pipe(Nt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(L.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Ar.CONTENT, () => xn(_i, this._injector));
142
150
  }
143
151
  _dispose(e) {
144
152
  const n = e.getUnitId();
@@ -153,7 +161,7 @@ let Ue = class extends pn {
153
161
  _hasCropObject(e) {
154
162
  const n = e.getAllObjectsByOrder();
155
163
  for (const t of n)
156
- if (t instanceof $n)
164
+ if (t instanceof ur)
157
165
  return !0;
158
166
  return !1;
159
167
  }
@@ -167,9 +175,9 @@ let Ue = class extends pn {
167
175
  return;
168
176
  let r;
169
177
  this.disposeWithMe(
170
- _n(
178
+ $n(
171
179
  t.createControl$.subscribe(() => {
172
- if (this._contextService.setContextValue(me, !0), this._hasCropObject(n))
180
+ if (this._contextService.setContextValue(ve, !0), this._hasCropObject(n))
173
181
  return;
174
182
  const o = t.getSelectedObjectMap();
175
183
  if (o.size > 1) {
@@ -188,7 +196,7 @@ let Ue = class extends pn {
188
196
  r == null || r.dispose();
189
197
  const f = this._canvasPopManagerService.getFeatureMenu(c, a, h, u);
190
198
  r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(d, {
191
- componentKey: Ln,
199
+ componentKey: hr,
192
200
  direction: "horizontal",
193
201
  offset: [2, 0],
194
202
  extraProps: {
@@ -203,7 +211,7 @@ let Ue = class extends pn {
203
211
  )
204
212
  ), this.disposeWithMe(
205
213
  t.clearControl$.subscribe(() => {
206
- r == null || r.dispose(), this._contextService.setContextValue(me, !1), this._drawingManagerService.focusDrawing(null);
214
+ r == null || r.dispose(), this._contextService.setContextValue(ve, !1), this._drawingManagerService.focusDrawing(null);
207
215
  })
208
216
  ), this.disposeWithMe(
209
217
  t.changing$.subscribe(() => {
@@ -216,53 +224,53 @@ let Ue = class extends pn {
216
224
  {
217
225
  label: "image-popup.edit",
218
226
  index: 0,
219
- commandId: Jt.id,
227
+ commandId: _n.id,
220
228
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
221
- disable: r === k.DRAWING_DOM
229
+ disable: r === V.DRAWING_DOM
222
230
  },
223
231
  {
224
232
  label: "image-popup.delete",
225
233
  index: 1,
226
- commandId: Ge.id,
234
+ commandId: Ze.id,
227
235
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
228
236
  disable: !1
229
237
  },
230
238
  {
231
239
  label: "image-popup.crop",
232
240
  index: 2,
233
- commandId: Bn.id,
241
+ commandId: gr.id,
234
242
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
235
- disable: r === k.DRAWING_DOM
243
+ disable: r === V.DRAWING_DOM
236
244
  },
237
245
  {
238
246
  label: "image-popup.reset",
239
247
  index: 3,
240
- commandId: Gn.id,
248
+ commandId: mr.id,
241
249
  commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
242
- disable: r === k.DRAWING_DOM
250
+ disable: r === V.DRAWING_DOM
243
251
  }
244
252
  ];
245
253
  }
246
254
  };
247
- Ue = Yr([
248
- se(0, W(Rt)),
249
- se(1, K),
250
- se(2, W(Zn)),
251
- se(3, J),
252
- se(4, fe),
253
- se(5, Dt),
254
- se(6, W(sr))
255
- ], Ue);
256
- function L(i, e, n) {
257
- const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: d = 0, skewX: l = 0, skewY: g = 0 } = i, { column: c, columnOffset: a, row: h, rowOffset: u } = t, { column: m, columnOffset: f, row: p, rowOffset: C } = r, S = n.getCurrentSkeleton(), v = Te(S, {
255
+ Le = Ii([
256
+ ae(0, N(Ie)),
257
+ ae(1, q),
258
+ ae(2, N(Cr)),
259
+ ae(3, X),
260
+ ae(4, fe),
261
+ ae(5, Gt),
262
+ ae(6, N(Ur))
263
+ ], Le);
264
+ function B(i, e, n) {
265
+ const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: d = 0, skewX: l = 0, skewY: g = 0 } = i, { column: c, columnOffset: a, row: h, rowOffset: u } = t, { column: m, columnOffset: f, row: p, rowOffset: v } = r, I = n.getCurrentSkeleton(), S = $e(I, {
258
266
  startColumn: c,
259
267
  endColumn: c,
260
268
  startRow: h,
261
269
  endRow: h
262
270
  });
263
- if (v == null)
271
+ if (S == null)
264
272
  return;
265
- const R = Te(S, {
273
+ const R = $e(I, {
266
274
  startColumn: m,
267
275
  endColumn: m,
268
276
  startRow: p,
@@ -270,11 +278,11 @@ function L(i, e, n) {
270
278
  });
271
279
  if (R == null)
272
280
  return;
273
- const { startX: _, startY: I } = v, { startX: w, startY: O } = R;
274
- let b = ne(_ + a, 1), A = ne(I + u, 1), E = ne(w + f - b, 1), M = ne(O + C - A, 1);
275
- v.startX === R.endX && (E = 0), v.startY === R.endY && (M = 0);
276
- const D = S.rowHeaderWidth + S.columnTotalWidth, U = S.columnHeaderHeight + S.rowTotalHeight;
277
- return b + E > D && (b = D - E), A + M > U && (A = U - M), {
281
+ const { startX: _, startY: C } = S, { startX: w, startY: O } = R;
282
+ let b = ie(_ + a, 1), A = ie(C + u, 1), P = ie(w + f - b, 1), D = ie(O + v - A, 1);
283
+ S.startX === R.endX && (P = 0), S.startY === R.endY && (D = 0);
284
+ const M = I.rowHeaderWidth + I.columnTotalWidth, U = I.columnHeaderHeight + I.rowTotalHeight;
285
+ return b + P > M && (b = M - P), A + D > U && (A = U - D), {
278
286
  flipY: s,
279
287
  flipX: o,
280
288
  angle: d,
@@ -282,27 +290,27 @@ function L(i, e, n) {
282
290
  skewY: g,
283
291
  left: b,
284
292
  top: A,
285
- width: E,
286
- height: M
293
+ width: P,
294
+ height: D
287
295
  };
288
296
  }
289
- function N(i, e) {
297
+ function j(i, e) {
290
298
  const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: d = !1, angle: l = 0, skewX: g = 0, skewY: c = 0 } = i, a = e.getCellWithCoordByOffset(n, t);
291
299
  if (a == null)
292
300
  return;
293
301
  const h = {
294
302
  column: a.actualColumn,
295
- columnOffset: ne(n - a.startX, 1),
303
+ columnOffset: ie(n - a.startX, 1),
296
304
  row: a.actualRow,
297
- rowOffset: ne(t - a.startY, 1)
305
+ rowOffset: ie(t - a.startY, 1)
298
306
  }, u = e.getCellWithCoordByOffset(n + r, t + s);
299
307
  if (u == null)
300
308
  return;
301
309
  const m = {
302
310
  column: u.actualColumn,
303
- columnOffset: ne(n + r - u.startX, 1),
311
+ columnOffset: ie(n + r - u.startX, 1),
304
312
  row: u.actualRow,
305
- rowOffset: ne(t + s - u.startY, 1)
313
+ rowOffset: ie(t + s - u.startY, 1)
306
314
  };
307
315
  return {
308
316
  flipY: o,
@@ -314,12 +322,12 @@ function N(i, e) {
314
322
  to: m
315
323
  };
316
324
  }
317
- var Fr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, Hr = (i, e, n, t) => {
318
- for (var r = t > 1 ? void 0 : t ? Xr(e, n) : e, s = i.length - 1, o; s >= 0; s--)
325
+ var Ci = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Mi = (i, e, n, t) => {
326
+ for (var r = t > 1 ? void 0 : t ? Ri(e, n) : e, s = i.length - 1, o; s >= 0; s--)
319
327
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
320
- return t && r && Fr(e, n, r), r;
321
- }, Me = (i, e) => (n, t) => e(n, t, i);
322
- let st = class extends ie {
328
+ return t && r && Ci(e, n, r), r;
329
+ }, Ue = (i, e) => (n, t) => e(n, t, i);
330
+ let ft = class extends Z {
323
331
  constructor(i, e, n, t, r) {
324
332
  super(), this._context = i, this._sheetDrawingService = e, this._drawingManagerService = n, this._sheetSelectionRenderService = t, this._sheetSkeletonManagerService = r, this._init();
325
333
  }
@@ -333,95 +341,22 @@ let st = class extends ie {
333
341
  const n = i[e];
334
342
  for (const t in n.data) {
335
343
  const r = n.data[t];
336
- r.transform = L(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
344
+ r.transform = B(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
337
345
  }
338
346
  }
339
347
  this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
340
348
  }
341
349
  };
342
- st = Hr([
343
- Me(1, F),
344
- Me(2, K),
345
- Me(3, W(pe)),
346
- Me(4, W(q))
347
- ], st);
348
- var X = function() {
349
- return X = Object.assign || function(i) {
350
- for (var e, n = 1, t = arguments.length; n < t; n++) {
351
- e = arguments[n];
352
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
353
- }
354
- return i;
355
- }, X.apply(this, arguments);
356
- }, zr = function(i, e) {
357
- var n = {};
358
- for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
359
- if (i != null && typeof Object.getOwnPropertySymbols == "function")
360
- for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
361
- e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
362
- return n;
363
- }, Qt = Xt(function(i, e) {
364
- var n = i.icon, t = i.id, r = i.className, s = i.extend, o = zr(i, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = br("_".concat(Zr()));
365
- return en(n, "".concat(t), { defIds: n.defIds, idSuffix: l.current }, X({ ref: e, className: d }, o), s);
366
- });
367
- function en(i, e, n, t, r) {
368
- return Ht(i.tag, X(X({ key: e }, Kr(i, n, r)), t), (Jr(i, n).children || []).map(function(s, o) {
369
- return en(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
370
- }));
371
- }
372
- function Kr(i, e, n) {
373
- var t = X({}, i.attrs);
374
- n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
375
- var r = e.defIds;
376
- return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
377
- var o = s[0], d = s[1];
378
- typeof d == "string" && (t[o] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
379
- })), t;
380
- }
381
- function Jr(i, e) {
382
- var n, t = e.defIds;
383
- return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? X(X({}, i), { children: i.children.map(function(r) {
384
- return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? X(X({}, r), { attrs: X(X({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
385
- }) }) : i;
386
- }
387
- function Zr() {
388
- return Math.random().toString(36).substring(2, 8);
389
- }
390
- Qt.displayName = "UniverIcon";
391
- var qr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, tn = Xt(function(i, e) {
392
- return Ht(Qt, Object.assign({}, i, {
393
- id: "add-image-single",
394
- ref: e,
395
- icon: qr
396
- }));
397
- });
398
- tn.displayName = "AddImageSingle";
399
- const nn = {
400
- id: "sheet.command.delete-drawing",
401
- type: H.COMMAND,
402
- handler: (i) => {
403
- const e = i.get(B), t = i.get(F).getFocusDrawings();
404
- if (t.length === 0)
405
- return !1;
406
- const r = t[0].unitId, s = t.map((o) => {
407
- const { unitId: d, subUnitId: l, drawingId: g, drawingType: c } = o;
408
- return {
409
- unitId: d,
410
- subUnitId: l,
411
- drawingId: g,
412
- drawingType: c
413
- };
414
- });
415
- return e.executeCommand(Ge.id, {
416
- unitId: r,
417
- drawings: s
418
- });
419
- }
420
- };
421
- function Qr(i) {
350
+ ft = Mi([
351
+ Ue(1, z),
352
+ Ue(2, q),
353
+ Ue(3, N(Ce)),
354
+ Ue(4, N(Q))
355
+ ], ft);
356
+ function Di(i) {
422
357
  const e = [];
423
358
  return i.forEach((n) => {
424
- const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: d } = t, l = Fn(0, 0, r.map((a) => a.transform || {})), g = r.map((a) => {
359
+ const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: d } = t, l = wr(0, 0, r.map((a) => a.transform || {})), g = r.map((a) => {
425
360
  const h = a.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: m, drawingId: f } = a;
426
361
  return {
427
362
  unitId: u,
@@ -438,7 +373,7 @@ function Qr(i) {
438
373
  unitId: s,
439
374
  subUnitId: o,
440
375
  drawingId: d,
441
- drawingType: k.DRAWING_GROUP,
376
+ drawingType: V.DRAWING_GROUP,
442
377
  transform: l
443
378
  };
444
379
  e.push({
@@ -447,14 +382,14 @@ function Qr(i) {
447
382
  });
448
383
  }), e;
449
384
  }
450
- function ei(i) {
385
+ function bi(i) {
451
386
  const e = [];
452
387
  return i.forEach((n) => {
453
388
  const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: d, transform: l = { width: 0, height: 0 } } = t;
454
389
  if (l == null)
455
390
  return;
456
391
  const g = r.map((a) => {
457
- const { transform: h } = a, { unitId: u, subUnitId: m, drawingId: f } = a, p = Xn(h || {}, l, l.width || 0, l.height || 0);
392
+ const { transform: h } = a, { unitId: u, subUnitId: m, drawingId: f } = a, p = _r(h || {}, l, l.width || 0, l.height || 0);
458
393
  return {
459
394
  unitId: u,
460
395
  subUnitId: m,
@@ -466,7 +401,7 @@ function ei(i) {
466
401
  unitId: s,
467
402
  subUnitId: o,
468
403
  drawingId: d,
469
- drawingType: k.DRAWING_GROUP,
404
+ drawingType: V.DRAWING_GROUP,
470
405
  transform: {
471
406
  left: 0,
472
407
  top: 0
@@ -478,11 +413,11 @@ function ei(i) {
478
413
  });
479
414
  }), e;
480
415
  }
481
- const rn = {
416
+ const vn = {
482
417
  id: "sheet.command.group-sheet-image",
483
- type: H.COMMAND,
418
+ type: Y.COMMAND,
484
419
  handler: (i, e) => {
485
- const n = i.get(B), t = i.get(ue), r = i.get(F);
420
+ const n = i.get(G), t = i.get(me), r = i.get(z);
486
421
  if (!e) return !1;
487
422
  const s = [];
488
423
  e.forEach(({ parent: u, children: m }) => {
@@ -491,87 +426,87 @@ const rn = {
491
426
  });
492
427
  });
493
428
  const o = r.getGroupDrawingOp(e), { unitId: d, subUnitId: l, undo: g, redo: c, objects: a } = o;
494
- return n.syncExecuteCommand(P.id, { op: c, unitId: d, subUnitId: l, objects: a, type: T.GROUP }) ? (t.pushUndoRedo({
429
+ return n.syncExecuteCommand(T.id, { op: c, unitId: d, subUnitId: l, objects: a, type: E.GROUP }) ? (t.pushUndoRedo({
495
430
  unitID: d,
496
431
  undoMutations: [
497
- { id: P.id, params: { op: g, unitId: d, subUnitId: l, objects: ei(a), type: T.UNGROUP } },
498
- { id: j.id, params: s }
432
+ { id: T.id, params: { op: g, unitId: d, subUnitId: l, objects: bi(a), type: E.UNGROUP } },
433
+ { id: W.id, params: s }
499
434
  ],
500
435
  redoMutations: [
501
- { id: P.id, params: { op: c, unitId: d, subUnitId: l, objects: a, type: T.GROUP } },
502
- { id: j.id, params: s }
436
+ { id: T.id, params: { op: c, unitId: d, subUnitId: l, objects: a, type: E.GROUP } },
437
+ { id: W.id, params: s }
503
438
  ]
504
439
  }), !0) : !1;
505
440
  }
506
- }, ke = {
441
+ }, Qe = {
507
442
  id: "sheet.command.insert-sheet-image",
508
- type: H.COMMAND,
443
+ type: Y.COMMAND,
509
444
  handler: (i, e) => {
510
- var S, v, R;
511
- const n = i.get(B), t = i.get(ue), r = i.get(F), s = i.get(at);
445
+ var I, S, R;
446
+ const n = i.get(G), t = i.get(me), r = i.get(z), s = i.get(qe);
512
447
  if (!e) return !1;
513
- const o = e.drawings, d = o.map((_) => _.unitId), l = r.getBatchAddOp(o), { unitId: g, subUnitId: c, undo: a, redo: h, objects: u } = l, m = s.onCommandExecute({ id: ke.id, params: e }), f = { id: P.id, params: { op: h, unitId: g, subUnitId: c, objects: u, type: T.INSERT } }, p = { id: P.id, params: { op: a, unitId: g, subUnitId: c, objects: u, type: T.REMOVE } };
514
- return It([...(S = m.preRedos) != null ? S : [], f, ...m.redos], n) ? (t.pushUndoRedo({
448
+ const o = e.drawings, d = o.map((_) => _.unitId), l = r.getBatchAddOp(o), { unitId: g, subUnitId: c, undo: a, redo: h, objects: u } = l, m = s.onCommandExecute({ id: Qe.id, params: e }), f = { id: T.id, params: { op: h, unitId: g, subUnitId: c, objects: u, type: E.INSERT } }, p = { id: T.id, params: { op: a, unitId: g, subUnitId: c, objects: u, type: E.REMOVE } };
449
+ return Lt([...(I = m.preRedos) != null ? I : [], f, ...m.redos], n) ? (t.pushUndoRedo({
515
450
  unitID: g,
516
451
  undoMutations: [
517
- ...(v = m.preUndos) != null ? v : [],
452
+ ...(S = m.preUndos) != null ? S : [],
518
453
  p,
519
454
  ...m.undos,
520
- { id: j.id, params: d }
455
+ { id: W.id, params: d }
521
456
  ],
522
457
  redoMutations: [
523
458
  ...(R = m.preRedos) != null ? R : [],
524
459
  f,
525
460
  ...m.redos,
526
- { id: j.id, params: d }
461
+ { id: W.id, params: d }
527
462
  ]
528
463
  }), !0) : !1;
529
464
  }
530
- }, sn = {
465
+ }, Sn = {
531
466
  id: "sheet.command.set-drawing-arrange",
532
- type: H.COMMAND,
467
+ type: Y.COMMAND,
533
468
  handler: (i, e) => {
534
- const n = i.get(B), t = i.get(ue);
469
+ const n = i.get(G), t = i.get(me);
535
470
  if (!e) return !1;
536
- const r = i.get(F), { unitId: s, subUnitId: o, drawingIds: d, arrangeType: l } = e, g = { unitId: s, subUnitId: o, drawingIds: d };
471
+ const r = i.get(z), { unitId: s, subUnitId: o, drawingIds: d, arrangeType: l } = e, g = { unitId: s, subUnitId: o, drawingIds: d };
537
472
  let c;
538
- if (l === ve.forward ? c = r.getForwardDrawingsOp(g) : l === ve.backward ? c = r.getBackwardDrawingOp(g) : l === ve.front ? c = r.getFrontDrawingsOp(g) : l === ve.back && (c = r.getBackDrawingsOp(g)), c == null)
473
+ if (l === De.forward ? c = r.getForwardDrawingsOp(g) : l === De.backward ? c = r.getBackwardDrawingOp(g) : l === De.front ? c = r.getFrontDrawingsOp(g) : l === De.back && (c = r.getBackDrawingsOp(g)), c == null)
539
474
  return !1;
540
475
  const { objects: a, redo: h, undo: u } = c;
541
- return n.syncExecuteCommand(P.id, { op: h, unitId: s, subUnitId: o, objects: a, type: T.ARRANGE }) ? (t.pushUndoRedo({
476
+ return n.syncExecuteCommand(T.id, { op: h, unitId: s, subUnitId: o, objects: a, type: E.ARRANGE }) ? (t.pushUndoRedo({
542
477
  unitID: s,
543
478
  undoMutations: [
544
- { id: P.id, params: { op: u, unitId: s, subUnitId: o, objects: a, type: T.ARRANGE } }
479
+ { id: T.id, params: { op: u, unitId: s, subUnitId: o, objects: a, type: E.ARRANGE } }
545
480
  ],
546
481
  redoMutations: [
547
- { id: P.id, params: { op: h, unitId: s, subUnitId: o, objects: a, type: T.ARRANGE } }
482
+ { id: T.id, params: { op: h, unitId: s, subUnitId: o, objects: a, type: E.ARRANGE } }
548
483
  ]
549
484
  }), !0) : !1;
550
485
  }
551
- }, Ye = {
486
+ }, et = {
552
487
  id: "sheet.command.set-sheet-image",
553
- type: H.COMMAND,
488
+ type: Y.COMMAND,
554
489
  handler: (i, e) => {
555
- const n = i.get(B), t = i.get(ue), r = i.get(F);
490
+ const n = i.get(G), t = i.get(me), r = i.get(z);
556
491
  if (!e) return !1;
557
492
  const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: d, subUnitId: l, undo: g, redo: c, objects: a } = o;
558
- return n.syncExecuteCommand(P.id, { unitId: d, subUnitId: l, op: c, objects: a, type: T.UPDATE }) ? (t.pushUndoRedo({
493
+ return n.syncExecuteCommand(T.id, { unitId: d, subUnitId: l, op: c, objects: a, type: E.UPDATE }) ? (t.pushUndoRedo({
559
494
  unitID: d,
560
495
  undoMutations: [
561
- { id: P.id, params: { unitId: d, subUnitId: l, op: g, objects: a, type: T.UPDATE } },
562
- { id: j.id, params: [d] }
496
+ { id: T.id, params: { unitId: d, subUnitId: l, op: g, objects: a, type: E.UPDATE } },
497
+ { id: W.id, params: [d] }
563
498
  ],
564
499
  redoMutations: [
565
- { id: P.id, params: { unitId: d, subUnitId: l, op: c, objects: a, type: T.UPDATE } },
566
- { id: j.id, params: [d] }
500
+ { id: T.id, params: { unitId: d, subUnitId: l, op: c, objects: a, type: E.UPDATE } },
501
+ { id: W.id, params: [d] }
567
502
  ]
568
503
  }), !0) : !1;
569
504
  }
570
- }, on = {
505
+ }, In = {
571
506
  id: "sheet.command.ungroup-sheet-image",
572
- type: H.COMMAND,
507
+ type: Y.COMMAND,
573
508
  handler: (i, e) => {
574
- const n = i.get(B), t = i.get(ue), r = i.get(F);
509
+ const n = i.get(G), t = i.get(me), r = i.get(z);
575
510
  if (!e) return !1;
576
511
  const s = [];
577
512
  e.forEach(({ parent: u, children: m }) => {
@@ -580,84 +515,201 @@ const rn = {
580
515
  });
581
516
  });
582
517
  const o = r.getUngroupDrawingOp(e), { unitId: d, subUnitId: l, undo: g, redo: c, objects: a } = o;
583
- return n.syncExecuteCommand(P.id, { op: c, unitId: d, subUnitId: l, objects: a, type: T.UNGROUP }) ? (t.pushUndoRedo({
518
+ return n.syncExecuteCommand(T.id, { op: c, unitId: d, subUnitId: l, objects: a, type: E.UNGROUP }) ? (t.pushUndoRedo({
584
519
  unitID: d,
585
520
  undoMutations: [
586
- { id: P.id, params: { op: g, unitId: d, subUnitId: l, objects: Qr(a), type: T.GROUP } },
587
- { id: j.id, params: s }
521
+ { id: T.id, params: { op: g, unitId: d, subUnitId: l, objects: Di(a), type: E.GROUP } },
522
+ { id: W.id, params: s }
588
523
  ],
589
524
  redoMutations: [
590
- { id: P.id, params: { op: c, unitId: d, subUnitId: l, objects: a, type: T.UNGROUP } },
591
- { id: j.id, params: s }
525
+ { id: T.id, params: { op: c, unitId: d, subUnitId: l, objects: a, type: E.UNGROUP } },
526
+ { id: W.id, params: s }
592
527
  ]
593
528
  }), !0) : !1;
594
529
  }
595
530
  };
596
- var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (i, e, n, t) => {
597
- for (var r = t > 1 ? void 0 : t ? ni(e, n) : e, s = i.length - 1, o; s >= 0; s--)
531
+ var yi = Object.defineProperty, Oi = Object.getOwnPropertyDescriptor, Ti = (i, e, n, t) => {
532
+ for (var r = t > 1 ? void 0 : t ? Oi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
598
533
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
599
- return t && r && ti(e, n, r), r;
600
- }, z = (i, e) => (n, t) => e(n, t, i);
601
- let Ae = class extends ie {
602
- constructor(e, n, t, r, s, o, d, l, g, c, a, h) {
534
+ return t && r && yi(e, n, r), r;
535
+ }, K = (i, e) => (n, t) => e(n, t, i);
536
+ function Ei(i, e, n) {
537
+ const t = n * Math.PI / 180, r = Math.abs(i * Math.cos(t)) + Math.abs(e * Math.sin(t)), s = Math.abs(i * Math.sin(t)) + Math.abs(e * Math.cos(t));
538
+ return { rotatedWidth: r, rotatedHeight: s };
539
+ }
540
+ function Cn(i, e, n, t, r) {
541
+ var I;
542
+ const { rotatedHeight: s, rotatedWidth: o } = Ei(n, t, r), l = i.get(X).getRenderById(e.unitId);
543
+ if (!l)
544
+ return !1;
545
+ const c = (I = l.with(Q).getWorksheetSkeleton(e.subUnitId)) == null ? void 0 : I.skeleton;
546
+ if (c == null)
547
+ return !1;
548
+ const a = c.getCellByIndex(e.row, e.col), h = a.mergeInfo.endX - a.mergeInfo.startX - 2, u = a.mergeInfo.endY - a.mergeInfo.startY - 2, m = o / s, p = Math.ceil(Math.min(h, u * m)) / o, v = !p || Number.isNaN(p) ? 1e-3 : p;
549
+ return {
550
+ width: n * v,
551
+ height: t * v
552
+ };
553
+ }
554
+ let Se = class extends Z {
555
+ constructor(e, n, t, r, s, o, d, l, g, c, a, h, u) {
603
556
  super();
604
- V(this, "_workbookSelections");
605
- this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = d, this._drawingManagerService = l, this._contextService = g, this._messageService = c, this._localeService = a, this._workbookSelections = h.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
557
+ F(this, "_workbookSelections");
558
+ this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = d, this._drawingManagerService = l, this._contextService = g, this._messageService = c, this._localeService = a, this._injector = u, this._workbookSelections = h.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
606
559
  }
607
560
  async insertFloatImage() {
608
561
  const e = await this._fileOpenerService.openFile({
609
562
  multiple: !0,
610
- accept: Nn.map((t) => `.${t.replace("image/", "")}`).join(",")
563
+ accept: bt.map((t) => `.${t.replace("image/", "")}`).join(",")
611
564
  }), n = e.length;
612
- return n > mt ? (this._messageService.show({
613
- type: Re.Error,
614
- content: this._localeService.t("update-status.exceedMaxCount", String(mt))
565
+ return n > yt ? (this._messageService.show({
566
+ type: oe.Error,
567
+ content: this._localeService.t("update-status.exceedMaxCount", String(yt))
615
568
  }), !1) : n === 0 ? !1 : (e.forEach(async (t) => await this._insertFloatImage(t)), !0);
616
569
  }
570
+ async insertCellImage() {
571
+ const n = (await this._fileOpenerService.openFile({
572
+ multiple: !1,
573
+ accept: bt.map((t) => `.${t.replace("image/", "")}`).join(",")
574
+ }))[0];
575
+ return n ? (await this._insertCellImage(n), !0) : !1;
576
+ }
617
577
  async _insertFloatImage(e) {
618
578
  let n;
619
579
  try {
620
580
  n = await this._imageIoService.saveImage(e);
621
- } catch (S) {
622
- const v = S.message;
623
- v === He.ERROR_EXCEED_SIZE ? this._messageService.show({
624
- type: Re.Error,
625
- content: this._localeService.t("update-status.exceedMaxSize", String(jn / (1024 * 1024)))
626
- }) : v === He.ERROR_IMAGE_TYPE ? this._messageService.show({
627
- type: Re.Error,
581
+ } catch (I) {
582
+ const S = I.message;
583
+ S === ue.ERROR_EXCEED_SIZE ? this._messageService.show({
584
+ type: oe.Error,
585
+ content: this._localeService.t("update-status.exceedMaxSize", String(Ot / (1024 * 1024)))
586
+ }) : S === ue.ERROR_IMAGE_TYPE ? this._messageService.show({
587
+ type: oe.Error,
628
588
  content: this._localeService.t("update-status.invalidImageType")
629
- }) : v === He.ERROR_IMAGE && this._messageService.show({
630
- type: Re.Error,
589
+ }) : S === ue.ERROR_IMAGE && this._messageService.show({
590
+ type: oe.Error,
631
591
  content: this._localeService.t("update-status.invalidImage")
632
592
  });
633
593
  }
634
594
  if (n == null)
635
595
  return;
636
- const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: d, source: l, base64Cache: g } = n, { width: c, height: a, image: h } = await Wn(g || ""), { width: u, height: m } = this._context.scene;
596
+ const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: d, source: l, base64Cache: g } = n, { width: c, height: a, image: h } = await Tt(g || ""), { width: u, height: m } = this._context.scene;
637
597
  this._imageIoService.addImageSourceCache(l, d, h);
638
598
  let f = 1;
639
- if (c > ft || a > pt) {
640
- const S = ft / c, v = pt / a;
641
- f = Math.max(S, v);
599
+ if (c > Et || a > Pt) {
600
+ const I = Et / c, S = Pt / a;
601
+ f = Math.max(I, S);
642
602
  }
643
603
  const p = this._getImagePosition(c * f, a * f, u, m);
644
604
  if (p == null)
645
605
  return;
646
- const C = {
606
+ const v = {
647
607
  unitId: r,
648
608
  subUnitId: s,
649
609
  drawingId: o,
650
- drawingType: k.DRAWING_IMAGE,
610
+ drawingType: V.DRAWING_IMAGE,
651
611
  imageSourceType: d,
652
612
  source: l,
653
- transform: L(p, this._selectionRenderService, this._skeletonManagerService),
613
+ transform: B(p, this._selectionRenderService, this._skeletonManagerService),
654
614
  sheetTransform: p
655
615
  };
656
- this._commandService.executeCommand(ke.id, {
616
+ this._commandService.executeCommand(Qe.id, {
657
617
  unitId: r,
658
- drawings: [C]
618
+ drawings: [v]
659
619
  });
660
620
  }
621
+ // eslint-disable-next-line max-lines-per-function
622
+ async _insertCellImage(e) {
623
+ let n;
624
+ try {
625
+ n = await this._imageIoService.saveImage(e);
626
+ } catch (p) {
627
+ const v = p.message;
628
+ v === ue.ERROR_EXCEED_SIZE ? this._messageService.show({
629
+ type: oe.Error,
630
+ content: this._localeService.t("update-status.exceedMaxSize", String(Ot / (1024 * 1024)))
631
+ }) : v === ue.ERROR_IMAGE_TYPE ? this._messageService.show({
632
+ type: oe.Error,
633
+ content: this._localeService.t("update-status.invalidImageType")
634
+ }) : v === ue.ERROR_IMAGE && this._messageService.show({
635
+ type: oe.Error,
636
+ content: this._localeService.t("update-status.invalidImage")
637
+ });
638
+ }
639
+ if (n == null)
640
+ return;
641
+ const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width: d, height: l, image: g } = await Tt(o || "");
642
+ this._imageIoService.addImageSourceCache(s, r, g);
643
+ const c = this._workbookSelections.getCurrentLastSelection();
644
+ if (!c)
645
+ return !1;
646
+ const a = Bn("", {}), h = Cn(
647
+ this._injector,
648
+ {
649
+ unitId: this._context.unitId,
650
+ subUnitId: this._context.unit.getActiveSheet().getSheetId(),
651
+ row: c.primary.actualRow,
652
+ col: c.primary.actualColumn
653
+ },
654
+ d,
655
+ l,
656
+ 0
657
+ );
658
+ if (!h)
659
+ return !1;
660
+ const u = {
661
+ size: {
662
+ width: h.width,
663
+ height: h.height
664
+ },
665
+ positionH: {
666
+ relativeFrom: Ln.PAGE,
667
+ posOffset: 0
668
+ },
669
+ positionV: {
670
+ relativeFrom: Gn.PARAGRAPH,
671
+ posOffset: 0
672
+ },
673
+ angle: 0
674
+ }, m = {
675
+ unitId: a.getUnitId(),
676
+ subUnitId: a.getUnitId(),
677
+ drawingId: t,
678
+ drawingType: V.DRAWING_IMAGE,
679
+ imageSourceType: r,
680
+ source: s,
681
+ transform: oi(u),
682
+ docTransform: u,
683
+ behindDoc: Fn.FALSE,
684
+ title: "",
685
+ description: "",
686
+ layoutType: Vn.INLINE,
687
+ // Insert inline drawing by default.
688
+ wrapText: kn.BOTH_SIDES,
689
+ distB: 0,
690
+ distL: 0,
691
+ distR: 0,
692
+ distT: 0
693
+ }, f = Hn.drawing.add({
694
+ documentDataModel: a,
695
+ drawings: [m],
696
+ selection: {
697
+ collapsed: !0,
698
+ startOffset: 0,
699
+ endOffset: 0
700
+ }
701
+ });
702
+ return f ? (a.apply(f), this._commandService.syncExecuteCommand(Vr.id, {
703
+ value: {
704
+ [c.primary.actualRow]: {
705
+ [c.primary.actualColumn]: {
706
+ p: a.getSnapshot(),
707
+ t: 1
708
+ }
709
+ }
710
+ }
711
+ })) : !1;
712
+ }
661
713
  _getUnitInfo() {
662
714
  const e = this._context.unit, n = e.getActiveSheet(), t = e.getUnitId(), r = n.getSheetId();
663
715
  return {
@@ -674,7 +726,7 @@ let Ae = class extends ie {
674
726
  endColumn: 0
675
727
  };
676
728
  s && s.length > 0 && (o = s[s.length - 1].range);
677
- const d = Te(this._skeletonManagerService.getCurrent().skeleton, o);
729
+ const d = $e(this._skeletonManagerService.getCurrent().skeleton, o);
678
730
  if (d == null)
679
731
  return;
680
732
  let { startColumn: l, startRow: g, startX: c, startY: a } = d, h = !1;
@@ -706,7 +758,7 @@ let Ae = class extends ie {
706
758
  _updateOrderListener() {
707
759
  this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((e) => {
708
760
  const { unitId: n, subUnitId: t, drawingIds: r, arrangeType: s } = e;
709
- this._commandService.executeCommand(sn.id, {
761
+ this._commandService.executeCommand(Sn.id, {
710
762
  unitId: n,
711
763
  subUnitId: t,
712
764
  drawingIds: r,
@@ -724,16 +776,16 @@ let Ae = class extends ie {
724
776
  const g = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
725
777
  if (g == null || g.unitId !== this._context.unitId)
726
778
  return;
727
- const c = N({ ...g.transform, ...l }, this._selectionRenderService);
779
+ const c = j({ ...g.transform, ...l }, this._selectionRenderService);
728
780
  if (c == null)
729
781
  return;
730
782
  const a = {
731
783
  ...t,
732
- transform: { ...g.transform, ...l, ...L(c, this._selectionRenderService, this._skeletonManagerService) },
784
+ transform: { ...g.transform, ...l, ...B(c, this._selectionRenderService, this._skeletonManagerService) },
733
785
  sheetTransform: { ...c }
734
786
  };
735
787
  n.push(a);
736
- }), n.length > 0 && this._commandService.executeCommand(Ye.id, {
788
+ }), n.length > 0 && this._commandService.executeCommand(et.id, {
737
789
  unitId: e[0].unitId,
738
790
  drawings: n
739
791
  }));
@@ -741,322 +793,194 @@ let Ae = class extends ie {
741
793
  }
742
794
  _groupDrawingListener() {
743
795
  this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((e) => {
744
- this._commandService.executeCommand(rn.id, e);
796
+ this._commandService.executeCommand(vn.id, e);
745
797
  const { unitId: n, subUnitId: t, drawingId: r } = e[0].parent;
746
798
  this._drawingManagerService.focusDrawing([{ unitId: n, subUnitId: t, drawingId: r }]);
747
799
  })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((e) => {
748
- this._commandService.executeCommand(on.id, e);
800
+ this._commandService.executeCommand(In.id, e);
749
801
  }));
750
802
  }
751
803
  _focusDrawingListener() {
752
804
  this.disposeWithMe(
753
805
  this._drawingManagerService.focus$.subscribe((e) => {
754
- e == null || e.length === 0 ? (this._contextService.setContextValue(me, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(me, !0), this._sheetDrawingService.focusDrawing(e));
806
+ e == null || e.length === 0 ? (this._contextService.setContextValue(ve, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(ve, !0), this._sheetDrawingService.focusDrawing(e));
755
807
  })
756
808
  );
757
809
  }
758
810
  };
759
- Ae = ri([
760
- z(1, W(q)),
761
- z(2, B),
762
- z(3, pe),
763
- z(4, Mt),
764
- z(5, ar),
765
- z(6, F),
766
- z(7, K),
767
- z(8, Dt),
768
- z(9, cr),
769
- z(10, W(Be)),
770
- z(11, W(pr))
771
- ], Ae);
772
- const dt = {
773
- id: "sheet.command.insert-float-image",
774
- type: H.COMMAND,
775
- handler: (i) => {
776
- var n, t;
777
- return (t = (n = i.get(J).getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : n.with(Ae).insertFloatImage()) != null ? t : !1;
778
- }
779
- }, we = {
780
- id: "sheet.command.move-drawing",
781
- type: H.COMMAND,
782
- handler: (i, e) => {
783
- const n = i.get(B), t = i.get(F), r = i.get(pe), { direction: s } = e, o = t.getFocusDrawings();
784
- if (o.length === 0)
785
- return !1;
786
- const d = o[0].unitId, l = o.map((c) => {
787
- const { transform: a } = c;
788
- if (a == null)
789
- return null;
790
- const h = { ...a }, { left: u = 0, top: m = 0 } = a;
791
- return s === te.UP ? h.top = m - 1 : s === te.DOWN ? h.top = m + 1 : s === te.LEFT ? h.left = u - 1 : s === te.RIGHT && (h.left = u + 1), {
792
- ...c,
793
- transform: h,
794
- sheetTransform: N(h, r)
795
- };
796
- }).filter((c) => c != null);
797
- return n.syncExecuteCommand(Ye.id, {
798
- unitId: d,
799
- drawings: l
800
- }) ? (n.syncExecuteCommand(j.id, [d]), !0) : !1;
811
+ Se = Ti([
812
+ K(1, N(Q)),
813
+ K(2, G),
814
+ K(3, Ce),
815
+ K(4, Ft),
816
+ K(5, Nr),
817
+ K(6, z),
818
+ K(7, q),
819
+ K(8, Gt),
820
+ K(9, jr),
821
+ K(10, N(Je)),
822
+ K(11, N(Yt)),
823
+ K(12, N(Ie))
824
+ ], Se);
825
+ var Pi = Object.defineProperty, Ui = Object.getOwnPropertyDescriptor, Ai = (i, e, n, t) => {
826
+ for (var r = t > 1 ? void 0 : t ? Ui(e, n) : e, s = i.length - 1, o; s >= 0; s--)
827
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
828
+ return t && r && Pi(e, n, r), r;
829
+ }, ce = (i, e) => (n, t) => e(n, t, i);
830
+ function pt(i, e, n) {
831
+ var t, r, s, o;
832
+ if (((r = (t = n == null ? void 0 : n.p) == null ? void 0 : t.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = n.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
833
+ const d = n.p.drawings[n.p.drawingsOrder[0]], l = Cn(
834
+ i,
835
+ {
836
+ unitId: e.unitId,
837
+ subUnitId: e.subUnitId,
838
+ row: e.row,
839
+ col: e.col
840
+ },
841
+ d.docTransform.size.width,
842
+ d.docTransform.size.height,
843
+ d.docTransform.angle
844
+ );
845
+ if (l)
846
+ return d.transform.width = l.width, d.transform.height = l.height, d.docTransform.size.width = l.width, d.docTransform.size.height = l.height, d.transform.left = 0, d.transform.top = 0, d.docTransform.positionH.posOffset = 0, d.docTransform.positionV.posOffset = 0, n.p.documentStyle.pageSize.width = 1 / 0, n.p.documentStyle.pageSize.height = 1 / 0, !0;
801
847
  }
802
- }, an = "addition-and-subtraction-single", cn = "sheet.menu.image";
803
- function ii(i) {
804
- return {
805
- id: cn,
806
- type: bt.SUBITEMS,
807
- icon: an,
808
- tooltip: "sheetImage.title",
809
- hidden$: yt(i, Y.UNIVER_SHEET),
810
- disabled$: qn(i, { workbookTypes: [tt], worksheetTypes: [Pe], rangeTypes: [wr] })
811
- };
812
- }
813
- function si(i) {
814
- return {
815
- id: dt.id,
816
- title: "sheetImage.upload.float",
817
- type: bt.BUTTON,
818
- hidden$: yt(i, Y.UNIVER_SHEET)
819
- };
820
- }
821
- const oi = "univer-image-common-panel", ai = "univer-image-common-panel-grid", ci = "univer-image-common-panel-border", di = "univer-image-common-panel-title", li = "univer-image-common-panel-subtitle", ui = "univer-image-common-panel-row", hi = "univer-image-common-panel-row-vertical", gi = "univer-image-common-panel-column", mi = "univer-image-common-panel-column-center", fi = "univer-image-common-panel-inline", pi = "univer-image-common-panel-span2", wi = "univer-image-common-panel-span3", _i = "univer-image-common-panel-input", vi = "univer-sheet-image-menu", Si = "univer-sheet-image-menu-input", ee = {
822
- imageCommonPanel: oi,
823
- imageCommonPanelGrid: ai,
824
- imageCommonPanelBorder: ci,
825
- imageCommonPanelTitle: di,
826
- imageCommonPanelSubtitle: li,
827
- imageCommonPanelRow: ui,
828
- imageCommonPanelRowVertical: hi,
829
- imageCommonPanelColumn: gi,
830
- imageCommonPanelColumnCenter: mi,
831
- imageCommonPanelInline: fi,
832
- imageCommonPanelSpan2: pi,
833
- imageCommonPanelSpan3: wi,
834
- imageCommonPanelInput: _i,
835
- sheetImageMenu: vi,
836
- sheetImageMenuInput: Si
837
- };
838
- function dn(i) {
839
- var e, n, t = "";
840
- if (typeof i == "string" || typeof i == "number") t += i;
841
- else if (typeof i == "object") if (Array.isArray(i)) {
842
- var r = i.length;
843
- for (e = 0; e < r; e++) i[e] && (n = dn(i[e])) && (t && (t += " "), t += n);
844
- } else for (n in i) i[n] && (t && (t += " "), t += n);
845
- return t;
848
+ return !1;
846
849
  }
847
- function be() {
848
- for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = dn(i)) && (t && (t += " "), t += e);
849
- return t;
850
- }
851
- const Ci = (i) => {
852
- var v;
853
- const e = ae(B), n = ae(Be), t = ae(K), r = ae(J), { drawings: s } = i, o = s[0];
854
- if (o == null)
855
- return;
856
- const { unitId: d } = o, l = r.getRenderById(d), g = l == null ? void 0 : l.scene;
857
- if (g == null)
858
- return;
859
- const c = g.getTransformerByCreate(), [a, h] = it(!0), u = (v = o.anchorType) != null ? v : y.Position, [m, f] = it(u);
860
- function p(R, _) {
861
- const I = [];
862
- return R.forEach((w) => {
863
- const { oKey: O } = w, b = _.getDrawingOKey(O);
864
- if (b == null)
865
- return I.push(null), !0;
866
- const { unitId: A, subUnitId: E, drawingId: M, drawingType: D, anchorType: U, sheetTransform: x } = b;
867
- I.push({
868
- unitId: A,
869
- subUnitId: E,
870
- drawingId: M,
871
- anchorType: U,
872
- sheetTransform: x,
873
- drawingType: D
874
- });
875
- }), I;
876
- }
877
- ct(() => {
878
- const R = c.clearControl$.subscribe((I) => {
879
- I === !0 && h(!1);
880
- }), _ = c.changeStart$.subscribe((I) => {
881
- var b;
882
- const { objects: w } = I, O = p(w, t);
883
- if (O.length === 0)
884
- h(!1);
885
- else if (O.length >= 1) {
886
- h(!0);
887
- const A = ((b = O[0]) == null ? void 0 : b.anchorType) || y.Position;
888
- f(A);
850
+ let Ge = class extends Z {
851
+ constructor(i, e, n, t, r, s, o) {
852
+ super(), this._commandService = i, this._sheetInterceptorService = e, this._univerInstanceService = n, this._injector = t, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
853
+ }
854
+ _initHandleResize() {
855
+ this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
856
+ let e, n = [];
857
+ if (i.id === Xt.id) {
858
+ const t = i.params;
859
+ n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
860
+ } else if (i.id === zt.id) {
861
+ const t = i.params;
862
+ n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
863
+ } else if (i.id === kr.id) {
864
+ const t = i.params;
865
+ n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
866
+ } else if (i.id === Hr.id) {
867
+ const t = i.params;
868
+ e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }), n = t.rowsAutoHeightInfo.map((r) => ({
869
+ startRow: r.row,
870
+ endRow: r.row,
871
+ startColumn: 0,
872
+ endColumn: 9999
873
+ }));
874
+ } else if (i.id === Yr.id) {
875
+ const t = i.params;
876
+ n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
877
+ } else if (i.id === Xr.id) {
878
+ const t = i.params;
879
+ n = t.ranges, e = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
889
880
  }
890
- });
891
- return () => {
892
- _.unsubscribe(), R.unsubscribe();
893
- };
894
- }, []);
895
- function C(R) {
896
- f(R);
897
- const _ = t.getFocusDrawings();
898
- if (_.length === 0)
899
- return;
900
- const I = _.map((w) => ({
901
- unitId: w.unitId,
902
- subUnitId: w.subUnitId,
903
- drawingId: w.drawingId,
904
- anchorType: R
881
+ e && n.length && n.forEach((t) => {
882
+ const r = Yn.transformRange(t, e.worksheet);
883
+ for (let s = r.startRow; s <= r.endRow; s++)
884
+ for (let o = r.startColumn; o <= r.endColumn; o++)
885
+ pt(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: s, col: o }, e.worksheet.getCellRaw(s, o));
886
+ });
905
887
  }));
906
- e.executeCommand(Ye.id, {
907
- unitId: _[0].unitId,
908
- drawings: I
909
- });
910
888
  }
911
- const S = (R) => R ? "block" : "none";
912
- return /* @__PURE__ */ $.jsxs("div", { className: be(ee.imageCommonPanelGrid, ee.imageCommonPanelBorder), style: { display: S(a) }, children: [
913
- /* @__PURE__ */ $.jsx("div", { className: ee.imageCommonPanelRow, children: /* @__PURE__ */ $.jsx("div", { className: be(ee.imageCommonPanelColumn, ee.imageCommonPanelTitle), children: /* @__PURE__ */ $.jsx("div", { children: n.t("drawing-anchor.title") }) }) }),
914
- /* @__PURE__ */ $.jsx("div", { className: be(ee.imageCommonPanelRow), children: /* @__PURE__ */ $.jsx("div", { className: be(ee.imageCommonPanelColumn), children: /* @__PURE__ */ $.jsxs(yr, { value: m, onChange: C, direction: "vertical", children: [
915
- /* @__PURE__ */ $.jsx(Ze, { value: y.Both, children: n.t("drawing-anchor.both") }),
916
- /* @__PURE__ */ $.jsx(Ze, { value: y.Position, children: n.t("drawing-anchor.position") }),
917
- /* @__PURE__ */ $.jsx(Ze, { value: y.None, children: n.t("drawing-anchor.none") })
918
- ] }) }) })
919
- ] });
920
- }, Ii = () => {
921
- const i = ae(K), e = i.getFocusDrawings(), [n, t] = it(e);
922
- return ct(() => {
923
- const r = i.focus$.subscribe((s) => {
924
- t(s);
925
- });
926
- return () => {
927
- r.unsubscribe();
928
- };
929
- }, []), !!(n != null && n.length) && /* @__PURE__ */ $.jsxs("div", { className: ee.imageCommonPanel, children: [
930
- /* @__PURE__ */ $.jsx(Vn, { drawings: n }),
931
- /* @__PURE__ */ $.jsx(Ci, { drawings: n })
932
- ] });
933
- }, Ri = {
934
- [dr.FORMULAS_INSERT]: {
935
- [cn]: {
936
- order: 3,
937
- menuItemFactory: ii,
938
- [dt.id]: {
939
- order: 0,
940
- menuItemFactory: si
941
- }
942
- }
943
- }
944
- };
945
- function _e(i) {
946
- return !i.getContextValue(vn) && !i.getContextValue(Sn) && !i.getContextValue(Cn) && i.getContextValue(me);
947
- }
948
- const Di = {
949
- id: we.id,
950
- description: "shortcut.sheet.drawing-move-down",
951
- group: "4_sheet-drawing-view",
952
- binding: le.ARROW_DOWN,
953
- priority: 100,
954
- preconditions: _e,
955
- staticParameters: {
956
- direction: te.DOWN
957
- }
958
- }, Mi = {
959
- id: we.id,
960
- description: "shortcut.sheet.drawing-move-up",
961
- group: "4_sheet-drawing-view",
962
- binding: le.ARROW_UP,
963
- priority: 100,
964
- preconditions: _e,
965
- staticParameters: {
966
- direction: te.UP
889
+ _handleInitEditor() {
890
+ this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
891
+ i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(be), this._docDrawingController.loadDrawingDataForUnit(be), this._drawingManagerService.initializeNotification(be)) : this._drawingManagerService.removeDrawingDataForUnit(be);
892
+ })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
893
+ i.id === ai.id && i.params.unitId === ye && (this._drawingManagerService.removeDrawingDataForUnit(ye), this._docDrawingController.loadDrawingDataForUnit(ye), this._drawingManagerService.initializeNotification(ye));
894
+ }));
967
895
  }
968
- }, bi = {
969
- id: we.id,
970
- description: "shortcut.sheet.drawing-move-left",
971
- group: "4_sheet-drawing-view",
972
- binding: le.ARROW_LEFT,
973
- priority: 100,
974
- preconditions: _e,
975
- staticParameters: {
976
- direction: te.LEFT
896
+ _handleWriteCell() {
897
+ this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(zr, {
898
+ priority: 9999,
899
+ handler: (i, e, n) => (pt(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, i), n(i))
900
+ }));
977
901
  }
978
- }, yi = {
979
- id: we.id,
980
- description: "shortcut.sheet.drawing-move-right",
981
- group: "4_sheet-drawing-view",
982
- binding: le.ARROW_RIGHT,
983
- priority: 100,
984
- preconditions: _e,
985
- staticParameters: {
986
- direction: te.RIGHT
902
+ _initCellContentInterceptor() {
903
+ this.disposeWithMe(
904
+ this._sheetInterceptorService.intercept(
905
+ Kr.CELL_CONTENT,
906
+ {
907
+ effect: Xn.Style,
908
+ priority: Jr.CELL_IMAGE,
909
+ handler: (i, e, n) => {
910
+ var t;
911
+ return i != null && i.p && ((t = i.p.drawingsOrder) != null && t.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), n(i);
912
+ }
913
+ }
914
+ )
915
+ );
987
916
  }
988
- }, Oi = {
989
- id: nn.id,
990
- description: "shortcut.sheet.drawing-delete",
991
- group: "4_sheet-drawing-view",
992
- // when focusing on any other input tag do not trigger this shortcut
993
- preconditions: _e,
994
- binding: le.DELETE,
995
- mac: le.BACKSPACE
996
917
  };
997
- var Pi = Object.defineProperty, Ti = Object.getOwnPropertyDescriptor, Ei = (i, e, n, t) => {
998
- for (var r = t > 1 ? void 0 : t ? Ti(e, n) : e, s = i.length - 1, o; s >= 0; s--)
918
+ Ge = Ai([
919
+ ce(0, G),
920
+ ce(1, N(qe)),
921
+ ce(2, fe),
922
+ ce(3, N(Ie)),
923
+ ce(4, q),
924
+ ce(5, N(si)),
925
+ ce(6, N(Rr))
926
+ ], Ge);
927
+ var Ni = Object.defineProperty, ji = Object.getOwnPropertyDescriptor, Wi = (i, e, n, t) => {
928
+ for (var r = t > 1 ? void 0 : t ? ji(e, n) : e, s = i.length - 1, o; s >= 0; s--)
999
929
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1000
- return t && r && Pi(e, n, r), r;
1001
- }, ye = (i, e) => (n, t) => e(n, t, i);
1002
- let Ne = class extends ie {
1003
- constructor(i, e, n, t) {
1004
- super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
930
+ return t && r && Ni(e, n, r), r;
931
+ }, Bt = (i, e) => (n, t) => e(n, t, i);
932
+ let Fe = class extends Z {
933
+ constructor(i, e) {
934
+ super(), this._autoFillService = i, this._injector = e, this._initAutoFillHooks();
1005
935
  }
1006
- _initCustomComponents() {
1007
- const i = this._componentManager;
1008
- this.disposeWithMe(i.register(an, tn)), this.disposeWithMe(i.register(zt, Ii));
1009
- }
1010
- _initMenus() {
1011
- this._menuManagerService.mergeMenu(Ri);
936
+ _initAutoFillHooks() {
937
+ this.disposeWithMe(
938
+ this._autoFillService.addHook({
939
+ id: "sheet-cell-image-autofill",
940
+ onBeforeSubmit: (i, e, n, t) => {
941
+ new zn(t).forValue((r, s, o) => {
942
+ pt(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
943
+ });
944
+ }
945
+ })
946
+ );
1012
947
  }
1013
- _initCommands() {
1014
- [
1015
- dt,
1016
- ke,
1017
- Ge,
1018
- Ye,
1019
- Kt,
1020
- j,
1021
- Jt,
1022
- rn,
1023
- on,
1024
- we,
1025
- nn,
1026
- sn
1027
- ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
948
+ };
949
+ Fe = Wi([
950
+ Bt(0, N(Mr)),
951
+ Bt(1, N(Ie))
952
+ ], Fe);
953
+ var xi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, Bi = (i, e, n, t) => {
954
+ for (var r = t > 1 ? void 0 : t ? $i(e, n) : e, s = i.length - 1, o; s >= 0; s--)
955
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
956
+ return t && r && xi(e, n, r), r;
957
+ }, Ae = (i, e) => (n, t) => e(n, t, i);
958
+ let Ve = class extends Z {
959
+ constructor(e, n, t, r) {
960
+ super();
961
+ F(this, "_isSetCursor", !1);
962
+ this._hoverManagerService = e, this._renderManagerService = n, this._selectionsService = t, this._drawingRenderService = r;
1028
963
  }
1029
- _initShortcuts() {
1030
- [
1031
- // sheet drawing shortcuts
1032
- Di,
1033
- Mi,
1034
- bi,
1035
- yi,
1036
- Oi
1037
- ].forEach((i) => {
1038
- this.disposeWithMe(this._shortcutService.registerShortcut(i));
1039
- });
964
+ _initHover() {
1040
965
  }
1041
- _init() {
1042
- this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
966
+ _initImageClick() {
1043
967
  }
1044
968
  };
1045
- Ne = Ei([
1046
- ye(0, W(lr)),
1047
- ye(1, ur),
1048
- ye(2, B),
1049
- ye(3, hr)
1050
- ], Ne);
1051
- var Ui = Object.defineProperty, Ai = Object.getOwnPropertyDescriptor, Ni = (i, e, n, t) => {
1052
- for (var r = t > 1 ? void 0 : t ? Ai(e, n) : e, s = i.length - 1, o; s >= 0; s--)
969
+ Ve = Bi([
970
+ Ae(0, N(Dr)),
971
+ Ae(1, N(X)),
972
+ Ae(2, N(Yt)),
973
+ Ae(3, N(Vt))
974
+ ], Ve);
975
+ var Li = Object.defineProperty, Gi = Object.getOwnPropertyDescriptor, Fi = (i, e, n, t) => {
976
+ for (var r = t > 1 ? void 0 : t ? Gi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1053
977
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1054
- return t && r && Ui(e, n, r), r;
1055
- }, qe = (i, e) => (n, t) => e(n, t, i);
1056
- let je = class extends ie {
978
+ return t && r && Li(e, n, r), r;
979
+ }, ct = (i, e) => (n, t) => e(n, t, i);
980
+ let ke = class extends Z {
1057
981
  constructor(e, n, t) {
1058
982
  super();
1059
- V(this, "_copyInfo");
983
+ F(this, "_copyInfo");
1060
984
  this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste();
1061
985
  }
1062
986
  _initCopyPaste() {
@@ -1064,7 +988,7 @@ let je = class extends ie {
1064
988
  id: "SHEET_IMAGE_UI_PLUGIN",
1065
989
  onBeforeCopy: (e, n, t) => this._collect(e, n, t),
1066
990
  onPasteCells: (e, n, t, r) => {
1067
- const { copyType: s = _t.COPY, pasteType: o } = r, { range: d } = e || {}, { range: l, unitId: g, subUnitId: c } = n;
991
+ const { copyType: s = At.COPY, pasteType: o } = r, { range: d } = e || {}, { range: l, unitId: g, subUnitId: c } = n;
1068
992
  return this._generateMutations(l, { copyType: s, pasteType: o, copyRange: d, unitId: g, subUnitId: c });
1069
993
  },
1070
994
  onPastePlainText: (e, n) => ({ undos: [], redos: [] })
@@ -1072,7 +996,7 @@ let je = class extends ie {
1072
996
  }
1073
997
  _collect(e, n, t) {
1074
998
  var h;
1075
- const r = (h = this._renderManagerService.getRenderById(e)) == null ? void 0 : h.with(q);
999
+ const r = (h = this._renderManagerService.getRenderById(e)) == null ? void 0 : h.with(Q);
1076
1000
  if (!r) return;
1077
1001
  const s = r.attachRangeWithCoord(t);
1078
1002
  if (!s)
@@ -1082,13 +1006,13 @@ let je = class extends ie {
1082
1006
  const m = c[u], { transform: f } = m;
1083
1007
  if (m.anchorType !== y.Both || !f)
1084
1008
  return;
1085
- const { left: p = 0, top: C = 0, width: S = 0, height: v = 0 } = f, { drawingStartX: R, drawingEndX: _, drawingStartY: I, drawingEndY: w } = {
1009
+ const { left: p = 0, top: v = 0, width: I = 0, height: S = 0 } = f, { drawingStartX: R, drawingEndX: _, drawingStartY: C, drawingEndY: w } = {
1086
1010
  drawingStartX: p,
1087
- drawingEndX: p + S,
1088
- drawingStartY: C,
1089
- drawingEndY: C + v
1011
+ drawingEndX: p + I,
1012
+ drawingStartY: v,
1013
+ drawingEndY: v + S
1090
1014
  };
1091
- o <= R && _ <= d && l <= I && w <= g && a.push(m);
1015
+ o <= R && _ <= d && l <= C && w <= g && a.push(m);
1092
1016
  }), a.length && (this._copyInfo = {
1093
1017
  drawings: a,
1094
1018
  unitId: e,
@@ -1101,10 +1025,10 @@ let je = class extends ie {
1101
1025
  if (!this._copyInfo)
1102
1026
  return { redos: [], undos: [] };
1103
1027
  if ([
1104
- Se.SPECIAL_PASTE_COL_WIDTH,
1105
- Se.SPECIAL_PASTE_VALUE,
1106
- Se.SPECIAL_PASTE_FORMAT,
1107
- Se.SPECIAL_PASTE_FORMULA
1028
+ Oe.SPECIAL_PASTE_COL_WIDTH,
1029
+ Oe.SPECIAL_PASTE_VALUE,
1030
+ Oe.SPECIAL_PASTE_FORMAT,
1031
+ Oe.SPECIAL_PASTE_FORMULA
1108
1032
  ].includes(
1109
1033
  n.pasteType
1110
1034
  ))
@@ -1112,7 +1036,7 @@ let je = class extends ie {
1112
1036
  const { copyRange: t } = n;
1113
1037
  if (!t)
1114
1038
  return { redos: [], undos: [] };
1115
- const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [d, l], mapFunc: g } = Qn([t, e]), { row: c, col: a } = g(d.startRow, d.startColumn), { row: h, col: u } = g(l.startRow, l.startColumn), m = (b = this._renderManagerService.getRenderById(s)) == null ? void 0 : b.with(q);
1039
+ const { drawings: r, unitId: s, subUnitId: o } = this._copyInfo, { ranges: [d, l], mapFunc: g } = br([t, e]), { row: c, col: a } = g(d.startRow, d.startColumn), { row: h, col: u } = g(l.startRow, l.startColumn), m = (b = this._renderManagerService.getRenderById(s)) == null ? void 0 : b.with(Q);
1116
1040
  if (!m)
1117
1041
  return { redos: [], undos: [] };
1118
1042
  const f = m.attachRangeWithCoord({
@@ -1128,75 +1052,75 @@ let je = class extends ie {
1128
1052
  });
1129
1053
  if (!f || !p)
1130
1054
  return { redos: [], undos: [] };
1131
- const C = [], S = [], v = p.startX - f.startX, R = p.startY - f.startY, _ = h - c, I = u - a, w = n.copyType === _t.CUT, { _sheetDrawingService: O } = this;
1055
+ const v = [], I = [], S = p.startX - f.startX, R = p.startY - f.startY, _ = h - c, C = u - a, w = n.copyType === At.CUT, { _sheetDrawingService: O } = this;
1132
1056
  return r.forEach((A) => {
1133
- const { transform: E, sheetTransform: M } = A;
1134
- if (!E)
1057
+ const { transform: P, sheetTransform: D } = A;
1058
+ if (!P)
1135
1059
  return;
1136
- const D = {
1060
+ const M = {
1137
1061
  ...A,
1138
1062
  unitId: s,
1139
1063
  subUnitId: o,
1140
- drawingId: w ? A.drawingId : ge.generateRandomId(),
1064
+ drawingId: w ? A.drawingId : _e.generateRandomId(),
1141
1065
  transform: {
1142
- ...E,
1143
- left: E.left + v,
1144
- top: E.top + R
1066
+ ...P,
1067
+ left: P.left + S,
1068
+ top: P.top + R
1145
1069
  },
1146
1070
  sheetTransform: {
1147
- to: { ...M.to, row: M.to.row + _, column: M.to.column + I },
1148
- from: { ...M.from, row: M.from.row + _, column: M.from.column + I }
1071
+ to: { ...D.to, row: D.to.row + _, column: D.to.column + C },
1072
+ from: { ...D.from, row: D.from.row + _, column: D.from.column + C }
1149
1073
  }
1150
1074
  };
1151
1075
  if (w) {
1152
- const { undo: U, redo: x, objects: Z } = O.getBatchUpdateOp([D]);
1153
- C.push({
1154
- id: P.id,
1076
+ const { undo: U, redo: x, objects: ee } = O.getBatchUpdateOp([M]);
1077
+ v.push({
1078
+ id: T.id,
1155
1079
  params: {
1156
1080
  unitId: s,
1157
1081
  subUnitId: o,
1158
- type: T.UPDATE,
1082
+ type: E.UPDATE,
1159
1083
  op: x,
1160
- objects: Z
1084
+ objects: ee
1161
1085
  }
1162
- }), S.push({
1163
- id: P.id,
1086
+ }), I.push({
1087
+ id: T.id,
1164
1088
  params: {
1165
1089
  unitId: s,
1166
1090
  subUnitId: o,
1167
- type: T.UPDATE,
1091
+ type: E.UPDATE,
1168
1092
  op: U,
1169
- objects: Z
1093
+ objects: ee
1170
1094
  }
1171
1095
  });
1172
1096
  } else {
1173
- const { undo: U, redo: x, objects: Z } = O.getBatchAddOp([D]);
1174
- C.push({ id: P.id, params: { op: x, unitId: s, subUnitId: o, objects: Z, type: T.INSERT } }), S.push({ id: P.id, params: { op: U, unitId: s, subUnitId: o, objects: Z, type: T.REMOVE } });
1097
+ const { undo: U, redo: x, objects: ee } = O.getBatchAddOp([M]);
1098
+ v.push({ id: T.id, params: { op: x, unitId: s, subUnitId: o, objects: ee, type: E.INSERT } }), I.push({ id: T.id, params: { op: U, unitId: s, subUnitId: o, objects: ee, type: E.REMOVE } });
1175
1099
  }
1176
1100
  }), {
1177
- redos: C,
1178
- undos: S
1101
+ redos: v,
1102
+ undos: I
1179
1103
  };
1180
1104
  }
1181
1105
  };
1182
- je = Ni([
1183
- qe(0, er),
1184
- qe(1, J),
1185
- qe(2, F)
1186
- ], je);
1187
- var ji = Object.defineProperty, Wi = Object.getOwnPropertyDescriptor, xi = (i, e, n, t) => {
1188
- for (var r = t > 1 ? void 0 : t ? Wi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1106
+ ke = Fi([
1107
+ ct(0, yr),
1108
+ ct(1, X),
1109
+ ct(2, z)
1110
+ ], ke);
1111
+ var Vi = Object.defineProperty, ki = Object.getOwnPropertyDescriptor, Hi = (i, e, n, t) => {
1112
+ for (var r = t > 1 ? void 0 : t ? ki(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1189
1113
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1190
- return t && r && ji(e, n, r), r;
1191
- }, he = (i, e) => (n, t) => e(n, t, i);
1192
- let We = class extends ie {
1114
+ return t && r && Vi(e, n, r), r;
1115
+ }, we = (i, e) => (n, t) => e(n, t, i);
1116
+ let He = class extends Z {
1193
1117
  constructor(i, e, n, t, r) {
1194
1118
  super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1195
1119
  }
1196
1120
  _initDrawingVisible() {
1197
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
1121
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET);
1198
1122
  this.disposeWithMe(
1199
- Ce([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1123
+ Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1200
1124
  if (!e) {
1201
1125
  this._drawingManagerService.setDrawingVisible(!1);
1202
1126
  return;
@@ -1207,7 +1131,7 @@ let We = class extends ie {
1207
1131
  return;
1208
1132
  }
1209
1133
  const r = e.getUnitId(), s = t.getSheetId();
1210
- if (this._permissionService.composePermission([new Ct(r).id, new Je(r, s).id]).every((d) => d.value))
1134
+ if (this._permissionService.composePermission([new Wt(r).id, new st(r, s).id]).every((d) => d.value))
1211
1135
  this._drawingManagerService.setDrawingVisible(!0);
1212
1136
  else {
1213
1137
  this._drawingManagerService.setDrawingVisible(!1);
@@ -1215,7 +1139,7 @@ let We = class extends ie {
1215
1139
  if (h == null)
1216
1140
  return;
1217
1141
  h.getAllObjectsByOrder().forEach((m) => {
1218
- m.classType === de.IMAGE && c.some((f) => m.oKey.includes(f.drawingId)) && h.removeObject(m);
1142
+ m.classType === he.IMAGE && c.some((f) => m.oKey.includes(f.drawingId)) && h.removeObject(m);
1219
1143
  });
1220
1144
  }
1221
1145
  });
@@ -1223,9 +1147,9 @@ let We = class extends ie {
1223
1147
  );
1224
1148
  }
1225
1149
  _initDrawingEditable() {
1226
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
1150
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET);
1227
1151
  this.disposeWithMe(
1228
- Ce([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1152
+ Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1229
1153
  if (!e) {
1230
1154
  this._drawingManagerService.setDrawingEditable(!1);
1231
1155
  return;
@@ -1236,7 +1160,7 @@ let We = class extends ie {
1236
1160
  return;
1237
1161
  }
1238
1162
  const r = e.getUnitId(), s = t.getSheetId();
1239
- if (this._permissionService.composePermission([new tt(r).id, new Pe(r, s).id]).every((d) => d.value))
1163
+ if (this._permissionService.composePermission([new ut(r).id, new xe(r, s).id]).every((d) => d.value))
1240
1164
  this._drawingManagerService.setDrawingEditable(!0);
1241
1165
  else {
1242
1166
  this._drawingManagerService.setDrawingEditable(!1);
@@ -1244,7 +1168,7 @@ let We = class extends ie {
1244
1168
  if (h == null)
1245
1169
  return;
1246
1170
  h.getAllObjectsByOrder().forEach((m) => {
1247
- m.classType === de.IMAGE && c.some((f) => m.oKey.includes(f.drawingId)) && h.detachTransformerFrom(m);
1171
+ m.classType === he.IMAGE && c.some((f) => m.oKey.includes(f.drawingId)) && h.detachTransformerFrom(m);
1248
1172
  });
1249
1173
  }
1250
1174
  });
@@ -1252,9 +1176,9 @@ let We = class extends ie {
1252
1176
  );
1253
1177
  }
1254
1178
  _initViewPermissionChange() {
1255
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
1179
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET);
1256
1180
  this.disposeWithMe(
1257
- Ce([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1181
+ Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1258
1182
  e && e.activeSheet$.subscribe((t) => {
1259
1183
  var a;
1260
1184
  if (!t)
@@ -1264,21 +1188,21 @@ let We = class extends ie {
1264
1188
  const d = this._renderManagerService.getRenderById(r), l = d == null ? void 0 : d.scene;
1265
1189
  if (l == null)
1266
1190
  return;
1267
- const g = l.getTransformerByCreate(), c = this._permissionService.composePermission$([new Ct(r).id, new Je(r, s).id]).pipe(Ee((h) => h.every((u) => u.value)));
1191
+ const g = l.getTransformerByCreate(), c = this._permissionService.composePermission$([new Wt(r).id, new st(r, s).id]).pipe(Be((h) => h.every((u) => u.value)));
1268
1192
  c == null || c.pipe(
1269
- re((h) => h !== o),
1270
- Ie()
1193
+ se((h) => h !== o),
1194
+ Ee()
1271
1195
  ).subscribe({
1272
1196
  next: (h) => {
1273
1197
  o = h, this._drawingManagerService.setDrawingVisible(h);
1274
1198
  const u = l.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), f = Object.values(m);
1275
1199
  h ? this._drawingManagerService.addNotification(f) : (u.forEach((p) => {
1276
- p.classType === de.IMAGE && f.some((C) => p.oKey.includes(C.drawingId)) && l.removeObject(p);
1200
+ p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.removeObject(p);
1277
1201
  }), g.clearSelectedObjects());
1278
1202
  }
1279
- }), (a = this._permissionService.getPermissionPoint$(new Je(r, s).id)) == null || a.pipe(
1280
- re((h) => h.value !== o),
1281
- Ie()
1203
+ }), (a = this._permissionService.getPermissionPoint$(new st(r, s).id)) == null || a.pipe(
1204
+ se((h) => h.value !== o),
1205
+ Ee()
1282
1206
  ).subscribe({
1283
1207
  complete: () => {
1284
1208
  o = !0, this._drawingManagerService.setDrawingVisible(!0);
@@ -1291,9 +1215,9 @@ let We = class extends ie {
1291
1215
  );
1292
1216
  }
1293
1217
  _initEditPermissionChange() {
1294
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
1218
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET);
1295
1219
  this.disposeWithMe(
1296
- Ce([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1220
+ Te([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
1297
1221
  e && e.activeSheet$.subscribe((t) => {
1298
1222
  var a;
1299
1223
  if (!t)
@@ -1303,31 +1227,31 @@ let We = class extends ie {
1303
1227
  const d = this._renderManagerService.getRenderById(r), l = d == null ? void 0 : d.scene;
1304
1228
  if (l == null)
1305
1229
  return;
1306
- const g = l.getTransformerByCreate(), c = this._permissionService.composePermission$([new tt(r).id, new Pe(r, s).id]).pipe(Ee((h) => h.every((u) => u.value)));
1230
+ const g = l.getTransformerByCreate(), c = this._permissionService.composePermission$([new ut(r).id, new xe(r, s).id]).pipe(Be((h) => h.every((u) => u.value)));
1307
1231
  c == null || c.pipe(
1308
- re((h) => h !== o),
1309
- Ie()
1232
+ se((h) => h !== o),
1233
+ Ee()
1310
1234
  ).subscribe({
1311
1235
  next: (h) => {
1312
1236
  o = h, this._drawingManagerService.setDrawingEditable(h);
1313
1237
  const u = l.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), f = Object.values(m);
1314
1238
  h ? (u.forEach((p) => {
1315
- p.classType === de.IMAGE && f.some((C) => p.oKey.includes(C.drawingId)) && l.attachTransformerTo(p);
1239
+ p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.attachTransformerTo(p);
1316
1240
  }), this._drawingManagerService.addNotification(f)) : (u.forEach((p) => {
1317
- p.classType === de.IMAGE && f.some((C) => p.oKey.includes(C.drawingId)) && l.detachTransformerFrom(p);
1241
+ p.classType === he.IMAGE && f.some((v) => p.oKey.includes(v.drawingId)) && l.detachTransformerFrom(p);
1318
1242
  }), g.clearSelectedObjects());
1319
1243
  }
1320
- }), (a = this._permissionService.getPermissionPoint$(new Pe(r, s).id)) == null || a.pipe(
1321
- re((h) => h.value !== o),
1322
- Ie()
1244
+ }), (a = this._permissionService.getPermissionPoint$(new xe(r, s).id)) == null || a.pipe(
1245
+ se((h) => h.value !== o),
1246
+ Ee()
1323
1247
  ).subscribe({
1324
1248
  complete: () => {
1325
1249
  o = !0;
1326
- const h = e.getUnitId(), u = t.getSheetId(), m = this._drawingManagerService.getDrawingData(h, u), f = Object.values(m), p = this._renderManagerService.getRenderById(h), C = p == null ? void 0 : p.scene;
1327
- if (C == null)
1250
+ const h = e.getUnitId(), u = t.getSheetId(), m = this._drawingManagerService.getDrawingData(h, u), f = Object.values(m), p = this._renderManagerService.getRenderById(h), v = p == null ? void 0 : p.scene;
1251
+ if (v == null)
1328
1252
  return;
1329
- this._drawingManagerService.setDrawingEditable(!0), C.getAllObjectsByOrder().forEach((v) => {
1330
- v.classType === de.IMAGE && f.some((R) => v.oKey.includes(R.drawingId)) && C.detachTransformerFrom(v);
1253
+ this._drawingManagerService.setDrawingEditable(!0), v.getAllObjectsByOrder().forEach((S) => {
1254
+ S.classType === he.IMAGE && f.some((R) => S.oKey.includes(R.drawingId)) && v.detachTransformerFrom(S);
1331
1255
  });
1332
1256
  }
1333
1257
  });
@@ -1336,19 +1260,19 @@ let We = class extends ie {
1336
1260
  );
1337
1261
  }
1338
1262
  };
1339
- We = xi([
1340
- he(0, K),
1341
- he(1, J),
1342
- he(2, Rn),
1343
- he(3, fe),
1344
- he(4, W(In))
1345
- ], We);
1346
- var $i = Object.defineProperty, Li = Object.getOwnPropertyDescriptor, Bi = (i, e, n, t) => {
1347
- for (var r = t > 1 ? void 0 : t ? Li(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1263
+ He = Hi([
1264
+ we(0, q),
1265
+ we(1, X),
1266
+ we(2, Jn),
1267
+ we(3, fe),
1268
+ we(4, N(Kn))
1269
+ ], He);
1270
+ var Yi = Object.defineProperty, Xi = Object.getOwnPropertyDescriptor, zi = (i, e, n, t) => {
1271
+ for (var r = t > 1 ? void 0 : t ? Xi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1348
1272
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1349
- return t && r && $i(e, n, r), r;
1350
- }, Oe = (i, e) => (n, t) => e(n, t, i);
1351
- let xe = class extends ie {
1273
+ return t && r && Yi(e, n, r), r;
1274
+ }, Ne = (i, e) => (n, t) => e(n, t, i);
1275
+ let Ye = class extends Z {
1352
1276
  constructor(i, e, n, t) {
1353
1277
  super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
1354
1278
  }
@@ -1373,15 +1297,15 @@ let xe = class extends ie {
1373
1297
  const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
1374
1298
  if (!s)
1375
1299
  return n(i);
1376
- const o = s.with(q).getWorksheetSkeleton(r);
1300
+ const o = s.with(Q).getWorksheetSkeleton(r);
1377
1301
  if (!o)
1378
1302
  return n(i);
1379
1303
  const d = this._drawingManagerService.getDrawingDataForUnit(t), l = d == null ? void 0 : d[e.subUnitId];
1380
1304
  if (!l)
1381
1305
  return n(i);
1382
- const { scaleX: g, scaleY: c } = s.scene, a = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = l.order.map((u) => l.data[u]).filter((u) => u.drawingType !== k.DRAWING_DOM);
1306
+ const { scaleX: g, scaleY: c } = s.scene, a = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = l.order.map((u) => l.data[u]).filter((u) => u.drawingType !== V.DRAWING_DOM);
1383
1307
  return h.length ? (h.forEach((u) => {
1384
- if (!u.groupId && u.transform && ge.isDefine(u.transform.left) && ge.isDefine(u.transform.top) && ge.isDefine(u.transform.width) && ge.isDefine(u.transform.height)) {
1308
+ if (!u.groupId && u.transform && _e.isDefine(u.transform.left) && _e.isDefine(u.transform.top) && _e.isDefine(u.transform.width) && _e.isDefine(u.transform.height)) {
1385
1309
  const m = o.skeleton.getCellIndexByOffset(u.transform.left, u.transform.top, g, c, { x: 0, y: 0 }), f = o.skeleton.getCellIndexByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, c, { x: 0, y: 0 });
1386
1310
  m.column < a.startColumn && (a.startColumn = m.column), m.row < a.startRow && (a.startRow = m.row), a.endRow < f.row && (a.endRow = f.row), a.endColumn < f.column && (a.endColumn = f.column);
1387
1311
  }
@@ -1392,46 +1316,46 @@ let xe = class extends ie {
1392
1316
  );
1393
1317
  }
1394
1318
  };
1395
- xe = Bi([
1396
- Oe(0, W(tr)),
1397
- Oe(1, W(kn)),
1398
- Oe(2, K),
1399
- Oe(3, J)
1400
- ], xe);
1401
- var Gi = Object.defineProperty, Vi = Object.getOwnPropertyDescriptor, ki = (i, e, n, t) => {
1402
- for (var r = t > 1 ? void 0 : t ? Vi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1319
+ Ye = zi([
1320
+ Ne(0, N(Or)),
1321
+ Ne(1, N(Vt)),
1322
+ Ne(2, q),
1323
+ Ne(3, X)
1324
+ ], Ye);
1325
+ var Ki = Object.defineProperty, Ji = Object.getOwnPropertyDescriptor, qi = (i, e, n, t) => {
1326
+ for (var r = t > 1 ? void 0 : t ? Ji(e, n) : e, s = i.length - 1, o; s >= 0; s--)
1403
1327
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
1404
- return t && r && Gi(e, n, r), r;
1405
- }, Q = (i, e) => (n, t) => e(n, t, i);
1406
- const Yi = [
1407
- Ot.id,
1408
- Pt.id,
1409
- Tt.id,
1410
- Et.id,
1411
- Ut.id,
1412
- At.id,
1413
- Nt.id,
1414
- jt.id,
1415
- nt.id,
1416
- rt.id,
1417
- Wt.id,
1418
- xt.id,
1419
- $t.id,
1420
- Lt.id,
1421
- Bt.id,
1422
- Gt.id,
1423
- Vt.id,
1424
- kt.id,
1425
- Yt.id
1426
- ], Fi = [
1427
- _r.id,
1428
- vr.id,
1429
- Sr.id,
1430
- Cr.id,
1431
- Ir.id,
1432
- Rr.id
1328
+ return t && r && Ki(e, n, r), r;
1329
+ }, te = (i, e) => (n, t) => e(n, t, i);
1330
+ const Zi = [
1331
+ Kt.id,
1332
+ Jt.id,
1333
+ qt.id,
1334
+ Zt.id,
1335
+ Qt.id,
1336
+ en.id,
1337
+ tn.id,
1338
+ nn.id,
1339
+ ht.id,
1340
+ gt.id,
1341
+ rn.id,
1342
+ sn.id,
1343
+ on.id,
1344
+ an.id,
1345
+ cn.id,
1346
+ dn.id,
1347
+ ln.id,
1348
+ un.id,
1349
+ hn.id
1350
+ ], Qi = [
1351
+ qr.id,
1352
+ Zr.id,
1353
+ Qr.id,
1354
+ ei.id,
1355
+ Xt.id,
1356
+ zt.id
1433
1357
  ];
1434
- let ot = class extends ie {
1358
+ let wt = class extends Z {
1435
1359
  constructor(i, e, n, t, r, s, o, d, l) {
1436
1360
  super(), this._context = i, this._renderManagerService = e, this._commandService = n, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = d, this._univerInstanceService = l, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
1437
1361
  }
@@ -1439,57 +1363,57 @@ let ot = class extends ie {
1439
1363
  this.disposeWithMe(
1440
1364
  this._sheetInterceptorService.interceptCommand({
1441
1365
  getMutations: (i) => {
1442
- if (!Yi.includes(i.id))
1366
+ if (!Zi.includes(i.id))
1443
1367
  return { redos: [], undos: [] };
1444
1368
  if (i.params == null)
1445
1369
  return { redos: [], undos: [] };
1446
1370
  const e = i.id;
1447
- if (e === Ot.id)
1371
+ if (e === Kt.id)
1448
1372
  return this._moveRowInterceptor(i.params, "insert");
1449
- if ([Vt.id, kt.id, Yt.id].includes(e))
1373
+ if ([ln.id, un.id, hn.id].includes(e))
1450
1374
  return this._moveRangeInterceptor(i.params);
1451
- if (e === Pt.id)
1375
+ if (e === Jt.id)
1452
1376
  return this._moveColInterceptor(i.params, "insert");
1453
- if (e === Tt.id)
1377
+ if (e === qt.id)
1454
1378
  return this._moveRowInterceptor(i.params, "remove");
1455
- if (e === Et.id)
1379
+ if (e === Zt.id)
1456
1380
  return this._moveColInterceptor(i.params, "remove");
1457
- if (e === Ut.id) {
1381
+ if (e === Qt.id) {
1458
1382
  const { range: n } = i.params;
1459
1383
  return this._getRangeMoveUndo(
1460
1384
  n,
1461
1385
  0
1462
1386
  /* deleteLeft */
1463
1387
  );
1464
- } else if (e === At.id) {
1388
+ } else if (e === en.id) {
1465
1389
  const { range: n } = i.params;
1466
1390
  return this._getRangeMoveUndo(
1467
1391
  n,
1468
1392
  1
1469
1393
  /* deleteUp */
1470
1394
  );
1471
- } else if (e === Nt.id) {
1395
+ } else if (e === tn.id) {
1472
1396
  const { range: n } = i.params;
1473
1397
  return this._getRangeMoveUndo(
1474
1398
  n,
1475
1399
  2
1476
1400
  /* insertDown */
1477
1401
  );
1478
- } else if (e === jt.id) {
1402
+ } else if (e === nn.id) {
1479
1403
  const { range: n } = i.params;
1480
1404
  return this._getRangeMoveUndo(
1481
1405
  n,
1482
1406
  3
1483
1407
  /* insertRight */
1484
1408
  );
1485
- } else if (e === $t.id || e === Lt.id) {
1409
+ } else if (e === on.id || e === an.id) {
1486
1410
  const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
1487
1411
  return this._getDrawingUndoForRowVisible(t, r, s);
1488
- } else if (e === Bt.id || e === Gt.id) {
1412
+ } else if (e === cn.id || e === dn.id) {
1489
1413
  const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
1490
1414
  return this._getDrawingUndoForColVisible(t, r, s);
1491
- } else if (e === nt.id || e === rt.id || e === Wt.id || e === xt.id) {
1492
- const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === nt.id || e === rt.id;
1415
+ } else if (e === ht.id || e === gt.id || e === rn.id || e === sn.id) {
1416
+ const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === ht.id || e === gt.id;
1493
1417
  return this._getDrawingUndoForRowAndColSize(t, r, s, o);
1494
1418
  }
1495
1419
  return { redos: [], undos: [] };
@@ -1498,7 +1422,7 @@ let ot = class extends ie {
1498
1422
  );
1499
1423
  }
1500
1424
  _getRangeMoveUndo(i, e) {
1501
- const n = ce(this._univerInstanceService);
1425
+ const n = H(this._univerInstanceService);
1502
1426
  if (n == null)
1503
1427
  return { redos: [], undos: [] };
1504
1428
  const t = n.unitId, r = n.subUnitId, s = [], o = [], d = this._sheetDrawingService.getDrawingData(t, r), l = [], g = [];
@@ -1509,13 +1433,13 @@ let ot = class extends ie {
1509
1433
  return { redos: [], undos: [] };
1510
1434
  if (l.length > 0) {
1511
1435
  const c = this._sheetDrawingService.getBatchUpdateOp(l), { undo: a, redo: h, objects: u } = c;
1512
- s.push({ id: P.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: T.UPDATE } }), o.push({ id: P.id, params: { unitId: t, subUnitId: r, op: a, objects: u, type: T.UPDATE } });
1436
+ s.push({ id: T.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.UPDATE } }), o.push({ id: T.id, params: { unitId: t, subUnitId: r, op: a, objects: u, type: E.UPDATE } });
1513
1437
  }
1514
1438
  if (g.length > 0) {
1515
1439
  const c = this._sheetDrawingService.getBatchRemoveOp(g), a = c.undo, h = c.redo, u = c.objects;
1516
- s.push({ id: P.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: T.REMOVE } }), o.push({ id: P.id, params: { unitId: t, subUnitId: r, op: a, objects: u, type: T.INSERT } });
1440
+ s.push({ id: T.id, params: { unitId: t, subUnitId: r, op: h, objects: u, type: E.REMOVE } }), o.push({ id: T.id, params: { unitId: t, subUnitId: r, op: a, objects: u, type: E.INSERT } });
1517
1441
  }
1518
- return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
1442
+ return s.push({ id: W.id, params: [t] }), o.push({ id: W.id, params: [t] }), {
1519
1443
  redos: s,
1520
1444
  undos: o
1521
1445
  };
@@ -1527,37 +1451,37 @@ let ot = class extends ie {
1527
1451
  updateDrawings: t,
1528
1452
  deleteDrawings: r
1529
1453
  };
1530
- const { startRow: C, endRow: S, startColumn: v, endColumn: R } = i;
1531
- let _ = null, I = null;
1532
- if (e === 0 && u >= C && f <= S)
1533
- if (m >= v && p <= R)
1454
+ const { startRow: v, endRow: I, startColumn: S, endColumn: R } = i;
1455
+ let _ = null, C = null;
1456
+ if (e === 0 && u >= v && f <= I)
1457
+ if (m >= S && p <= R)
1534
1458
  r.push({ unitId: l, subUnitId: g, drawingId: c });
1535
1459
  else {
1536
- const w = this._shrinkCol(s, d, v, R, o);
1537
- _ = w == null ? void 0 : w.newSheetTransform, I = w == null ? void 0 : w.newTransform;
1460
+ const w = this._shrinkCol(s, d, S, R, o);
1461
+ _ = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
1538
1462
  }
1539
- else if (e === 1 && m >= v && p <= R)
1540
- if (u >= C && f <= S)
1463
+ else if (e === 1 && m >= S && p <= R)
1464
+ if (u >= v && f <= I)
1541
1465
  r.push({ unitId: l, subUnitId: g, drawingId: c });
1542
1466
  else {
1543
- const w = this._shrinkRow(s, d, C, S, o);
1544
- _ = w == null ? void 0 : w.newSheetTransform, I = w == null ? void 0 : w.newTransform;
1467
+ const w = this._shrinkRow(s, d, v, I, o);
1468
+ _ = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
1545
1469
  }
1546
1470
  else if (e === 2) {
1547
- const w = this._expandRow(s, d, C, S, o);
1548
- _ = w == null ? void 0 : w.newSheetTransform, I = w == null ? void 0 : w.newTransform;
1471
+ const w = this._expandRow(s, d, v, I, o);
1472
+ _ = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
1549
1473
  } else if (e === 3) {
1550
- const w = this._expandCol(s, d, v, R, o);
1551
- _ = w == null ? void 0 : w.newSheetTransform, I = w == null ? void 0 : w.newTransform;
1474
+ const w = this._expandCol(s, d, S, R, o);
1475
+ _ = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
1552
1476
  }
1553
- if (_ != null && I != null) {
1554
- const w = L(_, this._selectionRenderService, this._skeletonManagerService);
1477
+ if (_ != null && C != null) {
1478
+ const w = B(_, this._selectionRenderService, this._skeletonManagerService);
1555
1479
  t.push({ ...n, sheetTransform: _, transform: w });
1556
1480
  }
1557
1481
  return { updateDrawings: t, deleteDrawings: r };
1558
1482
  }
1559
1483
  _remainDrawingSize(i, e, n) {
1560
- const t = N({ ...i }, this._selectionRenderService);
1484
+ const t = j({ ...i }, this._selectionRenderService);
1561
1485
  t != null && e.push({
1562
1486
  ...n,
1563
1487
  sheetTransform: t
@@ -1571,60 +1495,60 @@ let ot = class extends ie {
1571
1495
  if (m === y.None)
1572
1496
  this._remainDrawingSize(u, r, a);
1573
1497
  else {
1574
- const { from: f, to: p } = h, { row: C, column: S } = f, { row: v, column: R } = p;
1498
+ const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column: R } = p;
1575
1499
  for (let _ = 0; _ < n.length; _++) {
1576
- const I = n[_], { startRow: w, endRow: O, startColumn: b, endColumn: A } = I;
1500
+ const C = n[_], { startRow: w, endRow: O, startColumn: b, endColumn: A } = C;
1577
1501
  if (R < b)
1578
1502
  continue;
1579
1503
  if (m === y.Position) {
1580
- let D = null, U = null;
1581
- if (S >= b && S <= A) {
1582
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: A, startRow: f.row, endRow: p.row });
1504
+ let M = null, U = null;
1505
+ if (I >= b && I <= A) {
1506
+ const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: A, startRow: f.row, endRow: p.row });
1583
1507
  if (x == null)
1584
1508
  return;
1585
1509
  U = { ...u, left: x.startX };
1586
1510
  }
1587
- if (U != null && (D = N(U, this._selectionRenderService), D != null && U != null)) {
1588
- r.push({ ...a, sheetTransform: D, transform: U });
1511
+ if (U != null && (M = j(U, this._selectionRenderService), M != null && U != null)) {
1512
+ r.push({ ...a, sheetTransform: M, transform: U });
1589
1513
  break;
1590
1514
  }
1591
1515
  this._remainDrawingSize(u, r, a);
1592
1516
  continue;
1593
1517
  }
1594
- if (S >= b && R <= A)
1518
+ if (I >= b && R <= A)
1595
1519
  continue;
1596
- let E = null, M = null;
1597
- if (S >= b && S <= A) {
1598
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: A, startRow: f.row, endRow: p.row });
1599
- if (D == null)
1520
+ let P = null, D = null;
1521
+ if (I >= b && I <= A) {
1522
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: A, startRow: f.row, endRow: p.row });
1523
+ if (M == null)
1600
1524
  return;
1601
- M = {
1525
+ D = {
1602
1526
  ...u,
1603
- left: (D == null ? void 0 : D.startX) || 0,
1604
- width: ((u == null ? void 0 : u.width) || 0) - D.endX + D.startX
1527
+ left: (M == null ? void 0 : M.startX) || 0,
1528
+ width: ((u == null ? void 0 : u.width) || 0) - M.endX + M.startX
1605
1529
  };
1606
1530
  } else if (R >= b && R <= A) {
1607
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: b, endColumn: R, startRow: f.row, endRow: p.row });
1608
- if (D == null)
1531
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: b, endColumn: R, startRow: f.row, endRow: p.row });
1532
+ if (M == null)
1609
1533
  return;
1610
- M = {
1534
+ D = {
1611
1535
  ...u,
1612
- left: D.startX - ((u == null ? void 0 : u.width) || 0)
1536
+ left: M.startX - ((u == null ? void 0 : u.width) || 0)
1613
1537
  };
1614
1538
  } else {
1615
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: b, endColumn: A, startRow: f.row, endRow: p.row });
1616
- if (D == null)
1539
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: b, endColumn: A, startRow: f.row, endRow: p.row });
1540
+ if (M == null)
1617
1541
  return;
1618
- if (M = {
1542
+ if (D = {
1619
1543
  ...u,
1620
- width: ((u == null ? void 0 : u.width) || 0) - D.endX + D.startX
1621
- }, E = N(M, this._selectionRenderService), E != null && M != null) {
1622
- s.push({ ...a, sheetTransform: E, transform: M });
1544
+ width: ((u == null ? void 0 : u.width) || 0) - M.endX + M.startX
1545
+ }, P = j(D, this._selectionRenderService), P != null && D != null) {
1546
+ s.push({ ...a, sheetTransform: P, transform: D });
1623
1547
  break;
1624
1548
  }
1625
1549
  }
1626
- if (M != null && (E = N(M, this._selectionRenderService)), M != null && E != null) {
1627
- r.push({ ...a, sheetTransform: E, transform: M });
1550
+ if (D != null && (P = j(D, this._selectionRenderService)), D != null && P != null) {
1551
+ r.push({ ...a, sheetTransform: P, transform: D });
1628
1552
  break;
1629
1553
  } else
1630
1554
  this._remainDrawingSize(u, r, a);
@@ -1646,11 +1570,11 @@ let ot = class extends ie {
1646
1570
  }
1647
1571
  _createUndoAndRedoMutation(i, e, n) {
1648
1572
  const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, d = [
1649
- { id: P.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: T.UPDATE } },
1650
- { id: j.id, params: [i] }
1573
+ { id: T.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: E.UPDATE } },
1574
+ { id: W.id, params: [i] }
1651
1575
  ], l = [
1652
- { id: P.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: T.UPDATE } },
1653
- { id: j.id, params: [i] }
1576
+ { id: T.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: E.UPDATE } },
1577
+ { id: W.id, params: [i] }
1654
1578
  ];
1655
1579
  return {
1656
1580
  redos: d,
@@ -1665,60 +1589,60 @@ let ot = class extends ie {
1665
1589
  if (m === y.None)
1666
1590
  this._remainDrawingSize(u, r, a);
1667
1591
  else {
1668
- const { from: f, to: p } = h, { row: C, column: S } = f, { row: v, column: R } = p;
1592
+ const { from: f, to: p } = h, { row: v, column: I } = f, { row: S, column: R } = p;
1669
1593
  for (let _ = 0; _ < n.length; _++) {
1670
- const I = n[_], { startRow: w, endRow: O, startColumn: b, endColumn: A } = I;
1671
- if (v < w)
1594
+ const C = n[_], { startRow: w, endRow: O, startColumn: b, endColumn: A } = C;
1595
+ if (S < w)
1672
1596
  continue;
1673
1597
  if (m === y.Position) {
1674
- let D = null, U = null;
1675
- if (C >= w && C <= O) {
1676
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: C, endRow: O });
1598
+ let M = null, U = null;
1599
+ if (v >= w && v <= O) {
1600
+ const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: v, endRow: O });
1677
1601
  if (x == null)
1678
1602
  return;
1679
1603
  U = { ...u, top: x.startY };
1680
1604
  }
1681
- if (U != null && (D = N(U, this._selectionRenderService), D != null && U != null)) {
1682
- r.push({ ...a, sheetTransform: D, transform: U });
1605
+ if (U != null && (M = j(U, this._selectionRenderService), M != null && U != null)) {
1606
+ r.push({ ...a, sheetTransform: M, transform: U });
1683
1607
  break;
1684
1608
  }
1685
1609
  this._remainDrawingSize(u, r, a);
1686
1610
  continue;
1687
1611
  }
1688
- if (C >= w && v <= O)
1612
+ if (v >= w && S <= O)
1689
1613
  continue;
1690
- let E = null, M = null;
1691
- if (C >= w && C <= O) {
1692
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: C, endRow: O });
1693
- if (D == null)
1614
+ let P = null, D = null;
1615
+ if (v >= w && v <= O) {
1616
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: v, endRow: O });
1617
+ if (M == null)
1694
1618
  return;
1695
- M = {
1619
+ D = {
1696
1620
  ...u,
1697
- top: (D == null ? void 0 : D.startY) || 0,
1698
- height: ((u == null ? void 0 : u.height) || 0) - D.endY + D.startY
1621
+ top: (M == null ? void 0 : M.startY) || 0,
1622
+ height: ((u == null ? void 0 : u.height) || 0) - M.endY + M.startY
1699
1623
  };
1700
- } else if (v >= w && v <= O) {
1701
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: w, endRow: v });
1702
- if (D == null)
1624
+ } else if (S >= w && S <= O) {
1625
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: w, endRow: S });
1626
+ if (M == null)
1703
1627
  return;
1704
- M = {
1628
+ D = {
1705
1629
  ...u,
1706
- top: D.startY - ((u == null ? void 0 : u.height) || 0)
1630
+ top: M.startY - ((u == null ? void 0 : u.height) || 0)
1707
1631
  };
1708
1632
  } else {
1709
- const D = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: w, endRow: O });
1710
- if (D == null)
1633
+ const M = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: w, endRow: O });
1634
+ if (M == null)
1711
1635
  return;
1712
- if (M = {
1636
+ if (D = {
1713
1637
  ...u,
1714
- height: ((u == null ? void 0 : u.height) || 0) - D.endY + D.startY
1715
- }, E = N(M, this._selectionRenderService), E != null && M != null) {
1716
- s.push({ ...a, sheetTransform: E, transform: M });
1638
+ height: ((u == null ? void 0 : u.height) || 0) - M.endY + M.startY
1639
+ }, P = j(D, this._selectionRenderService), P != null && D != null) {
1640
+ s.push({ ...a, sheetTransform: P, transform: D });
1717
1641
  break;
1718
1642
  }
1719
1643
  }
1720
- if (M != null && (E = N(M, this._selectionRenderService)), M != null && E != null) {
1721
- r.push({ ...a, sheetTransform: E, transform: M });
1644
+ if (D != null && (P = j(D, this._selectionRenderService)), D != null && P != null) {
1645
+ r.push({ ...a, sheetTransform: P, transform: D });
1722
1646
  break;
1723
1647
  } else
1724
1648
  this._remainDrawingSize(u, r, a);
@@ -1746,15 +1670,15 @@ let ot = class extends ie {
1746
1670
  this._remainDrawingSize(g, s, d);
1747
1671
  else {
1748
1672
  const { from: a, to: h } = l, { row: u, column: m } = a, { row: f, column: p } = h;
1749
- for (let C = 0; C < n.length; C++) {
1750
- const S = n[C], { startRow: v, endRow: R, startColumn: _, endColumn: I } = S;
1751
- if (f < v || p < _)
1673
+ for (let v = 0; v < n.length; v++) {
1674
+ const I = n[v], { startRow: S, endRow: R, startColumn: _, endColumn: C } = I;
1675
+ if (f < S || p < _)
1752
1676
  continue;
1753
- if (c === y.Position && (u <= v && f >= R || m <= _ && p >= I)) {
1677
+ if (c === y.Position && (u <= S && f >= R || m <= _ && p >= C)) {
1754
1678
  this._remainDrawingSize(g, s, d);
1755
1679
  continue;
1756
1680
  }
1757
- const w = L(
1681
+ const w = B(
1758
1682
  { ...l },
1759
1683
  this._selectionRenderService,
1760
1684
  this._skeletonManagerService
@@ -1775,7 +1699,7 @@ let ot = class extends ie {
1775
1699
  if (e === "insert")
1776
1700
  n = i.unitId, t = i.subUnitId;
1777
1701
  else {
1778
- const r = ce(this._univerInstanceService);
1702
+ const r = H(this._univerInstanceService);
1779
1703
  if (r == null)
1780
1704
  return;
1781
1705
  n = r.unitId, t = r.subUnitId;
@@ -1783,37 +1707,37 @@ let ot = class extends ie {
1783
1707
  return { unitId: n, subUnitId: t };
1784
1708
  }
1785
1709
  _moveRangeInterceptor(i) {
1786
- var v, R;
1787
- const { toRange: e, fromRange: n } = i, t = ce(this._univerInstanceService);
1710
+ var S, R;
1711
+ const { toRange: e, fromRange: n } = i, t = H(this._univerInstanceService);
1788
1712
  if (!t)
1789
1713
  return { redos: [], undos: [] };
1790
- const { unitId: r, subUnitId: s } = t, o = (R = (v = this._renderManagerService.getRenderById(r)) == null ? void 0 : v.with(q)) == null ? void 0 : R.getCurrentSkeleton();
1714
+ const { unitId: r, subUnitId: s } = t, o = (R = (S = this._renderManagerService.getRenderById(r)) == null ? void 0 : S.with(Q)) == null ? void 0 : R.getCurrentSkeleton();
1791
1715
  if (!o)
1792
1716
  return { redos: [], undos: [] };
1793
- const d = Te(o, n);
1717
+ const d = $e(o, n);
1794
1718
  if (!d)
1795
1719
  return { redos: [], undos: [] };
1796
1720
  const { startX: l, endX: g, startY: c, endY: a } = d, h = this._sheetDrawingService.getDrawingData(r, s), u = [];
1797
1721
  Object.keys(h).forEach((_) => {
1798
- const I = h[_];
1799
- if (I.anchorType !== y.Both)
1722
+ const C = h[_];
1723
+ if (C.anchorType !== y.Both)
1800
1724
  return;
1801
- const { transform: w } = I;
1725
+ const { transform: w } = C;
1802
1726
  if (!w)
1803
1727
  return;
1804
- const { left: O = 0, top: b = 0, width: A = 0, height: E = 0 } = w, { drawingStartX: M, drawingEndX: D, drawingStartY: U, drawingEndY: x } = {
1728
+ const { left: O = 0, top: b = 0, width: A = 0, height: P = 0 } = w, { drawingStartX: D, drawingEndX: M, drawingStartY: U, drawingEndY: x } = {
1805
1729
  drawingStartX: O,
1806
1730
  drawingEndX: O + A,
1807
1731
  drawingStartY: b,
1808
- drawingEndY: b + E
1732
+ drawingEndY: b + P
1809
1733
  };
1810
- l <= M && D <= g && c <= U && x <= a && u.push(I);
1734
+ l <= D && M <= g && c <= U && x <= a && u.push(C);
1811
1735
  });
1812
- const m = [], f = [], p = e.startRow - n.startRow, C = e.startColumn - n.startColumn, S = u.map((_) => {
1813
- const I = _.sheetTransform, w = {
1814
- to: { ...I.to, row: I.to.row + p, column: I.to.column + C },
1815
- from: { ...I.from, row: I.from.row + p, column: I.from.column + C }
1816
- }, O = L(w, this._selectionRenderService, this._skeletonManagerService);
1736
+ const m = [], f = [], p = e.startRow - n.startRow, v = e.startColumn - n.startColumn, I = u.map((_) => {
1737
+ const C = _.sheetTransform, w = {
1738
+ to: { ...C.to, row: C.to.row + p, column: C.to.column + v },
1739
+ from: { ...C.from, row: C.from.row + p, column: C.from.column + v }
1740
+ }, O = B(w, this._selectionRenderService, this._skeletonManagerService);
1817
1741
  return {
1818
1742
  unitId: r,
1819
1743
  subUnitId: s,
@@ -1822,9 +1746,9 @@ let ot = class extends ie {
1822
1746
  sheetTransform: w
1823
1747
  };
1824
1748
  });
1825
- if (S.length) {
1826
- const _ = this._sheetDrawingService.getBatchUpdateOp(S), { undo: I, redo: w, objects: O } = _;
1827
- m.push({ id: P.id, params: { unitId: r, subUnitId: s, op: w, objects: O, type: T.UPDATE } }), f.push({ id: P.id, params: { unitId: r, subUnitId: s, op: I, objects: O, type: T.UPDATE } });
1749
+ if (I.length) {
1750
+ const _ = this._sheetDrawingService.getBatchUpdateOp(I), { undo: C, redo: w, objects: O } = _;
1751
+ m.push({ id: T.id, params: { unitId: r, subUnitId: s, op: w, objects: O, type: E.UPDATE } }), f.push({ id: T.id, params: { unitId: r, subUnitId: s, op: C, objects: O, type: E.UPDATE } });
1828
1752
  }
1829
1753
  return { redos: m, undos: f };
1830
1754
  }
@@ -1834,37 +1758,37 @@ let ot = class extends ie {
1834
1758
  return { redos: [], undos: [] };
1835
1759
  const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, d = s.endRow, l = [], g = [], c = this._sheetDrawingService.getDrawingData(t, r), a = [], h = [];
1836
1760
  if (Object.keys(c).forEach((u) => {
1837
- const m = c[u], { sheetTransform: f, transform: p, anchorType: C = y.Position } = m;
1761
+ const m = c[u], { sheetTransform: f, transform: p, anchorType: v = y.Position } = m;
1838
1762
  if (f == null || p == null)
1839
1763
  return;
1840
- let S, v;
1764
+ let I, S;
1841
1765
  if (e === "insert") {
1842
- const _ = this._expandRow(f, p, o, d, C);
1843
- S = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1766
+ const _ = this._expandRow(f, p, o, d, v);
1767
+ I = _ == null ? void 0 : _.newSheetTransform, S = _ == null ? void 0 : _.newTransform;
1844
1768
  } else {
1845
- const { from: _, to: I } = f, { row: w } = _, { row: O } = I;
1846
- if (C === y.Both && w >= o && O <= d)
1769
+ const { from: _, to: C } = f, { row: w } = _, { row: O } = C;
1770
+ if (v === y.Both && w >= o && O <= d)
1847
1771
  h.push({ unitId: t, subUnitId: r, drawingId: u });
1848
1772
  else {
1849
- const b = this._shrinkRow(f, p, o, d, C);
1850
- S = b == null ? void 0 : b.newSheetTransform, v = b == null ? void 0 : b.newTransform;
1773
+ const b = this._shrinkRow(f, p, o, d, v);
1774
+ I = b == null ? void 0 : b.newSheetTransform, S = b == null ? void 0 : b.newTransform;
1851
1775
  }
1852
1776
  }
1853
- if (!S || !v)
1777
+ if (!I || !S)
1854
1778
  return;
1855
- const R = { unitId: t, subUnitId: r, drawingId: u, transform: v, sheetTransform: S };
1779
+ const R = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
1856
1780
  a.push(R);
1857
1781
  }), a.length === 0 && h.length === 0)
1858
1782
  return { redos: [], undos: [] };
1859
1783
  if (a.length > 0) {
1860
1784
  const u = this._sheetDrawingService.getBatchUpdateOp(a), { undo: m, redo: f, objects: p } = u;
1861
- l.push({ id: P.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.UPDATE } }), g.push({ id: P.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.UPDATE } });
1785
+ l.push({ id: T.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.UPDATE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.UPDATE } });
1862
1786
  }
1863
1787
  if (h.length > 0) {
1864
1788
  const u = this._sheetDrawingService.getBatchRemoveOp(h), m = u.undo, f = u.redo, p = u.objects;
1865
- l.push({ id: P.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.REMOVE } }), g.push({ id: P.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.INSERT } });
1789
+ l.push({ id: T.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.REMOVE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.INSERT } });
1866
1790
  }
1867
- return l.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), {
1791
+ return l.push({ id: W.id, params: [t] }), g.push({ id: W.id, params: [t] }), {
1868
1792
  redos: l,
1869
1793
  undos: g
1870
1794
  };
@@ -1875,43 +1799,43 @@ let ot = class extends ie {
1875
1799
  return { redos: [], undos: [] };
1876
1800
  const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, d = s.endColumn, l = [], g = [], c = this._sheetDrawingService.getDrawingData(t, r), a = [], h = [];
1877
1801
  if (Object.keys(c).forEach((u) => {
1878
- const m = c[u], { sheetTransform: f, transform: p, anchorType: C = y.Position } = m;
1802
+ const m = c[u], { sheetTransform: f, transform: p, anchorType: v = y.Position } = m;
1879
1803
  if (f == null || p == null)
1880
1804
  return;
1881
- let S, v;
1805
+ let I, S;
1882
1806
  if (e === "insert") {
1883
- const _ = this._expandCol(f, p, o, d, C);
1884
- S = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1807
+ const _ = this._expandCol(f, p, o, d, v);
1808
+ I = _ == null ? void 0 : _.newSheetTransform, S = _ == null ? void 0 : _.newTransform;
1885
1809
  } else {
1886
- const { from: _, to: I } = f, { column: w } = _, { column: O } = I;
1887
- if (C === y.Both && w >= o && O <= d)
1810
+ const { from: _, to: C } = f, { column: w } = _, { column: O } = C;
1811
+ if (v === y.Both && w >= o && O <= d)
1888
1812
  h.push({ unitId: t, subUnitId: r, drawingId: u });
1889
1813
  else {
1890
- const b = this._shrinkCol(f, p, o, d, C);
1891
- S = b == null ? void 0 : b.newSheetTransform, v = b == null ? void 0 : b.newTransform;
1814
+ const b = this._shrinkCol(f, p, o, d, v);
1815
+ I = b == null ? void 0 : b.newSheetTransform, S = b == null ? void 0 : b.newTransform;
1892
1816
  }
1893
1817
  }
1894
- if (!S || !v)
1818
+ if (!I || !S)
1895
1819
  return;
1896
- const R = { unitId: t, subUnitId: r, drawingId: u, transform: v, sheetTransform: S };
1820
+ const R = { unitId: t, subUnitId: r, drawingId: u, transform: S, sheetTransform: I };
1897
1821
  a.push(R);
1898
1822
  }), a.length === 0 && h.length === 0)
1899
1823
  return { redos: [], undos: [] };
1900
1824
  if (a.length > 0) {
1901
1825
  const u = this._sheetDrawingService.getBatchUpdateOp(a), { undo: m, redo: f, objects: p } = u;
1902
- l.push({ id: P.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.UPDATE } }), g.push({ id: P.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.UPDATE } });
1826
+ l.push({ id: T.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.UPDATE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.UPDATE } });
1903
1827
  }
1904
1828
  if (h.length > 0) {
1905
1829
  const u = this._sheetDrawingService.getBatchRemoveOp(h), m = u.undo, f = u.redo, p = u.objects;
1906
- l.push({ id: P.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: T.REMOVE } }), g.push({ id: P.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: T.INSERT } });
1830
+ l.push({ id: T.id, params: { unitId: t, subUnitId: r, op: f, objects: p, type: E.REMOVE } }), g.push({ id: T.id, params: { unitId: t, subUnitId: r, op: m, objects: p, type: E.INSERT } });
1907
1831
  }
1908
- return l.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), { redos: l, undos: g };
1832
+ return l.push({ id: W.id, params: [t] }), g.push({ id: W.id, params: [t] }), { redos: l, undos: g };
1909
1833
  }
1910
1834
  _expandCol(i, e, n, t, r = y.Position) {
1911
1835
  const s = t - n + 1, { from: o, to: d } = i, { column: l } = o, { column: g } = d;
1912
1836
  if (r === y.None)
1913
1837
  return {
1914
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1838
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
1915
1839
  newTransform: e
1916
1840
  };
1917
1841
  let c = null, a = null;
@@ -1919,16 +1843,16 @@ let ot = class extends ie {
1919
1843
  const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: d.row });
1920
1844
  if (h == null)
1921
1845
  return;
1922
- a = { ...e, left: (e.left || 0) + h.endX - h.startX }, c = N(a, this._selectionRenderService);
1846
+ a = { ...e, left: (e.left || 0) + h.endX - h.startX }, c = j(a, this._selectionRenderService);
1923
1847
  } else if (g >= t)
1924
1848
  if (r === y.Both)
1925
1849
  c = {
1926
1850
  from: { ...o },
1927
1851
  to: { ...d, column: g + s }
1928
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1852
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
1929
1853
  else
1930
1854
  return {
1931
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1855
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
1932
1856
  newTransform: e
1933
1857
  };
1934
1858
  return c != null && a != null ? {
@@ -1940,7 +1864,7 @@ let ot = class extends ie {
1940
1864
  const s = t - n + 1, { from: o, to: d } = i, { column: l } = o, { column: g } = d;
1941
1865
  if (r === y.None)
1942
1866
  return {
1943
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1867
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
1944
1868
  newTransform: e
1945
1869
  };
1946
1870
  let c = null, a = null;
@@ -1948,7 +1872,7 @@ let ot = class extends ie {
1948
1872
  c = {
1949
1873
  from: { ...o, column: l - s },
1950
1874
  to: { ...d, column: g - s }
1951
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1875
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
1952
1876
  else {
1953
1877
  if (l >= n && g <= t)
1954
1878
  return null;
@@ -1957,10 +1881,10 @@ let ot = class extends ie {
1957
1881
  c = {
1958
1882
  from: { ...o },
1959
1883
  to: { ...d, column: g - s }
1960
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1884
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
1961
1885
  else
1962
1886
  return {
1963
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1887
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
1964
1888
  newTransform: e
1965
1889
  };
1966
1890
  else if (l >= n && l <= t) {
@@ -1972,7 +1896,7 @@ let ot = class extends ie {
1972
1896
  return;
1973
1897
  a = { ...e, left: (e.left || 0) - h.endX + h.startX - i.from.columnOffset };
1974
1898
  }
1975
- c = N(a, this._selectionRenderService);
1899
+ c = j(a, this._selectionRenderService);
1976
1900
  } else if (g >= n && g <= t && r === y.Both) {
1977
1901
  const h = this._skeletonManagerService.attachRangeWithCoord({
1978
1902
  startColumn: n - 1,
@@ -1985,7 +1909,7 @@ let ot = class extends ie {
1985
1909
  c = {
1986
1910
  from: { ...o },
1987
1911
  to: { ...d, column: n - 1, columnOffset: h.endX - h.startX }
1988
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1912
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
1989
1913
  }
1990
1914
  }
1991
1915
  return c != null && a != null ? {
@@ -1997,7 +1921,7 @@ let ot = class extends ie {
1997
1921
  const s = t - n + 1, { from: o, to: d } = i, { row: l } = o, { row: g } = d;
1998
1922
  if (r === y.None)
1999
1923
  return {
2000
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1924
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
2001
1925
  newTransform: e
2002
1926
  };
2003
1927
  let c = null, a = null;
@@ -2005,7 +1929,7 @@ let ot = class extends ie {
2005
1929
  const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: d.column });
2006
1930
  if (h == null)
2007
1931
  return;
2008
- a = { ...e, top: (e.top || 0) + h.endY - h.startY }, c = N(a, this._selectionRenderService);
1932
+ a = { ...e, top: (e.top || 0) + h.endY - h.startY }, c = j(a, this._selectionRenderService);
2009
1933
  } else if (g >= t)
2010
1934
  if (r === y.Both)
2011
1935
  c = {
@@ -2014,10 +1938,10 @@ let ot = class extends ie {
2014
1938
  ...d,
2015
1939
  row: g + s
2016
1940
  }
2017
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1941
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
2018
1942
  else
2019
1943
  return {
2020
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1944
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
2021
1945
  newTransform: e
2022
1946
  };
2023
1947
  return c != null && a != null ? {
@@ -2029,7 +1953,7 @@ let ot = class extends ie {
2029
1953
  const s = t - n + 1, { from: o, to: d } = i, { row: l } = o, { row: g } = d;
2030
1954
  if (r === y.None)
2031
1955
  return {
2032
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1956
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
2033
1957
  newTransform: e
2034
1958
  };
2035
1959
  let c = null, a = null;
@@ -2037,7 +1961,7 @@ let ot = class extends ie {
2037
1961
  c = {
2038
1962
  from: { ...o, row: l - s },
2039
1963
  to: { ...d, row: g - s }
2040
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1964
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
2041
1965
  else {
2042
1966
  if (l >= n && g <= t)
2043
1967
  return null;
@@ -2046,10 +1970,10 @@ let ot = class extends ie {
2046
1970
  c = {
2047
1971
  from: { ...o },
2048
1972
  to: { ...d, row: g - s }
2049
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1973
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
2050
1974
  else
2051
1975
  return {
2052
- newSheetTransform: N({ ...e }, this._selectionRenderService),
1976
+ newSheetTransform: j({ ...e }, this._selectionRenderService),
2053
1977
  newTransform: e
2054
1978
  };
2055
1979
  else if (l >= n && l <= t) {
@@ -2061,7 +1985,7 @@ let ot = class extends ie {
2061
1985
  return;
2062
1986
  a = { ...e, top: (e.top || 0) - h.endY + h.startY - i.from.rowOffset };
2063
1987
  }
2064
- c = N(a, this._selectionRenderService);
1988
+ c = j(a, this._selectionRenderService);
2065
1989
  } else if (g >= n && g <= t && r === y.Both) {
2066
1990
  const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
2067
1991
  if (h == null)
@@ -2069,7 +1993,7 @@ let ot = class extends ie {
2069
1993
  c = {
2070
1994
  from: { ...o },
2071
1995
  to: { ...d, row: n - 1, rowOffset: h.endY - h.startY }
2072
- }, a = L(c, this._selectionRenderService, this._skeletonManagerService);
1996
+ }, a = B(c, this._selectionRenderService, this._skeletonManagerService);
2073
1997
  }
2074
1998
  }
2075
1999
  return c != null && a != null ? {
@@ -2080,7 +2004,7 @@ let ot = class extends ie {
2080
2004
  _commandListener() {
2081
2005
  this.disposeWithMe(
2082
2006
  this._commandService.onCommandExecuted((i) => {
2083
- i.id === Dr.id && setTimeout(() => {
2007
+ i.id === ti.id && setTimeout(() => {
2084
2008
  const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
2085
2009
  Object.keys(r).forEach((d) => {
2086
2010
  const l = r[d];
@@ -2089,7 +2013,7 @@ let ot = class extends ie {
2089
2013
  c != null && Object.keys(c).forEach((a) => {
2090
2014
  if (d === n && g === t) {
2091
2015
  const h = c[a];
2092
- h.transform = L(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(c[a]);
2016
+ h.transform = B(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(c[a]);
2093
2017
  } else
2094
2018
  o.push(c[a]);
2095
2019
  });
@@ -2102,7 +2026,7 @@ let ot = class extends ie {
2102
2026
  _sheetRefreshListener() {
2103
2027
  this.disposeWithMe(
2104
2028
  this._commandService.onCommandExecuted((i) => {
2105
- Fi.includes(i.id) && requestIdleCallback(() => {
2029
+ Qi.includes(i.id) && requestIdleCallback(() => {
2106
2030
  const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
2107
2031
  this._refreshDrawingTransform(n, t, r);
2108
2032
  });
@@ -2117,11 +2041,11 @@ let ot = class extends ie {
2117
2041
  return !0;
2118
2042
  const { from: c, to: a } = d, { row: h, column: u } = c, { row: m, column: f } = a;
2119
2043
  for (let p = 0; p < n.length; p++) {
2120
- const C = n[p], { startRow: S, endRow: v, startColumn: R, endColumn: _ } = C;
2121
- if (Dn.intersects(
2044
+ const v = n[p], { startRow: I, endRow: S, startColumn: R, endColumn: _ } = v;
2045
+ if (qn.intersects(
2122
2046
  {
2123
- startRow: S,
2124
- endRow: v,
2047
+ startRow: I,
2048
+ endRow: S,
2125
2049
  startColumn: R,
2126
2050
  endColumn: _
2127
2051
  },
@@ -2131,39 +2055,409 @@ let ot = class extends ie {
2131
2055
  startColumn: u,
2132
2056
  endColumn: f
2133
2057
  }
2134
- ) || h > v || u > _) {
2135
- const I = g === y.Position, w = L(d, this._selectionRenderService, this._skeletonManagerService);
2058
+ ) || h > S || u > _) {
2059
+ const C = g === y.Position, w = B(d, this._selectionRenderService, this._skeletonManagerService);
2136
2060
  r.push({
2137
2061
  ...o,
2138
2062
  transform: {
2139
2063
  ...w,
2140
- width: I ? l == null ? void 0 : l.width : w == null ? void 0 : w.width,
2141
- height: I ? l == null ? void 0 : l.height : w == null ? void 0 : w.height
2064
+ width: C ? l == null ? void 0 : l.width : w == null ? void 0 : w.width,
2065
+ height: C ? l == null ? void 0 : l.height : w == null ? void 0 : w.height
2142
2066
  }
2143
2067
  });
2144
2068
  break;
2145
2069
  }
2146
2070
  }
2147
- }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(j.id, [i]));
2071
+ }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(W.id, [i]));
2072
+ }
2073
+ };
2074
+ wt = qi([
2075
+ te(1, X),
2076
+ te(2, G),
2077
+ te(3, Ce),
2078
+ te(4, N(Q)),
2079
+ te(5, N(qe)),
2080
+ te(6, z),
2081
+ te(7, q),
2082
+ te(8, fe)
2083
+ ], wt);
2084
+ var J = function() {
2085
+ return J = Object.assign || function(i) {
2086
+ for (var e, n = 1, t = arguments.length; n < t; n++) {
2087
+ e = arguments[n];
2088
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
2089
+ }
2090
+ return i;
2091
+ }, J.apply(this, arguments);
2092
+ }, es = function(i, e) {
2093
+ var n = {};
2094
+ for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
2095
+ if (i != null && typeof Object.getOwnPropertySymbols == "function")
2096
+ for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
2097
+ e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
2098
+ return n;
2099
+ }, Rn = mn(function(i, e) {
2100
+ var n = i.icon, t = i.id, r = i.className, s = i.extend, o = es(i, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = ii("_".concat(rs()));
2101
+ return Mn(n, "".concat(t), { defIds: n.defIds, idSuffix: l.current }, J({ ref: e, className: d }, o), s);
2102
+ });
2103
+ function Mn(i, e, n, t, r) {
2104
+ return fn(i.tag, J(J({ key: e }, ts(i, n, r)), t), (ns(i, n).children || []).map(function(s, o) {
2105
+ return Mn(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
2106
+ }));
2107
+ }
2108
+ function ts(i, e, n) {
2109
+ var t = J({}, i.attrs);
2110
+ n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
2111
+ var r = e.defIds;
2112
+ return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
2113
+ var o = s[0], d = s[1];
2114
+ typeof d == "string" && (t[o] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
2115
+ })), t;
2116
+ }
2117
+ function ns(i, e) {
2118
+ var n, t = e.defIds;
2119
+ return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? J(J({}, i), { children: i.children.map(function(r) {
2120
+ return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? J(J({}, r), { attrs: J(J({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
2121
+ }) }) : i;
2122
+ }
2123
+ function rs() {
2124
+ return Math.random().toString(36).substring(2, 8);
2125
+ }
2126
+ Rn.displayName = "UniverIcon";
2127
+ var is = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Dn = mn(function(i, e) {
2128
+ return fn(Rn, Object.assign({}, i, {
2129
+ id: "add-image-single",
2130
+ ref: e,
2131
+ icon: is
2132
+ }));
2133
+ });
2134
+ Dn.displayName = "AddImageSingle";
2135
+ const bn = {
2136
+ id: "sheet.command.delete-drawing",
2137
+ type: Y.COMMAND,
2138
+ handler: (i) => {
2139
+ const e = i.get(G), t = i.get(z).getFocusDrawings();
2140
+ if (t.length === 0)
2141
+ return !1;
2142
+ const r = t[0].unitId, s = t.map((o) => {
2143
+ const { unitId: d, subUnitId: l, drawingId: g, drawingType: c } = o;
2144
+ return {
2145
+ unitId: d,
2146
+ subUnitId: l,
2147
+ drawingId: g,
2148
+ drawingType: c
2149
+ };
2150
+ });
2151
+ return e.executeCommand(Ze.id, {
2152
+ unitId: r,
2153
+ drawings: s
2154
+ });
2155
+ }
2156
+ }, St = {
2157
+ id: "sheet.command.insert-float-image",
2158
+ type: Y.COMMAND,
2159
+ handler: (i) => {
2160
+ var n, t;
2161
+ return (t = (n = i.get(X).getCurrentTypeOfRenderer(L.UNIVER_SHEET)) == null ? void 0 : n.with(Se).insertFloatImage()) != null ? t : !1;
2162
+ }
2163
+ }, It = {
2164
+ id: "sheet.command.insert-cell-image",
2165
+ type: Y.COMMAND,
2166
+ handler: (i) => {
2167
+ var n, t;
2168
+ return (t = (n = i.get(X).getCurrentTypeOfRenderer(L.UNIVER_SHEET)) == null ? void 0 : n.with(Se).insertCellImage()) != null ? t : !1;
2169
+ }
2170
+ }, Re = {
2171
+ id: "sheet.command.move-drawing",
2172
+ type: Y.COMMAND,
2173
+ handler: (i, e) => {
2174
+ const n = i.get(G), t = i.get(z), r = i.get(Ce), { direction: s } = e, o = t.getFocusDrawings();
2175
+ if (o.length === 0)
2176
+ return !1;
2177
+ const d = o[0].unitId, l = o.map((c) => {
2178
+ const { transform: a } = c;
2179
+ if (a == null)
2180
+ return null;
2181
+ const h = { ...a }, { left: u = 0, top: m = 0 } = a;
2182
+ return s === re.UP ? h.top = m - 1 : s === re.DOWN ? h.top = m + 1 : s === re.LEFT ? h.left = u - 1 : s === re.RIGHT && (h.left = u + 1), {
2183
+ ...c,
2184
+ transform: h,
2185
+ sheetTransform: j(h, r)
2186
+ };
2187
+ }).filter((c) => c != null);
2188
+ return n.syncExecuteCommand(et.id, {
2189
+ unitId: d,
2190
+ drawings: l
2191
+ }) ? (n.syncExecuteCommand(W.id, [d]), !0) : !1;
2192
+ }
2193
+ }, yn = "addition-and-subtraction-single", On = "sheet.menu.image";
2194
+ function ss(i) {
2195
+ return {
2196
+ id: On,
2197
+ type: _t.SUBITEMS,
2198
+ icon: yn,
2199
+ tooltip: "sheetImage.title",
2200
+ hidden$: Ht(i, L.UNIVER_SHEET),
2201
+ disabled$: Tr(i, { workbookTypes: [ut], worksheetTypes: [xe], rangeTypes: [ni] })
2202
+ };
2203
+ }
2204
+ function os(i) {
2205
+ return {
2206
+ id: St.id,
2207
+ title: "sheetImage.upload.float",
2208
+ type: _t.BUTTON,
2209
+ hidden$: Ht(i, L.UNIVER_SHEET)
2210
+ };
2211
+ }
2212
+ function as(i) {
2213
+ return {
2214
+ id: It.id,
2215
+ title: "sheetImage.upload.cell",
2216
+ type: _t.BUTTON
2217
+ };
2218
+ }
2219
+ const cs = "univer-image-common-panel", ds = "univer-image-common-panel-grid", ls = "univer-image-common-panel-border", us = "univer-image-common-panel-title", hs = "univer-image-common-panel-subtitle", gs = "univer-image-common-panel-row", ms = "univer-image-common-panel-row-vertical", fs = "univer-image-common-panel-column", ps = "univer-image-common-panel-column-center", ws = "univer-image-common-panel-inline", _s = "univer-image-common-panel-span2", vs = "univer-image-common-panel-span3", Ss = "univer-image-common-panel-input", Is = "univer-sheet-image-menu", Cs = "univer-sheet-image-menu-input", ne = {
2220
+ imageCommonPanel: cs,
2221
+ imageCommonPanelGrid: ds,
2222
+ imageCommonPanelBorder: ls,
2223
+ imageCommonPanelTitle: us,
2224
+ imageCommonPanelSubtitle: hs,
2225
+ imageCommonPanelRow: gs,
2226
+ imageCommonPanelRowVertical: ms,
2227
+ imageCommonPanelColumn: fs,
2228
+ imageCommonPanelColumnCenter: ps,
2229
+ imageCommonPanelInline: ws,
2230
+ imageCommonPanelSpan2: _s,
2231
+ imageCommonPanelSpan3: vs,
2232
+ imageCommonPanelInput: Ss,
2233
+ sheetImageMenu: Is,
2234
+ sheetImageMenuInput: Cs
2235
+ };
2236
+ function Tn(i) {
2237
+ var e, n, t = "";
2238
+ if (typeof i == "string" || typeof i == "number") t += i;
2239
+ else if (typeof i == "object") if (Array.isArray(i)) {
2240
+ var r = i.length;
2241
+ for (e = 0; e < r; e++) i[e] && (n = Tn(i[e])) && (t && (t += " "), t += n);
2242
+ } else for (n in i) i[n] && (t && (t += " "), t += n);
2243
+ return t;
2244
+ }
2245
+ function je() {
2246
+ for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = Tn(i)) && (t && (t += " "), t += e);
2247
+ return t;
2248
+ }
2249
+ const Rs = (i) => {
2250
+ var S;
2251
+ const e = le(G), n = le(Je), t = le(q), r = le(X), { drawings: s } = i, o = s[0];
2252
+ if (o == null)
2253
+ return;
2254
+ const { unitId: d } = o, l = r.getRenderById(d), g = l == null ? void 0 : l.scene;
2255
+ if (g == null)
2256
+ return;
2257
+ const c = g.getTransformerByCreate(), [a, h] = mt(!0), u = (S = o.anchorType) != null ? S : y.Position, [m, f] = mt(u);
2258
+ function p(R, _) {
2259
+ const C = [];
2260
+ return R.forEach((w) => {
2261
+ const { oKey: O } = w, b = _.getDrawingOKey(O);
2262
+ if (b == null)
2263
+ return C.push(null), !0;
2264
+ const { unitId: A, subUnitId: P, drawingId: D, drawingType: M, anchorType: U, sheetTransform: x } = b;
2265
+ C.push({
2266
+ unitId: A,
2267
+ subUnitId: P,
2268
+ drawingId: D,
2269
+ anchorType: U,
2270
+ sheetTransform: x,
2271
+ drawingType: M
2272
+ });
2273
+ }), C;
2274
+ }
2275
+ vt(() => {
2276
+ const R = c.clearControl$.subscribe((C) => {
2277
+ C === !0 && h(!1);
2278
+ }), _ = c.changeStart$.subscribe((C) => {
2279
+ var b;
2280
+ const { objects: w } = C, O = p(w, t);
2281
+ if (O.length === 0)
2282
+ h(!1);
2283
+ else if (O.length >= 1) {
2284
+ h(!0);
2285
+ const A = ((b = O[0]) == null ? void 0 : b.anchorType) || y.Position;
2286
+ f(A);
2287
+ }
2288
+ });
2289
+ return () => {
2290
+ _.unsubscribe(), R.unsubscribe();
2291
+ };
2292
+ }, []);
2293
+ function v(R) {
2294
+ f(R);
2295
+ const _ = t.getFocusDrawings();
2296
+ if (_.length === 0)
2297
+ return;
2298
+ const C = _.map((w) => ({
2299
+ unitId: w.unitId,
2300
+ subUnitId: w.subUnitId,
2301
+ drawingId: w.drawingId,
2302
+ anchorType: R
2303
+ }));
2304
+ e.executeCommand(et.id, {
2305
+ unitId: _[0].unitId,
2306
+ drawings: C
2307
+ });
2148
2308
  }
2309
+ const I = (R) => R ? "block" : "none";
2310
+ return /* @__PURE__ */ $.jsxs("div", { className: je(ne.imageCommonPanelGrid, ne.imageCommonPanelBorder), style: { display: I(a) }, children: [
2311
+ /* @__PURE__ */ $.jsx("div", { className: ne.imageCommonPanelRow, children: /* @__PURE__ */ $.jsx("div", { className: je(ne.imageCommonPanelColumn, ne.imageCommonPanelTitle), children: /* @__PURE__ */ $.jsx("div", { children: n.t("drawing-anchor.title") }) }) }),
2312
+ /* @__PURE__ */ $.jsx("div", { className: je(ne.imageCommonPanelRow), children: /* @__PURE__ */ $.jsx("div", { className: je(ne.imageCommonPanelColumn), children: /* @__PURE__ */ $.jsxs(ci, { value: m, onChange: v, direction: "vertical", children: [
2313
+ /* @__PURE__ */ $.jsx(ot, { value: y.Both, children: n.t("drawing-anchor.both") }),
2314
+ /* @__PURE__ */ $.jsx(ot, { value: y.Position, children: n.t("drawing-anchor.position") }),
2315
+ /* @__PURE__ */ $.jsx(ot, { value: y.None, children: n.t("drawing-anchor.none") })
2316
+ ] }) }) })
2317
+ ] });
2318
+ }, Ms = () => {
2319
+ const i = le(q), e = i.getFocusDrawings(), [n, t] = mt(e);
2320
+ return vt(() => {
2321
+ const r = i.focus$.subscribe((s) => {
2322
+ t(s);
2323
+ });
2324
+ return () => {
2325
+ r.unsubscribe();
2326
+ };
2327
+ }, []), !!(n != null && n.length) && /* @__PURE__ */ $.jsxs("div", { className: ne.imageCommonPanel, children: [
2328
+ /* @__PURE__ */ $.jsx(fr, { drawings: n }),
2329
+ /* @__PURE__ */ $.jsx(Rs, { drawings: n })
2330
+ ] });
2331
+ }, Ds = {
2332
+ [Wr.FORMULAS_INSERT]: {
2333
+ [On]: {
2334
+ order: 3,
2335
+ menuItemFactory: ss,
2336
+ [St.id]: {
2337
+ order: 0,
2338
+ menuItemFactory: os
2339
+ },
2340
+ [It.id]: {
2341
+ order: 1,
2342
+ menuItemFactory: as
2343
+ }
2344
+ }
2345
+ }
2346
+ };
2347
+ function Me(i) {
2348
+ return !i.getContextValue(Zn) && !i.getContextValue(Qn) && !i.getContextValue(er) && i.getContextValue(ve);
2349
+ }
2350
+ const bs = {
2351
+ id: Re.id,
2352
+ description: "shortcut.sheet.drawing-move-down",
2353
+ group: "4_sheet-drawing-view",
2354
+ binding: ge.ARROW_DOWN,
2355
+ priority: 100,
2356
+ preconditions: Me,
2357
+ staticParameters: {
2358
+ direction: re.DOWN
2359
+ }
2360
+ }, ys = {
2361
+ id: Re.id,
2362
+ description: "shortcut.sheet.drawing-move-up",
2363
+ group: "4_sheet-drawing-view",
2364
+ binding: ge.ARROW_UP,
2365
+ priority: 100,
2366
+ preconditions: Me,
2367
+ staticParameters: {
2368
+ direction: re.UP
2369
+ }
2370
+ }, Os = {
2371
+ id: Re.id,
2372
+ description: "shortcut.sheet.drawing-move-left",
2373
+ group: "4_sheet-drawing-view",
2374
+ binding: ge.ARROW_LEFT,
2375
+ priority: 100,
2376
+ preconditions: Me,
2377
+ staticParameters: {
2378
+ direction: re.LEFT
2379
+ }
2380
+ }, Ts = {
2381
+ id: Re.id,
2382
+ description: "shortcut.sheet.drawing-move-right",
2383
+ group: "4_sheet-drawing-view",
2384
+ binding: ge.ARROW_RIGHT,
2385
+ priority: 100,
2386
+ preconditions: Me,
2387
+ staticParameters: {
2388
+ direction: re.RIGHT
2389
+ }
2390
+ }, Es = {
2391
+ id: bn.id,
2392
+ description: "shortcut.sheet.drawing-delete",
2393
+ group: "4_sheet-drawing-view",
2394
+ // when focusing on any other input tag do not trigger this shortcut
2395
+ preconditions: Me,
2396
+ binding: ge.DELETE,
2397
+ mac: ge.BACKSPACE
2149
2398
  };
2150
- ot = ki([
2151
- Q(1, J),
2152
- Q(2, B),
2153
- Q(3, pe),
2154
- Q(4, W(q)),
2155
- Q(5, W(at)),
2156
- Q(6, F),
2157
- Q(7, K),
2158
- Q(8, fe)
2159
- ], ot);
2160
- var Xi = Object.defineProperty, Hi = Object.getOwnPropertyDescriptor, zi = (i, e, n, t) => {
2161
- for (var r = t > 1 ? void 0 : t ? Hi(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2399
+ var Ps = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, As = (i, e, n, t) => {
2400
+ for (var r = t > 1 ? void 0 : t ? Us(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2162
2401
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2163
- return t && r && Xi(e, n, r), r;
2164
- }, oe = (i, e) => (n, t) => e(n, t, i);
2165
- function Ki(i, e, n, t) {
2166
- const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Kn.VIEW_MAIN), d = {
2402
+ return t && r && Ps(e, n, r), r;
2403
+ }, We = (i, e) => (n, t) => e(n, t, i);
2404
+ let Xe = class extends Z {
2405
+ constructor(i, e, n, t) {
2406
+ super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
2407
+ }
2408
+ _initCustomComponents() {
2409
+ const i = this._componentManager;
2410
+ this.disposeWithMe(i.register(yn, Dn)), this.disposeWithMe(i.register(pn, Ms));
2411
+ }
2412
+ _initMenus() {
2413
+ this._menuManagerService.mergeMenu(Ds);
2414
+ }
2415
+ _initCommands() {
2416
+ [
2417
+ St,
2418
+ It,
2419
+ Qe,
2420
+ Ze,
2421
+ et,
2422
+ wn,
2423
+ W,
2424
+ _n,
2425
+ vn,
2426
+ In,
2427
+ Re,
2428
+ bn,
2429
+ Sn
2430
+ ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
2431
+ }
2432
+ _initShortcuts() {
2433
+ [
2434
+ // sheet drawing shortcuts
2435
+ bs,
2436
+ ys,
2437
+ Os,
2438
+ Ts,
2439
+ Es
2440
+ ].forEach((i) => {
2441
+ this.disposeWithMe(this._shortcutService.registerShortcut(i));
2442
+ });
2443
+ }
2444
+ _init() {
2445
+ this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
2446
+ }
2447
+ };
2448
+ Xe = As([
2449
+ We(0, N(xr)),
2450
+ We(1, $r),
2451
+ We(2, G),
2452
+ We(3, Br)
2453
+ ], Xe);
2454
+ var Ns = Object.defineProperty, js = Object.getOwnPropertyDescriptor, Ws = (i, e, n, t) => {
2455
+ for (var r = t > 1 ? void 0 : t ? js(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2456
+ (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2457
+ return t && r && Ns(e, n, r), r;
2458
+ }, de = (i, e) => (n, t) => e(n, t, i);
2459
+ function xs(i, e, n, t) {
2460
+ const { scaleX: r, scaleY: s } = e.getAncestorScale(), o = e.getViewport(kt.VIEW_MAIN), d = {
2167
2461
  left: !0,
2168
2462
  top: !0
2169
2463
  };
@@ -2172,37 +2466,37 @@ function Ki(i, e, n, t) {
2172
2466
  ...i,
2173
2467
  absolute: d
2174
2468
  };
2175
- const { left: l, right: g, top: c, bottom: a } = i, h = t.getFreeze(), { startColumn: u, startRow: m, xSplit: f, ySplit: p } = h, C = n.getNoMergeCellPositionByIndexWithNoHeader(m - p, u - f), S = n.getNoMergeCellPositionByIndexWithNoHeader(m, u), { rowHeaderWidth: v, columnHeaderHeight: R } = n, _ = S.startX - C.startX, I = S.startY - C.startY, { top: w, left: O, viewportScrollX: b, viewportScrollY: A } = o;
2176
- let E, M;
2177
- l < O ? (d.left = !0, E = (_ + v + (l - O)) * r, M = Math.max(
2469
+ const { left: l, right: g, top: c, bottom: a } = i, h = t.getFreeze(), { startColumn: u, startRow: m, xSplit: f, ySplit: p } = h, v = n.getNoMergeCellPositionByIndexWithNoHeader(m - p, u - f), I = n.getNoMergeCellPositionByIndexWithNoHeader(m, u), { rowHeaderWidth: S, columnHeaderHeight: R } = n, _ = I.startX - v.startX, C = I.startY - v.startY, { top: w, left: O, viewportScrollX: b, viewportScrollY: A } = o;
2470
+ let P, D;
2471
+ l < O ? (d.left = !0, P = (_ + S + (l - O)) * r, D = Math.max(
2178
2472
  Math.min(
2179
- (_ + v + (g - O)) * r,
2180
- (_ + v) * r
2473
+ (_ + S + (g - O)) * r,
2474
+ (_ + S) * r
2181
2475
  ),
2182
2476
  (g - b) * r
2183
- )) : (d.left = !1, E = Math.max((l - b) * r, (_ + v) * r), M = Math.max((g - b) * r, (_ + v) * r));
2184
- let D, U;
2185
- return c < w ? (d.top = !0, D = (I + R + (c - w)) * s, U = Math.max(
2477
+ )) : (d.left = !1, P = Math.max((l - b) * r, (_ + S) * r), D = Math.max((g - b) * r, (_ + S) * r));
2478
+ let M, U;
2479
+ return c < w ? (d.top = !0, M = (C + R + (c - w)) * s, U = Math.max(
2186
2480
  Math.min(
2187
- (I + R + (g - w)) * s,
2188
- (I + R) * s
2481
+ (C + R + (g - w)) * s,
2482
+ (C + R) * s
2189
2483
  ),
2190
2484
  (a - A) * s
2191
- )) : (d.top = !1, D = Math.max((c - A) * s, (I + R) * s), U = Math.max((a - A) * s, (I + R) * s)), {
2192
- left: E,
2193
- right: M,
2194
- top: D,
2485
+ )) : (d.top = !1, M = Math.max((c - A) * s, (C + R) * s), U = Math.max((a - A) * s, (C + R) * s)), {
2486
+ left: P,
2487
+ right: D,
2488
+ top: M,
2195
2489
  bottom: U,
2196
2490
  absolute: d
2197
2491
  };
2198
2492
  }
2199
- const Qe = (i, e, n, t) => {
2493
+ const dt = (i, e, n, t) => {
2200
2494
  const { scene: r } = e, { left: s, top: o, width: d, height: l, angle: g } = i, c = {
2201
2495
  left: s,
2202
2496
  right: s + d,
2203
2497
  top: o,
2204
2498
  bottom: o + l
2205
- }, a = Ki(c, r, n, t), { scaleX: h, scaleY: u } = r.getAncestorScale();
2499
+ }, a = xs(c, r, n, t), { scaleX: h, scaleY: u } = r.getAncestorScale();
2206
2500
  return {
2207
2501
  startX: a.left,
2208
2502
  endX: a.right,
@@ -2214,22 +2508,22 @@ const Qe = (i, e, n, t) => {
2214
2508
  absolute: a.absolute
2215
2509
  };
2216
2510
  };
2217
- let $e = class extends ie {
2511
+ let ze = class extends Z {
2218
2512
  constructor(e, n, t, r, s, o, d) {
2219
2513
  super();
2220
- V(this, "_domLayerMap", /* @__PURE__ */ new Map());
2221
- V(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2222
- V(this, "_transformChange$", new Ke());
2223
- V(this, "transformChange$", this._transformChange$.asObservable());
2224
- V(this, "_add$", new Ke());
2225
- V(this, "add$", this._add$.asObservable());
2226
- V(this, "_remove$", new Ke());
2227
- V(this, "remove$", this._remove$.asObservable());
2228
- V(this, "_hooks", []);
2514
+ F(this, "_domLayerMap", /* @__PURE__ */ new Map());
2515
+ F(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2516
+ F(this, "_transformChange$", new it());
2517
+ F(this, "transformChange$", this._transformChange$.asObservable());
2518
+ F(this, "_add$", new it());
2519
+ F(this, "add$", this._add$.asObservable());
2520
+ F(this, "_remove$", new it());
2521
+ F(this, "remove$", this._remove$.asObservable());
2522
+ F(this, "_hooks", []);
2229
2523
  this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = d, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
2230
2524
  }
2231
2525
  _bindScrollEvent() {
2232
- this._lifecycleService.lifecycle$.pipe(re((e) => e === bn.Rendered), mr(1)).subscribe(() => {
2526
+ this._lifecycleService.lifecycle$.pipe(se((e) => e === nr.Rendered), Gr(1)).subscribe(() => {
2233
2527
  this._scrollUpdateListener();
2234
2528
  });
2235
2529
  }
@@ -2263,18 +2557,18 @@ let $e = class extends ie {
2263
2557
  // eslint-disable-next-line max-lines-per-function
2264
2558
  this._drawingManagerService.add$.subscribe((e) => {
2265
2559
  e.forEach((n) => {
2266
- var ut, ht, gt;
2267
- const { unitId: t, subUnitId: r, drawingId: s } = n, o = ce(this._univerInstanceService, { unitId: t, subUnitId: r }), d = this._drawingManagerService.getDrawingByParam(n), l = this._univerInstanceService.getUnit(t);
2560
+ var Rt, Mt, Dt;
2561
+ const { unitId: t, subUnitId: r, drawingId: s } = n, o = H(this._univerInstanceService, { unitId: t, subUnitId: r }), d = this._drawingManagerService.getDrawingByParam(n), l = this._univerInstanceService.getUnit(t, L.UNIVER_SHEET);
2268
2562
  if (!l)
2269
2563
  return;
2270
2564
  const g = l.getActiveSheet().getSheetId();
2271
2565
  if (!d || !o)
2272
2566
  return;
2273
- const c = (ut = this._renderManagerService.getRenderById(t)) == null ? void 0 : ut.with(q).getWorksheetSkeleton(r);
2567
+ const c = (Rt = this._renderManagerService.getRenderById(t)) == null ? void 0 : Rt.with(Q).getWorksheetSkeleton(r);
2274
2568
  if (!c)
2275
2569
  return;
2276
2570
  const { transform: a, drawingType: h, data: u } = d;
2277
- if (h !== k.DRAWING_DOM && h !== k.DRAWING_CHART)
2571
+ if (h !== V.DRAWING_DOM && h !== V.DRAWING_CHART)
2278
2572
  return;
2279
2573
  const m = this._getSceneAndTransformerByDrawingSearch(t);
2280
2574
  if (m == null)
@@ -2284,57 +2578,57 @@ let $e = class extends ie {
2284
2578
  return !0;
2285
2579
  if (g !== r)
2286
2580
  return;
2287
- const { left: C, top: S, width: v, height: R, angle: _, flipX: I, flipY: w, skewX: O, skewY: b } = a, A = ze({ unitId: t, subUnitId: r, drawingId: s }), E = f.getObject(A);
2288
- if (E != null) {
2289
- E.transformByState({ left: C, top: S, width: v, height: R, angle: _, flipX: I, flipY: w, skewX: O, skewY: b });
2581
+ const { left: v, top: I, width: S, height: R, angle: _, flipX: C, flipY: w, skewX: O, skewY: b } = a, A = rt({ unitId: t, subUnitId: r, drawingId: s }), P = f.getObject(A);
2582
+ if (P != null) {
2583
+ P.transformByState({ left: v, top: I, width: S, height: R, angle: _, flipX: C, flipY: w, skewX: O, skewY: b });
2290
2584
  return;
2291
2585
  }
2292
- const M = {
2293
- left: C,
2294
- top: S,
2295
- width: v,
2586
+ const D = {
2587
+ left: v,
2588
+ top: I,
2589
+ width: S,
2296
2590
  height: R,
2297
2591
  zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
2298
- }, D = h === k.DRAWING_CHART;
2299
- D && (M.fill = "white", M.rotateEnabled = !1, u && u.border && (M.stroke = u.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8);
2300
- const U = new wt(A, M);
2301
- D && U.setObjectType(Hn.CHART), f.addObject(U, zn), d.allowTransform !== !1 && f.attachTransformerTo(U);
2302
- const x = this._ensureMap(t, r), Z = new yn(), hn = Qe(U, m.renderObject, c.skeleton, o.worksheet), Fe = new fr(hn), gn = {
2303
- dispose: Z,
2592
+ }, M = h === V.DRAWING_CHART;
2593
+ M && (D.fill = "white", D.rotateEnabled = !1, u && u.border && (D.stroke = u.border), D.paintFirst = "stroke", D.strokeWidth = 1, D.borderEnabled = !1, D.radius = 8);
2594
+ const U = new Ut(A, D);
2595
+ M && U.setObjectType(vr.CHART), f.addObject(U, Sr), d.allowTransform !== !1 && f.attachTransformerTo(U);
2596
+ const x = this._ensureMap(t, r), ee = new rr(), Un = dt(U, m.renderObject, c.skeleton, o.worksheet), tt = new Fr(Un), An = {
2597
+ dispose: ee,
2304
2598
  rect: U,
2305
- position$: Fe,
2599
+ position$: tt,
2306
2600
  unitId: t,
2307
2601
  subUnitId: r
2308
2602
  };
2309
2603
  this._canvasFloatDomService.addFloatDom({
2310
- position$: Fe,
2604
+ position$: tt,
2311
2605
  id: s,
2312
2606
  componentKey: d.componentKey,
2313
- onPointerDown: (G) => {
2314
- p.dispatchEvent(new PointerEvent(G.type, G));
2607
+ onPointerDown: (k) => {
2608
+ p.dispatchEvent(new PointerEvent(k.type, k));
2315
2609
  },
2316
- onPointerMove: (G) => {
2317
- p.dispatchEvent(new PointerEvent(G.type, G));
2610
+ onPointerMove: (k) => {
2611
+ p.dispatchEvent(new PointerEvent(k.type, k));
2318
2612
  },
2319
- onPointerUp: (G) => {
2320
- p.dispatchEvent(new PointerEvent(G.type, G));
2613
+ onPointerUp: (k) => {
2614
+ p.dispatchEvent(new PointerEvent(k.type, k));
2321
2615
  },
2322
- onWheel: (G) => {
2323
- p.dispatchEvent(new WheelEvent(G.type, G));
2616
+ onWheel: (k) => {
2617
+ p.dispatchEvent(new WheelEvent(k.type, k));
2324
2618
  },
2325
- props: (gt = (ht = x.get(s)) == null ? void 0 : ht.props) != null ? gt : this._getFloatDomProps(s),
2619
+ props: (Dt = (Mt = x.get(s)) == null ? void 0 : Mt.props) != null ? Dt : this._getFloatDomProps(s),
2326
2620
  data: u,
2327
2621
  unitId: t
2328
2622
  });
2329
- const lt = U.onTransformChange$.subscribeEvent(() => {
2330
- const G = Qe(U, m.renderObject, c.skeleton, o.worksheet);
2331
- Fe.next(
2332
- G
2623
+ const Ct = U.onTransformChange$.subscribeEvent(() => {
2624
+ const k = dt(U, m.renderObject, c.skeleton, o.worksheet);
2625
+ tt.next(
2626
+ k
2333
2627
  );
2334
2628
  });
2335
- Z.add(() => {
2629
+ ee.add(() => {
2336
2630
  this._canvasFloatDomService.removeFloatDom(s);
2337
- }), lt && Z.add(lt), this._domLayerInfoMap.set(s, gn), x.set(s, {
2631
+ }), Ct && ee.add(Ct), this._domLayerInfoMap.set(s, An), x.set(s, {
2338
2632
  ...x.get(s)
2339
2633
  });
2340
2634
  });
@@ -2342,7 +2636,7 @@ let $e = class extends ie {
2342
2636
  ), this.disposeWithMe(
2343
2637
  this._drawingManagerService.remove$.subscribe((e) => {
2344
2638
  e.forEach((n) => {
2345
- const { unitId: t, subUnitId: r, drawingId: s } = n, o = ze({ unitId: t, subUnitId: r, drawingId: s }), d = this._getSceneAndTransformerByDrawingSearch(t);
2639
+ const { unitId: t, subUnitId: r, drawingId: s } = n, o = rt({ unitId: t, subUnitId: r, drawingId: s }), d = this._getSceneAndTransformerByDrawingSearch(t);
2346
2640
  if (d == null)
2347
2641
  return;
2348
2642
  const { transformer: l, scene: g } = d, c = g.getObject(o);
@@ -2354,39 +2648,39 @@ let $e = class extends ie {
2354
2648
  _scrollUpdateListener() {
2355
2649
  const e = (n, t) => {
2356
2650
  var g;
2357
- const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), d = ce(this._univerInstanceService, { unitId: n, subUnitId: t }), l = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(q).getWorksheetSkeleton(t);
2651
+ const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), d = H(this._univerInstanceService, { unitId: n, subUnitId: t }), l = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(Q).getWorksheetSkeleton(t);
2358
2652
  !r || !d || !l || o.forEach((c) => {
2359
2653
  const a = this._domLayerInfoMap.get(c);
2360
2654
  if (a) {
2361
- const h = Qe(a.rect, r.renderObject, l.skeleton, d.worksheet);
2655
+ const h = dt(a.rect, r.renderObject, l.skeleton, d.worksheet);
2362
2656
  a.position$.next(h);
2363
2657
  }
2364
2658
  });
2365
2659
  };
2366
2660
  this.disposeWithMe(
2367
- this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(
2368
- re((n) => !!n),
2369
- St((n) => n.activeSheet$),
2370
- re((n) => !!n),
2371
- Ee((n) => {
2661
+ this._univerInstanceService.getCurrentTypeOfUnit$(L.UNIVER_SHEET).pipe(
2662
+ se((n) => !!n),
2663
+ jt((n) => n.activeSheet$),
2664
+ se((n) => !!n),
2665
+ Be((n) => {
2372
2666
  const t = this._renderManagerService.getRenderById(n.getUnitId());
2373
2667
  return t ? { render: t, unitId: n.getUnitId(), subUnitId: n.getSheetId() } : null;
2374
2668
  }),
2375
- re((n) => !!n),
2376
- St(
2377
- (n) => On(n.render.scene.getViewport(nr.VIEW_MAIN).onScrollAfter$).pipe(Ee(() => ({ unitId: n.unitId, subUnitId: n.subUnitId })))
2669
+ se((n) => !!n),
2670
+ jt(
2671
+ (n) => ir(n.render.scene.getViewport(kt.VIEW_MAIN).onScrollAfter$).pipe(Be(() => ({ unitId: n.unitId, subUnitId: n.subUnitId })))
2378
2672
  )
2379
2673
  ).subscribe(({ unitId: n, subUnitId: t }) => {
2380
2674
  e(n, t);
2381
2675
  })
2382
2676
  ), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
2383
2677
  var t, r;
2384
- if (n.id === rr.id) {
2678
+ if (n.id === Er.id) {
2385
2679
  const s = n.params, { unitId: o } = s;
2386
2680
  Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((l) => {
2387
2681
  e(o, l);
2388
2682
  });
2389
- } else if (n.id === Mr.id) {
2683
+ } else if (n.id === ri.id) {
2390
2684
  const { unitId: s, subUnitId: o } = n.params;
2391
2685
  e(s, o);
2392
2686
  }
@@ -2394,7 +2688,7 @@ let $e = class extends ie {
2394
2688
  }
2395
2689
  _getPosition(e, n) {
2396
2690
  var h;
2397
- const { startX: t, endX: r, startY: s, endY: o } = e, d = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(pe);
2691
+ const { startX: t, endX: r, startY: s, endY: o } = e, d = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(Ce);
2398
2692
  if (d == null)
2399
2693
  return;
2400
2694
  const l = d.getCellWithCoordByOffset(t, s);
@@ -2424,7 +2718,7 @@ let $e = class extends ie {
2424
2718
  this._drawingManagerService.update$.subscribe((e) => {
2425
2719
  e.forEach((n) => {
2426
2720
  const t = this._drawingManagerService.getDrawingByParam(n);
2427
- if (!t || t.drawingType !== k.DRAWING_DOM && t.drawingType !== k.DRAWING_CHART)
2721
+ if (!t || t.drawingType !== V.DRAWING_DOM && t.drawingType !== V.DRAWING_CHART)
2428
2722
  return;
2429
2723
  const r = {
2430
2724
  ...t.transform
@@ -2446,18 +2740,18 @@ let $e = class extends ie {
2446
2740
  updateFloatDomProps(e, n, t, r) {
2447
2741
  const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(e);
2448
2742
  if (s && o) {
2449
- const { scene: d } = o, l = ze({ unitId: e, subUnitId: n, drawingId: t }), g = d.getObject(l);
2450
- g && g instanceof wt && g.setProps(r);
2743
+ const { scene: d } = o, l = rt({ unitId: e, subUnitId: n, drawingId: t }), g = d.getObject(l);
2744
+ g && g instanceof Ut && g.setProps(r);
2451
2745
  }
2452
2746
  }
2453
2747
  addFloatDomToPosition(e, n) {
2454
- const t = ce(this._univerInstanceService, {
2748
+ const t = H(this._univerInstanceService, {
2455
2749
  unitId: e.unitId,
2456
2750
  subUnitId: e.subUnitId
2457
2751
  });
2458
2752
  if (!t)
2459
2753
  throw new Error("cannot find current target!");
2460
- const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: d, data: l, allowTransform: g = !0 } = e, c = n != null ? n : Pn(), a = this._getPosition(o, r);
2754
+ const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: d, data: l, allowTransform: g = !0 } = e, c = n != null ? n : sr(), a = this._getPosition(o, r);
2461
2755
  if (a == null)
2462
2756
  return;
2463
2757
  this._ensureMap(r, s).set(c, e);
@@ -2465,7 +2759,7 @@ let $e = class extends ie {
2465
2759
  unitId: r,
2466
2760
  subUnitId: s,
2467
2761
  drawingId: c,
2468
- drawingType: e.type || k.DRAWING_DOM,
2762
+ drawingType: e.type || V.DRAWING_DOM,
2469
2763
  componentKey: d,
2470
2764
  sheetTransform: a,
2471
2765
  transform: {
@@ -2477,7 +2771,7 @@ let $e = class extends ie {
2477
2771
  data: l,
2478
2772
  allowTransform: g
2479
2773
  };
2480
- return this._commandService.executeCommand(ke.id, {
2774
+ return this._commandService.executeCommand(Qe.id, {
2481
2775
  unitId: r,
2482
2776
  drawings: [u]
2483
2777
  }), this._add$.next({ unitId: r, subUnitId: s, id: c }), {
@@ -2500,7 +2794,7 @@ let $e = class extends ie {
2500
2794
  if (!l)
2501
2795
  return;
2502
2796
  const g = this._sheetDrawingService.getBatchRemoveOp([l]), { redo: c, objects: a } = g;
2503
- this._commandService.syncExecuteCommand(P.id, { unitId: r, subUnitId: s, op: c, objects: a, type: T.REMOVE });
2797
+ this._commandService.syncExecuteCommand(T.id, { unitId: r, subUnitId: s, op: c, objects: a, type: E.REMOVE });
2504
2798
  }
2505
2799
  }
2506
2800
  addHook(e) {
@@ -2512,86 +2806,92 @@ let $e = class extends ie {
2512
2806
  };
2513
2807
  }
2514
2808
  };
2515
- $e = zi([
2516
- oe(0, W(J)),
2517
- oe(1, fe),
2518
- oe(2, W(B)),
2519
- oe(3, K),
2520
- oe(4, W(gr)),
2521
- oe(5, F),
2522
- oe(6, W(Mn))
2523
- ], $e);
2524
- var ln = Object.defineProperty, Ji = Object.getOwnPropertyDescriptor, Zi = (i, e, n) => e in i ? ln(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, qi = (i, e, n, t) => {
2525
- for (var r = t > 1 ? void 0 : t ? Ji(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2809
+ ze = Ws([
2810
+ de(0, N(X)),
2811
+ de(1, fe),
2812
+ de(2, N(G)),
2813
+ de(3, q),
2814
+ de(4, N(Lr)),
2815
+ de(5, z),
2816
+ de(6, N(tr))
2817
+ ], ze);
2818
+ var En = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, Bs = (i, e, n) => e in i ? En(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Ls = (i, e, n, t) => {
2819
+ for (var r = t > 1 ? void 0 : t ? $s(e, n) : e, s = i.length - 1, o; s >= 0; s--)
2526
2820
  (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
2527
- return t && r && ln(e, n, r), r;
2528
- }, et = (i, e) => (n, t) => e(n, t, i), un = (i, e, n) => Zi(i, typeof e != "symbol" ? e + "" : e, n);
2529
- const Qi = "SHEET_IMAGE_UI_PLUGIN";
2530
- let Le = class extends En {
2531
- constructor(i = Pr, e, n, t) {
2821
+ return t && r && En(e, n, r), r;
2822
+ }, lt = (i, e) => (n, t) => e(n, t, i), Pn = (i, e, n) => Bs(i, typeof e != "symbol" ? e + "" : e, n);
2823
+ const Gs = "SHEET_IMAGE_UI_PLUGIN";
2824
+ let Ke = class extends ar {
2825
+ constructor(i = li, e, n, t) {
2532
2826
  super(), this._config = i, this._injector = e, this._renderManagerService = n, this._configService = t;
2533
2827
  const { menu: r, ...s } = this._config;
2534
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Or, s);
2828
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(di, s);
2535
2829
  }
2536
2830
  onStarting() {
2537
- Un(this._injector, [
2538
- [$e],
2539
- [Ne],
2540
- [Ue],
2541
- [xe],
2542
- [We],
2543
- [je]
2544
- ]), Xe(this._injector, [
2545
- [$e]
2831
+ cr(this._injector, [
2832
+ [ze],
2833
+ [Xe],
2834
+ [Le],
2835
+ [Ye],
2836
+ [He],
2837
+ [ke],
2838
+ [Ge],
2839
+ [Ve],
2840
+ [Fe]
2841
+ ]), nt(this._injector, [
2842
+ [ze]
2546
2843
  ]);
2547
2844
  }
2548
2845
  onReady() {
2549
- Xe(this._injector, [
2550
- [je]
2846
+ nt(this._injector, [
2847
+ [ke]
2551
2848
  ]);
2552
2849
  }
2553
2850
  onRendered() {
2554
- this._registerRenderModules(), Xe(this._injector, [
2555
- [We],
2556
- [xe],
2557
- [Ne]
2851
+ this._registerRenderModules(), nt(this._injector, [
2852
+ [He],
2853
+ [Ye],
2854
+ [Xe],
2855
+ [Ge],
2856
+ [Ve],
2857
+ [Fe]
2558
2858
  ]);
2559
2859
  }
2560
2860
  onSteady() {
2561
- this._injector.get(Ue);
2861
+ this._injector.get(Le);
2562
2862
  }
2563
2863
  _registerRenderModules() {
2564
2864
  [
2565
- [Ae],
2566
- [ot],
2567
- [st]
2865
+ [Se],
2866
+ [wt],
2867
+ [ft]
2568
2868
  ].forEach((i) => {
2569
- this.disposeWithMe(this._renderManagerService.registerRenderModule(Y.UNIVER_SHEET, i));
2869
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(L.UNIVER_SHEET, i));
2570
2870
  });
2571
2871
  }
2572
2872
  };
2573
- un(Le, "type", Y.UNIVER_SHEET);
2574
- un(Le, "pluginName", Qi);
2575
- Le = qi([
2576
- Tn(xn, Yn, Jn),
2577
- et(1, W(Rt)),
2578
- et(2, J),
2579
- et(3, An)
2580
- ], Le);
2873
+ Pn(Ke, "type", L.UNIVER_SHEET);
2874
+ Pn(Ke, "pluginName", Gs);
2875
+ Ke = Ls([
2876
+ or(lr, pr, Ir),
2877
+ lt(1, N(Ie)),
2878
+ lt(2, X),
2879
+ lt(3, dr)
2880
+ ], Ke);
2581
2881
  export {
2582
- j as ClearSheetDrawingTransformerOperation,
2583
- nn as DeleteDrawingsCommand,
2584
- Jt as EditSheetDrawingOperation,
2585
- rn as GroupSheetDrawingCommand,
2586
- cn as IMAGE_MENU_ID,
2587
- dt as InsertFloatImageCommand,
2588
- ke as InsertSheetDrawingCommand,
2589
- we as MoveDrawingsCommand,
2590
- Ge as RemoveSheetDrawingCommand,
2591
- sn as SetDrawingArrangeCommand,
2592
- Ye as SetSheetDrawingCommand,
2593
- $e as SheetCanvasFloatDomManagerService,
2594
- Kt as SidebarSheetDrawingOperation,
2595
- on as UngroupSheetDrawingCommand,
2596
- Le as UniverSheetsDrawingUIPlugin
2882
+ W as ClearSheetDrawingTransformerOperation,
2883
+ bn as DeleteDrawingsCommand,
2884
+ _n as EditSheetDrawingOperation,
2885
+ vn as GroupSheetDrawingCommand,
2886
+ St as InsertFloatImageCommand,
2887
+ Qe as InsertSheetDrawingCommand,
2888
+ Re as MoveDrawingsCommand,
2889
+ Ze as RemoveSheetDrawingCommand,
2890
+ On as SHEETS_IMAGE_MENU_ID,
2891
+ Sn as SetDrawingArrangeCommand,
2892
+ et as SetSheetDrawingCommand,
2893
+ ze as SheetCanvasFloatDomManagerService,
2894
+ wn as SidebarSheetDrawingOperation,
2895
+ In as UngroupSheetDrawingCommand,
2896
+ Ke as UniverSheetsDrawingUIPlugin
2597
2897
  };