@harbour-enterprises/superdoc 0.22.1 → 0.23.0-next.2

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 (55) hide show
  1. package/dist/chunks/{PdfViewer-D2BPnEBG.cjs → PdfViewer-BItyloFT.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CBmOiHsj.es.js → PdfViewer-MPmm-SUD.es.js} +1 -1
  3. package/dist/chunks/{index-B0CI50e4.cjs → index-CdJOxoqt.cjs} +2 -2
  4. package/dist/chunks/{index-BSDcfSFc.es.js → index-OVF3JhUR.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-DOOwW-Iv.cjs → super-editor.es-C7stybby.cjs} +1608 -1032
  6. package/dist/chunks/{super-editor.es-BW1T3N2-.es.js → super-editor.es-DQnqUJZs.es.js} +1608 -1032
  7. package/dist/style.css +3 -0
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-UuZxU-p8.js → converter-BVirrB35.js} +1463 -1028
  10. package/dist/super-editor/chunks/{docx-zipper-Bss48sB0.js → docx-zipper-Cpb9d2an.js} +1 -1
  11. package/dist/super-editor/chunks/{editor--v3HbUU0.js → editor-DIINh50j.js} +151 -10
  12. package/dist/super-editor/chunks/{toolbar-BeXlvdV8.js → toolbar-CmDmkPHL.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/super-converter/exporter.d.ts +4 -4
  18. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
  19. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
  20. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
  21. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
  22. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
  23. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
  24. package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
  25. package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
  26. package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
  27. package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
  28. package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
  29. package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
  38. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
  39. package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
  40. package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
  41. package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
  42. package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -0
  43. package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
  44. package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
  45. package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
  46. package/dist/super-editor/style.css +3 -0
  47. package/dist/super-editor/super-editor.es.js +10 -8
  48. package/dist/super-editor/toolbar.es.js +2 -2
  49. package/dist/super-editor.cjs +1 -1
  50. package/dist/super-editor.es.js +1 -1
  51. package/dist/superdoc.cjs +2 -2
  52. package/dist/superdoc.es.js +2 -2
  53. package/dist/superdoc.umd.js +1608 -1032
  54. package/dist/superdoc.umd.js.map +1 -1
  55. package/package.json +1 -1
@@ -30710,13 +30710,56 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30710
30710
  const { content: nodes } = params2.node;
30711
30711
  if (!nodes) return [];
30712
30712
  const translatedNodes = [];
30713
- nodes.forEach((node) => {
30713
+ const hyperlinkGroup = [];
30714
+ let index2 = 0;
30715
+ while (index2 < nodes.length) {
30716
+ const node = nodes[index2];
30717
+ const linkMark = _isLinkNode(node);
30718
+ if (linkMark) {
30719
+ hyperlinkGroup.push(node);
30720
+ const nextNode = index2 + 1 < nodes.length ? nodes[index2 + 1] : null;
30721
+ const nextIsLink = _isLinkNode(nextNode, linkMark);
30722
+ if (nextIsLink) {
30723
+ index2++;
30724
+ continue;
30725
+ } else {
30726
+ let translatedLinkGroup = exportSchemaToJson({
30727
+ ...params2,
30728
+ node: hyperlinkGroup[0],
30729
+ extraParams: { ...params2.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
30730
+ });
30731
+ if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
30732
+ else translatedNodes.push(translatedLinkGroup);
30733
+ hyperlinkGroup.length = 0;
30734
+ index2++;
30735
+ continue;
30736
+ }
30737
+ }
30714
30738
  let translatedNode = exportSchemaToJson({ ...params2, node });
30715
30739
  if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
30716
30740
  else translatedNodes.push(translatedNode);
30717
- });
30741
+ index2++;
30742
+ }
30718
30743
  return translatedNodes.filter((n) => n);
30719
30744
  }
30745
+ function _isLinkNode(node, referenceMark = null) {
30746
+ if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
30747
+ const marks = node.marks || node.attrs.marksAsAttrs;
30748
+ const linkMark = marks.find((mark) => mark.type === "link");
30749
+ if (!linkMark) return null;
30750
+ if (referenceMark) {
30751
+ return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
30752
+ }
30753
+ return linkMark;
30754
+ }
30755
+ function _isSameLinkMark(attrsA, attrsB) {
30756
+ for (let key2 of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
30757
+ if (attrsA[key2] != attrsB[key2]) {
30758
+ return false;
30759
+ }
30760
+ }
30761
+ return true;
30762
+ }
30720
30763
  const baseNumbering = {
30721
30764
  declaration: {
30722
30765
  attributes: {
@@ -32063,37 +32106,37 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32063
32106
  };
32064
32107
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
32065
32108
  let NodeTranslator = _NodeTranslator;
32066
- const encode$18 = (attributes) => {
32109
+ const encode$1b = (attributes) => {
32067
32110
  return attributes["w:type"];
32068
32111
  };
32069
- const decode$$ = (attrs) => {
32112
+ const decode$11 = (attrs) => {
32070
32113
  const { lineBreakType } = attrs;
32071
32114
  return lineBreakType;
32072
32115
  };
32073
32116
  const attrConfig$F = Object.freeze({
32074
32117
  xmlName: "w:type",
32075
32118
  sdName: "lineBreakType",
32076
- encode: encode$18,
32077
- decode: decode$$
32119
+ encode: encode$1b,
32120
+ decode: decode$11
32078
32121
  });
32079
- const encode$17 = (attributes) => {
32122
+ const encode$1a = (attributes) => {
32080
32123
  const xmlAttrValue = attributes["w:clear"];
32081
32124
  return xmlAttrValue;
32082
32125
  };
32083
- const decode$_ = (attrs) => {
32126
+ const decode$10 = (attrs) => {
32084
32127
  const { clear } = attrs;
32085
32128
  return clear;
32086
32129
  };
32087
32130
  const attrConfig$E = Object.freeze({
32088
32131
  xmlName: "w:clear",
32089
32132
  sdName: "clear",
32090
- encode: encode$17,
32091
- decode: decode$_
32133
+ encode: encode$1a,
32134
+ decode: decode$10
32092
32135
  });
32093
32136
  const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
32094
- const XML_NODE_NAME$u = "w:br";
32095
- const SD_NODE_NAME$d = "lineBreak";
32096
- const encode$16 = (_2, encodedAttrs) => {
32137
+ const XML_NODE_NAME$x = "w:br";
32138
+ const SD_NODE_NAME$f = "lineBreak";
32139
+ const encode$19 = (_2, encodedAttrs) => {
32097
32140
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
32098
32141
  const translated = {
32099
32142
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -32103,7 +32146,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32103
32146
  }
32104
32147
  return translated;
32105
32148
  };
32106
- const decode$Z = (params2, decodedAttrs) => {
32149
+ const decode$$ = (params2, decodedAttrs) => {
32107
32150
  const { node } = params2;
32108
32151
  if (!node) return;
32109
32152
  const wBreak = { name: "w:br" };
@@ -32120,39 +32163,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32120
32163
  };
32121
32164
  return translated;
32122
32165
  };
32123
- const config$s = {
32124
- xmlName: XML_NODE_NAME$u,
32125
- sdNodeOrKeyName: SD_NODE_NAME$d,
32166
+ const config$v = {
32167
+ xmlName: XML_NODE_NAME$x,
32168
+ sdNodeOrKeyName: SD_NODE_NAME$f,
32126
32169
  type: NodeTranslator.translatorTypes.NODE,
32127
- encode: encode$16,
32128
- decode: decode$Z,
32170
+ encode: encode$19,
32171
+ decode: decode$$,
32129
32172
  attributes: validXmlAttributes$m
32130
32173
  };
32131
- const translator$16 = NodeTranslator.from(config$s);
32132
- const encode$15 = (attributes) => attributes?.["w:val"];
32133
- const decode$Y = (attrs) => attrs?.highlight;
32174
+ const translator$19 = NodeTranslator.from(config$v);
32175
+ const encode$18 = (attributes) => attributes?.["w:val"];
32176
+ const decode$_ = (attrs) => attrs?.highlight;
32134
32177
  const attrConfig$D = Object.freeze({
32135
32178
  xmlName: "w:val",
32136
32179
  sdName: "highlight",
32137
- encode: encode$15,
32138
- decode: decode$Y
32180
+ encode: encode$18,
32181
+ decode: decode$_
32139
32182
  });
32140
32183
  const validXmlAttributes$l = [attrConfig$D];
32141
- const XML_NODE_NAME$t = "w:highlight";
32142
- const SD_ATTR_KEY$f = "highlight";
32184
+ const XML_NODE_NAME$w = "w:highlight";
32185
+ const SD_ATTR_KEY$g = "highlight";
32143
32186
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
32144
- const encode$14 = (params2, encodedAttrs = {}) => {
32187
+ const encode$17 = (params2, encodedAttrs = {}) => {
32145
32188
  const { nodes } = params2;
32146
32189
  const node = nodes?.[0];
32147
32190
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
32148
32191
  return {
32149
32192
  type: "attr",
32150
- xmlName: XML_NODE_NAME$t,
32151
- sdNodeOrKeyName: SD_ATTR_KEY$f,
32193
+ xmlName: XML_NODE_NAME$w,
32194
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
32152
32195
  attributes: { "w:val": value ?? null }
32153
32196
  };
32154
32197
  };
32155
- const decode$X = (params2) => {
32198
+ const decode$Z = (params2) => {
32156
32199
  const attrs = params2?.node?.attrs || {};
32157
32200
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
32158
32201
  if (!highlightValue) return void 0;
@@ -32160,14 +32203,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32160
32203
  if (!normalizedValue) return void 0;
32161
32204
  if (DISABLED_TOKENS.has(normalizedValue)) {
32162
32205
  return {
32163
- name: XML_NODE_NAME$t,
32206
+ name: XML_NODE_NAME$w,
32164
32207
  attributes: { "w:val": "none" }
32165
32208
  };
32166
32209
  }
32167
32210
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
32168
32211
  if (keyword) {
32169
32212
  return {
32170
- name: XML_NODE_NAME$t,
32213
+ name: XML_NODE_NAME$w,
32171
32214
  attributes: { "w:val": keyword }
32172
32215
  };
32173
32216
  }
@@ -32182,63 +32225,63 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32182
32225
  }
32183
32226
  };
32184
32227
  };
32185
- const config$r = {
32186
- xmlName: XML_NODE_NAME$t,
32187
- sdNodeOrKeyName: SD_ATTR_KEY$f,
32228
+ const config$u = {
32229
+ xmlName: XML_NODE_NAME$w,
32230
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
32188
32231
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
32189
- encode: encode$14,
32190
- decode: decode$X,
32232
+ encode: encode$17,
32233
+ decode: decode$Z,
32191
32234
  attributes: validXmlAttributes$l
32192
32235
  };
32193
- const translator$15 = NodeTranslator.from(config$r);
32194
- const encode$13 = (attributes) => {
32236
+ const translator$18 = NodeTranslator.from(config$u);
32237
+ const encode$16 = (attributes) => {
32195
32238
  return attributes["w:val"];
32196
32239
  };
32197
- const decode$W = (attrs) => {
32240
+ const decode$Y = (attrs) => {
32198
32241
  const { tabSize } = attrs || {};
32199
32242
  return tabSize;
32200
32243
  };
32201
32244
  const attrConfig$C = Object.freeze({
32202
32245
  xmlName: "w:val",
32203
32246
  sdName: "tabSize",
32204
- encode: encode$13,
32205
- decode: decode$W
32247
+ encode: encode$16,
32248
+ decode: decode$Y
32206
32249
  });
32207
- const encode$12 = (attributes) => {
32250
+ const encode$15 = (attributes) => {
32208
32251
  return attributes["w:leader"];
32209
32252
  };
32210
- const decode$V = (attrs) => {
32253
+ const decode$X = (attrs) => {
32211
32254
  const { leader } = attrs || {};
32212
32255
  return leader;
32213
32256
  };
32214
32257
  const attrConfig$B = Object.freeze({
32215
32258
  xmlName: "w:leader",
32216
32259
  sdName: "leader",
32217
- encode: encode$12,
32218
- decode: decode$V
32260
+ encode: encode$15,
32261
+ decode: decode$X
32219
32262
  });
32220
- const encode$11 = (attributes) => {
32263
+ const encode$14 = (attributes) => {
32221
32264
  return attributes["w:pos"];
32222
32265
  };
32223
- const decode$U = (attrs) => {
32266
+ const decode$W = (attrs) => {
32224
32267
  const { pos } = attrs || {};
32225
32268
  return pos;
32226
32269
  };
32227
32270
  const attrConfig$A = Object.freeze({
32228
32271
  xmlName: "w:pos",
32229
32272
  sdName: "pos",
32230
- encode: encode$11,
32231
- decode: decode$U
32273
+ encode: encode$14,
32274
+ decode: decode$W
32232
32275
  });
32233
32276
  const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
32234
- const XML_NODE_NAME$s = "w:tab";
32235
- const SD_NODE_NAME$c = "tab";
32236
- const encode$10 = (_2, encodedAttrs = {}) => {
32277
+ const XML_NODE_NAME$v = "w:tab";
32278
+ const SD_NODE_NAME$e = "tab";
32279
+ const encode$13 = (_2, encodedAttrs = {}) => {
32237
32280
  const translated = { type: "tab" };
32238
32281
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
32239
32282
  return translated;
32240
32283
  };
32241
- const decode$T = (params2, decodedAttrs = {}) => {
32284
+ const decode$V = (params2, decodedAttrs = {}) => {
32242
32285
  const { node } = params2 || {};
32243
32286
  if (!node) return;
32244
32287
  const wTab = { name: "w:tab" };
@@ -32254,15 +32297,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32254
32297
  }
32255
32298
  return translated;
32256
32299
  };
32257
- const config$q = {
32258
- xmlName: XML_NODE_NAME$s,
32259
- sdNodeOrKeyName: SD_NODE_NAME$c,
32300
+ const config$t = {
32301
+ xmlName: XML_NODE_NAME$v,
32302
+ sdNodeOrKeyName: SD_NODE_NAME$e,
32260
32303
  type: NodeTranslator.translatorTypes.NODE,
32261
- encode: encode$10,
32262
- decode: decode$T,
32304
+ encode: encode$13,
32305
+ decode: decode$V,
32263
32306
  attributes: validXmlAttributes$k
32264
32307
  };
32265
- const translator$14 = NodeTranslator.from(config$q);
32308
+ const translator$17 = NodeTranslator.from(config$t);
32266
32309
  const mergeTextNodes = (nodes) => {
32267
32310
  if (!nodes || !Array.isArray(nodes)) {
32268
32311
  return nodes;
@@ -32636,104 +32679,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32636
32679
  justify: pPrByIdJcAttr
32637
32680
  };
32638
32681
  };
32639
- const preProcessNodesForFldChar = (nodes = []) => {
32640
- const processedNodes = [];
32641
- let buffer2 = [];
32642
- let collecting = false;
32643
- for (const node of nodes) {
32644
- const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
32645
- const fldType = fldCharEl?.attributes?.["w:fldCharType"];
32646
- if (fldType === "begin") {
32647
- buffer2 = [node];
32648
- collecting = true;
32649
- continue;
32650
- }
32651
- if (fldType === "separate" && collecting) {
32652
- buffer2.push(node);
32653
- continue;
32654
- }
32655
- if (fldType === "end" && collecting) {
32656
- buffer2.push(node);
32657
- processedNodes.push(...processCombinedNodesForFldChar(buffer2));
32658
- buffer2 = [];
32659
- collecting = false;
32660
- continue;
32661
- }
32662
- if (collecting) {
32663
- buffer2.push(node);
32664
- } else {
32665
- processedNodes.push(node);
32666
- }
32667
- }
32668
- if (buffer2.length) {
32669
- processedNodes.push(...buffer2);
32670
- }
32671
- return processedNodes;
32672
- };
32673
- const processCombinedNodesForFldChar = (nodesToCombine = []) => {
32674
- let processedNodes = [];
32675
- let hasPageMarker = false;
32676
- let isNumPages = false;
32677
- const textStart = nodesToCombine.findIndex(
32678
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
32679
- );
32680
- const textEnd = nodesToCombine.findIndex(
32681
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
32682
- );
32683
- const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
32684
- const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
32685
- const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
32686
- const instrText = instrTextNode?.elements[0].text;
32687
- if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
32688
- if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
32689
- const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
32690
- if (hasPageMarker) {
32691
- const pageNumNode = {
32692
- name: "sd:autoPageNumber",
32693
- type: "element"
32694
- };
32695
- nodesToCombine.forEach((n) => {
32696
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
32697
- if (rPrNode) pageNumNode.elements = [rPrNode];
32698
- });
32699
- processedNodes.push(pageNumNode);
32700
- } else if (isNumPages) {
32701
- const totalPageNumNode = {
32702
- name: "sd:totalPageNumber",
32703
- type: "element"
32704
- };
32705
- nodesToCombine.forEach((n) => {
32706
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
32707
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
32708
- });
32709
- processedNodes.push(totalPageNumNode);
32710
- } else if (urlMatch && urlMatch?.length >= 2) {
32711
- const url = urlMatch[1];
32712
- const textMarks = [];
32713
- textNodes.forEach((n) => {
32714
- const rPr2 = n.elements.find((el) => el.name === "w:rPr");
32715
- if (!rPr2) return;
32716
- const { elements } = rPr2;
32717
- elements.forEach((el) => {
32718
- textMarks.push(el);
32719
- });
32720
- });
32721
- const linkMark = { name: "link", attributes: { href: url } };
32722
- const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
32723
- processedNodes.push({
32724
- name: "w:r",
32725
- type: "element",
32726
- elements: [rPr, ...textNodes]
32727
- });
32728
- }
32729
- return processedNodes;
32730
- };
32731
32682
  const handleParagraphNode$1 = (params2) => {
32732
32683
  const { nodes, docx, nodeListHandler, filename } = params2;
32733
32684
  const node = carbonCopy(nodes[0]);
32734
32685
  let schemaNode;
32735
- let processedElements = preProcessNodesForFldChar(node.elements);
32736
- node.elements = processedElements;
32737
32686
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
32738
32687
  (e) => e.handlerName === "standardNodeHandler"
32739
32688
  )?.handler;
@@ -32874,89 +32823,89 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32874
32823
  }
32875
32824
  return schemaNode;
32876
32825
  };
32877
- const encode$$ = (attributes) => {
32826
+ const encode$12 = (attributes) => {
32878
32827
  return attributes["w:rsidDel"];
32879
32828
  };
32880
- const decode$S = (attrs) => {
32829
+ const decode$U = (attrs) => {
32881
32830
  return attrs.rsidDel;
32882
32831
  };
32883
32832
  const attrConfig$z = Object.freeze({
32884
32833
  xmlName: "w:rsidDel",
32885
32834
  sdName: "rsidDel",
32886
- encode: encode$$,
32887
- decode: decode$S
32835
+ encode: encode$12,
32836
+ decode: decode$U
32888
32837
  });
32889
- const encode$_ = (attributes) => {
32838
+ const encode$11 = (attributes) => {
32890
32839
  return attributes["w:rsidP"];
32891
32840
  };
32892
- const decode$R = (attrs) => {
32841
+ const decode$T = (attrs) => {
32893
32842
  return attrs.rsidP;
32894
32843
  };
32895
32844
  const attrConfig$y = Object.freeze({
32896
32845
  xmlName: "w:rsidP",
32897
32846
  sdName: "rsidP",
32898
- encode: encode$_,
32899
- decode: decode$R
32847
+ encode: encode$11,
32848
+ decode: decode$T
32900
32849
  });
32901
- const encode$Z = (attributes) => {
32850
+ const encode$10 = (attributes) => {
32902
32851
  return attributes["w:rsidR"];
32903
32852
  };
32904
- const decode$Q = (attrs) => {
32853
+ const decode$S = (attrs) => {
32905
32854
  return attrs.rsidR;
32906
32855
  };
32907
32856
  const attrConfig$x = Object.freeze({
32908
32857
  xmlName: "w:rsidR",
32909
32858
  sdName: "rsidR",
32910
- encode: encode$Z,
32911
- decode: decode$Q
32859
+ encode: encode$10,
32860
+ decode: decode$S
32912
32861
  });
32913
- const encode$Y = (attributes) => {
32862
+ const encode$$ = (attributes) => {
32914
32863
  return attributes["w:rsidRPr"];
32915
32864
  };
32916
- const decode$P = (attrs) => {
32865
+ const decode$R = (attrs) => {
32917
32866
  return attrs.rsidRPr;
32918
32867
  };
32919
32868
  const attrConfig$w = Object.freeze({
32920
32869
  xmlName: "w:rsidRPr",
32921
32870
  sdName: "rsidRPr",
32922
- encode: encode$Y,
32923
- decode: decode$P
32871
+ encode: encode$$,
32872
+ decode: decode$R
32924
32873
  });
32925
- const encode$X = (attributes) => {
32874
+ const encode$_ = (attributes) => {
32926
32875
  return attributes["w:rsidRDefault"];
32927
32876
  };
32928
- const decode$O = (attrs) => {
32877
+ const decode$Q = (attrs) => {
32929
32878
  return attrs.rsidRDefault;
32930
32879
  };
32931
32880
  const attrConfig$v = Object.freeze({
32932
32881
  xmlName: "w:rsidRDefault",
32933
32882
  sdName: "rsidRDefault",
32934
- encode: encode$X,
32935
- decode: decode$O
32883
+ encode: encode$_,
32884
+ decode: decode$Q
32936
32885
  });
32937
- const encode$W = (attributes) => {
32886
+ const encode$Z = (attributes) => {
32938
32887
  return attributes["w14:paraId"];
32939
32888
  };
32940
- const decode$N = (attrs) => {
32889
+ const decode$P = (attrs) => {
32941
32890
  return attrs.paraId;
32942
32891
  };
32943
32892
  const attrConfig$u = Object.freeze({
32944
32893
  xmlName: "w14:paraId",
32945
32894
  sdName: "paraId",
32946
- encode: encode$W,
32947
- decode: decode$N
32895
+ encode: encode$Z,
32896
+ decode: decode$P
32948
32897
  });
32949
- const encode$V = (attributes) => {
32898
+ const encode$Y = (attributes) => {
32950
32899
  return attributes["w14:textId"];
32951
32900
  };
32952
- const decode$M = (attrs) => {
32901
+ const decode$O = (attrs) => {
32953
32902
  return attrs.textId;
32954
32903
  };
32955
32904
  const attrConfig$t = Object.freeze({
32956
32905
  xmlName: "w14:textId",
32957
32906
  sdName: "textId",
32958
- encode: encode$V,
32959
- decode: decode$M
32907
+ encode: encode$Y,
32908
+ decode: decode$O
32960
32909
  });
32961
32910
  const validXmlAttributes$j = [
32962
32911
  attrConfig$u,
@@ -32967,9 +32916,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32967
32916
  attrConfig$w,
32968
32917
  attrConfig$z
32969
32918
  ];
32970
- const XML_NODE_NAME$r = "w:p";
32971
- const SD_NODE_NAME$b = "paragraph";
32972
- const encode$U = (params2, encodedAttrs = {}) => {
32919
+ const XML_NODE_NAME$u = "w:p";
32920
+ const SD_NODE_NAME$d = "paragraph";
32921
+ const encode$X = (params2, encodedAttrs = {}) => {
32973
32922
  const node = handleParagraphNode$1(params2);
32974
32923
  if (!node) return void 0;
32975
32924
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -32977,7 +32926,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32977
32926
  }
32978
32927
  return node;
32979
32928
  };
32980
- const decode$L = (params2, decodedAttrs = {}) => {
32929
+ const decode$N = (params2, decodedAttrs = {}) => {
32981
32930
  const translated = translateParagraphNode(params2);
32982
32931
  if (!translated) return void 0;
32983
32932
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -32985,16 +32934,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32985
32934
  }
32986
32935
  return translated;
32987
32936
  };
32988
- const config$p = {
32989
- xmlName: XML_NODE_NAME$r,
32990
- sdNodeOrKeyName: SD_NODE_NAME$b,
32937
+ const config$s = {
32938
+ xmlName: XML_NODE_NAME$u,
32939
+ sdNodeOrKeyName: SD_NODE_NAME$d,
32991
32940
  type: NodeTranslator.translatorTypes.NODE,
32992
- encode: encode$U,
32993
- decode: decode$L,
32941
+ encode: encode$X,
32942
+ decode: decode$N,
32994
32943
  attributes: validXmlAttributes$j
32995
32944
  };
32996
- const translator$13 = NodeTranslator.from(config$p);
32997
- const encode$T = (attributes) => {
32945
+ const translator$16 = NodeTranslator.from(config$s);
32946
+ const encode$W = (attributes) => {
32998
32947
  const raw = attributes?.["w:val"];
32999
32948
  if (raw === void 0 || raw === null) return void 0;
33000
32949
  if (typeof raw === "boolean") return raw;
@@ -33004,24 +32953,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33004
32953
  if (val === "1" || val === "true" || val === "on") return true;
33005
32954
  return void 0;
33006
32955
  };
33007
- const decode$K = (runProps) => {
32956
+ const decode$M = (runProps) => {
33008
32957
  if (runProps?.bold === false) return "0";
33009
32958
  return void 0;
33010
32959
  };
33011
32960
  const attrConfig$s = Object.freeze({
33012
32961
  xmlName: "w:val",
33013
32962
  sdName: "bold",
33014
- encode: encode$T,
33015
- decode: decode$K
32963
+ encode: encode$W,
32964
+ decode: decode$M
33016
32965
  });
33017
32966
  const validXmlAttributes$i = [attrConfig$s];
33018
- const XML_NODE_NAME$q = "w:b";
33019
- const SD_ATTR_KEY$e = "bold";
33020
- const encode$S = (params2, encodedAttrs = {}) => {
32967
+ const XML_NODE_NAME$t = "w:b";
32968
+ const SD_ATTR_KEY$f = "bold";
32969
+ const encode$V = (params2, encodedAttrs = {}) => {
33021
32970
  const { nodes } = params2;
33022
32971
  const node = nodes[0];
33023
32972
  if (!node) return void 0;
33024
- const val = encodedAttrs?.[SD_ATTR_KEY$e];
32973
+ const val = encodedAttrs?.[SD_ATTR_KEY$f];
33025
32974
  let attributes;
33026
32975
  if (val === false) attributes = { "w:val": "0" };
33027
32976
  else if (val === true)
@@ -33029,85 +32978,85 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33029
32978
  else attributes = node.attributes || {};
33030
32979
  return {
33031
32980
  type: "attr",
33032
- xmlName: XML_NODE_NAME$q,
33033
- sdNodeOrKeyName: SD_ATTR_KEY$e,
32981
+ xmlName: XML_NODE_NAME$t,
32982
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
33034
32983
  attributes
33035
32984
  };
33036
32985
  };
33037
- const config$o = {
33038
- xmlName: XML_NODE_NAME$q,
33039
- sdNodeOrKeyName: SD_ATTR_KEY$e,
32986
+ const config$r = {
32987
+ xmlName: XML_NODE_NAME$t,
32988
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
33040
32989
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33041
- encode: encode$S,
32990
+ encode: encode$V,
33042
32991
  attributes: validXmlAttributes$i
33043
32992
  };
33044
- const translator$12 = NodeTranslator.from(config$o);
33045
- const XML_NODE_NAME$p = "w:i";
33046
- const SD_ATTR_KEY$d = "italic";
33047
- const encode$R = (params2) => {
32993
+ const translator$15 = NodeTranslator.from(config$r);
32994
+ const XML_NODE_NAME$s = "w:i";
32995
+ const SD_ATTR_KEY$e = "italic";
32996
+ const encode$U = (params2) => {
33048
32997
  const { nodes } = params2;
33049
32998
  const node = nodes?.[0];
33050
32999
  if (!node) return void 0;
33051
33000
  return {
33052
33001
  type: "attr",
33053
- xmlName: XML_NODE_NAME$p,
33054
- sdNodeOrKeyName: SD_ATTR_KEY$d,
33002
+ xmlName: XML_NODE_NAME$s,
33003
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
33055
33004
  attributes: {
33056
33005
  "w:val": node.attributes?.["w:val"] ?? null
33057
33006
  }
33058
33007
  };
33059
33008
  };
33060
- const config$n = {
33061
- xmlName: XML_NODE_NAME$p,
33062
- sdNodeOrKeyName: SD_ATTR_KEY$d,
33009
+ const config$q = {
33010
+ xmlName: XML_NODE_NAME$s,
33011
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
33063
33012
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33064
- encode: encode$R
33013
+ encode: encode$U
33065
33014
  };
33066
- const translator$11 = NodeTranslator.from(config$n);
33067
- const encode$Q = (attributes) => attributes?.["w:val"];
33068
- const decode$J = (attrs) => attrs?.underline;
33015
+ const translator$14 = NodeTranslator.from(config$q);
33016
+ const encode$T = (attributes) => attributes?.["w:val"];
33017
+ const decode$L = (attrs) => attrs?.underline;
33069
33018
  const attrConfig$r = Object.freeze({
33070
33019
  xmlName: "w:val",
33071
33020
  sdName: "underline",
33072
- encode: encode$Q,
33073
- decode: decode$J
33021
+ encode: encode$T,
33022
+ decode: decode$L
33074
33023
  });
33075
- const encode$P = (attributes) => attributes?.["w:color"];
33076
- const decode$I = (attrs) => attrs?.color;
33024
+ const encode$S = (attributes) => attributes?.["w:color"];
33025
+ const decode$K = (attrs) => attrs?.color;
33077
33026
  const attrConfig$q = Object.freeze({
33078
33027
  xmlName: "w:color",
33079
33028
  sdName: "color",
33080
- encode: encode$P,
33081
- decode: decode$I
33029
+ encode: encode$S,
33030
+ decode: decode$K
33082
33031
  });
33083
- const encode$O = (attributes) => attributes?.["w:themeColor"];
33084
- const decode$H = (attrs) => attrs?.themeColor;
33032
+ const encode$R = (attributes) => attributes?.["w:themeColor"];
33033
+ const decode$J = (attrs) => attrs?.themeColor;
33085
33034
  const attrConfig$p = Object.freeze({
33086
33035
  xmlName: "w:themeColor",
33087
33036
  sdName: "themeColor",
33088
- encode: encode$O,
33089
- decode: decode$H
33037
+ encode: encode$R,
33038
+ decode: decode$J
33090
33039
  });
33091
- const encode$N = (attributes) => attributes?.["w:themeTint"];
33092
- const decode$G = (attrs) => attrs?.themeTint;
33040
+ const encode$Q = (attributes) => attributes?.["w:themeTint"];
33041
+ const decode$I = (attrs) => attrs?.themeTint;
33093
33042
  const attrConfig$o = Object.freeze({
33094
33043
  xmlName: "w:themeTint",
33095
33044
  sdName: "themeTint",
33096
- encode: encode$N,
33097
- decode: decode$G
33045
+ encode: encode$Q,
33046
+ decode: decode$I
33098
33047
  });
33099
- const encode$M = (attributes) => attributes?.["w:themeShade"];
33100
- const decode$F = (attrs) => attrs?.themeShade;
33048
+ const encode$P = (attributes) => attributes?.["w:themeShade"];
33049
+ const decode$H = (attrs) => attrs?.themeShade;
33101
33050
  const attrConfig$n = Object.freeze({
33102
33051
  xmlName: "w:themeShade",
33103
33052
  sdName: "themeShade",
33104
- encode: encode$M,
33105
- decode: decode$F
33053
+ encode: encode$P,
33054
+ decode: decode$H
33106
33055
  });
33107
33056
  const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
33108
- const XML_NODE_NAME$o = "w:u";
33109
- const SD_ATTR_KEY$c = "underline";
33110
- const encode$L = (params2, encodedAttrs = {}) => {
33057
+ const XML_NODE_NAME$r = "w:u";
33058
+ const SD_ATTR_KEY$d = "underline";
33059
+ const encode$O = (params2, encodedAttrs = {}) => {
33111
33060
  const { nodes } = params2;
33112
33061
  const node = nodes?.[0];
33113
33062
  const sourceAttrs = node?.attributes || {};
@@ -33123,12 +33072,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33123
33072
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
33124
33073
  return {
33125
33074
  type: "attr",
33126
- xmlName: XML_NODE_NAME$o,
33127
- sdNodeOrKeyName: SD_ATTR_KEY$c,
33075
+ xmlName: XML_NODE_NAME$r,
33076
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
33128
33077
  attributes
33129
33078
  };
33130
33079
  };
33131
- const decode$E = (params2) => {
33080
+ const decode$G = (params2) => {
33132
33081
  const attrs = params2?.node?.attrs || {};
33133
33082
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
33134
33083
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -33146,20 +33095,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33146
33095
  if (themeTint) attributes["w:themeTint"] = themeTint;
33147
33096
  if (themeShade) attributes["w:themeShade"] = themeShade;
33148
33097
  return {
33149
- name: XML_NODE_NAME$o,
33098
+ name: XML_NODE_NAME$r,
33150
33099
  attributes
33151
33100
  };
33152
33101
  };
33153
- const config$m = {
33154
- xmlName: XML_NODE_NAME$o,
33155
- sdNodeOrKeyName: SD_ATTR_KEY$c,
33102
+ const config$p = {
33103
+ xmlName: XML_NODE_NAME$r,
33104
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
33156
33105
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33157
- encode: encode$L,
33158
- decode: decode$E,
33106
+ encode: encode$O,
33107
+ decode: decode$G,
33159
33108
  attributes: validXmlAttributes$h
33160
33109
  };
33161
- const translator$10 = NodeTranslator.from(config$m);
33162
- const encode$K = (attributes) => {
33110
+ const translator$13 = NodeTranslator.from(config$p);
33111
+ const encode$N = (attributes) => {
33163
33112
  const raw = attributes?.["w:val"];
33164
33113
  if (raw === void 0 || raw === null) return void 0;
33165
33114
  if (typeof raw === "boolean") return raw;
@@ -33169,24 +33118,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33169
33118
  if (val === "1" || val === "true" || val === "on") return true;
33170
33119
  return void 0;
33171
33120
  };
33172
- const decode$D = (attrs) => {
33121
+ const decode$F = (attrs) => {
33173
33122
  if (attrs?.strike === false) return "0";
33174
33123
  return void 0;
33175
33124
  };
33176
33125
  const attrConfig$m = Object.freeze({
33177
33126
  xmlName: "w:val",
33178
33127
  sdName: "strike",
33179
- encode: encode$K,
33180
- decode: decode$D
33128
+ encode: encode$N,
33129
+ decode: decode$F
33181
33130
  });
33182
33131
  const validXmlAttributes$g = [attrConfig$m];
33183
- const XML_NODE_NAME$n = "w:strike";
33184
- const SD_ATTR_KEY$b = "strike";
33185
- const encode$J = (params2, encodedAttrs = {}) => {
33132
+ const XML_NODE_NAME$q = "w:strike";
33133
+ const SD_ATTR_KEY$c = "strike";
33134
+ const encode$M = (params2, encodedAttrs = {}) => {
33186
33135
  const { nodes } = params2;
33187
33136
  const node = nodes?.[0];
33188
33137
  if (!node) return void 0;
33189
- const val = encodedAttrs?.[SD_ATTR_KEY$b];
33138
+ const val = encodedAttrs?.[SD_ATTR_KEY$c];
33190
33139
  let attributes;
33191
33140
  if (val === false) attributes = { "w:val": "0" };
33192
33141
  else if (val === true) attributes = {};
@@ -33195,55 +33144,55 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33195
33144
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
33196
33145
  return {
33197
33146
  type: "attr",
33198
- xmlName: XML_NODE_NAME$n,
33199
- sdNodeOrKeyName: SD_ATTR_KEY$b,
33147
+ xmlName: XML_NODE_NAME$q,
33148
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
33200
33149
  attributes
33201
33150
  };
33202
33151
  };
33203
- const config$l = {
33204
- xmlName: XML_NODE_NAME$n,
33205
- sdNodeOrKeyName: SD_ATTR_KEY$b,
33152
+ const config$o = {
33153
+ xmlName: XML_NODE_NAME$q,
33154
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
33206
33155
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33207
- encode: encode$J,
33156
+ encode: encode$M,
33208
33157
  attributes: validXmlAttributes$g
33209
33158
  };
33210
- const translator$$ = NodeTranslator.from(config$l);
33211
- const encode$I = (attributes) => attributes?.["w:val"];
33212
- const decode$C = (attrs) => attrs?.color;
33159
+ const translator$12 = NodeTranslator.from(config$o);
33160
+ const encode$L = (attributes) => attributes?.["w:val"];
33161
+ const decode$E = (attrs) => attrs?.color;
33213
33162
  const attrConfig$l = Object.freeze({
33214
33163
  xmlName: "w:val",
33215
33164
  sdName: "color",
33216
- encode: encode$I,
33217
- decode: decode$C
33165
+ encode: encode$L,
33166
+ decode: decode$E
33218
33167
  });
33219
- const encode$H = (attributes) => attributes?.["w:themeColor"];
33220
- const decode$B = (attrs) => attrs?.themeColor;
33168
+ const encode$K = (attributes) => attributes?.["w:themeColor"];
33169
+ const decode$D = (attrs) => attrs?.themeColor;
33221
33170
  const attrConfig$k = Object.freeze({
33222
33171
  xmlName: "w:themeColor",
33223
33172
  sdName: "themeColor",
33224
- encode: encode$H,
33225
- decode: decode$B
33173
+ encode: encode$K,
33174
+ decode: decode$D
33226
33175
  });
33227
- const encode$G = (attributes) => attributes?.["w:themeTint"];
33228
- const decode$A = (attrs) => attrs?.themeTint;
33176
+ const encode$J = (attributes) => attributes?.["w:themeTint"];
33177
+ const decode$C = (attrs) => attrs?.themeTint;
33229
33178
  const attrConfig$j = Object.freeze({
33230
33179
  xmlName: "w:themeTint",
33231
33180
  sdName: "themeTint",
33232
- encode: encode$G,
33233
- decode: decode$A
33181
+ encode: encode$J,
33182
+ decode: decode$C
33234
33183
  });
33235
- const encode$F = (attributes) => attributes?.["w:themeShade"];
33236
- const decode$z = (attrs) => attrs?.themeShade;
33184
+ const encode$I = (attributes) => attributes?.["w:themeShade"];
33185
+ const decode$B = (attrs) => attrs?.themeShade;
33237
33186
  const attrConfig$i = Object.freeze({
33238
33187
  xmlName: "w:themeShade",
33239
33188
  sdName: "themeShade",
33240
- encode: encode$F,
33241
- decode: decode$z
33189
+ encode: encode$I,
33190
+ decode: decode$B
33242
33191
  });
33243
33192
  const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
33244
- const XML_NODE_NAME$m = "w:color";
33245
- const SD_ATTR_KEY$a = "color";
33246
- const encode$E = (params2, encodedAttrs = {}) => {
33193
+ const XML_NODE_NAME$p = "w:color";
33194
+ const SD_ATTR_KEY$b = "color";
33195
+ const encode$H = (params2, encodedAttrs = {}) => {
33247
33196
  const { nodes } = params2;
33248
33197
  const node = nodes?.[0];
33249
33198
  const sourceAttrs = node?.attributes || {};
@@ -33258,63 +33207,63 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33258
33207
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
33259
33208
  return {
33260
33209
  type: "attr",
33261
- xmlName: XML_NODE_NAME$m,
33262
- sdNodeOrKeyName: SD_ATTR_KEY$a,
33210
+ xmlName: XML_NODE_NAME$p,
33211
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
33263
33212
  attributes
33264
33213
  };
33265
33214
  };
33266
- const config$k = {
33267
- xmlName: XML_NODE_NAME$m,
33268
- sdNodeOrKeyName: SD_ATTR_KEY$a,
33215
+ const config$n = {
33216
+ xmlName: XML_NODE_NAME$p,
33217
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
33269
33218
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33270
- encode: encode$E,
33219
+ encode: encode$H,
33271
33220
  attributes: validXmlAttributes$f
33272
33221
  };
33273
- const translator$_ = NodeTranslator.from(config$k);
33274
- const encode$D = (attributes) => attributes?.["w:eastAsia"];
33275
- const decode$y = (attrs) => attrs?.eastAsia;
33222
+ const translator$11 = NodeTranslator.from(config$n);
33223
+ const encode$G = (attributes) => attributes?.["w:eastAsia"];
33224
+ const decode$A = (attrs) => attrs?.eastAsia;
33276
33225
  const attrConfig$h = Object.freeze({
33277
33226
  xmlName: "w:eastAsia",
33278
33227
  sdName: "eastAsia",
33279
- encode: encode$D,
33280
- decode: decode$y
33228
+ encode: encode$G,
33229
+ decode: decode$A
33281
33230
  });
33282
- const encode$C = (attributes) => attributes?.["w:ascii"];
33283
- const decode$x = (attrs) => attrs?.ascii;
33231
+ const encode$F = (attributes) => attributes?.["w:ascii"];
33232
+ const decode$z = (attrs) => attrs?.ascii;
33284
33233
  const attrConfig$g = Object.freeze({
33285
33234
  xmlName: "w:ascii",
33286
33235
  sdName: "ascii",
33287
- encode: encode$C,
33288
- decode: decode$x
33236
+ encode: encode$F,
33237
+ decode: decode$z
33289
33238
  });
33290
- const encode$B = (attributes) => attributes?.["w:hAnsi"];
33291
- const decode$w = (attrs) => attrs?.hAnsi;
33239
+ const encode$E = (attributes) => attributes?.["w:hAnsi"];
33240
+ const decode$y = (attrs) => attrs?.hAnsi;
33292
33241
  const attrConfig$f = Object.freeze({
33293
33242
  xmlName: "w:hAnsi",
33294
33243
  sdName: "hAnsi",
33295
- encode: encode$B,
33296
- decode: decode$w
33244
+ encode: encode$E,
33245
+ decode: decode$y
33297
33246
  });
33298
- const encode$A = (attributes) => attributes?.["w:cs"];
33299
- const decode$v = (attrs) => attrs?.cs;
33247
+ const encode$D = (attributes) => attributes?.["w:cs"];
33248
+ const decode$x = (attrs) => attrs?.cs;
33300
33249
  const attrConfig$e = Object.freeze({
33301
33250
  xmlName: "w:cs",
33302
33251
  sdName: "cs",
33303
- encode: encode$A,
33304
- decode: decode$v
33252
+ encode: encode$D,
33253
+ decode: decode$x
33305
33254
  });
33306
- const encode$z = (attributes) => attributes?.["w:val"];
33307
- const decode$u = (attrs) => attrs?.value;
33255
+ const encode$C = (attributes) => attributes?.["w:val"];
33256
+ const decode$w = (attrs) => attrs?.value;
33308
33257
  const attrConfig$d = Object.freeze({
33309
33258
  xmlName: "w:val",
33310
33259
  sdName: "value",
33311
- encode: encode$z,
33312
- decode: decode$u
33260
+ encode: encode$C,
33261
+ decode: decode$w
33313
33262
  });
33314
33263
  const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
33315
- const XML_NODE_NAME$l = "w:rFonts";
33316
- const SD_ATTR_KEY$9 = "fontFamily";
33317
- const encode$y = (params2, encodedAttrs = {}) => {
33264
+ const XML_NODE_NAME$o = "w:rFonts";
33265
+ const SD_ATTR_KEY$a = "fontFamily";
33266
+ const encode$B = (params2, encodedAttrs = {}) => {
33318
33267
  const { nodes } = params2;
33319
33268
  const node = nodes?.[0];
33320
33269
  const sourceAttrs = node?.attributes || {};
@@ -33340,120 +33289,281 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33340
33289
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
33341
33290
  return {
33342
33291
  type: "attr",
33343
- xmlName: XML_NODE_NAME$l,
33344
- sdNodeOrKeyName: SD_ATTR_KEY$9,
33292
+ xmlName: XML_NODE_NAME$o,
33293
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
33345
33294
  attributes
33346
33295
  };
33347
33296
  };
33348
- const config$j = {
33349
- xmlName: XML_NODE_NAME$l,
33350
- sdNodeOrKeyName: SD_ATTR_KEY$9,
33297
+ const config$m = {
33298
+ xmlName: XML_NODE_NAME$o,
33299
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
33351
33300
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33352
- encode: encode$y,
33301
+ encode: encode$B,
33353
33302
  attributes: validXmlAttributes$e
33354
33303
  };
33355
- const translator$Z = NodeTranslator.from(config$j);
33356
- const encode$x = (attributes) => attributes?.["w:val"];
33357
- const decode$t = (attrs) => attrs?.styleId;
33304
+ const translator$10 = NodeTranslator.from(config$m);
33305
+ const encode$A = (attributes) => attributes?.["w:val"];
33306
+ const decode$v = (attrs) => attrs?.styleId;
33358
33307
  const attrConfig$c = Object.freeze({
33359
33308
  xmlName: "w:val",
33360
33309
  sdName: "styleId",
33361
- encode: encode$x,
33362
- decode: decode$t
33310
+ encode: encode$A,
33311
+ decode: decode$v
33363
33312
  });
33364
33313
  const validXmlAttributes$d = [attrConfig$c];
33365
- const XML_NODE_NAME$k = "w:rStyle";
33366
- const SD_ATTR_KEY$8 = "styleId";
33367
- const encode$w = (params2, encodedAttrs = {}) => {
33314
+ const XML_NODE_NAME$n = "w:rStyle";
33315
+ const SD_ATTR_KEY$9 = "styleId";
33316
+ const encode$z = (params2, encodedAttrs = {}) => {
33368
33317
  const { nodes } = params2;
33369
33318
  const node = nodes?.[0];
33370
33319
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
33371
33320
  return {
33372
33321
  type: "attr",
33373
- xmlName: XML_NODE_NAME$k,
33374
- sdNodeOrKeyName: SD_ATTR_KEY$8,
33322
+ xmlName: XML_NODE_NAME$n,
33323
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
33375
33324
  attributes: { "w:val": value ?? null }
33376
33325
  };
33377
33326
  };
33378
- const config$i = {
33379
- xmlName: XML_NODE_NAME$k,
33380
- sdNodeOrKeyName: SD_ATTR_KEY$8,
33327
+ const config$l = {
33328
+ xmlName: XML_NODE_NAME$n,
33329
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
33381
33330
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33382
- encode: encode$w,
33331
+ encode: encode$z,
33383
33332
  attributes: validXmlAttributes$d
33384
33333
  };
33385
- const translator$Y = NodeTranslator.from(config$i);
33386
- const encode$v = (attributes) => attributes?.["w:val"];
33387
- const decode$s = (attrs) => attrs?.fontSize;
33334
+ const translator$$ = NodeTranslator.from(config$l);
33335
+ const encode$y = (attributes) => attributes?.["w:val"];
33336
+ const decode$u = (attrs) => attrs?.fontSize;
33388
33337
  const attrConfig$b = Object.freeze({
33389
33338
  xmlName: "w:val",
33390
33339
  sdName: "fontSize",
33391
- encode: encode$v,
33392
- decode: decode$s
33340
+ encode: encode$y,
33341
+ decode: decode$u
33393
33342
  });
33394
33343
  const validXmlAttributes$c = [attrConfig$b];
33395
- const XML_NODE_NAME$j = "w:sz";
33396
- const SD_ATTR_KEY$7 = "fontSize";
33397
- const encode$u = (params2, encodedAttrs = {}) => {
33344
+ const XML_NODE_NAME$m = "w:sz";
33345
+ const SD_ATTR_KEY$8 = "fontSize";
33346
+ const encode$x = (params2, encodedAttrs = {}) => {
33398
33347
  const { nodes } = params2;
33399
33348
  const node = nodes?.[0];
33400
33349
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
33401
33350
  return {
33402
33351
  type: "attr",
33403
- xmlName: XML_NODE_NAME$j,
33404
- sdNodeOrKeyName: SD_ATTR_KEY$7,
33352
+ xmlName: XML_NODE_NAME$m,
33353
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
33405
33354
  attributes: { "w:val": value ?? null }
33406
33355
  };
33407
33356
  };
33408
- const config$h = {
33409
- xmlName: XML_NODE_NAME$j,
33410
- sdNodeOrKeyName: SD_ATTR_KEY$7,
33357
+ const config$k = {
33358
+ xmlName: XML_NODE_NAME$m,
33359
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
33411
33360
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33412
- encode: encode$u,
33361
+ encode: encode$x,
33413
33362
  attributes: validXmlAttributes$c
33414
33363
  };
33415
- const translator$X = NodeTranslator.from(config$h);
33416
- const encode$t = (attributes) => attributes?.["w:val"];
33417
- const decode$r = (attrs) => attrs?.fontSizeCs;
33364
+ const translator$_ = NodeTranslator.from(config$k);
33365
+ const encode$w = (attributes) => attributes?.["w:val"];
33366
+ const decode$t = (attrs) => attrs?.fontSizeCs;
33418
33367
  const attrConfig$a = Object.freeze({
33419
33368
  xmlName: "w:val",
33420
33369
  sdName: "fontSizeCs",
33421
- encode: encode$t,
33422
- decode: decode$r
33370
+ encode: encode$w,
33371
+ decode: decode$t
33423
33372
  });
33424
33373
  const validXmlAttributes$b = [attrConfig$a];
33425
- const XML_NODE_NAME$i = "w:szCs";
33426
- const SD_ATTR_KEY$6 = "fontSizeCs";
33427
- const encode$s = (params2, encodedAttrs = {}) => {
33374
+ const XML_NODE_NAME$l = "w:szCs";
33375
+ const SD_ATTR_KEY$7 = "fontSizeCs";
33376
+ const encode$v = (params2, encodedAttrs = {}) => {
33428
33377
  const { nodes } = params2;
33429
33378
  const node = nodes?.[0];
33430
33379
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
33431
33380
  return {
33432
33381
  type: "attr",
33433
- xmlName: XML_NODE_NAME$i,
33434
- sdNodeOrKeyName: SD_ATTR_KEY$6,
33382
+ xmlName: XML_NODE_NAME$l,
33383
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
33435
33384
  attributes: { "w:val": value ?? null }
33436
33385
  };
33437
33386
  };
33438
- const config$g = {
33439
- xmlName: XML_NODE_NAME$i,
33440
- sdNodeOrKeyName: SD_ATTR_KEY$6,
33387
+ const config$j = {
33388
+ xmlName: XML_NODE_NAME$l,
33389
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
33441
33390
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33442
- encode: encode$s,
33391
+ encode: encode$v,
33443
33392
  attributes: validXmlAttributes$b
33444
33393
  };
33445
- const translator$W = NodeTranslator.from(config$g);
33394
+ const translator$Z = NodeTranslator.from(config$j);
33395
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
33396
+ handlerName,
33397
+ handler: (params2) => {
33398
+ const { nodes } = params2;
33399
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
33400
+ return { nodes: [], consumed: 0 };
33401
+ }
33402
+ const result = translator2.encode(params2);
33403
+ if (!result) return { nodes: [], consumed: 0 };
33404
+ return {
33405
+ nodes: Array.isArray(result) ? result : [result],
33406
+ consumed: 1
33407
+ };
33408
+ }
33409
+ });
33410
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
33411
+ if (!sdName) sdName = xmlName.split(":")[1];
33412
+ if (!transformEncode) transformEncode = (v2) => v2;
33413
+ if (!transformDecode) transformDecode = (v2) => v2;
33414
+ return {
33415
+ xmlName,
33416
+ sdNodeOrKeyName: sdName,
33417
+ encode: ({ nodes }) => {
33418
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
33419
+ },
33420
+ decode: ({ node }) => {
33421
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
33422
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
33423
+ }
33424
+ };
33425
+ }
33426
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
33427
+ if (!sdName) sdName = xmlName.split(":")[1];
33428
+ return {
33429
+ xmlName,
33430
+ sdNodeOrKeyName: sdName,
33431
+ attributes: [
33432
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
33433
+ createAttributeHandler("w:type")
33434
+ ],
33435
+ encode: (_2, encodedAttrs) => {
33436
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
33437
+ },
33438
+ decode: function({ node }) {
33439
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
33440
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
33441
+ }
33442
+ };
33443
+ }
33444
+ function createBorderPropertyHandler(xmlName, sdName = null) {
33445
+ if (!sdName) sdName = xmlName.split(":")[1];
33446
+ return {
33447
+ xmlName,
33448
+ sdNodeOrKeyName: sdName,
33449
+ attributes: [
33450
+ createAttributeHandler("w:val"),
33451
+ createAttributeHandler("w:color"),
33452
+ createAttributeHandler("w:themeColor"),
33453
+ createAttributeHandler("w:themeTint"),
33454
+ createAttributeHandler("w:themeShade"),
33455
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
33456
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
33457
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
33458
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
33459
+ ],
33460
+ encode: (params2, encodedAttrs) => {
33461
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
33462
+ },
33463
+ decode: function({ node }, context) {
33464
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
33465
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
33466
+ }
33467
+ };
33468
+ }
33469
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
33470
+ if (!transformEncode) transformEncode = (v2) => v2;
33471
+ if (!transformDecode) transformDecode = (v2) => v2;
33472
+ if (!sdName) sdName = xmlName.split(":")[1];
33473
+ return {
33474
+ xmlName,
33475
+ sdName,
33476
+ encode: (attributes) => transformEncode(attributes[xmlName]),
33477
+ decode: (attributes) => transformDecode(attributes[sdName])
33478
+ };
33479
+ };
33480
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
33481
+ if (!node?.elements || node.elements.length === 0) {
33482
+ return asArray ? [] : {};
33483
+ }
33484
+ const attributes = asArray ? [] : {};
33485
+ node.elements.forEach((el) => {
33486
+ const translator2 = translatorsByXmlName[el.name];
33487
+ if (translator2) {
33488
+ const encodedAttr = translator2.encode({ nodes: [el] });
33489
+ if (encodedAttr != null) {
33490
+ if (asArray) {
33491
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
33492
+ } else {
33493
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
33494
+ }
33495
+ }
33496
+ }
33497
+ });
33498
+ return attributes;
33499
+ }
33500
+ function decodeProperties(translatorsBySdName, properties) {
33501
+ if (!properties || typeof properties !== "object") {
33502
+ return [];
33503
+ }
33504
+ const elements = [];
33505
+ Object.keys(properties).forEach((key2) => {
33506
+ const translator2 = translatorsBySdName[key2];
33507
+ if (translator2) {
33508
+ const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
33509
+ if (result != null) {
33510
+ result.name = translator2.xmlName;
33511
+ elements.push(result);
33512
+ }
33513
+ }
33514
+ });
33515
+ return elements;
33516
+ }
33517
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
33518
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
33519
+ const parseInteger = (value) => {
33520
+ if (value == null) return void 0;
33521
+ const intValue = parseInt(value, 10);
33522
+ return isNaN(intValue) ? void 0 : intValue;
33523
+ };
33524
+ const integerToString = (value) => {
33525
+ const intValue = parseInteger(value);
33526
+ return intValue != void 0 ? String(intValue) : void 0;
33527
+ };
33528
+ const XML_NODE_NAME$k = "w:caps";
33529
+ const SD_ATTR_KEY$6 = "textTransform";
33530
+ const encode$u = (params2, encodedAttrs = {}) => {
33531
+ const { nodes } = params2;
33532
+ const node = nodes[0];
33533
+ if (!node) return void 0;
33534
+ let result;
33535
+ if (!["false", "0"].includes(encodedAttrs.val)) {
33536
+ result = "uppercase";
33537
+ } else {
33538
+ return void 0;
33539
+ }
33540
+ return {
33541
+ type: "attr",
33542
+ xmlName: XML_NODE_NAME$k,
33543
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
33544
+ attributes: { [SD_ATTR_KEY$6]: result }
33545
+ };
33546
+ };
33547
+ const config$i = {
33548
+ xmlName: XML_NODE_NAME$k,
33549
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
33550
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
33551
+ encode: encode$u,
33552
+ attributes: [createAttributeHandler("w:val")]
33553
+ };
33554
+ const translator$Y = NodeTranslator.from(config$i);
33446
33555
  const runPropertyTranslators = Object.freeze({
33447
- "w:b": translator$12,
33448
- "w:i": translator$11,
33449
- "w:u": translator$10,
33450
- "w:strike": translator$$,
33451
- "w:color": translator$_,
33452
- "w:highlight": translator$15,
33453
- "w:rFonts": translator$Z,
33454
- "w:rStyle": translator$Y,
33455
- "w:sz": translator$X,
33456
- "w:szCs": translator$W
33556
+ "w:b": translator$15,
33557
+ "w:i": translator$14,
33558
+ "w:u": translator$13,
33559
+ "w:strike": translator$12,
33560
+ "w:color": translator$11,
33561
+ "w:highlight": translator$18,
33562
+ "w:rFonts": translator$10,
33563
+ "w:rStyle": translator$$,
33564
+ "w:sz": translator$_,
33565
+ "w:szCs": translator$Z,
33566
+ "w:caps": translator$Y
33457
33567
  });
33458
33568
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
33459
33569
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -33467,9 +33577,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33467
33577
  attributes: { ...candidate.attributes || {} }
33468
33578
  };
33469
33579
  };
33470
- const XML_NODE_NAME$h = "w:rPr";
33580
+ const XML_NODE_NAME$j = "w:rPr";
33471
33581
  const SD_ATTR_KEY$5 = "runProperties";
33472
- const encode$r = (params2) => {
33582
+ const encode$t = (params2) => {
33473
33583
  const { nodes } = params2;
33474
33584
  const node = nodes?.[0] || {};
33475
33585
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -33503,16 +33613,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33503
33613
  attributes: runPropsArray
33504
33614
  };
33505
33615
  };
33506
- const config$f = {
33507
- xmlName: XML_NODE_NAME$h,
33616
+ const config$h = {
33617
+ xmlName: XML_NODE_NAME$j,
33508
33618
  sdNodeOrKeyName: SD_ATTR_KEY$5,
33509
33619
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
33510
- encode: encode$r
33620
+ encode: encode$t
33511
33621
  };
33512
- const translator$V = NodeTranslator.from(config$f);
33622
+ const translator$X = NodeTranslator.from(config$h);
33513
33623
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
33514
33624
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
33515
- const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
33625
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$X) => {
33516
33626
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
33517
33627
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
33518
33628
  let entries = [];
@@ -33581,7 +33691,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33581
33691
  };
33582
33692
  const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
33583
33693
  const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
33584
- const runStyleMarks = collectStyleMarks(runStyleId, docx);
33694
+ if (paragraphStyleId?.startsWith("TOC")) {
33695
+ return paragraphStyleMarks;
33696
+ }
33697
+ let runStyleMarks = collectStyleMarks(runStyleId, docx);
33585
33698
  const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
33586
33699
  const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
33587
33700
  return { inlineMarks, textStyleAttrs };
@@ -33807,6 +33920,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33807
33920
  }
33808
33921
  break;
33809
33922
  }
33923
+ case "w:caps": {
33924
+ if (attributes["textTransform"] != null) {
33925
+ hasTextStyle = true;
33926
+ textStyleAttrs.textTransform = attributes["textTransform"];
33927
+ }
33928
+ break;
33929
+ }
33810
33930
  case "w:rFonts": {
33811
33931
  const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
33812
33932
  const eastAsiaFamily = attributes["w:eastAsia"];
@@ -33826,9 +33946,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33826
33946
  case "w:sz":
33827
33947
  case "w:szCs": {
33828
33948
  const rawSize = Number(attributes["w:val"]);
33949
+ const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
33829
33950
  if (Number.isFinite(rawSize) && rawSize > 0) {
33830
33951
  hasTextStyle = true;
33831
- textStyleAttrs.fontSize = `${rawSize / 2}pt`;
33952
+ textStyleAttrs[attrName] = `${rawSize / 2}pt`;
33832
33953
  }
33833
33954
  break;
33834
33955
  }
@@ -33974,46 +34095,166 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33974
34095
  }
33975
34096
  return runs;
33976
34097
  };
33977
- const encode$q = (attributes) => {
34098
+ const XML_NODE_NAME$i = "w:hyperlink";
34099
+ const SD_NODE_NAME$c = "link";
34100
+ const _createAttributeHandler = (xmlName, sdName) => ({
34101
+ xmlName,
34102
+ sdName,
34103
+ encode: (attributes) => attributes[xmlName],
34104
+ decode: (attributes) => attributes[sdName]
34105
+ });
34106
+ const validXmlAttributes$a = [
34107
+ _createAttributeHandler("w:anchor", "anchor"),
34108
+ _createAttributeHandler("w:docLocation", "docLocation"),
34109
+ {
34110
+ xmlName: "w:history",
34111
+ sdName: "history",
34112
+ encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
34113
+ decode: (attributes) => attributes["history"] ? "1" : "0"
34114
+ },
34115
+ _createAttributeHandler("w:tooltip", "tooltip"),
34116
+ _createAttributeHandler("r:id", "rId"),
34117
+ _createAttributeHandler("w:tgtFrame", "target")
34118
+ ];
34119
+ const encode$s = (params2, encodedAttrs) => {
34120
+ const { nodes, docx, nodeListHandler } = params2;
34121
+ const node = nodes[0];
34122
+ let href = _resolveHref(docx, encodedAttrs);
34123
+ const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
34124
+ const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
34125
+ const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
34126
+ contentNodes.forEach((contentNode) => {
34127
+ const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
34128
+ const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
34129
+ contentNode.marks = [...marksWithoutLink, linkMark];
34130
+ });
34131
+ const updatedNode = nodeListHandler.handler({
34132
+ ...params2,
34133
+ nodes: contentNodes,
34134
+ path: [...params2.path || [], node]
34135
+ });
34136
+ return updatedNode;
34137
+ };
34138
+ const _resolveHref = (docx, encodedAttrs) => {
34139
+ const rels = docx["word/_rels/document.xml.rels"];
34140
+ const relationships = rels.elements.find((el) => el.name === "Relationships");
34141
+ const { elements } = relationships;
34142
+ const { rId, anchor } = encodedAttrs;
34143
+ let href;
34144
+ if (!rId && anchor) {
34145
+ href = `#${anchor}`;
34146
+ } else if (rId) {
34147
+ const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
34148
+ const { attributes: relAttributes = {} } = rel;
34149
+ href = relAttributes["Target"];
34150
+ }
34151
+ return href;
34152
+ };
34153
+ function decode$s(params2) {
34154
+ const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
34155
+ const node = hyperlinkGroup[0];
34156
+ const linkMark = node.marks.find((m2) => m2.type === "link");
34157
+ const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
34158
+ let { anchor, href: link } = linkMark.attrs;
34159
+ const isExternalLink = !anchor;
34160
+ if (isExternalLink) {
34161
+ linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
34162
+ }
34163
+ let contentNodes = [];
34164
+ hyperlinkGroup.forEach((linkNode) => {
34165
+ if ("marks" in linkNode) {
34166
+ linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
34167
+ } else {
34168
+ linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
34169
+ }
34170
+ const outputNode = exportSchemaToJson({ ...params2, node: linkNode });
34171
+ if (outputNode) {
34172
+ if (outputNode instanceof Array) contentNodes.push(...outputNode);
34173
+ else contentNodes.push(outputNode);
34174
+ }
34175
+ });
34176
+ const newNode = {
34177
+ name: "w:hyperlink",
34178
+ type: "element",
34179
+ attributes: {
34180
+ ...linkAttrs
34181
+ },
34182
+ elements: contentNodes
34183
+ };
34184
+ return newNode;
34185
+ }
34186
+ function _addNewLinkRelationship(params2, link, rId) {
34187
+ if (!rId) rId = generateDocxRandomId();
34188
+ if (!params2.relationships || !Array.isArray(params2.relationships)) {
34189
+ params2.relationships = [];
34190
+ }
34191
+ const existingRel = params2.relationships.find(
34192
+ (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
34193
+ );
34194
+ if (existingRel) {
34195
+ return rId;
34196
+ }
34197
+ params2.relationships.push({
34198
+ type: "element",
34199
+ name: "Relationship",
34200
+ attributes: {
34201
+ Id: rId,
34202
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
34203
+ Target: link,
34204
+ TargetMode: "External"
34205
+ }
34206
+ });
34207
+ return rId;
34208
+ }
34209
+ const config$g = {
34210
+ xmlName: XML_NODE_NAME$i,
34211
+ sdNodeOrKeyName: SD_NODE_NAME$c,
34212
+ type: NodeTranslator.translatorTypes.NODE,
34213
+ encode: encode$s,
34214
+ decode: decode$s,
34215
+ attributes: validXmlAttributes$a
34216
+ };
34217
+ const translator$W = NodeTranslator.from(config$g);
34218
+ const encode$r = (attributes) => {
33978
34219
  return attributes["w:rsidR"];
33979
34220
  };
33980
- const decode$q = (attrs) => {
34221
+ const decode$r = (attrs) => {
33981
34222
  return attrs.rsidR;
33982
34223
  };
33983
34224
  const attrConfig$9 = Object.freeze({
33984
34225
  xmlName: "w:rsidR",
33985
34226
  sdName: "rsidR",
33986
- encode: encode$q,
33987
- decode: decode$q
34227
+ encode: encode$r,
34228
+ decode: decode$r
33988
34229
  });
33989
- const encode$p = (attributes) => {
34230
+ const encode$q = (attributes) => {
33990
34231
  return attributes["w:rsidRPr"];
33991
34232
  };
33992
- const decode$p = (attrs) => {
34233
+ const decode$q = (attrs) => {
33993
34234
  return attrs.rsidRPr;
33994
34235
  };
33995
34236
  const attrConfig$8 = Object.freeze({
33996
34237
  xmlName: "w:rsidRPr",
33997
34238
  sdName: "rsidRPr",
33998
- encode: encode$p,
33999
- decode: decode$p
34239
+ encode: encode$q,
34240
+ decode: decode$q
34000
34241
  });
34001
- const encode$o = (attributes) => {
34242
+ const encode$p = (attributes) => {
34002
34243
  return attributes["w:rsidDel"];
34003
34244
  };
34004
- const decode$o = (attrs) => {
34245
+ const decode$p = (attrs) => {
34005
34246
  return attrs.rsidDel;
34006
34247
  };
34007
34248
  const attrConfig$7 = Object.freeze({
34008
34249
  xmlName: "w:rsidDel",
34009
34250
  sdName: "rsidDel",
34010
- encode: encode$o,
34011
- decode: decode$o
34251
+ encode: encode$p,
34252
+ decode: decode$p
34012
34253
  });
34013
- const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
34014
- const XML_NODE_NAME$g = "w:r";
34254
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
34255
+ const XML_NODE_NAME$h = "w:r";
34015
34256
  const SD_KEY_NAME = "run";
34016
- const encode$n = (params2, encodedAttrs = {}) => {
34257
+ const encode$o = (params2, encodedAttrs = {}) => {
34017
34258
  const { nodes = [], nodeListHandler } = params2 || {};
34018
34259
  const runNode = nodes[0];
34019
34260
  if (!runNode) return void 0;
@@ -34061,9 +34302,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34061
34302
  }
34062
34303
  return runNodeResult;
34063
34304
  };
34064
- const decode$n = (params2, decodedAttrs = {}) => {
34305
+ const decode$o = (params2, decodedAttrs = {}) => {
34065
34306
  const { node } = params2 || {};
34066
34307
  if (!node) return void 0;
34308
+ const isLinkNode = node.marks?.some((m2) => m2.type === "link");
34309
+ if (isLinkNode) return translator$W.decode(params2);
34067
34310
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
34068
34311
  const runAttrs = runNodeForExport.attrs || {};
34069
34312
  const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
@@ -34118,7 +34361,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34118
34361
  runs.push(trackedClone);
34119
34362
  return;
34120
34363
  }
34121
- const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
34364
+ const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
34122
34365
  applyBaseRunProps(runWrapper);
34123
34366
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
34124
34367
  runWrapper.elements.push(cloneXmlNode(child));
@@ -34126,7 +34369,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34126
34369
  });
34127
34370
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
34128
34371
  if (!trackedRuns.length) {
34129
- const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
34372
+ const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
34130
34373
  applyBaseRunProps(emptyRun);
34131
34374
  trackedRuns.push(emptyRun);
34132
34375
  }
@@ -34140,148 +34383,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34140
34383
  }
34141
34384
  return trackedRuns;
34142
34385
  };
34143
- const config$e = {
34144
- xmlName: XML_NODE_NAME$g,
34386
+ const config$f = {
34387
+ xmlName: XML_NODE_NAME$h,
34145
34388
  sdNodeOrKeyName: SD_KEY_NAME,
34146
34389
  type: NodeTranslator.translatorTypes.NODE,
34147
- encode: encode$n,
34148
- decode: decode$n,
34149
- attributes: validXmlAttributes$a
34150
- };
34151
- const translator$U = NodeTranslator.from(config$e);
34152
- const generateV2HandlerEntity = (handlerName, translator2) => ({
34153
- handlerName,
34154
- handler: (params2) => {
34155
- const { nodes } = params2;
34156
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
34157
- return { nodes: [], consumed: 0 };
34158
- }
34159
- const result = translator2.encode(params2);
34160
- if (!result) return { nodes: [], consumed: 0 };
34161
- return {
34162
- nodes: Array.isArray(result) ? result : [result],
34163
- consumed: 1
34164
- };
34165
- }
34166
- });
34167
- function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
34168
- if (!sdName) sdName = xmlName.split(":")[1];
34169
- if (!transformEncode) transformEncode = (v2) => v2;
34170
- if (!transformDecode) transformDecode = (v2) => v2;
34171
- return {
34172
- xmlName,
34173
- sdNodeOrKeyName: sdName,
34174
- encode: ({ nodes }) => {
34175
- return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
34176
- },
34177
- decode: ({ node }) => {
34178
- const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
34179
- return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
34180
- }
34181
- };
34182
- }
34183
- function createMeasurementPropertyHandler(xmlName, sdName = null) {
34184
- if (!sdName) sdName = xmlName.split(":")[1];
34185
- return {
34186
- xmlName,
34187
- sdNodeOrKeyName: sdName,
34188
- attributes: [
34189
- createAttributeHandler("w:w", "value", parseInteger, integerToString),
34190
- createAttributeHandler("w:type")
34191
- ],
34192
- encode: (_2, encodedAttrs) => {
34193
- return encodedAttrs["value"] != null ? encodedAttrs : void 0;
34194
- },
34195
- decode: function({ node }) {
34196
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
34197
- return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
34198
- }
34199
- };
34200
- }
34201
- function createBorderPropertyHandler(xmlName, sdName = null) {
34202
- if (!sdName) sdName = xmlName.split(":")[1];
34203
- return {
34204
- xmlName,
34205
- sdNodeOrKeyName: sdName,
34206
- attributes: [
34207
- createAttributeHandler("w:val"),
34208
- createAttributeHandler("w:color"),
34209
- createAttributeHandler("w:themeColor"),
34210
- createAttributeHandler("w:themeTint"),
34211
- createAttributeHandler("w:themeShade"),
34212
- createAttributeHandler("w:sz", "size", parseInteger, integerToString),
34213
- createAttributeHandler("w:space", null, parseInteger, integerToString),
34214
- createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
34215
- createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
34216
- ],
34217
- encode: (params2, encodedAttrs) => {
34218
- return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
34219
- },
34220
- decode: function({ node }, context) {
34221
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
34222
- return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
34223
- }
34224
- };
34225
- }
34226
- const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
34227
- if (!transformEncode) transformEncode = (v2) => v2;
34228
- if (!transformDecode) transformDecode = (v2) => v2;
34229
- if (!sdName) sdName = xmlName.split(":")[1];
34230
- return {
34231
- xmlName,
34232
- sdName,
34233
- encode: (attributes) => transformEncode(attributes[xmlName]),
34234
- decode: (attributes) => transformDecode(attributes[sdName])
34235
- };
34236
- };
34237
- function encodeProperties(node, translatorsByXmlName, asArray = false) {
34238
- if (!node?.elements || node.elements.length === 0) {
34239
- return asArray ? [] : {};
34240
- }
34241
- const attributes = asArray ? [] : {};
34242
- node.elements.forEach((el) => {
34243
- const translator2 = translatorsByXmlName[el.name];
34244
- if (translator2) {
34245
- const encodedAttr = translator2.encode({ nodes: [el] });
34246
- if (encodedAttr != null) {
34247
- if (asArray) {
34248
- attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
34249
- } else {
34250
- attributes[translator2.sdNodeOrKeyName] = encodedAttr;
34251
- }
34252
- }
34253
- }
34254
- });
34255
- return attributes;
34256
- }
34257
- function decodeProperties(translatorsBySdName, properties) {
34258
- if (!properties || typeof properties !== "object") {
34259
- return [];
34260
- }
34261
- const elements = [];
34262
- Object.keys(properties).forEach((key2) => {
34263
- const translator2 = translatorsBySdName[key2];
34264
- if (translator2) {
34265
- const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
34266
- if (result != null) {
34267
- result.name = translator2.xmlName;
34268
- elements.push(result);
34269
- }
34270
- }
34271
- });
34272
- return elements;
34273
- }
34274
- const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
34275
- const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
34276
- const parseInteger = (value) => {
34277
- if (value == null) return void 0;
34278
- const intValue = parseInt(value, 10);
34279
- return isNaN(intValue) ? void 0 : intValue;
34280
- };
34281
- const integerToString = (value) => {
34282
- const intValue = parseInteger(value);
34283
- return intValue != void 0 ? String(intValue) : void 0;
34390
+ encode: encode$o,
34391
+ decode: decode$o,
34392
+ attributes: validXmlAttributes$9
34284
34393
  };
34394
+ const translator$V = NodeTranslator.from(config$f);
34285
34395
  function preProcessVerticalMergeCells(table, { editorSchema }) {
34286
34396
  if (!table || !Array.isArray(table.content)) {
34287
34397
  return table;
@@ -34322,13 +34432,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34322
34432
  }
34323
34433
  return table;
34324
34434
  }
34325
- const translator$T = NodeTranslator.from({
34435
+ const translator$U = NodeTranslator.from({
34326
34436
  xmlName: "w:cantSplit",
34327
34437
  sdNodeOrKeyName: "cantSplit",
34328
34438
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
34329
34439
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
34330
34440
  });
34331
- const translator$S = NodeTranslator.from({
34441
+ const translator$T = NodeTranslator.from({
34332
34442
  xmlName: "w:cnfStyle",
34333
34443
  sdNodeOrKeyName: "cnfStyle",
34334
34444
  attributes: [
@@ -34354,8 +34464,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34354
34464
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
34355
34465
  }
34356
34466
  });
34357
- const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
34358
- const translator$Q = NodeTranslator.from(
34467
+ const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
34468
+ const translator$R = NodeTranslator.from(
34359
34469
  createSingleAttrPropertyHandler(
34360
34470
  "w:gridAfter",
34361
34471
  null,
@@ -34364,7 +34474,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34364
34474
  (v2) => integerToString(v2)
34365
34475
  )
34366
34476
  );
34367
- const translator$P = NodeTranslator.from(
34477
+ const translator$Q = NodeTranslator.from(
34368
34478
  createSingleAttrPropertyHandler(
34369
34479
  "w:gridBefore",
34370
34480
  null,
@@ -34373,21 +34483,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34373
34483
  (v2) => integerToString(v2)
34374
34484
  )
34375
34485
  );
34376
- const translator$O = NodeTranslator.from({
34486
+ const translator$P = NodeTranslator.from({
34377
34487
  xmlName: "w:hidden",
34378
34488
  sdNodeOrKeyName: "hidden",
34379
34489
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
34380
34490
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
34381
34491
  });
34382
- const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
34383
- const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
34384
- const translator$L = NodeTranslator.from({
34492
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
34493
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
34494
+ const translator$M = NodeTranslator.from({
34385
34495
  xmlName: "w:tblHeader",
34386
34496
  sdNodeOrKeyName: "repeatHeader",
34387
34497
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
34388
34498
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
34389
34499
  });
34390
- const translator$K = NodeTranslator.from({
34500
+ const translator$L = NodeTranslator.from({
34391
34501
  xmlName: "w:trHeight",
34392
34502
  sdNodeOrKeyName: "rowHeight",
34393
34503
  encode: ({ nodes }) => {
@@ -34414,11 +34524,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34414
34524
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
34415
34525
  }
34416
34526
  });
34417
- const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
34418
- const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
34419
- const XML_NODE_NAME$f = "w:trPr";
34527
+ const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
34528
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
34529
+ const XML_NODE_NAME$g = "w:trPr";
34420
34530
  const SD_ATTR_KEY$4 = "tableRowProperties";
34421
- const encode$m = (params2) => {
34531
+ const encode$n = (params2) => {
34422
34532
  const { nodes } = params2;
34423
34533
  const node = nodes[0];
34424
34534
  let attributes = {
@@ -34432,12 +34542,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34432
34542
  };
34433
34543
  return {
34434
34544
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
34435
- xmlName: XML_NODE_NAME$f,
34545
+ xmlName: XML_NODE_NAME$g,
34436
34546
  sdNodeOrKeyName: SD_ATTR_KEY$4,
34437
34547
  attributes
34438
34548
  };
34439
34549
  };
34440
- const decode$m = (params2) => {
34550
+ const decode$n = (params2) => {
34441
34551
  const { tableRowProperties = {} } = params2.node.attrs || {};
34442
34552
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
34443
34553
  const newNode = {
@@ -34449,6 +34559,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34449
34559
  return newNode;
34450
34560
  };
34451
34561
  const propertyTranslators$3 = [
34562
+ translator$U,
34452
34563
  translator$T,
34453
34564
  translator$S,
34454
34565
  translator$R,
@@ -34459,8 +34570,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34459
34570
  translator$M,
34460
34571
  translator$L,
34461
34572
  translator$K,
34462
- translator$J,
34463
- translator$I
34573
+ translator$J
34464
34574
  ];
34465
34575
  const propertyTranslatorsByXmlName$2 = {};
34466
34576
  propertyTranslators$3.forEach((translator2) => {
@@ -34470,25 +34580,25 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34470
34580
  propertyTranslators$3.forEach((translator2) => {
34471
34581
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
34472
34582
  });
34473
- const config$d = {
34474
- xmlName: XML_NODE_NAME$f,
34583
+ const config$e = {
34584
+ xmlName: XML_NODE_NAME$g,
34475
34585
  sdNodeOrKeyName: SD_ATTR_KEY$4,
34476
34586
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
34477
- encode: encode$m,
34478
- decode: decode$m
34587
+ encode: encode$n,
34588
+ decode: decode$n
34479
34589
  };
34480
- const translator$H = NodeTranslator.from(config$d);
34481
- const XML_NODE_NAME$e = "w:tr";
34482
- const SD_NODE_NAME$a = "tableRow";
34483
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
34590
+ const translator$I = NodeTranslator.from(config$e);
34591
+ const XML_NODE_NAME$f = "w:tr";
34592
+ const SD_NODE_NAME$b = "tableRow";
34593
+ const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
34484
34594
  (xmlName) => createAttributeHandler(xmlName)
34485
34595
  );
34486
- const encode$l = (params2, encodedAttrs) => {
34596
+ const encode$m = (params2, encodedAttrs) => {
34487
34597
  const { row } = params2.extraParams;
34488
34598
  let tableRowProperties = {};
34489
34599
  const tPr = row.elements.find((el) => el.name === "w:trPr");
34490
34600
  if (tPr) {
34491
- ({ attributes: tableRowProperties } = translator$H.encode({
34601
+ ({ attributes: tableRowProperties } = translator$I.encode({
34492
34602
  ...params2,
34493
34603
  nodes: [tPr]
34494
34604
  }));
@@ -34501,7 +34611,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34501
34611
  let currentColumnIndex = 0;
34502
34612
  const content = cellNodes?.map((n) => {
34503
34613
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
34504
- const result = translator$8.encode({
34614
+ const result = translator$9.encode({
34505
34615
  ...params2,
34506
34616
  extraParams: {
34507
34617
  ...params2.extraParams,
@@ -34523,7 +34633,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34523
34633
  };
34524
34634
  return newNode;
34525
34635
  };
34526
- const decode$l = (params2, decodedAttrs) => {
34636
+ const decode$m = (params2, decodedAttrs) => {
34527
34637
  const { node } = params2;
34528
34638
  const elements = translateChildNodes(params2);
34529
34639
  if (node.attrs?.tableRowProperties) {
@@ -34535,7 +34645,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34535
34645
  }
34536
34646
  }
34537
34647
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
34538
- const trPr = translator$H.decode({
34648
+ const trPr = translator$I.decode({
34539
34649
  ...params2,
34540
34650
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
34541
34651
  });
@@ -34547,22 +34657,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34547
34657
  elements
34548
34658
  };
34549
34659
  };
34550
- const config$c = {
34551
- xmlName: XML_NODE_NAME$e,
34552
- sdNodeOrKeyName: SD_NODE_NAME$a,
34660
+ const config$d = {
34661
+ xmlName: XML_NODE_NAME$f,
34662
+ sdNodeOrKeyName: SD_NODE_NAME$b,
34553
34663
  type: NodeTranslator.translatorTypes.NODE,
34554
- encode: encode$l,
34555
- decode: decode$l,
34556
- attributes: validXmlAttributes$9
34664
+ encode: encode$m,
34665
+ decode: decode$m,
34666
+ attributes: validXmlAttributes$8
34557
34667
  };
34558
- const translator$G = NodeTranslator.from(config$c);
34559
- const translator$F = NodeTranslator.from({
34668
+ const translator$H = NodeTranslator.from(config$d);
34669
+ const translator$G = NodeTranslator.from({
34560
34670
  xmlName: "w:bidiVisual",
34561
34671
  sdNodeOrKeyName: "rightToLeft",
34562
34672
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
34563
34673
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
34564
34674
  });
34565
- const translator$E = NodeTranslator.from({
34675
+ const translator$F = NodeTranslator.from({
34566
34676
  xmlName: "w:shd",
34567
34677
  sdNodeOrKeyName: "shading",
34568
34678
  attributes: [
@@ -34584,11 +34694,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34584
34694
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
34585
34695
  }
34586
34696
  });
34587
- const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
34588
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
34589
- const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
34590
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
34591
- const translator$z = NodeTranslator.from({
34697
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
34698
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
34699
+ const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
34700
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
34701
+ const translator$A = NodeTranslator.from({
34592
34702
  xmlName: "w:tblLook",
34593
34703
  sdNodeOrKeyName: "tblLook",
34594
34704
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -34600,16 +34710,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34600
34710
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
34601
34711
  }
34602
34712
  });
34603
- const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
34604
- const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
34605
- const translator$w = NodeTranslator.from(
34713
+ const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
34714
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
34715
+ const translator$x = NodeTranslator.from(
34606
34716
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
34607
34717
  );
34608
- const translator$v = NodeTranslator.from(
34718
+ const translator$w = NodeTranslator.from(
34609
34719
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
34610
34720
  );
34611
- const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
34612
- const translator$t = NodeTranslator.from({
34721
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
34722
+ const translator$u = NodeTranslator.from({
34613
34723
  xmlName: "w:tblpPr",
34614
34724
  sdNodeOrKeyName: "floatingTableProperties",
34615
34725
  attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
@@ -34621,29 +34731,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34621
34731
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
34622
34732
  }
34623
34733
  });
34624
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
34625
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
34626
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
34627
- const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
34628
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
34629
- const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
34630
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
34631
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
34632
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
34633
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
34634
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
34635
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
34636
- const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
34637
- const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
34638
- const XML_NODE_NAME$d = "w:tblBorders";
34734
+ const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
34735
+ const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
34736
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
34737
+ const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
34738
+ const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
34739
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
34740
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
34741
+ const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
34742
+ const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
34743
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
34744
+ const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
34745
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
34746
+ const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
34747
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
34748
+ const XML_NODE_NAME$e = "w:tblBorders";
34639
34749
  const SD_ATTR_KEY$3 = "borders";
34640
- const encode$k = (params2) => {
34750
+ const encode$l = (params2) => {
34641
34751
  const { nodes } = params2;
34642
34752
  const node = nodes[0];
34643
34753
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
34644
34754
  return Object.keys(attributes).length > 0 ? attributes : void 0;
34645
34755
  };
34646
- const decode$k = (params2) => {
34756
+ const decode$l = (params2) => {
34647
34757
  const { borders = {} } = params2.node.attrs || {};
34648
34758
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
34649
34759
  const newNode = {
@@ -34655,14 +34765,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34655
34765
  return newNode;
34656
34766
  };
34657
34767
  const propertyTranslators$2 = [
34658
- translator$s,
34659
- translator$q,
34768
+ translator$t,
34769
+ translator$r,
34770
+ translator$p,
34660
34771
  translator$o,
34661
34772
  translator$n,
34662
- translator$m,
34663
- translator$k,
34664
- translator$i,
34665
- translator$g
34773
+ translator$l,
34774
+ translator$j,
34775
+ translator$h
34666
34776
  ];
34667
34777
  const tblBordersTranslatorsByXmlName = {};
34668
34778
  const tblBordersTranslatorsBySdName = {};
@@ -34670,27 +34780,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34670
34780
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
34671
34781
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
34672
34782
  });
34673
- const translator$e = NodeTranslator.from({
34674
- xmlName: XML_NODE_NAME$d,
34783
+ const translator$f = NodeTranslator.from({
34784
+ xmlName: XML_NODE_NAME$e,
34675
34785
  sdNodeOrKeyName: SD_ATTR_KEY$3,
34676
34786
  type: NodeTranslator.translatorTypes.NODE,
34677
34787
  attributes: [],
34678
- encode: encode$k,
34679
- decode: decode$k
34788
+ encode: encode$l,
34789
+ decode: decode$l
34680
34790
  });
34681
- const XML_NODE_NAME$c = "w:tblCellMar";
34791
+ const XML_NODE_NAME$d = "w:tblCellMar";
34682
34792
  const SD_ATTR_KEY$2 = "cellMargins";
34683
- const encode$j = (params2) => {
34793
+ const encode$k = (params2) => {
34684
34794
  const { nodes } = params2;
34685
34795
  const node = nodes[0];
34686
34796
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
34687
34797
  return Object.keys(attributes).length > 0 ? attributes : void 0;
34688
34798
  };
34689
- const decode$j = (params2) => {
34799
+ const decode$k = (params2) => {
34690
34800
  const { cellMargins = {} } = params2.node.attrs || {};
34691
34801
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
34692
34802
  const newNode = {
34693
- name: XML_NODE_NAME$c,
34803
+ name: XML_NODE_NAME$d,
34694
34804
  type: "element",
34695
34805
  attributes: {},
34696
34806
  elements
@@ -34698,12 +34808,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34698
34808
  return newNode;
34699
34809
  };
34700
34810
  const propertyTranslators$1 = [
34701
- translator$r,
34702
- translator$p,
34703
- translator$l,
34704
- translator$j,
34705
- translator$h,
34706
- translator$f
34811
+ translator$s,
34812
+ translator$q,
34813
+ translator$m,
34814
+ translator$k,
34815
+ translator$i,
34816
+ translator$g
34707
34817
  ];
34708
34818
  const propertyTranslatorsByXmlName$1 = {};
34709
34819
  const propertyTranslatorsBySdName$1 = {};
@@ -34711,27 +34821,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34711
34821
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
34712
34822
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
34713
34823
  });
34714
- const translator$d = NodeTranslator.from({
34715
- xmlName: XML_NODE_NAME$c,
34824
+ const translator$e = NodeTranslator.from({
34825
+ xmlName: XML_NODE_NAME$d,
34716
34826
  sdNodeOrKeyName: SD_ATTR_KEY$2,
34717
34827
  type: NodeTranslator.translatorTypes.NODE,
34718
34828
  attributes: [],
34719
- encode: encode$j,
34720
- decode: decode$j
34829
+ encode: encode$k,
34830
+ decode: decode$k
34721
34831
  });
34722
- const XML_NODE_NAME$b = "w:tblPr";
34832
+ const XML_NODE_NAME$c = "w:tblPr";
34723
34833
  const SD_ATTR_KEY$1 = "tableProperties";
34724
- const encode$i = (params2) => {
34834
+ const encode$j = (params2) => {
34725
34835
  const { nodes } = params2;
34726
34836
  const node = nodes[0];
34727
34837
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
34728
34838
  return {
34729
- xmlName: XML_NODE_NAME$b,
34839
+ xmlName: XML_NODE_NAME$c,
34730
34840
  sdNodeOrKeyName: SD_ATTR_KEY$1,
34731
34841
  attributes
34732
34842
  };
34733
34843
  };
34734
- const decode$i = (params2) => {
34844
+ const decode$j = (params2) => {
34735
34845
  const { tableProperties = {} } = params2.node.attrs || {};
34736
34846
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
34737
34847
  const newNode = {
@@ -34743,11 +34853,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34743
34853
  return newNode;
34744
34854
  };
34745
34855
  const propertyTranslators = [
34856
+ translator$G,
34857
+ translator$O,
34746
34858
  translator$F,
34747
- translator$N,
34748
34859
  translator$E,
34860
+ translator$N,
34749
34861
  translator$D,
34750
- translator$M,
34751
34862
  translator$C,
34752
34863
  translator$B,
34753
34864
  translator$A,
@@ -34757,9 +34868,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34757
34868
  translator$w,
34758
34869
  translator$v,
34759
34870
  translator$u,
34760
- translator$t,
34761
- translator$e,
34762
- translator$d
34871
+ translator$f,
34872
+ translator$e
34763
34873
  ];
34764
34874
  const propertyTranslatorsByXmlName = {};
34765
34875
  const propertyTranslatorsBySdName = {};
@@ -34767,14 +34877,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34767
34877
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
34768
34878
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
34769
34879
  });
34770
- const config$b = {
34771
- xmlName: XML_NODE_NAME$b,
34880
+ const config$c = {
34881
+ xmlName: XML_NODE_NAME$c,
34772
34882
  sdNodeOrKeyName: SD_ATTR_KEY$1,
34773
- encode: encode$i,
34774
- decode: decode$i
34883
+ encode: encode$j,
34884
+ decode: decode$j
34775
34885
  };
34776
- const translator$c = NodeTranslator.from(config$b);
34777
- const translator$b = NodeTranslator.from(
34886
+ const translator$d = NodeTranslator.from(config$c);
34887
+ const translator$c = NodeTranslator.from(
34778
34888
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
34779
34889
  );
34780
34890
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -34824,20 +34934,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34824
34934
  }
34825
34935
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
34826
34936
  };
34827
- const XML_NODE_NAME$a = "w:tblGrid";
34937
+ const XML_NODE_NAME$b = "w:tblGrid";
34828
34938
  const SD_ATTR_KEY = "grid";
34829
34939
  const cellMinWidth = pixelsToTwips(10);
34830
- const encode$h = (params2) => {
34940
+ const encode$i = (params2) => {
34831
34941
  const { nodes } = params2;
34832
34942
  const node = nodes[0];
34833
- const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
34943
+ const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
34834
34944
  return {
34835
- xmlName: XML_NODE_NAME$a,
34945
+ xmlName: XML_NODE_NAME$b,
34836
34946
  sdNodeOrKeyName: SD_ATTR_KEY,
34837
34947
  attributes
34838
34948
  };
34839
34949
  };
34840
- const decode$h = (params2) => {
34950
+ const decode$i = (params2) => {
34841
34951
  const { grid: rawGrid } = params2.node.attrs || {};
34842
34952
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
34843
34953
  const { firstRow = {} } = params2.extraParams || {};
@@ -34856,10 +34966,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34856
34966
  numericWidth = fallbackColumnWidthTwips;
34857
34967
  }
34858
34968
  numericWidth = Math.max(numericWidth, cellMinWidth);
34859
- const decoded = translator$b.decode({
34969
+ const decoded = translator$c.decode({
34860
34970
  node: { type: (
34861
34971
  /** @type {string} */
34862
- translator$b.sdNodeOrKeyName
34972
+ translator$c.sdNodeOrKeyName
34863
34973
  ), attrs: { col: numericWidth } }
34864
34974
  });
34865
34975
  if (decoded) elements.push(decoded);
@@ -34894,19 +35004,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34894
35004
  columnIndex++;
34895
35005
  }
34896
35006
  const newNode = {
34897
- name: XML_NODE_NAME$a,
35007
+ name: XML_NODE_NAME$b,
34898
35008
  attributes: {},
34899
35009
  elements
34900
35010
  };
34901
35011
  return newNode;
34902
35012
  };
34903
- const config$a = {
34904
- xmlName: XML_NODE_NAME$a,
35013
+ const config$b = {
35014
+ xmlName: XML_NODE_NAME$b,
34905
35015
  sdNodeOrKeyName: SD_ATTR_KEY,
34906
- encode: encode$h,
34907
- decode: decode$h
35016
+ encode: encode$i,
35017
+ decode: decode$i
34908
35018
  };
34909
- const translator$a = NodeTranslator.from(config$a);
35019
+ const translator$b = NodeTranslator.from(config$b);
34910
35020
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
34911
35021
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
34912
35022
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -34969,19 +35079,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34969
35079
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
34970
35080
  };
34971
35081
  };
34972
- const XML_NODE_NAME$9 = "w:tbl";
34973
- const SD_NODE_NAME$9 = "table";
34974
- const encode$g = (params2, encodedAttrs) => {
35082
+ const XML_NODE_NAME$a = "w:tbl";
35083
+ const SD_NODE_NAME$a = "table";
35084
+ const encode$h = (params2, encodedAttrs) => {
34975
35085
  const { nodes } = params2;
34976
35086
  const node = nodes[0];
34977
35087
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
34978
35088
  if (tblPr) {
34979
- const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
35089
+ const encodedProperties = translator$d.encode({ ...params2, nodes: [tblPr] });
34980
35090
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
34981
35091
  }
34982
35092
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
34983
35093
  if (tblGrid) {
34984
- encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
35094
+ encodedAttrs["grid"] = translator$b.encode({ ...params2, nodes: [tblGrid] }).attributes;
34985
35095
  }
34986
35096
  [
34987
35097
  "tableStyleId",
@@ -35048,7 +35158,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35048
35158
  }
35049
35159
  const content = [];
35050
35160
  rows.forEach((row) => {
35051
- const result = translator$G.encode({
35161
+ const result = translator$H.encode({
35052
35162
  ...params2,
35053
35163
  nodes: [row],
35054
35164
  extraParams: {
@@ -35067,13 +35177,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35067
35177
  attrs: encodedAttrs
35068
35178
  };
35069
35179
  };
35070
- const decode$g = (params2, decodedAttrs) => {
35180
+ const decode$h = (params2, decodedAttrs) => {
35071
35181
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
35072
35182
  const { node } = params2;
35073
35183
  const elements = translateChildNodes(params2);
35074
35184
  const firstRow = node.content?.find((n) => n.type === "tableRow");
35075
35185
  const properties = node.attrs.grid;
35076
- const element = translator$a.decode({
35186
+ const element = translator$b.decode({
35077
35187
  ...params2,
35078
35188
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
35079
35189
  extraParams: {
@@ -35083,7 +35193,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35083
35193
  if (element) elements.unshift(element);
35084
35194
  if (node.attrs?.tableProperties) {
35085
35195
  const properties2 = { ...node.attrs.tableProperties };
35086
- const element2 = translator$c.decode({
35196
+ const element2 = translator$d.decode({
35087
35197
  ...params2,
35088
35198
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
35089
35199
  });
@@ -35149,7 +35259,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35149
35259
  if (baseTblPr && baseTblPr.elements) {
35150
35260
  tblPr.elements.push(...baseTblPr.elements);
35151
35261
  }
35152
- const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
35262
+ const tableProperties = translator$d.encode({ ...params2, nodes: [tblPr] }).attributes;
35153
35263
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
35154
35264
  if (borders) stylesToReturn.borders = borders;
35155
35265
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -35166,16 +35276,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35166
35276
  }
35167
35277
  return stylesToReturn;
35168
35278
  }
35169
- const config$9 = {
35170
- xmlName: XML_NODE_NAME$9,
35171
- sdNodeOrKeyName: SD_NODE_NAME$9,
35279
+ const config$a = {
35280
+ xmlName: XML_NODE_NAME$a,
35281
+ sdNodeOrKeyName: SD_NODE_NAME$a,
35172
35282
  type: NodeTranslator.translatorTypes.NODE,
35173
- encode: encode$g,
35174
- decode: decode$g,
35283
+ encode: encode$h,
35284
+ decode: decode$h,
35175
35285
  attributes: []
35176
35286
  };
35177
- const translator$9 = NodeTranslator.from(config$9);
35178
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
35287
+ const translator$a = NodeTranslator.from(config$a);
35288
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
35179
35289
  function getReferencedTableStyles(tblStyleTag, docx) {
35180
35290
  if (!tblStyleTag) return null;
35181
35291
  const stylesToReturn = {};
@@ -35537,10 +35647,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35537
35647
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
35538
35648
  return elements;
35539
35649
  }
35540
- const XML_NODE_NAME$8 = "w:tc";
35541
- const SD_NODE_NAME$8 = "tableCell";
35542
- const validXmlAttributes$8 = [];
35543
- function encode$f(params2, encodedAttrs) {
35650
+ const XML_NODE_NAME$9 = "w:tc";
35651
+ const SD_NODE_NAME$9 = "tableCell";
35652
+ const validXmlAttributes$7 = [];
35653
+ function encode$g(params2, encodedAttrs) {
35544
35654
  const {
35545
35655
  node,
35546
35656
  table,
@@ -35567,162 +35677,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35567
35677
  }
35568
35678
  return schemaNode;
35569
35679
  }
35570
- function decode$f(params2, decodedAttrs) {
35680
+ function decode$g(params2, decodedAttrs) {
35571
35681
  const translated = translateTableCell(params2);
35572
35682
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
35573
35683
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
35574
35684
  }
35575
35685
  return translated;
35576
35686
  }
35577
- const config$8 = {
35578
- xmlName: XML_NODE_NAME$8,
35579
- sdNodeOrKeyName: SD_NODE_NAME$8,
35580
- type: NodeTranslator.translatorTypes.NODE,
35581
- encode: encode$f,
35582
- decode: decode$f,
35583
- attributes: validXmlAttributes$8
35584
- };
35585
- const translator$8 = NodeTranslator.from(config$8);
35586
- const XML_NODE_NAME$7 = "w:hyperlink";
35587
- const SD_NODE_NAME$7 = "link";
35588
- const _createAttributeHandler = (xmlName, sdName) => ({
35589
- xmlName,
35590
- sdName,
35591
- encode: (attributes) => attributes[xmlName],
35592
- decode: (attributes) => attributes[sdName]
35593
- });
35594
- const validXmlAttributes$7 = [
35595
- _createAttributeHandler("w:anchor", "anchor"),
35596
- _createAttributeHandler("w:docLocation", "docLocation"),
35597
- {
35598
- xmlName: "w:history",
35599
- sdName: "history",
35600
- encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
35601
- decode: (attributes) => attributes["history"] ? "1" : "0"
35602
- },
35603
- _createAttributeHandler("w:tooltip", "tooltip"),
35604
- _createAttributeHandler("r:id", "rId"),
35605
- _createAttributeHandler("w:tgtFrame", "target")
35606
- ];
35607
- const encode$e = (params2, encodedAttrs) => {
35608
- const { nodes, docx, nodeListHandler } = params2;
35609
- const node = nodes[0];
35610
- let href = _resolveHref(docx, encodedAttrs);
35611
- const linkMark = { attrs: { ...encodedAttrs, href } };
35612
- const runNodes = node.elements.filter((el) => el.name === "w:r");
35613
- runNodes.forEach((runNode) => {
35614
- const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
35615
- const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
35616
- runNode.marks = runMarksWithoutLink;
35617
- });
35618
- const updatedNode = nodeListHandler.handler({
35619
- ...params2,
35620
- nodes: runNodes,
35621
- path: [...params2.path || [], node]
35622
- });
35623
- const cloneMark2 = (mark) => {
35624
- if (!mark || typeof mark !== "object") return mark;
35625
- if (!mark.attrs) return { ...mark };
35626
- return { ...mark, attrs: { ...mark.attrs } };
35627
- };
35628
- const ensureLinkMark = (child) => {
35629
- if (!child || typeof child !== "object") return child;
35630
- if (Array.isArray(child.content)) {
35631
- const updatedContent = child.content.map((item) => ensureLinkMark(item));
35632
- if (updatedContent !== child.content) {
35633
- child = { ...child, content: updatedContent };
35634
- }
35635
- }
35636
- if (child.type === "run") {
35637
- const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
35638
- const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
35639
- if (filteredMarks.length !== existingMarks2.length) {
35640
- if (filteredMarks.length) child = { ...child, marks: filteredMarks };
35641
- else {
35642
- const { marks: _removedMarks, ...rest } = child;
35643
- child = rest;
35644
- }
35645
- }
35646
- return child;
35647
- }
35648
- if (child.type !== "text") return child;
35649
- const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
35650
- const hasLink = existingMarks.some((mark) => mark?.type === "link");
35651
- if (hasLink) return child;
35652
- const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
35653
- return { ...child, marks: [...existingMarks, linkClone] };
35654
- };
35655
- if (!Array.isArray(updatedNode)) return updatedNode;
35656
- return updatedNode.map((child) => ensureLinkMark(child));
35657
- };
35658
- const _resolveHref = (docx, encodedAttrs) => {
35659
- const rels = docx["word/_rels/document.xml.rels"];
35660
- const relationships = rels.elements.find((el) => el.name === "Relationships");
35661
- const { elements } = relationships;
35662
- const { rId, anchor } = encodedAttrs;
35663
- let href;
35664
- if (!rId && anchor) {
35665
- href = `#${anchor}`;
35666
- } else if (rId) {
35667
- const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
35668
- const { attributes: relAttributes = {} } = rel;
35669
- href = relAttributes["Target"];
35670
- }
35671
- return href;
35672
- };
35673
- function decode$e(params2) {
35674
- const { node } = params2;
35675
- const linkMark = node.marks.find((m2) => m2.type === "link");
35676
- const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
35677
- let { anchor, href: link } = linkMark.attrs;
35678
- const isExternalLink = !anchor;
35679
- if (isExternalLink) {
35680
- linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
35681
- }
35682
- node.marks = node.marks.filter((m2) => m2.type !== "link");
35683
- const outputNode = exportSchemaToJson({ ...params2, node });
35684
- const newNode = {
35685
- name: "w:hyperlink",
35686
- type: "element",
35687
- attributes: {
35688
- ...linkAttrs
35689
- },
35690
- elements: [outputNode]
35691
- };
35692
- return newNode;
35693
- }
35694
- function _addNewLinkRelationship(params2, link, rId) {
35695
- if (!rId) rId = generateDocxRandomId();
35696
- if (!params2.relationships || !Array.isArray(params2.relationships)) {
35697
- params2.relationships = [];
35698
- }
35699
- const existingRel = params2.relationships.find(
35700
- (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
35701
- );
35702
- if (existingRel) {
35703
- return rId;
35704
- }
35705
- params2.relationships.push({
35706
- type: "element",
35707
- name: "Relationship",
35708
- attributes: {
35709
- Id: rId,
35710
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
35711
- Target: link,
35712
- TargetMode: "External"
35713
- }
35714
- });
35715
- return rId;
35716
- }
35717
- const config$7 = {
35718
- xmlName: XML_NODE_NAME$7,
35719
- sdNodeOrKeyName: SD_NODE_NAME$7,
35687
+ const config$9 = {
35688
+ xmlName: XML_NODE_NAME$9,
35689
+ sdNodeOrKeyName: SD_NODE_NAME$9,
35720
35690
  type: NodeTranslator.translatorTypes.NODE,
35721
- encode: encode$e,
35722
- decode: decode$e,
35691
+ encode: encode$g,
35692
+ decode: decode$g,
35723
35693
  attributes: validXmlAttributes$7
35724
35694
  };
35725
- const translator$7 = NodeTranslator.from(config$7);
35695
+ const translator$9 = NodeTranslator.from(config$9);
35726
35696
  function parseTagValueJSON(json) {
35727
35697
  if (typeof json !== "string") {
35728
35698
  return {};
@@ -35858,12 +35828,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35858
35828
  }
35859
35829
  const content = node?.elements.find((el) => el.name === "w:sdtContent");
35860
35830
  const handler2 = validGalleryTypeMap[docPartGalleryType];
35861
- const result = handler2({ ...params2, nodes: [content] });
35831
+ const result = handler2({
35832
+ ...params2,
35833
+ nodes: [content],
35834
+ extraParams: { ...params2.extraParams || {}, sdtPr }
35835
+ });
35862
35836
  return result;
35863
35837
  }
35864
35838
  const tableOfContentsHandler = (params2) => {
35865
35839
  const node = params2.nodes[0];
35866
- return params2.nodeListHandler.handler({ ...params2, nodes: node.elements });
35840
+ const translatedContent = params2.nodeListHandler.handler({
35841
+ ...params2,
35842
+ nodes: node.elements,
35843
+ path: [...params2.path || [], node]
35844
+ });
35845
+ const sdtPr = params2.extraParams.sdtPr;
35846
+ const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
35847
+ const result = {
35848
+ type: "documentPartObject",
35849
+ content: translatedContent,
35850
+ attrs: {
35851
+ id,
35852
+ docPartGallery: "Table of Contents",
35853
+ docPartUnique: true
35854
+ }
35855
+ };
35856
+ return result;
35867
35857
  };
35868
35858
  const validGalleryTypeMap = {
35869
35859
  "Table of Contents": tableOfContentsHandler
@@ -36521,32 +36511,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36521
36511
  elements: [...anchorElements, ...elementsWithWrap]
36522
36512
  };
36523
36513
  }
36524
- const XML_NODE_NAME$6 = "wp:anchor";
36525
- const SD_NODE_NAME$6 = ["image"];
36514
+ const XML_NODE_NAME$8 = "wp:anchor";
36515
+ const SD_NODE_NAME$8 = ["image"];
36526
36516
  const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36527
- function encode$d(params2) {
36517
+ function encode$f(params2) {
36528
36518
  const { node } = params2.extraParams;
36529
36519
  if (!node || !node.type) {
36530
36520
  return null;
36531
36521
  }
36532
36522
  return handleAnchorNode(params2);
36533
36523
  }
36534
- function decode$d(params2) {
36524
+ function decode$f(params2) {
36535
36525
  const { node } = params2;
36536
36526
  if (!node || !node.type) {
36537
36527
  return null;
36538
36528
  }
36539
36529
  return translateAnchorNode(params2);
36540
36530
  }
36541
- const config$6 = {
36542
- xmlName: XML_NODE_NAME$6,
36543
- sdNodeOrKeyName: SD_NODE_NAME$6,
36531
+ const config$8 = {
36532
+ xmlName: XML_NODE_NAME$8,
36533
+ sdNodeOrKeyName: SD_NODE_NAME$8,
36544
36534
  type: NodeTranslator.translatorTypes.NODE,
36545
- encode: encode$d,
36546
- decode: decode$d,
36535
+ encode: encode$f,
36536
+ decode: decode$f,
36547
36537
  attributes: validXmlAttributes$6
36548
36538
  };
36549
- const translator$6 = NodeTranslator.from(config$6);
36539
+ const translator$8 = NodeTranslator.from(config$8);
36550
36540
  function handleInlineNode(params2) {
36551
36541
  const { node } = params2.extraParams;
36552
36542
  if (node.name !== "wp:inline") {
@@ -36562,41 +36552,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36562
36552
  elements: nodeElements.elements
36563
36553
  };
36564
36554
  }
36565
- const XML_NODE_NAME$5 = "wp:inline";
36566
- const SD_NODE_NAME$5 = ["image"];
36555
+ const XML_NODE_NAME$7 = "wp:inline";
36556
+ const SD_NODE_NAME$7 = ["image"];
36567
36557
  const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36568
- function encode$c(params2) {
36558
+ function encode$e(params2) {
36569
36559
  const { node } = params2.extraParams;
36570
36560
  if (!node || !node.type) {
36571
36561
  return null;
36572
36562
  }
36573
36563
  return handleInlineNode(params2);
36574
36564
  }
36575
- function decode$c(params2) {
36565
+ function decode$e(params2) {
36576
36566
  const { node } = params2;
36577
36567
  if (!node || !node.type) {
36578
36568
  return null;
36579
36569
  }
36580
36570
  return translateInlineNode(params2);
36581
36571
  }
36582
- const config$5 = {
36583
- xmlName: XML_NODE_NAME$5,
36584
- sdNodeOrKeyName: SD_NODE_NAME$5,
36572
+ const config$7 = {
36573
+ xmlName: XML_NODE_NAME$7,
36574
+ sdNodeOrKeyName: SD_NODE_NAME$7,
36585
36575
  type: NodeTranslator.translatorTypes.NODE,
36586
- encode: encode$c,
36587
- decode: decode$c,
36576
+ encode: encode$e,
36577
+ decode: decode$e,
36588
36578
  attributes: validXmlAttributes$5
36589
36579
  };
36590
- const translator$5 = NodeTranslator.from(config$5);
36591
- const XML_NODE_NAME$4 = "w:drawing";
36592
- const SD_NODE_NAME$4 = [];
36580
+ const translator$7 = NodeTranslator.from(config$7);
36581
+ const XML_NODE_NAME$6 = "w:drawing";
36582
+ const SD_NODE_NAME$6 = [];
36593
36583
  const validXmlAttributes$4 = [];
36594
- function encode$b(params2) {
36584
+ function encode$d(params2) {
36595
36585
  const nodes = params2.nodes;
36596
36586
  const node = nodes[0];
36597
36587
  const translatorByChildName = {
36598
- "wp:anchor": translator$6,
36599
- "wp:inline": translator$5
36588
+ "wp:anchor": translator$8,
36589
+ "wp:inline": translator$7
36600
36590
  };
36601
36591
  return node.elements.reduce((acc, child) => {
36602
36592
  if (acc) return acc;
@@ -36605,12 +36595,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36605
36595
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
36606
36596
  }, null);
36607
36597
  }
36608
- function decode$b(params2) {
36598
+ function decode$d(params2) {
36609
36599
  const { node } = params2;
36610
36600
  if (!node || !node.type) {
36611
36601
  return null;
36612
36602
  }
36613
- const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
36603
+ const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
36614
36604
  const resultNode = childTranslator.decode(params2);
36615
36605
  return wrapTextInRun(
36616
36606
  {
@@ -36620,15 +36610,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36620
36610
  []
36621
36611
  );
36622
36612
  }
36623
- const config$4 = {
36624
- xmlName: XML_NODE_NAME$4,
36625
- sdNodeOrKeyName: SD_NODE_NAME$4,
36613
+ const config$6 = {
36614
+ xmlName: XML_NODE_NAME$6,
36615
+ sdNodeOrKeyName: SD_NODE_NAME$6,
36626
36616
  type: NodeTranslator.translatorTypes.NODE,
36627
- encode: encode$b,
36628
- decode: decode$b,
36617
+ encode: encode$d,
36618
+ decode: decode$d,
36629
36619
  attributes: validXmlAttributes$4
36630
36620
  };
36631
- const translator$4 = NodeTranslator.from(config$4);
36621
+ const translator$6 = NodeTranslator.from(config$6);
36632
36622
  class CommandService {
36633
36623
  /**
36634
36624
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -37966,7 +37956,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37966
37956
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
37967
37957
  }
37968
37958
  function prepareImageAnnotation(params2, imageSize) {
37969
- return translator$4.decode({
37959
+ return translator$6.decode({
37970
37960
  ...params2,
37971
37961
  imageSize
37972
37962
  });
@@ -38186,6 +38176,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38186
38176
  ]
38187
38177
  };
38188
38178
  };
38179
+ function translateDocumentPartObj(params2) {
38180
+ const { node } = params2;
38181
+ const { attrs = {} } = node;
38182
+ const childContent = translateChildNodes({ ...params2, nodes: node.content });
38183
+ const nodeElements = [
38184
+ {
38185
+ name: "w:sdtPr",
38186
+ elements: [
38187
+ {
38188
+ name: "w:id",
38189
+ attributes: {
38190
+ "w:val": attrs.id
38191
+ }
38192
+ },
38193
+ {
38194
+ name: "w:docPartObj",
38195
+ elements: [
38196
+ {
38197
+ name: "w:docPartGallery",
38198
+ attributes: {
38199
+ "w:val": attrs.docPartGallery
38200
+ }
38201
+ },
38202
+ ...attrs.docPartUnique ? [
38203
+ {
38204
+ name: "w:docPartUnique"
38205
+ }
38206
+ ] : []
38207
+ ]
38208
+ }
38209
+ ]
38210
+ },
38211
+ {
38212
+ name: "w:sdtContent",
38213
+ elements: childContent
38214
+ }
38215
+ ];
38216
+ const result = {
38217
+ name: "w:sdt",
38218
+ elements: nodeElements
38219
+ };
38220
+ return result;
38221
+ }
38189
38222
  function translateStructuredContent(params2) {
38190
38223
  const { node } = params2;
38191
38224
  const childContent = translateChildNodes({ ...params2, nodes: node.content });
@@ -38237,10 +38270,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38237
38270
  };
38238
38271
  return result;
38239
38272
  }
38240
- const XML_NODE_NAME$3 = "w:sdt";
38241
- const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
38273
+ const XML_NODE_NAME$5 = "w:sdt";
38274
+ const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
38242
38275
  const validXmlAttributes$3 = [];
38243
- function encode$a(params2) {
38276
+ function encode$c(params2) {
38244
38277
  const nodes = params2.nodes;
38245
38278
  const node = nodes[0];
38246
38279
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -38250,7 +38283,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38250
38283
  const result = handler2(params2);
38251
38284
  return result;
38252
38285
  }
38253
- function decode$a(params2) {
38286
+ function decode$c(params2) {
38254
38287
  const { node } = params2;
38255
38288
  if (!node || !node.type) {
38256
38289
  return null;
@@ -38260,91 +38293,93 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38260
38293
  structuredContent: () => translateStructuredContent(params2),
38261
38294
  structuredContentBlock: () => translateStructuredContent(params2),
38262
38295
  documentSection: () => translateDocumentSection(params2),
38296
+ documentPartObject: () => translateDocumentPartObj(params2),
38297
+ // Handled in doc-part-obj translator
38263
38298
  default: () => null
38264
38299
  };
38265
38300
  const decoder = types2[node.type] ?? types2.default;
38266
38301
  const result = decoder();
38267
38302
  return result;
38268
38303
  }
38269
- const config$3 = {
38270
- xmlName: XML_NODE_NAME$3,
38271
- sdNodeOrKeyName: SD_NODE_NAME$3,
38304
+ const config$5 = {
38305
+ xmlName: XML_NODE_NAME$5,
38306
+ sdNodeOrKeyName: SD_NODE_NAME$5,
38272
38307
  type: NodeTranslator.translatorTypes.NODE,
38273
- encode: encode$a,
38274
- decode: decode$a,
38308
+ encode: encode$c,
38309
+ decode: decode$c,
38275
38310
  attributes: validXmlAttributes$3
38276
38311
  };
38277
- const translator$3 = NodeTranslator.from(config$3);
38278
- const encode$9 = (attributes) => {
38312
+ const translator$5 = NodeTranslator.from(config$5);
38313
+ const encode$b = (attributes) => {
38279
38314
  return attributes["w:id"];
38280
38315
  };
38281
- const decode$9 = (attrs) => {
38316
+ const decode$b = (attrs) => {
38282
38317
  return attrs.id;
38283
38318
  };
38284
38319
  const attrConfig$6 = Object.freeze({
38285
38320
  xmlName: "w:id",
38286
38321
  sdName: "id",
38287
- encode: encode$9,
38288
- decode: decode$9
38322
+ encode: encode$b,
38323
+ decode: decode$b
38289
38324
  });
38290
- const encode$8 = (attributes) => {
38325
+ const encode$a = (attributes) => {
38291
38326
  return attributes["w:name"];
38292
38327
  };
38293
- const decode$8 = (attrs) => {
38328
+ const decode$a = (attrs) => {
38294
38329
  return attrs.name;
38295
38330
  };
38296
38331
  const attrConfig$5 = Object.freeze({
38297
38332
  xmlName: "w:name",
38298
38333
  sdName: "name",
38299
- encode: encode$8,
38300
- decode: decode$8
38334
+ encode: encode$a,
38335
+ decode: decode$a
38301
38336
  });
38302
- const encode$7 = (attributes) => {
38337
+ const encode$9 = (attributes) => {
38303
38338
  return attributes["w:colFirst"];
38304
38339
  };
38305
- const decode$7 = (attrs) => {
38340
+ const decode$9 = (attrs) => {
38306
38341
  return attrs.colFirst;
38307
38342
  };
38308
38343
  const attrConfig$4 = Object.freeze({
38309
38344
  xmlName: "w:colFirst",
38310
38345
  sdName: "colFirst",
38311
- encode: encode$7,
38312
- decode: decode$7
38346
+ encode: encode$9,
38347
+ decode: decode$9
38313
38348
  });
38314
- const encode$6 = (attributes) => {
38349
+ const encode$8 = (attributes) => {
38315
38350
  return attributes["w:colLast"];
38316
38351
  };
38317
- const decode$6 = (attrs) => {
38352
+ const decode$8 = (attrs) => {
38318
38353
  return attrs.colLast;
38319
38354
  };
38320
38355
  const attrConfig$3 = Object.freeze({
38321
38356
  xmlName: "w:colLast",
38322
38357
  sdName: "colLast",
38323
- encode: encode$6,
38324
- decode: decode$6
38358
+ encode: encode$8,
38359
+ decode: decode$8
38325
38360
  });
38326
- const encode$5 = (attributes) => {
38361
+ const encode$7 = (attributes) => {
38327
38362
  return attributes["w:displacedByCustomXml"];
38328
38363
  };
38329
- const decode$5 = (attrs) => {
38364
+ const decode$7 = (attrs) => {
38330
38365
  return attrs.displacedByCustomXml;
38331
38366
  };
38332
38367
  const attrConfig$2 = Object.freeze({
38333
38368
  xmlName: "w:displacedByCustomXml",
38334
38369
  sdName: "displacedByCustomXml",
38335
- encode: encode$5,
38336
- decode: decode$5
38370
+ encode: encode$7,
38371
+ decode: decode$7
38337
38372
  });
38338
38373
  const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
38339
- const XML_NODE_NAME$2 = "w:bookmarkStart";
38340
- const SD_NODE_NAME$2 = "bookmarkStart";
38341
- const encode$4 = (params2, encodedAttrs = {}) => {
38374
+ const XML_NODE_NAME$4 = "w:bookmarkStart";
38375
+ const SD_NODE_NAME$4 = "bookmarkStart";
38376
+ const encode$6 = (params2, encodedAttrs = {}) => {
38342
38377
  return {
38343
38378
  type: "bookmarkStart",
38344
38379
  attrs: encodedAttrs
38345
38380
  };
38346
38381
  };
38347
- const decode$4 = (params2, decodedAttrs = {}) => {
38382
+ const decode$6 = (params2, decodedAttrs = {}) => {
38348
38383
  const result = {
38349
38384
  name: "w:bookmarkStart",
38350
38385
  elements: []
@@ -38354,49 +38389,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38354
38389
  }
38355
38390
  return result;
38356
38391
  };
38357
- const config$2 = {
38358
- xmlName: XML_NODE_NAME$2,
38359
- sdNodeOrKeyName: SD_NODE_NAME$2,
38392
+ const config$4 = {
38393
+ xmlName: XML_NODE_NAME$4,
38394
+ sdNodeOrKeyName: SD_NODE_NAME$4,
38360
38395
  type: NodeTranslator.translatorTypes.NODE,
38361
- encode: encode$4,
38362
- decode: decode$4,
38396
+ encode: encode$6,
38397
+ decode: decode$6,
38363
38398
  attributes: validXmlAttributes$2
38364
38399
  };
38365
- const translator$2 = NodeTranslator.from(config$2);
38366
- const encode$3 = (attributes) => {
38400
+ const translator$4 = NodeTranslator.from(config$4);
38401
+ const encode$5 = (attributes) => {
38367
38402
  return attributes["w:id"];
38368
38403
  };
38369
- const decode$3 = (attrs) => {
38404
+ const decode$5 = (attrs) => {
38370
38405
  return attrs.id;
38371
38406
  };
38372
38407
  const attrConfig$1 = Object.freeze({
38373
38408
  xmlName: "w:id",
38374
38409
  sdName: "id",
38375
- encode: encode$3,
38376
- decode: decode$3
38410
+ encode: encode$5,
38411
+ decode: decode$5
38377
38412
  });
38378
- const encode$2 = (attributes) => {
38413
+ const encode$4 = (attributes) => {
38379
38414
  return attributes["w:displacedByCustomXml"];
38380
38415
  };
38381
- const decode$2 = (attrs) => {
38416
+ const decode$4 = (attrs) => {
38382
38417
  return attrs.displacedByCustomXml;
38383
38418
  };
38384
38419
  const attrConfig = Object.freeze({
38385
38420
  xmlName: "w:displacedByCustomXml",
38386
38421
  sdName: "displacedByCustomXml",
38387
- encode: encode$2,
38388
- decode: decode$2
38422
+ encode: encode$4,
38423
+ decode: decode$4
38389
38424
  });
38390
38425
  const validXmlAttributes$1 = [attrConfig$1, attrConfig];
38391
- const XML_NODE_NAME$1 = "w:bookmarkEnd";
38392
- const SD_NODE_NAME$1 = "bookmarkEnd";
38393
- const encode$1 = (params2, encodedAttrs = {}) => {
38426
+ const XML_NODE_NAME$3 = "w:bookmarkEnd";
38427
+ const SD_NODE_NAME$3 = "bookmarkEnd";
38428
+ const encode$3 = (params2, encodedAttrs = {}) => {
38394
38429
  return {
38395
38430
  type: "bookmarkEnd",
38396
38431
  attrs: encodedAttrs
38397
38432
  };
38398
38433
  };
38399
- const decode$1 = (params2, decodedAttrs = {}) => {
38434
+ const decode$3 = (params2, decodedAttrs = {}) => {
38400
38435
  const result = {
38401
38436
  name: "w:bookmarkEnd",
38402
38437
  elements: []
@@ -38406,19 +38441,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38406
38441
  }
38407
38442
  return result;
38408
38443
  };
38409
- const config$1 = {
38410
- xmlName: XML_NODE_NAME$1,
38411
- sdNodeOrKeyName: SD_NODE_NAME$1,
38444
+ const config$3 = {
38445
+ xmlName: XML_NODE_NAME$3,
38446
+ sdNodeOrKeyName: SD_NODE_NAME$3,
38412
38447
  type: NodeTranslator.translatorTypes.NODE,
38413
- encode: encode$1,
38414
- decode: decode$1,
38448
+ encode: encode$3,
38449
+ decode: decode$3,
38415
38450
  attributes: validXmlAttributes$1
38416
38451
  };
38417
- const translator$1 = NodeTranslator.from(config$1);
38418
- const XML_NODE_NAME = "mc:AlternateContent";
38419
- const SD_NODE_NAME = [];
38452
+ const translator$3 = NodeTranslator.from(config$3);
38453
+ const XML_NODE_NAME$2 = "mc:AlternateContent";
38454
+ const SD_NODE_NAME$2 = [];
38420
38455
  const validXmlAttributes = [];
38421
- function encode$19(params2) {
38456
+ function encode$2(params2) {
38422
38457
  const { nodeListHandler } = params2;
38423
38458
  const { node } = params2.extraParams;
38424
38459
  if (!node || !node.type) {
@@ -38438,7 +38473,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38438
38473
  path: [...params2.path || [], wpsNode]
38439
38474
  });
38440
38475
  }
38441
- function decode(params2) {
38476
+ function decode$2(params2) {
38442
38477
  const { node } = params2;
38443
38478
  const { drawingContent } = node.attrs;
38444
38479
  const drawing = {
@@ -38455,13 +38490,186 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38455
38490
  elements: [choice]
38456
38491
  };
38457
38492
  }
38493
+ const config$2 = {
38494
+ xmlName: XML_NODE_NAME$2,
38495
+ sdNodeOrKeyName: SD_NODE_NAME$2,
38496
+ type: NodeTranslator.translatorTypes.NODE,
38497
+ encode: encode$2,
38498
+ decode: decode$2,
38499
+ attributes: validXmlAttributes
38500
+ };
38501
+ const translator$2 = NodeTranslator.from(config$2);
38502
+ const XML_NODE_NAME$1 = "sd:pageReference";
38503
+ const SD_NODE_NAME$1 = "pageReference";
38504
+ const encode$1 = (params2, _2) => {
38505
+ const { nodes = [], nodeListHandler } = params2 || {};
38506
+ const node = nodes[0];
38507
+ const processedText = nodeListHandler.handler({
38508
+ ...params2,
38509
+ nodes: node.elements
38510
+ });
38511
+ const processedNode = {
38512
+ type: "pageReference",
38513
+ attrs: {
38514
+ instruction: node.attributes?.instruction || "",
38515
+ marksAsAttrs: node.marks || []
38516
+ },
38517
+ content: processedText
38518
+ };
38519
+ return processedNode;
38520
+ };
38521
+ const decode$1 = (params2, _2) => {
38522
+ const { node } = params2;
38523
+ const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
38524
+ const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
38525
+ const translated = [
38526
+ {
38527
+ name: "w:r",
38528
+ elements: [
38529
+ {
38530
+ name: "w:rPr",
38531
+ elements: outputMarks
38532
+ },
38533
+ {
38534
+ name: "w:fldChar",
38535
+ attributes: {
38536
+ "w:fldCharType": "begin"
38537
+ }
38538
+ }
38539
+ ]
38540
+ },
38541
+ {
38542
+ name: "w:r",
38543
+ elements: [
38544
+ {
38545
+ name: "w:rPr",
38546
+ elements: outputMarks
38547
+ },
38548
+ {
38549
+ name: "w:instrText",
38550
+ attributes: { "xml:space": "preserve" },
38551
+ elements: [
38552
+ {
38553
+ type: "text",
38554
+ text: `${node.attrs.instruction}`
38555
+ }
38556
+ ]
38557
+ }
38558
+ ]
38559
+ },
38560
+ {
38561
+ name: "w:r",
38562
+ elements: [
38563
+ {
38564
+ name: "w:rPr",
38565
+ elements: outputMarks
38566
+ },
38567
+ {
38568
+ name: "w:fldChar",
38569
+ attributes: {
38570
+ "w:fldCharType": "separate"
38571
+ }
38572
+ }
38573
+ ]
38574
+ },
38575
+ ...contentNodes,
38576
+ {
38577
+ name: "w:r",
38578
+ elements: [
38579
+ {
38580
+ name: "w:rPr",
38581
+ elements: outputMarks
38582
+ },
38583
+ {
38584
+ name: "w:fldChar",
38585
+ attributes: {
38586
+ "w:fldCharType": "end"
38587
+ }
38588
+ }
38589
+ ]
38590
+ }
38591
+ ];
38592
+ return translated;
38593
+ };
38594
+ const config$1 = {
38595
+ xmlName: XML_NODE_NAME$1,
38596
+ sdNodeOrKeyName: SD_NODE_NAME$1,
38597
+ type: NodeTranslator.translatorTypes.NODE,
38598
+ encode: encode$1,
38599
+ decode: decode$1
38600
+ };
38601
+ const translator$1 = NodeTranslator.from(config$1);
38602
+ const XML_NODE_NAME = "sd:tableOfContents";
38603
+ const SD_NODE_NAME = "tableOfContents";
38604
+ const encode$1c = (params2, _2) => {
38605
+ const { nodes = [], nodeListHandler } = params2 || {};
38606
+ const node = nodes[0];
38607
+ const processedContent = nodeListHandler.handler({
38608
+ ...params2,
38609
+ nodes: node.elements || []
38610
+ });
38611
+ const processedNode = {
38612
+ type: "tableOfContents",
38613
+ attrs: {
38614
+ instruction: node.attributes?.instruction || ""
38615
+ },
38616
+ content: processedContent
38617
+ };
38618
+ return processedNode;
38619
+ };
38620
+ const decode = (params2, _2) => {
38621
+ const { node } = params2;
38622
+ const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
38623
+ const tocBeginElements = [
38624
+ {
38625
+ name: "w:r",
38626
+ elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
38627
+ },
38628
+ {
38629
+ name: "w:r",
38630
+ elements: [
38631
+ {
38632
+ name: "w:instrText",
38633
+ attributes: { "xml:space": "preserve" },
38634
+ elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
38635
+ }
38636
+ ]
38637
+ },
38638
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
38639
+ ];
38640
+ if (contentNodes.length > 0) {
38641
+ const firstParagraph = contentNodes[0];
38642
+ let insertIndex = 0;
38643
+ if (firstParagraph.elements) {
38644
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
38645
+ insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
38646
+ } else {
38647
+ firstParagraph.elements = [];
38648
+ }
38649
+ firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
38650
+ } else {
38651
+ contentNodes.push({
38652
+ name: "w:p",
38653
+ elements: tocBeginElements
38654
+ });
38655
+ }
38656
+ const tocEndElements = [
38657
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
38658
+ ];
38659
+ const lastParagraph = contentNodes[contentNodes.length - 1];
38660
+ if (lastParagraph.elements) {
38661
+ lastParagraph.elements.push(...tocEndElements);
38662
+ } else {
38663
+ lastParagraph.elements = [...tocEndElements];
38664
+ }
38665
+ return contentNodes;
38666
+ };
38458
38667
  const config = {
38459
38668
  xmlName: XML_NODE_NAME,
38460
38669
  sdNodeOrKeyName: SD_NODE_NAME,
38461
38670
  type: NodeTranslator.translatorTypes.NODE,
38462
- encode: encode$19,
38463
- decode,
38464
- attributes: validXmlAttributes
38671
+ encode: encode$1c,
38672
+ decode
38465
38673
  };
38466
38674
  const translator = NodeTranslator.from(config);
38467
38675
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
@@ -38535,32 +38743,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38535
38743
  doc: translateDocumentNode,
38536
38744
  body: translateBodyNode,
38537
38745
  heading: translateHeadingNode,
38538
- paragraph: translator$13,
38539
- run: translator$U,
38746
+ paragraph: translator$16,
38747
+ run: translator$V,
38540
38748
  text: translateTextNode,
38541
38749
  bulletList: translateList,
38542
38750
  orderedList: translateList,
38543
- lineBreak: translator$16,
38544
- table: translator$9,
38545
- tableRow: translator$G,
38546
- tableCell: translator$8,
38547
- bookmarkStart: translator$2,
38548
- bookmarkEnd: translator$1,
38549
- fieldAnnotation: translator$3,
38550
- tab: translator$14,
38551
- image: translator$4,
38552
- hardBreak: translator$16,
38751
+ lineBreak: translator$19,
38752
+ table: translator$a,
38753
+ tableRow: translator$H,
38754
+ tableCell: translator$9,
38755
+ bookmarkStart: translator$4,
38756
+ bookmarkEnd: translator$3,
38757
+ fieldAnnotation: translator$5,
38758
+ tab: translator$17,
38759
+ image: translator$6,
38760
+ hardBreak: translator$19,
38553
38761
  commentRangeStart: () => translateCommentNode(params2, "Start"),
38554
38762
  commentRangeEnd: () => translateCommentNode(params2, "End"),
38555
38763
  commentReference: () => null,
38556
38764
  shapeContainer: translateShapeContainer,
38557
38765
  shapeTextbox: translateShapeTextbox,
38558
38766
  contentBlock: translateContentBlock,
38559
- structuredContent: translator$3,
38560
- structuredContentBlock: translator$3,
38561
- documentSection: translator$3,
38767
+ structuredContent: translator$5,
38768
+ structuredContentBlock: translator$5,
38769
+ documentPartObject: translator$5,
38770
+ documentSection: translator$5,
38562
38771
  "page-number": translatePageNumberNode,
38563
- "total-page-number": translateTotalPageNumberNode
38772
+ "total-page-number": translateTotalPageNumberNode,
38773
+ pageReference: translator$1,
38774
+ tableOfContents: translator
38564
38775
  };
38565
38776
  let handler2 = router[type2];
38566
38777
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -38898,8 +39109,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38898
39109
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
38899
39110
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
38900
39111
  if (isTrackedNode) return translateTrackedNode(params2);
38901
- const isLinkNode = node.marks?.some((m2) => m2.type === "link");
38902
- if (isLinkNode) return translator$7.decode(params2);
38903
39112
  const { text, marks = [] } = node;
38904
39113
  return getTextNodeForExport(text, marks, params2);
38905
39114
  }
@@ -39205,7 +39414,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39205
39414
  markElement.type = "element";
39206
39415
  break;
39207
39416
  case "underline": {
39208
- const translated = translator$10.decode({
39417
+ const translated = translator$13.decode({
39209
39418
  node: {
39210
39419
  attrs: {
39211
39420
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -39269,7 +39478,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39269
39478
  break;
39270
39479
  case "highlight": {
39271
39480
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
39272
- const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
39481
+ const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
39273
39482
  return translated || {};
39274
39483
  }
39275
39484
  }
@@ -39329,7 +39538,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39329
39538
  if (vmlAttributes || horizontalRule) {
39330
39539
  return translateVRectContentBlock(params2);
39331
39540
  }
39332
- const alternateContent = translator.decode(params2);
39541
+ const alternateContent = translator$2.decode(params2);
39333
39542
  return wrapTextInRun(alternateContent);
39334
39543
  }
39335
39544
  function translateVRectContentBlock(params2) {
@@ -39475,6 +39684,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39475
39684
  },
39476
39685
  {
39477
39686
  name: "w:instrText",
39687
+ attributes: { "xml:space": "preserve" },
39478
39688
  elements: [
39479
39689
  {
39480
39690
  type: "text",
@@ -39534,7 +39744,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39534
39744
  if (mainNode.name === "w:drawing") node = mainNode;
39535
39745
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
39536
39746
  if (!node) return { nodes: [], consumed: 0 };
39537
- const schemaNode = translator$4.encode(params2);
39747
+ const schemaNode = translator$6.encode(params2);
39538
39748
  const newNodes = schemaNode ? [schemaNode] : [];
39539
39749
  return { nodes: newNodes, consumed: 1 };
39540
39750
  };
@@ -39636,8 +39846,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39636
39846
  handlerName: "trackChangeNodeHandler",
39637
39847
  handler: handleTrackChangeNode
39638
39848
  };
39639
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
39640
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
39849
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
39850
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
39641
39851
  const handleTextNode = (params2) => {
39642
39852
  const { nodes, insideTrackChange } = params2;
39643
39853
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -39678,7 +39888,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39678
39888
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
39679
39889
  return { nodes: [], consumed: 0 };
39680
39890
  }
39681
- const schemaNode = translator$13.encode(params2);
39891
+ const schemaNode = translator$16.encode(params2);
39682
39892
  const newNodes = schemaNode ? [schemaNode] : [];
39683
39893
  return { nodes: newNodes, consumed: 1 };
39684
39894
  };
@@ -39691,7 +39901,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39691
39901
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
39692
39902
  return { nodes: [], consumed: 0 };
39693
39903
  }
39694
- const result = translator$3.encode(params2);
39904
+ const result = translator$5.encode(params2);
39695
39905
  if (!result) {
39696
39906
  return { nodes: [], consumed: 0 };
39697
39907
  }
@@ -39781,7 +39991,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39781
39991
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
39782
39992
  return { nodes: [], consumed: 0 };
39783
39993
  }
39784
- const result = translator$16.encode(params2);
39994
+ const result = translator$19.encode(params2);
39785
39995
  if (!result) return { nodes: [], consumed: 0 };
39786
39996
  return {
39787
39997
  nodes: [result],
@@ -39853,7 +40063,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39853
40063
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
39854
40064
  return handleBookmarkNode(params2);
39855
40065
  }
39856
- const node = translator$2.encode(params2);
40066
+ const node = translator$4.encode(params2);
39857
40067
  if (!node) return { nodes: [], consumed: 0 };
39858
40068
  return { nodes: [node], consumed: 1 };
39859
40069
  };
@@ -39885,7 +40095,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39885
40095
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
39886
40096
  return { nodes: [], consumed: 0 };
39887
40097
  }
39888
- const node = translator$1.encode(params2);
40098
+ const node = translator$3.encode(params2);
39889
40099
  if (!node) return { nodes: [], consumed: 0 };
39890
40100
  return { nodes: [node], consumed: 1 };
39891
40101
  };
@@ -40018,6 +40228,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40018
40228
  handlerName: "autoTotalPageCountEntity",
40019
40229
  handler: handleAutoTotalPageNumber
40020
40230
  };
40231
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
40021
40232
  const handlePictNode = (params2) => {
40022
40233
  const { nodes } = params2;
40023
40234
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -40489,6 +40700,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40489
40700
  const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
40490
40701
  const justify = pPr?.elements?.find((el) => el.name === "w:jc");
40491
40702
  const indent = pPr?.elements?.find((el) => el.name === "w:ind");
40703
+ const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
40492
40704
  let lineSpaceBefore, lineSpaceAfter, line;
40493
40705
  if (spacing) {
40494
40706
  lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
@@ -40502,6 +40714,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40502
40714
  rightIndent = twipsToPixels(indent?.attributes["w:right"]);
40503
40715
  firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
40504
40716
  }
40717
+ let tabStops = [];
40718
+ if (tabs) {
40719
+ tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
40720
+ let val = tab.attributes["w:val"];
40721
+ if (val == "left") {
40722
+ val = "start";
40723
+ } else if (val == "right") {
40724
+ val = "end";
40725
+ }
40726
+ return {
40727
+ val,
40728
+ pos: twipsToPixels(tab.attributes["w:pos"]),
40729
+ leader: tab.attributes["w:leader"]
40730
+ };
40731
+ });
40732
+ }
40505
40733
  const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
40506
40734
  const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
40507
40735
  const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
@@ -40534,7 +40762,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40534
40762
  const parsedStyles = {
40535
40763
  spacing: { lineSpaceAfter, lineSpaceBefore, line },
40536
40764
  textAlign,
40537
- indent: { leftIndent, rightIndent, firstLine }
40765
+ indent: { leftIndent, rightIndent, firstLine },
40766
+ tabStops: tabStops.length > 0 ? tabStops : null
40538
40767
  };
40539
40768
  parsedMarks.forEach((mark) => {
40540
40769
  const { type: type2, attrs } = mark;
@@ -40558,13 +40787,213 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40558
40787
  if (!nodes.length || nodes[0].name !== "w:tab") {
40559
40788
  return { nodes: [], consumed: 0 };
40560
40789
  }
40561
- const node = translator$14.encode(params2);
40790
+ const node = translator$17.encode(params2);
40562
40791
  return { nodes: [node], consumed: 1 };
40563
40792
  };
40564
40793
  const tabNodeEntityHandler = {
40565
40794
  handlerName: "w:tabTranslator",
40566
40795
  handler: handleTabNode
40567
40796
  };
40797
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
40798
+ function preProcessPageInstruction(nodesToCombine, _2, __) {
40799
+ const pageNumNode = {
40800
+ name: "sd:autoPageNumber",
40801
+ type: "element"
40802
+ };
40803
+ nodesToCombine.forEach((n) => {
40804
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
40805
+ if (rPrNode) pageNumNode.elements = [rPrNode];
40806
+ });
40807
+ return [pageNumNode];
40808
+ }
40809
+ function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
40810
+ const totalPageNumNode = {
40811
+ name: "sd:totalPageNumber",
40812
+ type: "element"
40813
+ };
40814
+ nodesToCombine.forEach((n) => {
40815
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40816
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
40817
+ });
40818
+ return [totalPageNumNode];
40819
+ }
40820
+ function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
40821
+ const pageRefNode = {
40822
+ name: "sd:pageReference",
40823
+ type: "element",
40824
+ attributes: {
40825
+ instruction: instrText
40826
+ },
40827
+ elements: nodesToCombine
40828
+ };
40829
+ return [pageRefNode];
40830
+ }
40831
+ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
40832
+ const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
40833
+ let linkAttributes;
40834
+ if (urlMatch && urlMatch.length >= 2) {
40835
+ const url = urlMatch[1];
40836
+ const rels = docx["word/_rels/document.xml.rels"];
40837
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
40838
+ if (relationships) {
40839
+ const rId = generateDocxRandomId();
40840
+ relationships.elements.push({
40841
+ type: "element",
40842
+ name: "Relationship",
40843
+ attributes: {
40844
+ Id: rId,
40845
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
40846
+ Target: url,
40847
+ TargetMode: "External"
40848
+ }
40849
+ });
40850
+ linkAttributes = { "r:id": rId };
40851
+ } else {
40852
+ linkAttributes = { "w:anchor": url };
40853
+ }
40854
+ } else {
40855
+ const availableSwitches = {
40856
+ "w:anchor": `l "(?<value>[^"]+)"`,
40857
+ new_window: `
40858
+ `,
40859
+ "w:tgtFrame": ` "(?<value>[^"]+)"`,
40860
+ "w:tooltip": `o "(?<value>[^"]+)"`
40861
+ };
40862
+ const parsedSwitches = {};
40863
+ for (const [key2, regex] of Object.entries(availableSwitches)) {
40864
+ const match = instruction.match(new RegExp(regex));
40865
+ if (match) {
40866
+ parsedSwitches[key2] = match.groups?.value || true;
40867
+ }
40868
+ }
40869
+ if (parsedSwitches.new_window) {
40870
+ parsedSwitches["w:tgtFrame"] = "_blank";
40871
+ delete parsedSwitches.new_window;
40872
+ }
40873
+ linkAttributes = { ...parsedSwitches };
40874
+ }
40875
+ return [
40876
+ {
40877
+ name: "w:hyperlink",
40878
+ type: "element",
40879
+ attributes: linkAttributes,
40880
+ elements: nodesToCombine
40881
+ }
40882
+ ];
40883
+ }
40884
+ function preProcessTocInstruction(nodesToCombine, instrText) {
40885
+ return [
40886
+ {
40887
+ name: "sd:tableOfContents",
40888
+ type: "element",
40889
+ attributes: {
40890
+ instruction: instrText
40891
+ },
40892
+ elements: nodesToCombine
40893
+ }
40894
+ ];
40895
+ }
40896
+ const getInstructionPreProcessor = (instruction) => {
40897
+ const instructionType = instruction.split(" ")[0];
40898
+ switch (instructionType) {
40899
+ case "PAGE":
40900
+ return preProcessPageInstruction;
40901
+ case "NUMPAGES":
40902
+ return preProcessNumPagesInstruction;
40903
+ case "PAGEREF":
40904
+ return preProcessPageRefInstruction;
40905
+ case "HYPERLINK":
40906
+ return preProcessHyperlinkInstruction;
40907
+ case "TOC":
40908
+ return preProcessTocInstruction;
40909
+ default:
40910
+ return null;
40911
+ }
40912
+ };
40913
+ const preProcessNodesForFldChar = (nodes = [], docx) => {
40914
+ const processedNodes = [];
40915
+ let collectedNodesStack = [];
40916
+ let currentFieldStack = [];
40917
+ let unpairedEnd = null;
40918
+ let collecting = false;
40919
+ const finalizeField = () => {
40920
+ if (collecting) {
40921
+ const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
40922
+ const currentField = currentFieldStack.pop();
40923
+ const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
40924
+ if (collectedNodesStack.length === 0) {
40925
+ processedNodes.push(...combined);
40926
+ } else {
40927
+ collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
40928
+ }
40929
+ } else {
40930
+ unpairedEnd = true;
40931
+ }
40932
+ };
40933
+ for (const node of nodes) {
40934
+ const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
40935
+ const fldType = fldCharEl?.attributes?.["w:fldCharType"];
40936
+ const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
40937
+ collecting = collectedNodesStack.length > 0;
40938
+ if (fldType === "begin") {
40939
+ collectedNodesStack.push([null]);
40940
+ currentFieldStack.push({ instrText: "" });
40941
+ continue;
40942
+ }
40943
+ if (instrTextEl && collecting && currentFieldStack.length > 0) {
40944
+ currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40945
+ continue;
40946
+ }
40947
+ if (fldType === "end") {
40948
+ finalizeField();
40949
+ continue;
40950
+ } else if (fldType === "separate") {
40951
+ continue;
40952
+ }
40953
+ if (Array.isArray(node.elements)) {
40954
+ const childResult = preProcessNodesForFldChar(node.elements, docx);
40955
+ node.elements = childResult.processedNodes;
40956
+ if (childResult.unpairedBegin) {
40957
+ childResult.unpairedBegin.forEach((pendingField) => {
40958
+ currentFieldStack.push(pendingField.fieldInfo);
40959
+ collectedNodesStack.push([node]);
40960
+ });
40961
+ } else if (childResult.unpairedEnd) {
40962
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
40963
+ finalizeField();
40964
+ } else if (collecting) {
40965
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
40966
+ } else {
40967
+ processedNodes.push(node);
40968
+ }
40969
+ } else if (collecting) {
40970
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
40971
+ } else {
40972
+ processedNodes.push(node);
40973
+ }
40974
+ }
40975
+ let unpairedBegin = null;
40976
+ if (collectedNodesStack.length > 0) {
40977
+ unpairedBegin = [];
40978
+ for (let i2 = 0; i2 < collectedNodesStack.length; i2++) {
40979
+ processedNodes.push(...collectedNodesStack[i2].filter((n) => n !== null));
40980
+ unpairedBegin.push({
40981
+ nodes: collectedNodesStack[i2],
40982
+ fieldInfo: currentFieldStack[i2]
40983
+ });
40984
+ }
40985
+ }
40986
+ return { processedNodes, unpairedBegin, unpairedEnd };
40987
+ };
40988
+ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
40989
+ const instructionType = instrText.trim().split(" ")[0];
40990
+ const instructionPreProcessor = getInstructionPreProcessor(instructionType);
40991
+ if (instructionPreProcessor) {
40992
+ return instructionPreProcessor(nodesToCombine, instrText, docx);
40993
+ } else {
40994
+ return nodesToCombine;
40995
+ }
40996
+ };
40568
40997
  const createDocumentJson = (docx, converter, editor) => {
40569
40998
  const json = carbonCopy(getInitialJSON(docx));
40570
40999
  if (!json) return null;
@@ -40594,6 +41023,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40594
41023
  if (bodyNode) {
40595
41024
  ensureSectionProperties(bodyNode);
40596
41025
  const node = bodyNode;
41026
+ const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
41027
+ node.elements = processedNodes;
40597
41028
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
40598
41029
  const content = pruneIgnoredNodes(contentElements);
40599
41030
  const comments = importCommentData({ docx, converter, editor });
@@ -40649,8 +41080,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40649
41080
  trackChangeNodeHandlerEntity,
40650
41081
  tableNodeHandlerEntity,
40651
41082
  tabNodeEntityHandler,
41083
+ tableOfContentsHandlerEntity,
40652
41084
  autoPageHandlerEntity,
40653
41085
  autoTotalPageCountEntity,
41086
+ pageReferenceEntity,
40654
41087
  standardNodeHandlerEntity
40655
41088
  ];
40656
41089
  const handler2 = createNodeListHandler(entities);
@@ -62105,6 +62538,48 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62105
62538
  };
62106
62539
  }
62107
62540
  });
62541
+ const DocumentPartObject = Node$1.create({
62542
+ name: "documentPartObject",
62543
+ group: "block",
62544
+ content: "block*",
62545
+ isolating: true,
62546
+ addOptions() {
62547
+ return {
62548
+ htmlAttributes: {
62549
+ class: "sd-document-part-object-block",
62550
+ "aria-label": "Structured document part block"
62551
+ }
62552
+ };
62553
+ },
62554
+ parseDOM() {
62555
+ return [
62556
+ {
62557
+ tag: "div.sd-document-part-object-block",
62558
+ priority: 60
62559
+ }
62560
+ ];
62561
+ },
62562
+ renderDOM({ htmlAttributes }) {
62563
+ return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
62564
+ },
62565
+ addAttributes() {
62566
+ return {
62567
+ sdBlockId: {
62568
+ default: null,
62569
+ keepOnSplit: false,
62570
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
62571
+ renderDOM: (attrs) => {
62572
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
62573
+ }
62574
+ },
62575
+ id: {},
62576
+ docPartGallery: {},
62577
+ docPartUnique: {
62578
+ default: true
62579
+ }
62580
+ };
62581
+ }
62582
+ });
62108
62583
  const Document = Node$1.create({
62109
62584
  name: "doc",
62110
62585
  topNode: true,
@@ -63241,7 +63716,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63241
63716
  return { ...base2, ...linkedStyle.definition?.styles || {} };
63242
63717
  };
63243
63718
  const pMap = buildStyleMap(paragraphStyleId);
63244
- const tMap = buildStyleMap(inlineTextStyleId);
63719
+ let tMap;
63720
+ if (paragraphStyleId?.startsWith("TOC")) {
63721
+ tMap = {};
63722
+ } else {
63723
+ tMap = buildStyleMap(inlineTextStyleId);
63724
+ }
63245
63725
  const rMap = buildStyleMap(runStyleId);
63246
63726
  const finalStyles = { ...pMap, ...tMap, ...rMap };
63247
63727
  if (Object.keys(finalStyles).length === 0) return;
@@ -64538,7 +65018,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64538
65018
  });
64539
65019
  const defaultTabDistance = 48;
64540
65020
  const defaultLineLength = 816;
64541
- const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
65021
+ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
64542
65022
  const decorations = [];
64543
65023
  const paragraphCache = /* @__PURE__ */ new Map();
64544
65024
  const end2 = to ?? doc2.content.size;
@@ -64546,7 +65026,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64546
65026
  if (node.type.name !== "tab") return;
64547
65027
  let extraStyles = "";
64548
65028
  const $pos = doc2.resolve(pos);
64549
- const paragraphContext = getParagraphContext($pos, paragraphCache);
65029
+ const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
64550
65030
  if (!paragraphContext) return;
64551
65031
  try {
64552
65032
  const { tabStops, flattened, startPos } = paragraphContext;
@@ -64601,18 +65081,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64601
65081
  });
64602
65082
  return decorations;
64603
65083
  };
64604
- function getParagraphContext($pos, cache2) {
65084
+ function getParagraphContext($pos, cache2, helpers2) {
64605
65085
  for (let depth = $pos.depth; depth >= 0; depth--) {
64606
65086
  const node = $pos.node(depth);
64607
65087
  if (node?.type?.name === "paragraph") {
64608
65088
  const startPos = $pos.start(depth);
64609
65089
  if (!cache2.has(startPos)) {
65090
+ let tabStops = [];
65091
+ if (Array.isArray(node.attrs?.tabStops)) {
65092
+ tabStops = node.attrs.tabStops;
65093
+ } else {
65094
+ const style2 = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
65095
+ if (Array.isArray(style2?.definition?.styles?.tabStops)) {
65096
+ tabStops = style2.definition.styles.tabStops;
65097
+ }
65098
+ }
64610
65099
  cache2.set(startPos, {
64611
65100
  paragraph: node,
64612
65101
  paragraphDepth: depth,
64613
65102
  startPos,
64614
65103
  indent: node.attrs?.indent || {},
64615
- tabStops: Array.isArray(node.attrs?.tabStops) ? node.attrs.tabStops : [],
65104
+ tabStops,
64616
65105
  flattened: flattenParagraph(node, startPos),
64617
65106
  accumulatedTabWidth: 0
64618
65107
  });
@@ -64778,7 +65267,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64778
65267
  };
64779
65268
  },
64780
65269
  addPmPlugins() {
64781
- const { view } = this.editor;
65270
+ const { view, helpers: helpers2 } = this.editor;
64782
65271
  const tabPlugin = new Plugin({
64783
65272
  name: "tabPlugin",
64784
65273
  key: new PluginKey("tabPlugin"),
@@ -64788,7 +65277,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64788
65277
  },
64789
65278
  apply(tr, { decorations }, _oldState, newState) {
64790
65279
  if (!decorations) {
64791
- decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view));
65280
+ decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
64792
65281
  }
64793
65282
  if (!tr.docChanged) {
64794
65283
  return { decorations };
@@ -64828,7 +65317,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64828
65317
  rangesToRecalculate.forEach(([start2, end2]) => {
64829
65318
  const oldDecorations = decorations.find(start2, end2);
64830
65319
  decorations = decorations.remove(oldDecorations);
64831
- const newDecorations = getTabDecorations(newState.doc, view, start2, end2);
65320
+ const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
64832
65321
  decorations = decorations.add(newState.doc, newDecorations);
64833
65322
  });
64834
65323
  return { decorations };
@@ -71109,6 +71598,43 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71109
71598
  });
71110
71599
  return styles;
71111
71600
  };
71601
+ const PageReference = Node$1.create({
71602
+ name: "pageReference",
71603
+ group: "inline",
71604
+ inline: true,
71605
+ atom: true,
71606
+ draggable: false,
71607
+ selectable: false,
71608
+ content: "inline*",
71609
+ addOptions() {
71610
+ return {
71611
+ htmlAttributes: {
71612
+ contenteditable: false,
71613
+ "data-id": "auto-page-reference",
71614
+ "aria-label": "Page reference node",
71615
+ class: "sd-editor-page-reference"
71616
+ }
71617
+ };
71618
+ },
71619
+ addAttributes() {
71620
+ return {
71621
+ marksAsAttrs: {
71622
+ default: null,
71623
+ rendered: false
71624
+ },
71625
+ instruction: {
71626
+ default: "",
71627
+ rendered: false
71628
+ }
71629
+ };
71630
+ },
71631
+ parseDOM() {
71632
+ return [{ tag: 'span[data-id="auto-page-reference"]' }];
71633
+ },
71634
+ renderDOM({ htmlAttributes }) {
71635
+ return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
71636
+ }
71637
+ });
71112
71638
  const ShapeContainer = Node$1.create({
71113
71639
  name: "shapeContainer",
71114
71640
  group: "block",
@@ -71522,6 +72048,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71522
72048
  });
71523
72049
  });
71524
72050
  };
72051
+ const TableOfContents = Node$1.create({
72052
+ name: "tableOfContents",
72053
+ group: "block",
72054
+ content: "paragraph+",
72055
+ inline: false,
72056
+ addOptions() {
72057
+ return {
72058
+ htmlAttributes: {
72059
+ "data-id": "table-of-contents",
72060
+ "aria-label": "Table of Contents"
72061
+ }
72062
+ };
72063
+ },
72064
+ parseDOM() {
72065
+ return [
72066
+ {
72067
+ tag: 'div[data-id="table-of-contents"]'
72068
+ }
72069
+ ];
72070
+ },
72071
+ renderDOM({ htmlAttributes }) {
72072
+ return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
72073
+ },
72074
+ addAttributes() {
72075
+ return {
72076
+ instruction: {
72077
+ default: null,
72078
+ rendered: false
72079
+ },
72080
+ /**
72081
+ * @private
72082
+ * @category Attribute
72083
+ * @param {string} [sdBlockId] - Internal block tracking ID (not user-configurable)
72084
+ */
72085
+ sdBlockId: {
72086
+ default: null,
72087
+ keepOnSplit: false,
72088
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
72089
+ renderDOM: (attrs) => {
72090
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
72091
+ }
72092
+ }
72093
+ };
72094
+ }
72095
+ });
71525
72096
  const TextStyle = Mark.create({
71526
72097
  name: "textStyle",
71527
72098
  addOptions() {
@@ -78128,6 +78699,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78128
78699
  SlashMenu,
78129
78700
  Strike,
78130
78701
  TabNode,
78702
+ TableOfContents,
78131
78703
  Text,
78132
78704
  TextAlign,
78133
78705
  TextIndent,
@@ -78162,6 +78734,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78162
78734
  AiLoaderNode,
78163
78735
  PageNumber,
78164
78736
  TotalPageCount,
78737
+ PageReference,
78165
78738
  ShapeContainer,
78166
78739
  ShapeTextbox,
78167
78740
  ContentBlock,
@@ -78170,6 +78743,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78170
78743
  StructuredContentBlock,
78171
78744
  StructuredContentCommands,
78172
78745
  DocumentSection,
78746
+ DocumentPartObject,
78173
78747
  NodeResizer,
78174
78748
  CustomSelection,
78175
78749
  TextTransform
@@ -93706,71 +94280,73 @@ ${style2}
93706
94280
  };
93707
94281
  const SuperInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-4d5cff52"]]);
93708
94282
  const additionalHandlers = Object.freeze({
93709
- "mc:AlternateContent": translator,
93710
- "w:b": translator$12,
93711
- "w:bidiVisual": translator$F,
93712
- "w:bookmarkEnd": translator$1,
93713
- "w:bookmarkStart": translator$2,
93714
- "w:bottom": translator$s,
93715
- "w:br": translator$16,
93716
- "w:cantSplit": translator$T,
93717
- "w:cnfStyle": translator$S,
93718
- "w:color": translator$_,
93719
- "w:divId": translator$R,
93720
- "w:drawing": translator$4,
93721
- "w:end": translator$q,
93722
- "w:gridAfter": translator$Q,
93723
- "w:gridBefore": translator$P,
93724
- "w:gridCol": translator$b,
93725
- "w:hidden": translator$O,
93726
- "w:highlight": translator$15,
93727
- "w:hyperlink": translator$7,
93728
- "w:i": translator$11,
93729
- "w:insideH": translator$o,
93730
- "w:insideV": translator$n,
93731
- "w:jc": translator$N,
93732
- "w:left": translator$m,
93733
- "w:p": translator$13,
93734
- "w:r": translator$U,
93735
- "w:rFonts": translator$Z,
93736
- "w:rPr": translator$V,
93737
- "w:rStyle": translator$Y,
93738
- "w:right": translator$k,
93739
- "w:sdt": translator$3,
93740
- "w:shd": translator$E,
93741
- "w:start": translator$i,
93742
- "w:strike": translator$$,
93743
- "w:sz": translator$X,
93744
- "w:szCs": translator$W,
93745
- "w:tab": translator$14,
93746
- "w:tbl": translator$9,
93747
- "w:tblBorders": translator$e,
93748
- "w:tblCaption": translator$D,
93749
- "w:tblCellMar": translator$d,
93750
- "w:tblCellSpacing": translator$M,
93751
- "w:tblDescription": translator$C,
93752
- "w:tblGrid": translator$a,
93753
- "w:tblHeader": translator$L,
93754
- "w:tblInd": translator$B,
93755
- "w:tblLayout": translator$A,
93756
- "w:tblLook": translator$z,
93757
- "w:tblOverlap": translator$y,
93758
- "w:tblPr": translator$c,
93759
- "w:tblStyle": translator$x,
93760
- "w:tblStyleColBandSize": translator$w,
93761
- "w:tblStyleRowBandSize": translator$v,
93762
- "w:tblW": translator$u,
93763
- "w:tblpPr": translator$t,
93764
- "w:tc": translator$8,
93765
- "w:top": translator$g,
93766
- "w:tr": translator$G,
93767
- "w:trHeight": translator$K,
93768
- "w:trPr": translator$H,
93769
- "w:u": translator$10,
93770
- "w:wAfter": translator$J,
93771
- "w:wBefore": translator$I,
93772
- "wp:anchor": translator$6,
93773
- "wp:inline": translator$5
94283
+ "mc:AlternateContent": translator$2,
94284
+ "sd:pageReference": translator$1,
94285
+ "sd:tableOfContents": translator,
94286
+ "w:b": translator$15,
94287
+ "w:bidiVisual": translator$G,
94288
+ "w:bookmarkEnd": translator$3,
94289
+ "w:bookmarkStart": translator$4,
94290
+ "w:bottom": translator$t,
94291
+ "w:br": translator$19,
94292
+ "w:cantSplit": translator$U,
94293
+ "w:cnfStyle": translator$T,
94294
+ "w:color": translator$11,
94295
+ "w:divId": translator$S,
94296
+ "w:drawing": translator$6,
94297
+ "w:end": translator$r,
94298
+ "w:gridAfter": translator$R,
94299
+ "w:gridBefore": translator$Q,
94300
+ "w:gridCol": translator$c,
94301
+ "w:hidden": translator$P,
94302
+ "w:highlight": translator$18,
94303
+ "w:hyperlink": translator$W,
94304
+ "w:i": translator$14,
94305
+ "w:insideH": translator$p,
94306
+ "w:insideV": translator$o,
94307
+ "w:jc": translator$O,
94308
+ "w:left": translator$n,
94309
+ "w:p": translator$16,
94310
+ "w:r": translator$V,
94311
+ "w:rFonts": translator$10,
94312
+ "w:rPr": translator$X,
94313
+ "w:rStyle": translator$$,
94314
+ "w:right": translator$l,
94315
+ "w:sdt": translator$5,
94316
+ "w:shd": translator$F,
94317
+ "w:start": translator$j,
94318
+ "w:strike": translator$12,
94319
+ "w:sz": translator$_,
94320
+ "w:szCs": translator$Z,
94321
+ "w:tab": translator$17,
94322
+ "w:tbl": translator$a,
94323
+ "w:tblBorders": translator$f,
94324
+ "w:tblCaption": translator$E,
94325
+ "w:tblCellMar": translator$e,
94326
+ "w:tblCellSpacing": translator$N,
94327
+ "w:tblDescription": translator$D,
94328
+ "w:tblGrid": translator$b,
94329
+ "w:tblHeader": translator$M,
94330
+ "w:tblInd": translator$C,
94331
+ "w:tblLayout": translator$B,
94332
+ "w:tblLook": translator$A,
94333
+ "w:tblOverlap": translator$z,
94334
+ "w:tblPr": translator$d,
94335
+ "w:tblStyle": translator$y,
94336
+ "w:tblStyleColBandSize": translator$x,
94337
+ "w:tblStyleRowBandSize": translator$w,
94338
+ "w:tblW": translator$v,
94339
+ "w:tblpPr": translator$u,
94340
+ "w:tc": translator$9,
94341
+ "w:top": translator$h,
94342
+ "w:tr": translator$H,
94343
+ "w:trHeight": translator$L,
94344
+ "w:trPr": translator$I,
94345
+ "w:u": translator$13,
94346
+ "w:wAfter": translator$K,
94347
+ "w:wBefore": translator$J,
94348
+ "wp:anchor": translator$8,
94349
+ "wp:inline": translator$7
93774
94350
  });
93775
94351
  const baseHandlers = {
93776
94352
  ...runPropertyTranslators,