@univerjs/docs-ui 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var Bt = Object.defineProperty;
2
- var Ft = (i, e, t) => e in i ? Bt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var m = (i, e, t) => (Ft(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { FOCUSING_DOC as xe, FOCUSING_UNIVER_EDITOR as Ge, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as wt, Direction as V, EDITOR_ACTIVATED as Rt, LocaleService as Ze, RxDisposable as ce, ICommandService as v, BooleanNumber as C, UniverInstanceType as S, BaselineOffset as J, ThemeService as Tt, HorizontalAlign as De, IUniverInstanceService as D, Disposable as Y, OnLifecycle as N, LifecycleStages as A, Tools as qe, LRUMap as jt, ColorKit as rt, toDisposable as F, ILogService as It, CommandType as Ke, IContextService as Vt, checkForSubstrings as Wt, IConfigService as zt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as kt, IFloatingObjectManagerService as Ht, Plugin as Yt } from "@univerjs/core";
5
- import { Inject as O, Injector as Pe, Optional as Xt, createIdentifier as Gt } from "@wendellhu/redi";
6
- import { KeyCode as P, MetaKeys as le, ILayoutService as bt, MenuGroup as I, MenuItemType as T, MenuPosition as b, getMenuHiddenObservable as M, FONT_FAMILY_LIST as ot, FONT_SIZE_LIST as Zt, FontFamily as qt, FontFamilyItem as Kt, FontSize as Jt, DesktopUIPart as Qt, ComponentManager as en, IEditorService as $, IMenuService as tn, IUIController as nn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as rn, HTML_CLIPBOARD_MIME_TYPE as on, IClipboardInterfaceService as Je, CopyCommand as sn, CutCommand as an, PasteCommand as cn, SetEditorResizeOperation as ln, IShortcutService as dn } from "@univerjs/ui";
7
- import { MoveCursorOperation as Ue, MoveSelectionOperation as Le, SelectAllOperation as un, SetInlineFormatBoldCommand as hn, SetTextSelectionsOperation as U, SetInlineFormatCommand as ee, SetInlineFormatItalicCommand as gn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as pn, SetInlineFormatSubscriptCommand as fn, SetInlineFormatSuperscriptCommand as mn, SetInlineFormatFontFamilyCommand as st, SetInlineFormatFontSizeCommand as at, SetInlineFormatTextColorCommand as ct, AlignLeftCommand as Sn, AlignOperationCommand as Ne, AlignCenterCommand as vn, AlignRightCommand as Cn, AlignJustifyCommand as On, OrderListCommand as Rn, BulletListCommand as Tn, ResetInlineFormatTextBackgroundColorCommand as In, SetInlineFormatTextBackgroundColorCommand as ke, TextSelectionManagerService as te, BreakLineCommand as bn, DeleteLeftCommand as Mn, DeleteRightCommand as yn, CutContentCommand as Mt, InnerPasteCommand as yt, VIEWPORT_KEY as Ae, CoverContentCommand as En, RichTextEditingMutation as Qe, DocSkeletonManagerService as ne, DOCS_COMPONENT_MAIN_LAYER_INDEX as je, DOCS_COMPONENT_HEADER_LAYER_INDEX as xn, DOCS_VIEW_KEY as lt, DOCS_COMPONENT_DEFAULT_Z_INDEX as Dn, SetDocZoomRatioOperation as et, SetDocZoomRatioCommand as Pn, getDocObject as Et, getDocObjectById as Un } from "@univerjs/docs";
8
- import { connectInjector as Ln } from "@wendellhu/redi/react-bindings";
9
- import { ITextSelectionRenderManager as de, pixelToPt as Nn, ptToPixel as dt, ScrollBar as He, IRenderManagerService as W, PageLayoutType as ut, Viewport as An, EVENT_TYPE as $n, Layer as ht, Documents as Bn, Liquid as Fn, Rect as wn, CURSOR_TYPE as gt, NodePositionConvertToCursor as jn, getAnchorBounding as Vn } from "@univerjs/engine-render";
2
+ var $t = (i, e, t) => e in i ? Bt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var p = (i, e, t) => ($t(i, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { FOCUSING_DOC as De, FOCUSING_UNIVER_EDITOR as Ke, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Ft, Direction as V, EDITOR_ACTIVATED as Tt, LocaleService as Ze, RxDisposable as le, ICommandService as v, BooleanNumber as C, UniverInstanceType as m, BaselineOffset as J, ThemeService as It, HorizontalAlign as Pe, IUniverInstanceService as U, Disposable as ee, OnLifecycle as L, LifecycleStages as B, Tools as qe, LRUMap as wt, ColorKit as ot, toDisposable as j, ILogService as bt, CommandType as Je, IContextService as jt, checkForSubstrings as Vt, IConfigService as Wt, PositionedObjectLayoutType as kt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as zt, IFloatingObjectManagerService as Ht, Plugin as Yt } from "@univerjs/core";
5
+ import { Inject as R, Injector as Ue, Optional as Gt, createIdentifier as Xt } from "@wendellhu/redi";
6
+ import { KeyCode as D, MetaKeys as de, ILayoutService as yt, MenuGroup as I, MenuItemType as T, MenuPosition as b, getMenuHiddenObservable as y, FONT_FAMILY_LIST as st, FONT_SIZE_LIST as Kt, FontFamily as Zt, FontFamilyItem as qt, FontSize as Jt, DesktopUIPart as Qt, ComponentManager as en, IEditorService as $, IMenuService as tn, IUIController as nn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as rn, HTML_CLIPBOARD_MIME_TYPE as on, IClipboardInterfaceService as Qe, CopyCommand as sn, CutCommand as an, PasteCommand as cn, SetEditorResizeOperation as ln, IShortcutService as dn } from "@univerjs/ui";
7
+ import { MoveCursorOperation as Ne, MoveSelectionOperation as Ae, SelectAllOperation as un, SetInlineFormatBoldCommand as hn, SetTextSelectionsOperation as P, SetInlineFormatCommand as te, SetInlineFormatItalicCommand as gn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as pn, SetInlineFormatSubscriptCommand as fn, SetInlineFormatSuperscriptCommand as mn, SetInlineFormatFontFamilyCommand as at, SetInlineFormatFontSizeCommand as ct, SetInlineFormatTextColorCommand as lt, AlignLeftCommand as Sn, AlignOperationCommand as Le, AlignCenterCommand as vn, AlignRightCommand as Cn, AlignJustifyCommand as On, OrderListCommand as Rn, BulletListCommand as Tn, ResetInlineFormatTextBackgroundColorCommand as In, SetInlineFormatTextBackgroundColorCommand as He, TextSelectionManagerService as ne, BreakLineCommand as bn, DeleteLeftCommand as yn, DeleteRightCommand as Mn, CutContentCommand as Mt, InnerPasteCommand as Et, VIEWPORT_KEY as Be, CoverContentCommand as En, RichTextEditingMutation as et, DocSkeletonManagerService as ie, DOCS_VIEW_KEY as q, DOCS_COMPONENT_MAIN_LAYER_INDEX as We, DOCS_COMPONENT_HEADER_LAYER_INDEX as xn, DOCS_COMPONENT_DEFAULT_Z_INDEX as dt, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as Dn, SetDocZoomRatioOperation as tt, SetDocZoomRatioCommand as Pn, getDocObject as xt, getDocObjectById as Un } from "@univerjs/docs";
8
+ import { connectInjector as Nn } from "@wendellhu/redi/react-bindings";
9
+ import { ITextSelectionRenderManager as ue, pixelToPt as An, ptToPixel as ut, ScrollBar as Ye, IRenderManagerService as H, PageLayoutType as ht, Viewport as Ln, EVENT_TYPE as Bn, Layer as gt, Documents as $n, DocBackground as Fn, Liquid as wn, CURSOR_TYPE as _t, NodePositionConvertToCursor as jn, getAnchorBounding as Vn } from "@univerjs/engine-render";
10
10
  import Wn from "react";
11
- import { Observable as E, takeUntil as ae, fromEvent as _t, BehaviorSubject as zn } from "rxjs";
12
- import { ColorPicker as kn } from "@univerjs/design";
11
+ import { Observable as M, takeUntil as ce, fromEvent as pt, BehaviorSubject as kn } from "rxjs";
12
+ import { ColorPicker as zn } from "@univerjs/design";
13
13
  const Hn = {
14
14
  undo: !0,
15
15
  redo: !0,
@@ -51,89 +51,89 @@ const Hn = {
51
51
  frozenContent: !1,
52
52
  infoBar: !0,
53
53
  toolbar: !0
54
- }, Xn = {
54
+ }, Gn = {
55
55
  layout: {
56
56
  docContainerConfig: Yn,
57
57
  toolbarConfig: Hn
58
58
  }
59
- }, Gn = "DocUI";
60
- function B(i) {
61
- return i.getContextValue(xe) && i.getContextValue(Ge);
59
+ }, Xn = "DocUI";
60
+ function A(i) {
61
+ return i.getContextValue(De) && i.getContextValue(Ke);
62
62
  }
63
- function Zn(i) {
64
- return i.getContextValue(xe) && i.getContextValue(Ge) && !i.getContextValue(wt);
63
+ function Kn(i) {
64
+ return i.getContextValue(De) && i.getContextValue(Ke) && !i.getContextValue(Ft);
65
65
  }
66
- const qn = {
67
- id: Ue.id,
68
- binding: P.ARROW_UP,
69
- preconditions: B,
66
+ const Zn = {
67
+ id: Ne.id,
68
+ binding: D.ARROW_UP,
69
+ preconditions: A,
70
70
  staticParameters: {
71
71
  direction: V.UP
72
72
  }
73
- }, Kn = {
74
- id: Ue.id,
75
- binding: P.ARROW_DOWN,
76
- preconditions: B,
73
+ }, qn = {
74
+ id: Ne.id,
75
+ binding: D.ARROW_DOWN,
76
+ preconditions: A,
77
77
  staticParameters: {
78
78
  direction: V.DOWN
79
79
  }
80
80
  }, Jn = {
81
- id: Ue.id,
82
- binding: P.ARROW_LEFT,
83
- preconditions: B,
81
+ id: Ne.id,
82
+ binding: D.ARROW_LEFT,
83
+ preconditions: A,
84
84
  staticParameters: {
85
85
  direction: V.LEFT
86
86
  }
87
87
  }, Qn = {
88
- id: Ue.id,
89
- binding: P.ARROW_RIGHT,
90
- preconditions: B,
88
+ id: Ne.id,
89
+ binding: D.ARROW_RIGHT,
90
+ preconditions: A,
91
91
  staticParameters: {
92
92
  direction: V.RIGHT
93
93
  }
94
94
  }, ei = {
95
- id: Le.id,
96
- binding: P.ARROW_UP | le.SHIFT,
97
- preconditions: B,
95
+ id: Ae.id,
96
+ binding: D.ARROW_UP | de.SHIFT,
97
+ preconditions: A,
98
98
  staticParameters: {
99
99
  direction: V.UP
100
100
  }
101
101
  }, ti = {
102
- id: Le.id,
103
- binding: P.ARROW_DOWN | le.SHIFT,
104
- preconditions: B,
102
+ id: Ae.id,
103
+ binding: D.ARROW_DOWN | de.SHIFT,
104
+ preconditions: A,
105
105
  staticParameters: {
106
106
  direction: V.DOWN
107
107
  }
108
108
  }, ni = {
109
- id: Le.id,
110
- binding: P.ARROW_LEFT | le.SHIFT,
111
- preconditions: B,
109
+ id: Ae.id,
110
+ binding: D.ARROW_LEFT | de.SHIFT,
111
+ preconditions: A,
112
112
  staticParameters: {
113
113
  direction: V.LEFT
114
114
  }
115
115
  }, ii = {
116
- id: Le.id,
117
- binding: P.ARROW_RIGHT | le.SHIFT,
118
- preconditions: B,
116
+ id: Ae.id,
117
+ binding: D.ARROW_RIGHT | de.SHIFT,
118
+ preconditions: A,
119
119
  staticParameters: {
120
120
  direction: V.RIGHT
121
121
  }
122
122
  }, ri = {
123
123
  id: un.id,
124
- binding: P.A | le.CTRL_COMMAND,
125
- preconditions: (i) => i.getContextValue(Ge) && (i.getContextValue(xe) || i.getContextValue(Rt))
124
+ binding: D.A | de.CTRL_COMMAND,
125
+ preconditions: (i) => i.getContextValue(Ke) && (i.getContextValue(De) || i.getContextValue(Tt))
126
126
  };
127
127
  var oi = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (i, e, t, n) => {
128
- for (var r = n > 1 ? void 0 : n ? si(e, t) : e, s = i.length - 1, o; s >= 0; s--)
129
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
128
+ for (var r = n > 1 ? void 0 : n ? si(e, t) : e, o = i.length - 1, s; o >= 0; o--)
129
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
130
130
  return n && r && oi(e, t, r), r;
131
- }, pt = (i, e) => (t, n) => e(t, n, i);
132
- let Ye = class {
131
+ }, ft = (i, e) => (t, n) => e(t, n, i);
132
+ let Ge = class {
133
133
  constructor(i, e, t) {
134
- m(this, "_docContainer");
134
+ p(this, "_docContainer");
135
135
  // 获取SheetContainer组件
136
- m(this, "getComponent", (i) => {
136
+ p(this, "getComponent", (i) => {
137
137
  if (this._docContainer = i, !i.getContentRef().current)
138
138
  throw new Error("container is not ready");
139
139
  });
@@ -144,7 +144,7 @@ let Ye = class {
144
144
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
145
145
  *
146
146
  */
147
- m(this, "changeLocale", (i) => {
147
+ p(this, "changeLocale", (i) => {
148
148
  this._localeService.setLocale(i);
149
149
  });
150
150
  this._config = i, this._localeService = e, this._injector = t;
@@ -168,19 +168,19 @@ let Ye = class {
168
168
  return this._docContainer;
169
169
  }
170
170
  };
171
- Ye = ai([
172
- pt(1, O(Ze)),
173
- pt(2, O(Pe))
174
- ], Ye);
171
+ Ge = ai([
172
+ ft(1, R(Ze)),
173
+ ft(2, R(Ue))
174
+ ], Ge);
175
175
  var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
176
- for (var r = n > 1 ? void 0 : n ? li(e, t) : e, s = i.length - 1, o; s >= 0; s--)
177
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
176
+ for (var r = n > 1 ? void 0 : n ? li(e, t) : e, o = i.length - 1, s; o >= 0; o--)
177
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
178
178
  return n && r && ci(e, t, r), r;
179
- }, _e = (i, e) => (t, n) => e(t, n, i);
180
- let se = class extends ce {
181
- constructor(e, t, n, r, s) {
179
+ }, fe = (i, e) => (t, n) => e(t, n, i);
180
+ let ae = class extends le {
181
+ constructor(e, t, n, r, o) {
182
182
  super();
183
- m(this, "_docContainerController");
183
+ p(this, "_docContainerController");
184
184
  /**
185
185
  * Change language
186
186
  * @param {string} locale new language
@@ -188,10 +188,10 @@ let se = class extends ce {
188
188
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
189
189
  *
190
190
  */
191
- m(this, "changeLocale", (e) => {
191
+ p(this, "changeLocale", (e) => {
192
192
  this._localeService.setLocale(e);
193
193
  });
194
- this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = s, this._docContainerController = this._injector.createInstance(Ye, e), this._registerContainer();
194
+ this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = o, this._docContainerController = this._injector.createInstance(Ge, e), this._registerContainer();
195
195
  }
196
196
  _registerContainer() {
197
197
  this._layoutService && this.disposeWithMe(
@@ -203,14 +203,14 @@ let se = class extends ce {
203
203
  return this._docContainerController;
204
204
  }
205
205
  };
206
- se = di([
207
- _e(1, O(Ze)),
208
- _e(2, O(Pe)),
209
- _e(3, de),
210
- _e(4, Xt(bt))
211
- ], se);
212
- const $e = "UI_PLUGIN_DOCS", tt = `${$e}_COLOR_PICKER_COMPONENT`, xt = `${$e}_FONT_FAMILY_COMPONENT`, Dt = `${$e}_FONT_FAMILY_ITEM_COMPONENT`, Pt = `${$e}_FONT_SIZE_COMPONENT`;
213
- var Ut = { exports: {} }, Be = {};
206
+ ae = di([
207
+ fe(1, R(Ze)),
208
+ fe(2, R(Ue)),
209
+ fe(3, ue),
210
+ fe(4, Gt(yt))
211
+ ], ae);
212
+ const $e = "UI_PLUGIN_DOCS", nt = `${$e}_COLOR_PICKER_COMPONENT`, Dt = `${$e}_FONT_FAMILY_COMPONENT`, Pt = `${$e}_FONT_FAMILY_ITEM_COMPONENT`, Ut = `${$e}_FONT_SIZE_COMPONENT`;
213
+ var Nt = { exports: {} }, Fe = {};
214
214
  /**
215
215
  * @license React
216
216
  * react-jsx-runtime.production.min.js
@@ -221,21 +221,21 @@ var Ut = { exports: {} }, Be = {};
221
221
  * LICENSE file in the root directory of this source tree.
222
222
  */
223
223
  var ui = Wn, hi = Symbol.for("react.element"), gi = Symbol.for("react.fragment"), _i = Object.prototype.hasOwnProperty, pi = ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, fi = { key: !0, ref: !0, __self: !0, __source: !0 };
224
- function Lt(i, e, t) {
225
- var n, r = {}, s = null, o = null;
226
- t !== void 0 && (s = "" + t), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
224
+ function At(i, e, t) {
225
+ var n, r = {}, o = null, s = null;
226
+ t !== void 0 && (o = "" + t), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
227
227
  for (n in e)
228
228
  _i.call(e, n) && !fi.hasOwnProperty(n) && (r[n] = e[n]);
229
229
  if (i && i.defaultProps)
230
230
  for (n in e = i.defaultProps, e)
231
231
  r[n] === void 0 && (r[n] = e[n]);
232
- return { $$typeof: hi, type: i, key: s, ref: o, props: r, _owner: pi.current };
232
+ return { $$typeof: hi, type: i, key: o, ref: s, props: r, _owner: pi.current };
233
233
  }
234
- Be.Fragment = gi;
235
- Be.jsx = Lt;
236
- Be.jsxs = Lt;
237
- Ut.exports = Be;
238
- var mi = Ut.exports;
234
+ Fe.Fragment = gi;
235
+ Fe.jsx = At;
236
+ Fe.jsxs = At;
237
+ Nt.exports = Fe;
238
+ var mi = Nt.exports;
239
239
  const Si = "univer-docs-ui-canvas-background", vi = {
240
240
  docsUiCanvasBackground: Si
241
241
  }, Ci = () => /* @__PURE__ */ mi.jsx("div", { className: vi.docsUiCanvasBackground });
@@ -249,21 +249,21 @@ function Oi(i) {
249
249
  title: "Set bold",
250
250
  tooltip: "toolbar.bold",
251
251
  positions: [b.TOOLBAR_START],
252
- activated$: new E((t) => {
252
+ activated$: new M((t) => {
253
253
  const n = e.onCommandExecuted((r) => {
254
- var o;
255
- const s = r.id;
256
- if (s === U.id || s === ee.id) {
257
- const a = z(i);
254
+ var s;
255
+ const o = r.id;
256
+ if (o === P.id || o === te.id) {
257
+ const a = W(i);
258
258
  if (a == null)
259
259
  return;
260
- const c = (o = a.ts) == null ? void 0 : o.bl;
260
+ const c = (s = a.ts) == null ? void 0 : s.bl;
261
261
  t.next(c === C.TRUE);
262
262
  }
263
263
  });
264
264
  return t.next(!1), n.dispose;
265
265
  }),
266
- hidden$: M(i, S.UNIVER_DOC)
266
+ hidden$: y(i, m.UNIVER_DOC)
267
267
  };
268
268
  }
269
269
  function Ri(i) {
@@ -276,21 +276,21 @@ function Ri(i) {
276
276
  title: "Set italic",
277
277
  tooltip: "toolbar.italic",
278
278
  positions: [b.TOOLBAR_START],
279
- activated$: new E((t) => {
279
+ activated$: new M((t) => {
280
280
  const n = e.onCommandExecuted((r) => {
281
- var o;
282
- const s = r.id;
283
- if (s === U.id || s === ee.id) {
284
- const a = z(i);
281
+ var s;
282
+ const o = r.id;
283
+ if (o === P.id || o === te.id) {
284
+ const a = W(i);
285
285
  if (a == null)
286
286
  return;
287
- const c = (o = a.ts) == null ? void 0 : o.it;
287
+ const c = (s = a.ts) == null ? void 0 : s.it;
288
288
  t.next(c === C.TRUE);
289
289
  }
290
290
  });
291
291
  return t.next(!1), n.dispose;
292
292
  }),
293
- hidden$: M(i, S.UNIVER_DOC)
293
+ hidden$: y(i, m.UNIVER_DOC)
294
294
  };
295
295
  }
296
296
  function Ti(i) {
@@ -303,21 +303,21 @@ function Ti(i) {
303
303
  title: "Set underline",
304
304
  tooltip: "toolbar.underline",
305
305
  positions: [b.TOOLBAR_START],
306
- activated$: new E((t) => {
306
+ activated$: new M((t) => {
307
307
  const n = e.onCommandExecuted((r) => {
308
- var o;
309
- const s = r.id;
310
- if (s === U.id || s === ee.id) {
311
- const a = z(i);
308
+ var s;
309
+ const o = r.id;
310
+ if (o === P.id || o === te.id) {
311
+ const a = W(i);
312
312
  if (a == null)
313
313
  return;
314
- const c = (o = a.ts) == null ? void 0 : o.ul;
314
+ const c = (s = a.ts) == null ? void 0 : s.ul;
315
315
  t.next((c == null ? void 0 : c.s) === C.TRUE);
316
316
  }
317
317
  });
318
318
  return t.next(!1), n.dispose;
319
319
  }),
320
- hidden$: M(i, S.UNIVER_DOC)
320
+ hidden$: y(i, m.UNIVER_DOC)
321
321
  };
322
322
  }
323
323
  function Ii(i) {
@@ -330,21 +330,21 @@ function Ii(i) {
330
330
  title: "Set strike through",
331
331
  tooltip: "toolbar.strikethrough",
332
332
  positions: [b.TOOLBAR_START],
333
- activated$: new E((t) => {
333
+ activated$: new M((t) => {
334
334
  const n = e.onCommandExecuted((r) => {
335
- var o;
336
- const s = r.id;
337
- if (s === U.id || s === ee.id) {
338
- const a = z(i);
335
+ var s;
336
+ const o = r.id;
337
+ if (o === P.id || o === te.id) {
338
+ const a = W(i);
339
339
  if (a == null)
340
340
  return;
341
- const c = (o = a.ts) == null ? void 0 : o.st;
341
+ const c = (s = a.ts) == null ? void 0 : s.st;
342
342
  t.next((c == null ? void 0 : c.s) === C.TRUE);
343
343
  }
344
344
  });
345
345
  return t.next(!1), n.dispose;
346
346
  }),
347
- hidden$: M(i, S.UNIVER_DOC)
347
+ hidden$: y(i, m.UNIVER_DOC)
348
348
  };
349
349
  }
350
350
  function bi(i) {
@@ -356,24 +356,24 @@ function bi(i) {
356
356
  icon: "SubscriptSingle",
357
357
  tooltip: "toolbar.subscript",
358
358
  positions: [b.TOOLBAR_START],
359
- activated$: new E((t) => {
359
+ activated$: new M((t) => {
360
360
  const n = e.onCommandExecuted((r) => {
361
- var o;
362
- const s = r.id;
363
- if (s === U.id || s === ee.id) {
364
- const a = z(i);
361
+ var s;
362
+ const o = r.id;
363
+ if (o === P.id || o === te.id) {
364
+ const a = W(i);
365
365
  if (a == null)
366
366
  return;
367
- const c = (o = a.ts) == null ? void 0 : o.va;
367
+ const c = (s = a.ts) == null ? void 0 : s.va;
368
368
  t.next(c === J.SUBSCRIPT);
369
369
  }
370
370
  });
371
371
  return t.next(!1), n.dispose;
372
372
  }),
373
- hidden$: M(i, S.UNIVER_DOC)
373
+ hidden$: y(i, m.UNIVER_DOC)
374
374
  };
375
375
  }
376
- function Mi(i) {
376
+ function yi(i) {
377
377
  const e = i.get(v);
378
378
  return {
379
379
  id: mn.id,
@@ -382,66 +382,66 @@ function Mi(i) {
382
382
  icon: "SuperscriptSingle",
383
383
  tooltip: "toolbar.superscript",
384
384
  positions: [b.TOOLBAR_START],
385
- activated$: new E((t) => {
385
+ activated$: new M((t) => {
386
386
  const n = e.onCommandExecuted((r) => {
387
- var o;
388
- const s = r.id;
389
- if (s === U.id || s === ee.id) {
390
- const a = z(i);
387
+ var s;
388
+ const o = r.id;
389
+ if (o === P.id || o === te.id) {
390
+ const a = W(i);
391
391
  if (a == null)
392
392
  return;
393
- const c = (o = a.ts) == null ? void 0 : o.va;
393
+ const c = (s = a.ts) == null ? void 0 : s.va;
394
394
  t.next(c === J.SUPERSCRIPT);
395
395
  }
396
396
  });
397
397
  return t.next(!1), n.dispose;
398
398
  }),
399
- hidden$: M(i, S.UNIVER_DOC)
399
+ hidden$: y(i, m.UNIVER_DOC)
400
400
  };
401
401
  }
402
- function yi(i) {
402
+ function Mi(i) {
403
403
  const e = i.get(v);
404
404
  return {
405
- id: st.id,
405
+ id: at.id,
406
406
  tooltip: "toolbar.font",
407
407
  group: I.TOOLBAR_FORMAT,
408
408
  type: T.SELECTOR,
409
- label: xt,
409
+ label: Dt,
410
410
  positions: [b.TOOLBAR_START],
411
- selections: ot.map((t) => ({
411
+ selections: st.map((t) => ({
412
412
  label: {
413
- name: Dt,
413
+ name: Pt,
414
414
  hoverable: !0
415
415
  },
416
416
  value: t.value
417
417
  })),
418
418
  // disabled$: getCurrentSheetDisabled$(accessor),
419
- value$: new E((t) => {
420
- const n = ot[0].value, r = e.onCommandExecuted((s) => {
419
+ value$: new M((t) => {
420
+ const n = st[0].value, r = e.onCommandExecuted((o) => {
421
421
  var a;
422
- const o = s.id;
423
- if (o === U.id || o === st.id) {
424
- const c = z(i);
422
+ const s = o.id;
423
+ if (s === P.id || s === at.id) {
424
+ const c = W(i);
425
425
  if (c == null)
426
426
  return;
427
- const d = (a = c.ts) == null ? void 0 : a.ff;
428
- t.next(d != null ? d : n);
427
+ const l = (a = c.ts) == null ? void 0 : a.ff;
428
+ t.next(l != null ? l : n);
429
429
  }
430
430
  });
431
431
  return t.next(n), r.dispose;
432
432
  }),
433
- hidden$: M(i, S.UNIVER_DOC)
433
+ hidden$: y(i, m.UNIVER_DOC)
434
434
  };
435
435
  }
436
436
  function Ei(i) {
437
437
  const e = i.get(v);
438
438
  return {
439
- id: at.id,
439
+ id: ct.id,
440
440
  group: I.TOOLBAR_FORMAT,
441
441
  type: T.SELECTOR,
442
442
  tooltip: "toolbar.fontSize",
443
443
  label: {
444
- name: Pt,
444
+ name: Ut,
445
445
  props: {
446
446
  min: 1,
447
447
  max: 400
@@ -449,29 +449,29 @@ function Ei(i) {
449
449
  }
450
450
  },
451
451
  positions: [b.TOOLBAR_START],
452
- selections: Zt,
452
+ selections: Kt,
453
453
  // disabled$,
454
- value$: new E((t) => {
455
- const r = e.onCommandExecuted((s) => {
454
+ value$: new M((t) => {
455
+ const r = e.onCommandExecuted((o) => {
456
456
  var a;
457
- const o = s.id;
458
- if (o === U.id || o === at.id) {
459
- const c = z(i);
457
+ const s = o.id;
458
+ if (s === P.id || s === ct.id) {
459
+ const c = W(i);
460
460
  if (c == null)
461
461
  return;
462
- const d = (a = c.ts) == null ? void 0 : a.fs;
463
- t.next(d != null ? d : 14);
462
+ const l = (a = c.ts) == null ? void 0 : a.fs;
463
+ t.next(l != null ? l : 14);
464
464
  }
465
465
  });
466
466
  return t.next(14), r.dispose;
467
467
  }),
468
- hidden$: M(i, S.UNIVER_DOC)
468
+ hidden$: y(i, m.UNIVER_DOC)
469
469
  };
470
470
  }
471
471
  function xi(i) {
472
- const e = i.get(v), t = i.get(Tt);
472
+ const e = i.get(v), t = i.get(It);
473
473
  return {
474
- id: ct.id,
474
+ id: lt.id,
475
475
  icon: "FontColor",
476
476
  tooltip: "toolbar.textColor.main",
477
477
  group: I.TOOLBAR_FORMAT,
@@ -480,21 +480,21 @@ function xi(i) {
480
480
  selections: [
481
481
  {
482
482
  label: {
483
- name: tt,
483
+ name: nt,
484
484
  hoverable: !1
485
485
  }
486
486
  }
487
487
  ],
488
- value$: new E((n) => {
489
- const r = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
490
- if (o.id === ct.id) {
491
- const a = o.params.value;
488
+ value$: new M((n) => {
489
+ const r = t.getCurrentTheme().textColor, o = e.onCommandExecuted((s) => {
490
+ if (s.id === lt.id) {
491
+ const a = s.params.value;
492
492
  n.next(a != null ? a : r);
493
493
  }
494
494
  });
495
- return n.next(r), s.dispose;
495
+ return n.next(r), o.dispose;
496
496
  }),
497
- hidden$: M(i, S.UNIVER_DOC)
497
+ hidden$: y(i, m.UNIVER_DOC)
498
498
  // disabled$: getCurrentSheetDisabled$(accessor),
499
499
  };
500
500
  }
@@ -507,21 +507,21 @@ function Di(i) {
507
507
  icon: "LeftJustifyingSingle",
508
508
  tooltip: "toolbar.alignLeft",
509
509
  positions: [b.TOOLBAR_START],
510
- activated$: new E((t) => {
510
+ activated$: new M((t) => {
511
511
  const n = e.onCommandExecuted((r) => {
512
- var o;
513
- const s = r.id;
514
- if (s === U.id || s === Ne.id) {
515
- const a = Fe(i);
512
+ var s;
513
+ const o = r.id;
514
+ if (o === P.id || o === Le.id) {
515
+ const a = we(i);
516
516
  if (a == null)
517
517
  return;
518
- const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
519
- t.next(c === De.LEFT);
518
+ const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
519
+ t.next(c === Pe.LEFT);
520
520
  }
521
521
  });
522
522
  return t.next(!1), n.dispose;
523
523
  }),
524
- hidden$: M(i, S.UNIVER_DOC)
524
+ hidden$: y(i, m.UNIVER_DOC)
525
525
  };
526
526
  }
527
527
  function Pi(i) {
@@ -533,21 +533,21 @@ function Pi(i) {
533
533
  icon: "HorizontallySingle",
534
534
  tooltip: "toolbar.alignCenter",
535
535
  positions: [b.TOOLBAR_START],
536
- activated$: new E((t) => {
536
+ activated$: new M((t) => {
537
537
  const n = e.onCommandExecuted((r) => {
538
- var o;
539
- const s = r.id;
540
- if (s === U.id || s === Ne.id) {
541
- const a = Fe(i);
538
+ var s;
539
+ const o = r.id;
540
+ if (o === P.id || o === Le.id) {
541
+ const a = we(i);
542
542
  if (a == null)
543
543
  return;
544
- const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
545
- t.next(c === De.CENTER);
544
+ const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
545
+ t.next(c === Pe.CENTER);
546
546
  }
547
547
  });
548
548
  return t.next(!1), n.dispose;
549
549
  }),
550
- hidden$: M(i, S.UNIVER_DOC)
550
+ hidden$: y(i, m.UNIVER_DOC)
551
551
  };
552
552
  }
553
553
  function Ui(i) {
@@ -559,24 +559,24 @@ function Ui(i) {
559
559
  icon: "RightJustifyingSingle",
560
560
  tooltip: "toolbar.alignRight",
561
561
  positions: [b.TOOLBAR_START],
562
- activated$: new E((t) => {
562
+ activated$: new M((t) => {
563
563
  const n = e.onCommandExecuted((r) => {
564
- var o;
565
- const s = r.id;
566
- if (s === U.id || s === Ne.id) {
567
- const a = Fe(i);
564
+ var s;
565
+ const o = r.id;
566
+ if (o === P.id || o === Le.id) {
567
+ const a = we(i);
568
568
  if (a == null)
569
569
  return;
570
- const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
571
- t.next(c === De.RIGHT);
570
+ const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
571
+ t.next(c === Pe.RIGHT);
572
572
  }
573
573
  });
574
574
  return t.next(!1), n.dispose;
575
575
  }),
576
- hidden$: M(i, S.UNIVER_DOC)
576
+ hidden$: y(i, m.UNIVER_DOC)
577
577
  };
578
578
  }
579
- function Li(i) {
579
+ function Ni(i) {
580
580
  const e = i.get(v);
581
581
  return {
582
582
  id: On.id,
@@ -585,24 +585,24 @@ function Li(i) {
585
585
  icon: "AlignTextBothSingle",
586
586
  tooltip: "toolbar.alignJustify",
587
587
  positions: [b.TOOLBAR_START],
588
- activated$: new E((t) => {
588
+ activated$: new M((t) => {
589
589
  const n = e.onCommandExecuted((r) => {
590
- var o;
591
- const s = r.id;
592
- if (s === U.id || s === Ne.id) {
593
- const a = Fe(i);
590
+ var s;
591
+ const o = r.id;
592
+ if (o === P.id || o === Le.id) {
593
+ const a = we(i);
594
594
  if (a == null)
595
595
  return;
596
- const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
597
- t.next(c === De.JUSTIFIED);
596
+ const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
597
+ t.next(c === Pe.JUSTIFIED);
598
598
  }
599
599
  });
600
600
  return t.next(!1), n.dispose;
601
601
  }),
602
- hidden$: M(i, S.UNIVER_DOC)
602
+ hidden$: y(i, m.UNIVER_DOC)
603
603
  };
604
604
  }
605
- function Ni(i) {
605
+ function Ai(i) {
606
606
  return {
607
607
  id: Rn.id,
608
608
  group: I.TOOLBAR_LAYOUT,
@@ -610,10 +610,10 @@ function Ni(i) {
610
610
  icon: "OrderSingle",
611
611
  tooltip: "toolbar.order",
612
612
  positions: [b.TOOLBAR_START],
613
- hidden$: M(i, S.UNIVER_DOC)
613
+ hidden$: y(i, m.UNIVER_DOC)
614
614
  };
615
615
  }
616
- function Ai(i) {
616
+ function Li(i) {
617
617
  return {
618
618
  id: Tn.id,
619
619
  group: I.TOOLBAR_LAYOUT,
@@ -621,22 +621,22 @@ function Ai(i) {
621
621
  icon: "UnorderSingle",
622
622
  tooltip: "toolbar.unorder",
623
623
  positions: [b.TOOLBAR_START],
624
- hidden$: M(i, S.UNIVER_DOC)
624
+ hidden$: y(i, m.UNIVER_DOC)
625
625
  };
626
626
  }
627
- function $i(i) {
627
+ function Bi(i) {
628
628
  return {
629
629
  id: In.id,
630
630
  type: T.BUTTON,
631
631
  title: "toolbar.resetColor",
632
632
  icon: "NoColor",
633
- positions: ke.id
633
+ positions: He.id
634
634
  };
635
635
  }
636
- function Bi(i) {
637
- const e = i.get(v), t = i.get(Tt);
636
+ function $i(i) {
637
+ const e = i.get(v), t = i.get(It);
638
638
  return {
639
- id: ke.id,
639
+ id: He.id,
640
640
  tooltip: "toolbar.fillColor.main",
641
641
  group: I.TOOLBAR_FORMAT,
642
642
  type: T.BUTTON_SELECTOR,
@@ -645,64 +645,64 @@ function Bi(i) {
645
645
  selections: [
646
646
  {
647
647
  label: {
648
- name: tt,
648
+ name: nt,
649
649
  hoverable: !1
650
650
  }
651
651
  }
652
652
  ],
653
- value$: new E((n) => {
654
- const r = t.getCurrentTheme().primaryColor, s = e.onCommandExecuted((o) => {
655
- if (o.id === ke.id) {
656
- const a = o.params.value;
653
+ value$: new M((n) => {
654
+ const r = t.getCurrentTheme().primaryColor, o = e.onCommandExecuted((s) => {
655
+ if (s.id === He.id) {
656
+ const a = s.params.value;
657
657
  n.next(a != null ? a : r);
658
658
  }
659
659
  });
660
- return n.next(r), s.dispose;
660
+ return n.next(r), o.dispose;
661
661
  }),
662
- hidden$: M(i, S.UNIVER_DOC)
662
+ hidden$: y(i, m.UNIVER_DOC)
663
663
  };
664
664
  }
665
- function z(i) {
665
+ function W(i) {
666
666
  var c;
667
- const e = i.get(D), t = i.get(te), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
667
+ const e = i.get(U), t = i.get(ne), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
668
668
  if (n == null || r == null)
669
669
  return;
670
- const s = (c = n.getBody()) == null ? void 0 : c.textRuns;
671
- if (s == null)
670
+ const o = (c = n.getBody()) == null ? void 0 : c.textRuns;
671
+ if (o == null)
672
672
  return;
673
- const { startOffset: o } = r;
674
- return s.find(({ st: d, ed: u }) => o >= d && o < u);
673
+ const { startOffset: s } = r;
674
+ return o.find(({ st: l, ed: u }) => s >= l && s < u);
675
675
  }
676
- function Fe(i) {
676
+ function we(i) {
677
677
  var c;
678
- const e = i.get(D), t = i.get(te), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
678
+ const e = i.get(U), t = i.get(ne), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
679
679
  if (n == null || r == null)
680
680
  return;
681
- const s = (c = n.getBody()) == null ? void 0 : c.paragraphs;
682
- if (s == null)
681
+ const o = (c = n.getBody()) == null ? void 0 : c.paragraphs;
682
+ if (o == null)
683
683
  return;
684
- const { startOffset: o } = r;
684
+ const { startOffset: s } = r;
685
685
  let a = -1;
686
- for (const d of s) {
687
- const { startIndex: u } = d;
688
- if (o > a && o <= u)
689
- return d;
686
+ for (const l of o) {
687
+ const { startIndex: u } = l;
688
+ if (s > a && s <= u)
689
+ return l;
690
690
  a = u;
691
691
  }
692
692
  return null;
693
693
  }
694
694
  var Fi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, ji = (i, e, t, n) => {
695
- for (var r = n > 1 ? void 0 : n ? wi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
696
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
695
+ for (var r = n > 1 ? void 0 : n ? wi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
696
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
697
697
  return n && r && Fi(e, t, r), r;
698
698
  }, k = (i, e) => (t, n) => e(t, n, i);
699
- let Se = class extends Y {
700
- constructor(i, e, t, n, r, s, o) {
701
- super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = s, this._univerInstanceService = o, this._init();
699
+ let Ce = class extends ee {
700
+ constructor(i, e, t, n, r, o, s) {
701
+ super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = o, this._univerInstanceService = s, this._init();
702
702
  }
703
703
  _initCustomComponents() {
704
704
  const i = this._componentManager;
705
- this.disposeWithMe(i.register(tt, kn)), this.disposeWithMe(i.register(xt, qt)), this.disposeWithMe(i.register(Dt, Kt)), this.disposeWithMe(i.register(Pt, Jt));
705
+ this.disposeWithMe(i.register(nt, zn)), this.disposeWithMe(i.register(Dt, Zt)), this.disposeWithMe(i.register(Pt, qt)), this.disposeWithMe(i.register(Ut, Jt));
706
706
  }
707
707
  _initMenus() {
708
708
  [
@@ -711,18 +711,18 @@ let Se = class extends Y {
711
711
  Ti,
712
712
  Ii,
713
713
  bi,
714
- Mi,
715
- Ei,
716
714
  yi,
715
+ Ei,
716
+ Mi,
717
717
  xi,
718
718
  Di,
719
719
  Pi,
720
720
  Ui,
721
- Li,
722
721
  Ni,
723
722
  Ai,
724
- $i,
725
- Bi
723
+ Li,
724
+ Bi,
725
+ $i
726
726
  ].forEach((i) => {
727
727
  this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i)));
728
728
  });
@@ -731,31 +731,31 @@ let Se = class extends Y {
731
731
  this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
732
732
  }
733
733
  _initDocBackground() {
734
- const i = this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC)[0].getUnitId();
734
+ const i = this._univerInstanceService.getAllUnitsForType(m.UNIVER_DOC)[0].getUnitId();
735
735
  if (i == null)
736
736
  return;
737
737
  this._editorService.isEditor(i) || this.disposeWithMe(
738
- this._uiController.registerComponent(Qt.CONTENT, () => Ln(Ci, this._injector))
738
+ this._uiController.registerComponent(Qt.CONTENT, () => Nn(Ci, this._injector))
739
739
  );
740
740
  }
741
741
  _initFocusHandler() {
742
742
  this.disposeWithMe(
743
- this._layoutService.registerFocusHandler(S.UNIVER_DOC, () => {
744
- this._injector.get(de).focus();
743
+ this._layoutService.registerFocusHandler(m.UNIVER_DOC, () => {
744
+ this._injector.get(ue).focus();
745
745
  })
746
746
  );
747
747
  }
748
748
  };
749
- Se = ji([
750
- N(A.Rendered, Se),
751
- k(0, O(Pe)),
752
- k(1, O(en)),
753
- k(2, bt),
749
+ Ce = ji([
750
+ L(B.Rendered, Ce),
751
+ k(0, R(Ue)),
752
+ k(1, R(en)),
753
+ k(2, yt),
754
754
  k(3, $),
755
755
  k(4, tn),
756
756
  k(5, nn),
757
- k(6, D)
758
- ], Se);
757
+ k(6, U)
758
+ ], Ce);
759
759
  const Vi = {
760
760
  toolbar: {
761
761
  undo: "Undo",
@@ -784,7 +784,7 @@ const Vi = {
784
784
  alignRight: "Align Right",
785
785
  alignJustify: "Justify"
786
786
  }
787
- }, to = Vi, Wi = {
787
+ }, qr = Vi, Wi = {
788
788
  toolbar: {
789
789
  undo: "撤销",
790
790
  redo: "重做",
@@ -812,29 +812,57 @@ const Vi = {
812
812
  alignRight: "右对齐",
813
813
  alignJustify: "两端对齐"
814
814
  }
815
- }, zi = Wi, ki = {
815
+ }, ki = Wi, zi = {
816
+ toolbar: {
817
+ undo: "Отменить",
818
+ redo: "Повторить",
819
+ font: "Шрифт",
820
+ fontSize: "Размер шрифта",
821
+ bold: "Полужирный",
822
+ italic: "Курсив",
823
+ strikethrough: "Зачеркнутый",
824
+ subscript: "Нижний индекс",
825
+ superscript: "Верхний индекс",
826
+ underline: "Подчеркнутый",
827
+ textColor: {
828
+ main: "Цвет текста",
829
+ right: "Выбрать цвет"
830
+ },
831
+ fillColor: {
832
+ main: "Цвет фона текста",
833
+ right: "Выбрать цвет"
834
+ },
835
+ resetColor: "Сбросить",
836
+ order: "Упорядоченный список",
837
+ unorder: "Неупорядоченный список",
838
+ alignLeft: "Выровнять по левому краю",
839
+ alignCenter: "Выровнять по центру",
840
+ alignRight: "Выровнять по правому краю",
841
+ alignJustify: "Выровнять по ширине"
842
+ }
843
+ }, Jr = zi, Hi = {
816
844
  id: bn.id,
817
- preconditions: Zn,
818
- binding: P.ENTER
819
- }, Hi = {
820
- id: Mn.id,
821
- preconditions: B,
822
- binding: P.BACKSPACE
845
+ preconditions: Kn,
846
+ binding: D.ENTER
823
847
  }, Yi = {
824
848
  id: yn.id,
825
- preconditions: B,
826
- binding: P.DELETE
827
- }, Xi = 10, Gi = 6;
849
+ preconditions: A,
850
+ binding: D.BACKSPACE
851
+ }, Gi = {
852
+ id: Mn.id,
853
+ preconditions: A,
854
+ binding: D.DELETE
855
+ }, Xi = 10, Ki = 6;
828
856
  function Zi() {
829
- return qe.generateRandomId(Gi);
857
+ return qe.generateRandomId(Ki);
830
858
  }
831
859
  function qi(i) {
832
860
  const e = i.match(/data-copy-id="([^\s]+)"/);
833
861
  return e && e[1] ? e[1] : null;
834
862
  }
835
- class Ki {
863
+ class Ji {
836
864
  constructor() {
837
- m(this, "_cache", new jt(Xi));
865
+ p(this, "_cache", new wt(Xi));
838
866
  }
839
867
  set(e, t) {
840
868
  this._cache.set(e, t);
@@ -846,8 +874,8 @@ class Ki {
846
874
  this._cache.clear();
847
875
  }
848
876
  }
849
- const ft = new Ki();
850
- function nt(i) {
877
+ const mt = new Ji();
878
+ function it(i) {
851
879
  const e = i.style, t = {}, n = i.tagName.toLowerCase();
852
880
  switch (n) {
853
881
  case "b":
@@ -879,44 +907,44 @@ function nt(i) {
879
907
  }
880
908
  }
881
909
  for (let r = 0; r < e.length; r++) {
882
- const s = e[r], o = e.getPropertyValue(s);
883
- switch (s) {
910
+ const o = e[r], s = e.getPropertyValue(o);
911
+ switch (o) {
884
912
  case "font-family": {
885
- t.ff = o;
913
+ t.ff = s;
886
914
  break;
887
915
  }
888
916
  case "font-size": {
889
- const a = Number.parseInt(o);
890
- Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs = Nn(a)));
917
+ const a = Number.parseInt(s);
918
+ Number.isNaN(a) || (s.endsWith("pt") ? t.fs = a : s.endsWith("px") && (t.fs = An(a)));
891
919
  break;
892
920
  }
893
921
  case "font-style": {
894
- o === "italic" && (t.it = C.TRUE);
922
+ s === "italic" && (t.it = C.TRUE);
895
923
  break;
896
924
  }
897
925
  case "font-weight": {
898
- Number(o) > 400 && (t.bl = C.TRUE);
926
+ Number(s) > 400 && (t.bl = C.TRUE);
899
927
  break;
900
928
  }
901
929
  case "text-decoration": {
902
- /underline/.test(o) ? t.ul = {
930
+ /underline/.test(s) ? t.ul = {
903
931
  s: C.TRUE
904
- } : /overline/.test(o) ? t.ol = {
932
+ } : /overline/.test(s) ? t.ol = {
905
933
  s: C.TRUE
906
- } : /line-through/.test(o) && (t.st = {
934
+ } : /line-through/.test(s) && (t.st = {
907
935
  s: C.TRUE
908
936
  });
909
937
  break;
910
938
  }
911
939
  case "color": {
912
- const a = new rt(o);
940
+ const a = new ot(s);
913
941
  a.isValid && (t.cl = {
914
942
  rgb: a.toRgbString()
915
943
  });
916
944
  break;
917
945
  }
918
946
  case "background-color": {
919
- const a = new rt(o);
947
+ const a = new ot(s);
920
948
  a.isValid && (t.bg = {
921
949
  rgb: a.toRgbString()
922
950
  });
@@ -926,19 +954,19 @@ function nt(i) {
926
954
  }
927
955
  return t;
928
956
  }
929
- function Ji(i) {
957
+ function Qi(i) {
930
958
  const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
931
959
  return e.parseFromString(t, "text/html").querySelector("#univer-root");
932
960
  }
933
- function mt(i, e) {
961
+ function St(i, e) {
934
962
  const t = i.tagName.toLowerCase();
935
963
  return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
936
964
  }
937
- const Ee = class Ee {
965
+ const xe = class xe {
938
966
  constructor() {
939
- m(this, "_styleCache", /* @__PURE__ */ new Map());
940
- m(this, "_styleRules", []);
941
- m(this, "_afterProcessRules", []);
967
+ p(this, "_styleCache", /* @__PURE__ */ new Map());
968
+ p(this, "_styleRules", []);
969
+ p(this, "_afterProcessRules", []);
942
970
  }
943
971
  static use(e) {
944
972
  if (this._pluginList.includes(e))
@@ -946,7 +974,7 @@ const Ee = class Ee {
946
974
  this._pluginList.push(e);
947
975
  }
948
976
  convert(e) {
949
- const t = Ee._pluginList.find((s) => s.checkPasteType(e)), n = Ji(e), r = {
977
+ const t = xe._pluginList.find((o) => o.checkPasteType(e)), n = Qi(e), r = {
950
978
  dataStream: "",
951
979
  textRuns: []
952
980
  };
@@ -954,30 +982,30 @@ const Ee = class Ee {
954
982
  }
955
983
  _process(e, t, n) {
956
984
  var r;
957
- for (const s of t)
958
- if (s.nodeType === Node.TEXT_NODE) {
959
- const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
985
+ for (const o of t)
986
+ if (o.nodeType === Node.TEXT_NODE) {
987
+ const s = (r = o.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
960
988
  let a;
961
- e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
962
- st: n.dataStream.length - o.length,
989
+ e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += s, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
990
+ st: n.dataStream.length - s.length,
963
991
  ed: n.dataStream.length,
964
992
  ts: a
965
993
  });
966
- } else if (s.nodeType === Node.ELEMENT_NODE) {
967
- const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => mt(s, h)), c = a ? a.getStyle(s) : nt(s);
968
- this._styleCache.set(s, { ...o, ...c });
969
- const { childNodes: d } = s;
970
- this._process(s, d, n);
994
+ } else if (o.nodeType === Node.ELEMENT_NODE) {
995
+ const s = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => St(o, h)), c = a ? a.getStyle(o) : it(o);
996
+ this._styleCache.set(o, { ...s, ...c });
997
+ const { childNodes: l } = o;
998
+ this._process(o, l, n);
971
999
  const u = this._afterProcessRules.find(
972
- ({ filter: h }) => mt(s, h)
1000
+ ({ filter: h }) => St(o, h)
973
1001
  );
974
- u && u.handler(n, s);
1002
+ u && u.handler(n, o);
975
1003
  }
976
1004
  }
977
1005
  };
978
- m(Ee, "_pluginList", []);
979
- let Q = Ee;
980
- const Qi = {
1006
+ p(xe, "_pluginList", []);
1007
+ let Q = xe;
1008
+ const er = {
981
1009
  name: "univer-doc-paste-plugin-lark",
982
1010
  checkPasteType(i) {
983
1011
  return /lark-record-clipboard/i.test(i);
@@ -987,7 +1015,7 @@ const Qi = {
987
1015
  {
988
1016
  filter: ["s"],
989
1017
  getStyle(i) {
990
- const e = nt(i);
1018
+ const e = it(i);
991
1019
  return {
992
1020
  st: {
993
1021
  s: C.TRUE
@@ -1009,32 +1037,32 @@ const Qi = {
1009
1037
  }
1010
1038
  }
1011
1039
  ]
1012
- }, er = Qi;
1013
- function Nt(i) {
1040
+ }, tr = er;
1041
+ function Lt(i) {
1014
1042
  const e = i.style, t = {};
1015
1043
  for (let n = 0; n < e.length; n++) {
1016
- const r = e[n], s = e.getPropertyValue(r);
1044
+ const r = e[n], o = e.getPropertyValue(r);
1017
1045
  switch (r) {
1018
1046
  case "margin-top": {
1019
- const o = Number.parseInt(s);
1020
- t.spaceAbove = /pt/.test(s) ? dt(o) : o;
1047
+ const s = Number.parseInt(o);
1048
+ t.spaceAbove = /pt/.test(o) ? ut(s) : s;
1021
1049
  break;
1022
1050
  }
1023
1051
  case "margin-bottom": {
1024
- const o = Number.parseInt(s);
1025
- t.spaceBelow = /pt/.test(s) ? dt(o) : o;
1052
+ const s = Number.parseInt(o);
1053
+ t.spaceBelow = /pt/.test(o) ? ut(s) : s;
1026
1054
  break;
1027
1055
  }
1028
1056
  case "line-height": {
1029
- const o = Number.parseFloat(s);
1030
- t.lineSpacing = o;
1057
+ const s = Number.parseFloat(o);
1058
+ t.lineSpacing = s;
1031
1059
  break;
1032
1060
  }
1033
1061
  }
1034
1062
  }
1035
1063
  return Object.getOwnPropertyNames(t).length ? t : null;
1036
1064
  }
1037
- const tr = {
1065
+ const nr = {
1038
1066
  name: "univer-doc-paste-plugin-word",
1039
1067
  checkPasteType(i) {
1040
1068
  return /word|mso/i.test(i);
@@ -1043,7 +1071,7 @@ const tr = {
1043
1071
  {
1044
1072
  filter: ["b"],
1045
1073
  getStyle(i) {
1046
- const e = nt(i);
1074
+ const e = it(i);
1047
1075
  return { bl: C.TRUE, ...e };
1048
1076
  }
1049
1077
  }
@@ -1057,12 +1085,12 @@ const tr = {
1057
1085
  i.paragraphs == null && (i.paragraphs = []);
1058
1086
  const t = {
1059
1087
  startIndex: i.dataStream.length
1060
- }, n = Nt(e);
1088
+ }, n = Lt(e);
1061
1089
  n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
1062
1090
  }
1063
1091
  }
1064
1092
  ]
1065
- }, nr = tr, ir = {
1093
+ }, ir = nr, rr = {
1066
1094
  name: "univer-doc-paste-plugin-univer",
1067
1095
  checkPasteType(i) {
1068
1096
  return /UniverNormal/i.test(i);
@@ -1077,69 +1105,69 @@ const tr = {
1077
1105
  i.paragraphs == null && (i.paragraphs = []);
1078
1106
  const t = {
1079
1107
  startIndex: i.dataStream.length
1080
- }, n = Nt(e);
1108
+ }, n = Lt(e);
1081
1109
  n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
1082
1110
  }
1083
1111
  }
1084
1112
  ]
1085
- }, rr = ir;
1086
- function St(i, e) {
1087
- const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg: p, cl: g, va: f } = r;
1088
- let l = i.slice(t, n);
1113
+ }, or = rr;
1114
+ function vt(i, e) {
1115
+ const { st: t, ed: n, ts: r = {} } = e, { ff: o, fs: s, it: a, bl: c, ul: l, st: u, ol: h, bg: f, cl: g, va: S } = r;
1116
+ let d = i.slice(t, n);
1089
1117
  const _ = [];
1090
- return a === C.TRUE && (l = `<i>${l}</i>`), f === J.SUPERSCRIPT ? l = `<sup>${l}</sup>` : f === J.SUBSCRIPT && (l = `<sub>${l}</sub>`), (d == null ? void 0 : d.s) === C.TRUE && (l = `<u>${l}</u>`), (u == null ? void 0 : u.s) === C.TRUE && (l = `<s>${l}</s>`), c === C.TRUE && (l = `<strong>${l}</strong>`), s && _.push(`font-family: ${s}`), g && _.push(`color: ${g.rgb}`), o && _.push(`font-size: ${o}pt`), h && _.push("text-decoration: overline"), p && _.push(`background: ${p.rgb}`), _.length ? `<span style="${_.join("; ")};">${l}</span>` : l;
1118
+ return a === C.TRUE && (d = `<i>${d}</i>`), S === J.SUPERSCRIPT ? d = `<sup>${d}</sup>` : S === J.SUBSCRIPT && (d = `<sub>${d}</sub>`), (l == null ? void 0 : l.s) === C.TRUE && (d = `<u>${d}</u>`), (u == null ? void 0 : u.s) === C.TRUE && (d = `<s>${d}</s>`), c === C.TRUE && (d = `<strong>${d}</strong>`), o && _.push(`font-family: ${o}`), g && _.push(`color: ${g.rgb}`), s && _.push(`font-size: ${s}pt`), h && _.push("text-decoration: overline"), f && _.push(`background: ${f.rgb}`), _.length ? `<span style="${_.join("; ")};">${d}</span>` : d;
1091
1119
  }
1092
- function Ve(i, e, t) {
1120
+ function ke(i, e, t) {
1093
1121
  const { dataStream: n, textRuns: r = [] } = i;
1094
- let s = e;
1095
- const o = [];
1122
+ let o = e;
1123
+ const s = [];
1096
1124
  for (const a of r) {
1097
- const { st: c, ed: d } = a;
1098
- qe.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(St(n, {
1125
+ const { st: c, ed: l } = a;
1126
+ qe.hasIntersectionBetweenTwoRanges(e, t, c, l) && (c > o ? (s.push(n.slice(o, c)), s.push(vt(n, {
1099
1127
  ...a,
1100
- ed: Math.min(d, t)
1101
- }))) : o.push(St(n, {
1128
+ ed: Math.min(l, t)
1129
+ }))) : s.push(vt(n, {
1102
1130
  ...a,
1103
- st: s,
1104
- ed: Math.min(d, t)
1105
- }))), s = Math.max(e, Math.min(d, t));
1131
+ st: o,
1132
+ ed: Math.min(l, t)
1133
+ }))), o = Math.max(e, Math.min(l, t));
1106
1134
  }
1107
- return s !== t && o.push(n.slice(s, t)), o.join("");
1135
+ return o !== t && s.push(n.slice(o, t)), s.join("");
1108
1136
  }
1109
- function vt(i, e = !0) {
1137
+ function Ct(i, e = !0) {
1110
1138
  var t;
1111
1139
  if (e && ((t = i.paragraphs) != null && t.length)) {
1112
1140
  const { dataStream: n, paragraphs: r = [] } = i;
1113
- let s = "", o = -1;
1141
+ let o = "", s = -1;
1114
1142
  for (const a of r) {
1115
- const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: p } = d, g = [];
1116
- u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), p != null && g.push(`line-height: ${p}`), c > o + 1 ? s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${Ve(i, o + 1, c)}</p>` : s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, o = c;
1143
+ const { startIndex: c, paragraphStyle: l = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: f } = l, g = [];
1144
+ u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), f != null && g.push(`line-height: ${f}`), c > s + 1 ? o += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${ke(i, s + 1, c)}</p>` : o += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, s = c;
1117
1145
  }
1118
- return o !== n.length && (s += Ve(i, o, n.length)), s;
1146
+ return s !== n.length && (o += ke(i, s, n.length)), o;
1119
1147
  } else
1120
- return Ve(i, 0, i.dataStream.length);
1148
+ return ke(i, 0, i.dataStream.length);
1121
1149
  }
1122
- class or {
1150
+ class sr {
1123
1151
  convert(e) {
1124
1152
  if (e.length === 0)
1125
1153
  throw new Error("The bodyList length at least to be 1");
1126
1154
  if (e.length === 1)
1127
- return vt(e[0]);
1155
+ return Ct(e[0]);
1128
1156
  let t = "";
1129
1157
  for (const n of e)
1130
- t += '<p className="UniverNormal">', t += vt(n, !1), t += "</p>";
1158
+ t += '<p className="UniverNormal">', t += Ct(n, !1), t += "</p>";
1131
1159
  return t;
1132
1160
  }
1133
1161
  }
1134
- var sr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, cr = (i, e, t, n) => {
1135
- for (var r = n > 1 ? void 0 : n ? ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1136
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1137
- return n && r && sr(e, t, r), r;
1138
- }, ie = (i, e) => (t, n) => e(t, n, i);
1139
- Q.use(nr);
1140
- Q.use(er);
1141
- Q.use(rr);
1142
- function lr(i) {
1162
+ var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (i, e, t, n) => {
1163
+ for (var r = n > 1 ? void 0 : n ? cr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1164
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1165
+ return n && r && ar(e, t, r), r;
1166
+ }, re = (i, e) => (t, n) => e(t, n, i);
1167
+ Q.use(ir);
1168
+ Q.use(tr);
1169
+ Q.use(or);
1170
+ function dr(i) {
1143
1171
  const e = i.replace(/\n/g, "\r"), t = [];
1144
1172
  for (let n = 0; n < e.length; n++)
1145
1173
  e[n] === "\r" && t.push({ startIndex: n });
@@ -1148,14 +1176,14 @@ function lr(i) {
1148
1176
  paragraphs: t
1149
1177
  };
1150
1178
  }
1151
- const ue = Gt("doc.clipboard-service");
1152
- let Xe = class extends Y {
1153
- constructor(e, t, n, r, s) {
1179
+ const he = Xt("doc.clipboard-service");
1180
+ let Xe = class extends ee {
1181
+ constructor(e, t, n, r, o) {
1154
1182
  super();
1155
- m(this, "_clipboardHooks", []);
1156
- m(this, "_htmlToUDM", new Q());
1157
- m(this, "_umdToHtml", new or());
1158
- this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = s;
1183
+ p(this, "_clipboardHooks", []);
1184
+ p(this, "_htmlToUDM", new Q());
1185
+ p(this, "_umdToHtml", new sr());
1186
+ this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = o;
1159
1187
  }
1160
1188
  async copy() {
1161
1189
  const e = this._getDocumentBodyInRanges();
@@ -1180,25 +1208,25 @@ let Xe = class extends Y {
1180
1208
  return this._paste(n);
1181
1209
  }
1182
1210
  async _cut() {
1183
- var s;
1211
+ var o;
1184
1212
  const {
1185
1213
  segmentId: e,
1186
1214
  endOffset: t,
1187
1215
  style: n
1188
- } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, r = this._textSelectionManagerService.getSelections();
1216
+ } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, r = this._textSelectionManagerService.getSelections();
1189
1217
  if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || r == null)
1190
1218
  return !1;
1191
1219
  this.copy();
1192
1220
  try {
1193
- let o = t;
1221
+ let s = t;
1194
1222
  for (const c of r) {
1195
- const { startOffset: d, endOffset: u } = c;
1196
- d == null || u == null || u <= t && (o -= u - d);
1223
+ const { startOffset: l, endOffset: u } = c;
1224
+ l == null || u == null || u <= t && (s -= u - l);
1197
1225
  }
1198
1226
  const a = [
1199
1227
  {
1200
- startOffset: o,
1201
- endOffset: o,
1228
+ startOffset: s,
1229
+ endOffset: s,
1202
1230
  style: n
1203
1231
  }
1204
1232
  ];
@@ -1208,14 +1236,14 @@ let Xe = class extends Y {
1208
1236
  }
1209
1237
  }
1210
1238
  async _paste(e) {
1211
- var o;
1212
- const { segmentId: t, endOffset: n, style: r } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, s = this._textSelectionManagerService.getSelections();
1213
- if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || s == null)
1239
+ var s;
1240
+ const { segmentId: t, endOffset: n, style: r } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, o = this._textSelectionManagerService.getSelections();
1241
+ if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || o == null)
1214
1242
  return !1;
1215
1243
  try {
1216
1244
  let a = n;
1217
- for (const d of s) {
1218
- const { startOffset: u, endOffset: h } = d;
1245
+ for (const l of o) {
1246
+ const { startOffset: u, endOffset: h } = l;
1219
1247
  u == null || h == null || h <= n && (a += e.dataStream.length - (h - u));
1220
1248
  }
1221
1249
  const c = [
@@ -1225,19 +1253,19 @@ let Xe = class extends Y {
1225
1253
  style: r
1226
1254
  }
1227
1255
  ];
1228
- return this._commandService.executeCommand(yt.id, { body: e, segmentId: t, textRanges: c });
1256
+ return this._commandService.executeCommand(Et.id, { body: e, segmentId: t, textRanges: c });
1229
1257
  } catch {
1230
1258
  return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
1231
1259
  }
1232
1260
  }
1233
1261
  async _setClipboardData(e) {
1234
- const t = Zi(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1262
+ const t = Zi(), n = e.length > 1 ? e.map((o) => o.dataStream).join(`
1235
1263
  `) : e[0].dataStream;
1236
1264
  let r = this._umdToHtml.convert(e);
1237
- return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), ft.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
1265
+ return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (o, s) => `${s} data-copy-id="${t}"`), mt.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
1238
1266
  }
1239
1267
  addClipboardHook(e) {
1240
- return this._clipboardHooks.push(e), F(() => {
1268
+ return this._clipboardHooks.push(e), j(() => {
1241
1269
  const t = this._clipboardHooks.indexOf(e);
1242
1270
  t > -1 && this._clipboardHooks.splice(t, 1);
1243
1271
  });
@@ -1247,10 +1275,10 @@ let Xe = class extends Y {
1247
1275
  if (e == null || !t)
1248
1276
  return n;
1249
1277
  for (const r of e) {
1250
- const { startOffset: s, endOffset: o, collapsed: a } = r;
1251
- if (a || s == null || o == null)
1278
+ const { startOffset: o, endOffset: s, collapsed: a } = r;
1279
+ if (a || o == null || s == null)
1252
1280
  continue;
1253
- const c = t.sliceBody(s, o);
1281
+ const c = t.sliceBody(o, s);
1254
1282
  c != null && n.push(c);
1255
1283
  }
1256
1284
  return n;
@@ -1259,8 +1287,8 @@ let Xe = class extends Y {
1259
1287
  try {
1260
1288
  let t = "", n = "";
1261
1289
  for (const r of e)
1262
- for (const s of r.types)
1263
- s === rn ? n = await r.getType(s).then((o) => o && o.text()) : s === on && (t = await r.getType(s).then((o) => o && o.text()));
1290
+ for (const o of r.types)
1291
+ o === rn ? n = await r.getType(o).then((s) => s && s.text()) : o === on && (t = await r.getType(o).then((s) => s && s.text()));
1264
1292
  return this._generateBodyFromHtmlAndText(t, n);
1265
1293
  } catch (t) {
1266
1294
  return Promise.reject(t);
@@ -1269,98 +1297,98 @@ let Xe = class extends Y {
1269
1297
  _generateBodyFromHtmlAndText(e, t) {
1270
1298
  if (!e) {
1271
1299
  if (t)
1272
- return lr(t);
1300
+ return dr(t);
1273
1301
  throw new Error("[DocClipboardService] html and text cannot be both empty!");
1274
1302
  }
1275
1303
  const n = qi(e);
1276
1304
  if (n) {
1277
- const r = ft.get(n);
1305
+ const r = mt.get(n);
1278
1306
  if (r)
1279
1307
  return r;
1280
1308
  }
1281
1309
  return this._htmlToUDM.convert(e);
1282
1310
  }
1283
1311
  };
1284
- Xe = cr([
1285
- ie(0, D),
1286
- ie(1, It),
1287
- ie(2, v),
1288
- ie(3, Je),
1289
- ie(4, O(te))
1312
+ Xe = lr([
1313
+ re(0, U),
1314
+ re(1, bt),
1315
+ re(2, v),
1316
+ re(3, Qe),
1317
+ re(4, R(ne))
1290
1318
  ], Xe);
1291
- function we(i) {
1292
- return i.getContextValue(xe) || i.getContextValue(Rt);
1319
+ function je(i) {
1320
+ return i.getContextValue(De) || i.getContextValue(Tt);
1293
1321
  }
1294
- const it = 999, dr = {
1322
+ const rt = 999, ur = {
1295
1323
  id: sn.id,
1296
1324
  name: "doc.command.copy",
1297
- type: Ke.COMMAND,
1325
+ type: Je.COMMAND,
1298
1326
  multi: !0,
1299
- priority: it,
1300
- preconditions: we,
1301
- handler: async (i) => i.get(ue).copy()
1302
- }, ur = {
1327
+ priority: rt,
1328
+ preconditions: je,
1329
+ handler: async (i) => i.get(he).copy()
1330
+ }, hr = {
1303
1331
  id: an.id,
1304
1332
  name: "doc.command.cut",
1305
- type: Ke.COMMAND,
1333
+ type: Je.COMMAND,
1306
1334
  multi: !0,
1307
- priority: it,
1308
- preconditions: we,
1309
- handler: async (i) => i.get(ue).cut()
1310
- }, hr = {
1335
+ priority: rt,
1336
+ preconditions: je,
1337
+ handler: async (i) => i.get(he).cut()
1338
+ }, gr = {
1311
1339
  id: cn.id,
1312
1340
  name: "doc.command.paste",
1313
- type: Ke.COMMAND,
1341
+ type: Je.COMMAND,
1314
1342
  multi: !0,
1315
- priority: it,
1316
- preconditions: we,
1343
+ priority: rt,
1344
+ preconditions: je,
1317
1345
  handler: async (i) => {
1318
- const e = i.get(ue), n = await i.get(Je).read();
1346
+ const e = i.get(he), n = await i.get(Qe).read();
1319
1347
  return n.length === 0 ? !1 : e.paste(n);
1320
1348
  }
1321
1349
  };
1322
- var gr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, pr = (i, e, t, n) => {
1323
- for (var r = n > 1 ? void 0 : n ? _r(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1324
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1325
- return n && r && gr(e, t, r), r;
1326
- }, re = (i, e) => (t, n) => e(t, n, i);
1327
- let ve = class extends ce {
1350
+ var _r = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, fr = (i, e, t, n) => {
1351
+ for (var r = n > 1 ? void 0 : n ? pr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1352
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1353
+ return n && r && _r(e, t, r), r;
1354
+ }, oe = (i, e) => (t, n) => e(t, n, i);
1355
+ let Oe = class extends le {
1328
1356
  constructor(i, e, t, n, r) {
1329
1357
  super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
1330
1358
  }
1331
1359
  _init() {
1332
- [dr, ur, hr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [yt, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
1360
+ [ur, hr, gr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [Et, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
1333
1361
  }
1334
1362
  _initLegacyPasteCommand() {
1335
1363
  var i;
1336
- (i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(ae(this.dispose$)).subscribe((e) => {
1337
- var s, o;
1338
- if (!we(this._contextService))
1364
+ (i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(ce(this.dispose$)).subscribe((e) => {
1365
+ var o, s;
1366
+ if (!je(this._contextService))
1339
1367
  return;
1340
1368
  e.event.preventDefault();
1341
- const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), r = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
1369
+ const t = e.event, n = (o = t.clipboardData) == null ? void 0 : o.getData("text/html"), r = (s = t.clipboardData) == null ? void 0 : s.getData("text/plain");
1342
1370
  this._docClipboardService.legacyPaste(n, r);
1343
1371
  });
1344
1372
  }
1345
1373
  };
1346
- ve = pr([
1347
- N(A.Rendered, ve),
1348
- re(0, v),
1349
- re(1, Je),
1350
- re(2, ue),
1351
- re(3, de),
1352
- re(4, Vt)
1353
- ], ve);
1354
- var fr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (i, e, t, n) => {
1355
- for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1356
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1357
- return n && r && fr(e, t, r), r;
1358
- }, Z = (i, e) => (t, n) => e(t, n, i);
1359
- let Ce = class extends Y {
1360
- constructor(e, t, n, r, s, o) {
1374
+ Oe = fr([
1375
+ L(B.Rendered, Oe),
1376
+ oe(0, v),
1377
+ oe(1, Qe),
1378
+ oe(2, he),
1379
+ oe(3, ue),
1380
+ oe(4, jt)
1381
+ ], Oe);
1382
+ var mr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, vr = (i, e, t, n) => {
1383
+ for (var r = n > 1 ? void 0 : n ? Sr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1384
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1385
+ return n && r && mr(e, t, r), r;
1386
+ }, X = (i, e) => (t, n) => e(t, n, i);
1387
+ let Re = class extends ee {
1388
+ constructor(e, t, n, r, o, s) {
1361
1389
  super();
1362
- m(this, "_initialEditors", /* @__PURE__ */ new Set());
1363
- this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
1390
+ p(this, "_initialEditors", /* @__PURE__ */ new Set());
1391
+ this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = o, this._renderManagerService = s, this._initialize();
1364
1392
  }
1365
1393
  _initialize() {
1366
1394
  this.disposeWithMe(
@@ -1373,26 +1401,26 @@ let Ce = class extends Y {
1373
1401
  }), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
1374
1402
  }
1375
1403
  _resize(e) {
1376
- var L, w, j;
1404
+ var N, F, w;
1377
1405
  if (e == null)
1378
1406
  return;
1379
1407
  const t = this._editorService.getEditor(e);
1380
1408
  if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
1381
1409
  return;
1382
- const n = (L = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : L.skeleton, r = this._univerInstanceService.getUniverDocInstance(e);
1410
+ const n = (N = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : N.skeleton, r = this._univerInstanceService.getUniverDocInstance(e);
1383
1411
  if (t == null || t.render == null || n == null || r == null)
1384
1412
  return;
1385
1413
  n.calculate();
1386
- const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
1387
- let { actualHeight: h, actualWidth: p } = n.getActualSize();
1388
- h += s + o, p += a + c;
1389
- const { width: g, height: f } = t.getBoundingClientRect(), l = d.getViewport(Ae.VIEW_MAIN);
1390
- let _ = l == null ? void 0 : l.getScrollBar();
1391
- const R = Math.max(p, g), y = Math.max(h, f);
1392
- d.transformByState({
1393
- width: R,
1394
- height: y
1395
- }), u == null || u.resize(R, y), t.isSingle() ? p > g ? _ == null ? l && new He(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (j = l == null ? void 0 : l.getScrollBar()) == null || j.dispose()) : h > f ? _ == null ? l && new He(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (w = l == null ? void 0 : l.getScrollBar()) == null || w.dispose());
1414
+ const { marginTop: o = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: l, mainComponent: u } = t.render;
1415
+ let { actualHeight: h, actualWidth: f } = n.getActualSize();
1416
+ h += o + s, f += a + c;
1417
+ const { width: g, height: S } = t.getBoundingClientRect(), d = l.getViewport(Be.VIEW_MAIN);
1418
+ let _ = d == null ? void 0 : d.getScrollBar();
1419
+ const O = Math.max(f, g), E = Math.max(h, S);
1420
+ l.transformByState({
1421
+ width: O,
1422
+ height: E
1423
+ }), u == null || u.resize(O, E), t.isSingle() ? f > g ? _ == null ? d && new Ye(d, { barSize: 8, enableVertical: !1 }) : d == null || d.resetSizeAndScrollBar() : (_ = null, d == null || d.scrollTo({ x: 0, y: 0 }), (w = d == null ? void 0 : d.getScrollBar()) == null || w.dispose()) : h > S ? _ == null ? d && new Ye(d, { enableHorizontal: !1, barSize: 8 }) : d == null || d.resetSizeAndScrollBar() : (_ = null, d == null || d.scrollTo({ x: 0, y: 0 }), (F = d == null ? void 0 : d.getScrollBar()) == null || F.dispose());
1396
1424
  }
1397
1425
  _initialSetValue() {
1398
1426
  this.disposeWithMe(
@@ -1434,17 +1462,17 @@ let Ce = class extends Y {
1434
1462
  "univer-formula-help-param"
1435
1463
  ];
1436
1464
  this.disposeWithMe(
1437
- _t(window, "mousedown").subscribe((n) => {
1438
- const s = n.target.classList[0] || "";
1439
- if (Wt(s, e)) {
1465
+ pt(window, "mousedown").subscribe((n) => {
1466
+ const o = n.target.classList[0] || "";
1467
+ if (Vt(o, e)) {
1440
1468
  this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
1441
1469
  return;
1442
1470
  }
1443
1471
  this._editorService.changeSpreadsheetFocusState(!1);
1444
1472
  })
1445
- ), this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).forEach((n) => {
1446
- const r = n.getUnitId(), s = this._renderManagerService.getRenderById(r), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
1447
- o != null && _t(o, "mousedown").subscribe((a) => {
1473
+ ), this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).forEach((n) => {
1474
+ const r = n.getUnitId(), o = this._renderManagerService.getRenderById(r), s = o == null ? void 0 : o.engine.getCanvas().getCanvasEle();
1475
+ s != null && pt(s, "mousedown").subscribe((a) => {
1448
1476
  this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
1449
1477
  });
1450
1478
  });
@@ -1472,7 +1500,7 @@ let Ce = class extends Y {
1472
1500
  * Listen to document edits to refresh the size of the normula editor.
1473
1501
  */
1474
1502
  _commandExecutedListener() {
1475
- const e = [Qe.id, ln.id];
1503
+ const e = [et.id, ln.id];
1476
1504
  this.disposeWithMe(
1477
1505
  this._commandService.onCommandExecuted((t) => {
1478
1506
  if (e.includes(t.id)) {
@@ -1485,28 +1513,28 @@ let Ce = class extends Y {
1485
1513
  );
1486
1514
  }
1487
1515
  };
1488
- Ce = Sr([
1489
- N(A.Rendered, Ce),
1490
- Z(0, D),
1491
- Z(1, O(ne)),
1492
- Z(2, $),
1493
- Z(3, v),
1494
- Z(4, de),
1495
- Z(5, W)
1496
- ], Ce);
1497
- var vr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Or = (i, e, t, n) => {
1498
- for (var r = n > 1 ? void 0 : n ? Cr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1499
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1500
- return n && r && vr(e, t, r), r;
1501
- }, pe = (i, e) => (t, n) => e(t, n, i);
1502
- let Oe = class extends ce {
1516
+ Re = vr([
1517
+ L(B.Rendered, Re),
1518
+ X(0, U),
1519
+ X(1, R(ie)),
1520
+ X(2, $),
1521
+ X(3, v),
1522
+ X(4, ue),
1523
+ X(5, H)
1524
+ ], Re);
1525
+ var Cr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, Rr = (i, e, t, n) => {
1526
+ for (var r = n > 1 ? void 0 : n ? Or(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1527
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1528
+ return n && r && Cr(e, t, r), r;
1529
+ }, me = (i, e) => (t, n) => e(t, n, i);
1530
+ let Te = class extends le {
1503
1531
  constructor(e, t, n, r) {
1504
1532
  super();
1505
- m(this, "_docRenderMap", /* @__PURE__ */ new Set());
1533
+ p(this, "_docRenderMap", /* @__PURE__ */ new Set());
1506
1534
  this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
1507
1535
  }
1508
1536
  _initialRenderRefresh() {
1509
- this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ae(this.dispose$)).subscribe((e) => {
1537
+ this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ce(this.dispose$)).subscribe((e) => {
1510
1538
  this._create(e);
1511
1539
  });
1512
1540
  }
@@ -1516,34 +1544,34 @@ let Oe = class extends ce {
1516
1544
  const { skeleton: t, unitId: n } = e;
1517
1545
  let r = this._renderManagerService.getRenderById(n);
1518
1546
  r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
1519
- const { mainComponent: s } = r;
1520
- s.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
1547
+ const { mainComponent: o, components: s } = r, a = o, c = s.get(q.BACKGROUND);
1548
+ a.changeSkeleton(t), c.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
1521
1549
  }
1522
1550
  _recalculateSizeBySkeleton(e, t) {
1523
- var u;
1524
- const { mainComponent: n, scene: r, unitId: s } = e, o = n, a = (u = t.getSkeletonData()) == null ? void 0 : u.pages;
1525
- if (a == null)
1551
+ var f;
1552
+ const { mainComponent: n, scene: r, unitId: o, components: s } = e, a = n, c = s.get(q.BACKGROUND), l = (f = t.getSkeletonData()) == null ? void 0 : f.pages;
1553
+ if (l == null)
1526
1554
  return;
1527
- let c = 0, d = 0;
1528
- for (let h = 0, p = a.length; h < p; h++) {
1529
- const g = a[h], { pageWidth: f, pageHeight: l } = g;
1530
- o.pageLayoutType === ut.VERTICAL ? (d += l, d += o.pageMarginTop, h === p - 1 && (d += o.pageMarginTop), c = Math.max(c, f)) : o.pageLayoutType === ut.HORIZONTAL && (c += f, h !== p - 1 && (c += o.pageMarginLeft), d = Math.max(d, l));
1555
+ let u = 0, h = 0;
1556
+ for (let g = 0, S = l.length; g < S; g++) {
1557
+ const d = l[g], { pageWidth: _, pageHeight: O } = d;
1558
+ a.pageLayoutType === ht.VERTICAL ? (h += O, h += a.pageMarginTop, g === S - 1 && (h += a.pageMarginTop), u = Math.max(u, _)) : a.pageLayoutType === ht.HORIZONTAL && (u += _, g !== S - 1 && (u += a.pageMarginLeft), h = Math.max(h, O));
1531
1559
  }
1532
- o.resize(c, d), this._editorService.isEditor(s) || r.resize(c, d);
1560
+ a.resize(u, h), c.resize(u, h), this._editorService.isEditor(o) || r.resize(u, h);
1533
1561
  }
1534
1562
  _commandExecutedListener() {
1535
- const e = [Qe.id];
1563
+ const e = [et.id];
1536
1564
  this.disposeWithMe(
1537
1565
  this._commandService.onCommandExecuted((t) => {
1538
1566
  var n;
1539
1567
  if (e.includes(t.id)) {
1540
- const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
1541
- if (o == null)
1568
+ const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getSkeletonByUnitId(o);
1569
+ if (s == null)
1542
1570
  return;
1543
- const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
1571
+ const { skeleton: a } = s, c = this._renderManagerService.getRenderById(o);
1544
1572
  if (c == null || !!a.getViewModel().getDataModel().getSnapshot().disabled)
1545
1573
  return;
1546
- if (a.calculate(), this._editorService.isEditor(s)) {
1574
+ if (a.calculate(), this._editorService.isEditor(o)) {
1547
1575
  (n = c.mainComponent) == null || n.makeDirty();
1548
1576
  return;
1549
1577
  }
@@ -1553,33 +1581,33 @@ let Oe = class extends ce {
1553
1581
  );
1554
1582
  }
1555
1583
  };
1556
- Oe = Or([
1557
- N(A.Rendered, Oe),
1558
- pe(0, O(ne)),
1559
- pe(1, W),
1560
- pe(2, v),
1561
- pe(3, $)
1562
- ], Oe);
1563
- var Rr = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ir = (i, e, t, n) => {
1564
- for (var r = n > 1 ? void 0 : n ? Tr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1565
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1566
- return n && r && Rr(e, t, r), r;
1567
- }, fe = (i, e) => (t, n) => e(t, n, i);
1568
- let Re = class extends ce {
1584
+ Te = Rr([
1585
+ L(B.Rendered, Te),
1586
+ me(0, R(ie)),
1587
+ me(1, H),
1588
+ me(2, v),
1589
+ me(3, $)
1590
+ ], Te);
1591
+ var Tr = Object.defineProperty, Ir = Object.getOwnPropertyDescriptor, br = (i, e, t, n) => {
1592
+ for (var r = n > 1 ? void 0 : n ? Ir(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1593
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1594
+ return n && r && Tr(e, t, r), r;
1595
+ }, Se = (i, e) => (t, n) => e(t, n, i);
1596
+ let Ie = class extends le {
1569
1597
  constructor(e, t, n, r) {
1570
1598
  super();
1571
- m(this, "_scene");
1572
- m(this, "_currentDocumentModel");
1573
- m(this, "_fps$", new zn(""));
1574
- m(this, "fps$", this._fps$.asObservable());
1599
+ p(this, "_scene");
1600
+ p(this, "_currentDocumentModel");
1601
+ p(this, "_fps$", new kn(""));
1602
+ p(this, "fps$", this._fps$.asObservable());
1575
1603
  this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
1576
1604
  }
1577
1605
  _initialize() {
1578
- this._renderManagerService.createRender$.pipe(ae(this.dispose$)).subscribe((e) => {
1606
+ this._renderManagerService.createRender$.pipe(ce(this.dispose$)).subscribe((e) => {
1579
1607
  this._create(e);
1580
- }), this._univerInstanceService.getCurrentTypeOfUnit$(S.UNIVER_DOC).pipe(ae(this.dispose$)).subscribe((e) => {
1608
+ }), this._univerInstanceService.getCurrentTypeOfUnit$(m.UNIVER_DOC).pipe(ce(this.dispose$)).subscribe((e) => {
1581
1609
  this._create(e == null ? void 0 : e.getUnitId());
1582
- }), this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC).forEach((e) => {
1610
+ }), this._univerInstanceService.getAllUnitsForType(m.UNIVER_DOC).forEach((e) => {
1583
1611
  this._create(e.getUnitId());
1584
1612
  });
1585
1613
  }
@@ -1592,65 +1620,62 @@ let Re = class extends ce {
1592
1620
  const t = this._univerInstanceService.getUniverDocInstance(e);
1593
1621
  t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
1594
1622
  }
1595
- // eslint-disable-next-line max-lines-per-function
1596
1623
  _addNewRender() {
1597
- const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), r = e.getParentRenderUnitId();
1598
- if (n != null && r != null)
1599
- throw new Error("container or parentRenderUnitId can only exist one");
1600
- n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
1601
- const s = this._renderManagerService.getRenderById(t);
1602
- if (s == null)
1624
+ const t = this._currentDocumentModel.getUnitId();
1625
+ this._renderManagerService.createRender(t);
1626
+ const n = this._renderManagerService.getRenderById(t);
1627
+ if (n == null)
1603
1628
  return;
1604
- const { scene: o, engine: a } = s;
1605
- o.openTransformer(), this._scene = o;
1606
- const c = new An(Ae.VIEW_MAIN, o, {
1629
+ const { scene: r, engine: o } = n;
1630
+ r.openTransformer(), this._scene = r;
1631
+ const s = new Ln(Be.VIEW_MAIN, r, {
1607
1632
  left: 0,
1608
1633
  top: 0,
1609
1634
  bottom: 0,
1610
1635
  right: 0,
1611
1636
  isWheelPreventDefaultX: !0
1612
1637
  });
1613
- o.attachControl(), o.on($n.wheel, (h, p) => {
1614
- const g = h;
1615
- if (g.ctrlKey) {
1616
- const f = Math.abs(g.deltaX);
1617
- let l = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
1618
- l *= g.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (l /= 2), o.scaleX + l > 4 ? o.scale(4, 4) : o.scaleX + l < 0.1 ? o.scale(0.1, 0.1) : g.preventDefault();
1638
+ r.attachControl(), r.on(Bn.wheel, (l, u) => {
1639
+ const h = l;
1640
+ if (h.ctrlKey) {
1641
+ const f = Math.abs(h.deltaX);
1642
+ let g = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
1643
+ g *= h.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (g /= 2), r.scaleX + g > 4 ? r.scale(4, 4) : r.scaleX + g < 0.1 ? r.scale(0.1, 0.1) : h.preventDefault();
1619
1644
  } else
1620
- c.onMouseWheel(g, p);
1621
- }), this._configService.getConfig("hasScroll") !== !1 && new He(c), o.addLayer(
1622
- new ht(o, [], je),
1623
- new ht(o, [], xn)
1624
- ), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
1625
- o.render(), this._fps$.next(Math.round(a.getFps()).toString());
1645
+ s.onMouseWheel(h, u);
1646
+ }), this._configService.getConfig("hasScroll") !== !1 && new Ye(s), r.addLayer(
1647
+ new gt(r, [], We),
1648
+ new gt(r, [], xn)
1649
+ ), this._addComponent(n), this._currentDocumentModel.getShouldRenderLoopImmediately() && o.runRenderLoop(() => {
1650
+ r.render(), this._fps$.next(Math.round(o.getFps()).toString());
1626
1651
  }), this._renderManagerService.setCurrent(t);
1627
1652
  }
1628
1653
  _addComponent(e) {
1629
- const t = this._scene, n = this._currentDocumentModel, r = new Bn(lt.MAIN, void 0, {
1654
+ const t = this._scene, n = this._currentDocumentModel, r = {
1630
1655
  pageMarginLeft: n.documentStyle.marginLeft || 0,
1631
1656
  pageMarginTop: n.documentStyle.marginTop || 0
1632
- });
1633
- r.zIndex = Dn, e.mainComponent = r, e.components.set(lt.MAIN, r), t.addObjects([r], je), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(je);
1657
+ }, o = new $n(q.MAIN, void 0, r), s = new Fn(q.BACKGROUND, void 0, r);
1658
+ o.zIndex = dt, s.zIndex = dt, e.mainComponent = o, e.components.set(q.MAIN, o), e.components.set(q.BACKGROUND, s), t.addObjects([o], We), t.addObjects([s], Dn), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(We);
1634
1659
  }
1635
1660
  };
1636
- Re = Ir([
1637
- N(A.Starting, Re),
1638
- fe(0, W),
1639
- fe(1, zt),
1640
- fe(2, D),
1641
- fe(3, $)
1642
- ], Re);
1643
- var br = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, yr = (i, e, t, n) => {
1644
- for (var r = n > 1 ? void 0 : n ? Mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1645
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1646
- return n && r && br(e, t, r), r;
1647
- }, q = (i, e) => (t, n) => e(t, n, i);
1648
- let Te = class extends Y {
1649
- constructor(e, t, n, r, s, o) {
1661
+ Ie = br([
1662
+ L(B.Starting, Ie),
1663
+ Se(0, H),
1664
+ Se(1, Wt),
1665
+ Se(2, U),
1666
+ Se(3, $)
1667
+ ], Ie);
1668
+ var yr = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
1669
+ for (var r = n > 1 ? void 0 : n ? Mr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1670
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1671
+ return n && r && yr(e, t, r), r;
1672
+ }, K = (i, e) => (t, n) => e(t, n, i);
1673
+ let be = class extends ee {
1674
+ constructor(e, t, n, r, o, s) {
1650
1675
  super();
1651
- m(this, "_liquid", new Fn());
1652
- m(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1653
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
1676
+ p(this, "_liquid", new wn());
1677
+ p(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1678
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = o, this._editorService = s, this._initialize(), this._commandExecutedListener();
1654
1679
  }
1655
1680
  _initialize() {
1656
1681
  this._initialRenderRefresh(), this._updateOnPluginChange();
@@ -1660,19 +1685,19 @@ let Te = class extends Y {
1660
1685
  const t = this._docSkeletonManagerService.getCurrent();
1661
1686
  if (t == null)
1662
1687
  return;
1663
- const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
1664
- if (s == null)
1688
+ const { unitId: n, skeleton: r } = t, o = this._renderManagerService.getRenderById(n);
1689
+ if (o == null)
1665
1690
  return;
1666
- const { mainComponent: o, components: a, scene: c } = s, d = o, { left: u, top: h } = d;
1667
- e.forEach((p) => {
1668
- const { unitId: g, subUnitId: f, floatingObjectId: l, floatingObject: _ } = p, { left: R = 0, top: y = 0, width: L = 0, height: w = 0, angle: j, flipX: X, flipY: G, skewX: he, skewY: ge } = _, x = this._pageMarginCache.get(l), At = (x == null ? void 0 : x.marginLeft) || 0, $t = (x == null ? void 0 : x.marginTop) || 0;
1669
- r == null || r.getViewModel().getDataModel().updateDrawing(l, {
1670
- left: R - u - At,
1671
- top: y - h - $t,
1672
- height: w,
1673
- width: L
1691
+ const { mainComponent: s, components: a, scene: c } = o, l = s, { left: u, top: h } = l;
1692
+ e.forEach((f) => {
1693
+ const { unitId: g, subUnitId: S, floatingObjectId: d, floatingObject: _ } = f, { left: O = 0, top: E = 0, width: N = 0, height: F = 0, angle: w, flipX: Y, flipY: G, skewX: ge, skewY: _e } = _, x = this._pageMarginCache.get(d), pe = (x == null ? void 0 : x.marginLeft) || 0, Ve = (x == null ? void 0 : x.marginTop) || 0;
1694
+ r == null || r.getViewModel().getDataModel().updateDrawing(d, {
1695
+ left: O - u - pe,
1696
+ top: E - h - Ve,
1697
+ height: F,
1698
+ width: N
1674
1699
  });
1675
- }), r == null || r.calculate(), o == null || o.makeDirty();
1700
+ }), r == null || r.calculate(), s == null || s.makeDirty();
1676
1701
  });
1677
1702
  }
1678
1703
  _initialRenderRefresh() {
@@ -1682,135 +1707,83 @@ let Te = class extends Y {
1682
1707
  const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
1683
1708
  if (r == null)
1684
1709
  return;
1685
- const { mainComponent: s } = r;
1686
- s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1710
+ const { mainComponent: o } = r;
1711
+ o.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1687
1712
  });
1688
1713
  }
1689
1714
  _commandExecutedListener() {
1690
- const e = [Qe.id, et.id];
1715
+ const e = [et.id, tt.id];
1691
1716
  this.disposeWithMe(
1692
1717
  this._commandService.onCommandExecuted((t) => {
1693
1718
  var n;
1694
1719
  if (e.includes(t.id)) {
1695
- const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getCurrent();
1696
- if (o == null)
1720
+ const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getCurrent();
1721
+ if (s == null)
1697
1722
  return;
1698
- const { unitId: a, skeleton: c } = o;
1699
- if (s !== a)
1723
+ const { unitId: a, skeleton: c } = s;
1724
+ if (o !== a)
1700
1725
  return;
1701
- const d = this._renderManagerService.getRenderById(a);
1702
- if (d == null)
1726
+ const l = this._renderManagerService.getRenderById(a);
1727
+ if (l == null)
1703
1728
  return;
1704
1729
  if (this._editorService.isEditor(a)) {
1705
- (n = d.mainComponent) == null || n.makeDirty();
1730
+ (n = l.mainComponent) == null || n.makeDirty();
1706
1731
  return;
1707
1732
  }
1708
- this._refreshFloatingObject(a, c, d);
1733
+ this._refreshFloatingObject(a, c, l);
1709
1734
  }
1710
1735
  })
1711
1736
  );
1712
1737
  }
1713
1738
  _refreshFloatingObject(e, t, n) {
1714
- const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
1739
+ const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: o, scene: s } = n, a = o;
1715
1740
  if (!r)
1716
1741
  return;
1717
- const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = a, { pages: g } = r, f = [];
1718
- o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1719
- for (let l = 0, _ = g.length; l < _; l++) {
1720
- const R = g[l], { skeDrawings: y, marginLeft: L, marginTop: w } = R;
1721
- this._liquid.translatePagePadding(R), y.forEach((j) => {
1722
- const { aLeft: X, aTop: G, height: he, width: ge, objectId: x } = j;
1723
- f.push({
1742
+ const { left: c, top: l, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: f } = a, { pages: g } = r, S = [];
1743
+ s.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1744
+ for (let d = 0, _ = g.length; d < _; d++) {
1745
+ const O = g[d], { skeDrawings: E, marginLeft: N, marginTop: F } = O;
1746
+ this._liquid.translatePagePadding(O), E.forEach((w) => {
1747
+ const { aLeft: Y, aTop: G, height: ge, width: _e, objectId: x, drawingOrigin: pe } = w, Ve = pe.layoutType === kt.WRAP_NONE && pe.behindDoc === C.TRUE;
1748
+ S.push({
1724
1749
  unitId: e,
1725
- subUnitId: kt,
1750
+ subUnitId: zt,
1726
1751
  floatingObjectId: x,
1752
+ behindText: Ve,
1727
1753
  floatingObject: {
1728
- left: X + c + this._liquid.x,
1729
- top: G + d + this._liquid.y,
1730
- width: ge,
1731
- height: he
1754
+ left: Y + c + this._liquid.x,
1755
+ top: G + l + this._liquid.y,
1756
+ width: _e,
1757
+ height: ge
1732
1758
  }
1733
1759
  }), this._pageMarginCache.set(x, {
1734
1760
  marginLeft: this._liquid.x,
1735
1761
  marginTop: this._liquid.y
1736
1762
  });
1737
- }), this._liquid.translatePage(R, u, h, p);
1763
+ }), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h, f);
1738
1764
  }
1739
- this._floatingObjectManagerService.BatchAddOrUpdate(f);
1765
+ this._floatingObjectManagerService.batchAddOrUpdate(S);
1740
1766
  }
1741
1767
  };
1742
- Te = yr([
1743
- N(A.Steady, Te),
1744
- q(0, O(ne)),
1745
- q(1, D),
1746
- q(2, W),
1747
- q(3, v),
1748
- q(4, Ht),
1749
- q(5, $)
1750
- ], Te);
1751
- var Er = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Dr = (i, e, t, n) => {
1752
- for (var r = n > 1 ? void 0 : n ? xr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1753
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1754
- return n && r && Er(e, t, r), r;
1755
- }, We = (i, e) => (t, n) => e(t, n, i);
1756
- const Pr = "rgba(198, 198, 198, 1)", Ur = "rgba(255, 255, 255, 1)";
1757
- let Ie = class extends Y {
1758
- constructor(i, e, t) {
1759
- super(), this._renderManagerService = i, this._editorService = e, this._univerInstanceService = t, this._initialize(), this._commandExecutedListener();
1760
- }
1761
- _initialize() {
1762
- this._initialRenderRefresh();
1763
- }
1764
- _initialRenderRefresh() {
1765
- this._renderManagerService.currentRender$.subscribe((i) => {
1766
- var s;
1767
- if (i == null)
1768
- return;
1769
- const e = this._renderManagerService.getRenderById(i);
1770
- if (this._editorService.isEditor(i) || this._univerInstanceService.getUniverDocInstance(i) == null || e == null)
1771
- return;
1772
- const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
1773
- this.disposeWithMe(
1774
- F(
1775
- n.onPageRenderObservable.add((o) => {
1776
- var _, R, y, L;
1777
- if (this._editorService.isEditor(i))
1778
- return;
1779
- const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: g, pageHeight: f } = a;
1780
- u.save(), u.translate(c - 0.5, d - 0.5);
1781
- const l = {
1782
- width: (R = (_ = r == null ? void 0 : r.width) != null ? _ : p) != null ? R : h,
1783
- height: (L = (y = r == null ? void 0 : r.height) != null ? y : f) != null ? L : g,
1784
- strokeWidth: 1,
1785
- stroke: Pr,
1786
- fill: Ur,
1787
- zIndex: 3
1788
- };
1789
- wn.drawWith(u, l), u.restore();
1790
- })
1791
- )
1792
- );
1793
- });
1794
- }
1795
- _commandExecutedListener() {
1796
- }
1797
- };
1798
- Ie = Dr([
1799
- N(A.Rendered, Ie),
1800
- We(0, W),
1801
- We(1, $),
1802
- We(2, D)
1803
- ], Ie);
1804
- var Lr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
1805
- for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1806
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1807
- return n && r && Lr(e, t, r), r;
1808
- }, K = (i, e) => (t, n) => e(t, n, i);
1809
- let be = class extends Y {
1810
- constructor(e, t, n, r, s, o) {
1768
+ be = Er([
1769
+ L(B.Steady, be),
1770
+ K(0, R(ie)),
1771
+ K(1, U),
1772
+ K(2, H),
1773
+ K(3, v),
1774
+ K(4, Ht),
1775
+ K(5, $)
1776
+ ], be);
1777
+ var xr = Object.defineProperty, Dr = Object.getOwnPropertyDescriptor, Pr = (i, e, t, n) => {
1778
+ for (var r = n > 1 ? void 0 : n ? Dr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1779
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1780
+ return n && r && xr(e, t, r), r;
1781
+ }, Z = (i, e) => (t, n) => e(t, n, i);
1782
+ let ye = class extends ee {
1783
+ constructor(e, t, n, r, o, s) {
1811
1784
  super();
1812
- m(this, "_initializedRender", /* @__PURE__ */ new Set());
1813
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
1785
+ p(this, "_initializedRender", /* @__PURE__ */ new Set());
1786
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = o, this._editorService = s, this._initialize();
1814
1787
  }
1815
1788
  dispose() {
1816
1789
  super.dispose();
@@ -1828,22 +1801,22 @@ let be = class extends Y {
1828
1801
  this._initializedRender.add(t);
1829
1802
  const { scene: r } = n;
1830
1803
  this.disposeWithMe(
1831
- F(
1832
- r.onMouseWheelObserver.add((s) => {
1833
- if (!s.ctrlKey)
1804
+ j(
1805
+ r.onMouseWheelObserver.add((o) => {
1806
+ if (!o.ctrlKey)
1834
1807
  return;
1835
- const o = this._univerInstanceService.getCurrentUniverDocInstance();
1836
- if (!o)
1808
+ const s = this._univerInstanceService.getCurrentUniverDocInstance();
1809
+ if (!s)
1837
1810
  return;
1838
- const a = Math.abs(s.deltaX);
1811
+ const a = Math.abs(o.deltaX);
1839
1812
  let c = a < 40 ? 0.2 : a < 80 ? 0.4 : 0.2;
1840
- c *= s.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
1841
- const d = o.zoomRatio;
1842
- let u = +Number.parseFloat(`${d + c}`).toFixed(1);
1813
+ c *= o.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
1814
+ const l = s.zoomRatio;
1815
+ let u = +Number.parseFloat(`${l + c}`).toFixed(1);
1843
1816
  u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Pn.id, {
1844
1817
  zoomRatio: u,
1845
- unitId: o.getUnitId()
1846
- }), s.preventDefault();
1818
+ unitId: s.getUnitId()
1819
+ }), o.preventDefault();
1847
1820
  })
1848
1821
  )
1849
1822
  );
@@ -1858,7 +1831,7 @@ let be = class extends Y {
1858
1831
  // }
1859
1832
  _skeletonListener() {
1860
1833
  this.disposeWithMe(
1861
- F(
1834
+ j(
1862
1835
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1863
1836
  if (e == null)
1864
1837
  return;
@@ -1872,18 +1845,18 @@ let be = class extends Y {
1872
1845
  );
1873
1846
  }
1874
1847
  _commandExecutedListener() {
1875
- const e = [et.id];
1848
+ const e = [tt.id];
1876
1849
  this.disposeWithMe(
1877
1850
  this._commandService.onCommandExecuted((t) => {
1878
1851
  if (e.includes(t.id)) {
1879
1852
  const n = this._univerInstanceService.getCurrentUniverDocInstance();
1880
1853
  if (!n)
1881
1854
  return;
1882
- const r = t.params, { unitId: s } = r;
1883
- if (s !== n.getUnitId())
1855
+ const r = t.params, { unitId: o } = r;
1856
+ if (o !== n.getUnitId())
1884
1857
  return;
1885
- const o = n.zoomRatio || 1;
1886
- this._updateViewZoom(o);
1858
+ const s = n.zoomRatio || 1;
1859
+ this._updateViewZoom(s);
1887
1860
  }
1888
1861
  })
1889
1862
  );
@@ -1894,44 +1867,44 @@ let be = class extends Y {
1894
1867
  n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
1895
1868
  }
1896
1869
  _calculatePagePosition(e, t) {
1897
- const { document: n, scene: r } = e, s = r == null ? void 0 : r.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
1898
- if (s == null || o === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
1870
+ const { document: n, scene: r, docBackground: o } = e, s = r == null ? void 0 : r.getParent(), { width: a, height: c, pageMarginLeft: l, pageMarginTop: u } = n;
1871
+ if (s == null || a === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
1899
1872
  return;
1900
- const { width: u, height: h } = s;
1901
- let p = 0, g = 0, f = 0, l = 0, _ = Number.POSITIVE_INFINITY;
1902
- u > (o + c * 2) * t ? (p = u / 2 - o * t / 2, p /= t, f = (u - c * 2) / t, _ = 0) : (p = c, f = o + c * 2, _ = (f - u / t) / 2), h > a ? (g = h / 2 - a / 2, l = (h - d * 2) / t) : (g = d, l = a + d * 2), r.resize(f, l + 200), n.translate(p, g);
1903
- const R = r.getViewport(Ae.VIEW_MAIN);
1904
- if (_ !== Number.POSITIVE_INFINITY && R != null) {
1905
- const y = R.getBarScroll(_, 0).x;
1906
- R.scrollTo({
1907
- x: y
1873
+ const { width: h, height: f } = s;
1874
+ let g = 0, S = 0, d = 0, _ = 0, O = Number.POSITIVE_INFINITY;
1875
+ h > (a + l * 2) * t ? (g = h / 2 - a * t / 2, g /= t, d = (h - l * 2) / t, O = 0) : (g = l, d = a + l * 2, O = (d - h / t) / 2), f > c ? (S = f / 2 - c / 2, _ = (f - u * 2) / t) : (S = u, _ = c + u * 2), r.resize(d, _ + 200), n.translate(g, S), o.translate(g, S);
1876
+ const E = r.getViewport(Be.VIEW_MAIN);
1877
+ if (O !== Number.POSITIVE_INFINITY && E != null) {
1878
+ const N = E.getBarScroll(O, 0).x;
1879
+ E.scrollTo({
1880
+ x: N
1908
1881
  });
1909
1882
  }
1910
1883
  return this;
1911
1884
  }
1912
1885
  _getDocObject() {
1913
- return Et(this._univerInstanceService, this._renderManagerService);
1886
+ return xt(this._univerInstanceService, this._renderManagerService);
1914
1887
  }
1915
1888
  };
1916
- be = Ar([
1917
- N(A.Rendered, be),
1918
- K(0, O(ne)),
1919
- K(1, D),
1920
- K(2, v),
1921
- K(3, W),
1922
- K(4, O(te)),
1923
- K(5, $)
1924
- ], be);
1925
- var $r = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, Fr = (i, e, t, n) => {
1926
- for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1927
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1928
- return n && r && $r(e, t, r), r;
1929
- }, H = (i, e) => (t, n) => e(t, n, i);
1930
- let Me = class extends Y {
1931
- constructor(e, t, n, r, s, o, a) {
1889
+ ye = Pr([
1890
+ L(B.Rendered, ye),
1891
+ Z(0, R(ie)),
1892
+ Z(1, U),
1893
+ Z(2, v),
1894
+ Z(3, H),
1895
+ Z(4, R(ne)),
1896
+ Z(5, $)
1897
+ ], ye);
1898
+ var Ur = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
1899
+ for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1900
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
1901
+ return n && r && Ur(e, t, r), r;
1902
+ }, z = (i, e) => (t, n) => e(t, n, i);
1903
+ let Me = class extends ee {
1904
+ constructor(e, t, n, r, o, s, a) {
1932
1905
  super();
1933
- m(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1934
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
1906
+ p(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1907
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = o, this._textSelectionManagerService = s, this._editorService = a, this._initialize();
1935
1908
  }
1936
1909
  _initialize() {
1937
1910
  this._init(), this._skeletonListener(), this._commandExecutedListener();
@@ -1951,46 +1924,47 @@ let Me = class extends Y {
1951
1924
  const t = this._getDocObjectById(e);
1952
1925
  t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
1953
1926
  }
1927
+ // eslint-disable-next-line max-lines-per-function
1954
1928
  _initialMain(e) {
1955
1929
  const t = this._getDocObjectById(e);
1956
1930
  if (t == null)
1957
1931
  return;
1958
1932
  const { document: n, scene: r } = t;
1959
1933
  this.disposeWithMe(
1960
- F(
1934
+ j(
1961
1935
  n.onPointerEnterObserver.add(() => {
1962
- this._isEditorReadOnly(e) || (n.cursor = gt.TEXT);
1936
+ this._isEditorReadOnly(e) || (n.cursor = _t.TEXT);
1963
1937
  })
1964
1938
  )
1965
1939
  ), this.disposeWithMe(
1966
- F(
1940
+ j(
1967
1941
  n.onPointerLeaveObserver.add(() => {
1968
- n.cursor = gt.DEFAULT, r.resetCursor();
1942
+ n.cursor = _t.DEFAULT, r.resetCursor();
1969
1943
  })
1970
1944
  )
1971
1945
  ), this.disposeWithMe(
1972
- F(
1973
- n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
1946
+ j(
1947
+ n == null ? void 0 : n.onPointerDownObserver.add((o, s) => {
1974
1948
  if (this._isEditorReadOnly(e))
1975
1949
  return;
1976
1950
  const a = this._univerInstanceService.getCurrentUniverDocInstance();
1977
- (a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(s);
1978
- const { offsetX: c, offsetY: d } = s;
1979
- this._editorService.getEditor(e) && setTimeout(() => {
1980
- this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, d);
1981
- }, 0), s.button !== 2 && o.stopPropagation();
1951
+ (a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(o);
1952
+ const { offsetX: c, offsetY: l } = o;
1953
+ this._editorService.getEditor(e) && (this._setEditorFocus(e), setTimeout(() => {
1954
+ this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, l);
1955
+ }, 0)), o.button !== 2 && s.stopPropagation();
1982
1956
  })
1983
1957
  )
1984
1958
  ), this.disposeWithMe(
1985
- F(
1986
- n == null ? void 0 : n.onDblclickObserver.add((s) => {
1987
- this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
1959
+ j(
1960
+ n == null ? void 0 : n.onDblclickObserver.add((o) => {
1961
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(o);
1988
1962
  })
1989
1963
  )
1990
1964
  ), this.disposeWithMe(
1991
- F(
1992
- n == null ? void 0 : n.onTripleClickObserver.add((s) => {
1993
- this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
1965
+ j(
1966
+ n == null ? void 0 : n.onTripleClickObserver.add((o) => {
1967
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(o);
1994
1968
  })
1995
1969
  )
1996
1970
  );
@@ -2000,20 +1974,20 @@ let Me = class extends Y {
2000
1974
  return t ? t.isReadOnly() : !1;
2001
1975
  }
2002
1976
  _setEditorFocus(e) {
2003
- if (this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).length > 0) {
2004
- const n = this._univerInstanceService.getCurrentUnitForType(S.UNIVER_SHEET);
1977
+ if (this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).length > 0) {
1978
+ const n = this._univerInstanceService.getCurrentUnitForType(m.UNIVER_SHEET);
2005
1979
  this._editorService.setOperationSheetUnitId(n.getUnitId());
2006
1980
  }
2007
1981
  this._editorService.focusStyle(e);
2008
1982
  }
2009
1983
  _commandExecutedListener() {
2010
- const e = [et.id];
1984
+ const e = [tt.id];
2011
1985
  this.disposeWithMe(
2012
1986
  this._commandService.onCommandExecuted((t) => {
2013
1987
  var n;
2014
1988
  if (e.includes(t.id)) {
2015
- const r = t.params, { unitId: s } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
2016
- if (s !== o)
1989
+ const r = t.params, { unitId: o } = r, s = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
1990
+ if (o !== s)
2017
1991
  return;
2018
1992
  this._textSelectionManagerService.refreshSelection();
2019
1993
  }
@@ -2028,8 +2002,8 @@ let Me = class extends Y {
2028
2002
  const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
2029
2003
  if (r == null)
2030
2004
  return;
2031
- const { scene: s, mainComponent: o } = r;
2032
- this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2005
+ const { scene: o, mainComponent: s } = r;
2006
+ this._textSelectionRenderManager.changeRuntime(n, o, s), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2033
2007
  unitId: t,
2034
2008
  subUnitId: ""
2035
2009
  });
@@ -2037,31 +2011,31 @@ let Me = class extends Y {
2037
2011
  );
2038
2012
  }
2039
2013
  _getDocObjectById(e) {
2040
- return this._univerInstanceService.getUnitType(e) !== S.UNIVER_DOC ? null : Un(e, this._renderManagerService);
2014
+ return this._univerInstanceService.getUnitType(e) !== m.UNIVER_DOC ? null : Un(e, this._renderManagerService);
2041
2015
  }
2042
2016
  };
2043
- Me = Fr([
2044
- N(A.Rendered, Me),
2045
- H(0, O(ne)),
2046
- H(1, D),
2047
- H(2, v),
2048
- H(3, W),
2049
- H(4, de),
2050
- H(5, O(te)),
2051
- H(6, $)
2017
+ Me = Ar([
2018
+ L(B.Rendered, Me),
2019
+ z(0, R(ie)),
2020
+ z(1, U),
2021
+ z(2, v),
2022
+ z(3, H),
2023
+ z(4, ue),
2024
+ z(5, R(ne)),
2025
+ z(6, $)
2052
2026
  ], Me);
2053
- var wr = Object.defineProperty, jr = Object.getOwnPropertyDescriptor, Vr = (i, e, t, n) => {
2054
- for (var r = n > 1 ? void 0 : n ? jr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2055
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2056
- return n && r && wr(e, t, r), r;
2057
- }, oe = (i, e) => (t, n) => e(t, n, i);
2058
- const Ct = 1.5;
2059
- let ye = class extends ce {
2027
+ var Lr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, $r = (i, e, t, n) => {
2028
+ for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2029
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
2030
+ return n && r && Lr(e, t, r), r;
2031
+ }, se = (i, e) => (t, n) => e(t, n, i);
2032
+ const Ot = 1.5;
2033
+ let Ee = class extends le {
2060
2034
  constructor(i, e, t, n, r) {
2061
2035
  super(), this._docSkeletonManagerService = i, this._textSelectionManagerService = e, this._editorService = t, this._univerInstanceService = n, this._renderManagerService = r, this._init();
2062
2036
  }
2063
2037
  _init() {
2064
- this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((i) => {
2038
+ this._textSelectionManagerService.textSelection$.pipe(ce(this.dispose$)).subscribe((i) => {
2065
2039
  if (i == null)
2066
2040
  return;
2067
2041
  const { isEditing: e, unitId: t } = i;
@@ -2074,54 +2048,54 @@ let ye = class extends ce {
2074
2048
  const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
2075
2049
  if (e == null || t == null || n == null)
2076
2050
  return;
2077
- const { collapsed: r, startNodePosition: s } = e;
2051
+ const { collapsed: r, startNodePosition: o } = e;
2078
2052
  if (!r)
2079
2053
  return;
2080
- const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new jn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: p, height: g } = Vn(u), f = h + a, l = p + c, _ = t.scene.getViewport(Ae.VIEW_MAIN), R = !!this._editorService.getEditor(i);
2054
+ const s = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = s, l = new jn(s, n), { contentBoxPointGroup: u } = l.getRangePointData(o, o), { left: h, top: f, height: g } = Vn(u), S = h + a, d = f + c, _ = t.scene.getViewport(Be.VIEW_MAIN), O = !!this._editorService.getEditor(i);
2081
2055
  if (_ == null)
2082
2056
  return;
2083
2057
  const {
2084
- left: y,
2085
- top: L,
2086
- right: w,
2087
- bottom: j
2058
+ left: E,
2059
+ top: N,
2060
+ right: F,
2061
+ bottom: w
2088
2062
  } = _.getBounding().viewBound;
2089
- let X = 0, G = 0;
2090
- const he = R ? 0 : 100;
2091
- l < L ? X = l - L : l > j - g && (X = l - j + g + he), f < y ? G = f - y : f > w - Ct && (G = f - w + Ct);
2092
- const ge = _.getBarScroll(G, X);
2093
- _.scrollBy(ge);
2063
+ let Y = 0, G = 0;
2064
+ const ge = O ? 0 : 100;
2065
+ d < N ? Y = d - N : d > w - g && (Y = d - w + g + ge), S < E ? G = S - E : S > F - Ot && (G = S - F + Ot);
2066
+ const _e = _.getBarScroll(G, Y);
2067
+ _.scrollBy(_e);
2094
2068
  }
2095
2069
  _getDocObject() {
2096
- return Et(this._univerInstanceService, this._renderManagerService);
2070
+ return xt(this._univerInstanceService, this._renderManagerService);
2097
2071
  }
2098
2072
  };
2099
- ye = Vr([
2100
- N(A.Rendered, ye),
2101
- oe(0, O(ne)),
2102
- oe(1, O(te)),
2103
- oe(2, $),
2104
- oe(3, D),
2105
- oe(4, W)
2106
- ], ye);
2107
- var Wr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, kr = (i, e, t, n) => {
2108
- for (var r = n > 1 ? void 0 : n ? zr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2109
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2110
- return n && r && Wr(e, t, r), r;
2111
- }, ze = (i, e) => (t, n) => e(t, n, i), me;
2112
- let Ot = (me = class extends Yt {
2073
+ Ee = $r([
2074
+ L(B.Rendered, Ee),
2075
+ se(0, R(ie)),
2076
+ se(1, R(ne)),
2077
+ se(2, $),
2078
+ se(3, U),
2079
+ se(4, H)
2080
+ ], Ee);
2081
+ var Fr = Object.defineProperty, wr = Object.getOwnPropertyDescriptor, jr = (i, e, t, n) => {
2082
+ for (var r = n > 1 ? void 0 : n ? wr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2083
+ (s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
2084
+ return n && r && Fr(e, t, r), r;
2085
+ }, ze = (i, e) => (t, n) => e(t, n, i), ve;
2086
+ let Rt = (ve = class extends Yt {
2113
2087
  constructor(i, e, t, n) {
2114
2088
  super(), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
2115
- zhCN: zi
2116
- }), this._config = qe.deepMerge({}, Xn, this._config), this._initDependencies(e), this._initializeCommands();
2089
+ zhCN: ki
2090
+ }), this._config = qe.deepMerge({}, Gn, this._config), this._initDependencies(e), this._initializeCommands();
2117
2091
  }
2118
2092
  onRendered() {
2119
2093
  this._initModules(), this._markDocAsFocused();
2120
2094
  }
2121
2095
  _initializeCommands() {
2122
2096
  [
2097
+ Zn,
2123
2098
  qn,
2124
- Kn,
2125
2099
  Qn,
2126
2100
  Jn,
2127
2101
  ei,
@@ -2129,9 +2103,9 @@ let Ot = (me = class extends Yt {
2129
2103
  ni,
2130
2104
  ii,
2131
2105
  ri,
2132
- Hi,
2133
2106
  Yi,
2134
- ki
2107
+ Gi,
2108
+ Hi
2135
2109
  ].forEach((i) => {
2136
2110
  this._injector.get(dn).registerShortcut(i);
2137
2111
  });
@@ -2139,36 +2113,35 @@ let Ot = (me = class extends Yt {
2139
2113
  _initDependencies(i) {
2140
2114
  [
2141
2115
  // Controller
2142
- [Se],
2143
- [ve],
2144
2116
  [Ce],
2145
2117
  [Oe],
2118
+ [Re],
2146
2119
  [Te],
2147
- [Ie],
2148
2120
  [be],
2149
- [Me],
2150
2121
  [ye],
2122
+ [Me],
2123
+ [Ee],
2151
2124
  [
2152
2125
  // controllers
2153
- se,
2126
+ ae,
2154
2127
  {
2155
- useFactory: () => this._injector.createInstance(se, this._config)
2128
+ useFactory: () => this._injector.createInstance(ae, this._config)
2156
2129
  }
2157
2130
  ],
2158
2131
  [
2159
- ue,
2132
+ he,
2160
2133
  {
2161
2134
  useClass: Xe
2162
2135
  }
2163
2136
  ],
2164
2137
  // Render views
2165
- [Re]
2138
+ [Ie]
2166
2139
  ].forEach((t) => {
2167
2140
  i.add(t);
2168
2141
  });
2169
2142
  }
2170
2143
  _markDocAsFocused() {
2171
- const i = this._injector.get(D), e = this._injector.get($);
2144
+ const i = this._injector.get(U), e = this._injector.get($);
2172
2145
  try {
2173
2146
  const t = i.getCurrentUniverDocInstance();
2174
2147
  if (!t)
@@ -2180,24 +2153,25 @@ let Ot = (me = class extends Yt {
2180
2153
  }
2181
2154
  }
2182
2155
  _initModules() {
2183
- this._injector.get(se);
2184
- }
2185
- }, m(me, "pluginName", Gn), m(me, "type", S.UNIVER_DOC), me);
2186
- Ot = kr([
2187
- ze(1, O(Pe)),
2188
- ze(2, O(Ze)),
2189
- ze(3, It)
2190
- ], Ot);
2156
+ this._injector.get(ae);
2157
+ }
2158
+ }, p(ve, "pluginName", Xn), p(ve, "type", m.UNIVER_DOC), ve);
2159
+ Rt = jr([
2160
+ ze(1, R(Ue)),
2161
+ ze(2, R(Ze)),
2162
+ ze(3, bt)
2163
+ ], Rt);
2191
2164
  export {
2192
- Gn as DOC_UI_PLUGIN_NAME,
2165
+ Xn as DOC_UI_PLUGIN_NAME,
2193
2166
  Yn as DefaultDocContainerConfig,
2194
- Xn as DefaultDocUiConfig,
2167
+ Gn as DefaultDocUiConfig,
2195
2168
  Hn as DefaultToolbarConfig,
2196
- Re as DocCanvasView,
2197
- er as PastePluginLark,
2198
- rr as PastePluginUniver,
2199
- nr as PastePluginWord,
2200
- Ot as UniverDocsUIPlugin,
2201
- to as enUS,
2202
- zi as zhCN
2169
+ Ie as DocCanvasView,
2170
+ tr as PastePluginLark,
2171
+ or as PastePluginUniver,
2172
+ ir as PastePluginWord,
2173
+ Rt as UniverDocsUIPlugin,
2174
+ qr as enUS,
2175
+ Jr as ruRU,
2176
+ ki as zhCN
2203
2177
  };