@shbernal/ts-pptx 3.2.0 → 3.4.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 (77) hide show
  1. package/README.md +19 -20
  2. package/dist/{autopage-QQyfRtoK.js → autopage-BYlTzX-l.js} +21 -17
  3. package/dist/autopage-BYlTzX-l.js.map +1 -0
  4. package/dist/browser.d.ts +6 -6
  5. package/dist/browser.js +11 -12
  6. package/dist/browser.js.map +1 -1
  7. package/dist/{diagnostics-Chjz_4_Q.d.ts → diagnostics-B0OmTOoz.d.ts} +65 -16
  8. package/dist/diagnostics-B0OmTOoz.d.ts.map +1 -0
  9. package/dist/{diagnostics-DYQC7xLV.js → diagnostics-CPVADSL1.js} +0 -0
  10. package/dist/{diagnostics-DYQC7xLV.js.map → diagnostics-CPVADSL1.js.map} +1 -1
  11. package/dist/{enums-CoXnxiCI.d.ts → enums-CvRYniUA.d.ts} +13 -3
  12. package/dist/{enums-CoXnxiCI.d.ts.map → enums-CvRYniUA.d.ts.map} +1 -1
  13. package/dist/{errors-BVLCFr-t.d.ts → errors-fB1KDJKQ.d.ts} +5 -5
  14. package/dist/{errors-BVLCFr-t.d.ts.map → errors-fB1KDJKQ.d.ts.map} +1 -1
  15. package/dist/{fit-DhMbQG5O.js → fit-TjpNbMru.js} +0 -0
  16. package/dist/fit-TjpNbMru.js.map +1 -0
  17. package/dist/{html-dom-DajBuobe.js → html-dom-yUSdCExA.js} +5 -6
  18. package/dist/html-dom-yUSdCExA.js.map +1 -0
  19. package/dist/html.d.ts +3 -3
  20. package/dist/html.js +1 -1
  21. package/dist/index.d.ts +6 -6
  22. package/dist/index.js +16 -34
  23. package/dist/index.js.map +1 -1
  24. package/dist/inspect.d.ts +1 -1
  25. package/dist/inspect.js +5 -4
  26. package/dist/inspect.js.map +1 -1
  27. package/dist/math.d.ts +1 -1
  28. package/dist/measure.d.ts +96 -6
  29. package/dist/measure.d.ts.map +1 -1
  30. package/dist/measure.js +2 -2
  31. package/dist/{st-enums-evQG2A7Z.js → namespaces-Sy_m7Nhd.js} +318 -209
  32. package/dist/namespaces-Sy_m7Nhd.js.map +1 -0
  33. package/dist/node.d.ts +6 -6
  34. package/dist/node.js +7 -20
  35. package/dist/node.js.map +1 -1
  36. package/dist/notes-bWApshah.js +1727 -0
  37. package/dist/notes-bWApshah.js.map +1 -0
  38. package/dist/{pres-C-EU3SkN.d.ts → pres-Dybf7ZUl.d.ts} +4 -4
  39. package/dist/{pres-C-EU3SkN.d.ts.map → pres-Dybf7ZUl.d.ts.map} +1 -1
  40. package/dist/{presentation-CxnUVhK9.js → presentation-3rAKKRfm.js} +1247 -743
  41. package/dist/presentation-3rAKKRfm.js.map +1 -0
  42. package/dist/{presentation-Osx1cDdJ.d.ts → presentation-types-D7cgT-eG.d.ts} +867 -24
  43. package/dist/presentation-types-D7cgT-eG.d.ts.map +1 -0
  44. package/dist/read.d.ts +4 -5
  45. package/dist/read.d.ts.map +1 -1
  46. package/dist/read.js +3 -3
  47. package/dist/script.d.ts +2 -2
  48. package/dist/script.d.ts.map +1 -1
  49. package/dist/script.js +0 -0
  50. package/dist/script.js.map +1 -1
  51. package/dist/{shapes-DoJBPrwN.js → shapes-Dyw5bxwO.js} +371 -52
  52. package/dist/shapes-Dyw5bxwO.js.map +1 -0
  53. package/dist/{slide-BTfn1Pyp.d.ts → slide-B_aInw3N.d.ts} +246 -182
  54. package/dist/slide-B_aInw3N.d.ts.map +1 -0
  55. package/dist/{text-C4P9MNdf.js → text-DSN3anEh.js} +3609 -4932
  56. package/dist/text-DSN3anEh.js.map +1 -0
  57. package/dist/{units-internal-CR8s8YQa.js → units-internal-DNvK2I6o.js} +207 -35
  58. package/dist/units-internal-DNvK2I6o.js.map +1 -0
  59. package/dist/zip.d.ts +2 -2
  60. package/package.json +36 -27
  61. package/dist/autopage-QQyfRtoK.js.map +0 -1
  62. package/dist/diagnostics-Chjz_4_Q.d.ts.map +0 -1
  63. package/dist/embedded-fonts-MaynAHa9.js +0 -94
  64. package/dist/embedded-fonts-MaynAHa9.js.map +0 -1
  65. package/dist/fit-DhMbQG5O.js.map +0 -1
  66. package/dist/html-dom-DajBuobe.js.map +0 -1
  67. package/dist/presentation-CxnUVhK9.js.map +0 -1
  68. package/dist/presentation-Osx1cDdJ.d.ts.map +0 -1
  69. package/dist/presentation-types-Dj4riuDs.d.ts +0 -538
  70. package/dist/presentation-types-Dj4riuDs.d.ts.map +0 -1
  71. package/dist/shapes-DoJBPrwN.js.map +0 -1
  72. package/dist/slide-BTfn1Pyp.d.ts.map +0 -1
  73. package/dist/st-enums-evQG2A7Z.js.map +0 -1
  74. package/dist/text-C4P9MNdf.js.map +0 -1
  75. package/dist/units-C7QM1KgH.js +0 -144
  76. package/dist/units-C7QM1KgH.js.map +0 -1
  77. package/dist/units-internal-CR8s8YQa.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"text-C4P9MNdf.js","names":["neverLineCap","relationship","PROP","NS","relationship"],"sources":["../src/media/content-type.ts","../src/gen/define/background.ts","../src/gen/utils.ts","../src/gen/oxml/el.ts","../src/gen/drawingml/color.ts","../src/gen/drawingml/effect.ts","../src/gen/define/chart.ts","../src/gen/define/comment.ts","../src/gen/define/object-name.ts","../src/gen/define/connector.ts","../src/gen/define/image.ts","../src/gen/define/hyperlinks.ts","../src/gen/define/shape.ts","../src/gen/define/text.ts","../src/gen/define/group.ts","../src/gen/define/media.ts","../src/gen/define/preview-image.ts","../src/gen/define/model3d.ts","../src/gen/define/notes.ts","../src/gen/define/ole.ts","../src/gen/define/table.ts","../src/gen/define/zoom.ts","../src/slide.ts","../src/gen/drawingml/fill.ts","../src/gen/drawingml/line.ts","../src/gen/chart/data-refs.ts","../src/gen/chart/chart-parts.ts","../src/gen/chart/chart-axes.ts","../src/gen/chart/plot-cat-axis.ts","../src/gen/chart/plot-scatter.ts","../src/gen/chart/plot-bubble.ts","../src/gen/chart/plot-pie.ts","../src/gen/chart/plot-stock.ts","../src/gen/chart/plot-surface.ts","../src/gen/chart/chart-xml.ts","../src/gen/chart/chartex-data.ts","../src/gen/chart/chartex-xml.ts","../src/gen/chart/chartex-style.ts","../src/gen/chart/embed-xlsx.ts","../src/gen/define/master.ts","../src/gen/define/placeholder.ts","../src/gen/media.ts","../src/gen/prepare.ts","../src/gen/slide/shape-ids.ts","../src/gen/anim/animation.ts","../src/gen/anim/timing.ts","../src/gen/anim/transition.ts","../src/gen/drawingml/clamp.ts","../src/gen/drawingml/locks.ts","../src/gen/slide/objects/shared.ts","../src/gen/drawingml/math.ts","../src/gen/drawingml/text-run.ts","../src/gen/drawingml/text-body.ts","../src/gen/slide/objects/chart.ts","../src/gen/slide/objects/connector.ts","../src/gen/drawingml/geometry.ts","../src/gen/drawingml/image.ts","../src/gen/slide/objects/image.ts","../src/gen/slide/objects/media.ts","../src/gen/slide/objects/model3d.ts","../src/gen/slide/objects/ole.ts","../src/gen/drawingml/table-border.ts","../src/gen/drawingml/table-cell3d.ts","../src/gen/slide/objects/table.ts","../src/gen/slide/objects/text.ts","../src/gen/slide/objects/zoom.ts","../src/gen/slide/object.ts","../src/gen/slide/slide.ts","../src/gen/slide/notes.ts","../src/gen/pres/theme.ts","../src/gen/opc/app.ts","../src/gen/opc/content-types.ts","../src/gen/opc/core.ts","../src/gen/opc/custom-props.ts","../src/gen/opc/root-rels.ts","../src/gen/pres/presentation-rels.ts","../src/gen/pres/presentation.ts","../src/gen/pres/table-styles.ts","../src/gen/slide/comments.ts","../src/gen/slide/layout.ts","../src/gen/slide/master.ts","../src/package/assemble.ts","../src/presentation.ts","../src/clip.ts","../src/types/text.ts"],"sourcesContent":["/**\n * OPC content types for embedded media parts, keyed by file extension.\n *\n * Both mappings reproduce what PowerPoint itself authors rather than the IANA-preferred\n * spelling — a package that disagrees (e.g. `audio/mp3` for an `.mp3`) is the kind of thing\n * PowerPoint offers to repair.\n */\n\n/**\n * Map an image file extension to its OOXML content type.\n * Inverse of the read-side `IMAGE_EXTENSION_BY_CONTENT_TYPE` (src/read/api/shapes/picture.ts):\n * EMF/WMF use the `x-`-prefixed forms PowerPoint authors (and that the read side\n * expects), `jpg`/`jpeg` normalize to `image/jpeg`, and `svg` to `image/svg+xml`.\n * Only the content type is derived here; the file extension (used for the media\n * Target filename) is left to the caller.\n * @param {string} extn - image file extension (e.g. `png`, `jpg`, `emf`)\n * @returns {string} OOXML content type (e.g. `image/png`, `image/x-emf`)\n */\nexport function imageContentType(extn: string): string {\n\tswitch ((extn || '').toLowerCase()) {\n\t\tcase 'emf':\n\t\t\treturn 'image/x-emf'\n\t\tcase 'wmf':\n\t\t\treturn 'image/x-wmf'\n\t\tcase 'svg':\n\t\t\treturn 'image/svg+xml'\n\t\tcase 'jpg':\n\t\tcase 'jpeg':\n\t\t\treturn 'image/jpeg'\n\t\tdefault:\n\t\t\treturn 'image/' + (extn || '').toLowerCase()\n\t}\n}\n\n/**\n * Resolve the file extension an embedded image part should carry, from the caller's source.\n *\n * A `data:` URI states its mime type outright, so it wins over `path`: the bytes are the thing\n * being embedded, and a caller may supply them with no path at all (or with a path whose\n * extension disagrees with the payload). The extension chosen here names the media part *and*,\n * via {@link imageContentType}, decides the `<Default>` the package declares for it — so\n * getting it from a placeholder path is how a deck ends up declaring `image/png` over SVG\n * bytes, which is exactly the mismatch PowerPoint offers to \"repair\".\n *\n * `image/svg+xml` needs its own test because the `\\w+` mime capture stops at the `+`. The\n * result is always lower-cased, so a `data:image/PNG;` source names its part the same way a\n * `photo.PNG` path does.\n * @param {string} path - caller-supplied path/URL (may be empty); query and fragment are stripped\n * @param {string} data - caller-supplied `data:`/base64 payload (may be empty)\n * @returns {string} file extension, no dot (e.g. `png`, `jpeg`, `svg`)\n */\nexport function imageExtensionForSource(path: string, data: string): string {\n\t// NOTE: Split to address URLs with params (eg: `path/brent.jpg?someParam=true`)\n\tconst strPath = path || ''\n\tconst strData = data || ''\n\tconst pathFile = strPath.slice(strPath.lastIndexOf('/') + 1).split('?')[0] || ''\n\tconst pathExtn = ((pathFile.split('.').pop() || 'png').split('#')[0] || 'png').toLowerCase()\n\n\t// Pre-encoded images can be whatever mime-type they want (and good for them!)\n\tconst mimeMatch = /image\\/(\\w+);/.exec(strData)\n\tif (strData && mimeMatch?.[1]) return mimeMatch[1].toLowerCase()\n\tif (strData.toLowerCase().includes('image/svg+xml')) return 'svg'\n\treturn pathExtn\n}\n\n/**\n * Map an audio content type's subtype back to the file extension a media part should use.\n *\n * Needed because a caller supplying sound bytes as a `data:` URI states a *content type*\n * (`data:audio/x-wav;base64,…`), while the media part needs a *filename*. Taking the subtype\n * verbatim produces `audio1.x-wav` — legal, since the package would then declare a matching\n * `<Default Extension=\"x-wav\"/>`, but a file type that does not exist and that no other tool\n * recognises. `audio/x-wav` in particular is not an edge case: it is exactly what PowerPoint\n * authors for an embedded transition sound, so it arrives on any deck read back in.\n *\n * Only the spellings that are *not* already an extension are listed; anything else (`ogg`,\n * `flac`, `aac`, …) is its own extension and falls through. Read against {@link avContentType},\n * which maps the same pairs in the other direction.\n */\nexport function audioExtensionForSubtype(subtype: string): string {\n\tswitch ((subtype || '').toLowerCase()) {\n\t\tcase 'x-wav':\n\t\tcase 'wave':\n\t\tcase 'vnd.wave':\n\t\t\treturn 'wav'\n\t\tcase 'mpeg':\n\t\t\treturn 'mp3'\n\t\tcase 'x-ms-wma':\n\t\t\treturn 'wma'\n\t\tcase 'mp4':\n\t\t\treturn 'm4a'\n\t\tdefault:\n\t\t\treturn (subtype || '').toLowerCase()\n\t}\n}\n\n/**\n * Resolve the OPC content type for an embedded audio/video part by file extension,\n * matching what PowerPoint authors (e.g. `mp3` → `audio/mpeg`, not `audio/mp3`).\n * The `mtype` disambiguates extensions Office maps differently per kind and seeds\n * the `mtype/extn` fallback for anything unlisted.\n * @param {string} extn - media file extension (no dot), case-insensitive\n * @param {'audio' | 'video'} mtype - whether the item is audio or video\n */\nexport function avContentType(extn: string, mtype: 'audio' | 'video'): string {\n\tswitch ((extn || '').toLowerCase()) {\n\t\t// video\n\t\tcase 'mp4':\n\t\t\treturn mtype === 'audio' ? 'audio/mp4' : 'video/mp4'\n\t\tcase 'm4v':\n\t\t\treturn 'video/mp4'\n\t\tcase 'mov':\n\t\t\treturn 'video/quicktime'\n\t\tcase 'avi':\n\t\t\treturn 'video/avi'\n\t\tcase 'wmv':\n\t\t\treturn 'video/x-ms-wmv'\n\t\tcase 'mpg':\n\t\tcase 'mpeg':\n\t\t\treturn mtype === 'audio' ? 'audio/mpeg' : 'video/mpeg'\n\t\tcase 'ogv':\n\t\t\treturn 'video/ogg'\n\t\tcase 'webm':\n\t\t\treturn 'video/webm'\n\t\t// audio\n\t\tcase 'mp3':\n\t\t\treturn 'audio/mpeg'\n\t\tcase 'm4a':\n\t\t\treturn 'audio/mp4'\n\t\tcase 'wav':\n\t\t\treturn 'audio/x-wav' // PowerPoint authors the x- form (e.g. embedded transition sounds)\n\t\tcase 'wma':\n\t\t\treturn 'audio/x-ms-wma'\n\t\tcase 'aac':\n\t\t\treturn 'audio/aac'\n\t\tcase 'oga':\n\t\tcase 'ogg':\n\t\t\treturn 'audio/ogg'\n\t\tcase 'flac':\n\t\t\treturn 'audio/flac'\n\t\tdefault:\n\t\t\treturn mtype + '/' + (extn || '').toLowerCase()\n\t}\n}\n","/**\n * ts-pptx: Background Definition\n *\n * Registers an `addBackground()` image as a slide media rel (color backgrounds carry no rel);\n * the `<p:bg>` XML is emitted later at slide / layout serialize time.\n */\nimport type { BackgroundProps } from '../../types/index.js'\nimport type { SlideLayoutInternal } from '../../types/internal.js'\nimport { imageContentType, imageExtensionForSource } from '../../media/content-type.js'\n\n/**\n * Reduce a slide/layout name to something safe to embed in a media part name.\n *\n * A background rel's `Target` is used twice over: it is written into the `.rels` part *and*,\n * with `..` swapped for `ppt`, used verbatim as the ZIP entry name (`presentation.ts`). A layout's\n * name is caller-supplied (`defineSlideMaster({ title })`), so without this the caller can put\n * arbitrary characters into an OPC part name. XML-escaping does not help — the escaping is\n * undone before the target is resolved, and the ZIP entry is never escaped at all. Demonstrated\n * breakage before this was added:\n * - `%` produced an invalid percent-escape, so the target would not decode at all\n * - `?` and `#` began a query/fragment, truncating the resolved path (`what?now-image-1.png`\n * resolves to `ppt/media/what`, which is not in the package)\n * - `/` silently pushed the media into a subdirectory\n *\n * So the safe set is the URI \"unreserved\" characters. Runs of anything else collapse to a\n * single `-` (subsuming the whitespace handling this replaces), leading/trailing punctuation is\n * trimmed, and a name left empty — including an all-non-ASCII one — falls back to `media`.\n * The result is cosmetic: it names the media part, and nothing resolves a layout by it.\n */\nfunction sanitizeMediaNamePart(name: string): string {\n\tconst safe = name\n\t\t.replace(/[^A-Za-z0-9._-]+/g, '-')\n\t\t.replace(/^[-.]+/, '')\n\t\t.replace(/[-.]+$/, '')\n\treturn safe || 'media'\n}\n\n/**\n * Adds a background image or color to a slide definition.\n * @param {BackgroundProps} props - color string or an object with image definition\n * @param {PresSlideInternal} target - slide object that the background is set to\n */\nexport function addBackgroundDefinition(props: BackgroundProps | undefined, target: SlideLayoutInternal): void {\n\t// Handle media\n\tif (props && (props.path || props.data)) {\n\t\t// The `data:` mime wins over `path`, as it does for `addImage()`: a background supplied as\n\t\t// bytes alone used to fall back on the `preencoded.png` placeholder path and declare\n\t\t// `image/png` no matter what it actually carried, so `{ data: 'data:image/svg+xml;…' }`\n\t\t// shipped SVG bytes in a part the package announced as PNG.\n\t\tlet strImgExtn = imageExtensionForSource(props.path || '', props.data || '')\n\t\tif (strImgExtn === 'jpg') strImgExtn = 'jpeg' // base64-encoded jpg's come out as \"data:image/jpeg;base64,/9j/[...]\", so correct exttnesion to avoid content warnings at PPT startup\n\t\t// Allow the use of only the data key (`path` isnt reqd). Kept local: `props` is the\n\t\t// caller's own object on the `slide.background =` path, not a clone.\n\t\tconst strImgPath = props.path || `preencoded.${strImgExtn}`\n\n\t\ttarget._relsMedia = target._relsMedia || []\n\t\tconst intRels = target._relsMedia.length + 1\n\t\t// NOTE: `Target` cannot have spaces (eg:\"Slide 1-image-1.jpg\") or a \"presentation is corrupt\"\n\t\t// warning comes up — `sanitizeMediaNamePart` covers that case along with the rest.\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strImgPath,\n\t\t\ttype: imageContentType(strImgExtn),\n\t\t\textn: strImgExtn,\n\t\t\tdata: props.data || undefined,\n\t\t\trId: intRels,\n\t\t\tTarget: `../media/${sanitizeMediaNamePart(target._name || '')}-image-${target._relsMedia.length + 1}.${strImgExtn}`,\n\t\t})\n\t\ttarget._bkgdImgRid = intRels\n\t}\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\n * - Identifiers & naming getUuid, validateObjectName, getDuplicateObjectNames\n * - Slide relationships getNewRelId, isHyperlinkRel\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 type { PresSlideInternal } from '../types/internal.js'\n\n/**\n * Basic UUID Generator Adapted\n * @link https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript#answer-2117523\n * @param {string} uuidFormat - UUID format\n * @returns {string} UUID\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 * 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\t// Pattern built from String.fromCharCode so no-control-regex cannot flag it statically.\n\tconst cc = String.fromCharCode\n\tconst illegalXmlCharsRe = new RegExp(`[${cc(0)}-${cc(8)}${cc(11)}${cc(12)}${cc(14)}-${cc(31)}${cc(127)}]`, 'g')\n\treturn xml\n\t\t.toString()\n\t\t.replace(illegalXmlCharsRe, '')\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/**\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`, silently changing\n * the stored name.\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 illegal-XML-char set that `encodeXmlEntities` strips; detect so the caller knows the name will change.\n\tconst cc = String.fromCharCode\n\tconst illegalXmlCharsRe = new RegExp(`[${cc(0)}-${cc(8)}${cc(11)}${cc(12)}${cc(14)}-${cc(31)}${cc(127)}]`)\n\tif (illegalXmlCharsRe.test(name)) {\n\t\twarn(\n\t\t\t'object-name/control-characters',\n\t\t\t`${kind} objectName \"${name}\" contains control characters that will be stripped, changing the stored name.`\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 = 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\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 * 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 * 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 */\ninterface 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 * 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 { REGEX_HEX_COLOR, DEF_FONT_COLOR } from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { PERCENT_SCALE } from '../../units.js'\nimport { el, raw, 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\tlet colorVal = (colorStr || '').replace('#', '')\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\tif (/^[0-9a-fA-F]{8}$/.test(colorVal)) {\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\tconst alphaHex = colorVal.slice(6, 8)\n\t\t\tconst alphaVal = Math.round((parseInt(alphaHex, 16) / 255) * PERCENT_SCALE)\n\t\t\tinnerElements = voidEl('a:alpha', { val: alphaVal }) + (innerElements || '')\n\t\t}\n\t\tcolorVal = colorVal.slice(0, 6)\n\t}\n\n\tif (!REGEX_HEX_COLOR.test(colorVal) && !Object.values(SchemeColor).includes(colorVal as SchemeColor)) {\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 = REGEX_HEX_COLOR.test(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, so this\n\t// is one of the few places `el`/`voidEl` are chosen at runtime rather than by tag.\n\treturn innerElements ? el(name, attrs, raw(innerElements)) : voidEl(name, attrs)\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 { ANGLE_UNITS_PER_DEGREE, EMU_PER_POINT, PERCENT_SCALE } from '../../units.js'\nimport { opacityToAlpha, valToPts } from '../../units-internal.js'\nimport { createColorElement } from './color.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.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\tconst size = Math.round(opts.size * EMU_PER_POINT)\n\tconst color = opts.color || DEF_FONT_COLOR\n\tconst opacity = opacityToAlpha(opts.opacity ?? 0)\n\n\treturn el('a:glow', { rad: size }, raw(createColorElement(color, alpha(opacity))))\n}\n\n/** The `<a:alpha>` child both effects hang off their color element. */\nfunction alpha(value: number): string {\n\treturn voidEl('a:alpha', { val: value })\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 = valToPts(opts.blur ?? 0)\n\tconst offset = valToPts(opts.offset ?? 0)\n\tconst angle = Math.round((opts.angle ?? 0) * ANGLE_UNITS_PER_DEGREE)\n\tconst opacity = Math.round((opts._alpha ?? 0.75) * PERCENT_SCALE)\n\tconst color = opts.color || DEF_FONT_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: opts.rotateWithShape ? 1 : 0 }\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, alpha(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 inner ? el('a:effectLst', null, raw(inner)) : voidEl('a:effectLst')\n}\n\n/**\n * Checks shadow options passed by user and performs corrections if needed.\n * @param {ShadowProps} ShadowProps - shadow options\n */\nexport function correctShadowOptions(ShadowProps?: ShadowProps | null): ShadowPropsInternal | undefined {\n\tif (!ShadowProps || typeof ShadowProps !== '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 = ShadowProps\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`\n\tif (corrected.angle) {\n\t\t// A: REALITY-CHECK\n\t\tif (isNaN(Number(corrected.angle)) || corrected.angle < 0 || corrected.angle > 359) {\n\t\t\twarn('shadow/angle-out-of-range', 'shadow.angle can only be 0-359')\n\t\t\tcorrected.angle = 270\n\t\t}\n\n\t\t// B: ROBUST: Cast any type of valid arg to int: '12', 12.3, etc. -> 12\n\t\tcorrected.angle = Math.round(Number(corrected.angle))\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 = Number(corrected.transparency)\n\t\tif (isNaN(pct) || pct < 0 || pct > 100) {\n\t\t\twarn('shadow/transparency-out-of-range', 'shadow.transparency can only be 0-100')\n\t\t} else {\n\t\t\tcorrected._alpha = 1 - pct / 100\n\t\t}\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 = corrected.color.replace('#', '')\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\tif (/^[0-9a-fA-F]{8}$/.test(corrected.color)) {\n\t\t\tconst alphaHex = corrected.color.slice(6, 8)\n\t\t\tif (corrected._alpha === undefined) {\n\t\t\t\tcorrected._alpha = parseInt(alphaHex, 16) / 255\n\t\t\t}\n\t\t\tcorrected.color = corrected.color.slice(0, 6)\n\t\t}\n\t}\n\n\treturn corrected\n}\n","/**\n * ts-pptx: Chart Definition\n *\n * `addChartDefinition` normalizes `addChart()` options onto the slide model and registers the\n * chart part rel; the `normalize*` / `clamp*` helpers apply the schema-valid defaults and range\n * clamps. The chart *XML* is emitted later by `gen/chart/chart-xml.ts`.\n */\nimport { asChartType, type CHART_NAME, ChartType, isChartExType, SchemeColor, SlideObjectType } from '../../enums.js'\nimport { BARCHART_COLORS, DEF_CHART_BORDER, PIECHART_COLORS } from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport type { ChartMulti, ChartOpts, OptsChartData, OptsChartGridLine } from '../../types/index.js'\nimport type { ChartOptsInternal, OptsChartDataInternal, PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { correctShadowOptions } from '../drawingml/effect.js'\nimport { valToPts } from '../../units-internal.js'\n\n/**\n * Copy one series into the internal shape the emitters read, without touching the caller's object.\n *\n * `labels` is widened to the nested `string[][]` form the multi-level category serializer wants and\n * `_dataIndex` records the series' position. Both used to be assigned back onto the caller's own\n * series object, so `data[0].labels` became `[['A','B','C']]` after `addChart` and any code that\n * reused the same array afterwards (a legend, a table, a second chart) silently saw one nested array\n * instead of three strings.\n *\n * The copy is one level deep on purpose: everything under `src/gen/chart/` is a pure string builder\n * that only reads `values`/`sizes`/`customLabels`/`pointStyles`/`errorBars`, so sharing those arrays\n * with the caller is safe.\n * @param item - caller-supplied series\n * @param index - series position, across all subcharts for a combo chart\n */\nfunction normalizeChartSeries(item: OptsChartData, index: number): OptsChartDataInternal {\n\tconst labels = item.labels\n\treturn {\n\t\t...item,\n\t\t_dataIndex: index,\n\t\tlabels: labels === undefined ? undefined : Array.isArray(labels[0]) ? (labels as string[][]) : [labels as string[]],\n\t}\n}\n\n/**\n * Copy a caller-supplied `ChartOpts` so the normalization below never writes back onto it.\n *\n * `addChartDefinition` fills in defaults, clamps out-of-range values and deletes invalid keys\n * (`layout.x`, `catGridLine.size`, `dataLabelPosition`, …). Doing that in place mutated the\n * caller's object, which is both surprising on its own and order-dependent when one options\n * object is shared across two charts.\n *\n * Nested objects are copied wherever a normalizer writes into them. `structuredClone` is\n * deliberately not used: it would deep-copy the `ChartMulti[]` on `_type` — breaking the series\n * identity the combo emit path depends on — and throws on a stray function in an untyped\n * caller's option bag.\n * @param opts - caller-supplied chart options\n */\nfunction copyChartOptions(opts: ChartOpts | ChartOptsInternal): ChartOptsInternal {\n\tconst copy: ChartOptsInternal = { ...opts }\n\t// `_type` is derived from the `type` argument below; never inherit a caller-stamped one.\n\tdelete copy._type\n\tif (copy.plotArea) {\n\t\tcopy.plotArea = { ...copy.plotArea }\n\t\tif (copy.plotArea.border) copy.plotArea.border = { ...copy.plotArea.border }\n\t\tif (copy.plotArea.fill) copy.plotArea.fill = { ...copy.plotArea.fill }\n\t}\n\tif (copy.chartArea) copy.chartArea = { ...copy.chartArea }\n\tif (copy.dataBorder) copy.dataBorder = { ...copy.dataBorder }\n\tif (copy.layout) copy.layout = { ...copy.layout }\n\tif (copy.catGridLine) copy.catGridLine = { ...copy.catGridLine }\n\tif (copy.valGridLine) copy.valGridLine = { ...copy.valGridLine }\n\tif (copy.serGridLine) copy.serGridLine = { ...copy.serGridLine }\n\t// `correctShadowOptions` normalizes its argument in place (angle rounding, `_alpha`).\n\tif (copy.shadow) copy.shadow = { ...copy.shadow }\n\treturn copy\n}\n\n/**\n * Round and clamp an integer chart percentage/angle option into a schema-valid range.\n *\n * Several chart attributes are bounded integer types whose out-of-range values make\n * PowerPoint report the package as needing repair: `<c:overlap>` (ST_Overlap, -100..100),\n * `<c:gapWidth>`/`<c:gapDepth>` (ST_GapAmount, 0..500), `<c:holeSize>` (ST_HoleSize, 10..90)\n * and `<c:firstSliceAng>` (ST_FirstSliceAng, 0..360). Missing/non-numeric input returns\n * `undefined` so the caller can apply its own default; an out-of-range value is clamped\n * and a warning is emitted (per the library's warn-rather-than-degrade policy).\n * @param value - caller-supplied option value\n * @param min - inclusive lower bound\n * @param max - inclusive upper bound\n * @param name - option name, for the warning message\n */\nfunction clampChartPct(value: number | undefined, min: number, max: number, name: string): number | undefined {\n\tif (typeof value !== 'number' || isNaN(value)) return undefined\n\tconst clamped = Math.min(max, Math.max(min, Math.round(value)))\n\tif (clamped !== value)\n\t\twarn('chart/option-out-of-range', `${name} ${value} is outside the valid range ${min}-${max}; using ${clamped}.`)\n\treturn clamped\n}\n\n/**\n * Drop `dataLabelPosition` values that are invalid for the chart type / bar grouping,\n * per the OOXML data-label placement rules, so PowerPoint does not flag the file.\n *\n * `chartType` is passed in rather than read off `options._type` so the combo path can run the\n * same rules per subchart: a combo chart's `_type` is a `ChartMulti[]`, which matches none of\n * the comparisons below (see {@link normalizeComboSubchartOptions}).\n * @param options - options bag to correct in place\n * @param chartType - the plot type these options are emitted for, if known\n */\nfunction normalizeChartDataLabelPosition(options: ChartOptsInternal, chartType: ChartType | undefined): void {\n\tif (options.dataLabelPosition) {\n\t\tconst dataLabelPosition = options.dataLabelPosition\n\t\tif (\n\t\t\tchartType === ChartType.area ||\n\t\t\tchartType === ChartType.bar3d ||\n\t\t\tchartType === ChartType.doughnut ||\n\t\t\tchartType === ChartType.radar\n\t\t) {\n\t\t\tdelete options.dataLabelPosition\n\t\t}\n\t\tif (chartType === ChartType.pie) {\n\t\t\tif (!['bestFit', 'ctr', 'inEnd', 'outEnd'].includes(dataLabelPosition)) delete options.dataLabelPosition\n\t\t}\n\t\tif (\n\t\t\tchartType === ChartType.bubble ||\n\t\t\tchartType === ChartType.bubble3d ||\n\t\t\tchartType === ChartType.line ||\n\t\t\tchartType === ChartType.scatter\n\t\t) {\n\t\t\tif (!['b', 'ctr', 'l', 'r', 't'].includes(dataLabelPosition)) delete options.dataLabelPosition\n\t\t}\n\t\tif (chartType === ChartType.bar) {\n\t\t\tif (!['stacked', 'percentStacked'].includes(options.barGrouping || '')) {\n\t\t\t\tif (!['ctr', 'inBase', 'inEnd'].includes(dataLabelPosition)) delete options.dataLabelPosition\n\t\t\t}\n\t\t\tif (!['clustered'].includes(options.barGrouping || '')) {\n\t\t\t\tif (!['ctr', 'inBase', 'inEnd', 'outEnd'].includes(dataLabelPosition)) delete options.dataLabelPosition\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Correct `barGrouping` to a value `<c:grouping>` (ST_Grouping) accepts for the given chart type.\n *\n * Split out of `addChartDefinition` for the same reason as\n * {@link normalizeChartDataLabelPosition}: the combo path needs it per subchart, keyed to that\n * subchart's own type.\n * @param options - options bag to correct in place\n * @param chartType - the plot type these options are emitted for, if known\n */\nfunction normalizeChartBarGrouping(options: ChartOptsInternal, chartType: ChartType | undefined): void {\n\t// barGrouping: \"21.2.3.17 ST_Grouping (Grouping)\"\n\tif (chartType === ChartType.area) {\n\t\tif (!['stacked', 'standard', 'percentStacked'].includes(options.barGrouping || '')) options.barGrouping = 'standard'\n\t}\n\tif (chartType === ChartType.bar) {\n\t\tif (!['clustered', 'stacked', 'percentStacked'].includes(options.barGrouping || ''))\n\t\t\toptions.barGrouping = 'clustered'\n\t}\n\tif (chartType === ChartType.bar3d) {\n\t\tif (!['clustered', 'stacked', 'standard', 'percentStacked'].includes(options.barGrouping || ''))\n\t\t\toptions.barGrouping = 'standard'\n\t}\n}\n\n/**\n * Apply plotArea option defaults: show* toggles, axis-line visibility, and the 3D view angles.\n */\nfunction normalizeChartPlotAreaOptions(options: ChartOptsInternal): void {\n\t// The eleven `show*` toggles are deliberately NOT defaulted here. Each one used to carry\n\t// a statement of the form `x = x || !x ? x : <default>`, but `a || !a` is true for every\n\t// value of `a`, so the alternative never ran and the whole statement was an identity\n\t// assignment. Every consumer reads these as plain truthiness (`opts.showPercent ? 1 : 0`,\n\t// `!opts.showDataTableKeys ? 0 : 1`), which makes an absent option behave as `false` — and\n\t// that is what the public types document (`@default false` on `showDataTable`,\n\t// `showPercent`, `v3DRAngAx`). Removing the dead statements changes no emitted byte;\n\t// *applying* the defaults those ternaries appear to promise would, so do not \"restore\"\n\t// them without treating it as the behavior change it is.\n\toptions.catAxisLineShow = typeof options.catAxisLineShow !== 'undefined' ? options.catAxisLineShow : true\n\toptions.valAxisLineShow = typeof options.valAxisLineShow !== 'undefined' ? options.valAxisLineShow : true\n\toptions.serAxisLineShow = typeof options.serAxisLineShow !== 'undefined' ? options.serAxisLineShow : true\n\n\toptions.v3DRotX =\n\t\ttypeof options.v3DRotX === 'number' && !isNaN(options.v3DRotX) && options.v3DRotX >= -90 && options.v3DRotX <= 90\n\t\t\t? options.v3DRotX\n\t\t\t: 30\n\toptions.v3DRotY =\n\t\ttypeof options.v3DRotY === 'number' && !isNaN(options.v3DRotY) && options.v3DRotY >= 0 && options.v3DRotY <= 360\n\t\t\t? options.v3DRotY\n\t\t\t: 30\n\t// v3DRAngAx: same dead-ternary shape as the show* block above, same reason for its absence.\n\toptions.v3DPerspective =\n\t\ttypeof options.v3DPerspective === 'number' &&\n\t\t!isNaN(options.v3DPerspective) &&\n\t\toptions.v3DPerspective >= 0 &&\n\t\toptions.v3DPerspective <= 240\n\t\t\t? options.v3DPerspective\n\t\t\t: 30\n}\n\n/**\n * Apply chart-level option defaults: gap/overlap/hole clamps, chart colors, plotArea/chartArea\n * borders and fills, data border, data-label format codes, line size and multi-level cat labels.\n */\nfunction normalizeChartOptions(options: ChartOptsInternal): void {\n\toptions.barGapWidthPct = clampChartPct(options.barGapWidthPct, 0, 500, 'barGapWidthPct') ?? 150\n\toptions.barGapDepthPct = clampChartPct(options.barGapDepthPct, 0, 500, 'barGapDepthPct') ?? 150\n\toptions.barOverlapPct = clampChartPct(options.barOverlapPct, -100, 100, 'barOverlapPct')\n\t// `<c:holeSize>` is ST_HoleSize (10..90); `<c:firstSliceAng>` is ST_FirstSliceAng (0..360).\n\toptions.holeSize = clampChartPct(options.holeSize, 10, 90, 'holeSize')\n\toptions.firstSliceAng = clampChartPct(options.firstSliceAng, 0, 360, 'firstSliceAng')\n\n\toptions.chartColors = Array.isArray(options.chartColors)\n\t\t? options.chartColors\n\t\t: options._type === ChartType.pie || options._type === ChartType.doughnut\n\t\t\t? PIECHART_COLORS\n\t\t\t: BARCHART_COLORS\n\toptions.chartColorsOpacity =\n\t\toptions.chartColorsOpacity && !isNaN(options.chartColorsOpacity) ? options.chartColorsOpacity : undefined\n\toptions.plotArea = options.plotArea || {}\n\toptions.plotArea.border =\n\t\toptions.plotArea.border && typeof options.plotArea.border === 'object' ? options.plotArea.border : undefined\n\tif (options.plotArea.border && (!options.plotArea.border.width || isNaN(options.plotArea.border.width)))\n\t\toptions.plotArea.border.width = DEF_CHART_BORDER.width\n\tif (\n\t\toptions.plotArea.border &&\n\t\t(!options.plotArea.border.color || typeof options.plotArea.border.color !== 'string')\n\t) {\n\t\toptions.plotArea.border.color = DEF_CHART_BORDER.color\n\t}\n\toptions.plotArea.fill = options.plotArea.fill || {}\n\toptions.chartArea = options.chartArea || {}\n\toptions.chartArea.border =\n\t\toptions.chartArea.border && typeof options.chartArea.border === 'object' ? options.chartArea.border : undefined\n\tif (options.chartArea.border) {\n\t\toptions.chartArea.border = {\n\t\t\tcolor: options.chartArea.border.color || DEF_CHART_BORDER.color,\n\t\t\twidth: options.chartArea.border.width || DEF_CHART_BORDER.width,\n\t\t\ttransparency: options.chartArea.border.transparency,\n\t\t}\n\t}\n\toptions.chartArea.roundedCorners =\n\t\ttypeof options.chartArea.roundedCorners === 'boolean' ? options.chartArea.roundedCorners : true\n\t//\n\toptions.dataBorder = options.dataBorder && typeof options.dataBorder === 'object' ? options.dataBorder : undefined\n\tif (options.dataBorder && (!options.dataBorder.width || isNaN(options.dataBorder.width)))\n\t\toptions.dataBorder.width = 0.75\n\tif (options.dataBorder && options.dataBorder.color) {\n\t\tconst isHexColor =\n\t\t\ttypeof options.dataBorder.color === 'string' &&\n\t\t\toptions.dataBorder.color.length === 6 &&\n\t\t\t/^[0-9A-Fa-f]{6}$/.test(options.dataBorder.color)\n\t\tconst isSchemeColor = Object.values(SchemeColor).includes(options.dataBorder.color as SchemeColor)\n\t\tif (!isHexColor && !isSchemeColor) {\n\t\t\toptions.dataBorder.color = 'F9F9F9' // Fallback if neither hex nor scheme color\n\t\t}\n\t}\n\t//\n\tif (!options.dataLabelFormatCode && options._type === ChartType.scatter) options.dataLabelFormatCode = 'General'\n\tif (!options.dataLabelFormatCode && (options._type === ChartType.pie || options._type === ChartType.doughnut)) {\n\t\toptions.dataLabelFormatCode = options.showPercent ? '0%' : 'General'\n\t}\n\toptions.dataLabelFormatCode =\n\t\toptions.dataLabelFormatCode && typeof options.dataLabelFormatCode === 'string'\n\t\t\t? options.dataLabelFormatCode\n\t\t\t: '#,##0'\n\t//\n\t// Set default format for Scatter chart labels to custom string if not defined\n\tif (!options.dataLabelFormatScatter && options._type === ChartType.scatter) options.dataLabelFormatScatter = 'custom'\n\t//\n\toptions.lineSize = typeof options.lineSize === 'number' ? options.lineSize : 2\n\toptions.valAxisMajorUnit = typeof options.valAxisMajorUnit === 'number' ? options.valAxisMajorUnit : undefined\n\n\tif (\n\t\toptions._type === ChartType.area ||\n\t\toptions._type === ChartType.bar ||\n\t\toptions._type === ChartType.bar3d ||\n\t\toptions._type === ChartType.line\n\t) {\n\t\toptions.catAxisMultiLevelLabels = !!options.catAxisMultiLevelLabels\n\t} else {\n\t\tdelete options.catAxisMultiLevelLabels\n\t}\n\n\tif (options._type === ChartType.waterfall && options.subtotals !== undefined) {\n\t\t// <cx:subtotals> holds zero-based category indices; drop non-integer / negative entries\n\t\t// (they would make PowerPoint report the chartEx part as needing repair). Warn per the\n\t\t// library's warn-rather-than-degrade policy.\n\t\tconst clean = (Array.isArray(options.subtotals) ? options.subtotals : []).filter((idx) => {\n\t\t\tconst ok = typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n\t\t\tif (!ok)\n\t\t\t\twarn(\n\t\t\t\t\t'chart/invalid-subtotal-index',\n\t\t\t\t\t`chart waterfall subtotal index \"${String(idx)}\" is not a non-negative integer; entry skipped.`\n\t\t\t\t)\n\t\t\treturn ok\n\t\t})\n\t\toptions.subtotals = clean.length > 0 ? clean : undefined\n\t}\n}\n\n/**\n * Options a combo subchart may override that land in a bounded or enumerated OOXML attribute,\n * i.e. the ones {@link normalizeComboSubchartOptions} is allowed to write back.\n */\nconst SUBCHART_VALIDATED_KEYS = [\n\t'barDir',\n\t'barGrouping',\n\t'barGapWidthPct',\n\t'barGapDepthPct',\n\t'barOverlapPct',\n\t'bar3DShape',\n\t'holeSize',\n\t'firstSliceAng',\n\t'lineDataSymbol',\n\t'lineDataSymbolSize',\n\t'lineDataSymbolLineSize',\n\t'dataLabelPosition',\n] as const\n\n/**\n * Clamp and correct one combo subchart's option overrides.\n *\n * `addChartDefinition` normalizes the chart-level options once, but a combo chart's per-subchart\n * `ChartMulti.options` are merged over them only at emit time (`gen/chart/chart-xml.ts`) — after\n * every clamp and enum correction has already run. Anything set there therefore reached the part\n * verbatim: `barOverlapPct: 250` emitted `<c:overlap val=\"250\"/>` where ST_Overlap is -100..100,\n * `barGapWidthPct: 9999` blew past ST_GapAmount's 500, and `barGrouping: 'sideways'` failed the\n * ST_Grouping enumeration — three PowerPoint-repair prompts reachable only through the combo API.\n *\n * The gap runs the other way too: for a combo chart `options._type` is a `ChartMulti[]`, so the\n * *type-dependent* chart-level corrections (`barGrouping`, `dataLabelPosition`) match no branch\n * and never fire at all.\n *\n * Both are fixed by validating the value the emitter actually reads — `{...chartOptions,\n * ...subOptions}` — against this subchart's own type, then writing back only the keys a\n * correction changed so the subchart bag stays a sparse override of the chart-level options.\n * @param subOptions - caller-supplied `ChartMulti.options` (never written to)\n * @param chartOptions - the already-normalized chart-level options\n * @param subType - this subchart's own plot type\n * @param callerSetBarGapWidthPct - whether the caller supplied a chart-level `barGapWidthPct`\n */\nfunction normalizeComboSubchartOptions(\n\tsubOptions: ChartOpts | undefined,\n\tchartOptions: ChartOptsInternal,\n\tsubType: ChartType,\n\tcallerSetBarGapWidthPct: boolean\n): ChartOpts {\n\tconst sub: ChartOpts = subOptions && typeof subOptions === 'object' ? subOptions : {}\n\t// What the emitter reads for this subchart today, and the corrected copy to diff against it.\n\tconst merged: ChartOptsInternal = { ...chartOptions, ...sub }\n\tconst fixed: ChartOptsInternal = { ...merged }\n\n\t// Enumerations emitted verbatim: `<c:barDir>` (ST_BarDir), `<c:grouping>` (ST_Grouping),\n\t// `<c:shape>` (ST_Shape), `<c:symbol>` (ST_MarkerStyle).\n\tif (!['bar', 'col'].includes(fixed.barDir || '')) fixed.barDir = 'col'\n\tnormalizeChartBarGrouping(fixed, subType)\n\tif (!['cone', 'coneToMax', 'box', 'cylinder', 'pyramid', 'pyramidToMax'].includes(fixed.bar3DShape || ''))\n\t\tfixed.bar3DShape = 'box'\n\tif (!['circle', 'dash', 'diamond', 'dot', 'none', 'square', 'triangle'].includes(fixed.lineDataSymbol || ''))\n\t\tfixed.lineDataSymbol = 'circle'\n\t// A stacked bar group takes the narrower default gap a chart-level stacked bar gets. The\n\t// merged bag already carries the clustered default, so only step in when neither the\n\t// chart-level nor the subchart caller asked for a specific width.\n\tif (fixed.barGrouping?.includes('tacked') && !callerSetBarGapWidthPct && sub.barGapWidthPct == null)\n\t\tfixed.barGapWidthPct = 50\n\t// Depends on the corrected grouping above, so it has to run after it.\n\tnormalizeChartDataLabelPosition(fixed, subType)\n\n\t// Bounded integers. A non-numeric override falls back to the chart-level value, which\n\t// `normalizeChartOptions` has already put in range.\n\tfixed.barGapWidthPct = clampChartPct(fixed.barGapWidthPct, 0, 500, 'barGapWidthPct') ?? chartOptions.barGapWidthPct\n\tfixed.barGapDepthPct = clampChartPct(fixed.barGapDepthPct, 0, 500, 'barGapDepthPct') ?? chartOptions.barGapDepthPct\n\tfixed.barOverlapPct = clampChartPct(fixed.barOverlapPct, -100, 100, 'barOverlapPct')\n\tfixed.holeSize = clampChartPct(fixed.holeSize, 10, 90, 'holeSize')\n\tfixed.firstSliceAng = clampChartPct(fixed.firstSliceAng, 0, 360, 'firstSliceAng')\n\t// `<c:size val>` is ST_MarkerSize: an integer 2..72 points.\n\tif (fixed.lineDataSymbolSize != null && !isNaN(fixed.lineDataSymbolSize)) {\n\t\tconst symbolSize = Math.min(72, Math.max(2, Math.round(fixed.lineDataSymbolSize)))\n\t\tif (symbolSize !== fixed.lineDataSymbolSize)\n\t\t\twarn(\n\t\t\t\t'chart/symbol-size-out-of-range',\n\t\t\t\t`lineDataSymbolSize ${fixed.lineDataSymbolSize} is outside the valid marker size range (integer 2-72); using ${symbolSize}.`\n\t\t\t)\n\t\tfixed.lineDataSymbolSize = symbolSize\n\t}\n\t// Points -> EMU, but only for a width this subchart supplied: the chart-level value has\n\t// already been through `valToPts` and converting it twice would emit a hairline.\n\tif (sub.lineDataSymbolLineSize != null && !isNaN(sub.lineDataSymbolLineSize))\n\t\tfixed.lineDataSymbolLineSize = valToPts(sub.lineDataSymbolLineSize)\n\n\tconst result: ChartOptsInternal = { ...sub }\n\tfor (const key of SUBCHART_VALIDATED_KEYS) {\n\t\tif (fixed[key] !== merged[key]) (result as Record<string, unknown>)[key] = fixed[key]\n\t}\n\treturn result\n}\n\n/**\n * Generate the chart based on input data.\n * OOXML Chart Spec: ISO/IEC 29500-1:2016(E)\n *\n * @param {CHART_NAME | ChartMulti[]} `type` should belong to: 'column', 'pie'\n * @param {[]} `data` a JSON object with follow the following format\n * @param {ChartOptsInternal} `opt` chart options\n * @param {PresSlideInternal} `target` slide object that the chart will be added to\n * @return {object} chart object\n * {\n * title: 'eSurvey chart',\n * data: [\n * {\n * name: 'Income',\n * labels: ['2005', '2006', '2007', '2008', '2009'],\n * values: [23.5, 26.2, 30.1, 29.5, 24.6]\n * },\n * {\n * name: 'Expense',\n * labels: ['2005', '2006', '2007', '2008', '2009'],\n * values: [18.1, 22.8, 23.9, 25.1, 25]\n * }\n * ]\n * }\n */\nexport function addChartDefinition(\n\ttarget: PresSlideInternal,\n\ttype: CHART_NAME | ChartMulti[],\n\tdata: OptsChartData[] | ChartOpts,\n\topt?: ChartOptsInternal\n): object {\n\tfunction correctGridLineOptions(glOpts: OptsChartGridLine): void {\n\t\tif (!glOpts || glOpts.style === 'none') return\n\t\tif (glOpts.size !== undefined && (isNaN(Number(glOpts.size)) || glOpts.size <= 0)) {\n\t\t\twarn('chart/invalid-grid-line-size', 'chart.gridLine.size must be greater than 0.')\n\t\t\tdelete glOpts.size // delete prop to used defaults\n\t\t}\n\t\tif (glOpts.style && !['solid', 'dash', 'dot'].includes(glOpts.style)) {\n\t\t\twarn('chart/invalid-grid-line-style', 'chart.gridLine.style options: `solid`, `dash`, `dot`.')\n\t\t\tdelete glOpts.style\n\t\t}\n\t\tif (glOpts.cap && !['flat', 'square', 'round'].includes(glOpts.cap)) {\n\t\t\twarn('chart/invalid-grid-line-cap', 'chart.gridLine.cap options: `flat`, `square`, `round`.')\n\t\t\tdelete glOpts.cap\n\t\t}\n\t}\n\n\t// Placeholder part identity, unique only within this target. The authoritative,\n\t// package-unique chart part filename is assigned at write time by a per-presentation\n\t// pass in `buildPackageParts` (`package/assemble.ts`, STEP 2). A module-global counter\n\t// here was never reset, so two identical decks built in one process emitted different\n\t// chart part filenames — same input, different bytes.\n\tconst chartId = target._relsChart.length + 1\n\tconst resultObject: SlideObject = {\n\t\t_type: SlideObjectType.chart,\n\t}\n\t// DESIGN: `type` can an object (ex: `ChartType.doughnut`) or an array of chart objects\n\t// EX: addChartDefinition([ { type:ChartType.bar, data:{name:'', labels:[], values[]} }, {<etc>} ])\n\t// Multi-Type Charts\n\tlet tmpOpt: ChartOpts | ChartOptsInternal | undefined\n\tlet tmpData: OptsChartDataInternal[] = []\n\tlet tmpTypes: ChartMulti[] | undefined\n\tif (Array.isArray(type)) {\n\t\t// For multi-type charts there needs to be data for each type, as well as a single data\n\t\t// source for non-series operations. The series are indexed across subcharts to keep the\n\t\t// data in order when segmented into types.\n\t\t//\n\t\t// The whole `ChartMulti[]` is rebuilt around the normalized copies, not just flattened\n\t\t// into `tmpData`: the combo emit path plots each subchart from `opts._type[i].data`\n\t\t// (see gen/chart/chart-xml.ts), so both views have to reference the same series objects.\n\t\tlet seriesIndex = 0\n\t\ttmpTypes = type.map((obj) => {\n\t\t\tconst seriesData = (Array.isArray(obj.data) ? obj.data : []).map((item) =>\n\t\t\t\tnormalizeChartSeries(item, seriesIndex++)\n\t\t\t)\n\t\t\ttmpData = tmpData.concat(seriesData)\n\t\t\treturn { ...obj, data: seriesData }\n\t\t})\n\t\ttmpOpt = !Array.isArray(data) && data && typeof data === 'object' ? data : opt\n\t} else {\n\t\ttmpData = (Array.isArray(data) ? data : []).map(normalizeChartSeries)\n\t\ttmpOpt = opt\n\t}\n\t// Everything below normalizes onto this copy; the caller's options object is a read-only input.\n\tconst options: ChartOptsInternal = copyChartOptions(tmpOpt && typeof tmpOpt === 'object' ? tmpOpt : {})\n\t// Captured before normalization fills in the default, so the combo pass below can tell an\n\t// explicit gap width from an inherited one.\n\tconst callerSetBarGapWidthPct = typeof options.barGapWidthPct === 'number' && !isNaN(options.barGapWidthPct)\n\n\t// STEP 1: Set default options/decode user options\n\t// A: Core\n\toptions._type = tmpTypes ?? asChartType(type as CHART_NAME)\n\toptions.x = typeof options.x !== 'undefined' && options.x != null && !isNaN(Number(options.x)) ? options.x : 1\n\toptions.y = typeof options.y !== 'undefined' && options.y != null && !isNaN(Number(options.y)) ? options.y : 1\n\toptions.w = options.w || '50%'\n\toptions.h = options.h || '50%'\n\toptions.objectName = options.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(options.objectName, 'chart'))\n\t\t: `Chart ${target._slideObjects.filter((obj) => obj._type === SlideObjectType.chart).length}`\n\n\t// B: Options: misc\n\tif (!['bar', 'col'].includes(options.barDir || '')) options.barDir = 'col'\n\n\t// barGrouping must be handled before data label validation as it can affect valid label positioning\n\tconst chartLevelType = Array.isArray(options._type) ? undefined : options._type\n\tnormalizeChartBarGrouping(options, chartLevelType)\n\tif (options.barGrouping?.includes('tacked')) {\n\t\tif (!options.barGapWidthPct) options.barGapWidthPct = 50\n\t}\n\t// Clean up and validate data label positions\n\t// REFERENCE: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/e2b1697c-7adc-463d-9081-3daef72f656f?redirectedfrom=MSDN\n\tnormalizeChartDataLabelPosition(options, chartLevelType)\n\t// dataLabelBkgrdColors: same dead-ternary shape as the show* block in\n\t// normalizeChartPlotAreaOptions, same reason for its absence.\n\tif (!['b', 'l', 'r', 't', 'tr'].includes(options.legendPos || '')) options.legendPos = 'r'\n\n\t// 3D bar: ST_Shape\n\tif (!['cone', 'coneToMax', 'box', 'cylinder', 'pyramid', 'pyramidToMax'].includes(options.bar3DShape || ''))\n\t\toptions.bar3DShape = 'box'\n\t// lineDataSymbol: http://www.datypic.com/sc/ooxml/a-val-32.html\n\t// Spec has [plus,star,x] however neither PPT2013 nor PPT-Online support them\n\tif (!['circle', 'dash', 'diamond', 'dot', 'none', 'square', 'triangle'].includes(options.lineDataSymbol || ''))\n\t\toptions.lineDataSymbol = 'circle'\n\tif (!['gap', 'span', 'zero'].includes(options.displayBlanksAs || '')) options.displayBlanksAs = 'gap'\n\tif (!['radar', 'markers', 'filled'].includes(options.radarStyle || '')) options.radarStyle = 'radar'\n\t// Marker size emits as `<c:size val>` (ST_MarkerSize): an integer in [2,72] points.\n\t// Out-of-range or non-integer values make PowerPoint report the file as needing\n\t// repair, so round and clamp into range and warn when the input is coerced.\n\t{\n\t\tconst rawSymbolSize = options.lineDataSymbolSize\n\t\tconst hasSymbolSize = rawSymbolSize != null && !isNaN(rawSymbolSize)\n\t\tconst symbolSize = Math.min(72, Math.max(2, Math.round(hasSymbolSize ? rawSymbolSize : 6)))\n\t\tif (hasSymbolSize && symbolSize !== rawSymbolSize) {\n\t\t\twarn(\n\t\t\t\t'chart/symbol-size-out-of-range',\n\t\t\t\t`lineDataSymbolSize ${rawSymbolSize} is outside the valid marker size range (integer 2-72); using ${symbolSize}.`\n\t\t\t)\n\t\t}\n\t\toptions.lineDataSymbolSize = symbolSize\n\t}\n\toptions.lineDataSymbolLineSize =\n\t\toptions.lineDataSymbolLineSize && !isNaN(options.lineDataSymbolLineSize)\n\t\t\t? valToPts(options.lineDataSymbolLineSize)\n\t\t\t: valToPts(0.75)\n\t// `layout` allows the override of PPT defaults to maximize space\n\tconst chartLayout = options.layout\n\tif (chartLayout) {\n\t\t;(['x', 'y', 'w', 'h'] as const).forEach((key) => {\n\t\t\tconst val = chartLayout[key]\n\t\t\tconst numVal = Number(val)\n\t\t\tif (isNaN(numVal) || numVal < 0 || numVal > 1) {\n\t\t\t\twarn('chart/layout-out-of-range', 'chart.layout.' + key + ' can only be 0-1')\n\t\t\t\tdelete chartLayout[key] // remove invalid value so that default will be used\n\t\t\t}\n\t\t})\n\t}\n\n\t// Set gridline defaults\n\toptions.catGridLine =\n\t\toptions.catGridLine || (options._type === ChartType.scatter ? { color: 'D9D9D9', size: 1 } : { style: 'none' })\n\toptions.valGridLine = options.valGridLine || (options._type === ChartType.scatter ? { color: 'D9D9D9', size: 1 } : {})\n\toptions.serGridLine =\n\t\toptions.serGridLine || (options._type === ChartType.scatter ? { color: 'D9D9D9', size: 1 } : { style: 'none' })\n\tcorrectGridLineOptions(options.catGridLine)\n\tcorrectGridLineOptions(options.valGridLine)\n\tcorrectGridLineOptions(options.serGridLine)\n\tcorrectShadowOptions(options.shadow)\n\n\t// C: Options: plotArea\n\tnormalizeChartPlotAreaOptions(options)\n\n\t// D: Options: chart\n\t// `<c:gapWidth>`/`<c:gapDepth>` are ST_GapAmount (integer 0..500); `<c:overlap>` is\n\t// ST_Overlap (integer -100..100). Out-of-range values trigger PowerPoint repair.\n\tnormalizeChartOptions(options)\n\n\t// E: Options: combo subcharts\n\t// A `ChartMulti` entry's options override the chart-level ones at emit time, so they have to\n\t// go through the same clamps and enum corrections — keyed to that subchart's own plot type.\n\tif (Array.isArray(options._type)) {\n\t\toptions._type.forEach((sub) => {\n\t\t\t// Safe to assign: these entries are the copies built above, not the caller's objects.\n\t\t\tsub.options = normalizeComboSubchartOptions(sub.options, options, asChartType(sub.type), callerSetBarGapWidthPct)\n\t\t})\n\t}\n\n\t// Stock charts require their series in a fixed order (see `stockStyle`); default to the\n\t// three-value High-Low-Close style and warn (rather than corrupt) when the number of data\n\t// series doesn't match the style, since PowerPoint expects an exact count per style.\n\tif (options._type === ChartType.stock) {\n\t\tconst STOCK_SERIES_COUNT: Record<string, number> = { hlc: 3, ohlc: 4, vhlc: 4, vohlc: 5 }\n\t\tif (!Object.keys(STOCK_SERIES_COUNT).includes(options.stockStyle || '')) options.stockStyle = 'hlc'\n\t\tconst expected = STOCK_SERIES_COUNT[options.stockStyle as string]\n\t\tif (tmpData.length !== expected) {\n\t\t\twarn(\n\t\t\t\t'chart/stock-series-count',\n\t\t\t\t`stock chart style \"${options.stockStyle}\" expects ${expected} data series (got ${tmpData.length}); the chart may not render as intended.`\n\t\t\t)\n\t\t}\n\t}\n\n\t// STEP 4: Set props\n\tresultObject._type = SlideObjectType.chart\n\tresultObject.options = options\n\tresultObject.chartRid = getNewRelId(target)\n\n\t// STEP 5: Add this chart to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)\n\t// chartEx charts (waterfall, …) live alongside classic charts in `ppt/charts/` but use the\n\t// `chartEx{N}.xml` name, the `chartex+xml` content type and the MS chartEx rel type. The\n\t// authoritative, package-unique filename is (re)assigned at write time in\n\t// `buildPackageParts` (`package/assemble.ts`); this placeholder mirrors the same\n\t// Ex-prefix rule so a single-chart deck is already correct.\n\tconst isChartEx = isChartExType(options._type)\n\tconst chartBase = isChartEx ? `chartEx${chartId}` : `chart${chartId}`\n\ttarget._relsChart.push({\n\t\trId: getNewRelId(target),\n\t\tdata: tmpData,\n\t\topts: options,\n\t\ttype: options._type,\n\t\tglobalId: chartId,\n\t\tisChartEx,\n\t\tfileName: `${chartBase}.xml`,\n\t\tTarget: `/ppt/charts/${chartBase}.xml`,\n\t})\n\n\ttarget._slideObjects.push(resultObject)\n\treturn resultObject\n}\n","/**\n * ts-pptx: Comment Definition\n *\n * Validates `addComment()` author / text / position and stashes a review comment on the slide\n * (`_comments`); the `<p:cm>` XML is emitted later by `gen/slide/comments.ts`.\n */\nimport { warn } from '../../diagnostics.js'\nimport type { CommentProps } from '../../types/index.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\n\n/**\n * Derive 1-2 letter initials from an author display name (e.g. \"Ada Lovelace\" -> \"AL\").\n * Falls back to the first character when the name is a single word.\n */\nfunction deriveAuthorInitials(author: string): string {\n\tconst words = author.trim().split(/\\s+/).filter(Boolean)\n\tconst first = words[0]\n\tif (!first) return '?'\n\tif (words.length === 1) return first.charAt(0).toUpperCase()\n\tconst last = words[words.length - 1] ?? first\n\treturn (first.charAt(0) + last.charAt(0)).toUpperCase()\n}\n\n/**\n * Adds a review comment to a slide (legacy ISO/IEC 29500 §13 comment).\n * @param {PresSlideInternal} target slide object the comment is attached to\n * @param {CommentProps} opts comment author/text/position options\n */\nexport function addCommentDefinition(target: PresSlideInternal, opts: CommentProps): void {\n\tconst author = typeof opts?.author === 'string' ? opts.author.trim() : ''\n\tconst text = typeof opts?.text === 'string' ? opts.text : ''\n\t// Don't silently coerce: a comment with no author or no body is meaningless, so warn + skip\n\t// rather than emit a degenerate <p:cm> (API policy: warn over silent coercion).\n\tif (!author) {\n\t\twarn('comment/missing-author', 'addComment() requires a non-empty `author`; comment ignored.')\n\t\treturn\n\t}\n\tif (!text) {\n\t\twarn('comment/missing-text', 'addComment() requires non-empty `text`; comment ignored.')\n\t\treturn\n\t}\n\n\tconst initials =\n\t\ttypeof opts.initials === 'string' && opts.initials.trim() ? opts.initials.trim() : deriveAuthorInitials(author)\n\tconst x = typeof opts.x === 'number' && Number.isFinite(opts.x) ? opts.x : 0.5\n\tconst y = typeof opts.y === 'number' && Number.isFinite(opts.y) ? opts.y : 0.5\n\tlet date: string | undefined\n\tif (opts.date instanceof Date) date = opts.date.toISOString()\n\telse if (typeof opts.date === 'string' && opts.date) date = opts.date\n\n\tif (!target._comments) target._comments = []\n\ttarget._comments.push({ author, initials, text, x, y, date })\n}\n","/**\n * ts-pptx: Slide-Object Name Indexing\n *\n * The per-slide default-name counter shared by every `add*Definition`. Kept in one place so a\n * grouped child and a later top-level object never collide on the same Selection Pane name\n * (see the note on {@link nextObjectNameIdx}).\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\n\n/**\n * Take the next slide-wide index for `type`'s default Selection Pane name (`Shape 0`, `Image 1`,\n * `Group 1`, …).\n *\n * Default names used to be derived by counting the matching objects already in\n * `target._slideObjects`. `buildGroupObject` splices group children back out of that array, so the\n * count never advanced past them and a later top-level object reused a grouped child's name. This\n * counter is immune to the splice: every object of a kind consumes an index when it is added,\n * whether it stays top-level or moves into a group — at any nesting depth, since `target` stays the\n * slide all the way down.\n *\n * Shapes and text boxes deliberately share the `text` bucket (both are `_type === text`), which is\n * what keeps `Shape 0` and `Text 0` from colliding on one slide. Callers take an index\n * unconditionally, including when the caller supplied an explicit `objectName`, so an object's\n * index is its ordinal among its kind rather than a count of the defaulted ones.\n * @param target - slide (or master) the object is being added to\n * @param type - the object's `_type`\n * @returns the index this object takes\n */\nexport function nextObjectNameIdx(target: PresSlideInternal, type: SlideObjectType): number {\n\tconst counts = (target._objectNameCounts ??= {})\n\tconst idx = counts[type] ?? 0\n\tcounts[type] = idx + 1\n\treturn idx\n}\n","/**\n * ts-pptx: Connector Definition\n *\n * `addConnectorDefinition` converts two endpoints to a flip-oriented bounding box, resolves the\n * connector preset + adjust guides, and optionally binds start / end shapes. Emitted later as\n * `<p:cxnSp>`.\n */\nimport { connectorPresetFor, SlideObjectType } from '../../enums.js'\nimport { DEF_SHAPE_LINE_COLOR } from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport type { ConnectorProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { EMU_PER_INCH, FIXED_PCT_PER_PERCENT } from '../../units.js'\nimport { encodeXmlAttrValue, validateObjectName } from '../utils.js'\nimport { getSmartParseNumber } from '../../units-internal.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * Adds a connector object to a slide definition.\n * A connector is a line between two points emitted as a PowerPoint connector (`<p:cxnSp>`).\n * Endpoints are converted to a bounding box (`x/y/w/h`) plus `flipH`/`flipV` so the box can be\n * oriented from any corner; the connector preset geometry is derived from `type`.\n * @param {PresSlideInternal} target - slide the connector is added to\n * @param {ConnectorProps} opts - connector options (endpoints + line styling)\n */\nexport function addConnectorDefinition(target: PresSlideInternal, opts: ConnectorProps): void {\n\tif (!opts || [opts.x1, opts.y1, opts.x2, opts.y2].some((v) => typeof v === 'undefined')) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'connector/missing-endpoints',\n\t\t\t'addConnector requires { x1, y1, x2, y2 }. Example: `slide.addConnector({ x1:1, y1:1, x2:4, y2:3 })`'\n\t\t)\n\t}\n\n\tconst type = opts.type || 'straight'\n\tif (type !== 'straight' && type !== 'elbow' && type !== 'curved') {\n\t\tthrow new InvalidOptionError(\n\t\t\t'connector/invalid-type',\n\t\t\t`Invalid connector type \"${String(type)}\". Use 'straight', 'elbow', or 'curved'.`\n\t\t)\n\t}\n\n\t// Resolve the preset variant + adjust guides. `bentConnector{3,4,5}` / `curvedConnector{3,4,5}`\n\t// each expose `bends` adjustable jogs as `<a:gd name=\"adjN\" fmla=\"val …\"/>` (1000ths-of-a-percent,\n\t// so 50% → 50000; values verified against PowerPoint-authored decks). `straightConnector1` has none.\n\tconst adjInput = opts.adj === undefined ? [] : Array.isArray(opts.adj) ? opts.adj : [opts.adj]\n\tconst bends = opts.bends ?? (adjInput.length || 1)\n\tlet connectorAdj: number[] = []\n\tif (type === 'straight') {\n\t\tif (opts.bends !== undefined || opts.adj !== undefined) {\n\t\t\twarn(\n\t\t\t\t'connector/bends-ignored-for-straight',\n\t\t\t\t'addConnector `bends`/`adj` are ignored for type \"straight\" (a straight connector has no bends).'\n\t\t\t)\n\t\t}\n\t} else {\n\t\tif (bends !== 1 && bends !== 2 && bends !== 3) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'connector/invalid-bends',\n\t\t\t\t`addConnector \\`bends\\` must be 1, 2, or 3 (got ${String(bends)}).`\n\t\t\t)\n\t\t}\n\t\tif (opts.adj !== undefined && adjInput.length !== bends) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'connector/adj-count-mismatch',\n\t\t\t\t`addConnector \\`adj\\` must supply ${bends} value(s) to match \\`bends\\`=${bends} (got ${adjInput.length}).`\n\t\t\t)\n\t\t}\n\t\t// Convert each percent to OOXML 1000ths-of-a-percent. Fail loud on non-finite input\n\t\t// (silent coercion would emit a degenerate guide PowerPoint repairs); warn but allow\n\t\t// out-of-range, which legitimately places a jog beyond the endpoint box.\n\t\tconnectorAdj = adjInput.map((pct, i) => {\n\t\t\tif (typeof pct !== 'number' || !Number.isFinite(pct)) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'connector/adj-non-finite',\n\t\t\t\t\t`addConnector \\`adj\\` value #${i + 1} must be a finite number (percent 0–100); got ${String(pct)}.`\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (pct < 0 || pct > 100) {\n\t\t\t\twarn(\n\t\t\t\t\t'connector/adj-out-of-range',\n\t\t\t\t\t`addConnector \\`adj\\` value ${pct} is outside 0–100; the bend will sit beyond the endpoint box.`\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn Math.round(pct * FIXED_PCT_PER_PERCENT)\n\t\t})\n\t}\n\tconst preset = connectorPresetFor(type, bends)\n\n\t// Optional shape binding (<a:stCxn>/<a:endCxn>). The target id is resolved at serialize time\n\t// (it equals the shape's slide-object index + 2); here we just capture the name + site index.\n\t// The site index must be a non-negative integer — a bad idx makes PowerPoint repair the connector.\n\tconst resolveCxn = (\n\t\tshapeName: string | undefined,\n\t\tidx: number | undefined,\n\t\tend: 'startShape' | 'endShape'\n\t): { name: string; idx: number } | undefined => {\n\t\tif (shapeName === undefined) return undefined\n\t\tif (typeof shapeName !== 'string' || shapeName.trim().length === 0) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'connector/invalid-binding-name',\n\t\t\t\t`addConnector \\`${end}\\` must be a non-empty shape objectName.`\n\t\t\t)\n\t\t}\n\t\tconst site = idx ?? 0\n\t\tif (!Number.isInteger(site) || site < 0) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'connector/invalid-connection-site',\n\t\t\t\t`addConnector \\`${end}Idx\\` must be a non-negative integer (got ${String(site)}).`\n\t\t\t)\n\t\t}\n\t\t// Stored as the caller spelled it: `resolveObjectNameToId` escapes its own lookup key at\n\t\t// serialize time (see its docblock), so escaping here too would look up `Q&amp;amp;A`.\n\t\treturn { name: shapeName, idx: site }\n\t}\n\tconst startCxn = resolveCxn(opts.startShape, opts.startShapeIdx, 'startShape')\n\tconst endCxn = resolveCxn(opts.endShape, opts.endShapeIdx, 'endShape')\n\tconst connectorNameIdx = nextObjectNameIdx(target, SlideObjectType.connector)\n\n\t// Resolve all four endpoints to inches up front (handles every `Coord` form: number,\n\t// '50%', '2in', etc.). The connector box uses the min corner as its origin and flips\n\t// horizontally/vertically when the end point is left of / above the start point.\n\tconst x1 = getSmartParseNumber(opts.x1, 'X', target._presLayout) / EMU_PER_INCH\n\tconst y1 = getSmartParseNumber(opts.y1, 'Y', target._presLayout) / EMU_PER_INCH\n\tconst x2 = getSmartParseNumber(opts.x2, 'X', target._presLayout) / EMU_PER_INCH\n\tconst y2 = getSmartParseNumber(opts.y2, 'Y', target._presLayout) / EMU_PER_INCH\n\n\tconst newObject: SlideObject = {\n\t\t_type: SlideObjectType.connector,\n\t\t// store the connector preset on `shape`; the serializer emits it as the prstGeom `prst`\n\t\tshape: preset,\n\t\toptions: {\n\t\t\tx: Math.min(x1, x2),\n\t\t\ty: Math.min(y1, y2),\n\t\t\tw: Math.abs(x2 - x1),\n\t\t\th: Math.abs(y2 - y1),\n\t\t\tflipH: x2 < x1,\n\t\t\tflipV: y2 < y1,\n\t\t\t_connectorAdj: connectorAdj.length ? connectorAdj : undefined,\n\t\t\t_startCxn: startCxn,\n\t\t\t_endCxn: endCxn,\n\t\t\tline: {\n\t\t\t\ttype: 'solid',\n\t\t\t\tcolor: opts.color || DEF_SHAPE_LINE_COLOR,\n\t\t\t\twidth: typeof opts.width === 'number' ? opts.width : 1,\n\t\t\t\tdashType: opts.dashType || 'solid',\n\t\t\t\tbeginArrowType: opts.beginArrowType,\n\t\t\t\tendArrowType: opts.endArrowType,\n\t\t\t},\n\t\t\taltText: opts.altText,\n\t\t\tobjectName: opts.objectName\n\t\t\t\t? encodeXmlAttrValue(validateObjectName(opts.objectName, 'connector'))\n\t\t\t\t: `Connector ${connectorNameIdx}`,\n\t\t},\n\t}\n\n\ttarget._slideObjects.push(newObject)\n}\n","/**\n * ts-pptx: Image Definition\n *\n * `addImageDefinition` resolves an `addImage()` source, allocates its drawing rel(s) (SVG needs\n * a second for the PNG fallback), registers the media bytes (deduped) and inherits any\n * placeholder geometry. `registerImageFillMedia` does the same media-rel registration for an\n * image *fill* used by a shape or text box.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport { warn } from '../../diagnostics.js'\nimport type { Coord, ImageProps, ObjectOptions, ShapeFillProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { correctShadowOptions } from '../drawingml/effect.js'\nimport { svgMarkupToDataUri } from '../../media/base64.js'\nimport { imageContentType, imageExtensionForSource } from '../../media/content-type.js'\nimport { getImageSizeFromBase64 } from '../../media/image-size.js'\nimport { getSmartParseNumber } from '../../units-internal.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/** DPI PowerPoint assumes when sizing an inserted raster image (natural pixels / 96 == inches) */\nconst IMAGE_NATURAL_DPI = 96\n\n/**\n * Register a raster image fill as a slide media relationship and stash the resolved\n * rId on the fill object so serialization can emit `<a:blipFill r:embed=\"rIdN\">`.\n * Mirrors the non-SVG media-registration path used by `addImageDefinition()`,\n * including de-duplication of identical sources. SVG sources are not\n * supported as fills yet.\n * @param {PresSlideInternal} target - slide the owning object belongs to\n * @param {ShapeFillProps} fill - fill options carrying `image: { path | data }`\n */\nexport function registerImageFillMedia(target: PresSlideInternal, fill: ShapeFillProps): void {\n\tconst strImagePath = fill.image?.path || ''\n\tconst strImageData = fill.image?.data || ''\n\n\tif (!strImagePath && !strImageData) {\n\t\twarn('image-fill/missing-source', 'image fill requires `image.path` or `image.data`; ignoring image fill.')\n\t\tfill.type = 'none'\n\t\treturn\n\t}\n\tif (strImageData && !strImageData.toLowerCase().includes('base64,')) {\n\t\twarn(\n\t\t\t'image-fill/missing-base64-header',\n\t\t\t\"image fill `data` value lacks a base64 header (ex: 'image/png;base64,...'); ignoring image fill.\"\n\t\t)\n\t\tfill.type = 'none'\n\t\treturn\n\t}\n\n\tconst strImgExtn = imageExtensionForSource(strImagePath, strImageData)\n\n\tif (strImgExtn === 'svg') {\n\t\twarn(\n\t\t\t'image-fill/svg-unsupported',\n\t\t\t'SVG image fills are not supported; ignoring image fill. Use a raster format (PNG/JPEG/GIF/BMP/WebP).'\n\t\t)\n\t\tfill.type = 'none'\n\t\treturn\n\t}\n\n\tconst imageRelId = getNewRelId(target)\n\tconst mediaSlideKey =\n\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\tconst imgContentType = imageContentType(strImgExtn)\n\tconst dupeItem = target._relsMedia.find((item) => {\n\t\tif (item.isDuplicate || !item.Target || item.type !== imgContentType) return false\n\t\treturn strImagePath ? item.path === strImagePath : !!strImageData && item.data === strImageData\n\t})\n\n\ttarget._relsMedia.push({\n\t\tpath: strImagePath || 'preencoded.' + strImgExtn,\n\t\ttype: imgContentType,\n\t\textn: strImgExtn,\n\t\tdata: strImageData || '',\n\t\trId: imageRelId,\n\t\tisDuplicate: !!dupeItem?.Target,\n\t\tTarget: dupeItem?.Target\n\t\t\t? dupeItem.Target\n\t\t\t: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.${strImgExtn}`,\n\t})\n\tfill.type = 'image'\n\tfill._imgRid = imageRelId\n}\n\n/**\n * Adds an image object to a slide definition.\n * This method can be called with only two args (opt, target) - this is supposed to be the only way in future.\n * @param {ImageProps} `opt` - object containing `path`/`data`, `x`, `y`, etc.\n * @param {PresSlideInternal} `target` - slide that the image should be added to (if not specified as the 2nd arg)\n * @note: Remote images (eg: \"http://whatev.com/blah\"/from web and/or remote server arent supported yet - we'd need to create an <img>, load it, then send to canvas\n * @see: https://stackoverflow.com/questions/164181/how-to-fetch-a-remote-image-to-display-in-a-canvas)\n */\n/**\n * Normalize an `addImage()` call into a slide image object and register its media relationships.\n *\n * Resolves the image source (path or base64 `data:`), allocates the drawing relationship id(s)\n * — SVG needs a second rId for its PNG rasterization fallback — appends the bytes to\n * `target._relsMedia` (deduping identical sources), and inherits any omitted x/y/w/h from a\n * matching layout picture placeholder. The resulting `SlideObject` is pushed onto the slide;\n * `gen/slide/objects/image.ts` later emits the `<p:pic>`.\n * @param target - slide (or master/group) the image is appended to\n * @param opt - the caller's `ImageProps` (path/data, geometry, sizing, hyperlink, placeholder, …)\n */\nexport function addImageDefinition(target: PresSlideInternal, opt: ImageProps): void {\n\tconst newObject: SlideObject = {\n\t\t_type: SlideObjectType.image,\n\t}\n\n\t// Inherit geometry from a matching layout placeholder: an image targeting a\n\t// placeholder adopts that placeholder's position/size for any of x/y/w/h the caller omits.\n\t// Explicit `opt` values always win; this only fills the gaps so a picture placeholder no longer\n\t// collapses to the image's natural/1in fallback when no dimensions are supplied. Mirrors the\n\t// text-object placeholder inheritance in addTextDefinition().\n\tlet phX: Coord | undefined\n\tlet phY: Coord | undefined\n\tlet phW: Coord | undefined\n\tlet phH: Coord | undefined\n\tif (opt.placeholder && target._slideLayout?._slideObjects) {\n\t\tconst placeHold = target._slideLayout._slideObjects.find(\n\t\t\t(item) => item._type === SlideObjectType.placeholder && item.options?.placeholder === opt.placeholder\n\t\t)\n\t\tif (placeHold?.options) {\n\t\t\tphX = placeHold.options.x\n\t\t\tphY = placeHold.options.y\n\t\t\tphW = placeHold.options.w\n\t\t\tphH = placeHold.options.h\n\t\t}\n\t}\n\n\t// FIRST: Set vars for this image (object param replaces positional args in 1.1.0)\n\tconst intPosX = opt.x ?? phX ?? 0\n\tconst intPosY = opt.y ?? phY ?? 0\n\tconst intWidth = opt.w ?? phW ?? 0\n\tconst intHeight = opt.h ?? phH ?? 0\n\tconst sizing = opt.sizing\n\tconst objHyperlink = opt.hyperlink || ''\n\t// Convenience: accept raw SVG markup via `svg` and encode it to a data URI.\n\t// `data`/`path` win when also supplied, matching the documented precedence.\n\tconst strImageData = opt.data || (opt.svg && !opt.path ? svgMarkupToDataUri(opt.svg) : '')\n\tconst strImagePath = opt.path || ''\n\tlet imageRelId = getNewRelId(target)\n\tconst imageNameIdx = nextObjectNameIdx(target, SlideObjectType.image)\n\tconst objectName = opt.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opt.objectName, 'image'))\n\t\t: `Image ${imageNameIdx}`\n\n\t// REALITY-CHECK: an unusable source has nothing to degrade to — there is no image to place —\n\t// so these reject rather than warn. `addMedia()` already rejects the missing-source and\n\t// missing-header cases, as does the `hyperlink` check further down this same function.\n\tif (!strImagePath && !strImageData) {\n\t\tthrow new InvalidOptionError('image/missing-source', \"addImage(): either 'data' or 'path' is required\")\n\t} else if (strImagePath && typeof strImagePath !== 'string') {\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/path-not-a-string',\n\t\t\t`addImage(): 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(strImagePath)}`\n\t\t)\n\t} else if (strImageData && typeof strImageData !== 'string') {\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/data-not-a-string',\n\t\t\t`addImage(): 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(strImageData)}`\n\t\t)\n\t} else if (strImageData && typeof strImageData === 'string' && !strImageData.toLowerCase().includes('base64,')) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/missing-base64-header',\n\t\t\t\"addImage(): `data` value lacks a base64 header, ex: 'image/png;base64,NMP[...]'\"\n\t\t)\n\t}\n\n\t// STEP 1: Set extension (the `data:` mime wins over the path when both are supplied)\n\tconst strImgExtn = imageExtensionForSource(strImagePath, strImageData)\n\n\t// STEP 2: Set type/path\n\tnewObject._type = SlideObjectType.image\n\tnewObject.image = strImagePath || 'preencoded.png'\n\n\t// STEP 3: Default any missing dimension from the image's intrinsic (natural) size.\n\t// For base64 `data` images the bytes are already in hand, so we can read the\n\t// natural pixel size synchronously and avoid the legacy 1x1 fallback that\n\t// squished data-only images into a 1in square.\n\t// Path images can't be measured synchronously (bytes load async during export),\n\t// so the missing extent is flagged via `_szAuto` and backfilled at serialize time\n\t// once the media bytes are available.\n\t// PowerPoint inserts images at 96 DPI, so natural pixels / 96 == inches.\n\t//\n\t// A vector source is measured for its RATIO only. An SVG's user units are dependable\n\t// relative to each other and merely conventional in absolute terms — a 24-unit icon is\n\t// authored to be drawn at whatever size it is placed, not as a quarter-inch object — so an\n\t// SVG with one side given derives the other, and an SVG with neither keeps the 1in fallback.\n\tlet defWidth = intWidth\n\tlet defHeight = intHeight\n\tlet szAuto: { w: boolean; h: boolean } | undefined\n\tconst vectorWithNoExtent = strImgExtn === 'svg' && !intWidth && !intHeight\n\tif ((!intWidth || !intHeight) && !vectorWithNoExtent) {\n\t\tconst natural = strImageData ? getImageSizeFromBase64(strImageData) : null\n\t\tif (natural) {\n\t\t\tif (!intWidth && !intHeight) {\n\t\t\t\t// Neither given: use the natural size (inches @ 96 DPI)\n\t\t\t\tdefWidth = natural.w / IMAGE_NATURAL_DPI\n\t\t\t\tdefHeight = natural.h / IMAGE_NATURAL_DPI\n\t\t\t} else if (typeof intWidth === 'number' && intWidth && !intHeight) {\n\t\t\t\t// Only width given: preserve aspect ratio for height (same unit as width)\n\t\t\t\tdefHeight = intWidth * (natural.h / natural.w)\n\t\t\t} else if (typeof intHeight === 'number' && intHeight && !intWidth) {\n\t\t\t\t// Only height given: preserve aspect ratio for width (same unit as height)\n\t\t\t\tdefWidth = intHeight * (natural.w / natural.h)\n\t\t\t}\n\t\t} else if (strImagePath) {\n\t\t\t// Path image: defer measurement to serialize time. Record which side(s) to derive\n\t\t\t// from the natural ratio; the 1in fallback below still applies if it stays unmeasurable.\n\t\t\tszAuto = { w: !intWidth, h: !intHeight }\n\t\t}\n\t}\n\n\t// STEP 4: Set image properties & options\n\tconst objectOptions: ObjectOptions = {\n\t\tx: intPosX || 0,\n\t\ty: intPosY || 0,\n\t\tw: defWidth || 1,\n\t\th: defHeight || 1,\n\t\taltText: opt.altText || '',\n\t\trounding: typeof opt.rounding === 'boolean' ? opt.rounding : false,\n\t\tshape: opt.shape,\n\t\tpoints: opt.points,\n\t\trectRadius: opt.rectRadius,\n\t\tshapeAdjust: opt.shapeAdjust,\n\t\tsizing,\n\t\tcrop: opt.crop,\n\t\tplaceholder: opt.placeholder,\n\t\trotate: opt.rotate || 0,\n\t\tflipV: opt.flipV || false,\n\t\tflipH: opt.flipH || false,\n\t\ttransparency: opt.transparency || 0,\n\t\tduotone: opt.duotone,\n\t\tgrayscale: opt.grayscale,\n\t\tbiLevel: opt.biLevel,\n\t\tclrChange: opt.clrChange,\n\t\tobjectName,\n\t\tobjectLock: opt.objectLock,\n\t\tshadow: correctShadowOptions(opt.shadow),\n\t\t...(szAuto ? { _szAuto: szAuto } : {}),\n\t}\n\tnewObject.options = objectOptions\n\n\t// STEP 5: Add this image to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)\n\t// Use a namespaced key for media targets so slide master (sm) and slide layouts (sl-N, _slideNum >= 1000)\n\t// never collide with regular slide media names in large decks.\n\tconst mediaSlideKey =\n\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\tif (strImgExtn === 'svg') {\n\t\t// SVG files consume *TWO* rId's: (a png version and the svg image)\n\t\t// <Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"../media/image1.png\"/>\n\t\t// <Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"../media/image2.svg\"/>\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strImagePath || strImageData + 'png',\n\t\t\ttype: 'image/png',\n\t\t\textn: 'png',\n\t\t\tdata: strImageData || '',\n\t\t\trId: imageRelId,\n\t\t\tTarget: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.png`,\n\t\t\tisSvgPng: true,\n\t\t\tsvgSize: {\n\t\t\t\tw: getSmartParseNumber(objectOptions.w, 'X', target._presLayout),\n\t\t\t\th: getSmartParseNumber(objectOptions.h, 'Y', target._presLayout),\n\t\t\t},\n\t\t})\n\t\tnewObject.imageRid = imageRelId\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strImagePath || strImageData,\n\t\t\ttype: 'image/svg+xml',\n\t\t\textn: strImgExtn,\n\t\t\tdata: strImageData || '',\n\t\t\trId: imageRelId + 1,\n\t\t\tTarget: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.${strImgExtn}`,\n\t\t})\n\t\tnewObject.imageRid = imageRelId + 1\n\t} else {\n\t\t// PERF: Duplicate media should reuse existing `Target` value and not create an additional copy.\n\t\t// File-path images are matched by `path`; base64/`data` images have no real path\n\t\t// (all share the `preencoded.<extn>` placeholder), so they are matched by their data\n\t\t// payload instead so identical inline images are embedded once.\n\t\tconst imgContentType = imageContentType(strImgExtn)\n\t\tconst dupeItem = target._relsMedia.find((item) => {\n\t\t\tif (item.isDuplicate || !item.Target || item.type !== imgContentType) return false\n\t\t\treturn strImagePath ? item.path === strImagePath : !!strImageData && item.data === strImageData\n\t\t})\n\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strImagePath || 'preencoded.' + strImgExtn,\n\t\t\ttype: imgContentType,\n\t\t\textn: strImgExtn,\n\t\t\tdata: strImageData || '',\n\t\t\trId: imageRelId,\n\t\t\tisDuplicate: !!dupeItem?.Target,\n\t\t\tTarget: dupeItem?.Target\n\t\t\t\t? dupeItem.Target\n\t\t\t\t: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.${strImgExtn}`,\n\t\t})\n\t\tnewObject.imageRid = imageRelId\n\t}\n\n\t// STEP 6: Hyperlink support\n\tif (typeof objHyperlink === 'object') {\n\t\tif (!objHyperlink.url && !objHyperlink.slide)\n\t\t\tthrow new InvalidOptionError('hyperlink/missing-target', 'addImage: `hyperlink` requires either `url` or `slide`')\n\t\telse {\n\t\t\timageRelId++\n\n\t\t\ttarget._rels.push({\n\t\t\t\ttype: SlideObjectType.hyperlink,\n\t\t\t\tdata: objHyperlink.slide ? 'slide' : 'dummy',\n\t\t\t\trId: imageRelId,\n\t\t\t\t// `Target` is stored RAW; every emitter escapes it. See the note on `SlideRel.Target`.\n\t\t\t\tTarget: objHyperlink.url ? objHyperlink.url : String(objHyperlink.slide),\n\t\t\t})\n\n\t\t\tobjHyperlink._rId = imageRelId\n\t\t\tnewObject.hyperlink = objHyperlink\n\t\t}\n\t}\n\n\t// STEP 7: Add object to slide\n\ttarget._slideObjects.push(newObject)\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 { ObjectOptions, TableCell, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { getNewRelId } from '../utils.js'\n\ntype HyperlinkTextObject = (TextProps | SlideObject | TableCell) & {\n\toptions?: TextPropsOptions | ObjectOptions\n\ttext?: string | number | TextProps[] | TableCell[]\n}\n\n/**\n * Parses text/text-objects from `addText()` and `addTable()` methods; creates 'hyperlink'-type Slide Rels for each hyperlink found\n * @param {PresSlideInternal} target - slide object that any hyperlinks will be be added to\n * @param {number | string | TextProps | TextProps[] | TableCell[][]} text - text to parse\n */\nexport function createHyperlinkRels(\n\ttarget: PresSlideInternal,\n\ttext: number | string | SlideObject | TextProps | TextProps[] | TableCell[] | TableCell[][],\n\toptions?: TextPropsOptions[]\n): void {\n\tlet textObjs: Array<HyperlinkTextObject | TableCell[]> = []\n\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: \"else if\" Array.isArray must come before typeof===object! Otherwise, code will exhaust recursion!\n\telse if (Array.isArray(text)) textObjs = text\n\telse if (typeof text === 'object') textObjs = [text]\n\n\ttextObjs.forEach((text: HyperlinkTextObject | TableCell[], idx: number) => {\n\t\t// NOTE: `text` can be an array of other `text` objects (table cell word-level formatting), continue parsing using recursion\n\t\tif (Array.isArray(text)) {\n\t\t\tconst cellOpts: TextPropsOptions[] = []\n\t\t\ttext.forEach((tablecell) => {\n\t\t\t\tif (tablecell.options) {\n\t\t\t\t\tcellOpts.push(tablecell.options)\n\t\t\t\t}\n\t\t\t})\n\t\t\tcreateHyperlinkRels(target, text, cellOpts)\n\t\t\treturn\n\t\t}\n\n\t\t// IMPORTANT: `options` are lost due to recursion/copy!\n\t\tif (options && options[idx] && options[idx].hyperlink) text.options = { ...text.options, ...options[idx] }\n\t\tif (Array.isArray(text.text)) {\n\t\t\tcreateHyperlinkRels(target, text.text, options && options[idx] ? [options[idx]] : undefined)\n\t\t} else if (\n\t\t\ttext &&\n\t\t\ttypeof text === 'object' &&\n\t\t\ttext.options &&\n\t\t\ttext.options.hyperlink &&\n\t\t\t!text.options.hyperlink._rId\n\t\t) {\n\t\t\tconst hyperlink = text.options.hyperlink\n\t\t\t// Only a `url` or a `slide` needs a relationship. Two other shapes reach here and mint\n\t\t\t// nothing, for opposite reasons:\n\t\t\t// - A navigation action button (`action` alone) is legitimately rel-free — the\n\t\t\t// `ppaction://hlinkshowjump` action is self-contained, so the emitter writes `r:id=\"\"`.\n\t\t\t// - A malformed hyperlink (not an object, or no target at all) is not reportable here.\n\t\t\t// The run emitter rejects the same input with `hyperlink/not-an-object` /\n\t\t\t// `hyperlink/missing-target` when the deck is written; a console line ahead of that\n\t\t\t// throw was one fault reported twice, the first time unroutably.\n\t\t\tif (typeof hyperlink === 'object' && (hyperlink.url || hyperlink.slide)) {\n\t\t\t\tconst relId = getNewRelId(target)\n\n\t\t\t\ttarget._rels.push({\n\t\t\t\t\ttype: SlideObjectType.hyperlink,\n\t\t\t\t\tdata: hyperlink.slide ? 'slide' : 'dummy',\n\t\t\t\t\trId: relId,\n\t\t\t\t\t// `Target` is stored RAW; every emitter escapes it. See the note on `SlideRel.Target`.\n\t\t\t\t\tTarget: hyperlink.url ? hyperlink.url : String(hyperlink.slide),\n\t\t\t\t})\n\n\t\t\t\thyperlink._rId = relId\n\t\t\t}\n\t\t} else if (\n\t\t\ttext &&\n\t\t\ttypeof text === 'object' &&\n\t\t\ttext.options &&\n\t\t\ttext.options.hyperlink &&\n\t\t\ttext.options.hyperlink._rId\n\t\t) {\n\t\t\tconst hyperlink = text.options.hyperlink\n\t\t\tconst hyperlinkRelId = hyperlink._rId\n\t\t\t// NOTE: auto-paging will create new slides, but skip above as _rId exists, BUT this is a new slide, so add rels!\n\t\t\tif (hyperlinkRelId && !target._rels.some((rel) => rel.rId === hyperlinkRelId)) {\n\t\t\t\ttarget._rels.push({\n\t\t\t\t\ttype: SlideObjectType.hyperlink,\n\t\t\t\t\tdata: hyperlink.slide ? 'slide' : 'dummy',\n\t\t\t\t\trId: hyperlinkRelId,\n\t\t\t\t\t// `Target` is stored RAW; every emitter escapes it. See the note on `SlideRel.Target`.\n\t\t\t\t\tTarget: hyperlink.url ? hyperlink.url : String(hyperlink.slide),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t})\n}\n","/**\n * ts-pptx: Shape Definition\n *\n * `addShapeDefinition` normalizes an `addShape()` preset (mapping friendly aliases, rejecting\n * presets PowerPoint can't parse), applies line defaults, registers hyperlink + image-fill rels,\n * and pushes a `text`-type shape object.\n */\nimport { type SHAPE_NAME, ShapeType, SlideObjectType, VALID_SHAPE_PRESETS } from '../../enums.js'\nimport { DEF_SHAPE_LINE_COLOR } from '../../constants-internal.js'\nimport type { ShapeLineProps, ShapeProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, validateObjectName } from '../utils.js'\nimport { correctShadowOptions } from '../drawingml/effect.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { createHyperlinkRels } from './hyperlinks.js'\nimport { registerImageFillMedia } from './image.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * Map of common friendly shape names users pass as bare strings to their\n * valid OOXML preset values. PowerPoint can't parse the friendly spellings\n * and removes the shape during repair .\n */\nconst SHAPE_NAME_ALIASES: { [key: string]: SHAPE_NAME } = {\n\toval: 'ellipse',\n\trectangle: 'rect',\n\troundedRectangle: 'roundRect',\n\troundedrectangle: 'roundRect',\n}\n\n// ===== Shapes & connectors =====\n\n/**\n * Adds a shape object to a slide definition.\n * @param {PresSlideInternal} target slide object that the shape should be added to\n * @param {SHAPE_NAME} shapeName shape name\n * @param {ShapeProps} opts shape options\n */\nexport function addShapeDefinition(target: PresSlideInternal, shapeName: SHAPE_NAME, opts: ShapeProps): void {\n\tconst options = typeof opts === 'object' ? opts : {}\n\toptions.line = options.line || { type: 'none' }\n\toptions.shadow = correctShadowOptions(options.shadow)\n\t// Normalize friendly shape names (e.g. \"oval\" -> \"ellipse\") to their valid\n\t// OOXML preset spellings before storing on the slide object.\n\tconst resolvedShapeName: SHAPE_NAME =\n\t\ttypeof shapeName === 'string' && SHAPE_NAME_ALIASES[shapeName] ? SHAPE_NAME_ALIASES[shapeName] : shapeName\n\tconst newObject: SlideObject = {\n\t\t_type: SlideObjectType.text,\n\t\tshape: resolvedShapeName || ShapeType.rect,\n\t\toptions,\n\t}\n\n\t// Reality check\n\tif (!shapeName)\n\t\tthrow new InvalidOptionError(\n\t\t\t'shape/missing-type',\n\t\t\t'Missing/Invalid shape parameter! Example: `addShape(ShapeType.line, {x:1, y:1, w:1, h:1});`'\n\t\t)\n\n\t// Reject presets PowerPoint can't parse. An invalid `prst` value (a typo or an\n\t// unmapped friendly name) corrupts the package and triggers the repair dialog,\n\t// so fail loudly here rather than emit degenerate OOXML. Use `ShapeType.*`\n\t// for the canonical names.\n\tif (!VALID_SHAPE_PRESETS.has(resolvedShapeName)) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'shape/unknown-preset',\n\t\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\t)\n\t}\n\n\t// 1: ShapeLineProps defaults\n\t// A stroke can carry a non-solid paint (a `gradient`) just like a fill, so infer the\n\t// stroke `type` from the gradient when the caller omits it (`line: { gradient }`) and\n\t// preserve the gradient through normalization. Only a solid stroke gets the default\n\t// line color; a gradient stroke takes its colors from its stops.\n\t//\n\t// Spread first, then override only the keys this block actually defaults. Listing the\n\t// carried keys instead is what broke `pattern`, `image` and `cap`: each was added to\n\t// `ShapeLineProps` without being added here, so the emitter read a key normalization\n\t// had already dropped — `line: { type: 'pattern' }` reached `genXmlPatternFill` with no\n\t// pattern object and threw. A spread cannot fall out of sync with the type.\n\tconst lineType = options.line.type || (options.line.gradient ? 'gradient' : 'solid')\n\tconst newLineOpts: ShapeLineProps = {\n\t\t...options.line,\n\t\ttype: lineType,\n\t\tcolor: lineType === 'solid' ? options.line.color || DEF_SHAPE_LINE_COLOR : options.line.color,\n\t\ttransparency: options.line.transparency || 0,\n\t\twidth: options.line.width || 1,\n\t\tdashType: options.line.dashType || 'solid',\n\t}\n\tif (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts\n\n\t// 2: Set options defaults\n\toptions.x = options.x || (options.x === 0 ? 0 : 1)\n\toptions.y = options.y || (options.y === 0 ? 0 : 1)\n\toptions.w = options.w || (options.w === 0 ? 0 : 1)\n\toptions.h = options.h || (options.h === 0 ? 0 : 1)\n\t// Shapes are `_type === text` objects, so they share the text-box name bucket (`Shape 0`,\n\t// `Text 1`, …) — which is what stops a shape and a text box colliding on `0`.\n\tconst shapeNameIdx = nextObjectNameIdx(target, SlideObjectType.text)\n\toptions.objectName = options.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(options.objectName, 'shape'))\n\t\t: `Shape ${shapeNameIdx}`\n\n\t// 3: Create hyperlink rels\n\tcreateHyperlinkRels(target, newObject)\n\n\t// 5: Register an image fill (if any) as a media relationship for serialize-time blipFill\n\tif (typeof options.fill === 'object' && (options.fill.type === 'image' || options.fill.image)) {\n\t\tregisterImageFillMedia(target, options.fill)\n\t}\n\n\t// LAST: Add object to slide\n\ttarget._slideObjects.push(newObject)\n}\n","/**\n * ts-pptx: Text Definition\n *\n * `addTextDefinition` cleans shape / run options (color, bullets, placeholder inheritance, body\n * properties, columns, align / valign), registers hyperlink + picture-bullet + image-fill rels,\n * and pushes a `text` / `placeholder` object. `createBulletImageRels` handles the picture-bullet\n * media rels.\n */\nimport { AlignH, type PLACEHOLDER_TYPE, ShapeType, SlideObjectType, TextAnchor } from '../../enums.js'\nimport { DEF_FONT_COLOR, DEF_SHAPE_LINE_COLOR } from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport type { ObjectOptions, ShapeLineProps, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { correctShadowOptions } from '../drawingml/effect.js'\nimport { imageContentType, imageExtensionForSource } from '../../media/content-type.js'\nimport { valToPts } from '../../units-internal.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { createHyperlinkRels } from './hyperlinks.js'\nimport { registerImageFillMedia } from './image.js'\n\n/**\n * Adds a text object to a slide definition.\n * @param {PresSlideInternal} target - slide object that the text should be added to\n * @param {string|TextProps[]} text text string or object\n * @param {TextPropsOptions} opts text options\n * @param {boolean} isPlaceholder whether this a placeholder object\n */\nexport function addTextDefinition(\n\ttarget: PresSlideInternal,\n\ttext: TextProps[],\n\topts: TextPropsOptions,\n\tisPlaceholder: boolean\n): void {\n\tconst textObjects = !text || text.length === 0 ? [{ text: '' }] : text\n\tconst objectOptions: ObjectOptions = opts || {}\n\tconst newObject: SlideObject = {\n\t\t_type: isPlaceholder ? SlideObjectType.placeholder : SlideObjectType.text,\n\t\tshape: opts.shape || ShapeType.rect,\n\t\ttext: textObjects,\n\t\toptions: objectOptions,\n\t}\n\t// One index for the whole text object, taken here rather than inside `cleanOpts` — that runs once\n\t// for the object and again for every run, so naming from inside it would burn an index per run.\n\tconst textNameIdx = nextObjectNameIdx(target, newObject._type)\n\n\tfunction cleanOpts(itemOpts: ObjectOptions): TextPropsOptions {\n\t\t// STEP 1: Set some options\n\t\t{\n\t\t\t// A.1: Color (placeholders should inherit their colors or override them, so don't default them)\n\t\t\tif (!itemOpts.placeholder) {\n\t\t\t\t// A hyperlink run with no color configured anywhere inherits the theme hyperlink color\n\t\t\t\t// (a:schemeClr hlink, and folHlink once visited), which PowerPoint applies automatically\n\t\t\t\t// when the run carries no explicit fill. Defaulting it to DEF_FONT_COLOR would emit a\n\t\t\t\t// solidFill plus hlinkClr=\"tx\", pinning the link to black and suppressing the theme\n\t\t\t\t// hyperlink/visited colors. Only non-hyperlink text falls back to DEF_FONT_COLOR.\n\t\t\t\titemOpts.color =\n\t\t\t\t\titemOpts.color ||\n\t\t\t\t\tobjectOptions.color ||\n\t\t\t\t\ttarget.color ||\n\t\t\t\t\t(itemOpts.hyperlink || objectOptions.hyperlink ? undefined : DEF_FONT_COLOR)\n\t\t\t}\n\n\t\t\t// A.2: Placeholder should inherit their bullets or override them, so don't default them\n\t\t\tif (itemOpts.placeholder || isPlaceholder) {\n\t\t\t\titemOpts.bullet = itemOpts.bullet || false\n\t\t\t}\n\n\t\t\t// A.3: Text targeting a placeholder need to inherit the placeholders options (eg: margin, valign, etc.)\n\t\t\tif (itemOpts.placeholder && target._slideLayout && target._slideLayout._slideObjects) {\n\t\t\t\tconst placeHold = target._slideLayout._slideObjects.filter(\n\t\t\t\t\t(item) =>\n\t\t\t\t\t\titem._type === SlideObjectType.placeholder &&\n\t\t\t\t\t\titem.options &&\n\t\t\t\t\t\titem.options.placeholder &&\n\t\t\t\t\t\titem.options.placeholder === itemOpts.placeholder\n\t\t\t\t)[0]\n\t\t\t\tif (placeHold?.options) itemOpts = { ...itemOpts, ...placeHold.options }\n\t\t\t}\n\n\t\t\t// B:\n\t\t\tif (itemOpts.shape === ShapeType.line) {\n\t\t\t\tconst itemLine = typeof itemOpts.line === 'object' && itemOpts.line ? itemOpts.line : {}\n\t\t\t\t// ShapeLineProps defaults. Spread first, override only what is defaulted here —\n\t\t\t\t// see the same block in define/shape.ts for why listing the carried keys instead\n\t\t\t\t// silently dropped `gradient`, `pattern`, `image` and `cap` off this path.\n\t\t\t\tconst newLineOpts: ShapeLineProps = {\n\t\t\t\t\t...itemLine,\n\t\t\t\t\ttype: itemLine.type || 'solid',\n\t\t\t\t\tcolor: itemLine.color || DEF_SHAPE_LINE_COLOR,\n\t\t\t\t\ttransparency: itemLine.transparency || 0,\n\t\t\t\t\twidth: itemLine.width || 1,\n\t\t\t\t\tdashType: itemLine.dashType || 'solid',\n\t\t\t\t}\n\t\t\t\tif (typeof itemOpts.line === 'object') itemOpts.line = newLineOpts\n\t\t\t}\n\n\t\t\t// C: Line opts\n\t\t\titemOpts.line = itemOpts.line || {}\n\t\t\titemOpts.lineSpacing = itemOpts.lineSpacing && !isNaN(itemOpts.lineSpacing) ? itemOpts.lineSpacing : undefined\n\t\t\titemOpts.lineSpacingMultiple =\n\t\t\t\titemOpts.lineSpacingMultiple && !isNaN(itemOpts.lineSpacingMultiple) ? itemOpts.lineSpacingMultiple : undefined\n\n\t\t\t// D: Transform text options to bodyProperties as thats how we build XML\n\t\t\titemOpts._bodyProp = itemOpts._bodyProp || {}\n\t\t\titemOpts._bodyProp.anchor = !itemOpts.placeholder ? TextAnchor.ctr : undefined // VALS: [t,ctr,b]\n\t\t\t// `textDirection` is the documented public option; `vert` is a legacy/extended alias kept as an\n\t\t\t// escape hatch for the full ST_TextVerticalType range (eaVert, mongolianVert, wordArtVertRtl).\n\t\t\t// Both map directly to the `<a:bodyPr vert=\"…\">` attribute, so prefer the documented one.\n\t\t\titemOpts._bodyProp.vert = itemOpts.textDirection ?? itemOpts.vert // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]\n\t\t\titemOpts._bodyProp.wrap = typeof itemOpts.wrap === 'boolean' ? itemOpts.wrap : true\n\t\t\titemOpts._bodyProp.prstTxWarp = itemOpts.textWarp // preset text warp (`<a:prstTxWarp>`), e.g. 'textArchUp'\n\n\t\t\t// D.1: Text columns (`numCol` range is 1-16 per ECMA-376 ST_TextColumnCount)\n\t\t\tif (itemOpts.columns !== undefined) {\n\t\t\t\tif (\n\t\t\t\t\ttypeof itemOpts.columns !== 'number' ||\n\t\t\t\t\tisNaN(itemOpts.columns) ||\n\t\t\t\t\titemOpts.columns < 1 ||\n\t\t\t\t\titemOpts.columns > 16\n\t\t\t\t) {\n\t\t\t\t\twarn('text/invalid-columns', 'text `columns` must be a number 1-16 (ignoring value)')\n\t\t\t\t} else {\n\t\t\t\t\titemOpts._bodyProp.numCol = Math.round(itemOpts.columns)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (itemOpts.columnSpacing !== undefined) {\n\t\t\t\tif (typeof itemOpts.columnSpacing !== 'number' || isNaN(itemOpts.columnSpacing) || itemOpts.columnSpacing < 0) {\n\t\t\t\t\twarn('text/invalid-column-spacing', 'text `columnSpacing` must be a number >= 0 (ignoring value)')\n\t\t\t\t} else {\n\t\t\t\t\titemOpts._bodyProp.spcCol = valToPts(itemOpts.columnSpacing)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// E: Normalize shorthand `underline: true` to the object form\n\t\t\tif (typeof itemOpts.underline === 'boolean' && itemOpts.underline === true) itemOpts.underline = { style: 'sng' }\n\t\t}\n\n\t\t// STEP 2: Transform `align`/`valign` to XML values, store in _bodyProp for XML gen\n\t\t{\n\t\t\tconst align = (itemOpts.align || '').toLowerCase()\n\t\t\tconst valign = (itemOpts.valign || '').toLowerCase()\n\t\t\tif (align.startsWith('c')) itemOpts._bodyProp.align = AlignH.center\n\t\t\telse if (align.startsWith('l')) itemOpts._bodyProp.align = AlignH.left\n\t\t\telse if (align.startsWith('r')) itemOpts._bodyProp.align = AlignH.right\n\t\t\telse if (align.startsWith('j')) itemOpts._bodyProp.align = AlignH.justify\n\n\t\t\tif (valign.startsWith('b')) itemOpts._bodyProp.anchor = TextAnchor.b\n\t\t\telse if (valign.startsWith('m')) itemOpts._bodyProp.anchor = TextAnchor.ctr\n\t\t\telse if (valign.startsWith('t')) itemOpts._bodyProp.anchor = TextAnchor.t\n\t\t}\n\n\t\t// STEP 3: ROBUST: Set rational values for some shadow props if needed\n\t\tcorrectShadowOptions(itemOpts.shadow)\n\n\t\treturn itemOpts\n\t}\n\n\t// STEP 1: Create/Clean object options\n\tnewObject.options = cleanOpts(objectOptions)\n\n\t// STEP 1a: Selection Pane identity (`objectName`). Set once here, on the shape-level object\n\t// only — not inside `cleanOpts`, which also runs per text run (STEP 2 below). `Slide.addText`'s\n\t// single-string convenience form reuses the same options object for both the shape and its lone\n\t// run, so encoding this inside `cleanOpts` encoded a caller-supplied name twice. A placeholder's\n\t// default identity is its declared name (falling back to its type, then its idx). Placeholders\n\t// are `placeholder`-typed objects and so take their name index from their own bucket; naming\n\t// them `Text N` off the text-box bucket would collide with the slide's real text boxes.\n\tnewObject.options.objectName = newObject.options.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(newObject.options.objectName, 'text'))\n\t\t: isPlaceholder\n\t\t\t? encodeXmlAttrValue(\n\t\t\t\t\tString(\n\t\t\t\t\t\tnewObject.options.placeholder ||\n\t\t\t\t\t\t\tnewObject.options._placeholderType ||\n\t\t\t\t\t\t\t`Placeholder ${newObject.options._placeholderIdx ?? target._slideObjects.length}`\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t: `Text ${textNameIdx}`\n\n\t// STEP 1b: Standalone placeholder type (accessibility \"Missing Slide Title\")\n\t// `placeholder` is documented as a placeholder *type* ('title', 'body', et. al.). When it\n\t// resolves to a layout placeholder the layout object supplies the <p:ph> at serialize time,\n\t// but with a blank/default layout there is no match and no <p:ph> was emitted - so PowerPoint's\n\t// accessibility checker reports the slide as having no title. Record the type here so a real\n\t// <p:ph type=\"...\"/> is emitted on the slide shape even without a matching layout placeholder.\n\tif (!isPlaceholder && newObject.options.placeholder && !newObject.options._placeholderType) {\n\t\tnewObject.options._placeholderType = newObject.options.placeholder as PLACEHOLDER_TYPE\n\t}\n\n\t// STEP 2: Create/Clean text options\n\ttextObjects.forEach((item) => (item.options = cleanOpts(item.options || {})))\n\n\t// STEP 3: Create hyperlinks\n\tcreateHyperlinkRels(target, textObjects)\n\n\t// STEP 4: Create picture-bullet image rels\n\tcreateBulletImageRels(target, newObject.options, textObjects)\n\n\t// STEP 5: Register an image fill (if any) as a media relationship for serialize-time blipFill\n\tif (\n\t\ttypeof newObject.options.fill === 'object' &&\n\t\t(newObject.options.fill.type === 'image' || newObject.options.fill.image)\n\t) {\n\t\tregisterImageFillMedia(target, newObject.options.fill)\n\t}\n\n\t// LAST: Add object to Slide\n\ttarget._slideObjects.push(newObject)\n}\n\n/**\n * Register slide media relationships for any picture bullets (`bullet.image`) used by a text object.\n * Picture bullets render as `<a:buBlip><a:blip r:embed=\"rId..\"/></a:buBlip>`, so the bullet image\n * needs the same media-rel + package-part plumbing as `addImage()`. The assigned `rId` is stored on\n * the bullet options object (`_rId`) so XML generation can reference it.\n * @param {PresSlideInternal} target - slide receiving the rels\n * @param {ObjectOptions} objectOptions - shape-level text options (bullet may live here)\n * @param {TextProps[]} textObjects - per-paragraph text options (bullet may live here too)\n */\nfunction createBulletImageRels(\n\ttarget: PresSlideInternal,\n\tobjectOptions: ObjectOptions,\n\ttextObjects: TextProps[]\n): void {\n\t// Collect every bullet options object that requests a picture bullet (shape-level + per-paragraph).\n\t// Shape-level bullets are later shared by reference onto the first run, so the same object may appear\n\t// twice; the `_rId` guard below makes the registration idempotent.\n\tconst bulletObjs: Array<{ image?: { path?: string; data?: string }; _rId?: number; _rIdSvg?: number }> = []\n\tconst collect = (opts?: TextPropsOptions): void => {\n\t\tif (opts && typeof opts.bullet === 'object' && opts.bullet) bulletObjs.push(opts.bullet)\n\t}\n\tcollect(objectOptions)\n\ttextObjects.forEach((item) => collect(item.options))\n\n\tbulletObjs.forEach((bullet) => {\n\t\tconst img = bullet.image\n\t\tif (!img || (!img.path && !img.data)) return\n\n\t\t// REALITY-CHECK: base64 `data` must carry a base64 header (mirror addImage()). Unlike\n\t\t// `addImage()` this warns rather than throws: refusing the rel is not fatal, because the run\n\t\t// emitter falls back to a default glyph and the deck still opens.\n\t\tif (img.data && (typeof img.data !== 'string' || !img.data.toLowerCase().includes('base64,'))) {\n\t\t\twarn(\n\t\t\t\t'bullet/image-missing-base64-header',\n\t\t\t\t\"bullet.image `data` value lacks a base64 header, ex: 'image/png;base64,iVBOR[...]'\"\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// Auto-paging clones text objects onto new slides while sharing the bullet options object by\n\t\t// reference, so `_rId` may already be set from the originating slide. Skip when this slide already\n\t\t// carries the rel; otherwise (re-)register so the new slide's .rels and media part exist.\n\t\tif (bullet._rId && target._relsMedia.some((rel) => rel.rId === bullet._rId)) return\n\n\t\t// Determine extension: the `data:` mime wins, else parse the path (mirror addImageDefinition())\n\t\tconst strImgExtn = imageExtensionForSource(img.path || '', img.data || '')\n\n\t\tconst relId = bullet._rId || getNewRelId(target)\n\t\tconst mediaSlideKey =\n\t\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\n\t\tif (strImgExtn === 'svg') {\n\t\t\t// SVG bullets consume *TWO* rels, mirroring addImage(): a PNG preview (referenced by the\n\t\t\t// `<a:buBlip><a:blip r:embed>`) plus the SVG itself (referenced by the `asvg:svgBlip` ext).\n\t\t\t// The preview rel is flagged `isSvgPng` so the media pipeline generates its PNG fallback.\n\t\t\ttarget._relsMedia.push({\n\t\t\t\tpath: img.path || img.data + 'png',\n\t\t\t\ttype: 'image/png',\n\t\t\t\textn: 'png',\n\t\t\t\tdata: img.data || '',\n\t\t\t\trId: relId,\n\t\t\t\tTarget: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.png`,\n\t\t\t\tisSvgPng: true,\n\t\t\t})\n\t\t\ttarget._relsMedia.push({\n\t\t\t\tpath: img.path || img.data || 'preencoded.svg',\n\t\t\t\ttype: 'image/svg+xml',\n\t\t\t\textn: 'svg',\n\t\t\t\tdata: img.data || '',\n\t\t\t\trId: relId + 1,\n\t\t\t\tTarget: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.svg`,\n\t\t\t})\n\t\t\tbullet._rId = relId\n\t\t\tbullet._rIdSvg = relId + 1\n\t\t} else {\n\t\t\ttarget._relsMedia.push({\n\t\t\t\tpath: img.path || 'preencoded.' + strImgExtn,\n\t\t\t\ttype: imageContentType(strImgExtn),\n\t\t\t\textn: strImgExtn,\n\t\t\t\tdata: img.data || '',\n\t\t\t\trId: relId,\n\t\t\t\tTarget: `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.${strImgExtn}`,\n\t\t\t})\n\t\t\tbullet._rId = relId\n\t\t}\n\t})\n}\n","/**\n * ts-pptx: Group Definition\n *\n * The group (`<p:grpSp>`) definition layer: `addGroupDefinition` builds a group from child\n * descriptors (recursing for nested groups), `groupObjectsDefinition` lifts already-authored\n * top-level objects into a group, and `addChildDefinition` is the shared child-descriptor\n * dispatch (also used by the slide-master definition).\n */\nimport { ShapeType, SlideObjectType } from '../../enums.js'\nimport { warn } from '../../diagnostics.js'\nimport type { GroupChildProps, GroupProps, SlideMasterObject } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, validateObjectName } from '../utils.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { addChartDefinition } from './chart.js'\nimport { addImageDefinition } from './image.js'\nimport { addShapeDefinition } from './shape.js'\nimport { addTextDefinition } from './text.js'\nimport { InvalidOptionError, UnsupportedFeatureError } from '../../errors.js'\n\n/**\n * Dispatch a key-tagged child-object descriptor (`{ text }`, `{ image }`, `{ shape }`, …) to the\n * matching `add*Definition`. Shared by `createSlideMaster` (slide master `objects`) and\n * `addGroupDefinition` (group children) so the descriptor mapping lives in one place.\n *\n * `placeholder` is intentionally not handled here — it is master-specific and needs the object's\n * index for `_placeholderIdx`, so `createSlideMaster` handles that case itself.\n * @param target - slide (or master) the object is appended to\n * @param object - the child descriptor\n * @returns `true` if the descriptor was recognized and added, else `false`\n */\nexport function addChildDefinition(target: PresSlideInternal, object: SlideMasterObject | GroupChildProps): boolean {\n\tif ('chart' in object)\n\t\taddChartDefinition(target, object.chart.type, object.chart.data, object.chart.opts || object.chart.options || {})\n\telse if ('image' in object) addImageDefinition(target, object.image)\n\telse if ('line' in object) addShapeDefinition(target, ShapeType.line, object.line)\n\telse if ('rect' in object) addShapeDefinition(target, ShapeType.rect, object.rect)\n\telse if ('roundRect' in object) addShapeDefinition(target, ShapeType.roundRect, object.roundRect)\n\telse if ('shape' in object) addShapeDefinition(target, object.shape.type, object.shape.options || {})\n\telse if ('text' in object)\n\t\taddTextDefinition(\n\t\t\ttarget,\n\t\t\tArray.isArray(object.text.text) ? object.text.text : [{ text: object.text.text }],\n\t\t\tobject.text.options || {},\n\t\t\tfalse\n\t\t)\n\telse return false\n\treturn true\n}\n\n/**\n * Build a group (`<p:grpSp>`) render-object from its child descriptors, without appending the\n * group itself to the slide. Nested `group` children recurse, so a group can contain other groups.\n *\n * An identity child coordinate space is kept at every depth (emitted in `gen/slide/object.ts` as\n * `chOff/chExt == off/ext`), so children — including descendants of nested groups — keep their\n * slide-absolute coordinates and grouping is visually a no-op while making the objects one\n * selectable PowerPoint group. Charts, media, tables, and placeholders are not supported as group\n * children yet; each is skipped with a warning. When `opts.x/y/w/h` are omitted the group's bounds\n * are auto-computed (in `gen/slide/object.ts`) as the bounding box of its children.\n *\n * `target` stays the slide at every depth so leaf descendants register their image/chart rels and\n * unique ids slide-level, even when nested inside child groups.\n * @param target - slide the group's leaf children register rels against\n * @param children - the child-object descriptors\n * @param opts - group position/size/name options\n */\nfunction buildGroupObject(target: PresSlideInternal, children: GroupChildProps[], opts: GroupProps): SlideObject {\n\tconst groupObjects: SlideObject[] = []\n\n\t;(children || []).forEach((child) => {\n\t\t// Nested group: recurse and embed the child group object directly (no slide splice — its own\n\t\t// leaf descendants still register against `target` inside the recursive call).\n\t\tif ('group' in child) {\n\t\t\tgroupObjects.push(buildGroupObject(target, child.group.children, child.group.options || {}))\n\t\t\treturn\n\t\t}\n\t\t// Reject object types grouping does not support yet (rels/ID/transform work pending).\n\t\tif ('chart' in child || 'placeholder' in child || 'table' in child || 'media' in child) {\n\t\t\twarn('group/unsupported-child', `addGroup() does not support '${Object.keys(child)[0]}' children yet; skipping.`)\n\t\t\treturn\n\t\t}\n\t\t// Reuse the existing add*Definition logic (which registers any image/chart rels on the slide,\n\t\t// correctly — grouped children still reference slide-level relationships), then move the\n\t\t// just-appended object(s) off the slide's top-level list into this group's child list.\n\t\tconst before = target._slideObjects.length\n\t\tif (!addChildDefinition(target, child)) {\n\t\t\twarn(\n\t\t\t\t'group/unrecognized-child',\n\t\t\t\t`addGroup() received an unrecognized child descriptor (${Object.keys(child).join(', ')}); skipping.`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tgroupObjects.push(...target._slideObjects.splice(before))\n\t})\n\n\t// A group with no renderable children resolves to a zero-size <p:grpSp> (auto-bounds over an empty\n\t// bbox is 0×0). That is the degenerate result AGENTS.md says to warn on rather than emit silently —\n\t// the same class as the partial-frame fallback. Warn once here, at the group that is actually empty:\n\t// a nested empty group has already warned in its own recursion, and its non-empty parent has not.\n\tif (groupObjects.length === 0) {\n\t\twarn(\n\t\t\t'group/no-children',\n\t\t\t`addGroup(): group \"${opts.objectName ?? ''}\" has no renderable children; emitting an empty, zero-size group. ` +\n\t\t\t\t'Pass at least one supported child (text/shape, image, or a nested group).'\n\t\t)\n\t}\n\n\t// Called after the children above so nested groups number inside-out (see `makeGroupObject`).\n\treturn makeGroupObject(target, groupObjects, opts)\n}\n\n/**\n * Wrap already-built child render-objects in a group (`<p:grpSp>`) render-object, without appending\n * the group anywhere. Shared by `buildGroupObject` (children built from descriptors) and\n * `groupObjectsDefinition` (children lifted off the slide) so both entry points name and frame a\n * group identically — including the all-or-nothing frame, which is left to `gen/slide/object.ts` to resolve:\n * passing `x/y/w/h` through unset is what makes the bounds auto-compute to the children's bounding\n * box, so neither caller needs bounds math of its own.\n *\n * Call this *after* the children exist, so nested groups number inside-out: the name index is taken\n * here, and a child group that was built first has already taken a lower one.\n * @param target - slide the group belongs to (owns the name counter)\n * @param groupObjects - the group's child render-objects, in z-order\n * @param opts - group position/size/name options\n */\nfunction makeGroupObject(target: PresSlideInternal, groupObjects: SlideObject[], opts: GroupProps): SlideObject {\n\t// Per slide rather than per process: a module-global counter made two identical presentations\n\t// built in one process disagree on their group names. `Group N` is 1-based, matching PowerPoint.\n\tconst groupNameIdx = nextObjectNameIdx(target, SlideObjectType.group)\n\tconst objectName = opts.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opts.objectName, 'group'))\n\t\t: `Group ${groupNameIdx + 1}`\n\n\treturn {\n\t\t_type: SlideObjectType.group,\n\t\t_groupObjects: groupObjects,\n\t\toptions: {\n\t\t\tx: opts.x,\n\t\t\ty: opts.y,\n\t\t\tw: opts.w,\n\t\t\th: opts.h,\n\t\t\trotate: opts.rotate,\n\t\t\tflipH: opts.flipH,\n\t\t\tflipV: opts.flipV,\n\t\t\tobjectName,\n\t\t\taltText: opts.altText,\n\t\t\tobjectLock: opts.objectLock,\n\t\t},\n\t}\n}\n\n/**\n * Add a group (`<p:grpSp>`) of child objects to a slide. Children may include nested groups.\n * @param target - slide the group is added to\n * @param children - the child-object descriptors\n * @param opts - group position/size/name options\n */\nexport function addGroupDefinition(target: PresSlideInternal, children: GroupChildProps[], opts: GroupProps): void {\n\ttarget._slideObjects.push(buildGroupObject(target, children, opts))\n}\n\n/**\n * Object kinds `groupObjects()` accepts. Text (which shapes and text boxes both are), images,\n * connectors, and groups — the last so consumers can build nested logical groups out of groups they\n * already made. Charts, media, tables, and placeholders are excluded for the same reason\n * `addGroup()` excludes them (rels/id/transform work pending); a placeholder is excluded on top of\n * that because grouping it would sever the layout inheritance that makes it a placeholder.\n */\nconst GROUPABLE_TYPES: readonly SlideObjectType[] = [\n\tSlideObjectType.text,\n\tSlideObjectType.image,\n\tSlideObjectType.connector,\n\tSlideObjectType.group,\n]\n\n/**\n * Depth-first search for an object whose *stored* name is `key`, among group children. Used only to\n * explain a failed lookup, so it takes the same attribute-escaped key the caller already compared\n * against `_slideObjects` (see `groupObjectsDefinition`) rather than escaping again per call.\n */\nfunction findNameInGroups(objects: SlideObject[], key: string): boolean {\n\treturn objects.some((obj) => {\n\t\tif (obj._type !== SlideObjectType.group) return false\n\t\treturn (obj._groupObjects || []).some(\n\t\t\t(child) => child.options?.objectName === key || findNameInGroups([child], key)\n\t\t)\n\t})\n}\n\n/**\n * Move already-authored, top-level slide objects into one group (`<p:grpSp>`), addressed by\n * `objectName`. The counterpart to `addGroup()` for consumers that compose a slide from independent\n * renderers: the objects already exist, so replaying their descriptors just to group them would mean\n * every renderer exposing its internals.\n *\n * Grouping is visually a no-op — children keep their slide-absolute geometry, their ids, their rels,\n * and their relative z-order, exactly as with `addGroup()`. Two ordering rules make that true:\n * children are ordered by their existing slide z-order (**not** by the order they are named, which\n * would silently restack the slide), and the group itself takes the topmost member's former slot, so\n * it lands where the selection's top edge already was.\n *\n * Every failure here throws rather than warns. An unmatched name is not a degenerate deck the author\n * might still want — it means the intended object is silently still loose on the slide, which is the\n * footgun the group was meant to remove.\n * @param target - slide holding the objects\n * @param objectNames - `objectName`s of the top-level objects to group\n * @param opts - group position/size/name options (same semantics as `addGroup()`)\n */\nexport function groupObjectsDefinition(target: PresSlideInternal, objectNames: string[], opts: GroupProps): void {\n\tif (!Array.isArray(objectNames) || objectNames.length === 0) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'group/missing-object-names',\n\t\t\t\"groupObjects() requires a non-empty array of objectNames. Ex: `slide.groupObjects(['Title', 'Logo'])`\"\n\t\t)\n\t}\n\n\tconst requested = new Set<string>()\n\tobjectNames.forEach((name) => {\n\t\tif (typeof name !== 'string' || name.trim().length === 0) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'group/invalid-object-name',\n\t\t\t\t`groupObjects(): every objectName must be a non-empty string (got ${JSON.stringify(name)}).`\n\t\t\t)\n\t\t}\n\t\tif (requested.has(name))\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'group/duplicate-object-name',\n\t\t\t\t`groupObjects(): objectName \"${name}\" was named more than once.`\n\t\t\t)\n\t\trequested.add(name)\n\t})\n\n\t// Resolve every name before moving anything, so a bad name leaves the slide untouched instead of\n\t// half-grouped.\n\tconst members: SlideObject[] = []\n\tobjectNames.forEach((name) => {\n\t\t// Match the stored name, which every `add*Definition` attribute-escapes before it reaches\n\t\t// `options` (same rule as `resolveObjectNameToId`, which this lookup does not go through).\n\t\t// Comparing raw made `groupObjects(['Q&A'])` throw for a shape that is right there on the slide.\n\t\t// Every message below stays on the caller's raw spelling.\n\t\tconst key = encodeXmlAttrValue(name)\n\t\tconst matches = target._slideObjects.filter((obj) => obj.options?.objectName === key)\n\t\tconst [obj, ambiguous] = matches\n\t\tif (!obj) {\n\t\t\t// Distinguish \"no such object\" from \"already grouped\": both leave the caller's name\n\t\t\t// unresolved, but only one of them is a typo.\n\t\t\tconst hint = findNameInGroups(target._slideObjects, key)\n\t\t\t\t? 'it is already inside a group (an object can only belong to one group)'\n\t\t\t\t: 'no top-level object on this slide has that objectName'\n\t\t\tthrow new InvalidOptionError('group/unresolved-object-name', `groupObjects(): cannot group \"${name}\" — ${hint}.`)\n\t\t}\n\t\tif (ambiguous) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'group/ambiguous-object-name',\n\t\t\t\t`groupObjects(): objectName \"${name}\" is ambiguous — ${matches.length} objects on this slide share it. Give them unique objectNames.`\n\t\t\t)\n\t\t}\n\t\tif (!GROUPABLE_TYPES.includes(obj._type) || obj.options?.placeholder) {\n\t\t\tconst kind = obj.options?.placeholder ? 'placeholder' : obj._type\n\t\t\tthrow new UnsupportedFeatureError(\n\t\t\t\t'group/kind-not-groupable',\n\t\t\t\t`groupObjects(): cannot group \"${name}\" — grouping a ${String(kind)} is not supported yet.`\n\t\t\t)\n\t\t}\n\t\tmembers.push(obj)\n\t})\n\n\t// Order children by existing z-order, not by the order named: grouping must not restack the slide.\n\tconst memberSet = new Set(members)\n\tconst children = target._slideObjects.filter((obj) => memberSet.has(obj))\n\n\t// The wrapper takes the topmost member's former slot — i.e. it sits above everything the selection\n\t// sat above, and below everything it sat below. Counting the *survivors* ahead of that slot gives\n\t// the post-removal index directly, so the removal below cannot shift it.\n\tconst topmostIdx = Math.max(...members.map((obj) => target._slideObjects.indexOf(obj)))\n\tconst insertAt = target._slideObjects.slice(0, topmostIdx).filter((obj) => !memberSet.has(obj)).length\n\n\tconst regrouped = target._slideObjects.filter((obj) => !memberSet.has(obj))\n\tregrouped.splice(insertAt, 0, makeGroupObject(target, children, opts))\n\t// Rewrite in place (rather than reassigning `_slideObjects`) so any held reference stays live.\n\ttarget._slideObjects.splice(0, target._slideObjects.length, ...regrouped)\n}\n","/**\n * ts-pptx: Media Definition\n *\n * `addMediaDefinition` registers an `addMedia()` audio / video (or online video) source: each\n * embedded A/V consumes two rels (ECMA video + MS-2007 media) plus a cover image; online videos\n * use the external-link variant. The timing / `<p:pic>` XML is emitted later.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport { IMG_PLAYBTN } from '../../constants-internal.js'\nimport type { MediaProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * Adds a media object to a slide definition.\n * @param {PresSlideInternal} `target` - slide object that the media will be added to\n * @param {MediaProps} `opt` - media options\n */\nexport function addMediaDefinition(target: PresSlideInternal, opt: MediaProps): void {\n\tconst intPosX = opt.x || 0\n\tconst intPosY = opt.y || 0\n\tconst intSizeX = opt.w || 2\n\tconst intSizeY = opt.h || 2\n\tconst strData = opt.data || ''\n\tconst strLink = opt.link || ''\n\tconst strPath = opt.path || ''\n\tconst strType = opt.type || 'audio'\n\tlet strExtn = ''\n\tconst strCover = opt.cover || IMG_PLAYBTN\n\tconst mediaNameIdx = nextObjectNameIdx(target, SlideObjectType.media)\n\tconst objectName = opt.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opt.objectName, 'media'))\n\t\t: `Media ${mediaNameIdx}`\n\tconst slideData: SlideObject = { _type: SlideObjectType.media }\n\n\t// STEP 1: REALITY-CHECK\n\tif (!strPath && !strData && strType !== 'online') {\n\t\tthrow new InvalidOptionError('media/missing-source', 'addMedia(): either `data` or `path` are required!')\n\t} else if (strData && !strData.toLowerCase().includes('base64,')) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'media/missing-base64-header',\n\t\t\t\"addMedia(): `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')\"\n\t\t)\n\t} else if (strCover && !strCover.toLowerCase().includes('base64,')) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'media/cover-missing-base64-header',\n\t\t\t\"addMedia(): `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')\"\n\t\t)\n\t}\n\t// Online Video: requires `link`\n\tif (strType === 'online' && !strLink) {\n\t\tthrow new InvalidOptionError('media/online-missing-link', 'addMedia(): online videos require `link` value')\n\t}\n\n\tstrExtn = opt.extn || (strData ? (strData.split(';')[0] ?? '').split('/')[1] : strPath.split('.').pop()) || 'mp3'\n\n\t// STEP 2: Set type, media\n\tslideData.mtype = strType\n\tslideData.media = strPath || 'preencoded.mov'\n\tslideData.options = {}\n\n\t// Playback looping (embedded audio/video only; online embeds have no timing tree)\n\tif (strType !== 'online') {\n\t\tif (opt.loop) slideData.loop = true\n\t\telse if (typeof opt.loopCount === 'number' && opt.loopCount > 0) slideData.loopCount = opt.loopCount\n\t}\n\n\t// STEP 3: Set media properties & options\n\tslideData.options.x = intPosX\n\tslideData.options.y = intPosY\n\tslideData.options.w = intSizeX\n\tslideData.options.h = intSizeY\n\tslideData.options.objectName = objectName\n\tif (opt.altText) slideData.options.altText = opt.altText\n\tif (opt.objectLock) slideData.options.objectLock = opt.objectLock\n\n\t// STEP 4: Add this media to this Slide Rels (rId/rels count spans all slides! Count all media to get next rId)\n\t/**\n\t * NOTE:\n\t * - rId starts at 2 (hence the intRels+1 below) as slideLayout.xml is rId=1!\n\t *\n\t * NOTE:\n\t * - Audio/Video files consume *TWO* rId's:\n\t * <Relationship Id=\"rId2\" Target=\"../media/media1.mov\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video\"/>\n\t * <Relationship Id=\"rId3\" Target=\"../media/media1.mov\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\"/>\n\t */\n\tif (strType === 'online') {\n\t\tconst relId1 = getNewRelId(target)\n\t\t// A: ECMA video rel (external link) — referenced by <a:videoFile r:link>.\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strPath || 'preencoded' + strExtn,\n\t\t\tdata: 'dummy',\n\t\t\ttype: 'online',\n\t\t\textn: strExtn,\n\t\t\trId: relId1,\n\t\t\tTarget: strLink,\n\t\t})\n\t\tslideData.mediaRid = relId1\n\n\t\t// B: MS-2007 media rel — PowerPoint authors a second external rel sharing the\n\t\t// same link Target; the body points at it via <p14:media r:link>. (Mirrors the\n\t\t// embedded A/V pair, but External and with no media binary part.)\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strPath || 'preencoded' + strExtn,\n\t\t\tdata: 'dummy',\n\t\t\ttype: 'online',\n\t\t\textn: strExtn,\n\t\t\trId: getNewRelId(target),\n\t\t\tTarget: strLink,\n\t\t})\n\n\t\t// C: Add cover (preview/overlay) image\n\t\ttarget._relsMedia.push({\n\t\t\tpath: 'preencoded.png',\n\t\t\tdata: strCover,\n\t\t\ttype: 'image/png',\n\t\t\textn: 'png',\n\t\t\trId: getNewRelId(target),\n\t\t\tTarget: `../media/image-${target._slideNum}-${target._relsMedia.length + 1}.png`,\n\t\t})\n\t} else {\n\t\t// PERF: Duplicate media should reuse existing `Target` value and not create an additional copy.\n\t\t// Path-based media match by `path`; base64/`data` media (which share the `preencoded`\n\t\t// placeholder path) match by their data payload so identical inline media embed once.\n\t\tconst dupeItem = target._relsMedia.find((item) => {\n\t\t\tif (item.isDuplicate || !item.Target || item.type !== strType + '/' + strExtn) return false\n\t\t\treturn strPath ? item.path === strPath : !!strData && item.data === strData\n\t\t})\n\n\t\t// A: \"relationships/video\"\n\t\tconst relId1 = getNewRelId(target)\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strPath || 'preencoded' + strExtn,\n\t\t\ttype: strType + '/' + strExtn,\n\t\t\textn: strExtn,\n\t\t\tdata: strData || '',\n\t\t\trId: relId1,\n\t\t\tisDuplicate: !!dupeItem?.Target,\n\t\t\tTarget: dupeItem?.Target\n\t\t\t\t? dupeItem.Target\n\t\t\t\t: `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.${strExtn}`,\n\t\t})\n\t\tslideData.mediaRid = relId1\n\n\t\t// B: \"relationships/media\"\n\t\ttarget._relsMedia.push({\n\t\t\tpath: strPath || 'preencoded' + strExtn,\n\t\t\ttype: strType + '/' + strExtn,\n\t\t\textn: strExtn,\n\t\t\tdata: strData || '',\n\t\t\trId: getNewRelId(target),\n\t\t\tisDuplicate: !!dupeItem?.Target,\n\t\t\tTarget: dupeItem?.Target\n\t\t\t\t? dupeItem.Target\n\t\t\t\t: `../media/media-${target._slideNum}-${target._relsMedia.length + 0}.${strExtn}`,\n\t\t})\n\n\t\t// C: Add cover (preview/overlay) image\n\t\ttarget._relsMedia.push({\n\t\t\tpath: 'preencoded.png',\n\t\t\ttype: 'image/png',\n\t\t\textn: 'png',\n\t\t\tdata: strCover,\n\t\t\trId: getNewRelId(target),\n\t\t\tTarget: `../media/image-${target._slideNum}-${target._relsMedia.length + 1}.png`,\n\t\t})\n\t}\n\n\t// LAST\n\ttarget._slideObjects.push(slideData)\n}\n","/**\n * ts-pptx: preview/cover image registration.\n *\n * Several objects are drawn from a cached raster the library cannot render itself — a Zoom tile's\n * thumbnail of its target slide, an OLE object's picture of the embedded document. Each registers\n * that raster as an ordinary slide image rel (deduped exactly like `addImage`) and references it by\n * rId. Shared here so the two definers agree on extension sniffing, content type, and de-dup.\n */\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { getNewRelId } from '../utils.js'\nimport { imageContentType, imageExtensionForSource } from '../../media/content-type.js'\n\n/** 32×32 solid #E7E6E6 PNG — the neutral placeholder shown when the caller supplies no cover image. */\nconst PLACEHOLDER_PNG =\n\t'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAxSURBVFhH7c4hAQAACMAw+geFGOAJAGbi5mpRmf1Z7HEdAAAAAAAAAAAAAAAAAADAAPwOyNPFH3F8AAAAAElFTkSuQmCC'\n\n/**\n * Register a preview/cover image as a slide media rel (deduped like `addImage`) and return its rId.\n * Falls back to the gray placeholder PNG when no cover image is supplied.\n * @param target - slide the image rel is registered on\n * @param cover - caller-supplied cover image (`path` or base64 `data`); omitted → gray placeholder\n * @returns the rId of the image rel\n */\nexport function registerPreviewImage(target: PresSlideInternal, cover?: { path?: string; data?: string }): number {\n\tconst strImagePath = cover?.path || ''\n\tlet strImageData = cover?.data || ''\n\tif (!strImagePath && !strImageData) strImageData = 'image/png;base64,' + PLACEHOLDER_PNG\n\tconst extn = imageExtensionForSource(strImagePath, strImageData)\n\n\tconst rId = getNewRelId(target)\n\tconst mediaSlideKey =\n\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\tconst type = imageContentType(extn)\n\tconst dupe = target._relsMedia.find((item) => {\n\t\tif (item.isDuplicate || !item.Target || item.type !== type) return false\n\t\treturn strImagePath ? item.path === strImagePath : item.data === strImageData\n\t})\n\ttarget._relsMedia.push({\n\t\tpath: strImagePath || 'preencoded.' + extn,\n\t\ttype,\n\t\textn,\n\t\tdata: strImageData || '',\n\t\trId,\n\t\tisDuplicate: !!dupe?.Target,\n\t\tTarget: dupe?.Target ? dupe.Target : `../media/image-${mediaSlideKey}-${target._relsMedia.length + 1}.${extn}`,\n\t})\n\treturn rId\n}\n","/**\n * ts-pptx: 3D model Definition (`addModel3d()` — PowerPoint's Insert ▸ 3D Models).\n *\n * Registers the `.glb` payload as an embedded media part plus a preview-picture image rel, and\n * pushes a `SlideObject{ _type: model3d, model3d }` for `gen/slide/objects/model3d.ts` to emit as\n * an `<mc:AlternateContent>` wrapping a `<p:graphicFrame>`.\n *\n * Ground truth for the package-level choices here (verified against a deck authored by PowerPoint\n * via `Shapes.Add3DModel` — `test/read/fixtures/model3d.pptx`):\n * - the payload is referenced with the Microsoft `…/office/2017/06/relationships/model3d` rel\n * type and registered by a content-type `Default` for `glb` — `model/gltf.binary`, spelled\n * with a dot, not the `model/gltf-binary` of the IANA-style media type;\n * - both the payload and the preview picture live in `ppt/media/`, the payload named `model3dN`;\n * - the preview picture is an ordinary image rel, referenced twice — once by `am3d:raster`'s\n * `am3d:blip` and once by the `mc:Fallback` picture.\n *\n * Camera: PowerPoint derives its camera from the model's bounding box (it normalizes the largest\n * extent to 1 metre, then frames the resulting bounding sphere). This library does not parse\n * glTF, so it emits the camera PowerPoint wrote for a 2×2×2 cube and lets the caller override the\n * scale — see `docs/3d-models.md`.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { Model3dProps, Model3dPoint, Model3dCameraProps } from '../../types/model3d.js'\nimport type { PresSlideInternal, SlideObject, Model3dInternal } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { registerPreviewImage } from './preview-image.js'\nimport { InvalidOptionError } from '../../errors.js'\nimport { warn } from '../../diagnostics.js'\n\n/** OPC content type for a glTF binary, as PowerPoint spells it in `[Content_Types].xml`. */\nconst GLB_CONTENT_TYPE = 'model/gltf.binary'\n/** `.rels` `Type` URI for the embedded 3D model part. Note `2017/06` — not the namespace's `2017`. */\nconst MODEL3D_REL_TYPE = 'http://schemas.microsoft.com/office/2017/06/relationships/model3d'\n\n/** Fixed-point denominator for `am3d` linear values: `am3d:up@dy=\"36000000\"` is the unit vector. */\nconst AM3D_UNIT = 36000000\n/** Denominator of every `am3d` rational (`meterPerModelUnit`, `scale`, `illuminance`, `intensity`). */\nconst AM3D_RATIO_DEN = 1000000\n/** `am3d:perspective@fov` is in 60000ths of a degree, like every other DrawingML angle. */\nconst FOV_PER_DEGREE = 60000\n\n/**\n * The camera PowerPoint wrote for the 2×2×2 cube fixture, in caller units (metres / degrees).\n * `z` is `sqrt(3)/2 / sin(22.5°)` — the bounding sphere of a 1-metre cube framed at a 45° fov.\n */\nconst DEFAULT_CAMERA = {\n\tpos: { x: 0, y: 0, z: 2.2630334 },\n\tlookAt: { x: 0, y: 0, z: 0 },\n\tup: { x: 0, y: 1, z: 0 },\n\tfov: 45,\n} as const\n/** `am3d:meterPerModelUnit` for the cube fixture: 1 / (its 2-unit largest extent). */\nconst DEFAULT_METER_PER_MODEL_UNIT = 0.5\n\n/** Reject a non-finite camera component rather than letting `NaN` reach the XML as `\"NaN\"`. */\nfunction toAm3dUnits(point: Model3dPoint | undefined, fallback: Model3dPoint, label: string): Model3dPoint {\n\tconst src = point ?? fallback\n\tfor (const axis of ['x', 'y', 'z'] as const) {\n\t\tif (!Number.isFinite(src[axis])) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'model3d/invalid-camera',\n\t\t\t\t`addModel3d(): camera.${label}.${axis} must be a finite number, got ${String(src[axis])}.`\n\t\t\t)\n\t\t}\n\t}\n\treturn { x: Math.round(src.x * AM3D_UNIT), y: Math.round(src.y * AM3D_UNIT), z: Math.round(src.z * AM3D_UNIT) }\n}\n\n/** Resolve `camera` + `meterPerModelUnit` into the wire units {@link Model3dInternal} carries. */\nfunction resolveCamera(\n\tcamera: Model3dCameraProps | undefined,\n\tmeterPerModelUnit: number | undefined\n): Omit<Model3dInternal, 'modelRid' | 'previewRid'> {\n\tconst fovDeg = camera?.fov ?? DEFAULT_CAMERA.fov\n\tif (!Number.isFinite(fovDeg) || fovDeg <= 0 || fovDeg >= 180) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'model3d/invalid-fov',\n\t\t\t`addModel3d(): camera.fov must be greater than 0 and less than 180 degrees, got ${String(fovDeg)}.`\n\t\t)\n\t}\n\tconst scale = meterPerModelUnit ?? DEFAULT_METER_PER_MODEL_UNIT\n\tif (!Number.isFinite(scale) || scale <= 0) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'model3d/invalid-scale',\n\t\t\t`addModel3d(): meterPerModelUnit must be a finite number greater than 0, got ${String(scale)}.`\n\t\t)\n\t}\n\tconst up = toAm3dUnits(camera?.up, DEFAULT_CAMERA.up, 'up')\n\treturn {\n\t\tpos: toAm3dUnits(camera?.pos, DEFAULT_CAMERA.pos, 'pos'),\n\t\tlookAt: toAm3dUnits(camera?.lookAt, DEFAULT_CAMERA.lookAt, 'lookAt'),\n\t\tup: { dx: up.x, dy: up.y, dz: up.z },\n\t\tfov: Math.round(fovDeg * FOV_PER_DEGREE),\n\t\tmeterPerModelUnitN: Math.round(scale * AM3D_RATIO_DEN),\n\t}\n}\n\n/**\n * Adds an embedded 3D model to a slide definition.\n * @param {PresSlideInternal} target - slide the model will be added to\n * @param {Model3dProps} opt - 3D model options\n */\nexport function addModel3dDefinition(target: PresSlideInternal, opt: Model3dProps): void {\n\tconst strData = opt.data || ''\n\tconst strPath = opt.path || ''\n\n\t// STEP 1: REALITY-CHECK. The payload is the whole point; there is no meaningful default.\n\tif (!strPath && !strData) {\n\t\tthrow new InvalidOptionError('model3d/missing-source', 'addModel3d(): either `data` or `path` are required!')\n\t}\n\n\t// STEP 2: Resolve the camera before touching the rel table, so an invalid option throws without\n\t// leaving a half-registered part behind.\n\tconst camera = resolveCamera(opt.camera, opt.meterPerModelUnit)\n\tconst nameIdx = nextObjectNameIdx(target, SlideObjectType.model3d)\n\tconst objectName = opt.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opt.objectName, 'model3d'))\n\t\t: `3D Model ${nameIdx + 1}`\n\n\t// STEP 3: Register the `.glb` payload rel. Every model gets its own rel and its own camera; the\n\t// package-part de-dup in `package/assemble.ts` still collapses byte-identical payloads to one\n\t// part, which is wanted here (a model is read-only geometry, unlike an OLE payload, which is\n\t// exempted there because double-clicking one would rewrite the other's source).\n\tconst modelRid = getNewRelId(target)\n\tconst mediaSlideKey =\n\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\ttarget._relsMedia.push({\n\t\tpath: strPath || 'preencoded.glb',\n\t\ttype: GLB_CONTENT_TYPE,\n\t\textn: 'glb',\n\t\tdata: strData,\n\t\trId: modelRid,\n\t\tmodel3dRelType: MODEL3D_REL_TYPE,\n\t\tTarget: `../media/model3d-${mediaSlideKey}-${target._relsMedia.length + 1}.glb`,\n\t})\n\n\t// STEP 4: Register the preview picture. Unlike OLE's silent placeholder, say so out loud — a\n\t// missing preview is invisible in PowerPoint (which draws the live model over it) and shows up\n\t// only in thumbnails, PDF export, and older viewers, i.e. long after the deck was checked.\n\tif (!opt.preview?.path && !opt.preview?.data) {\n\t\twarn(\n\t\t\t'model3d/preview-missing',\n\t\t\t'addModel3d(): no `preview` image supplied, so a gray placeholder is embedded. PowerPoint 2019+ ' +\n\t\t\t\t'draws the live model over it, but thumbnails, PDF export and older viewers show the placeholder.'\n\t\t)\n\t}\n\tconst previewRid = registerPreviewImage(target, opt.preview)\n\n\t// LAST: Push the slide object for the `<mc:AlternateContent>` emitter.\n\tconst slideData: SlideObject = {\n\t\t_type: SlideObjectType.model3d,\n\t\toptions: {\n\t\t\tx: opt.x ?? 0,\n\t\t\ty: opt.y ?? 0,\n\t\t\t// A 3D model has no aspect ratio and the library never opens the payload, so — as with\n\t\t\t// `addOleObject` — there is no natural size to measure.\n\t\t\tw: opt.w ?? 4,\n\t\t\th: opt.h ?? 3,\n\t\t\tobjectName,\n\t\t\t...(opt.altText ? { altText: opt.altText } : {}),\n\t\t},\n\t\tmodel3d: { modelRid, previewRid, ...camera },\n\t}\n\ttarget._slideObjects.push(slideData)\n}\n","/**\n * ts-pptx: Notes Definition\n *\n * Normalizes plain or rich `addNotes()` input to a `TextProps[]` run list and pushes a\n * `notes`-type slide object; the notes-slide XML is emitted later by `gen/slide/notes.ts`.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { NotesProps, TextProps } from '../../types/index.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\n\n/**\n * Adds Notes to a slide.\n * @param {PresSlideInternal} `target` slide object\n * @param {string | NotesProps | NotesProps[]} `notes` plain text, or rich runs (inline formatting / hyperlinks)\n */\nexport function addNotesDefinition(target: PresSlideInternal, notes: string | NotesProps | NotesProps[]): void {\n\t// Normalize all input forms to a TextProps[] run list so the notes-slide serializer\n\t// (which reuses the standard text-run generator) can handle plain and rich notes uniformly.\n\tconst runs: TextProps[] =\n\t\ttypeof notes === 'string'\n\t\t\t? [{ text: notes }]\n\t\t\t: (Array.isArray(notes) ? notes : [notes]).map((run) => ({ text: run.text, options: run.options }))\n\n\ttarget._slideObjects.push({\n\t\t_type: SlideObjectType.notes,\n\t\ttext: runs,\n\t})\n}\n","/**\n * ts-pptx: OLE / Embedded Object Definition (`addOleObject()` — PowerPoint's Insert ▸ Object).\n *\n * Registers the payload as an embedded package part plus a preview-picture image rel, and pushes a\n * `SlideObject{ _type: oleObject, ole }` for `gen/slide/objects/ole.ts` to emit as a `<p:graphicFrame>`.\n *\n * Ground truth for the two package-level choices here (verified against a deck authored by\n * PowerPoint via `Shapes.AddOLEObject`):\n * - an embedded Office file (xlsx/docx/pptx — each an OPC package in its own right) is referenced\n * with the `.../relationships/package` rel type and gets a content-type `Default` for its\n * extension; only a non-package OLE server blob uses `.../relationships/oleObject` with a `.bin`\n * part (ECMA-376 Part 1 §15.2.10);\n * - the payload lives in `ppt/embeddings/`, the preview picture in `ppt/media/` as an ordinary image.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { OleObjectProps } from '../../types/media.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, validateObjectName } from '../utils.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { registerPreviewImage } from './preview-image.js'\nimport { InvalidOptionError } from '../../errors.js'\nimport { OFFICE_REL } from '../../ooxml/rel-types.js'\n\nconst OD = 'application/vnd.openxmlformats-officedocument.'\n/** Rel type for an embedded OPC package (an Office file, itself a zip). */\nconst PACKAGE_REL = OFFICE_REL + 'package'\n/** Rel type for a generic OLE-server blob — a compound-file `.bin` (ECMA-376 Part 1 §15.2.10). */\nconst OLE_OBJECT_REL = OFFICE_REL + 'oleObject'\n\ninterface OleFormat {\n\t/** OPC content type, emitted as a `Default` entry for the part's extension. */\n\tcontentType: string\n\t/** `.rels` `Type` URI for the payload part. */\n\trelType: string\n\t/** Default `p:oleObj@progId`. */\n\tprogId: string\n\t/** Default `p:oleObj@name` — how PowerPoint labels the object's kind. */\n\tname: string\n}\n\n/**\n * Embeddable payload formats, keyed by file extension. The six Office extensions are OPC packages\n * and keep their own extension in `ppt/embeddings/`; everything else is embedded as a generic OLE\n * blob under {@link BIN_FORMAT}.\n */\nconst OLE_FORMATS: Record<string, OleFormat> = {\n\txlsx: { contentType: OD + 'spreadsheetml.sheet', relType: PACKAGE_REL, progId: 'Excel.Sheet.12', name: 'Worksheet' },\n\txlsm: {\n\t\tcontentType: 'application/vnd.ms-excel.sheet.macroEnabled.12',\n\t\trelType: PACKAGE_REL,\n\t\tprogId: 'Excel.SheetMacroEnabled.12',\n\t\tname: 'Worksheet',\n\t},\n\tdocx: {\n\t\tcontentType: OD + 'wordprocessingml.document',\n\t\trelType: PACKAGE_REL,\n\t\tprogId: 'Word.Document.12',\n\t\tname: 'Document',\n\t},\n\tdocm: {\n\t\tcontentType: 'application/vnd.ms-word.document.macroEnabled.12',\n\t\trelType: PACKAGE_REL,\n\t\tprogId: 'Word.DocumentMacroEnabled.12',\n\t\tname: 'Document',\n\t},\n\tpptx: {\n\t\tcontentType: OD + 'presentationml.presentation',\n\t\trelType: PACKAGE_REL,\n\t\tprogId: 'PowerPoint.Show.12',\n\t\tname: 'Presentation',\n\t},\n\tpptm: {\n\t\tcontentType: 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',\n\t\trelType: PACKAGE_REL,\n\t\tprogId: 'PowerPoint.ShowMacroEnabled.12',\n\t\tname: 'Presentation',\n\t},\n}\n/** Fallback for any payload that is not one of the {@link OLE_FORMATS} Office packages. */\nconst BIN_FORMAT: OleFormat = {\n\tcontentType: OD + 'oleObject',\n\trelType: OLE_OBJECT_REL,\n\tprogId: 'Package',\n\tname: 'Object',\n}\n\n/** Reverse of {@link OLE_FORMATS}: a caller-supplied `progId` implies the payload's extension. */\nconst EXTN_BY_PROG_ID = new Map(Object.entries(OLE_FORMATS).map(([extn, fmt]) => [fmt.progId.toLowerCase(), extn]))\n/** Reverse of {@link OLE_FORMATS}: a `data:` URI's MIME implies the payload's extension. */\nconst EXTN_BY_CONTENT_TYPE = new Map(\n\tObject.entries(OLE_FORMATS).map(([extn, fmt]) => [fmt.contentType.toLowerCase(), extn])\n)\n\n/**\n * Resolve the embedded part's extension from whatever the caller gave us, in decreasing order of\n * explicitness: `extn`, the `data:` URI's MIME, the `path`'s extension, then the `progId`. Anything\n * unrecognized becomes `bin`, the generic OLE blob — which is what PowerPoint itself writes for a\n * shell-packaged payload, so an unknown extension never leaks into `[Content_Types].xml`.\n */\nfunction resolvePartExtn(opt: OleObjectProps): string {\n\tconst explicit = (opt.extn || '').replace(/^\\./, '').toLowerCase()\n\tif (explicit) return explicit in OLE_FORMATS ? explicit : 'bin'\n\n\tconst mime = /^data:([^;,]+)[;,]/.exec(opt.data || '')?.[1]?.toLowerCase()\n\tconst byMime = mime ? EXTN_BY_CONTENT_TYPE.get(mime) : undefined\n\tif (byMime) return byMime\n\n\tconst file = (opt.path || '').split(/[?#]/)[0] ?? ''\n\tconst byPath = file.includes('.') ? (file.split('.').pop() ?? '').toLowerCase() : ''\n\tif (byPath in OLE_FORMATS) return byPath\n\n\treturn EXTN_BY_PROG_ID.get((opt.progId || '').toLowerCase()) ?? 'bin'\n}\n\n/**\n * Adds an embedded OLE object to a slide definition.\n * @param {PresSlideInternal} target - slide the object will be added to\n * @param {OleObjectProps} opt - OLE object options\n */\nexport function addOleObjectDefinition(target: PresSlideInternal, opt: OleObjectProps): void {\n\tconst strData = opt.data || ''\n\tconst strPath = opt.path || ''\n\n\t// STEP 1: REALITY-CHECK. The payload is the whole point; there is no meaningful default.\n\tif (!strPath && !strData) {\n\t\tthrow new InvalidOptionError('ole/missing-source', 'addOleObject(): either `data` or `path` are required!')\n\t}\n\n\t// STEP 2: Resolve the payload format — part extension, content type, rel type, progId.\n\tconst extn = resolvePartExtn(opt)\n\tconst format = OLE_FORMATS[extn] ?? BIN_FORMAT\n\tconst nameIdx = nextObjectNameIdx(target, SlideObjectType.oleObject)\n\tconst objectName = opt.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opt.objectName, 'oleObject'))\n\t\t: `Object ${nameIdx + 1}`\n\n\t// STEP 3: Register the payload part rel. Deliberately NOT deduped against an identical payload\n\t// elsewhere in the deck: PowerPoint gives every OLE object its own embedding part, and sharing\n\t// one would make editing either object rewrite the other's source.\n\tconst objectRid = getNewRelId(target)\n\tconst mediaSlideKey =\n\t\ttarget._slideNum == null ? 'sm' : target._slideNum >= 1000 ? `sl-${target._slideNum}` : target._slideNum\n\ttarget._relsMedia.push({\n\t\tpath: strPath || `preencoded.${extn}`,\n\t\ttype: format.contentType,\n\t\textn,\n\t\tdata: strData,\n\t\trId: objectRid,\n\t\toleRelType: format.relType,\n\t\tTarget: `../embeddings/oleObject-${mediaSlideKey}-${target._relsMedia.length + 1}.${extn}`,\n\t})\n\n\t// STEP 4: Register the preview picture (gray placeholder when the caller supplied no cover).\n\tconst previewRid = registerPreviewImage(target, opt.cover)\n\n\t// LAST: Push the slide object for the `<p:graphicFrame>` emitter.\n\tconst slideData: SlideObject = {\n\t\t_type: SlideObjectType.oleObject,\n\t\toptions: {\n\t\t\tx: opt.x ?? 0,\n\t\t\ty: opt.y ?? 0,\n\t\t\t// The library never opens the payload, so there is no natural size to measure.\n\t\t\tw: opt.w ?? 4,\n\t\t\th: opt.h ?? 3,\n\t\t\tobjectName,\n\t\t\t...(opt.altText ? { altText: opt.altText } : {}),\n\t\t\t...(opt.objectLock ? { objectLock: opt.objectLock } : {}),\n\t\t},\n\t\tole: {\n\t\t\tobjectRid,\n\t\t\tpreviewRid,\n\t\t\tprogId: opt.progId || format.progId,\n\t\t\tname: format.name,\n\t\t\tshowAsIcon: !!opt.showAsIcon,\n\t\t\t...(typeof opt.imgW === 'number' ? { imgW: opt.imgW } : {}),\n\t\t\t...(typeof opt.imgH === 'number' ? { imgH: opt.imgH } : {}),\n\t\t},\n\t}\n\ttarget._slideObjects.push(slideData)\n}\n","/**\n * ts-pptx: Table Definition\n *\n * `addTableDefinition` applies the `headerRow` / `columns` sugar, normalizes rows into\n * fully-resolved `TableCell`s (incl. 4-side borders), computes width, and — when `autoPage` is\n * set — shreds the table across overflow slides via `getSlidesForTableRows`.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport {\n\tDEF_CELL_BORDER,\n\tDEF_CELL_MARGIN_IN,\n\tDEF_FONT_COLOR,\n\tDEF_FONT_SIZE,\n\tDEF_SLIDE_MARGIN_IN,\n} from '../../constants-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport type {\n\tAddSlideProps,\n\tBorderProps,\n\tPresLayout,\n\tShapeFillProps,\n\tTableCell,\n\tTableProps,\n\tTableRow,\n} from '../../types/index.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { getSlidesForTableRows } from '../table/autopage.js'\nimport { encodeXmlAttrValue, validateObjectName } from '../utils.js'\nimport { getSmartParseNumber } from '../../units-internal.js'\nimport { EMU_PER_INCH } from '../../units.js'\nimport { createHyperlinkRels } from './hyperlinks.js'\nimport { registerImageFillMedia } from './image.js'\nimport { InvalidOptionError } from '../../errors.js'\n\ntype BorderTuple = [BorderProps, BorderProps, BorderProps, BorderProps]\ntype OuterBorderTuple = [BorderProps?, BorderProps?, BorderProps?, BorderProps?]\n\n/**\n * Expand a cell/table border into the 4-side tuple the rest of the pipeline expects.\n * A single `BorderProps` is broadcast to all four sides `[top, right, bottom, left]`;\n * an already-4-element `BorderTuple` passes through unchanged.\n * @param border - one border style (applied to every side) or a per-side tuple\n * @return {BorderTuple} a 4-element `[top, right, bottom, left]` tuple\n */\nfunction normalizeBorderTuple(border: BorderProps | BorderTuple): BorderTuple {\n\treturn Array.isArray(border) ? border : [border, border, border, border]\n}\n\n/** Fill a border's defaulted keys, preserving anything else the caller set (`cap`, `dashType`, …). */\nfunction withBorderDefaults(side: BorderProps): BorderProps {\n\treturn {\n\t\t...side,\n\t\ttype: side.type || DEF_CELL_BORDER.type,\n\t\tcolor: side.color || DEF_CELL_BORDER.color,\n\t\twidth: typeof side.width === 'number' ? side.width : DEF_CELL_BORDER.width,\n\t}\n}\n\n/**\n * Resolve `TableProps.outerBorder` into the `[top, right, bottom, left]` tuple the emitter\n * applies to the table's edge cells, with `undefined` for a side the caller left out.\n *\n * A sparse side is *not* the same as `{ type: 'none' }`: it means \"leave this edge to\n * whatever `border` (or the cell's own `options.border`) already drew\", whereas `'none'` is\n * an explicit instruction to erase the rule there. Keeping the hole is what lets\n * `outerBorder: [rule, undefined, rule, undefined]` add rules above and below a table\n * without also clearing its left and right edges.\n */\nfunction normalizeOuterBorder(outer: TableProps['outerBorder']): OuterBorderTuple | undefined {\n\tif (!outer || typeof outer !== 'object') return undefined\n\tconst sides: OuterBorderTuple = Array.isArray(outer) ? outer : [outer, outer, outer, outer]\n\tconst resolved = ([0, 1, 2, 3] as const).map((idx) => {\n\t\tconst side = sides[idx]\n\t\treturn side && typeof side === 'object' ? withBorderDefaults(side) : undefined\n\t}) as OuterBorderTuple\n\treturn resolved.some((side) => side !== undefined) ? resolved : undefined\n}\n\n/**\n * Adds a table object to a slide definition.\n * @param {PresSlideInternal} target - slide object that the table should be added to\n * @param {TableRow[]} tableRows - table data\n * @param {TableProps} options - table options\n * @param {SlideLayoutInternal} slideLayout - Slide layout\n * @param {PresLayout} presLayout - Presentation layout\n * @param {Function} addSlide - method\n * @param {Function} getSlide - method\n */\n/**\n * Apply the `headerRow` / `columns` inline-styling sugar: bake blanket header/column\n * formatting into per-cell options so it flows through the normal cell pipeline. Sets\n * `opt.hasHeader` when `headerRow` implies it. Returns the (possibly shallow-copied) rows.\n */\nfunction applyTableHeaderColumnSugar(tableRows: TableRow[], opt: TableProps): TableRow[] {\n\tconst hdr = opt.headerRow && typeof opt.headerRow === 'object' ? opt.headerRow : undefined\n\tconst cols = Array.isArray(opt.columns) && opt.columns.length ? opt.columns : undefined\n\tlet srcRows: TableRow[] = tableRows\n\tif ((hdr || cols) && Array.isArray(tableRows[0])) {\n\t\tif (hdr && opt.hasHeader === undefined) opt.hasHeader = true\n\t\tsrcRows = tableRows.map((row, rowIdx) => {\n\t\t\tif (!Array.isArray(row)) return row\n\t\t\t// Column-scoped defaults only apply when we actually have `columns`; the header row\n\t\t\t// alone is a cheaper positional map. Skip untouched body rows to avoid needless copies.\n\t\t\tif (!cols && rowIdx !== 0) return row\n\t\t\tlet colCursor = 0\n\t\t\treturn row.map((cell: number | string | TableCell): TableCell => {\n\t\t\t\tconst cellObj: TableCell =\n\t\t\t\t\ttypeof cell === 'string' || typeof cell === 'number'\n\t\t\t\t\t\t? { text: String(cell), options: {} }\n\t\t\t\t\t\t: { ...cell, options: { ...cell.options } }\n\t\t\t\tconst colDef = cols ? cols[colCursor] : undefined\n\t\t\t\tcolCursor += cellObj.options?.colspan || 1\n\t\t\t\tcellObj.options = {\n\t\t\t\t\t...(colDef && typeof colDef === 'object' ? colDef : {}),\n\t\t\t\t\t...(rowIdx === 0 && hdr ? hdr : {}),\n\t\t\t\t\t...cellObj.options,\n\t\t\t\t}\n\t\t\t\treturn cellObj\n\t\t\t})\n\t\t})\n\t}\n\treturn srcRows\n}\n\n/**\n * Transform loosely-typed table rows (strings / numbers / TableCell) into a grid of\n * well-formed TableCell objects with fully-resolved 4-side cell borders.\n *\n * @param srcRows - the rows as authored, after the `headerRow`/`columns` sugar\n * @param opt - the table's options\n */\nfunction normalizeTableRows(srcRows: TableRow[], opt: TableProps): TableCell[][] {\n\tconst arrRows: TableCell[][] = []\n\tsrcRows.forEach((row, idx) => {\n\t\tconst newRow: TableCell[] = []\n\n\t\tif (Array.isArray(row)) {\n\t\t\trow.forEach((cell: number | string | TableCell) => {\n\t\t\t\t// A:\n\t\t\t\tconst newCellOptions = typeof cell === 'object' && cell.options ? cell.options : {}\n\t\t\t\tconst newCell: TableCell = {\n\t\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t\ttext: '',\n\t\t\t\t\toptions: newCellOptions,\n\t\t\t\t}\n\n\t\t\t\t// B:\n\t\t\t\tif (typeof cell === 'string' || typeof cell === 'number') newCell.text = cell.toString()\n\t\t\t\telse if (cell.text) {\n\t\t\t\t\t// Cell can contain complex text type, or string, or number\n\t\t\t\t\tif (typeof cell.text === 'string' || typeof cell.text === 'number') newCell.text = cell.text.toString()\n\t\t\t\t\telse if (cell.text) newCell.text = cell.text\n\t\t\t\t\t// Capture options\n\t\t\t\t\tif (cell.options && typeof cell.options === 'object') newCell.options = cell.options\n\t\t\t\t}\n\n\t\t\t\t// C: Set cell borders\n\t\t\t\t// A side nobody asked for is written as an explicit `{type:'none'}`. That is direct\n\t\t\t\t// formatting, so it beats any border a built-in table style would draw — which is\n\t\t\t\t// what keeps an unstyled table free of grid lines. Whatever the caller *did* author,\n\t\t\t\t// on the cell or on the table, is untouched.\n\t\t\t\tconst authoredBorder = newCellOptions.border || opt.border\n\t\t\t\tnewCellOptions.border = authoredBorder || [\n\t\t\t\t\t{ type: 'none' },\n\t\t\t\t\t{ type: 'none' },\n\t\t\t\t\t{ type: 'none' },\n\t\t\t\t\t{ type: 'none' },\n\t\t\t\t]\n\t\t\t\tlet cellBorder = newCellOptions.border\n\n\t\t\t\t// CASE 1: border interface is: BorderOptions | [BorderOptions, BorderOptions, BorderOptions, BorderOptions]\n\t\t\t\tif (cellBorder && typeof cellBorder === 'object') {\n\t\t\t\t\tcellBorder = normalizeBorderTuple(cellBorder)\n\t\t\t\t\tnewCellOptions.border = cellBorder\n\t\t\t\t}\n\t\t\t\t// Handle: [null, null, {type:'solid'}, null]\n\t\t\t\tconst cellBorderTuple = newCellOptions.border as BorderTuple\n\t\t\t\tif (!cellBorderTuple[0]) cellBorderTuple[0] = { type: 'none' }\n\t\t\t\tif (!cellBorderTuple[1]) cellBorderTuple[1] = { type: 'none' }\n\t\t\t\tif (!cellBorderTuple[2]) cellBorderTuple[2] = { type: 'none' }\n\t\t\t\tif (!cellBorderTuple[3]) cellBorderTuple[3] = { type: 'none' }\n\n\t\t\t\t// set complete BorderOptions for all sides\n\t\t\t\tconst arrSides = [0, 1, 2, 3] as const\n\t\t\t\tarrSides.forEach((idx) => {\n\t\t\t\t\tconst side = cellBorderTuple[idx]\n\t\t\t\t\t// `withBorderDefaults` spreads first and overrides only the defaulted keys.\n\t\t\t\t\t// Rebuilding the side from a fixed key list dropped `cap` — public on\n\t\t\t\t\t// `BorderProps` and already read by `genTableCellBorderXml`, so every table\n\t\t\t\t\t// border emitted cap=\"flat\" whatever the caller asked for (and `dashType`\n\t\t\t\t\t// would go the same way). The spread also gives each side its own object,\n\t\t\t\t\t// which the single-BorderProps form (one object shared across all four)\n\t\t\t\t\t// relies on.\n\t\t\t\t\tcellBorderTuple[idx] = withBorderDefaults(side)\n\t\t\t\t})\n\t\t\t\tnewCellOptions.border = cellBorderTuple\n\n\t\t\t\t// LAST:\n\t\t\t\tnewRow.push(newCell)\n\t\t\t})\n\t\t} else {\n\t\t\t// The same condition STEP 1 rejects for row 0, reaching us on a later row. It used to log\n\t\t\t// and push an empty row, so a deck built fine and quietly lost a row of content.\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'table/rows-not-nested',\n\t\t\t\t`addTable: 'rows' should be an array of cells! Row ${idx} is ${JSON.stringify(row)}`\n\t\t\t)\n\t\t}\n\n\t\tarrRows.push(newRow)\n\t})\n\treturn arrRows\n}\n\n/**\n * Register the slide media relationship behind every image fill this table uses, so the\n * cell emitter can resolve `<a:blipFill r:embed=\"rIdN\">` instead of warning and dropping\n * the fill. Tables were the last major object kind not wired into `registerImageFillMedia`\n * (shapes do it at `define/shape.ts`, text boxes at `define/text.ts`).\n *\n * Three fill sources are walked, which between them cover every way a picture reaches a table:\n * the resolved cells (per-cell `options.fill`, plus `headerRow` and `columns[i]`, both baked\n * onto cells by the sugar step above), the table-level `fill`, which is *not* baked —\n * `gen/slide/objects/table.ts` copies it onto each cell at emit time — and `tableFill`, which\n * lands on `a:tblPr` itself and so needs its own relationship for the same reason.\n *\n * Keyed on fill **object identity**, not on the image source. The sugar spreads its options\n * shallowly, so one `headerRow` fill object is shared by every cell it styles; registering\n * per cell would mint a redundant relationship each time and let the later call overwrite\n * the `_imgRid` the first one stashed. Two cells given separately-authored fills for the\n * same file still get one relationship each — matching how two shapes sharing an image\n * behave — while the bytes are deduped into a single media part downstream.\n *\n * Must run only after auto-paging has shredded the rows across slides, for the same reason\n * `createHyperlinkRels` does: `target` has to be the slide the cell actually lands on, or\n * every relationship piles onto the first slide.\n */\nfunction registerTableImageFills(target: PresSlideInternal, rows: TableCell[][], opt: TableProps): void {\n\tconst seen = new Set<ShapeFillProps>()\n\tconst register = (fill: ShapeFillProps | undefined): void => {\n\t\t// `type:'image'` and a bare `image:{…}` are both accepted, mirroring the shape path.\n\t\tif (!fill || typeof fill !== 'object') return\n\t\tif (fill.type !== 'image' && !fill.image) return\n\t\tif (seen.has(fill)) return\n\t\tseen.add(fill)\n\t\tregisterImageFillMedia(target, fill)\n\t}\n\n\tregister(opt.fill)\n\tregister(opt.tableFill)\n\trows.forEach((row) => {\n\t\trow.forEach((cell) => {\n\t\t\tregister(cell.options?.fill)\n\t\t})\n\t})\n}\n\nexport function addTableDefinition(\n\ttarget: PresSlideInternal,\n\ttableRows: TableRow[],\n\toptions: TableProps,\n\tslideLayout: SlideLayoutInternal | null,\n\tpresLayout: PresLayout,\n\taddSlide: (options?: AddSlideProps) => PresSlideInternal,\n\tgetSlide: (slideNumber: number) => PresSlideInternal | undefined\n): PresSlideInternal[] {\n\tconst slides: PresSlideInternal[] = [target] // Create array of Slides as more may be added by auto-paging\n\tconst opt: TableProps = options && typeof options === 'object' ? options : {}\n\topt.objectName = opt.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opt.objectName, 'table'))\n\t\t: `Table ${target._slideObjects.filter((obj) => obj._type === SlideObjectType.table).length}`\n\n\t// STEP 0: PLACEHOLDER — a table targeting a layout placeholder inherits that placeholder's\n\t// position/size for any of x/y/w/h the caller omits, mirroring the image and\n\t// text placeholder inheritance. Explicit values always win; this only fills the gaps so\n\t// the table fills the placeholder geometry rather than the default 1in/full-width fallback.\n\tif (opt.placeholder && slideLayout?._slideObjects) {\n\t\tconst placeHold = slideLayout._slideObjects.find(\n\t\t\t(item) => item._type === SlideObjectType.placeholder && item.options?.placeholder === opt.placeholder\n\t\t)\n\t\tif (placeHold?.options) {\n\t\t\tif (opt.x === undefined) opt.x = placeHold.options.x\n\t\t\tif (opt.y === undefined) opt.y = placeHold.options.y\n\t\t\tif (opt.w === undefined) opt.w = placeHold.options.w\n\t\t\tif (opt.h === undefined) opt.h = placeHold.options.h\n\t\t}\n\t}\n\n\t// STEP 1: REALITY-CHECK\n\t{\n\t\t// A: check for empty\n\t\tif (tableRows === null || tableRows.length === 0 || !Array.isArray(tableRows)) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'table/rows-not-an-array',\n\t\t\t\t\"addTable: Array expected! EX: 'slide.addTable( [rows], {options} );'\"\n\t\t\t)\n\t\t}\n\n\t\t// B: check for non-well-formatted array (ex: rows=['a','b'] instead of [['a','b']])\n\t\tif (!tableRows[0] || !Array.isArray(tableRows[0])) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'table/rows-not-nested',\n\t\t\t\t\"addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );'\"\n\t\t\t)\n\t\t}\n\t}\n\n\t// STEP 1.5: `headerRow` / `columns` inline sugar — bake blanket styling into cells as\n\t// direct per-cell formatting so it flows through the normal cell pipeline (incl. border\n\t// defaulting below). Precedence (highest wins), matching how PowerPoint resolves styling\n\t// (direct formatting overrides a style region): explicit per-cell `options` > `headerRow`\n\t// (row 0) > `columns[colIdx]` > `tableStyle`/defaults. The merge is property-level, so a\n\t// header cell keeps `headerRow` typography and takes its column's fill when they differ.\n\t// Setting `headerRow` implies `hasHeader` unless the caller set it explicitly. The caller's\n\t// `tableRows` array is not mutated — only affected rows (and their cells) are shallow-copied.\n\tconst srcRows = applyTableHeaderColumnSugar(tableRows, opt)\n\n\t// STEP 2: Transform `tableRows` into well-formatted TableCell's\n\t// tableRows can be object or plain text array: `[{text:'cell 1'}, {text:'cell 2', options:{color:'ff0000'}}]` | `[\"cell 1\", \"cell 2\"]`\n\tconst arrRows = normalizeTableRows(srcRows, opt)\n\n\t// STEP 3: Set options\n\t// Keep x/y/w/h as raw user `Coord` (inches/percent/unit-string). They are resolved to EMU\n\t// exactly once at emission (`gen/slide/objects/table.ts`) and by the auto-pager (getSlidesForTableRows); no\n\t// pre-conversion here, so a value is never parsed twice. Default position is 0.5in.\n\tif (opt.x === undefined || opt.x === null) opt.x = 0.5\n\tif (opt.y === undefined || opt.y === null) opt.y = 0.5\n\t// NOTE: Dont set default `h` - leaving it null triggers auto-rowH in `makeXMLSlide()`\n\topt.fontSize = opt.fontSize || DEF_FONT_SIZE\n\topt.margin = opt.margin === 0 || opt.margin ? opt.margin : DEF_CELL_MARGIN_IN\n\tif (typeof opt.margin === 'number')\n\t\topt.margin = [Number(opt.margin), Number(opt.margin), Number(opt.margin), Number(opt.margin)]\n\t// defensive fallback - if `opt.margin` is not a 4-element array of finite numbers, use defaults so non-numeric table-level margins don't leak NaN into <a:tcPr>\n\tif (\n\t\t!Array.isArray(opt.margin) ||\n\t\topt.margin.length !== 4 ||\n\t\topt.margin.some((v: unknown) => typeof v !== 'number' || !Number.isFinite(v))\n\t) {\n\t\topt.margin = DEF_CELL_MARGIN_IN\n\t}\n\t// Black lands on the table and is inherited by every cell that has no colour of its own\n\t// (`gen/slide/objects/table.ts`), as direct formatting. One thing stands it down: a\n\t// hyperlink anywhere in the grid, because the default paints the whole run, so the words\n\t// *after* a link come out black instead of following the link colour. That run is then\n\t// emitted with no `<a:solidFill>` and PowerPoint resolves the text from the theme's `tx1`.\n\tif (!JSON.stringify({ arrRows }).includes('hyperlink')) {\n\t\tif (!opt.color) opt.color = DEF_FONT_COLOR // table option > inherit from Slide > default to black\n\t}\n\tif (typeof opt.border === 'string') {\n\t\twarn('table/invalid-border', \"addTable `border` option must be an object. Ex: `{border: {type:'none'}}`\")\n\t\topt.border = undefined\n\t} else if (Array.isArray(opt.border)) {\n\t\tconst border = opt.border\n\t\t;([0, 1, 2, 3] as const).forEach((idx) => {\n\t\t\tconst side = border[idx]\n\t\t\tborder[idx] = side ? withBorderDefaults(side) : { type: 'none' }\n\t\t})\n\t}\n\tif (typeof opt.outerBorder === 'string') {\n\t\twarn(\n\t\t\t'table/invalid-outer-border',\n\t\t\t\"addTable `outerBorder` option must be an object. Ex: `{outerBorder: {type:'solid'}}`\"\n\t\t)\n\t\topt.outerBorder = undefined\n\t}\n\t// The perimeter is resolved here but applied at emit time: which cells sit on the table's\n\t// outer edge is only knowable once the merge grid exists, and the serializer is what builds\n\t// it — a colspan reaching the last column puts that column's rule on a *covered* cell.\n\topt.outerBorder = normalizeOuterBorder(opt.outerBorder)\n\n\topt.autoPage = typeof opt.autoPage === 'boolean' ? opt.autoPage : false\n\topt.autoPagePlaceholder = typeof opt.autoPagePlaceholder === 'boolean' ? opt.autoPagePlaceholder : false\n\topt.autoPageRepeatHeader = typeof opt.autoPageRepeatHeader === 'boolean' ? opt.autoPageRepeatHeader : false\n\topt.autoPageHeaderRows =\n\t\ttypeof opt.autoPageHeaderRows !== 'undefined' && !isNaN(Number(opt.autoPageHeaderRows))\n\t\t\t? Number(opt.autoPageHeaderRows)\n\t\t\t: 1\n\topt.autoPageLineWeight =\n\t\ttypeof opt.autoPageLineWeight !== 'undefined' && !isNaN(Number(opt.autoPageLineWeight))\n\t\t\t? Number(opt.autoPageLineWeight)\n\t\t\t: 0\n\tif (opt.autoPageLineWeight) {\n\t\tif (opt.autoPageLineWeight > 1) opt.autoPageLineWeight = 1\n\t\telse if (opt.autoPageLineWeight < -1) opt.autoPageLineWeight = -1\n\t}\n\t// autoPage ^^^\n\n\t// Set/Calc table width\n\t// Get slide margins - start with default values, then adjust if master or slide margins exist\n\tlet arrTableMargin = DEF_SLIDE_MARGIN_IN\n\t// Master margins override the defaults, if present\n\tif (slideLayout && typeof slideLayout._margin !== 'undefined') {\n\t\tif (Array.isArray(slideLayout._margin)) arrTableMargin = slideLayout._margin\n\t\telse if (!isNaN(Number(slideLayout._margin))) {\n\t\t\tarrTableMargin = [\n\t\t\t\tNumber(slideLayout._margin),\n\t\t\t\tNumber(slideLayout._margin),\n\t\t\t\tNumber(slideLayout._margin),\n\t\t\t\tNumber(slideLayout._margin),\n\t\t\t]\n\t\t}\n\t}\n\n\t/**\n\t * Calc table width depending upon what data we have - several scenarios exist (including bad data, eg: colW doesnt match col count)\n\t * The API does not require a `w` value, but XML generation does, hence, code to calc a width below using colW value(s)\n\t */\n\tif (opt.colW) {\n\t\tconst firstRowColCnt = (arrRows[0] ?? []).reduce((totalLen, c) => {\n\t\t\tif (c?.options?.colspan && typeof c.options.colspan === 'number') {\n\t\t\t\ttotalLen += c.options.colspan\n\t\t\t} else {\n\t\t\t\ttotalLen += 1\n\t\t\t}\n\t\t\treturn totalLen\n\t\t}, 0)\n\n\t\tif (typeof opt.colW === 'string' || typeof opt.colW === 'number') {\n\t\t\t// Ex: `colW = 3` or `colW = '3'`\n\t\t\topt.w = Math.floor(Number(opt.colW) * firstRowColCnt)\n\t\t\topt.colW = undefined // IMPORTANT: Unset `colW` so table is created using `opt.w`, which will evenly divide cols\n\t\t} else if (opt.colW && Array.isArray(opt.colW) && opt.colW.length === 1 && firstRowColCnt > 1) {\n\t\t\t// Ex: `colW=[3]` but with >1 cols (same as above, user is saying \"use this width for all\")\n\t\t\topt.w = Math.floor(Number(opt.colW) * firstRowColCnt)\n\t\t\topt.colW = undefined // IMPORTANT: Unset `colW` so table is created using `opt.w`, which will evenly divide cols\n\t\t} else if (opt.colW && Array.isArray(opt.colW) && opt.colW.length !== firstRowColCnt) {\n\t\t\t// Err: Mismatched colW and cols count\n\t\t\twarn(\n\t\t\t\t'table/col-width-count-mismatch',\n\t\t\t\t'addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths.'\n\t\t\t)\n\t\t\topt.colW = undefined\n\t\t}\n\t} else if (opt.w) {\n\t\t// Keep raw user `Coord` — resolved to EMU once at emission. (No pre-conversion.)\n\t} else {\n\t\topt.w = Math.floor((presLayout._sizeW || presLayout.width) / EMU_PER_INCH - arrTableMargin[1] - arrTableMargin[3])\n\t}\n\n\t// Shrink-to-fit (`fitColumns: 'shrink'`): proportionally scale columns down so a\n\t// too-wide table fits between `x` and the right slide margin. Runs after the width-calc\n\t// above so it sees the resolved form — either a surviving per-column `colW` array, or a\n\t// single `w`. Rewriting the widths here (the table definition) means both the emitter and\n\t// the measured-fit pass inherit the fitted grid; shrink only, no minimum-width floor.\n\tif (opt.fitColumns === 'shrink') {\n\t\tconst slideWin = (presLayout._sizeW || presLayout.width) / EMU_PER_INCH\n\t\tconst xIn = getSmartParseNumber(opt.x, 'X', presLayout) / EMU_PER_INCH\n\t\t// `arrTableMargin` is TRBL, so the margin to the RIGHT of the table is index 1. This\n\t\t// read index 3 (the left margin) — invisible with the default symmetric [0.5 × 4], and\n\t\t// wrong by the difference for any master whose `_margin` is asymmetric, which is\n\t\t// exactly the layout a caller sets a left gutter on.\n\t\tconst availWin = slideWin - xIn - arrTableMargin[1]\n\t\tif (availWin > 0) {\n\t\t\tif (Array.isArray(opt.colW)) {\n\t\t\t\tconst sumIn = opt.colW.reduce((p, n) => p + (Number.isFinite(n) ? n : 0), 0)\n\t\t\t\tif (sumIn > availWin) {\n\t\t\t\t\tconst factor = availWin / sumIn\n\t\t\t\t\topt.colW = opt.colW.map((n) => (Number.isFinite(n) ? n * factor : n))\n\t\t\t\t\topt.w = availWin\n\t\t\t\t}\n\t\t\t} else if (typeof opt.w === 'number' && opt.w > availWin) {\n\t\t\t\topt.w = availWin\n\t\t\t}\n\t\t}\n\t}\n\n\t// STEP 5: Loop over cells: transform each to TableCell; check to see whether to unset `autoPage` while here\n\tarrRows.forEach((row) => {\n\t\trow.forEach((cell, idy) => {\n\t\t\t// A: Transform cell data if needed\n\t\t\t/* Table rows can be an object or plain text - transform into object when needed\n\t\t\t\t// EX:\n\t\t\t\tconst arrTabRows1 = [\n\t\t\t\t\t[ { text:'A1\\nA2', options:{rowspan:2, fill:'99FFCC'} } ]\n\t\t\t\t\t,[ 'B2', 'C2', 'D2', 'E2' ]\n\t\t\t\t]\n\t\t\t*/\n\t\t\tif (typeof cell === 'number' || typeof cell === 'string') {\n\t\t\t\t// Grab table formatting `opts` to use here so text style/format inherits as it should\n\t\t\t\trow[idy] = { _type: SlideObjectType.tablecell, text: String(row[idy]), options: opt }\n\t\t\t} else if (typeof cell === 'object') {\n\t\t\t\tconst target = row[idy]\n\t\t\t\tif (!target) return\n\t\t\t\t// ARG0: `text` (numeric input was already coerced to a string in the first pass)\n\t\t\t\tif (typeof cell.text === 'undefined' || cell.text === null) target.text = ''\n\n\t\t\t\t// ARG1: `options`: ensure options exists\n\t\t\t\ttarget.options = cell.options || {}\n\n\t\t\t\t// Set type to tabelcell\n\t\t\t\ttarget._type = SlideObjectType.tablecell\n\t\t\t}\n\n\t\t\t// B: Check for fine-grained formatting, disable auto-page when found\n\t\t\t// Since genXmlTextBody already checks for text array ( text:[{},..{}] ) we're done!\n\t\t\t// Text in individual cells will be formatted as they are added by calls to genXmlTextBody within table builder\n\t\t})\n\t})\n\n\t// If autoPage = true, we need to return references to newly created slides if any\n\tconst newAutoPagedSlides: PresSlideInternal[] = []\n\n\t// STEP 6: Auto-Paging: (via {options} and used internally)\n\t// (used internally by `tableToSlides()` to not engage recursion - we've already paged the table data, just add this one)\n\tif (opt && !opt.autoPage) {\n\t\t// Create hyperlink rels (IMPORTANT: Wait until table has been shredded across Slides or all rels will end-up on Slide 1!)\n\t\tcreateHyperlinkRels(target, arrRows)\n\n\t\t// Same timing rule as the hyperlink rels above: resolve cell image fills to media rels\n\t\t// on the slide this table actually landed on.\n\t\tregisterTableImageFills(target, arrRows, opt)\n\n\t\t// Add slideObjects (NOTE: Use `extend` to avoid mutation)\n\t\t// `columns` (per-column TableCellProps[]) is consumed in STEP 1.5 and baked into cells;\n\t\t// drop it here so it is not carried into `ObjectOptions`, where `columns` is the unrelated\n\t\t// text-column *count* (`number`). Leaving it in would be both meaningless and a type clash.\n\t\ttarget._slideObjects.push({\n\t\t\t_type: SlideObjectType.table,\n\t\t\tarrTabRows: arrRows,\n\t\t\toptions: { ...opt, columns: undefined },\n\t\t})\n\t} else {\n\t\tif (opt.autoPageRepeatHeader)\n\t\t\topt._arrObjTabHeadRows = arrRows.filter((_row, idx) => idx < (opt.autoPageHeaderRows || 1))\n\n\t\t// snapshot populated placeholders on the source slide (e.g. a title added via\n\t\t// `addText(text, { placeholder })`) so they can be re-rendered on each overflow slide.\n\t\t// Overflow slides otherwise inherit only the layout's empty placeholders. Captured before\n\t\t// the loop so the table object added per-slide below is never included.\n\t\tconst sourcePlaceholders =\n\t\t\topt.autoPagePlaceholder && Array.isArray(target._slideObjects)\n\t\t\t\t? target._slideObjects.filter((obj) => obj._type !== SlideObjectType.table && obj.options?.placeholder)\n\t\t\t\t: []\n\n\t\t// Loop over rows and create 1-N tables as needed\n\t\tgetSlidesForTableRows(arrRows, opt, presLayout, slideLayout).forEach((slide, idx) => {\n\t\t\t// A: Create new Slide when needed, otherwise, use existing (NOTE: More than 1 table can be on a Slide, so we will go up AND down the Slide chain)\n\t\t\tlet newSlide = getSlide(target._slideNum + idx)\n\t\t\tif (!newSlide) {\n\t\t\t\tnewSlide = addSlide({ masterTitle: slideLayout?._name || undefined })\n\t\t\t\tslides.push(newSlide)\n\t\t\t}\n\n\t\t\t// B: Reset opt.y to `option`/`margin` after first Slide\n\t\t\t// Keep raw inches — resolved to EMU once at emission. (No pre-conversion.)\n\t\t\tif (idx > 0) opt.y = opt.autoPageSlideStartY || arrTableMargin[0]\n\n\t\t\t// C: Add this table to new Slide\n\t\t\t{\n\t\t\t\topt.autoPage = false\n\n\t\t\t\t// copy the source slide's populated placeholders onto each overflow slide\n\t\t\t\t// (idx 0 is the source slide itself and already has them).\n\t\t\t\tif (idx > 0 && sourcePlaceholders.length > 0) {\n\t\t\t\t\tsourcePlaceholders.forEach((ph) => newSlide._slideObjects.push(structuredClone(ph)))\n\t\t\t\t}\n\n\t\t\t\t// Create hyperlink rels (IMPORTANT: Wait until table has been shredded across Slides or all rels will end-up on Slide 1!)\n\t\t\t\tcreateHyperlinkRels(newSlide, slide.rows)\n\n\t\t\t\t// Add rows to new slide. When `rowH` is an array it is keyed by *original* row index,\n\t\t\t\t// which no longer matches the per-slide physical row order after pagination; use the\n\t\t\t\t// per-slide heights the auto-pager resolved so each row keeps its configured height\n\t\t\t\t// instead of inheriting whatever row lands at the same index.\n\t\t\t\t// `slide.rowH` may contain `undefined` holes (auto-height rows); the table serializer\n\t\t\t\t// treats a falsy per-row height as \"auto\", so the cast to number[] is safe.\n\t\t\t\tnewSlide.addTable(slide.rows, {\n\t\t\t\t\t...opt,\n\t\t\t\t\trowH: Array.isArray(opt.rowH) && slide.rowH ? (slide.rowH as number[]) : opt.rowH,\n\t\t\t\t})\n\n\t\t\t\t// Add reference to the new slide so it can be returned, but don't add the first one because the user already has a reference to that one.\n\t\t\t\tif (idx > 0) newAutoPagedSlides.push(newSlide)\n\t\t\t}\n\t\t})\n\t}\n\treturn newAutoPagedSlides\n}\n","/**\n * ts-pptx: Zoom Definition (Slide / Section / Summary Zoom — Insert ▸ Zoom).\n *\n * Resolves a zoom's target(s) to the ids the emitter needs (`sldId` / section GUID), registers\n * the preview-image media rel and the `.../slide` fallback rel(s), lays out the Summary Zoom grid,\n * and pushes a `SlideObject{ _type: zoom, zoom }` for `gen/slide/objects/zoom.ts` to emit as a\n * `<p:graphicFrame>`. See {@link ../../types/zoom} for the preview-image behavior.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport { warn } from '../../diagnostics.js'\nimport type { SectionZoomProps, SlideZoomProps, SummaryZoomProps } from '../../types/zoom.js'\nimport type {\n\tPresSlideInternal,\n\tSectionInternalProps,\n\tSlideObject,\n\tZoomInternal,\n\tZoomTileInternal,\n} from '../../types/internal.js'\nimport { encodeXmlAttrValue, getNewRelId, getUuid, validateObjectName } from '../utils.js'\nimport { getSmartParseNumber } from '../../units-internal.js'\nimport { nextObjectNameIdx } from './object-name.js'\nimport { registerPreviewImage } from './preview-image.js'\n\nconst ZOOM_LABEL = { slide: 'Slide Zoom', section: 'Section Zoom', summary: 'Summary Zoom' } as const\n\n/** A fresh, braced, upper-case v4 GUID for a `zmPr@id`. */\nfunction zoomGuid(): string {\n\treturn `{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}`\n}\n\n/** Register a `.../slide` rel (used by the fallback picture's `hlinkClick`) to a 1-based slide number. */\nfunction registerSlideRel(target: PresSlideInternal, slideNum: number): number {\n\tconst rId = getNewRelId(target)\n\ttarget._rels.push({ type: SlideObjectType.hyperlink, data: 'slide', rId, Target: String(slideNum) })\n\treturn rId\n}\n\n/** Shared object-name + object-scaffold for all three variants. */\nfunction pushZoomObject(\n\ttarget: PresSlideInternal,\n\tvariant: ZoomInternal['variant'],\n\topts: SlideZoomProps | SectionZoomProps | SummaryZoomProps,\n\tzoom: Omit<ZoomInternal, 'variant'>\n): void {\n\tconst nameIdx = nextObjectNameIdx(target, SlideObjectType.zoom)\n\tconst objectName = opts.objectName\n\t\t? encodeXmlAttrValue(validateObjectName(opts.objectName, 'zoom'))\n\t\t: `${ZOOM_LABEL[variant]} ${nameIdx + 1}`\n\tconst newObject: SlideObject = {\n\t\t_type: SlideObjectType.zoom,\n\t\toptions: { x: opts.x ?? 0, y: opts.y ?? 0, w: opts.w ?? 0, h: opts.h ?? 0, objectName },\n\t\tzoom: { variant, ...zoom },\n\t}\n\ttarget._slideObjects.push(newObject)\n}\n\n/** Slide Zoom — one tile linking to a single target slide. */\nexport function addSlideZoomDefinition(target: PresSlideInternal, opts: SlideZoomProps): void {\n\tif (!opts?.target) {\n\t\twarn(\n\t\t\t'zoom/missing-target',\n\t\t\t'addSlideZoom requires a `target` slide (a Slide object or its 1-based number); ignoring.'\n\t\t)\n\t\treturn\n\t}\n\tconst targetSlide = opts.target as PresSlideInternal\n\tconst sldId = typeof opts.target === 'number' ? 256 + (opts.target - 1) : targetSlide._slideId\n\tconst slideNum = typeof opts.target === 'number' ? opts.target : targetSlide._slideNum\n\tif (sldId == null || slideNum == null) {\n\t\twarn('zoom/unresolved-target', 'addSlideZoom: could not resolve the target slide; ignoring.')\n\t\treturn\n\t}\n\n\tconst previewRid = registerPreviewImage(target, opts.coverImage)\n\tconst fallbackSlideRid = registerSlideRel(target, slideNum)\n\tconst tile: ZoomTileInternal = { sldId, previewRid, fallbackSlideRid, zmPrId: zoomGuid() }\n\tpushZoomObject(target, 'slide', opts, {\n\t\ttiles: [tile],\n\t\treturnToParent: !!opts.returnToParent,\n\t\ttransitionDur: opts.transitionDur ?? 1000,\n\t})\n}\n\n/** Section Zoom — one tile linking to the start of a named section. */\nexport function addSectionZoomDefinition(\n\ttarget: PresSlideInternal,\n\topts: SectionZoomProps,\n\tsections: SectionInternalProps[]\n): void {\n\tif (!opts?.sectionTitle) {\n\t\twarn('zoom/missing-section-title', 'addSectionZoom requires a `sectionTitle`; ignoring.')\n\t\treturn\n\t}\n\tconst section = sections.find((s) => s.title === opts.sectionTitle)\n\tif (!section) {\n\t\twarn('zoom/section-not-found', `addSectionZoom: no section titled \"${opts.sectionTitle}\"; ignoring.`)\n\t\treturn\n\t}\n\tconst firstSlide = section._slides[0]\n\tif (!firstSlide) {\n\t\twarn('zoom/section-empty', `addSectionZoom: section \"${opts.sectionTitle}\" has no slides; ignoring.`)\n\t\treturn\n\t}\n\n\tconst previewRid = registerPreviewImage(target, opts.coverImage)\n\tconst fallbackSlideRid = registerSlideRel(target, firstSlide._slideNum)\n\tconst tile: ZoomTileInternal = { sectionId: section._id, previewRid, fallbackSlideRid, zmPrId: zoomGuid() }\n\tpushZoomObject(target, 'section', opts, {\n\t\ttiles: [tile],\n\t\treturnToParent: !!opts.returnToParent,\n\t\ttransitionDur: opts.transitionDur ?? 1000,\n\t})\n}\n\n/**\n * Summary Zoom — a grid of tiles, one per section (excluding the host slide's own section).\n * All tiles share the single placeholder/cover image; each links to its section's first slide.\n */\nexport function addSummaryZoomDefinition(\n\ttarget: PresSlideInternal,\n\topts: SummaryZoomProps,\n\tsections: SectionInternalProps[]\n): void {\n\t// Exclude the section that contains this (host) slide — a summary does not link to itself.\n\tconst hostSection = sections.find((s) => s._slides.some((sl) => sl._slideNum === target._slideNum))\n\tconst targets = sections.filter((s) => s !== hostSection && s._slides.length > 0)\n\tif (targets.length === 0) {\n\t\twarn(\n\t\t\t'zoom/no-sections-to-summarize',\n\t\t\t'addSummaryZoom: no sections to summarize (need at least one section besides this slide’s own); ignoring.'\n\t\t)\n\t\treturn\n\t}\n\n\t// Grid geometry (EMU). Tiles preserve the slide aspect ratio; the grid is centered in the frame,\n\t// last row left-aligned (matching PowerPoint). See the Summary oracle in plan `foamy-imagining-narwhal`.\n\tconst frameCx = getSmartParseNumber(opts.w ?? 0, 'X', target._presLayout)\n\tconst frameCy = getSmartParseNumber(opts.h ?? 0, 'Y', target._presLayout)\n\tconst ar = target._presLayout.width / target._presLayout.height\n\tconst n = targets.length\n\tconst cols = Math.ceil(Math.sqrt(n))\n\tconst rows = Math.ceil(n / cols)\n\tconst gap = Math.round(frameCx * 0.0124)\n\tlet tileW = (frameCx - (cols - 1) * gap) / cols\n\tlet tileH = tileW / ar\n\tconst tileHFit = (frameCy - (rows - 1) * gap) / rows\n\tif (tileH > tileHFit) {\n\t\ttileH = tileHFit\n\t\ttileW = tileH * ar\n\t}\n\ttileW = Math.round(tileW)\n\ttileH = Math.round(tileH)\n\tconst gridW = cols * tileW + (cols - 1) * gap\n\tconst gridH = rows * tileH + (rows - 1) * gap\n\tconst originX = Math.round((frameCx - gridW) / 2)\n\tconst originY = Math.round((frameCy - gridH) / 2)\n\n\t// One shared preview image across all tiles (identical placeholder/cover).\n\tconst previewRid = registerPreviewImage(target, opts.coverImage)\n\tconst tiles: ZoomTileInternal[] = []\n\ttargets.forEach((section, i) => {\n\t\tconst firstSlide = section._slides[0]\n\t\tif (!firstSlide) return // guarded above (length > 0), but keeps the emit total-function\n\t\tconst r = Math.floor(i / cols)\n\t\tconst c = i % cols\n\t\ttiles.push({\n\t\t\tsectionId: section._id,\n\t\t\tpreviewRid,\n\t\t\tfallbackSlideRid: registerSlideRel(target, firstSlide._slideNum),\n\t\t\tzmPrId: zoomGuid(),\n\t\t\tgrid: { x: originX + c * (tileW + gap), y: originY + r * (tileH + gap), cx: tileW, cy: tileH },\n\t\t})\n\t})\n\n\tpushZoomObject(target, 'summary', opts, {\n\t\ttiles,\n\t\treturnToParent: !!opts.returnToParent,\n\t\ttransitionDur: opts.transitionDur ?? 1000,\n\t})\n}\n","/**\n * ts-pptx: SlideBuilder — write-side implementation of the public `Slide` interface\n */\n\nimport type { CHART_NAME, SHAPE_NAME } from './enums.js'\nimport type {\n\tAddSlideProps,\n\tAnimationProps,\n\tBackgroundProps,\n\tCommentProps,\n\tConnectorProps,\n\tGroupChildProps,\n\tGroupProps,\n\tHexColor,\n\tChartMulti,\n\tChartOpts,\n\tSlideComment,\n\tImageProps,\n\tMediaProps,\n\tModel3dProps,\n\tNotesProps,\n\tOleObjectProps,\n\tPresLayout,\n\tShapeProps,\n\tSlideNumberProps,\n\tOptsChartData,\n\tTableProps,\n\tTableRow,\n\tTextProps,\n\tTextPropsOptions,\n\tTransitionProps,\n\tSlideZoomProps,\n\tSectionZoomProps,\n\tSummaryZoomProps,\n} from './types/index.js'\nimport type { Slide } from './types/slide.js'\nimport type {\n\tSlideObject,\n\tSlideRel,\n\tSlideRelChart,\n\tSlideRelMedia,\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSectionInternalProps,\n} from './types/internal.js'\nimport { emuToInches } from './units.js'\nimport { InvalidOptionError } from './errors.js'\nimport { addBackgroundDefinition } from './gen/define/background.js'\nimport { addChartDefinition } from './gen/define/chart.js'\nimport { addCommentDefinition } from './gen/define/comment.js'\nimport { addConnectorDefinition } from './gen/define/connector.js'\nimport { addGroupDefinition, groupObjectsDefinition } from './gen/define/group.js'\nimport { addImageDefinition } from './gen/define/image.js'\nimport { addMediaDefinition } from './gen/define/media.js'\nimport { addModel3dDefinition } from './gen/define/model3d.js'\nimport { addNotesDefinition } from './gen/define/notes.js'\nimport { addOleObjectDefinition } from './gen/define/ole.js'\nimport { addShapeDefinition } from './gen/define/shape.js'\nimport { addTableDefinition } from './gen/define/table.js'\nimport { addTextDefinition } from './gen/define/text.js'\nimport { addSectionZoomDefinition, addSlideZoomDefinition, addSummaryZoomDefinition } from './gen/define/zoom.js'\n\n/** Distinguish a multi-type (combo) chart array (`ChartMulti[]`) from a single chart's data (`OptsChartData[]`). */\nfunction isMultiChart(arg: OptsChartData[] | ChartMulti[]): arg is ChartMulti[] {\n\tconst first = arg[0] as Partial<ChartMulti> | undefined\n\treturn !!first && typeof first === 'object' && 'type' in first && 'data' in first\n}\n\nexport default class SlideBuilder {\n\tprivate readonly _setSlideNum: (value: SlideNumberProps) => void\n\n\tpublic addSlide: (options?: AddSlideProps) => PresSlideInternal\n\tpublic getSlide: (slideNum: number) => PresSlideInternal | undefined\n\tpublic getSections: () => SectionInternalProps[]\n\tpublic _name: string\n\tpublic _presLayout: PresLayout\n\tpublic _rels: SlideRel[]\n\tpublic _relsChart: SlideRelChart[]\n\tpublic _relsMedia: SlideRelMedia[]\n\tpublic _rId: number\n\tpublic _slideId: number\n\tpublic _slideLayout: SlideLayoutInternal | null\n\tpublic _slideNum: number\n\tpublic _slideNumberProps: SlideNumberProps | null\n\tpublic _slideObjects: SlideObject[]\n\tpublic _comments: SlideComment[] = []\n\tpublic _newAutoPagedSlides: PresSlideInternal[] = []\n\tpublic _animations: AnimationProps[] = []\n\n\tconstructor(params: {\n\t\taddSlide: (options?: AddSlideProps) => PresSlideInternal\n\t\tgetSlide: (slideNum: number) => PresSlideInternal | undefined\n\t\tgetSections?: () => SectionInternalProps[]\n\t\tpresLayout: PresLayout\n\t\tsetSlideNum: (value: SlideNumberProps) => void\n\t\tslideId: number\n\t\tslideRId: number\n\t\tslideNumber: number\n\t\tslideLayout?: SlideLayoutInternal\n\t}) {\n\t\tthis.addSlide = params.addSlide\n\t\tthis.getSlide = params.getSlide\n\t\tthis.getSections = params.getSections ?? (() => [])\n\t\tthis._name = `Slide ${params.slideNumber}`\n\t\tthis._presLayout = params.presLayout\n\t\tthis._rId = params.slideRId\n\t\tthis._rels = []\n\t\tthis._relsChart = []\n\t\tthis._relsMedia = []\n\t\tthis._setSlideNum = params.setSlideNum\n\t\tthis._slideId = params.slideId\n\t\tthis._slideLayout = params.slideLayout || null\n\t\tthis._slideNum = params.slideNumber\n\t\tthis._slideObjects = []\n\t\t/** NOTE: Slide Numbers: In order for Slide Numbers to function they need to be in all 3 files: master/layout/slide\n\t\t * `defineSlideMaster` and `addNewSlide.slideNumber` will add {slideNumber} to `this.masterSlide` and `this.slideLayouts`\n\t\t * so, lastly, add to the Slide now.\n\t\t */\n\t\tthis._slideNumberProps = this._slideLayout?._slideNumberProps ? this._slideLayout._slideNumberProps : null\n\t}\n\n\t/**\n\t * Background color or image\n\t * @type {BackgroundProps}\n\t * @example solid color `background: { color:'FF0000' }`\n\t * @example color+trans `background: { color:'FF0000', transparency:0.5 }`\n\t * @example base64 `background: { data:'image/png;base64,ABC[...]123' }`\n\t * @example url `background: { path:'https://some.url/image.jpg'}`\n\t */\n\tprivate _background?: BackgroundProps\n\tpublic set background(props: BackgroundProps) {\n\t\tthis._background = props\n\t\t// Add background (image data/path must be captured before the package is built)\n\t\tif (props) addBackgroundDefinition(props, this)\n\t}\n\n\tpublic get background(): BackgroundProps | undefined {\n\t\treturn this._background\n\t}\n\n\t/**\n\t * Default font color\n\t * @type {HexColor}\n\t */\n\tprivate _color?: HexColor\n\tpublic set color(value: HexColor) {\n\t\tthis._color = value\n\t}\n\n\tpublic get color(): HexColor | undefined {\n\t\treturn this._color\n\t}\n\n\t/**\n\t * @type {boolean}\n\t */\n\tprivate _hidden = false\n\tpublic set hidden(value: boolean) {\n\t\tthis._hidden = value\n\t}\n\n\tpublic get hidden(): boolean {\n\t\treturn this._hidden\n\t}\n\n\t/**\n\t * Slide-show transition (`p:transition`) played when advancing to this slide.\n\t * @type {TransitionProps}\n\t */\n\tprivate _transition?: TransitionProps\n\tpublic set transition(value: TransitionProps | undefined) {\n\t\tthis._transition = value\n\t}\n\n\tpublic get transition(): TransitionProps | undefined {\n\t\treturn this._transition\n\t}\n\n\t/**\n\t * @type {SlideNumberProps}\n\t */\n\tpublic set slideNumber(value: SlideNumberProps) {\n\t\t// NOTE: Slide Numbers: In order for Slide Numbers to function they need to be in all 3 files: master/layout/slide\n\t\tthis._slideNumberProps = value\n\t\tthis._setSlideNum(value)\n\t}\n\n\tpublic get slideNumber(): SlideNumberProps | undefined {\n\t\treturn this._slideNumberProps ?? undefined\n\t}\n\n\tpublic get newAutoPagedSlides(): Slide[] {\n\t\treturn this._newAutoPagedSlides\n\t}\n\n\t/** Slide width in inches (resolved from the active presentation layout). */\n\tpublic get width(): number {\n\t\treturn emuToInches(this._presLayout.width)\n\t}\n\n\t/** Slide height in inches (resolved from the active presentation layout). */\n\tpublic get height(): number {\n\t\treturn emuToInches(this._presLayout.height)\n\t}\n\n\t/**\n\t * Add chart to Slide\n\t * @param {OptsChartData[]} data - chart data\n\t * @param {ChartOpts & { type: CHART_NAME }} options - chart options; `type` is required here\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddChart(data: OptsChartData[], options: ChartOpts & { type: CHART_NAME }): SlideBuilder\n\t/**\n\t * Add a multi-type (combo) chart to Slide\n\t * @param {ChartMulti[]} charts - per-type chart definitions (each carries its own `type`/`data`)\n\t * @param {ChartOpts} options - shared chart options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddChart(charts: ChartMulti[], options?: ChartOpts): SlideBuilder\n\taddChart(arg1: OptsChartData[] | ChartMulti[], arg2?: ChartOpts & { type?: CHART_NAME }): SlideBuilder {\n\t\tlet type: CHART_NAME | ChartMulti[]\n\t\tlet data: OptsChartData[]\n\t\tlet options: ChartOpts\n\n\t\tif (Array.isArray(arg1) && isMultiChart(arg1)) {\n\t\t\t// Multi-type (combo) chart: addChart(ChartMulti[], options?)\n\t\t\ttype = arg1\n\t\t\tdata = []\n\t\t\toptions = arg2 ?? {}\n\t\t} else {\n\t\t\t// Canonical single-type form: addChart(data, { type, ...options })\n\t\t\tdata = arg1 ?? []\n\t\t\toptions = arg2 ?? {}\n\t\t\tconst optType = (options as ChartOpts & { type?: CHART_NAME }).type\n\t\t\tif (!optType) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'chart/missing-type',\n\t\t\t\t\t'addChart: a chart `type` is required on the options object, e.g. addChart(data, { type: ChartType.bar }).'\n\t\t\t\t)\n\t\t\t}\n\t\t\ttype = optType\n\t\t}\n\n\t\t// `_type` is set by `addChartDefinition` on its own copy of the options — stamping it here\n\t\t// too would write an internal field onto the caller's object for no gain.\n\t\t// addChartDefinition's multi-type branch reads the shared options from its `data` slot\n\t\tif (Array.isArray(type)) {\n\t\t\taddChartDefinition(this, type, options, undefined)\n\t\t} else {\n\t\t\taddChartDefinition(this, type, data, options)\n\t\t}\n\t\treturn this\n\t}\n\n\t/**\n\t * Add image to Slide\n\t * @param {ImageProps} options - image options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddImage(options: ImageProps): SlideBuilder {\n\t\taddImageDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add media (audio/video) to Slide\n\t * @param {MediaProps} options - media options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddMedia(options: MediaProps): SlideBuilder {\n\t\taddMediaDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add an embedded OLE object (PowerPoint's Insert ▸ Object ▸ Create from File) to the Slide.\n\t *\n\t * The payload's bytes ship inside the `.pptx`, so a double-click in PowerPoint opens the source\n\t * document in place. Supply a `cover` screenshot for what the slide shows; without one a neutral\n\t * gray placeholder is embedded (PowerPoint draws the live object over it, other consumers do not).\n\t * @param {OleObjectProps} options - OLE object options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addOleObject({ path: 'budget.xlsx', cover: { path: 'budget.png' }, x: 1, y: 1, w: 6, h: 3 })\n\t */\n\taddOleObject(options: OleObjectProps): SlideBuilder {\n\t\taddOleObjectDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add an embedded 3D model (PowerPoint's Insert ▸ 3D Models) to the Slide.\n\t *\n\t * The `.glb` bytes ship inside the `.pptx`, so PowerPoint 2019+ renders the model live and lets\n\t * the viewer orbit it. Everything else — older PowerPoint, thumbnails, PDF export — draws the\n\t * `preview` picture instead; without one a neutral gray placeholder is embedded.\n\t *\n\t * Most models also need `meterPerModelUnit`: ts-pptx does not parse the `.glb`, so it cannot\n\t * measure the bounding box PowerPoint would have scaled the scene by. Set it to\n\t * `1 / <largest bounding-box dimension in model units>`.\n\t * @param {Model3dProps} options - 3D model options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addModel3d({ path: 'engine.glb', preview: { path: 'engine.png' }, x: 1, y: 1, w: 6, h: 4 })\n\t */\n\taddModel3d(options: Model3dProps): SlideBuilder {\n\t\taddModel3dDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add speaker notes to Slide\n\t * @param {string | NotesProps | NotesProps[]} notes - notes text, or rich runs with inline\n\t * formatting / hyperlinks. A plain string is the single-run case; pass run objects to add\n\t * hyperlinks (external `url` only) or per-run bold/italic/underline/color/fontSize/fontFace.\n\t * @example slide.addNotes('Remember to smile')\n\t * @example slide.addNotes([{ text: 'See ' }, { text: 'the docs', options: { hyperlink: { url: 'https://example.com/' } } }])\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddNotes(notes: string | NotesProps | NotesProps[]): SlideBuilder {\n\t\taddNotesDefinition(this, notes)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a review comment to the Slide (legacy PowerPoint comment).\n\t * Comments by the same author (name + initials) are grouped under one author entry in the deck.\n\t * @param {CommentProps} options - comment author, text, and optional marker position/date\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addComment({ author: 'Ada Lovelace', text: 'Tighten this headline', x: 1, y: 0.5 })\n\t */\n\taddComment(options: CommentProps): SlideBuilder {\n\t\taddCommentDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add shape to Slide\n\t * @param {SHAPE_NAME} shapeName - shape name\n\t * @param {ShapeProps} options - shape options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddShape(shapeName: SHAPE_NAME, options?: ShapeProps): SlideBuilder {\n\t\t// `shapeName` is a plain string preset name (e.g. `ShapeType.rect` === \"rect\").\n\t\taddShapeDefinition(this, shapeName, options || {})\n\t\treturn this\n\t}\n\n\t/**\n\t * Group slide objects into a single PowerPoint group (`<p:grpSp>`).\n\t *\n\t * Children keep their slide-absolute `x/y/w/h` (identity child coordinate space at every depth),\n\t * and the objects become one selectable/movable group in PowerPoint. A `group` child nests\n\t * another group. The group's frame is all-or-nothing: pass all four of `options.x/y/w/h`, or none\n\t * to have the bounds be the bounding box of the children (recursing into nested groups). A\n\t * partial frame warns and uses auto-bounds. Charts, media, tables, and placeholders are not\n\t * supported as group children yet (each is skipped with a warning).\n\t * @param {GroupChildProps[]} children - child object descriptors (`{ text }`, `{ image }`, `{ shape }`, `{ rect }`, `{ roundRect }`, `{ line }`, `{ group }`)\n\t * @param {GroupProps} options - group position/size/name options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addGroup([{ rect: { x: 1, y: 1, w: 2, h: 1, fill: { color: 'CC0000' } } }, { text: { text: 'Hi', options: { x: 1, y: 1, w: 2, h: 1 } } }])\n\t * @example slide.addGroup([{ rect: { x: 1, y: 1, w: 4, h: 3 } }, { group: { children: [{ text: { text: 'Hi', options: { x: 1.5, y: 1.5, w: 2, h: 1 } } }] } }])\n\t */\n\taddGroup(children: GroupChildProps[], options?: GroupProps): SlideBuilder {\n\t\taddGroupDefinition(this, children, options || {})\n\t\treturn this\n\t}\n\n\t/**\n\t * Group objects already added to this slide into a single PowerPoint group (`<p:grpSp>`),\n\t * addressed by their `objectName`. The counterpart to {@link SlideBuilder.addGroup} for slides composed\n\t * from independent renderers, where the objects exist already and replaying their descriptors just\n\t * to group them is not practical.\n\t *\n\t * Grouping is visually a no-op: children keep their slide-absolute geometry and their relative\n\t * z-order, and the group takes the topmost member's former slot in the stack. Name the objects in\n\t * any order — z-order decides the children's order, not the array. Groups may be named, so groups\n\t * can be nested into larger logical groups. Charts, media, tables, and placeholders cannot be\n\t * grouped yet.\n\t *\n\t * Unlike `addGroup()`, every problem throws: a name that matches nothing, matches an object\n\t * already inside another group, is ambiguous across two same-named objects, or names an\n\t * ungroupable kind. Each would otherwise leave the object loose on the slide, silently.\n\t * @param {string[]} objectNames - `objectName`s of the top-level objects to group\n\t * @param {GroupProps} options - group position/size/name options (frame is all-or-nothing, as with `addGroup`)\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addText('Hi', { x: 1, y: 1, w: 2, h: 1, objectName: 'Caption' })\n\t * @example slide.addImage({ path: 'logo.png', x: 1, y: 2, w: 2, h: 2, objectName: 'Logo' })\n\t * @example slide.groupObjects(['Caption', 'Logo'], { objectName: 'Branding' })\n\t */\n\tgroupObjects(objectNames: string[], options?: GroupProps): SlideBuilder {\n\t\tgroupObjectsDefinition(this, objectNames, options || {})\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a connector (a line drawn between two points, emitted as a PowerPoint `<p:cxnSp>`).\n\t * @param {ConnectorProps} options - connector endpoints (`x1,y1,x2,y2`) and line styling\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addConnector({ type: 'elbow', x1: 1, y1: 1, x2: 5, y2: 3, endArrowType: 'triangle' })\n\t */\n\taddConnector(options: ConnectorProps): SlideBuilder {\n\t\taddConnectorDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add table to Slide\n\t * @param {TableRow[]} tableRows - table rows\n\t * @param {TableProps} options - table options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddTable(tableRows: TableRow[], options?: TableProps): SlideBuilder {\n\t\tthis._newAutoPagedSlides = addTableDefinition(\n\t\t\tthis,\n\t\t\ttableRows,\n\t\t\toptions || {},\n\t\t\tthis._slideLayout,\n\t\t\tthis._presLayout,\n\t\t\tthis.addSlide,\n\t\t\tthis.getSlide\n\t\t)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add text to Slide\n\t * @param {string|TextProps[]} text - text string or complex object\n\t * @param {TextPropsOptions} options - text options\n\t * @return {SlideBuilder} this Slide\n\t */\n\taddText(text: string | number | TextProps[], options?: TextPropsOptions): SlideBuilder {\n\t\tconst textParam = typeof text === 'string' || typeof text === 'number' ? [{ text, options }] : text\n\t\taddTextDefinition(this, textParam, options || {}, false)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a preset build animation (entrance/emphasis/exit) to a shape on this slide.\n\t * Effects play in the order added and are grouped into click steps by `trigger`.\n\t * Target the shape by its 0-based add order (`shapeIndex`) or by `objectName`.\n\t * @param {AnimationProps} options - preset, target shape, trigger, and duration\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addAnimation({ preset: 'fadeIn', shapeIndex: 0 })\n\t * @example slide.addAnimation({ preset: 'grow', objectName: 'logo', trigger: 'afterPrevious' })\n\t */\n\taddAnimation(options: AnimationProps): SlideBuilder {\n\t\tthis._animations.push(options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a Slide Zoom — a clickable tile that zooms to a single target slide (Insert ▸ Zoom).\n\t * The tile shows a neutral placeholder until PowerPoint regenerates the live thumbnail\n\t * (once the target slide is next edited); pass `coverImage` to ship a fixed thumbnail.\n\t * @param {SlideZoomProps} options - target slide (`Slide` or 1-based number), position, and options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addSlideZoom({ target: intro, x: 1, y: 1, w: 3, h: 1.7 })\n\t */\n\taddSlideZoom(options: SlideZoomProps): SlideBuilder {\n\t\taddSlideZoomDefinition(this, options)\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a Section Zoom — a clickable tile that zooms to the start of a named section.\n\t * @param {SectionZoomProps} options - target `sectionTitle`, position, and options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addSectionZoom({ sectionTitle: 'Results', x: 1, y: 1, w: 3, h: 1.7 })\n\t */\n\taddSectionZoom(options: SectionZoomProps): SlideBuilder {\n\t\taddSectionZoomDefinition(this, options, this.getSections())\n\t\treturn this\n\t}\n\n\t/**\n\t * Add a Summary Zoom — a grid of tiles, one per section (excluding this slide's own section),\n\t * each zooming to that section's start.\n\t * @param {SummaryZoomProps} options - grid position/size and options\n\t * @return {SlideBuilder} this Slide\n\t * @example slide.addSummaryZoom({ x: 0.5, y: 1.5, w: 11, h: 4.5 })\n\t */\n\taddSummaryZoom(options: SummaryZoomProps): SlideBuilder {\n\t\taddSummaryZoomDefinition(this, options, this.getSections())\n\t\treturn this\n\t}\n}\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 { FIXED_PCT_PER_PERCENT } from '../../units.js'\nimport { convertRotationDegrees, transparencyToAlpha } from '../../units-internal.js'\nimport { createColorElement } from './color.js'\nimport { InvalidOptionError, UnsupportedFeatureError } from '../../errors.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\nfunction boolToXml(value: boolean): string {\n\treturn value ? '1' : '0'\n}\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\treturn convertRotationDegrees(((degrees % 360) + 360) % 360)\n}\n\nfunction alphaFromTransparency(transparency: number | undefined): string {\n\treturn transparency ? voidEl('a:alpha', { val: transparencyToAlpha(transparency) }) : ''\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\tconst cx = Math.max(0, Math.min(100, gradient.center?.x ?? 50))\n\t\tconst cy = Math.max(0, Math.min(100, gradient.center?.y ?? 50))\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' ? boolToXml(gradient.scaled) : undefined,\n\t\t})\n\t}\n\n\treturn el('a:gradFill', { rotWithShape: boolToXml(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 = pattern.fgColor ?? '000000'\n\tconst bgColor = pattern.bgColor ?? 'FFFFFF'\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 {ShapeFillProps} props fill props (must carry a resolved `_imgRid`)\n * @returns XML string\n */\nexport function genXmlImageFill(props: ShapeFillProps | 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: Math.round((100 - alpha) * FIXED_PCT_PER_PERCENT) }) : ''\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(voidEl('a:srcRect')),\n\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t])\n}\n\n/**\n * Create color selection\n * @param {Color | ShapeFillProps | ShapeLineProps} props fill props\n * @returns XML string\n */\nexport function genXmlColorSelection(props: Color | ShapeFillProps | ShapeLineProps): string {\n\tlet fillType = 'solid'\n\tlet colorVal = ''\n\tlet internalElements = ''\n\tlet outText = ''\n\n\tif (props) {\n\t\tif (typeof props === 'string') colorVal = props\n\t\telse {\n\t\t\tif (props.type) fillType = props.type\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\nimport type { BorderProps, LineCap, ShapeLineProps } from '../../types/index.js'\nimport { genXmlColorSelection, genXmlGradientFill } from './fill.js'\nimport { InvalidOptionError } from '../../errors.js'\nimport { warnOnce } from '../../diagnostics.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { PRESET_LINE_DASHES } from '../../ooxml/st-enums.js'\nimport { voidEl } from '../oxml/el.js'\n\n/** Every key `BorderProps` defines. Keep in step with the interface in `types/style.ts`. */\nconst BORDER_KEYS: readonly string[] = ['type', 'dashType', 'color', 'width', 'transparency', 'cap']\n\n/**\n * Resolve the `a:prstDash/@val` a border should emit.\n *\n * `BorderProps.type` is a three-way switch, so on its own it can only say \"dashed\" and\n * every dashed border collapses onto `sysDash`. `dashType` names the preset directly and\n * therefore wins when both are given; `type: 'none'` never reaches here, being decided by\n * the caller before any dash is chosen.\n *\n * A value outside `ST_PresetLineDashVal` would make the part schema-invalid, which\n * PowerPoint reports as a corrupt file rather than a mis-set option — so an unrecognized\n * one is reported and dropped back to what `type` implies.\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\tconst fromType = border.type === 'dash' ? 'sysDash' : 'solid'\n\treturn (\n\t\tcheckEnumOrWarn(border.dashType, PRESET_LINE_DASHES, 'border/invalid-dash-type', 'border: dashType') ?? fromType\n\t)\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 usable number.\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 finite 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' && !isNaN(val) ? val : defaultPt\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 || lineCap === 'flat') {\n\t\treturn 'flat'\n\t} else if (lineCap === 'square') {\n\t\treturn 'sq'\n\t} else if (lineCap === 'round') {\n\t\treturn 'rnd'\n\t} else {\n\t\tconst neverLineCap: never = lineCap\n\t\tthrow new InvalidOptionError('line/invalid-cap', `Invalid line cap: ${String(neverLineCap)}`)\n\t}\n}\n\n/**\n * Emit the paint child of an `<a:ln>` stroke.\n * DrawingML allows the same fill group inside `<a:ln>` as inside a shape fill, so a\n * stroke can be a gradient/pattern as well as a solid color:\n * - a `gradient` (or `type: 'gradient'`) produces a `<a:gradFill>` (gradient stroke);\n * - a `pattern`/`image` type delegates to the shared fill dispatch;\n * - otherwise a `color` produces a `<a:solidFill>`.\n * Returns '' when the line specifies no paint, so the caller emits no fill child and\n * the stroke inherits its color from the theme/placeholder.\n * @param {ShapeLineProps} line line options\n * @returns XML string\n */\nexport function genXmlLineFill(line: ShapeLineProps): string {\n\t// `type: 'none'` is an explicit *no stroke*, and it is not the same as saying nothing.\n\t// Omitting the paint child leaves the outline to the theme or placeholder, so a shape\n\t// authored with `line: { type: 'none' }` grew the theme's border instead of losing it.\n\tif (line.type === 'none') return voidEl('a:noFill')\n\t// `gradient` presence selects a gradient stroke even when `type` was omitted.\n\tif (line.gradient || line.type === 'gradient') return genXmlGradientFill(line.gradient)\n\tif (line.type === 'pattern' || line.type === 'image') return genXmlColorSelection(line)\n\tif (line.color) return genXmlColorSelection(line)\n\treturn ''\n}\n","/**\n * ts-pptx: Chart Series-Data ↔ Worksheet-Cell Mapping\n *\n * The tiny pure helpers that both chart package parts share: the empty-array-safe\n * accessors over the normalized (internal) chart-series arrays, and the builders that\n * turn a (column, row) into an absolute reference into the chart's embedded `Sheet1`.\n * The embedded-workbook builder ({@link ../chart/embed-xlsx}) writes the cells; the\n * chart-XML builder ({@link ../chart/chart-xml}) points `<c:f>` formulas back at them —\n * so this mapping lives in one place to keep column letters and `$`-anchoring from\n * drifting between the two sides.\n */\n\nimport { LETTERS } from '../../constants-internal.js'\nimport type { OptsChartDataInternal } from '../../types/internal.js'\n\n// ===== Series-data accessors =====\n// The normalized (internal) chart-series arrays are populated at addChart time but stay\n// optional on OptsChartDataInternal; read them through these accessors with an empty-array\n// fallback so the OOXML/worksheet assembly never dereferences `undefined`. They also\n// tolerate an absent series (`data[0]` on an empty set) by returning an empty array.\nexport const dataLabels = (d: OptsChartDataInternal | undefined): string[][] => d?.labels ?? []\nexport const dataValues = (d: OptsChartDataInternal | undefined): number[] => d?.values ?? []\nexport const dataSizes = (d: OptsChartDataInternal | undefined): number[] => d?.sizes ?? []\n// The first label group of a series (`labels[0]`), empty when the series or group is absent.\nexport const firstLabelGroup = (d: OptsChartDataInternal | undefined): string[] => dataLabels(d)[0] ?? []\n\n// ===== Worksheet-cell references =====\n\n/**\n * Calc and return excel column name for a given column length\n * @param colIndex column index\n * @return column name\n * @example 1 returns 'A'\n * @example 27 returns 'AA'\n */\nexport function getExcelColName(colIndex: number): string {\n\tlet colStr: string\n\tconst colIdx = colIndex - 1 // Subtract 1 so `LETTERS[columnIndex]` returns \"A\" etc\n\n\tif (colIdx <= 25) {\n\t\t// A-Z\n\t\tcolStr = LETTERS[colIdx] ?? ''\n\t} else {\n\t\t// AA-ZZ (ZZ = index 702)\n\t\tcolStr = `${LETTERS[Math.floor(colIdx / LETTERS.length - 1)]}${LETTERS[colIdx % LETTERS.length]}`\n\t}\n\n\treturn colStr\n}\n\n/**\n * Build an absolute single-cell reference into the embedded workbook's `Sheet1`,\n * as emitted in a chart series `<c:f>` formula: `Sheet1!$C$2`. Centralizes the\n * `$`-anchoring so the column letter and `$` placement can't drift between sites.\n * @param colIndex 1-based column index (1 => 'A')\n * @param row 1-based row number\n */\nexport function sheetCellRef(colIndex: number, row: number): string {\n\treturn `Sheet1!$${getExcelColName(colIndex)}$${row}`\n}\n\n/**\n * Build an absolute range reference into the embedded workbook's `Sheet1`, as\n * emitted in a chart series `<c:f>` formula: `Sheet1!$C$2:$C$6`. A same-column\n * range (the common case) passes the same index for `colFrom`/`colTo`; deriving\n * the column letter once per endpoint removes the duplicated `getExcelColName`\n * call that was a real off-by-one surface.\n * @param colFrom 1-based start column index\n * @param rowFrom 1-based start row\n * @param colTo 1-based end column index\n * @param rowTo 1-based end row\n */\nexport function sheetRangeRef(colFrom: number, rowFrom: number, colTo: number, rowTo: number): string {\n\treturn `Sheet1!$${getExcelColName(colFrom)}$${rowFrom}:$${getExcelColName(colTo)}$${rowTo}`\n}\n","/**\n * ts-pptx: Shared Chart Fragment Builders\n *\n * The leaf builders every chart region reuses -- titles, gridlines, series data points,\n * error bars, number caches, leader lines, borders. Each is a pure string builder with\n * no dependency on any other module in this directory, which is what lets the plot\n * builders ({@link ./plot-cat-axis}, {@link ./plot-scatter}, {@link ./plot-bubble},\n * {@link ./plot-pie}), the axes ({@link ./chart-axes}), and the chart envelope\n * ({@link ./chart-xml}) all draw on them without a cycle.\n */\n\nimport { ChartType } from '../../enums.js'\nimport {\n\tBARCHART_COLORS,\n\tDEF_CHART_GRIDLINE,\n\tDEF_FONT_COLOR,\n\tDEF_FONT_SIZE,\n\tDEF_SHAPE_SHADOW,\n} from '../../constants-internal.js'\nimport type { BorderProps, ChartErrorBarOptions, ChartPropsTitle, OptsChartGridLine } from '../../types/index.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { createShadowEffectLst } from '../drawingml/effect.js'\nimport { genXmlColorSelection, genXmlPatternFill } from '../drawingml/fill.js'\nimport { createLineCap, resolveBorderWidth } from '../drawingml/line.js'\nimport { convertRotationDegrees, valToPts } from '../../units-internal.js'\nimport { ptToHundredths } from '../../units.js'\nimport { dataValues } from './data-refs.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\nexport const VALID_CHART_TIME_UNITS = ['days', 'months', 'years']\n\n// DEF_CHART_GRIDLINE.color is optional on the type but always present on the constant.\nexport const DEF_GRIDLINE_COLOR: string = DEF_CHART_GRIDLINE.color ?? '888888'\n\n/**\n * Fill fragment for a `chartColors`-derived series/line/marker colour.\n *\n * A `'transparent'` entry means \"no fill\" — an invisible series, connecting line, or marker\n * stroke — and maps to `<a:noFill/>`. Any real colour goes through the normal solid-fill path.\n * The series and marker *fill* paths already special-case `'transparent'`; without this the\n * *stroke* paths (`<a:ln>` on the series line and marker border) would instead pass the literal\n * `'transparent'` through colour validation, warn \"not a valid scheme color or hex RGB\", and\n * render as black — leaving a stray black line/border where a transparent series was requested.\n */\nexport function chartColorLineFill(color: string): string {\n\treturn color === 'transparent' ? voidEl('a:noFill') : genXmlColorSelection(color)\n}\n/**\n * Emit the `<a:latin>/<a:ea>/<a:cs>` font trio for a chart text run.\n *\n * In DrawingML run properties a typeface applies only to the script class of\n * its element: `<a:latin>` covers Latin/ASCII, `<a:ea>` covers East Asian, and\n * `<a:cs>` covers complex scripts. Emitting `<a:latin>` alone leaves East Asian\n * (e.g. Chinese) and complex-script glyphs falling back to the theme font, so a\n * user-specified font never takes effect for that text — most visibly on\n * PowerPoint for Mac. Stamping the same typeface onto all three classes is what\n * choosing a font in PowerPoint's UI does.\n * @param {string} typeface - font face name\n * @return {string} `<a:latin/><a:ea/><a:cs/>` XML\n */\n\nexport function createChartTextFonts(typeface: string): string {\n\t// Every caller passes a caller-supplied font option (dataLabelFontFace, catAxisLabelFontFace,\n\t// legendFontFace, ...), so escaping happens here — one site covers all of them. voidEl()'s\n\t// attrs escape by construction: an unescaped `\"` or `&` would otherwise close the attribute\n\t// early and emit a non-parseable chart part.\n\treturn voidEl('a:latin', { typeface }) + voidEl('a:ea', { typeface }) + voidEl('a:cs', { typeface })\n}\n\nexport function genXmlTitle(opts: ChartPropsTitle, chartX?: number, chartY?: number): string {\n\tconst align =\n\t\topts.titleAlign === 'left' || opts.titleAlign === 'right'\n\t\t\t? `<a:pPr algn=\"${opts.titleAlign.slice(0, 1)}\">`\n\t\t\t: '<a:pPr>'\n\tconst rotate = opts.titleRotate ? `<a:bodyPr rot=\"${convertRotationDegrees(opts.titleRotate)}\"/>` : '<a:bodyPr/>' // don't specify rotation to get default (ex. vertical for cat axis)\n\tconst sizeAttr = opts.fontSize ? `sz=\"${ptToHundredths(opts.fontSize)}\"` : '' // only set the font size if specified. Powerpoint will handle the default size\n\tconst titleBold = opts.titleBold ? 1 : 0\n\tconst titleItalic = opts.titleItalic ? 1 : 0\n\tconst titleUnderline = opts.titleUnderline ? 'sng' : 'none'\n\n\tlet layout = '<c:layout/>'\n\tconst hasX = opts.titlePos && typeof opts.titlePos.x === 'number'\n\tconst hasY = opts.titlePos && typeof opts.titlePos.y === 'number'\n\tif (hasX || hasY) {\n\t\t// NOTE: manualLayout x/y vals are *relative to entire slide*. Each axis is\n\t\t// independent in CT_ManualLayout: omitting xMode/x (or yMode/y) leaves that\n\t\t// axis on automatic layout, so a caller can center horizontally while still\n\t\t// applying a manual vertical offset (and vice-versa).\n\t\t// Schema order is xMode, yMode, x, y.\n\t\tlet modes = ''\n\t\tlet vals = ''\n\t\tif (hasX) {\n\t\t\tconst totalX = (opts.titlePos?.x ?? 0) + (chartX ?? 0)\n\t\t\tlet valX = totalX === 0 ? 0 : (totalX * (totalX / 5)) / 10\n\t\t\tif (valX >= 1) valX = valX / 10\n\t\t\tif (valX >= 0.1) valX = valX / 10\n\t\t\tmodes += '<c:xMode val=\"edge\"/>'\n\t\t\tvals += `<c:x val=\"${valX}\"/>`\n\t\t}\n\t\tif (hasY) {\n\t\t\tconst totalY = (opts.titlePos?.y ?? 0) + (chartY ?? 0)\n\t\t\tlet valY = totalY === 0 ? 0 : (totalY * (totalY / 5)) / 10\n\t\t\tif (valY >= 1) valY = valY / 10\n\t\t\tif (valY >= 0.1) valY = valY / 10\n\t\t\tmodes += '<c:yMode val=\"edge\"/>'\n\t\t\tvals += `<c:y val=\"${valY}\"/>`\n\t\t}\n\t\tlayout = `<c:layout><c:manualLayout>${modes}${vals}</c:manualLayout></c:layout>`\n\t}\n\n\treturn `<c:title>\n <c:tx>\n <c:rich>\n ${rotate}\n <a:lstStyle/>\n <a:p>\n ${align}\n <a:defRPr ${sizeAttr} b=\"${titleBold}\" i=\"${titleItalic}\" u=\"${titleUnderline}\" strike=\"noStrike\">\n ${genXmlColorSelection(opts.color || DEF_FONT_COLOR)}\n ${createChartTextFonts(opts.fontFace || 'Arial')}\n </a:defRPr>\n </a:pPr>\n <a:r>\n <a:rPr ${sizeAttr} b=\"${titleBold}\" i=\"${titleItalic}\" u=\"${titleUnderline}\" strike=\"noStrike\">\n ${genXmlColorSelection(opts.color || DEF_FONT_COLOR)}\n ${createChartTextFonts(opts.fontFace || 'Arial')}\n </a:rPr>\n ${el('a:t', null, opts.title ?? '')}\n </a:r>\n </a:p>\n </c:rich>\n </c:tx>\n ${layout}\n <c:overlay val=\"0\"/>\n </c:title>`\n}\n\n/**\n * Create Grid Line Element\n * @param {OptsChartGridLine} glOpts {size, color, style}\n * @return {string} XML\n */\nexport function createGridLineElement(glOpts: OptsChartGridLine): string {\n\tconst line = el(\n\t\t'a:ln',\n\t\t{\n\t\t\tw: valToPts(glOpts.size || DEF_CHART_GRIDLINE.size || 1),\n\t\t\tcap: createLineCap(glOpts.cap || DEF_CHART_GRIDLINE.cap),\n\t\t},\n\t\t[\n\t\t\traw(' ' + el('a:solidFill', null, raw(createColorElement(glOpts.color || DEF_GRIDLINE_COLOR)))),\n\t\t\traw(' ' + voidEl('a:prstDash', { val: glOpts.style || DEF_CHART_GRIDLINE.style }) + voidEl('a:round')),\n\t\t],\n\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t)\n\n\treturn el('c:majorGridlines', null, raw(el('c:spPr', null, raw(line), { openPrefix: ' ', closePrefix: ' ' })))\n}\n\n/**\n * Build a `<c:pt>` numeric-cache data point, or '' to leave a gap.\n *\n * `<c:v>` inside a `<c:numCache>` is an `xsd:double`; emitting `NaN`, `Infinity`\n * or an empty string yields an invalid value that makes PowerPoint report the\n * package as needing repair. Null/undefined are intentional gaps and are skipped\n * silently (a sparse, idx-keyed cache is valid); other non-finite numbers are\n * skipped with a warning, per the library's \"warn rather than emit a degenerate\n * result\" policy.\n * @param idx - zero-based data-point index (emitted as `idx`)\n * @param value - numeric value (or null/undefined gap)\n */\nexport function numCachePt(idx: number, value: number | null | undefined): string {\n\tif (value == null) return ''\n\tif (!Number.isFinite(value)) {\n\t\twarn('chart/non-finite-value', `chart value \"${value}\" at index ${idx} is not a finite number; data point omitted.`)\n\t\treturn ''\n\t}\n\treturn `<c:pt idx=\"${idx}\"><c:v>${value}</c:v></c:pt>`\n}\n\n/**\n * Build the error-bar elements (`<c:errBars>`) for a single series.\n *\n * Schema position (CT_*Ser): after `dLbls`/`trendline`, before `cat`/`val` (bar/line/area)\n * or `xVal`/`yVal` (scatter). CT_ErrBars child order is errDir → errBarType → errValType →\n * noEndCap → plus → minus → val → spPr.\n *\n * @param chartType - chart this series belongs to (used to bound how many bars are legal)\n * @param errorBars - one config, or an array (X+Y) for scatter/area; bar/line keep only the first\n * @param obj - the series data object (only `name`, for warnings)\n */\nexport function makeChartErrorBarsXml(\n\tchartType: ChartType,\n\terrorBars: ChartErrorBarOptions | ChartErrorBarOptions[] | undefined,\n\tobj: OptsChartDataInternal\n): string {\n\tif (!errorBars) return ''\n\tconst bars = Array.isArray(errorBars) ? errorBars : [errorBars]\n\t// CT_BarSer/CT_LineSer allow a single <c:errBars>; only scatter/area permit two (x + y).\n\tconst maxBars = chartType === ChartType.scatter || chartType === ChartType.area ? 2 : 1\n\tlet strXml = ''\n\n\tbars.slice(0, maxBars).forEach((eb) => {\n\t\tif (!eb) return\n\t\tconst valueType = eb.valueType || 'fixedVal'\n\t\tconst barType = eb.barType || 'both'\n\t\tconst direction = eb.direction || 'y'\n\n\t\tstrXml += '<c:errBars>'\n\t\tstrXml += `<c:errDir val=\"${direction}\"/>`\n\t\tstrXml += `<c:errBarType val=\"${barType}\"/>`\n\t\tstrXml += `<c:errValType val=\"${valueType}\"/>`\n\t\tstrXml += `<c:noEndCap val=\"${eb.noEndCap ? '1' : '0'}\"/>`\n\n\t\tif (valueType === 'cust') {\n\t\t\t// Custom amounts: <c:plus>/<c:minus> each hold a number source (we emit <c:numLit>).\n\t\t\t// `barType` decides which sides are present; warn (don't silently drop) on a missing side.\n\t\t\tif (barType !== 'minus') {\n\t\t\t\tif (!eb.plusValues?.length)\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'chart/error-bars-missing-values',\n\t\t\t\t\t\t`chart series \"${obj.name}\" errorBars valueType 'cust' needs \\`plusValues\\` for barType '${barType}'.`\n\t\t\t\t\t)\n\t\t\t\tstrXml += makeErrBarNumLit('plus', eb.plusValues || [])\n\t\t\t}\n\t\t\tif (barType !== 'plus') {\n\t\t\t\tif (!eb.minusValues?.length)\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'chart/error-bars-missing-values',\n\t\t\t\t\t\t`chart series \"${obj.name}\" errorBars valueType 'cust' needs \\`minusValues\\` for barType '${barType}'.`\n\t\t\t\t\t)\n\t\t\t\tstrXml += makeErrBarNumLit('minus', eb.minusValues || [])\n\t\t\t}\n\t\t} else if (valueType !== 'stdErr') {\n\t\t\t// fixedVal / percentage / stdDev use a single magnitude (stdErr derives it from the data).\n\t\t\tstrXml += `<c:val val=\"${eb.value ?? 1}\"/>`\n\t\t}\n\n\t\tif (eb.color || eb.size != null) {\n\t\t\tstrXml += '<c:spPr><a:ln'\n\t\t\tstrXml += eb.size != null ? ` w=\"${valToPts(eb.size)}\"` : ''\n\t\t\tstrXml += '>'\n\t\t\tstrXml += eb.color ? genXmlColorSelection(eb.color) : ''\n\t\t\tstrXml += '</a:ln></c:spPr>'\n\t\t}\n\n\t\tstrXml += '</c:errBars>'\n\t})\n\n\treturn strXml\n}\n\n/**\n * Build a `<c:plus>`/`<c:minus>` number-literal source for custom error-bar amounts.\n * @param tag - `'plus'` or `'minus'`\n * @param values - per-point magnitudes (index-aligned with the series values)\n */\nfunction makeErrBarNumLit(tag: 'plus' | 'minus', values: number[]): string {\n\tlet strXml = `<c:${tag}><c:numLit><c:formatCode>General</c:formatCode><c:ptCount val=\"${values.length}\"/>`\n\tvalues.forEach((value, idx) => {\n\t\tstrXml += numCachePt(idx, value)\n\t})\n\tstrXml += `</c:numLit></c:${tag}>`\n\n\treturn strXml\n}\n\n/**\n * Build a `<c:serLines>` (\"Series Lines\") element for a bar chart.\n * @param opt - `true` for PowerPoint automatic styling, an {@link OptsChartGridLine}\n * to customize the line, or falsy / `{ style: 'none' }` to omit the element.\n */\nexport function createSerLinesElement(opt?: boolean | OptsChartGridLine): string {\n\tif (!opt) return ''\n\tif (opt === true) return '<c:serLines/>'\n\tif (opt.style === 'none') return ''\n\tconst line = el(\n\t\t'a:ln',\n\t\t{ w: valToPts(opt.size || DEF_CHART_GRIDLINE.size || 1), cap: createLineCap(opt.cap || DEF_CHART_GRIDLINE.cap) },\n\t\t[\n\t\t\traw(el('a:solidFill', null, raw(createColorElement(opt.color || DEF_GRIDLINE_COLOR)))),\n\t\t\traw(voidEl('a:prstDash', { val: opt.style || DEF_CHART_GRIDLINE.style }) + voidEl('a:round')),\n\t\t]\n\t)\n\n\treturn el('c:serLines', null, raw(el('c:spPr', null, raw(line))))\n}\n\n/**\n * Build the `<c:leaderLines>` element for pie/doughnut data labels.\n *\n * Schema position: inside `<c:dLbls>`, immediately after `<c:showLeaderLines>`\n * (CT_DLbls / Group_DLbls order: showLeaderLines → leaderLines).\n *\n * Returns `''` unless the caller both enabled leader lines (`showLeaderLines`)\n * and configured their appearance (`leaderLineColor` / `leaderLineSize`). When\n * appearance is unset we leave the element off so PowerPoint applies its\n * automatic leader-line color, matching prior behavior.\n *\n * @param opts - chart options (reads `showLeaderLines`, `leaderLineColor`, `leaderLineSize`)\n */\nexport function createLeaderLinesElement(opts: ChartOptsInternal): string {\n\tif (!opts.showLeaderLines) return ''\n\tif (!opts.leaderLineColor && opts.leaderLineSize == null) return ''\n\tconst w = valToPts(opts.leaderLineSize ?? 0.75)\n\tconst color = opts.leaderLineColor || '808080'\n\treturn (\n\t\t'<c:leaderLines><c:spPr>' +\n\t\t`<a:ln w=\"${w}\" cap=\"flat\">${genXmlColorSelection(color)}<a:prstDash val=\"solid\"/><a:round/></a:ln>` +\n\t\t'<a:effectLst/></c:spPr></c:leaderLines>'\n\t)\n}\n\n/**\n * Build a single custom `<c:dLbl>` (rich-text data label) overriding one data point's label.\n *\n * Used when a series supplies explicit per-point label text: the emitted `<c:idx>` pins the\n * override to that point, and the `<c:rich>` run carries the label's own font styling (size,\n * bold, italic, color, face) resolved from the chart-level dataLabel* options. All the\n * `show*` flags are forced off so only the literal `text` renders (no value/category/percent).\n * @param idx - zero-based data-point index this label overrides\n * @param text - the literal label text (XML-escaped here)\n * @param opts - chart options supplying dataLabel font/color defaults and `lang`\n * @return {string} a `<c:dLbl>` element\n */\nexport function makeCustomDLblXml(idx: number, text: string, opts: ChartOptsInternal): string {\n\tconst sz = ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)\n\tconst bold = opts.dataLabelFontBold ? '1' : '0'\n\tconst italic = opts.dataLabelFontItalic ? '1' : '0'\n\tconst color = createColorElement(opts.dataLabelColor || DEF_FONT_COLOR)\n\tconst face = opts.dataLabelFontFace || 'Arial'\n\tconst lang = opts.lang || 'en-US'\n\treturn (\n\t\t`<c:dLbl><c:idx val=\"${idx}\"/>` +\n\t\t'<c:tx><c:rich><a:bodyPr/><a:lstStyle/>' +\n\t\t`<a:p><a:pPr><a:defRPr sz=\"${sz}\" b=\"${bold}\" i=\"${italic}\" u=\"none\" strike=\"noStrike\">` +\n\t\t`<a:solidFill>${color}</a:solidFill>${createChartTextFonts(face)}</a:defRPr></a:pPr>` +\n\t\t`<a:r><a:rPr lang=\"${lang}\" sz=\"${sz}\" b=\"${bold}\" i=\"${italic}\" u=\"none\" strike=\"noStrike\" dirty=\"0\">` +\n\t\t`<a:solidFill>${color}</a:solidFill>${createChartTextFonts(face)}</a:rPr>` +\n\t\tel('a:t', null, text) +\n\t\t'</a:r></a:p>' +\n\t\t'</c:rich></c:tx>' +\n\t\t'<c:showLegendKey val=\"0\"/><c:showVal val=\"0\"/><c:showCatName val=\"0\"/>' +\n\t\t'<c:showSerName val=\"0\"/><c:showPercent val=\"0\"/><c:showBubbleSize val=\"0\"/></c:dLbl>'\n\t)\n}\n\n/**\n * Build an `<a:ln>` border element from a per-data-point `BorderProps`.\n * @param border - point border style (`type`, `color`, `pt`)\n */\nexport function createChartBorderLine(border: BorderProps): string {\n\tif (border.type === 'none') return '<a:ln><a:noFill/></a:ln>'\n\tconst dash = border.type === 'dash' ? 'dash' : 'solid'\n\treturn `<a:ln w=\"${valToPts(resolveBorderWidth(border, 1))}\" cap=\"flat\">${genXmlColorSelection({ color: border.color || '666666', transparency: border.transparency })}<a:prstDash val=\"${dash}\"/><a:round/></a:ln>`\n}\n\n/**\n * Build `<c:dPt>` entries for a series in the bar/line/area/scatter loops.\n *\n * Merges two sources into a single `c:dPt` per index so we never emit a\n * duplicate `<c:idx>` (which corrupts the chart):\n * - legacy single-series color-vary fills (bar/scatter), supplied via `varyColors`\n * - per-point `pointStyles` border/fill overrides\n *\n * Must be emitted in schema position *before* `c:dLbls` (CT_*Ser order).\n * RADAR is skipped: extra per-point markup historically corrupts the chart.\n *\n * @param chartType - series chart type\n * @param obj - series data (reads `values`, `pointStyles`)\n * @param opts - chart options (fill/shadow/lineSize context)\n * @param varyColors - color array when single-series color-vary applies, else `null`\n */\nexport function makeSeriesDataPointsXml(\n\tchartType: ChartType,\n\tobj: OptsChartDataInternal,\n\topts: ChartOptsInternal,\n\tvaryColors: string[] | null\n): string {\n\tif (chartType === ChartType.radar) return ''\n\tconst pointStyles = obj.pointStyles\n\tif (!varyColors && !pointStyles?.length) return ''\n\n\tconst isBar = chartType === ChartType.bar || chartType === ChartType.bar3d\n\tconst isScatter = chartType === ChartType.scatter\n\tlet xml = ''\n\tdataValues(obj).forEach((value, index) => {\n\t\tconst ptStyle = pointStyles?.[index]\n\t\tconst arrColors = varyColors\n\t\t\t? value < 0\n\t\t\t\t? opts.invertedColors || opts.chartColors || BARCHART_COLORS\n\t\t\t\t: varyColors\n\t\t\t: null\n\t\tconst fillColor = ptStyle?.fill || (arrColors ? arrColors[index % arrColors.length] : null)\n\t\tconst pattern = ptStyle?.pattern\n\t\tconst border = ptStyle?.border\n\t\t// Nothing to style for this point -> omit the c:dPt entirely\n\t\tif (!fillColor && !pattern && !border) return\n\n\t\txml += '<c:dPt>'\n\t\txml += `<c:idx val=\"${index}\"/>`\n\t\tif (isBar) xml += '<c:invertIfNegative val=\"0\"/>'\n\t\txml += '<c:bubble3D val=\"0\"/>'\n\t\txml += '<c:spPr>'\n\t\tif ((isBar || isScatter) && opts.lineSize === 0 && !border && !ptStyle?.fill && !pattern) {\n\t\t\t// Preserve legacy color-vary behavior: hide outline when lineSize===0\n\t\t\txml += '<a:ln><a:noFill/></a:ln>'\n\t\t} else {\n\t\t\t// Pattern fill takes precedence over a solid fill (OOXML allows only one fill per c:dPt).\n\t\t\t// Default the pattern foreground to this point's resolved color so it reads as a hatched bar.\n\t\t\tif (pattern) {\n\t\t\t\txml += genXmlPatternFill(fillColor && !pattern.fgColor ? { ...pattern, fgColor: fillColor } : pattern)\n\t\t\t} else if (fillColor) {\n\t\t\t\t// BAR3D color-vary historically tints the edge line, not the face fill\n\t\t\t\tif (chartType === ChartType.bar3d) xml += `<a:ln>${genXmlColorSelection(fillColor)}</a:ln>`\n\t\t\t\telse xml += genXmlColorSelection(fillColor)\n\t\t\t}\n\t\t\tif (border) xml += createChartBorderLine(border)\n\t\t}\n\t\txml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\t\txml += '</c:spPr>'\n\t\txml += '</c:dPt>'\n\t})\n\treturn xml\n}\n","/**\n * ts-pptx: Chart Axis Assembly\n *\n * Builds the `<c:catAx>` / `<c:valAx>` / `<c:serAx>` elements. The three share a\n * structure -- scaling, delete flag, tick marks, label position, text properties,\n * gridlines, optional axis title -- but PowerPoint requires the child elements in a\n * fixed order that differs per axis, so they stay as three separate builders rather\n * than one parameterized one. Called by {@link ./chart-xml}'s axis region.\n *\n * Sub-blocks are shared where they can be shared *exactly*: {@link axisLineSpPr} covers\n * `<c:spPr>`, which differs between the three only by indent width. `<c:txPr>` is\n * deliberately left duplicated — its inherited indentation is irregular *within* each copy\n * as well as between them (the category axis closes `</a:defRPr>` at three spaces, the value\n * axis at six), so parameterising it would take about as many indent arguments as it has\n * lines and would hide the quirks rather than share the structure.\n */\n\nimport { asChartType, ChartType } from '../../enums.js'\nimport {\n\tAXIS_ID_CATEGORY_PRIMARY,\n\tAXIS_ID_CATEGORY_SECONDARY,\n\tAXIS_ID_VALUE_PRIMARY,\n\tAXIS_ID_VALUE_SECONDARY,\n\tDEF_FONT_COLOR,\n\tDEF_FONT_SIZE,\n} from '../../constants-internal.js'\nimport type { ChartOptsInternal } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { convertRotationDegrees, valToPts } from '../../units-internal.js'\nimport { EMU_PER_POINT, ptToHundredths } from '../../units.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport {\n\tcreateChartTextFonts,\n\tcreateGridLineElement,\n\tDEF_GRIDLINE_COLOR,\n\tgenXmlTitle,\n\tVALID_CHART_TIME_UNITS,\n} from './chart-parts.js'\n\n/**\n * The `<c:spPr>` axis-line block, identical in shape on all three axes.\n *\n * The only thing that differed between the three copies was how far each was indented — two\n * spaces on the category and series axes, one on the value axis — and that irregularity is\n * inherited, not meaningful. It is reproduced here rather than normalised because inter-element\n * whitespace being inert does not make changing it free: byte-identity is the gate that proves\n * an emitter refactor changed nothing, and it cannot tell a \"harmless\" whitespace edit from a\n * real one. `indent` keeps the quirk visible at the call site.\n * @param {number} indent - leading spaces on the `<c:spPr>` line; children step out by 2 and 4\n * @param {number} widthEmu - line width for `a:ln@w`\n * @param {boolean | undefined} show - false emits `<a:noFill/>` instead of a colour\n * @param {string | undefined} color - line colour, defaulting to {@link DEF_GRIDLINE_COLOR}\n * @param {string} dash - `a:prstDash@val`\n * @return {string} XML `<c:spPr>`\n */\nfunction axisLineSpPr(\n\tindent: number,\n\twidthEmu: number,\n\tshow: boolean | undefined,\n\tcolor: string | undefined,\n\tdash: string\n): string {\n\tconst at = (extra: number): string => ' '.repeat(indent + extra)\n\treturn (\n\t\t`${at(0)}<c:spPr>` +\n\t\t`${at(2)}<a:ln w=\"${widthEmu}\" cap=\"flat\">` +\n\t\t(!show ? '<a:noFill/>' : genXmlColorSelection(color || DEF_GRIDLINE_COLOR)) +\n\t\t`${at(4)}<a:prstDash val=\"${dash}\"/>` +\n\t\t`${at(4)}<a:round/>` +\n\t\t`${at(2)}</a:ln>` +\n\t\t`${at(0)}</c:spPr>`\n\t)\n}\n\nexport function makeCatAxis(opts: ChartOptsInternal, axisId: string, valAxisId: string): string {\n\tlet strXml = ''\n\tconst usesValueAxisForCategories =\n\t\topts._type === ChartType.scatter || opts._type === ChartType.bubble || opts._type === ChartType.bubble3d\n\tconst usesCategoryAxis = !usesValueAxisForCategories && !opts.catLabelFormatCode\n\n\t// Build cat axis tag\n\t// NOTE: Scatter and Bubble chart need two Val axises as they display numbers on x axis\n\tif (usesValueAxisForCategories) {\n\t\tstrXml += '<c:valAx>'\n\t} else {\n\t\tstrXml += '<c:' + (opts.catLabelFormatCode ? 'dateAx' : 'catAx') + '>'\n\t}\n\tstrXml += ' <c:axId val=\"' + axisId + '\"/>'\n\tstrXml += ' <c:scaling>'\n\tstrXml += '<c:orientation val=\"' + (opts.catAxisOrientation || 'minMax') + '\"/>'\n\tif (opts.catAxisMaxVal || opts.catAxisMaxVal === 0) strXml += `<c:max val=\"${opts.catAxisMaxVal}\"/>`\n\tif (opts.catAxisMinVal || opts.catAxisMinVal === 0) strXml += `<c:min val=\"${opts.catAxisMinVal}\"/>`\n\tstrXml += '</c:scaling>'\n\tstrXml += ' <c:delete val=\"' + (opts.catAxisHidden ? '1' : '0') + '\"/>'\n\tstrXml += ' <c:axPos val=\"' + (opts.barDir === 'col' ? 'b' : 'l') + '\"/>'\n\tstrXml += opts.catGridLine && opts.catGridLine.style !== 'none' ? createGridLineElement(opts.catGridLine) : ''\n\t// '<c:title>' comes between '</c:majorGridlines>' and '<c:numFmt>'\n\tif (opts.showCatAxisTitle) {\n\t\tstrXml += genXmlTitle({\n\t\t\tcolor: opts.catAxisTitleColor,\n\t\t\tfontFace: opts.catAxisTitleFontFace,\n\t\t\tfontSize: opts.catAxisTitleFontSize,\n\t\t\ttitleRotate: opts.catAxisTitleRotate,\n\t\t\ttitle: opts.catAxisTitle || 'Axis Title',\n\t\t})\n\t}\n\t// NOTE: Adding Val Axis Formatting if scatter or bubble charts\n\tif (opts._type === ChartType.scatter || opts._type === ChartType.bubble || opts._type === ChartType.bubble3d) {\n\t\tconst xAxisFmtCode = opts.catAxisLabelFormatCode ?? opts.valAxisLabelFormatCode\n\t\tstrXml += ' ' + voidEl('c:numFmt', { formatCode: xAxisFmtCode || 'General', sourceLinked: 1 })\n\t} else {\n\t\tstrXml += ' ' + voidEl('c:numFmt', { formatCode: (opts.catLabelFormatCode ?? '') || 'General', sourceLinked: 1 })\n\t}\n\tif (opts._type === ChartType.scatter) {\n\t\tstrXml += ' <c:majorTickMark val=\"none\"/>'\n\t\tstrXml += ' <c:minorTickMark val=\"none\"/>'\n\t\tstrXml += ' <c:tickLblPos val=\"' + (opts.catAxisLabelPos || 'nextTo') + '\"/>'\n\t} else {\n\t\tstrXml += ' <c:majorTickMark val=\"' + (opts.catAxisMajorTickMark || 'out') + '\"/>'\n\t\tstrXml += ' <c:minorTickMark val=\"' + (opts.catAxisMinorTickMark || 'none') + '\"/>'\n\t\tstrXml += ' <c:tickLblPos val=\"' + (opts.catAxisLabelPos || (opts.barDir === 'col' ? 'low' : 'nextTo')) + '\"/>'\n\t}\n\tstrXml += axisLineSpPr(\n\t\t2,\n\t\topts.catAxisLineSize ? valToPts(opts.catAxisLineSize) : EMU_PER_POINT,\n\t\topts.catAxisLineShow,\n\t\topts.catAxisLineColor,\n\t\topts.catAxisLineStyle || 'solid'\n\t)\n\tstrXml += ' <c:txPr>'\n\tif (opts.catAxisLabelRotate) {\n\t\tstrXml += `<a:bodyPr rot=\"${convertRotationDegrees(opts.catAxisLabelRotate)}\"/>`\n\t} else {\n\t\t// NOTE: don't specify \"`rot=0\" - that way the object will be auto behavior\n\t\tstrXml += '<a:bodyPr/>'\n\t}\n\tstrXml += ' <a:lstStyle/>'\n\tstrXml += ' <a:p>'\n\tstrXml += ' <a:pPr>'\n\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.catAxisLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.catAxisLabelFontBold ? 1 : 0}\" i=\"${opts.catAxisLabelFontItalic ? 1 : 0}\" u=\"none\" strike=\"noStrike\">`\n\tstrXml += genXmlColorSelection(opts.catAxisLabelColor || DEF_FONT_COLOR)\n\tstrXml += ' ' + createChartTextFonts(opts.catAxisLabelFontFace || 'Arial')\n\tstrXml += ' </a:defRPr>'\n\tstrXml += ' </a:pPr>'\n\tstrXml += ' <a:endParaRPr lang=\"' + (opts.lang || 'en-US') + '\"/>'\n\tstrXml += ' </a:p>'\n\tstrXml += ' </c:txPr>'\n\tstrXml += ' <c:crossAx val=\"' + valAxisId + '\"/>'\n\tconst valAxisCrossTag = typeof opts.valAxisCrossesAt === 'number' ? 'crossesAt' : 'crosses'\n\tconst valAxisCrossValue =\n\t\ttypeof opts.valAxisCrossesAt === 'number' ? opts.valAxisCrossesAt : opts.valAxisCrossesAt || 'autoZero'\n\tstrXml += ` <c:${valAxisCrossTag} val=\"${valAxisCrossValue}\"/>`\n\tif (!usesValueAxisForCategories) strXml += ' <c:auto val=\"1\"/>'\n\tif (usesCategoryAxis) {\n\t\tstrXml += ' <c:lblAlgn val=\"ctr\"/>'\n\t\tif (opts.catAxisLabelFrequency) strXml += ' <c:tickLblSkip val=\"' + opts.catAxisLabelFrequency + '\"/>'\n\t\tstrXml += ` <c:noMultiLvlLbl val=\"${opts.catAxisMultiLevelLabels ? 0 : 1}\"/>`\n\t}\n\n\t// PPT will auto-adjust these as needed after calcing the date bounds, so we only include them when specified by user\n\t// Allow major and minor units to be set for double value axis charts\n\tif (opts.catLabelFormatCode || usesValueAxisForCategories) {\n\t\tif (opts.catLabelFormatCode) {\n\t\t\t;(['catAxisBaseTimeUnit', 'catAxisMajorTimeUnit', 'catAxisMinorTimeUnit'] as const).forEach((opt) => {\n\t\t\t\t// Validate input as poorly chosen/garbage options will cause chart corruption and it wont render at all!\n\t\t\t\tconst optVal = opts[opt]\n\t\t\t\tif (optVal && (typeof optVal !== 'string' || !VALID_CHART_TIME_UNITS.includes(optVal.toLowerCase()))) {\n\t\t\t\t\twarn('chart/invalid-axis-time-unit', `\"${opt}\" must be one of: 'days','months','years' !`)\n\t\t\t\t\topts[opt] = undefined\n\t\t\t\t}\n\t\t\t})\n\t\t\tif (opts.catAxisBaseTimeUnit) strXml += '<c:baseTimeUnit val=\"' + opts.catAxisBaseTimeUnit.toLowerCase() + '\"/>'\n\t\t\tif (opts.catAxisMajorTimeUnit)\n\t\t\t\tstrXml += voidEl('c:majorTimeUnit', { val: opts.catAxisMajorTimeUnit.toLowerCase() })\n\t\t\tif (opts.catAxisMinorTimeUnit)\n\t\t\t\tstrXml += voidEl('c:minorTimeUnit', { val: opts.catAxisMinorTimeUnit.toLowerCase() })\n\t\t}\n\t\tif (opts.catAxisMajorUnit) strXml += `<c:majorUnit val=\"${opts.catAxisMajorUnit}\"/>`\n\t\tif (opts.catAxisMinorUnit) strXml += `<c:minorUnit val=\"${opts.catAxisMinorUnit}\"/>`\n\t}\n\n\t// Close cat axis tag\n\t// NOTE: Added closing tag of val or cat axis based on chart type\n\tif (usesValueAxisForCategories) {\n\t\tstrXml += '</c:valAx>'\n\t} else {\n\t\tstrXml += '</c:' + (opts.catLabelFormatCode ? 'dateAx' : 'catAx') + '>'\n\t}\n\n\treturn strXml\n}\n\n/**\n * Create Value Axis (Used by `bar3D`)\n * @param {ChartOptsInternal} opts - chart options\n * @param {string} valAxisId - value\n * @return {string} XML\n */\nexport function makeValAxis(opts: ChartOptsInternal, valAxisId: string): string {\n\tlet axisPos =\n\t\tvalAxisId === AXIS_ID_VALUE_PRIMARY ? (opts.barDir === 'col' ? 'l' : 'b') : opts.barDir !== 'col' ? 'r' : 't'\n\tif (valAxisId === AXIS_ID_VALUE_SECONDARY) axisPos = 'r' // default behavior for PPT is showing 2nd val axis on right (primary axis on left)\n\tconst crossAxId = valAxisId === AXIS_ID_VALUE_PRIMARY ? AXIS_ID_CATEGORY_PRIMARY : AXIS_ID_CATEGORY_SECONDARY\n\tlet strXml = ''\n\n\tstrXml += '<c:valAx>'\n\tstrXml += ' <c:axId val=\"' + valAxisId + '\"/>'\n\tstrXml += ' <c:scaling>'\n\tif (opts.valAxisLogScaleBase) strXml += `<c:logBase val=\"${opts.valAxisLogScaleBase}\"/>`\n\tstrXml += '<c:orientation val=\"' + (opts.valAxisOrientation || 'minMax') + '\"/>'\n\tif (opts.valAxisMaxVal || opts.valAxisMaxVal === 0) strXml += `<c:max val=\"${opts.valAxisMaxVal}\"/>`\n\tif (opts.valAxisMinVal || opts.valAxisMinVal === 0) strXml += `<c:min val=\"${opts.valAxisMinVal}\"/>`\n\tstrXml += ' </c:scaling>'\n\tstrXml += ` <c:delete val=\"${opts.valAxisHidden ? 1 : 0}\"/>`\n\tstrXml += ' <c:axPos val=\"' + axisPos + '\"/>'\n\tif (opts.valGridLine && opts.valGridLine.style !== 'none') strXml += createGridLineElement(opts.valGridLine)\n\t// '<c:title>' comes between '</c:majorGridlines>' and '<c:numFmt>'\n\tif (opts.showValAxisTitle) {\n\t\tstrXml += genXmlTitle({\n\t\t\tcolor: opts.valAxisTitleColor,\n\t\t\tfontFace: opts.valAxisTitleFontFace,\n\t\t\tfontSize: opts.valAxisTitleFontSize,\n\t\t\ttitleRotate: opts.valAxisTitleRotate,\n\t\t\ttitle: opts.valAxisTitle || 'Axis Title',\n\t\t})\n\t}\n\tstrXml += voidEl('c:numFmt', { formatCode: opts.valAxisLabelFormatCode || 'General', sourceLinked: 0 })\n\tif (opts._type === ChartType.scatter) {\n\t\tstrXml += ' <c:majorTickMark val=\"none\"/>'\n\t\tstrXml += ' <c:minorTickMark val=\"none\"/>'\n\t\tstrXml += ' <c:tickLblPos val=\"nextTo\"/>'\n\t} else {\n\t\tstrXml += ' <c:majorTickMark val=\"' + (opts.valAxisMajorTickMark || 'out') + '\"/>'\n\t\tstrXml += ' <c:minorTickMark val=\"' + (opts.valAxisMinorTickMark || 'none') + '\"/>'\n\t\tstrXml += ' <c:tickLblPos val=\"' + (opts.valAxisLabelPos || (opts.barDir === 'col' ? 'nextTo' : 'low')) + '\"/>'\n\t}\n\tstrXml += axisLineSpPr(\n\t\t1,\n\t\topts.valAxisLineSize ? valToPts(opts.valAxisLineSize) : EMU_PER_POINT,\n\t\topts.valAxisLineShow,\n\t\topts.valAxisLineColor,\n\t\topts.valAxisLineStyle || 'solid'\n\t)\n\tstrXml += ' <c:txPr>'\n\tstrXml += ` <a:bodyPr${opts.valAxisLabelRotate ? ' rot=\"' + convertRotationDegrees(opts.valAxisLabelRotate).toString() + '\"' : ''}/>` // don't specify rot 0 so we get the auto behavior\n\tstrXml += ' <a:lstStyle/>'\n\tstrXml += ' <a:p>'\n\tstrXml += ' <a:pPr>'\n\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.valAxisLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.valAxisLabelFontBold ? 1 : 0}\" i=\"${opts.valAxisLabelFontItalic ? 1 : 0}\" u=\"none\" strike=\"noStrike\">`\n\tstrXml += genXmlColorSelection(opts.valAxisLabelColor || DEF_FONT_COLOR)\n\tstrXml += ' ' + createChartTextFonts(opts.valAxisLabelFontFace || 'Arial')\n\tstrXml += ' </a:defRPr>'\n\tstrXml += ' </a:pPr>'\n\tstrXml += ' <a:endParaRPr lang=\"' + (opts.lang || 'en-US') + '\"/>'\n\tstrXml += ' </a:p>'\n\tstrXml += ' </c:txPr>'\n\tstrXml += ' <c:crossAx val=\"' + crossAxId + '\"/>'\n\tif (typeof opts.catAxisCrossesAt === 'number') {\n\t\tstrXml += ` <c:crossesAt val=\"${opts.catAxisCrossesAt}\"/>`\n\t} else if (typeof opts.catAxisCrossesAt === 'string') {\n\t\tstrXml += ' <c:crosses val=\"' + opts.catAxisCrossesAt + '\"/>'\n\t} else {\n\t\tconst isRight = axisPos === 'r' || axisPos === 't'\n\t\tconst crosses = isRight ? 'max' : 'autoZero'\n\t\tstrXml += ' <c:crosses val=\"' + crosses + '\"/>'\n\t}\n\tstrXml +=\n\t\t' <c:crossBetween val=\"' +\n\t\t(opts.valAxisCrossBetween\n\t\t\t? opts.valAxisCrossBetween\n\t\t\t: opts._type === ChartType.scatter ||\n\t\t\t\t !!(Array.isArray(opts._type) && opts._type.some((type) => asChartType(type.type) === ChartType.area))\n\t\t\t\t? 'midCat'\n\t\t\t\t: 'between') +\n\t\t'\"/>'\n\tif (opts.valAxisMajorUnit) strXml += ` <c:majorUnit val=\"${opts.valAxisMajorUnit}\"/>`\n\tif (opts.valAxisDisplayUnit) {\n\t\tstrXml += el('c:dispUnits', null, [\n\t\t\traw(voidEl('c:builtInUnit', { val: opts.valAxisDisplayUnit })),\n\t\t\traw(opts.valAxisDisplayUnitLabel ? voidEl('c:dispUnitsLbl') : ''),\n\t\t])\n\t}\n\n\tstrXml += '</c:valAx>'\n\n\treturn strXml\n}\n\n/**\n * Create Series Axis (Used by `bar3D`)\n * @param {ChartOptsInternal} opts - chart options\n * @param {string} axisId - axis ID\n * @param {string} valAxisId - value\n * @return {string} XML\n */\nexport function makeSerAxis(opts: ChartOptsInternal, axisId: string, valAxisId: string): string {\n\tlet strXml = ''\n\n\t// Build ser axis tag\n\tstrXml += '<c:serAx>'\n\tstrXml += ' <c:axId val=\"' + axisId + '\"/>'\n\tstrXml += ' <c:scaling><c:orientation val=\"' + (opts.serAxisOrientation || 'minMax') + '\"/></c:scaling>'\n\tstrXml += ' <c:delete val=\"' + (opts.serAxisHidden ? '1' : '0') + '\"/>'\n\tstrXml += ' <c:axPos val=\"' + (opts.barDir === 'col' ? 'b' : 'l') + '\"/>'\n\tstrXml += opts.serGridLine && opts.serGridLine.style !== 'none' ? createGridLineElement(opts.serGridLine) : ''\n\t// '<c:title>' comes between '</c:majorGridlines>' and '<c:numFmt>'\n\tif (opts.showSerAxisTitle) {\n\t\tstrXml += genXmlTitle({\n\t\t\tcolor: opts.serAxisTitleColor,\n\t\t\tfontFace: opts.serAxisTitleFontFace,\n\t\t\tfontSize: opts.serAxisTitleFontSize,\n\t\t\ttitleRotate: opts.serAxisTitleRotate,\n\t\t\ttitle: opts.serAxisTitle || 'Axis Title',\n\t\t})\n\t}\n\tstrXml += ' ' + voidEl('c:numFmt', { formatCode: (opts.serLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\tstrXml += ' <c:majorTickMark val=\"out\"/>'\n\tstrXml += ' <c:minorTickMark val=\"none\"/>'\n\tstrXml += ` <c:tickLblPos val=\"${opts.serAxisLabelPos || (opts.barDir === 'col' ? 'low' : 'nextTo')}\"/>`\n\tstrXml += axisLineSpPr(2, EMU_PER_POINT, opts.serAxisLineShow, opts.serAxisLineColor, 'solid')\n\tstrXml += ' <c:txPr>'\n\tstrXml += ' <a:bodyPr/>' // don't specify rot 0 so we get the auto behavior\n\tstrXml += ' <a:lstStyle/>'\n\tstrXml += ' <a:p>'\n\tstrXml += ' <a:pPr>'\n\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.serAxisLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.serAxisLabelFontBold ? '1' : '0'}\" i=\"${opts.serAxisLabelFontItalic ? '1' : '0'}\" u=\"none\" strike=\"noStrike\">`\n\tstrXml += ` ${genXmlColorSelection(opts.serAxisLabelColor || DEF_FONT_COLOR)}`\n\tstrXml += ' ' + createChartTextFonts(opts.serAxisLabelFontFace || 'Arial')\n\tstrXml += ' </a:defRPr>'\n\tstrXml += ' </a:pPr>'\n\tstrXml += ' <a:endParaRPr lang=\"' + (opts.lang || 'en-US') + '\"/>'\n\tstrXml += ' </a:p>'\n\tstrXml += ' </c:txPr>'\n\tstrXml += ' <c:crossAx val=\"' + valAxisId + '\"/>'\n\tstrXml += ' <c:crosses val=\"autoZero\"/>'\n\tif (opts.serAxisLabelFrequency) strXml += ' <c:tickLblSkip val=\"' + opts.serAxisLabelFrequency + '\"/>'\n\n\t// PPT will auto-adjust these as needed after calcing the date bounds, so we only include them when specified by user\n\tif (opts.serLabelFormatCode) {\n\t\t;(['serAxisBaseTimeUnit', 'serAxisMajorTimeUnit', 'serAxisMinorTimeUnit'] as const).forEach((opt) => {\n\t\t\t// Validate input as poorly chosen/garbage options will cause chart corruption and it wont render at all!\n\t\t\tconst optVal = opts[opt]\n\t\t\tif (optVal && (typeof optVal !== 'string' || !VALID_CHART_TIME_UNITS.includes(optVal.toLowerCase()))) {\n\t\t\t\twarn('chart/invalid-axis-time-unit', `\"${opt}\" must be one of: 'days','months','years' !`)\n\t\t\t\topts[opt] = undefined\n\t\t\t}\n\t\t})\n\t\t// `baseTimeUnit` keeps its template string on purpose: it emits TWO spaces before\n\t\t// `val`, and voidEl() joins attributes with exactly one. Normalizing the spacing\n\t\t// would be a byte change, so the quirk stays visible here rather than being\n\t\t// silently \"fixed\" by the builder.\n\t\tif (opts.serAxisBaseTimeUnit) strXml += ` <c:baseTimeUnit val=\"${opts.serAxisBaseTimeUnit.toLowerCase()}\"/>`\n\t\tif (opts.serAxisMajorTimeUnit)\n\t\t\tstrXml += voidEl('c:majorTimeUnit', { val: opts.serAxisMajorTimeUnit.toLowerCase() }, { openPrefix: ' ' })\n\t\tif (opts.serAxisMinorTimeUnit)\n\t\t\tstrXml += voidEl('c:minorTimeUnit', { val: opts.serAxisMinorTimeUnit.toLowerCase() }, { openPrefix: ' ' })\n\t\tif (opts.serAxisMajorUnit) strXml += ` <c:majorUnit val=\"${opts.serAxisMajorUnit}\"/>`\n\t\tif (opts.serAxisMinorUnit) strXml += ` <c:minorUnit val=\"${opts.serAxisMinorUnit}\"/>`\n\t}\n\n\t// Close ser axis tag\n\tstrXml += '</c:serAx>'\n\n\treturn strXml\n}\n\n/**\n * Create char title elements\n * @param {ChartPropsTitle} opts - options\n * @return {string} XML `<c:title>`\n */\n","/**\n * ts-pptx: Category-Axis Plot Assembly\n *\n * Emits the `<c:areaChart>` / `<c:barChart>` / `<c:bar3DChart>` / `<c:lineChart>` /\n * `<c:radarChart>` plot elements. These five chart types share one builder because they\n * share a plot shape -- grouping, per-series `<c:ser>` with a category reference and a\n * value cache, then the axis-id pair -- and differ only in a handful of type-gated\n * children. Reached through {@link ./chart-xml}'s `makeChartType` dispatch.\n */\n\nimport { ChartType } from '../../enums.js'\nimport {\n\tAXIS_ID_SERIES_PRIMARY,\n\tBARCHART_COLORS,\n\tDEF_FONT_COLOR,\n\tDEF_FONT_SIZE,\n\tDEF_SHAPE_SHADOW,\n} from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { createShadowEffectLst } from '../drawingml/effect.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { createLineCap, resolveBorderWidth } from '../drawingml/line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { FIXED_PCT_PER_PERCENT, ptToHundredths } from '../../units.js'\nimport { dataLabels, dataValues, firstLabelGroup, sheetCellRef, sheetRangeRef } from './data-refs.js'\nimport { el, voidEl } from '../oxml/el.js'\nimport {\n\tchartColorLineFill,\n\tcreateChartTextFonts,\n\tcreateSerLinesElement,\n\tmakeChartErrorBarsXml,\n\tmakeCustomDLblXml,\n\tmakeSeriesDataPointsXml,\n\tnumCachePt,\n} from './chart-parts.js'\n\n/**\n * Plot a category-axis chart family (area / bar / bar3d / line / radar) into a\n * `<c:xxxChart>` element. These share the grouping / series / cat+val axis structure.\n */\nexport function makeCatAxisPlot(\n\tchartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string,\n\tvalFmtCode: string\n): string {\n\tlet colorIndex = -1 // Maintain the color index by region\n\tlet strXml = ''\n\t// 1: Start Chart\n\tstrXml += `<c:${chartType}Chart>`\n\tif (chartType === ChartType.area || chartType === ChartType.line) {\n\t\tconst lineGrouping =\n\t\t\topts.barGrouping === 'stacked' || opts.barGrouping === 'percentStacked' ? opts.barGrouping : 'standard'\n\t\tstrXml += '<c:grouping val=\"' + lineGrouping + '\"/>'\n\t}\n\n\tif (chartType === ChartType.bar || chartType === ChartType.bar3d) {\n\t\tstrXml += '<c:barDir val=\"' + opts.barDir + '\"/>'\n\t\tstrXml += '<c:grouping val=\"' + (opts.barGrouping || 'clustered') + '\"/>'\n\t}\n\n\tif (chartType === ChartType.radar) {\n\t\t// Map the public PowerPoint-UI names to ST_RadarStyle wire values.\n\t\tconst radarStyleWire =\n\t\t\t{ radar: 'standard', markers: 'marker', filled: 'filled' }[opts.radarStyle || 'radar'] ?? 'standard'\n\t\tstrXml += '<c:radarStyle val=\"' + radarStyleWire + '\"/>'\n\t}\n\n\tstrXml += '<c:varyColors val=\"0\"/>'\n\n\t// 2: \"Series\" block for every data row\n\t/* EX1:\n\t\t\t\tdata: [\n\t\t\t\t {\n\t\t\t\t name: 'Region 1',\n\t\t\t\t labels: [['April', 'May', 'June', 'July']],\n\t\t\t\t values: [17, 26, 53, 96]\n\t\t\t\t },\n\t\t\t\t {\n\t\t\t\t name: 'Region 2',\n\t\t\t\t labels: [['April', 'May', 'June', 'July']],\n\t\t\t\t values: [55, 43, 70, 58]\n\t\t\t\t }\n\t\t\t\t]\n */\n\t/* EX2:\n\t\t\t\tdata: [\n\t\t\t\t {\n\t\t\t\t name: 'Region 1',\n\t\t\t\t labels: [\n\t\t\t\t\t ['April', 'May', 'June', 'April', 'May', 'June'],\n\t\t\t\t\t ['2020', '', '', '2021', '', '']\n\t\t\t\t ],\n\t\t\t\t values: [17, 26, 53, 96, 40, 33]\n\t\t\t\t },\n\t\t\t\t {\n\t\t\t\t name: 'Region 2',\n\t\t\t\t labels: [\n\t\t\t\t\t ['April', 'May', 'June', 'April', 'May', 'June'],\n\t\t\t\t\t ['2020', '', '', '2021', '', '']\n\t\t\t\t ],\n\t\t\t\t values: [55, 43, 70, 58, 78, 63]\n\t\t\t\t }\n\t\t\t\t]\n */\n\tdata.forEach((obj) => {\n\t\tcolorIndex++\n\t\tstrXml += '<c:ser>'\n\t\tstrXml += ` <c:idx val=\"${obj._dataIndex}\"/><c:order val=\"${obj._dataIndex}\"/>`\n\t\tstrXml += ' <c:tx>'\n\t\tstrXml += ' <c:strRef>'\n\t\tstrXml += ` <c:f>${sheetCellRef(obj._dataIndex + dataLabels(obj).length + 1, 1)}</c:f>`\n\t\tstrXml +=\n\t\t\t' <c:strCache><c:ptCount val=\"1\"/><c:pt idx=\"0\">' + el('c:v', null, obj.name ?? '') + '</c:pt></c:strCache>'\n\t\tstrXml += ' </c:strRef>'\n\t\tstrXml += ' </c:tx>'\n\n\t\t// Fill and Border\n\t\t// `chartColors` is always populated by addChartDefinition() (defaulting to BARCHART_COLORS); the\n\t\t// fallback here only satisfies the optional type and keeps `seriesColor` a non-null string.\n\t\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\t\tconst seriesOverride = opts.seriesOptions?.[obj._dataIndex]\n\t\tconst seriesColor = seriesOverride?.color ?? chartColors[colorIndex % chartColors.length] ?? '000000'\n\n\t\tstrXml += ' <c:spPr>'\n\t\tif (seriesColor === 'transparent') {\n\t\t\tstrXml += '<a:noFill/>'\n\t\t} else if (opts.chartColorsOpacity) {\n\t\t\tstrXml +=\n\t\t\t\t'<a:solidFill>' +\n\t\t\t\tcreateColorElement(\n\t\t\t\t\tseriesColor,\n\t\t\t\t\t`<a:alpha val=\"${Math.round(opts.chartColorsOpacity * FIXED_PCT_PER_PERCENT)}\"/>`\n\t\t\t\t) +\n\t\t\t\t'</a:solidFill>'\n\t\t} else {\n\t\t\tstrXml += genXmlColorSelection(seriesColor)\n\t\t}\n\n\t\tif (chartType === ChartType.line || chartType === ChartType.radar) {\n\t\t\tconst effectiveLineSize = seriesOverride?.lineSize ?? opts.lineSize ?? 2\n\t\t\tif (effectiveLineSize === 0) {\n\t\t\t\tstrXml += '<a:ln><a:noFill/></a:ln>'\n\t\t\t} else {\n\t\t\t\tstrXml += `<a:ln w=\"${valToPts(effectiveLineSize)}\" cap=\"${createLineCap(opts.lineCap)}\">${chartColorLineFill(seriesColor)}`\n\t\t\t\tstrXml +=\n\t\t\t\t\tvoidEl('a:prstDash', { val: opts.lineDashValues?.[colorIndex] ?? opts.lineDash ?? 'solid' }) +\n\t\t\t\t\tvoidEl('a:round') +\n\t\t\t\t\t'</a:ln>'\n\t\t\t}\n\t\t} else if (opts.dataBorder) {\n\t\t\tstrXml += `<a:ln w=\"${valToPts(resolveBorderWidth(opts.dataBorder, 0.75))}\" cap=\"${createLineCap(opts.lineCap)}\">${genXmlColorSelection({ color: opts.dataBorder.color ?? '363636', transparency: opts.dataBorder.transparency })}<a:prstDash val=\"solid\"/><a:round/></a:ln>`\n\t\t}\n\n\t\tstrXml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\n\t\tstrXml += ' </c:spPr>'\n\t\t// `invertIfNegative` is bar-only in the schema (CT_BarSer); area/line/radar series must omit it\n\t\tif (chartType === ChartType.bar || chartType === ChartType.bar3d) strXml += ' <c:invertIfNegative val=\"0\"/>'\n\n\t\t// 'c:marker' must precede 'c:dLbls' in CT_LineSer (schema order: spPr → marker → dPt → dLbls)\n\t\tif (chartType === ChartType.line || chartType === ChartType.radar) {\n\t\t\tstrXml += '<c:marker>'\n\t\t\tstrXml += ' <c:symbol val=\"' + opts.lineDataSymbol + '\"/>'\n\t\t\tif (opts.lineDataSymbolSize) strXml += `<c:size val=\"${opts.lineDataSymbolSize}\"/>` // Defaults to \"auto\" otherwise (but this is usually too small, so there is a default)\n\t\t\tstrXml += ' <c:spPr>'\n\t\t\t{\n\t\t\t\tconst markerColor =\n\t\t\t\t\tchartColors[\n\t\t\t\t\t\tobj._dataIndex + 1 > chartColors.length ? Math.floor(Math.random() * chartColors.length) : obj._dataIndex\n\t\t\t\t\t] ?? '000000'\n\t\t\t\tstrXml += markerColor === 'transparent' ? '<a:noFill/>' : genXmlColorSelection(markerColor)\n\t\t\t}\n\t\t\tstrXml += ` <a:ln w=\"${opts.lineDataSymbolLineSize}\" cap=\"flat\">${chartColorLineFill(opts.lineDataSymbolLineColor || seriesColor)}<a:prstDash val=\"solid\"/><a:round/></a:ln>`\n\t\t\tstrXml += ' <a:effectLst/>'\n\t\t\tstrXml += ' </c:spPr>'\n\t\t\tstrXml += '</c:marker>'\n\t\t}\n\n\t\t// Per-point data points (`c:dPt`) MUST precede `c:dLbls` in CT_*Ser schema order.\n\t\t// Covers legacy single-series bar color-vary AND per-point `pointStyles` overrides.\n\t\t{\n\t\t\tconst barVaryColors =\n\t\t\t\t(chartType === ChartType.bar || chartType === ChartType.bar3d) &&\n\t\t\t\tdata.length === 1 &&\n\t\t\t\t((opts.chartColors && opts.chartColors !== BARCHART_COLORS && opts.chartColors.length > 1) ||\n\t\t\t\t\topts.invertedColors?.length)\n\t\t\t\t\t? opts.chartColors || BARCHART_COLORS\n\t\t\t\t\t: null\n\t\t\tstrXml += makeSeriesDataPointsXml(chartType, obj, opts, barVaryColors)\n\t\t}\n\n\t\t// Data Labels per series\n\t\t// NOTE: [20190117] Adding these to RADAR chart causes unrecoverable corruption!\n\t\tif (chartType !== ChartType.radar) {\n\t\t\tconst lblColor = seriesOverride?.dataLabelColor ?? opts.dataLabelColor ?? DEF_FONT_COLOR\n\t\t\tconst lblBold = seriesOverride?.dataLabelFontBold ?? opts.dataLabelFontBold ?? false\n\t\t\tconst lblItalic = seriesOverride?.dataLabelFontItalic ?? opts.dataLabelFontItalic ?? false\n\t\t\tconst lblSize = seriesOverride?.dataLabelFontSize ?? opts.dataLabelFontSize ?? DEF_FONT_SIZE\n\t\t\tconst lblFace = seriesOverride?.dataLabelFontFace ?? opts.dataLabelFontFace ?? 'Arial'\n\t\t\tconst lblFmtCode = seriesOverride?.dataLabelFormatCode ?? opts.dataLabelFormatCode\n\t\t\tstrXml += '<c:dLbls>'\n\t\t\t// Per-point custom labels must precede aggregate settings (CT_DLbls schema order: dLbl* then Group_DLbls)\n\t\t\tif (obj.customLabels?.length) {\n\t\t\t\tobj.customLabels.forEach((lbl, idx) => {\n\t\t\t\t\tif (lbl) strXml += makeCustomDLblXml(idx, lbl, opts)\n\t\t\t\t})\n\t\t\t}\n\t\t\tstrXml += voidEl('c:numFmt', { formatCode: (lblFmtCode ?? '') || 'General', sourceLinked: 0 })\n\t\t\tif (opts.dataLabelBkgrdColors) strXml += `<c:spPr>${genXmlColorSelection(seriesColor)}</c:spPr>`\n\t\t\tstrXml += '<c:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr>'\n\t\t\tstrXml += `<a:defRPr b=\"${lblBold ? 1 : 0}\" i=\"${lblItalic ? 1 : 0}\" strike=\"noStrike\" sz=\"${ptToHundredths(lblSize)}\" u=\"none\">`\n\t\t\tstrXml += genXmlColorSelection(lblColor)\n\t\t\tstrXml += createChartTextFonts(lblFace)\n\t\t\tstrXml += '</a:defRPr></a:pPr></a:p></c:txPr>'\n\t\t\tif (opts.dataLabelPosition) strXml += voidEl('c:dLblPos', { val: opts.dataLabelPosition })\n\t\t\tstrXml += '<c:showLegendKey val=\"0\"/>'\n\t\t\tstrXml += `<c:showVal val=\"${opts.showValue ? '1' : '0'}\"/>`\n\t\t\tstrXml += `<c:showCatName val=\"0\"/><c:showSerName val=\"${opts.showSerName ? '1' : '0'}\"/><c:showPercent val=\"0\"/><c:showBubbleSize val=\"0\"/>`\n\t\t\tstrXml += `<c:showLeaderLines val=\"${opts.showLeaderLines ? '1' : '0'}\"/>`\n\t\t\tstrXml += '</c:dLbls>'\n\t\t}\n\n\t\t// Error bars (`<c:errBars>`) — schema order places them after dLbls, before cat.\n\t\t// RADAR has no error bars in CT_RadarSer, so it is excluded.\n\t\tif (chartType !== ChartType.radar) strXml += makeChartErrorBarsXml(chartType, obj.errorBars, obj)\n\n\t\t// 2: \"Categories\"\n\t\t{\n\t\t\tstrXml += '<c:cat>'\n\t\t\tif (opts.catLabelFormatCode) {\n\t\t\t\t// Use 'numRef' as catLabelFormatCode implies that we are expecting numbers here\n\t\t\t\tstrXml += ' <c:numRef>'\n\t\t\t\tstrXml += ` <c:f>Sheet1!$A$2:$A$${firstLabelGroup(obj).length + 1}</c:f>`\n\t\t\t\tstrXml += ' <c:numCache>'\n\t\t\t\tstrXml += ' <c:formatCode>' + (opts.catLabelFormatCode || 'General') + '</c:formatCode>'\n\t\t\t\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(obj).length}\"/>`\n\t\t\t\tfirstLabelGroup(obj).forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\t\t\t\tstrXml += ' </c:numCache>'\n\t\t\t\tstrXml += ' </c:numRef>'\n\t\t\t} else if (dataLabels(obj).length === 1) {\n\t\t\t\tstrXml += ' <c:strRef>'\n\t\t\t\tstrXml += ` <c:f>Sheet1!$A$2:$A$${firstLabelGroup(obj).length + 1}</c:f>`\n\t\t\t\tstrXml += ' <c:strCache>'\n\t\t\t\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(obj).length}\"/>`\n\t\t\t\tfirstLabelGroup(obj).forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\t\t\t\tstrXml += ' </c:strCache>'\n\t\t\t\tstrXml += ' </c:strRef>'\n\t\t\t} else {\n\t\t\t\tstrXml += ' <c:multiLvlStrRef>'\n\t\t\t\tstrXml += ` <c:f>${sheetRangeRef(1, 2, dataLabels(obj).length, firstLabelGroup(obj).length + 1)}</c:f>`\n\t\t\t\tstrXml += ' <c:multiLvlStrCache>'\n\t\t\t\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(obj).length}\"/>`\n\t\t\t\tdataLabels(obj).forEach((labelsGroup) => {\n\t\t\t\t\tstrXml += '<c:lvl>'\n\t\t\t\t\tlabelsGroup.forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\t\t\t\t\tstrXml += '</c:lvl>'\n\t\t\t\t})\n\t\t\t\tstrXml += ' </c:multiLvlStrCache>'\n\t\t\t\tstrXml += ' </c:multiLvlStrRef>'\n\t\t\t}\n\t\t\tstrXml += '</c:cat>'\n\t\t}\n\n\t\t// 3: \"Values\"\n\t\t{\n\t\t\tstrXml += '<c:val>'\n\t\t\tstrXml += ' <c:numRef>'\n\t\t\tstrXml += `<c:f>${sheetRangeRef(obj._dataIndex + dataLabels(obj).length + 1, 2, obj._dataIndex + dataLabels(obj).length + 1, firstLabelGroup(obj).length + 1)}</c:f>`\n\t\t\tstrXml += ' <c:numCache>'\n\t\t\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\t\t\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(obj).length}\"/>`\n\t\t\tdataValues(obj).forEach((value, idx) => {\n\t\t\t\tstrXml += numCachePt(idx, value)\n\t\t\t})\n\t\t\tstrXml += ' </c:numCache>'\n\t\t\tstrXml += ' </c:numRef>'\n\t\t\tstrXml += '</c:val>'\n\t\t}\n\n\t\t// Option: `smooth`\n\t\tif (chartType === ChartType.line) strXml += '<c:smooth val=\"' + (opts.lineSmooth ? '1' : '0') + '\"/>'\n\n\t\t// 4: Close \"SERIES\"\n\t\tstrXml += '</c:ser>'\n\t})\n\n\t// 3: \"Data Labels\"\n\t{\n\t\tstrXml += ' <c:dLbls>'\n\t\tstrXml +=\n\t\t\t' ' + voidEl('c:numFmt', { formatCode: (opts.dataLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\t\tstrXml += ' <c:txPr>'\n\t\tstrXml += ' <a:bodyPr/>'\n\t\tstrXml += ' <a:lstStyle/>'\n\t\tstrXml += ' <a:p><a:pPr>'\n\t\tstrXml += ` <a:defRPr b=\"${opts.dataLabelFontBold ? 1 : 0}\" i=\"${opts.dataLabelFontItalic ? 1 : 0}\" strike=\"noStrike\" sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" u=\"none\">`\n\t\tstrXml += genXmlColorSelection(opts.dataLabelColor || DEF_FONT_COLOR)\n\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\tstrXml += ' </a:defRPr>'\n\t\tstrXml += ' </a:pPr></a:p>'\n\t\tstrXml += ' </c:txPr>'\n\t\tif (opts.dataLabelPosition) strXml += ' <c:dLblPos val=\"' + opts.dataLabelPosition + '\"/>'\n\t\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\t\tstrXml += ' <c:showVal val=\"' + (opts.showValue ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showCatName val=\"0\"/>'\n\t\tstrXml += ' <c:showSerName val=\"' + (opts.showSerName ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showPercent val=\"0\"/>'\n\t\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\t\tstrXml += ` <c:showLeaderLines val=\"${opts.showLeaderLines ? '1' : '0'}\"/>`\n\t\tstrXml += ' </c:dLbls>'\n\t}\n\n\t// 4: Add more chart options (gapWidth, line Marker, etc.)\n\tif (chartType === ChartType.bar) {\n\t\tstrXml += ` <c:gapWidth val=\"${opts.barGapWidthPct}\"/>`\n\t\tstrXml += ` <c:overlap val=\"${opts.barOverlapPct != null ? opts.barOverlapPct : (opts.barGrouping || '').includes('tacked') ? 100 : 0}\"/>`\n\t\t// `<c:serLines>` (\"Series Lines\") connects data points across stacked bar/column series.\n\t\t// Schema order (CT_BarChart): gapWidth → overlap → serLines → axId.\n\t\tstrXml += createSerLinesElement(opts.barSeriesLine)\n\t} else if (chartType === ChartType.bar3d) {\n\t\tstrXml += ` <c:gapWidth val=\"${opts.barGapWidthPct}\"/>`\n\t\tstrXml += ` <c:gapDepth val=\"${opts.barGapDepthPct}\"/>`\n\t\tstrXml += ' <c:shape val=\"' + opts.bar3DShape + '\"/>'\n\t} else if (chartType === ChartType.line) {\n\t\tstrXml += ' <c:marker val=\"1\"/>'\n\t}\n\n\t// 5: Add axisId (NOTE: order matters! (category comes first))\n\t// Only 3D charts (BAR3D) get a series axis def; emitting a\n\t// SERIES_PRIMARY axId for 2D charts produced a dangling reference\n\t// that violated the OOXML invariant (every axId in <c:plotArea>\n\t// must resolve to a defined catAx/valAx).\n\tstrXml += `<c:axId val=\"${catAxisId}\"/><c:axId val=\"${valAxisId}\"/>`\n\tif (chartType === ChartType.bar3d) {\n\t\tstrXml += `<c:axId val=\"${AXIS_ID_SERIES_PRIMARY}\"/>`\n\t}\n\n\t// 6: Close Chart tag\n\tstrXml += `</c:${chartType}Chart>`\n\treturn strXml\n}\n","/**\n * ts-pptx: Scatter Plot Assembly\n *\n * Emits the `<c:scatterChart>` plot element. Scatter is the one family whose first data\n * row supplies X *values* rather than categories, so each `<c:ser>` carries an\n * `<c:xVal>`/`<c:yVal>` pair instead of `<c:cat>`/`<c:val>` -- which is why it does not\n * share the category-axis builder. Reached through {@link ./chart-xml}'s `makeChartType`\n * dispatch.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { BARCHART_COLORS, DEF_FONT_COLOR, DEF_FONT_SIZE, DEF_SHAPE_SHADOW } from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { encodeXmlEntities, getUuid } from '../utils.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { createShadowEffectLst } from '../drawingml/effect.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { createLineCap } from '../drawingml/line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { FIXED_PCT_PER_PERCENT, ptToHundredths } from '../../units.js'\nimport { dataLabels, dataValues, firstLabelGroup, sheetCellRef, sheetRangeRef } from './data-refs.js'\nimport { el, voidEl } from '../oxml/el.js'\nimport {\n\tchartColorLineFill,\n\tcreateChartTextFonts,\n\tmakeChartErrorBarsXml,\n\tmakeSeriesDataPointsXml,\n\tnumCachePt,\n} from './chart-parts.js'\n\n/**\n * Plot an XY scatter chart into `<c:scatterChart>` (paired X/Y numeric series).\n */\nexport function makeScatterPlot(\n\tchartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string,\n\tvalFmtCode: string\n): string {\n\tlet colorIndex = -1 // Maintain the color index by region\n\tlet strXml = ''\n\t/*\n\t\t\t\t`data` = [\n\t\t\t\t\t{ name:'X-Axis', values:[1,2,3,4,5,6,7,8,9,10,11,12] },\n\t\t\t\t\t{ name:'Y-Value 1', values:[13, 20, 21, 25] },\n\t\t\t\t\t{ name:'Y-Value 2', values:[ 1, 2, 5, 9] }\n\t\t\t\t];\n */\n\n\t// 1: Start Chart\n\tstrXml += '<c:' + chartType + 'Chart>'\n\tstrXml += '<c:scatterStyle val=\"lineMarker\"/>'\n\tstrXml += '<c:varyColors val=\"0\"/>'\n\n\t// 2: Series: (One for each Y-Axis)\n\tcolorIndex = -1\n\tdata\n\t\t.filter((_obj, idx) => idx > 0)\n\t\t.forEach((obj, idx) => {\n\t\t\tcolorIndex++\n\t\t\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\t\t\tstrXml += '<c:ser>'\n\t\t\tstrXml += ` <c:idx val=\"${idx}\"/>`\n\t\t\tstrXml += ` <c:order val=\"${idx}\"/>`\n\t\t\tstrXml += ' <c:tx>'\n\t\t\tstrXml += ' <c:strRef>'\n\t\t\tstrXml += ` <c:f>${sheetCellRef(idx + 2, 1)}</c:f>`\n\t\t\tstrXml +=\n\t\t\t\t' <c:strCache><c:ptCount val=\"1\"/><c:pt idx=\"0\">' +\n\t\t\t\tel('c:v', null, obj.name ?? '') +\n\t\t\t\t'</c:pt></c:strCache>'\n\t\t\tstrXml += ' </c:strRef>'\n\t\t\tstrXml += ' </c:tx>'\n\n\t\t\t// 'c:spPr': Fill, Border, Line, LineStyle (dash, etc.), Shadow\n\t\t\tstrXml += ' <c:spPr>'\n\t\t\t{\n\t\t\t\tconst tmpSerColor = chartColors[colorIndex % chartColors.length] ?? '000000'\n\n\t\t\t\tif (tmpSerColor === 'transparent') {\n\t\t\t\t\tstrXml += '<a:noFill/>'\n\t\t\t\t} else if (opts.chartColorsOpacity) {\n\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t'<a:solidFill>' +\n\t\t\t\t\t\tcreateColorElement(\n\t\t\t\t\t\t\ttmpSerColor,\n\t\t\t\t\t\t\t'<a:alpha val=\"' + Math.round(opts.chartColorsOpacity * FIXED_PCT_PER_PERCENT).toString() + '\"/>'\n\t\t\t\t\t\t) +\n\t\t\t\t\t\t'</a:solidFill>'\n\t\t\t\t} else {\n\t\t\t\t\tstrXml += genXmlColorSelection(tmpSerColor)\n\t\t\t\t}\n\n\t\t\t\tif (opts.lineSize === 0) {\n\t\t\t\t\tstrXml += '<a:ln><a:noFill/></a:ln>'\n\t\t\t\t} else {\n\t\t\t\t\tstrXml += `<a:ln w=\"${valToPts(opts.lineSize ?? 2)}\" cap=\"${createLineCap(opts.lineCap)}\">${chartColorLineFill(tmpSerColor)}`\n\t\t\t\t\tstrXml +=\n\t\t\t\t\t\tvoidEl('a:prstDash', { val: opts.lineDashValues?.[colorIndex] ?? opts.lineDash ?? 'solid' }) +\n\t\t\t\t\t\tvoidEl('a:round') +\n\t\t\t\t\t\t'</a:ln>'\n\t\t\t\t}\n\n\t\t\t\t// Shadow\n\t\t\t\tstrXml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\t\t\t}\n\t\t\tstrXml += ' </c:spPr>'\n\n\t\t\t// 'c:marker' tag: `lineDataSymbol`\n\t\t\t{\n\t\t\t\tstrXml += '<c:marker>'\n\t\t\t\tstrXml += ' <c:symbol val=\"' + opts.lineDataSymbol + '\"/>'\n\t\t\t\tif (opts.lineDataSymbolSize) {\n\t\t\t\t\t// Defaults to \"auto\" otherwise (but this is usually too small, so there is a default)\n\t\t\t\t\tstrXml += `<c:size val=\"${opts.lineDataSymbolSize}\"/>`\n\t\t\t\t}\n\t\t\t\tstrXml += '<c:spPr>'\n\t\t\t\t{\n\t\t\t\t\tconst markerColor =\n\t\t\t\t\t\tchartColors[idx + 1 > chartColors.length ? Math.floor(Math.random() * chartColors.length) : idx] ?? '000000'\n\t\t\t\t\tstrXml += markerColor === 'transparent' ? '<a:noFill/>' : genXmlColorSelection(markerColor)\n\t\t\t\t}\n\t\t\t\tstrXml += `<a:ln w=\"${opts.lineDataSymbolLineSize}\" cap=\"flat\">${chartColorLineFill(opts.lineDataSymbolLineColor || (chartColors[colorIndex % chartColors.length] ?? '000000'))}<a:prstDash val=\"solid\"/><a:round/></a:ln>`\n\t\t\t\tstrXml += '<a:effectLst/>'\n\t\t\t\tstrXml += '</c:spPr>'\n\t\t\t\tstrXml += '</c:marker>'\n\t\t\t}\n\n\t\t\t// Per-point data points (`c:dPt`) MUST precede `c:dLbls` (CT_ScatterSer schema order).\n\t\t\t// Covers legacy single-series color-vary AND per-point `pointStyles` overrides.\n\t\t\t{\n\t\t\t\tconst scatterVaryColors =\n\t\t\t\t\tdata.length === 1 && opts.chartColors !== BARCHART_COLORS ? opts.chartColors || BARCHART_COLORS : null\n\t\t\t\tstrXml += makeSeriesDataPointsXml(chartType, obj, opts, scatterVaryColors)\n\t\t\t}\n\n\t\t\t// Option: scatter data point labels\n\t\t\tif (opts.showLabel) {\n\t\t\t\tconst chartUuid = getUuid('-xxxx-xxxx-xxxx-xxxxxxxxxxxx')\n\t\t\t\tif (\n\t\t\t\t\tdataLabels(obj)[0] &&\n\t\t\t\t\t(opts.dataLabelFormatScatter === 'custom' || opts.dataLabelFormatScatter === 'customXY')\n\t\t\t\t) {\n\t\t\t\t\tstrXml += '<c:dLbls>'\n\t\t\t\t\tfirstLabelGroup(obj).forEach((label, idx) => {\n\t\t\t\t\t\tif (opts.dataLabelFormatScatter === 'custom' || opts.dataLabelFormatScatter === 'customXY') {\n\t\t\t\t\t\t\tstrXml += ' <c:dLbl>'\n\t\t\t\t\t\t\tstrXml += ` <c:idx val=\"${idx}\"/>`\n\t\t\t\t\t\t\tstrXml += ' <c:tx>'\n\t\t\t\t\t\t\tstrXml += ' <c:rich>'\n\t\t\t\t\t\t\tstrXml += ' <a:bodyPr>'\n\t\t\t\t\t\t\tstrXml += ' <a:spAutoFit/>'\n\t\t\t\t\t\t\tstrXml += ' </a:bodyPr>'\n\t\t\t\t\t\t\tstrXml += ' <a:lstStyle/>'\n\t\t\t\t\t\t\tstrXml += ' <a:p>'\n\t\t\t\t\t\t\tstrXml += ' <a:pPr>'\n\t\t\t\t\t\t\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.dataLabelFontBold ? '1' : '0'}\" i=\"${opts.dataLabelFontItalic ? '1' : '0'}\" u=\"none\" strike=\"noStrike\">`\n\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t' <a:solidFill>' +\n\t\t\t\t\t\t\t\tcreateColorElement(opts.dataLabelColor || DEF_FONT_COLOR) +\n\t\t\t\t\t\t\t\t'</a:solidFill>'\n\t\t\t\t\t\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\t\t\t\t\t\tstrXml += ' </a:defRPr>'\n\t\t\t\t\t\t\tstrXml += ' </a:pPr>'\n\t\t\t\t\t\t\tstrXml += ' <a:r>'\n\t\t\t\t\t\t\tstrXml += ` <a:rPr lang=\"${encodeXmlEntities(opts.lang || 'en-US')}\" sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.dataLabelFontBold ? '1' : '0'}\" i=\"${opts.dataLabelFontItalic ? '1' : '0'}\" u=\"none\" strike=\"noStrike\" dirty=\"0\">`\n\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t' <a:solidFill>' +\n\t\t\t\t\t\t\t\tcreateColorElement(opts.dataLabelColor || DEF_FONT_COLOR) +\n\t\t\t\t\t\t\t\t'</a:solidFill>'\n\t\t\t\t\t\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\t\t\t\t\t\tstrXml += ' </a:rPr>'\n\t\t\t\t\t\t\tstrXml += ' ' + el('a:t', null, label)\n\t\t\t\t\t\t\tstrXml += ' </a:r>'\n\t\t\t\t\t\t\t// Apply XY values at end of custom label\n\t\t\t\t\t\t\t// Do not apply the values if the label was empty or just spaces\n\t\t\t\t\t\t\t// This allows for selective labelling where required\n\t\t\t\t\t\t\tif (opts.dataLabelFormatScatter === 'customXY' && !/^ *$/.test(label)) {\n\t\t\t\t\t\t\t\tstrXml += ' <a:r>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:rPr lang=\"' + (opts.lang || 'en-US') + '\" baseline=\"0\" dirty=\"0\"/>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:t> (</a:t>'\n\t\t\t\t\t\t\t\tstrXml += ' </a:r>'\n\t\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t\t' <a:fld id=\"{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}\" type=\"XVALUE\">'\n\t\t\t\t\t\t\t\tstrXml += ' <a:rPr lang=\"' + (opts.lang || 'en-US') + '\" baseline=\"0\"/>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:pPr>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:defRPr/>'\n\t\t\t\t\t\t\t\tstrXml += ' </a:pPr>'\n\t\t\t\t\t\t\t\tstrXml += ' ' + el('a:t', null, '[' + (obj.name ?? ''))\n\t\t\t\t\t\t\t\tstrXml += ' </a:fld>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:r>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:rPr lang=\"' + (opts.lang || 'en-US') + '\" baseline=\"0\" dirty=\"0\"/>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:t>, </a:t>'\n\t\t\t\t\t\t\t\tstrXml += ' </a:r>'\n\t\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t\t' <a:fld id=\"{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}\" type=\"YVALUE\">'\n\t\t\t\t\t\t\t\tstrXml += ' <a:rPr lang=\"' + (opts.lang || 'en-US') + '\" baseline=\"0\"/>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:pPr>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:defRPr/>'\n\t\t\t\t\t\t\t\tstrXml += ' </a:pPr>'\n\t\t\t\t\t\t\t\tstrXml += ' ' + el('a:t', null, '[' + (obj.name ?? '') + ']')\n\t\t\t\t\t\t\t\tstrXml += ' </a:fld>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:r>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:rPr lang=\"' + (opts.lang || 'en-US') + '\" baseline=\"0\" dirty=\"0\"/>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:t>)</a:t>'\n\t\t\t\t\t\t\t\tstrXml += ' </a:r>'\n\t\t\t\t\t\t\t\tstrXml += ' <a:endParaRPr lang=\"' + (opts.lang || 'en-US') + '\" dirty=\"0\"/>'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstrXml += ' </a:p>'\n\t\t\t\t\t\t\tstrXml += ' </c:rich>'\n\t\t\t\t\t\t\tstrXml += ' </c:tx>'\n\t\t\t\t\t\t\tstrXml += ' <c:spPr>'\n\t\t\t\t\t\t\tstrXml += ' <a:noFill/>'\n\t\t\t\t\t\t\tstrXml += ' <a:ln>'\n\t\t\t\t\t\t\tstrXml += ' <a:noFill/>'\n\t\t\t\t\t\t\tstrXml += ' </a:ln>'\n\t\t\t\t\t\t\tstrXml += ' <a:effectLst/>'\n\t\t\t\t\t\t\tstrXml += ' </c:spPr>'\n\t\t\t\t\t\t\tif (opts.dataLabelPosition) strXml += ' <c:dLblPos val=\"' + opts.dataLabelPosition + '\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showVal val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showCatName val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showSerName val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showPercent val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:showLeaderLines val=\"1\"/>'\n\t\t\t\t\t\t\tstrXml += ' <c:extLst>'\n\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t' <c:ext uri=\"{CE6537A1-D6FC-4f65-9D91-7224C49458BB}\" xmlns:c15=\"http://schemas.microsoft.com/office/drawing/2012/chart\"/>'\n\t\t\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t\t\t' <c:ext uri=\"{C3380CC4-5D6E-409C-BE32-E72D297353CC}\" xmlns:c16=\"http://schemas.microsoft.com/office/drawing/2014/chart\">'\n\t\t\t\t\t\t\tstrXml += ` <c16:uniqueId val=\"{${String(idx + 1).padStart(8, '0')}${chartUuid}}\"/>`\n\t\t\t\t\t\t\tstrXml += ' </c:ext>'\n\t\t\t\t\t\t\tstrXml += ' </c:extLst>'\n\t\t\t\t\t\t\tstrXml += '</c:dLbl>'\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tstrXml += '</c:dLbls>'\n\t\t\t\t}\n\t\t\t\tif (opts.dataLabelFormatScatter === 'XY') {\n\t\t\t\t\tstrXml += '<c:dLbls>'\n\t\t\t\t\tstrXml += ' <c:spPr>'\n\t\t\t\t\tstrXml += ' <a:noFill/>'\n\t\t\t\t\tstrXml += ' <a:ln>'\n\t\t\t\t\tstrXml += ' <a:noFill/>'\n\t\t\t\t\tstrXml += ' </a:ln>'\n\t\t\t\t\tstrXml += ' <a:effectLst/>'\n\t\t\t\t\tstrXml += ' </c:spPr>'\n\t\t\t\t\tstrXml += ' <c:txPr>'\n\t\t\t\t\tstrXml += ' <a:bodyPr>'\n\t\t\t\t\tstrXml += ' <a:spAutoFit/>'\n\t\t\t\t\tstrXml += ' </a:bodyPr>'\n\t\t\t\t\tstrXml += ' <a:lstStyle/>'\n\t\t\t\t\tstrXml += ' <a:p>'\n\t\t\t\t\tstrXml += ' <a:pPr>'\n\t\t\t\t\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.dataLabelFontBold ? '1' : '0'}\" i=\"${opts.dataLabelFontItalic ? '1' : '0'}\" u=\"none\" strike=\"noStrike\">`\n\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t' <a:solidFill>' +\n\t\t\t\t\t\tcreateColorElement(opts.dataLabelColor || DEF_FONT_COLOR) +\n\t\t\t\t\t\t'</a:solidFill>'\n\t\t\t\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\t\t\t\tstrXml += ' </a:defRPr>'\n\t\t\t\t\tstrXml += ' </a:pPr>'\n\t\t\t\t\tstrXml += ` <a:endParaRPr lang=\"${encodeXmlEntities(opts.lang || 'en-US')}\"/>`\n\t\t\t\t\tstrXml += ' </a:p>'\n\t\t\t\t\tstrXml += ' </c:txPr>'\n\t\t\t\t\tif (opts.dataLabelPosition) strXml += ' <c:dLblPos val=\"' + opts.dataLabelPosition + '\"/>'\n\t\t\t\t\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\t\t\t\t\tstrXml += ` <c:showVal val=\"${opts.showLabel ? '1' : '0'}\"/>`\n\t\t\t\t\tstrXml += ` <c:showCatName val=\"${opts.showLabel ? '1' : '0'}\"/>`\n\t\t\t\t\tstrXml += ` <c:showSerName val=\"${opts.showSerName ? '1' : '0'}\"/>`\n\t\t\t\t\tstrXml += ' <c:showPercent val=\"0\"/>'\n\t\t\t\t\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\t\t\t\t\tstrXml += ' <c:extLst>'\n\t\t\t\t\tstrXml +=\n\t\t\t\t\t\t' <c:ext uri=\"{CE6537A1-D6FC-4f65-9D91-7224C49458BB}\" xmlns:c15=\"http://schemas.microsoft.com/office/drawing/2012/chart\">'\n\t\t\t\t\tstrXml += ' <c15:showLeaderLines val=\"1\"/>'\n\t\t\t\t\tstrXml += ' </c:ext>'\n\t\t\t\t\tstrXml += ' </c:extLst>'\n\t\t\t\t\tstrXml += '</c:dLbls>'\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Error bars (`<c:errBars>`) — schema order places them after dLbls, before xVal/yVal.\n\t\t\tstrXml += makeChartErrorBarsXml(chartType, obj.errorBars, obj)\n\n\t\t\t// 3: \"Values\": Scatter Chart has 2: `xVal` and `yVal`\n\t\t\t{\n\t\t\t\t// X-Axis is always the same\n\t\t\t\tstrXml += '<c:xVal>'\n\t\t\t\tstrXml += ' <c:numRef>'\n\t\t\t\tstrXml += ` <c:f>Sheet1!$A$2:$A$${dataValues(data[0]).length + 1}</c:f>`\n\t\t\t\tstrXml += ' <c:numCache>'\n\t\t\t\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\t\t\t\tstrXml += ` <c:ptCount val=\"${dataValues(data[0]).length}\"/>`\n\t\t\t\tdataValues(data[0]).forEach((value, idx) => {\n\t\t\t\t\tstrXml += numCachePt(idx, value)\n\t\t\t\t})\n\t\t\t\tstrXml += ' </c:numCache>'\n\t\t\t\tstrXml += ' </c:numRef>'\n\t\t\t\tstrXml += '</c:xVal>'\n\n\t\t\t\t// Y-Axis vals are this object's `values`\n\t\t\t\tstrXml += '<c:yVal>'\n\t\t\t\tstrXml += ' <c:numRef>'\n\t\t\t\tstrXml += ` <c:f>${sheetRangeRef(idx + 2, 2, idx + 2, dataValues(data[0]).length + 1)}</c:f>`\n\t\t\t\tstrXml += ' <c:numCache>'\n\t\t\t\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\t\t\t\t// NOTE: Use pt count and iterate over data[0] (X-Axis) as user can have more values than data (eg: timeline where only first few months are populated)\n\t\t\t\tstrXml += ` <c:ptCount val=\"${dataValues(data[0]).length}\"/>`\n\t\t\t\tdataValues(data[0]).forEach((_value, idx) => {\n\t\t\t\t\tstrXml += numCachePt(idx, dataValues(obj)[idx])\n\t\t\t\t})\n\t\t\t\tstrXml += ' </c:numCache>'\n\t\t\t\tstrXml += ' </c:numRef>'\n\t\t\t\tstrXml += '</c:yVal>'\n\t\t\t}\n\n\t\t\t// Option: `smooth`\n\t\t\tstrXml += '<c:smooth val=\"' + (opts.lineSmooth ? '1' : '0') + '\"/>'\n\n\t\t\t// 4: Close \"SERIES\"\n\t\t\tstrXml += '</c:ser>'\n\t\t})\n\n\t// 3: Data Labels\n\t{\n\t\tstrXml += ' <c:dLbls>'\n\t\tstrXml +=\n\t\t\t' ' + voidEl('c:numFmt', { formatCode: (opts.dataLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\t\tstrXml += ' <c:txPr>'\n\t\tstrXml += ' <a:bodyPr/>'\n\t\tstrXml += ' <a:lstStyle/>'\n\t\tstrXml += ' <a:p><a:pPr>'\n\t\tstrXml += ` <a:defRPr b=\"${opts.dataLabelFontBold ? '1' : '0'}\" i=\"${opts.dataLabelFontItalic ? '1' : '0'}\" strike=\"noStrike\" sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" u=\"none\">`\n\t\tstrXml += genXmlColorSelection(opts.dataLabelColor || DEF_FONT_COLOR)\n\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\tstrXml += ' </a:defRPr>'\n\t\tstrXml += ' </a:pPr></a:p>'\n\t\tstrXml += ' </c:txPr>'\n\t\tif (opts.dataLabelPosition) strXml += ' <c:dLblPos val=\"' + opts.dataLabelPosition + '\"/>'\n\t\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\t\tstrXml += ' <c:showVal val=\"' + (opts.showValue ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showCatName val=\"0\"/>'\n\t\tstrXml += ' <c:showSerName val=\"' + (opts.showSerName ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showPercent val=\"0\"/>'\n\t\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\t\tstrXml += ' </c:dLbls>'\n\t}\n\n\t// 4: Add axis Id (NOTE: order matters! - category comes first)\n\tstrXml += `<c:axId val=\"${catAxisId}\"/><c:axId val=\"${valAxisId}\"/>`\n\n\t// 5: Close Chart tag\n\tstrXml += '</c:' + chartType + 'Chart>'\n\treturn strXml\n}\n","/**\n * ts-pptx: Bubble Plot Assembly\n *\n * Emits the `<c:bubbleChart>` plot element for `bubble` and `bubble3D`. Like scatter it\n * takes X values from the first data row, and adds a third `<c:bubbleSize>` cache per\n * series. Reached through {@link ./chart-xml}'s `makeChartType` dispatch.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { BARCHART_COLORS, DEF_FONT_COLOR, DEF_FONT_SIZE, DEF_SHAPE_SHADOW } from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { createShadowEffectLst } from '../drawingml/effect.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { resolveBorderWidth } from '../drawingml/line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { FIXED_PCT_PER_PERCENT, ptToHundredths } from '../../units.js'\nimport { dataSizes, dataValues, sheetCellRef, sheetRangeRef } from './data-refs.js'\nimport { el, voidEl } from '../oxml/el.js'\nimport { createChartTextFonts, numCachePt } from './chart-parts.js'\n\n/**\n * Plot a bubble / bubble3d chart into `<c:bubbleChart>` (X/Y plus per-point size).\n */\nexport function makeBubblePlot(\n\tchartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string,\n\tvalFmtCode: string\n): string {\n\tlet colorIndex = -1 // Maintain the color index by region\n\tlet idxColLtr = 1\n\tlet strXml = ''\n\t/*\n\t\t\t\t`data` = [\n\t\t\t\t\t{ name:'X-Axis', values:[1,2,3,4,5,6,7,8,9,10,11,12] },\n\t\t\t\t\t{ name:'Y-Values 1', values:[13, 20, 21, 25], sizes:[10, 5, 20, 15] },\n\t\t\t\t\t{ name:'Y-Values 2', values:[ 1, 2, 5, 9], sizes:[ 5, 3, 9, 3] }\n\t\t\t\t];\n */\n\n\t// 1: Start Chart\n\tstrXml += '<c:bubbleChart>'\n\tstrXml += '<c:varyColors val=\"0\"/>'\n\n\t// 2: Series: (One for each Y-Axis)\n\tcolorIndex = -1\n\tdata\n\t\t.filter((_obj, idx) => idx > 0)\n\t\t.forEach((obj, idx) => {\n\t\t\tcolorIndex++\n\t\t\tstrXml += '<c:ser>'\n\t\t\tstrXml += ` <c:idx val=\"${idx}\"/>`\n\t\t\tstrXml += ` <c:order val=\"${idx}\"/>`\n\n\t\t\t// A: `<c:tx>`\n\t\t\tstrXml += ' <c:tx>'\n\t\t\tstrXml += ' <c:strRef>'\n\t\t\tstrXml += ` <c:f>${sheetCellRef(idxColLtr + 1, 1)}</c:f>`\n\t\t\tstrXml +=\n\t\t\t\t' <c:strCache><c:ptCount val=\"1\"/><c:pt idx=\"0\">' +\n\t\t\t\tel('c:v', null, obj.name ?? '') +\n\t\t\t\t'</c:pt></c:strCache>'\n\t\t\tstrXml += ' </c:strRef>'\n\t\t\tstrXml += ' </c:tx>'\n\n\t\t\t// B: '<c:spPr>': Fill, Border, Line, LineStyle (dash, etc.), Shadow\n\t\t\t{\n\t\t\t\tstrXml += '<c:spPr>'\n\n\t\t\t\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\t\t\t\tconst tmpSerColor = chartColors[colorIndex % chartColors.length] ?? '000000'\n\n\t\t\t\tif (tmpSerColor === 'transparent') {\n\t\t\t\t\tstrXml += '<a:noFill/>'\n\t\t\t\t} else if (opts.chartColorsOpacity) {\n\t\t\t\t\tstrXml += `<a:solidFill>${createColorElement(tmpSerColor, '<a:alpha val=\"' + Math.round(opts.chartColorsOpacity * FIXED_PCT_PER_PERCENT).toString() + '\"/>')}</a:solidFill>`\n\t\t\t\t} else {\n\t\t\t\t\tstrXml += genXmlColorSelection(tmpSerColor)\n\t\t\t\t}\n\n\t\t\t\tif (opts.lineSize === 0) {\n\t\t\t\t\tstrXml += '<a:ln><a:noFill/></a:ln>'\n\t\t\t\t} else if (opts.dataBorder) {\n\t\t\t\t\tstrXml += `<a:ln w=\"${valToPts(resolveBorderWidth(opts.dataBorder, 0.75))}\" cap=\"flat\">${genXmlColorSelection({ color: opts.dataBorder.color ?? '363636', transparency: opts.dataBorder.transparency })}<a:prstDash val=\"solid\"/><a:round/></a:ln>`\n\t\t\t\t} else {\n\t\t\t\t\tstrXml += `<a:ln w=\"${valToPts(opts.lineSize ?? 2)}\" cap=\"flat\">${genXmlColorSelection(tmpSerColor)}`\n\t\t\t\t\tstrXml +=\n\t\t\t\t\t\tvoidEl('a:prstDash', { val: opts.lineDashValues?.[colorIndex] ?? opts.lineDash ?? 'solid' }) +\n\t\t\t\t\t\tvoidEl('a:round') +\n\t\t\t\t\t\t'</a:ln>'\n\t\t\t\t}\n\n\t\t\t\t// Shadow\n\t\t\t\tstrXml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\n\t\t\t\tstrXml += '</c:spPr>'\n\t\t\t}\n\n\t\t\t// C: '<c:dLbls>' \"Data Labels\"\n\t\t\t// Let it be defaulted for now\n\n\t\t\t// D: '<c:xVal>'/'<c:yVal>' \"Values\": Scatter Chart has 2: `xVal` and `yVal`\n\t\t\t{\n\t\t\t\t// X-Axis is always the same\n\t\t\t\tstrXml += '<c:xVal>'\n\t\t\t\tstrXml += ' <c:numRef>'\n\t\t\t\tstrXml += ` <c:f>Sheet1!$A$2:$A$${dataValues(data[0]).length + 1}</c:f>`\n\t\t\t\tstrXml += ' <c:numCache>'\n\t\t\t\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\t\t\t\tstrXml += ` <c:ptCount val=\"${dataValues(data[0]).length}\"/>`\n\t\t\t\tdataValues(data[0]).forEach((value, idx) => {\n\t\t\t\t\tstrXml += numCachePt(idx, value)\n\t\t\t\t})\n\t\t\t\tstrXml += ' </c:numCache>'\n\t\t\t\tstrXml += ' </c:numRef>'\n\t\t\t\tstrXml += '</c:xVal>'\n\n\t\t\t\t// Y-Axis vals are this object's `values`\n\t\t\t\tstrXml += '<c:yVal>'\n\t\t\t\tstrXml += ' <c:numRef>'\n\t\t\t\tstrXml += `<c:f>${sheetRangeRef(idxColLtr + 1, 2, idxColLtr + 1, dataValues(data[0]).length + 1)}</c:f>`\n\t\t\t\tidxColLtr++\n\t\t\t\tstrXml += ' <c:numCache>'\n\t\t\t\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\t\t\t\t// NOTE: Use pt count and iterate over data[0] (X-Axis) as user can have more values than data (eg: timeline where only first few months are populated)\n\t\t\t\tstrXml += ` <c:ptCount val=\"${dataValues(data[0]).length}\"/>`\n\t\t\t\tdataValues(data[0]).forEach((_value, idx) => {\n\t\t\t\t\tstrXml += numCachePt(idx, dataValues(obj)[idx])\n\t\t\t\t})\n\t\t\t\tstrXml += ' </c:numCache>'\n\t\t\t\tstrXml += ' </c:numRef>'\n\t\t\t\tstrXml += '</c:yVal>'\n\t\t\t}\n\n\t\t\t// E: '<c:bubbleSize>'\n\t\t\tstrXml += ' <c:bubbleSize>'\n\t\t\tstrXml += ' <c:numRef>'\n\t\t\tstrXml += `<c:f>${sheetRangeRef(idxColLtr + 1, 2, idxColLtr + 1, dataSizes(obj).length + 1)}</c:f>`\n\t\t\tidxColLtr++\n\t\t\tstrXml += ' <c:numCache>'\n\t\t\tstrXml += ' <c:formatCode>General</c:formatCode>'\n\t\t\tstrXml += ` <c:ptCount val=\"${dataSizes(obj).length}\"/>`\n\t\t\tdataSizes(obj).forEach((value, idx) => {\n\t\t\t\tstrXml += numCachePt(idx, value)\n\t\t\t})\n\t\t\tstrXml += ' </c:numCache>'\n\t\t\tstrXml += ' </c:numRef>'\n\t\t\tstrXml += ' </c:bubbleSize>'\n\t\t\tstrXml += ' <c:bubble3D val=\"' + (chartType === ChartType.bubble3d ? '1' : '0') + '\"/>'\n\n\t\t\t// F: Close \"SERIES\"\n\t\t\tstrXml += '</c:ser>'\n\t\t})\n\n\t// 3: Data Labels\n\t{\n\t\tstrXml += '<c:dLbls>'\n\t\tstrXml += voidEl('c:numFmt', { formatCode: (opts.dataLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\t\tstrXml += '<c:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr>'\n\t\tstrXml += `<a:defRPr b=\"${opts.dataLabelFontBold ? 1 : 0}\" i=\"${opts.dataLabelFontItalic ? 1 : 0}\" strike=\"noStrike\" sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" u=\"none\">`\n\t\tstrXml += genXmlColorSelection(opts.dataLabelColor || DEF_FONT_COLOR)\n\t\tstrXml += createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\tstrXml += '</a:defRPr></a:pPr></a:p></c:txPr>'\n\t\tif (opts.dataLabelPosition) strXml += voidEl('c:dLblPos', { val: opts.dataLabelPosition })\n\t\tstrXml += '<c:showLegendKey val=\"0\"/>'\n\t\tstrXml += `<c:showVal val=\"${opts.showValue ? '1' : '0'}\"/>`\n\t\tstrXml += `<c:showCatName val=\"0\"/><c:showSerName val=\"${opts.showSerName ? '1' : '0'}\"/><c:showPercent val=\"0\"/><c:showBubbleSize val=\"${opts.showBubbleSize ? '1' : '0'}\"/>`\n\t\tstrXml += '<c:extLst>'\n\t\tstrXml +=\n\t\t\t' <c:ext uri=\"{CE6537A1-D6FC-4f65-9D91-7224C49458BB}\" xmlns:c15=\"http://schemas.microsoft.com/office/drawing/2012/chart\">'\n\t\tstrXml += ' <c15:showLeaderLines val=\"' + (opts.showLeaderLines ? '1' : '0') + '\"/>'\n\t\tstrXml += ' </c:ext>'\n\t\tstrXml += '</c:extLst>'\n\t\tstrXml += '</c:dLbls>'\n\t}\n\n\t// 4: Bubble options\n\t// `<c:bubbleScale>` / `<c:showNegBubbles>` are intentionally omitted so PowerPoint\n\t// applies its own defaults; no library option exposes them yet.\n\n\t// 5: AxisId (NOTE: order matters! (category comes first))\n\tstrXml += `<c:axId val=\"${catAxisId}\"/><c:axId val=\"${valAxisId}\"/>`\n\n\t// 6: Close Chart tag\n\tstrXml += '</c:bubbleChart>'\n\treturn strXml\n}\n","/**\n * ts-pptx: Pie & Doughnut Plot Assembly\n *\n * Emits the `<c:pieChart>` / `<c:doughnutChart>` plot elements. These are the only\n * families with no axes at all -- a single series, one `<c:dPt>` per slice carrying its\n * own fill, and optional leader lines -- so the builder takes no axis ids. Reached\n * through {@link ./chart-xml}'s `makeChartType` dispatch.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { BARCHART_COLORS, DEF_FONT_COLOR, DEF_FONT_SIZE, DEF_SHAPE_SHADOW } from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { encodeXmlEntities } from '../utils.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { createShadowEffectLst } from '../drawingml/effect.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { resolveBorderWidth } from '../drawingml/line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { ptToHundredths } from '../../units.js'\nimport { dataValues, firstLabelGroup } from './data-refs.js'\nimport { el, voidEl } from '../oxml/el.js'\nimport { createChartBorderLine, createChartTextFonts, createLeaderLinesElement } from './chart-parts.js'\n\n/**\n * Plot a single-series pie / doughnut chart into `<c:pieChart>` / `<c:doughnutChart>`.\n */\nexport function makePiePlot(\n\tchartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalFmtCode: string\n): string {\n\tlet optsChartData: OptsChartDataInternal\n\tlet strXml = ''\n\t// Use the same let name so code blocks from barChart are interchangeable\n\t{\n\t\tconst first = data[0]\n\t\tif (!first) return strXml\n\t\toptsChartData = first\n\t}\n\n\t/* EX:\n\t\t\t\tdata: [\n\t\t\t\t {\n\t\t\t\t name: 'Project Status',\n\t\t\t\t labels: ['Red', 'Amber', 'Green', 'Unknown'],\n\t\t\t\t values: [10, 20, 38, 2]\n\t\t\t\t }\n\t\t\t\t]\n */\n\n\t// 1: Start Chart\n\tstrXml += '<c:' + chartType + 'Chart>'\n\tstrXml += ' <c:varyColors val=\"1\"/>'\n\tstrXml += '<c:ser>'\n\tstrXml += ' <c:idx val=\"0\"/>'\n\tstrXml += ' <c:order val=\"0\"/>'\n\tstrXml += ' <c:tx>'\n\tstrXml += ' <c:strRef>'\n\tstrXml += ' <c:f>Sheet1!$B$1</c:f>'\n\tstrXml += ' <c:strCache>'\n\tstrXml += ' <c:ptCount val=\"1\"/>'\n\tstrXml += ' <c:pt idx=\"0\">' + el('c:v', null, optsChartData.name ?? '') + '</c:pt>'\n\tstrXml += ' </c:strCache>'\n\tstrXml += ' </c:strRef>'\n\tstrXml += ' </c:tx>'\n\tstrXml += ' <c:spPr>'\n\tstrXml += ' <a:solidFill><a:schemeClr val=\"accent1\"/></a:solidFill>'\n\tstrXml +=\n\t\t' <a:ln w=\"9525\" cap=\"flat\"><a:solidFill><a:srgbClr val=\"F9F9F9\"/></a:solidFill><a:prstDash val=\"solid\"/><a:round/></a:ln>'\n\tif (opts.dataNoEffects) {\n\t\tstrXml += '<a:effectLst/>'\n\t} else {\n\t\tstrXml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\t}\n\tstrXml += ' </c:spPr>'\n\n\t// 2: \"Data Point\" block for every data row\n\tfirstLabelGroup(optsChartData).forEach((_label, idx) => {\n\t\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\t\tconst ptStyle = optsChartData.pointStyles?.[idx]\n\t\tstrXml += '<c:dPt>'\n\t\tstrXml += ` <c:idx val=\"${idx}\"/>`\n\t\tstrXml += ' <c:bubble3D val=\"0\"/>'\n\t\tstrXml += ' <c:spPr>'\n\t\tstrXml += `<a:solidFill>${createColorElement(\n\t\t\tptStyle?.fill ||\n\t\t\t\t(chartColors[idx + 1 > chartColors.length ? Math.floor(Math.random() * chartColors.length) : idx] ?? '000000')\n\t\t)}</a:solidFill>`\n\t\t// Per-point border override takes precedence over chart-level `dataBorder`\n\t\tif (ptStyle?.border) {\n\t\t\tstrXml += createChartBorderLine(ptStyle.border)\n\t\t} else if (opts.dataBorder) {\n\t\t\tstrXml += `<a:ln w=\"${valToPts(resolveBorderWidth(opts.dataBorder, 0.75))}\" cap=\"flat\">${genXmlColorSelection({\n\t\t\t\tcolor: opts.dataBorder.color ?? '363636',\n\t\t\t\ttransparency: opts.dataBorder.transparency,\n\t\t\t})}<a:prstDash val=\"solid\"/><a:round/></a:ln>`\n\t\t}\n\t\tstrXml += createShadowEffectLst(opts.shadow, DEF_SHAPE_SHADOW)\n\t\tstrXml += ' </c:spPr>'\n\t\tstrXml += '</c:dPt>'\n\t})\n\n\t// 3: \"Data Label\" block for every data Label\n\tstrXml += '<c:dLbls>'\n\tfirstLabelGroup(optsChartData).forEach((_label, idx) => {\n\t\tconst customLbl = optsChartData.customLabels?.[idx]\n\t\tstrXml += '<c:dLbl>'\n\t\tstrXml += ` <c:idx val=\"${idx}\"/>`\n\t\t// c:tx must precede c:numFmt per CT_DLbl / Group_DLbl / EG_DLblShared schema order\n\t\tif (customLbl) {\n\t\t\tstrXml +=\n\t\t\t\t'<c:tx><c:rich><a:bodyPr/><a:lstStyle/><a:p><a:r>' +\n\t\t\t\t`<a:rPr lang=\"${encodeXmlEntities(opts.lang || 'en-US')}\" dirty=\"0\"/>` +\n\t\t\t\tel('a:t', null, customLbl) +\n\t\t\t\t'</a:r></a:p></c:rich></c:tx>'\n\t\t}\n\t\tstrXml += ' ' + voidEl('c:numFmt', { formatCode: (opts.dataLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\t\tstrXml += ' <c:spPr/><c:txPr>'\n\t\tstrXml += ' <a:bodyPr/><a:lstStyle/>'\n\t\tstrXml += ' <a:p><a:pPr>'\n\t\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.dataLabelFontBold ? 1 : 0}\" i=\"${\n\t\t\topts.dataLabelFontItalic ? 1 : 0\n\t\t}\" u=\"none\" strike=\"noStrike\">`\n\t\tstrXml += genXmlColorSelection(opts.dataLabelColor || DEF_FONT_COLOR)\n\t\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\t\tstrXml += ' </a:defRPr>'\n\t\tstrXml += ' </a:pPr></a:p>'\n\t\tstrXml += ' </c:txPr>'\n\t\tif (chartType === ChartType.pie && opts.dataLabelPosition)\n\t\t\tstrXml += voidEl('c:dLblPos', { val: opts.dataLabelPosition })\n\t\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\t\tstrXml += ' <c:showVal val=\"' + (customLbl ? '0' : opts.showValue ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showCatName val=\"' + (opts.showLabel ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showSerName val=\"' + (opts.showSerName ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showPercent val=\"' + (opts.showPercent ? '1' : '0') + '\"/>'\n\t\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\t\tstrXml += ' </c:dLbl>'\n\t})\n\tstrXml += ' ' + voidEl('c:numFmt', { formatCode: (opts.dataLabelFormatCode ?? '') || 'General', sourceLinked: 0 })\n\tstrXml += ' <c:txPr>'\n\tstrXml += ' <a:bodyPr/>'\n\tstrXml += ' <a:lstStyle/>'\n\tstrXml += ' <a:p>'\n\tstrXml += ' <a:pPr>'\n\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(opts.dataLabelFontSize || DEF_FONT_SIZE)}\" b=\"${opts.dataLabelFontBold ? '1' : '0'}\" i=\"${opts.dataLabelFontItalic ? '1' : '0'}\" u=\"none\" strike=\"noStrike\">`\n\tstrXml += genXmlColorSelection(opts.dataLabelColor || DEF_FONT_COLOR)\n\tstrXml += ' ' + createChartTextFonts(opts.dataLabelFontFace || 'Arial')\n\tstrXml += ' </a:defRPr>'\n\tstrXml += ' </a:pPr>'\n\tstrXml += ' </a:p>'\n\tstrXml += ' </c:txPr>'\n\tstrXml += chartType === ChartType.pie ? voidEl('c:dLblPos', { val: opts.dataLabelPosition || 'ctr' }) : ''\n\tstrXml += ' <c:showLegendKey val=\"0\"/>'\n\tstrXml += ' <c:showVal val=\"0\"/>'\n\tstrXml += ' <c:showCatName val=\"1\"/>'\n\tstrXml += ' <c:showSerName val=\"0\"/>'\n\tstrXml += ' <c:showPercent val=\"1\"/>'\n\tstrXml += ' <c:showBubbleSize val=\"0\"/>'\n\tstrXml += ` <c:showLeaderLines val=\"${opts.showLeaderLines ? '1' : '0'}\"/>`\n\tstrXml += createLeaderLinesElement(opts)\n\tstrXml += '</c:dLbls>'\n\n\t// 2: \"Categories\"\n\tstrXml += '<c:cat>'\n\tstrXml += ' <c:strRef>'\n\tstrXml += ` <c:f>Sheet1!$A$2:$A$${firstLabelGroup(optsChartData).length + 1}</c:f>`\n\tstrXml += ' <c:strCache>'\n\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(optsChartData).length}\"/>`\n\tfirstLabelGroup(optsChartData).forEach((label, idx) => {\n\t\tstrXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`\n\t})\n\tstrXml += ' </c:strCache>'\n\tstrXml += ' </c:strRef>'\n\tstrXml += '</c:cat>'\n\n\t// 3: Create vals\n\tstrXml += ' <c:val>'\n\tstrXml += ' <c:numRef>'\n\tstrXml += ` <c:f>Sheet1!$B$2:$B$${firstLabelGroup(optsChartData).length + 1}</c:f>`\n\tstrXml += ' <c:numCache>'\n\tstrXml += ' <c:formatCode>' + valFmtCode + '</c:formatCode>'\n\tstrXml += ` <c:ptCount val=\"${firstLabelGroup(optsChartData).length}\"/>`\n\tdataValues(optsChartData).forEach((value, idx) => {\n\t\tstrXml += `<c:pt idx=\"${idx}\"><c:v>${value || value === 0 ? value : ''}</c:v></c:pt>`\n\t})\n\tstrXml += ' </c:numCache>'\n\tstrXml += ' </c:numRef>'\n\tstrXml += ' </c:val>'\n\n\t// 4: Close \"SERIES\"\n\tstrXml += ' </c:ser>'\n\tstrXml += ` <c:firstSliceAng val=\"${opts.firstSliceAng ? Math.round(opts.firstSliceAng) : 0}\"/>`\n\tif (chartType === ChartType.doughnut)\n\t\tstrXml += `<c:holeSize val=\"${typeof opts.holeSize === 'number' ? opts.holeSize : '50'}\"/>`\n\tstrXml += '</c:' + chartType + 'Chart>'\n\treturn strXml\n}\n\n/**\n * Create Category axis\n * @param {ChartOptsInternal} opts - chart options\n * @param {string} axisId - value\n * @param {string} valAxisId - value\n * @return {string} XML\n */\n","/**\n * ts-pptx: Stock (High-Low-Close) Plot Assembly\n *\n * Emits the classic `<c:stockChart>` element (plus, for the volume styles, a leading\n * `<c:barChart>` volume series on a secondary axis pair). A stock chart is a fixed-order\n * multi-series line chart drawn with invisible lines: `<c:hiLowLines>` connect the\n * high/low of each category, and the open-high-low-close styles add `<c:upDownBars>`.\n * Reached through {@link ./chart-xml}'s `makeChartType` dispatch; its axes are built by\n * the stock branch of `makeChartAxesXml` (which reuses {@link ./chart-axes}).\n */\n\nimport { ChartType } from '../../enums.js'\nimport {\n\tAXIS_ID_CATEGORY_PRIMARY,\n\tAXIS_ID_CATEGORY_SECONDARY,\n\tAXIS_ID_VALUE_PRIMARY,\n\tAXIS_ID_VALUE_SECONDARY,\n\tBARCHART_COLORS,\n} from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { dataLabels, dataValues, firstLabelGroup, sheetCellRef, sheetRangeRef } from './data-refs.js'\nimport { el } from '../oxml/el.js'\nimport { numCachePt } from './chart-parts.js'\n\ntype StockStyle = 'hlc' | 'ohlc' | 'vhlc' | 'vohlc'\n\n/**\n * Per-style stock chart geometry: how many value series the style expects, whether the first\n * series is a Volume column drawn as a bar (on its own axis pair), and whether the open-close\n * `<c:upDownBars>` are drawn. HLC/VHLC are three-value (no open) and instead mark the close\n * with a dot; OHLC/VOHLC are four-value and use up/down bars for the open-close body.\n */\nconst STOCK_STYLE_SPEC: Record<StockStyle, { seriesCount: number; volume: boolean; upDownBars: boolean }> = {\n\thlc: { seriesCount: 3, volume: false, upDownBars: false },\n\tohlc: { seriesCount: 4, volume: false, upDownBars: true },\n\tvhlc: { seriesCount: 4, volume: true, upDownBars: false },\n\tvohlc: { seriesCount: 5, volume: true, upDownBars: true },\n}\n\n/** True when the given (already-normalized) stock style leads with a Volume bar series. */\nexport const isVolumeStockStyle = (style: StockStyle | undefined): boolean => !!style && STOCK_STYLE_SPEC[style].volume\n\n/** Minimal `<c:dLbls>` block (all labels off) shared by the stock and volume-bar subcharts. */\nconst STOCK_DLBLS =\n\t'<c:dLbls><c:showLegendKey val=\"0\"/><c:showVal val=\"0\"/><c:showCatName val=\"0\"/><c:showSerName val=\"0\"/><c:showPercent val=\"0\"/><c:showBubbleSize val=\"0\"/></c:dLbls>'\n\n/** Emit the shared `<c:cat>` + `<c:val>` refs for a stock/volume series (single-level categories). */\nfunction stockCatVal(obj: OptsChartDataInternal, opts: ChartOptsInternal, valFmtCode: string): string {\n\tconst cats = firstLabelGroup(obj)\n\tconst valColRow = obj._dataIndex + dataLabels(obj).length + 1\n\tlet strXml = '<c:cat>'\n\tif (opts.catLabelFormatCode) {\n\t\t// Numeric categories (dates): a `numRef` carrying the source format so PPT renders them as dates.\n\t\tstrXml += '<c:numRef>'\n\t\tstrXml += `<c:f>Sheet1!$A$2:$A$${cats.length + 1}</c:f>`\n\t\tstrXml += '<c:numCache>'\n\t\tstrXml += `<c:formatCode>${opts.catLabelFormatCode || 'General'}</c:formatCode>`\n\t\tstrXml += `<c:ptCount val=\"${cats.length}\"/>`\n\t\tcats.forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\t\tstrXml += '</c:numCache></c:numRef>'\n\t} else {\n\t\tstrXml += '<c:strRef>'\n\t\tstrXml += `<c:f>Sheet1!$A$2:$A$${cats.length + 1}</c:f>`\n\t\tstrXml += '<c:strCache>'\n\t\tstrXml += `<c:ptCount val=\"${cats.length}\"/>`\n\t\tcats.forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\t\tstrXml += '</c:strCache></c:strRef>'\n\t}\n\tstrXml += '</c:cat>'\n\n\tstrXml += '<c:val><c:numRef>'\n\tstrXml += `<c:f>${sheetRangeRef(valColRow, 2, valColRow, cats.length + 1)}</c:f>`\n\tstrXml += '<c:numCache>'\n\tstrXml += `<c:formatCode>${valFmtCode}</c:formatCode>`\n\tstrXml += `<c:ptCount val=\"${cats.length}\"/>`\n\tdataValues(obj).forEach((value, idx) => (strXml += numCachePt(idx, value)))\n\tstrXml += '</c:numCache></c:numRef></c:val>'\n\treturn strXml\n}\n\n/** Emit the `<c:tx>` series-name reference for a stock/volume series. */\nfunction stockSeriesName(obj: OptsChartDataInternal): string {\n\tconst nameCol = obj._dataIndex + dataLabels(obj).length + 1\n\treturn (\n\t\t'<c:tx><c:strRef>' +\n\t\t`<c:f>${sheetCellRef(nameCol, 1)}</c:f>` +\n\t\t'<c:strCache><c:ptCount val=\"1\"/><c:pt idx=\"0\">' +\n\t\tel('c:v', null, obj.name ?? '') +\n\t\t'</c:pt></c:strCache></c:strRef></c:tx>'\n\t)\n}\n\n/** Emit a single stock (line) series: invisible line, optional close-marker, cat/val refs. */\nfunction makeStockLineSer(\n\tobj: OptsChartDataInternal,\n\topts: ChartOptsInternal,\n\tvalFmtCode: string,\n\tmarkCloseColor: string | null\n): string {\n\tlet strXml = '<c:ser>'\n\tstrXml += `<c:idx val=\"${obj._dataIndex}\"/><c:order val=\"${obj._dataIndex}\"/>`\n\tstrXml += stockSeriesName(obj)\n\t// Stock series draw no line themselves (the hi-low lines / up-down bars carry the visual).\n\tstrXml += '<c:spPr><a:ln w=\"19050\" cap=\"rnd\"><a:noFill/><a:round/></a:ln><a:effectLst/></c:spPr>'\n\tif (markCloseColor) {\n\t\tstrXml +=\n\t\t\t'<c:marker><c:symbol val=\"dot\"/><c:size val=\"5\"/><c:spPr>' +\n\t\t\tgenXmlColorSelection(markCloseColor) +\n\t\t\t`<a:ln w=\"9525\">${genXmlColorSelection(markCloseColor)}</a:ln><a:effectLst/></c:spPr></c:marker>`\n\t} else {\n\t\tstrXml += '<c:marker><c:symbol val=\"none\"/></c:marker>'\n\t}\n\tstrXml += stockCatVal(obj, opts, valFmtCode)\n\tstrXml += '<c:smooth val=\"0\"/>'\n\tstrXml += '</c:ser>'\n\treturn strXml\n}\n\n/**\n * Plot a stock chart. For `vhlc`/`vohlc` the first data series is a Volume column drawn as a\n * `<c:barChart>` on the primary axis pair, with the remaining high/low/close(/open) series in a\n * `<c:stockChart>` on the secondary axis pair; the non-volume styles draw only the stock chart on\n * the primary pair. `valAxisId`/`catAxisId` are the primary ids passed by the dispatch.\n */\nexport function makeStockPlot(\n\t_chartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string,\n\tvalFmtCode: string\n): string {\n\tconst spec = STOCK_STYLE_SPEC[(opts.stockStyle as StockStyle) || 'hlc']\n\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\tconst volumeSeries = spec.volume ? data[0] : null\n\tconst stockSeries = spec.volume ? data.slice(1) : data\n\tlet strXml = ''\n\n\t// VOLUME: a bar series on the PRIMARY axis pair (drawn behind the price series).\n\tif (volumeSeries) {\n\t\tstrXml += '<c:barChart>'\n\t\tstrXml += '<c:barDir val=\"col\"/><c:grouping val=\"clustered\"/><c:varyColors val=\"0\"/>'\n\t\tstrXml += '<c:ser>'\n\t\tstrXml += `<c:idx val=\"${volumeSeries._dataIndex}\"/><c:order val=\"${volumeSeries._dataIndex}\"/>`\n\t\tstrXml += stockSeriesName(volumeSeries)\n\t\tstrXml += `<c:spPr>${genXmlColorSelection(chartColors[0] ?? '4472C4')}</c:spPr>`\n\t\tstrXml += '<c:invertIfNegative val=\"0\"/>'\n\t\tstrXml += stockCatVal(volumeSeries, opts, valFmtCode)\n\t\tstrXml += '</c:ser>'\n\t\tstrXml += STOCK_DLBLS\n\t\tstrXml += '<c:gapWidth val=\"150\"/>'\n\t\tstrXml += `<c:axId val=\"${AXIS_ID_CATEGORY_PRIMARY}\"/><c:axId val=\"${AXIS_ID_VALUE_PRIMARY}\"/>`\n\t\tstrXml += '</c:barChart>'\n\t}\n\n\t// STOCK: the price series drawn with invisible lines + hi-low lines (+ up-down bars for OHLC).\n\tstrXml += '<c:stockChart>'\n\tstockSeries.forEach((obj, idx) => {\n\t\t// HLC/VHLC (no up-down bars) mark the final \"close\" series with a dot so it reads on the chart.\n\t\tconst isClose = !spec.upDownBars && idx === stockSeries.length - 1\n\t\tconst markColor = isClose ? (chartColors[obj._dataIndex % chartColors.length] ?? 'ED7D31') : null\n\t\tstrXml += makeStockLineSer(obj, opts, valFmtCode, markColor)\n\t})\n\tstrXml += STOCK_DLBLS\n\tstrXml +=\n\t\t'<c:hiLowLines><c:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"75000\"/><a:lumOff val=\"25000\"/></a:schemeClr></a:solidFill><a:round/></a:ln><a:effectLst/></c:spPr></c:hiLowLines>'\n\tif (spec.upDownBars) {\n\t\tstrXml +=\n\t\t\t'<c:upDownBars><c:gapWidth val=\"150\"/>' +\n\t\t\t'<c:upBars><c:spPr><a:solidFill><a:schemeClr val=\"bg1\"/></a:solidFill><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill><a:round/></a:ln><a:effectLst/></c:spPr></c:upBars>' +\n\t\t\t'<c:downBars><c:spPr><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill><a:round/></a:ln><a:effectLst/></c:spPr></c:downBars>' +\n\t\t\t'</c:upDownBars>'\n\t}\n\t// Volume styles put the price series on the SECONDARY axis pair (the bar owns the primary pair).\n\tconst stockCatId = spec.volume ? AXIS_ID_CATEGORY_SECONDARY : catAxisId\n\tconst stockValId = spec.volume ? AXIS_ID_VALUE_SECONDARY : valAxisId\n\tstrXml += `<c:axId val=\"${stockCatId}\"/><c:axId val=\"${stockValId}\"/>`\n\tstrXml += '</c:stockChart>'\n\n\treturn strXml\n}\n","/**\n * ts-pptx: Surface Plot Assembly\n *\n * Emits the classic `<c:surface3DChart>` (a 3-D surface) or `<c:surfaceChart>` (a 2-D\n * contour / top view), selected by the `surface3D` option; `wireframe` toggles the\n * mesh-only look. A surface chart interpolates a colored sheet over the category (X) and\n * series (Z) axes with the value as height (Y), so — like `bar3D` — it needs all three\n * axes and a `<c:view3D>` + floor/side/back walls (emitted by the surface branch of\n * `makeChartHeaderXml`). Reached through {@link ./chart-xml}'s `makeChartType` dispatch.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { AXIS_ID_SERIES_PRIMARY, BARCHART_COLORS } from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal } from '../../types/internal.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { dataLabels, dataValues, firstLabelGroup, sheetCellRef, sheetRangeRef } from './data-refs.js'\nimport { el } from '../oxml/el.js'\nimport { numCachePt } from './chart-parts.js'\n\n/** True when the (normalized) surface options select the 3-D surface rather than a 2-D contour. */\nconst isSurface3D = (opts: ChartOptsInternal): boolean => opts.surface3D !== false\n\n/** Emit the shared `<c:cat>` (strRef) + `<c:val>` (numRef) refs for a surface series. */\nfunction surfaceCatVal(obj: OptsChartDataInternal, valFmtCode: string): string {\n\tconst cats = firstLabelGroup(obj)\n\tconst valCol = obj._dataIndex + dataLabels(obj).length + 1\n\tlet strXml = '<c:cat><c:strRef>'\n\tstrXml += `<c:f>Sheet1!$A$2:$A$${cats.length + 1}</c:f>`\n\tstrXml += `<c:strCache><c:ptCount val=\"${cats.length}\"/>`\n\tcats.forEach((label, idx) => (strXml += `<c:pt idx=\"${idx}\">${el('c:v', null, label)}</c:pt>`))\n\tstrXml += '</c:strCache></c:strRef></c:cat>'\n\n\tstrXml += '<c:val><c:numRef>'\n\tstrXml += `<c:f>${sheetRangeRef(valCol, 2, valCol, cats.length + 1)}</c:f>`\n\tstrXml += `<c:numCache><c:formatCode>${valFmtCode}</c:formatCode><c:ptCount val=\"${cats.length}\"/>`\n\tdataValues(obj).forEach((value, idx) => (strXml += numCachePt(idx, value)))\n\tstrXml += '</c:numCache></c:numRef></c:val>'\n\treturn strXml\n}\n\n/** Emit a single surface series: name ref, 3-D shape props, and cat/val refs. */\nfunction makeSurfaceSer(obj: OptsChartDataInternal, valFmtCode: string, seriesColor: string): string {\n\tconst nameCol = obj._dataIndex + dataLabels(obj).length + 1\n\tlet strXml = '<c:ser>'\n\tstrXml += `<c:idx val=\"${obj._dataIndex}\"/><c:order val=\"${obj._dataIndex}\"/>`\n\tstrXml +=\n\t\t'<c:tx><c:strRef>' +\n\t\t`<c:f>${sheetCellRef(nameCol, 1)}</c:f>` +\n\t\t'<c:strCache><c:ptCount val=\"1\"/><c:pt idx=\"0\">' +\n\t\tel('c:v', null, obj.name ?? '') +\n\t\t'</c:pt></c:strCache></c:strRef></c:tx>'\n\t// A surface series carries 3-D shape props; the surface itself is colored by value band, but the\n\t// per-series fill still styles the wireframe / legend key.\n\tstrXml += `<c:spPr>${genXmlColorSelection(seriesColor)}<a:ln/><a:effectLst/><a:sp3d/></c:spPr>`\n\tstrXml += surfaceCatVal(obj, valFmtCode)\n\tstrXml += '</c:ser>'\n\treturn strXml\n}\n\n/**\n * Plot a surface chart into a `<c:surface3DChart>` (3-D) or `<c:surfaceChart>` (2-D contour). Every\n * series shares the category axis; the series axis (Z) is the third axis. `valAxisId`/`catAxisId`\n * are the primary ids passed by the dispatch; the series axis uses `AXIS_ID_SERIES_PRIMARY`.\n */\nexport function makeSurfacePlot(\n\t_chartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string,\n\tvalFmtCode: string\n): string {\n\tconst tag = isSurface3D(opts) ? 'surface3DChart' : 'surfaceChart'\n\tconst chartColors = opts.chartColors?.length ? opts.chartColors : BARCHART_COLORS\n\tlet strXml = `<c:${tag}>`\n\tstrXml += `<c:wireframe val=\"${opts.surfaceWireframe ? 1 : 0}\"/>`\n\tdata.forEach((obj, idx) => {\n\t\tstrXml += makeSurfaceSer(obj, valFmtCode, chartColors[idx % chartColors.length] ?? '4472C4')\n\t})\n\t// Surface, value and series axes (category X, value Y/height, series Z).\n\tstrXml += `<c:axId val=\"${catAxisId}\"/><c:axId val=\"${valAxisId}\"/><c:axId val=\"${AXIS_ID_SERIES_PRIMARY}\"/>`\n\tstrXml += `</c:${tag}>`\n\treturn strXml\n}\n\n/**\n * Build the `<c:view3D>` + floor/side/back walls for a surface chart. A 3-D surface tilts the scene\n * (using the shared `v3DRotX`/`v3DRotY` options, which the define layer defaults to 30); a 2-D\n * contour looks straight down the value axis (rotX 90, flat perspective). These precede\n * `<c:plotArea>` in CT_Chart document order (view3D → floor → sideWall → backWall → plotArea).\n */\nexport function makeSurfaceScene(opts: ChartOptsInternal): string {\n\tconst wall = '<c:thickness val=\"0\"/><c:spPr><a:noFill/><a:ln><a:noFill/></a:ln><a:effectLst/><a:sp3d/></c:spPr>'\n\tlet strXml = '<c:view3D>'\n\tif (isSurface3D(opts)) {\n\t\tstrXml += `<c:rotX val=\"${opts.v3DRotX}\"/><c:rotY val=\"${opts.v3DRotY}\"/><c:rAngAx val=\"0\"/>`\n\t} else {\n\t\t// Contour / top view: look straight down the value axis, flat perspective.\n\t\tstrXml += '<c:rotX val=\"90\"/><c:rotY val=\"0\"/><c:rAngAx val=\"0\"/><c:perspective val=\"0\"/>'\n\t}\n\tstrXml += '</c:view3D>'\n\tstrXml += `<c:floor>${wall}</c:floor><c:sideWall>${wall}</c:sideWall><c:backWall>${wall}</c:backWall>`\n\treturn strXml\n}\n","/**\n * ts-pptx: Chart DrawingML Assembly\n *\n * Builds a chart's `ppt/charts/chartN.xml` -- the `<c:chartSpace>` DrawingML that\n * PowerPoint renders. `makeXmlCharts` assembles the top-level envelope (header, plot\n * area, axes region, legend, metadata) and `makeChartType` dispatches the plot itself to\n * the per-family builder: {@link ./plot-cat-axis} for area/bar/bar3D/line/radar,\n * {@link ./plot-scatter}, {@link ./plot-bubble}, {@link ./plot-pie}. Axes come from\n * {@link ./chart-axes} and the shared leaf fragments from {@link ./chart-parts}.\n *\n * Every function in this directory is a pure string builder -- no I/O, no mutation of\n * the presentation model. The `<c:f>` series formulas here point back at the cells\n * written by the embedded workbook ({@link ./embed-xlsx}); that mapping lives in\n * {@link ./data-refs}.\n */\n\nimport { asChartType, ChartType } from '../../enums.js'\nimport {\n\tAXIS_ID_CATEGORY_PRIMARY,\n\tAXIS_ID_CATEGORY_SECONDARY,\n\tAXIS_ID_SERIES_PRIMARY,\n\tAXIS_ID_VALUE_PRIMARY,\n\tAXIS_ID_VALUE_SECONDARY,\n\tDEF_FONT_SIZE,\n\tDEF_FONT_TITLE_SIZE,\n\tXML_DECL,\n} from '../../constants-internal.js'\nimport type { ChartOptsInternal, OptsChartDataInternal, SlideRelChart } from '../../types/internal.js'\nimport type { ShapeFillProps } from '../../types/index.js'\nimport { warn } from '../../diagnostics.js'\nimport { encodeXmlEntities } from '../utils.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { resolveBorderWidth } from '../drawingml/line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { ptToHundredths } from '../../units.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { createChartTextFonts, genXmlTitle } from './chart-parts.js'\nimport { makeCatAxis, makeSerAxis, makeValAxis } from './chart-axes.js'\nimport { makeCatAxisPlot } from './plot-cat-axis.js'\nimport { makeScatterPlot } from './plot-scatter.js'\nimport { makeBubblePlot } from './plot-bubble.js'\nimport { makePiePlot } from './plot-pie.js'\nimport { isVolumeStockStyle, makeStockPlot } from './plot-stock.js'\nimport { makeSurfacePlot, makeSurfaceScene } from './plot-surface.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/**\n * Whether a chart-area/plot-area `fill` says anything the fill dispatch can act on.\n *\n * `c:spPr` is `a:CT_ShapeProperties` — the same optional `EG_FillProperties` group the\n * shape path writes into — so gradient, pattern and an omitted fill child are all legal\n * here. The gate used to be `fill?.color`, which meant every spelling carrying no colour\n * (`gradient`, `pattern`, `image`, `inherit`) fell to the no-fill arm and did nothing.\n *\n * The gate cannot simply be `fill != null`. `normalizeChartOptions` defaults\n * `plotArea.fill` to `{}`, so every chart in existence arrives here with a fill object,\n * and a presence check would paint each one a default grey. The same is true of the one\n * input a caller can write by hand: `{ transparency: 50 }` alone is not a fill, since\n * there is no colour for the alpha to apply to. Both stay no-fill.\n *\n * A payload with no `type` (`{ gradient }`, `{ pattern }`) is likewise not stated, which\n * matches the shape path: only `line` infers its type from a bare `gradient`, fills have\n * always wanted `type: 'gradient'` spelled out.\n */\nfunction isStatedFill(fill?: ShapeFillProps): fill is ShapeFillProps {\n\treturn Boolean(fill?.color || fill?.type)\n}\n\n/**\n * Build the chartSpace/chart header: chartSpace open, title (or autoTitleDeleted),\n * optional 3D view, and the plotArea open with optional manual layout.\n */\nfunction makeChartHeaderXml(rel: SlideRelChart): string {\n\tconst chartArea = rel.opts.chartArea ?? {}\n\tlet strXml = ''\n\t// CHARTSPACE: BEGIN vvv\n\tstrXml +=\n\t\t'<c:chartSpace xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">'\n\tstrXml += voidEl('c:date1904', { val: 0 }) // ppt defaults to 1904 dates, excel to 1900\n\tstrXml += voidEl('c:roundedCorners', { val: chartArea.roundedCorners ? 1 : 0 })\n\tstrXml += '<c:chart>'\n\n\t// OPTION: Title\n\tif (rel.opts.showTitle) {\n\t\tstrXml += genXmlTitle(\n\t\t\t{\n\t\t\t\ttitle: rel.opts.title || 'Chart Title',\n\t\t\t\tcolor: rel.opts.titleColor,\n\t\t\t\tfontFace: rel.opts.titleFontFace,\n\t\t\t\tfontSize: rel.opts.titleFontSize || DEF_FONT_TITLE_SIZE,\n\t\t\t\ttitleAlign: rel.opts.titleAlign,\n\t\t\t\ttitleBold: rel.opts.titleBold,\n\t\t\t\ttitleItalic: rel.opts.titleItalic,\n\t\t\t\ttitleUnderline: rel.opts.titleUnderline,\n\t\t\t\ttitlePos: rel.opts.titlePos,\n\t\t\t\ttitleRotate: rel.opts.titleRotate,\n\t\t\t},\n\t\t\trel.opts.x as number,\n\t\t\trel.opts.y as number\n\t\t)\n\t\tstrXml += voidEl('c:autoTitleDeleted', { val: 0 })\n\t} else {\n\t\t// NOTE: Add autoTitleDeleted tag in else to prevent default creation of chart title even when showTitle is set to false\n\t\tstrXml += voidEl('c:autoTitleDeleted', { val: 1 })\n\t}\n\t/** Add 3D view tag\n\t * @see: https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_perspective_topic_ID0E6BUQB.html\n\t */\n\tif (rel.opts._type === ChartType.bar3d) {\n\t\tstrXml += el('c:view3D', null, [\n\t\t\traw(voidEl('c:rotX', { val: rel.opts.v3DRotX })),\n\t\t\traw(voidEl('c:rotY', { val: rel.opts.v3DRotY })),\n\t\t\traw(voidEl('c:rAngAx', { val: !rel.opts.v3DRAngAx ? 0 : 1 })),\n\t\t\traw(voidEl('c:perspective', { val: rel.opts.v3DPerspective })),\n\t\t])\n\t} else if (rel.opts._type === ChartType.surface) {\n\t\t// A surface chart is a 3-D scene: view3D + floor/side/back walls precede the plotArea.\n\t\tstrXml += makeSurfaceScene(rel.opts)\n\t}\n\n\tstrXml += '<c:plotArea>'\n\t// IMPORTANT: Dont specify layout to enable auto-fit: PPT does a great job maximizing space with all 4 TRBL locations\n\tif (rel.opts.layout) {\n\t\tconst manualLayout = el(\n\t\t\t'c:manualLayout',\n\t\t\tnull,\n\t\t\t[\n\t\t\t\traw(voidEl('c:layoutTarget', { val: 'inner' }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:xMode', { val: 'edge' }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:yMode', { val: 'edge' }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:x', { val: rel.opts.layout.x || 0 }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:y', { val: rel.opts.layout.y || 0 }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:w', { val: rel.opts.layout.w || 1 }, { closePrefix: ' ' })),\n\t\t\t\traw(voidEl('c:h', { val: rel.opts.layout.h || 1 }, { closePrefix: ' ' })),\n\t\t\t],\n\t\t\t{ childPrefix: ' ', closePrefix: ' ' }\n\t\t)\n\t\tstrXml += el('c:layout', null, raw(manualLayout), { childPrefix: ' ' })\n\t} else {\n\t\tstrXml += voidEl('c:layout')\n\t}\n\treturn strXml\n}\n\n/**\n * Build the category/value/series axis XML (empty for pie/doughnut). Resolves combo-chart\n * category axes to val axes when owned by a scatter/bubble subchart, per the tracked flags.\n */\nfunction makeChartAxesXml(\n\trel: SlideRelChart,\n\tusesSecondaryValAxis: boolean,\n\tusesSecondaryCatAxis: boolean,\n\tprimaryCatAxisValType: ChartType | null,\n\tsecondaryCatAxisValType: ChartType | null,\n\tprimaryCatAxisHasCategoryChart: boolean,\n\tsecondaryCatAxisHasCategoryChart: boolean\n): string {\n\tlet strXml = ''\n\t// Stock charts drive their own (date/category)+value axis pair. The non-volume styles use just\n\t// the primary pair (the generic path below would also produce it), but the volume styles add a\n\t// secondary pair for the price series (the volume bar owns the primary pair) — so route all stock\n\t// axes here, reusing the shared cat/val emitters. `barDir` defaults to 'col' in the define layer,\n\t// which already gives the correct axis positions (category at bottom, value at left).\n\tif (rel.opts._type === ChartType.stock) {\n\t\tlet stockXml = makeCatAxis(rel.opts, AXIS_ID_CATEGORY_PRIMARY, AXIS_ID_VALUE_PRIMARY)\n\t\tstockXml += makeValAxis(rel.opts, AXIS_ID_VALUE_PRIMARY)\n\t\tif (isVolumeStockStyle(rel.opts.stockStyle)) {\n\t\t\t// Secondary value axis (right) for the price series, then a hidden secondary category axis.\n\t\t\tstockXml += makeValAxis(rel.opts, AXIS_ID_VALUE_SECONDARY)\n\t\t\tstockXml += makeCatAxis({ ...rel.opts, catAxisHidden: true }, AXIS_ID_CATEGORY_SECONDARY, AXIS_ID_VALUE_SECONDARY)\n\t\t}\n\t\treturn stockXml\n\t}\n\tif (rel.opts._type !== ChartType.pie && rel.opts._type !== ChartType.doughnut) {\n\t\t// Param check\n\t\tif (rel.opts.valAxes && rel.opts.valAxes.length > 1 && !usesSecondaryValAxis) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'chart/secondary-axis-unused',\n\t\t\t\t'Secondary axis must be used by one of the multiple charts'\n\t\t\t)\n\t\t}\n\n\t\t// Resolve the effective `_type` for a combo category axis so scatter/bubble\n\t\t// subcharts get a `<c:valAx>` X axis. Returns the scatter/bubble type when\n\t\t// that axis is owned only by such a subchart, else null (category axis).\n\t\tconst comboCatAxisType = (isSecondary: boolean): { _type: ChartType } | Record<string, never> => {\n\t\t\tconst valType = isSecondary ? secondaryCatAxisValType : primaryCatAxisValType\n\t\t\tconst hasCategoryChart = isSecondary ? secondaryCatAxisHasCategoryChart : primaryCatAxisHasCategoryChart\n\t\t\tif (!valType) return {}\n\t\t\tif (hasCategoryChart) {\n\t\t\t\t// A category-based chart and a scatter/bubble chart cannot share one\n\t\t\t\t// axis (one needs <c:catAx>, the other <c:valAx>). Keep the category\n\t\t\t\t// axis and warn rather than silently emit a repair-triggering file.\n\t\t\t\twarn(\n\t\t\t\t\t'chart/axis-type-conflict',\n\t\t\t\t\t`A category-based chart and a scatter/bubble chart cannot share the same ${isSecondary ? 'secondary' : 'primary'} category axis; emitting a category axis. Put the scatter/bubble series on a separate axis.`\n\t\t\t\t)\n\t\t\t\treturn {}\n\t\t\t}\n\t\t\treturn { _type: valType }\n\t\t}\n\n\t\tif (rel.opts.catAxes) {\n\t\t\tif (!rel.opts.valAxes || rel.opts.valAxes.length !== rel.opts.catAxes.length) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'chart/axis-count-mismatch',\n\t\t\t\t\t'There must be the same number of value and category axes.'\n\t\t\t\t)\n\t\t\t}\n\t\t\tstrXml += makeCatAxis(\n\t\t\t\t{ ...rel.opts, ...rel.opts.catAxes[0], ...comboCatAxisType(false) },\n\t\t\t\tAXIS_ID_CATEGORY_PRIMARY,\n\t\t\t\tAXIS_ID_VALUE_PRIMARY\n\t\t\t)\n\t\t} else {\n\t\t\tstrXml += makeCatAxis(\n\t\t\t\t{ ...rel.opts, ...comboCatAxisType(false) },\n\t\t\t\tAXIS_ID_CATEGORY_PRIMARY,\n\t\t\t\tAXIS_ID_VALUE_PRIMARY\n\t\t\t)\n\t\t}\n\n\t\tif (rel.opts.valAxes) {\n\t\t\tstrXml += makeValAxis({ ...rel.opts, ...rel.opts.valAxes[0] }, AXIS_ID_VALUE_PRIMARY)\n\t\t\tif (rel.opts.valAxes[1]) {\n\t\t\t\tstrXml += makeValAxis({ ...rel.opts, ...rel.opts.valAxes[1] }, AXIS_ID_VALUE_SECONDARY)\n\t\t\t}\n\t\t} else {\n\t\t\tstrXml += makeValAxis(rel.opts, AXIS_ID_VALUE_PRIMARY)\n\n\t\t\t// Add series axis for 3D bar and surface (both plot over a category × series grid)\n\t\t\tif (rel.opts._type === ChartType.bar3d || rel.opts._type === ChartType.surface) {\n\t\t\t\tstrXml += makeSerAxis(rel.opts, AXIS_ID_SERIES_PRIMARY, AXIS_ID_VALUE_PRIMARY)\n\t\t\t}\n\n\t\t\t// For combo charts referencing a secondary value axis via the\n\t\t\t// `secondaryValAxis: true` flag (without a `valAxes` array),\n\t\t\t// auto-synthesise the missing secondary value axis def so that\n\t\t\t// the axId references in <c:plotArea> all resolve.\n\t\t\tif (usesSecondaryValAxis) {\n\t\t\t\tstrXml += makeValAxis(rel.opts, AXIS_ID_VALUE_SECONDARY)\n\t\t\t}\n\t\t}\n\n\t\t// Combo Charts: Add secondary axes after all vals\n\t\tif (rel.opts?.catAxes && rel.opts?.catAxes[1]) {\n\t\t\tstrXml += makeCatAxis(\n\t\t\t\t{ ...rel.opts, ...rel.opts.catAxes[1], ...comboCatAxisType(true) },\n\t\t\t\tAXIS_ID_CATEGORY_SECONDARY,\n\t\t\t\tAXIS_ID_VALUE_SECONDARY\n\t\t\t)\n\t\t} else if (usesSecondaryCatAxis && (!rel.opts.catAxes || !rel.opts.catAxes[1])) {\n\t\t\t// Same as above for the secondary category axis.\n\t\t\tstrXml += makeCatAxis(\n\t\t\t\t{ ...rel.opts, ...comboCatAxisType(true) },\n\t\t\t\tAXIS_ID_CATEGORY_SECONDARY,\n\t\t\t\tAXIS_ID_VALUE_SECONDARY\n\t\t\t)\n\t\t}\n\t}\n\treturn strXml\n}\n\n/**\n * Build the plotArea properties (data table, fill, border), close plotArea, then the legend.\n */\nfunction makeChartPlotAreaPropsXml(rel: SlideRelChart): string {\n\tconst plotArea = rel.opts.plotArea ?? {}\n\tlet strXml = ''\n\t// NOTE: DataTable goes between '</c:valAx>' and '<c:spPr>'\n\tif (rel.opts.showDataTable) {\n\t\tstrXml += '<c:dTable>'\n\t\tstrXml += ` <c:showHorzBorder val=\"${!rel.opts.showDataTableHorzBorder ? 0 : 1}\"/>`\n\t\tstrXml += ` <c:showVertBorder val=\"${!rel.opts.showDataTableVertBorder ? 0 : 1}\"/>`\n\t\tstrXml += ` <c:showOutline val=\"${!rel.opts.showDataTableOutline ? 0 : 1}\"/>`\n\t\tstrXml += ` <c:showKeys val=\"${!rel.opts.showDataTableKeys ? 0 : 1}\"/>`\n\t\tstrXml += ' <c:spPr>'\n\t\tstrXml += ' <a:noFill/>'\n\t\tstrXml +=\n\t\t\t' <a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln>'\n\t\tstrXml += ' <a:effectLst/>'\n\t\tstrXml += ' </c:spPr>'\n\t\tstrXml += ' <c:txPr>'\n\t\tstrXml +=\n\t\t\t' <a:bodyPr rot=\"0\" spcFirstLastPara=\"1\" vertOverflow=\"ellipsis\" vert=\"horz\" wrap=\"square\" anchor=\"ctr\" anchorCtr=\"1\"/>'\n\t\tstrXml += ' <a:lstStyle/>'\n\t\tstrXml += ' <a:p>'\n\t\tstrXml += ' <a:pPr rtl=\"0\">'\n\t\tstrXml += ` <a:defRPr sz=\"${ptToHundredths(rel.opts.dataTableFontSize || DEF_FONT_SIZE)}\" b=\"0\" i=\"0\" u=\"none\" strike=\"noStrike\" kern=\"1200\" baseline=\"0\">`\n\t\tstrXml +=\n\t\t\t' <a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill>'\n\t\tstrXml += ' <a:latin typeface=\"+mn-lt\"/>'\n\t\tstrXml += ' <a:ea typeface=\"+mn-ea\"/>'\n\t\tstrXml += ' <a:cs typeface=\"+mn-cs\"/>'\n\t\tstrXml += ' </a:defRPr>'\n\t\tstrXml += ' </a:pPr>'\n\t\tstrXml += ' <a:endParaRPr lang=\"en-US\"/>'\n\t\tstrXml += ' </a:p>'\n\t\tstrXml += ' </c:txPr>'\n\t\tstrXml += '</c:dTable>'\n\t}\n\n\tstrXml += ' <c:spPr>'\n\n\t// OPTION: Fill\n\tstrXml += isStatedFill(plotArea.fill) ? genXmlColorSelection(plotArea.fill) : '<a:noFill/>'\n\n\t// OPTION: Border\n\tstrXml += plotArea.border\n\t\t? `<a:ln w=\"${valToPts(resolveBorderWidth(plotArea.border, 1))}\" cap=\"flat\">${genXmlColorSelection({ color: plotArea.border.color ?? '363636', transparency: plotArea.border.transparency })}</a:ln>`\n\t\t: '<a:ln><a:noFill/></a:ln>'\n\n\t// Close shapeProp/plotArea before Legend\n\tstrXml += ' <a:effectLst/>'\n\tstrXml += ' </c:spPr>'\n\tstrXml += '</c:plotArea>'\n\n\t// OPTION: Legend\n\t// IMPORTANT: Dont specify layout to enable auto-fit: PPT does a great job maximizing space with all 4 TRBL locations\n\tif (rel.opts.showLegend) {\n\t\tstrXml += '<c:legend>'\n\t\tstrXml += '<c:legendPos val=\"' + rel.opts.legendPos + '\"/>'\n\t\t// For combo charts: suppress series from subcharts that set showLegend: false\n\t\tif (Array.isArray(rel.opts._type)) {\n\t\t\tlet seriesIdx = 0\n\t\t\trel.opts._type.forEach((type) => {\n\t\t\t\tif (type.options?.showLegend === false) {\n\t\t\t\t\tfor (let i = 0; i < type.data.length; i++) {\n\t\t\t\t\t\tstrXml += `<c:legendEntry><c:idx val=\"${seriesIdx + i}\"/><c:delete val=\"1\"/></c:legendEntry>`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tseriesIdx += type.data.length\n\t\t\t})\n\t\t}\n\t\t// OPTION: Manual legend placement\n\t\t// Each axis of CT_ManualLayout is independent: omitting xMode/x (or\n\t\t// yMode/y, etc.) leaves that axis on automatic layout. x/y use edge\n\t\t// mode so they are absolute fractions of the chart; w/h are fractions\n\t\t// of the chart size. Schema order: xMode, yMode, x, y, w, h.\n\t\tconst legendLayout = rel.opts.legendLayout\n\t\tconst hasLegendX = legendLayout && typeof legendLayout.x === 'number'\n\t\tconst hasLegendY = legendLayout && typeof legendLayout.y === 'number'\n\t\tconst hasLegendW = legendLayout && typeof legendLayout.w === 'number'\n\t\tconst hasLegendH = legendLayout && typeof legendLayout.h === 'number'\n\t\tif (hasLegendX || hasLegendY || hasLegendW || hasLegendH) {\n\t\t\tlet modes = ''\n\t\t\tlet vals = ''\n\t\t\tif (hasLegendX) {\n\t\t\t\tmodes += '<c:xMode val=\"edge\"/>'\n\t\t\t\tvals += `<c:x val=\"${legendLayout.x}\"/>`\n\t\t\t}\n\t\t\tif (hasLegendY) {\n\t\t\t\tmodes += '<c:yMode val=\"edge\"/>'\n\t\t\t\tvals += `<c:y val=\"${legendLayout.y}\"/>`\n\t\t\t}\n\t\t\tif (hasLegendW) vals += `<c:w val=\"${legendLayout.w}\"/>`\n\t\t\tif (hasLegendH) vals += `<c:h val=\"${legendLayout.h}\"/>`\n\t\t\tstrXml += `<c:layout><c:manualLayout>${modes}${vals}</c:manualLayout></c:layout>`\n\t\t}\n\t\tstrXml += '<c:overlay val=\"0\"/>'\n\t\tif (rel.opts.legendFontFace || rel.opts.legendFontSize || rel.opts.legendColor) {\n\t\t\tstrXml += '<c:txPr>'\n\t\t\tstrXml += ' <a:bodyPr/>'\n\t\t\tstrXml += ' <a:lstStyle/>'\n\t\t\tstrXml += ' <a:p>'\n\t\t\tstrXml += ' <a:pPr>'\n\t\t\tstrXml += rel.opts.legendFontSize\n\t\t\t\t? `<a:defRPr sz=\"${ptToHundredths(Number(rel.opts.legendFontSize))}\">`\n\t\t\t\t: '<a:defRPr>'\n\t\t\tif (rel.opts.legendColor) strXml += genXmlColorSelection(rel.opts.legendColor)\n\t\t\tif (rel.opts.legendFontFace) strXml += createChartTextFonts(rel.opts.legendFontFace)\n\t\t\tstrXml += ' </a:defRPr>'\n\t\t\tstrXml += ' </a:pPr>'\n\t\t\tstrXml += ' <a:endParaRPr lang=\"en-US\"/>'\n\t\t\tstrXml += ' </a:p>'\n\t\t\tstrXml += '</c:txPr>'\n\t\t}\n\t\tstrXml += '</c:legend>'\n\t}\n\treturn strXml\n}\n\n/**\n * Main entry point method for create charts\n * @see: http://www.datypic.com/sc/ooxml/s-dml-chart.xsd.html\n * @param {SlideRelChart} rel - chart object\n * @return {string} XML\n */\nexport function makeXmlCharts(rel: SlideRelChart): string {\n\tlet strXml = XML_DECL\n\t// `chartArea`/`plotArea` are always populated by addChartDefinition() but stay optional on the type.\n\tconst chartArea = rel.opts.chartArea ?? {}\n\tlet usesSecondaryValAxis = false\n\tlet usesSecondaryCatAxis = false\n\t// Combo charts: a scatter/bubble subchart draws numbers on its category (X)\n\t// axis, so that axis must be emitted as a `<c:valAx>` rather than a `<c:catAx>`\n\t// or PowerPoint flags the file for repair. Track, per category axis,\n\t// the scatter/bubble subchart type that owns it (if any) and whether a\n\t// category-based subchart also references it (an unsatisfiable conflict).\n\tlet primaryCatAxisValType: ChartType | null = null\n\tlet secondaryCatAxisValType: ChartType | null = null\n\tlet primaryCatAxisHasCategoryChart = false\n\tlet secondaryCatAxisHasCategoryChart = false\n\n\t// STEP 1: Create chart\n\tstrXml += makeChartHeaderXml(rel)\n\n\t// STEP 2: Create chart-type XML (plot each subchart's series/points)\n\tif (Array.isArray(rel.opts._type)) {\n\t\trel.opts._type.forEach((type) => {\n\t\t\tconst options = { ...rel.opts, ...type.options }\n\t\t\tconst valAxisId = options.secondaryValAxis ? AXIS_ID_VALUE_SECONDARY : AXIS_ID_VALUE_PRIMARY\n\t\t\tconst catAxisId = options.secondaryCatAxis ? AXIS_ID_CATEGORY_SECONDARY : AXIS_ID_CATEGORY_PRIMARY\n\t\t\tusesSecondaryValAxis = usesSecondaryValAxis || (options.secondaryValAxis ?? false)\n\t\t\tusesSecondaryCatAxis = usesSecondaryCatAxis || (options.secondaryCatAxis ?? false)\n\t\t\tconst subType = asChartType(type.type)\n\t\t\t// Record whether this subchart needs a value-based X axis (scatter/bubble)\n\t\t\t// or a category-based X axis, keyed to the primary/secondary cat axis it uses.\n\t\t\tconst usesValueXAxis =\n\t\t\t\tsubType === ChartType.scatter || subType === ChartType.bubble || subType === ChartType.bubble3d\n\t\t\tif (options.secondaryCatAxis) {\n\t\t\t\tif (usesValueXAxis) secondaryCatAxisValType = subType\n\t\t\t\telse secondaryCatAxisHasCategoryChart = true\n\t\t\t} else {\n\t\t\t\tif (usesValueXAxis) primaryCatAxisValType = subType\n\t\t\t\telse primaryCatAxisHasCategoryChart = true\n\t\t\t}\n\t\t\tstrXml += makeChartType(subType, type.data as OptsChartDataInternal[], options, valAxisId, catAxisId)\n\t\t})\n\t} else if (rel.opts._type) {\n\t\tstrXml += makeChartType(rel.opts._type, rel.data, rel.opts, AXIS_ID_VALUE_PRIMARY, AXIS_ID_CATEGORY_PRIMARY)\n\t}\n\n\t// STEP 3: Axes\n\tstrXml += makeChartAxesXml(\n\t\trel,\n\t\tusesSecondaryValAxis,\n\t\tusesSecondaryCatAxis,\n\t\tprimaryCatAxisValType,\n\t\tsecondaryCatAxisValType,\n\t\tprimaryCatAxisHasCategoryChart,\n\t\tsecondaryCatAxisHasCategoryChart\n\t)\n\n\t// STEP 4: Chart properties and plotArea options: border, data table, fill, legend\n\tstrXml += makeChartPlotAreaPropsXml(rel)\n\n\tstrXml += ' <c:plotVisOnly val=\"1\"/>'\n\tstrXml += ' <c:dispBlanksAs val=\"' + rel.opts.displayBlanksAs + '\"/>'\n\tif (rel.opts._type === ChartType.scatter) strXml += '<c:showDLblsOverMax val=\"1\"/>'\n\n\tstrXml += '</c:chart>'\n\n\t// STEP 5: chartSpace shape props\n\tstrXml += '<c:spPr>'\n\tstrXml += isStatedFill(chartArea.fill) ? genXmlColorSelection(chartArea.fill) : '<a:noFill/>'\n\tstrXml += chartArea.border\n\t\t? `<a:ln w=\"${valToPts(resolveBorderWidth(chartArea.border, 1))}\" cap=\"flat\">${genXmlColorSelection({ color: chartArea.border.color ?? '363636', transparency: chartArea.border.transparency })}</a:ln>`\n\t\t: '<a:ln><a:noFill/></a:ln>'\n\tstrXml += ' <a:effectLst/>'\n\tstrXml += '</c:spPr>'\n\n\t// STEP 6: Data (add relId)\n\tstrXml += '<c:externalData r:id=\"rId1\"><c:autoUpdate val=\"0\"/></c:externalData>'\n\n\t// STEP 7: Metadata (custom chart-level annotations via the schema-valid extension list)\n\t// CT_ChartSpace document order: externalData → printSettings → userShapes → extLst (extLst LAST).\n\tstrXml += genXmlChartMetadata(rel.opts.metadata)\n\n\t// LAST: chartSpace end\n\tstrXml += '</c:chartSpace>'\n\n\treturn strXml\n}\n\n/**\n * Stable ts-pptx vendor GUID identifying the chart-metadata extension on `c:chartSpace/c:extLst`.\n * Custom data rides under this URI in a foreign namespace so PowerPoint preserves it (the extLst\n * mechanism) instead of stripping/repairing it as it would an unrecognised sibling element.\n */\nconst CHART_METADATA_EXT_URI = '{094A432E-1F6C-499B-95B8-B57DC9536949}'\n\n/** Foreign namespace for the chart-metadata extension payload. */\nconst CHART_METADATA_NS = 'http://ts-pptx.com/schema/chart/metadata'\n\n/**\n * Create the chart-space extension-list XML carrying custom `metadata` key/value annotations.\n * Emits nothing when metadata is absent or contains no valid entries. Keys must be non-empty\n * strings and values must be strings; invalid entries are dropped with a warning rather than\n * emitting degenerate XML (per the \"no silent coercion\" policy).\n * @param {Record<string, string>} [metadata] custom chart-level metadata\n * @return {string} `<c:extLst>…</c:extLst>` XML, or '' when there is nothing valid to emit\n */\nfunction genXmlChartMetadata(metadata?: Record<string, string>): string {\n\tif (metadata == null) return ''\n\tif (typeof metadata !== 'object' || Array.isArray(metadata)) {\n\t\twarn('chart/invalid-metadata', 'chart `metadata` must be a plain object of string key/value pairs; ignored.')\n\t\treturn ''\n\t}\n\n\tlet items = ''\n\tfor (const [key, value] of Object.entries(metadata)) {\n\t\tif (typeof key !== 'string' || key.length === 0) {\n\t\t\twarn(\n\t\t\t\t'chart/invalid-metadata-key',\n\t\t\t\t`chart metadata key \"${String(key)}\" is not a non-empty string; entry skipped.`\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tif (typeof value !== 'string') {\n\t\t\twarn('chart/invalid-metadata-value', `chart metadata value for key \"${key}\" is not a string; entry skipped.`)\n\t\t\tcontinue\n\t\t}\n\t\titems += voidEl('pgm:item', { key, value })\n\t}\n\tif (items === '') return ''\n\n\treturn el(\n\t\t'c:extLst',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'c:ext',\n\t\t\t\t{ uri: CHART_METADATA_EXT_URI },\n\t\t\t\traw(el('pgm:metadata', { 'xmlns:pgm': CHART_METADATA_NS }, raw(items)))\n\t\t\t)\n\t\t)\n\t)\n}\n\n/**\n * Create XML string for any given chart type.\n * Dispatches to a per-family plot helper; resolves the effective value number format first.\n * @param {ChartType} chartType chart type name\n * @param {OptsChartDataInternal[]} data chart data\n * @param {ChartOptsInternal} opts chart options\n * @param {string} valAxisId chart val axis id\n * @param {string} catAxisId chart cat axis id\n * @example 'bubble' returns <c:bubbleChart></c>\n * @example '<c:lineChart>'\n * @return {string} XML chart\n */\n\nfunction makeChartType(\n\tchartType: ChartType,\n\tdata: OptsChartDataInternal[],\n\topts: ChartOptsInternal,\n\tvalAxisId: string,\n\tcatAxisId: string\n): string {\n\t// NOTE: \"Chart Range\" (as shown in \"select Chart Area dialog\") is calculated.\n\t// ....: Ensure each X/Y Axis/Col has same row height (esp. applicable to XY Scatter where X can often be larger than Y's)\n\t//\n\t// PowerPoint and Google Slides render values using the cached *source* number format carried in\n\t// each series' `<c:numCache><c:formatCode>` (mirroring the embedded workbook cell format), NOT the\n\t// `<c:dLbls><c:numFmt>` mask — so when the value cache is left as \"General\" those engines display\n\t// raw values (e.g. `0.1` instead of `10%`) even though LibreOffice honors the dLbls mask. Resolve a\n\t// single effective value format and stamp it onto every value cache below so all three engines agree.\n\t// Precedence keeps the historical `valLabelFormatCode` winner,\n\t// then the data-table format, and finally falls back to `dataLabelFormatCode` (the most common knob).\n\tconst valFmtCode = encodeXmlEntities(\n\t\topts.valLabelFormatCode || opts.dataTableFormatCode || opts.dataLabelFormatCode || 'General'\n\t)\n\n\tswitch (chartType) {\n\t\tcase ChartType.area:\n\t\tcase ChartType.bar:\n\t\tcase ChartType.bar3d:\n\t\tcase ChartType.line:\n\t\tcase ChartType.radar:\n\t\t\treturn makeCatAxisPlot(chartType, data, opts, valAxisId, catAxisId, valFmtCode)\n\t\tcase ChartType.scatter:\n\t\t\treturn makeScatterPlot(chartType, data, opts, valAxisId, catAxisId, valFmtCode)\n\t\tcase ChartType.bubble:\n\t\tcase ChartType.bubble3d:\n\t\t\treturn makeBubblePlot(chartType, data, opts, valAxisId, catAxisId, valFmtCode)\n\t\tcase ChartType.stock:\n\t\t\treturn makeStockPlot(chartType, data, opts, valAxisId, catAxisId, valFmtCode)\n\t\tcase ChartType.surface:\n\t\t\treturn makeSurfacePlot(chartType, data, opts, valAxisId, catAxisId, valFmtCode)\n\t\tcase ChartType.doughnut:\n\t\tcase ChartType.pie:\n\t\t\treturn makePiePlot(chartType, data, opts, valFmtCode)\n\t\tdefault:\n\t\t\treturn ''\n\t}\n}\n","/**\n * ts-pptx: chartEx (`cx:`) Chart-Data Builder\n *\n * Builds the `<cx:chartData>` block of a chartEx chart part (waterfall, and the other\n * Office-2016 layouts as they land). This is the chartEx analogue of the `<c:cat>`/`<c:val>`\n * caches on the classic side: it names the embedded-workbook cells via `<cx:f>` formulas and\n * mirrors their values into `<cx:lvl>` string/number caches so PowerPoint can render without\n * opening the workbook. The category label levels occupy the leading columns (0 of them for a\n * category-less histogram, 1 for a flat chart, N for a hierarchical treemap/sunburst) and the one\n * value series sits in the next column — so the references here line up 1:1 with the workbook\n * written by {@link ./embed-xlsx}.\n */\n\nimport { ChartType } from '../../enums.js'\nimport type { SlideRelChart } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { dataLabels, dataValues, firstLabelGroup, sheetCellRef, sheetRangeRef } from './data-refs.js'\n\n/**\n * The numeric-dimension tag PowerPoint expects varies by layout. The flat layouts (waterfall,\n * funnel, histogram, pareto, boxWhisker) use `type=\"val\"`; the hierarchical treemap/sunburst use\n * `type=\"size\"`; a `regionMap` uses `type=\"colorVal\"` (the value drives each region's fill color).\n * The value always comes from the series' `values`; only the dimension tag differs.\n */\nfunction valueDimType(type: ChartType): 'size' | 'val' | 'colorVal' {\n\tif (type === ChartType.treemap || type === ChartType.sunburst) return 'size'\n\tif (type === ChartType.regionMap) return 'colorVal'\n\treturn 'val'\n}\n\n/**\n * Build the `<cx:chartData>` for a single-series chartEx chart.\n *\n * `<cx:data id=\"0\">` carries a `<cx:strDim type=\"cat\">` (category labels) and a numeric dimension\n * (`type=\"val\"` for flat layouts, `type=\"size\"` for the hierarchical treemap/sunburst);\n * `<cx:externalData r:id=\"rId1\">` points at the embedded workbook (same `rId1` the chart part's\n * `.rels` maps to the `.xlsx`).\n *\n * Category labels are `string[][]` — one inner array per hierarchy level (leaf first). A flat chart\n * has a single level; treemap/sunburst carry several. Each level becomes one `<cx:lvl>`, emitted\n * leaf-first to match PowerPoint. The workbook ({@link ./embed-xlsx}) lays the levels out in\n * columns A..N (outermost in A, leaf in the last label column) with the value series in the next\n * column; the single `<cx:f>` range on each dimension spans exactly those columns.\n * @param {SlideRelChart} rel - the registered chart\n * @return {string} `<cx:chartData>…</cx:chartData>` XML\n */\nexport function makeChartExData(rel: SlideRelChart): string {\n\tconst series = rel.data[0]\n\tconst type = rel.opts._type as ChartType\n\tconst levels = dataLabels(series)\n\tconst totLvl = levels.length // 0 for a category-less layout (histogram), 1 flat, N hierarchical\n\tconst vals = dataValues(series)\n\t// Row span is driven by whichever dimension has more points; the workbook writes both to the same rows.\n\tconst ptCount = Math.max(firstLabelGroup(series).length, vals.length)\n\tconst lastRow = ptCount + 1\n\tconst valueCol = totLvl + 1 // value series sits in the column right after all label columns\n\n\t// Category (string) dimension — one <cx:lvl> per hierarchy level, leaf-first, over columns A..totLvl.\n\t// A category-less layout (histogram bins raw observations itself) emits no strDim at all.\n\tlet catDim = ''\n\tif (totLvl > 0) {\n\t\tconst catLvls = levels\n\t\t\t.map((group) => {\n\t\t\t\tconst pts = group.map((label, idx) => el('cx:pt', { idx }, label ?? '')).join('')\n\t\t\t\treturn el('cx:lvl', { ptCount: group.length }, raw(pts))\n\t\t\t})\n\t\t\t.join('')\n\t\tcatDim = el('cx:strDim', { type: 'cat' }, [\n\t\t\traw(el('cx:f', null, sheetRangeRef(1, 2, totLvl, lastRow))),\n\t\t\traw(catLvls),\n\t\t])\n\t}\n\n\t// Numeric dimension — the value column. Skip null/non-finite points (a valid sparse cache);\n\t// warn on non-finite, matching the classic side's `numCachePt` policy.\n\tlet valPts = ''\n\tvals.forEach((value, idx) => {\n\t\tif (value == null) return\n\t\tif (!Number.isFinite(value)) {\n\t\t\twarn(\n\t\t\t\t'chart/non-finite-value',\n\t\t\t\t`chartEx value \"${value}\" at index ${idx} is not a finite number; data point omitted.`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tvalPts += el('cx:pt', { idx }, value)\n\t})\n\tconst valDim = el('cx:numDim', { type: valueDimType(type) }, [\n\t\traw(el('cx:f', null, sheetRangeRef(valueCol, 2, valueCol, lastRow))),\n\t\traw(el('cx:lvl', { ptCount, formatCode: 'General' }, raw(valPts))),\n\t])\n\n\tconst data = el('cx:data', { id: 0 }, [raw(catDim), raw(valDim)])\n\t// CT_ChartData order is externalData? → data+. externalData is a LEAF whose only attribute is\n\t// `id` (r:id → the embedded workbook); it carries no `autoUpdate` and no child elements.\n\tconst externalData = voidEl('cx:externalData', { 'r:id': 'rId1' })\n\treturn el('cx:chartData', null, [raw(externalData), raw(data)])\n}\n\n/**\n * The `Sheet1` cell holding the series name (the numeric dimension's header) — column immediately\n * after all label columns, row 1. A category-less histogram lands on `$A$1`; a flat chart on\n * `$B$1`; a 3-level treemap on `$D$1`.\n * @param {SlideRelChart} rel - the registered chart\n * @return {string} an absolute single-cell reference, e.g. `Sheet1!$B$1`\n */\nexport function chartExSeriesNameRef(rel: SlideRelChart): string {\n\treturn sheetCellRef(dataLabels(rel.data[0]).length + 1, 1)\n}\n","/**\n * ts-pptx: chartEx (`cx:`) Chart Assembly\n *\n * Builds a chartEx chart part `ppt/charts/chartEx{N}.xml` — the `<cx:chartSpace>` for the\n * Office-2016 chart family (currently `waterfall`, `funnel`, `treemap`, `sunburst`, `histogram`,\n * `pareto`, `boxWhisker`, `regionMap`).\n * This is the chartEx analogue of\n * {@link ./chart-xml} (`makeXmlCharts`): a pure string builder, no I/O, no model mutation.\n *\n * chartEx differs from the classic `<c:chartSpace>` in three ways the rest of the package must\n * account for (all handled at the call sites, not here):\n * - it is a **separate part** with content type `application/vnd.ms-office.chartex+xml`,\n * - it is referenced from the slide through `<mc:AlternateContent>` (see `gen/slide/objects/chart.ts`),\n * - it renders **only in PowerPoint 2016+/Microsoft 365**; other consumers show the fallback shape.\n *\n * The `<cx:f>` formulas point back at the same embedded workbook the classic charts use\n * ({@link ./embed-xlsx}); the cell mapping lives in {@link ./chartex-data} / {@link ./data-refs}.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { DEF_FONT_COLOR, XML_DECL } from '../../constants-internal.js'\nimport type { ChartExBinning, ChartExGeography, ChartExStatistics } from '../../types/chart.js'\nimport type { SlideRelChart } from '../../types/internal.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { createChartTextFonts } from './chart-parts.js'\nimport { chartExSeriesNameRef, makeChartExData } from './chartex-data.js'\n\nconst CX_NS = 'http://schemas.microsoft.com/office/drawing/2014/chartex'\nconst A_NS = 'http://schemas.openxmlformats.org/drawingml/2006/main'\nconst R_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'\n\n/**\n * Map a chartEx {@link ChartType} to its `<cx:series layoutId>` token (the CT_SeriesLayout value\n * PowerPoint keys the chart geometry on). Returns `''` for a non-chartEx type.\n */\nfunction chartExLayoutId(type: ChartType): string {\n\tswitch (type) {\n\t\tcase ChartType.waterfall:\n\t\t\treturn 'waterfall'\n\t\tcase ChartType.funnel:\n\t\t\treturn 'funnel'\n\t\tcase ChartType.treemap:\n\t\t\treturn 'treemap'\n\t\tcase ChartType.sunburst:\n\t\t\treturn 'sunburst'\n\t\tcase ChartType.histogram:\n\t\t\t// A histogram is a clustered-column series whose bins PowerPoint computes from <cx:binning>.\n\t\t\treturn 'clusteredColumn'\n\t\tcase ChartType.boxWhisker:\n\t\t\treturn 'boxWhisker'\n\t\tcase ChartType.regionMap:\n\t\t\treturn 'regionMap'\n\t\tdefault:\n\t\t\treturn ''\n\t}\n}\n\n/**\n * A deterministic `uniqueId` GUID for a `<cx:series>`, derived from the chart's package-global id.\n * PowerPoint stamps a random GUID here; deriving it keeps output byte-stable (the project pins\n * chart determinism — the package-wide id this derives from is assigned at write time in\n * `package/assemble.ts`, STEP 2). `seriesIdx`\n * distinguishes multiple series within one chart (pareto emits two), varying the 4th GUID group so\n * every series still gets a distinct id.\n */\nfunction chartExUniqueId(globalId: number, seriesIdx = 0): string {\n\treturn `{00000000-0000-0000-${String(seriesIdx).padStart(4, '0')}-${String(globalId).padStart(12, '0')}}`\n}\n\n/** chartEx legend positions are `t|b|l|r`; clamp the classic `'tr'` (and anything else) to `'t'`. */\nfunction chartExLegendPos(pos: string | undefined): string {\n\treturn pos === 'b' || pos === 'l' || pos === 'r' ? pos : 't'\n}\n\n/**\n * The `<cx:axisId>` binding on a `<cx:series>` (which value/category axis the series plots against).\n *\n * NOTE — a schema-vs-PowerPoint divergence (the exact mirror of the histogram `binCount` gotcha):\n * the OpenXML SDK models `cx:axisId` as an `OpenXmlLeafTextElement`, so the OOXML validator only\n * accepts the text-content form `<cx:axisId>1</cx:axisId>` and flags the `val` attribute as\n * undeclared. But PowerPoint desktop REFUSES to open a deck using the text form (0x80070570) — it\n * writes and requires the ATTRIBUTE form `<cx:axisId val=\"1\"/>` (matching the classic `c:axId`).\n * PowerPoint is the authoritative oracle here, so the attribute form is emitted; the resulting\n * validator complaint on `cx:axisId/@val` is expected and whitelisted in the schema-case test.\n */\nfunction makeChartExAxisId(id: number): string {\n\treturn voidEl('cx:axisId', { val: id })\n}\n\n/**\n * Build the histogram `<cx:binning>` element from the caller's `binning` opt. PowerPoint bins the\n * raw observations automatically; the only control wired here is `intervalClosed` — whether each\n * bin interval is right-closed (`\"r\"`, PowerPoint's default) or left-closed (`\"l\"`).\n *\n * NOTE: explicit bin geometry (`binCount`/`binSize` child elements, `underflow`/`overflow`\n * attributes) is intentionally NOT emitted. Although `<cx:binCount>`/`<cx:binSize>` pass OOXML\n * schema validation (they are declared children of `cx:binning` in the OpenXML SDK), PowerPoint\n * desktop refuses to open a deck that contains them (0x80004005) — so shipping them would corrupt\n * the file. They stay deferred until their real requirements are pinned down against PowerPoint.\n */\nfunction makeChartExBinning(binning: ChartExBinning | undefined): string {\n\treturn voidEl('cx:binning', { intervalClosed: binning?.intervalClosed === 'l' ? 'l' : 'r' })\n}\n\n/**\n * Build the box-and-whisker `<cx:layoutPr>` body — a `<cx:visibility>` toggle set plus a\n * `<cx:statistics>` quartile-method choice, in that document order (what PowerPoint itself emits).\n * All flags default to PowerPoint's own defaults: exclusive quartiles, mean marker on, outlier\n * points on, the mean-line and the full non-outlier scatter off. Booleans map to the `0`/`1`\n * attribute form PowerPoint uses.\n */\nfunction makeBoxWhiskerLayoutPr(stats: ChartExStatistics | undefined): string {\n\tconst bit = (v: boolean | undefined, dflt: boolean): 0 | 1 => ((v ?? dflt) ? 1 : 0)\n\tconst visibility = voidEl('cx:visibility', {\n\t\tmeanLine: bit(stats?.meanLine, false),\n\t\tmeanMarker: bit(stats?.meanMarker, true),\n\t\tnonoutliers: bit(stats?.nonoutliers, false),\n\t\toutliers: bit(stats?.outliers, true),\n\t})\n\tconst statistics = voidEl('cx:statistics', {\n\t\tquartileMethod: stats?.quartileMethod === 'inclusive' ? 'inclusive' : 'exclusive',\n\t})\n\treturn el('cx:layoutPr', null, [raw(visibility), raw(statistics)])\n}\n\n/**\n * Build the region-map `<cx:layoutPr>` body — a single `<cx:geography>` hint telling PowerPoint how\n * to interpret the category labels as geographic region names. `cultureLanguage`/`cultureRegion`\n * (both schema-REQUIRED) resolve ambiguous names (e.g. \"Georgia\" the country vs. the US state);\n * `attribution` is Bing's fixed acknowledgement string.\n *\n * NOTE — PowerPoint itself also nests a `<cx:geoCache>` here holding a base64 binary blob: its\n * cached Bing geometry for the resolved regions. That blob is produced by an online Bing lookup and\n * cannot be reproduced offline, so it is intentionally OMITTED. PowerPoint re-resolves the geography\n * from the region names when the deck is opened (verified over COM: the deck opens and reads back as\n * a regionMap either way) — this is why a region map is documented as best-effort/write-only and\n * renders blank if the names don't match PowerPoint's geography database.\n */\nfunction makeGeographyLayoutPr(geo: ChartExGeography | undefined): string {\n\tconst geography = voidEl('cx:geography', {\n\t\tcultureLanguage: geo?.cultureLanguage || 'en-US',\n\t\tcultureRegion: geo?.cultureRegion || 'US',\n\t\tattribution: 'Powered by Bing',\n\t})\n\treturn el('cx:layoutPr', null, raw(geography))\n}\n\n/** The `<cx:tx>` series-name cell/value block (shared by every layout that names its series). */\nfunction makeChartExSeriesName(rel: SlideRelChart): string {\n\treturn el(\n\t\t'cx:tx',\n\t\tnull,\n\t\traw(\n\t\t\tel('cx:txData', null, [\n\t\t\t\traw(el('cx:f', null, chartExSeriesNameRef(rel))),\n\t\t\t\traw(el('cx:v', null, rel.data[0]?.name ?? '')),\n\t\t\t])\n\t\t)\n\t)\n}\n\n/**\n * Data labels: chartEx toggles each field via `<cx:visibility>`. Only emitted when the caller asked\n * to show values, matching the classic default of no data labels.\n */\nfunction makeChartExDataLabels(rel: SlideRelChart): string {\n\tconst showValue = !!(rel.opts.showValue || rel.opts.showLabel)\n\treturn showValue\n\t\t? el('cx:dataLabels', { pos: 'outEnd' }, raw(voidEl('cx:visibility', { seriesName: 0, categoryName: 0, value: 1 })))\n\t\t: ''\n}\n\n/**\n * Build the pareto `<cx:series>` PAIR — pareto is the first chartEx layout that emits more than one\n * series. Series 0 is a `clusteredColumn` bound to value axis 1 whose `<cx:aggregation/>` tells\n * PowerPoint to sum the values per category, sort the bars descending, and drive the cumulative\n * line. Series 1 is the `paretoLine` itself: it carries `ownerIdx=\"0\"` (it derives its data from\n * series 0, so it has NO `<cx:tx>` or `<cx:dataId>`) and binds to the secondary percentage axis 2.\n */\nfunction makeParetoSeries(rel: SlideRelChart): string {\n\tconst bar = el('cx:series', { layoutId: 'clusteredColumn', uniqueId: chartExUniqueId(rel.globalId, 0) }, [\n\t\traw(makeChartExSeriesName(rel)),\n\t\traw(makeChartExDataLabels(rel)),\n\t\traw(voidEl('cx:dataId', { val: 0 })),\n\t\traw(el('cx:layoutPr', null, raw(voidEl('cx:aggregation')))),\n\t\traw(makeChartExAxisId(1)),\n\t])\n\tconst line = el('cx:series', { layoutId: 'paretoLine', ownerIdx: 0, uniqueId: chartExUniqueId(rel.globalId, 1) }, [\n\t\traw(makeChartExAxisId(2)),\n\t])\n\treturn bar + line\n}\n\n/** Build the `<cx:series>` (title cell, data labels, dataId, and layout-specific `<cx:layoutPr>`). */\nfunction makeChartExSeries(rel: SlideRelChart): string {\n\tconst opts = rel.opts\n\tconst type = opts._type as ChartType\n\n\t// Pareto is multi-series (a column series + a cumulative line on a secondary axis).\n\tif (type === ChartType.pareto) return makeParetoSeries(rel)\n\n\t// Layout-specific series props.\n\tlet layoutPr = ''\n\tif (type === ChartType.waterfall && Array.isArray(opts.subtotals) && opts.subtotals.length > 0) {\n\t\t// waterfall: subtotal/total column indices.\n\t\tconst idxs = opts.subtotals.map((idx) => voidEl('cx:idx', { val: idx })).join('')\n\t\tlayoutPr = el('cx:layoutPr', null, raw(el('cx:subtotals', null, raw(idxs))))\n\t} else if (type === ChartType.treemap) {\n\t\t// treemap: how parent-category banners are placed (PowerPoint's default is `overlapping`).\n\t\tlayoutPr = el('cx:layoutPr', null, raw(voidEl('cx:parentLabelLayout', { val: 'overlapping' })))\n\t} else if (type === ChartType.histogram) {\n\t\t// histogram: how PowerPoint bins the raw observations. Default is auto binning with\n\t\t// right-closed intervals; the `binning` opt exposes explicit width/count/overflow control.\n\t\tlayoutPr = el('cx:layoutPr', null, raw(makeChartExBinning(opts.binning)))\n\t} else if (type === ChartType.boxWhisker) {\n\t\t// box-and-whisker: quartile method + which box adornments (mean line/marker, outliers) show.\n\t\tlayoutPr = makeBoxWhiskerLayoutPr(opts.statistics)\n\t} else if (type === ChartType.regionMap) {\n\t\t// region map: the <cx:geography> hint PowerPoint resolves the region names against.\n\t\tlayoutPr = makeGeographyLayoutPr(opts.geography)\n\t}\n\n\treturn el('cx:series', { layoutId: chartExLayoutId(type), uniqueId: chartExUniqueId(rel.globalId) }, [\n\t\traw(makeChartExSeriesName(rel)),\n\t\traw(makeChartExDataLabels(rel)),\n\t\traw(voidEl('cx:dataId', { val: 0 })),\n\t\traw(layoutPr),\n\t])\n}\n\n/**\n * Build the `<cx:axis>` list for a layout (matched to what PowerPoint itself emits for each):\n * - **waterfall** — a category (id 0) + value (id 1) axis.\n * - **funnel** — a SINGLE category axis, which PowerPoint numbers id 1, with no value axis and no\n * gridlines (the bars run horizontally off one category scale).\n * - **pareto** — like histogram (cat id0 gapWidth0 + val id1) PLUS a SECONDARY value axis id2\n * scaled 0..1 with `unit=\"percentage\"` that the cumulative `paretoLine` series binds to.\n * - **boxWhisker** — a category (id0, gapWidth 1) + value (id1, gridlines) axis, like waterfall\n * but with the wider default gap PowerPoint uses to separate the boxes.\n * Every other layout returns no axes — the hierarchical treemap/sunburst are genuinely axis-free\n * (categories are encoded by the nested tiles/rings, not an axis scale), and a `regionMap` plots on\n * geography rather than any Cartesian axis.\n */\nfunction makeChartExAxes(type: ChartType): string {\n\t// chartEx catScaling gapWidth is a fraction (1.0 = 100%), NOT the classic integer percent.\n\tif (type === ChartType.waterfall) {\n\t\tconst catAxis = el('cx:axis', { id: 0 }, [\n\t\t\traw(voidEl('cx:catScaling', { gapWidth: '0.5' })),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\tconst valAxis = el('cx:axis', { id: 1 }, [\n\t\t\traw(voidEl('cx:valScaling')),\n\t\t\traw(voidEl('cx:majorGridlines')),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\treturn catAxis + valAxis\n\t}\n\tif (type === ChartType.funnel) {\n\t\treturn el('cx:axis', { id: 1 }, [raw(voidEl('cx:catScaling', { gapWidth: '2.19' })), raw(voidEl('cx:tickLabels'))])\n\t}\n\tif (type === ChartType.histogram) {\n\t\t// Histogram bins abut, so the category axis uses gapWidth 0; the value axis carries gridlines.\n\t\tconst catAxis = el('cx:axis', { id: 0 }, [\n\t\t\traw(voidEl('cx:catScaling', { gapWidth: '0' })),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\tconst valAxis = el('cx:axis', { id: 1 }, [\n\t\t\traw(voidEl('cx:valScaling')),\n\t\t\traw(voidEl('cx:majorGridlines')),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\treturn catAxis + valAxis\n\t}\n\tif (type === ChartType.pareto) {\n\t\t// Aggregated column axes (like histogram: cat id0 gapWidth0 + val id1) …\n\t\tconst catAxis = el('cx:axis', { id: 0 }, [\n\t\t\traw(voidEl('cx:catScaling', { gapWidth: '0' })),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\tconst valAxis = el('cx:axis', { id: 1 }, [\n\t\t\traw(voidEl('cx:valScaling')),\n\t\t\traw(voidEl('cx:majorGridlines')),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\t// … plus the SECONDARY value axis (id2) the cumulative paretoLine plots against: a 0..1\n\t\t// percentage scale, no gridlines (the primary value axis already carries them).\n\t\tconst pctAxis = el('cx:axis', { id: 2 }, [\n\t\t\traw(voidEl('cx:valScaling', { max: '1', min: '0' })),\n\t\t\traw(voidEl('cx:units', { unit: 'percentage' })),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\treturn catAxis + valAxis + pctAxis\n\t}\n\tif (type === ChartType.boxWhisker) {\n\t\tconst catAxis = el('cx:axis', { id: 0 }, [\n\t\t\traw(voidEl('cx:catScaling', { gapWidth: '1' })),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\tconst valAxis = el('cx:axis', { id: 1 }, [\n\t\t\traw(voidEl('cx:valScaling')),\n\t\t\traw(voidEl('cx:majorGridlines')),\n\t\t\traw(voidEl('cx:tickLabels')),\n\t\t])\n\t\treturn catAxis + valAxis\n\t}\n\treturn ''\n}\n\n/** Build a minimal `<cx:title>` from the chart title options (only when `showTitle`). */\nfunction makeChartExTitle(rel: SlideRelChart): string {\n\tif (!rel.opts.showTitle) return ''\n\tconst color = rel.opts.titleColor || DEF_FONT_COLOR\n\tconst face = rel.opts.titleFontFace || 'Calibri'\n\tconst rPr = el('a:defRPr', null, [raw(genXmlColorSelection(color)), raw(createChartTextFonts(face))])\n\tconst rich = el('cx:rich', null, [\n\t\traw(voidEl('a:bodyPr')),\n\t\traw(voidEl('a:lstStyle')),\n\t\traw(\n\t\t\tel('a:p', null, [\n\t\t\t\traw(el('a:pPr', null, raw(rPr))),\n\t\t\t\traw(\n\t\t\t\t\tel('a:r', null, [\n\t\t\t\t\t\traw(voidEl('a:rPr', { lang: rel.opts.lang || 'en-US' })),\n\t\t\t\t\t\traw(el('a:t', null, rel.opts.title || 'Chart Title')),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n\treturn el('cx:title', { pos: 't', align: 'ctr', overlay: 0 }, raw(el('cx:tx', null, raw(rich))))\n}\n\n/**\n * Assemble the full `<cx:chartSpace>` for a chartEx chart part.\n * Document order (CT_ChartSpace): `chartData` → `chart`; the `<cx:chart>` holds\n * `title? → plotArea → legend?`.\n * @param {SlideRelChart} rel - the registered chartEx chart\n * @return {string} the `ppt/charts/chartEx{N}.xml` body\n */\nexport function makeXmlChartEx(rel: SlideRelChart): string {\n\tconst type = rel.opts._type as ChartType\n\n\tconst plotAreaRegion = el('cx:plotAreaRegion', null, raw(makeChartExSeries(rel)))\n\tconst plotArea = el('cx:plotArea', null, [raw(plotAreaRegion), raw(makeChartExAxes(type))])\n\tconst legend = rel.opts.showLegend\n\t\t? voidEl('cx:legend', { pos: chartExLegendPos(rel.opts.legendPos), align: 'ctr', overlay: 0 })\n\t\t: ''\n\tconst chart = el('cx:chart', null, [raw(makeChartExTitle(rel)), raw(plotArea), raw(legend)])\n\n\treturn (\n\t\tXML_DECL +\n\t\tel('cx:chartSpace', { 'xmlns:cx': CX_NS, 'xmlns:a': A_NS, 'xmlns:r': R_NS }, [\n\t\t\traw(makeChartExData(rel)),\n\t\t\traw(chart),\n\t\t])\n\t)\n}\n","/**\n * ts-pptx: chartEx (cx:) Style + Color Parts\n *\n * Every chartEx chart part (`chartEx{N}.xml`) MUST be accompanied by a chart-style part\n * (`style{N}.xml`, `cs:chartStyle`) and a chart-color-style part (`colors{N}.xml`,\n * `cs:colorStyle`), linked from the chartEx part's `.rels` via the MS `chartStyle` /\n * `chartColorStyle` relationship types. This is NOT optional: PowerPoint reports a chartEx deck\n * that lacks them as corrupt (0x80070570) — a failure the OOXML schema validator does not catch,\n * found via the desktop COM smoke (`pnpm run test:com`).\n *\n * The two payloads below are PowerPoint's own generic, chart-type-agnostic defaults (the same\n * boilerplate Office writes for any new chartEx chart), captured verbatim and shipped as a static\n * template — analogous to the default theme/worksheet boilerplate the library already embeds. They\n * reference theme scheme colors, so they adapt to the deck theme without per-chart customization.\n */\n\nimport { XML_DECL } from '../../constants-internal.js'\n\n/**\n * The `cs:colorStyle` payload for a chartEx chart's `colors{N}.xml` part (theme-accent cycle).\n * @raw-xml-asset Captured verbatim from PowerPoint; not built here, so not a migration target.\n */\nconst CHARTEX_COLORS_BODY =\n\t'<cs:colorStyle xmlns:cs=\"http://schemas.microsoft.com/office/drawing/2012/chartStyle\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" meth=\"cycle\" id=\"10\"><a:schemeClr val=\"accent1\"/><a:schemeClr val=\"accent2\"/><a:schemeClr val=\"accent3\"/><a:schemeClr val=\"accent4\"/><a:schemeClr val=\"accent5\"/><a:schemeClr val=\"accent6\"/><cs:variation/><cs:variation><a:lumMod val=\"60000\"/></cs:variation><cs:variation><a:lumMod val=\"80000\"/><a:lumOff val=\"20000\"/></cs:variation><cs:variation><a:lumMod val=\"80000\"/></cs:variation><cs:variation><a:lumMod val=\"60000\"/><a:lumOff val=\"40000\"/></cs:variation><cs:variation><a:lumMod val=\"50000\"/></cs:variation><cs:variation><a:lumMod val=\"70000\"/><a:lumOff val=\"30000\"/></cs:variation><cs:variation><a:lumMod val=\"70000\"/></cs:variation><cs:variation><a:lumMod val=\"50000\"/><a:lumOff val=\"50000\"/></cs:variation></cs:colorStyle>'\n\n/**\n * The `cs:chartStyle` payload for a chartEx chart's `style{N}.xml` part (PowerPoint default).\n * @raw-xml-asset Captured verbatim from PowerPoint; not built here, so not a migration target.\n */\nconst CHARTEX_STYLE_BODY =\n\t'<cs:chartStyle xmlns:cs=\"http://schemas.microsoft.com/office/drawing/2012/chartStyle\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" id=\"395\"><cs:axisTitle><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1197\"/></cs:axisTitle><cs:categoryAxis><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz=\"1197\"/></cs:categoryAxis><cs:chartArea mods=\"allowNoFillOverride allowNoLineOverride\"><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"bg1\"/></a:solidFill><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz=\"1330\"/></cs:chartArea><cs:dataLabel><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1197\"/></cs:dataLabel><cs:dataLabelCallout><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"dk1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill><a:ln><a:solidFill><a:schemeClr val=\"dk1\"><a:lumMod val=\"25000\"/><a:lumOff val=\"75000\"/></a:schemeClr></a:solidFill></a:ln></cs:spPr><cs:defRPr sz=\"1197\"/><cs:bodyPr rot=\"0\" spcFirstLastPara=\"1\" vertOverflow=\"clip\" horzOverflow=\"clip\" vert=\"horz\" wrap=\"square\" lIns=\"36576\" tIns=\"18288\" rIns=\"36576\" bIns=\"18288\" anchor=\"ctr\" anchorCtr=\"1\"><a:spAutoFit/></cs:bodyPr></cs:dataLabelCallout><cs:dataPoint><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:fillRef><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill></cs:spPr></cs:dataPoint><cs:dataPoint3D><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:fillRef><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill></cs:spPr></cs:dataPoint3D><cs:dataPointLine><cs:lnRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:lnRef><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"28575\" cap=\"rnd\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointLine><cs:dataPointMarker><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:fillRef><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:ln w=\"9525\"><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill></a:ln></cs:spPr></cs:dataPointMarker><cs:dataPointMarkerLayout symbol=\"circle\" size=\"5\"/><cs:dataPointWireframe><cs:lnRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:lnRef><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"28575\" cap=\"rnd\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointWireframe><cs:dataTable><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:spPr><a:ln w=\"9525\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill></a:ln></cs:spPr><cs:defRPr sz=\"1197\"/></cs:dataTable><cs:downBar><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"dk1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"dk1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill><a:ln w=\"9525\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:downBar><cs:dropLine><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"35000\"/><a:lumOff val=\"65000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:dropLine><cs:errorBar><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:errorBar><cs:floor><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef></cs:floor><cs:gridlineMajor><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMajor><cs:gridlineMinor><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMinor><cs:hiLoLine><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"75000\"/><a:lumOff val=\"25000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:hiLoLine><cs:leaderLine><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"35000\"/><a:lumOff val=\"65000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:leaderLine><cs:legend><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1197\"/></cs:legend><cs:plotArea mods=\"allowNoFillOverride allowNoLineOverride\"><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef></cs:plotArea><cs:plotArea3D mods=\"allowNoFillOverride allowNoLineOverride\"><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef></cs:plotArea3D><cs:seriesAxis><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz=\"1197\"/></cs:seriesAxis><cs:seriesLine><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"9525\" cap=\"flat\"><a:solidFill><a:srgbClr val=\"D9D9D9\"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:seriesLine><cs:title><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1862\"/></cs:title><cs:trendline><cs:lnRef idx=\"0\"><cs:styleClr val=\"auto\"/></cs:lnRef><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef><cs:spPr><a:ln w=\"19050\" cap=\"rnd\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"sysDash\"/></a:ln></cs:spPr></cs:trendline><cs:trendlineLabel><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1197\"/></cs:trendlineLabel><cs:upBar><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"dk1\"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val=\"lt1\"/></a:solidFill><a:ln w=\"9525\"><a:solidFill><a:schemeClr val=\"tx1\"><a:lumMod val=\"15000\"/><a:lumOff val=\"85000\"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:upBar><cs:valueAxis><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"><a:lumMod val=\"65000\"/><a:lumOff val=\"35000\"/></a:schemeClr></cs:fontRef><cs:defRPr sz=\"1197\"/></cs:valueAxis><cs:wall><cs:lnRef idx=\"0\"/><cs:fillRef idx=\"0\"/><cs:effectRef idx=\"0\"/><cs:fontRef idx=\"minor\"><a:schemeClr val=\"tx1\"/></cs:fontRef></cs:wall></cs:chartStyle>'\n\n/** Build the `ppt/charts/colors{N}.xml` part body. */\nexport function makeChartExColorsXml(): string {\n\treturn XML_DECL + CHARTEX_COLORS_BODY\n}\n\n/** Build the `ppt/charts/style{N}.xml` part body. */\nexport function makeChartExStyleXml(): string {\n\treturn XML_DECL + CHARTEX_STYLE_BODY\n}\n","/**\n * ts-pptx: Chart Embedded-Workbook Generation\n *\n * Builds the embedded `.xlsx` workbook that backs a chart's cached data — the data\n * source PowerPoint opens when a user edits the chart. `createExcelWorksheet` writes\n * the workbook plus the chart part + its `.rels` into the presentation package;\n * `buildEmbeddedWorksheet` / `buildChartRelsXml` are also reused by the read-side\n * injection path (`TsPptx.extractSlides`). Everything here is a pure string/bytes\n * builder — no I/O beyond the passed-in ZipWriter, no mutation of the presentation model.\n *\n * The chart's `chart.xml` DrawingML lives in `./chart-xml.ts`; the series↔worksheet-cell\n * mapping the two sides share lives in `./data-refs.ts`.\n */\n\nimport { ChartType } from '../../enums.js'\nimport { XML_DECL } from '../../constants-internal.js'\nimport type { SlideRelChart, OptsChartDataInternal } from '../../types/internal.js'\nimport { encodeXmlEntities } from '../utils.js'\nimport { ZipWriter } from '../../zip.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { OFFICE_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.js'\nimport { dataLabels, dataValues, dataSizes, firstLabelGroup, getExcelColName } from './data-refs.js'\nimport { makeXmlCharts } from './chart-xml.js'\nimport { makeXmlChartEx } from './chartex-xml.js'\nimport { makeChartExColorsXml, makeChartExStyleXml } from './chartex-style.js'\n\n/** MS chart-extension relationship types (chartEx style + color-style sidecar parts). */\nconst MS_CHART_REL = 'http://schemas.microsoft.com/office/2011/relationships/'\n\nfunction relationship(id: string, type: string, target: string): string {\n\treturn voidEl('Relationship', { Id: id, Type: type, Target: target })\n}\n\n/** `<Relationships>` wrapper shared by the workbook's `.rels` parts (all flat, no indent). */\nfunction relationships(rels: string[]): string {\n\treturn el('Relationships', { xmlns: PACKAGE_REL_NS }, rels.map(raw))\n}\n\n/**\n * Build the chart's embedded Excel workbook as a standalone OPC package and\n * return its bytes — the data source PowerPoint opens when a user edits the\n * chart's data. Pure (no zip side effects), so both the package write path\n * ({@link createExcelWorksheet}) and the read-side injection path\n * (`TsPptx.extractSlides`) can reuse it.\n * @param {SlideRelChart} chartObject - chart object\n * @return {Uint8Array} the embedded `.xlsx` package bytes\n */\n// ===== Embedded worksheet =====\n\nexport function buildEmbeddedWorksheet(chartObject: SlideRelChart): Uint8Array {\n\tconst data = chartObject.data\n\n\t{\n\t\t// The embedded workbook is its own OPC package: build it in a nested ZipWriter,\n\t\t// then embed its bytes (no folder scaffolding; fflate emits no directory entries).\n\t\tconst zipExcel = new ZipWriter()\n\t\tconst intBubbleCols = (data.length - 1) * 2 + 1 // 1 for \"X-Values\", then 2 for every Y-Axis\n\t\tconst IS_MULTI_CAT_AXES = (data[0]?.labels?.length ?? 0) > 1\n\n\t\t// B: Add core contents\n\t\t{\n\t\t\tzipExcel.add(\n\t\t\t\t'[Content_Types].xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">' +\n\t\t\t\t\t' <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>' +\n\t\t\t\t\t' <Default Extension=\"xml\" ContentType=\"application/xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/theme/theme1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/sharedStrings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/xl/tables/table1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/>' +\n\t\t\t\t\t' <Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/>' +\n\t\t\t\t\t'</Types>\\n'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'_rels/.rels',\n\t\t\t\tXML_DECL +\n\t\t\t\t\trelationships([\n\t\t\t\t\t\trelationship('rId1', PACKAGE_REL_NS + '/metadata/core-properties', 'docProps/core.xml'),\n\t\t\t\t\t\trelationship('rId2', OFFICE_REL + 'extended-properties', 'docProps/app.xml'),\n\t\t\t\t\t\trelationship('rId3', OFFICE_REL + 'officeDocument', 'xl/workbook.xml'),\n\t\t\t\t\t]) +\n\t\t\t\t\t'\\n'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'docProps/app.xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">' +\n\t\t\t\t\t'<Application>Microsoft Macintosh Excel</Application>' +\n\t\t\t\t\t'<DocSecurity>0</DocSecurity>' +\n\t\t\t\t\t'<ScaleCrop>false</ScaleCrop>' +\n\t\t\t\t\t'<HeadingPairs><vt:vector size=\"2\" baseType=\"variant\"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs>' +\n\t\t\t\t\t'<TitlesOfParts><vt:vector size=\"1\" baseType=\"lpstr\"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts>' +\n\t\t\t\t\t'<Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion>' +\n\t\t\t\t\t'</Properties>\\n'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'docProps/core.xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">' +\n\t\t\t\t\t'<dc:creator>TsPptx</dc:creator>' +\n\t\t\t\t\t'<cp:lastModifiedBy>TsPptx</cp:lastModifiedBy>' +\n\t\t\t\t\t'<dcterms:created xsi:type=\"dcterms:W3CDTF\">' +\n\t\t\t\t\tnew Date().toISOString() +\n\t\t\t\t\t'</dcterms:created>' +\n\t\t\t\t\t'<dcterms:modified xsi:type=\"dcterms:W3CDTF\">' +\n\t\t\t\t\tnew Date().toISOString() +\n\t\t\t\t\t'</dcterms:modified>' +\n\t\t\t\t\t'</cp:coreProperties>'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'xl/_rels/workbook.xml.rels',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t// Ids are deliberately out of order (3/2/1/4) — that is how this part has\n\t\t\t\t\t// always been emitted, and rel order is byte-significant.\n\t\t\t\t\trelationships([\n\t\t\t\t\t\trelationship('rId3', OFFICE_REL + 'styles', 'styles.xml'),\n\t\t\t\t\t\trelationship('rId2', OFFICE_REL + 'theme', 'theme/theme1.xml'),\n\t\t\t\t\t\trelationship('rId1', OFFICE_REL + 'worksheet', 'worksheets/sheet1.xml'),\n\t\t\t\t\t\trelationship('rId4', OFFICE_REL + 'sharedStrings', 'sharedStrings.xml'),\n\t\t\t\t\t])\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'xl/styles.xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><numFmts count=\"1\"><numFmt numFmtId=\"0\" formatCode=\"General\"/></numFmts><fonts count=\"4\"><font><sz val=\"9\"/><color indexed=\"8\"/><name val=\"Geneva\"/></font><font><sz val=\"9\"/><color indexed=\"8\"/><name val=\"Geneva\"/></font><font><sz val=\"10\"/><color indexed=\"8\"/><name val=\"Geneva\"/></font><font><sz val=\"18\"/><color indexed=\"8\"/>' +\n\t\t\t\t\t'<name val=\"Arial\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><dxfs count=\"0\"/><tableStyles count=\"0\"/><colors><indexedColors><rgbColor rgb=\"ff000000\"/><rgbColor rgb=\"ffffffff\"/><rgbColor rgb=\"ffff0000\"/><rgbColor rgb=\"ff00ff00\"/><rgbColor rgb=\"ff0000ff\"/>' +\n\t\t\t\t\t'<rgbColor rgb=\"ffffff00\"/><rgbColor rgb=\"ffff00ff\"/><rgbColor rgb=\"ff00ffff\"/><rgbColor rgb=\"ff000000\"/><rgbColor rgb=\"ffffffff\"/><rgbColor rgb=\"ff878787\"/><rgbColor rgb=\"fff9f9f9\"/></indexedColors></colors></styleSheet>\\n'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'xl/theme/theme1.xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\"><a:themeElements><a:clrScheme name=\"Office\"><a:dk1><a:sysClr val=\"windowText\" lastClr=\"000000\"/></a:dk1><a:lt1><a:sysClr val=\"window\" lastClr=\"FFFFFF\"/></a:lt1><a:dk2><a:srgbClr val=\"44546A\"/></a:dk2><a:lt2><a:srgbClr val=\"E7E6E6\"/></a:lt2><a:accent1><a:srgbClr val=\"4472C4\"/></a:accent1><a:accent2><a:srgbClr val=\"ED7D31\"/></a:accent2><a:accent3><a:srgbClr val=\"A5A5A5\"/></a:accent3><a:accent4><a:srgbClr val=\"FFC000\"/></a:accent4><a:accent5><a:srgbClr val=\"5B9BD5\"/></a:accent5><a:accent6><a:srgbClr val=\"70AD47\"/></a:accent6><a:hlink><a:srgbClr val=\"0563C1\"/></a:hlink><a:folHlink><a:srgbClr val=\"954F72\"/></a:folHlink></a:clrScheme><a:fontScheme name=\"Office\"><a:majorFont><a:latin typeface=\"Calibri Light\" panose=\"020F0302020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/><a:font script=\"Jpan\" typeface=\"Yu Gothic Light\"/><a:font script=\"Hang\" typeface=\"맑은 고딕\"/><a:font script=\"Hans\" typeface=\"DengXian Light\"/><a:font script=\"Hant\" typeface=\"新細明體\"/><a:font script=\"Arab\" typeface=\"Times New Roman\"/><a:font script=\"Hebr\" typeface=\"Times New Roman\"/><a:font script=\"Thai\" typeface=\"Tahoma\"/><a:font script=\"Ethi\" typeface=\"Nyala\"/><a:font script=\"Beng\" typeface=\"Vrinda\"/><a:font script=\"Gujr\" typeface=\"Shruti\"/><a:font script=\"Khmr\" typeface=\"MoolBoran\"/><a:font script=\"Knda\" typeface=\"Tunga\"/><a:font script=\"Guru\" typeface=\"Raavi\"/><a:font script=\"Cans\" typeface=\"Euphemia\"/><a:font script=\"Cher\" typeface=\"Plantagenet Cherokee\"/><a:font script=\"Yiii\" typeface=\"Microsoft Yi Baiti\"/><a:font script=\"Tibt\" typeface=\"Microsoft Himalaya\"/><a:font script=\"Thaa\" typeface=\"MV Boli\"/><a:font script=\"Deva\" typeface=\"Mangal\"/><a:font script=\"Telu\" typeface=\"Gautami\"/><a:font script=\"Taml\" typeface=\"Latha\"/><a:font script=\"Syrc\" typeface=\"Estrangelo Edessa\"/><a:font script=\"Orya\" typeface=\"Kalinga\"/><a:font script=\"Mlym\" typeface=\"Kartika\"/><a:font script=\"Laoo\" typeface=\"DokChampa\"/><a:font script=\"Sinh\" typeface=\"Iskoola Pota\"/><a:font script=\"Mong\" typeface=\"Mongolian Baiti\"/><a:font script=\"Viet\" typeface=\"Times New Roman\"/><a:font script=\"Uigh\" typeface=\"Microsoft Uighur\"/><a:font script=\"Geor\" typeface=\"Sylfaen\"/></a:majorFont><a:minorFont><a:latin typeface=\"Calibri\" panose=\"020F0502020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/><a:font script=\"Jpan\" typeface=\"Yu Gothic\"/><a:font script=\"Hang\" typeface=\"맑은 고딕\"/><a:font script=\"Hans\" typeface=\"DengXian\"/><a:font script=\"Hant\" typeface=\"新細明體\"/><a:font script=\"Arab\" typeface=\"Arial\"/><a:font script=\"Hebr\" typeface=\"Arial\"/><a:font script=\"Thai\" typeface=\"Tahoma\"/><a:font script=\"Ethi\" typeface=\"Nyala\"/><a:font script=\"Beng\" typeface=\"Vrinda\"/><a:font script=\"Gujr\" typeface=\"Shruti\"/><a:font script=\"Khmr\" typeface=\"DaunPenh\"/><a:font script=\"Knda\" typeface=\"Tunga\"/><a:font script=\"Guru\" typeface=\"Raavi\"/><a:font script=\"Cans\" typeface=\"Euphemia\"/><a:font script=\"Cher\" typeface=\"Plantagenet Cherokee\"/><a:font script=\"Yiii\" typeface=\"Microsoft Yi Baiti\"/><a:font script=\"Tibt\" typeface=\"Microsoft Himalaya\"/><a:font script=\"Thaa\" typeface=\"MV Boli\"/><a:font script=\"Deva\" typeface=\"Mangal\"/><a:font script=\"Telu\" typeface=\"Gautami\"/><a:font script=\"Taml\" typeface=\"Latha\"/><a:font script=\"Syrc\" typeface=\"Estrangelo Edessa\"/><a:font script=\"Orya\" typeface=\"Kalinga\"/><a:font script=\"Mlym\" typeface=\"Kartika\"/><a:font script=\"Laoo\" typeface=\"DokChampa\"/><a:font script=\"Sinh\" typeface=\"Iskoola Pota\"/><a:font script=\"Mong\" typeface=\"Mongolian Baiti\"/><a:font script=\"Viet\" typeface=\"Arial\"/><a:font script=\"Uigh\" typeface=\"Microsoft Uighur\"/><a:font script=\"Geor\" typeface=\"Sylfaen\"/></a:minorFont></a:fontScheme><a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/><a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:satMod val=\"103000\"/><a:lumMod val=\"102000\"/><a:tint val=\"94000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"110000\"/><a:lumMod val=\"100000\"/><a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/><a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:tint val=\"93000\"/><a:satMod val=\"150000\"/><a:shade val=\"98000\"/><a:lumMod val=\"102000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:tint val=\"98000\"/><a:satMod val=\"130000\"/><a:shade val=\"90000\"/><a:lumMod val=\"103000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:shade val=\"63000\"/><a:satMod val=\"120000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri=\"{05A4C25C-085E-4340-85A3-A5531E510DB2}\"><thm15:themeFamily xmlns:thm15=\"http://schemas.microsoft.com/office/thememl/2012/main\" name=\"Office Theme\" id=\"{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}\" vid=\"{4A3C46E8-61CC-4603-A589-7422A47A8E4A}\"/></a:ext></a:extLst></a:theme>'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'xl/workbook.xml',\n\t\t\t\tXML_DECL +\n\t\t\t\t\t'<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x15\" xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\">' +\n\t\t\t\t\t'<fileVersion appName=\"xl\" lastEdited=\"7\" lowestEdited=\"6\" rupBuild=\"10507\"/>' +\n\t\t\t\t\t'<workbookPr/>' +\n\t\t\t\t\t'<bookViews><workbookView xWindow=\"0\" yWindow=\"500\" windowWidth=\"20960\" windowHeight=\"15960\"/></bookViews>' +\n\t\t\t\t\t'<sheets><sheet name=\"Sheet1\" sheetId=\"1\" r:id=\"rId1\"/></sheets>' +\n\t\t\t\t\t'<calcPr calcId=\"0\" concurrentCalc=\"0\"/>' +\n\t\t\t\t\t'</workbook>\\n'\n\t\t\t)\n\t\t\tzipExcel.add(\n\t\t\t\t'xl/worksheets/_rels/sheet1.xml.rels',\n\t\t\t\tXML_DECL + relationships([relationship('rId1', OFFICE_REL + 'table', '../tables/table1.xml')]) + '\\n'\n\t\t\t)\n\t\t}\n\n\t\tzipExcel.add('xl/sharedStrings.xml', buildXlsxSharedStrings(chartObject, data, intBubbleCols, IS_MULTI_CAT_AXES))\n\t\tzipExcel.add('xl/tables/table1.xml', buildXlsxTable(chartObject, data, intBubbleCols))\n\t\tzipExcel.add('xl/worksheets/sheet1.xml', buildXlsxSheet(chartObject, data, intBubbleCols, IS_MULTI_CAT_AXES))\n\n\t\t// Done — return the embedded workbook bytes for the caller to place.\n\t\treturn zipExcel.toBytes()\n\t}\n}\n\n/**\n * Build the embedded workbook's `xl/sharedStrings.xml` (series names + category labels).\n */\nfunction buildXlsxSharedStrings(\n\tchartObject: SlideRelChart,\n\tdata: OptsChartDataInternal[],\n\tintBubbleCols: number,\n\tIS_MULTI_CAT_AXES: boolean\n): string {\n\tlet strSharedStrings = XML_DECL\n\tif (chartObject.opts._type === ChartType.bubble || chartObject.opts._type === ChartType.bubble3d) {\n\t\tstrSharedStrings += `<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"${intBubbleCols}\" uniqueCount=\"${intBubbleCols}\">`\n\t} else if (chartObject.opts._type === ChartType.scatter) {\n\t\tstrSharedStrings += `<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"${data.length}\" uniqueCount=\"${data.length}\">`\n\t} else if (IS_MULTI_CAT_AXES) {\n\t\tlet totCount = data.length + 1 // +1 for the blank entry at index 0\n\t\tdataLabels(data[0]).forEach((arrLabel) => (totCount += arrLabel.filter((label) => label && label !== '').length))\n\t\tstrSharedStrings += `<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"${totCount}\" uniqueCount=\"${totCount}\">`\n\t\tstrSharedStrings += '<si><t/></si>'\n\t} else {\n\t\t// series names + all labels of one series + number of label groups (data.labels.length) of one series (i.e. how many times the blank string is used)\n\t\tconst totCount =\n\t\t\tdata.length + dataLabels(data[0]).length * firstLabelGroup(data[0]).length + dataLabels(data[0]).length\n\t\t// series names + labels of one series + blank string (same for all label groups)\n\t\tconst unqCount = data.length + dataLabels(data[0]).length * firstLabelGroup(data[0]).length + 1\n\t\t// start `sst`\n\t\tstrSharedStrings += `<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"${totCount}\" uniqueCount=\"${unqCount}\">`\n\t\t// B: Add 'blank' for A1, B1, ..., of every label group inside data[n].labels\n\t\tstrSharedStrings += '<si><t xml:space=\"preserve\"></t></si>'\n\t}\n\n\t// C: Add `name`/Series\n\tif (chartObject.opts._type === ChartType.bubble || chartObject.opts._type === ChartType.bubble3d) {\n\t\tdata.forEach((objData, idx) => {\n\t\t\tif (idx === 0) strSharedStrings += '<si><t>X-Axis</t></si>'\n\t\t\telse {\n\t\t\t\tstrSharedStrings += `<si><t>${encodeXmlEntities(objData.name || `Y-Axis${idx}`)}</t></si>`\n\t\t\t\tstrSharedStrings += `<si><t>${encodeXmlEntities(`Size${idx}`)}</t></si>`\n\t\t\t}\n\t\t})\n\t} else {\n\t\tdata.forEach((objData) => {\n\t\t\tstrSharedStrings += `<si><t>${encodeXmlEntities((objData.name || ' ').replace('X-Axis', 'X-Values'))}</t></si>`\n\t\t})\n\t}\n\n\t// D: Add `labels`/Categories\n\tif (\n\t\tchartObject.opts._type !== ChartType.bubble &&\n\t\tchartObject.opts._type !== ChartType.bubble3d &&\n\t\tchartObject.opts._type !== ChartType.scatter\n\t) {\n\t\t// Use forEach backwards & check for '' to support multi-cat axes\n\t\tdataLabels(data[0])\n\t\t\t.slice()\n\t\t\t.reverse()\n\t\t\t.forEach((labelsGroup) => {\n\t\t\t\tlabelsGroup\n\t\t\t\t\t.filter((label) => label && label !== '')\n\t\t\t\t\t.forEach((label) => {\n\t\t\t\t\t\tstrSharedStrings += `<si><t>${encodeXmlEntities(label)}</t></si>`\n\t\t\t\t\t})\n\t\t\t})\n\t}\n\n\t// DONE:\n\tstrSharedStrings += '</sst>\\n'\n\treturn strSharedStrings\n}\n\n/**\n * Build the embedded workbook's `xl/tables/table1.xml` (the data table over the sheet range).\n */\nfunction buildXlsxTable(chartObject: SlideRelChart, data: OptsChartDataInternal[], intBubbleCols: number): string {\n\tlet strTableXml = XML_DECL\n\tif (chartObject.opts._type === ChartType.bubble || chartObject.opts._type === ChartType.bubble3d) {\n\t\tstrTableXml += `<table xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" id=\"1\" name=\"Table1\" displayName=\"Table1\" ref=\"A1:${getExcelColName(intBubbleCols)}${intBubbleCols}\" totalsRowShown=\"0\">`\n\t\tstrTableXml += `<tableColumns count=\"${intBubbleCols}\">`\n\t\tlet idxColLtr = 1\n\t\tdata.forEach((obj, idx) => {\n\t\t\tif (idx === 0) {\n\t\t\t\tstrTableXml += `<tableColumn id=\"${idx + 1}\" name=\"X-Values\"/>`\n\t\t\t} else {\n\t\t\t\tstrTableXml += `<tableColumn id=\"${idx + idxColLtr}\" name=\"${obj.name}\"/>`\n\t\t\t\tidxColLtr++\n\t\t\t\tstrTableXml += `<tableColumn id=\"${idx + idxColLtr}\" name=\"Size${idx}\"/>`\n\t\t\t}\n\t\t})\n\t} else if (chartObject.opts._type === ChartType.scatter) {\n\t\tstrTableXml += `<table xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" id=\"1\" name=\"Table1\" displayName=\"Table1\" ref=\"A1:${getExcelColName(data.length)}${dataValues(data[0]).length + 1}\" totalsRowShown=\"0\">`\n\t\tstrTableXml += `<tableColumns count=\"${data.length}\">`\n\t\tdata.forEach((_obj, idx) => {\n\t\t\tstrTableXml += `<tableColumn id=\"${idx + 1}\" name=\"${idx === 0 ? 'X-Values' : 'Y-Value '}${idx}\"/>`\n\t\t})\n\t} else {\n\t\tstrTableXml += `<table xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" id=\"1\" name=\"Table1\" displayName=\"Table1\" ref=\"A1:${getExcelColName(data.length + dataLabels(data[0]).length)}${firstLabelGroup(data[0]).length + 1}\" totalsRowShown=\"0\">`\n\t\tstrTableXml += `<tableColumns count=\"${data.length + dataLabels(data[0]).length}\">`\n\t\tdataLabels(data[0]).forEach((_labelsGroup, idx) => {\n\t\t\tstrTableXml += `<tableColumn id=\"${idx + 1}\" name=\"Column${idx + 1}\"/>`\n\t\t})\n\t\tdata.forEach((obj, idx) => {\n\t\t\tstrTableXml += `<tableColumn id=\"${idx + dataLabels(data[0]).length + 1}\" name=\"${encodeXmlEntities(obj.name ?? '')}\"/>`\n\t\t})\n\t}\n\tstrTableXml += '</tableColumns>'\n\tstrTableXml += '<tableStyleInfo showFirstColumn=\"0\" showLastColumn=\"0\" showRowStripes=\"1\" showColumnStripes=\"0\"/>'\n\tstrTableXml += '</table>'\n\treturn strTableXml\n}\n\n/**\n * Build the embedded workbook's `xl/worksheets/sheet1.xml` (header row + per-series data rows).\n */\nfunction buildXlsxSheet(\n\tchartObject: SlideRelChart,\n\tdata: OptsChartDataInternal[],\n\tintBubbleCols: number,\n\tIS_MULTI_CAT_AXES: boolean\n): string {\n\tlet strSheetXml = XML_DECL\n\tstrSheetXml +=\n\t\t'<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\">'\n\n\tif (chartObject.opts._type === ChartType.bubble || chartObject.opts._type === ChartType.bubble3d) {\n\t\tstrSheetXml += `<dimension ref=\"A1:${getExcelColName(intBubbleCols)}${dataValues(data[0]).length + 1}\"/>`\n\t} else if (chartObject.opts._type === ChartType.scatter) {\n\t\tstrSheetXml += `<dimension ref=\"A1:${getExcelColName(data.length)}${dataValues(data[0]).length + 1}\"/>`\n\t} else {\n\t\tstrSheetXml += `<dimension ref=\"A1:${getExcelColName(data.length + dataLabels(data[0]).length)}${dataValues(data[0]).length + 1}\"/>`\n\t}\n\n\tstrSheetXml +=\n\t\t'<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\"><selection activeCell=\"B1\" sqref=\"B1\"/></sheetView></sheetViews>'\n\tstrSheetXml += '<sheetFormatPr baseColWidth=\"10\" defaultRowHeight=\"16\"/>'\n\tif (chartObject.opts._type === ChartType.bubble || chartObject.opts._type === ChartType.bubble3d) {\n\t\t/* EX: INPUT: `data`\n\t\t\t\t[\n\t\t\t\t\t{ name:'X-Axis' , values:[10,11,12,13,14,15,16,17,18,19,20] },\n\t\t\t\t\t{ name:'Y-Axis 1', values:[ 1, 6, 7, 8, 9], sizes:[ 4, 5, 6, 7, 8] },\n\t\t\t\t\t{ name:'Y-Axis 2', values:[33,32,42,53,63], sizes:[11,12,13,14,15] }\n\t\t\t\t];\n\t\t\t\t*/\n\t\t/* EX: OUTPUT: bubbleChart Worksheet:\n\t\t\t\t\t-|----A-----|------B-----|------C-----|------D-----|------E-----|\n\t\t\t\t\t1| X-Values | Y-Values 1 | Y-Sizes 1 | Y-Values 2 | Y-Sizes 2 |\n\t\t\t\t\t2| 11 | 22 | 4 | 33 | 8 |\n\t\t\t\t\t-|----------|------------|------------|------------|------------|\n\t\t\t\t*/\n\t\tstrSheetXml += '<sheetData>'\n\n\t\t// A: Create header row first (NOTE: Start at index=1 as headers cols start with 'B')\n\t\tstrSheetXml += `<row r=\"1\" spans=\"1:${intBubbleCols}\">`\n\t\tstrSheetXml += '<c r=\"A1\" t=\"s\"><v>0</v></c>'\n\t\tfor (let idx = 1; idx < intBubbleCols; idx++) {\n\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idx + 1)}1\" t=\"s\"><v>${idx}</v></c>` // NOTE: add `t=\"s\"` for label cols!\n\t\t}\n\t\tstrSheetXml += '</row>'\n\n\t\t// B: Add row for each X-Axis value (Y-Axis* value is optional)\n\t\tdataValues(data[0]).forEach((val, idx) => {\n\t\t\t// Leading col is reserved for the 'X-Axis' value, so hard-code it, then loop over col values\n\t\t\tstrSheetXml += `<row r=\"${idx + 2}\" spans=\"1:${intBubbleCols}\">`\n\t\t\tstrSheetXml += `<c r=\"A${idx + 2}\"><v>${val}</v></c>`\n\t\t\t// Add Y-Axis 1->N (idy=0 = Xaxis)\n\t\t\tlet idxColLtr = 2\n\t\t\tfor (let idy = 1; idy < data.length; idy++) {\n\t\t\t\t// y-value\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idxColLtr)}${idx + 2}\"><v>${dataValues(data[idy])[idx] ?? ''}</v></c>`\n\t\t\t\tidxColLtr++\n\t\t\t\t// y-size\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idxColLtr)}${idx + 2}\"><v>${dataSizes(data[idy])[idx] ?? ''}</v></c>`\n\t\t\t\tidxColLtr++\n\t\t\t}\n\t\t\tstrSheetXml += '</row>'\n\t\t})\n\t} else if (chartObject.opts._type === ChartType.scatter) {\n\t\t/* EX: INPUT: `data`\n\t\t\t\t\t[\n\t\t\t\t\t\t{ name:'X-AxisA', values:[ 1, 2, 3, 4, 5] },\n\t\t\t\t\t\t{ name:'Y-AxisB', values:[ 2,22,42,52,62] },\n\t\t\t\t\t\t{ name:'Y-AxisC', values:[ 3,33,43,53,63] }\n\t\t\t\t\t];\n\t\t\t\t*/\n\t\t/* EX: OUTPUT: sheet1.xml:\n\t\t\t\t\t-|----A----|----B----|----C----|\n\t\t\t\t\t1| X-AxisA | Y-AxisB | Y-AxisC |\n\t\t\t\t\t2| 1 | 2 | 3 |\n\t\t\t\t\t-|---------|---------|---------|\n\t\t\t\t*/\n\t\tstrSheetXml += '<sheetData>'\n\n\t\t// A: Create header row first (every `name` row provided)\n\t\tstrSheetXml += `<row r=\"1\" spans=\"1:${data.length}\">`\n\t\tfor (let idx = 0; idx < data.length; idx++) {\n\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idx + 1)}1\" t=\"s\"><v>${idx}</v></c>` // NOTE: add `t=\"s\"` for label cols!\n\t\t}\n\t\tstrSheetXml += '</row>'\n\n\t\t// B: Add row for each X-Axis value (Y-Axis* value is optional)\n\t\tdataValues(data[0]).forEach((val, idx) => {\n\t\t\t// Leading col is reserved for the 'X-Axis' value, so hard-code it, then loop over col values\n\t\t\tstrSheetXml += `<row r=\"${idx + 2}\" spans=\"1:${data.length}\">`\n\t\t\tstrSheetXml += `<c r=\"A${idx + 2}\"><v>${val}</v></c>`\n\t\t\t// Add Y-Axis 1->N\n\t\t\tfor (let idy = 1; idy < data.length; idy++) {\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idy + 1)}${idx + 2}\"><v>${\n\t\t\t\t\tdataValues(data[idy])[idx] || dataValues(data[idy])[idx] === 0 ? dataValues(data[idy])[idx] : ''\n\t\t\t\t}</v></c>`\n\t\t\t}\n\t\t\tstrSheetXml += '</row>'\n\t\t})\n\t} else {\n\t\tstrSheetXml += '<sheetData>'\n\n\t\t/* EX: INPUT: `data`\n\t\t\t\t\t[\n\t\t\t\t\t\t{ name:'Red', labels:['Jan..May-17'], values:[11,13,14,15,16] },\n\t\t\t\t\t\t{ name:'Amb', labels:['Jan..May-17'], values:[22, 6, 7, 8, 9] },\n\t\t\t\t\t\t{ name:'Grn', labels:['Jan..May-17'], values:[33,32,42,53,63] }\n\t\t\t\t\t];\n\t\t\t\t*/\n\t\t/* EX: OUTPUT: lineChart Worksheet:\n\t\t\t\t\t-|---A---|--B--|--C--|--D--|\n\t\t\t\t\t1| | Red | Amb | Grn |\n\t\t\t\t\t2|Jan-17 | 11| 22| 33|\n\t\t\t\t\t3|Feb-17 | 55| 43| 70|\n\t\t\t\t\t4|Mar-17 | 56| 143| 99|\n\t\t\t\t\t5|Apr-17 | 65| 3| 120|\n\t\t\t\t\t6|May-17 | 75| 93| 170|\n\t\t\t\t\t-|-------|-----|-----|-----|\n\t\t\t\t*/\n\n\t\tif (!IS_MULTI_CAT_AXES) {\n\t\t\t// A: Create header row first\n\t\t\tstrSheetXml += `<row r=\"1\" spans=\"1:${data.length + dataLabels(data[0]).length}\">`\n\t\t\tdataLabels(data[0]).forEach((_labelsGroup, idx) => {\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idx + 1)}1\" t=\"s\"><v>0</v></c>`\n\t\t\t})\n\t\t\tfor (let idx = 0; idx < data.length; idx++) {\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idx + 1 + dataLabels(data[0]).length)}1\" t=\"s\"><v>${idx + 1}</v></c>` // NOTE: use `t=\"s\"` for label cols!\n\t\t\t}\n\t\t\tstrSheetXml += '</row>'\n\n\t\t\t// B: Add data row(s). Normally one row per category; a category-less chartEx layout\n\t\t\t// (histogram feeds PowerPoint raw observations with no labels) has no label groups, so\n\t\t\t// the row count falls back to the longest value series and the leading label columns are\n\t\t\t// simply skipped — values land in column A.\n\t\t\tconst rowCount =\n\t\t\t\tfirstLabelGroup(data[0]).length || Math.max(0, ...data.map((series) => dataValues(series).length))\n\t\t\tfor (let idx = 0; idx < rowCount; idx++) {\n\t\t\t\tstrSheetXml += `<row r=\"${idx + 2}\" spans=\"1:${data.length + dataLabels(data[0]).length}\">`\n\t\t\t\t// Leading cols are reserved for the label groups\n\t\t\t\tfor (let idx2 = dataLabels(data[0]).length - 1; idx2 >= 0; idx2--) {\n\t\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(dataLabels(data[0]).length - idx2)}${idx + 2}\" t=\"s\">`\n\t\t\t\t\tstrSheetXml += `<v>${data.length + idx + 1}</v>`\n\t\t\t\t\tstrSheetXml += '</c>'\n\t\t\t\t}\n\t\t\t\tfor (let idy = 0; idy < data.length; idy++) {\n\t\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(dataLabels(data[0]).length + idy + 1)}${idx + 2}\"><v>${dataValues(data[idy])[idx] ?? ''}</v></c>`\n\t\t\t\t}\n\t\t\t\tstrSheetXml += '</row>'\n\t\t\t}\n\t\t} else {\n\t\t\tconst TOT_SER = data.length\n\t\t\tconst TOT_CAT = firstLabelGroup(data[0]).length\n\t\t\tconst TOT_LVL = dataLabels(data[0]).length\n\t\t\t// labels[0] is the leaf (inner) level; labels[TOT_LVL-1] is the outermost.\n\t\t\t// Reversed so that the outermost group occupies column A and the leaf occupies column TOT_LVL.\n\t\t\tconst revLabelGroups = dataLabels(data[0]).slice().reverse()\n\n\t\t\t// Pre-build a map from (revLevelIdx, rowIdx) -> shared-string index.\n\t\t\t// SST layout: 0=blank, 1..TOT_SER=series names, then non-empty labels per\n\t\t\t// reversed level in appearance order.\n\t\t\tconst ssLabelMap = new Map<string, number>()\n\t\t\tlet ssIdx = TOT_SER + 1\n\t\t\trevLabelGroups.forEach((labelsGroup, revLevelIdx) => {\n\t\t\t\tlabelsGroup.forEach((label, rowIdx) => {\n\t\t\t\t\tif (label && label !== '') ssLabelMap.set(`${revLevelIdx}:${rowIdx}`, ssIdx++)\n\t\t\t\t})\n\t\t\t})\n\n\t\t\t// Header row: label columns blank (index 0), series name columns use indices 1..TOT_SER\n\t\t\tstrSheetXml += `<row r=\"1\" spans=\"1:${TOT_SER + TOT_LVL}\">`\n\t\t\tfor (let col = 1; col <= TOT_LVL; col++) {\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(col)}1\" t=\"s\"><v>0</v></c>`\n\t\t\t}\n\t\t\tfor (let ser = 0; ser < TOT_SER; ser++) {\n\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(TOT_LVL + ser + 1)}1\" t=\"s\"><v>${ser + 1}</v></c>`\n\t\t\t}\n\t\t\tstrSheetXml += '</row>'\n\n\t\t\t// One data row per leaf category\n\t\t\tfor (let idx = 0; idx < TOT_CAT; idx++) {\n\t\t\t\tstrSheetXml += `<row r=\"${idx + 2}\" spans=\"1:${TOT_SER + TOT_LVL}\">`\n\t\t\t\t// Label columns: column idy+1 holds revLabelGroups[idy]; emit only non-empty cells\n\t\t\t\trevLabelGroups.forEach((labelsGroup, idy) => {\n\t\t\t\t\tconst colLabel = labelsGroup[idx]\n\t\t\t\t\tif (colLabel && colLabel !== '') {\n\t\t\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(idy + 1)}${idx + 2}\" t=\"s\"><v>${ssLabelMap.get(`${idy}:${idx}`)}</v></c>`\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t// Data columns\n\t\t\t\tfor (let idy = 0; idy < TOT_SER; idy++) {\n\t\t\t\t\tstrSheetXml += `<c r=\"${getExcelColName(TOT_LVL + idy + 1)}${idx + 2}\"><v>${dataValues(data[idy])[idx] ?? ''}</v></c>`\n\t\t\t\t}\n\t\t\t\tstrSheetXml += '</row>'\n\t\t\t}\n\t\t}\n\t}\n\tstrSheetXml += '</sheetData>'\n\n\tstrSheetXml += '<pageMargins left=\"0.7\" right=\"0.7\" top=\"0.75\" bottom=\"0.75\" header=\"0.3\" footer=\"0.3\"/>'\n\t// Link the `table1.xml` file to define an actual Table in Excel\n\t// NOTE: Intentionally no `<tableParts>` here. A tablePart only works for scatter charts;\n\t// every other chart type reports a \"cannot find linked file\" error. The chart data can be\n\t// edited / range-selected without it, so it is deliberately never emitted.\n\tstrSheetXml += '</worksheet>\\n'\n\treturn strSheetXml\n}\n\n/**\n * Build the standalone `.rels` for a chart part: a single `rId1` relationship to\n * the chart's embedded workbook (`Target`). Shared by the package write path and\n * the read-side injection path, which pass different (relative) embedding targets.\n * @param {string} embeddingTarget - the workbook target, relative to the chart part\n * @return {string} the chart part's `.rels` XML\n */\nfunction buildChartRelsXml(embeddingTarget: string): string {\n\t// `voidEl` escapes the Target. The one in-tree caller passes an internally built\n\t// `../embeddings/Microsoft_Excel_WorksheetN.xlsx`, so that is a no-op on bytes;\n\t// it matters only for the read-side injection path, which supplies its own target.\n\treturn XML_DECL + relationships([relationship('rId1', OFFICE_REL + 'package', embeddingTarget)])\n}\n\n/**\n * Build the `.rels` for a chartEx chart part: the embedded workbook (rId1, via `<cx:externalData>`)\n * plus the mandatory color-style (rId2) and chart-style (rId3) sidecar parts. PowerPoint treats a\n * chartEx part without the style/color rels as corrupt, so these are not optional.\n * @param {string} embeddingTarget - workbook target, relative to the chart part\n * @param {string} colorsTarget - `colors{N}.xml`, relative to the chart part\n * @param {string} styleTarget - `style{N}.xml`, relative to the chart part\n */\nfunction buildChartExRelsXml(embeddingTarget: string, colorsTarget: string, styleTarget: string): string {\n\treturn (\n\t\tXML_DECL +\n\t\trelationships([\n\t\t\trelationship('rId1', OFFICE_REL + 'package', embeddingTarget),\n\t\t\trelationship('rId2', MS_CHART_REL + 'chartColorStyle', colorsTarget),\n\t\t\trelationship('rId3', MS_CHART_REL + 'chartStyle', styleTarget),\n\t\t])\n\t)\n}\n\n/**\n * Create the chart's embedded Excel worksheet and add the chart + workbook parts\n * to `zip` (package write path). The read-side injection path builds the same\n * parts itself from {@link buildEmbeddedWorksheet}, {@link buildChartRelsXml}, and\n * {@link makeXmlCharts}.\n * @param {SlideRelChart} chartObject - chart object\n * @param {ZipWriter} zip - zip writer the resulting XLSX (and chart parts) are added to\n * @return {Promise} promise of generating the XLSX file\n */\nexport async function createExcelWorksheet(chartObject: SlideRelChart, zip: ZipWriter): Promise<string> {\n\t// 1: Embed the workbook. The xlsx is itself a zip, so STORE it — re-DEFLATING\n\t// already-compressed bytes wastes CPU.\n\tzip.add(`ppt/embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx`, buildEmbeddedWorksheet(chartObject), {\n\t\tstore: true,\n\t})\n\n\t// 2: Create the chart part, its rels, and (for chartEx) the required style/color sidecar parts.\n\tconst embeddingTarget = `../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx`\n\tif (chartObject.isChartEx) {\n\t\t// chartEx charts REQUIRE a chart-style + color-style part or PowerPoint reports the deck as\n\t\t// corrupt (schema-valid but unopenable) — see gen/chart/chartex-style.ts.\n\t\tconst colorsName = `colors${chartObject.globalId}.xml`\n\t\tconst styleName = `style${chartObject.globalId}.xml`\n\t\tzip.add(`ppt/charts/${colorsName}`, makeChartExColorsXml())\n\t\tzip.add(`ppt/charts/${styleName}`, makeChartExStyleXml())\n\t\tzip.add(\n\t\t\t'ppt/charts/_rels/' + chartObject.fileName + '.rels',\n\t\t\tbuildChartExRelsXml(embeddingTarget, colorsName, styleName)\n\t\t)\n\t\tzip.add(`ppt/charts/${chartObject.fileName}`, makeXmlChartEx(chartObject))\n\t} else {\n\t\tzip.add('ppt/charts/_rels/' + chartObject.fileName + '.rels', buildChartRelsXml(embeddingTarget))\n\t\tzip.add(`ppt/charts/${chartObject.fileName}`, makeXmlCharts(chartObject))\n\t}\n\n\treturn ''\n}\n","/**\n * ts-pptx: Slide-Master Definition\n *\n * `createSlideMaster` walks a `SlideMasterProps` definition onto a layout target: shared\n * chart / image / shape / text children via `addChildDefinition`, plus master-specific text\n * placeholders (which need the object index for `_placeholderIdx`).\n */\nimport type { ObjectOptions, SlideMasterProps, TextPropsOptions } from '../../types/index.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { addChildDefinition } from './group.js'\nimport { addTextDefinition } from './text.js'\n\n/**\n * Transforms a slide definition to a slide object that is then passed to the XML transformation process.\n * @param {SlideMasterProps} props - slide definition\n * @param {PresSlideInternal|SlideLayoutInternal} target - empty slide object that should be updated by the passed definition\n */\nexport function createSlideMaster(props: SlideMasterProps, target: SlideLayoutInternal): void {\n\t// STEP 1: Add all Slide Master objects in the order they were given\n\tif (props.objects && Array.isArray(props.objects) && props.objects.length > 0) {\n\t\tprops.objects.forEach((object, idx) => {\n\t\t\tconst tgt = target as PresSlideInternal\n\t\t\tif (addChildDefinition(tgt, object)) {\n\t\t\t\t// handled by the shared chart/image/shape/text dispatch\n\t\t\t} else if ('placeholder' in object) {\n\t\t\t\tconst placeholder = object.placeholder\n\t\t\t\tconst { name, type, ...rawPlaceholderOptions } = placeholder.options\n\t\t\t\tconst placeholderOptions = rawPlaceholderOptions as TextPropsOptions & ObjectOptions\n\t\t\t\tplaceholderOptions.placeholder = name\n\t\t\t\tplaceholderOptions._placeholderType = type\n\t\t\t\tplaceholderOptions._placeholderIdx = 100 + idx\n\t\t\t\taddTextDefinition(tgt, [{ text: placeholder.text }], placeholderOptions, true)\n\t\t\t\t// NOTE: only text placeholders are supported (image/other placeholder kinds are not emitted)\n\t\t\t}\n\t\t})\n\t}\n\n\t// STEP 2: Add Slide Numbers (NOTE: Do this last so numbers are not covered by objects!)\n\tif (props.slideNumber && typeof props.slideNumber === 'object') target._slideNumberProps = props.slideNumber\n}\n","/**\n * ts-pptx: Placeholder Definition\n *\n * `addPlaceholdersToSlideLayouts` seeds a slide with any layout placeholders it has not already\n * populated, so every inherited placeholder is present as an (empty) text object.\n */\nimport { SlideObjectType } from '../../enums.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { addTextDefinition } from './text.js'\n\n/**\n * Adds placeholder objects to slide\n * @param {PresSlideInternal} slide - slide object containing layouts\n */\nexport function addPlaceholdersToSlideLayouts(slide: PresSlideInternal): void {\n\tif (!slide._slideLayout) return // Add all placeholders on this Slide that dont already exist\n\t;(slide._slideLayout._slideObjects || []).forEach((slideLayoutObj) => {\n\t\tif (slideLayoutObj._type === SlideObjectType.placeholder) {\n\t\t\tconst slideLayoutOptions = slideLayoutObj.options || {}\n\t\t\t// A: Search for this placeholder on Slide before we add\n\t\t\t// NOTE: Check to ensure a placeholder does not already exist on the Slide\n\t\t\t// They are created when they have been populated with text (ex: `slide.addText('Hi', { placeholder:'title' });`)\n\t\t\tif (\n\t\t\t\t!slide._slideObjects.some(\n\t\t\t\t\t(slideObj) => slideObj.options && slideObj.options.placeholder === slideLayoutOptions.placeholder\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\taddTextDefinition(slide, [{ text: '' }], slideLayoutOptions, true)\n\t\t\t}\n\t\t}\n\t})\n}\n","/**\n * ts-pptx: Media Methods\n */\n\nimport { IMG_BROKEN } from '../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideRelMedia } from '../types/internal.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport { warn } from '../diagnostics.js'\nimport { MediaError } from '../errors.js'\n\ntype SlideMediaRelWithPath = SlideRelMedia & { path: string }\n\nfunction hasEncodingPath(rel: SlideRelMedia): rel is SlideMediaRelWithPath {\n\treturn typeof rel.path === 'string' && rel.path.length > 0 && !rel.path.includes('preencoded')\n}\n\n/**\n * Encode Image/Audio/Video into base64\n * @param {PresSlideInternal | SlideLayoutInternal} layout - slide layout\n * @param {RuntimeAdapter} runtime - runtime adapter (Node/browser media loader)\n * @param {'throw' | 'placeholder'} onMediaError - failure policy: reject the export (default) or substitute a placeholder and warn\n * @return {Promise} promise\n */\nexport function encodeSlideMediaRels(\n\tlayout: PresSlideInternal | SlideLayoutInternal,\n\truntime: RuntimeAdapter,\n\tonMediaError: 'throw' | 'placeholder' = 'throw'\n): Array<Promise<string>> {\n\tconst imageProms: Array<Promise<string>> = []\n\n\t// A: Capture all audio/image/video candidates for encoding (filtering online/pre-encoded)\n\tconst candidateRels = layout._relsMedia.filter(\n\t\t(rel): rel is SlideMediaRelWithPath => rel.type !== 'online' && !rel.data && hasEncodingPath(rel)\n\t)\n\n\t// B: PERF: Mark dupes (same `path`) to avoid loading the same media over-and-over!\n\tconst unqPaths: string[] = []\n\tcandidateRels.forEach((rel) => {\n\t\tif (!unqPaths.includes(rel.path)) {\n\t\t\trel.isDuplicate = false\n\t\t\tunqPaths.push(rel.path)\n\t\t} else {\n\t\t\trel.isDuplicate = true\n\t\t}\n\t})\n\n\t// STEP 4: Read/Encode each unique media item\n\tcandidateRels\n\t\t.filter((rel) => !rel.isDuplicate)\n\t\t.forEach((rel) => {\n\t\t\timageProms.push(\n\t\t\t\t(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\trel.data = await runtime.loadMedia(rel)\n\t\t\t\t\t\tconst dupes = candidateRels.filter((dupe) => dupe.isDuplicate && dupe.path === rel.path)\n\t\t\t\t\t\tdupes.forEach((dupe) => (dupe.data = rel.data))\n\t\t\t\t\t\tif (rel.isSvgPng) await runtime.createSvgPngPreview(rel)\n\t\t\t\t\t\t// A path-deduped rel can itself be an SVG-PNG preview (the same SVG *file*\n\t\t\t\t\t\t// placed 2+ times on one slide: each placement pushes its own fallback rel).\n\t\t\t\t\t\t// Such dupes are skipped by STEP 5 — its `rel.data` filter runs synchronously,\n\t\t\t\t\t\t// before this async load populates `dupe.data` — so convert them here, or the\n\t\t\t\t\t\t// fallback keeps raw SVG bytes in a `.png` part and corrupts the deck.\n\t\t\t\t\t\tawait Promise.all(dupes.filter((dupe) => dupe.isSvgPng).map((dupe) => runtime.createSvgPngPreview(dupe)))\n\t\t\t\t\t\treturn 'done'\n\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\tif (onMediaError === 'placeholder') {\n\t\t\t\t\t\t\twarn(\n\t\t\t\t\t\t\t\t'media/load-failed',\n\t\t\t\t\t\t\t\t`Failed to load media \"${rel.path}\"; embedding a broken-image placeholder. (${String(ex)})`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\trel.data = IMG_BROKEN\n\t\t\t\t\t\t\tcandidateRels\n\t\t\t\t\t\t\t\t.filter((dupe) => dupe.isDuplicate && dupe.path === rel.path)\n\t\t\t\t\t\t\t\t.forEach((dupe) => (dupe.data = rel.data))\n\t\t\t\t\t\t\treturn 'done'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Default: fail-fast with an actionable error that names the failing asset and\n\t\t\t\t\t\t// chains the original cause (the raw fs/network error alone does not say which\n\t\t\t\t\t\t// media path broke). Pass `onMediaError: 'placeholder'` to degrade gracefully.\n\t\t\t\t\t\tthrow new MediaError('media/load-failed', `Failed to load media \"${rel.path}\" during export.`, {\n\t\t\t\t\t\t\tcause: ex,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})()\n\t\t\t)\n\t\t})\n\n\t// STEP 5: SVG-PNG previews\n\t// ......: \"SVG:\" base64 data still requires a png to be generated\n\t// ......: (`isSvgPng` flag this as the preview image, not the SVG itself)\n\tlayout._relsMedia\n\t\t.filter((rel) => rel.isSvgPng && rel.data)\n\t\t.forEach((rel) => {\n\t\t\timageProms.push(runtime.createSvgPngPreview(rel))\n\t\t})\n\n\treturn imageProms\n}\n","/**\n * ts-pptx: the pre-serialization pass\n *\n * Everything that must happen to authored slide state *before* any XML is built. Two callers\n * reach serialization and both need it:\n *\n * - `package/assemble.ts` — the normal `write`/`stream`/`writeFile` path, building a\n * complete `.pptx`.\n * - `PresentationCore.extractSlides()` — serializes slide bodies only, for splicing into\n * an already-loaded deck via `Presentation.appendSlides()` (`ts-pptx/read`).\n *\n * The second used to reimplement the first inline, kept in step by a comment that said\n * \"exactly as ... does\". Nothing failed when they drifted: `extractSlides` would simply emit\n * slides that did not match what a normal write produces, and no test compares the two.\n *\n * Two primitives rather than one combined pass, because the package path has work of its own\n * that must land *between* them: it de-duplicates identical media across the deck (which\n * needs the encoded bytes {@link encodeMediaForTargets} produces) and assigns package-unique\n * chart part filenames, both before any slide content is baked. Exposing the halves lets\n * `assemble` keep its established order exactly while still sharing the code.\n *\n * The order across the two is load-bearing:\n *\n * 1. **Media first.** It is the only asynchronous step, and the sync XML pass reads the\n * `rel.data` it populates.\n * 2. **Backfill placeholders**, so a slide inherits its layout's placeholder objects before\n * anything measures or serializes them.\n * 3. **Bake measured fit last**, because it measures the text step 2 may have just added and\n * writes the `fontScale` the sync XML pass then reads.\n *\n * The two functions take different target sets on purpose: media lives on layouts and the\n * master as well as on slides, while placeholder backfill and measured fit apply only to\n * slides. `extractSlides` passes only its slides to both, because it emits no layout or\n * master parts.\n */\n\nimport { applyMeasuredFit } from '../measure/fit.js'\nimport type { FontMetricsRegistry } from '../measure/font-metrics.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../types/internal.js'\nimport { addPlaceholdersToSlideLayouts } from './define/placeholder.js'\nimport { encodeSlideMediaRels } from './media.js'\n\n/**\n * Step 1: load and base64-encode every media rel on the given targets, populating `rel.data`.\n * @param {ReadonlyArray<PresSlideInternal | SlideLayoutInternal>} targets - media-bearing targets (slides, layouts, master)\n * @param {RuntimeAdapter} runtime - runtime adapter used to load media\n * @param {'throw' | 'placeholder'} onMediaError - failure policy for unloadable media\n */\nexport async function encodeMediaForTargets(\n\ttargets: ReadonlyArray<PresSlideInternal | SlideLayoutInternal>,\n\truntime: RuntimeAdapter,\n\tonMediaError: 'throw' | 'placeholder'\n): Promise<void> {\n\tconst promises: Array<Promise<string>> = []\n\tfor (const target of targets) {\n\t\tpromises.push(...encodeSlideMediaRels(target, runtime, onMediaError))\n\t}\n\tawait Promise.all(promises)\n}\n\n/**\n * Steps 2 and 3: backfill inherited layout placeholders, then bake measured text fit.\n * @param {PresSlideInternal[]} slides - the slides to prepare\n * @param {FontMetricsRegistry} fontMetrics - registered font metrics; an empty registry skips the fit bake\n */\nexport function bakeSlideContent(slides: PresSlideInternal[], fontMetrics: FontMetricsRegistry): void {\n\tfor (const slide of slides) {\n\t\tif (slide._slideLayout) addPlaceholdersToSlideLayouts(slide)\n\t}\n\n\tapplyMeasuredFit(slides, fontMetrics)\n}\n","/**\n * ts-pptx: slide shape-id allocation\n *\n * Compute the `<p:cNvPr>` id every slide shape (including group children) is\n * rendered with, and resolve an `objectName` back to that id. References that\n * must name a shape before the render walk reaches it — a connector's\n * `<a:stCxn>`, an animation's `<p:spTgt spid>` — go through these helpers, so\n * they are shared by both the slide-object renderer and the animation builder.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport type { SlideObject } from '../../types/internal.js'\nimport { encodeXmlAttrValue } from '../utils.js'\n\n/**\n * Every object a slide renders, paired with the `<p:cNvPr>` id it is rendered with: top-level\n * objects first (`index + 2`, in add order), then group children, seeded past the last top-level id\n * and allocated pre-order (a nested group takes an id before its own children do).\n *\n * This **mirrors** the allocation in `slideObjectToXml`, which hands out ids as it walks the tree.\n * A reference that must name an id *before* the walk reaches it — a connector's `<a:stCxn>`, an\n * animation's `<p:spTgt spid>` — cannot wait for that, so it resolves through this map instead.\n * The two must stay in step: `test/regression/shape/group-shapes.test.js` parses the emitted `cNvPr` ids\n * back out and asserts each reference points at the shape it names, so drift fails there.\n * @param slideObjects - the slide's top-level objects\n * @returns each object's `<p:cNvPr>` id, keyed by object identity, in id order\n */\nexport function collectSlideShapeIds(slideObjects: SlideObject[]): Map<SlideObject, number> {\n\tconst shapeIds = new Map<SlideObject, number>()\n\tslideObjects.forEach((obj, idx) => shapeIds.set(obj, idx + 2))\n\n\tlet childIdxAlloc = slideObjects.length\n\tconst allocGroupChildren = (children: SlideObject[]): void => {\n\t\tchildren.forEach((child) => {\n\t\t\tshapeIds.set(child, childIdxAlloc++ + 2)\n\t\t\tif (child._type === SlideObjectType.group) allocGroupChildren(child._groupObjects || [])\n\t\t})\n\t}\n\tslideObjects.forEach((obj) => {\n\t\tif (obj._type === SlideObjectType.group) allocGroupChildren(obj._groupObjects || [])\n\t})\n\n\treturn shapeIds\n}\n\n/**\n * The `<p:cNvPr>` id of the object named `objectName`, or `null` when the slide has no such object.\n *\n * `objectName` is the **raw**, caller-supplied name — escaping is this helper's job. Every\n * `add*Definition` stores the name attribute-escaped (`encodeXmlAttrValue`) so `cNvPrOpen` can emit\n * it verbatim (see its comment in `gen/slide/objects/shared.ts`), which means the stored text is not the\n * caller's string: a shape added as `'Q&A'` is held as `Q&amp;A`. Comparing here rather than at each\n * call site keeps that one rule in one place — re-deriving it per caller is exactly how the\n * animation lookup came to disagree with the connector one and drop every effect naming a shape\n * whose name contained `&`, `<`, `>`, `\"`, `'`, a tab or a newline.\n *\n * Group children are searched too: `buildGroupObject` splices them out of `_slideObjects` and into\n * their group's `_groupObjects`, but they are still `<p:cNvPr>`-named on this same slide and so are\n * legitimate targets for a connector binding or an animation. Searching only `_slideObjects` is what\n * silently dropped both.\n *\n * A top-level object wins over a group child of the same name (`slideObjectToXml` warns separately\n * about the duplicate), which leaves resolution unchanged for every deck without groups.\n * @param shapeIds - the slide's shape ids, from `collectSlideShapeIds` (iterated in id order)\n * @param objectName - the raw `objectName` to resolve, as the caller spelled it\n * @returns the object's `<p:cNvPr>` id, or `null` when unresolved\n */\nexport function resolveObjectNameToId(shapeIds: Map<SlideObject, number>, objectName: string): number | null {\n\tconst key = encodeXmlAttrValue(objectName)\n\tfor (const [obj, id] of shapeIds) {\n\t\tif (obj.options?.objectName === key) return id\n\t}\n\treturn null\n}\n","/**\n * ts-pptx: slide build animations\n *\n * Resolve preset build animations to their target shape ids and assemble the\n * `mainSeq` / `bldLst` trees that PowerPoint reads for click-triggered entrance,\n * emphasis and exit effects. Consumed by the slide `<p:timing>` builder.\n */\n\nimport type { AnimationProps } from '../../types/index.js'\nimport type { SlideObject } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { resolveObjectNameToId } from '../slide/shape-ids.js'\n\n/**\n * Resolved animation target's shape id (`spid`), or `null` when it cannot be resolved — in which\n * case the effect is dropped, so every `null` warns rather than leaving the animation silently\n * missing from the deck.\n *\n * `objectName` resolves through `shapeIds`, which covers group children: they are `<p:cNvPr>`-named\n * on the slide and animate like any other shape, but are not in `_slideObjects`, so the old lookup\n * there dropped every animation targeting one. The name goes in raw — `resolveObjectNameToId` owns\n * matching it against the attribute-escaped form the slide object stores — so the warning below\n * quotes the same spelling the caller passed.\n *\n * `shapeIndex` is a 0-based index into the top-level objects only (its `spid = shapeIndex + 2`\n * mirrors the `idx + 2` top-level allocation in `collectSlideShapeIds`; group children take ids past\n * that range). An index outside `[0, topLevelCount)` would emit a `<p:spTgt spid>` naming no shape on\n * the slide — a dangling spid PowerPoint reports as a repair (0x80070570) — so it warns and drops,\n * exactly like an unresolvable `objectName` does.\n * @param shapeIds - the slide's shape ids, from `collectSlideShapeIds`\n * @param topLevelCount - number of top-level slide objects a `shapeIndex` may address\n * @param anim - the animation to resolve\n * @returns the target's `<p:cNvPr>` id, or `null`\n */\nexport function resolveAnimationSpid(\n\tshapeIds: Map<SlideObject, number>,\n\ttopLevelCount: number,\n\tanim: AnimationProps\n): number | null {\n\tif (typeof anim.shapeIndex === 'number') {\n\t\tif (anim.shapeIndex >= 0 && anim.shapeIndex < topLevelCount) return anim.shapeIndex + 2\n\t\twarn(\n\t\t\t'animation/target-index-out-of-range',\n\t\t\t`addAnimation: shapeIndex ${anim.shapeIndex} is out of range (slide has ${topLevelCount} top-level object(s)), so its \"${anim.preset}\" effect was dropped.`\n\t\t)\n\t\treturn null\n\t}\n\tif (anim.objectName) {\n\t\tconst id = resolveObjectNameToId(shapeIds, anim.objectName)\n\t\tif (id !== null) return id\n\t\twarn(\n\t\t\t'animation/target-not-found',\n\t\t\t`addAnimation: no object named \"${anim.objectName}\" on the slide, so its \"${anim.preset}\" effect was dropped.`\n\t\t)\n\t\treturn null\n\t}\n\twarn(\n\t\t'animation/target-missing',\n\t\t`addAnimation: the \"${anim.preset}\" effect names no target (pass shapeIndex or objectName), so it was dropped.`\n\t)\n\treturn null\n}\n\ninterface AnimPresetMeta {\n\tpresetID: number\n\tpresetClass: 'entr' | 'emph' | 'exit'\n\tpresetSubtype: number\n\tdefaultDurationMs: number\n\t/** Emit the effect's behavior nodes (each `<p:cTn>` consumes one id via `next`). */\n\tbehaviors: (spid: number, dur: number, next: () => number) => string\n}\n\nconst ANIM_SET_VISIBLE = (spid: number, next: () => number): string =>\n\tel('p:set', null, [\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t{ id: next(), dur: 1, fill: 'hold' },\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 0 }))))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'style.visibility')))),\n\t\t\t])\n\t\t),\n\t\traw(el('p:to', null, raw(voidEl('p:strVal', { val: 'visible' })))),\n\t])\n\nconst ANIM_SET_HIDDEN = (spid: number, dur: number, next: () => number): string =>\n\tel('p:set', null, [\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t{ id: next(), dur: 1, fill: 'hold' },\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: Math.max(0, dur - 1) }))))\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'style.visibility')))),\n\t\t\t])\n\t\t),\n\t\traw(el('p:to', null, raw(voidEl('p:strVal', { val: 'hidden' })))),\n\t])\n\n/** `p:animEffect` filter transition (fade/wipe(down)/…), shared by entrance and exit presets. */\nconst ANIM_EFFECT = (transition: 'in' | 'out', filter: string, spid: number, dur: number, next: () => number): string =>\n\tel(\n\t\t'p:animEffect',\n\t\t{ transition, filter },\n\t\traw(\n\t\t\tel('p:cBhvr', null, [\n\t\t\t\traw(voidEl('p:cTn', { id: next(), dur })),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t])\n\t\t)\n\t)\n\nconst ANIM_FADE = (transition: 'in' | 'out', spid: number, dur: number, next: () => number): string =>\n\tANIM_EFFECT(transition, 'fade', spid, dur, next)\n\n/**\n * One `ppt_x`/`ppt_y` motion `<p:anim>` for Fly In (entrance) / Fly Out (exit).\n * PowerPoint authors the two directions differently (captured in\n * `slide-animation-presets.oracle.json`): the entrance form references the\n * hashed run-time variables (`#ppt_x`) and holds (`fill=\"hold\"`) starting\n * off-screen and ending in place; the exit form uses the bare variables\n * (`ppt_x`, no `#`), omits `fill=\"hold\"`, and ends off-screen.\n */\nconst ANIM_FLY_AXIS = (\n\tdirection: 'in' | 'out',\n\taxis: 'x' | 'y',\n\tspid: number,\n\tdur: number,\n\tnext: () => number\n): string => {\n\tconst h = direction === 'in' ? '#' : ''\n\tlet from: string\n\tlet to: string\n\tif (axis === 'x') {\n\t\tfrom = `${h}ppt_x`\n\t\tto = `${h}ppt_x`\n\t} else if (direction === 'in') {\n\t\tfrom = `1+${h}ppt_h/2`\n\t\tto = `${h}ppt_y`\n\t} else {\n\t\tfrom = `${h}ppt_y`\n\t\tto = `1+${h}ppt_h/2`\n\t}\n\tconst fill = direction === 'in' ? 'hold' : null\n\treturn el('p:anim', { calcmode: 'lin', valueType: 'num' }, [\n\t\traw(\n\t\t\tel('p:cBhvr', { additive: 'base' }, [\n\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill })),\n\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, `ppt_${axis}`)))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:tavLst', null, [\n\t\t\t\traw(el('p:tav', { tm: 0 }, raw(el('p:val', null, raw(voidEl('p:strVal', { val: from })))))),\n\t\t\t\traw(el('p:tav', { tm: 100000 }, raw(el('p:val', null, raw(voidEl('p:strVal', { val: to })))))),\n\t\t\t])\n\t\t),\n\t])\n}\n\nconst ANIM_PRESETS: Record<string, AnimPresetMeta> = {\n\tfadeIn: {\n\t\tpresetID: 10,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_SET_VISIBLE(spid, next) + ANIM_FADE('in', spid, dur, next),\n\t},\n\tflyIn: {\n\t\tpresetID: 2,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tANIM_SET_VISIBLE(spid, next) +\n\t\t\tANIM_FLY_AXIS('in', 'x', spid, dur, next) +\n\t\t\tANIM_FLY_AXIS('in', 'y', spid, dur, next),\n\t},\n\tappear: {\n\t\tpresetID: 1,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, _dur, next) => ANIM_SET_VISIBLE(spid, next),\n\t},\n\twipe: {\n\t\tpresetID: 22,\n\t\tpresetClass: 'entr',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_SET_VISIBLE(spid, next) + ANIM_EFFECT('in', 'wipe(down)', spid, dur, next),\n\t},\n\tgrow: {\n\t\tpresetID: 6,\n\t\tpresetClass: 'emph',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 2000,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tel('p:animScale', null, [\n\t\t\t\traw(\n\t\t\t\t\tel('p:cBhvr', null, [\n\t\t\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill: 'hold' })),\n\t\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t\traw(voidEl('p:by', { x: 150000, y: 150000 })),\n\t\t\t]),\n\t},\n\tspin: {\n\t\tpresetID: 8,\n\t\tpresetClass: 'emph',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 2000,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tel('p:animRot', { by: 21600000 }, [\n\t\t\t\traw(\n\t\t\t\t\tel('p:cBhvr', null, [\n\t\t\t\t\t\traw(voidEl('p:cTn', { id: next(), dur, fill: 'hold' })),\n\t\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t\t\traw(el('p:attrNameLst', null, raw(el('p:attrName', null, 'r')))),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t]),\n\t},\n\tfadeOut: {\n\t\tpresetID: 10,\n\t\tpresetClass: 'exit',\n\t\tpresetSubtype: 0,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) => ANIM_FADE('out', spid, dur, next) + ANIM_SET_HIDDEN(spid, dur, next),\n\t},\n\tflyOut: {\n\t\tpresetID: 2,\n\t\tpresetClass: 'exit',\n\t\tpresetSubtype: 4,\n\t\tdefaultDurationMs: 500,\n\t\tbehaviors: (spid, dur, next) =>\n\t\t\tANIM_FLY_AXIS('out', 'x', spid, dur, next) +\n\t\t\tANIM_FLY_AXIS('out', 'y', spid, dur, next) +\n\t\t\tANIM_SET_HIDDEN(spid, dur, next),\n\t},\n}\n\nconst ANIM_NODE_TYPE: Record<string, string> = {\n\tonClick: 'clickEffect',\n\twithPrevious: 'withEffect',\n\tafterPrevious: 'afterEffect',\n}\n\ntype ResolvedAnimation = { anim: AnimationProps; spid: number }\n\n/**\n * Assemble the `mainSeq` from preset effects. Effects are grouped into click\n * steps: an `onClick` effect opens a new click group; `afterPrevious` opens a new\n * sub-step (delayed by the previous effect's duration) within it; `withPrevious`\n * joins the current sub-step. This reproduces PowerPoint's interactive build tree.\n */\nexport function buildAnimationSeq(animations: ResolvedAnimation[], next: () => number): string {\n\tinterface SubGroup {\n\t\tdelay: number\n\t\teffects: ResolvedAnimation[]\n\t}\n\tinterface ClickGroup {\n\t\tsubs: SubGroup[]\n\t}\n\tconst groups: ClickGroup[] = []\n\tlet prevDuration = 0\n\tfor (const entry of animations) {\n\t\tconst meta = ANIM_PRESETS[entry.anim.preset]\n\t\tif (!meta) continue\n\t\tconst trigger = entry.anim.trigger ?? 'onClick'\n\t\tconst duration = typeof entry.anim.durationMs === 'number' ? entry.anim.durationMs : meta.defaultDurationMs\n\t\tif (trigger === 'onClick' || groups.length === 0) {\n\t\t\tgroups.push({ subs: [{ delay: 0, effects: [entry] }] })\n\t\t} else if (trigger === 'afterPrevious') {\n\t\t\tgroups[groups.length - 1]?.subs.push({ delay: prevDuration, effects: [entry] })\n\t\t} else {\n\t\t\t// withPrevious — join the current sub-step\n\t\t\tconst subs = groups[groups.length - 1]?.subs\n\t\t\tconst lastSub = subs?.[subs.length - 1]\n\t\t\tif (lastSub) lastSub.effects.push(entry)\n\t\t}\n\t\tprevDuration = duration\n\t}\n\n\tconst emitEffect = (entry: ResolvedAnimation): string => {\n\t\tconst meta = ANIM_PRESETS[entry.anim.preset]\n\t\tif (!meta) return ''\n\t\tconst nodeType = ANIM_NODE_TYPE[entry.anim.trigger ?? 'onClick']\n\t\tconst duration = typeof entry.anim.durationMs === 'number' ? entry.anim.durationMs : meta.defaultDurationMs\n\t\tconst effectId = next()\n\t\tconst behaviors = meta.behaviors(entry.spid, duration, next)\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:cTn',\n\t\t\t\t\t{\n\t\t\t\t\t\tid: effectId,\n\t\t\t\t\t\tpresetID: meta.presetID,\n\t\t\t\t\t\tpresetClass: meta.presetClass,\n\t\t\t\t\t\tpresetSubtype: meta.presetSubtype,\n\t\t\t\t\t\tfill: 'hold',\n\t\t\t\t\t\tgrpId: 0,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 0 })))),\n\t\t\t\t\t\traw(el('p:childTnLst', null, raw(behaviors))),\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t}\n\n\tconst emitSub = (sub: SubGroup): string => {\n\t\tconst subId = next()\n\t\tconst effects = sub.effects.map(emitEffect).join('')\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cTn', { id: subId, fill: 'hold' }, [\n\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: sub.delay })))),\n\t\t\t\t\traw(el('p:childTnLst', null, raw(effects))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\tconst emitGroup = (group: ClickGroup): string => {\n\t\tconst groupId = next()\n\t\tconst subs = group.subs.map(emitSub).join('')\n\t\treturn el(\n\t\t\t'p:par',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cTn', { id: groupId, fill: 'hold' }, [\n\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 'indefinite' })))),\n\t\t\t\t\traw(el('p:childTnLst', null, raw(subs))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\tconst clickGroups = groups.map(emitGroup).join('')\n\treturn el('p:seq', { concurrent: 1, nextAc: 'seek' }, [\n\t\traw(\n\t\t\tel('p:cTn', { id: 2, dur: 'indefinite', nodeType: 'mainSeq' }, raw(el('p:childTnLst', null, raw(clickGroups))))\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:prevCondLst',\n\t\t\t\tnull,\n\t\t\t\traw(el('p:cond', { evt: 'onPrev', delay: 0 }, raw(el('p:tgtEl', null, raw(voidEl('p:sldTgt'))))))\n\t\t\t)\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:nextCondLst',\n\t\t\t\tnull,\n\t\t\t\traw(el('p:cond', { evt: 'onNext', delay: 0 }, raw(el('p:tgtEl', null, raw(voidEl('p:sldTgt'))))))\n\t\t\t)\n\t\t),\n\t])\n}\n\n/** One `<p:bldP>` per animated shape, in order of first appearance. */\nexport function buildBldList(animations: ResolvedAnimation[]): string {\n\tconst seen = new Set<number>()\n\tconst bldPs: string[] = []\n\tfor (const { spid } of animations) {\n\t\tif (seen.has(spid)) continue\n\t\tseen.add(spid)\n\t\tbldPs.push(voidEl('p:bldP', { spid, grpId: 0 }))\n\t}\n\treturn el('p:bldLst', null, raw(bldPs.join('')))\n}\n","/**\n * ts-pptx: slide `<p:timing>` tree\n *\n * Build the slide-level timing tree that drives looping embedded media and the\n * preset build-animation `mainSeq`. A slide has at most one `<p:timing>`; all\n * looping media and animation effects share its `tmRoot` node.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport type { AnimationProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideObject } from '../../types/internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { collectSlideShapeIds } from '../slide/shape-ids.js'\nimport { buildAnimationSeq, buildBldList, resolveAnimationSpid } from './animation.js'\n\n/**\n * Build the slide-level `<p:timing>` tree that makes embedded media loop.\n * - PowerPoint stores playback looping as `repeatCount` on the media node's `<p:cTn>`\n * (`indefinite` for \"Loop until Stopped\", or `N*1000` for a finite N plays), inside\n * the slide timing tree rather than on the `<p:pic>` itself.\n * - A slide has at most one `<p:timing>`; all looping media share its `tmRoot` node.\n * - Audio loops via `<p:audio>`, video via `<p:video>` (both `CT_TLCommonMediaNodeData`).\n * - The media node targets the picture by `spid` (its `<p:cNvPr>` id = slide-object index + 2).\n * @param {PresSlideInternal} slide - the slide to inspect for looping media\n * @returns {string} the `<p:timing>` XML, or `''` when no media loops\n */\nexport function slideTimingToXml(slide: PresSlideInternal): string {\n\tconst loopMedia = slide._slideObjects.filter(\n\t\t(obj) =>\n\t\t\tobj._type === SlideObjectType.media &&\n\t\t\tobj.mtype !== 'online' &&\n\t\t\ttypeof obj.mediaRid === 'number' &&\n\t\t\t(obj.loop === true || (typeof obj.loopCount === 'number' && obj.loopCount > 0))\n\t)\n\n\t// Resolve preset build animations to their target shape ids. `collectSlideShapeIds` covers group\n\t// children as well as top-level objects, so `objectName` addresses any shape on the slide.\n\tconst shapeIds = collectSlideShapeIds(slide._slideObjects)\n\tconst animations = (slide._animations ?? [])\n\t\t.map((anim) => ({ anim, spid: resolveAnimationSpid(shapeIds, slide._slideObjects.length, anim) }))\n\t\t.filter((entry): entry is { anim: AnimationProps; spid: number } => entry.spid !== null)\n\n\tconst mediaNode = (obj: SlideObject, nodeId: number): string => {\n\t\t// spid must equal the picture's <p:cNvPr> id, which is the slide-object index + 2\n\t\t// (same basis as animation spids). Using mediaRid + 2 here desyncs from the shape id\n\t\t// and targets the wrong/nonexistent shape => PowerPoint reports the file corrupt.\n\t\tconst spid = slide._slideObjects.indexOf(obj) + 2\n\t\tconst repeatCount = obj.loop === true ? 'indefinite' : String(Math.round((obj.loopCount as number) * 1000))\n\t\t// EG_TimeNodeChoice: audio loops via <p:audio>, video via <p:video> (both CT_TLCommonMediaNodeData)\n\t\tconst mediaTag = obj.mtype === 'audio' ? 'p:audio' : 'p:video'\n\t\treturn el(\n\t\t\tmediaTag,\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:cMediaNode', null, [\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t{ id: nodeId, repeatCount, fill: 'hold', display: 0 },\n\t\t\t\t\t\t\traw(el('p:stCondLst', null, raw(voidEl('p:cond', { delay: 'indefinite' }))))\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\traw(el('p:tgtEl', null, raw(voidEl('p:spTgt', { spid })))),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t}\n\n\t// Media-only path: unchanged legacy output (`<p:cTn id=\"1\">` tmRoot, media nodes follow).\n\tif (animations.length === 0) {\n\t\tif (loopMedia.length === 0) return ''\n\t\tlet nodeId = 1\n\t\tconst mediaNodes = loopMedia.map((obj) => mediaNode(obj, (nodeId += 1))).join('')\n\t\treturn el(\n\t\t\t'p:timing',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:tnLst',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:par',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t\t\t{ id: 1, dur: 'indefinite', restart: 'never', nodeType: 'tmRoot' },\n\t\t\t\t\t\t\t\t\traw(el('p:childTnLst', null, raw(mediaNodes)))\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\t)\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t}\n\n\t// Animation path: a `mainSeq` of preset effects (plus any looping media as sibling nodes).\n\t// A monotonically increasing id is assigned to every `<p:cTn>` in document order, matching\n\t// how PowerPoint numbers the tree (tmRoot=1, mainSeq=2, then wrappers/effects/behaviors).\n\tlet id = 2 // tmRoot=1, mainSeq=2 are fixed\n\tconst next = (): number => (id += 1)\n\n\tconst seq = buildAnimationSeq(animations, next)\n\tconst mediaNodes = loopMedia.map((obj) => mediaNode(obj, next())).join('')\n\tconst bldLst = buildBldList(animations)\n\n\treturn el('p:timing', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:tnLst',\n\t\t\t\tnull,\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:par',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t'p:cTn',\n\t\t\t\t\t\t\t\t{ id: 1, dur: 'indefinite', restart: 'never', nodeType: 'tmRoot' },\n\t\t\t\t\t\t\t\traw(el('p:childTnLst', null, raw(seq + mediaNodes)))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(bldLst),\n\t])\n}\n","/**\n * ts-pptx: slide-show transitions\n *\n * Build the `<p:transition>` tree (positioned in CT_Slide between `p:clrMapOvr`\n * and `p:timing`): the transition-type element, its optional sound action, and\n * the `mc:AlternateContent` envelope that carries an exact `p14:dur`.\n */\n\nimport type { TransitionProps } from '../../types/index.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\n\n/** Map a `ST_TransitionSpeed`-less exact duration (ms) to PowerPoint's coarse `spd` bucket. */\nfunction transitionSpeedForDuration(durationMs: number): 'slow' | 'med' | 'fast' {\n\tif (durationMs <= 500) return 'fast'\n\tif (durationMs <= 1000) return 'med'\n\treturn 'slow'\n}\n\n/**\n * Build the slide-show transition tree (`p:transition`), positioned in `CT_Slide`\n * between `p:clrMapOvr` and `p:timing`. Emits PowerPoint's `mc:AlternateContent`\n * form (a `p14` Choice carrying the exact `p14:dur`, plus a base `mc:Fallback`)\n * when `durationMs` is set, and the bare `<p:transition>` otherwise. See\n * `docs/animations-and-transitions.md`.\n * @returns {string} the transition XML, or `''` when the slide has no transition\n */\n/**\n * Build the `p:sndAc` sound-action child of `p:transition` (positioned after the\n * transition-type element). A start sound is `<p:stSnd [loop=\"1\"]><p:snd r:embed\n * name/></p:stSnd>` referencing the embedded WAV by the relationship id stamped on\n * `transition._sndRId`; the stop-previous form is `<p:endSnd/>` (no rel). Returns\n * `''` when the transition has no sound.\n */\nfunction transitionSoundToXml(transition: TransitionProps): string {\n\tconst sound = transition.sound\n\tif (!sound) return ''\n\tif (sound.stopPrevious) return el('p:sndAc', null, raw(voidEl('p:endSnd')))\n\tif (typeof transition._sndRId !== 'number') return '' // no embedded part registered\n\treturn el(\n\t\t'p:sndAc',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:stSnd',\n\t\t\t\t{ loop: sound.loop ? '1' : null },\n\t\t\t\traw(voidEl('p:snd', { 'r:embed': `rId${transition._sndRId}`, name: sound.name || null }))\n\t\t\t)\n\t\t)\n\t)\n}\n\nexport function slideTransitionToXml(slide: PresSlideInternal): string {\n\tconst transition = slide.transition\n\tif (!transition?.type) return ''\n\n\tconst typeEl = voidEl(`p:${transition.type}`, transition.variant ?? null)\n\tconst sndAc = transitionSoundToXml(transition)\n\n\tconst hasDuration = typeof transition.durationMs === 'number' && isFinite(transition.durationMs)\n\tconst speed = transition.speed ?? (hasDuration ? transitionSpeedForDuration(transition.durationMs as number) : null)\n\tconst baseAttrs: XmlAttrs = {\n\t\tspd: speed || null,\n\t\tadvClick: transition.advanceOnClick === false ? '0' : null,\n\t\tadvTm: typeof transition.advanceAfterMs === 'number' ? Math.round(transition.advanceAfterMs) : null,\n\t}\n\n\tif (!hasDuration) return el('p:transition', baseAttrs, [raw(typeEl), raw(sndAc)])\n\n\tconst dur = Math.round(transition.durationMs as number)\n\treturn el('mc:AlternateContent', { 'xmlns:mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006' }, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'mc:Choice',\n\t\t\t\t{ 'xmlns:p14': 'http://schemas.microsoft.com/office/powerpoint/2010/main', Requires: 'p14' },\n\t\t\t\traw(el('p:transition', { ...baseAttrs, 'p14:dur': dur }, [raw(typeEl), raw(sndAc)]))\n\t\t\t)\n\t\t),\n\t\traw(el('mc:Fallback', null, raw(el('p:transition', baseAttrs, [raw(typeEl), raw(sndAc)])))),\n\t])\n}\n","/**\n * ts-pptx: DrawingML value clamps\n *\n * Clamp font/character/line spacing values (points) into their ST_* schema\n * ranges and convert to the hundredths-of-a-point units the attributes expect.\n * Out-of-range values make PowerPoint report the package as needing repair.\n */\n\nimport { EMU_PER_POINT, HUNDREDTHS_PER_POINT, ptToHundredths } from '../../units.js'\nimport { valToPts } from '../../units-internal.js'\nimport { warnOnce } from '../../diagnostics.js'\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 */\nexport function clampFontSizeSz(fontSizePts: number): number {\n\tconst raw = ptToHundredths(fontSizePts)\n\tconst clamped = Math.min(400000, Math.max(100, raw))\n\tif (clamped !== raw)\n\t\twarnOnce(\n\t\t\t'font/size-out-of-range',\n\t\t\t`fontSize ${fontSizePts} is outside the valid range 1-4000pt; using ${clamped / HUNDREDTHS_PER_POINT}.`\n\t\t)\n\treturn clamped\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\tconst raw = ptToHundredths(charSpacingPts)\n\tconst clamped = Math.min(400000, Math.max(-400000, raw))\n\tif (clamped !== raw)\n\t\twarnOnce(\n\t\t\t'text/char-spacing-out-of-range',\n\t\t\t`charSpacing ${charSpacingPts} is outside the valid range -4000..4000pt; using ${clamped / HUNDREDTHS_PER_POINT}.`\n\t\t)\n\treturn clamped\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\tconst raw = valToPts(marginPts)\n\tconst clamped = Math.min(51206400, Math.max(0, raw))\n\tif (clamped !== raw)\n\t\twarnOnce(\n\t\t\t'text/paragraph-margin-out-of-range',\n\t\t\t`paraMarginLeft ${marginPts} is outside the valid range 0-4032pt; using ${clamped / EMU_PER_POINT}.`\n\t\t)\n\treturn clamped\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\tconst raw = valToPts(indentPts)\n\tconst clamped = Math.min(51206400, Math.max(-51206400, raw))\n\tif (clamped !== raw)\n\t\twarnOnce(\n\t\t\t'text/paragraph-indent-out-of-range',\n\t\t\t`paraIndent ${indentPts} is outside the valid range -4032..4032pt; using ${clamped / EMU_PER_POINT}.`\n\t\t)\n\treturn clamped\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\tconst raw = ptToHundredths(lineSpacingPts)\n\tconst clamped = Math.min(158400, Math.max(0, raw))\n\tif (clamped !== raw)\n\t\twarnOnce(\n\t\t\t'text/line-spacing-out-of-range',\n\t\t\t`lineSpacing ${lineSpacingPts} is outside the valid range 0-1584pt; using ${clamped / HUNDREDTHS_PER_POINT}.`\n\t\t)\n\treturn clamped\n}\n","/**\n * ts-pptx: DrawingML object-lock serialization\n *\n * Emit the `a:spLocks` / `a:picLocks` / `a:graphicFrameLocks` / group-shape lock\n * elements. Each locking element type supports a different set of flags; the\n * `*_LOCK_ATTRS` tables list the valid attribute names in ECMA-376 emit order.\n */\n\nimport type { ObjectLockProps } from '../../types/index.js'\nimport { voidEl } from '../oxml/el.js'\nimport { warn } from '../../diagnostics.js'\n\n// Object lock attributes valid for each DrawingML locking element, in emit order (ECMA-376 §20.1.2.2.x / §20.1.2.2.34).\n// Object keys in `ObjectLockProps` mirror these attribute names 1:1, so serialization is a filtered lookup.\nexport const SHAPE_LOCK_ATTRS = [\n\t'noGrp',\n\t'noSelect',\n\t'noRot',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n\t'noEditPoints',\n\t'noAdjustHandles',\n\t'noChangeArrowheads',\n\t'noChangeShapeType',\n\t'noTextEdit',\n] as const\nexport const PICTURE_LOCK_ATTRS = [\n\t'noGrp',\n\t'noSelect',\n\t'noRot',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n\t'noEditPoints',\n\t'noAdjustHandles',\n\t'noChangeArrowheads',\n\t'noChangeShapeType',\n\t'noCrop',\n] as const\nexport const GRAPHIC_FRAME_LOCK_ATTRS = [\n\t'noGrp',\n\t'noDrilldown',\n\t'noSelect',\n\t'noChangeAspect',\n\t'noMove',\n\t'noResize',\n] as const\nexport const GROUP_SHAPE_LOCK_ATTRS = ['noGrp', 'noSelect', 'noRot', 'noChangeAspect', 'noMove', 'noResize'] as const\n\n/**\n * Serialize an object-lock element (`a:spLocks` / `a:picLocks` / `a:graphicFrameLocks`).\n * Only flags set to `true` AND valid for this element type are emitted; a flag set on an\n * unsupported element type is dropped with a warning (silent coercion is a footgun).\n * @param tag - locking element tag, e.g. `'a:spLocks'`\n * @param allowed - attribute names this element type supports, in desired emit order\n * @param locks - merged lock flags (callers fold any hard-coded default in first)\n * @param objectName - for the warning message\n * @returns the locking element string, or `''` when no applicable flag is set\n */\nexport function genXmlObjectLock(\n\ttag: string,\n\tallowed: readonly string[],\n\tlocks: ObjectLockProps | undefined,\n\tobjectName?: string\n): string {\n\tif (!locks) return ''\n\tconst lockMap = locks as Record<string, boolean | undefined>\n\tfor (const key of Object.keys(lockMap)) {\n\t\tif (lockMap[key] && !allowed.includes(key)) {\n\t\t\twarn(\n\t\t\t\t'object-lock/unsupported-on-shape',\n\t\t\t\t`objectLock.${key} is not supported on <${tag}> (object \"${objectName ?? ''}\") and was ignored.`\n\t\t\t)\n\t\t}\n\t}\n\tconst set = allowed.filter((name) => lockMap[name] === true)\n\treturn set.length > 0 ? voidEl(tag, Object.fromEntries(set.map((name) => [name, '1']))) : ''\n}\n","/**\n * ts-pptx: helpers shared by more than one slide-object renderer\n *\n * The `<p:cNvPr>` open tag, 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 { HyperlinkProps, ShapeLineProps } from '../../../types/index.js'\nimport { encodeXmlAttrValue } from '../../utils.js'\nimport { createLineCap, genXmlLineFill } from '../../drawingml/line.js'\nimport { lineWidthToEmu } from '../../../units-internal.js'\nimport { el, raw, voidEl } from '../../oxml/el.js'\n\n/** PowerPoint 2010 (`p14`) namespace — carries `<p14:modId>` and `<p14:media>`. */\nexport const P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main'\n/** Markup-compatibility namespace, declared by every `<mc:AlternateContent>` this module's callers emit. */\nexport const MC_NS = 'http://schemas.openxmlformats.org/markup-compatibility/2006'\n\n/**\n * The `<p:cNvPr>` OPEN tag shared by every shape renderer. Callers append `/>` or\n * `>`+children+`</p:cNvPr>` — the element is self-closing for some shape kinds and paired\n * (hyperlink / media-action children) for others.\n *\n * NOT built with the element builder, deliberately. `descr` is escaped here but `name` is **not**,\n * and that asymmetry is intentional and load-bearing: `objectName` is caller-supplied free text,\n * but every `add*Definition` (text.ts, shape.ts, image.ts, chart.ts, media.ts, connector.ts,\n * group.ts, table.ts) already runs it through `encodeXmlAttrValue(validateObjectName(...))` once\n * before it reaches a slide object's `options`. Escaping it again here would double-encode it\n * (`'Q&A'` -> `Q&amp;A` upstream -> `Q&amp;amp;A` if escaped here too). This helper exists so that\n * single escape stays one line in one place instead of eight call sites re-deriving it.\n * @param id - the shape's `<p:cNvPr>` id, unique slide-wide\n * @param name - caller-supplied `objectName`, already escaped once upstream (emitted as-is)\n * @param descr - alt text (escaped)\n * @param openPrefix - byte-significant indentation before `<p:cNvPr`\n * @returns the open tag, without its closing delimiter\n */\nexport function cNvPrOpen(id: number, name: string | undefined, descr: string, openPrefix = ''): string {\n\treturn `${openPrefix}<p:cNvPr id=\"${id}\" name=\"${name}\" descr=\"${encodeXmlAttrValue(descr)}\"`\n}\n\n/**\n * The `<a:hlinkClick>` children of a shape's `<p:cNvPr>` — a URL link and/or a jump to another\n * slide. Shared by the text and image renderers, which emitted identical copies.\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, one or two `<a:hlinkClick>` elements\n */\nexport function cNvPrHyperlink(link: HyperlinkProps | undefined): string {\n\tif (!link) return ''\n\tconst tooltip = link.tooltip ?? ''\n\treturn (\n\t\t(link.url ? voidEl('a:hlinkClick', { 'r:id': `rId${link._rId}`, tooltip }) : '') +\n\t\t(link.slide\n\t\t\t? voidEl('a:hlinkClick', { 'r:id': `rId${link._rId}`, tooltip, action: 'ppaction://hlinksldjump' })\n\t\t\t: '') +\n\t\t// Action buttons: a self-contained slide-show navigation action. No relationship, so `r:id`\n\t\t// is emitted empty (schema-optional on CT_Hyperlink; matches PowerPoint's own output).\n\t\t(link.action\n\t\t\t? voidEl('a:hlinkClick', { 'r:id': '', tooltip, action: `ppaction://hlinkshowjump?jump=${link.action}` })\n\t\t\t: '')\n\t)\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('a:ln', { w: ln.width ? lineWidthToEmu(ln.width) : null, cap: ln.cap ? createLineCap(ln.cap) : null }, [\n\t\traw(genXmlLineFill(ln)),\n\t\tln.dashType ? raw(voidEl('a:prstDash', { val: ln.dashType })) : null,\n\t\tln.beginArrowType ? raw(voidEl('a:headEnd', { type: ln.beginArrowType })) : null,\n\t\tln.endArrowType ? raw(voidEl('a:tailEnd', { type: ln.endArrowType })) : null,\n\t])\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'\n\nconst M_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/math'\nconst A14_NS = 'http://schemas.microsoft.com/office/drawing/2010/main'\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': A14_NS, 'xmlns:m': M_NS }, 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, TableCell, TextFitShrinkProps, TextProps, TextPropsOptions } from '../../types/index.js'\nimport type { SlideObject } from '../../types/internal.js'\nimport { createColorElement } from './color.js'\nimport { createGlowElement, createShadowElement } from './effect.js'\nimport { genXmlColorSelection } from './fill.js'\nimport { inch2Emu, lineWidthToEmu, valToPts } from '../../units-internal.js'\nimport { FIXED_PCT_PER_PERCENT, PERCENT_SCALE, ptToHundredths } from '../../units.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport {\n\tclampCharSpacingSpc,\n\tclampFontSizeSz,\n\tclampLineSpacingPts,\n\tclampParaIndentEmu,\n\tclampParaMarginEmu,\n} from './clamp.js'\nimport { genXmlInlineMath, genXmlMathParagraph } from './math.js'\nimport { InvalidOptionError } from '../../errors.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:buChar>` cannot go through the element builder. Its `char` attribute carries a *pre-escaped*\n * numeric character reference (`&#x2022;` — see `BulletType`), and the builder escapes every\n * attribute value, which would emit `&amp;#x2022;` and render that text literally as the bullet.\n * There is no raw-attribute escape hatch, so this one stays a template.\n */\nfunction buChar(char: string): string {\n\treturn `<a:buChar char=\"${char}\"/>`\n}\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 * @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 === undefined) return fallbackEmu\n\tif (option === 'inherit') return null\n\treturn clamp(option)\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 = valToPts(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\n\t\tif (opts.align) {\n\t\t\tswitch (opts.align) {\n\t\t\t\tcase 'left':\n\t\t\t\t\tparagraphPropXml += ' algn=\"l\"'\n\t\t\t\t\tbreak\n\t\t\t\tcase 'right':\n\t\t\t\t\tparagraphPropXml += ' algn=\"r\"'\n\t\t\t\t\tbreak\n\t\t\t\tcase 'center':\n\t\t\t\t\tparagraphPropXml += ' algn=\"ctr\"'\n\t\t\t\t\tbreak\n\t\t\t\tcase 'justify':\n\t\t\t\t\tparagraphPropXml += ' algn=\"just\"'\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tparagraphPropXml += ''\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (opts.lineSpacing) {\n\t\t\tstrXmlLnSpc = el('a:lnSpc', null, raw(voidEl('a:spcPts', { val: clampLineSpacingPts(opts.lineSpacing) })))\n\t\t} else if (opts.lineSpacingMultiple) {\n\t\t\tconst val = Math.round(opts.lineSpacingMultiple * PERCENT_SCALE)\n\t\t\tstrXmlLnSpc = el('a:lnSpc', null, raw(voidEl('a:spcPct', { val })))\n\t\t}\n\n\t\t// OPTION: indent\n\t\tif (opts.indentLevel && !isNaN(Number(opts.indentLevel)) && opts.indentLevel > 0) {\n\t\t\tparagraphPropXml += ` lvl=\"${opts.indentLevel}\"`\n\t\t}\n\n\t\t// OPTION: Paragraph Spacing: Before/After\n\t\tif (opts.paraSpaceBefore && !isNaN(Number(opts.paraSpaceBefore)) && opts.paraSpaceBefore > 0) {\n\t\t\tstrXmlParaSpc += el('a:spcBef', null, raw(voidEl('a:spcPts', { val: ptToHundredths(opts.paraSpaceBefore) })))\n\t\t}\n\t\tif (opts.paraSpaceAfter && !isNaN(Number(opts.paraSpaceAfter)) && opts.paraSpaceAfter > 0) {\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\tconst bulletImage = opts.bullet.image\n\t\t\tconst isPictureBullet = !!(bulletImage && (bulletImage.path || bulletImage.data))\n\t\t\tif (opts.bullet?.indent) bulletMarL = valToPts(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 = opts.indentLevel && opts.indentLevel > 0 ? bulletMarL + bulletMarL * opts.indentLevel : bulletMarL\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\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\tlet bulletSizePct: number | undefined\n\t\t\tif (opts.bullet.size !== undefined) {\n\t\t\t\tconst bulletSize = Number(opts.bullet.size)\n\t\t\t\t// 25–400% is the range PowerPoint's bullet-size dialog accepts (and the\n\t\t\t\t// range `<a:buSzPct>` renders sensibly); values outside it are rejected\n\t\t\t\t// rather than clamped so the caller notices the bad input.\n\t\t\t\tif (isNaN(bulletSize) || bulletSize < 25 || bulletSize > 400) {\n\t\t\t\t\twarn('bullet/size-out-of-range', '`bullet.size` must be a percentage between 25 and 400!')\n\t\t\t\t} else {\n\t\t\t\t\tbulletSizePct = Math.round(bulletSize * FIXED_PCT_PER_PERCENT)\n\t\t\t\t}\n\t\t\t}\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 (opts.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 = opts.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': 'http://schemas.microsoft.com/office/drawing/2016/SVG/main',\n\t\t\t\t\t\t\t\t\t\t\t\t'r:embed': `rId${opts.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 = svgExt\n\t\t\t\t\t\t? el('a:blip', { 'r:embed': `rId${opts.bullet._rId}` }, raw(svgExt))\n\t\t\t\t\t\t: voidEl('a:blip', { 'r:embed': `rId${opts.bullet._rId}` })\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 + buChar(BulletType.DEFAULT)\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\tvoidEl('a:buAutoNum', {\n\t\t\t\t\t\ttype: opts.bullet.numberType || 'arabicPeriod',\n\t\t\t\t\t\tstartAt: opts.bullet.numberStartAt || '1',\n\t\t\t\t\t})\n\t\t\t} else if (opts.bullet.characterCode) {\n\t\t\t\tlet bulletCode = `&#x${opts.bullet.characterCode};`\n\n\t\t\t\t// Check value for hex-ness (s/b 4 char hex)\n\t\t\t\tif (!/^[0-9A-Fa-f]{4}$/.test(opts.bullet.characterCode)) {\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'bullet/invalid-character-code',\n\t\t\t\t\t\t'`bullet.characterCode` should be a 4-digit unicode character (ex: 22AB)!'\n\t\t\t\t\t)\n\t\t\t\t\tbulletCode = BulletType.DEFAULT\n\t\t\t\t}\n\n\t\t\t\tstrXmlBullet = strXmlBulletSize + strXmlBulletFont + buChar(bulletCode)\n\t\t\t} else {\n\t\t\t\tstrXmlBullet = strXmlBulletSize + strXmlBulletFont + buChar(BulletType.DEFAULT)\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 = opts.indentLevel && opts.indentLevel > 0 ? bulletMarL + bulletMarL * opts.indentLevel : bulletMarL\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 = buChar(BulletType.DEFAULT)\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) => voidEl('a:tab', { pos: inch2Emu(stop.position || 1), algn: stop.alignment || 'l' }))\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\tconst underline =\n\t\ttypeof opts.underline === 'object' && opts.underline?.style ? opts.underline.style : opts.hyperlink ? 'sng' : 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: opts.fontSize ? clampFontSizeSz(opts.fontSize) : 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: opts?.bold ? '1' : null,\n\t\ti: opts?.italic ? '1' : null,\n\t\tstrike: opts?.strike ? (typeof opts.strike === 'string' ? opts.strike : 'sngStrike') : null,\n\t\tcap: opts?.caps ? opts.caps : null,\n\t\tu: underline,\n\t\tbaseline,\n\t\tspc: opts.charSpacing ? clampCharSpacingSpc(opts.charSpacing) : 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(opts.outline.size || 0.75) },\n\t\t\t\traw(genXmlColorSelection(opts.outline.color || 'FFFFFF'))\n\t\t\t)\n\t\t}\n\t\tif (opts.color) runProps += genXmlColorSelection({ color: opts.color, transparency: 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\tif (opts.highlight) runProps += el('a:highlight', null, raw(createColorElement(opts.highlight)))\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\tif (typeof opts.hyperlink !== 'object')\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'hyperlink/not-an-object',\n\t\t\t\t\"text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` \"\n\t\t\t)\n\t\telse if (!opts.hyperlink.url && !opts.hyperlink.slide && !opts.hyperlink.action)\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'hyperlink/missing-target',\n\t\t\t\t'text `hyperlink` requires either `url`, `slide`, or `action`'\n\t\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\telse if (opts.hyperlink.url || opts.hyperlink.slide) {\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${opts.hyperlink._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${opts.hyperlink._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 += opts.color\n\t\t\t\t? el('a:hlinkClick', linkAttrs, raw(HLINK_TEXT_COLOR_EXT))\n\t\t\t\t: voidEl('a:hlinkClick', linkAttrs)\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// NOTE: fontScale/lnSpcReduction are authored as a percent (0-100); OOXML stores them in 1000ths of a percent.\n\tconst pct = (val: number | undefined, name: string): number | null => {\n\t\tif (val === undefined || val === null) return null\n\t\tif (typeof val !== 'number' || isNaN(val) || val < 0 || val > 100) {\n\t\t\twarn(\n\t\t\t\t'text/invalid-fit-percentage',\n\t\t\t\t`fit.${name} must be a number between 0 and 100 (percent); received ${String(val)} - attribute ignored.`\n\t\t\t)\n\t\t\treturn null\n\t\t}\n\t\treturn Math.round(val * FIXED_PCT_PER_PERCENT)\n\t}\n\n\t// `pct` returns null for an absent/rejected 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: TextPropsOptions }\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: ObjectOptions): 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 * 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 | TableCell,\n\topts: ObjectOptions\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\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\ttextObj.options.align = textObj.options.align || opts.align\n\t\t\ttextObj.options.lineSpacing = textObj.options.lineSpacing || opts.lineSpacing\n\t\t\ttextObj.options.lineSpacingMultiple = textObj.options.lineSpacingMultiple || opts.lineSpacingMultiple\n\t\t\ttextObj.options.indentLevel = textObj.options.indentLevel || opts.indentLevel\n\t\t\ttextObj.options.paraSpaceBefore = textObj.options.paraSpaceBefore || opts.paraSpaceBefore\n\t\t\ttextObj.options.paraSpaceAfter = textObj.options.paraSpaceAfter || opts.paraSpaceAfter\n\t\t\t// `??`, not `||`, on these two: `0` is a meaningful margin (flush with the frame, and\n\t\t\t// the override that suppresses a bullet's hanging indent), where the options above have\n\t\t\t// no zero worth stating. A falsy test would silently swap a run's explicit `0` for the\n\t\t\t// shape's value.\n\t\t\ttextObj.options.paraMarginLeft = textObj.options.paraMarginLeft ?? opts.paraMarginLeft\n\t\t\ttextObj.options.paraIndent = textObj.options.paraIndent ?? opts.paraIndent\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 any main options (color, fontSize, etc.)\n\t\t\t// NOTE: We only pass the text.options to genXmlTextRun (not the Slide.options),\n\t\t\t// so the run building function cant just fallback to Slide.color, therefore, we need to do that here before passing options below.\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\tObject.entries(opts)\n\t\t\t\t.filter(([key]) => !(textObj.options.hyperlink && key === 'color'))\n\t\t\t\t.forEach(([key, val]) => {\n\t\t\t\t\t// NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything\n\t\t\t\t\tif (key !== 'bullet' && !textOptions[key]) textOptions[key] = val\n\t\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\tif ((!textObj.text && opts.fontSize) || textObj.options.fontSize) {\n\t\t\t\treqsClosingFontSize = true\n\t\t\t\topts.fontSize = opts.fontSize || 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: opts.fontSize ? clampFontSizeSz(opts.fontSize) : null,\n\t\t\tdirty: '0',\n\t\t})\n\t\tif (slideObj._type === SlideObjectType.tablecell && (opts.fontSize || 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 text body\n *\n * The container layer over `text-run.ts`: body properties (`<a:bodyPr>`), the\n * full `<p:txBody>`/`<a:txBody>` builder (`genXmlTextBody`), the native-equation\n * predicate, and the placeholder `<p:ph>` element.\n */\n\nimport { PlaceholderType, SlideObjectType } from '../../enums.js'\nimport { CRLF } from '../../constants-internal.js'\nimport type { ObjectOptions, TableCell, TextProps } from '../../types/index.js'\nimport type { SlideObject } from '../../types/internal.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport {\n\tgenXmlNormAutofit,\n\tgenXmlParagraphProperties,\n\tgroupRunsIntoLines,\n\trenderTextParagraphsXml,\n\ttype RunProps,\n} from './text-run.js'\n\nconst PLACEHOLDER_TYPE_MAP = PlaceholderType as Record<string, string>\n\n/**\n * Builds `<a:bodyPr></a:bodyPr>` tag for \"genXmlTextBody()\"\n * @param {SlideObject | TableCell} slideObject - various options\n * @return {string} XML string\n */\nfunction genXmlBodyProperties(slideObject: SlideObject | TableCell): string {\n\t// A table cell always emits bare body properties, whatever else is configured. (This used to be\n\t// a ternary on the return, which built the full element first and then threw it away.)\n\tif (slideObject._type === SlideObjectType.tablecell) return voidEl('a:bodyPr')\n\n\t// Placeholders (incl. master/layout placeholders) carry their margin/valign in `_bodyProp` just\n\t// like text boxes, so they must emit the same configured `<a:bodyPr>` — otherwise a placeholder\n\t// authored with insets or a vertical anchor silently degrades to the default.\n\t// `_bodyProp`/`options` are optional on the type but present on text/placeholder objects that reach\n\t// this branch; bind them once so the body reads a narrowed, non-undefined value.\n\tconst options = (slideObject as SlideObject).options\n\tconst bodyProp = options?._bodyProp\n\tif (\n\t\t!slideObject ||\n\t\t(slideObject._type !== SlideObjectType.text && slideObject._type !== SlideObjectType.placeholder) ||\n\t\t!bodyProp\n\t) {\n\t\t// DEFAULT: paired, not self-closing — `<a:bodyPr .../>` would be a byte change.\n\t\treturn el('a:bodyPr', { wrap: 'square', rtlCol: '0' })\n\t}\n\n\t// PPT-2019 EX: <a:bodyPr wrap=\"square\" lIns=\"1270\" tIns=\"1270\" rIns=\"1270\" bIns=\"1270\" rtlCol=\"0\" anchor=\"ctr\"/>\n\t// NOTE: attribute ORDER is byte-significant; `rtlCol` sits after the margins and columns but\n\t// before the anchor points, which is why this is one ordered literal rather than grouped writes.\n\tconst attrs: XmlAttrs = {\n\t\t// A: Enable or disable textwrapping none or square\n\t\twrap: bodyProp.wrap ? 'square' : 'none',\n\t\t// B: Textbox margins [padding] — an explicit zero is meaningful, so test for it separately\n\t\tlIns: bodyProp.lIns || bodyProp.lIns === 0 ? bodyProp.lIns : null,\n\t\ttIns: bodyProp.tIns || bodyProp.tIns === 0 ? bodyProp.tIns : null,\n\t\trIns: bodyProp.rIns || bodyProp.rIns === 0 ? bodyProp.rIns : null,\n\t\tbIns: bodyProp.bIns || bodyProp.bIns === 0 ? bodyProp.bIns : null,\n\t\t// C.1: Text columns (numCol/spcCol). Spacing is only meaningful when there is more than one column.\n\t\tnumCol: bodyProp.numCol ? bodyProp.numCol : null,\n\t\tspcCol: bodyProp.spcCol ? bodyProp.spcCol : null,\n\t\t// C: Add rtl after margins\n\t\trtlCol: '0',\n\t\t// D: Add anchorPoints\n\t\tanchor: bodyProp.anchor ? bodyProp.anchor : null, // VALS: [t,ctr,b]\n\t\tvert: bodyProp.vert ? bodyProp.vert : null, // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]\n\t}\n\n\tconst children: string[] = []\n\n\t// E.1: Preset text warp (`<a:prstTxWarp>`). Per CT_TextBodyProperties this child\n\t// comes before the autofit group, so emit it immediately after the attributes.\n\t// NOTE: this `<a:avLst/>` has NO space before the slash, unlike the one `custGeom` writes.\n\tif (bodyProp.prstTxWarp) {\n\t\tchildren.push(el('a:prstTxWarp', { prst: bodyProp.prstTxWarp }, raw(voidEl('a:avLst'))))\n\t}\n\n\t/**\n\t * F: Text Fit/AutoFit/Shrink option\n\t * @see: http://officeopenxml.com/drwSp-text-bodyPr-fit.php\n\t * @see: http://www.datypic.com/sc/ooxml/g-a_EG_TextAutofit.html\n\t */\n\tif (options?.fit) {\n\t\tconst fit = options.fit\n\t\t// NOTE: Use of '<a:noAutofit/>' instead of '' causes issues in PPT-2013! ('none' emits nothing.)\n\t\t// NOTE: Bare shrink does not work automatically - PowerPoint calculates fontScale/lnSpcReduction dynamically upon edit/resize.\n\t\t// The object form bakes explicit values into the file (MS-PPT > Format shape > Text Options: \"Shrink text on overflow\").\n\t\tif (fit === 'shrink') children.push(voidEl('a:normAutofit'))\n\t\telse if (fit === 'resize') children.push(voidEl('a:spAutoFit'))\n\t\telse if (typeof fit === 'object' && fit.type === 'shrink') children.push(genXmlNormAutofit(fit))\n\t}\n\n\treturn el('a:bodyPr', attrs, children.map(raw))\n}\n\n/** Whether a slide object carries a native equation (`math` raw OMML) on any of its text items. */\nexport function objectHasMath(slideObj: SlideObject): boolean {\n\tconst text = slideObj.text as TextProps | TextProps[] | string | number | undefined\n\tif (Array.isArray(text)) return text.some((item) => item && typeof item === 'object' && !!item.math)\n\tif (text && typeof text === 'object') return !!text.math\n\treturn false\n}\n\n/**\n * Generate the XML for text and its options (bold, bullet, etc) including text runs (word-level formatting)\n * @param {SlideObject|TableCell} slideObj - slideObj or tableCell\n * @note PPT text lines [lines followed by line-breaks] are created using <p>-aragraph's\n * @note Bullets are a paragragh-level formatting device\n * @template\n * <p:txBody>\n * <a:bodyPr wrap=\"square\" rtlCol=\"0\">\n * <a:spAutoFit/>\n * </a:bodyPr>\n * <a:lstStyle/>\n * <a:p>\n * <a:pPr algn=\"ctr\"/>\n * <a:r>\n * <a:rPr lang=\"en-US\" dirty=\"0\" err=\"1\"/>\n * <a:t>textbox text</a:t>\n * </a:r>\n * <a:endParaRPr lang=\"en-US\" dirty=\"0\"/>\n * </a:p>\n * </p:txBody>\n * @returns XML containing the param object's text and formatting\n */\nexport function genXmlTextBody(slideObj: SlideObject | TableCell): string {\n\tconst opts: ObjectOptions = slideObj.options || {}\n\tlet tmpTextObjects: TextProps[] = []\n\tconst arrTextObjects: RunProps[] = []\n\n\t// FIRST: Shapes without text reach this point with `slideObj.text` null/undefined.\n\t// We MUST still emit a `<p:txBody>` with at least an empty `<a:p>` paragraph;\n\t// the empty-txBody fallback below appends `<a:p><a:endParaRPr/></a:p>` when no\n\t// `<a:p>` was produced. Returning early here would emit `<p:sp>` without\n\t// `<p:txBody>`, which PowerPoint reports as a needs-repair error.\n\n\t// STEP 1: Accumulate the body's children; the `<p:txBody>`/`<a:txBody>` wrapper closes over\n\t// them in STEP 7.\n\tlet strSlideXml = ''\n\n\t// STEP 2: Add bodyProperties\n\t{\n\t\t// A: 'bodyPr'\n\t\tstrSlideXml += genXmlBodyProperties(slideObj)\n\n\t\t// B: 'lstStyle'\n\t\t// NOTE: shape type 'LINE' has different text align needs (a lstStyle.lvl1pPr between bodyPr and p)\n\t\t// KNOWN LIMITATION: horizontal align on a LINE does not work — text is always left-aligned inside the line.\n\t\tif (opts.h === 0 && opts.line && opts.align)\n\t\t\tstrSlideXml += el('a:lstStyle', null, raw(voidEl('a:lvl1pPr', { algn: 'l' })))\n\t\telse if (slideObj._type === SlideObjectType.placeholder)\n\t\t\tstrSlideXml += el('a:lstStyle', null, raw(genXmlParagraphProperties(slideObj, true)))\n\t\telse strSlideXml += voidEl('a:lstStyle')\n\t}\n\n\t/* STEP 3: Modify slideObj.text to array\n\t\tCASES:\n\t\taddText( 'string' ) // string\n\t\taddText( 'line1\\n line2' ) // string with lineBreak\n\t\taddText( {text:'word1'} ) // TextProps object\n\t\taddText( ['barry','allen'] ) // array of strings\n\t\taddText( [{text:'word1'}, {text:'word2'}] ) // TextProps object array\n\t\taddText( [{text:'line1\\n line2'}, {text:'end word'}] ) // TextProps object array with lineBreak\n\t*/\n\tif (typeof slideObj.text === 'string' || typeof slideObj.text === 'number') {\n\t\t// Handle cases 1,2\n\t\ttmpTextObjects.push({ text: slideObj.text.toString(), options: opts || {} })\n\t} else if (\n\t\tslideObj.text &&\n\t\t!Array.isArray(slideObj.text) &&\n\t\ttypeof slideObj.text === 'object' &&\n\t\tObject.keys(slideObj.text).includes('text')\n\t) {\n\t\t// Handle case 3\n\t\ttmpTextObjects.push({\n\t\t\ttext: slideObj.text || '',\n\t\t\toptions: slideObj.options || {},\n\t\t\tmath: (slideObj.text as TextProps).math,\n\t\t\tinline: (slideObj.text as TextProps).inline,\n\t\t})\n\t} else if (Array.isArray(slideObj.text)) {\n\t\t// Handle cases 4,5,6\n\t\t// NOTE: use cast as text is TextProps[]|TableCell[] and their `options` dont overlap (they share the same TextBaseProps though)\n\t\t// `math` carries raw OMML for native equation paragraphs — preserved here so STEP 5/6 can isolate it.\n\t\ttmpTextObjects = (slideObj.text as TextProps[]).map((item) => ({\n\t\t\ttext: item.text,\n\t\t\toptions: item.options,\n\t\t\tmath: item.math,\n\t\t\tinline: item.inline,\n\t\t}))\n\t}\n\n\t// STEP 4: Iterate over text objects, set text/options, break into pieces if '\\n'/breakLine found\n\ttmpTextObjects.forEach((itext, idx) => {\n\t\tif (!itext.text) itext.text = ''\n\n\t\t// A: Set options\n\t\titext.options = itext.options || opts || {}\n\t\tif (idx === 0 && itext.options && !itext.options.bullet && opts.bullet) itext.options.bullet = opts.bullet\n\n\t\t// B: Cast to text-object and fix line-breaks (if needed)\n\t\tif (typeof itext.text === 'string' || typeof itext.text === 'number') {\n\t\t\t// 1: Convert \"\\n\" or any variation into CRLF\n\t\t\titext.text = itext.text.toString().replace(/\\r*\\n/g, CRLF)\n\t\t}\n\n\t\t// C: If text string has line-breaks, then create a separate text-object for each (much easier than dealing with split inside a loop below)\n\t\t// NOTE: Filter for trailing lineBreak prevents the creation of an empty textObj as the last item\n\t\tif (itext.text.includes(CRLF) && itext.text.match(/\\n$/g) === null) {\n\t\t\tconst lines = itext.text.split(CRLF)\n\t\t\tlines.forEach((line, lineIdx) => {\n\t\t\t\tconst isLast = lineIdx === lines.length - 1\n\t\t\t\t// Non-last pieces need a paragraph break after them (the \\n implies it).\n\t\t\t\t// The last piece inherits the caller's breakLine intent — do not mutate the original options object.\n\t\t\t\tarrTextObjects.push({\n\t\t\t\t\ttext: line,\n\t\t\t\t\toptions: { ...itext.options, breakLine: isLast ? itext.options?.breakLine : true },\n\t\t\t\t})\n\t\t\t})\n\t\t} else {\n\t\t\tarrTextObjects.push({ ...itext, options: itext.options ?? {} })\n\t\t}\n\t})\n\n\t// STEP 5: Group textObj into lines by checking for lineBreak, bullets, alignment change, etc.\n\tconst arrLines = groupRunsIntoLines(arrTextObjects, opts)\n\n\t// STEP 6: Loop over each line and create paragraph props, text run, etc.\n\tstrSlideXml += renderTextParagraphsXml(arrLines, slideObj, opts)\n\n\t// IMPORTANT: An empty txBody will cause \"needs repair\" error! Add <p> content if missing.\n\t// This fixes an issue with table auto-paging where some cells would be empty on subsequent pages.\n\t/*\n\t\t<a:txBody>\n\t\t\t<a:bodyPr/>\n\t\t\t<a:lstStyle/>\n\t\t</a:txBody>\n\t*/\n\t// NOTE: this scans the accumulated CHILDREN, which no longer include the opening `<p:txBody>`.\n\t// That does not change the result: neither `<a:bodyPr>` nor `<a:lstStyle>` can contain the\n\t// exact substring `<a:p>` (`<a:pPr`/`<a:lvl1pPr` do not match), so only real paragraphs do.\n\tif (!strSlideXml.includes('<a:p>')) {\n\t\tstrSlideXml += el('a:p', null, raw(voidEl('a:endParaRPr')))\n\t}\n\n\t// STEP 7: Close the textBody\n\t// LAST: Return XML\n\treturn el(slideObj._type === SlideObjectType.tablecell ? 'a:txBody' : 'p:txBody', null, raw(strSlideXml))\n}\n\n/**\n * Generate an XML Placeholder\n * @param {SlideObject} placeholderObj\n * @returns XML\n */\nexport function genXmlPlaceholder(placeholderObj: SlideObject | null): string {\n\tif (!placeholderObj) return ''\n\n\tconst placeholderIdx = placeholderObj.options?._placeholderIdx ? placeholderObj.options._placeholderIdx : ''\n\tconst placeholderTyp = placeholderObj.options?._placeholderType ? placeholderObj.options._placeholderType : ''\n\t// Normalize to the OOXML ST_PlaceholderType value, accepting either a friendly PlaceholderType\n\t// key ('image', 'table') or the mapped value ('pic', 'tbl') - the latter is what `PLACEHOLDER_TYPE`\n\t// actually declares. Unknown strings emit no type rather than an invalid attribute.\n\tconst placeholderType = PLACEHOLDER_TYPE_MAP[placeholderTyp]\n\t\t? PLACEHOLDER_TYPE_MAP[placeholderTyp].toString()\n\t\t: (Object.values(PlaceholderType) as string[]).includes(placeholderTyp)\n\t\t\t? placeholderTyp\n\t\t\t: ''\n\n\t// `hasCustomPrompt` flags a placeholder *definition* (layout/master) that carries custom\n\t// prompt text; it must not be set on a populated slide-level text shape promoted to a\n\t// placeholder, or PowerPoint would treat the visible text as prompt text.\n\tconst isPlaceholderDef = placeholderObj._type === SlideObjectType.placeholder\n\n\t// NOTE: `placeholderType` is already the mapped OOXML value (e.g. 'pic', 'tbl') validated on\n\t// the line above; do NOT re-look it up in PLACEHOLDER_TYPE_MAP (its keys are the input names,\n\t// not the mapped values), or the type attribute is silently dropped for image/table placeholders.\n\t//\n\t// NOT built with the element builder, deliberately. This template's own source indentation\n\t// reaches the file: attributes are separated by a newline + two tabs, each carries an extra\n\t// leading space, and an ABSENT attribute still emits its separator — so the whitespace depends\n\t// on which attributes are missing. `voidEl` joins attributes with exactly one space and omits\n\t// absent ones entirely, so this layout is not expressible. 105 baseline parts carry `<p:ph`,\n\t// so tidying it is a visible byte change and belongs in its own fixture-gated commit.\n\treturn `<p:ph\n\t\t${placeholderIdx ? ' idx=\"' + placeholderIdx.toString() + '\"' : ''}\n\t\t${placeholderType ? ` type=\"${placeholderType}\"` : ''}\n\t\t${isPlaceholderDef && placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt=\"1\"' : ''}\n\t\t/>`\n}\n","/**\n * ts-pptx: chart slide-object serialization\n *\n * Emits a `chart` slide object as the `<p:graphicFrame>` that references the chart part.\n * Classic charts emit that frame bare; chartEx charts wrap it in `<mc:AlternateContent>` with a\n * plain-shape `<mc:Fallback>` for consumers older than PowerPoint 2016.\n */\n\nimport { ChartType, isChartExType } from '../../../enums.js'\nimport type { ObjectOptions } from '../../../types/index.js'\nimport type { SlideObject } from '../../../types/internal.js'\nimport { genXmlPlaceholder } from '../../drawingml/text-body.js'\nimport { el, raw, voidEl } from '../../oxml/el.js'\nimport { cNvPrOpen, MC_NS } from './shared.js'\n\nconst DML_NS = 'http://schemas.openxmlformats.org/drawingml/2006/main'\nconst CHART_NS = 'http://schemas.openxmlformats.org/drawingml/2006/chart'\n/** graphicData URI + child namespace for chartEx charts (referenced via `<mc:AlternateContent>`). */\nconst CHARTEX_NS = 'http://schemas.microsoft.com/office/drawing/2014/chartex'\n/**\n * chartEx feature-version namespace declared on `<mc:Choice Requires>`. Each 2016 chart wave\n * introduced a feature level a consumer must \"understand\" to render the chart; a consumer that\n * doesn't falls through to `<mc:Fallback>`. Keyed by `ChartType`.\n */\nconst CHARTEX_FEATURE_NS: Partial<Record<ChartType, { prefix: string; uri: string }>> = {\n\t[ChartType.waterfall]: { prefix: 'cx1', uri: 'http://schemas.microsoft.com/office/drawing/2015/9/8/chartex' },\n\t[ChartType.funnel]: { prefix: 'cx2', uri: 'http://schemas.microsoft.com/office/drawing/2015/10/21/chartex' },\n\t[ChartType.regionMap]: { prefix: 'cx4', uri: 'http://schemas.microsoft.com/office/drawing/2016/5/10/chartex' },\n}\n\n/**\n * Render a `chart` slide object to its `<p:graphicFrame>` XML referencing the chart part.\n *\n * Classic charts emit a bare `<p:graphicFrame>` pointing at a `<c:chart>`. chartEx charts\n * (waterfall, …) instead wrap that graphicFrame in `<mc:AlternateContent>`: an `<mc:Choice>`\n * carrying the `<cx:chart>` reference (rendered by PowerPoint 2016+/Microsoft 365) and an\n * `<mc:Fallback>` placeholder shape shown by every other consumer.\n */\nexport function renderChartObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\tplaceholderObj: SlideObject | null\n): string {\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\tconst opts = slideItemObj.options\n\t// A chart's options are really `ChartOptsInternal`; `_type` is not on the broad `ObjectOptions`.\n\tconst chartType = (opts as { _type?: ChartType })._type\n\tconst isChartEx = isChartExType(chartType)\n\n\tconst graphicDataUri = isChartEx ? CHARTEX_NS : CHART_NS\n\tconst chartChild = isChartEx\n\t\t? voidEl('cx:chart', { 'xmlns:cx': CHARTEX_NS, 'r:id': `rId${slideItemObj.chartRid}` }, { openPrefix: ' ' })\n\t\t: voidEl('c:chart', { 'r:id': `rId${slideItemObj.chartRid}`, 'xmlns:c': CHART_NS }, { openPrefix: ' ' })\n\n\tconst graphicFrame = el('p:graphicFrame', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:nvGraphicFramePr',\n\t\t\t\tnull,\n\t\t\t\t[\n\t\t\t\t\traw(cNvPrOpen(idx + 2, opts.objectName, opts.altText || '', ' ') + '/>'),\n\t\t\t\t\traw(voidEl('p:cNvGraphicFramePr', null, { openPrefix: ' ' })),\n\t\t\t\t\traw(el('p:nvPr', null, raw(genXmlPlaceholder(placeholderObj)), { openPrefix: ' ' })),\n\t\t\t\t],\n\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t)\n\t\t),\n\t\traw(el('p:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))], { openPrefix: ' ' })),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'a:graphic',\n\t\t\t\t{ 'xmlns:a': DML_NS },\n\t\t\t\traw(el('a:graphicData', { uri: graphicDataUri }, raw(chartChild), { openPrefix: ' ', closePrefix: ' ' })),\n\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t)\n\t\t),\n\t])\n\n\tif (!isChartEx) return graphicFrame\n\n\t// chartEx: wrap the graphicFrame in <mc:AlternateContent>. The Choice declares the feature-level\n\t// namespace it Requires; the Fallback is a plain shape so non-2016 consumers show something.\n\tconst feature = (chartType && CHARTEX_FEATURE_NS[chartType]) ?? CHARTEX_FEATURE_NS[ChartType.waterfall]\n\tconst choice = el(\n\t\t'mc:Choice',\n\t\t{ [`xmlns:${feature?.prefix ?? 'cx1'}`]: feature?.uri, Requires: feature?.prefix ?? 'cx1' },\n\t\traw(graphicFrame)\n\t)\n\tconst fallback = el('mc:Fallback', null, raw(renderChartExFallback(idx, opts, x, y, cx, cy)))\n\treturn el('mc:AlternateContent', { 'xmlns:mc': MC_NS }, [raw(choice), raw(fallback)])\n}\n\n/**\n * Build the `<mc:Fallback>` placeholder shape shown when a chartEx chart cannot be rendered\n * (any consumer older than PowerPoint 2016 / Microsoft 365). A light-grey rectangle at the chart's\n * position carrying a short explanatory note — enough that the slide reads sensibly rather than\n * showing a void where the chart would be.\n */\nfunction renderChartExFallback(idx: number, opts: ObjectOptions, x: number, y: number, cx: number, cy: number): string {\n\treturn el('p:sp', null, [\n\t\traw(\n\t\t\tel('p:nvSpPr', null, [\n\t\t\t\traw(cNvPrOpen(idx + 2, opts.objectName, opts.altText || '') + '/>'),\n\t\t\t\traw(voidEl('p:cNvSpPr')),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:spPr', null, [\n\t\t\t\traw(el('a:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t\t\t\traw(el('a:solidFill', null, raw(voidEl('a:srgbClr', { val: 'F2F2F2' })))),\n\t\t\t\traw(el('a:ln', null, raw(el('a:solidFill', null, raw(voidEl('a:srgbClr', { val: 'BFBFBF' })))))),\n\t\t\t])\n\t\t),\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:r', null, [\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, 'This chart requires PowerPoint 2016 or newer to display.')),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t])\n\t\t),\n\t])\n}\n","/**\n * ts-pptx: connector slide-object serialization\n *\n * Emits a `connector` slide object as a `<p:cxnSp>`. The start/end shape bindings resolve a\n * caller-supplied `objectName` to the target's slide-wide `<p:cNvPr>` id; an unresolved name\n * falls back to the static endpoint geometry rather than emitting a dangling id.\n */\n\nimport type { SlideObject } from '../../../types/internal.js'\nimport { warn } from '../../../diagnostics.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../../oxml/el.js'\nimport { resolveObjectNameToId } from '../shape-ids.js'\nimport { cNvPrOpen, genXmlShapeLine } from './shared.js'\n\n/**\n * Render a `connector` slide object to its `<p:cxnSp>` XML (start/end shape bindings via shapeIds).\n */\nexport function renderConnectorObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\tlocationAttrs: XmlAttrs,\n\tshapeIds: Map<SlideObject, number>\n): string {\n\tlet strSlideXml = ''\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\t// A connector is emitted as <p:cxnSp> (a connector shape) rather than <p:sp>, so\n\t// PowerPoint treats it as a connector. Geometry/flip come from the shared resolution\n\t// above; the preset (straightConnector1 / bentConnector3 / curvedConnector3) is on `shape`.\n\tstrSlideXml += '<p:cxnSp><p:nvCxnSpPr>'\n\tstrSlideXml += cNvPrOpen(idx + 2, slideItemObj.options.objectName, slideItemObj.options.altText || '') + '/>'\n\t{\n\t\t// Shape binding: resolve each bound target's objectName to its cNvPr id and emit\n\t\t// <a:stCxn>/<a:endCxn> in schema order. Resolution goes through `shapeIds`, so a shape\n\t\t// inside a group binds like any other (it is cNvPr-named on this slide); the old\n\t\t// `_slideObjects`-only lookup missed those and warned that the shape did not exist.\n\t\t// An unresolved name falls back to the static endpoint geometry (warn, don't corrupt)\n\t\t// rather than a dangling id.\n\t\tconst cxnTag = (binding: { name: string; idx: number } | undefined, tag: 'a:stCxn' | 'a:endCxn'): string => {\n\t\t\tif (!binding) return ''\n\t\t\tconst id = resolveObjectNameToId(shapeIds, binding.name)\n\t\t\tif (id === null) {\n\t\t\t\twarn(\n\t\t\t\t\t'connector/unresolved-binding',\n\t\t\t\t\t`addConnector could not bind to shape \"${binding.name}\" (no object with that objectName on the slide); using endpoint coordinates instead.`\n\t\t\t\t)\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn `<${tag} id=\"${id}\" idx=\"${binding.idx}\"/>`\n\t\t}\n\t\tconst cxnSpPr = cxnTag(slideItemObj.options._startCxn, 'a:stCxn') + cxnTag(slideItemObj.options._endCxn, 'a:endCxn')\n\t\tstrSlideXml += cxnSpPr ? `<p:cNvCxnSpPr>${cxnSpPr}</p:cNvCxnSpPr>` : '<p:cNvCxnSpPr/>'\n\t}\n\tstrSlideXml += '<p:nvPr/></p:nvCxnSpPr><p:spPr>'\n\tstrSlideXml += el('a:xfrm', locationAttrs, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])\n\t{\n\t\t// Bent/curved connectors carry adjustable jogs as `<a:gd name=\"adjN\" fmla=\"val …\"/>`\n\t\t// (1000ths-of-a-percent). With none, the empty `<a:avLst/>` leaves the preset default (50%).\n\t\tconst adj = slideItemObj.options._connectorAdj || []\n\t\tconst avLst = adj.map((val, i) => voidEl('a:gd', { name: `adj${i + 1}`, fmla: `val ${val}` })).join('')\n\t\tstrSlideXml += el('a:prstGeom', { prst: slideItemObj.shape }, raw(el('a:avLst', null, raw(avLst))))\n\t}\n\tstrSlideXml += genXmlShapeLine(slideItemObj.options.line || {})\n\tstrSlideXml += '</p:spPr></p:cxnSp>'\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 { convertArcAngle, convertRotationDegrees, 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\nexport function genXmlPresetGeom(shapeName: string, options: ObjectOptions, cx: number, cy: number): string {\n\t// Safety net for every prstGeom emitter (addShape, addText/addImage `shape`):\n\t// an unknown preset becomes an invalid `prst` value that makes PowerPoint show\n\t// the \"needs repair\" dialog and drop the shape. Fail loudly instead.\n\tif (!VALID_SHAPE_PRESETS.has(shapeName)) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'shape/unknown-preset',\n\t\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\t)\n\t}\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\tif (options.rectRadius) {\n\t\tconst adjVal = Math.round((options.rectRadius * EMU_PER_INCH * PERCENT_SCALE) / Math.min(cx, cy))\n\t\tif (RECT_RADIUS_ADJ1_SHAPES.has(shapeName)) {\n\t\t\temitGuide('adj1', adjVal)\n\t\t\temitGuide('adj2', 0)\n\t\t} else {\n\t\t\temitGuide('adj', adjVal)\n\t\t}\n\t} else if (options.angleRange) {\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}`, convertRotationDegrees(angle))\n\t\t}\n\n\t\tif (options.arcThicknessRatio) {\n\t\t\temitGuide('adj3', Math.round(options.arcThicknessRatio * (PERCENT_SCALE / 2)))\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!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' || !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: convertRotationDegrees(c.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 : convertRotationDegrees(h.minAng),\n\t\t\t\t\t\tmaxAng: h.maxAng == null ? undefined : convertRotationDegrees(h.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 * ts-pptx: DrawingML image sizing & cropping\n *\n * Build the `<a:srcRect>` (+ `<a:stretch>`) blipFill children for the image\n * sizing modes (`cover` / `contain` / `crop` / `stretch`), for the implicit\n * aspect-correct placement a vector source gets, and for explicit percentage crops.\n */\n\nimport { fitSrcRectPercents } from '../../media/image-size.js'\nimport { FIXED_PCT_PER_PERCENT } from '../../units.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { InvalidOptionError } from '../../errors.js'\n\n/** Every `<a:srcRect>` below is followed by this same fill directive. */\nconst STRETCH = el('a:stretch', null, raw(voidEl('a:fillRect')))\n\n/** The `<a:srcRect>` fitting `imgSize` into `boxDim`, followed by the fill directive. */\nfunction fitSrcRect(\n\ttype: 'cover' | 'contain',\n\timgSize: { w: number; h: number },\n\tboxDim: { w: number; h: number }\n): string {\n\tconst { l, r, t, b } = fitSrcRectPercents(type, imgSize, boxDim)\n\treturn voidEl('a:srcRect', { l, r, t, b }) + STRETCH\n}\n\nexport const ImageSizingXml = {\n\tcover: function (imgSize: { w: number; h: number }, boxDim: { w: number; h: number; x: number; y: number }) {\n\t\treturn fitSrcRect('cover', imgSize, boxDim)\n\t},\n\tcontain: function (imgSize: { w: number; h: number }, boxDim: { w: number; h: number; x: number; y: number }) {\n\t\treturn fitSrcRect('contain', imgSize, boxDim)\n\t},\n\t/** No source rectangle at all: the image fills the box, aspect ratio be damned. */\n\tstretch: function () {\n\t\treturn STRETCH\n\t},\n\tcrop: function (imgSize: { w: number; h: number }, boxDim: { w: number; h: number; x: number; y: number }) {\n\t\tconst l = boxDim.x\n\t\tconst r = imgSize.w - (boxDim.x + boxDim.w)\n\t\tconst t = boxDim.y\n\t\tconst b = imgSize.h - (boxDim.y + boxDim.h)\n\t\tif (l < 0 || r < 0 || t < 0 || b < 0) {\n\t\t\tconst over = [\n\t\t\t\tl < 0 && `x (${l < 0 ? -l : 0} past left edge)`,\n\t\t\t\tr < 0 && `x+w (${-r} past right edge)`,\n\t\t\t\tt < 0 && `y (${-t} past top edge)`,\n\t\t\t\tb < 0 && `y+h (${-b} past bottom edge)`,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(', ')\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'image/crop-window-overflows',\n\t\t\t\t`addImage sizing.type 'crop': crop window overflows image bounds — ${over}. Ensure x≥0, y≥0, x+w≤w, y+h≤h.`\n\t\t\t)\n\t\t}\n\t\tconst lPerc = Math.round(1e5 * (l / imgSize.w))\n\t\tconst rPerc = Math.round(1e5 * (r / imgSize.w))\n\t\tconst tPerc = Math.round(1e5 * (t / imgSize.h))\n\t\tconst bPerc = Math.round(1e5 * (b / imgSize.h))\n\t\treturn voidEl('a:srcRect', { l: lPerc, r: rPerc, t: tPerc, b: bPerc }) + STRETCH\n\t},\n}\n\n/**\n * The blipFill children for a vector source the caller gave no `sizing` for: letterbox it to its\n * own aspect ratio inside its frame, the way `sizing: 'contain'` would — an SVG carries an\n * intrinsic ratio, and stretching a glyph into a box that disagrees with it is never the intent.\n *\n * Returns `null` when the two ratios already agree, which is the overwhelmingly common case (a\n * square icon in a square box). The caller then emits the plain `<a:stretch>` it always did, so\n * this default costs nothing — neither bytes nor a behaviour change — until it actually differs.\n * @param imgSize - the vector's intrinsic size (viewBox or width/height)\n * @param boxDim - the picture's displayed frame\n * @returns the `<a:srcRect>` + `<a:stretch>` children, or `null` if no letterboxing is needed\n */\nexport function genXmlVectorAspectFit(\n\timgSize: { w: number; h: number },\n\tboxDim: { w: number; h: number }\n): string | null {\n\tconst { l, r, t, b } = fitSrcRectPercents('contain', imgSize, boxDim)\n\tif (l === 0 && r === 0 && t === 0 && b === 0) return null\n\treturn fitSrcRect('contain', imgSize, boxDim)\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 objectName - for error messages\n * @returns the `<a:srcRect>` + `<a:stretch>` blipFill children\n */\nexport function genXmlImageCrop(crop: { l?: number; t?: number; r?: number; b?: number }, objectName?: string): string {\n\tconst where = objectName ? ` for image \"${objectName}\"` : ''\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' || !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`addImage 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`addImage 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`addImage crop: top+bottom insets (${edges.t}%+${edges.b}%) must be < 100%${where}.`\n\t\t)\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 above emit l/r/t/b. Attribute\n\t// order is byte-significant, so the two orderings are kept as they are rather than unified.\n\treturn voidEl('a:srcRect', { l: v(edges.l), t: v(edges.t), r: v(edges.r), b: v(edges.b) }) + STRETCH\n}\n","/**\n * ts-pptx: image slide-object serialization\n *\n * Emits an `image` slide object as a `<p:pic>`: the blip and its image effects (transparency,\n * duotone, colour change, grayscale, bi-level), the crop or `sizing` source rectangle, the\n * clipping geometry, outline and shadow. An omitted dimension is backfilled from the embedded\n * bytes' natural pixel ratio, which only becomes available once `_relsMedia` is populated.\n */\n\nimport type { ObjectOptions } from '../../../types/index.js'\nimport { DEF_TEXT_SHADOW } from '../../../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideObject } from '../../../types/internal.js'\nimport { createColorElement } from '../../drawingml/color.js'\nimport { createShadowEffectLst } from '../../drawingml/effect.js'\nimport { genXmlCustGeom, genXmlPresetGeom } from '../../drawingml/geometry.js'\nimport { genXmlImageCrop, genXmlVectorAspectFit, ImageSizingXml } from '../../drawingml/image.js'\nimport { genXmlObjectLock, PICTURE_LOCK_ATTRS } from '../../drawingml/locks.js'\nimport { genXmlPlaceholder } from '../../drawingml/text-body.js'\nimport { getImageSizeFromBase64 } from '../../../media/image-size.js'\nimport { el, raw, voidEl, type XmlAttrs, type XmlChild } from '../../oxml/el.js'\nimport { getSmartParseNumber } from '../../../units-internal.js'\nimport { FIXED_PCT_PER_PERCENT, PERCENT_SCALE, pixelsToEmu } from '../../../units.js'\nimport { warn } from '../../../diagnostics.js'\nimport { cNvPrHyperlink, cNvPrOpen, genXmlShapeLine } from './shared.js'\n\n/**\n * Render an `image` slide object to its `<p:pic>` XML (sizing/crop, rounding, hyperlink, shadow).\n */\nexport function renderImageObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tslide: PresSlideInternal | SlideLayoutInternal,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\timgWidth: number,\n\timgHeight: number,\n\tplaceholderObj: SlideObject | null,\n\tlocationAttrs: XmlAttrs,\n\tsizing: ObjectOptions['sizing'],\n\trounding: ObjectOptions['rounding']\n): string {\n\tlet strSlideXml = ''\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\t// The media bytes this picture points at. Not available synchronously in `addImage()`, but\n\t// populated by now — which is why every question that needs the image itself (its natural\n\t// size, whether it is a vector) is answered here rather than at definition time.\n\tconst mediaRel = (slide._relsMedia || []).find((rel) => rel.rId === slideItemObj.imageRid)\n\tconst relData = mediaRel?.data\n\tconst naturalSize = (): { w: number; h: number } | null =>\n\t\ttypeof relData === 'string' ? getImageSizeFromBase64(relData) : null\n\t// Backfill any omitted dimension of a path-based image from its natural pixel ratio.\n\t// PowerPoint inserts images at 96 DPI, so natural pixels / 96 * EMU == display EMU.\n\tif (slideItemObj.options._szAuto) {\n\t\tconst szAuto = slideItemObj.options._szAuto\n\t\tconst natural = naturalSize()\n\t\tif (natural) {\n\t\t\tif (szAuto.w && szAuto.h) {\n\t\t\t\tcx = pixelsToEmu(natural.w, 96)\n\t\t\t\tcy = pixelsToEmu(natural.h, 96)\n\t\t\t} else if (szAuto.h) {\n\t\t\t\t// Width supplied, derive height\n\t\t\t\tcy = Math.round(cx * (natural.h / natural.w))\n\t\t\t} else if (szAuto.w) {\n\t\t\t\t// Height supplied, derive width\n\t\t\t\tcx = Math.round(cy * (natural.w / natural.h))\n\t\t\t}\n\t\t\timgWidth = cx\n\t\t\timgHeight = cy\n\t\t}\n\t}\n\tconst imgOpts = slideItemObj.options\n\tconst imgLink = slideItemObj.hyperlink\n\tstrSlideXml += '<p:pic>'\n\tstrSlideXml += ' <p:nvPicPr>'\n\tstrSlideXml +=\n\t\tcNvPrOpen(idx + 2, imgOpts.objectName, imgOpts.altText || slideItemObj.image || '') + '>' + cNvPrHyperlink(imgLink)\n\tstrSlideXml += ' </p:cNvPr>'\n\t// Default to locking aspect ratio (PowerPoint's own behavior); user `objectLock` overrides any flag, incl. noChangeAspect.\n\tstrSlideXml += el(\n\t\t'p:cNvPicPr',\n\t\tnull,\n\t\traw(\n\t\t\tgenXmlObjectLock(\n\t\t\t\t'a:picLocks',\n\t\t\t\tPICTURE_LOCK_ATTRS,\n\t\t\t\t{ noChangeAspect: true, ...imgOpts.objectLock },\n\t\t\t\timgOpts.objectName\n\t\t\t)\n\t\t),\n\t\t{ openPrefix: ' ' }\n\t)\n\tstrSlideXml += el('p:nvPr', null, raw(genXmlPlaceholder(placeholderObj)), { openPrefix: ' ' })\n\tstrSlideXml += ' </p:nvPicPr>'\n\n\t// The `<a:blip>` image-effect children (CT_Blip), shared by the SVG and raster branches:\n\t// transparency as `alphaModFix`, then duotone recolor (shadows→shadow, highlights→highlight),\n\t// both before any `extLst`.\n\t// NOTE: the SVG branch writes ` <a:alphaModFix` with a LEADING space and the raster branch\n\t// writes none. That space is byte-significant, so it is passed in rather than normalized away.\n\tconst blipEffects = (alphaPrefix: string): XmlChild[] => [\n\t\timgOpts.transparency\n\t\t\t? raw(\n\t\t\t\t\tvoidEl(\n\t\t\t\t\t\t'a:alphaModFix',\n\t\t\t\t\t\t{ amt: Math.round((100 - imgOpts.transparency) * FIXED_PCT_PER_PERCENT) },\n\t\t\t\t\t\t{ openPrefix: alphaPrefix }\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t: null,\n\t\timgOpts.duotone\n\t\t\t? raw(\n\t\t\t\t\tel('a:duotone', null, [\n\t\t\t\t\t\traw(createColorElement(imgOpts.duotone.shadow)),\n\t\t\t\t\t\traw(createColorElement(imgOpts.duotone.highlight)),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t: null,\n\t\timgOpts.clrChange\n\t\t\t? raw(\n\t\t\t\t\tel('a:clrChange', null, [\n\t\t\t\t\t\traw(el('a:clrFrom', null, raw(createColorElement(imgOpts.clrChange.from)))),\n\t\t\t\t\t\traw(el('a:clrTo', null, raw(createColorElement(imgOpts.clrChange.to)))),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t: null,\n\t\timgOpts.grayscale ? raw(voidEl('a:grayscl')) : null,\n\t\timgOpts.biLevel\n\t\t\t? raw(voidEl('a:biLevel', { thresh: Math.round(imgOpts.biLevel.threshold * PERCENT_SCALE) }))\n\t\t\t: null,\n\t]\n\n\tstrSlideXml += '<p:blipFill>'\n\t// NOTE: This works for both cases: either `path` or `data` contains the SVG\n\tconst isVector = mediaRel?.extn === 'svg'\n\tif (isVector) {\n\t\tstrSlideXml += el('a:blip', { 'r:embed': `rId${(slideItemObj.imageRid ?? 0) - 1}` }, [\n\t\t\t...blipEffects(' '),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'a:extLst',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'a:ext',\n\t\t\t\t\t\t\t{ uri: '{96DAC541-7B7A-43D3-8B79-37D633B846F1}' },\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tvoidEl(\n\t\t\t\t\t\t\t\t\t'asvg:svgBlip',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'xmlns:asvg': 'http://schemas.microsoft.com/office/drawing/2016/SVG/main',\n\t\t\t\t\t\t\t\t\t\t'r:embed': `rId${slideItemObj.imageRid}`,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{ openPrefix: ' ' }\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t\t)\n\t\t\t),\n\t\t])\n\t} else {\n\t\tstrSlideXml += el('a:blip', { 'r:embed': `rId${slideItemObj.imageRid}` }, blipEffects(''))\n\t}\n\tif (slideItemObj.options.crop) {\n\t\t// Explicit OOXML srcRect (percentage edge insets), emitted verbatim. Crops the source\n\t\t// directly, so it wins over the inch-based `sizing` crop and works for SVG/unmeasurable\n\t\t// formats; the picture's normal w/h box stays the display extent.\n\t\tif (sizing?.type)\n\t\t\twarn(\n\t\t\t\t'image/crop-and-sizing-conflict',\n\t\t\t\t`addImage 'crop' and 'sizing' are mutually exclusive for image \"${slideItemObj.options.objectName}\"; 'sizing' was ignored.`\n\t\t\t)\n\t\tstrSlideXml += genXmlImageCrop(slideItemObj.options.crop, slideItemObj.options.objectName)\n\t} else if (sizing?.type) {\n\t\tconst boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx\n\t\tconst boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy\n\t\tconst boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout)\n\t\tconst boxY = getSmartParseNumber(sizing.y || 0, 'Y', slide._presLayout)\n\n\t\t// `cover`/`contain` crop the *source* bitmap, so the srcRect must be derived from the\n\t\t// image's natural pixel ratio — not the displayed box (options.w/h). Measure it from the\n\t\t// embedded media bytes; if unmeasurable (SVG/unknown format) fall back to display dims + warn.\n\t\t// `crop` keeps display EMU: its contract treats the displayed extent as the crop frame.\n\t\tlet cropSize: { w: number; h: number } = { w: imgWidth, h: imgHeight }\n\t\tif (sizing.type === 'cover' || sizing.type === 'contain') {\n\t\t\tconst natural = naturalSize()\n\t\t\tif (natural) {\n\t\t\t\tcropSize = natural\n\t\t\t} else {\n\t\t\t\twarn(\n\t\t\t\t\t'image/unmeasurable-natural-size',\n\t\t\t\t\t`sizing '${sizing.type}' could not measure natural dimensions for image \"${slideItemObj.options.objectName}\"; falling back to displayed aspect ratio (crop may be inexact). Provide a raster image (PNG/JPEG/GIF/BMP/WebP) or an SVG with width/height or a viewBox to enable an aspect-correct crop.`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tstrSlideXml += ImageSizingXml[sizing.type](cropSize, { w: boxW, h: boxH, x: boxX, y: boxY })\n\t\timgWidth = boxW\n\t\timgHeight = boxH\n\t} else {\n\t\t// No `sizing` at all. A raster fills its box — that box was chosen for it, and PowerPoint\n\t\t// does the same. A vector does not: an SVG states its own aspect ratio in a viewBox, and a\n\t\t// glyph squashed to a box that disagrees is a defect, not a layout choice. So a measurable\n\t\t// vector letterboxes here by default, and `sizing: { type: 'stretch' }` opts back out.\n\t\t// Unmeasurable vectors (no viewBox, no width/height) fall through silently: nothing was\n\t\t// asked for, so there is nothing to warn about.\n\t\tconst natural = isVector ? naturalSize() : null\n\t\tconst aspectFit = natural ? genXmlVectorAspectFit(natural, { w: imgWidth, h: imgHeight }) : null\n\t\tstrSlideXml += aspectFit ?? el('a:stretch', null, raw(voidEl('a:fillRect')), { openPrefix: ' ' })\n\t}\n\tstrSlideXml += '</p:blipFill>'\n\tstrSlideXml += '<p:spPr>'\n\tstrSlideXml += el(\n\t\t'a:xfrm',\n\t\tlocationAttrs,\n\t\t[raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx: imgWidth, cy: imgHeight }))],\n\t\t{ openPrefix: ' ', childPrefix: ' ', closePrefix: ' ' }\n\t)\n\t// Clip the picture to a geometry. `points` (freeform custGeom) takes precedence over `shape`/`rounding`;\n\t// otherwise `shape` wins over `rounding` (shorthand for an ellipse), falling back to a plain rectangle.\n\tif (slideItemObj.options.points) {\n\t\tstrSlideXml += ' ' + genXmlCustGeom(slideItemObj.options, imgWidth, imgHeight, slide._presLayout)\n\t} else {\n\t\tstrSlideXml +=\n\t\t\t' ' +\n\t\t\tgenXmlPresetGeom(\n\t\t\t\tslideItemObj.options.shape ?? (rounding ? 'ellipse' : 'rect'),\n\t\t\t\tslideItemObj.options,\n\t\t\t\timgWidth,\n\t\t\t\timgHeight\n\t\t\t)\n\t}\n\n\t// BORDER: `<a:ln>` outline (must precede `<a:effectLst>` per CT_ShapeProperties order)\n\tif (slideItemObj.options.line) strSlideXml += genXmlShapeLine(slideItemObj.options.line)\n\n\t// EFFECTS > SHADOW: REF: @see http://officeopenxml.com/drwSp-effects.php\n\tif (slideItemObj.options.shadow && slideItemObj.options.shadow.type !== 'none') {\n\t\tstrSlideXml += createShadowEffectLst(slideItemObj.options.shadow, DEF_TEXT_SHADOW)\n\t}\n\tstrSlideXml += '</p:spPr>'\n\tstrSlideXml += '</p:pic>'\n\treturn strSlideXml\n}\n","/**\n * ts-pptx: media (audio / video / online video) slide-object serialization\n *\n * Emits a `media` slide object as a `<p:pic>` carrying the required preview image. The online\n * and embedded forms differ in exactly two tokens — the EG_Media choice element and whether the\n * paired `<p14:media>` rel binds by `r:link` or `r:embed` — so they share one body.\n */\n\nimport type { SlideObject } from '../../../types/internal.js'\nimport { genXmlObjectLock, PICTURE_LOCK_ATTRS } from '../../drawingml/locks.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../../oxml/el.js'\nimport { cNvPrOpen, P14_NS } from './shared.js'\n\n/**\n * Render a `media` (audio/video/online) slide object to its `<p:pic>` XML.\n */\nexport function renderMediaObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\tlocationAttrs: XmlAttrs\n): string {\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\tconst opts = slideItemObj.options\n\tconst mediaRid = slideItemObj.mediaRid ?? 0\n\n\t// The online (external-link) and embedded forms differ in exactly two tokens, so they share\n\t// one body rather than two near-identical branches:\n\t// - EG_Media choice: audio embeds use <a:audioFile>, video and online video <a:videoFile>;\n\t// - the paired <p14:media> rel is bound by r:link for an external link (no media binary\n\t// part, sharing the link Target with the ECMA rel) and by r:embed for an embedded file.\n\t// Note the ECMA media element itself is r:link in BOTH forms.\n\tconst mediaTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile'\n\tconst p14MediaAttr = slideItemObj.mtype === 'online' ? 'r:link' : 'r:embed'\n\n\treturn el('p:pic', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:nvPicPr',\n\t\t\t\tnull,\n\t\t\t\t[\n\t\t\t\t\t// cNvPr/@id must be unique across every shape on the slide, so it uses the slide-object\n\t\t\t\t\t// index (idx + 2) like all other shapes — NOT mediaRid, which lives in the relationship-id\n\t\t\t\t\t// space and collides with a sibling shape's idx (duplicate ids => PowerPoint reports the\n\t\t\t\t\t// file corrupt, 0x80070570). The preview image is still bound via <a:blip r:embed> below.\n\t\t\t\t\traw(\n\t\t\t\t\t\tcNvPrOpen(idx + 2, opts.objectName, opts.altText || '') +\n\t\t\t\t\t\t\t'>' +\n\t\t\t\t\t\t\tvoidEl('a:hlinkClick', { 'r:id': '', action: 'ppaction://media' }) +\n\t\t\t\t\t\t\t'</p:cNvPr>'\n\t\t\t\t\t),\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:cNvPicPr',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tgenXmlObjectLock(\n\t\t\t\t\t\t\t\t\t'a:picLocks',\n\t\t\t\t\t\t\t\t\tPICTURE_LOCK_ATTRS,\n\t\t\t\t\t\t\t\t\t{ noChangeAspect: true, ...opts.objectLock },\n\t\t\t\t\t\t\t\t\topts.objectName\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{ openPrefix: ' ' }\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\traw(\n\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t'p:nvPr',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\traw(voidEl(mediaTag, { 'r:link': `rId${mediaRid}` }, { openPrefix: ' ' })),\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'p:extLst',\n\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t\t\t\t'p:ext',\n\t\t\t\t\t\t\t\t\t\t\t\t{ uri: '{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}' },\n\t\t\t\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\t\t\t\tvoidEl(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'p14:media',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ 'xmlns:p14': P14_NS, [p14MediaAttr]: `rId${mediaRid + 1}` },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ openPrefix: ' ' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\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\t{ openPrefix: ' ', closePrefix: ' ' }\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\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t)\n\t\t),\n\t\t// NOTE: Preview image is required!\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:blipFill',\n\t\t\t\tnull,\n\t\t\t\t[\n\t\t\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${mediaRid + 2}` })),\n\t\t\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t\t\t],\n\t\t\t\t{ openPrefix: ' ' }\n\t\t\t)\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:spPr',\n\t\t\t\tnull,\n\t\t\t\t[\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('a:xfrm', locationAttrs, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))], {\n\t\t\t\t\t\t\topenPrefix: ' ',\n\t\t\t\t\t\t})\n\t\t\t\t\t),\n\t\t\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')), { openPrefix: ' ' })),\n\t\t\t\t],\n\t\t\t\t{ openPrefix: ' ', closePrefix: ' ' }\n\t\t\t)\n\t\t),\n\t])\n}\n","/**\n * ts-pptx: 3D model (`am3d:model3d`) slide-object serialization\n *\n * Emits a `model3d` slide object as an `<mc:AlternateContent>`. The `mc:Choice` carries the real\n * `<p:graphicFrame>` in the 2017 `am3d` namespace, rendered live by PowerPoint 2019+; the\n * `mc:Fallback` carries a plain preview picture, which is what every other consumer — older\n * PowerPoint, thumbnails, PDF export — actually draws. See `gen/define/model3d.ts`.\n *\n * Every constant below is transcribed from a PowerPoint-authored deck\n * (`test/read/fixtures/model3d.pptx`, `Shapes.Add3DModel`), including the lighting rig, which came\n * out byte-identical for every probe model and is therefore emitted as a fixed studio setup rather\n * than derived from anything.\n */\n\nimport type { Model3dInternal, SlideObject } from '../../../types/internal.js'\nimport { el, raw, voidEl } from '../../oxml/el.js'\nimport { cNvPrOpen, MC_NS } from './shared.js'\n\n/** The `am3d` namespace, doubling as `a:graphicData@uri` and the `mc:Choice Requires` token's URI. */\nconst AM3D_NS = 'http://schemas.microsoft.com/office/drawing/2017/model3d'\n/** Denominator of every `am3d` rational element (`@n`/`@d`). */\nconst RATIO_DEN = 1000000\n/**\n * `am3d:raster@rName`/`@rVer` — the renderer that produced the cached preview. PowerPoint stamps\n * its own renderer here; ts-pptx did not rasterize anything, but the attributes are what PowerPoint\n * writes and the element is where the preview blip lives, so they are reproduced verbatim.\n */\nconst RASTER = { rName: 'Office3DRenderer', rVer: '16.0.8326' }\n/**\n * `am3d:objViewport@viewportSz`. Bounding-box derived in PowerPoint's output (a cube and a slab\n * gave different values); the cube's is emitted, matching the fixed default camera.\n */\nconst OBJ_VIEWPORT_SZ = 3338805\n\n/** One `am3d:ptLight` of the fixed studio rig: colour (scRGB, 1000ths of a percent), intensity, position. */\ninterface PtLight {\n\tclr: { r: number; g: number; b: number }\n\tintensityN: number\n\tpos: { x: number; y: number; z: number }\n}\n/** The three point lights PowerPoint writes for every inserted model — key, fill and rim. */\nconst PT_LIGHTS: readonly PtLight[] = [\n\t{ clr: { r: 100000, g: 75000, b: 50000 }, intensityN: 9765625, pos: { x: 21959998, y: 70920001, z: 16344003 } },\n\t{ clr: { r: 40000, g: 60000, b: 95000 }, intensityN: 12250000, pos: { x: -37964106, y: 51130435, z: 57631972 } },\n\t{ clr: { r: 86837, g: 72700, b: 100000 }, intensityN: 3125000, pos: { x: -37739122, y: 58056624, z: -34769649 } },\n]\n/** `am3d:ambientLight` — neutral 50% scRGB at half illuminance, constant like the point lights. */\nconst AMBIENT = { clr: { r: 50000, g: 50000, b: 50000 }, illuminanceN: 500000 }\n\n/** `<am3d:clr><a:scrgbClr …/></am3d:clr>` — the colour wrapper both light kinds share. */\nfunction lightColor(clr: { r: number; g: number; b: number }): string {\n\treturn el('am3d:clr', null, raw(voidEl('a:scrgbClr', clr)))\n}\n\n/** The `am3d:camera` block: eye position, up vector, aim point and perspective fov. */\nfunction cameraEl(model: Model3dInternal): string {\n\treturn el('am3d:camera', null, [\n\t\traw(voidEl('am3d:pos', model.pos)),\n\t\traw(voidEl('am3d:up', model.up)),\n\t\traw(voidEl('am3d:lookAt', model.lookAt)),\n\t\traw(voidEl('am3d:perspective', { fov: model.fov })),\n\t])\n}\n\n/**\n * The `am3d:trans` block: model-unit scale plus an identity placement. Only `meterPerModelUnit`\n * varies — `preTrans`/`scale`/`rot`/`postTrans` are the identity PowerPoint writes for a model\n * inserted without any subsequent 3D manipulation, and `am3d:rot` is emitted attribute-less.\n */\nfunction transEl(model: Model3dInternal): string {\n\tconst unit = { n: RATIO_DEN, d: RATIO_DEN }\n\treturn el('am3d:trans', null, [\n\t\traw(voidEl('am3d:meterPerModelUnit', { n: model.meterPerModelUnitN, d: RATIO_DEN })),\n\t\traw(voidEl('am3d:preTrans', { dx: 0, dy: 0, dz: 0 })),\n\t\traw(\n\t\t\tel('am3d:scale', null, [raw(voidEl('am3d:sx', unit)), raw(voidEl('am3d:sy', unit)), raw(voidEl('am3d:sz', unit))])\n\t\t),\n\t\traw(voidEl('am3d:rot')),\n\t\traw(voidEl('am3d:postTrans', { dx: 0, dy: 0, dz: 0 })),\n\t])\n}\n\n/** The fixed lighting rig: one ambient light and three point lights, in PowerPoint's order. */\nfunction lightsXml(): string {\n\treturn (\n\t\tel('am3d:ambientLight', null, [\n\t\t\traw(lightColor(AMBIENT.clr)),\n\t\t\traw(voidEl('am3d:illuminance', { n: AMBIENT.illuminanceN, d: RATIO_DEN })),\n\t\t]) +\n\t\tPT_LIGHTS.map((light) =>\n\t\t\tel('am3d:ptLight', { rad: 0 }, [\n\t\t\t\traw(lightColor(light.clr)),\n\t\t\t\traw(voidEl('am3d:intensity', { n: light.intensityN, d: RATIO_DEN })),\n\t\t\t\traw(voidEl('am3d:pos', light.pos)),\n\t\t\t])\n\t\t).join('')\n\t)\n}\n\n/** The `mc:Fallback` picture — the cached preview, drawn by everything that is not PowerPoint 2019+. */\nfunction fallbackPic(\n\tpicId: number,\n\tobjectName: string | undefined,\n\taltText: string,\n\tmodel: Model3dInternal,\n\txf: { x: number; y: number; cx: number; cy: number }\n): string {\n\treturn el('p:pic', null, [\n\t\traw(\n\t\t\tel('p:nvPicPr', null, [\n\t\t\t\traw(cNvPrOpen(picId, objectName, altText) + '/>'),\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cNvPicPr',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t// PowerPoint's model-3d lock set: the zoom/picture set plus `noCrop` — a 3D model is\n\t\t\t\t\t\t\t// reframed by its camera, never by cropping the cached raster.\n\t\t\t\t\t\t\tvoidEl('a:picLocks', {\n\t\t\t\t\t\t\t\tnoGrp: '1',\n\t\t\t\t\t\t\t\tnoRot: '1',\n\t\t\t\t\t\t\t\tnoChangeAspect: '1',\n\t\t\t\t\t\t\t\tnoMove: '1',\n\t\t\t\t\t\t\t\tnoResize: '1',\n\t\t\t\t\t\t\t\tnoEditPoints: '1',\n\t\t\t\t\t\t\t\tnoAdjustHandles: '1',\n\t\t\t\t\t\t\t\tnoChangeArrowheads: '1',\n\t\t\t\t\t\t\t\tnoChangeShapeType: '1',\n\t\t\t\t\t\t\t\tnoCrop: '1',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:blipFill', null, [\n\t\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${model.previewRid}` })),\n\t\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:spPr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel('a:xfrm', null, [\n\t\t\t\t\t\traw(voidEl('a:off', { x: xf.x, y: xf.y })),\n\t\t\t\t\t\traw(voidEl('a:ext', { cx: xf.cx, cy: xf.cy })),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t\t\t])\n\t\t),\n\t])\n}\n\n/**\n * Render a `model3d` slide object to its `<mc:AlternateContent>` XML. The `mc:Choice` carries the\n * real `<p:graphicFrame>` (the `am3d:model3d` graphicData PowerPoint 2019+ renders live); the\n * `mc:Fallback` carries the cached preview picture. See `gen/define/model3d.ts`.\n */\nexport function renderModel3dObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number\n): string {\n\tconst model = slideItemObj.model3d\n\tif (!model) return ''\n\tconst opts = slideItemObj.options || {}\n\tconst altText = opts.altText || ''\n\n\t// `am3d:spPr`'s xfrm is FRAME-LOCAL: origin 0,0 with the graphic frame's own extent. The\n\t// slide-absolute position lives on `p:xfrm` below (and on the fallback picture's `p:spPr`).\n\tconst spPr = el('am3d:spPr', null, [\n\t\traw(el('a:xfrm', null, [raw(voidEl('a:off', { x: 0, y: 0 })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t])\n\n\tconst model3d = el('am3d:model3d', { 'r:embed': `rId${model.modelRid}` }, [\n\t\traw(spPr),\n\t\traw(cameraEl(model)),\n\t\traw(transEl(model)),\n\t\t// The raster's blip and the fallback picture share one image rel, as PowerPoint writes it.\n\t\traw(el('am3d:raster', RASTER, raw(voidEl('am3d:blip', { 'r:embed': `rId${model.previewRid}` })))),\n\t\traw(voidEl('am3d:objViewport', { viewportSz: OBJ_VIEWPORT_SZ })),\n\t\traw(lightsXml()),\n\t])\n\n\tconst graphicFrame = el('p:graphicFrame', null, [\n\t\traw(\n\t\t\tel('p:nvGraphicFramePr', null, [\n\t\t\t\traw(cNvPrOpen(idx + 2, opts.objectName, altText) + '/>'),\n\t\t\t\traw(el('p:cNvGraphicFramePr', null, raw(voidEl('a:graphicFrameLocks')))),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(el('p:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\traw(el('a:graphic', null, raw(el('a:graphicData', { uri: AM3D_NS }, raw(model3d))))),\n\t])\n\n\treturn el('mc:AlternateContent', { 'xmlns:mc': MC_NS }, [\n\t\traw(el('mc:Choice', { 'xmlns:am3d': AM3D_NS, Requires: 'am3d' }, raw(graphicFrame))),\n\t\traw(el('mc:Fallback', null, raw(fallbackPic(idx + 2, opts.objectName, altText, model, { x, y, cx, cy })))),\n\t])\n}\n","/**\n * ts-pptx: OLE-object slide-object serialization\n */\n\nimport type { SlideObject } from '../../../types/internal.js'\nimport { genXmlObjectLock, GRAPHIC_FRAME_LOCK_ATTRS } from '../../drawingml/locks.js'\nimport { el, raw, voidEl, type XmlAttrs, type XmlChild } from '../../oxml/el.js'\nimport { cNvPrOpen, MC_NS } from './shared.js'\n\n/** VML namespace — declared by an OLE object's `mc:Choice Requires=\"v\"` (no VML content is emitted). */\nconst VML_NS = 'urn:schemas-microsoft-com:vml'\n/** graphicData URI for an embedded OLE object (`<p:oleObj>`). */\nconst OLE_NS = 'http://schemas.openxmlformats.org/presentationml/2006/ole'\n\n/**\n * Render an `oleObject` slide object to its `<p:graphicFrame>` XML.\n *\n * Mirrors what PowerPoint authors for Insert ▸ Object: a graphicFrame in the `.../ole` graphicData\n * namespace holding an `<mc:AlternateContent>`. The `mc:Choice` carries the bare `<p:oleObj>` (which\n * PowerPoint renders by drawing the live embedded document); the `mc:Fallback` repeats it with a\n * `<p:pic>` preview so every other consumer shows the cached picture.\n *\n * Note `mc:Choice Requires=\"v\"` only *declares* the VML namespace — modern PowerPoint writes no\n * `spid` and no `vmlDrawing` part, so neither is emitted here.\n */\nexport function renderOleObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number\n): string {\n\tconst ole = slideItemObj.ole\n\tif (!ole) return ''\n\tconst opts = slideItemObj.options || {}\n\n\t// Shared by both branches; attribute order matches PowerPoint's.\n\tconst oleAttrs: XmlAttrs = {\n\t\tname: ole.name,\n\t\tshowAsIcon: ole.showAsIcon ? '1' : null,\n\t\t'r:id': `rId${ole.objectRid}`,\n\t\timgW: ole.imgW ?? cx,\n\t\timgH: ole.imgH ?? cy,\n\t\tprogId: ole.progId,\n\t}\n\tconst oleObj = (children: XmlChild[]): string => el('p:oleObj', oleAttrs, children)\n\n\t// The Fallback's cached picture. Its `cNvPr` is the id-less `0`/`\"\"` form PowerPoint writes:\n\t// the picture is an alternate rendering of the graphicFrame above, never a sibling shape, so it\n\t// takes no id from the slide's shape-id space.\n\tconst previewPic = el('p:pic', null, [\n\t\traw(\n\t\t\tel('p:nvPicPr', null, [\n\t\t\t\traw(voidEl('p:cNvPr', { id: 0, name: '' })),\n\t\t\t\traw(voidEl('p:cNvPicPr')),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:blipFill', null, [\n\t\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${ole.previewRid}` })),\n\t\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:spPr', null, [\n\t\t\t\traw(el('a:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t\t\t])\n\t\t),\n\t])\n\n\tconst alternateContent = el('mc:AlternateContent', { 'xmlns:mc': MC_NS }, [\n\t\traw(el('mc:Choice', { 'xmlns:v': VML_NS, Requires: 'v' }, raw(oleObj([raw(voidEl('p:embed'))])))),\n\t\traw(el('mc:Fallback', null, raw(oleObj([raw(voidEl('p:embed')), raw(previewPic)])))),\n\t])\n\n\treturn el('p:graphicFrame', null, [\n\t\traw(\n\t\t\tel('p:nvGraphicFramePr', null, [\n\t\t\t\traw(cNvPrOpen(idx + 2, opts.objectName, opts.altText || '') + '/>'),\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cNvGraphicFramePr',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tgenXmlObjectLock(\n\t\t\t\t\t\t\t\t'a:graphicFrameLocks',\n\t\t\t\t\t\t\t\tGRAPHIC_FRAME_LOCK_ATTRS,\n\t\t\t\t\t\t\t\t{ noChangeAspect: true, ...opts.objectLock },\n\t\t\t\t\t\t\t\topts.objectName\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(el('p:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\traw(el('a:graphic', null, raw(el('a:graphicData', { uri: OLE_NS }, raw(alternateContent))))),\n\t])\n}\n","/**\n * ts-pptx: DrawingML table-cell borders\n *\n * Emit the `<a:lnL>/<a:lnR>/<a:lnT>/<a:lnB>` border children of a table cell's\n * `<a:tcPr>`, in the LRTB document order PowerPoint requires, plus the two\n * optional diagonals (`<a:lnTlToBr>`/`<a:lnBlToTr>`) that follow them.\n */\n\nimport type { BorderProps, TableCellDiagonals } from '../../types/index.js'\nimport { genXmlColorSelection } from './fill.js'\nimport { createLineCap, resolveBorderDash, resolveBorderWidth } from './line.js'\nimport { valToPts } from '../../units-internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\n/**\n * One `<a:lnX>` border element. Every side of a table cell — the four edges and the two\n * diagonals — is a `CT_LineProperties`, so they differ only in element name.\n * @param {string} name - the element's local name (`lnL`, `lnTlToBr`, …)\n * @param {BorderProps} border - the resolved border for that side\n * @return {string} the border element XML\n */\nfunction genBorderLine(name: string, border: BorderProps): string {\n\tconst cap = createLineCap(border.cap)\n\tif (border.type === 'none') return el(`a:${name}`, { w: 0, cap, cmpd: 'sng', algn: 'ctr' }, raw(voidEl('a:noFill')))\n\treturn el(\n\t\t`a:${name}`,\n\t\t{ w: valToPts(resolveBorderWidth(border, 1)), cap, cmpd: 'sng', algn: 'ctr' },\n\t\t[\n\t\t\tgenXmlColorSelection({ color: border.color ?? '363636', transparency: border.transparency }),\n\t\t\tvoidEl('a:prstDash', { val: resolveBorderDash(border) }),\n\t\t\tvoidEl('a:round'),\n\t\t\tvoidEl('a:headEnd', { type: 'none', w: 'med', len: 'med' }),\n\t\t\tvoidEl('a:tailEnd', { type: 'none', w: 'med', len: 'med' }),\n\t\t].map(raw)\n\t)\n}\n\n/**\n * Emit the border children of an `<a:tcPr>` for a table cell: the four edges, then the two\n * diagonals when the cell asks for them.\n *\n * The edges are shared by normal cells and the dummy span (`_hmerge`/`_vmerge`) cells so a\n * merged region's outer edges render with the same border as its origin cell. The diagonals\n * are **not**: a diagonal across a merged region is one stroke corner-to-corner, and\n * repeating it on each covered cell would draw a sawtooth instead. Only the span origin\n * carries them, which is also where PowerPoint puts them.\n *\n * A side may be missing, and missing is not the same as `{type:'none'}`: `none` writes an\n * explicit `w=\"0\"` rule, which is direct formatting and overrides whatever a built-in table\n * style would have drawn there, while an omitted side leaves that edge to the style. The\n * definition step sends every cell here dense; a caller reaching this directly may not.\n *\n * @param {BorderProps[]} cellBorder - up to a 4-tuple of border props in [top, right, bottom, left] order\n * @param {TableCellDiagonals} [diagonal] - the cell's optional corner-to-corner rules\n * @return {string} concatenated border element XML, in the document order PowerPoint expects\n */\nexport function genTableCellBorderXml(\n\tcellBorder: ReadonlyArray<BorderProps | undefined>,\n\tdiagonal?: TableCellDiagonals\n): string {\n\tlet strXml = ''\n\t// NOTE: *** IMPORTANT! *** LRTB order matters! (Reorder a line below to watch the borders go wonky in MS-PPT-2013!!)\n\t;(\n\t\t[\n\t\t\t{ idx: 3, name: 'lnL' },\n\t\t\t{ idx: 1, name: 'lnR' },\n\t\t\t{ idx: 0, name: 'lnT' },\n\t\t\t{ idx: 2, name: 'lnB' },\n\t\t] as const\n\t).forEach((obj) => {\n\t\tconst border = cellBorder[obj.idx]\n\t\tif (!border) return\n\t\tstrXml += genBorderLine(obj.name, border)\n\t})\n\t// CT_TableCellProperties declares the diagonals immediately after `lnB` and before\n\t// `cell3D`/the fill, so they append here rather than being emitted by the caller.\n\tif (diagonal?.tlToBr) strXml += genBorderLine('lnTlToBr', diagonal.tlToBr)\n\tif (diagonal?.blToTr) strXml += genBorderLine('lnBlToTr', diagonal.blToTr)\n\treturn strXml\n}\n","/**\n * ts-pptx: DrawingML table-cell 3-D bevel\n *\n * Emit the `<a:cell3D>` child of a table cell's `<a:tcPr>`. `CT_Cell3D` is a **required**\n * `a:bevel` plus an optional `a:lightRig`, which is why an empty `cell3D: {}` still produces\n * a bevel element (at the schema's own defaults) rather than an empty, invalid `a:cell3D`.\n *\n * The surface is deliberately minimal — preset, size, material and light rig. PowerPoint's\n * table UI exposes no control for any of it, so a cell3D reaches a deck from a theme or\n * another producer; this exists to author and reproduce one, not to model DrawingML 3-D.\n */\n\nimport type { TableCell3DProps } from '../../types/index.js'\nimport { warnOnce } from '../../diagnostics.js'\nimport { checkEnumOrWarn } from '../../ooxml/check-enum.js'\nimport { BEVEL_PRESETS, LIGHT_RIGS, LIGHT_RIG_DIRECTIONS, PRESET_MATERIALS } from '../../ooxml/st-enums.js'\nimport { valToPts } from '../../units-internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\n/**\n * Vet one enumerated value before it reaches the XML, reporting and dropping anything outside\n * its `ST_` union. See `ooxml/check-enum.ts` for why the write path drops rather than throws.\n */\nfunction resolveEnum<T extends string>(value: string | undefined, valid: readonly T[], field: string): T | null {\n\treturn checkEnumOrWarn(value, valid, 'table/invalid-cell3d', `table cell: cell3D \\`${field}\\``, { field })\n}\n\n/**\n * A bevel dimension in EMU (`ST_PositiveCoordinate`), from a width in points.\n * A negative or non-finite value cannot be written, so it falls back to the attribute's\n * own default of 76200 EMU (6pt) rather than emitting something PowerPoint would reject.\n */\nfunction bevelSizeEmu(points: number | undefined, field: string): number | null {\n\tif (points === undefined || points === null) return null\n\tif (!Number.isFinite(points) || points < 0) {\n\t\twarnOnce(\n\t\t\t'table/invalid-cell3d',\n\t\t\t`table cell: cell3D \\`${field}\\` must be a non-negative number of points; \\`${String(points)}\\` is ignored.`,\n\t\t\t{ received: points, field }\n\t\t)\n\t\treturn null\n\t}\n\treturn valToPts(points)\n}\n\n/**\n * Emit a cell's `<a:cell3D>`, or `''` when it has none.\n * @param {TableCell3DProps} [cell3D] - the cell's 3-D options\n * @return {string} the `a:cell3D` element XML\n */\nexport function genTableCell3DXml(cell3D?: TableCell3DProps): string {\n\tif (!cell3D || typeof cell3D !== 'object') return ''\n\tconst bevel = voidEl('a:bevel', {\n\t\tw: bevelSizeEmu(cell3D.width, 'width'),\n\t\th: bevelSizeEmu(cell3D.height, 'height'),\n\t\tprst: resolveEnum(cell3D.preset, BEVEL_PRESETS, 'preset'),\n\t})\n\t// Both `rig` and `dir` are required on CT_LightRig, so a half-specified rig is dropped\n\t// whole — emitting one attribute would produce a part PowerPoint calls corrupt.\n\tconst rig = resolveEnum(cell3D.lightRig?.rig, LIGHT_RIGS, 'lightRig.rig')\n\tconst dir = resolveEnum(cell3D.lightRig?.dir, LIGHT_RIG_DIRECTIONS, 'lightRig.dir')\n\tconst lightRig = rig && dir ? voidEl('a:lightRig', { rig, dir }) : ''\n\tif (cell3D.lightRig && !lightRig) {\n\t\twarnOnce(\n\t\t\t'table/invalid-cell3d',\n\t\t\t'table cell: cell3D `lightRig` needs both `rig` and `dir` (both are required by CT_LightRig); ' +\n\t\t\t\t'the light rig is dropped and the bevel takes the renderer default.',\n\t\t\t{ received: cell3D.lightRig }\n\t\t)\n\t}\n\treturn el('a:cell3D', { prstMaterial: resolveEnum(cell3D.material, PRESET_MATERIALS, 'material') }, [\n\t\traw(bevel),\n\t\tlightRig ? raw(lightRig) : null,\n\t])\n}\n","/**\n * ts-pptx: table slide-object serialization\n *\n * Emits a `table` slide object as a `<p:graphicFrame>` wrapping `<a:tbl>`: the merge grid\n * (`_hmerge`/`_vmerge` dummy cells for col/rowspan), the column widths, and per-cell borders,\n * fill, margins and text body.\n */\n\nimport { SlideObjectType } from '../../../enums.js'\nimport { DEF_CELL_MARGIN_IN } from '../../../constants-internal.js'\nimport type { BorderProps, ObjectOptions, TableCell, TableCellProps } from '../../../types/index.js'\nimport type { SlideObject } from '../../../types/internal.js'\nimport { checkEnumOrWarn } from '../../../ooxml/check-enum.js'\nimport { TEXT_HORZ_OVERFLOW } from '../../../ooxml/st-enums.js'\nimport { genXmlColorSelection } from '../../drawingml/fill.js'\nimport { genXmlObjectLock, GRAPHIC_FRAME_LOCK_ATTRS } from '../../drawingml/locks.js'\nimport { genTableCellBorderXml } from '../../drawingml/table-border.js'\nimport { genTableCell3DXml } from '../../drawingml/table-cell3d.js'\nimport { genXmlPlaceholder, genXmlTextBody } from '../../drawingml/text-body.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../../oxml/el.js'\nimport { inch2Emu, marginToEmu, resolveTableColWidthsEmu } from '../../../units-internal.js'\nimport { EMU_PER_INCH } from '../../../units.js'\nimport { cNvPrOpen, P14_NS } from './shared.js'\n\ntype TableInheritableOption =\n\t| 'align'\n\t| 'bold'\n\t| 'border'\n\t| 'color'\n\t| 'fill'\n\t| 'fontFace'\n\t| 'fontSize'\n\t| 'margin'\n\t| 'textDirection'\n\t| 'underline'\n\t| 'valign'\ntype TableInheritableValue = ObjectOptions[TableInheritableOption]\n\n/**\n * Validate a cell's `horzOverflow` before it reaches the XML, reporting and dropping anything\n * outside `ST_TextHorzOverflowType`. `undefined` (the common case) emits nothing.\n */\nfunction resolveHorzOverflow(value: TableCellProps['horzOverflow']): string | null {\n\treturn checkEnumOrWarn(value, TEXT_HORZ_OVERFLOW, 'table/invalid-horz-overflow', 'table cell: horzOverflow')\n}\n\n/** A cell's grid position, for deciding which of the table's outer edges it sits on. */\ninterface GridEdge {\n\trIdx: number\n\tcIdx: number\n\tlastRow: number\n\tlastCol: number\n}\n\n/**\n * Overlay `TableProps.outerBorder` onto one cell's own 4-side border tuple.\n *\n * The perimeter is decided per **grid position**, not per authored cell, which is what makes\n * merges work: a colspan's origin sits at the left of its span and its covered `_hmerge`\n * cells sit to the right, so a span straddling the last column gets that column's rule on the\n * covered cell — exactly where PowerPoint defines a merged region's outer edge. A cell in the\n * table's interior touches no edge and comes back untouched.\n *\n * Returns the input array (not a copy) when nothing applies, so the common no-perimeter path\n * allocates nothing and stays byte-identical. Never mutates: `arrTabRows` holds the caller's\n * own cell objects and repeated `write()` calls must not accumulate borders.\n *\n * @param base - the cell's resolved `[top, right, bottom, left]` borders, or `null` when it has none\n * @param outer - the normalized perimeter tuple, `undefined` for a side the caller left out\n * @param at - where this cell sits in the merge grid\n * @returns the borders to emit, or `null` when there are none and the perimeter adds none\n */\nfunction applyOuterBorder(\n\tbase: ReadonlyArray<BorderProps | undefined> | null,\n\touter: ReadonlyArray<BorderProps | undefined> | undefined,\n\tat: GridEdge\n): ReadonlyArray<BorderProps | undefined> | null {\n\tif (!outer) return base\n\t// TRBL, matching the public tuple order.\n\tconst onEdge = [at.rIdx === 0, at.cIdx === at.lastCol, at.rIdx === at.lastRow, at.cIdx === 0]\n\tconst applies = ([0, 1, 2, 3] as const).filter((idx) => onEdge[idx] && outer[idx])\n\tif (applies.length === 0) return base\n\t// A cell with no borders of its own has the other three sides spelled out as `{type:'none'}`\n\t// — what the definition step puts on an unstyled cell, so this matches rather than invents.\n\tconst merged: (BorderProps | undefined)[] = base\n\t\t? [...base]\n\t\t: [{ type: 'none' }, { type: 'none' }, { type: 'none' }, { type: 'none' }]\n\tfor (const idx of applies) {\n\t\tconst side = outer[idx]\n\t\tif (side) merged[idx] = side\n\t}\n\treturn merged\n}\n\n/**\n * Render a `table` slide object to its `<p:graphicFrame>` XML (merge-grid, row/col spans, per-cell styling).\n */\nexport function renderTableObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\tplaceholderObj: SlideObject | null,\n\titemOpts: ObjectOptions\n): string {\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\tlet strXml: string\n\tlet arrTabRows: TableCell[][] = []\n\tlet objTabOpts: ObjectOptions = {}\n\tlet intColCnt = 0\n\tlet tblInner = ''\n\tlet cellOpts: TableCellProps | null = null\n\t// Shallow-clone each row so splice() in the merge-grid builder does not mutate the stored\n\t// arrTabRows, which would corrupt output on repeated write()/writeFile() calls.\n\tarrTabRows = (slideItemObj.arrTabRows ?? []).map((row) => [...row])\n\tobjTabOpts = slideItemObj.options\n\tintColCnt = 0\n\n\t// Calc number of columns\n\t// NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not\n\t// ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd\n\t;(arrTabRows[0] ?? []).forEach((cell) => {\n\t\tcellOpts = cell.options || null\n\t\tintColCnt += cellOpts?.colspan ? Number(cellOpts.colspan) : 1\n\t})\n\n\t// STEP 1: Start Table XML\n\t// NOTE: The cNvPr id must be unique among ALL shapes on the slide. A table is an\n\t// ordinary top-level slide object, so it uses the same `idx + 2` scheme as every other\n\t// object type below. The legacy `intTableNum * slide._slideNum + 1` formula could collide\n\t// with another shape's `idx + 2` on the same slide (e.g. a table plus enough sibling\n\t// shapes on slide 7), producing a duplicate id that makes PowerPoint report the file as\n\t// corrupt/unreadable (0x80070570) while LibreOffice silently tolerates it.\n\tstrXml =\n\t\t'<p:graphicFrame><p:nvGraphicFramePr>' +\n\t\tcNvPrOpen(idx + 2, slideItemObj.options.objectName, slideItemObj.options.altText || '') +\n\t\t'/>'\n\tstrXml +=\n\t\tel(\n\t\t\t'p:cNvGraphicFramePr',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tgenXmlObjectLock(\n\t\t\t\t\t'a:graphicFrameLocks',\n\t\t\t\t\tGRAPHIC_FRAME_LOCK_ATTRS,\n\t\t\t\t\t{ noGrp: true, ...slideItemObj.options.objectLock },\n\t\t\t\t\tslideItemObj.options.objectName\n\t\t\t\t)\n\t\t\t)\n\t\t) +\n\t\t// A table bound to a layout placeholder emits that placeholder's <p:ph> (idx/type) so\n\t\t// PowerPoint treats the graphicFrame as filling the placeholder. The <p:ph>\n\t\t// precedes <p:extLst> per CT_ApplicationNonVisualDrawingProps document order.\n\t\tel(\n\t\t\t'p:nvPr',\n\t\t\tnull,\n\t\t\t[\n\t\t\t\traw(genXmlPlaceholder(placeholderObj)),\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:extLst',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t'p:ext',\n\t\t\t\t\t\t\t\t{ uri: '{D42A27DB-BD31-4B8C-83A1-F6EECF244321}' },\n\t\t\t\t\t\t\t\traw(voidEl('p14:modId', { 'xmlns:p14': P14_NS, val: '1579011935' }))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t],\n\t\t\t{ openPrefix: ' ' }\n\t\t) +\n\t\t'</p:nvGraphicFramePr>'\n\tstrXml += el('p:xfrm', null, [\n\t\traw(voidEl('a:off', { x: x || (x === 0 ? 0 : EMU_PER_INCH), y: y || (y === 0 ? 0 : EMU_PER_INCH) })),\n\t\traw(voidEl('a:ext', { cx: cx || (cx === 0 ? 0 : EMU_PER_INCH), cy: cy || EMU_PER_INCH })),\n\t])\n\t{\n\t\t// NOTE: attribute ORDER is byte-significant. None of these flags appears in the byte-gate\n\t\t// baseline (zero parts each), so their emission is pinned by test/regression instead.\n\t\tconst tblPrAttrs: XmlAttrs = {\n\t\t\trtl: objTabOpts.rtl ? '1' : null,\n\t\t\tfirstRow: objTabOpts.hasHeader ? '1' : null,\n\t\t\tlastRow: objTabOpts.hasFooter ? '1' : null,\n\t\t\tbandRow: objTabOpts.hasBandedRows ? '1' : null,\n\t\t\tbandCol: objTabOpts.hasBandedColumns ? '1' : null,\n\t\t\tfirstCol: objTabOpts.hasFirstColumn ? '1' : null,\n\t\t\tlastCol: objTabOpts.hasLastColumn ? '1' : null,\n\t\t}\n\t\t// `CT_TableProperties` sequences its children as EG_FillProperties, EG_EffectProperties,\n\t\t// then the tableStyle/tableStyleId choice — so a table background precedes the style id.\n\t\t// (No effects surface: PowerPoint's UI exposes no table-level effect, so a source deck\n\t\t// will not contain one and there would be nothing to reproduce.)\n\t\tconst tableFillXml = objTabOpts.tableFill ? genXmlColorSelection(objTabOpts.tableFill) : ''\n\t\tconst tblPrChildren =\n\t\t\ttableFillXml + (objTabOpts.tableStyle ? el('a:tableStyleId', null, objTabOpts.tableStyle) : '')\n\t\t// Paired when it carries a fill or a style id, else self-closing — an arity difference.\n\t\tconst tblPr = tblPrChildren ? el('a:tblPr', tblPrAttrs, raw(tblPrChildren)) : voidEl('a:tblPr', tblPrAttrs)\n\t\t// The `<a:tbl>` children accumulate here and are wrapped once at STEP 5, so the byte-significant\n\t\t// (and non-depth-regular) indentation on the closing tags is described in one place.\n\t\ttblInner = tblPr\n\t}\n\n\t// `addTableDefinition` normalizes `outerBorder` to a TRBL tuple, but a table object built by\n\t// hand (or replayed from an older serialized form) can still carry the single-`BorderProps`\n\t// form, so broadcast that here rather than silently dropping the perimeter.\n\tconst outerBorder: ReadonlyArray<BorderProps | undefined> | undefined = !objTabOpts.outerBorder\n\t\t? undefined\n\t\t: Array.isArray(objTabOpts.outerBorder)\n\t\t\t? objTabOpts.outerBorder\n\t\t\t: [objTabOpts.outerBorder, objTabOpts.outerBorder, objTabOpts.outerBorder, objTabOpts.outerBorder]\n\n\t// STEP 2: Set column widths\n\t// Per-column inches from an explicit `colW` array, else split the table's\n\t// resolved EMU width (`cx`) evenly. `resolveTableColWidthsEmu` is the single\n\t// source of truth shared with the measured-fit pass. NOTE: divide the EMU\n\t// width, not the raw inches `options.w` — the latter collapsed auto-width\n\t// tables to ~0-EMU columns (e.g. `w=9` → `gridCol w=\"3\"`).\n\t{\n\t\tconst gridColsEmu = resolveTableColWidthsEmu(objTabOpts.colW, cx, intColCnt)\n\t\ttblInner += el(\n\t\t\t'a:tblGrid',\n\t\t\tnull,\n\t\t\tgridColsEmu.map((w) => raw(voidEl('a:gridCol', { w })))\n\t\t)\n\t}\n\n\t// STEP 3: Build our row arrays into an actual grid to match the XML we will be building next\n\t// Note row arrays can arrive \"lopsided\" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,\n\t// so a simple loop below in XML building wont suffice to build table correctly.\n\t// We have to build an actual grid now\n\t/*\n\t\t\t\t\tEX: (A0:rowspan=3, B1:rowspan=2, C1:colspan=2)\n\n\t\t\t\t\t/------|------|------|------\\\n\t\t\t\t\t| A0 | B0 | C0 | D0 |\n\t\t\t\t\t| | B1 | C1 | |\n\t\t\t\t\t| | | C2 | D2 |\n\t\t\t\t\t\\------|------|------|------/\n\t\t\t\t*/\n\t// A: add _hmerge cell for colspan. should reserve rowspan\n\tarrTabRows.forEach((cells) => {\n\t\tfor (let cIdx = 0; cIdx < cells.length;) {\n\t\t\tconst cell = cells[cIdx]\n\t\t\tif (!cell) break\n\t\t\tconst colspan = cell.options?.colspan\n\t\t\tconst rowspan = cell.options?.rowspan\n\t\t\tif (colspan && colspan > 1) {\n\t\t\t\tconst vMergeCells = new Array(colspan - 1).fill(undefined).map(() => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t\t\toptions: { rowspan },\n\t\t\t\t\t\t_hmerge: true,\n\t\t\t\t\t\t_spanOrigin: cell,\n\t\t\t\t\t} as const\n\t\t\t\t})\n\t\t\t\tcells.splice(cIdx + 1, 0, ...vMergeCells)\n\t\t\t\tcIdx += colspan\n\t\t\t} else {\n\t\t\t\tcIdx += 1\n\t\t\t}\n\t\t}\n\t})\n\t// B: add _vmerge cell for rowspan. should reserve colspan/_hmerge\n\tarrTabRows.forEach((cells, rIdx) => {\n\t\tconst nextRow = arrTabRows[rIdx + 1]\n\t\tif (!nextRow) return\n\t\tcells.forEach((cell, cIdx) => {\n\t\t\tconst rowspan = cell._rowContinue || cell.options?.rowspan\n\t\t\tconst colspan = cell.options?.colspan\n\t\t\tconst _hmerge = cell._hmerge\n\t\t\tif (rowspan && rowspan > 1) {\n\t\t\t\t// Point back to the true origin cell: when `cell` is itself an `_hmerge` dummy\n\t\t\t\t// (combined colspan+rowspan), use its origin rather than the dummy.\n\t\t\t\tconst _spanOrigin = cell._spanOrigin || cell\n\t\t\t\tconst hMergeCell = {\n\t\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t\toptions: { colspan },\n\t\t\t\t\t_rowContinue: rowspan - 1,\n\t\t\t\t\t_vmerge: true,\n\t\t\t\t\t_hmerge,\n\t\t\t\t\t_spanOrigin,\n\t\t\t\t} as const\n\t\t\t\tnextRow.splice(cIdx, 0, hMergeCell)\n\t\t\t}\n\t\t})\n\t})\n\n\t// STEP 4: Build table rows/cells\n\tarrTabRows.forEach((cells, rIdx) => {\n\t\t// A: Table Height provided without rowH? Then distribute rows\n\t\tlet intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work\n\t\tif (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]))\n\t\telse if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH))\n\t\telse if (itemOpts.cy || itemOpts.h) {\n\t\t\t// `cy` already holds the table height resolved to EMU (line ~276), correctly handling\n\t\t\t// inches/percent/unit-string inputs — reuse it rather than re-parsing options.h.\n\t\t\tintRowH = Math.round((itemOpts.h ? cy : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length)\n\t\t}\n\n\t\t// B: Start row — cells accumulate here and the row wraps them once, below.\n\t\tconst rowCells: string[] = []\n\n\t\t// C: Loop over each CELL\n\t\tcells.forEach((cellObj, cIdx) => {\n\t\t\tconst cell: TableCell = cellObj\n\t\t\t// The grid is rectangular by now (STEP 3 filled every span with a dummy cell), so a\n\t\t\t// cell's index in its row *is* its grid column and the perimeter can be decided here.\n\t\t\tconst at: GridEdge = { rIdx, cIdx, lastRow: arrTabRows.length - 1, lastCol: cells.length - 1 }\n\n\t\t\t// NOTE: attribute ORDER is byte-significant; `undefined` omits the attribute entirely,\n\t\t\t// which is what the old `.filter(([, v]) => !!v)` did.\n\t\t\tconst cellSpanAttrs: XmlAttrs = {\n\t\t\t\trowSpan: cell.options?.rowspan && cell.options.rowspan > 1 ? cell.options.rowspan : undefined,\n\t\t\t\tgridSpan: cell.options?.colspan && cell.options.colspan > 1 ? cell.options.colspan : undefined,\n\t\t\t\tvMerge: cell._vmerge ? 1 : undefined,\n\t\t\t\thMerge: cell._hmerge ? 1 : undefined,\n\t\t\t}\n\n\t\t\t// 1: COLSPAN/ROWSPAN: Emit the dummy covered cell for any active span. PowerPoint defines a\n\t\t\t// merged region's outer edges (e.g. the right border of a colspan, the bottom border of a\n\t\t\t// rowspan) on the *covered* cells, so inherit the origin cell's border + fill here instead of\n\t\t\t// emitting an empty `<a:tcPr/>` that drops those edges.\n\t\t\tif (cell._hmerge || cell._vmerge) {\n\t\t\t\tconst origin = cell._spanOrigin\n\t\t\t\tconst originOpts = origin?.options || {}\n\t\t\t\tlet spanPrXml = ''\n\t\t\t\t// Outside the `origin` guard below: a covered cell on the table's edge carries that\n\t\t\t\t// edge's rule whether or not its origin was resolvable.\n\t\t\t\tconst originBorder = applyOuterBorder(\n\t\t\t\t\tArray.isArray(originOpts.border) ? originOpts.border : null,\n\t\t\t\t\touterBorder,\n\t\t\t\t\tat\n\t\t\t\t)\n\t\t\t\tif (originBorder) spanPrXml += genTableCellBorderXml(originBorder)\n\t\t\t\tif (origin) {\n\t\t\t\t\t// Resolve the origin's fill with the same precedence the origin cell itself uses below,\n\t\t\t\t\t// so the whole merged region fills uniformly. This is the origin's fill *object*, so\n\t\t\t\t\t// an image fill arrives with its `_imgRid` already stashed and the covered cell emits\n\t\t\t\t\t// a `blipFill` against the same relationship.\n\t\t\t\t\t// NOTE: PowerPoint itself writes a bare `<a:tcPr/>` on a covered cell and repeats no\n\t\t\t\t\t// fill there (verified against `test/read/fixtures/table-cell-image-fill.pptx`). We\n\t\t\t\t\t// diverge deliberately: a covered cell is never rendered — the origin spans over it —\n\t\t\t\t\t// so copying the fill is invisible either way, and keeping it uniform with the solid\n\t\t\t\t\t// case avoids a branch that would change nothing on screen.\n\t\t\t\t\tconst spanFill = originOpts.fill || ''\n\t\t\t\t\tif (spanFill) spanPrXml += genXmlColorSelection(spanFill)\n\t\t\t\t}\n\t\t\t\t// NOTE: the covered cell is FLAT, unlike the real cell below, which carries indentation\n\t\t\t\t// before its `</a:tcPr>` and `</a:tc>`.\n\t\t\t\trowCells.push(el('a:tc', cellSpanAttrs, raw(el('a:tcPr', null, raw(spanPrXml)))))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// 2: OPTIONS: Build/set cell options\n\t\t\tconst cellOpts = cell.options || {}\n\t\t\tcell.options = cellOpts\n\n\t\t\t// B: Inherit some options from table when cell options dont exist\n\t\t\t// @see: http://officeopenxml.com/drwTableCellProperties-alignment.php\n\t\t\tconst inheritedCellOpts = cellOpts as Partial<Record<TableInheritableOption, TableInheritableValue>>\n\t\t\tconst inheritedTableOpts = objTabOpts as Partial<Record<TableInheritableOption, TableInheritableValue>>\n\t\t\t;(\n\t\t\t\t[\n\t\t\t\t\t'align',\n\t\t\t\t\t'bold',\n\t\t\t\t\t'border',\n\t\t\t\t\t'color',\n\t\t\t\t\t'fill',\n\t\t\t\t\t'fontFace',\n\t\t\t\t\t'fontSize',\n\t\t\t\t\t'margin',\n\t\t\t\t\t'textDirection',\n\t\t\t\t\t'underline',\n\t\t\t\t\t'valign',\n\t\t\t\t] as const\n\t\t\t).forEach((name) => {\n\t\t\t\tif (inheritedTableOpts[name] && !inheritedCellOpts[name] && inheritedCellOpts[name] !== 0)\n\t\t\t\t\tinheritedCellOpts[name] = inheritedTableOpts[name]\n\t\t\t})\n\n\t\t\tconst cellValign = cellOpts.valign\n\t\t\t\t? cellOpts.valign\n\t\t\t\t\t\t.replace(/^c$/i, 'ctr')\n\t\t\t\t\t\t.replace(/^m$/i, 'ctr')\n\t\t\t\t\t\t.replace('center', 'ctr')\n\t\t\t\t\t\t.replace('middle', 'ctr')\n\t\t\t\t\t\t.replace('top', 't')\n\t\t\t\t\t\t.replace('btm', 'b')\n\t\t\t\t\t\t.replace('bottom', 'b')\n\t\t\t\t: null\n\t\t\tconst cellTextDir = cellOpts.textDirection && cellOpts.textDirection !== 'horz' ? cellOpts.textDirection : null\n\n\t\t\tconst fillColor = cellOpts.fill || ''\n\t\t\tconst cellFill = fillColor ? genXmlColorSelection(fillColor) : ''\n\n\t\t\tlet cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN\n\t\t\tif (!Array.isArray(cellMargin) && typeof cellMargin === 'number')\n\t\t\t\tcellMargin = [cellMargin, cellMargin, cellMargin, cellMargin]\n\t\t\t// defensive fallback - if `cellMargin` is not a 4-element array of finite numbers, use defaults (prevents NaN in marL/R/T/B)\n\t\t\tif (\n\t\t\t\t!Array.isArray(cellMargin) ||\n\t\t\t\tcellMargin.length !== 4 ||\n\t\t\t\tcellMargin.some((v) => typeof v !== 'number' || !isFinite(v))\n\t\t\t) {\n\t\t\t\tcellMargin = DEF_CELL_MARGIN_IN\n\t\t\t}\n\t\t\t// Cell text ALWAYS wraps — PowerPoint has no per-cell no-wrap, so there is nothing to emit\n\t\t\t// for one. `wrap=\"none\"` on a cell's `<a:bodyPr>` renders inert and is stripped on the next\n\t\t\t// save, and `TextFrame.WordWrap` is read-only on a cell over COM (it reports msoTrue whatever\n\t\t\t// the XML says). `horzOverflow` below is NOT that switch: per ECMA-376 §20.1.10.68 it decides\n\t\t\t// whether a single glyph too wide for the line is clipped or draws past the cell edge.\n\t\t\t// Probe for both: `test/read/fixtures/authoring/probe-table-cell-wrap.ps1`\n\t\t\tconst cellHorzOverflow = resolveHorzOverflow(cellOpts.horzOverflow)\n\n\t\t\t// Cell margins are inches (see `marginToEmu`); a `>= 1` value warns once as a likely legacy points value.\n\t\t\t// NOTE: attribute ORDER is byte-significant (margins, then anchor, then vert). `horzOverflow`\n\t\t\t// goes last, which is both where CT_TableCellProperties declares it and where PowerPoint\n\t\t\t// writes it, so an existing cell's bytes are unchanged while it stays unset. `anchorCtr`\n\t\t\t// follows `anchor`, matching the schema's own adjacency; that the emitter's `anchor`/`vert`\n\t\t\t// pair is inverted relative to CT_TableCellProperties is pre-existing and harmless — XML\n\t\t\t// attributes are unordered, so the order is only about keeping emitted bytes stable.\n\t\t\tconst tcPrAttrs: XmlAttrs = {\n\t\t\t\tmarL: marginToEmu(cellMargin[3]),\n\t\t\t\tmarR: marginToEmu(cellMargin[1]),\n\t\t\t\tmarT: marginToEmu(cellMargin[0]),\n\t\t\t\tmarB: marginToEmu(cellMargin[2]),\n\t\t\t\tanchor: cellValign,\n\t\t\t\t// `false` is the schema default, so only `true` is worth writing.\n\t\t\t\tanchorCtr: cellOpts.anchorCtr ? '1' : null,\n\t\t\t\tvert: cellTextDir,\n\t\t\t\thorzOverflow: cellHorzOverflow,\n\t\t\t}\n\n\t\t\t// 4: Set CELL content and properties; 5: borders; 6: fill ==============\n\t\t\t// The trailing indentation before `</a:tcPr>` and `</a:tc>` is byte-significant.\n\t\t\t// Child order is the CT_TableCellProperties sequence: the four edges, the two diagonals,\n\t\t\t// `cell3D`, then the fill. Unlike the edges, the diagonals are NOT copied onto a merged\n\t\t\t// region's covered cells (see `genTableCellBorderXml`).\n\t\t\tconst cellBorder = applyOuterBorder(Array.isArray(cellOpts.border) ? cellOpts.border : null, outerBorder, at)\n\t\t\tconst cellDiagonal = cellOpts.diagonal\n\t\t\tconst cellBorderXml = cellBorder || cellDiagonal ? genTableCellBorderXml(cellBorder ?? [], cellDiagonal) : ''\n\t\t\trowCells.push(\n\t\t\t\tel(\n\t\t\t\t\t'a:tc',\n\t\t\t\t\tcellSpanAttrs,\n\t\t\t\t\t[\n\t\t\t\t\t\traw(genXmlTextBody(cell)),\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tel('a:tcPr', tcPrAttrs, [raw(cellBorderXml), raw(genTableCell3DXml(cellOpts.cell3D)), raw(cellFill)], {\n\t\t\t\t\t\t\t\tclosePrefix: ' ',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\t{ closePrefix: ' ' }\n\t\t\t\t)\n\t\t\t)\n\t\t})\n\n\t\t// D: Complete row\n\t\ttblInner += el('a:tr', { h: intRowH }, rowCells.map(raw))\n\t})\n\n\t// STEP 5: Complete table. NOTE: the closing tags carry indentation the opening tags do not,\n\t// so each `closePrefix` is stated explicitly rather than derived from depth.\n\tstrXml += el(\n\t\t'a:graphic',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'a:graphicData',\n\t\t\t\t{ uri: 'http://schemas.openxmlformats.org/drawingml/2006/table' },\n\t\t\t\traw(el('a:tbl', null, raw(tblInner), { closePrefix: ' ' })),\n\t\t\t\t{ closePrefix: ' ' }\n\t\t\t)\n\t\t),\n\t\t{ closePrefix: ' ' }\n\t)\n\tstrXml += '</p:graphicFrame>'\n\n\treturn strXml\n}\n","/**\n * ts-pptx: text / placeholder slide-object serialization\n *\n * Emits a `text` or `placeholder` slide object as a `<p:sp>`: body insets from the caller's\n * margin, the shape geometry (preset or custom), fill, outline and shadow, then the text body.\n * An equation-bearing shape is wrapped in the `a14` markup-compatibility envelope.\n */\n\nimport { SlideObjectType } from '../../../enums.js'\nimport { DEF_TEXT_SHADOW } from '../../../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideObject } from '../../../types/internal.js'\nimport { createShadowEffectLst } from '../../drawingml/effect.js'\nimport { genXmlColorSelection } from '../../drawingml/fill.js'\nimport { genXmlCustGeom, genXmlPresetGeom } from '../../drawingml/geometry.js'\nimport { genXmlObjectLock, SHAPE_LOCK_ATTRS } from '../../drawingml/locks.js'\nimport { genXmlPlaceholder, genXmlTextBody, objectHasMath } from '../../drawingml/text-body.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../../oxml/el.js'\nimport { marginToEmu } from '../../../units-internal.js'\nimport { EMU_PER_INCH } from '../../../units.js'\nimport { cNvPrHyperlink, cNvPrOpen, genXmlShapeLine } from './shared.js'\n\n/**\n * Render a `text` / `placeholder` slide object to its `<p:sp>` XML.\n */\nexport function renderTextObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tslide: PresSlideInternal | SlideLayoutInternal,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number,\n\tplaceholderObj: SlideObject | null,\n\tlocationAttrs: XmlAttrs\n): string {\n\tlet strSlideXml = ''\n\t// Caller guarantees options is set (see slideObjectToXml); re-narrow for this scope.\n\tslideItemObj.options = slideItemObj.options || {}\n\t// Lines can have zero cy, but text should not\n\tif (!slideItemObj.options.line && cy === 0) cy = EMU_PER_INCH * 0.3\n\n\t// Margin/Padding/Inset for textboxes\n\tif (!slideItemObj.options._bodyProp) slideItemObj.options._bodyProp = {}\n\tif (slideItemObj.options.margin && Array.isArray(slideItemObj.options.margin)) {\n\t\t// Margin arrays are documented as [Top, Right, Bottom, Left] (CSS order) and table cells /\n\t\t// slide numbers already map them that way. Keep textboxes consistent: index 0=Top, 3=Left.\n\t\t// Margins are inches (see `marginToEmu`), matching cell margins and the PowerPoint dialog.\n\t\tslideItemObj.options._bodyProp.tIns = marginToEmu(slideItemObj.options.margin[0] || 0)\n\t\tslideItemObj.options._bodyProp.rIns = marginToEmu(slideItemObj.options.margin[1] || 0)\n\t\tslideItemObj.options._bodyProp.bIns = marginToEmu(slideItemObj.options.margin[2] || 0)\n\t\tslideItemObj.options._bodyProp.lIns = marginToEmu(slideItemObj.options.margin[3] || 0)\n\t} else if (typeof slideItemObj.options.margin === 'number') {\n\t\tslideItemObj.options._bodyProp.lIns = marginToEmu(slideItemObj.options.margin)\n\t\tslideItemObj.options._bodyProp.rIns = marginToEmu(slideItemObj.options.margin)\n\t\tslideItemObj.options._bodyProp.bIns = marginToEmu(slideItemObj.options.margin)\n\t\tslideItemObj.options._bodyProp.tIns = marginToEmu(slideItemObj.options.margin)\n\t}\n\n\t// A: Start SHAPE =======================================================\n\t// A native equation uses the `a14` (drawing-2010) markup-compatibility extension.\n\t// PowerPoint wraps the whole shape in <mc:AlternateContent><mc:Choice Requires=\"a14\"> so\n\t// non-a14 consumers (and schema validators) treat the a14:m subtree as a known extension.\n\tif (objectHasMath(slideItemObj)) {\n\t\tstrSlideXml += '<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">'\n\t\tstrSlideXml += '<mc:Choice xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" Requires=\"a14\">'\n\t}\n\tstrSlideXml += '<p:sp>'\n\n\t// B: The addition of the \"txBox\" attribute is the sole determiner of if an object is a shape or textbox\n\tconst txtOpts = slideItemObj.options\n\tstrSlideXml +=\n\t\t'<p:nvSpPr>' +\n\t\tcNvPrOpen(idx + 2, txtOpts.objectName, txtOpts.altText || '') +\n\t\t'>' +\n\t\tcNvPrHyperlink(txtOpts.hyperlink) +\n\t\t'</p:cNvPr>'\n\t{\n\t\tconst spLockXml = genXmlObjectLock('a:spLocks', SHAPE_LOCK_ATTRS, txtOpts.objectLock, txtOpts.objectName)\n\t\t// NOTE: paired only when there are locks to carry; otherwise self-closing. That is an arity\n\t\t// difference, so it cannot be expressed as one `el()` call.\n\t\tconst cNvSpPrAttrs: XmlAttrs = { txBox: txtOpts?.isTextBox ? '1' : null }\n\t\tstrSlideXml += spLockXml ? el('p:cNvSpPr', cNvSpPrAttrs, raw(spLockXml)) : voidEl('p:cNvSpPr', cNvSpPrAttrs)\n\t}\n\t// Prefer the resolved slide-layout placeholder; otherwise fall back to the shape's own\n\t// placeholder type so a standalone title/body text box still emits a real <p:ph>.\n\tstrSlideXml += el(\n\t\t'p:nvPr',\n\t\tnull,\n\t\traw(\n\t\t\tgenXmlPlaceholder(\n\t\t\t\tslideItemObj._type === SlideObjectType.placeholder ||\n\t\t\t\t\t(placeholderObj == null && slideItemObj.options?._placeholderType)\n\t\t\t\t\t? slideItemObj\n\t\t\t\t\t: placeholderObj\n\t\t\t)\n\t\t)\n\t)\n\tstrSlideXml += '</p:nvSpPr><p:spPr>'\n\tstrSlideXml += el('a:xfrm', locationAttrs, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])\n\n\tif (slideItemObj.shape === 'custGeom') {\n\t\tstrSlideXml += genXmlCustGeom(slideItemObj.options, cx, cy, slide._presLayout)\n\t} else {\n\t\tstrSlideXml += genXmlPresetGeom(slideItemObj.shape ?? '', slideItemObj.options, cx, cy)\n\t}\n\n\t// Option: FILL\n\t// A missing `fill` defaults to `<a:noFill/>` here — an unfilled box is what a text box\n\t// should be, and every deck ever authored against this writer depends on it. That default\n\t// is also why omission cannot mean *inherit* on this path: `fill: { type: 'inherit' }` is\n\t// the spelling that emits no fill child and lets `p:style/a:fillRef` or the placeholder\n\t// paint the interior.\n\tstrSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>'\n\n\t// shape Type: LINE: line color\n\tif (slideItemObj.options.line) strSlideXml += genXmlShapeLine(slideItemObj.options.line)\n\n\t// EFFECTS > SHADOW: REF: @see http://officeopenxml.com/drwSp-effects.php\n\tif (slideItemObj.options.shadow && slideItemObj.options.shadow.type !== 'none') {\n\t\tstrSlideXml += createShadowEffectLst(slideItemObj.options.shadow, DEF_TEXT_SHADOW)\n\t}\n\n\t// B: Close shape Properties\n\tstrSlideXml += '</p:spPr>'\n\n\t// C: Add formatted text (text body \"bodyPr\")\n\tstrSlideXml += genXmlTextBody(slideItemObj)\n\n\t// LAST: Close SHAPE =======================================================\n\tstrSlideXml += '</p:sp>'\n\n\t// Close the a14 markup-compatibility envelope for an equation-bearing shape.\n\tif (objectHasMath(slideItemObj)) strSlideXml += '</mc:Choice></mc:AlternateContent>'\n\treturn strSlideXml\n}\n","/**\n * ts-pptx: Zoom (Slide / Section / Summary) slide-object serialization\n *\n * Emits a `zoom` slide object as an `<mc:AlternateContent>`. The `mc:Choice` carries the real\n * `<p:graphicFrame>` in the 2016 zoom namespaces, read by PowerPoint 2016+; the `mc:Fallback`\n * carries a hyperlinked preview picture — or, for a Summary Zoom, a group of them — so older\n * consumers still get a clickable navigation thumbnail. See `gen/define/zoom.ts`.\n */\n\nimport type { SlideObject, ZoomInternal, ZoomTileInternal } from '../../../types/internal.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../../oxml/el.js'\nimport { cNvPrOpen, MC_NS } from './shared.js'\n\n/** Zoom (Slide/Section/Summary) graphicData URI + `mc:Choice Requires` prefix + element local-names, per variant. */\nconst ZOOM_VARIANTS = {\n\tslide: {\n\t\turi: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',\n\t\tprefix: 'pslz',\n\t\tzm: 'sldZm',\n\t\tobj: 'sldZmObj',\n\t},\n\tsection: {\n\t\turi: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',\n\t\tprefix: 'psez',\n\t\tzm: 'sectionZm',\n\t\tobj: 'sectionZmObj',\n\t},\n\tsummary: {\n\t\turi: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom',\n\t\tprefix: 'psuz',\n\t\tzm: 'summaryZm',\n\t\tobj: 'summaryZmObj',\n\t},\n} as const\n/** Namespace of the zoom preview `blipFill`/`spPr` (children of `zmPr`). */\nconst P166_NS = 'http://schemas.microsoft.com/office/powerpoint/2016/6/main'\n\n/** The `p166:blipFill` + `p166:spPr` (preview image + framed tile) shared by a zoom tile's `zmPr`. */\nfunction zoomBlipSpPr(previewRid: number, xf: { x: number; y: number; cx: number; cy: number }): string {\n\treturn (\n\t\tel('p166:blipFill', { 'xmlns:p166': P166_NS }, [\n\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${previewRid}` })),\n\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t]) +\n\t\tel('p166:spPr', { 'xmlns:p166': P166_NS }, [\n\t\t\traw(\n\t\t\t\tel('a:xfrm', null, [raw(voidEl('a:off', { x: xf.x, y: xf.y })), raw(voidEl('a:ext', { cx: xf.cx, cy: xf.cy }))])\n\t\t\t),\n\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t\t\traw(el('a:ln', { w: '3175' }, raw(el('a:solidFill', null, raw(voidEl('a:prstClr', { val: 'ltGray' })))))),\n\t\t])\n\t)\n}\n\n/** One `{prefix}:{obj}` targeting element (sldZmObj/sectionZmObj/summaryZmObj) with its nested `zmPr`. */\nfunction zoomObjEl(\n\tvariant: ZoomInternal['variant'],\n\ttile: ZoomTileInternal,\n\treturnToParent: boolean,\n\ttransitionDur: number,\n\tlocalXf: { x: number; y: number; cx: number; cy: number }\n): string {\n\tconst { prefix, obj } = ZOOM_VARIANTS[variant]\n\tconst objAttrs: XmlAttrs = variant === 'slide' ? { sldId: tile.sldId ?? null } : { sectionId: tile.sectionId ?? null }\n\t// zmPr attrs: id, (Slide Zoom only) returnToParent, transitionDur — matching PowerPoint's order.\n\tconst zmAttrs: XmlAttrs = { id: tile.zmPrId }\n\tif (variant === 'slide') zmAttrs['returnToParent'] = returnToParent ? '1' : '0'\n\tzmAttrs['transitionDur'] = transitionDur\n\treturn el(\n\t\t`${prefix}:${obj}`,\n\t\tobjAttrs,\n\t\traw(el(`${prefix}:zmPr`, zmAttrs, raw(zoomBlipSpPr(tile.previewRid, localXf))))\n\t)\n}\n\n/** The `mc:Fallback` picture (or grouped pictures) — a hyperlinked thumbnail for pre-2016 consumers. */\nfunction zoomFallbackPic(\n\tpicId: number,\n\tobjectName: string | undefined,\n\ttile: ZoomTileInternal,\n\tabsXf: { x: number; y: number; cx: number; cy: number }\n): string {\n\treturn el('p:pic', null, [\n\t\traw(\n\t\t\tel('p:nvPicPr', null, [\n\t\t\t\traw(\n\t\t\t\t\tcNvPrOpen(picId, objectName, '') +\n\t\t\t\t\t\t'>' +\n\t\t\t\t\t\tvoidEl('a:hlinkClick', { 'r:id': `rId${tile.fallbackSlideRid}`, action: 'ppaction://hlinksldjump' }) +\n\t\t\t\t\t\t'</p:cNvPr>'\n\t\t\t\t),\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p:cNvPicPr',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tvoidEl('a:picLocks', {\n\t\t\t\t\t\t\t\tnoGrp: '1',\n\t\t\t\t\t\t\t\tnoRot: '1',\n\t\t\t\t\t\t\t\tnoChangeAspect: '1',\n\t\t\t\t\t\t\t\tnoMove: '1',\n\t\t\t\t\t\t\t\tnoResize: '1',\n\t\t\t\t\t\t\t\tnoEditPoints: '1',\n\t\t\t\t\t\t\t\tnoAdjustHandles: '1',\n\t\t\t\t\t\t\t\tnoChangeArrowheads: '1',\n\t\t\t\t\t\t\t\tnoChangeShapeType: '1',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:blipFill', null, [\n\t\t\t\traw(voidEl('a:blip', { 'r:embed': `rId${tile.previewRid}` })),\n\t\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t\t])\n\t\t),\n\t\traw(\n\t\t\tel('p:spPr', null, [\n\t\t\t\traw(\n\t\t\t\t\tel('a:xfrm', null, [\n\t\t\t\t\t\traw(voidEl('a:off', { x: absXf.x, y: absXf.y })),\n\t\t\t\t\t\traw(voidEl('a:ext', { cx: absXf.cx, cy: absXf.cy })),\n\t\t\t\t\t])\n\t\t\t\t),\n\t\t\t\traw(el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))),\n\t\t\t\traw(el('a:ln', { w: '3175' }, raw(el('a:solidFill', null, raw(voidEl('a:prstClr', { val: 'ltGray' })))))),\n\t\t\t])\n\t\t),\n\t])\n}\n\n/**\n * Render a `zoom` slide object to its `<mc:AlternateContent>` XML. The `mc:Choice` carries the real\n * `<p:graphicFrame>` (Slide/Section/Summary Zoom in the 2016 zoom namespaces, read by PowerPoint\n * 2016+); the `mc:Fallback` carries a hyperlinked picture — or, for a Summary Zoom, a group of them —\n * so pre-2016 consumers still get a clickable navigation thumbnail. See `gen/define/zoom.ts`.\n */\nexport function renderZoomObject(\n\tslideItemObj: SlideObject,\n\tidx: number,\n\tx: number,\n\ty: number,\n\tcx: number,\n\tcy: number\n): string {\n\tconst zoom = slideItemObj.zoom\n\tif (!zoom) return ''\n\tconst opts = slideItemObj.options || {}\n\tconst objectName = opts.objectName\n\tconst { uri, prefix, zm } = ZOOM_VARIANTS[zoom.variant]\n\tconst firstTile = zoom.tiles[0]\n\tif (!firstTile) return '' // every zoom is registered with >= 1 tile; keeps this a total function\n\n\t// Choice: the zoom `graphicData` body. Single-tile (slide/section) uses a frame-local 0,0 xfrm;\n\t// summary lays each tile out at its precomputed grid cell (frame-local EMU).\n\tconst objectsXml =\n\t\tzoom.variant === 'summary'\n\t\t\t? zoom.tiles\n\t\t\t\t\t.map((t) =>\n\t\t\t\t\t\traw(zoomObjEl('summary', t, zoom.returnToParent, zoom.transitionDur, t.grid ?? { x: 0, y: 0, cx, cy }))\n\t\t\t\t\t)\n\t\t\t\t\t.concat(raw(voidEl(`${prefix}:gridLayout`)))\n\t\t\t: [raw(zoomObjEl(zoom.variant, firstTile, zoom.returnToParent, zoom.transitionDur, { x: 0, y: 0, cx, cy }))]\n\n\tconst graphicFrame = el('p:graphicFrame', null, [\n\t\traw(\n\t\t\tel('p:nvGraphicFramePr', null, [\n\t\t\t\traw(cNvPrOpen(idx + 2, objectName, '') + '/>'),\n\t\t\t\traw(el('p:cNvGraphicFramePr', null, raw(voidEl('a:graphicFrameLocks', { noChangeAspect: '1' })))),\n\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t])\n\t\t),\n\t\traw(el('p:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])),\n\t\traw(el('a:graphic', null, raw(el('a:graphicData', { uri }, raw(el(`${prefix}:${zm}`, null, objectsXml)))))),\n\t])\n\tconst choice = el('mc:Choice', { [`xmlns:${prefix}`]: uri, Requires: prefix }, raw(graphicFrame))\n\n\t// Fallback: a hyperlinked picture per tile at its slide-absolute position.\n\tlet fallbackInner: string\n\tif (zoom.variant === 'summary') {\n\t\tconst pics = zoom.tiles.map((t, k) => {\n\t\t\tconst g = t.grid ?? { x: 0, y: 0, cx, cy }\n\t\t\treturn raw(zoomFallbackPic(idx + 3 + k, objectName, t, { x: x + g.x, y: y + g.y, cx: g.cx, cy: g.cy }))\n\t\t})\n\t\tfallbackInner = el('p:grpSp', null, [\n\t\t\traw(\n\t\t\t\tel('p:nvGrpSpPr', null, [\n\t\t\t\t\traw(cNvPrOpen(idx + 2, objectName, '') + '/>'),\n\t\t\t\t\traw(voidEl('p:cNvGrpSpPr')),\n\t\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t\t])\n\t\t\t),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:grpSpPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('a:xfrm', null, [\n\t\t\t\t\t\t\traw(voidEl('a:off', { x, y })),\n\t\t\t\t\t\t\traw(voidEl('a:ext', { cx, cy })),\n\t\t\t\t\t\t\traw(voidEl('a:chOff', { x, y })),\n\t\t\t\t\t\t\traw(voidEl('a:chExt', { cx, cy })),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\t...pics,\n\t\t])\n\t} else {\n\t\tfallbackInner = zoomFallbackPic(idx + 2, objectName, firstTile, { x, y, cx, cy })\n\t}\n\n\treturn el('mc:AlternateContent', { 'xmlns:mc': MC_NS }, [\n\t\traw(choice),\n\t\traw(el('mc:Fallback', null, raw(fallbackInner))),\n\t])\n}\n","/**\n * ts-pptx: slide object serialization\n *\n * The per-shape `<p:spTree>` builder: `slideObjectToXml` walks a slide/layout's objects\n * (recursing into groups, allocating `<p:cNvPr>` ids as it goes) and dispatches each one to the\n * matching renderer under `objects/`. The group render and the slide-number placeholder stay\n * here because both consume the slide-wide child-id counter the walk maintains.\n * `slideObjectRelationsToXml` emits the matching `.rels` targets.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport { CRLF, DEF_PRES_LAYOUT_NAME, SLDNUMFLDID, XML_DECL } from '../../constants-internal.js'\nimport type { ObjectOptions } from '../../types/index.js'\nimport type {\n\tPresSlideInternal,\n\tSlideLayoutInternal,\n\tSlideObject,\n\tSlideRel,\n\tSlideRelChart,\n\tSlideRelMedia,\n} from '../../types/internal.js'\nimport { encodeXmlAttrValue, getDuplicateObjectNames, isHyperlinkRel } from '../utils.js'\nimport { genXmlColorSelection } from '../drawingml/fill.js'\nimport { convertRotationDegrees, getSmartParseNumber, marginToEmu } from '../../units-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { clampFontSizeSz } from '../drawingml/clamp.js'\nimport { genXmlObjectLock, GROUP_SHAPE_LOCK_ATTRS } from '../drawingml/locks.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { cNvPrOpen } from './objects/shared.js'\nimport { renderChartObject } from './objects/chart.js'\nimport { renderConnectorObject } from './objects/connector.js'\nimport { renderImageObject } from './objects/image.js'\nimport { renderMediaObject } from './objects/media.js'\nimport { renderModel3dObject } from './objects/model3d.js'\nimport { renderOleObject } from './objects/ole.js'\nimport { renderTableObject } from './objects/table.js'\nimport { renderTextObject } from './objects/text.js'\nimport { renderZoomObject } from './objects/zoom.js'\nimport { collectSlideShapeIds } from './shape-ids.js'\nimport { OFFICE_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.js'\n\n/** The MS-2007 `media` rel that pairs with an ECMA audio/video/online rel on the same Target. */\nconst MS_MEDIA_REL = 'http://schemas.microsoft.com/office/2007/relationships/media'\n/** Slide→chartEx-part relationship type (MS, not the ECMA `.../relationships/chart`). */\nconst CHARTEX_REL = 'http://schemas.microsoft.com/office/2014/relationships/chartEx'\n\n/** The four axes that make up an explicit group frame. All or nothing — see `givenGroupFrameAxes`. */\nconst GROUP_FRAME_AXES = ['x', 'y', 'w', 'h'] as const\n\n/**\n * Which of `x`/`y`/`w`/`h` a group's caller actually supplied.\n *\n * A group frame is explicit only when **all four** are given; anything less falls back to\n * auto-bounds on every axis. Partial frames used to be honoured per-axis, which let the unset ones\n * take the shared per-object defaults (`x=0`, `y=0`, `cx=75%` of the layout width, `cy=0`) — so\n * `addGroup([rect], { x: 5, y: 2 })` emitted a zero-height group whose width was a silent\n * slide-width fraction, and every child of it then re-read as `null` through the read path's\n * degenerate-`chExt` guard.\n *\n * Per-axis fallback was the other candidate, but it cannot mean what it reads like: the writer keeps\n * an identity child space (`chOff/chExt == off/ext`), so a group's frame never moves or scales its\n * children — it only places the selection handle and the rotate pivot. `{ x: 5 }` would leave the\n * children where they were and put the group's box somewhere they are not. Falling back whole, with\n * a warning, keeps the group box around its content and says so out loud.\n * @param options - the group object's options\n * @returns the supplied axis names, in `x`/`y`/`w`/`h` order\n */\nconst givenGroupFrameAxes = (options: ObjectOptions): Array<(typeof GROUP_FRAME_AXES)[number]> =>\n\tGROUP_FRAME_AXES.filter((axis) => typeof options[axis] !== 'undefined')\n\n/**\n * Whether a group's frame is fully explicit (all four of `x`/`y`/`w`/`h`), and so should be used\n * verbatim instead of the children's bounding box. See `givenGroupFrameAxes`.\n * @param options - the group object's options\n * @returns true when every axis is supplied\n */\nconst hasCompleteGroupFrame = (options: ObjectOptions): boolean =>\n\tgivenGroupFrameAxes(options).length === GROUP_FRAME_AXES.length\n\n/**\n * Normalize one axis of a placement box so its extent is never negative.\n *\n * `<a:ext cx>`/`<a:ext cy>` are `ST_PositiveCoordinate` (ECMA-376 Part 1, `CT_PositiveSize2D`), so a\n * negative extent is schema-invalid. PowerPoint rejects the *whole* presentation with \"The file or\n * directory is corrupted and unreadable\" (0x80070570) and names no shape, part, or slide, while\n * LibreOffice renders the same package happily — so the defect is invisible until the deck reaches\n * PowerPoint.\n *\n * A signed delta is the natural way to write \"draw from A to B\" (`{ x: x0, y: y0, w: x1 - x0, h: y1 - y0 }`),\n * and it goes negative the moment the line runs leftward or upward. The correct encoding is the\n * normalized bounding box plus a flip, which is what `addConnector` already derives from its own\n * endpoints (`src/gen/define/connector.ts`); this gives every other shape kind the same treatment at\n * the one point where every `Coord` form ('50%', '2in', a number) has been resolved to EMU.\n *\n * The caller composes `flip` onto any `flipH`/`flipV` the author set, so an explicit flip plus a\n * negative extent cancel out rather than double-applying.\n * @param off - the axis origin in EMU (`a:off` `x` or `y`)\n * @param ext - the axis extent in EMU (`a:ext` `cx` or `cy`), possibly negative\n * @returns the min-corner origin, the absolute extent, and whether the axis was mirrored\n */\nconst normalizeAxisExtent = (off: number, ext: number): { off: number; ext: number; flip: boolean } =>\n\text < 0 ? { off: off + ext, ext: -ext, flip: true } : { off, ext, flip: false }\n\n/**\n * Transforms a slide or slideLayout to resulting XML string - Creates `ppt/slide*.xml`\n * @param {PresSlideInternal|SlideLayoutInternal} slideObject - slide object created within createSlideObject\n * @return {string} XML string with <p:cSld> as the root\n */\nexport function slideObjectToXml(slide: PresSlideInternal | SlideLayoutInternal): string {\n\t// `_name` is escaped HERE, at emission, unlike `objectName`'s single-escape-upstream design\n\t// (see `cNvPrOpen`): `_name` doubles as the raw lookup key `addSlide({masterTitle})` matches\n\t// against the caller's `title` string (presentation.ts, `layout._name === masterTitle`), so it\n\t// must stay unescaped until the last possible moment or that match breaks for any title\n\t// containing `&`/`<`/`\"`. Plain slides' default `_name` (\"Slide N\", slide.ts) never contains\n\t// XML metacharacters, so escaping it here is a no-op for that path.\n\t// The element stays a template because it wraps the entire slide, built by append below.\n\tlet strSlideXml: string = slide._name ? '<p:cSld name=\"' + encodeXmlAttrValue(slide._name) + '\">' : '<p:cSld>'\n\n\t// Warn on duplicate Selection Pane identities within this slide. Unique `objectName`\n\t// values are what consumers (e.g. semantic manifests) rely on, so flag collisions loudly.\n\t// Groups are recursed into: a group's children are `<p:cNvPr>`-named on this same slide, so a\n\t// child colliding with a top-level object (or with a child of another group) is a collision the\n\t// Selection Pane shows — checking only the top level cannot see it.\n\tconst collectObjectNames = (objects: SlideObject[]): string[] =>\n\t\tobjects.flatMap((obj) => [\n\t\t\t...(typeof obj.options?.objectName === 'string' ? [obj.options.objectName] : []),\n\t\t\t...collectObjectNames(obj._groupObjects || []),\n\t\t])\n\tconst duplicateObjectNames = getDuplicateObjectNames(collectObjectNames(slide._slideObjects))\n\tif (duplicateObjectNames.length > 0) {\n\t\twarn(\n\t\t\t'object-name/duplicate',\n\t\t\t`duplicate objectName value(s) emitted on a single slide: ${duplicateObjectNames.join(', ')}. Selection Pane identities should be unique.`\n\t\t)\n\t}\n\n\t// STEP 1: Add background color/image (ensure only a single `<p:bg>` tag is created, ex: when master-baskground has both `color` and `path`)\n\tif (slide._bkgdImgRid) {\n\t\tstrSlideXml += el(\n\t\t\t'p:bg',\n\t\t\tnull,\n\t\t\traw(\n\t\t\t\tel('p:bgPr', null, [\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('a:blipFill', { dpi: '0', rotWithShape: '1' }, [\n\t\t\t\t\t\t\traw(el('a:blip', { 'r:embed': `rId${slide._bkgdImgRid}` }, raw(voidEl('a:lum')))),\n\t\t\t\t\t\t\traw(voidEl('a:srcRect')),\n\t\t\t\t\t\t\traw(el('a:stretch', null, raw(voidEl('a:fillRect')))),\n\t\t\t\t\t\t])\n\t\t\t\t\t),\n\t\t\t\t\traw(voidEl('a:effectLst')),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\t} else if (slide.background?.color || slide.background?.type === 'gradient') {\n\t\tstrSlideXml += el(\n\t\t\t'p:bg',\n\t\t\tnull,\n\t\t\traw(el('p:bgPr', null, [raw(genXmlColorSelection(slide.background)), raw(voidEl('a:effectLst'))]))\n\t\t)\n\t} else if (!slide.background && slide._name && slide._name === DEF_PRES_LAYOUT_NAME) {\n\t\t// NOTE: Default [white] background is needed on slideMaster1.xml to avoid gray background in Keynote (and Finder previews)\n\t\tstrSlideXml += el('p:bg', null, raw(el('p:bgRef', { idx: '1001' }, raw(voidEl('a:schemeClr', { val: 'bg1' })))))\n\t}\n\n\t// STEP 2: Continue slide by starting spTree node\n\t// spTree root — OOXML requires the shape tree to open with the implicit top-level group's\n\t// non-visual props (`<p:nvGrpSpPr>`, the reserved `cNvPr id=\"1\"`) and an identity group\n\t// transform (off/ext and chOff/chExt all zero) before any child shape. This is the slide's\n\t// built-in root group, not a user-authored `addGroup` — hence the zeroed frame.\n\tstrSlideXml += '<p:spTree>'\n\tstrSlideXml += el('p:nvGrpSpPr', null, [\n\t\traw(voidEl('p:cNvPr', { id: '1', name: '' })),\n\t\traw(voidEl('p:cNvGrpSpPr')),\n\t\traw(voidEl('p:nvPr')),\n\t])\n\tstrSlideXml += el(\n\t\t'p:grpSpPr',\n\t\tnull,\n\t\traw(\n\t\t\tel('a:xfrm', null, [\n\t\t\t\traw(voidEl('a:off', { x: '0', y: '0' })),\n\t\t\t\traw(voidEl('a:ext', { cx: '0', cy: '0' })),\n\t\t\t\traw(voidEl('a:chOff', { x: '0', y: '0' })),\n\t\t\t\traw(voidEl('a:chExt', { cx: '0', cy: '0' })),\n\t\t\t])\n\t\t)\n\t)\n\n\t// Every object's <p:cNvPr> id, up front, for the references that cannot wait for the walk below\n\t// to reach their target (connector shape bindings, animation spids). `collectSlideShapeIds`\n\t// mirrors the allocation performed here — keep the two in step.\n\tconst shapeIds = collectSlideShapeIds(slide._slideObjects)\n\n\t// STEP 3: Loop over all Slide.data objects and add them to this slide.\n\t// Allocates <p:cNvPr id> values for group children, which are not in `slide._slideObjects`\n\t// and so cannot reuse the top-level `idx + 2` scheme without colliding. Seeded past the last\n\t// top-level object id so child ids stay unique slide-wide.\n\tlet childIdxAlloc = slide._slideObjects.length\n\n\t// Resolve an object's bounds in EMU. For an auto-sized group (a `group` object with no explicit\n\t// x/y/w/h) this recurses into `_groupObjects` and returns their bounding box — so a parent group\n\t// can size around a nested auto-sized child group. The group rendering below uses the same helper\n\t// for both a child's bounds and a group's own off/ext, keeping every level consistent.\n\tconst resolveObjBounds = (obj: SlideObject): { x: number; y: number; cx: number; cy: number } => {\n\t\tconst o = obj.options || {}\n\t\t// Shares `hasCompleteGroupFrame` with the group renderer below, so a partial frame resolves to\n\t\t// the same auto-bounds here (where a parent group sizes around this one) as it does there.\n\t\tif (obj._type === SlideObjectType.group && !hasCompleteGroupFrame(o)) {\n\t\t\tconst kids = (obj._groupObjects || []).map(resolveObjBounds)\n\t\t\tif (kids.length === 0) return { x: 0, y: 0, cx: 0, cy: 0 }\n\t\t\tconst minX = Math.min(...kids.map((b) => b.x))\n\t\t\tconst minY = Math.min(...kids.map((b) => b.y))\n\t\t\tconst maxX = Math.max(...kids.map((b) => b.x + b.cx))\n\t\t\tconst maxY = Math.max(...kids.map((b) => b.y + b.cy))\n\t\t\treturn { x: minX, y: minY, cx: maxX - minX, cy: maxY - minY }\n\t\t}\n\t\t// Normalized the same way the render path below normalizes its own box, so a child with a\n\t\t// negative extent contributes the box it will actually be emitted with — an un-normalized\n\t\t// `x + cx` would put the group's `maxX` *left* of its `minX` and size the group wrong.\n\t\tconst bx = normalizeAxisExtent(\n\t\t\ttypeof o.x !== 'undefined' ? getSmartParseNumber(o.x, 'X', slide._presLayout) : 0,\n\t\t\ttypeof o.w !== 'undefined' ? getSmartParseNumber(o.w, 'X', slide._presLayout) : 0\n\t\t)\n\t\tconst by = normalizeAxisExtent(\n\t\t\ttypeof o.y !== 'undefined' ? getSmartParseNumber(o.y, 'Y', slide._presLayout) : 0,\n\t\t\ttypeof o.h !== 'undefined' ? getSmartParseNumber(o.h, 'Y', slide._presLayout) : 0\n\t\t)\n\t\treturn { x: bx.off, y: by.off, cx: bx.ext, cy: by.ext }\n\t}\n\n\t// Render one slide object — and, for a group, its children recursively — to an XML fragment.\n\t// Closes over `slide` and `childIdxAlloc`. Uses a local\n\t// `strSlideXml` accumulator (shadowing the slide-level one) so the existing per-object\n\t// `strSlideXml +=` appends compose into the returned fragment unchanged.\n\tconst renderSlideObjectXml = (slideItemObj: SlideObject, idx: number): string => {\n\t\tlet strSlideXml = ''\n\t\tlet x = 0\n\t\tlet y = 0\n\t\t// Annotated `number` rather than inferring the branded `Emu` this initializer returns: `x`, `y`,\n\t\t// and `cy` are all plain numbers, every `render*Object` takes `number`, and normalization below\n\t\t// reassigns all four from one helper.\n\t\tlet cx: number = getSmartParseNumber('75%', 'X', slide._presLayout)\n\t\tlet cy = 0\n\t\tlet placeholderObj: SlideObject | null = null\n\t\tconst sizing: ObjectOptions['sizing'] = slideItemObj.options?.sizing\n\t\tconst rounding = slideItemObj.options?.rounding\n\n\t\tconst slideLayout = (slide as PresSlideInternal)._slideLayout\n\t\tconst wantedPlaceholder = slideItemObj.options?.placeholder\n\t\tif (slideLayout?._slideObjects !== undefined && wantedPlaceholder) {\n\t\t\tplaceholderObj =\n\t\t\t\tslideLayout._slideObjects.filter(\n\t\t\t\t\t(object: SlideObject) => object.options?.placeholder === wantedPlaceholder\n\t\t\t\t)[0] ?? null\n\t\t}\n\n\t\t// A: Set option vars\n\t\tslideItemObj.options = slideItemObj.options || {}\n\t\tconst itemOpts = slideItemObj.options\n\n\t\tif (typeof slideItemObj.options.x !== 'undefined')\n\t\t\tx = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout)\n\t\tif (typeof slideItemObj.options.y !== 'undefined')\n\t\t\ty = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout)\n\t\tif (typeof slideItemObj.options.w !== 'undefined')\n\t\t\tcx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout)\n\t\tif (typeof slideItemObj.options.h !== 'undefined')\n\t\t\tcy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout)\n\n\t\t// A negative `w`/`h` becomes a min-corner origin, an absolute extent, and a flip — never a\n\t\t// negative `<a:ext>`, which is out of range for `ST_PositiveCoordinate` and costs the whole\n\t\t// package (see `normalizeAxisExtent`). Done here, after every `Coord` form has resolved to EMU,\n\t\t// so `'-2in'` and `'-25%'` normalize alongside a plain negative number.\n\t\tconst normX = normalizeAxisExtent(x, cx)\n\t\tconst normY = normalizeAxisExtent(y, cy)\n\t\tx = normX.off\n\t\tcx = normX.ext\n\t\ty = normY.off\n\t\tcy = normY.ext\n\n\t\t// Set w/h now that smart parse is done\n\t\tconst imgWidth = cx\n\t\tconst imgHeight = cy\n\n\t\t// If using a placeholder then inherit it's position\n\t\tif (placeholderObj) {\n\t\t\tconst phOpts = placeholderObj.options ?? {}\n\t\t\tif (phOpts.x || phOpts.x === 0) x = getSmartParseNumber(phOpts.x, 'X', slide._presLayout)\n\t\t\tif (phOpts.y || phOpts.y === 0) y = getSmartParseNumber(phOpts.y, 'Y', slide._presLayout)\n\t\t\tif (phOpts.w || phOpts.w === 0) cx = getSmartParseNumber(phOpts.w, 'X', slide._presLayout)\n\t\t\tif (phOpts.h || phOpts.h === 0) cy = getSmartParseNumber(phOpts.h, 'Y', slide._presLayout)\n\t\t}\n\t\t// The `<a:xfrm>` placement attributes, shared by every shape kind that has a transform.\n\t\t// NOTE: order is byte-significant (flipH, flipV, rot), and `null` means omitted — `rotate: 0`\n\t\t// stays absent, matching the truthiness test this replaced.\n\t\t// A flip derived from a negative extent XORs with the author's own: `{ w: -2, flipH: true }`\n\t\t// is a box mirrored twice, i.e. not mirrored at all.\n\t\tconst locationAttrs: XmlAttrs = {\n\t\t\tflipH: Boolean(slideItemObj.options.flipH) !== normX.flip ? '1' : null,\n\t\t\tflipV: Boolean(slideItemObj.options.flipV) !== normY.flip ? '1' : null,\n\t\t\trot: slideItemObj.options.rotate ? convertRotationDegrees(slideItemObj.options.rotate) : null,\n\t\t}\n\n\t\t// B: Add OBJECT to the current Slide\n\t\tswitch (slideItemObj._type) {\n\t\t\tcase SlideObjectType.table:\n\t\t\t\tstrSlideXml += renderTableObject(slideItemObj, idx, x, y, cx, cy, placeholderObj, itemOpts)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.text:\n\t\t\tcase SlideObjectType.placeholder:\n\t\t\t\tstrSlideXml += renderTextObject(slideItemObj, idx, slide, x, y, cx, cy, placeholderObj, locationAttrs)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.connector:\n\t\t\t\tstrSlideXml += renderConnectorObject(slideItemObj, idx, x, y, cx, cy, locationAttrs, shapeIds)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.image:\n\t\t\t\tstrSlideXml += renderImageObject(\n\t\t\t\t\tslideItemObj,\n\t\t\t\t\tidx,\n\t\t\t\t\tslide,\n\t\t\t\t\tx,\n\t\t\t\t\ty,\n\t\t\t\t\tcx,\n\t\t\t\t\tcy,\n\t\t\t\t\timgWidth,\n\t\t\t\t\timgHeight,\n\t\t\t\t\tplaceholderObj,\n\t\t\t\t\tlocationAttrs,\n\t\t\t\t\tsizing,\n\t\t\t\t\trounding\n\t\t\t\t)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.media:\n\t\t\t\tstrSlideXml += renderMediaObject(slideItemObj, idx, x, y, cx, cy, locationAttrs)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.chart:\n\t\t\t\tstrSlideXml += renderChartObject(slideItemObj, idx, x, y, cx, cy, placeholderObj)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.oleObject:\n\t\t\t\tstrSlideXml += renderOleObject(slideItemObj, idx, x, y, cx, cy)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.zoom:\n\t\t\t\tstrSlideXml += renderZoomObject(slideItemObj, idx, x, y, cx, cy)\n\t\t\t\tbreak\n\t\t\tcase SlideObjectType.model3d:\n\t\t\t\tstrSlideXml += renderModel3dObject(slideItemObj, idx, x, y, cx, cy)\n\t\t\t\tbreak\n\n\t\t\tcase SlideObjectType.group: {\n\t\t\t\tconst groupChildren = slideItemObj._groupObjects || []\n\n\t\t\t\t// Render children (recursively for nested groups). Each child gets a unique id via\n\t\t\t\t// `childIdxAlloc` (children are not in `_slideObjects`); the shared counter keeps ids\n\t\t\t\t// collision-free across nesting depth.\n\t\t\t\tlet innerXml = ''\n\t\t\t\tgroupChildren.forEach((child) => {\n\t\t\t\t\tchild.options = child.options || {}\n\t\t\t\t\tinnerXml += renderSlideObjectXml(child, childIdxAlloc++)\n\t\t\t\t})\n\n\t\t\t\t// Identity child coordinate space (chOff/chExt == off/ext) at every depth, so children\n\t\t\t\t// keep their slide-absolute coordinates. Use explicit x/y/w/h when all four are given,\n\t\t\t\t// else the bounding box of the children (recursing into nested auto-sized groups).\n\t\t\t\t// A partial frame warns and falls back whole rather than letting the unset axes take the\n\t\t\t\t// per-object defaults above (`cy` = 0 among them) and emit a degenerate group.\n\t\t\t\tconst givenAxes = givenGroupFrameAxes(slideItemObj.options)\n\t\t\t\tif (givenAxes.length > 0 && givenAxes.length < GROUP_FRAME_AXES.length) {\n\t\t\t\t\tconst missingAxes = GROUP_FRAME_AXES.filter((axis) => !givenAxes.includes(axis))\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'group/partial-frame',\n\t\t\t\t\t\t`addGroup: group \"${slideItemObj.options.objectName ?? ''}\" has a partial frame (${givenAxes.join('/')} given, ${missingAxes.join('/')} missing); using auto-bounds (the bounding box of its children) instead. Pass all of x/y/w/h, or none.`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tconst gb = hasCompleteGroupFrame(slideItemObj.options) ? { x, y, cx, cy } : resolveObjBounds(slideItemObj)\n\t\t\t\tconst gx: number = gb.x\n\t\t\t\tconst gy: number = gb.y\n\t\t\t\tconst gcx: number = gb.cx\n\t\t\t\tconst gcy: number = gb.cy\n\n\t\t\t\tconst grpLockXml = genXmlObjectLock(\n\t\t\t\t\t'a:grpSpLocks',\n\t\t\t\t\tGROUP_SHAPE_LOCK_ATTRS,\n\t\t\t\t\tslideItemObj.options.objectLock,\n\t\t\t\t\tslideItemObj.options.objectName\n\t\t\t\t)\n\t\t\t\tstrSlideXml += '<p:grpSp>'\n\t\t\t\tstrSlideXml += el('p:nvGrpSpPr', null, [\n\t\t\t\t\traw(cNvPrOpen(idx + 2, slideItemObj.options.objectName, slideItemObj.options.altText || '') + '/>'),\n\t\t\t\t\t// Paired only when there are locks to carry; otherwise self-closing.\n\t\t\t\t\traw(grpLockXml ? el('p:cNvGrpSpPr', null, raw(grpLockXml)) : voidEl('p:cNvGrpSpPr')),\n\t\t\t\t\traw(voidEl('p:nvPr')),\n\t\t\t\t])\n\t\t\t\tstrSlideXml += el(\n\t\t\t\t\t'p:grpSpPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('a:xfrm', locationAttrs, [\n\t\t\t\t\t\t\traw(voidEl('a:off', { x: gx, y: gy })),\n\t\t\t\t\t\t\traw(voidEl('a:ext', { cx: gcx, cy: gcy })),\n\t\t\t\t\t\t\traw(voidEl('a:chOff', { x: gx, y: gy })),\n\t\t\t\t\t\t\traw(voidEl('a:chExt', { cx: gcx, cy: gcy })),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\tstrSlideXml += innerXml\n\t\t\t\tstrSlideXml += '</p:grpSp>'\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tstrSlideXml += ''\n\t\t\t\tbreak\n\t\t}\n\t\treturn strSlideXml\n\t}\n\n\tslide._slideObjects.forEach((slideItemObj: SlideObject, idx: number) => {\n\t\tstrSlideXml += renderSlideObjectXml(slideItemObj, idx)\n\t})\n\n\t// STEP 4: Add slide numbers (if any) last\n\tif (slide._slideNumberProps) {\n\t\t// Set some defaults (done here b/c SlideNumber canbe added to masters or slides and has numerous entry points)\n\t\tif (!slide._slideNumberProps.align) slide._slideNumberProps.align = 'left'\n\n\t\t// Allocate this placeholder's <p:cNvPr> id from the same monotonic counter as every other\n\t\t// shape on the slide (top-level objects took `idx + 2`; group children advanced `childIdxAlloc`\n\t\t// past that). A hardcoded id here (formerly 25) aliases a shape or group-child id once a slide\n\t\t// holds enough objects — a duplicate `<p:cNvPr>` id PowerPoint repairs — so take the next free\n\t\t// slot instead. `childIdxAlloc` is the next unused index after the walk above; its id is `+ 2`.\n\t\tconst slideNumberId = childIdxAlloc++ + 2\n\n\t\tconst snProps = slide._slideNumberProps\n\t\tstrSlideXml += '<p:sp>'\n\t\tstrSlideXml += ' <p:nvSpPr>'\n\t\tstrSlideXml +=\n\t\t\tvoidEl('p:cNvPr', { id: slideNumberId, name: 'Slide Number Placeholder 0' }, { openPrefix: ' ' }) +\n\t\t\tel('p:cNvSpPr', null, raw(voidEl('a:spLocks', { noGrp: '1' })))\n\t\tstrSlideXml += el('p:nvPr', null, raw(voidEl('p:ph', { type: 'sldNum', sz: 'quarter', idx: '4294967295' })), {\n\t\t\topenPrefix: ' ',\n\t\t})\n\t\tstrSlideXml += ' </p:nvSpPr>'\n\t\tstrSlideXml += ' <p:spPr>'\n\t\tstrSlideXml +=\n\t\t\tel('a:xfrm', null, [\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('a:off', {\n\t\t\t\t\t\tx: getSmartParseNumber(snProps.x, 'X', slide._presLayout),\n\t\t\t\t\t\ty: getSmartParseNumber(snProps.y, 'Y', slide._presLayout),\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('a:ext', {\n\t\t\t\t\t\tcx: snProps.w ? getSmartParseNumber(snProps.w, 'X', slide._presLayout) : '800000',\n\t\t\t\t\t\tcy: snProps.h ? getSmartParseNumber(snProps.h, 'Y', slide._presLayout) : '300000',\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t]) +\n\t\t\tel('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')), { openPrefix: ' ' }) +\n\t\t\tel(\n\t\t\t\t'a:extLst',\n\t\t\t\tnull,\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'a:ext',\n\t\t\t\t\t\t{ uri: '{C572A759-6A51-4108-AA02-DFA0A04FC94B}' },\n\t\t\t\t\t\traw(\n\t\t\t\t\t\t\tvoidEl('ma14:wrappingTextBoxFlag', {\n\t\t\t\t\t\t\t\tval: '0',\n\t\t\t\t\t\t\t\t'xmlns:ma14': 'http://schemas.microsoft.com/office/mac/drawingml/2011/main',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t{ openPrefix: ' ' }\n\t\t\t) +\n\t\t\t'</p:spPr>'\n\t\tstrSlideXml += '<p:txBody>'\n\t\t// Margins are inches (see `marginToEmu`), matching text-box and cell margins.\n\t\t// NOTE: attribute ORDER is byte-significant, and note the margin order is lIns/tIns/rIns/bIns\n\t\t// while the source array is [Top, Right, Bottom, Left] — hence the 3/0/1/2 indexing.\n\t\tconst snMargin = snProps.margin\n\t\tconst snMarginAt = (arrIdx: number): number | null =>\n\t\t\tArray.isArray(snMargin)\n\t\t\t\t? marginToEmu(snMargin[arrIdx] || 0)\n\t\t\t\t: typeof snMargin === 'number'\n\t\t\t\t\t? marginToEmu(snMargin || 0)\n\t\t\t\t\t: null\n\t\tstrSlideXml += voidEl('a:bodyPr', {\n\t\t\tlIns: snMarginAt(3),\n\t\t\ttIns: snMarginAt(0),\n\t\t\trIns: snMarginAt(1),\n\t\t\tbIns: snMarginAt(2),\n\t\t\tanchor: snProps.valign\n\t\t\t\t? snProps.valign.replace('top', 't').replace('middle', 'ctr').replace('bottom', 'b')\n\t\t\t\t: null,\n\t\t})\n\t\tlet defRPr = ''\n\t\tif (snProps.fontFace || snProps.fontSize || snProps.color) {\n\t\t\t// The typeface is caller-supplied via `slide.slideNumber({ fontFace })`; the element builder\n\t\t\t// escapes it, so a `\"`/`&` in the name cannot close the attribute early.\n\t\t\tconst face = snProps.fontFace\n\t\t\tdefRPr = el('a:defRPr', { sz: clampFontSizeSz(snProps.fontSize || 12) }, [\n\t\t\t\tsnProps.color ? raw(genXmlColorSelection(snProps.color)) : null,\n\t\t\t\tface ? raw(voidEl('a:latin', { typeface: face })) : null,\n\t\t\t\tface ? raw(voidEl('a:ea', { typeface: face })) : null,\n\t\t\t\tface ? raw(voidEl('a:cs', { typeface: face })) : null,\n\t\t\t])\n\t\t}\n\t\tstrSlideXml += el('a:lstStyle', null, raw(el('a:lvl1pPr', null, raw(defRPr))), { openPrefix: ' ' })\n\n\t\t// `align` is normalized to 'left' above when unset; anything not starting c/r falls back to 'l'.\n\t\t// `align` is defaulted to 'left' on the props object above; read it through a local so the\n\t\t// narrowing survives (the mutation is kept — other readers rely on it).\n\t\tconst snAlignRaw = snProps.align ?? 'left'\n\t\tconst snAlign = snAlignRaw.startsWith('c') ? 'ctr' : snAlignRaw.startsWith('r') ? 'r' : 'l'\n\t\tstrSlideXml += el('a:p', null, [\n\t\t\traw(voidEl('a:pPr', { algn: snAlign })),\n\t\t\traw(\n\t\t\t\tel('a:fld', { id: SLDNUMFLDID, type: 'slidenum' }, [\n\t\t\t\t\t// NOTE: `b` is emitted as \"0\" when unset, unlike the run properties elsewhere which omit it.\n\t\t\t\t\traw(voidEl('a:rPr', { b: snProps.bold ? 1 : 0, lang: 'en-US' })),\n\t\t\t\t\t// NOTE: `String(...)` is load-bearing. A slide MASTER has no `_slideNum`, and the\n\t\t\t\t\t// template this replaced stringified that `null` into the literal text \"null\"\n\t\t\t\t\t// (visible in slideMaster1.xml). `el()` skips a null child entirely, which would\n\t\t\t\t\t// silently drop it — a byte change. Preserved; fixing it is its own commit.\n\t\t\t\t\traw(el('a:t', null, String(slide._slideNum))),\n\t\t\t\t])\n\t\t\t),\n\t\t\traw(voidEl('a:endParaRPr', { lang: 'en-US' })),\n\t\t])\n\t\tstrSlideXml += '</p:txBody></p:sp>'\n\t}\n\n\t// STEP 5: Close spTree and finalize slide XML\n\tstrSlideXml += '</p:spTree>'\n\tstrSlideXml += '</p:cSld>'\n\n\t// LAST: Return\n\treturn strSlideXml\n}\n\n/**\n * Transforms slide relations to XML string.\n * Extra relations that are not dynamic can be passed using the 2nd arg (e.g. theme relation in master file).\n * These relations use rId series that starts with 1-increased maximum of rIds used for dynamic relations.\n * @param {PresSlideInternal | SlideLayoutInternal} slide - slide object whose relations are being transformed\n * @param {{ target: string; type: string }[]} defaultRels - array of default relations\n * @return {string} XML\n */\nexport function slideObjectRelationsToXml(\n\tslide: PresSlideInternal | SlideLayoutInternal,\n\tdefaultRels: Array<{ target: string; type: string }>\n): string {\n\tlet lastRid = 0 // stores maximum rId used for dynamic relations\n\tconst rels: string[] = []\n\n\t/**\n\t * Has a rel with this Target already been emitted? Media items produce *TWO* rels\n\t * sharing one Target, and the second is told from the first by the Target already\n\t * being present. `target` must therefore be the ESCAPED form — what actually got\n\t * written — or an online-video link carrying `&` never matches its own first rel\n\t * and the pair is mistyped (media emitted as video). See `SlideRel.Target`.\n\t */\n\tconst hasTarget = (target: string): boolean => rels.some((xml) => xml.includes(` Target=\"${target}\"`))\n\n\t// STEP 1: Add all rels for this Slide\n\tslide._rels.forEach((rel: SlideRel) => {\n\t\tlastRid = Math.max(lastRid, rel.rId)\n\t\tif (isHyperlinkRel(rel)) {\n\t\t\tif (rel.data === 'slide') {\n\t\t\t\trels.push(\n\t\t\t\t\tvoidEl('Relationship', { Id: `rId${rel.rId}`, Type: OFFICE_REL + 'slide', Target: `slide${rel.Target}.xml` })\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\trels.push(\n\t\t\t\t\tvoidEl('Relationship', {\n\t\t\t\t\t\tId: `rId${rel.rId}`,\n\t\t\t\t\t\tType: OFFICE_REL + 'hyperlink',\n\t\t\t\t\t\tTarget: rel.Target,\n\t\t\t\t\t\tTargetMode: 'External',\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\t// NOTE: there is no `else` here on purpose. `_rels` only ever holds hyperlinks —\n\t\t// it is initialized empty (`slide.ts`) and the three sites that append to it\n\t\t// (`define/hyperlinks.ts` ×2, `define/image.ts`) all push `SlideObjectType.hyperlink`.\n\t\t// The notesSlide rel every slide needs comes from `defaultRels` in `makeXmlSlideRel`.\n\t})\n\t;(slide._relsChart || []).forEach((rel: SlideRelChart) => {\n\t\tlastRid = Math.max(lastRid, rel.rId)\n\t\t// chartEx parts use the MS chartEx rel type; classic charts use the ECMA `chart` rel.\n\t\trels.push(\n\t\t\tvoidEl('Relationship', {\n\t\t\t\tId: `rId${rel.rId}`,\n\t\t\t\tType: rel.isChartEx ? CHARTEX_REL : OFFICE_REL + 'chart',\n\t\t\t\tTarget: rel.Target,\n\t\t\t})\n\t\t)\n\t})\n\t;(slide._relsMedia || []).forEach((rel: SlideRelMedia) => {\n\t\tconst relType = rel.type.toLowerCase()\n\t\t// `voidEl` escapes the Target on the way out; the probe has to compare against\n\t\t// those emitted bytes, so it needs the escaped form computed separately here —\n\t\t// with the SAME escaper the builder uses, or the two drift apart.\n\t\tconst relTarget = encodeXmlAttrValue(rel.Target)\n\t\tconst media = (type: string, targetMode?: string): string =>\n\t\t\tvoidEl('Relationship', { Id: `rId${rel.rId}`, Type: type, Target: rel.Target, TargetMode: targetMode })\n\t\tlastRid = Math.max(lastRid, rel.rId)\n\t\tif (rel.oleRelType) {\n\t\t\t// An OLE payload part carries its rel type verbatim (`.../package` or `.../oleObject`);\n\t\t\t// its `type` is the part's content type, which the sniffing below would misread.\n\t\t\trels.push(media(rel.oleRelType))\n\t\t} else if (rel.model3dRelType) {\n\t\t\t// Likewise a 3D model payload: its content type is `model/gltf.binary`, which matches none\n\t\t\t// of the sniffs below — and they have no `else`, so without this branch the rel would be\n\t\t\t// silently dropped and the slide would carry a dangling `r:embed`.\n\t\t\trels.push(media(rel.model3dRelType))\n\t\t} else if (relType.includes('image')) {\n\t\t\trels.push(media(OFFICE_REL + 'image'))\n\t\t} else if (relType.includes('audio')) {\n\t\t\trels.push(hasTarget(relTarget) ? media(MS_MEDIA_REL) : media(OFFICE_REL + 'audio'))\n\t\t} else if (relType.includes('video')) {\n\t\t\trels.push(hasTarget(relTarget) ? media(MS_MEDIA_REL) : media(OFFICE_REL + 'video'))\n\t\t} else if (relType.includes('online')) {\n\t\t\t// Online video has *TWO* external rels sharing the link Target: the ECMA video\n\t\t\t// rel (first) and the MS-2007 media rel (second). Both TargetMode=\"External\",\n\t\t\t// no media binary part.\n\t\t\trels.push(hasTarget(relTarget) ? media(MS_MEDIA_REL, 'External') : media(OFFICE_REL + 'video', 'External'))\n\t\t}\n\t})\n\n\t// STEP 2: Add default rels\n\tdefaultRels.forEach((rel, idx) => {\n\t\trels.push(voidEl('Relationship', { Id: `rId${lastRid + idx + 1}`, Type: rel.type, Target: rel.target }))\n\t})\n\n\treturn XML_DECL + CRLF + el('Relationships', { xmlns: PACKAGE_REL_NS }, rels.map(raw))\n}\n","/**\n * ts-pptx: slide part + slide/layout rels\n *\n * Emit a slide (`ppt/slides/slideN.xml`) and the relationship files for slides\n * and layouts (`slideN.xml.rels`, `slideLayoutN.xml.rels`).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { slideTimingToXml } from '../anim/timing.js'\nimport { slideTransitionToXml } from '../anim/transition.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { slideObjectRelationsToXml, slideObjectToXml } from './object.js'\nimport { InternalError } from '../../errors.js'\n\n/**\n * Generates XML for the slide file (`ppt/slides/slide1.xml`)\n * @param {PresSlideInternal} slide - the slide object to transform into XML\n * @return {string} XML\n */\nexport function makeXmlSlide(slide: PresSlideInternal): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:sld',\n\t\t\t{\n\t\t\t\t'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\n\t\t\t\tshow: slide?.hidden ? '0' : null,\n\t\t\t},\n\t\t\t[\n\t\t\t\traw(slideObjectToXml(slide)),\n\t\t\t\traw(el('p:clrMapOvr', null, raw(voidEl('a:masterClrMapping')))),\n\t\t\t\traw(slideTransitionToXml(slide)),\n\t\t\t\traw(slideTimingToXml(slide)),\n\t\t\t]\n\t\t)\n\t)\n}\n\n/**\n * Generates XML string for a slide layout relation file\n * @param {number} layoutNumber - 1-indexed number of a layout that relations are generated for\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layouts\n * @return {string} XML\n */\nexport function makeXmlSlideLayoutRel(layoutNumber: number, slideLayouts: SlideLayoutInternal[]): string {\n\tconst slideLayout = slideLayouts[layoutNumber - 1]\n\tif (!slideLayout)\n\t\tthrow new InternalError(\n\t\t\t'slide/rel-index-out-of-range',\n\t\t\t`makeXmlSlideLayoutRel: no slide layout at index ${layoutNumber - 1}`\n\t\t)\n\treturn slideObjectRelationsToXml(slideLayout, [\n\t\t{\n\t\t\ttarget: '../slideMasters/slideMaster1.xml',\n\t\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster',\n\t\t},\n\t])\n}\n\n/**\n * Creates `ppt/_rels/slide*.xml.rels`\n * @param {PresSlideInternal[]} slides\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layout(s)\n * @param {number} `slideNumber` 1-indexed number of a layout that relations are generated for\n * @return {string} XML\n */\nexport function makeXmlSlideRel(\n\tslides: PresSlideInternal[],\n\tslideLayouts: SlideLayoutInternal[],\n\tslideNumber: number\n): string {\n\tconst slide = slides[slideNumber - 1]\n\tif (!slide)\n\t\tthrow new InternalError('slide/rel-index-out-of-range', `makeXmlSlideRel: no slide at index ${slideNumber - 1}`)\n\tconst defaultRels = [\n\t\t{\n\t\t\ttarget: `../slideLayouts/slideLayout${getLayoutIdxForSlide(slides, slideLayouts, slideNumber)}.xml`,\n\t\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout',\n\t\t},\n\t\t{\n\t\t\ttarget: `../notesSlides/notesSlide${slideNumber}.xml`,\n\t\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide',\n\t\t},\n\t]\n\t// Only emit the comments rel for slides that actually carry comments (the comment part\n\t// is likewise only written for those slides); the rId is assigned after slideLayout/notesSlide.\n\tif ((slide._comments || []).length > 0) {\n\t\tdefaultRels.push({\n\t\t\ttarget: `../comments/comment${slideNumber}.xml`,\n\t\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',\n\t\t})\n\t}\n\treturn slideObjectRelationsToXml(slide, defaultRels)\n}\n\n/**\n * For the passed slide number, resolves name of a layout that is used for.\n * @param {PresSlideInternal[]} slides - srray of slides\n * @param {SlideLayoutInternal[]} slideLayouts - array of slideLayouts\n * @param {number} slideNumber\n * @return {number} slide number\n */\nfunction getLayoutIdxForSlide(\n\tslides: PresSlideInternal[],\n\tslideLayouts: SlideLayoutInternal[],\n\tslideNumber: number\n): number {\n\tfor (let i = 0; i < slideLayouts.length; i++) {\n\t\tif (slideLayouts[i]?._name === slides[slideNumber - 1]?._slideLayout?._name) {\n\t\t\treturn i + 1\n\t\t}\n\t}\n\n\t// IMPORTANT: Return 1 (for `slideLayout1.xml`) when no def is found\n\t// So all objects are in Layout1 and every slide that references it uses this layout.\n\treturn 1\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 { CRLF, SLDNUMFLDID, XML_DECL } from '../../constants-internal.js'\nimport type { TextProps } from '../../types/index.js'\nimport type { 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 { OFFICE_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.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/**\n * Build (and cache) the hyperlink relationships for a slide's notes part (`notesSlideN.xml.rels`).\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 * dynamic hyperlink rels are allocated starting at rId3. Each notes hyperlink run is tagged\n * with its `_rId` so the body serializer and the rels file agree.\n *\n * Idempotent: the result is cached on `slide._relsNotes` and reused by both callers.\n * Only external `url` hyperlinks are supported; `slide` targets are ignored with a warning.\n * @param {PresSlideInternal} slide - the slide object\n * @return {SlideRel[]} notes hyperlink relationships\n */\nexport function buildNotesSlideRels(slide: PresSlideInternal): SlideRel[] {\n\tif (slide._relsNotes) return slide._relsNotes\n\n\tconst NOTES_REL_RESERVED = 2 // rId1=notesMaster, rId2=slide\n\tconst rels: SlideRel[] = []\n\tlet lastRid = NOTES_REL_RESERVED\n\n\tgetNotesRuns(slide).forEach((run) => {\n\t\tconst hyperlink = run.options?.hyperlink\n\t\tif (!hyperlink) return\n\t\tif (!hyperlink.url) {\n\t\t\t// Notes support external `url` links only. Drop unsupported (e.g. `slide`) targets so the\n\t\t\t// run serializer doesn't emit a dangling <a:hlinkClick> with no 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\tif (run.options) delete run.options.hyperlink\n\t\t\treturn\n\t\t}\n\n\t\tlastRid++\n\t\thyperlink._rId = lastRid\n\t\trels.push({\n\t\t\ttype: SlideObjectType.hyperlink,\n\t\t\tdata: 'dummy',\n\t\t\trId: lastRid,\n\t\t\t// `Target` is stored RAW; every emitter escapes it. See the note on `SlideRel.Target`.\n\t\t\tTarget: hyperlink.url,\n\t\t})\n\t})\n\n\tslide._relsNotes = rels\n\treturn rels\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 {PresSlideInternal} slide - the slide object\n * @return {string} XML string of `<a:p>` paragraphs\n */\nfunction genXmlNotesParagraphs(slide: PresSlideInternal): string {\n\tconst paragraphs: TextProps[][] = [[]]\n\n\tgetNotesRuns(slide).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 * 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 =>\n\t\tel('a:xfrm', null, [raw(voidEl('a:off', { x, y })), raw(voidEl('a:ext', { cx, cy }))])\n\tconst prstGeomRect = el('a:prstGeom', { prst: 'rect' }, raw(voidEl('a:avLst')))\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(prstGeomRect)])),\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(prstGeomRect)])),\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(prstGeomRect),\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(prstGeomRect)])),\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(prstGeomRect)])),\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(prstGeomRect)])),\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 = 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(\n\t\t\tel(\n\t\t\t\t'p:grpSpPr',\n\t\t\t\tnull,\n\t\t\t\traw(\n\t\t\t\t\tel('a:xfrm', null, [\n\t\t\t\t\t\traw(voidEl('a:off', { x: 0, y: 0 })),\n\t\t\t\t\t\traw(voidEl('a:ext', { cx: 0, cy: 0 })),\n\t\t\t\t\t\traw(voidEl('a:chOff', { x: 0, y: 0 })),\n\t\t\t\t\t\traw(voidEl('a:chExt', { cx: 0, cy: 0 })),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(header),\n\t\traw(date),\n\t\traw(slideImg),\n\t\traw(notesPlaceholder),\n\t\traw(footer),\n\t\traw(slideNum),\n\t])\n\n\tconst extLst = 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(\n\t\t\t\t\tvoidEl('p14:creationId', {\n\t\t\t\t\t\t'xmlns:p14': 'http://schemas.microsoft.com/office/powerpoint/2010/main',\n\t\t\t\t\t\tval: 1024086991,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\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', {\n\t\tbg1: 'lt1',\n\t\ttx1: 'dk1',\n\t\tbg2: 'lt2',\n\t\ttx2: 'dk2',\n\t\taccent1: 'accent1',\n\t\taccent2: 'accent2',\n\t\taccent3: 'accent3',\n\t\taccent4: 'accent4',\n\t\taccent5: 'accent5',\n\t\taccent6: 'accent6',\n\t\thlink: 'hlink',\n\t\tfolHlink: 'folHlink',\n\t})\n\n\tconst notesStyleLevel = (n: number, marL: number): string =>\n\t\tel(\n\t\t\t`a:lvl${n}pPr`,\n\t\t\t{ marL, algn: 'l', defTabSz: 914400, rtl: 0, eaLnBrk: 1, latinLnBrk: 0, hangingPunct: 1 },\n\t\t\traw(\n\t\t\t\tel('a:defRPr', { sz: 1200, kern: 1200 }, [\n\t\t\t\t\traw(el('a:solidFill', null, raw(voidEl('a:schemeClr', { val: 'tx1' })))),\n\t\t\t\t\traw(voidEl('a:latin', { typeface: '+mn-lt' })),\n\t\t\t\t\traw(voidEl('a:ea', { typeface: '+mn-ea' })),\n\t\t\t\t\traw(voidEl('a:cs', { typeface: '+mn-cs' })),\n\t\t\t\t])\n\t\t\t)\n\t\t)\n\tconst notesStyle = el(\n\t\t'p:notesStyle',\n\t\tnull,\n\t\traw(\n\t\t\t[0, 457200, 914400, 1371600, 1828800, 2286000, 2743200, 3200400, 3657600]\n\t\t\t\t.map((marL, i) => notesStyleLevel(i + 1, marL))\n\t\t\t\t.join('')\n\t\t)\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'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\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 * @return {string} XML\n */\nexport function makeXmlNotesSlide(slide: PresSlideInternal): string {\n\t// Allocate notes hyperlink rels first so run serialization can reference the correct rId\n\tbuildNotesSlideRels(slide)\n\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(genXmlNotesParagraphs(slide))])),\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, slide._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 = 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(\n\t\t\tel(\n\t\t\t\t'p:grpSpPr',\n\t\t\t\tnull,\n\t\t\t\traw(\n\t\t\t\t\tel('a:xfrm', null, [\n\t\t\t\t\t\traw(voidEl('a:off', { x: 0, y: 0 })),\n\t\t\t\t\t\traw(voidEl('a:ext', { cx: 0, cy: 0 })),\n\t\t\t\t\t\traw(voidEl('a:chOff', { x: 0, y: 0 })),\n\t\t\t\t\t\traw(voidEl('a:chExt', { cx: 0, cy: 0 })),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(slideImgPh),\n\t\traw(notesPh),\n\t\traw(slideNumPh),\n\t])\n\n\tconst extLst = 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(\n\t\t\t\t\tvoidEl('p14:creationId', {\n\t\t\t\t\t\t'xmlns:p14': 'http://schemas.microsoft.com/office/powerpoint/2010/main',\n\t\t\t\t\t\tval: 1024086991,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\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'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\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 {PresSlideInternal} slide - the slide whose notes part is being related\n * @param {number} slideNumber - 1-indexed slide number the notes part belongs to\n * @return {string} XML\n */\nexport function makeXmlNotesSlideRel(slide: PresSlideInternal, slideNumber: number): string {\n\t// Flat: the hyperlink rels run together on one line, after the indented rId1/rId2 pair.\n\tconst hlinkRels = buildNotesSlideRels(slide)\n\t\t.map((rel) =>\n\t\t\tvoidEl('Relationship', {\n\t\t\t\tId: `rId${rel.rId}`,\n\t\t\t\tType: OFFICE_REL + 'hyperlink',\n\t\t\t\tTarget: rel.Target,\n\t\t\t\tTargetMode: 'External',\n\t\t\t})\n\t\t)\n\t\t.join('')\n\n\treturn (\n\t\tXML_DECL +\n\t\tel(\n\t\t\t'Relationships',\n\t\t\t{ xmlns: PACKAGE_REL_NS },\n\t\t\t[\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('Relationship', {\n\t\t\t\t\t\tId: 'rId1',\n\t\t\t\t\t\tType: OFFICE_REL + 'notesMaster',\n\t\t\t\t\t\tTarget: '../notesMasters/notesMaster1.xml',\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('Relationship', {\n\t\t\t\t\t\tId: 'rId2',\n\t\t\t\t\t\tType: OFFICE_REL + 'slide',\n\t\t\t\t\t\tTarget: `../slides/slide${slideNumber}.xml`,\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\t// Always a child, even when empty, so its `childPrefix` indent is still emitted.\n\t\t\t\traw(hlinkRels),\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 (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'Relationships',\n\t\t\t{ xmlns: PACKAGE_REL_NS },\n\t\t\traw(voidEl('Relationship', { Id: 'rId1', Type: OFFICE_REL + 'theme', Target: '../theme/theme2.xml' })),\n\t\t\t// The closing tag is indented to child depth, not parent depth — as emitted today.\n\t\t\t{ childPrefix: '\\n\\t\\t', closePrefix: '\\n\\t\\t' }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: `ppt/theme/theme1.xml`\n *\n * Emit the Office theme: the `<a:clrScheme>` (with any caller color overrides\n * over the default Office scheme) plus the fixed font/format schemes.\n */\n\nimport { REGEX_HEX_COLOR, XML_DECL } from '../../constants-internal.js'\nimport type { ThemeColorScheme } from '../../types/index.js'\nimport type { PresentationPropsInternal } from '../../types/internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl, type RawXml } from '../oxml/el.js'\n\n/**\n * Theme `<a:clrScheme>` slots in OOXML document order, with their default Office color child.\n * `dk1`/`lt1` default to `sysClr` (windowText/window); the rest are `srgbClr`. A user override\n * for any slot is emitted as `<a:srgbClr>` (see `buildThemeClrScheme`).\n */\nconst THEME_CLR_SCHEME_DEFAULTS: ReadonlyArray<[keyof ThemeColorScheme, RawXml]> = [\n\t['dk1', raw(voidEl('a:sysClr', { val: 'windowText', lastClr: '000000' }))],\n\t['lt1', raw(voidEl('a:sysClr', { val: 'window', lastClr: 'FFFFFF' }))],\n\t['dk2', raw(voidEl('a:srgbClr', { val: '44546A' }))],\n\t['lt2', raw(voidEl('a:srgbClr', { val: 'E7E6E6' }))],\n\t['accent1', raw(voidEl('a:srgbClr', { val: '4472C4' }))],\n\t['accent2', raw(voidEl('a:srgbClr', { val: 'ED7D31' }))],\n\t['accent3', raw(voidEl('a:srgbClr', { val: 'A5A5A5' }))],\n\t['accent4', raw(voidEl('a:srgbClr', { val: 'FFC000' }))],\n\t['accent5', raw(voidEl('a:srgbClr', { val: '5B9BD5' }))],\n\t['accent6', raw(voidEl('a:srgbClr', { val: '70AD47' }))],\n\t['hlink', raw(voidEl('a:srgbClr', { val: '0563C1' }))],\n\t['folHlink', raw(voidEl('a:srgbClr', { val: '954F72' }))],\n]\n\n/**\n * Build the theme `<a:clrScheme>` block, applying any caller-supplied color overrides over the\n * default Office scheme. Invalid (non 6-digit-hex) overrides warn and keep the default rather\n * than emitting a degenerate color.\n * @param {ThemeColorScheme} [scheme] - per-slot hex overrides\n * @return {string} the `<a:clrScheme>...</a:clrScheme>` XML\n */\nfunction buildThemeClrScheme(scheme?: ThemeColorScheme): string {\n\treturn el(\n\t\t'a:clrScheme',\n\t\t{ name: 'Office' },\n\t\tTHEME_CLR_SCHEME_DEFAULTS.map(([slot, defaultChild]) => {\n\t\t\tconst override = scheme?.[slot]\n\t\t\tlet child = defaultChild\n\t\t\tif (typeof override === 'string' && override.length > 0) {\n\t\t\t\tconst hex = override.replace('#', '')\n\t\t\t\tif (REGEX_HEX_COLOR.test(hex)) child = raw(voidEl('a:srgbClr', { val: hex.toUpperCase() }))\n\t\t\t\telse\n\t\t\t\t\twarn(\n\t\t\t\t\t\t'theme/invalid-color-override',\n\t\t\t\t\t\t`makeXmlTheme: colorScheme.${slot} \"${override}\" is not a 6-digit hex color; keeping the Office default.`\n\t\t\t\t\t)\n\t\t\t}\n\t\t\treturn raw(el(`a:${slot}`, null, child))\n\t\t})\n\t)\n}\n\n// Per-script theme font fallback tables (CT_TextFont lists), in OOXML document order. Static Office\n// defaults — no caller data, no escaping risk — unlike the `<a:latin>`/`<a:ea>`/`<a:cs>` slots below.\nconst MAJOR_FONT_LIST: ReadonlyArray<readonly [string, string]> = [\n\t['Jpan', '游ゴシック Light'],\n\t['Hang', '맑은 고딕'],\n\t['Hans', '等线 Light'],\n\t['Hant', '新細明體'],\n\t['Arab', 'Times New Roman'],\n\t['Hebr', 'Times New Roman'],\n\t['Thai', 'Angsana New'],\n\t['Ethi', 'Nyala'],\n\t['Beng', 'Vrinda'],\n\t['Gujr', 'Shruti'],\n\t['Khmr', 'MoolBoran'],\n\t['Knda', 'Tunga'],\n\t['Guru', 'Raavi'],\n\t['Cans', 'Euphemia'],\n\t['Cher', 'Plantagenet Cherokee'],\n\t['Yiii', 'Microsoft Yi Baiti'],\n\t['Tibt', 'Microsoft Himalaya'],\n\t['Thaa', 'MV Boli'],\n\t['Deva', 'Mangal'],\n\t['Telu', 'Gautami'],\n\t['Taml', 'Latha'],\n\t['Syrc', 'Estrangelo Edessa'],\n\t['Orya', 'Kalinga'],\n\t['Mlym', 'Kartika'],\n\t['Laoo', 'DokChampa'],\n\t['Sinh', 'Iskoola Pota'],\n\t['Mong', 'Mongolian Baiti'],\n\t['Viet', 'Times New Roman'],\n\t['Uigh', 'Microsoft Uighur'],\n\t['Geor', 'Sylfaen'],\n\t['Armn', 'Arial'],\n\t['Bugi', 'Leelawadee UI'],\n\t['Bopo', 'Microsoft JhengHei'],\n\t['Java', 'Javanese Text'],\n\t['Lisu', 'Segoe UI'],\n\t['Mymr', 'Myanmar Text'],\n\t['Nkoo', 'Ebrima'],\n\t['Olck', 'Nirmala UI'],\n\t['Osma', 'Ebrima'],\n\t['Phag', 'Phagspa'],\n\t['Syrn', 'Estrangelo Edessa'],\n\t['Syrj', 'Estrangelo Edessa'],\n\t['Syre', 'Estrangelo Edessa'],\n\t['Sora', 'Nirmala UI'],\n\t['Tale', 'Microsoft Tai Le'],\n\t['Talu', 'Microsoft New Tai Lue'],\n\t['Tfng', 'Ebrima'],\n]\nconst MINOR_FONT_LIST: ReadonlyArray<readonly [string, string]> = [\n\t['Jpan', '游ゴシック'],\n\t['Hang', '맑은 고딕'],\n\t['Hans', '等线'],\n\t['Hant', '新細明體'],\n\t['Arab', 'Arial'],\n\t['Hebr', 'Arial'],\n\t['Thai', 'Cordia New'],\n\t['Ethi', 'Nyala'],\n\t['Beng', 'Vrinda'],\n\t['Gujr', 'Shruti'],\n\t['Khmr', 'DaunPenh'],\n\t['Knda', 'Tunga'],\n\t['Guru', 'Raavi'],\n\t['Cans', 'Euphemia'],\n\t['Cher', 'Plantagenet Cherokee'],\n\t['Yiii', 'Microsoft Yi Baiti'],\n\t['Tibt', 'Microsoft Himalaya'],\n\t['Thaa', 'MV Boli'],\n\t['Deva', 'Mangal'],\n\t['Telu', 'Gautami'],\n\t['Taml', 'Latha'],\n\t['Syrc', 'Estrangelo Edessa'],\n\t['Orya', 'Kalinga'],\n\t['Mlym', 'Kartika'],\n\t['Laoo', 'DokChampa'],\n\t['Sinh', 'Iskoola Pota'],\n\t['Mong', 'Mongolian Baiti'],\n\t['Viet', 'Arial'],\n\t['Uigh', 'Microsoft Uighur'],\n\t['Geor', 'Sylfaen'],\n\t['Armn', 'Arial'],\n\t['Bugi', 'Leelawadee UI'],\n\t['Bopo', 'Microsoft JhengHei'],\n\t['Java', 'Javanese Text'],\n\t['Lisu', 'Segoe UI'],\n\t['Mymr', 'Myanmar Text'],\n\t['Nkoo', 'Ebrima'],\n\t['Olck', 'Nirmala UI'],\n\t['Osma', 'Ebrima'],\n\t['Phag', 'Phagspa'],\n\t['Syrn', 'Estrangelo Edessa'],\n\t['Syrj', 'Estrangelo Edessa'],\n\t['Syre', 'Estrangelo Edessa'],\n\t['Sora', 'Nirmala UI'],\n\t['Tale', 'Microsoft Tai Le'],\n\t['Talu', 'Microsoft New Tai Lue'],\n\t['Tfng', 'Ebrima'],\n]\n\nfunction fontListChildren(scriptFaces: ReadonlyArray<readonly [string, string]>): RawXml[] {\n\treturn scriptFaces.map(([script, typeface]) => raw(voidEl('a:font', { script, typeface })))\n}\n\n// `<a:fmtScheme>` — fill/line/effect/background style matrices referenced by shape style indices\n// (`<p:style>`). Fixed Office boilerplate: no caller data reaches this block, so — unlike the\n// `<a:clrScheme>`/`<a:fontScheme>` blocks above — there is no escaping risk to centralize by\n// rebuilding it node-by-node. Kept as a raw literal (see app.ts for the same reasoning) rather than\n// hand-transcribed into ~90 nested el()/voidEl() calls purely for uniformity.\nconst FMT_SCHEME_XML =\n\t'<a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/><a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:satMod val=\"103000\"/><a:lumMod val=\"102000\"/><a:tint val=\"94000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"110000\"/><a:lumMod val=\"100000\"/><a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/><a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:tint val=\"93000\"/><a:satMod val=\"150000\"/><a:shade val=\"98000\"/><a:lumMod val=\"102000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:tint val=\"98000\"/><a:satMod val=\"130000\"/><a:shade val=\"90000\"/><a:lumMod val=\"103000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:shade val=\"63000\"/><a:satMod val=\"120000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme>'\n\n/**\n * Creates `ppt/theme/theme1.xml`\n * @return {string} XML\n */\nexport function makeXmlTheme(pres: PresentationPropsInternal): string {\n\t// Theme font faces are caller-supplied strings (`ThemeProps`). el()'s attrs escape by\n\t// construction: an unescaped `\"` or `&` in a font name would close the attribute early and\n\t// emit non-parseable `theme1.xml`, which PowerPoint reports as a file needing repair.\n\tconst majorLatin = pres.theme?.headFontFace\n\t\t? raw(voidEl('a:latin', { typeface: pres.theme.headFontFace }))\n\t\t: raw(voidEl('a:latin', { typeface: 'Calibri Light', panose: '020F0302020204030204' }))\n\tconst minorLatin = pres.theme?.bodyFontFace\n\t\t? raw(voidEl('a:latin', { typeface: pres.theme.bodyFontFace }))\n\t\t: raw(voidEl('a:latin', { typeface: 'Calibri', panose: '020F0502020204030204' }))\n\t// East Asian (`<a:ea>`) and complex-script (`<a:cs>`) theme font slots. PowerPoint emits these\n\t// empty by default and resolves per-script via the `<a:font>` list that follows; setting them\n\t// lets CJK / complex-script runs fall back to a caller-chosen theme font.\n\tconst majorEa = raw(voidEl('a:ea', { typeface: pres.theme?.headFontFaceEA ?? '' }))\n\tconst minorEa = raw(voidEl('a:ea', { typeface: pres.theme?.bodyFontFaceEA ?? '' }))\n\tconst majorCs = raw(voidEl('a:cs', { typeface: pres.theme?.headFontFaceCS ?? '' }))\n\tconst minorCs = raw(voidEl('a:cs', { typeface: pres.theme?.bodyFontFaceCS ?? '' }))\n\n\tconst fontScheme = el('a:fontScheme', { name: 'Office' }, [\n\t\traw(el('a:majorFont', null, [majorLatin, majorEa, majorCs, ...fontListChildren(MAJOR_FONT_LIST)])),\n\t\traw(el('a:minorFont', null, [minorLatin, minorEa, minorCs, ...fontListChildren(MINOR_FONT_LIST)])),\n\t])\n\n\tconst themeElements = el('a:themeElements', null, [\n\t\traw(buildThemeClrScheme(pres.theme?.colorScheme)),\n\t\traw(fontScheme),\n\t\traw(FMT_SCHEME_XML),\n\t])\n\n\tconst extLst = el(\n\t\t'a:extLst',\n\t\tnull,\n\t\traw(\n\t\t\tel(\n\t\t\t\t'a:ext',\n\t\t\t\t{ uri: '{05A4C25C-085E-4340-85A3-A5531E510DB2}' },\n\t\t\t\traw(\n\t\t\t\t\tvoidEl('thm15:themeFamily', {\n\t\t\t\t\t\t'xmlns:thm15': 'http://schemas.microsoft.com/office/thememl/2012/main',\n\t\t\t\t\t\tname: 'Office Theme',\n\t\t\t\t\t\tid: '{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}',\n\t\t\t\t\t\tvid: '{4A3C46E8-61CC-4603-A589-7422A47A8E4A}',\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t)\n\n\treturn (\n\t\tXML_DECL +\n\t\tel('a:theme', { 'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main', name: 'Office Theme' }, [\n\t\t\traw(themeElements),\n\t\t\traw(voidEl('a:objectDefaults')),\n\t\t\traw(voidEl('a:extraClrSchemeLst')),\n\t\t\traw(extLst),\n\t\t])\n\t)\n}\n","/**\n * ts-pptx: `docProps/app.xml`\n *\n * Emit the extended-properties part (application, slide/notes counts, heading\n * pairs, titles of parts, company).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { el, raw } from '../oxml/el.js'\n\n/** This part is pretty-printed, one element per line, at three nesting depths. */\nconst INDENT_1 = '\\n\\t'\nconst INDENT_2 = '\\n\\t\\t'\nconst INDENT_3 = '\\n\\t\\t\\t'\nconst PROP = { openPrefix: INDENT_1 }\nconst VECTOR = { openPrefix: INDENT_2, closePrefix: INDENT_2 }\nconst ITEM = { openPrefix: INDENT_3 }\n\nconst NS = {\n\txmlns: 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties',\n\t'xmlns:vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes',\n}\n\n/** One `<vt:variant>` of a heading pair: the section's name, then its count. */\nfunction headingPair(name: string, count: number): string[] {\n\treturn [\n\t\tel('vt:variant', null, raw(el('vt:lpstr', null, name)), ITEM),\n\t\tel('vt:variant', null, raw(el('vt:i4', null, count)), ITEM),\n\t]\n}\n\n/**\n * Creates `docProps/app.xml`\n * @param {PresSlideInternal[]} slides - Presenation Slides\n * @param {string} company - \"Company\" metadata\n * @returns XML\n */\nexport function makeXmlApp(slides: PresSlideInternal[], company: string): string {\n\tconst headingPairs = el(\n\t\t'vt:vector',\n\t\t{ size: 6, baseType: 'variant' },\n\t\t[...headingPair('Fonts Used', 2), ...headingPair('Theme', 1), ...headingPair('Slide Titles', slides.length)].map(\n\t\t\traw\n\t\t),\n\t\tVECTOR\n\t)\n\n\tconst titlesOfParts = el(\n\t\t'vt:vector',\n\t\t{ size: slides.length + 1 + 2, baseType: 'lpstr' },\n\t\t[\n\t\t\traw(el('vt:lpstr', null, 'Arial', ITEM)),\n\t\t\traw(el('vt:lpstr', null, 'Calibri', ITEM)),\n\t\t\traw(el('vt:lpstr', null, 'Office Theme', ITEM)),\n\t\t\t// The slide titles share one line, so the indent is emitted once — and it is\n\t\t\t// emitted whether or not there are any titles to follow it.\n\t\t\traw(INDENT_3),\n\t\t\t...slides.map((_slideObj, idx) => raw(el('vt:lpstr', null, `Slide ${idx + 1}`))),\n\t\t],\n\t\tVECTOR\n\t)\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'Properties',\n\t\t\tNS,\n\t\t\t[\n\t\t\t\traw(el('TotalTime', null, 0, PROP)),\n\t\t\t\traw(el('Words', null, 0, PROP)),\n\t\t\t\traw(el('Application', null, 'Microsoft Office PowerPoint', PROP)),\n\t\t\t\traw(el('PresentationFormat', null, 'On-screen Show (16:9)', PROP)),\n\t\t\t\traw(el('Paragraphs', null, 0, PROP)),\n\t\t\t\traw(el('Slides', null, slides.length, PROP)),\n\t\t\t\traw(el('Notes', null, slides.length, PROP)),\n\t\t\t\traw(el('HiddenSlides', null, 0, PROP)),\n\t\t\t\traw(el('MMClips', null, 0, PROP)),\n\t\t\t\traw(el('ScaleCrop', null, 'false', PROP)),\n\t\t\t\traw(el('HeadingPairs', null, raw(headingPairs), { ...PROP, closePrefix: INDENT_1 })),\n\t\t\t\traw(el('TitlesOfParts', null, raw(titlesOfParts), { ...PROP, closePrefix: INDENT_1 })),\n\t\t\t\traw(el('Company', null, company, PROP)),\n\t\t\t\traw(el('LinksUpToDate', null, 'false', PROP)),\n\t\t\t\traw(el('SharedDoc', null, 'false', PROP)),\n\t\t\t\traw(el('HyperlinksChanged', null, 'false', PROP)),\n\t\t\t\traw(el('AppVersion', null, '16.0000', PROP)),\n\t\t\t],\n\t\t\t{ closePrefix: INDENT_1 }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: `[Content_Types].xml`\n *\n * Emit the package content-types part: Default entries for the media extensions\n * actually used by the deck (plus xlsx/font defaults when present) and Override\n * entries for every written part.\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal, SlideLayoutInternal, SlideRelChart, SlideRelMedia } from '../../types/internal.js'\nimport { avContentType } from '../../media/content-type.js'\nimport { type EmbeddedFont, FONT_DATA_CONTENT_TYPE, FONT_DATA_EXTENSION } from '../../embedded-fonts.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\n/** Content-type prefixes; spelled out per part below so each entry stays greppable by its suffix. */\nconst OD = 'application/vnd.openxmlformats-officedocument.'\nconst PKG = 'application/vnd.openxmlformats-package.'\nconst CT_CHART = OD + 'drawingml.chart+xml'\n// chartEx (cx:) parts use Microsoft content types, NOT the `OD` (openxmlformats) prefix. Each\n// chartEx chart part also requires a chart-style + color-style sidecar part.\nconst CT_CHARTEX = 'application/vnd.ms-office.chartex+xml'\nconst CT_CHARTEX_STYLE = 'application/vnd.ms-office.chartstyle+xml'\nconst CT_CHARTEX_COLORS = 'application/vnd.ms-office.chartcolorstyle+xml'\nconst CT_THEME = OD + 'theme+xml'\n\n/**\n * Some Override entries have always been emitted with a leading space. It is insignificant\n * whitespace, but it is in the bytes this library has shipped for years, so it is reproduced\n * verbatim rather than normalized (see AGENTS.md \"Verification\": whitespace diffs are a STOP).\n */\nconst LEADING_SPACE = { openPrefix: ' ' }\n\nfunction contentDefault(extension: string, contentType: string): string {\n\treturn voidEl('Default', { Extension: extension, ContentType: contentType })\n}\n\nfunction override(partName: string, contentType: string, fmt?: { openPrefix: string }): string {\n\treturn voidEl('Override', { PartName: partName, ContentType: contentType }, fmt)\n}\n\n/**\n * Content-type Override(s) for a chart rel. A classic chart is one Override; a chartEx chart is\n * three: the `chartEx{N}.xml` part plus its mandatory `style{N}.xml` and `colors{N}.xml` sidecars\n * (keyed to the same `globalId`).\n */\nfunction chartOverrides(rel: SlideRelChart, fmt?: { openPrefix: string }): string[] {\n\tif (!rel.isChartEx) return [override(rel.Target, CT_CHART, fmt)]\n\treturn [\n\t\toverride(rel.Target, CT_CHARTEX, fmt),\n\t\toverride(`/ppt/charts/style${rel.globalId}.xml`, CT_CHARTEX_STYLE, fmt),\n\t\toverride(`/ppt/charts/colors${rel.globalId}.xml`, CT_CHARTEX_COLORS, fmt),\n\t]\n}\n\n/**\n * Generate XML ContentType\n * @param {PresSlideInternal[]} slides - slides\n * @param {SlideLayoutInternal[]} slideLayouts - slide layouts\n * @param {PresSlideInternal} masterSlide - master slide\n * @returns XML\n */\nexport function makeXmlContTypes(\n\tslides: PresSlideInternal[],\n\tslideLayouts: SlideLayoutInternal[],\n\tmasterSlide?: PresSlideInternal,\n\thasCustomProps?: boolean,\n\tembeddedFonts?: EmbeddedFont[]\n): string {\n\tconst parts: string[] = [contentDefault('xml', 'application/xml'), contentDefault('rels', PKG + 'relationships+xml')]\n\n\t// STEP 1 - Emit Default Extension entries only for media types actually used by the deck.\n\t// Walk slides + slideLayouts + masterSlide _relsMedia[] and dedupe by extension.\n\t// Skip 'online' rels (no part written) and rels missing extn/type.\n\tconst extnTypeMap = new Map<string, string>()\n\tconst ctTargets: Array<{ _relsMedia?: SlideRelMedia[]; _relsChart?: SlideRelChart[] }> = []\n\t;(slides || []).forEach((s) => ctTargets.push(s))\n\t;(slideLayouts || []).forEach((l) => ctTargets.push(l))\n\tif (masterSlide) ctTargets.push(masterSlide)\n\tlet ctHasChart = false\n\tctTargets.forEach((target) => {\n\t\t;(target._relsMedia || []).forEach((rel) => {\n\t\t\tif (rel.type === 'online' || !rel.extn || !rel.type) return\n\t\t\t// A/V rel `type` is `${mtype}/${extn}` (e.g. `audio/mp3`); resolve the part's\n\t\t\t// Default content type to what PowerPoint authors (`audio/mpeg`). Image rels\n\t\t\t// already carry their final content type (imageContentType).\n\t\t\tconst contentType = rel.type.startsWith('audio/')\n\t\t\t\t? avContentType(rel.extn, 'audio')\n\t\t\t\t: rel.type.startsWith('video/')\n\t\t\t\t\t? avContentType(rel.extn, 'video')\n\t\t\t\t\t: rel.type\n\t\t\tif (!extnTypeMap.has(rel.extn)) extnTypeMap.set(rel.extn, contentType)\n\t\t})\n\t\tif ((target._relsChart || []).length > 0) ctHasChart = true\n\t})\n\textnTypeMap.forEach((type, extn) => {\n\t\tparts.push(contentDefault(extn, type))\n\t})\n\t// Charts embed an xlsx workbook part; emit the Default only when at least one chart is present —\n\t// and only if an OLE object hasn't already contributed the same `xlsx` Default above (one\n\t// Extension may appear once).\n\tif (ctHasChart && !extnTypeMap.has('xlsx')) parts.push(contentDefault('xlsx', OD + 'spreadsheetml.sheet'))\n\t// Embedded fonts: one Default covers every `.fntdata` part (emitted only when fonts are embedded).\n\tif ((embeddedFonts || []).some((font) => font.faces.some((face) => face.bytes))) {\n\t\tparts.push(contentDefault(FONT_DATA_EXTENSION, FONT_DATA_CONTENT_TYPE))\n\t}\n\n\t// STEP 2: Add presentation and slide master(s)/slide(s)\n\tparts.push(override('/ppt/presentation.xml', OD + 'presentationml.presentation.main+xml'))\n\tparts.push(override('/ppt/notesMasters/notesMaster1.xml', OD + 'presentationml.notesMaster+xml'))\n\t// Only one slideMaster part (`slideMaster1.xml`) is written; emit a single matching Override\n\t// rather than one per slide (which would dangle, since `slideMaster2..N.xml` do not exist).\n\tparts.push(override('/ppt/slideMasters/slideMaster1.xml', OD + 'presentationml.slideMaster+xml'))\n\tslides.forEach((slide, idx) => {\n\t\tparts.push(override(`/ppt/slides/slide${idx + 1}.xml`, OD + 'presentationml.slide+xml'))\n\t\t// Add charts if any\n\t\tslide._relsChart.forEach((rel) => {\n\t\t\tparts.push(...chartOverrides(rel))\n\t\t})\n\t})\n\n\t// STEP 3: Core PPT\n\tparts.push(override('/ppt/presProps.xml', OD + 'presentationml.presProps+xml'))\n\tparts.push(override('/ppt/viewProps.xml', OD + 'presentationml.viewProps+xml'))\n\tparts.push(override('/ppt/theme/theme1.xml', CT_THEME))\n\t// notesMaster1.xml.rels references ../theme/theme2.xml; emit a matching Override so the part resolves\n\tparts.push(override('/ppt/theme/theme2.xml', CT_THEME))\n\tparts.push(override('/ppt/tableStyles.xml', OD + 'presentationml.tableStyles+xml'))\n\n\t// STEP 4: Add Slide Layouts\n\tslideLayouts.forEach((layout, idx) => {\n\t\tparts.push(override(`/ppt/slideLayouts/slideLayout${idx + 1}.xml`, OD + 'presentationml.slideLayout+xml'))\n\t\t;(layout._relsChart || []).forEach((rel) => {\n\t\t\tparts.push(...chartOverrides(rel, LEADING_SPACE))\n\t\t})\n\t})\n\n\t// STEP 5: Add notes slide(s)\n\tslides.forEach((_slide, idx) => {\n\t\tparts.push(override(`/ppt/notesSlides/notesSlide${idx + 1}.xml`, OD + 'presentationml.notesSlide+xml'))\n\t})\n\n\t// STEP 5b: Comments — per-slide comment part Override for slides that have comments, plus the\n\t// single presentation-level commentAuthors part Override when the deck has any comments.\n\tlet hasAnyComment = false\n\tslides.forEach((slide, idx) => {\n\t\tif ((slide._comments || []).length > 0) {\n\t\t\thasAnyComment = true\n\t\t\tparts.push(override(`/ppt/comments/comment${idx + 1}.xml`, OD + 'presentationml.comments+xml'))\n\t\t}\n\t})\n\tif (hasAnyComment) parts.push(override('/ppt/commentAuthors.xml', OD + 'presentationml.commentAuthors+xml'))\n\n\t// STEP 6: Add rels\n\tmasterSlide?._relsChart.forEach((rel) => {\n\t\tparts.push(...chartOverrides(rel, LEADING_SPACE))\n\t})\n\t// master _relsMedia extensions are already covered by the unified ctTargets walk above; no per-master Default block needed here.\n\n\t// LAST: Finish XML (Resume core)\n\tparts.push(override('/docProps/core.xml', PKG + 'core-properties+xml', LEADING_SPACE))\n\tparts.push(override('/docProps/app.xml', OD + 'extended-properties+xml', LEADING_SPACE))\n\tif (hasCustomProps) parts.push(override('/docProps/custom.xml', OD + 'custom-properties+xml', LEADING_SPACE))\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel('Types', { xmlns: 'http://schemas.openxmlformats.org/package/2006/content-types' }, parts.map(raw))\n\t)\n}\n","/**\n * ts-pptx: `docProps/core.xml`\n *\n * Emit the core-properties part (title/subject/creator/revision and the\n * created/modified timestamps).\n */\n\nimport { XML_DECL } from '../../constants-internal.js'\nimport { el, raw } from '../oxml/el.js'\n\n/** Each property sits on its own indented line; the parent supplies the closing indent. */\nconst PROP = { openPrefix: '\\n\\t\\t' }\n\nconst NS = {\n\t'xmlns:cp': 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',\n\t'xmlns:dc': 'http://purl.org/dc/elements/1.1/',\n\t'xmlns:dcterms': 'http://purl.org/dc/terms/',\n\t'xmlns:dcmitype': 'http://purl.org/dc/dcmitype/',\n\t'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',\n}\n\nfunction timestamp(): string {\n\treturn new Date().toISOString().replace(/\\.\\d\\d\\dZ/, 'Z')\n}\n\n/**\n * Creates `docProps/core.xml`\n * @param {string} title - metadata data\n * @param {string} subject - metadata data\n * @param {string} author - metadata value\n * @param {string} revision - metadata value\n * @returns XML\n */\nexport function makeXmlCore(title: string, subject: string, author: string, revision: string): string {\n\tconst dcterms = { 'xsi:type': 'dcterms:W3CDTF' }\n\treturn (\n\t\tXML_DECL +\n\t\tel(\n\t\t\t'cp:coreProperties',\n\t\t\tNS,\n\t\t\t[\n\t\t\t\traw(el('dc:title', null, title, PROP)),\n\t\t\t\traw(el('dc:subject', null, subject, PROP)),\n\t\t\t\traw(el('dc:creator', null, author, PROP)),\n\t\t\t\traw(el('cp:lastModifiedBy', null, author, PROP)),\n\t\t\t\t// `revision` is interpolated unescaped today; raw() preserves that.\n\t\t\t\traw(el('cp:revision', null, raw(revision), PROP)),\n\t\t\t\traw(el('dcterms:created', dcterms, raw(timestamp()), PROP)),\n\t\t\t\traw(el('dcterms:modified', dcterms, raw(timestamp()), PROP)),\n\t\t\t],\n\t\t\t{ openPrefix: '\\n\\t', closePrefix: '\\n\\t' }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: `docProps/custom.xml`\n *\n * Emit the custom-properties part from caller-supplied name/value pairs (bool,\n * date, number and string value types).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { CustomPropertyValue } from '../../types/index.js'\nimport { el, raw } from '../oxml/el.js'\n\nconst CUSTOM_PROPS_FMTID = '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'\n\nconst PROPS_NS = {\n\txmlns: 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties',\n\t'xmlns:vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes',\n}\n\n/** Serialize one custom-property value to its typed `vt:` element. */\nfunction valueEl(value: CustomPropertyValue): string {\n\tif (typeof value === 'boolean') return el('vt:bool', null, String(value))\n\tif (value instanceof Date) return el('vt:filetime', null, value.toISOString().replace(/\\.\\d{3}Z$/, 'Z'))\n\tif (typeof value === 'number') return el(Number.isInteger(value) ? 'vt:i4' : 'vt:r8', null, value)\n\treturn el('vt:lpwstr', null, String(value))\n}\n\n/**\n * Creates `docProps/custom.xml`\n * @param props - custom property name/value pairs\n * @returns XML\n */\nexport function makeXmlCustomProperties(props: Array<{ name: string; value: CustomPropertyValue }>): string {\n\t// pid is 1-based with 1 reserved by the spec, so caller properties start at 2.\n\tconst properties = props.map(({ name, value }, idx) =>\n\t\traw(el('property', { fmtid: CUSTOM_PROPS_FMTID, pid: idx + 2, name }, raw(valueEl(value))))\n\t)\n\treturn XML_DECL + CRLF + el('Properties', PROPS_NS, properties)\n}\n","/**\n * ts-pptx: `_rels/.rels`\n *\n * Emit the package root relationships (app/core/presentation, plus custom-props\n * when present).\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { OFFICE_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.js'\n\nfunction relationship(id: string, type: string, target: string): string {\n\treturn voidEl('Relationship', { Id: id, Type: type, Target: target }, { openPrefix: '\\n\\t\\t' })\n}\n\n/**\n * Creates `_rels/.rels`\n * @returns XML\n */\nexport function makeXmlRootRels(hasCustomProps?: boolean): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'Relationships',\n\t\t\t{ xmlns: PACKAGE_REL_NS },\n\t\t\t[\n\t\t\t\traw(relationship('rId1', OFFICE_REL + 'extended-properties', 'docProps/app.xml')),\n\t\t\t\traw(relationship('rId2', PACKAGE_REL_NS + '/metadata/core-properties', 'docProps/core.xml')),\n\t\t\t\traw(relationship('rId3', OFFICE_REL + 'officeDocument', 'ppt/presentation.xml')),\n\t\t\t\thasCustomProps ? raw(relationship('rId4', OFFICE_REL + 'custom-properties', 'docProps/custom.xml')) : null,\n\t\t\t],\n\t\t\t// The closing tag is indented to child depth, not parent depth. That is\n\t\t\t// how this part has always been emitted; kept verbatim for byte-identity.\n\t\t\t{ closePrefix: '\\n\\t\\t' }\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: `ppt/_rels/presentation.xml.rels`\n *\n * Emit the presentation relationships (slideMaster, slides, notesMaster/\n * presProps/viewProps/theme/tableStyles, optional commentAuthors, embedded-font\n * faces). `presentationFontRelStart` is shared with the presentation-part writer\n * so the embeddedFontLst face `r:id`s match the rels that back them.\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { type EmbeddedFont, FONT_REL_TYPE, flattenEmbeddedFaces } from '../../embedded-fonts.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\nimport { OFFICE_REL, PACKAGE_REL_NS } from '../../ooxml/rel-types.js'\n\nfunction relationship(rId: number, type: string, target: string): string {\n\treturn voidEl('Relationship', { Id: `rId${rId}`, Type: type, Target: target })\n}\n\n/**\n * Creates `ppt/_rels/presentation.xml.rels`\n * @param {PresSlideInternal[]} slides - Presenation Slides\n * @returns XML\n */\n/**\n * The first relationship id free for embedded-font rels in `presentation.xml.rels`,\n * i.e. one past the last fixed rel {@link makeXmlPresentationRels} emits. Shared by\n * the rels writer and {@link makeXmlPresentation} so the `embeddedFontLst` face\n * `r:id`s match the relationships that back them.\n *\n * Layout: rId1 = slideMaster, rId2..(N+1) = N slides, then notesMaster/presProps/\n * viewProps/theme1/tableStyles (5), then commentAuthors (1, only with comments).\n */\nexport function presentationFontRelStart(slides: PresSlideInternal[]): number {\n\tconst hasComments = (slides || []).some((slide) => (slide._comments || []).length > 0)\n\treturn slides.length + 7 + (hasComments ? 1 : 0)\n}\n\nexport function makeXmlPresentationRels(slides: PresSlideInternal[], embeddedFonts?: EmbeddedFont[]): string {\n\tlet intRelNum = 1\n\tconst rels: string[] = [relationship(1, OFFICE_REL + 'slideMaster', 'slideMasters/slideMaster1.xml')]\n\tfor (let idx = 1; idx <= slides.length; idx++) {\n\t\trels.push(relationship(++intRelNum, OFFICE_REL + 'slide', `slides/slide${idx}.xml`))\n\t}\n\tintRelNum++\n\trels.push(\n\t\trelationship(intRelNum + 0, OFFICE_REL + 'notesMaster', 'notesMasters/notesMaster1.xml'),\n\t\trelationship(intRelNum + 1, OFFICE_REL + 'presProps', 'presProps.xml'),\n\t\trelationship(intRelNum + 2, OFFICE_REL + 'viewProps', 'viewProps.xml'),\n\t\trelationship(intRelNum + 3, OFFICE_REL + 'theme', 'theme/theme1.xml'),\n\t\trelationship(intRelNum + 4, OFFICE_REL + 'tableStyles', 'tableStyles.xml')\n\t)\n\t// The presentation-level commentAuthors part is shared by every slide's comments, so it is\n\t// related once from the presentation (only when the deck has at least one comment).\n\tif ((slides || []).some((slide) => (slide._comments || []).length > 0)) {\n\t\trels.push(relationship(intRelNum + 5, OFFICE_REL + 'commentAuthors', 'commentAuthors.xml'))\n\t}\n\t// Embedded fonts: one `font` rel per face, ids continuing past the fixed rels above.\n\tfor (const face of flattenEmbeddedFaces(embeddedFonts || [], presentationFontRelStart(slides))) {\n\t\trels.push(relationship(face.rId, FONT_REL_TYPE, `fonts/font${face.partIndex}.fntdata`))\n\t}\n\n\treturn XML_DECL + CRLF + el('Relationships', { xmlns: PACKAGE_REL_NS }, rels.map(raw))\n}\n","/**\n * ts-pptx: `ppt/presentation.xml` + presProps/viewProps\n *\n * Emit the presentation part (masters/notes/slide id lists, sizes, embedded-font\n * list, default text styles, sections) and the small presProps/viewProps parts.\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { PresentationPropsInternal, SectionInternalProps } from '../../types/internal.js'\nimport { flattenEmbeddedFaces, serializeEmbeddedFontLst } from '../../embedded-fonts.js'\nimport { presentationFontRelStart } from './presentation-rels.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\nconst DML = 'http://schemas.openxmlformats.org/drawingml/2006/main'\nconst REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'\nconst PML = 'http://schemas.openxmlformats.org/presentationml/2006/main'\n\nfunction defaultTextStyleLevel(idy: number): string {\n\treturn el(\n\t\t`a:lvl${idy}pPr`,\n\t\t{ marL: (idy - 1) * 457200, algn: 'l', defTabSz: 914400, rtl: 0, eaLnBrk: 1, latinLnBrk: 0, hangingPunct: 1 },\n\t\traw(\n\t\t\tel('a:defRPr', { sz: 1800, kern: 1200 }, [\n\t\t\t\traw(el('a:solidFill', null, raw(voidEl('a:schemeClr', { val: 'tx1' })))),\n\t\t\t\traw(voidEl('a:latin', { typeface: '+mn-lt' })),\n\t\t\t\traw(voidEl('a:ea', { typeface: '+mn-ea' })),\n\t\t\t\traw(voidEl('a:cs', { typeface: '+mn-cs' })),\n\t\t\t])\n\t\t)\n\t)\n}\n\nfunction sectionsExtLst(sections: SectionInternalProps[]): string {\n\treturn el('p:extLst', null, [\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:ext',\n\t\t\t\t{ uri: '{521415D9-36F7-43E2-AB2F-B90AF26B5E84}' },\n\t\t\t\traw(\n\t\t\t\t\tel(\n\t\t\t\t\t\t'p14:sectionLst',\n\t\t\t\t\t\t{ 'xmlns:p14': 'http://schemas.microsoft.com/office/powerpoint/2010/main' },\n\t\t\t\t\t\tsections.map((sect) =>\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t'p14:section',\n\t\t\t\t\t\t\t\t\t{ name: sect.title, id: sect._id },\n\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\tel(\n\t\t\t\t\t\t\t\t\t\t\t'p14:sldIdLst',\n\t\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\t\tsect._slides.map((slide) => raw(voidEl('p14:sldId', { id: slide._slideId })))\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\t)\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\traw(\n\t\t\tel(\n\t\t\t\t'p:ext',\n\t\t\t\t{ uri: '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}' },\n\t\t\t\traw(voidEl('p15:sldGuideLst', { 'xmlns:p15': 'http://schemas.microsoft.com/office/powerpoint/2012/main' }))\n\t\t\t)\n\t\t),\n\t])\n}\n\n/**\n * Create presentation file (`ppt/presentation.xml`)\n * @see https://docs.microsoft.com/en-us/office/open-xml/structure-of-a-presentationml-document\n * @see http://www.datypic.com/sc/ooxml/t-p_CT_Presentation.html\n * @param {PresentationPropsInternal} pres - presentation\n * @return {string} XML\n */\nexport function makeXmlPresentation(pres: PresentationPropsInternal): string {\n\t// NOTE: the double space before saveSubsetFonts/embedTrueTypeFonts when\n\t// rtlMode is unset is a pre-existing template artifact (verified against\n\t// the byte-identity baseline) — the literal space around `${rtl}` survives\n\t// even when the interpolation is empty. el()'s attrs always normalize to\n\t// single-space separators, so this opening tag stays a raw template rather\n\t// than being forced through the builder.\n\tconst openTag =\n\t\t`<p:presentation xmlns:a=\"${DML}\" xmlns:r=\"${REL}\" ` +\n\t\t// When fonts are embedded we carry WHOLE faces, so `embedTrueTypeFonts=\"1\"` (so\n\t\t// PowerPoint honors the embed) and `saveSubsetFonts=\"0\"` (we did not subset).\n\t\t// With no embedded fonts, keep the historical inert `saveSubsetFonts=\"1\"`.\n\t\t`xmlns:p=\"${PML}\" ${pres.rtlMode ? 'rtl=\"1\"' : ''} ${(pres.embeddedFonts || []).some((font) => font.faces.some((face) => face.bytes)) ? 'embedTrueTypeFonts=\"1\" saveSubsetFonts=\"0\"' : 'saveSubsetFonts=\"1\"'} autoCompressPictures=\"0\"${pres.firstSlideNum !== 1 ? ` firstSlideNum=\"${pres.firstSlideNum}\"` : ''}>`\n\n\t// SPEC (ECMA-376 Part 1 §19.2.1.26): sldMasterIdLst, then notesMasterIdLst\n\t// BEFORE sldIdLst — emitting notesMasterIdLst after sldIdLst (or after\n\t// sldSz/notesSz) violates the schema and is flagged by OpenXmlValidator as\n\t// Sch_UnexpectedElementContentExpectingComplex.\n\tconst sldMasterIdLst = el('p:sldMasterIdLst', null, raw(voidEl('p:sldMasterId', { id: 2147483648, 'r:id': 'rId1' })))\n\n\t// NOTE: length+2 is from `presentation.xml.rels` func (since we have to match this rId, we just use same logic)\n\tconst notesMasterIdLst = el(\n\t\t'p:notesMasterIdLst',\n\t\tnull,\n\t\traw(voidEl('p:notesMasterId', { 'r:id': `rId${pres.slides.length + 2}` }))\n\t)\n\n\tconst sldIdLst = el(\n\t\t'p:sldIdLst',\n\t\tnull,\n\t\tpres.slides.map((slide) => raw(voidEl('p:sldId', { id: slide._slideId, 'r:id': `rId${slide._rId}` })))\n\t)\n\n\tconst sldSz = voidEl('p:sldSz', { cx: pres.presLayout.width, cy: pres.presLayout.height })\n\tconst notesSz = voidEl('p:notesSz', { cx: pres.presLayout.height, cy: pres.presLayout.width })\n\n\t// Embedded fonts (CT_Presentation index 7 — after notesSz, before defaultTextStyle).\n\t// rIds continue past the fixed presentation rels and must match makeXmlPresentationRels.\n\tconst fonts = pres.embeddedFonts || []\n\tconst flat = flattenEmbeddedFaces(fonts, presentationFontRelStart(pres.slides))\n\tconst rIdOf = new Map(flat.map((face) => [`${face.fontIndex}:${face.slot}`, face.rId]))\n\tconst embeddedFontLst = serializeEmbeddedFontLst(fonts, (fontIndex, slot) => rIdOf.get(`${fontIndex}:${slot}`))\n\n\tconst defaultTextStyle = el(\n\t\t'p:defaultTextStyle',\n\t\tnull,\n\t\tArray.from({ length: 9 }, (_, i) => raw(defaultTextStyleLevel(i + 1)))\n\t)\n\n\tconst extLst = pres.sections && pres.sections.length > 0 ? sectionsExtLst(pres.sections) : ''\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\topenTag +\n\t\tsldMasterIdLst +\n\t\tnotesMasterIdLst +\n\t\tsldIdLst +\n\t\tsldSz +\n\t\tnotesSz +\n\t\tembeddedFontLst +\n\t\tdefaultTextStyle +\n\t\textLst +\n\t\t'</p:presentation>'\n\t)\n}\n\n/**\n * Create `ppt/presProps.xml`\n * @return {string} XML\n */\nexport function makeXmlPresProps(): string {\n\treturn XML_DECL + CRLF + voidEl('p:presentationPr', { 'xmlns:a': DML, 'xmlns:r': REL, 'xmlns:p': PML })\n}\n\n/**\n * Creates `ppt/viewProps.xml`\n * @return {string} XML\n */\nexport function makeXmlViewProps(): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel('p:viewPr', { 'xmlns:a': DML, 'xmlns:r': REL, 'xmlns:p': PML }, [\n\t\t\traw(\n\t\t\t\tel('p:normalViewPr', { horzBarState: 'maximized' }, [\n\t\t\t\t\traw(voidEl('p:restoredLeft', { sz: 15611 })),\n\t\t\t\t\traw(voidEl('p:restoredTop', { sz: 94610 })),\n\t\t\t\t])\n\t\t\t),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:slideViewPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('p:cSldViewPr', { snapToGrid: 0, snapToObjects: 1 }, [\n\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\tel('p:cViewPr', { varScale: 1 }, [\n\t\t\t\t\t\t\t\t\traw(\n\t\t\t\t\t\t\t\t\t\tel('p:scale', null, [\n\t\t\t\t\t\t\t\t\t\t\traw(voidEl('a:sx', { n: 136, d: 100 })),\n\t\t\t\t\t\t\t\t\t\t\traw(voidEl('a:sy', { n: 136, d: 100 })),\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\traw(voidEl('p:origin', { x: 216, y: 312 })),\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\traw(voidEl('p:guideLst')),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:notesTextViewPr',\n\t\t\t\t\tnull,\n\t\t\t\t\traw(\n\t\t\t\t\t\tel('p:cViewPr', null, [\n\t\t\t\t\t\t\traw(el('p:scale', null, [raw(voidEl('a:sx', { n: 1, d: 1 })), raw(voidEl('a:sy', { n: 1, d: 1 }))])),\n\t\t\t\t\t\t\traw(voidEl('p:origin', { x: 0, y: 0 })),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\traw(voidEl('p:gridSpacing', { cx: 76200, cy: 76200 })),\n\t\t])\n\t)\n}\n","/**\n * ts-pptx: `ppt/tableStyles.xml`\n *\n * Emit the table-styles part. The part carries only the default style id: it defines no\n * styles of its own, because PowerPoint never reads one out of it.\n *\n * `<a:tableStyleId>` is resolved against PowerPoint's *own* table-style gallery, not against\n * this part. Verified by render (PowerPoint desktop 16.0): a deck pointed at a built-in GUID\n * this part does not define paints correctly, while a PowerPoint-authored deck whose style\n * GUID is rewritten to a novel value — in both this part and the slide, bytes otherwise\n * identical — loses its styling entirely and falls back to the black hairline grid. The same\n * holds for a definition placed inline in the slide's `<a:tblPr>` as `<a:tableStyle>`, and for\n * one nominated by this part's `def=`. So a custom `<a:tblStyle>` is unreachable markup in the\n * supported target, whatever it says and wherever it sits. Brand styling belongs in direct\n * cell formatting (`headerRow`, `columns[i]`, per-cell options); see `docs/tables.md`.\n *\n * The part itself still ships: PowerPoint expects the relationship and content-type override\n * to be present, and the read side (`src/read/api/ops/table-styles.ts`) merges real definitions out of\n * *imported* decks into it, which is a different thing from authoring one here.\n */\n\nimport { TableStyle } from '../../enums.js'\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport { voidEl } from '../oxml/el.js'\n\n/**\n * Create `ppt/tableStyles.xml`\n * @see: http://openxmldeveloper.org/discussions/formats/f/13/p/2398/8107.aspx\n * @return {string} XML\n */\nexport function makeXmlTableStyles(): string {\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tvoidEl('a:tblStyleLst', {\n\t\t\t'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\tdef: TableStyle.MEDIUM_STYLE_2_ACCENT_1,\n\t\t})\n\t)\n}\n","/**\n * ts-pptx: comment parts\n *\n * Resolve every slide's comments into a deck-wide author registry with per-author\n * numbering, then emit the presentation-level `commentAuthors.xml` and each\n * slide's `comments/commentN.xml` part.\n */\n\nimport { CRLF, XML_DECL } from '../../constants-internal.js'\nimport type { ResolvedCommentAuthor, SlideComment } from '../../types/index.js'\nimport type { PresSlideInternal } from '../../types/internal.js'\nimport { inch2Emu } from '../../units-internal.js'\nimport { el, raw, voidEl } from '../oxml/el.js'\n\n/** Result of resolving every slide's comments into a deck-wide author registry + per-comment numbering. */\ninterface ResolvedComments {\n\t/** Authors in first-appearance order, ready to serialize to `commentAuthors.xml`. */\n\tauthors: ResolvedCommentAuthor[]\n\t/** Per-comment `authorId`/`idx` keyed by the stored comment object. */\n\tmeta: Map<SlideComment, { authorId: number; idx: number }>\n}\n\n/**\n * Walk every slide's comments and build the deck-wide author registry + per-comment numbering.\n *\n * Legacy comments number each comment with a *per-author* 1-based `idx`; an author's `lastIdx` is the\n * highest `idx` it used. Authors are keyed by `name`+`initials` and assigned ids in first-appearance\n * order (slide order, then insertion order). `clrIdx` mirrors `id` (one colour slot per author).\n * @param {PresSlideInternal[]} slides - all presentation slides\n * @return {ResolvedComments} the author list and per-comment metadata\n */\nexport function resolveCommentAuthors(slides: PresSlideInternal[]): ResolvedComments {\n\tconst byKey = new Map<string, ResolvedCommentAuthor>()\n\tconst authors: ResolvedCommentAuthor[] = []\n\tconst perAuthorCount = new Map<number, number>()\n\tconst meta = new Map<SlideComment, { authorId: number; idx: number }>()\n\n\t;(slides || []).forEach((slide) => {\n\t\t;(slide._comments || []).forEach((comment) => {\n\t\t\tconst key = comment.author + '\\0' + comment.initials\n\t\t\tlet author = byKey.get(key)\n\t\t\tif (!author) {\n\t\t\t\tauthor = {\n\t\t\t\t\tid: authors.length,\n\t\t\t\t\tname: comment.author,\n\t\t\t\t\tinitials: comment.initials,\n\t\t\t\t\tlastIdx: 0,\n\t\t\t\t\tclrIdx: authors.length,\n\t\t\t\t}\n\t\t\t\tbyKey.set(key, author)\n\t\t\t\tauthors.push(author)\n\t\t\t\tperAuthorCount.set(author.id, 0)\n\t\t\t}\n\t\t\tconst idx = (perAuthorCount.get(author.id) ?? 0) + 1\n\t\t\tperAuthorCount.set(author.id, idx)\n\t\t\tauthor.lastIdx = idx\n\t\t\tmeta.set(comment, { authorId: author.id, idx })\n\t\t})\n\t})\n\n\treturn { authors, meta }\n}\n\n/**\n * Creates the presentation-level `ppt/commentAuthors.xml` part (`<p:cmAuthorLst>`).\n * @param {ResolvedCommentAuthor[]} authors - resolved deck-wide author registry\n * @return {string} XML\n */\nexport function makeXmlCommentAuthors(authors: ResolvedCommentAuthor[]): string {\n\tconst cmAuthors = authors\n\t\t.map((author) =>\n\t\t\tvoidEl('p:cmAuthor', {\n\t\t\t\tid: author.id,\n\t\t\t\tname: author.name,\n\t\t\t\tinitials: author.initials,\n\t\t\t\tlastIdx: author.lastIdx,\n\t\t\t\tclrIdx: author.clrIdx,\n\t\t\t})\n\t\t)\n\t\t.join('')\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:cmAuthorLst',\n\t\t\t{\n\t\t\t\t'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\n\t\t\t},\n\t\t\traw(cmAuthors)\n\t\t)\n\t)\n}\n\n/**\n * Creates a per-slide comments part `ppt/comments/comment{N}.xml` (`<p:cmLst>`).\n * @param {PresSlideInternal} slide - the slide whose comments are serialized\n * @param {Map} meta - per-comment `authorId`/`idx` from {@link resolveCommentAuthors}\n * @return {string} XML\n */\nexport function makeXmlComments(\n\tslide: PresSlideInternal,\n\tmeta: Map<SlideComment, { authorId: number; idx: number }>\n): string {\n\tconst cms = (slide._comments || [])\n\t\t.map((comment) => {\n\t\t\tconst m = meta.get(comment)\n\t\t\tif (!m) return '' // defensive: comment must have been seen by resolveCommentAuthors\n\t\t\t// Child order is fixed by CT_Comment: <p:pos> then <p:text>. pos x/y are ST_Coordinate (EMU).\n\t\t\treturn el('p:cm', { authorId: m.authorId, dt: comment.date || null, idx: m.idx }, [\n\t\t\t\traw(voidEl('p:pos', { x: Math.round(inch2Emu(comment.x)), y: Math.round(inch2Emu(comment.y)) })),\n\t\t\t\traw(el('p:text', null, comment.text)),\n\t\t\t])\n\t\t})\n\t\t.join('')\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:cmLst',\n\t\t\t{\n\t\t\t\t'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\n\t\t\t},\n\t\t\traw(cms)\n\t\t)\n\t)\n}\n","/**\n * ts-pptx: slide-layout part\n *\n * Emit a slide layout (`ppt/slideLayouts/slideLayoutN.xml`) from a layout object.\n */\n\nimport { XML_DECL } from '../../constants-internal.js'\nimport type { SlideLayoutInternal } from '../../types/internal.js'\nimport { slideObjectToXml } from './object.js'\n\n/**\n * Generates the XML layout resource from a layout object\n * @param {SlideLayoutInternal} layout - slide layout (master)\n * @return {string} XML\n */\nexport function makeXmlLayout(layout: SlideLayoutInternal): string {\n\treturn `${XML_DECL}\n\t\t<p:sldLayout xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\" preserve=\"1\">\n\t\t${slideObjectToXml(layout)}\n\t\t<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`\n}\n","/**\n * ts-pptx: slide-master parts\n *\n * The slide master (`slideMaster1.xml`) and its `.rels`, plus the master text\n * styles (`<p:txStyles>`): per-level default values mirroring the built-in\n * Office master, with any `MasterTextStyleProps` overrides layered on top.\n */\n\nimport { CRLF, LAYOUT_IDX_SERIES_BASE, XML_DECL } from '../../constants-internal.js'\nimport type { MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps } from '../../types/index.js'\nimport type { PresSlideInternal, SlideLayoutInternal } from '../../types/internal.js'\nimport { createColorElement } from '../drawingml/color.js'\nimport { inch2Emu } from '../../units-internal.js'\nimport { HUNDREDTHS_PER_POINT, ptToHundredths } from '../../units.js'\nimport { warn } from '../../diagnostics.js'\nimport { el, raw, voidEl, type XmlAttrs } from '../oxml/el.js'\nimport { slideObjectRelationsToXml, slideObjectToXml } from './object.js'\n\n// Default per-level values mirroring the built-in Office master (used as the base that\n// `MasterTextStyleProps` overrides are layered onto). `bu` describes the level's default\n// bullet: 'none' -> <a:buNone/>, undefined -> no bullet element (otherStyle), or a glyph.\ninterface MasterLevelDefault {\n\tmarL: number // EMU\n\tindent?: number // EMU (omitted when undefined)\n\talgn: string // OOXML algn value\n\tspcBefPct?: number // <a:spcBef> percent (×1000); omitted when undefined\n\tbu?: 'none' | { char: string; font: string } // default bullet; undefined => emit no bullet element\n\tsz: number // <a:defRPr@sz>\n\tfont: 'mj' | 'mn' // major (heading) vs minor (body) theme font family\n}\nconst MASTER_TITLE_DEFAULT: MasterLevelDefault = {\n\tmarL: 0,\n\talgn: 'ctr',\n\tspcBefPct: 0,\n\tbu: 'none',\n\tsz: 4400,\n\tfont: 'mj',\n}\nconst MASTER_BODY_DEFAULTS: MasterLevelDefault[] = [\n\t{\n\t\tmarL: 342900,\n\t\tindent: -342900,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 3200,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 742950,\n\t\tindent: -285750,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '–', font: 'Arial' },\n\t\tsz: 2800,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 1143000,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2400,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 1600200,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '–', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2057400,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '»', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2514600,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 2971800,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 3429000,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n\t{\n\t\tmarL: 3886200,\n\t\tindent: -228600,\n\t\talgn: 'l',\n\t\tspcBefPct: 20000,\n\t\tbu: { char: '•', font: 'Arial' },\n\t\tsz: 2000,\n\t\tfont: 'mn',\n\t},\n]\nconst MASTER_OTHER_DEFAULTS: MasterLevelDefault[] = [\n\t0, 457200, 914400, 1371600, 1828800, 2286000, 2743200, 3200400, 3657600,\n].map((marL) => ({ marL, algn: 'l', sz: 1800, font: 'mn' as const }))\n\nfunction masterAlignAttr(align: MasterTextStyleLevel['align']): string {\n\tswitch (align) {\n\t\tcase 'left':\n\t\t\treturn 'l'\n\t\tcase 'right':\n\t\t\treturn 'r'\n\t\tcase 'center':\n\t\t\treturn 'ctr'\n\t\tcase 'justify':\n\t\t\treturn 'just'\n\t\tdefault:\n\t\t\treturn ''\n\t}\n}\n\n/** Build the bullet element for a master level: caller override wins over the level default. */\nfunction masterBulletXml(\n\tbulletOverride: boolean | MasterBulletProps | undefined,\n\tbase: MasterLevelDefault['bu']\n): string {\n\t// Explicit override\n\tif (bulletOverride === false) return voidEl('a:buNone')\n\tif (bulletOverride && typeof bulletOverride === 'object') {\n\t\tconst font = bulletOverride.fontFace ? voidEl('a:buFont', { typeface: bulletOverride.fontFace }) : ''\n\t\tif (bulletOverride.type === 'number') {\n\t\t\tconst type = bulletOverride.numberType || 'arabicPeriod'\n\t\t\tconst startAt = typeof bulletOverride.numberStartAt === 'number' ? Math.round(bulletOverride.numberStartAt) : null\n\t\t\treturn font + voidEl('a:buAutoNum', { type, startAt })\n\t\t}\n\t\t// character bullet (default). NOTE: `char` is a pre-escaped numeric char ref (e.g.\n\t\t// `&#x25AA;` from `characterCode`) — the same quirk `<a:buChar>` carries in text-run.ts.\n\t\t// The builder would double-escape the `&`, so this one attribute stays a raw template;\n\t\t// see text-run.ts's `<a:buChar>` note for the fuller rationale.\n\t\tconst char = bulletOverride.characterCode ? `&#x${bulletOverride.characterCode};` : '•'\n\t\tconst buFont = bulletOverride.fontFace\n\t\t\t? font\n\t\t\t: voidEl('a:buFont', { typeface: 'Arial', pitchFamily: 34, charset: 0 })\n\t\treturn `${buFont}<a:buChar char=\"${char}\"/>`\n\t}\n\t// No override (undefined / true): keep the level's default bullet\n\tif (base === 'none') return voidEl('a:buNone')\n\tif (base && typeof base === 'object')\n\t\treturn voidEl('a:buFont', { typeface: base.font, pitchFamily: 34, charset: 0 }) + `<a:buChar char=\"${base.char}\"/>`\n\treturn '' // otherStyle: no bullet element by default\n}\n\n/** Serialize one `<a:lvlNpPr>` from its default, layering an optional caller override. */\nfunction masterLevelXml(levelNum: number, base: MasterLevelDefault, levelOverride: MasterTextStyleLevel = {}): string {\n\tconst marL =\n\t\ttypeof levelOverride.marginLeft === 'number' && !isNaN(levelOverride.marginLeft)\n\t\t\t? inch2Emu(levelOverride.marginLeft)\n\t\t\t: base.marL\n\tconst indentEmu =\n\t\ttypeof levelOverride.indent === 'number' && !isNaN(levelOverride.indent)\n\t\t\t? inch2Emu(levelOverride.indent)\n\t\t\t: base.indent\n\tconst algn = (levelOverride.align && masterAlignAttr(levelOverride.align)) || base.algn\n\n\tlet sz = base.sz\n\tif (typeof levelOverride.fontSize === 'number') {\n\t\tif (isNaN(levelOverride.fontSize) || levelOverride.fontSize <= 0)\n\t\t\twarn(\n\t\t\t\t'master/invalid-text-style-font-size',\n\t\t\t\t`master textStyles fontSize \"${levelOverride.fontSize}\" is invalid; keeping default ${base.sz / HUNDREDTHS_PER_POINT}pt.`\n\t\t\t)\n\t\telse sz = ptToHundredths(levelOverride.fontSize)\n\t}\n\tconst colorXml = levelOverride.color ? createColorElement(levelOverride.color) : voidEl('a:schemeClr', { val: 'tx1' })\n\tconst latinXml = levelOverride.fontFace\n\t\t? voidEl('a:latin', { typeface: levelOverride.fontFace })\n\t\t: voidEl('a:latin', { typeface: `+${base.font}-lt` })\n\n\treturn el(\n\t\t`a:lvl${levelNum}pPr`,\n\t\t{ marL, indent: indentEmu, algn, defTabSz: 914400, rtl: 0, eaLnBrk: 1, latinLnBrk: 0, hangingPunct: 1 },\n\t\t[\n\t\t\ttypeof base.spcBefPct === 'number'\n\t\t\t\t? raw(el('a:spcBef', null, raw(voidEl('a:spcPct', { val: base.spcBefPct }))))\n\t\t\t\t: null,\n\t\t\traw(masterBulletXml(levelOverride.bullet, base.bu)),\n\t\t\traw(\n\t\t\t\tel('a:defRPr', { sz, b: levelOverride.bold ? '1' : null, i: levelOverride.italic ? '1' : null, kern: 1200 }, [\n\t\t\t\t\traw(el('a:solidFill', null, raw(colorXml))),\n\t\t\t\t\traw(latinXml),\n\t\t\t\t\traw(voidEl('a:ea', { typeface: `+${base.font}-ea` })),\n\t\t\t\t\traw(voidEl('a:cs', { typeface: `+${base.font}-cs` })),\n\t\t\t\t])\n\t\t\t),\n\t\t]\n\t)\n}\n\n/** Clamp a caller-provided per-level override array to the 9 valid list levels, warning on overflow. */\nfunction masterLevelOverrides(levels: MasterTextStyleLevel[] | undefined, group: string): MasterTextStyleLevel[] {\n\tif (!Array.isArray(levels)) return []\n\tif (levels.length > 9)\n\t\twarn(\n\t\t\t'master/too-many-text-style-levels',\n\t\t\t`master textStyles.${group} has ${levels.length} levels; only the first 9 are used.`\n\t\t)\n\treturn levels.slice(0, 9)\n}\n\n/**\n * Build the `<p:txStyles>` block from caller overrides layered onto the Office master defaults.\n * Only invoked when `defineSlideMaster({ textStyles })` was set; the unconfigured deck keeps the\n * verbatim default literal in `makeXmlMaster` for byte-identical output.\n */\nfunction makeXmlMasterTxStyles(textStyles: MasterTextStyleProps): string {\n\tconst title = masterLevelXml(1, MASTER_TITLE_DEFAULT, textStyles.title)\n\tconst bodyOverrides = masterLevelOverrides(textStyles.body, 'body')\n\tconst body = MASTER_BODY_DEFAULTS.map((base, i) => masterLevelXml(i + 1, base, bodyOverrides[i])).join('')\n\tconst otherOverrides = masterLevelOverrides(textStyles.other, 'other')\n\tconst other = MASTER_OTHER_DEFAULTS.map((base, i) => masterLevelXml(i + 1, base, otherOverrides[i])).join('')\n\treturn el('p:txStyles', null, [\n\t\traw(el('p:titleStyle', null, raw(title))),\n\t\traw(el('p:bodyStyle', null, raw(body))),\n\t\traw(el('p:otherStyle', null, [raw(el('a:defPPr', null, raw(voidEl('a:defRPr', { lang: 'en-US' })))), raw(other)])),\n\t])\n}\n\n/**\n * The built-in Office master's `<p:txStyles>`, used verbatim when `defineSlideMaster({ textStyles })`\n * was never called. Deliberately NOT built via `masterLevelXml`: a configured title level always\n * carries `marL=\"0\"` (from `MASTER_TITLE_DEFAULT.marL`), but the true unconfigured default titleStyle\n * has no `marL`/`indent` attribute at all — a pre-existing asymmetry between the two paths, preserved\n * exactly rather than unified.\n */\nfunction makeXmlMasterDefaultTxStyles(): string {\n\tconst defaultLevel = (\n\t\tn: number,\n\t\tattrs: XmlAttrs,\n\t\tbullet: string,\n\t\tsz: number,\n\t\tfont: 'mj' | 'mn',\n\t\tspcBefPct?: number\n\t): string =>\n\t\tel(`a:lvl${n}pPr`, { ...attrs, defTabSz: 914400, rtl: 0, eaLnBrk: 1, latinLnBrk: 0, hangingPunct: 1 }, [\n\t\t\ttypeof spcBefPct === 'number' ? raw(el('a:spcBef', null, raw(voidEl('a:spcPct', { val: spcBefPct })))) : null,\n\t\t\traw(bullet),\n\t\t\traw(\n\t\t\t\tel('a:defRPr', { sz, kern: 1200 }, [\n\t\t\t\t\traw(el('a:solidFill', null, raw(voidEl('a:schemeClr', { val: 'tx1' })))),\n\t\t\t\t\traw(voidEl('a:latin', { typeface: `+${font}-lt` })),\n\t\t\t\t\traw(voidEl('a:ea', { typeface: `+${font}-ea` })),\n\t\t\t\t\traw(voidEl('a:cs', { typeface: `+${font}-cs` })),\n\t\t\t\t])\n\t\t\t),\n\t\t])\n\n\tconst title = defaultLevel(1, { algn: 'ctr' }, voidEl('a:buNone'), 4400, 'mj', 0)\n\n\tconst bodyLevels = MASTER_BODY_DEFAULTS.map((base, i) => {\n\t\tconst bu = base.bu as { char: string; font: string }\n\t\treturn defaultLevel(\n\t\t\ti + 1,\n\t\t\t{ marL: base.marL, indent: base.indent, algn: base.algn },\n\t\t\tvoidEl('a:buFont', { typeface: bu.font, pitchFamily: 34, charset: 0 }) + voidEl('a:buChar', { char: bu.char }),\n\t\t\tbase.sz,\n\t\t\t'mn',\n\t\t\tbase.spcBefPct\n\t\t)\n\t})\n\n\tconst otherLevels = MASTER_OTHER_DEFAULTS.map((base, i) =>\n\t\tdefaultLevel(i + 1, { marL: base.marL, algn: base.algn }, '', base.sz, 'mn')\n\t)\n\n\t// NOTE: the source template's own indentation reaches the file here — each style block's\n\t// children are preceded by two spaces and its own closing tag by one (see `fmt` below) —\n\t// same class of quirk as `genXmlPlaceholder` in text-body.ts. Preserved, not reformatted.\n\treturn el(\n\t\t'p:txStyles',\n\t\tnull,\n\t\t[\n\t\t\traw(el('p:titleStyle', null, raw(title), { childPrefix: ' ', closePrefix: ' ' })),\n\t\t\traw(el('p:bodyStyle', null, bodyLevels.map(raw), { childPrefix: ' ', closePrefix: ' ' })),\n\t\t\traw(\n\t\t\t\tel(\n\t\t\t\t\t'p:otherStyle',\n\t\t\t\t\tnull,\n\t\t\t\t\t[raw(el('a:defPPr', null, raw(voidEl('a:defRPr', { lang: 'en-US' })))), ...otherLevels.map(raw)],\n\t\t\t\t\t{ childPrefix: ' ', closePrefix: ' ' }\n\t\t\t\t)\n\t\t\t),\n\t\t],\n\t\t{ childPrefix: ' ' }\n\t)\n}\n\n/**\n * Creates Slide Master 1 (`ppt/slideMasters/slideMaster1.xml`)\n * @param {PresSlideInternal} slide - slide object that represents master slide layout\n * @param {SlideLayoutInternal[]} layouts - slide layouts\n * @return {string} XML\n */\nexport function makeXmlMaster(slide: PresSlideInternal, layouts: SlideLayoutInternal[]): string {\n\t// NOTE: Pass layouts as static rels because they are not referenced any time\n\tconst layoutDefs = layouts\n\t\t.map((_layoutDef, idx) =>\n\t\t\tvoidEl('p:sldLayoutId', { id: LAYOUT_IDX_SERIES_BASE + idx, 'r:id': `rId${slide._rels.length + idx + 1}` })\n\t\t)\n\t\t.join('')\n\n\tconst clrMap = voidEl('p:clrMap', {\n\t\tbg1: 'lt1',\n\t\ttx1: 'dk1',\n\t\tbg2: 'lt2',\n\t\ttx2: 'dk2',\n\t\taccent1: 'accent1',\n\t\taccent2: 'accent2',\n\t\taccent3: 'accent3',\n\t\taccent4: 'accent4',\n\t\taccent5: 'accent5',\n\t\taccent6: 'accent6',\n\t\thlink: 'hlink',\n\t\tfolHlink: 'folHlink',\n\t})\n\n\t// CT_HeaderFooter/@sldNum defaults to true (ECMA-376). When a slide-number placeholder is\n\t// defined on the master we must NOT disable it here, otherwise slides that PowerPoint inserts\n\t// from this master inherit sldNum=\"0\" and the master slide number disappears.\n\tconst hf = voidEl('p:hf', { sldNum: slide._slideNumberProps ? null : 0, hdr: 0, ftr: 0, dt: 0 })\n\n\tconst txStyles = slide._txStyles ? makeXmlMasterTxStyles(slide._txStyles) : makeXmlMasterDefaultTxStyles()\n\n\treturn (\n\t\tXML_DECL +\n\t\tCRLF +\n\t\tel(\n\t\t\t'p:sldMaster',\n\t\t\t{\n\t\t\t\t'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\t\t\t\t'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n\t\t\t\t'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main',\n\t\t\t},\n\t\t\t[\n\t\t\t\traw(slideObjectToXml(slide)),\n\t\t\t\traw(clrMap),\n\t\t\t\traw(el('p:sldLayoutIdLst', null, raw(layoutDefs))),\n\t\t\t\traw(hf),\n\t\t\t\traw(txStyles),\n\t\t\t]\n\t\t)\n\t)\n}\n\n/**\n * Creates `ppt/slideMasters/_rels/slideMaster1.xml.rels`\n * @param {PresSlideInternal} masterSlide - Slide object\n * @param {SlideLayoutInternal[]} slideLayouts - Slide Layouts\n * @return {string} XML\n */\nexport function makeXmlMasterRel(masterSlide: PresSlideInternal, slideLayouts: SlideLayoutInternal[]): string {\n\tconst defaultRels = slideLayouts.map((_layoutDef, idx) => ({\n\t\ttarget: `../slideLayouts/slideLayout${idx + 1}.xml`,\n\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout',\n\t}))\n\tdefaultRels.push({\n\t\ttarget: '../theme/theme1.xml',\n\t\ttype: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',\n\t})\n\n\treturn slideObjectRelationsToXml(masterSlide, defaultRels)\n}\n","/**\n * Package assembly: turn an authored presentation's internal state into the full set of\n * OOXML package parts and hand the bytes to the ZIP writer. This is the write-side\n * \"packaging\" layer — `[Content_Types].xml`, the `_rels` graph, docProps, theme, the\n * per-slide/layout/master parts, comments, and chart/media rels — split out of the\n * authoring class (`TsPptx`) so that class stays a façade over slide authoring.\n *\n * The entry point `writePackage` takes a structural {@link PackageSource} that the\n * authoring class satisfies; it does not depend on the class itself, so the same pipeline\n * can be driven from any assembled deck state.\n */\nimport { ZipWriter } from '../zip.js'\nimport type { CustomPropertyValue, WriteProps } from '../types/index.js'\nimport type { PresentationPropsInternal, PresSlideInternal, SlideLayoutInternal } from '../types/internal.js'\nimport type { RuntimeAdapter } from '../runtime/types.js'\nimport type { FontMetricsRegistry } from '../measure/font-metrics.js'\nimport { flattenEmbeddedFaces } from '../embedded-fonts.js'\nimport { getNewRelId } from '../gen/utils.js'\nimport { decodeBase64ToBytes } from '../media/base64.js'\nimport { audioExtensionForSubtype } from '../media/content-type.js'\nimport { createExcelWorksheet } from '../gen/chart/embed-xlsx.js'\nimport { bakeSlideContent, encodeMediaForTargets } from '../gen/prepare.js'\nimport { makeXmlApp } from '../gen/opc/app.js'\nimport { makeXmlContTypes } from '../gen/opc/content-types.js'\nimport { makeXmlCore } from '../gen/opc/core.js'\nimport { makeXmlCustomProperties } from '../gen/opc/custom-props.js'\nimport { makeXmlRootRels } from '../gen/opc/root-rels.js'\nimport { makeXmlPresentationRels } from '../gen/pres/presentation-rels.js'\nimport { makeXmlPresentation, makeXmlPresProps, makeXmlViewProps } from '../gen/pres/presentation.js'\nimport { makeXmlTableStyles } from '../gen/pres/table-styles.js'\nimport { makeXmlTheme } from '../gen/pres/theme.js'\nimport { makeXmlCommentAuthors, makeXmlComments, resolveCommentAuthors } from '../gen/slide/comments.js'\nimport { makeXmlLayout } from '../gen/slide/layout.js'\nimport { makeXmlMaster, makeXmlMasterRel } from '../gen/slide/master.js'\nimport {\n\tmakeXmlNotesMaster,\n\tmakeXmlNotesMasterRel,\n\tmakeXmlNotesSlide,\n\tmakeXmlNotesSlideRel,\n} from '../gen/slide/notes.js'\nimport { makeXmlSlide, makeXmlSlideLayoutRel, makeXmlSlideRel } from '../gen/slide/slide.js'\n\n/**\n * The slice of an authored presentation the packager reads. The authoring class satisfies\n * this structurally: `presentation` is its internal props view (slides, layouts, master,\n * embedded fonts, and metadata), and the remaining fields are state the part builders need\n * that the props view does not carry.\n */\nexport interface PackageSource {\n\treadonly runtime: RuntimeAdapter\n\treadonly presentation: PresentationPropsInternal\n\treadonly customProperties: Array<{ name: string; value: CustomPropertyValue }>\n\treadonly fontMetrics: FontMetricsRegistry\n}\n\n/**\n * Media extensions whose bytes are already entropy-coded, so running the ZIP's\n * DEFLATE pass over them costs CPU for a negligible size gain. For these we set\n * the per-entry ZIP compression to STORE while leaving XML parts on DEFLATE.\n * In image/video-heavy decks media dominates the byte count, so this is the\n * dominant cost when writing large presentations.\n * Formats that genuinely benefit from DEFLATE (bmp, wav, tiff, emf, wmf, svg)\n * are deliberately excluded so they keep inheriting the global compression.\n */\nconst ALREADY_COMPRESSED_MEDIA_EXTN = new Set([\n\t'jpg',\n\t'jpeg',\n\t'png',\n\t'gif',\n\t'webp',\n\t'heic',\n\t'heif',\n\t'avif',\n\t'mp4',\n\t'm4v',\n\t'mov',\n\t'avi',\n\t'mpg',\n\t'mpeg',\n\t'wmv',\n\t'webm',\n\t'mkv',\n\t'mp3',\n\t'm4a',\n\t'aac',\n\t'ogg',\n\t'oga',\n])\n\n/**\n * Extensions whose payload is itself a ZIP archive — the embedded OPC packages an OLE object can\n * carry (`addOleObject`). Deflating a zip inside a zip buys nothing, so these are STOREd like the\n * already-compressed media above. No media/image rel ever uses one of these extensions, so decks\n * without an OLE object are unaffected.\n */\nconst ZIP_CONTAINER_EXTN = new Set(['xlsx', 'xlsm', 'docx', 'docm', 'pptx', 'pptm'])\n\n/**\n * Register an audio media part + relationship for each slide-transition start sound\n * (`transition.sound` with `data`/`path`), stamping the assigned relationship id onto\n * `transition._sndRId` for the `p:sndAc/p:snd r:embed`. Runs before media encoding so\n * the bytes are loaded; idempotent (skips a sound already registered) so re-export is\n * safe. The stop-previous form (`sound.stopPrevious`) needs no part and is skipped.\n */\nfunction registerTransitionSounds(slides: PresSlideInternal[]): void {\n\tslides.forEach((slide) => {\n\t\tconst transition = slide.transition\n\t\tconst sound = transition?.sound\n\t\tif (!sound || sound.stopPrevious || typeof transition._sndRId === 'number') return\n\t\tif (!sound.data && !sound.path) return\n\n\t\t// Derive the file extension from the data-URI mime, else the path, defaulting to wav.\n\t\t// The mime's subtype is not itself an extension for the spellings PowerPoint actually\n\t\t// uses (`audio/x-wav` for a transition sound), so it goes through the mapping rather\n\t\t// than into the filename raw — see `audioExtensionForSubtype`.\n\t\tconst dataMime = /audio\\/([\\w.-]+)[;,]/.exec(sound.data ?? '')\n\t\tconst pathFile = sound.path ? ((sound.path.split('/').pop() ?? '').split('?')[0] ?? '') : ''\n\t\tconst extn = dataMime\n\t\t\t? audioExtensionForSubtype(dataMime[1] ?? '')\n\t\t\t: (pathFile.split('.').pop() ?? 'wav').toLowerCase()\n\n\t\tconst rId = getNewRelId(slide)\n\t\tconst mediaSlideKey =\n\t\t\tslide._slideNum == null ? 'sm' : slide._slideNum >= 1000 ? `sl-${slide._slideNum}` : slide._slideNum\n\t\tslide._relsMedia.push({\n\t\t\tpath: sound.path ?? `preencoded.${extn}`,\n\t\t\ttype: `audio/${extn}`,\n\t\t\textn,\n\t\t\tdata: sound.data ?? '',\n\t\t\trId,\n\t\t\tTarget: `../media/audio-${mediaSlideKey}-${slide._relsMedia.length + 1}.${extn}`,\n\t\t})\n\t\ttransition._sndRId = rId\n\t})\n}\n\n/**\n * Create all chart and media rels for this Presentation\n * @param {PresSlideInternal | SlideLayoutInternal} slide - slide with rels\n * @param {ZipWriter} zip - zip writer\n * @param {Promise<string>[]} chartPromises - promise array\n */\nfunction createChartMediaRels(\n\tslide: PresSlideInternal | SlideLayoutInternal,\n\tzip: ZipWriter,\n\tchartPromises: Promise<string>[]\n): void {\n\tslide._relsChart.forEach((rel) => chartPromises.push(createExcelWorksheet(rel, zip)))\n\tslide._relsMedia.forEach((rel) => {\n\t\tif (rel.type !== 'online' && rel.type !== 'hyperlink') {\n\t\t\t// A: Loop vars\n\t\t\tlet data: string = rel.data && typeof rel.data === 'string' ? rel.data : ''\n\n\t\t\t// B: Users will undoubtedly pass various string formats, so correct prefixes as needed\n\t\t\tif (!data.includes(',') && !data.includes(';')) data = 'image/png;base64,' + data\n\t\t\telse if (!data.includes(',')) data = 'image/png;base64,' + data\n\t\t\telse if (!data.includes(';')) data = 'image/png;' + data\n\n\t\t\t// C: Add media. fflate needs decoded bytes (no base64 convenience), so\n\t\t\t// decode the payload here. Already-compressed formats (JPEG/PNG/video/…)\n\t\t\t// gain ~nothing from DEFLATE, so STORE them to avoid wasted compression\n\t\t\t// CPU on large decks; other parts inherit global compression.\n\t\t\tconst bytes = decodeBase64ToBytes(data)\n\t\t\tif (!bytes) return\n\t\t\tconst extn = (rel.extn || rel.Target.split('.').pop() || '').toLowerCase()\n\t\t\tzip.add(rel.Target.replace('..', 'ppt'), bytes, {\n\t\t\t\tstore: ALREADY_COMPRESSED_MEDIA_EXTN.has(extn) || ZIP_CONTAINER_EXTN.has(extn),\n\t\t\t})\n\t\t}\n\t})\n}\n\n/**\n * One emitted OOXML package part, before zipping: its slash-path, already-encoded bytes, and\n * whether it is added with `store` (DEFLATE skipped — already-compressed media/fonts). This is\n * the build-side seam {@link buildPackageParts} returns and {@link zipPackageParts} consumes;\n * the `store` hint is an fflate-era zip optimization kept internal so re-zipping stays\n * byte-identical. A public parts API exposes only `{ path, data }`.\n */\ninterface InternalPackagePart {\n\treadonly path: string\n\treadonly data: Uint8Array\n\treadonly store: boolean\n}\n\n/**\n * Assemble every package part for `source` and return them in emission order, without zipping.\n * This runs the transition-sound registration, media encode, cross-deck media de-dup,\n * chart-part-id assignment, placeholder backfill, and measured-fit passes before the synchronous\n * XML pass reads slide state. The bytes are the same the ZIP writer would compress; splitting the\n * assembly from the zip lets the byte-identity harness (and a future parts API) read parts\n * directly. Only `onMediaError` is meaningful here — compression/output shape are zip concerns\n * handled by {@link zipPackageParts}.\n */\nexport async function buildPackageParts(\n\tsource: PackageSource,\n\tprops: { onMediaError?: WriteProps['onMediaError'] }\n): Promise<InternalPackagePart[]> {\n\tconst pres = source.presentation\n\tconst arrChartPromises: Promise<string>[] = []\n\tconst zip = new ZipWriter()\n\n\t// STEP 0: Register transition-sound media parts/rels before encoding picks them up.\n\tregisterTransitionSounds(pres.slides)\n\n\t// STEP 1: Read/Encode all Media before zip as base64 content, etc. is required\n\tconst onMediaError = props.onMediaError ?? 'throw'\n\tconst mediaTargets = [...pres.slides, ...pres.slideLayouts, pres.masterSlide]\n\n\t// STEP 2: Wait for media (if any) then generate the PPTX file\n\treturn await encodeMediaForTargets(mediaTargets, source.runtime, onMediaError).then(async () => {\n\t\t// PERF: Collapse identical media to a single package part across the entire deck.\n\t\t// Each target (slide/layout/master) namespaces its media `Target` by slide, so the\n\t\t// same image used on multiple slides — or loaded from the same path — otherwise\n\t\t// embeds one copy per use. By now `encodeSlideMediaRels` has populated every\n\t\t// `rel.data`, so we can point later duplicates at the first occurrence's `Target`\n\t\t// (slide `.rels` reference media by rId, and sharing a part across slides is valid\n\t\t// OOXML). This subsumes the per-slide path/data de-dup for cross-slide reuse and\n\t\t// also covers background images.\n\t\tconst canonicalMediaTargets = new Map<string, string>()\n\t\tfor (const target of [...pres.slides, ...pres.slideLayouts, pres.masterSlide]) {\n\t\t\tfor (const rel of target._relsMedia || []) {\n\t\t\t\tif (rel.type === 'online' || rel.type === 'hyperlink' || typeof rel.data !== 'string' || !rel.data) continue\n\t\t\t\t// OLE payloads are exempt: PowerPoint gives every embedded object its own part, and\n\t\t\t\t// collapsing two identical ones would make editing either rewrite the other's source.\n\t\t\t\tif (rel.oleRelType) continue\n\t\t\t\t// Key on extension + bytes so identical content with differing part\n\t\t\t\t// extensions is never merged into one mistyped file.\n\t\t\t\tconst key = (rel.extn || '') + '\\0' + rel.data\n\t\t\t\tconst canonical = canonicalMediaTargets.get(key)\n\t\t\t\tif (canonical) rel.Target = canonical\n\t\t\t\telse canonicalMediaTargets.set(key, rel.Target)\n\t\t\t}\n\t\t}\n\n\t\t// DETERMINISM: Assign chart part filenames from a per-presentation counter here,\n\t\t// at write time, so two identical decks built in one process produce byte-identical\n\t\t// packages. Chart parts share one `ppt/charts/` namespace across slides, layouts, and\n\t\t// the master, so the id must be package-wide; `addChartDefinition` only sets a\n\t\t// target-local placeholder. This is the authoritative assignment consumed by content\n\t\t// types, slide rels, and the chart/embedding parts below — all emitted after this pass.\n\t\t// A never-reset module global in `gen/define/chart.ts` previously drove this — same\n\t\t// input, different bytes. `gen/chart/chartex-xml.ts` derives its series GUIDs from\n\t\t// the id assigned here, so both depend on this pass staying authoritative.\n\t\tlet chartPartIdx = 0\n\t\tfor (const target of [...pres.slides, ...pres.slideLayouts, pres.masterSlide]) {\n\t\t\tfor (const rel of target._relsChart || []) {\n\t\t\t\tconst chartId = ++chartPartIdx\n\t\t\t\trel.globalId = chartId\n\t\t\t\t// chartEx charts share the `ppt/charts/` namespace but use the `chartEx{N}.xml` name.\n\t\t\t\t// The single shared counter keeps every chart part name globally unique regardless of\n\t\t\t\t// prefix, so classic and chartEx parts never collide.\n\t\t\t\tconst chartBase = rel.isChartEx ? `chartEx${chartId}` : `chart${chartId}`\n\t\t\t\trel.fileName = `${chartBase}.xml`\n\t\t\t\trel.Target = `/ppt/charts/${chartBase}.xml`\n\t\t\t}\n\t\t}\n\n\t\t// A: Backfill inherited layout placeholders, then bake a real fontScale onto\n\t\t// `fit:'shrink'` text boxes when font metrics are registered — both before the\n\t\t// sync XML pass reads them. Shared with `extractSlides` (see `gen/prepare.ts`).\n\t\tbakeSlideContent(pres.slides, source.fontMetrics)\n\n\t\t// B: Add all required files. fflate keys on full slash-paths and emits no\n\t\t// directory entries, so there is no folder scaffolding to set up (and no\n\t\t// stray empty-directory entries to guard against on minimal decks).\n\t\tconst hasCustomProps = source.customProperties.length > 0\n\t\tzip.add(\n\t\t\t'[Content_Types].xml',\n\t\t\tmakeXmlContTypes(pres.slides, pres.slideLayouts, pres.masterSlide, hasCustomProps, pres.embeddedFonts)\n\t\t)\n\t\tzip.add('_rels/.rels', makeXmlRootRels(hasCustomProps))\n\t\tzip.add('docProps/app.xml', makeXmlApp(pres.slides, pres.company))\n\t\tzip.add('docProps/core.xml', makeXmlCore(pres.title, pres.subject, pres.author, pres.revision))\n\t\tif (hasCustomProps) {\n\t\t\tzip.add('docProps/custom.xml', makeXmlCustomProperties(source.customProperties))\n\t\t}\n\t\tzip.add('ppt/_rels/presentation.xml.rels', makeXmlPresentationRels(pres.slides, pres.embeddedFonts))\n\t\t// Embedded font parts (raw whole faces). Fonts are already compact binary, so STORE\n\t\t// (no DEFLATE) like already-compressed media. Part index matches the rels Target above.\n\t\tfor (const face of flattenEmbeddedFaces(pres.embeddedFonts, 1)) {\n\t\t\tzip.add(`ppt/fonts/font${face.partIndex}.fntdata`, face.bytes, { store: true })\n\t\t}\n\t\tzip.add('ppt/theme/theme1.xml', makeXmlTheme(pres))\n\t\t// emit a separate theme2.xml part so notesMaster1.xml.rels resolves\n\t\tzip.add('ppt/theme/theme2.xml', makeXmlTheme(pres))\n\t\tzip.add('ppt/presentation.xml', makeXmlPresentation(pres))\n\t\tzip.add('ppt/presProps.xml', makeXmlPresProps())\n\t\tzip.add('ppt/tableStyles.xml', makeXmlTableStyles())\n\t\tzip.add('ppt/viewProps.xml', makeXmlViewProps())\n\n\t\t// C: Create a Layout/Master/Rel/Slide file for each SlideLayout and Slide\n\t\tpres.slideLayouts.forEach((layout, idx) => {\n\t\t\tzip.add(`ppt/slideLayouts/slideLayout${idx + 1}.xml`, makeXmlLayout(layout))\n\t\t\tzip.add(\n\t\t\t\t`ppt/slideLayouts/_rels/slideLayout${idx + 1}.xml.rels`,\n\t\t\t\tmakeXmlSlideLayoutRel(idx + 1, pres.slideLayouts)\n\t\t\t)\n\t\t})\n\t\tpres.slides.forEach((slide, idx) => {\n\t\t\tzip.add(`ppt/slides/slide${idx + 1}.xml`, makeXmlSlide(slide))\n\t\t\tzip.add(`ppt/slides/_rels/slide${idx + 1}.xml.rels`, makeXmlSlideRel(pres.slides, pres.slideLayouts, idx + 1))\n\t\t\t// Create all slide notes related items. Notes of empty strings are created for slides which do not have notes specified, to keep track of _rels.\n\t\t\tzip.add(`ppt/notesSlides/notesSlide${idx + 1}.xml`, makeXmlNotesSlide(slide))\n\t\t\tzip.add(`ppt/notesSlides/_rels/notesSlide${idx + 1}.xml.rels`, makeXmlNotesSlideRel(slide, idx + 1))\n\t\t})\n\t\tzip.add('ppt/slideMasters/slideMaster1.xml', makeXmlMaster(pres.masterSlide, pres.slideLayouts))\n\t\tzip.add('ppt/slideMasters/_rels/slideMaster1.xml.rels', makeXmlMasterRel(pres.masterSlide, pres.slideLayouts))\n\t\tzip.add('ppt/notesMasters/notesMaster1.xml', makeXmlNotesMaster())\n\t\tzip.add('ppt/notesMasters/_rels/notesMaster1.xml.rels', makeXmlNotesMasterRel())\n\n\t\t// C.1: Comments — resolve the deck-wide author registry once, then emit the shared\n\t\t// commentAuthors part plus a per-slide comment part for each slide that has comments.\n\t\tconst resolvedComments = resolveCommentAuthors(pres.slides)\n\t\tif (resolvedComments.authors.length > 0) {\n\t\t\tzip.add('ppt/commentAuthors.xml', makeXmlCommentAuthors(resolvedComments.authors))\n\t\t\tpres.slides.forEach((slide, idx) => {\n\t\t\t\tif ((slide._comments || []).length > 0) {\n\t\t\t\t\tzip.add(`ppt/comments/comment${idx + 1}.xml`, makeXmlComments(slide, resolvedComments.meta))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// D: Create all Rels (images, media, chart data)\n\t\tpres.slideLayouts.forEach((layout) => {\n\t\t\tcreateChartMediaRels(layout, zip, arrChartPromises)\n\t\t})\n\t\tpres.slides.forEach((slide) => {\n\t\t\tcreateChartMediaRels(slide, zip, arrChartPromises)\n\t\t})\n\t\tcreateChartMediaRels(pres.masterSlide, zip, arrChartPromises)\n\n\t\t// E: Wait for the chart-embed Promises (if any), then snapshot the accumulated\n\t\t// parts in emission order. Zipping is deferred to `zipPackageParts`.\n\t\treturn await Promise.all(arrChartPromises).then(() => zip.entries())\n\t})\n}\n\n/**\n * Zip an ordered list of package parts into the output shape `props.outputType` selects. Re-adds\n * each part to a fresh {@link ZipWriter} in order — preserving each part's `store` hint — so the\n * archive is byte-identical to assembling straight into one writer. Compression and output type\n * are the only zip-level knobs; part assembly happened in {@link buildPackageParts}.\n */\nasync function zipPackageParts(\n\tparts: InternalPackagePart[],\n\tprops: WriteProps\n): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\tconst zip = new ZipWriter()\n\tfor (const part of parts) zip.add(part.path, part.data, { store: part.store })\n\n\tconst compression = props.compression !== false\n\tif (props.outputType === 'STREAM') {\n\t\t// A: stream file\n\t\treturn await zip.generate('nodebuffer', { compression })\n\t} else if (props.outputType) {\n\t\t// B: Node [fs]: Output type user option or default\n\t\treturn await zip.generate(props.outputType, { compression })\n\t} else {\n\t\t// C: Browser: Output blob as app/ms-pptx\n\t\treturn await zip.generate('blob', { compression })\n\t}\n}\n\n/**\n * Assemble every package part for `source` and zip it into the output shape `props.outputType`\n * selects. Thin composition of {@link buildPackageParts} (the assembly pipeline) and\n * {@link zipPackageParts} (the zip pass), kept as the stable entry point the authoring class calls.\n */\nexport async function writePackage(\n\tsource: PackageSource,\n\tprops: WriteProps\n): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\treturn await zipPackageParts(await buildPackageParts(source, props), props)\n}\n","/**\n * ts-pptx: the presentation core\n *\n * Home of {@link PresentationCore}, the class every entry point subclasses with a runtime\n * adapter (`index.ts`, `node.ts`, `browser.ts`). See the class doc below for the layout of\n * its body and where package assembly actually happens.\n *\n * Units: this library takes user coordinates in inches and converts to EMU on output — see\n * `units.ts` for the conversions and `STANDARD_LAYOUTS` for the built-in slide sizes.\n *\n * Derived from PptxGenJS (C) 2015-present Brent Ely (MIT), which in turn took some code from\n * the OfficeGen project (Copyright 2013 Ziv Barber). This project is likewise MIT; the full\n * license text is in `LICENSE` at the repository root.\n */\n\nimport { warn } from './diagnostics.js'\nimport { InternalError, InvalidOptionError } from './errors.js'\nimport SlideBuilder from './slide.js'\nimport { SlideObjectType } from './enums.js'\nimport { DEF_PRES_LAYOUT, DEF_PRES_LAYOUT_NAME, DEF_SLIDE_MARGIN_IN } from './constants-internal.js'\nimport type {\n\tAddSlideProps,\n\tCustomPropertyValue,\n\tMeasureTextOptions,\n\tOverflowBoxOptions,\n\tPresLayout,\n\tSectionProps,\n\tSlideLayout,\n\tPackagePart,\n\tPartsProps,\n\tSlideMasterProps,\n\tSlideNumberProps,\n\tTableLayoutResult,\n\tTableProps,\n\tTableRow,\n\tTextMeasurement,\n\tTextProps,\n\tThemeProps,\n\tWriteBaseProps,\n\tWriteFileProps,\n\tWriteProps,\n} from './types/index.js'\nimport type {\n\tPresentationPropsInternal,\n\tPresSlideInternal,\n\tSectionInternalProps,\n\tSlideLayoutInternal,\n} from './types/internal.js'\nimport type { Slide } from './types/slide.js'\nimport type { RuntimeAdapter } from './runtime/types.js'\nimport { FontMetricsRegistry, parseFontMetrics } from './measure/font-metrics.js'\nimport { type EmbeddedFont, type EmbeddedFontSlot, EMBEDDED_FONT_SLOTS } from './embedded-fonts.js'\nimport { measureText } from './measure/fit.js'\nimport { computeTableLayout } from './measure/table-fit.js'\nimport { getUuid, isHyperlinkRel } from './gen/utils.js'\nimport { decodeBase64ToBytes } from './media/base64.js'\nimport { avContentType, imageContentType } from './media/content-type.js'\nimport { inchesToEmu, STANDARD_LAYOUTS, type StandardLayout } from './units.js'\nimport type { ExtractedSlide, ExtractedSlides } from './read/api/presentation-types.js'\n\nimport { makeXmlCharts } from './gen/chart/chart-xml.js'\nimport { buildEmbeddedWorksheet } from './gen/chart/embed-xlsx.js'\nimport { addBackgroundDefinition } from './gen/define/background.js'\nimport { createSlideMaster } from './gen/define/master.js'\nimport { bakeSlideContent, encodeMediaForTargets } from './gen/prepare.js'\nimport { makeXmlSlide } from './gen/slide/slide.js'\nimport { buildNotesSlideRels, makeXmlNotesMaster, makeXmlNotesSlide } from './gen/slide/notes.js'\nimport { makeXmlTheme } from './gen/pres/theme.js'\nimport { buildPackageParts, writePackage, type PackageSource } from './package/assemble.js'\n\nconst VERSION = '3.2.0'\n\nfunction standardLayoutToPresLayout(layout: StandardLayout): PresLayout {\n\treturn {\n\t\tname: layout.name,\n\t\twidth: layout.widthEmu,\n\t\theight: layout.heightEmu,\n\t}\n}\n\n/**\n * Main presentation class and package export flow — the public entry point consumers\n * instantiate (`new TsPptx()`). Owns presentation-level state and metadata, collects\n * slides, and drives `write`/`writeFile`/`stream`. The actual OOXML string building is\n * delegated to the `gen-*` modules; runtime file/stream output goes through the injected\n * `RuntimeAdapter`. Enums (`AlignH`, `ChartType`, `ShapeType`, …) are imported from the\n * package entry, not read off the instance.\n *\n * Rough layout of the class body:\n * - Metadata accessors layout / author / company / title / theme / sections getters+setters\n * - Private slide helpers addNewSlide, getSlide, setSlideNumber\n * - Public export methods stream / write / writeFile — delegate packaging to `writePackage`\n * - Public authoring methods addSlide / defineLayout / defineSlideMaster / defineTableStyle\n *\n * Package assembly (`[Content_Types].xml`, the rels graph, per-part XML, the ZIP) lives in\n * `package/assemble.ts`; this class provides the deck state via {@link PresentationCore.packageSource}.\n * The live-DOM `tableToSlides()` is NOT here — it is added by the browser entry subclass\n * (`browser.ts`) so it stays out of the Node build and out of the core chunk.\n */\nexport default class PresentationCore {\n\t// Property getters/setters\n\n\t/**\n\t * Presentation layout name\n\t * Standard layouts:\n\t * - 'LAYOUT_4x3' (10\" x 7.5\")\n\t * - 'LAYOUT_16x9' (10\" x 5.625\")\n\t * - 'LAYOUT_16x10' (10\" x 6.25\")\n\t * - 'LAYOUT_WIDE' (13.333\" x 7.5\")\n\t * Custom layouts:\n\t * Use `pptx.defineLayout()` to create custom layouts (e.g.: 'A4')\n\t * @type {string}\n\t * @see https://support.office.com/en-us/article/Change-the-size-of-your-slides-040a811c-be43-40b9-8d04-0de5ed79987e\n\t */\n\tprivate _layout: string = DEF_PRES_LAYOUT\n\tpublic set layout(value: string | StandardLayout) {\n\t\t// Accept either a layout key string or a STANDARD_LAYOUTS preset object directly.\n\t\tconst layoutKey = typeof value === 'string' ? value : value?.layout\n\t\tconst newLayout: PresLayout | undefined = layoutKey ? this.LAYOUTS[layoutKey] : undefined\n\n\t\tif (newLayout) {\n\t\t\tthis._layout = layoutKey\n\t\t\tthis._presLayout = newLayout\n\t\t} else {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'layout/unknown',\n\t\t\t\t`Unknown layout ${JSON.stringify(layoutKey)}; pass a registered layout name (see LAYOUTS) or a STANDARD_LAYOUTS preset`\n\t\t\t)\n\t\t}\n\t}\n\n\tpublic get layout(): string {\n\t\treturn this._layout\n\t}\n\n\t/**\n\t * ts-pptx Library Version\n\t */\n\tprivate readonly _version: string = VERSION\n\tpublic get version(): string {\n\t\treturn this._version\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _author: string\n\tpublic set author(value: string) {\n\t\tthis._author = value\n\t}\n\n\tpublic get author(): string {\n\t\treturn this._author\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _company: string\n\tpublic set company(value: string) {\n\t\tthis._company = value\n\t}\n\n\tpublic get company(): string {\n\t\treturn this._company\n\t}\n\n\t/**\n\t * @type {string}\n\t * @note the `revision` value must be a whole number only (without \".\" or \",\" - otherwise, PPT will throw errors upon opening!)\n\t */\n\tprivate _revision: string\n\tpublic set revision(value: string) {\n\t\tthis._revision = value\n\t}\n\n\tpublic get revision(): string {\n\t\treturn this._revision\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _subject: string\n\tpublic set subject(value: string) {\n\t\tthis._subject = value\n\t}\n\n\tpublic get subject(): string {\n\t\treturn this._subject\n\t}\n\n\t/**\n\t * @type {ThemeProps}\n\t */\n\tprivate _theme: ThemeProps = {}\n\tpublic set theme(value: ThemeProps) {\n\t\tthis._theme = value\n\t}\n\n\tpublic get theme(): ThemeProps {\n\t\treturn this._theme\n\t}\n\n\t/**\n\t * @type {string}\n\t */\n\tprivate _title: string\n\tpublic set title(value: string) {\n\t\tthis._title = value\n\t}\n\n\tpublic get title(): string {\n\t\treturn this._title\n\t}\n\n\t/** Slide number shown on the first slide (maps to firstSlideNum in presentation.xml) */\n\tprivate _firstSlideNum: number\n\tpublic set firstSlideNum(value: number) {\n\t\tthis._firstSlideNum = value\n\t}\n\n\tpublic get firstSlideNum(): number {\n\t\treturn this._firstSlideNum\n\t}\n\n\t/**\n\t * Whether Right-to-Left (RTL) mode is enabled\n\t * @type {boolean}\n\t */\n\tprivate _rtlMode: boolean\n\tpublic set rtlMode(value: boolean) {\n\t\tthis._rtlMode = value\n\t}\n\n\tpublic get rtlMode(): boolean {\n\t\treturn this._rtlMode\n\t}\n\n\t/** master slide layout object */\n\tprivate readonly _masterSlide: PresSlideInternal\n\tpublic get masterSlide(): Slide {\n\t\treturn this._masterSlide\n\t}\n\n\t/** this Presentation's Slide objects */\n\tprivate readonly _slides: PresSlideInternal[]\n\tpublic get slides(): Slide[] {\n\t\treturn this._slides\n\t}\n\n\t/** this Presentation's sections */\n\tprivate readonly _sections: SectionInternalProps[]\n\tpublic get sections(): SectionProps[] {\n\t\treturn this._sections\n\t}\n\n\t/** custom document properties stored in docProps/custom.xml */\n\tprivate _customProperties: Array<{ name: string; value: CustomPropertyValue }>\n\n\t/**\n\t * slide layout definition objects, used for generating slide layout files.\n\t * `protected` (not `private`) so the browser entry subclass can resolve\n\t * `tableToSlides({ masterTitle })` against them — that method lives on the\n\t * browser build only (it reads a live DOM), see `browser.ts`.\n\t */\n\tprotected readonly _slideLayouts: SlideLayoutInternal[]\n\tpublic get slideLayouts(): SlideLayout[] {\n\t\treturn this._slideLayouts\n\t}\n\n\tprivate get internalPresentation(): PresentationPropsInternal {\n\t\treturn {\n\t\t\tauthor: this.author,\n\t\t\tcompany: this.company,\n\t\t\tfirstSlideNum: this.firstSlideNum,\n\t\t\tlayout: this.layout,\n\t\t\tmasterSlide: this._masterSlide,\n\t\t\tpresLayout: this.presLayout,\n\t\t\trevision: this.revision,\n\t\t\trtlMode: this.rtlMode,\n\t\t\tsections: this._sections,\n\t\t\tslideLayouts: this._slideLayouts,\n\t\t\tslides: this._slides,\n\t\t\tsubject: this.subject,\n\t\t\ttheme: this.theme,\n\t\t\ttitle: this.title,\n\t\t\tembeddedFonts: this._embeddedFonts,\n\t\t}\n\t}\n\n\tprivate LAYOUTS: { [key: string]: PresLayout }\n\n\tprivate _presLayout: PresLayout\n\tpublic get presLayout(): PresLayout {\n\t\treturn this._presLayout\n\t}\n\n\tprivate readonly _runtime: RuntimeAdapter\n\n\t/** Write-side font metrics for measured text fit (`fit:'shrink'`). @see registerFontMetrics */\n\tprivate readonly _fontMetrics = new FontMetricsRegistry()\n\n\t/** Author-side embedded font faces, accumulated by {@link embedFont} and emitted at write time. */\n\tprivate readonly _embeddedFonts: EmbeddedFont[] = []\n\n\tconstructor(runtime: RuntimeAdapter) {\n\t\tthis._runtime = runtime\n\t\t// Set available layouts\n\t\tthis.LAYOUTS = {\n\t\t\tLAYOUT_4x3: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_4x3),\n\t\t\tLAYOUT_16x9: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_16x9),\n\t\t\tLAYOUT_16x10: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_16x10),\n\t\t\tLAYOUT_WIDE: standardLayoutToPresLayout(STANDARD_LAYOUTS.LAYOUT_WIDE),\n\t\t}\n\n\t\t// Core\n\t\tthis._author = 'ts-pptx'\n\t\tthis._company = 'ts-pptx'\n\t\tthis._revision = '1' // Note: Must be a whole number\n\t\tthis._subject = 'ts-pptx Presentation'\n\t\tthis._title = 'ts-pptx Presentation'\n\t\t// ts-pptx props\n\t\tconst defLayout = this.LAYOUTS[DEF_PRES_LAYOUT]\n\t\tif (!defLayout)\n\t\t\tthrow new InternalError(\n\t\t\t\t'layout/default-not-registered',\n\t\t\t\t`Default presentation layout \"${DEF_PRES_LAYOUT}\" is not registered`\n\t\t\t)\n\t\tthis._presLayout = {\n\t\t\tname: defLayout.name,\n\t\t\t_sizeW: defLayout.width,\n\t\t\t_sizeH: defLayout.height,\n\t\t\twidth: defLayout.width,\n\t\t\theight: defLayout.height,\n\t\t}\n\t\tthis._firstSlideNum = 1\n\t\tthis._rtlMode = false\n\t\t//\n\t\tthis._slideLayouts = [\n\t\t\t{\n\t\t\t\t_margin: DEF_SLIDE_MARGIN_IN,\n\t\t\t\t_name: DEF_PRES_LAYOUT_NAME,\n\t\t\t\t_presLayout: this._presLayout,\n\t\t\t\t_rels: [],\n\t\t\t\t_relsChart: [],\n\t\t\t\t_relsMedia: [],\n\t\t\t\t_slide: null,\n\t\t\t\t_slideNum: 1000,\n\t\t\t\t_slideNumberProps: null,\n\t\t\t\t_slideObjects: [],\n\t\t\t},\n\t\t]\n\t\tthis._slides = []\n\t\tthis._sections = []\n\t\tthis._customProperties = []\n\t\tthis._masterSlide = {\n\t\t\taddChart: null,\n\t\t\taddComment: null,\n\t\t\taddConnector: null,\n\t\t\taddImage: null,\n\t\t\taddMedia: null,\n\t\t\taddNotes: null,\n\t\t\taddShape: null,\n\t\t\taddTable: null,\n\t\t\taddText: null,\n\t\t\taddAnimation: null,\n\t\t\t//\n\t\t\t_name: null,\n\t\t\t_animations: [],\n\t\t\t_presLayout: this._presLayout,\n\t\t\t_rId: null,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slideId: null,\n\t\t\t_slideLayout: null,\n\t\t\t_slideNum: null,\n\t\t\t_slideNumberProps: null,\n\t\t\t_slideObjects: [],\n\t\t\t// Deliberately-partial internal stub: the master slide carries only rels/objects,\n\t\t\t// so its authoring methods and ids are intentionally null (never invoked on the master).\n\t\t} as unknown as PresSlideInternal\n\t}\n\n\t/**\n\t * Provides an API for `addTableDefinition` to create slides as needed for auto-paging\n\t * @param {AddSlideProps} options - slide masterTitle and/or sectionTitle\n\t * @return {Slide} new Slide\n\t */\n\tprivate readonly addNewSlide = (options?: AddSlideProps): PresSlideInternal => {\n\t\tconst nextOptions = options || {}\n\t\t// Preserve the originating slide's section for all auto-paged continuation slides.\n\t\t// Search for the section that owns the current last slide rather than assuming it is\n\t\t// the last section — the originating slide may not be at the tail of the deck.\n\t\tconst lastSlide = this._slides[this._slides.length - 1]\n\t\tconst sourceSection = this._sections.find((sect) => sect._slides.some((s) => s._slideNum === lastSlide?._slideNum))\n\t\tnextOptions.sectionTitle = sourceSection?.title ?? undefined\n\n\t\treturn this.addSlide(nextOptions) as PresSlideInternal\n\t}\n\n\t/**\n\t * Provides an API for `addTableDefinition` to get slide reference by number\n\t * @param {number} slideNum - slide number\n\t * @return {Slide} Slide\n\t */\n\tprivate readonly getSlide = (slideNum: number): PresSlideInternal | undefined =>\n\t\tthis._slides.find((slide) => slide._slideNum === slideNum)\n\n\t/**\n\t * Provides the live section list to the `Slide` class so Section/Summary Zoom can resolve\n\t * a section title to its stable GUID and enumerate sections in order.\n\t * @return {SectionInternalProps[]} the presentation's sections\n\t */\n\tprivate readonly getSections = (): SectionInternalProps[] => this._sections\n\n\t/**\n\t * Enables the `Slide` class to set ts-pptx [Presentation] master/layout slidenumbers\n\t * @param {SlideNumberProps} slideNum - slide number config\n\t */\n\tprivate readonly setSlideNumber = (slideNum: SlideNumberProps): void => {\n\t\t// 1: Add slideNumber to slideMaster1.xml\n\t\tthis._masterSlide._slideNumberProps = slideNum\n\n\t\t// 2: Add slideNumber to DEF_PRES_LAYOUT_NAME layout\n\t\tconst defLayout = this._slideLayouts.find((layout) => layout._name === DEF_PRES_LAYOUT_NAME)\n\t\tif (defLayout) defLayout._slideNumberProps = slideNum\n\t}\n\n\t/**\n\t * Assemble the slice of internal state the packaging layer reads. `PresentationCore` owns the\n\t * authored deck; `writePackage` (in `package/assemble.ts`) turns it into OOXML parts.\n\t */\n\tprivate packageSource(): PackageSource {\n\t\treturn {\n\t\t\truntime: this._runtime,\n\t\t\tpresentation: this.internalPresentation,\n\t\t\tcustomProperties: this._customProperties,\n\t\t\tfontMetrics: this._fontMetrics,\n\t\t}\n\t}\n\n\t/**\n\t * Author + serialize this presentation's slides as injectable descriptors,\n\t * WITHOUT producing a `.pptx` package. Runs the same media-encode, placeholder\n\t * backfill, and measured-fit passes `write()` uses, then serializes each slide\n\t * body and resolves its image media to decoded bytes — so a loaded deck can\n\t * splice the slides in via `Presentation.appendSlides()` (see `ts-pptx/read`)\n\t * while keeping its own masters/layouts/theme byte-identical.\n\t *\n\t * Returns the deck's slide size (EMU, for the destination size check) and one\n\t * descriptor per authored slide. Charts, audio/video media, online media, and\n\t * internal slide-to-slide hyperlinks are surfaced as descriptors alongside the\n\t * serialized body — this method does not resolve them into a package; the append\n\t * path consumes each descriptor to reserve the parts and rebuild the rel graph.\n\t */\n\textractSlides = async (opts: { onMediaError?: 'throw' | 'placeholder' } = {}): Promise<ExtractedSlides> => {\n\t\tconst onMediaError = opts.onMediaError ?? 'throw'\n\n\t\t// STEP 1+2: The same pre-serialization pass `buildPackageParts` runs — encode media,\n\t\t// backfill placeholders, bake measured fit — so extracted bodies match a normal write\n\t\t// by construction rather than by keeping two copies in step. See `gen/prepare.ts`.\n\t\t// Only slides here: this method emits no layout or master parts.\n\t\tawait encodeMediaForTargets(this._slides, this._runtime, onMediaError)\n\t\tbakeSlideContent(this._slides, this._fontMetrics)\n\n\t\t// STEP 3: Serialize each slide body and resolve its image media to bytes.\n\t\tconst slides: ExtractedSlide[] = this._slides.map((slide) => {\n\t\t\tconst relByRid = new Map(slide._relsMedia.map((rel) => [rel.rId, rel] as const))\n\n\t\t\t// Embedded audio/video. addMedia (`gen/define/media.ts`) pushes three consecutive\n\t\t\t// _relsMedia entries per item off `mediaRid`: the ECMA audio/video rel\n\t\t\t// (rId=mediaRid), the MS-2007 `media` rel (mediaRid+1, sharing one Target),\n\t\t\t// and the preview image rel (mediaRid+2). The body references all three; we\n\t\t\t// surface the descriptor so appendSlides can reproduce the rel graph. Online\n\t\t\t// media (external link) is excluded — it has a different rel shape and no part.\n\t\t\tconst avPreviewRids = new Set<number>()\n\t\t\tconst avMedia = slide._slideObjects\n\t\t\t\t.filter(\n\t\t\t\t\t(obj) => obj._type === SlideObjectType.media && obj.mtype !== 'online' && typeof obj.mediaRid === 'number'\n\t\t\t\t)\n\t\t\t\t.map((obj) => {\n\t\t\t\t\tconst mtype: 'audio' | 'video' = obj.mtype === 'audio' ? 'audio' : 'video'\n\t\t\t\t\tconst mediaRid = obj.mediaRid as number\n\t\t\t\t\tconst mediaRel = relByRid.get(mediaRid)\n\t\t\t\t\tconst previewRel = relByRid.get(mediaRid + 2)\n\t\t\t\t\tif (!mediaRel || !previewRel) return null\n\t\t\t\t\tconst mediaBytes = decodeBase64ToBytes(typeof mediaRel.data === 'string' ? mediaRel.data : '')\n\t\t\t\t\tconst previewBytes = decodeBase64ToBytes(typeof previewRel.data === 'string' ? previewRel.data : '')\n\t\t\t\t\tif (!mediaBytes || !previewBytes) return null\n\t\t\t\t\tconst mediaExtn = (mediaRel.extn || mediaRel.Target.split('.').pop() || 'mp4').toLowerCase()\n\t\t\t\t\tconst previewExtn = (previewRel.extn || previewRel.Target.split('.').pop() || 'png').toLowerCase()\n\t\t\t\t\tavPreviewRids.add(mediaRid + 2)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmtype,\n\t\t\t\t\t\tmediaRid,\n\t\t\t\t\t\tmsMediaRid: mediaRid + 1,\n\t\t\t\t\t\tpreviewRid: mediaRid + 2,\n\t\t\t\t\t\tmediaBytes,\n\t\t\t\t\t\tmediaExtn,\n\t\t\t\t\t\tmediaContentType: avContentType(mediaExtn, mtype),\n\t\t\t\t\t\tpreviewBytes,\n\t\t\t\t\t\tpreviewExtn,\n\t\t\t\t\t\tpreviewContentType: imageContentType(previewExtn),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n\n\t\t\tconst media = slide._relsMedia\n\t\t\t\t// A/V preview images live in _relsMedia as image rels too; they are carried\n\t\t\t\t// by their A/V descriptor, so exclude them from the plain-image media list.\n\t\t\t\t.filter((rel) => rel.type.toLowerCase().includes('image') && !avPreviewRids.has(rel.rId))\n\t\t\t\t.map((rel) => {\n\t\t\t\t\t// Normalize the base64 payload's data-URI prefix, mirroring createChartMediaRels.\n\t\t\t\t\tlet data: string = rel.data && typeof rel.data === 'string' ? rel.data : ''\n\t\t\t\t\tif (!data.includes(',') && !data.includes(';')) data = 'image/png;base64,' + data\n\t\t\t\t\telse if (!data.includes(',')) data = 'image/png;base64,' + data\n\t\t\t\t\telse if (!data.includes(';')) data = 'image/png;' + data\n\t\t\t\t\tconst bytes = decodeBase64ToBytes(data)\n\t\t\t\t\tconst extn = (rel.extn || rel.Target.split('.').pop() || 'png').toLowerCase()\n\t\t\t\t\treturn bytes ? { rId: rel.rId, bytes, extn, contentType: imageContentType(extn) } : null\n\t\t\t\t})\n\t\t\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n\n\t\t\t// Online (external-link) video. addMedia type:'online' pushes three rels off\n\t\t\t// mediaRid: the ECMA video rel (mediaRid, External), the MS-2007 media rel\n\t\t\t// (mediaRid+1, External, sharing the link Target), and the poster image rel\n\t\t\t// (mediaRid+2, carried by `media` below as a normal image). No media binary\n\t\t\t// part exists; appendSlides reproduces only the two external rels + poster.\n\t\t\tconst onlineMedia = slide._slideObjects\n\t\t\t\t.filter(\n\t\t\t\t\t(obj) => obj._type === SlideObjectType.media && obj.mtype === 'online' && typeof obj.mediaRid === 'number'\n\t\t\t\t)\n\t\t\t\t.map((obj) => {\n\t\t\t\t\tconst mediaRid = obj.mediaRid as number\n\t\t\t\t\tconst videoRel = relByRid.get(mediaRid)\n\t\t\t\t\tif (!videoRel || typeof videoRel.Target !== 'string' || !videoRel.Target) return null\n\t\t\t\t\treturn { mediaRid, msMediaRid: mediaRid + 1, link: videoRel.Target }\n\t\t\t\t})\n\t\t\t\t.filter((m): m is NonNullable<typeof m> => m !== null)\n\n\t\t\tconst hyperlinks = slide._rels\n\t\t\t\t.filter((rel) => isHyperlinkRel(rel) && rel.data !== 'slide')\n\t\t\t\t.map((rel) => ({ rId: rel.rId, target: rel.Target }))\n\n\t\t\t// Internal slide-to-slide links: rel.data === 'slide', rel.Target is the\n\t\t\t// 1-based source slide number (see addText's hyperlink.slide handling).\n\t\t\tconst slideLinks = slide._rels\n\t\t\t\t.filter((rel) => isHyperlinkRel(rel) && rel.data === 'slide')\n\t\t\t\t.map((rel) => ({ rId: rel.rId, sourceSlideNumber: Number(rel.Target) }))\n\n\t\t\t// Charts: serialize the chart part XML + its embedded workbook bytes. The\n\t\t\t// chart part's own .rels (workbook reference) is rebuilt on injection.\n\t\t\tconst charts = (slide._relsChart || []).map((rel) => ({\n\t\t\t\trId: rel.rId,\n\t\t\t\tchartXml: makeXmlCharts(rel),\n\t\t\t\tembeddingBytes: buildEmbeddedWorksheet(rel),\n\t\t\t}))\n\n\t\t\t// Speaker notes. makeXmlNotesSlide calls buildNotesSlideRels itself (and caches\n\t\t\t// on the slide), so the rels are read back afterwards rather than rebuilt — the\n\t\t\t// body and the rels file must agree on every hyperlink rId. Notes rels reserve\n\t\t\t// rId1=notesMaster and rId2=slide, both of which appendSlides wires itself.\n\t\t\tconst hasNotes = slide._slideObjects.some((obj) => obj._type === SlideObjectType.notes)\n\t\t\tconst notes = hasNotes\n\t\t\t\t? {\n\t\t\t\t\t\txml: makeXmlNotesSlide(slide),\n\t\t\t\t\t\thyperlinks: buildNotesSlideRels(slide)\n\t\t\t\t\t\t\t.filter((rel) => typeof rel.Target === 'string' && rel.Target)\n\t\t\t\t\t\t\t.map((rel) => ({ rId: rel.rId, target: rel.Target })),\n\t\t\t\t\t}\n\t\t\t\t: undefined\n\n\t\t\treturn {\n\t\t\t\txml: makeXmlSlide(slide),\n\t\t\t\tmedia,\n\t\t\t\thyperlinks,\n\t\t\t\tcharts,\n\t\t\t\tslideLinks,\n\t\t\t\tavMedia,\n\t\t\t\tonlineMedia,\n\t\t\t\t...(notes ? { notes } : {}),\n\t\t\t}\n\t\t})\n\n\t\t// Presentation-level embedded fonts (pptx.embedFont) ride alongside the slides\n\t\t// so appendSlides can carry them into the destination deck; same model the\n\t\t// write path serializes (see src/embedded-fonts.ts), passed through unchanged.\n\t\t// A notes slide must bind to a notes master, and a destination template commonly has\n\t\t// none (a deck authored without notes carries no notesMaster part). Ship ours so the\n\t\t// append path can install one; it is discarded when the destination already has one.\n\t\t// theme2.xml is what notesMaster1.xml.rels resolves to on the normal write path.\n\t\tconst notesMaster = slides.some((s) => s.notes)\n\t\t\t? { xml: makeXmlNotesMaster(), themeXml: makeXmlTheme(this.internalPresentation) }\n\t\t\t: undefined\n\n\t\treturn {\n\t\t\twidthEmu: this.presLayout.width,\n\t\t\theightEmu: this.presLayout.height,\n\t\t\tslides,\n\t\t\tembeddedFonts: this._embeddedFonts,\n\t\t\t...(notesMaster ? { notesMaster } : {}),\n\t\t}\n\t}\n\n\t// FONT METRICS (measured text fit)\n\n\t/**\n\t * Register a font's metrics so `fit:'shrink'` text boxes are measured and a real\n\t * `fontScale` is baked at export time (text renders pre-shrunk in headless\n\t * renderers and on plain file-open, with no manual edit/resize).\n\t *\n\t * Without registered metrics, `fit:'shrink'` keeps its current behavior (a bare\n\t * `<a:normAutofit/>` that only PowerPoint recomputes on edit). Register the same\n\t * face once per weight/style you use; bold/italic advances differ.\n\t * @param {string} face - font family name as used in `fontFace` (e.g. 'Aptos')\n\t * @param {string | Uint8Array | ArrayBuffer} source - font file path/URL (Node/web) or raw TTF/OTF bytes\n\t * @param {object} [opts] - variant flags; advances differ per weight/style\n\t * @example await pptx.registerFontMetrics('Aptos', '/usr/share/fonts/Aptos.ttf')\n\t * @example await pptx.registerFontMetrics('Aptos', aptosBoldBytes, { bold: true })\n\t */\n\tasync registerFontMetrics(\n\t\tface: string,\n\t\tsource: string | Uint8Array | ArrayBuffer,\n\t\topts?: { bold?: boolean; italic?: boolean }\n\t): Promise<void> {\n\t\tlet bytes: Uint8Array\n\t\tif (typeof source === 'string') bytes = await this._runtime.loadFontData(source)\n\t\telse if (source instanceof Uint8Array) bytes = source\n\t\telse bytes = new Uint8Array(source)\n\t\tconst metrics = await parseFontMetrics(bytes)\n\t\tthis._fontMetrics.set(face, metrics, opts)\n\t}\n\n\t/**\n\t * Embed a font face so the deck renders with it even on machines that do not\n\t * have it installed. The **whole** face is embedded (not glyph-subset) under\n\t * `/ppt/fonts/` and wired into `presentation.xml` (`p:embeddedFontLst` +\n\t * `embedTrueTypeFonts=\"1\"`), exactly as PowerPoint's \"Embed fonts in the file\"\n\t * does. Call once per face/weight you use.\n\t *\n\t * The declared `typeface` MUST match the family name used in your run/`fontFace`\n\t * typefaces (e.g. `addText('hi', { fontFace: 'Silkscreen' })`) or PowerPoint\n\t * will not bind the embedded bytes to the text. Repeated calls with the same\n\t * `typeface` and different `style` accumulate into one `p:embeddedFont` entry.\n\t *\n\t * Font licensing is the caller's responsibility: the bytes are embedded as\n\t * handed over; `OS/2.fsType` embedding-permission bits are not enforced.\n\t * @param {object} opts - font source + identity\n\t * @param {string} [opts.path] - font file path (Node) or URL (web) to a `.ttf`/`.otf`\n\t * @param {ArrayBuffer | Uint8Array | string} [opts.data] - raw font bytes, or a base64 string, in lieu of `path`\n\t * @param {string} opts.typeface - family name as referenced by run/`fontFace` typefaces\n\t * @param {EmbeddedFontSlot} [opts.style] - face slot; defaults to `'regular'`\n\t * @example await pptx.embedFont({ path: '/fonts/Silkscreen-Regular.ttf', typeface: 'Silkscreen' })\n\t * @example await pptx.embedFont({ path: '/fonts/Silkscreen-Bold.ttf', typeface: 'Silkscreen', style: 'bold' })\n\t */\n\tasync embedFont(opts: {\n\t\tpath?: string\n\t\tdata?: ArrayBuffer | Uint8Array | string\n\t\ttypeface: string\n\t\tstyle?: EmbeddedFontSlot\n\t}): Promise<void> {\n\t\tif (!opts || typeof opts.typeface !== 'string' || opts.typeface.trim() === '') {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'font/missing-typeface',\n\t\t\t\t'embedFont: `typeface` is required (the family name your runs reference)'\n\t\t\t)\n\t\t}\n\t\tconst slot: EmbeddedFontSlot = opts.style ?? 'regular'\n\t\tif (!EMBEDDED_FONT_SLOTS.includes(slot)) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'font/invalid-style-slot',\n\t\t\t\t`embedFont: invalid style \"${slot}\"; expected one of ${EMBEDDED_FONT_SLOTS.join(', ')}`\n\t\t\t)\n\t\t}\n\n\t\t// Resolve bytes: a path/URL via the runtime loader, else in-memory data\n\t\t// (Uint8Array / ArrayBuffer / base64 string).\n\t\tlet bytes: Uint8Array\n\t\tif (typeof opts.path === 'string') {\n\t\t\tbytes = await this._runtime.loadFontData(opts.path)\n\t\t} else if (opts.data instanceof Uint8Array) {\n\t\t\tbytes = opts.data\n\t\t} else if (opts.data instanceof ArrayBuffer) {\n\t\t\tbytes = new Uint8Array(opts.data)\n\t\t} else if (typeof opts.data === 'string') {\n\t\t\tconst decoded = decodeBase64ToBytes(\n\t\t\t\topts.data.includes(',') ? opts.data : `application/x-fontdata;base64,${opts.data}`\n\t\t\t)\n\t\t\tif (!decoded) throw new InvalidOptionError('font/invalid-base64', 'embedFont: `data` string is not valid base64')\n\t\t\tbytes = decoded\n\t\t} else {\n\t\t\tthrow new InvalidOptionError('font/missing-source', 'embedFont: provide either `path` or `data`')\n\t\t}\n\n\t\t// Accumulate faces of one family under a single embeddedFont entry; a repeat\n\t\t// of the same typeface+style replaces the prior bytes (last call wins).\n\t\tlet font = this._embeddedFonts.find((f) => f.typeface === opts.typeface)\n\t\tif (!font) {\n\t\t\tfont = { typeface: opts.typeface, faces: [] }\n\t\t\tthis._embeddedFonts.push(font)\n\t\t}\n\t\tconst existing = font.faces.find((f) => f.slot === slot)\n\t\tif (existing) existing.bytes = bytes\n\t\telse font.faces.push({ slot, bytes })\n\t}\n\n\t/**\n\t * Measure how tall text wraps at a given width, using the **same** calibrated wrap\n\t * model the export-time autofit bake uses — so a layout-time prediction matches the\n\t * value `fit:'shrink'`/`'resize'` would bake. Synchronous: register the face's metrics\n\t * first with {@link PresentationCore.registerFontMetrics} (lookup is sync).\n\t *\n\t * Lets a consumer size its own geometry before export — grow a card to fit its text,\n\t * reflow a grid, or detect overflow at layout time. Heights err **tall** (conservative),\n\t * so the returned height is ≥ what PowerPoint/LibreOffice render.\n\t * @param {string | TextProps[]} text - a string or run array (per-run options override the defaults in `opts`)\n\t * @param {MeasureTextOptions} opts - width (inches), font size/face (points), and spacing\n\t * @returns {TextMeasurement} laid-out height + line count + fit helpers\n\t * @example const m = pptx.measureText('Long heading…', { wIn: 3, fontSize: 18, fontFace: 'Aptos' })\n\t * @example if (pptx.measureText(runs, { wIn, fontSize, fontFace }).heightIn > cardHeightIn) growCard()\n\t */\n\tmeasureText(text: string | TextProps[], opts: MeasureTextOptions): TextMeasurement {\n\t\treturn measureText(this._fontMetrics, text, opts)\n\t}\n\n\t/**\n\t * Convenience overflow check: `true` if `text` does not fit a box of inner size\n\t * `wIn`×`hIn` (inches) at full size. Because the model errs tall, this is a\n\t * **conservative** (slightly over-reporting) check — appropriate for a build-time\n\t * warning, not a hard gate. An unmeasurable (unnamed theme-default) face reports\n\t * `false` (no overflow) so the linter does not false-positive on faces it cannot measure.\n\t * @param {string | TextProps[]} text - a string or run array\n\t * @param {OverflowBoxOptions} opts - {@link MeasureTextOptions} plus the box inner height `hIn`\n\t * @returns {boolean} true if the text overflows the box\n\t */\n\toverflowsBox(text: string | TextProps[], opts: OverflowBoxOptions): boolean {\n\t\tconst m = measureText(this._fontMetrics, text, opts)\n\t\treturn m.measurable && !m.fitsBox(opts.hIn)\n\t}\n\n\t/**\n\t * Compute the per-cell geometry of a table laid out at `opts.x`/`y`/`w`, without\n\t * adding it to a slide — so a consumer can place images or shapes precisely over\n\t * cells. Column widths (cell `x`/`w`) are exact, derived from the same logic the\n\t * writer uses. Row heights (`y`/`h`) are exact when pinned by `rowH` (array or\n\t * scalar) or table `h`; an auto-height row is estimated with the same conservative\n\t * (tall) text model as {@link PresentationCore.measureText} and flagged `heightExact:false`\n\t * (register the cell font via {@link PresentationCore.registerFontMetrics} for an exact\n\t * estimate). Geometry is for a single, un-paginated table — `autoPage` paging is\n\t * not modeled.\n\t * @param {TableRow[]} rows - the same `rows` passed to `slide.addTable`\n\t * @param {TableProps} opts - the same table options (`x`, `y`, `w`, `colW`, `rowH`, `h`, …)\n\t * @returns {TableLayoutResult} per-cell rectangles (inches) plus overall table bounds\n\t * @example\n\t * const g = pptx.tableLayout(rows, { x: 1, y: 1, w: 8, colW: [2, 3, 3] })\n\t * const c = g.cells.find(c => c.row === 0 && c.col === 2)\n\t * slide.addImage({ path: 'logo.png', x: c.xIn, y: c.yIn, w: c.wIn, h: c.hIn })\n\t */\n\ttableLayout(rows: TableRow[], opts: TableProps): TableLayoutResult {\n\t\treturn computeTableLayout(rows, opts, this._presLayout, this._fontMetrics)\n\t}\n\n\t// EXPORT METHODS\n\n\t/**\n\t * Export the current Presentation to stream\n\t * @param {WriteBaseProps} props - output properties\n\t * @returns {Promise<string | ArrayBuffer | Blob | Uint8Array>} file stream\n\t */\n\tasync stream(props?: WriteBaseProps): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\t\treturn await writePackage(this.packageSource(), {\n\t\t\tcompression: props?.compression,\n\t\t\toutputType: 'STREAM',\n\t\t})\n\t}\n\n\t/**\n\t * Export the current Presentation as ZIP content with the selected type\n\t * @param {WriteProps} props output properties\n\t * @returns {Promise<string | ArrayBuffer | Blob | Uint8Array>} file content in selected type\n\t */\n\tasync write(props?: WriteProps): Promise<string | ArrayBuffer | Blob | Uint8Array> {\n\t\treturn await writePackage(this.packageSource(), {\n\t\t\tcompression: props?.compression,\n\t\t\toutputType: props?.outputType,\n\t\t\tonMediaError: props?.onMediaError,\n\t\t})\n\t}\n\n\t/**\n\t * Assemble the current Presentation into its OOXML package parts WITHOUT zipping — the raw\n\t * `path → bytes` contents `write()` would compress into the `.pptx`. Use this to stream parts\n\t * into a custom container, inspect individual parts, or feed a pipeline that does its own\n\t * archiving. To produce a real `.pptx` file, use {@link write} / {@link writeFile} instead.\n\t *\n\t * The returned parts are byte-identical, per part, to what `write()` emits for the same deck,\n\t * and their order is the package's emission order. Both are a stability-guaranteed observable\n\t * contract: adding a new part in a later release is backward-compatible as long as existing\n\t * part paths and their relative order do not shift; renaming or reordering an existing part is\n\t * a breaking change. Each call returns fresh `Uint8Array` views over per-call buffers (a new\n\t * assembly runs each time), so callers may retain or transfer them without defensive copying.\n\t * @param {PartsProps} props - assembly options (`onMediaError` only; compression/output shape\n\t * are zip concerns that do not apply to unzipped parts)\n\t * @returns {Promise<PackagePart[]>} the package parts in emission order\n\t */\n\tasync toParts(props?: PartsProps): Promise<PackagePart[]> {\n\t\tconst parts = await buildPackageParts(this.packageSource(), { onMediaError: props?.onMediaError })\n\t\t// Drop the internal `store` (DEFLATE) hint — an fflate-era zip optimization, not an OOXML fact.\n\t\treturn parts.map(({ path, data }) => ({ path, data }))\n\t}\n\n\t/**\n\t * Export the current Presentation.\n\t * Write the generated presentation to disk (Node) or trigger a download (browser).\n\t * @param {WriteFileProps} props - output file properties\n\t * @returns {Promise<string>} the presentation name\n\t */\n\tasync writeFile(props?: WriteFileProps): Promise<string> {\n\t\tconst { fileName: rawName = 'Presentation.pptx', compression, onMediaError } = props ?? {}\n\t\tconst fileName = rawName.toLowerCase().endsWith('.pptx') ? rawName : `${rawName}.pptx`\n\n\t\tconst data = await writePackage(this.packageSource(), {\n\t\t\tcompression,\n\t\t\toutputType: this._runtime.writeFileOutputType ?? undefined,\n\t\t\tonMediaError,\n\t\t})\n\t\treturn await this._runtime.writeFile(fileName, data)\n\t}\n\n\t// PRESENTATION METHODS\n\n\t/**\n\t * Set a custom document property stored in `docProps/custom.xml`.\n\t * Calling with the same name replaces the existing value.\n\t * @param name - property name\n\t * @param value - string, integer/float number, boolean, or Date\n\t */\n\tsetCustomProperty(name: string, value: CustomPropertyValue): void {\n\t\tthis._customProperties = this._customProperties.filter((p) => p.name !== name)\n\t\tthis._customProperties.push({ name, value })\n\t}\n\n\t/**\n\t * Add a new Section to Presentation\n\t * @param {SectionProps} section - section properties\n\t * @example pptx.addSection({ title:'Charts' });\n\t */\n\taddSection(section: SectionProps): void {\n\t\tif (!section) {\n\t\t\twarn('section/missing-argument', 'addSection requires an argument')\n\t\t\treturn\n\t\t} else if (!section.title) {\n\t\t\twarn('section/missing-title', 'addSection requires a title')\n\t\t\treturn\n\t\t} else if (this._sections.some((sect) => sect.title === section.title)) {\n\t\t\twarn(\n\t\t\t\t'section/duplicate-title',\n\t\t\t\t`addSection: a section titled \"${section.title}\" already exists; ignoring duplicate`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tconst newSection: SectionInternalProps = {\n\t\t\t_type: 'user',\n\t\t\t_slides: [],\n\t\t\t_id: `{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}`,\n\t\t\ttitle: section.title,\n\t\t}\n\n\t\tif (section.order) this._sections.splice(section.order, 0, newSection)\n\t\telse this._sections.push(newSection)\n\t}\n\n\t/**\n\t * Add a new Slide to Presentation\n\t * @param {AddSlideProps} options - slide options\n\t * @returns {Slide} the new Slide\n\t */\n\taddSlide(options?: AddSlideProps): Slide {\n\t\tconst masterTitle = options?.masterTitle ?? ''\n\t\tconst defLayout = this.LAYOUTS[DEF_PRES_LAYOUT]\n\t\tif (!defLayout)\n\t\t\tthrow new InternalError(\n\t\t\t\t'layout/default-not-registered',\n\t\t\t\t`Default presentation layout \"${DEF_PRES_LAYOUT}\" is not registered`\n\t\t\t)\n\t\tlet slideLayout: SlideLayoutInternal = {\n\t\t\t_name: defLayout.name,\n\t\t\t_presLayout: this.presLayout,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slideNum: this._slides.length + 1,\n\t\t\t_slideObjects: [],\n\t\t}\n\n\t\tif (masterTitle) {\n\t\t\tconst tmpLayout = this._slideLayouts.find((layout) => layout._name === masterTitle)\n\t\t\tif (tmpLayout) slideLayout = tmpLayout\n\t\t}\n\n\t\tconst newSlide: PresSlideInternal = new SlideBuilder({\n\t\t\taddSlide: this.addNewSlide,\n\t\t\tgetSlide: this.getSlide,\n\t\t\tgetSections: this.getSections,\n\t\t\tpresLayout: this.presLayout,\n\t\t\tsetSlideNum: this.setSlideNumber,\n\t\t\tslideId: this._slides.length + 256,\n\t\t\tslideRId: this._slides.length + 2,\n\t\t\tslideNumber: this._slides.length + 1,\n\t\t\tslideLayout,\n\t\t})\n\n\t\t// A: Add slide to pres\n\t\tthis._slides.push(newSlide)\n\n\t\t// B: Sections\n\t\t// B-1: Add slide to section (if any provided)\n\t\t// B-2: Handle slides without a section when sections are already is use (\"loose\" slides arent allowed, they all need a section)\n\t\tif (options?.sectionTitle) {\n\t\t\tconst sect = this._sections.find((section) => section.title === options.sectionTitle)\n\t\t\tif (!sect)\n\t\t\t\twarn('slide/section-not-found', `addSlide: unable to find section with title: \"${options.sectionTitle}\"`)\n\t\t\telse sect._slides.push(newSlide)\n\t\t} else if (this._sections && this._sections.length > 0 && !options?.sectionTitle) {\n\t\t\tconst lastSect = this._sections[this._sections.length - 1]\n\n\t\t\t// CASE 1: The latest section is a default type - just add this one\n\t\t\tif (lastSect?._type === 'default') lastSect._slides.push(newSlide)\n\t\t\t// CASE 2: There latest section is NOT a default type - create the defualt, add this slide\n\t\t\telse {\n\t\t\t\tthis._sections.push({\n\t\t\t\t\ttitle: `Default-${this._sections.filter((sect) => sect._type === 'default').length + 1}`,\n\t\t\t\t\t_type: 'default',\n\t\t\t\t\t_id: `{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}`,\n\t\t\t\t\t_slides: [newSlide],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn newSlide\n\t}\n\n\t/**\n\t * Create a custom Slide Layout in any size\n\t * @param {PresLayout} layout - layout properties\n\t * @example pptx.defineLayout({ name:'A3', width:16.5, height:11.7 });\n\t */\n\tdefineLayout(layout: PresLayout): void {\n\t\t// @see https://support.office.com/en-us/article/Change-the-size-of-your-slides-040a811c-be43-40b9-8d04-0de5ed79987e\n\t\tif (!layout) warn('layout/invalid-definition', 'defineLayout requires `{name, width, height}`')\n\t\telse if (!layout.name) warn('layout/invalid-definition', 'defineLayout requires `name`')\n\t\telse if (!layout.width) warn('layout/invalid-definition', 'defineLayout requires `width`')\n\t\telse if (!layout.height) warn('layout/invalid-definition', 'defineLayout requires `height`')\n\t\telse if (typeof layout.height !== 'number')\n\t\t\twarn('layout/invalid-definition', 'defineLayout `height` should be a number (inches)')\n\t\telse if (typeof layout.width !== 'number')\n\t\t\twarn('layout/invalid-definition', 'defineLayout `width` should be a number (inches)')\n\n\t\tthis.LAYOUTS[layout.name] = {\n\t\t\tname: layout.name,\n\t\t\t_sizeW: inchesToEmu(Number(layout.width)),\n\t\t\t_sizeH: inchesToEmu(Number(layout.height)),\n\t\t\twidth: inchesToEmu(Number(layout.width)),\n\t\t\theight: inchesToEmu(Number(layout.height)),\n\t\t}\n\t}\n\n\t/**\n\t * Create a new slide master [layout] for the Presentation\n\t * @param {SlideMasterProps} props - layout properties\n\t */\n\tdefineSlideMaster(props: SlideMasterProps): void {\n\t\t// deep clone the props object to avoid mutating the original object.\n\t\t// structuredClone preserves the `SlideMasterProps` type (unlike JSON round-tripping, which widens to `any`).\n\t\tconst propsClone = structuredClone(props)\n\t\tif (!propsClone.title)\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'master/missing-title',\n\t\t\t\t'defineSlideMaster() object argument requires a `title` value.'\n\t\t\t)\n\n\t\tconst newLayout: SlideLayoutInternal = {\n\t\t\t_margin: propsClone.margin || DEF_SLIDE_MARGIN_IN,\n\t\t\t// Kept RAW (unescaped) here, unlike `objectName`'s single-escape-upstream design: `_name`\n\t\t\t// doubles as the lookup key `addSlide({masterTitle})` matches against the caller's raw\n\t\t\t// `title` string (see the `layout._name === masterTitle` comparisons in this file).\n\t\t\t// Escaping it here would break that match for any title containing `&`/`<`/`\"`. It's\n\t\t\t// escaped once at emission instead -- see `slideObjectToXml` in gen/slide/object.ts.\n\t\t\t_name: propsClone.title,\n\t\t\t_presLayout: this.presLayout,\n\t\t\t_rels: [],\n\t\t\t_relsChart: [],\n\t\t\t_relsMedia: [],\n\t\t\t_slide: null,\n\t\t\t_slideNum: 1000 + this._slideLayouts.length + 1,\n\t\t\t_slideNumberProps: propsClone.slideNumber || null,\n\t\t\t_slideObjects: [],\n\t\t\tbackground: propsClone.background,\n\t\t}\n\n\t\t// STEP 1: Create the Slide Master/Layout\n\t\tcreateSlideMaster(propsClone, newLayout)\n\n\t\t// STEP 1b: Master text styles (<p:txStyles>) live on the single shared slide master, not per-layout.\n\t\t// Merge each provided group (title/body/other) onto the master, last-call-wins (deck-wide).\n\t\tif (propsClone.textStyles && typeof propsClone.textStyles === 'object') {\n\t\t\tthis._masterSlide._txStyles = { ...this._masterSlide._txStyles, ...propsClone.textStyles }\n\t\t}\n\n\t\t// STEP 2: Add it to layout defs\n\t\tthis._slideLayouts.push(newLayout)\n\n\t\t// STEP 3: Add background (image data/path must be captured before the package is built)\n\t\tif (propsClone.background) addBackgroundDefinition(propsClone.background, newLayout)\n\n\t\t// STEP 4: Add slideNumber to master slide (if any)\n\t\tif (newLayout._slideNumberProps && !this._masterSlide._slideNumberProps)\n\t\t\tthis._masterSlide._slideNumberProps = newLayout._slideNumberProps\n\t}\n}\n","/**\n * ts-pptx: named clip silhouettes for images\n *\n * A `ClipShape` is declarative data — a named silhouette plus its options — and {@link clipPath}\n * resolves it to the freeform `points` path `addImage` emits as the `<a:custGeom>` clip mask on\n * the `<p:pic>`. Paired with `sizing: { type: 'cover' }` (an `<a:srcRect>` crop) it reproduces\n * what a PowerPoint *picture placeholder* does — a layout `custGeom` clipping an inherited\n * blipFill — but standalone, with no placeholder involved.\n *\n * These are silhouettes recurring often enough in real decks to be worth naming; hand-authored\n * `points` remain available for anything else. Nothing here is theme- or brand-aware: which\n * silhouette to use, and which edge it sits flush to, belongs to the caller.\n *\n * ## The coordinate trap\n *\n * Coordinates come back in the image box's OWN inch space (`0..w`, `0..h`), because `custGeom`\n * points expressed as `%` resolve against the SLIDE, not the box. A box-relative silhouette must\n * therefore be emitted in inches already scaled to the box, which is why {@link clipPath} takes\n * the box size: the fractions below are multiplied by `w` / `h` at build time, so one silhouette\n * scales with whatever region it is handed. Authoring the same shape as percentages would put\n * the clip in the wrong place on every box that is not the full slide.\n */\n\nimport type { GeometryPoint } from './types/index.js'\n\n/**\n * Which edge of the box is the half-disc's FLAT side; the arc bulges toward the opposite edge.\n * `'right'` = flat right edge, arc bulging left.\n */\nexport type FlatSide = 'left' | 'right'\n\n/**\n * Which half-disc proportion to trace. Both are flat-on-one-edge, bulging half-discs whose arc\n * reaches the opposite edge near mid-height; they differ only in how far the arc reaches.\n * - `'deep'` — the arc spans about 32% of the box width, symmetric about mid-height (the default).\n * - `'shallow'` — the arc spans about 13%, slightly asymmetric, with its apex just below mid-height.\n */\nexport type HalfDiscPreset = 'deep' | 'shallow'\n\n/** A named clip silhouette, resolved to a `points` path by {@link clipPath}. */\nexport type ClipShape =\n\t/**\n\t * A rectangle with one side replaced by an elliptical arc that bulges toward the opposite\n\t * edge, reaching it near mid-height — the \"D\" a picture placeholder cuts on a cover slide.\n\t */\n\t{ kind: 'half-disc'; flat: FlatSide; preset?: HalfDiscPreset }\n\n/**\n * A half-disc as box fractions, flat side on the RIGHT (`x = 1`), the arc bulging LEFT toward\n * `x = 0` near mid-height. Two cubic Béziers trace the half-ellipse: the path runs\n * top-flat-corner → top-right → bottom-right → bottom-flat-corner → bottom tip, cubic up to the\n * mid-left apex, cubic back to the top tip, then closes.\n *\n * Each preset spells out every fraction rather than sharing a mirrored `topEdgeX`, because the\n * presets are independent freeforms — the shallow one is asymmetric top-to-bottom, so a\n * symmetric parameterization could not express it without changing its shape.\n */\ninterface HalfDiscSpec {\n\t/** x where the TOP edge departs the flat side toward the arc. */\n\ttopEdgeX: number\n\t/** x where the BOTTOM edge departs the flat side (may differ from the top). */\n\tbotEdgeX: number\n\t/** x where the arc leaves the top edge. */\n\ttipTopX: number\n\t/** y where the arc leaves the top edge. */\n\ttipTopY: number\n\t/** x where the arc leaves the bottom edge. */\n\ttipBotX: number\n\t/** y where the arc leaves the bottom edge. */\n\ttipBotY: number\n\t/** y of the bulge apex (at `x = 0`). */\n\tapexY: number\n\t/** Bottom-segment controls: from the bottom tip, cubic to the apex. */\n\tc1b: { x: number; y: number }\n\tc2b: { x: number; y: number }\n\t/** Top-segment controls: from the apex, cubic back to the top tip. */\n\tc1t: { x: number; y: number }\n\tc2t: { x: number; y: number }\n}\n\n/** `deep` — symmetric top/bottom, apex at mid-height. */\nconst DEEP_DISC: HalfDiscSpec = {\n\ttopEdgeX: 0.31788,\n\tbotEdgeX: 0.31788,\n\ttipTopX: 0.30061,\n\ttipTopY: 0.01078,\n\ttipBotX: 0.30061,\n\ttipBotY: 0.98922,\n\tapexY: 0.5,\n\tc1b: { x: 0.11594, y: 0.86833 },\n\tc2b: { x: 0.0, y: 0.69392 },\n\tc1t: { x: 0.0, y: 0.30609 },\n\tc2t: { x: 0.11594, y: 0.13167 },\n}\n\n/** `shallow` — a slightly asymmetric top/bottom inset and an apex just below mid-height. */\nconst SHALLOW_DISC: HalfDiscSpec = {\n\ttopEdgeX: 0.12611,\n\tbotEdgeX: 0.11128,\n\ttipTopX: 0.09976,\n\ttipTopY: 0.05448,\n\ttipBotX: 0.09976,\n\ttipBotY: 0.97617,\n\tapexY: 0.51533,\n\tc1b: { x: 0.03522, y: 0.83247 },\n\tc2b: { x: 0.0, y: 0.67725 },\n\tc1t: { x: 0.0, y: 0.3534 },\n\tc2t: { x: 0.03522, y: 0.19818 },\n}\n\nconst HALF_DISC: Record<HalfDiscPreset, HalfDiscSpec> = { deep: DEEP_DISC, shallow: SHALLOW_DISC }\n\n/**\n * Half-disc clip path for a `w × h` box. Authored flat-right; `flat: 'left'` mirrors `x → 1 - x`.\n */\nfunction halfDisc(w: number, h: number, flat: FlatSide, preset: HalfDiscPreset): GeometryPoint[] {\n\tconst s = HALF_DISC[preset]\n\tconst fx = flat === 'left' ? (x: number): number => (1 - x) * w : (x: number): number => x * w\n\tconst fy = (y: number): number => y * h\n\treturn [\n\t\t{ x: fx(s.topEdgeX), y: fy(0), moveTo: true },\n\t\t{ x: fx(1), y: fy(0) },\n\t\t{ x: fx(1), y: fy(1) },\n\t\t{ x: fx(s.botEdgeX), y: fy(1) },\n\t\t{ x: fx(s.tipBotX), y: fy(s.tipBotY) },\n\t\t{\n\t\t\tx: fx(0),\n\t\t\ty: fy(s.apexY),\n\t\t\tcurve: { type: 'cubic', x1: fx(s.c1b.x), y1: fy(s.c1b.y), x2: fx(s.c2b.x), y2: fy(s.c2b.y) },\n\t\t},\n\t\t{\n\t\t\tx: fx(s.tipTopX),\n\t\t\ty: fy(s.tipTopY),\n\t\t\tcurve: { type: 'cubic', x1: fx(s.c1t.x), y1: fy(s.c1t.y), x2: fx(s.c2t.x), y2: fy(s.c2t.y) },\n\t\t},\n\t\t{ close: true },\n\t]\n}\n\n/**\n * Resolve a {@link ClipShape} to a freeform `points` path filling a `w × h` box, ready to hand\n * to `addImage({ points })`.\n *\n * `w`/`h` are the image box's size **in inches** and must match the `w`/`h` the picture is drawn\n * at — the path is emitted in the box's own coordinate space, not normalized (see the module\n * note above).\n * @param {ClipShape} shape - the named silhouette and its options\n * @param {number} w - image box width (inches)\n * @param {number} h - image box height (inches)\n * @returns {GeometryPoint[]} the freeform path, for `addImage({ points })`\n * @example\n * const w = 5.22, h = 7.5\n * slide.addImage({\n * path: 'cover.jpg', x: 0, y: 0, w, h,\n * points: clipPath({ kind: 'half-disc', flat: 'right' }, w, h),\n * sizing: { type: 'cover' }, // center-crop the photo into the \"D\"\n * })\n */\nexport function clipPath(shape: ClipShape, w: number, h: number): GeometryPoint[] {\n\tswitch (shape.kind) {\n\t\tcase 'half-disc':\n\t\t\treturn halfDisc(w, h, shape.flat, shape.preset ?? 'deep')\n\t}\n}\n","/**\n * Text types: the `TextBaseProps` paragraph/run contract shared by text, table cells and charts;\n * `TextPropsOptions`/`TextProps`; measurement and layout results; notes and comments.\n *\n * Re-exported by `./index.js`, which is the import site for the rest of `src/`.\n */\nimport type { AlignH, SHAPE_NAME, TextAnchor } from '../enums.js'\nimport type { Color, DataOrPathProps, HAlign, HexColor, Margin, PositionProps, TextVertType, VAlign } from './core.js'\nimport type { ObjectNameProps } from './object.js'\nimport type { HyperlinkProps, ShadowProps, ShapeFillProps, ShapeLineProps } from './style.js'\n\n// used by: chart, slide, table, text\nexport interface TextBaseProps {\n\t/**\n\t * Horizontal alignment\n\t * @default 'left'\n\t */\n\talign?: HAlign\n\t/**\n\t * Bold style\n\t * @default false\n\t */\n\tbold?: boolean\n\t/**\n\t * Add a line-break\n\t * @default false\n\t */\n\tbreakLine?: boolean\n\t/**\n\t * Preset text warp / WordArt shape (`<a:bodyPr><a:prstTxWarp prst=\"..\">`), which\n\t * bends the text along a preset path (arch, circle, wave, …). The value is an\n\t * OOXML `ST_TextShapeType` preset name.\n\t * @example 'textArchUp' // bend text along an upward arch (e.g. a label following a ring/arc)\n\t * @example 'textCircle'\n\t */\n\ttextWarp?: string\n\t/**\n\t * Add standard or custom bullet\n\t * - use `true` for standard bullet\n\t * - pass object options for custom bullet\n\t * - `false` (and omitting the option) is the *explicit off*: it writes `<a:buNone/>`\n\t * plus `marL=\"0\" indent=\"0\"`, which overrides whatever bullet the layout's or\n\t * master's list style sets for this level\n\t * - `'inherit'` states nothing at all — no bullet child and no margin attributes — so\n\t * the list style keeps reaching the paragraph. This is the one state omission\n\t * cannot spell, because omitting the option means `false` here for compatibility\n\t *\n\t * The margins are only a *default* of the bullet state: {@link paraMarginLeft} and\n\t * {@link paraIndent} state `@marL`/`@indent` independently in any of the three, including\n\t * an inherited margin under a drawn bullet.\n\t * @default false\n\t */\n\tbullet?:\n\t\t| boolean\n\t\t| 'inherit'\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * Bullet type\n\t\t\t\t * @default bullet\n\t\t\t\t */\n\t\t\t\ttype?: 'bullet' | 'number'\n\t\t\t\t/**\n\t\t\t\t * Bullet character code (unicode)\n\t\t\t\t * @example '25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)\n\t\t\t\t */\n\t\t\t\tcharacterCode?: string\n\t\t\t\t/**\n\t\t\t\t * Bullet glyph font typeface (`<a:buFont/>`), e.g. for symbol-font bullets\n\t\t\t\t * @example 'Wingdings' // render `characterCode` using the Wingdings font\n\t\t\t\t */\n\t\t\t\tfontFace?: string\n\t\t\t\t/**\n\t\t\t\t * Bullet glyph size as a percentage of the run's text size (25–400)\n\t\t\t\t * @default 100\n\t\t\t\t * @example 80 // bullet glyph is 80% of the text size\n\t\t\t\t */\n\t\t\t\tsize?: number\n\t\t\t\t/**\n\t\t\t\t * Indentation (space between bullet and text) (points)\n\t\t\t\t * @default 27 // DEF_BULLET_MARGIN\n\t\t\t\t * @example 10 // Indents text 10 points from bullet\n\t\t\t\t */\n\t\t\t\tindent?: number\n\t\t\t\t/**\n\t\t\t\t * Number type\n\t\t\t\t * @example 'romanLcParenR' // roman numerals lower-case with paranthesis right\n\t\t\t\t */\n\t\t\t\tnumberType?:\n\t\t\t\t\t| 'alphaLcParenBoth'\n\t\t\t\t\t| 'alphaLcParenR'\n\t\t\t\t\t| 'alphaLcPeriod'\n\t\t\t\t\t| 'alphaUcParenBoth'\n\t\t\t\t\t| 'alphaUcParenR'\n\t\t\t\t\t| 'alphaUcPeriod'\n\t\t\t\t\t| 'arabicParenBoth'\n\t\t\t\t\t| 'arabicParenR'\n\t\t\t\t\t| 'arabicPeriod'\n\t\t\t\t\t| 'arabicPlain'\n\t\t\t\t\t| 'romanLcParenBoth'\n\t\t\t\t\t| 'romanLcParenR'\n\t\t\t\t\t| 'romanLcPeriod'\n\t\t\t\t\t| 'romanUcParenBoth'\n\t\t\t\t\t| 'romanUcParenR'\n\t\t\t\t\t| 'romanUcPeriod'\n\t\t\t\t/**\n\t\t\t\t * Number bullets start at\n\t\t\t\t * @default 1\n\t\t\t\t * @example 10 // numbered bullets start with 10\n\t\t\t\t */\n\t\t\t\tnumberStartAt?: number\n\t\t\t\t/**\n\t\t\t\t * Image to use as the bullet glyph (\"picture bullet\", `<a:buBlip>`)\n\t\t\t\t * - supply an image `path` (filesystem/URL) or base64 `data` (same forms as `addImage()`)\n\t\t\t\t * - raster formats (PNG/JPG/GIF) and SVG are supported; use `size` to scale relative to the text height\n\t\t\t\t * - SVG bullets embed a PNG preview plus the SVG (the same dual-rel handling as `addImage()`)\n\t\t\t\t * - takes precedence over `type`/`characterCode` when set\n\t\t\t\t * @example image: { path: 'images/star.png' }\n\t\t\t\t * @example image: { data: 'image/png;base64,iVBOR...' }\n\t\t\t\t * @example image: { path: 'images/star.svg' }\n\t\t\t\t */\n\t\t\t\timage?: { path?: string; data?: string }\n\t\t\t\t/**\n\t\t\t\t * Relationship id assigned to a picture-bullet image (`<a:blip r:embed>`)\n\t\t\t\t * - for SVG bullets this is the PNG-preview rel; the SVG rel is `_rIdSvg`\n\t\t\t\t * @internal populated by `addText()`; do not set directly\n\t\t\t\t */\n\t\t\t\t_rId?: number\n\t\t\t\t/**\n\t\t\t\t * Relationship id of the SVG image for an SVG picture bullet (`<asvg:svgBlip r:embed>`)\n\t\t\t\t * @internal populated by `addText()`; do not set directly\n\t\t\t\t */\n\t\t\t\t_rIdSvg?: number\n\t\t\t\t/**\n\t\t\t\t * Bullet glyph color (separate from the text run color)\n\t\t\t\t * @example 'FF0000' // red bullet\n\t\t\t\t */\n\t\t\t\tcolor?: HexColor\n\t\t }\n\t/**\n\t * Text capitalization (`a:rPr/@cap`, `ST_TextCapsType`)\n\t * - `'all'` = ALL CAPS\n\t * - `'small'` = Small Caps\n\t * - `'none'` = the *explicit off*: it writes `cap=\"none\"`, which overrides a capitalization\n\t * the run would otherwise inherit. Omitting the option states nothing and lets that\n\t * inheritance stand\n\t * - PowerPoint: Font > Effects > All Caps / Small Caps\n\t * @default (unset) inherit\n\t */\n\tcaps?: 'none' | 'small' | 'all'\n\t/**\n\t * Text color\n\t * - `HexColor` or `ThemeColor`\n\t * - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Color\n\t * @example 'FF0000' // hex color (red)\n\t * @example SchemeColor.text1 // Theme color (Text1)\n\t */\n\tcolor?: Color\n\t/**\n\t * Font face name\n\t *\n\t * Applied to the Latin (`<a:latin>`) and complex-script (`<a:cs>`) font slots, matching\n\t * how PowerPoint writes a font picked from the UI. The East Asian slot (`<a:ea>`) is left\n\t * to inherit from the theme unless `fontFaceEA` is set — forcing a Latin-only face into the\n\t * East Asian slot duplicates/ghosts text in Office 365.\n\t * @example 'Arial' // Arial font\n\t */\n\tfontFace?: string\n\t/**\n\t * East Asian font face name (`<a:ea>` slot), used to render CJK (Chinese/Japanese/Korean) glyphs\n\t *\n\t * Set this when the East Asian font differs from `fontFace`. When omitted, `<a:ea>` inherits the\n\t * theme East Asian font, which is what PowerPoint does for Latin fonts.\n\t * @example '微軟正黑體' // render East Asian glyphs with Microsoft JhengHei\n\t */\n\tfontFaceEA?: string\n\t/**\n\t * Font size\n\t * @example 12 // Font size 12\n\t */\n\tfontSize?: number\n\t/**\n\t * Text highlight color (hex format)\n\t * @example 'FFFF00' // yellow\n\t */\n\thighlight?: HexColor\n\t/**\n\t * italic style\n\t * @default false\n\t */\n\titalic?: boolean\n\t/**\n\t * language\n\t * - ISO 639-1 standard language code\n\t * @default 'en-US' // english US\n\t * @example 'fr-CA' // french Canadian\n\t */\n\tlang?: string\n\t/**\n\t * First-line indent (points) — `a:pPr/@indent`, the offset of the paragraph's FIRST line\n\t * from {@link paraMarginLeft}. Negative hangs the first line to the left of the body, which\n\t * is what a bulleted paragraph does; positive indents it to the right, the \"first line\n\t * indented\" prose form. PowerPoint: Paragraph > Indentation > Special.\n\t * - `'inherit'` writes no `@indent` at all, so the paragraph takes whatever its list style\n\t * (`a:lstStyle` → placeholder → layout → master) sets — the same third state\n\t * {@link bullet} spells, on the attribute beside it\n\t * - omitting the option keeps the bullet-derived default: a drawn bullet hangs the first\n\t * line by its margin, `bullet: false` writes `indent=\"0\"`, `bullet: 'inherit'` writes\n\t * nothing\n\t * - a value here overrides all of those, in every bullet state\n\t * @example -18 // hang the first line 18pt left of the body text\n\t * @example 18 // indent the first line 18pt, prose style\n\t * @example 'inherit' // keep the list style's indent, even on a bulleted paragraph\n\t */\n\tparaIndent?: number | 'inherit'\n\t/**\n\t * Left margin of the paragraph (points) — `a:pPr/@marL`, where the paragraph's body text\n\t * starts. This is the paragraph's own margin, not the text frame's internal padding\n\t * (`margin`) and not the discrete outline level (`indentLevel`, which writes `a:p/@lvl`).\n\t * PowerPoint: Paragraph > Indentation > Before text.\n\t * - `'inherit'` writes no `@marL` at all, so the paragraph takes whatever its list style\n\t * (`a:lstStyle` → placeholder → layout → master) sets — the third state that omission\n\t * cannot spell, since omitting it writes the bullet-derived default\n\t * - omitting the option keeps that default: a drawn bullet writes its own margin (see\n\t * `bullet.indent`), `bullet: false` writes `marL=\"0\"`, `bullet: 'inherit'` writes nothing\n\t * - a value here overrides all of those, in every bullet state\n\t * @example 36 // body text starts 36pt (0.5in) from the frame's text edge\n\t * @example 'inherit' // keep the list style's margin, even on a bulleted paragraph\n\t */\n\tparaMarginLeft?: number | 'inherit'\n\t/**\n\t * Add a soft line-break (shift+enter) before line text content\n\t * @default false\n\t */\n\tsoftBreakBefore?: boolean\n\t/**\n\t * tab stops\n\t * - PowerPoint: Paragraph > Tabs > Tab stop position\n\t * @example [{ position:1 }, { position:3 }] // Set first tab stop to 1 inch, set second tab stop to 3 inches\n\t */\n\ttabStops?: Array<{ position: number; alignment?: 'l' | 'r' | 'ctr' | 'dec' }>\n\t/**\n\t * text direction\n\t * `horz` = horizontal\n\t * `vert` = rotate 90^\n\t * `vert270` = rotate 270^\n\t * `wordArtVert` = stacked\n\t * @default 'horz'\n\t */\n\ttextDirection?: 'horz' | 'vert' | 'vert270' | 'wordArtVert'\n\t/**\n\t * Transparency (percent)\n\t * - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Transparency\n\t * - range: 0-100\n\t * @default 0\n\t */\n\ttransparency?: number\n\t/**\n\t * underline properties\n\t * - PowerPoint: Font > Color & Underline > Underline Style/Underline Color\n\t * - `style` is the full `ST_TextUnderlineType` enumeration (ECMA-376 §20.1.10.81)\n\t * - `'none'` is the *explicit off*: it writes `a:rPr/@u=\"none\"`, which overrides an\n\t * underline the run would otherwise inherit from its list style, placeholder, layout or\n\t * master. Omitting the option instead states nothing and lets that inheritance stand —\n\t * the two are different facts, not two spellings of one.\n\t * @default (unset) inherit\n\t */\n\tunderline?: {\n\t\tstyle?:\n\t\t\t| 'dash'\n\t\t\t| 'dashHeavy'\n\t\t\t| 'dashLong'\n\t\t\t| 'dashLongHeavy'\n\t\t\t| 'dbl'\n\t\t\t| 'dotDash'\n\t\t\t| 'dotDashHeavy'\n\t\t\t| 'dotDotDash'\n\t\t\t| 'dotDotDashHeavy'\n\t\t\t| 'dotted'\n\t\t\t| 'dottedHeavy'\n\t\t\t| 'heavy'\n\t\t\t| 'none'\n\t\t\t| 'sng'\n\t\t\t| 'wavy'\n\t\t\t| 'wavyDbl'\n\t\t\t| 'wavyHeavy'\n\t\t\t| 'words'\n\t\tcolor?: Color\n\t}\n\t/**\n\t * vertical alignment\n\t * @default 'top'\n\t */\n\tvalign?: VAlign\n}\n\nexport interface TextGlowProps {\n\t/**\n\t * Border color (hex format)\n\t * @example 'FF3399'\n\t */\n\tcolor?: HexColor\n\t/**\n\t * opacity (0.0 - 1.0)\n\t * @example 0.5\n\t * 50% opaque\n\t */\n\topacity?: number\n\t/**\n\t * size (points)\n\t */\n\tsize: number\n}\n\nexport interface TextFitShrinkProps {\n\t/**\n\t * Shrink text on overflow (`<a:normAutofit>`)\n\t */\n\ttype: 'shrink'\n\t/**\n\t * Font scale as a percent (0-100), mapped to `<a:normAutofit fontScale=\"..\">`.\n\t *\n\t * PowerPoint normally calculates this dynamically when text overflows; set it\n\t * explicitly to bake the scale into the generated file.\n\t * @example 85 // render text at 85% of its nominal size\n\t * @default undefined // attribute omitted (PowerPoint defaults to 100%)\n\t */\n\tfontScale?: number\n\t/**\n\t * Line-space reduction as a percent (0-100), mapped to `<a:normAutofit lnSpcReduction=\"..\">`.\n\t * @example 20 // reduce line spacing by 20%\n\t * @default undefined // attribute omitted (PowerPoint defaults to 0%)\n\t */\n\tlnSpcReduction?: number\n}\n\nexport interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps, ObjectNameProps {\n\t_bodyProp?: {\n\t\t// Note: Many of these duplicated as user options are transformed to _bodyProp options for XML processing\n\t\talign?: AlignH\n\t\tanchor?: TextAnchor\n\t\tlIns?: number\n\t\trIns?: number\n\t\ttIns?: number\n\t\tbIns?: number\n\t\tnumCol?: number\n\t\tspcCol?: number\n\t\tvert?: TextVertType\n\t\twrap?: boolean\n\t\tprstTxWarp?: string\n\t}\n\t_lineIdx?: number\n\n\tbaseline?: number\n\t/**\n\t * Character spacing\n\t */\n\tcharSpacing?: number\n\t/**\n\t * Number of text columns in the text body\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > \"Number\"\n\t * - range: 1-16\n\t * @default 1\n\t * @example 2 // flow text into two columns\n\t */\n\tcolumns?: number\n\t/**\n\t * Spacing between text columns (points)\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > \"Spacing\"\n\t * - only applies when `columns` > 1\n\t * @default 0\n\t * @example 10 // 10pt gap between columns\n\t */\n\tcolumnSpacing?: number\n\t/**\n\t * Text fit options\n\t *\n\t * MS-PPT > Format Shape > Shape Options > Text Box > \"[unlabeled group]\": [3 options below]\n\t * - 'none' = Do not Autofit\n\t * - 'shrink' = Shrink text on overflow\n\t * - 'resize' = Resize shape to fit text\n\t *\n\t * **Measured fit:** if you register the box's font with\n\t * {@link TsPptx.registerFontMetrics}, both `'shrink'` and `'resize'` are\n\t * **measured at export time**, so the text renders correctly in headless renderers\n\t * and on plain file-open (no edit/resize needed):\n\t * - `'shrink'` computes the largest `fontScale` at which the wrapped text fits and\n\t * bakes `<a:normAutofit fontScale=…/>`.\n\t * - `'resize'` computes the height the text needs and bakes it into the shape's\n\t * `a:ext/@cy` (adjusting `a:off/@y` per vertical anchor), the marker being\n\t * `<a:spAutoFit/>`.\n\t * Without registered metrics they fall back to the bare flag (`<a:normAutofit/>` /\n\t * `<a:spAutoFit/>`, which only PowerPoint recomputes on edit) and warn once.\n\t *\n\t * **Note** Bare `'shrink'`/`'resize'` (no metrics) only take effect after editing\n\t * text / resizing the shape; PowerPoint calculates the result then. The object form\n\t * of `'shrink'` always bakes the explicit values you pass.\n\t * @example 'shrink' // measured when metrics are registered; else bare <a:normAutofit/>\n\t * @example 'resize' // measured when metrics are registered; else bare <a:spAutoFit/>\n\t * @example { type: 'shrink', fontScale: 85, lnSpcReduction: 20 } // pre-shrink with explicit values\n\t * @default \"none\"\n\t */\n\tfit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps\n\t/**\n\t * Shape fill\n\t * @example { color:'FF0000' } // hex color (red)\n\t * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent\n\t * @example { color:SchemeColor.accent1 } // theme color Accent1\n\t */\n\tfill?: ShapeFillProps\n\t/**\n\t * Flip shape horizontally?\n\t * @default false\n\t */\n\tflipH?: boolean\n\t/**\n\t * Flip shape vertical?\n\t * @default false\n\t */\n\tflipV?: boolean\n\tglow?: TextGlowProps\n\thyperlink?: HyperlinkProps\n\tindentLevel?: number\n\tisTextBox?: boolean\n\tline?: ShapeLineProps\n\t/**\n\t * Line spacing (pt)\n\t * - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > \"Exactly\"\n\t * @example 28 // 28pt\n\t */\n\tlineSpacing?: number\n\t/**\n\t * line spacing multiple (percent)\n\t * - range: 0.0-9.99\n\t * - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > \"Multiple\"\n\t * @example 1.5 // 1.5X line spacing\n\t */\n\tlineSpacingMultiple?: number\n\t/**\n\t * Margin (inches) — the text-frame internal margin/padding\n\t * - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Left/Right/Top/Bottom margin (shown in inches)\n\t * - array order is `[top, right, bottom, left]`\n\t * - a value `>= 1` is honored as inches but warns once (it is likely a legacy points value; divide by 72)\n\t * @default (unset) PowerPoint's \"Normal\" internal margin [0.05\", 0.1\", 0.05\", 0.1\"]\n\t * @example 0 // Top/Right/Bottom/Left margin 0\n\t * @example 0.1 // Top/Right/Bottom/Left margin 0.1 inch\n\t * @example [0.05, 0.1, 0.05, 0.1] // top 0.05\", right 0.1\", bottom 0.05\", left 0.1\"\n\t */\n\tmargin?: Margin\n\toutline?: { color: Color; size: number }\n\tparaSpaceAfter?: number\n\tparaSpaceBefore?: number\n\t/**\n\t * Placeholder type\n\t * - when the value matches a placeholder defined on the slide layout/master, this text\n\t * inherits that placeholder's position and formatting\n\t * - otherwise the text shape is promoted to a standalone placeholder of this type, emitting\n\t * a real `<p:ph type=\"...\">`. Use `placeholder: 'title'` to give a slide an accessible\n\t * title (PowerPoint's accessibility checker otherwise reports \"Missing Slide Title\")\n\t * - values: 'title' | 'body' | et. al.\n\t * @example 'title'\n\t * @see https://learn.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype\n\t */\n\tplaceholder?: string\n\t/**\n\t * Rounded rectangle radius (only for ShapeType.roundRect)\n\t * - values: 0.0 to 1.0\n\t * @default 0\n\t */\n\trectRadius?: number\n\t/**\n\t * Rotation (degrees)\n\t * - range: -360 to 360\n\t * @default 0\n\t * @example 180 // rotate 180 degrees\n\t */\n\trotate?: number\n\t/**\n\t * Whether to enable right-to-left mode\n\t * @default false\n\t */\n\trtlMode?: boolean\n\tshadow?: ShadowProps\n\tshape?: SHAPE_NAME\n\t/**\n\t * Strikethrough (`a:rPr/@strike`, `ST_TextStrikeType` — ECMA-376 §20.1.10.78)\n\t * - `true` is `'sngStrike'`; `'dblStrike'` is the double rule\n\t * - `'noStrike'` is the *explicit off*: it writes `strike=\"noStrike\"`, which overrides a\n\t * strikethrough the run would otherwise inherit from its list style, placeholder, layout\n\t * or master\n\t * - `false`, like leaving the option out, writes no attribute at all and so states\n\t * *nothing* — the run keeps whatever it inherits. This matches `bold`/`italic`, whose\n\t * falsy arm is likewise an omission; reach for `'noStrike'` when the intent is \"not\n\t * struck\" rather than \"unspecified\"\n\t * @default (unset) inherit\n\t */\n\tstrike?: boolean | 'noStrike' | 'sngStrike' | 'dblStrike'\n\tsubscript?: boolean\n\tsuperscript?: boolean\n\t/**\n\t * Vertical alignment\n\t * @default middle\n\t */\n\tvalign?: VAlign\n\t/**\n\t * Advanced/legacy escape hatch for the full `ST_TextVerticalType` range (e.g. `eaVert`,\n\t * `mongolianVert`, `wordArtVert`). Prefer {@link TextBaseProps.textDirection} for the common\n\t * cases; both map to `a:bodyPr@vert`.\n\t */\n\tvert?: TextVertType\n\t/**\n\t * Text wrap\n\t * @default true\n\t */\n\twrap?: boolean\n}\nexport interface TextProps {\n\ttext?: string | number\n\toptions?: TextPropsOptions\n\t/**\n\t * Raw OMML (Office MathML) for a native, editable PowerPoint equation. By default it is emitted\n\t * as its own centered display-math paragraph (`<a14:m><m:oMathPara><m:oMath>…`) and `text` is\n\t * ignored; set `inline` to instead flow it as an equation run mid-paragraph. Accepts either the\n\t * inner OMML (children of `<m:oMath>`), a full `<m:oMath>…</m:oMath>`, or a full\n\t * `<m:oMathPara>…</m:oMathPara>`; the `m:` prefix is resolved by the wrapper, so the markup does\n\t * not need its own namespace declarations.\n\t * This is the raw-OMML entry point. To author from LaTeX or MathML, convert with\n\t * `latexToOmml()` / `mathmlToOmml()` from the `@shbernal/ts-pptx/math` subpath.\n\t * @example { math: '<m:r><m:t>x^2+1=y</m:t></m:r>' } // raw OMML\n\t * @example import { latexToOmml } from '@shbernal/ts-pptx/math'; ({ math: latexToOmml('x^2+1=y') })\n\t */\n\tmath?: string\n\t/**\n\t * Emit this item's `math` equation *inline* — an `<a14:m><m:oMath>` run flowing mid-paragraph\n\t * between the surrounding plain text runs — instead of as its own centered display-math\n\t * paragraph. Has no effect unless `math` is set. Pair with the bare-`<m:oMath>` inline form of\n\t * the equation: `latexToOmml(tex, { display: false })` or `mathmlToOmml(mathml)`.\n\t * @example addText([{ text: 'where ' }, { math: latexToOmml('x^2+1=y', { display: false }), inline: true }, { text: ' holds' }])\n\t */\n\tinline?: boolean\n}\n\n/**\n * Options for layout-time text measurement ({@link TsPptx.measureText}).\n * Inches for width, points for type/spacing — the consumer-facing units. The\n * measured face must have metrics registered via {@link TsPptx.registerFontMetrics}\n * (a named face without exact metrics uses a conservative heuristic; an unnamed\n * theme-default face is unmeasurable).\n */\nexport interface MeasureTextOptions {\n\t/** Available text width in inches (the box width minus L/R inset, unless `insetIn` is given). */\n\twIn: number\n\t/** Font size in points. */\n\tfontSize: number\n\t/** Font family name, as used in `fontFace`. Required for an exact measure; an unnamed face is unmeasurable. */\n\tfontFace?: string\n\tbold?: boolean\n\titalic?: boolean\n\t/** Character spacing in points. */\n\tcharSpacing?: number\n\t/** Exact line spacing in points (overrides `lineSpacingMultiple`). */\n\tlineSpacing?: number\n\t/** Line spacing as a multiple of single (e.g. `1.5`). */\n\tlineSpacingMultiple?: number\n\t/** Space before each paragraph, in points. */\n\tparaSpaceBefore?: number\n\t/** Space after each paragraph, in points. */\n\tparaSpaceAfter?: number\n\t/** L/R text inset in inches; when set, subtracted from `wIn` on both sides (pass a raw box width). */\n\tinsetIn?: number\n}\n\n/**\n * Result of {@link TsPptx.measureText}. Heights err **tall** (conservative) —\n * they match the value the export-time autofit bake uses, so the laid-out height is\n * ≥ what PowerPoint/LibreOffice render. Use it to grow a container; for an overflow\n * check it may slightly over-report (good for a warning, not a hard gate).\n */\nexport interface TextMeasurement {\n\t/** Laid-out height in inches at the given `fontSize` (conservative/tall). */\n\theightIn: number\n\t/** Number of wrapped lines (conservative — the model wraps marginally early). */\n\tlineCount: number\n\t/**\n\t * Width in inches of the widest laid-out line (conservative — the model wraps\n\t * marginally early, so this errs slightly wide). With an unconstrained `wIn` it\n\t * is the natural single-line width; constrained, it is the widest wrapped line.\n\t * A box set to this width will not re-wrap the text.\n\t */\n\twidestLineIn: number\n\t/** `false` only for an unnamed theme-default face that could not be measured. */\n\tmeasurable: boolean\n\t/**\n\t * The **named** faces laid out with the conservative average-advance heuristic\n\t * instead of their real metrics — i.e. faces with no registered metrics. Empty\n\t * when every run was measured exactly (and for an unmeasurable result, which\n\t * guessed nothing). The numbers stay conservative (they err tall/wide), but a\n\t * non-empty list means they are an approximation, not a measurement; register\n\t * the face via {@link TsPptx.registerFontMetrics} for an exact result.\n\t */\n\tapproximatedFaces: string[]\n\t/** True if the text fits a box of inner height `hIn` (inches) at full size. */\n\tfitsBox: (hIn: number) => boolean\n\t/** The `fontScale` (percent) that fits inner height `hIn`; `100` if it already fits, never below the shrink floor. */\n\tshrinkScaleFor: (hIn: number) => number\n}\n\n/** Options for {@link TsPptx.overflowsBox}: a measure plus the box inner height to test against. */\nexport interface OverflowBoxOptions extends MeasureTextOptions {\n\t/** Box inner height in inches to test for overflow. */\n\thIn: number\n}\n\n/**\n * One cell's computed rectangle from {@link TsPptx.tableLayout}. All values are\n * inches; `x`/`y` are absolute (offset from the table's `x`/`y`). For a merged cell,\n * `row`/`col` are the top-left origin and `wIn`/`hIn` cover the whole span; the\n * cells it covers are not emitted separately.\n */\nexport interface TableCellLayout {\n\t/** Zero-based grid row of the cell's top-left origin. */\n\trow: number\n\t/** Zero-based grid column of the cell's top-left origin. */\n\tcol: number\n\t/** Number of rows the cell spans (1 if not merged). */\n\trowSpan: number\n\t/** Number of columns the cell spans (1 if not merged). */\n\tcolSpan: number\n\t/** Left edge in inches (absolute). */\n\txIn: number\n\t/** Top edge in inches (absolute). */\n\tyIn: number\n\t/** Outer cell width in inches (sum of spanned column widths). */\n\twIn: number\n\t/** Outer cell height in inches (sum of spanned row heights). */\n\thIn: number\n\t/**\n\t * `true` when `hIn`/`yIn` are pinned by an explicit `rowH` (array or scalar) or\n\t * table `h`; `false` when the row is auto-height and the value is a conservative\n\t * (tall) estimate from the same text model as {@link TsPptx.measureText}.\n\t */\n\theightExact: boolean\n}\n\n/**\n * Result of {@link TsPptx.tableLayout}: per-cell geometry plus overall table\n * bounds, for placing images/shapes over a table without rendering it. Geometry is\n * for a single, un-paginated table laid out at `opts.x`/`y`/`w`; `autoPage` paging\n * is not modeled. Widths are exact; auto-height row heights are conservative\n * estimates (see {@link TableCellLayout.heightExact}).\n */\nexport interface TableLayoutResult {\n\t/** One entry per non-merged origin cell, in row-major order. */\n\tcells: TableCellLayout[]\n\t/** Overall table width in inches (sum of column widths). */\n\twidthIn: number\n\t/** Overall table height in inches (sum of row heights; may include estimates). */\n\theightIn: number\n\t/** `false` if any row height was estimated (the total errs tall, like `measureText`). */\n\theightExact: boolean\n}\n\n/**\n * Per-run options for a speaker-notes text run.\n * A focused subset of `TextPropsOptions`: inline formatting plus an (external URL) hyperlink.\n * Notes hyperlinks support `url` only; `slide` targets are not yet supported.\n */\nexport type NotesTextOptions = Pick<\n\tTextPropsOptions,\n\t'hyperlink' | 'bold' | 'italic' | 'underline' | 'color' | 'fontSize' | 'fontFace'\n>\n\n/** A single speaker-notes text run: text plus optional inline formatting / hyperlink. */\nexport interface NotesProps {\n\ttext: string\n\toptions?: NotesTextOptions\n}\n\n/**\n * A review comment attached to a slide (legacy ISO/IEC 29500 §13 comment).\n */\nexport interface CommentProps {\n\t/** Author display name (required). Comments sharing the same `author`+`initials` are grouped under one author entry. */\n\tauthor: string\n\t/** Author initials shown in the comment marker. Defaults to letters derived from `author`. */\n\tinitials?: string\n\t/** Comment body text (required). */\n\ttext: string\n\t/** Comment marker X position in inches. @default 0.5 */\n\tx?: number\n\t/** Comment marker Y position in inches. @default 0.5 */\n\ty?: number\n\t/** Authored date/time as a `Date` or ISO-8601 string. Omitted from the XML when not provided. */\n\tdate?: Date | string\n}\n\n/** Internal normalized comment stored on a slide (`_comments`). x/y are inches; `date` is ISO-8601 when present. */\nexport interface SlideComment {\n\tauthor: string\n\tinitials: string\n\ttext: string\n\tx: number\n\ty: number\n\tdate?: string\n}\n\n/** Resolved presentation-level comment author, emitted to `commentAuthors.xml`. */\nexport interface ResolvedCommentAuthor {\n\tid: number\n\tname: string\n\tinitials: string\n\tlastIdx: number\n\tclrIdx: number\n}\n\n/** Factory for a single inline text run. Prevents `as never` casts when building mixed-style run arrays. */\nexport function textRun(text: string | number, options?: TextPropsOptions): TextProps {\n\treturn options !== undefined ? { text, options } : { text }\n}\n\n/** Wraps a run array so TypeScript accepts it as `TextProps[]` without a cast. */\nexport function textRuns(runs: TextProps[]): TextProps[] {\n\treturn runs\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,MAAsB;CACtD,SAAS,QAAQ,GAAA,CAAI,YAAY,GAAjC;EACC,KAAK,OACJ,OAAO;EACR,KAAK,OACJ,OAAO;EACR,KAAK,OACJ,OAAO;EACR,KAAK;EACL,KAAK,QACJ,OAAO;EACR,SACC,OAAO,YAAY,QAAQ,GAAA,CAAI,YAAY;CAC7C;AACD;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,wBAAwB,MAAc,MAAsB;CAE3E,MAAM,UAAU,QAAQ;CACxB,MAAM,UAAU,QAAQ;CAExB,MAAM,cADW,QAAQ,MAAM,QAAQ,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAClD,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,MAAA,CAAO,MAAM,GAAG,CAAC,CAAC,MAAM,MAAA,CAAO,YAAY;CAG3F,MAAM,YAAY,gBAAgB,KAAK,OAAO;CAC9C,IAAI,WAAW,YAAY,IAAI,OAAO,UAAU,EAAE,CAAC,YAAY;CAC/D,IAAI,QAAQ,YAAY,CAAC,CA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