@univerjs/docs-drawing-ui 0.8.0-beta.0 → 0.8.0-nightly.202505271607

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/index.js CHANGED
@@ -1,123 +1,68 @@
1
- var kn = Object.defineProperty;
2
- var Fn = (r, e, t) => e in r ? kn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var Ie = (r, e, t) => Fn(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as St, JSONX as $, MemoryCursor as Wn, TextXActionType as Y, IUndoRedoService as Yt, BuildTextUtils as Hn, ArrangeTypeEnum as Qe, Tools as be, Inject as Z, IContextService as Zt, LocaleService as ut, Disposable as Le, WrapTextType as Xe, PositionedObjectLayoutType as F, BooleanNumber as oe, DrawingTypeEnum as Ne, ObjectRelativeFromV as W, ObjectRelativeFromH as J, FOCUSING_COMMON_DRAWINGS as rt, UniverInstanceType as we, Direction as fe, DocumentFlavor as mt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Dt, FOCUSING_UNIVER_EDITOR as Gn, UndoCommand as jn, RedoCommand as Vn, DisposableCollection as $n, toDisposable as De, fromEventSubject as Qt, generateRandomId as zn, Injector as Jt, DOC_DRAWING_PRINTING_COMPONENT_KEY as Xn, throttle as Rt, COLORS as qn, RxDisposable as Kn, LifecycleService as Yn, LifecycleStages as At, DependentOn as Zn, IConfigService as Qn, Plugin as Jn, merge as er } from "@univerjs/core";
5
- import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as tr } from "@univerjs/docs-drawing";
6
- import { IImageIoService as nr, IDrawingManagerService as pe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as rr, DRAWING_IMAGE_COUNT_LIMIT as Pt, ImageUploadStatusType as vt, DRAWING_IMAGE_ALLOW_SIZE as ir, getImageSize as or, getDrawingShapeKeyByDrawingSearch as sr, DRAWING_IMAGE_WIDTH_LIMIT as xt, DRAWING_IMAGE_HEIGHT_LIMIT as Nt, UniverDrawingPlugin as ar } from "@univerjs/drawing";
7
- import { DrawingCommonPanel as cr, DrawingRenderService as en, ImageCropperObject as dr, COMPONENT_IMAGE_POPUP_MENU as gr, OpenImageCropOperation as lr, ImageResetSizeOperation as ur, UniverDrawingUIPlugin as fr } from "@univerjs/drawing-ui";
8
- import { IRenderManagerService as Q, DocumentEditArea as We, getCurrentTypeOfRenderer as hr, CURSOR_TYPE as Lt, Liquid as tn, PageLayoutType as Ut, DocumentSkeletonPageType as Bt, Vector2 as pr, Rect as mr, getColor as vr, TRANSFORM_CHANGE_OBSERVABLE_TYPE as wr } from "@univerjs/engine-render";
9
- import { IMessageService as Ir, ILocalFileService as _r, ISidebarService as Sr, useDependency as ve, getMenuHiddenObservable as nn, MenuItemType as rn, RibbonInsertGroup as Dr, KeyCode as He, ComponentManager as on, IMenuManagerService as Or, IShortcutService as yr, CanvasFloatDomService as Tr, PrintFloatDomSingle as Mr, connectInjector as br, UniverUIPlugin as Cr } from "@univerjs/ui";
10
- import { RichTextEditingMutation as ee, DocSelectionManagerService as Ot, DocSkeletonManagerService as te } from "@univerjs/docs";
11
- import { DocSelectionRenderService as Ce, getRichTextEditPath as qe, getCustomBlockIdsInSelections as Er, docDrawingPositionToTransform as sn, VIEWPORT_KEY as an, SetDocZoomRatioOperation as cn, DocPrintInterceptorService as Rr, NodePositionConvertToCursor as kt, getOneTextSelectionRange as Ft, getAnchorBounding as Ar, TEXT_RANGE_LAYER_INDEX as Pr, getDocObject as xr, DocCanvasPopManagerService as Nr, IEditorService as Lr } from "@univerjs/docs-ui";
12
- import { MessageType as Wt, clsx as dn, InputNumber as Fe, Select as Ht, Checkbox as Ur, RadioGroup as Gt, Radio as Me, render as Br, unmount as kr } from "@univerjs/design";
13
- import { BehaviorSubject as yt, debounceTime as gn, Observable as Fr, map as jt, switchMap as Wr, of as Hr, takeUntil as Vt, filter as $t } from "rxjs";
14
- import { jsxs as X, jsx as T } from "react/jsx-runtime";
15
- import { forwardRef as ln, useRef as Gr, createElement as un, useState as ie, useEffect as Tt, useMemo as jr } from "react";
16
- const Vr = "docs-drawing-ui.config", zt = {};
17
- var he = function() {
18
- return he = Object.assign || function(r) {
19
- for (var e, t = 1, n = arguments.length; t < n; t++) {
20
- e = arguments[t];
21
- for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (r[i] = e[i]);
22
- }
23
- return r;
24
- }, he.apply(this, arguments);
25
- }, $r = function(r, e) {
26
- var t = {};
27
- for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
28
- if (r != null && typeof Object.getOwnPropertySymbols == "function")
29
- for (var i = 0, n = Object.getOwnPropertySymbols(r); i < n.length; i++)
30
- e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (t[n[i]] = r[n[i]]);
31
- return t;
32
- }, fn = ln(function(r, e) {
33
- var t = r.icon, n = r.id, i = r.className, o = r.extend, s = $r(r, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), d = Gr("_".concat(qr()));
34
- return hn(t, "".concat(n), { defIds: t.defIds, idSuffix: d.current }, he({ ref: e, className: c }, s), o);
35
- });
36
- function hn(r, e, t, n, i) {
37
- return un(r.tag, he(he({ key: e }, zr(r, t, i)), n), (Xr(r, t).children || []).map(function(o, s) {
38
- return hn(o, "".concat(e, "-").concat(r.tag, "-").concat(s), t, void 0, i);
39
- }));
40
- }
41
- function zr(r, e, t) {
42
- var n = he({}, r.attrs);
43
- t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1), r.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(o) {
44
- var s = o[0], c = o[1];
45
- s === "mask" && typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
46
- });
47
- var i = e.defIds;
48
- return !i || i.length === 0 || (r.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) {
49
- var s = o[0], c = o[1];
50
- typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
51
- })), n;
52
- }
53
- function Xr(r, e) {
54
- var t, n = e.defIds;
55
- return !n || n.length === 0 ? r : r.tag === "defs" && (!((t = r.children) === null || t === void 0) && t.length) ? he(he({}, r), { children: r.children.map(function(i) {
56
- return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? he(he({}, i), { attrs: he(he({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
57
- }) }) : r;
58
- }
59
- function qr() {
60
- return Math.random().toString(36).substring(2, 8);
61
- }
62
- fn.displayName = "UniverIcon";
63
- var Kr = { 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" } }] }, pn = ln(function(r, e) {
64
- return un(fn, Object.assign({}, r, {
65
- id: "add-image-single",
66
- ref: e,
67
- icon: Kr
68
- }));
69
- });
70
- pn.displayName = "AddImageSingle";
71
- const Mt = {
1
+ var An = Object.defineProperty;
2
+ var Pn = (i, e, t) => e in i ? An(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var ve = (i, e, t) => Pn(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as _t, JSONX as $, MemoryCursor as xn, TextXActionType as Y, IUndoRedoService as Kt, BuildTextUtils as Nn, ArrangeTypeEnum as Ze, Tools as Me, Inject as Z, IContextService as Yt, LocaleService as lt, Disposable as Ne, WrapTextType as ze, PositionedObjectLayoutType as k, BooleanNumber as oe, DrawingTypeEnum as xe, ObjectRelativeFromV as W, ObjectRelativeFromH as J, FOCUSING_COMMON_DRAWINGS as nt, UniverInstanceType as we, Direction as he, DocumentFlavor as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as St, FOCUSING_UNIVER_EDITOR as Un, UndoCommand as Ln, RedoCommand as Bn, DisposableCollection as Fn, toDisposable as Se, fromEventSubject as Zt, generateRandomId as kn, Injector as Qt, DOC_DRAWING_PRINTING_COMPONENT_KEY as Wn, throttle as Et, COLORS as Gn, RxDisposable as Hn, LifecycleService as jn, LifecycleStages as Rt, DependentOn as Vn, IConfigService as $n, Plugin as zn, merge as Xn } from "@univerjs/core";
5
+ import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as qn } from "@univerjs/docs-drawing";
6
+ import { IImageIoService as Kn, IDrawingManagerService as fe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Yn, DRAWING_IMAGE_COUNT_LIMIT as At, ImageUploadStatusType as mt, DRAWING_IMAGE_ALLOW_SIZE as Zn, getImageSize as Qn, getDrawingShapeKeyByDrawingSearch as Jn, DRAWING_IMAGE_WIDTH_LIMIT as Pt, DRAWING_IMAGE_HEIGHT_LIMIT as xt, UniverDrawingPlugin as er } from "@univerjs/drawing";
7
+ import { DrawingCommonPanel as tr, DrawingRenderService as Jt, ImageCropperObject as nr, COMPONENT_IMAGE_POPUP_MENU as rr, OpenImageCropOperation as ir, ImageResetSizeOperation as or, UniverDrawingUIPlugin as sr } from "@univerjs/drawing-ui";
8
+ import { IRenderManagerService as Q, DocumentEditArea as ke, getCurrentTypeOfRenderer as ar, CURSOR_TYPE as Nt, Liquid as en, PageLayoutType as Ut, DocumentSkeletonPageType as Lt, Vector2 as cr, Rect as dr, getColor as gr, TRANSFORM_CHANGE_OBSERVABLE_TYPE as lr } from "@univerjs/engine-render";
9
+ import { IMessageService as ur, ILocalFileService as hr, ISidebarService as fr, useDependency as me, getMenuHiddenObservable as tn, MenuItemType as nn, RibbonInsertGroup as pr, KeyCode as We, ComponentManager as rn, IMenuManagerService as mr, IShortcutService as wr, CanvasFloatDomService as vr, PrintFloatDomSingle as Ir, connectInjector as _r, UniverUIPlugin as Sr } from "@univerjs/ui";
10
+ import { RichTextEditingMutation as ee, DocSelectionManagerService as Dt, DocSkeletonManagerService as te } from "@univerjs/docs";
11
+ import { DocSelectionRenderService as be, getRichTextEditPath as Xe, getCustomBlockIdsInSelections as Dr, docDrawingPositionToTransform as on, VIEWPORT_KEY as sn, SetDocZoomRatioOperation as an, DocPrintInterceptorService as Or, NodePositionConvertToCursor as Bt, getOneTextSelectionRange as Ft, getAnchorBounding as Tr, TEXT_RANGE_LAYER_INDEX as yr, getDocObject as Mr, DocCanvasPopManagerService as br, IEditorService as Cr } from "@univerjs/docs-ui";
12
+ import { MessageType as kt, clsx as cn, InputNumber as Fe, Select as Wt, Checkbox as Er, RadioGroup as Gt, Radio as ye, render as Rr, unmount as Ar } from "@univerjs/design";
13
+ import { BehaviorSubject as Ot, debounceTime as dn, Observable as Pr, map as Ht, switchMap as xr, of as Nr, takeUntil as jt, filter as Vt } from "rxjs";
14
+ import { jsxs as X, jsx as y } from "react/jsx-runtime";
15
+ import { useState as ie, useEffect as Tt, useMemo as Ur } from "react";
16
+ const Lr = "docs-drawing-ui.config", $t = {}, yt = {
72
17
  id: "doc.command.remove-doc-image",
73
18
  type: q.COMMAND,
74
19
  // eslint-disable-next-line max-lines-per-function
75
- handler: (r, e) => {
76
- var C, M, A, U;
77
- const t = r.get(j), n = r.get(z), i = r.get(Q), o = n.getCurrentUniverDocInstance();
20
+ handler: (i, e) => {
21
+ var C, M, A, L;
22
+ const t = i.get(j), n = i.get(z), r = i.get(Q), o = n.getCurrentUniverDocInstance();
78
23
  if (e == null || o == null)
79
24
  return !1;
80
- const s = i.getRenderById(e.unitId).with(Ce), { drawings: c } = e, d = (C = s.getSegment()) != null ? C : "", a = new St(), g = $.getInstance(), u = (A = (M = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : M.customBlocks) != null ? A : [], l = c.map((R) => u.find((w) => w.blockId === R.drawingId)).filter((R) => !!R).sort((R, w) => R.startIndex > w.startIndex ? 1 : -1), h = c[0].unitId, f = new Wn();
81
- f.reset();
25
+ const s = r.getRenderById(e.unitId).with(be), { drawings: c } = e, d = (C = s.getSegment()) != null ? C : "", a = new _t(), g = $.getInstance(), u = (A = (M = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : M.customBlocks) != null ? A : [], l = c.map((R) => u.find((v) => v.blockId === R.drawingId)).filter((R) => !!R).sort((R, v) => R.startIndex > v.startIndex ? 1 : -1), f = c[0].unitId, h = new xn();
26
+ h.reset();
82
27
  const m = l[0].startIndex, p = [
83
28
  {
84
29
  startOffset: m,
85
30
  endOffset: m
86
31
  }
87
- ], v = {
32
+ ], w = {
88
33
  id: ee.id,
89
34
  params: {
90
- unitId: h,
35
+ unitId: f,
91
36
  actions: [],
92
37
  textRanges: p
93
38
  }
94
39
  }, D = [];
95
40
  for (const R of l) {
96
- const { startIndex: w } = R;
97
- w > f.cursor && a.push({
41
+ const { startIndex: v } = R;
42
+ v > h.cursor && a.push({
98
43
  t: Y.RETAIN,
99
- len: w - f.cursor
44
+ len: v - h.cursor
100
45
  }), a.push({
101
46
  t: Y.DELETE,
102
47
  len: 1
103
- }), f.moveCursorTo(w + 1);
48
+ }), h.moveCursorTo(v + 1);
104
49
  }
105
- const S = qe(o, d);
50
+ const S = Xe(o, d);
106
51
  D.push(g.editOp(a.serialize(), S));
107
52
  for (const R of l) {
108
- const { blockId: w } = R, N = ((U = o.getDrawings()) != null ? U : {})[w], x = o.getDrawingsOrder().indexOf(w), G = g.removeOp(["drawings", w], N), I = g.removeOp(["drawingsOrder", x], w);
109
- D.push(G), D.push(I);
53
+ const { blockId: v } = R, N = ((L = o.getDrawings()) != null ? L : {})[v], x = o.getDrawingsOrder().indexOf(v), H = g.removeOp(["drawings", v], N), I = g.removeOp(["drawingsOrder", x], v);
54
+ D.push(H), D.push(I);
110
55
  }
111
- return v.params.actions = D.reduce((R, w) => $.compose(R, w), null), !!t.syncExecuteCommand(v.id, v.params);
56
+ return w.params.actions = D.reduce((R, v) => $.compose(R, v), null), !!t.syncExecuteCommand(w.id, w.params);
112
57
  }
113
- }, mn = {
58
+ }, gn = {
114
59
  id: "doc.command.delete-drawing",
115
60
  type: q.COMMAND,
116
- handler: (r) => {
117
- const e = r.get(j), n = r.get(Ue).getFocusDrawings();
61
+ handler: (i) => {
62
+ const e = i.get(j), n = i.get(Ue).getFocusDrawings();
118
63
  if (n.length === 0)
119
64
  return !1;
120
- const { unitId: i } = n[0], o = n.map((s) => {
65
+ const { unitId: r } = n[0], o = n.map((s) => {
121
66
  const { unitId: c, subUnitId: d, drawingId: a, drawingType: g } = s;
122
67
  return {
123
68
  unitId: c,
@@ -126,17 +71,17 @@ const Mt = {
126
71
  drawingType: g
127
72
  };
128
73
  });
129
- return e.executeCommand(Mt.id, {
130
- unitId: i,
74
+ return e.executeCommand(yt.id, {
75
+ unitId: r,
131
76
  drawings: o
132
77
  });
133
78
  }
134
- }, vn = {
79
+ }, ln = {
135
80
  id: "doc.command.group-doc-image",
136
81
  type: q.COMMAND,
137
- handler: (r, e) => {
138
- r.get(j), r.get(Yt);
139
- const t = r.get(Ue);
82
+ handler: (i, e) => {
83
+ i.get(j), i.get(Kt);
84
+ const t = i.get(Ue);
140
85
  if (!e) return !1;
141
86
  const n = [];
142
87
  e.forEach(({ parent: g, children: u }) => {
@@ -144,59 +89,59 @@ const Mt = {
144
89
  n.push(l.unitId);
145
90
  });
146
91
  });
147
- const i = t.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = i;
92
+ const r = t.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
148
93
  return !1;
149
94
  }
150
- }, bt = {
95
+ }, Mt = {
151
96
  id: "doc.command.insert-doc-image",
152
97
  type: q.COMMAND,
153
98
  // eslint-disable-next-line max-lines-per-function
154
- handler: (r, e) => {
155
- var M, A, U, R;
99
+ handler: (i, e) => {
100
+ var M, A, L, R;
156
101
  if (e == null)
157
102
  return !1;
158
- const t = r.get(j), n = r.get(Ot), i = r.get(z), o = n.getActiveTextRange(), s = i.getCurrentUniverDocInstance();
103
+ const t = i.get(j), n = i.get(Dt), r = i.get(z), o = n.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
159
104
  if (o == null || s == null)
160
105
  return !1;
161
106
  const c = s.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset: g, segmentId: u } = o, l = s.getSelfOrHeaderFooterModel(u).getBody();
162
107
  if (l == null)
163
108
  return !1;
164
- const h = new St(), f = $.getInstance(), m = [], p = (A = (M = s.getSnapshot().drawingsOrder) == null ? void 0 : M.length) != null ? A : 0;
165
- let v = 0;
109
+ const f = new _t(), h = $.getInstance(), m = [], p = (A = (M = s.getSnapshot().drawingsOrder) == null ? void 0 : M.length) != null ? A : 0;
110
+ let w = 0;
166
111
  if (a)
167
- g > 0 && h.push({
112
+ g > 0 && f.push({
168
113
  t: Y.RETAIN,
169
114
  len: g
170
115
  });
171
116
  else {
172
- const w = Hn.selection.delete([o], l, 0, null, !1);
173
- h.push(...w);
174
- const N = Er(l, [o]), H = (U = s.getDrawings()) != null ? U : {}, x = (R = s.getDrawingsOrder()) != null ? R : [], G = N.sort((I, _) => x.indexOf(I) > x.indexOf(_) ? -1 : x.indexOf(I) < x.indexOf(_) ? 1 : 0);
175
- if (G.length > 0)
176
- for (const I of G) {
177
- const _ = H[I], E = x.indexOf(I);
117
+ const v = Nn.selection.delete([o], l, 0, null, !1);
118
+ f.push(...v);
119
+ const N = Dr(l, [o]), G = (L = s.getDrawings()) != null ? L : {}, x = (R = s.getDrawingsOrder()) != null ? R : [], H = N.sort((I, _) => x.indexOf(I) > x.indexOf(_) ? -1 : x.indexOf(I) < x.indexOf(_) ? 1 : 0);
120
+ if (H.length > 0)
121
+ for (const I of H) {
122
+ const _ = G[I], E = x.indexOf(I);
178
123
  if (_ == null || E < 0)
179
124
  continue;
180
- const y = f.removeOp(["drawings", I], _), L = f.removeOp(["drawingsOrder", E], I);
181
- m.push(y), m.push(L), v++;
125
+ const T = h.removeOp(["drawings", I], _), U = h.removeOp(["drawingsOrder", E], I);
126
+ m.push(T), m.push(U), w++;
182
127
  }
183
128
  }
184
- h.push({
129
+ f.push({
185
130
  t: Y.INSERT,
186
131
  body: {
187
132
  dataStream: "\b".repeat(d.length),
188
- customBlocks: d.map((w, N) => ({
133
+ customBlocks: d.map((v, N) => ({
189
134
  startIndex: N,
190
- blockId: w.drawingId
135
+ blockId: v.drawingId
191
136
  }))
192
137
  },
193
138
  len: d.length
194
139
  });
195
- const D = qe(s, u), S = f.editOp(h.serialize(), D);
140
+ const D = Xe(s, u), S = h.editOp(f.serialize(), D);
196
141
  m.push(S);
197
- for (const w of d) {
198
- const { drawingId: N } = w, H = f.insertOp(["drawings", N], w), x = f.insertOp(["drawingsOrder", p - v], N);
199
- m.push(H), m.push(x);
142
+ for (const v of d) {
143
+ const { drawingId: N } = v, G = h.insertOp(["drawings", N], v), x = h.insertOp(["drawingsOrder", p - w], N);
144
+ m.push(G), m.push(x);
200
145
  }
201
146
  const O = {
202
147
  id: ee.id,
@@ -206,41 +151,41 @@ const Mt = {
206
151
  textRanges: []
207
152
  }
208
153
  };
209
- return O.params.actions = m.reduce((w, N) => $.compose(w, N), null), !!t.syncExecuteCommand(O.id, O.params);
154
+ return O.params.actions = m.reduce((v, N) => $.compose(v, N), null), !!t.syncExecuteCommand(O.id, O.params);
210
155
  }
211
- }, wn = {
156
+ }, un = {
212
157
  id: "doc.command.set-drawing-arrange",
213
158
  type: q.COMMAND,
214
- handler: (r, e) => {
215
- const t = r.get(j), n = r.get(Ue);
159
+ handler: (i, e) => {
160
+ const t = i.get(j), n = i.get(Ue);
216
161
  if (e == null)
217
162
  return !1;
218
- const { unitId: i, subUnitId: o, drawingIds: s, arrangeType: c } = e, d = { unitId: i, subUnitId: o, drawingIds: s };
163
+ const { unitId: r, subUnitId: o, drawingIds: s, arrangeType: c } = e, d = { unitId: r, subUnitId: o, drawingIds: s };
219
164
  let a;
220
- if (c === Qe.forward ? a = n.getForwardDrawingsOp(d) : c === Qe.backward ? a = n.getBackwardDrawingOp(d) : c === Qe.front ? a = n.getFrontDrawingsOp(d) : c === Qe.back && (a = n.getBackDrawingsOp(d)), a == null)
165
+ if (c === Ze.forward ? a = n.getForwardDrawingsOp(d) : c === Ze.backward ? a = n.getBackwardDrawingOp(d) : c === Ze.front ? a = n.getFrontDrawingsOp(d) : c === Ze.back && (a = n.getBackDrawingsOp(d)), a == null)
221
166
  return !1;
222
167
  const { redo: g } = a;
223
168
  if (g == null)
224
169
  return !1;
225
170
  const u = [];
226
- let l = be.deepClone(g);
171
+ let l = Me.deepClone(g);
227
172
  l = l.slice(3), l.unshift("drawingsOrder"), u.push(l);
228
- const h = {
173
+ const f = {
229
174
  id: ee.id,
230
175
  params: {
231
- unitId: i,
176
+ unitId: r,
232
177
  actions: [],
233
178
  textRanges: null
234
179
  }
235
180
  };
236
- return h.params.actions = u.reduce((m, p) => $.compose(m, p), null), !!t.syncExecuteCommand(h.id, h.params);
181
+ return f.params.actions = u.reduce((m, p) => $.compose(m, p), null), !!t.syncExecuteCommand(f.id, f.params);
237
182
  }
238
- }, In = {
183
+ }, hn = {
239
184
  id: "doc.command.ungroup-doc-image",
240
185
  type: q.COMMAND,
241
- handler: (r, e) => {
242
- r.get(j), r.get(Yt);
243
- const t = r.get(Ue);
186
+ handler: (i, e) => {
187
+ i.get(j), i.get(Kt);
188
+ const t = i.get(Ue);
244
189
  if (!e) return !1;
245
190
  const n = [];
246
191
  e.forEach(({ parent: g, children: u }) => {
@@ -248,117 +193,117 @@ const Mt = {
248
193
  n.push(l.unitId);
249
194
  });
250
195
  });
251
- const i = t.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = i;
196
+ const r = t.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
252
197
  return !1;
253
198
  }
254
199
  };
255
- class ft {
200
+ class ut {
256
201
  constructor() {
257
- Ie(this, "_refreshDrawings$", new yt(null));
258
- Ie(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
202
+ ve(this, "_refreshDrawings$", new Ot(null));
203
+ ve(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
259
204
  }
260
205
  refreshDrawings(e) {
261
206
  this._refreshDrawings$.next(e);
262
207
  }
263
208
  }
264
- var Yr = Object.getOwnPropertyDescriptor, Zr = (r, e, t, n) => {
265
- for (var i = n > 1 ? void 0 : n ? Yr(e, t) : e, o = r.length - 1, s; o >= 0; o--)
266
- (s = r[o]) && (i = s(i) || i);
267
- return i;
268
- }, le = (r, e) => (t, n) => e(t, n, r);
269
- let it = class extends Le {
270
- constructor(r, e, t, n, i, o, s, c, d, a, g, u, l) {
271
- super(), this._context = r, this._commandService = e, this._docSelectionManagerService = t, this._renderManagerSrv = n, this._imageIoService = i, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = g, this._docRefreshDrawingsService = u, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
209
+ var Br = Object.getOwnPropertyDescriptor, Fr = (i, e, t, n) => {
210
+ for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, o = i.length - 1, s; o >= 0; o--)
211
+ (s = i[o]) && (r = s(r) || r);
212
+ return r;
213
+ }, le = (i, e) => (t, n) => e(t, n, i);
214
+ let rt = class extends Ne {
215
+ constructor(i, e, t, n, r, o, s, c, d, a, g, u, l) {
216
+ super(), this._context = i, this._commandService = e, this._docSelectionManagerService = t, this._renderManagerSrv = n, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = g, this._docRefreshDrawingsService = u, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
272
217
  }
273
218
  async insertDocImage() {
274
- const r = await this._fileOpenerService.openFile({
219
+ const i = await this._fileOpenerService.openFile({
275
220
  multiple: !0,
276
- accept: rr.map((t) => `.${t.replace("image/", "")}`).join(",")
277
- }), e = r.length;
278
- return e > Pt ? (this._messageService.show({
279
- type: Wt.Error,
280
- content: this._localeService.t("update-status.exceedMaxCount", String(Pt))
281
- }), !1) : e === 0 ? !1 : (await this._insertFloatImages(r), !0);
221
+ accept: Yn.map((t) => `.${t.replace("image/", "")}`).join(",")
222
+ }), e = i.length;
223
+ return e > At ? (this._messageService.show({
224
+ type: kt.Error,
225
+ content: this._localeService.t("update-status.exceedMaxCount", String(At))
226
+ }), !1) : e === 0 ? !1 : (await this._insertFloatImages(i), !0);
282
227
  }
283
228
  // eslint-disable-next-line max-lines-per-function
284
- async _insertFloatImages(r) {
229
+ async _insertFloatImages(i) {
285
230
  let e = [];
286
231
  try {
287
- e = await Promise.all(r.map((i) => this._imageIoService.saveImage(i)));
288
- } catch (i) {
289
- const o = i.message;
232
+ e = await Promise.all(i.map((r) => this._imageIoService.saveImage(r)));
233
+ } catch (r) {
234
+ const o = r.message;
290
235
  let s = "";
291
236
  switch (o) {
292
- case vt.ERROR_EXCEED_SIZE:
293
- s = this._localeService.t("update-status.exceedMaxSize", String(ir / (1024 * 1024)));
237
+ case mt.ERROR_EXCEED_SIZE:
238
+ s = this._localeService.t("update-status.exceedMaxSize", String(Zn / (1024 * 1024)));
294
239
  break;
295
- case vt.ERROR_IMAGE_TYPE:
240
+ case mt.ERROR_IMAGE_TYPE:
296
241
  s = this._localeService.t("update-status.invalidImageType");
297
242
  break;
298
- case vt.ERROR_IMAGE:
243
+ case mt.ERROR_IMAGE:
299
244
  s = this._localeService.t("update-status.invalidImage");
300
245
  break;
301
246
  }
302
247
  this._messageService.show({
303
- type: Wt.Error,
248
+ type: kt.Error,
304
249
  content: s
305
250
  });
306
251
  }
307
252
  if (e.length === 0)
308
253
  return;
309
254
  const { unitId: t } = this._context, n = [];
310
- for (const i of e) {
311
- if (i == null)
255
+ for (const r of e) {
256
+ if (r == null)
312
257
  continue;
313
- const { imageId: o, imageSourceType: s, source: c, base64Cache: d } = i, { width: a, height: g, image: u } = await or(d || "");
258
+ const { imageId: o, imageSourceType: s, source: c, base64Cache: d } = r, { width: a, height: g, image: u } = await Qn(d || "");
314
259
  this._imageIoService.addImageSourceCache(o, s, u);
315
260
  let l = 1;
316
- if (a > xt || g > Nt) {
317
- const p = xt / a, v = Nt / g;
318
- l = Math.min(p, v);
261
+ if (a > Pt || g > xt) {
262
+ const p = Pt / a, w = xt / g;
263
+ l = Math.min(p, w);
319
264
  }
320
- const h = this._getImagePosition(a * l, g * l);
321
- if (h == null)
265
+ const f = this._getImagePosition(a * l, g * l);
266
+ if (f == null)
322
267
  return;
323
- const f = {
268
+ const h = {
324
269
  unitId: t,
325
270
  subUnitId: t,
326
271
  drawingId: o,
327
- drawingType: Ne.DRAWING_IMAGE,
272
+ drawingType: xe.DRAWING_IMAGE,
328
273
  imageSourceType: s,
329
274
  source: c,
330
- transform: sn(h),
331
- docTransform: h,
275
+ transform: on(f),
276
+ docTransform: f,
332
277
  behindDoc: oe.FALSE,
333
278
  title: "",
334
279
  description: "",
335
- layoutType: F.INLINE,
280
+ layoutType: k.INLINE,
336
281
  // Insert inline drawing by default.
337
- wrapText: Xe.BOTH_SIDES,
282
+ wrapText: ze.BOTH_SIDES,
338
283
  distB: 0,
339
284
  distL: 0,
340
285
  distR: 0,
341
286
  distT: 0
342
287
  };
343
- this._isInsertInHeaderFooter() && (f.isMultiTransform = oe.TRUE, f.transforms = f.transform ? [f.transform] : null), n.push(f);
288
+ this._isInsertInHeaderFooter() && (h.isMultiTransform = oe.TRUE, h.transforms = h.transform ? [h.transform] : null), n.push(h);
344
289
  }
345
- this._commandService.executeCommand(bt.id, {
290
+ this._commandService.executeCommand(Mt.id, {
346
291
  unitId: t,
347
292
  drawings: n
348
293
  });
349
294
  }
350
295
  _isInsertInHeaderFooter() {
351
296
  var n;
352
- const { unitId: r } = this._context, e = (n = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : n.with(te).getViewModel(), t = e == null ? void 0 : e.getEditArea();
353
- return t === We.HEADER || t === We.FOOTER;
297
+ const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(te).getViewModel(), t = e == null ? void 0 : e.getEditArea();
298
+ return t === ke.HEADER || t === ke.FOOTER;
354
299
  }
355
- _getImagePosition(r, e) {
300
+ _getImagePosition(i, e) {
356
301
  const t = this._docSelectionRenderService.getActiveTextRange(), n = (t == null ? void 0 : t.getAbsolutePosition()) || {
357
302
  left: 0
358
303
  };
359
304
  return {
360
305
  size: {
361
- width: r,
306
+ width: i,
362
307
  height: e
363
308
  },
364
309
  positionH: {
@@ -373,34 +318,34 @@ let it = class extends Le {
373
318
  };
374
319
  }
375
320
  _updateOrderListener() {
376
- this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
377
- const { unitId: e, subUnitId: t, drawingIds: n, arrangeType: i } = r;
378
- this._commandService.executeCommand(wn.id, {
321
+ this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
322
+ const { unitId: e, subUnitId: t, drawingIds: n, arrangeType: r } = i;
323
+ this._commandService.executeCommand(un.id, {
379
324
  unitId: e,
380
325
  subUnitId: t,
381
326
  drawingIds: n,
382
- arrangeType: i
327
+ arrangeType: r
383
328
  });
384
329
  });
385
330
  }
386
331
  _groupDrawingListener() {
387
- this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
388
- this._commandService.executeCommand(vn.id, r);
389
- }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
390
- this._commandService.executeCommand(In.id, r);
332
+ this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
333
+ this._commandService.executeCommand(ln.id, i);
334
+ }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
335
+ this._commandService.executeCommand(hn.id, i);
391
336
  });
392
337
  }
393
338
  _getCurrentSceneAndTransformer() {
394
- const { scene: r, mainComponent: e } = this._context;
395
- if (r == null || e == null)
339
+ const { scene: i, mainComponent: e } = this._context;
340
+ if (i == null || e == null)
396
341
  return;
397
- const t = r.getTransformerByCreate(), { docsLeft: n, docsTop: i } = e.getOffsetConfig();
398
- return { scene: r, transformer: t, docsLeft: n, docsTop: i };
342
+ const t = i.getTransformerByCreate(), { docsLeft: n, docsTop: r } = e.getOffsetConfig();
343
+ return { scene: i, transformer: t, docsLeft: n, docsTop: r };
399
344
  }
400
345
  _transformDrawingListener() {
401
- const r = this._getCurrentSceneAndTransformer();
402
- if (r && r.transformer)
403
- this.disposeWithMe(r.transformer.changeEnd$.pipe(gn(30)).subscribe((e) => {
346
+ const i = this._getCurrentSceneAndTransformer();
347
+ if (i && i.transformer)
348
+ this.disposeWithMe(i.transformer.changeEnd$.pipe(dn(30)).subscribe((e) => {
404
349
  this._docSelectionManagerService.refreshSelection();
405
350
  }));
406
351
  else
@@ -408,17 +353,17 @@ let it = class extends Le {
408
353
  }
409
354
  _focusDrawingListener() {
410
355
  this.disposeWithMe(
411
- this._drawingManagerService.focus$.subscribe((r) => {
412
- var i;
413
- const { transformer: e, docsLeft: t, docsTop: n } = (i = this._getCurrentSceneAndTransformer()) != null ? i : {};
414
- if (r == null || r.length === 0)
415
- this._contextService.setContextValue(rt, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
356
+ this._drawingManagerService.focus$.subscribe((i) => {
357
+ var r;
358
+ const { transformer: e, docsLeft: t, docsTop: n } = (r = this._getCurrentSceneAndTransformer()) != null ? r : {};
359
+ if (i == null || i.length === 0)
360
+ this._contextService.setContextValue(nt, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
416
361
  zeroTop: 0,
417
362
  zeroLeft: 0
418
363
  });
419
364
  else {
420
- this._contextService.setContextValue(rt, !0), this._docDrawingService.focusDrawing(r), this._setDrawingSelections(r);
421
- const o = this._docSelectionRenderService.getSegment(), s = this._findSegmentIdByDrawingId(r[0].drawingId);
365
+ this._contextService.setContextValue(nt, !0), this._docDrawingService.focusDrawing(i), this._setDrawingSelections(i);
366
+ const o = this._docSelectionRenderService.getSegment(), s = this._findSegmentIdByDrawingId(i[0].drawingId);
422
367
  o !== s && this._docSelectionRenderService.setSegment(s), e && e.resetProps({
423
368
  zeroTop: n,
424
369
  zeroLeft: t
@@ -427,28 +372,28 @@ let it = class extends Le {
427
372
  })
428
373
  );
429
374
  }
430
- _findSegmentIdByDrawingId(r) {
375
+ _findSegmentIdByDrawingId(i) {
431
376
  var s, c, d;
432
- const { unit: e } = this._context, { body: t, headers: n = {}, footers: i = {} } = e.getSnapshot();
433
- if (((s = t == null ? void 0 : t.customBlocks) != null ? s : []).some((a) => a.blockId === r))
377
+ const { unit: e } = this._context, { body: t, headers: n = {}, footers: r = {} } = e.getSnapshot();
378
+ if (((s = t == null ? void 0 : t.customBlocks) != null ? s : []).some((a) => a.blockId === i))
434
379
  return "";
435
380
  for (const a of Object.keys(n))
436
- if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId === r))
381
+ if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId === i))
437
382
  return a;
438
- for (const a of Object.keys(i))
439
- if ((d = i[a].body.customBlocks) != null && d.some((g) => g.blockId === r))
383
+ for (const a of Object.keys(r))
384
+ if ((d = r[a].body.customBlocks) != null && d.some((g) => g.blockId === i))
440
385
  return a;
441
386
  return "";
442
387
  }
443
388
  // Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
444
389
  _updateDrawingsEditStatus() {
445
390
  var c;
446
- const { unit: r, scene: e, unitId: t } = this._context, n = (c = this._renderManagerSrv.getRenderById(t)) == null ? void 0 : c.with(te).getViewModel();
447
- if (n == null || r == null)
391
+ const { unit: i, scene: e, unitId: t } = this._context, n = (c = this._renderManagerSrv.getRenderById(t)) == null ? void 0 : c.with(te).getViewModel();
392
+ if (n == null || i == null)
448
393
  return;
449
- const i = r.getSnapshot(), { drawings: o = {} } = i, s = n.getEditArea() === We.BODY;
394
+ const r = i.getSnapshot(), { drawings: o = {} } = r, s = n.getEditArea() === ke.BODY;
450
395
  for (const d of Object.keys(o)) {
451
- const a = o[d], g = sr({ unitId: t, drawingId: a.drawingId, subUnitId: t }), u = e.fuzzyMathObjects(g, !0);
396
+ const a = o[d], g = Jn({ unitId: t, drawingId: a.drawingId, subUnitId: t }), u = e.fuzzyMathObjects(g, !0);
452
397
  if (u.length)
453
398
  for (const l of u) {
454
399
  e.detachTransformerFrom(l);
@@ -468,7 +413,7 @@ let it = class extends Le {
468
413
  }
469
414
  _editAreaChangeListener() {
470
415
  var t;
471
- const { unitId: r } = this._context, e = (t = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : t.with(te).getViewModel();
416
+ const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(te).getViewModel();
472
417
  e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
473
418
  e.editAreaChange$.subscribe(() => {
474
419
  this._updateDrawingsEditStatus();
@@ -485,54 +430,54 @@ let it = class extends Le {
485
430
  })
486
431
  ));
487
432
  }
488
- _setDrawingSelections(r) {
489
- var i, o;
490
- const { unit: e } = this._context, t = (o = (i = e.getSnapshot().body) == null ? void 0 : i.customBlocks) != null ? o : [], n = r.map((s) => {
433
+ _setDrawingSelections(i) {
434
+ var r, o;
435
+ const { unit: e } = this._context, t = (o = (r = e.getSnapshot().body) == null ? void 0 : r.customBlocks) != null ? o : [], n = i.map((s) => {
491
436
  const c = s.drawingId, d = t.find((a) => a.blockId === c);
492
437
  return d ? d.startIndex : null;
493
438
  }).filter((s) => s !== null).map((s) => ({ startOffset: s, endOffset: s + 1 }));
494
439
  this._docSelectionManagerService.replaceDocRanges(n);
495
440
  }
496
441
  };
497
- it = Zr([
442
+ rt = Fr([
498
443
  le(1, j),
499
- le(2, Z(Ot)),
444
+ le(2, Z(Dt)),
500
445
  le(3, Q),
501
- le(4, nr),
446
+ le(4, Kn),
502
447
  le(5, Ue),
503
- le(6, pe),
504
- le(7, Zt),
505
- le(8, Ir),
506
- le(9, Z(ut)),
507
- le(10, Z(Ce)),
508
- le(11, Z(ft)),
509
- le(12, _r)
510
- ], it);
511
- const _n = {
448
+ le(6, fe),
449
+ le(7, Yt),
450
+ le(8, ur),
451
+ le(9, Z(lt)),
452
+ le(10, Z(be)),
453
+ le(11, Z(ut)),
454
+ le(12, hr)
455
+ ], rt);
456
+ const fn = {
512
457
  id: "doc.command.insert-float-image",
513
458
  type: q.COMMAND,
514
- handler: (r) => {
515
- var n, i;
516
- const e = r.get(z), t = r.get(Q);
517
- return (i = (n = hr(we.UNIVER_DOC, e, t)) == null ? void 0 : n.with(it).insertDocImage()) != null ? i : !1;
459
+ handler: (i) => {
460
+ var n, r;
461
+ const e = i.get(z), t = i.get(Q);
462
+ return (r = (n = ar(we.UNIVER_DOC, e, t)) == null ? void 0 : n.with(rt).insertDocImage()) != null ? r : !1;
518
463
  }
519
464
  };
520
- var ue = /* @__PURE__ */ ((r) => (r.INLINE = "inline", r.BEHIND_TEXT = "behindText", r.IN_FRONT_OF_TEXT = "inFrontOfText", r.WRAP_SQUARE = "wrapSquare", r.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", r))(ue || {});
521
- const Qr = {
522
- inline: F.INLINE,
523
- wrapSquare: F.WRAP_SQUARE,
524
- wrapTopAndBottom: F.WRAP_TOP_AND_BOTTOM,
525
- inFrontOfText: F.WRAP_NONE,
526
- behindText: F.WRAP_NONE
465
+ var ue = /* @__PURE__ */ ((i) => (i.INLINE = "inline", i.BEHIND_TEXT = "behindText", i.IN_FRONT_OF_TEXT = "inFrontOfText", i.WRAP_SQUARE = "wrapSquare", i.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", i))(ue || {});
466
+ const kr = {
467
+ inline: k.INLINE,
468
+ wrapSquare: k.WRAP_SQUARE,
469
+ wrapTopAndBottom: k.WRAP_TOP_AND_BOTTOM,
470
+ inFrontOfText: k.WRAP_NONE,
471
+ behindText: k.WRAP_NONE
527
472
  };
528
- function Sn(r, e, t, n, i, o, s) {
529
- var h, f;
530
- const c = new St(), d = $.getInstance(), a = [], g = o.getSelfOrHeaderFooterModel(e).getBody(), u = o.getSelfOrHeaderFooterModel(r).getBody();
473
+ function pn(i, e, t, n, r, o, s) {
474
+ var f, h;
475
+ const c = new _t(), d = $.getInstance(), a = [], g = o.getSelfOrHeaderFooterModel(e).getBody(), u = o.getSelfOrHeaderFooterModel(i).getBody();
531
476
  if (g == null || u == null)
532
477
  return;
533
- const l = (f = (h = g.customBlocks) == null ? void 0 : h.find((m) => m.blockId === i)) == null ? void 0 : f.startIndex;
478
+ const l = (h = (f = g.customBlocks) == null ? void 0 : f.find((m) => m.blockId === r)) == null ? void 0 : h.startIndex;
534
479
  if (l != null) {
535
- if (n = Math.min(u.dataStream.length - 2, n), r === e) {
480
+ if (n = Math.min(u.dataStream.length - 2, n), i === e) {
536
481
  if (n < l ? (n > 0 && c.push({
537
482
  t: Y.RETAIN,
538
483
  len: n
@@ -542,7 +487,7 @@ function Sn(r, e, t, n, i, o, s) {
542
487
  dataStream: "\b",
543
488
  customBlocks: [{
544
489
  startIndex: 0,
545
- blockId: i
490
+ blockId: r
546
491
  }]
547
492
  },
548
493
  len: 1
@@ -567,12 +512,12 @@ function Sn(r, e, t, n, i, o, s) {
567
512
  dataStream: "\b",
568
513
  customBlocks: [{
569
514
  startIndex: 0,
570
- blockId: i
515
+ blockId: r
571
516
  }]
572
517
  },
573
518
  len: 1
574
519
  })), n !== l) {
575
- const m = qe(o, e), p = d.editOp(c.serialize(), m);
520
+ const m = Xe(o, e), p = d.editOp(c.serialize(), m);
576
521
  a.push(p);
577
522
  }
578
523
  } else {
@@ -583,7 +528,7 @@ function Sn(r, e, t, n, i, o, s) {
583
528
  t: Y.DELETE,
584
529
  len: 1
585
530
  });
586
- let m = qe(o, e), p = d.editOp(c.serialize(), m);
531
+ let m = Xe(o, e), p = d.editOp(c.serialize(), m);
587
532
  a.push(p), c.empty(), n > 0 && c.push({
588
533
  t: Y.RETAIN,
589
534
  len: n
@@ -593,58 +538,58 @@ function Sn(r, e, t, n, i, o, s) {
593
538
  dataStream: "\b",
594
539
  customBlocks: [{
595
540
  startIndex: 0,
596
- blockId: i
541
+ blockId: r
597
542
  }]
598
543
  },
599
544
  len: 1
600
- }), m = qe(o, r), p = d.editOp(c.serialize(), m), a.push(p), s.setSegment(r), s.setSegmentPage(t);
545
+ }), m = Xe(o, i), p = d.editOp(c.serialize(), m), a.push(p), s.setSegment(i), s.setSegmentPage(t);
601
546
  }
602
547
  return a;
603
548
  }
604
549
  }
605
- const Dn = {
550
+ const mn = {
606
551
  id: "doc.command.update-doc-drawing-wrapping-style",
607
552
  type: q.COMMAND,
608
553
  // eslint-disable-next-line max-lines-per-function, complexity
609
- handler: (r, e) => {
610
- var A, U;
554
+ handler: (i, e) => {
555
+ var A, L;
611
556
  if (e == null)
612
557
  return !1;
613
- const { drawings: t, wrappingStyle: n, unitId: i } = e, o = r.get(j), s = r.get(z), d = r.get(Q).getRenderById(i), a = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), g = d == null ? void 0 : d.with(te).getViewModel(), u = d == null ? void 0 : d.scene, l = s.getCurrentUniverDocInstance();
558
+ const { drawings: t, wrappingStyle: n, unitId: r } = e, o = i.get(j), s = i.get(z), d = i.get(Q).getRenderById(r), a = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), g = d == null ? void 0 : d.with(te).getViewModel(), u = d == null ? void 0 : d.scene, l = s.getCurrentUniverDocInstance();
614
559
  if (l == null || a == null || u == null || g == null)
615
560
  return !1;
616
- const h = g.getEditArea(), f = u.getTransformerByCreate(), { pages: m, skeHeaders: p, skeFooters: v } = a, D = $.getInstance(), S = [], { drawings: O = {} } = l.getSnapshot();
561
+ const f = g.getEditArea(), h = u.getTransformerByCreate(), { pages: m, skeHeaders: p, skeFooters: w } = a, D = $.getInstance(), S = [], { drawings: O = {} } = l.getSnapshot();
617
562
  for (const R of t) {
618
- const { drawingId: w } = R, N = O[w].layoutType, H = Qr[n];
619
- if (N !== H) {
620
- const _ = D.replaceOp(["drawings", w, "layoutType"], N, H);
563
+ const { drawingId: v } = R, N = O[v].layoutType, G = kr[n];
564
+ if (N !== G) {
565
+ const _ = D.replaceOp(["drawings", v, "layoutType"], N, G);
621
566
  S.push(_);
622
567
  }
623
568
  if (n === "behindText" || n === "inFrontOfText") {
624
- const _ = O[w].behindDoc, E = n === "behindText" ? oe.TRUE : oe.FALSE;
569
+ const _ = O[v].behindDoc, E = n === "behindText" ? oe.TRUE : oe.FALSE;
625
570
  if (_ !== E) {
626
- const y = D.replaceOp(["drawings", w, "behindDoc"], _, E);
627
- S.push(y);
571
+ const T = D.replaceOp(["drawings", v, "behindDoc"], _, E);
572
+ S.push(T);
628
573
  }
629
574
  }
630
575
  if (n === "inline")
631
576
  continue;
632
- let x = null, G = 0, I = 0;
577
+ let x = null, H = 0, I = 0;
633
578
  for (const _ of m) {
634
- const { headerId: E, footerId: y, marginTop: L, marginLeft: B, marginBottom: b, pageWidth: P, pageHeight: V } = _;
635
- switch (h) {
636
- case We.HEADER: {
637
- const k = (A = p.get(E)) == null ? void 0 : A.get(P);
638
- k != null && k.skeDrawings.has(w) && (x = k.skeDrawings.get(w), G = k.marginTop, I = B);
579
+ const { headerId: E, footerId: T, marginTop: U, marginLeft: B, marginBottom: b, pageWidth: P, pageHeight: V } = _;
580
+ switch (f) {
581
+ case ke.HEADER: {
582
+ const F = (A = p.get(E)) == null ? void 0 : A.get(P);
583
+ F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = F.marginTop, I = B);
639
584
  break;
640
585
  }
641
- case We.FOOTER: {
642
- const k = (U = v.get(y)) == null ? void 0 : U.get(P);
643
- k != null && k.skeDrawings.has(w) && (x = k.skeDrawings.get(w), G = V - b + k.marginTop, I = B);
586
+ case ke.FOOTER: {
587
+ const F = (L = w.get(T)) == null ? void 0 : L.get(P);
588
+ F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = V - b + F.marginTop, I = B);
644
589
  break;
645
590
  }
646
- case We.BODY: {
647
- _.skeDrawings.has(w) && (x = _.skeDrawings.get(w), G = L, I = B);
591
+ case ke.BODY: {
592
+ _.skeDrawings.has(v) && (x = _.skeDrawings.get(v), H = U, I = B);
648
593
  break;
649
594
  }
650
595
  }
@@ -652,58 +597,58 @@ const Dn = {
652
597
  break;
653
598
  }
654
599
  if (x != null) {
655
- const { aTop: _, aLeft: E } = x, y = O[w].docTransform.positionH;
656
- let L = E;
657
- y.relativeFrom === J.MARGIN ? L -= I : y.relativeFrom === J.COLUMN && (L -= x.columnLeft);
600
+ const { aTop: _, aLeft: E } = x, T = O[v].docTransform.positionH;
601
+ let U = E;
602
+ T.relativeFrom === J.MARGIN ? U -= I : T.relativeFrom === J.COLUMN && (U -= x.columnLeft);
658
603
  const B = {
659
- relativeFrom: y.relativeFrom,
660
- posOffset: L
604
+ relativeFrom: T.relativeFrom,
605
+ posOffset: U
661
606
  };
662
- if (y.posOffset !== B.posOffset) {
663
- const k = D.replaceOp(["drawings", w, "docTransform", "positionH"], y, B);
664
- S.push(k);
607
+ if (T.posOffset !== B.posOffset) {
608
+ const F = D.replaceOp(["drawings", v, "docTransform", "positionH"], T, B);
609
+ S.push(F);
665
610
  }
666
- const b = O[w].docTransform.positionV;
611
+ const b = O[v].docTransform.positionV;
667
612
  let P = _;
668
- b.relativeFrom === W.PAGE ? P += G : b.relativeFrom === W.LINE ? P -= x.lineTop : b.relativeFrom === W.PARAGRAPH && (P -= x.blockAnchorTop);
613
+ b.relativeFrom === W.PAGE ? P += H : b.relativeFrom === W.LINE ? P -= x.lineTop : b.relativeFrom === W.PARAGRAPH && (P -= x.blockAnchorTop);
669
614
  const V = {
670
615
  relativeFrom: b.relativeFrom,
671
616
  posOffset: P
672
617
  };
673
618
  if (b.posOffset !== V.posOffset) {
674
- const k = D.replaceOp(["drawings", w, "docTransform", "positionV"], b, V);
675
- S.push(k);
619
+ const F = D.replaceOp(["drawings", v, "docTransform", "positionV"], b, V);
620
+ S.push(F);
676
621
  }
677
622
  }
678
623
  }
679
624
  const C = {
680
625
  id: ee.id,
681
626
  params: {
682
- unitId: i,
627
+ unitId: r,
683
628
  actions: [],
684
629
  textRanges: null
685
630
  }
686
631
  };
687
- C.params.actions = S.reduce((R, w) => $.compose(R, w), null);
632
+ C.params.actions = S.reduce((R, v) => $.compose(R, v), null);
688
633
  const M = o.syncExecuteCommand(C.id, C.params);
689
- return f.refreshControls(), !!M;
634
+ return h.refreshControls(), !!M;
690
635
  }
691
- }, On = {
636
+ }, wn = {
692
637
  id: "doc.command.update-doc-drawing-distance",
693
638
  type: q.COMMAND,
694
- handler: (r, e) => {
639
+ handler: (i, e) => {
695
640
  if (e == null)
696
641
  return !1;
697
- const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
698
- if (i == null)
642
+ const t = i.get(j), r = i.get(z).getCurrentUniverDocInstance();
643
+ if (r == null)
699
644
  return !1;
700
- const { drawings: o, dist: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
701
- for (const h of o) {
702
- const { drawingId: f } = h;
645
+ const { drawings: o, dist: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = r.getSnapshot();
646
+ for (const f of o) {
647
+ const { drawingId: h } = f;
703
648
  for (const [m, p] of Object.entries(s)) {
704
- const v = g[f][m];
705
- if (v !== p) {
706
- const D = d.replaceOp(["drawings", f, m], v, p);
649
+ const w = g[h][m];
650
+ if (w !== p) {
651
+ const D = d.replaceOp(["drawings", h, m], w, p);
707
652
  a.push(D);
708
653
  }
709
654
  }
@@ -716,22 +661,22 @@ const Dn = {
716
661
  textRanges: null
717
662
  }
718
663
  };
719
- return u.params.actions = a.reduce((h, f) => $.compose(h, f), null), !!t.syncExecuteCommand(u.id, u.params);
664
+ return u.params.actions = a.reduce((f, h) => $.compose(f, h), null), !!t.syncExecuteCommand(u.id, u.params);
720
665
  }
721
- }, yn = {
666
+ }, vn = {
722
667
  id: "doc.command.update-doc-drawing-wrap-text",
723
668
  type: q.COMMAND,
724
- handler: (r, e) => {
669
+ handler: (i, e) => {
725
670
  if (e == null)
726
671
  return !1;
727
- const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
728
- if (i == null)
672
+ const t = i.get(j), r = i.get(z).getCurrentUniverDocInstance();
673
+ if (r == null)
729
674
  return !1;
730
- const { drawings: o, wrapText: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
731
- for (const h of o) {
732
- const { drawingId: f } = h, m = g[f].wrapText;
675
+ const { drawings: o, wrapText: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = r.getSnapshot();
676
+ for (const f of o) {
677
+ const { drawingId: h } = f, m = g[h].wrapText;
733
678
  if (m !== s) {
734
- const p = d.replaceOp(["drawings", f, "wrapText"], m, s);
679
+ const p = d.replaceOp(["drawings", h, "wrapText"], m, s);
735
680
  a.push(p);
736
681
  }
737
682
  }
@@ -743,29 +688,29 @@ const Dn = {
743
688
  textRanges: null
744
689
  }
745
690
  };
746
- return u.params.actions = a.reduce((h, f) => $.compose(h, f), null), !!t.syncExecuteCommand(u.id, u.params);
691
+ return u.params.actions = a.reduce((f, h) => $.compose(f, h), null), !!t.syncExecuteCommand(u.id, u.params);
747
692
  }
748
- }, Ke = {
693
+ }, qe = {
749
694
  id: "doc.command.update-drawing-doc-transform",
750
695
  type: q.COMMAND,
751
- handler: (r, e) => {
696
+ handler: (i, e) => {
752
697
  if (e == null)
753
698
  return !1;
754
- const t = r.get(j), n = r.get(z), o = r.get(Q).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
699
+ const t = i.get(j), n = i.get(z), o = i.get(Q).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
755
700
  if (s == null)
756
701
  return !1;
757
702
  const c = s.getTransformerByCreate(), d = n.getCurrentUniverDocInstance();
758
703
  if (d == null)
759
704
  return !1;
760
- const { drawings: a, unitId: g } = e, u = $.getInstance(), l = [], { drawings: h = {} } = d.getSnapshot();
705
+ const { drawings: a, unitId: g } = e, u = $.getInstance(), l = [], { drawings: f = {} } = d.getSnapshot();
761
706
  for (const p of a) {
762
- const { drawingId: v, key: D, value: S } = p, O = h[v].docTransform[D];
763
- if (!be.diffValue(O, S)) {
764
- const C = u.replaceOp(["drawings", v, "docTransform", D], O, S);
707
+ const { drawingId: w, key: D, value: S } = p, O = f[w].docTransform[D];
708
+ if (!Me.diffValue(O, S)) {
709
+ const C = u.replaceOp(["drawings", w, "docTransform", D], O, S);
765
710
  l.push(C);
766
711
  }
767
712
  }
768
- const f = {
713
+ const h = {
769
714
  id: ee.id,
770
715
  params: {
771
716
  unitId: g,
@@ -774,91 +719,91 @@ const Dn = {
774
719
  debounce: !0
775
720
  }
776
721
  };
777
- f.params.actions = l.reduce((p, v) => $.compose(p, v), null);
778
- const m = t.syncExecuteCommand(f.id, f.params);
722
+ h.params.actions = l.reduce((p, w) => $.compose(p, w), null);
723
+ const m = t.syncExecuteCommand(h.id, h.params);
779
724
  return c.refreshControls(), !!m;
780
725
  }
781
- }, Tn = {
726
+ }, In = {
782
727
  id: "doc.command.move-inline-drawing",
783
728
  type: q.COMMAND,
784
- handler: (r, e) => {
785
- var U, R;
729
+ handler: (i, e) => {
730
+ var L, R;
786
731
  if (e == null)
787
732
  return !1;
788
- const t = r.get(Q), n = (U = t.getRenderById(e.unitId)) == null ? void 0 : U.with(Ce), i = r.get(ft), o = t.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, c = o == null ? void 0 : o.with(te).getSkeleton();
733
+ const t = i.get(Q), n = (L = t.getRenderById(e.unitId)) == null ? void 0 : L.with(be), r = i.get(ut), o = t.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, c = o == null ? void 0 : o.with(te).getSkeleton();
789
734
  if (s == null || n == null)
790
735
  return !1;
791
- const d = s.getTransformerByCreate(), a = r.get(j), u = r.get(z).getCurrentUniverDocInstance();
736
+ const d = s.getTransformerByCreate(), a = i.get(j), u = i.get(z).getCurrentUniverDocInstance();
792
737
  if (u == null)
793
738
  return !1;
794
- const { drawing: l, unitId: h, offset: f, segmentId: m, segmentPage: p, needRefreshDrawings: v } = e;
795
- if (v)
796
- return i.refreshDrawings(c), d.refreshControls(), !0;
797
- const D = [], { drawingId: S } = l, O = (R = n.getSegment()) != null ? R : "", C = Sn(
739
+ const { drawing: l, unitId: f, offset: h, segmentId: m, segmentPage: p, needRefreshDrawings: w } = e;
740
+ if (w)
741
+ return r.refreshDrawings(c), d.refreshControls(), !0;
742
+ const D = [], { drawingId: S } = l, O = (R = n.getSegment()) != null ? R : "", C = pn(
798
743
  m,
799
744
  O,
800
745
  p,
801
- f,
746
+ h,
802
747
  S,
803
748
  u,
804
749
  n
805
750
  );
806
751
  if (C == null || C.length === 0)
807
- return i.refreshDrawings(c), d.refreshControls(), !1;
752
+ return r.refreshDrawings(c), d.refreshControls(), !1;
808
753
  D.push(...C);
809
754
  const M = {
810
755
  id: ee.id,
811
756
  params: {
812
- unitId: h,
757
+ unitId: f,
813
758
  actions: [],
814
759
  textRanges: null
815
760
  }
816
761
  };
817
- M.params.actions = D.reduce((w, N) => $.compose(w, N), null);
762
+ M.params.actions = D.reduce((v, N) => $.compose(v, N), null);
818
763
  const A = a.syncExecuteCommand(M.id, M.params);
819
764
  return d.refreshControls(), !!A;
820
765
  }
821
- }, Mn = {
766
+ }, _n = {
822
767
  id: "doc.command.transform-non-inline-drawing",
823
768
  type: q.COMMAND,
824
769
  // eslint-disable-next-line max-lines-per-function
825
- handler: (r, e) => {
826
- var x, G;
770
+ handler: (i, e) => {
771
+ var x, H;
827
772
  if (e == null)
828
773
  return !1;
829
- const t = r.get(Q), n = (x = t.getRenderById(e.unitId)) == null ? void 0 : x.with(Ce), i = t.getRenderById(e.unitId), o = i == null ? void 0 : i.scene;
774
+ const t = i.get(Q), n = (x = t.getRenderById(e.unitId)) == null ? void 0 : x.with(be), r = t.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
830
775
  if (o == null || n == null)
831
776
  return !1;
832
- const s = o.getTransformerByCreate(), c = r.get(j), a = r.get(z).getCurrentUniverDocInstance();
777
+ const s = o.getTransformerByCreate(), c = i.get(j), a = i.get(z).getCurrentUniverDocInstance();
833
778
  if (a == null)
834
779
  return !1;
835
- const { drawing: g, unitId: u, offset: l, docTransform: h, segmentId: f, segmentPage: m } = e, p = [], { drawingId: v } = g, D = (G = n.getSegment()) != null ? G : "", S = Sn(
836
- f,
780
+ const { drawing: g, unitId: u, offset: l, docTransform: f, segmentId: h, segmentPage: m } = e, p = [], { drawingId: w } = g, D = (H = n.getSegment()) != null ? H : "", S = pn(
781
+ h,
837
782
  D,
838
783
  m,
839
784
  l,
840
- v,
785
+ w,
841
786
  a,
842
787
  n
843
788
  );
844
789
  if (S == null)
845
790
  return !1;
846
791
  S.length > 0 && p.push(...S);
847
- const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(), M = C[v].docTransform, { positionH: A, positionV: U, size: R, angle: w } = M;
848
- if (!be.diffValue(A, h.positionH)) {
849
- const I = O.replaceOp(["drawings", v, "docTransform", "positionH"], A, h.positionH);
792
+ const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(), M = C[w].docTransform, { positionH: A, positionV: L, size: R, angle: v } = M;
793
+ if (!Me.diffValue(A, f.positionH)) {
794
+ const I = O.replaceOp(["drawings", w, "docTransform", "positionH"], A, f.positionH);
850
795
  p.push(I);
851
796
  }
852
- if (!be.diffValue(U, h.positionV)) {
853
- const I = O.replaceOp(["drawings", v, "docTransform", "positionV"], U, h.positionV);
797
+ if (!Me.diffValue(L, f.positionV)) {
798
+ const I = O.replaceOp(["drawings", w, "docTransform", "positionV"], L, f.positionV);
854
799
  p.push(I);
855
800
  }
856
- if (!be.diffValue(R, h.size)) {
857
- const I = O.replaceOp(["drawings", v, "docTransform", "size"], R, h.size);
801
+ if (!Me.diffValue(R, f.size)) {
802
+ const I = O.replaceOp(["drawings", w, "docTransform", "size"], R, f.size);
858
803
  p.push(I);
859
804
  }
860
- if (!be.diffValue(w, h.angle)) {
861
- const I = O.replaceOp(["drawings", v, "docTransform", "angle"], w, h.angle);
805
+ if (!Me.diffValue(v, f.angle)) {
806
+ const I = O.replaceOp(["drawings", w, "docTransform", "angle"], v, f.angle);
862
807
  p.push(I);
863
808
  }
864
809
  const N = {
@@ -871,62 +816,62 @@ const Dn = {
871
816
  }
872
817
  };
873
818
  N.params.actions = p.reduce((I, _) => $.compose(I, _), null);
874
- const H = c.syncExecuteCommand(N.id, N.params);
875
- return s.refreshControls(), !!H;
819
+ const G = c.syncExecuteCommand(N.id, N.params);
820
+ return s.refreshControls(), !!G;
876
821
  }
877
- }, Ye = {
822
+ }, Ke = {
878
823
  id: "doc.command.move-drawing",
879
824
  type: q.COMMAND,
880
- handler: (r, e) => {
881
- const t = r.get(j), n = r.get(Ue), i = r.get(z), o = r.get(Q), { direction: s } = e, c = n.getFocusDrawings();
825
+ handler: (i, e) => {
826
+ const t = i.get(j), n = i.get(Ue), r = i.get(z), o = i.get(Q), { direction: s } = e, c = n.getFocusDrawings();
882
827
  if (c.length === 0)
883
828
  return !1;
884
829
  const d = c[0].unitId, a = o.getRenderById(d), g = a == null ? void 0 : a.scene;
885
830
  if (g == null)
886
831
  return !1;
887
- const u = g.getTransformerByCreate(), l = i.getUniverDocInstance(d), h = c.map((m) => {
888
- var M, A, U, R, w;
889
- const { drawingId: p } = m, v = (M = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : M[p];
890
- if (v == null || v.layoutType === F.INLINE)
832
+ const u = g.getTransformerByCreate(), l = r.getUniverDocInstance(d), f = c.map((m) => {
833
+ var M, A, L, R, v;
834
+ const { drawingId: p } = m, w = (M = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : M[p];
835
+ if (w == null || w.layoutType === k.INLINE)
891
836
  return null;
892
- const { positionH: D, positionV: S } = v.docTransform, O = { ...D }, C = { ...S };
893
- return s === fe.UP ? C.posOffset = ((A = C.posOffset) != null ? A : 0) - 2 : s === fe.DOWN ? C.posOffset = ((U = C.posOffset) != null ? U : 0) + 2 : s === fe.LEFT ? O.posOffset = ((R = O.posOffset) != null ? R : 0) - 2 : s === fe.RIGHT && (O.posOffset = ((w = O.posOffset) != null ? w : 0) + 2), {
837
+ const { positionH: D, positionV: S } = w.docTransform, O = { ...D }, C = { ...S };
838
+ return s === he.UP ? C.posOffset = ((A = C.posOffset) != null ? A : 0) - 2 : s === he.DOWN ? C.posOffset = ((L = C.posOffset) != null ? L : 0) + 2 : s === he.LEFT ? O.posOffset = ((R = O.posOffset) != null ? R : 0) - 2 : s === he.RIGHT && (O.posOffset = ((v = O.posOffset) != null ? v : 0) + 2), {
894
839
  drawingId: p,
895
- key: s === fe.UP || s === fe.DOWN ? "positionV" : "positionH",
896
- value: s === fe.UP || s === fe.DOWN ? C : O
840
+ key: s === he.UP || s === he.DOWN ? "positionV" : "positionH",
841
+ value: s === he.UP || s === he.DOWN ? C : O
897
842
  };
898
843
  }).filter((m) => m != null);
899
- if (h.length === 0)
844
+ if (f.length === 0)
900
845
  return !1;
901
- const f = t.syncExecuteCommand(Ke.id, {
846
+ const h = t.syncExecuteCommand(qe.id, {
902
847
  unitId: d,
903
848
  subUnitId: d,
904
- drawings: h
849
+ drawings: f
905
850
  });
906
- return u.refreshControls(), !!f;
851
+ return u.refreshControls(), !!h;
907
852
  }
908
- }, Jr = {
853
+ }, Wr = {
909
854
  id: "doc.operation.clear-drawing-transformer",
910
855
  type: q.MUTATION,
911
- handler: (r, e) => {
912
- const t = r.get(Q);
856
+ handler: (i, e) => {
857
+ const t = i.get(Q);
913
858
  return e.forEach((n) => {
914
- var i, o;
915
- (o = (i = t.getRenderById(n)) == null ? void 0 : i.scene.getTransformer()) == null || o.debounceRefreshControls();
859
+ var r, o;
860
+ (o = (r = t.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || o.debounceRefreshControls();
916
861
  }), !0;
917
862
  }
918
- }, bn = "COMPONENT_DOC_DRAWING_PANEL", Cn = {
863
+ }, Sn = "COMPONENT_DOC_DRAWING_PANEL", Dn = {
919
864
  id: "sidebar.operation.doc-image",
920
865
  type: q.COMMAND,
921
- handler: async (r, e) => {
922
- const t = r.get(Sr), n = r.get(ut), i = r.get(pe);
866
+ handler: async (i, e) => {
867
+ const t = i.get(fr), n = i.get(lt), r = i.get(fe);
923
868
  switch (e.value) {
924
869
  case "open":
925
870
  t.open({
926
871
  header: { title: n.t("docImage.panel.title") },
927
- children: { label: bn },
872
+ children: { label: Sn },
928
873
  onClose: () => {
929
- i.focusDrawing(null);
874
+ r.focusDrawing(null);
930
875
  },
931
876
  width: 360
932
877
  });
@@ -938,21 +883,21 @@ const Dn = {
938
883
  }
939
884
  return !0;
940
885
  }
941
- }, En = {
886
+ }, On = {
942
887
  id: "doc.operation.edit-doc-image",
943
888
  type: q.OPERATION,
944
- handler: (r, e) => {
945
- const t = r.get(pe), n = r.get(j);
946
- return e == null ? !1 : (t.focusDrawing([e]), n.executeCommand(Cn.id, { value: "open" }), !0);
889
+ handler: (i, e) => {
890
+ const t = i.get(fe), n = i.get(j);
891
+ return e == null ? !1 : (t.focusDrawing([e]), n.executeCommand(Dn.id, { value: "open" }), !0);
947
892
  }
948
- }, Xt = -1e3, qt = 1e3, ei = (r) => {
949
- const e = ve(j), t = ve(ut), n = ve(pe), i = ve(Q), o = ve(z), { drawings: s } = r, c = s[0];
893
+ }, zt = -1e3, Xt = 1e3, Gr = (i) => {
894
+ const e = me(j), t = me(lt), n = me(fe), r = me(Q), o = me(z), { drawings: s } = i, c = s[0];
950
895
  if (c == null)
951
896
  return;
952
- const { unitId: d } = c, a = o.getUniverDocInstance(d), g = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, u = i.getRenderById(d), l = u == null ? void 0 : u.scene;
897
+ const { unitId: d } = c, a = o.getUniverDocInstance(d), g = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, u = r.getRenderById(d), l = u == null ? void 0 : u.scene;
953
898
  if (l == null)
954
899
  return;
955
- const h = l.getTransformerByCreate(), f = [{
900
+ const f = l.getTransformerByCreate(), h = [{
956
901
  label: t.t("image-position.column"),
957
902
  value: String(J.COLUMN)
958
903
  }, {
@@ -964,139 +909,139 @@ const Dn = {
964
909
  }], m = [{
965
910
  label: t.t("image-position.line"),
966
911
  value: String(W.LINE),
967
- disabled: g === mt.MODERN
912
+ disabled: g === pt.MODERN
968
913
  }, {
969
914
  label: t.t("image-position.page"),
970
915
  value: String(W.PAGE),
971
- disabled: g === mt.MODERN
916
+ disabled: g === pt.MODERN
972
917
  }, {
973
918
  label: t.t("image-position.margin"),
974
919
  value: String(W.MARGIN),
975
- disabled: g === mt.MODERN
920
+ disabled: g === pt.MODERN
976
921
  }, {
977
922
  label: t.t("image-position.paragraph"),
978
923
  value: String(W.PARAGRAPH)
979
- }], [p, v] = ie(!0), [D, S] = ie({
924
+ }], [p, w] = ie(!0), [D, S] = ie({
980
925
  relativeFrom: J.PAGE,
981
926
  posOffset: 0
982
927
  }), [O, C] = ie({
983
928
  relativeFrom: W.PAGE,
984
929
  posOffset: 0
985
- }), [M, A] = ie(!0), [U, R] = ie(!0);
986
- function w(_, E) {
930
+ }), [M, A] = ie(!0), [L, R] = ie(!0);
931
+ function v(_, E) {
987
932
  var b;
988
933
  _ === "positionH" ? S(E) : C(E);
989
- const y = n.getFocusDrawings();
990
- if (y.length === 0)
934
+ const T = n.getFocusDrawings();
935
+ if (T.length === 0)
991
936
  return;
992
- const L = y.map((P) => ({
937
+ const U = T.map((P) => ({
993
938
  unitId: P.unitId,
994
939
  subUnitId: P.subUnitId,
995
940
  drawingId: P.drawingId
996
941
  }));
997
- e.executeCommand(Ke.id, {
998
- unitId: y[0].unitId,
999
- subUnitId: y[0].unitId,
1000
- drawings: L.map((P) => ({
942
+ e.executeCommand(qe.id, {
943
+ unitId: T[0].unitId,
944
+ subUnitId: T[0].unitId,
945
+ drawings: U.map((P) => ({
1001
946
  drawingId: P.drawingId,
1002
947
  key: _,
1003
948
  value: E
1004
949
  }))
1005
950
  });
1006
- const B = (b = i.getRenderById(d)) == null ? void 0 : b.with(Ce);
1007
- B && B.blur(), h.refreshControls();
951
+ const B = (b = r.getRenderById(d)) == null ? void 0 : b.with(be);
952
+ B && B.blur(), f.refreshControls();
1008
953
  }
1009
954
  function N(_) {
1010
- var re, _e, Se;
1011
- const E = D.relativeFrom, y = D.posOffset, L = Number(_);
1012
- if (E === L)
955
+ var re, Ie, _e;
956
+ const E = D.relativeFrom, T = D.posOffset, U = Number(_);
957
+ if (E === U)
1013
958
  return;
1014
959
  const B = n.getFocusDrawings();
1015
960
  if (B.length === 0)
1016
961
  return;
1017
962
  const b = B[0].drawingId, P = B[0].unitId;
1018
- let V = null, k = 0;
1019
- const K = (re = i.getRenderById(P)) == null ? void 0 : re.with(te).getSkeleton(), se = K == null ? void 0 : K.getSkeletonData();
963
+ let V = null, F = 0;
964
+ const K = (re = r.getRenderById(P)) == null ? void 0 : re.with(te).getSkeleton(), se = K == null ? void 0 : K.getSkeletonData();
1020
965
  if (se == null)
1021
966
  return;
1022
- const { pages: Be, skeHeaders: Ee, skeFooters: Ge } = se;
1023
- for (const ce of Be) {
1024
- const { marginLeft: Oe, skeDrawings: ye, headerId: Re, footerId: Ae, pageWidth: Te } = ce;
1025
- if (ye.has(b)) {
1026
- V = ye.get(b), k = Oe;
967
+ const { pages: Le, skeHeaders: Ce, skeFooters: Ge } = se;
968
+ for (const ce of Le) {
969
+ const { marginLeft: De, skeDrawings: Oe, headerId: Ee, footerId: Re, pageWidth: Te } = ce;
970
+ if (Oe.has(b)) {
971
+ V = Oe.get(b), F = De;
1027
972
  break;
1028
973
  }
1029
- const de = (_e = Ee.get(Re)) == null ? void 0 : _e.get(Te);
974
+ const de = (Ie = Ce.get(Ee)) == null ? void 0 : Ie.get(Te);
1030
975
  if (de != null && de.skeDrawings.has(b)) {
1031
- V = de == null ? void 0 : de.skeDrawings.get(b), k = Oe;
976
+ V = de == null ? void 0 : de.skeDrawings.get(b), F = De;
1032
977
  break;
1033
978
  }
1034
- const ge = (Se = Ge.get(Ae)) == null ? void 0 : Se.get(Te);
979
+ const ge = (_e = Ge.get(Re)) == null ? void 0 : _e.get(Te);
1035
980
  if (ge != null && ge.skeDrawings.has(b)) {
1036
- V = ge == null ? void 0 : ge.skeDrawings.get(b), k = Oe;
981
+ V = ge == null ? void 0 : ge.skeDrawings.get(b), F = De;
1037
982
  break;
1038
983
  }
1039
984
  }
1040
985
  if (V == null)
1041
986
  return;
1042
987
  let ae = 0;
1043
- E === J.COLUMN ? ae -= V.columnLeft : E === J.MARGIN && (ae -= k), L === J.COLUMN ? ae += V.columnLeft : L === J.MARGIN ? ae += k : J.PAGE;
988
+ E === J.COLUMN ? ae -= V.columnLeft : E === J.MARGIN && (ae -= F), U === J.COLUMN ? ae += V.columnLeft : U === J.MARGIN ? ae += F : J.PAGE;
1044
989
  const ne = {
1045
- relativeFrom: L,
1046
- posOffset: (y != null ? y : 0) - ae
990
+ relativeFrom: U,
991
+ posOffset: (T != null ? T : 0) - ae
1047
992
  };
1048
- w("positionH", ne);
993
+ v("positionH", ne);
1049
994
  }
1050
- function H(_) {
1051
- var ye, Re, Ae, Te, de, ge;
1052
- const E = O.relativeFrom, y = O.posOffset, L = Number(_);
1053
- if (E === L)
995
+ function G(_) {
996
+ var Oe, Ee, Re, Te, de, ge;
997
+ const E = O.relativeFrom, T = O.posOffset, U = Number(_);
998
+ if (E === U)
1054
999
  return;
1055
1000
  const B = n.getFocusDrawings();
1056
1001
  if (B.length === 0)
1057
1002
  return;
1058
- const { drawingId: b, unitId: P } = B[0], V = o.getUniverDocInstance(P), k = (ye = i.getRenderById(P)) == null ? void 0 : ye.with(te).getSkeleton(), K = (Re = i.getRenderById(P)) == null ? void 0 : Re.with(Ce), se = K == null ? void 0 : K.getSegment(), Be = K == null ? void 0 : K.getSegmentPage(), Ee = (Te = (Ae = V == null ? void 0 : V.getSelfOrHeaderFooterModel(se).getBody()) == null ? void 0 : Ae.customBlocks) == null ? void 0 : Te.find((Pe) => Pe.blockId === b);
1059
- if (Ee == null || k == null || K == null)
1003
+ const { drawingId: b, unitId: P } = B[0], V = o.getUniverDocInstance(P), F = (Oe = r.getRenderById(P)) == null ? void 0 : Oe.with(te).getSkeleton(), K = (Ee = r.getRenderById(P)) == null ? void 0 : Ee.with(be), se = K == null ? void 0 : K.getSegment(), Le = K == null ? void 0 : K.getSegmentPage(), Ce = (Te = (Re = V == null ? void 0 : V.getSelfOrHeaderFooterModel(se).getBody()) == null ? void 0 : Re.customBlocks) == null ? void 0 : Te.find((Ae) => Ae.blockId === b);
1004
+ if (Ce == null || F == null || K == null)
1060
1005
  return;
1061
- const { startIndex: Ge } = Ee, ae = k.findNodeByCharIndex(Ge, se, Be), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, re = ne == null ? void 0 : ne.parent, _e = re == null ? void 0 : re.lines.find((Pe) => Pe.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Pe.paragraphStart), Se = (ge = re == null ? void 0 : re.parent) == null ? void 0 : ge.parent;
1062
- if (ae == null || ne == null || _e == null || re == null || Se == null)
1006
+ const { startIndex: Ge } = Ce, ae = F.findNodeByCharIndex(Ge, se, Le), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, re = ne == null ? void 0 : ne.parent, Ie = re == null ? void 0 : re.lines.find((Ae) => Ae.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Ae.paragraphStart), _e = (ge = re == null ? void 0 : re.parent) == null ? void 0 : ge.parent;
1007
+ if (ae == null || ne == null || Ie == null || re == null || _e == null)
1063
1008
  return;
1064
1009
  let ce = 0;
1065
- E === W.PARAGRAPH ? ce -= _e.top : E === W.LINE ? ce -= ne.top : E === W.PAGE && (ce += Se.marginTop), L === W.PARAGRAPH ? ce += _e.top : L === W.LINE ? ce += ne.top : L === W.PAGE && (ce -= Se.marginTop);
1066
- const Oe = {
1067
- relativeFrom: L,
1068
- posOffset: (y != null ? y : 0) - ce
1010
+ E === W.PARAGRAPH ? ce -= Ie.top : E === W.LINE ? ce -= ne.top : E === W.PAGE && (ce += _e.marginTop), U === W.PARAGRAPH ? ce += Ie.top : U === W.LINE ? ce += ne.top : U === W.PAGE && (ce -= _e.marginTop);
1011
+ const De = {
1012
+ relativeFrom: U,
1013
+ posOffset: (T != null ? T : 0) - ce
1069
1014
  };
1070
- w("positionV", Oe);
1015
+ v("positionV", De);
1071
1016
  }
1072
1017
  function x(_) {
1073
1018
  var P;
1074
- const E = a == null ? void 0 : a.getSnapshot(), y = (P = E == null ? void 0 : E.drawings) == null ? void 0 : P[_.drawingId];
1075
- if (y == null)
1019
+ const E = a == null ? void 0 : a.getSnapshot(), T = (P = E == null ? void 0 : E.drawings) == null ? void 0 : P[_.drawingId];
1020
+ if (T == null)
1076
1021
  return;
1077
- const { layoutType: L } = y, {
1022
+ const { layoutType: U } = T, {
1078
1023
  positionH: B,
1079
1024
  positionV: b
1080
- } = y.docTransform;
1081
- S(B), C(b), v(L === F.INLINE), A(b.relativeFrom === W.PARAGRAPH || b.relativeFrom === W.LINE);
1025
+ } = T.docTransform;
1026
+ S(B), C(b), w(U === k.INLINE), A(b.relativeFrom === W.PARAGRAPH || b.relativeFrom === W.LINE);
1082
1027
  }
1083
- function G() {
1028
+ function H() {
1084
1029
  const _ = n.getFocusDrawings();
1085
1030
  _.length !== 0 && x(_[0]);
1086
1031
  }
1087
1032
  function I(_) {
1088
- A(_), H(String(_ ? W.PARAGRAPH : W.PAGE));
1033
+ A(_), G(String(_ ? W.PARAGRAPH : W.PAGE));
1089
1034
  }
1090
1035
  return Tt(() => {
1091
- G();
1092
- const _ = n.focus$.subscribe((y) => {
1093
- if (y.length === 0) {
1036
+ H();
1037
+ const _ = n.focus$.subscribe((T) => {
1038
+ if (T.length === 0) {
1094
1039
  R(!1);
1095
1040
  return;
1096
1041
  }
1097
- R(!0), x(y[0]);
1098
- }), E = e.onCommandExecuted(async (y) => {
1099
- y.id === ee.id && G();
1042
+ R(!0), x(T[0]);
1043
+ }), E = e.onCommandExecuted(async (T) => {
1044
+ T.id === ee.id && H();
1100
1045
  });
1101
1046
  return () => {
1102
1047
  _.unsubscribe(), E.dispose();
@@ -1104,22 +1049,22 @@ const Dn = {
1104
1049
  }, []), /* @__PURE__ */ X(
1105
1050
  "div",
1106
1051
  {
1107
- className: dn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1108
- "univer-hidden": !U
1052
+ className: cn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1053
+ "univer-hidden": !L
1109
1054
  }),
1110
1055
  children: [
1111
- /* @__PURE__ */ T(
1056
+ /* @__PURE__ */ y(
1112
1057
  "header",
1113
1058
  {
1114
1059
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1115
- children: /* @__PURE__ */ T("div", { children: t.t("image-position.title") })
1060
+ children: /* @__PURE__ */ y("div", { children: t.t("image-position.title") })
1116
1061
  }
1117
1062
  ),
1118
- /* @__PURE__ */ T(
1063
+ /* @__PURE__ */ y(
1119
1064
  "div",
1120
1065
  {
1121
1066
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1122
- children: /* @__PURE__ */ T("div", { children: t.t("image-position.horizontal") })
1067
+ children: /* @__PURE__ */ y("div", { children: t.t("image-position.horizontal") })
1123
1068
  }
1124
1069
  ),
1125
1070
  /* @__PURE__ */ X(
@@ -1128,17 +1073,17 @@ const Dn = {
1128
1073
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1129
1074
  children: [
1130
1075
  /* @__PURE__ */ X("div", { children: [
1131
- /* @__PURE__ */ T("span", { children: t.t("image-position.absolutePosition") }),
1132
- /* @__PURE__ */ T(
1076
+ /* @__PURE__ */ y("span", { children: t.t("image-position.absolutePosition") }),
1077
+ /* @__PURE__ */ y(
1133
1078
  Fe,
1134
1079
  {
1135
- min: Xt,
1136
- max: qt,
1080
+ min: zt,
1081
+ max: Xt,
1137
1082
  precision: 1,
1138
1083
  disabled: p,
1139
1084
  value: D.posOffset,
1140
1085
  onChange: (_) => {
1141
- w("positionH", {
1086
+ v("positionH", {
1142
1087
  relativeFrom: D.relativeFrom,
1143
1088
  posOffset: _
1144
1089
  });
@@ -1147,13 +1092,13 @@ const Dn = {
1147
1092
  )
1148
1093
  ] }),
1149
1094
  /* @__PURE__ */ X("div", { children: [
1150
- /* @__PURE__ */ T("span", { children: t.t("image-position.toTheRightOf") }),
1151
- /* @__PURE__ */ T(
1152
- Ht,
1095
+ /* @__PURE__ */ y("span", { children: t.t("image-position.toTheRightOf") }),
1096
+ /* @__PURE__ */ y(
1097
+ Wt,
1153
1098
  {
1154
1099
  value: String(D.relativeFrom),
1155
1100
  disabled: p,
1156
- options: f,
1101
+ options: h,
1157
1102
  onChange: N
1158
1103
  }
1159
1104
  )
@@ -1161,11 +1106,11 @@ const Dn = {
1161
1106
  ]
1162
1107
  }
1163
1108
  ),
1164
- /* @__PURE__ */ T(
1109
+ /* @__PURE__ */ y(
1165
1110
  "div",
1166
1111
  {
1167
1112
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1168
- children: /* @__PURE__ */ T("div", { children: t.t("image-position.vertical") })
1113
+ children: /* @__PURE__ */ y("div", { children: t.t("image-position.vertical") })
1169
1114
  }
1170
1115
  ),
1171
1116
  /* @__PURE__ */ X(
@@ -1174,17 +1119,17 @@ const Dn = {
1174
1119
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1175
1120
  children: [
1176
1121
  /* @__PURE__ */ X("div", { children: [
1177
- /* @__PURE__ */ T("span", { children: t.t("image-position.absolutePosition") }),
1178
- /* @__PURE__ */ T(
1122
+ /* @__PURE__ */ y("span", { children: t.t("image-position.absolutePosition") }),
1123
+ /* @__PURE__ */ y(
1179
1124
  Fe,
1180
1125
  {
1181
- min: Xt,
1182
- max: qt,
1126
+ min: zt,
1127
+ max: Xt,
1183
1128
  precision: 1,
1184
1129
  disabled: p,
1185
1130
  value: O.posOffset,
1186
1131
  onChange: (_) => {
1187
- w("positionV", {
1132
+ v("positionV", {
1188
1133
  relativeFrom: O.relativeFrom,
1189
1134
  posOffset: _
1190
1135
  });
@@ -1193,29 +1138,29 @@ const Dn = {
1193
1138
  )
1194
1139
  ] }),
1195
1140
  /* @__PURE__ */ X("div", { children: [
1196
- /* @__PURE__ */ T("span", { children: t.t("image-position.bellow") }),
1197
- /* @__PURE__ */ T(
1198
- Ht,
1141
+ /* @__PURE__ */ y("span", { children: t.t("image-position.bellow") }),
1142
+ /* @__PURE__ */ y(
1143
+ Wt,
1199
1144
  {
1200
1145
  disabled: p,
1201
1146
  value: String(O.relativeFrom),
1202
1147
  options: m,
1203
- onChange: H
1148
+ onChange: G
1204
1149
  }
1205
1150
  )
1206
1151
  ] })
1207
1152
  ]
1208
1153
  }
1209
1154
  ),
1210
- /* @__PURE__ */ T(
1155
+ /* @__PURE__ */ y(
1211
1156
  "div",
1212
1157
  {
1213
1158
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1214
- children: /* @__PURE__ */ T("div", { children: t.t("image-position.options") })
1159
+ children: /* @__PURE__ */ y("div", { children: t.t("image-position.options") })
1215
1160
  }
1216
1161
  ),
1217
- /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(
1218
- Ur,
1162
+ /* @__PURE__ */ y("div", { children: /* @__PURE__ */ y(
1163
+ Er,
1219
1164
  {
1220
1165
  disabled: p,
1221
1166
  checked: M,
@@ -1226,33 +1171,33 @@ const Dn = {
1226
1171
  ]
1227
1172
  }
1228
1173
  );
1229
- }, Je = 0, et = 100, ti = (r) => {
1230
- const e = ve(j), t = ve(ut), n = ve(pe), i = ve(Q), o = ve(z), { drawings: s } = r, c = s[0];
1174
+ }, Qe = 0, Je = 100, Hr = (i) => {
1175
+ const e = me(j), t = me(lt), n = me(fe), r = me(Q), o = me(z), { drawings: s } = i, c = s[0];
1231
1176
  if (c == null)
1232
1177
  return null;
1233
- const { unitId: d } = c, a = o.getUniverDocInstance(d), g = i.getRenderById(d);
1178
+ const { unitId: d } = c, a = o.getUniverDocInstance(d), g = r.getRenderById(d);
1234
1179
  if ((g == null ? void 0 : g.scene) == null)
1235
1180
  return null;
1236
- const [l, h] = ie(!0), [f, m] = ie(!0), [p, v] = ie(!0), [D, S] = ie(ue.INLINE), [O, C] = ie(""), [M, A] = ie({
1181
+ const [l, f] = ie(!0), [h, m] = ie(!0), [p, w] = ie(!0), [D, S] = ie(ue.INLINE), [O, C] = ie(""), [M, A] = ie({
1237
1182
  distT: 0,
1238
1183
  distL: 0,
1239
1184
  distB: 0,
1240
1185
  distR: 0
1241
- }), [U, R] = ie(!0);
1242
- function w(I) {
1186
+ }), [L, R] = ie(!0);
1187
+ function v(I) {
1243
1188
  S(I);
1244
1189
  const _ = n.getFocusDrawings();
1245
1190
  if (_.length === 0)
1246
1191
  return;
1247
- const { unitId: E, subUnitId: y } = _[0], L = _.map(({ unitId: B, subUnitId: b, drawingId: P }) => ({
1192
+ const { unitId: E, subUnitId: T } = _[0], U = _.map(({ unitId: B, subUnitId: b, drawingId: P }) => ({
1248
1193
  unitId: B,
1249
1194
  subUnitId: b,
1250
1195
  drawingId: P
1251
1196
  }));
1252
- e.executeCommand(Dn.id, {
1197
+ e.executeCommand(mn.id, {
1253
1198
  unitId: E,
1254
- subUnitId: y,
1255
- drawings: L,
1199
+ subUnitId: T,
1200
+ drawings: U,
1256
1201
  wrappingStyle: I
1257
1202
  });
1258
1203
  }
@@ -1261,35 +1206,35 @@ const Dn = {
1261
1206
  const _ = n.getFocusDrawings();
1262
1207
  if (_.length === 0)
1263
1208
  return;
1264
- const E = _.map((y) => ({
1265
- unitId: y.unitId,
1266
- subUnitId: y.subUnitId,
1267
- drawingId: y.drawingId
1209
+ const E = _.map((T) => ({
1210
+ unitId: T.unitId,
1211
+ subUnitId: T.subUnitId,
1212
+ drawingId: T.drawingId
1268
1213
  }));
1269
- e.executeCommand(yn.id, {
1214
+ e.executeCommand(vn.id, {
1270
1215
  unitId: _[0].unitId,
1271
1216
  subUnitId: _[0].unitId,
1272
1217
  drawings: E,
1273
1218
  wrapText: I
1274
1219
  });
1275
1220
  }
1276
- function H(I, _) {
1221
+ function G(I, _) {
1277
1222
  if (I == null)
1278
1223
  return;
1279
1224
  const E = { ...M, [_]: I };
1280
1225
  A(E);
1281
- const y = n.getFocusDrawings();
1282
- if (y.length === 0)
1226
+ const T = n.getFocusDrawings();
1227
+ if (T.length === 0)
1283
1228
  return;
1284
- const L = y.map((B) => ({
1229
+ const U = T.map((B) => ({
1285
1230
  unitId: B.unitId,
1286
1231
  subUnitId: B.subUnitId,
1287
1232
  drawingId: B.drawingId
1288
1233
  }));
1289
- e.executeCommand(On.id, {
1290
- unitId: y[0].unitId,
1291
- subUnitId: y[0].unitId,
1292
- drawings: L,
1234
+ e.executeCommand(wn.id, {
1235
+ unitId: T[0].unitId,
1236
+ subUnitId: T[0].unitId,
1237
+ drawings: U,
1293
1238
  dist: {
1294
1239
  [_]: I
1295
1240
  }
@@ -1297,38 +1242,38 @@ const Dn = {
1297
1242
  }
1298
1243
  function x() {
1299
1244
  const I = n.getFocusDrawings();
1300
- I.length !== 0 && G(I[0]);
1245
+ I.length !== 0 && H(I[0]);
1301
1246
  }
1302
- function G(I) {
1247
+ function H(I) {
1303
1248
  var K, se;
1304
1249
  const _ = (se = (K = a == null ? void 0 : a.getSnapshot()) == null ? void 0 : K.drawings) == null ? void 0 : se[I.drawingId];
1305
1250
  if (_ == null)
1306
1251
  return;
1307
1252
  const {
1308
1253
  distT: E = 0,
1309
- distL: y = 0,
1310
- distB: L = 0,
1254
+ distL: T = 0,
1255
+ distB: U = 0,
1311
1256
  distR: B = 0,
1312
- layoutType: b = F.INLINE,
1257
+ layoutType: b = k.INLINE,
1313
1258
  behindDoc: P = oe.FALSE,
1314
- wrapText: V = Xe.BOTH_SIDES
1259
+ wrapText: V = ze.BOTH_SIDES
1315
1260
  } = _;
1316
1261
  if (A({
1317
1262
  distT: E,
1318
- distL: y,
1319
- distB: L,
1263
+ distL: T,
1264
+ distB: U,
1320
1265
  distR: B
1321
- }), C(V), h(b !== F.WRAP_SQUARE), b === F.WRAP_NONE || b === F.INLINE ? m(!0) : m(!1), b === F.WRAP_NONE || b === F.INLINE || b === F.WRAP_TOP_AND_BOTTOM ? v(!0) : v(!1), b === F.WRAP_NONE)
1266
+ }), C(V), f(b !== k.WRAP_SQUARE), b === k.WRAP_NONE || b === k.INLINE ? m(!0) : m(!1), b === k.WRAP_NONE || b === k.INLINE || b === k.WRAP_TOP_AND_BOTTOM ? w(!0) : w(!1), b === k.WRAP_NONE)
1322
1267
  P === oe.TRUE ? S(ue.BEHIND_TEXT) : S(ue.IN_FRONT_OF_TEXT);
1323
1268
  else
1324
1269
  switch (b) {
1325
- case F.INLINE:
1270
+ case k.INLINE:
1326
1271
  S(ue.INLINE);
1327
1272
  break;
1328
- case F.WRAP_SQUARE:
1273
+ case k.WRAP_SQUARE:
1329
1274
  S(ue.WRAP_SQUARE);
1330
1275
  break;
1331
- case F.WRAP_TOP_AND_BOTTOM:
1276
+ case k.WRAP_TOP_AND_BOTTOM:
1332
1277
  S(ue.WRAP_TOP_AND_BOTTOM);
1333
1278
  break;
1334
1279
  default:
@@ -1342,7 +1287,7 @@ const Dn = {
1342
1287
  R(!1);
1343
1288
  return;
1344
1289
  }
1345
- R(!0), G(E[0]);
1290
+ R(!0), H(E[0]);
1346
1291
  }), _ = e.onCommandExecuted(async (E) => {
1347
1292
  E.id === ee.id && x();
1348
1293
  });
@@ -1352,48 +1297,48 @@ const Dn = {
1352
1297
  }, []), /* @__PURE__ */ X(
1353
1298
  "div",
1354
1299
  {
1355
- className: dn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1356
- "univer-hidden": !U
1300
+ className: cn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1301
+ "univer-hidden": !L
1357
1302
  }),
1358
1303
  children: [
1359
- /* @__PURE__ */ T(
1304
+ /* @__PURE__ */ y(
1360
1305
  "header",
1361
1306
  {
1362
1307
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1363
- children: /* @__PURE__ */ T("div", { children: t.t("image-text-wrap.title") })
1308
+ children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.title") })
1364
1309
  }
1365
1310
  ),
1366
- /* @__PURE__ */ T(
1311
+ /* @__PURE__ */ y(
1367
1312
  "div",
1368
1313
  {
1369
1314
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1370
- children: /* @__PURE__ */ T("div", { children: t.t("image-text-wrap.wrappingStyle") })
1315
+ children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.wrappingStyle") })
1371
1316
  }
1372
1317
  ),
1373
- /* @__PURE__ */ T("div", { children: /* @__PURE__ */ X(Gt, { value: D, onChange: w, direction: "vertical", children: [
1374
- /* @__PURE__ */ T(Me, { value: ue.INLINE, children: t.t("image-text-wrap.inline") }),
1375
- /* @__PURE__ */ T(Me, { value: ue.WRAP_SQUARE, children: t.t("image-text-wrap.square") }),
1376
- /* @__PURE__ */ T(Me, { value: ue.WRAP_TOP_AND_BOTTOM, children: t.t("image-text-wrap.topAndBottom") }),
1377
- /* @__PURE__ */ T(Me, { value: ue.BEHIND_TEXT, children: t.t("image-text-wrap.behindText") }),
1378
- /* @__PURE__ */ T(Me, { value: ue.IN_FRONT_OF_TEXT, children: t.t("image-text-wrap.inFrontText") })
1318
+ /* @__PURE__ */ y("div", { children: /* @__PURE__ */ X(Gt, { value: D, onChange: v, direction: "vertical", children: [
1319
+ /* @__PURE__ */ y(ye, { value: ue.INLINE, children: t.t("image-text-wrap.inline") }),
1320
+ /* @__PURE__ */ y(ye, { value: ue.WRAP_SQUARE, children: t.t("image-text-wrap.square") }),
1321
+ /* @__PURE__ */ y(ye, { value: ue.WRAP_TOP_AND_BOTTOM, children: t.t("image-text-wrap.topAndBottom") }),
1322
+ /* @__PURE__ */ y(ye, { value: ue.BEHIND_TEXT, children: t.t("image-text-wrap.behindText") }),
1323
+ /* @__PURE__ */ y(ye, { value: ue.IN_FRONT_OF_TEXT, children: t.t("image-text-wrap.inFrontText") })
1379
1324
  ] }) }),
1380
- /* @__PURE__ */ T(
1325
+ /* @__PURE__ */ y(
1381
1326
  "div",
1382
1327
  {
1383
1328
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1384
- children: /* @__PURE__ */ T("div", { children: t.t("image-text-wrap.wrapText") })
1329
+ children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.wrapText") })
1385
1330
  }
1386
1331
  ),
1387
- /* @__PURE__ */ T("div", { children: /* @__PURE__ */ X(Gt, { disabled: l, value: O, onChange: N, direction: "horizontal", children: [
1388
- /* @__PURE__ */ T(Me, { value: Xe.BOTH_SIDES, children: t.t("image-text-wrap.bothSide") }),
1389
- /* @__PURE__ */ T(Me, { value: Xe.LEFT, children: t.t("image-text-wrap.leftOnly") }),
1390
- /* @__PURE__ */ T(Me, { value: Xe.RIGHT, children: t.t("image-text-wrap.rightOnly") })
1332
+ /* @__PURE__ */ y("div", { children: /* @__PURE__ */ X(Gt, { disabled: l, value: O, onChange: N, direction: "horizontal", children: [
1333
+ /* @__PURE__ */ y(ye, { value: ze.BOTH_SIDES, children: t.t("image-text-wrap.bothSide") }),
1334
+ /* @__PURE__ */ y(ye, { value: ze.LEFT, children: t.t("image-text-wrap.leftOnly") }),
1335
+ /* @__PURE__ */ y(ye, { value: ze.RIGHT, children: t.t("image-text-wrap.rightOnly") })
1391
1336
  ] }) }),
1392
- /* @__PURE__ */ T(
1337
+ /* @__PURE__ */ y(
1393
1338
  "div",
1394
1339
  {
1395
1340
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1396
- children: /* @__PURE__ */ T("div", { children: t.t("image-text-wrap.distanceFromText") })
1341
+ children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.distanceFromText") })
1397
1342
  }
1398
1343
  ),
1399
1344
  /* @__PURE__ */ X(
@@ -1402,33 +1347,33 @@ const Dn = {
1402
1347
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1403
1348
  children: [
1404
1349
  /* @__PURE__ */ X("div", { children: [
1405
- /* @__PURE__ */ T("span", { children: t.t("image-text-wrap.top") }),
1406
- /* @__PURE__ */ T(
1350
+ /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.top") }),
1351
+ /* @__PURE__ */ y(
1407
1352
  Fe,
1408
1353
  {
1409
- min: Je,
1410
- max: et,
1411
- disabled: f,
1354
+ min: Qe,
1355
+ max: Je,
1356
+ disabled: h,
1412
1357
  precision: 1,
1413
1358
  value: M.distT,
1414
1359
  onChange: (I) => {
1415
- H(I, "distT");
1360
+ G(I, "distT");
1416
1361
  }
1417
1362
  }
1418
1363
  )
1419
1364
  ] }),
1420
1365
  /* @__PURE__ */ X("div", { children: [
1421
- /* @__PURE__ */ T("span", { children: t.t("image-text-wrap.left") }),
1422
- /* @__PURE__ */ T(
1366
+ /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.left") }),
1367
+ /* @__PURE__ */ y(
1423
1368
  Fe,
1424
1369
  {
1425
- min: Je,
1426
- max: et,
1370
+ min: Qe,
1371
+ max: Je,
1427
1372
  disabled: p,
1428
1373
  precision: 1,
1429
1374
  value: M.distL,
1430
1375
  onChange: (I) => {
1431
- H(I, "distL");
1376
+ G(I, "distL");
1432
1377
  }
1433
1378
  }
1434
1379
  )
@@ -1442,33 +1387,33 @@ const Dn = {
1442
1387
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1443
1388
  children: [
1444
1389
  /* @__PURE__ */ X("div", { children: [
1445
- /* @__PURE__ */ T("span", { children: t.t("image-text-wrap.bottom") }),
1446
- /* @__PURE__ */ T(
1390
+ /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.bottom") }),
1391
+ /* @__PURE__ */ y(
1447
1392
  Fe,
1448
1393
  {
1449
- min: Je,
1450
- max: et,
1451
- disabled: f,
1394
+ min: Qe,
1395
+ max: Je,
1396
+ disabled: h,
1452
1397
  precision: 1,
1453
1398
  value: M.distB,
1454
1399
  onChange: (I) => {
1455
- H(I, "distB");
1400
+ G(I, "distB");
1456
1401
  }
1457
1402
  }
1458
1403
  )
1459
1404
  ] }),
1460
1405
  /* @__PURE__ */ X("div", { children: [
1461
- /* @__PURE__ */ T("span", { children: t.t("image-text-wrap.right") }),
1462
- /* @__PURE__ */ T(
1406
+ /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.right") }),
1407
+ /* @__PURE__ */ y(
1463
1408
  Fe,
1464
1409
  {
1465
- min: Je,
1466
- max: et,
1410
+ min: Qe,
1411
+ max: Je,
1467
1412
  disabled: p,
1468
1413
  precision: 1,
1469
1414
  value: M.distR,
1470
1415
  onChange: (I) => {
1471
- H(I, "distR");
1416
+ G(I, "distR");
1472
1417
  }
1473
1418
  }
1474
1419
  )
@@ -1479,31 +1424,31 @@ const Dn = {
1479
1424
  ]
1480
1425
  }
1481
1426
  );
1482
- }, ni = () => {
1483
- const r = ve(pe), e = r.getFocusDrawings(), [t, n] = ie(e);
1427
+ }, jr = () => {
1428
+ const i = me(fe), e = i.getFocusDrawings(), [t, n] = ie(e);
1484
1429
  return Tt(() => {
1485
- const i = r.focus$.subscribe((o) => {
1430
+ const r = i.focus$.subscribe((o) => {
1486
1431
  n(o);
1487
1432
  });
1488
1433
  return () => {
1489
- i.unsubscribe();
1434
+ r.unsubscribe();
1490
1435
  };
1491
1436
  }, []), !!(t != null && t.length) && /* @__PURE__ */ X("div", { className: "univer-text-sm", children: [
1492
- /* @__PURE__ */ T(cr, { drawings: t, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
1493
- /* @__PURE__ */ T(ti, { drawings: t }),
1494
- /* @__PURE__ */ T(ei, { drawings: t })
1437
+ /* @__PURE__ */ y(tr, { drawings: t, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
1438
+ /* @__PURE__ */ y(Hr, { drawings: t }),
1439
+ /* @__PURE__ */ y(Gr, { drawings: t })
1495
1440
  ] });
1496
- }, Rn = "addition-and-subtraction-single", An = "doc.menu.image", Pn = _n.id, ri = (r) => {
1497
- const e = r.get(Ot), t = r.get(z);
1498
- return new Fr((n) => {
1499
- const i = e.textSelection$.subscribe(() => {
1441
+ }, Tn = "doc.menu.image", yn = fn.id, Vr = (i) => {
1442
+ const e = i.get(Dt), t = i.get(z);
1443
+ return new Pr((n) => {
1444
+ const r = e.textSelection$.subscribe(() => {
1500
1445
  var s;
1501
1446
  const o = e.getActiveTextRange();
1502
1447
  if (o) {
1503
1448
  const { segmentId: c, startOffset: d, endOffset: a } = o, g = t.getCurrentUniverDocInstance(), u = (s = g == null ? void 0 : g.getSelfOrHeaderFooterModel(c).getBody()) == null ? void 0 : s.tables;
1504
1449
  if (u && u.length && u.some((l) => {
1505
- const { startIndex: h, endIndex: f } = l;
1506
- return d >= h && d < f || a >= h && a < f;
1450
+ const { startIndex: f, endIndex: h } = l;
1451
+ return d >= f && d < h || a >= f && a < h;
1507
1452
  })) {
1508
1453
  n.next(!0);
1509
1454
  return;
@@ -1514,160 +1459,160 @@ const Dn = {
1514
1459
  }
1515
1460
  n.next(!1);
1516
1461
  });
1517
- return () => i.unsubscribe();
1462
+ return () => r.unsubscribe();
1518
1463
  });
1519
1464
  };
1520
- function ii(r) {
1465
+ function $r(i) {
1521
1466
  return {
1522
- id: An,
1523
- type: rn.SUBITEMS,
1524
- icon: Rn,
1467
+ id: Tn,
1468
+ type: nn.SUBITEMS,
1469
+ icon: "AddImageIcon",
1525
1470
  tooltip: "docImage.title",
1526
- disabled$: ri(r),
1527
- hidden$: nn(r, we.UNIVER_DOC, void 0, Dt)
1471
+ disabled$: Vr(i),
1472
+ hidden$: tn(i, we.UNIVER_DOC, void 0, St)
1528
1473
  };
1529
1474
  }
1530
- function oi(r) {
1475
+ function zr(i) {
1531
1476
  return {
1532
- id: Pn,
1477
+ id: yn,
1533
1478
  title: "docImage.upload.float",
1534
- type: rn.BUTTON,
1535
- hidden$: nn(r, we.UNIVER_DOC, void 0, Dt)
1479
+ type: nn.BUTTON,
1480
+ hidden$: tn(i, we.UNIVER_DOC, void 0, St)
1536
1481
  };
1537
1482
  }
1538
- const si = {
1539
- [Dr.MEDIA]: {
1540
- [An]: {
1483
+ const Xr = {
1484
+ [pr.MEDIA]: {
1485
+ [Tn]: {
1541
1486
  order: 0,
1542
- menuItemFactory: ii,
1543
- [Pn]: {
1487
+ menuItemFactory: $r,
1488
+ [yn]: {
1544
1489
  order: 0,
1545
- menuItemFactory: oi
1490
+ menuItemFactory: zr
1546
1491
  }
1547
1492
  }
1548
1493
  }
1549
1494
  };
1550
- function Ze(r) {
1551
- return r.getContextValue(Gn) && r.getContextValue(rt);
1495
+ function Ye(i) {
1496
+ return i.getContextValue(Un) && i.getContextValue(nt);
1552
1497
  }
1553
- const ai = {
1554
- id: Ye.id,
1498
+ const qr = {
1499
+ id: Ke.id,
1555
1500
  description: "shortcut.drawing-move-down",
1556
1501
  group: "4_drawing-view",
1557
- binding: He.ARROW_DOWN,
1502
+ binding: We.ARROW_DOWN,
1558
1503
  priority: 100,
1559
- preconditions: Ze,
1504
+ preconditions: Ye,
1560
1505
  staticParameters: {
1561
- direction: fe.DOWN
1506
+ direction: he.DOWN
1562
1507
  }
1563
- }, ci = {
1564
- id: Ye.id,
1508
+ }, Kr = {
1509
+ id: Ke.id,
1565
1510
  description: "shortcut.drawing-move-up",
1566
1511
  group: "4_drawing-view",
1567
- binding: He.ARROW_UP,
1512
+ binding: We.ARROW_UP,
1568
1513
  priority: 100,
1569
- preconditions: Ze,
1514
+ preconditions: Ye,
1570
1515
  staticParameters: {
1571
- direction: fe.UP
1516
+ direction: he.UP
1572
1517
  }
1573
- }, di = {
1574
- id: Ye.id,
1518
+ }, Yr = {
1519
+ id: Ke.id,
1575
1520
  description: "shortcut.drawing-move-left",
1576
1521
  group: "4_drawing-view",
1577
- binding: He.ARROW_LEFT,
1522
+ binding: We.ARROW_LEFT,
1578
1523
  priority: 100,
1579
- preconditions: Ze,
1524
+ preconditions: Ye,
1580
1525
  staticParameters: {
1581
- direction: fe.LEFT
1526
+ direction: he.LEFT
1582
1527
  }
1583
- }, gi = {
1584
- id: Ye.id,
1528
+ }, Zr = {
1529
+ id: Ke.id,
1585
1530
  description: "shortcut.drawing-move-right",
1586
1531
  group: "4_drawing-view",
1587
- binding: He.ARROW_RIGHT,
1532
+ binding: We.ARROW_RIGHT,
1588
1533
  priority: 100,
1589
- preconditions: Ze,
1534
+ preconditions: Ye,
1590
1535
  staticParameters: {
1591
- direction: fe.RIGHT
1536
+ direction: he.RIGHT
1592
1537
  }
1593
- }, li = {
1594
- id: mn.id,
1538
+ }, Qr = {
1539
+ id: gn.id,
1595
1540
  description: "shortcut.drawing-delete",
1596
1541
  group: "4_drawing-view",
1597
1542
  // when focusing on any other input tag do not trigger this shortcut
1598
- preconditions: Ze,
1599
- binding: He.DELETE,
1600
- mac: He.BACKSPACE
1543
+ preconditions: Ye,
1544
+ binding: We.DELETE,
1545
+ mac: We.BACKSPACE
1601
1546
  };
1602
- var ui = Object.getOwnPropertyDescriptor, fi = (r, e, t, n) => {
1603
- for (var i = n > 1 ? void 0 : n ? ui(e, t) : e, o = r.length - 1, s; o >= 0; o--)
1604
- (s = r[o]) && (i = s(i) || i);
1605
- return i;
1606
- }, tt = (r, e) => (t, n) => e(t, n, r);
1607
- let ot = class extends Le {
1608
- constructor(r, e, t, n) {
1609
- super(), this._componentManager = r, this._menuManagerService = e, this._commandService = t, this._shortcutService = n, this._init();
1547
+ var Jr = Object.getOwnPropertyDescriptor, ei = (i, e, t, n) => {
1548
+ for (var r = n > 1 ? void 0 : n ? Jr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1549
+ (s = i[o]) && (r = s(r) || r);
1550
+ return r;
1551
+ }, et = (i, e) => (t, n) => e(t, n, i);
1552
+ let it = class extends Ne {
1553
+ constructor(i, e, t, n) {
1554
+ super(), this._componentManager = i, this._menuManagerService = e, this._commandService = t, this._shortcutService = n, this._init();
1610
1555
  }
1611
1556
  _initCustomComponents() {
1612
- const r = this._componentManager;
1613
- this.disposeWithMe(r.register(Rn, pn)), this.disposeWithMe(r.register(bn, ni));
1557
+ const i = this._componentManager;
1558
+ this.disposeWithMe(i.register(Sn, jr));
1614
1559
  }
1615
1560
  _initMenus() {
1616
- this._menuManagerService.mergeMenu(si);
1561
+ this._menuManagerService.mergeMenu(Xr);
1617
1562
  }
1618
1563
  _initCommands() {
1619
1564
  [
1565
+ fn,
1566
+ Mt,
1567
+ mn,
1568
+ wn,
1569
+ vn,
1570
+ qe,
1571
+ In,
1620
1572
  _n,
1621
- bt,
1573
+ yt,
1622
1574
  Dn,
1575
+ Wr,
1623
1576
  On,
1624
- yn,
1577
+ ln,
1578
+ hn,
1625
1579
  Ke,
1626
- Tn,
1627
- Mn,
1628
- Mt,
1629
- Cn,
1630
- Jr,
1631
- En,
1632
- vn,
1633
- In,
1634
- Ye,
1635
- mn,
1636
- wn
1637
- ].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
1580
+ gn,
1581
+ un
1582
+ ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
1638
1583
  }
1639
1584
  _initShortcuts() {
1640
1585
  [
1641
1586
  // sheet drawing shortcuts
1642
- ai,
1643
- ci,
1644
- di,
1645
- gi,
1646
- li
1647
- ].forEach((r) => {
1648
- this.disposeWithMe(this._shortcutService.registerShortcut(r));
1587
+ qr,
1588
+ Kr,
1589
+ Yr,
1590
+ Zr,
1591
+ Qr
1592
+ ].forEach((i) => {
1593
+ this.disposeWithMe(this._shortcutService.registerShortcut(i));
1649
1594
  });
1650
1595
  }
1651
1596
  _init() {
1652
1597
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
1653
1598
  }
1654
1599
  };
1655
- ot = fi([
1656
- tt(0, Z(on)),
1657
- tt(1, Or),
1658
- tt(2, j),
1659
- tt(3, yr)
1660
- ], ot);
1661
- var hi = Object.getOwnPropertyDescriptor, pi = (r, e, t, n) => {
1662
- for (var i = n > 1 ? void 0 : n ? hi(e, t) : e, o = r.length - 1, s; o >= 0; o--)
1663
- (s = r[o]) && (i = s(i) || i);
1664
- return i;
1665
- }, Ve = (r, e) => (t, n) => e(t, n, r);
1666
- function mi(r) {
1667
- var n, i, o, s;
1668
- if ($.isNoop(r) || !Array.isArray(r))
1600
+ it = ei([
1601
+ et(0, Z(rn)),
1602
+ et(1, mr),
1603
+ et(2, j),
1604
+ et(3, wr)
1605
+ ], it);
1606
+ var ti = Object.getOwnPropertyDescriptor, ni = (i, e, t, n) => {
1607
+ for (var r = n > 1 ? void 0 : n ? ti(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1608
+ (s = i[o]) && (r = s(r) || r);
1609
+ return r;
1610
+ }, je = (i, e) => (t, n) => e(t, n, i);
1611
+ function ri(i) {
1612
+ var n, r, o, s;
1613
+ if ($.isNoop(i) || !Array.isArray(i))
1669
1614
  return null;
1670
- const e = r.find((c) => Array.isArray(c) && (c == null ? void 0 : c[0]) === "drawings");
1615
+ const e = i.find((c) => Array.isArray(c) && (c == null ? void 0 : c[0]) === "drawings");
1671
1616
  if (e == null || !Array.isArray(e) || e.length < 3 || typeof e[1] == "string" && typeof e[2] != "object" || Array.isArray(e[1]) && typeof e[1][1] != "object")
1672
1617
  return null;
1673
1618
  const t = [];
@@ -1676,7 +1621,7 @@ function mi(r) {
1676
1621
  Array.isArray(c) && t.push({
1677
1622
  type: (n = c == null ? void 0 : c[1]) != null && n.i ? "add" : "remove",
1678
1623
  drawingId: c == null ? void 0 : c[0],
1679
- drawing: (i = c == null ? void 0 : c[1]) == null ? void 0 : i.i
1624
+ drawing: (r = c == null ? void 0 : c[1]) == null ? void 0 : r.i
1680
1625
  });
1681
1626
  else
1682
1627
  t.push({
@@ -1686,12 +1631,12 @@ function mi(r) {
1686
1631
  });
1687
1632
  return t;
1688
1633
  }
1689
- function vi(r) {
1690
- if (!Array.isArray(r) || r.length < 3 || r[0] !== "drawingsOrder")
1634
+ function ii(i) {
1635
+ if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
1691
1636
  return [];
1692
1637
  const e = [];
1693
- for (let t = 1; t < r.length; t++) {
1694
- const n = r[t];
1638
+ for (let t = 1; t < i.length; t++) {
1639
+ const n = i[t];
1695
1640
  if (Array.isArray(n) && typeof n[0] == "number" && typeof n[1] == "object")
1696
1641
  e.push(n[0]);
1697
1642
  else {
@@ -1701,95 +1646,95 @@ function vi(r) {
1701
1646
  }
1702
1647
  return e;
1703
1648
  }
1704
- let st = class extends Le {
1705
- constructor(r, e, t, n, i) {
1706
- super(), this._univerInstanceService = r, this._commandService = e, this._drawingManagerService = t, this._docDrawingService = n, this._renderManagerService = i, this._initialize();
1649
+ let ot = class extends Ne {
1650
+ constructor(i, e, t, n, r) {
1651
+ super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService = t, this._docDrawingService = n, this._renderManagerService = r, this._initialize();
1707
1652
  }
1708
1653
  _initialize() {
1709
1654
  this._commandExecutedListener();
1710
1655
  }
1711
1656
  _commandExecutedListener() {
1712
1657
  this.disposeWithMe(
1713
- this._commandService.beforeCommandExecuted((r) => {
1714
- if (r.id !== ee.id)
1658
+ this._commandService.beforeCommandExecuted((i) => {
1659
+ if (i.id !== ee.id)
1715
1660
  return;
1716
- const e = r.params, { unitId: t, actions: n } = e, i = mi(n);
1717
- if (i != null)
1718
- for (const { type: o, drawingId: s, drawing: c } of i)
1661
+ const e = i.params, { unitId: t, actions: n } = e, r = ri(n);
1662
+ if (r != null)
1663
+ for (const { type: o, drawingId: s, drawing: c } of r)
1719
1664
  o === "add" ? this._addDrawings(t, [c]) : this._removeDrawings(t, [s]);
1720
1665
  })
1721
1666
  ), this.disposeWithMe(
1722
- this._commandService.onCommandExecuted((r) => {
1723
- if (r.id !== ee.id)
1667
+ this._commandService.onCommandExecuted((i) => {
1668
+ if (i.id !== ee.id)
1724
1669
  return;
1725
- const e = r.params, { unitId: t, actions: n } = e;
1726
- vi(n).length > 0 && this._updateDrawingsOrder(t);
1670
+ const e = i.params, { unitId: t, actions: n } = e;
1671
+ ii(n).length > 0 && this._updateDrawingsOrder(t);
1727
1672
  })
1728
1673
  ), this.disposeWithMe(
1729
- this._commandService.onCommandExecuted((r) => {
1674
+ this._commandService.onCommandExecuted((i) => {
1730
1675
  var s;
1731
- if (r.id !== jn.id && r.id !== Vn.id)
1676
+ if (i.id !== Ln.id && i.id !== Bn.id)
1732
1677
  return;
1733
1678
  const e = (s = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : s.getUnitId(), t = this._drawingManagerService.getFocusDrawings();
1734
1679
  if (e == null || t.length === 0)
1735
1680
  return;
1736
- const n = this._renderManagerService.getRenderById(e), i = n == null ? void 0 : n.scene;
1737
- if (i == null)
1681
+ const n = this._renderManagerService.getRenderById(e), r = n == null ? void 0 : n.scene;
1682
+ if (r == null)
1738
1683
  return !1;
1739
- i.getTransformerByCreate().refreshControls();
1684
+ r.getTransformerByCreate().refreshControls();
1740
1685
  })
1741
1686
  );
1742
1687
  }
1743
- _addDrawings(r, e) {
1744
- const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects: c } = i;
1745
- t.applyJson1(r, o, s), n.applyJson1(r, o, s), t.addNotification(c), n.addNotification(c);
1688
+ _addDrawings(i, e) {
1689
+ const t = this._drawingManagerService, n = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects: c } = r;
1690
+ t.applyJson1(i, o, s), n.applyJson1(i, o, s), t.addNotification(c), n.addNotification(c);
1746
1691
  }
1747
- _removeDrawings(r, e) {
1748
- const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
1749
- unitId: r,
1750
- subUnitId: r,
1692
+ _removeDrawings(i, e) {
1693
+ const t = this._drawingManagerService, n = this._docDrawingService, r = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
1694
+ unitId: i,
1695
+ subUnitId: i,
1751
1696
  drawingId: d
1752
- }))), { subUnitId: o, redo: s, objects: c } = i;
1753
- t.applyJson1(r, o, s), n.applyJson1(r, o, s), t.removeNotification(c), n.removeNotification(c);
1697
+ }))), { subUnitId: o, redo: s, objects: c } = r;
1698
+ t.applyJson1(i, o, s), n.applyJson1(i, o, s), t.removeNotification(c), n.removeNotification(c);
1754
1699
  }
1755
- _updateDrawingsOrder(r) {
1756
- const e = this._univerInstanceService.getUniverDocInstance(r);
1700
+ _updateDrawingsOrder(i) {
1701
+ const e = this._univerInstanceService.getUniverDocInstance(i);
1757
1702
  if (e == null)
1758
1703
  return;
1759
1704
  const t = e.getSnapshot().drawingsOrder;
1760
1705
  if (t == null)
1761
1706
  return;
1762
- const n = this._drawingManagerService, i = this._docDrawingService;
1763
- n.setDrawingOrder(r, r, t), i.setDrawingOrder(r, r, t);
1707
+ const n = this._drawingManagerService, r = this._docDrawingService;
1708
+ n.setDrawingOrder(i, i, t), r.setDrawingOrder(i, i, t);
1764
1709
  const o = {
1765
- unitId: r,
1766
- subUnitId: r,
1710
+ unitId: i,
1711
+ subUnitId: i,
1767
1712
  drawingIds: t
1768
1713
  };
1769
- n.orderNotification(o), i.orderNotification(o);
1714
+ n.orderNotification(o), r.orderNotification(o);
1770
1715
  }
1771
1716
  };
1772
- st = pi([
1773
- Ve(0, z),
1774
- Ve(1, j),
1775
- Ve(2, pe),
1776
- Ve(3, Ue),
1777
- Ve(4, Q)
1778
- ], st);
1779
- var wi = Object.getOwnPropertyDescriptor, Ii = (r, e, t, n) => {
1780
- for (var i = n > 1 ? void 0 : n ? wi(e, t) : e, o = r.length - 1, s; o >= 0; o--)
1781
- (s = r[o]) && (i = s(i) || i);
1782
- return i;
1783
- }, ke = (r, e) => (t, n) => e(t, n, r);
1784
- function xn(r, e, t = 1, n = 0) {
1785
- const { top: i, left: o, bottom: s, right: c } = r, d = c - o, a = s - i, g = e.getViewport(an.VIEW_MAIN), { viewportScrollX: u, viewportScrollY: l } = g, { scaleX: h, scaleY: f } = e.getAncestorScale();
1717
+ ot = ni([
1718
+ je(0, z),
1719
+ je(1, j),
1720
+ je(2, fe),
1721
+ je(3, Ue),
1722
+ je(4, Q)
1723
+ ], ot);
1724
+ var oi = Object.getOwnPropertyDescriptor, si = (i, e, t, n) => {
1725
+ for (var r = n > 1 ? void 0 : n ? oi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1726
+ (s = i[o]) && (r = s(r) || r);
1727
+ return r;
1728
+ }, Be = (i, e) => (t, n) => e(t, n, i);
1729
+ function Mn(i, e, t = 1, n = 0) {
1730
+ const { top: r, left: o, bottom: s, right: c } = i, d = c - o, a = s - r, g = e.getViewport(sn.VIEW_MAIN), { viewportScrollX: u, viewportScrollY: l } = g, { scaleX: f, scaleY: h } = e.getAncestorScale();
1786
1731
  return {
1787
- startX: (o - u) * h,
1788
- startY: (i - l) * f,
1789
- endX: (o + d - u) * h,
1790
- endY: (i + a - l) * f,
1791
- width: d * h,
1792
- height: a * f,
1732
+ startX: (o - u) * f,
1733
+ startY: (r - l) * h,
1734
+ endX: (o + d - u) * f,
1735
+ endY: (r + a - l) * h,
1736
+ width: d * f,
1737
+ height: a * h,
1793
1738
  rotate: n,
1794
1739
  absolute: {
1795
1740
  left: !1,
@@ -1798,15 +1743,15 @@ function xn(r, e, t = 1, n = 0) {
1798
1743
  opacity: t != null ? t : 1
1799
1744
  };
1800
1745
  }
1801
- function wt(r, e) {
1802
- const { top: t, left: n, width: i, height: o, angle: s, opacity: c } = r;
1803
- return xn({ top: t, left: n, bottom: t + o, right: n + i }, e.scene, c, s);
1746
+ function wt(i, e) {
1747
+ const { top: t, left: n, width: r, height: o, angle: s, opacity: c } = i;
1748
+ return Mn({ top: t, left: n, bottom: t + o, right: n + r }, e.scene, c, s);
1804
1749
  }
1805
- let at = class extends Le {
1806
- constructor(e, t, n, i, o, s) {
1750
+ let st = class extends Ne {
1751
+ constructor(e, t, n, r, o, s) {
1807
1752
  super();
1808
- Ie(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1809
- this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService = i, this._univerInstanceService = o, this._commandService = s, this._initialize();
1753
+ ve(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1754
+ this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService = r, this._univerInstanceService = o, this._commandService = s, this._initialize();
1810
1755
  }
1811
1756
  dispose() {
1812
1757
  super.dispose();
@@ -1820,8 +1765,8 @@ let at = class extends Le {
1820
1765
  const t = this._renderManagerService.getRenderById(e);
1821
1766
  if (t == null)
1822
1767
  return null;
1823
- const n = t.scene, i = n.getTransformerByCreate();
1824
- return { scene: n, transformer: i, renderUnit: t, canvas: t.engine.getCanvasElement() };
1768
+ const n = t.scene, r = n.getTransformerByCreate();
1769
+ return { scene: n, transformer: r, renderUnit: t, canvas: t.engine.getCanvasElement() };
1825
1770
  }
1826
1771
  _drawingAddRemoveListener() {
1827
1772
  this.disposeWithMe(
@@ -1851,7 +1796,7 @@ let at = class extends Le {
1851
1796
  if (!(c == null || c.length === 0))
1852
1797
  for (const d of c) {
1853
1798
  this._addHoverForRect(d);
1854
- const a = new $n(), g = wt(d, o.renderUnit), u = new yt(g), l = o.canvas, h = s.data, f = {
1799
+ const a = new Fn(), g = wt(d, o.renderUnit), u = new Ot(g), l = o.canvas, f = s.data, h = {
1855
1800
  dispose: a,
1856
1801
  rect: d,
1857
1802
  position$: u,
@@ -1873,7 +1818,7 @@ let at = class extends Le {
1873
1818
  onWheel: (p) => {
1874
1819
  l.dispatchEvent(new WheelEvent(p.type, p));
1875
1820
  },
1876
- data: h,
1821
+ data: f,
1877
1822
  unitId: n
1878
1823
  });
1879
1824
  const m = d.onTransformChange$.subscribeEvent(() => {
@@ -1884,21 +1829,21 @@ let at = class extends Le {
1884
1829
  });
1885
1830
  a.add(() => {
1886
1831
  this._canvasFloatDomService.removeFloatDom(s.drawingId);
1887
- }), m && a.add(m), this._domLayerInfoMap.set(s.drawingId, f);
1832
+ }), m && a.add(m), this._domLayerInfoMap.set(s.drawingId, h);
1888
1833
  }
1889
1834
  });
1890
1835
  }
1891
1836
  _addHoverForRect(e) {
1892
1837
  this.disposeWithMe(
1893
- De(
1838
+ Se(
1894
1839
  e.onPointerEnter$.subscribeEvent(() => {
1895
- e.cursor = Lt.GRAB;
1840
+ e.cursor = Nt.GRAB;
1896
1841
  })
1897
1842
  )
1898
1843
  ), this.disposeWithMe(
1899
- De(
1844
+ Se(
1900
1845
  e.onPointerLeave$.subscribeEvent(() => {
1901
- e.cursor = Lt.DEFAULT;
1846
+ e.cursor = Nt.DEFAULT;
1902
1847
  })
1903
1848
  )
1904
1849
  );
@@ -1909,27 +1854,27 @@ let at = class extends Le {
1909
1854
  return;
1910
1855
  const { unitId: n } = t;
1911
1856
  this._domLayerInfoMap.delete(e), t.dispose.dispose();
1912
- const i = this._getSceneAndTransformerByDrawingSearch(n);
1913
- i && i.scene.removeObject(t.rect);
1857
+ const r = this._getSceneAndTransformerByDrawingSearch(n);
1858
+ r && r.scene.removeObject(t.rect);
1914
1859
  }
1915
1860
  _initScrollAndZoomEvent() {
1916
1861
  const e = (t) => {
1917
1862
  const n = this._getSceneAndTransformerByDrawingSearch(t);
1918
- n && this._domLayerInfoMap.forEach((i) => {
1919
- if (i.unitId !== t) return;
1920
- const o = wt(i.rect, n.renderUnit);
1921
- i.position$.next(o);
1863
+ n && this._domLayerInfoMap.forEach((r) => {
1864
+ if (r.unitId !== t) return;
1865
+ const o = wt(r.rect, n.renderUnit);
1866
+ r.position$.next(o);
1922
1867
  });
1923
1868
  };
1924
1869
  this.disposeWithMe(
1925
1870
  this._univerInstanceService.getCurrentTypeOfUnit$(we.UNIVER_DOC).pipe(
1926
- jt((t) => {
1871
+ Ht((t) => {
1927
1872
  if (!t) return null;
1928
- const n = t.getUnitId(), i = this._renderManagerService.getRenderById(n);
1929
- return i ? { render: i, unitId: n } : null;
1873
+ const n = t.getUnitId(), r = this._renderManagerService.getRenderById(n);
1874
+ return r ? { render: r, unitId: n } : null;
1930
1875
  }),
1931
- Wr(
1932
- (t) => t ? Qt(t.render.scene.getViewport(an.VIEW_MAIN).onScrollAfter$).pipe(jt(() => ({ unitId: t.unitId }))) : Hr(null)
1876
+ xr(
1877
+ (t) => t ? Zt(t.render.scene.getViewport(sn.VIEW_MAIN).onScrollAfter$).pipe(Ht(() => ({ unitId: t.unitId }))) : Nr(null)
1933
1878
  )
1934
1879
  ).subscribe((t) => {
1935
1880
  if (!t) return;
@@ -1937,19 +1882,19 @@ let at = class extends Le {
1937
1882
  e(n);
1938
1883
  })
1939
1884
  ), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
1940
- if (t.id === cn.id) {
1941
- const n = t.params, { unitId: i } = n;
1942
- e(i);
1885
+ if (t.id === an.id) {
1886
+ const n = t.params, { unitId: r } = n;
1887
+ e(r);
1943
1888
  }
1944
1889
  }));
1945
1890
  }
1946
1891
  insertFloatDom(e, t) {
1947
- var m, p, v;
1892
+ var m, p, w;
1948
1893
  const n = this._univerInstanceService.getCurrentUnitOfType(we.UNIVER_DOC);
1949
1894
  if (!n) return !1;
1950
- const i = this._getSceneAndTransformerByDrawingSearch(n.getUnitId());
1951
- if (!i) return !1;
1952
- const c = (m = i.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : m.pages[0];
1895
+ const r = this._getSceneAndTransformerByDrawingSearch(n.getUnitId());
1896
+ if (!r) return !1;
1897
+ const c = (m = r.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : m.pages[0];
1953
1898
  if (!c) return !1;
1954
1899
  const { pageWidth: d, marginLeft: a, marginRight: g } = c, u = d - a - g, l = {
1955
1900
  size: {
@@ -1965,37 +1910,37 @@ let at = class extends Le {
1965
1910
  posOffset: 0
1966
1911
  },
1967
1912
  angle: 0
1968
- }, h = (v = t.drawingId) != null ? v : zn(), f = {
1913
+ }, f = (w = t.drawingId) != null ? w : kn(), h = {
1969
1914
  unitId: n.getUnitId(),
1970
1915
  drawings: [
1971
1916
  {
1972
- drawingId: h,
1973
- drawingType: Ne.DRAWING_DOM,
1917
+ drawingId: f,
1918
+ drawingType: xe.DRAWING_DOM,
1974
1919
  subUnitId: n.getUnitId(),
1975
1920
  unitId: n.getUnitId(),
1976
1921
  ...e,
1977
1922
  title: "",
1978
1923
  description: "",
1979
1924
  docTransform: l,
1980
- layoutType: F.INLINE,
1981
- transform: sn(l)
1925
+ layoutType: k.INLINE,
1926
+ transform: on(l)
1982
1927
  }
1983
1928
  ]
1984
1929
  };
1985
- return this._commandService.syncExecuteCommand(bt.id, f), h;
1930
+ return this._commandService.syncExecuteCommand(Mt.id, h), f;
1986
1931
  }
1987
1932
  };
1988
- at = Ii([
1989
- ke(0, Q),
1990
- ke(1, pe),
1991
- ke(2, Z(en)),
1992
- ke(3, Z(Tr)),
1993
- ke(4, z),
1994
- ke(5, j)
1995
- ], at);
1996
- const _i = (r) => {
1997
- const { floatDomInfos: e, scene: t, offset: n, bound: i } = r, o = i.right - i.left, s = i.bottom - i.top, c = jr(() => e.map((d) => {
1998
- const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, f = xn(
1933
+ st = si([
1934
+ Be(0, Q),
1935
+ Be(1, fe),
1936
+ Be(2, Z(Jt)),
1937
+ Be(3, Z(vr)),
1938
+ Be(4, z),
1939
+ Be(5, j)
1940
+ ], st);
1941
+ const ai = (i) => {
1942
+ const { floatDomInfos: e, scene: t, offset: n, bound: r } = i, o = r.right - r.left, s = r.bottom - r.top, c = Ur(() => e.map((d) => {
1943
+ const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, h = Mn(
1999
1944
  {
2000
1945
  left: u,
2001
1946
  right: u + a,
@@ -2004,8 +1949,8 @@ const _i = (r) => {
2004
1949
  },
2005
1950
  t
2006
1951
  ), m = {
2007
- position$: new yt(f),
2008
- position: f,
1952
+ position$: new Ot(h),
1953
+ position: h,
2009
1954
  id: d.drawingId,
2010
1955
  componentKey: d.componentKey,
2011
1956
  onPointerMove: () => {
@@ -2021,27 +1966,27 @@ const _i = (r) => {
2021
1966
  };
2022
1967
  return [d.drawingId, m];
2023
1968
  }).filter(([d, a]) => !(a.position.endX < 0 || a.position.endY < 0 || a.position.startX > o || a.position.startY > s)), [e, t, n, o, s]);
2024
- return /* @__PURE__ */ T("div", { className: "univer-absolute univer-left-0 univer-top-0", children: c.map(([d, a]) => /* @__PURE__ */ T(Mr, { layer: a, id: d, position: a.position }, d)) });
1969
+ return /* @__PURE__ */ y("div", { className: "univer-absolute univer-left-0 univer-top-0", children: c.map(([d, a]) => /* @__PURE__ */ y(Ir, { layer: a, id: d, position: a.position }, d)) });
2025
1970
  };
2026
- var Si = Object.getOwnPropertyDescriptor, Di = (r, e, t, n) => {
2027
- for (var i = n > 1 ? void 0 : n ? Si(e, t) : e, o = r.length - 1, s; o >= 0; o--)
2028
- (s = r[o]) && (i = s(i) || i);
2029
- return i;
2030
- }, $e = (r, e) => (t, n) => e(t, n, r);
2031
- let ct = class extends Le {
2032
- constructor(r, e, t, n, i) {
2033
- super(), this._docPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = t, this._componetManager = n, this._injector = i, this._initPrinting(), this._initPrintingDom();
1971
+ var ci = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
1972
+ for (var r = n > 1 ? void 0 : n ? ci(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1973
+ (s = i[o]) && (r = s(r) || r);
1974
+ return r;
1975
+ }, Ve = (i, e) => (t, n) => e(t, n, i);
1976
+ let at = class extends Ne {
1977
+ constructor(i, e, t, n, r) {
1978
+ super(), this._docPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = t, this._componetManager = n, this._injector = r, this._initPrinting(), this._initPrintingDom();
2034
1979
  }
2035
1980
  _initPrinting() {
2036
1981
  this.disposeWithMe(
2037
1982
  this._docPrintInterceptorService.interceptor.intercept(
2038
1983
  this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
2039
1984
  {
2040
- handler: (r, e, t) => {
2041
- const { unitId: n, scene: i } = e, o = this._drawingManagerService.getDrawingDataForUnit(n), s = o == null ? void 0 : o[n];
1985
+ handler: (i, e, t) => {
1986
+ const { unitId: n, scene: r } = e, o = this._drawingManagerService.getDrawingDataForUnit(n), s = o == null ? void 0 : o[n];
2042
1987
  return s && s.order.forEach((c) => {
2043
1988
  const d = s.data[c];
2044
- d.drawingType !== Ne.DRAWING_CHART && d.drawingType !== Ne.DRAWING_DOM && this._drawingRenderService.renderDrawing(d, i);
1989
+ d.drawingType !== xe.DRAWING_CHART && d.drawingType !== xe.DRAWING_DOM && this._drawingRenderService.renderDrawing(d, r);
2045
1990
  }), t();
2046
1991
  }
2047
1992
  }
@@ -2053,17 +1998,17 @@ let ct = class extends Le {
2053
1998
  this._docPrintInterceptorService.interceptor.intercept(
2054
1999
  this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_DOM_COLLECT,
2055
2000
  {
2056
- handler: (r, e, t) => {
2057
- const { unitId: n } = e, i = this._drawingManagerService.getDrawingDataForUnit(n), o = i == null ? void 0 : i[n];
2001
+ handler: (i, e, t) => {
2002
+ const { unitId: n } = e, r = this._drawingManagerService.getDrawingDataForUnit(n), o = r == null ? void 0 : r[n];
2058
2003
  if (o) {
2059
2004
  const s = o.order.map((d) => {
2060
2005
  const a = o.data[d];
2061
- if (a.drawingType === Ne.DRAWING_CHART)
2006
+ if (a.drawingType === xe.DRAWING_CHART)
2062
2007
  return {
2063
2008
  ...a,
2064
- componentKey: this._componetManager.get(Xn)
2009
+ componentKey: this._componetManager.get(Wn)
2065
2010
  };
2066
- if (a.drawingType === Ne.DRAWING_DOM) {
2011
+ if (a.drawingType === xe.DRAWING_DOM) {
2067
2012
  const g = this._docPrintInterceptorService.getPrintComponent(a.componentKey);
2068
2013
  return {
2069
2014
  ...a,
@@ -2071,9 +2016,9 @@ let ct = class extends Le {
2071
2016
  };
2072
2017
  }
2073
2018
  return null;
2074
- }).filter(Boolean), c = br(_i, this._injector);
2075
- return Br(
2076
- /* @__PURE__ */ T(
2019
+ }).filter(Boolean), c = _r(ai, this._injector);
2020
+ return Rr(
2021
+ /* @__PURE__ */ y(
2077
2022
  c,
2078
2023
  {
2079
2024
  unitId: n,
@@ -2085,9 +2030,9 @@ let ct = class extends Le {
2085
2030
  }
2086
2031
  ),
2087
2032
  e.root
2088
- ), r == null || r.add(() => {
2089
- kr(e.root);
2090
- }), t(r);
2033
+ ), i == null || i.add(() => {
2034
+ Ar(e.root);
2035
+ }), t(i);
2091
2036
  }
2092
2037
  }
2093
2038
  }
@@ -2095,32 +2040,32 @@ let ct = class extends Le {
2095
2040
  );
2096
2041
  }
2097
2042
  };
2098
- ct = Di([
2099
- $e(0, Z(Rr)),
2100
- $e(1, Z(en)),
2101
- $e(2, pe),
2102
- $e(3, Z(on)),
2103
- $e(4, Z(Jt))
2104
- ], ct);
2105
- var Oi = Object.getOwnPropertyDescriptor, yi = (r, e, t, n) => {
2106
- for (var i = n > 1 ? void 0 : n ? Oi(e, t) : e, o = r.length - 1, s; o >= 0; o--)
2107
- (s = r[o]) && (i = s(i) || i);
2108
- return i;
2109
- }, nt = (r, e) => (t, n) => e(t, n, r);
2110
- const Ti = "__InlineDrawingAnchor__";
2111
- function Kt(r) {
2112
- const { path: e } = r;
2043
+ at = di([
2044
+ Ve(0, Z(Or)),
2045
+ Ve(1, Z(Jt)),
2046
+ Ve(2, fe),
2047
+ Ve(3, Z(rn)),
2048
+ Ve(4, Z(Qt))
2049
+ ], at);
2050
+ var gi = Object.getOwnPropertyDescriptor, li = (i, e, t, n) => {
2051
+ for (var r = n > 1 ? void 0 : n ? gi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2052
+ (s = i[o]) && (r = s(r) || r);
2053
+ return r;
2054
+ }, tt = (i, e) => (t, n) => e(t, n, i);
2055
+ const ui = "__InlineDrawingAnchor__";
2056
+ function qt(i) {
2057
+ const { path: e } = i;
2113
2058
  return e.some((t) => t === "cells");
2114
2059
  }
2115
- let dt = class extends Le {
2116
- constructor(e, t, n, i) {
2060
+ let ct = class extends Ne {
2061
+ constructor(e, t, n, r) {
2117
2062
  super();
2118
- Ie(this, "_liquid", new tn());
2119
- Ie(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
2063
+ ve(this, "_liquid", new en());
2064
+ ve(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
2120
2065
  // Use to cache the drawings is under transforming or scaling.
2121
- Ie(this, "_transformerCache", /* @__PURE__ */ new Map());
2122
- Ie(this, "_anchorShape");
2123
- this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService = i, this._init();
2066
+ ve(this, "_transformerCache", /* @__PURE__ */ new Map());
2067
+ ve(this, "_anchorShape");
2068
+ this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService = r, this._init();
2124
2069
  }
2125
2070
  _init() {
2126
2071
  this._listenDrawingFocus();
@@ -2139,55 +2084,55 @@ let dt = class extends Le {
2139
2084
  // Only handle one drawing transformer change.
2140
2085
  // eslint-disable-next-line max-lines-per-function
2141
2086
  _listenTransformerChange(e) {
2142
- var i;
2143
- const t = (i = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : i.transformer;
2087
+ var r;
2088
+ const t = (r = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : r.transformer;
2144
2089
  if (t == null)
2145
2090
  return;
2146
2091
  this.disposeWithMe(
2147
- De(
2092
+ Se(
2148
2093
  t.changeStart$.subscribe((o) => {
2149
2094
  var c;
2150
2095
  this._transformerCache.clear();
2151
2096
  const { objects: s } = o;
2152
2097
  for (const d of s.values()) {
2153
- const { oKey: a, width: g, height: u, left: l, top: h, angle: f } = d, m = this._drawingManagerService.getDrawingOKey(a);
2098
+ const { oKey: a, width: g, height: u, left: l, top: f, angle: h } = d, m = this._drawingManagerService.getDrawingOKey(a);
2154
2099
  if (m == null)
2155
2100
  continue;
2156
- const p = this._univerInstanceService.getUniverDocInstance(m.unitId), v = (c = p == null ? void 0 : p.getSnapshot().drawings) == null ? void 0 : c[m.drawingId];
2157
- if ((v == null ? void 0 : v.layoutType) === F.INLINE)
2101
+ const p = this._univerInstanceService.getUniverDocInstance(m.unitId), w = (c = p == null ? void 0 : p.getSnapshot().drawings) == null ? void 0 : c[m.drawingId];
2102
+ if ((w == null ? void 0 : w.layoutType) === k.INLINE)
2158
2103
  try {
2159
2104
  d.setOpacity(0.2);
2160
2105
  } catch {
2161
2106
  }
2162
- v != null && this._transformerCache.set(m.drawingId, {
2163
- drawing: v,
2164
- top: h,
2107
+ w != null && this._transformerCache.set(m.drawingId, {
2108
+ drawing: w,
2109
+ top: f,
2165
2110
  left: l,
2166
2111
  width: g,
2167
2112
  height: u,
2168
- angle: f
2113
+ angle: h
2169
2114
  });
2170
2115
  }
2171
2116
  })
2172
2117
  )
2173
2118
  );
2174
- const n = Rt(this._updateMultipleDrawingDocTransform.bind(this), 50);
2175
- Rt(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
2176
- De(
2119
+ const n = Et(this._updateMultipleDrawingDocTransform.bind(this), 50);
2120
+ Et(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
2121
+ Se(
2177
2122
  t.changing$.subscribe((o) => {
2178
2123
  const { objects: s, offsetX: c, offsetY: d } = o;
2179
2124
  if (s.size > 1)
2180
2125
  n(s);
2181
2126
  else if (s.size === 1) {
2182
- const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: h, left: f, angle: m } = g;
2183
- if (a && u === a.width && l === a.height && h === a.top && f === a.left && m === a.angle)
2127
+ const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2128
+ if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
2184
2129
  return;
2185
- a && (a.drawing.layoutType, F.INLINE), a && a.drawing.layoutType === F.INLINE && c != null && d != null && this._updateInlineDrawingAnchor(a.drawing, c, d);
2130
+ a && (a.drawing.layoutType, k.INLINE), a && a.drawing.layoutType === k.INLINE && c != null && d != null && this._updateInlineDrawingAnchor(a.drawing, c, d);
2186
2131
  }
2187
2132
  })
2188
2133
  )
2189
2134
  ), this.disposeWithMe(
2190
- De(
2135
+ Se(
2191
2136
  // eslint-disable-next-line complexity
2192
2137
  t.changeEnd$.subscribe((o) => {
2193
2138
  const { objects: s, offsetX: c, offsetY: d } = o;
@@ -2196,7 +2141,7 @@ let dt = class extends Le {
2196
2141
  if (g == null)
2197
2142
  continue;
2198
2143
  const u = this._transformerCache.get(g == null ? void 0 : g.drawingId);
2199
- if ((u == null ? void 0 : u.drawing.layoutType) === F.INLINE)
2144
+ if ((u == null ? void 0 : u.drawing.layoutType) === k.INLINE)
2200
2145
  try {
2201
2146
  a.setOpacity(1);
2202
2147
  } catch {
@@ -2205,10 +2150,10 @@ let dt = class extends Le {
2205
2150
  if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
2206
2151
  this._updateMultipleDrawingDocTransform(s);
2207
2152
  else if (s.size === 1) {
2208
- const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: h, left: f, angle: m } = g;
2209
- if (a && u === a.width && l === a.height && h === a.top && f === a.left && m === a.angle)
2153
+ const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2154
+ if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
2210
2155
  return;
2211
- a && a.drawing.layoutType === F.INLINE ? u !== a.width || l !== a.height || m !== a.angle ? this._updateDrawingSize(a, g) : c != null && d != null && this._moveInlineDrawing(a.drawing, c, d) : a && this._nonInlineDrawingTransform(a.drawing, g);
2156
+ a && a.drawing.layoutType === k.INLINE ? u !== a.width || l !== a.height || m !== a.angle ? this._updateDrawingSize(a, g) : c != null && d != null && this._moveInlineDrawing(a.drawing, c, d) : a && this._nonInlineDrawingTransform(a.drawing, g);
2212
2157
  }
2213
2158
  this._transformerCache.clear();
2214
2159
  })
@@ -2220,19 +2165,19 @@ let dt = class extends Le {
2220
2165
  if (e.size < 1)
2221
2166
  return;
2222
2167
  const t = [];
2223
- let n, i;
2168
+ let n, r;
2224
2169
  for (const o of e.values()) {
2225
2170
  const { oKey: s, left: c, top: d, angle: a } = o;
2226
2171
  let { width: g, height: u } = o;
2227
2172
  const l = this._drawingManagerService.getDrawingOKey(s);
2228
2173
  if (l == null)
2229
2174
  continue;
2230
- n == null && (n = l.unitId), i == null && (i = l.subUnitId);
2231
- const h = this._transformerCache.get(l.drawingId);
2232
- if (h == null)
2175
+ n == null && (n = l.unitId), r == null && (r = l.subUnitId);
2176
+ const f = this._transformerCache.get(l.drawingId);
2177
+ if (f == null)
2233
2178
  continue;
2234
- const { drawing: f, top: m, left: p, width: v, height: D, angle: S } = h, { width: O, height: C } = this._getPageContentSize(f);
2235
- if (g = Math.min(g, O), u = Math.min(u, C), (v !== g || D !== u) && t.push({
2179
+ const { drawing: h, top: m, left: p, width: w, height: D, angle: S } = f, { width: O, height: C } = this._getPageContentSize(h);
2180
+ if (g = Math.min(g, O), u = Math.min(u, C), (w !== g || D !== u) && t.push({
2236
2181
  drawingId: l.drawingId,
2237
2182
  key: "size",
2238
2183
  value: {
@@ -2249,22 +2194,22 @@ let dt = class extends Le {
2249
2194
  drawingId: l.drawingId,
2250
2195
  key: "positionV",
2251
2196
  value: {
2252
- relativeFrom: f.docTransform.positionV.relativeFrom,
2253
- posOffset: f.docTransform.positionV.posOffset + M
2197
+ relativeFrom: h.docTransform.positionV.relativeFrom,
2198
+ posOffset: h.docTransform.positionV.posOffset + M
2254
2199
  }
2255
2200
  }), A !== 0 && t.push({
2256
2201
  drawingId: l.drawingId,
2257
2202
  key: "positionH",
2258
2203
  value: {
2259
- relativeFrom: f.docTransform.positionH.relativeFrom,
2260
- posOffset: f.docTransform.positionH.posOffset + A
2204
+ relativeFrom: h.docTransform.positionH.relativeFrom,
2205
+ posOffset: h.docTransform.positionH.posOffset + A
2261
2206
  }
2262
2207
  });
2263
2208
  }
2264
2209
  }
2265
- t.length > 0 && n && i && this._commandService.executeCommand(Ke.id, {
2210
+ t.length > 0 && n && r && this._commandService.executeCommand(qe.id, {
2266
2211
  unitId: n,
2267
- subUnitId: i,
2212
+ subUnitId: r,
2268
2213
  drawings: t
2269
2214
  });
2270
2215
  }
@@ -2279,24 +2224,24 @@ let dt = class extends Le {
2279
2224
  var o;
2280
2225
  if (this._transformerCache.size !== 1)
2281
2226
  return;
2282
- const { contentBoxPointGroup: i } = (o = this._getInlineDrawingAnchor(e, t, n)) != null ? o : {};
2283
- i != null && this._createOrUpdateInlineAnchor(e.unitId, i);
2227
+ const { contentBoxPointGroup: r } = (o = this._getInlineDrawingAnchor(e, t, n)) != null ? o : {};
2228
+ r != null && this._createOrUpdateInlineAnchor(e.unitId, r);
2284
2229
  }
2285
2230
  _getInlineDrawingAnchor(e, t, n) {
2286
- var x, G;
2287
- const i = this._renderManagerService.getRenderById(e.unitId), o = i == null ? void 0 : i.with(te).getSkeleton();
2288
- if (i == null)
2231
+ var x, H;
2232
+ const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(te).getSkeleton();
2233
+ if (r == null)
2289
2234
  return;
2290
- const { mainComponent: s, scene: c } = i, d = s, a = c.getViewports()[0], {
2235
+ const { mainComponent: s, scene: c } = r, d = s, a = c.getViewports()[0], {
2291
2236
  pageLayoutType: g = Ut.VERTICAL,
2292
2237
  pageMarginLeft: u,
2293
2238
  pageMarginTop: l
2294
2239
  } = d.getOffsetConfig();
2295
- let h = null, f = !1, m = -1, p = "";
2296
- const v = 0.5, D = this._getTransformCoordForDocumentOffset(d, a, t, n);
2240
+ let f = null, h = !1, m = -1, p = "";
2241
+ const w = 0.5, D = this._getTransformCoordForDocumentOffset(d, a, t, n);
2297
2242
  if (D == null)
2298
2243
  return;
2299
- const S = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Ce);
2244
+ const S = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(be);
2300
2245
  if (S == null)
2301
2246
  return;
2302
2247
  const O = o == null ? void 0 : o.findNodeByCoord(D, g, u, l, {
@@ -2305,82 +2250,82 @@ let dt = class extends Le {
2305
2250
  segmentPage: S.getSegmentPage()
2306
2251
  });
2307
2252
  if (O) {
2308
- const { node: I, ratioX: _, segmentPage: E, segmentId: y } = O;
2309
- f = _ < v, h = I, m = E, p = y;
2253
+ const { node: I, ratioX: _, segmentPage: E, segmentId: T } = O;
2254
+ h = _ < w, f = I, m = E, p = T;
2310
2255
  }
2311
- if (h == null)
2256
+ if (f == null)
2312
2257
  return;
2313
- const C = o == null ? void 0 : o.findPositionByGlyph(h, m), M = this._getDocObject();
2314
- if (C == null || o == null || M == null || Kt(C))
2258
+ const C = o == null ? void 0 : o.findPositionByGlyph(f, m), M = this._getDocObject();
2259
+ if (C == null || o == null || M == null || qt(C))
2315
2260
  return;
2316
2261
  const A = {
2317
2262
  ...C,
2318
- isBack: f
2319
- }, U = M.document.getOffsetConfig(), R = new kt(U, o), { cursorList: w, contentBoxPointGroup: N } = R.getRangePointData(A, A), { startOffset: H } = (G = Ft(w)) != null ? G : {};
2320
- if (H != null)
2321
- return { offset: H, contentBoxPointGroup: N, segmentId: p, segmentPage: m };
2263
+ isBack: h
2264
+ }, L = M.document.getOffsetConfig(), R = new Bt(L, o), { cursorList: v, contentBoxPointGroup: N } = R.getRangePointData(A, A), { startOffset: G } = (H = Ft(v)) != null ? H : {};
2265
+ if (G != null)
2266
+ return { offset: G, contentBoxPointGroup: N, segmentId: p, segmentPage: m };
2322
2267
  }
2323
2268
  // eslint-disable-next-line max-lines-per-function, complexity
2324
2269
  _getDrawingAnchor(e, t) {
2325
- var _e, Se, ce, Oe, ye, Re, Ae, Te, de, ge, Pe;
2326
- const n = this._renderManagerService.getRenderById(e.unitId), i = n == null ? void 0 : n.with(te).getSkeleton(), o = i == null ? void 0 : i.getSkeletonData();
2270
+ var Ie, _e, ce, De, Oe, Ee, Re, Te, de, ge, Ae;
2271
+ const n = this._renderManagerService.getRenderById(e.unitId), r = n == null ? void 0 : n.with(te).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
2327
2272
  if (o == null || n == null)
2328
2273
  return;
2329
- const { pages: s, skeHeaders: c, skeFooters: d } = o, { mainComponent: a, scene: g } = n, u = a, l = g.getViewports()[0], { pageLayoutType: h = Ut.VERTICAL, pageMarginLeft: f, pageMarginTop: m, docsLeft: p, docsTop: v } = u.getOffsetConfig(), { left: D, top: S, angle: O } = t;
2274
+ const { pages: s, skeHeaders: c, skeFooters: d } = o, { mainComponent: a, scene: g } = n, u = a, l = g.getViewports()[0], { pageLayoutType: f = Ut.VERTICAL, pageMarginLeft: h, pageMarginTop: m, docsLeft: p, docsTop: w } = u.getOffsetConfig(), { left: D, top: S, angle: O } = t;
2330
2275
  let { width: C, height: M } = t;
2331
- const { positionV: A, positionH: U } = e.docTransform, { width: R, height: w } = this._getPageContentSize(e);
2332
- C = Math.min(C, R), M = Math.min(M, w);
2333
- let N = null, H = "", x = -1;
2334
- const G = !1, I = {
2276
+ const { positionV: A, positionH: L } = e.docTransform, { width: R, height: v } = this._getPageContentSize(e);
2277
+ C = Math.min(C, R), M = Math.min(M, v);
2278
+ let N = null, G = "", x = -1;
2279
+ const H = !1, I = {
2335
2280
  ...e.docTransform,
2336
2281
  size: {
2337
2282
  width: C,
2338
2283
  height: M
2339
2284
  },
2340
2285
  angle: O
2341
- }, { x: _, y: E } = g.getViewportScrollXY(l), y = this._getTransformCoordForDocumentOffset(u, l, D - _, S - E);
2342
- if (y == null)
2286
+ }, { x: _, y: E } = g.getViewportScrollXY(l), T = this._getTransformCoordForDocumentOffset(u, l, D - _, S - E);
2287
+ if (T == null)
2343
2288
  return;
2344
- const L = (_e = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : _e.with(Ce);
2345
- if (L == null)
2289
+ const U = (Ie = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : Ie.with(be);
2290
+ if (U == null)
2346
2291
  return;
2347
- const B = i == null ? void 0 : i.findNodeByCoord(y, h, f, m, {
2292
+ const B = r == null ? void 0 : r.findNodeByCoord(T, f, h, m, {
2348
2293
  strict: !1,
2349
- segmentId: L.getSegment(),
2350
- segmentPage: L.getSegmentPage()
2294
+ segmentId: U.getSegment(),
2295
+ segmentPage: U.getSegmentPage()
2351
2296
  });
2352
2297
  if (B) {
2353
- const { node: me, segmentPage: ht, segmentId: pt } = B;
2354
- N = me, x = ht, H = pt;
2298
+ const { node: pe, segmentPage: ht, segmentId: ft } = B;
2299
+ N = pe, x = ht, G = ft;
2355
2300
  }
2356
2301
  if (N == null)
2357
2302
  return;
2358
- const b = (Se = N.parent) == null ? void 0 : Se.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((me) => me.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && me.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], k = (Oe = P == null ? void 0 : P.parent) == null ? void 0 : Oe.parent;
2359
- if (b == null || P == null || V == null || k == null)
2303
+ const b = (_e = N.parent) == null ? void 0 : _e.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], F = (De = P == null ? void 0 : P.parent) == null ? void 0 : De.parent;
2304
+ if (b == null || P == null || V == null || F == null)
2360
2305
  return;
2361
2306
  this._liquid.reset();
2362
- const K = k.type;
2363
- for (const me of s) {
2364
- const { headerId: ht, footerId: pt, pageHeight: Ln, pageWidth: Ct, marginLeft: Et, marginBottom: Un } = me, Bn = s.indexOf(me);
2365
- if (x > -1 && Bn === x) {
2307
+ const K = F.type;
2308
+ for (const pe of s) {
2309
+ const { headerId: ht, footerId: ft, pageHeight: Cn, pageWidth: bt, marginLeft: Ct, marginBottom: En } = pe, Rn = s.indexOf(pe);
2310
+ if (x > -1 && Rn === x) {
2366
2311
  switch (K) {
2367
- case Bt.HEADER: {
2368
- const je = (ye = c.get(ht)) == null ? void 0 : ye.get(Ct);
2369
- if (je)
2312
+ case Lt.HEADER: {
2313
+ const He = (Oe = c.get(ht)) == null ? void 0 : Oe.get(bt);
2314
+ if (He)
2370
2315
  this._liquid.translatePagePadding({
2371
- marginTop: je.marginTop,
2372
- marginLeft: Et
2316
+ marginTop: He.marginTop,
2317
+ marginLeft: Ct
2373
2318
  });
2374
2319
  else
2375
2320
  throw new Error("header skeleton not found");
2376
2321
  break;
2377
2322
  }
2378
- case Bt.FOOTER: {
2379
- const je = (Re = d.get(pt)) == null ? void 0 : Re.get(Ct);
2380
- if (je)
2323
+ case Lt.FOOTER: {
2324
+ const He = (Ee = d.get(ft)) == null ? void 0 : Ee.get(bt);
2325
+ if (He)
2381
2326
  this._liquid.translatePagePadding({
2382
- marginTop: Ln - Un + je.marginTop,
2383
- marginLeft: Et
2327
+ marginTop: Cn - En + He.marginTop,
2328
+ marginLeft: Ct
2384
2329
  });
2385
2330
  else
2386
2331
  throw new Error("footer skeleton not found");
@@ -2389,16 +2334,16 @@ let dt = class extends Le {
2389
2334
  }
2390
2335
  break;
2391
2336
  }
2392
- if (this._liquid.translatePagePadding(me), me === k)
2337
+ if (this._liquid.translatePagePadding(pe), pe === F)
2393
2338
  break;
2394
- this._liquid.restorePagePadding(me), this._liquid.translatePage(me, h, f, m);
2339
+ this._liquid.restorePagePadding(pe), this._liquid.translatePage(pe, f, h, m);
2395
2340
  }
2396
- switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (Te = (Ae = V.divides) == null ? void 0 : Ae[0]) == null ? void 0 : Te.glyphGroup) == null ? void 0 : de[0]) != null ? ge : N, I.positionH = {
2397
- relativeFrom: U.relativeFrom,
2341
+ switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (Te = (Re = V.divides) == null ? void 0 : Re[0]) == null ? void 0 : Te.glyphGroup) == null ? void 0 : de[0]) != null ? ge : N, I.positionH = {
2342
+ relativeFrom: L.relativeFrom,
2398
2343
  posOffset: D - this._liquid.x - p
2399
- }, U.relativeFrom) {
2344
+ }, L.relativeFrom) {
2400
2345
  case J.MARGIN: {
2401
- I.positionH.posOffset = D - this._liquid.x - p - k.marginLeft;
2346
+ I.positionH.posOffset = D - this._liquid.x - p - F.marginLeft;
2402
2347
  break;
2403
2348
  }
2404
2349
  case J.COLUMN: {
@@ -2408,50 +2353,50 @@ let dt = class extends Le {
2408
2353
  }
2409
2354
  switch (I.positionV = {
2410
2355
  relativeFrom: A.relativeFrom,
2411
- posOffset: S - this._liquid.y - v
2356
+ posOffset: S - this._liquid.y - w
2412
2357
  }, A.relativeFrom) {
2413
2358
  case W.PAGE: {
2414
- I.positionV.posOffset = S - this._liquid.y - v - k.marginTop;
2359
+ I.positionV.posOffset = S - this._liquid.y - w - F.marginTop;
2415
2360
  break;
2416
2361
  }
2417
2362
  case W.LINE: {
2418
- I.positionV.posOffset = S - this._liquid.y - v - b.top;
2363
+ I.positionV.posOffset = S - this._liquid.y - w - b.top;
2419
2364
  break;
2420
2365
  }
2421
2366
  case W.PARAGRAPH: {
2422
- I.positionV.posOffset = S - this._liquid.y - v - V.top;
2367
+ I.positionV.posOffset = S - this._liquid.y - w - V.top;
2423
2368
  break;
2424
2369
  }
2425
2370
  }
2426
2371
  if (N == null)
2427
2372
  return;
2428
- const se = i == null ? void 0 : i.findPositionByGlyph(N, x), Be = this._getDocObject();
2429
- if (se == null || i == null || Be == null || Kt(se))
2373
+ const se = r == null ? void 0 : r.findPositionByGlyph(N, x), Le = this._getDocObject();
2374
+ if (se == null || r == null || Le == null || qt(se))
2430
2375
  return;
2431
- const Ee = {
2376
+ const Ce = {
2432
2377
  ...se,
2433
- isBack: G
2434
- }, Ge = Be.document.getOffsetConfig(), ae = new kt(Ge, i), { cursorList: ne } = ae.getRangePointData(Ee, Ee), { startOffset: re } = (Pe = Ft(ne)) != null ? Pe : {};
2378
+ isBack: H
2379
+ }, Ge = Le.document.getOffsetConfig(), ae = new Bt(Ge, r), { cursorList: ne } = ae.getRangePointData(Ce, Ce), { startOffset: re } = (Ae = Ft(ne)) != null ? Ae : {};
2435
2380
  if (re != null)
2436
- return { offset: re, docTransform: I, segmentId: H, segmentPage: x };
2381
+ return { offset: re, docTransform: I, segmentId: G, segmentPage: x };
2437
2382
  }
2438
2383
  // Update drawing when use transformer to resize it.
2439
2384
  _updateDrawingSize(e, t) {
2440
- const n = [], { drawing: i, width: o, height: s, angle: c } = e, { unitId: d, subUnitId: a } = i;
2385
+ const n = [], { drawing: r, width: o, height: s, angle: c } = e, { unitId: d, subUnitId: a } = r;
2441
2386
  let { width: g, height: u, angle: l } = t;
2442
- const { width: h, height: f } = this._getPageContentSize(i);
2443
- g = Math.min(h, g), u = Math.min(f, u), (g !== o || u !== s) && n.push({
2444
- drawingId: i.drawingId,
2387
+ const { width: f, height: h } = this._getPageContentSize(r);
2388
+ g = Math.min(f, g), u = Math.min(h, u), (g !== o || u !== s) && n.push({
2389
+ drawingId: r.drawingId,
2445
2390
  key: "size",
2446
2391
  value: {
2447
2392
  width: g,
2448
2393
  height: u
2449
2394
  }
2450
2395
  }), l !== c && n.push({
2451
- drawingId: i.drawingId,
2396
+ drawingId: r.drawingId,
2452
2397
  key: "angle",
2453
2398
  value: l
2454
- }), n.length > 0 && d && a && this._commandService.executeCommand(Ke.id, {
2399
+ }), n.length > 0 && d && a && this._commandService.executeCommand(qe.id, {
2455
2400
  unitId: d,
2456
2401
  subUnitId: a,
2457
2402
  drawings: n
@@ -2459,8 +2404,8 @@ let dt = class extends Le {
2459
2404
  }
2460
2405
  // Update inline drawing when use transformer to move it.
2461
2406
  _moveInlineDrawing(e, t, n) {
2462
- const i = this._getInlineDrawingAnchor(e, t, n), { offset: o, segmentId: s, segmentPage: c } = i != null ? i : {};
2463
- return this._commandService.executeCommand(Tn.id, {
2407
+ const r = this._getInlineDrawingAnchor(e, t, n), { offset: o, segmentId: s, segmentPage: c } = r != null ? r : {};
2408
+ return this._commandService.executeCommand(In.id, {
2464
2409
  unitId: e.unitId,
2465
2410
  subUnitId: e.unitId,
2466
2411
  drawing: e,
@@ -2473,35 +2418,35 @@ let dt = class extends Le {
2473
2418
  // Limit the drawing to the page area, mainly in the vertical direction,
2474
2419
  // and the upper and lower limits cannot exceed the page margin area.
2475
2420
  _limitDrawingInPage(e, t) {
2476
- const n = this._renderManagerService.getRenderById(e.unitId), { left: i, top: o, width: s, height: c, angle: d } = t, a = n == null ? void 0 : n.with(te).getSkeleton(), g = a == null ? void 0 : a.getSkeletonData(), { pages: u } = g != null ? g : {};
2421
+ const n = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: c, angle: d } = t, a = n == null ? void 0 : n.with(te).getSkeleton(), g = a == null ? void 0 : a.getSkeletonData(), { pages: u } = g != null ? g : {};
2477
2422
  if (g == null || n == null || u == null)
2478
2423
  return {
2479
- left: i,
2424
+ left: r,
2480
2425
  top: o,
2481
2426
  width: s,
2482
2427
  height: c,
2483
2428
  angle: d
2484
2429
  };
2485
- const { mainComponent: l } = n, h = l, { top: f, pageLayoutType: m, pageMarginLeft: p, pageMarginTop: v } = h;
2430
+ const { mainComponent: l } = n, f = l, { top: h, pageLayoutType: m, pageMarginLeft: p, pageMarginTop: w } = f;
2486
2431
  let D = o;
2487
2432
  this._liquid.reset();
2488
2433
  for (const S of u) {
2489
2434
  const { marginBottom: O, pageHeight: C } = S, M = u.indexOf(S), A = u[M + 1];
2490
2435
  if (A == null)
2491
2436
  continue;
2492
- if (be.hasIntersectionBetweenTwoRanges(
2437
+ if (Me.hasIntersectionBetweenTwoRanges(
2493
2438
  o,
2494
2439
  o + c,
2495
- this._liquid.y + f + C - O,
2496
- this._liquid.y + f + C + v + A.marginTop
2440
+ this._liquid.y + h + C - O,
2441
+ this._liquid.y + h + C + w + A.marginTop
2497
2442
  )) {
2498
- const R = o + c / 2, w = this._liquid.y + f + C + v / 2;
2499
- R < w ? D = Math.min(o, this._liquid.y + f + C - O - c) : D = Math.max(o, this._liquid.y + f + C + v + A.marginTop);
2443
+ const R = o + c / 2, v = this._liquid.y + h + C + w / 2;
2444
+ R < v ? D = Math.min(o, this._liquid.y + h + C - O - c) : D = Math.max(o, this._liquid.y + h + C + w + A.marginTop);
2500
2445
  }
2501
- this._liquid.translatePage(S, m, p, v);
2446
+ this._liquid.translatePage(S, m, p, w);
2502
2447
  }
2503
2448
  return {
2504
- left: i,
2449
+ left: r,
2505
2450
  top: D,
2506
2451
  width: s,
2507
2452
  height: c,
@@ -2509,11 +2454,11 @@ let dt = class extends Le {
2509
2454
  };
2510
2455
  }
2511
2456
  _nonInlineDrawingTransform(e, t, n = !1) {
2512
- const i = e.isMultiTransform === oe.TRUE ? t : this._limitDrawingInPage(e, t);
2513
- if (n && i.top !== t.top)
2457
+ const r = e.isMultiTransform === oe.TRUE ? t : this._limitDrawingInPage(e, t);
2458
+ if (n && r.top !== t.top)
2514
2459
  return;
2515
- const o = this._getDrawingAnchor(e, i), { offset: s, docTransform: c, segmentId: d, segmentPage: a } = o != null ? o : {};
2516
- return s == null || c == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, t]])) : this._commandService.executeCommand(Mn.id, {
2460
+ const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: c, segmentId: d, segmentPage: a } = o != null ? o : {};
2461
+ return s == null || c == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, t]])) : this._commandService.executeCommand(_n.id, {
2517
2462
  unitId: e.unitId,
2518
2463
  subUnitId: e.unitId,
2519
2464
  drawing: e,
@@ -2529,11 +2474,11 @@ let dt = class extends Le {
2529
2474
  const t = this._renderManagerService.getRenderById(e), n = t == null ? void 0 : t.scene;
2530
2475
  if (n == null)
2531
2476
  return;
2532
- const i = n.getTransformerByCreate();
2533
- return { scene: n, transformer: i };
2477
+ const r = n.getTransformerByCreate();
2478
+ return { scene: n, transformer: r };
2534
2479
  }
2535
- _getTransformCoordForDocumentOffset(e, t, n, i) {
2536
- const { documentTransform: o } = e.getOffsetConfig(), s = t.transformVector2SceneCoord(pr.FromArray([n, i]));
2480
+ _getTransformCoordForDocumentOffset(e, t, n, r) {
2481
+ const { documentTransform: o } = e.getOffsetConfig(), s = t.transformVector2SceneCoord(cr.FromArray([n, r]));
2537
2482
  if (s)
2538
2483
  return o.clone().invert().applyPoint(s);
2539
2484
  }
@@ -2541,32 +2486,32 @@ let dt = class extends Le {
2541
2486
  const n = this._renderManagerService.getRenderById(e);
2542
2487
  if (n == null)
2543
2488
  return;
2544
- const { mainComponent: i, scene: o } = n, s = i, {
2489
+ const { mainComponent: r, scene: o } = n, s = r, {
2545
2490
  docsLeft: c,
2546
2491
  docsTop: d
2547
- } = s.getOffsetConfig(), a = Ar(t), { left: g, top: u, height: l } = a, h = g + c, f = u + d;
2492
+ } = s.getOffsetConfig(), a = Tr(t), { left: g, top: u, height: l } = a, f = g + c, h = u + d;
2548
2493
  if (this._anchorShape) {
2549
- this._anchorShape.transformByState({ left: h, top: f, height: l }), this._anchorShape.show();
2494
+ this._anchorShape.transformByState({ left: f, top: h, height: l }), this._anchorShape.show();
2550
2495
  return;
2551
2496
  }
2552
- const m = 6, p = new mr(Ti + be.generateRandomId(m), {
2553
- left: h,
2554
- top: f,
2497
+ const m = 6, p = new dr(ui + Me.generateRandomId(m), {
2498
+ left: f,
2499
+ top: h,
2555
2500
  height: l,
2556
2501
  strokeWidth: 2,
2557
- stroke: vr(qn.darkGray, 1),
2502
+ stroke: gr(Gn.darkGray, 1),
2558
2503
  evented: !1
2559
2504
  });
2560
- this._anchorShape = p, o.addObject(p, Pr);
2505
+ this._anchorShape = p, o.addObject(p, yr);
2561
2506
  }
2562
2507
  _getDocObject() {
2563
- return xr(this._univerInstanceService, this._renderManagerService);
2508
+ return Mr(this._univerInstanceService, this._renderManagerService);
2564
2509
  }
2565
2510
  _getPageContentSize(e) {
2566
- const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(), i = 500, o = 500, s = n == null ? void 0 : n.getSkeletonData();
2511
+ const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(), r = 500, o = 500, s = n == null ? void 0 : n.getSkeletonData();
2567
2512
  if (s == null || t == null)
2568
2513
  return {
2569
- width: i,
2514
+ width: r,
2570
2515
  height: o
2571
2516
  };
2572
2517
  const { pages: c } = s;
@@ -2579,37 +2524,37 @@ let dt = class extends Le {
2579
2524
  }
2580
2525
  }
2581
2526
  if (d) {
2582
- const { pageWidth: a, pageHeight: g, marginLeft: u, marginBottom: l, marginRight: h, marginTop: f } = d;
2527
+ const { pageWidth: a, pageHeight: g, marginLeft: u, marginBottom: l, marginRight: f, marginTop: h } = d;
2583
2528
  return {
2584
- width: Math.max(i, a - u - h),
2585
- height: Math.max(o, g - f - l)
2529
+ width: Math.max(r, a - u - f),
2530
+ height: Math.max(o, g - h - l)
2586
2531
  };
2587
2532
  } else
2588
2533
  return {
2589
- width: i,
2534
+ width: r,
2590
2535
  height: o
2591
2536
  };
2592
2537
  }
2593
2538
  };
2594
- dt = yi([
2595
- nt(0, j),
2596
- nt(1, z),
2597
- nt(2, pe),
2598
- nt(3, Q)
2599
- ], dt);
2600
- var Mi = Object.getOwnPropertyDescriptor, bi = (r, e, t, n) => {
2601
- for (var i = n > 1 ? void 0 : n ? Mi(e, t) : e, o = r.length - 1, s; o >= 0; o--)
2602
- (s = r[o]) && (i = s(i) || i);
2603
- return i;
2604
- }, ze = (r, e) => (t, n) => e(t, n, r);
2605
- let gt = class extends Kn {
2606
- constructor(e, t, n, i, o) {
2539
+ ct = li([
2540
+ tt(0, j),
2541
+ tt(1, z),
2542
+ tt(2, fe),
2543
+ tt(3, Q)
2544
+ ], ct);
2545
+ var hi = Object.getOwnPropertyDescriptor, fi = (i, e, t, n) => {
2546
+ for (var r = n > 1 ? void 0 : n ? hi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2547
+ (s = i[o]) && (r = s(r) || r);
2548
+ return r;
2549
+ }, $e = (i, e) => (t, n) => e(t, n, i);
2550
+ let dt = class extends Hn {
2551
+ constructor(e, t, n, r, o) {
2607
2552
  super();
2608
- Ie(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2609
- this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = n, this._univerInstanceService = i, this._contextService = o, this._init();
2553
+ ve(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2554
+ this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = n, this._univerInstanceService = r, this._contextService = o, this._init();
2610
2555
  }
2611
2556
  _init() {
2612
- this._univerInstanceService.getCurrentTypeOfUnit$(we.UNIVER_DOC).pipe(Vt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_DOC).pipe(Vt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(we.UNIVER_DOC).forEach((e) => this._create(e));
2557
+ this._univerInstanceService.getCurrentTypeOfUnit$(we.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(we.UNIVER_DOC).forEach((e) => this._create(e));
2613
2558
  }
2614
2559
  _dispose(e) {
2615
2560
  const t = e.getUnitId();
@@ -2624,7 +2569,7 @@ let gt = class extends Kn {
2624
2569
  _hasCropObject(e) {
2625
2570
  const t = e.getAllObjects();
2626
2571
  for (const n of t)
2627
- if (n instanceof dr)
2572
+ if (n instanceof nr)
2628
2573
  return !0;
2629
2574
  return !1;
2630
2575
  }
@@ -2637,34 +2582,34 @@ let gt = class extends Kn {
2637
2582
  const n = t.getTransformerByCreate();
2638
2583
  if (!n)
2639
2584
  return;
2640
- const i = [];
2585
+ const r = [];
2641
2586
  this.disposeWithMe(
2642
- De(
2587
+ Se(
2643
2588
  n.createControl$.subscribe(() => {
2644
2589
  if (this._hasCropObject(t))
2645
2590
  return;
2646
2591
  const s = n.getSelectedObjectMap();
2647
- if (i.forEach((v) => v.dispose()), i.length = 0, s.size > 1)
2592
+ if (r.forEach((w) => w.dispose()), r.length = 0, s.size > 1)
2648
2593
  return;
2649
2594
  const c = s.values().next().value;
2650
2595
  if (!c)
2651
2596
  return;
2652
2597
  const d = c.oKey, a = this._drawingManagerService.getDrawingOKey(d);
2653
- if (!a || a.drawingType === Ne.DRAWING_DOM)
2598
+ if (!a || a.drawingType === xe.DRAWING_DOM)
2654
2599
  return;
2655
- const { unitId: g, subUnitId: u, drawingId: l, drawingType: h } = a, f = this._canvasPopManagerService.attachPopupToObject(
2600
+ const { unitId: g, subUnitId: u, drawingId: l, drawingType: f } = a, h = this._canvasPopManagerService.attachPopupToObject(
2656
2601
  c,
2657
2602
  {
2658
- componentKey: gr,
2603
+ componentKey: rr,
2659
2604
  direction: "horizontal",
2660
2605
  offset: [2, 0],
2661
2606
  extraProps: {
2662
- menuItems: this._getImageMenuItems(g, u, l, h)
2607
+ menuItems: this._getImageMenuItems(g, u, l, f)
2663
2608
  }
2664
2609
  },
2665
2610
  g
2666
2611
  );
2667
- i.push(this.disposeWithMe(f)), !this._drawingManagerService.getFocusDrawings().find((v) => v.unitId === g && v.subUnitId === u && v.drawingId === l) && this._drawingManagerService.focusDrawing([{
2612
+ r.push(this.disposeWithMe(h)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === g && w.subUnitId === u && w.drawingId === l) && this._drawingManagerService.focusDrawing([{
2668
2613
  unitId: g,
2669
2614
  subUnitId: u,
2670
2615
  drawingId: l
@@ -2672,31 +2617,31 @@ let gt = class extends Kn {
2672
2617
  })
2673
2618
  )
2674
2619
  ), this.disposeWithMe(
2675
- De(
2620
+ Se(
2676
2621
  n.clearControl$.subscribe(() => {
2677
- i.forEach((s) => s.dispose()), i.length = 0, this._contextService.setContextValue(rt, !1), this._drawingManagerService.focusDrawing(null);
2622
+ r.forEach((s) => s.dispose()), r.length = 0, this._contextService.setContextValue(nt, !1), this._drawingManagerService.focusDrawing(null);
2678
2623
  })
2679
2624
  )
2680
2625
  ), this.disposeWithMe(
2681
- De(
2626
+ Se(
2682
2627
  n.changing$.subscribe(() => {
2683
- i.forEach((s) => s.dispose()), i.length = 0;
2628
+ r.forEach((s) => s.dispose()), r.length = 0;
2684
2629
  })
2685
2630
  )
2686
2631
  ), this.disposeWithMe(
2687
- De(
2632
+ Se(
2688
2633
  n.changeStart$.subscribe(() => {
2689
- i.forEach((s) => s.dispose()), i.length = 0;
2634
+ r.forEach((s) => s.dispose()), r.length = 0;
2690
2635
  })
2691
2636
  )
2692
2637
  );
2693
2638
  }
2694
- _getImageMenuItems(e, t, n, i) {
2639
+ _getImageMenuItems(e, t, n, r) {
2695
2640
  return [
2696
2641
  {
2697
2642
  label: "image-popup.edit",
2698
2643
  index: 0,
2699
- commandId: En.id,
2644
+ commandId: On.id,
2700
2645
  commandParams: { unitId: e, subUnitId: t, drawingId: n },
2701
2646
  // disable: !!SHEET_EDITOR_UNITS.includes(unitId) || drawingType === DrawingTypeEnum.DRAWING_DOM,
2702
2647
  disable: !0
@@ -2704,14 +2649,14 @@ let gt = class extends Kn {
2704
2649
  {
2705
2650
  label: "image-popup.delete",
2706
2651
  index: 1,
2707
- commandId: Mt.id,
2652
+ commandId: yt.id,
2708
2653
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: t, drawingId: n }] },
2709
2654
  disable: !1
2710
2655
  },
2711
2656
  {
2712
2657
  label: "image-popup.crop",
2713
2658
  index: 2,
2714
- commandId: lr.id,
2659
+ commandId: ir.id,
2715
2660
  commandParams: { unitId: e, subUnitId: t, drawingId: n },
2716
2661
  disable: !0
2717
2662
  // TODO: @JOCS, feature is not ready.
@@ -2719,7 +2664,7 @@ let gt = class extends Kn {
2719
2664
  {
2720
2665
  label: "image-popup.reset",
2721
2666
  index: 3,
2722
- commandId: ur.id,
2667
+ commandId: or.id,
2723
2668
  commandParams: [{ unitId: e, subUnitId: t, drawingId: n }],
2724
2669
  disable: !0
2725
2670
  // TODO: @JOCS, feature is not ready.
@@ -2727,23 +2672,23 @@ let gt = class extends Kn {
2727
2672
  ];
2728
2673
  }
2729
2674
  };
2730
- gt = bi([
2731
- ze(0, pe),
2732
- ze(1, Z(Nr)),
2733
- ze(2, Q),
2734
- ze(3, z),
2735
- ze(4, Zt)
2736
- ], gt);
2737
- var Ci = Object.getOwnPropertyDescriptor, Ei = (r, e, t, n) => {
2738
- for (var i = n > 1 ? void 0 : n ? Ci(e, t) : e, o = r.length - 1, s; o >= 0; o--)
2739
- (s = r[o]) && (i = s(i) || i);
2740
- return i;
2741
- }, xe = (r, e) => (t, n) => e(t, n, r);
2742
- let _t = class extends Le {
2743
- constructor(e, t, n, i, o, s, c, d) {
2675
+ dt = fi([
2676
+ $e(0, fe),
2677
+ $e(1, Z(br)),
2678
+ $e(2, Q),
2679
+ $e(3, z),
2680
+ $e(4, Yt)
2681
+ ], dt);
2682
+ var pi = Object.getOwnPropertyDescriptor, mi = (i, e, t, n) => {
2683
+ for (var r = n > 1 ? void 0 : n ? pi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2684
+ (s = i[o]) && (r = s(r) || r);
2685
+ return r;
2686
+ }, Pe = (i, e) => (t, n) => e(t, n, i);
2687
+ let It = class extends Ne {
2688
+ constructor(e, t, n, r, o, s, c, d) {
2744
2689
  super();
2745
- Ie(this, "_liquid", new tn());
2746
- this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService = i, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = c, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
2690
+ ve(this, "_liquid", new en());
2691
+ this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = c, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
2747
2692
  }
2748
2693
  _initialize() {
2749
2694
  this._initialRenderRefresh(), this._drawingInitializeListener(), this._initResize();
@@ -2756,17 +2701,17 @@ let _t = class extends Le {
2756
2701
  });
2757
2702
  }
2758
2703
  _commandExecutedListener() {
2759
- const e = [ee.id, cn.id];
2704
+ const e = [ee.id, an.id];
2760
2705
  this.disposeWithMe(
2761
2706
  this._commandService.onCommandExecuted((t) => {
2762
2707
  if (e.includes(t.id)) {
2763
- const n = t.params, { unitId: i } = n, { unitId: o, mainComponent: s } = this._context;
2764
- if (i !== o)
2708
+ const n = t.params, { unitId: r } = n, { unitId: o, mainComponent: s } = this._context;
2709
+ if (r !== o)
2765
2710
  return;
2766
2711
  const c = this._docSkeletonManagerService.getSkeleton();
2767
2712
  if (c == null)
2768
2713
  return;
2769
- if (this._editorService.isEditor(o) && o !== Dt) {
2714
+ if (this._editorService.isEditor(o) && o !== St) {
2770
2715
  s == null || s.makeDirty();
2771
2716
  return;
2772
2717
  }
@@ -2777,9 +2722,9 @@ let _t = class extends Le {
2777
2722
  }
2778
2723
  _initResize() {
2779
2724
  this.disposeWithMe(
2780
- Qt(this._context.engine.onTransformChange$).pipe(
2781
- $t((e) => e.type === wr.resize),
2782
- gn(16)
2725
+ Zt(this._context.engine.onTransformChange$).pipe(
2726
+ Vt((e) => e.type === lr.resize),
2727
+ dn(16)
2783
2728
  ).subscribe(() => {
2784
2729
  var n;
2785
2730
  const e = this._docSkeletonManagerService.getSkeleton(), { scene: t } = this._context;
@@ -2789,73 +2734,73 @@ let _t = class extends Le {
2789
2734
  }
2790
2735
  _refreshDrawing(e) {
2791
2736
  var D, S;
2792
- const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId: i } = this._context, o = n;
2737
+ const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId: r } = this._context, o = n;
2793
2738
  if (!t)
2794
2739
  return;
2795
- const { left: s, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: g } = o, { pages: u, skeHeaders: l, skeFooters: h } = t, f = {};
2740
+ const { left: s, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: g } = o, { pages: u, skeHeaders: l, skeFooters: f } = t, h = {};
2796
2741
  this._liquid.reset();
2797
2742
  for (let O = 0, C = u.length; O < C; O++) {
2798
- const M = u[O], { headerId: A, footerId: U, pageWidth: R } = M;
2743
+ const M = u[O], { headerId: A, footerId: L, pageWidth: R } = M;
2799
2744
  if (A) {
2800
- const w = (D = l.get(A)) == null ? void 0 : D.get(R);
2801
- w && this._calculateDrawingPosition(
2802
- i,
2803
- w,
2745
+ const v = (D = l.get(A)) == null ? void 0 : D.get(R);
2746
+ v && this._calculateDrawingPosition(
2747
+ r,
2748
+ v,
2804
2749
  s,
2805
2750
  c,
2806
- f,
2807
- w.marginTop,
2751
+ h,
2752
+ v.marginTop,
2808
2753
  M.marginLeft
2809
2754
  );
2810
2755
  }
2811
- if (U) {
2812
- const w = (S = h.get(U)) == null ? void 0 : S.get(R);
2813
- w && this._calculateDrawingPosition(
2814
- i,
2815
- w,
2756
+ if (L) {
2757
+ const v = (S = f.get(L)) == null ? void 0 : S.get(R);
2758
+ v && this._calculateDrawingPosition(
2759
+ r,
2760
+ v,
2816
2761
  s,
2817
2762
  c,
2818
- f,
2819
- M.pageHeight - M.marginBottom + w.marginTop,
2763
+ h,
2764
+ M.pageHeight - M.marginBottom + v.marginTop,
2820
2765
  M.marginLeft
2821
2766
  );
2822
2767
  }
2823
- this._calculateDrawingPosition(i, M, s, c, f, M.marginTop, M.marginLeft), this._liquid.translatePage(M, d, a, g);
2768
+ this._calculateDrawingPosition(r, M, s, c, h, M.marginTop, M.marginLeft), this._liquid.translatePage(M, d, a, g);
2824
2769
  }
2825
- const m = Object.values(f), p = m.filter((O) => !O.isMultiTransform), v = m.filter((O) => O.isMultiTransform);
2826
- p.length > 0 && this._drawingManagerService.refreshTransform(p), this._handleMultiDrawingsTransform(v);
2770
+ const m = Object.values(h), p = m.filter((O) => !O.isMultiTransform), w = m.filter((O) => O.isMultiTransform);
2771
+ p.length > 0 && this._drawingManagerService.refreshTransform(p), this._handleMultiDrawingsTransform(w);
2827
2772
  }
2828
2773
  _handleMultiDrawingsTransform(e) {
2829
- const { scene: t, unitId: n } = this._context, i = t.getTransformerByCreate();
2774
+ const { scene: t, unitId: n } = this._context, r = t.getTransformerByCreate();
2830
2775
  e.forEach((d) => {
2831
2776
  const a = this._drawingManagerService.getDrawingByParam(d);
2832
2777
  a != null && (a.transform = d.transform, a.transforms = d.transforms, a.isMultiTransform = d.isMultiTransform);
2833
2778
  });
2834
- const s = [...i.getSelectedObjectMap().keys()], c = Object.values(this._drawingManagerService.getDrawingData(n, n)).filter((d) => d.isMultiTransform === oe.TRUE);
2779
+ const s = [...r.getSelectedObjectMap().keys()], c = Object.values(this._drawingManagerService.getDrawingData(n, n)).filter((d) => d.isMultiTransform === oe.TRUE);
2835
2780
  this._drawingManagerService.removeNotification(c), e.length > 0 && this._drawingManagerService.addNotification(e);
2836
2781
  for (const d of s) {
2837
2782
  const a = t.getObject(d);
2838
- a && i.setSelectedControl(a);
2783
+ a && r.setSelectedControl(a);
2839
2784
  }
2840
2785
  }
2841
- _calculateDrawingPosition(e, t, n, i, o, s, c) {
2786
+ _calculateDrawingPosition(e, t, n, r, o, s, c) {
2842
2787
  const { skeDrawings: d } = t;
2843
2788
  this._liquid.translatePagePadding({
2844
2789
  marginTop: s,
2845
2790
  marginLeft: c
2846
2791
  }), d.forEach((a) => {
2847
- const { aLeft: g, aTop: u, height: l, width: h, angle: f, drawingId: m, drawingOrigin: p } = a, v = p.layoutType === F.WRAP_NONE && p.behindDoc === oe.TRUE, { isMultiTransform: D = oe.FALSE } = p, S = {
2792
+ const { aLeft: g, aTop: u, height: l, width: f, angle: h, drawingId: m, drawingOrigin: p } = a, w = p.layoutType === k.WRAP_NONE && p.behindDoc === oe.TRUE, { isMultiTransform: D = oe.FALSE } = p, S = {
2848
2793
  left: g + n + this._liquid.x,
2849
- top: u + i + this._liquid.y,
2850
- width: h,
2794
+ top: u + r + this._liquid.y,
2795
+ width: f,
2851
2796
  height: l,
2852
- angle: f
2797
+ angle: h
2853
2798
  };
2854
2799
  o[m] == null ? o[m] = {
2855
2800
  unitId: e,
2856
2801
  subUnitId: e,
2857
2802
  drawingId: m,
2858
- behindText: v,
2803
+ behindText: w,
2859
2804
  transform: S,
2860
2805
  transforms: [S],
2861
2806
  isMultiTransform: D
@@ -2870,76 +2815,76 @@ let _t = class extends Le {
2870
2815
  const t = this._docSkeletonManagerService.getSkeleton();
2871
2816
  t != null && (this._refreshDrawing(t), this._drawingManagerService.initializeNotification(this._context.unitId));
2872
2817
  };
2873
- this._lifecycleService.stage >= At.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this._lifecycleService.lifecycle$.pipe($t((t) => t === At.Rendered)).subscribe(e);
2818
+ this._lifecycleService.stage >= Rt.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this._lifecycleService.lifecycle$.pipe(Vt((t) => t === Rt.Rendered)).subscribe(e);
2874
2819
  }
2875
2820
  };
2876
- _t = Ei([
2877
- xe(1, Z(te)),
2878
- xe(2, j),
2879
- xe(3, Lr),
2880
- xe(4, pe),
2881
- xe(5, Z(ft)),
2882
- xe(6, z),
2883
- xe(7, Z(Yn))
2884
- ], _t);
2885
- var Ri = Object.defineProperty, Ai = Object.getOwnPropertyDescriptor, Pi = (r, e, t) => e in r ? Ri(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, xi = (r, e, t, n) => {
2886
- for (var i = n > 1 ? void 0 : n ? Ai(e, t) : e, o = r.length - 1, s; o >= 0; o--)
2887
- (s = r[o]) && (i = s(i) || i);
2888
- return i;
2889
- }, It = (r, e) => (t, n) => e(t, n, r), Nn = (r, e, t) => Pi(r, typeof e != "symbol" ? e + "" : e, t);
2890
- const Ni = "DOC_DRAWING_UI_PLUGIN";
2891
- let lt = class extends Jn {
2892
- constructor(r = zt, e, t, n) {
2893
- super(), this._config = r, this._injector = e, this._renderManagerSrv = t, this._configService = n;
2894
- const { ...i } = er(
2821
+ It = mi([
2822
+ Pe(1, Z(te)),
2823
+ Pe(2, j),
2824
+ Pe(3, Cr),
2825
+ Pe(4, fe),
2826
+ Pe(5, Z(ut)),
2827
+ Pe(6, z),
2828
+ Pe(7, Z(jn))
2829
+ ], It);
2830
+ var wi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Ii = (i, e, t) => e in i ? wi(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, _i = (i, e, t, n) => {
2831
+ for (var r = n > 1 ? void 0 : n ? vi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2832
+ (s = i[o]) && (r = s(r) || r);
2833
+ return r;
2834
+ }, vt = (i, e) => (t, n) => e(t, n, i), bn = (i, e, t) => Ii(i, typeof e != "symbol" ? e + "" : e, t);
2835
+ const Si = "DOC_DRAWING_UI_PLUGIN";
2836
+ let gt = class extends zn {
2837
+ constructor(i = $t, e, t, n) {
2838
+ super(), this._config = i, this._injector = e, this._renderManagerSrv = t, this._configService = n;
2839
+ const { ...r } = Xn(
2895
2840
  {},
2896
- zt,
2841
+ $t,
2897
2842
  this._config
2898
2843
  );
2899
- this._configService.setConfig(Vr, i);
2844
+ this._configService.setConfig(Lr, r);
2900
2845
  }
2901
2846
  onStarting() {
2902
2847
  [
2903
- [ot],
2904
- [gt],
2848
+ [it],
2905
2849
  [dt],
2850
+ [ct],
2851
+ [ot],
2852
+ [ut],
2906
2853
  [st],
2907
- [ft],
2908
- [at],
2909
- [ct]
2854
+ [at]
2910
2855
  ].forEach((e) => this._injector.add(e));
2911
2856
  }
2912
2857
  onReady() {
2913
2858
  [
2914
- [it],
2915
- [_t]
2916
- ].forEach((r) => this._renderManagerSrv.registerRenderModule(we.UNIVER_DOC, r)), this._injector.get(st), this._injector.get(ot), this._injector.get(dt), this._injector.get(ct);
2859
+ [rt],
2860
+ [It]
2861
+ ].forEach((i) => this._renderManagerSrv.registerRenderModule(we.UNIVER_DOC, i)), this._injector.get(ot), this._injector.get(it), this._injector.get(ct), this._injector.get(at);
2917
2862
  }
2918
2863
  onRendered() {
2919
- this._injector.get(gt), this._injector.get(at);
2864
+ this._injector.get(dt), this._injector.get(st);
2920
2865
  }
2921
2866
  };
2922
- Nn(lt, "type", we.UNIVER_DOC);
2923
- Nn(lt, "pluginName", Ni);
2924
- lt = xi([
2925
- Zn(fr, ar, tr, Cr),
2926
- It(1, Z(Jt)),
2927
- It(2, Q),
2928
- It(3, Qn)
2929
- ], lt);
2867
+ bn(gt, "type", we.UNIVER_DOC);
2868
+ bn(gt, "pluginName", Si);
2869
+ gt = _i([
2870
+ Vn(sr, er, qn, Sr),
2871
+ vt(1, Z(Qt)),
2872
+ vt(2, Q),
2873
+ vt(3, $n)
2874
+ ], gt);
2930
2875
  export {
2931
- Jr as ClearDocDrawingTransformerOperation,
2932
- An as DOCS_IMAGE_MENU_ID,
2933
- mn as DeleteDocDrawingsCommand,
2934
- at as DocFloatDomController,
2935
- En as EditDocDrawingOperation,
2936
- vn as GroupDocDrawingCommand,
2937
- bt as InsertDocDrawingCommand,
2938
- _n as InsertDocImageCommand,
2939
- Ye as MoveDocDrawingsCommand,
2940
- Mt as RemoveDocDrawingCommand,
2941
- wn as SetDocDrawingArrangeCommand,
2942
- Cn as SidebarDocDrawingOperation,
2943
- In as UngroupDocDrawingCommand,
2944
- lt as UniverDocsDrawingUIPlugin
2876
+ Wr as ClearDocDrawingTransformerOperation,
2877
+ Tn as DOCS_IMAGE_MENU_ID,
2878
+ gn as DeleteDocDrawingsCommand,
2879
+ st as DocFloatDomController,
2880
+ On as EditDocDrawingOperation,
2881
+ ln as GroupDocDrawingCommand,
2882
+ Mt as InsertDocDrawingCommand,
2883
+ fn as InsertDocImageCommand,
2884
+ Ke as MoveDocDrawingsCommand,
2885
+ yt as RemoveDocDrawingCommand,
2886
+ un as SetDocDrawingArrangeCommand,
2887
+ Dn as SidebarDocDrawingOperation,
2888
+ hn as UngroupDocDrawingCommand,
2889
+ gt as UniverDocsDrawingUIPlugin
2945
2890
  };