@office-kit/pptx 0.13.0 → 0.15.0

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.
@@ -520,7 +520,7 @@ const parseElement = (cur, parentScope) => {
520
520
  };
521
521
  const parseXml = (src) => {
522
522
  const cur = {
523
- src: src.charCodeAt(0) === 65279 ? src.slice(1) : src,
523
+ src: (src.charCodeAt(0) === 65279 ? src.slice(1) : src).replace(/\r\n?/g, "\n"),
524
524
  pos: 0
525
525
  };
526
526
  const decl = parseDeclaration(cur);
@@ -1534,285 +1534,6 @@ const textBodyText = (txBody) => {
1534
1534
  return parts.join("\n");
1535
1535
  };
1536
1536
  //#endregion
1537
- //#region src/internal/drawingml/text-body-mutation.ts
1538
- const NAME_BU_CHAR = qname("a", "buChar", NS.dml);
1539
- const NAME_BU_AUTO_NUM = qname("a", "buAutoNum", NS.dml);
1540
- const NAME_BU_NONE$1 = qname("a", "buNone", NS.dml);
1541
- const NAME_BU_FONT = qname("a", "buFont", NS.dml);
1542
- const ATTR_CHAR = qname("", "char", "");
1543
- const ATTR_BU_TYPE = qname("", "type", "");
1544
- const ATTR_START_AT = qname("", "startAt", "");
1545
- const ATTR_TYPEFACE$3 = qname("", "typeface", "");
1546
- const NAME_P$5 = qname("a", "p", NS.dml);
1547
- const NAME_R$4 = qname("a", "r", NS.dml);
1548
- const NAME_T$5 = qname("a", "t", NS.dml);
1549
- const NAME_RPR$6 = qname("a", "rPr", NS.dml);
1550
- const NAME_PPR$1 = qname("a", "pPr", NS.dml);
1551
- NS.xml;
1552
- const cloneAttrs = (attrs) => attrs.map((a) => attr(a.name, a.value));
1553
- const cloneElement = (e) => elem(e.name, {
1554
- attrs: cloneAttrs(e.attrs),
1555
- prefixDecls: new Map(e.prefixDecls),
1556
- children: e.children.map(cloneNode)
1557
- });
1558
- const cloneNode = (n) => {
1559
- switch (n.kind) {
1560
- case "element": return cloneElement(n);
1561
- case "text": return {
1562
- kind: "text",
1563
- data: n.data
1564
- };
1565
- case "cdata": return {
1566
- kind: "cdata",
1567
- data: n.data
1568
- };
1569
- case "comment": return {
1570
- kind: "comment",
1571
- data: n.data
1572
- };
1573
- case "pi": return {
1574
- kind: "pi",
1575
- target: n.target,
1576
- data: n.data
1577
- };
1578
- }
1579
- };
1580
- /**
1581
- * Returns the first `a:rPr` reachable on the first run of the first paragraph
1582
- * inside `txBody`. Used to preserve formatting on text replacement: we clone
1583
- * the original rPr into the new run so font, color, size, etc. survive.
1584
- */
1585
- const findFirstRunProperties = (txBody) => {
1586
- const firstP = firstChildElement(txBody, NAME_P$5);
1587
- if (firstP === null) return null;
1588
- const firstR = firstChildElement(firstP, NAME_R$4);
1589
- if (firstR === null) return null;
1590
- return firstChildElement(firstR, NAME_RPR$6);
1591
- };
1592
- /**
1593
- * Returns the first `a:pPr` from the first paragraph. Used to preserve
1594
- * paragraph-level formatting (alignment, bullet, indent) when replacing.
1595
- */
1596
- const findFirstParagraphProperties = (txBody) => {
1597
- const firstP = firstChildElement(txBody, NAME_P$5);
1598
- if (firstP === null) return null;
1599
- return firstChildElement(firstP, NAME_PPR$1);
1600
- };
1601
- const removeAllParagraphs = (txBody) => {
1602
- txBody.children = txBody.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "p"));
1603
- };
1604
- const TOKEN_PATTERN = /\{\{([^{}]+)\}\}/g;
1605
- /**
1606
- * Replaces `{{key}}` tokens in every `a:t` element under `root` with values
1607
- * from `tokens`. Tokens whose key is not in `tokens` are left untouched.
1608
- *
1609
- * Returns the number of substitutions performed. Useful for callers that
1610
- * want to know whether anything matched.
1611
- *
1612
- * Limitation: a token must fit entirely within one `<a:t>` element to
1613
- * match. PowerPoint normally serializes contiguous user text as a single
1614
- * `<a:t>`, so the limitation only bites when a placeholder was edited
1615
- * character-by-character (causing PowerPoint to split runs). For those
1616
- * cases, fall back to `setText()`.
1617
- */
1618
- const replaceTokensInTree = (root, tokens) => {
1619
- let count = 0;
1620
- walkElements(root, (el) => {
1621
- if (el.name.namespaceURI !== NAME_T$5.namespaceURI) return;
1622
- if (el.name.localName !== "t") return;
1623
- const child = el.children[0];
1624
- if (!child || child.kind !== "text") return;
1625
- const before = child.data;
1626
- let didMatch = false;
1627
- const after = before.replace(TOKEN_PATTERN, (match, key) => {
1628
- if (Object.hasOwn(tokens, key)) {
1629
- didMatch = true;
1630
- return tokens[key] ?? "";
1631
- }
1632
- return match;
1633
- });
1634
- if (didMatch) {
1635
- child.data = after;
1636
- count++;
1637
- }
1638
- });
1639
- return count;
1640
- };
1641
- /**
1642
- * Replaces every occurrence of `from` in every `<a:t>` element under
1643
- * `root` with `to`. `from` may be a string (literal) or a `RegExp`
1644
- * (matched per-run). Returns the count of `<a:t>` elements that were
1645
- * mutated — not the count of substitutions inside them, since callers
1646
- * usually want "did anything change" rather than "how many letters
1647
- * moved."
1648
- *
1649
- * Same single-run constraint as `replaceTokensInTree`: matches must
1650
- * fit inside one `<a:t>`. Use this for the broader "find/replace
1651
- * across the deck" use case where {{token}} syntax isn't a fit.
1652
- */
1653
- const replaceTextInTree = (root, from, to) => {
1654
- const pattern = typeof from === "string" ? new RegExp(from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g") : from.global ? from : new RegExp(from.source, `${from.flags}g`);
1655
- let count = 0;
1656
- walkElements(root, (el) => {
1657
- if (el.name.namespaceURI !== NAME_T$5.namespaceURI) return;
1658
- if (el.name.localName !== "t") return;
1659
- const child = el.children[0];
1660
- if (!child || child.kind !== "text") return;
1661
- const before = child.data;
1662
- const after = before.replace(pattern, to);
1663
- if (after !== before) {
1664
- child.data = after;
1665
- count++;
1666
- }
1667
- });
1668
- return count;
1669
- };
1670
- const normalizeBulletStyle = (s) => {
1671
- if (s === "bullet") return {
1672
- kind: "char",
1673
- char: "•"
1674
- };
1675
- if (s === "number") return {
1676
- kind: "autoNum",
1677
- type: "arabicPeriod"
1678
- };
1679
- if (s === "none") return { kind: "none" };
1680
- if ("char" in s) return {
1681
- kind: "char",
1682
- char: s.char
1683
- };
1684
- return {
1685
- kind: "autoNum",
1686
- type: s.autoNum
1687
- };
1688
- };
1689
- const buildBulletElement = (style) => {
1690
- const n = normalizeBulletStyle(style);
1691
- switch (n.kind) {
1692
- case "char": return elem(NAME_BU_CHAR, { attrs: [attr(ATTR_CHAR, n.char)] });
1693
- case "autoNum": return elem(NAME_BU_AUTO_NUM, { attrs: [attr(ATTR_START_AT, "1"), attr(ATTR_BU_TYPE, n.type)] });
1694
- case "none": return elem(NAME_BU_NONE$1);
1695
- }
1696
- };
1697
- const NAME_PPR_FOR_BULLET = qname("a", "pPr", NS.dml);
1698
- const NAME_P_FOR_BULLET = qname("a", "p", NS.dml);
1699
- const alignToken = (a) => {
1700
- switch (a) {
1701
- case "left":
1702
- case "l": return "l";
1703
- case "center":
1704
- case "ctr": return "ctr";
1705
- case "right":
1706
- case "r": return "r";
1707
- case "justify":
1708
- case "just": return "just";
1709
- case "distribute":
1710
- case "dist": return "dist";
1711
- default: return a;
1712
- }
1713
- };
1714
- const ATTR_ALGN$1 = qname("", "algn", "");
1715
- /**
1716
- * Sets `<a:pPr algn="...">` on every paragraph in `txBody`. Existing
1717
- * pPr attributes other than `algn` are preserved.
1718
- */
1719
- const applyAlignmentToAllParagraphs = (txBody, align) => {
1720
- const token = alignToken(align);
1721
- for (const p of txBody.children) {
1722
- if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
1723
- let pPr = firstChildElement(p, NAME_PPR_FOR_BULLET);
1724
- if (pPr === null) {
1725
- pPr = elem(NAME_PPR_FOR_BULLET);
1726
- p.children.unshift(pPr);
1727
- }
1728
- pPr.attrs = pPr.attrs.filter((a) => a.name.localName !== "algn");
1729
- pPr.attrs.push(attr(ATTR_ALGN$1, token));
1730
- }
1731
- };
1732
- /**
1733
- * Sets the bullet style on a single `<a:p>` paragraph. Drops any
1734
- * existing bullet child element (`a:buChar`, `a:buAutoNum`, `a:buNone`)
1735
- * before inserting the new one. Creates `<a:pPr>` if absent.
1736
- */
1737
- const BULLET_INDENT_BY_LEVEL = [
1738
- {
1739
- marL: 342900,
1740
- indent: -342900
1741
- },
1742
- {
1743
- marL: 742950,
1744
- indent: -285750
1745
- },
1746
- {
1747
- marL: 1143e3,
1748
- indent: -228600
1749
- },
1750
- {
1751
- marL: 1600200,
1752
- indent: -228600
1753
- },
1754
- {
1755
- marL: 2057400,
1756
- indent: -228600
1757
- }
1758
- ];
1759
- const bulletIndentForLevel = (lvl) => BULLET_INDENT_BY_LEVEL[Math.min(lvl, BULLET_INDENT_BY_LEVEL.length - 1)];
1760
- const ATTR_MAR_L$1 = qname("", "marL", "");
1761
- const ATTR_INDENT$1 = qname("", "indent", "");
1762
- const hasAttr = (el, local) => el.attrs.some((a) => a.name.namespaceURI === "" && a.name.localName === local);
1763
- const applyBulletToParagraph = (paragraph, style) => {
1764
- let pPr = firstChildElement(paragraph, NAME_PPR_FOR_BULLET);
1765
- if (pPr === null) {
1766
- pPr = elem(NAME_PPR_FOR_BULLET);
1767
- paragraph.children.unshift(pPr);
1768
- }
1769
- pPr.children = pPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && (c.name.localName === "buChar" || c.name.localName === "buAutoNum" || c.name.localName === "buNone" || c.name.localName === "buFont")));
1770
- if (style !== "none") {
1771
- const lvl = Number.parseInt(pPr.attrs.find((a) => a.name.localName === "lvl")?.value ?? "0", 10);
1772
- const { marL, indent } = bulletIndentForLevel(Number.isFinite(lvl) ? lvl : 0);
1773
- if (!hasAttr(pPr, "marL")) pPr.attrs.push(attr(ATTR_MAR_L$1, String(marL)));
1774
- if (!hasAttr(pPr, "indent")) pPr.attrs.push(attr(ATTR_INDENT$1, String(indent)));
1775
- }
1776
- if (normalizeBulletStyle(style).kind === "autoNum") pPr.children.push(elem(NAME_BU_FONT, { attrs: [attr(ATTR_TYPEFACE$3, "+mj-lt")] }));
1777
- pPr.children.push(buildBulletElement(style));
1778
- };
1779
- /**
1780
- * Sets the bullet style on every paragraph in `txBody`. Drops any
1781
- * existing bullet child element (`a:buChar`, `a:buAutoNum`, `a:buNone`)
1782
- * before inserting the new one. Creates `<a:pPr>` if absent.
1783
- */
1784
- const applyBulletToAllParagraphs = (txBody, style) => {
1785
- for (const p of txBody.children) {
1786
- if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
1787
- applyBulletToParagraph(p, style);
1788
- }
1789
- };
1790
- /**
1791
- * Replaces the entire visible text of a `txBody` element with `value`.
1792
- * Newlines in `value` start a new paragraph.
1793
- *
1794
- * The first existing `a:rPr` (run properties) and `a:pPr` (paragraph
1795
- * properties) are cloned into every new paragraph so that font, color, size,
1796
- * alignment, and bullet style survive the replacement. If the source had
1797
- * mixed formatting per run, that gets collapsed into the first-run formatting
1798
- * across the entire new text — matching what PowerPoint does when you select
1799
- * all and type.
1800
- *
1801
- * The `bodyPr` and `lstStyle` children (if any) are preserved untouched.
1802
- */
1803
- const setTextBody = (txBody, value) => {
1804
- const rPrTemplate = findFirstRunProperties(txBody);
1805
- const pPrTemplate = findFirstParagraphProperties(txBody);
1806
- removeAllParagraphs(txBody);
1807
- const lines = value.split("\n");
1808
- for (const line of lines) {
1809
- const t = elem(NAME_T$5, { children: line.length > 0 ? [text(line)] : [] });
1810
- const r = elem(NAME_R$4, { children: rPrTemplate !== null ? [cloneElement(rPrTemplate), t] : [t] });
1811
- const p = elem(NAME_P$5, { children: pPrTemplate !== null ? [cloneElement(pPrTemplate), r] : [r] });
1812
- txBody.children.push(p);
1813
- }
1814
- };
1815
- //#endregion
1816
1537
  //#region src/internal/bounds.ts
1817
1538
  const RANGES = {
1818
1539
  coordinate: [-27273042329600, 27273042316900],
@@ -1954,7 +1675,7 @@ const buildColorElement = (value) => {
1954
1675
  //#endregion
1955
1676
  //#region src/internal/drawingml/text-format.ts
1956
1677
  NS.dml;
1957
- const NAME_RPR$5 = qname("a", "rPr", NS.dml);
1678
+ const NAME_RPR$6 = qname("a", "rPr", NS.dml);
1958
1679
  const NAME_LATIN = qname("a", "latin", NS.dml);
1959
1680
  const NAME_EA = qname("a", "ea", NS.dml);
1960
1681
  NS.dml;
@@ -1970,7 +1691,7 @@ const ATTR_SPC = qname("", "spc", "");
1970
1691
  const ATTR_KERN = qname("", "kern", "");
1971
1692
  const ATTR_BASELINE = qname("", "baseline", "");
1972
1693
  const ATTR_CAP = qname("", "cap", "");
1973
- const ATTR_TYPEFACE$2 = qname("", "typeface", "");
1694
+ const ATTR_TYPEFACE$3 = qname("", "typeface", "");
1974
1695
  const ATTR_VAL$8 = qname("", "val", "");
1975
1696
  const NAME_HIGHLIGHT = qname("a", "highlight", NS.dml);
1976
1697
  const RPR_CHILD_RANK = {
@@ -2013,12 +1734,12 @@ const setSolidFill$1 = (rPr, value) => {
2013
1734
  const setLatin = (rPr, font) => {
2014
1735
  rPr.children = rPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "latin"));
2015
1736
  if (font === null) return;
2016
- insertChildByRank(rPr, elem(NAME_LATIN, { attrs: [attr(ATTR_TYPEFACE$2, font)] }), rprChildRank);
1737
+ insertChildByRank(rPr, elem(NAME_LATIN, { attrs: [attr(ATTR_TYPEFACE$3, font)] }), rprChildRank);
2017
1738
  };
2018
1739
  const setEastAsian = (rPr, font) => {
2019
1740
  rPr.children = rPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "ea"));
2020
1741
  if (font === null) return;
2021
- insertChildByRank(rPr, elem(NAME_EA, { attrs: [attr(ATTR_TYPEFACE$2, font)] }), rprChildRank);
1742
+ insertChildByRank(rPr, elem(NAME_EA, { attrs: [attr(ATTR_TYPEFACE$3, font)] }), rprChildRank);
2022
1743
  };
2023
1744
  const setHighlight = (rPr, value) => {
2024
1745
  rPr.children = rPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "highlight"));
@@ -2027,57 +1748,376 @@ const setHighlight = (rPr, value) => {
2027
1748
  if (parsed === null) throw new Error(`unrecognized highlight color: ${value}`);
2028
1749
  insertChildByRank(rPr, elem(NAME_HIGHLIGHT, { children: [parsed.kind === "srgb" ? elem(NAME_SRGB_CLR$3, { attrs: [attr(ATTR_VAL$8, parsed.hex)] }) : elem(NAME_SCHEME_CLR$1, { attrs: [attr(ATTR_VAL$8, parsed.token)] })] }), rprChildRank);
2029
1750
  };
2030
- /** Mutates `rPr` in place per `format`. */
2031
- const applyRunFormat = (rPr, format) => {
2032
- let attrs = rPr.attrs;
2033
- if (format.size !== void 0) {
2034
- const sz = fontSizeHundredthPt(format.size * 100, "setShapeRunFormat: size");
2035
- attrs = setOrRemoveAttr(attrs, ATTR_SZ, String(sz));
1751
+ /** Mutates `rPr` in place per `format`. */
1752
+ const applyRunFormat = (rPr, format) => {
1753
+ let attrs = rPr.attrs;
1754
+ if (format.size !== void 0) {
1755
+ const sz = fontSizeHundredthPt(format.size * 100, "setShapeRunFormat: size");
1756
+ attrs = setOrRemoveAttr(attrs, ATTR_SZ, String(sz));
1757
+ }
1758
+ if (format.bold !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_B, format.bold ? "1" : "0");
1759
+ if (format.italic !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_I, format.italic ? "1" : "0");
1760
+ if (format.underline !== void 0) {
1761
+ const value = format.underline === false ? "none" : format.underline === true ? "sng" : format.underline;
1762
+ attrs = setOrRemoveAttr(attrs, ATTR_U, value);
1763
+ }
1764
+ if (format.strike !== void 0) {
1765
+ const value = format.strike === false ? "noStrike" : format.strike === true ? "sngStrike" : format.strike;
1766
+ attrs = setOrRemoveAttr(attrs, ATTR_STRIKE, value);
1767
+ }
1768
+ if (format.spc !== void 0) {
1769
+ const spc = textPointSpacing(format.spc, "setShapeRunFormat: spc");
1770
+ attrs = setOrRemoveAttr(attrs, ATTR_SPC, String(spc));
1771
+ }
1772
+ if (format.kern !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_KERN, String(Math.round(format.kern)));
1773
+ if (format.baseline !== void 0) {
1774
+ const pct = Math.round(format.baseline * 1e5);
1775
+ attrs = setOrRemoveAttr(attrs, ATTR_BASELINE, String(pct));
1776
+ }
1777
+ if (format.cap !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_CAP, format.cap);
1778
+ rPr.attrs = attrs;
1779
+ if (format.font !== void 0) setLatin(rPr, format.font);
1780
+ if (format.fontEastAsian !== void 0) setEastAsian(rPr, format.fontEastAsian);
1781
+ if (format.color !== void 0) setSolidFill$1(rPr, format.color);
1782
+ if (format.highlight !== void 0) setHighlight(rPr, format.highlight);
1783
+ };
1784
+ /**
1785
+ * Walks `txBody`, ensuring every `<a:r>` has an `<a:rPr>` carrying the
1786
+ * supplied format. Existing run-property attributes not addressed by
1787
+ * `format` are preserved.
1788
+ */
1789
+ const applyFormatToAllRuns = (txBody, format) => {
1790
+ for (const p of txBody.children) {
1791
+ if (p.kind !== "element" || p.name.namespaceURI !== NS.dml || p.name.localName !== "p") continue;
1792
+ for (const r of p.children) {
1793
+ if (r.kind !== "element" || r.name.namespaceURI !== NS.dml || r.name.localName !== "r") continue;
1794
+ let rPr = firstChildElement(r, NAME_RPR$6);
1795
+ if (rPr === null) {
1796
+ rPr = elem(NAME_RPR$6);
1797
+ r.children.unshift(rPr);
1798
+ }
1799
+ applyRunFormat(rPr, format);
1800
+ }
1801
+ }
1802
+ };
1803
+ //#endregion
1804
+ //#region src/internal/drawingml/text-body-mutation.ts
1805
+ const NAME_BU_CHAR = qname("a", "buChar", NS.dml);
1806
+ const NAME_BU_AUTO_NUM = qname("a", "buAutoNum", NS.dml);
1807
+ const NAME_BU_NONE$1 = qname("a", "buNone", NS.dml);
1808
+ const NAME_BU_FONT = qname("a", "buFont", NS.dml);
1809
+ const ATTR_CHAR = qname("", "char", "");
1810
+ const ATTR_BU_TYPE = qname("", "type", "");
1811
+ const ATTR_START_AT = qname("", "startAt", "");
1812
+ const ATTR_TYPEFACE$2 = qname("", "typeface", "");
1813
+ const NAME_P$5 = qname("a", "p", NS.dml);
1814
+ const NAME_R$4 = qname("a", "r", NS.dml);
1815
+ const NAME_T$5 = qname("a", "t", NS.dml);
1816
+ const NAME_RPR$5 = qname("a", "rPr", NS.dml);
1817
+ const NAME_PPR$1 = qname("a", "pPr", NS.dml);
1818
+ const NAME_END_PARA_RPR = qname("a", "endParaRPr", NS.dml);
1819
+ NS.xml;
1820
+ const cloneAttrs = (attrs) => attrs.map((a) => attr(a.name, a.value));
1821
+ const cloneElement = (e) => elem(e.name, {
1822
+ attrs: cloneAttrs(e.attrs),
1823
+ prefixDecls: new Map(e.prefixDecls),
1824
+ children: e.children.map(cloneNode)
1825
+ });
1826
+ const cloneNode = (n) => {
1827
+ switch (n.kind) {
1828
+ case "element": return cloneElement(n);
1829
+ case "text": return {
1830
+ kind: "text",
1831
+ data: n.data
1832
+ };
1833
+ case "cdata": return {
1834
+ kind: "cdata",
1835
+ data: n.data
1836
+ };
1837
+ case "comment": return {
1838
+ kind: "comment",
1839
+ data: n.data
1840
+ };
1841
+ case "pi": return {
1842
+ kind: "pi",
1843
+ target: n.target,
1844
+ data: n.data
1845
+ };
1846
+ }
1847
+ };
1848
+ /**
1849
+ * Returns the first `a:rPr` reachable on the first run of the first paragraph
1850
+ * inside `txBody`. Used to preserve formatting on text replacement: we clone
1851
+ * the original rPr into the new run so font, color, size, etc. survive.
1852
+ */
1853
+ const findFirstRunProperties = (txBody) => {
1854
+ const firstP = firstChildElement(txBody, NAME_P$5);
1855
+ if (firstP === null) return null;
1856
+ const firstR = firstChildElement(firstP, NAME_R$4);
1857
+ if (firstR === null) return null;
1858
+ return firstChildElement(firstR, NAME_RPR$5);
1859
+ };
1860
+ /**
1861
+ * Returns the first `a:pPr` from the first paragraph. Used to preserve
1862
+ * paragraph-level formatting (alignment, bullet, indent) when replacing.
1863
+ */
1864
+ const findFirstParagraphProperties = (txBody) => {
1865
+ const firstP = firstChildElement(txBody, NAME_P$5);
1866
+ if (firstP === null) return null;
1867
+ return firstChildElement(firstP, NAME_PPR$1);
1868
+ };
1869
+ const removeAllParagraphs = (txBody) => {
1870
+ txBody.children = txBody.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "p"));
1871
+ };
1872
+ const TOKEN_PATTERN = /\{\{([^{}]+)\}\}/g;
1873
+ /**
1874
+ * Replaces `{{key}}` tokens in every `a:t` element under `root` with values
1875
+ * from `tokens`. Tokens whose key is not in `tokens` are left untouched.
1876
+ *
1877
+ * Returns the number of substitutions performed. Useful for callers that
1878
+ * want to know whether anything matched.
1879
+ *
1880
+ * Limitation: a token must fit entirely within one `<a:t>` element to
1881
+ * match. PowerPoint normally serializes contiguous user text as a single
1882
+ * `<a:t>`, so the limitation only bites when a placeholder was edited
1883
+ * character-by-character (causing PowerPoint to split runs). For those
1884
+ * cases, fall back to `setText()`.
1885
+ */
1886
+ const replaceTokensInTree = (root, tokens) => {
1887
+ let count = 0;
1888
+ walkElements(root, (el) => {
1889
+ if (el.name.namespaceURI !== NAME_T$5.namespaceURI) return;
1890
+ if (el.name.localName !== "t") return;
1891
+ const child = el.children[0];
1892
+ if (!child || child.kind !== "text") return;
1893
+ const before = child.data;
1894
+ let didMatch = false;
1895
+ const after = before.replace(TOKEN_PATTERN, (match, key) => {
1896
+ if (Object.hasOwn(tokens, key)) {
1897
+ didMatch = true;
1898
+ return tokens[key] ?? "";
1899
+ }
1900
+ return match;
1901
+ });
1902
+ if (didMatch) {
1903
+ child.data = after;
1904
+ count++;
1905
+ }
1906
+ });
1907
+ return count;
1908
+ };
1909
+ /**
1910
+ * Replaces every occurrence of `from` in every `<a:t>` element under
1911
+ * `root` with `to`. `from` may be a string (literal) or a `RegExp`
1912
+ * (matched per-run). Returns the count of `<a:t>` elements that were
1913
+ * mutated — not the count of substitutions inside them, since callers
1914
+ * usually want "did anything change" rather than "how many letters
1915
+ * moved."
1916
+ *
1917
+ * Same single-run constraint as `replaceTokensInTree`: matches must
1918
+ * fit inside one `<a:t>`. Use this for the broader "find/replace
1919
+ * across the deck" use case where {{token}} syntax isn't a fit.
1920
+ */
1921
+ const replaceTextInTree = (root, from, to) => {
1922
+ const pattern = typeof from === "string" ? new RegExp(from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g") : from.global ? from : new RegExp(from.source, `${from.flags}g`);
1923
+ let count = 0;
1924
+ walkElements(root, (el) => {
1925
+ if (el.name.namespaceURI !== NAME_T$5.namespaceURI) return;
1926
+ if (el.name.localName !== "t") return;
1927
+ const child = el.children[0];
1928
+ if (!child || child.kind !== "text") return;
1929
+ const before = child.data;
1930
+ const after = before.replace(pattern, to);
1931
+ if (after !== before) {
1932
+ child.data = after;
1933
+ count++;
1934
+ }
1935
+ });
1936
+ return count;
1937
+ };
1938
+ const normalizeBulletStyle = (s) => {
1939
+ if (s === "bullet") return {
1940
+ kind: "char",
1941
+ char: "•"
1942
+ };
1943
+ if (s === "number") return {
1944
+ kind: "autoNum",
1945
+ type: "arabicPeriod"
1946
+ };
1947
+ if (s === "none") return { kind: "none" };
1948
+ if ("char" in s) return {
1949
+ kind: "char",
1950
+ char: s.char
1951
+ };
1952
+ return {
1953
+ kind: "autoNum",
1954
+ type: s.autoNum
1955
+ };
1956
+ };
1957
+ const buildBulletElement = (style) => {
1958
+ const n = normalizeBulletStyle(style);
1959
+ switch (n.kind) {
1960
+ case "char": return elem(NAME_BU_CHAR, { attrs: [attr(ATTR_CHAR, n.char)] });
1961
+ case "autoNum": return elem(NAME_BU_AUTO_NUM, { attrs: [attr(ATTR_START_AT, "1"), attr(ATTR_BU_TYPE, n.type)] });
1962
+ case "none": return elem(NAME_BU_NONE$1);
1963
+ }
1964
+ };
1965
+ const NAME_PPR_FOR_BULLET = qname("a", "pPr", NS.dml);
1966
+ const NAME_P_FOR_BULLET = qname("a", "p", NS.dml);
1967
+ const alignToken = (a) => {
1968
+ switch (a) {
1969
+ case "left":
1970
+ case "l": return "l";
1971
+ case "center":
1972
+ case "ctr": return "ctr";
1973
+ case "right":
1974
+ case "r": return "r";
1975
+ case "justify":
1976
+ case "just": return "just";
1977
+ case "distribute":
1978
+ case "dist": return "dist";
1979
+ default: return a;
2036
1980
  }
2037
- if (format.bold !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_B, format.bold ? "1" : "0");
2038
- if (format.italic !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_I, format.italic ? "1" : "0");
2039
- if (format.underline !== void 0) {
2040
- const value = format.underline === false ? "none" : format.underline === true ? "sng" : format.underline;
2041
- attrs = setOrRemoveAttr(attrs, ATTR_U, value);
1981
+ };
1982
+ const ATTR_ALGN$1 = qname("", "algn", "");
1983
+ /**
1984
+ * Sets `<a:pPr algn="...">` on every paragraph in `txBody`. Existing
1985
+ * pPr attributes other than `algn` are preserved.
1986
+ */
1987
+ const applyAlignmentToAllParagraphs = (txBody, align) => {
1988
+ const token = alignToken(align);
1989
+ for (const p of txBody.children) {
1990
+ if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
1991
+ let pPr = firstChildElement(p, NAME_PPR_FOR_BULLET);
1992
+ if (pPr === null) {
1993
+ pPr = elem(NAME_PPR_FOR_BULLET);
1994
+ p.children.unshift(pPr);
1995
+ }
1996
+ pPr.attrs = pPr.attrs.filter((a) => a.name.localName !== "algn");
1997
+ pPr.attrs.push(attr(ATTR_ALGN$1, token));
2042
1998
  }
2043
- if (format.strike !== void 0) {
2044
- const value = format.strike === false ? "noStrike" : format.strike === true ? "sngStrike" : format.strike;
2045
- attrs = setOrRemoveAttr(attrs, ATTR_STRIKE, value);
1999
+ };
2000
+ /**
2001
+ * Sets the bullet style on a single `<a:p>` paragraph. Drops any
2002
+ * existing bullet child element (`a:buChar`, `a:buAutoNum`, `a:buNone`)
2003
+ * before inserting the new one. Creates `<a:pPr>` if absent.
2004
+ */
2005
+ const BULLET_INDENT_BY_LEVEL = [
2006
+ {
2007
+ marL: 342900,
2008
+ indent: -342900
2009
+ },
2010
+ {
2011
+ marL: 742950,
2012
+ indent: -285750
2013
+ },
2014
+ {
2015
+ marL: 1143e3,
2016
+ indent: -228600
2017
+ },
2018
+ {
2019
+ marL: 1600200,
2020
+ indent: -228600
2021
+ },
2022
+ {
2023
+ marL: 2057400,
2024
+ indent: -228600
2046
2025
  }
2047
- if (format.spc !== void 0) {
2048
- const spc = textPointSpacing(format.spc, "setShapeRunFormat: spc");
2049
- attrs = setOrRemoveAttr(attrs, ATTR_SPC, String(spc));
2026
+ ];
2027
+ const bulletIndentForLevel = (lvl) => BULLET_INDENT_BY_LEVEL[Math.min(lvl, BULLET_INDENT_BY_LEVEL.length - 1)];
2028
+ const ATTR_MAR_L$1 = qname("", "marL", "");
2029
+ const ATTR_INDENT$1 = qname("", "indent", "");
2030
+ const hasAttr = (el, local) => el.attrs.some((a) => a.name.namespaceURI === "" && a.name.localName === local);
2031
+ const applyBulletToParagraph = (paragraph, style) => {
2032
+ let pPr = firstChildElement(paragraph, NAME_PPR_FOR_BULLET);
2033
+ if (pPr === null) {
2034
+ pPr = elem(NAME_PPR_FOR_BULLET);
2035
+ paragraph.children.unshift(pPr);
2050
2036
  }
2051
- if (format.kern !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_KERN, String(Math.round(format.kern)));
2052
- if (format.baseline !== void 0) {
2053
- const pct = Math.round(format.baseline * 1e5);
2054
- attrs = setOrRemoveAttr(attrs, ATTR_BASELINE, String(pct));
2037
+ pPr.children = pPr.children.filter((c) => !(c.kind === "element" && c.name.namespaceURI === NS.dml && (c.name.localName === "buChar" || c.name.localName === "buAutoNum" || c.name.localName === "buNone" || c.name.localName === "buFont")));
2038
+ if (style !== "none") {
2039
+ const lvl = Number.parseInt(pPr.attrs.find((a) => a.name.localName === "lvl")?.value ?? "0", 10);
2040
+ const { marL, indent } = bulletIndentForLevel(Number.isFinite(lvl) ? lvl : 0);
2041
+ if (!hasAttr(pPr, "marL")) pPr.attrs.push(attr(ATTR_MAR_L$1, String(marL)));
2042
+ if (!hasAttr(pPr, "indent")) pPr.attrs.push(attr(ATTR_INDENT$1, String(indent)));
2055
2043
  }
2056
- if (format.cap !== void 0) attrs = setOrRemoveAttr(attrs, ATTR_CAP, format.cap);
2057
- rPr.attrs = attrs;
2058
- if (format.font !== void 0) setLatin(rPr, format.font);
2059
- if (format.fontEastAsian !== void 0) setEastAsian(rPr, format.fontEastAsian);
2060
- if (format.color !== void 0) setSolidFill$1(rPr, format.color);
2061
- if (format.highlight !== void 0) setHighlight(rPr, format.highlight);
2044
+ if (normalizeBulletStyle(style).kind === "autoNum") pPr.children.push(elem(NAME_BU_FONT, { attrs: [attr(ATTR_TYPEFACE$2, "+mj-lt")] }));
2045
+ pPr.children.push(buildBulletElement(style));
2062
2046
  };
2063
2047
  /**
2064
- * Walks `txBody`, ensuring every `<a:r>` has an `<a:rPr>` carrying the
2065
- * supplied format. Existing run-property attributes not addressed by
2066
- * `format` are preserved.
2048
+ * Sets the bullet style on every paragraph in `txBody`. Drops any
2049
+ * existing bullet child element (`a:buChar`, `a:buAutoNum`, `a:buNone`)
2050
+ * before inserting the new one. Creates `<a:pPr>` if absent.
2067
2051
  */
2068
- const applyFormatToAllRuns = (txBody, format) => {
2052
+ const applyBulletToAllParagraphs = (txBody, style) => {
2069
2053
  for (const p of txBody.children) {
2070
- if (p.kind !== "element" || p.name.namespaceURI !== NS.dml || p.name.localName !== "p") continue;
2071
- for (const r of p.children) {
2072
- if (r.kind !== "element" || r.name.namespaceURI !== NS.dml || r.name.localName !== "r") continue;
2073
- let rPr = firstChildElement(r, NAME_RPR$5);
2074
- if (rPr === null) {
2075
- rPr = elem(NAME_RPR$5);
2076
- r.children.unshift(rPr);
2077
- }
2078
- applyRunFormat(rPr, format);
2054
+ if (p.kind !== "element" || p.name.namespaceURI !== NAME_P_FOR_BULLET.namespaceURI || p.name.localName !== "p") continue;
2055
+ applyBulletToParagraph(p, style);
2056
+ }
2057
+ };
2058
+ /**
2059
+ * Replaces the entire visible text of a `txBody` element with `value`.
2060
+ * Newlines in `value` start a new paragraph.
2061
+ *
2062
+ * The first existing `a:rPr` (run properties) and `a:pPr` (paragraph
2063
+ * properties) are cloned into every new paragraph so that font, color, size,
2064
+ * alignment, and bullet style survive the replacement. If the source had
2065
+ * mixed formatting per run, that gets collapsed into the first-run formatting
2066
+ * across the entire new text — matching what PowerPoint does when you select
2067
+ * all and type.
2068
+ *
2069
+ * The `bodyPr` and `lstStyle` children (if any) are preserved untouched.
2070
+ */
2071
+ const setTextBody = (txBody, value) => {
2072
+ const rPrTemplate = findFirstRunProperties(txBody);
2073
+ const pPrTemplate = findFirstParagraphProperties(txBody);
2074
+ removeAllParagraphs(txBody);
2075
+ const lines = value.split("\n");
2076
+ for (const line of lines) {
2077
+ const t = elem(NAME_T$5, { children: line.length > 0 ? [text(line)] : [] });
2078
+ const r = elem(NAME_R$4, { children: rPrTemplate !== null ? [cloneElement(rPrTemplate), t] : [t] });
2079
+ const p = elem(NAME_P$5, { children: pPrTemplate !== null ? [cloneElement(pPrTemplate), r] : [r] });
2080
+ txBody.children.push(p);
2081
+ }
2082
+ };
2083
+ /**
2084
+ * Builds the `<a:p>` elements for `paragraphs`. Every format is validated
2085
+ * here, so a caller that builds before it touches the tree leaves the
2086
+ * existing text intact when a value is rejected.
2087
+ */
2088
+ const buildTextBodyParagraphs = (paragraphs) => {
2089
+ if (paragraphs.length === 0) throw new Error("setTextBodyParagraphs: at least one paragraph is required");
2090
+ const built = [];
2091
+ for (const para of paragraphs) {
2092
+ const children = [];
2093
+ if (para.align !== void 0) children.push(elem(NAME_PPR$1, { attrs: [attr(ATTR_ALGN$1, alignToken(para.align))] }));
2094
+ for (const run of para.runs) {
2095
+ const rPr = elem(NAME_RPR$5);
2096
+ if (run.format !== void 0) applyRunFormat(rPr, run.format);
2097
+ const t = elem(NAME_T$5, { children: run.text.length > 0 ? [text(run.text)] : [] });
2098
+ children.push(elem(NAME_R$4, { children: [rPr, t] }));
2099
+ }
2100
+ if (para.endFormat !== void 0) {
2101
+ const endParaRPr = elem(NAME_END_PARA_RPR);
2102
+ applyRunFormat(endParaRPr, para.endFormat);
2103
+ children.push(endParaRPr);
2079
2104
  }
2105
+ built.push(elem(NAME_P$5, { children }));
2080
2106
  }
2107
+ return built;
2108
+ };
2109
+ const replaceTextBodyParagraphs = (txBody, built) => {
2110
+ removeAllParagraphs(txBody);
2111
+ txBody.children.push(...built);
2112
+ };
2113
+ /**
2114
+ * Replaces every paragraph of `txBody` with explicitly structured ones.
2115
+ * Unlike `setTextBody`, nothing is inherited from the existing runs: each
2116
+ * run gets a fresh `<a:rPr>` carrying only its own `format`. A rejected
2117
+ * format throws before `txBody` changes.
2118
+ */
2119
+ const setTextBodyParagraphs = (txBody, paragraphs) => {
2120
+ replaceTextBodyParagraphs(txBody, buildTextBodyParagraphs(paragraphs));
2081
2121
  };
2082
2122
  //#endregion
2083
2123
  //#region src/internal/drawingml/fill.ts
@@ -5143,11 +5183,17 @@ const solidFillSpPr = (color) => {
5143
5183
  const solidFill = elem(a("solidFill"), { children: [srgbClr] });
5144
5184
  return elem(c("spPr"), { children: [solidFill] });
5145
5185
  };
5146
- const gridlinesElement = (local, color) => {
5147
- if (color === void 0) return elem(c(local));
5148
- const hex = color.replace(/^#/, "").toUpperCase();
5149
- const ln = elem(a("ln"), { children: [elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), hex)] })] })] });
5150
- return elem(c(local), { children: [elem(c("spPr"), { children: [ln] })] });
5186
+ const lineSpPr = (color, widthEmu, field) => {
5187
+ if (color === void 0 && widthEmu === void 0) return null;
5188
+ const ln = elem(a("ln"), {
5189
+ attrs: widthEmu !== void 0 ? [attr(qname("", "w", ""), String(lineWidthEmu(widthEmu, field)))] : [],
5190
+ children: color !== void 0 ? [elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), color.replace(/^#/, "").toUpperCase())] })] })] : []
5191
+ });
5192
+ return elem(c("spPr"), { children: [ln] });
5193
+ };
5194
+ const gridlinesElement = (local, color, widthEmu, field) => {
5195
+ const spPr = lineSpPr(color, widthEmu, field);
5196
+ return spPr === null ? elem(c(local)) : elem(c(local), { children: [spPr] });
5151
5197
  };
5152
5198
  const spPrChildren = (fill, stroke) => {
5153
5199
  const out = [];
@@ -5163,8 +5209,8 @@ const DEFAULT_ACCENT_COLORS = [
5163
5209
  "5B9BD5",
5164
5210
  "70AD47"
5165
5211
  ];
5166
- const seriesSpPr = (color, lineWidthEmu$1, lineDash) => {
5167
- const lnChildren = [elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), color)] })] })];
5212
+ const seriesSpPr = (color, lineColor, lineWidthEmu$1, lineDash) => {
5213
+ const lnChildren = [elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), lineColor)] })] })];
5168
5214
  if (lineDash !== void 0) lnChildren.push(elem(a("prstDash"), { attrs: [attr(qname("", "val", ""), lineDash)] }));
5169
5215
  const ln = lineWidthEmu$1 !== void 0 ? elem(a("ln"), {
5170
5216
  attrs: [attr(qname("", "w", ""), String(lineWidthEmu(lineWidthEmu$1, "chart series: lineWidthEmu")))],
@@ -5172,11 +5218,14 @@ const seriesSpPr = (color, lineWidthEmu$1, lineDash) => {
5172
5218
  }) : elem(a("ln"), { children: lnChildren });
5173
5219
  return elem(c("spPr"), { children: [elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), color)] })] }), ln] });
5174
5220
  };
5175
- const markerElement = (symbol, sizePt) => {
5176
- if (symbol === void 0 && sizePt === void 0) return null;
5221
+ const markerElement = (symbol, sizePt, color, lineColor) => {
5177
5222
  const children = [];
5178
5223
  if (symbol !== void 0) children.push(valNode(c("symbol"), symbol));
5179
5224
  if (sizePt !== void 0) children.push(valNode(c("size"), Math.round(sizePt)));
5225
+ if (symbol !== "none") {
5226
+ const fill = (hex) => elem(a("solidFill"), { children: [elem(a("srgbClr"), { attrs: [attr(qname("", "val", ""), hex)] })] });
5227
+ children.push(elem(c("spPr"), { children: [fill(color), elem(a("ln"), { children: [fill(lineColor)] })] }));
5228
+ }
5180
5229
  return elem(c("marker"), { children });
5181
5230
  };
5182
5231
  const dPtElements = (colors, explosions) => {
@@ -5224,25 +5273,30 @@ const seriesElement = (spec, seriesIdx, sheet) => {
5224
5273
  const color = series.color !== void 0 ? series.color.replace(/^#/, "").toUpperCase() : DEFAULT_ACCENT_COLORS[seriesIdx % DEFAULT_ACCENT_COLORS.length] ?? "4472C4";
5225
5274
  const paddedValues = [];
5226
5275
  for (let i = 0; i < spec.categories.length; i++) paddedValues.push(i < series.values.length ? series.values[i] ?? null : null);
5276
+ const kind = series.chartKind ?? spec.kind;
5227
5277
  const children = [
5228
5278
  valNode(c("idx"), seriesIdx),
5229
5279
  valNode(c("order"), seriesIdx),
5230
5280
  elem(c("tx"), { children: [strRef(headerCellFormula, [series.name])] })
5231
5281
  ];
5232
- if (spec.kind === "line" || series.lineWidthEmu !== void 0 || series.lineDash !== void 0) children.push(seriesSpPr(color, series.lineWidthEmu, series.lineDash));
5233
- else children.push(solidFillSpPr(color));
5234
- if (series.invertIfNegative === true && (spec.kind === "bar" || spec.kind === "column")) children.push(valNode(c("invertIfNegative"), "1"));
5235
- if (spec.kind === "line" || spec.kind === "scatter" || spec.kind === "radar") {
5236
- const mk = markerElement(series.markerSymbol, series.markerSizePt);
5237
- if (mk !== null) children.push(mk);
5282
+ if (kind === "line" || series.lineWidthEmu !== void 0 || series.lineColor !== void 0 || series.lineDash !== void 0) {
5283
+ const lineColor = series.lineColor !== void 0 ? series.lineColor.replace(/^#/, "").toUpperCase() : color;
5284
+ children.push(seriesSpPr(color, lineColor, series.lineWidthEmu, series.lineDash));
5285
+ } else children.push(solidFillSpPr(color));
5286
+ if (series.invertIfNegative === true && (kind === "bar" || kind === "column")) children.push(valNode(c("invertIfNegative"), "1"));
5287
+ if (kind === "line" || kind === "scatter" || kind === "radar") {
5288
+ const markerColor = series.markerColor !== void 0 ? series.markerColor.replace(/^#/, "").toUpperCase() : color;
5289
+ const markerLineColor = series.markerLineColor !== void 0 ? series.markerLineColor.replace(/^#/, "").toUpperCase() : markerColor;
5290
+ children.push(markerElement(series.markerSymbol, series.markerSizePt, markerColor, markerLineColor));
5238
5291
  }
5239
5292
  for (const dPt of dPtElements(series.pointColors, series.pointExplosions)) children.push(dPt);
5240
- const serDLbls = buildDLblsFromLabels(series.dataLabels);
5293
+ if (series.pointDataLabels !== void 0 && series.dataLabels === void 0) throw new Error(`chart: series '${series.name}' sets pointDataLabels without dataLabels; add the series-level dataLabels the overrides fall back to`);
5294
+ const serDLbls = buildDLblsFromLabels(series.dataLabels, series.pointDataLabels);
5241
5295
  if (serDLbls !== null) children.push(serDLbls);
5242
- if (series.trendline && spec.kind !== "pie" && spec.kind !== "doughnut" && spec.kind !== "radar") children.push(trendlineElement(series.trendline));
5296
+ if (series.trendline && kind !== "pie" && kind !== "doughnut" && kind !== "radar") children.push(trendlineElement(series.trendline));
5243
5297
  children.push(elem(c("cat"), { children: [strRef(catRange, spec.categories)] }));
5244
5298
  children.push(elem(c("val"), { children: [numRef(valRange, paddedValues)] }));
5245
- if (spec.kind === "line") children.push(valNode(c("smooth"), series.smooth === true ? "1" : "0"));
5299
+ if (kind === "line") children.push(valNode(c("smooth"), series.smooth === true ? "1" : "0"));
5246
5300
  return elem(c("ser"), { children });
5247
5301
  };
5248
5302
  const CAT_AX_ID = 111111111;
@@ -5312,16 +5366,17 @@ const catAxis = (spec) => {
5312
5366
  valNode(c("axId"), CAT_AX_ID),
5313
5367
  elem(c("scaling"), { children: [valNode(c("orientation"), catOrientation)] }),
5314
5368
  valNode(c("delete"), spec.categoryAxisHidden ? "1" : "0"),
5315
- valNode(c("axPos"), "b")
5369
+ valNode(c("axPos"), isHorizontalBar(spec) ? "l" : "b")
5316
5370
  ];
5317
- if (spec.categoryAxisMajorGridlines) children.push(gridlinesElement("majorGridlines", spec.categoryAxisMajorGridlineColor));
5318
- if (spec.categoryAxisMinorGridlines) children.push(gridlinesElement("minorGridlines", spec.categoryAxisMinorGridlineColor));
5371
+ if (spec.categoryAxisMajorGridlines) children.push(gridlinesElement("majorGridlines", spec.categoryAxisMajorGridlineColor, spec.categoryAxisMajorGridlineWidthEmu, "chart: categoryAxisMajorGridlineWidthEmu"));
5372
+ if (spec.categoryAxisMinorGridlines) children.push(gridlinesElement("minorGridlines", spec.categoryAxisMinorGridlineColor, spec.categoryAxisMinorGridlineWidthEmu, "chart: categoryAxisMinorGridlineWidthEmu"));
5319
5373
  if (spec.categoryAxisTitle !== void 0) children.push(titleElement(spec.categoryAxisTitle, spec.categoryAxisTitleStyle, spec.categoryAxisTitleRotationDeg));
5320
5374
  if (spec.categoryAxisNumberFormat !== void 0) children.push(elem(c("numFmt"), { attrs: [attr(qname("", "formatCode", ""), spec.categoryAxisNumberFormat), attr(qname("", "sourceLinked", ""), "0")] }));
5321
5375
  if (spec.categoryAxisMajorTickMark !== void 0) children.push(valNode(c("majorTickMark"), spec.categoryAxisMajorTickMark));
5322
5376
  if (spec.categoryAxisMinorTickMark !== void 0) children.push(valNode(c("minorTickMark"), spec.categoryAxisMinorTickMark));
5323
5377
  if (spec.categoryAxisTickLabelPos !== void 0) children.push(valNode(c("tickLblPos"), spec.categoryAxisTickLabelPos));
5324
- if (spec.categoryAxisLineColor !== void 0) children.push(spPrChildren(void 0, spec.categoryAxisLineColor));
5378
+ const catLine = lineSpPr(spec.categoryAxisLineColor, spec.categoryAxisLineWidthEmu, "chart: categoryAxisLineWidthEmu");
5379
+ if (catLine !== null) children.push(catLine);
5325
5380
  const catTxPr = axisTxPrElement(spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg);
5326
5381
  if (catTxPr) children.push(catTxPr);
5327
5382
  children.push(valNode(c("crossAx"), VAL_AX_ID));
@@ -5332,39 +5387,85 @@ const catAxis = (spec) => {
5332
5387
  if (spec.categoryAxisNoMultiLevelLabel) children.push(valNode(c("noMultiLvlLbl"), "1"));
5333
5388
  return elem(c("catAx"), { children });
5334
5389
  };
5335
- const valAxis = (spec) => {
5390
+ const valueAxisElement = (f, ids) => {
5336
5391
  const scalingChildren = [];
5337
- if (spec.valueAxis?.logBase !== void 0) scalingChildren.push(valNode(c("logBase"), spec.valueAxis.logBase));
5338
- scalingChildren.push(valNode(c("orientation"), spec.valueAxisOrientation ?? "minMax"));
5339
- if (spec.valueAxis?.max !== void 0) scalingChildren.push(valNode(c("max"), spec.valueAxis.max));
5340
- if (spec.valueAxis?.min !== void 0) scalingChildren.push(valNode(c("min"), spec.valueAxis.min));
5392
+ if (f.scaling?.logBase !== void 0) scalingChildren.push(valNode(c("logBase"), f.scaling.logBase));
5393
+ scalingChildren.push(valNode(c("orientation"), f.orientation ?? "minMax"));
5394
+ if (f.scaling?.max !== void 0) scalingChildren.push(valNode(c("max"), f.scaling.max));
5395
+ if (f.scaling?.min !== void 0) scalingChildren.push(valNode(c("min"), f.scaling.min));
5341
5396
  const children = [
5342
- valNode(c("axId"), VAL_AX_ID),
5397
+ valNode(c("axId"), ids.axId),
5343
5398
  elem(c("scaling"), { children: scalingChildren }),
5344
- valNode(c("delete"), spec.valueAxisHidden ? "1" : "0"),
5345
- valNode(c("axPos"), "l")
5399
+ valNode(c("delete"), f.hidden ? "1" : "0"),
5400
+ valNode(c("axPos"), ids.axPos)
5346
5401
  ];
5347
- if (spec.valueAxisMajorGridlines) children.push(gridlinesElement("majorGridlines", spec.valueAxisMajorGridlineColor));
5348
- if (spec.valueAxisMinorGridlines) children.push(gridlinesElement("minorGridlines", spec.valueAxisMinorGridlineColor));
5349
- if (spec.valueAxisTitle !== void 0) children.push(titleElement(spec.valueAxisTitle, spec.valueAxisTitleStyle, spec.valueAxisTitleRotationDeg));
5350
- if (spec.valueAxis?.numberFormat !== void 0) children.push(elem(c("numFmt"), { attrs: [attr(qname("", "formatCode", ""), spec.valueAxis.numberFormat), attr(qname("", "sourceLinked", ""), "0")] }));
5351
- if (spec.valueAxisMajorTickMark !== void 0) children.push(valNode(c("majorTickMark"), spec.valueAxisMajorTickMark));
5352
- if (spec.valueAxisMinorTickMark !== void 0) children.push(valNode(c("minorTickMark"), spec.valueAxisMinorTickMark));
5353
- if (spec.valueAxisLineColor !== void 0) children.push(spPrChildren(void 0, spec.valueAxisLineColor));
5354
- const valTxPr = axisTxPrElement(spec.valueAxisLabelStyle, spec.valueAxisLabelRotationDeg);
5402
+ if (f.majorGridlines) children.push(gridlinesElement("majorGridlines", f.majorGridlineColor, f.majorGridlineWidthEmu, `chart: ${f.widthFields.majorGridline}`));
5403
+ if (f.minorGridlines) children.push(gridlinesElement("minorGridlines", f.minorGridlineColor, f.minorGridlineWidthEmu, `chart: ${f.widthFields.minorGridline}`));
5404
+ if (f.title !== void 0) children.push(titleElement(f.title, f.titleStyle, f.titleRotationDeg));
5405
+ if (f.scaling?.numberFormat !== void 0) children.push(elem(c("numFmt"), { attrs: [attr(qname("", "formatCode", ""), f.scaling.numberFormat), attr(qname("", "sourceLinked", ""), "0")] }));
5406
+ if (f.majorTickMark !== void 0) children.push(valNode(c("majorTickMark"), f.majorTickMark));
5407
+ if (f.minorTickMark !== void 0) children.push(valNode(c("minorTickMark"), f.minorTickMark));
5408
+ if (f.tickLabelPos !== void 0) children.push(valNode(c("tickLblPos"), f.tickLabelPos));
5409
+ const axisLine = lineSpPr(f.lineColor, f.lineWidthEmu, `chart: ${f.widthFields.line}`);
5410
+ if (axisLine !== null) children.push(axisLine);
5411
+ const valTxPr = axisTxPrElement(f.labelStyle, f.labelRotationDeg);
5355
5412
  if (valTxPr) children.push(valTxPr);
5356
- children.push(valNode(c("crossAx"), CAT_AX_ID));
5357
- const xross = spec.valueAxisCrosses;
5413
+ children.push(valNode(c("crossAx"), ids.crossAxId));
5414
+ const xross = f.crosses;
5358
5415
  if (xross !== void 0) if (typeof xross === "string") children.push(valNode(c("crosses"), xross));
5359
5416
  else children.push(valNode(c("crossesAt"), String(xross.at)));
5360
- if (spec.valueAxisCrossBetween !== void 0) children.push(valNode(c("crossBetween"), spec.valueAxisCrossBetween));
5361
- if (spec.valueAxis?.majorUnit !== void 0) children.push(valNode(c("majorUnit"), spec.valueAxis.majorUnit));
5362
- if (spec.valueAxis?.minorUnit !== void 0) children.push(valNode(c("minorUnit"), spec.valueAxis.minorUnit));
5363
- if (spec.valueAxis?.displayUnits !== void 0) children.push(elem(c("dispUnits"), { children: [valNode(c("builtInUnit"), spec.valueAxis.displayUnits)] }));
5417
+ if (f.crossBetween !== void 0) children.push(valNode(c("crossBetween"), f.crossBetween));
5418
+ if (f.scaling?.majorUnit !== void 0) children.push(valNode(c("majorUnit"), f.scaling.majorUnit));
5419
+ if (f.scaling?.minorUnit !== void 0) children.push(valNode(c("minorUnit"), f.scaling.minorUnit));
5420
+ if (f.scaling?.displayUnits !== void 0) children.push(elem(c("dispUnits"), { children: [valNode(c("builtInUnit"), f.scaling.displayUnits)] }));
5364
5421
  return elem(c("valAx"), { children });
5365
5422
  };
5366
- const buildDLblsFromLabels = (dl) => {
5367
- if (!dl) return null;
5423
+ const isHorizontalBar = (spec) => spec.kind === "bar";
5424
+ const valAxis = (spec) => valueAxisElement({
5425
+ scaling: spec.valueAxis,
5426
+ orientation: spec.valueAxisOrientation,
5427
+ hidden: spec.valueAxisHidden,
5428
+ majorGridlines: spec.valueAxisMajorGridlines,
5429
+ majorGridlineColor: spec.valueAxisMajorGridlineColor,
5430
+ majorGridlineWidthEmu: spec.valueAxisMajorGridlineWidthEmu,
5431
+ minorGridlines: spec.valueAxisMinorGridlines,
5432
+ minorGridlineColor: spec.valueAxisMinorGridlineColor,
5433
+ minorGridlineWidthEmu: spec.valueAxisMinorGridlineWidthEmu,
5434
+ title: spec.valueAxisTitle,
5435
+ titleStyle: spec.valueAxisTitleStyle,
5436
+ titleRotationDeg: spec.valueAxisTitleRotationDeg,
5437
+ majorTickMark: spec.valueAxisMajorTickMark,
5438
+ minorTickMark: spec.valueAxisMinorTickMark,
5439
+ tickLabelPos: spec.valueAxisTickLabelPos,
5440
+ lineColor: spec.valueAxisLineColor,
5441
+ lineWidthEmu: spec.valueAxisLineWidthEmu,
5442
+ widthFields: {
5443
+ majorGridline: "valueAxisMajorGridlineWidthEmu",
5444
+ minorGridline: "valueAxisMinorGridlineWidthEmu",
5445
+ line: "valueAxisLineWidthEmu"
5446
+ },
5447
+ labelStyle: spec.valueAxisLabelStyle,
5448
+ labelRotationDeg: spec.valueAxisLabelRotationDeg,
5449
+ crosses: spec.valueAxisCrosses,
5450
+ crossBetween: spec.valueAxisCrossBetween
5451
+ }, {
5452
+ axId: VAL_AX_ID,
5453
+ crossAxId: CAT_AX_ID,
5454
+ axPos: isHorizontalBar(spec) ? "b" : "l"
5455
+ });
5456
+ const buildDLblsFromLabels = (dl, pointLabels = void 0) => {
5457
+ const children = [];
5458
+ pointLabels?.forEach((pl, i) => {
5459
+ if (pl === null) return;
5460
+ children.push(elem(c("dLbl"), { children: [valNode(c("idx"), i), ...dLblGroupChildren(pl)] }));
5461
+ });
5462
+ if (dl) {
5463
+ children.push(...dLblGroupChildren(dl));
5464
+ if (dl.showLeaderLines !== void 0) children.push(valNode(c("showLeaderLines"), dl.showLeaderLines ? "1" : "0"));
5465
+ }
5466
+ return children.length === 0 ? null : elem(c("dLbls"), { children });
5467
+ };
5468
+ const dLblGroupChildren = (dl) => {
5368
5469
  const children = [];
5369
5470
  if (dl.numberFormat !== void 0) children.push(elem(c("numFmt"), { attrs: [attr(qname("", "formatCode", ""), dl.numberFormat), attr(qname("", "sourceLinked", ""), "0")] }));
5370
5471
  if (dl.textStyle !== void 0) {
@@ -5374,7 +5475,7 @@ const buildDLblsFromLabels = (dl) => {
5374
5475
  if (dl.position !== void 0) children.push(valNode(c("dLblPos"), dl.position));
5375
5476
  children.push(valNode(c("showLegendKey"), "0"), valNode(c("showVal"), dl.showValue ? "1" : "0"), valNode(c("showCatName"), dl.showCategory ? "1" : "0"), valNode(c("showSerName"), dl.showSeriesName ? "1" : "0"), valNode(c("showPercent"), dl.showPercent ? "1" : "0"), valNode(c("showBubbleSize"), "0"));
5376
5477
  if (dl.separator !== void 0) children.push(elem(c("separator"), { children: [text(dl.separator)] }));
5377
- return elem(c("dLbls"), { children });
5478
+ return children;
5378
5479
  };
5379
5480
  const dLblsElement = (spec) => buildDLblsFromLabels(spec.dataLabels);
5380
5481
  const buildBarChart = (spec, sheet, direction, seriesIndices, axes) => {
@@ -5394,11 +5495,12 @@ const buildBarChart = (spec, sheet, direction, seriesIndices, axes) => {
5394
5495
  children.push(valNode(c("axId"), axes.cat), valNode(c("axId"), axes.val));
5395
5496
  return elem(c(direction === "col" ? "barChart" : "barChart"), { children });
5396
5497
  };
5498
+ const lineAreaGrouping = (spec) => spec.grouping === "stacked" || spec.grouping === "percentStacked" ? spec.grouping : "standard";
5397
5499
  const buildLineChart = (spec, sheet, seriesIndices, axes) => {
5398
5500
  const ser = seriesIndices.map((i) => seriesElement(spec, i, sheet));
5399
5501
  const dl = dLblsElement(spec);
5400
5502
  const children = [
5401
- valNode(c("grouping"), spec.grouping ?? "standard"),
5503
+ valNode(c("grouping"), lineAreaGrouping(spec)),
5402
5504
  valNode(c("varyColors"), spec.varyColors ? "1" : "0"),
5403
5505
  ...ser,
5404
5506
  ...dl ? [dl] : []
@@ -5437,7 +5539,7 @@ const buildAreaChart = (spec, sheet, seriesIndices, axes) => {
5437
5539
  const ser = seriesIndices.map((i) => seriesElement(spec, i, sheet));
5438
5540
  const dl = dLblsElement(spec);
5439
5541
  return elem(c("areaChart"), { children: [
5440
- valNode(c("grouping"), spec.grouping ?? "standard"),
5542
+ valNode(c("grouping"), lineAreaGrouping(spec)),
5441
5543
  valNode(c("varyColors"), spec.varyColors ? "1" : "0"),
5442
5544
  ...ser,
5443
5545
  ...dl ? [dl] : [],
@@ -5458,25 +5560,54 @@ const buildComboGroupChart = (spec, sheet, kind, seriesIndices, axes) => {
5458
5560
  /**
5459
5561
  * Secondary value axis (`axPos="r"`, crossing at the category maximum) —
5460
5562
  * the right-hand axis PowerPoint pairs with `secondaryAxis` series.
5461
- */
5462
- const secondaryValAxis = () => elem(c("valAx"), { children: [
5463
- valNode(c("axId"), SEC_VAL_AX_ID),
5464
- elem(c("scaling"), { children: [valNode(c("orientation"), "minMax")] }),
5465
- valNode(c("delete"), "0"),
5466
- valNode(c("axPos"), "r"),
5467
- valNode(c("crossAx"), SEC_CAT_AX_ID),
5468
- valNode(c("crosses"), "max")
5469
- ] });
5563
+ * Formatting comes from `spec.secondaryValueAxis`; PowerPoint's defaults
5564
+ * apply for everything left out.
5565
+ */
5566
+ const secondaryValAxis = (spec) => {
5567
+ const s = spec.secondaryValueAxis ?? {};
5568
+ return valueAxisElement({
5569
+ scaling: s.scaling,
5570
+ orientation: void 0,
5571
+ hidden: void 0,
5572
+ majorGridlines: s.majorGridlines,
5573
+ majorGridlineColor: s.majorGridlineColor,
5574
+ majorGridlineWidthEmu: s.majorGridlineWidthEmu,
5575
+ minorGridlines: void 0,
5576
+ minorGridlineColor: void 0,
5577
+ minorGridlineWidthEmu: void 0,
5578
+ title: s.title,
5579
+ titleStyle: s.titleStyle,
5580
+ titleRotationDeg: void 0,
5581
+ majorTickMark: s.majorTickMark,
5582
+ minorTickMark: s.minorTickMark,
5583
+ tickLabelPos: s.tickLabelPos,
5584
+ lineColor: s.lineColor,
5585
+ lineWidthEmu: s.lineWidthEmu,
5586
+ widthFields: {
5587
+ majorGridline: "secondaryValueAxis.majorGridlineWidthEmu",
5588
+ minorGridline: "secondaryValueAxis.minorGridlineWidthEmu",
5589
+ line: "secondaryValueAxis.lineWidthEmu"
5590
+ },
5591
+ labelStyle: s.labelStyle,
5592
+ labelRotationDeg: void 0,
5593
+ crosses: "max",
5594
+ crossBetween: s.crossBetween
5595
+ }, {
5596
+ axId: SEC_VAL_AX_ID,
5597
+ crossAxId: SEC_CAT_AX_ID,
5598
+ axPos: "r"
5599
+ });
5600
+ };
5470
5601
  /**
5471
5602
  * Deleted companion category axis for the secondary pair. PowerPoint
5472
5603
  * requires every plot group's axId pair to resolve to a cat+val pair,
5473
5604
  * so the secondary group gets its own (hidden) category axis.
5474
5605
  */
5475
- const secondaryCatAxis = () => elem(c("catAx"), { children: [
5606
+ const secondaryCatAxis = (spec) => elem(c("catAx"), { children: [
5476
5607
  valNode(c("axId"), SEC_CAT_AX_ID),
5477
5608
  elem(c("scaling"), { children: [valNode(c("orientation"), "minMax")] }),
5478
5609
  valNode(c("delete"), "1"),
5479
- valNode(c("axPos"), "b"),
5610
+ valNode(c("axPos"), isHorizontalBar(spec) ? "l" : "b"),
5480
5611
  valNode(c("crossAx"), SEC_VAL_AX_ID)
5481
5612
  ] });
5482
5613
  const rPrAttrsFromStyle = (style) => {
@@ -5502,8 +5633,7 @@ const rPrAttrsFromStyle = (style) => {
5502
5633
  };
5503
5634
  };
5504
5635
  const titleElement = (title, style, rotationDeg) => {
5505
- const rPr = elem(a("defRPr"), { attrs: [attr(qname("", "sz", ""), "1400")] });
5506
- const pPr = elem(a("pPr"), { children: [rPr] });
5636
+ const pPr = elem(a("pPr"), { children: [elem(a("defRPr"))] });
5507
5637
  const { attrs: runAttrs, children: runChildren } = rPrAttrsFromStyle(style);
5508
5638
  const runRPr = elem(a("rPr"), {
5509
5639
  attrs: [attr(qname("", "lang", ""), "en-US"), ...runAttrs],
@@ -5511,13 +5641,12 @@ const titleElement = (title, style, rotationDeg) => {
5511
5641
  });
5512
5642
  const tRun = elem(a("r"), { children: [runRPr, elem(a("t"), { children: [text(title)] })] });
5513
5643
  const para = elem(a("p"), { children: [pPr, tRun] });
5514
- const rotStr = rotationDeg !== void 0 && rotationDeg !== 0 ? String(Math.round(rotationDeg * 6e4)) : "0";
5515
5644
  const rich = elem(c("rich"), { children: [
5516
5645
  elem(a("bodyPr"), { attrs: [
5517
- attr(qname("", "rot", ""), rotStr),
5646
+ ...rotationDeg !== void 0 ? [attr(qname("", "rot", ""), String(Math.round(rotationDeg * 6e4)))] : [],
5518
5647
  attr(qname("", "spcFirstLastPara", ""), "1"),
5519
5648
  attr(qname("", "vertOverflow", ""), "ellipsis"),
5520
- attr(qname("", "vert", ""), "horz"),
5649
+ ...rotationDeg !== void 0 ? [attr(qname("", "vert", ""), "horz")] : [],
5521
5650
  attr(qname("", "wrap", ""), "square"),
5522
5651
  attr(qname("", "anchor", ""), "ctr"),
5523
5652
  attr(qname("", "anchorCtr", ""), "1")
@@ -5568,7 +5697,7 @@ const buildChartSpaceDoc = (spec) => {
5568
5697
  const plotAreaChildren = [elem(c("layout")), ...plottedGroups];
5569
5698
  if (!axisless) {
5570
5699
  plotAreaChildren.push(catAxis(spec), valAxis(spec));
5571
- if (hasSecondary) plotAreaChildren.push(secondaryValAxis(), secondaryCatAxis());
5700
+ if (hasSecondary) plotAreaChildren.push(secondaryValAxis(spec), secondaryCatAxis(spec));
5572
5701
  }
5573
5702
  if (spec.plotAreaFill !== void 0 || spec.plotAreaStrokeColor !== void 0) plotAreaChildren.push(spPrChildren(spec.plotAreaFill, spec.plotAreaStrokeColor));
5574
5703
  const plotArea = elem(c("plotArea"), { children: plotAreaChildren });
@@ -5642,7 +5771,12 @@ const NAME_MULTI_LVL_STR_REF = qname("c", "multiLvlStrRef", NS_C);
5642
5771
  const NAME_MULTI_LVL_STR_CACHE = qname("c", "multiLvlStrCache", NS_C);
5643
5772
  const NAME_LVL = qname("c", "lvl", NS_C);
5644
5773
  const NAME_PT = qname("c", "pt", NS_C);
5774
+ const NAME_PT_COUNT = qname("c", "ptCount", NS_C);
5775
+ const MAX_PT_COUNT = 1048576;
5645
5776
  const NAME_V = qname("c", "v", NS_C);
5777
+ const NAME_D_LBLS = qname("c", "dLbls", NS_C);
5778
+ const NAME_D_LBL = qname("c", "dLbl", NS_C);
5779
+ const NAME_VAL_AX = qname("c", "valAx", NS_C);
5646
5780
  const NAME_TITLE = qname("c", "title", NS_C);
5647
5781
  const NAME_RICH = qname("c", "rich", NS_C);
5648
5782
  const NAME_T = qname("a", "t", NS_A);
@@ -5728,19 +5862,40 @@ const findFirst = (parent, names) => {
5728
5862
  }
5729
5863
  return null;
5730
5864
  };
5731
- const readPtArray = (cache) => {
5865
+ const readPtCount = (host) => {
5866
+ const ptCountEl = firstChildElement(host, NAME_PT_COUNT);
5867
+ const raw = ptCountEl !== null ? getAttrValue(ptCountEl, ATTR_VAL) : null;
5868
+ return raw !== null ? Number.parseInt(raw, 10) : NaN;
5869
+ };
5870
+ const readXmlBool = (el) => {
5871
+ const v = getAttrValue(el, ATTR_VAL);
5872
+ return v === null || v === "1" || v === "true";
5873
+ };
5874
+ const parsePointIndex = (raw, limit) => {
5875
+ if (raw === null || !/^\d+$/.test(raw)) return null;
5876
+ const idx = Number.parseInt(raw, 10);
5877
+ return idx < limit ? idx : null;
5878
+ };
5879
+ const readPointIndex = (host, pointCount) => {
5880
+ const idxEl = firstChildElement(host, qname("c", "idx", NS_C));
5881
+ return parsePointIndex(idxEl !== null ? getAttrValue(idxEl, ATTR_VAL) : null, pointCount);
5882
+ };
5883
+ const readPtArray = (cache, countHost = cache) => {
5732
5884
  const out = [];
5885
+ const ptCount = readPtCount(countHost);
5886
+ const idxLimit = Number.isFinite(ptCount) ? Math.min(ptCount, MAX_PT_COUNT) : MAX_PT_COUNT;
5733
5887
  for (const pt of allChildElements(cache, NAME_PT)) {
5734
- const idxRaw = getAttrValue(pt, ATTR_IDX);
5735
- if (idxRaw === null) continue;
5736
- const idx = Number.parseInt(idxRaw, 10);
5737
- if (!Number.isFinite(idx) || idx < 0) continue;
5888
+ const idx = parsePointIndex(getAttrValue(pt, ATTR_IDX), idxLimit);
5889
+ if (idx === null) continue;
5738
5890
  const v = firstChildElement(pt, NAME_V);
5739
5891
  if (v === null) continue;
5740
5892
  let text = "";
5741
5893
  for (const child of v.children) if (child.kind === "text" || child.kind === "cdata") text += child.data;
5742
5894
  out[idx] = text;
5743
5895
  }
5896
+ if (Number.isFinite(ptCount) && ptCount <= MAX_PT_COUNT) {
5897
+ for (let i = 0; i < ptCount; i++) if (out[i] === void 0) out[i] = "";
5898
+ }
5744
5899
  return out;
5745
5900
  };
5746
5901
  const readStringChannel = (parent) => {
@@ -5755,7 +5910,7 @@ const readStringChannel = (parent) => {
5755
5910
  if (multi) {
5756
5911
  const cache = firstChildElement(multi, NAME_MULTI_LVL_STR_CACHE);
5757
5912
  const lvl = cache ? firstChildElement(cache, NAME_LVL) : null;
5758
- if (lvl) return readPtArray(lvl);
5913
+ if (lvl && cache) return readPtArray(lvl, cache);
5759
5914
  }
5760
5915
  return null;
5761
5916
  };
@@ -5784,19 +5939,15 @@ const readSeriesName = (ser) => {
5784
5939
  if (!tx) return "";
5785
5940
  return readStringRef(tx)?.[0] ?? "";
5786
5941
  };
5787
- const readDataPointOverrides = (ser) => {
5942
+ const readDataPointOverrides = (ser, pointCount) => {
5788
5943
  const colors = [];
5789
5944
  const explosions = [];
5790
5945
  let anyColor = false;
5791
5946
  let anyExplosion = false;
5792
5947
  for (const c of ser.children) {
5793
5948
  if (c.kind !== "element" || c.name.namespaceURI !== NS_C || c.name.localName !== "dPt") continue;
5794
- const idxEl = firstChildElement(c, qname("c", "idx", NS_C));
5795
- if (!idxEl) continue;
5796
- const idxRaw = getAttrValue(idxEl, ATTR_VAL);
5797
- if (idxRaw === null) continue;
5798
- const idx = Number.parseInt(idxRaw, 10);
5799
- if (!Number.isFinite(idx) || idx < 0) continue;
5949
+ const idx = readPointIndex(c, pointCount);
5950
+ if (idx === null) continue;
5800
5951
  const spPr = firstChildElement(c, NAME_SP_PR_C);
5801
5952
  if (spPr) {
5802
5953
  const solidFill = firstChildElement(spPr, NAME_SOLID_FILL$1);
@@ -5929,10 +6080,21 @@ const readSeriesColor = (ser) => {
5929
6080
  const v = getAttrValue(srgb, ATTR_VAL);
5930
6081
  return v !== null ? `#${v.toUpperCase()}` : void 0;
5931
6082
  };
6083
+ const readSolidSrgb = (host) => {
6084
+ const fill = host !== null ? firstChildElement(host, NAME_SOLID_FILL$1) : null;
6085
+ const srgb = fill !== null ? firstChildElement(fill, NAME_SRGB_CLR) : null;
6086
+ const color = srgb !== null ? getAttrValue(srgb, ATTR_VAL) : null;
6087
+ return color !== null ? `#${color.toUpperCase()}` : void 0;
6088
+ };
5932
6089
  const readSeriesMarker = (ser) => {
5933
6090
  const m = firstChildElement(ser, qname("c", "marker", NS_C));
5934
6091
  if (!m) return {};
5935
6092
  const out = {};
6093
+ const spPr = firstChildElement(m, NAME_SP_PR_C);
6094
+ const color = readSolidSrgb(spPr);
6095
+ if (color !== void 0) out.markerColor = color;
6096
+ const lineColor = readSolidSrgb(spPr !== null ? firstChildElement(spPr, qname("a", "ln", NS_A)) : null);
6097
+ if (lineColor !== void 0) out.markerLineColor = lineColor;
5936
6098
  const symEl = firstChildElement(m, qname("c", "symbol", NS_C));
5937
6099
  if (symEl) {
5938
6100
  const v = getAttrValue(symEl, ATTR_VAL);
@@ -5954,10 +6116,14 @@ const readSeriesLineProps = (ser) => {
5954
6116
  const ln = firstChildElement(spPr, qname("a", "ln", NS_A));
5955
6117
  if (!ln) return {};
5956
6118
  const out = {};
6119
+ const lnFill = firstChildElement(ln, NAME_SOLID_FILL$1);
6120
+ const lnSrgb = lnFill !== null ? firstChildElement(lnFill, NAME_SRGB_CLR) : null;
6121
+ const lnColor = lnSrgb !== null ? getAttrValue(lnSrgb, ATTR_VAL) : null;
6122
+ if (lnColor !== null) out.lineColor = `#${lnColor.toUpperCase()}`;
5957
6123
  const w = getAttrValue(ln, qname("", "w", ""));
5958
6124
  if (w !== null) {
5959
6125
  const n = Number.parseInt(w, 10);
5960
- if (Number.isFinite(n) && n > 0) out.lineWidthEmu = n;
6126
+ if (Number.isFinite(n) && n >= 0) out.lineWidthEmu = n;
5961
6127
  }
5962
6128
  const prstDash = firstChildElement(ln, qname("a", "prstDash", NS_A));
5963
6129
  if (prstDash) {
@@ -6032,21 +6198,20 @@ const readRunStyle = (rPr) => {
6032
6198
  };
6033
6199
  const readLabelStyle = (richHost) => {
6034
6200
  for (const p of allChildElements(richHost, NAME_P_DML)) {
6201
+ let runStyle;
6035
6202
  for (const r of allChildElements(p, NAME_R_DML)) {
6036
6203
  const rPr = firstChildElement(r, NAME_A_RPR$1);
6037
- if (rPr) {
6038
- const s = readRunStyle(rPr);
6039
- if (s) return s;
6040
- }
6204
+ runStyle = rPr !== null ? readRunStyle(rPr) : void 0;
6205
+ if (runStyle !== void 0) break;
6041
6206
  }
6042
6207
  const pPr = firstChildElement(p, NAME_A_PPR$1);
6043
- if (pPr) {
6044
- const defRPr = firstChildElement(pPr, NAME_A_DEF_RPR$1);
6045
- if (defRPr) {
6046
- const s = readRunStyle(defRPr);
6047
- if (s) return s;
6048
- }
6049
- }
6208
+ const defRPr = pPr !== null ? firstChildElement(pPr, NAME_A_DEF_RPR$1) : null;
6209
+ const defStyle = defRPr !== null ? readRunStyle(defRPr) : void 0;
6210
+ if (runStyle === void 0 && defStyle === void 0) continue;
6211
+ return {
6212
+ ...defStyle,
6213
+ ...runStyle
6214
+ };
6050
6215
  }
6051
6216
  };
6052
6217
  const readTitleStyleOf = (titleEl) => {
@@ -6097,6 +6262,121 @@ const readDataLabelSeparator = (dLbls) => {
6097
6262
  for (const c of el.children) if (c.kind === "text" || c.kind === "cdata") acc += c.data;
6098
6263
  return acc.length > 0 ? acc : void 0;
6099
6264
  };
6265
+ const readDataLabelsGroup = (host, inherited) => {
6266
+ const readToggle = (local, fallback) => {
6267
+ const el = firstChildElement(host, qname("c", local, NS_C));
6268
+ return el !== null ? readXmlBool(el) : fallback;
6269
+ };
6270
+ const nfEl = firstChildElement(host, qname("c", "numFmt", NS_C));
6271
+ let numberFormat;
6272
+ if (nfEl) {
6273
+ const fc = getAttrValue(nfEl, qname("", "formatCode", ""));
6274
+ if (fc !== null && fc.length > 0 && fc !== "General") numberFormat = fc;
6275
+ }
6276
+ const position = readDataLabelPosition(host);
6277
+ const separator = readDataLabelSeparator(host);
6278
+ const txPrEl = firstChildElement(host, qname("c", "txPr", NS_C));
6279
+ const textStyle = txPrEl ? readLabelStyle(txPrEl) : void 0;
6280
+ return {
6281
+ showValue: readToggle("showVal", inherited?.showValue ?? false),
6282
+ showCategory: readToggle("showCatName", inherited?.showCategory ?? false),
6283
+ showSeriesName: readToggle("showSerName", inherited?.showSeriesName ?? false),
6284
+ showPercent: readToggle("showPercent", inherited?.showPercent ?? false),
6285
+ ...numberFormat !== void 0 ? { numberFormat } : {},
6286
+ ...position !== void 0 ? { position } : {},
6287
+ ...separator !== void 0 ? { separator } : {},
6288
+ ...textStyle !== void 0 ? { textStyle } : {}
6289
+ };
6290
+ };
6291
+ const readSeriesLevelDataLabels = (dLbls) => {
6292
+ const group = readDataLabelsGroup(dLbls, void 0);
6293
+ const leaderEl = firstChildElement(dLbls, qname("c", "showLeaderLines", NS_C));
6294
+ return leaderEl !== null ? {
6295
+ ...group,
6296
+ showLeaderLines: readXmlBool(leaderEl)
6297
+ } : group;
6298
+ };
6299
+ const hasDataLabelGroupChild = (dLbls) => dLbls.children.some((ch) => ch.kind === "element" && ch.name.namespaceURI === NS_C && ch.name.localName !== "dLbl" && ch.name.localName !== "extLst");
6300
+ const DELETED_POINT_LABEL = {
6301
+ showValue: false,
6302
+ showCategory: false,
6303
+ showSeriesName: false,
6304
+ showPercent: false
6305
+ };
6306
+ const readPointDataLabels = (dLbls, pointCount, seriesLabels) => {
6307
+ const out = [];
6308
+ let any = false;
6309
+ for (const dLbl of allChildElements(dLbls, NAME_D_LBL)) {
6310
+ const idx = readPointIndex(dLbl, pointCount);
6311
+ if (idx === null) continue;
6312
+ const deleteEl = firstChildElement(dLbl, qname("c", "delete", NS_C));
6313
+ out[idx] = deleteEl !== null && readXmlBool(deleteEl) ? DELETED_POINT_LABEL : readDataLabelsGroup(dLbl, seriesLabels);
6314
+ any = true;
6315
+ }
6316
+ if (!any) return void 0;
6317
+ for (let i = 0; i < out.length; i++) out[i] ??= null;
6318
+ return out;
6319
+ };
6320
+ const readValueAxisScaling = (valAx) => {
6321
+ let min;
6322
+ let max;
6323
+ let majorUnit;
6324
+ let minorUnit;
6325
+ let logBase;
6326
+ let displayUnits;
6327
+ const scaling = firstChildElement(valAx, qname("c", "scaling", NS_C));
6328
+ const readNumOn = (parent, local) => {
6329
+ const el = firstChildElement(parent, qname("c", local, NS_C));
6330
+ if (!el) return void 0;
6331
+ const v = getAttrValue(el, ATTR_VAL);
6332
+ if (v === null) return void 0;
6333
+ const n = Number.parseFloat(v);
6334
+ return Number.isFinite(n) ? n : void 0;
6335
+ };
6336
+ if (scaling) {
6337
+ min = readNumOn(scaling, "min");
6338
+ max = readNumOn(scaling, "max");
6339
+ const lb = readNumOn(scaling, "logBase");
6340
+ if (lb !== void 0 && lb >= 2 && lb <= 1e3) logBase = lb;
6341
+ }
6342
+ majorUnit = readNumOn(valAx, "majorUnit");
6343
+ minorUnit = readNumOn(valAx, "minorUnit");
6344
+ const dispUnits = firstChildElement(valAx, qname("c", "dispUnits", NS_C));
6345
+ if (dispUnits) {
6346
+ const builtIn = firstChildElement(dispUnits, qname("c", "builtInUnit", NS_C));
6347
+ if (builtIn) {
6348
+ const v = getAttrValue(builtIn, ATTR_VAL);
6349
+ switch (v) {
6350
+ case "hundreds":
6351
+ case "thousands":
6352
+ case "tenThousands":
6353
+ case "hundredThousands":
6354
+ case "millions":
6355
+ case "tenMillions":
6356
+ case "hundredMillions":
6357
+ case "billions":
6358
+ case "trillions":
6359
+ displayUnits = v;
6360
+ break;
6361
+ }
6362
+ }
6363
+ }
6364
+ let numberFormat;
6365
+ const nfEl = firstChildElement(valAx, qname("c", "numFmt", NS_C));
6366
+ if (nfEl) {
6367
+ const fc = getAttrValue(nfEl, qname("", "formatCode", ""));
6368
+ if (fc !== null && fc.length > 0 && fc !== "General") numberFormat = fc;
6369
+ }
6370
+ if (min !== void 0 || max !== void 0 || majorUnit !== void 0 || minorUnit !== void 0 || numberFormat !== void 0 || logBase !== void 0 || displayUnits !== void 0) return {
6371
+ ...min !== void 0 ? { min } : {},
6372
+ ...max !== void 0 ? { max } : {},
6373
+ ...majorUnit !== void 0 ? { majorUnit } : {},
6374
+ ...minorUnit !== void 0 ? { minorUnit } : {},
6375
+ ...numberFormat !== void 0 ? { numberFormat } : {},
6376
+ ...logBase !== void 0 ? { logBase } : {},
6377
+ ...displayUnits !== void 0 ? { displayUnits } : {}
6378
+ };
6379
+ };
6100
6380
  /**
6101
6381
  * Parses a `<c:chartSpace>` element into a typed `ChartSpec`. Throws if
6102
6382
  * the root or any required child is missing. Returns `null` only when
@@ -6129,22 +6409,24 @@ const readChartSpec = (root) => {
6129
6409
  if (!firstGroup) return null;
6130
6410
  const plotted = firstGroup.element;
6131
6411
  const kind = firstGroup.kind;
6132
- const secondaryValAxisIds = /* @__PURE__ */ new Set();
6133
- for (const child of plotArea.children) {
6134
- if (child.kind !== "element" || child.name.namespaceURI !== NS_C || child.name.localName !== "valAx") continue;
6135
- const axIdEl = firstChildElement(child, qname("c", "axId", NS_C));
6136
- const axPosEl = firstChildElement(child, qname("c", "axPos", NS_C));
6137
- const axId = axIdEl !== null ? getAttrValue(axIdEl, ATTR_VAL) : null;
6138
- const axPos = axPosEl !== null ? getAttrValue(axPosEl, ATTR_VAL) : null;
6139
- if (axId !== null && (axPos === "r" || axPos === "t")) secondaryValAxisIds.add(axId);
6140
- }
6141
- const groupUsesSecondaryAxis = (group) => {
6142
- for (const child of group.children) if (child.kind === "element" && child.name.namespaceURI === NS_C && child.name.localName === "axId") {
6143
- const id = getAttrValue(child, ATTR_VAL);
6144
- if (id !== null && secondaryValAxisIds.has(id)) return true;
6412
+ const groupAxisIds = (group) => {
6413
+ const ids = [];
6414
+ for (const axIdEl of allChildElements(group, qname("c", "axId", NS_C))) {
6415
+ const id = getAttrValue(axIdEl, ATTR_VAL);
6416
+ if (id !== null) ids.push(id);
6145
6417
  }
6146
- return false;
6418
+ return ids;
6147
6419
  };
6420
+ const valAxisIds = /* @__PURE__ */ new Set();
6421
+ for (const el of allChildElements(plotArea, NAME_VAL_AX)) {
6422
+ const axIdEl = firstChildElement(el, qname("c", "axId", NS_C));
6423
+ const id = axIdEl !== null ? getAttrValue(axIdEl, ATTR_VAL) : null;
6424
+ if (id !== null) valAxisIds.add(id);
6425
+ }
6426
+ const primaryAxisIds = new Set(groupAxisIds(plotted));
6427
+ const secondaryValAxisIds = /* @__PURE__ */ new Set();
6428
+ for (const group of plotGroups.slice(1)) for (const id of groupAxisIds(group.element)) if (valAxisIds.has(id) && !primaryAxisIds.has(id)) secondaryValAxisIds.add(id);
6429
+ const groupUsesSecondaryAxis = (group) => groupAxisIds(group).some((id) => secondaryValAxisIds.has(id));
6148
6430
  const series = [];
6149
6431
  let categoriesFromFirst = null;
6150
6432
  const serEntries = [];
@@ -6174,44 +6456,18 @@ const readChartSpec = (root) => {
6174
6456
  const bubbleSizeEl = firstChildElement(ser, qname("c", "bubbleSize", NS_C));
6175
6457
  const bubbleSizes = bubbleSizeEl !== null ? readNumRef(bubbleSizeEl) : null;
6176
6458
  const color = readSeriesColor(ser);
6177
- const { lineWidthEmu, lineDash } = readSeriesLineProps(ser);
6178
- const { markerSymbol, markerSizePt } = readSeriesMarker(ser);
6459
+ const { lineWidthEmu, lineColor, lineDash } = readSeriesLineProps(ser);
6460
+ const { markerSymbol, markerSizePt, markerColor, markerLineColor } = readSeriesMarker(ser);
6179
6461
  const invertEl = firstChildElement(ser, qname("c", "invertIfNegative", NS_C));
6180
- const invertIfNegative = invertEl !== null && getAttrValue(invertEl, ATTR_VAL) !== "0" ? true : void 0;
6181
- const { colors: pointColors, explosions: pointExplosions } = readDataPointOverrides(ser);
6462
+ const invertIfNegative = invertEl !== null && readXmlBool(invertEl) ? true : void 0;
6463
+ const pointCount = values !== null ? values.length : 0;
6464
+ const { colors: pointColors, explosions: pointExplosions } = readDataPointOverrides(ser, pointCount);
6182
6465
  const smoothEl = firstChildElement(ser, qname("c", "smooth", NS_C));
6183
- const smooth = smoothEl !== null && getAttrValue(smoothEl, ATTR_VAL) !== "0";
6466
+ const smooth = smoothEl !== null && readXmlBool(smoothEl);
6184
6467
  const trendline = readTrendline(ser);
6185
- const serDLblsEl = firstChildElement(ser, qname("c", "dLbls", NS_C));
6186
- let serDataLabels;
6187
- if (serDLblsEl) {
6188
- const readToggle = (local) => {
6189
- const el = firstChildElement(serDLblsEl, qname("c", local, NS_C));
6190
- if (!el) return false;
6191
- const v = getAttrValue(el, ATTR_VAL);
6192
- return v === null || v === "1" || v === "true";
6193
- };
6194
- const nfEl = firstChildElement(serDLblsEl, qname("c", "numFmt", NS_C));
6195
- let numberFormat;
6196
- if (nfEl) {
6197
- const fc = getAttrValue(nfEl, qname("", "formatCode", ""));
6198
- if (fc !== null && fc.length > 0 && fc !== "General") numberFormat = fc;
6199
- }
6200
- const position = readDataLabelPosition(serDLblsEl);
6201
- const separator = readDataLabelSeparator(serDLblsEl);
6202
- const txPrEl = firstChildElement(serDLblsEl, qname("c", "txPr", NS_C));
6203
- const textStyle = txPrEl ? readLabelStyle(txPrEl) : void 0;
6204
- serDataLabels = {
6205
- showValue: readToggle("showVal"),
6206
- showCategory: readToggle("showCatName"),
6207
- showSeriesName: readToggle("showSerName"),
6208
- showPercent: readToggle("showPercent"),
6209
- ...numberFormat !== void 0 ? { numberFormat } : {},
6210
- ...position !== void 0 ? { position } : {},
6211
- ...separator !== void 0 ? { separator } : {},
6212
- ...textStyle !== void 0 ? { textStyle } : {}
6213
- };
6214
- }
6468
+ const serDLblsEl = firstChildElement(ser, NAME_D_LBLS);
6469
+ const serDataLabels = serDLblsEl !== null && hasDataLabelGroupChild(serDLblsEl) ? readSeriesLevelDataLabels(serDLblsEl) : void 0;
6470
+ const pointDataLabels = serDLblsEl !== null ? readPointDataLabels(serDLblsEl, pointCount, serDataLabels) : void 0;
6215
6471
  series.push({
6216
6472
  name,
6217
6473
  values: values ?? [],
@@ -6221,12 +6477,16 @@ const readChartSpec = (root) => {
6221
6477
  ...bubbleSizes !== null ? { bubbleSizes } : {},
6222
6478
  ...color !== void 0 ? { color } : {},
6223
6479
  ...lineWidthEmu !== void 0 ? { lineWidthEmu } : {},
6480
+ ...lineColor !== void 0 ? { lineColor } : {},
6224
6481
  ...lineDash !== void 0 ? { lineDash } : {},
6225
6482
  ...markerSymbol !== void 0 ? { markerSymbol } : {},
6226
6483
  ...markerSizePt !== void 0 ? { markerSizePt } : {},
6484
+ ...markerColor !== void 0 ? { markerColor } : {},
6485
+ ...markerLineColor !== void 0 ? { markerLineColor } : {},
6227
6486
  ...invertIfNegative !== void 0 ? { invertIfNegative } : {},
6228
6487
  ...pointColors !== void 0 ? { pointColors } : {},
6229
6488
  ...pointExplosions !== void 0 ? { pointExplosions } : {},
6489
+ ...pointDataLabels !== void 0 ? { pointDataLabels } : {},
6230
6490
  ...smoothEl !== null ? { smooth } : {},
6231
6491
  ...trendline !== void 0 ? { trendline } : {},
6232
6492
  ...serDataLabels !== void 0 ? { dataLabels: serDataLabels } : {}
@@ -6235,98 +6495,21 @@ const readChartSpec = (root) => {
6235
6495
  const categories = categoriesFromFirst ?? [];
6236
6496
  const title = readTitle(chart);
6237
6497
  const titleStyle = readTitleStyle(chart);
6238
- const dLbls = firstChildElement(plotted, qname("c", "dLbls", NS_C));
6239
- let dataLabels;
6240
- if (dLbls) {
6241
- const readToggle = (local) => {
6242
- const el = firstChildElement(dLbls, qname("c", local, NS_C));
6243
- if (!el) return false;
6244
- const v = getAttrValue(el, ATTR_VAL);
6245
- return v === null || v === "1" || v === "true";
6246
- };
6247
- const nfEl = firstChildElement(dLbls, qname("c", "numFmt", NS_C));
6248
- let numberFormat;
6249
- if (nfEl) {
6250
- const fc = getAttrValue(nfEl, qname("", "formatCode", ""));
6251
- if (fc !== null && fc.length > 0 && fc !== "General") numberFormat = fc;
6252
- }
6253
- const position = readDataLabelPosition(dLbls);
6254
- const separator = readDataLabelSeparator(dLbls);
6255
- const txPrEl = firstChildElement(dLbls, qname("c", "txPr", NS_C));
6256
- const textStyle = txPrEl ? readLabelStyle(txPrEl) : void 0;
6257
- dataLabels = {
6258
- showValue: readToggle("showVal"),
6259
- showCategory: readToggle("showCatName"),
6260
- showSeriesName: readToggle("showSerName"),
6261
- showPercent: readToggle("showPercent"),
6262
- ...numberFormat !== void 0 ? { numberFormat } : {},
6263
- ...position !== void 0 ? { position } : {},
6264
- ...separator !== void 0 ? { separator } : {},
6265
- ...textStyle !== void 0 ? { textStyle } : {}
6266
- };
6267
- }
6268
- let valueAxis;
6269
- const valAx = findFirst(plotArea, ["valAx"]);
6270
- if (valAx) {
6271
- let min;
6272
- let max;
6273
- let majorUnit;
6274
- let minorUnit;
6275
- let logBase;
6276
- let displayUnits;
6277
- const scaling = firstChildElement(valAx, qname("c", "scaling", NS_C));
6278
- const readNumOn = (parent, local) => {
6279
- const el = firstChildElement(parent, qname("c", local, NS_C));
6280
- if (!el) return void 0;
6281
- const v = getAttrValue(el, ATTR_VAL);
6282
- if (v === null) return void 0;
6283
- const n = Number.parseFloat(v);
6284
- return Number.isFinite(n) ? n : void 0;
6285
- };
6286
- if (scaling) {
6287
- min = readNumOn(scaling, "min");
6288
- max = readNumOn(scaling, "max");
6289
- const lb = readNumOn(scaling, "logBase");
6290
- if (lb !== void 0 && lb >= 2 && lb <= 1e3) logBase = lb;
6291
- }
6292
- majorUnit = readNumOn(valAx, "majorUnit");
6293
- minorUnit = readNumOn(valAx, "minorUnit");
6294
- const dispUnits = firstChildElement(valAx, qname("c", "dispUnits", NS_C));
6295
- if (dispUnits) {
6296
- const builtIn = firstChildElement(dispUnits, qname("c", "builtInUnit", NS_C));
6297
- if (builtIn) {
6298
- const v = getAttrValue(builtIn, ATTR_VAL);
6299
- switch (v) {
6300
- case "hundreds":
6301
- case "thousands":
6302
- case "tenThousands":
6303
- case "hundredThousands":
6304
- case "millions":
6305
- case "tenMillions":
6306
- case "hundredMillions":
6307
- case "billions":
6308
- case "trillions":
6309
- displayUnits = v;
6310
- break;
6311
- }
6312
- }
6313
- }
6314
- let numberFormat;
6315
- const nfEl = firstChildElement(valAx, qname("c", "numFmt", NS_C));
6316
- if (nfEl) {
6317
- const fc = getAttrValue(nfEl, qname("", "formatCode", ""));
6318
- if (fc !== null && fc.length > 0 && fc !== "General") numberFormat = fc;
6319
- }
6320
- if (min !== void 0 || max !== void 0 || majorUnit !== void 0 || minorUnit !== void 0 || numberFormat !== void 0 || logBase !== void 0 || displayUnits !== void 0) valueAxis = {
6321
- ...min !== void 0 ? { min } : {},
6322
- ...max !== void 0 ? { max } : {},
6323
- ...majorUnit !== void 0 ? { majorUnit } : {},
6324
- ...minorUnit !== void 0 ? { minorUnit } : {},
6325
- ...numberFormat !== void 0 ? { numberFormat } : {},
6326
- ...logBase !== void 0 ? { logBase } : {},
6327
- ...displayUnits !== void 0 ? { displayUnits } : {}
6328
- };
6329
- }
6498
+ const dLbls = firstChildElement(plotted, NAME_D_LBLS);
6499
+ const dataLabels = dLbls !== null ? readSeriesLevelDataLabels(dLbls) : void 0;
6500
+ let valAx = null;
6501
+ let secValAx = null;
6502
+ for (const el of allChildElements(plotArea, NAME_VAL_AX)) {
6503
+ const axIdEl = firstChildElement(el, qname("c", "axId", NS_C));
6504
+ const id = axIdEl !== null ? getAttrValue(axIdEl, ATTR_VAL) : null;
6505
+ if (id !== null && secondaryValAxisIds.has(id)) secValAx ??= el;
6506
+ else valAx ??= el;
6507
+ }
6508
+ if (valAx === null) {
6509
+ valAx = secValAx;
6510
+ secValAx = null;
6511
+ }
6512
+ const valueAxis = valAx !== null ? readValueAxisScaling(valAx) : void 0;
6330
6513
  let grouping;
6331
6514
  if (kind === "column" || kind === "bar" || kind === "area" || kind === "line") {
6332
6515
  const groupingEl = firstChildElement(plotted, qname("c", "grouping", NS_C));
@@ -6405,6 +6588,12 @@ const readChartSpec = (root) => {
6405
6588
  let categoryAxisMajorGridlineColor;
6406
6589
  let categoryAxisMinorGridlineColor;
6407
6590
  let valueAxisMinorGridlineColor;
6591
+ let categoryAxisLineWidthEmu;
6592
+ let valueAxisLineWidthEmu;
6593
+ let categoryAxisMajorGridlineWidthEmu;
6594
+ let categoryAxisMinorGridlineWidthEmu;
6595
+ let valueAxisMajorGridlineWidthEmu;
6596
+ let valueAxisMinorGridlineWidthEmu;
6408
6597
  const readGridlineColor = (gl) => {
6409
6598
  const spPr = firstChildElement(gl, NAME_SP_PR_C);
6410
6599
  if (!spPr) return void 0;
@@ -6417,6 +6606,13 @@ const readChartSpec = (root) => {
6417
6606
  const v = getAttrValue(srgb, ATTR_VAL);
6418
6607
  return v !== null ? `#${v.toUpperCase()}` : void 0;
6419
6608
  };
6609
+ const readLineWidthEmu = (host) => {
6610
+ const spPr = firstChildElement(host, NAME_SP_PR_C);
6611
+ const ln = spPr !== null ? firstChildElement(spPr, qname("a", "ln", NS_A)) : null;
6612
+ const w = ln !== null ? getAttrValue(ln, qname("", "w", "")) : null;
6613
+ if (w === null || !/^\d+$/.test(w)) return void 0;
6614
+ return Number.parseInt(w, 10);
6615
+ };
6420
6616
  const readAxisLineColor = (axis) => {
6421
6617
  const spPr = firstChildElement(axis, NAME_SP_PR_C);
6422
6618
  if (!spPr) return void 0;
@@ -6444,6 +6640,7 @@ const readChartSpec = (root) => {
6444
6640
  let valueAxisOrientation;
6445
6641
  let valueAxisCrosses;
6446
6642
  let valueAxisCrossBetween;
6643
+ let valueAxisTickLabelPos;
6447
6644
  const readAxisOrientation = (axis) => {
6448
6645
  const scaling = firstChildElement(axis, qname("c", "scaling", NS_C));
6449
6646
  if (!scaling) return void 0;
@@ -6474,12 +6671,19 @@ const readChartSpec = (root) => {
6474
6671
  }
6475
6672
  categoryAxisHidden = isHidden(catAx);
6476
6673
  categoryAxisLineColor = readAxisLineColor(catAx);
6674
+ categoryAxisLineWidthEmu = readLineWidthEmu(catAx);
6477
6675
  const catMajorGl = firstChildElement(catAx, qname("c", "majorGridlines", NS_C));
6478
6676
  categoryAxisMajorGridlines = catMajorGl !== null;
6479
- if (catMajorGl) categoryAxisMajorGridlineColor = readGridlineColor(catMajorGl);
6677
+ if (catMajorGl) {
6678
+ categoryAxisMajorGridlineColor = readGridlineColor(catMajorGl);
6679
+ categoryAxisMajorGridlineWidthEmu = readLineWidthEmu(catMajorGl);
6680
+ }
6480
6681
  const catMinorGl = firstChildElement(catAx, qname("c", "minorGridlines", NS_C));
6481
6682
  categoryAxisMinorGridlines = catMinorGl !== null;
6482
- if (catMinorGl) categoryAxisMinorGridlineColor = readGridlineColor(catMinorGl);
6683
+ if (catMinorGl) {
6684
+ categoryAxisMinorGridlineColor = readGridlineColor(catMinorGl);
6685
+ categoryAxisMinorGridlineWidthEmu = readLineWidthEmu(catMinorGl);
6686
+ }
6483
6687
  categoryAxisOrientation = readAxisOrientation(catAx);
6484
6688
  categoryAxisMajorTickMark = readTickMark(catAx);
6485
6689
  categoryAxisMinorTickMark = readTickMarkLocal(catAx, "minorTickMark");
@@ -6553,9 +6757,15 @@ const readChartSpec = (root) => {
6553
6757
  }
6554
6758
  valueAxisHidden = isHidden(valAx);
6555
6759
  valueAxisLineColor = readAxisLineColor(valAx);
6760
+ valueAxisLineWidthEmu = readLineWidthEmu(valAx);
6556
6761
  valueAxisOrientation = readAxisOrientation(valAx);
6557
6762
  valueAxisMajorTickMark = readTickMark(valAx);
6558
6763
  valueAxisMinorTickMark = readTickMarkLocal(valAx, "minorTickMark");
6764
+ const valPosEl = firstChildElement(valAx, qname("c", "tickLblPos", NS_C));
6765
+ if (valPosEl) {
6766
+ const v = getAttrValue(valPosEl, ATTR_VAL);
6767
+ if (v === "none" || v === "low" || v === "high" || v === "nextTo") valueAxisTickLabelPos = v;
6768
+ }
6559
6769
  const crossesAtEl = firstChildElement(valAx, qname("c", "crossesAt", NS_C));
6560
6770
  if (crossesAtEl) {
6561
6771
  const v = getAttrValue(crossesAtEl, ATTR_VAL);
@@ -6577,10 +6787,54 @@ const readChartSpec = (root) => {
6577
6787
  }
6578
6788
  const majorGl = firstChildElement(valAx, qname("c", "majorGridlines", NS_C));
6579
6789
  valueAxisMajorGridlines = majorGl !== null;
6580
- if (majorGl) valueAxisMajorGridlineColor = readGridlineColor(majorGl);
6790
+ if (majorGl) {
6791
+ valueAxisMajorGridlineColor = readGridlineColor(majorGl);
6792
+ valueAxisMajorGridlineWidthEmu = readLineWidthEmu(majorGl);
6793
+ }
6581
6794
  const minorGl = firstChildElement(valAx, qname("c", "minorGridlines", NS_C));
6582
6795
  valueAxisMinorGridlines = minorGl !== null;
6583
- if (minorGl) valueAxisMinorGridlineColor = readGridlineColor(minorGl);
6796
+ if (minorGl) {
6797
+ valueAxisMinorGridlineColor = readGridlineColor(minorGl);
6798
+ valueAxisMinorGridlineWidthEmu = readLineWidthEmu(minorGl);
6799
+ }
6800
+ }
6801
+ let secondaryValueAxis;
6802
+ if (secValAx !== null) {
6803
+ const scaling = readValueAxisScaling(secValAx);
6804
+ const title = readTitle(secValAx);
6805
+ const titleEl = firstChildElement(secValAx, NAME_TITLE);
6806
+ const titleStyle = titleEl !== null ? readTitleStyleOf(titleEl) : void 0;
6807
+ const txPr = firstChildElement(secValAx, qname("c", "txPr", NS_C));
6808
+ const labelStyle = txPr !== null ? readLabelStyle(txPr) : void 0;
6809
+ const majorGl = firstChildElement(secValAx, qname("c", "majorGridlines", NS_C));
6810
+ const majorGridlineColor = majorGl !== null ? readGridlineColor(majorGl) : void 0;
6811
+ const majorGridlineWidthEmu = majorGl !== null ? readLineWidthEmu(majorGl) : void 0;
6812
+ const lineColor = readAxisLineColor(secValAx);
6813
+ const lineWidthEmu = readLineWidthEmu(secValAx);
6814
+ const majorTickMark = readTickMark(secValAx);
6815
+ const minorTickMark = readTickMarkLocal(secValAx, "minorTickMark");
6816
+ const secPosEl = firstChildElement(secValAx, qname("c", "tickLblPos", NS_C));
6817
+ const secPos = secPosEl !== null ? getAttrValue(secPosEl, ATTR_VAL) : null;
6818
+ const tickLabelPos = secPos === "none" || secPos === "low" || secPos === "high" || secPos === "nextTo" ? secPos : void 0;
6819
+ const crossBetweenEl = firstChildElement(secValAx, qname("c", "crossBetween", NS_C));
6820
+ const cb = crossBetweenEl !== null ? getAttrValue(crossBetweenEl, ATTR_VAL) : null;
6821
+ const crossBetween = cb === "between" || cb === "midCat" ? cb : void 0;
6822
+ const fields = {
6823
+ ...scaling !== void 0 ? { scaling } : {},
6824
+ ...title !== void 0 ? { title } : {},
6825
+ ...titleStyle !== void 0 ? { titleStyle } : {},
6826
+ ...labelStyle !== void 0 ? { labelStyle } : {},
6827
+ ...majorGl !== null ? { majorGridlines: true } : {},
6828
+ ...majorGridlineColor !== void 0 ? { majorGridlineColor } : {},
6829
+ ...majorGridlineWidthEmu !== void 0 ? { majorGridlineWidthEmu } : {},
6830
+ ...lineColor !== void 0 ? { lineColor } : {},
6831
+ ...lineWidthEmu !== void 0 ? { lineWidthEmu } : {},
6832
+ ...majorTickMark !== void 0 ? { majorTickMark } : {},
6833
+ ...minorTickMark !== void 0 ? { minorTickMark } : {},
6834
+ ...tickLabelPos !== void 0 ? { tickLabelPos } : {},
6835
+ ...crossBetween !== void 0 ? { crossBetween } : {}
6836
+ };
6837
+ if (Object.keys(fields).length > 0) secondaryValueAxis = fields;
6584
6838
  }
6585
6839
  const readSpPrFill = (parent) => {
6586
6840
  const spPr = firstChildElement(parent, NAME_SP_PR_C);
@@ -6750,6 +7004,7 @@ const readChartSpec = (root) => {
6750
7004
  ...titleStyle !== void 0 ? { titleStyle } : {},
6751
7005
  ...dataLabels !== void 0 ? { dataLabels } : {},
6752
7006
  ...valueAxis !== void 0 ? { valueAxis } : {},
7007
+ ...secondaryValueAxis !== void 0 ? { secondaryValueAxis } : {},
6753
7008
  ...grouping !== void 0 ? { grouping } : {},
6754
7009
  ...dropLines !== void 0 ? { dropLines } : {},
6755
7010
  ...hiLowLines !== void 0 ? { hiLowLines } : {},
@@ -6782,8 +7037,10 @@ const readChartSpec = (root) => {
6782
7037
  ...valueAxisHidden !== void 0 ? { valueAxisHidden } : {},
6783
7038
  ...valueAxisMajorGridlines !== void 0 ? { valueAxisMajorGridlines } : {},
6784
7039
  ...valueAxisMajorGridlineColor !== void 0 ? { valueAxisMajorGridlineColor } : {},
7040
+ ...valueAxisMajorGridlineWidthEmu !== void 0 ? { valueAxisMajorGridlineWidthEmu } : {},
6785
7041
  ...valueAxisMajorTickMark !== void 0 ? { valueAxisMajorTickMark } : {},
6786
7042
  ...valueAxisMinorTickMark !== void 0 ? { valueAxisMinorTickMark } : {},
7043
+ ...valueAxisTickLabelPos !== void 0 ? { valueAxisTickLabelPos } : {},
6787
7044
  ...valueAxisLabelRotationDeg !== void 0 ? { valueAxisLabelRotationDeg } : {},
6788
7045
  ...categoryAxisMajorTickMark !== void 0 ? { categoryAxisMajorTickMark } : {},
6789
7046
  ...categoryAxisMinorTickMark !== void 0 ? { categoryAxisMinorTickMark } : {},
@@ -6802,6 +7059,11 @@ const readChartSpec = (root) => {
6802
7059
  ...categoryAxisMajorGridlineColor !== void 0 ? { categoryAxisMajorGridlineColor } : {},
6803
7060
  ...categoryAxisMinorGridlineColor !== void 0 ? { categoryAxisMinorGridlineColor } : {},
6804
7061
  ...valueAxisMinorGridlineColor !== void 0 ? { valueAxisMinorGridlineColor } : {},
7062
+ ...categoryAxisLineWidthEmu !== void 0 ? { categoryAxisLineWidthEmu } : {},
7063
+ ...valueAxisLineWidthEmu !== void 0 ? { valueAxisLineWidthEmu } : {},
7064
+ ...categoryAxisMajorGridlineWidthEmu !== void 0 ? { categoryAxisMajorGridlineWidthEmu } : {},
7065
+ ...categoryAxisMinorGridlineWidthEmu !== void 0 ? { categoryAxisMinorGridlineWidthEmu } : {},
7066
+ ...valueAxisMinorGridlineWidthEmu !== void 0 ? { valueAxisMinorGridlineWidthEmu } : {},
6805
7067
  ...categoryAxisOrientation !== void 0 ? { categoryAxisOrientation } : {},
6806
7068
  ...valueAxisOrientation !== void 0 ? { valueAxisOrientation } : {},
6807
7069
  ...valueAxisCrosses !== void 0 ? { valueAxisCrosses } : {},
@@ -7858,14 +8120,22 @@ const validateChartSpecColors = (spec) => {
7858
8120
  checkChartColor(spec.categoryAxisMinorGridlineColor, "addSlideChart: categoryAxisMinorGridlineColor");
7859
8121
  checkChartColor(spec.valueAxisLineColor, "addSlideChart: valueAxisLineColor");
7860
8122
  checkChartColor(spec.categoryAxisLineColor, "addSlideChart: categoryAxisLineColor");
8123
+ checkChartColor(spec.secondaryValueAxis?.majorGridlineColor, "addSlideChart: secondaryValueAxis.majorGridlineColor");
8124
+ checkChartColor(spec.secondaryValueAxis?.lineColor, "addSlideChart: secondaryValueAxis.lineColor");
7861
8125
  spec.series.forEach((series, i) => {
7862
8126
  checkChartColor(series.color, `addSlideChart: series[${i}].color`);
8127
+ checkChartColor(series.lineColor, `addSlideChart: series[${i}].lineColor`);
8128
+ checkChartColor(series.markerColor, `addSlideChart: series[${i}].markerColor`);
8129
+ checkChartColor(series.markerLineColor, `addSlideChart: series[${i}].markerLineColor`);
7863
8130
  checkChartColor(series.trendline?.color, `addSlideChart: series[${i}].trendline.color`);
7864
8131
  series.pointColors?.forEach((c, j) => {
7865
8132
  checkChartColor(c, `addSlideChart: series[${i}].pointColors[${j}]`);
7866
8133
  });
7867
8134
  });
7868
8135
  };
8136
+ const validateChartSpecAxes = (spec) => {
8137
+ if (spec.series.length > 0 && spec.series.every((series) => series.secondaryAxis === true)) throw new Error("chart: at least one series must plot on the primary axis");
8138
+ };
7869
8139
  /**
7870
8140
  * Adds a chart to the slide. Returns the new shape handle (kind
7871
8141
  * `graphicFrame`). Supported chart kinds today: `bar`, `column`,
@@ -7893,10 +8163,17 @@ const withChartDefaultTextColor = (spec, color) => {
7893
8163
  ...style,
7894
8164
  color
7895
8165
  } : style;
8166
+ const hasSecondary = spec.series.some((series) => series.secondaryAxis === true);
8167
+ const secondary = spec.secondaryValueAxis ?? {};
7896
8168
  return {
7897
8169
  ...spec,
7898
8170
  categoryAxisLabelStyle: withColor(spec.categoryAxisLabelStyle),
7899
8171
  valueAxisLabelStyle: withColor(spec.valueAxisLabelStyle),
8172
+ ...hasSecondary ? { secondaryValueAxis: {
8173
+ ...secondary,
8174
+ labelStyle: withColor(secondary.labelStyle),
8175
+ ...secondary.title !== void 0 ? { titleStyle: withColor(secondary.titleStyle) } : {}
8176
+ } } : {},
7900
8177
  ...spec.title !== void 0 ? { titleStyle: withColor(spec.titleStyle) } : {},
7901
8178
  ...spec.legend !== void 0 ? { legend: {
7902
8179
  ...spec.legend,
@@ -7910,6 +8187,7 @@ const withChartDefaultTextColor = (spec, color) => {
7910
8187
  };
7911
8188
  const addSlideChart = (slide, opts) => {
7912
8189
  validateChartSpecColors(opts.spec);
8190
+ validateChartSpecAxes(opts.spec);
7913
8191
  const spec = withChartDefaultTextColor(opts.spec, resolveDeckBodyTextColor(slide));
7914
8192
  const pkg = slide[INTERNAL_PACKAGE];
7915
8193
  const chartN = allocateChartIndex(pkg);
@@ -7994,11 +8272,12 @@ const resolveChartPartName = (slide, shape) => {
7994
8272
  */
7995
8273
  const setChartSpec = (chart, spec) => {
7996
8274
  validateChartSpecColors(spec);
8275
+ validateChartSpecAxes(spec);
7997
8276
  const slide = chart.shape[SHAPE_SLIDE];
7998
8277
  const pkg = slide[INTERNAL_PACKAGE];
7999
8278
  const resolved = resolveChartPartName(slide, chart.shape);
8000
8279
  if (!resolved) throw new Error("setChartSpec: shape is not a chart graphic frame");
8001
- const chartBytes = encode$1(serializeXml(buildChartSpaceDoc(spec)));
8280
+ const chartBytes = encode$1(serializeXml(buildChartSpaceDoc(withChartDefaultTextColor(spec, resolveDeckBodyTextColor(slide)))));
8002
8281
  const chartPart = pkg.getPart(resolved.partName);
8003
8282
  if (!chartPart) throw new Error(`setChartSpec: chart part ${resolved.partName} not found`);
8004
8283
  chartPart.data = chartBytes;
@@ -8209,7 +8488,7 @@ const getSlideCharts = (slide) => {
8209
8488
  //#endregion
8210
8489
  //#region src/api/fn/shape-paragraph.ts
8211
8490
  const NAME_A_DEF_RPR = qname("a", "defRPr", NS.dml);
8212
- const NAME_A_END_PARA_RPR = qname("a", "endParaRPr", NS.dml);
8491
+ const NAME_A_END_PARA_RPR$1 = qname("a", "endParaRPr", NS.dml);
8213
8492
  const NAME_A_LST_STYLE = qname("a", "lstStyle", NS.dml);
8214
8493
  const NAME_P_TX_BODY_PML = qname("p", "txBody", NS.pml);
8215
8494
  const NAME_P_TX_STYLES = qname("p", "txStyles", NS.pml);
@@ -8312,7 +8591,7 @@ const getShapeRunFormatEffective = (pres, shape, paragraphIndex, runIndex) => {
8312
8591
  if (runRPr) mergeRPrLayer(result, parseRPrLikeElement(runRPr, ctx));
8313
8592
  const runs = runsOf(paragraph);
8314
8593
  if (runs.length > 0 && runs[runs.length - 1] === run) {
8315
- const endRPr = firstChildElement(paragraph, NAME_A_END_PARA_RPR);
8594
+ const endRPr = firstChildElement(paragraph, NAME_A_END_PARA_RPR$1);
8316
8595
  if (endRPr) mergeRPrLayer(result, parseRPrLikeElement(endRPr, ctx));
8317
8596
  }
8318
8597
  if (pPr) {
@@ -9493,9 +9772,7 @@ const ensureCellTxBody = (cell) => {
9493
9772
  txBody = elem(NAME_A_TX_BODY_TBL);
9494
9773
  txBody.children.push(elem(qname("a", "bodyPr", NS.dml)));
9495
9774
  txBody.children.push(elem(qname("a", "lstStyle", NS.dml)));
9496
- const tcPrIdx = tc.children.findIndex((c) => c.kind === "element" && c.name.namespaceURI === NS.dml && c.name.localName === "tcPr");
9497
- if (tcPrIdx >= 0) tc.children.splice(tcPrIdx, 0, txBody);
9498
- else tc.children.push(txBody);
9775
+ tc.children.unshift(txBody);
9499
9776
  }
9500
9777
  return txBody;
9501
9778
  };
@@ -9508,12 +9785,25 @@ const ensureCellTcPr = (cell) => {
9508
9785
  }
9509
9786
  return tcPr;
9510
9787
  };
9511
- /** Replaces a cell's text. `\n` starts a new paragraph. */
9788
+ /**
9789
+ * Replaces a cell's text. `\n` starts a new paragraph. The paragraph-end
9790
+ * format (`<a:endParaRPr>`) is not kept; author it with `setTableCellParagraphs`.
9791
+ */
9512
9792
  const setTableCellText = (cell, text) => {
9513
9793
  setTextBody(ensureCellTxBody(cell), text);
9514
9794
  commitTableCell(cell);
9515
9795
  };
9516
9796
  /**
9797
+ * Replaces the cell's text with explicitly structured paragraphs and runs —
9798
+ * the table counterpart of `setShapeParagraphs`. Read back with
9799
+ * `getTableCellParagraphs`.
9800
+ */
9801
+ const setTableCellParagraphs = (cell, paragraphs) => {
9802
+ const built = buildTextBodyParagraphs(paragraphs);
9803
+ replaceTextBodyParagraphs(ensureCellTxBody(cell), built);
9804
+ commitTableCell(cell);
9805
+ };
9806
+ /**
9517
9807
  * Reads the cell's merge / span attributes:
9518
9808
  *
9519
9809
  * - `gridSpan` — number of columns this cell spans (≥1, default 1).
@@ -9578,12 +9868,16 @@ const cellIsMergedAlready = (tc) => {
9578
9868
  * overlapping merges corrupt the grid and trip PowerPoint's repair
9579
9869
  * dialog. Split the existing merge first.
9580
9870
  *
9581
- * The anchor cell's text is preserved; covered cells keep their own
9582
- * `<a:txBody>` in the XML (PowerPoint ignores it while the merge marker
9583
- * is set) so the operation stays losslessly reversible.
9871
+ * The anchor cell's text is preserved. `coveredText: 'keep'` (the default)
9872
+ * leaves each covered cell's `<a:txBody>` in the XML; `'drop'` removes it,
9873
+ * so the covered cells carry no `<a:txBody>` at all (CT_TableCell allows
9874
+ * that), which is how PptxGenJS writes a merge; `getTableCellParagraphs`
9875
+ * reads them as `[]`.
9584
9876
  */
9585
- const mergeTableCells = (table, block) => {
9877
+ const mergeTableCells = (table, block, options) => {
9586
9878
  const { row, col, rowSpan, colSpan } = block;
9879
+ const coveredText = options?.coveredText ?? "keep";
9880
+ if (coveredText !== "keep" && coveredText !== "drop") throw new TypeError(`mergeTableCells: coveredText must be 'keep' or 'drop' (got ${String(coveredText)})`);
9587
9881
  if (!Number.isInteger(rowSpan) || !Number.isInteger(colSpan) || rowSpan < 1 || colSpan < 1) throw new RangeError(`mergeTableCells: rowSpan / colSpan must be integers ≥ 1 (got ${rowSpan} × ${colSpan})`);
9588
9882
  if (rowSpan === 1 && colSpan === 1) throw new RangeError("mergeTableCells: a 1×1 block is not a merge");
9589
9883
  if (!Number.isInteger(row) || !Number.isInteger(col) || row < 0 || col < 0) throw new RangeError(`mergeTableCells: row / col must be non-negative integers (got ${row}, ${col})`);
@@ -9605,6 +9899,7 @@ const mergeTableCells = (table, block) => {
9605
9899
  }
9606
9900
  if (c > col) setSpanAttr(tc, ATTR_H_MERGE, "1");
9607
9901
  if (r > row) setSpanAttr(tc, ATTR_V_MERGE, "1");
9902
+ if (coveredText === "drop") tc.children = tc.children.filter((child) => !(child.kind === "element" && qnameEquals(child.name, NAME_A_TX_BODY_TBL)));
9608
9903
  }
9609
9904
  commitSlideData(table[SHAPE_SLIDE]);
9610
9905
  refreshSlideData(table[SHAPE_SLIDE]);
@@ -9875,7 +10170,8 @@ const getTableCellParagraphs = (cell) => {
9875
10170
  const align = algn !== null ? ALIGN_TOKEN_MAP[algn] ?? null : null;
9876
10171
  out.push({
9877
10172
  align,
9878
- elements: readParagraphElements(p)
10173
+ elements: readParagraphElements(p),
10174
+ endFormat: readParagraphEndFormat(p)
9879
10175
  });
9880
10176
  }
9881
10177
  return out;
@@ -11988,6 +12284,7 @@ const NAME_A_P = qname("a", "p", NS.dml);
11988
12284
  const NAME_A_R = qname("a", "r", NS.dml);
11989
12285
  const NAME_A_RPR = qname("a", "rPr", NS.dml);
11990
12286
  const NAME_A_T = qname("a", "t", NS.dml);
12287
+ const NAME_A_END_PARA_RPR = qname("a", "endParaRPr", NS.dml);
11991
12288
  const paragraphsOf = (txBody) => txBody.children.filter((c) => c.kind === "element" && c.name.namespaceURI === NAME_A_P.namespaceURI && c.name.localName === "p");
11992
12289
  const runsOf = (paragraph) => paragraph.children.filter((c) => c.kind === "element" && c.name.namespaceURI === NAME_A_R.namespaceURI && c.name.localName === "r");
11993
12290
  const requireParagraph = (shape, paragraphIndex) => {
@@ -12037,6 +12334,21 @@ const getShapeParagraphCount = (shape) => paragraphsOf(requireTxBody(shape)).len
12037
12334
  */
12038
12335
  const getShapeParagraphElements = (shape, paragraphIndex) => readParagraphElements(requireParagraph(shape, paragraphIndex));
12039
12336
  /**
12337
+ * Reads the literal format of a paragraph's end mark (`<a:endParaRPr>`), or
12338
+ * `null` when the paragraph carries none. It is the only format a paragraph
12339
+ * with no runs carries. The write side is `setShapeParagraphs`' `endFormat`.
12340
+ */
12341
+ const getParagraphEndFormat = (shape, paragraphIndex) => readParagraphEndFormat(requireParagraph(shape, paragraphIndex));
12342
+ /**
12343
+ * Shared by the shape reader above and the table-cell paragraph reader.
12344
+ *
12345
+ * @internal
12346
+ */
12347
+ const readParagraphEndFormat = (paragraph) => {
12348
+ const endParaRPr = firstChildElement(paragraph, NAME_A_END_PARA_RPR);
12349
+ return endParaRPr === null ? null : parseRPrLikeElement(endParaRPr);
12350
+ };
12351
+ /**
12040
12352
  * Walks a single `<a:p>` element and returns its inline children in
12041
12353
  * document order. Shared by the shape-text reader above and the table-cell
12042
12354
  * text reader: both use the identical DrawingML run/field/break grammar, so
@@ -14954,7 +15266,8 @@ const NAME_TX_BODY = qname("p", "txBody", NS.pml);
14954
15266
  /**
14955
15267
  * Replaces the shape's visible text with `value`. Newlines start a new
14956
15268
  * paragraph. Existing run/paragraph properties are preserved so font,
14957
- * color, size, alignment, and bullet style stay intact.
15269
+ * color, size, alignment, and bullet style stay intact. The paragraph-end
15270
+ * format (`<a:endParaRPr>`) is not kept; author it with `setShapeParagraphs`.
14958
15271
  */
14959
15272
  const setShapeText = (shape, value, options = {}) => {
14960
15273
  if (shape[SHAPE_SNAPSHOT].kind !== "shape") throw new Error(`setShapeText only works on text-bearing shapes; ${shape[SHAPE_SNAPSHOT].kind} is not one`);
@@ -15415,6 +15728,17 @@ const setShapeTextFormat = (shape, format) => {
15415
15728
  applyFormatToAllRuns(requireTxBody(shape), format);
15416
15729
  commitAndRefresh(shape);
15417
15730
  };
15731
+ /**
15732
+ * Replaces the shape's text with explicitly structured paragraphs, each
15733
+ * carrying its own runs and per-run formats. `setShapeText` yields one run
15734
+ * per paragraph; use this when a paragraph mixes formats (a bold lead-in
15735
+ * followed by plain text, for example). Read back with
15736
+ * `getShapeParagraphElements`.
15737
+ */
15738
+ const setShapeParagraphs = (shape, paragraphs) => {
15739
+ setTextBodyParagraphs(requireTxBody(shape), paragraphs);
15740
+ commitAndRefresh(shape);
15741
+ };
15418
15742
  //#endregion
15419
15743
  //#region src/api/fn/shape-removal-zorder.ts
15420
15744
  /**
@@ -17000,8 +17324,8 @@ const ungroupShapes = (group) => {
17000
17324
  };
17001
17325
  //#endregion
17002
17326
  //#region src/api/index.ts
17003
- const VERSION = "0.13.0";
17327
+ const VERSION = "0.15.0";
17004
17328
  //#endregion
17005
- export { slideHasAnimations as $, getTableCellPosition as $a, findSlidesWithChartKind as $i, getSlideMasterCount as $n, getShapeHyperlink as $o, getShapeRunHyperlinkTooltip as $r, getCommentPosition as $s, getShapeStrokeCompound as $t, getPresentationTextLength as A, setSlideTransition as Aa, getShapeImageDuotone as Ai, findShapesInRect as An, removeThumbnail as Ao, setShapeStroke as Ar, getSlideLayoutShapes as As, setShapeTextColumns as At, getSlideText as B, setMediaPartBytes as Ba, setShapeImageContrast as Bi, getShapeCustomGeometry as Bn, findLayoutsWithPlaceholderType as Bo, getParagraphBullet as Br, setShapeImage as Bs, setShapeGlow as Bt, findSlideByTitle as C, getVisibleSlides as Ca, findSlidesByLayoutType as Ci, getSlideShapes as Cn, setTableCellTextDirection as Co, setShapeImageFill as Cr, getSlideBackgroundPatternFill as Cs, getShapeTextWrap as Ct, getOutlineText as D, setSlideNotes as Da, getShapeImageBytes as Di, translateShapes as Dn, setTableStyleFlags as Do, setShapePosition as Dr, getSlideLayoutBackgroundImageBytes as Ds, setShapeTextAnchor as Dt, getAllShapes as E, replaceHyperlink as Ea, getShapeImageBrightness as Ei, setSlideLayout as En, setTableRowHeight as Eo, setShapePatternFill as Er, getSlideLayoutBackgroundGradientFill as Es, setShapeText as Et, getSlideIndex as F, getPackageSize as Fa, getShapeImagePartName as Fi, getShapeAdjustValues as Fn, getPresentationModified as Fo, setShapeStrokeJoin as Fr, getSlideMasterShapes as Fs, clearShapeEffects as Ft, isSlideHidden as G, getSlideTables as Ga, SLIDE_SIZE_4_3 as Gi, getShapeName as Gn, getSlideLayoutPartName as Go, getParagraphLineSpacing as Gr, findCommentsAfter as Gs, getShapeFillColor as Gt, getSlideXmlString as H, validatePresentation as Ha, setShapeImageOpacity as Hi, getShapeFlip as Hn, findSlideLayoutByPartName as Ho, getParagraphBulletStyle as Hr, clearAllSlideComments as Hs, getShapeGradientFill as Ht, getSlideInfo as I, getPresentationSummary as Ia, hasShapeImage as Ii, getShapeAltTitle as In, incrementRevision as Io, getShapeRunFormat as Ir, setSlideBackground as Is, findShapesByEffect as It, replaceTextInSlide as J, getTableCellAnchor as Ja, appendSlideNotes as Ji, getShapePosition as Jn, getSlideLayoutUsageCounts as Jo, getShapeParagraphCount as Jr, findCommentsByText as Js, getShapeFillOpacity as Jt, replaceTextInNotes as K, getTableCell as Ka, getSlideSize as Ki, getShapePlaceholderIdx as Kn, getSlideLayoutPlaceholders as Ko, getParagraphSpacing as Kr, findCommentsBefore as Ks, getShapeFillColorResolved as Kt, getSlideLayoutCount as L, getSlideMediaPartNames as La, hasShapeText as Li, getShapeBounds as Ln, setCoreProperties as Lo, resolveDrawingColor as Lr, setSlideBackgroundImage as Ls, getShapeEffect as Lt, getShapeAt as M, compactPackage as Ma, getShapeImageFormat as Mi, getGroupTransform as Mn, getCoreProperties as Mo, setShapeStrokeCap as Mr, getSlideMasterBackgroundGradientFill as Ms, setShapeTextFormat as Mt, getSlideAt as N, getMediaParts as Na, getShapeImageLinkUrl as Ni, getMaxShapeId as Nn, getExtendedProperties as No, setShapeStrokeCompound as Nr, getSlideMasterBackgroundImageBytes as Ns, setShapeTextMargins as Nt, getPresentationShapeCountsBySlide as O, clearSlideTransition as Oa, getShapeImageContrast as Oi, centerShapeOnSlide as On, setTableStyleId as Oo, setShapeRotation as Or, getSlideLayoutBackgroundPatternFill as Os, setShapeTextAutoFit as Ot, getSlideCount as P, getOrphanMediaPartNames as Pa, getShapeImageOpacity as Pi, getMaxShapeIdInPresentation as Pn, getPresentationCreated as Po, setShapeStrokeDash as Pr, getSlideMasterBackgroundPatternFill as Ps, setShapeTextWrap as Pt, setSlideHidden as Q, getTableCellParagraphs as Qa, findSlidesByHyperlink as Qi, getShapeText as Qn, getParagraphPropertiesEffective as Qo, getShapeRunHyperlink as Qr, getCommentDate as Qs, getShapeStrokeColorResolved as Qt, getSlideOutline as R, listPackageParts as Ra, isShapeImageGrayscale as Ri, getShapeBoundsResolved as Rn, setExtendedProperties as Ro, resolveDrawingColorOpacity as Rr, getShapeClickAction as Rs, getShapeEffects as Rt, findSlideByText as S, getSlidesWithTables as Sa, findSlidesByLayoutPartName as Si, getSlideLayout as Sn, setTableCellText as So, setShapeGradientFill as Sr, getSlideBackgroundImageBytes as Ss, getShapeTextMargins as St, findSlidesByText as T, removeSlideNotes as Ta, getShapeImageBiLevelThreshold as Ti, replaceTokensInSlide as Tn, setTableColumnWidth as To, setShapeNoStroke as Tr, getSlideLayoutBackground as Ts, setShapeBullets as Tt, getSlides as U, clearTableCellFill as Ua, SLIDE_SIZE_16_10 as Ui, getShapeId as Un, findSlideLayoutByType as Uo, getParagraphIndent as Ur, clearSlideComments as Us, getShapeGradientFillEffective as Ut, getSlideTextLength as V, slidesUsingMediaPart as Va, setShapeImageCrop as Vi, getShapeDescription as Vn, findSlideLayout as Vo, getParagraphBulletImageBytes as Vr, addSlideComment as Vs, setShapeShadow as Vt, getSlidesByLayout as W, getPresentationTableCountsBySlide as Wa, SLIDE_SIZE_16_9 as Wi, getShapeKind as Wn, getSlideLayoutName as Wo, getParagraphLevel as Wr, findCommentAuthorByName as Ws, getShapeFill as Wt, replaceTokensInPresentation as X, getTableCellFill as Xa, clearAllSlideNotes as Xi, getShapeRotation as Xn, getSlideLayouts as Xo, getShapeRunClickAction as Xr, getCommentAuthor as Xs, getShapeStrokeCap as Xt, replaceTextInSlideNotes as Y, getTableCellBorders as Ya, clearAllHyperlinks as Yi, getShapePreset as Yn, getSlideLayoutUsageCountsByType as Yo, getShapeParagraphElements as Yr, findSlidesWithCommentsByAuthor as Ys, getShapeStroke as Yt, searchSlides as Z, getTableCellMargins as Za, clearSlideHyperlinks as Zi, getShapeSize as Zn, getUnusedSlideLayouts as Zo, getShapeRunCount as Zr, getCommentAuthors as Zs, getShapeStrokeColor as Zt, sortSlides as _, getSlidesWithComments as _a, emu as _c, setShapeAnimation as _i, findSlidePlaceholders as _n, setTableCellAlignment as _o, getShapeStrokeArrow as _r, getEffectiveColorMap as _s, getShapeTextAutoFit as _t, addContentSlide as a, getAllNotes as aa, getPresentationCommenters as ac, setParagraphLineSpacing as ai, findShapeById as an, getTableDimensions as ao, isShapePlaceholder as ar, findChartsBySeriesName as as, bringShapeForward as at, setSlideSections as b, getSlidesWithNotes as ba, pt as bc, findShapesOutsideCanvas as bi, getShapeXmlString as bn, setTableCellFill as bo, setShapeFill as br, getSlideBackground as bs, getShapeTextColumns as bt, addSlideAt as c, getEmptySlides as ca, removeSlideComment as cc, setShapeRunText as ci, findShapeInPresentation as cn, getTableStyleFlags as co, renameShape as cr, getPresentationChartCountsBySlide as cs, copyShape as ct, duplicateSlideAt as d, getPresentationNotesLength as da, setPresentationFonts as dc, setSlideBody as di, findShapesByName as dn, insertTableRow as do, setShapeDescription as dr, getShapeChartKind as ds, sendShapeBackward as dt, findSlidesWithChartTrendlines as ea, getCommentSlide as ec, getShapeRunText as ei, getShapeStrokeEffective as en, getTableCellSpan as eo, getSlideMasterPartName as er, getShapeRunFormatEffective as es, addSlideImage as et, importSlide as f, getPresentationNotesLengthsBySlide as fa, setPresentationTheme as fc, setSlidePlaceholders as fi, findShapesByPreset as fn, isChartShape as fo, setShapeHidden as fr, getShapeChartSeriesNames as fs, sendShapeToBack as ft, reverseSlides as g, getSlidesWithCharts as ga, cm as gc, getShapeAnimation as gi, findSlidePlaceholderByIdx as gn, removeTableRow as go, getShapePatternFill as gr, setChartSpec as gs, getShapeTextAnchor as gt, removeSlide as h, getSlideNotesLength as ha, savePresentation as hc, findShapesWithAnimation as hi, findSlidePlaceholder as hn, removeTableColumn as ho, clearShapeStroke as hr, getSlideCharts as hs, getShapeBodyPrEffective as ht, addBlankSlide as i, getAllImages as ia, getPresentationCommentCountsBySlide as ic, setParagraphLevel as ii, findEmptyPlaceholders as in, getTableColumnWidths as io, isShapeHidden as ir, findChartByKind as is, addSlideTextBox as it, getPresentationTextLengthsBySlide as j, _internalPackageOf as ja, getShapeImageFillBytes as ji, getGroupChildren as jn, setThumbnail as jo, setShapeStrokeArrow as jr, getSlideMasterBackground as js, setShapeTextDirection as jt, getPresentationText as k, getSlideTransition as ka, getShapeImageCrop as ki, findShapesAtPoint as kn, getThumbnail as ko, setShapeSize as kr, getSlideLayoutBackgroundShapes as ks, setShapeTextBodyRotationDeg as kt, addTitleSlide as l, getHiddenSlides as la, getPresentationFonts as lc, getSlideBody as li, findShapesByHyperlink as ln, getTableStyleId as lo, setShapeAltTitle as lr, getPresentationChartKindCounts as ls, getShapeZIndex as lt, moveSlide as m, getSlideNotes as ma, loadPresentation as mc, clearSlideAnimations as mi, findShapesWithHyperlinks as mn, mergeTableCells as mo, clearShapeFill as mr, getShapeChartSpec as ms, appendShapeText as mt, groupShapes as n, getAllComments as na, getCommentsSortedByDate as nc, setParagraphAlignment as ni, getShapeStrokeOpacity as nn, getTableCellTextDirection as no, getSlideMasterUsageCounts as nr, setShapeRunFormat as ns, addSlideShape as nt, addSectionHeaderSlide as o, getAllTables as oa, getSlideCommentAuthors as oc, setParagraphSpacing as oi, findShapeByName as on, getTableRowHeights as oo, isShapeTextBox as or, findChartsWithDataLabels as os, bringShapeToFront as ot, mergePresentations as p, getPresentationNotesText as pa, createPresentation as pc, setSlideTitle as pi, findShapesByText as pn, isTableShape as po, shapesOverlap as pr, getShapeChartSeriesValues as ps, setShapeZIndex as pt, replaceTextInPresentation as q, getTableCellAlignment as qa, setSlideSize as qi, getShapePlaceholderType as qn, getSlideLayoutType as qo, getShapeHyperlinkTooltip as qr, findCommentsByAuthor as qs, getShapeFillEffective as qt, ungroupShapes as r, getAllHyperlinks as ra, getPresentationCommentCountsByAuthor as rc, setParagraphBullet as ri, getShapeStrokeWidth as rn, getTableCells as ro, getUnusedSlideMasters as rr, addSlideChart as rs, addSlideTable as rt, addSlide as s, getDistinctHyperlinkUrls as sa, getSlideComments as sc, setShapeRunHyperlink as si, findShapeByText as sn, getTableSize as so, pointInShape as sr, findChartsWithTrendlines as ss, clearSlideShapes as st, VERSION as t, getAllCharts as ta, getCommentText as tc, isParagraphBulletPicture as ti, getShapeStrokeJoin as tn, getTableCellText as to, getSlideMasterPartNames as tr, setShapeHyperlink as ts, addSlideLine as tt, duplicateSlide as u, getPresentationHyperlinkCountsBySlide as ua, getPresentationTheme as uc, getSlideTitle as ui, findShapesByKind as un, insertTableColumn as uo, setShapeBounds as ur, getShapeChartCategories as us, removeShape as ut, swapSlides as v, getSlidesWithHyperlinks as va, inches as vc, findFlippedShapes as vi, getShapeIndex as vn, setTableCellAnchor as vo, getShapeStrokeDash as vr, resolveDeckBodyTextColor as vs, getShapeTextAutoFitParams as vt, findSlidesByNotes as w, hasSlideNotes as wa, getPresentationImageCountsBySlide as wi, getSlidesWithEmptyPlaceholders as wn, setTableCellTextFormat as wo, setShapeNoFill as wr, getSlideColorMapOverride as ws, setShapeAlignment as wt, findSlideByPartName as x, getSlidesWithOverlap as xa, findSlidesByLayoutName as xi, getShapesBounds as xn, setTableCellMargins as xo, setShapeFlip as xr, getSlideBackgroundGradientFill as xs, getShapeTextDirection as xt, getSlideSections as y, getSlidesWithImages as ya, mm as yc, findOverlappingShapePairs as yi, getShapeSlide as yn, setTableCellBorders as yo, setShapeAdjustValues as yr, clearSlideBackground as ys, getShapeTextBodyRotationDeg as yt, getSlidePartName as z, readPackagePart as za, setShapeImageBrightness as zi, getShapeCenter as zn, touchModified as zo, getParagraphAlignment as zr, setShapeClickAction as zs, getShapeEffectsEffective as zt };
17329
+ export { slideHasAnimations as $, getTableCellMargins as $a, clearSlideHyperlinks as $i, getShapeText as $n, getSlideLayouts as $o, getShapeRunCount as $r, getCommentAuthor as $s, getShapeStrokeColorResolved as $t, getPresentationTextLength as A, clearSlideTransition as Aa, getShapeImageContrast as Ai, findShapesAtPoint as An, setTableStyleFlags as Ao, setShapeSize as Ar, getSlideLayoutBackgroundImageBytes as As, setShapeTextBodyRotationDeg as At, getSlideText as B, listPackageParts as Ba, isShapeImageGrayscale as Bi, getShapeCenter as Bn, setCoreProperties as Bo, getParagraphAlignment as Br, setSlideBackgroundImage as Bs, getShapeEffectsEffective as Bt, findSlideByTitle as C, getSlidesWithOverlap as Ca, pt as Cc, findSlidesByLayoutName as Ci, getSlideLayout as Cn, setTableCellMargins as Co, setShapeGradientFill as Cr, getSlideBackground as Cs, getShapeTextWrap as Ct, getOutlineText as D, removeSlideNotes as Da, getShapeImageBiLevelThreshold as Di, setSlideLayout as Dn, setTableCellTextFormat as Do, setShapePatternFill as Dr, getSlideColorMapOverride as Ds, setShapeText as Dt, getAllShapes as E, hasSlideNotes as Ea, getPresentationImageCountsBySlide as Ei, replaceTokensInSlide as En, setTableCellTextDirection as Eo, setShapeNoStroke as Er, getSlideBackgroundPatternFill as Es, setShapeParagraphs as Et, getSlideIndex as F, getMediaParts as Fa, getShapeImageLinkUrl as Fi, getMaxShapeIdInPresentation as Fn, getCoreProperties as Fo, setShapeStrokeDash as Fr, getSlideMasterBackgroundGradientFill as Fs, setShapeTextWrap as Ft, isSlideHidden as G, clearTableCellFill as Ga, SLIDE_SIZE_16_10 as Gi, getShapeKind as Gn, findSlideLayoutByPartName as Go, getParagraphIndent as Gr, clearAllSlideComments as Gs, getShapeFill as Gt, getSlideXmlString as H, setMediaPartBytes as Ha, setShapeImageContrast as Hi, getShapeDescription as Hn, touchModified as Ho, getParagraphBulletImageBytes as Hr, setShapeClickAction as Hs, setShapeShadow as Ht, getSlideInfo as I, getOrphanMediaPartNames as Ia, getShapeImageOpacity as Ii, getShapeAdjustValues as In, getExtendedProperties as Io, setShapeStrokeJoin as Ir, getSlideMasterBackgroundImageBytes as Is, clearShapeEffects as It, replaceTextInSlide as J, getTableCell as Ja, getSlideSize as Ji, getShapePlaceholderType as Jn, getSlideLayoutPartName as Jo, getParagraphSpacing as Jr, findCommentsAfter as Js, getShapeFillEffective as Jt, replaceTextInNotes as K, getPresentationTableCountsBySlide as Ka, SLIDE_SIZE_16_9 as Ki, getShapeName as Kn, findSlideLayoutByType as Ko, getParagraphLevel as Kr, clearSlideComments as Ks, getShapeFillColor as Kt, getSlideLayoutCount as L, getPackageSize as La, getShapeImagePartName as Li, getShapeAltTitle as Ln, getPresentationCreated as Lo, getShapeRunFormat as Lr, getSlideMasterBackgroundPatternFill as Ls, findShapesByEffect as Lt, getShapeAt as M, setSlideTransition as Ma, getShapeImageDuotone as Mi, getGroupChildren as Mn, getThumbnail as Mo, setShapeStrokeArrow as Mr, getSlideLayoutBackgroundShapes as Ms, setShapeTextDirection as Mt, getSlideAt as N, _internalPackageOf as Na, getShapeImageFillBytes as Ni, getGroupTransform as Nn, removeThumbnail as No, setShapeStrokeCap as Nr, getSlideLayoutShapes as Ns, setShapeTextFormat as Nt, getPresentationShapeCountsBySlide as O, replaceHyperlink as Oa, getShapeImageBrightness as Oi, translateShapes as On, setTableColumnWidth as Oo, setShapePosition as Or, getSlideLayoutBackground as Os, setShapeTextAnchor as Ot, getSlideCount as P, compactPackage as Pa, getShapeImageFormat as Pi, getMaxShapeId as Pn, setThumbnail as Po, setShapeStrokeCompound as Pr, getSlideMasterBackground as Ps, setShapeTextMargins as Pt, setSlideHidden as Q, getTableCellFill as Qa, clearAllSlideNotes as Qi, getShapeSize as Qn, getSlideLayoutUsageCountsByType as Qo, getShapeRunClickAction as Qr, findSlidesWithCommentsByAuthor as Qs, getShapeStrokeColor as Qt, getSlideOutline as R, getPresentationSummary as Ra, hasShapeImage as Ri, getShapeBounds as Rn, getPresentationModified as Ro, resolveDrawingColor as Rr, getSlideMasterShapes as Rs, getShapeEffect as Rt, findSlideByText as S, getSlidesWithNotes as Sa, mm as Sc, findShapesOutsideCanvas as Si, getShapesBounds as Sn, setTableCellFill as So, setShapeFlip as Sr, clearSlideBackground as Ss, getShapeTextMargins as St, findSlidesByText as T, getVisibleSlides as Ta, findSlidesByLayoutType as Ti, getSlidesWithEmptyPlaceholders as Tn, setTableCellText as To, setShapeNoFill as Tr, getSlideBackgroundImageBytes as Ts, setShapeBullets as Tt, getSlides as U, slidesUsingMediaPart as Ua, setShapeImageCrop as Ui, getShapeFlip as Un, findLayoutsWithPlaceholderType as Uo, getParagraphBulletStyle as Ur, setShapeImage as Us, getShapeGradientFill as Ut, getSlideTextLength as V, readPackagePart as Va, setShapeImageBrightness as Vi, getShapeCustomGeometry as Vn, setExtendedProperties as Vo, getParagraphBullet as Vr, getShapeClickAction as Vs, setShapeGlow as Vt, getSlidesByLayout as W, validatePresentation as Wa, setShapeImageOpacity as Wi, getShapeId as Wn, findSlideLayout as Wo, getParagraphEndFormat as Wr, addSlideComment as Ws, getShapeGradientFillEffective as Wt, replaceTokensInPresentation as X, getTableCellAnchor as Xa, appendSlideNotes as Xi, getShapePreset as Xn, getSlideLayoutType as Xo, getShapeParagraphCount as Xr, findCommentsByAuthor as Xs, getShapeStroke as Xt, replaceTextInSlideNotes as Y, getTableCellAlignment as Ya, setSlideSize as Yi, getShapePosition as Yn, getSlideLayoutPlaceholders as Yo, getShapeHyperlinkTooltip as Yr, findCommentsBefore as Ys, getShapeFillOpacity as Yt, searchSlides as Z, getTableCellBorders as Za, clearAllHyperlinks as Zi, getShapeRotation as Zn, getSlideLayoutUsageCounts as Zo, getShapeParagraphElements as Zr, findCommentsByText as Zs, getShapeStrokeCap as Zt, sortSlides as _, getSlideNotesLength as _a, loadPresentation as _c, findShapesWithAnimation as _i, findSlidePlaceholderByIdx as _n, removeTableColumn as _o, getShapePatternFill as _r, getShapeChartSpec as _s, getShapeTextAutoFit as _t, addContentSlide as a, getAllHyperlinks as aa, getCommentsSortedByDate as ac, setParagraphBullet as ai, findEmptyPlaceholders as an, getTableCells as ao, isShapeHidden as ar, setShapeRunFormat as as, bringShapeForward as at, setSlideSections as b, getSlidesWithHyperlinks as ba, emu as bc, findFlippedShapes as bi, getShapeSlide as bn, setTableCellAnchor as bo, setShapeAdjustValues as br, getEffectiveColorMap as bs, getShapeTextColumns as bt, addSlideAt as c, getAllTables as ca, getPresentationCommenters as cc, setParagraphSpacing as ci, findShapeByText as cn, getTableRowHeights as co, pointInShape as cr, findChartsBySeriesName as cs, copyShape as ct, duplicateSlideAt as d, getHiddenSlides as da, removeSlideComment as dc, getSlideBody as di, findShapesByKind as dn, getTableStyleId as do, setShapeBounds as dr, getPresentationChartCountsBySlide as ds, sendShapeBackward as dt, findSlidesByHyperlink as ea, getCommentAuthors as ec, getShapeRunHyperlink as ei, getShapeStrokeCompound as en, getTableCellParagraphs as eo, getSlideMasterCount as er, getUnusedSlideLayouts as es, addSlideImage as et, importSlide as f, getPresentationHyperlinkCountsBySlide as fa, getPresentationFonts as fc, getSlideTitle as fi, findShapesByName as fn, insertTableColumn as fo, setShapeDescription as fr, getPresentationChartKindCounts as fs, sendShapeToBack as ft, reverseSlides as g, getSlideNotes as ga, createPresentation as gc, clearSlideAnimations as gi, findSlidePlaceholder as gn, mergeTableCells as go, clearShapeStroke as gr, getShapeChartSeriesValues as gs, getShapeTextAnchor as gt, removeSlide as h, getPresentationNotesText as ha, setPresentationTheme as hc, setSlideTitle as hi, findShapesWithHyperlinks as hn, isTableShape as ho, clearShapeFill as hr, getShapeChartSeriesNames as hs, getShapeBodyPrEffective as ht, addBlankSlide as i, getAllComments as ia, getCommentText as ic, setParagraphAlignment as ii, getShapeStrokeWidth as in, getTableCellTextDirection as io, getUnusedSlideMasters as ir, setShapeHyperlink as is, addSlideTextBox as it, getPresentationTextLengthsBySlide as j, getSlideTransition as ja, getShapeImageCrop as ji, findShapesInRect as jn, setTableStyleId as jo, setShapeStroke as jr, getSlideLayoutBackgroundPatternFill as js, setShapeTextColumns as jt, getPresentationText as k, setSlideNotes as ka, getShapeImageBytes as ki, centerShapeOnSlide as kn, setTableRowHeight as ko, setShapeRotation as kr, getSlideLayoutBackgroundGradientFill as ks, setShapeTextAutoFit as kt, addTitleSlide as l, getDistinctHyperlinkUrls as la, getSlideCommentAuthors as lc, setShapeRunHyperlink as li, findShapeInPresentation as ln, getTableSize as lo, renameShape as lr, findChartsWithDataLabels as ls, getShapeZIndex as lt, moveSlide as m, getPresentationNotesLengthsBySlide as ma, setPresentationFonts as mc, setSlidePlaceholders as mi, findShapesByText as mn, isChartShape as mo, shapesOverlap as mr, getShapeChartKind as ms, appendShapeText as mt, groupShapes as n, findSlidesWithChartTrendlines as na, getCommentPosition as nc, getShapeRunText as ni, getShapeStrokeJoin as nn, getTableCellSpan as no, getSlideMasterPartNames as nr, getShapeHyperlink as ns, addSlideShape as nt, addSectionHeaderSlide as o, getAllImages as oa, getPresentationCommentCountsByAuthor as oc, setParagraphLevel as oi, findShapeById as on, getTableColumnWidths as oo, isShapePlaceholder as or, addSlideChart as os, bringShapeToFront as ot, mergePresentations as p, getPresentationNotesLength as pa, getPresentationTheme as pc, setSlideBody as pi, findShapesByPreset as pn, insertTableRow as po, setShapeHidden as pr, getShapeChartCategories as ps, setShapeZIndex as pt, replaceTextInPresentation as q, getSlideTables as qa, SLIDE_SIZE_4_3 as qi, getShapePlaceholderIdx as qn, getSlideLayoutName as qo, getParagraphLineSpacing as qr, findCommentAuthorByName as qs, getShapeFillColorResolved as qt, ungroupShapes as r, getAllCharts as ra, getCommentSlide as rc, isParagraphBulletPicture as ri, getShapeStrokeOpacity as rn, getTableCellText as ro, getSlideMasterUsageCounts as rr, getShapeRunFormatEffective as rs, addSlideTable as rt, addSlide as s, getAllNotes as sa, getPresentationCommentCountsBySlide as sc, setParagraphLineSpacing as si, findShapeByName as sn, getTableDimensions as so, isShapeTextBox as sr, findChartByKind as ss, clearSlideShapes as st, VERSION as t, findSlidesWithChartKind as ta, getCommentDate as tc, getShapeRunHyperlinkTooltip as ti, getShapeStrokeEffective as tn, getTableCellPosition as to, getSlideMasterPartName as tr, getParagraphPropertiesEffective as ts, addSlideLine as tt, duplicateSlide as u, getEmptySlides as ua, getSlideComments as uc, setShapeRunText as ui, findShapesByHyperlink as un, getTableStyleFlags as uo, setShapeAltTitle as ur, findChartsWithTrendlines as us, removeShape as ut, swapSlides as v, getSlidesWithCharts as va, savePresentation as vc, getShapeAnimation as vi, findSlidePlaceholders as vn, removeTableRow as vo, getShapeStrokeArrow as vr, getSlideCharts as vs, getShapeTextAutoFitParams as vt, findSlidesByNotes as w, getSlidesWithTables as wa, findSlidesByLayoutPartName as wi, getSlideShapes as wn, setTableCellParagraphs as wo, setShapeImageFill as wr, getSlideBackgroundGradientFill as ws, setShapeAlignment as wt, findSlideByPartName as x, getSlidesWithImages as xa, inches as xc, findOverlappingShapePairs as xi, getShapeXmlString as xn, setTableCellBorders as xo, setShapeFill as xr, resolveDeckBodyTextColor as xs, getShapeTextDirection as xt, getSlideSections as y, getSlidesWithComments as ya, cm as yc, setShapeAnimation as yi, getShapeIndex as yn, setTableCellAlignment as yo, getShapeStrokeDash as yr, setChartSpec as ys, getShapeTextBodyRotationDeg as yt, getSlidePartName as z, getSlideMediaPartNames as za, hasShapeText as zi, getShapeBoundsResolved as zn, incrementRevision as zo, resolveDrawingColorOpacity as zr, setSlideBackground as zs, getShapeEffects as zt };
17006
17330
 
17007
- //# sourceMappingURL=api-BfZ3bkVf.js.map
17331
+ //# sourceMappingURL=api-DN51TPPz.js.map