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
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BY9i51n2.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-BE9w4viZ.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BtTJyHJj.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-Wqm4Y9w9.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -40558,6 +40558,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40558
40558
  const { processedNodes } = preProcessNodesForFldChar(node2.elements ?? [], docx);
40559
40559
  node2.elements = processedNodes;
40560
40560
  const bodySectPr = node2.elements?.find((n) => n.name === "w:sectPr");
40561
+ const bodySectPrElements = bodySectPr?.elements ?? [];
40562
+ if (converter) {
40563
+ converter.importedBodyHasHeaderRef = bodySectPrElements.some((el) => el?.name === "w:headerReference");
40564
+ converter.importedBodyHasFooterRef = bodySectPrElements.some((el) => el?.name === "w:footerReference");
40565
+ }
40561
40566
  const contentElements = node2.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
40562
40567
  const content2 = pruneIgnoredNodes(contentElements);
40563
40568
  const comments = importCommentData({ docx, converter, editor });
@@ -41494,15 +41499,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41494
41499
  }
41495
41500
  sectPr = ensureSectionLayoutDefaults(sectPr, params2.converter);
41496
41501
  if (params2.converter) {
41502
+ const canExportHeaderRef = params2.converter.importedBodyHasHeaderRef || params2.converter.headerFooterModified;
41503
+ const canExportFooterRef = params2.converter.importedBodyHasFooterRef || params2.converter.headerFooterModified;
41497
41504
  const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
41498
41505
  const hasDefaultHeader = params2.converter.headerIds?.default;
41499
- if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter) {
41506
+ if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter && canExportHeaderRef) {
41500
41507
  const defaultHeader = generateDefaultHeaderFooter("header", params2.converter.headerIds?.default);
41501
41508
  sectPr.elements.push(defaultHeader);
41502
41509
  }
41503
41510
  const hasFooter = sectPr.elements?.some((n) => n.name === "w:footerReference");
41504
41511
  const hasDefaultFooter = params2.converter.footerIds?.default;
41505
- if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter) {
41512
+ if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter && canExportFooterRef) {
41506
41513
  const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
41507
41514
  sectPr.elements.push(defaultFooter);
41508
41515
  }
@@ -41729,24 +41736,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41729
41736
  const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
41730
41737
  tags.push(__privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent2));
41731
41738
  } else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
41732
- try {
41733
- let text2 = String(elements[0].text);
41739
+ if (elements.length === 0) {
41740
+ console.error(`${name} element has no child elements. Expected text node. Element will be self-closing.`);
41741
+ } else if (elements[0] == null || typeof elements[0].text !== "string") {
41742
+ console.error(
41743
+ `${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.`
41744
+ );
41745
+ tags.push("");
41746
+ } else {
41747
+ let text2 = elements[0].text.replace(/\[\[sdspace\]\]/g, "");
41734
41748
  text2 = __privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, text2);
41735
41749
  tags.push(text2);
41736
- } catch (error) {
41737
- console.error("Text element does not contain valid string:", error);
41738
41750
  }
41739
41751
  } else {
41740
41752
  if (elements) {
41741
41753
  for (let child of elements) {
41742
41754
  const newElements = __privateMethod$2(this, _DocxExporter_instances, generateXml_fn).call(this, child);
41743
- if (!newElements) continue;
41755
+ if (!newElements) {
41756
+ continue;
41757
+ }
41744
41758
  if (typeof newElements === "string") {
41745
41759
  tags.push(newElements);
41746
41760
  continue;
41747
41761
  }
41748
41762
  const removeUndefined = newElements.filter((el) => {
41749
- return el !== "<undefined>" && el !== "</undefined>";
41763
+ const isUndefined = el === "<undefined>" || el === "</undefined>";
41764
+ return !isUndefined;
41750
41765
  });
41751
41766
  tags.push(...removeUndefined);
41752
41767
  }
@@ -41937,7 +41952,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41937
41952
  return numericIds.length ? Math.max(...numericIds) : 0;
41938
41953
  };
41939
41954
  const mergeRelationshipElements = (existingRelationships = [], newRelationships = []) => {
41940
- if (!newRelationships?.length) return existingRelationships;
41955
+ if (!newRelationships?.length) {
41956
+ return existingRelationships;
41957
+ }
41941
41958
  let largestId = getLargestRelationshipId(existingRelationships);
41942
41959
  const seenIds = new Set(existingRelationships.map((rel) => rel?.attributes?.Id).filter(Boolean));
41943
41960
  for (const rel of newRelationships) {
@@ -41971,7 +41988,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41971
41988
  seenIds.add(attributes.Id);
41972
41989
  additions.push(rel);
41973
41990
  });
41974
- return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
41991
+ const result = additions.length ? [...existingRelationships, ...additions] : existingRelationships;
41992
+ return result;
41975
41993
  };
41976
41994
  const FONT_FAMILY_FALLBACKS$1 = Object.freeze({
41977
41995
  swiss: "Arial, sans-serif",
@@ -42044,6 +42062,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42044
42062
  this.footers = {};
42045
42063
  this.footerIds = { default: null, even: null, odd: null, first: null };
42046
42064
  this.footerEditors = [];
42065
+ this.importedBodyHasHeaderRef = false;
42066
+ this.importedBodyHasFooterRef = false;
42067
+ this.headerFooterModified = false;
42047
42068
  this.linkedStyles = [];
42048
42069
  this.json = params2?.json;
42049
42070
  this.tagsNotInSchema = ["w:body"];
@@ -42186,7 +42207,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42186
42207
  static getStoredSuperdocVersion(docx) {
42187
42208
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42188
42209
  }
42189
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.57") {
42210
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.58") {
42190
42211
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42191
42212
  }
42192
42213
  /**
@@ -42577,6 +42598,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42577
42598
  if (!this.headerIds.ids.includes(rId)) {
42578
42599
  this.headerIds.ids.push(rId);
42579
42600
  }
42601
+ this.headerFooterModified = true;
42580
42602
  this.documentModified = true;
42581
42603
  return rId;
42582
42604
  }
@@ -42630,6 +42652,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42630
42652
  if (!this.footerIds.ids.includes(rId)) {
42631
42653
  this.footerIds.ids.push(rId);
42632
42654
  }
42655
+ this.headerFooterModified = true;
42633
42656
  this.documentModified = true;
42634
42657
  return rId;
42635
42658
  }
@@ -53353,7 +53376,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53353
53376
  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);
53354
53377
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
53355
53378
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
53356
- 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;
53379
+ 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;
53357
53380
  var GOOD_LEAF_SIZE = 200;
53358
53381
  var RopeSequence = function RopeSequence2() {
53359
53382
  };
@@ -66834,7 +66857,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66834
66857
  }
66835
66858
  }
66836
66859
  if (targetMode.toLowerCase() !== "external" && !looksExternal(target)) {
66837
- const likelyPath = `word/${target.replace(/^\.?\//, "")}`;
66860
+ let likelyPath;
66861
+ if (target.startsWith("../")) {
66862
+ likelyPath = target.replace(/^\.\.\//, "");
66863
+ } else {
66864
+ likelyPath = `word/${target.replace(/^\.?\//, "")}`;
66865
+ }
66838
66866
  if (!(likelyPath in convertedXml)) {
66839
66867
  if (!isImageType(type2)) {
66840
66868
  results.push(`Removed relationship ${id} with missing target: ${target}`);
@@ -67225,7 +67253,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67225
67253
  const shouldSkipNodeView = (editor) => {
67226
67254
  return isHeadless(editor);
67227
67255
  };
67228
- const summaryVersion = "1.0.0-beta.57";
67256
+ const summaryVersion = "1.0.0-beta.58";
67229
67257
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67230
67258
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67231
67259
  function mapAttributes(attrs) {
@@ -68014,7 +68042,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68014
68042
  { default: remarkStringify2 },
68015
68043
  { default: remarkGfm2 }
68016
68044
  ] = await Promise.all([
68017
- Promise.resolve().then(() => indexD5IkZjf9),
68045
+ Promise.resolve().then(() => indexBWMksCRw),
68018
68046
  Promise.resolve().then(() => indexDRCvimau),
68019
68047
  Promise.resolve().then(() => indexC_x_N6Uh),
68020
68048
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68219,7 +68247,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68219
68247
  * Process collaboration migrations
68220
68248
  */
68221
68249
  processCollaborationMigrations() {
68222
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.57");
68250
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.58");
68223
68251
  if (!this.options.ydoc) return;
68224
68252
  const metaMap = this.options.ydoc.getMap("meta");
68225
68253
  let docVersion = metaMap.get("version");
@@ -83205,7 +83233,7 @@ ${l}
83205
83233
  sectionFooterIds: /* @__PURE__ */ new Map(),
83206
83234
  sectionTitlePg: /* @__PURE__ */ new Map()
83207
83235
  });
83208
- function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
83236
+ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2, converterIds) {
83209
83237
  const identifier = defaultMultiSectionIdentifier();
83210
83238
  identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
83211
83239
  identifier.sectionCount = sectionMetadata.length;
@@ -83240,6 +83268,18 @@ ${l}
83240
83268
  identifier.footerIds = { ...section0Footers };
83241
83269
  }
83242
83270
  identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
83271
+ if (converterIds?.headerIds) {
83272
+ identifier.headerIds.default = identifier.headerIds.default ?? converterIds.headerIds.default ?? null;
83273
+ identifier.headerIds.first = identifier.headerIds.first ?? converterIds.headerIds.first ?? null;
83274
+ identifier.headerIds.even = identifier.headerIds.even ?? converterIds.headerIds.even ?? null;
83275
+ identifier.headerIds.odd = identifier.headerIds.odd ?? converterIds.headerIds.odd ?? null;
83276
+ }
83277
+ if (converterIds?.footerIds) {
83278
+ identifier.footerIds.default = identifier.footerIds.default ?? converterIds.footerIds.default ?? null;
83279
+ identifier.footerIds.first = identifier.footerIds.first ?? converterIds.footerIds.first ?? null;
83280
+ identifier.footerIds.even = identifier.footerIds.even ?? converterIds.footerIds.even ?? null;
83281
+ identifier.footerIds.odd = identifier.footerIds.odd ?? converterIds.footerIds.odd ?? null;
83282
+ }
83243
83283
  return identifier;
83244
83284
  }
83245
83285
  function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
@@ -90206,6 +90246,9 @@ ${l}
90206
90246
  }
90207
90247
  mainEditor.converter[`${type2}s`][sectionId] = updatedData;
90208
90248
  mainEditor.setOptions({ isHeaderFooterChanged: editor.docChanged });
90249
+ if (editor.docChanged && mainEditor.converter) {
90250
+ mainEditor.converter.headerFooterModified = true;
90251
+ }
90209
90252
  await updateYdocDocxData(mainEditor);
90210
90253
  };
90211
90254
  const setEditorToolbar = ({ editor }, mainEditor) => {
@@ -90487,17 +90530,20 @@ ${l}
90487
90530
  * ```
90488
90531
  */
90489
90532
  getDocumentJson(descriptor) {
90490
- if (!descriptor?.id) return null;
90533
+ if (!descriptor?.id) {
90534
+ return null;
90535
+ }
90491
90536
  const liveEntry = __privateGet$1(this, _editorEntries).get(descriptor.id);
90492
90537
  if (liveEntry) {
90493
90538
  try {
90494
- const json = liveEntry.editor.getJSON?.();
90495
- return json;
90539
+ return liveEntry.editor.getJSON?.();
90496
90540
  } catch {
90497
90541
  }
90498
90542
  }
90499
90543
  const collections = __privateGet$1(this, _collections);
90500
- if (!collections) return null;
90544
+ if (!collections) {
90545
+ return null;
90546
+ }
90501
90547
  if (descriptor.kind === "header") {
90502
90548
  return collections.headers?.[descriptor.id] ?? null;
90503
90549
  }
@@ -90883,7 +90929,9 @@ ${l}
90883
90929
  */
90884
90930
  getBatch(kind) {
90885
90931
  const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
90886
- if (!descriptors.length) return void 0;
90932
+ if (!descriptors.length) {
90933
+ return void 0;
90934
+ }
90887
90935
  const batch2 = {};
90888
90936
  let hasBlocks = false;
90889
90937
  descriptors.forEach((descriptor) => {
@@ -91116,13 +91164,7 @@ ${l}
91116
91164
  showEditingOverlay(pageElement, region, zoom) {
91117
91165
  try {
91118
91166
  const decorationContainer = __privateMethod$1(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, region.kind);
91119
- if (!decorationContainer) {
91120
- return {
91121
- success: false,
91122
- reason: `Decoration container not found for ${region.kind} on page ${region.pageIndex}`
91123
- };
91124
- }
91125
- const editorHost = __privateMethod$1(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind);
91167
+ const editorHost = __privateMethod$1(this, _EditorOverlayManager_instances, ensureEditorHost_fn).call(this, pageElement, region.kind, decorationContainer);
91126
91168
  if (!editorHost) {
91127
91169
  return {
91128
91170
  success: false,
@@ -91130,7 +91172,9 @@ ${l}
91130
91172
  };
91131
91173
  }
91132
91174
  __privateMethod$1(this, _EditorOverlayManager_instances, positionEditorHost_fn).call(this, editorHost, region, decorationContainer, zoom);
91133
- decorationContainer.style.visibility = "hidden";
91175
+ if (decorationContainer) {
91176
+ decorationContainer.style.visibility = "hidden";
91177
+ }
91134
91178
  editorHost.style.visibility = "visible";
91135
91179
  editorHost.style.zIndex = EDITOR_HOST_Z_INDEX;
91136
91180
  if (region.kind === "footer") {
@@ -91142,7 +91186,7 @@ ${l}
91142
91186
  }
91143
91187
  }
91144
91188
  }
91145
- __privateMethod$1(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer);
91189
+ __privateMethod$1(this, _EditorOverlayManager_instances, showHeaderFooterBorder_fn).call(this, pageElement, region, decorationContainer, zoom);
91146
91190
  __privateSet(this, _activeEditorHost, editorHost);
91147
91191
  __privateSet(this, _activeDecorationContainer, decorationContainer);
91148
91192
  __privateSet(this, _activeRegion, region);
@@ -91260,7 +91304,7 @@ ${l}
91260
91304
  const className = kind === "header" ? "superdoc-page-header" : "superdoc-page-footer";
91261
91305
  return pageElement.querySelector(`.${className}`);
91262
91306
  };
91263
- ensureEditorHost_fn = function(pageElement, kind) {
91307
+ ensureEditorHost_fn = function(pageElement, kind, decorationContainer) {
91264
91308
  const className = kind === "header" ? "superdoc-header-editor-host" : "superdoc-footer-editor-host";
91265
91309
  let editorHost = pageElement.querySelector(`.${className}`);
91266
91310
  if (!editorHost) {
@@ -91275,34 +91319,44 @@ ${l}
91275
91319
  overflow: "hidden",
91276
91320
  boxSizing: "border-box"
91277
91321
  });
91278
- const decorationContainer = __privateMethod$1(this, _EditorOverlayManager_instances, findDecorationContainer_fn).call(this, pageElement, kind);
91279
- if (!decorationContainer) {
91280
- console.error(`[EditorOverlayManager] Decoration container not found for ${kind}`);
91281
- return null;
91322
+ if (decorationContainer) {
91323
+ decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
91324
+ } else {
91325
+ pageElement.appendChild(editorHost);
91282
91326
  }
91283
- decorationContainer.parentNode?.insertBefore(editorHost, decorationContainer.nextSibling);
91284
91327
  }
91285
91328
  return editorHost;
91286
91329
  };
91287
- positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom) {
91288
- const decorationRect = decorationContainer.getBoundingClientRect();
91330
+ positionEditorHost_fn = function(editorHost, region, decorationContainer, zoom) {
91289
91331
  const pageElement = editorHost.parentElement;
91290
91332
  if (!pageElement) {
91291
91333
  console.error("[EditorOverlayManager] Editor host has no parent element");
91292
91334
  return;
91293
91335
  }
91294
- const pageRect = pageElement.getBoundingClientRect();
91295
- const top2 = decorationRect.top - pageRect.top;
91296
- const left2 = decorationRect.left - pageRect.left;
91297
- const width = decorationRect.width;
91298
- const height = decorationRect.height;
91336
+ let top2;
91337
+ let left2;
91338
+ let width;
91339
+ let height;
91340
+ if (decorationContainer) {
91341
+ const decorationRect = decorationContainer.getBoundingClientRect();
91342
+ const pageRect = pageElement.getBoundingClientRect();
91343
+ top2 = decorationRect.top - pageRect.top;
91344
+ left2 = decorationRect.left - pageRect.left;
91345
+ width = decorationRect.width;
91346
+ height = decorationRect.height;
91347
+ } else {
91348
+ top2 = region.localY * zoom;
91349
+ left2 = region.localX * zoom;
91350
+ width = region.width * zoom;
91351
+ height = region.height * zoom;
91352
+ }
91299
91353
  Object.assign(editorHost.style, {
91300
91354
  top: `${top2}px`,
91301
91355
  left: `${left2}px`,
91302
91356
  width: `${width}px`,
91303
91357
  height: `${height}px`
91304
91358
  });
91305
- if (region.kind === "footer") {
91359
+ if (region.kind === "footer" && decorationContainer) {
91306
91360
  const fragment = decorationContainer.querySelector(".superdoc-fragment");
91307
91361
  if (fragment instanceof HTMLElement) {
91308
91362
  const fragmentTop = parseFloat(fragment.style.top) || 0;
@@ -91310,14 +91364,19 @@ ${l}
91310
91364
  }
91311
91365
  }
91312
91366
  };
91313
- showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer) {
91367
+ showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, zoom) {
91314
91368
  __privateMethod$1(this, _EditorOverlayManager_instances, hideHeaderFooterBorder_fn).call(this);
91315
91369
  __privateSet(this, _borderLine, document.createElement("div"));
91316
91370
  __privateGet$1(this, _borderLine).className = "superdoc-header-footer-border";
91317
- const decorationRect = decorationContainer.getBoundingClientRect();
91318
- const pageRect = pageElement.getBoundingClientRect();
91371
+ let topPosition;
91319
91372
  const isHeader = region.kind === "header";
91320
- const topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
91373
+ if (decorationContainer) {
91374
+ const decorationRect = decorationContainer.getBoundingClientRect();
91375
+ const pageRect = pageElement.getBoundingClientRect();
91376
+ topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
91377
+ } else {
91378
+ topPosition = isHeader ? (region.localY + region.height) * zoom : region.localY * zoom;
91379
+ }
91321
91380
  Object.assign(__privateGet$1(this, _borderLine).style, {
91322
91381
  position: "absolute",
91323
91382
  left: "0",
@@ -93923,7 +93982,10 @@ ${l}
93923
93982
  }
93924
93983
  __privateSet(this, _sectionMetadata, sectionMetadata);
93925
93984
  const converter = __privateGet$1(this, _editor3).converter;
93926
- __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
93985
+ __privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles, {
93986
+ headerIds: converter?.headerIds,
93987
+ footerIds: converter?.footerIds
93988
+ }));
93927
93989
  const anchorMap = __privateMethod$1(this, _PresentationEditor_instances, computeAnchorMap_fn).call(this, bookmarks, layout);
93928
93990
  __privateSet(this, _layoutState, { blocks: blocks2, measures, layout, bookmarks, anchorMap });
93929
93991
  __privateSet(this, _headerLayoutResults, headerLayouts ?? null);
@@ -94361,41 +94423,71 @@ ${l}
94361
94423
  return { x: left2, width, height, offset: offset2 };
94362
94424
  }
94363
94425
  };
94426
+ computeExpectedSectionType_fn = function(kind, page, sectionFirstPageNumbers) {
94427
+ const sectionIndex = page.sectionIndex ?? 0;
94428
+ const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
94429
+ const sectionPageNumber = typeof firstPageInSection === "number" ? page.number - firstPageInSection + 1 : page.number;
94430
+ const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
94431
+ const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier);
94432
+ let titlePgEnabled = false;
94433
+ let alternateHeaders = false;
94434
+ if (multiSectionId) {
94435
+ titlePgEnabled = multiSectionId.sectionTitlePg?.get(sectionIndex) ?? multiSectionId.titlePg;
94436
+ alternateHeaders = multiSectionId.alternateHeaders;
94437
+ } else if (legacyIdentifier) {
94438
+ titlePgEnabled = legacyIdentifier.titlePg;
94439
+ alternateHeaders = legacyIdentifier.alternateHeaders;
94440
+ }
94441
+ if (sectionPageNumber === 1 && titlePgEnabled) {
94442
+ return "first";
94443
+ }
94444
+ if (alternateHeaders) {
94445
+ return page.number % 2 === 0 ? "even" : "odd";
94446
+ }
94447
+ return "default";
94448
+ };
94364
94449
  rebuildHeaderFooterRegions_fn = function(layout) {
94365
94450
  __privateGet$1(this, _headerRegions).clear();
94366
94451
  __privateGet$1(this, _footerRegions).clear();
94367
94452
  const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
94368
94453
  if (pageHeight <= 0) return;
94454
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
94455
+ for (const p2 of layout.pages) {
94456
+ const idx = p2.sectionIndex ?? 0;
94457
+ if (!sectionFirstPageNumbers.has(idx)) {
94458
+ sectionFirstPageNumbers.set(idx, p2.number);
94459
+ }
94460
+ }
94369
94461
  layout.pages.forEach((page, pageIndex) => {
94370
94462
  var _a2, _b2;
94371
- const headerPayload = (_a2 = __privateGet$1(this, _headerDecorationProvider)) == null ? void 0 : _a2.call(this, page.number, page.margins, page);
94372
- if (headerPayload?.hitRegion) {
94373
- __privateGet$1(this, _headerRegions).set(pageIndex, {
94374
- kind: "header",
94375
- headerId: headerPayload.headerId,
94376
- sectionType: headerPayload.sectionType,
94377
- pageIndex,
94378
- pageNumber: page.number,
94379
- localX: headerPayload.hitRegion.x ?? 0,
94380
- localY: headerPayload.hitRegion.y ?? 0,
94381
- width: headerPayload.hitRegion.width ?? headerPayload.box?.width ?? 0,
94382
- height: headerPayload.hitRegion.height ?? headerPayload.box?.height ?? 0
94383
- });
94384
- }
94385
- const footerPayload = (_b2 = __privateGet$1(this, _footerDecorationProvider)) == null ? void 0 : _b2.call(this, page.number, page.margins, page);
94386
- if (footerPayload?.hitRegion) {
94387
- __privateGet$1(this, _footerRegions).set(pageIndex, {
94388
- kind: "footer",
94389
- headerId: footerPayload.headerId,
94390
- sectionType: footerPayload.sectionType,
94391
- pageIndex,
94392
- pageNumber: page.number,
94393
- localX: footerPayload.hitRegion.x ?? 0,
94394
- localY: footerPayload.hitRegion.y ?? 0,
94395
- width: footerPayload.hitRegion.width ?? footerPayload.box?.width ?? 0,
94396
- height: footerPayload.hitRegion.height ?? footerPayload.box?.height ?? 0
94397
- });
94398
- }
94463
+ const margins = page.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
94464
+ const actualPageHeight = page.size?.h ?? pageHeight;
94465
+ const headerPayload = (_a2 = __privateGet$1(this, _headerDecorationProvider)) == null ? void 0 : _a2.call(this, page.number, margins, page);
94466
+ const headerBox = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "header", margins, actualPageHeight);
94467
+ __privateGet$1(this, _headerRegions).set(pageIndex, {
94468
+ kind: "header",
94469
+ headerId: headerPayload?.headerId,
94470
+ sectionType: headerPayload?.sectionType ?? __privateMethod$1(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "header", page, sectionFirstPageNumbers),
94471
+ pageIndex,
94472
+ pageNumber: page.number,
94473
+ localX: headerPayload?.hitRegion?.x ?? headerBox.x,
94474
+ localY: headerPayload?.hitRegion?.y ?? headerBox.offset,
94475
+ width: headerPayload?.hitRegion?.width ?? headerBox.width,
94476
+ height: headerPayload?.hitRegion?.height ?? headerBox.height
94477
+ });
94478
+ const footerPayload = (_b2 = __privateGet$1(this, _footerDecorationProvider)) == null ? void 0 : _b2.call(this, page.number, margins, page);
94479
+ const footerBox = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, "footer", margins, actualPageHeight);
94480
+ __privateGet$1(this, _footerRegions).set(pageIndex, {
94481
+ kind: "footer",
94482
+ headerId: footerPayload?.headerId,
94483
+ sectionType: footerPayload?.sectionType ?? __privateMethod$1(this, _PresentationEditor_instances, computeExpectedSectionType_fn).call(this, "footer", page, sectionFirstPageNumbers),
94484
+ pageIndex,
94485
+ pageNumber: page.number,
94486
+ localX: footerPayload?.hitRegion?.x ?? footerBox.x,
94487
+ localY: footerPayload?.hitRegion?.y ?? footerBox.offset,
94488
+ width: footerPayload?.hitRegion?.width ?? footerBox.width,
94489
+ height: footerPayload?.hitRegion?.height ?? footerBox.height
94490
+ });
94399
94491
  });
94400
94492
  };
94401
94493
  hitTestHeaderFooterRegion_fn = function(x2, y2) {
@@ -94585,6 +94677,7 @@ ${l}
94585
94677
  };
94586
94678
  exitHeaderFooterMode_fn = function() {
94587
94679
  if (__privateGet$1(this, _session).mode === "body") return;
94680
+ const editedHeaderId = __privateGet$1(this, _session).headerId;
94588
94681
  if (__privateGet$1(this, _activeHeaderFooterEditor)) {
94589
94682
  __privateGet$1(this, _activeHeaderFooterEditor).setEditable(false);
94590
94683
  __privateGet$1(this, _activeHeaderFooterEditor).setOptions({ documentMode: "viewing" });
@@ -94596,6 +94689,12 @@ ${l}
94596
94689
  __privateMethod$1(this, _PresentationEditor_instances, emitHeaderFooterModeChanged_fn).call(this);
94597
94690
  __privateMethod$1(this, _PresentationEditor_instances, emitHeaderFooterEditingContext_fn).call(this, __privateGet$1(this, _editor3));
94598
94691
  __privateGet$1(this, _inputBridge)?.notifyTargetChanged();
94692
+ if (editedHeaderId) {
94693
+ __privateGet$1(this, _headerFooterAdapter)?.invalidate(editedHeaderId);
94694
+ }
94695
+ __privateGet$1(this, _headerFooterManager)?.refresh();
94696
+ __privateSet(this, _pendingDocChange, true);
94697
+ __privateMethod$1(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
94599
94698
  __privateGet$1(this, _editor3).view?.focus();
94600
94699
  };
94601
94700
  getActiveDomTarget_fn = function() {
@@ -94691,29 +94790,15 @@ ${l}
94691
94790
  createDefaultHeaderFooter_fn = function(region) {
94692
94791
  const converter = __privateGet$1(this, _editor3).converter;
94693
94792
  if (!converter) {
94694
- console.error("[PresentationEditor] Converter not available for creating header/footer");
94695
94793
  return;
94696
94794
  }
94697
94795
  const variant = region.sectionType ?? "default";
94698
- try {
94699
- if (region.kind === "header") {
94700
- if (typeof converter.createDefaultHeader === "function") {
94701
- const headerId = converter.createDefaultHeader(variant);
94702
- console.log(`[PresentationEditor] Created default header: ${headerId}`);
94703
- } else {
94704
- console.error("[PresentationEditor] converter.createDefaultHeader is not a function");
94705
- }
94706
- } else if (region.kind === "footer") {
94707
- if (typeof converter.createDefaultFooter === "function") {
94708
- const footerId = converter.createDefaultFooter(variant);
94709
- console.log(`[PresentationEditor] Created default footer: ${footerId}`);
94710
- } else {
94711
- console.error("[PresentationEditor] converter.createDefaultFooter is not a function");
94712
- }
94713
- }
94714
- } catch (error) {
94715
- console.error("[PresentationEditor] Failed to create default header/footer:", error);
94796
+ if (region.kind === "header" && typeof converter.createDefaultHeader === "function") {
94797
+ converter.createDefaultHeader(variant);
94798
+ } else if (region.kind === "footer" && typeof converter.createDefaultFooter === "function") {
94799
+ converter.createDefaultFooter(variant);
94716
94800
  }
94801
+ __privateSet(this, _headerFooterIdentifier, extractIdentifierFromConverter(converter));
94717
94802
  };
94718
94803
  getPageElement_fn = function(pageIndex) {
94719
94804
  if (!__privateGet$1(this, _painterHost)) return null;
@@ -149064,7 +149149,7 @@ ${style2}
149064
149149
  this.config.colors = shuffleArray(this.config.colors);
149065
149150
  this.userColorMap = /* @__PURE__ */ new Map();
149066
149151
  this.colorIndex = 0;
149067
- this.version = "1.0.0-beta.57";
149152
+ this.version = "1.0.0-beta.58";
149068
149153
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
149069
149154
  this.superdocId = config2.superdocId || v4();
149070
149155
  this.colors = this.config.colors;
@@ -151530,7 +151615,7 @@ ${style2}
151530
151615
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
151531
151616
  );
151532
151617
  }
151533
- const indexD5IkZjf9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
151618
+ const indexBWMksCRw = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
151534
151619
  __proto__: null,
151535
151620
  unified
151536
151621
  }, Symbol.toStringTag, { value: "Module" }));