@univerjs/docs-ui 0.2.2 → 0.2.3

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,36 +1,36 @@
1
- var vn = Object.defineProperty;
2
- var On = (n, e, t) => e in n ? vn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var E = (n, e, t) => On(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { FOCUSING_DOC as Ne, FOCUSING_UNIVER_EDITOR as ht, FOCUSING_COMMON_DRAWINGS as Kt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Rn, Tools as ee, LRUMap as Cn, BaselineOffset as ae, BooleanNumber as S, ColorKit as St, skipParseTagNames as En, IUniverInstanceService as L, ILogService as Zt, ICommandService as C, Disposable as K, normalizeBody as Tn, toDisposable as qt, RxDisposable as Oe, Direction as Z, EDITOR_ACTIVATED as Jt, LocaleService as le, CommandType as de, DocumentFlavor as In, JSONX as et, UniverInstanceType as v, ThemeService as Qt, HorizontalAlign as Le, OnLifecycle as Ue, LifecycleStages as we, IContextService as bn, checkForSubstrings as Mn, IConfigService as xn, PositionedObjectLayoutType as yn, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Pn, DisposableCollection as vt, Plugin as Dn, ObjectRelativeFromH as An, ObjectRelativeFromV as Fn } from "@univerjs/core";
5
- import { IClipboardInterfaceService as gt, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Nn, HTML_CLIPBOARD_MIME_TYPE as Ln, IEditorService as Y, KeyCode as H, MetaKeys as Re, ILayoutService as en, ISidebarService as Un, ComponentManager as tn, MenuGroup as P, MenuItemType as x, MenuPosition as D, getMenuHiddenObservable as A, FONT_FAMILY_LIST as Ot, FONT_SIZE_LIST as wn, getHeaderFooterMenuHiddenObservable as Bn, FontFamily as $n, FontFamilyItem as Hn, FontSize as Vn, BuiltInUIPart as jn, IMenuService as Wn, IUIPartsService as kn, CopyCommand as zn, CutCommand as Gn, PasteCommand as Yn, SetEditorResizeOperation as Xn, ICanvasPopupService as Kn, IShortcutService as Zn } from "@univerjs/ui";
6
- import { createIdentifier as qn, Inject as T, Injector as Be, Optional as Jn } from "@wendellhu/redi";
7
- import { TextSelectionManagerService as ne, CutContentCommand as nn, InnerPasteCommand as on, getDeleteSelection as Qn, DocSkeletonManagerService as N, VIEWPORT_KEY as te, getDocObject as eo, MoveCursorOperation as $e, MoveSelectionOperation as He, SelectAllOperation as to, neoGetDocObject as Q, RichTextEditingMutation as Ve, SetInlineFormatBoldCommand as no, SetTextSelectionsOperation as V, SetInlineFormatCommand as ue, SetInlineFormatItalicCommand as oo, SetInlineFormatUnderlineCommand as io, SetInlineFormatStrikethroughCommand as ro, SetInlineFormatSubscriptCommand as so, SetInlineFormatSuperscriptCommand as ao, SetInlineFormatFontFamilyCommand as Rt, SetInlineFormatFontSizeCommand as Ct, SetInlineFormatTextColorCommand as Et, AlignLeftCommand as co, AlignOperationCommand as je, AlignCenterCommand as lo, AlignRightCommand as uo, AlignJustifyCommand as ho, OrderListCommand as go, BulletListCommand as po, ResetInlineFormatTextBackgroundColorCommand as _o, SetInlineFormatTextBackgroundColorCommand as tt, BreakLineCommand as fo, DeleteLeftCommand as mo, DeleteRightCommand as So, CoverContentCommand as vo, DOCS_COMPONENT_MAIN_LAYER_INDEX as Ye, DOCS_COMPONENT_HEADER_LAYER_INDEX as Oo, DOCS_VIEW_KEY as ie, DOCS_COMPONENT_DEFAULT_Z_INDEX as Tt, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as Ro, SetDocZoomRatioOperation as ve, SetDocZoomRatioCommand as Co, DocInterceptorService as Eo } from "@univerjs/docs";
8
- import { pixelToPt as To, ptToPixel as It, NodePositionConvertToCursor as rn, getAnchorBounding as Io, IRenderManagerService as k, ITextSelectionRenderManager as oe, Shape as bo, DocumentEditArea as F, PageLayoutType as De, Vector2 as sn, Rect as Xe, Path as bt, ScrollBar as nt, Viewport as Mo, Layer as Mt, Documents as xo, DocBackground as yo, Liquid as Po, CURSOR_TYPE as xt, getLineBounding as Do } from "@univerjs/engine-render";
9
- import { takeUntil as se, Observable as w, combineLatest as Ao, fromEvent as yt, BehaviorSubject as Pt, map as Fo } from "rxjs";
10
- import { useDependency as G, connectInjector as No } from "@wendellhu/redi/react-bindings";
11
- import Lo, { useState as an, useEffect as cn } from "react";
12
- import { Checkbox as Dt, InputNumber as At, Button as Uo, ColorPicker as wo } from "@univerjs/design";
13
- import Bo from "clsx";
14
- function z(n) {
15
- return n.getContextValue(Ne) && n.getContextValue(ht) && !n.getContextValue(Kt);
1
+ var fn = Object.defineProperty;
2
+ var _n = (t, e, n) => e in t ? fn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var C = (t, e, n) => _n(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { FOCUSING_DOC as Ne, FOCUSING_UNIVER_EDITOR as lt, FOCUSING_COMMON_DRAWINGS as Gt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as mn, Tools as Q, LRUMap as Sn, BaselineOffset as ae, BooleanNumber as S, ColorKit as ft, skipParseTagNames as vn, IUniverInstanceService as U, ILogService as Yt, ICommandService as O, Disposable as te, normalizeBody as Rn, toDisposable as Xt, RxDisposable as ve, Direction as X, EDITOR_ACTIVATED as Kt, LocaleService as le, CommandType as de, DocumentFlavor as On, JSONX as qe, UniverInstanceType as v, ThemeService as Zt, HorizontalAlign as Ue, OnLifecycle as Le, LifecycleStages as we, IContextService as Cn, checkForSubstrings as En, IConfigService as In, DisposableCollection as _t, Plugin as Tn, ObjectRelativeFromH as bn, ObjectRelativeFromV as Mn } from "@univerjs/core";
5
+ import { IClipboardInterfaceService as dt, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as xn, HTML_CLIPBOARD_MIME_TYPE as yn, IEditorService as K, KeyCode as H, MetaKeys as Re, ILayoutService as Jt, ISidebarService as Pn, ComponentManager as qt, MenuGroup as y, MenuItemType as x, MenuPosition as P, getMenuHiddenObservable as D, FONT_FAMILY_LIST as mt, FONT_SIZE_LIST as Dn, getHeaderFooterMenuHiddenObservable as An, FontFamily as Fn, FontFamilyItem as Nn, FontSize as Un, BuiltInUIPart as Ln, IMenuService as wn, IUIPartsService as Bn, CopyCommand as $n, CutCommand as Hn, PasteCommand as Vn, SetEditorResizeOperation as jn, ICanvasPopupService as Wn, IShortcutService as kn } from "@univerjs/ui";
6
+ import { createIdentifier as zn, Inject as T, Injector as Be, Optional as Gn } from "@wendellhu/redi";
7
+ import { TextSelectionManagerService as ne, CutContentCommand as Qt, InnerPasteCommand as en, getDeleteSelection as Yn, DocSkeletonManagerService as w, VIEWPORT_KEY as ee, getDocObject as Xn, MoveCursorOperation as $e, MoveSelectionOperation as He, SelectAllOperation as Kn, neoGetDocObject as q, RichTextEditingMutation as ut, SetInlineFormatBoldCommand as Zn, SetTextSelectionsOperation as V, SetInlineFormatCommand as ue, SetInlineFormatItalicCommand as Jn, SetInlineFormatUnderlineCommand as qn, SetInlineFormatStrikethroughCommand as Qn, SetInlineFormatSubscriptCommand as eo, SetInlineFormatSuperscriptCommand as to, SetInlineFormatFontFamilyCommand as St, SetInlineFormatFontSizeCommand as vt, SetInlineFormatTextColorCommand as Rt, AlignLeftCommand as no, AlignOperationCommand as Ve, AlignCenterCommand as oo, AlignRightCommand as io, AlignJustifyCommand as ro, OrderListCommand as so, BulletListCommand as ao, ResetInlineFormatTextBackgroundColorCommand as co, SetInlineFormatTextBackgroundColorCommand as Qe, BreakLineCommand as lo, DeleteLeftCommand as uo, DeleteRightCommand as ho, CoverContentCommand as go, DOCS_COMPONENT_MAIN_LAYER_INDEX as Ge, DOCS_COMPONENT_HEADER_LAYER_INDEX as po, DOCS_VIEW_KEY as ie, DOCS_COMPONENT_DEFAULT_Z_INDEX as Ot, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as fo, SetDocZoomRatioCommand as _o, SetDocZoomRatioOperation as Pe, DocInterceptorService as mo } from "@univerjs/docs";
8
+ import { pixelToPt as So, ptToPixel as Ct, NodePositionConvertToCursor as tn, getAnchorBounding as vo, IRenderManagerService as j, ITextSelectionRenderManager as oe, Shape as Ro, DocumentEditArea as N, PageLayoutType as De, Vector2 as nn, Rect as Ye, Path as Et, ScrollBar as et, Viewport as Oo, Layer as It, Documents as Co, DocBackground as Eo, CURSOR_TYPE as Tt, getLineBounding as Io } from "@univerjs/engine-render";
9
+ import { takeUntil as se, Observable as B, combineLatest as To, fromEvent as bt, BehaviorSubject as Mt, map as bo } from "rxjs";
10
+ import { useDependency as z, connectInjector as Mo } from "@wendellhu/redi/react-bindings";
11
+ import xo, { useState as on, useEffect as rn } from "react";
12
+ import { Checkbox as xt, InputNumber as yt, Button as yo, ColorPicker as Po } from "@univerjs/design";
13
+ import Do from "clsx";
14
+ function W(t) {
15
+ return t.getContextValue(Ne) && t.getContextValue(lt) && !t.getContextValue(Gt);
16
16
  }
17
- function $o(n) {
18
- return n.getContextValue(Ne) && n.getContextValue(ht) && !n.getContextValue(Rn) && !n.getContextValue(Kt);
17
+ function Ao(t) {
18
+ return t.getContextValue(Ne) && t.getContextValue(lt) && !t.getContextValue(mn) && !t.getContextValue(Gt);
19
19
  }
20
- const Ho = 10, Vo = 6;
21
- function jo() {
22
- return ee.generateRandomId(Vo);
20
+ const Fo = 10, No = 6;
21
+ function Uo() {
22
+ return Q.generateRandomId(No);
23
23
  }
24
- function Wo(n) {
25
- const e = n.match(/data-copy-id="([^\s]+)"/);
24
+ function Lo(t) {
25
+ const e = t.match(/data-copy-id="([^\s]+)"/);
26
26
  return e && e[1] ? e[1] : null;
27
27
  }
28
- class ko {
28
+ class wo {
29
29
  constructor() {
30
- E(this, "_cache", new Cn(Ho));
30
+ C(this, "_cache", new Sn(Fo));
31
31
  }
32
- set(e, t) {
33
- this._cache.set(e, t);
32
+ set(e, n) {
33
+ this._cache.set(e, n);
34
34
  }
35
35
  get(e) {
36
36
  return this._cache.get(e);
@@ -39,35 +39,35 @@ class ko {
39
39
  this._cache.clear();
40
40
  }
41
41
  }
42
- const Ft = new ko();
43
- function pt(n) {
44
- const e = n.style, t = {}, o = n.tagName.toLowerCase();
42
+ const Pt = new wo();
43
+ function ht(t) {
44
+ const e = t.style, n = {}, o = t.tagName.toLowerCase();
45
45
  switch (o) {
46
46
  case "b":
47
47
  case "em":
48
48
  case "strong": {
49
- t.bl = S.TRUE;
49
+ n.bl = S.TRUE;
50
50
  break;
51
51
  }
52
52
  case "s": {
53
- t.st = {
53
+ n.st = {
54
54
  s: S.TRUE
55
55
  };
56
56
  break;
57
57
  }
58
58
  case "u": {
59
- t.ul = {
59
+ n.ul = {
60
60
  s: S.TRUE
61
61
  };
62
62
  break;
63
63
  }
64
64
  case "i": {
65
- t.it = S.TRUE;
65
+ n.it = S.TRUE;
66
66
  break;
67
67
  }
68
68
  case "sub":
69
69
  case "sup": {
70
- t.va = o === "sup" ? ae.SUPERSCRIPT : ae.SUBSCRIPT;
70
+ n.va = o === "sup" ? ae.SUPERSCRIPT : ae.SUBSCRIPT;
71
71
  break;
72
72
  }
73
73
  }
@@ -75,63 +75,63 @@ function pt(n) {
75
75
  const r = e[i], s = e.getPropertyValue(r);
76
76
  switch (r) {
77
77
  case "font-family": {
78
- t.ff = s;
78
+ n.ff = s;
79
79
  break;
80
80
  }
81
81
  case "font-size": {
82
82
  const a = Number.parseInt(s);
83
- Number.isNaN(a) || (s.endsWith("pt") ? t.fs = a : s.endsWith("px") && (t.fs = To(a)));
83
+ Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs = So(a)));
84
84
  break;
85
85
  }
86
86
  case "font-style": {
87
- s === "italic" && (t.it = S.TRUE);
87
+ s === "italic" && (n.it = S.TRUE);
88
88
  break;
89
89
  }
90
90
  case "font-weight": {
91
- (Number(s) > 400 || String(s) === "bold") && (t.bl = S.TRUE);
91
+ (Number(s) > 400 || String(s) === "bold") && (n.bl = S.TRUE);
92
92
  break;
93
93
  }
94
94
  case "text-decoration": {
95
- /underline/.test(s) ? t.ul = {
95
+ /underline/.test(s) ? n.ul = {
96
96
  s: S.TRUE
97
- } : /overline/.test(s) ? t.ol = {
97
+ } : /overline/.test(s) ? n.ol = {
98
98
  s: S.TRUE
99
- } : /line-through/.test(s) && (t.st = {
99
+ } : /line-through/.test(s) && (n.st = {
100
100
  s: S.TRUE
101
101
  });
102
102
  break;
103
103
  }
104
104
  case "color": {
105
- const a = new St(s);
106
- a.isValid && (t.cl = {
105
+ const a = new ft(s);
106
+ a.isValid && (n.cl = {
107
107
  rgb: a.toRgbString()
108
108
  });
109
109
  break;
110
110
  }
111
111
  case "background-color": {
112
- const a = new St(s);
113
- a.isValid && (t.bg = {
112
+ const a = new ft(s);
113
+ a.isValid && (n.bg = {
114
114
  rgb: a.toRgbString()
115
115
  });
116
116
  break;
117
117
  }
118
118
  }
119
119
  }
120
- return t;
120
+ return n;
121
121
  }
122
- function zo(n) {
123
- const e = new DOMParser(), t = `<x-univer id="univer-root">${n}</x-univer>`;
124
- return e.parseFromString(t, "text/html").querySelector("#univer-root");
122
+ function Bo(t) {
123
+ const e = new DOMParser(), n = `<x-univer id="univer-root">${t}</x-univer>`;
124
+ return e.parseFromString(n, "text/html").querySelector("#univer-root");
125
125
  }
126
- function Nt(n, e) {
127
- const t = n.tagName.toLowerCase();
128
- return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((o) => o === t) : e(n);
126
+ function Dt(t, e) {
127
+ const n = t.tagName.toLowerCase();
128
+ return typeof e == "string" ? n === e : Array.isArray(e) ? e.some((o) => o === n) : e(t);
129
129
  }
130
130
  const Fe = class Fe {
131
131
  constructor() {
132
- E(this, "_styleCache", /* @__PURE__ */ new Map());
133
- E(this, "_styleRules", []);
134
- E(this, "_afterProcessRules", []);
132
+ C(this, "_styleCache", /* @__PURE__ */ new Map());
133
+ C(this, "_styleRules", []);
134
+ C(this, "_afterProcessRules", []);
135
135
  }
136
136
  static use(e) {
137
137
  if (this._pluginList.includes(e))
@@ -139,15 +139,15 @@ const Fe = class Fe {
139
139
  this._pluginList.push(e);
140
140
  }
141
141
  convert(e) {
142
- const t = Fe._pluginList.find((r) => r.checkPasteType(e)), o = zo(e), i = {
142
+ const n = Fe._pluginList.find((r) => r.checkPasteType(e)), o = Bo(e), i = {
143
143
  dataStream: "",
144
144
  textRuns: []
145
145
  };
146
- return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
146
+ return n && (this._styleRules = [...n.stylesRules], this._afterProcessRules = [...n.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
147
147
  }
148
- _process(e, t, o) {
148
+ _process(e, n, o) {
149
149
  var i, r;
150
- for (const s of t)
150
+ for (const s of n)
151
151
  if (s.nodeType === Node.TEXT_NODE) {
152
152
  if (((i = s.nodeValue) == null ? void 0 : i.trim()) === "")
153
153
  continue;
@@ -159,34 +159,34 @@ const Fe = class Fe {
159
159
  ts: c
160
160
  });
161
161
  } else {
162
- if (En.includes(s.nodeName.toLowerCase()))
162
+ if (vn.includes(s.nodeName.toLowerCase()))
163
163
  continue;
164
164
  if (s.nodeType === Node.ELEMENT_NODE) {
165
- const a = e ? this._styleCache.get(e) : {}, c = this._styleRules.find(({ filter: h }) => Nt(s, h)), d = c ? c.getStyle(s) : pt(s);
165
+ const a = e ? this._styleCache.get(e) : {}, c = this._styleRules.find(({ filter: g }) => Dt(s, g)), d = c ? c.getStyle(s) : ht(s);
166
166
  this._styleCache.set(s, { ...a, ...d });
167
167
  const { childNodes: p } = s;
168
168
  this._process(s, p, o);
169
- const g = this._afterProcessRules.find(
170
- ({ filter: h }) => Nt(s, h)
169
+ const h = this._afterProcessRules.find(
170
+ ({ filter: g }) => Dt(s, g)
171
171
  );
172
- g && g.handler(o, s);
172
+ h && h.handler(o, s);
173
173
  }
174
174
  }
175
175
  }
176
176
  };
177
- E(Fe, "_pluginList", []);
177
+ C(Fe, "_pluginList", []);
178
178
  let ce = Fe;
179
- const Go = {
179
+ const $o = {
180
180
  name: "univer-doc-paste-plugin-lark",
181
- checkPasteType(n) {
182
- return /lark-record-clipboard/i.test(n);
181
+ checkPasteType(t) {
182
+ return /lark-record-clipboard/i.test(t);
183
183
  },
184
184
  // TODO: @JOCS, support inline code copy from lark.
185
185
  stylesRules: [
186
186
  {
187
187
  filter: ["s"],
188
- getStyle(n) {
189
- const e = pt(n);
188
+ getStyle(t) {
189
+ const e = ht(t);
190
190
  return {
191
191
  st: {
192
192
  s: S.TRUE
@@ -198,173 +198,173 @@ const Go = {
198
198
  ],
199
199
  afterProcessRules: [
200
200
  {
201
- filter(n) {
202
- return n.tagName === "DIV" && /ace-line/i.test(n.className);
201
+ filter(t) {
202
+ return t.tagName === "DIV" && /ace-line/i.test(t.className);
203
203
  },
204
- handler(n) {
205
- n.paragraphs == null && (n.paragraphs = []), n.paragraphs.push({
206
- startIndex: n.dataStream.length
207
- }), n.dataStream += "\r";
204
+ handler(t) {
205
+ t.paragraphs == null && (t.paragraphs = []), t.paragraphs.push({
206
+ startIndex: t.dataStream.length
207
+ }), t.dataStream += "\r";
208
208
  }
209
209
  }
210
210
  ]
211
- }, Yo = Go;
212
- function ln(n) {
213
- const e = n.style, t = {};
211
+ }, Ho = $o;
212
+ function sn(t) {
213
+ const e = t.style, n = {};
214
214
  for (let o = 0; o < e.length; o++) {
215
215
  const i = e[o], r = e.getPropertyValue(i);
216
216
  switch (i) {
217
217
  case "margin-top": {
218
218
  const s = Number.parseInt(r);
219
- t.spaceAbove = /pt/.test(r) ? It(s) : s;
219
+ n.spaceAbove = /pt/.test(r) ? Ct(s) : s;
220
220
  break;
221
221
  }
222
222
  case "margin-bottom": {
223
223
  const s = Number.parseInt(r);
224
- t.spaceBelow = /pt/.test(r) ? It(s) : s;
224
+ n.spaceBelow = /pt/.test(r) ? Ct(s) : s;
225
225
  break;
226
226
  }
227
227
  case "line-height": {
228
228
  const s = Number.parseFloat(r);
229
- t.lineSpacing = s;
229
+ n.lineSpacing = s;
230
230
  break;
231
231
  }
232
232
  }
233
233
  }
234
- return Object.getOwnPropertyNames(t).length ? t : null;
234
+ return Object.getOwnPropertyNames(n).length ? n : null;
235
235
  }
236
- const Xo = {
236
+ const Vo = {
237
237
  name: "univer-doc-paste-plugin-word",
238
- checkPasteType(n) {
239
- return /word|mso/i.test(n);
238
+ checkPasteType(t) {
239
+ return /word|mso/i.test(t);
240
240
  },
241
241
  stylesRules: [
242
242
  {
243
243
  filter: ["b"],
244
- getStyle(n) {
245
- const e = pt(n);
244
+ getStyle(t) {
245
+ const e = ht(t);
246
246
  return { bl: S.TRUE, ...e };
247
247
  }
248
248
  }
249
249
  ],
250
250
  afterProcessRules: [
251
251
  {
252
- filter(n) {
253
- return n.tagName === "P";
252
+ filter(t) {
253
+ return t.tagName === "P";
254
254
  },
255
- handler(n, e) {
256
- n.paragraphs == null && (n.paragraphs = []);
257
- const t = {
258
- startIndex: n.dataStream.length
259
- }, o = ln(e);
260
- o && (t.paragraphStyle = o), n.paragraphs.push(t), n.dataStream += "\r";
255
+ handler(t, e) {
256
+ t.paragraphs == null && (t.paragraphs = []);
257
+ const n = {
258
+ startIndex: t.dataStream.length
259
+ }, o = sn(e);
260
+ o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
261
261
  }
262
262
  }
263
263
  ]
264
- }, Ko = Xo, Zo = {
264
+ }, jo = Vo, Wo = {
265
265
  name: "univer-doc-paste-plugin-univer",
266
- checkPasteType(n) {
267
- return /UniverNormal/i.test(n);
266
+ checkPasteType(t) {
267
+ return /UniverNormal/i.test(t);
268
268
  },
269
269
  stylesRules: [],
270
270
  afterProcessRules: [
271
271
  {
272
- filter(n) {
273
- return n.tagName === "P" && /UniverNormal/i.test(n.className);
272
+ filter(t) {
273
+ return t.tagName === "P" && /UniverNormal/i.test(t.className);
274
274
  },
275
- handler(n, e) {
276
- n.paragraphs == null && (n.paragraphs = []);
277
- const t = {
278
- startIndex: n.dataStream.length
279
- }, o = ln(e);
280
- o && (t.paragraphStyle = o), n.paragraphs.push(t), n.dataStream += "\r";
275
+ handler(t, e) {
276
+ t.paragraphs == null && (t.paragraphs = []);
277
+ const n = {
278
+ startIndex: t.dataStream.length
279
+ }, o = sn(e);
280
+ o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
281
281
  }
282
282
  }
283
283
  ]
284
- }, qo = Zo;
285
- function Lt(n, e) {
286
- const { st: t, ed: o, ts: i = {} } = e, { ff: r, fs: s, it: a, bl: c, ul: d, st: p, ol: g, bg: h, cl: l, va: f } = i;
287
- let u = n.slice(t, o);
284
+ }, ko = Wo;
285
+ function At(t, e) {
286
+ const { st: n, ed: o, ts: i = {} } = e, { ff: r, fs: s, it: a, bl: c, ul: d, st: p, ol: h, bg: g, cl: l, va: f } = i;
287
+ let u = t.slice(n, o);
288
288
  const _ = [];
289
- return a === S.TRUE && (u = `<i>${u}</i>`), f === ae.SUPERSCRIPT ? u = `<sup>${u}</sup>` : f === ae.SUBSCRIPT && (u = `<sub>${u}</sub>`), (d == null ? void 0 : d.s) === S.TRUE && (u = `<u>${u}</u>`), (p == null ? void 0 : p.s) === S.TRUE && (u = `<s>${u}</s>`), c === S.TRUE && (u = `<strong>${u}</strong>`), r && _.push(`font-family: ${r}`), l && _.push(`color: ${l.rgb}`), s && _.push(`font-size: ${s}pt`), g && _.push("text-decoration: overline"), h && _.push(`background: ${h.rgb}`), _.length ? `<span style="${_.join("; ")};">${u}</span>` : u;
289
+ return a === S.TRUE && (u = `<i>${u}</i>`), f === ae.SUPERSCRIPT ? u = `<sup>${u}</sup>` : f === ae.SUBSCRIPT && (u = `<sub>${u}</sub>`), (d == null ? void 0 : d.s) === S.TRUE && (u = `<u>${u}</u>`), (p == null ? void 0 : p.s) === S.TRUE && (u = `<s>${u}</s>`), c === S.TRUE && (u = `<strong>${u}</strong>`), r && _.push(`font-family: ${r}`), l && _.push(`color: ${l.rgb}`), s && _.push(`font-size: ${s}pt`), h && _.push("text-decoration: overline"), g && _.push(`background: ${g.rgb}`), _.length ? `<span style="${_.join("; ")};">${u}</span>` : u;
290
290
  }
291
- function Ke(n, e, t) {
292
- const { dataStream: o, textRuns: i = [] } = n;
291
+ function Xe(t, e, n) {
292
+ const { dataStream: o, textRuns: i = [] } = t;
293
293
  let r = e;
294
294
  const s = [];
295
295
  for (const a of i) {
296
296
  const { st: c, ed: d } = a;
297
- ee.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > r ? (s.push(o.slice(r, c)), s.push(Lt(o, {
297
+ Q.hasIntersectionBetweenTwoRanges(e, n, c, d) && (c > r ? (s.push(o.slice(r, c)), s.push(At(o, {
298
298
  ...a,
299
- ed: Math.min(d, t)
300
- }))) : s.push(Lt(o, {
299
+ ed: Math.min(d, n)
300
+ }))) : s.push(At(o, {
301
301
  ...a,
302
302
  st: r,
303
- ed: Math.min(d, t)
304
- }))), r = Math.max(e, Math.min(d, t));
303
+ ed: Math.min(d, n)
304
+ }))), r = Math.max(e, Math.min(d, n));
305
305
  }
306
- return r !== t && s.push(o.slice(r, t)), s.join("");
306
+ return r !== n && s.push(o.slice(r, n)), s.join("");
307
307
  }
308
- function Ut(n, e = !0) {
309
- var t;
310
- if (e && ((t = n.paragraphs) != null && t.length)) {
311
- const { dataStream: o, paragraphs: i = [] } = n;
308
+ function Ft(t, e = !0) {
309
+ var n;
310
+ if (e && ((n = t.paragraphs) != null && n.length)) {
311
+ const { dataStream: o, paragraphs: i = [] } = t;
312
312
  let r = "", s = -1;
313
313
  for (const a of i) {
314
- const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: p, spaceBelow: g, lineSpacing: h } = d, l = [];
315
- p != null && (typeof p == "number" ? l.push(`margin-top: ${p}px`) : l.push(`margin-top: ${p.v}px`)), g != null && (typeof g == "number" ? l.push(`margin-bottom: ${g}px`) : l.push(`margin-bottom: ${g.v}px`)), h != null && l.push(`line-height: ${h}`), c > s + 1 ? r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}>${Ke(n, s + 1, c)}</p>` : r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}></p>`, s = c;
314
+ const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: p, spaceBelow: h, lineSpacing: g } = d, l = [];
315
+ p != null && (typeof p == "number" ? l.push(`margin-top: ${p}px`) : l.push(`margin-top: ${p.v}px`)), h != null && (typeof h == "number" ? l.push(`margin-bottom: ${h}px`) : l.push(`margin-bottom: ${h.v}px`)), g != null && l.push(`line-height: ${g}`), c > s + 1 ? r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}>${Xe(t, s + 1, c)}</p>` : r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}></p>`, s = c;
316
316
  }
317
- return s !== o.length && (r += Ke(n, s, o.length)), r;
317
+ return s !== o.length && (r += Xe(t, s, o.length)), r;
318
318
  } else
319
- return Ke(n, 0, n.dataStream.length);
319
+ return Xe(t, 0, t.dataStream.length);
320
320
  }
321
- class Jo {
321
+ class zo {
322
322
  convert(e) {
323
323
  if (e.length === 0)
324
324
  throw new Error("The bodyList length at least to be 1");
325
325
  if (e.length === 1)
326
- return Ut(e[0]);
327
- let t = "";
326
+ return Ft(e[0]);
327
+ let n = "";
328
328
  for (const o of e)
329
- t += '<p className="UniverNormal">', t += Ut(o, !1), t += "</p>";
330
- return t;
329
+ n += '<p className="UniverNormal">', n += Ft(o, !1), n += "</p>";
330
+ return n;
331
331
  }
332
332
  }
333
- var Qo = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (n, e, t, o) => {
334
- for (var i = o > 1 ? void 0 : o ? ei(e, t) : e, r = n.length - 1, s; r >= 0; r--)
335
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
336
- return o && i && Qo(e, t, i), i;
337
- }, he = (n, e) => (t, o) => e(t, o, n);
338
- ce.use(Ko);
339
- ce.use(Yo);
340
- ce.use(qo);
341
- function ni(n) {
342
- const e = n.replace(/\n/g, "\r"), t = [];
333
+ var Go = Object.defineProperty, Yo = Object.getOwnPropertyDescriptor, Xo = (t, e, n, o) => {
334
+ for (var i = o > 1 ? void 0 : o ? Yo(e, n) : e, r = t.length - 1, s; r >= 0; r--)
335
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
336
+ return o && i && Go(e, n, i), i;
337
+ }, he = (t, e) => (n, o) => e(n, o, t);
338
+ ce.use(jo);
339
+ ce.use(Ho);
340
+ ce.use(ko);
341
+ function Ko(t) {
342
+ const e = t.replace(/\n/g, "\r"), n = [];
343
343
  for (let o = 0; o < e.length; o++)
344
- e[o] === "\r" && t.push({ startIndex: o });
344
+ e[o] === "\r" && n.push({ startIndex: o });
345
345
  return {
346
346
  dataStream: e,
347
- paragraphs: t
347
+ paragraphs: n
348
348
  };
349
349
  }
350
- const Ce = qn("doc.clipboard-service");
351
- let ot = class extends K {
352
- constructor(e, t, o, i, r) {
350
+ const Oe = zn("doc.clipboard-service");
351
+ let tt = class extends te {
352
+ constructor(e, n, o, i, r) {
353
353
  super();
354
- E(this, "_clipboardHooks", []);
355
- E(this, "_htmlToUDM", new ce());
356
- E(this, "_umdToHtml", new Jo());
357
- this._univerInstanceService = e, this._logService = t, this._commandService = o, this._clipboardInterfaceService = i, this._textSelectionManagerService = r;
354
+ C(this, "_clipboardHooks", []);
355
+ C(this, "_htmlToUDM", new ce());
356
+ C(this, "_umdToHtml", new zo());
357
+ this._univerInstanceService = e, this._logService = n, this._commandService = o, this._clipboardInterfaceService = i, this._textSelectionManagerService = r;
358
358
  }
359
359
  async copy() {
360
360
  const e = this._getDocumentBodyInRanges();
361
361
  if (e.length === 0)
362
362
  return !1;
363
363
  try {
364
- const t = this._textSelectionManagerService.getActiveRange(), o = !!(t != null && t.segmentId);
364
+ const n = this._textSelectionManagerService.getActiveRange(), o = !!(n != null && n.segmentId);
365
365
  this._setClipboardData(e, !o);
366
- } catch (t) {
367
- return this._logService.error("[DocClipboardService] copy failed", t), !1;
366
+ } catch (n) {
367
+ return this._logService.error("[DocClipboardService] copy failed", n), !1;
368
368
  }
369
369
  return !0;
370
370
  }
@@ -372,28 +372,28 @@ let ot = class extends K {
372
372
  return this._cut();
373
373
  }
374
374
  async paste(e) {
375
- const t = await this._generateBodyFromClipboardItems(e);
376
- return this._paste(t);
375
+ const n = await this._generateBodyFromClipboardItems(e);
376
+ return this._paste(n);
377
377
  }
378
- async legacyPaste(e, t) {
379
- const o = this._generateBodyFromHtmlAndText(e, t);
378
+ async legacyPaste(e, n) {
379
+ const o = this._generateBodyFromHtmlAndText(e, n);
380
380
  return this._paste(o);
381
381
  }
382
382
  async _cut() {
383
383
  var r;
384
384
  const {
385
385
  segmentId: e,
386
- endOffset: t,
386
+ endOffset: n,
387
387
  style: o
388
- } = (r = this._textSelectionManagerService.getActiveRange()) != null ? r : {}, i = this._textSelectionManagerService.getSelections();
389
- if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || i == null)
388
+ } = (r = this._textSelectionManagerService.getActiveRange()) != null ? r : {}, i = this._textSelectionManagerService.getCurrentSelections();
389
+ if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), n == null || i == null)
390
390
  return !1;
391
391
  this.copy();
392
392
  try {
393
- let s = t;
393
+ let s = n;
394
394
  for (const c of i) {
395
395
  const { startOffset: d, endOffset: p } = c;
396
- d == null || p == null || p <= t && (s -= p - d);
396
+ d == null || p == null || p <= n && (s -= p - d);
397
397
  }
398
398
  const a = [
399
399
  {
@@ -402,24 +402,24 @@ let ot = class extends K {
402
402
  style: o
403
403
  }
404
404
  ];
405
- return this._commandService.executeCommand(nn.id, { segmentId: e, textRanges: a });
405
+ return this._commandService.executeCommand(Qt.id, { segmentId: e, textRanges: a });
406
406
  } catch {
407
407
  return this._logService.error("[DocClipboardController] cut content failed"), !1;
408
408
  }
409
409
  }
410
410
  async _paste(e) {
411
- let t = Tn(e);
411
+ let n = Rn(e);
412
412
  this._clipboardHooks.forEach((c) => {
413
- c.onBeforePaste && (t = c.onBeforePaste(t));
413
+ c.onBeforePaste && (n = c.onBeforePaste(n));
414
414
  });
415
- const o = this._textSelectionManagerService.getActiveRange(), { segmentId: i, endOffset: r, style: s } = o || {}, a = this._textSelectionManagerService.getSelections();
415
+ const o = this._textSelectionManagerService.getActiveRange(), { segmentId: i, endOffset: r, style: s } = o || {}, a = this._textSelectionManagerService.getCurrentSelections();
416
416
  if (i == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), r == null || a == null)
417
417
  return !1;
418
418
  try {
419
419
  let c = r;
420
420
  for (const p of a) {
421
- const { startOffset: g, endOffset: h } = p;
422
- g == null || h == null || h <= r && (c += t.dataStream.length - (h - g));
421
+ const { startOffset: h, endOffset: g } = p;
422
+ h == null || g == null || g <= r && (c += n.dataStream.length - (g - h));
423
423
  }
424
424
  const d = [
425
425
  {
@@ -428,147 +428,147 @@ let ot = class extends K {
428
428
  style: s
429
429
  }
430
430
  ];
431
- return this._commandService.executeCommand(on.id, { body: t, segmentId: i, textRanges: d });
431
+ return this._commandService.executeCommand(en.id, { body: n, segmentId: i, textRanges: d });
432
432
  } catch {
433
433
  return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
434
434
  }
435
435
  }
436
- async _setClipboardData(e, t = !0) {
437
- const o = jo(), i = e.length > 1 ? e.map((s) => s.dataStream).join(`
436
+ async _setClipboardData(e, n = !0) {
437
+ const o = Uo(), i = e.length > 1 ? e.map((s) => s.dataStream).join(`
438
438
  `) : e[0].dataStream;
439
439
  let r = this._umdToHtml.convert(e);
440
- return e.length === 1 && t && (r = r.replace(/(<[a-z]+)/, (s, a) => `${a} data-copy-id="${o}"`), Ft.set(o, e[0])), this._clipboardInterfaceService.write(i, r);
440
+ return e.length === 1 && n && (r = r.replace(/(<[a-z]+)/, (s, a) => `${a} data-copy-id="${o}"`), Pt.set(o, e[0])), this._clipboardInterfaceService.write(i, r);
441
441
  }
442
442
  addClipboardHook(e) {
443
- return this._clipboardHooks.push(e), qt(() => {
444
- const t = this._clipboardHooks.indexOf(e);
445
- t > -1 && this._clipboardHooks.splice(t, 1);
443
+ return this._clipboardHooks.push(e), Xt(() => {
444
+ const n = this._clipboardHooks.indexOf(e);
445
+ n > -1 && this._clipboardHooks.splice(n, 1);
446
446
  });
447
447
  }
448
448
  _getDocumentBodyInRanges() {
449
- const e = this._textSelectionManagerService.getSelections(), t = this._textSelectionManagerService.getActiveRange(), o = this._univerInstanceService.getCurrentUniverDocInstance(), i = [], r = o == null ? void 0 : o.getBody();
450
- if (e == null || o == null || r == null || t == null)
449
+ const e = this._textSelectionManagerService.getCurrentSelections(), n = this._textSelectionManagerService.getActiveRange(), o = this._univerInstanceService.getCurrentUniverDocInstance(), i = [], r = o == null ? void 0 : o.getBody();
450
+ if (e == null || o == null || r == null || n == null)
451
451
  return i;
452
- const { segmentId: s } = t;
452
+ const { segmentId: s } = n;
453
453
  for (const a of e) {
454
454
  const { startOffset: c, endOffset: d, collapsed: p } = a;
455
455
  if (p || c == null || d == null)
456
456
  continue;
457
- const g = Qn({ startOffset: c, endOffset: d, collapsed: p }, r), h = o.getSelfOrHeaderFooterModel(s).sliceBody(g.startOffset, g.endOffset);
458
- if (h != null) {
459
- if (h.customRanges) {
457
+ const h = Yn({ startOffset: c, endOffset: d, collapsed: p }, r), g = o.getSelfOrHeaderFooterModel(s).sliceBody(h.startOffset, h.endOffset);
458
+ if (g != null) {
459
+ if (g.customRanges) {
460
460
  const l = [];
461
- h.customRanges.forEach((_) => {
461
+ g.customRanges.forEach((_) => {
462
462
  _.startIndex === _.endIndex && l.push(_);
463
- }), h.customRanges = h.customRanges.filter((_) => l.indexOf(_) === -1);
463
+ }), g.customRanges = g.customRanges.filter((_) => l.indexOf(_) === -1);
464
464
  let f = "", u = 0;
465
465
  l.forEach((_) => {
466
- f += h.dataStream.slice(u, _.endIndex), u = _.endIndex + 1;
467
- }), f += h.dataStream.slice(u, h.dataStream.length), h.dataStream = f;
466
+ f += g.dataStream.slice(u, _.endIndex), u = _.endIndex + 1;
467
+ }), f += g.dataStream.slice(u, g.dataStream.length), g.dataStream = f;
468
468
  }
469
- i.push(h);
469
+ i.push(g);
470
470
  }
471
471
  }
472
472
  return i;
473
473
  }
474
474
  async _generateBodyFromClipboardItems(e) {
475
475
  try {
476
- let t = "", o = "";
476
+ let n = "", o = "";
477
477
  for (const i of e)
478
478
  for (const r of i.types)
479
- r === Nn ? o = await i.getType(r).then((s) => s && s.text()) : r === Ln && (t = await i.getType(r).then((s) => s && s.text()));
480
- return this._generateBodyFromHtmlAndText(t, o);
481
- } catch (t) {
482
- return Promise.reject(t);
479
+ r === xn ? o = await i.getType(r).then((s) => s && s.text()) : r === yn && (n = await i.getType(r).then((s) => s && s.text()));
480
+ return this._generateBodyFromHtmlAndText(n, o);
481
+ } catch (n) {
482
+ return Promise.reject(n);
483
483
  }
484
484
  }
485
- _generateBodyFromHtmlAndText(e, t) {
485
+ _generateBodyFromHtmlAndText(e, n) {
486
486
  if (!e) {
487
- if (t)
488
- return ni(t);
487
+ if (n)
488
+ return Ko(n);
489
489
  throw new Error("[DocClipboardService] html and text cannot be both empty!");
490
490
  }
491
- const o = Wo(e);
491
+ const o = Lo(e);
492
492
  if (o) {
493
- const i = Ft.get(o);
493
+ const i = Pt.get(o);
494
494
  if (i)
495
495
  return i;
496
496
  }
497
497
  return this._htmlToUDM.convert(e);
498
498
  }
499
499
  };
500
- ot = ti([
501
- he(0, L),
502
- he(1, Zt),
503
- he(2, C),
504
- he(3, gt),
500
+ tt = Xo([
501
+ he(0, U),
502
+ he(1, Yt),
503
+ he(2, O),
504
+ he(3, dt),
505
505
  he(4, T(ne))
506
- ], ot);
507
- var oi = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, ri = (n, e, t, o) => {
508
- for (var i = o > 1 ? void 0 : o ? ii(e, t) : e, r = n.length - 1, s; r >= 0; r--)
509
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
510
- return o && i && oi(e, t, i), i;
511
- }, Ee = (n, e) => (t, o) => e(t, o, n);
512
- const wt = 1.5;
513
- let it = class extends Oe {
514
- constructor(n, e, t, o, i) {
515
- super(), this._context = n, this._textSelectionManagerService = e, this._editorService = t, this._univerInstanceService = o, this._renderManagerService = i, this._init();
506
+ ], tt);
507
+ var Zo = Object.defineProperty, Jo = Object.getOwnPropertyDescriptor, qo = (t, e, n, o) => {
508
+ for (var i = o > 1 ? void 0 : o ? Jo(e, n) : e, r = t.length - 1, s; r >= 0; r--)
509
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
510
+ return o && i && Zo(e, n, i), i;
511
+ }, Ce = (t, e) => (n, o) => e(n, o, t);
512
+ const Nt = 1.5;
513
+ let nt = class extends ve {
514
+ constructor(t, e, n, o, i) {
515
+ super(), this._context = t, this._textSelectionManagerService = e, this._editorService = n, this._univerInstanceService = o, this._renderManagerService = i, this._init();
516
516
  }
517
517
  _init() {
518
- this._textSelectionManagerService.textSelection$.pipe(se(this.dispose$)).subscribe((n) => {
519
- if (n == null)
518
+ this._textSelectionManagerService.textSelection$.pipe(se(this.dispose$)).subscribe((t) => {
519
+ if (t == null)
520
520
  return;
521
- const { isEditing: e, unitId: t } = n;
522
- e && this._scrollToSelection(t);
521
+ const { isEditing: e, unitId: n } = t;
522
+ e && this._scrollToSelection(n);
523
523
  });
524
524
  }
525
- scrollToRange(n, e) {
525
+ scrollToRange(t, e) {
526
526
  var s;
527
- const t = (s = this._renderManagerService.getRenderById(n)) == null ? void 0 : s.with(N), o = t == null ? void 0 : t.getSkeleton();
527
+ const n = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.with(w), o = n == null ? void 0 : n.getSkeleton();
528
528
  if (!o)
529
529
  return;
530
530
  const { startOffset: i } = e, r = o.findNodePositionByCharIndex(i);
531
- this.scrollToNode(n, r);
531
+ this.scrollToNode(t, r);
532
532
  }
533
- scrollToNode(n, e) {
534
- var $;
535
- const t = this._getDocObject(), o = ($ = this._renderManagerService.getRenderById(n)) == null ? void 0 : $.with(N), i = o == null ? void 0 : o.getSkeleton();
536
- if (t == null || i == null)
533
+ scrollToNode(t, e) {
534
+ var k;
535
+ const n = this._getDocObject(), o = (k = this._renderManagerService.getRenderById(t)) == null ? void 0 : k.with(w), i = o == null ? void 0 : o.getSkeleton();
536
+ if (n == null || i == null)
537
537
  return;
538
- const r = t.document.getOffsetConfig(), { docsLeft: s, docsTop: a } = r, c = new rn(r, i), { contentBoxPointGroup: d } = c.getRangePointData(e, e), { left: p, top: g, height: h } = Io(d), l = p + s, f = g + a, u = t.scene.getViewport(te.VIEW_MAIN), _ = !!this._editorService.getEditor(n);
538
+ const r = n.document.getOffsetConfig(), { docsLeft: s, docsTop: a } = r, c = new tn(r, i), { contentBoxPointGroup: d } = c.getRangePointData(e, e), { left: p, top: h, height: g } = vo(d), l = p + s, f = h + a, u = n.scene.getViewport(ee.VIEW_MAIN), _ = !!this._editorService.getEditor(t);
539
539
  if (u == null)
540
540
  return;
541
541
  const {
542
542
  left: m,
543
- top: O,
544
- right: M,
545
- bottom: I
543
+ top: R,
544
+ right: b,
545
+ bottom: M
546
546
  } = u.getBounding().viewBound;
547
- let R = 0, y = 0;
548
- const j = _ ? 0 : 100;
549
- f < O ? R = f - O - j : f > I - h && (R = f - I + h + j), l < m ? y = l - m : l > M - wt && (y = l - M + wt);
550
- const W = u.transViewportScroll2ScrollValue(y, R);
551
- u.scrollBy(W);
547
+ let E = 0, A = 0;
548
+ const F = _ ? 0 : 100;
549
+ f < R ? E = f - R - F : f > M - g && (E = f - M + g + F), l < m ? A = l - m : l > b - Nt && (A = l - b + Nt);
550
+ const G = u.transViewportScroll2ScrollValue(A, E);
551
+ u.scrollBy(G);
552
552
  }
553
553
  // Let the selection show on the current screen.
554
- _scrollToSelection(n) {
554
+ _scrollToSelection(t) {
555
555
  const e = this._textSelectionManagerService.getActiveRange();
556
556
  if (e == null)
557
557
  return;
558
- const { collapsed: t, startNodePosition: o } = e;
559
- t && this.scrollToNode(n, o);
558
+ const { collapsed: n, startNodePosition: o } = e;
559
+ n && this.scrollToNode(t, o);
560
560
  }
561
561
  _getDocObject() {
562
- return eo(this._univerInstanceService, this._renderManagerService);
562
+ return Xn(this._univerInstanceService, this._renderManagerService);
563
563
  }
564
564
  };
565
- it = ri([
566
- Ee(1, T(ne)),
567
- Ee(2, Y),
568
- Ee(3, T(L)),
569
- Ee(4, k)
570
- ], it);
571
- const si = {
565
+ nt = qo([
566
+ Ce(1, T(ne)),
567
+ Ce(2, K),
568
+ Ce(3, T(U)),
569
+ Ce(4, j)
570
+ ], nt);
571
+ const Qo = {
572
572
  undo: !0,
573
573
  redo: !0,
574
574
  // Undo redo
@@ -596,7 +596,7 @@ const si = {
596
596
  // 'Wrap mode'
597
597
  textRotateMode: !0
598
598
  // 'Text Rotation Mode'
599
- }, ai = {
599
+ }, ei = {
600
600
  outerLeft: !1,
601
601
  outerRight: !1,
602
602
  header: !0,
@@ -609,83 +609,83 @@ const si = {
609
609
  frozenContent: !1,
610
610
  infoBar: !0,
611
611
  toolbar: !0
612
- }, ci = {
612
+ }, ti = {
613
613
  layout: {
614
- docContainerConfig: ai,
615
- toolbarConfig: si
614
+ docContainerConfig: ei,
615
+ toolbarConfig: Qo
616
616
  }
617
- }, li = "DocUI", di = {
617
+ }, ni = "DocUI", oi = {
618
618
  id: $e.id,
619
619
  binding: H.ARROW_UP,
620
- preconditions: z,
620
+ preconditions: W,
621
621
  staticParameters: {
622
- direction: Z.UP
622
+ direction: X.UP
623
623
  }
624
- }, ui = {
624
+ }, ii = {
625
625
  id: $e.id,
626
626
  binding: H.ARROW_DOWN,
627
- preconditions: z,
627
+ preconditions: W,
628
628
  staticParameters: {
629
- direction: Z.DOWN
629
+ direction: X.DOWN
630
630
  }
631
- }, hi = {
631
+ }, ri = {
632
632
  id: $e.id,
633
633
  binding: H.ARROW_LEFT,
634
- preconditions: z,
634
+ preconditions: W,
635
635
  staticParameters: {
636
- direction: Z.LEFT
636
+ direction: X.LEFT
637
637
  }
638
- }, gi = {
638
+ }, si = {
639
639
  id: $e.id,
640
640
  binding: H.ARROW_RIGHT,
641
- preconditions: z,
641
+ preconditions: W,
642
642
  staticParameters: {
643
- direction: Z.RIGHT
643
+ direction: X.RIGHT
644
644
  }
645
- }, pi = {
645
+ }, ai = {
646
646
  id: He.id,
647
647
  binding: H.ARROW_UP | Re.SHIFT,
648
- preconditions: z,
648
+ preconditions: W,
649
649
  staticParameters: {
650
- direction: Z.UP
650
+ direction: X.UP
651
651
  }
652
- }, _i = {
652
+ }, ci = {
653
653
  id: He.id,
654
654
  binding: H.ARROW_DOWN | Re.SHIFT,
655
- preconditions: z,
655
+ preconditions: W,
656
656
  staticParameters: {
657
- direction: Z.DOWN
657
+ direction: X.DOWN
658
658
  }
659
- }, fi = {
659
+ }, li = {
660
660
  id: He.id,
661
661
  binding: H.ARROW_LEFT | Re.SHIFT,
662
- preconditions: z,
662
+ preconditions: W,
663
663
  staticParameters: {
664
- direction: Z.LEFT
664
+ direction: X.LEFT
665
665
  }
666
- }, mi = {
666
+ }, di = {
667
667
  id: He.id,
668
668
  binding: H.ARROW_RIGHT | Re.SHIFT,
669
- preconditions: z,
669
+ preconditions: W,
670
670
  staticParameters: {
671
- direction: Z.RIGHT
671
+ direction: X.RIGHT
672
672
  }
673
- }, Si = {
674
- id: to.id,
673
+ }, ui = {
674
+ id: Kn.id,
675
675
  binding: H.A | Re.CTRL_COMMAND,
676
- preconditions: (n) => n.getContextValue(ht) && (n.getContextValue(Ne) || n.getContextValue(Jt))
676
+ preconditions: (t) => t.getContextValue(lt) && (t.getContextValue(Ne) || t.getContextValue(Kt))
677
677
  };
678
- var vi = Object.defineProperty, Oi = Object.getOwnPropertyDescriptor, Ri = (n, e, t, o) => {
679
- for (var i = o > 1 ? void 0 : o ? Oi(e, t) : e, r = n.length - 1, s; r >= 0; r--)
680
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
681
- return o && i && vi(e, t, i), i;
682
- }, Bt = (n, e) => (t, o) => e(t, o, n);
683
- let rt = class {
684
- constructor(n, e, t) {
685
- E(this, "_docContainer");
678
+ var hi = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, pi = (t, e, n, o) => {
679
+ for (var i = o > 1 ? void 0 : o ? gi(e, n) : e, r = t.length - 1, s; r >= 0; r--)
680
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
681
+ return o && i && hi(e, n, i), i;
682
+ }, Ut = (t, e) => (n, o) => e(n, o, t);
683
+ let ot = class {
684
+ constructor(t, e, n) {
685
+ C(this, "_docContainer");
686
686
  // 获取SheetContainer组件
687
- E(this, "getComponent", (n) => {
688
- if (this._docContainer = n, !n.getContentRef().current)
687
+ C(this, "getComponent", (t) => {
688
+ if (this._docContainer = t, !t.getContentRef().current)
689
689
  throw new Error("container is not ready");
690
690
  });
691
691
  /**
@@ -695,10 +695,10 @@ let rt = class {
695
695
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
696
696
  *
697
697
  */
698
- E(this, "changeLocale", (n) => {
699
- this._localeService.setLocale(n);
698
+ C(this, "changeLocale", (t) => {
699
+ this._localeService.setLocale(t);
700
700
  });
701
- this._config = n, this._localeService = e, this._injector = t;
701
+ this._config = t, this._localeService = e, this._injector = n;
702
702
  }
703
703
  getUIConfig() {
704
704
  return {
@@ -711,27 +711,27 @@ let rt = class {
711
711
  getContentRef() {
712
712
  return this._docContainer.getContentRef();
713
713
  }
714
- UIDidMount(n) {
714
+ UIDidMount(t) {
715
715
  if (this._docContainer)
716
- return n(this._docContainer);
716
+ return t(this._docContainer);
717
717
  }
718
718
  getDocContainer() {
719
719
  return this._docContainer;
720
720
  }
721
721
  };
722
- rt = Ri([
723
- Bt(1, T(le)),
724
- Bt(2, T(Be))
725
- ], rt);
726
- var Ci = Object.defineProperty, Ei = Object.getOwnPropertyDescriptor, Ti = (n, e, t, o) => {
727
- for (var i = o > 1 ? void 0 : o ? Ei(e, t) : e, r = n.length - 1, s; r >= 0; r--)
728
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
729
- return o && i && Ci(e, t, i), i;
730
- }, Te = (n, e) => (t, o) => e(t, o, n);
731
- let me = class extends Oe {
732
- constructor(e, t, o, i, r) {
722
+ ot = pi([
723
+ Ut(1, T(le)),
724
+ Ut(2, T(Be))
725
+ ], ot);
726
+ var fi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, mi = (t, e, n, o) => {
727
+ for (var i = o > 1 ? void 0 : o ? _i(e, n) : e, r = t.length - 1, s; r >= 0; r--)
728
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
729
+ return o && i && fi(e, n, i), i;
730
+ }, Ee = (t, e) => (n, o) => e(n, o, t);
731
+ let me = class extends ve {
732
+ constructor(e, n, o, i, r) {
733
733
  super();
734
- E(this, "_docContainerController");
734
+ C(this, "_docContainerController");
735
735
  /**
736
736
  * Change language
737
737
  * @param {string} locale new language
@@ -739,10 +739,10 @@ let me = class extends Oe {
739
739
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
740
740
  *
741
741
  */
742
- E(this, "changeLocale", (e) => {
742
+ C(this, "changeLocale", (e) => {
743
743
  this._localeService.setLocale(e);
744
744
  });
745
- this._localeService = t, this._injector = o, this._textSelectionRenderManager = i, this._layoutService = r, this._docContainerController = this._injector.createInstance(rt, e), this._registerContainer();
745
+ this._localeService = n, this._injector = o, this._textSelectionRenderManager = i, this._layoutService = r, this._docContainerController = this._injector.createInstance(ot, e), this._registerContainer();
746
746
  }
747
747
  _registerContainer() {
748
748
  this._layoutService && this.disposeWithMe(
@@ -754,14 +754,14 @@ let me = class extends Oe {
754
754
  return this._docContainerController;
755
755
  }
756
756
  };
757
- me = Ti([
758
- Te(1, T(le)),
759
- Te(2, T(Be)),
760
- Te(3, oe),
761
- Te(4, Jn(en))
757
+ me = mi([
758
+ Ee(1, T(le)),
759
+ Ee(2, T(Be)),
760
+ Ee(3, oe),
761
+ Ee(4, Gn(Jt))
762
762
  ], me);
763
- const We = "UI_PLUGIN_DOCS", _t = `${We}_COLOR_PICKER_COMPONENT`, dn = `${We}_FONT_FAMILY_COMPONENT`, un = `${We}_FONT_FAMILY_ITEM_COMPONENT`, hn = `${We}_FONT_SIZE_COMPONENT`;
764
- var gn = { exports: {} }, ke = {};
763
+ const je = "UI_PLUGIN_DOCS", gt = `${je}_COLOR_PICKER_COMPONENT`, an = `${je}_FONT_FAMILY_COMPONENT`, cn = `${je}_FONT_FAMILY_ITEM_COMPONENT`, ln = `${je}_FONT_SIZE_COMPONENT`;
764
+ var dn = { exports: {} }, We = {};
765
765
  /**
766
766
  * @license React
767
767
  * react-jsx-runtime.production.min.js
@@ -771,136 +771,136 @@ var gn = { exports: {} }, ke = {};
771
771
  * This source code is licensed under the MIT license found in the
772
772
  * LICENSE file in the root directory of this source tree.
773
773
  */
774
- var Ii = Lo, bi = Symbol.for("react.element"), Mi = Symbol.for("react.fragment"), xi = Object.prototype.hasOwnProperty, yi = Ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Pi = { key: !0, ref: !0, __self: !0, __source: !0 };
775
- function pn(n, e, t) {
774
+ var Si = xo, vi = Symbol.for("react.element"), Ri = Symbol.for("react.fragment"), Oi = Object.prototype.hasOwnProperty, Ci = Si.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Ei = { key: !0, ref: !0, __self: !0, __source: !0 };
775
+ function un(t, e, n) {
776
776
  var o, i = {}, r = null, s = null;
777
- t !== void 0 && (r = "" + t), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (s = e.ref);
778
- for (o in e) xi.call(e, o) && !Pi.hasOwnProperty(o) && (i[o] = e[o]);
779
- if (n && n.defaultProps) for (o in e = n.defaultProps, e) i[o] === void 0 && (i[o] = e[o]);
780
- return { $$typeof: bi, type: n, key: r, ref: s, props: i, _owner: yi.current };
777
+ n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (s = e.ref);
778
+ for (o in e) Oi.call(e, o) && !Ei.hasOwnProperty(o) && (i[o] = e[o]);
779
+ if (t && t.defaultProps) for (o in e = t.defaultProps, e) i[o] === void 0 && (i[o] = e[o]);
780
+ return { $$typeof: vi, type: t, key: r, ref: s, props: i, _owner: Ci.current };
781
781
  }
782
- ke.Fragment = Mi;
783
- ke.jsx = pn;
784
- ke.jsxs = pn;
785
- gn.exports = ke;
786
- var b = gn.exports;
787
- const Di = "univer-docs-ui-canvas-background", Ai = {
788
- docsUiCanvasBackground: Di
789
- }, Fi = () => /* @__PURE__ */ b.jsx("div", { className: Ai.docsUiCanvasBackground }), $t = 18, Ht = 200, Ze = 6, Ni = 4;
790
- function Li(n, e) {
791
- let { radius: t, width: o, height: i } = e;
792
- t = t != null ? t : 0, o = o != null ? o : 30, i = i != null ? i : 30;
782
+ We.Fragment = Ri;
783
+ We.jsx = un;
784
+ We.jsxs = un;
785
+ dn.exports = We;
786
+ var I = dn.exports;
787
+ const Ii = "univer-docs-ui-canvas-background", Ti = {
788
+ docsUiCanvasBackground: Ii
789
+ }, bi = () => /* @__PURE__ */ I.jsx("div", { className: Ti.docsUiCanvasBackground }), Lt = 18, wt = 200, Ke = 6, Mi = 4;
790
+ function xi(t, e) {
791
+ let { radius: n, width: o, height: i } = e;
792
+ n = n != null ? n : 0, o = o != null ? o : 30, i = i != null ? i : 30;
793
793
  let r = 0;
794
- r = Math.min(t, o / 2, i / 2), n.beginPath(), n.moveTo(0, 0), n.lineTo(o, 0), n.lineTo(o, i - r), n.arc(o - r, i - r, r, 0, Math.PI / 2, !1), n.lineTo(0, i), n.lineTo(0, 0), n.closePath(), e.fill && (n.save(), n.fillStyle = e.fill, e.fillRule === "evenodd" ? n.fill("evenodd") : n.fill(), n.restore());
794
+ r = Math.min(n, o / 2, i / 2), t.beginPath(), t.moveTo(0, 0), t.lineTo(o, 0), t.lineTo(o, i - r), t.arc(o - r, i - r, r, 0, Math.PI / 2, !1), t.lineTo(0, i), t.lineTo(0, 0), t.closePath(), e.fill && (t.save(), t.fillStyle = e.fill, e.fillRule === "evenodd" ? t.fill("evenodd") : t.fill(), t.restore());
795
795
  }
796
- class Ae extends bo {
797
- constructor(t, o) {
798
- super(t, o);
799
- E(this, "color");
800
- E(this, "text");
796
+ class Ae extends Ro {
797
+ constructor(n, o) {
798
+ super(n, o);
799
+ C(this, "color");
800
+ C(this, "text");
801
801
  this.color = o == null ? void 0 : o.color, this.text = o == null ? void 0 : o.text;
802
802
  }
803
- static drawWith(t, o) {
803
+ static drawWith(n, o) {
804
804
  const { text: i, color: r } = o;
805
- t.save(), t.font = "13px Source Han Sans CN";
806
- const s = t.measureText(i).width, a = Math.min(
807
- s + 2 * Ze,
808
- Ht
805
+ n.save(), n.font = "13px Source Han Sans CN";
806
+ const s = n.measureText(i).width, a = Math.min(
807
+ s + 2 * Ke,
808
+ wt
809
809
  );
810
- Li(t, {
811
- height: $t,
810
+ xi(n, {
811
+ height: Lt,
812
812
  width: a,
813
813
  radius: 4,
814
814
  fill: r,
815
815
  evented: !1
816
- }), t.fillStyle = "rgba(58, 96, 247, 1)";
817
- const c = Ze, d = $t - Ni, p = Ht - 2 * Ze;
816
+ }), n.fillStyle = "rgba(58, 96, 247, 1)";
817
+ const c = Ke, d = Lt - Mi, p = wt - 2 * Ke;
818
818
  if (s > p) {
819
- let g = "", h = 0;
819
+ let h = "", g = 0;
820
820
  for (const l of i) {
821
- const f = t.measureText(l).width;
822
- if (h + f <= p - t.measureText("...").width)
823
- g += l, h += f;
821
+ const f = n.measureText(l).width;
822
+ if (g + f <= p - n.measureText("...").width)
823
+ h += l, g += f;
824
824
  else {
825
- g += "...";
825
+ h += "...";
826
826
  break;
827
827
  }
828
828
  }
829
- t.fillText(g, c, d);
829
+ n.fillText(h, c, d);
830
830
  } else
831
- t.fillText(i, c, d);
832
- t.restore();
831
+ n.fillText(i, c, d);
832
+ n.restore();
833
833
  }
834
- _draw(t) {
835
- Ae.drawWith(t, this);
834
+ _draw(n) {
835
+ Ae.drawWith(n, this);
836
836
  }
837
837
  }
838
- const _n = "COMPONENT_DOC_HEADER_FOOTER_PANEL", Ui = "univer-panel", wi = "univer-options-section", Bi = "univer-options-form-item", $i = "univer-options-input", Hi = "univer-options-margin-setting", B = {
839
- panel: Ui,
840
- optionsSection: wi,
841
- optionsFormItem: Bi,
842
- optionsInput: $i,
843
- optionsMarginSetting: Hi
844
- }, Vi = (n) => {
845
- const e = G(le), t = G(L), o = G(k), i = G(C), r = G(oe), s = G(ne), { unitId: a } = n, [c, d] = an({}), p = (l, f) => {
846
- var j;
847
- d((W) => ({
848
- ...W,
838
+ const hn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", yi = "univer-panel", Pi = "univer-options-section", Di = "univer-options-form-item", Ai = "univer-options-input", Fi = "univer-options-margin-setting", $ = {
839
+ panel: yi,
840
+ optionsSection: Pi,
841
+ optionsFormItem: Di,
842
+ optionsInput: Ai,
843
+ optionsMarginSetting: Fi
844
+ }, Ni = (t) => {
845
+ const e = z(le), n = z(U), o = z(j), i = z(O), r = z(oe), s = z(ne), { unitId: a } = t, [c, d] = on({}), p = (l, f) => {
846
+ var F;
847
+ d((G) => ({
848
+ ...G,
849
849
  [f]: l ? S.TRUE : S.FALSE
850
850
  }));
851
- const u = t.getUniverDocInstance(a), _ = u == null ? void 0 : u.getSnapshot().documentStyle, m = (j = o.getRenderById(a)) == null ? void 0 : j.with(N), O = m == null ? void 0 : m.getViewModel();
852
- if (_ == null || O == null)
851
+ const u = n.getUniverDocInstance(a), _ = u == null ? void 0 : u.getSnapshot().documentStyle, m = (F = o.getRenderById(a)) == null ? void 0 : F.with(w), R = m == null ? void 0 : m.getViewModel();
852
+ if (_ == null || R == null)
853
853
  return;
854
- const M = O.getEditArea();
855
- let I = !1;
856
- const R = r.getSegmentPage();
857
- let y = !1;
858
- if (f === "useFirstPageHeaderFooter" && l === !0 && ((M === F.HEADER && !_.firstPageHeaderId || M === F.FOOTER && !_.firstPageFooterId) && (I = !0), I && R === 0 && (y = !0)), f === "evenAndOddHeaders" && l === !0 && ((M === F.HEADER && !_.evenPageHeaderId || M === F.FOOTER && !_.evenPageFooterId) && (I = !0), I && R % 2 === 1 && (y = !0)), I) {
859
- const $ = ee.generateRandomId(6);
860
- y && r.setSegment($), i.executeCommand(Me, {
854
+ const b = R.getEditArea();
855
+ let M = !1;
856
+ const E = r.getSegmentPage();
857
+ let A = !1;
858
+ if (f === "useFirstPageHeaderFooter" && l === !0 && ((b === N.HEADER && !_.firstPageHeaderId || b === N.FOOTER && !_.firstPageFooterId) && (M = !0), M && E === 0 && (A = !0)), f === "evenAndOddHeaders" && l === !0 && ((b === N.HEADER && !_.evenPageHeaderId || b === N.FOOTER && !_.evenPageFooterId) && (M = !0), M && E % 2 === 1 && (A = !0)), M) {
859
+ const k = Q.generateRandomId(6);
860
+ A && r.setSegment(k), i.executeCommand(be, {
861
861
  unitId: a,
862
- segmentId: $,
862
+ segmentId: k,
863
863
  headerFooterProps: {
864
864
  [f]: l ? S.TRUE : S.FALSE
865
865
  }
866
866
  });
867
867
  } else
868
- i.executeCommand(Me, {
868
+ i.executeCommand(be, {
869
869
  unitId: a,
870
870
  headerFooterProps: {
871
871
  [f]: l ? S.TRUE : S.FALSE
872
872
  }
873
873
  });
874
- }, g = async (l, f) => {
874
+ }, h = async (l, f) => {
875
875
  d((u) => ({
876
876
  ...u,
877
877
  [f]: l
878
- })), await i.executeCommand(Me, {
878
+ })), await i.executeCommand(be, {
879
879
  unitId: a,
880
880
  headerFooterProps: {
881
881
  [f]: l
882
882
  }
883
883
  }), r.removeAllTextRanges(), r.blur();
884
- }, h = () => {
885
- var m, O;
886
- const l = (m = o.getRenderById(a)) == null ? void 0 : m.with(N), f = l == null ? void 0 : l.getSkeleton(), u = l == null ? void 0 : l.getViewModel(), _ = o.getRenderById(a);
887
- _ == null || u == null || f == null || (s.replaceTextRanges([]), r.setSegment(""), r.setSegmentPage(-1), u.setEditArea(F.BODY), f.calculate(), (O = _.mainComponent) == null || O.makeDirty(!0));
884
+ }, g = () => {
885
+ var m, R;
886
+ const l = (m = o.getRenderById(a)) == null ? void 0 : m.with(w), f = l == null ? void 0 : l.getSkeleton(), u = l == null ? void 0 : l.getViewModel(), _ = o.getRenderById(a);
887
+ _ == null || u == null || f == null || (s.replaceTextRanges([]), r.setSegment(""), r.setSegmentPage(-1), u.setEditArea(N.BODY), f.calculate(), (R = _.mainComponent) == null || R.makeDirty(!0));
888
888
  };
889
- return cn(() => {
890
- const l = t.getUniverDocInstance(a), f = l == null ? void 0 : l.getSnapshot().documentStyle;
889
+ return rn(() => {
890
+ const l = n.getUniverDocInstance(a), f = l == null ? void 0 : l.getSnapshot().documentStyle;
891
891
  if (f) {
892
- const { marginHeader: u, marginFooter: _, useFirstPageHeaderFooter: m, evenAndOddHeaders: O } = f;
892
+ const { marginHeader: u, marginFooter: _, useFirstPageHeaderFooter: m, evenAndOddHeaders: R } = f;
893
893
  d({
894
894
  marginHeader: u,
895
895
  marginFooter: _,
896
896
  useFirstPageHeaderFooter: m,
897
- evenAndOddHeaders: O
897
+ evenAndOddHeaders: R
898
898
  });
899
899
  }
900
- }, [a]), /* @__PURE__ */ b.jsxs("div", { className: B.options, children: [
901
- /* @__PURE__ */ b.jsxs("div", { className: B.optionsSection, children: [
902
- /* @__PURE__ */ b.jsx("div", { className: B.optionsFormItem, children: /* @__PURE__ */ b.jsx(
903
- Dt,
900
+ }, [a]), /* @__PURE__ */ I.jsxs("div", { className: $.options, children: [
901
+ /* @__PURE__ */ I.jsxs("div", { className: $.optionsSection, children: [
902
+ /* @__PURE__ */ I.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ I.jsx(
903
+ xt,
904
904
  {
905
905
  checked: c.useFirstPageHeaderFooter === S.TRUE,
906
906
  onChange: (l) => {
@@ -909,8 +909,8 @@ const _n = "COMPONENT_DOC_HEADER_FOOTER_PANEL", Ui = "univer-panel", wi = "unive
909
909
  children: e.t("headerFooter.firstPageCheckBox")
910
910
  }
911
911
  ) }),
912
- /* @__PURE__ */ b.jsx("div", { className: B.optionsFormItem, children: /* @__PURE__ */ b.jsx(
913
- Dt,
912
+ /* @__PURE__ */ I.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ I.jsx(
913
+ xt,
914
914
  {
915
915
  checked: c.evenAndOddHeaders === S.TRUE,
916
916
  onChange: (l) => {
@@ -920,65 +920,65 @@ const _n = "COMPONENT_DOC_HEADER_FOOTER_PANEL", Ui = "univer-panel", wi = "unive
920
920
  }
921
921
  ) })
922
922
  ] }),
923
- /* @__PURE__ */ b.jsxs("div", { className: Bo(B.optionsSection, B.optionsMarginSetting), children: [
924
- /* @__PURE__ */ b.jsxs("div", { className: B.optionsMarginItem, children: [
925
- /* @__PURE__ */ b.jsx("span", { children: e.t("headerFooter.headerTopMargin") }),
926
- /* @__PURE__ */ b.jsx(
927
- At,
923
+ /* @__PURE__ */ I.jsxs("div", { className: Do($.optionsSection, $.optionsMarginSetting), children: [
924
+ /* @__PURE__ */ I.jsxs("div", { className: $.optionsMarginItem, children: [
925
+ /* @__PURE__ */ I.jsx("span", { children: e.t("headerFooter.headerTopMargin") }),
926
+ /* @__PURE__ */ I.jsx(
927
+ yt,
928
928
  {
929
929
  min: 0,
930
930
  max: 200,
931
931
  precision: 1,
932
932
  value: c.marginHeader,
933
933
  onChange: (l) => {
934
- g(l, "marginHeader");
934
+ h(l, "marginHeader");
935
935
  },
936
- className: B.optionsInput
936
+ className: $.optionsInput
937
937
  }
938
938
  )
939
939
  ] }),
940
- /* @__PURE__ */ b.jsxs("div", { className: B.optionsMarginItem, children: [
941
- /* @__PURE__ */ b.jsx("span", { children: e.t("headerFooter.footerBottomMargin") }),
942
- /* @__PURE__ */ b.jsx(
943
- At,
940
+ /* @__PURE__ */ I.jsxs("div", { className: $.optionsMarginItem, children: [
941
+ /* @__PURE__ */ I.jsx("span", { children: e.t("headerFooter.footerBottomMargin") }),
942
+ /* @__PURE__ */ I.jsx(
943
+ yt,
944
944
  {
945
945
  min: 0,
946
946
  max: 200,
947
947
  precision: 1,
948
948
  value: c.marginFooter,
949
949
  onChange: (l) => {
950
- g(l, "marginFooter");
950
+ h(l, "marginFooter");
951
951
  },
952
- className: B.optionsInput
952
+ className: $.optionsInput
953
953
  }
954
954
  )
955
955
  ] })
956
956
  ] }),
957
- /* @__PURE__ */ b.jsx("div", { className: B.optionsSection, children: /* @__PURE__ */ b.jsx(Uo, { onClick: h, children: e.t("headerFooter.closeHeaderFooter") }) })
957
+ /* @__PURE__ */ I.jsx("div", { className: $.optionsSection, children: /* @__PURE__ */ I.jsx(yo, { onClick: g, children: e.t("headerFooter.closeHeaderFooter") }) })
958
958
  ] });
959
- }, ji = () => {
959
+ }, Ui = () => {
960
960
  var d;
961
- const n = G(le), e = G(k), i = G(L).getCurrentUniverDocInstance().getUnitId(), s = ((d = e.getRenderById(i)) == null ? void 0 : d.with(N)).getViewModel(), [a, c] = an(!0);
962
- return cn(() => {
961
+ const t = z(le), e = z(j), i = z(U).getCurrentUniverDocInstance().getUnitId(), s = ((d = e.getRenderById(i)) == null ? void 0 : d.with(w)).getViewModel(), [a, c] = on(!0);
962
+ return rn(() => {
963
963
  const p = s.getEditArea();
964
- c(p !== F.BODY);
965
- const g = s.editAreaChange$.subscribe((h) => {
966
- h != null && c(h !== F.BODY);
964
+ c(p !== N.BODY);
965
+ const h = s.editAreaChange$.subscribe((g) => {
966
+ g != null && c(g !== N.BODY);
967
967
  });
968
968
  return () => {
969
- g.unsubscribe();
969
+ h.unsubscribe();
970
970
  };
971
- }, []), /* @__PURE__ */ b.jsx("div", { className: B.panel, children: a ? /* @__PURE__ */ b.jsx(Vi, { unitId: i }) : /* @__PURE__ */ b.jsx("div", { className: B.panelDisableText, children: n.t("headerFooter.disableText") }) });
972
- }, fn = {
971
+ }, []), /* @__PURE__ */ I.jsx("div", { className: $.panel, children: a ? /* @__PURE__ */ I.jsx(Ni, { unitId: i }) : /* @__PURE__ */ I.jsx("div", { className: $.panelDisableText, children: t.t("headerFooter.disableText") }) });
972
+ }, gn = {
973
973
  id: "sidebar.operation.doc-header-footer-panel",
974
974
  type: de.COMMAND,
975
- handler: async (n, e) => {
976
- const t = n.get(Un), o = n.get(le);
975
+ handler: async (t, e) => {
976
+ const n = t.get(Pn), o = t.get(le);
977
977
  switch (e.value) {
978
978
  case "open":
979
- t.open({
979
+ n.open({
980
980
  header: { title: o.t("headerFooter.panel") },
981
- children: { label: _n },
981
+ children: { label: hn },
982
982
  onClose: () => {
983
983
  },
984
984
  width: 400
@@ -986,21 +986,21 @@ const _n = "COMPONENT_DOC_HEADER_FOOTER_PANEL", Ui = "univer-panel", wi = "unive
986
986
  break;
987
987
  case "close":
988
988
  default:
989
- t.close();
989
+ n.close();
990
990
  break;
991
991
  }
992
992
  return !0;
993
993
  }
994
994
  };
995
- var Wi = Object.defineProperty, ki = Object.getOwnPropertyDescriptor, zi = (n, e, t, o) => {
996
- for (var i = o > 1 ? void 0 : o ? ki(e, t) : e, r = n.length - 1, s; r >= 0; r--)
997
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
998
- return o && i && Wi(e, t, i), i;
999
- }, X = (n, e) => (t, o) => e(t, o, n);
1000
- const Vt = "rgba(58, 96, 247, 1)", jt = "rgba(58, 96, 247, 0.08)";
1001
- var U = /* @__PURE__ */ ((n) => (n[n.FIRST_PAGE_HEADER = 0] = "FIRST_PAGE_HEADER", n[n.FIRST_PAGE_FOOTER = 1] = "FIRST_PAGE_FOOTER", n[n.DEFAULT_HEADER = 2] = "DEFAULT_HEADER", n[n.DEFAULT_FOOTER = 3] = "DEFAULT_FOOTER", n[n.EVEN_PAGE_HEADER = 4] = "EVEN_PAGE_HEADER", n[n.EVEN_PAGE_FOOTER = 5] = "EVEN_PAGE_FOOTER", n))(U || {});
1002
- function Gi(n, e, t) {
1003
- const { documentStyle: o } = n.getDataModel().getSnapshot(), {
995
+ var Li = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Bi = (t, e, n, o) => {
996
+ for (var i = o > 1 ? void 0 : o ? wi(e, n) : e, r = t.length - 1, s; r >= 0; r--)
997
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
998
+ return o && i && Li(e, n, i), i;
999
+ }, Y = (t, e) => (n, o) => e(n, o, t);
1000
+ const Bt = "rgba(58, 96, 247, 1)", $t = "rgba(58, 96, 247, 0.08)";
1001
+ var L = /* @__PURE__ */ ((t) => (t[t.FIRST_PAGE_HEADER = 0] = "FIRST_PAGE_HEADER", t[t.FIRST_PAGE_FOOTER = 1] = "FIRST_PAGE_FOOTER", t[t.DEFAULT_HEADER = 2] = "DEFAULT_HEADER", t[t.DEFAULT_FOOTER = 3] = "DEFAULT_FOOTER", t[t.EVEN_PAGE_HEADER = 4] = "EVEN_PAGE_HEADER", t[t.EVEN_PAGE_FOOTER = 5] = "EVEN_PAGE_FOOTER", t))(L || {});
1002
+ function $i(t, e, n) {
1003
+ const { documentStyle: o } = t.getDataModel().getSnapshot(), {
1004
1004
  defaultHeaderId: i,
1005
1005
  defaultFooterId: r,
1006
1006
  evenPageHeaderId: s,
@@ -1008,19 +1008,19 @@ function Gi(n, e, t) {
1008
1008
  firstPageHeaderId: c,
1009
1009
  firstPageFooterId: d,
1010
1010
  evenAndOddHeaders: p,
1011
- useFirstPageHeaderFooter: g
1011
+ useFirstPageHeaderFooter: h
1012
1012
  } = o;
1013
1013
  switch (e) {
1014
- case F.BODY:
1014
+ case N.BODY:
1015
1015
  return {
1016
1016
  createType: null,
1017
1017
  headerFooterId: null
1018
1018
  };
1019
- case F.HEADER:
1020
- return g === S.TRUE && !c ? {
1019
+ case N.HEADER:
1020
+ return h === S.TRUE && !c ? {
1021
1021
  createType: 0,
1022
1022
  headerFooterId: null
1023
- } : p === S.TRUE && t % 2 === 0 && !s ? {
1023
+ } : p === S.TRUE && n % 2 === 0 && !s ? {
1024
1024
  createType: 4,
1025
1025
  headerFooterId: null
1026
1026
  } : i ? {
@@ -1030,11 +1030,11 @@ function Gi(n, e, t) {
1030
1030
  createType: 2,
1031
1031
  headerFooterId: null
1032
1032
  };
1033
- case F.FOOTER:
1034
- return g === S.TRUE && !d ? {
1033
+ case N.FOOTER:
1034
+ return h === S.TRUE && !d ? {
1035
1035
  createType: 1,
1036
1036
  headerFooterId: null
1037
- } : p === S.TRUE && t % 2 === 0 && !a ? {
1037
+ } : p === S.TRUE && n % 2 === 0 && !a ? {
1038
1038
  createType: 5,
1039
1039
  headerFooterId: null
1040
1040
  } : r ? {
@@ -1048,32 +1048,32 @@ function Gi(n, e, t) {
1048
1048
  throw new Error(`Invalid editArea: ${e}`);
1049
1049
  }
1050
1050
  }
1051
- let st = class extends K {
1052
- constructor(e, t, o, i, r, s, a, c, d) {
1051
+ let it = class extends te {
1052
+ constructor(e, n, o, i, r, s, a, c, d) {
1053
1053
  super();
1054
- E(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1055
- this._context = e, this._commandService = t, this._editorService = o, this._instanceSrv = i, this._renderManagerService = r, this._docSkeletonManagerService = s, this._textSelectionRenderManager = a, this._localeService = c, this._componentManager = d, this._initialize();
1054
+ C(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1055
+ this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._renderManagerService = r, this._docSkeletonManagerService = s, this._textSelectionRenderManager = a, this._localeService = c, this._componentManager = d, this._initialize();
1056
1056
  }
1057
1057
  _initialize() {
1058
- this._context.unit.getSnapshot().documentStyle.documentFlavor === In.TRADITIONAL && (this._init(), this._drawHeaderFooterLabel(), this._registerCommands(), this._initCustomComponents());
1058
+ this._context.unit.getSnapshot().documentStyle.documentFlavor === On.TRADITIONAL && (this._init(), this._drawHeaderFooterLabel(), this._registerCommands(), this._initCustomComponents());
1059
1059
  }
1060
1060
  _registerCommands() {
1061
1061
  [
1062
- kt,
1063
- mn,
1064
- fn
1062
+ Vt,
1063
+ pn,
1064
+ gn
1065
1065
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
1066
1066
  }
1067
1067
  _initCustomComponents() {
1068
1068
  const e = this._componentManager;
1069
- this.disposeWithMe(e.register(_n, ji));
1069
+ this.disposeWithMe(e.register(hn, Ui));
1070
1070
  }
1071
1071
  _init() {
1072
- const { unitId: e } = this._context, t = Q(this._context);
1073
- t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
1072
+ const { unitId: e } = this._context, n = q(this._context);
1073
+ n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
1074
1074
  }
1075
1075
  _initialMain(e) {
1076
- const t = Q(this._context), { document: o } = t;
1076
+ const n = q(this._context), { document: o } = n;
1077
1077
  this.disposeWithMe(o.onDblclick$.subscribeEvent(async (i) => {
1078
1078
  if (this._isEditorReadOnly(e))
1079
1079
  return;
@@ -1084,7 +1084,7 @@ let st = class extends K {
1084
1084
  } = o.getOffsetConfig(), p = this._getTransformCoordForDocumentOffset(r, s);
1085
1085
  if (p == null)
1086
1086
  return;
1087
- const g = this._docSkeletonManagerService.getViewModel(), h = this._docSkeletonManagerService.getSkeleton(), l = g.getEditArea(), { editArea: f, pageNumber: u } = h.findEditAreaByCoord(
1087
+ const h = this._docSkeletonManagerService.getViewModel(), g = this._docSkeletonManagerService.getSkeleton(), l = h.getEditArea(), { editArea: f, pageNumber: u } = g.findEditAreaByCoord(
1088
1088
  p,
1089
1089
  a,
1090
1090
  c,
@@ -1092,64 +1092,64 @@ let st = class extends K {
1092
1092
  );
1093
1093
  if (l === f)
1094
1094
  return;
1095
- g.setEditArea(f);
1096
- const { createType: _, headerFooterId: m } = Gi(g, f, u);
1097
- if (f === F.BODY)
1095
+ h.setEditArea(f);
1096
+ const { createType: _, headerFooterId: m } = $i(h, f, u);
1097
+ if (f === N.BODY)
1098
1098
  this._textSelectionRenderManager.setSegment(""), this._textSelectionRenderManager.setSegmentPage(-1), this._textSelectionRenderManager.setCursorManually(r, s);
1099
1099
  else if (_ != null) {
1100
- const M = ee.generateRandomId(6);
1101
- this._textSelectionRenderManager.setSegment(M), this._textSelectionRenderManager.setSegmentPage(u), await this._commandService.executeCommand(kt.id, {
1100
+ const b = Q.generateRandomId(6);
1101
+ this._textSelectionRenderManager.setSegment(b), this._textSelectionRenderManager.setSegmentPage(u), await this._commandService.executeCommand(Vt.id, {
1102
1102
  unitId: e,
1103
1103
  createType: _,
1104
- segmentId: M
1104
+ segmentId: b
1105
1105
  });
1106
1106
  } else m != null && (this._textSelectionRenderManager.setSegment(m), this._textSelectionRenderManager.setSegmentPage(u), this._textSelectionRenderManager.setCursorManually(r, s));
1107
1107
  }));
1108
1108
  }
1109
- _getTransformCoordForDocumentOffset(e, t) {
1110
- const o = Q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
1109
+ _getTransformCoordForDocumentOffset(e, n) {
1110
+ const o = q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
1111
1111
  if (a == null)
1112
1112
  return;
1113
- const c = a.transformVector2SceneCoord(sn.FromArray([e, t]));
1113
+ const c = a.transformVector2SceneCoord(nn.FromArray([e, n]));
1114
1114
  return s.clone().invert().applyPoint(c);
1115
1115
  }
1116
1116
  // eslint-disable-next-line max-lines-per-function
1117
1117
  _drawHeaderFooterLabel() {
1118
1118
  const e = this._localeService;
1119
- this._renderManagerService.currentRender$.subscribe((t) => {
1120
- if (t == null)
1119
+ this._renderManagerService.currentRender$.subscribe((n) => {
1120
+ if (n == null)
1121
1121
  return;
1122
- const o = this._renderManagerService.getRenderById(t);
1123
- if (this._editorService.isEditor(t) || this._instanceSrv.getUniverDocInstance(t) == null || o == null)
1122
+ const o = this._renderManagerService.getRenderById(n);
1123
+ if (this._editorService.isEditor(n) || this._instanceSrv.getUniverDocInstance(n) == null || o == null)
1124
1124
  return;
1125
1125
  const { mainComponent: i } = o, r = i;
1126
1126
  this.disposeWithMe(
1127
- qt(
1127
+ Xt(
1128
1128
  // eslint-disable-next-line max-lines-per-function
1129
1129
  r.pageRender$.subscribe((s) => {
1130
- if (this._editorService.isEditor(t))
1130
+ if (this._editorService.isEditor(n))
1131
1131
  return;
1132
- const d = this._docSkeletonManagerService.getViewModel().getEditArea() === F.BODY, { page: p, pageLeft: g, pageTop: h, ctx: l } = s, { pageWidth: f, pageHeight: u, marginTop: _, marginBottom: m } = p;
1133
- if (l.save(), l.translate(g - 0.5, h - 0.5), d ? (Xe.drawWith(l, {
1132
+ const d = this._docSkeletonManagerService.getViewModel().getEditArea() === N.BODY, { page: p, pageLeft: h, pageTop: g, ctx: l } = s, { pageWidth: f, pageHeight: u, marginTop: _, marginBottom: m } = p;
1133
+ if (l.save(), l.translate(h - 0.5, g - 0.5), d ? (Ye.drawWith(l, {
1134
1134
  left: 0,
1135
1135
  top: 0,
1136
1136
  width: f,
1137
1137
  height: _,
1138
1138
  fill: "rgba(255, 255, 255, 0.5)"
1139
- }), l.save(), l.translate(0, u - m), Xe.drawWith(l, {
1139
+ }), l.save(), l.translate(0, u - m), Ye.drawWith(l, {
1140
1140
  left: 0,
1141
1141
  top: 0,
1142
1142
  width: f,
1143
1143
  height: m,
1144
1144
  fill: "rgba(255, 255, 255, 0.5)"
1145
- }), l.restore()) : (l.save(), l.translate(0, _), Xe.drawWith(l, {
1145
+ }), l.restore()) : (l.save(), l.translate(0, _), Ye.drawWith(l, {
1146
1146
  left: 0,
1147
1147
  top: _,
1148
1148
  width: f,
1149
1149
  height: u - _ - m,
1150
1150
  fill: "rgba(255, 255, 255, 0.5)"
1151
1151
  }), l.restore()), !d) {
1152
- const O = {
1152
+ const R = {
1153
1153
  dataArray: [{
1154
1154
  command: "M",
1155
1155
  points: [0, _]
@@ -1158,8 +1158,8 @@ let st = class extends K {
1158
1158
  points: [f, _]
1159
1159
  }],
1160
1160
  strokeWidth: 1,
1161
- stroke: Vt
1162
- }, M = {
1161
+ stroke: Bt
1162
+ }, b = {
1163
1163
  dataArray: [{
1164
1164
  command: "M",
1165
1165
  points: [0, u - m]
@@ -1168,14 +1168,14 @@ let st = class extends K {
1168
1168
  points: [f, u - m]
1169
1169
  }],
1170
1170
  strokeWidth: 1,
1171
- stroke: Vt
1171
+ stroke: Bt
1172
1172
  };
1173
- bt.drawWith(l, O), bt.drawWith(l, M), l.translate(0, _ + 1), Ae.drawWith(l, {
1173
+ Et.drawWith(l, R), Et.drawWith(l, b), l.translate(0, _ + 1), Ae.drawWith(l, {
1174
1174
  text: e.t("headerFooter.header"),
1175
- color: jt
1175
+ color: $t
1176
1176
  }), l.translate(0, u - _ - m), Ae.drawWith(l, {
1177
1177
  text: e.t("headerFooter.footer"),
1178
- color: jt
1178
+ color: $t
1179
1179
  });
1180
1180
  }
1181
1181
  l.restore();
@@ -1185,24 +1185,24 @@ let st = class extends K {
1185
1185
  });
1186
1186
  }
1187
1187
  _isEditorReadOnly(e) {
1188
- const t = this._editorService.getEditor(e);
1189
- return t ? t.isReadOnly() : !1;
1188
+ const n = this._editorService.getEditor(e);
1189
+ return n ? n.isReadOnly() : !1;
1190
1190
  }
1191
1191
  _getDocDataModel() {
1192
1192
  return this._context.unit;
1193
1193
  }
1194
1194
  };
1195
- st = zi([
1196
- X(1, C),
1197
- X(2, Y),
1198
- X(3, L),
1199
- X(4, k),
1200
- X(5, T(N)),
1201
- X(6, oe),
1202
- X(7, T(le)),
1203
- X(8, T(tn))
1204
- ], st);
1205
- function Wt() {
1195
+ it = Bi([
1196
+ Y(1, O),
1197
+ Y(2, K),
1198
+ Y(3, U),
1199
+ Y(4, j),
1200
+ Y(5, T(w)),
1201
+ Y(6, oe),
1202
+ Y(7, T(le)),
1203
+ Y(8, T(qt))
1204
+ ], it);
1205
+ function Ht() {
1206
1206
  return {
1207
1207
  dataStream: `\r
1208
1208
  `,
@@ -1214,12 +1214,15 @@ function Wt() {
1214
1214
  // The default header footer text size.
1215
1215
  }
1216
1216
  }],
1217
+ customBlocks: [],
1217
1218
  paragraphs: [
1218
1219
  {
1219
1220
  startIndex: 0,
1220
- spaceAbove: 0,
1221
- lineSpacing: 1.5,
1222
- spaceBelow: 0
1221
+ paragraphStyle: {
1222
+ spaceAbove: 0,
1223
+ lineSpacing: 1.5,
1224
+ spaceBelow: 0
1225
+ }
1223
1226
  }
1224
1227
  ],
1225
1228
  sectionBreaks: [
@@ -1229,43 +1232,43 @@ function Wt() {
1229
1232
  ]
1230
1233
  };
1231
1234
  }
1232
- function qe(n, e, t, o) {
1233
- const i = et.getInstance(), r = 6, s = n != null ? n : ee.generateRandomId(r), a = e === U.DEFAULT_HEADER || e === U.FIRST_PAGE_HEADER || e === U.EVEN_PAGE_HEADER, c = i.insertOp([a ? "headers" : "footers", s], {
1235
+ function Ze(t, e, n, o) {
1236
+ const i = qe.getInstance(), r = 6, s = t != null ? t : Q.generateRandomId(r), a = e === L.DEFAULT_HEADER || e === L.FIRST_PAGE_HEADER || e === L.EVEN_PAGE_HEADER, c = i.insertOp([a ? "headers" : "footers", s], {
1234
1237
  [a ? "headerId" : "footerId"]: s,
1235
- body: Wt()
1238
+ body: Ht()
1236
1239
  });
1237
1240
  o.push(c);
1238
- const d = ee.generateRandomId(r), p = i.insertOp([a ? "footers" : "headers", d], {
1241
+ const d = Q.generateRandomId(r), p = i.insertOp([a ? "footers" : "headers", d], {
1239
1242
  [a ? "footers" : "headers"]: d,
1240
- body: Wt()
1243
+ body: Ht()
1241
1244
  });
1242
1245
  o.push(p);
1243
- let g = "defaultHeaderId", h = "defaultFooterId";
1246
+ let h = "defaultHeaderId", g = "defaultFooterId";
1244
1247
  switch (e) {
1245
- case U.DEFAULT_HEADER:
1246
- g = "defaultHeaderId", h = "defaultFooterId";
1248
+ case L.DEFAULT_HEADER:
1249
+ h = "defaultHeaderId", g = "defaultFooterId";
1247
1250
  break;
1248
- case U.DEFAULT_FOOTER:
1249
- g = "defaultFooterId", h = "defaultHeaderId";
1251
+ case L.DEFAULT_FOOTER:
1252
+ h = "defaultFooterId", g = "defaultHeaderId";
1250
1253
  break;
1251
- case U.FIRST_PAGE_HEADER:
1252
- g = "firstPageHeaderId", h = "firstPageFooterId";
1254
+ case L.FIRST_PAGE_HEADER:
1255
+ h = "firstPageHeaderId", g = "firstPageFooterId";
1253
1256
  break;
1254
- case U.FIRST_PAGE_FOOTER:
1255
- g = "firstPageFooterId", h = "firstPageHeaderId";
1257
+ case L.FIRST_PAGE_FOOTER:
1258
+ h = "firstPageFooterId", g = "firstPageHeaderId";
1256
1259
  break;
1257
- case U.EVEN_PAGE_HEADER:
1258
- g = "evenPageHeaderId", h = "evenPageFooterId";
1260
+ case L.EVEN_PAGE_HEADER:
1261
+ h = "evenPageHeaderId", g = "evenPageFooterId";
1259
1262
  break;
1260
- case U.EVEN_PAGE_FOOTER:
1261
- g = "evenPageFooterId", h = "evenPageHeaderId";
1263
+ case L.EVEN_PAGE_FOOTER:
1264
+ h = "evenPageFooterId", g = "evenPageHeaderId";
1262
1265
  break;
1263
1266
  default:
1264
1267
  throw new Error(`Unknown header footer type: ${e}`);
1265
1268
  }
1266
- for (const [l, f] of [[g, s], [h, d]])
1267
- if (t[l] != null) {
1268
- const u = i.replaceOp(["documentStyle", l], t[l], f);
1269
+ for (const [l, f] of [[h, s], [g, d]])
1270
+ if (n[l] != null) {
1271
+ const u = i.replaceOp(["documentStyle", l], n[l], f);
1269
1272
  o.push(u);
1270
1273
  } else {
1271
1274
  const u = i.insertOp(["documentStyle", l], f);
@@ -1273,21 +1276,21 @@ function qe(n, e, t, o) {
1273
1276
  }
1274
1277
  return o;
1275
1278
  }
1276
- const Me = "doc.command.core-header-footer", kt = {
1277
- id: Me,
1279
+ const be = "doc.command.core-header-footer", Vt = {
1280
+ id: be,
1278
1281
  type: de.COMMAND,
1279
1282
  // eslint-disable-next-line max-lines-per-function
1280
- handler: async (n, e) => {
1281
- var I;
1282
- const t = n.get(C), o = n.get(L), i = n.get(k), { unitId: r, segmentId: s, createType: a, headerFooterProps: c } = e, d = (I = i.getRenderById(r)) == null ? void 0 : I.with(N), p = o.getUniverDocInstance(r), g = d == null ? void 0 : d.getViewModel();
1283
- if (p == null || g == null)
1283
+ handler: async (t, e) => {
1284
+ var M;
1285
+ const n = t.get(O), o = t.get(U), i = t.get(j), { unitId: r, segmentId: s, createType: a, headerFooterProps: c } = e, d = (M = i.getRenderById(r)) == null ? void 0 : M.with(w), p = o.getUniverDocInstance(r), h = d == null ? void 0 : d.getViewModel();
1286
+ if (p == null || h == null)
1284
1287
  return !1;
1285
- const h = g.getEditArea(), { documentStyle: l } = p.getSnapshot(), f = (c == null ? void 0 : c.marginFooter) != null || (c == null ? void 0 : c.marginHeader) != null, u = [{
1288
+ const g = h.getEditArea(), { documentStyle: l } = p.getSnapshot(), f = (c == null ? void 0 : c.marginFooter) != null || (c == null ? void 0 : c.marginHeader) != null, u = [{
1286
1289
  startOffset: 0,
1287
1290
  endOffset: 0,
1288
1291
  collapsed: !0
1289
1292
  }], _ = {
1290
- id: Ve.id,
1293
+ id: ut.id,
1291
1294
  params: {
1292
1295
  unitId: r,
1293
1296
  actions: [],
@@ -1296,463 +1299,463 @@ const Me = "doc.command.core-header-footer", kt = {
1296
1299
  }
1297
1300
  };
1298
1301
  f && (_.params.noNeedSetTextRange = !0);
1299
- const m = et.getInstance(), O = [];
1300
- return a != null && qe(s, a, l, O), c != null && Object.keys(c).forEach((R) => {
1301
- const y = c[R], j = l[R];
1302
- if (y === j)
1302
+ const m = qe.getInstance(), R = [];
1303
+ return a != null && Ze(s, a, l, R), c != null && Object.keys(c).forEach((E) => {
1304
+ const A = c[E], F = l[E];
1305
+ if (A === F)
1303
1306
  return;
1304
- let W;
1305
- if (j === void 0 ? W = m.insertOp(["documentStyle", R], y) : W = m.replaceOp(["documentStyle", R], j, y), O.push(W), R === "useFirstPageHeaderFooter" && y === S.TRUE && !l.firstPageHeaderId) {
1306
- const $ = h === F.HEADER ? U.FIRST_PAGE_HEADER : U.FIRST_PAGE_FOOTER;
1307
- qe(s, $, l, O);
1308
- } else if (R === "evenAndOddHeaders" && y === S.TRUE && !l.evenPageHeaderId) {
1309
- const $ = h === F.HEADER ? U.EVEN_PAGE_HEADER : U.EVEN_PAGE_FOOTER;
1310
- qe(s, $, l, O);
1307
+ let G;
1308
+ if (F === void 0 ? G = m.insertOp(["documentStyle", E], A) : G = m.replaceOp(["documentStyle", E], F, A), R.push(G), E === "useFirstPageHeaderFooter" && A === S.TRUE && !l.firstPageHeaderId) {
1309
+ const k = g === N.HEADER ? L.FIRST_PAGE_HEADER : L.FIRST_PAGE_FOOTER;
1310
+ Ze(s, k, l, R);
1311
+ } else if (E === "evenAndOddHeaders" && A === S.TRUE && !l.evenPageHeaderId) {
1312
+ const k = g === N.HEADER ? L.EVEN_PAGE_HEADER : L.EVEN_PAGE_FOOTER;
1313
+ Ze(s, k, l, R);
1311
1314
  }
1312
- }), O.length === 0 ? !1 : (_.params.actions = O.reduce((R, y) => et.compose(R, y), null), !!t.syncExecuteCommand(_.id, _.params));
1315
+ }), R.length === 0 ? !1 : (_.params.actions = R.reduce((E, A) => qe.compose(E, A), null), !!n.syncExecuteCommand(_.id, _.params));
1313
1316
  }
1314
- }, mn = {
1317
+ }, pn = {
1315
1318
  id: "doc.command.open-header-footer-panel",
1316
1319
  type: de.COMMAND,
1317
- handler: async (n, e) => n.get(C).executeCommand(fn.id, { value: "open" })
1320
+ handler: async (t, e) => t.get(O).executeCommand(gn.id, { value: "open" })
1318
1321
  };
1319
- function Yi(n) {
1320
- const e = n.get(C);
1322
+ function Hi(t) {
1323
+ const e = t.get(O);
1321
1324
  return {
1322
- id: no.id,
1323
- group: P.TOOLBAR_FORMAT,
1325
+ id: Zn.id,
1326
+ group: y.TOOLBAR_FORMAT,
1324
1327
  type: x.BUTTON,
1325
1328
  icon: "BoldSingle",
1326
1329
  title: "Set bold",
1327
1330
  tooltip: "toolbar.bold",
1328
- positions: [D.TOOLBAR_START],
1329
- activated$: new w((t) => {
1331
+ positions: [P.TOOLBAR_START],
1332
+ activated$: new B((n) => {
1330
1333
  const o = e.onCommandExecuted((i) => {
1331
1334
  var s;
1332
1335
  const r = i.id;
1333
1336
  if (r === V.id || r === ue.id) {
1334
- const a = q(n);
1337
+ const a = Z(t);
1335
1338
  if (a == null)
1336
1339
  return;
1337
1340
  const c = (s = a.ts) == null ? void 0 : s.bl;
1338
- t.next(c === S.TRUE);
1341
+ n.next(c === S.TRUE);
1339
1342
  }
1340
1343
  });
1341
- return t.next(!1), o.dispose;
1344
+ return n.next(!1), o.dispose;
1342
1345
  }),
1343
- hidden$: A(n, v.UNIVER_DOC)
1346
+ hidden$: D(t, v.UNIVER_DOC)
1344
1347
  };
1345
1348
  }
1346
- function Xi(n) {
1347
- const e = n.get(C);
1349
+ function Vi(t) {
1350
+ const e = t.get(O);
1348
1351
  return {
1349
- id: oo.id,
1350
- group: P.TOOLBAR_FORMAT,
1352
+ id: Jn.id,
1353
+ group: y.TOOLBAR_FORMAT,
1351
1354
  type: x.BUTTON,
1352
1355
  icon: "ItalicSingle",
1353
1356
  title: "Set italic",
1354
1357
  tooltip: "toolbar.italic",
1355
- positions: [D.TOOLBAR_START],
1356
- activated$: new w((t) => {
1358
+ positions: [P.TOOLBAR_START],
1359
+ activated$: new B((n) => {
1357
1360
  const o = e.onCommandExecuted((i) => {
1358
1361
  var s;
1359
1362
  const r = i.id;
1360
1363
  if (r === V.id || r === ue.id) {
1361
- const a = q(n);
1364
+ const a = Z(t);
1362
1365
  if (a == null)
1363
1366
  return;
1364
1367
  const c = (s = a.ts) == null ? void 0 : s.it;
1365
- t.next(c === S.TRUE);
1368
+ n.next(c === S.TRUE);
1366
1369
  }
1367
1370
  });
1368
- return t.next(!1), o.dispose;
1371
+ return n.next(!1), o.dispose;
1369
1372
  }),
1370
- hidden$: A(n, v.UNIVER_DOC)
1373
+ hidden$: D(t, v.UNIVER_DOC)
1371
1374
  };
1372
1375
  }
1373
- function Ki(n) {
1374
- const e = n.get(C);
1376
+ function ji(t) {
1377
+ const e = t.get(O);
1375
1378
  return {
1376
- id: io.id,
1377
- group: P.TOOLBAR_FORMAT,
1379
+ id: qn.id,
1380
+ group: y.TOOLBAR_FORMAT,
1378
1381
  type: x.BUTTON,
1379
1382
  icon: "UnderlineSingle",
1380
1383
  title: "Set underline",
1381
1384
  tooltip: "toolbar.underline",
1382
- positions: [D.TOOLBAR_START],
1383
- activated$: new w((t) => {
1385
+ positions: [P.TOOLBAR_START],
1386
+ activated$: new B((n) => {
1384
1387
  const o = e.onCommandExecuted((i) => {
1385
1388
  var s;
1386
1389
  const r = i.id;
1387
1390
  if (r === V.id || r === ue.id) {
1388
- const a = q(n);
1391
+ const a = Z(t);
1389
1392
  if (a == null)
1390
1393
  return;
1391
1394
  const c = (s = a.ts) == null ? void 0 : s.ul;
1392
- t.next((c == null ? void 0 : c.s) === S.TRUE);
1395
+ n.next((c == null ? void 0 : c.s) === S.TRUE);
1393
1396
  }
1394
1397
  });
1395
- return t.next(!1), o.dispose;
1398
+ return n.next(!1), o.dispose;
1396
1399
  }),
1397
- hidden$: A(n, v.UNIVER_DOC)
1400
+ hidden$: D(t, v.UNIVER_DOC)
1398
1401
  };
1399
1402
  }
1400
- function Zi(n) {
1401
- const e = n.get(C);
1403
+ function Wi(t) {
1404
+ const e = t.get(O);
1402
1405
  return {
1403
- id: ro.id,
1404
- group: P.TOOLBAR_FORMAT,
1406
+ id: Qn.id,
1407
+ group: y.TOOLBAR_FORMAT,
1405
1408
  type: x.BUTTON,
1406
1409
  icon: "StrikethroughSingle",
1407
1410
  title: "Set strike through",
1408
1411
  tooltip: "toolbar.strikethrough",
1409
- positions: [D.TOOLBAR_START],
1410
- activated$: new w((t) => {
1412
+ positions: [P.TOOLBAR_START],
1413
+ activated$: new B((n) => {
1411
1414
  const o = e.onCommandExecuted((i) => {
1412
1415
  var s;
1413
1416
  const r = i.id;
1414
1417
  if (r === V.id || r === ue.id) {
1415
- const a = q(n);
1418
+ const a = Z(t);
1416
1419
  if (a == null)
1417
1420
  return;
1418
1421
  const c = (s = a.ts) == null ? void 0 : s.st;
1419
- t.next((c == null ? void 0 : c.s) === S.TRUE);
1422
+ n.next((c == null ? void 0 : c.s) === S.TRUE);
1420
1423
  }
1421
1424
  });
1422
- return t.next(!1), o.dispose;
1425
+ return n.next(!1), o.dispose;
1423
1426
  }),
1424
- hidden$: A(n, v.UNIVER_DOC)
1427
+ hidden$: D(t, v.UNIVER_DOC)
1425
1428
  };
1426
1429
  }
1427
- function qi(n) {
1428
- const e = n.get(C);
1430
+ function ki(t) {
1431
+ const e = t.get(O);
1429
1432
  return {
1430
- id: so.id,
1431
- group: P.TOOLBAR_FORMAT,
1433
+ id: eo.id,
1434
+ group: y.TOOLBAR_FORMAT,
1432
1435
  type: x.BUTTON,
1433
1436
  icon: "SubscriptSingle",
1434
1437
  tooltip: "toolbar.subscript",
1435
- positions: [D.TOOLBAR_START],
1436
- activated$: new w((t) => {
1438
+ positions: [P.TOOLBAR_START],
1439
+ activated$: new B((n) => {
1437
1440
  const o = e.onCommandExecuted((i) => {
1438
1441
  var s;
1439
1442
  const r = i.id;
1440
1443
  if (r === V.id || r === ue.id) {
1441
- const a = q(n);
1444
+ const a = Z(t);
1442
1445
  if (a == null)
1443
1446
  return;
1444
1447
  const c = (s = a.ts) == null ? void 0 : s.va;
1445
- t.next(c === ae.SUBSCRIPT);
1448
+ n.next(c === ae.SUBSCRIPT);
1446
1449
  }
1447
1450
  });
1448
- return t.next(!1), o.dispose;
1451
+ return n.next(!1), o.dispose;
1449
1452
  }),
1450
- hidden$: A(n, v.UNIVER_DOC)
1453
+ hidden$: D(t, v.UNIVER_DOC)
1451
1454
  };
1452
1455
  }
1453
- function Ji(n) {
1454
- const e = n.get(C);
1456
+ function zi(t) {
1457
+ const e = t.get(O);
1455
1458
  return {
1456
- id: ao.id,
1457
- group: P.TOOLBAR_FORMAT,
1459
+ id: to.id,
1460
+ group: y.TOOLBAR_FORMAT,
1458
1461
  type: x.BUTTON,
1459
1462
  icon: "SuperscriptSingle",
1460
1463
  tooltip: "toolbar.superscript",
1461
- positions: [D.TOOLBAR_START],
1462
- activated$: new w((t) => {
1464
+ positions: [P.TOOLBAR_START],
1465
+ activated$: new B((n) => {
1463
1466
  const o = e.onCommandExecuted((i) => {
1464
1467
  var s;
1465
1468
  const r = i.id;
1466
1469
  if (r === V.id || r === ue.id) {
1467
- const a = q(n);
1470
+ const a = Z(t);
1468
1471
  if (a == null)
1469
1472
  return;
1470
1473
  const c = (s = a.ts) == null ? void 0 : s.va;
1471
- t.next(c === ae.SUPERSCRIPT);
1474
+ n.next(c === ae.SUPERSCRIPT);
1472
1475
  }
1473
1476
  });
1474
- return t.next(!1), o.dispose;
1477
+ return n.next(!1), o.dispose;
1475
1478
  }),
1476
- hidden$: A(n, v.UNIVER_DOC)
1479
+ hidden$: D(t, v.UNIVER_DOC)
1477
1480
  };
1478
1481
  }
1479
- function Qi(n) {
1480
- const e = n.get(C);
1482
+ function Gi(t) {
1483
+ const e = t.get(O);
1481
1484
  return {
1482
- id: Rt.id,
1485
+ id: St.id,
1483
1486
  tooltip: "toolbar.font",
1484
- group: P.TOOLBAR_FORMAT,
1487
+ group: y.TOOLBAR_FORMAT,
1485
1488
  type: x.SELECTOR,
1486
- label: dn,
1487
- positions: [D.TOOLBAR_START],
1488
- selections: Ot.map((t) => ({
1489
+ label: an,
1490
+ positions: [P.TOOLBAR_START],
1491
+ selections: mt.map((n) => ({
1489
1492
  label: {
1490
- name: un,
1493
+ name: cn,
1491
1494
  hoverable: !0
1492
1495
  },
1493
- value: t.value
1496
+ value: n.value
1494
1497
  })),
1495
1498
  // disabled$: getCurrentSheetDisabled$(accessor),
1496
- value$: new w((t) => {
1497
- const o = Ot[0].value, i = e.onCommandExecuted((r) => {
1499
+ value$: new B((n) => {
1500
+ const o = mt[0].value, i = e.onCommandExecuted((r) => {
1498
1501
  var a;
1499
1502
  const s = r.id;
1500
- if (s === V.id || s === Rt.id) {
1501
- const c = q(n);
1503
+ if (s === V.id || s === St.id) {
1504
+ const c = Z(t);
1502
1505
  if (c == null)
1503
1506
  return;
1504
1507
  const d = (a = c.ts) == null ? void 0 : a.ff;
1505
- t.next(d != null ? d : o);
1508
+ n.next(d != null ? d : o);
1506
1509
  }
1507
1510
  });
1508
- return t.next(o), i.dispose;
1511
+ return n.next(o), i.dispose;
1509
1512
  }),
1510
- hidden$: A(n, v.UNIVER_DOC)
1513
+ hidden$: D(t, v.UNIVER_DOC)
1511
1514
  };
1512
1515
  }
1513
- function er(n) {
1514
- const e = n.get(C);
1516
+ function Yi(t) {
1517
+ const e = t.get(O);
1515
1518
  return {
1516
- id: Ct.id,
1517
- group: P.TOOLBAR_FORMAT,
1519
+ id: vt.id,
1520
+ group: y.TOOLBAR_FORMAT,
1518
1521
  type: x.SELECTOR,
1519
1522
  tooltip: "toolbar.fontSize",
1520
1523
  label: {
1521
- name: hn,
1524
+ name: ln,
1522
1525
  props: {
1523
1526
  min: 1,
1524
1527
  max: 400
1525
1528
  // disabled$,
1526
1529
  }
1527
1530
  },
1528
- positions: [D.TOOLBAR_START],
1529
- selections: wn,
1531
+ positions: [P.TOOLBAR_START],
1532
+ selections: Dn,
1530
1533
  // disabled$,
1531
- value$: new w((t) => {
1534
+ value$: new B((n) => {
1532
1535
  const i = e.onCommandExecuted((r) => {
1533
1536
  var a;
1534
1537
  const s = r.id;
1535
- if (s === V.id || s === Ct.id) {
1536
- const c = q(n);
1538
+ if (s === V.id || s === vt.id) {
1539
+ const c = Z(t);
1537
1540
  if (c == null)
1538
1541
  return;
1539
1542
  const d = (a = c.ts) == null ? void 0 : a.fs;
1540
- t.next(d != null ? d : 14);
1543
+ n.next(d != null ? d : 14);
1541
1544
  }
1542
1545
  });
1543
- return t.next(14), i.dispose;
1546
+ return n.next(14), i.dispose;
1544
1547
  }),
1545
- hidden$: A(n, v.UNIVER_DOC)
1548
+ hidden$: D(t, v.UNIVER_DOC)
1546
1549
  };
1547
1550
  }
1548
- function tr(n) {
1549
- const e = n.get(C), t = n.get(Qt);
1551
+ function Xi(t) {
1552
+ const e = t.get(O), n = t.get(Zt);
1550
1553
  return {
1551
- id: Et.id,
1554
+ id: Rt.id,
1552
1555
  icon: "FontColor",
1553
1556
  tooltip: "toolbar.textColor.main",
1554
- group: P.TOOLBAR_FORMAT,
1557
+ group: y.TOOLBAR_FORMAT,
1555
1558
  type: x.BUTTON_SELECTOR,
1556
- positions: [D.TOOLBAR_START],
1559
+ positions: [P.TOOLBAR_START],
1557
1560
  selections: [
1558
1561
  {
1559
1562
  label: {
1560
- name: _t,
1563
+ name: gt,
1561
1564
  hoverable: !1
1562
1565
  }
1563
1566
  }
1564
1567
  ],
1565
- value$: new w((o) => {
1566
- const i = t.getCurrentTheme().textColor, r = e.onCommandExecuted((s) => {
1567
- if (s.id === Et.id) {
1568
+ value$: new B((o) => {
1569
+ const i = n.getCurrentTheme().textColor, r = e.onCommandExecuted((s) => {
1570
+ if (s.id === Rt.id) {
1568
1571
  const a = s.params.value;
1569
1572
  o.next(a != null ? a : i);
1570
1573
  }
1571
1574
  });
1572
1575
  return o.next(i), r.dispose;
1573
1576
  }),
1574
- hidden$: A(n, v.UNIVER_DOC)
1577
+ hidden$: D(t, v.UNIVER_DOC)
1575
1578
  // disabled$: getCurrentSheetDisabled$(accessor),
1576
1579
  };
1577
1580
  }
1578
- function nr(n) {
1581
+ function Ki(t) {
1579
1582
  return {
1580
- id: mn.id,
1581
- group: P.TOOLBAR_OTHERS,
1583
+ id: pn.id,
1584
+ group: y.TOOLBAR_OTHERS,
1582
1585
  type: x.BUTTON,
1583
1586
  icon: "FreezeRowSingle",
1584
1587
  tooltip: "toolbar.headerFooter",
1585
- positions: [D.TOOLBAR_START],
1586
- hidden$: Ao(A(n, v.UNIVER_DOC), Bn(n), (e, t) => e || t)
1588
+ positions: [P.TOOLBAR_START],
1589
+ hidden$: To(D(t, v.UNIVER_DOC), An(t), (e, n) => e || n)
1587
1590
  };
1588
1591
  }
1589
- function or(n) {
1590
- const e = n.get(C);
1592
+ function Zi(t) {
1593
+ const e = t.get(O);
1591
1594
  return {
1592
- id: co.id,
1593
- group: P.TOOLBAR_LAYOUT,
1595
+ id: no.id,
1596
+ group: y.TOOLBAR_LAYOUT,
1594
1597
  type: x.BUTTON,
1595
1598
  icon: "LeftJustifyingSingle",
1596
1599
  tooltip: "toolbar.alignLeft",
1597
- positions: [D.TOOLBAR_START],
1598
- activated$: new w((t) => {
1600
+ positions: [P.TOOLBAR_START],
1601
+ activated$: new B((n) => {
1599
1602
  const o = e.onCommandExecuted((i) => {
1600
1603
  var s;
1601
1604
  const r = i.id;
1602
- if (r === V.id || r === je.id) {
1603
- const a = ze(n);
1605
+ if (r === V.id || r === Ve.id) {
1606
+ const a = ke(t);
1604
1607
  if (a == null)
1605
1608
  return;
1606
1609
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1607
- t.next(c === Le.LEFT);
1610
+ n.next(c === Ue.LEFT);
1608
1611
  }
1609
1612
  });
1610
- return t.next(!1), o.dispose;
1613
+ return n.next(!1), o.dispose;
1611
1614
  }),
1612
- hidden$: A(n, v.UNIVER_DOC)
1615
+ hidden$: D(t, v.UNIVER_DOC)
1613
1616
  };
1614
1617
  }
1615
- function ir(n) {
1616
- const e = n.get(C);
1618
+ function Ji(t) {
1619
+ const e = t.get(O);
1617
1620
  return {
1618
- id: lo.id,
1619
- group: P.TOOLBAR_LAYOUT,
1621
+ id: oo.id,
1622
+ group: y.TOOLBAR_LAYOUT,
1620
1623
  type: x.BUTTON,
1621
1624
  icon: "HorizontallySingle",
1622
1625
  tooltip: "toolbar.alignCenter",
1623
- positions: [D.TOOLBAR_START],
1624
- activated$: new w((t) => {
1626
+ positions: [P.TOOLBAR_START],
1627
+ activated$: new B((n) => {
1625
1628
  const o = e.onCommandExecuted((i) => {
1626
1629
  var s;
1627
1630
  const r = i.id;
1628
- if (r === V.id || r === je.id) {
1629
- const a = ze(n);
1631
+ if (r === V.id || r === Ve.id) {
1632
+ const a = ke(t);
1630
1633
  if (a == null)
1631
1634
  return;
1632
1635
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1633
- t.next(c === Le.CENTER);
1636
+ n.next(c === Ue.CENTER);
1634
1637
  }
1635
1638
  });
1636
- return t.next(!1), o.dispose;
1639
+ return n.next(!1), o.dispose;
1637
1640
  }),
1638
- hidden$: A(n, v.UNIVER_DOC)
1641
+ hidden$: D(t, v.UNIVER_DOC)
1639
1642
  };
1640
1643
  }
1641
- function rr(n) {
1642
- const e = n.get(C);
1644
+ function qi(t) {
1645
+ const e = t.get(O);
1643
1646
  return {
1644
- id: uo.id,
1645
- group: P.TOOLBAR_LAYOUT,
1647
+ id: io.id,
1648
+ group: y.TOOLBAR_LAYOUT,
1646
1649
  type: x.BUTTON,
1647
1650
  icon: "RightJustifyingSingle",
1648
1651
  tooltip: "toolbar.alignRight",
1649
- positions: [D.TOOLBAR_START],
1650
- activated$: new w((t) => {
1652
+ positions: [P.TOOLBAR_START],
1653
+ activated$: new B((n) => {
1651
1654
  const o = e.onCommandExecuted((i) => {
1652
1655
  var s;
1653
1656
  const r = i.id;
1654
- if (r === V.id || r === je.id) {
1655
- const a = ze(n);
1657
+ if (r === V.id || r === Ve.id) {
1658
+ const a = ke(t);
1656
1659
  if (a == null)
1657
1660
  return;
1658
1661
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1659
- t.next(c === Le.RIGHT);
1662
+ n.next(c === Ue.RIGHT);
1660
1663
  }
1661
1664
  });
1662
- return t.next(!1), o.dispose;
1665
+ return n.next(!1), o.dispose;
1663
1666
  }),
1664
- hidden$: A(n, v.UNIVER_DOC)
1667
+ hidden$: D(t, v.UNIVER_DOC)
1665
1668
  };
1666
1669
  }
1667
- function sr(n) {
1668
- const e = n.get(C);
1670
+ function Qi(t) {
1671
+ const e = t.get(O);
1669
1672
  return {
1670
- id: ho.id,
1671
- group: P.TOOLBAR_LAYOUT,
1673
+ id: ro.id,
1674
+ group: y.TOOLBAR_LAYOUT,
1672
1675
  type: x.BUTTON,
1673
1676
  icon: "AlignTextBothSingle",
1674
1677
  tooltip: "toolbar.alignJustify",
1675
- positions: [D.TOOLBAR_START],
1676
- activated$: new w((t) => {
1678
+ positions: [P.TOOLBAR_START],
1679
+ activated$: new B((n) => {
1677
1680
  const o = e.onCommandExecuted((i) => {
1678
1681
  var s;
1679
1682
  const r = i.id;
1680
- if (r === V.id || r === je.id) {
1681
- const a = ze(n);
1683
+ if (r === V.id || r === Ve.id) {
1684
+ const a = ke(t);
1682
1685
  if (a == null)
1683
1686
  return;
1684
1687
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1685
- t.next(c === Le.JUSTIFIED);
1688
+ n.next(c === Ue.JUSTIFIED);
1686
1689
  }
1687
1690
  });
1688
- return t.next(!1), o.dispose;
1691
+ return n.next(!1), o.dispose;
1689
1692
  }),
1690
- hidden$: A(n, v.UNIVER_DOC)
1693
+ hidden$: D(t, v.UNIVER_DOC)
1691
1694
  };
1692
1695
  }
1693
- function ar(n) {
1696
+ function er(t) {
1694
1697
  return {
1695
- id: go.id,
1696
- group: P.TOOLBAR_LAYOUT,
1698
+ id: so.id,
1699
+ group: y.TOOLBAR_LAYOUT,
1697
1700
  type: x.BUTTON,
1698
1701
  icon: "OrderSingle",
1699
1702
  tooltip: "toolbar.order",
1700
- positions: [D.TOOLBAR_START],
1701
- hidden$: A(n, v.UNIVER_DOC)
1703
+ positions: [P.TOOLBAR_START],
1704
+ hidden$: D(t, v.UNIVER_DOC)
1702
1705
  };
1703
1706
  }
1704
- function cr(n) {
1707
+ function tr(t) {
1705
1708
  return {
1706
- id: po.id,
1707
- group: P.TOOLBAR_LAYOUT,
1709
+ id: ao.id,
1710
+ group: y.TOOLBAR_LAYOUT,
1708
1711
  type: x.BUTTON,
1709
1712
  icon: "UnorderSingle",
1710
1713
  tooltip: "toolbar.unorder",
1711
- positions: [D.TOOLBAR_START],
1712
- hidden$: A(n, v.UNIVER_DOC)
1714
+ positions: [P.TOOLBAR_START],
1715
+ hidden$: D(t, v.UNIVER_DOC)
1713
1716
  };
1714
1717
  }
1715
- function lr(n) {
1718
+ function nr(t) {
1716
1719
  return {
1717
- id: _o.id,
1720
+ id: co.id,
1718
1721
  type: x.BUTTON,
1719
1722
  title: "toolbar.resetColor",
1720
1723
  icon: "NoColor",
1721
- positions: tt.id
1724
+ positions: Qe.id
1722
1725
  };
1723
1726
  }
1724
- function dr(n) {
1725
- const e = n.get(C), t = n.get(Qt);
1727
+ function or(t) {
1728
+ const e = t.get(O), n = t.get(Zt);
1726
1729
  return {
1727
- id: tt.id,
1730
+ id: Qe.id,
1728
1731
  tooltip: "toolbar.fillColor.main",
1729
- group: P.TOOLBAR_FORMAT,
1732
+ group: y.TOOLBAR_FORMAT,
1730
1733
  type: x.BUTTON_SELECTOR,
1731
- positions: [D.TOOLBAR_START],
1734
+ positions: [P.TOOLBAR_START],
1732
1735
  icon: "PaintBucket",
1733
1736
  selections: [
1734
1737
  {
1735
1738
  label: {
1736
- name: _t,
1739
+ name: gt,
1737
1740
  hoverable: !1
1738
1741
  }
1739
1742
  }
1740
1743
  ],
1741
- value$: new w((o) => {
1742
- const i = t.getCurrentTheme().primaryColor, r = e.onCommandExecuted((s) => {
1743
- if (s.id === tt.id) {
1744
+ value$: new B((o) => {
1745
+ const i = n.getCurrentTheme().primaryColor, r = e.onCommandExecuted((s) => {
1746
+ if (s.id === Qe.id) {
1744
1747
  const a = s.params.value;
1745
1748
  o.next(a != null ? a : i);
1746
1749
  }
1747
1750
  });
1748
1751
  return o.next(i), r.dispose;
1749
1752
  }),
1750
- hidden$: A(n, v.UNIVER_DOC)
1753
+ hidden$: D(t, v.UNIVER_DOC)
1751
1754
  };
1752
1755
  }
1753
- function q(n) {
1756
+ function Z(t) {
1754
1757
  var d;
1755
- const e = n.get(L), t = n.get(ne), o = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
1758
+ const e = t.get(U), n = t.get(ne), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
1756
1759
  if (o == null || i == null)
1757
1760
  return;
1758
1761
  const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.textRuns;
@@ -1760,21 +1763,21 @@ function q(n) {
1760
1763
  return;
1761
1764
  let c;
1762
1765
  for (let p = 0; p < a.length; p++) {
1763
- const g = a[p], h = a[p + 1];
1764
- if (h && h.st === h.ed && r === h.st) {
1765
- c = h;
1766
+ const h = a[p], g = a[p + 1];
1767
+ if (g && g.st === g.ed && r === g.st) {
1768
+ c = g;
1766
1769
  break;
1767
1770
  }
1768
- if (g.st <= r && r <= g.ed) {
1769
- c = g;
1771
+ if (h.st <= r && r <= h.ed) {
1772
+ c = h;
1770
1773
  break;
1771
1774
  }
1772
1775
  }
1773
1776
  return c;
1774
1777
  }
1775
- function ze(n) {
1778
+ function ke(t) {
1776
1779
  var d;
1777
- const e = n.get(L), t = n.get(ne), o = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
1780
+ const e = t.get(U), n = t.get(ne), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
1778
1781
  if (o == null || i == null)
1779
1782
  return;
1780
1783
  const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.paragraphs;
@@ -1782,60 +1785,60 @@ function ze(n) {
1782
1785
  return;
1783
1786
  let c = -1;
1784
1787
  for (const p of a) {
1785
- const { startIndex: g } = p;
1786
- if (r > c && r <= g)
1788
+ const { startIndex: h } = p;
1789
+ if (r > c && r <= h)
1787
1790
  return p;
1788
- c = g;
1791
+ c = h;
1789
1792
  }
1790
1793
  return null;
1791
1794
  }
1792
- var ur = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, gr = (n, e, t, o) => {
1793
- for (var i = o > 1 ? void 0 : o ? hr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
1794
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
1795
- return o && i && ur(e, t, i), i;
1796
- }, J = (n, e) => (t, o) => e(t, o, n);
1797
- let Se = class extends K {
1798
- constructor(n, e, t, o, i, r, s, a) {
1799
- super(), this._config = n, this._injector = e, this._componentManager = t, this._layoutService = o, this._editorService = i, this._menuService = r, this._uiPartsService = s, this._univerInstanceService = a, this._init();
1795
+ var ir = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, sr = (t, e, n, o) => {
1796
+ for (var i = o > 1 ? void 0 : o ? rr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1797
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1798
+ return o && i && ir(e, n, i), i;
1799
+ }, J = (t, e) => (n, o) => e(n, o, t);
1800
+ let Se = class extends te {
1801
+ constructor(t, e, n, o, i, r, s, a) {
1802
+ super(), this._config = t, this._injector = e, this._componentManager = n, this._layoutService = o, this._editorService = i, this._menuService = r, this._uiPartsService = s, this._univerInstanceService = a, this._init();
1800
1803
  }
1801
1804
  _initCustomComponents() {
1802
- const n = this._componentManager;
1803
- this.disposeWithMe(n.register(_t, wo)), this.disposeWithMe(n.register(dn, $n)), this.disposeWithMe(n.register(un, Hn)), this.disposeWithMe(n.register(hn, Vn));
1805
+ const t = this._componentManager;
1806
+ this.disposeWithMe(t.register(gt, Po)), this.disposeWithMe(t.register(an, Fn)), this.disposeWithMe(t.register(cn, Nn)), this.disposeWithMe(t.register(ln, Un));
1804
1807
  }
1805
1808
  _initMenus() {
1806
- const { menu: n = {} } = this._config;
1809
+ const { menu: t = {} } = this._config;
1807
1810
  [
1811
+ Hi,
1812
+ Vi,
1813
+ ji,
1814
+ Wi,
1815
+ ki,
1816
+ zi,
1808
1817
  Yi,
1818
+ Gi,
1809
1819
  Xi,
1810
1820
  Ki,
1811
1821
  Zi,
1812
- qi,
1813
1822
  Ji,
1814
- er,
1823
+ qi,
1815
1824
  Qi,
1825
+ er,
1816
1826
  tr,
1817
1827
  nr,
1818
- or,
1819
- ir,
1820
- rr,
1821
- sr,
1822
- ar,
1823
- cr,
1824
- lr,
1825
- dr
1828
+ or
1826
1829
  ].forEach((e) => {
1827
- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), n));
1830
+ this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), t));
1828
1831
  });
1829
1832
  }
1830
1833
  _init() {
1831
1834
  this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
1832
1835
  }
1833
1836
  _initDocBackground() {
1834
- const n = this._univerInstanceService.getAllUnitsForType(v.UNIVER_DOC)[0].getUnitId();
1835
- if (n == null)
1837
+ const t = this._univerInstanceService.getAllUnitsForType(v.UNIVER_DOC)[0].getUnitId();
1838
+ if (t == null)
1836
1839
  return;
1837
- this._editorService.isEditor(n) || this.disposeWithMe(
1838
- this._uiPartsService.registerComponent(jn.CONTENT, () => No(Fi, this._injector))
1840
+ this._editorService.isEditor(t) || this.disposeWithMe(
1841
+ this._uiPartsService.registerComponent(Ln.CONTENT, () => Mo(bi, this._injector))
1839
1842
  );
1840
1843
  }
1841
1844
  _initFocusHandler() {
@@ -1846,102 +1849,102 @@ let Se = class extends K {
1846
1849
  );
1847
1850
  }
1848
1851
  };
1849
- Se = gr([
1850
- Ue(we.Rendered, Se),
1852
+ Se = sr([
1853
+ Le(we.Rendered, Se),
1851
1854
  J(1, T(Be)),
1852
- J(2, T(tn)),
1853
- J(3, en),
1854
- J(4, Y),
1855
- J(5, Wn),
1856
- J(6, kn),
1857
- J(7, L)
1855
+ J(2, T(qt)),
1856
+ J(3, Jt),
1857
+ J(4, K),
1858
+ J(5, wn),
1859
+ J(6, Bn),
1860
+ J(7, U)
1858
1861
  ], Se);
1859
- const pr = {
1860
- id: fo.id,
1861
- preconditions: $o,
1862
+ const ar = {
1863
+ id: lo.id,
1864
+ preconditions: Ao,
1862
1865
  binding: H.ENTER
1863
- }, _r = {
1864
- id: mo.id,
1865
- preconditions: z,
1866
+ }, cr = {
1867
+ id: uo.id,
1868
+ preconditions: W,
1866
1869
  binding: H.BACKSPACE
1867
- }, fr = {
1868
- id: So.id,
1869
- preconditions: z,
1870
+ }, lr = {
1871
+ id: ho.id,
1872
+ preconditions: W,
1870
1873
  binding: H.DELETE
1871
1874
  };
1872
- function Ge(n) {
1873
- return n.getContextValue(Ne) || n.getContextValue(Jt);
1875
+ function ze(t) {
1876
+ return t.getContextValue(Ne) || t.getContextValue(Kt);
1874
1877
  }
1875
- const ft = 999, mr = {
1876
- id: zn.id,
1878
+ const pt = 999, dr = {
1879
+ id: $n.id,
1877
1880
  name: "doc.command.copy",
1878
1881
  type: de.COMMAND,
1879
1882
  multi: !0,
1880
- priority: ft,
1881
- preconditions: Ge,
1882
- handler: async (n) => n.get(Ce).copy()
1883
- }, Sr = {
1884
- id: Gn.id,
1883
+ priority: pt,
1884
+ preconditions: ze,
1885
+ handler: async (t) => t.get(Oe).copy()
1886
+ }, ur = {
1887
+ id: Hn.id,
1885
1888
  name: "doc.command.cut",
1886
1889
  type: de.COMMAND,
1887
1890
  multi: !0,
1888
- priority: ft,
1889
- preconditions: Ge,
1890
- handler: async (n) => n.get(Ce).cut()
1891
- }, vr = {
1892
- id: Yn.id,
1891
+ priority: pt,
1892
+ preconditions: ze,
1893
+ handler: async (t) => t.get(Oe).cut()
1894
+ }, hr = {
1895
+ id: Vn.id,
1893
1896
  name: "doc.command.paste",
1894
1897
  type: de.COMMAND,
1895
1898
  multi: !0,
1896
- priority: ft,
1897
- preconditions: Ge,
1898
- handler: async (n) => {
1899
- const e = n.get(Ce), o = await n.get(gt).read();
1899
+ priority: pt,
1900
+ preconditions: ze,
1901
+ handler: async (t) => {
1902
+ const e = t.get(Oe), o = await t.get(dt).read();
1900
1903
  return o.length === 0 ? !1 : e.paste(o);
1901
1904
  }
1902
1905
  };
1903
- var Or = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, Cr = (n, e, t, o) => {
1904
- for (var i = o > 1 ? void 0 : o ? Rr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
1905
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
1906
- return o && i && Or(e, t, i), i;
1907
- }, ge = (n, e) => (t, o) => e(t, o, n);
1908
- let xe = class extends Oe {
1909
- constructor(n, e, t, o, i) {
1910
- super(), this._commandService = n, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = o, this._contextService = i, this._init();
1906
+ var gr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, fr = (t, e, n, o) => {
1907
+ for (var i = o > 1 ? void 0 : o ? pr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1908
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1909
+ return o && i && gr(e, n, i), i;
1910
+ }, ge = (t, e) => (n, o) => e(n, o, t);
1911
+ let Me = class extends ve {
1912
+ constructor(t, e, n, o, i) {
1913
+ super(), this._commandService = t, this._clipboardInterfaceService = e, this._docClipboardService = n, this._textSelectionRenderManager = o, this._contextService = i, this._init();
1911
1914
  }
1912
1915
  _init() {
1913
- [mr, Sr, vr].forEach((n) => this.disposeWithMe(this._commandService.registerMultipleCommand(n))), [on, nn].forEach((n) => this.disposeWithMe(this._commandService.registerCommand(n))), this._initLegacyPasteCommand();
1916
+ [dr, ur, hr].forEach((t) => this.disposeWithMe(this._commandService.registerMultipleCommand(t))), [en, Qt].forEach((t) => this.disposeWithMe(this._commandService.registerCommand(t))), this._initLegacyPasteCommand();
1914
1917
  }
1915
1918
  _initLegacyPasteCommand() {
1916
- var n;
1917
- (n = this._textSelectionRenderManager) == null || n.onPaste$.pipe(se(this.dispose$)).subscribe((e) => {
1919
+ var t;
1920
+ (t = this._textSelectionRenderManager) == null || t.onPaste$.pipe(se(this.dispose$)).subscribe((e) => {
1918
1921
  var r, s;
1919
- if (!Ge(this._contextService))
1922
+ if (!ze(this._contextService))
1920
1923
  return;
1921
1924
  e.event.preventDefault();
1922
- const t = e.event, o = (r = t.clipboardData) == null ? void 0 : r.getData("text/html"), i = (s = t.clipboardData) == null ? void 0 : s.getData("text/plain");
1925
+ const n = e.event, o = (r = n.clipboardData) == null ? void 0 : r.getData("text/html"), i = (s = n.clipboardData) == null ? void 0 : s.getData("text/plain");
1923
1926
  this._docClipboardService.legacyPaste(o, i);
1924
1927
  });
1925
1928
  }
1926
1929
  };
1927
- xe = Cr([
1928
- Ue(we.Rendered, xe),
1929
- ge(0, C),
1930
- ge(1, gt),
1931
- ge(2, Ce),
1930
+ Me = fr([
1931
+ Le(we.Rendered, Me),
1932
+ ge(0, O),
1933
+ ge(1, dt),
1934
+ ge(2, Oe),
1932
1935
  ge(3, oe),
1933
- ge(4, bn)
1934
- ], xe);
1935
- var Er = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ir = (n, e, t, o) => {
1936
- for (var i = o > 1 ? void 0 : o ? Tr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
1937
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
1938
- return o && i && Er(e, t, i), i;
1939
- }, pe = (n, e) => (t, o) => e(t, o, n);
1940
- let ye = class extends K {
1941
- constructor(e, t, o, i, r) {
1936
+ ge(4, Cn)
1937
+ ], Me);
1938
+ var _r = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (t, e, n, o) => {
1939
+ for (var i = o > 1 ? void 0 : o ? mr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1940
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1941
+ return o && i && _r(e, n, i), i;
1942
+ }, pe = (t, e) => (n, o) => e(n, o, t);
1943
+ let xe = class extends te {
1944
+ constructor(e, n, o, i, r) {
1942
1945
  super();
1943
- E(this, "_initialEditors", /* @__PURE__ */ new Set());
1944
- this._univerInstanceService = e, this._editorService = t, this._commandService = o, this._textSelectionRenderManager = i, this._renderManagerService = r, this._initialize();
1946
+ C(this, "_initialEditors", /* @__PURE__ */ new Set());
1947
+ this._univerInstanceService = e, this._editorService = n, this._commandService = o, this._textSelectionRenderManager = i, this._renderManagerService = r, this._initialize();
1945
1948
  }
1946
1949
  _initialize() {
1947
1950
  this.disposeWithMe(
@@ -1949,39 +1952,39 @@ let ye = class extends K {
1949
1952
  this._resize(e);
1950
1953
  })
1951
1954
  ), this._editorService.getAllEditor().forEach((e) => {
1952
- const t = e.editorUnitId;
1953
- this._initialEditors.has(t) || (this._initialEditors.add(t), this._resize(t));
1955
+ const n = e.editorUnitId;
1956
+ this._initialEditors.has(n) || (this._initialEditors.add(n), this._resize(n));
1954
1957
  }), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
1955
1958
  }
1956
1959
  _resize(e) {
1957
- var M, I, R;
1960
+ var b, M, E;
1958
1961
  if (e == null)
1959
1962
  return;
1960
- const t = this._editorService.getEditor(e);
1961
- if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
1963
+ const n = this._editorService.getEditor(e);
1964
+ if ((n == null ? void 0 : n.cancelDefaultResizeListener) === !0)
1962
1965
  return;
1963
1966
  const o = this._univerInstanceService.getUniverDocInstance(e);
1964
1967
  if (!o)
1965
1968
  return;
1966
- const i = (M = this._renderManagerService.getRenderById(o.getUnitId())) == null ? void 0 : M.with(N).getSkeleton();
1967
- if (t == null || t.render == null || i == null || o == null)
1969
+ const i = (b = this._renderManagerService.getRenderById(o.getUnitId())) == null ? void 0 : b.with(w).getSkeleton();
1970
+ if (n == null || n.render == null || i == null || o == null)
1968
1971
  return;
1969
1972
  i.calculate();
1970
- const { marginTop: r = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = o.getSnapshot().documentStyle, { scene: d, mainComponent: p } = t.render;
1971
- let { actualHeight: g, actualWidth: h } = i.getActualSize();
1972
- g += r + s, h += a + c;
1973
- const { width: l, height: f } = t.getBoundingClientRect(), u = d.getViewport(te.VIEW_MAIN);
1973
+ const { marginTop: r = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = o.getSnapshot().documentStyle, { scene: d, mainComponent: p } = n.render;
1974
+ let { actualHeight: h, actualWidth: g } = i.getActualSize();
1975
+ h += r + s, g += a + c;
1976
+ const { width: l, height: f } = n.getBoundingClientRect(), u = d.getViewport(ee.VIEW_MAIN);
1974
1977
  let _ = u == null ? void 0 : u.getScrollBar();
1975
- const m = Math.max(h, l), O = Math.max(g, f);
1978
+ const m = Math.max(g, l), R = Math.max(h, f);
1976
1979
  d.transformByState({
1977
1980
  width: m,
1978
- height: O
1979
- }), p == null || p.resize(m, O), t.isSingle() ? h > l ? _ == null ? u && new nt(u, { barSize: 8, enableVertical: !1 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (R = u == null ? void 0 : u.getScrollBar()) == null || R.dispose()) : g > f ? _ == null ? u && new nt(u, { enableHorizontal: !1, barSize: 8 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (I = u == null ? void 0 : u.getScrollBar()) == null || I.dispose());
1981
+ height: R
1982
+ }), p == null || p.resize(m, R), n.isSingle() ? g > l ? _ == null ? u && new et(u, { barSize: 8, enableVertical: !1 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (E = u == null ? void 0 : u.getScrollBar()) == null || E.dispose()) : h > f ? _ == null ? u && new et(u, { enableHorizontal: !1, barSize: 8 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (M = u == null ? void 0 : u.getScrollBar()) == null || M.dispose());
1980
1983
  }
1981
1984
  _initialSetValue() {
1982
1985
  this.disposeWithMe(
1983
1986
  this._editorService.setValue$.subscribe((e) => {
1984
- this._commandService.executeCommand(vo.id, {
1987
+ this._commandService.executeCommand(go.id, {
1985
1988
  unitId: e.editorUnitId,
1986
1989
  body: e.body,
1987
1990
  segmentId: null
@@ -2000,8 +2003,8 @@ let ye = class extends K {
2000
2003
  const e = (i = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : i.getUnitId();
2001
2004
  if (e == null)
2002
2005
  return;
2003
- const t = this._editorService.getEditor(e), o = this._editorService.getFocusEditor();
2004
- t == null || t.isSheetEditor() || o && o.editorUnitId === e || this._editorService.blur();
2006
+ const n = this._editorService.getEditor(e), o = this._editorService.getFocusEditor();
2007
+ n == null || n.isSheetEditor() || o && o.editorUnitId === e || this._editorService.blur();
2005
2008
  })
2006
2009
  );
2007
2010
  }
@@ -2018,9 +2021,9 @@ let ye = class extends K {
2018
2021
  "univer-formula-help-param"
2019
2022
  ];
2020
2023
  this.disposeWithMe(
2021
- yt(window, "mousedown").subscribe((o) => {
2024
+ bt(window, "mousedown").subscribe((o) => {
2022
2025
  const r = o.target.classList[0] || "";
2023
- if (Mn(r, e)) {
2026
+ if (En(r, e)) {
2024
2027
  this._editorService.changeSpreadsheetFocusState(!0), o.stopPropagation();
2025
2028
  return;
2026
2029
  }
@@ -2028,7 +2031,7 @@ let ye = class extends K {
2028
2031
  })
2029
2032
  ), this._univerInstanceService.getAllUnitsForType(v.UNIVER_SHEET).forEach((o) => {
2030
2033
  const i = o.getUnitId(), r = this._renderManagerService.getRenderById(i), s = r == null ? void 0 : r.engine.getCanvas().getCanvasEle();
2031
- s != null && yt(s, "mousedown").subscribe((a) => {
2034
+ s != null && bt(s, "mousedown").subscribe((a) => {
2032
2035
  this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
2033
2036
  });
2034
2037
  });
@@ -2049,18 +2052,18 @@ let ye = class extends K {
2049
2052
  const e = (o = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : o.getUnitId();
2050
2053
  if (e == null)
2051
2054
  return;
2052
- const t = this._editorService.getEditor(e);
2053
- t == null || t.isSheetEditor() || this._editorService.refreshValueChange(e);
2055
+ const n = this._editorService.getEditor(e);
2056
+ n == null || n.isSheetEditor() || this._editorService.refreshValueChange(e);
2054
2057
  }
2055
2058
  /**
2056
2059
  * Listen to document edits to refresh the size of the formula editor.
2057
2060
  */
2058
2061
  _commandExecutedListener() {
2059
- const e = [Ve.id, Xn.id];
2062
+ const e = [ut.id, jn.id];
2060
2063
  this.disposeWithMe(
2061
- this._commandService.onCommandExecuted((t) => {
2062
- if (e.includes(t.id)) {
2063
- const o = t.params, { unitId: i } = o;
2064
+ this._commandService.onCommandExecuted((n) => {
2065
+ if (e.includes(n.id)) {
2066
+ const o = n.params, { unitId: i } = o;
2064
2067
  if (this._editorService.isSheetEditor(i))
2065
2068
  return;
2066
2069
  this._resize(i), this._valueChange();
@@ -2069,36 +2072,36 @@ let ye = class extends K {
2069
2072
  );
2070
2073
  }
2071
2074
  };
2072
- ye = Ir([
2073
- Ue(we.Rendered, ye),
2074
- pe(0, L),
2075
- pe(1, Y),
2076
- pe(2, C),
2075
+ xe = Sr([
2076
+ Le(we.Rendered, xe),
2077
+ pe(0, U),
2078
+ pe(1, K),
2079
+ pe(2, O),
2077
2080
  pe(3, oe),
2078
- pe(4, k)
2079
- ], ye);
2080
- var br = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, xr = (n, e, t, o) => {
2081
- for (var i = o > 1 ? void 0 : o ? Mr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2082
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2083
- return o && i && br(e, t, i), i;
2084
- }, _e = (n, e) => (t, o) => e(t, o, n);
2085
- let at = class extends Oe {
2086
- constructor(n, e, t, o, i, r) {
2087
- super(), this._context = n, this._commandService = e, this._docSkeletonManagerService = t, this._configService = o, this._editorService = i, this._renderManagerService = r, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
2088
- }
2089
- reRender(n) {
2081
+ pe(4, j)
2082
+ ], xe);
2083
+ var vr = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, Or = (t, e, n, o) => {
2084
+ for (var i = o > 1 ? void 0 : o ? Rr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2085
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2086
+ return o && i && vr(e, n, i), i;
2087
+ }, fe = (t, e) => (n, o) => e(n, o, t);
2088
+ let rt = class extends ve {
2089
+ constructor(t, e, n, o, i, r) {
2090
+ super(), this._context = t, this._commandService = e, this._docSkeletonManagerService = n, this._configService = o, this._editorService = i, this._renderManagerService = r, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
2091
+ }
2092
+ reRender(t) {
2090
2093
  var i, r;
2091
- const e = (i = this._renderManagerService.getRenderById(n)) == null ? void 0 : i.with(N), t = e == null ? void 0 : e.getSkeleton();
2092
- if (!(!t || t.getViewModel().getDataModel().getSnapshot().disabled)) {
2093
- if (t.calculate(), this._editorService.isEditor(n)) {
2094
+ const e = (i = this._renderManagerService.getRenderById(t)) == null ? void 0 : i.with(w), n = e == null ? void 0 : e.getSkeleton();
2095
+ if (!(!n || n.getViewModel().getDataModel().getSnapshot().disabled)) {
2096
+ if (n.calculate(), this._editorService.isEditor(t)) {
2094
2097
  (r = this._context.mainComponent) == null || r.makeDirty();
2095
2098
  return;
2096
2099
  }
2097
- this._recalculateSizeBySkeleton(t);
2100
+ this._recalculateSizeBySkeleton(n);
2098
2101
  }
2099
2102
  }
2100
2103
  _addNewRender() {
2101
- const { scene: n, engine: e, unit: t } = this._context, o = new Mo(te.VIEW_MAIN, n, {
2104
+ const { scene: t, engine: e, unit: n } = this._context, o = new Oo(ee.VIEW_MAIN, t, {
2102
2105
  left: 0,
2103
2106
  top: 0,
2104
2107
  bottom: 0,
@@ -2107,157 +2110,88 @@ let at = class extends Oe {
2107
2110
  isRelativeY: !0,
2108
2111
  isWheelPreventDefaultX: !0
2109
2112
  });
2110
- n.attachControl(), n.onMouseWheel$.subscribeEvent((s, a) => {
2113
+ t.attachControl(), t.onMouseWheel$.subscribeEvent((s, a) => {
2111
2114
  const c = s;
2112
2115
  if (c.ctrlKey) {
2113
2116
  const d = Math.abs(c.deltaX);
2114
2117
  let p = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
2115
- p *= c.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (p /= 2), n.scaleX + p > 4 ? n.scale(4, 4) : n.scaleX + p < 0.1 ? n.scale(0.1, 0.1) : c.preventDefault();
2118
+ p *= c.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (p /= 2), t.scaleX + p > 4 ? t.scale(4, 4) : t.scaleX + p < 0.1 ? t.scale(0.1, 0.1) : c.preventDefault();
2116
2119
  } else
2117
2120
  o.onMouseWheel(c, a);
2118
- }), this._configService.getConfig("hasScroll") !== !1 && new nt(o), n.addLayer(
2119
- new Mt(n, [], Ye),
2120
- new Mt(n, [], Oo)
2121
- ), this._addComponent(), t.getShouldRenderLoopImmediately() && e.runRenderLoop(() => {
2122
- n.render();
2121
+ }), this._configService.getConfig("hasScroll") !== !1 && new et(o), t.addLayer(
2122
+ new It(t, [], Ge),
2123
+ new It(t, [], po)
2124
+ ), this._addComponent(), n.getShouldRenderLoopImmediately() && e.runRenderLoop(() => {
2125
+ t.render();
2123
2126
  });
2124
2127
  }
2125
2128
  _addComponent() {
2126
- const { scene: n, unit: e, components: t } = this._context, o = {
2129
+ const { scene: t, unit: e, components: n } = this._context, o = {
2127
2130
  pageMarginLeft: e.documentStyle.marginLeft || 0,
2128
2131
  pageMarginTop: e.documentStyle.marginTop || 0
2129
- }, i = new xo(ie.MAIN, void 0, o);
2130
- i.zIndex = Tt;
2131
- const r = new yo(ie.BACKGROUND, void 0, o);
2132
- r.zIndex = Tt, this._context.mainComponent = i, t.set(ie.MAIN, i), t.set(ie.BACKGROUND, r), n.addObjects([i], Ye), n.addObjects([r], Ro), this._editorService.getEditor(e.getUnitId()) == null && n.enableLayerCache(Ye);
2132
+ }, i = new Co(ie.MAIN, void 0, o);
2133
+ i.zIndex = Ot;
2134
+ const r = new Eo(ie.BACKGROUND, void 0, o);
2135
+ r.zIndex = Ot, this._context.mainComponent = i, n.set(ie.MAIN, i), n.set(ie.BACKGROUND, r), t.addObjects([i], Ge), t.addObjects([r], fo), this._editorService.getEditor(e.getUnitId()) == null && t.enableLayerCache(Ge);
2133
2136
  }
2134
2137
  _initRenderRefresh() {
2135
- this._docSkeletonManagerService.currentSkeletonBefore$.pipe(se(this.dispose$)).subscribe((n) => {
2136
- this._create(n);
2138
+ this._docSkeletonManagerService.currentSkeletonBefore$.pipe(se(this.dispose$)).subscribe((t) => {
2139
+ this._create(t);
2137
2140
  });
2138
2141
  }
2139
- _create(n) {
2140
- if (!n)
2142
+ _create(t) {
2143
+ if (!t)
2141
2144
  return;
2142
- const { mainComponent: e, components: t } = this._context, o = e, i = t.get(ie.BACKGROUND);
2143
- o.changeSkeleton(n), i.changeSkeleton(n), this._recalculateSizeBySkeleton(n);
2145
+ const { mainComponent: e, components: n } = this._context, o = e, i = n.get(ie.BACKGROUND);
2146
+ o.changeSkeleton(t), i.changeSkeleton(t), this._recalculateSizeBySkeleton(t);
2144
2147
  }
2145
2148
  _initCommandListener() {
2146
- const n = [Ve.id];
2149
+ const t = [ut.id];
2147
2150
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2148
- if (n.includes(e.id)) {
2149
- const t = e.params, { unitId: o } = t;
2151
+ if (t.includes(e.id)) {
2152
+ const n = e.params, { unitId: o } = n;
2150
2153
  this.reRender(o);
2151
2154
  }
2152
2155
  }));
2153
2156
  }
2154
- _recalculateSizeBySkeleton(n) {
2157
+ _recalculateSizeBySkeleton(t) {
2155
2158
  var p;
2156
- const { mainComponent: e, scene: t, unitId: o, components: i } = this._context, r = e, s = i.get(ie.BACKGROUND), a = (p = n.getSkeletonData()) == null ? void 0 : p.pages;
2159
+ const { mainComponent: e, scene: n, unitId: o, components: i } = this._context, r = e, s = i.get(ie.BACKGROUND), a = (p = t.getSkeletonData()) == null ? void 0 : p.pages;
2157
2160
  if (a == null)
2158
2161
  return;
2159
2162
  let c = 0, d = 0;
2160
- for (let g = 0, h = a.length; g < h; g++) {
2161
- const l = a[g], { pageWidth: f, pageHeight: u } = l;
2162
- r.pageLayoutType === De.VERTICAL ? (d += u, d += r.pageMarginTop, g === h - 1 && (d += r.pageMarginTop), c = Math.max(c, f)) : r.pageLayoutType === De.HORIZONTAL && (c += f, g !== h - 1 && (c += r.pageMarginLeft), d = Math.max(d, u));
2163
- }
2164
- r.resize(c, d), s.resize(c, d), this._editorService.isEditor(o) || t.resize(c, d);
2165
- }
2166
- };
2167
- at = xr([
2168
- _e(1, C),
2169
- _e(2, T(N)),
2170
- _e(3, xn),
2171
- _e(4, Y),
2172
- _e(5, k)
2173
- ], at);
2174
- var yr = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, Dr = (n, e, t, o) => {
2175
- for (var i = o > 1 ? void 0 : o ? Pr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2176
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2177
- return o && i && yr(e, t, i), i;
2178
- }, Je = (n, e) => (t, o) => e(t, o, n);
2179
- let ct = class extends K {
2180
- constructor(e, t, o, i) {
2181
- super();
2182
- E(this, "_liquid", new Po());
2183
- E(this, "_pageMarginCache", /* @__PURE__ */ new Map());
2184
- this._context = e, this._docSkeletonManagerService = t, this._commandService = o, this._editorService = i, this._initialize(), this._commandExecutedListener();
2185
- }
2186
- _initialize() {
2187
- this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2188
- e != null && this._refreshDrawing(e);
2189
- });
2190
- }
2191
- _commandExecutedListener() {
2192
- const e = [Ve.id, ve.id];
2193
- this.disposeWithMe(
2194
- this._commandService.onCommandExecuted((t) => {
2195
- var o;
2196
- if (e.includes(t.id)) {
2197
- const i = t.params, { unitId: r } = i, s = this._docSkeletonManagerService.getSkeleton();
2198
- if (!s)
2199
- return;
2200
- if (this._editorService.isEditor(r)) {
2201
- (o = this._context.mainComponent) == null || o.makeDirty();
2202
- return;
2203
- }
2204
- this._refreshDrawing(s);
2205
- }
2206
- })
2207
- );
2208
- }
2209
- _refreshDrawing(e) {
2210
- const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: o, scene: i, unitId: r } = this._context, s = o;
2211
- if (!t)
2212
- return;
2213
- const { left: a, top: c, pageLayoutType: d, pageMarginLeft: p, pageMarginTop: g } = s, { pages: h } = t, l = [];
2214
- i.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
2215
- for (let f = 0, u = h.length; f < u; f++) {
2216
- const _ = h[f], { skeDrawings: m, marginLeft: O, marginTop: M } = _;
2217
- this._liquid.translatePagePadding(_), m.forEach((I) => {
2218
- const { aLeft: R, aTop: y, height: j, width: W, drawingId: $, drawingOrigin: mt } = I, Sn = mt.layoutType === yn.WRAP_NONE && mt.behindDoc === S.TRUE;
2219
- l.push({
2220
- unitId: r,
2221
- subUnitId: Pn,
2222
- floatingObjectId: $,
2223
- behindText: Sn,
2224
- floatingObject: {
2225
- left: R + a + this._liquid.x,
2226
- top: y + c + this._liquid.y,
2227
- width: W,
2228
- height: j
2229
- }
2230
- }), this._pageMarginCache.set($, {
2231
- marginLeft: this._liquid.x,
2232
- marginTop: this._liquid.y
2233
- });
2234
- }), this._liquid.restorePagePadding(_), this._liquid.translatePage(_, d, p, g);
2163
+ for (let h = 0, g = a.length; h < g; h++) {
2164
+ const l = a[h], { pageWidth: f, pageHeight: u } = l;
2165
+ r.pageLayoutType === De.VERTICAL ? (d += u, d += r.pageMarginTop, h === g - 1 && (d += r.pageMarginTop), c = Math.max(c, f)) : r.pageLayoutType === De.HORIZONTAL && (c += f, h !== g - 1 && (c += r.pageMarginLeft), d = Math.max(d, u));
2235
2166
  }
2167
+ r.resize(c, d), s.resize(c, d), this._editorService.isEditor(o) || n.resize(c, d);
2236
2168
  }
2237
2169
  };
2238
- ct = Dr([
2239
- Je(1, T(N)),
2240
- Je(2, C),
2241
- Je(3, Y)
2242
- ], ct);
2243
- var Ar = Object.defineProperty, Fr = Object.getOwnPropertyDescriptor, Nr = (n, e, t, o) => {
2244
- for (var i = o > 1 ? void 0 : o ? Fr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2245
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2246
- return o && i && Ar(e, t, i), i;
2247
- }, fe = (n, e) => (t, o) => e(t, o, n);
2248
- let lt = class extends K {
2249
- constructor(n, e, t, o, i, r) {
2250
- super(), this._context = n, this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = o, this._textSelectionManagerService = i, this._editorService = r, this._init();
2170
+ rt = Or([
2171
+ fe(1, O),
2172
+ fe(2, T(w)),
2173
+ fe(3, In),
2174
+ fe(4, K),
2175
+ fe(5, j)
2176
+ ], rt);
2177
+ var Cr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Ir = (t, e, n, o) => {
2178
+ for (var i = o > 1 ? void 0 : o ? Er(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2179
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2180
+ return o && i && Cr(e, n, i), i;
2181
+ }, _e = (t, e) => (n, o) => e(n, o, t);
2182
+ let st = class extends te {
2183
+ constructor(t, e, n, o, i, r) {
2184
+ super(), this._context = t, this._docSkeletonManagerService = e, this._univerInstanceService = n, this._commandService = o, this._textSelectionManagerService = i, this._editorService = r, this._init();
2251
2185
  }
2252
2186
  _init() {
2253
2187
  this._initSkeletonListener(), this._initCommandExecutedListener(), this._initRenderRefresher(), setTimeout(() => this._updateViewZoom(1, !0), 20);
2254
2188
  }
2255
2189
  _initRenderRefresher() {
2256
- this._docSkeletonManagerService.currentSkeleton$.subscribe((n) => {
2257
- if (n == null)
2190
+ this._docSkeletonManagerService.currentSkeleton$.subscribe((t) => {
2191
+ if (t == null)
2258
2192
  return;
2259
- const { unitId: e, scene: t } = this._context;
2260
- this._editorService.isEditor(e) || this.disposeWithMe(t.onMouseWheel$.subscribeEvent((o) => {
2193
+ const { unitId: e, scene: n } = this._context;
2194
+ this._editorService.isEditor(e) || this.disposeWithMe(n.onMouseWheel$.subscribeEvent((o) => {
2261
2195
  if (!o.ctrlKey)
2262
2196
  return;
2263
2197
  const i = this._univerInstanceService.getCurrentUniverDocInstance();
@@ -2265,10 +2199,10 @@ let lt = class extends K {
2265
2199
  return;
2266
2200
  const r = Math.abs(o.deltaX);
2267
2201
  let s = r < 40 ? 0.2 : r < 80 ? 0.4 : 0.2;
2268
- s *= o.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (s /= 2);
2202
+ s *= o.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (s /= 2);
2269
2203
  const a = i.zoomRatio;
2270
2204
  let c = +Number.parseFloat(`${a + s}`).toFixed(1);
2271
- c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(Co.id, {
2205
+ c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(_o.id, {
2272
2206
  zoomRatio: c,
2273
2207
  unitId: i.getUnitId()
2274
2208
  }), o.preventDefault();
@@ -2276,107 +2210,107 @@ let lt = class extends K {
2276
2210
  });
2277
2211
  }
2278
2212
  _initSkeletonListener() {
2279
- this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((n) => {
2280
- if (n == null)
2213
+ this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((t) => {
2214
+ if (t == null)
2281
2215
  return;
2282
2216
  const e = this._univerInstanceService.getCurrentUniverDocInstance();
2283
2217
  if (!e) return;
2284
- const t = e.zoomRatio || 1;
2285
- this._updateViewZoom(t, !1);
2218
+ const n = e.zoomRatio || 1;
2219
+ this._updateViewZoom(n, !1);
2286
2220
  }));
2287
2221
  }
2288
2222
  _initCommandExecutedListener() {
2289
- const n = [ve.id];
2223
+ const t = [Pe.id];
2290
2224
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2291
- if (n.includes(e.id)) {
2292
- const t = this._univerInstanceService.getCurrentUniverDocInstance();
2293
- if (!t) return;
2225
+ if (t.includes(e.id)) {
2226
+ const n = this._univerInstanceService.getCurrentUniverDocInstance();
2227
+ if (!n) return;
2294
2228
  const o = e.params, { unitId: i } = o;
2295
- if (i !== t.getUnitId())
2229
+ if (i !== n.getUnitId())
2296
2230
  return;
2297
- const r = t.zoomRatio || 1;
2231
+ const r = n.zoomRatio || 1;
2298
2232
  this._updateViewZoom(r);
2299
2233
  }
2300
2234
  }));
2301
2235
  }
2302
- _updateViewZoom(n, e = !0) {
2236
+ _updateViewZoom(t, e = !0) {
2303
2237
  var o;
2304
- const t = Q(this._context);
2305
- t.scene.scale(n, n), this._calculatePagePosition(t, n), e && this._textSelectionManagerService.refreshSelection(), (o = t.scene.getTransformer()) == null || o.clearSelectedObjects();
2238
+ const n = q(this._context);
2239
+ n.scene.scale(t, t), this._calculatePagePosition(n, t), e && this._textSelectionManagerService.refreshSelection(), (o = n.scene.getTransformer()) == null || o.clearSelectedObjects();
2306
2240
  }
2307
- _calculatePagePosition(n, e) {
2308
- const { document: t, scene: o, docBackground: i } = n, r = o == null ? void 0 : o.getParent(), { width: s, height: a, pageMarginLeft: c, pageMarginTop: d } = t;
2241
+ _calculatePagePosition(t, e) {
2242
+ const { document: n, scene: o, docBackground: i } = t, r = o == null ? void 0 : o.getParent(), { width: s, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
2309
2243
  if (r == null || s === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
2310
2244
  return;
2311
- const { width: p, height: g } = r;
2312
- let h = 0, l = 0, f = 0, u = 0, _ = Number.POSITIVE_INFINITY;
2313
- p > (s + c * 2) * e ? (h = p / 2 - s * e / 2, h /= e, f = (p - c * 2) / e, _ = 0) : (h = c, f = s + c * 2, _ = (f - p / e) / 2), g > a ? (l = g / 2 - a / 2, u = (g - d * 2) / e) : (l = d, u = a + d * 2), o.resize(f, u + 200), t.translate(h, l), i.translate(h, l);
2314
- const m = o.getViewport(te.VIEW_MAIN);
2245
+ const { width: p, height: h } = r;
2246
+ let g = 0, l = 0, f = 0, u = 0, _ = Number.POSITIVE_INFINITY;
2247
+ p > (s + c * 2) * e ? (g = p / 2 - s * e / 2, g /= e, f = (p - c * 2) / e, _ = 0) : (g = c, f = s + c * 2, _ = (f - p / e) / 2), h > a ? (l = h / 2 - a / 2, u = (h - d * 2) / e) : (l = d, u = a + d * 2), o.resize(f, u + 200), n.translate(g, l), i.translate(g, l);
2248
+ const m = o.getViewport(ee.VIEW_MAIN);
2315
2249
  if (_ !== Number.POSITIVE_INFINITY && m != null) {
2316
- const O = m.transViewportScroll2ScrollValue(_, 0).x;
2250
+ const R = m.transViewportScroll2ScrollValue(_, 0).x;
2317
2251
  m.scrollTo({
2318
- x: O
2252
+ x: R
2319
2253
  });
2320
2254
  }
2321
2255
  return this;
2322
2256
  }
2323
2257
  };
2324
- lt = Nr([
2325
- fe(1, T(N)),
2326
- fe(2, L),
2327
- fe(3, C),
2328
- fe(4, T(ne)),
2329
- fe(5, Y)
2330
- ], lt);
2331
- var Lr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, wr = (n, e, t, o) => {
2332
- for (var i = o > 1 ? void 0 : o ? Ur(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2333
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2334
- return o && i && Lr(e, t, i), i;
2335
- }, re = (n, e) => (t, o) => e(t, o, n);
2336
- let dt = class extends K {
2337
- constructor(e, t, o, i, r, s, a) {
2258
+ st = Ir([
2259
+ _e(1, T(w)),
2260
+ _e(2, U),
2261
+ _e(3, O),
2262
+ _e(4, T(ne)),
2263
+ _e(5, K)
2264
+ ], st);
2265
+ var Tr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Mr = (t, e, n, o) => {
2266
+ for (var i = o > 1 ? void 0 : o ? br(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2267
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2268
+ return o && i && Tr(e, n, i), i;
2269
+ }, re = (t, e) => (n, o) => e(n, o, t);
2270
+ let at = class extends te {
2271
+ constructor(e, n, o, i, r, s, a) {
2338
2272
  super();
2339
- E(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
2340
- this._context = e, this._commandService = t, this._editorService = o, this._instanceSrv = i, this._textSelectionRenderManager = r, this._docSkeletonManagerService = s, this._textSelectionManagerService = a, this._initialize();
2273
+ C(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
2274
+ this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._textSelectionRenderManager = r, this._docSkeletonManagerService = s, this._textSelectionManagerService = a, this._initialize();
2341
2275
  }
2342
2276
  _initialize() {
2343
2277
  this._init(), this._skeletonListener(), this._commandExecutedListener();
2344
2278
  }
2345
2279
  _init() {
2346
- const { unitId: e } = this._context, t = Q(this._context);
2347
- t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
2280
+ const { unitId: e } = this._context, n = q(this._context);
2281
+ n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
2348
2282
  }
2349
2283
  // eslint-disable-next-line max-lines-per-function
2350
2284
  _initialMain(e) {
2351
- const t = Q(this._context), { document: o, scene: i } = t;
2285
+ const n = q(this._context), { document: o, scene: i } = n;
2352
2286
  this.disposeWithMe(o.onPointerEnter$.subscribeEvent(() => {
2353
- this._isEditorReadOnly(e) || (o.cursor = xt.TEXT);
2287
+ this._isEditorReadOnly(e) || (o.cursor = Tt.TEXT);
2354
2288
  })), this.disposeWithMe(o.onPointerLeave$.subscribeEvent(() => {
2355
- o.cursor = xt.DEFAULT, i.resetCursor();
2289
+ o.cursor = Tt.DEFAULT, i.resetCursor();
2356
2290
  })), this.disposeWithMe(o.onPointerDown$.subscribeEvent((r, s) => {
2357
2291
  if (this._isEditorReadOnly(e))
2358
2292
  return;
2359
2293
  const a = this._instanceSrv.getCurrentUnitForType(v.UNIVER_DOC);
2360
2294
  (a == null ? void 0 : a.getUnitId()) !== e && this._instanceSrv.setCurrentUnitForType(e);
2361
- const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: p } = r, g = this._getTransformCoordForDocumentOffset(d, p);
2362
- if (g != null) {
2295
+ const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: p } = r, h = this._getTransformCoordForDocumentOffset(d, p);
2296
+ if (h != null) {
2363
2297
  const {
2364
- pageLayoutType: h = De.VERTICAL,
2298
+ pageLayoutType: g = De.VERTICAL,
2365
2299
  pageMarginLeft: l,
2366
2300
  pageMarginTop: f
2367
2301
  } = o.getOffsetConfig(), { editArea: u } = c.findEditAreaByCoord(
2368
- g,
2369
2302
  h,
2303
+ g,
2370
2304
  l,
2371
2305
  f
2372
2306
  ), _ = this._docSkeletonManagerService.getViewModel(), m = _.getEditArea();
2373
- m !== F.BODY && u !== F.BODY && u !== m && _.setEditArea(u);
2307
+ m !== N.BODY && u !== N.BODY && u !== m && _.setEditArea(u);
2374
2308
  }
2375
2309
  if (this._textSelectionRenderManager.eventTrigger(r), this._editorService.getEditor(e)) {
2376
2310
  this._setEditorFocus(e);
2377
- const { offsetX: h, offsetY: l } = r;
2311
+ const { offsetX: g, offsetY: l } = r;
2378
2312
  setTimeout(() => {
2379
- this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(h, l);
2313
+ this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(g, l);
2380
2314
  }, 0);
2381
2315
  }
2382
2316
  r.button !== 2 && s.stopPropagation();
@@ -2386,27 +2320,27 @@ let dt = class extends K {
2386
2320
  this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(r);
2387
2321
  }));
2388
2322
  }
2389
- _getTransformCoordForDocumentOffset(e, t) {
2390
- const o = Q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
2323
+ _getTransformCoordForDocumentOffset(e, n) {
2324
+ const o = q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
2391
2325
  if (a == null)
2392
2326
  return;
2393
- const c = a.transformVector2SceneCoord(sn.FromArray([e, t]));
2327
+ const c = a.transformVector2SceneCoord(nn.FromArray([e, n]));
2394
2328
  return s.clone().invert().applyPoint(c);
2395
2329
  }
2396
2330
  _isEditorReadOnly(e) {
2397
- const t = this._editorService.getEditor(e);
2398
- return t ? t.isReadOnly() : !1;
2331
+ const n = this._editorService.getEditor(e);
2332
+ return n ? n.isReadOnly() : !1;
2399
2333
  }
2400
2334
  _setEditorFocus(e) {
2401
2335
  this._editorService.focusStyle(e);
2402
2336
  }
2403
2337
  _commandExecutedListener() {
2404
- const e = [ve.id];
2338
+ const e = [Pe.id];
2405
2339
  this.disposeWithMe(
2406
- this._commandService.onCommandExecuted((t) => {
2340
+ this._commandService.onCommandExecuted((n) => {
2407
2341
  var o;
2408
- if (e.includes(t.id)) {
2409
- const i = t.params, { unitId: r } = i, s = (o = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : o.unitId;
2342
+ if (e.includes(n.id)) {
2343
+ const i = n.params, { unitId: r } = i, s = (o = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : o.unitId;
2410
2344
  if (r !== s)
2411
2345
  return;
2412
2346
  this._textSelectionManagerService.refreshSelection();
@@ -2419,8 +2353,8 @@ let dt = class extends K {
2419
2353
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2420
2354
  if (e == null)
2421
2355
  return;
2422
- const { scene: t, mainComponent: o, unitId: i } = this._context;
2423
- this._textSelectionRenderManager.changeRuntime(e, t, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2356
+ const { scene: n, mainComponent: o, unitId: i } = this._context;
2357
+ this._textSelectionRenderManager.changeRuntime(e, n, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2424
2358
  unitId: i,
2425
2359
  subUnitId: ""
2426
2360
  }), this._editorService.isEditor(i) || this._textSelectionManagerService.replaceTextRanges([
@@ -2433,96 +2367,96 @@ let dt = class extends K {
2433
2367
  );
2434
2368
  }
2435
2369
  };
2436
- dt = wr([
2437
- re(1, C),
2438
- re(2, Y),
2439
- re(3, L),
2370
+ at = Mr([
2371
+ re(1, O),
2372
+ re(2, K),
2373
+ re(3, U),
2440
2374
  re(4, oe),
2441
- re(5, T(N)),
2375
+ re(5, T(w)),
2442
2376
  re(6, T(ne))
2443
- ], dt);
2444
- var Br = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, Hr = (n, e, t, o) => {
2445
- for (var i = o > 1 ? void 0 : o ? $r(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2446
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2447
- return o && i && Br(e, t, i), i;
2448
- }, Ie = (n, e) => (t, o) => e(t, o, n);
2449
- function zt(n, e) {
2450
- const t = Gt(n.left, n.top, e), o = Gt(n.right, n.bottom, e);
2377
+ ], at);
2378
+ var xr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, Pr = (t, e, n, o) => {
2379
+ for (var i = o > 1 ? void 0 : o ? yr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2380
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2381
+ return o && i && xr(e, n, i), i;
2382
+ }, Ie = (t, e) => (n, o) => e(n, o, t);
2383
+ function jt(t, e) {
2384
+ const n = Wt(t.left, t.top, e), o = Wt(t.right, t.bottom, e);
2451
2385
  return {
2452
- left: t.x,
2453
- top: t.y,
2386
+ left: n.x,
2387
+ top: n.y,
2454
2388
  right: o.x,
2455
2389
  bottom: o.y
2456
2390
  };
2457
2391
  }
2458
- function Gt(n, e, t) {
2459
- const { scaleX: o, scaleY: i } = t.getAncestorScale(), r = t.getViewport(te.VIEW_MAIN);
2392
+ function Wt(t, e, n) {
2393
+ const { scaleX: o, scaleY: i } = n.getAncestorScale(), r = n.getViewport(ee.VIEW_MAIN);
2460
2394
  if (!r)
2461
2395
  return {
2462
- x: n,
2396
+ x: t,
2463
2397
  y: e
2464
2398
  };
2465
- const { viewportScrollX: s, viewportScrollY: a } = r, c = (n - s) * o, d = (e - a) * i;
2399
+ const { viewportScrollX: s, viewportScrollY: a } = r, c = (t - s) * o, d = (e - a) * i;
2466
2400
  return {
2467
2401
  x: c,
2468
2402
  y: d
2469
2403
  };
2470
2404
  }
2471
- let ut = class extends K {
2472
- constructor(n, e, t, o) {
2473
- super(), this._globalPopupManagerService = n, this._renderManagerService = e, this._univerInstanceService = t, this._commandService = o;
2405
+ let ct = class extends te {
2406
+ constructor(t, e, n, o) {
2407
+ super(), this._globalPopupManagerService = t, this._renderManagerService = e, this._univerInstanceService = n, this._commandService = o;
2474
2408
  }
2475
2409
  // #region attach to object
2476
- _createObjectPositionObserver(n, e) {
2477
- const t = () => {
2478
- const { scene: a } = e, { left: c, top: d, width: p, height: g } = n, h = {
2479
- left: c,
2480
- right: c + p,
2481
- top: d,
2482
- bottom: d + g
2483
- }, l = zt(h, a);
2410
+ _createObjectPositionObserver(t, e) {
2411
+ const n = () => {
2412
+ const { scene: a, engine: c } = e, { left: d, top: p, width: h, height: g } = t, l = {
2413
+ left: d,
2414
+ right: d + h,
2415
+ top: p,
2416
+ bottom: p + g
2417
+ }, f = jt(l, a), u = c.getCanvasElement().getBoundingClientRect().top;
2484
2418
  return {
2485
- left: l.left,
2486
- right: l.right,
2487
- top: l.top,
2488
- bottom: l.bottom
2419
+ left: f.left,
2420
+ right: f.right,
2421
+ top: f.top + u,
2422
+ bottom: f.bottom
2489
2423
  };
2490
- }, o = t(), i = new Pt(o), r = new vt();
2424
+ }, o = n(), i = new Mt(o), r = new _t();
2491
2425
  r.add(this._commandService.onCommandExecuted((a) => {
2492
- a.id === ve.id && i.next(t());
2426
+ a.id === Pe.id && i.next(n());
2493
2427
  }));
2494
- const s = e.scene.getViewport(te.VIEW_MAIN);
2428
+ const s = e.scene.getViewport(ee.VIEW_MAIN);
2495
2429
  return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
2496
- i.next(t());
2430
+ i.next(n());
2497
2431
  })), {
2498
2432
  position: o,
2499
2433
  position$: i,
2500
2434
  disposable: r
2501
2435
  };
2502
2436
  }
2503
- _createRangePositionObserver(n, e) {
2437
+ _createRangePositionObserver(t, e) {
2504
2438
  var a;
2505
- const t = () => {
2506
- const { scene: c, mainComponent: d } = e, p = e.with(N).getSkeleton(), g = p.findNodePositionByCharIndex(n.startOffset), h = p.findNodePositionByCharIndex(n.endOffset), l = d;
2507
- if (!h || !g)
2439
+ const n = () => {
2440
+ const { scene: c, mainComponent: d, engine: p } = e, h = e.with(w).getSkeleton(), g = h.findNodePositionByCharIndex(t.startOffset), l = h.findNodePositionByCharIndex(t.endOffset), f = d;
2441
+ if (!l || !g)
2508
2442
  return;
2509
- const f = l.getOffsetConfig(), { docsLeft: u, docsTop: _ } = f, m = new rn(f, p), { borderBoxPointGroup: O } = m.getRangePointData(g, h);
2510
- return Do(O).map((R) => zt(R, c)).map((R) => ({
2511
- left: R.left + u,
2512
- right: R.right + u,
2513
- top: R.top + _,
2514
- bottom: R.bottom + _
2443
+ const u = f.getOffsetConfig(), { docsLeft: _, docsTop: m } = u, R = p.getCanvasElement().getBoundingClientRect().top, b = new tn(u, h), { borderBoxPointGroup: M } = b.getRangePointData(g, l);
2444
+ return Io(M).map((F) => jt(F, c)).map((F) => ({
2445
+ left: F.left + _,
2446
+ right: F.right + _,
2447
+ top: F.top + m + R,
2448
+ bottom: F.bottom + m
2515
2449
  }));
2516
- }, o = (a = t()) != null ? a : [], i = new Pt(o), r = new vt();
2450
+ }, o = (a = n()) != null ? a : [], i = new Mt(o), r = new _t();
2517
2451
  r.add(this._commandService.onCommandExecuted((c) => {
2518
- if (c.id === ve.id) {
2519
- const d = t();
2452
+ if (c.id === Pe.id) {
2453
+ const d = n();
2520
2454
  d && i.next(d);
2521
2455
  }
2522
2456
  }));
2523
- const s = e.scene.getViewport(te.VIEW_MAIN);
2457
+ const s = e.scene.getViewport(ee.VIEW_MAIN);
2524
2458
  return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
2525
- const c = t();
2459
+ const c = n();
2526
2460
  c && i.next(c);
2527
2461
  })), {
2528
2462
  positions: o,
@@ -2536,14 +2470,14 @@ let ut = class extends K {
2536
2470
  * @param popup popup item
2537
2471
  * @returns disposable
2538
2472
  */
2539
- attachPopupToObject(n, e) {
2473
+ attachPopupToObject(t, e) {
2540
2474
  const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), i = this._renderManagerService.getRenderById(o);
2541
2475
  if (!i)
2542
2476
  return {
2543
2477
  dispose: () => {
2544
2478
  }
2545
2479
  };
2546
- const { position: r, position$: s, disposable: a } = this._createObjectPositionObserver(n, i), c = this._globalPopupManagerService.addPopup({
2480
+ const { position: r, position$: s, disposable: a } = this._createObjectPositionObserver(t, i), c = this._globalPopupManagerService.addPopup({
2547
2481
  ...e,
2548
2482
  unitId: o,
2549
2483
  subUnitId: "default",
@@ -2556,14 +2490,14 @@ let ut = class extends K {
2556
2490
  }
2557
2491
  };
2558
2492
  }
2559
- attachPopupToRange(n, e) {
2493
+ attachPopupToRange(t, e) {
2560
2494
  const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), { direction: i = "top" } = e, r = this._renderManagerService.getRenderById(o);
2561
2495
  if (!r)
2562
2496
  return {
2563
2497
  dispose: () => {
2564
2498
  }
2565
2499
  };
2566
- const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(n, r), d = a.pipe(Fo((g) => i === "top" ? g[0] : g[g.length - 1])), p = this._globalPopupManagerService.addPopup({
2500
+ const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(t, r), d = a.pipe(bo((h) => i === "top" ? h[0] : h[h.length - 1])), p = this._globalPopupManagerService.addPopup({
2567
2501
  ...e,
2568
2502
  unitId: o,
2569
2503
  subUnitId: "default",
@@ -2580,49 +2514,49 @@ let ut = class extends K {
2580
2514
  };
2581
2515
  }
2582
2516
  };
2583
- ut = Hr([
2584
- Ie(0, T(Kn)),
2585
- Ie(1, k),
2586
- Ie(2, L),
2587
- Ie(3, C)
2588
- ], ut);
2589
- var Vr = Object.defineProperty, jr = Object.getOwnPropertyDescriptor, Wr = (n, e, t, o) => {
2590
- for (var i = o > 1 ? void 0 : o ? jr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2591
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2592
- return o && i && Vr(e, t, i), i;
2593
- }, Yt = (n, e) => (t, o) => e(t, o, n);
2594
- let Pe = class extends Oe {
2595
- constructor(n, e) {
2596
- super(), this._instanceSrv = n, this._renderManagerService = e, this._init();
2517
+ ct = Pr([
2518
+ Ie(0, T(Wn)),
2519
+ Ie(1, j),
2520
+ Ie(2, U),
2521
+ Ie(3, O)
2522
+ ], ct);
2523
+ var Dr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Fr = (t, e, n, o) => {
2524
+ for (var i = o > 1 ? void 0 : o ? Ar(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2525
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2526
+ return o && i && Dr(e, n, i), i;
2527
+ }, kt = (t, e) => (n, o) => e(n, o, t);
2528
+ let ye = class extends ve {
2529
+ constructor(t, e) {
2530
+ super(), this._instanceSrv = t, this._renderManagerService = e, this._init();
2597
2531
  }
2598
2532
  _init() {
2599
- this._renderManagerService.createRender$.pipe(se(this.dispose$)).subscribe((n) => this._createRenderWithId(n)), this._instanceSrv.getTypeOfUnitAdded$(v.UNIVER_DOC).pipe(se(this.dispose$)).subscribe((n) => this._createRenderer(n)), this._instanceSrv.getAllUnitsForType(v.UNIVER_DOC).forEach((n) => this._createRenderer(n)), this._instanceSrv.getTypeOfUnitDisposed$(v.UNIVER_DOC).pipe(se(this.dispose$)).subscribe((n) => this._disposeRenderer(n));
2533
+ this._renderManagerService.createRender$.pipe(se(this.dispose$)).subscribe((t) => this._createRenderWithId(t)), this._instanceSrv.getTypeOfUnitAdded$(v.UNIVER_DOC).pipe(se(this.dispose$)).subscribe((t) => this._createRenderer(t)), this._instanceSrv.getAllUnitsForType(v.UNIVER_DOC).forEach((t) => this._createRenderer(t)), this._instanceSrv.getTypeOfUnitDisposed$(v.UNIVER_DOC).pipe(se(this.dispose$)).subscribe((t) => this._disposeRenderer(t));
2600
2534
  }
2601
- _createRenderer(n) {
2602
- const e = n.getUnitId();
2535
+ _createRenderer(t) {
2536
+ const e = t.getUnitId();
2603
2537
  this._renderManagerService.has(e) || (this._createRenderWithId(e), this._renderManagerService.setCurrent(e));
2604
2538
  }
2605
- _createRenderWithId(n) {
2606
- this._renderManagerService.createRender(n);
2539
+ _createRenderWithId(t) {
2540
+ this._renderManagerService.createRender(t);
2607
2541
  }
2608
- _disposeRenderer(n) {
2609
- const e = n.getUnitId();
2542
+ _disposeRenderer(t) {
2543
+ const e = t.getUnitId();
2610
2544
  this._renderManagerService.removeRender(e);
2611
2545
  }
2612
2546
  };
2613
- Pe = Wr([
2614
- Ue(we.Ready, Pe),
2615
- Yt(0, L),
2616
- Yt(1, k)
2617
- ], Pe);
2618
- var kr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, Gr = (n, e, t, o) => {
2619
- for (var i = o > 1 ? void 0 : o ? zr(e, t) : e, r = n.length - 1, s; r >= 0; r--)
2620
- (s = n[r]) && (i = (o ? s(e, t, i) : s(i)) || i);
2621
- return o && i && kr(e, t, i), i;
2622
- }, Qe = (n, e) => (t, o) => e(t, o, n), be;
2623
- let Xt = (be = class extends Dn {
2624
- constructor(n, e, t, o) {
2625
- super(), this._config = n, this._injector = e, this._renderManagerSrv = t, this._logService = o, this._config = ee.deepMerge({}, ci, this._config), this._initDependencies(e), this._initializeCommands();
2547
+ ye = Fr([
2548
+ Le(we.Ready, ye),
2549
+ kt(0, U),
2550
+ kt(1, j)
2551
+ ], ye);
2552
+ var Nr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Lr = (t, e, n, o) => {
2553
+ for (var i = o > 1 ? void 0 : o ? Ur(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2554
+ (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2555
+ return o && i && Nr(e, n, i), i;
2556
+ }, Je = (t, e) => (n, o) => e(n, o, t), Te;
2557
+ let zt = (Te = class extends Tn {
2558
+ constructor(t, e, n, o) {
2559
+ super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._logService = o, this._config = Q.deepMerge({}, ti, this._config), this._initDependencies(e), this._initializeCommands();
2626
2560
  }
2627
2561
  onReady() {
2628
2562
  this._initRenderBasics();
@@ -2632,42 +2566,42 @@ let Xt = (be = class extends Dn {
2632
2566
  }
2633
2567
  _initializeCommands() {
2634
2568
  [
2569
+ oi,
2570
+ ii,
2571
+ si,
2572
+ ri,
2573
+ ai,
2574
+ ci,
2575
+ li,
2635
2576
  di,
2636
2577
  ui,
2637
- gi,
2638
- hi,
2639
- pi,
2640
- _i,
2641
- fi,
2642
- mi,
2643
- Si,
2644
- _r,
2645
- fr,
2646
- pr
2647
- ].forEach((n) => {
2648
- this._injector.get(Zn).registerShortcut(n);
2578
+ cr,
2579
+ lr,
2580
+ ar
2581
+ ].forEach((t) => {
2582
+ this._injector.get(kn).registerShortcut(t);
2649
2583
  });
2650
2584
  }
2651
- _initDependencies(n) {
2585
+ _initDependencies(t) {
2652
2586
  [
2653
2587
  [Se, { useFactory: () => this._injector.createInstance(Se, this._config) }],
2588
+ [Me],
2654
2589
  [xe],
2655
2590
  [ye],
2656
- [Pe],
2657
2591
  [me, { useFactory: () => this._injector.createInstance(me, this._config) }],
2658
- [Ce, { useClass: ot }],
2659
- [ut]
2660
- ].forEach((t) => n.add(t));
2592
+ [Oe, { useClass: tt }],
2593
+ [ct]
2594
+ ].forEach((n) => t.add(n));
2661
2595
  }
2662
2596
  _markDocAsFocused() {
2663
- const n = this._injector.get(L), e = this._injector.get(Y);
2597
+ const t = this._injector.get(U), e = this._injector.get(K);
2664
2598
  try {
2665
- const t = n.getCurrentUnitForType(v.UNIVER_DOC);
2666
- if (!t) return;
2667
- const o = t.getUnitId();
2668
- e.isEditor(o) || n.focusUnit(t.getUnitId());
2669
- } catch (t) {
2670
- this._logService.warn(t);
2599
+ const n = t.getCurrentUnitForType(v.UNIVER_DOC);
2600
+ if (!n) return;
2601
+ const o = n.getUnitId();
2602
+ e.isEditor(o) || t.focusUnit(n.getUnitId());
2603
+ } catch (n) {
2604
+ this._logService.warn(n);
2671
2605
  }
2672
2606
  }
2673
2607
  _initUI() {
@@ -2675,73 +2609,72 @@ let Xt = (be = class extends Dn {
2675
2609
  }
2676
2610
  _initRenderBasics() {
2677
2611
  [
2678
- N,
2679
- Eo,
2680
- at,
2681
- lt
2682
- ].forEach((n) => {
2683
- this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, n);
2612
+ [w],
2613
+ [mo],
2614
+ [rt],
2615
+ [st]
2616
+ ].forEach((t) => {
2617
+ this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
2684
2618
  });
2685
2619
  }
2686
2620
  _initRenderModules() {
2687
2621
  [
2688
- it,
2689
- ct,
2690
- dt,
2691
- st
2692
- ].forEach((n) => {
2693
- this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, n);
2622
+ [nt],
2623
+ [at],
2624
+ [it]
2625
+ ].forEach((t) => {
2626
+ this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
2694
2627
  });
2695
2628
  }
2696
- }, E(be, "pluginName", li), E(be, "type", v.UNIVER_DOC), be);
2697
- Xt = Gr([
2698
- Qe(1, T(Be)),
2699
- Qe(2, k),
2700
- Qe(3, Zt)
2701
- ], Xt);
2702
- function is(n) {
2629
+ }, C(Te, "pluginName", ni), C(Te, "type", v.UNIVER_DOC), Te);
2630
+ zt = Lr([
2631
+ Je(1, T(Be)),
2632
+ Je(2, j),
2633
+ Je(3, Yt)
2634
+ ], zt);
2635
+ function Xr(t) {
2703
2636
  return {
2704
- left: n.positionH.posOffset,
2705
- top: n.positionV.posOffset,
2706
- width: n.size.width,
2707
- height: n.size.height
2637
+ left: t.positionH.posOffset,
2638
+ top: t.positionV.posOffset,
2639
+ width: t.size.width,
2640
+ height: t.size.height
2708
2641
  };
2709
2642
  }
2710
- function rs(n, e = 0, t = 0) {
2643
+ function Kr(t, e = 0, n = 0) {
2711
2644
  return {
2712
2645
  size: {
2713
- width: n.width,
2714
- height: n.height
2646
+ width: t.width,
2647
+ height: t.height
2715
2648
  },
2716
2649
  positionH: {
2717
- relativeFrom: An.MARGIN,
2718
- posOffset: (n.left || 0) - e
2650
+ relativeFrom: bn.MARGIN,
2651
+ posOffset: (t.left || 0) - e
2719
2652
  },
2720
2653
  positionV: {
2721
- relativeFrom: Fn.PAGE,
2722
- posOffset: (n.top || 0) - t
2654
+ relativeFrom: Mn.PAGE,
2655
+ posOffset: (t.top || 0) - n
2723
2656
  },
2724
- angle: n.angle || 0
2657
+ angle: t.angle || 0
2725
2658
  };
2726
2659
  }
2727
2660
  export {
2728
- li as DOC_UI_PLUGIN_NAME,
2729
- ai as DefaultDocContainerConfig,
2730
- ci as DefaultDocUiConfig,
2731
- si as DefaultToolbarConfig,
2732
- it as DocBackScrollRenderController,
2733
- ut as DocCanvasPopManagerService,
2734
- mr as DocCopyCommand,
2735
- Sr as DocCutCommand,
2736
- vr as DocPasteCommand,
2737
- at as DocRenderController,
2738
- Pe as DocsRenderService,
2739
- Ce as IDocClipboardService,
2740
- Yo as PastePluginLark,
2741
- qo as PastePluginUniver,
2742
- Ko as PastePluginWord,
2743
- Xt as UniverDocsUIPlugin,
2744
- is as docDrawingPositionToTransform,
2745
- rs as transformToDocDrawingPosition,
2746
- z as whenDocAndEditorFocused
2661
+ ni as DOC_UI_PLUGIN_NAME,
2662
+ ei as DefaultDocContainerConfig,
2663
+ ti as DefaultDocUiConfig,
2664
+ Qo as DefaultToolbarConfig,
2665
+ nt as DocBackScrollRenderController,
2666
+ ct as DocCanvasPopManagerService,
2667
+ dr as DocCopyCommand,
2668
+ ur as DocCutCommand,
2669
+ hr as DocPasteCommand,
2670
+ rt as DocRenderController,
2671
+ ye as DocsRenderService,
2672
+ Oe as IDocClipboardService,
2673
+ Ho as PastePluginLark,
2674
+ ko as PastePluginUniver,
2675
+ jo as PastePluginWord,
2676
+ zt as UniverDocsUIPlugin,
2677
+ Xr as docDrawingPositionToTransform,
2678
+ Kr as transformToDocDrawingPosition,
2679
+ W as whenDocAndEditorFocused
2747
2680
  };