@univerjs/docs-drawing-ui 0.7.0-beta.0 → 0.7.0-nightly.202504301607

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