@univerjs/docs 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +478 -487
  3. package/lib/types/basics/component-tools.d.ts +2 -1
  4. package/lib/types/basics/docs-view-key.d.ts +5 -3
  5. package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +1 -1
  6. package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +1 -1
  7. package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
  8. package/lib/types/commands/commands/core-editing.command.d.ts +1 -1
  9. package/lib/types/commands/commands/delete.command.d.ts +2 -2
  10. package/lib/types/commands/commands/list.command.d.ts +1 -1
  11. package/lib/types/commands/commands/replace-content.command.d.ts +1 -1
  12. package/lib/types/commands/commands/set-floating-object-transform.command.d.ts +3 -3
  13. package/lib/types/commands/mutations/core-editing.mutation.d.ts +1 -1
  14. package/lib/types/commands/mutations/insert-floating-object.mutation.d.ts +1 -1
  15. package/lib/types/commands/mutations/remove-floating-object.mutation.d.ts +1 -1
  16. package/lib/types/commands/mutations/set-floating-object.mutation.d.ts +3 -3
  17. package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +1 -1
  18. package/lib/types/commands/operations/text-selection.operation.d.ts +1 -1
  19. package/lib/types/controllers/ime-input.controller.d.ts +3 -3
  20. package/lib/types/controllers/move-cursor.controller.d.ts +3 -4
  21. package/lib/types/controllers/normal-input.controller.d.ts +3 -5
  22. package/lib/types/doc-plugin.d.ts +2 -5
  23. package/lib/types/services/doc-skeleton-manager.service.d.ts +2 -2
  24. package/lib/types/services/doc-state-change-manager.service.d.ts +1 -1
  25. package/lib/types/services/doc-view-model-manager.service.d.ts +1 -1
  26. package/lib/types/services/ime-input-manager.service.d.ts +3 -3
  27. package/lib/types/services/text-selection-manager.service.d.ts +1 -1
  28. package/lib/umd/index.js +1 -1
  29. package/package.json +10 -10
package/lib/es/index.js CHANGED
@@ -1,61 +1,64 @@
1
1
  var yt = Object.defineProperty;
2
- var Ot = (s, e, t) => e in s ? yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var x = (s, e, t) => (Ot(s, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { UniverInstanceType as W, CommandType as v, RxDisposable as ge, ICommandService as I, TextXActionType as y, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as dt, IUniverInstanceService as E, IUndoRedoService as Te, UndoCommandId as Xe, RedoCommandId as Ye, TextX as P, DataStreamTreeTokenType as xe, Tools as Q, LocaleService as Tt, MemoryCursor as oe, getDocsUpdateBody as Et, UpdateDocsAttributeType as Ee, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Dt, BooleanNumber as k, BaselineOffset as j, PRESET_LIST_TYPE as At, PresetListType as ut, HorizontalAlign as re, OnLifecycle as De, LifecycleStages as Ae, Disposable as Ne, Direction as N, Plugin as Nt } from "@univerjs/core";
5
- import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as bt, ITextSelectionRenderManager as fe, DocumentViewModel as Pt, DocumentSkeleton as Ut, hasListGlyph as wt, isIndentByGlyph as Lt, isFirstGlyph as Bt, getParagraphByGlyph as Ft, getCharSpaceApply as $t, getNumberUnitValue as Me, RANGE_DIRECTION as We, NodePositionConvertToCursor as Ze, IRenderManagerService as mt, TextSelectionRenderManager as Vt } from "@univerjs/engine-render";
2
+ var Ot = (o, e, t) => e in o ? yt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var y = (o, e, t) => (Ot(o, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { UniverInstanceType as W, CommandType as v, RxDisposable as ge, ICommandService as I, TextXActionType as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ut, IUniverInstanceService as E, IUndoRedoService as Te, UndoCommandId as Ye, RedoCommandId as We, TextX as b, DataStreamTreeTokenType as xe, Tools as Q, LocaleService as Tt, MemoryCursor as se, getDocsUpdateBody as Et, UpdateDocsAttributeType as Ee, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Dt, BooleanNumber as z, BaselineOffset as G, PRESET_LIST_TYPE as At, PresetListType as mt, HorizontalAlign as re, OnLifecycle as De, LifecycleStages as Ae, Disposable as Ne, Direction as N, Plugin as Nt } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as fe, DocumentViewModel as bt, DocumentSkeleton as Ut, hasListGlyph as wt, isIndentByGlyph as Lt, isFirstGlyph as Bt, getParagraphByGlyph as Ft, getCharSpaceApply as $t, getNumberUnitValue as Me, RANGE_DIRECTION as Ze, NodePositionConvertToCursor as Ke, IRenderManagerService as gt, TextSelectionRenderManager as Vt } from "@univerjs/engine-render";
6
6
  import { BehaviorSubject as ee, takeUntil as te } from "rxjs";
7
- import { Inject as V, Injector as zt } from "@wendellhu/redi";
8
- function gt(s, e) {
9
- const t = s.getCurrentUnitForType(W.UNIVER_DOC);
7
+ import { Inject as V, Injector as kt } from "@wendellhu/redi";
8
+ var Pe = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(Pe || {}), zt = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(zt || {});
9
+ const Gn = 0, jn = 2, Hn = 4, Xn = 10, Yn = "normalTextSelectionPluginName";
10
+ function Gt(o, e) {
11
+ const t = o.getCurrentUnitForType(W.UNIVER_DOC);
10
12
  if (!t)
11
13
  return null;
12
- const n = t.getUnitId(), o = e.getRenderById(n);
13
- if (o == null)
14
+ const n = t.getUnitId(), s = e.getRenderById(n);
15
+ if (s == null)
14
16
  return;
15
- const { mainComponent: r, scene: i, engine: a } = o;
17
+ const { mainComponent: r, scene: i, engine: a, components: c } = s, d = r, l = c.get(Pe.BACKGROUND);
16
18
  return {
17
- document: r,
19
+ document: d,
20
+ docBackground: l,
18
21
  scene: i,
19
22
  engine: a
20
23
  };
21
24
  }
22
- function Gn(s, e) {
23
- const t = e.getRenderById(s);
25
+ function Wn(o, e) {
26
+ const t = e.getRenderById(o);
24
27
  if (t == null)
25
28
  return;
26
- const { mainComponent: n, scene: o, engine: r } = t;
29
+ const { mainComponent: n, scene: s, engine: r, components: i } = t, a = n, c = i.get(Pe.BACKGROUND);
27
30
  return {
28
- document: n,
29
- scene: o,
31
+ document: a,
32
+ docBackground: c,
33
+ scene: s,
30
34
  engine: r
31
35
  };
32
36
  }
33
- var kt = /* @__PURE__ */ ((s) => (s.MAIN = "__Document_Render_Main__", s))(kt || {}), jt = /* @__PURE__ */ ((s) => (s.VIEW_MAIN = "viewMain", s.VIEW_TOP = "viewTop", s.VIEW_LEFT = "viewLeft", s.VIEW_LEFT_TOP = "viewLeftTop", s))(jt || {});
34
- const Hn = 0, Xn = 2, Yn = 10, Wn = "normalTextSelectionPluginName", ft = {
37
+ const ft = {
35
38
  id: "doc.operation.set-selections",
36
39
  type: v.OPERATION,
37
- handler: (s, e) => !0
40
+ handler: (o, e) => !0
38
41
  };
39
- var Gt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Xt = (s, e, t, n) => {
40
- for (var o = n > 1 ? void 0 : n ? Ht(e, t) : e, r = s.length - 1, i; r >= 0; r--)
41
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
42
- return n && o && Gt(e, t, o), o;
43
- }, Je = (s, e) => (t, n) => e(t, n, s);
44
- function Z(s) {
45
- const { startOffset: e, endOffset: t, collapsed: n } = s, o = {
42
+ var jt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Xt = (o, e, t, n) => {
43
+ for (var s = n > 1 ? void 0 : n ? Ht(e, t) : e, r = o.length - 1, i; r >= 0; r--)
44
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
45
+ return n && s && jt(e, t, s), s;
46
+ }, Je = (o, e) => (t, n) => e(t, n, o);
47
+ function Z(o) {
48
+ const { startOffset: e, endOffset: t, collapsed: n } = o, s = {
46
49
  startOffset: e,
47
50
  endOffset: t,
48
51
  collapsed: n
49
52
  };
50
- return typeof s.isActive == "function" && (o.isActive = s.isActive()), o;
53
+ return typeof o.isActive == "function" && (s.isActive = o.isActive()), s;
51
54
  }
52
55
  let T = class extends ge {
53
56
  constructor(e, t) {
54
57
  super();
55
- x(this, "_currentSelection", null);
56
- x(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
57
- x(this, "_textSelection$", new ee(null));
58
- x(this, "textSelection$", this._textSelection$.asObservable());
58
+ y(this, "_currentSelection", null);
59
+ y(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
60
+ y(this, "_textSelection$", new ee(null));
61
+ y(this, "textSelection$", this._textSelection$.asObservable());
59
62
  this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
60
63
  }
61
64
  getCurrentSelection() {
@@ -86,7 +89,7 @@ let T = class extends ge {
86
89
  const e = this._getTextRanges(this._currentSelection);
87
90
  if (e == null)
88
91
  return;
89
- const { textRanges: t, segmentId: n, style: o } = e, r = t.find((m) => m.isActive());
92
+ const { textRanges: t, segmentId: n, style: s } = e, r = t.find((m) => m.isActive());
90
93
  if (r == null)
91
94
  return null;
92
95
  const { startOffset: i, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: u } = r;
@@ -98,7 +101,7 @@ let T = class extends ge {
98
101
  endNodePosition: l,
99
102
  direction: u,
100
103
  segmentId: n,
101
- style: o
104
+ style: s
102
105
  };
103
106
  }
104
107
  // **Only used in test case** because this does not go through the render layer.
@@ -108,7 +111,7 @@ let T = class extends ge {
108
111
  textRanges: e,
109
112
  segmentId: "",
110
113
  isEditing: t,
111
- style: bt
114
+ style: Pt
112
115
  // mock style.
113
116
  });
114
117
  }
@@ -129,10 +132,10 @@ let T = class extends ge {
129
132
  ...e
130
133
  };
131
134
  this._replaceByParam(t), this._textSelection$.next(t);
132
- const { unitId: n, subUnitId: o, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
135
+ const { unitId: n, subUnitId: s, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
133
136
  this._commandService.executeCommand(ft.id, {
134
137
  unitId: n,
135
- subUnitId: o,
138
+ subUnitId: s,
136
139
  segmentId: r,
137
140
  style: i,
138
141
  isEditing: c,
@@ -140,55 +143,55 @@ let T = class extends ge {
140
143
  });
141
144
  }
142
145
  _getTextRanges(e) {
143
- var o;
146
+ var s;
144
147
  if (e == null)
145
148
  return;
146
149
  const { unitId: t, subUnitId: n = "" } = e;
147
- return (o = this._textSelectionInfo.get(t)) == null ? void 0 : o.get(n);
150
+ return (s = this._textSelectionInfo.get(t)) == null ? void 0 : s.get(n);
148
151
  }
149
152
  _refresh(e) {
150
153
  const t = this._getTextRanges(e);
151
154
  this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(Z));
152
155
  }
153
156
  _replaceByParam(e) {
154
- const { unitId: t, subUnitId: n, style: o, segmentId: r, textRanges: i, isEditing: a } = e;
155
- this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: i, style: o, segmentId: r, isEditing: a });
157
+ const { unitId: t, subUnitId: n, style: s, segmentId: r, textRanges: i, isEditing: a } = e;
158
+ this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: i, style: s, segmentId: r, isEditing: a });
156
159
  }
157
160
  _addByParam(e) {
158
- const { unitId: t, subUnitId: n, textRanges: o, style: r, segmentId: i, isEditing: a } = e;
161
+ const { unitId: t, subUnitId: n, textRanges: s, style: r, segmentId: i, isEditing: a } = e;
159
162
  this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
160
163
  const c = this._textSelectionInfo.get(t);
161
- c.has(n) ? c.get(n).textRanges.push(...o) : c.set(n, { textRanges: o, style: r, segmentId: i, isEditing: a });
164
+ c.has(n) ? c.get(n).textRanges.push(...s) : c.set(n, { textRanges: s, style: r, segmentId: i, isEditing: a });
162
165
  }
163
166
  };
164
167
  T = Xt([
165
168
  Je(0, fe),
166
169
  Je(1, I)
167
170
  ], T);
168
- function be(s, e = "", t = 0) {
169
- const { startOffset: n, endOffset: o } = s, r = [], i = n - t, a = o - t;
171
+ function be(o, e = "", t = 0) {
172
+ const { startOffset: n, endOffset: s } = o, r = [], i = n - t, a = s - t;
170
173
  return i > 0 && r.push({
171
- t: y.RETAIN,
174
+ t: x.RETAIN,
172
175
  len: i,
173
176
  segmentId: e
174
177
  }), r.push({
175
- t: y.DELETE,
178
+ t: x.DELETE,
176
179
  len: a - i,
177
180
  line: 0,
178
181
  segmentId: e
179
182
  }), r;
180
183
  }
181
- var Yt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
182
- for (var o = n > 1 ? void 0 : n ? Wt(e, t) : e, r = s.length - 1, i; r >= 0; r--)
183
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
184
- return n && o && Yt(e, t, o), o;
185
- }, Jt = (s, e) => (t, n) => e(t, n, s);
184
+ var Yt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (o, e, t, n) => {
185
+ for (var s = n > 1 ? void 0 : n ? Wt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
186
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
187
+ return n && s && Yt(e, t, s), s;
188
+ }, Kt = (o, e) => (t, n) => e(t, n, o);
186
189
  let ne = class extends ge {
187
190
  constructor(e) {
188
191
  super();
189
- x(this, "_docViewModelMap", /* @__PURE__ */ new Map());
190
- x(this, "_currentDocViewModel$", new ee(null));
191
- x(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
192
+ y(this, "_docViewModelMap", /* @__PURE__ */ new Map());
193
+ y(this, "_currentDocViewModel$", new ee(null));
194
+ y(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
192
195
  this._univerInstanceService = e, this._initialize();
193
196
  }
194
197
  _initialize() {
@@ -226,41 +229,41 @@ let ne = class extends ge {
226
229
  throw new Error(`Document data model with id ${e} not found when build view model.`);
227
230
  if (t.getBody() != null) {
228
231
  if (!this._docViewModelMap.has(e)) {
229
- const o = this._buildDocViewModel(t);
232
+ const s = this._buildDocViewModel(t);
230
233
  this._docViewModelMap.set(e, {
231
234
  unitId: e,
232
- docViewModel: o
235
+ docViewModel: s
233
236
  });
234
237
  }
235
- if (e === dt) {
236
- const o = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
237
- if (o == null)
238
+ if (e === ut) {
239
+ const s = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
240
+ if (s == null)
238
241
  return;
239
- o.reset(t);
242
+ s.reset(t);
240
243
  }
241
244
  this._currentDocViewModel$.next(this._docViewModelMap.get(e));
242
245
  }
243
246
  }
244
247
  _buildDocViewModel(e) {
245
- return new Pt(e);
248
+ return new bt(e);
246
249
  }
247
250
  };
248
251
  ne = Zt([
249
- Jt(0, E)
252
+ Kt(0, E)
250
253
  ], ne);
251
- var qt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Qt = (s, e, t, n) => {
252
- for (var o = n > 1 ? void 0 : n ? Kt(e, t) : e, r = s.length - 1, i; r >= 0; r--)
253
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
254
- return n && o && qt(e, t, o), o;
255
- }, Ce = (s, e) => (t, n) => e(t, n, s);
254
+ var Jt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Qt = (o, e, t, n) => {
255
+ for (var s = n > 1 ? void 0 : n ? qt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
256
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
257
+ return n && s && Jt(e, t, s), s;
258
+ }, Ce = (o, e) => (t, n) => e(t, n, o);
256
259
  const en = 300;
257
260
  let me = class extends ge {
258
261
  constructor(e, t, n) {
259
262
  super();
260
- x(this, "_docStateChange$", new ee(null));
261
- x(this, "docStateChange$", this._docStateChange$.asObservable());
262
- x(this, "_stateCache", /* @__PURE__ */ new Map());
263
- x(this, "_timer", null);
263
+ y(this, "_docStateChange$", new ee(null));
264
+ y(this, "docStateChange$", this._docStateChange$.asObservable());
265
+ y(this, "_stateCache", /* @__PURE__ */ new Map());
266
+ y(this, "_timer", null);
264
267
  this._undoRedoService = e, this._commandService = t, this._univerInstanceService = n, this._initialize();
265
268
  }
266
269
  setChangeState(e) {
@@ -270,7 +273,7 @@ let me = class extends ge {
270
273
  _initialize() {
271
274
  this.disposeWithMe(
272
275
  this._commandService.beforeCommandExecuted((e) => {
273
- if (e.id === Xe || e.id === Ye) {
276
+ if (e.id === Ye || e.id === We) {
274
277
  const t = this._univerInstanceService.getCurrentUniverDocInstance();
275
278
  if (t == null)
276
279
  return;
@@ -281,8 +284,8 @@ let me = class extends ge {
281
284
  );
282
285
  }
283
286
  _cacheChangeState(e) {
284
- const { trigger: t, unitId: n, noHistory: o } = e;
285
- if (!(t === Ye || t === Xe || o)) {
287
+ const { trigger: t, unitId: n, noHistory: s } = e;
288
+ if (!(t === We || t === Ye || s)) {
286
289
  if (this._stateCache.has(n)) {
287
290
  const r = this._stateCache.get(n);
288
291
  r == null || r.push(e);
@@ -297,14 +300,14 @@ let me = class extends ge {
297
300
  const t = this._undoRedoService, n = this._stateCache.get(e);
298
301
  if (!Array.isArray(n) || n.length === 0)
299
302
  return;
300
- const o = n.length, r = n[0].commandId, i = n[0], a = n[o - 1], c = {
303
+ const s = n.length, r = n[0].commandId, i = n[0], a = n[s - 1], c = {
301
304
  unitId: e,
302
- actions: n.reduce((l, u) => P.compose(l, u.redoState.actions), []),
305
+ actions: n.reduce((l, u) => b.compose(l, u.redoState.actions), []),
303
306
  textRanges: a.redoState.textRanges
304
307
  }, d = {
305
308
  unitId: e,
306
309
  // Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
307
- actions: n.reverse().reduce((l, u) => P.compose(l, u.undoState.actions), []),
310
+ actions: n.reverse().reduce((l, u) => b.compose(l, u.undoState.actions), []),
308
311
  textRanges: i.undoState.textRanges
309
312
  };
310
313
  t.pushUndoRedo({
@@ -321,9 +324,9 @@ me = Qt([
321
324
  ], me);
322
325
  class he {
323
326
  constructor() {
324
- x(this, "_previousActiveRange", null);
325
- x(this, "_undoMutationParamsCache", []);
326
- x(this, "_redoMutationParamsCache", []);
327
+ y(this, "_previousActiveRange", null);
328
+ y(this, "_undoMutationParamsCache", []);
329
+ y(this, "_redoMutationParamsCache", []);
327
330
  }
328
331
  clearUndoRedoMutationParamsCache() {
329
332
  this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
@@ -351,13 +354,13 @@ class he {
351
354
  return null;
352
355
  const { unitId: e } = this._undoMutationParamsCache[0], t = {
353
356
  unitId: e,
354
- actions: this._undoMutationParamsCache.reverse().reduce((o, r) => P.compose(o, r.actions), []),
357
+ actions: this._undoMutationParamsCache.reverse().reduce((s, r) => b.compose(s, r.actions), []),
355
358
  textRanges: []
356
359
  // Add empty array, will never use, just fix type error
357
360
  };
358
361
  return { redoMutationParams: {
359
362
  unitId: e,
360
- actions: this._redoMutationParamsCache.reduce((o, r) => P.compose(o, r.actions), []),
363
+ actions: this._redoMutationParamsCache.reduce((s, r) => b.compose(s, r.actions), []),
361
364
  textRanges: []
362
365
  // Add empty array, will never use, just fix type error
363
366
  }, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
@@ -369,18 +372,19 @@ class he {
369
372
  const qe = "doc.mutation.rich-text-editing", L = {
370
373
  id: qe,
371
374
  type: v.MUTATION,
372
- handler: (s, e) => {
375
+ // eslint-disable-next-line max-lines-per-function
376
+ handler: (o, e) => {
373
377
  var B;
374
378
  const {
375
379
  unitId: t,
376
380
  actions: n,
377
- textRanges: o,
381
+ textRanges: s,
378
382
  prevTextRanges: r,
379
383
  trigger: i,
380
384
  noHistory: a,
381
385
  isCompositionEnd: c,
382
386
  noNeedSetTextRange: d
383
- } = e, u = s.get(E).getUniverDocInstance(t), g = s.get(ne).getViewModel(t), p = s.get(T), f = ((B = p.getSelections()) != null ? B : []).map(Z), S = s.get(me), _ = s.get(he);
387
+ } = e, u = o.get(E).getUniverDocInstance(t), g = o.get(ne).getViewModel(t), p = o.get(T), f = ((B = p.getSelections()) != null ? B : []).map(Z), S = o.get(me), _ = o.get(he);
384
388
  if (u == null || g == null)
385
389
  throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
386
390
  const R = !!u.getSnapshot().disabled;
@@ -391,17 +395,17 @@ const qe = "doc.mutation.rich-text-editing", L = {
391
395
  textRanges: f
392
396
  };
393
397
  const M = u.apply(n), { segmentId: C } = n[0], D = u.getSelfOrHeaderFooterModel(C);
394
- g.getSelfOrHeaderFooterViewModel(C).reset(D), !d && o && i != null && queueMicrotask(() => {
395
- p.replaceTextRanges(o);
398
+ g.getSelfOrHeaderFooterViewModel(C).reset(D), !d && s && i != null && queueMicrotask(() => {
399
+ p.replaceTextRanges(s);
396
400
  });
397
- const b = {
401
+ const P = {
398
402
  commandId: qe,
399
403
  unitId: t,
400
404
  trigger: i,
401
405
  noHistory: a,
402
406
  redoState: {
403
407
  actions: n,
404
- textRanges: o
408
+ textRanges: s
405
409
  },
406
410
  undoState: {
407
411
  actions: M,
@@ -413,9 +417,9 @@ const qe = "doc.mutation.rich-text-editing", L = {
413
417
  if (O == null)
414
418
  throw new Error("historyParams is null in RichTextEditingMutation");
415
419
  const { undoMutationParams: U, redoMutationParams: w, previousActiveRange: X } = O;
416
- b.redoState.actions = w.actions, b.undoState.actions = U.actions, b.undoState.textRanges = [X];
420
+ P.redoState.actions = w.actions, P.undoState.actions = U.actions, P.undoState.textRanges = [X];
417
421
  }
418
- return S.setChangeState(b), {
422
+ return S.setChangeState(P), {
419
423
  unitId: t,
420
424
  actions: M,
421
425
  textRanges: f
@@ -424,81 +428,81 @@ const qe = "doc.mutation.rich-text-editing", L = {
424
428
  }, pe = {
425
429
  id: "doc.command.insert-text",
426
430
  type: v.COMMAND,
427
- handler: async (s, e) => {
428
- const t = s.get(I), { range: n, segmentId: o, body: r, unitId: i, textRanges: a } = e, { startOffset: c, collapsed: d } = n, l = {
431
+ handler: async (o, e) => {
432
+ const t = o.get(I), { range: n, segmentId: s, body: r, unitId: i, textRanges: a } = e, { startOffset: c, collapsed: d } = n, l = {
429
433
  id: L.id,
430
434
  params: {
431
435
  unitId: i,
432
436
  actions: [],
433
437
  textRanges: a
434
438
  }
435
- }, u = new P();
439
+ }, u = new b();
436
440
  return d ? c > 0 && u.push({
437
- t: y.RETAIN,
441
+ t: x.RETAIN,
438
442
  len: c,
439
- segmentId: o
440
- }) : u.push(...be(n, o)), u.push({
441
- t: y.INSERT,
443
+ segmentId: s
444
+ }) : u.push(...be(n, s)), u.push({
445
+ t: x.INSERT,
442
446
  body: r,
443
447
  len: r.dataStream.length,
444
448
  line: 0,
445
- segmentId: o
449
+ segmentId: s
446
450
  }), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
447
451
  }
448
452
  };
449
- var G = /* @__PURE__ */ ((s) => (s[s.LEFT = 0] = "LEFT", s[s.RIGHT = 1] = "RIGHT", s))(G || {});
453
+ var j = /* @__PURE__ */ ((o) => (o[o.LEFT = 0] = "LEFT", o[o.RIGHT = 1] = "RIGHT", o))(j || {});
450
454
  const Se = {
451
455
  id: "doc.command.delete-text",
452
456
  type: v.COMMAND,
453
- handler: async (s, e) => {
454
- const t = s.get(I), { range: n, segmentId: o, unitId: r, direction: i, textRanges: a, len: c = 1 } = e, { startOffset: d } = n, l = {
457
+ handler: async (o, e) => {
458
+ const t = o.get(I), { range: n, segmentId: s, unitId: r, direction: i, textRanges: a, len: c = 1 } = e, { startOffset: d } = n, l = {
455
459
  id: L.id,
456
460
  params: {
457
461
  unitId: r,
458
462
  actions: [],
459
463
  textRanges: a
460
464
  }
461
- }, u = new P();
465
+ }, u = new b();
462
466
  return d > 0 && u.push({
463
- t: y.RETAIN,
467
+ t: x.RETAIN,
464
468
  len: i === 0 ? d - c : d,
465
- segmentId: o
469
+ segmentId: s
466
470
  }), u.push({
467
- t: y.DELETE,
471
+ t: x.DELETE,
468
472
  len: c,
469
473
  line: 0,
470
- segmentId: o
474
+ segmentId: s
471
475
  }), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
472
476
  }
473
477
  }, ht = {
474
478
  id: "doc.command.update-text",
475
479
  type: v.COMMAND,
476
- handler: async (s, e) => {
477
- const { range: t, segmentId: n, updateBody: o, coverType: r, unitId: i, textRanges: a } = e, c = s.get(I), d = {
480
+ handler: async (o, e) => {
481
+ const { range: t, segmentId: n, updateBody: s, coverType: r, unitId: i, textRanges: a } = e, c = o.get(I), d = {
478
482
  id: L.id,
479
483
  params: {
480
484
  unitId: i,
481
485
  actions: [],
482
486
  textRanges: a
483
487
  }
484
- }, l = new P(), { startOffset: u, endOffset: m } = t;
488
+ }, l = new b(), { startOffset: u, endOffset: m } = t;
485
489
  return l.push({
486
- t: y.RETAIN,
490
+ t: x.RETAIN,
487
491
  len: u,
488
492
  segmentId: n
489
493
  }), l.push({
490
- t: y.RETAIN,
491
- body: o,
494
+ t: x.RETAIN,
495
+ body: s,
492
496
  len: m - u,
493
497
  segmentId: n,
494
498
  coverType: r
495
499
  }), d.params.actions = l.serialize(), !!c.syncExecuteCommand(d.id, d.params);
496
500
  }
497
501
  };
498
- function tn(s, e) {
502
+ function tn(o, e) {
499
503
  const t = [];
500
- for (let n = 0, o = s.length; n < o; n++)
501
- s[n] === xe.PARAGRAPH && t.push({
504
+ for (let n = 0, s = o.length; n < s; n++)
505
+ o[n] === xe.PARAGRAPH && t.push({
502
506
  startIndex: n
503
507
  });
504
508
  if (e)
@@ -509,15 +513,15 @@ function tn(s, e) {
509
513
  const nn = {
510
514
  id: "doc.command.break-line",
511
515
  type: v.COMMAND,
512
- handler: async (s) => {
516
+ handler: async (o) => {
513
517
  var p, h;
514
- const e = s.get(T), t = s.get(E), n = s.get(I), o = e.getActiveRange();
515
- if (o == null)
518
+ const e = o.get(T), t = o.get(E), n = o.get(I), s = e.getActiveRange();
519
+ if (s == null)
516
520
  return !1;
517
521
  const r = t.getCurrentUniverDocInstance();
518
522
  if (!r)
519
523
  return !1;
520
- const i = r.getUnitId(), { startOffset: a, segmentId: c, style: d } = o, l = [
524
+ const i = r.getUnitId(), { startOffset: a, segmentId: c, style: d } = s, l = [
521
525
  {
522
526
  startOffset: a + 1,
523
527
  endOffset: a + 1,
@@ -530,27 +534,27 @@ const nn = {
530
534
  dataStream: xe.PARAGRAPH,
531
535
  paragraphs: tn(xe.PARAGRAPH, m)
532
536
  },
533
- range: o,
537
+ range: s,
534
538
  textRanges: l,
535
539
  segmentId: c
536
540
  });
537
541
  }
538
542
  };
539
- var sn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, rn = (s, e, t, n) => {
540
- for (var o = n > 1 ? void 0 : n ? on(e, t) : e, r = s.length - 1, i; r >= 0; r--)
541
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
542
- return n && o && sn(e, t, o), o;
543
- }, Re = (s, e) => (t, n) => e(t, n, s);
543
+ var on = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, rn = (o, e, t, n) => {
544
+ for (var s = n > 1 ? void 0 : n ? sn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
545
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
546
+ return n && s && on(e, t, s), s;
547
+ }, Re = (o, e) => (t, n) => e(t, n, o);
544
548
  let H = class extends ge {
545
549
  constructor(e, t, n) {
546
550
  super();
547
- x(this, "_currentSkeletonUnitId", "");
548
- x(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
549
- x(this, "_currentSkeleton$", new ee(null));
550
- x(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
551
+ y(this, "_currentSkeletonUnitId", "");
552
+ y(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
553
+ y(this, "_currentSkeleton$", new ee(null));
554
+ y(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
551
555
  // CurrentSkeletonBefore for pre-triggered logic during registration
552
- x(this, "_currentSkeletonBefore$", new ee(null));
553
- x(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
556
+ y(this, "_currentSkeletonBefore$", new ee(null));
557
+ y(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
554
558
  this._localeService = e, this._docViewModelManagerService = t, this._univerInstanceService = n, this._initialize();
555
559
  }
556
560
  _initialize() {
@@ -612,8 +616,8 @@ H = rn([
612
616
  const Zn = {
613
617
  id: "doc.command.inner-paste",
614
618
  type: v.COMMAND,
615
- handler: async (s, e) => {
616
- const { segmentId: t, body: n, textRanges: o } = e, r = s.get(I), i = s.get(T), a = s.get(E), c = i.getSelections();
619
+ handler: async (o, e) => {
620
+ const { segmentId: t, body: n, textRanges: s } = e, r = o.get(I), i = o.get(T), a = o.get(E), c = i.getSelections();
617
621
  if (!Array.isArray(c) || c.length === 0)
618
622
  return !1;
619
623
  const d = a.getCurrentUniverDocInstance();
@@ -624,19 +628,19 @@ const Zn = {
624
628
  params: {
625
629
  unitId: l,
626
630
  actions: [],
627
- textRanges: o
631
+ textRanges: s
628
632
  }
629
- }, m = new oe();
633
+ }, m = new se();
630
634
  m.reset();
631
- const g = new P();
635
+ const g = new b();
632
636
  for (const h of c) {
633
637
  const { startOffset: f, endOffset: S, collapsed: _ } = h, R = f - m.cursor;
634
638
  _ ? g.push({
635
- t: y.RETAIN,
639
+ t: x.RETAIN,
636
640
  len: R,
637
641
  segmentId: t
638
642
  }) : g.push(...be(h, t, m.cursor)), g.push({
639
- t: y.INSERT,
643
+ t: x.INSERT,
640
644
  body: n,
641
645
  len: n.dataStream.length,
642
646
  line: 0,
@@ -648,9 +652,9 @@ const Zn = {
648
652
  }, pt = {
649
653
  id: "doc.command.inner-cut",
650
654
  type: v.COMMAND,
651
- handler: async (s, e) => {
655
+ handler: async (o, e) => {
652
656
  var h;
653
- const { segmentId: t, textRanges: n } = e, o = s.get(I), r = s.get(T), i = s.get(E), a = r.getSelections();
657
+ const { segmentId: t, textRanges: n } = e, s = o.get(I), r = o.get(T), i = o.get(E), a = r.getSelections();
654
658
  if (!Array.isArray(a) || a.length === 0)
655
659
  return !1;
656
660
  const c = (h = i.getCurrentUniverDocInstance()) == null ? void 0 : h.getUnitId();
@@ -666,48 +670,48 @@ const Zn = {
666
670
  actions: [],
667
671
  textRanges: n
668
672
  }
669
- }, m = new oe();
673
+ }, m = new se();
670
674
  m.reset();
671
- const g = new P();
675
+ const g = new b();
672
676
  for (const f of a) {
673
677
  const { startOffset: S, endOffset: _, collapsed: R } = f, M = S - m.cursor;
674
678
  R ? g.push({
675
- t: y.RETAIN,
679
+ t: x.RETAIN,
676
680
  len: M,
677
681
  segmentId: t
678
682
  }) : g.push(...an(f, l, t, m.cursor)), m.reset(), m.moveCursor(_);
679
683
  }
680
- return u.params.actions = g.serialize(), !!o.syncExecuteCommand(u.id, u.params);
684
+ return u.params.actions = g.serialize(), !!s.syncExecuteCommand(u.id, u.params);
681
685
  }
682
686
  };
683
- function an(s, e, t = "", n = 0) {
684
- const { startOffset: o, endOffset: r } = s, i = [], { paragraphs: a = [] } = e, c = o - n, d = r - n, l = a == null ? void 0 : a.find(
687
+ function an(o, e, t = "", n = 0) {
688
+ const { startOffset: s, endOffset: r } = o, i = [], { paragraphs: a = [] } = e, c = s - n, d = r - n, l = a == null ? void 0 : a.find(
685
689
  (u) => u.startIndex - n >= c && u.startIndex - n <= d
686
690
  );
687
691
  if (c > 0 && i.push({
688
- t: y.RETAIN,
692
+ t: x.RETAIN,
689
693
  len: c,
690
694
  segmentId: t
691
695
  }), l && l.startIndex - n > c) {
692
696
  const u = l.startIndex - n;
693
697
  i.push({
694
- t: y.DELETE,
698
+ t: x.DELETE,
695
699
  len: u - c,
696
700
  line: 0,
697
701
  segmentId: t
698
702
  }), i.push({
699
- t: y.RETAIN,
703
+ t: x.RETAIN,
700
704
  len: 1,
701
705
  segmentId: t
702
706
  }), d > u + 1 && i.push({
703
- t: y.DELETE,
707
+ t: x.DELETE,
704
708
  len: d - u - 1,
705
709
  line: 0,
706
710
  segmentId: t
707
711
  });
708
712
  } else
709
713
  i.push({
710
- t: y.DELETE,
714
+ t: x.DELETE,
711
715
  len: d - c,
712
716
  line: 0,
713
717
  segmentId: t
@@ -717,9 +721,10 @@ function an(s, e, t = "", n = 0) {
717
721
  const cn = {
718
722
  id: "doc.command.delete-left",
719
723
  type: v.COMMAND,
720
- handler: async (s) => {
724
+ // eslint-disable-next-line max-lines-per-function
725
+ handler: async (o) => {
721
726
  var M;
722
- const e = s.get(T), t = s.get(H), n = s.get(E), o = s.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (M = t.getCurrent()) == null ? void 0 : M.skeleton;
727
+ const e = o.get(T), t = o.get(H), n = o.get(E), s = o.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (M = t.getCurrent()) == null ? void 0 : M.skeleton;
723
728
  let c = !0;
724
729
  if (r == null || a == null || i == null)
725
730
  return !1;
@@ -729,11 +734,11 @@ const cn = {
729
734
  const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = wt(p), f = Lt(p, d.getBody());
730
735
  let S = l;
731
736
  const _ = a.findNodeByCharIndex(l - 1);
732
- if (Bt(p) && _ !== p && (h === !0 || f === !0)) {
737
+ if (Bt(p) && _ !== p && (h === !0 || f === !0) && u) {
733
738
  const C = Ft(p, d.getBody());
734
739
  if (C == null)
735
740
  return !1;
736
- const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 }, b = C.paragraphStyle;
741
+ const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 }, P = C.paragraphStyle;
737
742
  if (h === !0) {
738
743
  const O = C.paragraphStyle;
739
744
  if (O) {
@@ -743,7 +748,7 @@ const cn = {
743
748
  }
744
749
  } else if (f === !0) {
745
750
  const O = C.bullet;
746
- O && (A.bullet = O), b != null && (A.paragraphStyle = { ...b }, delete A.paragraphStyle.hanging, delete A.paragraphStyle.indentStart);
751
+ O && (A.bullet = O), P != null && (A.paragraphStyle = { ...P }, delete A.paragraphStyle.hanging, delete A.paragraphStyle.indentStart);
747
752
  }
748
753
  const B = [
749
754
  {
@@ -752,7 +757,7 @@ const cn = {
752
757
  style: g
753
758
  }
754
759
  ];
755
- c = await o.executeCommand(ht.id, {
760
+ c = await s.executeCommand(ht.id, {
756
761
  unitId: d.getUnitId(),
757
762
  updateBody: {
758
763
  dataStream: "",
@@ -770,8 +775,8 @@ const cn = {
770
775
  if (_ == null)
771
776
  return !0;
772
777
  if (_.content === "\r")
773
- c = await o.executeCommand(Pe.id, {
774
- direction: G.LEFT,
778
+ c = await s.executeCommand(Ue.id, {
779
+ direction: j.LEFT,
775
780
  range: r
776
781
  });
777
782
  else {
@@ -783,18 +788,18 @@ const cn = {
783
788
  style: g
784
789
  }
785
790
  ];
786
- c = await o.executeCommand(Se.id, {
791
+ c = await s.executeCommand(Se.id, {
787
792
  unitId: d.getUnitId(),
788
793
  range: r,
789
794
  segmentId: m,
790
- direction: G.LEFT,
795
+ direction: j.LEFT,
791
796
  len: _.count,
792
797
  textRanges: C
793
798
  });
794
799
  }
795
800
  } else {
796
801
  const C = St(r, i);
797
- c = await o.executeCommand(pt.id, {
802
+ c = await s.executeCommand(pt.id, {
798
803
  segmentId: m,
799
804
  textRanges: C
800
805
  });
@@ -804,9 +809,9 @@ const cn = {
804
809
  }, ln = {
805
810
  id: "doc.command.delete-right",
806
811
  type: v.COMMAND,
807
- handler: async (s) => {
812
+ handler: async (o) => {
808
813
  var p;
809
- const e = s.get(T), t = s.get(H), n = s.get(E), o = s.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (p = t.getCurrent()) == null ? void 0 : p.skeleton;
814
+ const e = o.get(T), t = o.get(H), n = o.get(E), s = o.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (p = t.getCurrent()) == null ? void 0 : p.skeleton;
810
815
  let c;
811
816
  if (r == null || a == null || i == null)
812
817
  return !1;
@@ -819,8 +824,8 @@ const cn = {
819
824
  if (u === !0) {
820
825
  const h = a.findNodeByCharIndex(l);
821
826
  if (h.content === "\r")
822
- c = await o.executeCommand(Pe.id, {
823
- direction: G.RIGHT,
827
+ c = await s.executeCommand(Ue.id, {
828
+ direction: j.RIGHT,
824
829
  range: r
825
830
  });
826
831
  else {
@@ -831,30 +836,31 @@ const cn = {
831
836
  style: g
832
837
  }
833
838
  ];
834
- c = await o.executeCommand(Se.id, {
839
+ c = await s.executeCommand(Se.id, {
835
840
  unitId: d.getUnitId(),
836
841
  range: r,
837
842
  segmentId: m,
838
- direction: G.RIGHT,
843
+ direction: j.RIGHT,
839
844
  textRanges: f,
840
845
  len: h.count
841
846
  });
842
847
  }
843
848
  } else {
844
849
  const h = St(r, i);
845
- c = await o.executeCommand(pt.id, {
850
+ c = await s.executeCommand(pt.id, {
846
851
  segmentId: m,
847
852
  textRanges: h
848
853
  });
849
854
  }
850
855
  return c;
851
856
  }
852
- }, Pe = {
857
+ }, Ue = {
853
858
  id: "doc.command.merge-two-paragraph",
854
859
  type: v.COMMAND,
855
- handler: async (s, e) => {
856
- var A, b, B;
857
- const t = s.get(T), n = s.get(E), o = s.get(I), { direction: r, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
860
+ // eslint-disable-next-line max-lines-per-function
861
+ handler: async (o, e) => {
862
+ var A, P, B;
863
+ const t = o.get(T), n = o.get(E), s = o.get(I), { direction: r, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
858
864
  if (a == null || c == null)
859
865
  return !1;
860
866
  const d = n.getCurrentUniverDocInstance();
@@ -863,7 +869,7 @@ const cn = {
863
869
  const { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
864
870
  if (!u)
865
871
  return !1;
866
- const p = r === G.LEFT ? l : l + 1, h = (B = (b = (A = d.getBody()) == null ? void 0 : A.paragraphs) == null ? void 0 : b.find((O) => O.startIndex >= p)) == null ? void 0 : B.startIndex, f = dn(d.getBody(), p, h), S = r === G.LEFT ? l - 1 : l, _ = d.getUnitId(), R = [
872
+ const p = r === j.LEFT ? l : l + 1, h = (B = (P = (A = d.getBody()) == null ? void 0 : A.paragraphs) == null ? void 0 : P.find((O) => O.startIndex >= p)) == null ? void 0 : B.startIndex, f = dn(d.getBody(), p, h), S = r === j.LEFT ? l - 1 : l, _ = d.getUnitId(), R = [
867
873
  {
868
874
  startOffset: S,
869
875
  endOffset: S,
@@ -877,34 +883,34 @@ const cn = {
877
883
  textRanges: R,
878
884
  prevTextRanges: [i]
879
885
  }
880
- }, C = new P();
886
+ }, C = new b();
881
887
  return C.push({
882
- t: y.RETAIN,
883
- len: r === G.LEFT ? l - 1 : l,
888
+ t: x.RETAIN,
889
+ len: r === j.LEFT ? l - 1 : l,
884
890
  segmentId: m
885
891
  }), f.dataStream.length && C.push({
886
- t: y.INSERT,
892
+ t: x.INSERT,
887
893
  body: f,
888
894
  len: f.dataStream.length,
889
895
  line: 0,
890
896
  segmentId: m
891
897
  }), C.push({
892
- t: y.RETAIN,
898
+ t: x.RETAIN,
893
899
  len: 1,
894
900
  segmentId: m
895
901
  }), C.push({
896
- t: y.DELETE,
902
+ t: x.DELETE,
897
903
  len: h + 1 - p,
898
904
  line: 0,
899
905
  segmentId: m
900
- }), M.params.actions = C.serialize(), !!o.syncExecuteCommand(M.id, M.params);
906
+ }), M.params.actions = C.serialize(), !!s.syncExecuteCommand(M.id, M.params);
901
907
  }
902
908
  };
903
- function dn(s, e, t) {
904
- const { textRuns: n } = s, o = s.dataStream.substring(e, t);
909
+ function dn(o, e, t) {
910
+ const { textRuns: n } = o, s = o.dataStream.substring(e, t);
905
911
  if (n == null)
906
912
  return {
907
- dataStream: o
913
+ dataStream: s
908
914
  };
909
915
  const r = [];
910
916
  for (const i of n) {
@@ -924,29 +930,29 @@ function dn(s, e, t) {
924
930
  }));
925
931
  }
926
932
  return {
927
- dataStream: o,
933
+ dataStream: s,
928
934
  textRuns: r
929
935
  };
930
936
  }
931
- function St(s, e) {
932
- let t = s.endOffset;
933
- for (const o of e) {
934
- const { startOffset: r, endOffset: i } = o;
935
- r == null || i == null || i <= s.endOffset && (t -= i - r);
937
+ function St(o, e) {
938
+ let t = o.endOffset;
939
+ for (const s of e) {
940
+ const { startOffset: r, endOffset: i } = s;
941
+ r == null || i == null || i <= o.endOffset && (t -= i - r);
936
942
  }
937
943
  return [
938
944
  {
939
945
  startOffset: t,
940
946
  endOffset: t,
941
- style: s.style
947
+ style: o.style
942
948
  }
943
949
  ];
944
950
  }
945
951
  const _t = {
946
952
  id: "doc.command.ime-input",
947
953
  type: v.COMMAND,
948
- handler: async (s, e) => {
949
- const { unitId: t, newText: n, oldTextLen: o, isCompositionEnd: r, isCompositionStart: i } = e, a = s.get(I), c = s.get(he), d = c.getActiveRange();
954
+ handler: async (o, e) => {
955
+ const { unitId: t, newText: n, oldTextLen: s, isCompositionEnd: r, isCompositionStart: i } = e, a = o.get(I), c = o.get(he), d = c.getActiveRange();
950
956
  if (d == null)
951
957
  return !1;
952
958
  const { startOffset: l, style: u, segmentId: m } = d, g = n.length, p = [
@@ -963,18 +969,18 @@ const _t = {
963
969
  actions: [],
964
970
  textRanges: p
965
971
  }
966
- }, f = new P();
972
+ }, f = new b();
967
973
  !d.collapsed && i ? f.push(...be(d, m)) : f.push({
968
- t: y.RETAIN,
974
+ t: x.RETAIN,
969
975
  len: l,
970
976
  segmentId: m
971
- }), o > 0 && f.push({
972
- t: y.DELETE,
973
- len: o,
977
+ }), s > 0 && f.push({
978
+ t: x.DELETE,
979
+ len: s,
974
980
  line: 0,
975
981
  segmentId: m
976
982
  }), f.push({
977
- t: y.INSERT,
983
+ t: x.INSERT,
978
984
  body: {
979
985
  dataStream: n
980
986
  },
@@ -986,32 +992,20 @@ const _t = {
986
992
  return c.pushUndoRedoMutationParams(S, h.params), !!S;
987
993
  }
988
994
  };
989
- function F(s, e, t, n) {
995
+ function F(o, e, t, n) {
990
996
  var r;
991
- const { segmentId: o } = (r = t.getActiveRange()) != null ? r : {};
992
- return o == null ? !1 : n.executeCommand(It.id, {
993
- segmentId: o,
994
- preCommandId: s,
997
+ const { segmentId: s } = (r = t.getActiveRange()) != null ? r : {};
998
+ return s == null ? !1 : n.executeCommand(It.id, {
999
+ segmentId: s,
1000
+ preCommandId: o,
995
1001
  ...e != null ? e : {}
996
1002
  });
997
1003
  }
998
- const Ke = "doc.command.set-inline-format-bold", Ue = {
999
- id: Ke,
1000
- type: v.COMMAND,
1001
- handler: async (s, e) => {
1002
- const t = s.get(I), n = s.get(T);
1003
- return F(
1004
- Ke,
1005
- e,
1006
- n,
1007
- t
1008
- );
1009
- }
1010
- }, Qe = "doc.command.set-inline-format-italic", we = {
1004
+ const Qe = "doc.command.set-inline-format-bold", we = {
1011
1005
  id: Qe,
1012
1006
  type: v.COMMAND,
1013
- handler: async (s, e) => {
1014
- const t = s.get(I), n = s.get(T);
1007
+ handler: async (o, e) => {
1008
+ const t = o.get(I), n = o.get(T);
1015
1009
  return F(
1016
1010
  Qe,
1017
1011
  e,
@@ -1019,11 +1013,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1019
1013
  t
1020
1014
  );
1021
1015
  }
1022
- }, et = "doc.command.set-inline-format-underline", Le = {
1016
+ }, et = "doc.command.set-inline-format-italic", Le = {
1023
1017
  id: et,
1024
1018
  type: v.COMMAND,
1025
- handler: async (s, e) => {
1026
- const t = s.get(I), n = s.get(T);
1019
+ handler: async (o, e) => {
1020
+ const t = o.get(I), n = o.get(T);
1027
1021
  return F(
1028
1022
  et,
1029
1023
  e,
@@ -1031,11 +1025,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1031
1025
  t
1032
1026
  );
1033
1027
  }
1034
- }, tt = "doc.command.set-inline-format-strikethrough", Be = {
1028
+ }, tt = "doc.command.set-inline-format-underline", Be = {
1035
1029
  id: tt,
1036
1030
  type: v.COMMAND,
1037
- handler: async (s, e) => {
1038
- const t = s.get(I), n = s.get(T);
1031
+ handler: async (o, e) => {
1032
+ const t = o.get(I), n = o.get(T);
1039
1033
  return F(
1040
1034
  tt,
1041
1035
  e,
@@ -1043,11 +1037,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1043
1037
  t
1044
1038
  );
1045
1039
  }
1046
- }, nt = "doc.command.set-inline-format-subscript", se = {
1040
+ }, nt = "doc.command.set-inline-format-strikethrough", Fe = {
1047
1041
  id: nt,
1048
1042
  type: v.COMMAND,
1049
- handler: async (s, e) => {
1050
- const t = s.get(I), n = s.get(T);
1043
+ handler: async (o, e) => {
1044
+ const t = o.get(I), n = o.get(T);
1051
1045
  return F(
1052
1046
  nt,
1053
1047
  e,
@@ -1055,35 +1049,35 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1055
1049
  t
1056
1050
  );
1057
1051
  }
1058
- }, st = "doc.command.set-inline-format-superscript", Fe = {
1059
- id: st,
1052
+ }, ot = "doc.command.set-inline-format-subscript", oe = {
1053
+ id: ot,
1060
1054
  type: v.COMMAND,
1061
- handler: async (s, e) => {
1062
- const t = s.get(I), n = s.get(T);
1055
+ handler: async (o, e) => {
1056
+ const t = o.get(I), n = o.get(T);
1063
1057
  return F(
1064
- st,
1058
+ ot,
1065
1059
  e,
1066
1060
  n,
1067
1061
  t
1068
1062
  );
1069
1063
  }
1070
- }, ot = "doc.command.set-inline-format-fontsize", $e = {
1071
- id: ot,
1064
+ }, st = "doc.command.set-inline-format-superscript", $e = {
1065
+ id: st,
1072
1066
  type: v.COMMAND,
1073
- handler: async (s, e) => {
1074
- const t = s.get(I), n = s.get(T);
1067
+ handler: async (o, e) => {
1068
+ const t = o.get(I), n = o.get(T);
1075
1069
  return F(
1076
- ot,
1070
+ st,
1077
1071
  e,
1078
1072
  n,
1079
1073
  t
1080
1074
  );
1081
1075
  }
1082
- }, rt = "doc.command.set-inline-format-font-family", Ve = {
1076
+ }, rt = "doc.command.set-inline-format-fontsize", Ve = {
1083
1077
  id: rt,
1084
1078
  type: v.COMMAND,
1085
- handler: async (s, e) => {
1086
- const t = s.get(I), n = s.get(T);
1079
+ handler: async (o, e) => {
1080
+ const t = o.get(I), n = o.get(T);
1087
1081
  return F(
1088
1082
  rt,
1089
1083
  e,
@@ -1091,11 +1085,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1091
1085
  t
1092
1086
  );
1093
1087
  }
1094
- }, it = "doc.command.set-inline-format-text-color", ze = {
1088
+ }, it = "doc.command.set-inline-format-font-family", ke = {
1095
1089
  id: it,
1096
1090
  type: v.COMMAND,
1097
- handler: async (s, e) => {
1098
- const t = s.get(I), n = s.get(T);
1091
+ handler: async (o, e) => {
1092
+ const t = o.get(I), n = o.get(T);
1099
1093
  return F(
1100
1094
  it,
1101
1095
  e,
@@ -1103,11 +1097,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1103
1097
  t
1104
1098
  );
1105
1099
  }
1106
- }, at = "doc.command.set-inline-format-text-background-color", ke = {
1100
+ }, at = "doc.command.set-inline-format-text-color", ze = {
1107
1101
  id: at,
1108
1102
  type: v.COMMAND,
1109
- handler: async (s, e) => {
1110
- const t = s.get(I), n = s.get(T);
1103
+ handler: async (o, e) => {
1104
+ const t = o.get(I), n = o.get(T);
1111
1105
  return F(
1112
1106
  at,
1113
1107
  e,
@@ -1115,11 +1109,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1115
1109
  t
1116
1110
  );
1117
1111
  }
1118
- }, ct = "doc.command.reset-inline-format-text-background-color", je = {
1112
+ }, ct = "doc.command.set-inline-format-text-background-color", Ge = {
1119
1113
  id: ct,
1120
1114
  type: v.COMMAND,
1121
- handler: async (s, e) => {
1122
- const t = s.get(I), n = s.get(T);
1115
+ handler: async (o, e) => {
1116
+ const t = o.get(I), n = o.get(T);
1123
1117
  return F(
1124
1118
  ct,
1125
1119
  e,
@@ -1127,52 +1121,64 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1127
1121
  t
1128
1122
  );
1129
1123
  }
1124
+ }, lt = "doc.command.reset-inline-format-text-background-color", je = {
1125
+ id: lt,
1126
+ type: v.COMMAND,
1127
+ handler: async (o, e) => {
1128
+ const t = o.get(I), n = o.get(T);
1129
+ return F(
1130
+ lt,
1131
+ e,
1132
+ n,
1133
+ t
1134
+ );
1135
+ }
1130
1136
  }, vt = {
1131
- [Ue.id]: "bl",
1132
- [we.id]: "it",
1133
- [Le.id]: "ul",
1134
- [Be.id]: "st",
1135
- [$e.id]: "fs",
1136
- [Ve.id]: "ff",
1137
+ [we.id]: "bl",
1138
+ [Le.id]: "it",
1139
+ [Be.id]: "ul",
1140
+ [Fe.id]: "st",
1141
+ [Ve.id]: "fs",
1142
+ [ke.id]: "ff",
1137
1143
  [ze.id]: "cl",
1138
- [ke.id]: "bg",
1144
+ [Ge.id]: "bg",
1139
1145
  [je.id]: "bg",
1140
- [se.id]: "va",
1141
- [Fe.id]: "va"
1146
+ [oe.id]: "va",
1147
+ [$e.id]: "va"
1142
1148
  }, It = {
1143
1149
  id: "doc.command.set-inline-format",
1144
1150
  type: v.COMMAND,
1145
- handler: async (s, e) => {
1146
- const { segmentId: t, value: n, preCommandId: o } = e, r = s.get(I), i = s.get(T), a = s.get(E), c = i.getSelections();
1151
+ handler: async (o, e) => {
1152
+ const { segmentId: t, value: n, preCommandId: s } = e, r = o.get(I), i = o.get(T), a = o.get(E), c = i.getSelections();
1147
1153
  if (!Array.isArray(c) || c.length === 0)
1148
1154
  return !1;
1149
1155
  let d = a.getCurrentUniverDocInstance();
1150
1156
  if (!d)
1151
1157
  return !1;
1152
1158
  let l = d.getUnitId();
1153
- l === Dt && (d = a.getUniverDocInstance(dt), l = d.getUnitId());
1159
+ l === Dt && (d = a.getUniverDocInstance(ut), l = d.getUnitId());
1154
1160
  let u;
1155
- switch (o) {
1156
- case Ue.id:
1161
+ switch (s) {
1157
1162
  case we.id:
1158
1163
  case Le.id:
1159
1164
  case Be.id:
1160
- case se.id:
1161
- case Fe.id: {
1165
+ case Fe.id:
1166
+ case oe.id:
1167
+ case $e.id: {
1162
1168
  u = mn(
1163
1169
  d.getBody().textRuns,
1164
- o,
1170
+ s,
1165
1171
  c
1166
1172
  );
1167
1173
  break;
1168
1174
  }
1169
- case $e.id:
1170
- case Ve.id: {
1175
+ case Ve.id:
1176
+ case ke.id: {
1171
1177
  u = n;
1172
1178
  break;
1173
1179
  }
1174
1180
  case ze.id:
1175
- case ke.id: {
1181
+ case Ge.id: {
1176
1182
  u = {
1177
1183
  rgb: n
1178
1184
  };
@@ -1185,7 +1191,7 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1185
1191
  break;
1186
1192
  }
1187
1193
  default:
1188
- throw new Error(`Unknown command: ${o} in handleInlineFormat`);
1194
+ throw new Error(`Unknown command: ${s} in handleInlineFormat`);
1189
1195
  }
1190
1196
  const m = {
1191
1197
  id: L.id,
@@ -1194,7 +1200,7 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1194
1200
  actions: [],
1195
1201
  textRanges: c.map(Z)
1196
1202
  }
1197
- }, g = new P(), p = new oe();
1203
+ }, g = new b(), p = new se();
1198
1204
  p.reset();
1199
1205
  for (const f of c) {
1200
1206
  const { startOffset: S, endOffset: _ } = f, R = {
@@ -1204,17 +1210,17 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1204
1210
  st: 0,
1205
1211
  ed: _ - S,
1206
1212
  ts: {
1207
- [vt[o]]: u
1213
+ [vt[s]]: u
1208
1214
  }
1209
1215
  }
1210
1216
  ]
1211
1217
  }, M = S - p.cursor;
1212
1218
  M !== 0 && g.push({
1213
- t: y.RETAIN,
1219
+ t: x.RETAIN,
1214
1220
  len: M,
1215
1221
  segmentId: t
1216
1222
  }), g.push({
1217
- t: y.RETAIN,
1223
+ t: x.RETAIN,
1218
1224
  body: R,
1219
1225
  len: _ - S,
1220
1226
  segmentId: t
@@ -1223,42 +1229,42 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1223
1229
  return m.params.actions = g.serialize(), !!r.syncExecuteCommand(m.id, m.params);
1224
1230
  }
1225
1231
  };
1226
- function un(s) {
1227
- return s !== null && typeof s == "object";
1232
+ function un(o) {
1233
+ return o !== null && typeof o == "object";
1228
1234
  }
1229
- function mn(s, e, t) {
1230
- let n = 0, o = 0;
1235
+ function mn(o, e, t) {
1236
+ let n = 0, s = 0;
1231
1237
  const r = vt[e];
1232
- for (; n !== s.length && o !== t.length; ) {
1233
- const { startOffset: i, endOffset: a } = t[o], { st: c, ed: d, ts: l } = s[n];
1238
+ for (; n !== o.length && s !== t.length; ) {
1239
+ const { startOffset: i, endOffset: a } = t[s], { st: c, ed: d, ts: l } = o[n];
1234
1240
  if (a <= c)
1235
- o++;
1241
+ s++;
1236
1242
  else if (d <= i)
1237
1243
  n++;
1238
1244
  else {
1239
1245
  if (/bl|it/.test(r))
1240
- return (l == null ? void 0 : l[r]) === k.TRUE ? k.FALSE : k.TRUE;
1246
+ return (l == null ? void 0 : l[r]) === z.TRUE ? z.FALSE : z.TRUE;
1241
1247
  if (/ul|st/.test(r))
1242
- return un(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s === k.TRUE ? {
1243
- s: k.FALSE
1248
+ return un(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s === z.TRUE ? {
1249
+ s: z.FALSE
1244
1250
  } : {
1245
- s: k.TRUE
1251
+ s: z.TRUE
1246
1252
  };
1247
1253
  if (/va/.test(r))
1248
- return e === se.id ? (l == null ? void 0 : l[r]) === j.SUBSCRIPT ? j.NORMAL : j.SUBSCRIPT : (l == null ? void 0 : l[r]) === j.SUPERSCRIPT ? j.NORMAL : j.SUPERSCRIPT;
1254
+ return e === oe.id ? (l == null ? void 0 : l[r]) === G.SUBSCRIPT ? G.NORMAL : G.SUBSCRIPT : (l == null ? void 0 : l[r]) === G.SUPERSCRIPT ? G.NORMAL : G.SUPERSCRIPT;
1249
1255
  n++;
1250
1256
  }
1251
1257
  }
1252
- return /bl|it/.test(r) ? k.TRUE : /ul|st/.test(r) ? {
1253
- s: k.TRUE
1254
- } : e === se.id ? j.SUBSCRIPT : j.SUPERSCRIPT;
1258
+ return /bl|it/.test(r) ? z.TRUE : /ul|st/.test(r) ? {
1259
+ s: z.TRUE
1260
+ } : e === oe.id ? G.SUBSCRIPT : G.SUPERSCRIPT;
1255
1261
  }
1256
- const Ge = {
1262
+ const He = {
1257
1263
  id: "doc.command.list-operation",
1258
1264
  type: v.COMMAND,
1259
- handler: (s, e) => {
1265
+ handler: (o, e) => {
1260
1266
  var O, U, w, X;
1261
- const t = s.get(T), n = s.get(E), o = s.get(I), { listType: r } = e, i = n.getCurrentUniverDocInstance();
1267
+ const t = o.get(T), n = o.get(E), s = o.get(I), { listType: r } = e, i = n.getCurrentUniverDocInstance();
1262
1268
  if (!i)
1263
1269
  return !1;
1264
1270
  const a = t.getActiveRange(), c = (O = t.getSelections()) != null ? O : [], d = (U = i.getBody()) == null ? void 0 : U.paragraphs, l = c.map(Z);
@@ -1270,8 +1276,8 @@ const Ge = {
1270
1276
  });
1271
1277
  let f = Q.generateRandomId(6);
1272
1278
  if (u.length === 1) {
1273
- const Y = d.indexOf(u[0]), $ = d[Y - 1], z = d[Y + 1];
1274
- $ && $.bullet && $.bullet.listType === r ? f = $.bullet.listId : z && z.bullet && z.bullet.listType === r && (f = z.bullet.listId);
1279
+ const Y = d.indexOf(u[0]), $ = d[Y - 1], k = d[Y + 1];
1280
+ $ && $.bullet && $.bullet.listType === r ? f = $.bullet.listId : k && k.bullet && k.bullet.listType === r && (f = k.bullet.listId);
1275
1281
  }
1276
1282
  const S = {
1277
1283
  id: L.id,
@@ -1280,38 +1286,38 @@ const Ge = {
1280
1286
  actions: [],
1281
1287
  textRanges: l
1282
1288
  }
1283
- }, _ = new oe();
1289
+ }, _ = new se();
1284
1290
  _.reset();
1285
- const R = new P(), M = (w = i.getSnapshot().lists) != null ? w : {}, C = {
1291
+ const R = new b(), M = (w = i.getSnapshot().lists) != null ? w : {}, C = {
1286
1292
  ...At,
1287
1293
  ...M
1288
- }, { charSpace: D, defaultTabStop: A = 36, gridType: b } = i.getSnapshot().documentStyle;
1294
+ }, { charSpace: D, defaultTabStop: A = 36, gridType: P } = i.getSnapshot().documentStyle;
1289
1295
  for (const Y of u) {
1290
- const { startIndex: $, paragraphStyle: z = {} } = Y, { indentFirstLine: Rt = 0, snapToGrid: xt, indentStart: _e = 0 } = z, { hanging: ve, indentStart: He } = C[r].nestingLevel[0], Ie = $t(D, A, b, xt);
1296
+ const { startIndex: $, paragraphStyle: k = {} } = Y, { indentFirstLine: Rt = 0, snapToGrid: xt, indentStart: _e = 0 } = k, { hanging: ve, indentStart: Xe } = C[r].nestingLevel[0], Ie = $t(D, A, P, xt);
1291
1297
  R.push({
1292
- t: y.RETAIN,
1298
+ t: x.RETAIN,
1293
1299
  len: $ - _.cursor,
1294
1300
  segmentId: m
1295
1301
  }), R.push({
1296
- t: y.RETAIN,
1302
+ t: x.RETAIN,
1297
1303
  len: 1,
1298
1304
  body: {
1299
1305
  dataStream: "",
1300
1306
  paragraphs: [
1301
1307
  p ? {
1302
1308
  paragraphStyle: {
1303
- ...z,
1309
+ ...k,
1304
1310
  hanging: void 0,
1305
- indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - He) : void 0
1311
+ indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - Xe) : void 0
1306
1312
  },
1307
1313
  startIndex: 0
1308
1314
  } : {
1309
1315
  startIndex: 0,
1310
1316
  paragraphStyle: {
1311
- ...z,
1317
+ ...k,
1312
1318
  indentFirstLine: void 0,
1313
1319
  hanging: ve,
1314
- indentStart: He - ve + Me(Rt, Ie) + Me(_e, Ie)
1320
+ indentStart: Xe - ve + Me(Rt, Ie) + Me(_e, Ie)
1315
1321
  },
1316
1322
  bullet: {
1317
1323
  ...(X = Y.bullet) != null ? X : {
@@ -1330,36 +1336,36 @@ const Ge = {
1330
1336
  coverType: Ee.REPLACE
1331
1337
  }), _.moveCursorTo($ + 1);
1332
1338
  }
1333
- return S.params.actions = R.serialize(), !!o.syncExecuteCommand(S.id, S.params);
1339
+ return S.params.actions = R.serialize(), !!s.syncExecuteCommand(S.id, S.params);
1334
1340
  }
1335
1341
  }, gn = {
1336
1342
  id: "doc.command.bullet-list",
1337
1343
  type: v.COMMAND,
1338
- handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1339
- listType: ut.BULLET_LIST
1344
+ handler: (o) => o.get(I).syncExecuteCommand(He.id, {
1345
+ listType: mt.BULLET_LIST
1340
1346
  })
1341
1347
  }, fn = {
1342
1348
  id: "doc.command.order-list",
1343
1349
  type: v.COMMAND,
1344
- handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1345
- listType: ut.ORDER_LIST
1350
+ handler: (o) => o.get(I).syncExecuteCommand(He.id, {
1351
+ listType: mt.ORDER_LIST
1346
1352
  })
1347
1353
  };
1348
- function Mt(s, e) {
1349
- const { startOffset: t, endOffset: n } = s, o = [];
1354
+ function Mt(o, e) {
1355
+ const { startOffset: t, endOffset: n } = o, s = [];
1350
1356
  let r = -1;
1351
1357
  for (const i of e) {
1352
1358
  const { startIndex: a } = i;
1353
- (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && o.push(i), r = a;
1359
+ (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && s.push(i), r = a;
1354
1360
  }
1355
- return o;
1361
+ return s;
1356
1362
  }
1357
1363
  const ie = {
1358
1364
  id: "doc.command.align-operation",
1359
1365
  type: v.COMMAND,
1360
- handler: (s, e) => {
1366
+ handler: (o, e) => {
1361
1367
  var R, M;
1362
- const t = s.get(T), n = s.get(E), o = s.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance();
1368
+ const t = o.get(T), n = o.get(E), s = o.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance();
1363
1369
  if (!i)
1364
1370
  return !1;
1365
1371
  const a = t.getActiveRange(), c = (R = t.getSelections()) != null ? R : [], d = (M = i.getBody()) == null ? void 0 : M.paragraphs, l = c.map(Z);
@@ -1375,13 +1381,13 @@ const ie = {
1375
1381
  actions: [],
1376
1382
  textRanges: l
1377
1383
  }
1378
- }, f = new oe();
1384
+ }, f = new se();
1379
1385
  f.reset();
1380
- const S = new P();
1386
+ const S = new b();
1381
1387
  for (const C of u) {
1382
1388
  const { startIndex: D } = C;
1383
1389
  S.push({
1384
- t: y.RETAIN,
1390
+ t: x.RETAIN,
1385
1391
  len: D - f.cursor,
1386
1392
  segmentId: m
1387
1393
  });
@@ -1390,7 +1396,7 @@ const ie = {
1390
1396
  horizontalAlign: p ? re.UNSPECIFIED : r
1391
1397
  };
1392
1398
  S.push({
1393
- t: y.RETAIN,
1399
+ t: x.RETAIN,
1394
1400
  len: 1,
1395
1401
  body: {
1396
1402
  dataStream: "",
@@ -1406,90 +1412,90 @@ const ie = {
1406
1412
  coverType: Ee.REPLACE
1407
1413
  }), f.moveCursorTo(D + 1);
1408
1414
  }
1409
- return h.params.actions = S.serialize(), !!o.syncExecuteCommand(h.id, h.params);
1415
+ return h.params.actions = S.serialize(), !!s.syncExecuteCommand(h.id, h.params);
1410
1416
  }
1411
1417
  }, hn = {
1412
1418
  id: "doc.command.align-left",
1413
1419
  type: v.COMMAND,
1414
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1420
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1415
1421
  alignType: re.LEFT
1416
1422
  })
1417
1423
  }, pn = {
1418
1424
  id: "doc.command.align-center",
1419
1425
  type: v.COMMAND,
1420
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1426
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1421
1427
  alignType: re.CENTER
1422
1428
  })
1423
1429
  }, Sn = {
1424
1430
  id: "doc.command.align-right",
1425
1431
  type: v.COMMAND,
1426
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1432
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1427
1433
  alignType: re.RIGHT
1428
1434
  })
1429
1435
  }, _n = {
1430
1436
  id: "doc.command.align-justify",
1431
1437
  type: v.COMMAND,
1432
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1438
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1433
1439
  alignType: re.JUSTIFIED
1434
1440
  })
1435
1441
  }, vn = {
1436
1442
  id: "doc.command-replace-content",
1437
1443
  type: v.COMMAND,
1438
- handler: async (s, e) => {
1444
+ handler: async (o, e) => {
1439
1445
  var g;
1440
- const { unitId: t, body: n, textRanges: o, segmentId: r = "" } = e, i = s.get(E), a = s.get(I), c = s.get(T), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
1446
+ const { unitId: t, body: n, textRanges: s, segmentId: r = "" } = e, i = o.get(E), a = o.get(I), c = o.get(T), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
1441
1447
  if (d == null || !Array.isArray(l) || l.length === 0)
1442
1448
  return !1;
1443
1449
  const u = Ct(t, r, d, n);
1444
- return u.params.textRanges = o, !!a.syncExecuteCommand(u.id, u.params);
1450
+ return u.params.textRanges = s, !!a.syncExecuteCommand(u.id, u.params);
1445
1451
  }
1446
1452
  }, In = {
1447
1453
  id: "doc.command-cover-content",
1448
1454
  type: v.COMMAND,
1449
- handler: async (s, e) => {
1455
+ handler: async (o, e) => {
1450
1456
  var l;
1451
- const { unitId: t, body: n, segmentId: o = "" } = e, r = s.get(E), i = s.get(I), a = s.get(Te), c = (l = r.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1457
+ const { unitId: t, body: n, segmentId: s = "" } = e, r = o.get(E), i = o.get(I), a = o.get(Te), c = (l = r.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1452
1458
  if (c == null)
1453
1459
  return !1;
1454
- const d = Ct(t, o, c, n);
1460
+ const d = Ct(t, s, c, n);
1455
1461
  return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, i.syncExecuteCommand(
1456
1462
  d.id,
1457
1463
  d.params
1458
1464
  ), a.clearUndoRedo(t), !0;
1459
1465
  }
1460
1466
  };
1461
- function Ct(s, e, t, n) {
1462
- const o = {
1467
+ function Ct(o, e, t, n) {
1468
+ const s = {
1463
1469
  id: L.id,
1464
1470
  params: {
1465
- unitId: s,
1471
+ unitId: o,
1466
1472
  actions: [],
1467
1473
  textRanges: []
1468
1474
  }
1469
- }, r = new P(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1475
+ }, r = new b(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1470
1476
  return i > 0 && r.push({
1471
- t: y.DELETE,
1477
+ t: x.DELETE,
1472
1478
  len: i,
1473
1479
  line: 0,
1474
1480
  segmentId: e
1475
1481
  }), n.dataStream.length > 0 && r.push({
1476
- t: y.INSERT,
1482
+ t: x.INSERT,
1477
1483
  body: n,
1478
1484
  len: n.dataStream.length,
1479
1485
  line: 0,
1480
1486
  segmentId: e
1481
- }), o.params.actions = r.serialize(), o;
1487
+ }), s.params.actions = r.serialize(), s;
1482
1488
  }
1483
1489
  const ye = {
1484
1490
  id: "doc.operation.move-cursor",
1485
1491
  type: v.OPERATION,
1486
- handler: (s, e) => !!e
1492
+ handler: (o, e) => !!e
1487
1493
  }, Oe = {
1488
1494
  id: "doc.operation.move-selection",
1489
1495
  type: v.OPERATION,
1490
- handler: (s, e) => !!e
1491
- }, Mn = (s, e) => {
1492
- const t = s.get(E).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1496
+ handler: (o, e) => !!e
1497
+ }, Mn = (o, e) => {
1498
+ const t = o.get(E).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1493
1499
  return {
1494
1500
  ...Q.deepClone(e),
1495
1501
  zoomRatio: n
@@ -1497,8 +1503,8 @@ const ye = {
1497
1503
  }, ce = {
1498
1504
  id: "doc.operation.set-zoom-ratio",
1499
1505
  type: v.OPERATION,
1500
- handler: (s, e) => {
1501
- const t = s.get(E).getUniverDocInstance(e.unitId);
1506
+ handler: (o, e) => {
1507
+ const t = o.get(E).getUniverDocInstance(e.unitId);
1502
1508
  if (!t)
1503
1509
  return !1;
1504
1510
  const n = t.getSnapshot();
@@ -1509,19 +1515,19 @@ const ye = {
1509
1515
  }, Cn = {
1510
1516
  type: v.COMMAND,
1511
1517
  id: "doc.command.set-zoom-ratio",
1512
- handler: async (s, e) => {
1518
+ handler: async (o, e) => {
1513
1519
  var u, m, g;
1514
- const t = s.get(I), n = s.get(Te), o = s.get(E);
1515
- let r = (u = o.getCurrentUniverDocInstance()) == null ? void 0 : u.getUnitId();
1520
+ const t = o.get(I), n = o.get(Te), s = o.get(E);
1521
+ let r = (u = s.getCurrentUniverDocInstance()) == null ? void 0 : u.getUnitId();
1516
1522
  if (!r)
1517
1523
  return !1;
1518
1524
  let i = 1;
1519
- if (e && (r = (m = e.documentId) != null ? m : r, i = (g = e.zoomRatio) != null ? g : i), !o.getUniverDocInstance(r))
1525
+ if (e && (r = (m = e.documentId) != null ? m : r, i = (g = e.zoomRatio) != null ? g : i), !s.getUniverDocInstance(r))
1520
1526
  return !1;
1521
1527
  const c = {
1522
1528
  zoomRatio: i,
1523
1529
  unitId: r
1524
- }, d = Mn(s, c);
1530
+ }, d = Mn(o, c);
1525
1531
  return t.syncExecuteCommand(ce.id, c) ? (n.pushUndoRedo({
1526
1532
  unitID: r,
1527
1533
  undoMutations: [{ id: ce.id, params: d }],
@@ -1531,36 +1537,36 @@ const ye = {
1531
1537
  }, Rn = {
1532
1538
  id: "doc.operation.select-all",
1533
1539
  type: v.COMMAND,
1534
- handler: async (s) => {
1535
- const e = s.get(E), t = s.get(T), n = e.getCurrentUniverDocInstance();
1540
+ handler: async (o) => {
1541
+ const e = o.get(E), t = o.get(T), n = e.getCurrentUniverDocInstance();
1536
1542
  if (!n)
1537
1543
  return !1;
1538
- const o = n.getSnapshot().body;
1539
- if (o == null)
1544
+ const s = n.getSnapshot().body;
1545
+ if (s == null)
1540
1546
  return !1;
1541
1547
  const r = [
1542
1548
  {
1543
1549
  startOffset: 0,
1544
- endOffset: o.dataStream.length - 2
1550
+ endOffset: s.dataStream.length - 2
1545
1551
  }
1546
1552
  ];
1547
1553
  return t.replaceTextRanges(r, !1), !0;
1548
1554
  }
1549
1555
  };
1550
- var xn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, On = (s, e, t, n) => {
1551
- for (var o = n > 1 ? void 0 : n ? yn(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1552
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1553
- return n && o && xn(e, t, o), o;
1554
- }, J = (s, e) => (t, n) => e(t, n, s);
1556
+ var xn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, On = (o, e, t, n) => {
1557
+ for (var s = n > 1 ? void 0 : n ? yn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1558
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1559
+ return n && s && xn(e, t, s), s;
1560
+ }, K = (o, e) => (t, n) => e(t, n, o);
1555
1561
  let le = class extends Ne {
1556
- constructor(e, t, n, o, r) {
1562
+ constructor(e, t, n, s, r) {
1557
1563
  super();
1558
- x(this, "_previousIMEContent", "");
1559
- x(this, "_isCompositionStart", !0);
1560
- x(this, "_onStartSubscription");
1561
- x(this, "_onUpdateSubscription");
1562
- x(this, "_onEndSubscription");
1563
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = o, this._commandService = r, this._initialize();
1564
+ y(this, "_previousIMEContent", "");
1565
+ y(this, "_isCompositionStart", !0);
1566
+ y(this, "_onStartSubscription");
1567
+ y(this, "_onUpdateSubscription");
1568
+ y(this, "_onEndSubscription");
1569
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService = r, this._initialize();
1564
1570
  }
1565
1571
  dispose() {
1566
1572
  var e, t, n;
@@ -1593,15 +1599,15 @@ let le = class extends Ne {
1593
1599
  const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
1594
1600
  if (e == null || n == null)
1595
1601
  return;
1596
- const o = this._univerInstanceService.getCurrentUniverDocInstance();
1597
- if (!o)
1602
+ const s = this._univerInstanceService.getCurrentUniverDocInstance();
1603
+ if (!s)
1598
1604
  return;
1599
1605
  const { event: r, activeRange: i } = e;
1600
1606
  if (n == null || i == null)
1601
1607
  return;
1602
1608
  const c = r.data;
1603
1609
  c === this._previousIMEContent && t || (await this._commandService.executeCommand(_t.id, {
1604
- unitId: o.getUnitId(),
1610
+ unitId: s.getUnitId(),
1605
1611
  newText: c,
1606
1612
  oldTextLen: this._previousIMEContent.length,
1607
1613
  isCompositionStart: this._isCompositionStart,
@@ -1614,28 +1620,26 @@ let le = class extends Ne {
1614
1620
  };
1615
1621
  le = On([
1616
1622
  De(Ae.Rendered, le),
1617
- J(0, V(H)),
1618
- J(1, E),
1619
- J(2, fe),
1620
- J(3, V(he)),
1621
- J(4, I)
1623
+ K(0, V(H)),
1624
+ K(1, E),
1625
+ K(2, fe),
1626
+ K(3, V(he)),
1627
+ K(4, I)
1622
1628
  ], le);
1623
- var Tn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Dn = (s, e, t, n) => {
1624
- for (var o = n > 1 ? void 0 : n ? En(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1625
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1626
- return n && o && Tn(e, t, o), o;
1627
- }, q = (s, e) => (t, n) => e(t, n, s);
1629
+ var Tn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Dn = (o, e, t, n) => {
1630
+ for (var s = n > 1 ? void 0 : n ? En(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1631
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1632
+ return n && s && Tn(e, t, s), s;
1633
+ }, J = (o, e) => (t, n) => e(t, n, o);
1628
1634
  let de = class extends Ne {
1629
- constructor(e, t, n, o, r) {
1635
+ constructor(e, t, n, s, r) {
1630
1636
  super();
1631
- x(this, "_onInputSubscription");
1632
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1637
+ y(this, "_onInputSubscription");
1638
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = r, this._commandExecutedListener();
1633
1639
  }
1634
1640
  dispose() {
1635
1641
  var e;
1636
- (e = this._onInputSubscription) == null || e.unsubscribe();
1637
- }
1638
- _initialize() {
1642
+ super.dispose(), (e = this._onInputSubscription) == null || e.unsubscribe();
1639
1643
  }
1640
1644
  _commandExecutedListener() {
1641
1645
  const e = [ye.id, Oe.id];
@@ -1657,8 +1661,8 @@ let de = class extends Ne {
1657
1661
  }
1658
1662
  _handleShiftMoveSelection(e) {
1659
1663
  var h, f, S;
1660
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), o = this._univerInstanceService.getCurrentUniverDocInstance();
1661
- if (!o)
1664
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._univerInstanceService.getCurrentUniverDocInstance();
1665
+ if (!s)
1662
1666
  return;
1663
1667
  const r = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, i = this._getDocObject();
1664
1668
  if (t == null || r == null || i == null)
@@ -1677,9 +1681,9 @@ let de = class extends Ne {
1677
1681
  ], !1);
1678
1682
  return;
1679
1683
  }
1680
- const m = l || u === We.FORWARD ? a : c;
1681
- let g = l || u === We.FORWARD ? c : a;
1682
- const p = (f = o.getBody().dataStream.length) != null ? f : Number.POSITIVE_INFINITY;
1684
+ const m = l || u === Ze.FORWARD ? a : c;
1685
+ let g = l || u === Ze.FORWARD ? c : a;
1686
+ const p = (f = s.getBody().dataStream.length) != null ? f : Number.POSITIVE_INFINITY;
1683
1687
  if (e === N.LEFT || e === N.RIGHT) {
1684
1688
  const _ = r.findNodeByCharIndex(g - 1), R = r.findNodeByCharIndex(g);
1685
1689
  g = e === N.RIGHT ? g + R.count : g - ((S = _ == null ? void 0 : _.count) != null ? S : 0), g = Math.min(p - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
@@ -1704,7 +1708,7 @@ let de = class extends Ne {
1704
1708
  ], !1);
1705
1709
  return;
1706
1710
  }
1707
- const C = new Ze(R, r).getRangePointData(
1711
+ const C = new Ke(R, r).getRangePointData(
1708
1712
  M,
1709
1713
  M
1710
1714
  ).cursorList[0];
@@ -1719,13 +1723,13 @@ let de = class extends Ne {
1719
1723
  }
1720
1724
  _handleMoveCursor(e) {
1721
1725
  var m, g, p;
1722
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), o = this._univerInstanceService.getCurrentUniverDocInstance();
1723
- if (!o)
1726
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._univerInstanceService.getCurrentUniverDocInstance();
1727
+ if (!s)
1724
1728
  return !1;
1725
1729
  const r = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, i = this._getDocObject();
1726
1730
  if (t == null || r == null || i == null || n == null)
1727
1731
  return;
1728
- const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, u = (g = o.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
1732
+ const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, u = (g = s.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
1729
1733
  if (e === N.LEFT || e === N.RIGHT) {
1730
1734
  let h;
1731
1735
  if (!t.collapsed || n.length > 1) {
@@ -1761,7 +1765,7 @@ let de = class extends Ne {
1761
1765
  ], !1);
1762
1766
  return;
1763
1767
  }
1764
- const R = new Ze(S, r).getRangePointData(
1768
+ const R = new Ke(S, r).getRangePointData(
1765
1769
  _,
1766
1770
  _
1767
1771
  ).cursorList[0];
@@ -1776,10 +1780,10 @@ let de = class extends Ne {
1776
1780
  _getTopOrBottomPosition(e, t, n) {
1777
1781
  if (t == null)
1778
1782
  return;
1779
- const o = this._getSpanLeftOffsetInLine(t), r = this._getNextOrPrevLine(t, n);
1783
+ const s = this._getSpanLeftOffsetInLine(t), r = this._getNextOrPrevLine(t, n);
1780
1784
  if (r == null)
1781
1785
  return;
1782
- const i = this._matchPositionByLeftOffset(e, r, o);
1786
+ const i = this._matchPositionByLeftOffset(e, r, s);
1783
1787
  if (i != null)
1784
1788
  return { ...i, isBack: !0 };
1785
1789
  }
@@ -1787,35 +1791,35 @@ let de = class extends Ne {
1787
1791
  const t = e.parent;
1788
1792
  if (t == null)
1789
1793
  return Number.NEGATIVE_INFINITY;
1790
- const n = t.left, { left: o } = e;
1791
- return n + o;
1794
+ const n = t.left, { left: s } = e;
1795
+ return n + s;
1792
1796
  }
1793
1797
  _matchPositionByLeftOffset(e, t, n) {
1794
- const o = {
1798
+ const s = {
1795
1799
  distance: Number.POSITIVE_INFINITY
1796
1800
  };
1797
1801
  for (const r of t.divides) {
1798
1802
  const i = r.left;
1799
1803
  for (const a of r.glyphGroup) {
1800
1804
  const { left: c } = a, d = i + c, l = Math.abs(n - d);
1801
- l < o.distance && (o.glyph = a, o.distance = l);
1805
+ l < s.distance && (s.glyph = a, s.distance = l);
1802
1806
  }
1803
1807
  }
1804
- if (o.glyph != null)
1805
- return e.findPositionByGlyph(o.glyph);
1808
+ if (s.glyph != null)
1809
+ return e.findPositionByGlyph(s.glyph);
1806
1810
  }
1807
1811
  _getNextOrPrevLine(e, t) {
1808
- var p, h, f, S, _, R, M, C, D, A, b, B;
1812
+ var p, h, f, S, _, R, M, C, D, A, P, B;
1809
1813
  const n = e.parent;
1810
1814
  if (n == null)
1811
1815
  return;
1812
- const o = n.parent;
1813
- if (o == null)
1816
+ const s = n.parent;
1817
+ if (s == null)
1814
1818
  return;
1815
- const r = o.parent;
1819
+ const r = s.parent;
1816
1820
  if (r == null)
1817
1821
  return;
1818
- const i = r.lines.indexOf(o);
1822
+ const i = r.lines.indexOf(s);
1819
1823
  if (i === -1)
1820
1824
  return;
1821
1825
  let a;
@@ -1857,7 +1861,7 @@ let de = class extends Ne {
1857
1861
  if (t === !0)
1858
1862
  a = (A = (D = (C = m.pages[g + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : D.columns[0]) == null ? void 0 : A.lines[0];
1859
1863
  else {
1860
- const O = (b = m.pages[g - 1]) == null ? void 0 : b.sections;
1864
+ const O = (P = m.pages[g - 1]) == null ? void 0 : P.sections;
1861
1865
  if (O == null)
1862
1866
  return;
1863
1867
  const U = (B = O[O.length - 1]) == null ? void 0 : B.columns, w = U[U.length - 1], X = w == null ? void 0 : w.lines;
@@ -1868,33 +1872,33 @@ let de = class extends Ne {
1868
1872
  }
1869
1873
  }
1870
1874
  _getDocObject() {
1871
- return gt(this._univerInstanceService, this._renderManagerService);
1875
+ return Gt(this._univerInstanceService, this._renderManagerService);
1872
1876
  }
1873
1877
  };
1874
1878
  de = Dn([
1875
1879
  De(Ae.Rendered, de),
1876
- q(0, V(H)),
1877
- q(1, E),
1878
- q(2, mt),
1879
- q(3, V(T)),
1880
- q(4, I)
1880
+ J(0, V(H)),
1881
+ J(1, E),
1882
+ J(2, gt),
1883
+ J(3, V(T)),
1884
+ J(4, I)
1881
1885
  ], de);
1882
- var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, bn = (s, e, t, n) => {
1883
- for (var o = n > 1 ? void 0 : n ? Nn(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1884
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1885
- return n && o && An(e, t, o), o;
1886
- }, K = (s, e) => (t, n) => e(t, n, s);
1886
+ var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Pn = (o, e, t, n) => {
1887
+ for (var s = n > 1 ? void 0 : n ? Nn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1888
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1889
+ return n && s && An(e, t, s), s;
1890
+ }, q = (o, e) => (t, n) => e(t, n, o);
1887
1891
  let ue = class extends Ne {
1888
- constructor(e, t, n, o, r) {
1892
+ constructor(e, t, n, s, r) {
1889
1893
  super();
1890
- x(this, "_onInputSubscription");
1891
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1894
+ y(this, "_onInputSubscription");
1895
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = r, this._init();
1892
1896
  }
1893
1897
  dispose() {
1894
1898
  var e;
1895
- (e = this._onInputSubscription) == null || e.unsubscribe();
1899
+ super.dispose(), (e = this._onInputSubscription) == null || e.unsubscribe();
1896
1900
  }
1897
- _initialize() {
1901
+ _init() {
1898
1902
  this._initialNormalInput();
1899
1903
  }
1900
1904
  _initialNormalInput() {
@@ -1905,7 +1909,7 @@ let ue = class extends Ne {
1905
1909
  const t = this._univerInstanceService.getCurrentUniverDocInstance();
1906
1910
  if (!t)
1907
1911
  return;
1908
- const n = t.getUnitId(), { event: o, content: r = "", activeRange: i } = e, a = o, c = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
1912
+ const n = t.getUnitId(), { event: s, content: r = "", activeRange: i } = e, a = s, c = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
1909
1913
  if (a.data == null || c == null || !c || !i)
1910
1914
  return;
1911
1915
  const { startOffset: d, segmentId: l, style: u } = i, m = r.length, g = [
@@ -1926,36 +1930,25 @@ let ue = class extends Ne {
1926
1930
  });
1927
1931
  });
1928
1932
  }
1929
- _commandExecutedListener() {
1930
- }
1931
- _getDocObject() {
1932
- return gt(this._univerInstanceService, this._renderManagerService);
1933
- }
1934
1933
  };
1935
- ue = bn([
1934
+ ue = Pn([
1936
1935
  De(Ae.Rendered, ue),
1937
- K(0, V(H)),
1938
- K(1, E),
1939
- K(2, mt),
1940
- K(3, fe),
1941
- K(4, I)
1936
+ q(0, V(H)),
1937
+ q(1, E),
1938
+ q(2, gt),
1939
+ q(3, fe),
1940
+ q(4, I)
1942
1941
  ], ue);
1943
- var Pn = Object.defineProperty, Un = Object.getOwnPropertyDescriptor, wn = (s, e, t, n) => {
1944
- for (var o = n > 1 ? void 0 : n ? Un(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1945
- (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1946
- return n && o && Pn(e, t, o), o;
1947
- }, Ln = (s, e) => (t, n) => e(t, n, s);
1948
- const Bn = {
1949
- hasScroll: !0
1950
- }, Fn = "docs";
1942
+ var bn = Object.defineProperty, Un = Object.getOwnPropertyDescriptor, wn = (o, e, t, n) => {
1943
+ for (var s = n > 1 ? void 0 : n ? Un(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1944
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1945
+ return n && s && bn(e, t, s), s;
1946
+ }, Ln = (o, e) => (t, n) => e(t, n, o);
1947
+ const Bn = "docs";
1951
1948
  var ae;
1952
- let lt = (ae = class extends Nt {
1953
- constructor(e = {}, t) {
1954
- super();
1955
- x(this, "_config");
1956
- this._injector = t, this._config = Object.assign(Bn, e), this._initializeDependencies(t), this._initializeCommands();
1957
- }
1958
- initialize() {
1949
+ let dt = (ae = class extends Nt {
1950
+ constructor(o = {}, e) {
1951
+ super(), this._injector = e, this._initializeDependencies(e), this._initializeCommands();
1959
1952
  }
1960
1953
  _initializeCommands() {
1961
1954
  [
@@ -1963,24 +1956,24 @@ let lt = (ae = class extends Nt {
1963
1956
  Oe,
1964
1957
  cn,
1965
1958
  ln,
1966
- Ue,
1967
1959
  we,
1968
1960
  Le,
1969
1961
  Be,
1970
- se,
1971
1962
  Fe,
1963
+ oe,
1972
1964
  $e,
1973
1965
  Ve,
1966
+ ke,
1974
1967
  ze,
1975
1968
  je,
1976
- ke,
1969
+ Ge,
1977
1970
  It,
1978
1971
  nn,
1979
1972
  pe,
1980
1973
  Se,
1981
1974
  ht,
1982
1975
  _t,
1983
- Pe,
1976
+ Ue,
1984
1977
  L,
1985
1978
  vn,
1986
1979
  In,
@@ -1990,20 +1983,17 @@ let lt = (ae = class extends Nt {
1990
1983
  Rn,
1991
1984
  fn,
1992
1985
  gn,
1993
- Ge,
1986
+ He,
1994
1987
  hn,
1995
1988
  pn,
1996
1989
  Sn,
1997
1990
  ie,
1998
1991
  _n
1999
- ].forEach((e) => {
2000
- this._injector.get(I).registerCommand(e);
1992
+ ].forEach((o) => {
1993
+ this._injector.get(I).registerCommand(o);
2001
1994
  });
2002
1995
  }
2003
- onReady() {
2004
- this.initialize();
2005
- }
2006
- _initializeDependencies(e) {
1996
+ _initializeDependencies(o) {
2007
1997
  [
2008
1998
  // services
2009
1999
  [H],
@@ -2021,12 +2011,12 @@ let lt = (ae = class extends Nt {
2021
2011
  [ue],
2022
2012
  [le],
2023
2013
  [de]
2024
- ].forEach((t) => e.add(t));
2014
+ ].forEach((e) => o.add(e));
2025
2015
  }
2026
- }, x(ae, "pluginName", Fn), x(ae, "type", W.UNIVER_DOC), ae);
2027
- lt = wn([
2028
- Ln(1, V(zt))
2029
- ], lt);
2016
+ }, y(ae, "pluginName", Bn), y(ae, "type", W.UNIVER_DOC), ae);
2017
+ dt = wn([
2018
+ Ln(1, V(kt))
2019
+ ], dt);
2030
2020
  export {
2031
2021
  pn as AlignCenterCommand,
2032
2022
  _n as AlignJustifyCommand,
@@ -2037,10 +2027,11 @@ export {
2037
2027
  gn as BulletListCommand,
2038
2028
  In as CoverContentCommand,
2039
2029
  pt as CutContentCommand,
2040
- Yn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2041
- Xn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2042
- Hn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2043
- kt as DOCS_VIEW_KEY,
2030
+ Gn as DOCS_COMPONENT_BACKGROUND_LAYER_INDEX,
2031
+ Xn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2032
+ Hn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2033
+ jn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2034
+ Pe as DOCS_VIEW_KEY,
2044
2035
  Se as DeleteCommand,
2045
2036
  cn as DeleteLeftCommand,
2046
2037
  ln as DeleteRightCommand,
@@ -2053,7 +2044,7 @@ export {
2053
2044
  pe as InsertCommand,
2054
2045
  ye as MoveCursorOperation,
2055
2046
  Oe as MoveSelectionOperation,
2056
- Wn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2047
+ Yn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2057
2048
  fn as OrderListCommand,
2058
2049
  vn as ReplaceContentCommand,
2059
2050
  je as ResetInlineFormatTextBackgroundColorCommand,
@@ -2061,23 +2052,23 @@ export {
2061
2052
  Rn as SelectAllOperation,
2062
2053
  Cn as SetDocZoomRatioCommand,
2063
2054
  ce as SetDocZoomRatioOperation,
2064
- Ue as SetInlineFormatBoldCommand,
2055
+ we as SetInlineFormatBoldCommand,
2065
2056
  It as SetInlineFormatCommand,
2066
- Ve as SetInlineFormatFontFamilyCommand,
2067
- $e as SetInlineFormatFontSizeCommand,
2068
- we as SetInlineFormatItalicCommand,
2069
- Be as SetInlineFormatStrikethroughCommand,
2070
- se as SetInlineFormatSubscriptCommand,
2071
- Fe as SetInlineFormatSuperscriptCommand,
2072
- ke as SetInlineFormatTextBackgroundColorCommand,
2057
+ ke as SetInlineFormatFontFamilyCommand,
2058
+ Ve as SetInlineFormatFontSizeCommand,
2059
+ Le as SetInlineFormatItalicCommand,
2060
+ Fe as SetInlineFormatStrikethroughCommand,
2061
+ oe as SetInlineFormatSubscriptCommand,
2062
+ $e as SetInlineFormatSuperscriptCommand,
2063
+ Ge as SetInlineFormatTextBackgroundColorCommand,
2073
2064
  ze as SetInlineFormatTextColorCommand,
2074
- Le as SetInlineFormatUnderlineCommand,
2065
+ Be as SetInlineFormatUnderlineCommand,
2075
2066
  ft as SetTextSelectionsOperation,
2076
2067
  T as TextSelectionManagerService,
2077
- lt as UniverDocsPlugin,
2068
+ dt as UniverDocsPlugin,
2078
2069
  ht as UpdateCommand,
2079
- jt as VIEWPORT_KEY,
2080
- gt as getDocObject,
2081
- Gn as getDocObjectById,
2070
+ zt as VIEWPORT_KEY,
2071
+ Gt as getDocObject,
2072
+ Wn as getDocObjectById,
2082
2073
  Z as serializeTextRange
2083
2074
  };