@univerjs/core 0.6.7 → 0.6.9

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/facade.js ADDED
@@ -0,0 +1,1428 @@
1
+ var N = Object.defineProperty;
2
+ var L = (n, e, t) => e in n ? N(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var d = (n, e, t) => L(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Disposable as V, Inject as l, Injector as _, AbsoluteRefType as F, UniverInstanceType as w, LifecycleStages as f, DataValidationType as W, DataValidationErrorStyle as q, DataValidationRenderMode as G, DataValidationOperator as J, DataValidationStatus as K, CommandType as Q, BaselineOffset as X, BooleanNumber as Y, HorizontalAlign as Z, TextDecoration as k, TextDirection as ee, VerticalAlign as te, WrapStrategy as re, BorderType as ne, BorderStyleTypes as ie, AutoFillSeries as oe, ColorType as se, CommonHideTypes as ce, CopyPasteType as ae, DeleteDirection as de, DeveloperMetadataVisibility as pe, Dimension as le, Direction as he, InterpolationPointType as ue, LocaleType as ye, MentionType as ge, ProtectionType as ve, RelativeDate as fe, SheetTypes as _e, ThemeColorType as me, LifecycleService as I, toDisposable as p, ICommandService as y, UndoCommand as h, IUndoRedoService as m, RedoCommand as u, Registry as Ee, UserManagerService as be, Rectangle as Se, numfmt as Ce, Tools as De, IUniverInstanceService as A, Univer as xe, CanceledError as D, ColorBuilder as Te, RichTextBuilder as we, RichTextValue as Re, ParagraphStyleBuilder as Oe, ParagraphStyleValue as Pe, TextStyleBuilder as je, TextStyleValue as Be, TextDecorationBuilder as He } from "@univerjs/core";
5
+ import { filter as E } from "rxjs";
6
+ class $ extends V {
7
+ /**
8
+ * @ignore
9
+ */
10
+ static extend(e) {
11
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
12
+ t !== "constructor" && (this.prototype[t] = e.prototype[t]);
13
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
14
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
15
+ });
16
+ }
17
+ }
18
+ const x = Symbol("initializers");
19
+ class Ue extends V {
20
+ constructor(e) {
21
+ super(), this._injector = e;
22
+ const t = this, r = Object.getPrototypeOf(this)[x];
23
+ r && r.forEach(function(i) {
24
+ i.apply(t, [e]);
25
+ });
26
+ }
27
+ /**
28
+ * @ignore
29
+ */
30
+ _initialize(e) {
31
+ }
32
+ /**
33
+ * @ignore
34
+ */
35
+ static extend(e) {
36
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
37
+ if (t === "_initialize") {
38
+ let r = this.prototype[x];
39
+ r || (r = [], this.prototype[x] = r), r.push(e.prototype._initialize);
40
+ } else t !== "constructor" && (this.prototype[t] = e.prototype[t]);
41
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
42
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
43
+ });
44
+ }
45
+ }
46
+ var Ve = Object.getOwnPropertyDescriptor, Ie = (n, e, t, r) => {
47
+ for (var i = r > 1 ? void 0 : r ? Ve(e, t) : e, o = n.length - 1, s; o >= 0; o--)
48
+ (s = n[o]) && (i = s(i) || i);
49
+ return i;
50
+ }, $e = (n, e) => (t, r) => e(t, r, n);
51
+ let S = class extends $ {
52
+ constructor(n, e) {
53
+ super(), this._blob = n, this._injector = e;
54
+ }
55
+ /**
56
+ * Returns a copy of this blob.
57
+ * @returns a new blob by copying the current blob
58
+ * @example
59
+ * ```ts
60
+ * const blob = univerAPI.newBlob();
61
+ * const newBlob = blob.copyBlob();
62
+ * console.log(newBlob);
63
+ * ```
64
+ */
65
+ copyBlob() {
66
+ return this._injector.createInstance(S, this._blob);
67
+ }
68
+ /**
69
+ * Return the data inside this object as a blob converted to the specified content type.
70
+ * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
71
+ * @returns a new blob by converting the current blob to the specified content type
72
+ * @example
73
+ * ```ts
74
+ * const blob = univerAPI.newBlob();
75
+ * const newBlob = blob.getAs('text/plain');
76
+ * console.log(newBlob);
77
+ * ```
78
+ */
79
+ getAs(n) {
80
+ const e = this.copyBlob();
81
+ return e.setContentType(n), e;
82
+ }
83
+ getDataAsString(n) {
84
+ return this._blob === null ? Promise.resolve("") : n === void 0 ? this._blob.text() : new Promise((e, t) => {
85
+ this._blob.arrayBuffer().then((r) => {
86
+ const i = new TextDecoder(n).decode(r);
87
+ e(i);
88
+ }).catch((r) => {
89
+ t(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`));
90
+ });
91
+ });
92
+ }
93
+ /**
94
+ * Gets the data stored in this blob.
95
+ * @returns the blob content as a byte array
96
+ * @example
97
+ * ```ts
98
+ * const blob = univerAPI.newBlob();
99
+ * const bytes = await blob.getBytes();
100
+ * console.log(bytes);
101
+ * ```
102
+ */
103
+ getBytes() {
104
+ return this._blob ? this._blob.arrayBuffer().then((n) => new Uint8Array(n)) : Promise.reject(new Error("Blob is undefined or null."));
105
+ }
106
+ /**
107
+ * Sets the data stored in this blob.
108
+ * @param bytes a byte array
109
+ * @returns the blob object
110
+ * @example
111
+ * ```ts
112
+ * const blob = univerAPI.newBlob();
113
+ * const bytes = new Uint8Array(10);
114
+ * blob.setBytes(bytes);
115
+ * ```
116
+ */
117
+ setBytes(n) {
118
+ return this._blob = new Blob([n]), this;
119
+ }
120
+ setDataFromString(n, e) {
121
+ const t = e != null ? e : "text/plain", r = new Blob([n], { type: t });
122
+ return this._blob = r, this;
123
+ }
124
+ /**
125
+ * Gets the content type of the data stored in this blob.
126
+ * @returns the content type
127
+ * @example
128
+ * ```ts
129
+ * const blob = univerAPI.newBlob();
130
+ * const contentType = blob.getContentType();
131
+ * console.log(contentType);
132
+ * ```
133
+ */
134
+ getContentType() {
135
+ var n;
136
+ return (n = this._blob) == null ? void 0 : n.type;
137
+ }
138
+ /**
139
+ * Sets the content type of the data stored in this blob.
140
+ * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
141
+ * @returns the blob object
142
+ * @example
143
+ * ```ts
144
+ * const blob = univerAPI.newBlob();
145
+ * blob.setContentType('text/plain');
146
+ * ```
147
+ */
148
+ setContentType(n) {
149
+ var e;
150
+ return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, n), this;
151
+ }
152
+ };
153
+ S = Ie([
154
+ $e(1, l(_))
155
+ ], S);
156
+ const g = class g {
157
+ static get() {
158
+ if (this._instance)
159
+ return this._instance;
160
+ const e = new g();
161
+ return this._instance = e, e;
162
+ }
163
+ /**
164
+ * @ignore
165
+ */
166
+ static extend(e) {
167
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
168
+ t !== "constructor" && (this.prototype[t] = e.prototype[t]);
169
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
170
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
171
+ });
172
+ }
173
+ constructor() {
174
+ for (const e in g.prototype)
175
+ this[e] = g.prototype[e];
176
+ }
177
+ /**
178
+ * Defines different types of absolute references
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * console.log(univerAPI.Enum.AbsoluteRefType);
183
+ * ```
184
+ */
185
+ get AbsoluteRefType() {
186
+ return F;
187
+ }
188
+ /**
189
+ * Defines different types of Univer instances
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * console.log(univerAPI.Enum.UniverInstanceType.UNIVER_SHEET);
194
+ * ```
195
+ */
196
+ get UniverInstanceType() {
197
+ return w;
198
+ }
199
+ /**
200
+ * Represents different stages in the lifecycle
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * console.log(univerAPI.Enum.LifecycleStages.Rendered);
205
+ * ```
206
+ */
207
+ get LifecycleStages() {
208
+ return f;
209
+ }
210
+ /**
211
+ * Different types of data validation
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * console.log(univerAPI.Enum.DataValidationType.LIST);
216
+ * ```
217
+ */
218
+ get DataValidationType() {
219
+ return W;
220
+ }
221
+ /**
222
+ * Different error display styles
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * console.log(univerAPI.Enum.DataValidationErrorStyle.WARNING);
227
+ * ```
228
+ */
229
+ get DataValidationErrorStyle() {
230
+ return q;
231
+ }
232
+ /**
233
+ * Different validation rendering modes
234
+ *
235
+ * @example
236
+ * ```ts
237
+ * console.log(univerAPI.Enum.DataValidationRenderMode.TEXT);
238
+ * ```
239
+ */
240
+ get DataValidationRenderMode() {
241
+ return G;
242
+ }
243
+ /**
244
+ * Different validation operators
245
+ *
246
+ * @example
247
+ * ```ts
248
+ * console.log(univerAPI.Enum.DataValidationOperator.BETWEEN);
249
+ * ```
250
+ */
251
+ get DataValidationOperator() {
252
+ return J;
253
+ }
254
+ /**
255
+ * Different validation states
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * console.log(univerAPI.Enum.DataValidationStatus.VALID);
260
+ * ```
261
+ */
262
+ get DataValidationStatus() {
263
+ return K;
264
+ }
265
+ /**
266
+ * Different types of commands
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * console.log(univerAPI.Enum.CommandType.COMMAND);
271
+ * ```
272
+ */
273
+ get CommandType() {
274
+ return Q;
275
+ }
276
+ /**
277
+ * Different baseline offsets for text baseline positioning
278
+ *
279
+ * @example
280
+ * ```ts
281
+ * console.log(univerAPI.Enum.BaselineOffset.SUPERSCRIPT);
282
+ * ```
283
+ */
284
+ get BaselineOffset() {
285
+ return X;
286
+ }
287
+ /**
288
+ * Boolean number representations
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * console.log(univerAPI.Enum.BooleanNumber.TRUE);
293
+ * ```
294
+ */
295
+ get BooleanNumber() {
296
+ return Y;
297
+ }
298
+ /**
299
+ * Different horizontal text alignment options
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * console.log(univerAPI.Enum.HorizontalAlign.CENTER);
304
+ * ```
305
+ */
306
+ get HorizontalAlign() {
307
+ return Z;
308
+ }
309
+ /**
310
+ * Different text decoration styles
311
+ *
312
+ * @example
313
+ * ```ts
314
+ * console.log(univerAPI.Enum.TextDecoration.DOUBLE);
315
+ * ```
316
+ */
317
+ get TextDecoration() {
318
+ return k;
319
+ }
320
+ /**
321
+ * Different text direction options
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * console.log(univerAPI.Enum.TextDirection.LEFT_TO_RIGHT);
326
+ * ```
327
+ */
328
+ get TextDirection() {
329
+ return ee;
330
+ }
331
+ /**
332
+ * Different vertical text alignment options
333
+ *
334
+ * @example
335
+ * ```ts
336
+ * console.log(univerAPI.Enum.VerticalAlign.MIDDLE);
337
+ * ```
338
+ */
339
+ get VerticalAlign() {
340
+ return te;
341
+ }
342
+ /**
343
+ * Different wrap strategy options
344
+ *
345
+ * @example
346
+ * ```ts
347
+ * console.log(univerAPI.Enum.WrapStrategy.WRAP);
348
+ * ```
349
+ */
350
+ get WrapStrategy() {
351
+ return re;
352
+ }
353
+ /**
354
+ * Different border types
355
+ *
356
+ * @example
357
+ * ```ts
358
+ * console.log(univerAPI.Enum.BorderType.OUTSIDE);
359
+ * ```
360
+ */
361
+ get BorderType() {
362
+ return ne;
363
+ }
364
+ /**
365
+ * Different border style types
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * console.log(univerAPI.Enum.BorderStyleTypes.NONE);
370
+ * ```
371
+ */
372
+ get BorderStyleTypes() {
373
+ return ie;
374
+ }
375
+ /**
376
+ * Auto fill series types
377
+ *
378
+ * @example
379
+ * ```ts
380
+ * console.log(univerAPI.Enum.AutoFillSeries.ALTERNATE_SERIES);
381
+ * ```
382
+ */
383
+ get AutoFillSeries() {
384
+ return oe;
385
+ }
386
+ /**
387
+ * Color types
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * console.log(univerAPI.Enum.ColorType.RGB);
392
+ * ```
393
+ */
394
+ get ColorType() {
395
+ return se;
396
+ }
397
+ /**
398
+ * Common hide types
399
+ *
400
+ * @example
401
+ * ```ts
402
+ * console.log(univerAPI.Enum.CommonHideTypes.ON);
403
+ * ```
404
+ */
405
+ get CommonHideTypes() {
406
+ return ce;
407
+ }
408
+ /**
409
+ * Copy paste types
410
+ *
411
+ * @example
412
+ * ```ts
413
+ * console.log(univerAPI.Enum.CopyPasteType.PASTE_VALUES);
414
+ * ```
415
+ */
416
+ get CopyPasteType() {
417
+ return ae;
418
+ }
419
+ /**
420
+ * Delete direction types
421
+ *
422
+ * @example
423
+ * ```ts
424
+ * console.log(univerAPI.Enum.DeleteDirection.LEFT);
425
+ * ```
426
+ */
427
+ get DeleteDirection() {
428
+ return de;
429
+ }
430
+ /**
431
+ * Developer metadata visibility types
432
+ *
433
+ * @example
434
+ * ```ts
435
+ * console.log(univerAPI.Enum.DeveloperMetadataVisibility.DOCUMENT);
436
+ * ```
437
+ */
438
+ get DeveloperMetadataVisibility() {
439
+ return pe;
440
+ }
441
+ /**
442
+ * Dimension types
443
+ *
444
+ * @example
445
+ * ```ts
446
+ * console.log(univerAPI.Enum.Dimension.ROWS);
447
+ * ```
448
+ */
449
+ get Dimension() {
450
+ return le;
451
+ }
452
+ /**
453
+ * Direction types
454
+ *
455
+ * @example
456
+ * ```ts
457
+ * console.log(univerAPI.Enum.Direction.UP);
458
+ * ```
459
+ */
460
+ get Direction() {
461
+ return he;
462
+ }
463
+ /**
464
+ * Interpolation point types
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * console.log(univerAPI.Enum.InterpolationPointType.NUMBER);
469
+ * ```
470
+ */
471
+ get InterpolationPointType() {
472
+ return ue;
473
+ }
474
+ /**
475
+ * Locale types
476
+ *
477
+ * @example
478
+ * ```ts
479
+ * console.log(univerAPI.Enum.LocaleType.EN_US);
480
+ * ```
481
+ */
482
+ get LocaleType() {
483
+ return ye;
484
+ }
485
+ /**
486
+ * Mention types
487
+ *
488
+ * @example
489
+ * ```ts
490
+ * console.log(univerAPI.Enum.MentionType.PERSON);
491
+ * ```
492
+ */
493
+ get MentionType() {
494
+ return ge;
495
+ }
496
+ /**
497
+ * Protection types
498
+ *
499
+ * @example
500
+ * ```ts
501
+ * console.log(univerAPI.Enum.ProtectionType.RANGE);
502
+ * ```
503
+ */
504
+ get ProtectionType() {
505
+ return ve;
506
+ }
507
+ /**
508
+ * Relative date types
509
+ *
510
+ * @example
511
+ * ```ts
512
+ * console.log(univerAPI.Enum.RelativeDate.TODAY);
513
+ * ```
514
+ */
515
+ get RelativeDate() {
516
+ return fe;
517
+ }
518
+ /**
519
+ * Sheet types
520
+ *
521
+ * @example
522
+ * ```ts
523
+ * console.log(univerAPI.Enum.SheetTypes.GRID);
524
+ * ```
525
+ */
526
+ get SheetTypes() {
527
+ return _e;
528
+ }
529
+ /**
530
+ * Theme color types
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * console.log(univerAPI.Enum.ThemeColorType.ACCENT1);
535
+ * ```
536
+ */
537
+ get ThemeColorType() {
538
+ return me;
539
+ }
540
+ };
541
+ /**
542
+ * @ignore
543
+ */
544
+ d(g, "_instance");
545
+ let R = g;
546
+ const v = class v {
547
+ static get() {
548
+ if (this._instance)
549
+ return this._instance;
550
+ const e = new v();
551
+ return this._instance = e, e;
552
+ }
553
+ /**
554
+ * @ignore
555
+ */
556
+ static extend(e) {
557
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
558
+ t !== "constructor" && (this.prototype[t] = e.prototype[t]);
559
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
560
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
561
+ });
562
+ }
563
+ constructor() {
564
+ for (const e in v.prototype)
565
+ this[e] = v.prototype[e];
566
+ }
567
+ /**
568
+ * Event fired when a document is created
569
+ * @see {@link IDocCreatedParam}
570
+ * @example
571
+ * ```ts
572
+ * const disposable = univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => {
573
+ * const { unitId, type, doc, unit } = params;
574
+ * console.log('doc created', params);
575
+ * });
576
+ *
577
+ * // Remove the event listener, use `disposable.dispose()`
578
+ * ```
579
+ */
580
+ get DocCreated() {
581
+ return "DocCreated";
582
+ }
583
+ /**
584
+ * Event fired when a document is disposed
585
+ * @see {@link IDocDisposedEvent}
586
+ * @example
587
+ * ```ts
588
+ * const disposable = univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => {
589
+ * const { unitId, unitType, snapshot } = params;
590
+ * console.log('doc disposed', params);
591
+ * });
592
+ *
593
+ * // Remove the event listener, use `disposable.dispose()`
594
+ * ```
595
+ */
596
+ get DocDisposed() {
597
+ return "DocDisposed";
598
+ }
599
+ /**
600
+ * Event fired when life cycle is changed
601
+ * @see {@link ILifeCycleChangedEvent}
602
+ * @example
603
+ * ```ts
604
+ * const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
605
+ * const { stage } = params;
606
+ * console.log('life cycle changed', params);
607
+ * });
608
+ *
609
+ * // Remove the event listener, use `disposable.dispose()`
610
+ * ```
611
+ */
612
+ get LifeCycleChanged() {
613
+ return "LifeCycleChanged";
614
+ }
615
+ /**
616
+ * Event fired when a redo command is executed
617
+ * @see {@link ICommandEvent}
618
+ * @example
619
+ * ```ts
620
+ * const disposable = univerAPI.addEvent(univerAPI.Event.Redo, (event) => {
621
+ * const { params, id, type } = event;
622
+ * console.log('redo command executed', event);
623
+ * });
624
+ *
625
+ * // Remove the event listener, use `disposable.dispose()`
626
+ * ```
627
+ */
628
+ get Redo() {
629
+ return "Redo";
630
+ }
631
+ /**
632
+ * Event fired when an undo command is executed
633
+ * @see {@link ICommandEvent}
634
+ * @example
635
+ * ```ts
636
+ * const disposable = univerAPI.addEvent(univerAPI.Event.Undo, (event) => {
637
+ * const { params, id, type } = event;
638
+ * console.log('undo command executed', event);
639
+ * });
640
+ *
641
+ * // Remove the event listener, use `disposable.dispose()`
642
+ * ```
643
+ */
644
+ get Undo() {
645
+ return "Undo";
646
+ }
647
+ /**
648
+ * Event fired before a redo command is executed
649
+ * @see {@link ICommandEvent}
650
+ * @example
651
+ * ```ts
652
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {
653
+ * const { params, id, type } = event;
654
+ * console.log('before redo command executed', event);
655
+ *
656
+ * // Cancel the redo operation
657
+ * event.cancel = true;
658
+ * });
659
+ *
660
+ * // Remove the event listener, use `disposable.dispose()`
661
+ * ```
662
+ */
663
+ get BeforeRedo() {
664
+ return "BeforeRedo";
665
+ }
666
+ /**
667
+ * Event fired before an undo command is executed
668
+ * @see {@link ICommandEvent}
669
+ * @example
670
+ * ```ts
671
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {
672
+ * const { params, id, type } = event;
673
+ * console.log('before undo command executed', event);
674
+ *
675
+ * // Cancel the undo operation
676
+ * event.cancel = true;
677
+ * });
678
+ *
679
+ * // Remove the event listener, use `disposable.dispose()`
680
+ * ```
681
+ */
682
+ get BeforeUndo() {
683
+ return "BeforeUndo";
684
+ }
685
+ /**
686
+ * Event fired when a command is executed
687
+ * @see {@link ICommandEvent}
688
+ * @example
689
+ * ```ts
690
+ * const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
691
+ * const { params, id, type } = event;
692
+ * console.log('command executed', event);
693
+ * });
694
+ *
695
+ * // Remove the event listener, use `disposable.dispose()`
696
+ * ```
697
+ */
698
+ get CommandExecuted() {
699
+ return "CommandExecuted";
700
+ }
701
+ /**
702
+ * Event fired before a command is executed
703
+ * @see {@link ICommandEvent}
704
+ * @example
705
+ * ```ts
706
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
707
+ * const { params, id, type } = event;
708
+ * console.log('before command executed', event);
709
+ *
710
+ * // Cancel the command execution
711
+ * event.cancel = true;
712
+ * });
713
+ *
714
+ * // Remove the event listener, use `disposable.dispose()`
715
+ * ```
716
+ */
717
+ get BeforeCommandExecute() {
718
+ return "BeforeCommandExecute";
719
+ }
720
+ };
721
+ /**
722
+ * @ignore
723
+ */
724
+ d(v, "_instance");
725
+ let O = v;
726
+ var Me = Object.getOwnPropertyDescriptor, ze = (n, e, t, r) => {
727
+ for (var i = r > 1 ? void 0 : r ? Me(e, t) : e, o = n.length - 1, s; o >= 0; o--)
728
+ (s = n[o]) && (i = s(i) || i);
729
+ return i;
730
+ }, M = (n, e) => (t, r) => e(t, r, n);
731
+ let P = class extends $ {
732
+ constructor(n, e) {
733
+ super(), this._injector = n, this._lifecycleService = e;
734
+ }
735
+ /**
736
+ * @param callback
737
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
738
+ */
739
+ onStarting(n) {
740
+ return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Starting)).subscribe(n));
741
+ }
742
+ /**
743
+ * @param callback
744
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
745
+ */
746
+ onReady(n) {
747
+ return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Ready)).subscribe(n));
748
+ }
749
+ /**
750
+ * @param callback
751
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
752
+ */
753
+ onRendered(n) {
754
+ return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Rendered)).subscribe(n));
755
+ }
756
+ /**
757
+ * @param callback
758
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
759
+ */
760
+ onSteady(n) {
761
+ return p(this._lifecycleService.lifecycle$.pipe(E((e) => e === f.Steady)).subscribe(n));
762
+ }
763
+ /**
764
+ * @param callback
765
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
766
+ */
767
+ onBeforeUndo(n) {
768
+ return this._injector.get(y).beforeCommandExecuted((t) => {
769
+ if (t.id === h.id) {
770
+ const i = this._injector.get(m).pitchTopUndoElement();
771
+ i && n(i);
772
+ }
773
+ });
774
+ }
775
+ /**
776
+ * @param callback
777
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
778
+ */
779
+ onUndo(n) {
780
+ return this._injector.get(y).onCommandExecuted((t) => {
781
+ if (t.id === h.id) {
782
+ const i = this._injector.get(m).pitchTopUndoElement();
783
+ i && n(i);
784
+ }
785
+ });
786
+ }
787
+ /**
788
+ * @param callback
789
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
790
+ */
791
+ onBeforeRedo(n) {
792
+ return this._injector.get(y).beforeCommandExecuted((t) => {
793
+ if (t.id === u.id) {
794
+ const i = this._injector.get(m).pitchTopRedoElement();
795
+ i && n(i);
796
+ }
797
+ });
798
+ }
799
+ /**
800
+ * @param callback
801
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
802
+ */
803
+ onRedo(n) {
804
+ return this._injector.get(y).onCommandExecuted((t) => {
805
+ if (t.id === u.id) {
806
+ const i = this._injector.get(m).pitchTopRedoElement();
807
+ i && n(i);
808
+ }
809
+ });
810
+ }
811
+ };
812
+ P = ze([
813
+ M(0, l(_)),
814
+ M(1, l(I))
815
+ ], P);
816
+ var Ae = Object.getOwnPropertyDescriptor, Ne = (n, e, t, r) => {
817
+ for (var i = r > 1 ? void 0 : r ? Ae(e, t) : e, o = n.length - 1, s; o >= 0; o--)
818
+ (s = n[o]) && (i = s(i) || i);
819
+ return i;
820
+ }, Le = (n, e) => (t, r) => e(t, r, n);
821
+ let j = class extends Ue {
822
+ constructor(n, e) {
823
+ super(e), this.doc = n;
824
+ }
825
+ };
826
+ j = Ne([
827
+ Le(1, l(_))
828
+ ], j);
829
+ class Fe {
830
+ constructor() {
831
+ d(this, "_eventRegistry", /* @__PURE__ */ new Map());
832
+ d(this, "_eventHandlerMap", /* @__PURE__ */ new Map());
833
+ d(this, "_eventHandlerRegisted", /* @__PURE__ */ new Map());
834
+ }
835
+ _ensureEventRegistry(e) {
836
+ return this._eventRegistry.has(e) || this._eventRegistry.set(e, new Ee()), this._eventRegistry.get(e);
837
+ }
838
+ registerEventHandler(e, t) {
839
+ const r = this._eventHandlerMap.get(e);
840
+ return r ? r.add(t) : this._eventHandlerMap.set(e, /* @__PURE__ */ new Set([t])), this._ensureEventRegistry(e).getData().length && this._initEventHandler(e), p(() => {
841
+ var i, o, s, a;
842
+ (i = this._eventHandlerMap.get(e)) == null || i.delete(t), (s = (o = this._eventHandlerRegisted.get(e)) == null ? void 0 : o.get(t)) == null || s.dispose(), (a = this._eventHandlerRegisted.get(e)) == null || a.delete(t);
843
+ });
844
+ }
845
+ removeEvent(e, t) {
846
+ const r = this._ensureEventRegistry(e);
847
+ if (r.delete(t), r.getData().length === 0) {
848
+ const i = this._eventHandlerRegisted.get(e);
849
+ i == null || i.forEach((o) => o.dispose()), this._eventHandlerRegisted.delete(e);
850
+ }
851
+ }
852
+ _initEventHandler(e) {
853
+ let t = this._eventHandlerRegisted.get(e);
854
+ const r = this._eventHandlerMap.get(e);
855
+ r && (t || (t = /* @__PURE__ */ new Map(), this._eventHandlerRegisted.set(e, t), r == null || r.forEach((i) => {
856
+ t == null || t.set(i, p(i()));
857
+ })));
858
+ }
859
+ /**
860
+ * Add an event listener
861
+ * @param {string} event key of event
862
+ * @param {(params: IEventParamConfig[typeof event]) => void} callback callback when event triggered
863
+ * @returns {Disposable} The Disposable instance, for remove the listener
864
+ * @example
865
+ * ```ts
866
+ * univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
867
+ * const { stage } = params;
868
+ * console.log('life cycle changed', params);
869
+ * });
870
+ * ```
871
+ */
872
+ addEvent(e, t) {
873
+ return this._ensureEventRegistry(e).add(t), this._initEventHandler(e), p(() => this.removeEvent(e, t));
874
+ }
875
+ /**
876
+ * Fire an event, used in internal only.
877
+ * @param {string} event key of event
878
+ * @param {any} params params of event
879
+ * @returns {boolean} should cancel
880
+ * @example
881
+ * ```ts
882
+ * this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
883
+ * ```
884
+ */
885
+ fireEvent(e, t) {
886
+ var r;
887
+ return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((i) => {
888
+ i(t);
889
+ }), t.cancel;
890
+ }
891
+ }
892
+ var We = Object.getOwnPropertyDescriptor, qe = (n, e, t, r) => {
893
+ for (var i = r > 1 ? void 0 : r ? We(e, t) : e, o = n.length - 1, s; o >= 0; o--)
894
+ (s = n[o]) && (i = s(i) || i);
895
+ return i;
896
+ }, z = (n, e) => (t, r) => e(t, r, n);
897
+ let B = class extends $ {
898
+ constructor(n, e) {
899
+ super(), this._injector = n, this._userManagerService = e;
900
+ }
901
+ /**
902
+ * Get current user info.
903
+ * @returns {IUser} Current user info.
904
+ * @example
905
+ * ```typescript
906
+ * univerAPI.getUserManager().getCurrentUser();
907
+ * ```
908
+ */
909
+ getCurrentUser() {
910
+ return this._userManagerService.getCurrentUser();
911
+ }
912
+ };
913
+ B = qe([
914
+ z(0, l(_)),
915
+ z(1, l(be))
916
+ ], B);
917
+ const C = class C {
918
+ static get() {
919
+ if (this._instance)
920
+ return this._instance;
921
+ const e = new C();
922
+ return this._instance = e, e;
923
+ }
924
+ /**
925
+ * @ignore
926
+ */
927
+ static extend(e) {
928
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
929
+ t !== "constructor" && (this.prototype[t] = e.prototype[t]);
930
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
931
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
932
+ });
933
+ }
934
+ /**
935
+ * Rectangle utils, including range operations likes merge, subtract, split
936
+ *
937
+ * @example
938
+ * ```ts
939
+ * const ranges = [
940
+ * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
941
+ * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
942
+ * ];
943
+ * const merged = univerAPI.Util.rectangle.mergeRanges(ranges);
944
+ * console.log(merged);
945
+ * ```
946
+ */
947
+ get rectangle() {
948
+ return Se;
949
+ }
950
+ /**
951
+ * Number format utils, including parse and strigify about date, price, etc
952
+ *
953
+ * @example
954
+ * ```ts
955
+ * const text = univerAPI.Util.numfmt.format('#,##0.00', 1234.567);
956
+ * console.log(text);
957
+ * ```
958
+ */
959
+ get numfmt() {
960
+ return Ce;
961
+ }
962
+ /**
963
+ * common tools
964
+ *
965
+ * @example
966
+ * ```ts
967
+ * const key = univerAPI.Util.tools.generateRandomId(6);
968
+ * console.log(key);
969
+ * ```
970
+ */
971
+ get tools() {
972
+ return De;
973
+ }
974
+ };
975
+ /**
976
+ * @ignore
977
+ */
978
+ d(C, "_instance");
979
+ let H = C;
980
+ var Ge = Object.getOwnPropertyDescriptor, Je = (n, e, t, r) => {
981
+ for (var i = r > 1 ? void 0 : r ? Ge(e, t) : e, o = n.length - 1, s; o >= 0; o--)
982
+ (s = n[o]) && (i = s(i) || i);
983
+ return i;
984
+ }, b = (n, e) => (t, r) => e(t, r, n);
985
+ const T = Symbol("initializers");
986
+ let U = class extends V {
987
+ constructor(e, t, r, i) {
988
+ super();
989
+ d(this, "_eventRegistry", new Fe());
990
+ d(this, "registerEventHandler", (e, t) => this._eventRegistry.registerEventHandler(e, t));
991
+ this._injector = e, this._commandService = t, this._univerInstanceService = r, this._lifecycleService = i, this.registerEventHandler(
992
+ this.Event.LifeCycleChanged,
993
+ () => p(
994
+ this._lifecycleService.lifecycle$.subscribe((s) => {
995
+ this.fireEvent(this.Event.LifeCycleChanged, { stage: s });
996
+ })
997
+ )
998
+ ), this._initUnitEvent(this._injector), this._initBeforeCommandEvent(this._injector), this._initCommandEvent(this._injector), this._injector.onDispose(() => {
999
+ this.dispose();
1000
+ });
1001
+ const o = Object.getPrototypeOf(this)[T];
1002
+ if (o) {
1003
+ const s = this;
1004
+ o.forEach(function(a) {
1005
+ a.apply(s, [e]);
1006
+ });
1007
+ }
1008
+ }
1009
+ /**
1010
+ * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
1011
+ * @static
1012
+ * @param {Univer | Injector} wrapped - The Univer instance or injector instance.
1013
+ * @returns {FUniver} - The FUniver instance.
1014
+ *
1015
+ * @example
1016
+ * ```ts
1017
+ * const univerAPI = FUniver.newAPI(univer);
1018
+ * ```
1019
+ */
1020
+ static newAPI(e) {
1021
+ return (e instanceof xe ? e.__getInjector() : e).createInstance(U);
1022
+ }
1023
+ /**
1024
+ * @ignore
1025
+ */
1026
+ _initialize(e) {
1027
+ }
1028
+ /**
1029
+ * @ignore
1030
+ */
1031
+ static extend(e) {
1032
+ Object.getOwnPropertyNames(e.prototype).forEach((t) => {
1033
+ if (t === "_initialize") {
1034
+ let r = this.prototype[T];
1035
+ r || (r = [], this.prototype[T] = r), r.push(e.prototype._initialize);
1036
+ } else t !== "constructor" && (this.prototype[t] = e.prototype[t]);
1037
+ }), Object.getOwnPropertyNames(e).forEach((t) => {
1038
+ t !== "prototype" && t !== "name" && t !== "length" && (this[t] = e[t]);
1039
+ });
1040
+ }
1041
+ _initCommandEvent(e) {
1042
+ const t = e.get(y);
1043
+ this.registerEventHandler(
1044
+ this.Event.Redo,
1045
+ () => t.onCommandExecuted((r) => {
1046
+ const { id: i, type: o, params: s } = r;
1047
+ if (r.id === u.id) {
1048
+ const c = { id: i, type: o, params: s };
1049
+ this.fireEvent(this.Event.Redo, c);
1050
+ }
1051
+ })
1052
+ ), this.registerEventHandler(
1053
+ this.Event.Undo,
1054
+ () => t.onCommandExecuted((r) => {
1055
+ const { id: i, type: o, params: s } = r;
1056
+ if (r.id === h.id) {
1057
+ const c = { id: i, type: o, params: s };
1058
+ this.fireEvent(this.Event.Undo, c);
1059
+ }
1060
+ })
1061
+ ), this.registerEventHandler(
1062
+ this.Event.CommandExecuted,
1063
+ () => t.onCommandExecuted((r) => {
1064
+ const { id: i, type: o, params: s } = r;
1065
+ if (r.id !== u.id && r.id !== h.id) {
1066
+ const c = { id: i, type: o, params: s };
1067
+ this.fireEvent(this.Event.CommandExecuted, c);
1068
+ }
1069
+ })
1070
+ );
1071
+ }
1072
+ _initBeforeCommandEvent(e) {
1073
+ const t = e.get(y);
1074
+ this.registerEventHandler(
1075
+ this.Event.BeforeRedo,
1076
+ () => t.beforeCommandExecuted((r) => {
1077
+ const { id: i, type: o, params: s } = r;
1078
+ if (r.id === u.id) {
1079
+ const c = { id: i, type: o, params: s };
1080
+ if (this.fireEvent(this.Event.BeforeRedo, c), c.cancel)
1081
+ throw new D();
1082
+ }
1083
+ })
1084
+ ), this.registerEventHandler(
1085
+ this.Event.BeforeUndo,
1086
+ () => t.beforeCommandExecuted((r) => {
1087
+ const { id: i, type: o, params: s } = r;
1088
+ if (r.id === h.id) {
1089
+ const c = { id: i, type: o, params: s };
1090
+ if (this.fireEvent(this.Event.BeforeUndo, c), c.cancel)
1091
+ throw new D();
1092
+ }
1093
+ })
1094
+ ), this.registerEventHandler(
1095
+ this.Event.BeforeCommandExecute,
1096
+ () => t.beforeCommandExecuted((r) => {
1097
+ const { id: i, type: o, params: s } = r;
1098
+ if (r.id !== u.id && r.id !== h.id) {
1099
+ const c = { id: i, type: o, params: s };
1100
+ if (this.fireEvent(this.Event.BeforeCommandExecute, c), c.cancel)
1101
+ throw new D();
1102
+ }
1103
+ })
1104
+ );
1105
+ }
1106
+ _initUnitEvent(e) {
1107
+ const t = e.get(A);
1108
+ this.registerEventHandler(
1109
+ this.Event.DocDisposed,
1110
+ () => t.unitDisposed$.subscribe((r) => {
1111
+ r.type === w.UNIVER_DOC && this.fireEvent(this.Event.DocDisposed, {
1112
+ unitId: r.getUnitId(),
1113
+ unitType: r.type,
1114
+ snapshot: r.getSnapshot()
1115
+ });
1116
+ })
1117
+ ), this.registerEventHandler(
1118
+ this.Event.DocCreated,
1119
+ () => t.unitAdded$.subscribe((r) => {
1120
+ if (r.type === w.UNIVER_DOC) {
1121
+ const i = r, o = e.createInstance(j, i);
1122
+ this.fireEvent(this.Event.DocCreated, {
1123
+ unitId: r.getUnitId(),
1124
+ type: r.type,
1125
+ doc: o,
1126
+ unit: o
1127
+ });
1128
+ }
1129
+ })
1130
+ );
1131
+ }
1132
+ /**
1133
+ * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
1134
+ * @param unitId The unit id of the UniverSheet.
1135
+ * @returns Whether the Univer instance is disposed successfully.
1136
+ *
1137
+ * @example
1138
+ * ```ts
1139
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1140
+ * const unitId = fWorkbook?.getId();
1141
+ *
1142
+ * if (unitId) {
1143
+ * univerAPI.disposeUnit(unitId);
1144
+ * }
1145
+ * ```
1146
+ */
1147
+ disposeUnit(e) {
1148
+ return this._univerInstanceService.disposeUnit(e);
1149
+ }
1150
+ /**
1151
+ * Get the current lifecycle stage.
1152
+ * @returns {LifecycleStages} - The current lifecycle stage.
1153
+ *
1154
+ * @example
1155
+ * ```ts
1156
+ * const stage = univerAPI.getCurrentLifecycleStage();
1157
+ * console.log(stage);
1158
+ * ```
1159
+ */
1160
+ getCurrentLifecycleStage() {
1161
+ return this._injector.get(I).stage;
1162
+ }
1163
+ /**
1164
+ * Undo an editing on the currently focused document.
1165
+ * @returns {Promise<boolean>} undo result
1166
+ *
1167
+ * @example
1168
+ * ```ts
1169
+ * await univerAPI.undo();
1170
+ * ```
1171
+ */
1172
+ undo() {
1173
+ return this._commandService.executeCommand(h.id);
1174
+ }
1175
+ /**
1176
+ * Redo an editing on the currently focused document.
1177
+ * @returns {Promise<boolean>} redo result
1178
+ *
1179
+ * @example
1180
+ * ```ts
1181
+ * await univerAPI.redo();
1182
+ * ```
1183
+ */
1184
+ redo() {
1185
+ return this._commandService.executeCommand(u.id);
1186
+ }
1187
+ /**
1188
+ * Register a callback that will be triggered before invoking a command.
1189
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
1190
+ * @param {CommandListener} callback The callback.
1191
+ * @returns {IDisposable} The disposable instance.
1192
+ */
1193
+ onBeforeCommandExecute(e) {
1194
+ return this._commandService.beforeCommandExecuted((t, r) => {
1195
+ e(t, r);
1196
+ });
1197
+ }
1198
+ /**
1199
+ * Register a callback that will be triggered when a command is invoked.
1200
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {})` instead.
1201
+ * @param {CommandListener} callback The callback.
1202
+ * @returns {IDisposable} The disposable instance.
1203
+ */
1204
+ onCommandExecuted(e) {
1205
+ return this._commandService.onCommandExecuted((t, r) => {
1206
+ e(t, r);
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Execute a command with the given id and parameters.
1211
+ * @param id Identifier of the command.
1212
+ * @param params Parameters of this execution.
1213
+ * @param options Options of this execution.
1214
+ * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
1215
+ *
1216
+ * @example
1217
+ * ```ts
1218
+ * univerAPI.executeCommand('sheet.command.set-range-values', {
1219
+ * value: { v: "Hello, Univer!" },
1220
+ * range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
1221
+ * });
1222
+ * ```
1223
+ */
1224
+ executeCommand(e, t, r) {
1225
+ return this._commandService.executeCommand(e, t, r);
1226
+ }
1227
+ /**
1228
+ * Execute a command with the given id and parameters synchronously.
1229
+ * @param id Identifier of the command.
1230
+ * @param params Parameters of this execution.
1231
+ * @param options Options of this execution.
1232
+ * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
1233
+ *
1234
+ * @example
1235
+ * ```ts
1236
+ * univerAPI.syncExecuteCommand('sheet.command.set-range-values', {
1237
+ * value: { v: "Hello, Univer!" },
1238
+ * range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
1239
+ * });
1240
+ * ```
1241
+ */
1242
+ syncExecuteCommand(e, t, r) {
1243
+ return this._commandService.syncExecuteCommand(e, t, r);
1244
+ }
1245
+ /**
1246
+ * Get hooks.
1247
+ * @deprecated use `addEvent` instead.
1248
+ * @returns {FHooks} FHooks instance
1249
+ */
1250
+ getHooks() {
1251
+ return this._injector.createInstance(P);
1252
+ }
1253
+ get Enum() {
1254
+ return R.get();
1255
+ }
1256
+ get Event() {
1257
+ return O.get();
1258
+ }
1259
+ get Util() {
1260
+ return H.get();
1261
+ }
1262
+ /**
1263
+ * Add an event listener
1264
+ * @param {string} event key of event
1265
+ * @param {(params: IEventParamConfig[typeof event]) => void} callback callback when event triggered
1266
+ * @returns {Disposable} The Disposable instance, for remove the listener
1267
+ * @example
1268
+ * ```ts
1269
+ * // Add life cycle changed event listener
1270
+ * const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
1271
+ * const { stage } = params;
1272
+ * console.log('life cycle changed', params);
1273
+ * });
1274
+ *
1275
+ * // Remove the event listener, use `disposable.dispose()`
1276
+ * ```
1277
+ */
1278
+ addEvent(e, t) {
1279
+ if (!e || !t) throw new Error("Cannot add empty event");
1280
+ return this._eventRegistry.addEvent(e, t);
1281
+ }
1282
+ /**
1283
+ * Fire an event, used in internal only.
1284
+ * @param {string} event key of event
1285
+ * @param {any} params params of event
1286
+ * @returns {boolean} should cancel
1287
+ * @example
1288
+ * ```ts
1289
+ * this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
1290
+ * ```
1291
+ */
1292
+ fireEvent(e, t) {
1293
+ return this._eventRegistry.fireEvent(e, t);
1294
+ }
1295
+ getUserManager() {
1296
+ return this._injector.createInstance(B);
1297
+ }
1298
+ /**
1299
+ * Create a new blob.
1300
+ * @returns {FBlob} The new blob instance
1301
+ * @example
1302
+ * ```ts
1303
+ * const blob = univerAPI.newBlob();
1304
+ * ```
1305
+ */
1306
+ newBlob() {
1307
+ return this._injector.createInstance(S);
1308
+ }
1309
+ /**
1310
+ * Create a new color.
1311
+ * @returns {ColorBuilder} The new color instance
1312
+ * @example
1313
+ * ```ts
1314
+ * const color = univerAPI.newColor();
1315
+ * ```
1316
+ */
1317
+ newColor() {
1318
+ return new Te();
1319
+ }
1320
+ /**
1321
+ * Create a new rich text.
1322
+ * @param {IDocumentData} data
1323
+ * @returns {RichTextBuilder} The new rich text instance
1324
+ * @example
1325
+ * ```ts
1326
+ * const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
1327
+ * const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
1328
+ * range.setRichTextValueForCell(richText);
1329
+ * ```
1330
+ */
1331
+ newRichText(e) {
1332
+ return we.create(e);
1333
+ }
1334
+ /**
1335
+ * Create a new rich text value.
1336
+ * @param {IDocumentData} data - The rich text data
1337
+ * @returns {RichTextValue} The new rich text value instance
1338
+ * @example
1339
+ * ```ts
1340
+ * const richTextValue = univerAPI.newRichTextValue({ body: { dataStream: 'Hello World\r\n' } });
1341
+ * const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
1342
+ * range.setRichTextValueForCell(richTextValue);
1343
+ * ```
1344
+ */
1345
+ newRichTextValue(e) {
1346
+ return Re.create(e);
1347
+ }
1348
+ /**
1349
+ * Create a new paragraph style.
1350
+ * @param {IParagraphStyle} style - The paragraph style
1351
+ * @returns {ParagraphStyleBuilder} The new paragraph style instance
1352
+ * @example
1353
+ * ```ts
1354
+ * const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
1355
+ * const paragraphStyle = univerAPI.newParagraphStyle({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
1356
+ * richText.insertParagraph(paragraphStyle);
1357
+ * const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
1358
+ * range.setRichTextValueForCell(richText);
1359
+ * ```
1360
+ */
1361
+ newParagraphStyle(e) {
1362
+ return Oe.create(e);
1363
+ }
1364
+ /**
1365
+ * Create a new paragraph style value.
1366
+ * @param {IParagraphStyle} style - The paragraph style
1367
+ * @returns {ParagraphStyleValue} The new paragraph style value instance
1368
+ * @example
1369
+ * ```ts
1370
+ * const paragraphStyleValue = univerAPI.newParagraphStyleValue();
1371
+ * ```
1372
+ */
1373
+ newParagraphStyleValue(e) {
1374
+ return Pe.create(e);
1375
+ }
1376
+ /**
1377
+ * Create a new text style.
1378
+ * @param {ITextStyle} style - The text style
1379
+ * @returns {TextStyleBuilder} The new text style instance
1380
+ * @example
1381
+ * ```ts
1382
+ * const textStyle = univerAPI.newTextStyle();
1383
+ * ```
1384
+ */
1385
+ newTextStyle(e) {
1386
+ return je.create(e);
1387
+ }
1388
+ /**
1389
+ * Create a new text style value.
1390
+ * @param {ITextStyle} style - The text style
1391
+ * @returns {TextStyleValue} The new text style value instance
1392
+ * @example
1393
+ * ```ts
1394
+ * const textStyleValue = univerAPI.newTextStyleValue();
1395
+ * ```
1396
+ */
1397
+ newTextStyleValue(e) {
1398
+ return Be.create(e);
1399
+ }
1400
+ /**
1401
+ * Create a new text decoration.
1402
+ * @param {ITextDecoration} decoration - The text decoration
1403
+ * @returns {TextDecorationBuilder} The new text decoration instance
1404
+ * @example
1405
+ * ```ts
1406
+ * const decoration = univerAPI.newTextDecoration();
1407
+ * ```
1408
+ */
1409
+ newTextDecoration(e) {
1410
+ return new He(e);
1411
+ }
1412
+ };
1413
+ U = Je([
1414
+ b(0, l(_)),
1415
+ b(1, y),
1416
+ b(2, A),
1417
+ b(3, l(I))
1418
+ ], U);
1419
+ export {
1420
+ $ as FBase,
1421
+ Ue as FBaseInitialable,
1422
+ S as FBlob,
1423
+ R as FEnum,
1424
+ O as FEventName,
1425
+ P as FHooks,
1426
+ U as FUniver,
1427
+ H as FUtil
1428
+ };