@univerjs/docs 0.1.9 → 0.1.10

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,56 @@
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";
1
+ var Ot = Object.defineProperty;
2
+ var Tt = (o, e, t) => e in o ? Ot(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var x = (o, e, t) => (Tt(o, 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 ut, IUniverInstanceService as E, IUndoRedoService as Te, UndoCommandId as Ye, RedoCommandId as We, TextX as P, DataStreamTreeTokenType as xe, Tools as Q, LocaleService as Et, MemoryCursor as se, getDocsUpdateBody as Dt, UpdateDocsAttributeType as Ee, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as At, BooleanNumber as k, BaselineOffset as G, PRESET_LIST_TYPE as Nt, PresetListType as mt, HorizontalAlign as re, OnLifecycle as De, LifecycleStages as Ae, Disposable as Ne, Direction as N, Plugin as bt } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as fe, DocumentViewModel as Ut, DocumentSkeleton as wt, hasListGlyph as Lt, isIndentByGlyph as Bt, isFirstGlyph as Ft, getParagraphByGlyph as $t, getCharSpaceApply as Vt, getNumberUnitValue as Me, RANGE_DIRECTION as Ze, NodePositionConvertToCursor as Ke, IRenderManagerService as gt, TextSelectionRenderManager as zt } 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 be = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(be || {}), Gt = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Gt || {});
9
+ const jn = 0, Hn = 2, Xn = 4, Yn = 10, Wn = "normalTextSelectionPluginName";
10
+ function ft(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(be.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 Zn(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(be.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 ht = {
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) {
@@ -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;
133
- this._commandService.executeCommand(ft.id, {
135
+ const { unitId: n, subUnitId: s, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
136
+ this._commandService.executeCommand(ht.id, {
134
137
  unitId: n,
135
- subUnitId: o,
138
+ subUnitId: s,
136
139
  segmentId: r,
137
140
  style: i,
138
141
  isEditing: c,
@@ -140,33 +143,33 @@ 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 Pe(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
174
  t: y.RETAIN,
172
175
  len: i,
@@ -178,11 +181,11 @@ function be(s, e = "", t = 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();
@@ -226,33 +229,33 @@ 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 Ut(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) {
@@ -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,7 +300,7 @@ 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
305
  actions: n.reduce((l, u) => P.compose(l, u.redoState.actions), []),
303
306
  textRanges: a.redoState.textRanges
@@ -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) => P.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) => P.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,8 +395,8 @@ 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
401
  const b = {
398
402
  commandId: qe,
@@ -401,7 +405,7 @@ const qe = "doc.mutation.rich-text-editing", L = {
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,
@@ -424,8 +428,8 @@ 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,
@@ -436,22 +440,22 @@ const qe = "doc.mutation.rich-text-editing", L = {
436
440
  return d ? c > 0 && u.push({
437
441
  t: y.RETAIN,
438
442
  len: c,
439
- segmentId: o
440
- }) : u.push(...be(n, o)), u.push({
443
+ segmentId: s
444
+ }) : u.push(...Pe(n, s)), u.push({
441
445
  t: y.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,
@@ -462,19 +466,19 @@ const Se = {
462
466
  return d > 0 && u.push({
463
467
  t: y.RETAIN,
464
468
  len: i === 0 ? d - c : d,
465
- segmentId: o
469
+ segmentId: s
466
470
  }), u.push({
467
471
  t: y.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
- }, ht = {
477
+ }, pt = {
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,
@@ -488,17 +492,17 @@ const Se = {
488
492
  segmentId: n
489
493
  }), l.push({
490
494
  t: y.RETAIN,
491
- body: o,
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,17 +534,17 @@ 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();
@@ -601,19 +605,19 @@ let H = class extends ge {
601
605
  return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
602
606
  }
603
607
  _buildSkeleton(e) {
604
- return Ut.create(e, this._localeService);
608
+ return wt.create(e, this._localeService);
605
609
  }
606
610
  };
607
611
  H = rn([
608
- Re(0, V(Tt)),
612
+ Re(0, V(Et)),
609
613
  Re(1, V(ne)),
610
614
  Re(2, E)
611
615
  ], H);
612
- const Zn = {
616
+ const Kn = {
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,9 +628,9 @@ 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
635
  const g = new P();
632
636
  for (const h of c) {
@@ -635,7 +639,7 @@ const Zn = {
635
639
  t: y.RETAIN,
636
640
  len: R,
637
641
  segmentId: t
638
- }) : g.push(...be(h, t, m.cursor)), g.push({
642
+ }) : g.push(...Pe(h, t, m.cursor)), g.push({
639
643
  t: y.INSERT,
640
644
  body: n,
641
645
  len: n.dataStream.length,
@@ -645,18 +649,18 @@ const Zn = {
645
649
  }
646
650
  return u.params.actions = g.serialize(), !!r.syncExecuteCommand(u.id, u.params);
647
651
  }
648
- }, pt = {
652
+ }, St = {
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();
657
661
  if (!c)
658
662
  return !1;
659
- const d = i.getUniverDocInstance(c), l = Et(d.snapshot, t);
663
+ const d = i.getUniverDocInstance(c), l = Dt(d.snapshot, t);
660
664
  if (l == null)
661
665
  return !1;
662
666
  const u = {
@@ -666,7 +670,7 @@ const Zn = {
666
670
  actions: [],
667
671
  textRanges: n
668
672
  }
669
- }, m = new oe();
673
+ }, m = new se();
670
674
  m.reset();
671
675
  const g = new P();
672
676
  for (const f of a) {
@@ -677,11 +681,11 @@ const Zn = {
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({
@@ -717,20 +721,20 @@ 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
+ handler: async (o) => {
721
725
  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;
726
+ 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
727
  let c = !0;
724
728
  if (r == null || a == null || i == null)
725
729
  return !1;
726
730
  const d = n.getCurrentUniverDocInstance();
727
731
  if (!d)
728
732
  return !1;
729
- const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = wt(p), f = Lt(p, d.getBody());
733
+ const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = Lt(p), f = Bt(p, d.getBody());
730
734
  let S = l;
731
735
  const _ = a.findNodeByCharIndex(l - 1);
732
- if (Bt(p) && _ !== p && (h === !0 || f === !0)) {
733
- const C = Ft(p, d.getBody());
736
+ if (Ft(p) && _ !== p && (h === !0 || f === !0)) {
737
+ const C = $t(p, d.getBody());
734
738
  if (C == null)
735
739
  return !1;
736
740
  const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 }, b = C.paragraphStyle;
@@ -752,7 +756,7 @@ const cn = {
752
756
  style: g
753
757
  }
754
758
  ];
755
- c = await o.executeCommand(ht.id, {
759
+ c = await s.executeCommand(pt.id, {
756
760
  unitId: d.getUnitId(),
757
761
  updateBody: {
758
762
  dataStream: "",
@@ -770,8 +774,8 @@ const cn = {
770
774
  if (_ == null)
771
775
  return !0;
772
776
  if (_.content === "\r")
773
- c = await o.executeCommand(Pe.id, {
774
- direction: G.LEFT,
777
+ c = await s.executeCommand(Ue.id, {
778
+ direction: j.LEFT,
775
779
  range: r
776
780
  });
777
781
  else {
@@ -783,18 +787,18 @@ const cn = {
783
787
  style: g
784
788
  }
785
789
  ];
786
- c = await o.executeCommand(Se.id, {
790
+ c = await s.executeCommand(Se.id, {
787
791
  unitId: d.getUnitId(),
788
792
  range: r,
789
793
  segmentId: m,
790
- direction: G.LEFT,
794
+ direction: j.LEFT,
791
795
  len: _.count,
792
796
  textRanges: C
793
797
  });
794
798
  }
795
799
  } else {
796
- const C = St(r, i);
797
- c = await o.executeCommand(pt.id, {
800
+ const C = _t(r, i);
801
+ c = await s.executeCommand(St.id, {
798
802
  segmentId: m,
799
803
  textRanges: C
800
804
  });
@@ -804,9 +808,9 @@ const cn = {
804
808
  }, ln = {
805
809
  id: "doc.command.delete-right",
806
810
  type: v.COMMAND,
807
- handler: async (s) => {
811
+ handler: async (o) => {
808
812
  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;
813
+ 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
814
  let c;
811
815
  if (r == null || a == null || i == null)
812
816
  return !1;
@@ -819,8 +823,8 @@ const cn = {
819
823
  if (u === !0) {
820
824
  const h = a.findNodeByCharIndex(l);
821
825
  if (h.content === "\r")
822
- c = await o.executeCommand(Pe.id, {
823
- direction: G.RIGHT,
826
+ c = await s.executeCommand(Ue.id, {
827
+ direction: j.RIGHT,
824
828
  range: r
825
829
  });
826
830
  else {
@@ -831,30 +835,30 @@ const cn = {
831
835
  style: g
832
836
  }
833
837
  ];
834
- c = await o.executeCommand(Se.id, {
838
+ c = await s.executeCommand(Se.id, {
835
839
  unitId: d.getUnitId(),
836
840
  range: r,
837
841
  segmentId: m,
838
- direction: G.RIGHT,
842
+ direction: j.RIGHT,
839
843
  textRanges: f,
840
844
  len: h.count
841
845
  });
842
846
  }
843
847
  } else {
844
- const h = St(r, i);
845
- c = await o.executeCommand(pt.id, {
848
+ const h = _t(r, i);
849
+ c = await s.executeCommand(St.id, {
846
850
  segmentId: m,
847
851
  textRanges: h
848
852
  });
849
853
  }
850
854
  return c;
851
855
  }
852
- }, Pe = {
856
+ }, Ue = {
853
857
  id: "doc.command.merge-two-paragraph",
854
858
  type: v.COMMAND,
855
- handler: async (s, e) => {
859
+ handler: async (o, e) => {
856
860
  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();
861
+ 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
862
  if (a == null || c == null)
859
863
  return !1;
860
864
  const d = n.getCurrentUniverDocInstance();
@@ -863,7 +867,7 @@ const cn = {
863
867
  const { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
864
868
  if (!u)
865
869
  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 = [
870
+ const p = r === j.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 === j.LEFT ? l - 1 : l, _ = d.getUnitId(), R = [
867
871
  {
868
872
  startOffset: S,
869
873
  endOffset: S,
@@ -880,7 +884,7 @@ const cn = {
880
884
  }, C = new P();
881
885
  return C.push({
882
886
  t: y.RETAIN,
883
- len: r === G.LEFT ? l - 1 : l,
887
+ len: r === j.LEFT ? l - 1 : l,
884
888
  segmentId: m
885
889
  }), f.dataStream.length && C.push({
886
890
  t: y.INSERT,
@@ -897,14 +901,14 @@ const cn = {
897
901
  len: h + 1 - p,
898
902
  line: 0,
899
903
  segmentId: m
900
- }), M.params.actions = C.serialize(), !!o.syncExecuteCommand(M.id, M.params);
904
+ }), M.params.actions = C.serialize(), !!s.syncExecuteCommand(M.id, M.params);
901
905
  }
902
906
  };
903
- function dn(s, e, t) {
904
- const { textRuns: n } = s, o = s.dataStream.substring(e, t);
907
+ function dn(o, e, t) {
908
+ const { textRuns: n } = o, s = o.dataStream.substring(e, t);
905
909
  if (n == null)
906
910
  return {
907
- dataStream: o
911
+ dataStream: s
908
912
  };
909
913
  const r = [];
910
914
  for (const i of n) {
@@ -924,29 +928,29 @@ function dn(s, e, t) {
924
928
  }));
925
929
  }
926
930
  return {
927
- dataStream: o,
931
+ dataStream: s,
928
932
  textRuns: r
929
933
  };
930
934
  }
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);
935
+ function _t(o, e) {
936
+ let t = o.endOffset;
937
+ for (const s of e) {
938
+ const { startOffset: r, endOffset: i } = s;
939
+ r == null || i == null || i <= o.endOffset && (t -= i - r);
936
940
  }
937
941
  return [
938
942
  {
939
943
  startOffset: t,
940
944
  endOffset: t,
941
- style: s.style
945
+ style: o.style
942
946
  }
943
947
  ];
944
948
  }
945
- const _t = {
949
+ const vt = {
946
950
  id: "doc.command.ime-input",
947
951
  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();
952
+ handler: async (o, e) => {
953
+ const { unitId: t, newText: n, oldTextLen: s, isCompositionEnd: r, isCompositionStart: i } = e, a = o.get(I), c = o.get(he), d = c.getActiveRange();
950
954
  if (d == null)
951
955
  return !1;
952
956
  const { startOffset: l, style: u, segmentId: m } = d, g = n.length, p = [
@@ -964,13 +968,13 @@ const _t = {
964
968
  textRanges: p
965
969
  }
966
970
  }, f = new P();
967
- !d.collapsed && i ? f.push(...be(d, m)) : f.push({
971
+ !d.collapsed && i ? f.push(...Pe(d, m)) : f.push({
968
972
  t: y.RETAIN,
969
973
  len: l,
970
974
  segmentId: m
971
- }), o > 0 && f.push({
975
+ }), s > 0 && f.push({
972
976
  t: y.DELETE,
973
- len: o,
977
+ len: s,
974
978
  line: 0,
975
979
  segmentId: m
976
980
  }), f.push({
@@ -986,32 +990,20 @@ const _t = {
986
990
  return c.pushUndoRedoMutationParams(S, h.params), !!S;
987
991
  }
988
992
  };
989
- function F(s, e, t, n) {
993
+ function F(o, e, t, n) {
990
994
  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,
995
+ const { segmentId: s } = (r = t.getActiveRange()) != null ? r : {};
996
+ return s == null ? !1 : n.executeCommand(Mt.id, {
997
+ segmentId: s,
998
+ preCommandId: o,
995
999
  ...e != null ? e : {}
996
1000
  });
997
1001
  }
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 = {
1002
+ const Qe = "doc.command.set-inline-format-bold", we = {
1011
1003
  id: Qe,
1012
1004
  type: v.COMMAND,
1013
- handler: async (s, e) => {
1014
- const t = s.get(I), n = s.get(T);
1005
+ handler: async (o, e) => {
1006
+ const t = o.get(I), n = o.get(T);
1015
1007
  return F(
1016
1008
  Qe,
1017
1009
  e,
@@ -1019,11 +1011,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1019
1011
  t
1020
1012
  );
1021
1013
  }
1022
- }, et = "doc.command.set-inline-format-underline", Le = {
1014
+ }, et = "doc.command.set-inline-format-italic", Le = {
1023
1015
  id: et,
1024
1016
  type: v.COMMAND,
1025
- handler: async (s, e) => {
1026
- const t = s.get(I), n = s.get(T);
1017
+ handler: async (o, e) => {
1018
+ const t = o.get(I), n = o.get(T);
1027
1019
  return F(
1028
1020
  et,
1029
1021
  e,
@@ -1031,11 +1023,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1031
1023
  t
1032
1024
  );
1033
1025
  }
1034
- }, tt = "doc.command.set-inline-format-strikethrough", Be = {
1026
+ }, tt = "doc.command.set-inline-format-underline", Be = {
1035
1027
  id: tt,
1036
1028
  type: v.COMMAND,
1037
- handler: async (s, e) => {
1038
- const t = s.get(I), n = s.get(T);
1029
+ handler: async (o, e) => {
1030
+ const t = o.get(I), n = o.get(T);
1039
1031
  return F(
1040
1032
  tt,
1041
1033
  e,
@@ -1043,11 +1035,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1043
1035
  t
1044
1036
  );
1045
1037
  }
1046
- }, nt = "doc.command.set-inline-format-subscript", se = {
1038
+ }, nt = "doc.command.set-inline-format-strikethrough", Fe = {
1047
1039
  id: nt,
1048
1040
  type: v.COMMAND,
1049
- handler: async (s, e) => {
1050
- const t = s.get(I), n = s.get(T);
1041
+ handler: async (o, e) => {
1042
+ const t = o.get(I), n = o.get(T);
1051
1043
  return F(
1052
1044
  nt,
1053
1045
  e,
@@ -1055,35 +1047,35 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1055
1047
  t
1056
1048
  );
1057
1049
  }
1058
- }, st = "doc.command.set-inline-format-superscript", Fe = {
1059
- id: st,
1050
+ }, ot = "doc.command.set-inline-format-subscript", oe = {
1051
+ id: ot,
1060
1052
  type: v.COMMAND,
1061
- handler: async (s, e) => {
1062
- const t = s.get(I), n = s.get(T);
1053
+ handler: async (o, e) => {
1054
+ const t = o.get(I), n = o.get(T);
1063
1055
  return F(
1064
- st,
1056
+ ot,
1065
1057
  e,
1066
1058
  n,
1067
1059
  t
1068
1060
  );
1069
1061
  }
1070
- }, ot = "doc.command.set-inline-format-fontsize", $e = {
1071
- id: ot,
1062
+ }, st = "doc.command.set-inline-format-superscript", $e = {
1063
+ id: st,
1072
1064
  type: v.COMMAND,
1073
- handler: async (s, e) => {
1074
- const t = s.get(I), n = s.get(T);
1065
+ handler: async (o, e) => {
1066
+ const t = o.get(I), n = o.get(T);
1075
1067
  return F(
1076
- ot,
1068
+ st,
1077
1069
  e,
1078
1070
  n,
1079
1071
  t
1080
1072
  );
1081
1073
  }
1082
- }, rt = "doc.command.set-inline-format-font-family", Ve = {
1074
+ }, rt = "doc.command.set-inline-format-fontsize", Ve = {
1083
1075
  id: rt,
1084
1076
  type: v.COMMAND,
1085
- handler: async (s, e) => {
1086
- const t = s.get(I), n = s.get(T);
1077
+ handler: async (o, e) => {
1078
+ const t = o.get(I), n = o.get(T);
1087
1079
  return F(
1088
1080
  rt,
1089
1081
  e,
@@ -1091,11 +1083,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1091
1083
  t
1092
1084
  );
1093
1085
  }
1094
- }, it = "doc.command.set-inline-format-text-color", ze = {
1086
+ }, it = "doc.command.set-inline-format-font-family", ze = {
1095
1087
  id: it,
1096
1088
  type: v.COMMAND,
1097
- handler: async (s, e) => {
1098
- const t = s.get(I), n = s.get(T);
1089
+ handler: async (o, e) => {
1090
+ const t = o.get(I), n = o.get(T);
1099
1091
  return F(
1100
1092
  it,
1101
1093
  e,
@@ -1103,11 +1095,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1103
1095
  t
1104
1096
  );
1105
1097
  }
1106
- }, at = "doc.command.set-inline-format-text-background-color", ke = {
1098
+ }, at = "doc.command.set-inline-format-text-color", ke = {
1107
1099
  id: at,
1108
1100
  type: v.COMMAND,
1109
- handler: async (s, e) => {
1110
- const t = s.get(I), n = s.get(T);
1101
+ handler: async (o, e) => {
1102
+ const t = o.get(I), n = o.get(T);
1111
1103
  return F(
1112
1104
  at,
1113
1105
  e,
@@ -1115,11 +1107,11 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1115
1107
  t
1116
1108
  );
1117
1109
  }
1118
- }, ct = "doc.command.reset-inline-format-text-background-color", je = {
1110
+ }, ct = "doc.command.set-inline-format-text-background-color", Ge = {
1119
1111
  id: ct,
1120
1112
  type: v.COMMAND,
1121
- handler: async (s, e) => {
1122
- const t = s.get(I), n = s.get(T);
1113
+ handler: async (o, e) => {
1114
+ const t = o.get(I), n = o.get(T);
1123
1115
  return F(
1124
1116
  ct,
1125
1117
  e,
@@ -1127,52 +1119,64 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1127
1119
  t
1128
1120
  );
1129
1121
  }
1130
- }, 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
- [ze.id]: "cl",
1138
- [ke.id]: "bg",
1139
- [je.id]: "bg",
1140
- [se.id]: "va",
1141
- [Fe.id]: "va"
1122
+ }, lt = "doc.command.reset-inline-format-text-background-color", je = {
1123
+ id: lt,
1124
+ type: v.COMMAND,
1125
+ handler: async (o, e) => {
1126
+ const t = o.get(I), n = o.get(T);
1127
+ return F(
1128
+ lt,
1129
+ e,
1130
+ n,
1131
+ t
1132
+ );
1133
+ }
1142
1134
  }, It = {
1135
+ [we.id]: "bl",
1136
+ [Le.id]: "it",
1137
+ [Be.id]: "ul",
1138
+ [Fe.id]: "st",
1139
+ [Ve.id]: "fs",
1140
+ [ze.id]: "ff",
1141
+ [ke.id]: "cl",
1142
+ [Ge.id]: "bg",
1143
+ [je.id]: "bg",
1144
+ [oe.id]: "va",
1145
+ [$e.id]: "va"
1146
+ }, Mt = {
1143
1147
  id: "doc.command.set-inline-format",
1144
1148
  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();
1149
+ handler: async (o, e) => {
1150
+ const { segmentId: t, value: n, preCommandId: s } = e, r = o.get(I), i = o.get(T), a = o.get(E), c = i.getSelections();
1147
1151
  if (!Array.isArray(c) || c.length === 0)
1148
1152
  return !1;
1149
1153
  let d = a.getCurrentUniverDocInstance();
1150
1154
  if (!d)
1151
1155
  return !1;
1152
1156
  let l = d.getUnitId();
1153
- l === Dt && (d = a.getUniverDocInstance(dt), l = d.getUnitId());
1157
+ l === At && (d = a.getUniverDocInstance(ut), l = d.getUnitId());
1154
1158
  let u;
1155
- switch (o) {
1156
- case Ue.id:
1159
+ switch (s) {
1157
1160
  case we.id:
1158
1161
  case Le.id:
1159
1162
  case Be.id:
1160
- case se.id:
1161
- case Fe.id: {
1163
+ case Fe.id:
1164
+ case oe.id:
1165
+ case $e.id: {
1162
1166
  u = mn(
1163
1167
  d.getBody().textRuns,
1164
- o,
1168
+ s,
1165
1169
  c
1166
1170
  );
1167
1171
  break;
1168
1172
  }
1169
- case $e.id:
1170
- case Ve.id: {
1173
+ case Ve.id:
1174
+ case ze.id: {
1171
1175
  u = n;
1172
1176
  break;
1173
1177
  }
1174
- case ze.id:
1175
- case ke.id: {
1178
+ case ke.id:
1179
+ case Ge.id: {
1176
1180
  u = {
1177
1181
  rgb: n
1178
1182
  };
@@ -1185,7 +1189,7 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1185
1189
  break;
1186
1190
  }
1187
1191
  default:
1188
- throw new Error(`Unknown command: ${o} in handleInlineFormat`);
1192
+ throw new Error(`Unknown command: ${s} in handleInlineFormat`);
1189
1193
  }
1190
1194
  const m = {
1191
1195
  id: L.id,
@@ -1194,7 +1198,7 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1194
1198
  actions: [],
1195
1199
  textRanges: c.map(Z)
1196
1200
  }
1197
- }, g = new P(), p = new oe();
1201
+ }, g = new P(), p = new se();
1198
1202
  p.reset();
1199
1203
  for (const f of c) {
1200
1204
  const { startOffset: S, endOffset: _ } = f, R = {
@@ -1204,7 +1208,7 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1204
1208
  st: 0,
1205
1209
  ed: _ - S,
1206
1210
  ts: {
1207
- [vt[o]]: u
1211
+ [It[s]]: u
1208
1212
  }
1209
1213
  }
1210
1214
  ]
@@ -1223,16 +1227,16 @@ const Ke = "doc.command.set-inline-format-bold", Ue = {
1223
1227
  return m.params.actions = g.serialize(), !!r.syncExecuteCommand(m.id, m.params);
1224
1228
  }
1225
1229
  };
1226
- function un(s) {
1227
- return s !== null && typeof s == "object";
1230
+ function un(o) {
1231
+ return o !== null && typeof o == "object";
1228
1232
  }
1229
- function mn(s, e, t) {
1230
- let n = 0, o = 0;
1231
- 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];
1233
+ function mn(o, e, t) {
1234
+ let n = 0, s = 0;
1235
+ const r = It[e];
1236
+ for (; n !== o.length && s !== t.length; ) {
1237
+ const { startOffset: i, endOffset: a } = t[s], { st: c, ed: d, ts: l } = o[n];
1234
1238
  if (a <= c)
1235
- o++;
1239
+ s++;
1236
1240
  else if (d <= i)
1237
1241
  n++;
1238
1242
  else {
@@ -1245,26 +1249,26 @@ function mn(s, e, t) {
1245
1249
  s: k.TRUE
1246
1250
  };
1247
1251
  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;
1252
+ 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
1253
  n++;
1250
1254
  }
1251
1255
  }
1252
1256
  return /bl|it/.test(r) ? k.TRUE : /ul|st/.test(r) ? {
1253
1257
  s: k.TRUE
1254
- } : e === se.id ? j.SUBSCRIPT : j.SUPERSCRIPT;
1258
+ } : e === oe.id ? G.SUBSCRIPT : G.SUPERSCRIPT;
1255
1259
  }
1256
- const Ge = {
1260
+ const He = {
1257
1261
  id: "doc.command.list-operation",
1258
1262
  type: v.COMMAND,
1259
- handler: (s, e) => {
1263
+ handler: (o, e) => {
1260
1264
  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();
1265
+ const t = o.get(T), n = o.get(E), s = o.get(I), { listType: r } = e, i = n.getCurrentUniverDocInstance();
1262
1266
  if (!i)
1263
1267
  return !1;
1264
1268
  const a = t.getActiveRange(), c = (O = t.getSelections()) != null ? O : [], d = (U = i.getBody()) == null ? void 0 : U.paragraphs, l = c.map(Z);
1265
1269
  if (a == null || d == null)
1266
1270
  return !1;
1267
- const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((Y) => {
1271
+ const u = Ct(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((Y) => {
1268
1272
  var $;
1269
1273
  return (($ = Y.bullet) == null ? void 0 : $.listType) === r;
1270
1274
  });
@@ -1280,14 +1284,14 @@ const Ge = {
1280
1284
  actions: [],
1281
1285
  textRanges: l
1282
1286
  }
1283
- }, _ = new oe();
1287
+ }, _ = new se();
1284
1288
  _.reset();
1285
1289
  const R = new P(), M = (w = i.getSnapshot().lists) != null ? w : {}, C = {
1286
- ...At,
1290
+ ...Nt,
1287
1291
  ...M
1288
1292
  }, { charSpace: D, defaultTabStop: A = 36, gridType: b } = i.getSnapshot().documentStyle;
1289
1293
  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);
1294
+ const { startIndex: $, paragraphStyle: z = {} } = Y, { indentFirstLine: xt = 0, snapToGrid: yt, indentStart: _e = 0 } = z, { hanging: ve, indentStart: Xe } = C[r].nestingLevel[0], Ie = Vt(D, A, b, yt);
1291
1295
  R.push({
1292
1296
  t: y.RETAIN,
1293
1297
  len: $ - _.cursor,
@@ -1302,7 +1306,7 @@ const Ge = {
1302
1306
  paragraphStyle: {
1303
1307
  ...z,
1304
1308
  hanging: void 0,
1305
- indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - He) : void 0
1309
+ indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - Xe) : void 0
1306
1310
  },
1307
1311
  startIndex: 0
1308
1312
  } : {
@@ -1311,7 +1315,7 @@ const Ge = {
1311
1315
  ...z,
1312
1316
  indentFirstLine: void 0,
1313
1317
  hanging: ve,
1314
- indentStart: He - ve + Me(Rt, Ie) + Me(_e, Ie)
1318
+ indentStart: Xe - ve + Me(xt, Ie) + Me(_e, Ie)
1315
1319
  },
1316
1320
  bullet: {
1317
1321
  ...(X = Y.bullet) != null ? X : {
@@ -1330,42 +1334,42 @@ const Ge = {
1330
1334
  coverType: Ee.REPLACE
1331
1335
  }), _.moveCursorTo($ + 1);
1332
1336
  }
1333
- return S.params.actions = R.serialize(), !!o.syncExecuteCommand(S.id, S.params);
1337
+ return S.params.actions = R.serialize(), !!s.syncExecuteCommand(S.id, S.params);
1334
1338
  }
1335
1339
  }, gn = {
1336
1340
  id: "doc.command.bullet-list",
1337
1341
  type: v.COMMAND,
1338
- handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1339
- listType: ut.BULLET_LIST
1342
+ handler: (o) => o.get(I).syncExecuteCommand(He.id, {
1343
+ listType: mt.BULLET_LIST
1340
1344
  })
1341
1345
  }, fn = {
1342
1346
  id: "doc.command.order-list",
1343
1347
  type: v.COMMAND,
1344
- handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1345
- listType: ut.ORDER_LIST
1348
+ handler: (o) => o.get(I).syncExecuteCommand(He.id, {
1349
+ listType: mt.ORDER_LIST
1346
1350
  })
1347
1351
  };
1348
- function Mt(s, e) {
1349
- const { startOffset: t, endOffset: n } = s, o = [];
1352
+ function Ct(o, e) {
1353
+ const { startOffset: t, endOffset: n } = o, s = [];
1350
1354
  let r = -1;
1351
1355
  for (const i of e) {
1352
1356
  const { startIndex: a } = i;
1353
- (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && o.push(i), r = a;
1357
+ (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && s.push(i), r = a;
1354
1358
  }
1355
- return o;
1359
+ return s;
1356
1360
  }
1357
1361
  const ie = {
1358
1362
  id: "doc.command.align-operation",
1359
1363
  type: v.COMMAND,
1360
- handler: (s, e) => {
1364
+ handler: (o, e) => {
1361
1365
  var R, M;
1362
- const t = s.get(T), n = s.get(E), o = s.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance();
1366
+ const t = o.get(T), n = o.get(E), s = o.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance();
1363
1367
  if (!i)
1364
1368
  return !1;
1365
1369
  const a = t.getActiveRange(), c = (R = t.getSelections()) != null ? R : [], d = (M = i.getBody()) == null ? void 0 : M.paragraphs, l = c.map(Z);
1366
1370
  if (a == null || d == null)
1367
1371
  return !1;
1368
- const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((C) => {
1372
+ const u = Ct(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((C) => {
1369
1373
  var D;
1370
1374
  return ((D = C.paragraphStyle) == null ? void 0 : D.horizontalAlign) === r;
1371
1375
  }), h = {
@@ -1375,7 +1379,7 @@ const ie = {
1375
1379
  actions: [],
1376
1380
  textRanges: l
1377
1381
  }
1378
- }, f = new oe();
1382
+ }, f = new se();
1379
1383
  f.reset();
1380
1384
  const S = new P();
1381
1385
  for (const C of u) {
@@ -1406,63 +1410,63 @@ const ie = {
1406
1410
  coverType: Ee.REPLACE
1407
1411
  }), f.moveCursorTo(D + 1);
1408
1412
  }
1409
- return h.params.actions = S.serialize(), !!o.syncExecuteCommand(h.id, h.params);
1413
+ return h.params.actions = S.serialize(), !!s.syncExecuteCommand(h.id, h.params);
1410
1414
  }
1411
1415
  }, hn = {
1412
1416
  id: "doc.command.align-left",
1413
1417
  type: v.COMMAND,
1414
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1418
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1415
1419
  alignType: re.LEFT
1416
1420
  })
1417
1421
  }, pn = {
1418
1422
  id: "doc.command.align-center",
1419
1423
  type: v.COMMAND,
1420
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1424
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1421
1425
  alignType: re.CENTER
1422
1426
  })
1423
1427
  }, Sn = {
1424
1428
  id: "doc.command.align-right",
1425
1429
  type: v.COMMAND,
1426
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1430
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1427
1431
  alignType: re.RIGHT
1428
1432
  })
1429
1433
  }, _n = {
1430
1434
  id: "doc.command.align-justify",
1431
1435
  type: v.COMMAND,
1432
- handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1436
+ handler: (o) => o.get(I).syncExecuteCommand(ie.id, {
1433
1437
  alignType: re.JUSTIFIED
1434
1438
  })
1435
1439
  }, vn = {
1436
1440
  id: "doc.command-replace-content",
1437
1441
  type: v.COMMAND,
1438
- handler: async (s, e) => {
1442
+ handler: async (o, e) => {
1439
1443
  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();
1444
+ 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
1445
  if (d == null || !Array.isArray(l) || l.length === 0)
1442
1446
  return !1;
1443
- const u = Ct(t, r, d, n);
1444
- return u.params.textRanges = o, !!a.syncExecuteCommand(u.id, u.params);
1447
+ const u = Rt(t, r, d, n);
1448
+ return u.params.textRanges = s, !!a.syncExecuteCommand(u.id, u.params);
1445
1449
  }
1446
1450
  }, In = {
1447
1451
  id: "doc.command-cover-content",
1448
1452
  type: v.COMMAND,
1449
- handler: async (s, e) => {
1453
+ handler: async (o, e) => {
1450
1454
  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;
1455
+ 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
1456
  if (c == null)
1453
1457
  return !1;
1454
- const d = Ct(t, o, c, n);
1458
+ const d = Rt(t, s, c, n);
1455
1459
  return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, i.syncExecuteCommand(
1456
1460
  d.id,
1457
1461
  d.params
1458
1462
  ), a.clearUndoRedo(t), !0;
1459
1463
  }
1460
1464
  };
1461
- function Ct(s, e, t, n) {
1462
- const o = {
1465
+ function Rt(o, e, t, n) {
1466
+ const s = {
1463
1467
  id: L.id,
1464
1468
  params: {
1465
- unitId: s,
1469
+ unitId: o,
1466
1470
  actions: [],
1467
1471
  textRanges: []
1468
1472
  }
@@ -1478,18 +1482,18 @@ function Ct(s, e, t, n) {
1478
1482
  len: n.dataStream.length,
1479
1483
  line: 0,
1480
1484
  segmentId: e
1481
- }), o.params.actions = r.serialize(), o;
1485
+ }), s.params.actions = r.serialize(), s;
1482
1486
  }
1483
1487
  const ye = {
1484
1488
  id: "doc.operation.move-cursor",
1485
1489
  type: v.OPERATION,
1486
- handler: (s, e) => !!e
1490
+ handler: (o, e) => !!e
1487
1491
  }, Oe = {
1488
1492
  id: "doc.operation.move-selection",
1489
1493
  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;
1494
+ handler: (o, e) => !!e
1495
+ }, Mn = (o, e) => {
1496
+ const t = o.get(E).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1493
1497
  return {
1494
1498
  ...Q.deepClone(e),
1495
1499
  zoomRatio: n
@@ -1497,8 +1501,8 @@ const ye = {
1497
1501
  }, ce = {
1498
1502
  id: "doc.operation.set-zoom-ratio",
1499
1503
  type: v.OPERATION,
1500
- handler: (s, e) => {
1501
- const t = s.get(E).getUniverDocInstance(e.unitId);
1504
+ handler: (o, e) => {
1505
+ const t = o.get(E).getUniverDocInstance(e.unitId);
1502
1506
  if (!t)
1503
1507
  return !1;
1504
1508
  const n = t.getSnapshot();
@@ -1509,19 +1513,19 @@ const ye = {
1509
1513
  }, Cn = {
1510
1514
  type: v.COMMAND,
1511
1515
  id: "doc.command.set-zoom-ratio",
1512
- handler: async (s, e) => {
1516
+ handler: async (o, e) => {
1513
1517
  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();
1518
+ const t = o.get(I), n = o.get(Te), s = o.get(E);
1519
+ let r = (u = s.getCurrentUniverDocInstance()) == null ? void 0 : u.getUnitId();
1516
1520
  if (!r)
1517
1521
  return !1;
1518
1522
  let i = 1;
1519
- if (e && (r = (m = e.documentId) != null ? m : r, i = (g = e.zoomRatio) != null ? g : i), !o.getUniverDocInstance(r))
1523
+ if (e && (r = (m = e.documentId) != null ? m : r, i = (g = e.zoomRatio) != null ? g : i), !s.getUniverDocInstance(r))
1520
1524
  return !1;
1521
1525
  const c = {
1522
1526
  zoomRatio: i,
1523
1527
  unitId: r
1524
- }, d = Mn(s, c);
1528
+ }, d = Mn(o, c);
1525
1529
  return t.syncExecuteCommand(ce.id, c) ? (n.pushUndoRedo({
1526
1530
  unitID: r,
1527
1531
  undoMutations: [{ id: ce.id, params: d }],
@@ -1531,36 +1535,36 @@ const ye = {
1531
1535
  }, Rn = {
1532
1536
  id: "doc.operation.select-all",
1533
1537
  type: v.COMMAND,
1534
- handler: async (s) => {
1535
- const e = s.get(E), t = s.get(T), n = e.getCurrentUniverDocInstance();
1538
+ handler: async (o) => {
1539
+ const e = o.get(E), t = o.get(T), n = e.getCurrentUniverDocInstance();
1536
1540
  if (!n)
1537
1541
  return !1;
1538
- const o = n.getSnapshot().body;
1539
- if (o == null)
1542
+ const s = n.getSnapshot().body;
1543
+ if (s == null)
1540
1544
  return !1;
1541
1545
  const r = [
1542
1546
  {
1543
1547
  startOffset: 0,
1544
- endOffset: o.dataStream.length - 2
1548
+ endOffset: s.dataStream.length - 2
1545
1549
  }
1546
1550
  ];
1547
1551
  return t.replaceTextRanges(r, !1), !0;
1548
1552
  }
1549
1553
  };
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);
1554
+ var xn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, On = (o, e, t, n) => {
1555
+ for (var s = n > 1 ? void 0 : n ? yn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1556
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1557
+ return n && s && xn(e, t, s), s;
1558
+ }, K = (o, e) => (t, n) => e(t, n, o);
1555
1559
  let le = class extends Ne {
1556
- constructor(e, t, n, o, r) {
1560
+ constructor(e, t, n, s, r) {
1557
1561
  super();
1558
1562
  x(this, "_previousIMEContent", "");
1559
1563
  x(this, "_isCompositionStart", !0);
1560
1564
  x(this, "_onStartSubscription");
1561
1565
  x(this, "_onUpdateSubscription");
1562
1566
  x(this, "_onEndSubscription");
1563
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = o, this._commandService = r, this._initialize();
1567
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService = r, this._initialize();
1564
1568
  }
1565
1569
  dispose() {
1566
1570
  var e, t, n;
@@ -1593,15 +1597,15 @@ let le = class extends Ne {
1593
1597
  const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
1594
1598
  if (e == null || n == null)
1595
1599
  return;
1596
- const o = this._univerInstanceService.getCurrentUniverDocInstance();
1597
- if (!o)
1600
+ const s = this._univerInstanceService.getCurrentUniverDocInstance();
1601
+ if (!s)
1598
1602
  return;
1599
1603
  const { event: r, activeRange: i } = e;
1600
1604
  if (n == null || i == null)
1601
1605
  return;
1602
1606
  const c = r.data;
1603
- c === this._previousIMEContent && t || (await this._commandService.executeCommand(_t.id, {
1604
- unitId: o.getUnitId(),
1607
+ c === this._previousIMEContent && t || (await this._commandService.executeCommand(vt.id, {
1608
+ unitId: s.getUnitId(),
1605
1609
  newText: c,
1606
1610
  oldTextLen: this._previousIMEContent.length,
1607
1611
  isCompositionStart: this._isCompositionStart,
@@ -1614,22 +1618,22 @@ let le = class extends Ne {
1614
1618
  };
1615
1619
  le = On([
1616
1620
  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)
1621
+ K(0, V(H)),
1622
+ K(1, E),
1623
+ K(2, fe),
1624
+ K(3, V(he)),
1625
+ K(4, I)
1622
1626
  ], 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);
1627
+ var Tn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Dn = (o, e, t, n) => {
1628
+ for (var s = n > 1 ? void 0 : n ? En(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1629
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1630
+ return n && s && Tn(e, t, s), s;
1631
+ }, J = (o, e) => (t, n) => e(t, n, o);
1628
1632
  let de = class extends Ne {
1629
- constructor(e, t, n, o, r) {
1633
+ constructor(e, t, n, s, r) {
1630
1634
  super();
1631
1635
  x(this, "_onInputSubscription");
1632
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1636
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = r, this._initialize(), this._commandExecutedListener();
1633
1637
  }
1634
1638
  dispose() {
1635
1639
  var e;
@@ -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
1812
  var p, h, f, S, _, R, M, C, D, A, b, 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;
@@ -1868,27 +1872,27 @@ let de = class extends Ne {
1868
1872
  }
1869
1873
  }
1870
1874
  _getDocObject() {
1871
- return gt(this._univerInstanceService, this._renderManagerService);
1875
+ return ft(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, bn = (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
1894
  x(this, "_onInputSubscription");
1891
- this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1895
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = r, this._initialize(), this._commandExecutedListener();
1892
1896
  }
1893
1897
  dispose() {
1894
1898
  var e;
@@ -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 = [
@@ -1929,27 +1933,27 @@ let ue = class extends Ne {
1929
1933
  _commandExecutedListener() {
1930
1934
  }
1931
1935
  _getDocObject() {
1932
- return gt(this._univerInstanceService, this._renderManagerService);
1936
+ return ft(this._univerInstanceService, this._renderManagerService);
1933
1937
  }
1934
1938
  };
1935
1939
  ue = bn([
1936
1940
  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)
1941
+ q(0, V(H)),
1942
+ q(1, E),
1943
+ q(2, gt),
1944
+ q(3, fe),
1945
+ q(4, I)
1942
1946
  ], 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);
1947
+ var Pn = Object.defineProperty, Un = Object.getOwnPropertyDescriptor, wn = (o, e, t, n) => {
1948
+ for (var s = n > 1 ? void 0 : n ? Un(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1949
+ (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1950
+ return n && s && Pn(e, t, s), s;
1951
+ }, Ln = (o, e) => (t, n) => e(t, n, o);
1948
1952
  const Bn = {
1949
1953
  hasScroll: !0
1950
1954
  }, Fn = "docs";
1951
1955
  var ae;
1952
- let lt = (ae = class extends Nt {
1956
+ let dt = (ae = class extends bt {
1953
1957
  constructor(e = {}, t) {
1954
1958
  super();
1955
1959
  x(this, "_config");
@@ -1963,34 +1967,34 @@ let lt = (ae = class extends Nt {
1963
1967
  Oe,
1964
1968
  cn,
1965
1969
  ln,
1966
- Ue,
1967
1970
  we,
1968
1971
  Le,
1969
1972
  Be,
1970
- se,
1971
1973
  Fe,
1974
+ oe,
1972
1975
  $e,
1973
1976
  Ve,
1974
1977
  ze,
1975
- je,
1976
1978
  ke,
1977
- It,
1979
+ je,
1980
+ Ge,
1981
+ Mt,
1978
1982
  nn,
1979
1983
  pe,
1980
1984
  Se,
1981
- ht,
1982
- _t,
1983
- Pe,
1985
+ pt,
1986
+ vt,
1987
+ Ue,
1984
1988
  L,
1985
1989
  vn,
1986
1990
  In,
1987
1991
  Cn,
1988
1992
  ce,
1989
- ft,
1993
+ ht,
1990
1994
  Rn,
1991
1995
  fn,
1992
1996
  gn,
1993
- Ge,
1997
+ He,
1994
1998
  hn,
1995
1999
  pn,
1996
2000
  Sn,
@@ -2013,7 +2017,7 @@ let lt = (ae = class extends Nt {
2013
2017
  [
2014
2018
  fe,
2015
2019
  {
2016
- useClass: Vt
2020
+ useClass: zt
2017
2021
  }
2018
2022
  ],
2019
2023
  [T],
@@ -2024,9 +2028,9 @@ let lt = (ae = class extends Nt {
2024
2028
  ].forEach((t) => e.add(t));
2025
2029
  }
2026
2030
  }, x(ae, "pluginName", Fn), x(ae, "type", W.UNIVER_DOC), ae);
2027
- lt = wn([
2028
- Ln(1, V(zt))
2029
- ], lt);
2031
+ dt = wn([
2032
+ Ln(1, V(kt))
2033
+ ], dt);
2030
2034
  export {
2031
2035
  pn as AlignCenterCommand,
2032
2036
  _n as AlignJustifyCommand,
@@ -2036,20 +2040,21 @@ export {
2036
2040
  nn as BreakLineCommand,
2037
2041
  gn as BulletListCommand,
2038
2042
  In as CoverContentCommand,
2039
- pt as CutContentCommand,
2043
+ St as CutContentCommand,
2044
+ jn as DOCS_COMPONENT_BACKGROUND_LAYER_INDEX,
2040
2045
  Yn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2041
2046
  Xn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2042
2047
  Hn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2043
- kt as DOCS_VIEW_KEY,
2048
+ be as DOCS_VIEW_KEY,
2044
2049
  Se as DeleteCommand,
2045
2050
  cn as DeleteLeftCommand,
2046
2051
  ln as DeleteRightCommand,
2047
2052
  H as DocSkeletonManagerService,
2048
2053
  me as DocStateChangeManagerService,
2049
2054
  ne as DocViewModelManagerService,
2050
- _t as IMEInputCommand,
2055
+ vt as IMEInputCommand,
2051
2056
  he as IMEInputManagerService,
2052
- Zn as InnerPasteCommand,
2057
+ Kn as InnerPasteCommand,
2053
2058
  pe as InsertCommand,
2054
2059
  ye as MoveCursorOperation,
2055
2060
  Oe as MoveSelectionOperation,
@@ -2061,23 +2066,23 @@ export {
2061
2066
  Rn as SelectAllOperation,
2062
2067
  Cn as SetDocZoomRatioCommand,
2063
2068
  ce as SetDocZoomRatioOperation,
2064
- Ue as SetInlineFormatBoldCommand,
2065
- 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,
2073
- ze as SetInlineFormatTextColorCommand,
2074
- Le as SetInlineFormatUnderlineCommand,
2075
- ft as SetTextSelectionsOperation,
2069
+ we as SetInlineFormatBoldCommand,
2070
+ Mt as SetInlineFormatCommand,
2071
+ ze as SetInlineFormatFontFamilyCommand,
2072
+ Ve as SetInlineFormatFontSizeCommand,
2073
+ Le as SetInlineFormatItalicCommand,
2074
+ Fe as SetInlineFormatStrikethroughCommand,
2075
+ oe as SetInlineFormatSubscriptCommand,
2076
+ $e as SetInlineFormatSuperscriptCommand,
2077
+ Ge as SetInlineFormatTextBackgroundColorCommand,
2078
+ ke as SetInlineFormatTextColorCommand,
2079
+ Be as SetInlineFormatUnderlineCommand,
2080
+ ht as SetTextSelectionsOperation,
2076
2081
  T as TextSelectionManagerService,
2077
- lt as UniverDocsPlugin,
2078
- ht as UpdateCommand,
2079
- jt as VIEWPORT_KEY,
2080
- gt as getDocObject,
2081
- Gn as getDocObjectById,
2082
+ dt as UniverDocsPlugin,
2083
+ pt as UpdateCommand,
2084
+ Gt as VIEWPORT_KEY,
2085
+ ft as getDocObject,
2086
+ Zn as getDocObjectById,
2082
2087
  Z as serializeTextRange
2083
2088
  };