@univerjs/docs 0.1.0-beta.0 → 0.1.0-beta.2

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,53 +1,53 @@
1
1
  var Ft = Object.defineProperty;
2
- var kt = (n, e, t) => e in n ? Ft(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var S = (n, e, t) => (kt(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { CommandType as R, RxDisposable as Ze, ICommandService as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as K, IUniverInstanceService as O, IUndoRedoService as N, DataStreamTreeTokenType as He, Tools as H, FOCUSING_DOC as w, FOCUSING_EDITOR as me, LocaleService as It, MemoryCursor as we, getDocsUpdateBody as zt, UpdateDocsAttributeType as xt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as J, BooleanNumber as D, BaselineOffset as j, PresetListType as Ot, LRUMap as Wt, ColorKit as it, Disposable as W, toDisposable as Ge, OnLifecycle as V, LifecycleStages as F, ILogService as Ht, IContextService as Gt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Xt, IFloatingObjectManagerService as qt, Direction as b, IConfigService as yt, Plugin as Yt, PluginType as Zt } from "@univerjs/core";
5
- import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Kt, ITextSelectionRenderManager as fe, DocumentViewModel as Jt, DocumentSkeleton as Qt, hasListSpan as en, isIndentBySpan as tn, isFirstSpan as nn, getParagraphBySpan as rn, PageLayoutType as ot, IRenderManagerService as G, Liquid as sn, RANGE_DIRECTION as at, NodePositionConvertToCursor as ct, Rect as on, CURSOR_TYPE as lt, Viewport as an, EVENT_TYPE as cn, ScrollBar as ln, Layer as dt, Documents as dn, TextSelectionRenderManager as un } from "@univerjs/engine-render";
6
- import { BehaviorSubject as de, takeUntil as bt } from "rxjs";
7
- import { CopyCommand as hn, CutCommand as pn, PasteCommand as gn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as mn, HTML_CLIPBOARD_MIME_TYPE as fn, IClipboardInterfaceService as _n, LayoutService as Sn, KeyCode as $, MetaKeys as _e, IShortcutService as vn } from "@univerjs/ui";
2
+ var kt = (i, e, t) => e in i ? Ft(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var S = (i, e, t) => (kt(i, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { CommandType as R, RxDisposable as me, ICommandService as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Z, IUniverInstanceService as O, IUndoRedoService as N, DataStreamTreeTokenType as Xe, Tools as re, FOCUSING_DOC as w, FOCUSING_EDITOR as fe, LocaleService as xt, MemoryCursor as Ae, getDocsUpdateBody as zt, UpdateDocsAttributeType as Ot, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as K, BooleanNumber as D, BaselineOffset as j, PresetListType as yt, LRUMap as Wt, ColorKit as ot, Disposable as W, toDisposable as qe, OnLifecycle as V, LifecycleStages as F, ILogService as Ht, IContextService as Gt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Xt, IFloatingObjectManagerService as qt, Direction as b, IConfigService as bt, Plugin as Yt, PluginType as Zt } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Kt, ITextSelectionRenderManager as _e, DocumentViewModel as Jt, DocumentSkeleton as Qt, hasListSpan as en, isIndentBySpan as tn, isFirstSpan as nn, getParagraphBySpan as rn, PageLayoutType as at, IRenderManagerService as H, Liquid as sn, RANGE_DIRECTION as ct, NodePositionConvertToCursor as lt, Rect as on, CURSOR_TYPE as dt, Viewport as an, EVENT_TYPE as cn, ScrollBar as ln, Layer as ut, Documents as dn, TextSelectionRenderManager as un } from "@univerjs/engine-render";
6
+ import { BehaviorSubject as de, takeUntil as Se } from "rxjs";
7
+ import { CopyCommand as hn, CutCommand as pn, PasteCommand as gn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as mn, HTML_CLIPBOARD_MIME_TYPE as fn, IClipboardInterfaceService as _n, LayoutService as Sn, KeyCode as $, MetaKeys as ve, IShortcutService as vn } from "@univerjs/ui";
8
8
  import { Inject as U, createIdentifier as Mn, Optional as Cn, Injector as Rn } from "@wendellhu/redi";
9
- function Le(n, e) {
10
- const r = n.getCurrentUniverDocInstance().getUnitId(), s = e.getRenderById(r);
11
- if (s == null)
9
+ function Ne(i, e) {
10
+ const n = i.getCurrentUniverDocInstance().getUnitId(), r = e.getRenderById(n);
11
+ if (r == null)
12
12
  return;
13
- const { mainComponent: i, scene: o, engine: a } = s;
13
+ const { mainComponent: s, scene: o, engine: a } = r;
14
14
  return {
15
- document: i,
15
+ document: s,
16
16
  scene: o,
17
17
  engine: a
18
18
  };
19
19
  }
20
- function In(n, e) {
21
- const t = e.getRenderById(n);
20
+ function In(i, e) {
21
+ const t = e.getRenderById(i);
22
22
  if (t == null)
23
23
  return;
24
- const { mainComponent: r, scene: s, engine: i } = t;
24
+ const { mainComponent: n, scene: r, engine: s } = t;
25
25
  return {
26
- document: r,
27
- scene: s,
28
- engine: i
26
+ document: n,
27
+ scene: r,
28
+ engine: s
29
29
  };
30
30
  }
31
- var Xe = /* @__PURE__ */ ((n) => (n.MAIN = "__Document_Render_Main__", n))(Xe || {}), Ke = /* @__PURE__ */ ((n) => (n.VIEW_MAIN = "viewMain", n.VIEW_TOP = "viewTop", n.VIEW_LEFT = "viewLeft", n.VIEW_LEFT_TOP = "viewLeftTop", n))(Ke || {});
32
- const ut = 0, xn = 2, On = 10, hs = "normalTextSelectionPluginName", Dt = {
31
+ var Ye = /* @__PURE__ */ ((i) => (i.MAIN = "__Document_Render_Main__", i))(Ye || {}), Je = /* @__PURE__ */ ((i) => (i.VIEW_MAIN = "viewMain", i.VIEW_TOP = "viewTop", i.VIEW_LEFT = "viewLeft", i.VIEW_LEFT_TOP = "viewLeftTop", i))(Je || {});
32
+ const ht = 0, xn = 2, On = 10, hi = "normalTextSelectionPluginName", Dt = {
33
33
  id: "doc.operation.set-selections",
34
34
  type: R.OPERATION,
35
- handler: (n, e) => !0
35
+ handler: (i, e) => !0
36
36
  };
37
- var yn = Object.defineProperty, bn = Object.getOwnPropertyDescriptor, Dn = (n, e, t, r) => {
38
- for (var s = r > 1 ? void 0 : r ? bn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
39
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
40
- return r && s && yn(e, t, s), s;
41
- }, ht = (n, e) => (t, r) => e(t, r, n);
42
- function pt(n) {
43
- const { startOffset: e, endOffset: t, collapsed: r } = n;
37
+ var yn = Object.defineProperty, bn = Object.getOwnPropertyDescriptor, Dn = (i, e, t, n) => {
38
+ for (var r = n > 1 ? void 0 : n ? bn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
39
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
40
+ return n && r && yn(e, t, r), r;
41
+ }, pt = (i, e) => (t, n) => e(t, n, i);
42
+ function gt(i) {
43
+ const { startOffset: e, endOffset: t, collapsed: n } = i;
44
44
  return {
45
45
  startOffset: e,
46
46
  endOffset: t,
47
- collapsed: r
47
+ collapsed: n
48
48
  };
49
49
  }
50
- let P = class extends Ze {
50
+ let P = class extends me {
51
51
  constructor(e, t) {
52
52
  super();
53
53
  S(this, "_currentSelection", null);
@@ -84,19 +84,19 @@ let P = class extends Ze {
84
84
  const e = this._getTextRanges(this._currentSelection);
85
85
  if (e == null)
86
86
  return;
87
- const { textRanges: t, segmentId: r, style: s } = e, i = t.find((p) => p.isActive());
88
- if (i == null)
87
+ const { textRanges: t, segmentId: n, style: r } = e, s = t.find((h) => h.isActive());
88
+ if (s == null)
89
89
  return null;
90
- const { startOffset: o, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: h } = i;
90
+ const { startOffset: o, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: p } = s;
91
91
  return o == null || a == null ? null : {
92
92
  startOffset: o,
93
93
  endOffset: a,
94
94
  collapsed: c,
95
95
  startNodePosition: d,
96
96
  endNodePosition: l,
97
- direction: h,
98
- segmentId: r,
99
- style: s
97
+ direction: p,
98
+ segmentId: n,
99
+ style: r
100
100
  };
101
101
  }
102
102
  // **Only used in test case** because this does not go through the render layer.
@@ -114,7 +114,7 @@ let P = class extends Ze {
114
114
  }
115
115
  // All textRanges should be synchronized from the render layer.
116
116
  _syncSelectionFromRenderService() {
117
- this._textSelectionRenderManager.textSelectionInner$.pipe(bt(this.dispose$)).subscribe((e) => {
117
+ this._textSelectionRenderManager.textSelectionInner$.pipe(Se(this.dispose$)).subscribe((e) => {
118
118
  e != null && this._replaceTextRangesWithNoRefresh(e);
119
119
  });
120
120
  }
@@ -126,458 +126,468 @@ let P = class extends Ze {
126
126
  ...e
127
127
  };
128
128
  this._replaceByParam(t), this._textSelection$.next(t);
129
- const { unitId: r, subUnitId: s, segmentId: i, style: o, textRanges: a } = t;
129
+ const { unitId: n, subUnitId: r, segmentId: s, style: o, textRanges: a } = t;
130
130
  this._commandService.executeCommand(Dt.id, {
131
- unitId: r,
132
- subUnitId: s,
133
- segmentId: i,
131
+ unitId: n,
132
+ subUnitId: r,
133
+ segmentId: s,
134
134
  style: o,
135
- ranges: a.map(pt)
135
+ ranges: a.map(gt)
136
136
  });
137
137
  }
138
138
  _getTextRanges(e) {
139
- var s;
139
+ var r;
140
140
  if (e == null)
141
141
  return;
142
- const { unitId: t, subUnitId: r = "" } = e;
143
- return (s = this._textSelectionInfo.get(t)) == null ? void 0 : s.get(r);
142
+ const { unitId: t, subUnitId: n = "" } = e;
143
+ return (r = this._textSelectionInfo.get(t)) == null ? void 0 : r.get(n);
144
144
  }
145
145
  _refresh(e) {
146
146
  const t = this._getTextRanges(e);
147
- this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(pt));
147
+ this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(gt));
148
148
  }
149
149
  _replaceByParam(e) {
150
- const { unitId: t, subUnitId: r, style: s, segmentId: i, textRanges: o } = e;
151
- this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(r, { textRanges: o, style: s, segmentId: i });
150
+ const { unitId: t, subUnitId: n, style: r, segmentId: s, textRanges: o } = e;
151
+ this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: o, style: r, segmentId: s });
152
152
  }
153
153
  _addByParam(e) {
154
- const { unitId: t, subUnitId: r, textRanges: s, style: i, segmentId: o } = e;
154
+ const { unitId: t, subUnitId: n, textRanges: r, style: s, segmentId: o } = e;
155
155
  this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
156
156
  const a = this._textSelectionInfo.get(t);
157
- a.has(r) ? a.get(r).textRanges.push(...s) : a.set(r, { textRanges: s, style: i, segmentId: o });
157
+ a.has(n) ? a.get(n).textRanges.push(...r) : a.set(n, { textRanges: r, style: s, segmentId: o });
158
158
  }
159
159
  };
160
160
  P = Dn([
161
- ht(0, fe),
162
- ht(1, x)
161
+ pt(0, _e),
162
+ pt(1, x)
163
163
  ], P);
164
- function Ae(n, e = "", t = 0) {
165
- const { startOffset: r, endOffset: s } = n, i = [], o = r - t, a = s - t;
166
- return o > 0 && i.push({
164
+ function $e(i, e = "", t = 0) {
165
+ const { startOffset: n, endOffset: r } = i, s = [], o = n - t, a = r - t;
166
+ return o > 0 && s.push({
167
167
  t: "r",
168
168
  len: o,
169
169
  segmentId: e
170
- }), i.push({
170
+ }), s.push({
171
171
  t: "d",
172
172
  len: a - o,
173
173
  line: 0,
174
174
  segmentId: e
175
- }), i;
175
+ }), s;
176
176
  }
177
- var Tn = Object.defineProperty, Pn = Object.getOwnPropertyDescriptor, En = (n, e, t, r) => {
178
- for (var s = r > 1 ? void 0 : r ? Pn(e, t) : e, i = n.length - 1, o; i >= 0; i--)
179
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
180
- return r && s && Tn(e, t, s), s;
181
- }, Un = (n, e) => (t, r) => e(t, r, n);
182
- let se = class {
183
- constructor(n) {
177
+ var Tn = Object.defineProperty, Pn = Object.getOwnPropertyDescriptor, En = (i, e, t, n) => {
178
+ for (var r = n > 1 ? void 0 : n ? Pn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
179
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
180
+ return n && r && Tn(e, t, r), r;
181
+ }, Un = (i, e) => (t, n) => e(t, n, i);
182
+ let ie = class extends me {
183
+ constructor(e) {
184
+ super();
184
185
  S(this, "_currentViewModelUnitId", "");
185
186
  S(this, "_docViewModelMap", /* @__PURE__ */ new Map());
186
187
  S(this, "_currentDocViewModel$", new de(null));
187
188
  S(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
188
- this._currentUniverService = n;
189
+ this._currentUniverService = e, this._initialize();
190
+ }
191
+ _initialize() {
192
+ this._currentUniverService.currentDoc$.pipe(Se(this.dispose$)).subscribe((e) => {
193
+ if (e == null)
194
+ return;
195
+ const t = e.getUnitId();
196
+ this._setCurrent(t);
197
+ });
189
198
  }
190
199
  dispose() {
191
- this._currentDocViewModel$.complete(), this._docViewModelMap = /* @__PURE__ */ new Map();
200
+ this._currentDocViewModel$.complete(), this._docViewModelMap.clear();
192
201
  }
193
202
  getCurrent() {
194
203
  return this._docViewModelMap.get(this._currentViewModelUnitId);
195
204
  }
196
- getViewModel(n) {
197
- var e;
198
- return (e = this._docViewModelMap.get(n)) == null ? void 0 : e.docViewModel;
199
- }
200
- setCurrent(n) {
205
+ getViewModel(e) {
201
206
  var t;
202
- const e = this._currentUniverService.getUniverDocInstance(n);
203
- if (e == null)
204
- throw new Error(`Document data model with id ${n} not found when build view model.`);
205
- if (e.getBody() != null) {
206
- if (!this._docViewModelMap.has(n)) {
207
- const r = this._buildDocViewModel(e);
208
- this._docViewModelMap.set(n, {
209
- unitId: n,
207
+ return (t = this._docViewModelMap.get(e)) == null ? void 0 : t.docViewModel;
208
+ }
209
+ _setCurrent(e) {
210
+ var n;
211
+ const t = this._currentUniverService.getUniverDocInstance(e);
212
+ if (t == null)
213
+ throw new Error(`Document data model with id ${e} not found when build view model.`);
214
+ if (t.getBody() != null) {
215
+ if (!this._docViewModelMap.has(e)) {
216
+ const r = this._buildDocViewModel(t);
217
+ this._docViewModelMap.set(e, {
218
+ unitId: e,
210
219
  docViewModel: r
211
220
  });
212
221
  }
213
- if (n === K) {
214
- const r = (t = this._docViewModelMap.get(n)) == null ? void 0 : t.docViewModel;
222
+ if (e === Z) {
223
+ const r = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
215
224
  if (r == null)
216
225
  return;
217
- r.reset(e);
226
+ r.reset(t);
218
227
  }
219
- this._currentViewModelUnitId = n, this._currentDocViewModel$.next(this.getCurrent());
228
+ this._currentViewModelUnitId = e, this._currentDocViewModel$.next(this.getCurrent());
220
229
  }
221
230
  }
222
- _buildDocViewModel(n) {
223
- return new Jt(n);
231
+ _buildDocViewModel(e) {
232
+ return new Jt(e);
224
233
  }
225
234
  };
226
- se = En([
235
+ ie = En([
227
236
  Un(0, O)
228
- ], se);
237
+ ], ie);
229
238
  const _ = {
230
239
  id: "doc.mutation.rich-text-editing",
231
240
  type: R.MUTATION,
232
- handler: (n, e) => {
233
- const { unitId: t, mutations: r } = e, i = n.get(O).getUniverDocInstance(t), a = n.get(se).getViewModel(t);
234
- if (i == null || a == null)
241
+ handler: (i, e) => {
242
+ const { unitId: t, mutations: n } = e, s = i.get(O).getUniverDocInstance(t), a = i.get(ie).getViewModel(t);
243
+ if (s == null || a == null)
235
244
  throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
236
- const c = i.apply(r), d = r[0].segmentId, l = i.getSelfOrHeaderFooterModel(d);
245
+ if (n.length === 0)
246
+ throw new Error("Mutation's length should great than 0 when call RichTextEditingMutation");
247
+ const c = s.apply(n), { segmentId: d } = n[0], l = s.getSelfOrHeaderFooterModel(d);
237
248
  return a.getSelfOrHeaderFooterViewModel(d).reset(l), {
238
249
  unitId: t,
239
250
  mutations: c
240
251
  };
241
252
  }
242
- }, Je = {
253
+ }, Qe = {
243
254
  id: "doc.command.insert-text",
244
255
  type: R.COMMAND,
245
- handler: async (n, e) => {
246
- const t = n.get(N), r = n.get(x), s = n.get(P), { range: i, segmentId: o, body: a, unitId: c, textRanges: d } = e, { startOffset: l, collapsed: h } = i, p = {
256
+ handler: async (i, e) => {
257
+ const t = i.get(N), n = i.get(x), r = i.get(P), { range: s, segmentId: o, body: a, unitId: c, textRanges: d } = e, { startOffset: l, collapsed: p } = s, h = {
247
258
  id: _.id,
248
259
  params: {
249
260
  unitId: c,
250
261
  mutations: []
251
262
  }
252
263
  };
253
- h ? l > 0 && p.params.mutations.push({
264
+ p ? l > 0 && h.params.mutations.push({
254
265
  t: "r",
255
266
  len: l,
256
267
  segmentId: o
257
- }) : p.params.mutations.push(...Ae(i, o)), p.params.mutations.push({
268
+ }) : h.params.mutations.push(...$e(s, o)), h.params.mutations.push({
258
269
  t: "i",
259
270
  body: a,
260
271
  len: a.dataStream.length,
261
272
  line: 0,
262
273
  segmentId: o
263
274
  });
264
- const u = r.syncExecuteCommand(p.id, p.params);
265
- return s.replaceTextRanges(d), u ? (t.pushUndoRedo({
275
+ const u = n.syncExecuteCommand(h.id, h.params);
276
+ return r.replaceTextRanges(d), u ? (t.pushUndoRedo({
266
277
  unitID: c,
267
278
  undoMutations: [{ id: _.id, params: u }],
268
- redoMutations: [{ id: _.id, params: p.params }],
279
+ redoMutations: [{ id: _.id, params: h.params }],
269
280
  undo() {
270
- return r.syncExecuteCommand(_.id, u), s.replaceTextRanges([i]), !0;
281
+ return n.syncExecuteCommand(_.id, u), r.replaceTextRanges([s]), !0;
271
282
  },
272
283
  redo() {
273
- return r.syncExecuteCommand(_.id, p.params), s.replaceTextRanges(d), !0;
284
+ return n.syncExecuteCommand(_.id, h.params), r.replaceTextRanges(d), !0;
274
285
  }
275
286
  }), !0) : !1;
276
287
  }
277
288
  };
278
- var q = /* @__PURE__ */ ((n) => (n[n.LEFT = 0] = "LEFT", n[n.RIGHT = 1] = "RIGHT", n))(q || {});
279
- const Qe = {
289
+ var X = /* @__PURE__ */ ((i) => (i[i.LEFT = 0] = "LEFT", i[i.RIGHT = 1] = "RIGHT", i))(X || {});
290
+ const et = {
280
291
  id: "doc.command.delete-text",
281
292
  type: R.COMMAND,
282
- handler: async (n, e) => {
283
- const t = n.get(x), r = n.get(N), s = n.get(P), { range: i, segmentId: o, unitId: a, direction: c, textRanges: d, len: l = 1 } = e, { startOffset: h } = i, p = {
293
+ handler: async (i, e) => {
294
+ const t = i.get(x), n = i.get(N), r = i.get(P), { range: s, segmentId: o, unitId: a, direction: c, textRanges: d, len: l = 1 } = e, { startOffset: p } = s, h = {
284
295
  id: _.id,
285
296
  params: {
286
297
  unitId: a,
287
298
  mutations: []
288
299
  }
289
300
  };
290
- h > 0 && p.params.mutations.push({
301
+ p > 0 && h.params.mutations.push({
291
302
  t: "r",
292
- len: c === 0 ? h - l : h,
303
+ len: c === 0 ? p - l : p,
293
304
  segmentId: o
294
- }), p.params.mutations.push({
305
+ }), h.params.mutations.push({
295
306
  t: "d",
296
307
  len: l,
297
308
  line: 0,
298
309
  segmentId: o
299
310
  });
300
- const u = t.syncExecuteCommand(p.id, p.params);
301
- return s.replaceTextRanges(d), u && r.pushUndoRedo({
311
+ const u = t.syncExecuteCommand(h.id, h.params);
312
+ return r.replaceTextRanges(d), u && n.pushUndoRedo({
302
313
  unitID: a,
303
314
  undoMutations: [{ id: _.id, params: u }],
304
- redoMutations: [{ id: _.id, params: p.params }],
315
+ redoMutations: [{ id: _.id, params: h.params }],
305
316
  undo() {
306
- return t.syncExecuteCommand(_.id, u), s.replaceTextRanges([i]), !0;
317
+ return t.syncExecuteCommand(_.id, u), r.replaceTextRanges([s]), !0;
307
318
  },
308
319
  redo() {
309
- return t.syncExecuteCommand(_.id, p.params), s.replaceTextRanges(d), !0;
320
+ return t.syncExecuteCommand(_.id, h.params), r.replaceTextRanges(d), !0;
310
321
  }
311
322
  }), !1;
312
323
  }
313
324
  }, Tt = {
314
325
  id: "doc.command.update-text",
315
326
  type: R.COMMAND,
316
- handler: async (n, e) => {
317
- const { range: t, segmentId: r, updateBody: s, coverType: i, unitId: o, textRanges: a } = e, c = n.get(x), d = n.get(N), l = n.get(P), h = {
327
+ handler: async (i, e) => {
328
+ const { range: t, segmentId: n, updateBody: r, coverType: s, unitId: o, textRanges: a } = e, c = i.get(x), d = i.get(N), l = i.get(P), p = {
318
329
  id: _.id,
319
330
  params: {
320
331
  unitId: o,
321
332
  mutations: []
322
333
  }
323
- }, { startOffset: p, endOffset: u } = t;
324
- h.params.mutations.push({
334
+ }, { startOffset: h, endOffset: u } = t;
335
+ p.params.mutations.push({
325
336
  t: "r",
326
- len: p,
327
- segmentId: r
328
- }), h.params.mutations.push({
337
+ len: h,
338
+ segmentId: n
339
+ }), p.params.mutations.push({
329
340
  t: "r",
330
- body: s,
331
- len: u - p,
332
- segmentId: r,
333
- coverType: i
341
+ body: r,
342
+ len: u - h,
343
+ segmentId: n,
344
+ coverType: s
334
345
  });
335
- const g = c.syncExecuteCommand(h.id, h.params);
346
+ const g = c.syncExecuteCommand(p.id, p.params);
336
347
  return l.replaceTextRanges(a), g ? (d.pushUndoRedo({
337
348
  unitID: o,
338
349
  undoMutations: [{ id: _.id, params: g }],
339
- redoMutations: [{ id: _.id, params: h.params }],
350
+ redoMutations: [{ id: _.id, params: p.params }],
340
351
  undo() {
341
352
  return c.syncExecuteCommand(_.id, g), l.replaceTextRanges(a), !0;
342
353
  },
343
354
  redo() {
344
- return c.syncExecuteCommand(_.id, h.params), l.replaceTextRanges(a), !0;
355
+ return c.syncExecuteCommand(_.id, p.params), l.replaceTextRanges(a), !0;
345
356
  }
346
357
  }), !0) : !1;
347
358
  }
348
359
  };
349
- function wn(n, e) {
360
+ function wn(i, e) {
350
361
  const t = [];
351
- for (let r = 0, s = n.length; r < s; r++)
352
- n[r] === He.PARAGRAPH && t.push({
353
- startIndex: r
362
+ for (let n = 0, r = i.length; n < r; n++)
363
+ i[n] === Xe.PARAGRAPH && t.push({
364
+ startIndex: n
354
365
  });
355
366
  if (e)
356
- for (const r of t)
357
- e.bullet && (r.bullet = H.deepClone(e.bullet)), e.paragraphStyle && (r.paragraphStyle = H.deepClone(e.paragraphStyle));
367
+ for (const n of t)
368
+ e.bullet && (n.bullet = re.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = re.deepClone(e.paragraphStyle));
358
369
  return t;
359
370
  }
360
371
  const Pt = {
361
372
  id: "doc.command.break-line",
362
373
  type: R.COMMAND,
363
- handler: async (n) => {
374
+ handler: async (i) => {
364
375
  var g;
365
- const e = n.get(P), t = n.get(O), r = n.get(x), s = e.getActiveRange();
366
- if (s == null)
376
+ const e = i.get(P), t = i.get(O), n = i.get(x), r = e.getActiveRange();
377
+ if (r == null)
367
378
  return !1;
368
- const i = t.getCurrentUniverDocInstance(), o = i.getUnitId(), { startOffset: a, segmentId: c, style: d } = s, l = [
379
+ const s = t.getCurrentUniverDocInstance(), o = s.getUnitId(), { startOffset: a, segmentId: c, style: d } = r, l = [
369
380
  {
370
381
  startOffset: a + 1,
371
382
  endOffset: a + 1,
372
383
  style: d
373
384
  }
374
- ], p = (((g = i.getBody()) == null ? void 0 : g.paragraphs) ?? []).find((m) => m.startIndex >= a);
375
- return await r.executeCommand(Je.id, {
385
+ ], h = (((g = s.getBody()) == null ? void 0 : g.paragraphs) ?? []).find((m) => m.startIndex >= a);
386
+ return await n.executeCommand(Qe.id, {
376
387
  unitId: o,
377
388
  body: {
378
- dataStream: He.PARAGRAPH,
379
- paragraphs: wn(He.PARAGRAPH, p)
389
+ dataStream: Xe.PARAGRAPH,
390
+ paragraphs: wn(Xe.PARAGRAPH, h)
380
391
  },
381
- range: s,
392
+ range: r,
382
393
  textRanges: l,
383
394
  segmentId: c
384
395
  });
385
396
  }
386
- }, Ve = {
397
+ }, ke = {
387
398
  id: hn.id,
388
399
  name: "doc.command.copy",
389
400
  type: R.COMMAND,
390
401
  multi: !0,
391
402
  priority: 999,
392
- preconditions: (n) => n.getContextValue(w) || n.getContextValue(me),
403
+ preconditions: (i) => i.getContextValue(w) || i.getContextValue(fe),
393
404
  handler: async () => !0
394
- }, Fe = {
405
+ }, ze = {
395
406
  id: pn.id,
396
407
  name: "doc.command.cut",
397
408
  type: R.COMMAND,
398
409
  multi: !0,
399
410
  priority: 999,
400
- preconditions: (n) => n.getContextValue(w) || n.getContextValue(me),
411
+ preconditions: (i) => i.getContextValue(w) || i.getContextValue(fe),
401
412
  handler: async () => !0
402
- }, ke = {
413
+ }, We = {
403
414
  id: gn.id,
404
415
  name: "doc.command.paste",
405
416
  type: R.COMMAND,
406
417
  multi: !0,
407
418
  priority: 999,
408
- preconditions: (n) => n.getContextValue(w) || n.getContextValue(me),
419
+ preconditions: (i) => i.getContextValue(w) || i.getContextValue(fe),
409
420
  handler: async () => !0
410
421
  };
411
- var Ln = Object.defineProperty, An = Object.getOwnPropertyDescriptor, Nn = (n, e, t, r) => {
412
- for (var s = r > 1 ? void 0 : r ? An(e, t) : e, i = n.length - 1, o; i >= 0; i--)
413
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
414
- return r && s && Ln(e, t, s), s;
415
- }, gt = (n, e) => (t, r) => e(t, r, n);
416
- let A = class {
417
- constructor(n, e) {
422
+ var Ln = Object.defineProperty, An = Object.getOwnPropertyDescriptor, Nn = (i, e, t, n) => {
423
+ for (var r = n > 1 ? void 0 : n ? An(e, t) : e, s = i.length - 1, o; s >= 0; s--)
424
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
425
+ return n && r && Ln(e, t, r), r;
426
+ }, mt = (i, e) => (t, n) => e(t, n, i);
427
+ let A = class extends me {
428
+ constructor(e, t) {
429
+ super();
418
430
  S(this, "_currentSkeletonUnitId", "");
419
431
  S(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
420
432
  S(this, "_currentSkeleton$", new de(null));
421
433
  S(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
422
- /**
423
- * CurrentSkeletonBefore for pre-triggered logic during registration
424
- */
434
+ // CurrentSkeletonBefore for pre-triggered logic during registration
425
435
  S(this, "_currentSkeletonBefore$", new de(null));
426
436
  S(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
427
- this._localeService = n, this._docViewModelManagerService = e, this.initialize();
437
+ this._localeService = e, this._docViewModelManagerService = t, this._initialize();
428
438
  }
429
- initialize() {
430
- this._docViewModelManagerService.currentDocViewModel$.subscribe((n) => {
431
- n != null && this._setCurrent(n);
439
+ _initialize() {
440
+ this._docViewModelManagerService.currentDocViewModel$.pipe(Se(this.dispose$)).subscribe((e) => {
441
+ e != null && this._setCurrent(e);
432
442
  });
433
443
  }
434
444
  dispose() {
435
- this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._docSkeletonMap = /* @__PURE__ */ new Map();
445
+ this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._docSkeletonMap.clear();
436
446
  }
437
447
  getCurrent() {
438
448
  return this.getSkeletonByUnitId(this._currentSkeletonUnitId);
439
449
  }
440
- makeDirtyCurrent(n = !0) {
441
- this.makeDirty(this._currentSkeletonUnitId, n);
450
+ makeDirtyCurrent(e = !0) {
451
+ this.makeDirty(this._currentSkeletonUnitId, e);
442
452
  }
443
- makeDirty(n, e = !0) {
444
- const t = this.getSkeletonByUnitId(n);
445
- t != null && (t.dirty = e);
453
+ makeDirty(e, t = !0) {
454
+ const n = this.getSkeletonByUnitId(e);
455
+ n != null && (n.dirty = t);
446
456
  }
447
- _setCurrent(n) {
448
- const { unitId: e } = n;
449
- if (this._docSkeletonMap.has(e)) {
450
- const t = this.getSkeletonByUnitId(e);
451
- t.skeleton.calculate(), t.dirty = !0;
457
+ getSkeletonByUnitId(e) {
458
+ return this._docSkeletonMap.get(e);
459
+ }
460
+ _setCurrent(e) {
461
+ const { unitId: t } = e;
462
+ if (this._docSkeletonMap.has(t)) {
463
+ const n = this.getSkeletonByUnitId(t);
464
+ n.skeleton.calculate(), n.dirty = !0;
452
465
  } else {
453
- const t = this._buildSkeleton(n.docViewModel);
454
- t.calculate(), this._docSkeletonMap.set(e, {
455
- unitId: e,
456
- skeleton: t,
466
+ const n = this._buildSkeleton(e.docViewModel);
467
+ n.calculate(), this._docSkeletonMap.set(t, {
468
+ unitId: t,
469
+ skeleton: n,
457
470
  dirty: !1
458
471
  });
459
472
  }
460
- return this._currentSkeletonUnitId = e, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
461
- }
462
- getSkeletonByUnitId(n) {
463
- return this._docSkeletonMap.get(n);
473
+ return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
464
474
  }
465
- _buildSkeleton(n) {
466
- return Qt.create(n, this._localeService);
475
+ _buildSkeleton(e) {
476
+ return Qt.create(e, this._localeService);
467
477
  }
468
478
  };
469
479
  A = Nn([
470
- gt(0, U(It)),
471
- gt(1, U(se))
480
+ mt(0, U(xt)),
481
+ mt(1, U(ie))
472
482
  ], A);
473
- const mt = {
483
+ const ft = {
474
484
  id: "doc.command.inner-paste",
475
485
  type: R.COMMAND,
476
- handler: async (n, e) => {
477
- const { segmentId: t, body: r, textRanges: s } = e, i = n.get(N), o = n.get(x), a = n.get(P), c = n.get(O), d = a.getSelections();
486
+ handler: async (i, e) => {
487
+ const { segmentId: t, body: n, textRanges: r } = e, s = i.get(N), o = i.get(x), a = i.get(P), c = i.get(O), d = a.getSelections();
478
488
  if (!Array.isArray(d) || d.length === 0)
479
489
  return !1;
480
- const h = c.getCurrentUniverDocInstance().getUnitId(), p = {
490
+ const p = c.getCurrentUniverDocInstance().getUnitId(), h = {
481
491
  id: _.id,
482
492
  params: {
483
- unitId: h,
493
+ unitId: p,
484
494
  mutations: []
485
495
  }
486
- }, u = new we();
496
+ }, u = new Ae();
487
497
  u.reset();
488
498
  for (const m of d) {
489
499
  const { startOffset: f, endOffset: v, collapsed: M } = m, T = f - u.cursor;
490
- M ? p.params.mutations.push({
500
+ M ? h.params.mutations.push({
491
501
  t: "r",
492
502
  len: T,
493
503
  segmentId: t
494
- }) : p.params.mutations.push(
495
- ...Ae(m, t, u.cursor)
496
- ), p.params.mutations.push({
504
+ }) : h.params.mutations.push(
505
+ ...$e(m, t, u.cursor)
506
+ ), h.params.mutations.push({
497
507
  t: "i",
498
- body: r,
499
- len: r.dataStream.length,
508
+ body: n,
509
+ len: n.dataStream.length,
500
510
  line: 0,
501
511
  segmentId: t
502
512
  }), u.reset(), u.moveCursor(v);
503
513
  }
504
- const g = o.syncExecuteCommand(p.id, p.params);
505
- return a.replaceTextRanges(s), g ? (i.pushUndoRedo({
506
- unitID: h,
514
+ const g = o.syncExecuteCommand(h.id, h.params);
515
+ return a.replaceTextRanges(r), g ? (s.pushUndoRedo({
516
+ unitID: p,
507
517
  undoMutations: [{ id: _.id, params: g }],
508
- redoMutations: [{ id: _.id, params: p.params }],
518
+ redoMutations: [{ id: _.id, params: h.params }],
509
519
  undo() {
510
520
  return o.syncExecuteCommand(_.id, g), a.replaceTextRanges(d), !0;
511
521
  },
512
522
  redo() {
513
- return o.syncExecuteCommand(_.id, p.params), a.replaceTextRanges(s), !0;
523
+ return o.syncExecuteCommand(_.id, h.params), a.replaceTextRanges(r), !0;
514
524
  }
515
525
  }), !0) : !1;
516
526
  }
517
- }, Ee = {
527
+ }, we = {
518
528
  id: "doc.command.inner-cut",
519
529
  type: R.COMMAND,
520
- handler: async (n, e) => {
521
- const { segmentId: t, textRanges: r } = e, s = n.get(N), i = n.get(x), o = n.get(P), a = n.get(O), c = o.getSelections();
530
+ handler: async (i, e) => {
531
+ const { segmentId: t, textRanges: n } = e, r = i.get(N), s = i.get(x), o = i.get(P), a = i.get(O), c = o.getSelections();
522
532
  if (!Array.isArray(c) || c.length === 0)
523
533
  return !1;
524
- const d = a.getCurrentUniverDocInstance().getUnitId(), l = a.getUniverDocInstance(d), h = zt(l.snapshot, t);
525
- if (h == null)
534
+ const d = a.getCurrentUniverDocInstance().getUnitId(), l = a.getUniverDocInstance(d), p = zt(l.snapshot, t);
535
+ if (p == null)
526
536
  return !1;
527
- const p = {
537
+ const h = {
528
538
  id: _.id,
529
539
  params: {
530
540
  unitId: d,
531
541
  mutations: []
532
542
  }
533
- }, u = new we();
543
+ }, u = new Ae();
534
544
  u.reset();
535
545
  for (const m of c) {
536
546
  const { startOffset: f, endOffset: v, collapsed: M } = m, T = f - u.cursor;
537
- M ? p.params.mutations.push({
547
+ M ? h.params.mutations.push({
538
548
  t: "r",
539
549
  len: T,
540
550
  segmentId: t
541
- }) : p.params.mutations.push(
542
- ...$n(m, h, t, u.cursor)
551
+ }) : h.params.mutations.push(
552
+ ...$n(m, p, t, u.cursor)
543
553
  ), u.reset(), u.moveCursor(v);
544
554
  }
545
- const g = i.syncExecuteCommand(p.id, p.params);
546
- return o.replaceTextRanges(r), g ? (s.pushUndoRedo({
555
+ const g = s.syncExecuteCommand(h.id, h.params);
556
+ return o.replaceTextRanges(n), g ? (r.pushUndoRedo({
547
557
  unitID: d,
548
558
  undoMutations: [{ id: _.id, params: g }],
549
- redoMutations: [{ id: _.id, params: p.params }],
559
+ redoMutations: [{ id: _.id, params: h.params }],
550
560
  undo() {
551
- return i.syncExecuteCommand(_.id, g), o.replaceTextRanges(c), !0;
561
+ return s.syncExecuteCommand(_.id, g), o.replaceTextRanges(c), !0;
552
562
  },
553
563
  redo() {
554
- return i.syncExecuteCommand(_.id, p.params), o.replaceTextRanges(r), !0;
564
+ return s.syncExecuteCommand(_.id, h.params), o.replaceTextRanges(n), !0;
555
565
  }
556
566
  }), !0) : !1;
557
567
  }
558
568
  };
559
- function $n(n, e, t = "", r = 0) {
560
- const { startOffset: s, endOffset: i } = n, o = [], { paragraphs: a = [] } = e, c = s - r, d = i - r, l = a == null ? void 0 : a.find(
561
- (h) => h.startIndex - r >= c && h.startIndex - r <= d
569
+ function $n(i, e, t = "", n = 0) {
570
+ const { startOffset: r, endOffset: s } = i, o = [], { paragraphs: a = [] } = e, c = r - n, d = s - n, l = a == null ? void 0 : a.find(
571
+ (p) => p.startIndex - n >= c && p.startIndex - n <= d
562
572
  );
563
573
  if (c > 0 && o.push({
564
574
  t: "r",
565
575
  len: c,
566
576
  segmentId: t
567
- }), l && l.startIndex - r > c) {
568
- const h = l.startIndex - r;
577
+ }), l && l.startIndex - n > c) {
578
+ const p = l.startIndex - n;
569
579
  o.push({
570
580
  t: "d",
571
- len: h - c,
581
+ len: p - c,
572
582
  line: 0,
573
583
  segmentId: t
574
584
  }), o.push({
575
585
  t: "r",
576
586
  len: 1,
577
587
  segmentId: t
578
- }), d > h + 1 && o.push({
588
+ }), d > p + 1 && o.push({
579
589
  t: "d",
580
- len: d - h - 1,
590
+ len: d - p - 1,
581
591
  line: 0,
582
592
  segmentId: t
583
593
  });
@@ -593,14 +603,14 @@ function $n(n, e, t = "", r = 0) {
593
603
  const Et = {
594
604
  id: "doc.command.delete-left",
595
605
  type: R.COMMAND,
596
- handler: async (n) => {
606
+ handler: async (i) => {
597
607
  var y;
598
- const e = n.get(P), t = n.get(A), r = n.get(O), s = n.get(x), i = e.getActiveRange(), o = e.getSelections(), a = (y = t.getCurrent()) == null ? void 0 : y.skeleton;
608
+ const e = i.get(P), t = i.get(A), n = i.get(O), r = i.get(x), s = e.getActiveRange(), o = e.getSelections(), a = (y = t.getCurrent()) == null ? void 0 : y.skeleton;
599
609
  let c;
600
- if (i == null || a == null || o == null)
610
+ if (s == null || a == null || o == null)
601
611
  return !1;
602
- const d = r.getCurrentUniverDocInstance(), { startOffset: l, collapsed: h, segmentId: p, style: u } = i;
603
- if (l === 0 && h)
612
+ const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: p, segmentId: h, style: u } = s;
613
+ if (l === 0 && p)
604
614
  return !0;
605
615
  const g = a.findNodeByCharIndex(l), m = en(g), f = tn(g, d.body);
606
616
  let v = l;
@@ -624,7 +634,7 @@ const Et = {
624
634
  style: u
625
635
  }
626
636
  ];
627
- c = await s.executeCommand(Tt.id, {
637
+ c = await r.executeCommand(Tt.id, {
628
638
  unitId: d.getUnitId(),
629
639
  updateBody: {
630
640
  dataStream: "",
@@ -635,14 +645,14 @@ const Et = {
635
645
  endOffset: E + 1
636
646
  },
637
647
  textRanges: k,
638
- coverType: xt.REPLACE,
639
- segmentId: p
648
+ coverType: Ot.REPLACE,
649
+ segmentId: h
640
650
  });
641
- } else if (h === !0)
651
+ } else if (p === !0)
642
652
  if (M.content === "\r")
643
- c = await s.executeCommand(et.id, {
644
- direction: q.LEFT,
645
- range: i
653
+ c = await r.executeCommand(tt.id, {
654
+ direction: X.LEFT,
655
+ range: s
646
656
  });
647
657
  else {
648
658
  v -= M.count;
@@ -653,19 +663,19 @@ const Et = {
653
663
  style: u
654
664
  }
655
665
  ];
656
- c = await s.executeCommand(Qe.id, {
666
+ c = await r.executeCommand(et.id, {
657
667
  unitId: d.getUnitId(),
658
- range: i,
659
- segmentId: p,
660
- direction: q.LEFT,
668
+ range: s,
669
+ segmentId: h,
670
+ direction: X.LEFT,
661
671
  len: M.count,
662
672
  textRanges: C
663
673
  });
664
674
  }
665
675
  else {
666
- const C = wt(i, o);
667
- c = await s.executeCommand(Ee.id, {
668
- segmentId: p,
676
+ const C = wt(s, o);
677
+ c = await r.executeCommand(we.id, {
678
+ segmentId: h,
669
679
  textRanges: C
670
680
  });
671
681
  }
@@ -674,21 +684,21 @@ const Et = {
674
684
  }, Ut = {
675
685
  id: "doc.command.delete-right",
676
686
  type: R.COMMAND,
677
- handler: async (n) => {
687
+ handler: async (i) => {
678
688
  var g;
679
- const e = n.get(P), t = n.get(A), r = n.get(O), s = n.get(x), i = e.getActiveRange(), o = e.getSelections(), a = (g = t.getCurrent()) == null ? void 0 : g.skeleton;
689
+ const e = i.get(P), t = i.get(A), n = i.get(O), r = i.get(x), s = e.getActiveRange(), o = e.getSelections(), a = (g = t.getCurrent()) == null ? void 0 : g.skeleton;
680
690
  let c;
681
- if (i == null || a == null || o == null)
691
+ if (s == null || a == null || o == null)
682
692
  return !1;
683
- const d = r.getCurrentUniverDocInstance(), { startOffset: l, collapsed: h, segmentId: p, style: u } = i;
684
- if (l === d.getBody().dataStream.length - 2 && h)
693
+ const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: p, segmentId: h, style: u } = s;
694
+ if (l === d.getBody().dataStream.length - 2 && p)
685
695
  return !0;
686
- if (h === !0) {
696
+ if (p === !0) {
687
697
  const m = a.findNodeByCharIndex(l);
688
698
  if (m.content === "\r")
689
- c = await s.executeCommand(et.id, {
690
- direction: q.RIGHT,
691
- range: i
699
+ c = await r.executeCommand(tt.id, {
700
+ direction: X.RIGHT,
701
+ range: s
692
702
  });
693
703
  else {
694
704
  const f = [
@@ -698,36 +708,36 @@ const Et = {
698
708
  style: u
699
709
  }
700
710
  ];
701
- c = await s.executeCommand(Qe.id, {
711
+ c = await r.executeCommand(et.id, {
702
712
  unitId: d.getUnitId(),
703
- range: i,
704
- segmentId: p,
705
- direction: q.RIGHT,
713
+ range: s,
714
+ segmentId: h,
715
+ direction: X.RIGHT,
706
716
  textRanges: f,
707
717
  len: m.count
708
718
  });
709
719
  }
710
720
  } else {
711
- const m = wt(i, o);
712
- c = await s.executeCommand(Ee.id, {
713
- segmentId: p,
721
+ const m = wt(s, o);
722
+ c = await r.executeCommand(we.id, {
723
+ segmentId: h,
714
724
  textRanges: m
715
725
  });
716
726
  }
717
727
  return c;
718
728
  }
719
- }, et = {
729
+ }, tt = {
720
730
  id: "doc.command.merge-two-paragraph",
721
731
  type: R.COMMAND,
722
- handler: async (n, e) => {
732
+ handler: async (i, e) => {
723
733
  var L, B, k;
724
- const t = n.get(P), r = n.get(O), s = n.get(x), i = n.get(N), { direction: o, range: a } = e, c = t.getActiveRange(), d = t.getSelections();
734
+ const t = i.get(P), n = i.get(O), r = i.get(x), s = i.get(N), { direction: o, range: a } = e, c = t.getActiveRange(), d = t.getSelections();
725
735
  if (c == null || d == null)
726
736
  return !1;
727
- const l = r.getCurrentUniverDocInstance(), { startOffset: h, collapsed: p, segmentId: u, style: g } = c;
728
- if (!p)
737
+ const l = n.getCurrentUniverDocInstance(), { startOffset: p, collapsed: h, segmentId: u, style: g } = c;
738
+ if (!h)
729
739
  return !1;
730
- const m = o === q.LEFT ? h : h + 1, f = (k = (B = (L = l.getBody()) == null ? void 0 : L.paragraphs) == null ? void 0 : B.find((I) => I.startIndex >= m)) == null ? void 0 : k.startIndex, v = Bn(l.getBody(), m, f), M = o === q.LEFT ? h - 1 : h, T = l.getUnitId(), y = [
740
+ const m = o === X.LEFT ? p : p + 1, f = (k = (B = (L = l.getBody()) == null ? void 0 : L.paragraphs) == null ? void 0 : B.find((I) => I.startIndex >= m)) == null ? void 0 : k.startIndex, v = Bn(l.getBody(), m, f), M = o === X.LEFT ? p - 1 : p, T = l.getUnitId(), y = [
731
741
  {
732
742
  startOffset: M,
733
743
  endOffset: M,
@@ -742,7 +752,7 @@ const Et = {
742
752
  };
743
753
  C.params.mutations.push({
744
754
  t: "r",
745
- len: o === q.LEFT ? h - 1 : h,
755
+ len: o === X.LEFT ? p - 1 : p,
746
756
  segmentId: u
747
757
  }), v.dataStream.length && C.params.mutations.push({
748
758
  t: "i",
@@ -760,63 +770,63 @@ const Et = {
760
770
  line: 0,
761
771
  segmentId: u
762
772
  });
763
- const E = s.syncExecuteCommand(C.id, C.params);
764
- return t.replaceTextRanges(y), E ? (i.pushUndoRedo({
773
+ const E = r.syncExecuteCommand(C.id, C.params);
774
+ return t.replaceTextRanges(y), E ? (s.pushUndoRedo({
765
775
  unitID: T,
766
776
  undoMutations: [{ id: _.id, params: E }],
767
777
  redoMutations: [{ id: _.id, params: C.params }],
768
778
  undo() {
769
- return s.syncExecuteCommand(_.id, E), t.replaceTextRanges([a]), !0;
779
+ return r.syncExecuteCommand(_.id, E), t.replaceTextRanges([a]), !0;
770
780
  },
771
781
  redo() {
772
- return s.syncExecuteCommand(_.id, C.params), t.replaceTextRanges(y), !0;
782
+ return r.syncExecuteCommand(_.id, C.params), t.replaceTextRanges(y), !0;
773
783
  }
774
784
  }), !0) : !1;
775
785
  }
776
786
  };
777
- function Bn(n, e, t) {
778
- const { textRuns: r } = n, s = n.dataStream.substring(e, t);
779
- if (r == null)
787
+ function Bn(i, e, t) {
788
+ const { textRuns: n } = i, r = i.dataStream.substring(e, t);
789
+ if (n == null)
780
790
  return {
781
- dataStream: s
791
+ dataStream: r
782
792
  };
783
- const i = [];
784
- for (const o of r) {
793
+ const s = [];
794
+ for (const o of n) {
785
795
  const { st: a, ed: c } = o;
786
- c <= e || a >= t || (a < e ? i.push({
796
+ c <= e || a >= t || (a < e ? s.push({
787
797
  ...o,
788
798
  st: 0,
789
799
  ed: c - e
790
- }) : c > t ? i.push({
800
+ }) : c > t ? s.push({
791
801
  ...o,
792
802
  st: a - e,
793
803
  ed: t - e
794
- }) : i.push({
804
+ }) : s.push({
795
805
  ...o,
796
806
  st: a - e,
797
807
  ed: c - e
798
808
  }));
799
809
  }
800
810
  return {
801
- dataStream: s,
802
- textRuns: i
811
+ dataStream: r,
812
+ textRuns: s
803
813
  };
804
814
  }
805
- function wt(n, e) {
806
- let t = n.endOffset;
807
- for (const s of e) {
808
- const { startOffset: i, endOffset: o } = s;
809
- i == null || o == null || o <= n.endOffset && (t -= o - i);
815
+ function wt(i, e) {
816
+ let t = i.endOffset;
817
+ for (const r of e) {
818
+ const { startOffset: s, endOffset: o } = r;
819
+ s == null || o == null || o <= i.endOffset && (t -= o - s);
810
820
  }
811
821
  return [
812
822
  {
813
823
  startOffset: t,
814
824
  endOffset: t,
815
- style: n.style
825
+ style: i.style
816
826
  }
817
827
  ];
818
828
  }
819
- class tt {
829
+ class nt {
820
830
  constructor() {
821
831
  S(this, "_previousActiveRange", null);
822
832
  S(this, "_undoMutationParamsCache", []);
@@ -834,30 +844,30 @@ class tt {
834
844
  fetchComposedUndoRedoMutationParams(e) {
835
845
  if (this._undoMutationParamsCache.length === 0 || this._previousActiveRange == null)
836
846
  return null;
837
- const { unitId: t } = this._undoMutationParamsCache[0], { segmentId: r, startOffset: s, collapsed: i } = this._previousActiveRange, o = {
847
+ const { unitId: t } = this._undoMutationParamsCache[0], { segmentId: n, startOffset: r, collapsed: s } = this._previousActiveRange, o = {
838
848
  unitId: t,
839
849
  mutations: []
840
850
  }, a = {
841
851
  unitId: t,
842
852
  mutations: []
843
853
  };
844
- return i ? (o.mutations.push({
854
+ return s ? (o.mutations.push({
845
855
  t: "r",
846
- len: s,
847
- segmentId: r
856
+ len: r,
857
+ segmentId: n
848
858
  }), a.mutations.push({
849
859
  t: "r",
850
- len: s,
851
- segmentId: r
852
- })) : (s > 0 && o.mutations.push({
860
+ len: r,
861
+ segmentId: n
862
+ })) : (r > 0 && o.mutations.push({
853
863
  t: "r",
854
- len: s,
855
- segmentId: r
856
- }), o.mutations.push(this._undoMutationParamsCache[0].mutations.find((c) => c.t === "i")), a.mutations.push(...Ae(this._previousActiveRange, r))), e.length && (o.mutations.push({
864
+ len: r,
865
+ segmentId: n
866
+ }), o.mutations.push(this._undoMutationParamsCache[0].mutations.find((c) => c.t === "i")), a.mutations.push(...$e(this._previousActiveRange, n))), e.length && (o.mutations.push({
857
867
  t: "d",
858
868
  len: e.length,
859
869
  line: 0,
860
- segmentId: r
870
+ segmentId: n
861
871
  }), a.mutations.push({
862
872
  t: "i",
863
873
  body: {
@@ -865,7 +875,7 @@ class tt {
865
875
  },
866
876
  len: e.length,
867
877
  line: 0,
868
- segmentId: r
878
+ segmentId: n
869
879
  })), { redoMutationParams: a, undoMutationParams: o, previousActiveRange: this._previousActiveRange };
870
880
  }
871
881
  dispose() {
@@ -875,36 +885,36 @@ class tt {
875
885
  const Lt = {
876
886
  id: "doc.command.ime-input",
877
887
  type: R.COMMAND,
878
- handler: async (n, e) => {
879
- const { unitId: t, newText: r, oldTextLen: s, range: i, segmentId: o, textRanges: a, isCompositionEnd: c } = e, d = n.get(x), l = n.get(N), h = n.get(P), p = n.get(tt), u = {
888
+ handler: async (i, e) => {
889
+ const { unitId: t, newText: n, oldTextLen: r, range: s, segmentId: o, textRanges: a, isCompositionEnd: c } = e, d = i.get(x), l = i.get(N), p = i.get(P), h = i.get(nt), u = {
880
890
  id: _.id,
881
891
  params: {
882
892
  unitId: t,
883
893
  mutations: []
884
894
  }
885
895
  };
886
- i.collapsed ? u.params.mutations.push({
896
+ s.collapsed ? u.params.mutations.push({
887
897
  t: "r",
888
- len: i.startOffset,
898
+ len: s.startOffset,
889
899
  segmentId: o
890
- }) : u.params.mutations.push(...Ae(i, o)), s > 0 && u.params.mutations.push({
900
+ }) : u.params.mutations.push(...$e(s, o)), r > 0 && u.params.mutations.push({
891
901
  t: "d",
892
- len: s,
902
+ len: r,
893
903
  line: 0,
894
904
  segmentId: o
895
905
  }), u.params.mutations.push({
896
906
  t: "i",
897
907
  body: {
898
- dataStream: r
908
+ dataStream: n
899
909
  },
900
- len: r.length,
910
+ len: n.length,
901
911
  line: 0,
902
912
  segmentId: o
903
913
  });
904
914
  const g = d.syncExecuteCommand(u.id, u.params);
905
- if (p.pushUndoRedoMutationParams(g, u.params), h.replaceTextRanges(a), c) {
915
+ if (h.pushUndoRedoMutationParams(g, u.params), p.replaceTextRanges(a), c) {
906
916
  if (g) {
907
- const m = p.fetchComposedUndoRedoMutationParams(r);
917
+ const m = h.fetchComposedUndoRedoMutationParams(n);
908
918
  if (m == null)
909
919
  return !1;
910
920
  const { undoMutationParams: f, redoMutationParams: v, previousActiveRange: M } = m;
@@ -913,10 +923,10 @@ const Lt = {
913
923
  undoMutations: [{ id: _.id, params: f }],
914
924
  redoMutations: [{ id: _.id, params: v }],
915
925
  undo() {
916
- return d.syncExecuteCommand(_.id, f), h.replaceTextRanges([M]), !0;
926
+ return d.syncExecuteCommand(_.id, f), p.replaceTextRanges([M]), !0;
917
927
  },
918
928
  redo() {
919
- return d.syncExecuteCommand(_.id, v), h.replaceTextRanges(a), !0;
929
+ return d.syncExecuteCommand(_.id, v), p.replaceTextRanges(a), !0;
920
930
  }
921
931
  }), !0;
922
932
  }
@@ -928,23 +938,23 @@ const Lt = {
928
938
  id: "doc.command.set-inline-format-bold",
929
939
  type: R.COMMAND,
930
940
  handler: async () => !0
931
- }, Ne = {
941
+ }, Be = {
932
942
  id: "doc.command.set-inline-format-italic",
933
943
  type: R.COMMAND,
934
944
  handler: async () => !0
935
- }, $e = {
945
+ }, je = {
936
946
  id: "doc.command.set-inline-format-underline",
937
947
  type: R.COMMAND,
938
948
  handler: async () => !0
939
- }, Be = {
949
+ }, Ve = {
940
950
  id: "doc.command.set-inline-format-strikethrough",
941
951
  type: R.COMMAND,
942
952
  handler: async () => !0
943
- }, Q = {
953
+ }, J = {
944
954
  id: "doc.command.set-inline-format-subscript",
945
955
  type: R.COMMAND,
946
956
  handler: async () => !0
947
- }, ie = {
957
+ }, se = {
948
958
  id: "doc.command.set-inline-format-superscript",
949
959
  type: R.COMMAND,
950
960
  handler: async () => !0
@@ -956,65 +966,65 @@ const Lt = {
956
966
  id: "doc.command.set-inline-format-font-family",
957
967
  type: R.COMMAND,
958
968
  handler: async () => !0
959
- }, je = {
969
+ }, Fe = {
960
970
  id: "doc.command.set-inline-format-text-color",
961
971
  type: R.COMMAND,
962
972
  handler: async () => !0
963
973
  }, At = {
964
974
  [ue.id]: "bl",
965
- [Ne.id]: "it",
966
- [$e.id]: "ul",
967
- [Be.id]: "st",
975
+ [Be.id]: "it",
976
+ [je.id]: "ul",
977
+ [Ve.id]: "st",
968
978
  [he.id]: "fs",
969
979
  [pe.id]: "ff",
970
- [je.id]: "cl",
971
- [Q.id]: "va",
972
- [ie.id]: "va"
980
+ [Fe.id]: "cl",
981
+ [J.id]: "va",
982
+ [se.id]: "va"
973
983
  }, Nt = {
974
984
  id: "doc.command.set-inline-format",
975
985
  type: R.COMMAND,
976
- handler: async (n, e) => {
977
- const { segmentId: t, value: r, preCommandId: s } = e, i = n.get(N), o = n.get(x), a = n.get(P), c = n.get(O), d = a.getSelections();
986
+ handler: async (i, e) => {
987
+ const { segmentId: t, value: n, preCommandId: r } = e, s = i.get(N), o = i.get(x), a = i.get(P), c = i.get(O), d = a.getSelections();
978
988
  if (!Array.isArray(d) || d.length === 0)
979
989
  return !1;
980
- let l = c.getCurrentUniverDocInstance(), h = l.getUnitId();
981
- h === J && (l = c.getUniverDocInstance(K), h = l.getUnitId());
982
- let p;
983
- switch (s) {
990
+ let l = c.getCurrentUniverDocInstance(), p = l.getUnitId();
991
+ p === K && (l = c.getUniverDocInstance(Z), p = l.getUnitId());
992
+ let h;
993
+ switch (r) {
984
994
  case ue.id:
985
- case Ne.id:
986
- case $e.id:
987
995
  case Be.id:
988
- case Q.id:
989
- case ie.id: {
990
- p = Vn(
996
+ case je.id:
997
+ case Ve.id:
998
+ case J.id:
999
+ case se.id: {
1000
+ h = Vn(
991
1001
  l.getBody().textRuns,
992
- s,
1002
+ r,
993
1003
  d
994
1004
  );
995
1005
  break;
996
1006
  }
997
1007
  case he.id:
998
1008
  case pe.id: {
999
- p = r;
1009
+ h = n;
1000
1010
  break;
1001
1011
  }
1002
- case je.id: {
1003
- p = {
1004
- rgb: r
1012
+ case Fe.id: {
1013
+ h = {
1014
+ rgb: n
1005
1015
  };
1006
1016
  break;
1007
1017
  }
1008
1018
  default:
1009
- throw new Error(`Unknown command: ${s} in handleInlineFormat`);
1019
+ throw new Error(`Unknown command: ${r} in handleInlineFormat`);
1010
1020
  }
1011
1021
  const u = {
1012
1022
  id: _.id,
1013
1023
  params: {
1014
- unitId: h,
1024
+ unitId: p,
1015
1025
  mutations: []
1016
1026
  }
1017
- }, g = new we();
1027
+ }, g = new Ae();
1018
1028
  g.reset();
1019
1029
  for (const v of d) {
1020
1030
  const { startOffset: M, endOffset: T } = v, y = {
@@ -1024,7 +1034,7 @@ const Lt = {
1024
1034
  st: 0,
1025
1035
  ed: T - M,
1026
1036
  ts: {
1027
- [At[s]]: p
1037
+ [At[r]]: h
1028
1038
  }
1029
1039
  }
1030
1040
  ]
@@ -1044,87 +1054,87 @@ const Lt = {
1044
1054
  ue.id,
1045
1055
  he.id,
1046
1056
  pe.id,
1047
- Q.id,
1048
- ie.id
1057
+ J.id,
1058
+ se.id
1049
1059
  ];
1050
- return f.includes(s) && a.refreshSelection(), m ? (i.pushUndoRedo({
1051
- unitID: h,
1060
+ return f.includes(r) && a.refreshSelection(), m ? (s.pushUndoRedo({
1061
+ unitID: p,
1052
1062
  undoMutations: [{ id: _.id, params: m }],
1053
1063
  redoMutations: [{ id: _.id, params: u.params }],
1054
1064
  undo() {
1055
- return o.syncExecuteCommand(_.id, m), f.includes(s) && a.refreshSelection(), !0;
1065
+ return o.syncExecuteCommand(_.id, m), f.includes(r) && a.refreshSelection(), !0;
1056
1066
  },
1057
1067
  redo() {
1058
- return o.syncExecuteCommand(_.id, u.params), f.includes(s) && a.refreshSelection(), !0;
1068
+ return o.syncExecuteCommand(_.id, u.params), f.includes(r) && a.refreshSelection(), !0;
1059
1069
  }
1060
1070
  }), !0) : !1;
1061
1071
  }
1062
1072
  };
1063
- function jn(n) {
1064
- return n !== null && typeof n == "object";
1073
+ function jn(i) {
1074
+ return i !== null && typeof i == "object";
1065
1075
  }
1066
- function Vn(n, e, t) {
1067
- let r = 0, s = 0;
1068
- const i = At[e];
1069
- for (; r !== n.length && s !== t.length; ) {
1070
- const { startOffset: o, endOffset: a } = t[s], { st: c, ed: d, ts: l } = n[r];
1076
+ function Vn(i, e, t) {
1077
+ let n = 0, r = 0;
1078
+ const s = At[e];
1079
+ for (; n !== i.length && r !== t.length; ) {
1080
+ const { startOffset: o, endOffset: a } = t[r], { st: c, ed: d, ts: l } = i[n];
1071
1081
  if (a <= c)
1072
- s++;
1073
- else if (d <= o)
1074
1082
  r++;
1083
+ else if (d <= o)
1084
+ n++;
1075
1085
  else {
1076
- if ((l == null ? void 0 : l[i]) == null) {
1077
- if (/bl|it/.test(i))
1086
+ if ((l == null ? void 0 : l[s]) == null) {
1087
+ if (/bl|it/.test(s))
1078
1088
  return D.TRUE;
1079
- if (/ul|st/.test(i))
1089
+ if (/ul|st/.test(s))
1080
1090
  return {
1081
1091
  s: D.TRUE
1082
1092
  };
1083
- if (/va/.test(i))
1084
- return e === Q.id ? j.SUBSCRIPT : j.SUPERSCRIPT;
1093
+ if (/va/.test(s))
1094
+ return e === J.id ? j.SUBSCRIPT : j.SUPERSCRIPT;
1085
1095
  }
1086
- if (jn(l == null ? void 0 : l[i]) && l[i].s === D.FALSE)
1096
+ if (jn(l == null ? void 0 : l[s]) && l[s].s === D.FALSE)
1087
1097
  return {
1088
1098
  s: D.TRUE
1089
1099
  };
1090
- if (e === Q.id && (l == null ? void 0 : l[i]) !== j.SUBSCRIPT)
1100
+ if (e === J.id && (l == null ? void 0 : l[s]) !== j.SUBSCRIPT)
1091
1101
  return j.SUBSCRIPT;
1092
- if (e === ie.id && (l == null ? void 0 : l[i]) !== j.SUPERSCRIPT)
1102
+ if (e === se.id && (l == null ? void 0 : l[s]) !== j.SUPERSCRIPT)
1093
1103
  return j.SUPERSCRIPT;
1094
- if ((l == null ? void 0 : l[i]) === D.FALSE)
1104
+ if ((l == null ? void 0 : l[s]) === D.FALSE)
1095
1105
  return D.TRUE;
1096
- r++;
1106
+ n++;
1097
1107
  }
1098
1108
  }
1099
- return /bl|it/.test(i) ? D.FALSE : /ul|st/.test(i) ? {
1109
+ return /bl|it/.test(s) ? D.FALSE : /ul|st/.test(s) ? {
1100
1110
  s: D.FALSE
1101
1111
  } : j.NORMAL;
1102
1112
  }
1103
1113
  const Fn = {
1104
1114
  id: "doc.command.bullet-list",
1105
1115
  type: R.COMMAND,
1106
- handler: (n) => n.get(x).syncExecuteCommand(nt.id, {
1107
- listType: Ot.BULLET_LIST
1116
+ handler: (i) => i.get(x).syncExecuteCommand(rt.id, {
1117
+ listType: yt.BULLET_LIST
1108
1118
  })
1109
1119
  }, kn = {
1110
1120
  id: "doc.command.order-list",
1111
1121
  type: R.COMMAND,
1112
- handler: (n) => n.get(x).syncExecuteCommand(nt.id, {
1113
- listType: Ot.ORDER_LIST
1122
+ handler: (i) => i.get(x).syncExecuteCommand(rt.id, {
1123
+ listType: yt.ORDER_LIST
1114
1124
  })
1115
- }, nt = {
1125
+ }, rt = {
1116
1126
  id: "doc.command.list-operation",
1117
1127
  type: R.COMMAND,
1118
- handler: (n, e) => {
1128
+ handler: (i, e) => {
1119
1129
  var T;
1120
- const t = n.get(P), r = n.get(O), s = n.get(x), i = n.get(N), { listType: o } = e, a = r.getCurrentUniverDocInstance(), c = t.getActiveRange(), d = (T = a.getBody()) == null ? void 0 : T.paragraphs;
1130
+ const t = i.get(P), n = i.get(O), r = i.get(x), s = i.get(N), { listType: o } = e, a = n.getCurrentUniverDocInstance(), c = t.getActiveRange(), d = (T = a.getBody()) == null ? void 0 : T.paragraphs;
1121
1131
  if (c == null || d == null)
1122
1132
  return !1;
1123
- const l = zn(c, d), { segmentId: h } = c, p = a.getUnitId(), u = l.every((y) => {
1133
+ const l = zn(c, d), { segmentId: p } = c, h = a.getUnitId(), u = l.every((y) => {
1124
1134
  var C;
1125
1135
  return ((C = y.bullet) == null ? void 0 : C.listType) === o;
1126
1136
  }), g = 6;
1127
- let m = H.generateRandomId(g);
1137
+ let m = re.generateRandomId(g);
1128
1138
  if (l.length === 1) {
1129
1139
  const y = d.indexOf(l[0]), C = d[y - 1], E = d[y + 1];
1130
1140
  C && C.bullet && C.bullet.listType === o ? m = C.bullet.listId : E && E.bullet && E.bullet.listType === o && (m = E.bullet.listId);
@@ -1132,17 +1142,17 @@ const Fn = {
1132
1142
  const f = {
1133
1143
  id: _.id,
1134
1144
  params: {
1135
- unitId: p,
1145
+ unitId: h,
1136
1146
  mutations: []
1137
1147
  }
1138
- }, v = new we();
1148
+ }, v = new Ae();
1139
1149
  v.reset();
1140
1150
  for (const y of l) {
1141
1151
  const { startIndex: C } = y;
1142
1152
  f.params.mutations.push({
1143
1153
  t: "r",
1144
1154
  len: C - v.cursor,
1145
- segmentId: h
1155
+ segmentId: p
1146
1156
  });
1147
1157
  const E = {
1148
1158
  ...y.paragraphStyle,
@@ -1174,155 +1184,155 @@ const Fn = {
1174
1184
  }
1175
1185
  ]
1176
1186
  },
1177
- segmentId: h,
1178
- coverType: xt.REPLACE
1187
+ segmentId: p,
1188
+ coverType: Ot.REPLACE
1179
1189
  }), v.moveCursorTo(C + 1);
1180
1190
  }
1181
- const M = s.syncExecuteCommand(f.id, f.params);
1182
- return t.refreshSelection(), M && i.pushUndoRedo({
1183
- unitID: p,
1191
+ const M = r.syncExecuteCommand(f.id, f.params);
1192
+ return t.refreshSelection(), M && s.pushUndoRedo({
1193
+ unitID: h,
1184
1194
  undoMutations: [{ id: _.id, params: M }],
1185
1195
  redoMutations: [{ id: _.id, params: f.params }],
1186
1196
  undo() {
1187
- return s.syncExecuteCommand(_.id, M), t.refreshSelection(), !0;
1197
+ return r.syncExecuteCommand(_.id, M), t.refreshSelection(), !0;
1188
1198
  },
1189
1199
  redo() {
1190
- return s.syncExecuteCommand(_.id, f.params), t.refreshSelection(), !0;
1200
+ return r.syncExecuteCommand(_.id, f.params), t.refreshSelection(), !0;
1191
1201
  }
1192
1202
  }), !0;
1193
1203
  }
1194
1204
  };
1195
- function zn(n, e) {
1196
- const { startOffset: t, endOffset: r } = n, s = [];
1197
- let i = 0;
1205
+ function zn(i, e) {
1206
+ const { startOffset: t, endOffset: n } = i, r = [];
1207
+ let s = -1;
1198
1208
  for (const o of e) {
1199
1209
  const { startIndex: a } = o;
1200
- (t > i && t <= a || r > i && r <= a || a >= t && a <= r) && s.push(o), i = a;
1210
+ (t > s && t <= a || n > s && n <= a || a >= t && a <= n) && r.push(o), s = a;
1201
1211
  }
1202
- return s;
1212
+ return r;
1203
1213
  }
1204
1214
  const Wn = {
1205
1215
  id: "doc.command-replace-content",
1206
1216
  type: R.COMMAND,
1207
- handler: async (n, e) => {
1217
+ handler: async (i, e) => {
1208
1218
  var g;
1209
- const { unitId: t, body: r, textRanges: s, segmentId: i = "" } = e, o = n.get(O), a = n.get(x), c = n.get(P), d = n.get(N), l = (g = o.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, h = c.getSelections();
1210
- if (l == null || !Array.isArray(h) || h.length === 0)
1219
+ const { unitId: t, body: n, textRanges: r, segmentId: s = "" } = e, o = i.get(O), a = i.get(x), c = i.get(P), d = i.get(N), l = (g = o.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, p = c.getSelections();
1220
+ if (l == null || !Array.isArray(p) || p.length === 0)
1211
1221
  return !1;
1212
- const p = $t(t, i, l, r), u = a.syncExecuteCommand(p.id, p.params);
1213
- return c.replaceTextRanges(s), u ? (d.pushUndoRedo({
1222
+ const h = $t(t, s, l, n), u = a.syncExecuteCommand(h.id, h.params);
1223
+ return c.replaceTextRanges(r), u ? (d.pushUndoRedo({
1214
1224
  unitID: t,
1215
1225
  undoMutations: [{ id: _.id, params: u }],
1216
- redoMutations: [{ id: _.id, params: p.params }],
1226
+ redoMutations: [{ id: _.id, params: h.params }],
1217
1227
  undo() {
1218
- return a.syncExecuteCommand(_.id, u), c.replaceTextRanges(h), !0;
1228
+ return a.syncExecuteCommand(_.id, u), c.replaceTextRanges(p), !0;
1219
1229
  },
1220
1230
  redo() {
1221
- return a.syncExecuteCommand(_.id, p.params), c.replaceTextRanges(s), !0;
1231
+ return a.syncExecuteCommand(_.id, h.params), c.replaceTextRanges(r), !0;
1222
1232
  }
1223
1233
  }), !0) : !1;
1224
1234
  }
1225
1235
  }, Hn = {
1226
1236
  id: "doc.command-cover-content",
1227
1237
  type: R.COMMAND,
1228
- handler: async (n, e) => {
1238
+ handler: async (i, e) => {
1229
1239
  var l;
1230
- const { unitId: t, body: r, segmentId: s = "" } = e, i = n.get(O), o = n.get(x), a = n.get(N), c = (l = i.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1240
+ const { unitId: t, body: n, segmentId: r = "" } = e, s = i.get(O), o = i.get(x), a = i.get(N), c = (l = s.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1231
1241
  if (c == null)
1232
1242
  return !1;
1233
- const d = $t(t, s, c, r);
1243
+ const d = $t(t, r, c, n);
1234
1244
  return o.syncExecuteCommand(
1235
1245
  d.id,
1236
1246
  d.params
1237
1247
  ), a.clearUndoRedo(t), !0;
1238
1248
  }
1239
1249
  };
1240
- function $t(n, e, t, r) {
1241
- const s = {
1250
+ function $t(i, e, t, n) {
1251
+ const r = {
1242
1252
  id: _.id,
1243
1253
  params: {
1244
- unitId: n,
1254
+ unitId: i,
1245
1255
  mutations: []
1246
1256
  }
1247
- }, i = (t == null ? void 0 : t.dataStream.length) - 2;
1248
- return i > 0 && s.params.mutations.push({
1257
+ }, s = (t == null ? void 0 : t.dataStream.length) - 2;
1258
+ return s > 0 && r.params.mutations.push({
1249
1259
  t: "d",
1250
- len: i,
1260
+ len: s,
1251
1261
  line: 0,
1252
1262
  segmentId: e
1253
- }), r.dataStream.length > 0 && s.params.mutations.push({
1263
+ }), n.dataStream.length > 0 && r.params.mutations.push({
1254
1264
  t: "i",
1255
- body: r,
1256
- len: r.dataStream.length,
1265
+ body: n,
1266
+ len: n.dataStream.length,
1257
1267
  line: 0,
1258
1268
  segmentId: e
1259
- }), s;
1269
+ }), r;
1260
1270
  }
1261
- const ee = {
1271
+ const Q = {
1262
1272
  id: "doc.operation.move-cursor",
1263
1273
  type: R.OPERATION,
1264
- handler: (n, e) => !!e
1265
- }, te = {
1274
+ handler: (i, e) => !!e
1275
+ }, ee = {
1266
1276
  id: "doc.operation.move-selection",
1267
1277
  type: R.OPERATION,
1268
- handler: (n, e) => !!e
1269
- }, Gn = (n, e) => {
1270
- const t = n.get(O).getUniverDocInstance(e.unitId), r = (t == null ? void 0 : t.zoomRatio) || 1;
1278
+ handler: (i, e) => !!e
1279
+ }, Gn = (i, e) => {
1280
+ const t = i.get(O).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1271
1281
  return {
1272
- ...H.deepClone(e),
1273
- zoomRatio: r
1282
+ ...re.deepClone(e),
1283
+ zoomRatio: n
1274
1284
  };
1275
- }, Z = {
1285
+ }, Y = {
1276
1286
  id: "doc.operation.set-zoom-ratio",
1277
1287
  type: R.OPERATION,
1278
- handler: (n, e) => {
1279
- const t = n.get(O).getUniverDocInstance(e.unitId);
1288
+ handler: (i, e) => {
1289
+ const t = i.get(O).getUniverDocInstance(e.unitId);
1280
1290
  if (!t)
1281
1291
  return !1;
1282
- const r = t.getSnapshot();
1283
- return r.settings == null ? r.settings = {
1292
+ const n = t.getSnapshot();
1293
+ return n.settings == null ? n.settings = {
1284
1294
  zoomRatio: e.zoomRatio
1285
- } : r.settings.zoomRatio = e.zoomRatio, !0;
1295
+ } : n.settings.zoomRatio = e.zoomRatio, !0;
1286
1296
  }
1287
1297
  }, Bt = {
1288
1298
  type: R.COMMAND,
1289
1299
  id: "doc.command.set-zoom-ratio",
1290
- handler: async (n, e) => {
1291
- const t = n.get(x), r = n.get(N), s = n.get(O);
1292
- let i = s.getCurrentUniverDocInstance().getUnitId(), o = 1;
1293
- if (e && (i = e.documentId ?? i, o = e.zoomRatio ?? o), !s.getUniverDocInstance(i))
1300
+ handler: async (i, e) => {
1301
+ const t = i.get(x), n = i.get(N), r = i.get(O);
1302
+ let s = r.getCurrentUniverDocInstance().getUnitId(), o = 1;
1303
+ if (e && (s = e.documentId ?? s, o = e.zoomRatio ?? o), !r.getUniverDocInstance(s))
1294
1304
  return !1;
1295
1305
  const c = {
1296
1306
  zoomRatio: o,
1297
- unitId: i
1298
- }, d = Gn(n, c);
1299
- return t.syncExecuteCommand(Z.id, c) ? (r.pushUndoRedo({
1300
- unitID: i,
1301
- undoMutations: [{ id: Z.id, params: d }],
1302
- redoMutations: [{ id: Z.id, params: c }]
1307
+ unitId: s
1308
+ }, d = Gn(i, c);
1309
+ return t.syncExecuteCommand(Y.id, c) ? (n.pushUndoRedo({
1310
+ unitID: s,
1311
+ undoMutations: [{ id: Y.id, params: d }],
1312
+ redoMutations: [{ id: Y.id, params: c }]
1303
1313
  }), !0) : !1;
1304
1314
  }
1305
1315
  }, jt = {
1306
1316
  id: "doc.operation.select-all",
1307
1317
  type: R.COMMAND,
1308
- handler: async (n) => {
1309
- const e = n.get(O), t = n.get(P), r = e.getCurrentUniverDocInstance().getSnapshot().body;
1310
- if (r == null)
1318
+ handler: async (i) => {
1319
+ const e = i.get(O), t = i.get(P), n = e.getCurrentUniverDocInstance().getSnapshot().body;
1320
+ if (n == null)
1311
1321
  return !1;
1312
- const s = [
1322
+ const r = [
1313
1323
  {
1314
1324
  startOffset: 0,
1315
- endOffset: r.dataStream.length - 2
1325
+ endOffset: n.dataStream.length - 2
1316
1326
  }
1317
1327
  ];
1318
- return t.replaceTextRanges(s), !0;
1328
+ return t.replaceTextRanges(r), !0;
1319
1329
  }
1320
1330
  }, Xn = 10, qn = 6;
1321
1331
  function Yn() {
1322
- return H.generateRandomId(qn);
1332
+ return re.generateRandomId(qn);
1323
1333
  }
1324
- function Zn(n) {
1325
- const e = n.match(/data-copy-id="([^\s]+)"/);
1334
+ function Zn(i) {
1335
+ const e = i.match(/data-copy-id="([^\s]+)"/);
1326
1336
  return e && e[1] ? e[1] : null;
1327
1337
  }
1328
1338
  class Kn {
@@ -1339,32 +1349,32 @@ class Kn {
1339
1349
  this._cache.clear();
1340
1350
  }
1341
1351
  }
1342
- const ft = new Kn();
1343
- function Jn(n) {
1344
- const e = n.style, t = {};
1345
- for (let r = 0; r < e.length; r++) {
1346
- const s = e[r], i = e.getPropertyValue(s);
1347
- switch (s) {
1352
+ const _t = new Kn();
1353
+ function Jn(i) {
1354
+ const e = i.style, t = {};
1355
+ for (let n = 0; n < e.length; n++) {
1356
+ const r = e[n], s = e.getPropertyValue(r);
1357
+ switch (r) {
1348
1358
  case "margin-top": {
1349
- const o = parseInt(i);
1350
- t.spaceAbove = /pt/.test(i) ? qe(o) : o;
1359
+ const o = parseInt(s);
1360
+ t.spaceAbove = /pt/.test(s) ? Ze(o) : o;
1351
1361
  break;
1352
1362
  }
1353
1363
  case "margin-bottom": {
1354
- const o = parseInt(i);
1355
- t.spaceBelow = /pt/.test(i) ? qe(o) : o;
1364
+ const o = parseInt(s);
1365
+ t.spaceBelow = /pt/.test(s) ? Ze(o) : o;
1356
1366
  break;
1357
1367
  }
1358
1368
  }
1359
1369
  }
1360
1370
  return Object.getOwnPropertyNames(t).length ? t : null;
1361
1371
  }
1362
- function qe(n) {
1363
- return n / 0.75;
1372
+ function Ze(i) {
1373
+ return i / 0.75;
1364
1374
  }
1365
- function rt(n) {
1366
- const e = n.style, t = {}, r = n.tagName.toLowerCase();
1367
- switch (r) {
1375
+ function it(i) {
1376
+ const e = i.style, t = {}, n = i.tagName.toLowerCase();
1377
+ switch (n) {
1368
1378
  case "b":
1369
1379
  case "em":
1370
1380
  case "strong": {
@@ -1389,20 +1399,20 @@ function rt(n) {
1389
1399
  }
1390
1400
  case "sub":
1391
1401
  case "sup": {
1392
- t.va = r === "sup" ? j.SUPERSCRIPT : j.SUBSCRIPT;
1402
+ t.va = n === "sup" ? j.SUPERSCRIPT : j.SUBSCRIPT;
1393
1403
  break;
1394
1404
  }
1395
1405
  }
1396
- for (let s = 0; s < e.length; s++) {
1397
- const i = e[s], o = e.getPropertyValue(i);
1398
- switch (i) {
1406
+ for (let r = 0; r < e.length; r++) {
1407
+ const s = e[r], o = e.getPropertyValue(s);
1408
+ switch (s) {
1399
1409
  case "font-family": {
1400
1410
  t.ff = o;
1401
1411
  break;
1402
1412
  }
1403
1413
  case "font-size": {
1404
1414
  const a = parseInt(o);
1405
- Number.isNaN(a) || (t.fs = /pt$/.test(o) ? qe(a) : a);
1415
+ Number.isNaN(a) || (t.fs = /pt$/.test(o) ? Ze(a) : a);
1406
1416
  break;
1407
1417
  }
1408
1418
  case "font-style": {
@@ -1424,14 +1434,14 @@ function rt(n) {
1424
1434
  break;
1425
1435
  }
1426
1436
  case "color": {
1427
- const a = new it(o);
1437
+ const a = new ot(o);
1428
1438
  a.isValid && (t.cl = {
1429
1439
  rgb: a.toRgbString()
1430
1440
  });
1431
1441
  break;
1432
1442
  }
1433
1443
  case "background-color": {
1434
- const a = new it(o);
1444
+ const a = new ot(o);
1435
1445
  a.isValid && (t.bg = {
1436
1446
  rgb: a.toRgbString()
1437
1447
  });
@@ -1441,15 +1451,15 @@ function rt(n) {
1441
1451
  }
1442
1452
  return t;
1443
1453
  }
1444
- function Qn(n) {
1445
- const e = new DOMParser(), t = `<x-univer id="univer-root">${n}</x-univer>`;
1454
+ function Qn(i) {
1455
+ const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
1446
1456
  return e.parseFromString(t, "text/html").querySelector("#univer-root");
1447
1457
  }
1448
- function _t(n, e) {
1449
- const t = n.tagName.toLowerCase();
1450
- return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((r) => r === t) : e(n);
1458
+ function St(i, e) {
1459
+ const t = i.tagName.toLowerCase();
1460
+ return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
1451
1461
  }
1452
- const Ue = class Ue {
1462
+ const Le = class Le {
1453
1463
  constructor() {
1454
1464
  S(this, "_styleCache", /* @__PURE__ */ new Map());
1455
1465
  S(this, "_styleRules", []);
@@ -1461,48 +1471,48 @@ const Ue = class Ue {
1461
1471
  this._pluginList.push(e);
1462
1472
  }
1463
1473
  convert(e) {
1464
- const t = Ue._pluginList.find((i) => i.checkPasteType(e)), r = Qn(e), s = {
1474
+ const t = Le._pluginList.find((s) => s.checkPasteType(e)), n = Qn(e), r = {
1465
1475
  dataStream: "",
1466
1476
  textRuns: []
1467
1477
  };
1468
- return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, r == null ? void 0 : r.childNodes, s), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], s;
1478
+ return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes, r), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], r;
1469
1479
  }
1470
- _process(e, t, r) {
1471
- var s;
1472
- for (const i of t)
1473
- if (i.nodeType === Node.TEXT_NODE) {
1474
- const o = (s = i.nodeValue) == null ? void 0 : s.replace(/[\r\n]/g, "");
1480
+ _process(e, t, n) {
1481
+ var r;
1482
+ for (const s of t)
1483
+ if (s.nodeType === Node.TEXT_NODE) {
1484
+ const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
1475
1485
  let a;
1476
- e && this._styleCache.has(e) && (a = this._styleCache.get(e)), r.dataStream += o, a && Object.getOwnPropertyNames(a).length && r.textRuns.push({
1477
- st: r.dataStream.length - o.length,
1478
- ed: r.dataStream.length,
1486
+ e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
1487
+ st: n.dataStream.length - o.length,
1488
+ ed: n.dataStream.length,
1479
1489
  ts: a
1480
1490
  });
1481
- } else if (i.nodeType === Node.ELEMENT_NODE) {
1482
- const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => _t(i, h)), c = a ? a.getStyle(i) : rt(i);
1483
- this._styleCache.set(i, { ...o, ...c });
1484
- const { childNodes: d } = i;
1485
- this._process(i, d, r);
1491
+ } else if (s.nodeType === Node.ELEMENT_NODE) {
1492
+ const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: p }) => St(s, p)), c = a ? a.getStyle(s) : it(s);
1493
+ this._styleCache.set(s, { ...o, ...c });
1494
+ const { childNodes: d } = s;
1495
+ this._process(s, d, n);
1486
1496
  const l = this._afterProcessRules.find(
1487
- ({ filter: h }) => _t(i, h)
1497
+ ({ filter: p }) => St(s, p)
1488
1498
  );
1489
- l && l.handler(r, i);
1499
+ l && l.handler(n, s);
1490
1500
  }
1491
1501
  }
1492
1502
  };
1493
- S(Ue, "_pluginList", []);
1494
- let ge = Ue;
1503
+ S(Le, "_pluginList", []);
1504
+ let ge = Le;
1495
1505
  const er = {
1496
1506
  name: "univer-doc-paste-plugin-lark",
1497
- checkPasteType(n) {
1498
- return /lark-record-clipboard/i.test(n);
1507
+ checkPasteType(i) {
1508
+ return /lark-record-clipboard/i.test(i);
1499
1509
  },
1500
1510
  // TODO: @JOCS, support inline code copy from lark.
1501
1511
  stylesRules: [
1502
1512
  {
1503
1513
  filter: ["s"],
1504
- getStyle(n) {
1505
- const e = rt(n);
1514
+ getStyle(i) {
1515
+ const e = it(i);
1506
1516
  return {
1507
1517
  st: {
1508
1518
  s: D.TRUE
@@ -1514,61 +1524,61 @@ const er = {
1514
1524
  ],
1515
1525
  afterProcessRules: [
1516
1526
  {
1517
- filter(n) {
1518
- return n.tagName === "DIV" && /ace-line/i.test(n.className);
1527
+ filter(i) {
1528
+ return i.tagName === "DIV" && /ace-line/i.test(i.className);
1519
1529
  },
1520
- handler(n) {
1521
- n.paragraphs == null && (n.paragraphs = []), n.paragraphs.push({
1522
- startIndex: n.dataStream.length
1523
- }), n.dataStream += "\r";
1530
+ handler(i) {
1531
+ i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
1532
+ startIndex: i.dataStream.length
1533
+ }), i.dataStream += "\r";
1524
1534
  }
1525
1535
  }
1526
1536
  ]
1527
1537
  }, tr = {
1528
1538
  name: "univer-doc-paste-plugin-word",
1529
- checkPasteType(n) {
1530
- return /word|mso/i.test(n);
1539
+ checkPasteType(i) {
1540
+ return /word|mso/i.test(i);
1531
1541
  },
1532
1542
  stylesRules: [
1533
1543
  {
1534
1544
  filter: ["b"],
1535
- getStyle(n) {
1536
- const e = rt(n);
1545
+ getStyle(i) {
1546
+ const e = it(i);
1537
1547
  return { bl: D.TRUE, ...e };
1538
1548
  }
1539
1549
  }
1540
1550
  ],
1541
1551
  afterProcessRules: [
1542
1552
  {
1543
- filter(n) {
1544
- return n.tagName === "P" && /mso/i.test(n.className);
1553
+ filter(i) {
1554
+ return i.tagName === "P" && /mso/i.test(i.className);
1545
1555
  },
1546
- handler(n, e) {
1547
- n.paragraphs == null && (n.paragraphs = []);
1556
+ handler(i, e) {
1557
+ i.paragraphs == null && (i.paragraphs = []);
1548
1558
  const t = {
1549
- startIndex: n.dataStream.length
1550
- }, r = Jn(e);
1551
- r && (t.paragraphStyle = r), n.paragraphs.push(t), n.dataStream += "\r";
1559
+ startIndex: i.dataStream.length
1560
+ }, n = Jn(e);
1561
+ n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
1552
1562
  }
1553
1563
  }
1554
1564
  ]
1555
1565
  };
1556
- function nr(n, e) {
1557
- const { st: t, ed: r, ts: s = {} } = e, { ff: i, fs: o, it: a, bl: c, ul: d, st: l, ol: h, bg: p, cl: u, va: g } = s;
1558
- let m = n.slice(t, r);
1566
+ function nr(i, e) {
1567
+ const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: l, ol: p, bg: h, cl: u, va: g } = r;
1568
+ let m = i.slice(t, n);
1559
1569
  const f = [];
1560
- return a === D.TRUE && (m = `<i>${m}</i>`), g === j.SUPERSCRIPT ? m = `<sup>${m}</sup>` : g === j.SUBSCRIPT && (m = `<sub>${m}</sub>`), (d == null ? void 0 : d.s) === D.TRUE && (m = `<u>${m}</u>`), (l == null ? void 0 : l.s) === D.TRUE && (m = `<s>${m}</s>`), c === D.TRUE && (m = `<strong>${m}</strong>`), i && f.push(`font-family: ${i}`), u && f.push(`color: ${u.rgb}`), o && f.push(`font-size: ${o}px`), h && f.push("text-decoration: overline"), p && f.push(`background: ${p.rgb}`), f.length ? `<span style="${f.join(";")}">${m}</span>` : m;
1570
+ return a === D.TRUE && (m = `<i>${m}</i>`), g === j.SUPERSCRIPT ? m = `<sup>${m}</sup>` : g === j.SUBSCRIPT && (m = `<sub>${m}</sub>`), (d == null ? void 0 : d.s) === D.TRUE && (m = `<u>${m}</u>`), (l == null ? void 0 : l.s) === D.TRUE && (m = `<s>${m}</s>`), c === D.TRUE && (m = `<strong>${m}</strong>`), s && f.push(`font-family: ${s}`), u && f.push(`color: ${u.rgb}`), o && f.push(`font-size: ${o}px`), p && f.push("text-decoration: overline"), h && f.push(`background: ${h.rgb}`), f.length ? `<span style="${f.join(";")}">${m}</span>` : m;
1561
1571
  }
1562
- function St(n, e = !0) {
1563
- const { dataStream: t, textRuns: r = [], paragraphs: s = [] } = n;
1564
- let i = 0;
1572
+ function vt(i, e = !0) {
1573
+ const { dataStream: t, textRuns: n = [], paragraphs: r = [] } = i;
1574
+ let s = 0;
1565
1575
  const o = [], a = [];
1566
- for (const c of r) {
1576
+ for (const c of n) {
1567
1577
  const { st: d, ed: l } = c;
1568
- if (d !== i && o.push(t.slice(i, d)), o.push(nr(t, c)), i = l, e)
1569
- for (const h of s) {
1570
- const { startIndex: p, paragraphStyle: u = {} } = h;
1571
- if (p >= d && p <= l) {
1578
+ if (d !== s && o.push(t.slice(s, d)), o.push(nr(t, c)), s = l, e)
1579
+ for (const p of r) {
1580
+ const { startIndex: h, paragraphStyle: u = {} } = p;
1581
+ if (h >= d && h <= l) {
1572
1582
  const { spaceAbove: g, spaceBelow: m } = u, f = [];
1573
1583
  g != null && (typeof g == "number" ? f.push(`margin-top: ${g}px`) : f.push(`margin-top: ${g.v}px`)), m != null && (typeof m == "number" ? f.push(`margin-bottom: ${m}px`) : f.push(`margin-bottom: ${m.v}px`)), a.push(
1574
1584
  `<p className="UniverNormal" ${f.length ? `style="${f.join(";")}"` : ""}>${o.join("")}</p>`
@@ -1583,31 +1593,31 @@ class rr {
1583
1593
  if (e.length === 0)
1584
1594
  throw new Error("The bodyList length at least to be 1");
1585
1595
  if (e.length === 1)
1586
- return St(e[0]);
1596
+ return vt(e[0]);
1587
1597
  let t = "";
1588
- for (const r of e)
1589
- t += '<p className="UniverNormal">', t += St(r, !1), t += "</p>";
1598
+ for (const n of e)
1599
+ t += '<p className="UniverNormal">', t += vt(n, !1), t += "</p>";
1590
1600
  return t;
1591
1601
  }
1592
1602
  }
1593
- var sr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, or = (n, e, t, r) => {
1594
- for (var s = r > 1 ? void 0 : r ? ir(e, t) : e, i = n.length - 1, o; i >= 0; i--)
1595
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
1596
- return r && s && sr(e, t, s), s;
1597
- }, vt = (n, e) => (t, r) => e(t, r, n);
1603
+ var ir = Object.defineProperty, sr = Object.getOwnPropertyDescriptor, or = (i, e, t, n) => {
1604
+ for (var r = n > 1 ? void 0 : n ? sr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1605
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1606
+ return n && r && ir(e, t, r), r;
1607
+ }, Mt = (i, e) => (t, n) => e(t, n, i);
1598
1608
  ge.use(tr);
1599
1609
  ge.use(er);
1600
- function ar(n) {
1601
- const e = n.replace(/\n/g, "\r"), t = [];
1602
- for (let r = 0; r < e.length; r++)
1603
- e[r] === "\r" && t.push({ startIndex: r });
1610
+ function ar(i) {
1611
+ const e = i.replace(/\n/g, "\r"), t = [];
1612
+ for (let n = 0; n < e.length; n++)
1613
+ e[n] === "\r" && t.push({ startIndex: n });
1604
1614
  return {
1605
1615
  dataStream: e,
1606
1616
  paragraphs: t
1607
1617
  };
1608
1618
  }
1609
1619
  const Vt = Mn("doc.clipboard-service");
1610
- let Ye = class extends W {
1620
+ let Ke = class extends W {
1611
1621
  constructor(e, t) {
1612
1622
  super();
1613
1623
  S(this, "_clipboardHooks", []);
@@ -1620,17 +1630,17 @@ let Ye = class extends W {
1620
1630
  if (e.length === 0)
1621
1631
  return Promise.reject();
1622
1632
  try {
1623
- let t = "", r = "";
1624
- for (const i of e)
1625
- for (const o of i.types)
1626
- o === mn ? r = await i.getType(o).then((a) => a && a.text()) : o === fn && (t = await i.getType(o).then((a) => a && a.text()));
1633
+ let t = "", n = "";
1634
+ for (const s of e)
1635
+ for (const o of s.types)
1636
+ o === mn ? n = await s.getType(o).then((a) => a && a.text()) : o === fn && (t = await s.getType(o).then((a) => a && a.text()));
1627
1637
  if (!t)
1628
- return ar(r);
1629
- const s = Zn(t);
1630
- if (s) {
1631
- const i = ft.get(s);
1632
- if (i)
1633
- return i;
1638
+ return ar(n);
1639
+ const r = Zn(t);
1640
+ if (r) {
1641
+ const s = _t.get(r);
1642
+ if (s)
1643
+ return s;
1634
1644
  }
1635
1645
  return this._htmlToUDM.convert(t);
1636
1646
  } catch (t) {
@@ -1638,53 +1648,53 @@ let Ye = class extends W {
1638
1648
  }
1639
1649
  }
1640
1650
  async setClipboardData(e) {
1641
- const t = Yn(), r = e.length > 1 ? e.map((i) => i.dataStream).join(`
1651
+ const t = Yn(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1642
1652
  `) : e[0].dataStream;
1643
- let s = this._umdToHtml.convert(e);
1644
- return e.length === 1 && (s = s.replace(/(<[a-z]+)/, (i, o) => `${o} data-copy-id="${t}"`), ft.set(t, e[0])), this._clipboardInterfaceService.write(r, s);
1653
+ let r = this._umdToHtml.convert(e);
1654
+ return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), _t.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
1645
1655
  }
1646
1656
  addClipboardHook(e) {
1647
- return this._clipboardHooks.push(e), Ge(() => {
1657
+ return this._clipboardHooks.push(e), qe(() => {
1648
1658
  const t = this._clipboardHooks.indexOf(e);
1649
1659
  t > -1 && this._clipboardHooks.splice(t, 1);
1650
1660
  });
1651
1661
  }
1652
1662
  };
1653
- Ye = or([
1654
- vt(0, O),
1655
- vt(1, _n)
1656
- ], Ye);
1657
- var cr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, dr = (n, e, t, r) => {
1658
- for (var s = r > 1 ? void 0 : r ? lr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
1659
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
1660
- return r && s && cr(e, t, s), s;
1661
- }, ne = (n, e) => (t, r) => e(t, r, n);
1662
- let Me = class extends W {
1663
- constructor(n, e, t, r, s, i) {
1664
- super(), this._logService = n, this._commandService = e, this._currentUniverService = t, this._docClipboardService = r, this._textSelectionManagerService = s, this._contextService = i, this._commandExecutedListener(), this.initialize();
1663
+ Ke = or([
1664
+ Mt(0, O),
1665
+ Mt(1, _n)
1666
+ ], Ke);
1667
+ var cr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, dr = (i, e, t, n) => {
1668
+ for (var r = n > 1 ? void 0 : n ? lr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1669
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1670
+ return n && r && cr(e, t, r), r;
1671
+ }, te = (i, e) => (t, n) => e(t, n, i);
1672
+ let Re = class extends W {
1673
+ constructor(i, e, t, n, r, s) {
1674
+ super(), this._logService = i, this._commandService = e, this._currentUniverService = t, this._docClipboardService = n, this._textSelectionManagerService = r, this._contextService = s, this._commandExecutedListener(), this.initialize();
1665
1675
  }
1666
1676
  initialize() {
1667
- [Ve, Fe, ke].forEach(
1668
- (n) => this.disposeWithMe(this._commandService.registerAsMultipleCommand(n))
1669
- ), [mt, Ee].forEach(
1670
- (n) => this.disposeWithMe(this._commandService.registerCommand(n))
1677
+ [ke, ze, We].forEach(
1678
+ (i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))
1679
+ ), [ft, we].forEach(
1680
+ (i) => this.disposeWithMe(this._commandService.registerCommand(i))
1671
1681
  );
1672
1682
  }
1673
1683
  _commandExecutedListener() {
1674
- const n = [Fe.id, Ve.id, ke.id];
1684
+ const i = [ze.id, ke.id, We.id];
1675
1685
  this.disposeWithMe(
1676
1686
  this._commandService.onCommandExecuted((e) => {
1677
- if (n.includes(e.id) && !(!this._contextService.getContextValue(w) && !this._contextService.getContextValue(me)))
1687
+ if (i.includes(e.id) && !(!this._contextService.getContextValue(w) && !this._contextService.getContextValue(fe)))
1678
1688
  switch (e.id) {
1679
- case ke.id: {
1689
+ case We.id: {
1680
1690
  this._handlePaste();
1681
1691
  break;
1682
1692
  }
1683
- case Ve.id: {
1693
+ case ke.id: {
1684
1694
  this._handleCopy();
1685
1695
  break;
1686
1696
  }
1687
- case Fe.id: {
1697
+ case ze.id: {
1688
1698
  this._handleCut();
1689
1699
  break;
1690
1700
  }
@@ -1695,165 +1705,135 @@ let Me = class extends W {
1695
1705
  );
1696
1706
  }
1697
1707
  async _handlePaste() {
1698
- const { _docClipboardService: n } = this, {
1708
+ const { _docClipboardService: i } = this, {
1699
1709
  segmentId: e,
1700
1710
  endOffset: t,
1701
- style: r
1702
- } = this._textSelectionManagerService.getActiveRange() ?? {}, s = this._textSelectionManagerService.getSelections();
1703
- if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(t == null || s == null))
1711
+ style: n
1712
+ } = this._textSelectionManagerService.getActiveRange() ?? {}, r = this._textSelectionManagerService.getSelections();
1713
+ if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(t == null || r == null))
1704
1714
  try {
1705
- const i = await n.queryClipboardData();
1715
+ const s = await i.queryClipboardData();
1706
1716
  let o = t;
1707
- for (const c of s) {
1717
+ for (const c of r) {
1708
1718
  const { startOffset: d, endOffset: l } = c;
1709
- d == null || l == null || l <= t && (o += i.dataStream.length - (l - d));
1719
+ d == null || l == null || l <= t && (o += s.dataStream.length - (l - d));
1710
1720
  }
1711
1721
  const a = [
1712
1722
  {
1713
1723
  startOffset: o,
1714
1724
  endOffset: o,
1715
- style: r
1725
+ style: n
1716
1726
  }
1717
1727
  ];
1718
- this._commandService.executeCommand(mt.id, { body: i, segmentId: e, textRanges: a });
1728
+ this._commandService.executeCommand(ft.id, { body: s, segmentId: e, textRanges: a });
1719
1729
  } catch {
1720
1730
  this._logService.error("[DocClipboardController] clipboard is empty");
1721
1731
  }
1722
1732
  }
1723
1733
  _getDocumentBodyInRanges() {
1724
- const n = this._textSelectionManagerService.getSelections(), e = this._currentUniverService.getCurrentUniverDocInstance(), { dataStream: t, textRuns: r = [], paragraphs: s = [] } = e.getBody(), i = [];
1725
- if (n == null)
1726
- return i;
1727
- for (const o of n) {
1728
- const { startOffset: a, endOffset: c, collapsed: d } = o;
1729
- if (d || a == null || c == null)
1734
+ const i = this._textSelectionManagerService.getSelections(), e = this._currentUniverService.getCurrentUniverDocInstance(), t = [];
1735
+ if (i == null)
1736
+ return t;
1737
+ for (const n of i) {
1738
+ const { startOffset: r, endOffset: s, collapsed: o } = n;
1739
+ if (o || r == null || s == null)
1730
1740
  continue;
1731
- const l = {
1732
- dataStream: t.slice(a, c)
1733
- }, h = [];
1734
- for (const u of r) {
1735
- const g = H.deepClone(u), { st: m, ed: f } = g;
1736
- H.hasIntersectionBetweenTwoRanges(m, f, a, c) && (a >= m && a <= f ? h.push({
1737
- ...g,
1738
- st: a,
1739
- ed: Math.min(c, f)
1740
- }) : c >= m && c <= f ? h.push({
1741
- ...g,
1742
- st: Math.max(a, m),
1743
- ed: c
1744
- }) : h.push(g));
1745
- }
1746
- h.length && (l.textRuns = h.map((u) => {
1747
- const { st: g, ed: m } = u;
1748
- return {
1749
- ...u,
1750
- st: g - a,
1751
- ed: m - a
1752
- };
1753
- }));
1754
- const p = [];
1755
- for (const u of s) {
1756
- const { startIndex: g } = u;
1757
- g >= a && g <= c && p.push(H.deepClone(u));
1758
- }
1759
- p.length && (l.paragraphs = p.map((u) => ({
1760
- ...u,
1761
- startIndex: u.startIndex - a
1762
- }))), i.push(l);
1741
+ const a = e.sliceBody(r, s);
1742
+ a != null && t.push(a);
1763
1743
  }
1764
- return i;
1744
+ return t;
1765
1745
  }
1766
1746
  async _handleCopy() {
1767
- const { _docClipboardService: n } = this, e = this._getDocumentBodyInRanges();
1747
+ const { _docClipboardService: i } = this, e = this._getDocumentBodyInRanges();
1768
1748
  try {
1769
- n.setClipboardData(e);
1749
+ i.setClipboardData(e);
1770
1750
  } catch {
1771
1751
  this._logService.error("[DocClipboardController] set clipboard failed");
1772
1752
  }
1773
1753
  }
1774
1754
  async _handleCut() {
1775
1755
  const {
1776
- segmentId: n,
1756
+ segmentId: i,
1777
1757
  endOffset: e,
1778
1758
  style: t
1779
- } = this._textSelectionManagerService.getActiveRange() ?? {}, r = this._textSelectionManagerService.getSelections();
1780
- if (n == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(e == null || r == null)) {
1759
+ } = this._textSelectionManagerService.getActiveRange() ?? {}, n = this._textSelectionManagerService.getSelections();
1760
+ if (i == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(e == null || n == null)) {
1781
1761
  this._handleCopy();
1782
1762
  try {
1783
- let s = e;
1784
- for (const o of r) {
1763
+ let r = e;
1764
+ for (const o of n) {
1785
1765
  const { startOffset: a, endOffset: c } = o;
1786
- a == null || c == null || c <= e && (s -= c - a);
1766
+ a == null || c == null || c <= e && (r -= c - a);
1787
1767
  }
1788
- const i = [
1768
+ const s = [
1789
1769
  {
1790
- startOffset: s,
1791
- endOffset: s,
1770
+ startOffset: r,
1771
+ endOffset: r,
1792
1772
  style: t
1793
1773
  }
1794
1774
  ];
1795
- this._commandService.executeCommand(Ee.id, { segmentId: n, textRanges: i });
1775
+ this._commandService.executeCommand(we.id, { segmentId: i, textRanges: s });
1796
1776
  } catch {
1797
1777
  this._logService.error("[DocClipboardController] cut content failed");
1798
1778
  }
1799
1779
  }
1800
1780
  }
1801
1781
  };
1802
- Me = dr([
1803
- V(F.Rendered, Me),
1804
- ne(0, Ht),
1805
- ne(1, x),
1806
- ne(2, O),
1807
- ne(3, Vt),
1808
- ne(4, U(P)),
1809
- ne(5, Gt)
1810
- ], Me);
1811
- var ur = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, pr = (n, e, t, r) => {
1812
- for (var s = r > 1 ? void 0 : r ? hr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
1813
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
1814
- return r && s && ur(e, t, s), s;
1815
- }, ze = (n, e) => (t, r) => e(t, r, n);
1816
- let Ce = class extends Ze {
1817
- constructor(n, e, t) {
1818
- super(), this._docSkeletonManagerService = n, this._renderManagerService = e, this._commandService = t, this._initialRenderRefresh(), this._commandExecutedListener();
1782
+ Re = dr([
1783
+ V(F.Rendered, Re),
1784
+ te(0, Ht),
1785
+ te(1, x),
1786
+ te(2, O),
1787
+ te(3, Vt),
1788
+ te(4, U(P)),
1789
+ te(5, Gt)
1790
+ ], Re);
1791
+ var ur = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, pr = (i, e, t, n) => {
1792
+ for (var r = n > 1 ? void 0 : n ? hr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1793
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1794
+ return n && r && ur(e, t, r), r;
1795
+ }, He = (i, e) => (t, n) => e(t, n, i);
1796
+ let Ie = class extends me {
1797
+ constructor(i, e, t) {
1798
+ super(), this._docSkeletonManagerService = i, this._renderManagerService = e, this._commandService = t, this._initialRenderRefresh(), this._commandExecutedListener();
1819
1799
  }
1820
1800
  _initialRenderRefresh() {
1821
- this._docSkeletonManagerService.currentSkeletonBefore$.pipe(bt(this.dispose$)).subscribe((n) => {
1822
- if (n == null)
1801
+ this._docSkeletonManagerService.currentSkeletonBefore$.pipe(Se(this.dispose$)).subscribe((i) => {
1802
+ if (i == null)
1823
1803
  return;
1824
- const { skeleton: e, unitId: t } = n, r = this._renderManagerService.getRenderById(t);
1825
- if (r == null)
1804
+ const { skeleton: e, unitId: t } = i, n = this._renderManagerService.getRenderById(t);
1805
+ if (n == null)
1826
1806
  return;
1827
- const { mainComponent: s } = r;
1828
- s.changeSkeleton(e), this._recalculateSizeBySkeleton(r, e);
1807
+ const { mainComponent: r } = n;
1808
+ r.changeSkeleton(e), this._recalculateSizeBySkeleton(n, e);
1829
1809
  });
1830
1810
  }
1831
- _recalculateSizeBySkeleton(n, e) {
1811
+ _recalculateSizeBySkeleton(i, e) {
1832
1812
  var d;
1833
- const { mainComponent: t, scene: r } = n, s = t, i = (d = e.getSkeletonData()) == null ? void 0 : d.pages;
1834
- if (i == null)
1813
+ const { mainComponent: t, scene: n } = i, r = t, s = (d = e.getSkeletonData()) == null ? void 0 : d.pages;
1814
+ if (s == null)
1835
1815
  return;
1836
1816
  let o = 0, a = 0;
1837
- for (let l = 0, h = i.length; l < h; l++) {
1838
- const p = i[l], { pageWidth: u, pageHeight: g } = p;
1839
- s.pageLayoutType === ot.VERTICAL ? (a += g, a += s.pageMarginTop, l === h - 1 && (a += s.pageMarginTop), o = Math.max(o, u)) : s.pageLayoutType === ot.HORIZONTAL && (o += u, l !== h - 1 && (o += s.pageMarginLeft), a = Math.max(a, g));
1817
+ for (let l = 0, p = s.length; l < p; l++) {
1818
+ const h = s[l], { pageWidth: u, pageHeight: g } = h;
1819
+ r.pageLayoutType === at.VERTICAL ? (a += g, a += r.pageMarginTop, l === p - 1 && (a += r.pageMarginTop), o = Math.max(o, u)) : r.pageLayoutType === at.HORIZONTAL && (o += u, l !== p - 1 && (o += r.pageMarginLeft), a = Math.max(a, g));
1840
1820
  }
1841
- s.resize(o, a), [K, J].includes(n.unitId) || r.resize(o, a);
1821
+ r.resize(o, a), [Z, K].includes(i.unitId) || n.resize(o, a);
1842
1822
  }
1843
1823
  _commandExecutedListener() {
1844
- const n = [_.id], e = [K, J];
1824
+ const i = [_.id], e = [Z, K];
1845
1825
  this.disposeWithMe(
1846
1826
  this._commandService.onCommandExecuted((t) => {
1847
- var r;
1848
- if (n.includes(t.id)) {
1849
- const s = t.params, { unitId: i } = s, o = this._docSkeletonManagerService.getSkeletonByUnitId(i);
1827
+ var n;
1828
+ if (i.includes(t.id)) {
1829
+ const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
1850
1830
  if (o == null)
1851
1831
  return;
1852
- const { skeleton: a } = o, c = this._renderManagerService.getRenderById(i);
1832
+ const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
1853
1833
  if (c == null)
1854
1834
  return;
1855
- if (a.calculate(), e.includes(i)) {
1856
- (r = c.mainComponent) == null || r.makeDirty();
1835
+ if (a.calculate(), e.includes(s)) {
1836
+ (n = c.mainComponent) == null || n.makeDirty();
1857
1837
  return;
1858
1838
  }
1859
1839
  this._recalculateSizeBySkeleton(c, a);
@@ -1862,23 +1842,23 @@ let Ce = class extends Ze {
1862
1842
  );
1863
1843
  }
1864
1844
  };
1865
- Ce = pr([
1866
- V(F.Rendered, Ce),
1867
- ze(0, U(A)),
1868
- ze(1, G),
1869
- ze(2, x)
1870
- ], Ce);
1871
- var gr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, fr = (n, e, t, r) => {
1872
- for (var s = r > 1 ? void 0 : r ? mr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
1873
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
1874
- return r && s && gr(e, t, s), s;
1875
- }, oe = (n, e) => (t, r) => e(t, r, n);
1876
- let Re = class extends W {
1877
- constructor(e, t, r, s, i) {
1845
+ Ie = pr([
1846
+ V(F.Rendered, Ie),
1847
+ He(0, U(A)),
1848
+ He(1, H),
1849
+ He(2, x)
1850
+ ], Ie);
1851
+ var gr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, fr = (i, e, t, n) => {
1852
+ for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1853
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1854
+ return n && r && gr(e, t, r), r;
1855
+ }, oe = (i, e) => (t, n) => e(t, n, i);
1856
+ let xe = class extends W {
1857
+ constructor(e, t, n, r, s) {
1878
1858
  super();
1879
1859
  S(this, "_liquid", new sn());
1880
1860
  S(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1881
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = r, this._commandService = s, this._floatingObjectManagerService = i, this._initialize(), this._commandExecutedListener();
1861
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._initialize(), this._commandExecutedListener();
1882
1862
  }
1883
1863
  _initialize() {
1884
1864
  this._initialRenderRefresh(), this._updateOnPluginChange();
@@ -1888,39 +1868,39 @@ let Re = class extends W {
1888
1868
  const t = this._docSkeletonManagerService.getCurrent();
1889
1869
  if (t == null)
1890
1870
  return;
1891
- const { unitId: r, skeleton: s } = t, i = this._renderManagerService.getRenderById(r);
1892
- if (i == null)
1871
+ const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
1872
+ if (s == null)
1893
1873
  return;
1894
- const { mainComponent: o, components: a, scene: c } = i, d = o, { left: l, top: h } = d;
1895
- e.forEach((p) => {
1896
- const { unitId: u, subComponentId: g, floatingObjectId: m, floatingObject: f } = p, { left: v = 0, top: M = 0, width: T = 0, height: y = 0, angle: C, flipX: E, flipY: L, skewX: B, skewY: k } = f, I = this._pageMarginCache.get(m), X = (I == null ? void 0 : I.marginLeft) || 0, z = (I == null ? void 0 : I.marginTop) || 0;
1897
- s == null || s.getViewModel().getDataModel().updateDrawing(m, {
1898
- left: v - l - X,
1899
- top: M - h - z,
1874
+ const { mainComponent: o, components: a, scene: c } = s, d = o, { left: l, top: p } = d;
1875
+ e.forEach((h) => {
1876
+ const { unitId: u, subUnitId: g, floatingObjectId: m, floatingObject: f } = h, { left: v = 0, top: M = 0, width: T = 0, height: y = 0, angle: C, flipX: E, flipY: L, skewX: B, skewY: k } = f, I = this._pageMarginCache.get(m), G = (I == null ? void 0 : I.marginLeft) || 0, z = (I == null ? void 0 : I.marginTop) || 0;
1877
+ r == null || r.getViewModel().getDataModel().updateDrawing(m, {
1878
+ left: v - l - G,
1879
+ top: M - p - z,
1900
1880
  height: y,
1901
1881
  width: T
1902
1882
  });
1903
- }), s == null || s.calculate(), o == null || o.makeDirty();
1883
+ }), r == null || r.calculate(), o == null || o.makeDirty();
1904
1884
  });
1905
1885
  }
1906
1886
  _initialRenderRefresh() {
1907
1887
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1908
1888
  if (e == null)
1909
1889
  return;
1910
- const { skeleton: t, unitId: r } = e, s = this._renderManagerService.getRenderById(r);
1911
- if (s == null)
1890
+ const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
1891
+ if (r == null)
1912
1892
  return;
1913
- const { mainComponent: i } = s;
1914
- i.changeSkeleton(t), this._refreshFloatingObject(r, t, s);
1893
+ const { mainComponent: s } = r;
1894
+ s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1915
1895
  });
1916
1896
  }
1917
1897
  _commandExecutedListener() {
1918
- const e = [_.id, Z.id], t = [K, J];
1898
+ const e = [_.id, Y.id], t = [Z, K];
1919
1899
  this.disposeWithMe(
1920
- this._commandService.onCommandExecuted((r) => {
1921
- var s;
1922
- if (e.includes(r.id)) {
1923
- const i = r.params, { unitId: o } = i, a = this._docSkeletonManagerService.getCurrent();
1900
+ this._commandService.onCommandExecuted((n) => {
1901
+ var r;
1902
+ if (e.includes(n.id)) {
1903
+ const s = n.params, { unitId: o } = s, a = this._docSkeletonManagerService.getCurrent();
1924
1904
  if (a == null)
1925
1905
  return;
1926
1906
  const { unitId: c, skeleton: d } = a;
@@ -1930,7 +1910,7 @@ let Re = class extends W {
1930
1910
  if (l == null)
1931
1911
  return;
1932
1912
  if (t.includes(c)) {
1933
- (s = l.mainComponent) == null || s.makeDirty();
1913
+ (r = l.mainComponent) == null || r.makeDirty();
1934
1914
  return;
1935
1915
  }
1936
1916
  this._refreshFloatingObject(c, d, l);
@@ -1938,11 +1918,11 @@ let Re = class extends W {
1938
1918
  })
1939
1919
  );
1940
1920
  }
1941
- _refreshFloatingObject(e, t, r) {
1942
- const s = t == null ? void 0 : t.getSkeletonData(), { mainComponent: i, scene: o } = r, a = i;
1943
- if (!s)
1921
+ _refreshFloatingObject(e, t, n) {
1922
+ const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
1923
+ if (!r)
1944
1924
  return;
1945
- const { left: c, top: d, pageLayoutType: l, pageMarginLeft: h, pageMarginTop: p } = a, { pages: u } = s, g = [];
1925
+ const { left: c, top: d, pageLayoutType: l, pageMarginLeft: p, pageMarginTop: h } = a, { pages: u } = r, g = [];
1946
1926
  o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1947
1927
  for (let m = 0, f = u.length; m < f; m++) {
1948
1928
  const v = u[m], { skeDrawings: M, marginLeft: T, marginTop: y } = v;
@@ -1950,7 +1930,7 @@ let Re = class extends W {
1950
1930
  const { aLeft: E, aTop: L, height: B, width: k, objectId: I } = C;
1951
1931
  g.push({
1952
1932
  unitId: e,
1953
- subComponentId: Xt,
1933
+ subUnitId: Xt,
1954
1934
  floatingObjectId: I,
1955
1935
  floatingObject: {
1956
1936
  left: E + c + this._liquid.x,
@@ -1962,37 +1942,37 @@ let Re = class extends W {
1962
1942
  marginLeft: this._liquid.x,
1963
1943
  marginTop: this._liquid.y
1964
1944
  });
1965
- }), this._liquid.translatePage(v, l, h, p);
1945
+ }), this._liquid.translatePage(v, l, p, h);
1966
1946
  }
1967
1947
  this._floatingObjectManagerService.BatchAddOrUpdate(g);
1968
1948
  }
1969
1949
  };
1970
- Re = fr([
1971
- V(F.Steady, Re),
1950
+ xe = fr([
1951
+ V(F.Steady, xe),
1972
1952
  oe(0, U(A)),
1973
1953
  oe(1, O),
1974
- oe(2, G),
1954
+ oe(2, H),
1975
1955
  oe(3, x),
1976
1956
  oe(4, qt)
1977
- ], Re);
1978
- var _r = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, vr = (n, e, t, r) => {
1979
- for (var s = r > 1 ? void 0 : r ? Sr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
1980
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
1981
- return r && s && _r(e, t, s), s;
1982
- }, re = (n, e) => (t, r) => e(t, r, n);
1983
- let Ie = class extends W {
1984
- constructor(e, t, r, s, i, o) {
1957
+ ], xe);
1958
+ var _r = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, vr = (i, e, t, n) => {
1959
+ for (var r = n > 1 ? void 0 : n ? Sr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1960
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1961
+ return n && r && _r(e, t, r), r;
1962
+ }, ne = (i, e) => (t, n) => e(t, n, i);
1963
+ let Oe = class extends W {
1964
+ constructor(e, t, n, r, s, o) {
1985
1965
  super();
1986
1966
  S(this, "_previousIMEContent", "");
1987
1967
  S(this, "_previousIMERange");
1988
1968
  S(this, "_onStartSubscription");
1989
1969
  S(this, "_onUpdateSubscription");
1990
1970
  S(this, "_onEndSubscription");
1991
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = r, this._textSelectionRenderManager = s, this._imeInputManagerService = i, this._commandService = o, this._initialize();
1971
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._imeInputManagerService = s, this._commandService = o, this._initialize();
1992
1972
  }
1993
1973
  dispose() {
1994
- var e, t, r;
1995
- (e = this._onStartSubscription) == null || e.unsubscribe(), (t = this._onUpdateSubscription) == null || t.unsubscribe(), (r = this._onEndSubscription) == null || r.unsubscribe();
1974
+ var e, t, n;
1975
+ (e = this._onStartSubscription) == null || e.unsubscribe(), (t = this._onUpdateSubscription) == null || t.unsubscribe(), (n = this._onEndSubscription) == null || n.unsubscribe();
1996
1976
  }
1997
1977
  _initialize() {
1998
1978
  this._initialOnCompositionstart(), this._initialOnCompositionUpdate(), this._initialOnCompositionend();
@@ -2002,7 +1982,7 @@ let Ie = class extends W {
2002
1982
  if (e == null)
2003
1983
  return;
2004
1984
  const { activeRange: t } = e;
2005
- t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(H.deepClone(t)), this._previousIMERange = t);
1985
+ t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(re.deepClone(t)), this._previousIMERange = t);
2006
1986
  });
2007
1987
  }
2008
1988
  _initialOnCompositionUpdate() {
@@ -2017,99 +1997,99 @@ let Ie = class extends W {
2017
1997
  }
2018
1998
  async _updateContent(e, t) {
2019
1999
  var g;
2020
- const r = (g = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : g.skeleton;
2021
- if (this._previousIMERange == null || e == null || r == null)
2000
+ const n = (g = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : g.skeleton;
2001
+ if (this._previousIMERange == null || e == null || n == null)
2022
2002
  return;
2023
- const s = this._currentUniverService.getCurrentUniverDocInstance(), { event: i, activeRange: o } = e, { startOffset: a, segmentId: c, style: d } = this._previousIMERange;
2024
- if (r == null || o == null)
2003
+ const r = this._currentUniverService.getCurrentUniverDocInstance(), { event: s, activeRange: o } = e, { startOffset: a, segmentId: c, style: d } = this._previousIMERange;
2004
+ if (n == null || o == null)
2025
2005
  return;
2026
- const h = i.data;
2027
- if (h === this._previousIMEContent && t)
2006
+ const p = s.data;
2007
+ if (p === this._previousIMEContent && t)
2028
2008
  return;
2029
- const p = h.length, u = [
2009
+ const h = p.length, u = [
2030
2010
  {
2031
- startOffset: a + p,
2032
- endOffset: a + p,
2011
+ startOffset: a + h,
2012
+ endOffset: a + h,
2033
2013
  style: d
2034
2014
  }
2035
2015
  ];
2036
2016
  await this._commandService.executeCommand(Lt.id, {
2037
- unitId: s.getUnitId(),
2038
- newText: h,
2017
+ unitId: r.getUnitId(),
2018
+ newText: p,
2039
2019
  oldTextLen: this._previousIMEContent.length,
2040
2020
  range: this._previousIMERange,
2041
2021
  textRanges: u,
2042
2022
  isCompositionEnd: !t,
2043
2023
  segmentId: c
2044
- }), r.calculate(), t ? (this._previousIMERange.collapsed || (this._previousIMERange.collapsed = !0), this._previousIMEContent = h) : this._resetIME();
2024
+ }), t ? (this._previousIMERange.collapsed || (this._previousIMERange.collapsed = !0), this._previousIMEContent = p) : this._resetIME();
2045
2025
  }
2046
2026
  _resetIME() {
2047
2027
  this._previousIMEContent = "", this._previousIMERange = null, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
2048
2028
  }
2049
2029
  _getDocObject() {
2050
- return Le(this._currentUniverService, this._renderManagerService);
2030
+ return Ne(this._currentUniverService, this._renderManagerService);
2051
2031
  }
2052
2032
  };
2053
- Ie = vr([
2054
- V(F.Rendered, Ie),
2055
- re(0, U(A)),
2056
- re(1, O),
2057
- re(2, G),
2058
- re(3, fe),
2059
- re(4, U(tt)),
2060
- re(5, x)
2061
- ], Ie);
2062
- var Mr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Rr = (n, e, t, r) => {
2063
- for (var s = r > 1 ? void 0 : r ? Cr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2064
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2065
- return r && s && Mr(e, t, s), s;
2066
- }, Mt = (n, e) => (t, r) => e(t, r, n);
2067
- let xe = class extends W {
2068
- constructor(n, e) {
2069
- super(), this._textSelectionManagerService = n, this._commandService = e, this._commandExecutedListener();
2033
+ Oe = vr([
2034
+ V(F.Rendered, Oe),
2035
+ ne(0, U(A)),
2036
+ ne(1, O),
2037
+ ne(2, H),
2038
+ ne(3, _e),
2039
+ ne(4, U(nt)),
2040
+ ne(5, x)
2041
+ ], Oe);
2042
+ var Mr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Rr = (i, e, t, n) => {
2043
+ for (var r = n > 1 ? void 0 : n ? Cr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2044
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2045
+ return n && r && Mr(e, t, r), r;
2046
+ }, Ct = (i, e) => (t, n) => e(t, n, i);
2047
+ let ye = class extends W {
2048
+ constructor(i, e) {
2049
+ super(), this._textSelectionManagerService = i, this._commandService = e, this._commandExecutedListener();
2070
2050
  }
2071
2051
  _commandExecutedListener() {
2072
- const n = [
2052
+ const i = [
2073
2053
  ue.id,
2074
- Ne.id,
2075
- $e.id,
2076
2054
  Be.id,
2077
- Q.id,
2078
- ie.id,
2055
+ je.id,
2056
+ Ve.id,
2057
+ J.id,
2058
+ se.id,
2079
2059
  he.id,
2080
2060
  pe.id,
2081
- je.id
2061
+ Fe.id
2082
2062
  ];
2083
2063
  this.disposeWithMe(
2084
2064
  this._commandService.onCommandExecuted((e) => {
2085
- n.includes(e.id) && this._handleInlineFormat(e);
2065
+ i.includes(e.id) && this._handleInlineFormat(e);
2086
2066
  })
2087
2067
  );
2088
2068
  }
2089
- _handleInlineFormat(n) {
2069
+ _handleInlineFormat(i) {
2090
2070
  const { segmentId: e } = this._textSelectionManagerService.getActiveRange() ?? {};
2091
2071
  e != null && this._commandService.executeCommand(Nt.id, {
2092
2072
  segmentId: e,
2093
- preCommandId: n.id,
2094
- ...n.params ?? {}
2073
+ preCommandId: i.id,
2074
+ ...i.params ?? {}
2095
2075
  });
2096
2076
  }
2097
2077
  };
2098
- xe = Rr([
2099
- V(F.Rendered, xe),
2100
- Mt(0, U(P)),
2101
- Mt(1, x)
2102
- ], xe);
2103
- var Ir = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Or = (n, e, t, r) => {
2104
- for (var s = r > 1 ? void 0 : r ? xr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2105
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2106
- return r && s && Ir(e, t, s), s;
2107
- }, ae = (n, e) => (t, r) => e(t, r, n);
2108
- let Oe = class extends W {
2109
- constructor(e, t, r, s, i) {
2078
+ ye = Rr([
2079
+ V(F.Rendered, ye),
2080
+ Ct(0, U(P)),
2081
+ Ct(1, x)
2082
+ ], ye);
2083
+ var Ir = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Or = (i, e, t, n) => {
2084
+ for (var r = n > 1 ? void 0 : n ? xr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2085
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2086
+ return n && r && Ir(e, t, r), r;
2087
+ }, ae = (i, e) => (t, n) => e(t, n, i);
2088
+ let be = class extends W {
2089
+ constructor(e, t, n, r, s) {
2110
2090
  super();
2111
2091
  S(this, "_onInputSubscription");
2112
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = r, this._textSelectionManagerService = s, this._commandService = i, this._initialize(), this._commandExecutedListener();
2092
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = r, this._commandService = s, this._initialize(), this._commandExecutedListener();
2113
2093
  }
2114
2094
  dispose() {
2115
2095
  var e;
@@ -2118,17 +2098,17 @@ let Oe = class extends W {
2118
2098
  _initialize() {
2119
2099
  }
2120
2100
  _commandExecutedListener() {
2121
- const e = [ee.id, te.id];
2101
+ const e = [Q.id, ee.id];
2122
2102
  this.disposeWithMe(
2123
2103
  this._commandService.onCommandExecuted((t) => {
2124
2104
  if (!e.includes(t.id))
2125
2105
  return;
2126
- const r = t.params;
2106
+ const n = t.params;
2127
2107
  switch (t.id) {
2108
+ case Q.id:
2109
+ return this._handleMoveCursor(n.direction);
2128
2110
  case ee.id:
2129
- return this._handleMoveCursor(r.direction);
2130
- case te.id:
2131
- return this._handleShiftMoveSelection(r.direction);
2111
+ return this._handleShiftMoveSelection(n.direction);
2132
2112
  default:
2133
2113
  throw new Error("Unknown command");
2134
2114
  }
@@ -2137,13 +2117,13 @@ let Oe = class extends W {
2137
2117
  }
2138
2118
  _handleShiftMoveSelection(e) {
2139
2119
  var m;
2140
- const t = this._textSelectionManagerService.getActiveRange(), r = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), i = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, o = this._getDocObject();
2141
- if (t == null || i == null || o == null)
2120
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), s = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, o = this._getDocObject();
2121
+ if (t == null || s == null || o == null)
2142
2122
  return;
2143
- const { startOffset: a, endOffset: c, style: d, collapsed: l, direction: h } = t;
2144
- if (r.length > 1) {
2123
+ const { startOffset: a, endOffset: c, style: d, collapsed: l, direction: p } = t;
2124
+ if (n.length > 1) {
2145
2125
  let f = 1 / 0, v = -1 / 0;
2146
- for (const M of r)
2126
+ for (const M of n)
2147
2127
  f = Math.min(f, M.startOffset), v = Math.max(v, M.endOffset);
2148
2128
  this._textSelectionManagerService.replaceTextRanges([
2149
2129
  {
@@ -2154,40 +2134,40 @@ let Oe = class extends W {
2154
2134
  ]);
2155
2135
  return;
2156
2136
  }
2157
- const p = l || h === at.FORWARD ? a : c;
2158
- let u = l || h === at.FORWARD ? c : a;
2159
- const g = s.getBody().dataStream.length ?? 1 / 0;
2137
+ const h = l || p === ct.FORWARD ? a : c;
2138
+ let u = l || p === ct.FORWARD ? c : a;
2139
+ const g = r.getBody().dataStream.length ?? 1 / 0;
2160
2140
  if (e === b.LEFT || e === b.RIGHT) {
2161
- const f = i.findNodeByCharIndex(u - 1), v = i.findNodeByCharIndex(u);
2141
+ const f = s.findNodeByCharIndex(u - 1), v = s.findNodeByCharIndex(u);
2162
2142
  u = e === b.RIGHT ? u + v.count : u - ((f == null ? void 0 : f.count) ?? 0), u = Math.min(g - 2, Math.max(0, u)), this._textSelectionManagerService.replaceTextRanges([
2163
2143
  {
2164
- startOffset: p,
2144
+ startOffset: h,
2165
2145
  endOffset: u,
2166
2146
  style: d
2167
2147
  }
2168
2148
  ]);
2169
2149
  } else {
2170
- const f = i.findNodeByCharIndex(u), v = o.document.getOffsetConfig(), M = this._getTopOrBottomPosition(i, f, e === b.DOWN);
2150
+ const f = s.findNodeByCharIndex(u), v = o.document.getOffsetConfig(), M = this._getTopOrBottomPosition(s, f, e === b.DOWN);
2171
2151
  if (M == null) {
2172
2152
  const y = e === b.UP ? 0 : g - 2;
2173
2153
  if (y === u)
2174
2154
  return;
2175
2155
  this._textSelectionManagerService.replaceTextRanges([
2176
2156
  {
2177
- startOffset: p,
2157
+ startOffset: h,
2178
2158
  endOffset: y,
2179
2159
  style: d
2180
2160
  }
2181
2161
  ]);
2182
2162
  return;
2183
2163
  }
2184
- const T = new ct(v, i).getRangePointData(
2164
+ const T = new lt(v, s).getRangePointData(
2185
2165
  M,
2186
2166
  M
2187
2167
  ).cursorList[0];
2188
2168
  this._textSelectionManagerService.replaceTextRanges([
2189
2169
  {
2190
- startOffset: p,
2170
+ startOffset: h,
2191
2171
  endOffset: T.endOffset,
2192
2172
  style: d
2193
2173
  }
@@ -2195,21 +2175,21 @@ let Oe = class extends W {
2195
2175
  }
2196
2176
  }
2197
2177
  _handleMoveCursor(e) {
2198
- var p;
2199
- const t = this._textSelectionManagerService.getActiveRange(), r = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), i = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton, o = this._getDocObject();
2200
- if (t == null || i == null || o == null || r == null)
2178
+ var h;
2179
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), s = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, o = this._getDocObject();
2180
+ if (t == null || s == null || o == null || n == null)
2201
2181
  return;
2202
- const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, h = s.getBody().dataStream.length ?? 1 / 0;
2182
+ const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, p = r.getBody().dataStream.length ?? 1 / 0;
2203
2183
  if (e === b.LEFT || e === b.RIGHT) {
2204
2184
  let u;
2205
- if (!t.collapsed || r.length > 1) {
2185
+ if (!t.collapsed || n.length > 1) {
2206
2186
  let g = 1 / 0, m = -1 / 0;
2207
- for (const f of r)
2187
+ for (const f of n)
2208
2188
  g = Math.min(g, f.startOffset), m = Math.max(m, f.endOffset);
2209
2189
  u = e === b.LEFT ? g : m;
2210
2190
  } else {
2211
- const g = i.findNodeByCharIndex(a - 1), m = i.findNodeByCharIndex(a);
2212
- e === b.LEFT ? u = Math.max(0, a - ((g == null ? void 0 : g.count) ?? 0)) : u = Math.min(h - 2, c + m.count);
2191
+ const g = s.findNodeByCharIndex(a - 1), m = s.findNodeByCharIndex(a);
2192
+ e === b.LEFT ? u = Math.max(0, a - ((g == null ? void 0 : g.count) ?? 0)) : u = Math.min(p - 2, c + m.count);
2213
2193
  }
2214
2194
  this._textSelectionManagerService.replaceTextRanges([
2215
2195
  {
@@ -2219,14 +2199,14 @@ let Oe = class extends W {
2219
2199
  }
2220
2200
  ]);
2221
2201
  } else {
2222
- const u = i.findNodeByCharIndex(a), g = i.findNodeByCharIndex(c), m = o.document.getOffsetConfig(), f = this._getTopOrBottomPosition(
2223
- i,
2202
+ const u = s.findNodeByCharIndex(a), g = s.findNodeByCharIndex(c), m = o.document.getOffsetConfig(), f = this._getTopOrBottomPosition(
2203
+ s,
2224
2204
  e === b.UP ? u : g,
2225
2205
  e === b.DOWN
2226
2206
  );
2227
2207
  if (f == null) {
2228
2208
  let M;
2229
- l ? M = e === b.UP ? 0 : h - 2 : M = e === b.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
2209
+ l ? M = e === b.UP ? 0 : p - 2 : M = e === b.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
2230
2210
  {
2231
2211
  startOffset: M,
2232
2212
  endOffset: M,
@@ -2235,7 +2215,7 @@ let Oe = class extends W {
2235
2215
  ]);
2236
2216
  return;
2237
2217
  }
2238
- const v = new ct(m, i).getRangePointData(
2218
+ const v = new lt(m, s).getRangePointData(
2239
2219
  f,
2240
2220
  f
2241
2221
  ).cursorList[0];
@@ -2247,13 +2227,13 @@ let Oe = class extends W {
2247
2227
  ]);
2248
2228
  }
2249
2229
  }
2250
- _getTopOrBottomPosition(e, t, r) {
2230
+ _getTopOrBottomPosition(e, t, n) {
2251
2231
  if (t == null)
2252
2232
  return;
2253
- const s = this._getSpanLeftOffsetInLine(t), i = this._getNextOrPrevLine(t, r);
2254
- if (i == null)
2233
+ const r = this._getSpanLeftOffsetInLine(t), s = this._getNextOrPrevLine(t, n);
2234
+ if (s == null)
2255
2235
  return;
2256
- const o = this._matchPositionByLeftOffset(e, i, s);
2236
+ const o = this._matchPositionByLeftOffset(e, s, r);
2257
2237
  if (o != null)
2258
2238
  return { ...o, isBack: !0 };
2259
2239
  }
@@ -2261,44 +2241,44 @@ let Oe = class extends W {
2261
2241
  const t = e.parent;
2262
2242
  if (t == null)
2263
2243
  return -1 / 0;
2264
- const r = t.left, { left: s } = e;
2265
- return r + s;
2244
+ const n = t.left, { left: r } = e;
2245
+ return n + r;
2266
2246
  }
2267
- _matchPositionByLeftOffset(e, t, r) {
2268
- const s = {
2247
+ _matchPositionByLeftOffset(e, t, n) {
2248
+ const r = {
2269
2249
  distance: 1 / 0
2270
2250
  };
2271
- for (const i of t.divides) {
2272
- const o = i.left;
2273
- for (const a of i.spanGroup) {
2274
- const { left: c } = a, d = o + c, l = Math.abs(r - d);
2275
- l < s.distance && (s.span = a, s.distance = l);
2251
+ for (const s of t.divides) {
2252
+ const o = s.left;
2253
+ for (const a of s.spanGroup) {
2254
+ const { left: c } = a, d = o + c, l = Math.abs(n - d);
2255
+ l < r.distance && (r.span = a, r.distance = l);
2276
2256
  }
2277
2257
  }
2278
- if (s.span != null)
2279
- return e.findPositionBySpan(s.span);
2258
+ if (r.span != null)
2259
+ return e.findPositionBySpan(r.span);
2280
2260
  }
2281
2261
  _getNextOrPrevLine(e, t) {
2282
2262
  var g, m, f, v, M, T, y, C, E, L, B, k;
2283
- const r = e.parent;
2263
+ const n = e.parent;
2264
+ if (n == null)
2265
+ return;
2266
+ const r = n.parent;
2284
2267
  if (r == null)
2285
2268
  return;
2286
2269
  const s = r.parent;
2287
2270
  if (s == null)
2288
2271
  return;
2289
- const i = s.parent;
2290
- if (i == null)
2291
- return;
2292
- const o = i.lines.indexOf(s);
2272
+ const o = s.lines.indexOf(r);
2293
2273
  if (o === -1)
2294
2274
  return;
2295
2275
  let a;
2296
- if (t === !0 ? a = i.lines[o + 1] : a = i.lines[o - 1], a != null)
2276
+ if (t === !0 ? a = s.lines[o + 1] : a = s.lines[o - 1], a != null)
2297
2277
  return a;
2298
- const c = i.parent;
2278
+ const c = s.parent;
2299
2279
  if (c == null)
2300
2280
  return;
2301
- const d = c.columns.indexOf(i);
2281
+ const d = c.columns.indexOf(s);
2302
2282
  if (d === -1)
2303
2283
  return;
2304
2284
  if (t === !0)
@@ -2312,29 +2292,29 @@ let Oe = class extends W {
2312
2292
  const l = c.parent;
2313
2293
  if (l == null)
2314
2294
  return;
2315
- const h = l.sections.indexOf(c);
2316
- if (h === -1)
2295
+ const p = l.sections.indexOf(c);
2296
+ if (p === -1)
2317
2297
  return;
2318
2298
  if (t === !0)
2319
- a = (M = (v = l.sections[h - 1]) == null ? void 0 : v.columns[0]) == null ? void 0 : M.lines[0];
2299
+ a = (M = (v = l.sections[p - 1]) == null ? void 0 : v.columns[0]) == null ? void 0 : M.lines[0];
2320
2300
  else {
2321
- const I = (y = (T = l.sections) == null ? void 0 : T[h - 1]) == null ? void 0 : y.columns, X = I == null ? void 0 : I[I.length - 1], z = X == null ? void 0 : X.lines;
2301
+ const I = (y = (T = l.sections) == null ? void 0 : T[p - 1]) == null ? void 0 : y.columns, G = I == null ? void 0 : I[I.length - 1], z = G == null ? void 0 : G.lines;
2322
2302
  a = z == null ? void 0 : z[z.length - 1];
2323
2303
  }
2324
2304
  if (a != null)
2325
2305
  return a;
2326
- const p = l.parent;
2327
- if (p == null)
2306
+ const h = l.parent;
2307
+ if (h == null)
2328
2308
  return;
2329
- const u = p.pages.indexOf(l);
2309
+ const u = h.pages.indexOf(l);
2330
2310
  if (u !== -1) {
2331
2311
  if (t === !0)
2332
- a = (L = (E = (C = p.pages[u + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : E.columns[0]) == null ? void 0 : L.lines[0];
2312
+ a = (L = (E = (C = h.pages[u + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : E.columns[0]) == null ? void 0 : L.lines[0];
2333
2313
  else {
2334
- const I = (B = p.pages[u - 1]) == null ? void 0 : B.sections;
2314
+ const I = (B = h.pages[u - 1]) == null ? void 0 : B.sections;
2335
2315
  if (I == null)
2336
2316
  return;
2337
- const X = (k = I[I.length - 1]) == null ? void 0 : k.columns, z = X[X.length - 1], st = z == null ? void 0 : z.lines;
2317
+ const G = (k = I[I.length - 1]) == null ? void 0 : k.columns, z = G[G.length - 1], st = z == null ? void 0 : z.lines;
2338
2318
  a = st[st.length - 1];
2339
2319
  }
2340
2320
  if (a != null)
@@ -2342,27 +2322,27 @@ let Oe = class extends W {
2342
2322
  }
2343
2323
  }
2344
2324
  _getDocObject() {
2345
- return Le(this._currentUniverService, this._renderManagerService);
2325
+ return Ne(this._currentUniverService, this._renderManagerService);
2346
2326
  }
2347
2327
  };
2348
- Oe = Or([
2349
- V(F.Rendered, Oe),
2328
+ be = Or([
2329
+ V(F.Rendered, be),
2350
2330
  ae(0, U(A)),
2351
2331
  ae(1, O),
2352
- ae(2, G),
2332
+ ae(2, H),
2353
2333
  ae(3, U(P)),
2354
2334
  ae(4, x)
2355
- ], Oe);
2356
- var yr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Dr = (n, e, t, r) => {
2357
- for (var s = r > 1 ? void 0 : r ? br(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2358
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2359
- return r && s && yr(e, t, s), s;
2360
- }, ce = (n, e) => (t, r) => e(t, r, n);
2361
- let ye = class extends W {
2362
- constructor(e, t, r, s, i) {
2335
+ ], be);
2336
+ var yr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Dr = (i, e, t, n) => {
2337
+ for (var r = n > 1 ? void 0 : n ? br(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2338
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2339
+ return n && r && yr(e, t, r), r;
2340
+ }, ce = (i, e) => (t, n) => e(t, n, i);
2341
+ let De = class extends W {
2342
+ constructor(e, t, n, r, s) {
2363
2343
  super();
2364
2344
  S(this, "_onInputSubscription");
2365
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = r, this._textSelectionRenderManager = s, this._commandService = i, this._initialize(), this._commandExecutedListener();
2345
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._commandService = s, this._initialize(), this._commandExecutedListener();
2366
2346
  }
2367
2347
  dispose() {
2368
2348
  var e;
@@ -2376,20 +2356,20 @@ let ye = class extends W {
2376
2356
  var g;
2377
2357
  if (e == null)
2378
2358
  return;
2379
- const r = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: s, content: i = "", activeRange: o } = e, a = s, c = (g = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : g.skeleton;
2359
+ const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: r, content: s = "", activeRange: o } = e, a = r, c = (g = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : g.skeleton;
2380
2360
  if (a.data == null || c == null || !c || !o)
2381
2361
  return;
2382
- const { startOffset: d, segmentId: l, style: h } = o, p = i.length, u = [
2362
+ const { startOffset: d, segmentId: l, style: p } = o, h = s.length, u = [
2383
2363
  {
2384
- startOffset: d + p,
2385
- endOffset: d + p,
2386
- style: h
2364
+ startOffset: d + h,
2365
+ endOffset: d + h,
2366
+ style: p
2387
2367
  }
2388
2368
  ];
2389
- await this._commandService.executeCommand(Je.id, {
2390
- unitId: r,
2369
+ await this._commandService.executeCommand(Qe.id, {
2370
+ unitId: n,
2391
2371
  body: {
2392
- dataStream: i
2372
+ dataStream: s
2393
2373
  },
2394
2374
  range: o,
2395
2375
  textRanges: u,
@@ -2400,46 +2380,46 @@ let ye = class extends W {
2400
2380
  _commandExecutedListener() {
2401
2381
  }
2402
2382
  _getDocObject() {
2403
- return Le(this._currentUniverService, this._renderManagerService);
2383
+ return Ne(this._currentUniverService, this._renderManagerService);
2404
2384
  }
2405
2385
  };
2406
- ye = Dr([
2407
- V(F.Rendered, ye),
2386
+ De = Dr([
2387
+ V(F.Rendered, De),
2408
2388
  ce(0, U(A)),
2409
2389
  ce(1, O),
2410
- ce(2, G),
2411
- ce(3, fe),
2390
+ ce(2, H),
2391
+ ce(3, _e),
2412
2392
  ce(4, x)
2413
- ], ye);
2414
- var Tr = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, Er = (n, e, t, r) => {
2415
- for (var s = r > 1 ? void 0 : r ? Pr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2416
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2417
- return r && s && Tr(e, t, s), s;
2418
- }, Ct = (n, e) => (t, r) => e(t, r, n);
2393
+ ], De);
2394
+ var Tr = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
2395
+ for (var r = n > 1 ? void 0 : n ? Pr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2396
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2397
+ return n && r && Tr(e, t, r), r;
2398
+ }, Rt = (i, e) => (t, n) => e(t, n, i);
2419
2399
  const Ur = "rgba(198, 198, 198, 1)", wr = "rgba(255, 255, 255, 1)";
2420
- let be = class extends W {
2421
- constructor(n, e) {
2422
- super(), this._renderManagerService = n, this._currentUniverService = e, this._initialize(), this._commandExecutedListener();
2400
+ let Te = class extends W {
2401
+ constructor(i, e) {
2402
+ super(), this._renderManagerService = i, this._currentUniverService = e, this._initialize(), this._commandExecutedListener();
2423
2403
  }
2424
2404
  _initialize() {
2425
2405
  this._initialRenderRefresh();
2426
2406
  }
2427
2407
  _initialRenderRefresh() {
2428
- this._renderManagerService.currentRender$.subscribe((n) => {
2429
- var i;
2430
- if (n == null || this._currentUniverService.getUniverDocInstance(n) == null)
2408
+ this._renderManagerService.currentRender$.subscribe((i) => {
2409
+ var s;
2410
+ if (i == null || this._currentUniverService.getUniverDocInstance(i) == null)
2431
2411
  return;
2432
- const e = this._renderManagerService.getRenderById(n);
2412
+ const e = this._renderManagerService.getRenderById(i);
2433
2413
  if (e == null)
2434
2414
  return;
2435
- const { mainComponent: t } = e, r = t, s = (i = r.getSkeleton()) == null ? void 0 : i.getPageSize();
2436
- r.onPageRenderObservable.add((o) => {
2437
- if ([K, J].includes(n))
2415
+ const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
2416
+ n.onPageRenderObservable.add((o) => {
2417
+ if ([Z, K].includes(i))
2438
2418
  return;
2439
- const { page: a, pageLeft: c, pageTop: d, ctx: l } = o, { width: h, pageWidth: p, height: u, pageHeight: g } = a;
2419
+ const { page: a, pageLeft: c, pageTop: d, ctx: l } = o, { width: p, pageWidth: h, height: u, pageHeight: g } = a;
2440
2420
  l.save(), l.translate(c - 0.5, d - 0.5), on.drawWith(l, {
2441
- width: (s == null ? void 0 : s.width) ?? p ?? h,
2442
- height: (s == null ? void 0 : s.height) ?? g ?? u,
2421
+ width: (r == null ? void 0 : r.width) ?? h ?? p,
2422
+ height: (r == null ? void 0 : r.height) ?? g ?? u,
2443
2423
  strokeWidth: 1,
2444
2424
  stroke: Ur,
2445
2425
  fill: wr,
@@ -2451,18 +2431,18 @@ let be = class extends W {
2451
2431
  _commandExecutedListener() {
2452
2432
  }
2453
2433
  };
2454
- be = Er([
2455
- V(F.Rendered, be),
2456
- Ct(0, G),
2457
- Ct(1, U(O))
2458
- ], be);
2459
- var Lr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Nr = (n, e, t, r) => {
2460
- for (var s = r > 1 ? void 0 : r ? Ar(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2461
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2462
- return r && s && Lr(e, t, s), s;
2463
- }, Y = (n, e) => (t, r) => e(t, r, n);
2464
- let De = class extends W {
2465
- constructor(e, t, r, s, i, o, a) {
2434
+ Te = Er([
2435
+ V(F.Rendered, Te),
2436
+ Rt(0, H),
2437
+ Rt(1, U(O))
2438
+ ], Te);
2439
+ var Lr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Nr = (i, e, t, n) => {
2440
+ for (var r = n > 1 ? void 0 : n ? Ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2441
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2442
+ return n && r && Lr(e, t, r), r;
2443
+ }, q = (i, e) => (t, n) => e(t, n, i);
2444
+ let Pe = class extends W {
2445
+ constructor(e, t, n, r, s, o, a) {
2466
2446
  super();
2467
2447
  S(this, "_moveInObserver");
2468
2448
  S(this, "_moveOutObserver");
@@ -2470,7 +2450,7 @@ let De = class extends W {
2470
2450
  S(this, "_dblClickObserver");
2471
2451
  S(this, "_tripleClickObserver");
2472
2452
  S(this, "_loadedMap", /* @__PURE__ */ new Set());
2473
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = r, this._renderManagerService = s, this._textSelectionRenderManager = i, this._textSelectionManagerService = o, this._layoutService = a, this._renderManagerService.currentRender$.subscribe((c) => {
2453
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._layoutService = a, this._renderManagerService.currentRender$.subscribe((c) => {
2474
2454
  c != null && this._currentUniverService.getUniverDocInstance(c) != null && (this._loadedMap.has(c) || (this._initialMain(c), this._loadedMap.add(c)));
2475
2455
  }), this._initialize();
2476
2456
  }
@@ -2489,27 +2469,27 @@ let De = class extends W {
2489
2469
  const t = this._getDocObjectById(e);
2490
2470
  if (t == null)
2491
2471
  return;
2492
- const { document: r, scene: s } = t;
2493
- this._moveInObserver = r.onPointerEnterObserver.add(() => {
2494
- r.cursor = lt.TEXT;
2495
- }), this._moveOutObserver = r.onPointerLeaveObserver.add(() => {
2496
- r.cursor = lt.DEFAULT, s.resetCursor();
2497
- }), this._downObserver = r == null ? void 0 : r.onPointerDownObserver.add((i, o) => {
2498
- this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(i), i.button !== 2 && o.stopPropagation();
2499
- }), this._dblClickObserver = r == null ? void 0 : r.onDblclickObserver.add((i) => {
2500
- this._textSelectionRenderManager.handleDblClick(i);
2501
- }), this._tripleClickObserver = r == null ? void 0 : r.onTripleClickObserver.add((i) => {
2502
- this._textSelectionRenderManager.handleTripleClick(i);
2472
+ const { document: n, scene: r } = t;
2473
+ this._moveInObserver = n.onPointerEnterObserver.add(() => {
2474
+ n.cursor = dt.TEXT;
2475
+ }), this._moveOutObserver = n.onPointerLeaveObserver.add(() => {
2476
+ n.cursor = dt.DEFAULT, r.resetCursor();
2477
+ }), this._downObserver = n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
2478
+ this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(s), s.button !== 2 && o.stopPropagation();
2479
+ }), this._dblClickObserver = n == null ? void 0 : n.onDblclickObserver.add((s) => {
2480
+ this._textSelectionRenderManager.handleDblClick(s);
2481
+ }), this._tripleClickObserver = n == null ? void 0 : n.onTripleClickObserver.add((s) => {
2482
+ this._textSelectionRenderManager.handleTripleClick(s);
2503
2483
  });
2504
2484
  }
2505
2485
  _commandExecutedListener() {
2506
- const e = [Z.id];
2486
+ const e = [Y.id];
2507
2487
  this.disposeWithMe(
2508
2488
  this._commandService.onCommandExecuted((t) => {
2509
- var r;
2489
+ var n;
2510
2490
  if (e.includes(t.id)) {
2511
- const s = t.params, { unitId: i } = s, o = (r = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : r.unitId;
2512
- if (i !== o)
2491
+ const r = t.params, { unitId: s } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
2492
+ if (s !== o)
2513
2493
  return;
2514
2494
  this._textSelectionManagerService.refreshSelection();
2515
2495
  }
@@ -2520,11 +2500,11 @@ let De = class extends W {
2520
2500
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2521
2501
  if (e == null)
2522
2502
  return;
2523
- const { unitId: t, skeleton: r } = e, s = this._renderManagerService.getRenderById(t);
2524
- if (s == null)
2503
+ const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
2504
+ if (r == null)
2525
2505
  return;
2526
- const { scene: i, mainComponent: o } = s;
2527
- this._textSelectionRenderManager.changeRuntime(r, i, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2506
+ const { scene: s, mainComponent: o } = r;
2507
+ this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2528
2508
  unitId: t,
2529
2509
  subUnitId: ""
2530
2510
  });
@@ -2534,26 +2514,26 @@ let De = class extends W {
2534
2514
  return In(e, this._renderManagerService);
2535
2515
  }
2536
2516
  };
2537
- De = Nr([
2538
- V(F.Rendered, De),
2539
- Y(0, U(A)),
2540
- Y(1, O),
2541
- Y(2, x),
2542
- Y(3, G),
2543
- Y(4, fe),
2544
- Y(5, U(P)),
2545
- Y(6, Cn(Sn))
2546
- ], De);
2547
- var $r = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, jr = (n, e, t, r) => {
2548
- for (var s = r > 1 ? void 0 : r ? Br(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2549
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2550
- return r && s && $r(e, t, s), s;
2551
- }, le = (n, e) => (t, r) => e(t, r, n);
2552
- let Te = class extends W {
2553
- constructor(e, t, r, s, i) {
2517
+ Pe = Nr([
2518
+ V(F.Rendered, Pe),
2519
+ q(0, U(A)),
2520
+ q(1, O),
2521
+ q(2, x),
2522
+ q(3, H),
2523
+ q(4, _e),
2524
+ q(5, U(P)),
2525
+ q(6, Cn(Sn))
2526
+ ], Pe);
2527
+ var $r = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, jr = (i, e, t, n) => {
2528
+ for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2529
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2530
+ return n && r && $r(e, t, r), r;
2531
+ }, le = (i, e) => (t, n) => e(t, n, i);
2532
+ let Ee = class extends W {
2533
+ constructor(e, t, n, r, s) {
2554
2534
  super();
2555
2535
  S(this, "_initializedRender", /* @__PURE__ */ new Set());
2556
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = r, this._renderManagerService = s, this._textSelectionManagerService = i, this._initialize();
2536
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._initialize();
2557
2537
  }
2558
2538
  dispose() {
2559
2539
  super.dispose();
@@ -2565,25 +2545,25 @@ let Te = class extends W {
2565
2545
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2566
2546
  if (e == null)
2567
2547
  return;
2568
- const { unitId: t } = e, r = this._renderManagerService.getRenderById(t);
2569
- if (r == null || this._initializedRender.has(t) || [K, J].includes(t))
2548
+ const { unitId: t } = e, n = this._renderManagerService.getRenderById(t);
2549
+ if (n == null || this._initializedRender.has(t) || [Z, K].includes(t))
2570
2550
  return;
2571
2551
  this._initializedRender.add(t);
2572
- const { scene: s } = r;
2552
+ const { scene: r } = n;
2573
2553
  this.disposeWithMe(
2574
- Ge(
2575
- s.onMouseWheelObserver.add((i) => {
2576
- if (!i.ctrlKey)
2554
+ qe(
2555
+ r.onMouseWheelObserver.add((s) => {
2556
+ if (!s.ctrlKey)
2577
2557
  return;
2578
- const o = Math.abs(i.deltaX);
2558
+ const o = Math.abs(s.deltaX);
2579
2559
  let a = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
2580
- a *= i.deltaY > 0 ? -1 : 1, s.scaleX < 1 && (a /= 2);
2560
+ a *= s.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (a /= 2);
2581
2561
  const c = this._currentUniverService.getCurrentUniverDocInstance(), d = c.zoomRatio;
2582
2562
  let l = +parseFloat(`${d + a}`).toFixed(1);
2583
2563
  l = l >= 4 ? 4 : l <= 0.1 ? 0.1 : l, this._commandService.executeCommand(Bt.id, {
2584
2564
  zoomRatio: l,
2585
2565
  unitId: c.getUnitId()
2586
- }), i.preventDefault();
2566
+ }), s.preventDefault();
2587
2567
  })
2588
2568
  )
2589
2569
  );
@@ -2598,43 +2578,43 @@ let Te = class extends W {
2598
2578
  // }
2599
2579
  _skeletonListener() {
2600
2580
  this.disposeWithMe(
2601
- Ge(
2581
+ qe(
2602
2582
  this._docSkeletonManagerService.currentSkeletonBefore$.subscribe((e) => {
2603
2583
  if (e == null)
2604
2584
  return;
2605
- const r = this._currentUniverService.getCurrentUniverDocInstance().zoomRatio || 1;
2606
- this._updateViewZoom(r, !1);
2585
+ const n = this._currentUniverService.getCurrentUniverDocInstance().zoomRatio || 1;
2586
+ this._updateViewZoom(n, !1);
2607
2587
  })
2608
2588
  )
2609
2589
  );
2610
2590
  }
2611
2591
  _commandExecutedListener() {
2612
- const e = [Z.id];
2592
+ const e = [Y.id];
2613
2593
  this.disposeWithMe(
2614
2594
  this._commandService.onCommandExecuted((t) => {
2615
2595
  if (e.includes(t.id)) {
2616
- const r = this._currentUniverService.getCurrentUniverDocInstance(), s = t.params, { unitId: i } = s;
2617
- if (i !== r.getUnitId())
2596
+ const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId: s } = r;
2597
+ if (s !== n.getUnitId())
2618
2598
  return;
2619
- const o = r.zoomRatio || 1;
2599
+ const o = n.zoomRatio || 1;
2620
2600
  this._updateViewZoom(o);
2621
2601
  }
2622
2602
  })
2623
2603
  );
2624
2604
  }
2625
2605
  _updateViewZoom(e, t = !0) {
2626
- var s;
2627
- const r = this._getDocObject();
2628
- r != null && (r.scene.scale(e, e), this._calculatePagePosition(r, e), t && this._textSelectionManagerService.refreshSelection(), (s = r.scene.getTransformer()) == null || s.hideControl());
2606
+ var r;
2607
+ const n = this._getDocObject();
2608
+ n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
2629
2609
  }
2630
2610
  _calculatePagePosition(e, t) {
2631
- const { document: r, scene: s } = e, i = s == null ? void 0 : s.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = r;
2632
- if (i == null || o === 1 / 0 || a === 1 / 0)
2611
+ const { document: n, scene: r } = e, s = r == null ? void 0 : r.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
2612
+ if (s == null || o === 1 / 0 || a === 1 / 0)
2633
2613
  return;
2634
- const { width: l, height: h } = i;
2635
- let p = 0, u = 0, g = 0, m = 0, f = 1 / 0;
2636
- l > (o + c * 2) * t ? (p = l / 2 - o * t / 2, p /= t, g = (l - c * 2) / t, f = 0) : (p = c, g = o + c * 2, f = (g - l / t) / 2), h > a ? (u = h / 2 - a / 2, m = (h - d * 2) / t) : (u = d, m = a + d * 2), s.resize(g, m + 200), r.translate(p, u);
2637
- const v = s.getViewport(Ke.VIEW_MAIN);
2614
+ const { width: l, height: p } = s;
2615
+ let h = 0, u = 0, g = 0, m = 0, f = 1 / 0;
2616
+ l > (o + c * 2) * t ? (h = l / 2 - o * t / 2, h /= t, g = (l - c * 2) / t, f = 0) : (h = c, g = o + c * 2, f = (g - l / t) / 2), p > a ? (u = p / 2 - a / 2, m = (p - d * 2) / t) : (u = d, m = a + d * 2), r.resize(g, m + 200), n.translate(h, u);
2617
+ const v = r.getViewport(Je.VIEW_MAIN);
2638
2618
  if (f !== 1 / 0 && v != null) {
2639
2619
  const M = v.getBarScroll(f, 0).x;
2640
2620
  v.scrollTo({
@@ -2644,213 +2624,213 @@ let Te = class extends W {
2644
2624
  return this;
2645
2625
  }
2646
2626
  _getDocObject() {
2647
- return Le(this._currentUniverService, this._renderManagerService);
2627
+ return Ne(this._currentUniverService, this._renderManagerService);
2648
2628
  }
2649
2629
  };
2650
- Te = jr([
2651
- V(F.Rendered, Te),
2630
+ Ee = jr([
2631
+ V(F.Rendered, Ee),
2652
2632
  le(0, U(A)),
2653
2633
  le(1, O),
2654
2634
  le(2, x),
2655
- le(3, G),
2635
+ le(3, H),
2656
2636
  le(4, U(P))
2657
- ], Te);
2637
+ ], Ee);
2658
2638
  const Vr = {
2659
2639
  id: Pt.id,
2660
- preconditions: (n) => n.getContextValue(w),
2640
+ preconditions: (i) => i.getContextValue(w),
2661
2641
  binding: $.ENTER
2662
2642
  }, Fr = {
2663
2643
  id: Et.id,
2664
- preconditions: (n) => n.getContextValue(w),
2644
+ preconditions: (i) => i.getContextValue(w),
2665
2645
  binding: $.BACKSPACE
2666
2646
  }, kr = {
2667
2647
  id: Ut.id,
2668
- preconditions: (n) => n.getContextValue(w),
2648
+ preconditions: (i) => i.getContextValue(w),
2669
2649
  binding: $.DELETE
2670
2650
  }, zr = {
2671
- id: ee.id,
2651
+ id: Q.id,
2672
2652
  binding: $.ARROW_UP,
2673
- preconditions: (n) => n.getContextValue(w),
2653
+ preconditions: (i) => i.getContextValue(w),
2674
2654
  staticParameters: {
2675
2655
  direction: b.UP
2676
2656
  }
2677
2657
  }, Wr = {
2678
- id: ee.id,
2658
+ id: Q.id,
2679
2659
  binding: $.ARROW_DOWN,
2680
- preconditions: (n) => n.getContextValue(w),
2660
+ preconditions: (i) => i.getContextValue(w),
2681
2661
  staticParameters: {
2682
2662
  direction: b.DOWN
2683
2663
  }
2684
2664
  }, Hr = {
2685
- id: ee.id,
2665
+ id: Q.id,
2686
2666
  binding: $.ARROW_LEFT,
2687
- preconditions: (n) => n.getContextValue(w),
2667
+ preconditions: (i) => i.getContextValue(w),
2688
2668
  staticParameters: {
2689
2669
  direction: b.LEFT
2690
2670
  }
2691
2671
  }, Gr = {
2692
- id: ee.id,
2672
+ id: Q.id,
2693
2673
  binding: $.ARROW_RIGHT,
2694
- preconditions: (n) => n.getContextValue(w),
2674
+ preconditions: (i) => i.getContextValue(w),
2695
2675
  staticParameters: {
2696
2676
  direction: b.RIGHT
2697
2677
  }
2698
2678
  }, Xr = {
2699
- id: te.id,
2700
- binding: $.ARROW_UP | _e.SHIFT,
2701
- preconditions: (n) => n.getContextValue(w),
2679
+ id: ee.id,
2680
+ binding: $.ARROW_UP | ve.SHIFT,
2681
+ preconditions: (i) => i.getContextValue(w),
2702
2682
  staticParameters: {
2703
2683
  direction: b.UP
2704
2684
  }
2705
2685
  }, qr = {
2706
- id: te.id,
2707
- binding: $.ARROW_DOWN | _e.SHIFT,
2708
- preconditions: (n) => n.getContextValue(w),
2686
+ id: ee.id,
2687
+ binding: $.ARROW_DOWN | ve.SHIFT,
2688
+ preconditions: (i) => i.getContextValue(w),
2709
2689
  staticParameters: {
2710
2690
  direction: b.DOWN
2711
2691
  }
2712
2692
  }, Yr = {
2713
- id: te.id,
2714
- binding: $.ARROW_LEFT | _e.SHIFT,
2715
- preconditions: (n) => n.getContextValue(w),
2693
+ id: ee.id,
2694
+ binding: $.ARROW_LEFT | ve.SHIFT,
2695
+ preconditions: (i) => i.getContextValue(w),
2716
2696
  staticParameters: {
2717
2697
  direction: b.LEFT
2718
2698
  }
2719
2699
  }, Zr = {
2720
- id: te.id,
2721
- binding: $.ARROW_RIGHT | _e.SHIFT,
2722
- preconditions: (n) => n.getContextValue(w),
2700
+ id: ee.id,
2701
+ binding: $.ARROW_RIGHT | ve.SHIFT,
2702
+ preconditions: (i) => i.getContextValue(w),
2723
2703
  staticParameters: {
2724
2704
  direction: b.RIGHT
2725
2705
  }
2726
2706
  }, Kr = {
2727
2707
  id: jt.id,
2728
- binding: $.A | _e.CTRL_COMMAND,
2729
- preconditions: (n) => n.getContextValue(w) || n.getContextValue(me)
2708
+ binding: $.A | ve.CTRL_COMMAND,
2709
+ preconditions: (i) => i.getContextValue(w) || i.getContextValue(fe)
2730
2710
  };
2731
- var Jr = Object.defineProperty, Qr = Object.getOwnPropertyDescriptor, es = (n, e, t, r) => {
2732
- for (var s = r > 1 ? void 0 : r ? Qr(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2733
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2734
- return r && s && Jr(e, t, s), s;
2735
- }, Se = (n, e) => (t, r) => e(t, r, n);
2736
- let Pe = class extends Ze {
2737
- constructor(e, t, r, s) {
2711
+ var Jr = Object.defineProperty, Qr = Object.getOwnPropertyDescriptor, ei = (i, e, t, n) => {
2712
+ for (var r = n > 1 ? void 0 : n ? Qr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2713
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2714
+ return n && r && Jr(e, t, r), r;
2715
+ }, Me = (i, e) => (t, n) => e(t, n, i);
2716
+ let Ue = class extends me {
2717
+ constructor(e, t, n, r) {
2738
2718
  super();
2739
2719
  S(this, "_scene");
2740
2720
  S(this, "_currentDocumentModel");
2741
2721
  S(this, "_loadedMap", /* @__PURE__ */ new Set());
2742
2722
  S(this, "_fps$", new de(""));
2743
2723
  S(this, "fps$", this._fps$.asObservable());
2744
- this._renderManagerService = e, this._configService = t, this._currentUniverService = r, this._docViewModelManagerService = s, this._initialize();
2724
+ this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._docViewModelManagerService = r, this._initialize();
2745
2725
  }
2746
2726
  _initialize() {
2747
- this._currentUniverService.currentDoc$.subscribe((e) => {
2727
+ this._currentUniverService.currentDoc$.pipe(Se(this.dispose$)).subscribe((e) => {
2748
2728
  if (e == null)
2749
2729
  return;
2750
2730
  this._currentDocumentModel = e;
2751
2731
  const t = e.getUnitId();
2752
- this._docViewModelManagerService.setCurrent(t), this._loadedMap.has(t) || (this._addNewRender(), this._loadedMap.add(t));
2732
+ this._loadedMap.has(t) || (this._addNewRender(), this._loadedMap.add(t));
2753
2733
  });
2754
2734
  }
2755
2735
  dispose() {
2756
2736
  this._fps$.complete();
2757
2737
  }
2758
2738
  _addNewRender() {
2759
- const e = this._currentDocumentModel, t = e.getUnitId(), r = e.getContainer(), s = e.getParentRenderUnitId();
2760
- if (r != null && s != null)
2739
+ const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), r = e.getParentRenderUnitId();
2740
+ if (n != null && r != null)
2761
2741
  throw new Error("container or parentRenderUnitId can only exist one");
2762
- r == null && s != null ? this._renderManagerService.createRenderWithParent(t, s) : this._renderManagerService.createRender(t);
2763
- const i = this._renderManagerService.getRenderById(t);
2764
- if (i == null)
2742
+ n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
2743
+ const s = this._renderManagerService.getRenderById(t);
2744
+ if (s == null)
2765
2745
  return;
2766
- const { scene: o, engine: a } = i;
2746
+ const { scene: o, engine: a } = s;
2767
2747
  o.openTransformer(), this._scene = o;
2768
- const c = new an(Ke.VIEW_MAIN, o, {
2748
+ const c = new an(Je.VIEW_MAIN, o, {
2769
2749
  left: 0,
2770
2750
  top: 0,
2771
2751
  bottom: 0,
2772
2752
  right: 0,
2773
2753
  isWheelPreventDefaultX: !0
2774
2754
  });
2775
- o.addViewport(c).attachControl(), o.on(cn.wheel, (h, p) => {
2776
- const u = h;
2755
+ o.attachControl(), o.on(cn.wheel, (p, h) => {
2756
+ const u = p;
2777
2757
  if (u.ctrlKey) {
2778
2758
  const g = Math.abs(u.deltaX);
2779
2759
  let m = g < 40 ? 0.2 : g < 80 ? 0.4 : 0.2;
2780
2760
  m *= u.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (m /= 2), o.scaleX + m > 4 ? o.scale(4, 4) : o.scaleX + m < 0.1 ? o.scale(0.1, 0.1) : u.preventDefault();
2781
2761
  } else
2782
- c.onMouseWheel(u, p);
2783
- }), this._configService.getConfig("hasScroll") !== !1 && t !== J && new ln(c), o.addLayer(
2784
- new dt(o, [], ut),
2785
- new dt(o, [], xn)
2786
- ), this._addComponent(i), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
2762
+ c.onMouseWheel(u, h);
2763
+ }), this._configService.getConfig("hasScroll") !== !1 && t !== K && new ln(c), o.addLayer(
2764
+ new ut(o, [], ht),
2765
+ new ut(o, [], xn)
2766
+ ), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
2787
2767
  o.render(), this._fps$.next(Math.round(a.getFps()).toString());
2788
2768
  }), this._renderManagerService.setCurrent(t);
2789
2769
  }
2790
2770
  _addComponent(e) {
2791
- const t = this._scene, r = this._currentDocumentModel, s = new dn(Xe.MAIN, void 0, {
2792
- pageMarginLeft: r.documentStyle.marginLeft || 0,
2793
- pageMarginTop: r.documentStyle.marginTop || 0
2771
+ const t = this._scene, n = this._currentDocumentModel, r = new dn(Ye.MAIN, void 0, {
2772
+ pageMarginLeft: n.documentStyle.marginLeft || 0,
2773
+ pageMarginTop: n.documentStyle.marginTop || 0
2794
2774
  });
2795
- s.zIndex = On, e.mainComponent = s, e.components.set(Xe.MAIN, s), t.addObjects([s], ut);
2775
+ r.zIndex = On, e.mainComponent = r, e.components.set(Ye.MAIN, r), t.addObjects([r], ht);
2796
2776
  }
2797
2777
  };
2798
- Pe = es([
2799
- V(F.Ready, Pe),
2800
- Se(0, G),
2801
- Se(1, yt),
2802
- Se(2, O),
2803
- Se(3, U(se))
2804
- ], Pe);
2805
- var ts = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, rs = (n, e, t, r) => {
2806
- for (var s = r > 1 ? void 0 : r ? ns(e, t) : e, i = n.length - 1, o; i >= 0; i--)
2807
- (o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
2808
- return r && s && ts(e, t, s), s;
2809
- }, ve = (n, e) => (t, r) => e(t, r, n);
2810
- const ss = {
2778
+ Ue = ei([
2779
+ V(F.Ready, Ue),
2780
+ Me(0, H),
2781
+ Me(1, bt),
2782
+ Me(2, O),
2783
+ Me(3, U(ie))
2784
+ ], Ue);
2785
+ var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (i, e, t, n) => {
2786
+ for (var r = n > 1 ? void 0 : n ? ni(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2787
+ (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2788
+ return n && r && ti(e, t, r), r;
2789
+ }, Ce = (i, e) => (t, n) => e(t, n, i);
2790
+ const ii = {
2811
2791
  hasScroll: !0
2812
- }, is = "docs";
2813
- var We;
2814
- let Rt = (We = class extends Yt {
2815
- constructor(e = {}, t, r, s, i) {
2816
- super(is);
2792
+ }, si = "docs";
2793
+ var Ge;
2794
+ let It = (Ge = class extends Yt {
2795
+ constructor(e = {}, t, n, r, s) {
2796
+ super(si);
2817
2797
  S(this, "_config");
2818
- this._injector = t, this._localeService = r, this._configService = s, this._currentUniverService = i, this._config = Object.assign(ss, e), this._initializeDependencies(t), this._initializeCommands();
2798
+ this._injector = t, this._localeService = n, this._configService = r, this._currentUniverService = s, this._config = Object.assign(ii, e), this._initializeDependencies(t), this._initializeCommands();
2819
2799
  }
2820
2800
  initialize() {
2821
2801
  }
2822
2802
  _initializeCommands() {
2823
2803
  [
2804
+ Q,
2824
2805
  ee,
2825
- te,
2826
2806
  Et,
2827
2807
  Ut,
2828
2808
  ue,
2829
- Ne,
2830
- $e,
2831
2809
  Be,
2832
- Q,
2833
- ie,
2810
+ je,
2811
+ Ve,
2812
+ J,
2813
+ se,
2834
2814
  he,
2835
2815
  pe,
2836
- je,
2816
+ Fe,
2837
2817
  Nt,
2838
2818
  Pt,
2839
- Je,
2840
2819
  Qe,
2820
+ et,
2841
2821
  Tt,
2842
2822
  Lt,
2843
- et,
2823
+ tt,
2844
2824
  _,
2845
2825
  Wn,
2846
2826
  Hn,
2847
2827
  Bt,
2848
- Z,
2828
+ Y,
2849
2829
  Dt,
2850
2830
  jt,
2851
2831
  kn,
2852
2832
  Fn,
2853
- nt
2833
+ rt
2854
2834
  ].forEach((e) => {
2855
2835
  this._injector.get(x).registerCommand(e);
2856
2836
  }), [
@@ -2880,66 +2860,66 @@ let Rt = (We = class extends Yt {
2880
2860
  // { useFactory: () => docInjector.createInstance(CanvasView, this._config.standalone ?? true) },
2881
2861
  // ], // FIXME: CanvasView shouldn't be a dependency of UniverDocs. Because it maybe created dynamically.
2882
2862
  //views
2883
- [Pe],
2863
+ [Ue],
2884
2864
  // services
2885
2865
  [A],
2886
- [se],
2887
- [tt],
2866
+ [ie],
2867
+ [nt],
2888
2868
  [
2889
2869
  Vt,
2890
2870
  {
2891
- useClass: Ye
2871
+ useClass: Ke
2892
2872
  }
2893
2873
  ],
2894
2874
  [
2895
- fe,
2875
+ _e,
2896
2876
  {
2897
2877
  useClass: un
2898
2878
  }
2899
2879
  ],
2900
2880
  [P],
2901
2881
  // controllers
2902
- [Ce],
2903
- [be],
2904
- [De],
2905
- [ye],
2906
2882
  [Ie],
2907
- [xe],
2908
- [Me],
2909
- [Oe],
2910
2883
  [Te],
2911
- [Re]
2884
+ [Pe],
2885
+ [De],
2886
+ [Oe],
2887
+ [ye],
2888
+ [Re],
2889
+ [be],
2890
+ [Ee],
2891
+ [xe]
2912
2892
  ].forEach((t) => e.add(t));
2913
2893
  }
2914
- }, S(We, "type", Zt.Doc), We);
2915
- Rt = rs([
2916
- ve(1, U(Rn)),
2917
- ve(2, U(It)),
2918
- ve(3, yt),
2919
- ve(4, O)
2920
- ], Rt);
2894
+ }, S(Ge, "type", Zt.Doc), Ge);
2895
+ It = ri([
2896
+ Ce(1, U(Rn)),
2897
+ Ce(2, U(xt)),
2898
+ Ce(3, bt),
2899
+ Ce(4, O)
2900
+ ], It);
2921
2901
  export {
2922
2902
  Pt as BreakLineCommand,
2923
2903
  Fn as BulletListCommand,
2924
2904
  Hn as CoverContentCommand,
2925
2905
  On as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2926
2906
  xn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2927
- ut as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2928
- Xe as DOCS_VIEW_KEY,
2929
- Qe as DeleteCommand,
2907
+ ht as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2908
+ Ye as DOCS_VIEW_KEY,
2909
+ et as DeleteCommand,
2930
2910
  Et as DeleteLeftCommand,
2931
2911
  Ut as DeleteRightCommand,
2932
- Pe as DocCanvasView,
2933
- Ve as DocCopyCommand,
2934
- Fe as DocCutCommand,
2935
- ke as DocPasteCommand,
2912
+ Ue as DocCanvasView,
2913
+ ke as DocCopyCommand,
2914
+ ze as DocCutCommand,
2915
+ We as DocPasteCommand,
2936
2916
  A as DocSkeletonManagerService,
2937
- se as DocViewModelManagerService,
2917
+ ie as DocViewModelManagerService,
2938
2918
  Lt as IMEInputCommand,
2939
- Je as InsertCommand,
2940
- ee as MoveCursorOperation,
2941
- te as MoveSelectionOperation,
2942
- hs as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2919
+ Qe as InsertCommand,
2920
+ Q as MoveCursorOperation,
2921
+ ee as MoveSelectionOperation,
2922
+ hi as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2943
2923
  kn as OrderListCommand,
2944
2924
  Wn as ReplaceContentCommand,
2945
2925
  _ as RichTextEditingMutation,
@@ -2947,16 +2927,16 @@ export {
2947
2927
  Nt as SetInlineFormatCommand,
2948
2928
  pe as SetInlineFormatFontFamilyCommand,
2949
2929
  he as SetInlineFormatFontSizeCommand,
2950
- Ne as SetInlineFormatItalicCommand,
2951
- Be as SetInlineFormatStrikethroughCommand,
2952
- Q as SetInlineFormatSubscriptCommand,
2953
- ie as SetInlineFormatSuperscriptCommand,
2954
- je as SetInlineFormatTextColorCommand,
2955
- $e as SetInlineFormatUnderlineCommand,
2930
+ Be as SetInlineFormatItalicCommand,
2931
+ Ve as SetInlineFormatStrikethroughCommand,
2932
+ J as SetInlineFormatSubscriptCommand,
2933
+ se as SetInlineFormatSuperscriptCommand,
2934
+ Fe as SetInlineFormatTextColorCommand,
2935
+ je as SetInlineFormatUnderlineCommand,
2956
2936
  Dt as SetTextSelectionsOperation,
2957
2937
  P as TextSelectionManagerService,
2958
- Rt as UniverDocsPlugin,
2938
+ It as UniverDocsPlugin,
2959
2939
  Tt as UpdateCommand,
2960
- Ke as VIEWPORT_KEY,
2961
- Le as getDocObject
2940
+ Je as VIEWPORT_KEY,
2941
+ Ne as getDocObject
2962
2942
  };