@univerjs/docs 1.3.1 → 1.5.0

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/index.js CHANGED
@@ -1,10 +1,11 @@
1
- import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SHEET_TEXT_LINE_GAP, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, requestImmediateMacroTask, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
2
- import { DocumentLayoutSession, DocumentSkeleton, DocumentViewModel, FontCache, IRenderManagerService, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, getDocsCustomBlockRenderViewport, getDocumentLayoutPresentation, getFontStyleString, setDocsCustomBlockRenderViewportProvider } from "@univerjs/engine-render";
1
+ import { _ as _defineProperty, c as name, d as DocLayoutExecutorState, f as DocLayoutExecutorType, g as __decorateParam, h as __decorate, i as DOCS_PLUGIN_CONFIG_KEY, l as version, m as RICH_TEXT_EDITING_MUTATION_ID, n as DocsLayoutWorkerPerformanceTracker, o as defaultPluginConfig, p as DocLayoutSessionStatus, r as DocsLayoutFontLoader, t as DOCS_LAYOUT_WORKER_CHANNEL, u as DocLayoutExecutorService } from "./protocol-D1XjAOOp.js";
2
+ import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MemoryCursor, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SHEET_TEXT_LINE_GAP, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
3
+ import { DocumentSkeleton, DocumentViewModel, FontCache, IRenderManagerService, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, SheetCellDocumentViewModel, getDocumentLayoutPresentation, getFontStyleString } from "@univerjs/engine-render";
3
4
  import { BehaviorSubject, Observable, Subject, shareReplay, takeUntil } from "rxjs";
4
5
  import { UnitAction, UnitObject } from "@univerjs/protocol";
5
- import { ChannelService, fromModule, toModule } from "@univerjs/rpc";
6
+ import { ChannelService, toModule } from "@univerjs/rpc";
6
7
 
7
- //#region src/commands/operations/text-selection.operation.ts
8
+ // src/commands/operations/text-selection.operation.ts
8
9
  const SetTextSelectionsOperation = {
9
10
  id: "doc.operation.set-selections",
10
11
  type: CommandType.OPERATION,
@@ -13,67 +14,7 @@ const SetTextSelectionsOperation = {
13
14
  }
14
15
  };
15
16
 
16
- //#endregion
17
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
18
- function _typeof(o) {
19
- "@babel/helpers - typeof";
20
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
21
- return typeof o;
22
- } : function(o) {
23
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
24
- }, _typeof(o);
25
- }
26
-
27
- //#endregion
28
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
29
- function toPrimitive(t, r) {
30
- if ("object" != _typeof(t) || !t) return t;
31
- var e = t[Symbol.toPrimitive];
32
- if (void 0 !== e) {
33
- var i = e.call(t, r || "default");
34
- if ("object" != _typeof(i)) return i;
35
- throw new TypeError("@@toPrimitive must return a primitive value.");
36
- }
37
- return ("string" === r ? String : Number)(t);
38
- }
39
-
40
- //#endregion
41
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
42
- function toPropertyKey(t) {
43
- var i = toPrimitive(t, "string");
44
- return "symbol" == _typeof(i) ? i : i + "";
45
- }
46
-
47
- //#endregion
48
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
49
- function _defineProperty(e, r, t) {
50
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
51
- value: t,
52
- enumerable: !0,
53
- configurable: !0,
54
- writable: !0
55
- }) : e[r] = t, e;
56
- }
57
-
58
- //#endregion
59
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
60
- function __decorateParam(paramIndex, decorator) {
61
- return function(target, key) {
62
- decorator(target, key, paramIndex);
63
- };
64
- }
65
-
66
- //#endregion
67
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
68
- function __decorate(decorators, target, key, desc) {
69
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
70
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
71
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
- return c > 3 && r && Object.defineProperty(target, key, r), r;
73
- }
74
-
75
- //#endregion
76
- //#region src/services/doc-selection-manager.service.ts
17
+ // src/services/doc-selection-manager.service.ts
77
18
  /**
78
19
  * Keeps a programmatically restored collapsed caret from being promoted back
79
20
  * into a neighboring whole-entity selection by feature-specific UI.
@@ -251,664 +192,7 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
251
192
  };
252
193
  DocSelectionManagerService = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IUniverInstanceService)], DocSelectionManagerService);
253
194
 
254
- //#endregion
255
- //#region src/commands/mutations/core-editing.mutation-id.ts
256
- /**
257
- * Copyright 2023-present DreamNum Co., Ltd.
258
- *
259
- * Licensed under the Apache License, Version 2.0 (the "License");
260
- * you may not use this file except in compliance with the License.
261
- * You may obtain a copy of the License at
262
- *
263
- * http://www.apache.org/licenses/LICENSE-2.0
264
- *
265
- * Unless required by applicable law or agreed to in writing, software
266
- * distributed under the License is distributed on an "AS IS" BASIS,
267
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
- * See the License for the specific language governing permissions and
269
- * limitations under the License.
270
- */
271
- const RICH_TEXT_EDITING_MUTATION_ID = "doc.mutation.rich-text-editing";
272
-
273
- //#endregion
274
- //#region src/services/document-layout-snapshot.ts
275
- function projectCustomBlock(block) {
276
- const { docxRawXml: _docxRawXml, docxExportTs: _docxExportTs, ...layoutBlock } = block;
277
- return layoutBlock;
278
- }
279
- function projectDocumentBody(body) {
280
- const { docxRawCustomBlocks: _docxRawCustomBlocks, docxRawBlocks: _docxRawBlocks, docxExportExcludedRanges: _docxExportExcludedRanges, payloads: _payloads, customBlocks, ...layoutBody } = body;
281
- return {
282
- ...layoutBody,
283
- ...customBlocks == null ? {} : { customBlocks: customBlocks.map(projectCustomBlock) }
284
- };
285
- }
286
- function projectHeader(header) {
287
- return {
288
- ...header,
289
- body: projectDocumentBody(header.body)
290
- };
291
- }
292
- function projectFooter(footer) {
293
- return {
294
- ...footer,
295
- body: projectDocumentBody(footer.body)
296
- };
297
- }
298
- /**
299
- * Builds the model snapshot owned by the layout Worker. Exchange-only payloads
300
- * remain in the authoritative Main model and are deliberately excluded from
301
- * the structured-clone boundary because they do not affect document geometry.
302
- */
303
- function createDocumentLayoutSnapshot(snapshot) {
304
- const { resources: _resources, body, headers, footers, footnotes, endnotes, ...layoutSnapshot } = snapshot;
305
- return {
306
- ...layoutSnapshot,
307
- ...footnotes == null ? {} : { footnotes: Object.fromEntries(Object.entries(footnotes).map(([id, note]) => [id, {
308
- ...note,
309
- body: projectDocumentBody(note.body)
310
- }])) },
311
- ...endnotes == null ? {} : { endnotes: Object.fromEntries(Object.entries(endnotes).map(([id, note]) => [id, {
312
- ...note,
313
- body: projectDocumentBody(note.body)
314
- }])) },
315
- ...body == null ? {} : { body: projectDocumentBody(body) },
316
- ...headers == null ? {} : { headers: Object.fromEntries(Object.entries(headers).map(([headerId, header]) => [headerId, projectHeader(header)])) },
317
- ...footers == null ? {} : { footers: Object.fromEntries(Object.entries(footers).map(([footerId, footer]) => [footerId, projectFooter(footer)])) }
318
- };
319
- }
320
-
321
- //#endregion
322
- //#region src/services/doc-layout-executor.service.ts
323
- var _DocLayoutExecutorService;
324
- let DocLayoutExecutorType = /* @__PURE__ */ function(DocLayoutExecutorType) {
325
- DocLayoutExecutorType["MAIN_THREAD"] = "main-thread";
326
- DocLayoutExecutorType["WORKER"] = "worker";
327
- return DocLayoutExecutorType;
328
- }({});
329
- let DocLayoutSessionStatus = /* @__PURE__ */ function(DocLayoutSessionStatus) {
330
- DocLayoutSessionStatus["ACCEPTED"] = "accepted";
331
- DocLayoutSessionStatus["NOT_FOUND"] = "not-found";
332
- DocLayoutSessionStatus["RESNAPSHOT_REQUIRED"] = "resnapshot-required";
333
- DocLayoutSessionStatus["SUPERSEDED"] = "superseded";
334
- return DocLayoutSessionStatus;
335
- }({});
336
- let DocLayoutExecutorState = /* @__PURE__ */ function(DocLayoutExecutorState) {
337
- DocLayoutExecutorState["UNREGISTERED"] = "unregistered";
338
- DocLayoutExecutorState["INITIALIZING"] = "initializing";
339
- DocLayoutExecutorState["ACTIVE"] = "active";
340
- DocLayoutExecutorState["RECOVERING"] = "recovering";
341
- DocLayoutExecutorState["FAILED"] = "failed";
342
- return DocLayoutExecutorState;
343
- }({});
344
- function areShallowRecordsEqual(left, right) {
345
- const leftRecord = left;
346
- const rightRecord = right;
347
- const leftKeys = Object.keys(leftRecord);
348
- const rightKeys = Object.keys(rightRecord);
349
- return leftKeys.length === rightKeys.length && leftKeys.every((key) => leftRecord[key] === rightRecord[key]);
350
- }
351
- function createRecordPatch(previous, current) {
352
- const upserts = {};
353
- const removals = [];
354
- for (const [key, value] of Object.entries(current)) if (previous[key] == null || !areShallowRecordsEqual(previous[key], value)) upserts[key] = value;
355
- for (const key of Object.keys(previous)) if (current[key] == null) removals.push(key);
356
- return {
357
- removals,
358
- upserts
359
- };
360
- }
361
- function getCustomRangePresentationKey$1(entry) {
362
- return JSON.stringify([entry.segmentId, entry.rangeId]);
363
- }
364
- function toCustomRangePresentationMap(entries) {
365
- return new Map(entries.map((entry) => [getCustomRangePresentationKey$1(entry), entry]));
366
- }
367
- function createCustomRangePresentationPatch(previous, current) {
368
- const upserts = [];
369
- const removals = [];
370
- for (const [key, entry] of current) {
371
- const previousEntry = previous.get(key);
372
- if (previousEntry == null || !areShallowRecordsEqual(previousEntry.presentation, entry.presentation)) upserts.push(entry);
373
- }
374
- for (const [key, entry] of previous) if (!current.has(key)) removals.push({
375
- segmentId: entry.segmentId,
376
- rangeId: entry.rangeId
377
- });
378
- return {
379
- removals,
380
- upserts
381
- };
382
- }
383
- function isRichTextEditingMutationParams(value) {
384
- return typeof value === "object" && value != null && "unitId" in value && typeof value.unitId === "string" && "actions" in value;
385
- }
386
- function collectCustomBlockViewports(dataModel, options) {
387
- var _documentStyle$pageSi, _documentStyle$pageSi2;
388
- const snapshot = dataModel.getSnapshot();
389
- const documentStyle = snapshot.documentStyle;
390
- const isModern = documentStyle.documentFlavor === DocumentFlavor.MODERN;
391
- const modernMargin = options.modernHorizontalMargin ?? MODERN_DOCUMENT_DEFAULT_MARGIN;
392
- const pageMarginLeft = isModern ? modernMargin : documentStyle.marginLeft;
393
- const pageMarginRight = isModern ? modernMargin : documentStyle.marginRight;
394
- const pageWidth = isModern ? options.modernPageWidth ?? ((_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width) ?? MODERN_DOCUMENT_WIDTH[ModernDocumentWidthMode.MEDIUM] : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.width;
395
- const viewports = {};
396
- const bodies = [
397
- snapshot.body,
398
- ...Object.values(snapshot.headers ?? {}).map((header) => header.body),
399
- ...Object.values(snapshot.footers ?? {}).map((footer) => footer.body)
400
- ];
401
- for (const customBlock of bodies.flatMap((body) => (body === null || body === void 0 ? void 0 : body.customBlocks) ?? [])) {
402
- var _snapshot$drawings;
403
- const drawing = (_snapshot$drawings = snapshot.drawings) === null || _snapshot$drawings === void 0 ? void 0 : _snapshot$drawings[customBlock.blockId];
404
- if (drawing == null) continue;
405
- const viewport = getDocsCustomBlockRenderViewport(dataModel.getUnitId(), customBlock.blockId, {
406
- fallbackHeight: drawing.docTransform.size.height ?? 0,
407
- fallbackWidth: drawing.docTransform.size.width ?? 0,
408
- pageMarginLeft,
409
- pageMarginRight,
410
- pageWidth
411
- });
412
- if (viewport != null) viewports[customBlock.blockId] = { ...viewport };
413
- }
414
- return viewports;
415
- }
416
- let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecutorService extends Disposable {
417
- constructor(_univerInstanceService, _commandService, _localeService, _logService) {
418
- super();
419
- this._univerInstanceService = _univerInstanceService;
420
- this._commandService = _commandService;
421
- this._localeService = _localeService;
422
- this._logService = _logService;
423
- _defineProperty(this, "_executor", null);
424
- _defineProperty(this, "_executorReady", null);
425
- _defineProperty(this, "_recoveryFailure", null);
426
- _defineProperty(this, "_sessionEpoch", 0);
427
- _defineProperty(this, "_sessions", /* @__PURE__ */ new Map());
428
- _defineProperty(this, "_hydrationSamples", /* @__PURE__ */ new Map());
429
- _defineProperty(this, "_customRangePresentationProviders", /* @__PURE__ */ new Set());
430
- _defineProperty(this, "_executorStatus$", new BehaviorSubject({
431
- state: "unregistered",
432
- executor: null,
433
- diagnostic: null,
434
- recoveryUnitId: null
435
- }));
436
- _defineProperty(this, "executorStatus$", this._executorStatus$.asObservable());
437
- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_DOC).subscribe(({ unit }) => this._createSessionIfEligible(unit)));
438
- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_DOC).subscribe((unit) => this._disposeSession(unit.getUnitId())));
439
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
440
- if (command.id !== "doc.mutation.rich-text-editing") return;
441
- const params = command.params;
442
- if (!isRichTextEditingMutationParams(params)) {
443
- this._logService.warn("[DocLayoutExecutorService]: ignored malformed document mutation parameters.");
444
- return;
445
- }
446
- this._enqueueCommittedMutation(params);
447
- }));
448
- this.disposeWithMe(this._localeService.localeChanged$.subscribe(() => {
449
- for (const unitId of this._sessions.keys()) {
450
- const dataModel = this._getEligibleModel(unitId);
451
- if (dataModel != null) this._replaceSession(dataModel).catch((error) => {
452
- this._logService.error("[DocLayoutExecutorService]: failed to refresh Worker locale.", error);
453
- });
454
- }
455
- }));
456
- }
457
- register(executor) {
458
- if (this._executor != null) throw new Error("A document layout executor is already registered.");
459
- this._executor = executor;
460
- this._recoveryFailure = null;
461
- this._executorStatus$.next({
462
- state: "initializing",
463
- executor: executor.type,
464
- diagnostic: null,
465
- recoveryUnitId: null
466
- });
467
- const executorReady = executor.initialize();
468
- this._executorReady = executorReady;
469
- executorReady.then(() => {
470
- if (this._executor === executor) this._executorStatus$.next({
471
- state: "active",
472
- executor: executor.type,
473
- diagnostic: null,
474
- recoveryUnitId: null
475
- });
476
- }).catch((error) => {
477
- if (this._executor !== executor) return;
478
- this._executor = null;
479
- this._executorReady = null;
480
- this._disposeManagedSessions();
481
- this._sessions.clear();
482
- const diagnostic = error instanceof Error ? error.message : String(error);
483
- this._executorStatus$.next({
484
- state: "failed",
485
- executor: executor.type,
486
- diagnostic,
487
- recoveryUnitId: null
488
- });
489
- this._logService.error("[DocLayoutExecutorService]: document layout executor initialization failed.", error);
490
- });
491
- for (const unit of this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_DOC)) this._createSessionIfEligible(unit);
492
- return toDisposable(() => {
493
- if (this._executor === executor) {
494
- this._executor = null;
495
- this._executorReady = null;
496
- this._disposeManagedSessions();
497
- this._sessions.clear();
498
- this._executorStatus$.next({
499
- state: "unregistered",
500
- executor: null,
501
- diagnostic: null,
502
- recoveryUnitId: null
503
- });
504
- }
505
- });
506
- }
507
- getExecutor() {
508
- return this._executor;
509
- }
510
- getExecutorStatus() {
511
- return this._executorStatus$.value;
512
- }
513
- registerCustomRangePresentationProvider(provider) {
514
- this._customRangePresentationProviders.add(provider);
515
- return toDisposable(() => this._customRangePresentationProviders.delete(provider));
516
- }
517
- async getPerformanceMetrics(unitId) {
518
- var _this$_executor;
519
- const executorMetrics = await ((_this$_executor = this._executor) === null || _this$_executor === void 0 ? void 0 : _this$_executor.getPerformanceMetrics(unitId));
520
- return {
521
- hydrationMs: [...this._hydrationSamples.get(unitId) ?? []],
522
- mutationTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.mutationTransferMs) ?? []],
523
- patchTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.patchTransferMs) ?? []],
524
- snapshotTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.snapshotTransferMs) ?? []]
525
- };
526
- }
527
- async resetPerformanceMetrics(unitId) {
528
- var _this$_executor2;
529
- this._hydrationSamples.delete(unitId);
530
- await ((_this$_executor2 = this._executor) === null || _this$_executor2 === void 0 ? void 0 : _this$_executor2.resetPerformanceMetrics(unitId));
531
- }
532
- recordHydrationDuration(unitId, durationMs) {
533
- this._appendPerformanceSample(this._hydrationSamples, unitId, durationMs);
534
- }
535
- async recoverExecutor(unitId, diagnostic) {
536
- const executor = this._requireExecutor();
537
- this._executorStatus$.next({
538
- state: "recovering",
539
- executor: executor.type,
540
- diagnostic,
541
- recoveryUnitId: unitId
542
- });
543
- for (const session of this._sessions.values()) this._markSessionDisposed(session);
544
- this._sessions.clear();
545
- this._hydrationSamples.clear();
546
- try {
547
- const executorReady = executor.recover();
548
- this._executorReady = executorReady;
549
- await executorReady;
550
- } catch (error) {
551
- if (this._executor === executor) {
552
- const recoveryDiagnostic = error instanceof Error ? error.message : String(error);
553
- this._executor = null;
554
- this._executorReady = null;
555
- this._recoveryFailure = {
556
- diagnostic: recoveryDiagnostic,
557
- unitId
558
- };
559
- this._executorStatus$.next({
560
- state: "recovering",
561
- executor: executor.type,
562
- diagnostic: recoveryDiagnostic,
563
- recoveryUnitId: unitId
564
- });
565
- }
566
- throw error;
567
- }
568
- }
569
- completeRecovery(unitId) {
570
- var _this$_recoveryFailur;
571
- const status = this._executorStatus$.value;
572
- if (status.state !== "recovering" || status.recoveryUnitId !== unitId) return;
573
- const recoveryFailure = ((_this$_recoveryFailur = this._recoveryFailure) === null || _this$_recoveryFailur === void 0 ? void 0 : _this$_recoveryFailur.unitId) === unitId ? this._recoveryFailure : null;
574
- this._recoveryFailure = null;
575
- this._executorStatus$.next({
576
- state: recoveryFailure == null ? "active" : "failed",
577
- executor: status.executor,
578
- diagnostic: (recoveryFailure === null || recoveryFailure === void 0 ? void 0 : recoveryFailure.diagnostic) ?? null,
579
- recoveryUnitId: null
580
- });
581
- }
582
- async startLayout(identity, options, budgetMs) {
583
- const { unitId } = identity;
584
- const executor = this._executor;
585
- const dataModel = this._getEligibleModel(unitId);
586
- if (executor == null || dataModel == null) return null;
587
- let session = this._sessions.get(unitId);
588
- if (session != null && session.sourceMutationRevision !== dataModel.getMutationRevision()) session.needsResnapshot = true;
589
- if (session == null || session.needsResnapshot) session = await this._replaceSession(dataModel);
590
- if (session.disposed || this._executor !== executor || this._getEligibleModel(unitId) !== dataModel) return null;
591
- let result = await this._startSynchronizedLayout(executor, session, identity, options, budgetMs);
592
- if (session.disposed || this._executor !== executor || this._getEligibleModel(unitId) !== dataModel) return null;
593
- if (result.status === "not-found" || result.status === "resnapshot-required") {
594
- session = await this._replaceSession(dataModel);
595
- result = await this._startSynchronizedLayout(executor, session, identity, options, budgetMs);
596
- }
597
- return result;
598
- }
599
- stepLayout(request) {
600
- return this._requireExecutor().stepLayout(request);
601
- }
602
- publishBacklog(request) {
603
- return this._requireExecutor().publishBacklog(request);
604
- }
605
- getLayoutPage(request) {
606
- return this._requireExecutor().getLayoutPage(request);
607
- }
608
- cancelLayout(request) {
609
- const executor = this._executor;
610
- return executor == null ? Promise.resolve() : executor.cancelLayout(request);
611
- }
612
- disposeLayoutMount(request) {
613
- const executor = this._executor;
614
- const session = this._sessions.get(request.unitId);
615
- const latestStart = session === null || session === void 0 ? void 0 : session.latestStarts.get(request.mountId);
616
- if ((latestStart === null || latestStart === void 0 ? void 0 : latestStart.mountEpoch) === request.mountEpoch && latestStart.viewportEpoch === request.viewportEpoch) {
617
- session === null || session === void 0 || session.latestStarts.delete(request.mountId);
618
- session === null || session === void 0 || session.customBlockViewportsByMount.delete(request.mountId);
619
- }
620
- return executor == null ? Promise.resolve() : executor.disposeLayoutMount(request);
621
- }
622
- dispose() {
623
- const executor = this._executor;
624
- if (executor != null) for (const [unitId, session] of this._sessions) {
625
- this._markSessionDisposed(session);
626
- executor.disposeSession({
627
- unitId,
628
- sessionEpoch: session.sessionEpoch
629
- }).catch((error) => {
630
- if (this._executor === executor) this._logService.error("[DocLayoutExecutorService]: failed to dispose a Worker session.", error);
631
- });
632
- }
633
- this._sessions.clear();
634
- this._executor = null;
635
- this._executorReady = null;
636
- this._recoveryFailure = null;
637
- this._executorStatus$.complete();
638
- this._customRangePresentationProviders.clear();
639
- super.dispose();
640
- }
641
- _createSessionIfEligible(dataModel) {
642
- if (this._executor == null || !this._isEligible(dataModel) || this._sessions.has(dataModel.getUnitId())) return;
643
- this._replaceSession(dataModel).catch((error) => {
644
- this._logService.error("[DocLayoutExecutorService]: failed to create a Worker session.", error);
645
- });
646
- }
647
- _enqueueCommittedMutation(params) {
648
- var _params$actions;
649
- const executor = this._executor;
650
- const dataModel = this._getEligibleModel(params.unitId);
651
- if (executor == null || dataModel == null) return;
652
- if (JSONX.isNoop(params.actions) || ((_params$actions = params.actions) === null || _params$actions === void 0 ? void 0 : _params$actions.length) === 0) return;
653
- const session = this._sessions.get(params.unitId);
654
- if (session == null) {
655
- this._replaceSession(dataModel).catch((error) => {
656
- this._logService.error("[DocLayoutExecutorService]: failed to snapshot a document mutation.", error);
657
- });
658
- return;
659
- }
660
- const sourceMutationRevision = dataModel.getMutationRevision();
661
- if (sourceMutationRevision !== session.sourceMutationRevision + 1) {
662
- session.needsResnapshot = true;
663
- return;
664
- }
665
- const baseRevision = session.modelRevision;
666
- const modelRevision = baseRevision + 1;
667
- session.modelRevision = modelRevision;
668
- session.sourceMutationRevision = sourceMutationRevision;
669
- session.pendingMutations.push({
670
- baseRevision,
671
- modelRevision,
672
- actions: params.actions
673
- });
674
- }
675
- async _startSynchronizedLayout(executor, session, identity, options, budgetMs) {
676
- var _session$latestStarts;
677
- const { unitId, mountId } = identity;
678
- const startId = (((_session$latestStarts = session.latestStarts.get(mountId)) === null || _session$latestStarts === void 0 ? void 0 : _session$latestStarts.startId) ?? 0) + 1;
679
- const startIdentity = {
680
- startId,
681
- mountEpoch: identity.mountEpoch,
682
- viewportEpoch: identity.viewportEpoch
683
- };
684
- session.latestStarts.set(mountId, startIdentity);
685
- const startTask = session.queue.then(async () => {
686
- if (session.disposed || this._executor !== executor) return { status: "not-found" };
687
- const currentModel = this._getEligibleModel(unitId);
688
- if (currentModel == null || currentModel.getMutationRevision() !== session.sourceMutationRevision) {
689
- session.needsResnapshot = true;
690
- return {
691
- status: "resnapshot-required",
692
- modelRevision: session.workerRevision
693
- };
694
- }
695
- if (session.latestStarts.get(mountId) !== startIdentity) return { status: "superseded" };
696
- const mutations = session.pendingMutations.slice();
697
- const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId), options);
698
- const request = {
699
- ...identity,
700
- metricsRevision: startId,
701
- baseRevision: session.workerRevision,
702
- modelRevision: session.modelRevision,
703
- mutations,
704
- ...projections.request,
705
- budgetMs,
706
- ...options
707
- };
708
- const result = await executor.startLayout(request);
709
- if (result.status === "accepted") {
710
- session.workerRevision = request.modelRevision;
711
- session.pendingMutations.splice(0, mutations.length);
712
- session.customBlockViewportsByMount.set(mountId, {
713
- mountEpoch: identity.mountEpoch,
714
- value: projections.customBlockViewports
715
- });
716
- session.customRangePresentations = projections.customRangePresentations;
717
- } else session.needsResnapshot = true;
718
- return result;
719
- });
720
- session.queue = startTask.then(() => void 0, (error) => {
721
- if (session.disposed || this._executor !== executor) return;
722
- session.needsResnapshot = true;
723
- this._logService.error("[DocLayoutExecutorService]: synchronized layout start failed.", error);
724
- });
725
- return startTask;
726
- }
727
- _createLayoutProjectionPayload(session, identity, dataModel, options) {
728
- const customBlockViewports = collectCustomBlockViewports(dataModel, options);
729
- const previousCustomBlockViewports = session.customBlockViewportsByMount.get(identity.mountId);
730
- const customRangePresentations = this._collectCustomRangePresentations(dataModel);
731
- const customRangePresentationMap = toCustomRangePresentationMap(customRangePresentations);
732
- const request = {};
733
- if (previousCustomBlockViewports == null || previousCustomBlockViewports.mountEpoch !== identity.mountEpoch) request.customBlockViewports = customBlockViewports;
734
- else {
735
- const patch = createRecordPatch(previousCustomBlockViewports.value, customBlockViewports);
736
- if (patch.removals.length > 0 || Object.keys(patch.upserts).length > 0) request.customBlockViewportPatch = patch;
737
- }
738
- if (session.customRangePresentations == null) request.customRangePresentations = customRangePresentations;
739
- else {
740
- const patch = createCustomRangePresentationPatch(session.customRangePresentations, customRangePresentationMap);
741
- if (patch.removals.length > 0 || patch.upserts.length > 0) request.customRangePresentationPatch = patch;
742
- }
743
- return {
744
- request,
745
- customBlockViewports,
746
- customRangePresentations: customRangePresentationMap
747
- };
748
- }
749
- async _replaceSession(dataModel) {
750
- const executor = this._requireExecutor();
751
- const unitId = dataModel.getUnitId();
752
- const previous = this._sessions.get(unitId);
753
- if (previous != null) this._markSessionDisposed(previous);
754
- const modelRevision = (previous === null || previous === void 0 ? void 0 : previous.modelRevision) ?? 0;
755
- const session = {
756
- sessionEpoch: ++this._sessionEpoch,
757
- modelRevision,
758
- sourceMutationRevision: dataModel.getMutationRevision(),
759
- workerRevision: modelRevision,
760
- pendingMutations: [],
761
- latestStarts: /* @__PURE__ */ new Map(),
762
- customBlockViewportsByMount: /* @__PURE__ */ new Map(),
763
- customRangePresentations: null,
764
- queue: Promise.resolve(),
765
- needsResnapshot: false,
766
- disposed: false,
767
- cancelPendingCreateTask: null
768
- };
769
- const createTask = this._createSessionOnNextMacroTask(executor, session, dataModel);
770
- session.queue = createTask;
771
- this._sessions.set(unitId, session);
772
- try {
773
- await createTask;
774
- } catch (error) {
775
- if (!session.disposed && this._executor === executor) {
776
- session.needsResnapshot = true;
777
- throw error;
778
- }
779
- }
780
- return session;
781
- }
782
- _disposeSession(unitId) {
783
- const session = this._sessions.get(unitId);
784
- if (session == null) return;
785
- this._markSessionDisposed(session);
786
- this._sessions.delete(unitId);
787
- this._hydrationSamples.delete(unitId);
788
- const executor = this._executor;
789
- executor === null || executor === void 0 || executor.disposeSession({
790
- unitId,
791
- sessionEpoch: session.sessionEpoch
792
- }).catch((error) => {
793
- if (this._executor === executor) this._logService.error("[DocLayoutExecutorService]: failed to dispose a Worker session.", error);
794
- });
795
- }
796
- _getEligibleModel(unitId) {
797
- const dataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
798
- return dataModel != null && this._isEligible(dataModel) ? dataModel : null;
799
- }
800
- _getRequiredModel(unitId) {
801
- const dataModel = this._getEligibleModel(unitId);
802
- if (dataModel == null) throw new Error(`Eligible document model not found for Worker layout: "${unitId}".`);
803
- return dataModel;
804
- }
805
- _collectCustomRangePresentations(dataModel) {
806
- const presentations = [];
807
- const providers = Array.from(this._customRangePresentationProviders).reverse();
808
- if (providers.length === 0) return presentations;
809
- const collectSegment = (segmentId, body) => {
810
- if (body == null) return;
811
- const seenRangeIds = /* @__PURE__ */ new Set();
812
- for (const range of body.customRanges ?? []) {
813
- if (seenRangeIds.has(range.rangeId)) continue;
814
- seenRangeIds.add(range.rangeId);
815
- for (const provider of providers) {
816
- const presentation = provider(dataModel.getUnitId(), range, {
817
- segmentId,
818
- body
819
- });
820
- if (presentation != null) {
821
- presentations.push({
822
- segmentId,
823
- rangeId: range.rangeId,
824
- presentation: { ...presentation }
825
- });
826
- break;
827
- }
828
- }
829
- }
830
- };
831
- collectSegment("", dataModel.getBody());
832
- for (const [segmentId, headerModel] of dataModel.headerModelMap) collectSegment(segmentId, headerModel.getBody());
833
- for (const [segmentId, footerModel] of dataModel.footerModelMap) collectSegment(segmentId, footerModel.getBody());
834
- return presentations;
835
- }
836
- _isEligible(dataModel) {
837
- if (isInternalEditorID(dataModel.getUnitId())) return false;
838
- const flavor = dataModel.getSnapshot().documentStyle.documentFlavor;
839
- return flavor === DocumentFlavor.TRADITIONAL || flavor === DocumentFlavor.MODERN;
840
- }
841
- _requireExecutor() {
842
- if (this._executor == null) throw new Error("No document layout executor is registered.");
843
- return this._executor;
844
- }
845
- _appendPerformanceSample(target, unitId, durationMs) {
846
- const samples = target.get(unitId) ?? [];
847
- samples.push(durationMs);
848
- if (samples.length > _DocLayoutExecutorService._performanceSampleLimit) samples.splice(0, samples.length - _DocLayoutExecutorService._performanceSampleLimit);
849
- target.set(unitId, samples);
850
- }
851
- _createSessionOnNextMacroTask(executor, session, dataModel) {
852
- return new Promise((resolve, reject) => {
853
- const cancelTask = requestImmediateMacroTask(() => {
854
- session.cancelPendingCreateTask = null;
855
- const unitId = dataModel.getUnitId();
856
- if (session.disposed || this._executor !== executor || this._sessions.get(unitId) !== session) {
857
- resolve();
858
- return;
859
- }
860
- const executorReady = this._executorReady;
861
- if (executorReady == null) {
862
- resolve();
863
- return;
864
- }
865
- executorReady.then(() => {
866
- if (session.disposed || this._executor !== executor || this._sessions.get(unitId) !== session || this._getEligibleModel(unitId) !== dataModel) {
867
- resolve();
868
- return;
869
- }
870
- session.sourceMutationRevision = dataModel.getMutationRevision();
871
- session.workerRevision = session.modelRevision;
872
- session.pendingMutations.length = 0;
873
- const request = {
874
- unitId,
875
- sessionEpoch: session.sessionEpoch,
876
- snapshot: createDocumentLayoutSnapshot(dataModel.getSnapshot()),
877
- modelRevision: session.modelRevision,
878
- locale: this._localeService.getCurrentLocale(),
879
- localeData: this._localeService.getLocales(),
880
- direction: this._localeService.getDirection()
881
- };
882
- executor.createSession(request).then(resolve, reject);
883
- }, reject);
884
- });
885
- session.cancelPendingCreateTask = () => {
886
- cancelTask();
887
- session.cancelPendingCreateTask = null;
888
- resolve();
889
- };
890
- });
891
- }
892
- _markSessionDisposed(session) {
893
- var _session$cancelPendin;
894
- session.disposed = true;
895
- (_session$cancelPendin = session.cancelPendingCreateTask) === null || _session$cancelPendin === void 0 || _session$cancelPendin.call(session);
896
- session.cancelPendingCreateTask = null;
897
- }
898
- _disposeManagedSessions() {
899
- for (const session of this._sessions.values()) this._markSessionDisposed(session);
900
- }
901
- };
902
- _defineProperty(DocLayoutExecutorService, "_performanceSampleLimit", 2048);
903
- DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
904
- __decorateParam(0, IUniverInstanceService),
905
- __decorateParam(1, ICommandService),
906
- __decorateParam(2, Inject(LocaleService)),
907
- __decorateParam(3, ILogService)
908
- ], DocLayoutExecutorService);
909
-
910
- //#endregion
911
- //#region src/services/doc-skeleton-manager.service.ts
195
+ // src/services/doc-skeleton-manager.service.ts
912
196
  let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDisposable {
913
197
  constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
914
198
  super();
@@ -980,7 +264,7 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
980
264
  return DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: isSheetEditor ? this._configService.getConfig(SHEET_TEXT_LINE_GAP) : void 0 });
981
265
  }
982
266
  _buildDocViewModel(documentDataModel) {
983
- return new DocumentViewModel(documentDataModel);
267
+ return this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? new SheetCellDocumentViewModel(documentDataModel) : new DocumentViewModel(documentDataModel);
984
268
  }
985
269
  };
986
270
  DocSkeletonManagerService = __decorate([
@@ -990,8 +274,7 @@ DocSkeletonManagerService = __decorate([
990
274
  __decorateParam(4, IConfigService)
991
275
  ], DocSkeletonManagerService);
992
276
 
993
- //#endregion
994
- //#region src/services/doc-state-emit.service.ts
277
+ // src/services/doc-state-emit.service.ts
995
278
  var DocStateEmitService = class extends RxDisposable {
996
279
  constructor() {
997
280
  super();
@@ -1007,8 +290,7 @@ var DocStateEmitService = class extends RxDisposable {
1007
290
  }
1008
291
  };
1009
292
 
1010
- //#endregion
1011
- //#region src/commands/mutations/doc-structure-mutation-validation.ts
293
+ // src/commands/mutations/doc-structure-mutation-validation.ts
1012
294
  const STRUCTURAL_BODY_FIELDS = [
1013
295
  "paragraphs",
1014
296
  "sectionBreaks",
@@ -1051,7 +333,7 @@ const NON_STRUCTURAL_ROOT_FIELDS = /* @__PURE__ */ new Set([
1051
333
  "tableSource",
1052
334
  "title"
1053
335
  ]);
1054
- function isRecord$3(value) {
336
+ function isRecord$2(value) {
1055
337
  return typeof value === "object" && value != null && !Array.isArray(value);
1056
338
  }
1057
339
  function containsStructuralToken(dataStream) {
@@ -1059,7 +341,7 @@ function containsStructuralToken(dataStream) {
1059
341
  return false;
1060
342
  }
1061
343
  function isStructurePreservingBody(value) {
1062
- if (!isRecord$3(value)) return false;
344
+ if (!isRecord$2(value)) return false;
1063
345
  const dataStream = value.dataStream;
1064
346
  if (dataStream != null && (typeof dataStream !== "string" || containsStructuralToken(dataStream))) return false;
1065
347
  return STRUCTURAL_BODY_FIELDS.every((field) => {
@@ -1070,7 +352,7 @@ function isStructurePreservingBody(value) {
1070
352
  function isStructurePreservingTextXEdit(value) {
1071
353
  if (!Array.isArray(value)) return false;
1072
354
  return value.every((action) => {
1073
- if (!isRecord$3(action) || typeof action.len !== "number" || !Number.isFinite(action.len)) return false;
355
+ if (!isRecord$2(action) || typeof action.len !== "number" || !Number.isFinite(action.len)) return false;
1074
356
  if (action.t === TextXActionType.DELETE) return true;
1075
357
  if (action.t === TextXActionType.INSERT) return isStructurePreservingBody(action.body);
1076
358
  return action.t === TextXActionType.RETAIN && (action.body == null || isStructurePreservingBody(action.body));
@@ -1245,9 +527,9 @@ function validateDocStructureMutation(documentDataModel, segmentId, actions, und
1245
527
  const path = cursor.getPath();
1246
528
  if (path[0] === "notes" && (path.length <= 2 || path[2] !== "body") || path.includes("customRanges")) changesFootnoteStructure = true;
1247
529
  if (component.et === TextX.id && Array.isArray(component.e)) for (const action of component.e) {
1248
- if (isRecord$3(action) && Array.isArray(action.rangeUpdates) && action.rangeUpdates.some((update) => isRecord$3(update) && isRecord$3(update.range) && (update.range.rangeType === CustomRangeType.FOOTNOTE || update.range.rangeType === CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
1249
- const ranges = isRecord$3(action) && isRecord$3(action.body) ? action.body.customRanges : void 0;
1250
- if (Array.isArray(ranges) && ranges.some((range) => isRecord$3(range) && (range.rangeType === CustomRangeType.FOOTNOTE || range.rangeType === CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
530
+ if (isRecord$2(action) && Array.isArray(action.rangeUpdates) && action.rangeUpdates.some((update) => isRecord$2(update) && isRecord$2(update.range) && (update.range.rangeType === CustomRangeType.FOOTNOTE || update.range.rangeType === CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
531
+ const ranges = isRecord$2(action) && isRecord$2(action.body) ? action.body.customRanges : void 0;
532
+ if (Array.isArray(ranges) && ranges.some((range) => isRecord$2(range) && (range.rangeType === CustomRangeType.FOOTNOTE || range.rangeType === CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
1251
533
  }
1252
534
  });
1253
535
  if (changesFootnoteStructure) {
@@ -1257,8 +539,7 @@ function validateDocStructureMutation(documentDataModel, segmentId, actions, und
1257
539
  return preservesStructure && !changesFootnoteStructure;
1258
540
  }
1259
541
 
1260
- //#endregion
1261
- //#region src/commands/mutations/core-editing.mutation.ts
542
+ // src/commands/mutations/core-editing.mutation.ts
1262
543
  let DocHistoryAction = /* @__PURE__ */ function(DocHistoryAction) {
1263
544
  DocHistoryAction["DeleteChart"] = "delete-chart";
1264
545
  DocHistoryAction["DeleteDivider"] = "delete-divider";
@@ -1393,7 +674,8 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
1393
674
  }, selectionTarget);
1394
675
  const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
1395
676
  queueMicrotask(() => {
1396
- if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
677
+ var _selectionManager$__g;
678
+ if (((_selectionManager$__g = selectionManager.__getCurrentSelection()) === null || _selectionManager$__g === void 0 ? void 0 : _selectionManager$__g.unitId) !== unitId || selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
1397
679
  selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
1398
680
  });
1399
681
  }
@@ -1482,8 +764,7 @@ const RichTextEditingMutation = {
1482
764
  }
1483
765
  };
1484
766
 
1485
- //#endregion
1486
- //#region src/commands/commands/core-editing.command.ts
767
+ // src/commands/commands/core-editing.command.ts
1487
768
  /**
1488
769
  * The command to insert text. The changed range could be non-collapsed, mainly use in line break and normal input.
1489
770
  */
@@ -1639,8 +920,7 @@ const UpdateTextCommand = {
1639
920
  }
1640
921
  };
1641
922
 
1642
- //#endregion
1643
- //#region src/commands/commands/create-header-footer.command.ts
923
+ // src/commands/commands/create-header-footer.command.ts
1644
924
  let HeaderFooterType = /* @__PURE__ */ function(HeaderFooterType) {
1645
925
  HeaderFooterType[HeaderFooterType["FIRST_PAGE_HEADER"] = 0] = "FIRST_PAGE_HEADER";
1646
926
  HeaderFooterType[HeaderFooterType["FIRST_PAGE_FOOTER"] = 1] = "FIRST_PAGE_FOOTER";
@@ -1783,8 +1063,7 @@ const CreateHeaderFooterCommand = {
1783
1063
  }
1784
1064
  };
1785
1065
 
1786
- //#endregion
1787
- //#region src/commands/commands/set-document-default-paragraph-style.command.ts
1066
+ // src/commands/commands/set-document-default-paragraph-style.command.ts
1788
1067
  const SetDocumentDefaultParagraphStyleCommand = {
1789
1068
  id: "doc.command.set-default-paragraph-style",
1790
1069
  type: CommandType.COMMAND,
@@ -1827,8 +1106,7 @@ const SetDocumentDefaultParagraphStyleCommand = {
1827
1106
  }
1828
1107
  };
1829
1108
 
1830
- //#endregion
1831
- //#region src/commands/mutations/docs-rename.mutation.ts
1109
+ // src/commands/mutations/docs-rename.mutation.ts
1832
1110
  const DocsRenameMutation = {
1833
1111
  id: "doc.mutation.rename-doc",
1834
1112
  type: CommandType.MUTATION,
@@ -1840,8 +1118,7 @@ const DocsRenameMutation = {
1840
1118
  }
1841
1119
  };
1842
1120
 
1843
- //#endregion
1844
- //#region src/commands/commands/set-document-name.command.ts
1121
+ // src/commands/commands/set-document-name.command.ts
1845
1122
  const SetDocumentNameCommand = {
1846
1123
  id: "doc.command.set-name",
1847
1124
  type: CommandType.COMMAND,
@@ -1874,8 +1151,7 @@ const SetDocumentNameCommand = {
1874
1151
  }
1875
1152
  };
1876
1153
 
1877
- //#endregion
1878
- //#region src/services/permission/permission-point/document/comment.ts
1154
+ // src/services/permission/permission-point/document/comment.ts
1879
1155
  var DocumentCommentPermission = class {
1880
1156
  constructor(unitId) {
1881
1157
  this.unitId = unitId;
@@ -1888,8 +1164,7 @@ var DocumentCommentPermission = class {
1888
1164
  }
1889
1165
  };
1890
1166
 
1891
- //#endregion
1892
- //#region src/services/permission/permission-point/document/copy.ts
1167
+ // src/services/permission/permission-point/document/copy.ts
1893
1168
  var DocumentCopyPermission = class {
1894
1169
  constructor(unitId) {
1895
1170
  this.unitId = unitId;
@@ -1902,8 +1177,7 @@ var DocumentCopyPermission = class {
1902
1177
  }
1903
1178
  };
1904
1179
 
1905
- //#endregion
1906
- //#region src/services/permission/permission-point/document/editable.ts
1180
+ // src/services/permission/permission-point/document/editable.ts
1907
1181
  var DocumentEditablePermission = class {
1908
1182
  constructor(unitId) {
1909
1183
  this.unitId = unitId;
@@ -1916,8 +1190,7 @@ var DocumentEditablePermission = class {
1916
1190
  }
1917
1191
  };
1918
1192
 
1919
- //#endregion
1920
- //#region src/services/permission/permission-point/document/export.ts
1193
+ // src/services/permission/permission-point/document/export.ts
1921
1194
  var DocumentExportPermission = class {
1922
1195
  constructor(unitId) {
1923
1196
  this.unitId = unitId;
@@ -1930,8 +1203,7 @@ var DocumentExportPermission = class {
1930
1203
  }
1931
1204
  };
1932
1205
 
1933
- //#endregion
1934
- //#region src/services/permission/permission-point/document/print.ts
1206
+ // src/services/permission/permission-point/document/print.ts
1935
1207
  var DocumentPrintPermission = class {
1936
1208
  constructor(unitId) {
1937
1209
  this.unitId = unitId;
@@ -1944,8 +1216,7 @@ var DocumentPrintPermission = class {
1944
1216
  }
1945
1217
  };
1946
1218
 
1947
- //#endregion
1948
- //#region src/services/permission/permission-point/entity/edit.ts
1219
+ // src/services/permission/permission-point/entity/edit.ts
1949
1220
  var DocumentEntityEditPermission = class {
1950
1221
  constructor(unitId, objectId) {
1951
1222
  this.unitId = unitId;
@@ -1959,8 +1230,7 @@ var DocumentEntityEditPermission = class {
1959
1230
  }
1960
1231
  };
1961
1232
 
1962
- //#endregion
1963
- //#region src/services/permission/permission-point/paragraph/edit.ts
1233
+ // src/services/permission/permission-point/paragraph/edit.ts
1964
1234
  var DocumentParagraphEditPermission = class {
1965
1235
  constructor(unitId, objectId) {
1966
1236
  this.unitId = unitId;
@@ -1974,8 +1244,7 @@ var DocumentParagraphEditPermission = class {
1974
1244
  }
1975
1245
  };
1976
1246
 
1977
- //#endregion
1978
- //#region src/services/permission/permission-point/section/edit.ts
1247
+ // src/services/permission/permission-point/section/edit.ts
1979
1248
  var DocumentSectionEditPermission = class {
1980
1249
  constructor(unitId, objectId) {
1981
1250
  this.unitId = unitId;
@@ -1989,8 +1258,7 @@ var DocumentSectionEditPermission = class {
1989
1258
  }
1990
1259
  };
1991
1260
 
1992
- //#endregion
1993
- //#region src/services/permission/document-permission.ts
1261
+ // src/services/permission/document-permission.ts
1994
1262
  const DOCUMENT_UNIT_PERMISSION_ACTIONS = [
1995
1263
  UnitAction.Edit,
1996
1264
  UnitAction.Copy,
@@ -2053,8 +1321,7 @@ function canEditDocumentTargets(permissionService, unitId, objectIds) {
2053
1321
  return true;
2054
1322
  }
2055
1323
 
2056
- //#endregion
2057
- //#region src/commands/commands/set-document-permission.command.ts
1324
+ // src/commands/commands/set-document-permission.command.ts
2058
1325
  const SetDocumentPermissionCommand = {
2059
1326
  type: CommandType.COMMAND,
2060
1327
  id: "doc.command.set-permission",
@@ -2080,8 +1347,7 @@ const SetDocumentPermissionCommand = {
2080
1347
  }
2081
1348
  };
2082
1349
 
2083
- //#endregion
2084
- //#region src/commands/commands/set-document-permissions.command.ts
1350
+ // src/commands/commands/set-document-permissions.command.ts
2085
1351
  const SetDocumentPermissionsCommand = {
2086
1352
  type: CommandType.COMMAND,
2087
1353
  id: "doc.command.set-permissions",
@@ -2103,8 +1369,7 @@ const SetDocumentPermissionsCommand = {
2103
1369
  }
2104
1370
  };
2105
1371
 
2106
- //#endregion
2107
- //#region src/utils/sections.ts
1372
+ // src/utils/sections.ts
2108
1373
  /** Returns document-level section breaks, excluding table-cell and modern-column sentinels. */
2109
1374
  function getTopLevelSectionBreaks(body) {
2110
1375
  const sectionBreakByIndex = new Map((body.sectionBreaks ?? []).map((sectionBreak) => [sectionBreak.startIndex, sectionBreak]));
@@ -2125,8 +1390,7 @@ function getTopLevelSectionBreaks(body) {
2125
1390
  return result;
2126
1391
  }
2127
1392
 
2128
- //#endregion
2129
- //#region src/services/permission/document-permission-resolver.ts
1393
+ // src/services/permission/document-permission-resolver.ts
2130
1394
  const HEADER_FOOTER_REFERENCE_KEYS = [
2131
1395
  "defaultHeaderId",
2132
1396
  "defaultFooterId",
@@ -2314,18 +1578,18 @@ function getDrawingIdsFromActions(actions) {
2314
1578
  });
2315
1579
  return;
2316
1580
  }
2317
- if (!isRecord$2(value)) return;
1581
+ if (!isRecord$1(value)) return;
2318
1582
  Object.values(value).forEach(visit);
2319
1583
  };
2320
1584
  visit(actions);
2321
1585
  return [...result];
2322
1586
  }
2323
1587
  function isTextXAction(value) {
2324
- if (!isRecord$2(value) || typeof value.len !== "number") return false;
2325
- if (value.t === TextXActionType.INSERT) return isRecord$2(value.body);
1588
+ if (!isRecord$1(value) || typeof value.len !== "number") return false;
1589
+ if (value.t === TextXActionType.INSERT) return isRecord$1(value.body);
2326
1590
  return value.t === TextXActionType.RETAIN || value.t === TextXActionType.DELETE;
2327
1591
  }
2328
- function isRecord$2(value) {
1592
+ function isRecord$1(value) {
2329
1593
  return typeof value === "object" && value !== null && !Array.isArray(value);
2330
1594
  }
2331
1595
  function getDocumentEntityParentPermissionObjectIds(documentDataModel, segmentId, entityType, entityId) {
@@ -2389,8 +1653,7 @@ function getHeaderFooterOwnerSectionIds(documentDataModel, segmentId, sections =
2389
1653
  return [...result];
2390
1654
  }
2391
1655
 
2392
- //#endregion
2393
- //#region src/commands/commands/set-heading-collapsed.command.ts
1656
+ // src/commands/commands/set-heading-collapsed.command.ts
2394
1657
  const SetHeadingCollapsedCommand = {
2395
1658
  id: "doc.command.set-heading-collapsed",
2396
1659
  type: CommandType.COMMAND,
@@ -2458,8 +1721,7 @@ const SetHeadingCollapsedCommand = {
2458
1721
  }
2459
1722
  };
2460
1723
 
2461
- //#endregion
2462
- //#region src/commands/commands/set-section-header-footer-link.command.ts
1724
+ // src/commands/commands/set-section-header-footer-link.command.ts
2463
1725
  const SetSectionHeaderFooterLinkCommand = {
2464
1726
  id: "doc.command.set-section-header-footer-link",
2465
1727
  type: CommandType.COMMAND,
@@ -2553,8 +1815,7 @@ function buildUnlinkActions(context, kind, requestedSegmentId) {
2553
1815
  ], segmentId)];
2554
1816
  }
2555
1817
 
2556
- //#endregion
2557
- //#region src/commands/commands/update-document-paragraph-style.command.ts
1818
+ // src/commands/commands/update-document-paragraph-style.command.ts
2558
1819
  function isValidParams(params) {
2559
1820
  return Boolean((params === null || params === void 0 ? void 0 : params.unitId) && params.paragraphId && Number.isInteger(params.startOffset) && Number.isInteger(params.endOffset) && params.startOffset >= 0 && params.endOffset >= params.startOffset && params.style && Object.keys(params.style).length > 0);
2560
1821
  }
@@ -2652,8 +1913,7 @@ const UpdateDocumentParagraphStyleCommand = {
2652
1913
  }
2653
1914
  };
2654
1915
 
2655
- //#endregion
2656
- //#region src/utils/section-columns.ts
1916
+ // src/utils/section-columns.ts
2657
1917
  function resolveSectionValue(sectionValue, documentValue, fallback) {
2658
1918
  return sectionValue ?? documentValue ?? fallback;
2659
1919
  }
@@ -2721,8 +1981,7 @@ function createSectionColumnProperties(documentStyle, section, columnCount, gap,
2721
1981
  }));
2722
1982
  }
2723
1983
 
2724
- //#endregion
2725
- //#region src/commands/commands/update-document-section.command.ts
1984
+ // src/commands/commands/update-document-section.command.ts
2726
1985
  const UpdateDocumentSectionCommand = {
2727
1986
  id: "doc.command.update-section",
2728
1987
  type: CommandType.COMMAND,
@@ -2924,8 +2183,7 @@ function executeSectionTextX(commandService, documentDataModel, textX, trigger)
2924
2183
  }));
2925
2184
  }
2926
2185
 
2927
- //#endregion
2928
- //#region src/services/permission/document-permission-rule.model.ts
2186
+ // src/services/permission/document-permission-rule.model.ts
2929
2187
  /**
2930
2188
  * Copyright 2023-present DreamNum Co., Ltd.
2931
2189
  *
@@ -2952,8 +2210,7 @@ let DocumentPermissionRuleModel = class DocumentPermissionRuleModel extends Obje
2952
2210
  };
2953
2211
  DocumentPermissionRuleModel = __decorate([__decorateParam(0, IResourceManagerService)], DocumentPermissionRuleModel);
2954
2212
 
2955
- //#endregion
2956
- //#region src/commands/mutations/set-document-permission-rule.mutation.ts
2213
+ // src/commands/mutations/set-document-permission-rule.mutation.ts
2957
2214
  const SetDocumentPermissionRuleMutation = {
2958
2215
  id: "doc.mutation.set-permission-rule",
2959
2216
  type: CommandType.MUTATION,
@@ -2963,8 +2220,7 @@ const SetDocumentPermissionRuleMutation = {
2963
2220
  }
2964
2221
  };
2965
2222
 
2966
- //#endregion
2967
- //#region src/commands/mutations/set-document-permission-rules.mutation.ts
2223
+ // src/commands/mutations/set-document-permission-rules.mutation.ts
2968
2224
  const SetDocumentPermissionRulesMutation = {
2969
2225
  id: "doc.mutation.set-permission-rules",
2970
2226
  type: CommandType.MUTATION,
@@ -2974,8 +2230,7 @@ const SetDocumentPermissionRulesMutation = {
2974
2230
  }
2975
2231
  };
2976
2232
 
2977
- //#endregion
2978
- //#region src/embed-host-anchor.ts
2233
+ // src/embed-host-anchor.ts
2979
2234
  const EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY = "UniverEmbedDocsCustomBlock";
2980
2235
  const DEFAULT_CUSTOM_BLOCK_SIZE = {
2981
2236
  width: 720,
@@ -3132,34 +2387,7 @@ function composeActions(actions) {
3132
2387
  }, []);
3133
2388
  }
3134
2389
 
3135
- //#endregion
3136
- //#region package.json
3137
- var name = "@univerjs/docs";
3138
- var version = "1.3.1";
3139
-
3140
- //#endregion
3141
- //#region src/config/config.ts
3142
- /**
3143
- * Copyright 2023-present DreamNum Co., Ltd.
3144
- *
3145
- * Licensed under the Apache License, Version 2.0 (the "License");
3146
- * you may not use this file except in compliance with the License.
3147
- * You may obtain a copy of the License at
3148
- *
3149
- * http://www.apache.org/licenses/LICENSE-2.0
3150
- *
3151
- * Unless required by applicable law or agreed to in writing, software
3152
- * distributed under the License is distributed on an "AS IS" BASIS,
3153
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3154
- * See the License for the specific language governing permissions and
3155
- * limitations under the License.
3156
- */
3157
- const DOCS_PLUGIN_CONFIG_KEY = "docs.config";
3158
- const configSymbol$1 = Symbol(DOCS_PLUGIN_CONFIG_KEY);
3159
- const defaultPluginConfig = {};
3160
-
3161
- //#endregion
3162
- //#region src/controllers/custom-range.controller.ts
2390
+ // src/controllers/custom-range.controller.ts
3163
2391
  let DocCustomRangeController = class DocCustomRangeController extends Disposable {
3164
2392
  constructor(_commandService, _textSelectionManagerService, _univerInstanceService) {
3165
2393
  super();
@@ -3213,8 +2441,7 @@ DocCustomRangeController = __decorate([
3213
2441
  __decorateParam(2, IUniverInstanceService)
3214
2442
  ], DocCustomRangeController);
3215
2443
 
3216
- //#endregion
3217
- //#region src/controllers/doc-permission.controller.ts
2444
+ // src/controllers/doc-permission.controller.ts
3218
2445
  const NON_EDIT_DOCUMENT_COMMAND_IDS = /* @__PURE__ */ new Set([
3219
2446
  SetDocumentPermissionCommand.id,
3220
2447
  SetDocumentPermissionsCommand.id,
@@ -3304,12 +2531,12 @@ function isDocumentDataMutation(commandInfo) {
3304
2531
  return id.startsWith("doc.mutation.") || id.startsWith("docs.mutation.") || /^docs-[^.]+\.mutation\./.test(id);
3305
2532
  }
3306
2533
  function isDerivedDocumentMutation(commandInfo) {
3307
- const params = isRecord$1(commandInfo.params) ? commandInfo.params : void 0;
2534
+ const params = isRecord(commandInfo.params) ? commandInfo.params : void 0;
3308
2535
  return DERIVED_DOCUMENT_MUTATION_IDS.has(commandInfo.id) || commandInfo.id === "doc.mutation.update-shape-data" && !!(params === null || params === void 0 ? void 0 : params.formulaLastValueGuard);
3309
2536
  }
3310
2537
  function resolveEntityTargets(documentDataModel, commandInfo) {
3311
2538
  const params = commandInfo.params;
3312
- if (!isRecord$1(params)) return [];
2539
+ if (!isRecord(params)) return [];
3313
2540
  const result = /* @__PURE__ */ new Set();
3314
2541
  const add = (segmentId, entityType, entityId) => {
3315
2542
  result.add(getDocumentEntityPermissionObjectId(segmentId, entityType, entityId));
@@ -3348,14 +2575,14 @@ function collectEntityReferences(value) {
3348
2575
  candidate.forEach((item) => visit(item, singularKey));
3349
2576
  return;
3350
2577
  }
3351
- if (!isRecord$1(candidate)) return;
2578
+ if (!isRecord(candidate)) return;
3352
2579
  Object.entries(candidate).forEach(([childKey, child]) => visit(child, childKey));
3353
2580
  };
3354
2581
  visit(value);
3355
2582
  return [...result.values()];
3356
2583
  }
3357
2584
  function getUnitId(commandInfo, options) {
3358
- const params = isRecord$1(commandInfo.params) ? commandInfo.params : void 0;
2585
+ const params = isRecord(commandInfo.params) ? commandInfo.params : void 0;
3359
2586
  return typeof (params === null || params === void 0 ? void 0 : params.unitId) === "string" ? params.unitId : typeof (options === null || options === void 0 ? void 0 : options.unitId) === "string" ? options.unitId : void 0;
3360
2587
  }
3361
2588
  function getDocumentUnitAction(commandId) {
@@ -3412,12 +2639,11 @@ function resolveSectionTargets(documentDataModel, commandInfo) {
3412
2639
  }
3413
2640
  return null;
3414
2641
  }
3415
- function isRecord$1(value) {
2642
+ function isRecord(value) {
3416
2643
  return typeof value === "object" && value !== null && !Array.isArray(value);
3417
2644
  }
3418
2645
 
3419
- //#endregion
3420
- //#region src/services/doc-block-move-validator.service.ts
2646
+ // src/services/doc-block-move-validator.service.ts
3421
2647
  var DocBlockMoveValidatorService = class extends Disposable {
3422
2648
  constructor(..._args) {
3423
2649
  super(..._args);
@@ -3443,8 +2669,7 @@ var DocBlockMoveValidatorService = class extends Disposable {
3443
2669
  }
3444
2670
  };
3445
2671
 
3446
- //#endregion
3447
- //#region src/services/doc-content-insert.service.ts
2672
+ // src/services/doc-content-insert.service.ts
3448
2673
  /**
3449
2674
  * Copyright 2023-present DreamNum Co., Ltd.
3450
2675
  *
@@ -3480,8 +2705,7 @@ var DocContentInsertService = class extends Disposable {
3480
2705
  }
3481
2706
  };
3482
2707
 
3483
- //#endregion
3484
- //#region src/services/doc-state-change-manager.service.ts
2708
+ // src/services/doc-state-change-manager.service.ts
3485
2709
  const DEBOUNCE_DELAY = 300;
3486
2710
  const IDocStateChangeInterceptorService = createIdentifier("doc.state-change-interceptor-service");
3487
2711
  let DocStateChangeManagerService = class DocStateChangeManagerService extends RxDisposable {
@@ -3668,8 +2892,7 @@ DocStateChangeManagerService = __decorate([
3668
2892
  __decorateParam(4, Optional(IDocStateChangeInterceptorService))
3669
2893
  ], DocStateChangeManagerService);
3670
2894
 
3671
- //#endregion
3672
- //#region src/services/doc-text-resolver.service.ts
2895
+ // src/services/doc-text-resolver.service.ts
3673
2896
  /**
3674
2897
  * Builds a consumer-facing text projection while retaining a mapping back to
3675
2898
  * the native document offsets.
@@ -3741,8 +2964,7 @@ var DocTextResolverService = class extends Disposable {
3741
2964
  }
3742
2965
  };
3743
2966
 
3744
- //#endregion
3745
- //#region src/plugin.ts
2967
+ // src/plugin.ts
3746
2968
  let UniverDocsPlugin = class UniverDocsPlugin extends Plugin {
3747
2969
  constructor(_config = defaultPluginConfig, _injector, _configService) {
3748
2970
  super();
@@ -3827,8 +3049,7 @@ _defineProperty(UniverDocsPlugin, "packageName", name);
3827
3049
  _defineProperty(UniverDocsPlugin, "version", version);
3828
3050
  UniverDocsPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverDocsPlugin);
3829
3051
 
3830
- //#endregion
3831
- //#region src/layout-worker/config/config.ts
3052
+ // src/layout-worker/config/config.ts
3832
3053
  /**
3833
3054
  * Copyright 2023-present DreamNum Co., Ltd.
3834
3055
  *
@@ -3849,8 +3070,7 @@ const configSymbol = Symbol(DOCS_LAYOUT_WORKER_PLUGIN_CONFIG_KEY);
3849
3070
  const DEFAULT_DOCS_LAYOUT_WORKER_REQUEST_TIMEOUT_MS = 15e3;
3850
3071
  const defaultPluginDocsLayoutWorkerConfig = { requestTimeoutMs: DEFAULT_DOCS_LAYOUT_WORKER_REQUEST_TIMEOUT_MS };
3851
3072
 
3852
- //#endregion
3853
- //#region src/layout-worker/document-font-metrics.ts
3073
+ // src/layout-worker/document-font-metrics.ts
3854
3074
  /**
3855
3075
  * Copyright 2023-present DreamNum Co., Ltd.
3856
3076
  *
@@ -3896,459 +3116,7 @@ function measureDocumentFontFamilies(families) {
3896
3116
  return FontCache.getNormalLineHeightCache();
3897
3117
  }
3898
3118
 
3899
- //#endregion
3900
- //#region src/layout-worker/font-loader.ts
3901
- /** Owns the same explicitly supplied font faces in the rendering and layout realms. */
3902
- var DocsLayoutFontLoader = class extends Disposable {
3903
- constructor(..._args) {
3904
- super(..._args);
3905
- _defineProperty(this, "_loading", null);
3906
- _defineProperty(this, "_fontSet", void 0);
3907
- _defineProperty(this, "_faces", []);
3908
- }
3909
- load(fonts) {
3910
- this._loading ??= this._load(fonts);
3911
- return this._loading;
3912
- }
3913
- dispose() {
3914
- for (const face of this._faces) {
3915
- var _this$_fontSet;
3916
- (_this$_fontSet = this._fontSet) === null || _this$_fontSet === void 0 || _this$_fontSet.delete(face);
3917
- }
3918
- if (this._faces.length > 0) FontCache.invalidateMetrics(() => true);
3919
- this._faces = [];
3920
- this._fontSet = void 0;
3921
- super.dispose();
3922
- }
3923
- async _load(fonts) {
3924
- this.ensureNotDisposed();
3925
- if (fonts.length === 0) return;
3926
- const fontSet = typeof document === "undefined" ? globalThis.fonts : document.fonts;
3927
- if (typeof FontFace === "undefined" || fontSet == null) throw new Error("Document layout requires FontFace support to load the configured fonts.");
3928
- try {
3929
- const faces = fonts.map(({ family, source, descriptors }) => {
3930
- if (!family.trim() || (typeof source === "string" ? !source.trim() : source.byteLength === 0)) throw new TypeError("Document layout font family and source must not be empty.");
3931
- return new FontFace(family, source, descriptors);
3932
- });
3933
- await Promise.all(faces.map((face) => face.load()));
3934
- this.ensureNotDisposed();
3935
- this._fontSet = fontSet;
3936
- this._faces = faces;
3937
- for (const face of faces) fontSet.add(face);
3938
- FontCache.invalidateMetrics(() => true);
3939
- } catch (error) {
3940
- this.dispose();
3941
- throw error;
3942
- }
3943
- }
3944
- };
3945
-
3946
- //#endregion
3947
- //#region src/layout-worker/performance-tracker.ts
3948
- const PERFORMANCE_SAMPLE_LIMIT = 2048;
3949
- function isRecord(value) {
3950
- return typeof value === "object" && value != null;
3951
- }
3952
- function getRequest(message) {
3953
- if (!isRecord(message) || typeof message.method !== "string" || !Array.isArray(message.args)) return null;
3954
- const request = message.args[0];
3955
- return isRecord(request) ? {
3956
- method: message.method,
3957
- request
3958
- } : null;
3959
- }
3960
- function getPublicationResult(message) {
3961
- if (!isRecord(message) || !isRecord(message.data)) return null;
3962
- const result = message.data;
3963
- if (isRecord(result.step)) return result.step;
3964
- return result;
3965
- }
3966
- function createTransferMetrics() {
3967
- return {
3968
- mutationTransferMs: [],
3969
- patchTransferMs: [],
3970
- snapshotTransferMs: []
3971
- };
3972
- }
3973
- var DocsLayoutWorkerPerformanceTracker = class {
3974
- constructor() {
3975
- _defineProperty(this, "_metrics", /* @__PURE__ */ new Map());
3976
- }
3977
- recordRequest(message, durationMs) {
3978
- const requestInfo = getRequest(message);
3979
- const unitId = requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.request.unitId;
3980
- if (requestInfo == null || typeof unitId !== "string") return;
3981
- if (requestInfo.method === "createSession") {
3982
- this._append(unitId, "snapshotTransferMs", durationMs);
3983
- return;
3984
- }
3985
- if (requestInfo.method === "startLayout" && Array.isArray(requestInfo.request.mutations) && requestInfo.request.mutations.length > 0) this._append(unitId, "mutationTransferMs", durationMs);
3986
- }
3987
- recordResponse(message, durationMs) {
3988
- const result = getPublicationResult(message);
3989
- if (result == null || typeof result.unitId !== "string" || result.publication == null) return;
3990
- this._append(result.unitId, "patchTransferMs", durationMs);
3991
- }
3992
- getMetrics(unitId) {
3993
- const metrics = this._metrics.get(unitId) ?? createTransferMetrics();
3994
- return {
3995
- mutationTransferMs: [...metrics.mutationTransferMs],
3996
- patchTransferMs: [...metrics.patchTransferMs],
3997
- snapshotTransferMs: [...metrics.snapshotTransferMs]
3998
- };
3999
- }
4000
- reset(unitId) {
4001
- this._metrics.delete(unitId);
4002
- }
4003
- resetAll() {
4004
- this._metrics.clear();
4005
- }
4006
- _append(unitId, metric, durationMs) {
4007
- const metrics = this._metrics.get(unitId) ?? createTransferMetrics();
4008
- const samples = metrics[metric];
4009
- samples.push(durationMs);
4010
- if (samples.length > PERFORMANCE_SAMPLE_LIMIT) samples.splice(0, samples.length - PERFORMANCE_SAMPLE_LIMIT);
4011
- this._metrics.set(unitId, metrics);
4012
- }
4013
- };
4014
-
4015
- //#endregion
4016
- //#region src/layout-worker/protocol.ts
4017
- const DOCS_LAYOUT_WORKER_CHANNEL = "univer.docs-layout-worker";
4018
-
4019
- //#endregion
4020
- //#region src/layout-worker/worker.ts
4021
- const FONT_PROBE_CONTENT = "Univer 文档 Worker 0123456789";
4022
- const FONT_PROBE_STYLE = "16px Arial";
4023
- const WORKER_LAYOUT_INTERRUPT_INTERVAL = 8;
4024
- function yieldForWorkerMessage() {
4025
- return new Promise((resolve) => {
4026
- requestImmediateMacroTask(() => resolve());
4027
- });
4028
- }
4029
- function createDocsLayoutWorkerMessageProtocol$1(performanceTracker) {
4030
- return {
4031
- send(message) {
4032
- const startedAt = Tools.now();
4033
- postMessage(message);
4034
- performanceTracker.recordResponse(message, Tools.now() - startedAt);
4035
- },
4036
- onMessage: new Observable((subscriber) => {
4037
- const handler = (event) => subscriber.next(event.data);
4038
- addEventListener("message", handler);
4039
- return () => removeEventListener("message", handler);
4040
- }).pipe(shareReplay({
4041
- bufferSize: 1,
4042
- refCount: true
4043
- }))
4044
- };
4045
- }
4046
- function getCustomRangePresentationKey(entry) {
4047
- return JSON.stringify([entry.segmentId, entry.rangeId]);
4048
- }
4049
- function applyRecordPatch(target, patch) {
4050
- if (patch == null) return;
4051
- for (const key of patch.removals) delete target[key];
4052
- Object.assign(target, patch.upserts);
4053
- }
4054
- var DocsLayoutWorkerRuntime = class {
4055
- constructor(_performanceTracker = new DocsLayoutWorkerPerformanceTracker()) {
4056
- this._performanceTracker = _performanceTracker;
4057
- _defineProperty(this, "_sessions", /* @__PURE__ */ new Map());
4058
- _defineProperty(this, "_fontLoader", new DocsLayoutFontLoader());
4059
- _defineProperty(this, "type", "worker");
4060
- }
4061
- initialize(fontFaces = []) {
4062
- return this._fontLoader.load(fontFaces);
4063
- }
4064
- async getCapabilities() {
4065
- const metrics = FontCache.getMeasureText(FONT_PROBE_CONTENT, FONT_PROBE_STYLE);
4066
- return {
4067
- protocolVersion: 5,
4068
- executor: "worker",
4069
- offscreenCanvas: typeof OffscreenCanvas !== "undefined",
4070
- structuredClone: typeof structuredClone === "function",
4071
- fontProbe: {
4072
- content: FONT_PROBE_CONTENT,
4073
- font: FONT_PROBE_STYLE,
4074
- width: metrics.width,
4075
- actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
4076
- actualBoundingBoxDescent: metrics.actualBoundingBoxDescent
4077
- }
4078
- };
4079
- }
4080
- async recover() {
4081
- for (const session of this._sessions.values()) for (const mount of session.layoutSessions.values()) mount.layoutSession.dispose();
4082
- this._sessions.clear();
4083
- }
4084
- async createSession(request) {
4085
- if (typeof OffscreenCanvas === "undefined") throw new Error("Document layout Worker requires OffscreenCanvas text measurement support.");
4086
- const currentSession = this._sessions.get(request.unitId);
4087
- if (currentSession != null && request.sessionEpoch < currentSession.sessionEpoch) return;
4088
- this._disposeSession(request.unitId);
4089
- FontCache.setNormalLineHeightCache(request.normalFontLineHeights ?? {});
4090
- const dataModel = new DocumentDataModel(request.snapshot);
4091
- const localeService = new LocaleService();
4092
- if (request.localeData != null) localeService.load({ [request.locale]: request.localeData });
4093
- localeService.setLocale(request.locale);
4094
- localeService.setDirection(request.direction);
4095
- this._sessions.set(request.unitId, {
4096
- sessionEpoch: request.sessionEpoch,
4097
- dataModel,
4098
- layoutSessions: /* @__PURE__ */ new Map(),
4099
- localeService,
4100
- modelRevision: request.modelRevision,
4101
- customRangePresentations: /* @__PURE__ */ new Map()
4102
- });
4103
- }
4104
- async startLayout(request) {
4105
- const session = this._sessions.get(request.unitId);
4106
- if (session == null) return { status: "not-found" };
4107
- if (session.modelRevision !== request.baseRevision) return {
4108
- status: "resnapshot-required",
4109
- modelRevision: session.modelRevision
4110
- };
4111
- if (!this._applyMutations(session, request)) return {
4112
- status: "resnapshot-required",
4113
- modelRevision: session.modelRevision
4114
- };
4115
- FontCache.setNormalLineHeightCache(request.normalFontLineHeights ?? {});
4116
- this._updateCustomRangePresentations(session, request);
4117
- this._applyCustomRangePresentations(session.dataModel, Array.from(session.customRangePresentations.values()));
4118
- let mount = session.layoutSessions.get(request.mountId);
4119
- if (mount != null && (request.mountEpoch < mount.mountEpoch || request.mountEpoch === mount.mountEpoch && request.viewportEpoch < mount.viewportEpoch)) return { status: "superseded" };
4120
- if (mount != null && request.mountEpoch > mount.mountEpoch) {
4121
- mount.layoutSession.dispose();
4122
- session.layoutSessions.delete(request.mountId);
4123
- mount = void 0;
4124
- }
4125
- if (mount == null) {
4126
- const customBlockViewports = { ...request.customBlockViewports };
4127
- applyRecordPatch(customBlockViewports, request.customBlockViewportPatch);
4128
- mount = {
4129
- mountId: request.mountId,
4130
- layoutSession: new DocumentLayoutSession(session.dataModel, session.localeService),
4131
- customBlockViewports,
4132
- metricsRevision: request.metricsRevision,
4133
- mountEpoch: request.mountEpoch,
4134
- viewportEpoch: request.viewportEpoch,
4135
- activeGeneration: null,
4136
- cancelledGeneration: null
4137
- };
4138
- session.layoutSessions.set(request.mountId, mount);
4139
- } else {
4140
- if (request.customBlockViewports != null) mount.customBlockViewports = { ...request.customBlockViewports };
4141
- applyRecordPatch(mount.customBlockViewports, request.customBlockViewportPatch);
4142
- mount.metricsRevision = request.metricsRevision;
4143
- mount.viewportEpoch = request.viewportEpoch;
4144
- }
4145
- const generation = mount.layoutSession.start({
4146
- waitForHyphenationPatterns: true,
4147
- reason: request.reason,
4148
- anchor: request.anchor,
4149
- priorityAnchor: request.priorityAnchor,
4150
- invalidation: request.invalidation,
4151
- modernPageWidth: request.modernPageWidth,
4152
- modernHorizontalMargin: request.modernHorizontalMargin
4153
- });
4154
- mount.activeGeneration = generation;
4155
- mount.cancelledGeneration = null;
4156
- return {
4157
- status: "accepted",
4158
- step: await this._runLayoutStep(session, mount, generation, request.budgetMs)
4159
- };
4160
- }
4161
- _applyMutations(session, request) {
4162
- for (const mutation of request.mutations) {
4163
- if (mutation.baseRevision !== session.modelRevision || mutation.modelRevision !== mutation.baseRevision + 1) return false;
4164
- session.dataModel.apply(mutation.actions);
4165
- session.modelRevision = mutation.modelRevision;
4166
- }
4167
- if (session.modelRevision !== request.modelRevision) return false;
4168
- if (request.mutations.length > 0) for (const mount of session.layoutSessions.values()) {
4169
- mount.activeGeneration = null;
4170
- mount.cancelledGeneration = null;
4171
- mount.layoutSession.resetDataModel(session.dataModel);
4172
- }
4173
- return true;
4174
- }
4175
- _applyCustomRangePresentations(dataModel, presentations) {
4176
- const rangeMaps = /* @__PURE__ */ new Map();
4177
- const segmentModels = [
4178
- ["", dataModel],
4179
- ...dataModel.headerModelMap,
4180
- ...dataModel.footerModelMap
4181
- ];
4182
- for (const [segmentId, segmentModel] of segmentModels) {
4183
- var _segmentModel$getBody;
4184
- const rangeMap = /* @__PURE__ */ new Map();
4185
- for (const range of ((_segmentModel$getBody = segmentModel.getBody()) === null || _segmentModel$getBody === void 0 ? void 0 : _segmentModel$getBody.customRanges) ?? []) {
4186
- const workerRange = range;
4187
- delete workerRange.active;
4188
- delete workerRange.glyphAscentEm;
4189
- delete workerRange.glyphDescentEm;
4190
- delete workerRange.glyphWidthEm;
4191
- delete workerRange.show;
4192
- if (!rangeMap.has(range.rangeId)) rangeMap.set(range.rangeId, workerRange);
4193
- }
4194
- rangeMaps.set(segmentId, rangeMap);
4195
- }
4196
- for (const { segmentId, rangeId, presentation } of presentations ?? []) {
4197
- const rangeMap = rangeMaps.get(segmentId);
4198
- const range = rangeMap === null || rangeMap === void 0 ? void 0 : rangeMap.get(rangeId);
4199
- if (range != null) {
4200
- Object.assign(range, presentation);
4201
- rangeMap === null || rangeMap === void 0 || rangeMap.delete(rangeId);
4202
- }
4203
- }
4204
- }
4205
- _updateCustomRangePresentations(session, request) {
4206
- var _request$customRangeP, _request$customRangeP2;
4207
- if (request.customRangePresentations != null) {
4208
- session.customRangePresentations.clear();
4209
- for (const entry of request.customRangePresentations) {
4210
- const key = getCustomRangePresentationKey(entry);
4211
- if (!session.customRangePresentations.has(key)) session.customRangePresentations.set(key, entry);
4212
- }
4213
- }
4214
- for (const removal of ((_request$customRangeP = request.customRangePresentationPatch) === null || _request$customRangeP === void 0 ? void 0 : _request$customRangeP.removals) ?? []) session.customRangePresentations.delete(getCustomRangePresentationKey(removal));
4215
- for (const entry of ((_request$customRangeP2 = request.customRangePresentationPatch) === null || _request$customRangeP2 === void 0 ? void 0 : _request$customRangeP2.upserts) ?? []) session.customRangePresentations.set(getCustomRangePresentationKey(entry), entry);
4216
- }
4217
- async stepLayout(request) {
4218
- const session = this._getSession(request.unitId);
4219
- const mount = this._getLayoutMount(session, request);
4220
- return await this._runLayoutStep(session, mount, request.generation, request.budgetMs);
4221
- }
4222
- async publishBacklog(request) {
4223
- const session = this._getSession(request.unitId);
4224
- const mount = this._getLayoutMount(session, request);
4225
- return this._runWithCustomBlockViewports(session, mount, () => ({
4226
- ...mount.layoutSession.publishBacklog(request.generation),
4227
- unitId: request.unitId,
4228
- mountId: request.mountId,
4229
- mountEpoch: mount.mountEpoch,
4230
- viewportEpoch: mount.viewportEpoch,
4231
- modelRevision: session.modelRevision,
4232
- metricsRevision: mount.metricsRevision
4233
- }));
4234
- }
4235
- async getLayoutPage(request) {
4236
- const session = this._getSession(request.unitId);
4237
- const mount = this._getLayoutMount(session, request);
4238
- return {
4239
- ...request,
4240
- modelRevision: session.modelRevision,
4241
- metricsRevision: mount.metricsRevision,
4242
- page: mount.layoutSession.getPage(request.pageIndex)
4243
- };
4244
- }
4245
- async cancelLayout(request) {
4246
- var _this$_sessions$get;
4247
- const mount = (_this$_sessions$get = this._sessions.get(request.unitId)) === null || _this$_sessions$get === void 0 ? void 0 : _this$_sessions$get.layoutSessions.get(request.mountId);
4248
- if ((mount === null || mount === void 0 ? void 0 : mount.mountEpoch) === request.mountEpoch && mount.viewportEpoch === request.viewportEpoch) {
4249
- if (request.generation == null || request.generation === mount.activeGeneration) mount.cancelledGeneration = request.generation ?? mount.activeGeneration;
4250
- mount.layoutSession.cancel(request.generation);
4251
- }
4252
- }
4253
- async getPerformanceMetrics(unitId) {
4254
- return this._performanceTracker.getMetrics(unitId);
4255
- }
4256
- async resetPerformanceMetrics(unitId) {
4257
- this._performanceTracker.reset(unitId);
4258
- }
4259
- async disposeLayoutMount(request) {
4260
- const session = this._sessions.get(request.unitId);
4261
- const mount = session === null || session === void 0 ? void 0 : session.layoutSessions.get(request.mountId);
4262
- if (session == null || mount == null || mount.mountEpoch !== request.mountEpoch || mount.viewportEpoch !== request.viewportEpoch) return;
4263
- session.layoutSessions.delete(request.mountId);
4264
- mount.activeGeneration = null;
4265
- mount.layoutSession.dispose();
4266
- }
4267
- async disposeSession(request) {
4268
- const session = this._sessions.get(request.unitId);
4269
- if ((session === null || session === void 0 ? void 0 : session.sessionEpoch) !== request.sessionEpoch) return;
4270
- this._disposeSession(request.unitId);
4271
- this._performanceTracker.reset(request.unitId);
4272
- }
4273
- dispose() {
4274
- this._fontLoader.dispose();
4275
- for (const unitId of this._sessions.keys()) this._disposeSession(unitId);
4276
- this._performanceTracker.resetAll();
4277
- }
4278
- _getSession(unitId) {
4279
- const session = this._sessions.get(unitId);
4280
- if (session == null) throw new Error(`Document layout Worker session not found for unit "${unitId}".`);
4281
- return session;
4282
- }
4283
- _getLayoutMount(session, request) {
4284
- const mount = session.layoutSessions.get(request.mountId);
4285
- if (mount == null) throw new Error(`Document layout Worker mount not found: "${request.mountId}".`);
4286
- if (mount.mountEpoch !== request.mountEpoch || mount.viewportEpoch !== request.viewportEpoch) throw new Error(`Document layout Worker rejected a stale mount publication: "${request.mountId}".`);
4287
- return mount;
4288
- }
4289
- async _runLayoutStep(session, mount, generation, budgetMs) {
4290
- const result = this._runWithCustomBlockViewports(session, mount, () => ({
4291
- ...mount.layoutSession.step(generation, budgetMs, WORKER_LAYOUT_INTERRUPT_INTERVAL),
4292
- unitId: session.dataModel.getUnitId(),
4293
- mountId: mount.mountId,
4294
- mountEpoch: mount.mountEpoch,
4295
- viewportEpoch: mount.viewportEpoch,
4296
- modelRevision: session.modelRevision,
4297
- metricsRevision: mount.metricsRevision
4298
- }));
4299
- await yieldForWorkerMessage();
4300
- if (mount.activeGeneration === generation && mount.cancelledGeneration !== generation) return result;
4301
- return this._runWithCustomBlockViewports(session, mount, () => ({
4302
- ...mount.layoutSession.step(generation, 0, 1),
4303
- unitId: session.dataModel.getUnitId(),
4304
- mountId: mount.mountId,
4305
- mountEpoch: mount.mountEpoch,
4306
- viewportEpoch: mount.viewportEpoch,
4307
- modelRevision: session.modelRevision,
4308
- metricsRevision: mount.metricsRevision
4309
- }));
4310
- }
4311
- _runWithCustomBlockViewports(session, mount, run) {
4312
- const unregister = setDocsCustomBlockRenderViewportProvider((unitId, blockId) => unitId === session.dataModel.getUnitId() ? mount.customBlockViewports[blockId] : null);
4313
- try {
4314
- return run();
4315
- } finally {
4316
- unregister();
4317
- }
4318
- }
4319
- _disposeSession(unitId) {
4320
- const session = this._sessions.get(unitId);
4321
- if (session == null) return;
4322
- this._sessions.delete(unitId);
4323
- for (const mount of session.layoutSessions.values()) {
4324
- mount.activeGeneration = null;
4325
- mount.layoutSession.dispose();
4326
- }
4327
- session.layoutSessions.clear();
4328
- session.dataModel.dispose();
4329
- session.localeService.dispose();
4330
- }
4331
- };
4332
- var DocsLayoutWorkerChannelService = class extends ChannelService {
4333
- constructor(protocol, _runtime) {
4334
- super(protocol);
4335
- this._runtime = _runtime;
4336
- }
4337
- dispose() {
4338
- this._runtime.dispose();
4339
- super.dispose();
4340
- }
4341
- };
4342
- function startDocsLayoutWorker() {
4343
- const performanceTracker = new DocsLayoutWorkerPerformanceTracker();
4344
- const runtime = new DocsLayoutWorkerRuntime(performanceTracker);
4345
- const channelService = new DocsLayoutWorkerChannelService(createDocsLayoutWorkerMessageProtocol$1(performanceTracker), runtime);
4346
- channelService.registerChannel(DOCS_LAYOUT_WORKER_CHANNEL, fromModule(runtime));
4347
- return channelService;
4348
- }
4349
-
4350
- //#endregion
4351
- //#region src/layout-worker/index.ts
3119
+ // src/layout-worker/index.ts
4352
3120
  const FONT_METRICS_TOLERANCE = 1;
4353
3121
  var DocsLayoutWorkerCapabilityError = class extends Error {
4354
3122
  constructor(message) {
@@ -4560,8 +3328,7 @@ UniverDocsLayoutWorkerPlugin = __decorate([
4560
3328
  __decorateParam(3, IConfigService)
4561
3329
  ], UniverDocsLayoutWorkerPlugin);
4562
3330
 
4563
- //#endregion
4564
- //#region src/services/doc-interceptor/interceptor-const.ts
3331
+ // src/services/doc-interceptor/interceptor-const.ts
4565
3332
  const CUSTOM_RANGE = createInterceptorKey("CUSTOM_RANGE");
4566
3333
  const CUSTOM_DECORATION = createInterceptorKey("CUSTOM_DECORATION");
4567
3334
  const DOC_INTERCEPTOR_POINT = {
@@ -4569,8 +3336,7 @@ const DOC_INTERCEPTOR_POINT = {
4569
3336
  CUSTOM_DECORATION
4570
3337
  };
4571
3338
 
4572
- //#endregion
4573
- //#region src/services/doc-interceptor/doc-interceptor.service.ts
3339
+ // src/services/doc-interceptor/doc-interceptor.service.ts
4574
3340
  let DocInterceptorService = class DocInterceptorService extends Disposable {
4575
3341
  constructor(_context, _docSkeletonManagerService) {
4576
3342
  super();
@@ -4634,8 +3400,7 @@ let DocInterceptorService = class DocInterceptorService extends Disposable {
4634
3400
  };
4635
3401
  DocInterceptorService = __decorate([__decorateParam(1, Inject(DocSkeletonManagerService))], DocInterceptorService);
4636
3402
 
4637
- //#endregion
4638
- //#region src/utils/custom-range-factory.ts
3403
+ // src/utils/custom-range-factory.ts
4639
3404
  function addCustomRangeFactory(accessor, param, body) {
4640
3405
  const { unitId, segmentId } = param;
4641
3406
  const documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId);
@@ -4725,8 +3490,7 @@ function deleteCustomRangeFactory(accessor, params) {
4725
3490
  return doMutation;
4726
3491
  }
4727
3492
 
4728
- //#endregion
4729
- //#region src/utils/paragraphs.ts
3493
+ // src/utils/paragraphs.ts
4730
3494
  /** Builds paragraph metadata for inserted paragraph tokens, including horizontal-rule borders. */
4731
3495
  function generateParagraphs(dataStream, prevParagraph, borderBottom, existingParagraphIds = []) {
4732
3496
  const paragraphs = [];
@@ -4754,8 +3518,7 @@ function generateParagraphs(dataStream, prevParagraph, borderBottom, existingPar
4754
3518
  return paragraphs;
4755
3519
  }
4756
3520
 
4757
- //#endregion
4758
- //#region src/utils/replace-selection-factory.ts
3521
+ // src/utils/replace-selection-factory.ts
4759
3522
  function replaceSelectionFactory(accessor, params) {
4760
3523
  var _params$selection, _docDataModel$getSelf;
4761
3524
  const { unitId, body: insertBody, doc } = params;
@@ -4796,8 +3559,7 @@ function replaceSelectionFactory(accessor, params) {
4796
3559
  return doMutation;
4797
3560
  }
4798
3561
 
4799
- //#endregion
4800
- //#region src/utils/transform-position.ts
3562
+ // src/utils/transform-position.ts
4801
3563
  function buildDocTransform(width, height, position) {
4802
3564
  return {
4803
3565
  size: {
@@ -4845,8 +3607,7 @@ function transformToDocDrawingPosition(transform, marginLeft = 0, marginTop = 0)
4845
3607
  };
4846
3608
  }
4847
3609
 
4848
- //#endregion
4849
- //#region src/utils/util.ts
3610
+ // src/utils/util.ts
4850
3611
  function consumeContentInsertRange(accessor, unitId) {
4851
3612
  try {
4852
3613
  return accessor.get(DocContentInsertService).consumeInsertRange(unitId);
@@ -4878,5 +3639,4 @@ function normalizeTextRange(textRange) {
4878
3639
  };
4879
3640
  }
4880
3641
 
4881
- //#endregion
4882
- export { CreateHeaderFooterCommand, DOCUMENT_UNIT_PERMISSION_ACTIONS, DOC_INTERCEPTOR_POINT, DOC_SELECTION_OPTION_PRESERVE_CARET, DeleteDocumentSectionBreakCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutExecutorType, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, DocTextResolverService, DocsLayoutWorkerCapabilityError, DocsLayoutWorkerClientService, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentDefaultParagraphStyleCommand, SetDocumentNameCommand, SetDocumentPermissionCommand, SetDocumentPermissionRuleMutation, SetDocumentPermissionRulesMutation, SetDocumentPermissionsCommand, SetHeadingCollapsedCommand, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsLayoutWorkerPlugin, UniverDocsPlugin, UpdateDocumentParagraphStyleCommand, UpdateDocumentSectionCommand, UpdateTextCommand, addCustomRangeBySelectionFactory, addCustomRangeFactory, buildDocTransform, canEditDocumentTargets, consumeContentInsertRange, createDocsCustomBlockDrawing, createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createDocumentPermissionPoint, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, createSectionColumnProperties, deleteCustomRangeFactory, docDrawingPositionToTransform, generateParagraphs, getContentInsertRange, getDocumentDrawingSegmentId, getDocumentEditTargetObjectIds, getDocumentEntityParentPermissionObjectIds, getDocumentEntityPermissionObjectId, getDocumentParagraphParentPermissionObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getEffectiveSectionPageSetup, getSectionContentWidth, getTopLevelSectionBreaks, isEmbedDocsCustomBlockData, isHeaderFooterSelection, isSheetLikeDocsCustomBlockChildType, normalizeTextRange, replaceSelectionFactory, resolveDocsCustomBlockSize, setDocumentPermissionValue, shouldUseInlineTextSelectionForDocsCustomBlockDrawing, startDocsLayoutWorker, transformDocumentTextRanges, transformToDocDrawingPosition };
3642
+ export { CreateHeaderFooterCommand, DOCUMENT_UNIT_PERMISSION_ACTIONS, DOC_INTERCEPTOR_POINT, DOC_SELECTION_OPTION_PRESERVE_CARET, DeleteDocumentSectionBreakCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutExecutorType, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, DocTextResolverService, DocsLayoutWorkerCapabilityError, DocsLayoutWorkerClientService, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentDefaultParagraphStyleCommand, SetDocumentNameCommand, SetDocumentPermissionCommand, SetDocumentPermissionRuleMutation, SetDocumentPermissionRulesMutation, SetDocumentPermissionsCommand, SetHeadingCollapsedCommand, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsLayoutWorkerPlugin, UniverDocsPlugin, UpdateDocumentParagraphStyleCommand, UpdateDocumentSectionCommand, UpdateTextCommand, addCustomRangeBySelectionFactory, addCustomRangeFactory, buildDocTransform, canEditDocumentTargets, consumeContentInsertRange, createDocsCustomBlockDrawing, createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createDocumentPermissionPoint, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, createSectionColumnProperties, deleteCustomRangeFactory, docDrawingPositionToTransform, generateParagraphs, getContentInsertRange, getDocumentDrawingSegmentId, getDocumentEditTargetObjectIds, getDocumentEntityParentPermissionObjectIds, getDocumentEntityPermissionObjectId, getDocumentParagraphParentPermissionObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getEffectiveSectionPageSetup, getSectionContentWidth, getTopLevelSectionBreaks, isEmbedDocsCustomBlockData, isHeaderFooterSelection, isSheetLikeDocsCustomBlockChildType, normalizeTextRange, replaceSelectionFactory, resolveDocsCustomBlockSize, setDocumentPermissionValue, shouldUseInlineTextSelectionForDocsCustomBlockDrawing, transformDocumentTextRanges, transformToDocDrawingPosition };