@harbour-enterprises/superdoc 0.20.1 → 0.21.0-RC1

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 (95) hide show
  1. package/dist/chunks/{PdfViewer-BLwxuMWh.cjs → PdfViewer-BdrjIRpr.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-t_JS3Mbo.es.js → PdfViewer-DK1etjvu.es.js} +1 -1
  3. package/dist/chunks/{index-CBTSdULo.cjs → index-C_zTr1ZR.cjs} +14 -33
  4. package/dist/chunks/{index-Vp2WxlNm.es.js → index-ucP9WQ5I.es.js} +14 -33
  5. package/dist/chunks/{super-editor.es-DGV2_J23.es.js → super-editor.es-KKA9G1l1.es.js} +1846 -404
  6. package/dist/chunks/{super-editor.es-Cten5oWF.cjs → super-editor.es-XC168Mlw.cjs} +1846 -404
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/stores/comments-store.d.ts.map +1 -1
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Dq0PLazx.js → converter-B61ZUb-V.js} +1401 -310
  11. package/dist/super-editor/chunks/{docx-zipper-jT0gaoep.js → docx-zipper-B8nhsVFW.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-BEtv1kuN.js → editor-CQ0o4v54.js} +420 -65
  13. package/dist/super-editor/chunks/{toolbar-CJfSHfLU.js → toolbar-DWzoslZk.js} +11 -21
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/src/core/commands/index.d.ts +1 -0
  19. package/dist/super-editor/src/core/commands/toggleMarkCascade.d.ts +41 -0
  20. package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +5 -0
  21. package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
  22. package/dist/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +12 -0
  23. package/dist/super-editor/src/core/super-converter/v2/importer/runNodeImporter.d.ts +6 -6
  24. package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +20 -4
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +3 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +4 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +7 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/index.d.ts +1 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +2 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +4 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +4 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +4 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +4 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts +7 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/index.d.ts +2 -0
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/w-val.d.ts +4 -0
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/highlight-translator.d.ts +4 -0
  38. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +2 -0
  39. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +4 -0
  40. package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts +7 -0
  41. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/index.d.ts +2 -0
  42. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-del.d.ts +4 -0
  43. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r-pr.d.ts +4 -0
  44. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.d.ts +4 -0
  45. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts +40 -0
  46. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/index.d.ts +2 -0
  47. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +9 -0
  48. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/index.d.ts +1 -0
  49. package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts +4 -0
  50. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +2 -0
  51. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +4 -0
  52. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +4 -0
  53. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +4 -0
  54. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +4 -0
  55. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +4 -0
  56. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/index.d.ts +1 -0
  57. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts +5 -0
  58. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +2 -0
  59. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +4 -0
  60. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/index.d.ts +1 -0
  61. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts +7 -0
  62. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/index.d.ts +1 -0
  63. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts +5 -0
  64. package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +11 -0
  65. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +2 -0
  66. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +4 -0
  67. package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +7 -0
  68. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +2 -0
  69. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +4 -0
  70. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +4 -0
  71. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/index.d.ts +2 -0
  72. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/w-val.d.ts +4 -0
  73. package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts +4 -0
  74. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/index.d.ts +2 -0
  75. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-color.d.ts +4 -0
  76. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-color.d.ts +4 -0
  77. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-shade.d.ts +4 -0
  78. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-tint.d.ts +4 -0
  79. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-val.d.ts +4 -0
  80. package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/u-translator.d.ts +7 -0
  81. package/dist/super-editor/src/extensions/index.d.ts +2 -2
  82. package/dist/super-editor/src/extensions/linked-styles/index.d.ts +1 -0
  83. package/dist/super-editor/src/extensions/linked-styles/underline-css.d.ts +17 -0
  84. package/dist/super-editor/src/extensions/run/index.d.ts +1 -0
  85. package/dist/super-editor/src/extensions/run/run.d.ts +6 -0
  86. package/dist/super-editor/src/extensions/shared/cascade-toggle.d.ts +8 -0
  87. package/dist/super-editor/super-editor.es.js +49 -23
  88. package/dist/super-editor/toolbar.es.js +2 -2
  89. package/dist/super-editor.cjs +1 -1
  90. package/dist/super-editor.es.js +1 -1
  91. package/dist/superdoc.cjs +2 -2
  92. package/dist/superdoc.es.js +2 -2
  93. package/dist/superdoc.umd.js +1860 -437
  94. package/dist/superdoc.umd.js.map +1 -1
  95. package/package.json +1 -1
@@ -14875,25 +14875,47 @@ const getContentTypesFromXml = (contentTypesXml) => {
14875
14875
  const defaults = xmlDoc.querySelectorAll("Default");
14876
14876
  return Array.from(defaults).map((item) => item.getAttribute("Extension"));
14877
14877
  };
14878
+ const DOCX_HIGHLIGHT_KEYWORD_MAP = /* @__PURE__ */ new Map([
14879
+ ["yellow", "FFFF00"],
14880
+ ["green", "00FF00"],
14881
+ ["blue", "0000FF"],
14882
+ ["cyan", "00FFFF"],
14883
+ ["magenta", "FF00FF"],
14884
+ ["red", "FF0000"],
14885
+ ["darkYellow", "808000"],
14886
+ ["darkGreen", "008000"],
14887
+ ["darkBlue", "000080"],
14888
+ ["darkCyan", "008080"],
14889
+ ["darkMagenta", "800080"],
14890
+ ["darkGray", "808080"],
14891
+ ["darkRed", "800000"],
14892
+ ["lightGray", "C0C0C0"],
14893
+ ["black", "000000"],
14894
+ ["white", "FFFFFF"]
14895
+ ]);
14896
+ const normalizeHexColor = (hex) => {
14897
+ if (!hex) return null;
14898
+ let value = hex.replace("#", "").trim();
14899
+ if (!value) return null;
14900
+ value = value.toUpperCase();
14901
+ if (value.length === 3)
14902
+ value = value.split("").map((c) => c + c).join("");
14903
+ if (value.length === 8) value = value.slice(0, 6);
14904
+ return value;
14905
+ };
14878
14906
  const getHexColorFromDocxSystem = (docxColor) => {
14879
- const colorMap = /* @__PURE__ */ new Map([
14880
- ["yellow", "#ffff00"],
14881
- ["green", "#00ff00"],
14882
- ["blue", "#0000FFFF"],
14883
- ["cyan", "#00ffff"],
14884
- ["magenta", "#ff00ff"],
14885
- ["red", "#ff0000"],
14886
- ["darkYellow", "#808000FF"],
14887
- ["darkGreen", "#008000FF"],
14888
- ["darkBlue", "#000080"],
14889
- ["darkCyan", "#008080FF"],
14890
- ["darkMagenta", "#800080FF"],
14891
- ["darkGray", "#808080FF"],
14892
- ["darkRed", "#800000FF"],
14893
- ["lightGray", "#C0C0C0FF"],
14894
- ["black", "#000"]
14895
- ]);
14896
- return colorMap.get(docxColor) || null;
14907
+ const hex = DOCX_HIGHLIGHT_KEYWORD_MAP.get(docxColor);
14908
+ return hex ? `#${hex}` : null;
14909
+ };
14910
+ const getDocxHighlightKeywordFromHex = (hexColor) => {
14911
+ if (!hexColor) return null;
14912
+ if (DOCX_HIGHLIGHT_KEYWORD_MAP.has(hexColor)) return hexColor;
14913
+ const normalized = normalizeHexColor(hexColor);
14914
+ if (!normalized) return null;
14915
+ for (const [keyword, hex] of DOCX_HIGHLIGHT_KEYWORD_MAP.entries()) {
14916
+ if (hex === normalized) return keyword;
14917
+ }
14918
+ return null;
14897
14919
  };
14898
14920
  function isValidHexColor(color) {
14899
14921
  if (!color || typeof color !== "string") return false;
@@ -24303,37 +24325,37 @@ const _NodeTranslator = class _NodeTranslator {
24303
24325
  /** @type {typeof TranslatorTypes} */
24304
24326
  __publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
24305
24327
  let NodeTranslator = _NodeTranslator;
24306
- const encode$j = (attributes) => {
24328
+ const encode$T = (attributes) => {
24307
24329
  return attributes["w:type"];
24308
24330
  };
24309
- const decode$j = (attrs) => {
24331
+ const decode$K = (attrs) => {
24310
24332
  const { lineBreakType } = attrs;
24311
24333
  return lineBreakType;
24312
24334
  };
24313
- const attrConfig$b = Object.freeze({
24335
+ const attrConfig$z = Object.freeze({
24314
24336
  xmlName: "w:type",
24315
24337
  sdName: "lineBreakType",
24316
- encode: encode$j,
24317
- decode: decode$j
24338
+ encode: encode$T,
24339
+ decode: decode$K
24318
24340
  });
24319
- const encode$i = (attributes) => {
24341
+ const encode$S = (attributes) => {
24320
24342
  const xmlAttrValue = attributes["w:clear"];
24321
24343
  return xmlAttrValue;
24322
24344
  };
24323
- const decode$i = (attrs) => {
24345
+ const decode$J = (attrs) => {
24324
24346
  const { clear } = attrs;
24325
24347
  return clear;
24326
24348
  };
24327
- const attrConfig$a = Object.freeze({
24349
+ const attrConfig$y = Object.freeze({
24328
24350
  xmlName: "w:clear",
24329
24351
  sdName: "clear",
24330
- encode: encode$i,
24331
- decode: decode$i
24352
+ encode: encode$S,
24353
+ decode: decode$J
24332
24354
  });
24333
- const validXmlAttributes$6 = [attrConfig$b, attrConfig$a];
24334
- const XML_NODE_NAME$7 = "w:br";
24355
+ const validXmlAttributes$h = [attrConfig$z, attrConfig$y];
24356
+ const XML_NODE_NAME$j = "w:br";
24335
24357
  const SD_NODE_NAME$6 = "lineBreak";
24336
- const encode$h = (_2, encodedAttrs) => {
24358
+ const encode$R = (_2, encodedAttrs) => {
24337
24359
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24338
24360
  const translated = {
24339
24361
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24343,7 +24365,7 @@ const encode$h = (_2, encodedAttrs) => {
24343
24365
  }
24344
24366
  return translated;
24345
24367
  };
24346
- const decode$h = (params, decodedAttrs) => {
24368
+ const decode$I = (params, decodedAttrs) => {
24347
24369
  const { node } = params;
24348
24370
  if (!node) return;
24349
24371
  const wBreak = { name: "w:br" };
@@ -24360,63 +24382,120 @@ const decode$h = (params, decodedAttrs) => {
24360
24382
  };
24361
24383
  return translated;
24362
24384
  };
24363
- const config$7 = {
24364
- xmlName: XML_NODE_NAME$7,
24385
+ const config$j = {
24386
+ xmlName: XML_NODE_NAME$j,
24365
24387
  sdNodeOrKeyName: SD_NODE_NAME$6,
24366
24388
  type: NodeTranslator.translatorTypes.NODE,
24367
- encode: encode$h,
24368
- decode: decode$h,
24369
- attributes: validXmlAttributes$6
24389
+ encode: encode$R,
24390
+ decode: decode$I,
24391
+ attributes: validXmlAttributes$h
24392
+ };
24393
+ const translator$v = NodeTranslator.from(config$j);
24394
+ const encode$Q = (attributes) => attributes?.["w:val"];
24395
+ const decode$H = (attrs) => attrs?.highlight;
24396
+ const attrConfig$x = Object.freeze({
24397
+ xmlName: "w:val",
24398
+ sdName: "highlight",
24399
+ encode: encode$Q,
24400
+ decode: decode$H
24401
+ });
24402
+ const validXmlAttributes$g = [attrConfig$x];
24403
+ const XML_NODE_NAME$i = "w:highlight";
24404
+ const SD_ATTR_KEY$b = "highlight";
24405
+ const encode$P = (params, encodedAttrs = {}) => {
24406
+ const { nodes } = params;
24407
+ const node = nodes?.[0];
24408
+ const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24409
+ return {
24410
+ type: "attr",
24411
+ xmlName: XML_NODE_NAME$i,
24412
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
24413
+ attributes: { "w:val": value ?? null }
24414
+ };
24415
+ };
24416
+ const decode$G = (params) => {
24417
+ const attrs = params?.node?.attrs || {};
24418
+ const highlightValue = attrs.highlight ?? attrs.color ?? null;
24419
+ if (!highlightValue) return void 0;
24420
+ const normalizedValue = String(highlightValue).trim().toLowerCase();
24421
+ if (!normalizedValue || normalizedValue === "transparent" || normalizedValue === "none") {
24422
+ return void 0;
24423
+ }
24424
+ const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24425
+ if (keyword) {
24426
+ return {
24427
+ name: XML_NODE_NAME$i,
24428
+ attributes: { "w:val": keyword }
24429
+ };
24430
+ }
24431
+ const fill = normalizeHexColor(highlightValue);
24432
+ if (!fill) return void 0;
24433
+ return {
24434
+ name: "w:shd",
24435
+ attributes: {
24436
+ "w:color": "auto",
24437
+ "w:val": "clear",
24438
+ "w:fill": fill
24439
+ }
24440
+ };
24441
+ };
24442
+ const config$i = {
24443
+ xmlName: XML_NODE_NAME$i,
24444
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
24445
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
24446
+ encode: encode$P,
24447
+ decode: decode$G,
24448
+ attributes: validXmlAttributes$g
24370
24449
  };
24371
- const translator$j = NodeTranslator.from(config$7);
24372
- const encode$g = (attributes) => {
24450
+ const translator$u = NodeTranslator.from(config$i);
24451
+ const encode$O = (attributes) => {
24373
24452
  return attributes["w:val"];
24374
24453
  };
24375
- const decode$g = (attrs) => {
24454
+ const decode$F = (attrs) => {
24376
24455
  const { tabSize } = attrs || {};
24377
24456
  return tabSize;
24378
24457
  };
24379
- const attrConfig$9 = Object.freeze({
24458
+ const attrConfig$w = Object.freeze({
24380
24459
  xmlName: "w:val",
24381
24460
  sdName: "tabSize",
24382
- encode: encode$g,
24383
- decode: decode$g
24461
+ encode: encode$O,
24462
+ decode: decode$F
24384
24463
  });
24385
- const encode$f = (attributes) => {
24464
+ const encode$N = (attributes) => {
24386
24465
  return attributes["w:leader"];
24387
24466
  };
24388
- const decode$f = (attrs) => {
24467
+ const decode$E = (attrs) => {
24389
24468
  const { leader } = attrs || {};
24390
24469
  return leader;
24391
24470
  };
24392
- const attrConfig$8 = Object.freeze({
24471
+ const attrConfig$v = Object.freeze({
24393
24472
  xmlName: "w:leader",
24394
24473
  sdName: "leader",
24395
- encode: encode$f,
24396
- decode: decode$f
24474
+ encode: encode$N,
24475
+ decode: decode$E
24397
24476
  });
24398
- const encode$e = (attributes) => {
24477
+ const encode$M = (attributes) => {
24399
24478
  return attributes["w:pos"];
24400
24479
  };
24401
- const decode$e = (attrs) => {
24480
+ const decode$D = (attrs) => {
24402
24481
  const { pos } = attrs || {};
24403
24482
  return pos;
24404
24483
  };
24405
- const attrConfig$7 = Object.freeze({
24484
+ const attrConfig$u = Object.freeze({
24406
24485
  xmlName: "w:pos",
24407
24486
  sdName: "pos",
24408
- encode: encode$e,
24409
- decode: decode$e
24487
+ encode: encode$M,
24488
+ decode: decode$D
24410
24489
  });
24411
- const validXmlAttributes$5 = [attrConfig$9, attrConfig$7, attrConfig$8];
24412
- const XML_NODE_NAME$6 = "w:tab";
24490
+ const validXmlAttributes$f = [attrConfig$w, attrConfig$u, attrConfig$v];
24491
+ const XML_NODE_NAME$h = "w:tab";
24413
24492
  const SD_NODE_NAME$5 = "tab";
24414
- const encode$d = (_2, encodedAttrs = {}) => {
24493
+ const encode$L = (_2, encodedAttrs = {}) => {
24415
24494
  const translated = { type: "tab" };
24416
24495
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24417
24496
  return translated;
24418
24497
  };
24419
- const decode$d = (params, decodedAttrs = {}) => {
24498
+ const decode$C = (params, decodedAttrs = {}) => {
24420
24499
  const { node } = params || {};
24421
24500
  if (!node) return;
24422
24501
  const wTab = { name: "w:tab" };
@@ -24432,15 +24511,15 @@ const decode$d = (params, decodedAttrs = {}) => {
24432
24511
  }
24433
24512
  return translated;
24434
24513
  };
24435
- const config$6 = {
24436
- xmlName: XML_NODE_NAME$6,
24514
+ const config$h = {
24515
+ xmlName: XML_NODE_NAME$h,
24437
24516
  sdNodeOrKeyName: SD_NODE_NAME$5,
24438
24517
  type: NodeTranslator.translatorTypes.NODE,
24439
- encode: encode$d,
24440
- decode: decode$d,
24441
- attributes: validXmlAttributes$5
24518
+ encode: encode$L,
24519
+ decode: decode$C,
24520
+ attributes: validXmlAttributes$f
24442
24521
  };
24443
- const translator$i = NodeTranslator.from(config$6);
24522
+ const translator$t = NodeTranslator.from(config$h);
24444
24523
  const mergeTextNodes = (nodes) => {
24445
24524
  if (!nodes || !Array.isArray(nodes)) {
24446
24525
  return nodes;
@@ -24615,17 +24694,21 @@ function getMarkValue(markType, attributes, docx) {
24615
24694
  function getFontFamilyValue(attributes, docx) {
24616
24695
  const ascii = attributes["w:ascii"];
24617
24696
  const themeAscii = attributes["w:asciiTheme"];
24618
- if (!docx || !themeAscii) return ascii;
24619
- const theme = docx["word/theme/theme1.xml"];
24620
- if (!theme) return ascii;
24621
- const { elements: topElements } = theme;
24622
- const { elements } = topElements[0];
24623
- const themeElements = elements.find((el) => el.name === "a:themeElements");
24624
- const fontScheme = themeElements.elements.find((el) => el.name === "a:fontScheme");
24625
- const majorFont = fontScheme.elements.find((el) => el.name === "a:majorFont");
24626
- const latin = majorFont.elements.find((el) => el.name === "a:latin");
24627
- const typeface = latin.attributes["typeface"];
24628
- return typeface;
24697
+ let resolved = ascii;
24698
+ if (docx && themeAscii) {
24699
+ const theme = docx["word/theme/theme1.xml"];
24700
+ if (theme?.elements?.length) {
24701
+ const { elements: topElements } = theme;
24702
+ const { elements } = topElements[0] || {};
24703
+ const themeElements = elements?.find((el) => el.name === "a:themeElements");
24704
+ const fontScheme = themeElements?.elements?.find((el) => el.name === "a:fontScheme");
24705
+ const majorFont = fontScheme?.elements?.find((el) => el.name === "a:majorFont");
24706
+ const latin = majorFont?.elements?.find((el) => el.name === "a:latin");
24707
+ resolved = latin?.attributes?.typeface || resolved;
24708
+ }
24709
+ }
24710
+ if (!resolved) return null;
24711
+ return SuperConverter.toCssFontFamily(resolved, docx);
24629
24712
  }
24630
24713
  function getIndentValue(attributes) {
24631
24714
  let value = attributes["w:left"];
@@ -24646,7 +24729,11 @@ function getHighLightValue(attributes) {
24646
24729
  return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
24647
24730
  }
24648
24731
  function getStrikeValue(attributes) {
24649
- return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
24732
+ const raw = attributes?.["w:val"];
24733
+ if (raw === void 0 || raw === null) return "1";
24734
+ const value = String(raw).trim().toLowerCase();
24735
+ if (value === "1" || value === "true" || value === "on") return "1";
24736
+ return null;
24650
24737
  }
24651
24738
  const parseParagraphBorders = (pBdr) => {
24652
24739
  if (!pBdr || !pBdr.elements) return {};
@@ -25010,102 +25097,102 @@ const handleParagraphNode$1 = (params) => {
25010
25097
  }
25011
25098
  return schemaNode;
25012
25099
  };
25013
- const encode$c = (attributes) => {
25100
+ const encode$K = (attributes) => {
25014
25101
  return attributes["w:rsidDel"];
25015
25102
  };
25016
- const decode$c = (attrs) => {
25103
+ const decode$B = (attrs) => {
25017
25104
  return attrs.rsidDel;
25018
25105
  };
25019
- const attrConfig$6 = Object.freeze({
25106
+ const attrConfig$t = Object.freeze({
25020
25107
  xmlName: "w:rsidDel",
25021
25108
  sdName: "rsidDel",
25022
- encode: encode$c,
25023
- decode: decode$c
25109
+ encode: encode$K,
25110
+ decode: decode$B
25024
25111
  });
25025
- const encode$b = (attributes) => {
25112
+ const encode$J = (attributes) => {
25026
25113
  return attributes["w:rsidP"];
25027
25114
  };
25028
- const decode$b = (attrs) => {
25115
+ const decode$A = (attrs) => {
25029
25116
  return attrs.rsidP;
25030
25117
  };
25031
- const attrConfig$5 = Object.freeze({
25118
+ const attrConfig$s = Object.freeze({
25032
25119
  xmlName: "w:rsidP",
25033
25120
  sdName: "rsidP",
25034
- encode: encode$b,
25035
- decode: decode$b
25121
+ encode: encode$J,
25122
+ decode: decode$A
25036
25123
  });
25037
- const encode$a = (attributes) => {
25124
+ const encode$I = (attributes) => {
25038
25125
  return attributes["w:rsidR"];
25039
25126
  };
25040
- const decode$a = (attrs) => {
25127
+ const decode$z = (attrs) => {
25041
25128
  return attrs.rsidR;
25042
25129
  };
25043
- const attrConfig$4 = Object.freeze({
25130
+ const attrConfig$r = Object.freeze({
25044
25131
  xmlName: "w:rsidR",
25045
25132
  sdName: "rsidR",
25046
- encode: encode$a,
25047
- decode: decode$a
25133
+ encode: encode$I,
25134
+ decode: decode$z
25048
25135
  });
25049
- const encode$9 = (attributes) => {
25136
+ const encode$H = (attributes) => {
25050
25137
  return attributes["w:rsidRPr"];
25051
25138
  };
25052
- const decode$9 = (attrs) => {
25139
+ const decode$y = (attrs) => {
25053
25140
  return attrs.rsidRPr;
25054
25141
  };
25055
- const attrConfig$3 = Object.freeze({
25142
+ const attrConfig$q = Object.freeze({
25056
25143
  xmlName: "w:rsidRPr",
25057
25144
  sdName: "rsidRPr",
25058
- encode: encode$9,
25059
- decode: decode$9
25145
+ encode: encode$H,
25146
+ decode: decode$y
25060
25147
  });
25061
- const encode$8 = (attributes) => {
25148
+ const encode$G = (attributes) => {
25062
25149
  return attributes["w:rsidRDefault"];
25063
25150
  };
25064
- const decode$8 = (attrs) => {
25151
+ const decode$x = (attrs) => {
25065
25152
  return attrs.rsidRDefault;
25066
25153
  };
25067
- const attrConfig$2 = Object.freeze({
25154
+ const attrConfig$p = Object.freeze({
25068
25155
  xmlName: "w:rsidRDefault",
25069
25156
  sdName: "rsidRDefault",
25070
- encode: encode$8,
25071
- decode: decode$8
25157
+ encode: encode$G,
25158
+ decode: decode$x
25072
25159
  });
25073
- const encode$7 = (attributes) => {
25160
+ const encode$F = (attributes) => {
25074
25161
  return attributes["w14:paraId"];
25075
25162
  };
25076
- const decode$7 = (attrs) => {
25163
+ const decode$w = (attrs) => {
25077
25164
  return attrs.paraId;
25078
25165
  };
25079
- const attrConfig$1 = Object.freeze({
25166
+ const attrConfig$o = Object.freeze({
25080
25167
  xmlName: "w14:paraId",
25081
25168
  sdName: "paraId",
25082
- encode: encode$7,
25083
- decode: decode$7
25169
+ encode: encode$F,
25170
+ decode: decode$w
25084
25171
  });
25085
- const encode$6 = (attributes) => {
25172
+ const encode$E = (attributes) => {
25086
25173
  return attributes["w14:textId"];
25087
25174
  };
25088
- const decode$6 = (attrs) => {
25175
+ const decode$v = (attrs) => {
25089
25176
  return attrs.textId;
25090
25177
  };
25091
- const attrConfig = Object.freeze({
25178
+ const attrConfig$n = Object.freeze({
25092
25179
  xmlName: "w14:textId",
25093
25180
  sdName: "textId",
25094
- encode: encode$6,
25095
- decode: decode$6
25181
+ encode: encode$E,
25182
+ decode: decode$v
25096
25183
  });
25097
- const validXmlAttributes$4 = [
25098
- attrConfig$1,
25099
- attrConfig,
25100
- attrConfig$4,
25101
- attrConfig$2,
25102
- attrConfig$5,
25103
- attrConfig$3,
25104
- attrConfig$6
25184
+ const validXmlAttributes$e = [
25185
+ attrConfig$o,
25186
+ attrConfig$n,
25187
+ attrConfig$r,
25188
+ attrConfig$p,
25189
+ attrConfig$s,
25190
+ attrConfig$q,
25191
+ attrConfig$t
25105
25192
  ];
25106
- const XML_NODE_NAME$5 = "w:p";
25193
+ const XML_NODE_NAME$g = "w:p";
25107
25194
  const SD_NODE_NAME$4 = "paragraph";
25108
- const encode$5 = (params, encodedAttrs = {}) => {
25195
+ const encode$D = (params, encodedAttrs = {}) => {
25109
25196
  const node = handleParagraphNode$1(params);
25110
25197
  if (!node) return void 0;
25111
25198
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25113,7 +25200,7 @@ const encode$5 = (params, encodedAttrs = {}) => {
25113
25200
  }
25114
25201
  return node;
25115
25202
  };
25116
- const decode$5 = (params, decodedAttrs = {}) => {
25203
+ const decode$u = (params, decodedAttrs = {}) => {
25117
25204
  const translated = translateParagraphNode(params);
25118
25205
  if (!translated) return void 0;
25119
25206
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25121,15 +25208,15 @@ const decode$5 = (params, decodedAttrs = {}) => {
25121
25208
  }
25122
25209
  return translated;
25123
25210
  };
25124
- const config$5 = {
25125
- xmlName: XML_NODE_NAME$5,
25211
+ const config$g = {
25212
+ xmlName: XML_NODE_NAME$g,
25126
25213
  sdNodeOrKeyName: SD_NODE_NAME$4,
25127
25214
  type: NodeTranslator.translatorTypes.NODE,
25128
- encode: encode$5,
25129
- decode: decode$5,
25130
- attributes: validXmlAttributes$4
25215
+ encode: encode$D,
25216
+ decode: decode$u,
25217
+ attributes: validXmlAttributes$e
25131
25218
  };
25132
- const translator$h = NodeTranslator.from(config$5);
25219
+ const translator$s = NodeTranslator.from(config$g);
25133
25220
  const generateV2HandlerEntity = (handlerName, translator2) => ({
25134
25221
  handlerName,
25135
25222
  handler: (params) => {
@@ -25236,13 +25323,13 @@ const integerToString = (value) => {
25236
25323
  const intValue = parseInteger(value);
25237
25324
  return intValue != void 0 ? String(intValue) : void 0;
25238
25325
  };
25239
- const translator$g = NodeTranslator.from({
25326
+ const translator$r = NodeTranslator.from({
25240
25327
  xmlName: "w:cantSplit",
25241
25328
  sdNodeOrKeyName: "cantSplit",
25242
25329
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
25243
25330
  decode: ({ node }) => node.attrs?.cantSplit ? {} : void 0
25244
25331
  });
25245
- const translator$f = NodeTranslator.from({
25332
+ const translator$q = NodeTranslator.from({
25246
25333
  xmlName: "w:cnfStyle",
25247
25334
  sdNodeOrKeyName: "cnfStyle",
25248
25335
  attributes: [
@@ -25275,8 +25362,8 @@ const translator$f = NodeTranslator.from({
25275
25362
  return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
25276
25363
  }
25277
25364
  });
25278
- const translator$e = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
25279
- const translator$d = NodeTranslator.from(
25365
+ const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
25366
+ const translator$o = NodeTranslator.from(
25280
25367
  createSingleAttrPropertyHandler(
25281
25368
  "w:gridAfter",
25282
25369
  null,
@@ -25285,7 +25372,7 @@ const translator$d = NodeTranslator.from(
25285
25372
  (v2) => integerToString(v2)
25286
25373
  )
25287
25374
  );
25288
- const translator$c = NodeTranslator.from(
25375
+ const translator$n = NodeTranslator.from(
25289
25376
  createSingleAttrPropertyHandler(
25290
25377
  "w:gridBefore",
25291
25378
  null,
@@ -25294,21 +25381,21 @@ const translator$c = NodeTranslator.from(
25294
25381
  (v2) => integerToString(v2)
25295
25382
  )
25296
25383
  );
25297
- const translator$b = NodeTranslator.from({
25384
+ const translator$m = NodeTranslator.from({
25298
25385
  xmlName: "w:hidden",
25299
25386
  sdNodeOrKeyName: "hidden",
25300
25387
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
25301
25388
  decode: ({ node }) => node.attrs.hidden ? {} : void 0
25302
25389
  });
25303
- const translator$a = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
25304
- const translator$9 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
25305
- const translator$8 = NodeTranslator.from({
25390
+ const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
25391
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
25392
+ const translator$j = NodeTranslator.from({
25306
25393
  xmlName: "w:tblHeader",
25307
25394
  sdNodeOrKeyName: "repeatHeader",
25308
25395
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
25309
25396
  decode: ({ node }) => node.attrs.repeatHeader ? {} : void 0
25310
25397
  });
25311
- const translator$7 = NodeTranslator.from({
25398
+ const translator$i = NodeTranslator.from({
25312
25399
  xmlName: "w:trHeight",
25313
25400
  sdNodeOrKeyName: "rowHeight",
25314
25401
  encode: ({ nodes }) => {
@@ -25335,11 +25422,11 @@ const translator$7 = NodeTranslator.from({
25335
25422
  return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
25336
25423
  }
25337
25424
  });
25338
- const translator$6 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
25339
- const translator$5 = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
25340
- const XML_NODE_NAME$4 = "w:trPr";
25341
- const SD_ATTR_KEY = "tableRowProperties";
25342
- const encode$4 = (params) => {
25425
+ const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
25426
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
25427
+ const XML_NODE_NAME$f = "w:trPr";
25428
+ const SD_ATTR_KEY$a = "tableRowProperties";
25429
+ const encode$C = (params) => {
25343
25430
  const { nodes } = params;
25344
25431
  const node = nodes[0];
25345
25432
  let attributes = {
@@ -25353,12 +25440,12 @@ const encode$4 = (params) => {
25353
25440
  };
25354
25441
  return {
25355
25442
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25356
- xmlName: XML_NODE_NAME$4,
25357
- sdNodeOrKeyName: SD_ATTR_KEY,
25443
+ xmlName: XML_NODE_NAME$f,
25444
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25358
25445
  attributes
25359
25446
  };
25360
25447
  };
25361
- const decode$4 = (params) => {
25448
+ const decode$t = (params) => {
25362
25449
  const { tableRowProperties = {} } = params.node.attrs || {};
25363
25450
  const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
25364
25451
  const newNode = {
@@ -25370,18 +25457,18 @@ const decode$4 = (params) => {
25370
25457
  return newNode;
25371
25458
  };
25372
25459
  const propertyTranslators = [
25373
- translator$g,
25374
- translator$f,
25375
- translator$e,
25376
- translator$d,
25377
- translator$c,
25378
- translator$b,
25379
- translator$a,
25380
- translator$9,
25381
- translator$8,
25382
- translator$7,
25383
- translator$6,
25384
- translator$5
25460
+ translator$r,
25461
+ translator$q,
25462
+ translator$p,
25463
+ translator$o,
25464
+ translator$n,
25465
+ translator$m,
25466
+ translator$l,
25467
+ translator$k,
25468
+ translator$j,
25469
+ translator$i,
25470
+ translator$h,
25471
+ translator$g
25385
25472
  ];
25386
25473
  const propertyTranslatorsByXmlName = {};
25387
25474
  propertyTranslators.forEach((translator2) => {
@@ -25391,25 +25478,25 @@ const propertyTranslatorsBySdName = {};
25391
25478
  propertyTranslators.forEach((translator2) => {
25392
25479
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
25393
25480
  });
25394
- const config$4 = {
25395
- xmlName: XML_NODE_NAME$4,
25396
- sdNodeOrKeyName: SD_ATTR_KEY,
25481
+ const config$f = {
25482
+ xmlName: XML_NODE_NAME$f,
25483
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25397
25484
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25398
- encode: encode$4,
25399
- decode: decode$4
25485
+ encode: encode$C,
25486
+ decode: decode$t
25400
25487
  };
25401
- const translator$4 = NodeTranslator.from(config$4);
25402
- const XML_NODE_NAME$3 = "w:tr";
25488
+ const translator$f = NodeTranslator.from(config$f);
25489
+ const XML_NODE_NAME$e = "w:tr";
25403
25490
  const SD_NODE_NAME$3 = "tableRow";
25404
- const validXmlAttributes$3 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
25491
+ const validXmlAttributes$d = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
25405
25492
  (xmlName) => createAttributeHandler(xmlName)
25406
25493
  );
25407
- const encode$3 = (params, encodedAttrs) => {
25494
+ const encode$B = (params, encodedAttrs) => {
25408
25495
  const { row, table } = params.extraParams;
25409
25496
  let tableRowProperties = {};
25410
25497
  const tPr = row.elements.find((el) => el.name === "w:trPr");
25411
25498
  if (tPr) {
25412
- ({ attributes: tableRowProperties } = translator$4.encode({
25499
+ ({ attributes: tableRowProperties } = translator$f.encode({
25413
25500
  ...params,
25414
25501
  nodes: [tPr]
25415
25502
  }));
@@ -25422,7 +25509,7 @@ const encode$3 = (params, encodedAttrs) => {
25422
25509
  let currentColumnIndex = 0;
25423
25510
  const content = cellNodes?.map((n) => {
25424
25511
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
25425
- const result = translator$2.encode({
25512
+ const result = translator$d.encode({
25426
25513
  ...params,
25427
25514
  extraParams: {
25428
25515
  ...params.extraParams,
@@ -25453,7 +25540,7 @@ const _getGridColumnWidths = (tableNode) => {
25453
25540
  }) || [];
25454
25541
  return columnWidths;
25455
25542
  };
25456
- const decode$3 = (params, decodedAttrs) => {
25543
+ const decode$s = (params, decodedAttrs) => {
25457
25544
  const { node } = params;
25458
25545
  const elements = translateChildNodes(params);
25459
25546
  if (node.attrs?.tableRowProperties) {
@@ -25465,7 +25552,7 @@ const decode$3 = (params, decodedAttrs) => {
25465
25552
  }
25466
25553
  }
25467
25554
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
25468
- const trPr = translator$4.decode({
25555
+ const trPr = translator$f.decode({
25469
25556
  ...params,
25470
25557
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
25471
25558
  });
@@ -25477,15 +25564,15 @@ const decode$3 = (params, decodedAttrs) => {
25477
25564
  elements
25478
25565
  };
25479
25566
  };
25480
- const config$3 = {
25481
- xmlName: XML_NODE_NAME$3,
25567
+ const config$e = {
25568
+ xmlName: XML_NODE_NAME$e,
25482
25569
  sdNodeOrKeyName: SD_NODE_NAME$3,
25483
25570
  type: NodeTranslator.translatorTypes.NODE,
25484
- encode: encode$3,
25485
- decode: decode$3,
25486
- attributes: validXmlAttributes$3
25571
+ encode: encode$B,
25572
+ decode: decode$s,
25573
+ attributes: validXmlAttributes$d
25487
25574
  };
25488
- const translator$3 = NodeTranslator.from(config$3);
25575
+ const translator$e = NodeTranslator.from(config$e);
25489
25576
  const handleAllTableNodes = (params) => {
25490
25577
  const { nodes } = params;
25491
25578
  if (nodes.length === 0) {
@@ -25549,7 +25636,7 @@ function handleTableNode(node, params) {
25549
25636
  attrs["borders"] = borderData;
25550
25637
  const content = [];
25551
25638
  rows.forEach((row) => {
25552
- const result = translator$3.encode({
25639
+ const result = translator$e.encode({
25553
25640
  ...params,
25554
25641
  nodes: [row],
25555
25642
  extraParams: {
@@ -25930,10 +26017,10 @@ function generateCellMargins(cellMargins) {
25930
26017
  if (left != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left) } });
25931
26018
  return elements;
25932
26019
  }
25933
- const XML_NODE_NAME$2 = "w:tc";
26020
+ const XML_NODE_NAME$d = "w:tc";
25934
26021
  const SD_NODE_NAME$2 = "tableCell";
25935
- const validXmlAttributes$2 = [];
25936
- function encode$2(params, encodedAttrs) {
26022
+ const validXmlAttributes$c = [];
26023
+ function encode$A(params, encodedAttrs) {
25937
26024
  const { node, table, row, rowBorders, styleTag, columnIndex, columnWidth } = params.extraParams;
25938
26025
  const schemaNode = handleTableCellNode({
25939
26026
  params,
@@ -25950,23 +26037,23 @@ function encode$2(params, encodedAttrs) {
25950
26037
  }
25951
26038
  return schemaNode;
25952
26039
  }
25953
- function decode$2(params, decodedAttrs) {
26040
+ function decode$r(params, decodedAttrs) {
25954
26041
  const translated = translateTableCell(params);
25955
26042
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
25956
26043
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
25957
26044
  }
25958
26045
  return translated;
25959
26046
  }
25960
- const config$2 = {
25961
- xmlName: XML_NODE_NAME$2,
26047
+ const config$d = {
26048
+ xmlName: XML_NODE_NAME$d,
25962
26049
  sdNodeOrKeyName: SD_NODE_NAME$2,
25963
26050
  type: NodeTranslator.translatorTypes.NODE,
25964
- encode: encode$2,
25965
- decode: decode$2,
25966
- attributes: validXmlAttributes$2
26051
+ encode: encode$A,
26052
+ decode: decode$r,
26053
+ attributes: validXmlAttributes$c
25967
26054
  };
25968
- const translator$2 = NodeTranslator.from(config$2);
25969
- const XML_NODE_NAME$1 = "w:hyperlink";
26055
+ const translator$d = NodeTranslator.from(config$d);
26056
+ const XML_NODE_NAME$c = "w:hyperlink";
25970
26057
  const SD_NODE_NAME$1 = "link";
25971
26058
  const _createAttributeHandler = (xmlName, sdName) => ({
25972
26059
  xmlName,
@@ -25974,7 +26061,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
25974
26061
  encode: (attributes) => attributes[xmlName],
25975
26062
  decode: (attributes) => attributes[sdName]
25976
26063
  });
25977
- const validXmlAttributes$1 = [
26064
+ const validXmlAttributes$b = [
25978
26065
  _createAttributeHandler("w:anchor", "anchor"),
25979
26066
  _createAttributeHandler("w:docLocation", "docLocation"),
25980
26067
  {
@@ -25987,7 +26074,7 @@ const validXmlAttributes$1 = [
25987
26074
  _createAttributeHandler("r:id", "rId"),
25988
26075
  _createAttributeHandler("w:tgtFrame", "target")
25989
26076
  ];
25990
- const encode$1 = (params, encodedAttrs) => {
26077
+ const encode$z = (params, encodedAttrs) => {
25991
26078
  const { nodes, docx, nodeListHandler } = params;
25992
26079
  const node = nodes[0];
25993
26080
  let href = _resolveHref(docx, encodedAttrs);
@@ -26001,7 +26088,16 @@ const encode$1 = (params, encodedAttrs) => {
26001
26088
  nodes: runNodes,
26002
26089
  path: [...params.path || [], node]
26003
26090
  });
26004
- return updatedNode;
26091
+ const ensureLinkMark = (child) => {
26092
+ if (!child || typeof child !== "object") return child;
26093
+ const existingMarks = Array.isArray(child.marks) ? child.marks : [];
26094
+ const hasLink = existingMarks.some((mark) => mark?.type === "link");
26095
+ if (hasLink) return child;
26096
+ const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
26097
+ return { ...child, marks: [...existingMarks, linkClone] };
26098
+ };
26099
+ if (!Array.isArray(updatedNode)) return updatedNode;
26100
+ return updatedNode.map((child) => ensureLinkMark(child));
26005
26101
  };
26006
26102
  const _resolveHref = (docx, encodedAttrs) => {
26007
26103
  const rels = docx["word/_rels/document.xml.rels"];
@@ -26018,7 +26114,7 @@ const _resolveHref = (docx, encodedAttrs) => {
26018
26114
  }
26019
26115
  return href;
26020
26116
  };
26021
- function decode$1(params) {
26117
+ function decode$q(params) {
26022
26118
  const { node } = params;
26023
26119
  const linkMark = node.marks.find((m2) => m2.type === "link");
26024
26120
  const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
@@ -26062,15 +26158,15 @@ function _addNewLinkRelationship(params, link, rId) {
26062
26158
  });
26063
26159
  return rId;
26064
26160
  }
26065
- const config$1 = {
26066
- xmlName: XML_NODE_NAME$1,
26161
+ const config$c = {
26162
+ xmlName: XML_NODE_NAME$c,
26067
26163
  sdNodeOrKeyName: SD_NODE_NAME$1,
26068
26164
  type: NodeTranslator.translatorTypes.NODE,
26069
- encode: encode$1,
26070
- decode: decode$1,
26071
- attributes: validXmlAttributes$1
26165
+ encode: encode$z,
26166
+ decode: decode$q,
26167
+ attributes: validXmlAttributes$b
26072
26168
  };
26073
- const translator$1 = NodeTranslator.from(config$1);
26169
+ const translator$c = NodeTranslator.from(config$c);
26074
26170
  function parseTagValueJSON(json) {
26075
26171
  if (typeof json !== "string") {
26076
26172
  return {};
@@ -26081,7 +26177,7 @@ function parseTagValueJSON(json) {
26081
26177
  }
26082
26178
  try {
26083
26179
  return JSON.parse(trimmed);
26084
- } catch (err) {
26180
+ } catch {
26085
26181
  return {};
26086
26182
  }
26087
26183
  }
@@ -27883,10 +27979,10 @@ function translateStructuredContent(params) {
27883
27979
  };
27884
27980
  return result;
27885
27981
  }
27886
- const XML_NODE_NAME = "w:sdt";
27982
+ const XML_NODE_NAME$b = "w:sdt";
27887
27983
  const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
27888
- const validXmlAttributes = [];
27889
- function encode(params, encodedAttrs) {
27984
+ const validXmlAttributes$a = [];
27985
+ function encode$y(params) {
27890
27986
  const nodes = params.nodes;
27891
27987
  const node = nodes[0];
27892
27988
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -27896,7 +27992,7 @@ function encode(params, encodedAttrs) {
27896
27992
  const result = handler2(params);
27897
27993
  return result;
27898
27994
  }
27899
- function decode(params, decodedAttrs) {
27995
+ function decode$p(params) {
27900
27996
  const { node } = params;
27901
27997
  if (!node || !node.type) {
27902
27998
  return null;
@@ -27912,43 +28008,138 @@ function decode(params, decodedAttrs) {
27912
28008
  const result = decoder();
27913
28009
  return result;
27914
28010
  }
27915
- const config = {
27916
- xmlName: XML_NODE_NAME,
28011
+ const config$b = {
28012
+ xmlName: XML_NODE_NAME$b,
27917
28013
  sdNodeOrKeyName: SD_NODE_NAME,
27918
28014
  type: NodeTranslator.translatorTypes.NODE,
27919
- encode,
27920
- decode,
27921
- attributes: validXmlAttributes
28015
+ encode: encode$y,
28016
+ decode: decode$p,
28017
+ attributes: validXmlAttributes$a
28018
+ };
28019
+ const translator$b = NodeTranslator.from(config$b);
28020
+ const encode$x = (attributes) => attributes?.["w:val"];
28021
+ const decode$o = (attrs) => attrs?.underline;
28022
+ const attrConfig$m = Object.freeze({
28023
+ xmlName: "w:val",
28024
+ sdName: "underline",
28025
+ encode: encode$x,
28026
+ decode: decode$o
28027
+ });
28028
+ const encode$w = (attributes) => attributes?.["w:color"];
28029
+ const decode$n = (attrs) => attrs?.color;
28030
+ const attrConfig$l = Object.freeze({
28031
+ xmlName: "w:color",
28032
+ sdName: "color",
28033
+ encode: encode$w,
28034
+ decode: decode$n
28035
+ });
28036
+ const encode$v = (attributes) => attributes?.["w:themeColor"];
28037
+ const decode$m = (attrs) => attrs?.themeColor;
28038
+ const attrConfig$k = Object.freeze({
28039
+ xmlName: "w:themeColor",
28040
+ sdName: "themeColor",
28041
+ encode: encode$v,
28042
+ decode: decode$m
28043
+ });
28044
+ const encode$u = (attributes) => attributes?.["w:themeTint"];
28045
+ const decode$l = (attrs) => attrs?.themeTint;
28046
+ const attrConfig$j = Object.freeze({
28047
+ xmlName: "w:themeTint",
28048
+ sdName: "themeTint",
28049
+ encode: encode$u,
28050
+ decode: decode$l
28051
+ });
28052
+ const encode$t = (attributes) => attributes?.["w:themeShade"];
28053
+ const decode$k = (attrs) => attrs?.themeShade;
28054
+ const attrConfig$i = Object.freeze({
28055
+ xmlName: "w:themeShade",
28056
+ sdName: "themeShade",
28057
+ encode: encode$t,
28058
+ decode: decode$k
28059
+ });
28060
+ const validXmlAttributes$9 = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
28061
+ const XML_NODE_NAME$a = "w:u";
28062
+ const SD_ATTR_KEY$9 = "underline";
28063
+ const encode$s = (params, encodedAttrs = {}) => {
28064
+ const { nodes } = params;
28065
+ const node = nodes?.[0];
28066
+ const sourceAttrs = node?.attributes || {};
28067
+ const underlineType = encodedAttrs.underline ?? sourceAttrs["w:val"];
28068
+ const color = encodedAttrs.color ?? sourceAttrs["w:color"];
28069
+ const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
28070
+ const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
28071
+ const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
28072
+ const attributes = { "w:val": underlineType ?? null };
28073
+ if (color !== void 0 && color !== null) attributes["w:color"] = color;
28074
+ if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
28075
+ if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
28076
+ if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
28077
+ return {
28078
+ type: "attr",
28079
+ xmlName: XML_NODE_NAME$a,
28080
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
28081
+ attributes
28082
+ };
27922
28083
  };
27923
- const translator = NodeTranslator.from(config);
28084
+ const decode$j = (params) => {
28085
+ const attrs = params?.node?.attrs || {};
28086
+ const underlineType = attrs.underlineType ?? attrs.underline ?? null;
28087
+ const color = attrs.underlineColor ?? attrs.color ?? null;
28088
+ const themeColor = attrs.underlineThemeColor ?? attrs.themeColor ?? null;
28089
+ const themeTint = attrs.underlineThemeTint ?? attrs.themeTint ?? null;
28090
+ const themeShade = attrs.underlineThemeShade ?? attrs.themeShade ?? null;
28091
+ if (!underlineType && !color && !themeColor && !themeTint && !themeShade) return void 0;
28092
+ const attributes = {};
28093
+ if (underlineType) attributes["w:val"] = underlineType;
28094
+ if (color) {
28095
+ const normalized = normalizeHexColor(color);
28096
+ if (normalized) attributes["w:color"] = normalized;
28097
+ }
28098
+ if (themeColor) attributes["w:themeColor"] = themeColor;
28099
+ if (themeTint) attributes["w:themeTint"] = themeTint;
28100
+ if (themeShade) attributes["w:themeShade"] = themeShade;
28101
+ return {
28102
+ name: XML_NODE_NAME$a,
28103
+ attributes
28104
+ };
28105
+ };
28106
+ const config$a = {
28107
+ xmlName: XML_NODE_NAME$a,
28108
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
28109
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
28110
+ encode: encode$s,
28111
+ decode: decode$j,
28112
+ attributes: validXmlAttributes$9
28113
+ };
28114
+ const translator$a = NodeTranslator.from(config$a);
27924
28115
  function exportSchemaToJson(params) {
27925
28116
  const { type: type2 } = params.node || {};
27926
28117
  const router = {
27927
28118
  doc: translateDocumentNode,
27928
28119
  body: translateBodyNode,
27929
28120
  heading: translateHeadingNode,
27930
- paragraph: translator$h,
28121
+ paragraph: translator$s,
27931
28122
  text: translateTextNode,
27932
28123
  bulletList: translateList,
27933
28124
  orderedList: translateList,
27934
- lineBreak: translator$j,
28125
+ lineBreak: translator$v,
27935
28126
  table: translateTable,
27936
- tableRow: translator$3,
27937
- tableCell: translator$2,
28127
+ tableRow: translator$e,
28128
+ tableCell: translator$d,
27938
28129
  bookmarkStart: translateBookmarkStart,
27939
- fieldAnnotation: translator,
27940
- tab: translator$i,
28130
+ fieldAnnotation: translator$b,
28131
+ tab: translator$t,
27941
28132
  image: translateImageNode,
27942
- hardBreak: translator$j,
28133
+ hardBreak: translator$v,
27943
28134
  commentRangeStart: () => translateCommentNode(params, "Start"),
27944
28135
  commentRangeEnd: () => translateCommentNode(params, "End"),
27945
28136
  commentReference: () => null,
27946
28137
  shapeContainer: translateShapeContainer,
27947
28138
  shapeTextbox: translateShapeTextbox,
27948
28139
  contentBlock: translateContentBlock,
27949
- structuredContent: translator,
27950
- structuredContentBlock: translator,
27951
- documentSection: translator,
28140
+ structuredContent: translator$b,
28141
+ structuredContentBlock: translator$b,
28142
+ documentSection: translator$b,
27952
28143
  "page-number": translatePageNumberNode,
27953
28144
  "total-page-number": translateTotalPageNumberNode
27954
28145
  };
@@ -28271,7 +28462,7 @@ function translateTextNode(params) {
28271
28462
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
28272
28463
  if (isTrackedNode) return translateTrackedNode(params);
28273
28464
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
28274
- if (isLinkNode) return translator$1.decode(params);
28465
+ if (isLinkNode) return translator$c.decode(params);
28275
28466
  const { text, marks = [] } = node;
28276
28467
  return getTextNodeForExport(text, marks, params);
28277
28468
  }
@@ -28756,10 +28947,20 @@ function translateMark(mark) {
28756
28947
  delete markElement.attributes;
28757
28948
  markElement.type = "element";
28758
28949
  break;
28759
- case "underline":
28760
- markElement.type = "element";
28761
- markElement.attributes["w:val"] = attrs.underlineType;
28762
- break;
28950
+ case "underline": {
28951
+ const translated = translator$a.decode({
28952
+ node: {
28953
+ attrs: {
28954
+ underlineType: attrs.underlineType ?? attrs.underline ?? null,
28955
+ underlineColor: attrs.underlineColor ?? attrs.color ?? null,
28956
+ underlineThemeColor: attrs.underlineThemeColor ?? attrs.themeColor ?? null,
28957
+ underlineThemeTint: attrs.underlineThemeTint ?? attrs.themeTint ?? null,
28958
+ underlineThemeShade: attrs.underlineThemeShade ?? attrs.themeShade ?? null
28959
+ }
28960
+ }
28961
+ });
28962
+ return translated || {};
28963
+ }
28763
28964
  // Text style cases
28764
28965
  case "fontSize":
28765
28966
  value = attrs.fontSize;
@@ -28801,12 +29002,11 @@ function translateMark(mark) {
28801
29002
  case "lineHeight":
28802
29003
  markElement.attributes["w:line"] = linesToTwips(attrs.lineHeight);
28803
29004
  break;
28804
- case "highlight":
28805
- markElement.attributes["w:fill"] = attrs.color?.substring(1);
28806
- markElement.attributes["w:color"] = "auto";
28807
- markElement.attributes["w:val"] = "clear";
28808
- markElement.name = "w:shd";
28809
- break;
29005
+ case "highlight": {
29006
+ const highlightValue = attrs.color ?? attrs.highlight ?? null;
29007
+ const translated = translator$u.decode({ node: { attrs: { highlight: highlightValue } } });
29008
+ return translated || {};
29009
+ }
28810
29010
  }
28811
29011
  return markElement;
28812
29012
  }
@@ -29674,82 +29874,912 @@ const trackChangeNodeHandlerEntity = {
29674
29874
  handlerName: "trackChangeNodeHandler",
29675
29875
  handler: handleTrackChangeNode
29676
29876
  };
29677
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$1);
29678
- const handleRunNode = (params) => {
29679
- const { nodes, nodeListHandler, parentStyleId, docx } = params;
29680
- if (nodes.length === 0 || nodes[0].name !== "w:r") {
29681
- return { nodes: [], consumed: 0 };
29682
- }
29877
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$c);
29878
+ const encode$r = (attributes) => {
29879
+ const raw = attributes?.["w:val"];
29880
+ if (raw === void 0 || raw === null) return void 0;
29881
+ if (typeof raw === "boolean") return raw;
29882
+ if (typeof raw === "number") return raw !== 0;
29883
+ const val = String(raw).trim().toLowerCase();
29884
+ if (val === "0" || val === "false" || val === "off") return false;
29885
+ if (val === "1" || val === "true" || val === "on") return true;
29886
+ return void 0;
29887
+ };
29888
+ const decode$i = (runProps) => {
29889
+ if (runProps?.bold === false) return "0";
29890
+ return void 0;
29891
+ };
29892
+ const attrConfig$h = Object.freeze({
29893
+ xmlName: "w:val",
29894
+ sdName: "bold",
29895
+ encode: encode$r,
29896
+ decode: decode$i
29897
+ });
29898
+ const validXmlAttributes$8 = [attrConfig$h];
29899
+ const XML_NODE_NAME$9 = "w:b";
29900
+ const SD_ATTR_KEY$8 = "bold";
29901
+ const encode$q = (params, encodedAttrs = {}) => {
29902
+ const { nodes } = params;
29683
29903
  const node = nodes[0];
29684
- const childParams = { ...params, nodes: node.elements, path: [...params.path || [], node] };
29685
- let processedRun = nodeListHandler.handler(childParams)?.filter((n) => n) || [];
29686
- const hasRunProperties = node.elements?.some((el) => el.name === "w:rPr");
29687
- const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
29688
- if (hasRunProperties) {
29689
- const { marks = [] } = parseProperties(node);
29690
- let runStyleAttributes = [];
29691
- const runStyleElement = node.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
29692
- let runStyleId;
29693
- if (runStyleElement && runStyleElement.attributes?.["w:val"] && docx) {
29694
- runStyleId = runStyleElement.attributes["w:val"];
29695
- const runStyleDefinition = getMarksFromStyles(docx, runStyleId);
29696
- if (runStyleDefinition.marks && runStyleDefinition.marks.length > 0) {
29697
- runStyleAttributes = runStyleDefinition.marks;
29698
- }
29699
- }
29700
- let paragraphStyleAttributes = [];
29701
- if (defaultNodeStyles.marks) {
29702
- paragraphStyleAttributes = defaultNodeStyles.marks.filter((mark) => {
29703
- if (["bold"].includes(mark.type) && marks.find((m2) => m2.type === "bold")?.attrs?.value === "0") {
29704
- return false;
29705
- }
29706
- return true;
29707
- });
29708
- }
29709
- const combinedMarks = [...paragraphStyleAttributes];
29710
- runStyleAttributes.forEach((runStyle) => {
29711
- const exists = combinedMarks.some(
29712
- (mark) => mark.type === runStyle.type && JSON.stringify(mark.attrs || {}) === JSON.stringify(runStyle.attrs || {})
29713
- );
29714
- if (!exists) {
29715
- combinedMarks.push(runStyle);
29904
+ if (!node) return void 0;
29905
+ const val = encodedAttrs?.[SD_ATTR_KEY$8];
29906
+ let attributes;
29907
+ if (val === false) attributes = { "w:val": "0" };
29908
+ else if (val === true)
29909
+ attributes = {};
29910
+ else attributes = node.attributes || {};
29911
+ return {
29912
+ type: "attr",
29913
+ xmlName: XML_NODE_NAME$9,
29914
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
29915
+ attributes
29916
+ };
29917
+ };
29918
+ const config$9 = {
29919
+ xmlName: XML_NODE_NAME$9,
29920
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
29921
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
29922
+ encode: encode$q,
29923
+ attributes: validXmlAttributes$8
29924
+ };
29925
+ const translator$9 = NodeTranslator.from(config$9);
29926
+ const encode$p = (attributes) => {
29927
+ const raw = attributes?.["w:val"];
29928
+ if (raw === void 0 || raw === null) return void 0;
29929
+ if (typeof raw === "boolean") return raw;
29930
+ if (typeof raw === "number") return raw !== 0;
29931
+ const val = String(raw).trim().toLowerCase();
29932
+ if (val === "0" || val === "false" || val === "off") return false;
29933
+ if (val === "1" || val === "true" || val === "on") return true;
29934
+ return void 0;
29935
+ };
29936
+ const decode$h = (attrs) => {
29937
+ if (attrs?.italic === false) return "0";
29938
+ return void 0;
29939
+ };
29940
+ const attrConfig$g = Object.freeze({
29941
+ xmlName: "w:val",
29942
+ sdName: "italic",
29943
+ encode: encode$p,
29944
+ decode: decode$h
29945
+ });
29946
+ const validXmlAttributes$7 = [attrConfig$g];
29947
+ const XML_NODE_NAME$8 = "w:i";
29948
+ const SD_ATTR_KEY$7 = "italic";
29949
+ const encode$o = (params, encodedAttrs = {}) => {
29950
+ const { nodes } = params;
29951
+ const node = nodes?.[0];
29952
+ if (!node) return void 0;
29953
+ const val = encodedAttrs?.[SD_ATTR_KEY$7];
29954
+ let attributes;
29955
+ if (val === false) attributes = { "w:val": "0" };
29956
+ else if (val === true) attributes = {};
29957
+ else attributes = { ...node.attributes || {} };
29958
+ if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
29959
+ else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
29960
+ return {
29961
+ type: "attr",
29962
+ xmlName: XML_NODE_NAME$8,
29963
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
29964
+ attributes
29965
+ };
29966
+ };
29967
+ const config$8 = {
29968
+ xmlName: XML_NODE_NAME$8,
29969
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
29970
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
29971
+ encode: encode$o,
29972
+ attributes: validXmlAttributes$7
29973
+ };
29974
+ const translator$8 = NodeTranslator.from(config$8);
29975
+ const encode$n = (attributes) => {
29976
+ const raw = attributes?.["w:val"];
29977
+ if (raw === void 0 || raw === null) return void 0;
29978
+ if (typeof raw === "boolean") return raw;
29979
+ if (typeof raw === "number") return raw !== 0;
29980
+ const val = String(raw).trim().toLowerCase();
29981
+ if (val === "0" || val === "false" || val === "off") return false;
29982
+ if (val === "1" || val === "true" || val === "on") return true;
29983
+ return void 0;
29984
+ };
29985
+ const decode$g = (attrs) => {
29986
+ if (attrs?.strike === false) return "0";
29987
+ return void 0;
29988
+ };
29989
+ const attrConfig$f = Object.freeze({
29990
+ xmlName: "w:val",
29991
+ sdName: "strike",
29992
+ encode: encode$n,
29993
+ decode: decode$g
29994
+ });
29995
+ const validXmlAttributes$6 = [attrConfig$f];
29996
+ const XML_NODE_NAME$7 = "w:strike";
29997
+ const SD_ATTR_KEY$6 = "strike";
29998
+ const encode$m = (params, encodedAttrs = {}) => {
29999
+ const { nodes } = params;
30000
+ const node = nodes?.[0];
30001
+ if (!node) return void 0;
30002
+ const val = encodedAttrs?.[SD_ATTR_KEY$6];
30003
+ let attributes;
30004
+ if (val === false) attributes = { "w:val": "0" };
30005
+ else if (val === true) attributes = {};
30006
+ else attributes = { ...node.attributes || {} };
30007
+ if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
30008
+ else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
30009
+ return {
30010
+ type: "attr",
30011
+ xmlName: XML_NODE_NAME$7,
30012
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
30013
+ attributes
30014
+ };
30015
+ };
30016
+ const config$7 = {
30017
+ xmlName: XML_NODE_NAME$7,
30018
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
30019
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30020
+ encode: encode$m,
30021
+ attributes: validXmlAttributes$6
30022
+ };
30023
+ const translator$7 = NodeTranslator.from(config$7);
30024
+ const encode$l = (attributes) => attributes?.["w:val"];
30025
+ const decode$f = (attrs) => attrs?.color;
30026
+ const attrConfig$e = Object.freeze({
30027
+ xmlName: "w:val",
30028
+ sdName: "color",
30029
+ encode: encode$l,
30030
+ decode: decode$f
30031
+ });
30032
+ const encode$k = (attributes) => attributes?.["w:themeColor"];
30033
+ const decode$e = (attrs) => attrs?.themeColor;
30034
+ const attrConfig$d = Object.freeze({
30035
+ xmlName: "w:themeColor",
30036
+ sdName: "themeColor",
30037
+ encode: encode$k,
30038
+ decode: decode$e
30039
+ });
30040
+ const encode$j = (attributes) => attributes?.["w:themeTint"];
30041
+ const decode$d = (attrs) => attrs?.themeTint;
30042
+ const attrConfig$c = Object.freeze({
30043
+ xmlName: "w:themeTint",
30044
+ sdName: "themeTint",
30045
+ encode: encode$j,
30046
+ decode: decode$d
30047
+ });
30048
+ const encode$i = (attributes) => attributes?.["w:themeShade"];
30049
+ const decode$c = (attrs) => attrs?.themeShade;
30050
+ const attrConfig$b = Object.freeze({
30051
+ xmlName: "w:themeShade",
30052
+ sdName: "themeShade",
30053
+ encode: encode$i,
30054
+ decode: decode$c
30055
+ });
30056
+ const validXmlAttributes$5 = [attrConfig$e, attrConfig$d, attrConfig$c, attrConfig$b];
30057
+ const XML_NODE_NAME$6 = "w:color";
30058
+ const SD_ATTR_KEY$5 = "color";
30059
+ const encode$h = (params, encodedAttrs = {}) => {
30060
+ const { nodes } = params;
30061
+ const node = nodes?.[0];
30062
+ const sourceAttrs = node?.attributes || {};
30063
+ const value = encodedAttrs.color ?? sourceAttrs["w:val"];
30064
+ const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
30065
+ const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
30066
+ const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
30067
+ const attributes = {};
30068
+ attributes["w:val"] = value ?? null;
30069
+ if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
30070
+ if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
30071
+ if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
30072
+ return {
30073
+ type: "attr",
30074
+ xmlName: XML_NODE_NAME$6,
30075
+ sdNodeOrKeyName: SD_ATTR_KEY$5,
30076
+ attributes
30077
+ };
30078
+ };
30079
+ const config$6 = {
30080
+ xmlName: XML_NODE_NAME$6,
30081
+ sdNodeOrKeyName: SD_ATTR_KEY$5,
30082
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30083
+ encode: encode$h,
30084
+ attributes: validXmlAttributes$5
30085
+ };
30086
+ const translator$6 = NodeTranslator.from(config$6);
30087
+ const encode$g = (attributes) => attributes?.["w:eastAsia"];
30088
+ const decode$b = (attrs) => attrs?.eastAsia;
30089
+ const attrConfig$a = Object.freeze({
30090
+ xmlName: "w:eastAsia",
30091
+ sdName: "eastAsia",
30092
+ encode: encode$g,
30093
+ decode: decode$b
30094
+ });
30095
+ const encode$f = (attributes) => attributes?.["w:ascii"];
30096
+ const decode$a = (attrs) => attrs?.ascii;
30097
+ const attrConfig$9 = Object.freeze({
30098
+ xmlName: "w:ascii",
30099
+ sdName: "ascii",
30100
+ encode: encode$f,
30101
+ decode: decode$a
30102
+ });
30103
+ const encode$e = (attributes) => attributes?.["w:hAnsi"];
30104
+ const decode$9 = (attrs) => attrs?.hAnsi;
30105
+ const attrConfig$8 = Object.freeze({
30106
+ xmlName: "w:hAnsi",
30107
+ sdName: "hAnsi",
30108
+ encode: encode$e,
30109
+ decode: decode$9
30110
+ });
30111
+ const encode$d = (attributes) => attributes?.["w:cs"];
30112
+ const decode$8 = (attrs) => attrs?.cs;
30113
+ const attrConfig$7 = Object.freeze({
30114
+ xmlName: "w:cs",
30115
+ sdName: "cs",
30116
+ encode: encode$d,
30117
+ decode: decode$8
30118
+ });
30119
+ const encode$c = (attributes) => attributes?.["w:val"];
30120
+ const decode$7 = (attrs) => attrs?.value;
30121
+ const attrConfig$6 = Object.freeze({
30122
+ xmlName: "w:val",
30123
+ sdName: "value",
30124
+ encode: encode$c,
30125
+ decode: decode$7
30126
+ });
30127
+ const validXmlAttributes$4 = [attrConfig$a, attrConfig$9, attrConfig$8, attrConfig$7, attrConfig$6];
30128
+ const XML_NODE_NAME$5 = "w:rFonts";
30129
+ const SD_ATTR_KEY$4 = "fontFamily";
30130
+ const encode$b = (params, encodedAttrs = {}) => {
30131
+ const { nodes } = params;
30132
+ const node = nodes?.[0];
30133
+ const sourceAttrs = node?.attributes || {};
30134
+ const attributes = {};
30135
+ const setAttr = (xmlName, sdName) => {
30136
+ if (encodedAttrs[sdName] !== void 0 && encodedAttrs[sdName] !== null) {
30137
+ attributes[xmlName] = encodedAttrs[sdName];
30138
+ } else if (sourceAttrs[xmlName] !== void 0) {
30139
+ attributes[xmlName] = sourceAttrs[xmlName];
30140
+ }
30141
+ };
30142
+ setAttr("w:eastAsia", "eastAsia");
30143
+ setAttr("w:ascii", "ascii");
30144
+ setAttr("w:hAnsi", "hAnsi");
30145
+ setAttr("w:cs", "cs");
30146
+ setAttr("w:val", "value");
30147
+ Object.keys(sourceAttrs).forEach((key) => {
30148
+ if (attributes[key] === void 0) attributes[key] = sourceAttrs[key];
30149
+ });
30150
+ if (attributes["w:val"] === void 0 && attributes["w:eastAsia"]) {
30151
+ attributes["w:val"] = attributes["w:eastAsia"];
30152
+ }
30153
+ if (attributes["w:val"] === void 0) delete attributes["w:val"];
30154
+ return {
30155
+ type: "attr",
30156
+ xmlName: XML_NODE_NAME$5,
30157
+ sdNodeOrKeyName: SD_ATTR_KEY$4,
30158
+ attributes
30159
+ };
30160
+ };
30161
+ const config$5 = {
30162
+ xmlName: XML_NODE_NAME$5,
30163
+ sdNodeOrKeyName: SD_ATTR_KEY$4,
30164
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30165
+ encode: encode$b,
30166
+ attributes: validXmlAttributes$4
30167
+ };
30168
+ const translator$5 = NodeTranslator.from(config$5);
30169
+ const encode$a = (attributes) => attributes?.["w:val"];
30170
+ const decode$6 = (attrs) => attrs?.styleId;
30171
+ const attrConfig$5 = Object.freeze({
30172
+ xmlName: "w:val",
30173
+ sdName: "styleId",
30174
+ encode: encode$a,
30175
+ decode: decode$6
30176
+ });
30177
+ const validXmlAttributes$3 = [attrConfig$5];
30178
+ const XML_NODE_NAME$4 = "w:rStyle";
30179
+ const SD_ATTR_KEY$3 = "styleId";
30180
+ const encode$9 = (params, encodedAttrs = {}) => {
30181
+ const { nodes } = params;
30182
+ const node = nodes?.[0];
30183
+ const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
30184
+ return {
30185
+ type: "attr",
30186
+ xmlName: XML_NODE_NAME$4,
30187
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
30188
+ attributes: { "w:val": value ?? null }
30189
+ };
30190
+ };
30191
+ const config$4 = {
30192
+ xmlName: XML_NODE_NAME$4,
30193
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
30194
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30195
+ encode: encode$9,
30196
+ attributes: validXmlAttributes$3
30197
+ };
30198
+ const translator$4 = NodeTranslator.from(config$4);
30199
+ const encode$8 = (attributes) => attributes?.["w:val"];
30200
+ const decode$5 = (attrs) => attrs?.fontSize;
30201
+ const attrConfig$4 = Object.freeze({
30202
+ xmlName: "w:val",
30203
+ sdName: "fontSize",
30204
+ encode: encode$8,
30205
+ decode: decode$5
30206
+ });
30207
+ const validXmlAttributes$2 = [attrConfig$4];
30208
+ const XML_NODE_NAME$3 = "w:sz";
30209
+ const SD_ATTR_KEY$2 = "fontSize";
30210
+ const encode$7 = (params, encodedAttrs = {}) => {
30211
+ const { nodes } = params;
30212
+ const node = nodes?.[0];
30213
+ const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
30214
+ return {
30215
+ type: "attr",
30216
+ xmlName: XML_NODE_NAME$3,
30217
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
30218
+ attributes: { "w:val": value ?? null }
30219
+ };
30220
+ };
30221
+ const config$3 = {
30222
+ xmlName: XML_NODE_NAME$3,
30223
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
30224
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30225
+ encode: encode$7,
30226
+ attributes: validXmlAttributes$2
30227
+ };
30228
+ const translator$3 = NodeTranslator.from(config$3);
30229
+ const encode$6 = (attributes) => attributes?.["w:val"];
30230
+ const decode$4 = (attrs) => attrs?.fontSizeCs;
30231
+ const attrConfig$3 = Object.freeze({
30232
+ xmlName: "w:val",
30233
+ sdName: "fontSizeCs",
30234
+ encode: encode$6,
30235
+ decode: decode$4
30236
+ });
30237
+ const validXmlAttributes$1 = [attrConfig$3];
30238
+ const XML_NODE_NAME$2 = "w:szCs";
30239
+ const SD_ATTR_KEY$1 = "fontSizeCs";
30240
+ const encode$5 = (params, encodedAttrs = {}) => {
30241
+ const { nodes } = params;
30242
+ const node = nodes?.[0];
30243
+ const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
30244
+ return {
30245
+ type: "attr",
30246
+ xmlName: XML_NODE_NAME$2,
30247
+ sdNodeOrKeyName: SD_ATTR_KEY$1,
30248
+ attributes: { "w:val": value ?? null }
30249
+ };
30250
+ };
30251
+ const config$2 = {
30252
+ xmlName: XML_NODE_NAME$2,
30253
+ sdNodeOrKeyName: SD_ATTR_KEY$1,
30254
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30255
+ encode: encode$5,
30256
+ attributes: validXmlAttributes$1
30257
+ };
30258
+ const translator$2 = NodeTranslator.from(config$2);
30259
+ const runPropertyTranslators = Object.freeze({
30260
+ "w:b": translator$9,
30261
+ "w:i": translator$8,
30262
+ "w:u": translator$a,
30263
+ "w:strike": translator$7,
30264
+ "w:color": translator$6,
30265
+ "w:highlight": translator$u,
30266
+ "w:rFonts": translator$5,
30267
+ "w:rStyle": translator$4,
30268
+ "w:sz": translator$3,
30269
+ "w:szCs": translator$2
30270
+ });
30271
+ const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
30272
+ const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
30273
+ const KNOWN_CHILD_XML_NAMES = /* @__PURE__ */ new Set([...Object.keys(runPropertyTranslators), ...RAW_CHILD_NAME_SET]);
30274
+ const toRunPropertyEntry = (candidate) => {
30275
+ if (!candidate || candidate.type !== "attr") return null;
30276
+ const xmlName = candidate.xmlName || candidate.name;
30277
+ if (!xmlName) return null;
30278
+ return {
30279
+ xmlName,
30280
+ attributes: { ...candidate.attributes || {} }
30281
+ };
30282
+ };
30283
+ const XML_NODE_NAME$1 = "w:rPr";
30284
+ const SD_ATTR_KEY = "runProperties";
30285
+ const encode$4 = (params) => {
30286
+ const { nodes } = params;
30287
+ const node = nodes?.[0] || {};
30288
+ const contents = Array.isArray(node.elements) ? node.elements : [];
30289
+ const runPropsArray = contents.reduce(
30290
+ (acc, child) => {
30291
+ if (!child || typeof child !== "object") return acc;
30292
+ const xmlName = child.name;
30293
+ if (!KNOWN_CHILD_XML_NAMES.has(xmlName)) return acc;
30294
+ const translator2 = runPropertyTranslators[xmlName];
30295
+ let entry = null;
30296
+ if (translator2) {
30297
+ const encoded = translator2.encode({ ...params, nodes: [child] }) || null;
30298
+ entry = toRunPropertyEntry(encoded);
30299
+ } else if (RAW_CHILD_NAME_SET.has(xmlName)) {
30300
+ entry = toRunPropertyEntry({
30301
+ type: "attr",
30302
+ xmlName,
30303
+ attributes: { ...child.attributes || {} }
30304
+ });
29716
30305
  }
30306
+ if (entry) acc.push(entry);
30307
+ return acc;
30308
+ },
30309
+ /** @type {{ xmlName: string, attributes: Record<string, any> }[]} */
30310
+ []
30311
+ );
30312
+ return {
30313
+ type: "attr",
30314
+ xmlName: "w:rPr",
30315
+ sdNodeOrKeyName: "runProperties",
30316
+ attributes: runPropsArray
30317
+ };
30318
+ };
30319
+ const config$1 = {
30320
+ xmlName: XML_NODE_NAME$1,
30321
+ sdNodeOrKeyName: SD_ATTR_KEY,
30322
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
30323
+ encode: encode$4
30324
+ };
30325
+ const translator$1 = NodeTranslator.from(config$1);
30326
+ const collectRunProperties = (params, rPrNode, translator2 = translator$1) => {
30327
+ if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
30328
+ const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
30329
+ let entries = [];
30330
+ if (Array.isArray(result.attributes) && result.attributes.length) {
30331
+ entries = result.attributes.map((attr) => ({
30332
+ xmlName: attr?.xmlName,
30333
+ attributes: { ...attr?.attributes || {} }
30334
+ }));
30335
+ } else if (Array.isArray(rPrNode.elements) && rPrNode.elements.length) {
30336
+ entries = rPrNode.elements.filter((el) => el && typeof el === "object").map((el) => ({
30337
+ xmlName: el.name,
30338
+ attributes: { ...el.attributes || {} }
30339
+ }));
30340
+ }
30341
+ const legacyMarks = parseMarks(rPrNode, [], params?.docx) || [];
30342
+ const styleChangeMarks = handleStyleChangeMarks(rPrNode, legacyMarks) || [];
30343
+ return { entries, hadRPr: true, styleChangeMarks };
30344
+ };
30345
+ const buildRunAttrs = (encodedAttrs = {}, hadRPr, runProps) => {
30346
+ const base = { ...encodedAttrs || {} };
30347
+ if (hadRPr) {
30348
+ base.runProperties = runProps.length ? runProps : null;
30349
+ }
30350
+ return base;
30351
+ };
30352
+ const ensureRunMark = (marks, runAttrs) => {
30353
+ if (!runAttrs) return;
30354
+ const runMark = createRunMark(runAttrs);
30355
+ const runMarkIndex = marks.findIndex((mark) => mark?.type === "run");
30356
+ if (runMarkIndex >= 0) {
30357
+ const existing = marks[runMarkIndex];
30358
+ if (runMark.attrs) {
30359
+ marks[runMarkIndex] = { ...existing, attrs: mergeRunAttrs(existing?.attrs, runMark.attrs) };
30360
+ }
30361
+ return;
30362
+ }
30363
+ marks.push(runMark);
30364
+ };
30365
+ const ensureInlineMarks = (marks, inlineMarks = []) => {
30366
+ inlineMarks.forEach(({ type: type2, attrs }) => {
30367
+ if (!type2) return;
30368
+ if (marks.some((mark) => mark?.type === type2)) return;
30369
+ marks.push(attrs ? { type: type2, attrs: { ...attrs } } : { type: type2 });
30370
+ });
30371
+ };
30372
+ const ensureTextStyleMark = (marks, textStyleAttrs) => {
30373
+ if (!textStyleAttrs) return;
30374
+ const existingTextStyle = marks.find((mark) => mark?.type === "textStyle");
30375
+ if (existingTextStyle) {
30376
+ existingTextStyle.attrs = { ...existingTextStyle.attrs || {}, ...textStyleAttrs };
30377
+ return;
30378
+ }
30379
+ marks.push({ type: "textStyle", attrs: { ...textStyleAttrs } });
30380
+ };
30381
+ const applyRunMarks = (node, runAttrs, inlineMarks, textStyleAttrs) => {
30382
+ if (!node || typeof node !== "object") return node;
30383
+ const baseMarks = Array.isArray(node.marks) ? node.marks : [];
30384
+ const marks = baseMarks.map((mark) => cloneMark(mark));
30385
+ ensureRunMark(marks, runAttrs);
30386
+ ensureInlineMarks(marks, inlineMarks);
30387
+ if (node.type === "text") {
30388
+ ensureTextStyleMark(marks, textStyleAttrs);
30389
+ }
30390
+ return { ...node, marks };
30391
+ };
30392
+ const createRunMark = (attrs = {}) => {
30393
+ const hasAttrs = attrs && Object.keys(attrs).length > 0;
30394
+ return hasAttrs ? { type: "run", attrs: cloneRunAttrs(attrs) } : { type: "run" };
30395
+ };
30396
+ const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
30397
+ const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
30398
+ const runStyleMarks = collectStyleMarks(runStyleId, docx);
30399
+ const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
30400
+ const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
30401
+ return { inlineMarks, textStyleAttrs };
30402
+ };
30403
+ const collectStyleMarks = (styleId, docx, seen = /* @__PURE__ */ new Set()) => {
30404
+ if (!styleId || !docx || seen.has(styleId)) return { inlineMarks: [], textStyleAttrs: null };
30405
+ seen.add(styleId);
30406
+ const chain = collectStyleChain(styleId, docx, seen);
30407
+ if (!chain.length) return { inlineMarks: [], textStyleAttrs: null };
30408
+ const inlineMap = /* @__PURE__ */ new Map();
30409
+ let textStyleAttrs = {};
30410
+ chain.forEach((styleTag) => {
30411
+ const marks = extractMarksFromStyle(styleTag, docx);
30412
+ marks.inlineMarks.forEach((mark) => {
30413
+ inlineMap.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
29717
30414
  });
30415
+ if (marks.textStyleAttrs) textStyleAttrs = { ...textStyleAttrs, ...marks.textStyleAttrs };
30416
+ });
30417
+ return {
30418
+ inlineMarks: Array.from(inlineMap.values()),
30419
+ textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
30420
+ };
30421
+ };
30422
+ const collectStyleChain = (styleId, docx, seen) => {
30423
+ if (!styleId || !docx) return [];
30424
+ const styleTag = findStyleTag(docx, styleId);
30425
+ if (!styleTag || !styleTag.elements) return [];
30426
+ const basedOn = styleTag.elements?.find((el) => el.name === "w:basedOn")?.attributes?.["w:val"];
30427
+ let chain = [];
30428
+ if (basedOn && !seen.has(basedOn)) {
30429
+ seen.add(basedOn);
30430
+ chain = collectStyleChain(basedOn, docx, seen);
30431
+ }
30432
+ chain.push(styleTag);
30433
+ return chain;
30434
+ };
30435
+ const findStyleTag = (docx, styleId) => {
30436
+ const stylesFile = docx?.["word/styles.xml"];
30437
+ if (!stylesFile?.elements?.length) return null;
30438
+ const candidates = [];
30439
+ stylesFile.elements.forEach((el) => {
30440
+ if (!el) return;
30441
+ if (el.name === "w:styles" && Array.isArray(el.elements)) {
30442
+ el.elements.forEach((child) => {
30443
+ if (child?.name === "w:style") candidates.push(child);
30444
+ });
30445
+ return;
30446
+ }
30447
+ if (el.name === "w:style") {
30448
+ candidates.push(el);
30449
+ return;
30450
+ }
30451
+ if (Array.isArray(el.elements)) {
30452
+ el.elements.forEach((child) => {
30453
+ if (child?.name === "w:style") candidates.push(child);
30454
+ });
30455
+ }
30456
+ });
30457
+ return candidates.find((tag) => tag?.attributes?.["w:styleId"] === styleId) || null;
30458
+ };
30459
+ const extractMarksFromStyle = (styleTag, docx) => {
30460
+ const rPr = styleTag?.elements?.find((el) => el.name === "w:rPr");
30461
+ if (!rPr) return { inlineMarks: [], textStyleAttrs: null };
30462
+ const marks = parseMarks(rPr, [], docx) || [];
30463
+ const inlineMarks = [];
30464
+ let textStyleAttrs = {};
30465
+ marks.forEach((mark) => {
30466
+ if (!mark) return;
30467
+ if (mark.type === "textStyle") {
30468
+ const attrs = mark.attrs || {};
30469
+ if (Object.keys(attrs).length) textStyleAttrs = { ...textStyleAttrs, ...attrs };
30470
+ return;
30471
+ }
30472
+ if (mark.type) inlineMarks.push(mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
30473
+ });
30474
+ return {
30475
+ inlineMarks,
30476
+ textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
30477
+ };
30478
+ };
30479
+ const mergeInlineMarkSets = (...markSets) => {
30480
+ const map = /* @__PURE__ */ new Map();
30481
+ markSets.filter(Boolean).forEach((marks) => {
29718
30482
  marks.forEach((mark) => {
29719
- const exists = combinedMarks.some(
29720
- (existing) => existing.type === mark.type && JSON.stringify(existing.attrs || {}) === JSON.stringify(mark.attrs || {})
29721
- );
29722
- if (!exists) {
29723
- combinedMarks.push(mark);
29724
- }
30483
+ if (!mark || !mark.type) return;
30484
+ map.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
29725
30485
  });
29726
- if (runStyleId) combinedMarks.push({ type: "textStyle", attrs: { styleId: runStyleId } });
29727
- if (node.marks) combinedMarks.push(...node.marks);
29728
- const newMarks = createImportMarks(combinedMarks);
29729
- processedRun = processedRun.map((n) => {
29730
- const existingMarks = n.marks || [];
29731
- return {
29732
- ...n,
29733
- marks: [...newMarks, ...existingMarks]
29734
- };
30486
+ });
30487
+ return Array.from(map.values());
30488
+ };
30489
+ const mergeTextStyleAttrs = (...attrsList) => {
30490
+ const merged = attrsList.filter((attrs) => attrs && Object.keys(attrs).length).reduce((acc, attrs) => ({ ...acc, ...attrs }), {});
30491
+ return Object.keys(merged).length ? merged : null;
30492
+ };
30493
+ const cloneRunAttrs = (attrs) => {
30494
+ const clone = { ...attrs };
30495
+ if (Array.isArray(attrs?.runProperties)) {
30496
+ clone.runProperties = attrs.runProperties.map((entry) => ({
30497
+ xmlName: entry?.xmlName,
30498
+ attributes: { ...entry?.attributes || {} }
30499
+ }));
30500
+ }
30501
+ return clone;
30502
+ };
30503
+ const cloneMark = (mark) => {
30504
+ if (!mark || typeof mark !== "object") return mark;
30505
+ const cloned = { ...mark };
30506
+ if (mark.attrs && typeof mark.attrs === "object") {
30507
+ cloned.attrs = { ...mark.attrs };
30508
+ if (Array.isArray(mark.attrs.runProperties)) {
30509
+ cloned.attrs.runProperties = mark.attrs.runProperties.map((entry) => ({
30510
+ xmlName: entry?.xmlName,
30511
+ attributes: { ...entry?.attributes || {} }
30512
+ }));
30513
+ }
30514
+ }
30515
+ return cloned;
30516
+ };
30517
+ const mergeRunAttrs = (existing = {}, incoming = {}) => {
30518
+ const merged = { ...existing, ...cloneRunAttrs(incoming) };
30519
+ if (Array.isArray(existing?.runProperties) && Array.isArray(incoming?.runProperties)) {
30520
+ const seen = /* @__PURE__ */ new Set();
30521
+ const combined = [...existing.runProperties, ...incoming.runProperties];
30522
+ merged.runProperties = combined.filter((entry) => {
30523
+ const key = entry?.xmlName;
30524
+ if (!key || seen.has(key)) return false;
30525
+ seen.add(key);
30526
+ return true;
29735
30527
  });
29736
30528
  }
29737
- return { nodes: processedRun, consumed: 1 };
30529
+ return merged;
29738
30530
  };
29739
- const getMarksFromStyles = (docx, styleId) => {
29740
- const styles = docx?.["word/styles.xml"];
29741
- if (!styles) {
29742
- return {};
30531
+ const normalizeBool = (value) => {
30532
+ if (value === void 0 || value === null) return true;
30533
+ if (typeof value === "boolean") return value;
30534
+ if (typeof value === "number") return value !== 0;
30535
+ const normalized = String(value).trim().toLowerCase();
30536
+ if (normalized === "0" || normalized === "false" || normalized === "off") return false;
30537
+ if (normalized === "1" || normalized === "true" || normalized === "on") return true;
30538
+ return true;
30539
+ };
30540
+ const resolveRunElement = (node) => {
30541
+ if (!node) return null;
30542
+ if (node.name === "w:r") return node;
30543
+ return (node.elements || []).find((el) => el.name === "w:r") || null;
30544
+ };
30545
+ const ensureRunPropertiesContainer = (runElement) => {
30546
+ if (!Array.isArray(runElement.elements)) runElement.elements = [];
30547
+ let rPr = runElement.elements.find((el) => el.name === "w:rPr");
30548
+ if (!rPr) {
30549
+ rPr = { name: "w:rPr", elements: [] };
30550
+ runElement.elements.unshift(rPr);
30551
+ }
30552
+ if (!Array.isArray(rPr.elements)) rPr.elements = [];
30553
+ return rPr;
30554
+ };
30555
+ const splitRunProperties = (entries = [], docx = null) => {
30556
+ const remainingProps = [];
30557
+ const inlineMarks = [];
30558
+ const textStyleAttrs = {};
30559
+ let hasTextStyle = false;
30560
+ let highlightColor = null;
30561
+ let runStyleId = null;
30562
+ entries.forEach((entry) => {
30563
+ if (!entry || !entry.xmlName) return;
30564
+ const attributes = entry.attributes || {};
30565
+ switch (entry.xmlName) {
30566
+ case "w:b": {
30567
+ const val = normalizeBool(attributes["w:val"]);
30568
+ inlineMarks.push(val ? { type: "bold" } : { type: "bold", attrs: { value: "0" } });
30569
+ break;
30570
+ }
30571
+ case "w:i": {
30572
+ const val = normalizeBool(attributes["w:val"]);
30573
+ inlineMarks.push(val ? { type: "italic" } : { type: "italic", attrs: { value: "0" } });
30574
+ break;
30575
+ }
30576
+ case "w:u": {
30577
+ const rawVal = attributes["w:val"];
30578
+ const underlineType = rawVal == null || rawVal === "" ? "single" : String(rawVal);
30579
+ const attrs = {};
30580
+ if (underlineType.toLowerCase() === "none" || underlineType === "0") {
30581
+ attrs.underlineType = "none";
30582
+ } else {
30583
+ attrs.underlineType = underlineType;
30584
+ const colorRaw = attributes["w:color"];
30585
+ if (typeof colorRaw === "string" && colorRaw.toLowerCase() !== "auto") {
30586
+ const normalizedColor = normalizeHexColor(colorRaw);
30587
+ if (normalizedColor) attrs.underlineColor = `#${normalizedColor}`;
30588
+ }
30589
+ }
30590
+ if (attributes["w:themeColor"]) attrs.underlineThemeColor = attributes["w:themeColor"];
30591
+ if (attributes["w:themeTint"]) attrs.underlineThemeTint = attributes["w:themeTint"];
30592
+ if (attributes["w:themeShade"]) attrs.underlineThemeShade = attributes["w:themeShade"];
30593
+ inlineMarks.push({ type: "underline", attrs });
30594
+ break;
30595
+ }
30596
+ case "w:color": {
30597
+ const raw = attributes["w:val"];
30598
+ if (typeof raw === "string" && raw) {
30599
+ hasTextStyle = true;
30600
+ textStyleAttrs.color = `#${raw.replace("#", "").toUpperCase()}`;
30601
+ }
30602
+ break;
30603
+ }
30604
+ case "w:rFonts": {
30605
+ const family = attributes["w:ascii"] || attributes["w:eastAsia"] || attributes["w:hAnsi"] || attributes["w:val"];
30606
+ if (family) {
30607
+ hasTextStyle = true;
30608
+ textStyleAttrs.fontFamily = SuperConverter.toCssFontFamily(family, docx);
30609
+ }
30610
+ break;
30611
+ }
30612
+ case "w:sz":
30613
+ case "w:szCs": {
30614
+ const rawSize = Number(attributes["w:val"]);
30615
+ if (Number.isFinite(rawSize) && rawSize > 0) {
30616
+ hasTextStyle = true;
30617
+ textStyleAttrs.fontSize = `${rawSize / 2}pt`;
30618
+ }
30619
+ break;
30620
+ }
30621
+ case "w:strike": {
30622
+ const val = normalizeBool(attributes["w:val"]);
30623
+ inlineMarks.push(val ? { type: "strike" } : { type: "strike", attrs: { value: "0" } });
30624
+ break;
30625
+ }
30626
+ case "w:highlight": {
30627
+ const color = attributes["w:val"];
30628
+ if (typeof color === "string" && color) {
30629
+ highlightColor = color.toLowerCase() === "none" ? "transparent" : color;
30630
+ }
30631
+ break;
30632
+ }
30633
+ case "w:shd": {
30634
+ const fill = attributes["w:fill"];
30635
+ const shdVal = attributes["w:val"];
30636
+ if (fill && String(fill).toLowerCase() !== "auto") {
30637
+ highlightColor = `#${String(fill).replace("#", "")}`;
30638
+ } else if (typeof shdVal === "string") {
30639
+ const normalized = shdVal.toLowerCase();
30640
+ if (normalized === "clear" || normalized === "nil" || normalized === "none") {
30641
+ highlightColor = "transparent";
30642
+ }
30643
+ }
30644
+ break;
30645
+ }
30646
+ case "w:rStyle": {
30647
+ if (typeof attributes["w:val"] === "string") runStyleId = attributes["w:val"];
30648
+ remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
30649
+ break;
30650
+ }
30651
+ default: {
30652
+ remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
30653
+ }
30654
+ }
30655
+ });
30656
+ if (highlightColor) inlineMarks.push({ type: "highlight", attrs: { color: highlightColor } });
30657
+ return {
30658
+ remainingProps,
30659
+ inlineMarks,
30660
+ textStyleAttrs: hasTextStyle ? textStyleAttrs : null,
30661
+ runStyleId
30662
+ };
30663
+ };
30664
+ const encode$3 = (attributes) => {
30665
+ return attributes["w:rsidR"];
30666
+ };
30667
+ const decode$3 = (attrs) => {
30668
+ return attrs.rsidR;
30669
+ };
30670
+ const attrConfig$2 = Object.freeze({
30671
+ xmlName: "w:rsidR",
30672
+ sdName: "rsidR",
30673
+ encode: encode$3,
30674
+ decode: decode$3
30675
+ });
30676
+ const encode$2 = (attributes) => {
30677
+ return attributes["w:rsidRPr"];
30678
+ };
30679
+ const decode$2 = (attrs) => {
30680
+ return attrs.rsidRPr;
30681
+ };
30682
+ const attrConfig$1 = Object.freeze({
30683
+ xmlName: "w:rsidRPr",
30684
+ sdName: "rsidRPr",
30685
+ encode: encode$2,
30686
+ decode: decode$2
30687
+ });
30688
+ const encode$1 = (attributes) => {
30689
+ return attributes["w:rsidDel"];
30690
+ };
30691
+ const decode$1 = (attrs) => {
30692
+ return attrs.rsidDel;
30693
+ };
30694
+ const attrConfig = Object.freeze({
30695
+ xmlName: "w:rsidDel",
30696
+ sdName: "rsidDel",
30697
+ encode: encode$1,
30698
+ decode: decode$1
30699
+ });
30700
+ const validXmlAttributes = [attrConfig$2, attrConfig$1, attrConfig];
30701
+ const XML_NODE_NAME = "w:r";
30702
+ const SD_KEY_NAME = "run";
30703
+ const encode = (params, encodedAttrs = {}) => {
30704
+ const { nodes = [], nodeListHandler } = params || {};
30705
+ const runNode = nodes[0];
30706
+ if (!runNode) return void 0;
30707
+ const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
30708
+ const rPrNode = elements.find((child) => child?.name === "w:rPr");
30709
+ const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
30710
+ const { entries: runPropEntries, hadRPr, styleChangeMarks } = collectRunProperties(params, rPrNode);
30711
+ const { remainingProps, inlineMarks, textStyleAttrs, runStyleId } = splitRunProperties(runPropEntries, params?.docx);
30712
+ const styleMarks = deriveStyleMarks({
30713
+ docx: params?.docx,
30714
+ paragraphStyleId: params?.parentStyleId,
30715
+ runStyleId
30716
+ });
30717
+ const mergedInlineMarks = mergeInlineMarkSets(styleMarks.inlineMarks, inlineMarks);
30718
+ let mergedTextStyleAttrs = mergeTextStyleAttrs(styleMarks.textStyleAttrs, textStyleAttrs);
30719
+ if (runStyleId) {
30720
+ mergedTextStyleAttrs = mergedTextStyleAttrs ? { ...mergedTextStyleAttrs, styleId: runStyleId } : { styleId: runStyleId };
30721
+ }
30722
+ const runAttrs = buildRunAttrs(encodedAttrs, hadRPr, remainingProps);
30723
+ let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark(mark)) : [];
30724
+ if (styleChangeMarks?.length) {
30725
+ runLevelMarks = [...runLevelMarks, ...styleChangeMarks.map((mark) => cloneMark(mark))];
30726
+ }
30727
+ const childParams = { ...params, nodes: contentElements };
30728
+ const content = nodeListHandler?.handler(childParams) || [];
30729
+ const contentWithRunMarks = content.map((child) => {
30730
+ if (!child || typeof child !== "object") return child;
30731
+ const baseMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark(mark)) : [];
30732
+ if (!runLevelMarks.length) return child;
30733
+ return { ...child, marks: [...baseMarks, ...runLevelMarks.map((mark) => cloneMark(mark))] };
30734
+ });
30735
+ const marked = contentWithRunMarks.map(
30736
+ (child) => applyRunMarks(child, runAttrs, mergedInlineMarks, mergedTextStyleAttrs)
30737
+ );
30738
+ const filtered = marked.filter(Boolean);
30739
+ if (!filtered.length) return [];
30740
+ if (filtered.length === 1) return filtered[0];
30741
+ return filtered;
30742
+ };
30743
+ const decode = (params, decodedAttrs = {}) => {
30744
+ const { node } = params || {};
30745
+ if (!node) return void 0;
30746
+ const marks = Array.isArray(node.marks) ? node.marks : [];
30747
+ const runMarkIndex = marks.findIndex((mark) => mark?.type === SD_KEY_NAME);
30748
+ const runMark = runMarkIndex >= 0 ? marks[runMarkIndex] : void 0;
30749
+ const strippedMarks = marks.filter((_2, idx) => idx !== runMarkIndex);
30750
+ const exportNode = { ...node, marks: strippedMarks };
30751
+ const exportParams = { ...params, node: exportNode };
30752
+ if (!exportParams.editor) {
30753
+ exportParams.editor = { extensionService: { extensions: [] } };
30754
+ }
30755
+ const translated = exportSchemaToJson(exportParams);
30756
+ if (!translated) return void 0;
30757
+ const runElement = resolveRunElement(translated);
30758
+ if (!runElement) return translated;
30759
+ runElement.attributes = { ...runElement.attributes || {}, ...decodedAttrs };
30760
+ const runProperties = Array.isArray(runMark?.attrs?.runProperties) ? runMark.attrs.runProperties : null;
30761
+ if (runProperties && runProperties.length) {
30762
+ const rPr = ensureRunPropertiesContainer(runElement);
30763
+ const existingNames = new Set((rPr.elements || []).map((el) => el.name));
30764
+ runProperties.forEach((entry) => {
30765
+ if (!entry || !entry.xmlName || entry.xmlName === "w:b") return;
30766
+ if (existingNames.has(entry.xmlName)) return;
30767
+ rPr.elements.push({ name: entry.xmlName, attributes: { ...entry.attributes || {} } });
30768
+ existingNames.add(entry.xmlName);
30769
+ });
29743
30770
  }
29744
- const styleTags = styles.elements[0].elements.filter((style2) => style2.name === "w:style");
29745
- const style = styleTags.find((tag) => tag.attributes["w:styleId"] === styleId) || {};
29746
- if (!style) return {};
29747
- return parseProperties(style);
30771
+ return translated;
29748
30772
  };
29749
- const runNodeHandlerEntity = {
29750
- handlerName: "runNodeHandler",
29751
- handler: handleRunNode
30773
+ const config = {
30774
+ xmlName: XML_NODE_NAME,
30775
+ sdNodeOrKeyName: SD_KEY_NAME,
30776
+ type: NodeTranslator.translatorTypes.NODE,
30777
+ encode,
30778
+ decode,
30779
+ attributes: validXmlAttributes
29752
30780
  };
30781
+ const translator = NodeTranslator.from(config);
30782
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator);
29753
30783
  const handleTextNode = (params) => {
29754
30784
  const { nodes, insideTrackChange } = params;
29755
30785
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -29786,7 +30816,7 @@ const handleParagraphNode = (params) => {
29786
30816
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
29787
30817
  return { nodes: [], consumed: 0 };
29788
30818
  }
29789
- const schemaNode = translator$h.encode(params);
30819
+ const schemaNode = translator$s.encode(params);
29790
30820
  const newNodes = schemaNode ? [schemaNode] : [];
29791
30821
  return { nodes: newNodes, consumed: 1 };
29792
30822
  };
@@ -29799,7 +30829,7 @@ const handleSdtNode = (params) => {
29799
30829
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
29800
30830
  return { nodes: [], consumed: 0 };
29801
30831
  }
29802
- const result = translator.encode(params);
30832
+ const result = translator$b.encode(params);
29803
30833
  if (!result) {
29804
30834
  return { nodes: [], consumed: 0 };
29805
30835
  }
@@ -29889,7 +30919,7 @@ const handler = (params) => {
29889
30919
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
29890
30920
  return { nodes: [], consumed: 0 };
29891
30921
  }
29892
- const result = translator$j.encode(params);
30922
+ const result = translator$v.encode(params);
29893
30923
  if (!result) return { nodes: [], consumed: 0 };
29894
30924
  return {
29895
30925
  nodes: [result],
@@ -30585,7 +31615,7 @@ const handleTabNode = (params) => {
30585
31615
  if (!nodes.length || nodes[0].name !== "w:tab") {
30586
31616
  return { nodes: [], consumed: 0 };
30587
31617
  }
30588
- const node = translator$i.encode(params);
31618
+ const node = translator$t.encode(params);
30589
31619
  return { nodes: [node], consumed: 1 };
30590
31620
  };
30591
31621
  const tabNodeEntityHandler = {
@@ -31032,6 +32062,16 @@ const isAlternatingHeadersOddEven = (docx) => {
31032
32062
  };
31033
32063
  const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
31034
32064
  const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
32065
+ const FONT_FAMILY_FALLBACKS = Object.freeze({
32066
+ swiss: "Arial, sans-serif",
32067
+ roman: "Times New Roman, serif",
32068
+ modern: "Courier New, monospace",
32069
+ script: "cursive",
32070
+ decorative: "fantasy",
32071
+ system: "system-ui",
32072
+ auto: "sans-serif"
32073
+ });
32074
+ const DEFAULT_GENERIC_FALLBACK = "sans-serif";
31035
32075
  const _SuperConverter = class _SuperConverter {
31036
32076
  constructor(params = null) {
31037
32077
  __privateAdd(this, _SuperConverter_instances);
@@ -31067,6 +32107,31 @@ const _SuperConverter = class _SuperConverter {
31067
32107
  this.documentId = params?.documentId || null;
31068
32108
  if (this.docx.length || this.xml) this.parseFromXml();
31069
32109
  }
32110
+ static getFontTableEntry(docx, fontName) {
32111
+ if (!docx || !fontName) return null;
32112
+ const fontTable = docx["word/fontTable.xml"];
32113
+ if (!fontTable?.elements?.length) return null;
32114
+ const fontsNode = fontTable.elements.find((el) => el.name === "w:fonts");
32115
+ if (!fontsNode?.elements?.length) return null;
32116
+ return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
32117
+ }
32118
+ static getFallbackFromFontTable(docx, fontName) {
32119
+ const fontEntry = _SuperConverter.getFontTableEntry(docx, fontName);
32120
+ const family = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
32121
+ if (!family) return null;
32122
+ const mapped = FONT_FAMILY_FALLBACKS[family.toLowerCase()];
32123
+ return mapped || DEFAULT_GENERIC_FALLBACK;
32124
+ }
32125
+ static toCssFontFamily(fontName, docx) {
32126
+ if (!fontName) return fontName;
32127
+ if (fontName.includes(",")) return fontName;
32128
+ const fallback = _SuperConverter.getFallbackFromFontTable(docx, fontName) || DEFAULT_GENERIC_FALLBACK;
32129
+ const normalizedFallbackParts = fallback.split(",").map((part) => part.trim().toLowerCase()).filter(Boolean);
32130
+ if (normalizedFallbackParts.includes(fontName.trim().toLowerCase())) {
32131
+ return fallback;
32132
+ }
32133
+ return `${fontName}, ${fallback}`;
32134
+ }
31070
32135
  /**
31071
32136
  * Get the DocxHelpers object that contains utility functions for working with docx files.
31072
32137
  * @returns {import('./docx-helpers/docx-helpers.js').DocxHelpers} The DocxHelpers object.
@@ -31112,7 +32177,7 @@ const _SuperConverter = class _SuperConverter {
31112
32177
  return;
31113
32178
  }
31114
32179
  }
31115
- static updateDocumentVersion(docx = this.convertedXml, version = "0.20.0") {
32180
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.21.0-RC1") {
31116
32181
  const customLocation = "docProps/custom.xml";
31117
32182
  if (!docx[customLocation]) {
31118
32183
  docx[customLocation] = generateCustomXml();
@@ -31163,13 +32228,19 @@ const _SuperConverter = class _SuperConverter {
31163
32228
  if (rPrDefaults) {
31164
32229
  const rPr = rPrDefaults.elements?.find((el) => el.name === "w:rPr");
31165
32230
  const fonts = rPr?.elements?.find((el) => el.name === "w:rFonts");
31166
- typeface = fonts?.attributes["w:ascii"];
31167
- const fontSize = typeface ?? rPr?.elements?.find((el) => el.name === "w:sz")?.attributes["w:val"];
31168
- fontSizeNormal = !fontSizeNormal && fontSize ? Number(fontSize) / 2 : null;
32231
+ if (fonts?.attributes?.["w:ascii"]) {
32232
+ typeface = fonts.attributes["w:ascii"];
32233
+ }
32234
+ const fontSizeRaw = rPr?.elements?.find((el) => el.name === "w:sz")?.attributes?.["w:val"];
32235
+ if (!fontSizeNormal && fontSizeRaw) {
32236
+ fontSizeNormal = Number(fontSizeRaw) / 2;
32237
+ }
31169
32238
  }
31170
- const fontSizePt = fontSizeNormal || Number(rElements.find((el) => el.name === "w:sz")?.attributes["w:val"]) / 2 || 10;
32239
+ const fallbackSz = Number(rElements.find((el) => el.name === "w:sz")?.attributes?.["w:val"]);
32240
+ const fontSizePt = fontSizeNormal ?? (Number.isFinite(fallbackSz) ? fallbackSz / 2 : void 0) ?? 10;
31171
32241
  const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
31172
- return { fontSizePt, kern, typeface, panose };
32242
+ const fontFamilyCss = _SuperConverter.toCssFontFamily(typeface, this.convertedXml);
32243
+ return { fontSizePt, kern, typeface, panose, fontFamilyCss };
31173
32244
  }
31174
32245
  }
31175
32246
  getDocumentFonts() {
@@ -31602,7 +32673,7 @@ function storeSuperdocVersion(docx) {
31602
32673
  function generateCustomXml() {
31603
32674
  return DEFAULT_CUSTOM_XML;
31604
32675
  }
31605
- function generateSuperdocVersion(pid = 2, version = "0.20.0") {
32676
+ function generateSuperdocVersion(pid = 2, version = "0.21.0-RC1") {
31606
32677
  return {
31607
32678
  type: "element",
31608
32679
  name: "property",
@@ -31655,6 +32726,7 @@ export {
31655
32726
  objectIncludes as Z,
31656
32727
  AddMarkStep as _,
31657
32728
  Plugin as a,
32729
+ translator$v as a$,
31658
32730
  twipsToLines as a0,
31659
32731
  pixelsToTwips as a1,
31660
32732
  helpers as a2,
@@ -31670,10 +32742,28 @@ export {
31670
32742
  readFromClipboard as aC,
31671
32743
  handleClipboardPaste as aD,
31672
32744
  getFileObject as aE,
31673
- translator$h as aF,
31674
- translator$i as aG,
31675
- translator$j as aH,
31676
- _sfc_main as aI,
32745
+ runPropertyTranslators as aF,
32746
+ translator$g as aG,
32747
+ translator$h as aH,
32748
+ translator$f as aI,
32749
+ translator$i as aJ,
32750
+ translator$e as aK,
32751
+ translator$d as aL,
32752
+ translator$j as aM,
32753
+ translator$k as aN,
32754
+ translator$t as aO,
32755
+ translator$b as aP,
32756
+ translator$1 as aQ,
32757
+ translator as aR,
32758
+ translator$s as aS,
32759
+ translator$l as aT,
32760
+ translator$c as aU,
32761
+ translator$m as aV,
32762
+ translator$n as aW,
32763
+ translator$o as aX,
32764
+ translator$p as aY,
32765
+ translator$q as aZ,
32766
+ translator$r as a_,
31677
32767
  hasSomeParentWithClass as aa,
31678
32768
  isActive as ab,
31679
32769
  unflattenListsInHtml as ac,
@@ -31701,6 +32791,7 @@ export {
31701
32791
  getContentTypesFromXml as ay,
31702
32792
  xmljs as az,
31703
32793
  Slice as b,
32794
+ _sfc_main as b0,
31704
32795
  DOMParser$1 as c,
31705
32796
  Mark as d,
31706
32797
  dropPoint as e,