@univerjs/slides-ui 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js ADDED
@@ -0,0 +1,2272 @@
1
+ var dn = Object.defineProperty;
2
+ var un = (i, e, t) => e in i ? dn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var I = (i, e, t) => un(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as X, Injector as Ke, IUniverInstanceService as T, RxDisposable as pe, UniverInstanceType as E, debounce as gn, getColorStyle as hn, CommandType as V, Tools as mn, LocaleService as ee, ICommandService as B, generateRandomId as It, BasicShapes as vn, PageElementType as Ge, Disposable as Ve, DisposableCollection as Xe, IContextService as Ce, toDisposable as bt, FOCUSING_COMMON_DRAWINGS as pn, createInternalEditorID as Cn, createIdentifier as Pt, EDITOR_ACTIVATED as xe, FOCUSING_EDITOR_STANDALONE as Et, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Rt, DocumentDataModel as fn, HorizontalAlign as Ot, VerticalAlign as ye, IUndoRedoService as _n, WrapStrategy as nt, FOCUSING_EDITOR_BUT_HIDDEN as Sn, DEFAULT_EMPTY_DOCUMENT_VALUE as In, Direction as L, DocumentFlavor as bn, FOCUSING_UNIVER_EDITOR as xt, FORMULA_EDITOR_ACTIVATED as Pn, Plugin as En, merge as Rn, mergeOverrideWithDependencies as it, IConfigService as On } from "@univerjs/core";
5
+ import { IRenderManagerService as Y, Viewport as rt, ScrollBar as yt, getCurrentTypeOfRenderer as $e, Slide as xn, Rect as Tt, Scene as yn, ObjectType as ge, pxToNum as Tn, DeviceInputEventType as J, convertTextRotation as st, FIX_ONE_PIXEL_BLUR_OFFSET as se, fixLineWidthByScale as ot } from "@univerjs/engine-render";
6
+ import { ObjectProvider as Mn, SLIDE_KEY as oe } from "@univerjs/slides";
7
+ import { useDependency as x, ISidebarService as Mt, ICanvasPopupService as wn, ILayoutService as Nn, KeyCode as M, ILocalFileService as Dn, useObservable as Un, DISABLE_AUTO_FOCUS_KEY as at, getMenuHiddenObservable as fe, MenuItemType as _e, RibbonStartGroup as Vn, MetaKeys as Bn, IMenuManagerService as jn, ComponentManager as Ln, IUIPartsService as An, IShortcutService as $n, BuiltInUIPart as ct, connectInjector as lt } from "@univerjs/ui";
8
+ import { jsxs as R, jsx as u } from "react/jsx-runtime";
9
+ import { clsx as y, Button as be, Dropdown as wt, ColorPicker as Hn, InputNumber as de, Scrollbar as Fn } from "@univerjs/design";
10
+ import Nt, { forwardRef as $, useRef as Dt, createElement as H, useState as G, useEffect as me, useMemo as zn, useCallback as dt } from "react";
11
+ import { BehaviorSubject as Q, Subject as Ut, filter as Wn, takeUntil as ut } from "rxjs";
12
+ import { DocSelectionManagerService as kn, DocSkeletonManagerService as gt, RichTextEditingMutation as Kn } from "@univerjs/docs";
13
+ import { IEditorService as Ye, DocSelectionRenderService as ht, VIEWPORT_KEY as mt, DOCS_COMPONENT_MAIN_LAYER_INDEX as Gn, MoveSelectionOperation as Xn, MoveCursorOperation as Yn, DOCS_VIEW_KEY as Zn, DeleteLeftCommand as qn } from "@univerjs/docs-ui";
14
+ import { DRAWING_IMAGE_ALLOW_IMAGE_LIST as Jn, IImageIoService as Qn, getImageSize as ei } from "@univerjs/drawing";
15
+ var ti = Object.getOwnPropertyDescriptor, ni = (i, e, t, n) => {
16
+ for (var r = n > 1 ? void 0 : n ? ti(e, t) : e, s = i.length - 1, o; s >= 0; s--)
17
+ (o = i[s]) && (r = o(r) || r);
18
+ return r;
19
+ }, Be = (i, e) => (t, n) => e(t, n, i);
20
+ let ve = class extends pe {
21
+ constructor(e, t, n, r) {
22
+ super();
23
+ I(this, "_objectProvider", null);
24
+ I(this, "_refreshThumb", gn(() => {
25
+ this.createThumbs();
26
+ }, 300));
27
+ this._renderContext = e, this._injector = t, this._univerInstanceService = n, this._renderManagerService = r, this._objectProvider = this._injector.createInstance(Mn), this._addNewRender();
28
+ }
29
+ _addNewRender() {
30
+ const { unitId: e, engine: t, scene: n } = this._renderContext, r = this._getCurrUnitModel();
31
+ if (!r) return;
32
+ const s = t.onTransformChange$.subscribeEvent(() => {
33
+ this._scrollToCenter(), s == null || s.unsubscribe();
34
+ });
35
+ t.onTransformChange$.subscribeEvent(() => {
36
+ setTimeout(() => {
37
+ this.createThumbs();
38
+ }, 300);
39
+ });
40
+ const o = new rt(oe.VIEW, n, {
41
+ left: 0,
42
+ top: 0,
43
+ bottom: 0,
44
+ right: 0,
45
+ explicitViewportWidthSet: !1,
46
+ explicitViewportHeightSet: !1,
47
+ isWheelPreventDefaultX: !0
48
+ });
49
+ n.attachControl(), n.onMouseWheel$.subscribeEvent((c, h) => {
50
+ const l = c;
51
+ if (l.ctrlKey) {
52
+ const d = Math.abs(l.deltaX);
53
+ let v = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
54
+ v *= l.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (v /= 2), n.scaleX + v > 4 ? n.scale(4, 4) : n.scaleX + v < 0.1 ? n.scale(0.1, 0.1) : (l.deltaY > 0, l.preventDefault());
55
+ } else
56
+ o.onMouseWheel(l, h);
57
+ }), n.onFileLoaded$.subscribeEvent(() => {
58
+ this._refreshThumb();
59
+ }), yt.attachTo(o);
60
+ const a = this._createSlide(n);
61
+ this._renderContext.mainComponent = a, this._createSlidePages(r, a), this.createThumbs(), t.runRenderLoop(() => {
62
+ n.render();
63
+ });
64
+ }
65
+ _scrollToCenter() {
66
+ var c;
67
+ const e = (c = this._currentRender()) == null ? void 0 : c.scene, t = e == null ? void 0 : e.getViewport(oe.VIEW), n = this._getCenterPositionViewPort(e);
68
+ if (!t || !n) return;
69
+ const { left: r, top: s } = n, { x: o, y: a } = t.transViewportScroll2ScrollValue(r, s);
70
+ t.scrollToBarPos({
71
+ x: o,
72
+ y: a
73
+ });
74
+ }
75
+ _currentRender() {
76
+ return $e(E.UNIVER_SLIDE, this._univerInstanceService, this._renderManagerService);
77
+ }
78
+ /**
79
+ * @param mainScene
80
+ */
81
+ _createSlide(e) {
82
+ const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), { width: n, height: r } = e, s = t.getPageSize(), { width: o = 100, height: a = 100 } = s, c = new xn(oe.COMPONENT, {
83
+ left: (n - o) / 2,
84
+ top: (r - a) / 2,
85
+ width: o,
86
+ height: a,
87
+ zIndex: 10
88
+ });
89
+ return c.enableSelectedClipElement(), e.addObject(c), c;
90
+ }
91
+ _addBackgroundRect(e, t) {
92
+ const r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: o = 0 } = r, a = new Tt("canvas", {
93
+ left: 0,
94
+ top: 0,
95
+ width: s,
96
+ height: o,
97
+ strokeWidth: 1,
98
+ stroke: "rgba(198,198,198,1)",
99
+ fill: hn(t) || "rgba(255,255,255,1)",
100
+ zIndex: 0,
101
+ evented: !1
102
+ });
103
+ e.addObject(a, 0);
104
+ }
105
+ _getCenterPositionViewPort(e) {
106
+ if (!e) return { left: 0, top: 0 };
107
+ const { width: t, height: n } = e, r = e.getEngine(), s = (r == null ? void 0 : r.width) || 0, o = (r == null ? void 0 : r.height) || 0;
108
+ return {
109
+ left: (t - s) / 2,
110
+ top: (n - o) / 2
111
+ };
112
+ }
113
+ _thumbSceneRender(e, t) {
114
+ const n = this._renderManagerService.getRenderById(e);
115
+ if (n == null)
116
+ return;
117
+ const { engine: r } = n;
118
+ if (r == null)
119
+ return;
120
+ const { width: s, height: o } = t, { width: a = s, height: c = o } = r, h = r.getCanvas().getContext();
121
+ t.renderToThumb(h, e, a / s, c / o);
122
+ }
123
+ /**
124
+ * CreateScene by pages, and activate first one.
125
+ * @param slideDataModel
126
+ * @param slide
127
+ */
128
+ _createSlidePages(e, t) {
129
+ const n = e.getPages(), r = e.getPageOrder();
130
+ if (!(!n || !r) && r.length !== 0) {
131
+ for (let s = 0, o = r.length; s < o; s++) {
132
+ const a = r[s];
133
+ this.createPageScene(a, n[a]), this._createThumb(a);
134
+ }
135
+ t.activeFirstPage();
136
+ }
137
+ }
138
+ _createThumb(e) {
139
+ this._renderManagerService.createRender(e);
140
+ }
141
+ /**
142
+ * SlideDataModel is UnitModel
143
+ */
144
+ _getCurrUnitModel() {
145
+ return this._renderContext.unit;
146
+ }
147
+ activePage(e) {
148
+ let t = e;
149
+ const n = this._getCurrUnitModel();
150
+ let r;
151
+ if (t)
152
+ r = n.getPage(t);
153
+ else {
154
+ const c = n.getPages(), h = n.getPageOrder();
155
+ if (h == null || c == null)
156
+ return;
157
+ r = c[h[0]], t = r.id;
158
+ }
159
+ const s = this._currentRender();
160
+ if (r == null || s == null || s.mainComponent == null)
161
+ return;
162
+ const { id: o } = r, a = s.mainComponent;
163
+ if (n.setActivePage(r), a != null && a.hasPage(o)) {
164
+ a.changePage(o);
165
+ return;
166
+ }
167
+ this.createPageScene(o, r);
168
+ }
169
+ createThumbs() {
170
+ const t = this._getCurrUnitModel().getPageOrder(), n = this._currentRender();
171
+ if (!(!t || !n) && t.length !== 0)
172
+ for (let r = 0, s = t.length; r < s; r++) {
173
+ const o = t[r];
174
+ this._thumbSceneRender(o, n.mainComponent);
175
+ }
176
+ }
177
+ /**
178
+ * Create scene by page and set to _sceneMap.
179
+ * @param pageId
180
+ * @param page
181
+ */
182
+ createPageScene(e, t) {
183
+ const n = this._renderContext;
184
+ if (!n || !this._objectProvider)
185
+ return;
186
+ const { scene: r, mainComponent: s } = n, o = s, { width: a, height: c } = o, h = new yn(e, o, {
187
+ width: a,
188
+ height: c
189
+ });
190
+ new rt(`PageViewer_${e}`, h, {
191
+ left: 0,
192
+ top: 0,
193
+ bottom: 0,
194
+ right: 0,
195
+ explicitViewportWidthSet: !1,
196
+ explicitViewportHeightSet: !1
197
+ }).closeClip();
198
+ const { pageElements: d, pageBackgroundFill: v } = t, f = this._objectProvider.convertToRenderObjects(d, r);
199
+ if (!f || !o) return;
200
+ this._addBackgroundRect(h, v), h.addObjects(f), h.initTransformer(), f.forEach((p) => {
201
+ h.attachTransformerTo(p);
202
+ });
203
+ const C = h.getTransformer();
204
+ return C == null || C.changeEnd$.subscribe(() => {
205
+ this._thumbSceneRender(e, o);
206
+ }), C == null || C.clearControl$.subscribe(() => {
207
+ this._thumbSceneRender(e, o);
208
+ }), o.addPageScene(h), h;
209
+ }
210
+ /**
211
+ * Get pageScene from Slide.
212
+ * @param pageId
213
+ * @returns {Scene, Engine, UnitModel} scene & engine & unit from renderContext
214
+ */
215
+ getPageRenderUnit(e) {
216
+ const n = this._renderContext.mainComponent.getSubScenes().get(e), { engine: r, unit: s } = this._renderContext;
217
+ return {
218
+ scene: n,
219
+ engine: r,
220
+ unit: s
221
+ };
222
+ }
223
+ createObjectToPage(e, t) {
224
+ const { scene: n } = this.getPageRenderUnit(t);
225
+ if (!n || !this._objectProvider)
226
+ return;
227
+ const r = this._objectProvider.convertToRenderObject(e, n);
228
+ if (r)
229
+ return n.addObject(r), n.attachTransformerTo(r), n.getLayer().makeDirty(), r;
230
+ }
231
+ setObjectActiveByPage(e, t) {
232
+ const { scene: n } = this.getPageRenderUnit(t);
233
+ if (!n) return;
234
+ const r = n.getTransformer();
235
+ r == null || r.activeAnObject(e);
236
+ }
237
+ removeObjectById(e, t) {
238
+ const { scene: n } = this.getPageRenderUnit(t);
239
+ if (!n) return;
240
+ n.removeObject(e);
241
+ const r = n.getTransformer();
242
+ r == null || r.clearControls();
243
+ }
244
+ appendPage() {
245
+ const e = this._getCurrUnitModel(), t = e.getBlankPage(), n = this._currentRender();
246
+ if (t == null || n == null || n.mainComponent == null)
247
+ return;
248
+ const { id: r } = t, s = n.mainComponent, o = this.createPageScene(r, t);
249
+ s && o && s.addPageScene(o), e.appendPage(t), e.setActivePage(t);
250
+ }
251
+ };
252
+ ve = ni([
253
+ Be(1, X(Ke)),
254
+ Be(2, T),
255
+ Be(3, Y)
256
+ ], ve);
257
+ var ii = Object.getOwnPropertyDescriptor, ri = (i, e, t, n) => {
258
+ for (var r = n > 1 ? void 0 : n ? ii(e, t) : e, s = i.length - 1, o; s >= 0; s--)
259
+ (o = i[s]) && (r = o(r) || r);
260
+ return r;
261
+ }, si = (i, e) => (t, n) => e(t, n, i);
262
+ let N = class extends pe {
263
+ constructor(i) {
264
+ super(), this._renderManagerService = i;
265
+ }
266
+ _getSlideRenderControllerFromRenderUnit(i) {
267
+ return this._renderManagerService.getRenderById(i).with(ve);
268
+ }
269
+ createThumbs(i) {
270
+ this._getSlideRenderControllerFromRenderUnit(i).createThumbs();
271
+ }
272
+ activePage(i, e) {
273
+ this._getSlideRenderControllerFromRenderUnit(e).activePage(i);
274
+ }
275
+ getRenderUnitByPageId(i, e) {
276
+ return this._getSlideRenderControllerFromRenderUnit(e).getPageRenderUnit(i);
277
+ }
278
+ createObjectToPage(i, e, t) {
279
+ return this._getSlideRenderControllerFromRenderUnit(t).createObjectToPage(i, e);
280
+ }
281
+ setObjectActiveByPage(i, e, t) {
282
+ return this._getSlideRenderControllerFromRenderUnit(t).setObjectActiveByPage(i, e);
283
+ }
284
+ removeObjectById(i, e, t) {
285
+ this._getSlideRenderControllerFromRenderUnit(t).removeObjectById(i, e);
286
+ }
287
+ /**
288
+ * append blank page
289
+ */
290
+ appendPage(i) {
291
+ this._getSlideRenderControllerFromRenderUnit(i).appendPage();
292
+ }
293
+ };
294
+ N = ri([
295
+ si(0, Y)
296
+ ], N);
297
+ const oi = "slides-ui.config", vt = {}, Vt = {
298
+ id: "slide.operation.delete-element",
299
+ type: V.OPERATION,
300
+ handler: (i, e) => {
301
+ if (!(e != null && e.id)) return !1;
302
+ const t = e.unitId, r = i.get(T).getUnit(t);
303
+ if (!r) return !1;
304
+ const s = r.getActivePage();
305
+ return delete s.pageElements[e.id], r.updatePage(s.id, s), i.get(N).removeObjectById(e.id, s.id, t), !0;
306
+ }
307
+ };
308
+ var U = function() {
309
+ return U = Object.assign || function(i) {
310
+ for (var e, t = 1, n = arguments.length; t < n; t++) {
311
+ e = arguments[t];
312
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
313
+ }
314
+ return i;
315
+ }, U.apply(this, arguments);
316
+ }, ai = function(i, e) {
317
+ var t = {};
318
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && e.indexOf(n) < 0 && (t[n] = i[n]);
319
+ if (i != null && typeof Object.getOwnPropertySymbols == "function")
320
+ for (var r = 0, n = Object.getOwnPropertySymbols(i); r < n.length; r++)
321
+ e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, n[r]) && (t[n[r]] = i[n[r]]);
322
+ return t;
323
+ }, F = $(function(i, e) {
324
+ var t = i.icon, n = i.id, r = i.className, s = i.extend, o = ai(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), c = Dt("_".concat(di()));
325
+ return Bt(t, "".concat(n), { defIds: t.defIds, idSuffix: c.current }, U({ ref: e, className: a }, o), s);
326
+ });
327
+ function Bt(i, e, t, n, r) {
328
+ return H(i.tag, U(U({ key: e }, ci(i, t, r)), n), (li(i, t).children || []).map(function(s, o) {
329
+ return Bt(s, "".concat(e, "-").concat(i.tag, "-").concat(o), t, void 0, r);
330
+ }));
331
+ }
332
+ function ci(i, e, t) {
333
+ var n = U({}, i.attrs);
334
+ 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) {
335
+ var o = s[0], a = s[1];
336
+ o === "mask" && typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
337
+ });
338
+ var r = e.defIds;
339
+ 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) {
340
+ var o = s[0], a = s[1];
341
+ typeof a == "string" && (n[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
342
+ })), n;
343
+ }
344
+ function li(i, e) {
345
+ var t, n = e.defIds;
346
+ return !n || n.length === 0 ? i : i.tag === "defs" && (!((t = i.children) === null || t === void 0) && t.length) ? U(U({}, i), { children: i.children.map(function(r) {
347
+ return typeof r.attrs.id == "string" && n && n.indexOf(r.attrs.id) > -1 ? U(U({}, r), { attrs: U(U({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
348
+ }) }) : i;
349
+ }
350
+ function di() {
351
+ return Math.random().toString(36).substring(2, 8);
352
+ }
353
+ F.displayName = "UniverIcon";
354
+ var ui = { 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" } }] }, jt = $(function(i, e) {
355
+ return H(F, Object.assign({}, i, {
356
+ id: "add-image-single",
357
+ ref: e,
358
+ icon: ui
359
+ }));
360
+ });
361
+ jt.displayName = "AddImageSingle";
362
+ var gi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Lt = $(function(i, e) {
363
+ return H(F, Object.assign({}, i, {
364
+ id: "autofill",
365
+ ref: e,
366
+ icon: gi
367
+ }));
368
+ });
369
+ Lt.displayName = "Autofill";
370
+ var hi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045zM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544zM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641 9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, At = $(function(i, e) {
371
+ return H(F, Object.assign({}, i, {
372
+ id: "bottom-single",
373
+ ref: e,
374
+ icon: hi
375
+ }));
376
+ });
377
+ At.displayName = "BottomSingle";
378
+ var mi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { clipPath: "url(#graph-single_clip0_1293_28)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M6.29541 11.1896C3.83208 10.7489 1.9624 8.59552 1.9624 6.00544C1.9624 3.09673 4.32036 0.73877 7.22907 0.73877C9.93483 0.73877 12.164 2.77918 12.4619 5.40527H13.5621C14.998 5.40527 16.1621 6.56933 16.1621 8.00527V12.6719C16.1621 14.1079 14.998 15.2719 13.5621 15.2719H8.89541C7.45947 15.2719 6.29541 14.1079 6.29541 12.6719V11.1896ZM3.1624 6.00544C3.1624 3.75947 4.98311 1.93877 7.22907 1.93877C9.27112 1.93877 10.9616 3.44388 11.2518 5.40527H8.89541C7.45947 5.40527 6.29541 6.56933 6.29541 8.00527V9.96442C4.49946 9.5425 3.1624 7.93012 3.1624 6.00544ZM7.49541 8.00527C7.49541 7.23207 8.12221 6.60527 8.89541 6.60527H13.5621C14.3353 6.60527 14.9621 7.23207 14.9621 8.00527V12.6719C14.9621 13.4451 14.3353 14.0719 13.5621 14.0719H8.89541C8.12221 14.0719 7.49541 13.4451 7.49541 12.6719V8.00527Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "graph-single_clip0_1293_28" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.9)" } }] }] }], defIds: ["graph-single_clip0_1293_28"] }, $t = $(function(i, e) {
379
+ return H(F, Object.assign({}, i, {
380
+ id: "graph-single",
381
+ ref: e,
382
+ icon: mi
383
+ }));
384
+ });
385
+ $t.displayName = "GraphSingle";
386
+ var vi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ze = $(function(i, e) {
387
+ return H(F, Object.assign({}, i, {
388
+ id: "more-down-single",
389
+ ref: e,
390
+ icon: vi
391
+ }));
392
+ });
393
+ Ze.displayName = "MoreDownSingle";
394
+ var pi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z" } }] }, Ht = $(function(i, e) {
395
+ return H(F, Object.assign({}, i, {
396
+ id: "move-down-single",
397
+ ref: e,
398
+ icon: pi
399
+ }));
400
+ });
401
+ Ht.displayName = "MoveDownSingle";
402
+ var Ci = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z" } }] }, Ft = $(function(i, e) {
403
+ return H(F, Object.assign({}, i, {
404
+ id: "move-up-single",
405
+ ref: e,
406
+ icon: Ci
407
+ }));
408
+ });
409
+ Ft.displayName = "MoveUpSingle";
410
+ var fi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z" } }, { tag: "path", attrs: { fill: "colorChannel1", d: "M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z" } }] }, zt = $(function(i, e) {
411
+ return H(F, Object.assign({}, i, {
412
+ id: "paint-bucket",
413
+ ref: e,
414
+ icon: fi
415
+ }));
416
+ });
417
+ zt.displayName = "PaintBucket";
418
+ var _i = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z" } }] }, Wt = $(function(i, e) {
419
+ return H(F, Object.assign({}, i, {
420
+ id: "text-single",
421
+ ref: e,
422
+ icon: _i
423
+ }));
424
+ });
425
+ Wt.displayName = "TextSingle";
426
+ var Si = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9 15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9zM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665 15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665zM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, kt = $(function(i, e) {
427
+ return H(F, Object.assign({}, i, {
428
+ id: "topmost-single",
429
+ ref: e,
430
+ icon: Si
431
+ }));
432
+ });
433
+ kt.displayName = "TopmostSingle";
434
+ const k = {
435
+ id: "slide.operation.update-element",
436
+ type: V.OPERATION,
437
+ handler: (i, e) => {
438
+ const { oKey: t, props: n } = e, r = i.get(T), s = e == null ? void 0 : e.unitId, o = r.getUnit(s);
439
+ if (!o) return !1;
440
+ const a = o.getActivePage();
441
+ return a.pageElements[t] = mn.deepMerge(a.pageElements[t], n), o.updatePage(a.id, a), !0;
442
+ }
443
+ }, Ii = "univer-image-common-panel-grid", bi = "univer-image-common-panel-border", Pi = "univer-image-common-panel-title", Ei = "univer-image-common-panel-row", Ri = "univer-image-common-panel-column", Oi = "univer-image-common-panel-inline", xi = "univer-image-common-panel-span2", yi = "univer-image-common-panel-span3", Ti = "univer-image-common-panel-input", g = {
444
+ imageCommonPanelGrid: Ii,
445
+ imageCommonPanelBorder: bi,
446
+ imageCommonPanelTitle: Pi,
447
+ imageCommonPanelRow: Ei,
448
+ imageCommonPanelColumn: Ri,
449
+ imageCommonPanelInline: Oi,
450
+ imageCommonPanelSpan2: xi,
451
+ imageCommonPanelSpan3: yi,
452
+ imageCommonPanelInput: Ti
453
+ };
454
+ function Mi(i) {
455
+ const { pageId: e, unitId: t } = i, n = x(ee), r = x(N), s = x(B), o = r.getRenderUnitByPageId(e, t), a = o == null ? void 0 : o.scene;
456
+ if (!a) return null;
457
+ const c = a.getTransformer();
458
+ if (!c) return null;
459
+ const l = c.getSelectedObjectMap().values().next().value;
460
+ if (!l) return null;
461
+ const d = (v) => {
462
+ const f = a.getAllObjects(), [C, p] = f.reduce(([_, b], P) => {
463
+ const w = P.zIndex, D = w < _ ? w : _, j = w > b ? w : b;
464
+ return [D, j];
465
+ }, [0, 0]);
466
+ let m = l.zIndex;
467
+ v === 3 ? m = C - 1 : v === 2 ? m = p + 1 : v === 0 ? m = l.zIndex + 1 : v === 1 && (m = l.zIndex - 1), l.setProps({
468
+ zIndex: m
469
+ }), s.executeCommand(k.id, {
470
+ unitId: t,
471
+ oKey: l == null ? void 0 : l.oKey,
472
+ props: {
473
+ zIndex: m
474
+ }
475
+ });
476
+ };
477
+ return /* @__PURE__ */ R("div", { className: g.imageCommonPanelGrid, children: [
478
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelTitle), children: /* @__PURE__ */ u("div", { children: n.t("image-panel.arrange.title") }) }) }),
479
+ /* @__PURE__ */ R("div", { className: g.imageCommonPanelRow, children: [
480
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan2), children: /* @__PURE__ */ u(be, { size: "small", onClick: () => {
481
+ d(
482
+ 0
483
+ /* forward */
484
+ );
485
+ }, children: /* @__PURE__ */ R("span", { className: g.imageCommonPanelInline, children: [
486
+ /* @__PURE__ */ u(Ft, {}),
487
+ n.t("image-panel.arrange.forward")
488
+ ] }) }) }),
489
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan2), children: /* @__PURE__ */ u(be, { size: "small", onClick: () => {
490
+ d(
491
+ 1
492
+ /* backward */
493
+ );
494
+ }, children: /* @__PURE__ */ R("span", { className: g.imageCommonPanelInline, children: [
495
+ /* @__PURE__ */ u(Ht, {}),
496
+ n.t("image-panel.arrange.backward")
497
+ ] }) }) })
498
+ ] }),
499
+ /* @__PURE__ */ R("div", { className: g.imageCommonPanelRow, children: [
500
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan2), children: /* @__PURE__ */ u(be, { size: "small", onClick: () => {
501
+ d(
502
+ 2
503
+ /* front */
504
+ );
505
+ }, children: /* @__PURE__ */ R("span", { className: g.imageCommonPanelInline, children: [
506
+ /* @__PURE__ */ u(kt, {}),
507
+ n.t("image-panel.arrange.front")
508
+ ] }) }) }),
509
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan2), children: /* @__PURE__ */ u(be, { size: "small", onClick: () => {
510
+ d(
511
+ 3
512
+ /* back */
513
+ );
514
+ }, children: /* @__PURE__ */ R("span", { className: g.imageCommonPanelInline, children: [
515
+ /* @__PURE__ */ u(At, {}),
516
+ n.t("image-panel.arrange.back")
517
+ ] }) }) })
518
+ ] })
519
+ ] });
520
+ }
521
+ function wi(i) {
522
+ var C, p;
523
+ const { pageId: e, unitId: t } = i, n = x(ee), r = x(N), s = x(B), o = r.getRenderUnitByPageId(e, t), a = o == null ? void 0 : o.scene;
524
+ if (!a) return null;
525
+ const c = a.getTransformer();
526
+ if (!c) return null;
527
+ const l = c.getSelectedObjectMap().values().next().value;
528
+ if (!l) return null;
529
+ const [d, v] = Nt.useState((p = (C = l.fill) == null ? void 0 : C.toString()) != null ? p : "");
530
+ function f(m) {
531
+ l == null || l.setProps({
532
+ fill: m
533
+ }), s.executeCommand(k.id, {
534
+ unitId: t,
535
+ oKey: l == null ? void 0 : l.oKey,
536
+ props: {
537
+ shape: {
538
+ shapeProperties: {
539
+ shapeBackgroundFill: {
540
+ rgb: m
541
+ }
542
+ }
543
+ }
544
+ }
545
+ }), v(m);
546
+ }
547
+ return /* @__PURE__ */ u(
548
+ "div",
549
+ {
550
+ className: y(g.imageCommonPanelGrid, g.imageCommonPanelBorder),
551
+ children: /* @__PURE__ */ R("div", { className: g.imageCommonPanelGrid, children: [
552
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelTitle), children: /* @__PURE__ */ u("div", { children: n.t("slide.panel.fill.title") }) }) }),
553
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan2), children: /* @__PURE__ */ u(
554
+ wt,
555
+ {
556
+ overlay: /* @__PURE__ */ u("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ u(
557
+ Hn,
558
+ {
559
+ value: "#fff",
560
+ onChange: f
561
+ }
562
+ ) }),
563
+ children: /* @__PURE__ */ R("a", { className: g.uiPluginSheetsBorderPanelButton, children: [
564
+ /* @__PURE__ */ u(zt, { extend: { colorChannel1: d != null ? d : "rgb(var(--primary-color))" } }),
565
+ /* @__PURE__ */ u("span", { className: g.uiPluginSheetsBorderPanelMoreIcon, children: /* @__PURE__ */ u(Ze, {}) })
566
+ ] })
567
+ }
568
+ ) }) })
569
+ ] })
570
+ }
571
+ );
572
+ }
573
+ function Ni(i) {
574
+ const { pageId: e, unitId: t } = i, n = x(ee), r = x(N), s = x(B), o = r.getRenderUnitByPageId(e, t), a = o == null ? void 0 : o.scene;
575
+ if (!a) return null;
576
+ const c = a.getTransformer();
577
+ if (!c) return null;
578
+ const l = c.getSelectedObjectMap().values().next().value;
579
+ if (!l) return null;
580
+ const {
581
+ width: d = 0,
582
+ height: v = 0,
583
+ left: f = 0,
584
+ top: C = 0,
585
+ angle: p = 0
586
+ } = l, [m, _] = G(d), [b, P] = G(v), [w, D] = G(f), [j, O] = G(C), [K, ae] = G(p), z = (S) => {
587
+ const { objects: ce } = S, le = ce.values().next().value, {
588
+ width: sn = 0,
589
+ height: on = 0,
590
+ left: an = 0,
591
+ top: cn = 0,
592
+ angle: ln = 0
593
+ } = le;
594
+ _(sn), P(on), D(an), O(cn), ae(ln);
595
+ };
596
+ me(() => {
597
+ const S = c.changeStart$.subscribe((le) => {
598
+ z(le);
599
+ }), ce = c.changing$.subscribe((le) => {
600
+ z(le);
601
+ });
602
+ return () => {
603
+ ce.unsubscribe(), S.unsubscribe();
604
+ };
605
+ }, []);
606
+ function W(S) {
607
+ !S || !l || (s.executeCommand(k.id, {
608
+ pageId: e,
609
+ oKey: l.oKey,
610
+ props: {
611
+ width: S
612
+ }
613
+ }), l == null || l.resize(S, l.height), _(S), c == null || c.refreshControls());
614
+ }
615
+ function te(S) {
616
+ !S || !l || (s.executeCommand(k.id, {
617
+ pageId: e,
618
+ oKey: l.oKey,
619
+ props: {
620
+ height: S
621
+ }
622
+ }), l == null || l.resize(l.width, S), P(S), c == null || c.refreshControls());
623
+ }
624
+ function ne(S) {
625
+ !S || !l || (s.executeCommand(k.id, {
626
+ pageId: e,
627
+ oKey: l.oKey,
628
+ props: {
629
+ left: S
630
+ }
631
+ }), l == null || l.translate(S, l.top), D(S), c == null || c.refreshControls());
632
+ }
633
+ function Se(S) {
634
+ !S || !l || (s.executeCommand(k.id, {
635
+ pageId: e,
636
+ oKey: l.oKey,
637
+ props: {
638
+ right: S
639
+ }
640
+ }), l == null || l.translate(l.left, S), O(S), c == null || c.refreshControls());
641
+ }
642
+ function Ie(S) {
643
+ !S || !l || (s.executeCommand(k.id, {
644
+ pageId: e,
645
+ oKey: l.oKey,
646
+ props: {
647
+ angle: S
648
+ }
649
+ }), l == null || l.transformByState({
650
+ angle: S
651
+ }), ae(S), c == null || c.refreshControls());
652
+ }
653
+ return /* @__PURE__ */ R(
654
+ "div",
655
+ {
656
+ className: y(g.imageCommonPanelGrid, g.imageCommonPanelBorder),
657
+ children: [
658
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelTitle), children: /* @__PURE__ */ u("div", { children: n.t("image-panel.transform.title") }) }) }),
659
+ /* @__PURE__ */ R("div", { className: g.imageCommonPanelRow, children: [
660
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan3), children: /* @__PURE__ */ R("label", { children: [
661
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: n.t("image-panel.transform.width") }) }),
662
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: /* @__PURE__ */ u(
663
+ de,
664
+ {
665
+ className: g.imageCommonPanelInput,
666
+ min: 1,
667
+ value: m,
668
+ onChange: (S) => {
669
+ W(S);
670
+ }
671
+ }
672
+ ) }) })
673
+ ] }) }),
674
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan3), children: /* @__PURE__ */ R("label", { children: [
675
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: n.t("image-panel.transform.height") }) }),
676
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: /* @__PURE__ */ u(
677
+ de,
678
+ {
679
+ className: g.imageCommonPanelInput,
680
+ min: 1,
681
+ value: b,
682
+ onChange: (S) => {
683
+ te(S);
684
+ }
685
+ }
686
+ ) }) })
687
+ ] }) })
688
+ ] }),
689
+ /* @__PURE__ */ R("div", { className: g.imageCommonPanelRow, children: [
690
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan3), children: /* @__PURE__ */ R("label", { children: [
691
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: n.t("image-panel.transform.x") }) }),
692
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: /* @__PURE__ */ u(
693
+ de,
694
+ {
695
+ className: g.imageCommonPanelInput,
696
+ precision: 1,
697
+ min: 0,
698
+ value: w,
699
+ onChange: (S) => {
700
+ ne(S);
701
+ }
702
+ }
703
+ ) }) })
704
+ ] }) }),
705
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan3), children: /* @__PURE__ */ R("label", { children: [
706
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: n.t("image-panel.transform.y") }) }),
707
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: /* @__PURE__ */ u(
708
+ de,
709
+ {
710
+ className: g.imageCommonPanelInput,
711
+ precision: 1,
712
+ min: 0,
713
+ value: j,
714
+ onChange: (S) => {
715
+ Se(S);
716
+ }
717
+ }
718
+ ) }) })
719
+ ] }) }),
720
+ /* @__PURE__ */ u("div", { className: y(g.imageCommonPanelColumn, g.imageCommonPanelSpan3), children: /* @__PURE__ */ R("label", { children: [
721
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: n.t("image-panel.transform.rotate") }) }),
722
+ /* @__PURE__ */ u("div", { className: g.imageCommonPanelRow, children: /* @__PURE__ */ u("div", { className: g.imageCommonPanelColumn, children: /* @__PURE__ */ u(
723
+ de,
724
+ {
725
+ className: g.imageCommonPanelInput,
726
+ precision: 1,
727
+ value: K,
728
+ onChange: Ie
729
+ }
730
+ ) }) })
731
+ ] }) })
732
+ ] })
733
+ ]
734
+ }
735
+ );
736
+ }
737
+ const Di = "univer-image-common-panel", Ui = {
738
+ imageCommonPanel: Di
739
+ }, Oe = "COMPONENT_SLIDE_SIDEBAR";
740
+ function Vi() {
741
+ var h, l, d;
742
+ const i = x(T), e = x(N), t = i.getCurrentUnitForType(E.UNIVER_SLIDE), n = (h = t == null ? void 0 : t.getActivePage()) == null ? void 0 : h.id;
743
+ if (!n) return null;
744
+ const s = (l = e.getRenderUnitByPageId(n, n).scene) == null ? void 0 : l.getTransformer();
745
+ if (!s) return null;
746
+ const a = s.getSelectedObjectMap().values().next().value;
747
+ if (!a)
748
+ return null;
749
+ const c = ((d = i.getFocusedUnit()) == null ? void 0 : d.getUnitId()) || "";
750
+ return /* @__PURE__ */ R("section", { className: Ui.imageCommonPanel, children: [
751
+ /* @__PURE__ */ u(Mi, { pageId: n, unitId: c }),
752
+ /* @__PURE__ */ u(Ni, { pageId: n, unitId: c }),
753
+ a.objectType === ge.RECT && /* @__PURE__ */ u(wi, { pageId: n, unitId: c })
754
+ ] });
755
+ }
756
+ const qe = {
757
+ id: "slide.command.insert-float-shape",
758
+ type: V.COMMAND,
759
+ handler: async (i) => {
760
+ var r;
761
+ const e = i.get(B), n = (r = i.get(T).getFocusedUnit()) == null ? void 0 : r.getUnitId();
762
+ return e.executeCommand(Kt.id, { unitId: n });
763
+ }
764
+ }, Kt = {
765
+ id: "slide.operation.insert-float-shape",
766
+ type: V.OPERATION,
767
+ handler: async (i, e) => {
768
+ const t = It(6), n = i.get(T), r = e.unitId, s = n.getUnit(r);
769
+ if (!s) return !1;
770
+ const o = s.getActivePage(), a = Object.values(o.pageElements), c = a != null && a.length ? Math.max(...a.map((v) => v.zIndex)) : 20, h = {
771
+ id: t,
772
+ zIndex: c + 1,
773
+ left: 378,
774
+ top: 142,
775
+ width: 250,
776
+ height: 250,
777
+ title: t,
778
+ description: "",
779
+ type: Ge.SHAPE,
780
+ shape: {
781
+ shapeType: vn.Rect,
782
+ text: "",
783
+ shapeProperties: {
784
+ shapeBackgroundFill: {
785
+ rgb: "rgb(0,0,255)"
786
+ }
787
+ }
788
+ }
789
+ };
790
+ o.pageElements[t] = h, s.updatePage(o.id, o);
791
+ const l = i.get(N), d = l.createObjectToPage(h, o.id, r);
792
+ return d && l.setObjectActiveByPage(d, o.id, r), !0;
793
+ }
794
+ }, He = {
795
+ id: "sidebar.operation.slide-shape",
796
+ type: V.COMMAND,
797
+ handler: async (i, e) => {
798
+ const { visible: t, objectType: n } = e, r = i.get(Mt), s = i.get(ee);
799
+ let o = "", a = "";
800
+ return n === ge.RECT ? (o = "slide.sidebar.shape", a = Oe) : n === ge.IMAGE ? (o = "slide.sidebar.image", a = Oe) : n === ge.RICH_TEXT && (o = "slide.sidebar.text", a = Oe), t ? r.open({
801
+ header: { title: s.t(o) },
802
+ children: { label: a },
803
+ onClose: () => {
804
+ },
805
+ width: 360
806
+ }) : r.close(), !0;
807
+ }
808
+ }, Gt = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
809
+ var Bi = Object.getOwnPropertyDescriptor, ji = (i, e, t, n) => {
810
+ for (var r = n > 1 ? void 0 : n ? Bi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
811
+ (o = i[s]) && (r = o(r) || r);
812
+ return r;
813
+ }, Pe = (i, e) => (t, n) => e(t, n, i);
814
+ function Li(i, e) {
815
+ const t = pt(i.left, i.top, e), n = pt(i.right, i.bottom, e);
816
+ return {
817
+ left: t.x,
818
+ top: t.y,
819
+ right: n.x,
820
+ bottom: n.y
821
+ };
822
+ }
823
+ function pt(i, e, t) {
824
+ const { scaleX: n, scaleY: r } = t.getAncestorScale(), s = t.getViewport(oe.VIEW);
825
+ if (!s)
826
+ return {
827
+ x: i,
828
+ y: e
829
+ };
830
+ const { viewportScrollX: o, viewportScrollY: a } = s, c = (i - o) * n, h = (e - a) * r;
831
+ return {
832
+ x: c,
833
+ y: h
834
+ };
835
+ }
836
+ let Te = class extends Ve {
837
+ constructor(i, e, t, n) {
838
+ super(), this._globalPopupManagerService = i, this._renderManagerService = e, this._univerInstanceService = t, this._commandService = n;
839
+ }
840
+ _createObjectPositionObserver(i, e) {
841
+ const n = (() => {
842
+ var z, W, te, ne;
843
+ const { scene: o, engine: a } = e, { left: c, top: h, width: l, height: d } = i, v = (o.width - ((W = (z = e.mainComponent) == null ? void 0 : z.width) != null ? W : 0)) / 2, f = (o.height - ((ne = (te = e.mainComponent) == null ? void 0 : te.height) != null ? ne : 0)) / 2, C = {
844
+ left: c,
845
+ right: c + l,
846
+ top: h,
847
+ bottom: h + d
848
+ }, p = a.getCanvasElement(), m = p.getBoundingClientRect(), _ = Tn(p.style.width), { scaleX: b, scaleY: P } = o.getAncestorScale(), w = Li(C, o), { top: D, left: j, width: O } = m, K = O / _;
849
+ return {
850
+ left: w.left * K * b + j + v,
851
+ right: w.right * K * b + j + v,
852
+ top: w.top * K * P + D + f,
853
+ bottom: w.bottom * K * P + D + f
854
+ };
855
+ })(), r = new Q(n), s = new Xe();
856
+ return {
857
+ position: n,
858
+ position$: r,
859
+ disposable: s
860
+ };
861
+ }
862
+ attachPopupToObject(i, e) {
863
+ const n = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getUnitId(), r = this._renderManagerService.getRenderById(n);
864
+ if (!r)
865
+ return {
866
+ dispose: () => {
867
+ }
868
+ };
869
+ const { position: s, position$: o, disposable: a } = this._createObjectPositionObserver(i, r), c = this._globalPopupManagerService.addPopup({
870
+ ...e,
871
+ unitId: n,
872
+ subUnitId: "default",
873
+ anchorRect: s,
874
+ anchorRect$: o,
875
+ canvasElement: r.engine.getCanvasElement()
876
+ });
877
+ return {
878
+ dispose: () => {
879
+ this._globalPopupManagerService.removePopup(c), o.complete(), a.dispose();
880
+ }
881
+ };
882
+ }
883
+ };
884
+ Te = ji([
885
+ Pe(0, X(wn)),
886
+ Pe(1, Y),
887
+ Pe(2, T),
888
+ Pe(3, B)
889
+ ], Te);
890
+ var Ai = Object.getOwnPropertyDescriptor, $i = (i, e, t, n) => {
891
+ for (var r = n > 1 ? void 0 : n ? Ai(e, t) : e, s = i.length - 1, o; s >= 0; s--)
892
+ (o = i[s]) && (r = o(r) || r);
893
+ return r;
894
+ }, q = (i, e) => (t, n) => e(t, n, i);
895
+ let Me = class extends pe {
896
+ constructor(e, t, n, r, s, o, a) {
897
+ super();
898
+ I(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
899
+ this._canvasPopManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._contextService = r, this._canvasView = s, this._sidebarService = o, this._commandService = a, this._init();
900
+ }
901
+ _init() {
902
+ this._univerInstanceService.getAllUnitsForType(E.UNIVER_SLIDE).forEach((e) => this._create(e));
903
+ }
904
+ _create(e) {
905
+ if (!e)
906
+ return;
907
+ const t = e.getUnitId();
908
+ this._renderManagerService.has(t) && !this._initImagePopupMenu.has(t) && (this._popupMenuListener(t), this._initImagePopupMenu.add(t));
909
+ }
910
+ _hasCropObject(e) {
911
+ }
912
+ // eslint-disable-next-line max-lines-per-function
913
+ _popupMenuListener(e) {
914
+ var r;
915
+ const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), n = (r = t == null ? void 0 : t.getPages()) != null ? r : {};
916
+ Object.keys(n).forEach((s) => {
917
+ var h;
918
+ const a = (h = this._canvasView.getRenderUnitByPageId(s, e).scene) == null ? void 0 : h.getTransformer();
919
+ if (!a) return;
920
+ let c;
921
+ this.disposeWithMe(
922
+ bt(
923
+ a.createControl$.subscribe(() => {
924
+ const l = a.getSelectedObjectMap();
925
+ if (l.size > 1) {
926
+ c == null || c.dispose();
927
+ return;
928
+ }
929
+ const d = l.values().next().value;
930
+ if (!d)
931
+ return;
932
+ const v = d.oKey;
933
+ c == null || c.dispose(), c = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(d, {
934
+ componentKey: Gt,
935
+ direction: "horizontal",
936
+ offset: [2, 0],
937
+ extraProps: {
938
+ menuItems: this._getMenuItemsByObjectType(d.objectType, v, e)
939
+ }
940
+ })), this._sidebarService.visible && this._commandService.executeCommand(He.id, {
941
+ visible: !0,
942
+ objectType: d.objectType
943
+ });
944
+ })
945
+ )
946
+ ), this.disposeWithMe(
947
+ a.clearControl$.subscribe(() => {
948
+ c == null || c.dispose(), this._contextService.setContextValue(pn, !1);
949
+ })
950
+ ), this.disposeWithMe(
951
+ a.changing$.subscribe(() => {
952
+ c == null || c.dispose();
953
+ const l = a.getSelectedObjectMap();
954
+ if (l.size > 1) {
955
+ c == null || c.dispose();
956
+ return;
957
+ }
958
+ const d = l.values().next().value;
959
+ d && this._commandService.executeCommand(k.id, {
960
+ unitId: e,
961
+ oKey: d.oKey,
962
+ props: {
963
+ width: d.width,
964
+ height: d.height,
965
+ left: d.left,
966
+ top: d.top
967
+ }
968
+ });
969
+ })
970
+ );
971
+ });
972
+ }
973
+ _getMenuItemsByObjectType(e, t, n) {
974
+ return [{
975
+ label: "slide.popup.edit",
976
+ index: 0,
977
+ commandId: He.id,
978
+ commandParams: {
979
+ visible: !0,
980
+ objectType: e
981
+ },
982
+ disable: !1
983
+ }, {
984
+ label: "slide.popup.delete",
985
+ index: 5,
986
+ commandId: Vt.id,
987
+ commandParams: {
988
+ id: t,
989
+ unitId: n
990
+ },
991
+ disable: !1
992
+ }];
993
+ }
994
+ };
995
+ Me = $i([
996
+ q(0, X(Te)),
997
+ q(1, Y),
998
+ q(2, T),
999
+ q(3, Ce),
1000
+ q(4, X(N)),
1001
+ q(5, Mt),
1002
+ q(6, B)
1003
+ ], Me);
1004
+ const we = {
1005
+ id: "slide.operation.edit-arrow",
1006
+ type: V.OPERATION,
1007
+ handler: () => !0
1008
+ }, he = Cn("SLIDE_EDITOR");
1009
+ var Hi = Object.getOwnPropertyDescriptor, Fi = (i, e, t, n) => {
1010
+ for (var r = n > 1 ? void 0 : n ? Hi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1011
+ (o = i[s]) && (r = o(r) || r);
1012
+ return r;
1013
+ }, je = (i, e) => (t, n) => e(t, n, i);
1014
+ const Je = Pt("univer.slide-editor-bridge.service");
1015
+ let Fe = class extends Ve {
1016
+ constructor(e, t, n) {
1017
+ super();
1018
+ I(this, "_editorUnitId", he);
1019
+ I(this, "_isForceKeepVisible", !1);
1020
+ I(this, "_editorIsDirty", !1);
1021
+ I(this, "_currentEditRectState", null);
1022
+ I(this, "_currentEditRectState$", new Q(null));
1023
+ I(this, "currentEditRectState$", this._currentEditRectState$.asObservable());
1024
+ I(this, "_visibleParam", {
1025
+ visible: !1,
1026
+ eventType: J.Dblclick,
1027
+ unitId: ""
1028
+ });
1029
+ I(this, "_visible$", new Q(this._visibleParam));
1030
+ I(this, "visible$", this._visible$.asObservable());
1031
+ I(this, "_afterVisible$", new Q(this._visibleParam));
1032
+ I(this, "afterVisible$", this._afterVisible$.asObservable());
1033
+ I(this, "endEditing$", new Ut());
1034
+ I(this, "_currentEditRectInfo");
1035
+ this._editorService = e, this._contextService = t, this._renderManagerService = n;
1036
+ }
1037
+ dispose() {
1038
+ super.dispose();
1039
+ }
1040
+ getEditorRect() {
1041
+ return this._currentEditRectInfo;
1042
+ }
1043
+ /**
1044
+ * 1st part of startEditing.
1045
+ * @editorInfo editorInfo
1046
+ */
1047
+ setEditorRect(e) {
1048
+ this._currentEditRectInfo = e, this._editorService.getFocusEditor() || (this._editorService.focus(he), this._contextService.setContextValue(xe, !1), this._contextService.setContextValue(Et, !1), this._contextService.setContextValue(Rt, !1));
1049
+ const t = this.getEditRectState();
1050
+ this._currentEditRectState = t, this._currentEditRectState$.next(t);
1051
+ }
1052
+ changeVisible(e) {
1053
+ this._visibleParam = e, e.visible && (this._editorIsDirty = !1), this._visible$.next(this._visibleParam), this._afterVisible$.next(this._visibleParam);
1054
+ }
1055
+ /**
1056
+ * get info from _currentEditRectInfo
1057
+ *
1058
+ * invoked by slide-editing.render-controller.ts@_handleEditorVisible
1059
+ * && this@setEditorRect
1060
+ */
1061
+ getEditRectState() {
1062
+ const e = he, t = this._currentEditRectInfo, n = t.unitId, r = t.richTextObj.documentData;
1063
+ r.id = e, r.documentStyle = {
1064
+ ...r.documentStyle,
1065
+ pageSize: { width: t.richTextObj.width, height: 1 / 0 }
1066
+ };
1067
+ const o = {
1068
+ documentModel: new fn(r),
1069
+ fontString: "document",
1070
+ textRotation: { a: 0, v: 0 },
1071
+ wrapStrategy: 0,
1072
+ verticalAlign: ye.TOP,
1073
+ horizontalAlign: Ot.LEFT,
1074
+ paddingData: { t: 0, b: 1, l: 2, r: 2 }
1075
+ }, a = t.richTextObj.width, c = t.richTextObj.height, h = t.richTextObj.left, l = t.richTextObj.top, d = {
1076
+ left: 0,
1077
+ top: 0
1078
+ }, v = this._renderManagerService.getRenderById(n), f = v == null ? void 0 : v.scene, C = f == null ? void 0 : f.getViewport(oe.VIEW), p = f == null ? void 0 : f.getObject(oe.COMPONENT), m = {
1079
+ x: (p == null ? void 0 : p.left) || 0,
1080
+ y: (p == null ? void 0 : p.top) || 0
1081
+ }, _ = (C == null ? void 0 : C.viewportScrollX) || 0, b = (C == null ? void 0 : C.viewportScrollY) || 0;
1082
+ return d.left = m.x - _, d.top = m.y - b, {
1083
+ position: {
1084
+ startX: h,
1085
+ startY: l,
1086
+ endX: h + a,
1087
+ endY: l + c
1088
+ },
1089
+ scaleX: 1,
1090
+ scaleY: 1,
1091
+ slideCardOffset: d,
1092
+ unitId: n,
1093
+ editorUnitId: e,
1094
+ documentLayoutObject: o
1095
+ };
1096
+ }
1097
+ changeEditorDirty(e) {
1098
+ this._editorIsDirty = e;
1099
+ }
1100
+ isVisible() {
1101
+ return this._visibleParam.visible;
1102
+ }
1103
+ getEditorDirty() {
1104
+ return this._editorIsDirty;
1105
+ }
1106
+ getCurrentEditorId() {
1107
+ return this._editorUnitId;
1108
+ }
1109
+ /**
1110
+ * @deprecated
1111
+ */
1112
+ genDocData(e) {
1113
+ const t = this.getCurrentEditorId(), n = e.text, r = e.fs;
1114
+ return {
1115
+ id: t,
1116
+ body: {
1117
+ dataStream: `${n}\r
1118
+ `,
1119
+ textRuns: [{ st: 0, ed: n.length }],
1120
+ paragraphs: [{
1121
+ paragraphStyle: {
1122
+ // no use
1123
+ // textStyle: { fs: 30 },
1124
+ // horizontalAlign: HorizontalAlign.CENTER,
1125
+ // verticalAlign: VerticalAlign.MIDDLE,
1126
+ },
1127
+ startIndex: n.length + 1
1128
+ }],
1129
+ sectionBreaks: [{ startIndex: n.length + 2 }]
1130
+ },
1131
+ documentStyle: {
1132
+ marginBottom: 0,
1133
+ marginLeft: 0,
1134
+ marginRight: 0,
1135
+ marginTop: 0,
1136
+ pageSize: { width: 1 / 0, height: 1 / 0 },
1137
+ textStyle: { fs: r },
1138
+ renderConfig: {
1139
+ // horizontalAlign: HorizontalAlign.CENTER,
1140
+ verticalAlign: ye.MIDDLE,
1141
+ centerAngle: 0,
1142
+ vertexAngle: 0,
1143
+ wrapStrategy: 0
1144
+ }
1145
+ },
1146
+ drawings: {},
1147
+ drawingsOrder: [],
1148
+ settings: { zoomRatio: 1 }
1149
+ };
1150
+ }
1151
+ };
1152
+ Fe = Fi([
1153
+ je(0, Ye),
1154
+ je(1, Ce),
1155
+ je(2, Y)
1156
+ ], Fe);
1157
+ class zi {
1158
+ constructor() {
1159
+ I(this, "_state", null);
1160
+ I(this, "_rect", null);
1161
+ I(this, "_state$", new Q(null));
1162
+ I(this, "state$", this._state$.asObservable());
1163
+ I(this, "_rect$", new Q(null));
1164
+ I(this, "rect$", this._rect$.asObservable());
1165
+ I(this, "_focus", !1);
1166
+ I(this, "_focus$", new Q(this._focus));
1167
+ I(this, "focus$", this._focus$.asObservable());
1168
+ }
1169
+ dispose() {
1170
+ this._state$.complete(), this._state = null, this._rect$.complete(), this._rect = null;
1171
+ }
1172
+ setState(e) {
1173
+ this._state = e, this._refresh(e);
1174
+ }
1175
+ getRect() {
1176
+ return this._rect;
1177
+ }
1178
+ setRect(e) {
1179
+ this._rect = e, this._rect$.next(e);
1180
+ }
1181
+ getState() {
1182
+ return this._state;
1183
+ }
1184
+ setFocus(e = !1) {
1185
+ this._focus = e, this._focus$.next(e);
1186
+ }
1187
+ _refresh(e) {
1188
+ this._state$.next(e);
1189
+ }
1190
+ }
1191
+ const Qe = Pt(
1192
+ "univer.slide-editor-manager.service"
1193
+ );
1194
+ var Z = /* @__PURE__ */ ((i) => (i[i.InitialState = 0] = "InitialState", i[i.StartEditor = 1] = "StartEditor", i[i.CursorChange = 2] = "CursorChange", i))(Z || {}), Wi = Object.getOwnPropertyDescriptor, ki = (i, e, t, n) => {
1195
+ for (var r = n > 1 ? void 0 : n ? Wi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1196
+ (o = i[s]) && (r = o(r) || r);
1197
+ return r;
1198
+ }, A = (i, e) => (t, n) => e(t, n, i);
1199
+ const Ct = -1e3, ft = 5, Ki = 2;
1200
+ let ze = class extends Ve {
1201
+ constructor(e, t, n, r, s, o, a, c, h, l, d, v) {
1202
+ super();
1203
+ /**
1204
+ * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
1205
+ */
1206
+ I(this, "_cursorChange", Z.InitialState);
1207
+ /** If the corresponding unit is active and prepared for editing. */
1208
+ I(this, "_isUnitEditing", !1);
1209
+ I(this, "_d");
1210
+ this._renderContext = e, this._layoutService = t, this._undoRedoService = n, this._contextService = r, this._instanceSrv = s, this._renderManagerService = o, this._editorBridgeService = a, this._cellEditorManagerService = c, this._textSelectionManagerService = h, this._commandService = l, this._localService = d, this._editorService = v, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((f) => {
1211
+ f && f.getUnitId() === this._renderContext.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
1212
+ visible: !1,
1213
+ eventType: J.Keyboard,
1214
+ keycode: M.ESC,
1215
+ unitId: this._renderContext.unitId
1216
+ }), this._isUnitEditing = !1));
1217
+ })), this._initEditorVisibilityListener();
1218
+ }
1219
+ dispose() {
1220
+ super.dispose(), this._disposeCurrent();
1221
+ }
1222
+ _disposeCurrent() {
1223
+ var e;
1224
+ (e = this._d) == null || e.dispose(), this._d = null;
1225
+ }
1226
+ _init() {
1227
+ const e = new Xe();
1228
+ return this._subscribeToCurrentCell(e), this._initialKeyboardListener(e), this._initialCursorSync(e), this._listenEditorFocus(e), this._commandExecutedListener(e), setTimeout(() => {
1229
+ this._cursorStateListener(e);
1230
+ }, 1e3), e;
1231
+ }
1232
+ _initEditorVisibilityListener() {
1233
+ this.disposeWithMe(this._editorBridgeService.visible$.subscribe((e) => {
1234
+ e.visible ? (this._isUnitEditing = !0, this._handleEditorVisible(e)) : this._isUnitEditing && (this._handleEditorInvisible(e), this._isUnitEditing = !1);
1235
+ }));
1236
+ }
1237
+ _listenEditorFocus(e) {
1238
+ const t = this._getEditorObject();
1239
+ t && e.add(t.document.onPointerDown$.subscribeEvent(() => {
1240
+ }));
1241
+ }
1242
+ _getEditorSkeleton(e) {
1243
+ var t;
1244
+ return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(gt).getSkeleton();
1245
+ }
1246
+ _getEditorViewModel(e) {
1247
+ var t;
1248
+ return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(gt).getViewModel();
1249
+ }
1250
+ _initialCursorSync(e) {
1251
+ e.add(this._cellEditorManagerService.focus$.pipe(Wn((t) => !!t)).subscribe(() => {
1252
+ var t;
1253
+ (t = $e(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || t.with(ht).sync();
1254
+ }));
1255
+ }
1256
+ /**
1257
+ * Set editorUnitId to curr doc.
1258
+ * @param d DisposableCollection
1259
+ */
1260
+ _subscribeToCurrentCell(e) {
1261
+ e.add(this._editorBridgeService.currentEditRectState$.subscribe((t) => {
1262
+ var d;
1263
+ if (t == null || this._contextService.getContextValue(Et) || this._contextService.getContextValue(Rt))
1264
+ return;
1265
+ const {
1266
+ position: { startX: n, endX: r },
1267
+ documentLayoutObject: { textRotation: s, wrapStrategy: o, documentModel: a },
1268
+ scaleX: c,
1269
+ editorUnitId: h
1270
+ } = t, { vertexAngle: l } = st(s);
1271
+ a.updateDocumentId(h), o === nt.WRAP && l === 0 && a.updateDocumentDataPageSize((r - n) / c), this._instanceSrv.changeDoc(h, a), this._contextService.setContextValue(Sn, !0), this._textSelectionManagerService.replaceTextRanges([{
1272
+ startOffset: 0,
1273
+ endOffset: 0
1274
+ }]), (d = $e(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || d.with(ht).activate(Ct, Ct);
1275
+ }));
1276
+ }
1277
+ /**
1278
+ * Set size and pos of editing area.
1279
+ * @param positionFromEditRectState
1280
+ * @param canvasOffset
1281
+ * @param documentSkeleton
1282
+ * @param documentLayoutObject
1283
+ * @param scaleX
1284
+ * @param scaleY
1285
+ */
1286
+ _fitTextSize(e, t, n, r, s = 1, o = 1) {
1287
+ const { startX: a, startY: c, endX: h, endY: l } = e, d = r.documentModel;
1288
+ if (d == null)
1289
+ return;
1290
+ const { actualWidth: v, actualHeight: f } = this._predictingSize(
1291
+ e,
1292
+ t,
1293
+ n,
1294
+ r,
1295
+ s,
1296
+ o
1297
+ ), { verticalAlign: C, paddingData: p, fill: m } = r;
1298
+ let _ = h - a, b = l - c;
1299
+ if (_ < v && (_ = v), b < f)
1300
+ b = f, d.updateDocumentDataMargin(p);
1301
+ else {
1302
+ let P = 0;
1303
+ C === ye.MIDDLE ? P = (b - f) / 2 / o : C === ye.TOP ? P = p.t || 0 : P = (b - f) / o - (p.b || 0), P = P < (p.t || 0) ? p.t || 0 : P, d.updateDocumentDataMargin({
1304
+ t: P
1305
+ });
1306
+ }
1307
+ n.calculate(), this._editAreaProcessing(_, b, e, t, m, s, o);
1308
+ }
1309
+ /**
1310
+ * Mainly used to pre-calculate the width of the editor,
1311
+ * to determine whether it needs to be automatically widened.
1312
+ */
1313
+ _predictingSize(e, t, n, r, s = 1, o = 1) {
1314
+ const { startX: a, endX: c } = e, { textRotation: h, wrapStrategy: l } = r, d = r.documentModel, { vertexAngle: v } = st(h), f = document.body.clientWidth;
1315
+ if (l === nt.WRAP && v === 0) {
1316
+ const { actualWidth: m, actualHeight: _ } = n.getActualSize();
1317
+ return {
1318
+ actualWidth: m * s,
1319
+ actualHeight: _ * o
1320
+ };
1321
+ }
1322
+ d == null || d.updateDocumentDataPageSize((f - a - t.left) / s), n.calculate();
1323
+ const C = n.getActualSize();
1324
+ let p = c - a;
1325
+ return p < C.actualWidth * s + ft * s && (p = C.actualWidth * s + ft * s), d == null || d.updateDocumentDataPageSize(p / s), d == null || d.updateDocumentRenderConfig({
1326
+ horizontalAlign: Ot.UNSPECIFIED,
1327
+ cellValueType: void 0
1328
+ }), {
1329
+ actualWidth: p,
1330
+ actualHeight: C.actualHeight * o
1331
+ };
1332
+ }
1333
+ /**
1334
+ * control the size of editing area
1335
+ */
1336
+ // eslint-disable-next-line max-lines-per-function
1337
+ _editAreaProcessing(e, t, n, r, s, o = 1, a = 1) {
1338
+ var S;
1339
+ const c = this._getEditorObject();
1340
+ if (c == null)
1341
+ return;
1342
+ function h(ce) {
1343
+ return Number.parseInt(ce.replace("px", ""));
1344
+ }
1345
+ const d = this._renderContext.engine.getCanvasElement(), v = d.getBoundingClientRect(), f = h(d.style.width), { top: C, left: p, width: m } = v, _ = m / f;
1346
+ let { startX: b, startY: P } = n;
1347
+ b += r.left, P += r.top;
1348
+ const { document: w, scene: D, engine: j } = c, O = D.getViewport(mt.VIEW_MAIN), K = document.body.clientHeight - P - r.top - Ki * 2, ae = document.body.clientWidth - b - r.left;
1349
+ let z = t, W = O == null ? void 0 : O.getScrollBar();
1350
+ z > K ? (z = K, W == null ? O && new yt(O, { enableHorizontal: !1, barSize: 8 }) : O == null || O.resetCanvasSizeAndUpdateScroll()) : (W = null, (S = O == null ? void 0 : O.getScrollBar()) == null || S.dispose()), e += (W == null ? void 0 : W.barSize) || 0, e = Math.min(e, ae), b -= se, P -= se, this._addBackground(D, e / o, t / a, s);
1351
+ const { scaleX: te, scaleY: ne } = D.getPrecisionScale();
1352
+ D.transformByState({
1353
+ width: e * _ / o,
1354
+ height: t * _ / a,
1355
+ scaleX: o * _,
1356
+ scaleY: a * _
1357
+ }), w.resize(e / o, t / a), setTimeout(() => {
1358
+ j.resizeBySize(
1359
+ ot(e, te),
1360
+ ot(z, ne)
1361
+ );
1362
+ }, 0);
1363
+ const Se = this._layoutService.getContentElement().getBoundingClientRect(), Ie = d.getBoundingClientRect();
1364
+ b = b * _ + (Ie.left - Se.left), P = P * _ + (Ie.top - Se.top), this._cellEditorManagerService.setState({
1365
+ startX: b,
1366
+ startY: P,
1367
+ endX: e * _ + b,
1368
+ endY: z * _ + P,
1369
+ show: !0
1370
+ });
1371
+ }
1372
+ /**
1373
+ * Since the document does not support cell background color, an additional rect needs to be added.
1374
+ */
1375
+ _addBackground(e, t, n, r) {
1376
+ const s = "_backgroundRectHelperColor_", o = e.getObject(s);
1377
+ o == null && r == null || (o == null ? e.addObjects(
1378
+ [
1379
+ new Tt(s, {
1380
+ width: t,
1381
+ height: n,
1382
+ fill: r,
1383
+ evented: !1
1384
+ })
1385
+ ],
1386
+ Gn
1387
+ ) : r == null ? o.dispose() : (o.setProps({
1388
+ fill: r
1389
+ }), o.transformByState({
1390
+ width: t,
1391
+ height: n
1392
+ })));
1393
+ }
1394
+ /**
1395
+ * Show input area, resize input area and then place input to right place.
1396
+ * @TODO why do resize in show input area?
1397
+ * @param param
1398
+ */
1399
+ // handleVisible is the 2nd part of editing.
1400
+ // first part: startEditing --> _updateEditor
1401
+ // 2nd part: startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
1402
+ _handleEditorVisible(e) {
1403
+ var m, _;
1404
+ const { eventType: t } = e;
1405
+ this._cursorChange = [J.PointerDown, J.Dblclick].includes(t) ? Z.CursorChange : Z.StartEditor;
1406
+ const n = this._editorBridgeService.getEditRectState();
1407
+ if (n == null)
1408
+ return;
1409
+ const {
1410
+ position: r,
1411
+ documentLayoutObject: s,
1412
+ slideCardOffset: o,
1413
+ scaleX: a,
1414
+ scaleY: c,
1415
+ editorUnitId: h,
1416
+ unitId: l
1417
+ } = n, d = this._getEditorObject();
1418
+ if (d == null)
1419
+ return;
1420
+ const { scene: v } = d;
1421
+ this._contextService.setContextValue(xe, !0);
1422
+ const { documentModel: f } = s, C = this._getEditorSkeleton(h);
1423
+ if (!C || !f)
1424
+ return;
1425
+ this._fitTextSize(r, o, C, s, a, c);
1426
+ const p = f.getBody().dataStream.length - 2 || 0;
1427
+ (m = v.getViewport(mt.VIEW_MAIN)) == null || m.scrollToViewportPos({
1428
+ viewportScrollX: Number.POSITIVE_INFINITY
1429
+ }), this._textSelectionManagerService.replaceTextRanges([
1430
+ {
1431
+ startOffset: p,
1432
+ endOffset: p
1433
+ }
1434
+ ]), (_ = this._renderManagerService.getRenderById(l)) == null || _.scene.resetCursor();
1435
+ }
1436
+ _resetBodyStyle(e, t = !1) {
1437
+ e.dataStream = In, e.textRuns != null && (e.textRuns.length === 1 && !t ? (e.textRuns[0].st = 0, e.textRuns[0].ed = 1) : e.textRuns = void 0), e.paragraphs != null && (e.paragraphs.length === 1 ? e.paragraphs[0].startIndex = 0 : e.paragraphs = [
1438
+ {
1439
+ startIndex: 0
1440
+ }
1441
+ ]), e.sectionBreaks != null && (e.sectionBreaks = void 0), e.tables != null && (e.tables = void 0), e.customRanges != null && (e.customRanges = void 0), e.customBlocks != null && (e.customBlocks = void 0);
1442
+ }
1443
+ /**
1444
+ * Should activate the editor when the user inputs text.
1445
+ * @param d DisposableCollection
1446
+ */
1447
+ _initialKeyboardListener(e) {
1448
+ }
1449
+ _showEditorByKeyboard(e) {
1450
+ }
1451
+ _commandExecutedListener(e) {
1452
+ const t = [we.id], n = [Kn.id];
1453
+ e.add(this._commandService.onCommandExecuted((r) => {
1454
+ this._editorService.getFocusId() === he && (t.includes(r.id) && this._moveCursorCmdHandler(r), n.includes(r.id) && this._editorBridgeService.isVisible() && this._editingChangedHandler());
1455
+ }));
1456
+ }
1457
+ _moveCursorCmdHandler(e) {
1458
+ const t = e.params, { keycode: n, isShift: r } = t;
1459
+ n != null && this._cursorChange === Z.CursorChange ? this._moveInEditor(n, r) : this._editorBridgeService.changeVisible(t);
1460
+ }
1461
+ _editingChangedHandler() {
1462
+ const e = this._editorBridgeService.getEditorRect();
1463
+ if (!e)
1464
+ return;
1465
+ const t = e.richTextObj;
1466
+ t.refreshDocumentByDocData(), t.resizeToContentSize();
1467
+ const { unitId: n } = this._renderContext;
1468
+ this._handleEditorVisible({ visible: !0, eventType: 3, unitId: n });
1469
+ }
1470
+ _getEditorObject() {
1471
+ return Gi(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
1472
+ }
1473
+ async _handleEditorInvisible(e) {
1474
+ const { keycode: t } = e;
1475
+ if (this._cursorChange = Z.InitialState, this._exitInput(e), this._editorBridgeService.getEditRectState() == null)
1476
+ return;
1477
+ if (this._editorBridgeService.getEditorDirty() === !1) {
1478
+ this._moveCursor(t);
1479
+ return;
1480
+ }
1481
+ this._moveCursor(t);
1482
+ }
1483
+ _exitInput(e) {
1484
+ this._contextService.setContextValue(xe, !1), this._cellEditorManagerService.setState({
1485
+ show: e.visible
1486
+ });
1487
+ const t = this._editorBridgeService.getCurrentEditorId();
1488
+ t != null && this._undoRedoService.clearUndoRedo(t);
1489
+ }
1490
+ _moveCursor(e) {
1491
+ if (e != null)
1492
+ switch (L.LEFT, e) {
1493
+ case M.ENTER:
1494
+ L.DOWN;
1495
+ break;
1496
+ case M.TAB:
1497
+ L.RIGHT;
1498
+ break;
1499
+ case M.ARROW_DOWN:
1500
+ L.DOWN;
1501
+ break;
1502
+ case M.ARROW_UP:
1503
+ L.UP;
1504
+ break;
1505
+ case M.ARROW_LEFT:
1506
+ L.LEFT;
1507
+ break;
1508
+ case M.ARROW_RIGHT:
1509
+ L.RIGHT;
1510
+ break;
1511
+ }
1512
+ }
1513
+ /**
1514
+ * The user's operations follow the sequence of opening the editor and then moving the cursor.
1515
+ * The logic here predicts the user's first cursor movement behavior based on this rule
1516
+ */
1517
+ _cursorStateListener(e) {
1518
+ const t = this._getEditorObject();
1519
+ if (!t)
1520
+ return;
1521
+ const { document: n } = t;
1522
+ e.add(bt(n.onPointerDown$.subscribeEvent(() => {
1523
+ this._cursorChange === Z.StartEditor && (this._cursorChange = Z.CursorChange);
1524
+ })));
1525
+ }
1526
+ // TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
1527
+ _moveInEditor(e, t) {
1528
+ let n = L.LEFT;
1529
+ e === M.ARROW_DOWN ? n = L.DOWN : e === M.ARROW_UP ? n = L.UP : e === M.ARROW_RIGHT && (n = L.RIGHT), t ? this._commandService.executeCommand(Xn.id, {
1530
+ direction: n
1531
+ }) : this._commandService.executeCommand(Yn.id, {
1532
+ direction: n
1533
+ });
1534
+ }
1535
+ };
1536
+ ze = ki([
1537
+ A(1, Nn),
1538
+ A(2, _n),
1539
+ A(3, Ce),
1540
+ A(4, T),
1541
+ A(5, Y),
1542
+ A(6, Je),
1543
+ A(7, Qe),
1544
+ A(8, X(kn)),
1545
+ A(9, B),
1546
+ A(10, X(ee)),
1547
+ A(11, Ye)
1548
+ ], ze);
1549
+ function Gi(i, e) {
1550
+ if (i == null)
1551
+ return;
1552
+ const t = e.getRenderById(i);
1553
+ if (t == null)
1554
+ return;
1555
+ const { mainComponent: n, scene: r, engine: s, components: o } = t, a = n, c = o.get(Zn.BACKGROUND);
1556
+ return {
1557
+ document: a,
1558
+ docBackground: c,
1559
+ scene: r,
1560
+ engine: s
1561
+ };
1562
+ }
1563
+ var Xi = Object.getOwnPropertyDescriptor, Yi = (i, e, t, n) => {
1564
+ for (var r = n > 1 ? void 0 : n ? Xi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1565
+ (o = i[s]) && (r = o(r) || r);
1566
+ return r;
1567
+ }, Le = (i, e) => (t, n) => e(t, n, i);
1568
+ let We = class extends pe {
1569
+ constructor(e, t, n, r) {
1570
+ super();
1571
+ /**
1572
+ * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
1573
+ */
1574
+ // private _cursorChange: CursorChange = CursorChange.InitialState;
1575
+ /** If the corresponding unit is active and prepared for editing. */
1576
+ // private _isUnitEditing = false;
1577
+ I(this, "setSlideTextEditor$", new Ut());
1578
+ I(this, "_curRichText", null);
1579
+ I(this, "_d");
1580
+ this._renderContext = e, this._instanceSrv = t, this._commandService = n, this._editorBridgeService = r, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((s) => {
1581
+ s && s.getUnitId() === this._renderContext.unitId ? this._d = this._init() : this._disposeCurrent();
1582
+ }));
1583
+ }
1584
+ _init() {
1585
+ const e = new Xe();
1586
+ return this._initEventListener(e), e;
1587
+ }
1588
+ _disposeCurrent() {
1589
+ var e;
1590
+ (e = this._d) == null || e.dispose(), this._d = null;
1591
+ }
1592
+ _setEditorRect(e, t) {
1593
+ this._curRichText = t;
1594
+ const { scene: n, engine: r } = this._renderContext, s = this._renderContext.unitId, o = {
1595
+ scene: n,
1596
+ engine: r,
1597
+ unitId: s,
1598
+ pageId: e,
1599
+ richTextObj: t
1600
+ };
1601
+ this._editorBridgeService.setEditorRect(o);
1602
+ }
1603
+ _initEventListener(e) {
1604
+ const t = (o) => {
1605
+ const a = o.getTransformer();
1606
+ a && (e.add(a.clearControl$.subscribe(() => {
1607
+ this.setEditorVisible(!1), this.pickOtherObjects();
1608
+ })), e.add(a.createControl$.subscribe(() => {
1609
+ this.setEditorVisible(!1);
1610
+ })), e.add(o.onDblclick$.subscribeEvent(() => {
1611
+ a.clearControls();
1612
+ const h = a.getSelectedObjectMap().values().next().value;
1613
+ h && (h.objectType !== ge.RICH_TEXT ? this.pickOtherObjects() : this.startEditing(o.sceneKey, h));
1614
+ })), e.add(this._instanceSrv.focused$.subscribe((c) => {
1615
+ this.endEditing();
1616
+ })));
1617
+ }, { mainComponent: n } = this._renderContext;
1618
+ n.subSceneChanged$.subscribeEvent((o) => {
1619
+ t(o);
1620
+ });
1621
+ const s = Array.from(n.getSubScenes().values());
1622
+ for (let o = 0; o < s.length; o++) {
1623
+ const a = s[o];
1624
+ t(a);
1625
+ }
1626
+ }
1627
+ pickOtherObjects() {
1628
+ this.endEditing();
1629
+ }
1630
+ /**
1631
+ * invoked when picking other object.
1632
+ *
1633
+ * save editing state to curr richText.
1634
+ */
1635
+ endEditing() {
1636
+ var s;
1637
+ if (!this._curRichText) return;
1638
+ this.setEditorVisible(!1);
1639
+ const e = this._curRichText;
1640
+ if (!this._instanceSrv.getCurrentUnitForType(E.UNIVER_SLIDE)) return !1;
1641
+ e.refreshDocumentByDocData(), e.resizeToContentSize(), this._editorBridgeService.endEditing$.next(e);
1642
+ const n = {
1643
+ bl: 1,
1644
+ fs: e.fs,
1645
+ text: e.text
1646
+ }, r = (s = e.documentData.body) == null ? void 0 : s.textRuns;
1647
+ if (r && r.length) {
1648
+ const a = r[0].ts;
1649
+ n.cl = a == null ? void 0 : a.cl;
1650
+ }
1651
+ this._commandService.executeCommand(k.id, {
1652
+ unitId: this._renderContext.unitId,
1653
+ oKey: e == null ? void 0 : e.oKey,
1654
+ props: {
1655
+ richText: n
1656
+ }
1657
+ }), this._curRichText = null;
1658
+ }
1659
+ /**
1660
+ * TODO calling twice ????
1661
+ * editingParam derives from RichText object.
1662
+ *
1663
+ * TODO @lumixraku need scale param
1664
+ * @param target
1665
+ */
1666
+ startEditing(e, t) {
1667
+ this._setEditorRect(e, t), this.setEditorVisible(!0);
1668
+ }
1669
+ setEditorVisible(e) {
1670
+ var n, r;
1671
+ e ? (n = this._curRichText) == null || n.hide() : (r = this._curRichText) == null || r.show();
1672
+ const { unitId: t } = this._renderContext;
1673
+ this._editorBridgeService.changeVisible({ visible: e, eventType: J.PointerDown, unitId: t });
1674
+ }
1675
+ };
1676
+ We = Yi([
1677
+ Le(1, T),
1678
+ Le(2, B),
1679
+ Le(3, Je)
1680
+ ], We);
1681
+ const Xt = {
1682
+ id: "slide.operation.activate-slide",
1683
+ type: V.OPERATION,
1684
+ handler: (i, e) => {
1685
+ var h, l;
1686
+ const t = e.unitId, n = i.get(N), s = i.get(T).getUnit(t), o = (h = s == null ? void 0 : s.getActivePage()) == null ? void 0 : h.id;
1687
+ if (!o) return !1;
1688
+ const a = n.getRenderUnitByPageId(o, t);
1689
+ if (!a) return !1;
1690
+ const c = (l = a.scene) == null ? void 0 : l.getTransformer();
1691
+ return c && c.clearControls(), n.activePage(e.id, t), !0;
1692
+ }
1693
+ }, Yt = {
1694
+ id: "slide.operation.append-slide",
1695
+ type: V.OPERATION,
1696
+ handler: (i, e) => {
1697
+ const t = e.unitId;
1698
+ return i.get(T).getUnit(t) ? (i.get(N).appendPage(t), !0) : !1;
1699
+ }
1700
+ }, et = {
1701
+ id: "slide.command.insert-float-image",
1702
+ type: V.COMMAND,
1703
+ handler: async (i, e) => {
1704
+ var j;
1705
+ const t = i.get(T), n = (j = t.getCurrentUnitForType(E.UNIVER_SLIDE)) == null ? void 0 : j.getUnitId();
1706
+ if (!n) return !1;
1707
+ const s = await i.get(Dn).openFile({
1708
+ multiple: !0,
1709
+ accept: Jn.map((O) => `.${O.replace("image/", "")}`).join(",")
1710
+ });
1711
+ if (s.length !== 1) return !1;
1712
+ const a = await i.get(Qn).saveImage(s[0]);
1713
+ if (!a) return !1;
1714
+ const { imageId: c, imageSourceType: h, source: l, base64Cache: d } = a, { width: v, height: f, image: C } = await ei(d || ""), p = t.getUnit(n);
1715
+ if (!p) return !1;
1716
+ const m = p.getActivePage(), _ = Object.values(m.pageElements), b = _ != null && _.length ? Math.max(..._.map((O) => O.zIndex)) : 20, P = {
1717
+ id: c,
1718
+ zIndex: b + 1,
1719
+ left: 0,
1720
+ top: 0,
1721
+ width: v,
1722
+ height: f,
1723
+ title: "",
1724
+ description: "",
1725
+ type: Ge.IMAGE,
1726
+ image: {
1727
+ imageProperties: {
1728
+ contentUrl: d,
1729
+ imageSourceType: h,
1730
+ source: l,
1731
+ base64Cache: d,
1732
+ image: C
1733
+ }
1734
+ }
1735
+ };
1736
+ m.pageElements[c] = P, p.updatePage(m.id, m);
1737
+ const w = i.get(N), D = w.createObjectToPage(P, m.id, n);
1738
+ return D && w.setObjectActiveByPage(D, m.id, n), !0;
1739
+ }
1740
+ }, tt = {
1741
+ id: "slide.command.add-text",
1742
+ type: V.COMMAND,
1743
+ handler: async (i) => {
1744
+ var r;
1745
+ const e = i.get(B), n = (r = i.get(T).getFocusedUnit()) == null ? void 0 : r.getUnitId();
1746
+ return await e.executeCommand(Zt.id, { unitId: n });
1747
+ }
1748
+ }, Zt = {
1749
+ id: "slide.operation.add-text",
1750
+ type: V.OPERATION,
1751
+ handler: async (i, e) => {
1752
+ const t = e.unitId, n = It(6), r = 220, s = 40, o = 230, a = 142, c = (e == null ? void 0 : e.text) || "A New Text", l = i.get(T).getUnit(t);
1753
+ if (!l) return !1;
1754
+ const d = l.getActivePage(), v = Object.values(d.pageElements), f = v != null && v.length ? Math.max(...v.map((_) => _.zIndex)) : 21, C = {
1755
+ id: n,
1756
+ zIndex: f + 1,
1757
+ left: o,
1758
+ top: a,
1759
+ width: r,
1760
+ height: s,
1761
+ title: "text",
1762
+ description: "",
1763
+ type: Ge.TEXT,
1764
+ richText: {
1765
+ text: c,
1766
+ fs: 30,
1767
+ cl: {
1768
+ rgb: "rgb(51, 51, 51)"
1769
+ },
1770
+ bl: 1
1771
+ }
1772
+ };
1773
+ d.pageElements[n] = C, l.updatePage(d.id, d);
1774
+ const p = i.get(N), m = p.createObjectToPage(C, d.id, t);
1775
+ return m && p.setObjectActiveByPage(m, d.id, t), !0;
1776
+ }
1777
+ }, qt = {
1778
+ id: "slide.operation.set-slide-page-thumb",
1779
+ type: V.OPERATION,
1780
+ handler: (i, e) => (i.get(N).createThumbs(e.unitId), !0)
1781
+ }, Zi = "univer-image-popup-menu", qi = "univer-image-popup-menu-item", Ji = "univer-image-popup-menu-item-title", Qi = "univer-btn-container", er = "univer-btn-container-expand", ue = {
1782
+ imagePopupMenu: Zi,
1783
+ imagePopupMenuItem: qi,
1784
+ imagePopupMenuItemTitle: Ji,
1785
+ btnContainer: Qi,
1786
+ btnContainerExpand: er
1787
+ };
1788
+ function tr(i) {
1789
+ var C, p;
1790
+ const e = (p = (C = i.popup) == null ? void 0 : C.extraProps) == null ? void 0 : p.menuItems;
1791
+ if (!e)
1792
+ return null;
1793
+ const t = x(B), n = x(ee), [r, s] = G(!1), [o, a] = G(!1), c = () => {
1794
+ a(!0);
1795
+ }, h = () => {
1796
+ a(!1);
1797
+ }, l = (m) => {
1798
+ s(m);
1799
+ }, d = (m) => {
1800
+ t.executeCommand(m.commandId, m.commandParams), s(!1);
1801
+ }, v = r || o, f = e.filter((m) => !m.disable);
1802
+ return /* @__PURE__ */ u(
1803
+ "div",
1804
+ {
1805
+ onMouseEnter: c,
1806
+ onMouseLeave: h,
1807
+ children: /* @__PURE__ */ u(
1808
+ wt,
1809
+ {
1810
+ align: "start",
1811
+ overlay: /* @__PURE__ */ u(
1812
+ "ul",
1813
+ {
1814
+ className: y(ue.imagePopupMenu, `
1815
+ univer-box-border univer-p-2 univer-text-sm univer-theme
1816
+ `),
1817
+ children: f.map((m) => /* @__PURE__ */ u(
1818
+ "li",
1819
+ {
1820
+ onClick: () => d(m),
1821
+ className: ue.imagePopupMenuItem,
1822
+ children: /* @__PURE__ */ u("span", { className: ue.imagePopupMenuItemTitle, children: n.t(m.label) })
1823
+ },
1824
+ m.index
1825
+ ))
1826
+ }
1827
+ ),
1828
+ open: r,
1829
+ onOpenChange: l,
1830
+ children: /* @__PURE__ */ R(
1831
+ "div",
1832
+ {
1833
+ className: y(ue.btnContainer, {
1834
+ [ue.btnContainerExpand]: r
1835
+ }),
1836
+ children: [
1837
+ /* @__PURE__ */ u(
1838
+ Lt,
1839
+ {
1840
+ style: { color: "#35322B" },
1841
+ extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
1842
+ }
1843
+ ),
1844
+ v && /* @__PURE__ */ u(Ze, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
1845
+ ]
1846
+ }
1847
+ )
1848
+ }
1849
+ )
1850
+ }
1851
+ );
1852
+ }
1853
+ const nr = "univer-slide-bar", ir = "univer-slide-bar-content", rr = "univer-slide-bar-content-header", sr = "univer-slide-bar-item", or = "univer-slide-bar-box", ar = "univer-slide-bar-item-active", ie = {
1854
+ slideBar: nr,
1855
+ slideBarContent: ir,
1856
+ slideBarContentHeader: rr,
1857
+ slideBarItem: sr,
1858
+ slideBarBox: or,
1859
+ slideBarItemActive: ar
1860
+ };
1861
+ function cr() {
1862
+ var C, p;
1863
+ const i = x(T), e = x(B), t = x(Y), n = x(ee), r = Dt(null), s = i.getCurrentUnitForType(E.UNIVER_SLIDE), o = s == null ? void 0 : s.getPages(), a = s == null ? void 0 : s.getPageOrder();
1864
+ if (!o || !a)
1865
+ return null;
1866
+ const c = a.map((m) => o[m]), [h, l] = G((p = (C = s == null ? void 0 : s.getActivePage()) == null ? void 0 : C.id) != null ? p : null), d = zn(() => c.map(() => Nt.createRef()), [c]);
1867
+ me(() => {
1868
+ const m = s == null ? void 0 : s.activePage$.subscribe((_) => {
1869
+ var P;
1870
+ const b = (P = _ == null ? void 0 : _.id) != null ? P : null;
1871
+ b && l(b);
1872
+ });
1873
+ return () => {
1874
+ m == null || m.unsubscribe();
1875
+ };
1876
+ }, []), me(() => {
1877
+ d.forEach((m, _) => {
1878
+ var b;
1879
+ if (m.current) {
1880
+ const P = c[_];
1881
+ (b = t.getRenderById(P.id)) == null || b.engine.setContainer(m.current);
1882
+ }
1883
+ }), d.length > 0 && e.syncExecuteCommand(qt.id, { unitId: s == null ? void 0 : s.getUnitId() });
1884
+ }, [d, c, t, e, s]);
1885
+ const v = dt((m) => {
1886
+ e.syncExecuteCommand(Xt.id, { id: m, unitId: s == null ? void 0 : s.getUnitId() });
1887
+ }, [e, s]), f = dt(() => {
1888
+ e.syncExecuteCommand(Yt.id, { unitId: s == null ? void 0 : s.getUnitId() });
1889
+ }, [e, s]);
1890
+ return /* @__PURE__ */ u("aside", { className: ie.slideBar, ref: r, children: /* @__PURE__ */ u(Fn, { children: /* @__PURE__ */ R("div", { className: ie.slideBarContent, children: [
1891
+ /* @__PURE__ */ u("header", { className: ie.slideBarContentHeader, children: /* @__PURE__ */ u("a", { onClick: f, children: n.t("slide.append") }) }),
1892
+ c.map((m, _) => /* @__PURE__ */ R(
1893
+ "div",
1894
+ {
1895
+ className: y(ie.slideBarItem, {
1896
+ [ie.slideBarItemActive]: m.id === h
1897
+ }),
1898
+ onClick: () => v(m.id),
1899
+ children: [
1900
+ /* @__PURE__ */ u("span", { children: _ + 1 }),
1901
+ /* @__PURE__ */ u("div", { ref: d[_], className: ie.slideBarBox })
1902
+ ]
1903
+ },
1904
+ m.id
1905
+ ))
1906
+ ] }) }) });
1907
+ }
1908
+ const lr = "univer-slide-editor-container", dr = {
1909
+ slideEditorContainer: lr
1910
+ }, Ne = -1e3, _t = {
1911
+ width: 0,
1912
+ height: 0,
1913
+ top: Ne,
1914
+ left: Ne
1915
+ }, ur = () => {
1916
+ const [i, e] = G({
1917
+ ..._t
1918
+ }), t = x(Qe), n = x(Ye), r = x(Ce), s = Un(
1919
+ () => r.subscribeContextValue$(at),
1920
+ !1,
1921
+ void 0,
1922
+ [r, at]
1923
+ );
1924
+ return bn.UNSPECIFIED, me(() => {
1925
+ t.state$.subscribe((o) => {
1926
+ if (o == null)
1927
+ return;
1928
+ const {
1929
+ startX: a = Ne,
1930
+ startY: c = Ne,
1931
+ endX: h = 0,
1932
+ endY: l = 0,
1933
+ show: d = !1
1934
+ } = o;
1935
+ if (!d)
1936
+ e({
1937
+ ..._t
1938
+ });
1939
+ else {
1940
+ e({
1941
+ width: h - a - se + 2,
1942
+ height: l - c - se + 2,
1943
+ left: a + se,
1944
+ top: c + se
1945
+ });
1946
+ const v = n.getEditor(he);
1947
+ if (v == null)
1948
+ return;
1949
+ const { left: f, top: C, width: p, height: m } = v.getBoundingClientRect();
1950
+ t.setRect({ left: f, top: C, width: p, height: m });
1951
+ }
1952
+ });
1953
+ }, []), me(() => {
1954
+ s || t.setFocus(!0);
1955
+ }, [s, i]), /* @__PURE__ */ u(
1956
+ "div",
1957
+ {
1958
+ className: dr.slideEditorContainer,
1959
+ style: {
1960
+ left: i.left,
1961
+ top: i.top,
1962
+ width: i.width,
1963
+ height: i.height
1964
+ }
1965
+ }
1966
+ );
1967
+ }, Jt = "addition-and-subtraction-single", Qt = "slide.menu.image";
1968
+ function gr(i) {
1969
+ return {
1970
+ id: Qt,
1971
+ type: _e.SUBITEMS,
1972
+ icon: Jt,
1973
+ tooltip: "slide.image.insert.title",
1974
+ hidden$: fe(i, E.UNIVER_SLIDE)
1975
+ };
1976
+ }
1977
+ function hr(i) {
1978
+ return {
1979
+ id: et.id,
1980
+ title: "slide.image.insert.float",
1981
+ type: _e.BUTTON,
1982
+ hidden$: fe(i, E.UNIVER_SLIDE)
1983
+ };
1984
+ }
1985
+ const en = "graph-single", tn = "slide.menu.shape";
1986
+ function mr(i) {
1987
+ return {
1988
+ id: tn,
1989
+ type: _e.SUBITEMS,
1990
+ icon: en,
1991
+ tooltip: "slide.shape.insert.title",
1992
+ hidden$: fe(i, E.UNIVER_SLIDE)
1993
+ // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
1994
+ };
1995
+ }
1996
+ function vr(i) {
1997
+ return {
1998
+ id: qe.id,
1999
+ title: "slide.shape.insert.rectangle",
2000
+ type: _e.BUTTON,
2001
+ hidden$: fe(i, E.UNIVER_SLIDE)
2002
+ };
2003
+ }
2004
+ const nn = "text-single";
2005
+ function pr(i) {
2006
+ return {
2007
+ id: tt.id,
2008
+ type: _e.BUTTON,
2009
+ icon: nn,
2010
+ tooltip: "slide.text.insert.title",
2011
+ hidden$: fe(i, E.UNIVER_SLIDE)
2012
+ };
2013
+ }
2014
+ const Cr = {
2015
+ [Vn.FORMAT]: {
2016
+ [tt.id]: {
2017
+ order: 0,
2018
+ menuItemFactory: pr
2019
+ },
2020
+ [Qt]: {
2021
+ order: 0,
2022
+ menuItemFactory: gr,
2023
+ [et.id]: {
2024
+ order: 0,
2025
+ menuItemFactory: hr
2026
+ }
2027
+ },
2028
+ [tn]: {
2029
+ order: 0,
2030
+ menuItemFactory: mr,
2031
+ [qe.id]: {
2032
+ order: 0,
2033
+ menuItemFactory: vr
2034
+ }
2035
+ }
2036
+ }
2037
+ };
2038
+ function ke(i) {
2039
+ return i.getContextValue(xt) && i.getContextValue(xe);
2040
+ }
2041
+ function fr(i) {
2042
+ return i.getContextValue(Pn) && i.getContextValue(xt);
2043
+ }
2044
+ const rn = [
2045
+ M.ARROW_DOWN,
2046
+ M.ARROW_UP,
2047
+ M.ARROW_LEFT,
2048
+ M.ARROW_RIGHT
2049
+ ];
2050
+ [M.ENTER, M.TAB, ...rn];
2051
+ function _r() {
2052
+ const i = [];
2053
+ for (const e of rn)
2054
+ i.push({
2055
+ id: we.id,
2056
+ binding: e,
2057
+ preconditions: (t) => ke(t),
2058
+ staticParameters: {
2059
+ visible: !1,
2060
+ eventType: J.Keyboard,
2061
+ keycode: e,
2062
+ isShift: !1
2063
+ }
2064
+ }), i.push({
2065
+ id: we.id,
2066
+ binding: e | Bn.SHIFT,
2067
+ preconditions: (t) => ke(t),
2068
+ staticParameters: {
2069
+ visible: !1,
2070
+ eventType: J.Keyboard,
2071
+ keycode: e,
2072
+ isShift: !0
2073
+ }
2074
+ });
2075
+ return i;
2076
+ }
2077
+ const Sr = {
2078
+ id: qn.id,
2079
+ preconditions: (i) => ke(i) || fr(i),
2080
+ binding: M.BACKSPACE
2081
+ };
2082
+ var Ir = Object.getOwnPropertyDescriptor, br = (i, e, t, n) => {
2083
+ for (var r = n > 1 ? void 0 : n ? Ir(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2084
+ (o = i[s]) && (r = o(r) || r);
2085
+ return r;
2086
+ }, re = (i, e) => (t, n) => e(t, n, i);
2087
+ let De = class extends Ve {
2088
+ constructor(i, e, t, n, r, s) {
2089
+ super(), this._injector = i, this._menuManagerService = e, this._componentManager = t, this._uiPartsService = n, this._commandService = r, this._shortcutService = s, this._initCommands(), this._initCustomComponents(), this._initUIComponents(), this._initMenus(), this._initShortcuts();
2090
+ }
2091
+ _initMenus() {
2092
+ this._menuManagerService.mergeMenu(Cr);
2093
+ }
2094
+ _initCustomComponents() {
2095
+ const i = this._componentManager;
2096
+ this.disposeWithMe(i.register(Jt, jt)), this.disposeWithMe(i.register(nn, Wt)), this.disposeWithMe(i.register(en, $t)), this.disposeWithMe(i.register(Gt, tr)), this.disposeWithMe(i.register(Oe, Vi));
2097
+ }
2098
+ _initCommands() {
2099
+ [
2100
+ Yt,
2101
+ Xt,
2102
+ qt,
2103
+ et,
2104
+ Zt,
2105
+ tt,
2106
+ Kt,
2107
+ qe,
2108
+ He,
2109
+ Vt,
2110
+ k,
2111
+ // commands for editor
2112
+ we
2113
+ ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
2114
+ }
2115
+ _initUIComponents() {
2116
+ this.disposeWithMe(
2117
+ this._uiPartsService.registerComponent(ct.LEFT_SIDEBAR, () => lt(cr, this._injector))
2118
+ ), this.disposeWithMe(
2119
+ this._uiPartsService.registerComponent(ct.CONTENT, () => lt(ur, this._injector))
2120
+ );
2121
+ }
2122
+ _initShortcuts() {
2123
+ [
2124
+ Sr,
2125
+ ..._r()
2126
+ ].forEach((i) => {
2127
+ this.disposeWithMe(this._shortcutService.registerShortcut(i));
2128
+ });
2129
+ }
2130
+ };
2131
+ De = br([
2132
+ re(0, X(Ke)),
2133
+ re(1, jn),
2134
+ re(2, X(Ln)),
2135
+ re(3, An),
2136
+ re(4, B),
2137
+ re(5, $n)
2138
+ ], De);
2139
+ var Pr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
2140
+ for (var r = n > 1 ? void 0 : n ? Pr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2141
+ (o = i[s]) && (r = o(r) || r);
2142
+ return r;
2143
+ }, Ae = (i, e) => (t, n) => e(t, n, i);
2144
+ let Ue = class extends pe {
2145
+ // private _skeletonChangeMutations = new Set<string>();
2146
+ constructor(i, e, t) {
2147
+ super(), this._contextService = i, this._instanceSrv = e, this._renderManagerService = t, Promise.resolve().then(() => this._init());
2148
+ }
2149
+ _init() {
2150
+ this._initSlideDataListener(), this._initContextListener();
2151
+ }
2152
+ _initSlideDataListener() {
2153
+ this._instanceSrv.getTypeOfUnitAdded$(E.UNIVER_SLIDE).pipe(ut(this.dispose$)).subscribe((i) => {
2154
+ this._createRenderer(i == null ? void 0 : i.getUnitId());
2155
+ }), this._instanceSrv.getAllUnitsForType(E.UNIVER_SLIDE).forEach((i) => {
2156
+ this._createRenderer(i.getUnitId());
2157
+ }), this._instanceSrv.getTypeOfUnitDisposed$(E.UNIVER_SLIDE).pipe(ut(this.dispose$)).subscribe((i) => this._disposeRenderer(i));
2158
+ }
2159
+ _createRenderer(i) {
2160
+ i == null || this._instanceSrv.getUnit(i, E.UNIVER_SLIDE) == null || this._renderManagerService.createRender(i);
2161
+ }
2162
+ _disposeRenderer(i) {
2163
+ const e = i.getUnitId();
2164
+ this._renderManagerService.removeRender(e);
2165
+ }
2166
+ _initContextListener() {
2167
+ }
2168
+ };
2169
+ Ue = Er([
2170
+ Ae(0, Ce),
2171
+ Ae(1, T),
2172
+ Ae(2, Y)
2173
+ ], Ue);
2174
+ var Rr = Object.getOwnPropertyDescriptor, Or = (i, e, t, n) => {
2175
+ for (var r = n > 1 ? void 0 : n ? Rr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2176
+ (o = i[s]) && (r = o(r) || r);
2177
+ return r;
2178
+ }, Ee = (i, e) => (t, n) => e(t, n, i);
2179
+ const xr = "SLIDE_UI";
2180
+ var Re;
2181
+ let St = (Re = class extends En {
2182
+ constructor(i = vt, e, t, n, r) {
2183
+ super(), this._config = i, this._injector = e, this._renderManagerService = t, this._univerInstanceService = n, this._configService = r;
2184
+ const { menu: s, ...o } = Rn(
2185
+ {},
2186
+ vt,
2187
+ this._config
2188
+ );
2189
+ s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(oi, o);
2190
+ }
2191
+ onStarting() {
2192
+ it([
2193
+ [Ue],
2194
+ [Je, { useClass: Fe }],
2195
+ // used by SlideUIController --> EditorContainer
2196
+ [Qe, { useClass: zi }],
2197
+ [Te]
2198
+ ], this._config.override).forEach((i) => this._injector.add(i));
2199
+ }
2200
+ onReady() {
2201
+ [
2202
+ // SlideRenderService will be init in ready stage, and then calling RenderManagerService@createRender --> init all deps in this rendering register block.
2203
+ [ve]
2204
+ ].forEach((i) => {
2205
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
2206
+ }), it([
2207
+ [N],
2208
+ // cannot register in _renderManagerService now.
2209
+ // [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
2210
+ // // used by SlideUIController --> EditorContainer
2211
+ // [ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
2212
+ // SlidesUIController controller should be registered in Ready stage.
2213
+ // SlidesUIController controller would add a new RenderUnit (__INTERNAL_EDITOR__DOCS_NORMAL)
2214
+ [De],
2215
+ // editor service was create in renderManagerService
2216
+ [ve],
2217
+ [Me]
2218
+ ], this._config.override).forEach((i) => {
2219
+ this._injector.add(i);
2220
+ }), this._injector.get(N), this._injector.get(Ue);
2221
+ }
2222
+ onRendered() {
2223
+ [
2224
+ // need slideEditorBridgeService
2225
+ // need TextSelectionRenderService which init by EditorContainer
2226
+ [We],
2227
+ [ze]
2228
+ ].forEach((i) => {
2229
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
2230
+ }), this._markSlideAsFocused(), this._injector.get(De);
2231
+ }
2232
+ onSteady() {
2233
+ this._injector.get(Me);
2234
+ }
2235
+ _markSlideAsFocused() {
2236
+ const i = this._univerInstanceService;
2237
+ try {
2238
+ const e = i.getCurrentUnitForType(E.UNIVER_SLIDE);
2239
+ i.focusUnit(e.getUnitId());
2240
+ } catch {
2241
+ }
2242
+ }
2243
+ }, I(Re, "pluginName", xr), I(Re, "type", E.UNIVER_SLIDE), Re);
2244
+ St = Or([
2245
+ Ee(1, X(Ke)),
2246
+ Ee(2, Y),
2247
+ Ee(3, T),
2248
+ Ee(4, On)
2249
+ ], St);
2250
+ export {
2251
+ Xt as ActivateSlidePageOperation,
2252
+ Yt as AppendSlideOperation,
2253
+ N as CanvasView,
2254
+ Vt as DeleteSlideElementOperation,
2255
+ Je as ISlideEditorBridgeService,
2256
+ et as InsertSlideFloatImageCommand,
2257
+ qe as InsertSlideShapeRectangleCommand,
2258
+ Kt as InsertSlideShapeRectangleOperation,
2259
+ tn as SHAPE_MENU_ID,
2260
+ Qt as SLIDES_IMAGE_MENU_ID,
2261
+ he as SLIDE_EDITOR_ID,
2262
+ qt as SetSlidePageThumbOperation,
2263
+ tt as SlideAddTextCommand,
2264
+ Zt as SlideAddTextOperation,
2265
+ Te as SlideCanvasPopMangerService,
2266
+ ur as SlideEditorContainer,
2267
+ cr as SlideSideBar,
2268
+ De as SlidesUIController,
2269
+ Cr as SlidesUIMenuSchema,
2270
+ St as UniverSlidesUIPlugin,
2271
+ k as UpdateSlideElementOperation
2272
+ };