@harbour-enterprises/superdoc 1.5.0-next.7 → 1.5.0-next.9

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.
@@ -10994,7 +10994,7 @@
10994
10994
  decode: decode$$,
10995
10995
  attributes: validXmlAttributes$j
10996
10996
  };
10997
- const translator$2r = NodeTranslator.from(config$r);
10997
+ const translator$2s = NodeTranslator.from(config$r);
10998
10998
  const encode$Y = (attributes) => attributes?.["w:val"];
10999
10999
  const decode$_ = (attrs) => attrs?.highlight;
11000
11000
  const attrConfig$x = Object.freeze({
@@ -11056,7 +11056,7 @@
11056
11056
  decode: decode$Z,
11057
11057
  attributes: validXmlAttributes$i
11058
11058
  };
11059
- const translator$2q = NodeTranslator.from(config$q);
11059
+ const translator$2r = NodeTranslator.from(config$q);
11060
11060
  const encode$W = (attributes) => {
11061
11061
  return attributes["w:val"];
11062
11062
  };
@@ -11135,7 +11135,7 @@
11135
11135
  decode: decode$V,
11136
11136
  attributes: validXmlAttributes$h
11137
11137
  };
11138
- const translator$2p = NodeTranslator.from(config$p);
11138
+ const translator$2q = NodeTranslator.from(config$p);
11139
11139
  const carbonCopy = (obj) => {
11140
11140
  if (!obj) return void 0;
11141
11141
  try {
@@ -11461,10 +11461,10 @@
11461
11461
  const intValue = parseInteger(value);
11462
11462
  return intValue != void 0 ? String(intValue) : void 0;
11463
11463
  };
11464
- const translator$2o = NodeTranslator.from(createSingleBooleanPropertyHandler("w:b", "bold"));
11465
- const translator$2n = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bCs", "boldCs"));
11466
- const translator$2m = NodeTranslator.from(createBorderPropertyHandler("w:bdr", "borders"));
11467
- const translator$2l = NodeTranslator.from(createSingleBooleanPropertyHandler("w:i", "italic"));
11464
+ const translator$2p = NodeTranslator.from(createSingleBooleanPropertyHandler("w:b", "bold"));
11465
+ const translator$2o = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bCs", "boldCs"));
11466
+ const translator$2n = NodeTranslator.from(createBorderPropertyHandler("w:bdr", "borders"));
11467
+ const translator$2m = NodeTranslator.from(createSingleBooleanPropertyHandler("w:i", "italic"));
11468
11468
  const encode$S = (attributes) => attributes?.["w:val"];
11469
11469
  const decode$U = (attrs) => attrs?.underline;
11470
11470
  const attrConfig$t = Object.freeze({
@@ -11559,10 +11559,10 @@
11559
11559
  decode: decode$P,
11560
11560
  attributes: validXmlAttributes$g
11561
11561
  };
11562
- const translator$2k = NodeTranslator.from(config$o);
11563
- const translator$2j = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
11564
- const translator$2i = NodeTranslator.from(createSingleBooleanPropertyHandler("w:dstrike"));
11565
- const translator$2h = NodeTranslator.from({
11562
+ const translator$2l = NodeTranslator.from(config$o);
11563
+ const translator$2k = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
11564
+ const translator$2j = NodeTranslator.from(createSingleBooleanPropertyHandler("w:dstrike"));
11565
+ const translator$2i = NodeTranslator.from({
11566
11566
  xmlName: "w:color",
11567
11567
  sdNodeOrKeyName: "color",
11568
11568
  attributes: [
@@ -11579,7 +11579,7 @@
11579
11579
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11580
11580
  }
11581
11581
  });
11582
- const translator$2g = NodeTranslator.from({
11582
+ const translator$2h = NodeTranslator.from({
11583
11583
  xmlName: "w:rFonts",
11584
11584
  sdNodeOrKeyName: "fontFamily",
11585
11585
  attributes: [
@@ -11610,16 +11610,16 @@
11610
11610
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11611
11611
  }
11612
11612
  });
11613
- const translator$2f = NodeTranslator.from(createSingleAttrPropertyHandler("w:rStyle", "styleId"));
11614
- const translator$2e = NodeTranslator.from(createSingleIntegerPropertyHandler("w:sz", "fontSize"));
11615
- const translator$2d = NodeTranslator.from(createSingleIntegerPropertyHandler("w:szCs", "fontSizeCs"));
11616
- const translator$2c = NodeTranslator.from({
11613
+ const translator$2g = NodeTranslator.from(createSingleAttrPropertyHandler("w:rStyle", "styleId"));
11614
+ const translator$2f = NodeTranslator.from(createSingleIntegerPropertyHandler("w:sz", "fontSize"));
11615
+ const translator$2e = NodeTranslator.from(createSingleIntegerPropertyHandler("w:szCs", "fontSizeCs"));
11616
+ const translator$2d = NodeTranslator.from({
11617
11617
  xmlName: "w:caps",
11618
11618
  sdNodeOrKeyName: "textTransform",
11619
11619
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1") ? "uppercase" : "none",
11620
11620
  decode: ({ node: node2 }) => node2.attrs["textTransform"] != null ? { name: "w:caps", attributes: { "w:val": booleanToString(node2.attrs["textTransform"] === "uppercase") } } : void 0
11621
11621
  });
11622
- const translator$2b = NodeTranslator.from({
11622
+ const translator$2c = NodeTranslator.from({
11623
11623
  xmlName: "w:shd",
11624
11624
  sdNodeOrKeyName: "shading",
11625
11625
  attributes: [
@@ -11641,7 +11641,7 @@
11641
11641
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11642
11642
  }
11643
11643
  });
11644
- const translator$2a = NodeTranslator.from({
11644
+ const translator$2b = NodeTranslator.from({
11645
11645
  xmlName: "w:lang",
11646
11646
  sdNodeOrKeyName: "lang",
11647
11647
  attributes: [createAttributeHandler("w:val"), createAttributeHandler("w:eastAsia"), createAttributeHandler("w:bidi")],
@@ -11653,24 +11653,24 @@
11653
11653
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11654
11654
  }
11655
11655
  });
11656
- const translator$29 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:spacing", "letterSpacing"));
11657
- const translator$28 = NodeTranslator.from(createSingleAttrPropertyHandler("w:vertAlign"));
11658
- const translator$27 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:smallCaps"));
11659
- const translator$26 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:snapToGrid"));
11660
- const translator$25 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:emboss"));
11661
- const translator$24 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:imprint"));
11662
- const translator$23 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:noProof"));
11663
- const translator$22 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:oMath"));
11664
- const translator$21 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:outline"));
11665
- const translator$20 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:shadow"));
11666
- const translator$1$ = NodeTranslator.from(createSingleBooleanPropertyHandler("w:vanish"));
11667
- const translator$1_ = NodeTranslator.from(createSingleBooleanPropertyHandler("w:specVanish"));
11668
- const translator$1Z = NodeTranslator.from(createSingleAttrPropertyHandler("w:effect"));
11669
- const translator$1Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:em"));
11670
- const translator$1X = NodeTranslator.from(createSingleAttrPropertyHandler("w:w"));
11671
- const translator$1W = NodeTranslator.from(createSingleIntegerPropertyHandler("w:kern"));
11672
- const translator$1V = NodeTranslator.from(createSingleIntegerPropertyHandler("w:position"));
11673
- const translator$1U = NodeTranslator.from({
11656
+ const translator$2a = NodeTranslator.from(createSingleIntegerPropertyHandler("w:spacing", "letterSpacing"));
11657
+ const translator$29 = NodeTranslator.from(createSingleAttrPropertyHandler("w:vertAlign"));
11658
+ const translator$28 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:smallCaps"));
11659
+ const translator$27 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:snapToGrid"));
11660
+ const translator$26 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:emboss"));
11661
+ const translator$25 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:imprint"));
11662
+ const translator$24 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:noProof"));
11663
+ const translator$23 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:oMath"));
11664
+ const translator$22 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:outline"));
11665
+ const translator$21 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:shadow"));
11666
+ const translator$20 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:vanish"));
11667
+ const translator$1$ = NodeTranslator.from(createSingleBooleanPropertyHandler("w:specVanish"));
11668
+ const translator$1_ = NodeTranslator.from(createSingleAttrPropertyHandler("w:effect"));
11669
+ const translator$1Z = NodeTranslator.from(createSingleAttrPropertyHandler("w:em"));
11670
+ const translator$1Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:w"));
11671
+ const translator$1X = NodeTranslator.from(createSingleIntegerPropertyHandler("w:kern"));
11672
+ const translator$1W = NodeTranslator.from(createSingleIntegerPropertyHandler("w:position"));
11673
+ const translator$1V = NodeTranslator.from({
11674
11674
  xmlName: "w:fitText",
11675
11675
  sdNodeOrKeyName: "fitText",
11676
11676
  attributes: [createIntegerAttributeHandler("w:val"), createIntegerAttributeHandler("w:id")],
@@ -11682,7 +11682,7 @@
11682
11682
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11683
11683
  }
11684
11684
  });
11685
- const translator$1T = NodeTranslator.from({
11685
+ const translator$1U = NodeTranslator.from({
11686
11686
  xmlName: "w:eastAsianLayout",
11687
11687
  sdNodeOrKeyName: "eastAsianLayout",
11688
11688
  attributes: [
@@ -11700,53 +11700,53 @@
11700
11700
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11701
11701
  }
11702
11702
  });
11703
- const translator$1S = NodeTranslator.from(createSingleBooleanPropertyHandler("w:rtl"));
11704
- const translator$1R = NodeTranslator.from(createSingleBooleanPropertyHandler("w:cs"));
11705
- const translator$1Q = NodeTranslator.from(createSingleBooleanPropertyHandler("w:iCs"));
11706
- const translator$1P = NodeTranslator.from(createSingleBooleanPropertyHandler("w:webHidden"));
11707
- const propertyTranslators$b = [
11708
- translator$2n,
11703
+ const translator$1T = NodeTranslator.from(createSingleBooleanPropertyHandler("w:rtl"));
11704
+ const translator$1S = NodeTranslator.from(createSingleBooleanPropertyHandler("w:cs"));
11705
+ const translator$1R = NodeTranslator.from(createSingleBooleanPropertyHandler("w:iCs"));
11706
+ const translator$1Q = NodeTranslator.from(createSingleBooleanPropertyHandler("w:webHidden"));
11707
+ const propertyTranslators$c = [
11709
11708
  translator$2o,
11710
- translator$2m,
11711
- translator$2c,
11712
- translator$2h,
11713
- translator$1R,
11709
+ translator$2p,
11710
+ translator$2n,
11711
+ translator$2d,
11714
11712
  translator$2i,
11715
- translator$1T,
11716
- translator$1Z,
11717
- translator$1Y,
11718
- translator$25,
11713
+ translator$1S,
11714
+ translator$2j,
11719
11715
  translator$1U,
11720
- translator$2g,
11721
- translator$2d,
11716
+ translator$1_,
11717
+ translator$1Z,
11718
+ translator$26,
11719
+ translator$1V,
11720
+ translator$2h,
11722
11721
  translator$2e,
11723
- translator$2q,
11724
- translator$24,
11725
- translator$2l,
11726
- translator$1Q,
11727
- translator$1W,
11722
+ translator$2f,
11723
+ translator$2r,
11724
+ translator$25,
11725
+ translator$2m,
11726
+ translator$1R,
11727
+ translator$1X,
11728
+ translator$2b,
11728
11729
  translator$2a,
11729
- translator$29,
11730
+ translator$24,
11730
11731
  translator$23,
11731
11732
  translator$22,
11733
+ translator$1W,
11734
+ translator$1T,
11735
+ translator$2g,
11732
11736
  translator$21,
11733
- translator$1V,
11734
- translator$1S,
11735
- translator$2f,
11736
- translator$20,
11737
- translator$2b,
11737
+ translator$2c,
11738
+ translator$28,
11738
11739
  translator$27,
11739
- translator$26,
11740
- translator$1_,
11741
- translator$2j,
11742
- translator$2k,
11743
11740
  translator$1$,
11744
- translator$28,
11745
- translator$1P,
11746
- translator$1X
11741
+ translator$2k,
11742
+ translator$2l,
11743
+ translator$20,
11744
+ translator$29,
11745
+ translator$1Q,
11746
+ translator$1Y
11747
11747
  ];
11748
- const translator$1O = NodeTranslator.from(
11749
- createNestedPropertiesTranslator("w:rPr", "runProperties", propertyTranslators$b)
11748
+ const translator$1P = NodeTranslator.from(
11749
+ createNestedPropertiesTranslator("w:rPr", "runProperties", propertyTranslators$c)
11750
11750
  );
11751
11751
  const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
11752
11752
  "wps",
@@ -11827,18 +11827,18 @@
11827
11827
  elements: carbonCopy(selectedElements)
11828
11828
  };
11829
11829
  }
11830
- const translator$1N = NodeTranslator.from(config$n);
11830
+ const translator$1O = NodeTranslator.from(config$n);
11831
11831
  function buildPath(existingPath = [], node2, branch) {
11832
11832
  const path2 = [...existingPath];
11833
11833
  if (node2) path2.push(node2);
11834
11834
  if (branch) path2.push(branch);
11835
11835
  return path2;
11836
11836
  }
11837
- const translator$1M = NodeTranslator.from(createSingleBooleanPropertyHandler("w:adjustRightInd"));
11838
- const translator$1L = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDE"));
11839
- const translator$1K = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDN"));
11840
- const translator$1J = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bidi", "rightToLeft"));
11841
- const translator$1I = NodeTranslator.from({
11837
+ const translator$1N = NodeTranslator.from(createSingleBooleanPropertyHandler("w:adjustRightInd"));
11838
+ const translator$1M = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDE"));
11839
+ const translator$1L = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDN"));
11840
+ const translator$1K = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bidi", "rightToLeft"));
11841
+ const translator$1J = NodeTranslator.from({
11842
11842
  xmlName: "w:cnfStyle",
11843
11843
  sdNodeOrKeyName: "cnfStyle",
11844
11844
  attributes: [
@@ -11864,9 +11864,9 @@
11864
11864
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11865
11865
  }
11866
11866
  });
11867
- const translator$1H = NodeTranslator.from(createSingleBooleanPropertyHandler("w:contextualSpacing"));
11868
- const translator$1G = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
11869
- const translator$1F = NodeTranslator.from({
11867
+ const translator$1I = NodeTranslator.from(createSingleBooleanPropertyHandler("w:contextualSpacing"));
11868
+ const translator$1H = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
11869
+ const translator$1G = NodeTranslator.from({
11870
11870
  xmlName: "w:framePr",
11871
11871
  sdNodeOrKeyName: "framePr",
11872
11872
  attributes: [
@@ -11894,7 +11894,7 @@
11894
11894
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11895
11895
  }
11896
11896
  });
11897
- const translator$1E = NodeTranslator.from({
11897
+ const translator$1F = NodeTranslator.from({
11898
11898
  xmlName: "w:ind",
11899
11899
  sdNodeOrKeyName: "indent",
11900
11900
  attributes: [
@@ -11919,12 +11919,12 @@
11919
11919
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
11920
11920
  }
11921
11921
  });
11922
- const translator$1D = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
11923
- const translator$1C = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepLines"));
11924
- const translator$1B = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepNext"));
11925
- const translator$1A = NodeTranslator.from(createSingleBooleanPropertyHandler("w:kinsoku"));
11926
- const translator$1z = NodeTranslator.from(createSingleBooleanPropertyHandler("w:mirrorIndents"));
11927
- const translator$1y = NodeTranslator.from(createSingleIntegerPropertyHandler("w:ilvl"));
11922
+ const translator$1E = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
11923
+ const translator$1D = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepLines"));
11924
+ const translator$1C = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepNext"));
11925
+ const translator$1B = NodeTranslator.from(createSingleBooleanPropertyHandler("w:kinsoku"));
11926
+ const translator$1A = NodeTranslator.from(createSingleBooleanPropertyHandler("w:mirrorIndents"));
11927
+ const translator$1z = NodeTranslator.from(createSingleIntegerPropertyHandler("w:ilvl"));
11928
11928
  const createTrackStyleMark = (marks) => {
11929
11929
  const trackStyleMark = marks.find((mark2) => mark2.type === "trackFormat");
11930
11930
  if (trackStyleMark) {
@@ -12012,41 +12012,41 @@
12012
12012
  decode: decode$N,
12013
12013
  attributes: validXmlAttributes$e
12014
12014
  };
12015
- const translator$1x = NodeTranslator.from(config$m);
12016
- const translator$1w = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
12017
- const propertyTranslators$a = [translator$1N, translator$1y, translator$1x, translator$1w];
12018
- const translator$1v = NodeTranslator.from(
12019
- createNestedPropertiesTranslator("w:numPr", "numberingProperties", propertyTranslators$a)
12015
+ const translator$1y = NodeTranslator.from(config$m);
12016
+ const translator$1x = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
12017
+ const propertyTranslators$b = [translator$1O, translator$1z, translator$1y, translator$1x];
12018
+ const translator$1w = NodeTranslator.from(
12019
+ createNestedPropertiesTranslator("w:numPr", "numberingProperties", propertyTranslators$b)
12020
12020
  );
12021
- const translator$1u = NodeTranslator.from(
12021
+ const translator$1v = NodeTranslator.from(
12022
12022
  createSingleAttrPropertyHandler("w:outlineLvl", "outlineLvl", "w:val", parseInteger, integerToString)
12023
12023
  );
12024
- const translator$1t = NodeTranslator.from(createSingleBooleanPropertyHandler("w:overflowPunct"));
12025
- const translator$1s = NodeTranslator.from(createBorderPropertyHandler("w:bar"));
12026
- const translator$1r = NodeTranslator.from(createBorderPropertyHandler("w:between"));
12027
- const translator$1q = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
12028
- const translator$1p = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
12029
- const translator$1o = NodeTranslator.from(createBorderPropertyHandler("w:left"));
12030
- const translator$1n = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
12031
- const translator$1m = NodeTranslator.from(createBorderPropertyHandler("w:right"));
12032
- const translator$1l = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
12033
- const translator$1k = NodeTranslator.from(createBorderPropertyHandler("w:top"));
12034
- const translator$1j = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
12035
- const propertyTranslators$9 = [
12036
- translator$1N,
12024
+ const translator$1u = NodeTranslator.from(createSingleBooleanPropertyHandler("w:overflowPunct"));
12025
+ const translator$1t = NodeTranslator.from(createBorderPropertyHandler("w:bar"));
12026
+ const translator$1s = NodeTranslator.from(createBorderPropertyHandler("w:between"));
12027
+ const translator$1r = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
12028
+ const translator$1q = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
12029
+ const translator$1p = NodeTranslator.from(createBorderPropertyHandler("w:left"));
12030
+ const translator$1o = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
12031
+ const translator$1n = NodeTranslator.from(createBorderPropertyHandler("w:right"));
12032
+ const translator$1m = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
12033
+ const translator$1l = NodeTranslator.from(createBorderPropertyHandler("w:top"));
12034
+ const translator$1k = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
12035
+ const propertyTranslators$a = [
12036
+ translator$1O,
12037
+ translator$1t,
12037
12038
  translator$1s,
12038
12039
  translator$1r,
12039
- translator$1q,
12040
- translator$1o,
12041
- translator$1m,
12042
- translator$1k
12040
+ translator$1p,
12041
+ translator$1n,
12042
+ translator$1l
12043
12043
  ];
12044
- const translator$1i = NodeTranslator.from(
12045
- createNestedPropertiesTranslator("w:pBdr", "borders", propertyTranslators$9)
12044
+ const translator$1j = NodeTranslator.from(
12045
+ createNestedPropertiesTranslator("w:pBdr", "borders", propertyTranslators$a)
12046
12046
  );
12047
- const translator$1h = NodeTranslator.from(createSingleAttrPropertyHandler("w:pStyle", "styleId"));
12048
- const translator$1g = NodeTranslator.from(createSingleBooleanPropertyHandler("w:pageBreakBefore"));
12049
- const translator$1f = NodeTranslator.from({
12047
+ const translator$1i = NodeTranslator.from(createSingleAttrPropertyHandler("w:pStyle", "styleId"));
12048
+ const translator$1h = NodeTranslator.from(createSingleBooleanPropertyHandler("w:pageBreakBefore"));
12049
+ const translator$1g = NodeTranslator.from({
12050
12050
  xmlName: "w:spacing",
12051
12051
  sdNodeOrKeyName: "spacing",
12052
12052
  attributes: [
@@ -12067,20 +12067,21 @@
12067
12067
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
12068
12068
  }
12069
12069
  });
12070
- const translator$1e = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressAutoHyphens"));
12071
- const translator$1d = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressLineNumbers"));
12072
- const translator$1c = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressOverlap"));
12073
- const propertyTranslators$8 = [translator$1N, translator$2p];
12074
- const translator$1b = NodeTranslator.from(
12075
- createNestedArrayPropertyHandler("w:tabs", "tabStops", propertyTranslators$8, { skipRun: true })
12070
+ const translator$1f = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressAutoHyphens"));
12071
+ const translator$1e = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressLineNumbers"));
12072
+ const translator$1d = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressOverlap"));
12073
+ const propertyTranslators$9 = [translator$1O, translator$2q];
12074
+ const translator$1c = NodeTranslator.from(
12075
+ createNestedArrayPropertyHandler("w:tabs", "tabStops", propertyTranslators$9, { skipRun: true })
12076
12076
  );
12077
- const translator$1a = NodeTranslator.from(createSingleAttrPropertyHandler("w:textAlignment"));
12078
- const translator$19 = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
12079
- const translator$18 = NodeTranslator.from(createSingleAttrPropertyHandler("w:textboxTightWrap"));
12080
- const translator$17 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:topLinePunct"));
12081
- const translator$16 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:widowControl"));
12082
- const translator$15 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:wordWrap"));
12083
- const propertyTranslators$7 = [
12077
+ const translator$1b = NodeTranslator.from(createSingleAttrPropertyHandler("w:textAlignment"));
12078
+ const translator$1a = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
12079
+ const translator$19 = NodeTranslator.from(createSingleAttrPropertyHandler("w:textboxTightWrap"));
12080
+ const translator$18 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:topLinePunct"));
12081
+ const translator$17 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:widowControl"));
12082
+ const translator$16 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:wordWrap"));
12083
+ const propertyTranslators$8 = [
12084
+ translator$1O,
12084
12085
  translator$1N,
12085
12086
  translator$1M,
12086
12087
  translator$1L,
@@ -12095,15 +12096,15 @@
12095
12096
  translator$1C,
12096
12097
  translator$1B,
12097
12098
  translator$1A,
12098
- translator$1z,
12099
+ translator$1w,
12099
12100
  translator$1v,
12100
12101
  translator$1u,
12101
- translator$1t,
12102
+ translator$1j,
12102
12103
  translator$1i,
12103
12104
  translator$1h,
12105
+ translator$2c,
12106
+ translator$27,
12104
12107
  translator$1g,
12105
- translator$2b,
12106
- translator$26,
12107
12108
  translator$1f,
12108
12109
  translator$1e,
12109
12110
  translator$1d,
@@ -12114,11 +12115,10 @@
12114
12115
  translator$18,
12115
12116
  translator$17,
12116
12117
  translator$16,
12117
- translator$15,
12118
- translator$1O
12118
+ translator$1P
12119
12119
  ];
12120
- const translator$14 = NodeTranslator.from(
12121
- createNestedPropertiesTranslator("w:pPr", "paragraphProperties", propertyTranslators$7)
12120
+ const translator$15 = NodeTranslator.from(
12121
+ createNestedPropertiesTranslator("w:pPr", "paragraphProperties", propertyTranslators$8)
12122
12122
  );
12123
12123
  function getUnderlineCssString({ type = "single", color: color2 = null, thickness = null, approximate = true } = {}) {
12124
12124
  const parts = [];
@@ -12880,7 +12880,7 @@
12880
12880
  }
12881
12881
  return void 0;
12882
12882
  }
12883
- const ooxmlResolver$1 = createOoxmlResolver({ pPr: translator$14, rPr: translator$1O });
12883
+ const ooxmlResolver$1 = createOoxmlResolver({ pPr: translator$15, rPr: translator$1P });
12884
12884
  const getToCssFontFamily = () => {
12885
12885
  return SuperConverter.toCssFontFamily;
12886
12886
  };
@@ -13574,7 +13574,7 @@
13574
13574
  let submarks = [];
13575
13575
  const rPr = rPrChange.elements?.find((el) => el.name === "w:rPr");
13576
13576
  if (rPr) {
13577
- const runProperties = translator$1O.encode({ ...params2, nodes: [rPr] });
13577
+ const runProperties = translator$1P.encode({ ...params2, nodes: [rPr] });
13578
13578
  submarks = encodeMarksFromRPr(runProperties, params2?.docx);
13579
13579
  }
13580
13580
  return [{ type: TrackFormatMarkName$1, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
@@ -13743,7 +13743,7 @@
13743
13743
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
13744
13744
  let inlineParagraphProperties = {};
13745
13745
  if (pPr) {
13746
- inlineParagraphProperties = translator$14.encode({ ...params2, nodes: [pPr] }) || {};
13746
+ inlineParagraphProperties = translator$15.encode({ ...params2, nodes: [pPr] }) || {};
13747
13747
  }
13748
13748
  const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
13749
13749
  const tableStyleId = getTableStyleId(params2.path || []);
@@ -13798,7 +13798,7 @@
13798
13798
  const { node: node2 } = params2;
13799
13799
  const { attrs = {} } = node2;
13800
13800
  const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
13801
- let pPr = translator$14.decode({ node: { ...node2, attrs: { paragraphProperties } } });
13801
+ let pPr = translator$15.decode({ node: { ...node2, attrs: { paragraphProperties } } });
13802
13802
  const sectPr = node2.attrs?.paragraphProperties?.sectPr;
13803
13803
  if (sectPr) {
13804
13804
  if (!pPr) {
@@ -13950,7 +13950,7 @@
13950
13950
  decode: decode$F,
13951
13951
  attributes: validXmlAttributes$d
13952
13952
  };
13953
- const translator$13 = NodeTranslator.from(config$l);
13953
+ const translator$14 = NodeTranslator.from(config$l);
13954
13954
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
13955
13955
  const containsEastAsianCharacters = (text2) => EAST_ASIAN_CHARACTER_REGEX.test(text2);
13956
13956
  const resolveFontFamily = (textStyleAttrs, text2) => {
@@ -14235,7 +14235,7 @@
14235
14235
  decode: decode$E,
14236
14236
  attributes: validXmlAttributes$c
14237
14237
  };
14238
- const translator$12 = NodeTranslator.from(config$k);
14238
+ const translator$13 = NodeTranslator.from(config$k);
14239
14239
  const encode$B = (attributes) => {
14240
14240
  return attributes["w:rsidR"];
14241
14241
  };
@@ -14292,7 +14292,7 @@
14292
14292
  if (!runNode) return void 0;
14293
14293
  const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
14294
14294
  const rPrNode = elements.find((child) => child?.name === "w:rPr");
14295
- const runProperties = rPrNode ? translator$1O.encode({ ...params2, nodes: [rPrNode] }) : {};
14295
+ const runProperties = rPrNode ? translator$1P.encode({ ...params2, nodes: [rPrNode] }) : {};
14296
14296
  const paragraphProperties = params2?.extraParams?.paragraphProperties || {};
14297
14297
  const resolvedRunProperties = resolveRunProperties(params2, runProperties ?? {}, paragraphProperties);
14298
14298
  const marksResult = encodeMarksFromRPr(resolvedRunProperties, params2?.docx);
@@ -14364,7 +14364,7 @@
14364
14364
  ...params2.extraParams,
14365
14365
  linkProcessed: true
14366
14366
  };
14367
- return translator$12.decode({ ...params2, extraParams });
14367
+ return translator$13.decode({ ...params2, extraParams });
14368
14368
  }
14369
14369
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node2);
14370
14370
  const runAttrs = runNodeForExport.attrs || {};
@@ -14378,7 +14378,7 @@
14378
14378
  exportParams.editor = { extensionService: { extensions: [] } };
14379
14379
  }
14380
14380
  const childElements = translateChildNodes(exportParams) || [];
14381
- let runPropertiesElement = translator$1O.decode({
14381
+ let runPropertiesElement = translator$1P.decode({
14382
14382
  ...params2,
14383
14383
  node: { attrs: { runProperties } }
14384
14384
  });
@@ -14456,9 +14456,9 @@
14456
14456
  decode: decode$A,
14457
14457
  attributes: validXmlAttributes$b
14458
14458
  };
14459
- const translator$11 = NodeTranslator.from(config$j);
14460
- const translator$10 = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
14461
- const translator$$ = NodeTranslator.from(
14459
+ const translator$12 = NodeTranslator.from(config$j);
14460
+ const translator$11 = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
14461
+ const translator$10 = NodeTranslator.from(
14462
14462
  createSingleAttrPropertyHandler(
14463
14463
  "w:gridSpan",
14464
14464
  null,
@@ -14467,33 +14467,33 @@
14467
14467
  (v2) => integerToString(v2)
14468
14468
  )
14469
14469
  );
14470
- const translator$_ = NodeTranslator.from(
14470
+ const translator$$ = NodeTranslator.from(
14471
14471
  createSingleAttrPropertyHandler("w:vMerge", null, "w:val", (val) => !val ? "continue" : val)
14472
14472
  );
14473
- const translator$Z = NodeTranslator.from(createBorderPropertyHandler("w:end"));
14474
- const translator$Y = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
14475
- const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
14476
- const translator$W = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
14477
- const translator$V = NodeTranslator.from(createBorderPropertyHandler("w:start"));
14478
- const translator$U = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
14479
- const translator$T = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
14480
- const translator$S = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
14481
- const propertyTranslators$6 = [
14482
- translator$1k,
14483
- translator$V,
14484
- translator$1o,
14485
- translator$1q,
14486
- translator$Z,
14487
- translator$1m,
14488
- translator$X,
14473
+ const translator$_ = NodeTranslator.from(createBorderPropertyHandler("w:end"));
14474
+ const translator$Z = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
14475
+ const translator$Y = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
14476
+ const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
14477
+ const translator$W = NodeTranslator.from(createBorderPropertyHandler("w:start"));
14478
+ const translator$V = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
14479
+ const translator$U = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
14480
+ const translator$T = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
14481
+ const propertyTranslators$7 = [
14482
+ translator$1l,
14489
14483
  translator$W,
14490
- translator$T,
14491
- translator$S
14484
+ translator$1p,
14485
+ translator$1r,
14486
+ translator$_,
14487
+ translator$1n,
14488
+ translator$Y,
14489
+ translator$X,
14490
+ translator$U,
14491
+ translator$T
14492
14492
  ];
14493
- const translator$R = NodeTranslator.from(
14494
- createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$6)
14493
+ const translator$S = NodeTranslator.from(
14494
+ createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$7)
14495
14495
  );
14496
- const translator$Q = NodeTranslator.from(
14496
+ const translator$R = NodeTranslator.from(
14497
14497
  createSingleAttrPropertyHandler(
14498
14498
  "w:noWrap",
14499
14499
  null,
@@ -14502,18 +14502,18 @@
14502
14502
  (v2) => booleanToString(v2)
14503
14503
  )
14504
14504
  );
14505
- const propertyTranslators$5 = [
14506
- translator$1p,
14507
- translator$Y,
14508
- translator$1n,
14509
- translator$1l,
14510
- translator$U,
14511
- translator$1j
14505
+ const propertyTranslators$6 = [
14506
+ translator$1q,
14507
+ translator$Z,
14508
+ translator$1o,
14509
+ translator$1m,
14510
+ translator$V,
14511
+ translator$1k
14512
14512
  ];
14513
- const translator$P = NodeTranslator.from(
14514
- createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$5)
14513
+ const translator$Q = NodeTranslator.from(
14514
+ createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$6)
14515
14515
  );
14516
- const translator$O = NodeTranslator.from(
14516
+ const translator$P = NodeTranslator.from(
14517
14517
  createSingleAttrPropertyHandler(
14518
14518
  "w:tcFitText",
14519
14519
  null,
@@ -14522,8 +14522,8 @@
14522
14522
  (v2) => booleanToString(v2)
14523
14523
  )
14524
14524
  );
14525
- const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
14526
- const translator$M = NodeTranslator.from(
14525
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
14526
+ const translator$N = NodeTranslator.from(
14527
14527
  createSingleAttrPropertyHandler(
14528
14528
  "w:hideMark",
14529
14529
  null,
@@ -14532,27 +14532,27 @@
14532
14532
  (v2) => booleanToString(v2)
14533
14533
  )
14534
14534
  );
14535
- const translator$L = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
14536
- const translator$K = NodeTranslator.from(
14537
- createNestedArrayPropertyHandler("w:headers", "headers", [translator$L])
14535
+ const translator$M = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
14536
+ const translator$L = NodeTranslator.from(
14537
+ createNestedArrayPropertyHandler("w:headers", "headers", [translator$M])
14538
14538
  );
14539
- const propertyTranslators$4 = [
14540
- translator$1I,
14539
+ const propertyTranslators$5 = [
14540
+ translator$1J,
14541
+ translator$11,
14541
14542
  translator$10,
14542
14543
  translator$$,
14543
- translator$_,
14544
+ translator$S,
14545
+ translator$2c,
14544
14546
  translator$R,
14545
- translator$2b,
14546
14547
  translator$Q,
14548
+ translator$1a,
14547
14549
  translator$P,
14548
- translator$19,
14549
14550
  translator$O,
14550
14551
  translator$N,
14551
- translator$M,
14552
- translator$K
14552
+ translator$L
14553
14553
  ];
14554
- const translator$J = NodeTranslator.from(
14555
- createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators$4)
14554
+ const translator$K = NodeTranslator.from(
14555
+ createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators$5)
14556
14556
  );
14557
14557
  function handleTableCellNode({
14558
14558
  params: params2,
@@ -14560,6 +14560,9 @@
14560
14560
  table: table2,
14561
14561
  row: row2,
14562
14562
  rowBorders,
14563
+ baseTableBorders,
14564
+ tableLook,
14565
+ rowCnfStyle,
14563
14566
  columnIndex,
14564
14567
  columnWidth = null,
14565
14568
  allColumnWidths = [],
@@ -14572,7 +14575,7 @@
14572
14575
  const attributes = {};
14573
14576
  const referencedStyles = _referencedStyles ?? { fontSize: null, fonts: {}, cellMargins: {} };
14574
14577
  const tcPr = node2.elements.find((el) => el.name === "w:tcPr");
14575
- const tableCellProperties = tcPr ? translator$J.encode({ ...params2, nodes: [tcPr] }) ?? {} : {};
14578
+ const tableCellProperties = tcPr ? translator$K.encode({ ...params2, nodes: [tcPr] }) ?? {} : {};
14576
14579
  attributes["tableCellProperties"] = tableCellProperties;
14577
14580
  const effectiveTotalColumns = totalColumns ?? (allColumnWidths.length || 1);
14578
14581
  const effectiveTotalRows = totalRows ?? (table2?.elements?.filter((el) => el.name === "w:tr").length || 1);
@@ -14581,38 +14584,32 @@
14581
14584
  const isLastRow = rowIndex === effectiveTotalRows - 1;
14582
14585
  const isFirstColumn = columnIndex === 0;
14583
14586
  const isLastColumn = columnIndex + colspan >= effectiveTotalColumns;
14584
- const cellBorders = {};
14585
- if (rowBorders) {
14586
- if (rowBorders.top?.val === "none") {
14587
- cellBorders.top = rowBorders.top;
14588
- } else if (isFirstRow && rowBorders.top) {
14589
- cellBorders.top = rowBorders.top;
14590
- }
14591
- if (rowBorders.bottom?.val === "none") {
14592
- cellBorders.bottom = rowBorders.bottom;
14593
- } else if (isLastRow && rowBorders.bottom) {
14594
- cellBorders.bottom = rowBorders.bottom;
14595
- }
14596
- if (rowBorders.left?.val === "none") {
14597
- cellBorders.left = rowBorders.left;
14598
- } else if (isFirstColumn && rowBorders.left) {
14599
- cellBorders.left = rowBorders.left;
14600
- }
14601
- if (rowBorders.right?.val === "none") {
14602
- cellBorders.right = rowBorders.right;
14603
- } else if (isLastColumn && rowBorders.right) {
14604
- cellBorders.right = rowBorders.right;
14605
- }
14606
- if (!isLastRow && rowBorders.insideH) {
14607
- cellBorders.bottom = rowBorders.insideH;
14608
- }
14609
- if (!isLastColumn && rowBorders.insideV) {
14610
- cellBorders.right = rowBorders.insideV;
14611
- }
14587
+ attributes["borders"] = processCellBorders({
14588
+ baseTableBorders,
14589
+ rowBorders,
14590
+ tableLook,
14591
+ rowCnfStyle,
14592
+ isFirstRow,
14593
+ isLastRow,
14594
+ isFirstColumn,
14595
+ isLastColumn,
14596
+ tableCellProperties,
14597
+ referencedStyles
14598
+ });
14599
+ const hasRowOverrideNone = rowBorders && ["top", "left", "bottom", "right", "insideH", "insideV"].some((side) => rowBorders?.[side]?.val === "none");
14600
+ if (hasRowOverrideNone && isFirstColumn) {
14601
+ console.info(
14602
+ "[sd-table-borders] cell borders",
14603
+ JSON.stringify({
14604
+ rowIndex,
14605
+ columnIndex,
14606
+ totalColumns: effectiveTotalColumns,
14607
+ baseTableBorders,
14608
+ rowBorders,
14609
+ cellBorders: attributes["borders"]
14610
+ })
14611
+ );
14612
14612
  }
14613
- attributes["borders"] = cellBorders;
14614
- const inlineBorders = processInlineCellBorders(tableCellProperties.borders, cellBorders);
14615
- if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"], inlineBorders);
14616
14613
  if (colspan > 1) attributes["colspan"] = colspan;
14617
14614
  let width = tableCellProperties.cellWidth?.value ? twipsToPixels$2(tableCellProperties.cellWidth?.value) : null;
14618
14615
  const widthType = tableCellProperties.cellWidth?.type;
@@ -14791,6 +14788,81 @@
14791
14788
  return acc;
14792
14789
  }, {});
14793
14790
  };
14791
+ const processCellBorders = ({
14792
+ baseTableBorders,
14793
+ rowBorders,
14794
+ tableLook,
14795
+ rowCnfStyle,
14796
+ isFirstRow,
14797
+ isLastRow,
14798
+ isFirstColumn,
14799
+ isLastColumn,
14800
+ tableCellProperties,
14801
+ referencedStyles
14802
+ }) => {
14803
+ let cellBorders = {};
14804
+ if (baseTableBorders) {
14805
+ if (isFirstRow && baseTableBorders.top) {
14806
+ cellBorders.top = baseTableBorders.top;
14807
+ }
14808
+ if (isLastRow && baseTableBorders.bottom) {
14809
+ cellBorders.bottom = baseTableBorders.bottom;
14810
+ }
14811
+ if (isFirstColumn && baseTableBorders.left) {
14812
+ cellBorders.left = baseTableBorders.left;
14813
+ }
14814
+ if (isLastColumn && baseTableBorders.right) {
14815
+ cellBorders.right = baseTableBorders.right;
14816
+ }
14817
+ }
14818
+ if (rowBorders) {
14819
+ if (rowBorders.top?.val) {
14820
+ cellBorders.top = rowBorders.top;
14821
+ }
14822
+ if (rowBorders.bottom?.val) {
14823
+ cellBorders.bottom = rowBorders.bottom;
14824
+ }
14825
+ if (rowBorders.left?.val) {
14826
+ const applyLeftToAll = rowBorders.left.val === "none";
14827
+ if (applyLeftToAll || isFirstColumn) {
14828
+ cellBorders.left = rowBorders.left;
14829
+ }
14830
+ }
14831
+ if (rowBorders.right?.val) {
14832
+ const applyRightToAll = rowBorders.right.val === "none";
14833
+ if (applyRightToAll || isLastColumn) {
14834
+ cellBorders.right = rowBorders.right;
14835
+ }
14836
+ }
14837
+ if (!isLastRow && rowBorders.insideH) {
14838
+ cellBorders.bottom = rowBorders.insideH;
14839
+ }
14840
+ if (!isLastColumn && rowBorders.insideV) {
14841
+ cellBorders.right = rowBorders.insideV;
14842
+ }
14843
+ }
14844
+ const getStyleTableCellBorders = (styleVariant) => styleVariant?.tableCellProperties?.borders ?? null;
14845
+ const cellCnfStyle = tableCellProperties?.cnfStyle;
14846
+ const getFlag = (source, flag) => source && Object.prototype.hasOwnProperty.call(source, flag) ? source[flag] : void 0;
14847
+ const isStyleEnabled = (flag) => getFlag(cellCnfStyle, flag) ?? getFlag(rowCnfStyle, flag) ?? getFlag(tableLook, flag) ?? true;
14848
+ const applyStyleBorders = (styleVariant, allowedDirections) => {
14849
+ const styleBorders = getStyleTableCellBorders(styleVariant);
14850
+ if (!styleBorders) return;
14851
+ const filteredBorders = allowedDirections.reduce((acc, direction) => {
14852
+ if (styleBorders[direction]) acc[direction] = styleBorders[direction];
14853
+ return acc;
14854
+ }, {});
14855
+ const styleOverrides = processInlineCellBorders(filteredBorders, cellBorders);
14856
+ if (styleOverrides) cellBorders = Object.assign(cellBorders, styleOverrides);
14857
+ };
14858
+ if (isFirstRow && isStyleEnabled("firstRow")) applyStyleBorders(referencedStyles?.firstRow, ["top", "bottom"]);
14859
+ if (isLastRow && isStyleEnabled("lastRow")) applyStyleBorders(referencedStyles?.lastRow, ["top", "bottom"]);
14860
+ if (isFirstColumn && isStyleEnabled("firstColumn")) applyStyleBorders(referencedStyles?.firstCol, ["left", "right"]);
14861
+ if (isLastColumn && isStyleEnabled("lastColumn")) applyStyleBorders(referencedStyles?.lastCol, ["left", "right"]);
14862
+ const inlineBorders = processInlineCellBorders(tableCellProperties.borders, cellBorders);
14863
+ if (inlineBorders) cellBorders = Object.assign(cellBorders, inlineBorders);
14864
+ return cellBorders;
14865
+ };
14794
14866
  const getTableCellVMerge = (node2) => {
14795
14867
  const tcPr = node2.elements.find((el) => el.name === "w:tcPr");
14796
14868
  const vMerge = tcPr?.elements?.find((el) => el.name === "w:vMerge");
@@ -14907,7 +14979,7 @@
14907
14979
  } else if (tableCellProperties?.borders) {
14908
14980
  delete tableCellProperties.borders;
14909
14981
  }
14910
- const result = translator$J.decode({ node: { ...node2, attrs: { ...node2.attrs, tableCellProperties } } });
14982
+ const result = translator$K.decode({ node: { ...node2, attrs: { ...node2.attrs, tableCellProperties } } });
14911
14983
  return result;
14912
14984
  }
14913
14985
  const XML_NODE_NAME$j = "w:tc";
@@ -14919,6 +14991,9 @@
14919
14991
  table: table2,
14920
14992
  row: row2,
14921
14993
  rowBorders,
14994
+ baseTableBorders,
14995
+ tableLook,
14996
+ rowCnfStyle,
14922
14997
  columnIndex,
14923
14998
  columnWidth,
14924
14999
  columnWidths: allColumnWidths,
@@ -14933,6 +15008,9 @@
14933
15008
  table: table2,
14934
15009
  row: row2,
14935
15010
  rowBorders,
15011
+ baseTableBorders,
15012
+ tableLook,
15013
+ rowCnfStyle,
14936
15014
  columnIndex,
14937
15015
  columnWidth,
14938
15016
  allColumnWidths,
@@ -14961,27 +15039,27 @@
14961
15039
  decode: decode$z,
14962
15040
  attributes: validXmlAttributes$a
14963
15041
  };
14964
- const translator$I = NodeTranslator.from(config$i);
14965
- const propertyTranslators$3 = [
14966
- translator$1q,
14967
- translator$Z,
15042
+ const translator$J = NodeTranslator.from(config$i);
15043
+ const propertyTranslators$4 = [
15044
+ translator$1r,
15045
+ translator$_,
15046
+ translator$Y,
14968
15047
  translator$X,
15048
+ translator$1p,
15049
+ translator$1n,
14969
15050
  translator$W,
14970
- translator$1o,
14971
- translator$1m,
14972
- translator$V,
14973
- translator$1k
15051
+ translator$1l
14974
15052
  ];
14975
- const translator$H = NodeTranslator.from(
14976
- createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$3)
15053
+ const translator$I = NodeTranslator.from(
15054
+ createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$4)
14977
15055
  );
14978
- const translator$G = NodeTranslator.from({
15056
+ const translator$H = NodeTranslator.from({
14979
15057
  xmlName: "w:cantSplit",
14980
15058
  sdNodeOrKeyName: "cantSplit",
14981
15059
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
14982
15060
  decode: ({ node: node2 }) => node2.attrs?.cantSplit ? { attributes: {} } : void 0
14983
15061
  });
14984
- const translator$F = NodeTranslator.from(
15062
+ const translator$G = NodeTranslator.from(
14985
15063
  createSingleAttrPropertyHandler(
14986
15064
  "w:gridAfter",
14987
15065
  null,
@@ -14990,7 +15068,7 @@
14990
15068
  (v2) => integerToString(v2)
14991
15069
  )
14992
15070
  );
14993
- const translator$E = NodeTranslator.from(
15071
+ const translator$F = NodeTranslator.from(
14994
15072
  createSingleAttrPropertyHandler(
14995
15073
  "w:gridBefore",
14996
15074
  null,
@@ -14999,20 +15077,20 @@
14999
15077
  (v2) => integerToString(v2)
15000
15078
  )
15001
15079
  );
15002
- const translator$D = NodeTranslator.from({
15080
+ const translator$E = NodeTranslator.from({
15003
15081
  xmlName: "w:hidden",
15004
15082
  sdNodeOrKeyName: "hidden",
15005
15083
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
15006
15084
  decode: ({ node: node2 }) => node2.attrs.hidden ? { attributes: {} } : void 0
15007
15085
  });
15008
- const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
15009
- const translator$B = NodeTranslator.from({
15086
+ const translator$D = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
15087
+ const translator$C = NodeTranslator.from({
15010
15088
  xmlName: "w:tblHeader",
15011
15089
  sdNodeOrKeyName: "repeatHeader",
15012
15090
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
15013
15091
  decode: ({ node: node2 }) => node2.attrs.repeatHeader ? { attributes: {} } : void 0
15014
15092
  });
15015
- const translator$A = NodeTranslator.from({
15093
+ const translator$B = NodeTranslator.from({
15016
15094
  xmlName: "w:trHeight",
15017
15095
  sdNodeOrKeyName: "rowHeight",
15018
15096
  encode: ({ nodes }) => {
@@ -15039,24 +15117,24 @@
15039
15117
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
15040
15118
  }
15041
15119
  });
15042
- const translator$z = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
15043
- const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
15044
- const propertyTranslators$2 = [
15120
+ const translator$A = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
15121
+ const translator$z = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
15122
+ const propertyTranslators$3 = [
15123
+ translator$H,
15124
+ translator$1J,
15125
+ translator$1H,
15045
15126
  translator$G,
15046
- translator$1I,
15047
- translator$1G,
15048
15127
  translator$F,
15049
15128
  translator$E,
15129
+ translator$1E,
15050
15130
  translator$D,
15051
- translator$1D,
15052
15131
  translator$C,
15053
15132
  translator$B,
15054
15133
  translator$A,
15055
- translator$z,
15056
- translator$y
15134
+ translator$z
15057
15135
  ];
15058
- const translator$x = NodeTranslator.from(
15059
- createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$2, {
15136
+ const translator$y = NodeTranslator.from(
15137
+ createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$3, {
15060
15138
  cantSplit: false,
15061
15139
  hidden: false,
15062
15140
  repeatHeader: false
@@ -15135,11 +15213,11 @@
15135
15213
  return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
15136
15214
  };
15137
15215
  const encode$w = (params2, encodedAttrs) => {
15138
- const { row: row2 } = params2.extraParams;
15216
+ const { row: row2, tableLook } = params2.extraParams;
15139
15217
  let tableRowProperties = {};
15140
15218
  const tPr = row2.elements.find((el) => el.name === "w:trPr");
15141
15219
  if (tPr) {
15142
- tableRowProperties = translator$x.encode({
15220
+ tableRowProperties = translator$y.encode({
15143
15221
  ...params2,
15144
15222
  nodes: [tPr]
15145
15223
  });
@@ -15149,8 +15227,9 @@
15149
15227
  encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
15150
15228
  encodedAttrs["rowHeight"] = twipsToPixels$2(tableRowProperties["rowHeight"]?.value);
15151
15229
  encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
15152
- const baseBorders = params2.extraParams?.rowBorders;
15153
- const rowTableBorders = getRowTableBorders({
15230
+ const rowCnfStyle = tableRowProperties?.cnfStyle;
15231
+ const baseBorders = params2.extraParams?.tableBorders;
15232
+ const rowBorders = getRowBorders({
15154
15233
  params: params2,
15155
15234
  row: row2,
15156
15235
  baseBorders
@@ -15182,15 +15261,15 @@
15182
15261
  skipOccupiedColumns();
15183
15262
  const startColumn = currentColumnIndex;
15184
15263
  const columnWidth = gridColumnWidths?.[startColumn] || null;
15185
- const result = translator$I.encode({
15264
+ const result = translator$J.encode({
15186
15265
  ...params2,
15187
15266
  path: [...params2.path || [], node2],
15188
15267
  extraParams: {
15189
15268
  ...params2.extraParams,
15190
- rowBorders: {
15191
- ...baseBorders,
15192
- ...rowTableBorders
15193
- },
15269
+ rowBorders,
15270
+ baseTableBorders: baseBorders,
15271
+ tableLook,
15272
+ rowCnfStyle,
15194
15273
  node: node2,
15195
15274
  columnIndex: startColumn,
15196
15275
  columnWidth
@@ -15220,18 +15299,35 @@
15220
15299
  };
15221
15300
  return newNode;
15222
15301
  };
15223
- function getRowTableBorders({ params: params2, row: row2, baseBorders }) {
15302
+ function getRowBorders({ params: params2, row: row2, baseBorders }) {
15303
+ const rowIndex = params2?.extraParams?.rowIndex;
15224
15304
  const tblPrEx = row2?.elements?.find?.((el) => el.name === "w:tblPrEx");
15225
15305
  const tblBorders = tblPrEx?.elements?.find?.((el) => el.name === "w:tblBorders");
15306
+ const rowBaseBorders = {};
15307
+ if (baseBorders?.insideV) {
15308
+ rowBaseBorders.insideV = baseBorders?.insideV;
15309
+ }
15310
+ if (baseBorders?.insideH) {
15311
+ rowBaseBorders.insideH = baseBorders?.insideH;
15312
+ }
15226
15313
  if (!tblBorders) {
15227
- return baseBorders;
15314
+ return rowBaseBorders;
15228
15315
  }
15229
- const rawOverrides = translator$H.encode({ ...params2, nodes: [tblBorders] }) || {};
15316
+ const rawOverrides = translator$I.encode({ ...params2, nodes: [tblBorders] }) || {};
15230
15317
  const overrides = processRawTableBorders(rawOverrides);
15231
15318
  if (!Object.keys(overrides).length) {
15232
- return baseBorders;
15319
+ console.info(
15320
+ "[sd-table-borders] row tblPrEx overrides empty",
15321
+ JSON.stringify({ rowIndex, baseBorders: rowBaseBorders, rawOverrides })
15322
+ );
15323
+ return rowBaseBorders;
15233
15324
  }
15234
- return { ...baseBorders || {}, ...overrides };
15325
+ const rowBorders = { ...rowBaseBorders, ...overrides };
15326
+ console.info(
15327
+ "[sd-table-borders] row tblPrEx overrides",
15328
+ JSON.stringify({ rowIndex, baseBorders: rowBaseBorders, rawOverrides, overrides, rowBorders })
15329
+ );
15330
+ return rowBorders;
15235
15331
  }
15236
15332
  function processRawTableBorders(rawBorders) {
15237
15333
  const borders = {};
@@ -15307,7 +15403,7 @@
15307
15403
  }
15308
15404
  }
15309
15405
  tableRowProperties["cantSplit"] = node2.attrs["cantSplit"];
15310
- const trPr = translator$x.decode({
15406
+ const trPr = translator$y.decode({
15311
15407
  ...params2,
15312
15408
  node: { ...node2, attrs: { ...node2.attrs, tableRowProperties } }
15313
15409
  });
@@ -15327,7 +15423,7 @@
15327
15423
  decode: decode$y,
15328
15424
  attributes: validXmlAttributes$9
15329
15425
  };
15330
- const translator$w = NodeTranslator.from(config$h);
15426
+ const translator$x = NodeTranslator.from(config$h);
15331
15427
  function parseTagValueJSON(json) {
15332
15428
  if (typeof json !== "string") {
15333
15429
  return {};
@@ -30591,7 +30687,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30591
30687
  decode: decode$x,
30592
30688
  attributes: validXmlAttributes$8
30593
30689
  };
30594
- const translator$v = NodeTranslator.from(config$g);
30690
+ const translator$w = NodeTranslator.from(config$g);
30595
30691
  function handleInlineNode(params2) {
30596
30692
  const { node: node2 } = params2.extraParams;
30597
30693
  if (node2.name !== "wp:inline") {
@@ -30645,7 +30741,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30645
30741
  decode: decode$w,
30646
30742
  attributes: validXmlAttributes$7
30647
30743
  };
30648
- const translator$u = NodeTranslator.from(config$f);
30744
+ const translator$v = NodeTranslator.from(config$f);
30649
30745
  const XML_NODE_NAME$f = "w:drawing";
30650
30746
  const SD_NODE_NAME$d = [];
30651
30747
  const validXmlAttributes$6 = [];
@@ -30653,8 +30749,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30653
30749
  const nodes = params2.nodes;
30654
30750
  const node2 = nodes[0];
30655
30751
  const translatorByChildName = {
30656
- "wp:anchor": translator$v,
30657
- "wp:inline": translator$u
30752
+ "wp:anchor": translator$w,
30753
+ "wp:inline": translator$v
30658
30754
  };
30659
30755
  const result = (node2.elements || []).reduce((acc, child) => {
30660
30756
  if (acc) return acc;
@@ -30677,7 +30773,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30677
30773
  if (!node2 || !node2.type) {
30678
30774
  return null;
30679
30775
  }
30680
- const childTranslator = node2.attrs.isAnchor ? translator$v : translator$u;
30776
+ const childTranslator = node2.attrs.isAnchor ? translator$w : translator$v;
30681
30777
  const resultNode = childTranslator.decode(params2);
30682
30778
  return wrapTextInRun(
30683
30779
  {
@@ -30695,7 +30791,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30695
30791
  decode: decode$v,
30696
30792
  attributes: validXmlAttributes$6
30697
30793
  };
30698
- const translator$t = NodeTranslator.from(config$e);
30794
+ const translator$u = NodeTranslator.from(config$e);
30699
30795
  function getTextNodeForExport(text2, marks, params2) {
30700
30796
  const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text2);
30701
30797
  const space = hasLeadingOrTrailingSpace ? "preserve" : null;
@@ -30704,7 +30800,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30704
30800
  const textRunProperties = decodeRPrFromMarks(marks || []);
30705
30801
  const parentRunProperties = params2.extraParams?.runProperties || {};
30706
30802
  const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
30707
- const rPrNode = translator$1O.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
30803
+ const rPrNode = translator$1P.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
30708
30804
  textNodes.push({
30709
30805
  name: "w:t",
30710
30806
  elements: [{ text: text2, type: "text" }],
@@ -31103,7 +31199,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31103
31199
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
31104
31200
  }
31105
31201
  function prepareImageAnnotation(params2, imageSize) {
31106
- return translator$t.decode({
31202
+ return translator$u.decode({
31107
31203
  ...params2,
31108
31204
  imageSize
31109
31205
  });
@@ -31188,7 +31284,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31188
31284
  }
31189
31285
  ]
31190
31286
  };
31191
- return translator$12.decode({
31287
+ return translator$13.decode({
31192
31288
  ...params2,
31193
31289
  node: linkTextNode
31194
31290
  });
@@ -31565,7 +31661,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31565
31661
  decode: decode$u,
31566
31662
  attributes: validXmlAttributes$5
31567
31663
  };
31568
- const translator$s = NodeTranslator.from(config$d);
31664
+ const translator$t = NodeTranslator.from(config$d);
31569
31665
  const getColspan = (cell2) => {
31570
31666
  const rawColspan = cell2?.attrs?.colspan;
31571
31667
  const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
@@ -31656,21 +31752,47 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31656
31752
  }
31657
31753
  return table2;
31658
31754
  }
31659
- const translator$r = NodeTranslator.from({
31755
+ const translator$s = NodeTranslator.from({
31660
31756
  xmlName: "w:bidiVisual",
31661
31757
  sdNodeOrKeyName: "rightToLeft",
31662
31758
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
31663
31759
  decode: ({ node: node2 }) => node2.attrs.rightToLeft ? { attributes: {} } : void 0
31664
31760
  });
31665
- const translator$q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
31666
- const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
31667
- const translator$o = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
31668
- const translator$n = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
31669
- const translator$m = NodeTranslator.from({
31761
+ const translator$r = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
31762
+ const translator$q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
31763
+ const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
31764
+ const translator$o = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
31765
+ const tblLookBitmask = Object.freeze({
31766
+ firstRow: 32,
31767
+ lastRow: 64,
31768
+ firstColumn: 128,
31769
+ lastColumn: 256,
31770
+ noHBand: 512,
31771
+ noVBand: 1024
31772
+ });
31773
+ const decodeTblLookVal = (val) => {
31774
+ if (!val) return null;
31775
+ const raw = typeof val === "string" ? val.trim() : String(val);
31776
+ let numeric = Number.parseInt(raw, 16);
31777
+ if (!Number.isFinite(numeric)) {
31778
+ numeric = Number.parseInt(raw, 10);
31779
+ }
31780
+ if (!Number.isFinite(numeric)) return null;
31781
+ return Object.fromEntries(Object.entries(tblLookBitmask).map(([key2, mask]) => [key2, (numeric & mask) === mask]));
31782
+ };
31783
+ const translator$n = NodeTranslator.from({
31670
31784
  xmlName: "w:tblLook",
31671
31785
  sdNodeOrKeyName: "tblLook",
31672
31786
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
31673
31787
  encode: (params2, encodedAttrs) => {
31788
+ const decoded = decodeTblLookVal(encodedAttrs.val);
31789
+ if (decoded) {
31790
+ Object.entries(decoded).forEach(([key2, value]) => {
31791
+ if (!Object.prototype.hasOwnProperty.call(encodedAttrs, key2)) {
31792
+ encodedAttrs[key2] = value;
31793
+ }
31794
+ });
31795
+ }
31674
31796
  return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
31675
31797
  },
31676
31798
  decode: function({ node: node2 }, context) {
@@ -31678,16 +31800,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31678
31800
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
31679
31801
  }
31680
31802
  });
31681
- const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
31682
- const translator$k = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
31683
- const translator$j = NodeTranslator.from(
31803
+ const translator$m = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
31804
+ const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
31805
+ const translator$k = NodeTranslator.from(
31684
31806
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
31685
31807
  );
31686
- const translator$i = NodeTranslator.from(
31808
+ const translator$j = NodeTranslator.from(
31687
31809
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
31688
31810
  );
31689
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
31690
- const translator$g = NodeTranslator.from({
31811
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
31812
+ const translator$h = NodeTranslator.from({
31691
31813
  xmlName: "w:tblpPr",
31692
31814
  sdNodeOrKeyName: "floatingTableProperties",
31693
31815
  attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
@@ -31699,23 +31821,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31699
31821
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
31700
31822
  }
31701
31823
  });
31702
- const propertyTranslators$1 = [
31703
- translator$1p,
31704
- translator$Y,
31705
- translator$1n,
31706
- translator$1l,
31707
- translator$U,
31708
- translator$1j
31824
+ const propertyTranslators$2 = [
31825
+ translator$1q,
31826
+ translator$Z,
31827
+ translator$1o,
31828
+ translator$1m,
31829
+ translator$V,
31830
+ translator$1k
31709
31831
  ];
31710
- const translator$f = NodeTranslator.from(
31711
- createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$1)
31832
+ const translator$g = NodeTranslator.from(
31833
+ createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$2)
31712
31834
  );
31713
- const propertyTranslators = [
31835
+ const propertyTranslators$1 = [
31836
+ translator$s,
31837
+ translator$1E,
31838
+ translator$2c,
31714
31839
  translator$r,
31715
- translator$1D,
31716
- translator$2b,
31840
+ translator$D,
31717
31841
  translator$q,
31718
- translator$C,
31719
31842
  translator$p,
31720
31843
  translator$o,
31721
31844
  translator$n,
@@ -31725,14 +31848,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31725
31848
  translator$j,
31726
31849
  translator$i,
31727
31850
  translator$h,
31728
- translator$g,
31729
- translator$H,
31730
- translator$f
31851
+ translator$I,
31852
+ translator$g
31731
31853
  ];
31732
- const translator$e = NodeTranslator.from(
31733
- createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators)
31854
+ const translator$f = NodeTranslator.from(
31855
+ createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators$1)
31734
31856
  );
31735
- const translator$d = NodeTranslator.from(
31857
+ const translator$e = NodeTranslator.from(
31736
31858
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
31737
31859
  );
31738
31860
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -31790,7 +31912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31790
31912
  const node2 = nodes[0];
31791
31913
  const attributes = encodeProperties(
31792
31914
  { ...params2, nodes: [node2] },
31793
- { [translator$d.xmlName]: translator$d },
31915
+ { [translator$e.xmlName]: translator$e },
31794
31916
  true
31795
31917
  );
31796
31918
  return {
@@ -31832,10 +31954,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31832
31954
  const roundedWidth = Math.round(numericWidth);
31833
31955
  const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
31834
31956
  const safeWidth = Math.max(roundedWidth, minimumWidth);
31835
- const decoded = translator$d.decode({
31957
+ const decoded = translator$e.decode({
31836
31958
  node: { type: (
31837
31959
  /** @type {string} */
31838
- translator$d.sdNodeOrKeyName
31960
+ translator$e.sdNodeOrKeyName
31839
31961
  ), attrs: { col: safeWidth } }
31840
31962
  });
31841
31963
  if (decoded) elements.push(decoded);
@@ -31877,7 +31999,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31877
31999
  encode: encode$r,
31878
32000
  decode: decode$t
31879
32001
  };
31880
- const translator$c = NodeTranslator.from(config$c);
32002
+ const translator$d = NodeTranslator.from(config$c);
32003
+ const propertyTranslators = [translator$f, translator$K];
32004
+ const translator$c = NodeTranslator.from(
32005
+ createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators)
32006
+ );
31881
32007
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
31882
32008
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
31883
32009
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -31947,14 +32073,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31947
32073
  const node2 = nodes[0];
31948
32074
  const tblPr = node2.elements.find((el) => el.name === "w:tblPr");
31949
32075
  if (tblPr) {
31950
- const encodedProperties = translator$e.encode({ ...params2, nodes: [tblPr] });
32076
+ const encodedProperties = translator$f.encode({ ...params2, nodes: [tblPr] });
31951
32077
  encodedAttrs["tableProperties"] = encodedProperties || {};
31952
32078
  } else {
31953
32079
  encodedAttrs["tableProperties"] ||= {};
31954
32080
  }
31955
32081
  const tblGrid = node2.elements.find((el) => el.name === "w:tblGrid");
31956
32082
  if (tblGrid) {
31957
- encodedAttrs["grid"] = translator$c.encode({ ...params2, nodes: [tblGrid] }).attributes;
32083
+ encodedAttrs["grid"] = translator$d.encode({ ...params2, nodes: [tblGrid] }).attributes;
31958
32084
  }
31959
32085
  [
31960
32086
  "tableStyleId",
@@ -31993,6 +32119,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31993
32119
  };
31994
32120
  }
31995
32121
  }
32122
+ const tableLook = encodedAttrs.tableProperties.tblLook;
31996
32123
  const borderProps = _processTableBorders(encodedAttrs.tableProperties.borders || {});
31997
32124
  const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2) || {};
31998
32125
  encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps };
@@ -32019,14 +32146,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32019
32146
  const totalRows = rows.length;
32020
32147
  const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
32021
32148
  rows.forEach((row2, rowIndex) => {
32022
- const result = translator$w.encode({
32149
+ const result = translator$x.encode({
32023
32150
  ...params2,
32024
32151
  path: [...params2.path || [], node2],
32025
32152
  nodes: [row2],
32026
32153
  extraParams: {
32027
32154
  row: row2,
32028
32155
  table: node2,
32029
- rowBorders: encodedAttrs.borders,
32156
+ tableBorders: encodedAttrs.borders,
32157
+ tableLook,
32030
32158
  columnWidths,
32031
32159
  activeRowSpans: activeRowSpans.slice(),
32032
32160
  rowIndex,
@@ -32090,7 +32218,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32090
32218
  };
32091
32219
  const elements = translateChildNodes({ ...params2, extraParams });
32092
32220
  const firstRow = node2.content?.find((n) => n.type === "tableRow");
32093
- const element2 = translator$c.decode({
32221
+ const element2 = translator$d.decode({
32094
32222
  ...params2,
32095
32223
  node: { ...node2, attrs: { ...node2.attrs, grid } },
32096
32224
  extraParams: {
@@ -32101,7 +32229,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32101
32229
  if (element2) elements.unshift(element2);
32102
32230
  if (node2.attrs?.tableProperties) {
32103
32231
  const properties = { ...node2.attrs.tableProperties };
32104
- const element22 = translator$e.decode({
32232
+ const element22 = translator$f.decode({
32105
32233
  ...params2,
32106
32234
  node: { ...node2, attrs: { ...node2.attrs, tableProperties: properties } }
32107
32235
  });
@@ -32163,7 +32291,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32163
32291
  if (baseTblPr && baseTblPr.elements) {
32164
32292
  tblPr.elements = [...baseTblPr.elements, ...tblPr.elements];
32165
32293
  }
32166
- const tableProperties = translator$e.encode({ ...params2, nodes: [tblPr] });
32294
+ const tableProperties = translator$f.encode({ ...params2, nodes: [tblPr] });
32167
32295
  if (tableProperties) {
32168
32296
  const borders = _processTableBorders(tableProperties.borders || {});
32169
32297
  if (borders || Object.keys(borders).length) stylesToReturn.borders = borders;
@@ -32179,7 +32307,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32179
32307
  if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
32180
32308
  }
32181
32309
  }
32182
- return stylesToReturn;
32310
+ const tblStylePr = styleTag.elements.filter((el) => el.name === "w:tblStylePr");
32311
+ let styleProps = {};
32312
+ if (tblStylePr) {
32313
+ styleProps = tblStylePr.reduce((acc, el) => {
32314
+ acc[el.attributes["w:type"]] = translator$c.encode({ ...params2, nodes: [el] });
32315
+ return acc;
32316
+ }, {});
32317
+ }
32318
+ return {
32319
+ ...stylesToReturn,
32320
+ ...styleProps
32321
+ };
32183
32322
  }
32184
32323
  const config$b = {
32185
32324
  xmlName: XML_NODE_NAME$c,
@@ -32955,7 +33094,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32955
33094
  if (isHorizontalRule) {
32956
33095
  schemaAttrs.horizontalRule = true;
32957
33096
  }
32958
- const pElement = translator$13.encode({
33097
+ const pElement = translator$14.encode({
32959
33098
  ...params2,
32960
33099
  nodes: [{ ...pNode, elements: pNode.elements.filter((el) => el.name !== "w:r") }]
32961
33100
  });
@@ -33015,7 +33154,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33015
33154
  return { nodes: [], consumed: 0 };
33016
33155
  }
33017
33156
  const translatorParams = { ...params2, nodes: [node2] };
33018
- const schemaNode = translator$t.encode(translatorParams);
33157
+ const schemaNode = translator$u.encode(translatorParams);
33019
33158
  const newNodes = schemaNode ? [schemaNode] : [];
33020
33159
  return { nodes: newNodes, consumed: 1 };
33021
33160
  };
@@ -33143,7 +33282,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33143
33282
  });
33144
33283
  break;
33145
33284
  case "w:ins":
33146
- result = translator$1x.encode({
33285
+ result = translator$1y.encode({
33147
33286
  ...translatorParams,
33148
33287
  extraParams: {
33149
33288
  ...translatorParams.extraParams,
@@ -33158,8 +33297,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33158
33297
  handlerName: "trackChangeNodeHandler",
33159
33298
  handler: handleTrackChangeNode
33160
33299
  };
33161
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$12);
33162
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$11);
33300
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$13);
33301
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$12);
33163
33302
  const XML_NODE_NAME$1 = "w:t";
33164
33303
  const SD_NODE_NAME$1 = "text";
33165
33304
  const validXmlAttributes$1 = [createAttributeHandler("xml:space", "xmlSpace")];
@@ -33204,12 +33343,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33204
33343
  case "trackDelete":
33205
33344
  return translator$2.decode(params2);
33206
33345
  case "trackInsert":
33207
- return translator$1x.decode(params2);
33346
+ return translator$1y.decode(params2);
33208
33347
  }
33209
33348
  }
33210
33349
  const isLinkNode = node2.marks?.some((m2) => m2.type === "link");
33211
33350
  if (isLinkNode && !extraParams?.linkProcessed) {
33212
- return translator$12.decode(params2);
33351
+ return translator$13.decode(params2);
33213
33352
  }
33214
33353
  const { text: text2, marks = [] } = node2;
33215
33354
  return getTextNodeForExport(text2, marks, params2);
@@ -33251,7 +33390,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33251
33390
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
33252
33391
  return { nodes: [], consumed: 0 };
33253
33392
  }
33254
- const schemaNode = translator$13.encode(params2);
33393
+ const schemaNode = translator$14.encode(params2);
33255
33394
  const newNodes = schemaNode ? [schemaNode] : [];
33256
33395
  return { nodes: newNodes, consumed: 1 };
33257
33396
  };
@@ -33264,7 +33403,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33264
33403
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
33265
33404
  return { nodes: [], consumed: 0 };
33266
33405
  }
33267
- const result = translator$s.encode(params2);
33406
+ const result = translator$t.encode(params2);
33268
33407
  if (!result) {
33269
33408
  return { nodes: [], consumed: 0 };
33270
33409
  }
@@ -33280,152 +33419,152 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33280
33419
  };
33281
33420
  const translatorList = Array.from(
33282
33421
  /* @__PURE__ */ new Set([
33283
- translator$1N,
33422
+ translator$1O,
33284
33423
  translator$6,
33285
33424
  translator$5,
33286
33425
  translator$4,
33287
33426
  translator$3,
33427
+ translator$1N,
33288
33428
  translator$1M,
33289
33429
  translator$1L,
33290
- translator$1K,
33430
+ translator$2p,
33431
+ translator$1t,
33291
33432
  translator$2o,
33292
- translator$1s,
33293
33433
  translator$2n,
33294
- translator$2m,
33295
- translator$r,
33434
+ translator$s,
33296
33435
  translator$9,
33297
33436
  translator$a,
33298
- translator$1q,
33299
- translator$2r,
33300
- translator$G,
33301
- translator$2c,
33437
+ translator$1r,
33438
+ translator$2s,
33439
+ translator$H,
33440
+ translator$2d,
33441
+ translator$1J,
33442
+ translator$2i,
33302
33443
  translator$1I,
33303
- translator$2h,
33304
- translator$1H,
33305
- translator$1R,
33444
+ translator$1S,
33306
33445
  translator$2,
33307
- translator$1G,
33308
- translator$t,
33309
- translator$2i,
33310
- translator$1T,
33311
- translator$1Z,
33312
- translator$1Y,
33313
- translator$25,
33314
- translator$Z,
33446
+ translator$1H,
33447
+ translator$u,
33448
+ translator$2j,
33315
33449
  translator$1U,
33316
- translator$1F,
33450
+ translator$1_,
33451
+ translator$1Z,
33452
+ translator$26,
33453
+ translator$_,
33454
+ translator$1V,
33455
+ translator$1G,
33456
+ translator$G,
33317
33457
  translator$F,
33318
- translator$E,
33319
- translator$d,
33320
- translator$$,
33321
- translator$L,
33322
- translator$K,
33323
- translator$D,
33458
+ translator$e,
33459
+ translator$10,
33324
33460
  translator$M,
33325
- translator$2q,
33326
- translator$12,
33327
- translator$2l,
33328
- translator$1Q,
33461
+ translator$L,
33462
+ translator$E,
33463
+ translator$N,
33464
+ translator$2r,
33465
+ translator$13,
33466
+ translator$2m,
33467
+ translator$1R,
33468
+ translator$1z,
33469
+ translator$1F,
33470
+ translator$25,
33329
33471
  translator$1y,
33330
- translator$1E,
33331
- translator$24,
33332
- translator$1x,
33472
+ translator$Y,
33333
33473
  translator$X,
33334
- translator$W,
33474
+ translator$1E,
33335
33475
  translator$1D,
33336
33476
  translator$1C,
33477
+ translator$1X,
33337
33478
  translator$1B,
33338
- translator$1W,
33479
+ translator$2b,
33480
+ translator$1p,
33339
33481
  translator$1A,
33340
- translator$2a,
33341
- translator$1o,
33342
- translator$1z,
33343
- translator$23,
33344
- translator$Q,
33482
+ translator$24,
33483
+ translator$R,
33484
+ translator$1x,
33345
33485
  translator$1w,
33486
+ translator$22,
33346
33487
  translator$1v,
33347
- translator$21,
33348
33488
  translator$1u,
33349
- translator$1t,
33350
- translator$22,
33351
- translator$13,
33352
- translator$1g,
33353
- translator$1i,
33354
- translator$1V,
33489
+ translator$23,
33355
33490
  translator$14,
33356
33491
  translator$1h,
33492
+ translator$1j,
33493
+ translator$1W,
33494
+ translator$15,
33495
+ translator$1i,
33357
33496
  translator$8,
33358
33497
  translator$7,
33359
- translator$11,
33498
+ translator$12,
33499
+ translator$2h,
33500
+ translator$1P,
33360
33501
  translator$2g,
33361
- translator$1O,
33362
- translator$2f,
33363
- translator$1S,
33364
- translator$1m,
33365
- translator$s,
33366
- translator$20,
33367
- translator$2b,
33502
+ translator$1T,
33503
+ translator$1n,
33504
+ translator$t,
33505
+ translator$21,
33506
+ translator$2c,
33507
+ translator$28,
33368
33508
  translator$27,
33369
- translator$26,
33509
+ translator$1g,
33370
33510
  translator$1f,
33371
33511
  translator$1e,
33372
33512
  translator$1d,
33373
- translator$1c,
33374
- translator$1_,
33375
- translator$V,
33376
- translator$2j,
33513
+ translator$1$,
33514
+ translator$W,
33515
+ translator$2k,
33516
+ translator$2f,
33377
33517
  translator$2e,
33378
- translator$2d,
33379
33518
  translator$1,
33380
- translator$2p,
33381
- translator$1b,
33519
+ translator$2q,
33520
+ translator$1c,
33382
33521
  translator$b,
33383
- translator$H,
33522
+ translator$I,
33523
+ translator$r,
33524
+ translator$g,
33525
+ translator$D,
33384
33526
  translator$q,
33385
- translator$f,
33527
+ translator$d,
33386
33528
  translator$C,
33387
33529
  translator$p,
33388
- translator$c,
33389
- translator$B,
33390
33530
  translator$o,
33391
33531
  translator$n,
33392
33532
  translator$m,
33533
+ translator$f,
33393
33534
  translator$l,
33394
- translator$e,
33395
33535
  translator$k,
33396
33536
  translator$j,
33397
33537
  translator$i,
33398
33538
  translator$h,
33399
- translator$g,
33400
- translator$I,
33401
- translator$R,
33402
- translator$O,
33403
- translator$P,
33404
33539
  translator$J,
33405
- translator$10,
33406
- translator$19,
33407
- translator$T,
33408
- translator$w,
33409
33540
  translator$S,
33410
- translator$A,
33411
- translator$x,
33541
+ translator$P,
33542
+ translator$Q,
33543
+ translator$K,
33544
+ translator$11,
33412
33545
  translator$1a,
33546
+ translator$U,
33547
+ translator$x,
33548
+ translator$T,
33549
+ translator$B,
33550
+ translator$y,
33551
+ translator$1b,
33552
+ translator$19,
33413
33553
  translator$18,
33414
- translator$17,
33415
- translator$1k,
33416
- translator$2k,
33417
- translator$N,
33418
- translator$1$,
33419
- translator$28,
33420
- translator$_,
33421
- translator$1X,
33554
+ translator$1l,
33555
+ translator$2l,
33556
+ translator$O,
33557
+ translator$20,
33558
+ translator$29,
33559
+ translator$$,
33560
+ translator$1Y,
33561
+ translator$A,
33422
33562
  translator$z,
33423
- translator$y,
33424
- translator$1P,
33563
+ translator$1Q,
33564
+ translator$17,
33425
33565
  translator$16,
33426
- translator$15,
33566
+ translator$w,
33427
33567
  translator$v,
33428
- translator$u,
33429
33568
  commentRangeStartTranslator,
33430
33569
  commentRangeEndTranslator
33431
33570
  ])
@@ -33530,7 +33669,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33530
33669
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
33531
33670
  return { nodes: [], consumed: 0 };
33532
33671
  }
33533
- const result = translator$2r.encode(params2);
33672
+ const result = translator$2s.encode(params2);
33534
33673
  if (!result) return { nodes: [], consumed: 0 };
33535
33674
  return {
33536
33675
  nodes: [result],
@@ -33674,7 +33813,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33674
33813
  ...currentNode,
33675
33814
  type: "element"
33676
33815
  };
33677
- const translated = translator$1N.encode({
33816
+ const translated = translator$1O.encode({
33678
33817
  ...params2,
33679
33818
  nodes: [nodeForTranslator],
33680
33819
  extraParams: { ...params2.extraParams || {}, node: nodeForTranslator }
@@ -34456,7 +34595,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34456
34595
  if (!nodes.length || nodes[0].name !== "w:tab") {
34457
34596
  return { nodes: [], consumed: 0 };
34458
34597
  }
34459
- const node2 = translator$2p.encode(params2);
34598
+ const node2 = translator$2q.encode(params2);
34460
34599
  return { nodes: [node2], consumed: 1 };
34461
34600
  };
34462
34601
  const tabNodeEntityHandler = {
@@ -36034,7 +36173,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36034
36173
  if (vmlAttributes || horizontalRule) {
36035
36174
  return translateVRectContentBlock(params2);
36036
36175
  }
36037
- const alternateContent = translator$1N.decode(params2);
36176
+ const alternateContent = translator$1O.decode(params2);
36038
36177
  return wrapTextInRun(alternateContent);
36039
36178
  }
36040
36179
  function translateVRectContentBlock(params2) {
@@ -36501,19 +36640,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36501
36640
  doc: translateDocumentNode,
36502
36641
  body: translateBodyNode,
36503
36642
  heading: translateHeadingNode,
36504
- paragraph: translator$13,
36505
- run: translator$11,
36643
+ paragraph: translator$14,
36644
+ run: translator$12,
36506
36645
  text: translator$1,
36507
- lineBreak: translator$2r,
36646
+ lineBreak: translator$2s,
36508
36647
  table: translator$b,
36509
- tableRow: translator$w,
36510
- tableCell: translator$I,
36648
+ tableRow: translator$x,
36649
+ tableCell: translator$J,
36511
36650
  bookmarkStart: translator$a,
36512
36651
  bookmarkEnd: translator$9,
36513
- fieldAnnotation: translator$s,
36514
- tab: translator$2p,
36515
- image: translator$t,
36516
- hardBreak: translator$2r,
36652
+ fieldAnnotation: translator$t,
36653
+ tab: translator$2q,
36654
+ image: translator$u,
36655
+ hardBreak: translator$2s,
36517
36656
  commentRangeStart: commentRangeStartTranslator,
36518
36657
  commentRangeEnd: commentRangeEndTranslator,
36519
36658
  permStart: translator$8,
@@ -36524,10 +36663,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36524
36663
  contentBlock: translator,
36525
36664
  vectorShape: translateVectorShape,
36526
36665
  shapeGroup: translateShapeGroup,
36527
- structuredContent: translator$s,
36528
- structuredContentBlock: translator$s,
36529
- documentPartObject: translator$s,
36530
- documentSection: translator$s,
36666
+ structuredContent: translator$t,
36667
+ structuredContentBlock: translator$t,
36668
+ documentPartObject: translator$t,
36669
+ documentSection: translator$t,
36531
36670
  "page-number": translator$4,
36532
36671
  "total-page-number": translator$3,
36533
36672
  pageReference: translator$6,
@@ -36612,7 +36751,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36612
36751
  // Maps to Heading1, Heading2, etc. in Word
36613
36752
  }
36614
36753
  };
36615
- return translator$13.decode({ ...params2, node: paragraphNode });
36754
+ return translator$14.decode({ ...params2, node: paragraphNode });
36616
36755
  }
36617
36756
  function translateDocumentNode(params2) {
36618
36757
  const bodyNode = {
@@ -36681,7 +36820,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36681
36820
  markElement.type = "element";
36682
36821
  break;
36683
36822
  case "underline": {
36684
- const translated = translator$2k.decode({
36823
+ const translated = translator$2l.decode({
36685
36824
  node: {
36686
36825
  attrs: {
36687
36826
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -36745,7 +36884,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36745
36884
  break;
36746
36885
  case "highlight": {
36747
36886
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
36748
- const translated = translator$2q.decode({ node: { attrs: { highlight: highlightValue } } });
36887
+ const translated = translator$2r.decode({ node: { attrs: { highlight: highlightValue } } });
36749
36888
  return translated || {};
36750
36889
  }
36751
36890
  case "strike":
@@ -36879,7 +37018,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36879
37018
  return newComment;
36880
37019
  };
36881
37020
  const getCommentDefinition = (comment2, commentId, allComments, editor) => {
36882
- const translatedText = translator$13.decode({ editor, node: comment2.commentJSON });
37021
+ const translatedText = translator$14.decode({ editor, node: comment2.commentJSON });
36883
37022
  const attributes = {
36884
37023
  "w:id": String(commentId),
36885
37024
  "w:author": comment2.creatorName || comment2.importedAuthor?.name,
@@ -37564,7 +37703,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37564
37703
  static getStoredSuperdocVersion(docx) {
37565
37704
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
37566
37705
  }
37567
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.5.0-next.7") {
37706
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.5.0-next.9") {
37568
37707
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
37569
37708
  }
37570
37709
  /**
@@ -63447,7 +63586,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63447
63586
  return false;
63448
63587
  }
63449
63588
  };
63450
- const summaryVersion = "1.5.0-next.7";
63589
+ const summaryVersion = "1.5.0-next.9";
63451
63590
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
63452
63591
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
63453
63592
  function mapAttributes(attrs) {
@@ -66105,7 +66244,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66105
66244
  * Process collaboration migrations
66106
66245
  */
66107
66246
  processCollaborationMigrations() {
66108
- console.debug("[checkVersionMigrations] Current editor version", "1.5.0-next.7");
66247
+ console.debug("[checkVersionMigrations] Current editor version", "1.5.0-next.9");
66109
66248
  if (!this.options.ydoc) return;
66110
66249
  const metaMap = this.options.ydoc.getMap("meta");
66111
66250
  let docVersion = metaMap.get("version");
@@ -71393,7 +71532,8 @@ ${o}
71393
71532
  // The primary fix uses accurate font metrics from Canvas API, but this
71394
71533
  // provides defense-in-depth against any remaining sub-pixel rendering
71395
71534
  // differences between measurement and display.
71396
- overflow: "visible"
71535
+ overflow: "visible",
71536
+ zIndex: "10"
71397
71537
  });
71398
71538
  const PRINT_STYLES = `
71399
71539
  @media print {
@@ -71699,6 +71839,7 @@ ${o}
71699
71839
  border: 1px solid #629be7;
71700
71840
  position: relative;
71701
71841
  display: inline;
71842
+ z-index: 10;
71702
71843
  }
71703
71844
 
71704
71845
  /* Hover effect for inline structured content */
@@ -76888,11 +77029,6 @@ ${o}
76888
77029
  } else {
76889
77030
  delete el.dataset.pmEnd;
76890
77031
  }
76891
- if (fragment.pmStart != null && fragment.pmEnd != null) {
76892
- el.title = `PM ${fragment.pmStart}–${fragment.pmEnd}`;
76893
- } else {
76894
- el.removeAttribute("title");
76895
- }
76896
77032
  if (fragment.continuesFromPrev) {
76897
77033
  el.dataset.continuesFromPrev = "true";
76898
77034
  } else {
@@ -91585,8 +91721,8 @@ ${o}
91585
91721
  encode: (params2) => translator2.encode(params2)
91586
91722
  });
91587
91723
  const ooxmlResolver = createOoxmlResolver({
91588
- pPr: toOoxmlTranslator(translator$14),
91589
- rPr: toOoxmlTranslator(translator$1O)
91724
+ pPr: toOoxmlTranslator(translator$15),
91725
+ rPr: toOoxmlTranslator(translator$1P)
91590
91726
  });
91591
91727
  const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
91592
91728
  if (!hasParagraphStyleContext(context)) {
@@ -96980,8 +97116,6 @@ ${o}
96980
97116
  #activeRegion = null;
96981
97117
  /** Full-width border line element (MS Word style) */
96982
97118
  #borderLine = null;
96983
- /** Dimming overlay element (for dimming body content during editing) */
96984
- #dimmingOverlay = null;
96985
97119
  /**
96986
97120
  * Creates a new EditorOverlayManager instance.
96987
97121
  *
@@ -97275,17 +97409,6 @@ ${o}
97275
97409
  }
97276
97410
  }
97277
97411
  }
97278
- /**
97279
- * Hides and removes the dimming overlay.
97280
- * @internal Reserved for future implementation of body dimming during header/footer editing.
97281
- */
97282
- // eslint-disable-next-line no-unused-private-class-members
97283
- #hideDimmingOverlay() {
97284
- if (this.#dimmingOverlay) {
97285
- this.#dimmingOverlay.remove();
97286
- this.#dimmingOverlay = null;
97287
- }
97288
- }
97289
97412
  /**
97290
97413
  * Shows a full-width border line at the bottom of the header or top of the footer.
97291
97414
  * This creates the MS Word style visual indicator spanning edge-to-edge of the page.
@@ -99458,6 +99581,7 @@ ${o}
99458
99581
  #viewportHost;
99459
99582
  #painterHost;
99460
99583
  #selectionOverlay;
99584
+ #permissionOverlay = null;
99461
99585
  #hiddenHost;
99462
99586
  #layoutOptions;
99463
99587
  #layoutState = { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() };
@@ -99617,6 +99741,16 @@ ${o}
99617
99741
  });
99618
99742
  this.#domIndexObserverManager.setup();
99619
99743
  this.#selectionSync.on("render", () => this.#updateSelection());
99744
+ this.#selectionSync.on("render", () => this.#updatePermissionOverlay());
99745
+ this.#permissionOverlay = doc2.createElement("div");
99746
+ this.#permissionOverlay.className = "presentation-editor__permission-overlay";
99747
+ Object.assign(this.#permissionOverlay.style, {
99748
+ position: "absolute",
99749
+ inset: "0",
99750
+ pointerEvents: "none",
99751
+ zIndex: "5"
99752
+ });
99753
+ this.#viewportHost.appendChild(this.#permissionOverlay);
99620
99754
  this.#selectionOverlay = doc2.createElement("div");
99621
99755
  this.#selectionOverlay.className = "presentation-editor__selection-overlay";
99622
99756
  this.#selectionOverlay.id = `presentation-overlay-${options.documentId || "default"}`;
@@ -99702,7 +99836,7 @@ ${o}
99702
99836
  const normalizedEditorProps = {
99703
99837
  ...editorOptions.editorProps ?? {},
99704
99838
  editable: () => {
99705
- return this.#documentMode !== "viewing";
99839
+ return !this.#isViewLocked();
99706
99840
  }
99707
99841
  };
99708
99842
  try {
@@ -100144,6 +100278,7 @@ ${o}
100144
100278
  this.#pendingDocChange = true;
100145
100279
  this.#scheduleRerender();
100146
100280
  }
100281
+ this.#updatePermissionOverlay();
100147
100282
  }
100148
100283
  #syncDocumentModeClass() {
100149
100284
  if (!this.#visibleHost) return;
@@ -101530,7 +101665,7 @@ ${o}
101530
101665
  win,
101531
101666
  this.#visibleHost,
101532
101667
  () => this.#getActiveDomTarget(),
101533
- () => this.#documentMode !== "viewing"
101668
+ () => !this.#isViewLocked()
101534
101669
  );
101535
101670
  this.#inputBridge.bind();
101536
101671
  }
@@ -102429,7 +102564,7 @@ ${o}
102429
102564
  this.#dragUsedPageNotMountedFallback = false;
102430
102565
  return;
102431
102566
  }
102432
- if (this.#session.mode !== "body" || this.#documentMode === "viewing") {
102567
+ if (this.#session.mode !== "body" || this.#isViewLocked()) {
102433
102568
  this.#dragLastPointer = null;
102434
102569
  this.#dragLastRawHit = null;
102435
102570
  this.#dragUsedPageNotMountedFallback = false;
@@ -102779,6 +102914,7 @@ ${o}
102779
102914
  this.#epochMapper.onLayoutComplete(layoutEpoch);
102780
102915
  this.#selectionSync.onLayoutComplete(layoutEpoch);
102781
102916
  layoutCompleted = true;
102917
+ this.#updatePermissionOverlay();
102782
102918
  this.#layoutError = null;
102783
102919
  this.#layoutErrorState = "healthy";
102784
102920
  this.#dismissErrorBanner();
@@ -102867,7 +103003,7 @@ ${o}
102867
103003
  if (!this.#localSelectionLayer) {
102868
103004
  return;
102869
103005
  }
102870
- if (this.#documentMode === "viewing") {
103006
+ if (this.#isViewLocked()) {
102871
103007
  try {
102872
103008
  this.#localSelectionLayer.innerHTML = "";
102873
103009
  } catch (error) {
@@ -102937,6 +103073,76 @@ ${o}
102937
103073
  } catch (error) {
102938
103074
  }
102939
103075
  }
103076
+ /**
103077
+ * Updates the permission overlay (w:permStart/w:permEnd) to match the current editor permission ranges.
103078
+ *
103079
+ * This method is called after layout completes to ensure permission overlay
103080
+ * is based on stable permission ranges data.
103081
+ */
103082
+ #updatePermissionOverlay() {
103083
+ const overlay2 = this.#permissionOverlay;
103084
+ if (!overlay2) {
103085
+ return;
103086
+ }
103087
+ if (this.#session.mode !== "body") {
103088
+ overlay2.innerHTML = "";
103089
+ return;
103090
+ }
103091
+ const permissionStorage = this.#editor?.storage?.permissionRanges;
103092
+ const ranges = permissionStorage?.ranges ?? [];
103093
+ const shouldRender = ranges.length > 0;
103094
+ if (!shouldRender) {
103095
+ overlay2.innerHTML = "";
103096
+ return;
103097
+ }
103098
+ const layout = this.#layoutState.layout;
103099
+ if (!layout) {
103100
+ overlay2.innerHTML = "";
103101
+ return;
103102
+ }
103103
+ const docEpoch = this.#epochMapper.getCurrentEpoch();
103104
+ if (this.#layoutEpoch < docEpoch) {
103105
+ return;
103106
+ }
103107
+ const pageHeight = this.#getBodyPageHeight();
103108
+ const pageGap = layout.pageGap ?? this.#getEffectivePageGap();
103109
+ const fragment = overlay2.ownerDocument?.createDocumentFragment();
103110
+ if (!fragment) {
103111
+ overlay2.innerHTML = "";
103112
+ return;
103113
+ }
103114
+ ranges.forEach(({ from: from2, to }) => {
103115
+ const rects = this.#computeSelectionRectsFromDom(from2, to);
103116
+ if (!rects?.length) {
103117
+ return;
103118
+ }
103119
+ rects.forEach((rect) => {
103120
+ const pageLocalY = rect.y - rect.pageIndex * (pageHeight + pageGap);
103121
+ const coords = this.#convertPageLocalToOverlayCoords(rect.pageIndex, rect.x, pageLocalY);
103122
+ if (!coords) {
103123
+ return;
103124
+ }
103125
+ const highlight = overlay2.ownerDocument?.createElement("div");
103126
+ if (!highlight) {
103127
+ return;
103128
+ }
103129
+ highlight.className = "presentation-editor__permission-highlight";
103130
+ Object.assign(highlight.style, {
103131
+ position: "absolute",
103132
+ left: `${coords.x}px`,
103133
+ top: `${coords.y}px`,
103134
+ width: `${Math.max(1, rect.width)}px`,
103135
+ height: `${Math.max(1, rect.height)}px`,
103136
+ borderRadius: "2px",
103137
+ pointerEvents: "none",
103138
+ zIndex: 1
103139
+ });
103140
+ fragment.appendChild(highlight);
103141
+ });
103142
+ });
103143
+ overlay2.innerHTML = "";
103144
+ overlay2.appendChild(fragment);
103145
+ }
102940
103146
  #resolveLayoutOptions(blocks2, sectionMetadata) {
102941
103147
  const defaults2 = this.#computeDefaultLayoutDefaults();
102942
103148
  const firstSection = blocks2?.find(
@@ -103682,7 +103888,7 @@ ${o}
103682
103888
  this.#announce(announcement.message);
103683
103889
  }
103684
103890
  #validateHeaderFooterEditPermission() {
103685
- if (this.#documentMode === "viewing") {
103891
+ if (this.#isViewLocked()) {
103686
103892
  return { allowed: false, reason: "documentMode" };
103687
103893
  }
103688
103894
  if (!this.#editor.isEditable) {
@@ -104539,6 +104745,17 @@ ${o}
104539
104745
  this.#errorBanner = null;
104540
104746
  this.#errorBannerMessage = null;
104541
104747
  }
104748
+ /**
104749
+ * Determines whether the current viewing mode should block edits.
104750
+ * When documentMode is viewing but the active editor has been toggled
104751
+ * back to editable (e.g. permission ranges), we treat the view as editable.
104752
+ */
104753
+ #isViewLocked() {
104754
+ if (this.#documentMode !== "viewing") return false;
104755
+ const hasPermissionOverride = !!this.#editor?.storage?.permissionRanges?.hasAllowedRanges;
104756
+ if (hasPermissionOverride) return false;
104757
+ return this.#documentMode === "viewing";
104758
+ }
104542
104759
  /**
104543
104760
  * Applies vertical alignment and font scaling to layout DOM elements for subscript/superscript rendering.
104544
104761
  *
@@ -106418,6 +106635,11 @@ ${o}
106418
106635
  parseTagObject
106419
106636
  }, Symbol.toStringTag, { value: "Module" }));
106420
106637
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
106638
+ function isValidIntegerId(id) {
106639
+ if (id === null || id === void 0) return true;
106640
+ const str = String(id);
106641
+ return /^-?\d+$/.test(str);
106642
+ }
106421
106643
  const findFirstTextNode = (node2) => {
106422
106644
  let firstTextNode = null;
106423
106645
  node2.descendants((child) => {
@@ -106459,6 +106681,9 @@ ${o}
106459
106681
  * });
106460
106682
  */
106461
106683
  insertStructuredContentInline: (options = {}) => ({ editor, dispatch, state, tr }) => {
106684
+ if (options.attrs?.id !== void 0 && !isValidIntegerId(options.attrs.id)) {
106685
+ throw new Error("Invalid structured content id - must be an integer, got: " + options.attrs.id);
106686
+ }
106462
106687
  const { schema } = editor;
106463
106688
  let { from: from2, to } = state.selection;
106464
106689
  if (dispatch) {
@@ -106521,6 +106746,9 @@ ${o}
106521
106746
  * });
106522
106747
  */
106523
106748
  insertStructuredContentBlock: (options = {}) => ({ editor, dispatch, state, tr }) => {
106749
+ if (options.attrs?.id !== void 0 && !isValidIntegerId(options.attrs.id)) {
106750
+ throw new Error("Invalid structured content id - must be an integer, got: " + options.attrs.id);
106751
+ }
106524
106752
  const { schema } = editor;
106525
106753
  let { from: from2, to } = state.selection;
106526
106754
  if (dispatch) {
@@ -106578,6 +106806,9 @@ ${o}
106578
106806
  * });
106579
106807
  */
106580
106808
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state, tr }) => {
106809
+ if (options.attrs?.id !== void 0 && !isValidIntegerId(options.attrs.id)) {
106810
+ throw new Error("Invalid structured content id - must be an integer, got: " + options.attrs.id);
106811
+ }
106581
106812
  const structuredContentTags = getStructuredContentTagsById(id, state);
106582
106813
  if (!structuredContentTags.length) {
106583
106814
  return true;
@@ -106705,6 +106936,9 @@ ${o}
106705
106936
  * });
106706
106937
  */
106707
106938
  updateStructuredContentByGroup: (group, options = {}) => ({ editor, dispatch, state, tr }) => {
106939
+ if (options.attrs?.id !== void 0 && !isValidIntegerId(options.attrs.id)) {
106940
+ throw new Error("Invalid structured content id - must be an integer, got: " + options.attrs.id);
106941
+ }
106708
106942
  const structuredContentTags = getStructuredContentByGroup(group, state);
106709
106943
  if (!structuredContentTags.length) {
106710
106944
  return true;
@@ -107382,7 +107616,7 @@ ${o}
107382
107616
  }
107383
107617
  return merged;
107384
107618
  };
107385
- const collectChangedRanges = (trs, docSize) => {
107619
+ const collectChangedRanges$1 = (trs, docSize) => {
107386
107620
  const ranges = [];
107387
107621
  trs.forEach((tr) => {
107388
107622
  if (!tr.docChanged) return;
@@ -107585,7 +107819,7 @@ ${o}
107585
107819
  const runType = newState.schema.nodes.run;
107586
107820
  if (!runType) return null;
107587
107821
  pendingRanges = mapRangesThroughTransactions(pendingRanges, transactions, docSize);
107588
- const changedRanges = collectChangedRanges(transactions, docSize);
107822
+ const changedRanges = collectChangedRanges$1(transactions, docSize);
107589
107823
  pendingRanges = mergeRanges$2([...pendingRanges, ...changedRanges], docSize);
107590
107824
  if (view?.composing) {
107591
107825
  return null;
@@ -122336,6 +122570,283 @@ ${o}
122336
122570
  return [nodeResizer(["image"], this.editor)];
122337
122571
  }
122338
122572
  });
122573
+ const PERMISSION_PLUGIN_KEY = new PluginKey("permissionRanges");
122574
+ const EVERYONE_GROUP = "everyone";
122575
+ const EMPTY_IDENTIFIER_SET = Object.freeze(/* @__PURE__ */ new Set());
122576
+ const normalizeIdentifier$1 = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
122577
+ const buildAllowedIdentifierSet = (editor) => {
122578
+ const email = normalizeIdentifier$1(editor?.options?.user?.email);
122579
+ if (!email) {
122580
+ return EMPTY_IDENTIFIER_SET;
122581
+ }
122582
+ const [localPart, domain2] = email.split("@");
122583
+ if (!localPart || !domain2) {
122584
+ return EMPTY_IDENTIFIER_SET;
122585
+ }
122586
+ const formatted = `${domain2}\\${localPart}`;
122587
+ return formatted ? /* @__PURE__ */ new Set([formatted]) : EMPTY_IDENTIFIER_SET;
122588
+ };
122589
+ const isEveryoneGroup = (value) => normalizeIdentifier$1(value) === EVERYONE_GROUP;
122590
+ const isRangeAllowedForUser = (attrs, allowedIdentifiers) => {
122591
+ if (!attrs) return false;
122592
+ if (isEveryoneGroup(attrs.edGrp)) {
122593
+ return true;
122594
+ }
122595
+ if (!allowedIdentifiers?.size) {
122596
+ return false;
122597
+ }
122598
+ const normalizedEd = normalizeIdentifier$1(attrs.ed);
122599
+ return normalizedEd && allowedIdentifiers.has(normalizedEd);
122600
+ };
122601
+ const getPermissionNodeId = (node2, pos, fallbackPrefix) => String(node2.attrs?.id ?? `${fallbackPrefix}-${pos}`);
122602
+ const buildPermissionState = (doc2, allowedIdentifiers = EMPTY_IDENTIFIER_SET) => {
122603
+ const ranges = [];
122604
+ const openRanges = /* @__PURE__ */ new Map();
122605
+ doc2.descendants((node2, pos) => {
122606
+ if (node2.type?.name === "permStart") {
122607
+ const id = getPermissionNodeId(node2, pos, "permStart");
122608
+ openRanges.set(id, {
122609
+ from: pos + node2.nodeSize,
122610
+ attrs: node2.attrs ?? {}
122611
+ });
122612
+ return false;
122613
+ }
122614
+ if (node2.type?.name === "permEnd") {
122615
+ const id = getPermissionNodeId(node2, pos, "permEnd");
122616
+ const start2 = openRanges.get(id);
122617
+ if (start2 && isRangeAllowedForUser(start2.attrs, allowedIdentifiers)) {
122618
+ const to = Math.max(pos, start2.from);
122619
+ if (to > start2.from) {
122620
+ ranges.push({
122621
+ id,
122622
+ from: start2.from,
122623
+ to
122624
+ });
122625
+ }
122626
+ }
122627
+ if (start2) {
122628
+ openRanges.delete(id);
122629
+ }
122630
+ return false;
122631
+ }
122632
+ });
122633
+ return {
122634
+ ranges,
122635
+ hasAllowedRanges: ranges.length > 0
122636
+ };
122637
+ };
122638
+ const collectPermissionTags = (doc2, permStartType, permEndType) => {
122639
+ const tags = /* @__PURE__ */ new Map();
122640
+ doc2.descendants((node2, pos) => {
122641
+ if (node2.type !== permStartType && node2.type !== permEndType) {
122642
+ return;
122643
+ }
122644
+ const id = node2.attrs?.id;
122645
+ if (!id) {
122646
+ return;
122647
+ }
122648
+ const entry = tags.get(id) ?? {};
122649
+ if (node2.type === permStartType) {
122650
+ entry.start = { pos, attrs: node2.attrs ?? {} };
122651
+ } else if (node2.type === permEndType) {
122652
+ entry.end = { pos, attrs: node2.attrs ?? {} };
122653
+ }
122654
+ tags.set(id, entry);
122655
+ });
122656
+ return tags;
122657
+ };
122658
+ const clampPosition = (pos, size2) => {
122659
+ if (Number.isNaN(pos) || !Number.isFinite(pos)) {
122660
+ return 0;
122661
+ }
122662
+ return Math.max(0, Math.min(pos, size2));
122663
+ };
122664
+ const trimPermissionTagsFromRange = (doc2, range2, permStartType, permEndType) => {
122665
+ let from2 = range2.from;
122666
+ let to = range2.to;
122667
+ while (from2 < to) {
122668
+ const node2 = doc2.nodeAt(from2);
122669
+ if (!node2 || node2.type !== permStartType && node2.type !== permEndType) {
122670
+ break;
122671
+ }
122672
+ from2 += node2.nodeSize;
122673
+ }
122674
+ while (to > from2) {
122675
+ const $pos = doc2.resolve(to);
122676
+ const nodeBefore = $pos.nodeBefore;
122677
+ if (!nodeBefore || nodeBefore.type !== permStartType && nodeBefore.type !== permEndType) {
122678
+ break;
122679
+ }
122680
+ to -= nodeBefore.nodeSize;
122681
+ }
122682
+ return { from: from2, to };
122683
+ };
122684
+ const collectChangedRanges = (tr) => {
122685
+ const ranges = [];
122686
+ tr.mapping.maps.forEach((map2) => {
122687
+ map2.forEach((oldStart, oldEnd) => {
122688
+ const from2 = Math.min(oldStart, oldEnd);
122689
+ const to = Math.max(oldStart, oldEnd);
122690
+ ranges.push({ from: from2, to });
122691
+ });
122692
+ });
122693
+ return ranges;
122694
+ };
122695
+ const isRangeAllowed = (range2, allowedRanges) => {
122696
+ if (!allowedRanges?.length) return false;
122697
+ return allowedRanges.some((allowed) => range2.from >= allowed.from && range2.to <= allowed.to);
122698
+ };
122699
+ const PermissionRanges = Extension.create({
122700
+ name: "permissionRanges",
122701
+ addStorage() {
122702
+ return {
122703
+ ranges: [],
122704
+ hasAllowedRanges: false
122705
+ };
122706
+ },
122707
+ addPmPlugins() {
122708
+ const editor = this.editor;
122709
+ const storage = this.storage;
122710
+ let originalSetDocumentMode = null;
122711
+ const getAllowedIdentifiers = () => buildAllowedIdentifierSet(editor);
122712
+ const toggleEditableIfAllowed = (hasAllowedRanges) => {
122713
+ if (!editor || editor.isDestroyed) return;
122714
+ if (editor.options.documentMode !== "viewing") return;
122715
+ if (hasAllowedRanges && !editor.isEditable) {
122716
+ editor.setEditable(true, false);
122717
+ } else if (!hasAllowedRanges && editor.isEditable) {
122718
+ editor.setEditable(false, false);
122719
+ }
122720
+ };
122721
+ const updateEditableState = (hasAllowedRanges) => {
122722
+ const nextValue = Boolean(hasAllowedRanges);
122723
+ const previousValue = storage.hasAllowedRanges;
122724
+ storage.hasAllowedRanges = nextValue;
122725
+ if (previousValue === nextValue) {
122726
+ return;
122727
+ }
122728
+ toggleEditableIfAllowed(nextValue);
122729
+ };
122730
+ if (editor && typeof editor.setDocumentMode === "function") {
122731
+ originalSetDocumentMode = editor.setDocumentMode.bind(editor);
122732
+ editor.setDocumentMode = (mode, caller) => {
122733
+ originalSetDocumentMode(mode, caller);
122734
+ const state = editor.state;
122735
+ if (!state) return;
122736
+ const pluginState = PERMISSION_PLUGIN_KEY.getState(state);
122737
+ if (pluginState) {
122738
+ toggleEditableIfAllowed(pluginState.hasAllowedRanges);
122739
+ }
122740
+ };
122741
+ }
122742
+ return [
122743
+ new Plugin({
122744
+ key: PERMISSION_PLUGIN_KEY,
122745
+ state: {
122746
+ init(_2, state) {
122747
+ const permissionState = buildPermissionState(state.doc, getAllowedIdentifiers());
122748
+ storage.ranges = permissionState.ranges;
122749
+ updateEditableState(permissionState.hasAllowedRanges);
122750
+ return permissionState;
122751
+ },
122752
+ apply(tr, value, _oldState, newState) {
122753
+ let permissionState = value;
122754
+ if (tr.docChanged) {
122755
+ permissionState = buildPermissionState(newState.doc, getAllowedIdentifiers());
122756
+ storage.ranges = permissionState.ranges;
122757
+ updateEditableState(permissionState.hasAllowedRanges);
122758
+ }
122759
+ return permissionState;
122760
+ }
122761
+ },
122762
+ view() {
122763
+ return {
122764
+ destroy() {
122765
+ if (editor && originalSetDocumentMode) {
122766
+ editor.setDocumentMode = originalSetDocumentMode;
122767
+ }
122768
+ }
122769
+ };
122770
+ },
122771
+ // Appends transactions to the document to ensure permission ranges are updated.
122772
+ appendTransaction(transactions, oldState, newState) {
122773
+ if (!transactions.some((tr2) => tr2.docChanged)) return null;
122774
+ const permStartType = newState.schema.nodes["permStart"];
122775
+ const permEndType = newState.schema.nodes["permEnd"];
122776
+ if (!permStartType || !permEndType) return null;
122777
+ const oldTags = collectPermissionTags(oldState.doc, permStartType, permEndType);
122778
+ if (!oldTags.size) {
122779
+ return null;
122780
+ }
122781
+ const newTags = collectPermissionTags(newState.doc, permStartType, permEndType);
122782
+ const mappingToNew = new Mapping();
122783
+ transactions.forEach((tr2) => {
122784
+ mappingToNew.appendMapping(tr2.mapping);
122785
+ });
122786
+ const pendingInsertions = [];
122787
+ oldTags.forEach((tag, id) => {
122788
+ const current = newTags.get(id);
122789
+ if (tag.start && !current?.start) {
122790
+ const mapped = mappingToNew.mapResult(tag.start.pos, -1);
122791
+ pendingInsertions.push({
122792
+ pos: mapped.pos,
122793
+ nodeType: permStartType,
122794
+ attrs: tag.start.attrs,
122795
+ priority: 0
122796
+ });
122797
+ }
122798
+ if (tag.end && !current?.end) {
122799
+ const mapped = mappingToNew.mapResult(tag.end.pos, 1);
122800
+ pendingInsertions.push({
122801
+ pos: mapped.pos,
122802
+ nodeType: permEndType,
122803
+ attrs: tag.end.attrs,
122804
+ priority: 1
122805
+ });
122806
+ }
122807
+ });
122808
+ if (!pendingInsertions.length) {
122809
+ return null;
122810
+ }
122811
+ pendingInsertions.sort((a2, b2) => {
122812
+ if (a2.pos === b2.pos) {
122813
+ return a2.priority - b2.priority;
122814
+ }
122815
+ return a2.pos - b2.pos;
122816
+ });
122817
+ const tr = newState.tr;
122818
+ let offset2 = 0;
122819
+ pendingInsertions.forEach((item) => {
122820
+ const node2 = item.nodeType.create(item.attrs);
122821
+ const insertPos = clampPosition(item.pos + offset2, tr.doc.content.size);
122822
+ tr.insert(insertPos, node2);
122823
+ offset2 += node2.nodeSize;
122824
+ });
122825
+ return tr.docChanged ? tr : null;
122826
+ },
122827
+ // Filters transactions to ensure only allowed edits are applied.
122828
+ filterTransaction(tr, state) {
122829
+ if (!tr.docChanged) return true;
122830
+ if (!editor || editor.options.documentMode !== "viewing") return true;
122831
+ const pluginState = PERMISSION_PLUGIN_KEY.getState(state);
122832
+ if (!pluginState?.hasAllowedRanges) {
122833
+ return true;
122834
+ }
122835
+ const changedRanges = collectChangedRanges(tr);
122836
+ if (!changedRanges.length) return true;
122837
+ const permStartType = state.schema.nodes["permStart"];
122838
+ const permEndType = state.schema.nodes["permEnd"];
122839
+ if (!permStartType || !permEndType) return true;
122840
+ const allRangesAllowed = changedRanges.every((range2) => {
122841
+ const trimmed = trimPermissionTagsFromRange(state.doc, range2, permStartType, permEndType);
122842
+ return isRangeAllowed(trimmed, pluginState.ranges);
122843
+ });
122844
+ return allRangesAllowed;
122845
+ }
122846
+ })
122847
+ ];
122848
+ }
122849
+ });
122339
122850
  const PermStart = Node$2.create({
122340
122851
  name: "permStart",
122341
122852
  group: "inline",
@@ -122495,6 +123006,7 @@ ${o}
122495
123006
  ShapeGroup,
122496
123007
  PermStart,
122497
123008
  PermEnd,
123009
+ PermissionRanges,
122498
123010
  PassthroughInline,
122499
123011
  PassthroughBlock
122500
123012
  ];
@@ -147516,7 +148028,7 @@ ${reason}`);
147516
148028
  this.config.colors = shuffleArray(this.config.colors);
147517
148029
  this.userColorMap = /* @__PURE__ */ new Map();
147518
148030
  this.colorIndex = 0;
147519
- this.version = "1.5.0-next.7";
148031
+ this.version = "1.5.0-next.9";
147520
148032
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
147521
148033
  this.superdocId = config2.superdocId || v4();
147522
148034
  this.colors = this.config.colors;