@harbour-enterprises/superdoc 1.0.0-beta.57 → 1.0.0-beta.58

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-BpJ5YJmq.es.js → PdfViewer-BOtq_Mxx.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DvAhx37Y.cjs → PdfViewer-CPNlFudP.cjs} +1 -1
  3. package/dist/chunks/{index-D5IkZjf9-CPmfOXHq.es.js → index-BWMksCRw-BE_kaq_r.es.js} +1 -1
  4. package/dist/chunks/{index-D5IkZjf9-XnnWMFi7.cjs → index-BWMksCRw-BtY5hIaC.cjs} +1 -1
  5. package/dist/chunks/{index-BE9w4viZ.es.js → index-Wqm4Y9w9.es.js} +3 -3
  6. package/dist/chunks/{index-BbXDEDIW.cjs → index-yDP_DAl6.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-BY9i51n2.es.js → super-editor.es-BtTJyHJj.es.js} +182 -97
  8. package/dist/chunks/{super-editor.es-BjELk3Xl.cjs → super-editor.es-DsUuY-Pt.cjs} +182 -97
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Aoe_RSZD.js → converter-w1IY5-V-.js} +70 -11
  11. package/dist/super-editor/chunks/{docx-zipper-Ct68kitw.js → docx-zipper-B7-XHg8m.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-Dfqm3VkC.js → editor-CiTfe7Wr.js} +183 -96
  13. package/dist/super-editor/chunks/{index-D5IkZjf9.js → index-BWMksCRw.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-Dj_HCM6i.js → toolbar-yy1NR024.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 +184 -99
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -40540,6 +40540,11 @@ const createDocumentJson = (docx, converter, editor) => {
40540
40540
  const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
40541
40541
  node.elements = processedNodes;
40542
40542
  const bodySectPr = node.elements?.find((n) => n.name === "w:sectPr");
40543
+ const bodySectPrElements = bodySectPr?.elements ?? [];
40544
+ if (converter) {
40545
+ converter.importedBodyHasHeaderRef = bodySectPrElements.some((el) => el?.name === "w:headerReference");
40546
+ converter.importedBodyHasFooterRef = bodySectPrElements.some((el) => el?.name === "w:footerReference");
40547
+ }
40543
40548
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
40544
40549
  const content = pruneIgnoredNodes(contentElements);
40545
40550
  const comments = importCommentData({ docx, converter, editor });
@@ -41476,15 +41481,17 @@ function translateBodyNode(params2) {
41476
41481
  }
41477
41482
  sectPr = ensureSectionLayoutDefaults(sectPr, params2.converter);
41478
41483
  if (params2.converter) {
41484
+ const canExportHeaderRef = params2.converter.importedBodyHasHeaderRef || params2.converter.headerFooterModified;
41485
+ const canExportFooterRef = params2.converter.importedBodyHasFooterRef || params2.converter.headerFooterModified;
41479
41486
  const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
41480
41487
  const hasDefaultHeader = params2.converter.headerIds?.default;
41481
- if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter) {
41488
+ if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter && canExportHeaderRef) {
41482
41489
  const defaultHeader = generateDefaultHeaderFooter("header", params2.converter.headerIds?.default);
41483
41490
  sectPr.elements.push(defaultHeader);
41484
41491
  }
41485
41492
  const hasFooter = sectPr.elements?.some((n) => n.name === "w:footerReference");
41486
41493
  const hasDefaultFooter = params2.converter.footerIds?.default;
41487
- if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter) {
41494
+ if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter && canExportFooterRef) {
41488
41495
  const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
41489
41496
  sectPr.elements.push(defaultFooter);
41490
41497
  }
@@ -41711,24 +41718,32 @@ generateXml_fn = function(node) {
41711
41718
  const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
41712
41719
  tags.push(__privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent2));
41713
41720
  } else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
41714
- try {
41715
- let text = String(elements[0].text);
41721
+ if (elements.length === 0) {
41722
+ console.error(`${name} element has no child elements. Expected text node. Element will be self-closing.`);
41723
+ } else if (elements[0] == null || typeof elements[0].text !== "string") {
41724
+ console.error(
41725
+ `${name} element's first child is missing or does not have a valid text property. Received: ${JSON.stringify(elements[0])}. Pushing empty string to maintain XML structure.`
41726
+ );
41727
+ tags.push("");
41728
+ } else {
41729
+ let text = elements[0].text.replace(/\[\[sdspace\]\]/g, "");
41716
41730
  text = __privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, text);
41717
41731
  tags.push(text);
41718
- } catch (error) {
41719
- console.error("Text element does not contain valid string:", error);
41720
41732
  }
41721
41733
  } else {
41722
41734
  if (elements) {
41723
41735
  for (let child of elements) {
41724
41736
  const newElements = __privateMethod$2(this, _DocxExporter_instances, generateXml_fn).call(this, child);
41725
- if (!newElements) continue;
41737
+ if (!newElements) {
41738
+ continue;
41739
+ }
41726
41740
  if (typeof newElements === "string") {
41727
41741
  tags.push(newElements);
41728
41742
  continue;
41729
41743
  }
41730
41744
  const removeUndefined = newElements.filter((el) => {
41731
- return el !== "<undefined>" && el !== "</undefined>";
41745
+ const isUndefined = el === "<undefined>" || el === "</undefined>";
41746
+ return !isUndefined;
41732
41747
  });
41733
41748
  tags.push(...removeUndefined);
41734
41749
  }
@@ -41919,7 +41934,9 @@ const getLargestRelationshipId = (relationships = []) => {
41919
41934
  return numericIds.length ? Math.max(...numericIds) : 0;
41920
41935
  };
41921
41936
  const mergeRelationshipElements = (existingRelationships = [], newRelationships = []) => {
41922
- if (!newRelationships?.length) return existingRelationships;
41937
+ if (!newRelationships?.length) {
41938
+ return existingRelationships;
41939
+ }
41923
41940
  let largestId = getLargestRelationshipId(existingRelationships);
41924
41941
  const seenIds = new Set(existingRelationships.map((rel) => rel?.attributes?.Id).filter(Boolean));
41925
41942
  for (const rel of newRelationships) {
@@ -41953,7 +41970,8 @@ const mergeRelationshipElements = (existingRelationships = [], newRelationships
41953
41970
  seenIds.add(attributes.Id);
41954
41971
  additions.push(rel);
41955
41972
  });
41956
- return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
41973
+ const result = additions.length ? [...existingRelationships, ...additions] : existingRelationships;
41974
+ return result;
41957
41975
  };
41958
41976
  const FONT_FAMILY_FALLBACKS$1 = Object.freeze({
41959
41977
  swiss: "Arial, sans-serif",
@@ -42026,6 +42044,9 @@ const _SuperConverter = class _SuperConverter2 {
42026
42044
  this.footers = {};
42027
42045
  this.footerIds = { default: null, even: null, odd: null, first: null };
42028
42046
  this.footerEditors = [];
42047
+ this.importedBodyHasHeaderRef = false;
42048
+ this.importedBodyHasFooterRef = false;
42049
+ this.headerFooterModified = false;
42029
42050
  this.linkedStyles = [];
42030
42051
  this.json = params2?.json;
42031
42052
  this.tagsNotInSchema = ["w:body"];
@@ -42168,7 +42189,7 @@ const _SuperConverter = class _SuperConverter2 {
42168
42189
  static getStoredSuperdocVersion(docx) {
42169
42190
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42170
42191
  }
42171
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.57") {
42192
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.58") {
42172
42193
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42173
42194
  }
42174
42195
  /**
@@ -42559,6 +42580,7 @@ const _SuperConverter = class _SuperConverter2 {
42559
42580
  if (!this.headerIds.ids.includes(rId)) {
42560
42581
  this.headerIds.ids.push(rId);
42561
42582
  }
42583
+ this.headerFooterModified = true;
42562
42584
  this.documentModified = true;
42563
42585
  return rId;
42564
42586
  }
@@ -42612,6 +42634,7 @@ const _SuperConverter = class _SuperConverter2 {
42612
42634
  if (!this.footerIds.ids.includes(rId)) {
42613
42635
  this.footerIds.ids.push(rId);
42614
42636
  }
42637
+ this.headerFooterModified = true;
42615
42638
  this.documentModified = true;
42616
42639
  return rId;
42617
42640
  }
@@ -45478,7 +45501,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
45478
45501
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
45479
45502
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
45480
45503
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
45481
- 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, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _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, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _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, computeAnchorMap_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, _isEditable, _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;
45504
+ 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, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _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, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _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, computeExpectedSectionType_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, computeAnchorMap_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, _isEditable, _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;
45482
45505
  var GOOD_LEAF_SIZE = 200;
45483
45506
  var RopeSequence = function RopeSequence2() {
45484
45507
  };
@@ -58959,7 +58982,12 @@ function processRelationships(root2, convertedXml, results) {
58959
58982
  }
58960
58983
  }
58961
58984
  if (targetMode.toLowerCase() !== "external" && !looksExternal(target)) {
58962
- const likelyPath = `word/${target.replace(/^\.?\//, "")}`;
58985
+ let likelyPath;
58986
+ if (target.startsWith("../")) {
58987
+ likelyPath = target.replace(/^\.\.\//, "");
58988
+ } else {
58989
+ likelyPath = `word/${target.replace(/^\.?\//, "")}`;
58990
+ }
58963
58991
  if (!(likelyPath in convertedXml)) {
58964
58992
  if (!isImageType(type2)) {
58965
58993
  results.push(`Removed relationship ${id} with missing target: ${target}`);
@@ -59350,7 +59378,7 @@ const isHeadless = (editor) => {
59350
59378
  const shouldSkipNodeView = (editor) => {
59351
59379
  return isHeadless(editor);
59352
59380
  };
59353
- const summaryVersion = "1.0.0-beta.57";
59381
+ const summaryVersion = "1.0.0-beta.58";
59354
59382
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59355
59383
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59356
59384
  function mapAttributes(attrs) {
@@ -60139,7 +60167,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60139
60167
  { default: remarkStringify },
60140
60168
  { default: remarkGfm }
60141
60169
  ] = await Promise.all([
60142
- import("./index-D5IkZjf9-CPmfOXHq.es.js"),
60170
+ import("./index-BWMksCRw-BE_kaq_r.es.js"),
60143
60171
  import("./index-DRCvimau-Cw339678.es.js"),
60144
60172
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60145
60173
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60344,7 +60372,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60344
60372
  * Process collaboration migrations
60345
60373
  */
60346
60374
  processCollaborationMigrations() {
60347
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.57");
60375
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.58");
60348
60376
  if (!this.options.ydoc) return;
60349
60377
  const metaMap = this.options.ydoc.getMap("meta");
60350
60378
  let docVersion = metaMap.get("version");
@@ -75330,7 +75358,7 @@ const defaultMultiSectionIdentifier = () => ({
75330
75358
  sectionFooterIds: /* @__PURE__ */ new Map(),
75331
75359
  sectionTitlePg: /* @__PURE__ */ new Map()
75332
75360
  });
75333
- function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
75361
+ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2, converterIds) {
75334
75362
  const identifier = defaultMultiSectionIdentifier();
75335
75363
  identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
75336
75364
  identifier.sectionCount = sectionMetadata.length;
@@ -75365,6 +75393,18 @@ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
75365
75393
  identifier.footerIds = { ...section0Footers };
75366
75394
  }
75367
75395
  identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
75396
+ if (converterIds?.headerIds) {
75397
+ identifier.headerIds.default = identifier.headerIds.default ?? converterIds.headerIds.default ?? null;
75398
+ identifier.headerIds.first = identifier.headerIds.first ?? converterIds.headerIds.first ?? null;
75399
+ identifier.headerIds.even = identifier.headerIds.even ?? converterIds.headerIds.even ?? null;
75400
+ identifier.headerIds.odd = identifier.headerIds.odd ?? converterIds.headerIds.odd ?? null;
75401
+ }
75402
+ if (converterIds?.footerIds) {
75403
+ identifier.footerIds.default = identifier.footerIds.default ?? converterIds.footerIds.default ?? null;
75404
+ identifier.footerIds.first = identifier.footerIds.first ?? converterIds.footerIds.first ?? null;
75405
+ identifier.footerIds.even = identifier.footerIds.even ?? converterIds.footerIds.even ?? null;
75406
+ identifier.footerIds.odd = identifier.footerIds.odd ?? converterIds.footerIds.odd ?? null;
75407
+ }
75368
75408
  return identifier;
75369
75409
  }
75370
75410
  function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
@@ -82331,6 +82371,9 @@ const onHeaderFooterDataUpdate = async ({ editor, transaction }, mainEditor, sec
82331
82371
  }
82332
82372
  mainEditor.converter[`${type2}s`][sectionId] = updatedData;
82333
82373
  mainEditor.setOptions({ isHeaderFooterChanged: editor.docChanged });
82374
+ if (editor.docChanged && mainEditor.converter) {
82375
+ mainEditor.converter.headerFooterModified = true;
82376
+ }
82334
82377
  await updateYdocDocxData(mainEditor);
82335
82378
  };
82336
82379
  const setEditorToolbar = ({ editor }, mainEditor) => {
@@ -82612,17 +82655,20 @@ class HeaderFooterEditorManager extends EventEmitter$1 {
82612
82655
  * ```
82613
82656
  */
82614
82657
  getDocumentJson(descriptor) {
82615
- if (!descriptor?.id) return null;
82658
+ if (!descriptor?.id) {
82659
+ return null;
82660
+ }
82616
82661
  const liveEntry = __privateGet$1(this, _editorEntries).get(descriptor.id);
82617
82662
  if (liveEntry) {
82618
82663
  try {
82619
- const json = liveEntry.editor.getJSON?.();
82620
- return json;
82664
+ return liveEntry.editor.getJSON?.();
82621
82665
  } catch {
82622
82666
  }
82623
82667
  }
82624
82668
  const collections = __privateGet$1(this, _collections);
82625
- if (!collections) return null;
82669
+ if (!collections) {
82670
+ return null;
82671
+ }
82626
82672
  if (descriptor.kind === "header") {
82627
82673
  return collections.headers?.[descriptor.id] ?? null;
82628
82674
  }
@@ -83008,7 +83054,9 @@ class HeaderFooterLayoutAdapter {
83008
83054
  */
83009
83055
  getBatch(kind) {
83010
83056
  const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
83011
- if (!descriptors.length) return void 0;
83057
+ if (!descriptors.length) {
83058
+ return void 0;
83059
+ }
83012
83060
  const batch = {};
83013
83061
  let hasBlocks = false;
83014
83062
  descriptors.forEach((descriptor) => {
@@ -83241,13 +83289,7 @@ class EditorOverlayManager {
83241
83289
  showEditingOverlay(pageElement, region, zoom) {
83242
83290
  try {
83243
83291
  const decorationContainer = __privateMethod$1(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, region.kind);
83244
- if (!decorationContainer) {
83245
- return {
83246
- success: false,
83247
- reason: `Decoration container not found for ${region.kind} on page ${region.pageIndex}`
83248
- };
83249
- }
83250
- const editorHost = __privateMethod$1(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind);
83292
+ const editorHost = __privateMethod$1(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind, decorationContainer);
83251
83293
  if (!editorHost) {
83252
83294
  return {
83253
83295
  success: false,
@@ -83255,7 +83297,9 @@ class EditorOverlayManager {
83255
83297
  };
83256
83298
  }
83257
83299
  __privateMethod$1(this, _EditorOverlayManager_instances, positionEditorHost_fn).call(this, editorHost, region, decorationContainer, zoom);
83258
- decorationContainer.style.visibility = "hidden";
83300
+ if (decorationContainer) {
83301
+ decorationContainer.style.visibility = "hidden";
83302
+ }
83259
83303
  editorHost.style.visibility = "visible";
83260
83304
  editorHost.style.zIndex = EDITOR_HOST_Z_INDEX;
83261
83305
  if (region.kind === "footer") {
@@ -83267,7 +83311,7 @@ class EditorOverlayManager {
83267
83311
  }
83268
83312
  }
83269
83313
  }
83270
- __privateMethod$1(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer);
83314
+ __privateMethod$1(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer, zoom);
83271
83315
  __privateSet(this, _activeEditorHost, editorHost);
83272
83316
  __privateSet(this, _activeDecorationContainer, decorationContainer);
83273
83317
  __privateSet(this, _activeRegion, region);
@@ -83385,7 +83429,7 @@ findDecorationContainer_fn = function(pageElement, kind) {
83385
83429
  const className = kind === "header" ? "superdoc-page-header" : "superdoc-page-footer";
83386
83430
  return pageElement.querySelector(`.${className}`);
83387
83431
  };
83388
- ensureEditorHost_fn = function(pageElement, kind) {
83432
+ ensureEditorHost_fn = function(pageElement, kind, decorationContainer) {
83389
83433
  const className = kind === "header" ? "superdoc-header-editor-host" : "superdoc-footer-editor-host";
83390
83434
  let editorHost = pageElement.querySelector(`.${className}`);
83391
83435
  if (!editorHost) {
@@ -83400,34 +83444,44 @@ ensureEditorHost_fn = function(pageElement, kind) {
83400
83444
  overflow: "hidden",
83401
83445
  boxSizing: "border-box"
83402
83446
  });
83403
- const decorationContainer = __privateMethod$1(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, kind);
83404
- if (!decorationContainer) {
83405
- console.error(`[EditorOverlayManager] Decoration container not found for ${kind}`);
83406
- return null;
83447
+ if (decorationContainer) {
83448
+ decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
83449
+ } else {
83450
+ pageElement.appendChild(editorHost);
83407
83451
  }
83408
- decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
83409
83452
  }
83410
83453
  return editorHost;
83411
83454
  };
83412
- positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom) {
83413
- const decorationRect = decorationContainer.getBoundingClientRect();
83455
+ positionEditorHost_fn = function(editorHost, region, decorationContainer, zoom) {
83414
83456
  const pageElement = editorHost.parentElement;
83415
83457
  if (!pageElement) {
83416
83458
  console.error("[EditorOverlayManager] Editor host has no parent element");
83417
83459
  return;
83418
83460
  }
83419
- const pageRect = pageElement.getBoundingClientRect();
83420
- const top2 = decorationRect.top - pageRect.top;
83421
- const left2 = decorationRect.left - pageRect.left;
83422
- const width = decorationRect.width;
83423
- const height = decorationRect.height;
83461
+ let top2;
83462
+ let left2;
83463
+ let width;
83464
+ let height;
83465
+ if (decorationContainer) {
83466
+ const decorationRect = decorationContainer.getBoundingClientRect();
83467
+ const pageRect = pageElement.getBoundingClientRect();
83468
+ top2 = decorationRect.top - pageRect.top;
83469
+ left2 = decorationRect.left - pageRect.left;
83470
+ width = decorationRect.width;
83471
+ height = decorationRect.height;
83472
+ } else {
83473
+ top2 = region.localY * zoom;
83474
+ left2 = region.localX * zoom;
83475
+ width = region.width * zoom;
83476
+ height = region.height * zoom;
83477
+ }
83424
83478
  Object.assign(editorHost.style, {
83425
83479
  top: `${top2}px`,
83426
83480
  left: `${left2}px`,
83427
83481
  width: `${width}px`,
83428
83482
  height: `${height}px`
83429
83483
  });
83430
- if (region.kind === "footer") {
83484
+ if (region.kind === "footer" && decorationContainer) {
83431
83485
  const fragment = decorationContainer.querySelector(".superdoc-fragment");
83432
83486
  if (fragment instanceof HTMLElement) {
83433
83487
  const fragmentTop = parseFloat(fragment.style.top) || 0;
@@ -83435,14 +83489,19 @@ positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom)
83435
83489
  }
83436
83490
  }
83437
83491
  };
83438
- showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer) {
83492
+ showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, zoom) {
83439
83493
  __privateMethod$1(this, _EditorOverlayManager_instances, hideHeaderFooterBorder_fn).call(this);
83440
83494
  __privateSet(this, _borderLine, document.createElement("div"));
83441
83495
  __privateGet$1(this, _borderLine).className = "superdoc-header-footer-border";
83442
- const decorationRect = decorationContainer.getBoundingClientRect();
83443
- const pageRect = pageElement.getBoundingClientRect();
83496
+ let topPosition;
83444
83497
  const isHeader = region.kind === "header";
83445
- const topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
83498
+ if (decorationContainer) {
83499
+ const decorationRect = decorationContainer.getBoundingClientRect();
83500
+ const pageRect = pageElement.getBoundingClientRect();
83501
+ topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
83502
+ } else {
83503
+ topPosition = isHeader ? (region.localY + region.height) * zoom : region.localY * zoom;
83504
+ }
83446
83505
  Object.assign(__privateGet$1(this, _borderLine).style, {
83447
83506
  position: "absolute",
83448
83507
  left: "0",
@@ -86048,7 +86107,10 @@ rerender_fn = async function() {
86048
86107
  }
86049
86108
  __privateSet(this, _sectionMetadata, sectionMetadata);
86050
86109
  const converter = __privateGet$1(this, _editor3).converter;
86051
- __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
86110
+ __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles, {
86111
+ headerIds: converter?.headerIds,
86112
+ footerIds: converter?.footerIds
86113
+ }));
86052
86114
  const anchorMap = __privateMethod$1(this, _PresentationEditor_instances, computeAnchorMap_fn).call(this, bookmarks, layout);
86053
86115
  __privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
86054
86116
  __privateSet(this, _headerLayoutResults, headerLayouts ?? null);
@@ -86486,41 +86548,71 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
86486
86548
  return { x: left2, width, height, offset: offset2 };
86487
86549
  }
86488
86550
  };
86551
+ computeExpectedSectionType_fn = function(kind, page, sectionFirstPageNumbers) {
86552
+ const sectionIndex = page.sectionIndex ?? 0;
86553
+ const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
86554
+ const sectionPageNumber = typeof firstPageInSection === "number" ? page.number - firstPageInSection + 1 : page.number;
86555
+ const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
86556
+ const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier);
86557
+ let titlePgEnabled = false;
86558
+ let alternateHeaders = false;
86559
+ if (multiSectionId) {
86560
+ titlePgEnabled = multiSectionId.sectionTitlePg?.get(sectionIndex) ?? multiSectionId.titlePg;
86561
+ alternateHeaders = multiSectionId.alternateHeaders;
86562
+ } else if (legacyIdentifier) {
86563
+ titlePgEnabled = legacyIdentifier.titlePg;
86564
+ alternateHeaders = legacyIdentifier.alternateHeaders;
86565
+ }
86566
+ if (sectionPageNumber === 1 && titlePgEnabled) {
86567
+ return "first";
86568
+ }
86569
+ if (alternateHeaders) {
86570
+ return page.number % 2 === 0 ? "even" : "odd";
86571
+ }
86572
+ return "default";
86573
+ };
86489
86574
  rebuildHeaderFooterRegions_fn = function(layout) {
86490
86575
  __privateGet$1(this, _headerRegions).clear();
86491
86576
  __privateGet$1(this, _footerRegions).clear();
86492
86577
  const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
86493
86578
  if (pageHeight <= 0) return;
86579
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
86580
+ for (const p of layout.pages) {
86581
+ const idx = p.sectionIndex ?? 0;
86582
+ if (!sectionFirstPageNumbers.has(idx)) {
86583
+ sectionFirstPageNumbers.set(idx, p.number);
86584
+ }
86585
+ }
86494
86586
  layout.pages.forEach((page, pageIndex) => {
86495
86587
  var _a2, _b2;
86496
- const headerPayload = (_a2 = __privateGet$1(this, _headerDecorationProvider)) == null ? void 0 : _a2.call(this, page.number, page.margins, page);
86497
- if (headerPayload?.hitRegion) {
86498
- __privateGet$1(this, _headerRegions).set(pageIndex, {
86499
- kind: "header",
86500
- headerId: headerPayload.headerId,
86501
- sectionType: headerPayload.sectionType,
86502
- pageIndex,
86503
- pageNumber: page.number,
86504
- localX: headerPayload.hitRegion.x ?? 0,
86505
- localY: headerPayload.hitRegion.y ?? 0,
86506
- width: headerPayload.hitRegion.width ?? headerPayload.box?.width ?? 0,
86507
- height: headerPayload.hitRegion.height ?? headerPayload.box?.height ?? 0
86508
- });
86509
- }
86510
- const footerPayload = (_b2 = __privateGet$1(this, _footerDecorationProvider)) == null ? void 0 : _b2.call(this, page.number, page.margins, page);
86511
- if (footerPayload?.hitRegion) {
86512
- __privateGet$1(this, _footerRegions).set(pageIndex, {
86513
- kind: "footer",
86514
- headerId: footerPayload.headerId,
86515
- sectionType: footerPayload.sectionType,
86516
- pageIndex,
86517
- pageNumber: page.number,
86518
- localX: footerPayload.hitRegion.x ?? 0,
86519
- localY: footerPayload.hitRegion.y ?? 0,
86520
- width: footerPayload.hitRegion.width ?? footerPayload.box?.width ?? 0,
86521
- height: footerPayload.hitRegion.height ?? footerPayload.box?.height ?? 0
86522
- });
86523
- }
86588
+ const margins = page.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
86589
+ const actualPageHeight = page.size?.h ?? pageHeight;
86590
+ const headerPayload = (_a2 = __privateGet$1(this, _headerDecorationProvider)) == null ? void 0 : _a2.call(this, page.number, margins, page);
86591
+ const headerBox = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "header", margins, actualPageHeight);
86592
+ __privateGet$1(this, _headerRegions).set(pageIndex, {
86593
+ kind: "header",
86594
+ headerId: headerPayload?.headerId,
86595
+ sectionType: headerPayload?.sectionType ?? __privateMethod$1(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "header", page, sectionFirstPageNumbers),
86596
+ pageIndex,
86597
+ pageNumber: page.number,
86598
+ localX: headerPayload?.hitRegion?.x ?? headerBox.x,
86599
+ localY: headerPayload?.hitRegion?.y ?? headerBox.offset,
86600
+ width: headerPayload?.hitRegion?.width ?? headerBox.width,
86601
+ height: headerPayload?.hitRegion?.height ?? headerBox.height
86602
+ });
86603
+ const footerPayload = (_b2 = __privateGet$1(this, _footerDecorationProvider)) == null ? void 0 : _b2.call(this, page.number, margins, page);
86604
+ const footerBox = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "footer", margins, actualPageHeight);
86605
+ __privateGet$1(this, _footerRegions).set(pageIndex, {
86606
+ kind: "footer",
86607
+ headerId: footerPayload?.headerId,
86608
+ sectionType: footerPayload?.sectionType ?? __privateMethod$1(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "footer", page, sectionFirstPageNumbers),
86609
+ pageIndex,
86610
+ pageNumber: page.number,
86611
+ localX: footerPayload?.hitRegion?.x ?? footerBox.x,
86612
+ localY: footerPayload?.hitRegion?.y ?? footerBox.offset,
86613
+ width: footerPayload?.hitRegion?.width ?? footerBox.width,
86614
+ height: footerPayload?.hitRegion?.height ?? footerBox.height
86615
+ });
86524
86616
  });
86525
86617
  };
86526
86618
  hitTestHeaderFooterRegion_fn = function(x2, y2) {
@@ -86710,6 +86802,7 @@ enterHeaderFooterMode_fn = async function(region) {
86710
86802
  };
86711
86803
  exitHeaderFooterMode_fn = function() {
86712
86804
  if (__privateGet$1(this, _session).mode === "body") return;
86805
+ const editedHeaderId = __privateGet$1(this, _session).headerId;
86713
86806
  if (__privateGet$1(this, _activeHeaderFooterEditor)) {
86714
86807
  __privateGet$1(this, _activeHeaderFooterEditor).setEditable(false);
86715
86808
  __privateGet$1(this, _activeHeaderFooterEditor).setOptions({ documentMode: "viewing" });
@@ -86721,6 +86814,12 @@ exitHeaderFooterMode_fn = function() {
86721
86814
  __privateMethod$1(this, _PresentationEditor_instances, emitHeaderFooterModeChanged_fn).call(this);
86722
86815
  __privateMethod$1(this, _PresentationEditor_instances, emitHeaderFooterEditingContext_fn).call(this, __privateGet$1(this, _editor3));
86723
86816
  __privateGet$1(this, _inputBridge)?.notifyTargetChanged();
86817
+ if (editedHeaderId) {
86818
+ __privateGet$1(this, _headerFooterAdapter)?.invalidate(editedHeaderId);
86819
+ }
86820
+ __privateGet$1(this, _headerFooterManager)?.refresh();
86821
+ __privateSet(this, _pendingDocChange, true);
86822
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
86724
86823
  __privateGet$1(this, _editor3).view?.focus();
86725
86824
  };
86726
86825
  getActiveDomTarget_fn = function() {
@@ -86816,29 +86915,15 @@ resolveDescriptorForRegion_fn = function(region) {
86816
86915
  createDefaultHeaderFooter_fn = function(region) {
86817
86916
  const converter = __privateGet$1(this, _editor3).converter;
86818
86917
  if (!converter) {
86819
- console.error("[PresentationEditor] Converter not available for creating header/footer");
86820
86918
  return;
86821
86919
  }
86822
86920
  const variant = region.sectionType ?? "default";
86823
- try {
86824
- if (region.kind === "header") {
86825
- if (typeof converter.createDefaultHeader === "function") {
86826
- const headerId = converter.createDefaultHeader(variant);
86827
- console.log(`[PresentationEditor] Created default header: ${headerId}`);
86828
- } else {
86829
- console.error("[PresentationEditor] converter.createDefaultHeader is not a function");
86830
- }
86831
- } else if (region.kind === "footer") {
86832
- if (typeof converter.createDefaultFooter === "function") {
86833
- const footerId = converter.createDefaultFooter(variant);
86834
- console.log(`[PresentationEditor] Created default footer: ${footerId}`);
86835
- } else {
86836
- console.error("[PresentationEditor] converter.createDefaultFooter is not a function");
86837
- }
86838
- }
86839
- } catch (error) {
86840
- console.error("[PresentationEditor] Failed to create default header/footer:", error);
86921
+ if (region.kind === "header" && typeof converter.createDefaultHeader === "function") {
86922
+ converter.createDefaultHeader(variant);
86923
+ } else if (region.kind === "footer" && typeof converter.createDefaultFooter === "function") {
86924
+ converter.createDefaultFooter(variant);
86841
86925
  }
86926
+ __privateSet(this, _headerFooterIdentifier, extractIdentifierFromConverter(converter));
86842
86927
  };
86843
86928
  getPageElement_fn = function(pageIndex) {
86844
86929
  if (!__privateGet$1(this, _painterHost)) return null;