pptx-ts 4.0.0 → 4.1.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.
Files changed (95) hide show
  1. package/README.md +147 -114
  2. package/dist/{autopage-odPz7zZO.js → autopage-D4kyVp11.js} +5 -5
  3. package/dist/{autopage-odPz7zZO.js.map → autopage-D4kyVp11.js.map} +1 -1
  4. package/dist/{body-insets-Dw_BeWD_.js → body-insets-kVHmjGc6.js} +2 -2
  5. package/dist/{body-insets-Dw_BeWD_.js.map → body-insets-kVHmjGc6.js.map} +1 -1
  6. package/dist/browser.d.ts +7 -7
  7. package/dist/browser.js +5 -5
  8. package/dist/{clip-Bl01BPcN.d.ts → clip-DHDlnHUq.d.ts} +2 -2
  9. package/dist/{clip-Bl01BPcN.d.ts.map → clip-DHDlnHUq.d.ts.map} +1 -1
  10. package/dist/{diagnostics-D8ot4Ei7.d.ts → diagnostics-DiMmBU8P.d.ts} +6 -6
  11. package/dist/{diagnostics-D8ot4Ei7.d.ts.map → diagnostics-DiMmBU8P.d.ts.map} +1 -1
  12. package/dist/{embedded-fonts-DarT9aoa.d.ts → embedded-fonts-CI_YGW2d.d.ts} +2 -2
  13. package/dist/{embedded-fonts-DarT9aoa.d.ts.map → embedded-fonts-CI_YGW2d.d.ts.map} +1 -1
  14. package/dist/{entry-compose-DCnvBZz2.d.ts → entry-compose-6hF9aTmT.d.ts} +19 -17
  15. package/dist/{entry-compose-DCnvBZz2.d.ts.map → entry-compose-6hF9aTmT.d.ts.map} +1 -1
  16. package/dist/{enums-BUKTUB6V.d.ts → enums-DQRpVOLh.d.ts} +3 -3
  17. package/dist/{enums-BUKTUB6V.d.ts.map → enums-DQRpVOLh.d.ts.map} +1 -1
  18. package/dist/{errors-C4oENPcu.js → errors-Da2nXCJm.js} +6 -6
  19. package/dist/{errors-C4oENPcu.js.map → errors-Da2nXCJm.js.map} +1 -1
  20. package/dist/families.d.ts +6 -6
  21. package/dist/families.js +2 -2
  22. package/dist/{fit-Cb7naFj6.js → fit-CcXbg__l.js} +10 -10
  23. package/dist/{fit-Cb7naFj6.js.map → fit-CcXbg__l.js.map} +1 -1
  24. package/dist/{font-metrics-v5fn7s7e.d.ts → font-metrics-CBGmhLo0.d.ts} +6 -6
  25. package/dist/{font-metrics-v5fn7s7e.d.ts.map → font-metrics-CBGmhLo0.d.ts.map} +1 -1
  26. package/dist/{grid-DikTjFey.js → grid-9B2w5EaY.js} +2 -2
  27. package/dist/{grid-DikTjFey.js.map → grid-9B2w5EaY.js.map} +1 -1
  28. package/dist/{html-dom-Iuog2wdK.js → html-dom-DvJmuHt2.js} +10 -10
  29. package/dist/html-dom-DvJmuHt2.js.map +1 -0
  30. package/dist/html.d.ts +3 -3
  31. package/dist/html.js +2 -2
  32. package/dist/{image-size-CvN2iCA4.js → image-size-DwDbakcl.js} +64 -5
  33. package/dist/image-size-DwDbakcl.js.map +1 -0
  34. package/dist/index.d.ts +7 -7
  35. package/dist/index.js +3 -3
  36. package/dist/inspect.d.ts +4 -4
  37. package/dist/inspect.js +4 -4
  38. package/dist/inspect.js.map +1 -1
  39. package/dist/math.d.ts +1 -1
  40. package/dist/math.js +1 -1
  41. package/dist/measure.d.ts +3 -3
  42. package/dist/measure.js +2 -2
  43. package/dist/node.d.ts +7 -7
  44. package/dist/node.js +3 -3
  45. package/dist/{notes-Dh12JAbn.js → notes-BcT571R4.js} +19 -18
  46. package/dist/notes-BcT571R4.js.map +1 -0
  47. package/dist/options-internal-WqgMf720.js.map +1 -1
  48. package/dist/{package-J49Ck6S2.d.ts → package-KoEgVwII.d.ts} +6 -2
  49. package/dist/{package-J49Ck6S2.d.ts.map → package-KoEgVwII.d.ts.map} +1 -1
  50. package/dist/{pres-C6qgOFAa.d.ts → pres-BA9_lJbY.d.ts} +32 -12
  51. package/dist/pres-BA9_lJbY.d.ts.map +1 -0
  52. package/dist/{presentation-DGYlAWhl.js → presentation-Cyl74rq2.js} +70 -35
  53. package/dist/presentation-Cyl74rq2.js.map +1 -0
  54. package/dist/{presentation-types-8jLQHI4M.d.ts → presentation-types-B3VQH4Bz.d.ts} +19 -15
  55. package/dist/presentation-types-B3VQH4Bz.d.ts.map +1 -0
  56. package/dist/read.d.ts +6 -6
  57. package/dist/read.js +3 -3
  58. package/dist/script.d.ts +2 -2
  59. package/dist/script.d.ts.map +1 -1
  60. package/dist/script.js +11 -11
  61. package/dist/script.js.map +1 -1
  62. package/dist/{shapes-re0KyQk_.js → shapes-BcyFdZpp.js} +14 -10
  63. package/dist/shapes-BcyFdZpp.js.map +1 -0
  64. package/dist/{slide-Dx2ZeVZ6.d.ts → slide-BqPtyKmb.d.ts} +12 -7
  65. package/dist/slide-BqPtyKmb.d.ts.map +1 -0
  66. package/dist/{table-cell-margins-EVg0EwxT.js → table-cell-margins-PDshga8T.js} +4 -4
  67. package/dist/{table-cell-margins-EVg0EwxT.js.map → table-cell-margins-PDshga8T.js.map} +1 -1
  68. package/dist/{table-dom-BTDP3lEP.js → table-dom-CVbvUfgh.js} +3 -3
  69. package/dist/{table-dom-BTDP3lEP.js.map → table-dom-CVbvUfgh.js.map} +1 -1
  70. package/dist/{text-KnLOtEEu.js → text-BvFFMMFQ.js} +38 -36
  71. package/dist/{text-KnLOtEEu.js.map → text-BvFFMMFQ.js.map} +1 -1
  72. package/dist/{text-anchor-CrYXAfUu.js → text-anchor-BgLPbwbL.js} +2 -2
  73. package/dist/{text-anchor-CrYXAfUu.js.map → text-anchor-BgLPbwbL.js.map} +1 -1
  74. package/dist/{units-internal-XJlf-hOl.js → units-internal-DFcUYjh3.js} +11 -6
  75. package/dist/units-internal-DFcUYjh3.js.map +1 -0
  76. package/dist/{zip-C0leZZMj.d.ts → zip-CTll_dr0.d.ts} +2 -2
  77. package/dist/{zip-C0leZZMj.d.ts.map → zip-CTll_dr0.d.ts.map} +1 -1
  78. package/dist/{zip-CKd8ihcf.js → zip-CYZ0F6BV.js} +2 -2
  79. package/dist/{zip-CKd8ihcf.js.map → zip-CYZ0F6BV.js.map} +1 -1
  80. package/dist/zip.d.ts +2 -2
  81. package/dist/zip.js +2 -2
  82. package/dist/{zoom-cX9sllpH.js → zoom-BoNyOlPm.js} +66 -52
  83. package/dist/zoom-BoNyOlPm.js.map +1 -0
  84. package/package.json +39 -31
  85. package/skills/ts-pptx-upstream/SKILL.md +18 -18
  86. package/dist/html-dom-Iuog2wdK.js.map +0 -1
  87. package/dist/image-size-CvN2iCA4.js.map +0 -1
  88. package/dist/notes-Dh12JAbn.js.map +0 -1
  89. package/dist/pres-C6qgOFAa.d.ts.map +0 -1
  90. package/dist/presentation-DGYlAWhl.js.map +0 -1
  91. package/dist/presentation-types-8jLQHI4M.d.ts.map +0 -1
  92. package/dist/shapes-re0KyQk_.js.map +0 -1
  93. package/dist/slide-Dx2ZeVZ6.d.ts.map +0 -1
  94. package/dist/units-internal-XJlf-hOl.js.map +0 -1
  95. package/dist/zoom-cX9sllpH.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"notes-Dh12JAbn.js","names":[],"sources":["../src/xml-escape.ts","../src/gen/utils.ts","../src/ooxml/xml-decl.ts","../src/embedded-fonts.ts","../src/gen/oxml/el.ts","../src/gen/drawingml/color.ts","../src/gen/drawingml/effect.ts","../src/gen/drawingml/src-rect.ts","../src/gen/drawingml/fill.ts","../src/gen/drawingml/line.ts","../src/gen/define/hyperlinks.ts","../src/gen/drawingml/bullet.ts","../src/gen/drawingml/clamp.ts","../src/gen/drawingml/math.ts","../src/gen/drawingml/text-run.ts","../src/gen/drawingml/geometry.ts","../src/gen/slide/objects/shared.ts","../src/gen/opc/part-paths.ts","../src/gen/opc/rels.ts","../src/gen/drawingml/list-style.ts","../src/gen/slide/notes.ts"],"sourcesContent":["/**\n * ts-pptx: turning a caller's string into something that can sit inside XML.\n *\n * Three escapers with three notions of what is dangerous used to live here-and-there — one under\n * `gen/`, one under `read/oxml/`, and a fourth-of-a-job local one in `embedded-fonts.ts` — and the\n * weakest was the one reached by the least-checked input. `serializeEmbeddedFontLst` puts\n * `font.typeface` straight from `pptx.embedFont({ typeface })` through an escaper that handled\n * `& < > \"` and nothing else, so `embedFont({ typeface: 'Foo\\v' })` wrote a vertical tab into\n * `<p:font typeface=\"…\">` — a character XML 1.0 forbids outright, and exactly what the write side\n * strips at every other emission site — and `'Foo\\nBar'` lost its newline to attribute-value\n * normalisation.\n *\n * The copies had a real reason: `embedded-fonts.ts` is imported by `read/api/ops/`, so it must not\n * pull in `src/gen/`, and `read/oxml/dom.ts` is on the same side of that line. The answer to\n * \"both halves need this\" is a dependency-free root module, the same placement and rationale as\n * `hex-color.ts` — not a third, weaker copy.\n *\n * This module imports nothing.\n */\n\n/**\n * Characters XML 1.0's `Char` production excludes that a string holds in one code unit, as a\n * character class: every C0 control except tab, line feed and carriage return, and the two\n * non-characters U+FFFE and U+FFFF. No document may carry one in any spelling, not even as a\n * character reference, and a part that does is one PowerPoint offers to repair.\n *\n * DEL (U+007F) is in the class too, although XML 1.0 allows it. Stripping it loses nothing a slide\n * could show, and it has always been stripped.\n *\n * Built from `String.fromCharCode` so `no-control-regex` cannot flag it statically, and built\n * ONCE: it was constructed inside the text escaper, which runs for every attribute value and\n * text child in the package, and again inside `validateObjectName` under a comment saying it was\n * the same set.\n */\nconst ILLEGAL_XML_CHARS_CLASS = ((cc: (n: number) => string) =>\n\t`[${cc(0)}-${cc(8)}${cc(11)}${cc(12)}${cc(14)}-${cc(31)}${cc(127)}${cc(0xfffe)}${cc(0xffff)}]`)(String.fromCharCode)\n\n/** The stripping form. Separate from {@link ILLEGAL_XML_CHARS} because a `g` regex is stateful under `.test`. */\nconst ILLEGAL_XML_CHARS_G = new RegExp(ILLEGAL_XML_CHARS_CLASS, 'g')\n\n/** The detecting form; see {@link ILLEGAL_XML_CHARS_G} for why the two are not one regex. */\nconst ILLEGAL_XML_CHARS = new RegExp(ILLEGAL_XML_CHARS_CLASS)\n\n/** Does `value` carry a character XML 1.0 forbids? The escapers strip them; `validateObjectName` reports them. */\nexport function hasIllegalXmlChars(value: string): boolean {\n\treturn ILLEGAL_XML_CHARS.test(value)\n}\n\n/**\n * Replace special XML characters with HTML-encoded strings.\n *\n * ELEMENT TEXT ONLY. A literal tab, carriage return or line feed is left alone here because in\n * character data it *is* the content (`<a:t>` line breaks depend on it). Inside an attribute value\n * the same three characters are destroyed by the parser rather than preserved — see\n * {@link encodeXmlAttrValue}, which every attribute-emitting path must use instead.\n * @param {string | number} xml - value to encode (numbers are stringified, as callers pass counts/sizes)\n * @returns {string} escaped XML\n */\nexport function encodeXmlEntities(xml: string | number): string {\n\t// NOTE: Dont use short-circuit eval here as value c/b \"0\" (zero) etc.!\n\tif (typeof xml === 'undefined' || xml == null) return ''\n\t// Strip XML 1.0 illegal control chars (e.g. \\v) before escaping to prevent PowerPoint repair dialogs.\n\treturn xml\n\t\t.toString()\n\t\t.replace(ILLEGAL_XML_CHARS_G, '')\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;')\n\t\t.replace(/'/g, '&apos;')\n}\n\n/**\n * Escape a value destined for an XML **attribute**.\n *\n * Everything {@link encodeXmlEntities} does, plus the three whitespace characters that survive in\n * element text but not in an attribute: XML 1.0 section 3.3.3 requires a parser to normalise a\n * literal tab, carriage return or line feed inside an attribute value to a single space *before any\n * consumer sees it*. Carrying one across therefore requires a character reference, so a caller's\n * `objectName: 'Abschnitts-\\nuberschrift'` reads back with its line break rather than a space.\n *\n * Deliberately a separate function rather than a widening of `encodeXmlEntities`: that helper also\n * escapes element text, where a raw newline is meaningful content emitted as-is, and escaping it\n * there would change bytes across every text-bearing part in the package.\n * @param {string | number} xml - value to encode (numbers are stringified, as callers pass ids/sizes)\n * @returns {string} escaped XML, safe to place between attribute quotes\n */\nexport function encodeXmlAttrValue(xml: string | number): string {\n\treturn encodeXmlEntities(xml).replace(/\\t/g, '&#9;').replace(/\\n/g, '&#10;').replace(/\\r/g, '&#13;')\n}\n","/**\n * ts-pptx: shared generator helpers.\n *\n * The small cross-cutting pieces the OOXML writers all need and that belong to\n * no single part:\n * - XML text encodeXmlEntities (re-exported from `xml-escape.ts`)\n * - Identifiers & naming getUuid, validateObjectName, getDuplicateObjectNames\n * - Slide relationships getNewRelId, isHyperlinkRel, nextMediaTarget, preencodedPath\n *\n * DrawingML fragment builders moved to `gen/drawingml/{color,effect,fill,line}.ts`;\n * unit conversion to `units-internal.ts` (over the public primitives in `units.ts`);\n * base64/image-header decoding and media content types to `media/`.\n */\n\nimport { warn } from '../diagnostics.js'\nimport { hasIllegalXmlChars } from '../xml-escape.js'\nimport type { PresSlideInternal } from '../types/internal.js'\n\n// The two escapers this module used to define now live in `src/xml-escape.ts`, so the read side\n// and `embedded-fonts.ts` -- neither of which may import `gen/` -- can use the same ones. Every\n// write-side caller still reaches them through here.\nexport { encodeXmlEntities, encodeXmlAttrValue } from '../xml-escape.js'\n\n/**\n * Fill the `x`/`y` placeholders of a hex pattern with random nibbles.\n *\n * **Not replaceable by `crypto.randomUUID()`**, which exists on Node 24 and in every\n * browser. This takes a *format string*, and half its callers pass a partial one:\n * `gen/chart/plot-scatter.ts` asks for a bare tail (`-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)\n * to splice onto a padded point index, and its other two calls want a GUID shape with\n * no version nibble. Only `gen/define/zoom.ts` and `presentation.ts`, which pass a\n * v4-shaped pattern, could switch, and switching only those would leave two generators\n * where there is now one. The analysis is recorded here so it does not get re-derived:\n * the swap is low value and non-zero risk, and it is not on the roadmap.\n * @link https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript#answer-2117523\n * @param {string} uuidFormat - the pattern; `x` becomes a random nibble, `y` one of 8/9/a/b\n * @returns {string} the filled pattern\n */\nexport function getUuid(uuidFormat: string): string {\n\treturn uuidFormat.replace(/[xy]/g, function (c) {\n\t\tconst r = (Math.random() * 16) | 0\n\t\tconst v = c === 'x' ? r : (r & 0x3) | 0x8\n\t\treturn v.toString(16)\n\t})\n}\n\n/**\n * A fresh v4 GUID in the braced, upper-case form OOXML attributes carry:\n * `{XXXXXXXX-XXXX-4XXX-YXXX-XXXXXXXXXXXX}`.\n *\n * That is the spelling `p14:section@id` and `zmPr@id` both want, and it was written out three\n * times -- once as `zoomGuid` in `gen/define/zoom.ts` and twice inline in `presentation.ts`.\n * Nothing forced the three to agree, so a fix to the pattern in one was a fix in one.\n */\nexport function bracedGuid(): string {\n\treturn `{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}`\n}\n\n/**\n * Practical maximum length for a `p:cNvPr` object name. PowerPoint does not\n * enforce a hard spec limit, but very long names are a strong signal of a bug\n * and are unwieldy in the Selection Pane.\n */\nconst MAX_OBJECT_NAME_LENGTH = 255\n\n/**\n * Validate a user-supplied object name and warn (does not throw) when the value\n * cannot be preserved as a stable PowerPoint Selection Pane identity. This keeps\n * semantic-identity bugs visible at generation time without breaking existing\n * decks that pass loose names.\n * - Empty/whitespace-only names provide no usable identity.\n * - Control characters are stripped by `encodeXmlEntities` when the name is\n * written, so the file carries a different name than the one supplied.\n * - Excessively long names may not round-trip through PowerPoint/consumers.\n * @param {string} name - the raw (pre-encoding) object name\n * @param {string} kind - object kind for the warning message (e.g. 'text')\n * @returns {string} the name unchanged (validation only)\n */\nexport function validateObjectName(name: string, kind: string): string {\n\tif (typeof name !== 'string') return name\n\tif (name.trim().length === 0) {\n\t\twarn(\n\t\t\t'object-name/empty',\n\t\t\t`${kind} objectName is empty or whitespace-only; it will not provide a stable Selection Pane identity.`\n\t\t)\n\t\treturn name\n\t}\n\t// Same set `encodeXmlEntities` strips; detect so the caller knows the name will change.\n\tif (hasIllegalXmlChars(name)) {\n\t\twarn(\n\t\t\t'object-name/control-characters',\n\t\t\t`${kind} objectName \"${name}\" contains characters XML 1.0 forbids (control characters, or U+FFFE or U+FFFF) that will be stripped from the name written to the file.`\n\t\t)\n\t}\n\tif (name.length > MAX_OBJECT_NAME_LENGTH) {\n\t\twarn(\n\t\t\t'object-name/too-long',\n\t\t\t`${kind} objectName exceeds ${MAX_OBJECT_NAME_LENGTH} characters and may not be preserved by PowerPoint.`\n\t\t)\n\t}\n\treturn name\n}\n\n/**\n * Return object names that appear more than once in the given list. Used to warn\n * when duplicate Selection Pane identities would be emitted on a single slide,\n * which breaks consumers (e.g. semantic manifests) that rely on unique names.\n * @param {string[]} names - object names emitted on one slide\n * @returns {string[]} the duplicated names (each listed once)\n */\nexport function getDuplicateObjectNames(names: string[]): string[] {\n\tconst seen = new Set<string>()\n\tconst dupes = new Set<string>()\n\tnames.forEach((name) => {\n\t\tif (typeof name !== 'string' || name.length === 0) return\n\t\tif (seen.has(name)) dupes.add(name)\n\t\telse seen.add(name)\n\t})\n\treturn Array.from(dupes)\n}\n\n/**\n * Get a new rel ID (rId) for charts, media, etc.\n *\n * Counting is the normal case: a slide's rels are minted in order, so one past the\n * total is free. It is not enough on its own, because a rel can arrive on a slide\n * carrying an id minted somewhere else — auto-paging re-registers a repeated header\n * row's hyperlink on each overflow slide under the id stamped on the shared\n * hyperlink object (`gen/define/hyperlinks.ts`). That id is then held but not\n * counted-to, so the next mint could hand out the same number and the part would\n * declare two `Relationship` elements sharing an `Id` — invalid OPC, and PowerPoint\n * resolves such a reference to whichever comes first. Hence the scan: start where\n * the count says, then step over anything the slide already holds.\n * @param {PresSlideInternal} target - the slide to use\n * @returns {number} the lowest free rId at or above the current rel count plus 1\n */\nexport function getNewRelId(target: PresSlideInternal): number {\n\tconst held = heldRelIds(target)\n\tlet rId = target._rels.length + target._relsChart.length + target._relsMedia.length + 1\n\twhile (held.has(rId)) rId++\n\treturn rId\n}\n\n/**\n * Every rel id a slide already holds, across its hyperlink, chart and media rels.\n * @param {PresSlideInternal} target - the slide to use\n * @returns {Set<number>} the held ids\n */\nexport function heldRelIds(target: PresSlideInternal): Set<number> {\n\tconst held = new Set<number>()\n\ttarget._rels.forEach((rel) => held.add(rel.rId))\n\ttarget._relsChart.forEach((rel) => held.add(rel.rId))\n\ttarget._relsMedia.forEach((rel) => held.add(rel.rId))\n\treturn held\n}\n\n/**\n * Whether a slide relationship is a hyperlink (external URL or internal slide\n * link). The relationship `type` is stringly-typed (`'hyperlink'`, `'online'`,\n * mixed-case variants), so this centralizes the case-insensitive predicate that\n * was duplicated across the slide-rels writer (`gen/slide/slide.ts`) and the inspect path\n * (presentation.ts). For an internal slide-to-slide link, `rel.data === 'slide'` and\n * `rel.Target` is the 1-based target slide number.\n * @param {{ type: string }} rel - a slide relationship\n * @returns {boolean} true if the rel is any kind of hyperlink\n */\nexport function isHyperlinkRel(rel: { type: string }): boolean {\n\treturn rel.type.toLowerCase().includes('hyperlink')\n}\n\n/**\n * The slide-scoped segment of a media part's name.\n *\n * Media targets are namespaced by the slide that registered them so that slide\n * master (`sm`) and slide layout (`sl-N`) media never collide with regular slide\n * media names in large decks. A layout is identified by the `_slideNum >= 1000`\n * convention the layout builder stamps on it; a master has no `_slideNum` at all.\n * @param {PresSlideInternal} target - the slide, layout or master registering the media\n * @returns {string} the key to splice into the media part name\n */\nfunction mediaSlideKey(target: PresSlideInternal): string {\n\tif (target._slideNum == null) return 'sm'\n\treturn target._slideNum >= 1000 ? `sl-${target._slideNum}` : `${target._slideNum}`\n}\n\n/**\n * The target of the media part the NEXT push onto `target._relsMedia` will create:\n * `../media/image-3-2.png`, or `../embeddings/oleObject-sm-1.xlsx` for a `dir` of\n * `embeddings`.\n *\n * The trailing number counts a target's media parts from one, and it is read *before* the\n * push that consumes the name — so this must be called in the object literal being pushed,\n * not hoisted above an earlier push, which would rename every part after it. Eight sites\n * spelled the rule out by hand with `_relsMedia.length + 1` inline; naming it is what lets\n * the off-by-one convention be stated once and read.\n *\n * @param target - the slide, layout or master registering the media\n * @param kind - the name's leading segment: `image`, `media`, `model3d`, `audio`, `oleObject`\n * @param extn - the part's file extension, without the dot\n * @param dir - which sibling directory the part lands in\n */\nexport function nextMediaTarget(\n\ttarget: PresSlideInternal,\n\tkind: string,\n\textn: string,\n\tdir: 'media' | 'embeddings' = 'media'\n): string {\n\treturn `../${dir}/${kind}-${mediaSlideKey(target)}-${target._relsMedia.length + 1}.${extn}`\n}\n\n/**\n * The `path` a media rel carries when its bytes came inline as `data` and there is no file to\n * name — `preencoded.png`, `preencoded.mp4`. Nothing loads it: the media pass tells it apart\n * with {@link isPreencodedPath}.\n *\n * The spelling still reaches a deck. An image object with no alt text falls back to its path for\n * the shape's description, so an inline image is described as `preencoded.png`, and changing\n * this changes those bytes.\n *\n * There were four spellings of it, one with no dot, and two SVG registrations that put the\n * base64 payload itself in `path`. They worked only because the media pass skipped any path\n * *containing* the word.\n * @param extn - the part's file extension, without the dot\n */\nexport function preencodedPath(extn: string): string {\n\treturn `preencoded.${extn}`\n}\n\n/** Whether `path` is a {@link preencodedPath} placeholder rather than a file or URL to load. */\nexport function isPreencodedPath(path: string): boolean {\n\treturn path.startsWith('preencoded.')\n}\n","/**\n * The XML prolog every OOXML part this library writes begins with, including the parts the read\n * side regenerates when it serializes a package it has changed.\n *\n * It lived with the generator-only constants, out of the read side's reach, so the read side's\n * serializers spelled it out again four times. A prolog that differs between two parts by one\n * attribute is not something any check reports, which is why it has one home that both sides can\n * import: this module imports nothing, and no `ooxml/` module imports from `gen/` or `read/`.\n */\nexport const XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n","/**\n * Shared model + serializer for PresentationML embedded fonts, used by both the\n * write side (author-side `pptx.embedFont`, `gen/pres/presentation.ts`) and the read side\n * (the `embedFonts` carry in `importSlide`, `importSlides`, `importSlideMasters` and\n * `appendSlides`, `src/read/api/ops/embedded-fonts.ts`).\n *\n * Embedded fonts are three coordinated pieces (ECMA-376 transitional):\n * 1. binary font parts `/ppt/fonts/fontN.fntdata` — the **raw** TTF/OTF bytes\n * (PresentationML does not obfuscate embedded fonts), content type\n * `application/x-fontdata` via a single `fntdata` Default extension;\n * 2. one `font` relationship per face from `presentation.xml`;\n * 3. a `p:embeddedFontLst` in `presentation.xml`, at index 7 of the\n * `CT_Presentation` child sequence (after `smartTags`, before `custShowLst`\n * … `defaultTextStyle`).\n *\n * This module owns only the OOXML-shape knowledge; rId allocation and part\n * placement stay with each caller (their packaging models differ).\n *\n * It must not import from `src/gen/`, because `read/api/ops/embedded-fonts.ts` imports it. What\n * it needs from elsewhere -- the attribute escaper, the `font` relationship type and the face slot\n * list -- comes from modules that import nothing outside `src/ooxml/` themselves.\n */\n\nimport { encodeXmlAttrValue } from './xml-escape.js'\nimport { FONT_REL } from './ooxml/rel-types.js'\nimport { EMBEDDED_FONT_SLOTS } from './ooxml/st-enums.js'\n\n/** Extension for the binary font parts (`/ppt/fonts/fontN.fntdata`). */\nexport const FONT_DATA_EXTENSION = 'fntdata'\n/** Content type for a `.fntdata` part — one `Default` covers every font part. */\nexport const FONT_DATA_CONTENT_TYPE = 'application/x-fontdata'\n/** Relationship type from `presentation.xml` to a font part (one per face). */\nexport const FONT_REL_TYPE = FONT_REL\n\n/**\n * The four face slots of `CT_EmbeddedFontListEntry`, in schema child order. Declared in\n * `ooxml/st-enums.ts` with the other schema lists, where `ooxml/sequence.ts` can derive from it\n * without importing this module.\n */\nexport { EMBEDDED_FONT_SLOTS }\n\nexport type EmbeddedFontSlot = (typeof EMBEDDED_FONT_SLOTS)[number]\n\n/** One embeddable face: a slot plus the raw font bytes (absent in pure read-side merges). */\nexport interface EmbeddedFontFace {\n\tslot: EmbeddedFontSlot\n\tbytes?: Uint8Array\n}\n\n/** A typeface family with 1..4 embedded faces — one `p:embeddedFont` entry. */\nexport interface EmbeddedFont {\n\t/** `p:font/@typeface` — MUST match the family name used in run/`fontFace` typefaces or PowerPoint won't bind it. */\n\ttypeface: string\n\tpanose?: string\n\tpitchFamily?: number\n\tcharset?: number\n\tfaces: EmbeddedFontFace[]\n}\n\n/**\n * One face flattened to its package coordinates. `partIndex` is 1-based and maps\n * to `/ppt/fonts/font${partIndex}.fntdata`; `rId` is the numeric relationship id\n * (use `rId${rId}`). Produced once and shared by the part writer, the rels\n * writer, and the `embeddedFontLst` emitter so all three agree.\n */\nexport interface FlatEmbeddedFace {\n\tfontIndex: number\n\tslot: EmbeddedFontSlot\n\tbytes: Uint8Array\n\tpartIndex: number\n\trId: number\n}\n\n/**\n * Flatten `fonts` into one ordered face list, assigning sequential part indices\n * (1-based) and relationship ids (starting at `firstRId`). Faces are emitted in\n * `fonts` order, each font's faces in {@link EMBEDDED_FONT_SLOTS} order. Faces\n * without `bytes` are skipped (nothing to write).\n */\nexport function flattenEmbeddedFaces(fonts: EmbeddedFont[], firstRId: number): FlatEmbeddedFace[] {\n\tconst flat: FlatEmbeddedFace[] = []\n\tlet partIndex = 0\n\tlet rId = firstRId\n\tfonts.forEach((font, fontIndex) => {\n\t\tfor (const slot of EMBEDDED_FONT_SLOTS) {\n\t\t\tconst face = font.faces.find((f) => f.slot === slot)\n\t\t\tif (!face || !face.bytes) continue\n\t\t\tflat.push({ fontIndex, slot, bytes: face.bytes, partIndex: ++partIndex, rId: rId++ })\n\t\t}\n\t})\n\treturn flat\n}\n\n/**\n * Serialize a `<p:embeddedFontLst>` from `fonts` and a `(fontIndex, slot) → rId`\n * lookup (typically backed by {@link flattenEmbeddedFaces}). Returns `''` when no\n * font has any face with an allocated rId, so callers can emit nothing. Assumes\n * the enclosing document declares the `p:` and `r:` prefixes (presentation.xml\n * does), so no namespace declarations are emitted here.\n */\nexport function serializeEmbeddedFontLst(\n\tfonts: EmbeddedFont[],\n\trIdForFace: (fontIndex: number, slot: EmbeddedFontSlot) => number | undefined\n): string {\n\tconst entries: string[] = []\n\tfonts.forEach((font, fontIndex) => {\n\t\tconst faceXml: string[] = []\n\t\tfor (const slot of EMBEDDED_FONT_SLOTS) {\n\t\t\tconst rId = rIdForFace(fontIndex, slot)\n\t\t\tif (rId === undefined) continue\n\t\t\tfaceXml.push(`<p:${slot} r:id=\"rId${rId}\"/>`)\n\t\t}\n\t\tif (faceXml.length === 0) return\n\t\tlet fontAttrs = `typeface=\"${encodeXmlAttrValue(font.typeface)}\"`\n\t\tif (font.panose !== undefined) fontAttrs += ` panose=\"${encodeXmlAttrValue(font.panose)}\"`\n\t\tif (font.pitchFamily !== undefined) fontAttrs += ` pitchFamily=\"${font.pitchFamily}\"`\n\t\tif (font.charset !== undefined) fontAttrs += ` charset=\"${font.charset}\"`\n\t\tentries.push(`<p:embeddedFont><p:font ${fontAttrs}/>${faceXml.join('')}</p:embeddedFont>`)\n\t})\n\tif (entries.length === 0) return ''\n\treturn `<p:embeddedFontLst>${entries.join('')}</p:embeddedFontLst>`\n}\n","/**\n * ts-pptx: XML element builder (write-side substrate)\n *\n * The write path historically concatenated template strings and called\n * `encodeXmlEntities` by hand at every interpolation — the source of escaping,\n * attribute-order and child-sequence bugs. This builder centralizes escaping\n * while reproducing today's exact byte layout, so a migration onto it can be\n * gated on strict byte-identity (`pnpm run byte-identity:check`) rather than on\n * looser schema equivalence.\n *\n * Mirrors `src/read/oxml/dom.ts` on the write side.\n *\n * Two rules make byte-identity achievable:\n *\n * 1. Self-closing is decided by ARITY, never by child value. `el()` always emits\n * a paired tag; `voidEl()` always self-closes. This matters because\n * `encodeXmlEntities(undefined)` returns `''`, so a value-based rule would\n * turn today's `<dc:title></dc:title>` into `<dc:title/>` — a silent byte\n * regression on every optional-text element in the tree.\n *\n * Escaping is split to match: attribute values go through `encodeXmlAttrValue`\n * (which adds the `&#9;`/`&#10;`/`&#13;` character references an XML parser\n * would otherwise normalise to a space), text children through\n * `encodeXmlEntities`, where those same characters are content.\n *\n * 2. Whitespace is explicit, per element, via `fmt`. Most emitted parts are flat\n * (no `fmt` needed at all); the pretty-printed ones carry indentation that is\n * not always depth-regular, so it is described rather than derived. Quirks\n * like a misindented closing tag stay visible in the call site instead of\n * being hidden inside a template literal.\n */\n\nimport { encodeXmlAttrValue, encodeXmlEntities } from '../utils.js'\n\n/** Pre-serialized XML, interpolated verbatim (not escaped). */\nexport interface RawXml {\n\traw: string\n}\n\n/** A text child (escaped) or pre-serialized markup (verbatim). */\nexport type XmlChild = string | number | RawXml | null | undefined\n\n/** Attribute values; `undefined`/`null` omit the attribute entirely. */\nexport type XmlAttrs = Record<string, string | number | null | undefined>\n\n/**\n * Byte-layout control. Omit for flat output.\n * - `openPrefix` — emitted before `<name`\n * - `childPrefix` — emitted before each child\n * - `closePrefix` — emitted before the closing delimiter (`</name>`, or `/>` for `voidEl`)\n */\nexport interface XmlFmt {\n\topenPrefix?: string\n\tchildPrefix?: string\n\tclosePrefix?: string\n}\n\n/** Wrap already-serialized XML so it is interpolated verbatim. */\nexport function raw(xml: string): RawXml {\n\treturn { raw: xml }\n}\n\nfunction isRaw(child: XmlChild): child is RawXml {\n\treturn typeof child === 'object' && child !== null && typeof child.raw === 'string'\n}\n\nfunction openTag(name: string, attrs: XmlAttrs | null | undefined, fmt: XmlFmt | undefined): string {\n\tlet out = (fmt?.openPrefix ?? '') + '<' + name\n\tfor (const [key, value] of Object.entries(attrs ?? {})) {\n\t\tif (value === undefined || value === null) continue\n\t\tout += ' ' + key + '=\"' + encodeXmlAttrValue(value) + '\"'\n\t}\n\treturn out\n}\n\n/**\n * Paired element: `<name …>children</name>` — emitted even when `children` is\n * empty or `undefined`. Text children are escaped; `raw()` children are not.\n */\nexport function el(name: string, attrs?: XmlAttrs | null, children?: XmlChild | XmlChild[], fmt?: XmlFmt): string {\n\tlet out = openTag(name, attrs, fmt) + '>'\n\tconst childPrefix = fmt?.childPrefix ?? ''\n\tfor (const child of Array.isArray(children) ? children : [children]) {\n\t\tif (child === undefined || child === null) continue\n\t\tout += childPrefix + (isRaw(child) ? child.raw : encodeXmlEntities(child))\n\t}\n\treturn out + (fmt?.closePrefix ?? '') + '</' + name + '>'\n}\n\n/**\n * Self-closing element: `<name …/>`. `fmt.closePrefix` goes before the `/>` — a\n * handful of emitters write `<a:avLst />` with a space there, and that space is\n * byte-significant like any other.\n */\nexport function voidEl(name: string, attrs?: XmlAttrs | null, fmt?: XmlFmt): string {\n\treturn openTag(name, attrs, fmt) + (fmt?.closePrefix ?? '') + '/>'\n}\n\n/**\n * Paired around `childXml` when it holds anything, self-closing when it does not.\n *\n * The one place arity follows content, and on purpose: a lock set, a binding list or an effect\n * that may be empty makes its element paired or self-closing, and PowerPoint writes it that way.\n * Rule 1 above still holds everywhere else. Each caller used to spell the choice as its own\n * `x ? el(n, a, raw(x)) : voidEl(n, a)`.\n * @param childXml - already-serialized children; empty or absent means self-closing\n */\nexport function elOrVoid(\n\tname: string,\n\tattrs: XmlAttrs | null | undefined,\n\tchildXml: string | null | undefined,\n\tfmt?: XmlFmt\n): string {\n\treturn childXml ? el(name, attrs, raw(childXml), fmt) : voidEl(name, attrs, fmt)\n}\n","/**\n * ts-pptx: DrawingML color elements\n *\n * Emit the bare `<a:srgbClr>` / `<a:schemeClr>` color element that every other\n * color context builds on (solid fills, gradient stops, effect alphas, line\n * fills, highlights, patterns).\n *\n * The RGB->hex helpers this module used to carry now live in\n * `gen/table/html-dom.ts`, their only caller: they are reachable exclusively from\n * the browser-only `tableToSlides` path, so keeping them here made them permanent\n * dead weight in the Node chunk's coverage report (33% functions on a file that is\n * otherwise fully exercised) while html-dom.ts is coverage-excluded wholesale.\n */\n\nimport { SchemeColor, type SCHEME_COLORS } from '../../enums.js'\nimport { DEF_FONT_COLOR } from '../../constants-internal.js'\nimport { isHexColor, splitRgbaHex, stripHash } from '../../hex-color.js'\nimport { warn, warnOnce } from '../../diagnostics.js'\nimport { PERCENT_SCALE } from '../../units.js'\nimport { elOrVoid, voidEl } from '../oxml/el.js'\n\n/**\n * Opening delimiter of an `<a:alpha>` child, for detecting one a caller already\n * supplied. A prefix rather than a whole element: the value is the caller's, and\n * this asks only whether the element is present.\n */\nconst ALPHA_TAG = '<a:alpha'\n\n/**\n * Emit a bare DrawingML color element — either `<a:schemeClr>` (scheme color) or `<a:srgbClr>`\n * (hex RGB). This is a low-level primitive: it is the shared building block for every color\n * context (solid fills, gradient stops, `<a:alpha>` on shadows/glow, line fills, highlight,\n * underline, patterns, …), so it is intentionally NOT limited to solid fills and cannot be\n * folded into `genXmlColorSelection`.\n *\n * When you specifically want a *solid fill*, prefer `genXmlColorSelection` (`fill.ts`), which\n * wraps this in `<a:solidFill>…</a:solidFill>` and also handles `alpha`/`transparency` and the\n * gradient/pattern/image fill types — reach for `createColorElement` directly only when you\n * need the raw color element (e.g. inside `<a:ln>`, `<a:gs>`, an effect, or a highlight).\n * @param {string|SCHEME_COLORS} colorStr - hex RGB (e.g. \"FFFF00\") or a scheme color constant (e.g. SchemeColor.ACCENT1)\n * @param {string} [innerElements] - additional elements that adjust the color, nested inside the color element\n * @returns {string} XML string\n */\nexport function createColorElement(colorStr: string | SCHEME_COLORS, innerElements?: string): string {\n\tif (typeof colorStr !== 'string') {\n\t\twarn(\n\t\t\t'color/not-a-string',\n\t\t\t`createColorElement: expected a string color value, got ${typeof colorStr}. \"${DEF_FONT_COLOR}\" used instead.`\n\t\t)\n\t\tcolorStr = DEF_FONT_COLOR\n\t}\n\t// An empty string reaches here only from a slot that *requires* a colour — a gradient\n\t// stop, a duotone half. There is no \"inherit\" state to fall back to, so this\n\t// is the one place `''` still paints: it is reported under its own code, with a message\n\t// that names the real problem rather than `\"\" is not a valid scheme color`.\n\tif (colorStr === '') {\n\t\twarnOnce(\n\t\t\t'color/empty-string',\n\t\t\t`An empty string is not a color. \"${DEF_FONT_COLOR}\" used instead: this position requires one, so there is nothing to inherit. Omit the whole option if you meant to paint nothing.`\n\t\t)\n\t\tcolorStr = DEF_FONT_COLOR\n\t}\n\tlet colorVal = stripHash(colorStr || '')\n\n\t// 8-char hex (RGBA) — strip the alpha byte to a sibling <a:alpha val=\"N\"/>,\n\t// continue with the leading 6-char RGB through the existing validation. This keeps\n\t// fill/text/line/glow paths from silently falling back to DEF_FONT_COLOR on RGBA input.\n\tconst rgba = splitRgbaHex(colorVal)\n\tif (rgba.alpha !== undefined) {\n\t\t// If the caller already supplied an explicit <a:alpha> (e.g. shadow/glow `opacity`),\n\t\t// it wins — do NOT add a second alpha from the RGBA byte, which would emit two\n\t\t// <a:alpha> children and produce schema-invalid OOXML (CT_SRgbColor allows one).\n\t\tif (!innerElements?.includes(ALPHA_TAG))\n\t\t\tinnerElements = alphaEl(Math.round(rgba.alpha * PERCENT_SCALE)) + (innerElements || '')\n\t\tcolorVal = rgba.rgb\n\t}\n\n\tif (!isColorValue(colorVal)) {\n\t\twarn(\n\t\t\t'color/invalid-value',\n\t\t\t`\"${colorVal}\" is not a valid scheme color or hex RGB! \"${DEF_FONT_COLOR}\" used instead. Only provide 6-digit RGB or 'SchemeColor' values!`\n\t\t)\n\t\tcolorVal = DEF_FONT_COLOR\n\t}\n\n\tconst isHex = isHexColor(colorVal)\n\tconst name = isHex ? 'a:srgbClr' : 'a:schemeClr'\n\tconst attrs = { val: isHex ? colorVal.toUpperCase() : colorVal }\n\n\t// Paired vs self-closing is decided by whether there is anything to nest.\n\treturn elOrVoid(name, attrs, innerElements)\n}\n\n/**\n * Whether {@link createColorElement} paints `value` as given rather than replacing it: 6-digit or\n * 8-digit (RGBA) hex, with or without a leading `#`, or a {@link SchemeColor} name.\n *\n * A normalizer that wants to fall back to its own default instead of the emitter's black asks\n * this, so the two cannot disagree about what a colour is.\n * @param value - a colour option's value, whatever the caller passed\n */\nexport function isColorValue(value: unknown): boolean {\n\tif (typeof value !== 'string') return false\n\tconst { rgb } = splitRgbaHex(value)\n\treturn isHexColor(rgb) || Object.values(SchemeColor).includes(rgb as SchemeColor)\n}\n\n/**\n * Reject an empty colour string, reporting it once per option that named one.\n *\n * `''` is not a spelling of \"no paint\": omission already spells that, and `'inherit'` and\n * `'none'` spell the other two states a paint can be in. It reaches the library from the\n * caller's own missing value — an unset template field, `row.accent` on a row that has none\n * — so the useful answer is to say so and then behave exactly as omitting the option would\n * have. What it must not do is coerce to {@link DEF_FONT_COLOR}, which paints visible black\n * on a shape the caller expected to keep the theme's paint.\n *\n * Every site that consumes a caller-supplied colour calls this *before* its own fallback, so\n * the diagnostic names the option that carried the empty string rather than whichever\n * emitter happened to see it last. {@link createColorElement} is the exception and reports\n * the same code itself: its slot has no absent state to fall back to.\n * @param value - a colour option's value, whatever shape the option accepts\n * @param option - the option's name, for the message\n * @returns true when `value` was the empty string\n */\nexport function rejectEmptyColor(value: unknown, option: string): boolean {\n\tif (value !== '') return false\n\twarnOnce(\n\t\t'color/empty-string',\n\t\t`\\`${option}\\` is an empty string, which is not a color — the option was ignored, exactly as omitting it would be. Pass 6-digit hex RGB (e.g. \"FF3399\") or a SchemeColor value.`\n\t)\n\treturn true\n}\n\n/**\n * The colour the caller named for `option`, or `fallback` when they named none.\n *\n * The `x ?? DEFAULT` and `x || DEFAULT` this replaces disagreed about `''`: the first passed\n * it through to be painted black or dropped, the second quietly resolved it to the default.\n * Here it is one rule — an empty string is a missing value, reported and then resolved the\n * way an absent option is.\n * @param value - the caller's colour option, possibly absent or empty\n * @param fallback - what an absent option resolves to at this site\n * @param option - the option's name, for the message\n */\nexport function namedColorOr<T>(value: string | undefined, fallback: T, option: string): string | T {\n\tif (value === undefined || rejectEmptyColor(value, option)) return fallback\n\treturn value\n}\n\n/**\n * The `<a:alpha val>` child a colour element carries.\n *\n * Four sites built it: the RGBA split above, the gradient stop's `transparency`, the glow and\n * shadow `opacity`, and the chart's `chartColorsOpacity`. Each converts to the fixed\n * percentage its own option speaks first; this is only the element.\n * @param fixedPct - the alpha in `ST_PositiveFixedPercentage` units (`100%` is `100000`)\n */\nexport function alphaEl(fixedPct: number): string {\n\treturn voidEl('a:alpha', { val: fixedPct })\n}\n","/**\n * ts-pptx: DrawingML effects (glow and shadow)\n *\n * Emit the `<a:glow>` / `<a:outerShdw>` / `<a:innerShdw>` children of an\n * `<a:effectLst>`, and normalize the user-facing `shadow` options into the\n * internal shape every emit site reads.\n * @see http://officeopenxml.com/drwSp-effects.php\n */\n\nimport { DEF_FONT_COLOR } from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport type { ShadowProps, TextGlowProps } from '../../types/index.js'\nimport type { ShadowPropsInternal } from '../../types/internal.js'\nimport { PERCENT_SCALE } from '../../units.js'\nimport { clampRangedInput, convertAngleUnits, opacityToAlpha, positiveCoordinateEmu } from '../../units-internal.js'\nimport { splitRgbaHex, stripHash } from '../../hex-color.js'\nimport { alphaEl, createColorElement, namedColorOr } from './color.js'\nimport { el, elOrVoid, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { xsdBool } from '../../ooxml/xsd-boolean.js'\n\n/**\n * Creates `a:glow` element\n * @param {TextGlowProps} options glow properties\n * @param {TextGlowProps} defaults defaults for unspecified properties in `opts`\n * @see http://officeopenxml.com/drwSp-effects.php\n * { size: 8, color: 'FFFFFF', opacity: 0.75 };\n */\nexport function createGlowElement(options: TextGlowProps, defaults: TextGlowProps): string {\n\tconst opts = { ...defaults, ...options }\n\t// `a:glow/@rad` is `ST_PositiveCoordinate`, exactly like the shadow's `blurRad` and `dist`\n\t// below, so it takes the same converter. A bare multiply put `size: -5` in the package as\n\t// `rad=\"-63500\"` and `size: NaN` as `rad=\"NaN\"`, while the structurally identical shadow\n\t// measure two functions down was clamped and reported -- the asymmetry was inside this one\n\t// function, with the opacity beside it already guarded.\n\tconst size = positiveCoordinateEmu(opts.size, 'glow/size-out-of-range', 'glow.size')\n\tconst color = namedColorOr(opts.color, DEF_FONT_COLOR, 'glow.color')\n\tconst opacity = opacityToAlpha(opts.opacity ?? 0)\n\n\treturn el('a:glow', { rad: size }, raw(createColorElement(color, alphaEl(opacity))))\n}\n\n/**\n * Creates an `a:outerShdw`/`a:innerShdw` element for a text run, shape, image, or chart.\n * Returns the shadow element only (no wrapping `a:effectLst`) so callers can either combine\n * it with other effects (e.g. glow) inside one `a:effectLst`, or wrap a lone shadow via\n * {@link createShadowEffectLst}.\n *\n * Colors go through {@link createColorElement}, so scheme colors (e.g. `accent1`) are honored\n * — earlier per-site copies hardcoded `a:srgbClr` and silently emitted invalid OOXML for them.\n * @param {ShadowPropsInternal} options shadow properties\n * @param {ShadowPropsInternal} defaults defaults for unspecified properties in `options`\n * @see http://officeopenxml.com/drwSp-effects.php\n * @returns {string} XML string, or '' when type is 'none'\n */\nexport function createShadowElement(options: ShadowPropsInternal | undefined, defaults: ShadowPropsInternal): string {\n\tconst opts = { ...defaults, ...options }\n\tif (opts.type === 'none') return ''\n\n\t// NOTE: read into locals so we never mutate the caller's options (re-emission\n\t// would otherwise re-convert pt→EMU and produce absurd values).\n\tconst type = opts.type || 'outer'\n\tconst blur = positiveCoordinateEmu(opts.blur ?? 0, 'shadow/blur-out-of-range', 'shadow.blur')\n\tconst offset = positiveCoordinateEmu(opts.offset ?? 0, 'shadow/offset-out-of-range', 'shadow.offset')\n\tconst angle = convertAngleUnits(opts.angle ?? 0, 'shadow.angle')\n\tconst opacity = Math.round((opts._alpha ?? 0.75) * PERCENT_SCALE)\n\tconst color = namedColorOr(opts.color, DEF_FONT_COLOR, 'shadow.color')\n\n\t// sx/sy/kx/ky/algn/rotWithShape are valid only on `a:outerShdw` (CT_OuterShadowEffect);\n\t// `a:innerShdw` (CT_InnerShadowEffect) accepts only blurRad/dist/dir.\n\tconst outerAttrs: XmlAttrs =\n\t\ttype === 'outer'\n\t\t\t? { sx: 100000, sy: 100000, kx: 0, ky: 0, algn: 'bl', rotWithShape: xsdBool(opts.rotateWithShape) }\n\t\t\t: {}\n\tconst attrs = { ...outerAttrs, blurRad: blur, dist: offset, dir: angle }\n\n\treturn el(`a:${type}Shdw`, attrs, raw(createColorElement(color, alphaEl(opacity))))\n}\n\n/**\n * Wraps a lone shadow in the `a:effectLst` that CT_ShapeProperties (shapes/images) and chart\n * marker/data-point properties require. Returns a self-closing `<a:effectLst/>` when there is\n * no shadow (missing/non-object options, or `type: 'none'`), matching the \"no effects\" element\n * PowerPoint emits. Use this instead of {@link createShadowElement} when the shadow is the only\n * effect; use `createShadowElement` directly when combining with other effects (e.g. glow).\n * @param {ShadowPropsInternal} options shadow properties\n * @param {ShadowPropsInternal} defaults defaults for unspecified properties in `options`\n * @returns {string} `<a:effectLst>…</a:effectLst>` or `<a:effectLst/>`\n */\nexport function createShadowEffectLst(options: ShadowPropsInternal | undefined, defaults: ShadowPropsInternal): string {\n\tif (!options || typeof options !== 'object') return voidEl('a:effectLst')\n\tconst inner = createShadowElement(options, defaults)\n\treturn elOrVoid('a:effectLst', null, inner)\n}\n\n/**\n * Normalize a caller's `shadow` into the internal shape every emit site reads: a legal `type`, a\n * whole-degree `angle` inside `ST_PositiveFixedAngle`, a `_alpha` derived from `transparency` or\n * from an RGBA colour's alpha byte, and a colour with no `#` and no alpha byte.\n *\n * **Pure.** It used to normalize the caller's object *in place* and return it, and its four call\n * sites split on which of the two contracts they used — two assigned the result, two discarded it\n * and relied on the mutation. That made the obvious cleanup a trap: making it pure without\n * converting every caller silently drops `transparency` and RGBA alpha on every text run, because\n * `_alpha` is what `genXmlTextRunProperties` reads and nothing else writes it. The value now\n * reaches the emitter as a value rather than as a side effect, and a shadow literal shared across\n * two shapes comes back untouched.\n * @param shadow - the caller's shadow options\n * @returns a fresh normalized bag, or `undefined` when the caller stated no shadow object\n */\nexport function normalizeShadowOptions(shadow?: ShadowProps | null): ShadowPropsInternal | undefined {\n\tif (!shadow || typeof shadow !== 'object') {\n\t\t// warn(\"`shadow` options must be an object. Ex: `{shadow: {type:'none'}}`\")\n\t\treturn undefined\n\t}\n\tconst corrected: ShadowPropsInternal = { ...shadow }\n\t// No `opacity` scrub is needed: the derived alpha lives under the private `_alpha` name, so a\n\t// stray `opacity` from an untyped/legacy caller lands on a field nothing reads (inert) rather\n\t// than colliding with the internal value.\n\n\t// OPT: `type`\n\tif (corrected.type !== 'outer' && corrected.type !== 'inner' && corrected.type !== 'none') {\n\t\twarn('shadow/invalid-type', 'shadow.type options are `outer`, `inner` or `none`.')\n\t\tcorrected.type = 'outer'\n\t}\n\n\t// OPT: `angle` — clamped into ST_PositiveFixedAngle's 0-359 and rounded to whole degrees.\n\t// The absence check is `undefined`, not truthiness: `0` is a legal angle (a shadow cast to\n\t// the right), and under `if (corrected.angle)` a `NaN` fell through the guard entirely and\n\t// reached the emitter, which wrote `dir=\"NaN\"` into the package.\n\tif (corrected.angle !== undefined) {\n\t\tcorrected.angle = Math.round(\n\t\t\tclampRangedInput(corrected.angle, 0, 359, 'shadow/angle-out-of-range', 'shadow.angle', 'shadow/angle-non-finite')\n\t\t)\n\t}\n\n\t// OPT: `transparency` (PowerPoint UI term, 0-100) -> internal `_alpha` (0.0-1.0), which\n\t// every emit site reads.\n\tif (corrected.transparency !== undefined) {\n\t\tconst pct = clampRangedInput(\n\t\t\tcorrected.transparency,\n\t\t\t0,\n\t\t\t100,\n\t\t\t'shadow/transparency-out-of-range',\n\t\t\t'shadow.transparency'\n\t\t)\n\t\tcorrected._alpha = 1 - pct / 100\n\t}\n\n\t// OPT: `color`\n\tif (corrected.color) {\n\t\t// INCORRECT FORMAT\n\t\tif (corrected.color.startsWith('#')) {\n\t\t\twarn('shadow/color-has-hash', 'shadow.color should not include hash (#) character, , e.g. \"FF0000\"')\n\t\t\tcorrected.color = stripHash(corrected.color)\n\t\t}\n\n\t\t// 8-char hex (RGBA) — derive `_alpha` from the alpha byte (only when `transparency`\n\t\t// didn't already set one), then strip the alpha byte from the color so emit sites\n\t\t// produce valid 6-char `<a:srgbClr val=\"…\"/>`.\n\t\tconst rgba = splitRgbaHex(corrected.color)\n\t\tif (rgba.alpha !== undefined) {\n\t\t\tif (corrected._alpha === undefined) corrected._alpha = rgba.alpha\n\t\t\tcorrected.color = rgba.rgb\n\t\t}\n\t}\n\n\treturn corrected\n}\n","/**\n * ts-pptx: the explicit `<a:srcRect>` source crop\n *\n * A leaf module on purpose. A picture object (`addImage`) and a native picture fill\n * (`fill: { type: 'image' }`) crop a source image the same way, but they live on opposite\n * sides of a bundling boundary: `gen/drawingml/fill.ts` is reached from every shape, table\n * and chart emitter, while `gen/drawingml/image.ts` pulls the image-format sniffing tables\n * in behind it through `media/image-size.ts`. Sharing the crop from here rather than from\n * `image.ts` is what keeps ~24 kB of format headers out of the `read` and `inspect` entry\n * points, which never measure an image.\n */\n\nimport { FIXED_PCT_PER_PERCENT } from '../../units.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/** Percentage edge insets trimmed from the source image; an omitted edge is `0`. */\nexport type ImageCrop = { l?: number; t?: number; r?: number; b?: number }\n\n/**\n * The four insets, defaulted and checked. Rejects anything that is not a percentage and\n * any pair that would leave no source area at all — a degenerate `<a:srcRect>` renders as\n * an empty shape rather than as an error, so it has to fail here.\n * @param crop - edge insets in percent; omitted edges default to 0\n * @param label - the option's owner, as an error message names it (`addImage`, `image fill`)\n * @param where - trailing context for an error message, or `''`\n */\nfunction normalizeImageCrop(\n\tcrop: ImageCrop,\n\tlabel: string,\n\twhere: string\n): { l: number; t: number; r: number; b: number } {\n\tconst edges = { l: crop.l ?? 0, t: crop.t ?? 0, r: crop.r ?? 0, b: crop.b ?? 0 }\n\tfor (const [name, val] of Object.entries(edges)) {\n\t\tif (typeof val !== 'number' || !Number.isFinite(val) || val < 0 || val > 100) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'image/crop-inset-out-of-range',\n\t\t\t\t`${label} crop.${name} must be a percentage between 0 and 100 (got ${String(val)})${where}.`\n\t\t\t)\n\t\t}\n\t}\n\tif (edges.l + edges.r >= 100)\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/crop-insets-exceed-extent',\n\t\t\t`${label} crop: left+right insets (${edges.l}%+${edges.r}%) must be < 100%${where}.`\n\t\t)\n\tif (edges.t + edges.b >= 100)\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/crop-insets-exceed-extent',\n\t\t\t`${label} crop: top+bottom insets (${edges.t}%+${edges.b}%) must be < 100%${where}.`\n\t\t)\n\treturn edges\n}\n\n/**\n * Build an explicit `<a:srcRect>` crop from percentage edge insets (0–100), emitted verbatim.\n * Each inset is the percent of the *source* image trimmed from that edge; values serialize in\n * 1000ths of a percent (DrawingML `ST_Percentage`, where 100% = 100000). Unlike `sizing: 'crop'`\n * — which derives the rect from displayed inches and the natural pixel size — this maps a\n * sub-region of the source directly, so it works for SVG and other unmeasurable formats.\n * @param crop - edge insets in percent; omitted edges default to 0\n * @param label - the option's owner, as an error message names it\n * @param where - trailing context for an error message, or `''`\n * @returns the `<a:srcRect>` element on its own; the caller supplies the fill directive\n */\nexport function genXmlImageCropRect(crop: ImageCrop, label: string, where: string): string {\n\tconst edges = normalizeImageCrop(crop, label, where)\n\tconst v = (perc: number): number => Math.round(perc * FIXED_PCT_PER_PERCENT)\n\t// NOTE: attribute order here is l/t/r/b, where the sizing modes in `image.ts` emit l/r/t/b.\n\t// Attribute order is byte-significant, so the two orderings are kept as they are rather\n\t// than unified.\n\treturn voidEl('a:srcRect', { l: v(edges.l), t: v(edges.t), r: v(edges.r), b: v(edges.b) })\n}\n\n/**\n * `<a:stretch><a:fillRect/></a:stretch>` — the blipFill child that scales the source to the\n * shape's box, which every picture-bearing emitter writes and none parameterizes.\n *\n * After an `<a:srcRect/>`, it completes the canonical picture fill ECMA-376 gives\n * (§L.4.8.4.3). A picture's placement is split across two elements: the source rectangle and\n * this directive, which carry `sizing` and `crop`, sit in `p:blipFill`, while the clip\n * geometry (`shape`, `points`, `rounding`) sits in `p:spPr`.\n *\n * Here rather than in `image.ts` for the same bundling reason the crop is: `fill.ts` reaches\n * it from every shape, table and chart emitter, and must not pull the image-format tables in.\n */\nexport const STRETCH_FILL_RECT = el('a:stretch', null, raw(voidEl('a:fillRect')))\n","/**\n * ts-pptx: DrawingML fills\n *\n * Emit the fill group a shape, cell, chart element, or line paint can carry:\n * `<a:solidFill>`, `<a:gradFill>`, `<a:pattFill>`, `<a:blipFill>`.\n * {@link genXmlColorSelection} is the dispatch every caller should reach for;\n * the per-kind builders are exported for the few sites that know their fill kind.\n */\n\nimport { warn } from '../../diagnostics.js'\nimport type {\n\tColor,\n\tGradientFillProps,\n\tGradientStopProps,\n\tPatternFillProps,\n\tShapeFillProps,\n\tShapeLineProps,\n} from '../../types/index.js'\nimport type { ShapeFillPropsInternal } from '../../types/internal.js'\nimport { FIXED_PCT_PER_PERCENT } from '../../units.js'\nimport { clampRangedInput, convertRotationDegrees, mapStated, transparencyToAlpha } from '../../units-internal.js'\nimport { alphaEl, createColorElement, namedColorOr, rejectEmptyColor } from './color.js'\nimport { genXmlImageCropRect, STRETCH_FILL_RECT } from './src-rect.js'\nimport { InvalidOptionError, UnsupportedFeatureError } from '../../errors.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { xsdBool } from '../../ooxml/xsd-boolean.js'\n\nfunction normalizeGradientAngle(angle: number | undefined): number {\n\tconst degrees = angle ?? 0\n\tif (typeof degrees !== 'number' || !Number.isFinite(degrees))\n\t\tthrow new InvalidOptionError('gradient/angle-non-finite', 'Gradient angle must be a finite number.')\n\t// Into 0..360 rather than -360..360, which is where `convertRotationDegrees` leaves it:\n\t// `a:lin/@ang` is ST_PositiveFixedAngle (0..21600000), so a negative gradient angle is a\n\t// value PowerPoint reports as needing repair, not merely an unusual spelling.\n\treturn convertRotationDegrees(((degrees % 360) + 360) % 360)\n}\n\nfunction alphaFromTransparency(transparency: number | undefined): string {\n\treturn mapStated(transparency, (value) => alphaEl(transparencyToAlpha(value))) ?? ''\n}\n\nfunction normalizeGradientStops(stops: GradientStopProps[] | undefined): GradientStopProps[] {\n\tif (!Array.isArray(stops) || stops.length < 2)\n\t\tthrow new InvalidOptionError('gradient/too-few-stops', 'Gradient fill requires at least two stops.')\n\n\treturn stops\n\t\t.map((stop) => {\n\t\t\tif (!stop || typeof stop.position !== 'number' || !Number.isFinite(stop.position)) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'gradient/stop-position-non-finite',\n\t\t\t\t\t'Gradient stop position must be a finite number from 0 to 100.'\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (stop.position < 0 || stop.position > 100)\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'gradient/stop-position-out-of-range',\n\t\t\t\t\t'Gradient stop position must be from 0 to 100.'\n\t\t\t\t)\n\t\t\treturn stop\n\t\t})\n\t\t.sort((a, b) => a.position - b.position)\n}\n\n/**\n * Create a native DrawingML gradient fill.\n * @param {GradientFillProps} gradient gradient fill options\n * @returns XML string\n */\nexport function genXmlGradientFill(gradient: GradientFillProps | undefined): string {\n\tif (!gradient || (gradient.kind !== 'linear' && gradient.kind !== 'radial')) {\n\t\tthrow new UnsupportedFeatureError(\n\t\t\t'gradient/type-unsupported',\n\t\t\t'Gradient fill currently supports only linear and radial gradients.'\n\t\t)\n\t}\n\tif (typeof gradient.rotateWithShape !== 'undefined' && typeof gradient.rotateWithShape !== 'boolean') {\n\t\tthrow new InvalidOptionError(\n\t\t\t'gradient/rotate-with-shape-not-boolean',\n\t\t\t'Gradient rotateWithShape must be a boolean.'\n\t\t)\n\t}\n\n\tconst stops = normalizeGradientStops(gradient.stops)\n\tconst rotWithShape = gradient.rotateWithShape ?? true\n\n\tconst gsLst = el(\n\t\t'a:gsLst',\n\t\tnull,\n\t\tstops.map((stop) =>\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'a:gs',\n\t\t\t\t\t{ pos: Math.round(stop.position * FIXED_PCT_PER_PERCENT) },\n\t\t\t\t\traw(createColorElement(stop.color, alphaFromTransparency(stop.transparency)))\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\n\n\tlet shape: string\n\tif (gradient.kind === 'radial') {\n\t\t// `<a:path path=\"circle\">` radiates the first stop from a focus rectangle out\n\t\t// to the edges. `fillToRect` insets place that focus: equal insets center it,\n\t\t// and the `center` percentage shifts it (l/t = center, r/b = 100 - center).\n\t\t// `clampRangedInput`, not a bare `Math.min`/`Math.max`: those propagate `NaN` straight\n\t\t// through to `l=\"NaN\"`, and every other percentage option on this object already throws\n\t\t// on a non-number and warns on a clamp. The stops a few lines above always did.\n\t\tconst centerPct = (value: number | undefined, axis: 'x' | 'y'): number =>\n\t\t\tclampRangedInput(value ?? 50, 0, 100, 'gradient/center-out-of-range', `gradient.center.${axis}`)\n\t\tconst cx = centerPct(gradient.center?.x, 'x')\n\t\tconst cy = centerPct(gradient.center?.y, 'y')\n\t\tconst fillToRect = voidEl('a:fillToRect', {\n\t\t\tl: Math.round(cx * FIXED_PCT_PER_PERCENT),\n\t\t\tt: Math.round(cy * FIXED_PCT_PER_PERCENT),\n\t\t\tr: Math.round((100 - cx) * FIXED_PCT_PER_PERCENT),\n\t\t\tb: Math.round((100 - cy) * FIXED_PCT_PER_PERCENT),\n\t\t})\n\t\tshape = el('a:path', { path: 'circle' }, raw(fillToRect))\n\t} else {\n\t\tif (typeof gradient.scaled !== 'undefined' && typeof gradient.scaled !== 'boolean')\n\t\t\tthrow new InvalidOptionError('gradient/scaled-not-boolean', 'Gradient scaled must be a boolean.')\n\t\t// `scaled` is absent rather than defaulted when unset, so it stays `undefined`\n\t\t// and `voidEl` drops the attribute entirely.\n\t\tshape = voidEl('a:lin', {\n\t\t\tang: normalizeGradientAngle(gradient.angle),\n\t\t\tscaled: typeof gradient.scaled === 'boolean' ? xsdBool(gradient.scaled) : undefined,\n\t\t})\n\t}\n\n\treturn el('a:gradFill', { rotWithShape: xsdBool(rotWithShape) }, [raw(gsLst), raw(shape)])\n}\n\n/**\n * Create a native DrawingML pattern fill.\n * @param {PatternFillProps} pattern pattern fill options\n * @returns XML string\n */\nexport function genXmlPatternFill(pattern: PatternFillProps | undefined): string {\n\tif (!pattern) throw new InvalidOptionError('pattern-fill/missing-pattern', 'Pattern fill requires a pattern object.')\n\tconst fgColor = namedColorOr(pattern.fgColor, '000000', 'pattern.fgColor')\n\tconst bgColor = namedColorOr(pattern.bgColor, 'FFFFFF', 'pattern.bgColor')\n\treturn el('a:pattFill', { prst: pattern.preset }, [\n\t\traw(el('a:fgClr', null, raw(createColorElement(fgColor)))),\n\t\traw(el('a:bgClr', null, raw(createColorElement(bgColor)))),\n\t])\n}\n\n/**\n * Create a native DrawingML picture (image) fill.\n * The media relationship is registered when the object is added; this only emits\n * the `<a:blipFill>` referencing the pre-resolved rId.\n * @param props fill props (must carry a resolved `_imgRid`)\n * @returns XML string\n */\nexport function genXmlImageFill(props: ShapeFillPropsInternal | undefined): string {\n\tif (!props || typeof props._imgRid !== 'number') {\n\t\twarn(\n\t\t\t'image-fill/unresolved-media',\n\t\t\t'image fill is missing its resolved media reference; falling back to no fill. Provide `image: { path }` or `image: { data }`.'\n\t\t)\n\t\treturn voidEl('a:noFill')\n\t}\n\tconst alpha = props.transparency\n\tconst blipInner = alpha ? voidEl('a:alphaModFix', { amt: transparencyToAlpha(alpha) }) : ''\n\t// An empty `<a:srcRect/>` is the uncropped form, and stays byte-identical to what every\n\t// fill emitted before `crop` existed.\n\tconst srcRect = props.image?.crop ? genXmlImageCropRect(props.image.crop, 'image fill', '') : voidEl('a:srcRect')\n\treturn el('a:blipFill', { dpi: 0, rotWithShape: 1 }, [\n\t\t// `<a:blip>` stays paired even with no `alphaModFix` child — the arity rule.\n\t\traw(el('a:blip', { 'r:embed': `rId${props._imgRid}` }, raw(blipInner))),\n\t\traw(srcRect),\n\t\traw(STRETCH_FILL_RECT),\n\t])\n}\n\n/** The fill kinds a `ShapeFillProps`/`ShapeLineProps` can ask for. */\ntype FillKind = NonNullable<ShapeFillProps['type']>\n\n/**\n * Resolve which fill kind a set of fill or line props asks for.\n *\n * **An explicit `type` always wins**, even against a sub-object that disagrees:\n * `{ type: 'solid', gradient }` is a solid fill whose gradient is ignored. That is the rule\n * `type: 'none'` needs in order to mean anything (`{ type: 'none', color }` must stay\n * transparent), so it is the rule everywhere rather than one kind's exception.\n *\n * With no `type`, the first sub-object present selects the kind, in declaration order —\n * `gradient`, then `pattern`, then `image`. Setting two without a `type` is already a\n * contradiction; the order exists so the answer is stated rather than emergent.\n *\n * Everything else is `'solid'`, which is what `type` documents as its default.\n *\n * This is the one answer. It used to be given in four places: the stroke emitter inferred\n * `gradient` only, the shared dispatcher inferred nothing at all (so `fill: { gradient }`\n * painted a black `<a:solidFill>` and blamed the caller's colours for it), and three\n * `define/` modules each carried their own copy of the image half.\n */\nexport function resolveFillKind(props: Color | ShapeFillProps | ShapeLineProps | undefined): FillKind {\n\tif (!props || typeof props === 'string') return 'solid'\n\tif (props.type) return props.type\n\tif (props.gradient) return 'gradient'\n\tif (props.pattern) return 'pattern'\n\tif ('image' in props && props.image) return 'image'\n\treturn 'solid'\n}\n\n/** The paint kinds a stroke can ask for: {@link FillKind} without the one `<a:ln>` has no slot for. */\ntype LineFillKind = Exclude<FillKind, 'image'>\n\n/**\n * {@link resolveFillKind} for a stroke, which has one kind fewer.\n *\n * `<a:ln>`'s paint child is `EG_LineFillProperties` — `a:noFill`, `a:solidFill`, `a:gradFill`,\n * `a:pattFill` — with no `a:blipFill` among them, so a picture stroke has no OOXML expression\n * and `ShapeLineProps` subtracts `image` from the fill props it inherits. This is where the\n * subtraction is enforced at run time, for the JS caller TypeScript cannot stop: the request\n * is refused rather than painted as nothing, because emitting a blipFill inside `a:ln` is a\n * package PowerPoint reports as needing repair, and emitting nothing is a stroke the caller\n * asked to be a picture and got in the theme colour without being told.\n *\n * Every stroke site resolves through here — the two `define/` rebuilds and the emitter — so\n * the refusal names the call the caller made rather than surfacing at serialization time.\n */\nexport function resolveLineKind(props: ShapeLineProps | undefined): LineFillKind {\n\tconst kind = resolveFillKind(props)\n\tif (kind === 'image')\n\t\tthrow new UnsupportedFeatureError(\n\t\t\t'line/image-fill-unsupported',\n\t\t\t'A picture stroke is not expressible in OOXML: `a:ln` accepts noFill/solidFill/gradFill/pattFill only. Use `fill: { image }` for a picture interior, or give the line a solid, gradient or pattern paint.'\n\t\t)\n\treturn kind\n}\n\n/**\n * Does this fill or line props object name a paint at all?\n *\n * The question every *optional* paint site has to answer before dispatching: an outline, a\n * slide background and a table cell each inherit when the caller said nothing, so emitting\n * a fill child for an empty props object would paint them default black.\n *\n * \"Said nothing\" is narrower than \"is empty\". `'inherit'` is the explicit spelling of the\n * same silence and is false here. `'none'` is a statement — `<a:noFill/>` — and is true.\n * A `'solid'` kind needs a `color` to be saying anything; every other kind carries its\n * payload in its own sub-object, so its presence is the statement.\n *\n * An empty `color` string answers false as well, but is reported on the way out\n * ({@link rejectEmptyColor}): it is the caller's own missing value rather than a third\n * spelling of silence, and it used to reach here from sites that painted it black.\n */\nexport function fillNamesPaint(props: Color | ShapeFillProps | ShapeLineProps | undefined): boolean {\n\tif (!props) return false\n\tif (typeof props === 'string') return !rejectEmptyColor(props, 'color') && props.length > 0\n\tconst kind = resolveFillKind(props)\n\tif (kind === 'inherit') return false\n\tif (kind === 'solid') return !rejectEmptyColor(props.color, 'color') && Boolean(props.color)\n\treturn true\n}\n\n/**\n * Reject the empty-colour spelling of a missing value, in either shape a fill can wear.\n *\n * `''` and `{ color: '' }` say the same thing — the caller had no colour — and only the\n * second used to reach {@link createColorElement} and paint black. Both fold back onto\n * *absence* here, which is not the same as \"emit nothing\": what an absent fill means is the\n * surface's own rule, and a text box's absent fill is `<a:noFill/>`. So a site whose absence\n * rule is anything other than silence calls this before it branches, rather than letting\n * {@link genXmlColorSelection} answer for it.\n * @param props - the caller's fill or line props, in any shape the option accepts\n * @param option - the option's name, for the message\n * @returns true when the props carried the empty colour string\n */\nexport function rejectEmptyFill(props: Color | ShapeFillProps | ShapeLineProps | undefined, option: string): boolean {\n\tif (props === undefined || typeof props === 'string') return rejectEmptyColor(props, option)\n\treturn resolveFillKind(props) === 'solid' && rejectEmptyColor(props.color, option)\n}\n\n/**\n * A solid paint for {@link genXmlColorSelection}, carrying `transparency` only when one was set.\n *\n * Every caller assembles this out of an optional source — `border.transparency`,\n * `opts.transparency` — and writing the key with an `undefined` in it would be a second spelling\n * of \"no transparency\": one that reads the same here, but not in a bag that is spread over\n * another. So the key is simply absent, which is this codebase's one spelling of unset.\n * @param color - the colour to paint, already resolved against whatever default applies\n * @param transparency - percent transparency, or `undefined` for none\n */\nexport function solidPaint(color: Color, transparency: number | undefined): ShapeFillProps {\n\treturn transparency === undefined ? { color } : { color, transparency }\n}\n\n/**\n * Emit the fill group a set of fill/line props asks for, dispatching on\n * {@link resolveFillKind}. Returns '' for props that name nothing to paint, so a caller\n * with an optional paint can hand this whatever it has — including `undefined`.\n * @param {Color | ShapeFillProps | ShapeLineProps | undefined} props fill props\n * @returns XML string\n */\nexport function genXmlColorSelection(props: Color | ShapeFillProps | ShapeLineProps | undefined): string {\n\tlet colorVal = ''\n\tlet internalElements = ''\n\tlet outText = ''\n\n\t// Both spellings of the caller's missing value, folded onto the one answer. A bare `''`\n\t// is falsy and would otherwise fall past the guard below and emit nothing without a word;\n\t// `{ color: '' }` is truthy and used to fall through to `createColorElement`, which\n\t// painted DEF_FONT_COLOR — visible black on a shape the caller expected to inherit,\n\t// while the bare spelling of the same intent inherited silently. `fillNamesPaint` already\n\t// answered \"names no paint\" for both, so the two functions disagreed about one input.\n\tif (rejectEmptyFill(props, 'color')) return ''\n\n\tif (props) {\n\t\tconst fillType = resolveFillKind(props)\n\t\tif (typeof props === 'string') colorVal = props\n\t\telse {\n\t\t\tif (props.color) colorVal = props.color\n\t\t\tinternalElements += alphaFromTransparency(props.transparency)\n\t\t}\n\n\t\tswitch (fillType) {\n\t\t\t// `type: 'none'` is an explicit *no fill*, not the absence of a statement — the\n\t\t\t// same distinction `genXmlLineFill` already makes on the stroke side. Emitting\n\t\t\t// nothing leaves the interior to `p:style/a:fillRef` or the placeholder, so a\n\t\t\t// shape authored transparent came out painted in the theme's accent colour.\n\t\t\tcase 'none':\n\t\t\t\toutText += voidEl('a:noFill')\n\t\t\t\tbreak\n\t\t\t// The other half of that distinction, and the reason it needs a name of its own:\n\t\t\t// on the shape/text-box path a missing `fill` already emits `<a:noFill/>`, so\n\t\t\t// omission cannot spell *inherit* there. `'inherit'` emits nothing, which is what\n\t\t\t// hands the interior back to `p:style/a:fillRef` or the placeholder.\n\t\t\tcase 'inherit':\n\t\t\t\toutText += ''\n\t\t\t\tbreak\n\t\t\tcase 'solid':\n\t\t\t\toutText += el('a:solidFill', null, raw(createColorElement(colorVal, internalElements)))\n\t\t\t\tbreak\n\t\t\tcase 'gradient':\n\t\t\t\toutText += genXmlGradientFill(typeof props === 'string' ? undefined : props.gradient)\n\t\t\t\tbreak\n\t\t\tcase 'pattern':\n\t\t\t\toutText += genXmlPatternFill(typeof props === 'string' ? undefined : props.pattern)\n\t\t\t\tbreak\n\t\t\tcase 'image':\n\t\t\t\toutText += genXmlImageFill(typeof props === 'string' ? undefined : props)\n\t\t\t\tbreak\n\t\t\tdefault: // @note need a statement as having only \"break\" can be removed by bundlers, then triggers \"no-default\" js-linter\n\t\t\t\toutText += ''\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\treturn outText\n}\n","/**\n * ts-pptx: DrawingML line (stroke) properties\n *\n * Resolve the pieces of an `<a:ln>` stroke: its width, its `cap` attribute, and\n * its paint child. The paint reuses the shape fill group (`fill.ts`), because\n * DrawingML allows the same fills inside `<a:ln>` as inside a shape.\n *\n * It also assembles the whole element for the one stroke shape that recurs: the\n * `CT_LineProperties` a `BorderProps` paints, on a chart data point, a chart or plot\n * area, and each of a table cell's six edges ({@link borderLine}).\n */\n\nimport type { BorderProps, Color, LineCap, ShapeLineProps, StrokeProps } from '../../types/index.js'\nimport { fillNamesPaint, genXmlColorSelection, resolveLineKind, solidPaint } from './fill.js'\nimport { namedColorOr } from './color.js'\nimport { InvalidOptionError } from '../../errors.js'\nimport { warnOnce } from '../../diagnostics.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { LINE_END_TYPES, PRESET_LINE_DASHES } from '../../ooxml/st-enums.js'\nimport { lineCapToken } from '../../ooxml/line-cap.js'\nimport { lineWidthToEmu, mapStated } from '../../units-internal.js'\nimport { DEF_SHAPE_LINE_COLOR } from '../../constants-internal.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\n\n/**\n * Every key `BorderProps` defines.\n *\n * Derived from the interface rather than transcribed from it: the `satisfies` makes a key added\n * to `BorderProps` and not to this list a compile error, where the old `readonly string[]` and a\n * \"keep in step\" comment made it a silent omission.\n */\nconst BORDER_KEYS: readonly string[] = Object.keys({\n\ttype: 0,\n\tdashType: 0,\n\tcolor: 0,\n\twidth: 0,\n\ttransparency: 0,\n\tcap: 0,\n} satisfies Record<keyof Required<BorderProps>, 0>)\n\n/**\n * Resolve an `a:prstDash/@val`, falling back when the caller named nothing or named something\n * outside `ST_PresetLineDashVal`.\n *\n * Nine sites in the emitters reach that attribute and five of them wrote the caller's value\n * straight through, so the SAME type on the SAME attribute got two answers: a table border's\n * `dashType: 'bogusDash'` warned and fell back to solid, a shape line's went into the part. A\n * value outside the union makes the part schema-invalid, which PowerPoint reports as a corrupt\n * file rather than as a mis-set option.\n * @param value - the caller's dash, if any\n * @param fallback - what to emit when the caller named none, or named one outside the union\n * @param label - how the diagnostic names the option, e.g. `'border: dashType'`\n * @returns a value legal for `a:prstDash/@val`\n */\nexport function resolveDash(value: string | undefined | null, fallback: string, label: string): string {\n\treturn checkEnumOrWarn(value, PRESET_LINE_DASHES, 'border/invalid-dash-type', label) ?? fallback\n}\n\n/**\n * Resolve the `a:prstDash/@val` a {@link StrokeProps} should emit.\n *\n * `type` is a three-way switch, so on its own it can only say \"dashed\" and every dashed\n * stroke collapses onto `sysDash`. `dashType` names the preset directly and therefore wins\n * when both are given; `type: 'none'` never reaches here, being decided by the caller before\n * any dash is chosen.\n * @param stroke - the caller's stroke properties\n * @param label - how the diagnostic names the option, e.g. `'border: dashType'`\n * @returns a value legal for `a:prstDash/@val`\n */\nexport function strokeDash(stroke: StrokeProps, label: string): string {\n\treturn resolveDash(stroke.dashType, stroke.type === 'dash' ? 'sysDash' : 'solid', label)\n}\n\n/**\n * {@link strokeDash} under the name the table and chart-area borders call it by.\n * @param {BorderProps} border - the caller's border properties\n * @returns {string} a value legal for `a:prstDash/@val`\n */\nexport function resolveBorderDash(border: BorderProps): string {\n\treturn strokeDash(border, 'border: dashType')\n}\n\n/**\n * The `<a:solidFill>` (or `<a:noFill/>`) a {@link StrokeProps} paints with.\n *\n * `type: 'none'` is the one state that is not a colour, and it is decided here rather than at\n * each of the four chart call sites that used to spell it as a separate `*Show: false` flag or\n * as a `style: 'none'` sentinel.\n * @param stroke - the caller's stroke properties\n * @param defaultColor - the colour to paint when the caller named none\n * @returns the paint element\n */\nexport function strokePaint(stroke: StrokeProps, defaultColor: Color): string {\n\tif (stroke.type === 'none') return voidEl('a:noFill')\n\treturn genXmlColorSelection(solidPaint(namedColorOr(stroke.color, defaultColor, 'line.color'), stroke.transparency))\n}\n\n/**\n * Resolve an arrowhead type for `a:headEnd/@type` / `a:tailEnd/@type`, or `null` when the caller\n * named none -- the attribute is then not written and that end of the stroke stays plain.\n *\n * `ST_LineEndType` had no runtime tuple at all, so the two options were emitted verbatim and an\n * untyped caller could reach the attribute with anything.\n * @param value - the caller's arrow type, if any\n * @param label - how the diagnostic names the option, e.g. `'line: beginArrowType'`\n * @returns a value legal for the attribute, or `null` to omit it\n */\nfunction resolveLineEnd(value: string | undefined | null, label: string): string | null {\n\treturn checkEnumOrWarn(value, LINE_END_TYPES, 'line/invalid-arrow-type', label)\n}\n\n/**\n * One arrowhead element (`<a:headEnd>` / `<a:tailEnd>`), or `''` when the caller named no arrow\n * or named one outside `ST_LineEndType`.\n * @param tag - `a:headEnd` or `a:tailEnd`\n * @param value - the caller's arrow type, if any\n * @param label - how the diagnostic names the option\n * @returns the element, or `''`\n */\nexport function lineEndEl(tag: 'a:headEnd' | 'a:tailEnd', value: string | undefined | null, label: string): string {\n\tconst type = resolveLineEnd(value, label)\n\treturn type === null ? '' : voidEl(tag, { type })\n}\n\n/**\n * Report an authored key that is not part of `BorderProps`, which the library would\n * otherwise drop without a sound.\n *\n * TypeScript's excess-property check already rejects a stray key on a border written\n * *inline* at the call site. It deliberately does not fire when the border is built as\n * a variable first (`const b = {...}; addTable(rows, { border: b })`) — a variable may\n * legitimately be a supertype. That exemption covers precisely the reuse pattern a\n * shared grid style encourages, so the mistake reaches here typed as valid and the\n * wrong-named value is discarded during generation. A `.pptx` gives no other signal:\n * nothing throws, the deck opens, and the border simply renders at its default weight.\n * @param border - the caller's border properties\n */\nfunction warnUnknownBorderKeys(border: BorderProps): void {\n\tfor (const key in border) {\n\t\tif (!Object.hasOwn(border, key) || BORDER_KEYS.includes(key)) continue\n\t\twarnOnce(\n\t\t\t'border/unknown-key',\n\t\t\t`border: unknown option \\`${key}\\` is ignored — valid keys are ${BORDER_KEYS.join(', ')}. ` +\n\t\t\t\t'Line thickness is `width`, in points.',\n\t\t\t{ received: key, valid: BORDER_KEYS }\n\t\t)\n\t}\n}\n\n/**\n * Resolve a border's line width in points, falling back to `defaultPt` when `width`\n * is not a number.\n *\n * A number that is not finite is not a missing width, so it goes on to the converter rather\n * than taking the default: `lineWidthToEmu` refuses `NaN` and clamps `Infinity` to the top of\n * `ST_LineWidth`, as it does for every other line width.\n *\n * Every `BorderProps` the library reads — table cell borders, table-style regions, and\n * every chart border — resolves its width through here, so this doubles as the one\n * place that can vet a border's shape for all of them ({@link warnUnknownBorderKeys}).\n * @param {BorderProps} border - border properties (may carry `width`)\n * @param {number} defaultPt - width to use when `width` is not a number\n * @returns {number} resolved width in points\n */\nexport function resolveBorderWidth(border: BorderProps, defaultPt: number): number {\n\twarnUnknownBorderKeys(border)\n\tconst val = border.width\n\treturn typeof val === 'number' ? val : defaultPt\n}\n\n/**\n * A shape outline with its defaults applied: the kind `resolveLineKind` answers, no transparency, a\n * 1pt width, a solid dash, and on a solid stroke the default colour.\n *\n * Shapes, line-shaped text boxes and connectors each merged these themselves, and the connector\n * disagreed about zero: `line.width: 0` took the 1pt default on a shape and a text box, and wrote no\n * width at all on a connector. `0` means \"not stated\" for a line width, as it does for every option\n * `mapStated` guards, so all three take the default.\n *\n * The caller's line is spread first and only the defaulted keys are written over it. Listing the\n * carried keys instead is what once dropped `pattern`, `gradient` and `cap`: each was added to\n * `ShapeLineProps` without being added to the list, so the emitter read a key normalization had\n * already dropped. Only the solid arm writes `color`. The spread already carried whatever colour\n * another kind stated, and re-writing it would turn an unstated one into a present `undefined`.\n * @param line - the caller's line\n * @param colorLabel - how the caller's colour option is named in a colour warning\n * @returns the line with its defaults applied\n */\nexport function withLineDefaults(line: ShapeLineProps, colorLabel: string): ShapeLineProps {\n\tconst kind = resolveLineKind(line)\n\tconst resolved: ShapeLineProps = {\n\t\t...line,\n\t\ttype: kind,\n\t\ttransparency: mapStated(line.transparency, (transparency) => transparency) ?? 0,\n\t\twidth: mapStated(line.width, (width) => width) ?? 1,\n\t\tdashType: line.dashType || 'solid',\n\t}\n\tif (kind === 'solid') resolved.color = namedColorOr(line.color, DEF_SHAPE_LINE_COLOR, colorLabel)\n\treturn resolved\n}\n\n/**\n * Map a friendly `LineCap` value to the OOXML `cap` attribute value (`flat`/`sq`/`rnd`).\n * @param {LineCap} [lineCap] - line cap style (defaults to `flat`)\n * @returns {string} value for the `cap` attribute on `<a:ln>`\n */\nexport function createLineCap(lineCap?: LineCap): string {\n\tif (!lineCap) return 'flat'\n\tconst token = lineCapToken(lineCap)\n\tif (token === undefined) throw new InvalidOptionError('line/invalid-cap', `Invalid line cap: ${String(lineCap)}`)\n\treturn token\n}\n\n/**\n * Emit the paint child of an `<a:ln>` stroke.\n *\n * `<a:ln>` takes almost the same fill group as a shape interior, so a stroke can be a gradient\n * or a pattern as well as a solid color. Which one is asked for is {@link resolveLineKind}'s\n * answer, shared with the shape interior — the stroke side used to infer `gradient` from its\n * sub-object while the interior inferred nothing, so the same `{ gradient }` spelling painted a\n * gradient outline and a black fill. \"Almost\" is the picture fill: `EG_LineFillProperties` has\n * no `a:blipFill`, and `resolveLineKind` is where that is refused.\n *\n * Returns '' when the line names no paint at all ({@link fillNamesPaint}), so the caller emits\n * no fill child and the stroke inherits its color from the theme or placeholder. `type: 'none'`\n * is not that case: it is an explicit *no stroke*, and a shape authored with it grew the theme's\n * border back when the two were conflated.\n * @param {ShapeLineProps} line line options\n * @returns XML string\n */\nexport function genXmlLineFill(line: ShapeLineProps): string {\n\tif (!fillNamesPaint(line)) return ''\n\t// Refuses a picture stroke; every other kind is dispatched by the shared builder. Both\n\t// `define/` rebuilds have already resolved the kind, so this only fires for a props object\n\t// reaching the emitter directly.\n\tresolveLineKind(line)\n\treturn genXmlColorSelection(line)\n}\n\n/**\n * The `<a:ln>`-shaped stroke a {@link BorderProps} paints, in the one place every border\n * emitter now derives it.\n *\n * Four builders used to turn a `BorderProps` into a line element, each with its own\n * defaults, and the differences between them were only visible by reading all four: a\n * chart data point's outline, a chart-area or plot-area border, the `<c:spPr>` line the\n * plot and chart space share, and a table cell's six edges. They agree on the shape —\n * `w` and `cap` on the element, a solid paint from `color`/`transparency`, then an\n * optional dash and whatever the schema allows after it — and disagree only on what fills\n * those slots. Those are this function's parameters, so each caller is now a named\n * argument set rather than a re-derivation.\n *\n * Two things are deliberately *not* parameters. A stroke that paints nothing is spelled\n * differently by each caller (a bare `<a:ln><a:noFill/></a:ln>` for a chart, an\n * attribute-carrying `w=\"0\"` rule for a table cell, and nothing at all for a data point,\n * whose caller decides whether to emit it) — see {@link noStrokeLine} for the shared\n * spelling of the first. And the colour default is taken on `||`, not `??`, so an empty\n * `color` reads as *unstated* rather than reaching the colour validator as a bad value:\n * three of the four callers used to hand `''` straight through, which warns\n * `color/invalid-value` and paints `DEF_FONT_COLOR` — black — instead of the border\n * default they had named a line earlier. The chart-border builder already read it this way,\n * and `dataBorder` is the only one of the other three a caller can actually reach with an\n * empty string; the rest resolve their colour in the definition step first.\n *\n * @param name - the element's qualified name (`a:ln`, or `a:lnL`/`a:lnTlToBr`/… for a table cell)\n * @param border - the caller's border properties\n * @param spec - `defaultWidth`/`defaultColor` are used when the border states neither;\n * `cap` is the `cap` attribute value, already resolved; `extraAttrs` follows it in\n * document order; `dash` is the `a:prstDash/@val` to write, or `null` to omit the\n * element; `tail` is the already-built children that follow the dash (`a:round`, and a\n * table cell's head/tail ends), in schema order.\n * @returns the border element XML\n */\nexport function borderLine(\n\tname: string,\n\tborder: BorderProps,\n\tspec: {\n\t\tdefaultWidth: number\n\t\tdefaultColor: string\n\t\tcap: string\n\t\textraAttrs?: XmlAttrs\n\t\tdash: string | null\n\t\ttail: readonly string[]\n\t}\n): string {\n\treturn el(\n\t\tname,\n\t\t{\n\t\t\tw: lineWidthToEmu(resolveBorderWidth(border, spec.defaultWidth), 'border.width'),\n\t\t\tcap: spec.cap,\n\t\t\t...spec.extraAttrs,\n\t\t},\n\t\t[\n\t\t\tgenXmlColorSelection(\n\t\t\t\tsolidPaint(namedColorOr(border.color, spec.defaultColor, 'border.color'), border.transparency)\n\t\t\t),\n\t\t\t...(spec.dash === null ? [] : [voidEl('a:prstDash', { val: spec.dash })]),\n\t\t\t...spec.tail,\n\t\t].map(raw)\n\t)\n}\n\n/**\n * The `<a:ln>` that paints no stroke at all: an explicit `<a:noFill/>` on a bare element.\n *\n * This is the chart side's spelling of \"no line\" and is a different statement from a\n * {@link borderLine} whose paint is absent — an omitted `a:ln` inherits the theme's\n * `a:lnRef`, where this overrides it. A table cell spells the same intent with the\n * attributes still on the element and `w=\"0\"`, which is why that one is not this.\n * @returns the `<a:ln><a:noFill/></a:ln>` element XML\n */\nexport function noStrokeLine(): string {\n\treturn el('a:ln', null, raw(voidEl('a:noFill')))\n}\n","/**\n * ts-pptx: Hyperlink Relationship Registration\n *\n * Walks the text / table-cell object tree from `addText()` / `addTable()` and registers a\n * `hyperlink`-type slide rel for every hyperlink found, stamping the resolved `_rId` back onto\n * each hyperlink so serialization can emit `r:id`. Shared by the shape, text and table layers.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { HyperlinkProps, ObjectOptions, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type {\n\tHyperlinkPropsInternal,\n\tPresSlideInternal,\n\tSlideObject,\n\tSlideRel,\n\tTableCellInternal,\n} from '../../types/internal.js'\nimport { getNewRelId, heldRelIds } from '../utils.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * The relationship record one hyperlink serializes to.\n *\n * `data` distinguishes the two targets a hyperlink rel can have — `'slide'` for an internal\n * slide-to-slide link, `'dummy'` for an external URL — and `Target` is stored RAW, because\n * every emitter escapes it on the way out (see the note on `SlideRel.Target`).\n *\n * Four sites built this record by hand: the two below, `addImage`'s own hyperlink, and the\n * notes-part rels, which allocate from their own reserved id space and so cannot share the\n * registration below but can share this.\n * @param rId - the relationship id already allocated for this hyperlink\n * @param hyperlink - the caller's hyperlink; only `url`/`slide` are read\n */\nexport function hyperlinkRel(rId: number, hyperlink: HyperlinkProps): SlideRel {\n\treturn {\n\t\ttype: SlideObjectType.hyperlink,\n\t\t// `url` decides both fields, as it decides the emitted `<a:hlinkClick>`. `validateHyperlink`\n\t\t// refuses a link stating both, which once came out slide-typed with the URL as its target.\n\t\tdata: hyperlink.url ? 'dummy' : 'slide',\n\t\trId,\n\t\tTarget: hyperlink.url ? hyperlink.url : String(hyperlink.slide),\n\t}\n}\n\n/**\n * Refuse a hyperlink the writer cannot express, the same way wherever one is authored.\n *\n * A hyperlink names exactly one destination: a `url`, a `slide`, or a slide-show `action`. The image\n * definer and the run emitter each checked their own subset, and the shape path checked nothing. An\n * image refused an action-only link that a shape accepted, and nothing refused `url` together with\n * `slide`: that wrote two `<a:hlinkClick>` into one `<p:cNvPr>`, which allows one, over a slide-typed\n * relationship whose target was built from the URL.\n *\n * A `slide` has to be a 1-based slide number. `-1` and `1.5` were written as the targets\n * `slide-1.xml` and `slide1.5.xml`, parts no deck has. Whether the numbered slide exists is only\n * known once the deck is complete, so a number past the last slide is refused when the deck is\n * written (`requireSlideLinksInDeck`).\n * @param hyperlink - the caller's `hyperlink` option\n * @param call - the method or option the link was authored through, opening the message\n */\nexport function validateHyperlink(hyperlink: unknown, call: string): asserts hyperlink is HyperlinkPropsInternal {\n\tif (typeof hyperlink !== 'object' || hyperlink === null)\n\t\tthrow new InvalidOptionError(\n\t\t\t'hyperlink/not-an-object',\n\t\t\t`${call}: \\`hyperlink\\` option should be an object. Ex: \\`hyperlink:{url:'https://github.com'}\\``\n\t\t)\n\tconst { url, slide, action } = hyperlink as HyperlinkProps\n\tif (url && slide)\n\t\tthrow new InvalidOptionError(\n\t\t\t'hyperlink/conflicting-targets',\n\t\t\t`${call}: \\`hyperlink\\` takes one destination but states both \\`url\\` and \\`slide\\`.`\n\t\t)\n\tif (slide != null && !(Number.isInteger(slide) && slide >= 1))\n\t\tthrow new InvalidOptionError(\n\t\t\t'hyperlink/invalid-slide',\n\t\t\t`${call}: \\`hyperlink.slide\\` is a 1-based slide number, got ${typeof slide === 'string' ? JSON.stringify(slide) : String(slide)}.`\n\t\t)\n\tif (!url && !slide && !action)\n\t\tthrow new InvalidOptionError(\n\t\t\t'hyperlink/missing-target',\n\t\t\t`${call}: \\`hyperlink\\` requires either \\`url\\`, \\`slide\\`, or \\`action\\``\n\t\t)\n}\n\n/**\n * Mint a fresh rel id for `hyperlink`, register it on `target`, and stamp the id back onto\n * the hyperlink so the emitter can write `r:id`.\n *\n * The id comes from {@link getNewRelId}, which skips every id already held on the slide.\n * `addImage` used to increment the image's own id instead, which is how an SVG picture — a\n * pair that already consumes two ids — ended up sharing the second of them with its\n * hyperlink and emitting a duplicate `Relationship Id`.\n * @returns the allocated relationship id\n */\nexport function registerHyperlinkRel(target: PresSlideInternal, hyperlink: HyperlinkPropsInternal): number {\n\tconst relId = getNewRelId(target)\n\ttarget._rels.push(hyperlinkRel(relId, hyperlink))\n\thyperlink._rId = relId\n\treturn relId\n}\n\ntype HyperlinkTextObject = (TextProps | SlideObject | TableCellInternal) & {\n\toptions?: TextPropsOptions | ObjectOptions\n\ttext?: string | number | TextProps[] | TableCellInternal[]\n}\n\ntype HyperlinkTree =\n\t| number\n\t| string\n\t| SlideObject\n\t| TextProps\n\t| TextProps[]\n\t| TableCellInternal[]\n\t| TableCellInternal[][]\n\n/** The objects one level of a text or table-cell tree holds: a table row is itself an array. */\nfunction hyperlinkTreeLevel(text: HyperlinkTree): Array<HyperlinkTextObject | TableCellInternal[]> {\n\t// Only text objects can have hyperlinks, bail when text param is plain text\n\tif (typeof text === 'string' || typeof text === 'number') return []\n\t// IMPORTANT: Array.isArray must come before typeof===object! Otherwise, code will exhaust recursion!\n\tif (Array.isArray(text)) return text\n\treturn typeof text === 'object' ? [text] : []\n}\n\n/**\n * Parses text/text-objects from `addText()` and `addTable()` methods; creates 'hyperlink'-type Slide Rels for each hyperlink found\n *\n * Every link in the tree is checked before any is registered, by the same rules as an image's. A\n * refused link on a second run used to throw after the first run's relationship was already on\n * the slide, left pointing at a shape that was never added.\n * @param {PresSlideInternal} target - slide object that any hyperlinks will be be added to\n * @param {number | string | TextProps | TextProps[] | TableCellInternal[][]} text - text to parse\n * @param call - the method the objects were authored through, for a refused hyperlink's message\n */\nexport function createHyperlinkRels(target: PresSlideInternal, text: HyperlinkTree, call = 'addText'): void {\n\tvalidateHyperlinkTree(text, call)\n\tregisterHyperlinkTree(target, text)\n}\n\n/** Refuse the first hyperlink in the tree the writer cannot express, before anything is registered. */\nfunction validateHyperlinkTree(text: HyperlinkTree, call: string): void {\n\tfor (const item of hyperlinkTreeLevel(text)) {\n\t\tif (Array.isArray(item)) {\n\t\t\tvalidateHyperlinkTree(item, call)\n\t\t\tcontinue\n\t\t}\n\t\tif (item.options?.hyperlink) validateHyperlink(item.options.hyperlink, call)\n\t\tif (Array.isArray(item.text)) validateHyperlinkTree(item.text, call)\n\t}\n}\n\n/** Register a relationship for every hyperlink in an already-validated tree. */\nfunction registerHyperlinkTree(target: PresSlideInternal, tree: HyperlinkTree): void {\n\thyperlinkTreeLevel(tree).forEach((text: HyperlinkTextObject | TableCellInternal[]) => {\n\t\t// A table row: walk its cells.\n\t\tif (Array.isArray(text)) {\n\t\t\tregisterHyperlinkTree(target, text)\n\t\t\treturn\n\t\t}\n\n\t\tif (Array.isArray(text.text)) {\n\t\t\t// A shape carrying a hyperlink AND a run list needs BOTH walked: its own `hlinkClick` goes\n\t\t\t// on `p:cNvPr`, its runs' on their `a:rPr`, and they are two elements resolving two ids.\n\t\t\t// Recursing without registering this object's own left the shape's `r:id` pointing at a\n\t\t\t// relationship nothing had minted -- invisible while `addText`'s bare-string form handed\n\t\t\t// one options object to both the shape and its run, because the run then minted the id the\n\t\t\t// shape went on to read off the same object.\n\t\t\t//\n\t\t\t// A table cell's own link is registered on the cell below and not copied onto its runs:\n\t\t\t// the run emitter already carries it to every run. Merging the cell's options over the\n\t\t\t// first run's, which this walk once did, replaced that run's own colour and formatting.\n\t\t\tregisterHyperlinkTree(target, text.text)\n\t\t}\n\n\t\tconst options = text.options\n\t\tconst hyperlink: HyperlinkPropsInternal | undefined = options?.hyperlink\n\t\tif (!options || !hyperlink) return\n\n\t\tif (!hyperlink._rId) {\n\t\t\t// Only a `url` or a `slide` needs a relationship. A navigation action button (`action`\n\t\t\t// alone) is legitimately rel-free: the `ppaction://hlinkshowjump` action is self-contained,\n\t\t\t// so the emitter writes `r:id=\"\"`. A malformed hyperlink never gets here; it was refused above.\n\t\t\tif (hyperlink.url || hyperlink.slide) registerHyperlinkRel(target, hyperlink)\n\t\t\treturn\n\t\t}\n\n\t\t// A hyperlink already carrying an id was registered on some slide. Auto-paging re-registers\n\t\t// a repeated header row's hyperlink on each overflow slide under that id, and a caller can\n\t\t// hand one hyperlink object to two slides. Reusing the id is only sound when this slide has\n\t\t// it free: when it holds the id for a picture, a chart or another link, the rel would be\n\t\t// declared twice or the run would follow someone else's target. Then this slide gets its\n\t\t// own copy of the hyperlink and a fresh id, and the other slide keeps the original.\n\t\tconst hyperlinkRelId = hyperlink._rId\n\t\tconst wanted = hyperlinkRel(hyperlinkRelId, hyperlink)\n\t\tconst registeredHere = target._rels.some(\n\t\t\t(rel) =>\n\t\t\t\trel.rId === hyperlinkRelId &&\n\t\t\t\trel.type === wanted.type &&\n\t\t\t\trel.data === wanted.data &&\n\t\t\t\trel.Target === wanted.Target\n\t\t)\n\t\tif (registeredHere) return\n\t\tif (!heldRelIds(target).has(hyperlinkRelId)) {\n\t\t\ttarget._rels.push(wanted)\n\t\t} else {\n\t\t\tconst own: HyperlinkPropsInternal = { ...hyperlink }\n\t\t\tdelete own._rId\n\t\t\toptions.hyperlink = own\n\t\t\tregisterHyperlinkRel(target, own)\n\t\t}\n\t})\n}\n","/**\n * ts-pptx: the bullet elements, `a:buChar` and `a:buAutoNum`\n *\n * Two emitters write bullets: the slide text runs (`text-run.ts`) and the slide master's text\n * styles (`gen/slide/master.ts`). They built both elements themselves and disagreed. The slide path\n * checked a `characterCode` before using it, while the master interpolated it into the attribute\n * raw, so a code holding a quote wrote a master that does not parse. These builders are the only\n * place either element is built. What stays with each caller is its default font, which is a real\n * difference between the two rather than drift.\n */\n\nimport { BulletType } from '../../enums.js'\nimport { warn } from '../../diagnostics.js'\nimport { clampRangedInput } from '../../units-internal.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { TEXT_AUTONUM_SCHEMES } from '../../ooxml/st-enums.js'\nimport { voidEl } from '../oxml/el.js'\n\n/** A bullet `characterCode`: four hex digits naming a code point. */\nconst CHARACTER_CODE = /^[0-9A-Fa-f]{4}$/\n\n/** `ST_TextBulletStartAtNum`'s range. */\nconst START_AT_MIN = 1\nconst START_AT_MAX = 32767\n\n/**\n * `<a:buChar>`: the glyph a caller's `characterCode` names, or `glyph` when the caller named none.\n *\n * A template rather than `voidEl`, because `char` carries a pre-escaped numeric character reference\n * (`&#x2022;`, see `BulletType`) and the builder would escape its `&` a second time, rendering the\n * reference as literal text. That is why the code is checked before it gets near the attribute: one\n * that is not four hex digits warns and becomes {@link BulletType.DEFAULT}.\n * @param characterCode - the caller's `characterCode`, if they gave one\n * @param glyph - the glyph when they gave none; a library constant, already safe in an attribute\n * @param label - the option the code came from, opening the warning\n */\nexport function buCharEl(characterCode: string | undefined, glyph: string, label: string): string {\n\tlet char = glyph\n\tif (characterCode) {\n\t\tif (CHARACTER_CODE.test(characterCode)) {\n\t\t\tchar = `&#x${characterCode};`\n\t\t} else {\n\t\t\twarn(\n\t\t\t\t'bullet/invalid-character-code',\n\t\t\t\t`${label} \\`characterCode\\` should be a 4-digit unicode character (ex: 22AB), got ${JSON.stringify(characterCode)}; using the default bullet`\n\t\t\t)\n\t\t\tchar = BulletType.DEFAULT\n\t\t}\n\t}\n\treturn `<a:buChar char=\"${char}\"/>`\n}\n\n/**\n * `<a:buAutoNum>` for an auto-number scheme, starting at `startAt` when one is stated.\n *\n * `type` is required on the element, so a scheme `ST_TextAutonumberScheme` does not have warns and\n * the list counts in `arabicPeriod`, the scheme a numbered bullet takes when none is stated.\n * `startAt` is an `ST_TextBulletStartAtNum`, a whole number from 1 to 32767: a fractional one rounds,\n * one outside the range clamps with a warning, and one that is not a number throws.\n * @param type - the `ST_TextAutonumberScheme` token\n * @param startAt - the number the list starts at; omitted from the element when `undefined`\n * @param label - the option the value came from, opening the warning\n */\nexport function buAutoNumEl(type: string, startAt: number | undefined, label: string): string {\n\tconst scheme =\n\t\tcheckEnumOrWarn(type, TEXT_AUTONUM_SCHEMES, 'bullet/invalid-number-type', `${label} \\`numberType\\``) ??\n\t\t'arabicPeriod'\n\tconst start =\n\t\tstartAt === undefined\n\t\t\t? null\n\t\t\t: clampRangedInput(\n\t\t\t\t\tMath.round(startAt),\n\t\t\t\t\tSTART_AT_MIN,\n\t\t\t\t\tSTART_AT_MAX,\n\t\t\t\t\t'bullet/start-at-out-of-range',\n\t\t\t\t\t`${label} \\`numberStartAt\\``,\n\t\t\t\t\t'bullet/start-at-not-a-number'\n\t\t\t\t)\n\treturn voidEl('a:buAutoNum', { type: scheme, startAt: start })\n}\n","/**\n * ts-pptx: DrawingML value clamps\n *\n * Clamp font/character/line spacing values into their ST_* schema ranges and convert to the\n * units the attributes expect — hundredths of a point for most of them, thousandths of a\n * percent for the one measure the caller states as a multiple rather than a size.\n * Out-of-range values make PowerPoint report the package as needing repair.\n */\n\nimport { EMU_PER_INCH, EMU_PER_POINT, HUNDREDTHS_PER_POINT, PERCENT_SCALE, ptToHundredths } from '../../units.js'\nimport { clampRangedInput, inch2Emu, ptsToEmuLenient } from '../../units-internal.js'\nimport type { DiagnosticCode, InvalidOptionErrorCode } from '../../codes.js'\nimport { MAX_FONT_SIZE_PT, MIN_FONT_SIZE_PT } from '../../constants-internal.js'\n\n/**\n * One clamped text measure: how to convert the caller's value, what range the schema type\n * allows in the converted unit, and how to say so if the value falls outside it.\n */\ninterface ClampSpec {\n\t/** Diagnostic code raised when the value is clamped. */\n\tcode: DiagnosticCode\n\t/** Error code thrown when the value is not a number at all. */\n\tnonFiniteCode: InvalidOptionErrorCode\n\t/** Option name as the caller spells it, opening the warning. */\n\tlabel: string\n\t/** The valid range in the caller's own unit, as the warning states it. */\n\trange: string\n\t/** The caller's unit to the attribute's own unit. */\n\tconvert: (value: number) => number\n\t/** Converted units per caller unit: the bounds below, divided by it, are the range in the caller's unit. */\n\tperUnit: number\n\tmin: number\n\tmax: number\n}\n\n/**\n * Clamp a caller's value into its schema range, warn once if it did not already fit, and convert\n * it to the attribute's unit.\n *\n * The range is applied in the caller's own unit, through {@link clampRangedInput}: `Infinity`\n * clamps to the bound and warns, and `NaN` throws naming the option. Converting first left a\n * non-finite value to whatever the converter did with it, so `fontSize: Infinity` threw without\n * naming the option while `transparency: Infinity` clamped and warned. A value within half a unit\n * of a bound that used to round into range now also warns, though it writes the same bytes.\n *\n * The measures below differ only in the fields of {@link ClampSpec}. The warning is deduped on its\n * code plus its message, so the wording is part of the contract, not decoration.\n */\nfunction clampWithWarn(value: number, spec: ClampSpec, label = spec.label): number {\n\tconst clamped = clampRangedInput(\n\t\tvalue,\n\t\tspec.min / spec.perUnit,\n\t\tspec.max / spec.perUnit,\n\t\tspec.code,\n\t\tlabel,\n\t\tspec.nonFiniteCode,\n\t\t{ once: true, range: spec.range }\n\t)\n\treturn spec.convert(clamped)\n}\n\nconst FONT_SIZE: ClampSpec = {\n\tcode: 'font/size-out-of-range',\n\tnonFiniteCode: 'coord/non-finite',\n\tlabel: 'fontSize',\n\trange: `${MIN_FONT_SIZE_PT}-${MAX_FONT_SIZE_PT}pt`,\n\tconvert: ptToHundredths,\n\tperUnit: HUNDREDTHS_PER_POINT,\n\t// Derived from the two points constants rather than restated in hundredths: the measured-fit\n\t// pass floors a shrunk cell at the same minimum, and a bound stated twice is one that can drift.\n\tmin: MIN_FONT_SIZE_PT * HUNDREDTHS_PER_POINT,\n\tmax: MAX_FONT_SIZE_PT * HUNDREDTHS_PER_POINT,\n}\n\nconst CHAR_SPACING: ClampSpec = {\n\tcode: 'text/char-spacing-out-of-range',\n\tnonFiniteCode: 'coord/non-finite',\n\tlabel: 'charSpacing',\n\trange: '-4000..4000pt',\n\tconvert: ptToHundredths,\n\tperUnit: HUNDREDTHS_PER_POINT,\n\tmin: -400000,\n\tmax: 400000,\n}\n\nconst PARA_MARGIN: ClampSpec = {\n\tcode: 'text/paragraph-margin-out-of-range',\n\tnonFiniteCode: 'coord/non-finite',\n\tlabel: 'paraMarginLeft',\n\trange: '0-4032pt',\n\tconvert: ptsToEmuLenient,\n\tperUnit: EMU_PER_POINT,\n\tmin: 0,\n\tmax: 51206400,\n}\n\nconst PARA_INDENT: ClampSpec = {\n\tcode: 'text/paragraph-indent-out-of-range',\n\tnonFiniteCode: 'coord/non-finite',\n\tlabel: 'paraIndent',\n\trange: '-4032..4032pt',\n\tconvert: ptsToEmuLenient,\n\tperUnit: EMU_PER_POINT,\n\tmin: -51206400,\n\tmax: 51206400,\n}\n\n/** {@link PARA_MARGIN}, for the callers that state the measure in inches. 4032pt is 56in. */\nconst PARA_MARGIN_INCHES: ClampSpec = {\n\t...PARA_MARGIN,\n\trange: '0-56in',\n\tconvert: inch2Emu,\n\tperUnit: EMU_PER_INCH,\n}\n\n/** {@link PARA_INDENT}, for the callers that state the measure in inches. */\nconst PARA_INDENT_INCHES: ClampSpec = {\n\t...PARA_INDENT,\n\trange: '-56..56in',\n\tconvert: inch2Emu,\n\tperUnit: EMU_PER_INCH,\n}\n\nconst LINE_SPACING: ClampSpec = {\n\tcode: 'text/line-spacing-out-of-range',\n\tnonFiniteCode: 'coord/non-finite',\n\tlabel: 'lineSpacing',\n\trange: '0-1584pt',\n\tconvert: ptToHundredths,\n\tperUnit: HUNDREDTHS_PER_POINT,\n\tmin: 0,\n\tmax: 158400,\n}\n\nconst LINE_SPACING_MULTIPLE: ClampSpec = {\n\tcode: 'text/line-spacing-out-of-range',\n\tnonFiniteCode: 'percent/non-finite',\n\tlabel: 'lineSpacingMultiple',\n\trange: '0-132',\n\tconvert: (multiple) => Math.round(multiple * PERCENT_SCALE),\n\tperUnit: PERCENT_SCALE,\n\tmin: 0,\n\tmax: 13200000,\n}\n\n/**\n * Clamp a font size (points) into ST_TextFontSize (1-4000pt) and return it in\n * hundredths of a point for the `sz` attribute. Out-of-range sizes make\n * PowerPoint report the package as needing repair (e.g. `sz` > 400000 or < 100).\n *\n * Every `sz` in the package goes through here, and the nine options that reach it are spelled\n * nine different ways -- `fontSize` on a run, `legendFontSize` and six siblings on a chart.\n * `label` is what the warning quotes back, so a caller who set `catAxisLabelFontSize` is not\n * told about `fontSize`.\n * @param fontSizePts - the caller's size in points\n * @param label - option name as the caller spells it\n */\nexport function clampFontSizeSz(fontSizePts: number, label?: string): number {\n\treturn clampWithWarn(fontSizePts, FONT_SIZE, label)\n}\n\n/** Clamp character spacing (points) into ST_TextPoint (-4000..4000pt); returns hundredths for the `spc` attribute. */\nexport function clampCharSpacingSpc(charSpacingPts: number): number {\n\treturn clampWithWarn(charSpacingPts, CHAR_SPACING)\n}\n\n/**\n * Clamp a paragraph's left margin (points) into ST_TextMargin (0..4032pt, i.e. 0..51206400 EMU);\n * returns EMU for `a:pPr/@marL`. The type is unsigned — a negative margin is not a narrower one,\n * it is a value PowerPoint reports as needing repair.\n */\nexport function clampParaMarginEmu(marginPts: number): number {\n\treturn clampWithWarn(marginPts, PARA_MARGIN)\n}\n\n/**\n * Clamp a first-line indent (points) into ST_TextIndent (-4032..4032pt); returns EMU for\n * `a:pPr/@indent`. Unlike the margin this one is signed: a negative indent is the hanging\n * indent every bulleted paragraph uses.\n */\nexport function clampParaIndentEmu(indentPts: number): number {\n\treturn clampWithWarn(indentPts, PARA_INDENT)\n}\n\n/**\n * Clamp a left margin the caller stated in INCHES into ST_TextMargin, returning EMU for\n * `a:pPr/@marL`.\n *\n * A master's text styles state their measures in inches where a run's paragraph properties\n * state them in points. The schema bound is the same one either way, so the two spellings\n * share {@link PARA_MARGIN}'s range and differ only in the unit the warning quotes back.\n * @param marginInches - the caller's margin in inches\n * @param label - option name as the caller spells it\n */\nexport function clampParaMarginInchesEmu(marginInches: number, label: string): number {\n\treturn clampWithWarn(marginInches, PARA_MARGIN_INCHES, label)\n}\n\n/**\n * Clamp a first-line indent the caller stated in INCHES into ST_TextIndent, returning EMU for\n * `a:pPr/@indent`. The inch-stated half of {@link clampParaIndentEmu}; see\n * {@link clampParaMarginInchesEmu} for why there are two.\n * @param indentInches - the caller's indent in inches\n * @param label - option name as the caller spells it\n */\nexport function clampParaIndentInchesEmu(indentInches: number, label: string): number {\n\treturn clampWithWarn(indentInches, PARA_INDENT_INCHES, label)\n}\n\n/** Clamp line spacing (points) into ST_TextSpacingPoint (0..1584pt); returns hundredths for `<a:spcPts val>`. */\nexport function clampLineSpacingPts(lineSpacingPts: number): number {\n\treturn clampWithWarn(lineSpacingPts, LINE_SPACING)\n}\n\n/**\n * Clamp a line-spacing multiple into ST_TextSpacingPercentOrPercentString (0..13200000, i.e. a\n * multiple of 0..132); returns thousandths of a percent for `<a:spcPct val>`. The bound is the\n * schema's, not the `0.0-9.99` the option documents: a multiple of 12 is unusual, not invalid,\n * and only the values PowerPoint reports as needing repair are worth moving.\n */\nexport function clampLineSpacingMultiplePct(multiple: number): number {\n\treturn clampWithWarn(multiple, LINE_SPACING_MULTIPLE)\n}\n","/**\n * ts-pptx: DrawingML native equations (OMML)\n *\n * Wrap raw OMML markup into the `<a14:m>` marker PowerPoint uses for editable\n * equations — as a standalone display paragraph (`genXmlMathParagraph`) or as an\n * inline run that flows between the surrounding `<a:r>` runs (`genXmlInlineMath`).\n */\n\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\n\n/** The `<a14:m>` marker, carrying both namespace declarations so the supplied OMML needs none. */\nfunction a14Math(mathXml: string): string {\n\treturn el('a14:m', { 'xmlns:a14': OOXML_NS.a14, 'xmlns:m': OOXML_NS.m }, raw(mathXml))\n}\n\n/**\n * Build a native-equation paragraph (`<a:p>`) from raw OMML.\n *\n * PowerPoint stores an editable equation inside a text body as an `<a14:m>` marker wrapping\n * `<m:oMathPara><m:oMath>…`. We declare both the `a14` (drawing-2010) and `m` (math) namespaces\n * on the `<a14:m>` element so the supplied OMML needs no namespace declarations of its own, then\n * accept three input shapes: a full `<m:oMathPara>`, a full `<m:oMath>`, or the inner OMML\n * (children of `<m:oMath>`). A trailing `<a:endParaRPr>` matches what PowerPoint authors.\n *\n * @param {string} omml - raw OMML markup for the equation\n * @returns {string} an `<a:p>` math paragraph\n */\nexport function genXmlMathParagraph(omml: string): string {\n\tconst trimmed = (omml || '').trim()\n\tconst paraPr = el('m:oMathParaPr', null, raw(voidEl('m:jc', { 'm:val': 'centerGroup' })))\n\tconst mathXml = trimmed.startsWith('<m:oMathPara')\n\t\t? trimmed\n\t\t: trimmed.includes('<m:oMath')\n\t\t\t? el('m:oMathPara', null, [paraPr, trimmed].map(raw))\n\t\t\t: el('m:oMathPara', null, [paraPr, el('m:oMath', null, raw(trimmed))].map(raw))\n\treturn el('a:p', null, [a14Math(mathXml), voidEl('a:endParaRPr', { lang: 'en-US' })].map(raw))\n}\n\n/**\n * Build an INLINE native-equation run (dn-inline-math) from raw OMML.\n *\n * Unlike the display form ({@link genXmlMathParagraph}), an inline equation is *not* its own\n * paragraph: PowerPoint authors an `<a14:m>` marker wrapping a bare `<m:oMath>` (no `<m:oMathPara>`,\n * no `<m:oMathParaPr>`/`<m:jc>`) that flows between the surrounding `<a:r>` runs in one `<a:p>` —\n * pinned by the `math-omml-inline.pptx` oracle. The `mc:AlternateContent` envelope stays at the\n * shape level (see `objectHasMath`), so nothing wraps the run itself. We declare the `a14` and `m`\n * namespaces on the `<a14:m>` element so the supplied OMML needs none of its own, and accept the\n * same three input shapes as the display helper: a full `<m:oMathPara>` (its inner `<m:oMath>` is\n * unwrapped, since a paragraph block cannot flow inline), a full `<m:oMath>`, or the inner OMML.\n *\n * @param {string} omml - raw OMML markup for the equation\n * @returns {string} an `<a14:m>` inline equation run\n */\nexport function genXmlInlineMath(omml: string): string {\n\tconst trimmed = (omml || '').trim()\n\t// Extract a bare <m:oMath>…</m:oMath> — this both strips a display <m:oMathPara> wrapper and\n\t// leaves an already-bare <m:oMath> untouched; inner-only OMML is wrapped in <m:oMath>.\n\tconst oMathMatch = trimmed.match(/<m:oMath[\\s>][\\s\\S]*<\\/m:oMath>/)\n\treturn a14Math(oMathMatch ? oMathMatch[0] : el('m:oMath', null, raw(trimmed)))\n}\n","/**\n * ts-pptx: DrawingML text runs & paragraphs\n *\n * The run/paragraph half of text-body generation: paragraph properties\n * (`<a:pPr>`, bullets, spacing), run properties (`<a:rPr>`), the `<a:r>` run\n * builder, the shrink-autofit helper, and the grouping/rendering of a flat run\n * list into `<a:p>` paragraphs. The `text-body.ts` container layer builds on top.\n */\n\nimport { BulletType, SlideObjectType } from '../../enums.js'\nimport { DEF_BULLET_MARGIN, DEF_TEXT_GLOW, DEF_TEXT_SHADOW } from '../../constants-internal.js'\nimport type { ObjectOptions, TextFitShrinkProps, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type {\n\tHyperlinkPropsInternal,\n\tObjectOptionsInternal,\n\tSlideObject,\n\tTableCellInternal,\n\tTextBulletPropsInternal,\n\tTextPropsOptionsInternal,\n} from '../../types/internal.js'\nimport { createColorElement, namedColorOr, rejectEmptyColor } from './color.js'\nimport { createGlowElement, createShadowElement } from './effect.js'\nimport { genXmlColorSelection, solidPaint } from './fill.js'\nimport { setOrClear } from '../../options-internal.js'\nimport { validateHyperlink } from '../define/hyperlinks.js'\nimport { buAutoNumEl, buCharEl } from './bullet.js'\nimport { InternalError } from '../../errors.js'\nimport { inch2Emu, lineWidthToEmu, mapStated, percentToFixedPercent, ptsToEmuLenient } from '../../units-internal.js'\nimport { EMU_PER_POINT, ptToHundredths } from '../../units.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, elOrVoid, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { OOXML_NS } from '../../ooxml/namespaces.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { TEXT_CAPS_TYPES, TEXT_STRIKE_TYPES, TEXT_TAB_ALIGN_TYPES, TEXT_UNDERLINE_TYPES } from '../../ooxml/st-enums.js'\nimport { textAlignToken } from '../../ooxml/text-align.js'\nimport {\n\tclampCharSpacingSpc,\n\tclampFontSizeSz,\n\tclampLineSpacingMultiplePct,\n\tclampLineSpacingPts,\n\tclampParaIndentEmu,\n\tclampParaMarginEmu,\n} from './clamp.js'\nimport { genXmlInlineMath, genXmlMathParagraph } from './math.js'\nimport { xsdBoolIfTrue } from '../../ooxml/xsd-boolean.js'\n\n/** The 2018 hyperlink-color extension namespace, written on the `<ahyp:hlinkClr>` element itself. */\nconst AHYP_NS = 'http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor'\n\n/**\n * `<a:extLst>` marking a hyperlink whose color should follow the text color rather than the\n * theme's hyperlink color. The leading spaces are byte-significant: this block was authored as\n * indented string concatenation and that indentation reaches the file, so it is described here\n * with `openPrefix`/`closePrefix` rather than being tidied away.\n */\nconst HLINK_TEXT_COLOR_EXT = el(\n\t'a:extLst',\n\tnull,\n\traw(\n\t\tel(\n\t\t\t'a:ext',\n\t\t\t{ uri: '{A12FA001-AC4F-418D-AE19-62706E023703}' },\n\t\t\traw(voidEl('ahyp:hlinkClr', { 'xmlns:ahyp': AHYP_NS, val: 'tx' }, { openPrefix: ' ' })),\n\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t)\n\t),\n\t{ openPrefix: ' ', closePrefix: ' ' }\n)\n\n/**\n * Whether a `bullet` value makes the paragraph DRAW a bullet (a glyph, a number or a picture).\n *\n * Two call sites downstream of the emitter act on \"this paragraph has a bullet\" rather than on\n * \"this paragraph says something about its bullet\", and both were plain truthiness tests until\n * `'inherit'` — a truthy string that draws nothing — joined the union. Left as truthiness they\n * would have broken the line grouping (every run starting its own paragraph) and eaten a real\n * leading `•` from text that emits no `a:buChar` to duplicate it.\n * @param {TextPropsOptions['bullet']} bullet - the option value\n * @return {boolean} true when bullet markup is emitted\n */\nfunction emitsBulletMarkup(bullet: TextPropsOptions['bullet']): boolean {\n\treturn !!bullet && bullet !== 'inherit'\n}\n\n/**\n * One paragraph margin attribute's value in EMU, or `null` when the attribute is not written.\n *\n * Three inputs, because the option has three states and so does the attribute: an explicit\n * number is clamped and written, `'inherit'` writes nothing, and an absent option falls back to\n * whatever the `bullet` arm decided — which is also `null` for `bullet: 'inherit'`, the one arm\n * that states nothing on its own.\n *\n * BOTH arms go through the clamp. The fallback used to be returned verbatim on the grounds that\n * the emitter computed it, but the emitter computes it from the caller's `bullet.indent` and\n * `indentLevel`, so it is caller input one multiplication later — and it reached `@marL` at\n * ~6700x the `ST_TextMargin` ceiling. The fallback arrives in EMU rather than points because the\n * bullet arms do their arithmetic there; the round trip through the clamp's own unit is exact\n * for any value in range, so a paragraph that was already legal emits the same bytes.\n * @param {number|'inherit'|undefined} option - `paraMarginLeft` / `paraIndent` as given\n * @param {number|null} fallbackEmu - the bullet arm's default, `null` for no attribute\n * @param {Function} clamp - the attribute's ST_* range clamp (points in, EMU out)\n * @return {number|null} the EMU value to write, or null to omit the attribute\n */\nfunction resolveParagraphMargin(\n\toption: number | 'inherit' | undefined,\n\tfallbackEmu: number | null,\n\tclamp: (points: number) => number\n): number | null {\n\tif (option === 'inherit') return null\n\tif (option !== undefined) return clamp(option)\n\treturn fallbackEmu === null ? null : clamp(fallbackEmu / EMU_PER_POINT)\n}\n\n/**\n * The paragraph's outline level, or `0` when the caller named none or named one `a:p/@lvl`\n * cannot hold.\n *\n * Resolved once because the level is read twice — for the attribute, and as the multiplier on\n * the bullet arms' default `@marL`. Validating it for one use and multiplying a margin by it in\n * the other is how `indentLevel: 1e6` reached `marL=\"342900342900\"` under a warning that said\n * the value was being ignored.\n * @param {number|undefined} level - `indentLevel` as given\n * @return {number} a level `ST_TextIndentLevelType` accepts\n */\nfunction resolveIndentLevel(level: number | undefined): number {\n\tif (!level) return 0\n\tif (Number.isInteger(level) && level > 0 && level <= 8) return level\n\twarn('text/invalid-indent-level', `indentLevel ${String(level)} must be a whole number from 0 to 8; ignoring it.`)\n\treturn 0\n}\n\n/**\n * The `@marL` a bulleted paragraph defaults to: the bullet's own hang, plus one more of it for\n * every outline level. Two arms of the bullet chain write it — `bullet: {…}` and `bullet: true`\n * — and each had the expression spelled out, which is how one of them would have been fixed\n * and the other left behind.\n * @param {number} bulletMarLEmu - the hang one level is worth, in EMU\n * @param {number} indentLevel - the resolved outline level\n * @return {number} `a:pPr/@marL` in EMU\n */\nfunction bulletHangMarL(bulletMarLEmu: number, indentLevel: number): number {\n\treturn bulletMarLEmu + bulletMarLEmu * indentLevel\n}\n\n/**\n * Generate XML Paragraph Properties\n * @param {SlideObject|TextProps} textObj - text object\n * @param {boolean} isDefault - array of default relations\n * @return {string} XML\n */\nexport function genXmlParagraphProperties(textObj: SlideObject | TextProps, isDefault: boolean): string {\n\t// `options` is always present on text objects reaching here; narrow it once (both union\n\t// members have all-optional props, so an empty object is a valid fallback).\n\tconst opts: NonNullable<typeof textObj.options> = textObj.options ?? {}\n\tlet strXmlBullet = ''\n\tlet strXmlBulletColor = ''\n\tlet strXmlLnSpc = ''\n\tlet strXmlParaSpc = ''\n\tlet strXmlTabStops = ''\n\tconst tag = isDefault ? 'a:lvl1pPr' : 'a:pPr'\n\tlet bulletMarL = ptsToEmuLenient(DEF_BULLET_MARGIN)\n\t// The paragraph's own margins (`a:pPr/@marL` and `@indent`, in EMU). Each `bullet` arm below\n\t// records the default it has always written and `paraMarginLeft`/`paraIndent` override it;\n\t// `null` means the attribute is not written at all, which is what leaves the margin to the\n\t// `a:lstStyle` -> placeholder -> layout -> master chain. They are resolved and appended once,\n\t// after the chain, rather than by each arm — the arms decide a default, not the output.\n\tlet defaultMarL: number | null = null\n\tlet defaultIndent: number | null = null\n\t// The no-bullet arm writes `indent` before `marL`; every other arm writes `marL` first.\n\t// Attribute order carries no meaning to a reader, but it is byte-significant and the demo\n\t// decks are pinned byte-for-byte, so each arm keeps the order it has always emitted.\n\tlet indentBeforeMarL = false\n\n\t// NOTE: this open tag is deliberately NOT built with `openTag`/`el`. When `rtlMode` is set the\n\t// historical template emits `rtl=\"1\" ` with a TRAILING space while every attribute appended\n\t// below contributes a LEADING one, so `rtl` + `algn` produces a DOUBLE space between them.\n\t// `openTag` joins attributes with exactly one space, so that layout is not expressible — and\n\t// the demo deck contains no RTL text (zero `rtl=\"1\"` parts), so the byte gate could not catch\n\t// the change. Left as-is; the children below are built with the element builder.\n\tlet paragraphPropXml = `<${tag}${opts.rtlMode ? ' rtl=\"1\" ' : ''}`\n\n\t// A: Build paragraphProperties\n\t{\n\t\t// OPTION: align. A value the write API does not name writes no `algn`.\n\t\tconst algn = opts.align ? textAlignToken(opts.align) : undefined\n\t\tif (algn) paragraphPropXml += ` algn=\"${algn}\"`\n\n\t\t// A stated spacing reaches its clamp, `NaN` included, and the clamp refuses that by name.\n\t\t// The guards were truthiness, which dropped `NaN` without a word while `Infinity` threw.\n\t\tconst spacingPts = mapStated(opts.lineSpacing, clampLineSpacingPts)\n\t\tconst spacingPct =\n\t\t\tspacingPts === undefined ? mapStated(opts.lineSpacingMultiple, clampLineSpacingMultiplePct) : undefined\n\t\tif (spacingPts !== undefined) {\n\t\t\tstrXmlLnSpc = el('a:lnSpc', null, raw(voidEl('a:spcPts', { val: spacingPts })))\n\t\t} else if (spacingPct !== undefined) {\n\t\t\tstrXmlLnSpc = el('a:lnSpc', null, raw(voidEl('a:spcPct', { val: spacingPct })))\n\t\t}\n\n\t\t// OPTION: indent\n\t\t// `a:p/@lvl` is ST_TextIndentLevelType (0-8) and the value is written straight into the\n\t\t// attribute, so an unusable one is a repair prompt rather than a wrong-looking slide.\n\t\t// The guard used to be truthiness plus `> 0`, which `Infinity` passes: `lvl=\"Infinity\"`.\n\t\tconst indentLevel = resolveIndentLevel(opts.indentLevel)\n\t\tif (indentLevel) paragraphPropXml += ` lvl=\"${indentLevel}\"`\n\n\t\t// OPTION: Paragraph Spacing: Before/After\n\t\t// A non-finite value is left to reach `ptToHundredths`, which refuses it by name; dropping\n\t\t// the attribute here instead would silently lose a spacing the caller asked for. The guard\n\t\t// used to be truthiness plus `> 0`, which claimed to do that and did the opposite: `NaN` is\n\t\t// falsy, so only `Infinity` ever got through and `NaN` was dropped without a word.\n\t\tif (emitsParagraphSpacing(opts.paraSpaceBefore)) {\n\t\t\tstrXmlParaSpc += el('a:spcBef', null, raw(voidEl('a:spcPts', { val: ptToHundredths(opts.paraSpaceBefore) })))\n\t\t}\n\t\tif (emitsParagraphSpacing(opts.paraSpaceAfter)) {\n\t\t\tstrXmlParaSpc += el('a:spcAft', null, raw(voidEl('a:spcPts', { val: ptToHundredths(opts.paraSpaceAfter) })))\n\t\t}\n\n\t\t// OPTION: bullet\n\t\t// NOTE: OOXML uses the unicode character set for Bullets\n\t\t// EX: Unicode Character 'BULLET' (U+2022) ==> '<a:buChar char=\"&#x2022;\"/>'\n\t\tif (typeof opts.bullet === 'object') {\n\t\t\t// The two relationship ids `addText()` stamps on a picture bullet live off the public type.\n\t\t\tconst bullet: TextBulletPropsInternal = opts.bullet\n\t\t\tconst bulletImage = bullet.image\n\t\t\tconst isPictureBullet = !!(bulletImage && (bulletImage.path || bulletImage.data))\n\t\t\tif (opts.bullet?.indent) bulletMarL = ptsToEmuLenient(opts.bullet.indent)\n\t\t\t// Every bullet form hangs the first line by the same margin, whichever glyph it draws.\n\t\t\tdefaultMarL = bulletHangMarL(bulletMarL, indentLevel)\n\t\t\tdefaultIndent = -bulletMarL\n\t\t\t// `buClr` colors a glyph/number; it has no effect on a picture bullet, so skip it for `buBlip`.\n\t\t\trejectEmptyColor(opts.bullet.color, 'bullet.color')\n\t\t\tif (opts.bullet.color && !isPictureBullet)\n\t\t\t\tstrXmlBulletColor = el('a:buClr', null, raw(createColorElement(opts.bullet.color)))\n\n\t\t\t// `<a:buSzPct/>` val is thousandths of a percent; ST_TextBulletSizePercent allows 25%-400%.\n\t\t\t//\n\t\t\t// Emitted ONLY when the caller asked for a size. It used to be unconditional, pinned\n\t\t\t// to 100% when unset, and that is not the same thing as leaving it out: an explicit\n\t\t\t// `<a:buSzPct val=\"100000\"/>` *overrides* whatever bullet size the layout's or\n\t\t\t// master's list style sets, so every bullet this path wrote silently forced its glyph\n\t\t\t// back to full size. The same class of bug as the explicit `a:buNone` an omitted\n\t\t\t// `bullet` emits — and invisible until `Paragraph.bulletDetail` gave the round-trip\n\t\t\t// check something to see it with, which reported the added 100% on every bulleted\n\t\t\t// fixture.\n\t\t\t// 25-400% is ST_TextBulletSizePercent's range (and what PowerPoint's bullet-size\n\t\t\t// dialog accepts), so an out-of-range value goes through the same clamp every other\n\t\t\t// percentage option uses: a finite one moves to the nearest bound and warns, and a\n\t\t\t// value that is not a number throws. Dropping the attribute instead — what this did\n\t\t\t// until the policies were unified — resized the glyph to whatever the list style\n\t\t\t// inherits, which is a discarded request reported as a warning.\n\t\t\tconst bulletSizePct =\n\t\t\t\topts.bullet.size === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: percentToFixedPercent(opts.bullet.size, 'bullet/size-out-of-range', 'bullet.size', 25, 400)\n\t\t\tconst strXmlBulletSize = bulletSizePct === undefined ? '' : voidEl('a:buSzPct', { val: bulletSizePct })\n\t\t\t// NOTE: the builder escapes `typeface`, so the manual `encodeXmlEntities` that used to\n\t\t\t// wrap it here is gone — keeping both would double-escape (`&` -> `&amp;amp;`).\n\t\t\tconst strXmlBulletFont = opts.bullet.fontFace ? voidEl('a:buFont', { typeface: opts.bullet.fontFace }) : ''\n\n\t\t\tif (isPictureBullet) {\n\t\t\t\t// Picture bullet: <a:buBlip> references a slide media rel registered in addText() (`_rId`).\n\t\t\t\t// No `buFont` (there is no glyph typeface), but `buSzPct` still scales the image height.\n\t\t\t\tif (bullet._rId) {\n\t\t\t\t\t// SVG bullet: the blip embeds the PNG preview (`_rId`) and references the SVG via the\n\t\t\t\t\t// `asvg:svgBlip` extension (`_rIdSvg`), the same dual-rel form addImage() emits for SVG.\n\t\t\t\t\tconst svgExt = bullet._rIdSvg\n\t\t\t\t\t\t? el(\n\t\t\t\t\t\t\t\t'a:extLst',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t\t'a:ext',\n\t\t\t\t\t\t\t\t\t\t{ uri: '{96DAC541-7B7A-43D3-8B79-37D633B846F1}' },\n\t\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\t\tvoidEl('asvg:svgBlip', {\n\t\t\t\t\t\t\t\t\t\t\t\t'xmlns:asvg': OOXML_NS.asvg,\n\t\t\t\t\t\t\t\t\t\t\t\t'r:embed': `rId${bullet._rIdSvg}`,\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: ''\n\t\t\t\t\tconst blip = elOrVoid('a:blip', { 'r:embed': `rId${bullet._rId}` }, svgExt)\n\t\t\t\t\tstrXmlBullet = strXmlBulletSize + el('a:buBlip', null, raw(blip))\n\t\t\t\t} else {\n\t\t\t\t\t// rel was not registered (eg: bullet on a context without a slide target) - fall back to a glyph\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'bullet/image-embed-failed',\n\t\t\t\t\t\t'picture `bullet.image` could not be embedded; using a default bullet glyph'\n\t\t\t\t\t)\n\t\t\t\t\tstrXmlBullet = strXmlBulletSize + strXmlBulletFont + buCharEl(undefined, BulletType.DEFAULT, 'bullet')\n\t\t\t\t}\n\t\t\t} else if (opts.bullet.type && opts.bullet.type.toString().toLowerCase() === 'number') {\n\t\t\t\tstrXmlBullet =\n\t\t\t\t\tstrXmlBulletSize +\n\t\t\t\t\t(strXmlBulletFont || voidEl('a:buFont', { typeface: '+mj-lt' })) +\n\t\t\t\t\tbuAutoNumEl(opts.bullet.numberType || 'arabicPeriod', opts.bullet.numberStartAt || 1, 'bullet')\n\t\t\t} else {\n\t\t\t\tstrXmlBullet =\n\t\t\t\t\tstrXmlBulletSize + strXmlBulletFont + buCharEl(opts.bullet.characterCode, BulletType.DEFAULT, 'bullet')\n\t\t\t}\n\t\t} else if (opts.bullet === 'inherit') {\n\t\t\t// The paragraph states NOTHING about its bullet: no `a:buChar`/`a:buAutoNum`, no\n\t\t\t// `a:buNone`, and none of the margin attributes the other arms write. Bullet\n\t\t\t// properties resolve down the `a:lstStyle` -> placeholder -> layout -> master chain,\n\t\t\t// so silence is what lets the list style keep reaching this paragraph — `a:buNone`\n\t\t\t// *overrides* it, which is a different fact even where the inherited style has no\n\t\t\t// bullet, because a later edit to the master then stops arriving.\n\t\t\t//\n\t\t\t// Omission cannot mean this: it has meant `a:buNone` since the writer existed and\n\t\t\t// every deck authored against it depends on that. Same resolution as `fill: { type:\n\t\t\t// 'inherit' }` (#10) — name the state that had no name, leave the one that has.\n\t\t} else if (opts.bullet) {\n\t\t\tdefaultMarL = bulletHangMarL(bulletMarL, indentLevel)\n\t\t\tdefaultIndent = -bulletMarL\n\t\t\t// No `a:buSzPct` here either — `bullet: true` asks for a bullet, not for one pinned\n\t\t\t// to 100% of the body size in defiance of the master's list style. Same reasoning as\n\t\t\t// the `a:buNone` note just below, and it keeps `bullet: true` byte-identical to\n\t\t\t// `bullet: { type: 'bullet' }`, which the object branch above now also leaves out.\n\t\t\tstrXmlBullet = buCharEl(undefined, BulletType.DEFAULT, 'bullet')\n\t\t} else if (!opts.bullet) {\n\t\t\t// We only add this when the user explicitely asks for no bullet, otherwise, it can override the master defaults!\n\t\t\t// FIX: specify zero indent and marL or default will be hanging paragraph\n\t\t\tdefaultMarL = 0\n\t\t\tdefaultIndent = 0\n\t\t\tindentBeforeMarL = true\n\t\t\tstrXmlBullet = voidEl('a:buNone')\n\t\t}\n\n\t\t// OPTION: paraMarginLeft / paraIndent\n\t\t// The paragraph's own `@marL`/`@indent`, which until now only the `bullet` arms decided.\n\t\t// That conflated two facts on one element: `bullet: false` could not suppress a bullet\n\t\t// without ALSO flattening an inherited hanging indent to zero, and no state could set a\n\t\t// margin without drawing a bullet. An explicit value wins over the arm's default in every\n\t\t// state, and `'inherit'` takes the attribute out entirely — the third state omission\n\t\t// cannot spell here either, since omission is what writes the default.\n\t\tconst marLEmu = resolveParagraphMargin(opts.paraMarginLeft, defaultMarL, clampParaMarginEmu)\n\t\tconst indentEmu = resolveParagraphMargin(opts.paraIndent, defaultIndent, clampParaIndentEmu)\n\t\tconst marLAttr = marLEmu === null ? '' : ` marL=\"${marLEmu}\"`\n\t\tconst indentAttr = indentEmu === null ? '' : ` indent=\"${indentEmu}\"`\n\t\tparagraphPropXml += indentBeforeMarL ? indentAttr + marLAttr : marLAttr + indentAttr\n\n\t\t// OPTION: tabStops\n\t\tif (opts.tabStops && Array.isArray(opts.tabStops)) {\n\t\t\tconst tabStopsXml = opts.tabStops\n\t\t\t\t.map((stop) =>\n\t\t\t\t\tvoidEl('a:tab', {\n\t\t\t\t\t\tpos: inch2Emu(mapStated(stop.position, (position) => position) ?? 1),\n\t\t\t\t\t\t// An alignment outside `ST_TextTabAlignType` warns and is left out, so the stop takes the\n\t\t\t\t\t\t// schema's own default, `l`.\n\t\t\t\t\t\talgn: stop.alignment\n\t\t\t\t\t\t\t? checkEnumOrWarn(\n\t\t\t\t\t\t\t\t\tstop.alignment,\n\t\t\t\t\t\t\t\t\tTEXT_TAB_ALIGN_TYPES,\n\t\t\t\t\t\t\t\t\t'text/invalid-tab-alignment',\n\t\t\t\t\t\t\t\t\t'tab stop `alignment`'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: 'l',\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\t.join('')\n\t\t\tstrXmlTabStops = el('a:tabLst', null, raw(tabStopsXml))\n\t\t}\n\n\t\t// B: Close Paragraph-Properties\n\t\t// IMPORTANT: strXmlLnSpc, strXmlParaSpc, and strXmlBullet require strict ordering - anything out of order is ignored. (PPT-Online, PPT for Mac)\n\t\tparagraphPropXml += '>' + strXmlLnSpc + strXmlParaSpc + strXmlBulletColor + strXmlBullet + strXmlTabStops\n\t\tif (isDefault) paragraphPropXml += genXmlTextRunProperties(opts, true)\n\t\tparagraphPropXml += '</' + tag + '>'\n\t}\n\n\treturn paragraphPropXml\n}\n\n/**\n * Generate XML Text Run Properties (`a:rPr`)\n * @param {ObjectOptions|TextPropsOptions} opts - text options\n * @param {boolean} isDefault - whether these are the default text run properties\n * @return {string} XML\n */\nexport function genXmlTextRunProperties(opts: ObjectOptions | TextPropsOptions, isDefault: boolean): string {\n\tlet runProps = ''\n\tconst runPropsTag = isDefault ? 'a:defRPr' : 'a:rPr'\n\n\t// BEGIN runProperties (ex: `<a:rPr lang=\"en-US\" sz=\"1600\" b=\"1\" dirty=\"0\">`)\n\t// `strike`, `cap` and `u` are enumerated tokens: one outside its `ST_` type warns and is left out\n\t// rather than written into the attribute.\n\tconst underline =\n\t\ttypeof opts.underline === 'object' && opts.underline?.style\n\t\t\t? checkEnumOrWarn(opts.underline.style, TEXT_UNDERLINE_TYPES, 'text/invalid-underline', 'text `underline.style`')\n\t\t\t: opts.hyperlink\n\t\t\t\t? 'sng'\n\t\t\t\t: null\n\tconst baseline = opts.baseline\n\t\t? Math.round(opts.baseline * 50)\n\t\t: opts.subscript\n\t\t\t? -40000\n\t\t\t: opts.superscript\n\t\t\t\t? 30000\n\t\t\t\t: null\n\t// NOTE: attribute ORDER is byte-significant. Listing every attribute in emission order (null =\n\t// omitted) makes that order reviewable, where the old `+=` chain buried it in control flow.\n\tconst attrs: XmlAttrs = {\n\t\tlang: opts.lang ? opts.lang : 'en-US',\n\t\taltLang: opts.lang ? 'en-US' : null,\n\t\t// NOTE: clamp+round so sizes like '7.5' or out-of-range values wont cause corrupt presentations\n\t\tsz: mapStated(opts.fontSize, clampFontSizeSz) ?? null,\n\t\t// NOTE: `b`/`i` were written as `opts.bold ? '1' : '0'` inside a truthiness guard, so the\n\t\t// \"0\" arm was unreachable — the emitted value is always \"1\".\n\t\tb: xsdBoolIfTrue(opts?.bold),\n\t\ti: xsdBoolIfTrue(opts?.italic),\n\t\tstrike: opts?.strike\n\t\t\t? typeof opts.strike === 'string'\n\t\t\t\t? checkEnumOrWarn(opts.strike, TEXT_STRIKE_TYPES, 'text/invalid-strike', 'text `strike`')\n\t\t\t\t: 'sngStrike'\n\t\t\t: null,\n\t\tcap: opts?.caps ? checkEnumOrWarn(opts.caps, TEXT_CAPS_TYPES, 'text/invalid-caps', 'text `caps`') : null,\n\t\tu: underline,\n\t\tbaseline,\n\t\tspc: mapStated(opts.charSpacing, clampCharSpacingSpc) ?? null,\n\t\tkern: opts.charSpacing ? 0 : null, // IMPORTANT: Also disable kerning; otherwise text won't actually expand\n\t\tdirty: '0',\n\t}\n\n\t// Color / Font / Highlight / Outline / Effects are children of <a:rPr>, so add them now before closing the runProperties tag\n\tconst hasShadow = !!opts.shadow && opts.shadow.type !== 'none'\n\tif (\n\t\topts.color ||\n\t\topts.fontFace ||\n\t\topts.outline ||\n\t\topts.glow ||\n\t\thasShadow ||\n\t\t(typeof opts.underline === 'object' && opts.underline.color)\n\t) {\n\t\t// NOTE: children must follow CT_TextCharacterProperties order: ln, fill, effectLst, highlight, uFill, latin/ea/cs\n\t\tif (opts.outline && typeof opts.outline === 'object') {\n\t\t\trunProps += el(\n\t\t\t\t'a:ln',\n\t\t\t\t{ w: lineWidthToEmu(mapStated(opts.outline.size, (size) => size) ?? 0.75, 'outline.size') },\n\t\t\t\traw(genXmlColorSelection(namedColorOr(opts.outline.color, 'FFFFFF', 'outline.color')))\n\t\t\t)\n\t\t}\n\t\trejectEmptyColor(opts.color, 'color')\n\t\tif (opts.color) runProps += genXmlColorSelection(solidPaint(opts.color, opts.transparency))\n\t\t// EFFECTS: glow and shadow share a single <a:effectLst> (only one is allowed per CT_TextCharacterProperties; glow precedes shadow per CT_EffectList)\n\t\tif (opts.glow || hasShadow) {\n\t\t\trunProps += el('a:effectLst', null, [\n\t\t\t\topts.glow ? raw(createGlowElement(opts.glow, DEF_TEXT_GLOW)) : null,\n\t\t\t\thasShadow ? raw(createShadowElement(opts.shadow, DEF_TEXT_SHADOW)) : null,\n\t\t\t])\n\t\t}\n\t\trejectEmptyColor(opts.highlight, 'highlight')\n\t\tif (opts.highlight) runProps += el('a:highlight', null, raw(createColorElement(opts.highlight)))\n\t\tif (typeof opts.underline === 'object') rejectEmptyColor(opts.underline.color, 'underline.color')\n\t\tif (typeof opts.underline === 'object' && opts.underline.color)\n\t\t\trunProps += el('a:uFill', null, raw(genXmlColorSelection(opts.underline.color)))\n\t\tif (opts.fontFace) {\n\t\t\t// Match how PowerPoint writes a font picked from the UI: the chosen typeface goes in the\n\t\t\t// Latin (`<a:latin>`) and complex-script (`<a:cs>`) slots. The East Asian slot (`<a:ea>`) is\n\t\t\t// only written when an EA face is explicitly chosen (`fontFaceEA`); otherwise it inherits the\n\t\t\t// theme. Forcing a Latin-only font into `<a:ea>` — especially with the bogus charset values\n\t\t\t// PowerPoint never emits on ea/cs — duplicates/ghosts text in Office 365.\n\t\t\t// NOTE: order must be latin, ea, cs per CT_TextCharacterProperties.\n\t\t\t// `fontFace`/`fontFaceEA` are caller-supplied and unsanitized upstream, so they are escaped:\n\t\t\t// an unescaped `\"` or `&` in a font name closes the attribute early and emits a\n\t\t\t// non-parseable slide part, which PowerPoint reports as a file needing repair. The builder\n\t\t\t// does that escaping now, so the manual `encodeXmlEntities` calls are gone (keeping both\n\t\t\t// would double-escape).\n\t\t\trunProps += voidEl('a:latin', { typeface: opts.fontFace, pitchFamily: '34', charset: '0' })\n\t\t\tif (opts.fontFaceEA) runProps += voidEl('a:ea', { typeface: opts.fontFaceEA })\n\t\t\trunProps += voidEl('a:cs', { typeface: opts.fontFace })\n\t\t}\n\t}\n\n\t// Hyperlink support\n\tif (opts.hyperlink) {\n\t\t// Every definer refuses a hyperlink it cannot express when the link is authored, so a malformed\n\t\t// one reaching the emitter is this library's defect rather than the caller's input.\n\t\ttry {\n\t\t\tvalidateHyperlink(opts.hyperlink, 'text')\n\t\t} catch (err) {\n\t\t\tthrow new InternalError(\n\t\t\t\t'hyperlink/not-validated',\n\t\t\t\t`A run reached the emitter with a hyperlink its definer should have refused: ${(err as Error).message}`\n\t\t\t)\n\t\t}\n\t\t// An action-only hyperlink (an action-button navigation) lives on the shape's `<p:cNvPr>`\n\t\t// (see `cNvPrHyperlink`), NOT on the text run — a labeled action button emits no run-level\n\t\t// `<a:hlinkClick>`.\n\t\tif (opts.hyperlink.url || opts.hyperlink.slide) {\n\t\t\tconst link: HyperlinkPropsInternal = opts.hyperlink\n\t\t\t// runProps += '<a:uFill>'+ genXmlColorSelection('0000FF') +'</a:uFill>'; // Breaks PPT2010!\n\t\t\t// NOTE: `tooltip` is escaped by the builder now (the manual `encodeXmlEntities` is gone), and\n\t\t\t// it is written even when absent — an empty `tooltip=\"\"` is part of today's bytes.\n\t\t\tconst linkAttrs: XmlAttrs = opts.hyperlink.url\n\t\t\t\t? {\n\t\t\t\t\t\t'r:id': `rId${link._rId}`,\n\t\t\t\t\t\tinvalidUrl: '',\n\t\t\t\t\t\taction: '',\n\t\t\t\t\t\ttgtFrame: '',\n\t\t\t\t\t\ttooltip: opts.hyperlink.tooltip ?? '',\n\t\t\t\t\t\thistory: '1',\n\t\t\t\t\t\thighlightClick: '0',\n\t\t\t\t\t\tendSnd: '0',\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'r:id': `rId${link._rId}`,\n\t\t\t\t\t\taction: 'ppaction://hlinksldjump',\n\t\t\t\t\t\ttooltip: opts.hyperlink.tooltip ?? '',\n\t\t\t\t\t}\n\t\t\t// An explicit text color means the link must carry the \"follow text color\" extension, so\n\t\t\t// the element becomes paired; otherwise it self-closes.\n\t\t\trunProps += elOrVoid('a:hlinkClick', linkAttrs, opts.color ? HLINK_TEXT_COLOR_EXT : '')\n\t\t}\n\t}\n\n\t// END runProperties\n\treturn el(runPropsTag, attrs, raw(runProps))\n}\n\n/**\n * Build textBody text runs [`<a:r></a:r>`] for paragraphs [`<a:p>`]\n * @param {TextProps} textObj - Text object\n * @return {string} XML string\n */\nexport function genXmlTextRun(textObj: TextProps): string {\n\t// NOTE: Dont create full rPr runProps for empty [lineBreak] runs\n\t// Why? The size of the lineBreak wont match (eg: below it will be 18px instead of the correct 36px)\n\t// Do this:\n\t/*\n\t\t<a:p>\n\t\t\t<a:pPr algn=\"r\"/>\n\t\t\t<a:endParaRPr lang=\"en-US\" sz=\"3600\" dirty=\"0\"/>\n\t\t</a:p>\n\t*/\n\t// NOT this:\n\t/*\n\t\t<a:p>\n\t\t\t<a:pPr algn=\"r\"/>\n\t\t\t<a:r>\n\t\t\t\t<a:rPr lang=\"en-US\" sz=\"3600\" dirty=\"0\">\n\t\t\t\t\t<a:solidFill>\n\t\t\t\t\t\t<a:schemeClr val=\"accent5\"/>\n\t\t\t\t\t</a:solidFill>\n\t\t\t\t\t<a:latin typeface=\"Times\" pitchFamily=\"34\" charset=\"0\"/>\n\t\t\t\t\t<a:ea typeface=\"Times\" pitchFamily=\"34\" charset=\"-122\"/>\n\t\t\t\t\t<a:cs typeface=\"Times\" pitchFamily=\"34\" charset=\"-120\"/>\n\t\t\t\t</a:rPr>\n\t\t\t\t<a:t></a:t>\n\t\t\t</a:r>\n\t\t\t<a:endParaRPr lang=\"en-US\" dirty=\"0\"/>\n\t\t</a:p>\n\t*/\n\n\t// Return paragraph with text run\n\tif (textObj.text === undefined || textObj.text === null) return ''\n\t// `<a:t>` takes a TEXT child, so the builder escapes it — same `encodeXmlEntities` this used to call.\n\treturn el('a:r', null, [\n\t\traw(genXmlTextRunProperties(textObj.options ?? {}, false)),\n\t\traw(el('a:t', null, String(textObj.text))),\n\t])\n}\n\n/**\n * Builds `<a:normAutofit>` with explicit fontScale/lnSpcReduction for \"shrink text on overflow\"\n * @param {TextFitShrinkProps} fit - shrink fit options\n * @return {string} XML string (`<a:normAutofit .../>`)\n * @see ECMA-376 CT_TextNormAutofit (attributes in 1000ths of a percent)\n */\nexport function genXmlNormAutofit(fit: TextFitShrinkProps): string {\n\t// fontScale/lnSpcReduction are authored as a percent (0-100); OOXML stores them in 1000ths\n\t// of a percent. Both are ST_TextFontScalePercentOrPercentString / ST_TextFontScalePercent\n\t// ranges the shared percentage clamp already speaks: an out-of-range but finite scale moves\n\t// to the nearest bound and warns, and a non-number throws. They used to be dropped, which\n\t// left the shrink autofit silently un-parameterised.\n\tconst pct = (val: number | undefined, name: string): number | null =>\n\t\tval === undefined || val === null ? null : percentToFixedPercent(val, 'text/invalid-fit-percentage', `fit.${name}`)\n\n\t// `pct` returns null for an absent value, and the builder omits null attributes.\n\treturn voidEl('a:normAutofit', {\n\t\tfontScale: pct(fit.fontScale, 'fontScale'),\n\t\tlnSpcReduction: pct(fit.lnSpcReduction, 'lnSpcReduction'),\n\t})\n}\n\n// A run of formatted text within a paragraph. Every run reaching STEP 5/6 of genXmlTextBody\n// carries an `options` bag (assigned in STEP 4), so model it as required.\nexport type RunProps = TextProps & { options: TextPropsOptionsInternal }\n\n/**\n * Group the flat run list into paragraphs (lines): a new line starts on a display-math run,\n * an alignment change, or a bullet, and closes after a breakLine. Returns the per-line run arrays.\n */\nexport function groupRunsIntoLines(arrTextObjects: RunProps[], opts: ObjectOptionsInternal): RunProps[][] {\n\tconst arrLines: RunProps[][] = []\n\tlet arrTexts: RunProps[] = []\n\tarrTextObjects.forEach((textObj, idx) => {\n\t\t// A0: A DISPLAY math equation is its own paragraph — flush any pending runs and\n\t\t// give it its own line so STEP 6 emits the <a14:m><m:oMathPara> wrapper instead of text runs.\n\t\t// Inline math (dn-inline-math) flows mid-paragraph, so it falls through to the run-buffering\n\t\t// path below and STEP 6 emits a bare <a14:m><m:oMath> run alongside the plain text runs.\n\t\tif (textObj.math && !textObj.inline) {\n\t\t\tif (arrTexts.length > 0) {\n\t\t\t\tarrLines.push(arrTexts)\n\t\t\t\tarrTexts = []\n\t\t\t}\n\t\t\tarrLines.push([textObj])\n\t\t\treturn\n\t\t}\n\n\t\t// A: Align or Bullet trigger new line\n\t\tif (arrTexts.length > 0 && (textObj.options.align || opts.align)) {\n\t\t\t// Only start a new paragraph when align *changes*\n\t\t\tif (textObj.options.align !== arrTextObjects[idx - 1]?.options.align) {\n\t\t\t\tarrLines.push(arrTexts)\n\t\t\t\tarrTexts = []\n\t\t\t}\n\t\t} else if (arrTexts.length > 0 && emitsBulletMarkup(textObj.options.bullet)) {\n\t\t\tarrLines.push(arrTexts)\n\t\t\tarrTexts = []\n\t\t\ttextObj.options.breakLine = false // For cases with both `bullet` and `brekaLine` - prevent double lineBreak\n\t\t}\n\n\t\t// B: Add this text to current line\n\t\tarrTexts.push(textObj)\n\n\t\t// C: BreakLine begins new line **after** adding current text\n\t\tif (arrTexts.length > 0 && textObj.options.breakLine) {\n\t\t\t// Avoid starting a para right as loop is exhausted\n\t\t\tif (idx + 1 < arrTextObjects.length) {\n\t\t\t\tarrLines.push(arrTexts)\n\t\t\t\tarrTexts = []\n\t\t\t}\n\t\t}\n\n\t\t// D: Flush buffer\n\t\tif (idx + 1 === arrTextObjects.length) arrLines.push(arrTexts)\n\t})\n\treturn arrLines\n}\n\n/**\n * The options a run inherits from its shape — exactly the keys `genXmlTextRunProperties`\n * reads off a run's bag, in the order it reads them.\n *\n * This used to be `Object.entries(opts)` filtered on `!textOptions[key]`, which had two\n * consequences beyond copying keys (`x`, `w`, …) that mean nothing to an `<a:rPr>`. The\n * falsy test made an explicit `false`/`0` on the run indistinguishable from silence, so\n * `addText([{ text: 'a', options: { bold: false } }], { bold: true })` emitted `b=\"1\"` and a\n * run's `transparency: 0` took the shape's; and because it copied *whatever* was on the\n * shape's bag, the font-size write-back in step E below leaked one run's size onto every\n * later run. Naming the keys fixes the first and confines the second.\n *\n * Paragraph-level options (`align`, `lineSpacing`, the two margins, …) are inherited\n * separately in step B, before the `<a:pPr>` is emitted; they are deliberately not here.\n */\nconst RUN_INHERITABLE_OPTIONS = [\n\t'lang',\n\t'fontSize',\n\t'bold',\n\t'italic',\n\t'strike',\n\t'caps',\n\t'underline',\n\t'baseline',\n\t'subscript',\n\t'superscript',\n\t'charSpacing',\n\t'color',\n\t'transparency',\n\t'fontFace',\n\t'fontFaceEA',\n\t'outline',\n\t'glow',\n\t'highlight',\n\t'hyperlink',\n] as const\n\n/**\n * The paragraph-level options a run inherits from its shape -- exactly the keys\n * `genXmlParagraphProperties` reads off a run's bag, which is where the `<a:pPr>` for the\n * paragraph that run opens is built.\n *\n * A list rather than eight hand-written `setOrClear` calls because it has to be *complete*:\n * `rtlMode` and `tabStops` were read there and inherited nowhere, and reached a run only because\n * the bare-string form of `addText` handed the shape's own options object to its run. Once that\n * stopped, an unlisted key stopped arriving at all -- so the list is now the statement of what a\n * paragraph inherits, and the place to add to when `genXmlParagraphProperties` learns a new key.\n *\n * `bullet` is deliberately not here. It is inherited in STEP 4 of `text-body.ts`, onto the FIRST\n * text object only, before the line split copies each line's bag -- a rule about which paragraph\n * gets the shape's bullet, not about whether a paragraph inherits at all.\n */\nconst PARAGRAPH_INHERITABLE_OPTIONS = ['rtlMode', 'tabStops'] as const\n\n/**\n * Of those, the ones whose zero is a value the caller meant. `paraMarginLeft: 0` is flush with the\n * frame (and the override that suppresses a bullet's hanging indent) and `paraIndent: 0` likewise,\n * where `align`/`lineSpacing`/`indentLevel`/the paragraph spacings have no zero worth stating. A\n * falsy test would silently swap a run's explicit `0` for the shape's value.\n */\nconst PARAGRAPH_ZERO_IS_STATED = ['paraMarginLeft', 'paraIndent'] as const\n/**\n * Whether a value is a number the caller stated and no clamp can use -- `NaN` or `±Infinity`.\n *\n * It exists to keep such a value out of {@link PARAGRAPH_FALSY_IS_UNSTATED}'s inheritance. `NaN`\n * is falsy, so it read as \"the caller said nothing\" and took the shape's value instead of reaching\n * the clamp, whose `nonFiniteCode` is the whole point of naming a bad input rather than guessing at\n * one.\n */\nconst isUnusableNumber = (value: unknown): boolean => typeof value === 'number' && !Number.isFinite(value)\n\n/**\n * Whether `<a:spcBef>`/`<a:spcAft>` is written for a paragraph spacing value.\n *\n * `0` and a negative value are dropped, as they always were: the schema's `a:spcPts@val` is\n * unsigned, and `0` is how a caller says \"none\". A non-finite value is *not* dropped -- it is\n * passed on so {@link ptToHundredths} refuses it by name, which is what the old guard's comment\n * claimed to do while `NaN &&` short-circuited it into silence.\n */\nconst emitsParagraphSpacing = (value: number | undefined): value is number =>\n\tvalue !== undefined && (isUnusableNumber(value) || value > 0)\n\nconst PARAGRAPH_FALSY_IS_UNSTATED = [\n\t'align',\n\t'lineSpacing',\n\t'lineSpacingMultiple',\n\t'indentLevel',\n\t'paraSpaceBefore',\n\t'paraSpaceAfter',\n] as const\n\n/**\n * Render each grouped line to an `<a:p>` paragraph: paragraph props, inherited run options,\n * text runs (and inline/display math), and the closing endParaRPr.\n */\nexport function renderTextParagraphsXml(\n\tarrLines: RunProps[][],\n\tslideObj: SlideObject | TableCellInternal,\n\topts: ObjectOptionsInternal\n): string {\n\tlet strSlideXml = ''\n\tarrLines.forEach((line) => {\n\t\t// A DISPLAY equation owns its whole paragraph: emit the oMathPara wrapper and skip runs.\n\t\t// An inline equation (even when it is the line's only run) flows as a run and is emitted below.\n\t\tconst firstRun = line[0]\n\t\tif (line.length === 1 && firstRun?.math && !firstRun.inline) {\n\t\t\tstrSlideXml += genXmlMathParagraph(firstRun.math)\n\t\t\treturn\n\t\t}\n\n\t\tlet reqsClosingFontSize = false\n\t\t// The size the paragraph's `endParaRPr` closes on: the shape's, else the first run that states one.\n\t\tlet closingFontSize = opts.fontSize\n\n\t\t// A: Accumulate the paragraph's children; the `<a:p>` wrapper closes over them at the end.\n\t\tlet paraXml = ''\n\t\t// NOTE: the `<a:pPr ${rtlMode ? ' rtl=\"1\" ' : ''}` seed that used to sit here was dead —\n\t\t// `genXmlParagraphProperties` builds its own open tag (with the same `rtlMode` check) and\n\t\t// overwrote this on the first run, and nothing read it in between.\n\t\tlet paragraphPropEmitted = false\n\n\t\t// B: Start paragraph, loop over lines and add text runs\n\t\tline.forEach((textObj, idx) => {\n\t\t\t// A: Set line index\n\t\t\ttextObj.options._lineIdx = idx\n\n\t\t\t// A.1: Add soft break if not the first run of the line.\n\t\t\tif (idx > 0 && textObj.options.softBreakBefore) {\n\t\t\t\tparaXml += voidEl('a:br')\n\t\t\t}\n\n\t\t\t// B: Inherit pPr-type options from parent shape's `options`.\n\t\t\t// `setOrClear`, not plain assignment: where neither the run nor the shape states one,\n\t\t\t// the key stays off the run's bag rather than being written as an `undefined`. Run\n\t\t\t// option bags are spread — `{ ...itext.options }` in `text-body.ts`, and a placeholder's\n\t\t\t// options onto a slide's in `gen/define/text.ts` — and there the two are not the same.\n\t\t\tconst paraOptions = textObj.options as TextPropsOptions & Record<string, unknown>\n\t\t\tconst paraShapeOptions = opts as ObjectOptions & Record<string, unknown>\n\t\t\tfor (const key of PARAGRAPH_FALSY_IS_UNSTATED) {\n\t\t\t\t// `NaN` is falsy, but it is not \"unstated\": it is a value the caller wrote and we\n\t\t\t\t// cannot use. Inheriting over it hid it from the clamp that refuses it by name, so a\n\t\t\t\t// run's `lineSpacing: NaN` quietly took the shape's spacing while a shape-level `NaN`\n\t\t\t\t// was refused -- the same input, answered two ways depending on where it was written.\n\t\t\t\tconst stated = paraOptions[key]\n\t\t\t\tsetOrClear(paraOptions, key, isUnusableNumber(stated) ? stated : stated || paraShapeOptions[key])\n\t\t\t}\n\t\t\tfor (const key of [...PARAGRAPH_ZERO_IS_STATED, ...PARAGRAPH_INHERITABLE_OPTIONS]) {\n\t\t\t\tsetOrClear(paraOptions, key, paraOptions[key] ?? paraShapeOptions[key])\n\t\t\t}\n\n\t\t\t// OOXML allows only one `<a:pPr>` per `<a:p>`, and it must precede any `<a:r>` runs.\n\t\t\t// The paragraph's properties are the FIRST run's, decided once: this used to retry on\n\t\t\t// each subsequent run until one produced non-empty XML, which was unreachable while\n\t\t\t// every `bullet` state wrote something (an omitted one still emitted `marL=\"0\"\n\t\t\t// indent=\"0\"` + `a:buNone`) — and became wrong the moment `bullet: 'inherit'` made an\n\t\t\t// empty pPr possible. A retry would take its properties from a *continuation* run,\n\t\t\t// which by convention states no bullet, so the paragraph got back the very `a:buNone`\n\t\t\t// the first run asked to leave out — and got it appended AFTER that run's `<a:r>`,\n\t\t\t// where a `pPr` is not allowed.\n\t\t\tif (!paragraphPropEmitted) {\n\t\t\t\tparagraphPropEmitted = true\n\t\t\t\t// IMPORTANT: Empty \"pPr\" blocks will generate needs-repair/corrupt msg\n\t\t\t\tparaXml += genXmlParagraphProperties(textObj, false).replace('<a:pPr></a:pPr>', '')\n\t\t\t}\n\t\t\t// C: Inherit the run-level options from the shape's bag.\n\t\t\t// `genXmlTextRun` is handed the run's options only, never the shape's, so anything the\n\t\t\t// caller stated once on the shape has to be copied down here to reach `<a:rPr>`.\n\t\t\t// FILTER RULE: Hyperlinks should not inherit `color` from main options (let PPT default to local color, eg: blue on MacOS)\n\t\t\tconst textOptions = textObj.options as TextPropsOptions & Record<string, unknown>\n\t\t\tconst shapeOptions = opts as ObjectOptions & Record<string, unknown>\n\t\t\tRUN_INHERITABLE_OPTIONS.forEach((key) => {\n\t\t\t\tif (key === 'color' && textObj.options.hyperlink) return\n\t\t\t\tsetOrClear(textOptions, key, textOptions[key] ?? shapeOptions[key])\n\t\t\t})\n\n\t\t\t// D: Add formatted textrun\n\t\t\t// When this paragraph emits bullet markup (`bullet:true` or any object\n\t\t\t// form), strip a single leading bullet glyph (+ optional whitespace) from\n\t\t\t// the first run's text. Otherwise PowerPoint renders two bullets — one\n\t\t\t// from the paragraph-level `<a:buChar/>` and one from the literal glyph\n\t\t\t// in `<a:t>`. Mid-text glyphs are unaffected, and so are `bullet:false`,\n\t\t\t// `bullet:'inherit'` and no-bullet — none of them emit a glyph to double.\n\t\t\tlet _textRunObj = textObj\n\t\t\tif (idx === 0 && emitsBulletMarkup(line[0]?.options.bullet) && typeof textObj.text === 'string') {\n\t\t\t\tconst _stripped = textObj.text.replace(/^[\\u2022\\u25E6\\u25AA\\u25AB\\u25CF\\u25CB\\u2023\\u2043\\u2219]\\s*/, '')\n\t\t\t\tif (_stripped !== textObj.text) {\n\t\t\t\t\t_textRunObj = { text: _stripped, options: textObj.options }\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Drop empty-string runs that are pure paragraph-break artifacts. A segment that begins\n\t\t\t// with \"\\n\" (common when mixing RTL/LTR runs) splits into a leading empty piece; once the\n\t\t\t// paragraph break has been applied in STEP 5 that empty piece would otherwise emit a junk\n\t\t\t// `<a:r>...<a:t></a:t></a:r>` trailing the previous line. A *lone* empty run is the line\n\t\t\t// itself (an intentional blank paragraph, eg: \"line1\\n\\nline3\"), so keep it when it is the\n\t\t\t// only run on the line.\n\t\t\tconst isEmptyBreakArtifact = _textRunObj.text === '' && line.length > 1\n\t\t\tif (_textRunObj.math) {\n\t\t\t\t// Inline native equation (dn-inline-math): a bare <a14:m><m:oMath> run between plain runs.\n\t\t\t\tparaXml += genXmlInlineMath(_textRunObj.math)\n\t\t\t} else if (!isEmptyBreakArtifact) {\n\t\t\t\tparaXml += genXmlTextRun(_textRunObj)\n\t\t\t}\n\n\t\t\t// E: Flag close fontSize for empty [lineBreak] elements.\n\t\t\t// The size is tracked in a paragraph-local, NOT written back onto the shape's `opts`:\n\t\t\t// doing that made the first sized run's size the shape's size for every run after it,\n\t\t\t// so `[{ text: 'big', options: { fontSize: 40 } }, { text: 'normal' }]` emitted\n\t\t\t// `sz=\"4000\"` on both.\n\t\t\tif ((!textObj.text && opts.fontSize) || textObj.options.fontSize) {\n\t\t\t\treqsClosingFontSize = true\n\t\t\t\tclosingFontSize = closingFontSize ?? textObj.options.fontSize\n\t\t\t}\n\t\t})\n\n\t\t/* C: Append 'endParaRPr' (when needed) and close current open paragraph\n\t\t * NOTE: Add 'endParaRPr' with font/size props or PPT default (Arial/18pt en-us) is used making row \"too tall\"/not honoring options\n\t\t */\n\t\t// `sz` rides along in the first two branches only: the last one omits it even when\n\t\t// `opts.fontSize` is set, which is why the attribute set is built per-branch.\n\t\tconst sizedAttrs = (): XmlAttrs => ({\n\t\t\tlang: opts.lang || 'en-US',\n\t\t\tsz: closingFontSize ? clampFontSizeSz(closingFontSize) : null,\n\t\t\tdirty: '0',\n\t\t})\n\t\tif (slideObj._type === SlideObjectType.tablecell && (closingFontSize || opts.fontFace)) {\n\t\t\tif (opts.fontFace) {\n\t\t\t\t// Mirror genXmlTextRunProperties: Latin + complex-script slots carry the face; East Asian slot\n\t\t\t\t// inherits the theme unless `fontFaceEA` is set. Escaping is the builder's job now.\n\t\t\t\tparaXml += el('a:endParaRPr', sizedAttrs(), [\n\t\t\t\t\traw(voidEl('a:latin', { typeface: opts.fontFace, charset: '0' })),\n\t\t\t\t\topts.fontFaceEA ? raw(voidEl('a:ea', { typeface: opts.fontFaceEA })) : null,\n\t\t\t\t\traw(voidEl('a:cs', { typeface: opts.fontFace })),\n\t\t\t\t])\n\t\t\t} else {\n\t\t\t\tparaXml += voidEl('a:endParaRPr', sizedAttrs())\n\t\t\t}\n\t\t} else if (reqsClosingFontSize) {\n\t\t\t// Empty [lineBreak] lines should not contain runProp, however, they need to specify fontSize in `endParaRPr`\n\t\t\tparaXml += voidEl('a:endParaRPr', sizedAttrs())\n\t\t} else {\n\t\t\t// Added 20180101 to address PPT-2007 issues\n\t\t\tparaXml += voidEl('a:endParaRPr', { lang: opts.lang || 'en-US', dirty: '0' })\n\t\t}\n\n\t\t// D: End paragraph\n\t\tstrSlideXml += el('a:p', null, raw(paraXml))\n\t})\n\treturn strSlideXml\n}\n","/**\n * ts-pptx: DrawingML geometry\n *\n * Emit `<a:prstGeom>` (preset shapes with their adjustment guides) and\n * `<a:custGeom>` (freeform paths built from the `points` DSL). Shared by the\n * shape and image code paths so path/preset emission stays in one place.\n */\n\nimport { VALID_SHAPE_PRESETS } from '../../enums.js'\nimport type { Coord, GeometryPoint, ObjectOptions, PresLayout, ShapeAdjustHandleXY } from '../../types/index.js'\nimport { convertAngleUnits, convertArcAngle, getSmartParseNumber } from '../../units-internal.js'\nimport { EMU_PER_INCH, PERCENT_SCALE } from '../../units.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { warn } from '../../diagnostics.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * Several `<a:custGeom>` children are emitted as `<a:avLst />` — with a space before the\n * slash — where the rest of the tree writes `<a:avLst/>`. Byte-significant, so it stays.\n */\nconst SPACE_BEFORE_SLASH = { closePrefix: ' ' }\n\n/**\n * The path nodes inside `<a:cubicBezTo>`/`<a:quadBezTo>` are newline-and-tab separated,\n * an artifact of the source indentation these were originally written with. It reaches\n * the emitted bytes, so it is described here rather than left to leak from a literal.\n */\nconst BEZ_INDENT = { childPrefix: '\\n\\t\\t\\t\\t\\t', closePrefix: '\\n\\t\\t\\t\\t\\t' }\n\n/**\n * The 17 guide-formula operations ECMA-376 Part 1 §20.1.9.11 (`a:gd/@fmla`) defines.\n * The set is closed — the spec enumerates every operation with its arity — so an\n * unrecognized leading token is always a caller mistake, not a newer dialect.\n *\n * Only the operation is checked. The operands are deliberately left uninterpreted:\n * they may be literals, adjust names, or other guide names resolved in declaration\n * order, and validating them would mean re-implementing the geometry engine — which\n * is exactly what this passthrough exists to avoid.\n */\nconst GEOM_GUIDE_OPS = new Set([\n\t'*/',\n\t'+-',\n\t'+/',\n\t'?:',\n\t'abs',\n\t'at2',\n\t'cat2',\n\t'cos',\n\t'max',\n\t'min',\n\t'mod',\n\t'pin',\n\t'sat2',\n\t'sin',\n\t'sqrt',\n\t'tan',\n\t'val',\n])\n\n/**\n * Emit an `<a:prstGeom>` for a preset shape, including any adjust values (`<a:avLst>`).\n * Shared by the shape and image code paths so that geometry + adjust handling stays in one place.\n * @param {string} shapeName - preset geometry name (e.g. `rect`, `ellipse`, `roundRect`, `hexagon`)\n * @param {ObjectOptions} options - object options carrying optional `rectRadius`/`angleRange`/`arcThicknessRatio`\n * @param {number} cx - shape width (EMU), used to scale `rectRadius`\n * @param {number} cy - shape height (EMU), used to scale `rectRadius`\n * @return {string} `<a:prstGeom>` XML\n */\n// Shapes whose corner-radius adjust value is named adj1 (+ adj2) instead of adj.\n// Sourced from ECMA-376 Annex D electronic addenda (presetShapeDefinitions.xml).\nconst RECT_RADIUS_ADJ1_SHAPES = new Set(['round2SameRect', 'round2DiagRect'])\n\n/**\n * Reject a preset PowerPoint can't parse.\n *\n * An unknown `prst` value corrupts the package: PowerPoint shows the \"needs\n * repair\" dialog and drops the shape. So this is the safety net for every\n * `prstGeom` emitter — `addShape`, and the `shape` option on `addText`/`addImage`\n * — and it is also called during `addShape` normalization, so the caller sees\n * their own typo at the API boundary rather than at serialization time.\n * @param {string} shapeName - the resolved preset geometry name\n * @throws {InvalidOptionError} `shape/unknown-preset` when the name is not a preset\n */\nexport function assertKnownPreset(shapeName: string): void {\n\tif (VALID_SHAPE_PRESETS.has(shapeName)) return\n\tthrow new InvalidOptionError(\n\t\t'shape/unknown-preset',\n\t\t`Invalid shape \"${String(shapeName)}\"! Use a value from \\`ShapeType.*\\` (e.g. \\`ShapeType.rect\\`). PowerPoint can't render unknown preset geometries and will drop the shape during repair.`\n\t)\n}\n\n/**\n * A finite adjustment guide is emitted verbatim, however far outside the preset's own handle range\n * it falls. This is a decision, not an omission.\n *\n * Each preset defines its handle's bounds in its own geometry definition (the `ahXY`/`ahPolar`\n * min/max formulas of [MS-ODRAWXML]'s preset shape definitions), and nothing in ECMA-376 states\n * them -- `a:gd/@fmla` is `xsd:string`, so no schema check can see an out-of-range value either.\n * Clamping would therefore mean carrying an invented table, and many of those bounds are formulas\n * over the shape's own width and height rather than constants.\n *\n * It would also buy nothing. Desktop PowerPoint stores an out-of-range guide verbatim -- it neither\n * repairs the package on open nor rewrites the value on re-save -- and the preset's own formula\n * pins it at render time, so the shape it paints is the shape it paints at the bound. Verified by\n * exporting the slides to PNG and comparing pixels: `roundRect` at `adj` 50000, 60000 and 266667\n * rasterize identically, as do `blockArc` at `adj3` 50000 and 5000000, while two *in*-range values\n * of the same guide do not. `pnpm run test:com` carries that as a standing case.\n *\n * What IS refused is a guide PowerPoint cannot evaluate at all: a non-finite value, and a\n * `rectRadius` with no side to divide by. Those write `val NaN` / `val Infinity`, which is a token\n * outside the formula grammar rather than a number outside a range.\n */\nexport function genXmlPresetGeom(shapeName: string, options: ObjectOptions, cx: number, cy: number): string {\n\tassertKnownPreset(shapeName)\n\t// Collect adjustment guides; track names so the generic `shapeAdjust` passthrough\n\t// never emits a duplicate `<a:gd>` for a handle a friendly shortcut already set.\n\tlet avLst = ''\n\tconst emittedAdjNames = new Set<string>()\n\tconst emitGuide = (name: string, fmlaVal: number): void => {\n\t\t// `voidEl` escapes the guide name, which the `shapeAdjust` passthrough takes from the\n\t\t// caller. It is validated as a non-empty string but not charset-checked, so escaping is\n\t\t// a real (if narrow) hardening; every in-tree name is a plain `adj*` so bytes don't move.\n\t\tavLst += voidEl('a:gd', { name, fmla: `val ${fmlaVal}` })\n\t\temittedAdjNames.add(name)\n\t}\n\t// Zero is a deliberate value for every shortcut here — radius 0 is a sharp corner,\n\t// `[0, 0]` is a closed arc, thickness ratio 0 is a zero-thickness band — so each gate\n\t// asks whether the option was supplied (`!== undefined`), not whether it is truthy.\n\t// A truthy check silently dropped rectRadius: 0's guide entirely (PowerPoint then fell\n\t// back to the preset default rounding) and arcThicknessRatio: 0's adj3. (#24)\n\tif (options.rectRadius !== undefined) {\n\t\t// The radius is stated as a length and emitted as a fraction of the shape's SHORTER side,\n\t\t// which makes that side a divisor. A shape with no stated height reaches here as `cy === 0`\n\t\t// — `objects/text.ts` rescues a height for a line-less text shape, but `addShapeDefinition`\n\t\t// always stamps a `line`, so every `addShape` skips that rescue — and the division then\n\t\t// writes `fmla=\"val Infinity\"`. Both that and a non-finite radius are tokens PowerPoint\n\t\t// cannot evaluate, so warn and leave the handle at the preset's own default, which is the\n\t\t// policy `shapeAdjust` below already applies to a guide it will not emit.\n\t\tconst shorterSideEmu = Math.min(cx, cy)\n\t\tif (!Number.isFinite(options.rectRadius)) {\n\t\t\twarn(\n\t\t\t\t'geometry/invalid-shape-adjust',\n\t\t\t\t`rectRadius ${String(options.rectRadius)} is not a finite number and was ignored.`\n\t\t\t)\n\t\t} else if (!(shorterSideEmu > 0)) {\n\t\t\twarn(\n\t\t\t\t'shape/degenerate-extent',\n\t\t\t\t`rectRadius cannot be resolved against a ${cx}x${cy} EMU extent (the shape has no size on one axis); the preset's own corner radius is kept.`\n\t\t\t)\n\t\t} else {\n\t\t\tconst adjVal = Math.round((options.rectRadius * EMU_PER_INCH * PERCENT_SCALE) / shorterSideEmu)\n\t\t\tif (RECT_RADIUS_ADJ1_SHAPES.has(shapeName)) {\n\t\t\t\temitGuide('adj1', adjVal)\n\t\t\t\temitGuide('adj2', 0)\n\t\t\t} else {\n\t\t\t\temitGuide('adj', adjVal)\n\t\t\t}\n\t\t}\n\t} else if (options.angleRange !== undefined) {\n\t\tfor (let i = 0; i < 2; i++) {\n\t\t\tconst angle = options.angleRange[i] ?? 0\n\t\t\temitGuide(`adj${i + 1}`, convertAngleUnits(angle, `angleRange[${i}]`))\n\t\t}\n\n\t\tif (options.arcThicknessRatio !== undefined) {\n\t\t\t// Same reading as `rectRadius` above: a guide formula is a string, so nothing downstream\n\t\t\t// refuses `val NaN` — this is the only place it can be caught.\n\t\t\tif (Number.isFinite(options.arcThicknessRatio))\n\t\t\t\temitGuide('adj3', Math.round(options.arcThicknessRatio * (PERCENT_SCALE / 2)))\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/invalid-shape-adjust',\n\t\t\t\t\t`arcThicknessRatio ${String(options.arcThicknessRatio)} is not a finite number and was ignored.`\n\t\t\t\t)\n\t\t}\n\t}\n\t// Generic adjustment handles (`shapeAdjust`) for any preset shape.\n\tif (options.shapeAdjust) {\n\t\tconst adjusts = Array.isArray(options.shapeAdjust) ? options.shapeAdjust : [options.shapeAdjust]\n\t\tadjusts.forEach((adj) => {\n\t\t\t// Silent coercion of a bad guide produces a shape PowerPoint silently drops or repairs,\n\t\t\t// so warn and skip instead of emitting a degenerate `<a:gd>`.\n\t\t\tif (\n\t\t\t\t!adj ||\n\t\t\t\ttypeof adj.name !== 'string' ||\n\t\t\t\tadj.name.length === 0 ||\n\t\t\t\ttypeof adj.value !== 'number' ||\n\t\t\t\t!Number.isFinite(adj.value)\n\t\t\t) {\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/invalid-shape-adjust',\n\t\t\t\t\t`shapeAdjust entry ${JSON.stringify(adj)} is invalid (needs { name:string, value:number }) and was ignored.`\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (emittedAdjNames.has(adj.name)) {\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/shape-adjust-overridden',\n\t\t\t\t\t`shapeAdjust \"${adj.name}\" was ignored because rectRadius/angleRange already set that handle.`\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// `value` is a 0.0-1.0 fraction of the handle range, emitted as a percentage guide (1/100000 units).\n\t\t\temitGuide(adj.name, Math.round(adj.value * PERCENT_SCALE))\n\t\t})\n\t}\n\treturn el('a:prstGeom', { prst: shapeName }, raw(el('a:avLst', null, raw(avLst))))\n}\n\n/**\n * Narrow a freeform path node to an arc segment. An arc is the one curve node with no end\n * point, so it must be split off before the remaining curve nodes can be read for x/y.\n */\nfunction isArcPoint(point: GeometryPoint): point is Extract<GeometryPoint, { curve: { type: 'arc' } }> {\n\treturn 'curve' in point && point.curve.type === 'arc'\n}\n\n/**\n * Emit an `<a:custGeom>` for a freeform path built from `points`, plus any caller-supplied\n * connection sites (`connectionSites` → `<a:cxnLst>`), adjust handles (`adjustHandles` →\n * `<a:ahLst>`) and guide formulas (`guides` → `<a:gdLst>`) that make the shape connectable and\n * editable. Shared by the shape and image code paths so that path emission stays in one place.\n * Points and connection-site/handle positions are authored in the object's own inch/EMU space\n * (0..cx, 0..cy) — not slide-relative and not normalized; a bare non-`Coord` string is passed\n * through verbatim as a guide-name reference (matching `ST_AdjCoordinate`'s number-or-name union).\n * @param {ObjectOptions} options - object options carrying `points`/`guides`/`connectionSites`/`adjustHandles`\n * @param {number} cx - object width (EMU), used as the path viewport width\n * @param {number} cy - object height (EMU), used as the path viewport height\n * @param {PresLayout} layout - presentation layout used to resolve point coordinates to EMU\n * @return {string} `<a:custGeom>` XML\n */\nexport function genXmlCustGeom(options: ObjectOptions, cx: number, cy: number, layout: PresLayout): string {\n\tconst points = options.points\n\n\t/**\n\t * Resolve an `ST_AdjCoordinate` value: a number / unit-suffixed `Coord` → EMU (like `points`),\n\t * but a token that starts with a letter/underscore is a guide-name reference emitted verbatim.\n\t * `undefined` → `undefined`, so `el`/`voidEl` drop the (optional) attribute entirely.\n\t */\n\tconst adjCoord = (v: Coord | string | undefined, axis: 'X' | 'Y'): string | undefined => {\n\t\tif (v === undefined || v === null) return undefined\n\t\tif (typeof v === 'string' && /^[A-Za-z_]/.test(v.trim())) return v\n\t\treturn String(getSmartParseNumber(v as Coord, axis, layout))\n\t}\n\n\t/** `<a:pt>` in the object's own EMU space. */\n\tconst pt = (x: Coord | undefined, y: Coord | undefined): string =>\n\t\tvoidEl(\n\t\t\t'a:pt',\n\t\t\t{ x: getSmartParseNumber(x, 'X', layout), y: getSmartParseNumber(y, 'Y', layout) },\n\t\t\tSPACE_BEFORE_SLASH\n\t\t)\n\n\tconst nodes: string[] = []\n\tpoints?.forEach((point, i) => {\n\t\tif (isArcPoint(point)) {\n\t\t\t// An `<a:arcTo>` has no end point: it is derived from the pen position, radii and sweep.\n\t\t\t// An authored x/y is silently unused, so say so rather than let it read as meaningful.\n\t\t\t// (A union excess-property check does not reject one, so this is the only signal.)\n\t\t\tif ('x' in point || 'y' in point)\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/arc-node-point-ignored',\n\t\t\t\t\t'freeform arc node: x/y are ignored — an arcTo end point is computed from stAng/swAng and the radii.'\n\t\t\t\t)\n\t\t\tnodes.push(\n\t\t\t\tvoidEl(\n\t\t\t\t\t'a:arcTo',\n\t\t\t\t\t{\n\t\t\t\t\t\thR: getSmartParseNumber(point.curve.hR, 'Y', layout),\n\t\t\t\t\t\twR: getSmartParseNumber(point.curve.wR, 'X', layout),\n\t\t\t\t\t\tstAng: convertArcAngle(point.curve.stAng, 'stAng'),\n\t\t\t\t\t\tswAng: convertArcAngle(point.curve.swAng, 'swAng'),\n\t\t\t\t\t},\n\t\t\t\t\tSPACE_BEFORE_SLASH\n\t\t\t\t)\n\t\t\t)\n\t\t} else if ('curve' in point) {\n\t\t\tswitch (point.curve.type) {\n\t\t\t\tcase 'cubic':\n\t\t\t\t\tnodes.push(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'a:cubicBezTo',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t[pt(point.curve.x1, point.curve.y1), pt(point.curve.x2, point.curve.y2), pt(point.x, point.y)].map(raw),\n\t\t\t\t\t\t\tBEZ_INDENT\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\tcase 'quadratic':\n\t\t\t\t\tnodes.push(\n\t\t\t\t\t\tel('a:quadBezTo', null, [pt(point.curve.x1, point.curve.y1), pt(point.x, point.y)].map(raw), BEZ_INDENT)\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t} else if ('close' in point) {\n\t\t\tnodes.push(voidEl('a:close', null, SPACE_BEFORE_SLASH))\n\t\t} else if (point.moveTo || i === 0) {\n\t\t\tnodes.push(el('a:moveTo', null, raw(pt(point.x, point.y))))\n\t\t} else {\n\t\t\tnodes.push(el('a:lnTo', null, raw(pt(point.x, point.y))))\n\t\t}\n\t})\n\n\t// custGeom preamble — the sub-lists OOXML requires before `<a:pathLst>` in this exact order:\n\t// adjust values (avLst), guide formulas (gdLst), adjust handles (ahLst), connection sites\n\t// (cxnLst), and the text rectangle (rect). `avLst` and `rect` stay as ts-pptx drives them\n\t// from the path; the other three are populated from caller options when supplied, and MUST\n\t// fall back to today's exact empty-case bytes when absent (byte-identity contract).\n\n\t// `<a:gdLst>`: named construction formulas, emitted verbatim (advanced escape hatch).\n\tlet gdLst = el('a:gdLst')\n\tif (options.guides?.length) {\n\t\tconst guideEls: string[] = []\n\t\toptions.guides.forEach((g) => {\n\t\t\t// A degenerate `<a:gd>` (empty name or formula) is one PowerPoint silently repairs, so\n\t\t\t// warn and skip rather than emit it (mirrors the `shapeAdjust` guard in genXmlPresetGeom).\n\t\t\tif (\n\t\t\t\t!g ||\n\t\t\t\ttypeof g.name !== 'string' ||\n\t\t\t\tg.name.length === 0 ||\n\t\t\t\ttypeof g.formula !== 'string' ||\n\t\t\t\tg.formula.length === 0\n\t\t\t) {\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/invalid-guide',\n\t\t\t\t\t`guide entry ${JSON.stringify(g)} is invalid (needs { name:string, formula:string }) and was ignored.`\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// The formula is passed through uninterpreted, but its leading operation is a\n\t\t\t// closed set: an unknown one emits schema-shaped, semantically dead geometry\n\t\t\t// whose first feedback is a PowerPoint repair prompt. Warn and skip instead.\n\t\t\tconst op = g.formula.trimStart().split(/\\s+/)[0] ?? ''\n\t\t\tif (!GEOM_GUIDE_OPS.has(op)) {\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/unknown-guide-operation',\n\t\t\t\t\t`guide \"${g.name}\" formula ${JSON.stringify(g.formula)} starts with an unknown operation \"${op}\" (expected one of ${[...GEOM_GUIDE_OPS].join(' ')}) and was ignored.`\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tguideEls.push(voidEl('a:gd', { name: g.name, fmla: g.formula }))\n\t\t})\n\t\tif (guideEls.length) gdLst = el('a:gdLst', null, guideEls.map(raw))\n\t}\n\n\t// `<a:cxnLst>`: connection sites a connector can attach to (indexed by startShapeIdx/endShapeIdx).\n\tlet cxnLst = el('a:cxnLst')\n\tif (options.connectionSites?.length) {\n\t\tconst cxnEls: string[] = []\n\t\toptions.connectionSites.forEach((c) => {\n\t\t\tif (!c || typeof c.ang !== 'number' || !Number.isFinite(c.ang)) {\n\t\t\t\twarn(\n\t\t\t\t\t'geometry/invalid-connection-site',\n\t\t\t\t\t`connectionSite entry ${JSON.stringify(c)} is invalid (needs a finite \\`ang\\` in degrees) and was ignored.`\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst pos = voidEl('a:pos', { x: adjCoord(c.x, 'X'), y: adjCoord(c.y, 'Y') })\n\t\t\tcxnEls.push(el('a:cxn', { ang: convertAngleUnits(c.ang, 'connectionSite ang') }, raw(pos)))\n\t\t})\n\t\tif (cxnEls.length) cxnLst = el('a:cxnLst', null, cxnEls.map(raw))\n\t}\n\n\t// `<a:ahLst>`: draggable adjust handles — XY or polar, discriminated by any polar-only key.\n\tlet ahLst = voidEl('a:ahLst', null, SPACE_BEFORE_SLASH)\n\tif (options.adjustHandles?.length) {\n\t\tconst ahEls: string[] = options.adjustHandles.map((h) => {\n\t\t\tconst pos = raw(voidEl('a:pos', { x: adjCoord(h.x, 'X'), y: adjCoord(h.y, 'Y') }))\n\t\t\tconst isPolar = 'gdRefR' in h || 'minR' in h || 'maxR' in h || 'gdRefAng' in h || 'minAng' in h || 'maxAng' in h\n\t\t\t// `isPolar` is an aliased condition, so TS narrows `h` to `ShapeAdjustHandlePolar` in the\n\t\t\t// positive branch. The negation of a multi-`in` OR does not narrow the other way, so the\n\t\t\t// XY branch keeps an explicit cast.\n\t\t\tif (isPolar) {\n\t\t\t\treturn el(\n\t\t\t\t\t'a:ahPolar',\n\t\t\t\t\t{\n\t\t\t\t\t\tgdRefR: h.gdRefR,\n\t\t\t\t\t\tminR: adjCoord(h.minR, 'X'),\n\t\t\t\t\t\tmaxR: adjCoord(h.maxR, 'X'),\n\t\t\t\t\t\tgdRefAng: h.gdRefAng,\n\t\t\t\t\t\tminAng: h.minAng == null ? undefined : convertAngleUnits(h.minAng, 'adjustHandle minAng'),\n\t\t\t\t\t\tmaxAng: h.maxAng == null ? undefined : convertAngleUnits(h.maxAng, 'adjustHandle maxAng'),\n\t\t\t\t\t},\n\t\t\t\t\tpos\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst xy = h as ShapeAdjustHandleXY\n\t\t\treturn el(\n\t\t\t\t'a:ahXY',\n\t\t\t\t{\n\t\t\t\t\tgdRefX: xy.gdRefX,\n\t\t\t\t\tminX: adjCoord(xy.minX, 'X'),\n\t\t\t\t\tmaxX: adjCoord(xy.maxX, 'X'),\n\t\t\t\t\tgdRefY: xy.gdRefY,\n\t\t\t\t\tminY: adjCoord(xy.minY, 'Y'),\n\t\t\t\t\tmaxY: adjCoord(xy.maxY, 'Y'),\n\t\t\t\t},\n\t\t\t\tpos\n\t\t\t)\n\t\t})\n\t\tahLst = el('a:ahLst', null, ahEls.map(raw))\n\t}\n\n\treturn el(\n\t\t'a:custGeom',\n\t\tnull,\n\t\t[\n\t\t\tvoidEl('a:avLst', null, SPACE_BEFORE_SLASH),\n\t\t\tgdLst,\n\t\t\tahLst,\n\t\t\tcxnLst,\n\t\t\tvoidEl('a:rect', { l: 'l', t: 't', r: 'r', b: 'b' }, SPACE_BEFORE_SLASH),\n\t\t\tel('a:pathLst', null, raw(el('a:path', { w: cx, h: cy }, nodes.map(raw)))),\n\t\t].map(raw)\n\t)\n}\n\n/**\n * `<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>` — the unadjusted rectangle every emitter\n * that draws a plain box writes, seven of them by hand.\n *\n * `fmt` carries the caller's `openPrefix`, because indentation before this element is\n * byte-significant on two of those paths.\n */\nexport function prstGeomRect(fmt?: Parameters<typeof el>[3]): string {\n\treturn el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')), fmt)\n}\n","/**\n * ts-pptx: helpers shared by more than one slide-object renderer\n *\n * The `<p:cNvPr>` element, its `<a:hlinkClick>` children and the `<a:ln>` outline are each\n * emitted by several shape kinds. They live here — rather than in the dispatch module — so a\n * renderer never has to import from its own caller.\n */\n\nimport type { SlideObjectType } from '../../../enums.js'\nimport type { ShapeLineProps } from '../../../types/index.js'\nimport type {\n\tHyperlinkPropsInternal,\n\tObjectOptionsInternal,\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSlideMasterInternal,\n\tSlideObject,\n} from '../../../types/internal.js'\nimport { createLineCap, genXmlLineFill, lineEndEl, resolveDash } from '../../drawingml/line.js'\nimport { lineWidthToEmu, mapStated } from '../../../units-internal.js'\nimport { el, raw, voidEl, type XmlAttrs, type XmlFmt } from '../../oxml/el.js'\nimport { STRETCH_FILL_RECT } from '../../drawingml/src-rect.js'\nimport { prstGeomRect } from '../../drawingml/geometry.js'\n\n/**\n * Everything the dispatch in `gen/slide/object.ts` has already resolved for one slide object,\n * handed to whichever renderer that object's `_type` selects.\n *\n * One object rather than a positional prefix because the prefix was not actually shared: `slide`\n * sat in position 3 for two of the nine renderers and was absent from the other seven, and\n * `renderImageObject` took six adjacent `number` parameters that no type could tell apart.\n * Transposing `cx` and `cy` there compiled, shipped, and produced a stretched picture that\n * nothing outside a rendered slide would have flagged. Named fields make that transposition\n * impossible to write.\n *\n * Everything a renderer needs is here, and that is now a requirement rather than an observation:\n * a renderer is called through {@link RendererTable}, so it takes this and nothing else. Two used\n * to take a second argument. The connector's `shapeIds` map is genuine context and moved onto this\n * interface; the image's `{ imgWidth, imgHeight }` was `frame.cx`/`frame.cy` under another name —\n * the dispatch captured them from the same two variables the frame is built from, two statements\n * apart — so it reads the frame instead.\n */\nexport interface RenderContext {\n\t/** The slide object being emitted. */\n\tobj: SlideObject\n\t/**\n\t * Its `<p:cNvPr>` id, from the one allocator (`collectSlideShapeIds`).\n\t *\n\t * Every renderer used to recompute it as `idx + 2` off the walk index, and the group walk\n\t * kept a second counter for children — so the map that answers a forward reference (a\n\t * connector's `a:stCxn`, an animation's `p:spTgt spid`) and the ids actually emitted were two\n\t * derivations that had to be kept in step by hand.\n\t */\n\tshapeId: number\n\t/**\n\t * Every object's id, not just this one's — the whole map `shapeId` was read out of.\n\t *\n\t * A forward reference resolves through it: a connector names its endpoints by `objectName`\n\t * and has to answer with the id the target will be emitted with, which the walk has not\n\t * reached yet.\n\t */\n\tshapeIds: ReadonlyMap<SlideObject, number>\n\t/** The page it belongs to — a slide, a layout or the master. */\n\tslide: PresSlideInternal | SlideLayoutInternal | SlideMasterInternal\n\t/** The resolved box in EMU: normalized for negative extents, then overridden by a placeholder. */\n\tframe: { x: number; y: number; cx: number; cy: number }\n\t/** The layout placeholder this object inherits from, or `null`. */\n\tplaceholder: SlideObject | null\n\t/** `<a:xfrm>` placement attributes (`flipH`, `flipV`, `rot`); attribute order is byte-significant. */\n\tlocationAttrs: XmlAttrs\n\t/**\n\t * The object's options, already normalized by the dispatch. Read these rather than\n\t * re-narrowing `obj.options`: each renderer has exactly one call site, and a contract stated\n\t * there beats a defensive re-assignment in every callee.\n\t */\n\titemOpts: ObjectOptionsInternal\n}\n\n/**\n * The `SlideObjectType` members that a renderer emits a shape for.\n *\n * Not every member is one. `group` recurses back into the walk and owns the frame and bounds\n * logic that belongs to the dispatch, so it stays there; `notes`, `tablecell`, `hyperlink` and\n * `online` are not shapes at all and emit nothing. Those five are spelled out in the dispatch\n * beside this union's members, which is what makes a new enum member fail to compile until\n * someone says which kind it is.\n */\nexport type RenderedObjectType =\n\t| SlideObjectType.chart\n\t| SlideObjectType.connector\n\t| SlideObjectType.image\n\t| SlideObjectType.media\n\t| SlideObjectType.model3d\n\t| SlideObjectType.oleObject\n\t| SlideObjectType.placeholder\n\t| SlideObjectType.table\n\t| SlideObjectType.text\n\t| SlideObjectType.zoom\n\n/** One shape family's emitter: everything it needs is in the {@link RenderContext}. */\nexport type ObjectRenderer = (ctx: RenderContext) => string\n\n/**\n * Which renderer emits each shape family — the dispatch's whole knowledge of what a family's XML\n * looks like, supplied to it from outside.\n *\n * It has to come from outside. A named import inside a reachable function body is retained\n * unconditionally, so a `switch` that calls `renderChartObject` links the chart emitter into every\n * program that writes a slide, text-only ones included; a table built in the dispatch module would\n * import the same ten names and change nothing. Passed down the write path alongside the deck\n * state rather than registered into a module-level map: a mutable global populated at import time\n * is how the same input came to produce different bytes once already (see the chart-part-id\n * counter in `package/assemble.ts`), and it would also stop two decks built from different sets of\n * families in one process from each getting their own.\n *\n * `Partial` because a caller may legitimately supply fewer than ten. An object whose family is\n * absent is a routing bug rather than a silent omission, and the dispatch throws.\n */\nexport type RendererTable = Partial<Record<RenderedObjectType, ObjectRenderer>>\n\n/**\n * The `<p:cNvPr>` every shape renderer writes: self-closing for most shape kinds, paired around a\n * hyperlink or media-action child for the others.\n *\n * Both `name` and `descr` are escaped by the element builder and nowhere before it: a slide object\n * stores its `objectName` as the caller wrote it, so lookups by name and `slide.objects` compare and\n * report the caller's own spelling. Each caller used to append its own `/>` or `>`, child and close\n * tag to an open tag this module returned.\n * @param id - the shape's `<p:cNvPr>` id, unique slide-wide\n * @param name - the object's `objectName`, raw\n * @param descr - alt text, raw\n * @param children - already-serialized children; absent means self-closing, `''` means paired and empty\n * @param fmt - byte-significant whitespace around the element\n */\nexport function cNvPrEl(id: number, name: string | undefined, descr: string, children?: string, fmt?: XmlFmt): string {\n\tconst attrs = { id, name: name ?? '', descr }\n\treturn children === undefined ? voidEl('p:cNvPr', attrs, fmt) : el('p:cNvPr', attrs, raw(children), fmt)\n}\n\n/**\n * The `<a:hlinkClick>` child of a shape's `<p:cNvPr>`: a URL link, a jump to another slide, or a\n * slide-show action. Shared by the text and image renderers, which emitted identical copies.\n *\n * `<p:cNvPr>` holds at most one, so one destination is written, in that order of precedence. The\n * three used to be concatenated, which put two in one element for a link stating both `url` and\n * `slide`; `validateHyperlink` now refuses that link before it gets here.\n *\n * NOTE: the tooltip is passed through UNESCAPED and escaped once by the element builder. Escaping\n * it here as well would emit `&amp;amp;` for a tooltip containing `&`.\n * @param link - the shape's hyperlink, if any\n * @returns zero or one `<a:hlinkClick>` element\n */\nexport function cNvPrHyperlink(link: HyperlinkPropsInternal | undefined): string {\n\tif (!link) return ''\n\tconst tooltip = link.tooltip ?? ''\n\tif (link.url) return voidEl('a:hlinkClick', { 'r:id': `rId${link._rId}`, tooltip })\n\tif (link.slide)\n\t\treturn voidEl('a:hlinkClick', { 'r:id': `rId${link._rId}`, tooltip, action: 'ppaction://hlinksldjump' })\n\t// Action buttons: a self-contained slide-show navigation action. No relationship, so `r:id`\n\t// is emitted empty (schema-optional on CT_Hyperlink; matches PowerPoint's own output).\n\tif (link.action)\n\t\treturn voidEl('a:hlinkClick', { 'r:id': '', tooltip, action: `ppaction://hlinkshowjump?jump=${link.action}` })\n\treturn ''\n}\n\n/**\n * A shape outline: `<a:ln>` with its fill, dash pattern and arrow ends.\n *\n * The text, connector and image renderers each carried a byte-identical copy of this block; they\n * now share one. Attribute and child order are byte-significant and preserved as written.\n *\n * FUTURE: arrow-size support via the `w`/`len` attrs on headEnd/tailEnd\n * (e.g. `<a:headEnd type=\"arrow\" w=\"lg\" len=\"lg\"/>`; each is 'sm'|'med'|'lg', a 3x3 grid)\n * @param ln - the shape's line properties\n * @returns the `<a:ln>` element\n */\nexport function genXmlShapeLine(ln: ShapeLineProps): string {\n\treturn el(\n\t\t'a:ln',\n\t\t{\n\t\t\tw: mapStated(ln.width, (width) => lineWidthToEmu(width, 'line: width')) ?? null,\n\t\t\tcap: ln.cap ? createLineCap(ln.cap) : null,\n\t\t},\n\t\t[\n\t\t\traw(genXmlLineFill(ln)),\n\t\t\tln.dashType ? raw(voidEl('a:prstDash', { val: resolveDash(ln.dashType, 'solid', 'line: dashType') })) : null,\n\t\t\traw(lineEndEl('a:headEnd', ln.beginArrowType, 'line: beginArrowType')),\n\t\t\traw(lineEndEl('a:tailEnd', ln.endArrowType, 'line: endArrowType')),\n\t\t]\n\t)\n}\n\n/** A box in EMU, the one argument every transform emitter takes. */\nexport interface XfrmFrame {\n\tx: number | string\n\ty: number | string\n\tcx: number | string\n\tcy: number | string\n}\n\n/**\n * An `<a:off>`/`<a:ext>` transform, under whichever wrapper the context calls for: `p:xfrm` on a\n * `<p:graphicFrame>`, `a:xfrm` inside a `<p:spPr>`. Fourteen sites across the shape, chart,\n * connector, image, media, notes-master, text and zoom emitters wrote the same six-line pair;\n * `attrs` is what the last of them needed (a shape's `rot`/`flipH`/`flipV` ride on the `a:xfrm`\n * itself, not on its children).\n * @param tag - `p:xfrm` or `a:xfrm`\n * @param frame - the box, in EMU\n * @param attrs - attributes on the transform element itself, e.g. rotation and flips\n * @param fmt - byte-significant layout, where the caller's part indents\n */\nexport function xfrmEl(\n\ttag: 'p:xfrm' | 'a:xfrm',\n\tframe: XfrmFrame,\n\tattrs: XmlAttrs | null = null,\n\tfmt?: XmlFmt\n): string {\n\treturn el(\n\t\ttag,\n\t\tattrs,\n\t\t[raw(voidEl('a:off', { x: frame.x, y: frame.y })), raw(voidEl('a:ext', { cx: frame.cx, cy: frame.cy }))],\n\t\tfmt\n\t)\n}\n\n/**\n * A group's `<a:xfrm>`: the box, then an IDENTITY child coordinate space (`chOff`/`chExt` equal\n * to `off`/`ext`).\n *\n * The identity is the contract `docs/groups.md` and the measured-fit solver both rest on — a\n * group never scales its children, so a grouped shape's authored size is its rendered size.\n * Three group emitters spelled the four-child block out.\n * @param frame - the box, in EMU\n * @param attrs - attributes on the `a:xfrm` itself\n */\nexport function grpXfrmEl(frame: XfrmFrame, attrs: XmlAttrs | null = null): string {\n\treturn el('a:xfrm', attrs, [\n\t\traw(voidEl('a:off', { x: frame.x, y: frame.y })),\n\t\traw(voidEl('a:ext', { cx: frame.cx, cy: frame.cy })),\n\t\traw(voidEl('a:chOff', { x: frame.x, y: frame.y })),\n\t\traw(voidEl('a:chExt', { cx: frame.cx, cy: frame.cy })),\n\t])\n}\n\n/**\n * A part's `<p:spTree>`: the implicit top-level group's non-visual properties (the reserved\n * `cNvPr id=\"1\"`) and an identity group transform, zeroed, then the shapes.\n *\n * This is the part's built-in root group, not a user-authored `addGroup`, hence the zeroed frame.\n * Every slide, layout, master, notes slide and notes master opens its tree with exactly these\n * bytes, and the slide emitter and the notes emitter each used to write them out.\n * @param children - the shapes, already serialized, in document order\n */\nexport function spTreeEl(children: readonly string[]): string {\n\treturn el('p:spTree', null, [\n\t\traw(\n\t\t\tel('p:nvGrpSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 1, name: '' })),\n\t\t\t\traw(voidEl('p:cNvGrpSpPr')),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(el('p:grpSpPr', null, raw(grpXfrmEl({ x: 0, y: 0, cx: 0, cy: 0 })))),\n\t\t...children.map((child) => raw(child)),\n\t])\n}\n\n/**\n * A `<p:graphicFrame>`: its non-visual properties, its transform, and the `<a:graphic>` /\n * `<a:graphicData>` envelope around a payload.\n *\n * The child order is the point. `CT_GraphicalObjectFrame` sequences\n * `nvGraphicFramePr` → `xfrm` → `graphic`, and PowerPoint reports a frame that gets it wrong as\n * a corrupt file (0x80070570) rather than as a bad element — a failure the five emitters that\n * build one (chart, table, OLE, zoom, 3D model) each had to be right about separately.\n *\n * `nvGraphicFramePr` stays the caller's to build and is *not* folded in here. The five differ in\n * every part of it — an empty `<p:cNvGraphicFramePr>` for a chart against four different\n * `<a:graphicFrameLocks>` default sets, a `<p:nvPr>` that is empty for three and carries a\n * placeholder (and, for a table, a `p14:modId` extension) for the other two — and each of those\n * differences is deliberate and documented where it is made.\n *\n * @param opts.nvGraphicFramePr - the already-serialized `<p:nvGraphicFramePr>`\n * @param opts.frame - the frame's slide-absolute box, in EMU\n * @param opts.uri - the `<a:graphicData>` payload namespace\n * @param opts.payload - the already-serialized `<a:graphicData>` content\n * @param opts.fmt - per-element byte layout; `graphicAttrs` adds attributes to `<a:graphic>`\n * (the chart frame alone redeclares `xmlns:a` there, as PowerPoint writes it)\n */\nexport function graphicFrameEl(opts: {\n\tnvGraphicFramePr: string\n\tframe: { x: number; y: number; cx: number; cy: number }\n\turi: string\n\tpayload: string\n\tfmt?: { xfrm?: XmlFmt; graphic?: XmlFmt; graphicData?: XmlFmt; graphicAttrs?: XmlAttrs }\n}): string {\n\tconst { nvGraphicFramePr, frame, uri, payload, fmt } = opts\n\treturn el('p:graphicFrame', null, [\n\t\traw(nvGraphicFramePr),\n\t\traw(xfrmEl('p:xfrm', frame, null, fmt?.xfrm)),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'a:graphic',\n\t\t\t\tfmt?.graphicAttrs ?? null,\n\t\t\t\traw(el('a:graphicData', { uri }, raw(payload), fmt?.graphicData)),\n\t\t\t\tfmt?.graphic\n\t\t\t)\n\t\t),\n\t])\n}\n\n/**\n * The `<a:picLocks>` set PowerPoint fixes on an `mc:Fallback` preview picture.\n *\n * Fixed rather than taken from the caller's `objectLock`, and that is true of every construct\n * that emits one: the fallback picture is what a consumer *without* the feature draws, while the\n * caller's locks belong on the `mc:Choice` frame — the object PowerPoint itself manipulates. The\n * two element types also accept different flags, so folding a `graphicFrameLocks` set onto a\n * `picLocks` would warn about every flag they do not share. Routed through `genXmlObjectLock` so\n * attribute order comes from `PICTURE_LOCK_ATTRS` (`gen/drawingml/locks.ts`) rather than from a literal, and a flag\n * added to the table lands in the right place.\n *\n * A 3D model spreads `noCrop` on top: it is reframed by its camera, never by cropping the cached\n * raster.\n */\nexport const FALLBACK_PICTURE_LOCKS = Object.freeze({\n\tnoGrp: true,\n\tnoRot: true,\n\tnoChangeAspect: true,\n\tnoMove: true,\n\tnoResize: true,\n\tnoEditPoints: true,\n\tnoAdjustHandles: true,\n\tnoChangeArrowheads: true,\n\tnoChangeShapeType: true,\n})\n\n/**\n * The drawn half of an `mc:Fallback` preview picture: the `<p:blipFill>` onto the cached image\n * and the `<p:spPr>` that places it. Identical in the OLE, zoom and 3D-model emitters, which is\n * everything a preview picture is apart from its `<p:nvPicPr>` — and there the three differ on\n * purpose (an id-less `cNvPr` for OLE, a hyperlinked one for a zoom tile, `noCrop` for a model),\n * so each keeps its own.\n * @param previewRid - the relationship id of the cached image\n * @param frame - where the picture is drawn, in EMU\n * @param outline - `true` for the hairline grey border a zoom tile carries\n * @param prefix - which namespace the two wrapper elements take; a zoom tile's live in `p166`\n */\n/** Which namespace `previewPicBody`'s two wrapper elements take, and whether to declare it. */\ninterface PreviewPicPrefix {\n\tns: string\n\tnsUri?: string\n}\n\nexport function previewPicBody(\n\tpreviewRid: number,\n\tframe: XfrmFrame,\n\toutline = false,\n\tprefix: PreviewPicPrefix = { ns: 'p' }\n): string {\n\tconst attrs = prefix.nsUri === undefined ? null : { [`xmlns:${prefix.ns}`]: prefix.nsUri }\n\treturn (\n\t\tel(`${prefix.ns}:blipFill`, attrs, [\n\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${previewRid}` })),\n\t\t\traw(STRETCH_FILL_RECT),\n\t\t]) +\n\t\tel(`${prefix.ns}:spPr`, attrs, [\n\t\t\traw(xfrmEl('a:xfrm', frame)),\n\t\t\traw(prstGeomRect()),\n\t\t\toutline\n\t\t\t\t? raw(el('a:ln', { w: '3175' }, raw(el('a:solidFill', null, raw(voidEl('a:prstClr', { val: 'ltGray' }))))))\n\t\t\t\t: null,\n\t\t])\n\t)\n}\n","/**\n * Where the parts of a written package live.\n *\n * Every part is named at least three times: the assembler writes it, `[Content_Types].xml`\n * declares an `Override` for it, and one or more `.rels` parts target it. Each of those was\n * its own template literal in its own module, and the three spellings differ — a zip entry\n * name, a leading-slash part name, a relationship target resolved against the part that\n * states it — so nothing tied them together. A part written but not declared is a\n * PowerPoint repair, and so is a relationship pointing at a part nobody wrote.\n *\n * The canonical spelling here is the zip entry name: `ppt/slides/slide1.xml`, no leading\n * slash, which is what {@link ZipWriter.add} takes. The other two are derivations —\n * {@link overrideName} for the content-types declaration, {@link targetFromPresentation} and\n * {@link targetFromPptSubpart} for a relationship target — so a path can only be spelled once\n * and then transformed, never re-typed in a second dialect.\n *\n * Indices are 1-based throughout, matching the OPC naming rather than the arrays that drive it.\n */\n\nimport { FONT_DATA_EXTENSION } from '../../embedded-fonts.js'\n\n/** `ppt/presentation.xml`, the package's root presentation part. */\nexport const PRESENTATION_PATH = 'ppt/presentation.xml'\n\n/** `ppt/slideMasters/slideMaster1.xml`. Exactly one master part is written. */\nexport const SLIDE_MASTER_PATH = 'ppt/slideMasters/slideMaster1.xml'\n\n/** `ppt/notesMasters/notesMaster1.xml`. Exactly one notes-master part is written. */\nexport const NOTES_MASTER_PATH = 'ppt/notesMasters/notesMaster1.xml'\n\n/** The `n`-th slide part. */\nexport function slidePath(n: number): string {\n\treturn `ppt/slides/slide${n}.xml`\n}\n\n/** The `n`-th slide-layout part. */\nexport function slideLayoutPath(n: number): string {\n\treturn `ppt/slideLayouts/slideLayout${n}.xml`\n}\n\n/**\n * The `n`-th notes-slide part. One is written for every slide, empty notes included, so the\n * index is the slide's own — see the assembler, which keeps the two enumerations in step.\n */\nexport function notesSlidePath(n: number): string {\n\treturn `ppt/notesSlides/notesSlide${n}.xml`\n}\n\n/**\n * The comment part for the `n`-th slide. Written only for slides that carry comments, so the\n * index is a slide number with gaps in it rather than a running count of comment parts.\n */\nexport function commentPath(n: number): string {\n\treturn `ppt/comments/comment${n}.xml`\n}\n\n/** The `n`-th embedded-font part, holding one whole face's raw bytes. */\nexport function fontPath(n: number): string {\n\treturn `ppt/fonts/font${n}.${FONT_DATA_EXTENSION}`\n}\n\n/**\n * The `.rels` part that carries `path`'s relationships: `ppt/slides/_rels/slide1.xml.rels`.\n * A part with no relationships has no such part; this only says where one would go.\n */\nexport function relsPath(path: string): string {\n\tconst cut = path.lastIndexOf('/')\n\treturn `${path.slice(0, cut)}/_rels/${path.slice(cut + 1)}.rels`\n}\n\n/**\n * `path` as `[Content_Types].xml` spells it in an `Override/@PartName`: the same path with the\n * leading slash ECMA-376 Part 2 requires of a part name.\n */\nexport function overrideName(path: string): string {\n\treturn `/${path}`\n}\n\n/**\n * `path` as a relationship target stated by a part directly under `ppt/` — presentation.xml,\n * whose rels reach `slides/slide1.xml` with no traversal at all.\n */\nexport function targetFromPresentation(path: string): string {\n\treturn path.slice('ppt/'.length)\n}\n\n/**\n * `path` as a relationship target stated by a part one level below `ppt/` — a slide, a layout,\n * a notes slide, the master: `../slides/slide1.xml`.\n */\nexport function targetFromPptSubpart(path: string): string {\n\treturn `../${targetFromPresentation(path)}`\n}\n\n/**\n * `path` as a relationship target stated by the part at `fromPath`, where both live one level\n * below `ppt/`.\n *\n * Two parts in the same directory name each other bare, and anything else traverses. That is\n * PowerPoint's own convention: in an authored deck a slide's rels reach another slide as\n * `slide3.xml` and its layout as `../slideLayouts/slideLayout7.xml`.\n *\n * It exists because the slide-link target used to be spelled `slide${n}.xml` unconditionally, by\n * a function that also serves layouts and the master. A relationship target resolves against the\n * part that states it, so from `ppt/slideLayouts/` that named `ppt/slideLayouts/slide1.xml` — a\n * part no package has. Deriving the target from the emitting part's own path means the question\n * is asked once, by the only code that can answer it.\n */\nexport function targetBetweenPptSubparts(fromPath: string, path: string): string {\n\tconst dir = fromPath.slice(0, fromPath.lastIndexOf('/') + 1)\n\treturn path.startsWith(dir) ? path.slice(dir.length) : targetFromPptSubpart(path)\n}\n","/**\n * ts-pptx: shared `Relationship` writers.\n *\n * A `.rels` part is mostly one-off entries, written where the part that needs\n * them is built. This module holds the ones **more than one part** writes, so\n * that the attribute set stays a single fact — a `Relationship` whose `Type` and\n * `TargetMode` disagree between two writers does not throw, it produces a link\n * PowerPoint silently drops.\n */\n\nimport { el, raw, voidEl, type XmlFmt } from '../oxml/el.js'\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport { HYPERLINK_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.js'\n\n/**\n * One `Relationship` entry.\n *\n * Three private copies of this used to sit in `gen/opc/root-rels.ts`, `gen/pres/\n * presentation-rels.ts` and `gen/chart/embed-xlsx.ts`, identical but for whether the caller\n * passed `rId3` or `3`, with seven more written inline in `gen/slide/`. The attribute set and\n * its order are byte-significant, so one writer is the only way they stay one fact.\n *\n * `target` is passed **unescaped** — `voidEl` escapes it on the way out. `gen/slide/object.ts`\n * depends on that: it computes the escaped form separately to compare a rel against the bytes\n * already emitted, and the two escapers must not drift.\n * @param {string | number} id - the relationship id; a number gets the `rId` prefix\n * @param {string} type - the relationship type URI\n * @param {string} target - the target, unescaped (a partname, or a URL with `targetMode`)\n * @param {object} [opts] - `targetMode` for an external target; `fmt` for byte-layout prefixes\n * @returns {string} the `Relationship` element\n */\nexport function relationshipEl(\n\tid: string | number,\n\ttype: string,\n\ttarget: string,\n\t// Read-only argument bag: both keys are consulted with `?.` below and nothing spreads it, so a\n\t// caller assembling one out of a value it may not have (`{ targetMode }`) is saying the same\n\t// thing as omitting the key, and the declaration says so.\n\topts?: { targetMode?: string | undefined; fmt?: XmlFmt | undefined }\n): string {\n\treturn voidEl(\n\t\t'Relationship',\n\t\t{ Id: typeof id === 'number' ? `rId${id}` : id, Type: type, Target: target, TargetMode: opts?.targetMode },\n\t\topts?.fmt\n\t)\n}\n\n/**\n * The `<Relationships>` wrapper around already-serialized entries.\n *\n * Only the tag name and its namespace are fixed here; `fmt` is passed straight through, because\n * the six `.rels` writers each indent differently and every one of those differences is in the\n * emitted bytes. Normalizing them would be a rewrite of five parts disguised as a cleanup.\n */\nexport function relationshipsEl(rels: readonly string[], fmt?: XmlFmt): string {\n\treturn el('Relationships', { xmlns: PACKAGE_REL_NS }, rels.map(raw), fmt)\n}\n\n/**\n * A complete `.rels` part: the XML declaration, a CRLF, then {@link relationshipsEl}.\n *\n * The embedded workbook's parts are the exception and use {@link relationshipsEl} directly —\n * they follow the declaration with nothing, and two of them end with a bare newline.\n */\nexport function relationshipsPart(rels: readonly string[], fmt?: XmlFmt): string {\n\treturn XML_DECL + CRLF + relationshipsEl(rels, fmt)\n}\n\n/**\n * A `Relationship` to a URL outside the package: the shape of every external\n * hyperlink, whether it hangs off a slide (`gen/slide/object.ts`) or off a notes\n * slide (`gen/slide/notes.ts`). `TargetMode=\"External\"` is what makes the target\n * a URI rather than a partname, so it is not optional.\n * @param {number} rId - the relationship id, without its `rId` prefix\n * @param {string} target - the URL, unescaped; `voidEl` escapes it for the attribute\n * @returns {string} the `Relationship` element\n */\nexport function externalHyperlinkRel(rId: number, target: string): string {\n\treturn relationshipEl(rId, HYPERLINK_REL, target, { targetMode: 'External' })\n}\n","/**\n * ts-pptx: the `<a:lvlNpPr>` list-style level and the theme-font `<a:defRPr>` inside it.\n *\n * A deck states its text defaults in four places — the presentation's `p:defaultTextStyle`, the\n * notesMaster's `p:notesStyle`, and the slide master's built-in and configured `p:txStyles` —\n * and all four write the same level element around the same run-property block: a `solidFill`\n * over one colour, then the `latin`/`ea`/`cs` triple pointing at one theme font family. They\n * differed in the size, in whether `b`/`i` were carried, and in whether the colour and the\n * Latin face were overridable, which is what the parameters here are.\n */\n\nimport { LEVEL_PPR_TAIL } from '../../constants-internal.js'\nimport { el, raw, voidEl, type XmlAttrs, type XmlChild } from '../oxml/el.js'\n\n/**\n * The `<a:defRPr>` a list-style level carries: `attrs` (the size, and `b`/`i`/`kern` where the\n * caller states them), then the fill and the three typeface slots.\n *\n * @param font - the theme font family the three slots point at (`mj` = major/heading, `mn` = minor/body)\n * @param attrs - the run-property attributes, in emission order; `null` values are omitted\n * @param colorXml - the colour element inside `<a:solidFill>`; defaults to `<a:schemeClr val=\"tx1\"/>`\n * @param latinXml - the `<a:latin>` element; defaults to the `font` family's own `+xx-lt` token\n */\nexport function themeFontDefRPr(font: 'mj' | 'mn', attrs: XmlAttrs, colorXml?: string, latinXml?: string): string {\n\treturn el('a:defRPr', attrs, [\n\t\traw(el('a:solidFill', null, raw(colorXml ?? voidEl('a:schemeClr', { val: 'tx1' })))),\n\t\traw(latinXml ?? voidEl('a:latin', { typeface: `+${font}-lt` })),\n\t\traw(voidEl('a:ea', { typeface: `+${font}-ea` })),\n\t\traw(voidEl('a:cs', { typeface: `+${font}-cs` })),\n\t])\n}\n\n/**\n * One `<a:lvlNpPr>`, with {@link LEVEL_PPR_TAIL} appended to the caller's attributes.\n *\n * The tail is the fixed `defTabSz`/`rtl`/`eaLnBrk`/`latinLnBrk`/`hangingPunct` run every level\n * in the deck carries; it sits last because attribute order is byte-significant.\n * @param level - the 1-based list level (`1` emits `a:lvl1pPr`)\n * @param attrs - the level's own attributes, ahead of the tail\n * @param children - the level's children, in schema order\n */\nexport function lvlPPr(level: number, attrs: XmlAttrs, children: XmlChild[]): string {\n\treturn el(`a:lvl${level}pPr`, { ...attrs, ...LEVEL_PPR_TAIL }, children)\n}\n","/**\n * ts-pptx: speaker-notes parts\n *\n * Everything for the notes side of a deck: reading a slide's notes text/runs,\n * building the notes-slide hyperlink rels, and emitting the notes-slide,\n * notes-master and their `.rels` parts.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport { prstGeomRect } from '../drawingml/geometry.js'\nimport { lvlPPr, themeFontDefRPr } from '../drawingml/list-style.js'\nimport { CRLF, LEVEL_MARGINS_EMU, SLDNUMFLDID, XML_DECL } from '../../constants-internal.js'\nimport type { TextProps } from '../../types/index.js'\nimport type { HyperlinkPropsInternal, PresSlideInternal, SlideRel } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { genXmlTextRun } from '../drawingml/text-run.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { NOTES_MASTER_REL, SLIDE_REL, THEME_REL } from '../../ooxml/rel-types.js'\nimport { externalHyperlinkRel, relationshipEl, relationshipsEl, relationshipsPart } from '../opc/rels.js'\nimport { hyperlinkRel } from '../define/hyperlinks.js'\nimport { OOXML_NS, PML_ROOT_NS } from '../../ooxml/namespaces.js'\nimport { DEFAULT_COLOR_MAP } from '../../ooxml/st-enums.js'\nimport { spTreeEl, xfrmEl } from './objects/shared.js'\nimport { NOTES_MASTER_PATH, slidePath, targetFromPptSubpart } from '../opc/part-paths.js'\n\n/**\n * Collect the speaker-notes runs for a slide (flattened across any number of `addNotes()` calls).\n * @param {PresSlideInternal} slide - the slide object\n * @return {TextProps[]} notes text runs in document order\n */\nfunction getNotesRuns(slide: PresSlideInternal): TextProps[] {\n\tconst runs: TextProps[] = []\n\tslide._slideObjects.forEach((obj) => {\n\t\tif (obj._type === SlideObjectType.notes && obj.text) runs.push(...obj.text)\n\t})\n\treturn runs\n}\n\n/** A slide's notes as its notes part is written: the relationships the part declares, and the runs that reference them. */\nexport interface NotesSlideContent {\n\t/** The notes hyperlink relationships, numbered from rId3. */\n\treadonly rels: SlideRel[]\n\t/** The notes runs, with each `url` link carrying the id it was given here. */\n\treadonly runs: TextProps[]\n}\n\n/**\n * Resolve a slide's notes runs against the notes part's own relationship ids.\n *\n * Notes rels use their own namespace, independent of `slide._rels` (which serialize to\n * `slideN.xml.rels`). The notes part always reserves rId1=notesMaster and rId2=slide, so\n * hyperlink rels are allocated starting at rId3.\n *\n * Pure. The ids go on copies of the runs, never on the caller's run or hyperlink objects: the same\n * hyperlink object can also sit on a slide run, whose id lives in the slide's namespace, and a deck\n * can be written twice or gain notes between writes. Each notes-part writer computes this once and\n * hands the result to both the body and the rels file, which is what keeps the two in agreement.\n *\n * Only external `url` hyperlinks are supported; any other target is left off the copy, and a\n * `slide` target says so.\n * @param {PresSlideInternal} slide - the slide object\n * @return {NotesSlideContent} the notes hyperlink relationships and the runs referencing them\n */\nexport function buildNotesSlideRels(slide: PresSlideInternal): NotesSlideContent {\n\tconst NOTES_REL_RESERVED = 2 // rId1=notesMaster, rId2=slide\n\tconst rels: SlideRel[] = []\n\tlet lastRid = NOTES_REL_RESERVED\n\n\tconst runs = getNotesRuns(slide).map((run): TextProps => {\n\t\tconst hyperlink: HyperlinkPropsInternal | undefined = run.options?.hyperlink\n\t\tif (!hyperlink || !run.options) return run\n\t\tif (!hyperlink.url) {\n\t\t\t// Dropped from the copy so the run serializer doesn't emit a dangling <a:hlinkClick> with no\n\t\t\t// matching relationship.\n\t\t\tif (hyperlink.slide)\n\t\t\t\twarn('notes/hyperlink-slide-unsupported', 'notes hyperlinks support `url` only (ignoring `slide` target)')\n\t\t\tconst { hyperlink: _unsupported, ...options } = run.options\n\t\t\treturn { ...run, options }\n\t\t}\n\n\t\tlastRid++\n\t\trels.push(hyperlinkRel(lastRid, hyperlink))\n\t\tconst linked: HyperlinkPropsInternal = { ...hyperlink, _rId: lastRid }\n\t\treturn { ...run, options: { ...run.options, hyperlink: linked } }\n\t})\n\n\treturn { rels, runs }\n}\n\n/**\n * Build the `<p:txBody>` paragraphs for the notes placeholder.\n * Runs are split into `<a:p>` paragraphs on newlines; each run is serialized with the standard\n * text-run generator so inline formatting and `<a:hlinkClick>` markup are emitted consistently.\n * @param {TextProps[]} runs - the notes runs, as {@link buildNotesSlideRels} resolved them\n * @return {string} XML string of `<a:p>` paragraphs\n */\nfunction genXmlNotesParagraphs(runs: TextProps[]): string {\n\tconst paragraphs: TextProps[][] = [[]]\n\n\truns.forEach((run) => {\n\t\tconst segments = String(run.text ?? '').split('\\n')\n\t\tsegments.forEach((segment, idx) => {\n\t\t\tif (idx > 0) paragraphs.push([]) // a newline starts a new paragraph\n\t\t\tconst text = segment.replace(/\\r/g, '')\n\t\t\tif (text !== '') paragraphs[paragraphs.length - 1]?.push({ text, options: run.options || {} })\n\t\t})\n\t})\n\n\treturn paragraphs\n\t\t.map((runs) =>\n\t\t\tel('a:p', null, [\n\t\t\t\traw(runs.map((run) => genXmlTextRun(run)).join('')),\n\t\t\t\traw(voidEl('a:endParaRPr', { lang: 'en-US', dirty: 0 })),\n\t\t\t])\n\t\t)\n\t\t.join('')\n}\n\n/**\n * PowerPoint's creation-id extension, on the `p:cSld` of both notes parts.\n *\n * The value is a fixed literal, and that is the point of naming it: it looks like data — a\n * per-deck identifier PowerPoint would vary — so left inline in two places, someone eventually\n * changes one of them. It is deliberately constant, which is what keeps the two notes parts\n * byte-identical across builds.\n */\nconst NOTES_CREATION_ID = 1024086991\n\n/** The `p:extLst` carrying {@link NOTES_CREATION_ID}, identical on the notes master and notes slide. */\nfunction notesExtLst(): string {\n\treturn el(\n\t\t'p:extLst',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:ext',\n\t\t\t\t{ uri: '{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}' },\n\t\t\t\traw(voidEl('p14:creationId', { 'xmlns:p14': OOXML_NS.p14, val: NOTES_CREATION_ID }))\n\t\t\t)\n\t\t)\n\t)\n}\n\n/**\n * Generate XML for Notes Master (notesMaster1.xml)\n * @returns {string} XML\n */\nexport function makeXmlNotesMaster(): string {\n\tconst xfrmOffExt = (x: number, y: number, cx: number, cy: number): string => xfrmEl('a:xfrm', { x, y, cx, cy })\n\tconst rectGeom = prstGeomRect()\n\tconst spLocks = (attrs: Record<string, number>): string => el('p:cNvSpPr', null, raw(voidEl('a:spLocks', attrs)))\n\tconst nvPr = (phAttrs: Record<string, string | number>): string => el('p:nvPr', null, raw(voidEl('p:ph', phAttrs)))\n\tconst bodyPr = (attrs: Record<string, string | number>): string => voidEl('a:bodyPr', attrs)\n\tconst lstStyleLvl1 = (algn: string): string =>\n\t\tel('a:lstStyle', null, raw(el('a:lvl1pPr', { algn }, raw(voidEl('a:defRPr', { sz: 1200 })))))\n\tconst emptyPara = el('a:p', null, raw(voidEl('a:endParaRPr', { lang: 'en-US' })))\n\n\tconst header = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 2, name: 'Header Placeholder 1' })),\n\t\t\t\traw(spLocks({ noGrp: 1 })),\n\t\t\t\traw(nvPr({ type: 'hdr', sz: 'quarter' })),\n\t\t\t])\n\t\t),\n\t\traw(el('p:spPr', null, [raw(xfrmOffExt(0, 0, 2971800, 458788)), raw(rectGeom)])),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0 })),\n\t\t\t\traw(lstStyleLvl1('l')),\n\t\t\t\traw(emptyPara),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst date = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 3, name: 'Date Placeholder 2' })),\n\t\t\t\traw(spLocks({ noGrp: 1 })),\n\t\t\t\traw(nvPr({ type: 'dt', idx: 1 })),\n\t\t\t])\n\t\t),\n\t\traw(el('p:spPr', null, [raw(xfrmOffExt(3884613, 0, 2971800, 458788)), raw(rectGeom)])),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0 })),\n\t\t\t\traw(lstStyleLvl1('r')),\n\t\t\t\traw(\n\t\t\t\t\tel('a:p', null, [\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel('a:fld', { id: '{5282F153-3F37-0F45-9E97-73ACFA13230C}', type: 'datetimeFigureOut' }, [\n\t\t\t\t\t\t\t\traw(voidEl('a:rPr', { lang: 'en-US' })),\n\t\t\t\t\t\t\t\traw(el('a:t', null, '7/23/19')),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t),\n\t\t\t\t\t\traw(voidEl('a:endParaRPr', { lang: 'en-US' })),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst slideImg = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 4, name: 'Slide Image Placeholder 3' })),\n\t\t\t\traw(spLocks({ noGrp: 1, noRot: 1, noChangeAspect: 1 })),\n\t\t\t\traw(nvPr({ type: 'sldImg', idx: 2 })),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:spPr', null, [\n\t\t\t\traw(xfrmOffExt(685800, 1143000, 5486400, 3086100)),\n\t\t\t\traw(rectGeom),\n\t\t\t\traw(voidEl('a:noFill')),\n\t\t\t\traw(el('a:ln', { w: 12700 }, raw(el('a:solidFill', null, raw(voidEl('a:prstClr', { val: 'black' })))))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0, anchor: 'ctr' })),\n\t\t\t\traw(voidEl('a:lstStyle')),\n\t\t\t\traw(emptyPara),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst notesPlaceholder = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 5, name: 'Notes Placeholder 4' })),\n\t\t\t\traw(spLocks({ noGrp: 1 })),\n\t\t\t\traw(nvPr({ type: 'body', sz: 'quarter', idx: 3 })),\n\t\t\t])\n\t\t),\n\t\traw(el('p:spPr', null, [raw(xfrmOffExt(685800, 4400550, 5486400, 3600450)), raw(rectGeom)])),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0 })),\n\t\t\t\traw(voidEl('a:lstStyle')),\n\t\t\t\traw(\n\t\t\t\t\t['Click to edit Master text styles', 'Second level', 'Third level', 'Fourth level', 'Fifth level']\n\t\t\t\t\t\t.map((text, lvl) =>\n\t\t\t\t\t\t\tel('a:p', null, [\n\t\t\t\t\t\t\t\traw(voidEl('a:pPr', { lvl })),\n\t\t\t\t\t\t\t\traw(el('a:r', null, [raw(voidEl('a:rPr', { lang: 'en-US' })), raw(el('a:t', null, text))])),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('')\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst footer = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 6, name: 'Footer Placeholder 5' })),\n\t\t\t\traw(spLocks({ noGrp: 1 })),\n\t\t\t\traw(nvPr({ type: 'ftr', sz: 'quarter', idx: 4 })),\n\t\t\t])\n\t\t),\n\t\traw(el('p:spPr', null, [raw(xfrmOffExt(0, 8685213, 2971800, 458787)), raw(rectGeom)])),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0, anchor: 'b' })),\n\t\t\t\traw(lstStyleLvl1('l')),\n\t\t\t\traw(emptyPara),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst slideNum = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 7, name: 'Slide Number Placeholder 6' })),\n\t\t\t\traw(spLocks({ noGrp: 1 })),\n\t\t\t\traw(nvPr({ type: 'sldNum', sz: 'quarter', idx: 5 })),\n\t\t\t])\n\t\t),\n\t\traw(el('p:spPr', null, [raw(xfrmOffExt(3884613, 8685213, 2971800, 458787)), raw(rectGeom)])),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(bodyPr({ vert: 'horz', lIns: 91440, tIns: 45720, rIns: 91440, bIns: 45720, rtlCol: 0, anchor: 'b' })),\n\t\t\t\traw(lstStyleLvl1('r')),\n\t\t\t\traw(\n\t\t\t\t\tel('a:p', null, [\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel('a:fld', { id: '{CE5E9CC1-C706-0F49-92D6-E571CC5EEA8F}', type: 'slidenum' }, [\n\t\t\t\t\t\t\t\traw(voidEl('a:rPr', { lang: 'en-US' })),\n\t\t\t\t\t\t\t\traw(el('a:t', null, '‹#›')),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t),\n\t\t\t\t\t\traw(voidEl('a:endParaRPr', { lang: 'en-US' })),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst spTree = spTreeEl([header, date, slideImg, notesPlaceholder, footer, slideNum])\n\n\tconst extLst = notesExtLst()\n\n\tconst cSld = el('p:cSld', null, [\n\t\traw(el('p:bg', null, raw(el('p:bgRef', { idx: 1001 }, raw(voidEl('a:schemeClr', { val: 'bg1' })))))),\n\t\traw(spTree),\n\t\traw(extLst),\n\t])\n\n\tconst clrMap = voidEl('p:clrMap', DEFAULT_COLOR_MAP)\n\n\tconst notesStyleLevel = (n: number, marL: number): string =>\n\t\tlvlPPr(n, { marL, algn: 'l' }, [raw(themeFontDefRPr('mn', { sz: 1200, kern: 1200 }))])\n\tconst notesStyle = el(\n\t\t'p:notesStyle',\n\t\tnull,\n\t\traw(LEVEL_MARGINS_EMU.map((marL, i) => notesStyleLevel(i + 1, marL)).join(''))\n\t)\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:notesMaster',\n\t\t\t{\n\t\t\t\t...PML_ROOT_NS,\n\t\t\t},\n\t\t\t[raw(cSld), raw(clrMap), raw(notesStyle)]\n\t\t)\n\t)\n}\n\n/**\n * Creates Notes Slide (`ppt/notesSlides/notesSlide1.xml`)\n * @param {PresSlideInternal} slide - the slide object to transform into XML\n * @param {NotesSlideContent} notes - the slide's notes, from {@link buildNotesSlideRels}; the same\n * value has to reach {@link makeXmlNotesSlideRel}\n * @return {string} XML\n */\nexport function makeXmlNotesSlide(slide: PresSlideInternal, notes: NotesSlideContent): string {\n\treturn makeXmlNotesSlideSkeleton(genXmlNotesParagraphs(notes.runs), slide._slideNum)\n}\n\n/**\n * The notes slide's fixed frame, with the only two slide-dependent strings passed in.\n *\n * A notes slide is the same three placeholders every time — the thumbnail (`sldImg`),\n * the notes body, and the slide-number field — so everything except the body's\n * paragraphs and the cached slide number is a constant. It is a parameter of its own\n * because the read model authors notes onto a *loaded* deck (`Slide.addNotes`), where\n * there is no `PresSlideInternal` to serialize but the part must come out identical:\n * a second private copy of this frame is exactly the drift `src/ooxml/` exists to\n * prevent (see docs/contributing/architecture.md).\n * @param {string} bodyParagraphsXml - `a:p` children of the body placeholder's `p:txBody`\n * @param {number} slideNum - cached value of the slide-number `a:fld`\n * @return {string} XML\n */\nexport function makeXmlNotesSlideSkeleton(bodyParagraphsXml: string, slideNum: number): string {\n\tconst slideImgPh = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 2, name: 'Slide Image Placeholder 1' })),\n\t\t\t\traw(el('p:cNvSpPr', null, raw(voidEl('a:spLocks', { noGrp: 1, noRot: 1, noChangeAspect: 1 })))),\n\t\t\t\traw(el('p:nvPr', null, raw(voidEl('p:ph', { type: 'sldImg' })))),\n\t\t\t])\n\t\t),\n\t\traw(voidEl('p:spPr')),\n\t])\n\n\tconst notesPh = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 3, name: 'Notes Placeholder 2' })),\n\t\t\t\traw(el('p:cNvSpPr', null, raw(voidEl('a:spLocks', { noGrp: 1 })))),\n\t\t\t\traw(el('p:nvPr', null, raw(voidEl('p:ph', { type: 'body', idx: 1 })))),\n\t\t\t])\n\t\t),\n\t\traw(voidEl('p:spPr')),\n\t\traw(el('p:txBody', null, [raw(voidEl('a:bodyPr')), raw(voidEl('a:lstStyle')), raw(bodyParagraphsXml)])),\n\t])\n\n\tconst slideNumPh = el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 4, name: 'Slide Number Placeholder 3' })),\n\t\t\t\traw(el('p:cNvSpPr', null, raw(voidEl('a:spLocks', { noGrp: 1 })))),\n\t\t\t\traw(el('p:nvPr', null, raw(voidEl('p:ph', { type: 'sldNum', sz: 'quarter', idx: 10 })))),\n\t\t\t])\n\t\t),\n\t\traw(voidEl('p:spPr')),\n\t\traw(\n\t\t\tel('p:txBody', null, [\n\t\t\t\traw(voidEl('a:bodyPr')),\n\t\t\t\traw(voidEl('a:lstStyle')),\n\t\t\t\traw(\n\t\t\t\t\tel('a:p', null, [\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel('a:fld', { id: SLDNUMFLDID, type: 'slidenum' }, [\n\t\t\t\t\t\t\t\traw(voidEl('a:rPr', { lang: 'en-US' })),\n\t\t\t\t\t\t\t\traw(el('a:t', null, slideNum)),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t),\n\t\t\t\t\t\traw(voidEl('a:endParaRPr', { lang: 'en-US' })),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst spTree = spTreeEl([slideImgPh, notesPh, slideNumPh])\n\n\tconst extLst = notesExtLst()\n\n\tconst cSld = el('p:cSld', null, [raw(spTree), raw(extLst)])\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:notes',\n\t\t\t{\n\t\t\t\t...PML_ROOT_NS,\n\t\t\t},\n\t\t\t[raw(cSld), raw(el('p:clrMapOvr', null, raw(voidEl('a:masterClrMapping'))))]\n\t\t)\n\t)\n}\n\n/**\n * Generates XML string for a notes-slide relation file (`ppt/notesSlides/_rels/notesSlideN.xml.rels`).\n * rId1=notesMaster and rId2=slide are always reserved; any notes hyperlink rels follow (rId3+).\n * @param {NotesSlideContent} notes - the slide's notes, the value {@link makeXmlNotesSlide} was given\n * @param {number} slideNumber - 1-indexed slide number the notes part belongs to\n * @return {string} XML\n */\nexport function makeXmlNotesSlideRel(notes: NotesSlideContent, slideNumber: number): string {\n\t// Flat: the hyperlink rels run together on one line, after the indented rId1/rId2 pair.\n\tconst hlinkRels = notes.rels.map((rel) => externalHyperlinkRel(rel.rId, rel.Target)).join('')\n\n\treturn (\n\t\tXML_DECL +\n\t\trelationshipsEl(\n\t\t\t[\n\t\t\t\trelationshipEl(1, NOTES_MASTER_REL, targetFromPptSubpart(NOTES_MASTER_PATH)),\n\t\t\t\trelationshipEl(2, SLIDE_REL, targetFromPptSubpart(slidePath(slideNumber))),\n\t\t\t\t// Always a child, even when empty, so its `childPrefix` indent is still emitted.\n\t\t\t\thlinkRels,\n\t\t\t],\n\t\t\t// Two quirks kept verbatim: this part alone follows XML_DECL with a bare `\\n`\n\t\t\t// rather than CRLF, and the closing tag hugs the last child with no prefix.\n\t\t\t{ openPrefix: '\\n\\t\\t', childPrefix: '\\n\\t\\t\\t', closePrefix: '' }\n\t\t)\n\t)\n}\n\n/**\n * Creates `ppt/notesMasters/_rels/notesMaster1.xml.rels`\n * @return {string} XML\n */\nexport function makeXmlNotesMasterRel(): string {\n\treturn relationshipsPart(\n\t\t[relationshipEl(1, THEME_REL, '../theme/theme2.xml')],\n\t\t// The closing tag is indented to child depth, not parent depth — as emitted today.\n\t\t{ childPrefix: '\\n\\t\\t', closePrefix: '\\n\\t\\t' }\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,4BAA4B,OACjC,IAAI,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,GAAG,GAAG,IAAI,GAAG,KAAM,IAAI,GAAG,KAAM,EAAE,GAAA,CAAI,OAAO,YAAY;;AAGpH,MAAM,sBAAsB,IAAI,OAAO,yBAAyB,GAAG;;AAGnE,MAAM,oBAAoB,IAAI,OAAO,uBAAuB;;AAG5D,SAAgB,mBAAmB,OAAwB;CAC1D,OAAO,kBAAkB,KAAK,KAAK;AACpC;;;;;;;;;;;AAYA,SAAgB,kBAAkB,KAA8B;CAE/D,IAAI,OAAO,QAAQ,eAAe,OAAO,MAAM,OAAO;CAEtD,OAAO,IACL,SAAS,C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