superdoc 1.0.0-beta.20 → 1.0.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-CPnD95lv.es.js → PdfViewer-CEwbF85g.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DbSf6FKU.cjs → PdfViewer-CqAQvFv3.cjs} +1 -1
  3. package/dist/chunks/{index-BSHAWPko.es.js → index-BFobqgP4.es.js} +3 -3
  4. package/dist/chunks/{index-DHhKY9FZ-CyEU4GWR.es.js → index-DSuc12CK-DH_DeF0B.es.js} +1 -1
  5. package/dist/chunks/{index-DHhKY9FZ-DORT-UR6.cjs → index-DSuc12CK-Dpg5Hd9W.cjs} +1 -1
  6. package/dist/chunks/{index-DLco7m-w.cjs → index-Dy-eAVHL.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-C0tdU_gq.es.js → super-editor.es-B5YJmpPg.es.js} +393 -33
  8. package/dist/chunks/{super-editor.es-B6lsvAAY.cjs → super-editor.es-C2UuUFg3.cjs} +393 -33
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-m2x13P8G.js → converter-Cw0V00On.js} +4 -4
  11. package/dist/super-editor/chunks/{docx-zipper-CRSKJF-o.js → docx-zipper-D7k6lS5l.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-C9r_Jbbg.js → editor-CDWzRc4H.js} +392 -31
  13. package/dist/super-editor/chunks/{index-DHhKY9FZ.js → index-DSuc12CK.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-fnptYAcU.js → toolbar-CHJspeuY.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +395 -35
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
12
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as ListHelpers, O as updateNumberingProperties, Q as changeListLevel, U as findParentNode, V as isList, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-m2x13P8G.js";
16
- import { D as DocxZipper } from "./docx-zipper-CRSKJF-o.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as ListHelpers, O as updateNumberingProperties, Q as changeListLevel, U as findParentNode, V as isList, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-Cw0V00On.js";
16
+ import { D as DocxZipper } from "./docx-zipper-D7k6lS5l.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -11213,7 +11213,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
11213
11213
  comments.forEach((c) => {
11214
11214
  commentMap.set(c.commentId, c);
11215
11215
  });
11216
- new Set(comments.filter((c) => c.parentCommentId).map((c) => c.parentCommentId));
11217
11216
  const startNodes = [];
11218
11217
  const endNodes = [];
11219
11218
  const seen = /* @__PURE__ */ new Set();
@@ -13857,7 +13856,7 @@ const isHeadless = (editor) => {
13857
13856
  const shouldSkipNodeView = (editor) => {
13858
13857
  return isHeadless(editor);
13859
13858
  };
13860
- const summaryVersion = "1.0.0-beta.20";
13859
+ const summaryVersion = "1.0.0-beta.21";
13861
13860
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13862
13861
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13863
13862
  function mapAttributes(attrs) {
@@ -14636,7 +14635,7 @@ const _Editor = class _Editor extends EventEmitter {
14636
14635
  { default: remarkStringify },
14637
14636
  { default: remarkGfm }
14638
14637
  ] = await Promise.all([
14639
- import("./index-DHhKY9FZ.js"),
14638
+ import("./index-DSuc12CK.js"),
14640
14639
  import("./index-DRCvimau.js"),
14641
14640
  import("./index-C_x_N6Uh.js"),
14642
14641
  import("./index-D_sWOSiG.js"),
@@ -14841,7 +14840,7 @@ const _Editor = class _Editor extends EventEmitter {
14841
14840
  * Process collaboration migrations
14842
14841
  */
14843
14842
  processCollaborationMigrations() {
14844
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.20");
14843
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
14845
14844
  if (!this.options.ydoc) return;
14846
14845
  const metaMap = this.options.ydoc.getMap("meta");
14847
14846
  let docVersion = metaMap.get("version");
@@ -15616,8 +15615,9 @@ function extractPageNumbering(elements) {
15616
15615
  const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
15617
15616
  const startRaw = pgNumType.attributes["w:start"];
15618
15617
  const startNum = startRaw != null ? Number(startRaw) : void 0;
15618
+ const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
15619
15619
  return {
15620
- format: fmt,
15620
+ format: effectiveFormat,
15621
15621
  ...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
15622
15622
  };
15623
15623
  }
@@ -22839,6 +22839,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
22839
22839
  }
22840
22840
  return null;
22841
22841
  };
22842
+ const defaultMultiSectionIdentifier = () => ({
22843
+ headerIds: { default: null, first: null, even: null, odd: null },
22844
+ footerIds: { default: null, first: null, even: null, odd: null },
22845
+ titlePg: false,
22846
+ alternateHeaders: false,
22847
+ sectionCount: 0,
22848
+ sectionHeaderIds: /* @__PURE__ */ new Map(),
22849
+ sectionFooterIds: /* @__PURE__ */ new Map(),
22850
+ sectionTitlePg: /* @__PURE__ */ new Map()
22851
+ });
22852
+ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
22853
+ const identifier = defaultMultiSectionIdentifier();
22854
+ identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
22855
+ identifier.sectionCount = sectionMetadata.length;
22856
+ for (const section of sectionMetadata) {
22857
+ const idx = section.sectionIndex;
22858
+ if (section.headerRefs) {
22859
+ identifier.sectionHeaderIds.set(idx, {
22860
+ default: section.headerRefs.default ?? null,
22861
+ first: section.headerRefs.first ?? null,
22862
+ even: section.headerRefs.even ?? null,
22863
+ odd: section.headerRefs.odd ?? null
22864
+ });
22865
+ }
22866
+ if (section.footerRefs) {
22867
+ identifier.sectionFooterIds.set(idx, {
22868
+ default: section.footerRefs.default ?? null,
22869
+ first: section.footerRefs.first ?? null,
22870
+ even: section.footerRefs.even ?? null,
22871
+ odd: section.footerRefs.odd ?? null
22872
+ });
22873
+ }
22874
+ const hasFirstHeader = Boolean(section.headerRefs?.first);
22875
+ const hasFirstFooter = Boolean(section.footerRefs?.first);
22876
+ if (hasFirstHeader || hasFirstFooter) {
22877
+ identifier.sectionTitlePg.set(idx, true);
22878
+ }
22879
+ }
22880
+ const section0Headers = identifier.sectionHeaderIds.get(0);
22881
+ const section0Footers = identifier.sectionFooterIds.get(0);
22882
+ if (section0Headers) {
22883
+ identifier.headerIds = { ...section0Headers };
22884
+ }
22885
+ if (section0Footers) {
22886
+ identifier.footerIds = { ...section0Footers };
22887
+ }
22888
+ identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
22889
+ return identifier;
22890
+ }
22891
+ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
22892
+ if (pageNumber <= 0) return null;
22893
+ const kind = options?.kind ?? "header";
22894
+ const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
22895
+ const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
22896
+ const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
22897
+ const hasFirst = Boolean(ids.first);
22898
+ const hasEven = Boolean(ids.even);
22899
+ const hasOdd = Boolean(ids.odd);
22900
+ const hasDefault = Boolean(ids.default);
22901
+ const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
22902
+ const titlePgEnabled = sectionTitlePg && hasFirst;
22903
+ const isFirstPageOfSection = sectionPageNumber === 1;
22904
+ if (isFirstPageOfSection && titlePgEnabled) {
22905
+ return "first";
22906
+ }
22907
+ if (identifier.alternateHeaders) {
22908
+ if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
22909
+ return hasEven ? "even" : "default";
22910
+ }
22911
+ if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
22912
+ return hasOdd ? "odd" : "default";
22913
+ }
22914
+ }
22915
+ if (hasDefault) {
22916
+ return "default";
22917
+ }
22918
+ return null;
22919
+ }
22842
22920
  function createFloatingObjectManager(columns, margins, pageWidth) {
22843
22921
  const zones = [];
22844
22922
  const marginLeft = Math.max(0, margins?.left ?? 0);
@@ -23989,23 +24067,54 @@ function layoutTableBlock({
23989
24067
  const headerCount = countHeaderRows(block);
23990
24068
  const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
23991
24069
  let state = ensurePage();
24070
+ const availableHeight = state.contentBottom - state.cursorY;
24071
+ let minRequiredHeight = 0;
24072
+ if (measure.rows.length > 0) {
24073
+ minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
24074
+ } else if (measure.totalHeight > 0) {
24075
+ minRequiredHeight = measure.totalHeight;
24076
+ }
24077
+ if (minRequiredHeight > availableHeight && state.page.fragments.length > 0) {
24078
+ state = advanceColumn(state);
24079
+ }
23992
24080
  let currentRow = 0;
23993
24081
  let isTableContinuation = false;
23994
24082
  let pendingPartialRow = null;
24083
+ if (block.rows.length === 0 && measure.totalHeight > 0) {
24084
+ const height = Math.min(measure.totalHeight, state.contentBottom - state.cursorY);
24085
+ const metadata = {
24086
+ columnBoundaries: generateColumnBoundaries(measure),
24087
+ coordinateSystem: "fragment"
24088
+ };
24089
+ const fragment = {
24090
+ kind: "table",
24091
+ blockId: block.id,
24092
+ fromRow: 0,
24093
+ toRow: 0,
24094
+ x: columnX(state.columnIndex),
24095
+ y: state.cursorY,
24096
+ width: Math.min(columnWidth, measure.totalWidth || columnWidth),
24097
+ height,
24098
+ metadata
24099
+ };
24100
+ state.page.fragments.push(fragment);
24101
+ state.cursorY += height;
24102
+ return;
24103
+ }
23995
24104
  while (currentRow < block.rows.length || pendingPartialRow !== null) {
23996
24105
  state = ensurePage();
23997
- const availableHeight = state.contentBottom - state.cursorY;
24106
+ const availableHeight2 = state.contentBottom - state.cursorY;
23998
24107
  let repeatHeaderCount = 0;
23999
24108
  if (currentRow === 0 && !pendingPartialRow) {
24000
24109
  repeatHeaderCount = 0;
24001
24110
  } else {
24002
- if (headerCount > 0 && headerHeight <= availableHeight) {
24111
+ if (headerCount > 0 && headerHeight <= availableHeight2) {
24003
24112
  repeatHeaderCount = headerCount;
24004
- } else if (headerCount > 0 && headerHeight > availableHeight) {
24113
+ } else if (headerCount > 0 && headerHeight > availableHeight2) {
24005
24114
  repeatHeaderCount = 0;
24006
24115
  }
24007
24116
  }
24008
- const availableForBody = repeatHeaderCount > 0 ? availableHeight - headerHeight : availableHeight;
24117
+ const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
24009
24118
  const fullPageHeight = state.contentBottom;
24010
24119
  if (pendingPartialRow !== null) {
24011
24120
  const rowIndex = pendingPartialRow.rowIndex;
@@ -24384,7 +24493,7 @@ function computeDisplayPageNumber(pages, sections) {
24384
24493
  let currentSectionIndex = -1;
24385
24494
  for (let i = 0; i < pages.length; i++) {
24386
24495
  const page = pages[i];
24387
- const pageSectionIndex = 0;
24496
+ const pageSectionIndex = page.sectionIndex ?? 0;
24388
24497
  if (pageSectionIndex !== currentSectionIndex) {
24389
24498
  const sectionMetadata2 = sectionMap.get(pageSectionIndex);
24390
24499
  if (sectionMetadata2?.numbering?.start !== void 0) {
@@ -24633,6 +24742,18 @@ function layoutDocument(blocks, measures, options = {}) {
24633
24742
  };
24634
24743
  layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
24635
24744
  }
24745
+ const firstSectionIndexRaw = block.attrs?.sectionIndex;
24746
+ const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
24747
+ if (Number.isFinite(firstMetadataIndex)) {
24748
+ activeSectionIndex = firstMetadataIndex;
24749
+ }
24750
+ const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
24751
+ if (firstSectionMetadata?.numbering) {
24752
+ if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
24753
+ if (typeof firstSectionMetadata.numbering.start === "number") {
24754
+ activePageCounter = firstSectionMetadata.numbering.start;
24755
+ }
24756
+ }
24636
24757
  return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
24637
24758
  }
24638
24759
  const headerPx = block.margins?.header;
@@ -24649,7 +24770,15 @@ function layoutDocument(blocks, measures, options = {}) {
24649
24770
  if (block.orientation) next.pendingOrientation = block.orientation;
24650
24771
  const sectionType = block.type ?? "continuous";
24651
24772
  const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
24652
- if (block.numbering) {
24773
+ const sectionIndexRaw = block.attrs?.sectionIndex;
24774
+ const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
24775
+ if (Number.isFinite(metadataIndex)) {
24776
+ pendingSectionIndex = metadataIndex;
24777
+ }
24778
+ const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
24779
+ if (sectionMetadata?.numbering) {
24780
+ pendingNumbering = { ...sectionMetadata.numbering };
24781
+ } else if (block.numbering) {
24653
24782
  pendingNumbering = { ...block.numbering };
24654
24783
  }
24655
24784
  if (block.headerRefs || block.footerRefs) {
@@ -24718,6 +24847,8 @@ function layoutDocument(blocks, measures, options = {}) {
24718
24847
  ...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
24719
24848
  };
24720
24849
  }
24850
+ let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
24851
+ let pendingSectionIndex = null;
24721
24852
  const paginator = createPaginator({
24722
24853
  margins: { left: margins.left, right: margins.right },
24723
24854
  getActiveTopMargin: () => activeTopMargin,
@@ -24774,6 +24905,10 @@ function layoutDocument(blocks, measures, options = {}) {
24774
24905
  activeSectionRefs = pendingSectionRefs;
24775
24906
  pendingSectionRefs = null;
24776
24907
  }
24908
+ if (pendingSectionIndex !== null) {
24909
+ activeSectionIndex = pendingSectionIndex;
24910
+ pendingSectionIndex = null;
24911
+ }
24777
24912
  if (pendingVAlign !== null) {
24778
24913
  activeVAlign = pendingVAlign;
24779
24914
  pendingVAlign = null;
@@ -24783,6 +24918,8 @@ function layoutDocument(blocks, measures, options = {}) {
24783
24918
  }
24784
24919
  if (state?.page) {
24785
24920
  state.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
24921
+ state.page.sectionIndex = activeSectionIndex;
24922
+ layoutLog(`[Layout] Page ${state.page.number}: Stamped sectionIndex:`, activeSectionIndex);
24786
24923
  if (activeSectionRefs) {
24787
24924
  state.page.sectionRefs = {
24788
24925
  ...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
@@ -24969,8 +25106,8 @@ function layoutDocument(blocks, measures, options = {}) {
24969
25106
  activeOrientation = updatedState.activeOrientation;
24970
25107
  pendingOrientation = updatedState.pendingOrientation;
24971
25108
  if (effectiveBlock.vAlign) {
24972
- const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
24973
- if (isFirstSection) {
25109
+ const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
25110
+ if (isFirstSection2) {
24974
25111
  activeVAlign = effectiveBlock.vAlign;
24975
25112
  pendingVAlign = null;
24976
25113
  } else {
@@ -24984,6 +25121,36 @@ function layoutDocument(blocks, measures, options = {}) {
24984
25121
  };
24985
25122
  layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
24986
25123
  }
25124
+ const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
25125
+ const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
25126
+ const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
25127
+ if (Number.isFinite(metadataIndex)) {
25128
+ if (isFirstSection) {
25129
+ activeSectionIndex = metadataIndex;
25130
+ } else {
25131
+ pendingSectionIndex = metadataIndex;
25132
+ }
25133
+ }
25134
+ const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
25135
+ if (sectionMetadata?.numbering) {
25136
+ if (isFirstSection) {
25137
+ if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
25138
+ if (typeof sectionMetadata.numbering.start === "number") {
25139
+ activePageCounter = sectionMetadata.numbering.start;
25140
+ }
25141
+ } else {
25142
+ pendingNumbering = { ...sectionMetadata.numbering };
25143
+ }
25144
+ } else if (effectiveBlock.numbering) {
25145
+ if (isFirstSection) {
25146
+ if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
25147
+ if (typeof effectiveBlock.numbering.start === "number") {
25148
+ activePageCounter = effectiveBlock.numbering.start;
25149
+ }
25150
+ } else {
25151
+ pendingNumbering = { ...effectiveBlock.numbering };
25152
+ }
25153
+ }
24987
25154
  if (breakInfo.forceMidPageRegion && block.columns) {
24988
25155
  let state = paginator.ensurePage();
24989
25156
  const columnIndexBefore = state.columnIndex;
@@ -25963,8 +26130,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
25963
26130
  const { totalPages: docTotalPages } = pageResolver(1);
25964
26131
  const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
25965
26132
  for (const [type, blocks] of Object.entries(sections)) {
25966
- if (!blocks || blocks.length === 0) continue;
25967
- if (!hasPageTokens(blocks)) {
26133
+ if (!blocks || blocks.length === 0) {
26134
+ continue;
26135
+ }
26136
+ const hasTokens = hasPageTokens(blocks);
26137
+ if (!hasTokens) {
25968
26138
  const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
25969
26139
  const layout = layoutHeaderFooter(blocks, measures, constraints);
25970
26140
  result[type] = { blocks, measures, layout };
@@ -25986,7 +26156,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
25986
26156
  for (const pageNum of pagesToLayout) {
25987
26157
  const clonedBlocks = cloneHeaderFooterBlocks(blocks);
25988
26158
  const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
25989
- resolveHeaderFooterTokens(clonedBlocks, parseInt(displayText, 10) || pageNum, totalPagesForPage);
26159
+ const resolvedPageNum = parseInt(displayText, 10) || pageNum;
26160
+ resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
25990
26161
  const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
25991
26162
  const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
25992
26163
  pages.push({
@@ -35338,6 +35509,49 @@ class HeaderFooterLayoutAdapter {
35338
35509
  });
35339
35510
  return hasBlocks ? batch : void 0;
35340
35511
  }
35512
+ /**
35513
+ * Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
35514
+ *
35515
+ * Unlike getBatch() which only returns content for variant-associated IDs,
35516
+ * this method returns content for ALL registered header/footer IDs. This is
35517
+ * essential for multi-section documents where different sections may use
35518
+ * different content for the same variant type.
35519
+ *
35520
+ * @param kind - The type of section to retrieve: 'header' or 'footer'
35521
+ * @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
35522
+ *
35523
+ * @example
35524
+ * ```typescript
35525
+ * const footersByRId = adapter.getBlocksByRId('footer');
35526
+ * if (footersByRId) {
35527
+ * // footersByRId.get('rId14') - blocks for footer with rId14
35528
+ * // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
35529
+ * }
35530
+ * ```
35531
+ */
35532
+ getBlocksByRId(kind) {
35533
+ const descriptors = __privateGet(this, _manager).getDescriptors(kind);
35534
+ if (!descriptors.length) return void 0;
35535
+ const blocksMap = /* @__PURE__ */ new Map();
35536
+ descriptors.forEach((descriptor) => {
35537
+ const blocks = __privateMethod(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
35538
+ if (blocks && blocks.length > 0) {
35539
+ blocksMap.set(descriptor.id, blocks);
35540
+ }
35541
+ });
35542
+ return blocksMap.size > 0 ? blocksMap : void 0;
35543
+ }
35544
+ /**
35545
+ * Retrieves FlowBlocks for a specific header/footer by its relationship ID.
35546
+ *
35547
+ * @param rId - The relationship ID (e.g., 'rId14')
35548
+ * @returns FlowBlock array for the specified rId, or undefined if not found
35549
+ */
35550
+ getBlocksForRId(rId) {
35551
+ const descriptor = __privateGet(this, _manager).getDescriptorById(rId);
35552
+ if (!descriptor) return void 0;
35553
+ return __privateMethod(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
35554
+ }
35341
35555
  /**
35342
35556
  * Invalidates the cached FlowBlocks for a specific header/footer section.
35343
35557
  *
@@ -35848,8 +36062,12 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
35848
36062
  __privateAdd(this, _headerFooterManager, null);
35849
36063
  __privateAdd(this, _headerFooterAdapter, null);
35850
36064
  __privateAdd(this, _headerFooterIdentifier, null);
36065
+ __privateAdd(this, _multiSectionIdentifier, null);
35851
36066
  __privateAdd(this, _headerLayoutResults, null);
35852
36067
  __privateAdd(this, _footerLayoutResults, null);
36068
+ // Per-rId layout results for multi-section support
36069
+ __privateAdd(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
36070
+ __privateAdd(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
35853
36071
  __privateAdd(this, _headerDecorationProvider);
35854
36072
  __privateAdd(this, _footerDecorationProvider);
35855
36073
  __privateAdd(this, _headerFooterManagerCleanups, []);
@@ -37015,8 +37233,11 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
37015
37233
  __privateSet(this, _headerFooterManager, null);
37016
37234
  }, "Header/footer manager");
37017
37235
  __privateSet(this, _headerFooterIdentifier, null);
37236
+ __privateSet(this, _multiSectionIdentifier, null);
37018
37237
  __privateSet(this, _headerLayoutResults, null);
37019
37238
  __privateSet(this, _footerLayoutResults, null);
37239
+ __privateGet(this, _headerLayoutsByRId).clear();
37240
+ __privateGet(this, _footerLayoutsByRId).clear();
37020
37241
  __privateSet(this, _headerDecorationProvider, void 0);
37021
37242
  __privateSet(this, _footerDecorationProvider, void 0);
37022
37243
  __privateSet(this, _session, { mode: "body" });
@@ -37070,8 +37291,11 @@ _trackedChangesOverrides = new WeakMap();
37070
37291
  _headerFooterManager = new WeakMap();
37071
37292
  _headerFooterAdapter = new WeakMap();
37072
37293
  _headerFooterIdentifier = new WeakMap();
37294
+ _multiSectionIdentifier = new WeakMap();
37073
37295
  _headerLayoutResults = new WeakMap();
37074
37296
  _footerLayoutResults = new WeakMap();
37297
+ _headerLayoutsByRId = new WeakMap();
37298
+ _footerLayoutsByRId = new WeakMap();
37075
37299
  _headerDecorationProvider = new WeakMap();
37076
37300
  _footerDecorationProvider = new WeakMap();
37077
37301
  _headerFooterManagerCleanups = new WeakMap();
@@ -37850,11 +38074,11 @@ rerender_fn = async function() {
37850
38074
  const sectionMetadata = [];
37851
38075
  let blocks;
37852
38076
  try {
37853
- const converter = __privateGet(this, _editor3).converter;
37854
- const converterContext = converter ? {
37855
- docx: converter.convertedXml,
37856
- numbering: converter.numbering,
37857
- linkedStyles: converter.linkedStyles
38077
+ const converter2 = __privateGet(this, _editor3).converter;
38078
+ const converterContext = converter2 ? {
38079
+ docx: converter2.convertedXml,
38080
+ numbering: converter2.numbering,
38081
+ linkedStyles: converter2.linkedStyles
37858
38082
  } : void 0;
37859
38083
  const result = toFlowBlocks(docJson, {
37860
38084
  mediaFiles: __privateGet(this, _options).mediaFiles,
@@ -37912,9 +38136,12 @@ rerender_fn = async function() {
37912
38136
  return;
37913
38137
  }
37914
38138
  __privateSet(this, _sectionMetadata, sectionMetadata);
38139
+ const converter = __privateGet(this, _editor3).converter;
38140
+ __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
37915
38141
  __privateSet(this, _layoutState, { blocks, measures, layout });
37916
38142
  __privateSet(this, _headerLayoutResults, headerLayouts ?? null);
37917
38143
  __privateSet(this, _footerLayoutResults, footerLayouts ?? null);
38144
+ await __privateMethod(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
37918
38145
  __privateMethod(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
37919
38146
  const painter = __privateMethod(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
37920
38147
  if (typeof painter.setProviders === "function") {
@@ -37928,6 +38155,10 @@ rerender_fn = async function() {
37928
38155
  headerMeasures.push(...headerResult.measures);
37929
38156
  }
37930
38157
  }
38158
+ for (const rIdResult of __privateGet(this, _headerLayoutsByRId).values()) {
38159
+ headerBlocks.push(...rIdResult.blocks);
38160
+ headerMeasures.push(...rIdResult.measures);
38161
+ }
37931
38162
  const footerBlocks = [];
37932
38163
  const footerMeasures = [];
37933
38164
  if (footerLayouts) {
@@ -37936,6 +38167,10 @@ rerender_fn = async function() {
37936
38167
  footerMeasures.push(...footerResult.measures);
37937
38168
  }
37938
38169
  }
38170
+ for (const rIdResult of __privateGet(this, _footerLayoutsByRId).values()) {
38171
+ footerBlocks.push(...rIdResult.blocks);
38172
+ footerMeasures.push(...rIdResult.measures);
38173
+ }
37939
38174
  painter.setData?.(
37940
38175
  blocks,
37941
38176
  measures,
@@ -38041,7 +38276,9 @@ buildHeaderFooterInput_fn = function() {
38041
38276
  }
38042
38277
  const headerBlocks = __privateGet(this, _headerFooterAdapter).getBatch("header");
38043
38278
  const footerBlocks = __privateGet(this, _headerFooterAdapter).getBatch("footer");
38044
- if (!headerBlocks && !footerBlocks) {
38279
+ const headerBlocksByRId = __privateGet(this, _headerFooterAdapter).getBlocksByRId("header");
38280
+ const footerBlocksByRId = __privateGet(this, _headerFooterAdapter).getBlocksByRId("footer");
38281
+ if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
38045
38282
  return null;
38046
38283
  }
38047
38284
  const constraints = __privateMethod(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
@@ -38051,6 +38288,8 @@ buildHeaderFooterInput_fn = function() {
38051
38288
  return {
38052
38289
  headerBlocks,
38053
38290
  footerBlocks,
38291
+ headerBlocksByRId,
38292
+ footerBlocksByRId,
38054
38293
  constraints
38055
38294
  };
38056
38295
  };
@@ -38073,6 +38312,80 @@ computeHeaderFooterConstraints_fn = function() {
38073
38312
  margins: { left: marginLeft, right: marginRight }
38074
38313
  };
38075
38314
  };
38315
+ layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
38316
+ __privateGet(this, _headerLayoutsByRId).clear();
38317
+ __privateGet(this, _footerLayoutsByRId).clear();
38318
+ if (!headerFooterInput) return;
38319
+ const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
38320
+ const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
38321
+ const totalPages = layout.pages.length;
38322
+ const pageResolver = (pageNumber) => {
38323
+ const pageIndex = pageNumber - 1;
38324
+ const displayInfo = displayPages[pageIndex];
38325
+ return {
38326
+ displayText: displayInfo?.displayText ?? String(pageNumber),
38327
+ totalPages
38328
+ };
38329
+ };
38330
+ if (headerBlocksByRId) {
38331
+ for (const [rId, blocks] of headerBlocksByRId) {
38332
+ if (!blocks || blocks.length === 0) continue;
38333
+ try {
38334
+ const batchResult = await layoutHeaderFooterWithCache(
38335
+ { default: blocks },
38336
+ // Treat each rId as a 'default' variant
38337
+ constraints,
38338
+ (block, c) => measureBlock(block, c),
38339
+ void 0,
38340
+ // Use shared cache
38341
+ void 0,
38342
+ // No legacy totalPages
38343
+ pageResolver
38344
+ );
38345
+ if (batchResult.default) {
38346
+ __privateGet(this, _headerLayoutsByRId).set(rId, {
38347
+ kind: "header",
38348
+ type: "default",
38349
+ layout: batchResult.default.layout,
38350
+ blocks: batchResult.default.blocks,
38351
+ measures: batchResult.default.measures
38352
+ });
38353
+ }
38354
+ } catch (error) {
38355
+ console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
38356
+ }
38357
+ }
38358
+ }
38359
+ if (footerBlocksByRId) {
38360
+ for (const [rId, blocks] of footerBlocksByRId) {
38361
+ if (!blocks || blocks.length === 0) continue;
38362
+ try {
38363
+ const batchResult = await layoutHeaderFooterWithCache(
38364
+ { default: blocks },
38365
+ // Treat each rId as a 'default' variant
38366
+ constraints,
38367
+ (block, c) => measureBlock(block, c),
38368
+ void 0,
38369
+ // Use shared cache
38370
+ void 0,
38371
+ // No legacy totalPages
38372
+ pageResolver
38373
+ );
38374
+ if (batchResult.default) {
38375
+ __privateGet(this, _footerLayoutsByRId).set(rId, {
38376
+ kind: "footer",
38377
+ type: "default",
38378
+ layout: batchResult.default.layout,
38379
+ blocks: batchResult.default.blocks,
38380
+ measures: batchResult.default.measures
38381
+ });
38382
+ }
38383
+ } catch (error) {
38384
+ console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
38385
+ }
38386
+ }
38387
+ }
38388
+ };
38076
38389
  updateDecorationProviders_fn = function(layout) {
38077
38390
  __privateSet(this, _headerDecorationProvider, __privateMethod(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
38078
38391
  __privateSet(this, _footerDecorationProvider, __privateMethod(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
@@ -38080,15 +38393,63 @@ updateDecorationProviders_fn = function(layout) {
38080
38393
  };
38081
38394
  createDecorationProvider_fn = function(kind, layout) {
38082
38395
  const results = kind === "header" ? __privateGet(this, _headerLayoutResults) : __privateGet(this, _footerLayoutResults);
38083
- if (!results || results.length === 0) {
38396
+ const layoutsByRId = kind === "header" ? __privateGet(this, _headerLayoutsByRId) : __privateGet(this, _footerLayoutsByRId);
38397
+ if ((!results || results.length === 0) && layoutsByRId.size === 0) {
38084
38398
  return void 0;
38085
38399
  }
38086
- const identifier = __privateGet(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet(this, _editor3).converter);
38400
+ const multiSectionId = __privateGet(this, _multiSectionIdentifier);
38401
+ const legacyIdentifier = __privateGet(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet(this, _editor3).converter);
38402
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
38403
+ for (const p of layout.pages) {
38404
+ const idx = p.sectionIndex ?? 0;
38405
+ if (!sectionFirstPageNumbers.has(idx)) {
38406
+ sectionFirstPageNumbers.set(idx, p.number);
38407
+ }
38408
+ }
38087
38409
  return (pageNumber, pageMargins, page) => {
38088
- const headerFooterType = getHeaderFooterType(pageNumber, identifier, { kind });
38410
+ const sectionIndex = page?.sectionIndex ?? 0;
38411
+ const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
38412
+ const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
38413
+ const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
38414
+ const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
38089
38415
  if (!headerFooterType) {
38090
38416
  return null;
38091
38417
  }
38418
+ if (sectionRId && layoutsByRId.has(sectionRId)) {
38419
+ const rIdLayout = layoutsByRId.get(sectionRId);
38420
+ const slotPage2 = __privateMethod(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
38421
+ if (slotPage2) {
38422
+ const fragments2 = slotPage2.fragments ?? [];
38423
+ const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
38424
+ const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
38425
+ const box2 = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
38426
+ return {
38427
+ fragments: fragments2,
38428
+ height: box2.height,
38429
+ contentHeight: rIdLayout.layout.height ?? box2.height,
38430
+ offset: box2.offset,
38431
+ marginLeft: box2.x,
38432
+ contentWidth: box2.width,
38433
+ headerId: sectionRId,
38434
+ sectionType: headerFooterType,
38435
+ box: {
38436
+ x: box2.x,
38437
+ y: box2.offset,
38438
+ width: box2.width,
38439
+ height: box2.height
38440
+ },
38441
+ hitRegion: {
38442
+ x: box2.x,
38443
+ y: box2.offset,
38444
+ width: box2.width,
38445
+ height: box2.height
38446
+ }
38447
+ };
38448
+ }
38449
+ }
38450
+ if (!results || results.length === 0) {
38451
+ return null;
38452
+ }
38092
38453
  const variant = results.find((entry) => entry.type === headerFooterType);
38093
38454
  if (!variant || !variant.layout?.pages?.length) {
38094
38455
  return null;
@@ -38101,9 +38462,8 @@ createDecorationProvider_fn = function(kind, layout) {
38101
38462
  const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
38102
38463
  const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
38103
38464
  const box = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
38104
- const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
38105
38465
  const fallbackId = __privateGet(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
38106
- const finalHeaderId = headerId ?? fallbackId ?? void 0;
38466
+ const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
38107
38467
  return {
38108
38468
  fragments,
38109
38469
  height: box.height,
@@ -38351,7 +38711,8 @@ enterHeaderFooterMode_fn = async function(region) {
38351
38711
  const doc2 = editor.state?.doc;
38352
38712
  if (doc2) {
38353
38713
  const endPos = doc2.content.size - 1;
38354
- editor.commands?.setTextSelection?.(Math.max(1, endPos));
38714
+ const pos = Math.max(1, endPos);
38715
+ editor.commands?.setTextSelection?.({ from: pos, to: pos });
38355
38716
  }
38356
38717
  } catch (cursorError) {
38357
38718
  console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);