@univerjs/docs-ui 0.2.3 → 0.2.4

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