@harbour-enterprises/superdoc 0.22.0-next.9 → 0.23.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/chunks/{PdfViewer-DyWe33pN.cjs → PdfViewer-C9SGNZr6.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-HN-tp5RN.es.js → PdfViewer-D9atA783.es.js} +1 -1
  3. package/dist/chunks/{index-ir6efMuz.es.js → index-C8q6lenv.es.js} +3 -3
  4. package/dist/chunks/{index-BeVpZc19.cjs → index-CIbe1VMu.cjs} +3 -3
  5. package/dist/chunks/{super-editor.es-BwqYS285.es.js → super-editor.es-Dj6Sxtr7.es.js} +2891 -2008
  6. package/dist/chunks/{super-editor.es-CKfdmK-8.cjs → super-editor.es-DxScE0ep.cjs} +2891 -2008
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/style.css +4 -0
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BgedUNCW.js → converter-C08GQjNi.js} +1536 -1056
  11. package/dist/super-editor/chunks/{docx-zipper-ByLK3trM.js → docx-zipper-C3-uf2tI.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CFqh_xBx.js → editor-C2IwVkIp.js} +1251 -846
  13. package/dist/super-editor/chunks/{toolbar-DdfyWgZF.js → toolbar-De8G_9NV.js} +2 -2
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/src/core/helpers/generateDocxRandomId.d.ts +5 -0
  19. package/dist/super-editor/src/core/super-converter/exporter.d.ts +4 -4
  20. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
  21. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
  22. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
  23. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
  24. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
  25. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
  26. package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
  27. package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
  28. package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
  29. package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
  30. package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
  31. package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
  38. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
  39. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
  40. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
  41. package/dist/super-editor/src/extensions/index.d.ts +2 -1
  42. package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
  43. package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
  44. package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
  45. package/dist/super-editor/src/extensions/structured-content/index.d.ts +2 -0
  46. package/dist/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +67 -0
  47. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentBlockTags.d.ts +6 -0
  48. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentInlineTags.d.ts +6 -0
  49. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTags.d.ts +6 -0
  50. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsById.d.ts +7 -0
  51. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +4 -0
  52. package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
  53. package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
  54. package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
  55. package/dist/super-editor/style.css +4 -0
  56. package/dist/super-editor/super-editor.es.js +10 -8
  57. package/dist/super-editor/toolbar.es.js +2 -2
  58. package/dist/super-editor.cjs +1 -1
  59. package/dist/super-editor.es.js +1 -1
  60. package/dist/superdoc.cjs +2 -2
  61. package/dist/superdoc.es.js +2 -2
  62. package/dist/superdoc.umd.js +2892 -2009
  63. package/dist/superdoc.umd.js.map +1 -1
  64. package/package.json +1 -1
@@ -14986,6 +14986,10 @@ function generateDocxRandomId(length = 8) {
14986
14986
  }
14987
14987
  return id.join("");
14988
14988
  }
14989
+ function generateRandomSigned32BitIntStrId() {
14990
+ const val = Math.floor(Math.random() * 2147483647);
14991
+ return val.toString();
14992
+ }
14989
14993
  function generateRandom32BitHex() {
14990
14994
  const val = Math.floor(Math.random() * 2147483647);
14991
14995
  return val.toString(16).toUpperCase().padStart(8, "0");
@@ -22564,6 +22568,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
22564
22568
  generateDocxListAttributes,
22565
22569
  generateDocxRandomId,
22566
22570
  generateRandom32BitHex,
22571
+ generateRandomSigned32BitIntStrId,
22567
22572
  getActiveFormatting,
22568
22573
  getExtensionConfigField,
22569
22574
  getMarkRange,
@@ -22961,13 +22966,56 @@ function translateChildNodes(params) {
22961
22966
  const { content: nodes } = params.node;
22962
22967
  if (!nodes) return [];
22963
22968
  const translatedNodes = [];
22964
- nodes.forEach((node) => {
22969
+ const hyperlinkGroup = [];
22970
+ let index = 0;
22971
+ while (index < nodes.length) {
22972
+ const node = nodes[index];
22973
+ const linkMark = _isLinkNode(node);
22974
+ if (linkMark) {
22975
+ hyperlinkGroup.push(node);
22976
+ const nextNode = index + 1 < nodes.length ? nodes[index + 1] : null;
22977
+ const nextIsLink = _isLinkNode(nextNode, linkMark);
22978
+ if (nextIsLink) {
22979
+ index++;
22980
+ continue;
22981
+ } else {
22982
+ let translatedLinkGroup = exportSchemaToJson({
22983
+ ...params,
22984
+ node: hyperlinkGroup[0],
22985
+ extraParams: { ...params.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
22986
+ });
22987
+ if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
22988
+ else translatedNodes.push(translatedLinkGroup);
22989
+ hyperlinkGroup.length = 0;
22990
+ index++;
22991
+ continue;
22992
+ }
22993
+ }
22965
22994
  let translatedNode = exportSchemaToJson({ ...params, node });
22966
22995
  if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
22967
22996
  else translatedNodes.push(translatedNode);
22968
- });
22997
+ index++;
22998
+ }
22969
22999
  return translatedNodes.filter((n) => n);
22970
23000
  }
23001
+ function _isLinkNode(node, referenceMark = null) {
23002
+ if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
23003
+ const marks = node.marks || node.attrs.marksAsAttrs;
23004
+ const linkMark = marks.find((mark) => mark.type === "link");
23005
+ if (!linkMark) return null;
23006
+ if (referenceMark) {
23007
+ return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
23008
+ }
23009
+ return linkMark;
23010
+ }
23011
+ function _isSameLinkMark(attrsA, attrsB) {
23012
+ for (let key of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
23013
+ if (attrsA[key] != attrsB[key]) {
23014
+ return false;
23015
+ }
23016
+ }
23017
+ return true;
23018
+ }
22971
23019
  const baseNumbering = {
22972
23020
  declaration: {
22973
23021
  attributes: {
@@ -24323,37 +24371,37 @@ const _NodeTranslator = class _NodeTranslator {
24323
24371
  /** @type {typeof TranslatorTypes} */
24324
24372
  __publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
24325
24373
  let NodeTranslator = _NodeTranslator;
24326
- const encode$18 = (attributes) => {
24374
+ const encode$1b = (attributes) => {
24327
24375
  return attributes["w:type"];
24328
24376
  };
24329
- const decode$$ = (attrs) => {
24377
+ const decode$11 = (attrs) => {
24330
24378
  const { lineBreakType } = attrs;
24331
24379
  return lineBreakType;
24332
24380
  };
24333
24381
  const attrConfig$F = Object.freeze({
24334
24382
  xmlName: "w:type",
24335
24383
  sdName: "lineBreakType",
24336
- encode: encode$18,
24337
- decode: decode$$
24384
+ encode: encode$1b,
24385
+ decode: decode$11
24338
24386
  });
24339
- const encode$17 = (attributes) => {
24387
+ const encode$1a = (attributes) => {
24340
24388
  const xmlAttrValue = attributes["w:clear"];
24341
24389
  return xmlAttrValue;
24342
24390
  };
24343
- const decode$_ = (attrs) => {
24391
+ const decode$10 = (attrs) => {
24344
24392
  const { clear } = attrs;
24345
24393
  return clear;
24346
24394
  };
24347
24395
  const attrConfig$E = Object.freeze({
24348
24396
  xmlName: "w:clear",
24349
24397
  sdName: "clear",
24350
- encode: encode$17,
24351
- decode: decode$_
24398
+ encode: encode$1a,
24399
+ decode: decode$10
24352
24400
  });
24353
24401
  const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
24354
- const XML_NODE_NAME$u = "w:br";
24355
- const SD_NODE_NAME$d = "lineBreak";
24356
- const encode$16 = (_2, encodedAttrs) => {
24402
+ const XML_NODE_NAME$x = "w:br";
24403
+ const SD_NODE_NAME$f = "lineBreak";
24404
+ const encode$19 = (_2, encodedAttrs) => {
24357
24405
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24358
24406
  const translated = {
24359
24407
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24363,7 +24411,7 @@ const encode$16 = (_2, encodedAttrs) => {
24363
24411
  }
24364
24412
  return translated;
24365
24413
  };
24366
- const decode$Z = (params, decodedAttrs) => {
24414
+ const decode$$ = (params, decodedAttrs) => {
24367
24415
  const { node } = params;
24368
24416
  if (!node) return;
24369
24417
  const wBreak = { name: "w:br" };
@@ -24380,39 +24428,39 @@ const decode$Z = (params, decodedAttrs) => {
24380
24428
  };
24381
24429
  return translated;
24382
24430
  };
24383
- const config$s = {
24384
- xmlName: XML_NODE_NAME$u,
24385
- sdNodeOrKeyName: SD_NODE_NAME$d,
24431
+ const config$v = {
24432
+ xmlName: XML_NODE_NAME$x,
24433
+ sdNodeOrKeyName: SD_NODE_NAME$f,
24386
24434
  type: NodeTranslator.translatorTypes.NODE,
24387
- encode: encode$16,
24388
- decode: decode$Z,
24435
+ encode: encode$19,
24436
+ decode: decode$$,
24389
24437
  attributes: validXmlAttributes$m
24390
24438
  };
24391
- const translator$16 = NodeTranslator.from(config$s);
24392
- const encode$15 = (attributes) => attributes?.["w:val"];
24393
- const decode$Y = (attrs) => attrs?.highlight;
24439
+ const translator$19 = NodeTranslator.from(config$v);
24440
+ const encode$18 = (attributes) => attributes?.["w:val"];
24441
+ const decode$_ = (attrs) => attrs?.highlight;
24394
24442
  const attrConfig$D = Object.freeze({
24395
24443
  xmlName: "w:val",
24396
24444
  sdName: "highlight",
24397
- encode: encode$15,
24398
- decode: decode$Y
24445
+ encode: encode$18,
24446
+ decode: decode$_
24399
24447
  });
24400
24448
  const validXmlAttributes$l = [attrConfig$D];
24401
- const XML_NODE_NAME$t = "w:highlight";
24402
- const SD_ATTR_KEY$f = "highlight";
24449
+ const XML_NODE_NAME$w = "w:highlight";
24450
+ const SD_ATTR_KEY$g = "highlight";
24403
24451
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24404
- const encode$14 = (params, encodedAttrs = {}) => {
24452
+ const encode$17 = (params, encodedAttrs = {}) => {
24405
24453
  const { nodes } = params;
24406
24454
  const node = nodes?.[0];
24407
24455
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24408
24456
  return {
24409
24457
  type: "attr",
24410
- xmlName: XML_NODE_NAME$t,
24411
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24458
+ xmlName: XML_NODE_NAME$w,
24459
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24412
24460
  attributes: { "w:val": value ?? null }
24413
24461
  };
24414
24462
  };
24415
- const decode$X = (params) => {
24463
+ const decode$Z = (params) => {
24416
24464
  const attrs = params?.node?.attrs || {};
24417
24465
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24418
24466
  if (!highlightValue) return void 0;
@@ -24420,14 +24468,14 @@ const decode$X = (params) => {
24420
24468
  if (!normalizedValue) return void 0;
24421
24469
  if (DISABLED_TOKENS.has(normalizedValue)) {
24422
24470
  return {
24423
- name: XML_NODE_NAME$t,
24471
+ name: XML_NODE_NAME$w,
24424
24472
  attributes: { "w:val": "none" }
24425
24473
  };
24426
24474
  }
24427
24475
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24428
24476
  if (keyword) {
24429
24477
  return {
24430
- name: XML_NODE_NAME$t,
24478
+ name: XML_NODE_NAME$w,
24431
24479
  attributes: { "w:val": keyword }
24432
24480
  };
24433
24481
  }
@@ -24442,63 +24490,63 @@ const decode$X = (params) => {
24442
24490
  }
24443
24491
  };
24444
24492
  };
24445
- const config$r = {
24446
- xmlName: XML_NODE_NAME$t,
24447
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24493
+ const config$u = {
24494
+ xmlName: XML_NODE_NAME$w,
24495
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24448
24496
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24449
- encode: encode$14,
24450
- decode: decode$X,
24497
+ encode: encode$17,
24498
+ decode: decode$Z,
24451
24499
  attributes: validXmlAttributes$l
24452
24500
  };
24453
- const translator$15 = NodeTranslator.from(config$r);
24454
- const encode$13 = (attributes) => {
24501
+ const translator$18 = NodeTranslator.from(config$u);
24502
+ const encode$16 = (attributes) => {
24455
24503
  return attributes["w:val"];
24456
24504
  };
24457
- const decode$W = (attrs) => {
24505
+ const decode$Y = (attrs) => {
24458
24506
  const { tabSize } = attrs || {};
24459
24507
  return tabSize;
24460
24508
  };
24461
24509
  const attrConfig$C = Object.freeze({
24462
24510
  xmlName: "w:val",
24463
24511
  sdName: "tabSize",
24464
- encode: encode$13,
24465
- decode: decode$W
24512
+ encode: encode$16,
24513
+ decode: decode$Y
24466
24514
  });
24467
- const encode$12 = (attributes) => {
24515
+ const encode$15 = (attributes) => {
24468
24516
  return attributes["w:leader"];
24469
24517
  };
24470
- const decode$V = (attrs) => {
24518
+ const decode$X = (attrs) => {
24471
24519
  const { leader } = attrs || {};
24472
24520
  return leader;
24473
24521
  };
24474
24522
  const attrConfig$B = Object.freeze({
24475
24523
  xmlName: "w:leader",
24476
24524
  sdName: "leader",
24477
- encode: encode$12,
24478
- decode: decode$V
24525
+ encode: encode$15,
24526
+ decode: decode$X
24479
24527
  });
24480
- const encode$11 = (attributes) => {
24528
+ const encode$14 = (attributes) => {
24481
24529
  return attributes["w:pos"];
24482
24530
  };
24483
- const decode$U = (attrs) => {
24531
+ const decode$W = (attrs) => {
24484
24532
  const { pos } = attrs || {};
24485
24533
  return pos;
24486
24534
  };
24487
24535
  const attrConfig$A = Object.freeze({
24488
24536
  xmlName: "w:pos",
24489
24537
  sdName: "pos",
24490
- encode: encode$11,
24491
- decode: decode$U
24538
+ encode: encode$14,
24539
+ decode: decode$W
24492
24540
  });
24493
24541
  const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
24494
- const XML_NODE_NAME$s = "w:tab";
24495
- const SD_NODE_NAME$c = "tab";
24496
- const encode$10 = (_2, encodedAttrs = {}) => {
24542
+ const XML_NODE_NAME$v = "w:tab";
24543
+ const SD_NODE_NAME$e = "tab";
24544
+ const encode$13 = (_2, encodedAttrs = {}) => {
24497
24545
  const translated = { type: "tab" };
24498
24546
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24499
24547
  return translated;
24500
24548
  };
24501
- const decode$T = (params, decodedAttrs = {}) => {
24549
+ const decode$V = (params, decodedAttrs = {}) => {
24502
24550
  const { node } = params || {};
24503
24551
  if (!node) return;
24504
24552
  const wTab = { name: "w:tab" };
@@ -24514,15 +24562,15 @@ const decode$T = (params, decodedAttrs = {}) => {
24514
24562
  }
24515
24563
  return translated;
24516
24564
  };
24517
- const config$q = {
24518
- xmlName: XML_NODE_NAME$s,
24519
- sdNodeOrKeyName: SD_NODE_NAME$c,
24565
+ const config$t = {
24566
+ xmlName: XML_NODE_NAME$v,
24567
+ sdNodeOrKeyName: SD_NODE_NAME$e,
24520
24568
  type: NodeTranslator.translatorTypes.NODE,
24521
- encode: encode$10,
24522
- decode: decode$T,
24569
+ encode: encode$13,
24570
+ decode: decode$V,
24523
24571
  attributes: validXmlAttributes$k
24524
24572
  };
24525
- const translator$14 = NodeTranslator.from(config$q);
24573
+ const translator$17 = NodeTranslator.from(config$t);
24526
24574
  const mergeTextNodes = (nodes) => {
24527
24575
  if (!nodes || !Array.isArray(nodes)) {
24528
24576
  return nodes;
@@ -24896,104 +24944,10 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
24896
24944
  justify: pPrByIdJcAttr
24897
24945
  };
24898
24946
  };
24899
- const preProcessNodesForFldChar = (nodes = []) => {
24900
- const processedNodes = [];
24901
- let buffer2 = [];
24902
- let collecting = false;
24903
- for (const node of nodes) {
24904
- const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
24905
- const fldType = fldCharEl?.attributes?.["w:fldCharType"];
24906
- if (fldType === "begin") {
24907
- buffer2 = [node];
24908
- collecting = true;
24909
- continue;
24910
- }
24911
- if (fldType === "separate" && collecting) {
24912
- buffer2.push(node);
24913
- continue;
24914
- }
24915
- if (fldType === "end" && collecting) {
24916
- buffer2.push(node);
24917
- processedNodes.push(...processCombinedNodesForFldChar(buffer2));
24918
- buffer2 = [];
24919
- collecting = false;
24920
- continue;
24921
- }
24922
- if (collecting) {
24923
- buffer2.push(node);
24924
- } else {
24925
- processedNodes.push(node);
24926
- }
24927
- }
24928
- if (buffer2.length) {
24929
- processedNodes.push(...buffer2);
24930
- }
24931
- return processedNodes;
24932
- };
24933
- const processCombinedNodesForFldChar = (nodesToCombine = []) => {
24934
- let processedNodes = [];
24935
- let hasPageMarker = false;
24936
- let isNumPages = false;
24937
- const textStart = nodesToCombine.findIndex(
24938
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
24939
- );
24940
- const textEnd = nodesToCombine.findIndex(
24941
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
24942
- );
24943
- const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
24944
- const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
24945
- const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
24946
- const instrText = instrTextNode?.elements[0].text;
24947
- if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
24948
- if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
24949
- const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
24950
- if (hasPageMarker) {
24951
- const pageNumNode = {
24952
- name: "sd:autoPageNumber",
24953
- type: "element"
24954
- };
24955
- nodesToCombine.forEach((n) => {
24956
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24957
- if (rPrNode) pageNumNode.elements = [rPrNode];
24958
- });
24959
- processedNodes.push(pageNumNode);
24960
- } else if (isNumPages) {
24961
- const totalPageNumNode = {
24962
- name: "sd:totalPageNumber",
24963
- type: "element"
24964
- };
24965
- nodesToCombine.forEach((n) => {
24966
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24967
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
24968
- });
24969
- processedNodes.push(totalPageNumNode);
24970
- } else if (urlMatch && urlMatch?.length >= 2) {
24971
- const url = urlMatch[1];
24972
- const textMarks = [];
24973
- textNodes.forEach((n) => {
24974
- const rPr2 = n.elements.find((el) => el.name === "w:rPr");
24975
- if (!rPr2) return;
24976
- const { elements } = rPr2;
24977
- elements.forEach((el) => {
24978
- textMarks.push(el);
24979
- });
24980
- });
24981
- const linkMark = { name: "link", attributes: { href: url } };
24982
- const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
24983
- processedNodes.push({
24984
- name: "w:r",
24985
- type: "element",
24986
- elements: [rPr, ...textNodes]
24987
- });
24988
- }
24989
- return processedNodes;
24990
- };
24991
24947
  const handleParagraphNode$1 = (params) => {
24992
24948
  const { nodes, docx, nodeListHandler, filename } = params;
24993
24949
  const node = carbonCopy(nodes[0]);
24994
24950
  let schemaNode;
24995
- let processedElements = preProcessNodesForFldChar(node.elements);
24996
- node.elements = processedElements;
24997
24951
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
24998
24952
  (e) => e.handlerName === "standardNodeHandler"
24999
24953
  )?.handler;
@@ -25134,89 +25088,89 @@ const handleParagraphNode$1 = (params) => {
25134
25088
  }
25135
25089
  return schemaNode;
25136
25090
  };
25137
- const encode$$ = (attributes) => {
25091
+ const encode$12 = (attributes) => {
25138
25092
  return attributes["w:rsidDel"];
25139
25093
  };
25140
- const decode$S = (attrs) => {
25094
+ const decode$U = (attrs) => {
25141
25095
  return attrs.rsidDel;
25142
25096
  };
25143
25097
  const attrConfig$z = Object.freeze({
25144
25098
  xmlName: "w:rsidDel",
25145
25099
  sdName: "rsidDel",
25146
- encode: encode$$,
25147
- decode: decode$S
25100
+ encode: encode$12,
25101
+ decode: decode$U
25148
25102
  });
25149
- const encode$_ = (attributes) => {
25103
+ const encode$11 = (attributes) => {
25150
25104
  return attributes["w:rsidP"];
25151
25105
  };
25152
- const decode$R = (attrs) => {
25106
+ const decode$T = (attrs) => {
25153
25107
  return attrs.rsidP;
25154
25108
  };
25155
25109
  const attrConfig$y = Object.freeze({
25156
25110
  xmlName: "w:rsidP",
25157
25111
  sdName: "rsidP",
25158
- encode: encode$_,
25159
- decode: decode$R
25112
+ encode: encode$11,
25113
+ decode: decode$T
25160
25114
  });
25161
- const encode$Z = (attributes) => {
25115
+ const encode$10 = (attributes) => {
25162
25116
  return attributes["w:rsidR"];
25163
25117
  };
25164
- const decode$Q = (attrs) => {
25118
+ const decode$S = (attrs) => {
25165
25119
  return attrs.rsidR;
25166
25120
  };
25167
25121
  const attrConfig$x = Object.freeze({
25168
25122
  xmlName: "w:rsidR",
25169
25123
  sdName: "rsidR",
25170
- encode: encode$Z,
25171
- decode: decode$Q
25124
+ encode: encode$10,
25125
+ decode: decode$S
25172
25126
  });
25173
- const encode$Y = (attributes) => {
25127
+ const encode$$ = (attributes) => {
25174
25128
  return attributes["w:rsidRPr"];
25175
25129
  };
25176
- const decode$P = (attrs) => {
25130
+ const decode$R = (attrs) => {
25177
25131
  return attrs.rsidRPr;
25178
25132
  };
25179
25133
  const attrConfig$w = Object.freeze({
25180
25134
  xmlName: "w:rsidRPr",
25181
25135
  sdName: "rsidRPr",
25182
- encode: encode$Y,
25183
- decode: decode$P
25136
+ encode: encode$$,
25137
+ decode: decode$R
25184
25138
  });
25185
- const encode$X = (attributes) => {
25139
+ const encode$_ = (attributes) => {
25186
25140
  return attributes["w:rsidRDefault"];
25187
25141
  };
25188
- const decode$O = (attrs) => {
25142
+ const decode$Q = (attrs) => {
25189
25143
  return attrs.rsidRDefault;
25190
25144
  };
25191
25145
  const attrConfig$v = Object.freeze({
25192
25146
  xmlName: "w:rsidRDefault",
25193
25147
  sdName: "rsidRDefault",
25194
- encode: encode$X,
25195
- decode: decode$O
25148
+ encode: encode$_,
25149
+ decode: decode$Q
25196
25150
  });
25197
- const encode$W = (attributes) => {
25151
+ const encode$Z = (attributes) => {
25198
25152
  return attributes["w14:paraId"];
25199
25153
  };
25200
- const decode$N = (attrs) => {
25154
+ const decode$P = (attrs) => {
25201
25155
  return attrs.paraId;
25202
25156
  };
25203
25157
  const attrConfig$u = Object.freeze({
25204
25158
  xmlName: "w14:paraId",
25205
25159
  sdName: "paraId",
25206
- encode: encode$W,
25207
- decode: decode$N
25160
+ encode: encode$Z,
25161
+ decode: decode$P
25208
25162
  });
25209
- const encode$V = (attributes) => {
25163
+ const encode$Y = (attributes) => {
25210
25164
  return attributes["w14:textId"];
25211
25165
  };
25212
- const decode$M = (attrs) => {
25166
+ const decode$O = (attrs) => {
25213
25167
  return attrs.textId;
25214
25168
  };
25215
25169
  const attrConfig$t = Object.freeze({
25216
25170
  xmlName: "w14:textId",
25217
25171
  sdName: "textId",
25218
- encode: encode$V,
25219
- decode: decode$M
25172
+ encode: encode$Y,
25173
+ decode: decode$O
25220
25174
  });
25221
25175
  const validXmlAttributes$j = [
25222
25176
  attrConfig$u,
@@ -25227,9 +25181,9 @@ const validXmlAttributes$j = [
25227
25181
  attrConfig$w,
25228
25182
  attrConfig$z
25229
25183
  ];
25230
- const XML_NODE_NAME$r = "w:p";
25231
- const SD_NODE_NAME$b = "paragraph";
25232
- const encode$U = (params, encodedAttrs = {}) => {
25184
+ const XML_NODE_NAME$u = "w:p";
25185
+ const SD_NODE_NAME$d = "paragraph";
25186
+ const encode$X = (params, encodedAttrs = {}) => {
25233
25187
  const node = handleParagraphNode$1(params);
25234
25188
  if (!node) return void 0;
25235
25189
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25237,7 +25191,7 @@ const encode$U = (params, encodedAttrs = {}) => {
25237
25191
  }
25238
25192
  return node;
25239
25193
  };
25240
- const decode$L = (params, decodedAttrs = {}) => {
25194
+ const decode$N = (params, decodedAttrs = {}) => {
25241
25195
  const translated = translateParagraphNode(params);
25242
25196
  if (!translated) return void 0;
25243
25197
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25245,16 +25199,16 @@ const decode$L = (params, decodedAttrs = {}) => {
25245
25199
  }
25246
25200
  return translated;
25247
25201
  };
25248
- const config$p = {
25249
- xmlName: XML_NODE_NAME$r,
25250
- sdNodeOrKeyName: SD_NODE_NAME$b,
25202
+ const config$s = {
25203
+ xmlName: XML_NODE_NAME$u,
25204
+ sdNodeOrKeyName: SD_NODE_NAME$d,
25251
25205
  type: NodeTranslator.translatorTypes.NODE,
25252
- encode: encode$U,
25253
- decode: decode$L,
25206
+ encode: encode$X,
25207
+ decode: decode$N,
25254
25208
  attributes: validXmlAttributes$j
25255
25209
  };
25256
- const translator$13 = NodeTranslator.from(config$p);
25257
- const encode$T = (attributes) => {
25210
+ const translator$16 = NodeTranslator.from(config$s);
25211
+ const encode$W = (attributes) => {
25258
25212
  const raw = attributes?.["w:val"];
25259
25213
  if (raw === void 0 || raw === null) return void 0;
25260
25214
  if (typeof raw === "boolean") return raw;
@@ -25264,24 +25218,24 @@ const encode$T = (attributes) => {
25264
25218
  if (val === "1" || val === "true" || val === "on") return true;
25265
25219
  return void 0;
25266
25220
  };
25267
- const decode$K = (runProps) => {
25221
+ const decode$M = (runProps) => {
25268
25222
  if (runProps?.bold === false) return "0";
25269
25223
  return void 0;
25270
25224
  };
25271
25225
  const attrConfig$s = Object.freeze({
25272
25226
  xmlName: "w:val",
25273
25227
  sdName: "bold",
25274
- encode: encode$T,
25275
- decode: decode$K
25228
+ encode: encode$W,
25229
+ decode: decode$M
25276
25230
  });
25277
25231
  const validXmlAttributes$i = [attrConfig$s];
25278
- const XML_NODE_NAME$q = "w:b";
25279
- const SD_ATTR_KEY$e = "bold";
25280
- const encode$S = (params, encodedAttrs = {}) => {
25232
+ const XML_NODE_NAME$t = "w:b";
25233
+ const SD_ATTR_KEY$f = "bold";
25234
+ const encode$V = (params, encodedAttrs = {}) => {
25281
25235
  const { nodes } = params;
25282
25236
  const node = nodes[0];
25283
25237
  if (!node) return void 0;
25284
- const val = encodedAttrs?.[SD_ATTR_KEY$e];
25238
+ const val = encodedAttrs?.[SD_ATTR_KEY$f];
25285
25239
  let attributes;
25286
25240
  if (val === false) attributes = { "w:val": "0" };
25287
25241
  else if (val === true)
@@ -25289,85 +25243,85 @@ const encode$S = (params, encodedAttrs = {}) => {
25289
25243
  else attributes = node.attributes || {};
25290
25244
  return {
25291
25245
  type: "attr",
25292
- xmlName: XML_NODE_NAME$q,
25293
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25246
+ xmlName: XML_NODE_NAME$t,
25247
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25294
25248
  attributes
25295
25249
  };
25296
25250
  };
25297
- const config$o = {
25298
- xmlName: XML_NODE_NAME$q,
25299
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25251
+ const config$r = {
25252
+ xmlName: XML_NODE_NAME$t,
25253
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25300
25254
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25301
- encode: encode$S,
25255
+ encode: encode$V,
25302
25256
  attributes: validXmlAttributes$i
25303
25257
  };
25304
- const translator$12 = NodeTranslator.from(config$o);
25305
- const XML_NODE_NAME$p = "w:i";
25306
- const SD_ATTR_KEY$d = "italic";
25307
- const encode$R = (params) => {
25258
+ const translator$15 = NodeTranslator.from(config$r);
25259
+ const XML_NODE_NAME$s = "w:i";
25260
+ const SD_ATTR_KEY$e = "italic";
25261
+ const encode$U = (params) => {
25308
25262
  const { nodes } = params;
25309
25263
  const node = nodes?.[0];
25310
25264
  if (!node) return void 0;
25311
25265
  return {
25312
25266
  type: "attr",
25313
- xmlName: XML_NODE_NAME$p,
25314
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25267
+ xmlName: XML_NODE_NAME$s,
25268
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25315
25269
  attributes: {
25316
25270
  "w:val": node.attributes?.["w:val"] ?? null
25317
25271
  }
25318
25272
  };
25319
25273
  };
25320
- const config$n = {
25321
- xmlName: XML_NODE_NAME$p,
25322
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25274
+ const config$q = {
25275
+ xmlName: XML_NODE_NAME$s,
25276
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25323
25277
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25324
- encode: encode$R
25278
+ encode: encode$U
25325
25279
  };
25326
- const translator$11 = NodeTranslator.from(config$n);
25327
- const encode$Q = (attributes) => attributes?.["w:val"];
25328
- const decode$J = (attrs) => attrs?.underline;
25280
+ const translator$14 = NodeTranslator.from(config$q);
25281
+ const encode$T = (attributes) => attributes?.["w:val"];
25282
+ const decode$L = (attrs) => attrs?.underline;
25329
25283
  const attrConfig$r = Object.freeze({
25330
25284
  xmlName: "w:val",
25331
25285
  sdName: "underline",
25332
- encode: encode$Q,
25333
- decode: decode$J
25286
+ encode: encode$T,
25287
+ decode: decode$L
25334
25288
  });
25335
- const encode$P = (attributes) => attributes?.["w:color"];
25336
- const decode$I = (attrs) => attrs?.color;
25289
+ const encode$S = (attributes) => attributes?.["w:color"];
25290
+ const decode$K = (attrs) => attrs?.color;
25337
25291
  const attrConfig$q = Object.freeze({
25338
25292
  xmlName: "w:color",
25339
25293
  sdName: "color",
25340
- encode: encode$P,
25341
- decode: decode$I
25294
+ encode: encode$S,
25295
+ decode: decode$K
25342
25296
  });
25343
- const encode$O = (attributes) => attributes?.["w:themeColor"];
25344
- const decode$H = (attrs) => attrs?.themeColor;
25297
+ const encode$R = (attributes) => attributes?.["w:themeColor"];
25298
+ const decode$J = (attrs) => attrs?.themeColor;
25345
25299
  const attrConfig$p = Object.freeze({
25346
25300
  xmlName: "w:themeColor",
25347
25301
  sdName: "themeColor",
25348
- encode: encode$O,
25349
- decode: decode$H
25302
+ encode: encode$R,
25303
+ decode: decode$J
25350
25304
  });
25351
- const encode$N = (attributes) => attributes?.["w:themeTint"];
25352
- const decode$G = (attrs) => attrs?.themeTint;
25305
+ const encode$Q = (attributes) => attributes?.["w:themeTint"];
25306
+ const decode$I = (attrs) => attrs?.themeTint;
25353
25307
  const attrConfig$o = Object.freeze({
25354
25308
  xmlName: "w:themeTint",
25355
25309
  sdName: "themeTint",
25356
- encode: encode$N,
25357
- decode: decode$G
25310
+ encode: encode$Q,
25311
+ decode: decode$I
25358
25312
  });
25359
- const encode$M = (attributes) => attributes?.["w:themeShade"];
25360
- const decode$F = (attrs) => attrs?.themeShade;
25313
+ const encode$P = (attributes) => attributes?.["w:themeShade"];
25314
+ const decode$H = (attrs) => attrs?.themeShade;
25361
25315
  const attrConfig$n = Object.freeze({
25362
25316
  xmlName: "w:themeShade",
25363
25317
  sdName: "themeShade",
25364
- encode: encode$M,
25365
- decode: decode$F
25318
+ encode: encode$P,
25319
+ decode: decode$H
25366
25320
  });
25367
25321
  const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25368
- const XML_NODE_NAME$o = "w:u";
25369
- const SD_ATTR_KEY$c = "underline";
25370
- const encode$L = (params, encodedAttrs = {}) => {
25322
+ const XML_NODE_NAME$r = "w:u";
25323
+ const SD_ATTR_KEY$d = "underline";
25324
+ const encode$O = (params, encodedAttrs = {}) => {
25371
25325
  const { nodes } = params;
25372
25326
  const node = nodes?.[0];
25373
25327
  const sourceAttrs = node?.attributes || {};
@@ -25383,12 +25337,12 @@ const encode$L = (params, encodedAttrs = {}) => {
25383
25337
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25384
25338
  return {
25385
25339
  type: "attr",
25386
- xmlName: XML_NODE_NAME$o,
25387
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25340
+ xmlName: XML_NODE_NAME$r,
25341
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25388
25342
  attributes
25389
25343
  };
25390
25344
  };
25391
- const decode$E = (params) => {
25345
+ const decode$G = (params) => {
25392
25346
  const attrs = params?.node?.attrs || {};
25393
25347
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25394
25348
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25406,20 +25360,20 @@ const decode$E = (params) => {
25406
25360
  if (themeTint) attributes["w:themeTint"] = themeTint;
25407
25361
  if (themeShade) attributes["w:themeShade"] = themeShade;
25408
25362
  return {
25409
- name: XML_NODE_NAME$o,
25363
+ name: XML_NODE_NAME$r,
25410
25364
  attributes
25411
25365
  };
25412
25366
  };
25413
- const config$m = {
25414
- xmlName: XML_NODE_NAME$o,
25415
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25367
+ const config$p = {
25368
+ xmlName: XML_NODE_NAME$r,
25369
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25416
25370
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25417
- encode: encode$L,
25418
- decode: decode$E,
25371
+ encode: encode$O,
25372
+ decode: decode$G,
25419
25373
  attributes: validXmlAttributes$h
25420
25374
  };
25421
- const translator$10 = NodeTranslator.from(config$m);
25422
- const encode$K = (attributes) => {
25375
+ const translator$13 = NodeTranslator.from(config$p);
25376
+ const encode$N = (attributes) => {
25423
25377
  const raw = attributes?.["w:val"];
25424
25378
  if (raw === void 0 || raw === null) return void 0;
25425
25379
  if (typeof raw === "boolean") return raw;
@@ -25429,24 +25383,24 @@ const encode$K = (attributes) => {
25429
25383
  if (val === "1" || val === "true" || val === "on") return true;
25430
25384
  return void 0;
25431
25385
  };
25432
- const decode$D = (attrs) => {
25386
+ const decode$F = (attrs) => {
25433
25387
  if (attrs?.strike === false) return "0";
25434
25388
  return void 0;
25435
25389
  };
25436
25390
  const attrConfig$m = Object.freeze({
25437
25391
  xmlName: "w:val",
25438
25392
  sdName: "strike",
25439
- encode: encode$K,
25440
- decode: decode$D
25393
+ encode: encode$N,
25394
+ decode: decode$F
25441
25395
  });
25442
25396
  const validXmlAttributes$g = [attrConfig$m];
25443
- const XML_NODE_NAME$n = "w:strike";
25444
- const SD_ATTR_KEY$b = "strike";
25445
- const encode$J = (params, encodedAttrs = {}) => {
25397
+ const XML_NODE_NAME$q = "w:strike";
25398
+ const SD_ATTR_KEY$c = "strike";
25399
+ const encode$M = (params, encodedAttrs = {}) => {
25446
25400
  const { nodes } = params;
25447
25401
  const node = nodes?.[0];
25448
25402
  if (!node) return void 0;
25449
- const val = encodedAttrs?.[SD_ATTR_KEY$b];
25403
+ const val = encodedAttrs?.[SD_ATTR_KEY$c];
25450
25404
  let attributes;
25451
25405
  if (val === false) attributes = { "w:val": "0" };
25452
25406
  else if (val === true) attributes = {};
@@ -25455,55 +25409,55 @@ const encode$J = (params, encodedAttrs = {}) => {
25455
25409
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25456
25410
  return {
25457
25411
  type: "attr",
25458
- xmlName: XML_NODE_NAME$n,
25459
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25412
+ xmlName: XML_NODE_NAME$q,
25413
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25460
25414
  attributes
25461
25415
  };
25462
25416
  };
25463
- const config$l = {
25464
- xmlName: XML_NODE_NAME$n,
25465
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25417
+ const config$o = {
25418
+ xmlName: XML_NODE_NAME$q,
25419
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25466
25420
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25467
- encode: encode$J,
25421
+ encode: encode$M,
25468
25422
  attributes: validXmlAttributes$g
25469
25423
  };
25470
- const translator$$ = NodeTranslator.from(config$l);
25471
- const encode$I = (attributes) => attributes?.["w:val"];
25472
- const decode$C = (attrs) => attrs?.color;
25424
+ const translator$12 = NodeTranslator.from(config$o);
25425
+ const encode$L = (attributes) => attributes?.["w:val"];
25426
+ const decode$E = (attrs) => attrs?.color;
25473
25427
  const attrConfig$l = Object.freeze({
25474
25428
  xmlName: "w:val",
25475
25429
  sdName: "color",
25476
- encode: encode$I,
25477
- decode: decode$C
25430
+ encode: encode$L,
25431
+ decode: decode$E
25478
25432
  });
25479
- const encode$H = (attributes) => attributes?.["w:themeColor"];
25480
- const decode$B = (attrs) => attrs?.themeColor;
25433
+ const encode$K = (attributes) => attributes?.["w:themeColor"];
25434
+ const decode$D = (attrs) => attrs?.themeColor;
25481
25435
  const attrConfig$k = Object.freeze({
25482
25436
  xmlName: "w:themeColor",
25483
25437
  sdName: "themeColor",
25484
- encode: encode$H,
25485
- decode: decode$B
25438
+ encode: encode$K,
25439
+ decode: decode$D
25486
25440
  });
25487
- const encode$G = (attributes) => attributes?.["w:themeTint"];
25488
- const decode$A = (attrs) => attrs?.themeTint;
25441
+ const encode$J = (attributes) => attributes?.["w:themeTint"];
25442
+ const decode$C = (attrs) => attrs?.themeTint;
25489
25443
  const attrConfig$j = Object.freeze({
25490
25444
  xmlName: "w:themeTint",
25491
25445
  sdName: "themeTint",
25492
- encode: encode$G,
25493
- decode: decode$A
25446
+ encode: encode$J,
25447
+ decode: decode$C
25494
25448
  });
25495
- const encode$F = (attributes) => attributes?.["w:themeShade"];
25496
- const decode$z = (attrs) => attrs?.themeShade;
25449
+ const encode$I = (attributes) => attributes?.["w:themeShade"];
25450
+ const decode$B = (attrs) => attrs?.themeShade;
25497
25451
  const attrConfig$i = Object.freeze({
25498
25452
  xmlName: "w:themeShade",
25499
25453
  sdName: "themeShade",
25500
- encode: encode$F,
25501
- decode: decode$z
25454
+ encode: encode$I,
25455
+ decode: decode$B
25502
25456
  });
25503
25457
  const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25504
- const XML_NODE_NAME$m = "w:color";
25505
- const SD_ATTR_KEY$a = "color";
25506
- const encode$E = (params, encodedAttrs = {}) => {
25458
+ const XML_NODE_NAME$p = "w:color";
25459
+ const SD_ATTR_KEY$b = "color";
25460
+ const encode$H = (params, encodedAttrs = {}) => {
25507
25461
  const { nodes } = params;
25508
25462
  const node = nodes?.[0];
25509
25463
  const sourceAttrs = node?.attributes || {};
@@ -25518,63 +25472,63 @@ const encode$E = (params, encodedAttrs = {}) => {
25518
25472
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25519
25473
  return {
25520
25474
  type: "attr",
25521
- xmlName: XML_NODE_NAME$m,
25522
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25475
+ xmlName: XML_NODE_NAME$p,
25476
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25523
25477
  attributes
25524
25478
  };
25525
25479
  };
25526
- const config$k = {
25527
- xmlName: XML_NODE_NAME$m,
25528
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25480
+ const config$n = {
25481
+ xmlName: XML_NODE_NAME$p,
25482
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25529
25483
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25530
- encode: encode$E,
25484
+ encode: encode$H,
25531
25485
  attributes: validXmlAttributes$f
25532
25486
  };
25533
- const translator$_ = NodeTranslator.from(config$k);
25534
- const encode$D = (attributes) => attributes?.["w:eastAsia"];
25535
- const decode$y = (attrs) => attrs?.eastAsia;
25487
+ const translator$11 = NodeTranslator.from(config$n);
25488
+ const encode$G = (attributes) => attributes?.["w:eastAsia"];
25489
+ const decode$A = (attrs) => attrs?.eastAsia;
25536
25490
  const attrConfig$h = Object.freeze({
25537
25491
  xmlName: "w:eastAsia",
25538
25492
  sdName: "eastAsia",
25539
- encode: encode$D,
25540
- decode: decode$y
25493
+ encode: encode$G,
25494
+ decode: decode$A
25541
25495
  });
25542
- const encode$C = (attributes) => attributes?.["w:ascii"];
25543
- const decode$x = (attrs) => attrs?.ascii;
25496
+ const encode$F = (attributes) => attributes?.["w:ascii"];
25497
+ const decode$z = (attrs) => attrs?.ascii;
25544
25498
  const attrConfig$g = Object.freeze({
25545
25499
  xmlName: "w:ascii",
25546
25500
  sdName: "ascii",
25547
- encode: encode$C,
25548
- decode: decode$x
25501
+ encode: encode$F,
25502
+ decode: decode$z
25549
25503
  });
25550
- const encode$B = (attributes) => attributes?.["w:hAnsi"];
25551
- const decode$w = (attrs) => attrs?.hAnsi;
25504
+ const encode$E = (attributes) => attributes?.["w:hAnsi"];
25505
+ const decode$y = (attrs) => attrs?.hAnsi;
25552
25506
  const attrConfig$f = Object.freeze({
25553
25507
  xmlName: "w:hAnsi",
25554
25508
  sdName: "hAnsi",
25555
- encode: encode$B,
25556
- decode: decode$w
25509
+ encode: encode$E,
25510
+ decode: decode$y
25557
25511
  });
25558
- const encode$A = (attributes) => attributes?.["w:cs"];
25559
- const decode$v = (attrs) => attrs?.cs;
25512
+ const encode$D = (attributes) => attributes?.["w:cs"];
25513
+ const decode$x = (attrs) => attrs?.cs;
25560
25514
  const attrConfig$e = Object.freeze({
25561
25515
  xmlName: "w:cs",
25562
25516
  sdName: "cs",
25563
- encode: encode$A,
25564
- decode: decode$v
25517
+ encode: encode$D,
25518
+ decode: decode$x
25565
25519
  });
25566
- const encode$z = (attributes) => attributes?.["w:val"];
25567
- const decode$u = (attrs) => attrs?.value;
25520
+ const encode$C = (attributes) => attributes?.["w:val"];
25521
+ const decode$w = (attrs) => attrs?.value;
25568
25522
  const attrConfig$d = Object.freeze({
25569
25523
  xmlName: "w:val",
25570
25524
  sdName: "value",
25571
- encode: encode$z,
25572
- decode: decode$u
25525
+ encode: encode$C,
25526
+ decode: decode$w
25573
25527
  });
25574
25528
  const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25575
- const XML_NODE_NAME$l = "w:rFonts";
25576
- const SD_ATTR_KEY$9 = "fontFamily";
25577
- const encode$y = (params, encodedAttrs = {}) => {
25529
+ const XML_NODE_NAME$o = "w:rFonts";
25530
+ const SD_ATTR_KEY$a = "fontFamily";
25531
+ const encode$B = (params, encodedAttrs = {}) => {
25578
25532
  const { nodes } = params;
25579
25533
  const node = nodes?.[0];
25580
25534
  const sourceAttrs = node?.attributes || {};
@@ -25600,120 +25554,281 @@ const encode$y = (params, encodedAttrs = {}) => {
25600
25554
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25601
25555
  return {
25602
25556
  type: "attr",
25603
- xmlName: XML_NODE_NAME$l,
25604
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25557
+ xmlName: XML_NODE_NAME$o,
25558
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25605
25559
  attributes
25606
25560
  };
25607
25561
  };
25608
- const config$j = {
25609
- xmlName: XML_NODE_NAME$l,
25610
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25562
+ const config$m = {
25563
+ xmlName: XML_NODE_NAME$o,
25564
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25611
25565
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25612
- encode: encode$y,
25566
+ encode: encode$B,
25613
25567
  attributes: validXmlAttributes$e
25614
25568
  };
25615
- const translator$Z = NodeTranslator.from(config$j);
25616
- const encode$x = (attributes) => attributes?.["w:val"];
25617
- const decode$t = (attrs) => attrs?.styleId;
25569
+ const translator$10 = NodeTranslator.from(config$m);
25570
+ const encode$A = (attributes) => attributes?.["w:val"];
25571
+ const decode$v = (attrs) => attrs?.styleId;
25618
25572
  const attrConfig$c = Object.freeze({
25619
25573
  xmlName: "w:val",
25620
25574
  sdName: "styleId",
25621
- encode: encode$x,
25622
- decode: decode$t
25575
+ encode: encode$A,
25576
+ decode: decode$v
25623
25577
  });
25624
25578
  const validXmlAttributes$d = [attrConfig$c];
25625
- const XML_NODE_NAME$k = "w:rStyle";
25626
- const SD_ATTR_KEY$8 = "styleId";
25627
- const encode$w = (params, encodedAttrs = {}) => {
25579
+ const XML_NODE_NAME$n = "w:rStyle";
25580
+ const SD_ATTR_KEY$9 = "styleId";
25581
+ const encode$z = (params, encodedAttrs = {}) => {
25628
25582
  const { nodes } = params;
25629
25583
  const node = nodes?.[0];
25630
25584
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25631
25585
  return {
25632
25586
  type: "attr",
25633
- xmlName: XML_NODE_NAME$k,
25634
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25587
+ xmlName: XML_NODE_NAME$n,
25588
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25635
25589
  attributes: { "w:val": value ?? null }
25636
25590
  };
25637
25591
  };
25638
- const config$i = {
25639
- xmlName: XML_NODE_NAME$k,
25640
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25592
+ const config$l = {
25593
+ xmlName: XML_NODE_NAME$n,
25594
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25641
25595
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25642
- encode: encode$w,
25596
+ encode: encode$z,
25643
25597
  attributes: validXmlAttributes$d
25644
25598
  };
25645
- const translator$Y = NodeTranslator.from(config$i);
25646
- const encode$v = (attributes) => attributes?.["w:val"];
25647
- const decode$s = (attrs) => attrs?.fontSize;
25599
+ const translator$$ = NodeTranslator.from(config$l);
25600
+ const encode$y = (attributes) => attributes?.["w:val"];
25601
+ const decode$u = (attrs) => attrs?.fontSize;
25648
25602
  const attrConfig$b = Object.freeze({
25649
25603
  xmlName: "w:val",
25650
25604
  sdName: "fontSize",
25651
- encode: encode$v,
25652
- decode: decode$s
25605
+ encode: encode$y,
25606
+ decode: decode$u
25653
25607
  });
25654
25608
  const validXmlAttributes$c = [attrConfig$b];
25655
- const XML_NODE_NAME$j = "w:sz";
25656
- const SD_ATTR_KEY$7 = "fontSize";
25657
- const encode$u = (params, encodedAttrs = {}) => {
25609
+ const XML_NODE_NAME$m = "w:sz";
25610
+ const SD_ATTR_KEY$8 = "fontSize";
25611
+ const encode$x = (params, encodedAttrs = {}) => {
25658
25612
  const { nodes } = params;
25659
25613
  const node = nodes?.[0];
25660
25614
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25661
25615
  return {
25662
25616
  type: "attr",
25663
- xmlName: XML_NODE_NAME$j,
25664
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25617
+ xmlName: XML_NODE_NAME$m,
25618
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25665
25619
  attributes: { "w:val": value ?? null }
25666
25620
  };
25667
25621
  };
25668
- const config$h = {
25669
- xmlName: XML_NODE_NAME$j,
25670
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25622
+ const config$k = {
25623
+ xmlName: XML_NODE_NAME$m,
25624
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25671
25625
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25672
- encode: encode$u,
25626
+ encode: encode$x,
25673
25627
  attributes: validXmlAttributes$c
25674
25628
  };
25675
- const translator$X = NodeTranslator.from(config$h);
25676
- const encode$t = (attributes) => attributes?.["w:val"];
25677
- const decode$r = (attrs) => attrs?.fontSizeCs;
25629
+ const translator$_ = NodeTranslator.from(config$k);
25630
+ const encode$w = (attributes) => attributes?.["w:val"];
25631
+ const decode$t = (attrs) => attrs?.fontSizeCs;
25678
25632
  const attrConfig$a = Object.freeze({
25679
25633
  xmlName: "w:val",
25680
25634
  sdName: "fontSizeCs",
25681
- encode: encode$t,
25682
- decode: decode$r
25635
+ encode: encode$w,
25636
+ decode: decode$t
25683
25637
  });
25684
25638
  const validXmlAttributes$b = [attrConfig$a];
25685
- const XML_NODE_NAME$i = "w:szCs";
25686
- const SD_ATTR_KEY$6 = "fontSizeCs";
25687
- const encode$s = (params, encodedAttrs = {}) => {
25639
+ const XML_NODE_NAME$l = "w:szCs";
25640
+ const SD_ATTR_KEY$7 = "fontSizeCs";
25641
+ const encode$v = (params, encodedAttrs = {}) => {
25688
25642
  const { nodes } = params;
25689
25643
  const node = nodes?.[0];
25690
25644
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25691
25645
  return {
25692
25646
  type: "attr",
25693
- xmlName: XML_NODE_NAME$i,
25694
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25647
+ xmlName: XML_NODE_NAME$l,
25648
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25695
25649
  attributes: { "w:val": value ?? null }
25696
25650
  };
25697
25651
  };
25698
- const config$g = {
25699
- xmlName: XML_NODE_NAME$i,
25700
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25652
+ const config$j = {
25653
+ xmlName: XML_NODE_NAME$l,
25654
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25701
25655
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25702
- encode: encode$s,
25656
+ encode: encode$v,
25703
25657
  attributes: validXmlAttributes$b
25704
25658
  };
25705
- const translator$W = NodeTranslator.from(config$g);
25659
+ const translator$Z = NodeTranslator.from(config$j);
25660
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
25661
+ handlerName,
25662
+ handler: (params) => {
25663
+ const { nodes } = params;
25664
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
25665
+ return { nodes: [], consumed: 0 };
25666
+ }
25667
+ const result = translator2.encode(params);
25668
+ if (!result) return { nodes: [], consumed: 0 };
25669
+ return {
25670
+ nodes: Array.isArray(result) ? result : [result],
25671
+ consumed: 1
25672
+ };
25673
+ }
25674
+ });
25675
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
25676
+ if (!sdName) sdName = xmlName.split(":")[1];
25677
+ if (!transformEncode) transformEncode = (v2) => v2;
25678
+ if (!transformDecode) transformDecode = (v2) => v2;
25679
+ return {
25680
+ xmlName,
25681
+ sdNodeOrKeyName: sdName,
25682
+ encode: ({ nodes }) => {
25683
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
25684
+ },
25685
+ decode: ({ node }) => {
25686
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
25687
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
25688
+ }
25689
+ };
25690
+ }
25691
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
25692
+ if (!sdName) sdName = xmlName.split(":")[1];
25693
+ return {
25694
+ xmlName,
25695
+ sdNodeOrKeyName: sdName,
25696
+ attributes: [
25697
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
25698
+ createAttributeHandler("w:type")
25699
+ ],
25700
+ encode: (_2, encodedAttrs) => {
25701
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
25702
+ },
25703
+ decode: function({ node }) {
25704
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25705
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
25706
+ }
25707
+ };
25708
+ }
25709
+ function createBorderPropertyHandler(xmlName, sdName = null) {
25710
+ if (!sdName) sdName = xmlName.split(":")[1];
25711
+ return {
25712
+ xmlName,
25713
+ sdNodeOrKeyName: sdName,
25714
+ attributes: [
25715
+ createAttributeHandler("w:val"),
25716
+ createAttributeHandler("w:color"),
25717
+ createAttributeHandler("w:themeColor"),
25718
+ createAttributeHandler("w:themeTint"),
25719
+ createAttributeHandler("w:themeShade"),
25720
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
25721
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
25722
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
25723
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
25724
+ ],
25725
+ encode: (params, encodedAttrs) => {
25726
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
25727
+ },
25728
+ decode: function({ node }, context) {
25729
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25730
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
25731
+ }
25732
+ };
25733
+ }
25734
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
25735
+ if (!transformEncode) transformEncode = (v2) => v2;
25736
+ if (!transformDecode) transformDecode = (v2) => v2;
25737
+ if (!sdName) sdName = xmlName.split(":")[1];
25738
+ return {
25739
+ xmlName,
25740
+ sdName,
25741
+ encode: (attributes) => transformEncode(attributes[xmlName]),
25742
+ decode: (attributes) => transformDecode(attributes[sdName])
25743
+ };
25744
+ };
25745
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
25746
+ if (!node?.elements || node.elements.length === 0) {
25747
+ return asArray ? [] : {};
25748
+ }
25749
+ const attributes = asArray ? [] : {};
25750
+ node.elements.forEach((el) => {
25751
+ const translator2 = translatorsByXmlName[el.name];
25752
+ if (translator2) {
25753
+ const encodedAttr = translator2.encode({ nodes: [el] });
25754
+ if (encodedAttr != null) {
25755
+ if (asArray) {
25756
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
25757
+ } else {
25758
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
25759
+ }
25760
+ }
25761
+ }
25762
+ });
25763
+ return attributes;
25764
+ }
25765
+ function decodeProperties(translatorsBySdName, properties) {
25766
+ if (!properties || typeof properties !== "object") {
25767
+ return [];
25768
+ }
25769
+ const elements = [];
25770
+ Object.keys(properties).forEach((key) => {
25771
+ const translator2 = translatorsBySdName[key];
25772
+ if (translator2) {
25773
+ const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
25774
+ if (result != null) {
25775
+ result.name = translator2.xmlName;
25776
+ elements.push(result);
25777
+ }
25778
+ }
25779
+ });
25780
+ return elements;
25781
+ }
25782
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
25783
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
25784
+ const parseInteger = (value) => {
25785
+ if (value == null) return void 0;
25786
+ const intValue = parseInt(value, 10);
25787
+ return isNaN(intValue) ? void 0 : intValue;
25788
+ };
25789
+ const integerToString = (value) => {
25790
+ const intValue = parseInteger(value);
25791
+ return intValue != void 0 ? String(intValue) : void 0;
25792
+ };
25793
+ const XML_NODE_NAME$k = "w:caps";
25794
+ const SD_ATTR_KEY$6 = "textTransform";
25795
+ const encode$u = (params, encodedAttrs = {}) => {
25796
+ const { nodes } = params;
25797
+ const node = nodes[0];
25798
+ if (!node) return void 0;
25799
+ let result;
25800
+ if (!["false", "0"].includes(encodedAttrs.val)) {
25801
+ result = "uppercase";
25802
+ } else {
25803
+ return void 0;
25804
+ }
25805
+ return {
25806
+ type: "attr",
25807
+ xmlName: XML_NODE_NAME$k,
25808
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25809
+ attributes: { [SD_ATTR_KEY$6]: result }
25810
+ };
25811
+ };
25812
+ const config$i = {
25813
+ xmlName: XML_NODE_NAME$k,
25814
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25815
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25816
+ encode: encode$u,
25817
+ attributes: [createAttributeHandler("w:val")]
25818
+ };
25819
+ const translator$Y = NodeTranslator.from(config$i);
25706
25820
  const runPropertyTranslators = Object.freeze({
25707
- "w:b": translator$12,
25708
- "w:i": translator$11,
25709
- "w:u": translator$10,
25710
- "w:strike": translator$$,
25711
- "w:color": translator$_,
25712
- "w:highlight": translator$15,
25713
- "w:rFonts": translator$Z,
25714
- "w:rStyle": translator$Y,
25715
- "w:sz": translator$X,
25716
- "w:szCs": translator$W
25821
+ "w:b": translator$15,
25822
+ "w:i": translator$14,
25823
+ "w:u": translator$13,
25824
+ "w:strike": translator$12,
25825
+ "w:color": translator$11,
25826
+ "w:highlight": translator$18,
25827
+ "w:rFonts": translator$10,
25828
+ "w:rStyle": translator$$,
25829
+ "w:sz": translator$_,
25830
+ "w:szCs": translator$Z,
25831
+ "w:caps": translator$Y
25717
25832
  });
25718
25833
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25719
25834
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25727,9 +25842,9 @@ const toRunPropertyEntry = (candidate) => {
25727
25842
  attributes: { ...candidate.attributes || {} }
25728
25843
  };
25729
25844
  };
25730
- const XML_NODE_NAME$h = "w:rPr";
25845
+ const XML_NODE_NAME$j = "w:rPr";
25731
25846
  const SD_ATTR_KEY$5 = "runProperties";
25732
- const encode$r = (params) => {
25847
+ const encode$t = (params) => {
25733
25848
  const { nodes } = params;
25734
25849
  const node = nodes?.[0] || {};
25735
25850
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25763,16 +25878,16 @@ const encode$r = (params) => {
25763
25878
  attributes: runPropsArray
25764
25879
  };
25765
25880
  };
25766
- const config$f = {
25767
- xmlName: XML_NODE_NAME$h,
25881
+ const config$h = {
25882
+ xmlName: XML_NODE_NAME$j,
25768
25883
  sdNodeOrKeyName: SD_ATTR_KEY$5,
25769
25884
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25770
- encode: encode$r
25885
+ encode: encode$t
25771
25886
  };
25772
- const translator$V = NodeTranslator.from(config$f);
25887
+ const translator$X = NodeTranslator.from(config$h);
25773
25888
  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;
25774
25889
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25775
- const collectRunProperties = (params, rPrNode, translator2 = translator$V) => {
25890
+ const collectRunProperties = (params, rPrNode, translator2 = translator$X) => {
25776
25891
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25777
25892
  const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
25778
25893
  let entries = [];
@@ -25841,7 +25956,10 @@ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
25841
25956
  };
25842
25957
  const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
25843
25958
  const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
25844
- const runStyleMarks = collectStyleMarks(runStyleId, docx);
25959
+ if (paragraphStyleId?.startsWith("TOC")) {
25960
+ return paragraphStyleMarks;
25961
+ }
25962
+ let runStyleMarks = collectStyleMarks(runStyleId, docx);
25845
25963
  const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
25846
25964
  const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
25847
25965
  return { inlineMarks, textStyleAttrs };
@@ -26067,6 +26185,13 @@ const splitRunProperties = (entries = [], docx = null) => {
26067
26185
  }
26068
26186
  break;
26069
26187
  }
26188
+ case "w:caps": {
26189
+ if (attributes["textTransform"] != null) {
26190
+ hasTextStyle = true;
26191
+ textStyleAttrs.textTransform = attributes["textTransform"];
26192
+ }
26193
+ break;
26194
+ }
26070
26195
  case "w:rFonts": {
26071
26196
  const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
26072
26197
  const eastAsiaFamily = attributes["w:eastAsia"];
@@ -26086,9 +26211,10 @@ const splitRunProperties = (entries = [], docx = null) => {
26086
26211
  case "w:sz":
26087
26212
  case "w:szCs": {
26088
26213
  const rawSize = Number(attributes["w:val"]);
26214
+ const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
26089
26215
  if (Number.isFinite(rawSize) && rawSize > 0) {
26090
26216
  hasTextStyle = true;
26091
- textStyleAttrs.fontSize = `${rawSize / 2}pt`;
26217
+ textStyleAttrs[attrName] = `${rawSize / 2}pt`;
26092
26218
  }
26093
26219
  break;
26094
26220
  }
@@ -26234,46 +26360,166 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26234
26360
  }
26235
26361
  return runs;
26236
26362
  };
26237
- const encode$q = (attributes) => {
26238
- return attributes["w:rsidR"];
26239
- };
26240
- const decode$q = (attrs) => {
26363
+ const XML_NODE_NAME$i = "w:hyperlink";
26364
+ const SD_NODE_NAME$c = "link";
26365
+ const _createAttributeHandler = (xmlName, sdName) => ({
26366
+ xmlName,
26367
+ sdName,
26368
+ encode: (attributes) => attributes[xmlName],
26369
+ decode: (attributes) => attributes[sdName]
26370
+ });
26371
+ const validXmlAttributes$a = [
26372
+ _createAttributeHandler("w:anchor", "anchor"),
26373
+ _createAttributeHandler("w:docLocation", "docLocation"),
26374
+ {
26375
+ xmlName: "w:history",
26376
+ sdName: "history",
26377
+ encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
26378
+ decode: (attributes) => attributes["history"] ? "1" : "0"
26379
+ },
26380
+ _createAttributeHandler("w:tooltip", "tooltip"),
26381
+ _createAttributeHandler("r:id", "rId"),
26382
+ _createAttributeHandler("w:tgtFrame", "target")
26383
+ ];
26384
+ const encode$s = (params, encodedAttrs) => {
26385
+ const { nodes, docx, nodeListHandler } = params;
26386
+ const node = nodes[0];
26387
+ let href = _resolveHref(docx, encodedAttrs);
26388
+ const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
26389
+ const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
26390
+ const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
26391
+ contentNodes.forEach((contentNode) => {
26392
+ const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
26393
+ const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
26394
+ contentNode.marks = [...marksWithoutLink, linkMark];
26395
+ });
26396
+ const updatedNode = nodeListHandler.handler({
26397
+ ...params,
26398
+ nodes: contentNodes,
26399
+ path: [...params.path || [], node]
26400
+ });
26401
+ return updatedNode;
26402
+ };
26403
+ const _resolveHref = (docx, encodedAttrs) => {
26404
+ const rels = docx["word/_rels/document.xml.rels"];
26405
+ const relationships = rels.elements.find((el) => el.name === "Relationships");
26406
+ const { elements } = relationships;
26407
+ const { rId, anchor } = encodedAttrs;
26408
+ let href;
26409
+ if (!rId && anchor) {
26410
+ href = `#${anchor}`;
26411
+ } else if (rId) {
26412
+ const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
26413
+ const { attributes: relAttributes = {} } = rel;
26414
+ href = relAttributes["Target"];
26415
+ }
26416
+ return href;
26417
+ };
26418
+ function decode$s(params) {
26419
+ const { hyperlinkGroup = [params.node] } = params.extraParams || {};
26420
+ const node = hyperlinkGroup[0];
26421
+ const linkMark = node.marks.find((m2) => m2.type === "link");
26422
+ const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
26423
+ let { anchor, href: link } = linkMark.attrs;
26424
+ const isExternalLink = !anchor;
26425
+ if (isExternalLink) {
26426
+ linkAttrs["r:id"] = _addNewLinkRelationship(params, link, linkAttrs["r:id"]);
26427
+ }
26428
+ let contentNodes = [];
26429
+ hyperlinkGroup.forEach((linkNode) => {
26430
+ if ("marks" in linkNode) {
26431
+ linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
26432
+ } else {
26433
+ linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
26434
+ }
26435
+ const outputNode = exportSchemaToJson({ ...params, node: linkNode });
26436
+ if (outputNode) {
26437
+ if (outputNode instanceof Array) contentNodes.push(...outputNode);
26438
+ else contentNodes.push(outputNode);
26439
+ }
26440
+ });
26441
+ const newNode = {
26442
+ name: "w:hyperlink",
26443
+ type: "element",
26444
+ attributes: {
26445
+ ...linkAttrs
26446
+ },
26447
+ elements: contentNodes
26448
+ };
26449
+ return newNode;
26450
+ }
26451
+ function _addNewLinkRelationship(params, link, rId) {
26452
+ if (!rId) rId = generateDocxRandomId();
26453
+ if (!params.relationships || !Array.isArray(params.relationships)) {
26454
+ params.relationships = [];
26455
+ }
26456
+ const existingRel = params.relationships.find(
26457
+ (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
26458
+ );
26459
+ if (existingRel) {
26460
+ return rId;
26461
+ }
26462
+ params.relationships.push({
26463
+ type: "element",
26464
+ name: "Relationship",
26465
+ attributes: {
26466
+ Id: rId,
26467
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
26468
+ Target: link,
26469
+ TargetMode: "External"
26470
+ }
26471
+ });
26472
+ return rId;
26473
+ }
26474
+ const config$g = {
26475
+ xmlName: XML_NODE_NAME$i,
26476
+ sdNodeOrKeyName: SD_NODE_NAME$c,
26477
+ type: NodeTranslator.translatorTypes.NODE,
26478
+ encode: encode$s,
26479
+ decode: decode$s,
26480
+ attributes: validXmlAttributes$a
26481
+ };
26482
+ const translator$W = NodeTranslator.from(config$g);
26483
+ const encode$r = (attributes) => {
26484
+ return attributes["w:rsidR"];
26485
+ };
26486
+ const decode$r = (attrs) => {
26241
26487
  return attrs.rsidR;
26242
26488
  };
26243
26489
  const attrConfig$9 = Object.freeze({
26244
26490
  xmlName: "w:rsidR",
26245
26491
  sdName: "rsidR",
26246
- encode: encode$q,
26247
- decode: decode$q
26492
+ encode: encode$r,
26493
+ decode: decode$r
26248
26494
  });
26249
- const encode$p = (attributes) => {
26495
+ const encode$q = (attributes) => {
26250
26496
  return attributes["w:rsidRPr"];
26251
26497
  };
26252
- const decode$p = (attrs) => {
26498
+ const decode$q = (attrs) => {
26253
26499
  return attrs.rsidRPr;
26254
26500
  };
26255
26501
  const attrConfig$8 = Object.freeze({
26256
26502
  xmlName: "w:rsidRPr",
26257
26503
  sdName: "rsidRPr",
26258
- encode: encode$p,
26259
- decode: decode$p
26504
+ encode: encode$q,
26505
+ decode: decode$q
26260
26506
  });
26261
- const encode$o = (attributes) => {
26507
+ const encode$p = (attributes) => {
26262
26508
  return attributes["w:rsidDel"];
26263
26509
  };
26264
- const decode$o = (attrs) => {
26510
+ const decode$p = (attrs) => {
26265
26511
  return attrs.rsidDel;
26266
26512
  };
26267
26513
  const attrConfig$7 = Object.freeze({
26268
26514
  xmlName: "w:rsidDel",
26269
26515
  sdName: "rsidDel",
26270
- encode: encode$o,
26271
- decode: decode$o
26516
+ encode: encode$p,
26517
+ decode: decode$p
26272
26518
  });
26273
- const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
26274
- const XML_NODE_NAME$g = "w:r";
26519
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26520
+ const XML_NODE_NAME$h = "w:r";
26275
26521
  const SD_KEY_NAME = "run";
26276
- const encode$n = (params, encodedAttrs = {}) => {
26522
+ const encode$o = (params, encodedAttrs = {}) => {
26277
26523
  const { nodes = [], nodeListHandler } = params || {};
26278
26524
  const runNode = nodes[0];
26279
26525
  if (!runNode) return void 0;
@@ -26321,9 +26567,11 @@ const encode$n = (params, encodedAttrs = {}) => {
26321
26567
  }
26322
26568
  return runNodeResult;
26323
26569
  };
26324
- const decode$n = (params, decodedAttrs = {}) => {
26570
+ const decode$o = (params, decodedAttrs = {}) => {
26325
26571
  const { node } = params || {};
26326
26572
  if (!node) return void 0;
26573
+ const isLinkNode = node.marks?.some((m2) => m2.type === "link");
26574
+ if (isLinkNode) return translator$W.decode(params);
26327
26575
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26328
26576
  const runAttrs = runNodeForExport.attrs || {};
26329
26577
  const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
@@ -26378,7 +26626,7 @@ const decode$n = (params, decodedAttrs = {}) => {
26378
26626
  runs.push(trackedClone);
26379
26627
  return;
26380
26628
  }
26381
- const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
26629
+ const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
26382
26630
  applyBaseRunProps(runWrapper);
26383
26631
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26384
26632
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26386,7 +26634,7 @@ const decode$n = (params, decodedAttrs = {}) => {
26386
26634
  });
26387
26635
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26388
26636
  if (!trackedRuns.length) {
26389
- const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
26637
+ const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
26390
26638
  applyBaseRunProps(emptyRun);
26391
26639
  trackedRuns.push(emptyRun);
26392
26640
  }
@@ -26400,148 +26648,15 @@ const decode$n = (params, decodedAttrs = {}) => {
26400
26648
  }
26401
26649
  return trackedRuns;
26402
26650
  };
26403
- const config$e = {
26404
- xmlName: XML_NODE_NAME$g,
26651
+ const config$f = {
26652
+ xmlName: XML_NODE_NAME$h,
26405
26653
  sdNodeOrKeyName: SD_KEY_NAME,
26406
26654
  type: NodeTranslator.translatorTypes.NODE,
26407
- encode: encode$n,
26408
- decode: decode$n,
26409
- attributes: validXmlAttributes$a
26410
- };
26411
- const translator$U = NodeTranslator.from(config$e);
26412
- const generateV2HandlerEntity = (handlerName, translator2) => ({
26413
- handlerName,
26414
- handler: (params) => {
26415
- const { nodes } = params;
26416
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
26417
- return { nodes: [], consumed: 0 };
26418
- }
26419
- const result = translator2.encode(params);
26420
- if (!result) return { nodes: [], consumed: 0 };
26421
- return {
26422
- nodes: Array.isArray(result) ? result : [result],
26423
- consumed: 1
26424
- };
26425
- }
26426
- });
26427
- function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
26428
- if (!sdName) sdName = xmlName.split(":")[1];
26429
- if (!transformEncode) transformEncode = (v2) => v2;
26430
- if (!transformDecode) transformDecode = (v2) => v2;
26431
- return {
26432
- xmlName,
26433
- sdNodeOrKeyName: sdName,
26434
- encode: ({ nodes }) => {
26435
- return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
26436
- },
26437
- decode: ({ node }) => {
26438
- const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
26439
- return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
26440
- }
26441
- };
26442
- }
26443
- function createMeasurementPropertyHandler(xmlName, sdName = null) {
26444
- if (!sdName) sdName = xmlName.split(":")[1];
26445
- return {
26446
- xmlName,
26447
- sdNodeOrKeyName: sdName,
26448
- attributes: [
26449
- createAttributeHandler("w:w", "value", parseInteger, integerToString),
26450
- createAttributeHandler("w:type")
26451
- ],
26452
- encode: (_2, encodedAttrs) => {
26453
- return encodedAttrs["value"] != null ? encodedAttrs : void 0;
26454
- },
26455
- decode: function({ node }) {
26456
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26457
- return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
26458
- }
26459
- };
26460
- }
26461
- function createBorderPropertyHandler(xmlName, sdName = null) {
26462
- if (!sdName) sdName = xmlName.split(":")[1];
26463
- return {
26464
- xmlName,
26465
- sdNodeOrKeyName: sdName,
26466
- attributes: [
26467
- createAttributeHandler("w:val"),
26468
- createAttributeHandler("w:color"),
26469
- createAttributeHandler("w:themeColor"),
26470
- createAttributeHandler("w:themeTint"),
26471
- createAttributeHandler("w:themeShade"),
26472
- createAttributeHandler("w:sz", "size", parseInteger, integerToString),
26473
- createAttributeHandler("w:space", null, parseInteger, integerToString),
26474
- createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
26475
- createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
26476
- ],
26477
- encode: (params, encodedAttrs) => {
26478
- return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
26479
- },
26480
- decode: function({ node }, context) {
26481
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26482
- return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26483
- }
26484
- };
26485
- }
26486
- const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
26487
- if (!transformEncode) transformEncode = (v2) => v2;
26488
- if (!transformDecode) transformDecode = (v2) => v2;
26489
- if (!sdName) sdName = xmlName.split(":")[1];
26490
- return {
26491
- xmlName,
26492
- sdName,
26493
- encode: (attributes) => transformEncode(attributes[xmlName]),
26494
- decode: (attributes) => transformDecode(attributes[sdName])
26495
- };
26496
- };
26497
- function encodeProperties(node, translatorsByXmlName, asArray = false) {
26498
- if (!node?.elements || node.elements.length === 0) {
26499
- return asArray ? [] : {};
26500
- }
26501
- const attributes = asArray ? [] : {};
26502
- node.elements.forEach((el) => {
26503
- const translator2 = translatorsByXmlName[el.name];
26504
- if (translator2) {
26505
- const encodedAttr = translator2.encode({ nodes: [el] });
26506
- if (encodedAttr != null) {
26507
- if (asArray) {
26508
- attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
26509
- } else {
26510
- attributes[translator2.sdNodeOrKeyName] = encodedAttr;
26511
- }
26512
- }
26513
- }
26514
- });
26515
- return attributes;
26516
- }
26517
- function decodeProperties(translatorsBySdName, properties) {
26518
- if (!properties || typeof properties !== "object") {
26519
- return [];
26520
- }
26521
- const elements = [];
26522
- Object.keys(properties).forEach((key) => {
26523
- const translator2 = translatorsBySdName[key];
26524
- if (translator2) {
26525
- const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
26526
- if (result != null) {
26527
- result.name = translator2.xmlName;
26528
- elements.push(result);
26529
- }
26530
- }
26531
- });
26532
- return elements;
26533
- }
26534
- const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
26535
- const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
26536
- const parseInteger = (value) => {
26537
- if (value == null) return void 0;
26538
- const intValue = parseInt(value, 10);
26539
- return isNaN(intValue) ? void 0 : intValue;
26540
- };
26541
- const integerToString = (value) => {
26542
- const intValue = parseInteger(value);
26543
- return intValue != void 0 ? String(intValue) : void 0;
26655
+ encode: encode$o,
26656
+ decode: decode$o,
26657
+ attributes: validXmlAttributes$9
26544
26658
  };
26659
+ const translator$V = NodeTranslator.from(config$f);
26545
26660
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26546
26661
  if (!table || !Array.isArray(table.content)) {
26547
26662
  return table;
@@ -26582,13 +26697,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26582
26697
  }
26583
26698
  return table;
26584
26699
  }
26585
- const translator$T = NodeTranslator.from({
26700
+ const translator$U = NodeTranslator.from({
26586
26701
  xmlName: "w:cantSplit",
26587
26702
  sdNodeOrKeyName: "cantSplit",
26588
26703
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26589
26704
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26590
26705
  });
26591
- const translator$S = NodeTranslator.from({
26706
+ const translator$T = NodeTranslator.from({
26592
26707
  xmlName: "w:cnfStyle",
26593
26708
  sdNodeOrKeyName: "cnfStyle",
26594
26709
  attributes: [
@@ -26614,8 +26729,8 @@ const translator$S = NodeTranslator.from({
26614
26729
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26615
26730
  }
26616
26731
  });
26617
- const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26618
- const translator$Q = NodeTranslator.from(
26732
+ const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26733
+ const translator$R = NodeTranslator.from(
26619
26734
  createSingleAttrPropertyHandler(
26620
26735
  "w:gridAfter",
26621
26736
  null,
@@ -26624,7 +26739,7 @@ const translator$Q = NodeTranslator.from(
26624
26739
  (v2) => integerToString(v2)
26625
26740
  )
26626
26741
  );
26627
- const translator$P = NodeTranslator.from(
26742
+ const translator$Q = NodeTranslator.from(
26628
26743
  createSingleAttrPropertyHandler(
26629
26744
  "w:gridBefore",
26630
26745
  null,
@@ -26633,21 +26748,21 @@ const translator$P = NodeTranslator.from(
26633
26748
  (v2) => integerToString(v2)
26634
26749
  )
26635
26750
  );
26636
- const translator$O = NodeTranslator.from({
26751
+ const translator$P = NodeTranslator.from({
26637
26752
  xmlName: "w:hidden",
26638
26753
  sdNodeOrKeyName: "hidden",
26639
26754
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26640
26755
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26641
26756
  });
26642
- const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26643
- const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26644
- const translator$L = NodeTranslator.from({
26757
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26758
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26759
+ const translator$M = NodeTranslator.from({
26645
26760
  xmlName: "w:tblHeader",
26646
26761
  sdNodeOrKeyName: "repeatHeader",
26647
26762
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26648
26763
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26649
26764
  });
26650
- const translator$K = NodeTranslator.from({
26765
+ const translator$L = NodeTranslator.from({
26651
26766
  xmlName: "w:trHeight",
26652
26767
  sdNodeOrKeyName: "rowHeight",
26653
26768
  encode: ({ nodes }) => {
@@ -26674,11 +26789,11 @@ const translator$K = NodeTranslator.from({
26674
26789
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26675
26790
  }
26676
26791
  });
26677
- const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26678
- const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26679
- const XML_NODE_NAME$f = "w:trPr";
26792
+ const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26793
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26794
+ const XML_NODE_NAME$g = "w:trPr";
26680
26795
  const SD_ATTR_KEY$4 = "tableRowProperties";
26681
- const encode$m = (params) => {
26796
+ const encode$n = (params) => {
26682
26797
  const { nodes } = params;
26683
26798
  const node = nodes[0];
26684
26799
  let attributes = {
@@ -26692,12 +26807,12 @@ const encode$m = (params) => {
26692
26807
  };
26693
26808
  return {
26694
26809
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26695
- xmlName: XML_NODE_NAME$f,
26810
+ xmlName: XML_NODE_NAME$g,
26696
26811
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26697
26812
  attributes
26698
26813
  };
26699
26814
  };
26700
- const decode$m = (params) => {
26815
+ const decode$n = (params) => {
26701
26816
  const { tableRowProperties = {} } = params.node.attrs || {};
26702
26817
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26703
26818
  const newNode = {
@@ -26709,6 +26824,7 @@ const decode$m = (params) => {
26709
26824
  return newNode;
26710
26825
  };
26711
26826
  const propertyTranslators$3 = [
26827
+ translator$U,
26712
26828
  translator$T,
26713
26829
  translator$S,
26714
26830
  translator$R,
@@ -26719,8 +26835,7 @@ const propertyTranslators$3 = [
26719
26835
  translator$M,
26720
26836
  translator$L,
26721
26837
  translator$K,
26722
- translator$J,
26723
- translator$I
26838
+ translator$J
26724
26839
  ];
26725
26840
  const propertyTranslatorsByXmlName$2 = {};
26726
26841
  propertyTranslators$3.forEach((translator2) => {
@@ -26730,25 +26845,25 @@ const propertyTranslatorsBySdName$2 = {};
26730
26845
  propertyTranslators$3.forEach((translator2) => {
26731
26846
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26732
26847
  });
26733
- const config$d = {
26734
- xmlName: XML_NODE_NAME$f,
26848
+ const config$e = {
26849
+ xmlName: XML_NODE_NAME$g,
26735
26850
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26736
26851
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26737
- encode: encode$m,
26738
- decode: decode$m
26852
+ encode: encode$n,
26853
+ decode: decode$n
26739
26854
  };
26740
- const translator$H = NodeTranslator.from(config$d);
26741
- const XML_NODE_NAME$e = "w:tr";
26742
- const SD_NODE_NAME$a = "tableRow";
26743
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26855
+ const translator$I = NodeTranslator.from(config$e);
26856
+ const XML_NODE_NAME$f = "w:tr";
26857
+ const SD_NODE_NAME$b = "tableRow";
26858
+ const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26744
26859
  (xmlName) => createAttributeHandler(xmlName)
26745
26860
  );
26746
- const encode$l = (params, encodedAttrs) => {
26861
+ const encode$m = (params, encodedAttrs) => {
26747
26862
  const { row } = params.extraParams;
26748
26863
  let tableRowProperties = {};
26749
26864
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26750
26865
  if (tPr) {
26751
- ({ attributes: tableRowProperties } = translator$H.encode({
26866
+ ({ attributes: tableRowProperties } = translator$I.encode({
26752
26867
  ...params,
26753
26868
  nodes: [tPr]
26754
26869
  }));
@@ -26761,7 +26876,7 @@ const encode$l = (params, encodedAttrs) => {
26761
26876
  let currentColumnIndex = 0;
26762
26877
  const content = cellNodes?.map((n) => {
26763
26878
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26764
- const result = translator$8.encode({
26879
+ const result = translator$9.encode({
26765
26880
  ...params,
26766
26881
  extraParams: {
26767
26882
  ...params.extraParams,
@@ -26783,7 +26898,7 @@ const encode$l = (params, encodedAttrs) => {
26783
26898
  };
26784
26899
  return newNode;
26785
26900
  };
26786
- const decode$l = (params, decodedAttrs) => {
26901
+ const decode$m = (params, decodedAttrs) => {
26787
26902
  const { node } = params;
26788
26903
  const elements = translateChildNodes(params);
26789
26904
  if (node.attrs?.tableRowProperties) {
@@ -26795,7 +26910,7 @@ const decode$l = (params, decodedAttrs) => {
26795
26910
  }
26796
26911
  }
26797
26912
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
26798
- const trPr = translator$H.decode({
26913
+ const trPr = translator$I.decode({
26799
26914
  ...params,
26800
26915
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
26801
26916
  });
@@ -26807,22 +26922,22 @@ const decode$l = (params, decodedAttrs) => {
26807
26922
  elements
26808
26923
  };
26809
26924
  };
26810
- const config$c = {
26811
- xmlName: XML_NODE_NAME$e,
26812
- sdNodeOrKeyName: SD_NODE_NAME$a,
26925
+ const config$d = {
26926
+ xmlName: XML_NODE_NAME$f,
26927
+ sdNodeOrKeyName: SD_NODE_NAME$b,
26813
26928
  type: NodeTranslator.translatorTypes.NODE,
26814
- encode: encode$l,
26815
- decode: decode$l,
26816
- attributes: validXmlAttributes$9
26929
+ encode: encode$m,
26930
+ decode: decode$m,
26931
+ attributes: validXmlAttributes$8
26817
26932
  };
26818
- const translator$G = NodeTranslator.from(config$c);
26819
- const translator$F = NodeTranslator.from({
26933
+ const translator$H = NodeTranslator.from(config$d);
26934
+ const translator$G = NodeTranslator.from({
26820
26935
  xmlName: "w:bidiVisual",
26821
26936
  sdNodeOrKeyName: "rightToLeft",
26822
26937
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26823
26938
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
26824
26939
  });
26825
- const translator$E = NodeTranslator.from({
26940
+ const translator$F = NodeTranslator.from({
26826
26941
  xmlName: "w:shd",
26827
26942
  sdNodeOrKeyName: "shading",
26828
26943
  attributes: [
@@ -26844,11 +26959,11 @@ const translator$E = NodeTranslator.from({
26844
26959
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26845
26960
  }
26846
26961
  });
26847
- const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26848
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26849
- const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26850
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26851
- const translator$z = NodeTranslator.from({
26962
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26963
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26964
+ const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26965
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26966
+ const translator$A = NodeTranslator.from({
26852
26967
  xmlName: "w:tblLook",
26853
26968
  sdNodeOrKeyName: "tblLook",
26854
26969
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -26860,16 +26975,16 @@ const translator$z = NodeTranslator.from({
26860
26975
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26861
26976
  }
26862
26977
  });
26863
- const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26864
- const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26865
- const translator$w = NodeTranslator.from(
26978
+ const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26979
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26980
+ const translator$x = NodeTranslator.from(
26866
26981
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
26867
26982
  );
26868
- const translator$v = NodeTranslator.from(
26983
+ const translator$w = NodeTranslator.from(
26869
26984
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
26870
26985
  );
26871
- const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26872
- const translator$t = NodeTranslator.from({
26986
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26987
+ const translator$u = NodeTranslator.from({
26873
26988
  xmlName: "w:tblpPr",
26874
26989
  sdNodeOrKeyName: "floatingTableProperties",
26875
26990
  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))),
@@ -26881,29 +26996,29 @@ const translator$t = NodeTranslator.from({
26881
26996
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26882
26997
  }
26883
26998
  });
26884
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26885
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26886
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26887
- const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26888
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26889
- const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26890
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26891
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26892
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26893
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
26894
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
26895
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
26896
- const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
26897
- const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
26898
- const XML_NODE_NAME$d = "w:tblBorders";
26999
+ const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27000
+ const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27001
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27002
+ const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27003
+ const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27004
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27005
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27006
+ const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27007
+ const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27008
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27009
+ const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27010
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27011
+ const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27012
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27013
+ const XML_NODE_NAME$e = "w:tblBorders";
26899
27014
  const SD_ATTR_KEY$3 = "borders";
26900
- const encode$k = (params) => {
27015
+ const encode$l = (params) => {
26901
27016
  const { nodes } = params;
26902
27017
  const node = nodes[0];
26903
27018
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
26904
27019
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26905
27020
  };
26906
- const decode$k = (params) => {
27021
+ const decode$l = (params) => {
26907
27022
  const { borders = {} } = params.node.attrs || {};
26908
27023
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
26909
27024
  const newNode = {
@@ -26915,14 +27030,14 @@ const decode$k = (params) => {
26915
27030
  return newNode;
26916
27031
  };
26917
27032
  const propertyTranslators$2 = [
26918
- translator$s,
26919
- translator$q,
27033
+ translator$t,
27034
+ translator$r,
27035
+ translator$p,
26920
27036
  translator$o,
26921
27037
  translator$n,
26922
- translator$m,
26923
- translator$k,
26924
- translator$i,
26925
- translator$g
27038
+ translator$l,
27039
+ translator$j,
27040
+ translator$h
26926
27041
  ];
26927
27042
  const tblBordersTranslatorsByXmlName = {};
26928
27043
  const tblBordersTranslatorsBySdName = {};
@@ -26930,27 +27045,27 @@ propertyTranslators$2.forEach((translator2) => {
26930
27045
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
26931
27046
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26932
27047
  });
26933
- const translator$e = NodeTranslator.from({
26934
- xmlName: XML_NODE_NAME$d,
27048
+ const translator$f = NodeTranslator.from({
27049
+ xmlName: XML_NODE_NAME$e,
26935
27050
  sdNodeOrKeyName: SD_ATTR_KEY$3,
26936
27051
  type: NodeTranslator.translatorTypes.NODE,
26937
27052
  attributes: [],
26938
- encode: encode$k,
26939
- decode: decode$k
27053
+ encode: encode$l,
27054
+ decode: decode$l
26940
27055
  });
26941
- const XML_NODE_NAME$c = "w:tblCellMar";
27056
+ const XML_NODE_NAME$d = "w:tblCellMar";
26942
27057
  const SD_ATTR_KEY$2 = "cellMargins";
26943
- const encode$j = (params) => {
27058
+ const encode$k = (params) => {
26944
27059
  const { nodes } = params;
26945
27060
  const node = nodes[0];
26946
27061
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
26947
27062
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26948
27063
  };
26949
- const decode$j = (params) => {
27064
+ const decode$k = (params) => {
26950
27065
  const { cellMargins = {} } = params.node.attrs || {};
26951
27066
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
26952
27067
  const newNode = {
26953
- name: XML_NODE_NAME$c,
27068
+ name: XML_NODE_NAME$d,
26954
27069
  type: "element",
26955
27070
  attributes: {},
26956
27071
  elements
@@ -26958,12 +27073,12 @@ const decode$j = (params) => {
26958
27073
  return newNode;
26959
27074
  };
26960
27075
  const propertyTranslators$1 = [
26961
- translator$r,
26962
- translator$p,
26963
- translator$l,
26964
- translator$j,
26965
- translator$h,
26966
- translator$f
27076
+ translator$s,
27077
+ translator$q,
27078
+ translator$m,
27079
+ translator$k,
27080
+ translator$i,
27081
+ translator$g
26967
27082
  ];
26968
27083
  const propertyTranslatorsByXmlName$1 = {};
26969
27084
  const propertyTranslatorsBySdName$1 = {};
@@ -26971,27 +27086,27 @@ propertyTranslators$1.forEach((translator2) => {
26971
27086
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
26972
27087
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
26973
27088
  });
26974
- const translator$d = NodeTranslator.from({
26975
- xmlName: XML_NODE_NAME$c,
27089
+ const translator$e = NodeTranslator.from({
27090
+ xmlName: XML_NODE_NAME$d,
26976
27091
  sdNodeOrKeyName: SD_ATTR_KEY$2,
26977
27092
  type: NodeTranslator.translatorTypes.NODE,
26978
27093
  attributes: [],
26979
- encode: encode$j,
26980
- decode: decode$j
27094
+ encode: encode$k,
27095
+ decode: decode$k
26981
27096
  });
26982
- const XML_NODE_NAME$b = "w:tblPr";
27097
+ const XML_NODE_NAME$c = "w:tblPr";
26983
27098
  const SD_ATTR_KEY$1 = "tableProperties";
26984
- const encode$i = (params) => {
27099
+ const encode$j = (params) => {
26985
27100
  const { nodes } = params;
26986
27101
  const node = nodes[0];
26987
27102
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
26988
27103
  return {
26989
- xmlName: XML_NODE_NAME$b,
27104
+ xmlName: XML_NODE_NAME$c,
26990
27105
  sdNodeOrKeyName: SD_ATTR_KEY$1,
26991
27106
  attributes
26992
27107
  };
26993
27108
  };
26994
- const decode$i = (params) => {
27109
+ const decode$j = (params) => {
26995
27110
  const { tableProperties = {} } = params.node.attrs || {};
26996
27111
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
26997
27112
  const newNode = {
@@ -27003,11 +27118,12 @@ const decode$i = (params) => {
27003
27118
  return newNode;
27004
27119
  };
27005
27120
  const propertyTranslators = [
27121
+ translator$G,
27122
+ translator$O,
27006
27123
  translator$F,
27007
- translator$N,
27008
27124
  translator$E,
27125
+ translator$N,
27009
27126
  translator$D,
27010
- translator$M,
27011
27127
  translator$C,
27012
27128
  translator$B,
27013
27129
  translator$A,
@@ -27017,9 +27133,8 @@ const propertyTranslators = [
27017
27133
  translator$w,
27018
27134
  translator$v,
27019
27135
  translator$u,
27020
- translator$t,
27021
- translator$e,
27022
- translator$d
27136
+ translator$f,
27137
+ translator$e
27023
27138
  ];
27024
27139
  const propertyTranslatorsByXmlName = {};
27025
27140
  const propertyTranslatorsBySdName = {};
@@ -27027,14 +27142,14 @@ propertyTranslators.forEach((translator2) => {
27027
27142
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27028
27143
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27029
27144
  });
27030
- const config$b = {
27031
- xmlName: XML_NODE_NAME$b,
27145
+ const config$c = {
27146
+ xmlName: XML_NODE_NAME$c,
27032
27147
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27033
- encode: encode$i,
27034
- decode: decode$i
27148
+ encode: encode$j,
27149
+ decode: decode$j
27035
27150
  };
27036
- const translator$c = NodeTranslator.from(config$b);
27037
- const translator$b = NodeTranslator.from(
27151
+ const translator$d = NodeTranslator.from(config$c);
27152
+ const translator$c = NodeTranslator.from(
27038
27153
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27039
27154
  );
27040
27155
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27084,20 +27199,20 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
27084
27199
  }
27085
27200
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27086
27201
  };
27087
- const XML_NODE_NAME$a = "w:tblGrid";
27202
+ const XML_NODE_NAME$b = "w:tblGrid";
27088
27203
  const SD_ATTR_KEY = "grid";
27089
27204
  const cellMinWidth = pixelsToTwips(10);
27090
- const encode$h = (params) => {
27205
+ const encode$i = (params) => {
27091
27206
  const { nodes } = params;
27092
27207
  const node = nodes[0];
27093
- const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
27208
+ const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
27094
27209
  return {
27095
- xmlName: XML_NODE_NAME$a,
27210
+ xmlName: XML_NODE_NAME$b,
27096
27211
  sdNodeOrKeyName: SD_ATTR_KEY,
27097
27212
  attributes
27098
27213
  };
27099
27214
  };
27100
- const decode$h = (params) => {
27215
+ const decode$i = (params) => {
27101
27216
  const { grid: rawGrid } = params.node.attrs || {};
27102
27217
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27103
27218
  const { firstRow = {} } = params.extraParams || {};
@@ -27116,10 +27231,10 @@ const decode$h = (params) => {
27116
27231
  numericWidth = fallbackColumnWidthTwips;
27117
27232
  }
27118
27233
  numericWidth = Math.max(numericWidth, cellMinWidth);
27119
- const decoded = translator$b.decode({
27234
+ const decoded = translator$c.decode({
27120
27235
  node: { type: (
27121
27236
  /** @type {string} */
27122
- translator$b.sdNodeOrKeyName
27237
+ translator$c.sdNodeOrKeyName
27123
27238
  ), attrs: { col: numericWidth } }
27124
27239
  });
27125
27240
  if (decoded) elements.push(decoded);
@@ -27154,19 +27269,19 @@ const decode$h = (params) => {
27154
27269
  columnIndex++;
27155
27270
  }
27156
27271
  const newNode = {
27157
- name: XML_NODE_NAME$a,
27272
+ name: XML_NODE_NAME$b,
27158
27273
  attributes: {},
27159
27274
  elements
27160
27275
  };
27161
27276
  return newNode;
27162
27277
  };
27163
- const config$a = {
27164
- xmlName: XML_NODE_NAME$a,
27278
+ const config$b = {
27279
+ xmlName: XML_NODE_NAME$b,
27165
27280
  sdNodeOrKeyName: SD_ATTR_KEY,
27166
- encode: encode$h,
27167
- decode: decode$h
27281
+ encode: encode$i,
27282
+ decode: decode$i
27168
27283
  };
27169
- const translator$a = NodeTranslator.from(config$a);
27284
+ const translator$b = NodeTranslator.from(config$b);
27170
27285
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27171
27286
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27172
27287
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27229,19 +27344,19 @@ const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasure
27229
27344
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27230
27345
  };
27231
27346
  };
27232
- const XML_NODE_NAME$9 = "w:tbl";
27233
- const SD_NODE_NAME$9 = "table";
27234
- const encode$g = (params, encodedAttrs) => {
27347
+ const XML_NODE_NAME$a = "w:tbl";
27348
+ const SD_NODE_NAME$a = "table";
27349
+ const encode$h = (params, encodedAttrs) => {
27235
27350
  const { nodes } = params;
27236
27351
  const node = nodes[0];
27237
27352
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27238
27353
  if (tblPr) {
27239
- const encodedProperties = translator$c.encode({ ...params, nodes: [tblPr] });
27354
+ const encodedProperties = translator$d.encode({ ...params, nodes: [tblPr] });
27240
27355
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27241
27356
  }
27242
27357
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27243
27358
  if (tblGrid) {
27244
- encodedAttrs["grid"] = translator$a.encode({ ...params, nodes: [tblGrid] }).attributes;
27359
+ encodedAttrs["grid"] = translator$b.encode({ ...params, nodes: [tblGrid] }).attributes;
27245
27360
  }
27246
27361
  [
27247
27362
  "tableStyleId",
@@ -27308,7 +27423,7 @@ const encode$g = (params, encodedAttrs) => {
27308
27423
  }
27309
27424
  const content = [];
27310
27425
  rows.forEach((row) => {
27311
- const result = translator$G.encode({
27426
+ const result = translator$H.encode({
27312
27427
  ...params,
27313
27428
  nodes: [row],
27314
27429
  extraParams: {
@@ -27327,13 +27442,13 @@ const encode$g = (params, encodedAttrs) => {
27327
27442
  attrs: encodedAttrs
27328
27443
  };
27329
27444
  };
27330
- const decode$g = (params, decodedAttrs) => {
27445
+ const decode$h = (params, decodedAttrs) => {
27331
27446
  params.node = preProcessVerticalMergeCells(params.node, params);
27332
27447
  const { node } = params;
27333
27448
  const elements = translateChildNodes(params);
27334
27449
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27335
27450
  const properties = node.attrs.grid;
27336
- const element = translator$a.decode({
27451
+ const element = translator$b.decode({
27337
27452
  ...params,
27338
27453
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27339
27454
  extraParams: {
@@ -27343,7 +27458,7 @@ const decode$g = (params, decodedAttrs) => {
27343
27458
  if (element) elements.unshift(element);
27344
27459
  if (node.attrs?.tableProperties) {
27345
27460
  const properties2 = { ...node.attrs.tableProperties };
27346
- const element2 = translator$c.decode({
27461
+ const element2 = translator$d.decode({
27347
27462
  ...params,
27348
27463
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27349
27464
  });
@@ -27409,7 +27524,7 @@ function _getReferencedTableStyles(tableStyleReference, params) {
27409
27524
  if (baseTblPr && baseTblPr.elements) {
27410
27525
  tblPr.elements.push(...baseTblPr.elements);
27411
27526
  }
27412
- const tableProperties = translator$c.encode({ ...params, nodes: [tblPr] }).attributes;
27527
+ const tableProperties = translator$d.encode({ ...params, nodes: [tblPr] }).attributes;
27413
27528
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27414
27529
  if (borders) stylesToReturn.borders = borders;
27415
27530
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27426,16 +27541,16 @@ function _getReferencedTableStyles(tableStyleReference, params) {
27426
27541
  }
27427
27542
  return stylesToReturn;
27428
27543
  }
27429
- const config$9 = {
27430
- xmlName: XML_NODE_NAME$9,
27431
- sdNodeOrKeyName: SD_NODE_NAME$9,
27544
+ const config$a = {
27545
+ xmlName: XML_NODE_NAME$a,
27546
+ sdNodeOrKeyName: SD_NODE_NAME$a,
27432
27547
  type: NodeTranslator.translatorTypes.NODE,
27433
- encode: encode$g,
27434
- decode: decode$g,
27548
+ encode: encode$h,
27549
+ decode: decode$h,
27435
27550
  attributes: []
27436
27551
  };
27437
- const translator$9 = NodeTranslator.from(config$9);
27438
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
27552
+ const translator$a = NodeTranslator.from(config$a);
27553
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
27439
27554
  function getReferencedTableStyles(tblStyleTag, docx) {
27440
27555
  if (!tblStyleTag) return null;
27441
27556
  const stylesToReturn = {};
@@ -27797,10 +27912,10 @@ function generateCellMargins(cellMargins) {
27797
27912
  if (left != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left) } });
27798
27913
  return elements;
27799
27914
  }
27800
- const XML_NODE_NAME$8 = "w:tc";
27801
- const SD_NODE_NAME$8 = "tableCell";
27802
- const validXmlAttributes$8 = [];
27803
- function encode$f(params, encodedAttrs) {
27915
+ const XML_NODE_NAME$9 = "w:tc";
27916
+ const SD_NODE_NAME$9 = "tableCell";
27917
+ const validXmlAttributes$7 = [];
27918
+ function encode$g(params, encodedAttrs) {
27804
27919
  const {
27805
27920
  node,
27806
27921
  table,
@@ -27827,162 +27942,22 @@ function encode$f(params, encodedAttrs) {
27827
27942
  }
27828
27943
  return schemaNode;
27829
27944
  }
27830
- function decode$f(params, decodedAttrs) {
27945
+ function decode$g(params, decodedAttrs) {
27831
27946
  const translated = translateTableCell(params);
27832
27947
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
27833
27948
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
27834
27949
  }
27835
27950
  return translated;
27836
27951
  }
27837
- const config$8 = {
27838
- xmlName: XML_NODE_NAME$8,
27839
- sdNodeOrKeyName: SD_NODE_NAME$8,
27840
- type: NodeTranslator.translatorTypes.NODE,
27841
- encode: encode$f,
27842
- decode: decode$f,
27843
- attributes: validXmlAttributes$8
27844
- };
27845
- const translator$8 = NodeTranslator.from(config$8);
27846
- const XML_NODE_NAME$7 = "w:hyperlink";
27847
- const SD_NODE_NAME$7 = "link";
27848
- const _createAttributeHandler = (xmlName, sdName) => ({
27849
- xmlName,
27850
- sdName,
27851
- encode: (attributes) => attributes[xmlName],
27852
- decode: (attributes) => attributes[sdName]
27853
- });
27854
- const validXmlAttributes$7 = [
27855
- _createAttributeHandler("w:anchor", "anchor"),
27856
- _createAttributeHandler("w:docLocation", "docLocation"),
27857
- {
27858
- xmlName: "w:history",
27859
- sdName: "history",
27860
- encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
27861
- decode: (attributes) => attributes["history"] ? "1" : "0"
27862
- },
27863
- _createAttributeHandler("w:tooltip", "tooltip"),
27864
- _createAttributeHandler("r:id", "rId"),
27865
- _createAttributeHandler("w:tgtFrame", "target")
27866
- ];
27867
- const encode$e = (params, encodedAttrs) => {
27868
- const { nodes, docx, nodeListHandler } = params;
27869
- const node = nodes[0];
27870
- let href = _resolveHref(docx, encodedAttrs);
27871
- const linkMark = { attrs: { ...encodedAttrs, href } };
27872
- const runNodes = node.elements.filter((el) => el.name === "w:r");
27873
- runNodes.forEach((runNode) => {
27874
- const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
27875
- const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
27876
- runNode.marks = runMarksWithoutLink;
27877
- });
27878
- const updatedNode = nodeListHandler.handler({
27879
- ...params,
27880
- nodes: runNodes,
27881
- path: [...params.path || [], node]
27882
- });
27883
- const cloneMark2 = (mark) => {
27884
- if (!mark || typeof mark !== "object") return mark;
27885
- if (!mark.attrs) return { ...mark };
27886
- return { ...mark, attrs: { ...mark.attrs } };
27887
- };
27888
- const ensureLinkMark = (child) => {
27889
- if (!child || typeof child !== "object") return child;
27890
- if (Array.isArray(child.content)) {
27891
- const updatedContent = child.content.map((item) => ensureLinkMark(item));
27892
- if (updatedContent !== child.content) {
27893
- child = { ...child, content: updatedContent };
27894
- }
27895
- }
27896
- if (child.type === "run") {
27897
- const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
27898
- const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
27899
- if (filteredMarks.length !== existingMarks2.length) {
27900
- if (filteredMarks.length) child = { ...child, marks: filteredMarks };
27901
- else {
27902
- const { marks: _removedMarks, ...rest } = child;
27903
- child = rest;
27904
- }
27905
- }
27906
- return child;
27907
- }
27908
- if (child.type !== "text") return child;
27909
- const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
27910
- const hasLink = existingMarks.some((mark) => mark?.type === "link");
27911
- if (hasLink) return child;
27912
- const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
27913
- return { ...child, marks: [...existingMarks, linkClone] };
27914
- };
27915
- if (!Array.isArray(updatedNode)) return updatedNode;
27916
- return updatedNode.map((child) => ensureLinkMark(child));
27917
- };
27918
- const _resolveHref = (docx, encodedAttrs) => {
27919
- const rels = docx["word/_rels/document.xml.rels"];
27920
- const relationships = rels.elements.find((el) => el.name === "Relationships");
27921
- const { elements } = relationships;
27922
- const { rId, anchor } = encodedAttrs;
27923
- let href;
27924
- if (!rId && anchor) {
27925
- href = `#${anchor}`;
27926
- } else if (rId) {
27927
- const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
27928
- const { attributes: relAttributes = {} } = rel;
27929
- href = relAttributes["Target"];
27930
- }
27931
- return href;
27932
- };
27933
- function decode$e(params) {
27934
- const { node } = params;
27935
- const linkMark = node.marks.find((m2) => m2.type === "link");
27936
- const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
27937
- let { anchor, href: link } = linkMark.attrs;
27938
- const isExternalLink = !anchor;
27939
- if (isExternalLink) {
27940
- linkAttrs["r:id"] = _addNewLinkRelationship(params, link, linkAttrs["r:id"]);
27941
- }
27942
- node.marks = node.marks.filter((m2) => m2.type !== "link");
27943
- const outputNode = exportSchemaToJson({ ...params, node });
27944
- const newNode = {
27945
- name: "w:hyperlink",
27946
- type: "element",
27947
- attributes: {
27948
- ...linkAttrs
27949
- },
27950
- elements: [outputNode]
27951
- };
27952
- return newNode;
27953
- }
27954
- function _addNewLinkRelationship(params, link, rId) {
27955
- if (!rId) rId = generateDocxRandomId();
27956
- if (!params.relationships || !Array.isArray(params.relationships)) {
27957
- params.relationships = [];
27958
- }
27959
- const existingRel = params.relationships.find(
27960
- (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
27961
- );
27962
- if (existingRel) {
27963
- return rId;
27964
- }
27965
- params.relationships.push({
27966
- type: "element",
27967
- name: "Relationship",
27968
- attributes: {
27969
- Id: rId,
27970
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
27971
- Target: link,
27972
- TargetMode: "External"
27973
- }
27974
- });
27975
- return rId;
27976
- }
27977
- const config$7 = {
27978
- xmlName: XML_NODE_NAME$7,
27979
- sdNodeOrKeyName: SD_NODE_NAME$7,
27952
+ const config$9 = {
27953
+ xmlName: XML_NODE_NAME$9,
27954
+ sdNodeOrKeyName: SD_NODE_NAME$9,
27980
27955
  type: NodeTranslator.translatorTypes.NODE,
27981
- encode: encode$e,
27982
- decode: decode$e,
27956
+ encode: encode$g,
27957
+ decode: decode$g,
27983
27958
  attributes: validXmlAttributes$7
27984
27959
  };
27985
- const translator$7 = NodeTranslator.from(config$7);
27960
+ const translator$9 = NodeTranslator.from(config$9);
27986
27961
  function parseTagValueJSON(json) {
27987
27962
  if (typeof json !== "string") {
27988
27963
  return {};
@@ -28118,12 +28093,32 @@ function handleDocPartObj(params) {
28118
28093
  }
28119
28094
  const content = node?.elements.find((el) => el.name === "w:sdtContent");
28120
28095
  const handler2 = validGalleryTypeMap[docPartGalleryType];
28121
- const result = handler2({ ...params, nodes: [content] });
28096
+ const result = handler2({
28097
+ ...params,
28098
+ nodes: [content],
28099
+ extraParams: { ...params.extraParams || {}, sdtPr }
28100
+ });
28122
28101
  return result;
28123
28102
  }
28124
28103
  const tableOfContentsHandler = (params) => {
28125
28104
  const node = params.nodes[0];
28126
- return params.nodeListHandler.handler({ ...params, nodes: node.elements });
28105
+ const translatedContent = params.nodeListHandler.handler({
28106
+ ...params,
28107
+ nodes: node.elements,
28108
+ path: [...params.path || [], node]
28109
+ });
28110
+ const sdtPr = params.extraParams.sdtPr;
28111
+ const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
28112
+ const result = {
28113
+ type: "documentPartObject",
28114
+ content: translatedContent,
28115
+ attrs: {
28116
+ id,
28117
+ docPartGallery: "Table of Contents",
28118
+ docPartUnique: true
28119
+ }
28120
+ };
28121
+ return result;
28127
28122
  };
28128
28123
  const validGalleryTypeMap = {
28129
28124
  "Table of Contents": tableOfContentsHandler
@@ -28167,6 +28162,9 @@ function handleStructuredContentNode(params) {
28167
28162
  const node = nodes[0];
28168
28163
  const sdtPr = node.elements.find((el) => el.name === "w:sdtPr");
28169
28164
  const sdtContent = node.elements.find((el) => el.name === "w:sdtContent");
28165
+ const id = sdtPr?.elements?.find((el) => el.name === "w:id");
28166
+ const tag = sdtPr?.elements?.find((el) => el.name === "w:tag");
28167
+ const alias = sdtPr?.elements?.find((el) => el.name === "w:alias");
28170
28168
  if (!sdtContent) {
28171
28169
  return null;
28172
28170
  }
@@ -28178,15 +28176,16 @@ function handleStructuredContentNode(params) {
28178
28176
  nodes: sdtContent.elements,
28179
28177
  path: [...params.path || [], sdtContent]
28180
28178
  });
28181
- let sdtContentType = "structuredContent";
28182
- if (paragraph || table) {
28183
- sdtContentType = "structuredContentBlock";
28184
- }
28179
+ const isBlockNode = paragraph || table;
28180
+ const sdtContentType = isBlockNode ? "structuredContentBlock" : "structuredContent";
28185
28181
  let result = {
28186
28182
  type: sdtContentType,
28187
28183
  content: translatedContent,
28188
28184
  marks,
28189
28185
  attrs: {
28186
+ id: id?.attributes?.["w:val"] || null,
28187
+ tag: tag?.attributes?.["w:val"] || null,
28188
+ alias: alias?.attributes?.["w:val"] || null,
28190
28189
  sdtPr
28191
28190
  }
28192
28191
  };
@@ -28777,32 +28776,32 @@ function translateAnchorNode(params) {
28777
28776
  elements: [...anchorElements, ...elementsWithWrap]
28778
28777
  };
28779
28778
  }
28780
- const XML_NODE_NAME$6 = "wp:anchor";
28781
- const SD_NODE_NAME$6 = ["image"];
28779
+ const XML_NODE_NAME$8 = "wp:anchor";
28780
+ const SD_NODE_NAME$8 = ["image"];
28782
28781
  const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28783
- function encode$d(params) {
28782
+ function encode$f(params) {
28784
28783
  const { node } = params.extraParams;
28785
28784
  if (!node || !node.type) {
28786
28785
  return null;
28787
28786
  }
28788
28787
  return handleAnchorNode(params);
28789
28788
  }
28790
- function decode$d(params) {
28789
+ function decode$f(params) {
28791
28790
  const { node } = params;
28792
28791
  if (!node || !node.type) {
28793
28792
  return null;
28794
28793
  }
28795
28794
  return translateAnchorNode(params);
28796
28795
  }
28797
- const config$6 = {
28798
- xmlName: XML_NODE_NAME$6,
28799
- sdNodeOrKeyName: SD_NODE_NAME$6,
28796
+ const config$8 = {
28797
+ xmlName: XML_NODE_NAME$8,
28798
+ sdNodeOrKeyName: SD_NODE_NAME$8,
28800
28799
  type: NodeTranslator.translatorTypes.NODE,
28801
- encode: encode$d,
28802
- decode: decode$d,
28800
+ encode: encode$f,
28801
+ decode: decode$f,
28803
28802
  attributes: validXmlAttributes$6
28804
28803
  };
28805
- const translator$6 = NodeTranslator.from(config$6);
28804
+ const translator$8 = NodeTranslator.from(config$8);
28806
28805
  function handleInlineNode(params) {
28807
28806
  const { node } = params.extraParams;
28808
28807
  if (node.name !== "wp:inline") {
@@ -28818,41 +28817,41 @@ function translateInlineNode(params) {
28818
28817
  elements: nodeElements.elements
28819
28818
  };
28820
28819
  }
28821
- const XML_NODE_NAME$5 = "wp:inline";
28822
- const SD_NODE_NAME$5 = ["image"];
28820
+ const XML_NODE_NAME$7 = "wp:inline";
28821
+ const SD_NODE_NAME$7 = ["image"];
28823
28822
  const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28824
- function encode$c(params) {
28823
+ function encode$e(params) {
28825
28824
  const { node } = params.extraParams;
28826
28825
  if (!node || !node.type) {
28827
28826
  return null;
28828
28827
  }
28829
28828
  return handleInlineNode(params);
28830
28829
  }
28831
- function decode$c(params) {
28830
+ function decode$e(params) {
28832
28831
  const { node } = params;
28833
28832
  if (!node || !node.type) {
28834
28833
  return null;
28835
28834
  }
28836
28835
  return translateInlineNode(params);
28837
28836
  }
28838
- const config$5 = {
28839
- xmlName: XML_NODE_NAME$5,
28840
- sdNodeOrKeyName: SD_NODE_NAME$5,
28837
+ const config$7 = {
28838
+ xmlName: XML_NODE_NAME$7,
28839
+ sdNodeOrKeyName: SD_NODE_NAME$7,
28841
28840
  type: NodeTranslator.translatorTypes.NODE,
28842
- encode: encode$c,
28843
- decode: decode$c,
28841
+ encode: encode$e,
28842
+ decode: decode$e,
28844
28843
  attributes: validXmlAttributes$5
28845
28844
  };
28846
- const translator$5 = NodeTranslator.from(config$5);
28847
- const XML_NODE_NAME$4 = "w:drawing";
28848
- const SD_NODE_NAME$4 = [];
28845
+ const translator$7 = NodeTranslator.from(config$7);
28846
+ const XML_NODE_NAME$6 = "w:drawing";
28847
+ const SD_NODE_NAME$6 = [];
28849
28848
  const validXmlAttributes$4 = [];
28850
- function encode$b(params) {
28849
+ function encode$d(params) {
28851
28850
  const nodes = params.nodes;
28852
28851
  const node = nodes[0];
28853
28852
  const translatorByChildName = {
28854
- "wp:anchor": translator$6,
28855
- "wp:inline": translator$5
28853
+ "wp:anchor": translator$8,
28854
+ "wp:inline": translator$7
28856
28855
  };
28857
28856
  return node.elements.reduce((acc, child) => {
28858
28857
  if (acc) return acc;
@@ -28861,12 +28860,12 @@ function encode$b(params) {
28861
28860
  return translator2.encode({ ...params, extraParams: { node: child } }) || acc;
28862
28861
  }, null);
28863
28862
  }
28864
- function decode$b(params) {
28863
+ function decode$d(params) {
28865
28864
  const { node } = params;
28866
28865
  if (!node || !node.type) {
28867
28866
  return null;
28868
28867
  }
28869
- const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
28868
+ const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
28870
28869
  const resultNode = childTranslator.decode(params);
28871
28870
  return wrapTextInRun(
28872
28871
  {
@@ -28876,15 +28875,15 @@ function decode$b(params) {
28876
28875
  []
28877
28876
  );
28878
28877
  }
28879
- const config$4 = {
28880
- xmlName: XML_NODE_NAME$4,
28881
- sdNodeOrKeyName: SD_NODE_NAME$4,
28878
+ const config$6 = {
28879
+ xmlName: XML_NODE_NAME$6,
28880
+ sdNodeOrKeyName: SD_NODE_NAME$6,
28882
28881
  type: NodeTranslator.translatorTypes.NODE,
28883
- encode: encode$b,
28884
- decode: decode$b,
28882
+ encode: encode$d,
28883
+ decode: decode$d,
28885
28884
  attributes: validXmlAttributes$4
28886
28885
  };
28887
- const translator$4 = NodeTranslator.from(config$4);
28886
+ const translator$6 = NodeTranslator.from(config$6);
28888
28887
  class CommandService {
28889
28888
  /**
28890
28889
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30222,7 +30221,7 @@ function prepareTextAnnotation(params) {
30222
30221
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
30223
30222
  }
30224
30223
  function prepareImageAnnotation(params, imageSize) {
30225
- return translator$4.decode({
30224
+ return translator$6.decode({
30226
30225
  ...params,
30227
30226
  imageSize
30228
30227
  });
@@ -30442,27 +30441,104 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
30442
30441
  ]
30443
30442
  };
30444
30443
  };
30445
- function translateStructuredContent(params) {
30444
+ function translateDocumentPartObj(params) {
30446
30445
  const { node } = params;
30447
30446
  const { attrs = {} } = node;
30448
30447
  const childContent = translateChildNodes({ ...params, nodes: node.content });
30449
30448
  const nodeElements = [
30449
+ {
30450
+ name: "w:sdtPr",
30451
+ elements: [
30452
+ {
30453
+ name: "w:id",
30454
+ attributes: {
30455
+ "w:val": attrs.id
30456
+ }
30457
+ },
30458
+ {
30459
+ name: "w:docPartObj",
30460
+ elements: [
30461
+ {
30462
+ name: "w:docPartGallery",
30463
+ attributes: {
30464
+ "w:val": attrs.docPartGallery
30465
+ }
30466
+ },
30467
+ ...attrs.docPartUnique ? [
30468
+ {
30469
+ name: "w:docPartUnique"
30470
+ }
30471
+ ] : []
30472
+ ]
30473
+ }
30474
+ ]
30475
+ },
30450
30476
  {
30451
30477
  name: "w:sdtContent",
30452
30478
  elements: childContent
30453
30479
  }
30454
30480
  ];
30455
- nodeElements.unshift(attrs.sdtPr);
30456
30481
  const result = {
30457
30482
  name: "w:sdt",
30458
30483
  elements: nodeElements
30459
30484
  };
30460
30485
  return result;
30461
30486
  }
30462
- const XML_NODE_NAME$3 = "w:sdt";
30463
- const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30487
+ function translateStructuredContent(params) {
30488
+ const { node } = params;
30489
+ const childContent = translateChildNodes({ ...params, nodes: node.content });
30490
+ const sdtContent = { name: "w:sdtContent", elements: childContent };
30491
+ const sdtPr = generateSdtPrTagForStructuredContent({ node });
30492
+ const nodeElements = [sdtPr, sdtContent];
30493
+ const result = {
30494
+ name: "w:sdt",
30495
+ elements: nodeElements
30496
+ };
30497
+ return result;
30498
+ }
30499
+ function generateSdtPrTagForStructuredContent({ node }) {
30500
+ const { attrs = {} } = node;
30501
+ const id = {
30502
+ name: "w:id",
30503
+ type: "element",
30504
+ attributes: { "w:val": attrs.id }
30505
+ };
30506
+ const alias = {
30507
+ name: "w:alias",
30508
+ type: "element",
30509
+ attributes: { "w:val": attrs.alias }
30510
+ };
30511
+ const tag = {
30512
+ name: "w:tag",
30513
+ type: "element",
30514
+ attributes: { "w:val": attrs.tag }
30515
+ };
30516
+ const resultElements = [];
30517
+ if (attrs.id) resultElements.push(id);
30518
+ if (attrs.alias) resultElements.push(alias);
30519
+ if (attrs.tag) resultElements.push(tag);
30520
+ if (attrs.sdtPr) {
30521
+ const elements = attrs.sdtPr.elements || [];
30522
+ const elementsToExclude = ["w:id", "w:alias", "w:tag"];
30523
+ const restElements = elements.filter((el) => !elementsToExclude.includes(el.name));
30524
+ const result2 = {
30525
+ name: "w:sdtPr",
30526
+ type: "element",
30527
+ elements: [...resultElements, ...restElements]
30528
+ };
30529
+ return result2;
30530
+ }
30531
+ const result = {
30532
+ name: "w:sdtPr",
30533
+ type: "element",
30534
+ elements: resultElements
30535
+ };
30536
+ return result;
30537
+ }
30538
+ const XML_NODE_NAME$5 = "w:sdt";
30539
+ const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30464
30540
  const validXmlAttributes$3 = [];
30465
- function encode$a(params) {
30541
+ function encode$c(params) {
30466
30542
  const nodes = params.nodes;
30467
30543
  const node = nodes[0];
30468
30544
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30472,7 +30548,7 @@ function encode$a(params) {
30472
30548
  const result = handler2(params);
30473
30549
  return result;
30474
30550
  }
30475
- function decode$a(params) {
30551
+ function decode$c(params) {
30476
30552
  const { node } = params;
30477
30553
  if (!node || !node.type) {
30478
30554
  return null;
@@ -30482,91 +30558,93 @@ function decode$a(params) {
30482
30558
  structuredContent: () => translateStructuredContent(params),
30483
30559
  structuredContentBlock: () => translateStructuredContent(params),
30484
30560
  documentSection: () => translateDocumentSection(params),
30561
+ documentPartObject: () => translateDocumentPartObj(params),
30562
+ // Handled in doc-part-obj translator
30485
30563
  default: () => null
30486
30564
  };
30487
30565
  const decoder = types2[node.type] ?? types2.default;
30488
30566
  const result = decoder();
30489
30567
  return result;
30490
30568
  }
30491
- const config$3 = {
30492
- xmlName: XML_NODE_NAME$3,
30493
- sdNodeOrKeyName: SD_NODE_NAME$3,
30569
+ const config$5 = {
30570
+ xmlName: XML_NODE_NAME$5,
30571
+ sdNodeOrKeyName: SD_NODE_NAME$5,
30494
30572
  type: NodeTranslator.translatorTypes.NODE,
30495
- encode: encode$a,
30496
- decode: decode$a,
30573
+ encode: encode$c,
30574
+ decode: decode$c,
30497
30575
  attributes: validXmlAttributes$3
30498
30576
  };
30499
- const translator$3 = NodeTranslator.from(config$3);
30500
- const encode$9 = (attributes) => {
30577
+ const translator$5 = NodeTranslator.from(config$5);
30578
+ const encode$b = (attributes) => {
30501
30579
  return attributes["w:id"];
30502
30580
  };
30503
- const decode$9 = (attrs) => {
30581
+ const decode$b = (attrs) => {
30504
30582
  return attrs.id;
30505
30583
  };
30506
30584
  const attrConfig$6 = Object.freeze({
30507
30585
  xmlName: "w:id",
30508
30586
  sdName: "id",
30509
- encode: encode$9,
30510
- decode: decode$9
30587
+ encode: encode$b,
30588
+ decode: decode$b
30511
30589
  });
30512
- const encode$8 = (attributes) => {
30590
+ const encode$a = (attributes) => {
30513
30591
  return attributes["w:name"];
30514
30592
  };
30515
- const decode$8 = (attrs) => {
30593
+ const decode$a = (attrs) => {
30516
30594
  return attrs.name;
30517
30595
  };
30518
30596
  const attrConfig$5 = Object.freeze({
30519
30597
  xmlName: "w:name",
30520
30598
  sdName: "name",
30521
- encode: encode$8,
30522
- decode: decode$8
30599
+ encode: encode$a,
30600
+ decode: decode$a
30523
30601
  });
30524
- const encode$7 = (attributes) => {
30602
+ const encode$9 = (attributes) => {
30525
30603
  return attributes["w:colFirst"];
30526
30604
  };
30527
- const decode$7 = (attrs) => {
30605
+ const decode$9 = (attrs) => {
30528
30606
  return attrs.colFirst;
30529
30607
  };
30530
30608
  const attrConfig$4 = Object.freeze({
30531
30609
  xmlName: "w:colFirst",
30532
30610
  sdName: "colFirst",
30533
- encode: encode$7,
30534
- decode: decode$7
30611
+ encode: encode$9,
30612
+ decode: decode$9
30535
30613
  });
30536
- const encode$6 = (attributes) => {
30614
+ const encode$8 = (attributes) => {
30537
30615
  return attributes["w:colLast"];
30538
30616
  };
30539
- const decode$6 = (attrs) => {
30617
+ const decode$8 = (attrs) => {
30540
30618
  return attrs.colLast;
30541
30619
  };
30542
30620
  const attrConfig$3 = Object.freeze({
30543
30621
  xmlName: "w:colLast",
30544
30622
  sdName: "colLast",
30545
- encode: encode$6,
30546
- decode: decode$6
30623
+ encode: encode$8,
30624
+ decode: decode$8
30547
30625
  });
30548
- const encode$5 = (attributes) => {
30626
+ const encode$7 = (attributes) => {
30549
30627
  return attributes["w:displacedByCustomXml"];
30550
30628
  };
30551
- const decode$5 = (attrs) => {
30629
+ const decode$7 = (attrs) => {
30552
30630
  return attrs.displacedByCustomXml;
30553
30631
  };
30554
30632
  const attrConfig$2 = Object.freeze({
30555
30633
  xmlName: "w:displacedByCustomXml",
30556
30634
  sdName: "displacedByCustomXml",
30557
- encode: encode$5,
30558
- decode: decode$5
30635
+ encode: encode$7,
30636
+ decode: decode$7
30559
30637
  });
30560
30638
  const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30561
- const XML_NODE_NAME$2 = "w:bookmarkStart";
30562
- const SD_NODE_NAME$2 = "bookmarkStart";
30563
- const encode$4 = (params, encodedAttrs = {}) => {
30639
+ const XML_NODE_NAME$4 = "w:bookmarkStart";
30640
+ const SD_NODE_NAME$4 = "bookmarkStart";
30641
+ const encode$6 = (params, encodedAttrs = {}) => {
30564
30642
  return {
30565
30643
  type: "bookmarkStart",
30566
30644
  attrs: encodedAttrs
30567
30645
  };
30568
30646
  };
30569
- const decode$4 = (params, decodedAttrs = {}) => {
30647
+ const decode$6 = (params, decodedAttrs = {}) => {
30570
30648
  const result = {
30571
30649
  name: "w:bookmarkStart",
30572
30650
  elements: []
@@ -30576,49 +30654,49 @@ const decode$4 = (params, decodedAttrs = {}) => {
30576
30654
  }
30577
30655
  return result;
30578
30656
  };
30579
- const config$2 = {
30580
- xmlName: XML_NODE_NAME$2,
30581
- sdNodeOrKeyName: SD_NODE_NAME$2,
30657
+ const config$4 = {
30658
+ xmlName: XML_NODE_NAME$4,
30659
+ sdNodeOrKeyName: SD_NODE_NAME$4,
30582
30660
  type: NodeTranslator.translatorTypes.NODE,
30583
- encode: encode$4,
30584
- decode: decode$4,
30661
+ encode: encode$6,
30662
+ decode: decode$6,
30585
30663
  attributes: validXmlAttributes$2
30586
30664
  };
30587
- const translator$2 = NodeTranslator.from(config$2);
30588
- const encode$3 = (attributes) => {
30665
+ const translator$4 = NodeTranslator.from(config$4);
30666
+ const encode$5 = (attributes) => {
30589
30667
  return attributes["w:id"];
30590
30668
  };
30591
- const decode$3 = (attrs) => {
30669
+ const decode$5 = (attrs) => {
30592
30670
  return attrs.id;
30593
30671
  };
30594
30672
  const attrConfig$1 = Object.freeze({
30595
30673
  xmlName: "w:id",
30596
30674
  sdName: "id",
30597
- encode: encode$3,
30598
- decode: decode$3
30675
+ encode: encode$5,
30676
+ decode: decode$5
30599
30677
  });
30600
- const encode$2 = (attributes) => {
30678
+ const encode$4 = (attributes) => {
30601
30679
  return attributes["w:displacedByCustomXml"];
30602
30680
  };
30603
- const decode$2 = (attrs) => {
30681
+ const decode$4 = (attrs) => {
30604
30682
  return attrs.displacedByCustomXml;
30605
30683
  };
30606
30684
  const attrConfig = Object.freeze({
30607
30685
  xmlName: "w:displacedByCustomXml",
30608
30686
  sdName: "displacedByCustomXml",
30609
- encode: encode$2,
30610
- decode: decode$2
30687
+ encode: encode$4,
30688
+ decode: decode$4
30611
30689
  });
30612
30690
  const validXmlAttributes$1 = [attrConfig$1, attrConfig];
30613
- const XML_NODE_NAME$1 = "w:bookmarkEnd";
30614
- const SD_NODE_NAME$1 = "bookmarkEnd";
30615
- const encode$1 = (params, encodedAttrs = {}) => {
30691
+ const XML_NODE_NAME$3 = "w:bookmarkEnd";
30692
+ const SD_NODE_NAME$3 = "bookmarkEnd";
30693
+ const encode$3 = (params, encodedAttrs = {}) => {
30616
30694
  return {
30617
30695
  type: "bookmarkEnd",
30618
30696
  attrs: encodedAttrs
30619
30697
  };
30620
30698
  };
30621
- const decode$1 = (params, decodedAttrs = {}) => {
30699
+ const decode$3 = (params, decodedAttrs = {}) => {
30622
30700
  const result = {
30623
30701
  name: "w:bookmarkEnd",
30624
30702
  elements: []
@@ -30628,19 +30706,19 @@ const decode$1 = (params, decodedAttrs = {}) => {
30628
30706
  }
30629
30707
  return result;
30630
30708
  };
30631
- const config$1 = {
30632
- xmlName: XML_NODE_NAME$1,
30633
- sdNodeOrKeyName: SD_NODE_NAME$1,
30709
+ const config$3 = {
30710
+ xmlName: XML_NODE_NAME$3,
30711
+ sdNodeOrKeyName: SD_NODE_NAME$3,
30634
30712
  type: NodeTranslator.translatorTypes.NODE,
30635
- encode: encode$1,
30636
- decode: decode$1,
30713
+ encode: encode$3,
30714
+ decode: decode$3,
30637
30715
  attributes: validXmlAttributes$1
30638
30716
  };
30639
- const translator$1 = NodeTranslator.from(config$1);
30640
- const XML_NODE_NAME = "mc:AlternateContent";
30641
- const SD_NODE_NAME = [];
30717
+ const translator$3 = NodeTranslator.from(config$3);
30718
+ const XML_NODE_NAME$2 = "mc:AlternateContent";
30719
+ const SD_NODE_NAME$2 = [];
30642
30720
  const validXmlAttributes = [];
30643
- function encode(params) {
30721
+ function encode$2(params) {
30644
30722
  const { nodeListHandler } = params;
30645
30723
  const { node } = params.extraParams;
30646
30724
  if (!node || !node.type) {
@@ -30660,7 +30738,7 @@ function encode(params) {
30660
30738
  path: [...params.path || [], wpsNode]
30661
30739
  });
30662
30740
  }
30663
- function decode(params) {
30741
+ function decode$2(params) {
30664
30742
  const { node } = params;
30665
30743
  const { drawingContent } = node.attrs;
30666
30744
  const drawing = {
@@ -30677,13 +30755,186 @@ function decode(params) {
30677
30755
  elements: [choice]
30678
30756
  };
30679
30757
  }
30758
+ const config$2 = {
30759
+ xmlName: XML_NODE_NAME$2,
30760
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30761
+ type: NodeTranslator.translatorTypes.NODE,
30762
+ encode: encode$2,
30763
+ decode: decode$2,
30764
+ attributes: validXmlAttributes
30765
+ };
30766
+ const translator$2 = NodeTranslator.from(config$2);
30767
+ const XML_NODE_NAME$1 = "sd:pageReference";
30768
+ const SD_NODE_NAME$1 = "pageReference";
30769
+ const encode$1 = (params, _2) => {
30770
+ const { nodes = [], nodeListHandler } = params || {};
30771
+ const node = nodes[0];
30772
+ const processedText = nodeListHandler.handler({
30773
+ ...params,
30774
+ nodes: node.elements
30775
+ });
30776
+ const processedNode = {
30777
+ type: "pageReference",
30778
+ attrs: {
30779
+ instruction: node.attributes?.instruction || "",
30780
+ marksAsAttrs: node.marks || []
30781
+ },
30782
+ content: processedText
30783
+ };
30784
+ return processedNode;
30785
+ };
30786
+ const decode$1 = (params, _2) => {
30787
+ const { node } = params;
30788
+ const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
30789
+ const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params, node: n }));
30790
+ const translated = [
30791
+ {
30792
+ name: "w:r",
30793
+ elements: [
30794
+ {
30795
+ name: "w:rPr",
30796
+ elements: outputMarks
30797
+ },
30798
+ {
30799
+ name: "w:fldChar",
30800
+ attributes: {
30801
+ "w:fldCharType": "begin"
30802
+ }
30803
+ }
30804
+ ]
30805
+ },
30806
+ {
30807
+ name: "w:r",
30808
+ elements: [
30809
+ {
30810
+ name: "w:rPr",
30811
+ elements: outputMarks
30812
+ },
30813
+ {
30814
+ name: "w:instrText",
30815
+ attributes: { "xml:space": "preserve" },
30816
+ elements: [
30817
+ {
30818
+ type: "text",
30819
+ text: `${node.attrs.instruction}`
30820
+ }
30821
+ ]
30822
+ }
30823
+ ]
30824
+ },
30825
+ {
30826
+ name: "w:r",
30827
+ elements: [
30828
+ {
30829
+ name: "w:rPr",
30830
+ elements: outputMarks
30831
+ },
30832
+ {
30833
+ name: "w:fldChar",
30834
+ attributes: {
30835
+ "w:fldCharType": "separate"
30836
+ }
30837
+ }
30838
+ ]
30839
+ },
30840
+ ...contentNodes,
30841
+ {
30842
+ name: "w:r",
30843
+ elements: [
30844
+ {
30845
+ name: "w:rPr",
30846
+ elements: outputMarks
30847
+ },
30848
+ {
30849
+ name: "w:fldChar",
30850
+ attributes: {
30851
+ "w:fldCharType": "end"
30852
+ }
30853
+ }
30854
+ ]
30855
+ }
30856
+ ];
30857
+ return translated;
30858
+ };
30859
+ const config$1 = {
30860
+ xmlName: XML_NODE_NAME$1,
30861
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30862
+ type: NodeTranslator.translatorTypes.NODE,
30863
+ encode: encode$1,
30864
+ decode: decode$1
30865
+ };
30866
+ const translator$1 = NodeTranslator.from(config$1);
30867
+ const XML_NODE_NAME = "sd:tableOfContents";
30868
+ const SD_NODE_NAME = "tableOfContents";
30869
+ const encode = (params, _2) => {
30870
+ const { nodes = [], nodeListHandler } = params || {};
30871
+ const node = nodes[0];
30872
+ const processedContent = nodeListHandler.handler({
30873
+ ...params,
30874
+ nodes: node.elements || []
30875
+ });
30876
+ const processedNode = {
30877
+ type: "tableOfContents",
30878
+ attrs: {
30879
+ instruction: node.attributes?.instruction || ""
30880
+ },
30881
+ content: processedContent
30882
+ };
30883
+ return processedNode;
30884
+ };
30885
+ const decode = (params, _2) => {
30886
+ const { node } = params;
30887
+ const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params, node: n }));
30888
+ const tocBeginElements = [
30889
+ {
30890
+ name: "w:r",
30891
+ elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
30892
+ },
30893
+ {
30894
+ name: "w:r",
30895
+ elements: [
30896
+ {
30897
+ name: "w:instrText",
30898
+ attributes: { "xml:space": "preserve" },
30899
+ elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
30900
+ }
30901
+ ]
30902
+ },
30903
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
30904
+ ];
30905
+ if (contentNodes.length > 0) {
30906
+ const firstParagraph = contentNodes[0];
30907
+ let insertIndex = 0;
30908
+ if (firstParagraph.elements) {
30909
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
30910
+ insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
30911
+ } else {
30912
+ firstParagraph.elements = [];
30913
+ }
30914
+ firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
30915
+ } else {
30916
+ contentNodes.push({
30917
+ name: "w:p",
30918
+ elements: tocBeginElements
30919
+ });
30920
+ }
30921
+ const tocEndElements = [
30922
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
30923
+ ];
30924
+ const lastParagraph = contentNodes[contentNodes.length - 1];
30925
+ if (lastParagraph.elements) {
30926
+ lastParagraph.elements.push(...tocEndElements);
30927
+ } else {
30928
+ lastParagraph.elements = [...tocEndElements];
30929
+ }
30930
+ return contentNodes;
30931
+ };
30680
30932
  const config = {
30681
30933
  xmlName: XML_NODE_NAME,
30682
30934
  sdNodeOrKeyName: SD_NODE_NAME,
30683
30935
  type: NodeTranslator.translatorTypes.NODE,
30684
30936
  encode,
30685
- decode,
30686
- attributes: validXmlAttributes
30937
+ decode
30687
30938
  };
30688
30939
  const translator = NodeTranslator.from(config);
30689
30940
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
@@ -30757,32 +31008,35 @@ function exportSchemaToJson(params) {
30757
31008
  doc: translateDocumentNode,
30758
31009
  body: translateBodyNode,
30759
31010
  heading: translateHeadingNode,
30760
- paragraph: translator$13,
30761
- run: translator$U,
31011
+ paragraph: translator$16,
31012
+ run: translator$V,
30762
31013
  text: translateTextNode,
30763
31014
  bulletList: translateList,
30764
31015
  orderedList: translateList,
30765
- lineBreak: translator$16,
30766
- table: translator$9,
30767
- tableRow: translator$G,
30768
- tableCell: translator$8,
30769
- bookmarkStart: translator$2,
30770
- bookmarkEnd: translator$1,
30771
- fieldAnnotation: translator$3,
30772
- tab: translator$14,
30773
- image: translator$4,
30774
- hardBreak: translator$16,
31016
+ lineBreak: translator$19,
31017
+ table: translator$a,
31018
+ tableRow: translator$H,
31019
+ tableCell: translator$9,
31020
+ bookmarkStart: translator$4,
31021
+ bookmarkEnd: translator$3,
31022
+ fieldAnnotation: translator$5,
31023
+ tab: translator$17,
31024
+ image: translator$6,
31025
+ hardBreak: translator$19,
30775
31026
  commentRangeStart: () => translateCommentNode(params, "Start"),
30776
31027
  commentRangeEnd: () => translateCommentNode(params, "End"),
30777
31028
  commentReference: () => null,
30778
31029
  shapeContainer: translateShapeContainer,
30779
31030
  shapeTextbox: translateShapeTextbox,
30780
31031
  contentBlock: translateContentBlock,
30781
- structuredContent: translator$3,
30782
- structuredContentBlock: translator$3,
30783
- documentSection: translator$3,
31032
+ structuredContent: translator$5,
31033
+ structuredContentBlock: translator$5,
31034
+ documentPartObject: translator$5,
31035
+ documentSection: translator$5,
30784
31036
  "page-number": translatePageNumberNode,
30785
- "total-page-number": translateTotalPageNumberNode
31037
+ "total-page-number": translateTotalPageNumberNode,
31038
+ pageReference: translator$1,
31039
+ tableOfContents: translator
30786
31040
  };
30787
31041
  let handler2 = router[type2];
30788
31042
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -31120,8 +31374,6 @@ function translateTextNode(params) {
31120
31374
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
31121
31375
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
31122
31376
  if (isTrackedNode) return translateTrackedNode(params);
31123
- const isLinkNode = node.marks?.some((m2) => m2.type === "link");
31124
- if (isLinkNode) return translator$7.decode(params);
31125
31377
  const { text, marks = [] } = node;
31126
31378
  return getTextNodeForExport(text, marks, params);
31127
31379
  }
@@ -31427,7 +31679,7 @@ function translateMark(mark) {
31427
31679
  markElement.type = "element";
31428
31680
  break;
31429
31681
  case "underline": {
31430
- const translated = translator$10.decode({
31682
+ const translated = translator$13.decode({
31431
31683
  node: {
31432
31684
  attrs: {
31433
31685
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -31491,7 +31743,7 @@ function translateMark(mark) {
31491
31743
  break;
31492
31744
  case "highlight": {
31493
31745
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
31494
- const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
31746
+ const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
31495
31747
  return translated || {};
31496
31748
  }
31497
31749
  }
@@ -31519,7 +31771,7 @@ function translateShapeContainer(params) {
31519
31771
  const pict = {
31520
31772
  name: "w:pict",
31521
31773
  attributes: {
31522
- "w14:anchorId": Math.floor(Math.random() * 4294967295).toString()
31774
+ "w14:anchorId": generateRandomSigned32BitIntStrId()
31523
31775
  },
31524
31776
  elements: [shape]
31525
31777
  };
@@ -31551,7 +31803,7 @@ function translateContentBlock(params) {
31551
31803
  if (vmlAttributes || horizontalRule) {
31552
31804
  return translateVRectContentBlock(params);
31553
31805
  }
31554
- const alternateContent = translator.decode(params);
31806
+ const alternateContent = translator$2.decode(params);
31555
31807
  return wrapTextInRun(alternateContent);
31556
31808
  }
31557
31809
  function translateVRectContentBlock(params) {
@@ -31586,7 +31838,7 @@ function translateVRectContentBlock(params) {
31586
31838
  const pict = {
31587
31839
  name: "w:pict",
31588
31840
  attributes: {
31589
- "w14:anchorId": Math.floor(Math.random() * 4294967295).toString()
31841
+ "w14:anchorId": generateRandomSigned32BitIntStrId()
31590
31842
  },
31591
31843
  elements: [rect]
31592
31844
  };
@@ -31696,6 +31948,7 @@ const getAutoPageJson = (type2, outputMarks = []) => {
31696
31948
  },
31697
31949
  {
31698
31950
  name: "w:instrText",
31951
+ attributes: { "xml:space": "preserve" },
31699
31952
  elements: [
31700
31953
  {
31701
31954
  type: "text",
@@ -31755,7 +32008,7 @@ const handleDrawingNode = (params) => {
31755
32008
  if (mainNode.name === "w:drawing") node = mainNode;
31756
32009
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31757
32010
  if (!node) return { nodes: [], consumed: 0 };
31758
- const schemaNode = translator$4.encode(params);
32011
+ const schemaNode = translator$6.encode(params);
31759
32012
  const newNodes = schemaNode ? [schemaNode] : [];
31760
32013
  return { nodes: newNodes, consumed: 1 };
31761
32014
  };
@@ -31857,8 +32110,8 @@ const trackChangeNodeHandlerEntity = {
31857
32110
  handlerName: "trackChangeNodeHandler",
31858
32111
  handler: handleTrackChangeNode
31859
32112
  };
31860
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
31861
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
32113
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
32114
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
31862
32115
  const handleTextNode = (params) => {
31863
32116
  const { nodes, insideTrackChange } = params;
31864
32117
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31899,7 +32152,7 @@ const handleParagraphNode = (params) => {
31899
32152
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31900
32153
  return { nodes: [], consumed: 0 };
31901
32154
  }
31902
- const schemaNode = translator$13.encode(params);
32155
+ const schemaNode = translator$16.encode(params);
31903
32156
  const newNodes = schemaNode ? [schemaNode] : [];
31904
32157
  return { nodes: newNodes, consumed: 1 };
31905
32158
  };
@@ -31912,7 +32165,7 @@ const handleSdtNode = (params) => {
31912
32165
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31913
32166
  return { nodes: [], consumed: 0 };
31914
32167
  }
31915
- const result = translator$3.encode(params);
32168
+ const result = translator$5.encode(params);
31916
32169
  if (!result) {
31917
32170
  return { nodes: [], consumed: 0 };
31918
32171
  }
@@ -32002,7 +32255,7 @@ const handler = (params) => {
32002
32255
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
32003
32256
  return { nodes: [], consumed: 0 };
32004
32257
  }
32005
- const result = translator$16.encode(params);
32258
+ const result = translator$19.encode(params);
32006
32259
  if (!result) return { nodes: [], consumed: 0 };
32007
32260
  return {
32008
32261
  nodes: [result],
@@ -32074,7 +32327,7 @@ const handleBookmarkStartNode = (params) => {
32074
32327
  if (isCustomMarkBookmark(nodes[0], params.editor)) {
32075
32328
  return handleBookmarkNode(params);
32076
32329
  }
32077
- const node = translator$2.encode(params);
32330
+ const node = translator$4.encode(params);
32078
32331
  if (!node) return { nodes: [], consumed: 0 };
32079
32332
  return { nodes: [node], consumed: 1 };
32080
32333
  };
@@ -32106,7 +32359,7 @@ const handleBookmarkEndNode = (params) => {
32106
32359
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
32107
32360
  return { nodes: [], consumed: 0 };
32108
32361
  }
32109
- const node = translator$1.encode(params);
32362
+ const node = translator$3.encode(params);
32110
32363
  if (!node) return { nodes: [], consumed: 0 };
32111
32364
  return { nodes: [node], consumed: 1 };
32112
32365
  };
@@ -32239,6 +32492,7 @@ const autoTotalPageCountEntity = {
32239
32492
  handlerName: "autoTotalPageCountEntity",
32240
32493
  handler: handleAutoTotalPageNumber
32241
32494
  };
32495
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
32242
32496
  const handlePictNode = (params) => {
32243
32497
  const { nodes } = params;
32244
32498
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32737,6 +32991,7 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32737
32991
  const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
32738
32992
  const justify = pPr?.elements?.find((el) => el.name === "w:jc");
32739
32993
  const indent = pPr?.elements?.find((el) => el.name === "w:ind");
32994
+ const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
32740
32995
  let lineSpaceBefore, lineSpaceAfter, line;
32741
32996
  if (spacing) {
32742
32997
  lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
@@ -32750,6 +33005,22 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32750
33005
  rightIndent = twipsToPixels(indent?.attributes["w:right"]);
32751
33006
  firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
32752
33007
  }
33008
+ let tabStops = [];
33009
+ if (tabs) {
33010
+ tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
33011
+ let val = tab.attributes["w:val"];
33012
+ if (val == "left") {
33013
+ val = "start";
33014
+ } else if (val == "right") {
33015
+ val = "end";
33016
+ }
33017
+ return {
33018
+ val,
33019
+ pos: twipsToPixels(tab.attributes["w:pos"]),
33020
+ leader: tab.attributes["w:leader"]
33021
+ };
33022
+ });
33023
+ }
32753
33024
  const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
32754
33025
  const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
32755
33026
  const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
@@ -32782,7 +33053,8 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32782
33053
  const parsedStyles = {
32783
33054
  spacing: { lineSpaceAfter, lineSpaceBefore, line },
32784
33055
  textAlign,
32785
- indent: { leftIndent, rightIndent, firstLine }
33056
+ indent: { leftIndent, rightIndent, firstLine },
33057
+ tabStops: tabStops.length > 0 ? tabStops : null
32786
33058
  };
32787
33059
  parsedMarks.forEach((mark) => {
32788
33060
  const { type: type2, attrs } = mark;
@@ -32806,13 +33078,213 @@ const handleTabNode = (params) => {
32806
33078
  if (!nodes.length || nodes[0].name !== "w:tab") {
32807
33079
  return { nodes: [], consumed: 0 };
32808
33080
  }
32809
- const node = translator$14.encode(params);
33081
+ const node = translator$17.encode(params);
32810
33082
  return { nodes: [node], consumed: 1 };
32811
33083
  };
32812
33084
  const tabNodeEntityHandler = {
32813
33085
  handlerName: "w:tabTranslator",
32814
33086
  handler: handleTabNode
32815
33087
  };
33088
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
33089
+ function preProcessPageInstruction(nodesToCombine, _2, __) {
33090
+ const pageNumNode = {
33091
+ name: "sd:autoPageNumber",
33092
+ type: "element"
33093
+ };
33094
+ nodesToCombine.forEach((n) => {
33095
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
33096
+ if (rPrNode) pageNumNode.elements = [rPrNode];
33097
+ });
33098
+ return [pageNumNode];
33099
+ }
33100
+ function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
33101
+ const totalPageNumNode = {
33102
+ name: "sd:totalPageNumber",
33103
+ type: "element"
33104
+ };
33105
+ nodesToCombine.forEach((n) => {
33106
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
33107
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
33108
+ });
33109
+ return [totalPageNumNode];
33110
+ }
33111
+ function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
33112
+ const pageRefNode = {
33113
+ name: "sd:pageReference",
33114
+ type: "element",
33115
+ attributes: {
33116
+ instruction: instrText
33117
+ },
33118
+ elements: nodesToCombine
33119
+ };
33120
+ return [pageRefNode];
33121
+ }
33122
+ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
33123
+ const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
33124
+ let linkAttributes;
33125
+ if (urlMatch && urlMatch.length >= 2) {
33126
+ const url = urlMatch[1];
33127
+ const rels = docx["word/_rels/document.xml.rels"];
33128
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
33129
+ if (relationships) {
33130
+ const rId = generateDocxRandomId();
33131
+ relationships.elements.push({
33132
+ type: "element",
33133
+ name: "Relationship",
33134
+ attributes: {
33135
+ Id: rId,
33136
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
33137
+ Target: url,
33138
+ TargetMode: "External"
33139
+ }
33140
+ });
33141
+ linkAttributes = { "r:id": rId };
33142
+ } else {
33143
+ linkAttributes = { "w:anchor": url };
33144
+ }
33145
+ } else {
33146
+ const availableSwitches = {
33147
+ "w:anchor": `l "(?<value>[^"]+)"`,
33148
+ new_window: `
33149
+ `,
33150
+ "w:tgtFrame": ` "(?<value>[^"]+)"`,
33151
+ "w:tooltip": `o "(?<value>[^"]+)"`
33152
+ };
33153
+ const parsedSwitches = {};
33154
+ for (const [key, regex] of Object.entries(availableSwitches)) {
33155
+ const match = instruction.match(new RegExp(regex));
33156
+ if (match) {
33157
+ parsedSwitches[key] = match.groups?.value || true;
33158
+ }
33159
+ }
33160
+ if (parsedSwitches.new_window) {
33161
+ parsedSwitches["w:tgtFrame"] = "_blank";
33162
+ delete parsedSwitches.new_window;
33163
+ }
33164
+ linkAttributes = { ...parsedSwitches };
33165
+ }
33166
+ return [
33167
+ {
33168
+ name: "w:hyperlink",
33169
+ type: "element",
33170
+ attributes: linkAttributes,
33171
+ elements: nodesToCombine
33172
+ }
33173
+ ];
33174
+ }
33175
+ function preProcessTocInstruction(nodesToCombine, instrText) {
33176
+ return [
33177
+ {
33178
+ name: "sd:tableOfContents",
33179
+ type: "element",
33180
+ attributes: {
33181
+ instruction: instrText
33182
+ },
33183
+ elements: nodesToCombine
33184
+ }
33185
+ ];
33186
+ }
33187
+ const getInstructionPreProcessor = (instruction) => {
33188
+ const instructionType = instruction.split(" ")[0];
33189
+ switch (instructionType) {
33190
+ case "PAGE":
33191
+ return preProcessPageInstruction;
33192
+ case "NUMPAGES":
33193
+ return preProcessNumPagesInstruction;
33194
+ case "PAGEREF":
33195
+ return preProcessPageRefInstruction;
33196
+ case "HYPERLINK":
33197
+ return preProcessHyperlinkInstruction;
33198
+ case "TOC":
33199
+ return preProcessTocInstruction;
33200
+ default:
33201
+ return null;
33202
+ }
33203
+ };
33204
+ const preProcessNodesForFldChar = (nodes = [], docx) => {
33205
+ const processedNodes = [];
33206
+ let collectedNodesStack = [];
33207
+ let currentFieldStack = [];
33208
+ let unpairedEnd = null;
33209
+ let collecting = false;
33210
+ const finalizeField = () => {
33211
+ if (collecting) {
33212
+ const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
33213
+ const currentField = currentFieldStack.pop();
33214
+ const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
33215
+ if (collectedNodesStack.length === 0) {
33216
+ processedNodes.push(...combined);
33217
+ } else {
33218
+ collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
33219
+ }
33220
+ } else {
33221
+ unpairedEnd = true;
33222
+ }
33223
+ };
33224
+ for (const node of nodes) {
33225
+ const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
33226
+ const fldType = fldCharEl?.attributes?.["w:fldCharType"];
33227
+ const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
33228
+ collecting = collectedNodesStack.length > 0;
33229
+ if (fldType === "begin") {
33230
+ collectedNodesStack.push([null]);
33231
+ currentFieldStack.push({ instrText: "" });
33232
+ continue;
33233
+ }
33234
+ if (instrTextEl && collecting && currentFieldStack.length > 0) {
33235
+ currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
33236
+ continue;
33237
+ }
33238
+ if (fldType === "end") {
33239
+ finalizeField();
33240
+ continue;
33241
+ } else if (fldType === "separate") {
33242
+ continue;
33243
+ }
33244
+ if (Array.isArray(node.elements)) {
33245
+ const childResult = preProcessNodesForFldChar(node.elements, docx);
33246
+ node.elements = childResult.processedNodes;
33247
+ if (childResult.unpairedBegin) {
33248
+ childResult.unpairedBegin.forEach((pendingField) => {
33249
+ currentFieldStack.push(pendingField.fieldInfo);
33250
+ collectedNodesStack.push([node]);
33251
+ });
33252
+ } else if (childResult.unpairedEnd) {
33253
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33254
+ finalizeField();
33255
+ } else if (collecting) {
33256
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33257
+ } else {
33258
+ processedNodes.push(node);
33259
+ }
33260
+ } else if (collecting) {
33261
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33262
+ } else {
33263
+ processedNodes.push(node);
33264
+ }
33265
+ }
33266
+ let unpairedBegin = null;
33267
+ if (collectedNodesStack.length > 0) {
33268
+ unpairedBegin = [];
33269
+ for (let i = 0; i < collectedNodesStack.length; i++) {
33270
+ processedNodes.push(...collectedNodesStack[i].filter((n) => n !== null));
33271
+ unpairedBegin.push({
33272
+ nodes: collectedNodesStack[i],
33273
+ fieldInfo: currentFieldStack[i]
33274
+ });
33275
+ }
33276
+ }
33277
+ return { processedNodes, unpairedBegin, unpairedEnd };
33278
+ };
33279
+ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
33280
+ const instructionType = instrText.trim().split(" ")[0];
33281
+ const instructionPreProcessor = getInstructionPreProcessor(instructionType);
33282
+ if (instructionPreProcessor) {
33283
+ return instructionPreProcessor(nodesToCombine, instrText, docx);
33284
+ } else {
33285
+ return nodesToCombine;
33286
+ }
33287
+ };
32816
33288
  const createDocumentJson = (docx, converter, editor) => {
32817
33289
  const json = carbonCopy(getInitialJSON(docx));
32818
33290
  if (!json) return null;
@@ -32842,6 +33314,8 @@ const createDocumentJson = (docx, converter, editor) => {
32842
33314
  if (bodyNode) {
32843
33315
  ensureSectionProperties(bodyNode);
32844
33316
  const node = bodyNode;
33317
+ const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
33318
+ node.elements = processedNodes;
32845
33319
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
32846
33320
  const content = pruneIgnoredNodes(contentElements);
32847
33321
  const comments = importCommentData({ docx, converter, editor });
@@ -32897,8 +33371,10 @@ const defaultNodeListHandler = () => {
32897
33371
  trackChangeNodeHandlerEntity,
32898
33372
  tableNodeHandlerEntity,
32899
33373
  tabNodeEntityHandler,
33374
+ tableOfContentsHandlerEntity,
32900
33375
  autoPageHandlerEntity,
32901
33376
  autoTotalPageCountEntity,
33377
+ pageReferenceEntity,
32902
33378
  standardNodeHandlerEntity
32903
33379
  ];
32904
33380
  const handler2 = createNodeListHandler(entities);
@@ -33086,7 +33562,7 @@ const DEFAULT_SECTION_PROPS = Object.freeze({
33086
33562
  gutter: "0"
33087
33563
  })
33088
33564
  });
33089
- function ensureSectionProperties(bodyNode, converter) {
33565
+ function ensureSectionProperties(bodyNode) {
33090
33566
  if (!bodyNode.elements) bodyNode.elements = [];
33091
33567
  let sectPr = bodyNode.elements.find((el) => el.name === "w:sectPr");
33092
33568
  if (!sectPr) {
@@ -33454,7 +33930,7 @@ const _SuperConverter = class _SuperConverter {
33454
33930
  return;
33455
33931
  }
33456
33932
  }
33457
- static updateDocumentVersion(docx = this.convertedXml, version = "0.21.0") {
33933
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.22.0") {
33458
33934
  const customLocation = "docProps/custom.xml";
33459
33935
  if (!docx[customLocation]) {
33460
33936
  docx[customLocation] = generateCustomXml();
@@ -33946,7 +34422,7 @@ function storeSuperdocVersion(docx) {
33946
34422
  function generateCustomXml() {
33947
34423
  return DEFAULT_CUSTOM_XML;
33948
34424
  }
33949
- function generateSuperdocVersion(pid = 2, version = "0.21.0") {
34425
+ function generateSuperdocVersion(pid = 2, version = "0.22.0") {
33950
34426
  return {
33951
34427
  type: "element",
33952
34428
  name: "property",
@@ -33999,7 +34475,7 @@ export {
33999
34475
  objectIncludes as Z,
34000
34476
  AddMarkStep as _,
34001
34477
  Plugin as a,
34002
- translator$M as a$,
34478
+ translator$b as a$,
34003
34479
  twipsToLines as a0,
34004
34480
  pixelsToTwips as a1,
34005
34481
  helpers as a2,
@@ -34010,102 +34486,106 @@ export {
34010
34486
  createDocFromMarkdown as a7,
34011
34487
  createDocFromHTML as a8,
34012
34488
  EditorState as a9,
34013
- readFromClipboard as aA,
34014
- handleClipboardPaste as aB,
34015
- getFileObject as aC,
34016
- runPropertyTranslators as aD,
34017
- translator$5 as aE,
34018
- translator$6 as aF,
34019
- translator$I as aG,
34020
- translator$J as aH,
34021
- translator$10 as aI,
34022
- translator$H as aJ,
34023
- translator$K as aK,
34024
- translator$G as aL,
34025
- translator$g as aM,
34026
- translator$8 as aN,
34027
- translator$t as aO,
34028
- translator$u as aP,
34029
- translator$v as aQ,
34030
- translator$w as aR,
34031
- translator$x as aS,
34032
- translator$c as aT,
34489
+ vClickOutside as aA,
34490
+ getActiveFormatting as aB,
34491
+ readFromClipboard as aC,
34492
+ handleClipboardPaste as aD,
34493
+ getFileObject as aE,
34494
+ runPropertyTranslators as aF,
34495
+ translator$7 as aG,
34496
+ translator$8 as aH,
34497
+ translator$J as aI,
34498
+ translator$K as aJ,
34499
+ translator$13 as aK,
34500
+ translator$I as aL,
34501
+ translator$L as aM,
34502
+ translator$H as aN,
34503
+ translator$h as aO,
34504
+ translator$9 as aP,
34505
+ translator$u as aQ,
34506
+ translator$v as aR,
34507
+ translator$w as aS,
34508
+ translator$x as aT,
34033
34509
  translator$y as aU,
34034
- translator$z as aV,
34035
- translator$A as aW,
34036
- translator$B as aX,
34037
- translator$L as aY,
34038
- translator$a as aZ,
34039
- translator$C as a_,
34510
+ translator$d as aV,
34511
+ translator$z as aW,
34512
+ translator$A as aX,
34513
+ translator$B as aY,
34514
+ translator$C as aZ,
34515
+ translator$M as a_,
34040
34516
  hasSomeParentWithClass as aa,
34041
34517
  isActive as ab,
34042
34518
  unflattenListsInHtml as ac,
34043
34519
  parseSizeUnit as ad,
34044
34520
  minMax as ae,
34045
34521
  getLineHeightValueString as af,
34046
- InputRule as ag,
34047
- kebabCase as ah,
34048
- findParentNodeClosestToPos as ai,
34049
- getListItemStyleDefinitions as aj,
34050
- docxNumberigHelpers as ak,
34051
- parseIndentElement as al,
34052
- combineIndents as am,
34053
- SelectionRange as an,
34054
- Transform as ao,
34055
- isInTable as ap,
34056
- generateDocxRandomId as aq,
34057
- insertNewRelationship as ar,
34058
- updateDOMAttributes as as,
34059
- htmlHandler as at,
34060
- commonjsGlobal as au,
34061
- getDefaultExportFromCjs$1 as av,
34062
- getContentTypesFromXml as aw,
34063
- xmljs as ax,
34064
- vClickOutside as ay,
34065
- getActiveFormatting as az,
34522
+ updateDOMAttributes as ag,
34523
+ findChildren as ah,
34524
+ htmlHandler as ai,
34525
+ generateRandomSigned32BitIntStrId as aj,
34526
+ InputRule as ak,
34527
+ kebabCase as al,
34528
+ findParentNodeClosestToPos as am,
34529
+ getListItemStyleDefinitions as an,
34530
+ docxNumberigHelpers as ao,
34531
+ parseIndentElement as ap,
34532
+ combineIndents as aq,
34533
+ SelectionRange as ar,
34534
+ Transform as as,
34535
+ isInTable as at,
34536
+ generateDocxRandomId as au,
34537
+ insertNewRelationship as av,
34538
+ commonjsGlobal as aw,
34539
+ getDefaultExportFromCjs$1 as ax,
34540
+ getContentTypesFromXml as ay,
34541
+ xmljs as az,
34066
34542
  Slice as b,
34067
- translator$d as b0,
34068
- translator$D as b1,
34543
+ translator$D as b0,
34544
+ translator$N as b1,
34069
34545
  translator$e as b2,
34070
- translator$9 as b3,
34071
- translator$14 as b4,
34072
- translator$W as b5,
34073
- translator$X as b6,
34074
- translator$$ as b7,
34075
- translator$i as b8,
34076
- translator$E as b9,
34077
- translator$2 as bA,
34078
- translator$1 as bB,
34079
- translator$F as bC,
34080
- translator$12 as bD,
34081
- translator as bE,
34082
- _sfc_main as bF,
34083
- translator$3 as ba,
34084
- translator$k as bb,
34085
- translator$Y as bc,
34086
- translator$V as bd,
34087
- translator$Z as be,
34088
- translator$U as bf,
34089
- translator$13 as bg,
34090
- translator$m as bh,
34091
- translator$N as bi,
34546
+ translator$E as b3,
34547
+ translator$f as b4,
34548
+ translator$a as b5,
34549
+ translator$17 as b6,
34550
+ translator$Z as b7,
34551
+ translator$_ as b8,
34552
+ translator$12 as b9,
34553
+ translator$19 as bA,
34554
+ translator$t as bB,
34555
+ translator$4 as bC,
34556
+ translator$3 as bD,
34557
+ translator$G as bE,
34558
+ translator$15 as bF,
34559
+ translator as bG,
34560
+ translator$1 as bH,
34561
+ translator$2 as bI,
34562
+ _sfc_main as bJ,
34563
+ translator$j as ba,
34564
+ translator$F as bb,
34565
+ translator$5 as bc,
34566
+ translator$l as bd,
34567
+ translator$$ as be,
34568
+ translator$X as bf,
34569
+ translator$10 as bg,
34570
+ translator$V as bh,
34571
+ translator$16 as bi,
34092
34572
  translator$n as bj,
34093
- translator$o as bk,
34094
- translator$11 as bl,
34095
- translator$7 as bm,
34096
- translator$15 as bn,
34097
- translator$O as bo,
34098
- translator$b as bp,
34573
+ translator$O as bk,
34574
+ translator$o as bl,
34575
+ translator$p as bm,
34576
+ translator$14 as bn,
34577
+ translator$W as bo,
34578
+ translator$18 as bp,
34099
34579
  translator$P as bq,
34100
- translator$Q as br,
34101
- translator$q as bs,
34102
- translator$4 as bt,
34103
- translator$R as bu,
34104
- translator$_ as bv,
34580
+ translator$c as br,
34581
+ translator$Q as bs,
34582
+ translator$R as bt,
34583
+ translator$r as bu,
34584
+ translator$6 as bv,
34105
34585
  translator$S as bw,
34106
- translator$T as bx,
34107
- translator$16 as by,
34108
- translator$s as bz,
34586
+ translator$11 as bx,
34587
+ translator$T as by,
34588
+ translator$U as bz,
34109
34589
  DOMParser$1 as c,
34110
34590
  Mark as d,
34111
34591
  dropPoint as e,