@harbour-enterprises/superdoc 0.20.0-next.13 → 0.20.0-next.15

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 (108) hide show
  1. package/README.md +4 -4
  2. package/dist/chunks/{PdfViewer-Beoed5G0.es.js → PdfViewer-D3gJ5ozH.es.js} +1 -1
  3. package/dist/chunks/{PdfViewer-Dh2tr2ag.cjs → PdfViewer-DuEWa8ox.cjs} +1 -1
  4. package/dist/chunks/{index-BFe2eMYK.cjs → index-D2h9q27o.cjs} +32 -9
  5. package/dist/chunks/{index-OC4NDn1G.es.js → index-DiSIyVKk.es.js} +32 -9
  6. package/dist/chunks/{super-editor.es-cgub83Px.es.js → super-editor.es-4Ig7dBJr.es.js} +2901 -902
  7. package/dist/chunks/{super-editor.es-4ltXjey_.cjs → super-editor.es-lzaBZOn2.cjs} +2901 -902
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/stores/comments-store.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-CTJIyTAA.js → converter-BJVy6JMW.js} +1996 -657
  12. package/dist/super-editor/chunks/{docx-zipper-BwicJKh2.js → docx-zipper-DWDJGX0b.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-B97u3IuY.js → editor-BUCOmU2Y.js} +1027 -411
  14. package/dist/super-editor/chunks/{toolbar-BcdsHEOP.js → toolbar-CiBIcgiI.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/src/components/toolbar/format-negation.d.ts +5 -0
  20. package/dist/super-editor/src/core/commands/index.d.ts +1 -0
  21. package/dist/super-editor/src/core/commands/toggleMarkCascade.d.ts +42 -0
  22. package/dist/super-editor/src/core/commands/types/index.d.ts +29 -1
  23. package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +5 -0
  24. package/dist/super-editor/src/core/super-converter/exporter.d.ts +8 -0
  25. package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
  26. package/dist/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +12 -0
  27. package/dist/super-editor/src/core/super-converter/v2/importer/runNodeImporter.d.ts +6 -6
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/constants/east-asian-regex.d.ts +1 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/constants/index.d.ts +1 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +2 -12
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +3 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +4 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +7 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/index.d.ts +1 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +2 -0
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +4 -0
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +4 -0
  38. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +4 -0
  39. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +4 -0
  40. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts +7 -0
  41. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/index.d.ts +2 -0
  42. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/w-val.d.ts +4 -0
  43. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/highlight-translator.d.ts +4 -0
  44. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +2 -0
  45. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +4 -0
  46. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts +7 -0
  47. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/index.d.ts +2 -0
  48. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-del.d.ts +4 -0
  49. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r-pr.d.ts +4 -0
  50. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.d.ts +4 -0
  51. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts +40 -0
  52. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/index.d.ts +3 -0
  53. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +9 -0
  54. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/track-change-helpers.d.ts +5 -0
  55. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/index.d.ts +1 -0
  56. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts +4 -0
  57. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +2 -0
  58. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +4 -0
  59. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +4 -0
  60. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +4 -0
  61. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +4 -0
  62. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +4 -0
  63. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/index.d.ts +1 -0
  64. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts +5 -0
  65. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +2 -0
  66. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +4 -0
  67. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/index.d.ts +1 -0
  68. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts +7 -0
  69. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/index.d.ts +1 -0
  70. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts +5 -0
  71. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +11 -0
  72. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +2 -0
  73. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +4 -0
  74. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +7 -0
  75. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +2 -0
  76. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +4 -0
  77. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +4 -0
  78. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/index.d.ts +2 -0
  79. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/w-val.d.ts +4 -0
  80. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts +4 -0
  81. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/index.d.ts +2 -0
  82. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-color.d.ts +4 -0
  83. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-color.d.ts +4 -0
  84. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-shade.d.ts +4 -0
  85. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-tint.d.ts +4 -0
  86. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-val.d.ts +4 -0
  87. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/u-translator.d.ts +7 -0
  88. package/dist/super-editor/src/extensions/index.d.ts +2 -2
  89. package/dist/super-editor/src/extensions/linked-styles/index.d.ts +1 -0
  90. package/dist/super-editor/src/extensions/linked-styles/underline-css.d.ts +17 -0
  91. package/dist/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +62 -0
  92. package/dist/super-editor/src/extensions/run/commands/index.d.ts +1 -0
  93. package/dist/super-editor/src/extensions/run/commands/split-run.d.ts +1 -0
  94. package/dist/super-editor/src/extensions/run/index.d.ts +1 -0
  95. package/dist/super-editor/src/extensions/run/run.d.ts +6 -0
  96. package/dist/super-editor/src/extensions/shared/cascade-toggle.d.ts +8 -0
  97. package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +12 -0
  98. package/dist/super-editor/src/extensions/tab/tab.d.ts +4 -0
  99. package/dist/super-editor/src/tests/helpers/getParagraphText.d.ts +2 -0
  100. package/dist/super-editor/super-editor.es.js +90 -21
  101. package/dist/super-editor/toolbar.es.js +2 -2
  102. package/dist/super-editor.cjs +1 -1
  103. package/dist/super-editor.es.js +1 -1
  104. package/dist/superdoc.cjs +2 -2
  105. package/dist/superdoc.es.js +2 -2
  106. package/dist/superdoc.umd.js +2933 -911
  107. package/dist/superdoc.umd.js.map +1 -1
  108. package/package.json +7 -4
@@ -14886,25 +14886,47 @@ const getContentTypesFromXml = (contentTypesXml) => {
14886
14886
  const defaults = xmlDoc.querySelectorAll("Default");
14887
14887
  return Array.from(defaults).map((item) => item.getAttribute("Extension"));
14888
14888
  };
14889
+ const DOCX_HIGHLIGHT_KEYWORD_MAP = /* @__PURE__ */ new Map([
14890
+ ["yellow", "FFFF00"],
14891
+ ["green", "00FF00"],
14892
+ ["blue", "0000FF"],
14893
+ ["cyan", "00FFFF"],
14894
+ ["magenta", "FF00FF"],
14895
+ ["red", "FF0000"],
14896
+ ["darkYellow", "808000"],
14897
+ ["darkGreen", "008000"],
14898
+ ["darkBlue", "000080"],
14899
+ ["darkCyan", "008080"],
14900
+ ["darkMagenta", "800080"],
14901
+ ["darkGray", "808080"],
14902
+ ["darkRed", "800000"],
14903
+ ["lightGray", "C0C0C0"],
14904
+ ["black", "000000"],
14905
+ ["white", "FFFFFF"]
14906
+ ]);
14907
+ const normalizeHexColor = (hex) => {
14908
+ if (!hex) return null;
14909
+ let value = hex.replace("#", "").trim();
14910
+ if (!value) return null;
14911
+ value = value.toUpperCase();
14912
+ if (value.length === 3)
14913
+ value = value.split("").map((c) => c + c).join("");
14914
+ if (value.length === 8) value = value.slice(0, 6);
14915
+ return value;
14916
+ };
14889
14917
  const getHexColorFromDocxSystem = (docxColor) => {
14890
- const colorMap = /* @__PURE__ */ new Map([
14891
- ["yellow", "#ffff00"],
14892
- ["green", "#00ff00"],
14893
- ["blue", "#0000FFFF"],
14894
- ["cyan", "#00ffff"],
14895
- ["magenta", "#ff00ff"],
14896
- ["red", "#ff0000"],
14897
- ["darkYellow", "#808000FF"],
14898
- ["darkGreen", "#008000FF"],
14899
- ["darkBlue", "#000080"],
14900
- ["darkCyan", "#008080FF"],
14901
- ["darkMagenta", "#800080FF"],
14902
- ["darkGray", "#808080FF"],
14903
- ["darkRed", "#800000FF"],
14904
- ["lightGray", "#C0C0C0FF"],
14905
- ["black", "#000"]
14906
- ]);
14907
- return colorMap.get(docxColor) || null;
14918
+ const hex = DOCX_HIGHLIGHT_KEYWORD_MAP.get(docxColor);
14919
+ return hex ? `#${hex}` : null;
14920
+ };
14921
+ const getDocxHighlightKeywordFromHex = (hexColor) => {
14922
+ if (!hexColor) return null;
14923
+ if (DOCX_HIGHLIGHT_KEYWORD_MAP.has(hexColor)) return hexColor;
14924
+ const normalized = normalizeHexColor(hexColor);
14925
+ if (!normalized) return null;
14926
+ for (const [keyword, hex] of DOCX_HIGHLIGHT_KEYWORD_MAP.entries()) {
14927
+ if (hex === normalized) return keyword;
14928
+ }
14929
+ return null;
14908
14930
  };
14909
14931
  function isValidHexColor(color) {
14910
14932
  if (!color || typeof color !== "string") return false;
@@ -21399,7 +21421,7 @@ function L() {
21399
21421
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
21400
21422
  }
21401
21423
  var O = L();
21402
- function H(l3) {
21424
+ function G(l3) {
21403
21425
  O = l3;
21404
21426
  }
21405
21427
  var E = { exec: () => null };
@@ -21411,7 +21433,7 @@ function h(l3, e = "") {
21411
21433
  return n;
21412
21434
  }
21413
21435
  var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}#`), htmlBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}<(?:[a-z].*>|!--)`, "i") }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = /(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Te = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, we = /^[^\n]+/, Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), $e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(), K = { blockquote: $e, code: be, def: ye, fences: Re, heading: Oe, hr: C, html: Se, lheading: ie, list: Pe, newline: xe, paragraph: oe, table: E, text: we }, re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = { ...K, lheading: Te, table: re, paragraph: h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, Le = { ...K, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", C).replace("heading", ` *#{1,6} *[^
21414
- ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, W = /[\s\p{P}\p{S}]/u, le = /[^\s\p{P}\p{S}]/u, Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), ue = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, Ie = /(?:[^\s\p{P}\p{S}]|~)/u, Be = /\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g, pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = h(pe, "u").replace(/punct/g, D).getRegex(), ve = h(pe, "u").replace(/punct/g, ue).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ze = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(), Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), He = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), je = h(U).replace("(?:-->|$)", "-->").getRegex(), Fe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/, Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he$3 = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(), de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(), Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he$3).replace("nolink", de).getRegex(), X = { _backpedal: E, anyPunctuation: He, autolink: Ne, blockSkip: Be, br: ae, code: ze, del: E, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ge, escape: Me, link: Qe, nolink: de, punctuation: Ee, reflink: he$3, reflinkSearch: Ue, tag: Fe, text: Ae, url: E }, Ke = { ...X, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: Ze, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ }, We = { ...N, br: h(ae).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, I = { normal: K, gfm: _e, pedantic: Le }, M = { normal: X, gfm: N, breaks: We, pedantic: Ke };
21436
+ ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, W = /[\s\p{P}\p{S}]/u, le = /[^\s\p{P}\p{S}]/u, Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), ue = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, Ie = /(?:[^\s\p{P}\p{S}]|~)/u, Be = /\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g, pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = h(pe, "u").replace(/punct/g, D).getRegex(), ve = h(pe, "u").replace(/punct/g, ue).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), He = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(), Ze = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ge = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), je = h(U).replace("(?:-->|$)", "-->").getRegex(), Fe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/, Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he$3 = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(), de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(), Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he$3).replace("nolink", de).getRegex(), X = { _backpedal: E, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: ae, code: ze, del: E, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: Qe, nolink: de, punctuation: Ee, reflink: he$3, reflinkSearch: Ue, tag: Fe, text: Ae, url: E }, Ke = { ...X, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: He, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ }, We = { ...N, br: h(ae).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, I = { normal: K, gfm: _e, pedantic: Le }, M = { normal: X, gfm: N, breaks: We, pedantic: Ke };
21415
21437
  var Xe = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ke = (l3) => Xe[l3];
21416
21438
  function w(l3, e) {
21417
21439
  if (e) {
@@ -21569,15 +21591,15 @@ ${c}` : c;
21569
21591
  if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
21570
21592
  p = t[0], e = e.substring(p.length);
21571
21593
  let f = t[2].split(`
21572
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (Z) => " ".repeat(3 * Z.length)), k = e.split(`
21594
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), k = e.split(`
21573
21595
  `, 1)[0], x = !f.trim(), g = 0;
21574
21596
  if (this.options.pedantic ? (g = 2, c = f.trimStart()) : x ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = f.slice(g), g += t[1].length), x && this.rules.other.blankLine.test(k) && (p += k + `
21575
21597
  `, e = e.substring(k.length + 1), u = true), !u) {
21576
- let Z = this.rules.other.nextBulletRegex(g), ee = this.rules.other.hrRegex(g), te = this.rules.other.fencesBeginRegex(g), ne = this.rules.other.headingBeginRegex(g), me = this.rules.other.htmlBeginRegex(g);
21598
+ let H = this.rules.other.nextBulletRegex(g), ee = this.rules.other.hrRegex(g), te = this.rules.other.fencesBeginRegex(g), ne = this.rules.other.headingBeginRegex(g), me = this.rules.other.htmlBeginRegex(g);
21577
21599
  for (; e; ) {
21578
- let G = e.split(`
21600
+ let Z = e.split(`
21579
21601
  `, 1)[0], A;
21580
- if (k = G, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), A = k) : A = k.replace(this.rules.other.tabCharGlobal, " "), te.test(k) || ne.test(k) || me.test(k) || Z.test(k) || ee.test(k)) break;
21602
+ if (k = Z, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), A = k) : A = k.replace(this.rules.other.tabCharGlobal, " "), te.test(k) || ne.test(k) || me.test(k) || H.test(k) || ee.test(k)) break;
21581
21603
  if (A.search(this.rules.other.nonSpaceChar) >= g || !k.trim()) c += `
21582
21604
  ` + A.slice(g);
21583
21605
  else {
@@ -21585,8 +21607,8 @@ ${c}` : c;
21585
21607
  c += `
21586
21608
  ` + k;
21587
21609
  }
21588
- !x && !k.trim() && (x = true), p += G + `
21589
- `, e = e.substring(G.length + 1), f = A.slice(g);
21610
+ !x && !k.trim() && (x = true), p += Z + `
21611
+ `, e = e.substring(Z.length + 1), f = A.slice(g);
21590
21612
  }
21591
21613
  }
21592
21614
  i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (o = true));
@@ -21893,6 +21915,7 @@ var b = class l {
21893
21915
  }
21894
21916
  for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
21895
21917
  for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
21918
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
21896
21919
  let i = false, s = "";
21897
21920
  for (; e; ) {
21898
21921
  i || (s = ""), i = false;
@@ -22087,7 +22110,7 @@ ${e}</tr>
22087
22110
  return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
22088
22111
  }
22089
22112
  };
22090
- var S = class {
22113
+ var $ = class {
22091
22114
  strong({ text: e }) {
22092
22115
  return e;
22093
22116
  }
@@ -22121,7 +22144,7 @@ var R = class l2 {
22121
22144
  __publicField(this, "options");
22122
22145
  __publicField(this, "renderer");
22123
22146
  __publicField(this, "textRenderer");
22124
- this.options = e || O, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new S();
22147
+ this.options = e || O, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
22125
22148
  }
22126
22149
  static parse(e, t) {
22127
22150
  return new l2(t).parse(e);
@@ -22261,7 +22284,7 @@ var R = class l2 {
22261
22284
  return n;
22262
22285
  }
22263
22286
  };
22264
- var $ = (_a = class {
22287
+ var S = (_a = class {
22265
22288
  constructor(e) {
22266
22289
  __publicField(this, "options");
22267
22290
  __publicField(this, "block");
@@ -22276,13 +22299,16 @@ var $ = (_a = class {
22276
22299
  processAllTokens(e) {
22277
22300
  return e;
22278
22301
  }
22302
+ emStrongMask(e) {
22303
+ return e;
22304
+ }
22279
22305
  provideLexer() {
22280
22306
  return this.block ? b.lex : b.lexInline;
22281
22307
  }
22282
22308
  provideParser() {
22283
22309
  return this.block ? R.parse : R.parseInline;
22284
22310
  }
22285
- }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
22311
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
22286
22312
  var B = class {
22287
22313
  constructor(...e) {
22288
22314
  __publicField(this, "defaults", L());
@@ -22291,10 +22317,10 @@ var B = class {
22291
22317
  __publicField(this, "parseInline", this.parseMarkdown(false));
22292
22318
  __publicField(this, "Parser", R);
22293
22319
  __publicField(this, "Renderer", P);
22294
- __publicField(this, "TextRenderer", S);
22320
+ __publicField(this, "TextRenderer", $);
22295
22321
  __publicField(this, "Lexer", b);
22296
22322
  __publicField(this, "Tokenizer", y);
22297
- __publicField(this, "Hooks", $);
22323
+ __publicField(this, "Hooks", S);
22298
22324
  this.use(...e);
22299
22325
  }
22300
22326
  walkTokens(e, t) {
@@ -22367,13 +22393,13 @@ var B = class {
22367
22393
  r.tokenizer = i;
22368
22394
  }
22369
22395
  if (n.hooks) {
22370
- let i = this.defaults.hooks || new $();
22396
+ let i = this.defaults.hooks || new S();
22371
22397
  for (let s in n.hooks) {
22372
22398
  if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
22373
22399
  if (["options", "block"].includes(s)) continue;
22374
22400
  let o = s, a = n.hooks[o], u = i[o];
22375
- $.passThroughHooks.has(s) ? i[o] = (p) => {
22376
- if (this.defaults.async) return Promise.resolve(a.call(i, p)).then((f) => u.call(i, f));
22401
+ S.passThroughHooks.has(s) ? i[o] = (p) => {
22402
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return Promise.resolve(a.call(i, p)).then((f) => u.call(i, f));
22377
22403
  let c = a.call(i, p);
22378
22404
  return u.call(i, c);
22379
22405
  } : i[o] = (...p) => {
@@ -22439,12 +22465,12 @@ function d(l3, e) {
22439
22465
  return _.parse(l3, e);
22440
22466
  }
22441
22467
  d.options = d.setOptions = function(l3) {
22442
- return _.setOptions(l3), d.defaults = _.defaults, H(d.defaults), d;
22468
+ return _.setOptions(l3), d.defaults = _.defaults, G(d.defaults), d;
22443
22469
  };
22444
22470
  d.getDefaults = L;
22445
22471
  d.defaults = O;
22446
22472
  d.use = function(...l3) {
22447
- return _.use(...l3), d.defaults = _.defaults, H(d.defaults), d;
22473
+ return _.use(...l3), d.defaults = _.defaults, G(d.defaults), d;
22448
22474
  };
22449
22475
  d.walkTokens = function(l3, e) {
22450
22476
  return _.walkTokens(l3, e);
@@ -22453,11 +22479,11 @@ d.parseInline = _.parseInline;
22453
22479
  d.Parser = R;
22454
22480
  d.parser = R.parse;
22455
22481
  d.Renderer = P;
22456
- d.TextRenderer = S;
22482
+ d.TextRenderer = $;
22457
22483
  d.Lexer = b;
22458
22484
  d.lexer = b.lex;
22459
22485
  d.Tokenizer = y;
22460
- d.Hooks = $;
22486
+ d.Hooks = S;
22461
22487
  d.parse = d;
22462
22488
  d.options;
22463
22489
  d.setOptions;
@@ -24297,37 +24323,37 @@ const _NodeTranslator = class _NodeTranslator {
24297
24323
  /** @type {typeof TranslatorTypes} */
24298
24324
  __publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
24299
24325
  let NodeTranslator = _NodeTranslator;
24300
- const encode$A = (attributes) => {
24326
+ const encode$17 = (attributes) => {
24301
24327
  return attributes["w:type"];
24302
24328
  };
24303
- const decode$A = (attrs) => {
24329
+ const decode$_ = (attrs) => {
24304
24330
  const { lineBreakType } = attrs;
24305
24331
  return lineBreakType;
24306
24332
  };
24307
- const attrConfig$i = Object.freeze({
24333
+ const attrConfig$F = Object.freeze({
24308
24334
  xmlName: "w:type",
24309
24335
  sdName: "lineBreakType",
24310
- encode: encode$A,
24311
- decode: decode$A
24336
+ encode: encode$17,
24337
+ decode: decode$_
24312
24338
  });
24313
- const encode$z = (attributes) => {
24339
+ const encode$16 = (attributes) => {
24314
24340
  const xmlAttrValue = attributes["w:clear"];
24315
24341
  return xmlAttrValue;
24316
24342
  };
24317
- const decode$z = (attrs) => {
24343
+ const decode$Z = (attrs) => {
24318
24344
  const { clear } = attrs;
24319
24345
  return clear;
24320
24346
  };
24321
- const attrConfig$h = Object.freeze({
24347
+ const attrConfig$E = Object.freeze({
24322
24348
  xmlName: "w:clear",
24323
24349
  sdName: "clear",
24324
- encode: encode$z,
24325
- decode: decode$z
24350
+ encode: encode$16,
24351
+ decode: decode$Z
24326
24352
  });
24327
- const validXmlAttributes$b = [attrConfig$i, attrConfig$h];
24328
- const XML_NODE_NAME$h = "w:br";
24353
+ const validXmlAttributes$l = [attrConfig$F, attrConfig$E];
24354
+ const XML_NODE_NAME$t = "w:br";
24329
24355
  const SD_NODE_NAME$c = "lineBreak";
24330
- const encode$y = (_2, encodedAttrs) => {
24356
+ const encode$15 = (_2, encodedAttrs) => {
24331
24357
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24332
24358
  const translated = {
24333
24359
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24337,7 +24363,7 @@ const encode$y = (_2, encodedAttrs) => {
24337
24363
  }
24338
24364
  return translated;
24339
24365
  };
24340
- const decode$y = (params, decodedAttrs) => {
24366
+ const decode$Y = (params, decodedAttrs) => {
24341
24367
  const { node } = params;
24342
24368
  if (!node) return;
24343
24369
  const wBreak = { name: "w:br" };
@@ -24354,63 +24380,125 @@ const decode$y = (params, decodedAttrs) => {
24354
24380
  };
24355
24381
  return translated;
24356
24382
  };
24357
- const config$f = {
24358
- xmlName: XML_NODE_NAME$h,
24383
+ const config$r = {
24384
+ xmlName: XML_NODE_NAME$t,
24359
24385
  sdNodeOrKeyName: SD_NODE_NAME$c,
24360
24386
  type: NodeTranslator.translatorTypes.NODE,
24361
- encode: encode$y,
24362
- decode: decode$y,
24363
- attributes: validXmlAttributes$b
24387
+ encode: encode$15,
24388
+ decode: decode$Y,
24389
+ attributes: validXmlAttributes$l
24390
+ };
24391
+ const translator$15 = NodeTranslator.from(config$r);
24392
+ const encode$14 = (attributes) => attributes?.["w:val"];
24393
+ const decode$X = (attrs) => attrs?.highlight;
24394
+ const attrConfig$D = Object.freeze({
24395
+ xmlName: "w:val",
24396
+ sdName: "highlight",
24397
+ encode: encode$14,
24398
+ decode: decode$X
24399
+ });
24400
+ const validXmlAttributes$k = [attrConfig$D];
24401
+ const XML_NODE_NAME$s = "w:highlight";
24402
+ const SD_ATTR_KEY$f = "highlight";
24403
+ const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24404
+ const encode$13 = (params, encodedAttrs = {}) => {
24405
+ const { nodes } = params;
24406
+ const node = nodes?.[0];
24407
+ const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24408
+ return {
24409
+ type: "attr",
24410
+ xmlName: XML_NODE_NAME$s,
24411
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
24412
+ attributes: { "w:val": value ?? null }
24413
+ };
24414
+ };
24415
+ const decode$W = (params) => {
24416
+ const attrs = params?.node?.attrs || {};
24417
+ const highlightValue = attrs.highlight ?? attrs.color ?? null;
24418
+ if (!highlightValue) return void 0;
24419
+ const normalizedValue = String(highlightValue).trim().toLowerCase();
24420
+ if (!normalizedValue) return void 0;
24421
+ if (DISABLED_TOKENS.has(normalizedValue)) {
24422
+ return {
24423
+ name: XML_NODE_NAME$s,
24424
+ attributes: { "w:val": "none" }
24425
+ };
24426
+ }
24427
+ const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24428
+ if (keyword) {
24429
+ return {
24430
+ name: XML_NODE_NAME$s,
24431
+ attributes: { "w:val": keyword }
24432
+ };
24433
+ }
24434
+ const fill = normalizeHexColor(highlightValue);
24435
+ if (!fill) return void 0;
24436
+ return {
24437
+ name: "w:shd",
24438
+ attributes: {
24439
+ "w:color": "auto",
24440
+ "w:val": "clear",
24441
+ "w:fill": fill
24442
+ }
24443
+ };
24364
24444
  };
24365
- const translator$V = NodeTranslator.from(config$f);
24366
- const encode$x = (attributes) => {
24445
+ const config$q = {
24446
+ xmlName: XML_NODE_NAME$s,
24447
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
24448
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
24449
+ encode: encode$13,
24450
+ decode: decode$W,
24451
+ attributes: validXmlAttributes$k
24452
+ };
24453
+ const translator$14 = NodeTranslator.from(config$q);
24454
+ const encode$12 = (attributes) => {
24367
24455
  return attributes["w:val"];
24368
24456
  };
24369
- const decode$x = (attrs) => {
24457
+ const decode$V = (attrs) => {
24370
24458
  const { tabSize } = attrs || {};
24371
24459
  return tabSize;
24372
24460
  };
24373
- const attrConfig$g = Object.freeze({
24461
+ const attrConfig$C = Object.freeze({
24374
24462
  xmlName: "w:val",
24375
24463
  sdName: "tabSize",
24376
- encode: encode$x,
24377
- decode: decode$x
24464
+ encode: encode$12,
24465
+ decode: decode$V
24378
24466
  });
24379
- const encode$w = (attributes) => {
24467
+ const encode$11 = (attributes) => {
24380
24468
  return attributes["w:leader"];
24381
24469
  };
24382
- const decode$w = (attrs) => {
24470
+ const decode$U = (attrs) => {
24383
24471
  const { leader } = attrs || {};
24384
24472
  return leader;
24385
24473
  };
24386
- const attrConfig$f = Object.freeze({
24474
+ const attrConfig$B = Object.freeze({
24387
24475
  xmlName: "w:leader",
24388
24476
  sdName: "leader",
24389
- encode: encode$w,
24390
- decode: decode$w
24477
+ encode: encode$11,
24478
+ decode: decode$U
24391
24479
  });
24392
- const encode$v = (attributes) => {
24480
+ const encode$10 = (attributes) => {
24393
24481
  return attributes["w:pos"];
24394
24482
  };
24395
- const decode$v = (attrs) => {
24483
+ const decode$T = (attrs) => {
24396
24484
  const { pos } = attrs || {};
24397
24485
  return pos;
24398
24486
  };
24399
- const attrConfig$e = Object.freeze({
24487
+ const attrConfig$A = Object.freeze({
24400
24488
  xmlName: "w:pos",
24401
24489
  sdName: "pos",
24402
- encode: encode$v,
24403
- decode: decode$v
24490
+ encode: encode$10,
24491
+ decode: decode$T
24404
24492
  });
24405
- const validXmlAttributes$a = [attrConfig$g, attrConfig$e, attrConfig$f];
24406
- const XML_NODE_NAME$g = "w:tab";
24493
+ const validXmlAttributes$j = [attrConfig$C, attrConfig$A, attrConfig$B];
24494
+ const XML_NODE_NAME$r = "w:tab";
24407
24495
  const SD_NODE_NAME$b = "tab";
24408
- const encode$u = (_2, encodedAttrs = {}) => {
24496
+ const encode$$ = (_2, encodedAttrs = {}) => {
24409
24497
  const translated = { type: "tab" };
24410
24498
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24411
24499
  return translated;
24412
24500
  };
24413
- const decode$u = (params, decodedAttrs = {}) => {
24501
+ const decode$S = (params, decodedAttrs = {}) => {
24414
24502
  const { node } = params || {};
24415
24503
  if (!node) return;
24416
24504
  const wTab = { name: "w:tab" };
@@ -24426,15 +24514,15 @@ const decode$u = (params, decodedAttrs = {}) => {
24426
24514
  }
24427
24515
  return translated;
24428
24516
  };
24429
- const config$e = {
24430
- xmlName: XML_NODE_NAME$g,
24517
+ const config$p = {
24518
+ xmlName: XML_NODE_NAME$r,
24431
24519
  sdNodeOrKeyName: SD_NODE_NAME$b,
24432
24520
  type: NodeTranslator.translatorTypes.NODE,
24433
- encode: encode$u,
24434
- decode: decode$u,
24435
- attributes: validXmlAttributes$a
24521
+ encode: encode$$,
24522
+ decode: decode$S,
24523
+ attributes: validXmlAttributes$j
24436
24524
  };
24437
- const translator$U = NodeTranslator.from(config$e);
24525
+ const translator$13 = NodeTranslator.from(config$p);
24438
24526
  const mergeTextNodes = (nodes) => {
24439
24527
  if (!nodes || !Array.isArray(nodes)) {
24440
24528
  return nodes;
@@ -24609,17 +24697,21 @@ function getMarkValue(markType, attributes, docx) {
24609
24697
  function getFontFamilyValue(attributes, docx) {
24610
24698
  const ascii = attributes["w:ascii"];
24611
24699
  const themeAscii = attributes["w:asciiTheme"];
24612
- if (!docx || !themeAscii) return ascii;
24613
- const theme = docx["word/theme/theme1.xml"];
24614
- if (!theme) return ascii;
24615
- const { elements: topElements } = theme;
24616
- const { elements } = topElements[0];
24617
- const themeElements = elements.find((el) => el.name === "a:themeElements");
24618
- const fontScheme = themeElements.elements.find((el) => el.name === "a:fontScheme");
24619
- const majorFont = fontScheme.elements.find((el) => el.name === "a:majorFont");
24620
- const latin = majorFont.elements.find((el) => el.name === "a:latin");
24621
- const typeface = latin.attributes["typeface"];
24622
- return typeface;
24700
+ let resolved = ascii;
24701
+ if (docx && themeAscii) {
24702
+ const theme = docx["word/theme/theme1.xml"];
24703
+ if (theme?.elements?.length) {
24704
+ const { elements: topElements } = theme;
24705
+ const { elements } = topElements[0] || {};
24706
+ const themeElements = elements?.find((el) => el.name === "a:themeElements");
24707
+ const fontScheme = themeElements?.elements?.find((el) => el.name === "a:fontScheme");
24708
+ const majorFont = fontScheme?.elements?.find((el) => el.name === "a:majorFont");
24709
+ const latin = majorFont?.elements?.find((el) => el.name === "a:latin");
24710
+ resolved = latin?.attributes?.typeface || resolved;
24711
+ }
24712
+ }
24713
+ if (!resolved) return null;
24714
+ return SuperConverter.toCssFontFamily(resolved, docx);
24623
24715
  }
24624
24716
  function getIndentValue(attributes) {
24625
24717
  let value = attributes["w:left"];
@@ -24640,7 +24732,11 @@ function getHighLightValue(attributes) {
24640
24732
  return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
24641
24733
  }
24642
24734
  function getStrikeValue(attributes) {
24643
- return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
24735
+ const raw = attributes?.["w:val"];
24736
+ if (raw === void 0 || raw === null) return "1";
24737
+ const value = String(raw).trim().toLowerCase();
24738
+ if (value === "1" || value === "true" || value === "on") return "1";
24739
+ return null;
24644
24740
  }
24645
24741
  const parseParagraphBorders = (pBdr) => {
24646
24742
  if (!pBdr || !pBdr.elements) return {};
@@ -24670,27 +24766,39 @@ const getParagraphIndent = (node, docx, styleId = "") => {
24670
24766
  right: 0,
24671
24767
  firstLine: 0,
24672
24768
  hanging: 0,
24673
- textIndent: 0
24769
+ textIndent: 0,
24770
+ explicitLeft: false,
24771
+ explicitRight: false,
24772
+ explicitFirstLine: false,
24773
+ explicitHanging: false
24674
24774
  };
24675
24775
  const { indent: pDefaultIndent = {} } = getDefaultParagraphStyle(docx, styleId);
24676
24776
  const pPr = node.elements?.find((el) => el.name === "w:pPr");
24677
24777
  const inLineIndentTag = pPr?.elements?.find((el) => el.name === "w:ind");
24678
24778
  const inLineIndent = inLineIndentTag?.attributes || {};
24679
- const leftIndent = inLineIndent?.["w:left"] || pDefaultIndent?.["w:left"];
24680
- const rightIndent = inLineIndent?.["w:right"] || pDefaultIndent?.["w:right"];
24681
- const firstLine = inLineIndent?.["w:firstLine"] || pDefaultIndent?.["w:firstLine"];
24682
- const hanging = inLineIndent?.["w:hanging"] || pDefaultIndent?.["w:hanging"];
24779
+ const inlineLeft = inLineIndent?.["w:left"];
24780
+ const inlineRight = inLineIndent?.["w:right"];
24781
+ const inlineFirstLine = inLineIndent?.["w:firstLine"];
24782
+ const inlineHanging = inLineIndent?.["w:hanging"];
24783
+ const leftIndent = inlineLeft ?? pDefaultIndent?.["w:left"];
24784
+ const rightIndent = inlineRight ?? pDefaultIndent?.["w:right"];
24785
+ const firstLine = inlineFirstLine ?? pDefaultIndent?.["w:firstLine"];
24786
+ const hanging = inlineHanging ?? pDefaultIndent?.["w:hanging"];
24683
24787
  if (leftIndent) {
24684
24788
  indent.left = twipsToPixels(leftIndent);
24789
+ indent.explicitLeft = inlineLeft !== void 0;
24685
24790
  }
24686
24791
  if (rightIndent) {
24687
24792
  indent.right = twipsToPixels(rightIndent);
24793
+ indent.explicitRight = inlineRight !== void 0;
24688
24794
  }
24689
24795
  if (firstLine) {
24690
24796
  indent.firstLine = twipsToPixels(firstLine);
24797
+ indent.explicitFirstLine = inlineFirstLine !== void 0;
24691
24798
  }
24692
24799
  if (hanging) {
24693
24800
  indent.hanging = twipsToPixels(hanging);
24801
+ indent.explicitHanging = inlineHanging !== void 0;
24694
24802
  }
24695
24803
  const textIndentValue = leftIndent - parseInt(hanging || 0) || 0;
24696
24804
  if (textIndentValue) {
@@ -25029,102 +25137,102 @@ const handleParagraphNode$1 = (params) => {
25029
25137
  }
25030
25138
  return schemaNode;
25031
25139
  };
25032
- const encode$t = (attributes) => {
25140
+ const encode$_ = (attributes) => {
25033
25141
  return attributes["w:rsidDel"];
25034
25142
  };
25035
- const decode$t = (attrs) => {
25143
+ const decode$R = (attrs) => {
25036
25144
  return attrs.rsidDel;
25037
25145
  };
25038
- const attrConfig$d = Object.freeze({
25146
+ const attrConfig$z = Object.freeze({
25039
25147
  xmlName: "w:rsidDel",
25040
25148
  sdName: "rsidDel",
25041
- encode: encode$t,
25042
- decode: decode$t
25149
+ encode: encode$_,
25150
+ decode: decode$R
25043
25151
  });
25044
- const encode$s = (attributes) => {
25152
+ const encode$Z = (attributes) => {
25045
25153
  return attributes["w:rsidP"];
25046
25154
  };
25047
- const decode$s = (attrs) => {
25155
+ const decode$Q = (attrs) => {
25048
25156
  return attrs.rsidP;
25049
25157
  };
25050
- const attrConfig$c = Object.freeze({
25158
+ const attrConfig$y = Object.freeze({
25051
25159
  xmlName: "w:rsidP",
25052
25160
  sdName: "rsidP",
25053
- encode: encode$s,
25054
- decode: decode$s
25161
+ encode: encode$Z,
25162
+ decode: decode$Q
25055
25163
  });
25056
- const encode$r = (attributes) => {
25164
+ const encode$Y = (attributes) => {
25057
25165
  return attributes["w:rsidR"];
25058
25166
  };
25059
- const decode$r = (attrs) => {
25167
+ const decode$P = (attrs) => {
25060
25168
  return attrs.rsidR;
25061
25169
  };
25062
- const attrConfig$b = Object.freeze({
25170
+ const attrConfig$x = Object.freeze({
25063
25171
  xmlName: "w:rsidR",
25064
25172
  sdName: "rsidR",
25065
- encode: encode$r,
25066
- decode: decode$r
25173
+ encode: encode$Y,
25174
+ decode: decode$P
25067
25175
  });
25068
- const encode$q = (attributes) => {
25176
+ const encode$X = (attributes) => {
25069
25177
  return attributes["w:rsidRPr"];
25070
25178
  };
25071
- const decode$q = (attrs) => {
25179
+ const decode$O = (attrs) => {
25072
25180
  return attrs.rsidRPr;
25073
25181
  };
25074
- const attrConfig$a = Object.freeze({
25182
+ const attrConfig$w = Object.freeze({
25075
25183
  xmlName: "w:rsidRPr",
25076
25184
  sdName: "rsidRPr",
25077
- encode: encode$q,
25078
- decode: decode$q
25185
+ encode: encode$X,
25186
+ decode: decode$O
25079
25187
  });
25080
- const encode$p = (attributes) => {
25188
+ const encode$W = (attributes) => {
25081
25189
  return attributes["w:rsidRDefault"];
25082
25190
  };
25083
- const decode$p = (attrs) => {
25191
+ const decode$N = (attrs) => {
25084
25192
  return attrs.rsidRDefault;
25085
25193
  };
25086
- const attrConfig$9 = Object.freeze({
25194
+ const attrConfig$v = Object.freeze({
25087
25195
  xmlName: "w:rsidRDefault",
25088
25196
  sdName: "rsidRDefault",
25089
- encode: encode$p,
25090
- decode: decode$p
25197
+ encode: encode$W,
25198
+ decode: decode$N
25091
25199
  });
25092
- const encode$o = (attributes) => {
25200
+ const encode$V = (attributes) => {
25093
25201
  return attributes["w14:paraId"];
25094
25202
  };
25095
- const decode$o = (attrs) => {
25203
+ const decode$M = (attrs) => {
25096
25204
  return attrs.paraId;
25097
25205
  };
25098
- const attrConfig$8 = Object.freeze({
25206
+ const attrConfig$u = Object.freeze({
25099
25207
  xmlName: "w14:paraId",
25100
25208
  sdName: "paraId",
25101
- encode: encode$o,
25102
- decode: decode$o
25209
+ encode: encode$V,
25210
+ decode: decode$M
25103
25211
  });
25104
- const encode$n = (attributes) => {
25212
+ const encode$U = (attributes) => {
25105
25213
  return attributes["w14:textId"];
25106
25214
  };
25107
- const decode$n = (attrs) => {
25215
+ const decode$L = (attrs) => {
25108
25216
  return attrs.textId;
25109
25217
  };
25110
- const attrConfig$7 = Object.freeze({
25218
+ const attrConfig$t = Object.freeze({
25111
25219
  xmlName: "w14:textId",
25112
25220
  sdName: "textId",
25113
- encode: encode$n,
25114
- decode: decode$n
25221
+ encode: encode$U,
25222
+ decode: decode$L
25115
25223
  });
25116
- const validXmlAttributes$9 = [
25117
- attrConfig$8,
25118
- attrConfig$7,
25119
- attrConfig$b,
25120
- attrConfig$9,
25121
- attrConfig$c,
25122
- attrConfig$a,
25123
- attrConfig$d
25224
+ const validXmlAttributes$i = [
25225
+ attrConfig$u,
25226
+ attrConfig$t,
25227
+ attrConfig$x,
25228
+ attrConfig$v,
25229
+ attrConfig$y,
25230
+ attrConfig$w,
25231
+ attrConfig$z
25124
25232
  ];
25125
- const XML_NODE_NAME$f = "w:p";
25233
+ const XML_NODE_NAME$q = "w:p";
25126
25234
  const SD_NODE_NAME$a = "paragraph";
25127
- const encode$m = (params, encodedAttrs = {}) => {
25235
+ const encode$T = (params, encodedAttrs = {}) => {
25128
25236
  const node = handleParagraphNode$1(params);
25129
25237
  if (!node) return void 0;
25130
25238
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25132,7 +25240,7 @@ const encode$m = (params, encodedAttrs = {}) => {
25132
25240
  }
25133
25241
  return node;
25134
25242
  };
25135
- const decode$m = (params, decodedAttrs = {}) => {
25243
+ const decode$K = (params, decodedAttrs = {}) => {
25136
25244
  const translated = translateParagraphNode(params);
25137
25245
  if (!translated) return void 0;
25138
25246
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25140,165 +25248,1320 @@ const decode$m = (params, decodedAttrs = {}) => {
25140
25248
  }
25141
25249
  return translated;
25142
25250
  };
25143
- const config$d = {
25144
- xmlName: XML_NODE_NAME$f,
25251
+ const config$o = {
25252
+ xmlName: XML_NODE_NAME$q,
25145
25253
  sdNodeOrKeyName: SD_NODE_NAME$a,
25146
25254
  type: NodeTranslator.translatorTypes.NODE,
25147
- encode: encode$m,
25148
- decode: decode$m,
25149
- attributes: validXmlAttributes$9
25255
+ encode: encode$T,
25256
+ decode: decode$K,
25257
+ attributes: validXmlAttributes$i
25258
+ };
25259
+ const translator$12 = NodeTranslator.from(config$o);
25260
+ const encode$S = (attributes) => {
25261
+ const raw = attributes?.["w:val"];
25262
+ if (raw === void 0 || raw === null) return void 0;
25263
+ if (typeof raw === "boolean") return raw;
25264
+ if (typeof raw === "number") return raw !== 0;
25265
+ const val = String(raw).trim().toLowerCase();
25266
+ if (val === "0" || val === "false" || val === "off") return false;
25267
+ if (val === "1" || val === "true" || val === "on") return true;
25268
+ return void 0;
25150
25269
  };
25151
- const translator$T = NodeTranslator.from(config$d);
25152
- const generateV2HandlerEntity = (handlerName, translator2) => ({
25153
- handlerName,
25154
- handler: (params) => {
25155
- const { nodes } = params;
25156
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
25157
- return { nodes: [], consumed: 0 };
25158
- }
25159
- const result = translator2.encode(params);
25160
- if (!result) return { nodes: [], consumed: 0 };
25161
- return {
25162
- nodes: Array.isArray(result) ? result : [result],
25163
- consumed: 1
25164
- };
25165
- }
25270
+ const decode$J = (runProps) => {
25271
+ if (runProps?.bold === false) return "0";
25272
+ return void 0;
25273
+ };
25274
+ const attrConfig$s = Object.freeze({
25275
+ xmlName: "w:val",
25276
+ sdName: "bold",
25277
+ encode: encode$S,
25278
+ decode: decode$J
25166
25279
  });
25167
- function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
25168
- if (!sdName) sdName = xmlName.split(":")[1];
25169
- if (!transformEncode) transformEncode = (v2) => v2;
25170
- if (!transformDecode) transformDecode = (v2) => v2;
25280
+ const validXmlAttributes$h = [attrConfig$s];
25281
+ const XML_NODE_NAME$p = "w:b";
25282
+ const SD_ATTR_KEY$e = "bold";
25283
+ const encode$R = (params, encodedAttrs = {}) => {
25284
+ const { nodes } = params;
25285
+ const node = nodes[0];
25286
+ if (!node) return void 0;
25287
+ const val = encodedAttrs?.[SD_ATTR_KEY$e];
25288
+ let attributes;
25289
+ if (val === false) attributes = { "w:val": "0" };
25290
+ else if (val === true)
25291
+ attributes = {};
25292
+ else attributes = node.attributes || {};
25171
25293
  return {
25172
- xmlName,
25173
- sdNodeOrKeyName: sdName,
25174
- encode: ({ nodes }) => {
25175
- return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
25176
- },
25177
- decode: ({ node }) => {
25178
- const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
25179
- return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
25180
- }
25294
+ type: "attr",
25295
+ xmlName: XML_NODE_NAME$p,
25296
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25297
+ attributes
25181
25298
  };
25182
- }
25183
- function createMeasurementPropertyHandler(xmlName, sdName = null) {
25184
- if (!sdName) sdName = xmlName.split(":")[1];
25299
+ };
25300
+ const config$n = {
25301
+ xmlName: XML_NODE_NAME$p,
25302
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25303
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25304
+ encode: encode$R,
25305
+ attributes: validXmlAttributes$h
25306
+ };
25307
+ const translator$11 = NodeTranslator.from(config$n);
25308
+ const XML_NODE_NAME$o = "w:i";
25309
+ const SD_ATTR_KEY$d = "italic";
25310
+ const encode$Q = (params) => {
25311
+ const { nodes } = params;
25312
+ const node = nodes?.[0];
25313
+ if (!node) return void 0;
25185
25314
  return {
25186
- xmlName,
25187
- sdNodeOrKeyName: sdName,
25188
- attributes: [
25189
- createAttributeHandler("w:w", "value", parseInteger, integerToString),
25190
- createAttributeHandler("w:type")
25191
- ],
25192
- encode: (_2, encodedAttrs) => {
25193
- return encodedAttrs["value"] != null ? encodedAttrs : void 0;
25194
- },
25195
- decode: function({ node }) {
25196
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25197
- return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
25315
+ type: "attr",
25316
+ xmlName: XML_NODE_NAME$o,
25317
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25318
+ attributes: {
25319
+ "w:val": node.attributes?.["w:val"] ?? null
25198
25320
  }
25199
25321
  };
25200
- }
25201
- function createBorderPropertyHandler(xmlName, sdName = null) {
25202
- if (!sdName) sdName = xmlName.split(":")[1];
25322
+ };
25323
+ const config$m = {
25324
+ xmlName: XML_NODE_NAME$o,
25325
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25326
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25327
+ encode: encode$Q
25328
+ };
25329
+ const translator$10 = NodeTranslator.from(config$m);
25330
+ const encode$P = (attributes) => attributes?.["w:val"];
25331
+ const decode$I = (attrs) => attrs?.underline;
25332
+ const attrConfig$r = Object.freeze({
25333
+ xmlName: "w:val",
25334
+ sdName: "underline",
25335
+ encode: encode$P,
25336
+ decode: decode$I
25337
+ });
25338
+ const encode$O = (attributes) => attributes?.["w:color"];
25339
+ const decode$H = (attrs) => attrs?.color;
25340
+ const attrConfig$q = Object.freeze({
25341
+ xmlName: "w:color",
25342
+ sdName: "color",
25343
+ encode: encode$O,
25344
+ decode: decode$H
25345
+ });
25346
+ const encode$N = (attributes) => attributes?.["w:themeColor"];
25347
+ const decode$G = (attrs) => attrs?.themeColor;
25348
+ const attrConfig$p = Object.freeze({
25349
+ xmlName: "w:themeColor",
25350
+ sdName: "themeColor",
25351
+ encode: encode$N,
25352
+ decode: decode$G
25353
+ });
25354
+ const encode$M = (attributes) => attributes?.["w:themeTint"];
25355
+ const decode$F = (attrs) => attrs?.themeTint;
25356
+ const attrConfig$o = Object.freeze({
25357
+ xmlName: "w:themeTint",
25358
+ sdName: "themeTint",
25359
+ encode: encode$M,
25360
+ decode: decode$F
25361
+ });
25362
+ const encode$L = (attributes) => attributes?.["w:themeShade"];
25363
+ const decode$E = (attrs) => attrs?.themeShade;
25364
+ const attrConfig$n = Object.freeze({
25365
+ xmlName: "w:themeShade",
25366
+ sdName: "themeShade",
25367
+ encode: encode$L,
25368
+ decode: decode$E
25369
+ });
25370
+ const validXmlAttributes$g = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25371
+ const XML_NODE_NAME$n = "w:u";
25372
+ const SD_ATTR_KEY$c = "underline";
25373
+ const encode$K = (params, encodedAttrs = {}) => {
25374
+ const { nodes } = params;
25375
+ const node = nodes?.[0];
25376
+ const sourceAttrs = node?.attributes || {};
25377
+ const underlineType = encodedAttrs.underline ?? sourceAttrs["w:val"];
25378
+ const color = encodedAttrs.color ?? sourceAttrs["w:color"];
25379
+ const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
25380
+ const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
25381
+ const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
25382
+ const attributes = { "w:val": underlineType ?? null };
25383
+ if (color !== void 0 && color !== null) attributes["w:color"] = color;
25384
+ if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
25385
+ if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
25386
+ if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25203
25387
  return {
25204
- xmlName,
25205
- sdNodeOrKeyName: sdName,
25206
- attributes: [
25207
- createAttributeHandler("w:val"),
25208
- createAttributeHandler("w:color"),
25209
- createAttributeHandler("w:themeColor"),
25210
- createAttributeHandler("w:themeTint"),
25211
- createAttributeHandler("w:themeShade"),
25212
- createAttributeHandler("w:sz", "size", parseInteger, integerToString),
25213
- createAttributeHandler("w:space", null, parseInteger, integerToString),
25214
- createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
25215
- createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
25216
- ],
25217
- encode: (params, encodedAttrs) => {
25218
- return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
25219
- },
25220
- decode: function({ node }, context) {
25221
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25222
- return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
25223
- }
25388
+ type: "attr",
25389
+ xmlName: XML_NODE_NAME$n,
25390
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25391
+ attributes
25224
25392
  };
25225
- }
25226
- const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
25227
- if (!transformEncode) transformEncode = (v2) => v2;
25228
- if (!transformDecode) transformDecode = (v2) => v2;
25229
- if (!sdName) sdName = xmlName.split(":")[1];
25393
+ };
25394
+ const decode$D = (params) => {
25395
+ const attrs = params?.node?.attrs || {};
25396
+ const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25397
+ const color = attrs.underlineColor ?? attrs.color ?? null;
25398
+ const themeColor = attrs.underlineThemeColor ?? attrs.themeColor ?? null;
25399
+ const themeTint = attrs.underlineThemeTint ?? attrs.themeTint ?? null;
25400
+ const themeShade = attrs.underlineThemeShade ?? attrs.themeShade ?? null;
25401
+ if (!underlineType && !color && !themeColor && !themeTint && !themeShade) return void 0;
25402
+ const attributes = {};
25403
+ if (underlineType) attributes["w:val"] = underlineType;
25404
+ if (color) {
25405
+ const normalized = normalizeHexColor(color);
25406
+ if (normalized) attributes["w:color"] = normalized;
25407
+ }
25408
+ if (themeColor) attributes["w:themeColor"] = themeColor;
25409
+ if (themeTint) attributes["w:themeTint"] = themeTint;
25410
+ if (themeShade) attributes["w:themeShade"] = themeShade;
25230
25411
  return {
25231
- xmlName,
25232
- sdName,
25233
- encode: (attributes) => transformEncode(attributes[xmlName]),
25234
- decode: (attributes) => transformDecode(attributes[sdName])
25412
+ name: XML_NODE_NAME$n,
25413
+ attributes
25235
25414
  };
25236
25415
  };
25237
- function encodeProperties(node, translatorsByXmlName, asArray = false) {
25238
- if (!node?.elements || node.elements.length === 0) {
25239
- return asArray ? [] : {};
25240
- }
25241
- const attributes = asArray ? [] : {};
25242
- node.elements.forEach((el) => {
25243
- const translator2 = translatorsByXmlName[el.name];
25244
- if (translator2) {
25245
- const encodedAttr = translator2.encode({ nodes: [el] });
25246
- if (encodedAttr != null) {
25247
- if (asArray) {
25248
- attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
25249
- } else {
25250
- attributes[translator2.sdNodeOrKeyName] = encodedAttr;
25251
- }
25252
- }
25253
- }
25254
- });
25255
- return attributes;
25256
- }
25257
- function decodeProperties(translatorsBySdName, properties) {
25258
- if (!properties || typeof properties !== "object") {
25259
- return [];
25260
- }
25261
- const elements = [];
25262
- Object.keys(properties).forEach((key) => {
25263
- const translator2 = translatorsBySdName[key];
25264
- if (translator2) {
25265
- const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
25266
- if (result != null) {
25267
- result.name = translator2.xmlName;
25268
- elements.push(result);
25269
- }
25270
- }
25271
- });
25272
- return elements;
25273
- }
25274
- const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
25275
- const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
25276
- const parseInteger = (value) => {
25277
- if (value == null) return void 0;
25278
- const intValue = parseInt(value, 10);
25279
- return isNaN(intValue) ? void 0 : intValue;
25416
+ const config$l = {
25417
+ xmlName: XML_NODE_NAME$n,
25418
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25419
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25420
+ encode: encode$K,
25421
+ decode: decode$D,
25422
+ attributes: validXmlAttributes$g
25423
+ };
25424
+ const translator$$ = NodeTranslator.from(config$l);
25425
+ const encode$J = (attributes) => {
25426
+ const raw = attributes?.["w:val"];
25427
+ if (raw === void 0 || raw === null) return void 0;
25428
+ if (typeof raw === "boolean") return raw;
25429
+ if (typeof raw === "number") return raw !== 0;
25430
+ const val = String(raw).trim().toLowerCase();
25431
+ if (val === "0" || val === "false" || val === "off") return false;
25432
+ if (val === "1" || val === "true" || val === "on") return true;
25433
+ return void 0;
25280
25434
  };
25281
- const integerToString = (value) => {
25282
- const intValue = parseInteger(value);
25283
- return intValue != void 0 ? String(intValue) : void 0;
25435
+ const decode$C = (attrs) => {
25436
+ if (attrs?.strike === false) return "0";
25437
+ return void 0;
25284
25438
  };
25285
- function preProcessVerticalMergeCells(table, { editorSchema }) {
25286
- if (!table || !Array.isArray(table.content)) {
25287
- return table;
25288
- }
25289
- const rows = table.content;
25290
- for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
25291
- const row = rows[rowIndex];
25292
- if (!row) continue;
25293
- if (!Array.isArray(row.content)) {
25294
- row.content = [];
25295
- }
25296
- for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
25297
- const cell = row.content[cellIndex];
25298
- if (!cell) continue;
25299
- const attrs = cell.attrs || {};
25300
- if (!attrs.rowspan || attrs.rowspan <= 1) continue;
25301
- const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
25439
+ const attrConfig$m = Object.freeze({
25440
+ xmlName: "w:val",
25441
+ sdName: "strike",
25442
+ encode: encode$J,
25443
+ decode: decode$C
25444
+ });
25445
+ const validXmlAttributes$f = [attrConfig$m];
25446
+ const XML_NODE_NAME$m = "w:strike";
25447
+ const SD_ATTR_KEY$b = "strike";
25448
+ const encode$I = (params, encodedAttrs = {}) => {
25449
+ const { nodes } = params;
25450
+ const node = nodes?.[0];
25451
+ if (!node) return void 0;
25452
+ const val = encodedAttrs?.[SD_ATTR_KEY$b];
25453
+ let attributes;
25454
+ if (val === false) attributes = { "w:val": "0" };
25455
+ else if (val === true) attributes = {};
25456
+ else attributes = { ...node.attributes || {} };
25457
+ if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
25458
+ else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25459
+ return {
25460
+ type: "attr",
25461
+ xmlName: XML_NODE_NAME$m,
25462
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25463
+ attributes
25464
+ };
25465
+ };
25466
+ const config$k = {
25467
+ xmlName: XML_NODE_NAME$m,
25468
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25469
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25470
+ encode: encode$I,
25471
+ attributes: validXmlAttributes$f
25472
+ };
25473
+ const translator$_ = NodeTranslator.from(config$k);
25474
+ const encode$H = (attributes) => attributes?.["w:val"];
25475
+ const decode$B = (attrs) => attrs?.color;
25476
+ const attrConfig$l = Object.freeze({
25477
+ xmlName: "w:val",
25478
+ sdName: "color",
25479
+ encode: encode$H,
25480
+ decode: decode$B
25481
+ });
25482
+ const encode$G = (attributes) => attributes?.["w:themeColor"];
25483
+ const decode$A = (attrs) => attrs?.themeColor;
25484
+ const attrConfig$k = Object.freeze({
25485
+ xmlName: "w:themeColor",
25486
+ sdName: "themeColor",
25487
+ encode: encode$G,
25488
+ decode: decode$A
25489
+ });
25490
+ const encode$F = (attributes) => attributes?.["w:themeTint"];
25491
+ const decode$z = (attrs) => attrs?.themeTint;
25492
+ const attrConfig$j = Object.freeze({
25493
+ xmlName: "w:themeTint",
25494
+ sdName: "themeTint",
25495
+ encode: encode$F,
25496
+ decode: decode$z
25497
+ });
25498
+ const encode$E = (attributes) => attributes?.["w:themeShade"];
25499
+ const decode$y = (attrs) => attrs?.themeShade;
25500
+ const attrConfig$i = Object.freeze({
25501
+ xmlName: "w:themeShade",
25502
+ sdName: "themeShade",
25503
+ encode: encode$E,
25504
+ decode: decode$y
25505
+ });
25506
+ const validXmlAttributes$e = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25507
+ const XML_NODE_NAME$l = "w:color";
25508
+ const SD_ATTR_KEY$a = "color";
25509
+ const encode$D = (params, encodedAttrs = {}) => {
25510
+ const { nodes } = params;
25511
+ const node = nodes?.[0];
25512
+ const sourceAttrs = node?.attributes || {};
25513
+ const value = encodedAttrs.color ?? sourceAttrs["w:val"];
25514
+ const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
25515
+ const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
25516
+ const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
25517
+ const attributes = {};
25518
+ attributes["w:val"] = value ?? null;
25519
+ if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
25520
+ if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
25521
+ if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25522
+ return {
25523
+ type: "attr",
25524
+ xmlName: XML_NODE_NAME$l,
25525
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25526
+ attributes
25527
+ };
25528
+ };
25529
+ const config$j = {
25530
+ xmlName: XML_NODE_NAME$l,
25531
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25532
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25533
+ encode: encode$D,
25534
+ attributes: validXmlAttributes$e
25535
+ };
25536
+ const translator$Z = NodeTranslator.from(config$j);
25537
+ const encode$C = (attributes) => attributes?.["w:eastAsia"];
25538
+ const decode$x = (attrs) => attrs?.eastAsia;
25539
+ const attrConfig$h = Object.freeze({
25540
+ xmlName: "w:eastAsia",
25541
+ sdName: "eastAsia",
25542
+ encode: encode$C,
25543
+ decode: decode$x
25544
+ });
25545
+ const encode$B = (attributes) => attributes?.["w:ascii"];
25546
+ const decode$w = (attrs) => attrs?.ascii;
25547
+ const attrConfig$g = Object.freeze({
25548
+ xmlName: "w:ascii",
25549
+ sdName: "ascii",
25550
+ encode: encode$B,
25551
+ decode: decode$w
25552
+ });
25553
+ const encode$A = (attributes) => attributes?.["w:hAnsi"];
25554
+ const decode$v = (attrs) => attrs?.hAnsi;
25555
+ const attrConfig$f = Object.freeze({
25556
+ xmlName: "w:hAnsi",
25557
+ sdName: "hAnsi",
25558
+ encode: encode$A,
25559
+ decode: decode$v
25560
+ });
25561
+ const encode$z = (attributes) => attributes?.["w:cs"];
25562
+ const decode$u = (attrs) => attrs?.cs;
25563
+ const attrConfig$e = Object.freeze({
25564
+ xmlName: "w:cs",
25565
+ sdName: "cs",
25566
+ encode: encode$z,
25567
+ decode: decode$u
25568
+ });
25569
+ const encode$y = (attributes) => attributes?.["w:val"];
25570
+ const decode$t = (attrs) => attrs?.value;
25571
+ const attrConfig$d = Object.freeze({
25572
+ xmlName: "w:val",
25573
+ sdName: "value",
25574
+ encode: encode$y,
25575
+ decode: decode$t
25576
+ });
25577
+ const validXmlAttributes$d = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25578
+ const XML_NODE_NAME$k = "w:rFonts";
25579
+ const SD_ATTR_KEY$9 = "fontFamily";
25580
+ const encode$x = (params, encodedAttrs = {}) => {
25581
+ const { nodes } = params;
25582
+ const node = nodes?.[0];
25583
+ const sourceAttrs = node?.attributes || {};
25584
+ const attributes = {};
25585
+ const setAttr = (xmlName, sdName) => {
25586
+ if (encodedAttrs[sdName] !== void 0 && encodedAttrs[sdName] !== null) {
25587
+ attributes[xmlName] = encodedAttrs[sdName];
25588
+ } else if (sourceAttrs[xmlName] !== void 0) {
25589
+ attributes[xmlName] = sourceAttrs[xmlName];
25590
+ }
25591
+ };
25592
+ setAttr("w:eastAsia", "eastAsia");
25593
+ setAttr("w:ascii", "ascii");
25594
+ setAttr("w:hAnsi", "hAnsi");
25595
+ setAttr("w:cs", "cs");
25596
+ setAttr("w:val", "value");
25597
+ Object.keys(sourceAttrs).forEach((key) => {
25598
+ if (attributes[key] === void 0) attributes[key] = sourceAttrs[key];
25599
+ });
25600
+ if (attributes["w:val"] === void 0 && attributes["w:eastAsia"]) {
25601
+ attributes["w:val"] = attributes["w:eastAsia"];
25602
+ }
25603
+ if (attributes["w:val"] === void 0) delete attributes["w:val"];
25604
+ return {
25605
+ type: "attr",
25606
+ xmlName: XML_NODE_NAME$k,
25607
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25608
+ attributes
25609
+ };
25610
+ };
25611
+ const config$i = {
25612
+ xmlName: XML_NODE_NAME$k,
25613
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25614
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25615
+ encode: encode$x,
25616
+ attributes: validXmlAttributes$d
25617
+ };
25618
+ const translator$Y = NodeTranslator.from(config$i);
25619
+ const encode$w = (attributes) => attributes?.["w:val"];
25620
+ const decode$s = (attrs) => attrs?.styleId;
25621
+ const attrConfig$c = Object.freeze({
25622
+ xmlName: "w:val",
25623
+ sdName: "styleId",
25624
+ encode: encode$w,
25625
+ decode: decode$s
25626
+ });
25627
+ const validXmlAttributes$c = [attrConfig$c];
25628
+ const XML_NODE_NAME$j = "w:rStyle";
25629
+ const SD_ATTR_KEY$8 = "styleId";
25630
+ const encode$v = (params, encodedAttrs = {}) => {
25631
+ const { nodes } = params;
25632
+ const node = nodes?.[0];
25633
+ const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25634
+ return {
25635
+ type: "attr",
25636
+ xmlName: XML_NODE_NAME$j,
25637
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25638
+ attributes: { "w:val": value ?? null }
25639
+ };
25640
+ };
25641
+ const config$h = {
25642
+ xmlName: XML_NODE_NAME$j,
25643
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25644
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25645
+ encode: encode$v,
25646
+ attributes: validXmlAttributes$c
25647
+ };
25648
+ const translator$X = NodeTranslator.from(config$h);
25649
+ const encode$u = (attributes) => attributes?.["w:val"];
25650
+ const decode$r = (attrs) => attrs?.fontSize;
25651
+ const attrConfig$b = Object.freeze({
25652
+ xmlName: "w:val",
25653
+ sdName: "fontSize",
25654
+ encode: encode$u,
25655
+ decode: decode$r
25656
+ });
25657
+ const validXmlAttributes$b = [attrConfig$b];
25658
+ const XML_NODE_NAME$i = "w:sz";
25659
+ const SD_ATTR_KEY$7 = "fontSize";
25660
+ const encode$t = (params, encodedAttrs = {}) => {
25661
+ const { nodes } = params;
25662
+ const node = nodes?.[0];
25663
+ const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25664
+ return {
25665
+ type: "attr",
25666
+ xmlName: XML_NODE_NAME$i,
25667
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25668
+ attributes: { "w:val": value ?? null }
25669
+ };
25670
+ };
25671
+ const config$g = {
25672
+ xmlName: XML_NODE_NAME$i,
25673
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25674
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25675
+ encode: encode$t,
25676
+ attributes: validXmlAttributes$b
25677
+ };
25678
+ const translator$W = NodeTranslator.from(config$g);
25679
+ const encode$s = (attributes) => attributes?.["w:val"];
25680
+ const decode$q = (attrs) => attrs?.fontSizeCs;
25681
+ const attrConfig$a = Object.freeze({
25682
+ xmlName: "w:val",
25683
+ sdName: "fontSizeCs",
25684
+ encode: encode$s,
25685
+ decode: decode$q
25686
+ });
25687
+ const validXmlAttributes$a = [attrConfig$a];
25688
+ const XML_NODE_NAME$h = "w:szCs";
25689
+ const SD_ATTR_KEY$6 = "fontSizeCs";
25690
+ const encode$r = (params, encodedAttrs = {}) => {
25691
+ const { nodes } = params;
25692
+ const node = nodes?.[0];
25693
+ const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25694
+ return {
25695
+ type: "attr",
25696
+ xmlName: XML_NODE_NAME$h,
25697
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25698
+ attributes: { "w:val": value ?? null }
25699
+ };
25700
+ };
25701
+ const config$f = {
25702
+ xmlName: XML_NODE_NAME$h,
25703
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25704
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25705
+ encode: encode$r,
25706
+ attributes: validXmlAttributes$a
25707
+ };
25708
+ const translator$V = NodeTranslator.from(config$f);
25709
+ const runPropertyTranslators = Object.freeze({
25710
+ "w:b": translator$11,
25711
+ "w:i": translator$10,
25712
+ "w:u": translator$$,
25713
+ "w:strike": translator$_,
25714
+ "w:color": translator$Z,
25715
+ "w:highlight": translator$14,
25716
+ "w:rFonts": translator$Y,
25717
+ "w:rStyle": translator$X,
25718
+ "w:sz": translator$W,
25719
+ "w:szCs": translator$V
25720
+ });
25721
+ const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25722
+ const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
25723
+ const KNOWN_CHILD_XML_NAMES = /* @__PURE__ */ new Set([...Object.keys(runPropertyTranslators), ...RAW_CHILD_NAME_SET]);
25724
+ const toRunPropertyEntry = (candidate) => {
25725
+ if (!candidate || candidate.type !== "attr") return null;
25726
+ const xmlName = candidate.xmlName || candidate.name;
25727
+ if (!xmlName) return null;
25728
+ return {
25729
+ xmlName,
25730
+ attributes: { ...candidate.attributes || {} }
25731
+ };
25732
+ };
25733
+ const XML_NODE_NAME$g = "w:rPr";
25734
+ const SD_ATTR_KEY$5 = "runProperties";
25735
+ const encode$q = (params) => {
25736
+ const { nodes } = params;
25737
+ const node = nodes?.[0] || {};
25738
+ const contents = Array.isArray(node.elements) ? node.elements : [];
25739
+ const runPropsArray = contents.reduce(
25740
+ (acc, child) => {
25741
+ if (!child || typeof child !== "object") return acc;
25742
+ const xmlName = child.name;
25743
+ if (!KNOWN_CHILD_XML_NAMES.has(xmlName)) return acc;
25744
+ const translator2 = runPropertyTranslators[xmlName];
25745
+ let entry = null;
25746
+ if (translator2) {
25747
+ const encoded = translator2.encode({ ...params, nodes: [child] }) || null;
25748
+ entry = toRunPropertyEntry(encoded);
25749
+ } else if (RAW_CHILD_NAME_SET.has(xmlName)) {
25750
+ entry = toRunPropertyEntry({
25751
+ type: "attr",
25752
+ xmlName,
25753
+ attributes: { ...child.attributes || {} }
25754
+ });
25755
+ }
25756
+ if (entry) acc.push(entry);
25757
+ return acc;
25758
+ },
25759
+ /** @type {{ xmlName: string, attributes: Record<string, any> }[]} */
25760
+ []
25761
+ );
25762
+ return {
25763
+ type: "attr",
25764
+ xmlName: "w:rPr",
25765
+ sdNodeOrKeyName: "runProperties",
25766
+ attributes: runPropsArray
25767
+ };
25768
+ };
25769
+ const config$e = {
25770
+ xmlName: XML_NODE_NAME$g,
25771
+ sdNodeOrKeyName: SD_ATTR_KEY$5,
25772
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25773
+ encode: encode$q
25774
+ };
25775
+ const translator$U = NodeTranslator.from(config$e);
25776
+ 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;
25777
+ const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25778
+ const collectRunProperties = (params, rPrNode, translator2 = translator$U) => {
25779
+ if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25780
+ const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
25781
+ let entries = [];
25782
+ if (Array.isArray(result.attributes) && result.attributes.length) {
25783
+ entries = result.attributes.map((attr) => ({
25784
+ xmlName: attr?.xmlName,
25785
+ attributes: { ...attr?.attributes || {} }
25786
+ }));
25787
+ } else if (Array.isArray(rPrNode.elements) && rPrNode.elements.length) {
25788
+ entries = rPrNode.elements.filter((el) => el && typeof el === "object").map((el) => ({
25789
+ xmlName: el.name,
25790
+ attributes: { ...el.attributes || {} }
25791
+ }));
25792
+ }
25793
+ const legacyMarks = parseMarks(rPrNode, [], params?.docx) || [];
25794
+ const styleChangeMarks = handleStyleChangeMarks(rPrNode, legacyMarks) || [];
25795
+ return { entries, hadRPr: true, styleChangeMarks };
25796
+ };
25797
+ const buildRunAttrs = (encodedAttrs = {}, hadRPr, runProps) => {
25798
+ const base = { ...encodedAttrs || {} };
25799
+ if (hadRPr) {
25800
+ base.runProperties = runProps.length ? runProps : null;
25801
+ }
25802
+ return base;
25803
+ };
25804
+ const ensureInlineMarks = (marks, inlineMarks = []) => {
25805
+ inlineMarks.forEach(({ type: type2, attrs }) => {
25806
+ if (!type2) return;
25807
+ if (marks.some((mark) => mark?.type === type2)) return;
25808
+ marks.push(attrs ? { type: type2, attrs: { ...attrs } } : { type: type2 });
25809
+ });
25810
+ };
25811
+ const ensureTextStyleMark = (marks, textStyleAttrs) => {
25812
+ if (!textStyleAttrs) return;
25813
+ const existingTextStyle = marks.find((mark) => mark?.type === "textStyle");
25814
+ if (existingTextStyle) {
25815
+ existingTextStyle.attrs = { ...existingTextStyle.attrs || {}, ...textStyleAttrs };
25816
+ return;
25817
+ }
25818
+ marks.push({ type: "textStyle", attrs: { ...textStyleAttrs } });
25819
+ };
25820
+ const normalizeTextStyleAttrsForNode = (textStyleAttrs, node) => {
25821
+ if (!textStyleAttrs || typeof textStyleAttrs !== "object") return null;
25822
+ const normalized = { ...textStyleAttrs };
25823
+ const eastAsiaFont = normalized.eastAsiaFontFamily;
25824
+ if (eastAsiaFont) {
25825
+ delete normalized.eastAsiaFontFamily;
25826
+ const text = typeof node?.text === "string" ? node.text : null;
25827
+ const shouldUseEastAsia = typeof text === "string" && containsEastAsianCharacters(text);
25828
+ if (shouldUseEastAsia) {
25829
+ normalized.fontFamily = eastAsiaFont;
25830
+ }
25831
+ }
25832
+ return Object.keys(normalized).length ? normalized : null;
25833
+ };
25834
+ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
25835
+ if (!node || typeof node !== "object") return node;
25836
+ const baseMarks = Array.isArray(node.marks) ? node.marks : [];
25837
+ const marks = baseMarks.map((mark) => cloneMark$1(mark));
25838
+ ensureInlineMarks(marks, inlineMarks);
25839
+ if (node.type === "text") {
25840
+ const normalizedTextStyle = normalizeTextStyleAttrsForNode(textStyleAttrs, node);
25841
+ ensureTextStyleMark(marks, normalizedTextStyle);
25842
+ }
25843
+ return { ...node, marks };
25844
+ };
25845
+ const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
25846
+ const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
25847
+ const runStyleMarks = collectStyleMarks(runStyleId, docx);
25848
+ const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
25849
+ const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
25850
+ return { inlineMarks, textStyleAttrs };
25851
+ };
25852
+ const collectStyleMarks = (styleId, docx, seen = /* @__PURE__ */ new Set()) => {
25853
+ if (!styleId || !docx || seen.has(styleId)) return { inlineMarks: [], textStyleAttrs: null };
25854
+ seen.add(styleId);
25855
+ const chain = collectStyleChain(styleId, docx, seen);
25856
+ if (!chain.length) return { inlineMarks: [], textStyleAttrs: null };
25857
+ const inlineMap = /* @__PURE__ */ new Map();
25858
+ let textStyleAttrs = {};
25859
+ chain.forEach((styleTag) => {
25860
+ const marks = extractMarksFromStyle(styleTag, docx);
25861
+ marks.inlineMarks.forEach((mark) => {
25862
+ inlineMap.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
25863
+ });
25864
+ if (marks.textStyleAttrs) textStyleAttrs = { ...textStyleAttrs, ...marks.textStyleAttrs };
25865
+ });
25866
+ return {
25867
+ inlineMarks: Array.from(inlineMap.values()),
25868
+ textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
25869
+ };
25870
+ };
25871
+ const collectStyleChain = (styleId, docx, seen) => {
25872
+ if (!styleId || !docx) return [];
25873
+ const styleTag = findStyleTag(docx, styleId);
25874
+ if (!styleTag || !styleTag.elements) return [];
25875
+ const basedOn = styleTag.elements?.find((el) => el.name === "w:basedOn")?.attributes?.["w:val"];
25876
+ let chain = [];
25877
+ if (basedOn && !seen.has(basedOn)) {
25878
+ seen.add(basedOn);
25879
+ chain = collectStyleChain(basedOn, docx, seen);
25880
+ }
25881
+ chain.push(styleTag);
25882
+ return chain;
25883
+ };
25884
+ const findStyleTag = (docx, styleId) => {
25885
+ const stylesFile = docx?.["word/styles.xml"];
25886
+ if (!stylesFile?.elements?.length) return null;
25887
+ const candidates = [];
25888
+ stylesFile.elements.forEach((el) => {
25889
+ if (!el) return;
25890
+ if (el.name === "w:styles" && Array.isArray(el.elements)) {
25891
+ el.elements.forEach((child) => {
25892
+ if (child?.name === "w:style") candidates.push(child);
25893
+ });
25894
+ return;
25895
+ }
25896
+ if (el.name === "w:style") {
25897
+ candidates.push(el);
25898
+ return;
25899
+ }
25900
+ if (Array.isArray(el.elements)) {
25901
+ el.elements.forEach((child) => {
25902
+ if (child?.name === "w:style") candidates.push(child);
25903
+ });
25904
+ }
25905
+ });
25906
+ return candidates.find((tag) => tag?.attributes?.["w:styleId"] === styleId) || null;
25907
+ };
25908
+ const extractMarksFromStyle = (styleTag, docx) => {
25909
+ const rPr = styleTag?.elements?.find((el) => el.name === "w:rPr");
25910
+ if (!rPr) return { inlineMarks: [], textStyleAttrs: null };
25911
+ const marks = parseMarks(rPr, [], docx) || [];
25912
+ const inlineMarks = [];
25913
+ let textStyleAttrs = {};
25914
+ marks.forEach((mark) => {
25915
+ if (!mark) return;
25916
+ if (mark.type === "textStyle") {
25917
+ const attrs = mark.attrs || {};
25918
+ if (Object.keys(attrs).length) textStyleAttrs = { ...textStyleAttrs, ...attrs };
25919
+ return;
25920
+ }
25921
+ if (mark.type) inlineMarks.push(mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
25922
+ });
25923
+ return {
25924
+ inlineMarks,
25925
+ textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
25926
+ };
25927
+ };
25928
+ const mergeInlineMarkSets = (...markSets) => {
25929
+ const map = /* @__PURE__ */ new Map();
25930
+ markSets.filter(Boolean).forEach((marks) => {
25931
+ marks.forEach((mark) => {
25932
+ if (!mark || !mark.type) return;
25933
+ map.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
25934
+ });
25935
+ });
25936
+ return Array.from(map.values());
25937
+ };
25938
+ const mergeTextStyleAttrs = (...attrsList) => {
25939
+ const merged = attrsList.filter((attrs) => attrs && Object.keys(attrs).length).reduce((acc, attrs) => ({ ...acc, ...attrs }), {});
25940
+ return Object.keys(merged).length ? merged : null;
25941
+ };
25942
+ const cloneRunAttrs = (attrs) => {
25943
+ const clone = { ...attrs };
25944
+ if (Array.isArray(attrs?.runProperties)) {
25945
+ clone.runProperties = attrs.runProperties.map((entry) => ({
25946
+ xmlName: entry?.xmlName,
25947
+ attributes: { ...entry?.attributes || {} }
25948
+ }));
25949
+ }
25950
+ return clone;
25951
+ };
25952
+ const cloneMark$1 = (mark) => {
25953
+ if (!mark || typeof mark !== "object") return mark;
25954
+ const cloned = { ...mark };
25955
+ if (mark.attrs && typeof mark.attrs === "object") {
25956
+ cloned.attrs = { ...mark.attrs };
25957
+ if (Array.isArray(mark.attrs.runProperties)) {
25958
+ cloned.attrs.runProperties = mark.attrs.runProperties.map((entry) => ({
25959
+ xmlName: entry?.xmlName,
25960
+ attributes: { ...entry?.attributes || {} }
25961
+ }));
25962
+ }
25963
+ }
25964
+ return cloned;
25965
+ };
25966
+ const normalizeBool = (value) => {
25967
+ if (value === void 0 || value === null) return true;
25968
+ if (typeof value === "boolean") return value;
25969
+ if (typeof value === "number") return value !== 0;
25970
+ const normalized = String(value).trim().toLowerCase();
25971
+ if (normalized === "0" || normalized === "false" || normalized === "off") return false;
25972
+ if (normalized === "1" || normalized === "true" || normalized === "on") return true;
25973
+ return true;
25974
+ };
25975
+ const createRunPropertiesElement = (entries = []) => {
25976
+ if (!Array.isArray(entries) || !entries.length) return null;
25977
+ const elements = entries.map((entry) => {
25978
+ if (!entry || !entry.xmlName) return null;
25979
+ return {
25980
+ name: entry.xmlName,
25981
+ attributes: { ...entry.attributes || {} }
25982
+ };
25983
+ }).filter(Boolean);
25984
+ if (!elements.length) return null;
25985
+ return {
25986
+ name: "w:rPr",
25987
+ elements
25988
+ };
25989
+ };
25990
+ const cloneXmlNode = (nodeLike) => {
25991
+ if (!nodeLike || typeof nodeLike !== "object") return nodeLike;
25992
+ return {
25993
+ name: nodeLike.name,
25994
+ type: nodeLike.type,
25995
+ attributes: nodeLike.attributes ? { ...nodeLike.attributes } : void 0,
25996
+ elements: Array.isArray(nodeLike.elements) ? nodeLike.elements.map((el) => cloneXmlNode(el)) : void 0,
25997
+ text: nodeLike.text
25998
+ };
25999
+ };
26000
+ const applyRunPropertiesTemplate = (runNode, runPropertiesTemplate) => {
26001
+ if (!runNode || !runPropertiesTemplate) return;
26002
+ if (!Array.isArray(runNode.elements)) runNode.elements = [];
26003
+ let runProps = runNode.elements.find((el) => el?.name === "w:rPr");
26004
+ if (!runProps) {
26005
+ runProps = { name: "w:rPr", elements: [] };
26006
+ runNode.elements.unshift(runProps);
26007
+ }
26008
+ if (!Array.isArray(runProps.elements)) runProps.elements = [];
26009
+ if (runPropertiesTemplate.attributes) {
26010
+ runProps.attributes = {
26011
+ ...runProps.attributes || {},
26012
+ ...runPropertiesTemplate.attributes
26013
+ };
26014
+ }
26015
+ const isValidRunPropName = (name) => typeof name === "string" && name.includes(":");
26016
+ runProps.elements = runProps.elements.filter((entry) => isValidRunPropName(entry?.name));
26017
+ const existingNames = new Set(runProps.elements.map((el) => el?.name));
26018
+ (runPropertiesTemplate.elements || []).forEach((entry) => {
26019
+ if (!isValidRunPropName(entry?.name) || existingNames.has(entry.name)) return;
26020
+ runProps.elements.push(cloneXmlNode(entry));
26021
+ existingNames.add(entry.name);
26022
+ });
26023
+ };
26024
+ const splitRunProperties = (entries = [], docx = null) => {
26025
+ const remainingProps = [];
26026
+ const inlineMarks = [];
26027
+ const textStyleAttrs = {};
26028
+ let hasTextStyle = false;
26029
+ let highlightColor = null;
26030
+ let runStyleId = null;
26031
+ entries.forEach((entry) => {
26032
+ if (!entry || !entry.xmlName) return;
26033
+ const attributes = entry.attributes || {};
26034
+ switch (entry.xmlName) {
26035
+ case "w:b": {
26036
+ const val = normalizeBool(attributes["w:val"]);
26037
+ inlineMarks.push(val ? { type: "bold" } : { type: "bold", attrs: { value: "0" } });
26038
+ break;
26039
+ }
26040
+ case "w:i": {
26041
+ const val = normalizeBool(attributes["w:val"]);
26042
+ inlineMarks.push(val ? { type: "italic" } : { type: "italic", attrs: { value: "0" } });
26043
+ break;
26044
+ }
26045
+ case "w:u": {
26046
+ const rawVal = attributes["w:val"];
26047
+ const underlineType = rawVal == null || rawVal === "" ? "single" : String(rawVal);
26048
+ const attrs = {};
26049
+ if (underlineType.toLowerCase() === "none" || underlineType === "0") {
26050
+ attrs.underlineType = "none";
26051
+ } else {
26052
+ attrs.underlineType = underlineType;
26053
+ const colorRaw = attributes["w:color"];
26054
+ if (typeof colorRaw === "string" && colorRaw.toLowerCase() !== "auto") {
26055
+ const normalizedColor = normalizeHexColor(colorRaw);
26056
+ if (normalizedColor) attrs.underlineColor = `#${normalizedColor}`;
26057
+ }
26058
+ }
26059
+ if (attributes["w:themeColor"]) attrs.underlineThemeColor = attributes["w:themeColor"];
26060
+ if (attributes["w:themeTint"]) attrs.underlineThemeTint = attributes["w:themeTint"];
26061
+ if (attributes["w:themeShade"]) attrs.underlineThemeShade = attributes["w:themeShade"];
26062
+ inlineMarks.push({ type: "underline", attrs });
26063
+ break;
26064
+ }
26065
+ case "w:color": {
26066
+ const raw = attributes["w:val"];
26067
+ if (typeof raw === "string" && raw) {
26068
+ hasTextStyle = true;
26069
+ textStyleAttrs.color = `#${raw.replace("#", "").toUpperCase()}`;
26070
+ }
26071
+ break;
26072
+ }
26073
+ case "w:rFonts": {
26074
+ const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
26075
+ const eastAsiaFamily = attributes["w:eastAsia"];
26076
+ if (asciiFamily) {
26077
+ hasTextStyle = true;
26078
+ textStyleAttrs.fontFamily = SuperConverter.toCssFontFamily(asciiFamily, docx);
26079
+ }
26080
+ if (eastAsiaFamily) {
26081
+ hasTextStyle = true;
26082
+ const eastAsiaCss = SuperConverter.toCssFontFamily(eastAsiaFamily, docx);
26083
+ if (!asciiFamily || eastAsiaCss !== textStyleAttrs.fontFamily) {
26084
+ textStyleAttrs.eastAsiaFontFamily = eastAsiaCss;
26085
+ }
26086
+ }
26087
+ break;
26088
+ }
26089
+ case "w:sz":
26090
+ case "w:szCs": {
26091
+ const rawSize = Number(attributes["w:val"]);
26092
+ if (Number.isFinite(rawSize) && rawSize > 0) {
26093
+ hasTextStyle = true;
26094
+ textStyleAttrs.fontSize = `${rawSize / 2}pt`;
26095
+ }
26096
+ break;
26097
+ }
26098
+ case "w:strike": {
26099
+ const val = normalizeBool(attributes["w:val"]);
26100
+ inlineMarks.push(val ? { type: "strike" } : { type: "strike", attrs: { value: "0" } });
26101
+ break;
26102
+ }
26103
+ case "w:highlight": {
26104
+ const color = attributes["w:val"];
26105
+ if (typeof color === "string" && color) {
26106
+ highlightColor = color.toLowerCase() === "none" ? "transparent" : color;
26107
+ }
26108
+ break;
26109
+ }
26110
+ case "w:shd": {
26111
+ const fill = attributes["w:fill"];
26112
+ const shdVal = attributes["w:val"];
26113
+ if (fill && String(fill).toLowerCase() !== "auto") {
26114
+ highlightColor = `#${String(fill).replace("#", "")}`;
26115
+ } else if (typeof shdVal === "string") {
26116
+ const normalized = shdVal.toLowerCase();
26117
+ if (normalized === "clear" || normalized === "nil" || normalized === "none") {
26118
+ highlightColor = "transparent";
26119
+ }
26120
+ }
26121
+ break;
26122
+ }
26123
+ case "w:rStyle": {
26124
+ if (typeof attributes["w:val"] === "string") runStyleId = attributes["w:val"];
26125
+ remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
26126
+ break;
26127
+ }
26128
+ default: {
26129
+ remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
26130
+ }
26131
+ }
26132
+ });
26133
+ if (highlightColor) inlineMarks.push({ type: "highlight", attrs: { color: highlightColor } });
26134
+ return {
26135
+ remainingProps,
26136
+ inlineMarks,
26137
+ textStyleAttrs: hasTextStyle ? textStyleAttrs : null,
26138
+ runStyleId
26139
+ };
26140
+ };
26141
+ const cloneMark = (mark) => {
26142
+ if (!mark) return mark;
26143
+ return {
26144
+ ...mark,
26145
+ attrs: mark.attrs ? { ...mark.attrs } : void 0
26146
+ };
26147
+ };
26148
+ const cloneNode = (node) => {
26149
+ if (!node || typeof node !== "object") return node;
26150
+ const cloned = { ...node };
26151
+ if (node.marks) cloned.marks = node.marks.map((mark) => cloneMark(mark));
26152
+ if (node.content) cloned.content = node.content.map((child) => cloneNode(child));
26153
+ if (node.elements) cloned.elements = node.elements.map((el) => cloneNode(el));
26154
+ if (node.attributes) cloned.attributes = { ...node.attributes };
26155
+ return cloned;
26156
+ };
26157
+ const cloneRuns = (runs = []) => runs.map((run2) => cloneNode(run2));
26158
+ const prepareRunTrackingContext = (node = {}) => {
26159
+ const marks = Array.isArray(node.marks) ? node.marks : [];
26160
+ const trackingMarks = marks.filter(
26161
+ (mark) => mark?.type === TrackInsertMarkName || mark?.type === TrackDeleteMarkName
26162
+ );
26163
+ if (!trackingMarks.length) {
26164
+ return { runNode: node, trackingMarksByType: /* @__PURE__ */ new Map() };
26165
+ }
26166
+ const trackingMarksByType = /* @__PURE__ */ new Map();
26167
+ trackingMarks.forEach((mark) => {
26168
+ if (mark?.type) trackingMarksByType.set(mark.type, cloneMark(mark));
26169
+ });
26170
+ const preservedMarks = marks.filter((mark) => mark?.type !== TrackInsertMarkName && mark?.type !== TrackDeleteMarkName).map((mark) => cloneMark(mark));
26171
+ const clonedContent = Array.isArray(node.content) ? node.content.map((child) => {
26172
+ const childClone = cloneNode(child);
26173
+ const childMarks = Array.isArray(childClone.marks) ? childClone.marks.slice() : [];
26174
+ trackingMarks.forEach((mark) => {
26175
+ childMarks.push(cloneMark(mark));
26176
+ });
26177
+ childClone.marks = childMarks;
26178
+ return childClone;
26179
+ }) : [];
26180
+ return {
26181
+ runNode: {
26182
+ ...cloneNode(node),
26183
+ marks: preservedMarks,
26184
+ content: clonedContent
26185
+ },
26186
+ trackingMarksByType
26187
+ };
26188
+ };
26189
+ const mapTrackingAttrs = (mark, attrMap) => {
26190
+ const source = mark?.attrs || {};
26191
+ const mapped = {};
26192
+ attrMap.forEach((targetKey, sourceKey) => {
26193
+ if (source[sourceKey] != null) mapped[targetKey] = source[sourceKey];
26194
+ });
26195
+ return mapped;
26196
+ };
26197
+ const renameTextElementsForDeletion = (node) => {
26198
+ if (!node || typeof node !== "object") return;
26199
+ if (node.name === "w:t") node.name = "w:delText";
26200
+ if (Array.isArray(node.elements)) node.elements.forEach(renameTextElementsForDeletion);
26201
+ };
26202
+ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Map()) => {
26203
+ if (!Array.isArray(runs) || !runs.length) return runs;
26204
+ const firstRun = runs[0];
26205
+ if (firstRun?.name === "w:ins" || firstRun?.name === "w:del") {
26206
+ return runs;
26207
+ }
26208
+ if (!trackingMarksByType.size) return runs;
26209
+ if (trackingMarksByType.has(TrackInsertMarkName)) {
26210
+ const mark = trackingMarksByType.get(TrackInsertMarkName);
26211
+ const clonedRuns = cloneRuns(runs);
26212
+ const wrapper = {
26213
+ name: "w:ins",
26214
+ attributes: mapTrackingAttrs(
26215
+ mark,
26216
+ /* @__PURE__ */ new Map([
26217
+ ["id", "w:id"],
26218
+ ["author", "w:author"],
26219
+ ["authorEmail", "w:authorEmail"],
26220
+ ["date", "w:date"]
26221
+ ])
26222
+ ),
26223
+ elements: clonedRuns
26224
+ };
26225
+ return [wrapper];
26226
+ }
26227
+ if (trackingMarksByType.has(TrackDeleteMarkName)) {
26228
+ const mark = trackingMarksByType.get(TrackDeleteMarkName);
26229
+ const clonedRuns = cloneRuns(runs);
26230
+ clonedRuns.forEach(renameTextElementsForDeletion);
26231
+ const wrapper = {
26232
+ name: "w:del",
26233
+ attributes: mapTrackingAttrs(mark, /* @__PURE__ */ new Map([["id", "w:id"]])),
26234
+ elements: clonedRuns
26235
+ };
26236
+ return [wrapper];
26237
+ }
26238
+ return runs;
26239
+ };
26240
+ const encode$p = (attributes) => {
26241
+ return attributes["w:rsidR"];
26242
+ };
26243
+ const decode$p = (attrs) => {
26244
+ return attrs.rsidR;
26245
+ };
26246
+ const attrConfig$9 = Object.freeze({
26247
+ xmlName: "w:rsidR",
26248
+ sdName: "rsidR",
26249
+ encode: encode$p,
26250
+ decode: decode$p
26251
+ });
26252
+ const encode$o = (attributes) => {
26253
+ return attributes["w:rsidRPr"];
26254
+ };
26255
+ const decode$o = (attrs) => {
26256
+ return attrs.rsidRPr;
26257
+ };
26258
+ const attrConfig$8 = Object.freeze({
26259
+ xmlName: "w:rsidRPr",
26260
+ sdName: "rsidRPr",
26261
+ encode: encode$o,
26262
+ decode: decode$o
26263
+ });
26264
+ const encode$n = (attributes) => {
26265
+ return attributes["w:rsidDel"];
26266
+ };
26267
+ const decode$n = (attrs) => {
26268
+ return attrs.rsidDel;
26269
+ };
26270
+ const attrConfig$7 = Object.freeze({
26271
+ xmlName: "w:rsidDel",
26272
+ sdName: "rsidDel",
26273
+ encode: encode$n,
26274
+ decode: decode$n
26275
+ });
26276
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26277
+ const XML_NODE_NAME$f = "w:r";
26278
+ const SD_KEY_NAME = "run";
26279
+ const encode$m = (params, encodedAttrs = {}) => {
26280
+ const { nodes = [], nodeListHandler } = params || {};
26281
+ const runNode = nodes[0];
26282
+ if (!runNode) return void 0;
26283
+ const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
26284
+ const rPrNode = elements.find((child) => child?.name === "w:rPr");
26285
+ const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
26286
+ const { entries: runPropEntries, hadRPr, styleChangeMarks } = collectRunProperties(params, rPrNode);
26287
+ const { remainingProps, inlineMarks, textStyleAttrs, runStyleId } = splitRunProperties(runPropEntries, params?.docx);
26288
+ const styleMarks = deriveStyleMarks({
26289
+ docx: params?.docx,
26290
+ paragraphStyleId: params?.parentStyleId,
26291
+ runStyleId
26292
+ });
26293
+ const mergedInlineMarks = mergeInlineMarkSets(styleMarks.inlineMarks, inlineMarks);
26294
+ let mergedTextStyleAttrs = mergeTextStyleAttrs(styleMarks.textStyleAttrs, textStyleAttrs);
26295
+ if (runStyleId) {
26296
+ mergedTextStyleAttrs = mergedTextStyleAttrs ? { ...mergedTextStyleAttrs, styleId: runStyleId } : { styleId: runStyleId };
26297
+ }
26298
+ const runAttrs = buildRunAttrs(encodedAttrs, hadRPr, remainingProps);
26299
+ let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark$1(mark)) : [];
26300
+ if (styleChangeMarks?.length) {
26301
+ runLevelMarks = [...runLevelMarks, ...styleChangeMarks.map((mark) => cloneMark$1(mark))];
26302
+ }
26303
+ const childParams = { ...params, nodes: contentElements };
26304
+ const content = nodeListHandler?.handler(childParams) || [];
26305
+ const contentWithRunMarks = content.map((child) => {
26306
+ if (!child || typeof child !== "object") return child;
26307
+ const baseMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark$1(mark)) : [];
26308
+ if (!runLevelMarks.length) return child;
26309
+ return { ...child, marks: [...baseMarks, ...runLevelMarks.map((mark) => cloneMark$1(mark))] };
26310
+ });
26311
+ const marked = contentWithRunMarks.map((child) => applyRunMarks(child, mergedInlineMarks, mergedTextStyleAttrs));
26312
+ const filtered = marked.filter(Boolean);
26313
+ const runNodeResult = {
26314
+ type: SD_KEY_NAME,
26315
+ content: filtered
26316
+ };
26317
+ const attrs = cloneRunAttrs(runAttrs);
26318
+ if (attrs && Object.keys(attrs).length) {
26319
+ if (attrs.runProperties == null) delete attrs.runProperties;
26320
+ if (Object.keys(attrs).length) runNodeResult.attrs = attrs;
26321
+ }
26322
+ if (runLevelMarks.length) {
26323
+ runNodeResult.marks = runLevelMarks.map((mark) => cloneMark$1(mark));
26324
+ }
26325
+ return runNodeResult;
26326
+ };
26327
+ const decode$m = (params, decodedAttrs = {}) => {
26328
+ const { node } = params || {};
26329
+ if (!node) return void 0;
26330
+ const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26331
+ const runAttrs = runNodeForExport.attrs || {};
26332
+ const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
26333
+ const exportParams = { ...params, node: runNodeForExport };
26334
+ if (!exportParams.editor) {
26335
+ exportParams.editor = { extensionService: { extensions: [] } };
26336
+ }
26337
+ const childElements = translateChildNodes(exportParams) || [];
26338
+ let runPropertiesElement = createRunPropertiesElement(runProperties);
26339
+ const markElements = processOutputMarks(Array.isArray(runNodeForExport.marks) ? runNodeForExport.marks : []);
26340
+ if (markElements.length) {
26341
+ if (!runPropertiesElement) {
26342
+ runPropertiesElement = generateRunProps(markElements);
26343
+ } else {
26344
+ if (!Array.isArray(runPropertiesElement.elements)) runPropertiesElement.elements = [];
26345
+ const existingNames = new Set(
26346
+ runPropertiesElement.elements.map((el) => el?.name).filter((name) => typeof name === "string")
26347
+ );
26348
+ markElements.forEach((element) => {
26349
+ if (!element || !element.name || existingNames.has(element.name)) return;
26350
+ runPropertiesElement.elements.push({ ...element, attributes: { ...element.attributes || {} } });
26351
+ existingNames.add(element.name);
26352
+ });
26353
+ }
26354
+ }
26355
+ const runPropsTemplate = runPropertiesElement ? cloneXmlNode(runPropertiesElement) : null;
26356
+ const applyBaseRunProps = (runNode) => applyRunPropertiesTemplate(runNode, runPropsTemplate);
26357
+ const runs = [];
26358
+ childElements.forEach((child) => {
26359
+ if (!child) return;
26360
+ if (child.name === "w:r") {
26361
+ const clonedRun = cloneXmlNode(child);
26362
+ applyBaseRunProps(clonedRun);
26363
+ runs.push(clonedRun);
26364
+ return;
26365
+ }
26366
+ if (child.name === "w:hyperlink") {
26367
+ const hyperlinkClone = cloneXmlNode(child);
26368
+ if (Array.isArray(hyperlinkClone.elements)) {
26369
+ hyperlinkClone.elements.forEach((run2) => applyBaseRunProps(run2));
26370
+ }
26371
+ runs.push(hyperlinkClone);
26372
+ return;
26373
+ }
26374
+ if (child.name === "w:ins" || child.name === "w:del") {
26375
+ const trackedClone = cloneXmlNode(child);
26376
+ if (Array.isArray(trackedClone.elements)) {
26377
+ trackedClone.elements.forEach((element) => {
26378
+ if (element?.name === "w:r") applyBaseRunProps(element);
26379
+ });
26380
+ }
26381
+ runs.push(trackedClone);
26382
+ return;
26383
+ }
26384
+ const runWrapper = { name: XML_NODE_NAME$f, elements: [] };
26385
+ applyBaseRunProps(runWrapper);
26386
+ if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26387
+ runWrapper.elements.push(cloneXmlNode(child));
26388
+ runs.push(runWrapper);
26389
+ });
26390
+ const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26391
+ if (!trackedRuns.length) {
26392
+ const emptyRun = { name: XML_NODE_NAME$f, elements: [] };
26393
+ applyBaseRunProps(emptyRun);
26394
+ trackedRuns.push(emptyRun);
26395
+ }
26396
+ if (decodedAttrs && Object.keys(decodedAttrs).length) {
26397
+ trackedRuns.forEach((run2) => {
26398
+ run2.attributes = { ...run2.attributes || {}, ...decodedAttrs };
26399
+ });
26400
+ }
26401
+ if (trackedRuns.length === 1) {
26402
+ return trackedRuns[0];
26403
+ }
26404
+ return trackedRuns;
26405
+ };
26406
+ const config$d = {
26407
+ xmlName: XML_NODE_NAME$f,
26408
+ sdNodeOrKeyName: SD_KEY_NAME,
26409
+ type: NodeTranslator.translatorTypes.NODE,
26410
+ encode: encode$m,
26411
+ decode: decode$m,
26412
+ attributes: validXmlAttributes$9
26413
+ };
26414
+ const translator$T = NodeTranslator.from(config$d);
26415
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
26416
+ handlerName,
26417
+ handler: (params) => {
26418
+ const { nodes } = params;
26419
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
26420
+ return { nodes: [], consumed: 0 };
26421
+ }
26422
+ const result = translator2.encode(params);
26423
+ if (!result) return { nodes: [], consumed: 0 };
26424
+ return {
26425
+ nodes: Array.isArray(result) ? result : [result],
26426
+ consumed: 1
26427
+ };
26428
+ }
26429
+ });
26430
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
26431
+ if (!sdName) sdName = xmlName.split(":")[1];
26432
+ if (!transformEncode) transformEncode = (v2) => v2;
26433
+ if (!transformDecode) transformDecode = (v2) => v2;
26434
+ return {
26435
+ xmlName,
26436
+ sdNodeOrKeyName: sdName,
26437
+ encode: ({ nodes }) => {
26438
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
26439
+ },
26440
+ decode: ({ node }) => {
26441
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
26442
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
26443
+ }
26444
+ };
26445
+ }
26446
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
26447
+ if (!sdName) sdName = xmlName.split(":")[1];
26448
+ return {
26449
+ xmlName,
26450
+ sdNodeOrKeyName: sdName,
26451
+ attributes: [
26452
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
26453
+ createAttributeHandler("w:type")
26454
+ ],
26455
+ encode: (_2, encodedAttrs) => {
26456
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
26457
+ },
26458
+ decode: function({ node }) {
26459
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26460
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
26461
+ }
26462
+ };
26463
+ }
26464
+ function createBorderPropertyHandler(xmlName, sdName = null) {
26465
+ if (!sdName) sdName = xmlName.split(":")[1];
26466
+ return {
26467
+ xmlName,
26468
+ sdNodeOrKeyName: sdName,
26469
+ attributes: [
26470
+ createAttributeHandler("w:val"),
26471
+ createAttributeHandler("w:color"),
26472
+ createAttributeHandler("w:themeColor"),
26473
+ createAttributeHandler("w:themeTint"),
26474
+ createAttributeHandler("w:themeShade"),
26475
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
26476
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
26477
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
26478
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
26479
+ ],
26480
+ encode: (params, encodedAttrs) => {
26481
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
26482
+ },
26483
+ decode: function({ node }, context) {
26484
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26485
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26486
+ }
26487
+ };
26488
+ }
26489
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
26490
+ if (!transformEncode) transformEncode = (v2) => v2;
26491
+ if (!transformDecode) transformDecode = (v2) => v2;
26492
+ if (!sdName) sdName = xmlName.split(":")[1];
26493
+ return {
26494
+ xmlName,
26495
+ sdName,
26496
+ encode: (attributes) => transformEncode(attributes[xmlName]),
26497
+ decode: (attributes) => transformDecode(attributes[sdName])
26498
+ };
26499
+ };
26500
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
26501
+ if (!node?.elements || node.elements.length === 0) {
26502
+ return asArray ? [] : {};
26503
+ }
26504
+ const attributes = asArray ? [] : {};
26505
+ node.elements.forEach((el) => {
26506
+ const translator2 = translatorsByXmlName[el.name];
26507
+ if (translator2) {
26508
+ const encodedAttr = translator2.encode({ nodes: [el] });
26509
+ if (encodedAttr != null) {
26510
+ if (asArray) {
26511
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
26512
+ } else {
26513
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
26514
+ }
26515
+ }
26516
+ }
26517
+ });
26518
+ return attributes;
26519
+ }
26520
+ function decodeProperties(translatorsBySdName, properties) {
26521
+ if (!properties || typeof properties !== "object") {
26522
+ return [];
26523
+ }
26524
+ const elements = [];
26525
+ Object.keys(properties).forEach((key) => {
26526
+ const translator2 = translatorsBySdName[key];
26527
+ if (translator2) {
26528
+ const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
26529
+ if (result != null) {
26530
+ result.name = translator2.xmlName;
26531
+ elements.push(result);
26532
+ }
26533
+ }
26534
+ });
26535
+ return elements;
26536
+ }
26537
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
26538
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
26539
+ const parseInteger = (value) => {
26540
+ if (value == null) return void 0;
26541
+ const intValue = parseInt(value, 10);
26542
+ return isNaN(intValue) ? void 0 : intValue;
26543
+ };
26544
+ const integerToString = (value) => {
26545
+ const intValue = parseInteger(value);
26546
+ return intValue != void 0 ? String(intValue) : void 0;
26547
+ };
26548
+ function preProcessVerticalMergeCells(table, { editorSchema }) {
26549
+ if (!table || !Array.isArray(table.content)) {
26550
+ return table;
26551
+ }
26552
+ const rows = table.content;
26553
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
26554
+ const row = rows[rowIndex];
26555
+ if (!row) continue;
26556
+ if (!Array.isArray(row.content)) {
26557
+ row.content = [];
26558
+ }
26559
+ for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
26560
+ const cell = row.content[cellIndex];
26561
+ if (!cell) continue;
26562
+ const attrs = cell.attrs || {};
26563
+ if (!attrs.rowspan || attrs.rowspan <= 1) continue;
26564
+ const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
25302
26565
  for (let offset = 1; offset < maxRowspan; offset++) {
25303
26566
  const rowToChange = rows[rowIndex + offset];
25304
26567
  if (!rowToChange) continue;
@@ -26520,17 +27783,52 @@ const encode$d = (params, encodedAttrs) => {
26520
27783
  const { nodes, docx, nodeListHandler } = params;
26521
27784
  const node = nodes[0];
26522
27785
  let href = _resolveHref(docx, encodedAttrs);
26523
- const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
27786
+ const linkMark = { attrs: { ...encodedAttrs, href } };
26524
27787
  const runNodes = node.elements.filter((el) => el.name === "w:r");
26525
27788
  runNodes.forEach((runNode) => {
26526
- runNode.marks = [...runNode.marks || [], linkMark];
27789
+ const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
27790
+ const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
27791
+ runNode.marks = runMarksWithoutLink;
26527
27792
  });
26528
27793
  const updatedNode = nodeListHandler.handler({
26529
27794
  ...params,
26530
27795
  nodes: runNodes,
26531
27796
  path: [...params.path || [], node]
26532
27797
  });
26533
- return updatedNode;
27798
+ const cloneMark2 = (mark) => {
27799
+ if (!mark || typeof mark !== "object") return mark;
27800
+ if (!mark.attrs) return { ...mark };
27801
+ return { ...mark, attrs: { ...mark.attrs } };
27802
+ };
27803
+ const ensureLinkMark = (child) => {
27804
+ if (!child || typeof child !== "object") return child;
27805
+ if (Array.isArray(child.content)) {
27806
+ const updatedContent = child.content.map((item) => ensureLinkMark(item));
27807
+ if (updatedContent !== child.content) {
27808
+ child = { ...child, content: updatedContent };
27809
+ }
27810
+ }
27811
+ if (child.type === "run") {
27812
+ const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
27813
+ const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
27814
+ if (filteredMarks.length !== existingMarks2.length) {
27815
+ if (filteredMarks.length) child = { ...child, marks: filteredMarks };
27816
+ else {
27817
+ const { marks, ...rest } = child;
27818
+ child = rest;
27819
+ }
27820
+ }
27821
+ return child;
27822
+ }
27823
+ if (child.type !== "text") return child;
27824
+ const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
27825
+ const hasLink = existingMarks.some((mark) => mark?.type === "link");
27826
+ if (hasLink) return child;
27827
+ const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
27828
+ return { ...child, marks: [...existingMarks, linkClone] };
27829
+ };
27830
+ if (!Array.isArray(updatedNode)) return updatedNode;
27831
+ return updatedNode.map((child) => ensureLinkMark(child));
26534
27832
  };
26535
27833
  const _resolveHref = (docx, encodedAttrs) => {
26536
27834
  const rels = docx["word/_rels/document.xml.rels"];
@@ -27412,225 +28710,79 @@ function decode$c(params) {
27412
28710
  return translateAnchorNode(params);
27413
28711
  }
27414
28712
  const config$5 = {
27415
- xmlName: XML_NODE_NAME$5,
27416
- sdNodeOrKeyName: SD_NODE_NAME$5,
27417
- type: NodeTranslator.translatorTypes.NODE,
27418
- encode: encode$c,
27419
- decode: decode$c,
27420
- attributes: validXmlAttributes$5
27421
- };
27422
- const translator$5 = NodeTranslator.from(config$5);
27423
- function handleInlineNode(params) {
27424
- const { node } = params.extraParams;
27425
- if (node.name !== "wp:inline") {
27426
- return null;
27427
- }
27428
- return handleImageNode(node, params, false);
27429
- }
27430
- function translateInlineNode(params) {
27431
- const nodeElements = translateImageNode(params);
27432
- return {
27433
- name: "wp:inline",
27434
- attributes: nodeElements.attributes,
27435
- elements: nodeElements.elements
27436
- };
27437
- }
27438
- const XML_NODE_NAME$4 = "wp:inline";
27439
- const SD_NODE_NAME$4 = ["image"];
27440
- const validXmlAttributes$4 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
27441
- function encode$b(params) {
27442
- const { node } = params.extraParams;
27443
- if (!node || !node.type) {
27444
- return null;
27445
- }
27446
- return handleInlineNode(params);
27447
- }
27448
- function decode$b(params) {
27449
- const { node } = params;
27450
- if (!node || !node.type) {
27451
- return null;
27452
- }
27453
- return translateInlineNode(params);
27454
- }
27455
- const config$4 = {
27456
- xmlName: XML_NODE_NAME$4,
27457
- sdNodeOrKeyName: SD_NODE_NAME$4,
27458
- type: NodeTranslator.translatorTypes.NODE,
27459
- encode: encode$b,
27460
- decode: decode$b,
27461
- attributes: validXmlAttributes$4
27462
- };
27463
- const translator$4 = NodeTranslator.from(config$4);
27464
- const encode$a = (attributes) => {
27465
- return attributes["w:id"];
27466
- };
27467
- const decode$a = (attrs) => {
27468
- return attrs.id;
27469
- };
27470
- const attrConfig$6 = Object.freeze({
27471
- xmlName: "w:id",
27472
- sdName: "id",
27473
- encode: encode$a,
27474
- decode: decode$a
27475
- });
27476
- const encode$9 = (attributes) => {
27477
- return attributes["w:name"];
27478
- };
27479
- const decode$9 = (attrs) => {
27480
- return attrs.name;
27481
- };
27482
- const attrConfig$5 = Object.freeze({
27483
- xmlName: "w:name",
27484
- sdName: "name",
27485
- encode: encode$9,
27486
- decode: decode$9
27487
- });
27488
- const encode$8 = (attributes) => {
27489
- return attributes["w:colFirst"];
27490
- };
27491
- const decode$8 = (attrs) => {
27492
- return attrs.colFirst;
27493
- };
27494
- const attrConfig$4 = Object.freeze({
27495
- xmlName: "w:colFirst",
27496
- sdName: "colFirst",
27497
- encode: encode$8,
27498
- decode: decode$8
27499
- });
27500
- const encode$7 = (attributes) => {
27501
- return attributes["w:colLast"];
27502
- };
27503
- const decode$7 = (attrs) => {
27504
- return attrs.colLast;
27505
- };
27506
- const attrConfig$3 = Object.freeze({
27507
- xmlName: "w:colLast",
27508
- sdName: "colLast",
27509
- encode: encode$7,
27510
- decode: decode$7
27511
- });
27512
- const encode$6 = (attributes) => {
27513
- return attributes["w:displacedByCustomXml"];
27514
- };
27515
- const decode$6 = (attrs) => {
27516
- return attrs.displacedByCustomXml;
27517
- };
27518
- const attrConfig$2 = Object.freeze({
27519
- xmlName: "w:displacedByCustomXml",
27520
- sdName: "displacedByCustomXml",
27521
- encode: encode$6,
27522
- decode: decode$6
27523
- });
27524
- const validXmlAttributes$3 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
27525
- const XML_NODE_NAME$3 = "w:bookmarkStart";
27526
- const SD_NODE_NAME$3 = "bookmarkStart";
27527
- const encode$5 = (params, encodedAttrs = {}) => {
27528
- return {
27529
- type: "bookmarkStart",
27530
- attrs: encodedAttrs
27531
- };
27532
- };
27533
- const decode$5 = (params, decodedAttrs = {}) => {
27534
- const result = {
27535
- name: "w:bookmarkStart",
27536
- elements: []
27537
- };
27538
- if (decodedAttrs && Object.keys(decodedAttrs).length) {
27539
- result.attributes = decodedAttrs;
27540
- }
27541
- return result;
27542
- };
27543
- const config$3 = {
27544
- xmlName: XML_NODE_NAME$3,
27545
- sdNodeOrKeyName: SD_NODE_NAME$3,
27546
- type: NodeTranslator.translatorTypes.NODE,
27547
- encode: encode$5,
27548
- decode: decode$5,
27549
- attributes: validXmlAttributes$3
27550
- };
27551
- const translator$3 = NodeTranslator.from(config$3);
27552
- const encode$4 = (attributes) => {
27553
- return attributes["w:id"];
27554
- };
27555
- const decode$4 = (attrs) => {
27556
- return attrs.id;
27557
- };
27558
- const attrConfig$1 = Object.freeze({
27559
- xmlName: "w:id",
27560
- sdName: "id",
27561
- encode: encode$4,
27562
- decode: decode$4
27563
- });
27564
- const encode$3 = (attributes) => {
27565
- return attributes["w:displacedByCustomXml"];
27566
- };
27567
- const decode$3 = (attrs) => {
27568
- return attrs.displacedByCustomXml;
27569
- };
27570
- const attrConfig = Object.freeze({
27571
- xmlName: "w:displacedByCustomXml",
27572
- sdName: "displacedByCustomXml",
27573
- encode: encode$3,
27574
- decode: decode$3
27575
- });
27576
- const validXmlAttributes$2 = [attrConfig$1, attrConfig];
27577
- const XML_NODE_NAME$2 = "w:bookmarkEnd";
27578
- const SD_NODE_NAME$2 = "bookmarkEnd";
27579
- const encode$2 = (params, encodedAttrs = {}) => {
27580
- return {
27581
- type: "bookmarkEnd",
27582
- attrs: encodedAttrs
27583
- };
28713
+ xmlName: XML_NODE_NAME$5,
28714
+ sdNodeOrKeyName: SD_NODE_NAME$5,
28715
+ type: NodeTranslator.translatorTypes.NODE,
28716
+ encode: encode$c,
28717
+ decode: decode$c,
28718
+ attributes: validXmlAttributes$5
27584
28719
  };
27585
- const decode$2 = (params, decodedAttrs = {}) => {
27586
- const result = {
27587
- name: "w:bookmarkEnd",
27588
- elements: []
28720
+ const translator$5 = NodeTranslator.from(config$5);
28721
+ function handleInlineNode(params) {
28722
+ const { node } = params.extraParams;
28723
+ if (node.name !== "wp:inline") {
28724
+ return null;
28725
+ }
28726
+ return handleImageNode(node, params, false);
28727
+ }
28728
+ function translateInlineNode(params) {
28729
+ const nodeElements = translateImageNode(params);
28730
+ return {
28731
+ name: "wp:inline",
28732
+ attributes: nodeElements.attributes,
28733
+ elements: nodeElements.elements
27589
28734
  };
27590
- if (decodedAttrs && Object.keys(decodedAttrs).length) {
27591
- result.attributes = decodedAttrs;
28735
+ }
28736
+ const XML_NODE_NAME$4 = "wp:inline";
28737
+ const SD_NODE_NAME$4 = ["image"];
28738
+ const validXmlAttributes$4 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28739
+ function encode$b(params) {
28740
+ const { node } = params.extraParams;
28741
+ if (!node || !node.type) {
28742
+ return null;
27592
28743
  }
27593
- return result;
27594
- };
27595
- const config$2 = {
27596
- xmlName: XML_NODE_NAME$2,
27597
- sdNodeOrKeyName: SD_NODE_NAME$2,
28744
+ return handleInlineNode(params);
28745
+ }
28746
+ function decode$b(params) {
28747
+ const { node } = params;
28748
+ if (!node || !node.type) {
28749
+ return null;
28750
+ }
28751
+ return translateInlineNode(params);
28752
+ }
28753
+ const config$4 = {
28754
+ xmlName: XML_NODE_NAME$4,
28755
+ sdNodeOrKeyName: SD_NODE_NAME$4,
27598
28756
  type: NodeTranslator.translatorTypes.NODE,
27599
- encode: encode$2,
27600
- decode: decode$2,
27601
- attributes: validXmlAttributes$2
28757
+ encode: encode$b,
28758
+ decode: decode$b,
28759
+ attributes: validXmlAttributes$4
27602
28760
  };
27603
- const translator$2 = NodeTranslator.from(config$2);
27604
- const registeredHandlers = Object.freeze({
27605
- "w:br": translator$V,
27606
- "w:tab": translator$U,
27607
- "w:p": translator$T,
27608
- "wp:anchor": translator$5,
27609
- "wp:inline": translator$4,
27610
- "w:bookmarkStart": translator$3,
27611
- "w:bookmarkEnd": translator$2
27612
- });
27613
- const XML_NODE_NAME$1 = "w:drawing";
27614
- const SD_NODE_NAME$1 = [];
27615
- const validXmlAttributes$1 = [];
27616
- function encode$1(params) {
28761
+ const translator$4 = NodeTranslator.from(config$4);
28762
+ const XML_NODE_NAME$3 = "w:drawing";
28763
+ const SD_NODE_NAME$3 = [];
28764
+ const validXmlAttributes$3 = [];
28765
+ function encode$a(params) {
27617
28766
  const nodes = params.nodes;
27618
28767
  const node = nodes[0];
27619
- const validChildTranslators = ["wp:anchor", "wp:inline"];
28768
+ const translatorByChildName = {
28769
+ "wp:anchor": translator$5,
28770
+ "wp:inline": translator$4
28771
+ };
27620
28772
  return node.elements.reduce((acc, child) => {
27621
28773
  if (acc) return acc;
27622
- if (!validChildTranslators.includes(child.name)) return acc;
27623
- const translator2 = registeredHandlers[child.name];
28774
+ const translator2 = translatorByChildName[child.name];
28775
+ if (!translator2) return acc;
27624
28776
  return translator2.encode({ ...params, extraParams: { node: child } }) || acc;
27625
28777
  }, null);
27626
28778
  }
27627
- function decode$1(params) {
28779
+ function decode$a(params) {
27628
28780
  const { node } = params;
27629
28781
  if (!node || !node.type) {
27630
28782
  return null;
27631
28783
  }
27632
- const handlerName = node.attrs.isAnchor ? "wp:anchor" : "wp:inline";
27633
- const resultNode = registeredHandlers[handlerName].decode(params);
28784
+ const childTranslator = node.attrs.isAnchor ? translator$5 : translator$4;
28785
+ const resultNode = childTranslator.decode(params);
27634
28786
  return wrapTextInRun(
27635
28787
  {
27636
28788
  name: "w:drawing",
@@ -27639,15 +28791,15 @@ function decode$1(params) {
27639
28791
  []
27640
28792
  );
27641
28793
  }
27642
- const config$1 = {
27643
- xmlName: XML_NODE_NAME$1,
27644
- sdNodeOrKeyName: SD_NODE_NAME$1,
28794
+ const config$3 = {
28795
+ xmlName: XML_NODE_NAME$3,
28796
+ sdNodeOrKeyName: SD_NODE_NAME$3,
27645
28797
  type: NodeTranslator.translatorTypes.NODE,
27646
- encode: encode$1,
27647
- decode: decode$1,
27648
- attributes: validXmlAttributes$1
28798
+ encode: encode$a,
28799
+ decode: decode$a,
28800
+ attributes: validXmlAttributes$3
27649
28801
  };
27650
- const translator$1 = NodeTranslator.from(config$1);
28802
+ const translator$3 = NodeTranslator.from(config$3);
27651
28803
  class CommandService {
27652
28804
  /**
27653
28805
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -28985,7 +30137,7 @@ function prepareTextAnnotation(params) {
28985
30137
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
28986
30138
  }
28987
30139
  function prepareImageAnnotation(params, imageSize) {
28988
- return translator$1.decode({
30140
+ return translator$3.decode({
28989
30141
  ...params,
28990
30142
  imageSize
28991
30143
  });
@@ -29222,10 +30374,10 @@ function translateStructuredContent(params) {
29222
30374
  };
29223
30375
  return result;
29224
30376
  }
29225
- const XML_NODE_NAME = "w:sdt";
29226
- const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
29227
- const validXmlAttributes = [];
29228
- function encode(params) {
30377
+ const XML_NODE_NAME$2 = "w:sdt";
30378
+ const SD_NODE_NAME$2 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30379
+ const validXmlAttributes$2 = [];
30380
+ function encode$9(params) {
29229
30381
  const nodes = params.nodes;
29230
30382
  const node = nodes[0];
29231
30383
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -29235,7 +30387,7 @@ function encode(params) {
29235
30387
  const result = handler2(params);
29236
30388
  return result;
29237
30389
  }
29238
- function decode(params) {
30390
+ function decode$9(params) {
29239
30391
  const { node } = params;
29240
30392
  if (!node || !node.type) {
29241
30393
  return null;
@@ -29251,6 +30403,146 @@ function decode(params) {
29251
30403
  const result = decoder();
29252
30404
  return result;
29253
30405
  }
30406
+ const config$2 = {
30407
+ xmlName: XML_NODE_NAME$2,
30408
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30409
+ type: NodeTranslator.translatorTypes.NODE,
30410
+ encode: encode$9,
30411
+ decode: decode$9,
30412
+ attributes: validXmlAttributes$2
30413
+ };
30414
+ const translator$2 = NodeTranslator.from(config$2);
30415
+ const encode$8 = (attributes) => {
30416
+ return attributes["w:id"];
30417
+ };
30418
+ const decode$8 = (attrs) => {
30419
+ return attrs.id;
30420
+ };
30421
+ const attrConfig$6 = Object.freeze({
30422
+ xmlName: "w:id",
30423
+ sdName: "id",
30424
+ encode: encode$8,
30425
+ decode: decode$8
30426
+ });
30427
+ const encode$7 = (attributes) => {
30428
+ return attributes["w:name"];
30429
+ };
30430
+ const decode$7 = (attrs) => {
30431
+ return attrs.name;
30432
+ };
30433
+ const attrConfig$5 = Object.freeze({
30434
+ xmlName: "w:name",
30435
+ sdName: "name",
30436
+ encode: encode$7,
30437
+ decode: decode$7
30438
+ });
30439
+ const encode$6 = (attributes) => {
30440
+ return attributes["w:colFirst"];
30441
+ };
30442
+ const decode$6 = (attrs) => {
30443
+ return attrs.colFirst;
30444
+ };
30445
+ const attrConfig$4 = Object.freeze({
30446
+ xmlName: "w:colFirst",
30447
+ sdName: "colFirst",
30448
+ encode: encode$6,
30449
+ decode: decode$6
30450
+ });
30451
+ const encode$5 = (attributes) => {
30452
+ return attributes["w:colLast"];
30453
+ };
30454
+ const decode$5 = (attrs) => {
30455
+ return attrs.colLast;
30456
+ };
30457
+ const attrConfig$3 = Object.freeze({
30458
+ xmlName: "w:colLast",
30459
+ sdName: "colLast",
30460
+ encode: encode$5,
30461
+ decode: decode$5
30462
+ });
30463
+ const encode$4 = (attributes) => {
30464
+ return attributes["w:displacedByCustomXml"];
30465
+ };
30466
+ const decode$4 = (attrs) => {
30467
+ return attrs.displacedByCustomXml;
30468
+ };
30469
+ const attrConfig$2 = Object.freeze({
30470
+ xmlName: "w:displacedByCustomXml",
30471
+ sdName: "displacedByCustomXml",
30472
+ encode: encode$4,
30473
+ decode: decode$4
30474
+ });
30475
+ const validXmlAttributes$1 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30476
+ const XML_NODE_NAME$1 = "w:bookmarkStart";
30477
+ const SD_NODE_NAME$1 = "bookmarkStart";
30478
+ const encode$3 = (params, encodedAttrs = {}) => {
30479
+ return {
30480
+ type: "bookmarkStart",
30481
+ attrs: encodedAttrs
30482
+ };
30483
+ };
30484
+ const decode$3 = (params, decodedAttrs = {}) => {
30485
+ const result = {
30486
+ name: "w:bookmarkStart",
30487
+ elements: []
30488
+ };
30489
+ if (decodedAttrs && Object.keys(decodedAttrs).length) {
30490
+ result.attributes = decodedAttrs;
30491
+ }
30492
+ return result;
30493
+ };
30494
+ const config$1 = {
30495
+ xmlName: XML_NODE_NAME$1,
30496
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30497
+ type: NodeTranslator.translatorTypes.NODE,
30498
+ encode: encode$3,
30499
+ decode: decode$3,
30500
+ attributes: validXmlAttributes$1
30501
+ };
30502
+ const translator$1 = NodeTranslator.from(config$1);
30503
+ const encode$2 = (attributes) => {
30504
+ return attributes["w:id"];
30505
+ };
30506
+ const decode$2 = (attrs) => {
30507
+ return attrs.id;
30508
+ };
30509
+ const attrConfig$1 = Object.freeze({
30510
+ xmlName: "w:id",
30511
+ sdName: "id",
30512
+ encode: encode$2,
30513
+ decode: decode$2
30514
+ });
30515
+ const encode$1 = (attributes) => {
30516
+ return attributes["w:displacedByCustomXml"];
30517
+ };
30518
+ const decode$1 = (attrs) => {
30519
+ return attrs.displacedByCustomXml;
30520
+ };
30521
+ const attrConfig = Object.freeze({
30522
+ xmlName: "w:displacedByCustomXml",
30523
+ sdName: "displacedByCustomXml",
30524
+ encode: encode$1,
30525
+ decode: decode$1
30526
+ });
30527
+ const validXmlAttributes = [attrConfig$1, attrConfig];
30528
+ const XML_NODE_NAME = "w:bookmarkEnd";
30529
+ const SD_NODE_NAME = "bookmarkEnd";
30530
+ const encode = (params, encodedAttrs = {}) => {
30531
+ return {
30532
+ type: "bookmarkEnd",
30533
+ attrs: encodedAttrs
30534
+ };
30535
+ };
30536
+ const decode = (params, decodedAttrs = {}) => {
30537
+ const result = {
30538
+ name: "w:bookmarkEnd",
30539
+ elements: []
30540
+ };
30541
+ if (decodedAttrs && Object.keys(decodedAttrs).length) {
30542
+ result.attributes = decodedAttrs;
30543
+ }
30544
+ return result;
30545
+ };
29254
30546
  const config = {
29255
30547
  xmlName: XML_NODE_NAME,
29256
30548
  sdNodeOrKeyName: SD_NODE_NAME,
@@ -29260,35 +30552,44 @@ const config = {
29260
30552
  attributes: validXmlAttributes
29261
30553
  };
29262
30554
  const translator = NodeTranslator.from(config);
30555
+ const isLineBreakOnlyRun = (node) => {
30556
+ if (!node) return false;
30557
+ if (node.type === "lineBreak" || node.type === "hardBreak") return true;
30558
+ if (node.type !== "run") return false;
30559
+ const runContent = Array.isArray(node.content) ? node.content : [];
30560
+ if (!runContent.length) return false;
30561
+ return runContent.every((child) => child?.type === "lineBreak" || child?.type === "hardBreak");
30562
+ };
29263
30563
  function exportSchemaToJson(params) {
29264
30564
  const { type: type2 } = params.node || {};
29265
30565
  const router = {
29266
30566
  doc: translateDocumentNode,
29267
30567
  body: translateBodyNode,
29268
30568
  heading: translateHeadingNode,
29269
- paragraph: translator$T,
30569
+ paragraph: translator$12,
30570
+ run: translator$T,
29270
30571
  text: translateTextNode,
29271
30572
  bulletList: translateList,
29272
30573
  orderedList: translateList,
29273
- lineBreak: translator$V,
30574
+ lineBreak: translator$15,
29274
30575
  table: translator$8,
29275
30576
  tableRow: translator$F,
29276
30577
  tableCell: translator$7,
29277
- bookmarkStart: translator$3,
29278
- bookmarkEnd: translator$2,
29279
- fieldAnnotation: translator,
29280
- tab: translator$U,
29281
- image: translator$1,
29282
- hardBreak: translator$V,
30578
+ bookmarkStart: translator$1,
30579
+ bookmarkEnd: translator,
30580
+ fieldAnnotation: translator$2,
30581
+ tab: translator$13,
30582
+ image: translator$3,
30583
+ hardBreak: translator$15,
29283
30584
  commentRangeStart: () => translateCommentNode(params, "Start"),
29284
30585
  commentRangeEnd: () => translateCommentNode(params, "End"),
29285
30586
  commentReference: () => null,
29286
30587
  shapeContainer: translateShapeContainer,
29287
30588
  shapeTextbox: translateShapeTextbox,
29288
30589
  contentBlock: translateContentBlock,
29289
- structuredContent: translator,
29290
- structuredContentBlock: translator,
29291
- documentSection: translator,
30590
+ structuredContent: translator$2,
30591
+ structuredContentBlock: translator$2,
30592
+ documentSection: translator$2,
29292
30593
  "page-number": translatePageNumberNode,
29293
30594
  "total-page-number": translateTotalPageNumberNode
29294
30595
  };
@@ -29427,21 +30728,32 @@ function generateParagraphProperties(node) {
29427
30728
  };
29428
30729
  pPrElements.push(spacingElement);
29429
30730
  }
29430
- if (indent && Object.values(indent).some((v2) => v2 !== 0)) {
29431
- const { left, right, firstLine, hanging } = indent;
30731
+ const hasIndent = !!indent;
30732
+ if (hasIndent) {
30733
+ const { left, right, firstLine, hanging, explicitLeft, explicitRight, explicitFirstLine, explicitHanging } = indent;
29432
30734
  const attributes = {};
29433
- if (left || left === 0) attributes["w:left"] = pixelsToTwips(left);
29434
- if (right || right === 0) attributes["w:right"] = pixelsToTwips(right);
29435
- if (firstLine || firstLine === 0) attributes["w:firstLine"] = pixelsToTwips(firstLine);
29436
- if (hanging || hanging === 0) attributes["w:hanging"] = pixelsToTwips(hanging);
29437
- if (textIndent && !attributes["w:left"]) {
30735
+ if (left !== void 0 && (left !== 0 || explicitLeft || textIndent)) {
30736
+ attributes["w:left"] = pixelsToTwips(left);
30737
+ }
30738
+ if (right !== void 0 && (right !== 0 || explicitRight)) {
30739
+ attributes["w:right"] = pixelsToTwips(right);
30740
+ }
30741
+ if (firstLine !== void 0 && (firstLine !== 0 || explicitFirstLine)) {
30742
+ attributes["w:firstLine"] = pixelsToTwips(firstLine);
30743
+ }
30744
+ if (hanging !== void 0 && (hanging !== 0 || explicitHanging)) {
30745
+ attributes["w:hanging"] = pixelsToTwips(hanging);
30746
+ }
30747
+ if (textIndent && attributes["w:left"] === void 0) {
29438
30748
  attributes["w:left"] = getTextIndentExportValue(textIndent);
29439
30749
  }
29440
- const indentElement = {
29441
- name: "w:ind",
29442
- attributes
29443
- };
29444
- pPrElements.push(indentElement);
30750
+ if (Object.keys(attributes).length) {
30751
+ const indentElement = {
30752
+ name: "w:ind",
30753
+ attributes
30754
+ };
30755
+ pPrElements.push(indentElement);
30756
+ }
29445
30757
  } else if (textIndent && textIndent !== "0in") {
29446
30758
  const indentElement = {
29447
30759
  name: "w:ind",
@@ -29491,12 +30803,17 @@ function generateParagraphProperties(node) {
29491
30803
  if (sectPr) {
29492
30804
  pPrElements.push(sectPr);
29493
30805
  }
30806
+ const mapTabVal = (value) => {
30807
+ if (!value || value === "start") return "left";
30808
+ if (value === "end") return "right";
30809
+ return value;
30810
+ };
29494
30811
  const { tabStops } = attrs;
29495
30812
  if (tabStops && tabStops.length > 0) {
29496
30813
  const tabElements = tabStops.map((tab) => {
29497
30814
  const posValue = tab.originalPos !== void 0 ? tab.originalPos : pixelsToTwips(tab.pos).toString();
29498
30815
  const tabAttributes = {
29499
- "w:val": tab.val || "start",
30816
+ "w:val": mapTabVal(tab.val),
29500
30817
  "w:pos": posValue
29501
30818
  };
29502
30819
  if (tab.leader) {
@@ -29851,6 +31168,11 @@ const convertMultipleListItemsIntoSingleNode = (listItem) => {
29851
31168
  collapsedParagraph.content.push(item);
29852
31169
  }
29853
31170
  });
31171
+ collapsedParagraph.content = collapsedParagraph.content.filter((node, index, nodes) => {
31172
+ if (!isLineBreakOnlyRun(node)) return true;
31173
+ const prevNode = nodes[index - 1];
31174
+ return !(prevNode && isLineBreakOnlyRun(prevNode));
31175
+ });
29854
31176
  return collapsedParagraph;
29855
31177
  };
29856
31178
  const restoreIndent = (indent) => {
@@ -29904,13 +31226,27 @@ function translateMark(mark) {
29904
31226
  markElement.type = "element";
29905
31227
  break;
29906
31228
  case "italic":
29907
- delete markElement.attributes;
29908
- markElement.type = "element";
29909
- break;
29910
- case "underline":
31229
+ if (attrs?.value && attrs.value !== "1" && attrs.value !== true) {
31230
+ markElement.attributes["w:val"] = attrs.value;
31231
+ } else {
31232
+ delete markElement.attributes;
31233
+ }
29911
31234
  markElement.type = "element";
29912
- markElement.attributes["w:val"] = attrs.underlineType;
29913
31235
  break;
31236
+ case "underline": {
31237
+ const translated = translator$$.decode({
31238
+ node: {
31239
+ attrs: {
31240
+ underlineType: attrs.underlineType ?? attrs.underline ?? null,
31241
+ underlineColor: attrs.underlineColor ?? attrs.color ?? null,
31242
+ underlineThemeColor: attrs.underlineThemeColor ?? attrs.themeColor ?? null,
31243
+ underlineThemeTint: attrs.underlineThemeTint ?? attrs.themeTint ?? null,
31244
+ underlineThemeShade: attrs.underlineThemeShade ?? attrs.themeShade ?? null
31245
+ }
31246
+ }
31247
+ });
31248
+ return translated || {};
31249
+ }
29914
31250
  // Text style cases
29915
31251
  case "fontSize":
29916
31252
  value = attrs.fontSize;
@@ -29928,13 +31264,21 @@ function translateMark(mark) {
29928
31264
  markElement.name = "w:rStyle";
29929
31265
  markElement.attributes["w:val"] = attrs.styleId;
29930
31266
  break;
29931
- case "color":
29932
- let processedColor = attrs.color.replace(/^#/, "").replace(/;$/, "");
31267
+ case "color": {
31268
+ const rawColor = attrs.color;
31269
+ if (!rawColor) break;
31270
+ const normalized = String(rawColor).trim().toLowerCase();
31271
+ if (normalized === "inherit") {
31272
+ markElement.attributes["w:val"] = "auto";
31273
+ break;
31274
+ }
31275
+ let processedColor = String(rawColor).replace(/^#/, "").replace(/;$/, "");
29933
31276
  if (processedColor.startsWith("rgb")) {
29934
31277
  processedColor = rgbToHex(processedColor);
29935
31278
  }
29936
31279
  markElement.attributes["w:val"] = processedColor;
29937
31280
  break;
31281
+ }
29938
31282
  case "textAlign":
29939
31283
  markElement.attributes["w:val"] = attrs.textAlign;
29940
31284
  break;
@@ -29952,12 +31296,11 @@ function translateMark(mark) {
29952
31296
  case "lineHeight":
29953
31297
  markElement.attributes["w:line"] = linesToTwips(attrs.lineHeight);
29954
31298
  break;
29955
- case "highlight":
29956
- markElement.attributes["w:fill"] = attrs.color?.substring(1);
29957
- markElement.attributes["w:color"] = "auto";
29958
- markElement.attributes["w:val"] = "clear";
29959
- markElement.name = "w:shd";
29960
- break;
31299
+ case "highlight": {
31300
+ const highlightValue = attrs.color ?? attrs.highlight ?? null;
31301
+ const translated = translator$14.decode({ node: { attrs: { highlight: highlightValue } } });
31302
+ return translated || {};
31303
+ }
29961
31304
  }
29962
31305
  return markElement;
29963
31306
  }
@@ -30088,8 +31431,8 @@ generate_xml_as_list_fn = function(data, debug = false) {
30088
31431
  return final;
30089
31432
  };
30090
31433
  replaceSpecialCharacters_fn = function(text) {
30091
- if (!text) return;
30092
- return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
31434
+ if (text === void 0 || text === null) return text;
31435
+ return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
30093
31436
  };
30094
31437
  generateXml_fn = function(node) {
30095
31438
  if (!node) return null;
@@ -30105,7 +31448,7 @@ generateXml_fn = function(node) {
30105
31448
  else tag += ">";
30106
31449
  let tags = [tag];
30107
31450
  if (!name && node.type === "text") {
30108
- return node.text;
31451
+ return __privateMethod(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, node.text ?? "");
30109
31452
  }
30110
31453
  if (elements) {
30111
31454
  if (name === "w:instrText") {
@@ -30231,7 +31574,7 @@ const handleDrawingNode = (params) => {
30231
31574
  if (mainNode.name === "w:drawing") node = mainNode;
30232
31575
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
30233
31576
  if (!node) return { nodes: [], consumed: 0 };
30234
- const schemaNode = translator$1.encode(params);
31577
+ const schemaNode = translator$3.encode(params);
30235
31578
  const newNodes = schemaNode ? [schemaNode] : [];
30236
31579
  return { nodes: newNodes, consumed: 1 };
30237
31580
  };
@@ -30334,81 +31677,7 @@ const trackChangeNodeHandlerEntity = {
30334
31677
  handler: handleTrackChangeNode
30335
31678
  };
30336
31679
  const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$6);
30337
- const handleRunNode = (params) => {
30338
- const { nodes, nodeListHandler, parentStyleId, docx } = params;
30339
- if (nodes.length === 0 || nodes[0].name !== "w:r") {
30340
- return { nodes: [], consumed: 0 };
30341
- }
30342
- const node = nodes[0];
30343
- const childParams = { ...params, nodes: node.elements, path: [...params.path || [], node] };
30344
- let processedRun = nodeListHandler.handler(childParams)?.filter((n) => n) || [];
30345
- const hasRunProperties = node.elements?.some((el) => el.name === "w:rPr");
30346
- const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
30347
- if (hasRunProperties) {
30348
- const { marks = [] } = parseProperties(node);
30349
- let runStyleAttributes = [];
30350
- const runStyleElement = node.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
30351
- let runStyleId;
30352
- if (runStyleElement && runStyleElement.attributes?.["w:val"] && docx) {
30353
- runStyleId = runStyleElement.attributes["w:val"];
30354
- const runStyleDefinition = getMarksFromStyles(docx, runStyleId);
30355
- if (runStyleDefinition.marks && runStyleDefinition.marks.length > 0) {
30356
- runStyleAttributes = runStyleDefinition.marks;
30357
- }
30358
- }
30359
- let paragraphStyleAttributes = [];
30360
- if (defaultNodeStyles.marks) {
30361
- paragraphStyleAttributes = defaultNodeStyles.marks.filter((mark) => {
30362
- if (["bold"].includes(mark.type) && marks.find((m2) => m2.type === "bold")?.attrs?.value === "0") {
30363
- return false;
30364
- }
30365
- return true;
30366
- });
30367
- }
30368
- const combinedMarks = [...paragraphStyleAttributes];
30369
- runStyleAttributes.forEach((runStyle) => {
30370
- const exists = combinedMarks.some(
30371
- (mark) => mark.type === runStyle.type && JSON.stringify(mark.attrs || {}) === JSON.stringify(runStyle.attrs || {})
30372
- );
30373
- if (!exists) {
30374
- combinedMarks.push(runStyle);
30375
- }
30376
- });
30377
- marks.forEach((mark) => {
30378
- const exists = combinedMarks.some(
30379
- (existing) => existing.type === mark.type && JSON.stringify(existing.attrs || {}) === JSON.stringify(mark.attrs || {})
30380
- );
30381
- if (!exists) {
30382
- combinedMarks.push(mark);
30383
- }
30384
- });
30385
- if (runStyleId) combinedMarks.push({ type: "textStyle", attrs: { styleId: runStyleId } });
30386
- if (node.marks) combinedMarks.push(...node.marks);
30387
- const newMarks = createImportMarks(combinedMarks);
30388
- processedRun = processedRun.map((n) => {
30389
- const existingMarks = n.marks || [];
30390
- return {
30391
- ...n,
30392
- marks: [...newMarks, ...existingMarks]
30393
- };
30394
- });
30395
- }
30396
- return { nodes: processedRun, consumed: 1 };
30397
- };
30398
- const getMarksFromStyles = (docx, styleId) => {
30399
- const styles = docx?.["word/styles.xml"];
30400
- if (!styles) {
30401
- return {};
30402
- }
30403
- const styleTags = styles.elements[0].elements.filter((style2) => style2.name === "w:style");
30404
- const style = styleTags.find((tag) => tag.attributes["w:styleId"] === styleId) || {};
30405
- if (!style) return {};
30406
- return parseProperties(style);
30407
- };
30408
- const runNodeHandlerEntity = {
30409
- handlerName: "runNodeHandler",
30410
- handler: handleRunNode
30411
- };
31680
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$T);
30412
31681
  const handleTextNode = (params) => {
30413
31682
  const { nodes, insideTrackChange } = params;
30414
31683
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -30420,6 +31689,10 @@ const handleTextNode = (params) => {
30420
31689
  let text;
30421
31690
  if (elements.length === 1) {
30422
31691
  text = elements[0].text;
31692
+ const xmlSpace = node.attributes?.["xml:space"] ?? elements[0]?.attributes?.["xml:space"];
31693
+ if (xmlSpace !== "preserve" && typeof text === "string") {
31694
+ text = text.replace(/^\s+/, "").replace(/\s+$/, "");
31695
+ }
30423
31696
  text = text.replace(/\[\[sdspace\]\]/g, "");
30424
31697
  } else if (!elements.length && "attributes" in node && node.attributes["xml:space"] === "preserve") {
30425
31698
  text = " ";
@@ -30445,7 +31718,7 @@ const handleParagraphNode = (params) => {
30445
31718
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
30446
31719
  return { nodes: [], consumed: 0 };
30447
31720
  }
30448
- const schemaNode = translator$T.encode(params);
31721
+ const schemaNode = translator$12.encode(params);
30449
31722
  const newNodes = schemaNode ? [schemaNode] : [];
30450
31723
  return { nodes: newNodes, consumed: 1 };
30451
31724
  };
@@ -30458,7 +31731,7 @@ const handleSdtNode = (params) => {
30458
31731
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
30459
31732
  return { nodes: [], consumed: 0 };
30460
31733
  }
30461
- const result = translator.encode(params);
31734
+ const result = translator$2.encode(params);
30462
31735
  if (!result) {
30463
31736
  return { nodes: [], consumed: 0 };
30464
31737
  }
@@ -30548,7 +31821,7 @@ const handler = (params) => {
30548
31821
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
30549
31822
  return { nodes: [], consumed: 0 };
30550
31823
  }
30551
- const result = translator$V.encode(params);
31824
+ const result = translator$15.encode(params);
30552
31825
  if (!result) return { nodes: [], consumed: 0 };
30553
31826
  return {
30554
31827
  nodes: [result],
@@ -30620,7 +31893,7 @@ const handleBookmarkStartNode = (params) => {
30620
31893
  if (isCustomMarkBookmark(nodes[0], params.editor)) {
30621
31894
  return handleBookmarkNode(params);
30622
31895
  }
30623
- const node = translator$3.encode(params);
31896
+ const node = translator$1.encode(params);
30624
31897
  if (!node) return { nodes: [], consumed: 0 };
30625
31898
  return { nodes: [node], consumed: 1 };
30626
31899
  };
@@ -30652,7 +31925,7 @@ const handleBookmarkEndNode = (params) => {
30652
31925
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
30653
31926
  return { nodes: [], consumed: 0 };
30654
31927
  }
30655
- const node = translator$2.encode(params);
31928
+ const node = translator.encode(params);
30656
31929
  if (!node) return { nodes: [], consumed: 0 };
30657
31930
  return { nodes: [node], consumed: 1 };
30658
31931
  };
@@ -31291,7 +32564,7 @@ const handleTabNode = (params) => {
31291
32564
  if (!nodes.length || nodes[0].name !== "w:tab") {
31292
32565
  return { nodes: [], consumed: 0 };
31293
32566
  }
31294
- const node = translator$U.encode(params);
32567
+ const node = translator$13.encode(params);
31295
32568
  return { nodes: [node], consumed: 1 };
31296
32569
  };
31297
32570
  const tabNodeEntityHandler = {
@@ -31740,6 +33013,16 @@ const isAlternatingHeadersOddEven = (docx) => {
31740
33013
  };
31741
33014
  const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
31742
33015
  const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
33016
+ const FONT_FAMILY_FALLBACKS = Object.freeze({
33017
+ swiss: "Arial, sans-serif",
33018
+ roman: "Times New Roman, serif",
33019
+ modern: "Courier New, monospace",
33020
+ script: "cursive",
33021
+ decorative: "fantasy",
33022
+ system: "system-ui",
33023
+ auto: "sans-serif"
33024
+ });
33025
+ const DEFAULT_GENERIC_FALLBACK = "sans-serif";
31743
33026
  const _SuperConverter = class _SuperConverter {
31744
33027
  constructor(params = null) {
31745
33028
  __privateAdd(this, _SuperConverter_instances);
@@ -31775,6 +33058,31 @@ const _SuperConverter = class _SuperConverter {
31775
33058
  this.documentId = params?.documentId || null;
31776
33059
  if (this.docx.length || this.xml) this.parseFromXml();
31777
33060
  }
33061
+ static getFontTableEntry(docx, fontName) {
33062
+ if (!docx || !fontName) return null;
33063
+ const fontTable = docx["word/fontTable.xml"];
33064
+ if (!fontTable?.elements?.length) return null;
33065
+ const fontsNode = fontTable.elements.find((el) => el.name === "w:fonts");
33066
+ if (!fontsNode?.elements?.length) return null;
33067
+ return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
33068
+ }
33069
+ static getFallbackFromFontTable(docx, fontName) {
33070
+ const fontEntry = _SuperConverter.getFontTableEntry(docx, fontName);
33071
+ const family = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
33072
+ if (!family) return null;
33073
+ const mapped = FONT_FAMILY_FALLBACKS[family.toLowerCase()];
33074
+ return mapped || DEFAULT_GENERIC_FALLBACK;
33075
+ }
33076
+ static toCssFontFamily(fontName, docx) {
33077
+ if (!fontName) return fontName;
33078
+ if (fontName.includes(",")) return fontName;
33079
+ const fallback = _SuperConverter.getFallbackFromFontTable(docx, fontName) || DEFAULT_GENERIC_FALLBACK;
33080
+ const normalizedFallbackParts = fallback.split(",").map((part) => part.trim().toLowerCase()).filter(Boolean);
33081
+ if (normalizedFallbackParts.includes(fontName.trim().toLowerCase())) {
33082
+ return fallback;
33083
+ }
33084
+ return `${fontName}, ${fallback}`;
33085
+ }
31778
33086
  /**
31779
33087
  * Get the DocxHelpers object that contains utility functions for working with docx files.
31780
33088
  * @returns {import('./docx-helpers/docx-helpers.js').DocxHelpers} The DocxHelpers object.
@@ -31820,7 +33128,7 @@ const _SuperConverter = class _SuperConverter {
31820
33128
  return;
31821
33129
  }
31822
33130
  }
31823
- static updateDocumentVersion(docx = this.convertedXml, version = "0.20.0") {
33131
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.20.0-next.13") {
31824
33132
  const customLocation = "docProps/custom.xml";
31825
33133
  if (!docx[customLocation]) {
31826
33134
  docx[customLocation] = generateCustomXml();
@@ -31871,13 +33179,19 @@ const _SuperConverter = class _SuperConverter {
31871
33179
  if (rPrDefaults) {
31872
33180
  const rPr = rPrDefaults.elements?.find((el) => el.name === "w:rPr");
31873
33181
  const fonts = rPr?.elements?.find((el) => el.name === "w:rFonts");
31874
- typeface = fonts?.attributes["w:ascii"];
31875
- const fontSize = typeface ?? rPr?.elements?.find((el) => el.name === "w:sz")?.attributes["w:val"];
31876
- fontSizeNormal = !fontSizeNormal && fontSize ? Number(fontSize) / 2 : null;
33182
+ if (fonts?.attributes?.["w:ascii"]) {
33183
+ typeface = fonts.attributes["w:ascii"];
33184
+ }
33185
+ const fontSizeRaw = rPr?.elements?.find((el) => el.name === "w:sz")?.attributes?.["w:val"];
33186
+ if (!fontSizeNormal && fontSizeRaw) {
33187
+ fontSizeNormal = Number(fontSizeRaw) / 2;
33188
+ }
31877
33189
  }
31878
- const fontSizePt = fontSizeNormal || Number(rElements.find((el) => el.name === "w:sz")?.attributes["w:val"]) / 2 || 10;
33190
+ const fallbackSz = Number(rElements.find((el) => el.name === "w:sz")?.attributes?.["w:val"]);
33191
+ const fontSizePt = fontSizeNormal ?? (Number.isFinite(fallbackSz) ? fallbackSz / 2 : void 0) ?? 10;
31879
33192
  const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
31880
- return { fontSizePt, kern, typeface, panose };
33193
+ const fontFamilyCss = _SuperConverter.toCssFontFamily(typeface, this.convertedXml);
33194
+ return { fontSizePt, kern, typeface, panose, fontFamilyCss };
31881
33195
  }
31882
33196
  }
31883
33197
  getDocumentFonts() {
@@ -32310,7 +33624,7 @@ function storeSuperdocVersion(docx) {
32310
33624
  function generateCustomXml() {
32311
33625
  return DEFAULT_CUSTOM_XML;
32312
33626
  }
32313
- function generateSuperdocVersion(pid = 2, version = "0.20.0") {
33627
+ function generateSuperdocVersion(pid = 2, version = "0.20.0-next.13") {
32314
33628
  return {
32315
33629
  type: "element",
32316
33630
  name: "property",
@@ -32363,6 +33677,7 @@ export {
32363
33677
  objectIncludes as Z,
32364
33678
  AddMarkStep as _,
32365
33679
  Plugin as a,
33680
+ translator$R as a$,
32366
33681
  twipsToLines as a0,
32367
33682
  pixelsToTwips as a1,
32368
33683
  helpers as a2,
@@ -32373,12 +33688,33 @@ export {
32373
33688
  createDocFromMarkdown as a7,
32374
33689
  createDocFromHTML as a8,
32375
33690
  EditorState as a9,
32376
- getActiveFormatting as aA,
32377
- readFromClipboard as aB,
32378
- handleClipboardPaste as aC,
32379
- getFileObject as aD,
32380
- _sfc_main as aE,
32381
- registeredHandlers as aF,
33691
+ readFromClipboard as aA,
33692
+ handleClipboardPaste as aB,
33693
+ getFileObject as aC,
33694
+ runPropertyTranslators as aD,
33695
+ translator as aE,
33696
+ translator$1 as aF,
33697
+ translator$4 as aG,
33698
+ translator$5 as aH,
33699
+ translator$H as aI,
33700
+ translator$I as aJ,
33701
+ translator$G as aK,
33702
+ translator$J as aL,
33703
+ translator$F as aM,
33704
+ translator$7 as aN,
33705
+ translator$K as aO,
33706
+ translator$L as aP,
33707
+ translator$13 as aQ,
33708
+ translator$2 as aR,
33709
+ translator$U as aS,
33710
+ translator$T as aT,
33711
+ translator$12 as aU,
33712
+ translator$M as aV,
33713
+ translator$6 as aW,
33714
+ translator$N as aX,
33715
+ translator$O as aY,
33716
+ translator$P as aZ,
33717
+ translator$Q as a_,
32382
33718
  hasSomeParentWithClass as aa,
32383
33719
  isActive as ab,
32384
33720
  unflattenListsInHtml as ac,
@@ -32392,20 +33728,23 @@ export {
32392
33728
  docxNumberigHelpers as ak,
32393
33729
  parseIndentElement as al,
32394
33730
  combineIndents as am,
32395
- StepMap as an,
32396
- SelectionRange as ao,
32397
- Transform as ap,
32398
- isInTable as aq,
32399
- generateDocxRandomId as ar,
32400
- insertNewRelationship as as,
32401
- updateDOMAttributes as at,
32402
- htmlHandler as au,
32403
- commonjsGlobal as av,
32404
- getDefaultExportFromCjs$1 as aw,
32405
- getContentTypesFromXml as ax,
32406
- xmljs as ay,
32407
- vClickOutside as az,
33731
+ SelectionRange as an,
33732
+ Transform as ao,
33733
+ isInTable as ap,
33734
+ generateDocxRandomId as aq,
33735
+ insertNewRelationship as ar,
33736
+ updateDOMAttributes as as,
33737
+ htmlHandler as at,
33738
+ commonjsGlobal as au,
33739
+ getDefaultExportFromCjs$1 as av,
33740
+ getContentTypesFromXml as aw,
33741
+ xmljs as ax,
33742
+ vClickOutside as ay,
33743
+ getActiveFormatting as az,
32408
33744
  Slice as b,
33745
+ translator$S as b0,
33746
+ translator$15 as b1,
33747
+ _sfc_main as b2,
32409
33748
  DOMParser$1 as c,
32410
33749
  Mark as d,
32411
33750
  dropPoint as e,