@harbour-enterprises/superdoc 1.0.0-beta.65 → 1.0.0-beta.66

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-CqHxrRM3.es.js → PdfViewer-BgQnzisJ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CPtbSOs5.cjs → PdfViewer-CpRzjNks.cjs} +1 -1
  3. package/dist/chunks/{index-YSWS94Jr-C7xFStTB.cjs → index-Bjv0_slj-CIZ6x5_a.cjs} +1 -1
  4. package/dist/chunks/{index-YSWS94Jr-BeHINTZ9.es.js → index-Bjv0_slj-aY5T6UA7.es.js} +1 -1
  5. package/dist/chunks/{index-DWJXw-IX.cjs → index-Bw7VVDLD.cjs} +3 -3
  6. package/dist/chunks/{index-BUvQNe-T.es.js → index-k63Akk_i.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-BHjskxiY.cjs → super-editor.es-CLrhh2DY.cjs} +290 -157
  8. package/dist/chunks/{super-editor.es-DaC-R5gx.es.js → super-editor.es-PQo0jrvJ.es.js} +290 -157
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DIAStmht.js → converter-Ybdn8aYC.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DK-wWQD9.js → docx-zipper-DkmZTQAw.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CxKPNxhs.js → editor-pqbWS9yU.js} +345 -95
  13. package/dist/super-editor/chunks/{index-YSWS94Jr.js → index-Bjv0_slj.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-D7ZHiSKZ.js → toolbar-CSzCVKWZ.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 +292 -159
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_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;
12
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_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, applyDomCorrectionToRects_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, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_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;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-DIAStmht.js";
16
- import { D as DocxZipper } from "./docx-zipper-DK-wWQD9.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as resolveRunProperties, at as encodeCSSFromPPr, au as twipsToPixels$2, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-Ybdn8aYC.js";
16
+ import { D as DocxZipper } from "./docx-zipper-DkmZTQAw.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -13923,7 +13923,7 @@ const isHeadless = (editor) => {
13923
13923
  const shouldSkipNodeView = (editor) => {
13924
13924
  return isHeadless(editor);
13925
13925
  };
13926
- const summaryVersion = "1.0.0-beta.65";
13926
+ const summaryVersion = "1.0.0-beta.66";
13927
13927
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13928
13928
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13929
13929
  function mapAttributes(attrs) {
@@ -14715,7 +14715,7 @@ const _Editor = class _Editor extends EventEmitter {
14715
14715
  { default: remarkStringify },
14716
14716
  { default: remarkGfm }
14717
14717
  ] = await Promise.all([
14718
- import("./index-YSWS94Jr.js"),
14718
+ import("./index-Bjv0_slj.js"),
14719
14719
  import("./index-DRCvimau.js"),
14720
14720
  import("./index-C_x_N6Uh.js"),
14721
14721
  import("./index-D_sWOSiG.js"),
@@ -14920,7 +14920,7 @@ const _Editor = class _Editor extends EventEmitter {
14920
14920
  * Process collaboration migrations
14921
14921
  */
14922
14922
  processCollaborationMigrations() {
14923
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.65");
14923
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.66");
14924
14924
  if (!this.options.ydoc) return;
14925
14925
  const metaMap = this.options.ydoc.getMap("meta");
14926
14926
  let docVersion = metaMap.get("version");
@@ -22513,6 +22513,7 @@ function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize
22513
22513
  let measurementCanvas = null;
22514
22514
  let measurementCtx = null;
22515
22515
  const TAB_CHAR_LENGTH = 1;
22516
+ const SPACE_CHARS = /* @__PURE__ */ new Set([" ", " "]);
22516
22517
  const isTabRun$1 = (run) => run?.kind === "tab";
22517
22518
  function getMeasurementContext() {
22518
22519
  if (measurementCtx) return measurementCtx;
@@ -22529,6 +22530,41 @@ function getMeasurementContext() {
22529
22530
  }
22530
22531
  return measurementCtx;
22531
22532
  }
22533
+ const countSpaces = (text) => {
22534
+ let spaces = 0;
22535
+ for (let i = 0; i < text.length; i += 1) {
22536
+ if (SPACE_CHARS.has(text[i])) {
22537
+ spaces += 1;
22538
+ }
22539
+ }
22540
+ return spaces;
22541
+ };
22542
+ const getJustifyAdjustment = (block, line, availableWidthOverride) => {
22543
+ if (block.kind !== "paragraph") {
22544
+ return { extraPerSpace: 0, totalSpaces: 0 };
22545
+ }
22546
+ const alignment = block.attrs?.alignment;
22547
+ const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
22548
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
22549
+ const slack = Math.max(0, availableWidth - line.width);
22550
+ if (alignment !== "justify" || hasExplicitPositioning || slack <= 0) {
22551
+ return { extraPerSpace: 0, totalSpaces: 0 };
22552
+ }
22553
+ const runs = sliceRunsForLine$1(block, line);
22554
+ const totalSpaces = runs.reduce((sum, run) => {
22555
+ if (isTabRun$1(run) || "src" in run || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation") {
22556
+ return sum;
22557
+ }
22558
+ return sum + countSpaces(run.text ?? "");
22559
+ }, 0);
22560
+ if (totalSpaces <= 0) {
22561
+ return { extraPerSpace: 0, totalSpaces: 0 };
22562
+ }
22563
+ return {
22564
+ extraPerSpace: slack / totalSpaces,
22565
+ totalSpaces
22566
+ };
22567
+ };
22532
22568
  function getRunFontString(run) {
22533
22569
  if (run.kind === "tab" || run.kind === "lineBreak" || run.kind === "break" || run.kind === "fieldAnnotation" || "src" in run) {
22534
22570
  return "normal normal 16px Arial";
@@ -22586,9 +22622,15 @@ function sliceRunsForLine$1(block, line) {
22586
22622
  }
22587
22623
  return result;
22588
22624
  }
22589
- function measureCharacterX(block, line, charOffset) {
22625
+ function measureCharacterX(block, line, charOffset, availableWidthOverride) {
22590
22626
  const ctx2 = getMeasurementContext();
22627
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: if no maxWidth, approximate available width as line width (no slack)
22628
+ line.width;
22629
+ const justify = getJustifyAdjustment(block, line, availableWidth);
22630
+ const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
22631
+ const alignment = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
22591
22632
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
22633
+ const alignmentOffset = !hasExplicitPositioning && alignment === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
22592
22634
  if (hasExplicitPositioning && line.segments && ctx2) {
22593
22635
  return measureCharacterXSegmentBased(block, line, charOffset, ctx2);
22594
22636
  }
@@ -22603,11 +22645,12 @@ function measureCharacterX(block, line, charOffset) {
22603
22645
  return sum + (run.text ?? "").length;
22604
22646
  }, 0)
22605
22647
  );
22606
- return charOffset / charsInLine * line.width;
22648
+ return charOffset / charsInLine * renderedLineWidth;
22607
22649
  }
22608
22650
  const runs = sliceRunsForLine$1(block, line);
22609
22651
  let currentX = 0;
22610
22652
  let currentCharOffset = 0;
22653
+ let spaceTally = 0;
22611
22654
  for (const run of runs) {
22612
22655
  if (isTabRun$1(run)) {
22613
22656
  const runLength2 = TAB_CHAR_LENGTH;
@@ -22628,14 +22671,18 @@ function measureCharacterX(block, line, charOffset) {
22628
22671
  const textUpToTarget = text.slice(0, offsetInRun);
22629
22672
  const measured2 = ctx2.measureText(textUpToTarget);
22630
22673
  const spacingWidth = computeLetterSpacingWidth(run, offsetInRun, runLength);
22631
- return currentX + measured2.width + spacingWidth;
22674
+ const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(textUpToTarget) : 0;
22675
+ return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
22632
22676
  }
22633
22677
  ctx2.font = getRunFontString(run);
22634
22678
  const measured = ctx2.measureText(text);
22635
- currentX += measured.width + computeLetterSpacingWidth(run, runLength, runLength);
22679
+ const runLetterSpacing = computeLetterSpacingWidth(run, runLength, runLength);
22680
+ const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text) : 0;
22681
+ currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
22682
+ spaceTally += spacesInRun;
22636
22683
  currentCharOffset += runLength;
22637
22684
  }
22638
- return currentX;
22685
+ return alignmentOffset + currentX;
22639
22686
  }
22640
22687
  function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
22641
22688
  if (block.kind !== "paragraph" || !line.segments) return 0;
@@ -22710,8 +22757,15 @@ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
22710
22757
  }
22711
22758
  return lastPm;
22712
22759
  }
22713
- function findCharacterAtX(block, line, x, pmStart) {
22760
+ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride) {
22714
22761
  const ctx2 = getMeasurementContext();
22762
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: approximate with line width when no maxWidth is present
22763
+ line.width;
22764
+ const justify = getJustifyAdjustment(block, line, availableWidth);
22765
+ const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
22766
+ const alignment = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
22767
+ const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
22768
+ const alignmentOffset = !hasExplicitPositioning && alignment === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
22715
22769
  if (!ctx2) {
22716
22770
  const runs2 = sliceRunsForLine$1(block, line);
22717
22771
  const charsInLine = Math.max(
@@ -22723,7 +22777,7 @@ function findCharacterAtX(block, line, x, pmStart) {
22723
22777
  return sum + (run.text ?? "").length;
22724
22778
  }, 0)
22725
22779
  );
22726
- const ratio = Math.max(0, Math.min(1, x / line.width));
22780
+ const ratio = Math.max(0, Math.min(1, (x - alignmentOffset) / renderedLineWidth));
22727
22781
  const charOffset = Math.round(ratio * charsInLine);
22728
22782
  const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
22729
22783
  return {
@@ -22732,9 +22786,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22732
22786
  };
22733
22787
  }
22734
22788
  const runs = sliceRunsForLine$1(block, line);
22735
- const safeX = Math.max(0, Math.min(line.width, x));
22789
+ const safeX = Math.max(0, Math.min(renderedLineWidth, x - alignmentOffset));
22736
22790
  let currentX = 0;
22737
22791
  let currentCharOffset = 0;
22792
+ let spaceTally = 0;
22738
22793
  for (const run of runs) {
22739
22794
  if (isTabRun$1(run)) {
22740
22795
  const tabWidth = run.width ?? 0;
@@ -22761,7 +22816,8 @@ function findCharacterAtX(block, line, x, pmStart) {
22761
22816
  for (let i = 0; i <= runLength; i++) {
22762
22817
  const textUpToChar = text.slice(0, i);
22763
22818
  const measured2 = ctx2.measureText(textUpToChar);
22764
- const charX = currentX + measured2.width + computeLetterSpacingWidth(run, i, runLength);
22819
+ const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(textUpToChar) : 0;
22820
+ const charX = currentX + measured2.width + computeLetterSpacingWidth(run, i, runLength) + justify.extraPerSpace * (spaceTally + spacesInPortion);
22765
22821
  if (charX >= safeX) {
22766
22822
  if (i === 0) {
22767
22823
  const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
@@ -22784,7 +22840,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22784
22840
  }
22785
22841
  }
22786
22842
  const measured = ctx2.measureText(text);
22787
- currentX += measured.width + computeLetterSpacingWidth(run, runLength, runLength);
22843
+ const runLetterSpacing = computeLetterSpacingWidth(run, runLength, runLength);
22844
+ const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text) : 0;
22845
+ currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
22846
+ spaceTally += spacesInRun;
22788
22847
  currentCharOffset += runLength;
22789
22848
  }
22790
22849
  const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
@@ -35401,7 +35460,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
35401
35460
  }
35402
35461
  const line = measure.lines[lineIndex];
35403
35462
  const isRTL = isRtlBlock(block);
35404
- const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL);
35463
+ const paraIndentLeft = block.attrs?.indent?.left ?? 0;
35464
+ const paraIndentRight = block.attrs?.indent?.right ?? 0;
35465
+ const availableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
35466
+ const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth);
35405
35467
  if (pos == null) {
35406
35468
  logClickStage("warn", "no-position", {
35407
35469
  blockId: fragment.blockId
@@ -35432,7 +35494,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
35432
35494
  if (lineIndex != null) {
35433
35495
  const line = cellMeasure.lines[lineIndex];
35434
35496
  const isRTL = isRtlBlock(cellBlock);
35435
- const pos = mapPointToPm(cellBlock, line, localX, isRTL);
35497
+ const paraIndentLeft = cellBlock.attrs?.indent?.left ?? 0;
35498
+ const paraIndentRight = cellBlock.attrs?.indent?.right ?? 0;
35499
+ const availableWidth = Math.max(0, tableHit.fragment.width - (paraIndentLeft + paraIndentRight));
35500
+ const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth);
35436
35501
  if (pos != null) {
35437
35502
  logClickStage("log", "success", {
35438
35503
  blockId: tableHit.fragment.blockId,
@@ -35591,7 +35656,15 @@ function selectionToRects(layout, blocks, measures, from2, to) {
35591
35656
  const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
35592
35657
  const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
35593
35658
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
35594
- const rectX = fragment.x + markerWidth + Math.min(startX, endX);
35659
+ const paraIndentLeft = block.attrs?.indent?.left ?? 0;
35660
+ const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
35661
+ const isFirstLine = index2 === fragment.fromLine;
35662
+ const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
35663
+ let indentAdjust = 0;
35664
+ if (!isListFirstLine) {
35665
+ indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
35666
+ }
35667
+ const rectX = fragment.x + markerWidth + indentAdjust + Math.min(startX, endX);
35595
35668
  const rectWidth = Math.max(1, Math.abs(endX - startX));
35596
35669
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
35597
35670
  const rectY = fragment.y + lineOffset;
@@ -35967,11 +36040,11 @@ const lineHeightBeforeIndex = (measure, absoluteLineIndex) => {
35967
36040
  }
35968
36041
  return height;
35969
36042
  };
35970
- const mapPointToPm = (block, line, x, isRTL) => {
36043
+ const mapPointToPm = (block, line, x, isRTL, availableWidthOverride) => {
35971
36044
  if (block.kind !== "paragraph") return null;
35972
36045
  const range = computeLinePmRange(block, line);
35973
36046
  if (range.pmStart == null || range.pmEnd == null) return null;
35974
- const result = findCharacterAtX(block, line, x, range.pmStart);
36047
+ const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride);
35975
36048
  if (isRTL) {
35976
36049
  const charOffset = result.charOffset;
35977
36050
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
@@ -35982,7 +36055,10 @@ const mapPointToPm = (block, line, x, isRTL) => {
35982
36055
  };
35983
36056
  const mapPmToX = (block, line, offset2, fragmentWidth) => {
35984
36057
  if (fragmentWidth <= 0 || line.width <= 0) return 0;
35985
- return measureCharacterX(block, line, offset2);
36058
+ const paraIndentLeft = block.kind === "paragraph" ? block.attrs?.indent?.left ?? 0 : 0;
36059
+ const paraIndentRight = block.kind === "paragraph" ? block.attrs?.indent?.right ?? 0 : 0;
36060
+ const availableWidth = Math.max(0, fragmentWidth - (paraIndentLeft + paraIndentRight));
36061
+ return measureCharacterX(block, line, offset2, availableWidth);
35986
36062
  };
35987
36063
  const isRtlBlock = (block) => {
35988
36064
  if (block.kind !== "paragraph") return false;
@@ -38729,40 +38805,31 @@ ensureEditorHost_fn = function(pageElement, kind, decorationContainer) {
38729
38805
  return editorHost;
38730
38806
  };
38731
38807
  /**
38732
- * Positions the editor host for header/footer editing.
38808
+ * Positions the editor host for header/footer editing using pure layout coordinates.
38809
+ *
38810
+ * This method uses ONLY layout-based coordinates from the region data, never
38811
+ * getBoundingClientRect(). This ensures overlays stay aligned with content even
38812
+ * when the editor is embedded in containers with CSS transforms, filters, or
38813
+ * complex positioning contexts.
38733
38814
  *
38734
- * When a decoration container exists, positions are derived from its bounds.
38735
- * When no decoration container exists (empty header/footer), positions are
38736
- * derived directly from the region data.
38815
+ * The transform: scale() on #viewportHost handles zoom, so we don't multiply
38816
+ * by zoom here - we use the raw layout coordinates directly.
38737
38817
  *
38738
38818
  * @param editorHost - The editor host element to position
38739
- * @param region - The header/footer region with dimension data
38819
+ * @param region - The header/footer region with dimension data from layout engine
38740
38820
  * @param decorationContainer - The decoration container (optional, may not exist for empty regions)
38741
- * @param zoom - Current zoom level
38821
+ * @param _zoom - Current zoom level (unused - zoom is handled by transform: scale())
38742
38822
  */
38743
- positionEditorHost_fn = function(editorHost, region, decorationContainer, zoom) {
38823
+ positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom) {
38744
38824
  const pageElement = editorHost.parentElement;
38745
38825
  if (!pageElement) {
38746
38826
  console.error("[EditorOverlayManager] Editor host has no parent element");
38747
38827
  return;
38748
38828
  }
38749
- let top2;
38750
- let left2;
38751
- let width;
38752
- let height;
38753
- if (decorationContainer) {
38754
- const decorationRect = decorationContainer.getBoundingClientRect();
38755
- const pageRect = pageElement.getBoundingClientRect();
38756
- top2 = decorationRect.top - pageRect.top;
38757
- left2 = decorationRect.left - pageRect.left;
38758
- width = decorationRect.width;
38759
- height = decorationRect.height;
38760
- } else {
38761
- top2 = region.localY * zoom;
38762
- left2 = region.localX * zoom;
38763
- width = region.width * zoom;
38764
- height = region.height * zoom;
38765
- }
38829
+ const top2 = decorationContainer?.offsetTop ?? region.localY;
38830
+ const left2 = decorationContainer?.offsetLeft ?? region.localX;
38831
+ const width = decorationContainer?.offsetWidth ?? region.width;
38832
+ const height = decorationContainer?.offsetHeight ?? region.height;
38766
38833
  Object.assign(editorHost.style, {
38767
38834
  top: `${top2}px`,
38768
38835
  left: `${left2}px`,
@@ -38791,20 +38858,17 @@ hideDimmingOverlay_fn = function() {
38791
38858
  /**
38792
38859
  * Shows a full-width border line at the bottom of the header or top of the footer.
38793
38860
  * This creates the MS Word style visual indicator spanning edge-to-edge of the page.
38861
+ *
38862
+ * Uses pure layout coordinates from region data to avoid coordinate system mixing.
38794
38863
  */
38795
- showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, zoom) {
38864
+ showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, _zoom) {
38796
38865
  __privateMethod(this, _EditorOverlayManager_instances, hideHeaderFooterBorder_fn).call(this);
38797
38866
  __privateSet(this, _borderLine, document.createElement("div"));
38798
38867
  __privateGet(this, _borderLine).className = "superdoc-header-footer-border";
38799
- let topPosition;
38800
38868
  const isHeader = region.kind === "header";
38801
- if (decorationContainer) {
38802
- const decorationRect = decorationContainer.getBoundingClientRect();
38803
- const pageRect = pageElement.getBoundingClientRect();
38804
- topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
38805
- } else {
38806
- topPosition = isHeader ? (region.localY + region.height) * zoom : region.localY * zoom;
38807
- }
38869
+ const decorationTop = decorationContainer?.offsetTop;
38870
+ const decorationHeight = decorationContainer?.offsetHeight;
38871
+ const topPosition = isHeader ? decorationTop != null && decorationHeight != null ? decorationTop + decorationHeight : region.localY + region.height : decorationTop ?? region.localY;
38808
38872
  Object.assign(__privateGet(this, _borderLine).style, {
38809
38873
  position: "absolute",
38810
38874
  left: "0",
@@ -39976,8 +40040,10 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
39976
40040
  const start2 = Math.min(from2, to);
39977
40041
  const end2 = Math.max(from2, to);
39978
40042
  const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
39979
- const overlayRect = __privateGet(this, _selectionOverlay2).getBoundingClientRect();
39980
40043
  const relativeRect = relativeTo?.getBoundingClientRect() ?? null;
40044
+ const containerRect = __privateGet(this, _visibleHost).getBoundingClientRect();
40045
+ const scrollLeft = __privateGet(this, _visibleHost).scrollLeft ?? 0;
40046
+ const scrollTop = __privateGet(this, _visibleHost).scrollTop ?? 0;
39981
40047
  const layoutRectSource = () => {
39982
40048
  if (__privateGet(this, _session).mode !== "body") {
39983
40049
  return __privateMethod(this, _PresentationEditor_instances, computeHeaderFooterSelectionRects_fn).call(this, start2, end2);
@@ -39988,14 +40054,38 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
39988
40054
  };
39989
40055
  const rawRects = layoutRectSource();
39990
40056
  if (!rawRects.length) return [];
40057
+ const domCaretStart = __privateMethod(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, start2);
40058
+ const domCaretEnd = __privateMethod(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, end2);
40059
+ const layoutCaretStart = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, start2, false);
40060
+ __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, end2, false);
40061
+ const pageDelta = {};
40062
+ if (domCaretStart && layoutCaretStart && domCaretStart.pageIndex === layoutCaretStart.pageIndex) {
40063
+ pageDelta[domCaretStart.pageIndex] = {
40064
+ dx: domCaretStart.x - layoutCaretStart.x,
40065
+ dy: domCaretStart.y - layoutCaretStart.y
40066
+ };
40067
+ }
39991
40068
  const pageHeight = __privateGet(this, _session).mode === "body" ? __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this) : __privateMethod(this, _PresentationEditor_instances, getHeaderFooterPageHeight_fn).call(this);
39992
40069
  const pageGap = __privateGet(this, _layoutState).layout?.pageGap ?? 0;
39993
- return rawRects.map((rect) => {
39994
- const pageLocalY = rect.y - rect.pageIndex * (pageHeight + pageGap);
39995
- const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
40070
+ const finalRects = rawRects.map((rect, idx, allRects) => {
40071
+ const delta = pageDelta[rect.pageIndex];
40072
+ let adjustedX = delta ? rect.x + delta.dx : rect.x;
40073
+ const adjustedY = delta ? rect.y + delta.dy : rect.y;
40074
+ const isFirstRect = idx === 0;
40075
+ const isLastRect = idx === allRects.length - 1;
40076
+ if (isFirstRect && domCaretStart && rect.pageIndex === domCaretStart.pageIndex) {
40077
+ adjustedX = domCaretStart.x;
40078
+ }
40079
+ if (isLastRect && domCaretEnd && rect.pageIndex === domCaretEnd.pageIndex) {
40080
+ const endX = domCaretEnd.x;
40081
+ const newWidth = Math.max(1, endX - adjustedX);
40082
+ rect = { ...rect, width: newWidth };
40083
+ }
40084
+ const pageLocalY = adjustedY - rect.pageIndex * (pageHeight + pageGap);
40085
+ const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, adjustedX, pageLocalY);
39996
40086
  if (!coords) return null;
39997
- const absLeft = coords.x * zoom + overlayRect.left;
39998
- const absTop = coords.y * zoom + overlayRect.top;
40087
+ const absLeft = coords.x * zoom - scrollLeft + containerRect.left;
40088
+ const absTop = coords.y * zoom - scrollTop + containerRect.top;
39999
40089
  const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
40000
40090
  const top2 = relativeRect ? absTop - relativeRect.top : absTop;
40001
40091
  const width = Math.max(1, rect.width * zoom);
@@ -40010,6 +40100,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
40010
40100
  height
40011
40101
  };
40012
40102
  }).filter((rect) => Boolean(rect));
40103
+ return finalRects;
40013
40104
  }
40014
40105
  /**
40015
40106
  * Get selection bounds for a document range with aggregated bounding box.
@@ -40238,24 +40329,22 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
40238
40329
  return null;
40239
40330
  }
40240
40331
  const rect2 = rects2[0];
40241
- const overlayRect = __privateGet(this, _selectionOverlay2)?.getBoundingClientRect();
40242
- if (!overlayRect) {
40243
- return null;
40244
- }
40332
+ const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
40333
+ const containerRect = __privateGet(this, _visibleHost).getBoundingClientRect();
40334
+ const scrollLeft = __privateGet(this, _visibleHost).scrollLeft ?? 0;
40335
+ const scrollTop = __privateGet(this, _visibleHost).scrollTop ?? 0;
40245
40336
  const pageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
40246
40337
  const pageGap = __privateGet(this, _layoutState).layout?.pageGap ?? 0;
40247
40338
  const pageLocalY = rect2.y - rect2.pageIndex * (pageHeight + pageGap);
40248
40339
  const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect2.pageIndex, rect2.x, pageLocalY);
40249
- if (!coords) {
40250
- return null;
40251
- }
40340
+ if (!coords) return null;
40252
40341
  return {
40253
- top: coords.y + overlayRect.top,
40254
- bottom: coords.y + overlayRect.top + rect2.height,
40255
- left: coords.x + overlayRect.left,
40256
- right: coords.x + overlayRect.left + rect2.width,
40257
- width: rect2.width,
40258
- height: rect2.height
40342
+ top: coords.y * zoom - scrollTop + containerRect.top,
40343
+ bottom: coords.y * zoom - scrollTop + containerRect.top + rect2.height * zoom,
40344
+ left: coords.x * zoom - scrollLeft + containerRect.left,
40345
+ right: coords.x * zoom - scrollLeft + containerRect.left + rect2.width * zoom,
40346
+ width: rect2.width * zoom,
40347
+ height: rect2.height * zoom
40259
40348
  };
40260
40349
  }
40261
40350
  const rects = this.getRangeRects(pos, pos);
@@ -41954,7 +42043,7 @@ updateSelection_fn = function() {
41954
42043
  }
41955
42044
  try {
41956
42045
  __privateGet(this, _localSelectionLayer).innerHTML = "";
41957
- __privateMethod(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout);
42046
+ __privateMethod(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout, from2);
41958
42047
  } catch (error) {
41959
42048
  if (process$1.env.NODE_ENV === "development") {
41960
42049
  console.warn("[PresentationEditor] Failed to render caret overlay:", error);
@@ -41963,9 +42052,12 @@ updateSelection_fn = function() {
41963
42052
  return;
41964
42053
  }
41965
42054
  const rects = selectionToRects(layout, __privateGet(this, _layoutState).blocks, __privateGet(this, _layoutState).measures, from2, to) ?? [];
42055
+ const domStart = __privateMethod(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, from2);
42056
+ const domEnd = __privateMethod(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, to);
42057
+ const correctedRects = __privateMethod(this, _PresentationEditor_instances, applyDomCorrectionToRects_fn).call(this, rects, domStart, domEnd);
41966
42058
  try {
41967
42059
  __privateGet(this, _localSelectionLayer).innerHTML = "";
41968
- __privateMethod(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, rects);
42060
+ __privateMethod(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, correctedRects);
41969
42061
  } catch (error) {
41970
42062
  if (process$1.env.NODE_ENV === "development") {
41971
42063
  console.warn("[PresentationEditor] Failed to render selection rects:", error);
@@ -42810,6 +42902,51 @@ getHeaderFooterPageHeight_fn = function() {
42810
42902
  }
42811
42903
  return context.layout.pageSize?.h ?? context.region.height ?? 1;
42812
42904
  };
42905
+ /**
42906
+ * Apply DOM-based position correction to layout-computed selection rectangles.
42907
+ * This ensures selection highlights align with actual rendered text positions.
42908
+ *
42909
+ * The layout engine calculates positions based on fragment geometry, but the painter
42910
+ * applies additional CSS (padding, text-indent, word-spacing for justify) that can
42911
+ * shift where text actually renders. This method corrects for that drift.
42912
+ */
42913
+ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
42914
+ if (rects.length === 0) return rects;
42915
+ const pageDelta = {};
42916
+ if (domStart && rects[0] && domStart.pageIndex === rects[0].pageIndex) {
42917
+ const pageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
42918
+ const pageGap = __privateGet(this, _layoutState).layout?.pageGap ?? 0;
42919
+ const layoutY = rects[0].y - rects[0].pageIndex * (pageHeight + pageGap);
42920
+ pageDelta[domStart.pageIndex] = {
42921
+ dx: domStart.x - rects[0].x,
42922
+ dy: domStart.y - layoutY
42923
+ };
42924
+ }
42925
+ return rects.map((rect, idx) => {
42926
+ const delta = pageDelta[rect.pageIndex];
42927
+ let adjustedX = delta ? rect.x + delta.dx : rect.x;
42928
+ let adjustedY = delta ? rect.y + delta.dy : rect.y;
42929
+ let adjustedWidth = rect.width;
42930
+ const isFirstRect = idx === 0;
42931
+ const isLastRect = idx === rects.length - 1;
42932
+ if (isFirstRect && domStart && rect.pageIndex === domStart.pageIndex) {
42933
+ const pageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
42934
+ const pageGap = __privateGet(this, _layoutState).layout?.pageGap ?? 0;
42935
+ adjustedX = domStart.x;
42936
+ adjustedY = domStart.y + rect.pageIndex * (pageHeight + pageGap);
42937
+ }
42938
+ if (isLastRect && domEnd && rect.pageIndex === domEnd.pageIndex) {
42939
+ const endX = domEnd.x;
42940
+ adjustedWidth = Math.max(1, endX - adjustedX);
42941
+ }
42942
+ return {
42943
+ ...rect,
42944
+ x: adjustedX,
42945
+ y: adjustedY,
42946
+ width: adjustedWidth
42947
+ };
42948
+ });
42949
+ };
42813
42950
  renderSelectionRects_fn = function(rects) {
42814
42951
  const localSelectionLayer = __privateGet(this, _localSelectionLayer);
42815
42952
  if (!localSelectionLayer) {
@@ -42817,7 +42954,7 @@ renderSelectionRects_fn = function(rects) {
42817
42954
  }
42818
42955
  const pageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
42819
42956
  const pageGap = __privateGet(this, _layoutState).layout?.pageGap ?? 0;
42820
- rects.forEach((rect, _index) => {
42957
+ rects.forEach((rect) => {
42821
42958
  const pageLocalY = rect.y - rect.pageIndex * (pageHeight + pageGap);
42822
42959
  const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
42823
42960
  if (!coords) {
@@ -42870,7 +43007,7 @@ clearHoverRegion_fn = function() {
42870
43007
  __privateGet(this, _hoverTooltip).style.display = "none";
42871
43008
  }
42872
43009
  };
42873
- renderCaretOverlay_fn = function(caretLayout) {
43010
+ renderCaretOverlay_fn = function(caretLayout, pos) {
42874
43011
  if (!__privateGet(this, _localSelectionLayer)) {
42875
43012
  return;
42876
43013
  }
@@ -43109,6 +43246,50 @@ convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY)
43109
43246
  y: pageIndex * (pageHeight + pageGap) + pageLocalY
43110
43247
  };
43111
43248
  };
43249
+ /**
43250
+ * Compute DOM-based caret position in page-local coordinates.
43251
+ * Returns null when DOM data is unavailable.
43252
+ */
43253
+ computeDomCaretPageLocal_fn = function(pos) {
43254
+ __privateGet(this, _viewportHost).querySelector(`.superdoc-page span[data-pm-start][data-pm-end]`) ? __privateGet(this, _viewportHost).querySelector(`.superdoc-page`) : null;
43255
+ const spans = Array.from(__privateGet(this, _viewportHost).querySelectorAll("span[data-pm-start][data-pm-end]"));
43256
+ let targetSpan = null;
43257
+ for (const span of spans) {
43258
+ const pmStart2 = Number(span.dataset.pmStart ?? "NaN");
43259
+ const pmEnd = Number(span.dataset.pmEnd ?? "NaN");
43260
+ if (!Number.isFinite(pmStart2) || !Number.isFinite(pmEnd)) continue;
43261
+ if (pos < pmStart2 || pos > pmEnd) continue;
43262
+ targetSpan = span;
43263
+ break;
43264
+ }
43265
+ if (!targetSpan) return null;
43266
+ const page = targetSpan.closest(".superdoc-page");
43267
+ if (!page) return null;
43268
+ const pageRect = page.getBoundingClientRect();
43269
+ const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
43270
+ const textNode = targetSpan.firstChild;
43271
+ if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
43272
+ const spanRect = targetSpan.getBoundingClientRect();
43273
+ return {
43274
+ pageIndex: Number(page.dataset.pageIndex ?? "0"),
43275
+ x: (spanRect.left - pageRect.left) / zoom,
43276
+ y: (spanRect.top - pageRect.top) / zoom
43277
+ };
43278
+ }
43279
+ const pmStart = Number(targetSpan.dataset.pmStart ?? "NaN");
43280
+ const charIndex = Math.min(pos - pmStart, textNode.length);
43281
+ const range = document.createRange();
43282
+ range.setStart(textNode, Math.max(0, charIndex));
43283
+ range.setEnd(textNode, Math.max(0, charIndex));
43284
+ const rangeRect = range.getBoundingClientRect();
43285
+ const lineEl = targetSpan.closest(".superdoc-line");
43286
+ const lineRect = lineEl?.getBoundingClientRect() ?? rangeRect;
43287
+ return {
43288
+ pageIndex: Number(page.dataset.pageIndex ?? "0"),
43289
+ x: (rangeRect.left - pageRect.left) / zoom,
43290
+ y: (lineRect.top - pageRect.top) / zoom
43291
+ };
43292
+ };
43112
43293
  normalizeClientPoint_fn = function(clientX, clientY) {
43113
43294
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
43114
43295
  return null;
@@ -43122,13 +43303,9 @@ normalizeClientPoint_fn = function(clientX, clientY) {
43122
43303
  y: (clientY - rect.top + scrollTop) / zoom
43123
43304
  };
43124
43305
  };
43125
- computeCaretLayoutRect_fn = function(pos) {
43306
+ computeCaretLayoutRectGeometry_fn = function(pos, includeDomFallback = true) {
43126
43307
  const layout = __privateGet(this, _layoutState).layout;
43127
43308
  if (!layout) return null;
43128
- const domResult = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRectFromDOM_fn).call(this, pos);
43129
- if (domResult) {
43130
- return domResult;
43131
- }
43132
43309
  const hit = getFragmentAtPosition(layout, __privateGet(this, _layoutState).blocks, __privateGet(this, _layoutState).measures, pos);
43133
43310
  if (!hit) {
43134
43311
  return null;
@@ -43150,27 +43327,93 @@ computeCaretLayoutRect_fn = function(pos) {
43150
43327
  const { line, index: index2 } = lineInfo;
43151
43328
  const range = computeLinePmRange(block, line);
43152
43329
  if (range.pmStart == null || range.pmEnd == null) return null;
43153
- const pmCharsInLine = Math.max(1, range.pmEnd - range.pmStart);
43154
- const pmOffset = Math.max(0, Math.min(pmCharsInLine, pos - range.pmStart));
43155
- const localX = fragment.x + measureCharacterX(block, line, pmOffset);
43330
+ const pmOffset = pmPosToCharOffset(block, line, pos);
43331
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
43332
+ const paraIndentLeft = block.attrs?.indent?.left ?? 0;
43333
+ const paraIndentRight = block.attrs?.indent?.right ?? 0;
43334
+ const availableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
43335
+ const charX = measureCharacterX(block, line, pmOffset, availableWidth);
43336
+ const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
43337
+ const isFirstLine = index2 === fragment.fromLine;
43338
+ const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
43339
+ let indentAdjust = 0;
43340
+ if (!isListFirstLine) {
43341
+ indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
43342
+ }
43343
+ const localX = fragment.x + markerWidth + indentAdjust + charX;
43156
43344
  const lineOffset = __privateMethod(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
43157
43345
  const localY = fragment.y + lineOffset;
43158
- return {
43346
+ const result = {
43159
43347
  pageIndex: hit.pageIndex,
43160
43348
  x: localX,
43161
43349
  y: localY,
43162
43350
  height: line.lineHeight
43163
43351
  };
43352
+ const pageEl = __privateGet(this, _painterHost)?.querySelector(
43353
+ `.superdoc-page[data-page-index="${hit.pageIndex}"]`
43354
+ );
43355
+ const pageRect = pageEl?.getBoundingClientRect();
43356
+ const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
43357
+ let domCaretX = null;
43358
+ let domCaretY = null;
43359
+ const spanEls = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
43360
+ for (const spanEl of spanEls) {
43361
+ const pmStart = Number(spanEl.dataset.pmStart);
43362
+ const pmEnd = Number(spanEl.dataset.pmEnd);
43363
+ if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
43364
+ const textNode = spanEl.firstChild;
43365
+ const charIndex = Math.min(pos - pmStart, textNode.length);
43366
+ const rangeObj = document.createRange();
43367
+ rangeObj.setStart(textNode, charIndex);
43368
+ rangeObj.setEnd(textNode, charIndex);
43369
+ const rangeRect = rangeObj.getBoundingClientRect();
43370
+ if (pageRect) {
43371
+ domCaretX = (rangeRect.left - pageRect.left) / zoom;
43372
+ domCaretY = (rangeRect.top - pageRect.top) / zoom;
43373
+ }
43374
+ break;
43375
+ }
43376
+ }
43377
+ if (includeDomFallback && domCaretX != null && domCaretY != null) {
43378
+ return {
43379
+ pageIndex: hit.pageIndex,
43380
+ x: domCaretX,
43381
+ y: domCaretY,
43382
+ height: line.lineHeight
43383
+ };
43384
+ }
43385
+ return result;
43386
+ };
43387
+ /**
43388
+ * Compute caret position, preferring DOM when available, falling back to geometry.
43389
+ */
43390
+ computeCaretLayoutRect_fn = function(pos) {
43391
+ const geometry = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, pos, true);
43392
+ const dom = __privateMethod(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, pos);
43393
+ if (dom && geometry) {
43394
+ return {
43395
+ pageIndex: dom.pageIndex,
43396
+ x: dom.x,
43397
+ y: dom.y,
43398
+ height: geometry.height
43399
+ };
43400
+ }
43401
+ return geometry;
43164
43402
  };
43165
43403
  /**
43166
- * Computes caret position using DOM-based positioning.
43167
- * This matches how click-to-position mapping works and correctly handles
43168
- * segment-based rendering with tab stops.
43404
+ * DEPRECATED: Computes caret position using DOM-based positioning.
43405
+ *
43406
+ * This method is NO LONGER USED as of the fix for overlay positioning with external transforms.
43407
+ * It uses getBoundingClientRect() which returns viewport coordinates affected by external
43408
+ * transforms, causing caret drift when SuperDoc is embedded in containers with CSS transforms.
43409
+ *
43410
+ * Kept for reference only. Use layout engine geometry instead (see #computeCaretLayoutRect).
43169
43411
  *
43170
- * Returns page-local coordinates (x, y relative to the page element).
43412
+ * @deprecated Use layout engine geometry directly - this method is incompatible with external transforms
43413
+ * @private
43171
43414
  */
43415
+ // eslint-disable-next-line no-unused-private-class-members
43172
43416
  computeCaretLayoutRectFromDOM_fn = function(pos) {
43173
- const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
43174
43417
  let targetPageEl = null;
43175
43418
  if (__privateGet(this, _layoutState).layout && __privateGet(this, _layoutState).blocks && __privateGet(this, _layoutState).measures) {
43176
43419
  const fragmentHit = getFragmentAtPosition(
@@ -43202,6 +43445,7 @@ computeCaretLayoutRectFromDOM_fn = function(pos) {
43202
43445
  if (!pageEl) continue;
43203
43446
  const pageIndex = Number(pageEl.dataset.pageIndex ?? "0");
43204
43447
  const pageRect = pageEl.getBoundingClientRect();
43448
+ const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
43205
43449
  const textNode = spanEl.firstChild;
43206
43450
  if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
43207
43451
  const spanRect2 = spanEl.getBoundingClientRect();
@@ -43254,9 +43498,15 @@ computeCaretLayoutRectFromDOM_fn = function(pos) {
43254
43498
  return null;
43255
43499
  };
43256
43500
  /**
43257
- * Computes caret position within a table cell using DOM-based positioning.
43258
- * This uses the actual rendered DOM elements to get accurate positions,
43259
- * matching how click-to-position mapping works.
43501
+ * DEPRECATED: Computes caret position within a table cell using DOM-based positioning.
43502
+ *
43503
+ * This method is NO LONGER USED as the parent #computeCaretLayoutRect now uses layout
43504
+ * engine geometry exclusively to avoid issues with external transforms.
43505
+ *
43506
+ * Kept for reference only.
43507
+ *
43508
+ * @deprecated Use layout engine geometry - this method is incompatible with external transforms
43509
+ * @private
43260
43510
  */
43261
43511
  computeTableCaretLayoutRect_fn = function(pos, _fragment, _tableBlock, _tableMeasure, pageIndex) {
43262
43512
  const lineEls = Array.from(__privateGet(this, _viewportHost).querySelectorAll(".superdoc-line"));