@harbour-enterprises/superdoc 1.8.1-next.3 → 1.8.2-next.1

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.
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-0lz82cmH.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-CLZ8o__p.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -15778,7 +15778,7 @@ const canUseDOM = () => {
15778
15778
  return false;
15779
15779
  }
15780
15780
  };
15781
- const summaryVersion = "1.8.1-next.3";
15781
+ const summaryVersion = "1.8.2-next.1";
15782
15782
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15783
15783
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15784
15784
  function mapAttributes(attrs) {
@@ -18501,7 +18501,7 @@ class Editor extends EventEmitter {
18501
18501
  * Process collaboration migrations
18502
18502
  */
18503
18503
  processCollaborationMigrations() {
18504
- console.debug("[checkVersionMigrations] Current editor version", "1.8.1-next.3");
18504
+ console.debug("[checkVersionMigrations] Current editor version", "1.8.2-next.1");
18505
18505
  if (!this.options.ydoc) return;
18506
18506
  const metaMap = this.options.ydoc.getMap("meta");
18507
18507
  let docVersion = metaMap.get("version");
@@ -34370,22 +34370,26 @@ function applyTocMetadata(blocks, metadata) {
34370
34370
  }
34371
34371
  });
34372
34372
  }
34373
- function processTocChildren(children, metadata, context, outputArrays, paragraphConverter) {
34373
+ function processTocChildren(children, metadata, context, outputArrays) {
34374
+ const paragraphConverter = context.converters.paragraphToFlowBlocks;
34374
34375
  const { docPartGallery, docPartObjectId, tocInstruction } = metadata;
34375
34376
  const { blocks, recordBlockKind } = outputArrays;
34376
34377
  children.forEach((child) => {
34377
34378
  if (child.type === "paragraph") {
34378
- const paragraphBlocks = paragraphConverter(
34379
- child,
34380
- context.nextBlockId,
34381
- context.positions,
34382
- context.defaultFont,
34383
- context.defaultSize,
34384
- context.styleContext,
34385
- context.trackedChanges,
34386
- context.bookmarks,
34387
- context.hyperlinkConfig
34388
- );
34379
+ const paragraphBlocks = paragraphConverter({
34380
+ para: child,
34381
+ nextBlockId: context.nextBlockId,
34382
+ positions: context.positions,
34383
+ defaultFont: context.defaultFont,
34384
+ defaultSize: context.defaultSize,
34385
+ styleContext: context.styleContext,
34386
+ trackedChangesConfig: context.trackedChangesConfig,
34387
+ bookmarks: context.bookmarks,
34388
+ hyperlinkConfig: context.hyperlinkConfig,
34389
+ converters: context.converters,
34390
+ enableComments: context.enableComments,
34391
+ converterContext: context.converterContext
34392
+ });
34389
34393
  applyTocMetadata(paragraphBlocks, {
34390
34394
  gallery: docPartGallery,
34391
34395
  uniqueId: docPartObjectId,
@@ -34406,8 +34410,7 @@ function processTocChildren(children, metadata, context, outputArrays, paragraph
34406
34410
  child.content,
34407
34411
  { docPartGallery, docPartObjectId, tocInstruction: finalInstruction, sdtMetadata: metadata.sdtMetadata },
34408
34412
  context,
34409
- outputArrays,
34410
- paragraphConverter
34413
+ outputArrays
34411
34414
  );
34412
34415
  }
34413
34416
  });
@@ -34425,17 +34428,17 @@ function handleTableOfContentsNode(node, context) {
34425
34428
  trackedChangesConfig,
34426
34429
  bookmarks,
34427
34430
  hyperlinkConfig,
34428
- converters
34431
+ converters: converters2,
34432
+ converterContext,
34433
+ themeColors,
34434
+ enableComments
34429
34435
  } = context;
34430
34436
  const tocInstruction = getNodeInstruction(node);
34431
- const paragraphToFlowBlocks2 = converters?.paragraphToFlowBlocks;
34432
- if (!paragraphToFlowBlocks2) {
34433
- return;
34434
- }
34437
+ const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
34435
34438
  node.content.forEach((child) => {
34436
34439
  if (child.type === "paragraph") {
34437
- const paragraphBlocks = paragraphToFlowBlocks2(
34438
- child,
34440
+ const paragraphBlocks = paragraphToFlowBlocks2({
34441
+ para: child,
34439
34442
  nextBlockId,
34440
34443
  positions,
34441
34444
  defaultFont,
@@ -34443,8 +34446,12 @@ function handleTableOfContentsNode(node, context) {
34443
34446
  styleContext,
34444
34447
  trackedChangesConfig,
34445
34448
  bookmarks,
34446
- hyperlinkConfig
34447
- );
34449
+ themeColors,
34450
+ hyperlinkConfig,
34451
+ converters: converters2,
34452
+ enableComments,
34453
+ converterContext
34454
+ });
34448
34455
  paragraphBlocks.forEach((block) => {
34449
34456
  if (block.kind === "paragraph") {
34450
34457
  if (!block.attrs) block.attrs = {};
@@ -34484,12 +34491,11 @@ function handleIndexNode(node, context) {
34484
34491
  bookmarks,
34485
34492
  hyperlinkConfig,
34486
34493
  sectionState,
34487
- converters
34494
+ converters: converters2,
34495
+ themeColors,
34496
+ enableComments
34488
34497
  } = context;
34489
- const paragraphToFlowBlocks2 = converters?.paragraphToFlowBlocks;
34490
- if (!paragraphToFlowBlocks2) {
34491
- return;
34492
- }
34498
+ const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
34493
34499
  children.forEach((child) => {
34494
34500
  if (child.type !== "paragraph") {
34495
34501
  return;
@@ -34506,8 +34512,8 @@ function handleIndexNode(node, context) {
34506
34512
  sectionState.currentSectionIndex++;
34507
34513
  }
34508
34514
  }
34509
- const paragraphBlocks = paragraphToFlowBlocks2(
34510
- child,
34515
+ const paragraphBlocks = paragraphToFlowBlocks2({
34516
+ para: child,
34511
34517
  nextBlockId,
34512
34518
  positions,
34513
34519
  defaultFont,
@@ -34516,10 +34522,11 @@ function handleIndexNode(node, context) {
34516
34522
  trackedChangesConfig,
34517
34523
  bookmarks,
34518
34524
  hyperlinkConfig,
34519
- void 0,
34520
- // themeColors - not available in NodeHandlerContext
34521
- context.converterContext
34522
- );
34525
+ themeColors,
34526
+ converterContext: context.converterContext,
34527
+ enableComments,
34528
+ converters: converters2
34529
+ });
34523
34530
  paragraphBlocks.forEach((block) => {
34524
34531
  blocks.push(block);
34525
34532
  recordBlockKind(block.kind);
@@ -34540,17 +34547,17 @@ function handleStructuredContentBlockNode(node, context) {
34540
34547
  trackedChangesConfig,
34541
34548
  bookmarks,
34542
34549
  hyperlinkConfig,
34543
- converters
34550
+ converters: converters2,
34551
+ converterContext,
34552
+ enableComments,
34553
+ themeColors
34544
34554
  } = context;
34545
34555
  const structuredContentMetadata = resolveNodeSdtMetadata(node, "structuredContentBlock");
34546
- const paragraphToFlowBlocks2 = converters?.paragraphToFlowBlocks;
34547
- if (!paragraphToFlowBlocks2) {
34548
- return;
34549
- }
34556
+ const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
34550
34557
  node.content.forEach((child) => {
34551
34558
  if (child.type === "paragraph") {
34552
- const paragraphBlocks = paragraphToFlowBlocks2(
34553
- child,
34559
+ const paragraphBlocks = paragraphToFlowBlocks2({
34560
+ para: child,
34554
34561
  nextBlockId,
34555
34562
  positions,
34556
34563
  defaultFont,
@@ -34558,8 +34565,12 @@ function handleStructuredContentBlockNode(node, context) {
34558
34565
  styleContext,
34559
34566
  trackedChangesConfig,
34560
34567
  bookmarks,
34561
- hyperlinkConfig
34562
- );
34568
+ hyperlinkConfig,
34569
+ themeColors,
34570
+ enableComments,
34571
+ converters: converters2,
34572
+ converterContext
34573
+ });
34563
34574
  applySdtMetadataToParagraphBlocks(
34564
34575
  paragraphBlocks.filter((b2) => b2.kind === "paragraph"),
34565
34576
  structuredContentMetadata
@@ -34569,10 +34580,10 @@ function handleStructuredContentBlockNode(node, context) {
34569
34580
  recordBlockKind(block.kind);
34570
34581
  });
34571
34582
  } else if (child.type === "table") {
34572
- const tableNodeToBlock2 = converters?.tableNodeToBlock;
34583
+ const tableNodeToBlock2 = converters2?.tableNodeToBlock;
34573
34584
  if (tableNodeToBlock2) {
34574
- const tableBlock = tableNodeToBlock2(
34575
- child,
34585
+ const tableBlock = tableNodeToBlock2({
34586
+ node: child,
34576
34587
  nextBlockId,
34577
34588
  positions,
34578
34589
  defaultFont,
@@ -34580,8 +34591,12 @@ function handleStructuredContentBlockNode(node, context) {
34580
34591
  styleContext,
34581
34592
  trackedChangesConfig,
34582
34593
  bookmarks,
34583
- hyperlinkConfig
34584
- );
34594
+ hyperlinkConfig,
34595
+ themeColors,
34596
+ enableComments,
34597
+ converters: converters2,
34598
+ converterContext
34599
+ });
34585
34600
  if (tableBlock) {
34586
34601
  applySdtMetadataToTableBlock(tableBlock, structuredContentMetadata);
34587
34602
  blocks.push(tableBlock);
@@ -34591,19 +34606,22 @@ function handleStructuredContentBlockNode(node, context) {
34591
34606
  }
34592
34607
  });
34593
34608
  }
34594
- function processParagraphChild(child, sectionMetadata, context, output, converters) {
34595
- const paragraphBlocks = converters.paragraphToFlowBlocks(
34596
- child,
34597
- context.nextBlockId,
34598
- context.positions,
34599
- context.defaultFont,
34600
- context.defaultSize,
34601
- context.styleContext,
34602
- void 0,
34609
+ function processParagraphChild(child, sectionMetadata, context, output, converters2) {
34610
+ const paragraphBlocks = converters2.paragraphToFlowBlocks({
34611
+ para: child,
34612
+ nextBlockId: context.nextBlockId,
34613
+ positions: context.positions,
34614
+ defaultFont: context.defaultFont,
34615
+ defaultSize: context.defaultSize,
34616
+ styleContext: context.styleContext,
34617
+ trackedChangesConfig: void 0,
34603
34618
  // trackedChanges
34604
- context.bookmarks,
34605
- context.hyperlinkConfig
34606
- );
34619
+ bookmarks: context.bookmarks,
34620
+ hyperlinkConfig: context.hyperlinkConfig,
34621
+ converters: converters2,
34622
+ enableComments: context.enableComments,
34623
+ converterContext: context.converterContext
34624
+ });
34607
34625
  applySdtMetadataToParagraphBlocks(
34608
34626
  paragraphBlocks.filter((b2) => b2.kind === "paragraph"),
34609
34627
  sectionMetadata
@@ -34613,26 +34631,29 @@ function processParagraphChild(child, sectionMetadata, context, output, converte
34613
34631
  output.recordBlockKind(block.kind);
34614
34632
  });
34615
34633
  }
34616
- function processTableChild(child, sectionMetadata, context, output, converters) {
34617
- const tableBlock = converters.tableNodeToBlock(
34618
- child,
34619
- context.nextBlockId,
34620
- context.positions,
34621
- context.defaultFont,
34622
- context.defaultSize,
34623
- context.styleContext,
34624
- void 0,
34625
- void 0,
34626
- context.hyperlinkConfig
34627
- );
34634
+ function processTableChild(child, sectionMetadata, context, output, converters2) {
34635
+ const tableBlock = converters2.tableNodeToBlock({
34636
+ node: child,
34637
+ nextBlockId: context.nextBlockId,
34638
+ positions: context.positions,
34639
+ defaultFont: context.defaultFont,
34640
+ defaultSize: context.defaultSize,
34641
+ styleContext: context.styleContext,
34642
+ trackedChangesConfig: context.trackedChangesConfig,
34643
+ bookmarks: context.bookmarks,
34644
+ hyperlinkConfig: context.hyperlinkConfig,
34645
+ enableComments: context.enableComments,
34646
+ converters: converters2,
34647
+ converterContext: context.converterContext
34648
+ });
34628
34649
  if (tableBlock) {
34629
34650
  applySdtMetadataToTableBlock(tableBlock, sectionMetadata);
34630
34651
  output.blocks.push(tableBlock);
34631
34652
  output.recordBlockKind(tableBlock.kind);
34632
34653
  }
34633
34654
  }
34634
- function processImageChild(child, sectionMetadata, context, output, converters) {
34635
- const imageBlock = converters.imageNodeToBlock(child, context.nextBlockId, context.positions);
34655
+ function processImageChild(child, sectionMetadata, context, output, converters2) {
34656
+ const imageBlock = converters2.imageNodeToBlock(child, context.nextBlockId, context.positions);
34636
34657
  if (imageBlock && imageBlock.kind === "image") {
34637
34658
  if (sectionMetadata) {
34638
34659
  if (!imageBlock.attrs) imageBlock.attrs = {};
@@ -34642,22 +34663,25 @@ function processImageChild(child, sectionMetadata, context, output, converters)
34642
34663
  output.recordBlockKind(imageBlock.kind);
34643
34664
  }
34644
34665
  }
34645
- function processNestedStructuredContent(child, sectionMetadata, context, output, converters) {
34666
+ function processNestedStructuredContent(child, sectionMetadata, context, output, converters2) {
34646
34667
  const nestedMetadata = resolveNodeSdtMetadata(child, "structuredContentBlock");
34647
34668
  child.content?.forEach((grandchild) => {
34648
34669
  if (grandchild.type === "paragraph") {
34649
- const paragraphBlocks = converters.paragraphToFlowBlocks(
34650
- grandchild,
34651
- context.nextBlockId,
34652
- context.positions,
34653
- context.defaultFont,
34654
- context.defaultSize,
34655
- context.styleContext,
34656
- void 0,
34657
- // trackedChanges
34658
- context.bookmarks,
34659
- context.hyperlinkConfig
34660
- );
34670
+ const paragraphBlocks = converters2.paragraphToFlowBlocks({
34671
+ para: grandchild,
34672
+ nextBlockId: context.nextBlockId,
34673
+ positions: context.positions,
34674
+ defaultFont: context.defaultFont,
34675
+ defaultSize: context.defaultSize,
34676
+ styleContext: context.styleContext,
34677
+ trackedChangesConfig: context.trackedChangesConfig,
34678
+ bookmarks: context.bookmarks,
34679
+ hyperlinkConfig: context.hyperlinkConfig,
34680
+ converters: converters2,
34681
+ enableComments: context.enableComments,
34682
+ converterContext: context.converterContext,
34683
+ themeColors: context.themeColors
34684
+ });
34661
34685
  const paraOnly = paragraphBlocks.filter((b2) => b2.kind === "paragraph");
34662
34686
  applySdtMetadataToParagraphBlocks(paraOnly, nestedMetadata);
34663
34687
  applySdtMetadataToParagraphBlocks(paraOnly, sectionMetadata);
@@ -34666,17 +34690,21 @@ function processNestedStructuredContent(child, sectionMetadata, context, output,
34666
34690
  output.recordBlockKind(block.kind);
34667
34691
  });
34668
34692
  } else if (grandchild.type === "table") {
34669
- const tableBlock = converters.tableNodeToBlock(
34670
- grandchild,
34671
- context.nextBlockId,
34672
- context.positions,
34673
- context.defaultFont,
34674
- context.defaultSize,
34675
- context.styleContext,
34676
- void 0,
34677
- void 0,
34678
- context.hyperlinkConfig
34679
- );
34693
+ const tableBlock = converters2.tableNodeToBlock({
34694
+ node: grandchild,
34695
+ nextBlockId: context.nextBlockId,
34696
+ positions: context.positions,
34697
+ defaultFont: context.defaultFont,
34698
+ defaultSize: context.defaultSize,
34699
+ styleContext: context.styleContext,
34700
+ trackedChangesConfig: context.trackedChangesConfig,
34701
+ bookmarks: context.bookmarks,
34702
+ hyperlinkConfig: context.hyperlinkConfig,
34703
+ enableComments: context.enableComments,
34704
+ themeColors: context.themeColors,
34705
+ converters: converters2,
34706
+ converterContext: context.converterContext
34707
+ });
34680
34708
  if (tableBlock) {
34681
34709
  if (nestedMetadata) applySdtMetadataToTableBlock(tableBlock, nestedMetadata);
34682
34710
  applySdtMetadataToTableBlock(tableBlock, sectionMetadata);
@@ -34686,7 +34714,7 @@ function processNestedStructuredContent(child, sectionMetadata, context, output,
34686
34714
  }
34687
34715
  });
34688
34716
  }
34689
- function processDocumentPartObject(child, sectionMetadata, context, output, converters) {
34717
+ function processDocumentPartObject(child, sectionMetadata, context, output, converters2) {
34690
34718
  const docPartGallery = getDocPartGallery(child);
34691
34719
  const docPartObjectId = getDocPartObjectId(child);
34692
34720
  const tocInstruction = getNodeInstruction(child);
@@ -34703,10 +34731,13 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
34703
34731
  defaultSize: context.defaultSize,
34704
34732
  styleContext: context.styleContext,
34705
34733
  bookmarks: context.bookmarks,
34706
- hyperlinkConfig: context.hyperlinkConfig
34734
+ hyperlinkConfig: context.hyperlinkConfig,
34735
+ enableComments: context.enableComments,
34736
+ themeColors: context.themeColors,
34737
+ converters: converters2,
34738
+ converterContext: context.converterContext
34707
34739
  },
34708
- { blocks: output.blocks, recordBlockKind: output.recordBlockKind },
34709
- converters.paragraphToFlowBlocks
34740
+ { blocks: output.blocks, recordBlockKind: output.recordBlockKind }
34710
34741
  );
34711
34742
  for (let i = blocksBeforeToc; i < output.blocks.length; i++) {
34712
34743
  const block = output.blocks[i];
@@ -34724,18 +34755,18 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
34724
34755
  }
34725
34756
  }
34726
34757
  }
34727
- function processDocumentSectionChildren(children, sectionMetadata, context, output, converters) {
34758
+ function processDocumentSectionChildren(children, sectionMetadata, context, output, converters2) {
34728
34759
  children.forEach((child) => {
34729
34760
  if (child.type === "paragraph") {
34730
- processParagraphChild(child, sectionMetadata, context, output, converters);
34761
+ processParagraphChild(child, sectionMetadata, context, output, converters2);
34731
34762
  } else if (child.type === "table") {
34732
- processTableChild(child, sectionMetadata, context, output, converters);
34763
+ processTableChild(child, sectionMetadata, context, output, converters2);
34733
34764
  } else if (child.type === "image") {
34734
- processImageChild(child, sectionMetadata, context, output, converters);
34765
+ processImageChild(child, sectionMetadata, context, output, converters2);
34735
34766
  } else if (child.type === "structuredContentBlock" && Array.isArray(child.content)) {
34736
- processNestedStructuredContent(child, sectionMetadata, context, output, converters);
34767
+ processNestedStructuredContent(child, sectionMetadata, context, output, converters2);
34737
34768
  } else if (child.type === "documentPartObject" && Array.isArray(child.content)) {
34738
- processDocumentPartObject(child, sectionMetadata, context, output, converters);
34769
+ processDocumentPartObject(child, sectionMetadata, context, output, converters2);
34739
34770
  }
34740
34771
  });
34741
34772
  }
@@ -34751,14 +34782,13 @@ function handleDocumentSectionNode(node, context) {
34751
34782
  styleContext,
34752
34783
  bookmarks,
34753
34784
  hyperlinkConfig,
34754
- converters
34785
+ converters: converters2,
34786
+ enableComments,
34787
+ converterContext,
34788
+ trackedChangesConfig,
34789
+ themeColors
34755
34790
  } = context;
34756
34791
  const sectionMetadata = resolveNodeSdtMetadata(node, "documentSection");
34757
- const convertersToUse = {
34758
- paragraphToFlowBlocks: converters?.paragraphToFlowBlocks || (() => []),
34759
- tableNodeToBlock: converters?.tableNodeToBlock || (() => null),
34760
- imageNodeToBlock: converters?.imageNodeToBlock || (() => null)
34761
- };
34762
34792
  processDocumentSectionChildren(
34763
34793
  node.content,
34764
34794
  sectionMetadata,
@@ -34769,10 +34799,14 @@ function handleDocumentSectionNode(node, context) {
34769
34799
  defaultSize,
34770
34800
  styleContext,
34771
34801
  bookmarks,
34772
- hyperlinkConfig
34802
+ trackedChangesConfig,
34803
+ hyperlinkConfig,
34804
+ themeColors,
34805
+ enableComments,
34806
+ converterContext
34773
34807
  },
34774
34808
  { blocks, recordBlockKind },
34775
- convertersToUse
34809
+ converters2
34776
34810
  );
34777
34811
  }
34778
34812
  function handleDocumentPartObjectNode(node, context) {
@@ -34787,15 +34821,18 @@ function handleDocumentPartObjectNode(node, context) {
34787
34821
  styleContext,
34788
34822
  bookmarks,
34789
34823
  hyperlinkConfig,
34790
- converters,
34791
- trackedChangesConfig
34824
+ converters: converters2,
34825
+ converterContext,
34826
+ enableComments,
34827
+ trackedChangesConfig,
34828
+ themeColors
34792
34829
  } = context;
34793
34830
  const docPartGallery = getDocPartGallery(node);
34794
34831
  const docPartObjectId = getDocPartObjectId(node);
34795
34832
  const tocInstruction = getNodeInstruction(node);
34796
34833
  const docPartSdtMetadata = resolveNodeSdtMetadata(node, "docPartObject");
34797
- const paragraphToFlowBlocks2 = converters?.paragraphToFlowBlocks;
34798
- if (docPartGallery === "Table of Contents" && paragraphToFlowBlocks2) {
34834
+ const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
34835
+ if (docPartGallery === "Table of Contents") {
34799
34836
  processTocChildren(
34800
34837
  Array.from(node.content),
34801
34838
  { docPartGallery, docPartObjectId, tocInstruction, sdtMetadata: docPartSdtMetadata },
@@ -34806,16 +34843,19 @@ function handleDocumentPartObjectNode(node, context) {
34806
34843
  defaultSize,
34807
34844
  styleContext,
34808
34845
  bookmarks,
34809
- hyperlinkConfig
34846
+ hyperlinkConfig,
34847
+ enableComments,
34848
+ trackedChangesConfig,
34849
+ converters: converters2,
34850
+ converterContext
34810
34851
  },
34811
- { blocks, recordBlockKind },
34812
- paragraphToFlowBlocks2
34852
+ { blocks, recordBlockKind }
34813
34853
  );
34814
34854
  } else if (paragraphToFlowBlocks2) {
34815
34855
  for (const child of node.content) {
34816
34856
  if (child.type === "paragraph") {
34817
- const childBlocks = paragraphToFlowBlocks2(
34818
- child,
34857
+ const childBlocks = paragraphToFlowBlocks2({
34858
+ para: child,
34819
34859
  nextBlockId,
34820
34860
  positions,
34821
34861
  defaultFont,
@@ -34823,8 +34863,12 @@ function handleDocumentPartObjectNode(node, context) {
34823
34863
  styleContext,
34824
34864
  trackedChangesConfig,
34825
34865
  bookmarks,
34826
- hyperlinkConfig
34827
- );
34866
+ hyperlinkConfig,
34867
+ converters: converters2,
34868
+ themeColors,
34869
+ enableComments,
34870
+ converterContext
34871
+ });
34828
34872
  for (const block of childBlocks) {
34829
34873
  blocks.push(block);
34830
34874
  recordBlockKind(block.kind);
@@ -35310,7 +35354,21 @@ const applyInlineRunProperties = (run, runProperties, converterContext) => {
35310
35354
  const runAttrs = computeRunAttrs(runProperties, converterContext);
35311
35355
  return { ...run, ...runAttrs };
35312
35356
  };
35313
- function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
35357
+ function paragraphToFlowBlocks({
35358
+ para,
35359
+ nextBlockId,
35360
+ positions,
35361
+ defaultFont,
35362
+ defaultSize,
35363
+ styleContext,
35364
+ trackedChangesConfig,
35365
+ bookmarks,
35366
+ hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1,
35367
+ themeColors,
35368
+ converters: converters2,
35369
+ converterContext,
35370
+ enableComments = true
35371
+ }) {
35314
35372
  const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
35315
35373
  const baseBlockId = nextBlockId("paragraph");
35316
35374
  const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext);
@@ -35671,14 +35729,14 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35671
35729
  const anchorParagraphId = nextId();
35672
35730
  flushParagraph();
35673
35731
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
35674
- const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
35675
- if (shouldHideTrackedNode(trackedMeta, trackedChanges)) {
35732
+ const trackedMeta = trackedChangesConfig?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
35733
+ if (shouldHideTrackedNode(trackedMeta, trackedChangesConfig)) {
35676
35734
  return;
35677
35735
  }
35678
- if (converters?.imageNodeToBlock) {
35679
- const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
35736
+ if (converters2?.imageNodeToBlock) {
35737
+ const imageBlock = converters2.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChangesConfig);
35680
35738
  if (imageBlock && imageBlock.kind === "image") {
35681
- annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
35739
+ annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChangesConfig);
35682
35740
  blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
35683
35741
  }
35684
35742
  }
@@ -35698,7 +35756,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35698
35756
  const hrIndentRight = typeof indent?.right === "number" ? indent.right : void 0;
35699
35757
  const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
35700
35758
  const hrNode = hasIndent ? { ...node, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node;
35701
- const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
35759
+ const convert = converters2?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
35702
35760
  const drawingBlock = convert(hrNode, nextBlockId, positions);
35703
35761
  if (drawingBlock) {
35704
35762
  blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
@@ -35716,8 +35774,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35716
35774
  }
35717
35775
  const anchorParagraphId = nextId();
35718
35776
  flushParagraph();
35719
- if (converters?.vectorShapeNodeToDrawingBlock) {
35720
- const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
35777
+ if (converters2?.vectorShapeNodeToDrawingBlock) {
35778
+ const drawingBlock = converters2.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
35721
35779
  if (drawingBlock) {
35722
35780
  blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
35723
35781
  }
@@ -35734,8 +35792,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35734
35792
  }
35735
35793
  const anchorParagraphId = nextId();
35736
35794
  flushParagraph();
35737
- if (converters?.shapeGroupNodeToDrawingBlock) {
35738
- const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
35795
+ if (converters2?.shapeGroupNodeToDrawingBlock) {
35796
+ const drawingBlock = converters2.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
35739
35797
  if (drawingBlock) {
35740
35798
  blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
35741
35799
  }
@@ -35752,8 +35810,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35752
35810
  }
35753
35811
  const anchorParagraphId = nextId();
35754
35812
  flushParagraph();
35755
- if (converters?.shapeContainerNodeToDrawingBlock) {
35756
- const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
35813
+ if (converters2?.shapeContainerNodeToDrawingBlock) {
35814
+ const drawingBlock = converters2.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
35757
35815
  if (drawingBlock) {
35758
35816
  blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
35759
35817
  }
@@ -35770,8 +35828,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35770
35828
  }
35771
35829
  const anchorParagraphId = nextId();
35772
35830
  flushParagraph();
35773
- if (converters?.shapeTextboxNodeToDrawingBlock) {
35774
- const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
35831
+ if (converters2?.shapeTextboxNodeToDrawingBlock) {
35832
+ const drawingBlock = converters2.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
35775
35833
  if (drawingBlock) {
35776
35834
  blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
35777
35835
  }
@@ -35785,20 +35843,22 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35785
35843
  }
35786
35844
  const anchorParagraphId = nextId();
35787
35845
  flushParagraph();
35788
- if (converters?.tableNodeToBlock) {
35789
- const tableBlock = converters.tableNodeToBlock(
35846
+ if (converters2?.tableNodeToBlock) {
35847
+ const tableBlock = converters2.tableNodeToBlock({
35790
35848
  node,
35791
35849
  nextBlockId,
35792
35850
  positions,
35793
35851
  defaultFont,
35794
35852
  defaultSize,
35795
35853
  styleContext,
35796
- trackedChanges,
35854
+ trackedChangesConfig,
35797
35855
  bookmarks,
35798
35856
  hyperlinkConfig,
35799
35857
  themeColors,
35800
- ...converterContext !== void 0 ? [converterContext] : []
35801
- );
35858
+ converterContext,
35859
+ converters: converters2,
35860
+ enableComments
35861
+ });
35802
35862
  if (tableBlock) {
35803
35863
  blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
35804
35864
  }
@@ -35875,7 +35935,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35875
35935
  block.runs = mergeAdjacentRuns(block.runs);
35876
35936
  }
35877
35937
  });
35878
- if (!trackedChanges) {
35938
+ if (!trackedChangesConfig) {
35879
35939
  return blocks;
35880
35940
  }
35881
35941
  const processedBlocks = [];
@@ -35886,20 +35946,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
35886
35946
  }
35887
35947
  const filteredRuns = applyTrackedChangesModeToRuns(
35888
35948
  block.runs,
35889
- trackedChanges,
35949
+ trackedChangesConfig,
35890
35950
  hyperlinkConfig,
35891
35951
  applyMarksToRun,
35892
35952
  themeColors,
35893
35953
  enableComments
35894
35954
  );
35895
- if (trackedChanges.enabled && filteredRuns.length === 0) {
35955
+ if (trackedChangesConfig.enabled && filteredRuns.length === 0) {
35896
35956
  return;
35897
35957
  }
35898
35958
  block.runs = filteredRuns;
35899
35959
  block.attrs = {
35900
35960
  ...block.attrs ?? {},
35901
- trackedChangesMode: trackedChanges.mode,
35902
- trackedChangesEnabled: trackedChanges.enabled
35961
+ trackedChangesMode: trackedChangesConfig.mode,
35962
+ trackedChangesEnabled: trackedChangesConfig.enabled
35903
35963
  };
35904
35964
  processedBlocks.push(block);
35905
35965
  });
@@ -35918,7 +35978,10 @@ function handleParagraphNode(node, context) {
35918
35978
  bookmarks,
35919
35979
  hyperlinkConfig,
35920
35980
  sectionState,
35921
- converters
35981
+ converters: converters2,
35982
+ converterContext,
35983
+ themeColors,
35984
+ enableComments
35922
35985
  } = context;
35923
35986
  const { ranges: sectionRanges, currentSectionIndex, currentParagraphIndex } = sectionState;
35924
35987
  if (sectionRanges.length > 0) {
@@ -35933,12 +35996,9 @@ function handleParagraphNode(node, context) {
35933
35996
  sectionState.currentSectionIndex++;
35934
35997
  }
35935
35998
  }
35936
- const paragraphToFlowBlocks2 = converters?.paragraphToFlowBlocks;
35937
- if (!paragraphToFlowBlocks2) {
35938
- return;
35939
- }
35940
- const paragraphBlocks = paragraphToFlowBlocks2(
35941
- node,
35999
+ const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
36000
+ const paragraphBlocks = paragraphToFlowBlocks2({
36001
+ para: node,
35942
36002
  nextBlockId,
35943
36003
  positions,
35944
36004
  defaultFont,
@@ -35947,10 +36007,11 @@ function handleParagraphNode(node, context) {
35947
36007
  trackedChangesConfig,
35948
36008
  bookmarks,
35949
36009
  hyperlinkConfig,
35950
- void 0,
35951
- // themeColors - not available in NodeHandlerContext
35952
- context.converterContext
35953
- );
36010
+ themeColors,
36011
+ converterContext,
36012
+ converters: converters2,
36013
+ enableComments
36014
+ });
35954
36015
  paragraphBlocks.forEach((block) => {
35955
36016
  blocks.push(block);
35956
36017
  recordBlockKind(block.kind);
@@ -36323,7 +36384,7 @@ const parseTableCell = (args) => {
36323
36384
  ...tableProperties && { tableInfo: { tableProperties, rowIndex, cellIndex, numCells, numRows } },
36324
36385
  ...cellBackgroundColor && { backgroundColor: cellBackgroundColor }
36325
36386
  } : context.converterContext;
36326
- const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
36387
+ const paragraphToFlowBlocks2 = context.converters.paragraphToFlowBlocks;
36327
36388
  const tableNodeToBlock2 = context.converters?.tableNodeToBlock;
36328
36389
  const appendParagraphBlocks = (paragraphBlocks, sdtMetadata) => {
36329
36390
  applySdtMetadataToParagraphBlocks(
@@ -36339,19 +36400,21 @@ const parseTableCell = (args) => {
36339
36400
  for (const childNode of cellNode.content) {
36340
36401
  if (childNode.type === "paragraph") {
36341
36402
  if (!paragraphToFlowBlocks2) continue;
36342
- const paragraphBlocks = paragraphToFlowBlocks2(
36343
- childNode,
36344
- context.nextBlockId,
36345
- context.positions,
36346
- context.defaultFont,
36347
- context.defaultSize,
36348
- context.styleContext,
36349
- context.trackedChanges,
36350
- context.bookmarks,
36351
- context.hyperlinkConfig,
36352
- context.themeColors,
36353
- cellConverterContext
36354
- );
36403
+ const paragraphBlocks = paragraphToFlowBlocks2({
36404
+ para: childNode,
36405
+ nextBlockId: context.nextBlockId,
36406
+ positions: context.positions,
36407
+ defaultFont: context.defaultFont,
36408
+ defaultSize: context.defaultSize,
36409
+ styleContext: context.styleContext,
36410
+ trackedChangesConfig: context.trackedChangesConfig,
36411
+ bookmarks: context.bookmarks,
36412
+ hyperlinkConfig: context.hyperlinkConfig,
36413
+ themeColors: context.themeColors,
36414
+ converterContext: cellConverterContext,
36415
+ converters: context.converters,
36416
+ enableComments: context.enableComments
36417
+ });
36355
36418
  appendParagraphBlocks(paragraphBlocks);
36356
36419
  continue;
36357
36420
  }
@@ -36360,38 +36423,40 @@ const parseTableCell = (args) => {
36360
36423
  for (const nestedNode of childNode.content) {
36361
36424
  if (nestedNode.type === "paragraph") {
36362
36425
  if (!paragraphToFlowBlocks2) continue;
36363
- const paragraphBlocks = paragraphToFlowBlocks2(
36364
- nestedNode,
36365
- context.nextBlockId,
36366
- context.positions,
36367
- context.defaultFont,
36368
- context.defaultSize,
36369
- context.styleContext,
36370
- context.trackedChanges,
36371
- context.bookmarks,
36372
- context.hyperlinkConfig,
36373
- context.themeColors,
36374
- cellConverterContext
36375
- );
36426
+ const paragraphBlocks = paragraphToFlowBlocks2({
36427
+ para: nestedNode,
36428
+ nextBlockId: context.nextBlockId,
36429
+ positions: context.positions,
36430
+ defaultFont: context.defaultFont,
36431
+ defaultSize: context.defaultSize,
36432
+ styleContext: context.styleContext,
36433
+ trackedChangesConfig: context.trackedChangesConfig,
36434
+ bookmarks: context.bookmarks,
36435
+ hyperlinkConfig: context.hyperlinkConfig,
36436
+ themeColors: context.themeColors,
36437
+ converterContext: cellConverterContext,
36438
+ converters: context.converters,
36439
+ enableComments: context.enableComments
36440
+ });
36376
36441
  appendParagraphBlocks(paragraphBlocks, structuredContentMetadata);
36377
36442
  continue;
36378
36443
  }
36379
36444
  if (nestedNode.type === "table" && tableNodeToBlock2) {
36380
- const tableBlock = tableNodeToBlock2(
36381
- nestedNode,
36382
- context.nextBlockId,
36383
- context.positions,
36384
- context.defaultFont,
36385
- context.defaultSize,
36386
- context.styleContext,
36387
- context.trackedChanges,
36388
- context.bookmarks,
36389
- context.hyperlinkConfig,
36390
- context.themeColors,
36391
- paragraphToFlowBlocks2,
36392
- context.converterContext,
36393
- { converters: context.converters }
36394
- );
36445
+ const tableBlock = tableNodeToBlock2({
36446
+ node: nestedNode,
36447
+ nextBlockId: context.nextBlockId,
36448
+ positions: context.positions,
36449
+ defaultFont: context.defaultFont,
36450
+ defaultSize: context.defaultSize,
36451
+ styleContext: context.styleContext,
36452
+ trackedChangesConfig: context.trackedChangesConfig,
36453
+ bookmarks: context.bookmarks,
36454
+ hyperlinkConfig: context.hyperlinkConfig,
36455
+ themeColors: context.themeColors,
36456
+ converterContext: context.converterContext,
36457
+ converters: context.converters,
36458
+ enableComments: context.enableComments
36459
+ });
36395
36460
  if (tableBlock && tableBlock.kind === "table") {
36396
36461
  applySdtMetadataToTableBlock(tableBlock, structuredContentMetadata);
36397
36462
  blocks.push(tableBlock);
@@ -36402,21 +36467,21 @@ const parseTableCell = (args) => {
36402
36467
  continue;
36403
36468
  }
36404
36469
  if (childNode.type === "table" && tableNodeToBlock2) {
36405
- const tableBlock = tableNodeToBlock2(
36406
- childNode,
36407
- context.nextBlockId,
36408
- context.positions,
36409
- context.defaultFont,
36410
- context.defaultSize,
36411
- context.styleContext,
36412
- context.trackedChanges,
36413
- context.bookmarks,
36414
- context.hyperlinkConfig,
36415
- context.themeColors,
36416
- paragraphToFlowBlocks2,
36417
- context.converterContext,
36418
- { converters: context.converters }
36419
- );
36470
+ const tableBlock = tableNodeToBlock2({
36471
+ node: childNode,
36472
+ nextBlockId: context.nextBlockId,
36473
+ positions: context.positions,
36474
+ defaultFont: context.defaultFont,
36475
+ defaultSize: context.defaultSize,
36476
+ styleContext: context.styleContext,
36477
+ trackedChangesConfig: context.trackedChangesConfig,
36478
+ bookmarks: context.bookmarks,
36479
+ hyperlinkConfig: context.hyperlinkConfig,
36480
+ themeColors: context.themeColors,
36481
+ converterContext: context.converterContext,
36482
+ converters: context.converters,
36483
+ enableComments: context.enableComments
36484
+ });
36420
36485
  if (tableBlock && tableBlock.kind === "table") {
36421
36486
  blocks.push(tableBlock);
36422
36487
  }
@@ -36424,8 +36489,8 @@ const parseTableCell = (args) => {
36424
36489
  }
36425
36490
  if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
36426
36491
  const mergedMarks = [...childNode.marks ?? []];
36427
- const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
36428
- if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
36492
+ const trackedMeta = context.trackedChangesConfig ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
36493
+ if (shouldHideTrackedNode(trackedMeta, context.trackedChangesConfig)) {
36429
36494
  continue;
36430
36495
  }
36431
36496
  const imageBlock = context.converters.imageNodeToBlock(
@@ -36433,10 +36498,10 @@ const parseTableCell = (args) => {
36433
36498
  context.nextBlockId,
36434
36499
  context.positions,
36435
36500
  trackedMeta,
36436
- context.trackedChanges
36501
+ context.trackedChangesConfig
36437
36502
  );
36438
36503
  if (imageBlock && imageBlock.kind === "image") {
36439
- annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
36504
+ annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChangesConfig);
36440
36505
  blocks.push(imageBlock);
36441
36506
  }
36442
36507
  continue;
@@ -36626,23 +36691,37 @@ function extractFloatingTableAnchorWrap(node) {
36626
36691
  }
36627
36692
  return { anchor, wrap };
36628
36693
  }
36629
- function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
36694
+ function tableNodeToBlock({
36695
+ node,
36696
+ nextBlockId,
36697
+ positions,
36698
+ defaultFont,
36699
+ defaultSize,
36700
+ styleContext,
36701
+ trackedChangesConfig,
36702
+ bookmarks,
36703
+ hyperlinkConfig,
36704
+ themeColors,
36705
+ converterContext,
36706
+ converters: converters2,
36707
+ enableComments
36708
+ }) {
36630
36709
  if (!Array.isArray(node.content) || node.content.length === 0) return null;
36631
- const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
36710
+ const paragraphConverter = converters2.paragraphToFlowBlocks;
36632
36711
  if (!paragraphConverter) return null;
36633
36712
  const parserDeps = {
36634
36713
  nextBlockId,
36635
36714
  positions,
36636
36715
  defaultFont,
36637
36716
  defaultSize,
36638
- styleContext: _styleContext,
36639
- trackedChanges,
36717
+ styleContext,
36718
+ trackedChangesConfig,
36640
36719
  bookmarks,
36641
36720
  hyperlinkConfig,
36642
36721
  themeColors,
36643
- paragraphToFlowBlocks: paragraphConverter,
36644
36722
  converterContext,
36645
- converters: options?.converters
36723
+ converters: converters2,
36724
+ enableComments
36646
36725
  };
36647
36726
  const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
36648
36727
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
@@ -36765,10 +36844,11 @@ function handleTableNode(node, context) {
36765
36844
  trackedChangesConfig,
36766
36845
  bookmarks,
36767
36846
  hyperlinkConfig,
36768
- converters,
36769
- converterContext
36847
+ converters: converters2,
36848
+ converterContext,
36849
+ enableComments
36770
36850
  } = context;
36771
- const tableBlock = tableNodeToBlock$1(
36851
+ const tableBlock = tableNodeToBlock({
36772
36852
  node,
36773
36853
  nextBlockId,
36774
36854
  positions,
@@ -36778,12 +36858,11 @@ function handleTableNode(node, context) {
36778
36858
  trackedChangesConfig,
36779
36859
  bookmarks,
36780
36860
  hyperlinkConfig,
36781
- void 0,
36782
- // themeColors
36783
- converters?.paragraphToFlowBlocks,
36861
+ themeColors: void 0,
36784
36862
  converterContext,
36785
- { converters }
36786
- );
36863
+ converters: converters2,
36864
+ enableComments
36865
+ });
36787
36866
  if (tableBlock) {
36788
36867
  blocks.push(tableBlock);
36789
36868
  recordBlockKind(tableBlock.kind);
@@ -36842,6 +36921,16 @@ const nodeHandlers = {
36842
36921
  shapeContainer: handleShapeContainerNode,
36843
36922
  shapeTextbox: handleShapeTextboxNode
36844
36923
  };
36924
+ const converters = {
36925
+ contentBlockNodeToDrawingBlock,
36926
+ imageNodeToBlock,
36927
+ vectorShapeNodeToDrawingBlock,
36928
+ shapeGroupNodeToDrawingBlock,
36929
+ shapeContainerNodeToDrawingBlock,
36930
+ shapeTextboxNodeToDrawingBlock,
36931
+ tableNodeToBlock,
36932
+ paragraphToFlowBlocks
36933
+ };
36845
36934
  function toFlowBlocks(pmDoc, options) {
36846
36935
  const defaultFont = options?.defaultFont ?? DEFAULT_FONT;
36847
36936
  const defaultSize = options?.defaultSize ?? DEFAULT_SIZE;
@@ -36876,8 +36965,21 @@ function toFlowBlocks(pmDoc, options) {
36876
36965
  enableRichHyperlinks: options?.enableRichHyperlinks ?? false
36877
36966
  };
36878
36967
  const enableComments = options?.enableComments ?? true;
36879
- const themeColors = options?.themeColors;
36880
- const converterContext = options?.converterContext;
36968
+ const converterContext = options?.converterContext ?? {
36969
+ translatedNumbering: {},
36970
+ translatedLinkedStyles: {
36971
+ docDefaults: {
36972
+ runProperties: {
36973
+ fontFamily: {
36974
+ ascii: defaultFont
36975
+ },
36976
+ fontSize: pxToPt(defaultSize) ?? 12
36977
+ }
36978
+ },
36979
+ latentStyles: {},
36980
+ styles: {}
36981
+ }
36982
+ };
36881
36983
  if (!doc2.content) {
36882
36984
  return { blocks: [], bookmarks: /* @__PURE__ */ new Map() };
36883
36985
  }
@@ -36897,44 +36999,6 @@ function toFlowBlocks(pmDoc, options) {
36897
36999
  blocks.push(sectionBreak);
36898
37000
  recordBlockKind(sectionBreak.kind);
36899
37001
  }
36900
- const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => paragraphToFlowBlocks(
36901
- para,
36902
- nextBlockId2,
36903
- positions2,
36904
- defaultFont2,
36905
- defaultSize2,
36906
- context,
36907
- trackedChanges,
36908
- bookmarks2,
36909
- hyperlinkConfig2,
36910
- themeColorsParam ?? themeColors,
36911
- converterCtx ?? converterContext,
36912
- enableComments
36913
- );
36914
- const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
36915
- node,
36916
- nextBlockId2,
36917
- positions2,
36918
- defaultFont2,
36919
- defaultSize2,
36920
- context,
36921
- trackedChanges,
36922
- bookmarks2,
36923
- hyperlinkConfig2,
36924
- themeColorsParam ?? themeColors,
36925
- paragraphConverter,
36926
- converterCtx ?? converterContext,
36927
- {
36928
- converters: {
36929
- paragraphToFlowBlocks: paragraphConverter,
36930
- imageNodeToBlock,
36931
- vectorShapeNodeToDrawingBlock,
36932
- shapeGroupNodeToDrawingBlock,
36933
- shapeContainerNodeToDrawingBlock,
36934
- shapeTextboxNodeToDrawingBlock
36935
- }
36936
- }
36937
- );
36938
37002
  const handlerContext = {
36939
37003
  blocks,
36940
37004
  recordBlockKind,
@@ -36953,16 +37017,8 @@ function toFlowBlocks(pmDoc, options) {
36953
37017
  currentSectionIndex: 0,
36954
37018
  currentParagraphIndex: 0
36955
37019
  },
36956
- converters: {
36957
- // Type assertion needed due to signature mismatch between actual function and type definition
36958
- paragraphToFlowBlocks: paragraphConverter,
36959
- tableNodeToBlock: tableConverter,
36960
- imageNodeToBlock,
36961
- vectorShapeNodeToDrawingBlock,
36962
- shapeGroupNodeToDrawingBlock,
36963
- shapeContainerNodeToDrawingBlock,
36964
- shapeTextboxNodeToDrawingBlock
36965
- }
37020
+ converters,
37021
+ themeColors: options?.themeColors
36966
37022
  };
36967
37023
  doc2.content.forEach((node) => {
36968
37024
  const handler = nodeHandlers[node.type];
@@ -37015,82 +37071,6 @@ function mergeDropCapParagraphs(blocks) {
37015
37071
  }
37016
37072
  return result;
37017
37073
  }
37018
- function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext, enableComments = true) {
37019
- return paragraphToFlowBlocks$1(
37020
- para,
37021
- nextBlockId,
37022
- positions,
37023
- defaultFont,
37024
- defaultSize,
37025
- styleContext,
37026
- trackedChanges,
37027
- bookmarks,
37028
- hyperlinkConfig,
37029
- themeColors,
37030
- {
37031
- contentBlockNodeToDrawingBlock,
37032
- imageNodeToBlock,
37033
- vectorShapeNodeToDrawingBlock,
37034
- shapeGroupNodeToDrawingBlock,
37035
- shapeContainerNodeToDrawingBlock,
37036
- shapeTextboxNodeToDrawingBlock,
37037
- tableNodeToBlock: (node, nextBlockId2, positions2, defaultFont2, defaultSize2, styleContext2, trackedChanges2, bookmarks2, hyperlinkConfig2, themeColors2, converterCtx) => tableNodeToBlock$1(
37038
- node,
37039
- nextBlockId2,
37040
- positions2,
37041
- defaultFont2,
37042
- defaultSize2,
37043
- styleContext2,
37044
- trackedChanges2,
37045
- bookmarks2,
37046
- hyperlinkConfig2,
37047
- themeColors2,
37048
- paragraphToFlowBlocks,
37049
- converterCtx ?? converterContext,
37050
- {
37051
- converters: {
37052
- // Type assertion needed due to signature mismatch between actual function and type definition
37053
- paragraphToFlowBlocks: paragraphToFlowBlocks$1,
37054
- imageNodeToBlock,
37055
- vectorShapeNodeToDrawingBlock,
37056
- shapeGroupNodeToDrawingBlock,
37057
- shapeContainerNodeToDrawingBlock,
37058
- shapeTextboxNodeToDrawingBlock
37059
- }
37060
- }
37061
- )
37062
- },
37063
- converterContext,
37064
- enableComments
37065
- );
37066
- }
37067
- function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
37068
- return tableNodeToBlock$1(
37069
- node,
37070
- nextBlockId,
37071
- positions,
37072
- defaultFont,
37073
- defaultSize,
37074
- styleContext,
37075
- trackedChanges,
37076
- bookmarks,
37077
- hyperlinkConfig,
37078
- themeColors,
37079
- paragraphToFlowBlocks,
37080
- converterContext,
37081
- options ?? {
37082
- converters: {
37083
- // Type assertion needed due to signature mismatch between actual function and type definition
37084
- paragraphToFlowBlocks: paragraphToFlowBlocks$1,
37085
- imageNodeToBlock,
37086
- vectorShapeNodeToDrawingBlock,
37087
- shapeGroupNodeToDrawingBlock,
37088
- shapeContainerNodeToDrawingBlock,
37089
- shapeTextboxNodeToDrawingBlock
37090
- }
37091
- }
37092
- );
37093
- }
37094
37074
  function buildFootnotesInput(editorState, converter, converterContext, themeColors) {
37095
37075
  if (!editorState) return null;
37096
37076
  const footnoteNumberById = converterContext?.footnoteNumberById;