@shbernal/ts-pptx 3.3.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.
- package/dist/{autopage-D1sqK6j7.js → autopage-BYlTzX-l.js} +8 -5
- package/dist/autopage-BYlTzX-l.js.map +1 -0
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +11 -11
- package/dist/browser.js.map +1 -1
- package/dist/{diagnostics-B2yWpcjB.d.ts → diagnostics-B0OmTOoz.d.ts} +38 -6
- package/dist/diagnostics-B0OmTOoz.d.ts.map +1 -0
- package/dist/{diagnostics-H1QzgRSw.js → diagnostics-CPVADSL1.js} +29 -3
- package/dist/{diagnostics-H1QzgRSw.js.map → diagnostics-CPVADSL1.js.map} +1 -1
- package/dist/{fit-CYJ1jkQI.js → fit-TjpNbMru.js} +3 -3
- package/dist/{fit-CYJ1jkQI.js.map → fit-TjpNbMru.js.map} +1 -1
- package/dist/{html-dom-CzewEdE1.js → html-dom-yUSdCExA.js} +5 -5
- package/dist/html-dom-yUSdCExA.js.map +1 -0
- package/dist/html.d.ts +2 -2
- package/dist/html.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +16 -33
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +5 -4
- package/dist/inspect.js.map +1 -1
- package/dist/measure.d.ts +1 -1
- package/dist/measure.js +1 -1
- package/dist/{st-enums-bVnezkMJ.js → namespaces-Sy_m7Nhd.js} +288 -200
- package/dist/namespaces-Sy_m7Nhd.js.map +1 -0
- package/dist/node.d.ts +4 -4
- package/dist/node.js +7 -19
- package/dist/node.js.map +1 -1
- package/dist/{notes-SCvpJz0l.js → notes-bWApshah.js} +221 -140
- package/dist/notes-bWApshah.js.map +1 -0
- package/dist/{pres-Cb-1xDne.d.ts → pres-Dybf7ZUl.d.ts} +2 -2
- package/dist/{pres-Cb-1xDne.d.ts.map → pres-Dybf7ZUl.d.ts.map} +1 -1
- package/dist/{presentation-DeKTJGHf.js → presentation-3rAKKRfm.js} +154 -230
- package/dist/presentation-3rAKKRfm.js.map +1 -0
- package/dist/{presentation-types-B50aOUFI.d.ts → presentation-types-D7cgT-eG.d.ts} +191 -16
- package/dist/presentation-types-D7cgT-eG.d.ts.map +1 -0
- package/dist/read.d.ts +3 -3
- package/dist/read.js +3 -3
- package/dist/script.d.ts +1 -1
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +67 -40
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BXVgsk0F.js → shapes-Dyw5bxwO.js} +371 -52
- package/dist/shapes-Dyw5bxwO.js.map +1 -0
- package/dist/{slide-DWw9UoI6.d.ts → slide-B_aInw3N.d.ts} +208 -180
- package/dist/slide-B_aInw3N.d.ts.map +1 -0
- package/dist/{text-uM-zGton.js → text-DSN3anEh.js} +3563 -3437
- package/dist/text-DSN3anEh.js.map +1 -0
- package/dist/{units-internal-CGf4VrXy.js → units-internal-DNvK2I6o.js} +54 -34
- package/dist/{units-internal-CGf4VrXy.js.map → units-internal-DNvK2I6o.js.map} +1 -1
- package/package.json +4 -4
- package/dist/autopage-D1sqK6j7.js.map +0 -1
- package/dist/diagnostics-B2yWpcjB.d.ts.map +0 -1
- package/dist/html-dom-CzewEdE1.js.map +0 -1
- package/dist/notes-SCvpJz0l.js.map +0 -1
- package/dist/presentation-DeKTJGHf.js.map +0 -1
- package/dist/presentation-types-B50aOUFI.d.ts.map +0 -1
- package/dist/shapes-BXVgsk0F.js.map +0 -1
- package/dist/slide-DWw9UoI6.d.ts.map +0 -1
- package/dist/st-enums-bVnezkMJ.js.map +0 -1
- package/dist/text-uM-zGton.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shapes-BXVgsk0F.js","names":["#rPrAttr","#removeRPrAttr","#getOrAddRPr","#rPrAttrRaw","#setBoolRPrAttr","#rPr","#setSolidFill","#inheritedColorResolver","#inheritedResolver","#spacingPt","#emuAttrPt","#bulletStyle","#bulletImagePartName","#normAutofitPct","#setOffset","#setExtent","#setFill","#line","#setLine","#gradientStopsIn","#gradientFillIn","#effect","#readShadow","#applyEffectColor","#getOrAddBlip","#svgBlip","#applyFit","#connection","#chartGroups","#chart","#plotArea","#scaling","#seriesElements","#chart","#plotArea","#chartData","#root","#styleContext","#tblPrFlag","#setTcPrAttr","#getOrAddTcPr","#tcPr","#setFill","checkEnum","#styleFill","#fillSchemeColorOf","#graphicDataUri","#graphicData","#getOrAddGrpSpPr"],"sources":["../src/read/oxml/dom.ts","../src/read/opc/partnames.ts","../src/ooxml/sequence.ts","../src/read/oxml/fill.ts","../src/read/oxml/theme.ts","../src/read/oxml/placeholder-inherit.ts","../src/read/oxml/color-transform.ts","../src/read/api/theme-context.ts","../src/read/api/gradient.ts","../src/read/api/picture-fill.ts","../src/read/api/pattern-fill.ts","../src/read/api/shapes/oxml.ts","../src/read/api/shapes/geometry.ts","../src/read/api/shapes/group-transform.ts","../src/read/api/text.ts","../src/read/api/shapes/base.ts","../src/read/api/shapes/autoshape.ts","../src/read/api/shapes/picture.ts","../src/read/api/shapes/connector.ts","../src/read/api/chart.ts","../src/read/api/chartex.ts","../src/read/api/table-edit.ts","../src/read/api/table-structure.ts","../src/read/api/table-style-resolve.ts","../src/read/api/table.ts","../src/read/api/shapes/graphic-frame.ts","../src/read/api/shapes.ts"],"sourcesContent":["/**\n * Thin wrapper over `@xmldom/xmldom` — the only module in `src/read/` that\n * imports it directly.\n *\n * `@xmldom/xmldom` ships its own DOM types that are NOT assignable to the\n * lib.dom `Document`/`Element`; all of `src/read/` must import DOM types from\n * here, never from lib.dom and never from `@xmldom/xmldom` directly.\n */\nimport {\n\tDOMParser,\n\tMIME_TYPE,\n\tXMLSerializer,\n\tonErrorStopParsing,\n\ttype Document,\n\ttype Element,\n\ttype Node,\n} from '@xmldom/xmldom'\n\nexport type { Document, Element, Node } from '@xmldom/xmldom'\nimport { InternalError, InvalidOptionError } from '../../errors.js'\n\n/** DOM `Node.ELEMENT_NODE` constant (xmldom does not expose it statically). */\nexport const ELEMENT_NODE = 1\n\n/** Parse an XML string strictly: any well-formedness error throws. */\nexport function parseXml(xml: string): Document {\n\treturn new DOMParser({ onError: onErrorStopParsing }).parseFromString(xml, MIME_TYPE.XML_TEXT)\n}\n\n/**\n * Serialize a Document to an XML string. Does not pretty-print or normalize\n * whitespace. The XML declaration is not part of the DOM; callers that need\n * it (see `Part.serialize`) must prepend it themselves.\n */\nexport function serializeXml(doc: Document): string {\n\treturn new XMLSerializer().serializeToString(doc)\n}\n\n/** Canonical OOXML prefix → namespace URI registry. */\nexport const OOXML_NS = Object.freeze({\n\ta: 'http://schemas.openxmlformats.org/drawingml/2006/main',\n\tc: 'http://schemas.openxmlformats.org/drawingml/2006/chart',\n\tcp: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',\n\tct: 'http://schemas.openxmlformats.org/package/2006/content-types',\n\tcx: 'http://schemas.microsoft.com/office/drawing/2014/chartex',\n\tdc: 'http://purl.org/dc/elements/1.1/',\n\tdcterms: 'http://purl.org/dc/terms/',\n\tdgm: 'http://schemas.openxmlformats.org/drawingml/2006/diagram',\n\tep: 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties',\n\tmc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',\n\tp: 'http://schemas.openxmlformats.org/presentationml/2006/main',\n\tp14: 'http://schemas.microsoft.com/office/powerpoint/2010/main',\n\tp188: 'http://schemas.microsoft.com/office/powerpoint/2018/8/main',\n\tpr: 'http://schemas.openxmlformats.org/package/2006/relationships',\n\tr: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\n})\n\n/** Build a prefixed qname string, e.g. `qn('p', 'sld')` → `\"p:sld\"`. */\nexport function qn(prefix: string, local: string): string {\n\tif (!(prefix in OOXML_NS))\n\t\tthrow new InvalidOptionError('oxml/unknown-namespace-prefix', `Unknown OOXML namespace prefix: ${prefix}`)\n\treturn `${prefix}:${local}`\n}\n\nfunction splitQName(qname: string): { uri: string; local: string } {\n\tconst colon = qname.indexOf(':')\n\tif (colon < 0)\n\t\tthrow new InvalidOptionError('oxml/invalid-qname', `Expected a prefixed qname like \"p:sld\", got: ${qname}`)\n\tconst prefix = qname.slice(0, colon)\n\tconst uri = (OOXML_NS as Record<string, string>)[prefix]\n\tif (!uri) throw new InvalidOptionError('oxml/unknown-namespace-prefix', `Unknown OOXML namespace prefix: ${prefix}`)\n\treturn { uri, local: qname.slice(colon + 1) }\n}\n\n/**\n * Direct child elements of `parent` matching a qname. Matching is by\n * namespace URI + local name, so it is independent of the prefixes the\n * document happens to declare.\n */\nexport function getElements(parent: Node, qname: string): Element[] {\n\tconst { uri, local } = splitQName(qname)\n\tconst out: Element[] = []\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType === ELEMENT_NODE) {\n\t\t\tconst element = node as Element\n\t\t\tif (element.localName === local && element.namespaceURI === uri) out.push(element)\n\t\t}\n\t}\n\treturn out\n}\n\n/** All direct child elements in document order, regardless of qname. */\nexport function childElements(parent: Node): Element[] {\n\tconst out: Element[] = []\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType === ELEMENT_NODE) out.push(node as Element)\n\t}\n\treturn out\n}\n\n/**\n * All *descendant* elements of `root` matching a namespace + local name, snapshotted into an\n * array. Unlike {@link getElements} (direct children only) this searches the whole subtree, and\n * unlike the live `HTMLCollection` that `getElementsByTagNameNS` returns, the result does not\n * change as the caller mutates the tree — which is what makes it safe to iterate while replacing\n * the very elements being iterated.\n *\n * Note the DOM's own exclusion: `root` itself is never a candidate, only its descendants.\n */\nexport function descendantsByTag(root: Element, ns: string, local: string): Element[] {\n\tconst out: Element[] = []\n\tfor (const element of root.getElementsByTagNameNS(ns, local)) out.push(element)\n\treturn out\n}\n\n/** First direct child element matching a qname, or `null`. */\nexport function firstChild(parent: Node, qname: string): Element | null {\n\tconst { uri, local } = splitQName(qname)\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType === ELEMENT_NODE) {\n\t\t\tconst element = node as Element\n\t\t\tif (element.localName === local && element.namespaceURI === uri) return element\n\t\t}\n\t}\n\treturn null\n}\n\n/** First direct child *element* of `parent` (skipping text/comment nodes), or `null`. */\nexport function firstChildElement(parent: Node): Element | null {\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType === ELEMENT_NODE) return node as Element\n\t}\n\treturn null\n}\n\n/** First direct child element matching any of the given qnames, or `null`. */\nfunction firstChildMatchingAny(parent: Node, qnames: readonly string[]): Element | null {\n\tconst wanted = qnames.map(splitQName)\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\tconst element = node as Element\n\t\tif (wanted.some(({ uri, local }) => element.localName === local && element.namespaceURI === uri)) return element\n\t}\n\treturn null\n}\n\n// --- Mutation helpers (editing) --------------------------------------------\n//\n// `src/read/` mutates the live DOM in place; these are the only sanctioned way\n// to create elements, set attributes, and keep a parent's children in the\n// sequence OOXML requires. They never mark a part dirty — callers own that.\n\n/** Create a namespaced element from a prefixed qname (e.g. `createElement(doc, 'a:off')`). */\nexport function createElement(doc: Document, qname: string): Element {\n\tconst { uri } = splitQName(qname)\n\treturn doc.createElementNS(uri, qname)\n}\n\n/**\n * The owning document of a node. `Node.ownerDocument` is typed `Document | null`\n * (it is null only for a `Document` itself), but every element parsed from or\n * created within a package document has one; this encodes that invariant and\n * throws loudly if it is ever violated rather than deferring to a downstream NPE.\n */\nexport function ownerDocumentOf(node: Node): Document {\n\tconst doc = node.ownerDocument\n\tif (!doc) throw new InternalError('oxml/node-has-no-document', 'Node has no ownerDocument')\n\treturn doc\n}\n\n/**\n * Replace `oldNode` with `newNode` in `oldNode`'s parent. `Node.parentNode` is\n * typed `Node | null`; a node reached by walking a tree always has a parent, so\n * this captures the common replace-in-place pattern and fails clearly when the\n * node is unexpectedly detached.\n */\nexport function replaceInParent(oldNode: Node, newNode: Node): void {\n\tconst parent = oldNode.parentNode\n\tif (!parent) throw new InternalError('oxml/node-has-no-parent', 'Node has no parent to replace within')\n\tparent.replaceChild(newNode, oldNode)\n}\n\n/**\n * Set an attribute by qname. An unprefixed name (`sz`, `x`) sets a plain\n * attribute; a prefixed name (`r:id`) resolves the prefix to its namespace and\n * sets it via `setAttributeNS`. The reserved `xml:` prefix is handled by the\n * DOM itself.\n */\nexport function setAttr(element: Element, qname: string, value: string): void {\n\tconst colon = qname.indexOf(':')\n\tif (colon < 0 || qname.startsWith('xml:')) {\n\t\telement.setAttribute(qname, value)\n\t\treturn\n\t}\n\tconst { uri } = splitQName(qname)\n\telement.setAttributeNS(uri, qname, value)\n}\n\n/** Remove an attribute by qname; a no-op when the attribute is absent. */\nexport function removeAttr(element: Element, qname: string): void {\n\tconst colon = qname.indexOf(':')\n\tif (colon < 0 || qname.startsWith('xml:')) {\n\t\telement.removeAttribute(qname)\n\t\treturn\n\t}\n\tconst { uri, local } = splitQName(qname)\n\telement.removeAttributeNS(uri, local)\n}\n\n/**\n * Get the first child element matching `qname`, creating and inserting it when\n * absent. A newly created element is inserted before the first existing child\n * whose qname appears in `before` (the schema successors of the new element),\n * or appended when none are present — keeping the parent's children in the\n * sequence order OOXML mandates.\n */\nexport function getOrAddChild(parent: Element, qname: string, before: readonly string[] = []): Element {\n\tconst existing = firstChild(parent, qname)\n\tif (existing) return existing\n\tconst doc = parent.ownerDocument\n\tif (!doc)\n\t\tthrow new InternalError(\n\t\t\t'oxml/node-has-no-document',\n\t\t\t`Cannot create <${qname}>: parent element has no owner document`\n\t\t)\n\tconst child = createElement(doc, qname)\n\tconst successor = before.length ? firstChildMatchingAny(parent, before) : null\n\tparent.insertBefore(child, successor) // insertBefore(node, null) appends\n\treturn child\n}\n\n/**\n * Insert an already-built `node` into `parent` in document order: before the\n * first existing child whose qname is in `before` (the new node's schema\n * successors), or appended when none are present. Unlike {@link getOrAddChild}\n * this always inserts the given node (no get-or-create), so callers can place a\n * freshly-constructed subtree at the right position.\n */\nexport function insertInOrder(parent: Element, node: Node, before: readonly string[] = []): void {\n\tconst successor = before.length ? firstChildMatchingAny(parent, before) : null\n\tparent.insertBefore(node, successor)\n}\n\n/** Remove every direct child element matching any of the given qnames. */\nexport function removeChildrenByQName(parent: Element, qnames: readonly string[]): void {\n\tconst toRemove: Element[] = []\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\ttoRemove.push(node as Element)\n\t}\n\tconst wanted = qnames.map(splitQName)\n\tfor (const element of toRemove) {\n\t\tif (wanted.some(({ uri, local }) => element.localName === local && element.namespaceURI === uri)) {\n\t\t\tparent.removeChild(element)\n\t\t}\n\t}\n}\n\n/**\n * Read an attribute by qname. An unprefixed name (`sz`, `b`) reads the plain\n * attribute; a prefixed name (`r:id`, `r:embed`) resolves the prefix to its\n * namespace URI and reads via `getAttributeNS`, so it is robust to whatever\n * prefix the document declared. Returns `null` when the attribute is absent.\n */\nexport function attr(element: Element, qname: string): string | null {\n\tconst colon = qname.indexOf(':')\n\tif (colon < 0) return element.getAttribute(qname)\n\tconst { uri, local } = splitQName(qname)\n\treturn element.getAttributeNS(uri, local)\n}\n\n/** Parse an integer-valued OOXML attribute; `null`/empty/non-finite → `null`. */\nexport function intValue(value: string | null): number | null {\n\tif (value === null || value === '') return null\n\tconst number = Number(value)\n\treturn Number.isFinite(number) ? number : null\n}\n\n/** Parse an `xsd:boolean` OOXML attribute (`1`/`0`/`true`/`false`); else `null`. */\nexport function boolValue(value: string | null): boolean | null {\n\tif (value === '1' || value === 'true') return true\n\tif (value === '0' || value === 'false') return false\n\treturn null\n}\n\n/**\n * Escape a string for use inside a double-quoted XML attribute value.\n *\n * Tab/CR/LF become character references because XML 1.0 section 3.3.3 has a parser normalise the\n * literal characters to a single space before any consumer sees them. `'` needs no escaping between\n * double quotes. The write-side counterpart is `encodeXmlAttrValue` in `gen/utils.ts`.\n */\nexport function escapeXmlAttribute(value: string): string {\n\treturn value\n\t\t.replaceAll('&', '&')\n\t\t.replaceAll('<', '<')\n\t\t.replaceAll('>', '>')\n\t\t.replaceAll('\"', '"')\n\t\t.replaceAll('\\t', '	')\n\t\t.replaceAll('\\n', ' ')\n\t\t.replaceAll('\\r', ' ')\n}\n","/**\n * OPC partname helpers (ECMA-376 Part 2 pack-URI grammar).\n *\n * A partname is an absolute, `/`-separated path inside the package, e.g.\n * `/ppt/slides/slide1.xml`. Zip entry paths omit the leading slash.\n */\nimport { PackageReadError } from '../../errors.js'\nimport type { OpcPackage } from './package.js'\n\n/**\n * Resolve the single relationship of `type` owned by `partName` to its target partname, or\n * `null` when the part declares none. For the one-of-a-kind links in a deck's spine — a slide to\n * its layout, a layout to its master, a master to its theme — where a second relationship of the\n * same type would itself be malformed.\n *\n * The `OpcPackage` import is type-only, so this does not create a cycle with `package.ts` (which\n * imports this module at run time).\n */\nexport function resolveSingleRel(opc: OpcPackage, partName: string, type: string): string | null {\n\tconst rels = opc.relationshipsFor(partName)\n\tconst rel = rels.byType(type)[0]\n\treturn rel ? rels.resolveTarget(rel.id) : null\n}\n\nexport function zipPathToPartName(zipPath: string): string {\n\treturn zipPath.startsWith('/') ? zipPath : `/${zipPath}`\n}\n\nexport function partNameToZipPath(partName: string): string {\n\treturn partName.startsWith('/') ? partName.slice(1) : partName\n}\n\n/**\n * Lowercased extension without the dot, or `''` when the part has none.\n * Per OPC, the extension is everything after the last dot — so the leading\n * dot of `/_rels/.rels` still yields `rels`.\n */\nexport function partNameExtension(partName: string): string {\n\tconst lastSegment = partName.slice(partName.lastIndexOf('/') + 1)\n\tconst dot = lastSegment.lastIndexOf('.')\n\treturn dot < 0 ? '' : lastSegment.slice(dot + 1).toLowerCase()\n}\n\n/** Partname of the `.rels` part holding `sourcePartName`'s relationships ('/' = package). */\nexport function relsPartNameFor(sourcePartName: string): string {\n\tif (sourcePartName === '/') return '/_rels/.rels'\n\tconst dir = sourcePartName.slice(0, sourcePartName.lastIndexOf('/'))\n\tconst file = sourcePartName.slice(sourcePartName.lastIndexOf('/') + 1)\n\treturn `${dir}/_rels/${file}.rels`\n}\n\n/**\n * Build a relationship `Target` for `targetPartName` relative to its source\n * part's directory — the inverse of {@link resolveRelativePartName}. Both names\n * are absolute partnames. E.g. source `/ppt/slides/slide1.xml`, target\n * `/ppt/media/image1.png` → `../media/image1.png`.\n */\nexport function relativePartName(sourcePartName: string, targetPartName: string): string {\n\tconst from = sourcePartName.slice(1).split('/').slice(0, -1) // source directory segments\n\tconst to = targetPartName.slice(1).split('/') // target segments incl. filename\n\tlet common = 0\n\twhile (common < from.length && common < to.length - 1 && from[common] === to[common]) common++\n\tconst up = from.slice(common).map(() => '..')\n\tconst down = to.slice(common)\n\treturn [...up, ...down].join('/')\n}\n\n/**\n * Resolve a relationship target against its source part, per OPC pack-URI\n * resolution: relative targets resolve against the source part's directory.\n *\n * @param sourcePartName partname of the part owning the relationship ('/' for package-level)\n * @param target relationship Target attribute (relative like `../media/image1.png`, or absolute)\n */\nexport function resolveRelativePartName(sourcePartName: string, target: string): string {\n\tconst path = target.startsWith('/') ? target : sourcePartName.slice(0, sourcePartName.lastIndexOf('/') + 1) + target\n\tconst segments: string[] = []\n\tfor (const segment of path.split('/')) {\n\t\tif (segment === '' || segment === '.') continue\n\t\tif (segment === '..') {\n\t\t\tif (segments.length === 0)\n\t\t\t\tthrow new PackageReadError(\n\t\t\t\t\t'package/relationship-target-escapes-root',\n\t\t\t\t\t`Relationship target ${target} escapes the package root (source ${sourcePartName})`\n\t\t\t\t)\n\t\t\tsegments.pop()\n\t\t} else {\n\t\t\tsegments.push(segment)\n\t\t}\n\t}\n\treturn `/${segments.join('/')}`\n}\n","/**\n * Schema child-sequence order for the OOXML complexTypes both halves of the library insert into.\n *\n * **What these are for.** `getOrAddChild(parent, qname, before)` / `insertInOrder(parent, node,\n * before)` place a newly created child before the first sibling named in `before`. So `before`\n * must list exactly the children that legally *follow* the one being inserted. Get it wrong and\n * the part is schema-invalid — which PowerPoint reports as a corrupt file, not as a bad option,\n * so the failure surfaces far from its cause with no compile-time signal.\n *\n * **Why they are derived, not written out.** These successor lists used to be hand-maintained,\n * and the same four had drifted into two copies apiece (`read/api/shapes/oxml.ts` and\n * `read/oxml/theme.ts`), including one pair whose names were transposed (`SPPR_AFTER_XFRM` vs\n * `SPPR_XFRM_AFTER`) while the contents stayed identical. Declaring each complexType's sequence\n * **once** and slicing the successors out of it removes that class of bug outright: there is a\n * single ordering to be right about, and adding a child to a sequence updates every successor\n * list that follows it in one edit. This is the technique `TCPR_AFTER` already used for\n * `CT_TableCellProperties`; this module generalizes it.\n *\n * **Why this module is neither `gen/` nor `read/`.** Document order is a fact about the schema,\n * not about writing or reading it. `read/` inserts into a live DOM and `gen/` emits strings, but\n * both are bound by the same ECMA-376 sequence.\n */\n\n/**\n * One step of a schema sequence: a single element, or a choice group whose members are mutually\n * exclusive. A group is spelled as an array so {@link successorsOf} can treat every member as\n * occupying the same slot — the successors of `a:solidFill` are what follows the *whole*\n * `EG_FillProperties` group, not its sibling choices.\n */\ntype SequenceStep = string | readonly string[]\n\n/**\n * `EG_FillProperties` — the mutually exclusive fill choices, in schema order.\n * @see ECMA-376 Part 1 §20.1.8 (DrawingML fill group)\n */\nexport const FILL_CHOICES = ['a:noFill', 'a:solidFill', 'a:gradFill', 'a:blipFill', 'a:pattFill', 'a:grpFill'] as const\n\n/** `EG_EffectProperties` — the two mutually exclusive effect containers. */\nconst EFFECT_CHOICES = ['a:effectLst', 'a:effectDag'] as const\n\n/** `EG_Geometry` — the two mutually exclusive geometry choices. */\nconst GEOMETRY_CHOICES = ['a:custGeom', 'a:prstGeom'] as const\n\n/**\n * Everything that legally follows `member` in `sequence`, flattened.\n *\n * `member` may name a single element or any member of a choice group; either way the result\n * starts after the step it occupies, so a choice member never lists its own siblings. Throws on\n * an unknown name rather than returning `[]` — an empty successor list silently *appends*, which\n * is exactly the corruption these lists exist to prevent, so a typo must fail loudly and at\n * module-load time rather than produce a subtly out-of-order part at run time.\n */\nfunction successorsOf(sequence: readonly SequenceStep[], member: string): string[] {\n\tconst index = sequence.findIndex((step) => (typeof step === 'string' ? step === member : step.includes(member)))\n\tif (index < 0) throw new Error(`successorsOf: ${member} is not part of the given sequence`)\n\treturn sequence.slice(index + 1).flat()\n}\n\n/**\n * `CT_ShapeProperties` (`p:spPr`), in declaration order.\n * @see ECMA-376 Part 1 §20.1.2.2.35\n */\nconst SPPR_SEQUENCE: readonly SequenceStep[] = [\n\t'a:xfrm',\n\tGEOMETRY_CHOICES,\n\tFILL_CHOICES,\n\t'a:ln',\n\tEFFECT_CHOICES,\n\t'a:scene3d',\n\t'a:sp3d',\n\t'a:extLst',\n]\n\n/**\n * `CT_GroupShapeProperties` (`p:grpSpPr`), in declaration order. A group carries no `a:ln` and\n * no `a:sp3d` — which is exactly why it needs its own successor lists rather than borrowing the\n * shape ones.\n * @see ECMA-376 Part 1 §20.1.2.2.19\n */\nconst GRPSPPR_SEQUENCE: readonly SequenceStep[] = ['a:xfrm', FILL_CHOICES, EFFECT_CHOICES, 'a:scene3d', 'a:extLst']\n\n/**\n * `CT_LineProperties` (`a:ln`), in declaration order.\n * @see ECMA-376 Part 1 §20.1.2.2.24\n */\nconst LN_SEQUENCE: readonly SequenceStep[] = [\n\tFILL_CHOICES,\n\t['a:prstDash', 'a:custDash'],\n\t['a:round', 'a:bevel', 'a:miter'],\n\t'a:headEnd',\n\t'a:tailEnd',\n\t'a:extLst',\n]\n\n/**\n * `CT_TextCharacterProperties` (`a:rPr`/`a:defRPr`/`a:endParaRPr`), in declaration order.\n * @see ECMA-376 Part 1 §21.1.2.3.9\n */\nconst RPR_SEQUENCE: readonly SequenceStep[] = [\n\t'a:ln',\n\tFILL_CHOICES,\n\tEFFECT_CHOICES,\n\t'a:highlight',\n\t['a:uLnTx', 'a:uLn'],\n\t['a:uFillTx', 'a:uFill'],\n\t'a:latin',\n\t'a:ea',\n\t'a:cs',\n\t'a:sym',\n\t'a:hlinkClick',\n\t'a:hlinkMouseOver',\n\t'a:rtl',\n\t'a:extLst',\n]\n\n/**\n * `CT_TableCellProperties` (`a:tcPr`), in declaration order.\n * @see ECMA-376 Part 1 §21.1.3.17\n */\nexport const TCPR_SEQUENCE: readonly string[] = [\n\t'a:lnL',\n\t'a:lnR',\n\t'a:lnT',\n\t'a:lnB',\n\t'a:lnTlToBr',\n\t'a:lnBlToTr',\n\t'a:cell3D',\n\t...FILL_CHOICES,\n\t'a:headers',\n\t'a:extLst',\n]\n\n/**\n * For each `a:tcPr` child, the children that must follow it — i.e. what a new one is inserted\n * *before*. Every child gets an entry, so a caller can look one up by qname.\n */\nexport const TCPR_AFTER: Record<string, string[]> = Object.fromEntries(\n\tTCPR_SEQUENCE.map((qname, index) => [qname, TCPR_SEQUENCE.slice(index + 1)])\n)\n\n// --- p:spPr / p:grpSpPr ------------------------------------------------------\n\n/** Successors of `a:xfrm` inside `p:spPr`. */\nexport const SPPR_AFTER_XFRM = successorsOf(SPPR_SEQUENCE, 'a:xfrm')\n/** Successors of a fill choice inside `p:spPr`. */\nexport const SPPR_FILL_AFTER = successorsOf(SPPR_SEQUENCE, 'a:solidFill')\n/** Successors of `a:ln` inside `p:spPr`. */\nexport const SPPR_LN_AFTER = successorsOf(SPPR_SEQUENCE, 'a:ln')\n/** Successors of an effect container inside `p:spPr`. */\nexport const SPPR_EFFECT_AFTER = successorsOf(SPPR_SEQUENCE, 'a:effectLst')\n/** Successors of `a:scene3d` inside `p:spPr`. */\nexport const SPPR_SCENE3D_AFTER = successorsOf(SPPR_SEQUENCE, 'a:scene3d')\n/** Successors of `a:sp3d` inside `p:spPr`. */\nexport const SPPR_SP3D_AFTER = successorsOf(SPPR_SEQUENCE, 'a:sp3d')\n\n/** Successors of `a:xfrm` inside `p:grpSpPr`. */\nexport const GRPSPPR_AFTER_XFRM = successorsOf(GRPSPPR_SEQUENCE, 'a:xfrm')\n/** Successors of a fill choice inside `p:grpSpPr`. */\nexport const GRPSPPR_FILL_AFTER = successorsOf(GRPSPPR_SEQUENCE, 'a:solidFill')\n\n/**\n * Successors of `p:spPr` within `p:sp` (and before `p:style` within `p:pic` / `p:cxnSp`).\n * `p:blipFill` and the `p:nv*Pr` wrapper precede `p:spPr` and so are deliberately absent.\n */\nexport const SHAPE_AFTER_SPPR = ['p:style', 'p:txBody']\n\n// --- a:ln / a:rPr ------------------------------------------------------------\n\n/** Successors of a fill choice inside `a:ln`. */\nexport const LN_FILL_AFTER = successorsOf(LN_SEQUENCE, 'a:solidFill')\n/** Successors of a fill choice inside `a:rPr` (and `a:defRPr`/`a:endParaRPr`). */\nexport const RPR_FILL_AFTER = successorsOf(RPR_SEQUENCE, 'a:solidFill')\n","/**\n * Shared solid-fill read/mutation helpers for DrawingML colour-bearing parents:\n * a run's `a:rPr`, a shape's `p:spPr` / `p:grpSpPr`, and a line's `a:ln`.\n *\n * A parent carries at most one `EG_FillProperties` choice, so setting a solid\n * fill first clears any competing choice, then inserts `a:solidFill` in document\n * order. These helpers never mark a part dirty — callers own that.\n */\nimport { InvalidOptionError } from '../../errors.js'\nimport { FILL_CHOICES } from '../../ooxml/sequence.js'\nimport {\n\tattr,\n\tcreateElement,\n\tfirstChild,\n\tgetOrAddChild,\n\townerDocumentOf,\n\tremoveChildrenByQName,\n\tsetAttr,\n\ttype Element,\n} from './dom.js'\n\n/**\n * The mutually-exclusive fill choices (`EG_FillProperties`); a parent has at most one.\n * Declared in `src/ooxml/sequence.ts`, where the schema sequences that embed it live too.\n */\nexport { FILL_CHOICES }\n\n/** Normalize a 6-hex RGB string (optional leading `#`) to upper-case, or throw. */\nexport function normalizeHex(value: string): string {\n\tconst hex = value.startsWith('#') ? value.slice(1) : value\n\tif (!/^[0-9a-fA-F]{6}$/.test(hex))\n\t\tthrow new InvalidOptionError(\n\t\t\t'color/invalid-hex',\n\t\t\t`Expected a 6-digit hex RGB colour, got: ${JSON.stringify(value)}`\n\t\t)\n\treturn hex.toUpperCase()\n}\n\n/** The `@val` of a colour child (`qname`) under `parent/a:solidFill`, or `null`. */\nexport function solidFillColor(parent: Element | null, qname: string): string | null {\n\tconst fill = parent && firstChild(parent, 'a:solidFill')\n\tconst clr = fill && firstChild(fill, qname)\n\treturn clr ? attr(clr, 'val') : null\n}\n\n/**\n * Replace `parent`'s solid fill with a single colour element. Any competing fill\n * choice is dropped first, then `a:solidFill` is inserted before `afterOrder`\n * (its schema successors). To *clear* a fill instead, remove `a:solidFill`\n * directly via `removeChildrenByQName`, which leaves any other choice untouched.\n */\nexport function setSolidFill(parent: Element, afterOrder: string[], color: { qname: string; val: string }): void {\n\tremoveChildrenByQName(parent, FILL_CHOICES)\n\tconst fill = getOrAddChild(parent, 'a:solidFill', afterOrder)\n\tconst clr = createElement(ownerDocumentOf(parent), color.qname)\n\tsetAttr(clr, 'val', color.val)\n\tfill.appendChild(clr)\n}\n","/**\n * Theme colour resolution: turning a DrawingML colour reference or a style-matrix reference into\n * something literal.\n *\n * Two maps do the colour work. A scheme token (`accent1`, `bg1`, …) routes through the master's\n * `clrMap` to a `clrScheme` slot, whose literal RGB is the answer; child colour transforms\n * (`lumMod`/`shade`/`alpha`/…) are carried through untouched rather than computed, so a caller\n * that re-emits them renders identically. A style-matrix reference (`a:fillRef`/`a:lnRef`) instead\n * indexes the theme's `fmtScheme`, and resolves to a deep-cloned entry with its `phClr`\n * placeholder substituted.\n *\n * Everything here is **pure**: it reads a DOM and builds detached elements, and mutates nothing\n * the caller passes in. Two very different consumers depend on that:\n *\n * - the read model's colour getters, which resolve a colour to report it;\n * - the import-time flatten passes (`read/api/ops/flatten.ts`), which resolve the same colour in\n * order to *bake* it into a slide.\n *\n * They must agree, so they share this. The passes that write results back into a part live with\n * the other import operations, not here — this module deliberately has no mutating exports.\n * Placeholder-inheritance resolution (what a placeholder gets from its layout/master chain) is\n * its own concern and lives in `placeholder-inherit.ts`.\n */\nimport {\n\tOOXML_NS,\n\tattr,\n\tchildElements,\n\tcreateElement,\n\tdescendantsByTag,\n\tfirstChild,\n\tfirstChildElement,\n\townerDocumentOf,\n\treplaceInParent,\n\tsetAttr,\n\ttype Element,\n} from './dom.js'\n\n/** The 12 `a:clrScheme` slot names, in schema order. */\nexport const SCHEME_SLOTS = [\n\t'dk1',\n\t'lt1',\n\t'dk2',\n\t'lt2',\n\t'accent1',\n\t'accent2',\n\t'accent3',\n\t'accent4',\n\t'accent5',\n\t'accent6',\n\t'hlink',\n\t'folHlink',\n]\n\n/** Scheme tokens that name a `clrScheme` slot directly, bypassing the `clrMap`. */\nconst DIRECT_SLOT_TOKENS = new Set(['dk1', 'lt1', 'dk2', 'lt2'])\n\n/**\n * The colour-resolution context: the two maps that turn a DrawingML colour\n * reference into a literal hex — the effective colour map (token → `clrScheme`\n * slot, honouring any slide `clrMapOvr`) and the resolved colour scheme (slot →\n * 6-hex RGB). Shared by the read-model colour getters and {@link ThemeContext}.\n */\nexport interface ColorContext {\n\tclrMap: Map<string, string>\n\tclrScheme: Map<string, string>\n}\n\n/**\n * The source theme subgraph a slide, notes slide, layout or master resolves against: the\n * {@link ColorContext} maps, the live `a:fmtScheme` for style-matrix resolution, and the roots\n * of the inheritance chain a placeholder reads through.\n *\n * Every root here is **read-only** — nothing in this module or in `placeholder-inherit.ts`\n * mutates one. The import-time flatten pass extends this with the one field it needs to write\n * from (see `FlattenContext` in `read/api/ops/flatten.ts`).\n */\nexport interface ThemeContext extends ColorContext {\n\tfmtScheme: Element | null\n\t/**\n\t * The source `slideLayout` root element, for resolving what a placeholder inherits.\n\t * `null`/absent disables the layout tier.\n\t */\n\tlayoutRoot?: Element | null\n\t/**\n\t * The source `slideMaster` root element, for resolving placeholder inheritance via its\n\t * placeholder `a:lstStyle` and `p:txStyles`.\n\t */\n\tmasterRoot?: Element | null\n\t/**\n\t * The theme's `a:fontScheme`, for resolving a `+mj-*`/`+mn-*` major/minor font\n\t * token (the placeholder-inherited typeface chain bottoms out in one) to a\n\t * literal face name via {@link resolveThemeFont}. `null`/absent leaves such a\n\t * token unresolved.\n\t */\n\tfontScheme?: Element | null\n\t/**\n\t * The notesMaster's `p:notesStyle` (a `CT_TextListStyle`), for resolving the\n\t * character properties a *notes-body* run inherits when it sets none of its own.\n\t * Only ever set on a notes context (see `resolveNotesColorContext`); on a slide\n\t * context it is absent, so the slide placeholder chain (layout/master\n\t * `a:lstStyle` → `p:txStyles`) is unaffected. It is the notes analogue of the\n\t * master `p:txStyles` category style, keyed by level rather than placeholder\n\t * type. Read-only — never mutated.\n\t */\n\tnotesStyle?: Element | null\n\t/**\n\t * The presentation's `p:defaultTextStyle` (a `CT_TextListStyle` from\n\t * `presentation.xml`), keyed by level — PowerPoint's lowest-priority text\n\t * fallback, applying to any run (placeholder or not) that resolves nothing\n\t * above it. Only ever set on a *slide* context (see `resolveSlideColorContext`);\n\t * absent on notes/master/layout contexts, so their chains are unaffected.\n\t * Read-only — never mutated.\n\t */\n\tdefaultTextStyle?: Element | null\n}\n\n/** Parse an `a:clrScheme` into slot → 6-hex RGB, reading `srgbClr`/`sysClr`. */\nexport function parseClrScheme(clrScheme: Element | null): Map<string, string> {\n\tconst out = new Map<string, string>()\n\tif (!clrScheme) return out\n\tfor (const slot of SCHEME_SLOTS) {\n\t\tconst slotEl = firstChild(clrScheme, `a:${slot}`)\n\t\tconst hex = slotEl && colorElementHex(firstChildElement(slotEl))\n\t\tif (hex) out.set(slot, hex)\n\t}\n\treturn out\n}\n\n/**\n * Parse the `bg1`/`tx1`/`bg2`/`tx2`/`accent*`/`hlink`/`folHlink` attributes of an\n * `a:clrMap` (or `a:overrideClrMapping`) into token → slot.\n */\nexport function parseClrMap(clrMap: Element | null): Map<string, string> {\n\tconst out = new Map<string, string>()\n\tif (!clrMap) return out\n\tfor (const token of [\n\t\t'bg1',\n\t\t'tx1',\n\t\t'bg2',\n\t\t'tx2',\n\t\t'accent1',\n\t\t'accent2',\n\t\t'accent3',\n\t\t'accent4',\n\t\t'accent5',\n\t\t'accent6',\n\t\t'hlink',\n\t\t'folHlink',\n\t]) {\n\t\tconst slot = attr(clrMap, token)\n\t\tif (slot) out.set(token, slot)\n\t}\n\treturn out\n}\n\n/** Resolve a scheme token (`accent1`, `bg1`, `dk1`, …) to a 6-hex RGB, or `null`. */\nexport function resolveSchemeToken(token: string, ctx: ColorContext): string | null {\n\tif (token === 'phClr') return null\n\tconst slot = DIRECT_SLOT_TOKENS.has(token) ? token : ctx.clrMap.get(token)\n\treturn slot ? (ctx.clrScheme.get(slot) ?? null) : null\n}\n\n/** Whether `el` is a DrawingML element with the given local name. */\nexport function isA(el: Element | null, local: string): boolean {\n\treturn !!el && el.namespaceURI === OOXML_NS.a && el.localName === local\n}\n\n/** The literal RGB of a colour element (`srgbClr`/`sysClr`), or `null` for others. */\nfunction colorElementHex(color: Element | null): string | null {\n\tif (!color) return null\n\tif (isA(color, 'srgbClr')) return attr(color, 'val')\n\tif (isA(color, 'sysClr')) return attr(color, 'lastClr') ?? attr(color, 'val')\n\treturn null\n}\n\n/** A colour reference resolved to a literal base RGB plus its transform children. */\nexport interface ResolvedColor {\n\thex: string\n\ttransforms: Element[]\n}\n\n/**\n * Resolve a DrawingML colour element to a literal `{ hex, transforms }`, routing\n * `a:schemeClr` through the context. Returns `null` when the base cannot be made\n * literal (unmapped token, or a colour model we do not flatten).\n */\nexport function resolveColor(color: Element | null, ctx: ColorContext): ResolvedColor | null {\n\tif (!color) return null\n\tconst transforms = childElements(color)\n\tif (isA(color, 'srgbClr')) {\n\t\tconst hex = attr(color, 'val')\n\t\treturn hex ? { hex, transforms } : null\n\t}\n\tif (isA(color, 'sysClr')) {\n\t\tconst hex = colorElementHex(color)\n\t\treturn hex ? { hex, transforms } : null\n\t}\n\tif (isA(color, 'schemeClr')) {\n\t\tconst token = attr(color, 'val')\n\t\tconst hex = token ? resolveSchemeToken(token, ctx) : null\n\t\treturn hex ? { hex, transforms } : null\n\t}\n\treturn null\n}\n\n/**\n * Resolve a `+mj-*`/`+mn-*` major/minor font token against a theme `a:fontScheme`\n * to a literal typeface name. A non-token `typeface` (an already-literal face) is\n * returned verbatim. `null` when `typeface` is absent, or when a token cannot be\n * resolved (no `fontScheme`, or the indexed major/minor script slot is empty).\n * The script suffix selects the scheme child: `lt`→`a:latin`, `ea`→`a:ea`,\n * `cs`→`a:cs`.\n */\nexport function resolveThemeFont(typeface: string | null, fontScheme: Element | null): string | null {\n\tif (!typeface) return null\n\tconst match = /^\\+(mj|mn)-(lt|ea|cs)$/.exec(typeface)\n\tif (!match) return typeface\n\tif (!fontScheme) return null\n\tconst font = firstChild(fontScheme, match[1] === 'mj' ? 'a:majorFont' : 'a:minorFont')\n\tconst childName = match[2] === 'lt' ? 'a:latin' : match[2] === 'ea' ? 'a:ea' : 'a:cs'\n\tconst child = font && firstChild(font, childName)\n\tconst resolved = child && attr(child, 'typeface')\n\treturn resolved || null\n}\n\n/** Replace every `phClr` under `el` with the ref colour (ref transforms first, then the `phClr`'s own). */\nexport function substitutePhClr(el: Element, ref: ResolvedColor): void {\n\tconst doc = ownerDocumentOf(el)\n\tfor (const phClr of descendantsByTag(el, OOXML_NS.a, 'schemeClr')) {\n\t\tif (attr(phClr, 'val') !== 'phClr') continue\n\t\tconst srgb = createElement(doc, 'a:srgbClr')\n\t\tsetAttr(srgb, 'val', ref.hex)\n\t\tfor (const t of ref.transforms) srgb.appendChild(t.cloneNode(true))\n\t\twhile (phClr.firstChild) srgb.appendChild(phClr.firstChild)\n\t\treplaceInParent(phClr, srgb)\n\t}\n}\n\n/** The `idx`-th entry (1-based) of a `fmtScheme` style list, deep-cloned, or `null`. */\nexport function fmtEntry(ctx: ThemeContext, listName: string, idx: number): Element | null {\n\tconst list = ctx.fmtScheme && firstChild(ctx.fmtScheme, listName)\n\tif (!list || idx < 1) return null\n\tconst entry = childElements(list)[idx - 1]\n\treturn entry ? (entry.cloneNode(true) as Element) : null\n}\n\n/**\n * Build the explicit fill element a `p:style` `a:fillRef` resolves to — the indexed\n * `fmtScheme` `fillStyleLst`/`bgFillStyleLst` entry (deep-cloned) with its `phClr`\n * replaced by the ref's resolved colour. Pure: mutates neither the ref nor the\n * theme. `null` when the ref is absent, `idx` is 0/unset, or the entry or its\n * colour cannot be resolved. Shared by the flatten path and the read-model\n * `resolveStyleFillColor` getter so both see the same fill.\n */\nexport function styleRefFill(fillRef: Element | null, ctx: ThemeContext): Element | null {\n\tif (!fillRef) return null\n\tconst idx = intAttr(fillRef, 'idx')\n\tif (idx === null || idx <= 0) return null\n\t// idx >= 1000 selects bgFillStyleLst (offset by 1000); otherwise fillStyleLst.\n\tconst fill = idx >= 1000 ? fmtEntry(ctx, 'a:bgFillStyleLst', idx - 1000) : fmtEntry(ctx, 'a:fillStyleLst', idx)\n\tconst ref = resolveColor(firstChildElement(fillRef), ctx)\n\tif (!fill || !ref) return null\n\tsubstitutePhClr(fill, ref)\n\treturn fill\n}\n\n/**\n * Build the explicit `a:ln` element a `p:style` `a:lnRef` resolves to — the indexed\n * `fmtScheme` `lnStyleLst` entry (deep-cloned) with its `phClr` replaced by the\n * ref's resolved colour. Pure; the line/read counterpart of {@link styleRefFill}.\n */\nexport function styleRefLine(lnRef: Element | null, ctx: ThemeContext): Element | null {\n\tif (!lnRef) return null\n\tconst idx = intAttr(lnRef, 'idx')\n\tif (idx === null || idx <= 0) return null\n\tconst ln = fmtEntry(ctx, 'a:lnStyleLst', idx)\n\tconst ref = resolveColor(firstChildElement(lnRef), ctx)\n\tif (!ln || !ref) return null\n\tsubstitutePhClr(ln, ref)\n\treturn ln\n}\n\n/** Read an integer attribute; `null`/empty/non-finite → `null`. */\nexport function intAttr(el: Element, name: string): number | null {\n\tconst value = attr(el, name)\n\tif (value === null || value === '') return null\n\tconst n = Number(value)\n\treturn Number.isFinite(n) ? n : null\n}\n","/**\n * Resolving what a placeholder shape *inherits* from its source layout/master chain.\n *\n * A placeholder that sets none of its own colour, size, geometry, anchor or list style takes\n * each from a chain: the layout placeholder's `a:lstStyle`, then the master placeholder's, then\n * the master's `p:txStyles` category style (and, on a notes context, the notesMaster\n * `p:notesStyle`). Every function here answers \"what would this placeholder get?\" — none of them\n * writes anything.\n *\n * **Two callers, one answer.** The read model's getters (`Run.resolvedColor`,\n * `TextFrame.resolvedAnchor`, the font getters) and the import-time flatten passes\n * (`read/api/ops/flatten.ts`, which bakes the inherited values onto a slide so they survive a\n * rebind to a different master) both ask the same questions. They must not answer them\n * differently: if the getter and the bake disagreed, a caller would see one colour before export\n * and another in the file. Sharing this module is what makes that structurally impossible.\n *\n * This module is pure — mutation lives in the flatten pass, which is also why it sits in\n * `read/oxml/` (substrate) rather than `read/api/ops/`.\n */\n\nimport { attr, descendantsByTag, firstChild, firstChildElement, OOXML_NS, type Element } from './dom.js'\nimport { FILL_CHOICES } from './fill.js'\nimport { resolveColor, type ResolvedColor, type ThemeContext } from './theme.js'\n\n/** The master `p:txStyles` style element name for a placeholder category. */\nconst TX_STYLE_NAME: Record<'title' | 'body' | 'other', string> = {\n\ttitle: 'p:titleStyle',\n\tbody: 'p:bodyStyle',\n\tother: 'p:otherStyle',\n}\n\n/** The ordered children of a `CT_TextListStyle` (`a:lstStyle` / a `p:txStyles` style). */\nexport const LST_STYLE_LEVELS = [\n\t'a:defPPr',\n\t'a:lvl1pPr',\n\t'a:lvl2pPr',\n\t'a:lvl3pPr',\n\t'a:lvl4pPr',\n\t'a:lvl5pPr',\n\t'a:lvl6pPr',\n\t'a:lvl7pPr',\n\t'a:lvl8pPr',\n\t'a:lvl9pPr',\n]\n\n/** Inheritable run properties baked under `preserve`: size and weight/slant (not typeface). */\nexport const RUN_PROP_NAMES = ['sz', 'b', 'i'] as const\nexport type RunProps = Record<(typeof RUN_PROP_NAMES)[number], string | null>\n\n/** The `p:ph` element of a shape (`p:sp/p:nvSpPr/p:nvPr/p:ph`), or `null`. */\nexport function placeholderOf(sp: Element): Element | null {\n\tconst nvSpPr = firstChild(sp, 'p:nvSpPr')\n\tconst nvPr = nvSpPr && firstChild(nvSpPr, 'p:nvPr')\n\treturn nvPr ? firstChild(nvPr, 'p:ph') : null\n}\n\n/**\n * The master text-style *category* a placeholder type resolves against\n * (absent ⇒ `obj` ⇒ body). This is a `p:txStyles` selector — it picks\n * `p:titleStyle`/`p:bodyStyle`/`p:otherStyle` (see {@link TX_STYLE_NAME}) and\n * deliberately collapses `dt`/`ftr`/`sldNum`/`hdr` (and anything else) into\n * `'other'`. It is **not** a placeholder *identity* predicate: it must not be\n * used to decide which source placeholder a slide placeholder inherits geometry\n * from, or the footer trio become mutually interchangeable — use the exact\n * `type` match in {@link findPlaceholder} for that.\n */\nexport function phCategory(type: string | null): 'title' | 'body' | 'other' {\n\tif (type === 'title' || type === 'ctrTitle') return 'title'\n\tif (type === null || type === 'body' || type === 'subTitle' || type === 'obj') return 'body'\n\treturn 'other'\n}\n\n/**\n * Placeholder types of which a layout/master holds at most one, and whose\n * identity is their `type` alone: `dt`, `ftr`, `sldNum`, `hdr`. A slide\n * placeholder of one of these types must inherit **only** from a source\n * placeholder of the *same type* — never via `idx` or the txStyles *category*,\n * both of which lump the whole trio together and would let `sldNum` borrow the\n * footer's box (and vice versa).\n */\nconst SINGLETON_PH = new Set(['dt', 'ftr', 'sldNum', 'hdr'])\n\n/**\n * The placeholder shape in `root` (a layout/master) that the given slide\n * placeholder inherits from.\n *\n * A singleton-type slide placeholder (`dt`/`ftr`/`sldNum`/`hdr`) matches only an\n * exact same-`type` source placeholder — PowerPoint gives the trio different\n * `idx` on the layout (dt=10/ftr=11/sldNum=12) than the master (dt=2/ftr=3/\n * sldNum=4), so an `idx`- or category-based fallback would silently pick the\n * wrong member of the trio. Every other type prefers a same-`idx` placeholder of\n * the same category, then any same-`idx`, then any same-category, and never\n * lands on a singleton placeholder. Returns `null` when nothing matches.\n */\nexport function findPlaceholder(root: Element, slideType: string | null, slideIdx: string): Element | null {\n\tif (slideType && SINGLETON_PH.has(slideType)) {\n\t\tfor (const sp of descendantsByTag(root, OOXML_NS.p, 'sp')) {\n\t\t\tconst ph = placeholderOf(sp)\n\t\t\tif (ph && attr(ph, 'type') === slideType) return sp\n\t\t}\n\t\treturn null\n\t}\n\tconst cat = phCategory(slideType)\n\tlet idxMatch: Element | null = null\n\tlet catMatch: Element | null = null\n\tfor (const sp of descendantsByTag(root, OOXML_NS.p, 'sp')) {\n\t\tconst ph = placeholderOf(sp)\n\t\tif (!ph) continue\n\t\tconst type = attr(ph, 'type')\n\t\tif (type && SINGLETON_PH.has(type)) continue // a non-singleton must never inherit from the footer trio\n\t\tconst i = attr(ph, 'idx') ?? '0'\n\t\tconst sameCat = phCategory(type) === cat\n\t\tif (i === slideIdx && sameCat) return sp\n\t\tif (i === slideIdx && !idxMatch) idxMatch = sp\n\t\tif (sameCat && !catMatch) catMatch = sp\n\t}\n\treturn idxMatch ?? catMatch\n}\n\n/** The `a:lstStyle` of a placeholder shape's `p:txBody`, or `null`. */\nfunction placeholderLstStyle(sp: Element): Element | null {\n\tconst txBody = firstChild(sp, 'p:txBody')\n\treturn txBody ? firstChild(txBody, 'a:lstStyle') : null\n}\n\n/**\n * The `a:defRPr` for `level` (0-based) in a `CT_TextListStyle` (`a:lstStyle` or a\n * `p:txStyles` style): the level-specific `a:lvlNpPr/a:defRPr`, else the\n * `a:defPPr/a:defRPr` fallback. The shared root for colour and size resolution.\n */\nexport function lstStyleLevelDefRPr(listStyle: Element | null, level: number): Element | null {\n\tif (!listStyle) return null\n\tconst lvl = firstChild(listStyle, `a:lvl${level + 1}pPr`) ?? firstChild(listStyle, 'a:defPPr')\n\treturn lvl ? firstChild(lvl, 'a:defRPr') : null\n}\n\n/** The `a:solidFill` of a level's `a:defRPr`, or `null` when none is defined there. */\nexport function lstStyleLevelFill(listStyle: Element | null, level: number): Element | null {\n\tconst defRPr = lstStyleLevelDefRPr(listStyle, level)\n\treturn defRPr ? firstChild(defRPr, 'a:solidFill') : null\n}\n\n/**\n * The source style tiers a placeholder resolves against, most specific first: the layout\n * placeholder's `a:lstStyle`, the master placeholder's, then the master `p:txStyles` category\n * style — and, on a notes context only, the notesMaster `p:notesStyle`.\n *\n * The one place the chain is spelled out. `placeholderInherited*` differ only in what they pull\n * from each tier, so they all walk this.\n */\nfunction styleTiers(type: string | null, idx: string, ctx: ThemeContext): Element[] {\n\tconst tiers: (Element | null)[] = []\n\tif (ctx.layoutRoot) {\n\t\tconst layoutPh = findPlaceholder(ctx.layoutRoot, type, idx)\n\t\ttiers.push(layoutPh && placeholderLstStyle(layoutPh))\n\t}\n\tif (ctx.masterRoot) {\n\t\tconst masterPh = findPlaceholder(ctx.masterRoot, type, idx)\n\t\ttiers.push(masterPh && placeholderLstStyle(masterPh))\n\t\tconst txStyles = firstChild(ctx.masterRoot, 'p:txStyles')\n\t\ttiers.push(txStyles && firstChild(txStyles, TX_STYLE_NAME[phCategory(type)]))\n\t}\n\t// Notes body runs inherit from the notesMaster's `p:notesStyle` (keyed by level, not\n\t// placeholder type); it is the bottom tier of the notes chain — see the field note on\n\t// `ThemeContext.notesStyle`. Never set on a slide context.\n\tif (ctx.notesStyle) tiers.push(ctx.notesStyle)\n\treturn tiers.filter((t): t is Element => t !== null)\n}\n\n/**\n * The colour *element* a placeholder run inherits from the source style chain. Returns the\n * first tier's colour element that resolves against `ctx` (the `a:srgbClr`/`a:schemeClr`/…\n * inside its `a:solidFill`), or `null` when nothing in the chain defines a resolvable colour.\n * The read-model `Run.resolvedColor` getter feeds this element to `resolveColorElement` for the\n * `effectiveHex`; the flatten path resolves it directly via {@link placeholderInheritedColor}.\n */\nexport function placeholderInheritedFill(\n\ttype: string | null,\n\tidx: string,\n\tlevel: number,\n\tctx: ThemeContext\n): Element | null {\n\tfor (const tier of styleTiers(type, idx, ctx)) {\n\t\tconst fill = lstStyleLevelFill(tier, level)\n\t\tconst colorEl = fill && firstChildElement(fill)\n\t\tif (colorEl && resolveColor(colorEl, ctx)) return colorEl\n\t}\n\treturn null\n}\n\n/**\n * The level `a:defRPr` elements a placeholder inherits from the source style chain, in\n * resolution order. Tiers with no `a:defRPr` for `level` are dropped. The shared root for\n * inherited run *size* and *typeface* resolution (the size/face sibling of\n * {@link placeholderInheritedFill}), read directly by the flatten path and the read-model font\n * getters.\n */\nexport function placeholderInheritedDefRPrs(\n\ttype: string | null,\n\tidx: string,\n\tlevel: number,\n\tctx: ThemeContext\n): Element[] {\n\treturn styleTiers(type, idx, ctx)\n\t\t.map((tier) => lstStyleLevelDefRPr(tier, level))\n\t\t.filter((t): t is Element => t !== null)\n}\n\n/**\n * The source list-style tiers a placeholder inherits paragraph formatting from, most specific\n * first. The paragraph-level sibling of {@link placeholderInheritedDefRPrs} — it hands back the\n * tier elements whole rather than pulling one level's properties out of each.\n *\n * The notes tier is included for consistency with the rest of the chain, though it cannot arise\n * in practice: the only caller is the list-style bake in `flattenShape`, which runs on slide and\n * shape contexts, and `ctx.notesStyle` is set only on a notes context.\n */\nexport function placeholderInheritedListStyles(type: string | null, idx: string, ctx: ThemeContext): Element[] {\n\treturn styleTiers(type, idx, ctx)\n}\n\n/**\n * The colour a placeholder run inherits from the source style chain, resolved to a\n * literal `{ hex, transforms }`. Thin wrapper over {@link placeholderInheritedFill}\n * for the flatten path, which re-emits the transforms verbatim. Returns `null`\n * when nothing in the chain defines a resolvable colour (the run then re-binds to\n * the destination).\n */\nexport function placeholderInheritedColor(\n\ttype: string | null,\n\tidx: string,\n\tlevel: number,\n\tctx: ThemeContext\n): ResolvedColor | null {\n\tconst colorEl = placeholderInheritedFill(type, idx, level, ctx)\n\treturn colorEl ? resolveColor(colorEl, ctx) : null\n}\n\n/**\n * The run size/weight a placeholder run inherits from the source style chain, per list level.\n * Each of `sz`/`b`/`i` is taken from the first tier that defines it (properties resolve\n * independently). Returns `null` when no tier defines any of them.\n */\nexport function placeholderInheritedRunProps(\n\ttype: string | null,\n\tidx: string,\n\tlevel: number,\n\tctx: ThemeContext\n): RunProps | null {\n\tconst tiers = placeholderInheritedDefRPrs(type, idx, level, ctx)\n\tconst props = {} as RunProps\n\tlet any = false\n\tfor (const name of RUN_PROP_NAMES) {\n\t\tlet value: string | null = null\n\t\tfor (const tier of tiers) {\n\t\t\tvalue = attr(tier, name)\n\t\t\tif (value != null) break\n\t\t}\n\t\tprops[name] = value\n\t\tif (value != null) any = true\n\t}\n\treturn any ? props : null\n}\n\n/**\n * The `a:xfrm` a placeholder inherits from the source layout, then master,\n * tagged with which tier it came from — `null` when neither defines one. The\n * read-model `resolveInheritedFrame` (`theme-context.ts`) sibling of\n * {@link placeholderInheritedAnchor}; also the bake source for the flatten pass'\n * `resolvePlaceholderGeometry`.\n */\nexport function placeholderInheritedXfrm(\n\ttype: string | null,\n\tidx: string,\n\tctx: ThemeContext\n): { xfrm: Element; source: 'layout' | 'master' } | null {\n\tfor (const [root, source] of [\n\t\t[ctx.layoutRoot, 'layout'],\n\t\t[ctx.masterRoot, 'master'],\n\t] as const) {\n\t\tif (!root) continue\n\t\tconst ph = findPlaceholder(root, type, idx)\n\t\tconst spPr = ph && firstChild(ph, 'p:spPr')\n\t\tconst xfrm = spPr && firstChild(spPr, 'a:xfrm')\n\t\tif (xfrm) return { xfrm, source }\n\t}\n\treturn null\n}\n\n/**\n * The vertical anchor (`a:bodyPr/@anchor`) a placeholder inherits from the source\n * layout, then master, or `null`. Resolves per-attribute: the first tier whose\n * placeholder `a:bodyPr` actually sets `@anchor` wins, so a layout `a:bodyPr`\n * present but without `@anchor` does not mask the master's. The read-model\n * `TextFrame.resolvedAnchor` sibling of {@link placeholderInheritedXfrm}.\n */\nexport function placeholderInheritedAnchor(type: string | null, idx: string, ctx: ThemeContext): string | null {\n\tfor (const root of [ctx.layoutRoot, ctx.masterRoot]) {\n\t\tif (!root) continue\n\t\tconst ph = findPlaceholder(root, type, idx)\n\t\tconst txBody = ph && firstChild(ph, 'p:txBody')\n\t\tconst bodyPr = txBody && firstChild(txBody, 'a:bodyPr')\n\t\tconst anchor = bodyPr && attr(bodyPr, 'anchor')\n\t\tif (anchor) return anchor\n\t}\n\treturn null\n}\n\n/** Whether the *slide itself* already fixes this run's colour (so a rebind cannot change it). */\nexport function slideDefinesColor(run: Element, pPr: Element | null, slideLst: Element | null, level: number): boolean {\n\tconst rPr = firstChild(run, 'a:rPr')\n\tif (rPr && FILL_CHOICES.some((q) => firstChild(rPr, q))) return true\n\tconst defRPr = pPr && firstChild(pPr, 'a:defRPr')\n\tif (defRPr && firstChild(defRPr, 'a:solidFill')) return true\n\treturn !!lstStyleLevelFill(slideLst, level)\n}\n\n/** Whether the *slide itself* already fixes a run property (so a rebind cannot change it). */\nexport function slideDefinesProp(\n\tname: string,\n\trun: Element,\n\tpPr: Element | null,\n\tslideLst: Element | null,\n\tlevel: number\n): boolean {\n\tconst rPr = firstChild(run, 'a:rPr')\n\tif (rPr && attr(rPr, name) != null) return true\n\tconst defRPr = pPr && firstChild(pPr, 'a:defRPr')\n\tif (defRPr && attr(defRPr, name) != null) return true\n\tconst slideDefRPr = lstStyleLevelDefRPr(slideLst, level)\n\treturn !!(slideDefRPr && attr(slideDefRPr, name) != null)\n}\n","/**\n * Apply DrawingML colour-transform modifiers (`lumMod`/`lumOff`/`shade`/`tint`/\n * `satMod`/`alpha`/…) to a base sRGB colour, returning the *effective* colour a\n * renderer would paint.\n *\n * The read model resolves a `schemeClr`/`srgbClr` reference to its **base** hex\n * and carries the transform children verbatim (so the `theme: 'preserve'` flatten\n * path can re-emit them byte-for-byte). This module is the missing step that\n * turns that base hex + transform list into the final rendered hex, so a consumer\n * never hand-computes a tint/shade again.\n *\n * Colour-space model (verified against PowerPoint output — see\n * `test/read/color-transform.test.js`): the working colour is kept canonical as\n * sRGB between transforms; each transform converts into the space its family\n * operates in, applies, and converts back to sRGB. Transforms apply in **document\n * order** (ECMA-376 §20.1.2.3).\n *\n * - `lumMod` / `lumOff` — luminance (L) in HSL: `L' = L·mod + off`. PowerPoint's\n * \"Lighter/Darker N%\" family.\n * - `satMod` / `satOff` — saturation (S) in HSL.\n * - `hueMod` / `hueOff` — hue (H) in HSL (`hueMod` scales, `hueOff` offsets by\n * degrees). Not exercised by any current source; implemented for completeness.\n * - `shade` — toward black in **linear** RGB: `c' = c·k`.\n * - `tint` — toward white in **linear** RGB: `c' = c·k + (1−k)`.\n * - `alpha` / `alphaMod` / `alphaOff` — opacity, returned alongside the hex\n * (never folded into RGB).\n * - `comp` / `inv` / `gray` / `gamma` / `invGamma` — pass-through for now (no\n * current source needs them; add when one does).\n *\n * All DrawingML percentage values are stored in thousandths of a percent\n * (`100%` → `100000`), so a modifier's fraction is `val / 100000`.\n */\n\n/** A colour-transform modifier in its read-model form: tag local-name + raw `@val`. */\nexport interface ColorTransform {\n\tname: string\n\tvalue: string | null\n}\n\n/** The effective colour after applying transforms: final sRGB hex, plus opacity when an `alpha*` modifier was present. */\nexport interface EffectiveColor {\n\thex: string\n\talpha?: number\n}\n\n/** DrawingML percentage (`100%` = `100000`) → fraction, or `null` when unparseable. */\nfunction pct(value: string | null): number | null {\n\tif (value === null || value === '') return null\n\tconst n = Number(value)\n\treturn Number.isFinite(n) ? n / 100000 : null\n}\n\nconst clamp01 = (n: number): number => (n < 0 ? 0 : n > 1 ? 1 : n)\n\n/** Parse a 6-hex string (`RRGGBB`, optional `#`) into 0–1 sRGB channels, or `null`. */\nfunction parseHex(hex: string): { r: number; g: number; b: number } | null {\n\tconst h = hex.startsWith('#') ? hex.slice(1) : hex\n\tif (!/^[0-9a-fA-F]{6}$/.test(h)) return null\n\treturn {\n\t\tr: parseInt(h.slice(0, 2), 16) / 255,\n\t\tg: parseInt(h.slice(2, 4), 16) / 255,\n\t\tb: parseInt(h.slice(4, 6), 16) / 255,\n\t}\n}\n\n/** 0–1 sRGB channels → uppercase `RRGGBB`, rounding and clamping each channel. */\nfunction toHex(c: { r: number; g: number; b: number }): string {\n\tconst ch = (v: number): string =>\n\t\tMath.round(clamp01(v) * 255)\n\t\t\t.toString(16)\n\t\t\t.toUpperCase()\n\t\t\t.padStart(2, '0')\n\treturn `${ch(c.r)}${ch(c.g)}${ch(c.b)}`\n}\n\n/** sRGB channel (0–1) → linear-light (gamma decode). */\nfunction srgbToLinear(c: number): number {\n\treturn c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4)\n}\n\n/** Linear-light channel (0–1) → sRGB (gamma encode). */\nfunction linearToSrgb(c: number): number {\n\treturn c <= 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055\n}\n\n/** sRGB (0–1) → HSL with H in degrees [0,360), S/L in [0,1]. */\nfunction rgbToHsl(c: { r: number; g: number; b: number }): { h: number; s: number; l: number } {\n\tconst { r, g, b } = c\n\tconst max = Math.max(r, g, b)\n\tconst min = Math.min(r, g, b)\n\tconst l = (max + min) / 2\n\tconst d = max - min\n\tif (d === 0) return { h: 0, s: 0, l }\n\tconst s = d / (1 - Math.abs(2 * l - 1))\n\tlet h: number\n\tif (max === r) h = ((g - b) / d) % 6\n\telse if (max === g) h = (b - r) / d + 2\n\telse h = (r - g) / d + 4\n\th *= 60\n\tif (h < 0) h += 360\n\treturn { h, s, l }\n}\n\n/** HSL (H degrees, S/L 0–1) → sRGB (0–1). */\nfunction hslToRgb({ h, s, l }: { h: number; s: number; l: number }): { r: number; g: number; b: number } {\n\tconst c = (1 - Math.abs(2 * l - 1)) * s\n\tconst hp = (((h % 360) + 360) % 360) / 60\n\tconst x = c * (1 - Math.abs((hp % 2) - 1))\n\tconst [r, g, b] =\n\t\thp < 1 ? [c, x, 0] : hp < 2 ? [x, c, 0] : hp < 3 ? [0, c, x] : hp < 4 ? [0, x, c] : hp < 5 ? [x, 0, c] : [c, 0, x]\n\tconst m = l - c / 2\n\treturn { r: r + m, g: g + m, b: b + m }\n}\n\n/**\n * Apply an ordered list of DrawingML colour transforms to a base sRGB hex,\n * returning the effective sRGB hex (and opacity, when an `alpha*` modifier set\n * it). Pure: no DOM, no theme lookup — the caller has already resolved the base\n * colour and extracted each modifier's `{ name, value }`.\n *\n * An unparseable base hex is returned unchanged (with no transforms applied); an\n * unparseable/`null` modifier value is skipped.\n */\nexport function applyColorTransforms(baseHex: string, transforms: ColorTransform[]): EffectiveColor {\n\tconst parsed = parseHex(baseHex)\n\tif (!parsed) return { hex: baseHex }\n\tlet rgb = parsed\n\tlet alpha: number | undefined\n\n\tfor (const { name, value } of transforms) {\n\t\tswitch (name) {\n\t\t\tcase 'lumMod':\n\t\t\tcase 'lumOff': {\n\t\t\t\tconst f = pct(value)\n\t\t\t\tif (f === null) break\n\t\t\t\tconst hsl = rgbToHsl(rgb)\n\t\t\t\thsl.l = clamp01(name === 'lumMod' ? hsl.l * f : hsl.l + f)\n\t\t\t\trgb = hslToRgb(hsl)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'satMod':\n\t\t\tcase 'satOff': {\n\t\t\t\tconst f = pct(value)\n\t\t\t\tif (f === null) break\n\t\t\t\tconst hsl = rgbToHsl(rgb)\n\t\t\t\thsl.s = clamp01(name === 'satMod' ? hsl.s * f : hsl.s + f)\n\t\t\t\trgb = hslToRgb(hsl)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'hueMod':\n\t\t\tcase 'hueOff': {\n\t\t\t\tconst hsl = rgbToHsl(rgb)\n\t\t\t\t// hueMod is a percentage scale; hueOff is an angle in 60000ths of a degree.\n\t\t\t\tif (name === 'hueMod') {\n\t\t\t\t\tconst f = pct(value)\n\t\t\t\t\tif (f === null) break\n\t\t\t\t\thsl.h = (((hsl.h * f) % 360) + 360) % 360\n\t\t\t\t} else {\n\t\t\t\t\tconst n = value === null ? NaN : Number(value)\n\t\t\t\t\tif (!Number.isFinite(n)) break\n\t\t\t\t\thsl.h = (((hsl.h + n / 60000) % 360) + 360) % 360\n\t\t\t\t}\n\t\t\t\trgb = hslToRgb(hsl)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'shade':\n\t\t\tcase 'tint': {\n\t\t\t\tconst k = pct(value)\n\t\t\t\tif (k === null) break\n\t\t\t\tconst lin = { r: srgbToLinear(rgb.r), g: srgbToLinear(rgb.g), b: srgbToLinear(rgb.b) }\n\t\t\t\tconst apply = (c: number): number => clamp01(name === 'shade' ? c * k : c * k + (1 - k))\n\t\t\t\trgb = { r: linearToSrgb(apply(lin.r)), g: linearToSrgb(apply(lin.g)), b: linearToSrgb(apply(lin.b)) }\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'alpha': {\n\t\t\t\tconst f = pct(value)\n\t\t\t\tif (f !== null) alpha = clamp01(f)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'alphaMod': {\n\t\t\t\tconst f = pct(value)\n\t\t\t\tif (f !== null) alpha = clamp01((alpha ?? 1) * f)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'alphaOff': {\n\t\t\t\tconst f = pct(value)\n\t\t\t\tif (f !== null) alpha = clamp01((alpha ?? 1) + f)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// comp/inv/gray/gamma/invGamma: pass-through until a source needs them.\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\treturn alpha === undefined ? { hex: toHex(rgb) } : { hex: toHex(rgb), alpha }\n}\n","/**\n * Resolve a slide's theme colour context: the slide → slideLayout → slideMaster\n * → theme walk that turns a `schemeClr` token into a literal hex, plus the\n * `a:solidFill` helper the read-model colour getters share.\n *\n * One implementation backs two callers — the read-model getters\n * (`Slide.themeContext` → `Shape.resolvedFill` / `Run.resolvedColor`) and the\n * `importSlide` `theme: 'preserve'` flatten path, which layers its `fmtScheme` /\n * background needs on top of {@link resolveSlideThemeParts} — so a token resolves\n * identically whether it is read or baked.\n */\nimport { applyColorTransforms } from '../oxml/color-transform.js'\nimport { attr, firstChild, firstChildElement, intValue, type Element } from '../oxml/dom.js'\nimport {\n\tparseClrMap,\n\tparseClrScheme,\n\tresolveColor,\n\tresolveThemeFont,\n\tstyleRefFill,\n\tstyleRefLine,\n\ttype ColorContext,\n\ttype ThemeContext,\n} from '../oxml/theme.js'\nimport {\n\tlstStyleLevelDefRPr,\n\tlstStyleLevelFill,\n\tplaceholderInheritedAnchor,\n\tplaceholderInheritedDefRPrs,\n\tplaceholderInheritedFill,\n\tplaceholderInheritedXfrm,\n} from '../oxml/placeholder-inherit.js'\nimport type { OpcPackage } from '../opc/package.js'\nimport { resolveSingleRel } from '../opc/partnames.js'\nimport {\n\tNOTES_MASTER_REL,\n\tOFFICE_DOCUMENT_REL,\n\tSLIDE_LAYOUT_REL,\n\tSLIDE_MASTER_REL,\n\tTHEME_REL,\n} from '../../ooxml/rel-types.js'\n\n/** The resolved theme subgraph a slide depends on, plus its parsed colour maps. */\ninterface SlideThemeParts extends ColorContext {\n\tslideRoot: Element | null\n\tlayoutPartName: string | null\n\tmasterPartName: string | null\n\tlayoutRoot: Element | null\n\tmasterRoot: Element | null\n\t/**\n\t * Partname of the theme part the chain bottoms out in, or `null`. Callers that\n\t * materialize a fill out of the theme (a `p:bgRef`'s `fmtScheme` entry) need it to\n\t * resolve that fill's relationship ids against the *theme's* rels.\n\t */\n\tthemePartName: string | null\n\t/** The theme's `a:themeElements`, for callers that also need `a:fmtScheme`. */\n\tthemeElements: Element | null\n}\n\n/** The document element of a part, or `null` when the partname/part is absent. */\nfunction documentElement(opc: OpcPackage, partName: string | null): Element | null {\n\treturn partName ? (opc.part(partName)?.dom.documentElement ?? null) : null\n}\n\n/**\n * The presentation's `p:defaultTextStyle` (`presentation.xml`, reached via the\n * package `officeDocument` relationship), or `null` when absent. This is\n * PowerPoint's lowest-priority text fallback — the bottom tier of a slide run's\n * size/colour/face/bold resolution (see `ThemeContext.defaultTextStyle`).\n */\nfunction presentationDefaultTextStyle(opc: OpcPackage): Element | null {\n\tconst root = documentElement(opc, resolveSingleRel(opc, '/', OFFICE_DOCUMENT_REL))\n\treturn root ? firstChild(root, 'p:defaultTextStyle') : null\n}\n\n/**\n * Walk slide → slideLayout → slideMaster → theme, returning the resolved part\n * roots plus the parsed colour map (`clrMap`, honouring the slide's `clrMapOvr`)\n * and colour scheme (`clrScheme`). A missing link degrades to `null` roots and\n * empty maps rather than throwing.\n */\nexport function resolveSlideThemeParts(opc: OpcPackage, slidePartName: string): SlideThemeParts {\n\tconst layoutPartName = resolveSingleRel(opc, slidePartName, SLIDE_LAYOUT_REL)\n\tconst masterPartName = layoutPartName ? resolveSingleRel(opc, layoutPartName, SLIDE_MASTER_REL) : null\n\tconst themePartName = masterPartName ? resolveSingleRel(opc, masterPartName, THEME_REL) : null\n\n\tconst slideRoot = documentElement(opc, slidePartName)\n\tconst layoutRoot = documentElement(opc, layoutPartName)\n\tconst masterRoot = documentElement(opc, masterPartName)\n\tconst themeRoot = documentElement(opc, themePartName)\n\n\t// A slide's clrMapOvr/overrideClrMapping (if present) wins over the master map.\n\tconst masterClrMap = masterRoot ? firstChild(masterRoot, 'p:clrMap') : null\n\tconst clrMapOvr = slideRoot ? firstChild(slideRoot, 'p:clrMapOvr') : null\n\tconst override = clrMapOvr ? firstChild(clrMapOvr, 'a:overrideClrMapping') : null\n\tconst themeElements = themeRoot ? firstChild(themeRoot, 'a:themeElements') : null\n\n\treturn {\n\t\tslideRoot,\n\t\tlayoutPartName,\n\t\tmasterPartName,\n\t\tlayoutRoot,\n\t\tmasterRoot,\n\t\tthemePartName,\n\t\tthemeElements,\n\t\tclrMap: parseClrMap(override ?? masterClrMap),\n\t\tclrScheme: parseClrScheme(themeElements ? firstChild(themeElements, 'a:clrScheme') : null),\n\t}\n}\n\n/**\n * The colour context a slide's read-model getters resolve against: the\n * {@link ColorContext} maps plus the theme's `a:fmtScheme` (so a colour delivered\n * through a shape's `p:style` `fillRef`/`lnRef` can be resolved like the\n * `theme: 'preserve'` flatten path does). The `fmtScheme` is `null` when the\n * slide's theme is missing.\n */\nexport function resolveSlideColorContext(opc: OpcPackage, slidePartName: string): ThemeContext {\n\tconst { clrMap, clrScheme, themeElements, layoutRoot, masterRoot } = resolveSlideThemeParts(opc, slidePartName)\n\treturn {\n\t\tclrMap,\n\t\tclrScheme,\n\t\tfmtScheme: themeElements ? firstChild(themeElements, 'a:fmtScheme') : null,\n\t\t// The fontScheme lets the run font getters resolve a +mj-*/+mn-* token (the\n\t\t// placeholder-inherited typeface chain bottoms out in one) to a literal face.\n\t\tfontScheme: themeElements ? firstChild(themeElements, 'a:fontScheme') : null,\n\t\t// layout/master roots let the read-model run-colour/size/face getters resolve\n\t\t// a placeholder-inherited value the same way the flatten path does.\n\t\tlayoutRoot,\n\t\tmasterRoot,\n\t\t// The presentation's default text style — the lowest-priority tier a slide run\n\t\t// (placeholder or not) falls back to when it resolves nothing above it.\n\t\tdefaultTextStyle: presentationDefaultTextStyle(opc),\n\t}\n}\n\n/**\n * The colour context a slide's *speaker-notes* getters resolve against. A notes\n * slide inherits its theme through its notesMaster (`notesSlideN.xml.rels`\n * carries the `notesMaster` relationship), which in turn points at the notes\n * theme (`theme2.xml`). Walk notesSlide → notesMaster → theme, taking `clrMap`\n * from the notesMaster's own `p:clrMap` and `clrScheme`/`fontScheme` from that\n * theme, so a notes run's own `schemeClr` fill resolves to a literal hex the same\n * way a slide run's does (backing `Run.resolvedColor` on {@link Slide.notesTextFrame}).\n *\n * Notes runs inherit character properties from the notesMaster's `p:notesStyle`,\n * not from a slide layout/master placeholder chain, so `layoutRoot`/`masterRoot`\n * are deliberately left absent. Instead the notesMaster's `p:notesStyle` is carried\n * as `notesStyle`, and the notes body `TextFrame` is built with a placeholder\n * context (see {@link import('./notes.js').NotesPlaceholder}) so a body run's\n * effective size/face/bold (and inherited colour) resolve against it — the notes\n * analogue of the slide placeholder chain. The maps are empty when the\n * notesMaster/theme chain is incomplete, in which case tokens stay unresolved.\n */\nexport function resolveNotesColorContext(opc: OpcPackage, notesPartName: string): ThemeContext {\n\tconst masterPartName = resolveSingleRel(opc, notesPartName, NOTES_MASTER_REL)\n\tconst themePartName = masterPartName ? resolveSingleRel(opc, masterPartName, THEME_REL) : null\n\tconst masterRoot = documentElement(opc, masterPartName)\n\tconst themeRoot = documentElement(opc, themePartName)\n\tconst themeElements = themeRoot ? firstChild(themeRoot, 'a:themeElements') : null\n\treturn {\n\t\tclrMap: parseClrMap(masterRoot ? firstChild(masterRoot, 'p:clrMap') : null),\n\t\tclrScheme: parseClrScheme(themeElements ? firstChild(themeElements, 'a:clrScheme') : null),\n\t\tfmtScheme: themeElements ? firstChild(themeElements, 'a:fmtScheme') : null,\n\t\t// The fontScheme lets a notes run resolve a +mj-*/+mn-* theme-font token to a\n\t\t// literal face; the writer's notesStyle uses +mn-lt, so an authored notes run\n\t\t// that omits its own face resolves through here.\n\t\tfontScheme: themeElements ? firstChild(themeElements, 'a:fontScheme') : null,\n\t\t// The notesMaster's text style — the tier a notes-body run's inherited\n\t\t// size/face/bold/colour resolves against (see `ThemeContext.notesStyle`).\n\t\tnotesStyle: masterRoot ? firstChild(masterRoot, 'p:notesStyle') : null,\n\t}\n}\n\n/**\n * The colour context a *slide master*'s own getters resolve against: the master's\n * `p:clrMap` plus its theme's `clrScheme`/`fmtScheme`/`fontScheme` (walked master →\n * theme). Backs the text frames of {@link import('./chrome.js').SlideMaster}'s\n * placeholders — a master placeholder run's own `schemeClr` resolves to a literal\n * hex the same way a slide run's does. `masterRoot` is carried so an inherited\n * placeholder value still resolves against the master's own text styles. The maps\n * are empty when the theme is missing, in which case tokens stay unresolved.\n */\nexport function resolveMasterColorContext(opc: OpcPackage, masterPartName: string): ThemeContext {\n\tconst themePartName = resolveSingleRel(opc, masterPartName, THEME_REL)\n\tconst masterRoot = documentElement(opc, masterPartName)\n\tconst themeElements = themeElementsOf(opc, themePartName)\n\treturn {\n\t\tclrMap: parseClrMap(masterRoot ? firstChild(masterRoot, 'p:clrMap') : null),\n\t\tclrScheme: parseClrScheme(themeElements ? firstChild(themeElements, 'a:clrScheme') : null),\n\t\tfmtScheme: themeElements ? firstChild(themeElements, 'a:fmtScheme') : null,\n\t\tfontScheme: themeElements ? firstChild(themeElements, 'a:fontScheme') : null,\n\t\tmasterRoot,\n\t}\n}\n\n/**\n * The colour context a *slide layout*'s own getters resolve against: walk layout →\n * master → theme. The effective `clrMap` is the layout's own\n * `p:clrMapOvr/a:overrideClrMapping` when present (rare), else the master's\n * `p:clrMap` — the layout's usual `a:masterClrMapping` means \"inherit the master\n * map\". `clrScheme`/`fmtScheme`/`fontScheme` come from the master's theme, and both\n * `layoutRoot`/`masterRoot` are carried for inherited-placeholder resolution. Backs\n * the text frames of {@link import('./chrome.js').SlideLayout}'s placeholders.\n */\nexport function resolveLayoutColorContext(opc: OpcPackage, layoutPartName: string): ThemeContext {\n\tconst masterPartName = resolveSingleRel(opc, layoutPartName, SLIDE_MASTER_REL)\n\tconst themePartName = masterPartName ? resolveSingleRel(opc, masterPartName, THEME_REL) : null\n\tconst layoutRoot = documentElement(opc, layoutPartName)\n\tconst masterRoot = documentElement(opc, masterPartName)\n\tconst themeElements = themeElementsOf(opc, themePartName)\n\tconst masterClrMap = masterRoot ? firstChild(masterRoot, 'p:clrMap') : null\n\tconst clrMapOvr = layoutRoot ? firstChild(layoutRoot, 'p:clrMapOvr') : null\n\tconst override = clrMapOvr ? firstChild(clrMapOvr, 'a:overrideClrMapping') : null\n\treturn {\n\t\tclrMap: parseClrMap(override ?? masterClrMap),\n\t\tclrScheme: parseClrScheme(themeElements ? firstChild(themeElements, 'a:clrScheme') : null),\n\t\tfmtScheme: themeElements ? firstChild(themeElements, 'a:fmtScheme') : null,\n\t\tfontScheme: themeElements ? firstChild(themeElements, 'a:fontScheme') : null,\n\t\tlayoutRoot,\n\t\tmasterRoot,\n\t}\n}\n\n/** The `a:themeElements` of a theme part (by partname), or `null` when the part/element is absent. */\nfunction themeElementsOf(opc: OpcPackage, themePartName: string | null): Element | null {\n\tconst themeRoot = documentElement(opc, themePartName)\n\treturn themeRoot ? firstChild(themeRoot, 'a:themeElements') : null\n}\n\n/** Identifies a placeholder by its `p:ph` `type`/`idx` for inheritance lookups. */\nexport interface PlaceholderRef {\n\ttype: string | null\n\tidx: string\n}\n\n/**\n * The colour a run effectively renders when its own `a:rPr` defines none,\n * resolved to a full {@link ResolvedColor}. Walks the inheritance the way\n * PowerPoint does: the paragraph's `a:pPr/a:defRPr` colour, then the slide text\n * body's `a:lstStyle` colour for the run's `level`, then — only for a placeholder\n * run — the placeholder's layout → master → master-`p:txStyles` chain (via\n * {@link placeholderInheritedFill}), then the presentation's `p:defaultTextStyle`\n * for the run's level (`ctx.defaultTextStyle`). The first tier that defines a\n * colour wins. `ph` is `null` for a non-placeholder run, which skips the\n * placeholder chain but still reaches `p:defaultTextStyle`. `null` when nothing in\n * the chain defines a colour, or it cannot be made literal.\n */\nexport function resolveInheritedRunColor(\n\tph: PlaceholderRef | null,\n\tlevel: number,\n\tpPr: Element | null,\n\tslideLstStyle: Element | null,\n\tctx: ThemeContext\n): ResolvedColor | null {\n\tconst defRPr = pPr && firstChild(pPr, 'a:defRPr')\n\tconst paraFill = defRPr && firstChild(defRPr, 'a:solidFill')\n\tif (paraFill) return resolveColorElement(firstChildElement(paraFill), ctx)\n\tconst slideFill = lstStyleLevelFill(slideLstStyle, level)\n\tif (slideFill) return resolveColorElement(firstChildElement(slideFill), ctx)\n\tif (ph) {\n\t\tconst colorEl = placeholderInheritedFill(ph.type, ph.idx, level, ctx)\n\t\tif (colorEl) return resolveColorElement(colorEl, ctx)\n\t}\n\tconst defaultFill = lstStyleLevelFill(ctx.defaultTextStyle ?? null, level)\n\treturn defaultFill ? resolveColorElement(firstChildElement(defaultFill), ctx) : null\n}\n\n/**\n * The `a:defRPr` tiers a run resolves an inherited character property against, in\n * priority order: the paragraph's `a:pPr/a:defRPr`, then the slide text body's\n * `a:lstStyle` level `a:defRPr`, then — only for a placeholder run — the\n * placeholder's layout → master → master-`p:txStyles` chain (via\n * {@link placeholderInheritedDefRPrs}), then the presentation's\n * `p:defaultTextStyle` level `a:defRPr` (`ctx.defaultTextStyle`). The first tier\n * that defines the property wins — each property resolves independently, mirroring\n * how the colour resolver walks the same chain. `ph` is `null` for a\n * non-placeholder run, which skips the placeholder chain but still reaches\n * `p:defaultTextStyle`.\n */\nfunction inheritedRunDefRPrs(\n\tph: PlaceholderRef | null,\n\tlevel: number,\n\tpPr: Element | null,\n\tslideLstStyle: Element | null,\n\tctx: ThemeContext\n): Element[] {\n\tconst tiers: Element[] = []\n\tconst paraDefRPr = pPr && firstChild(pPr, 'a:defRPr')\n\tif (paraDefRPr) tiers.push(paraDefRPr)\n\tconst slideDefRPr = lstStyleLevelDefRPr(slideLstStyle, level)\n\tif (slideDefRPr) tiers.push(slideDefRPr)\n\tif (ph) tiers.push(...placeholderInheritedDefRPrs(ph.type, ph.idx, level, ctx))\n\tconst defaultDefRPr = lstStyleLevelDefRPr(ctx.defaultTextStyle ?? null, level)\n\tif (defaultDefRPr) tiers.push(defaultDefRPr)\n\treturn tiers\n}\n\n/**\n * The point size a run effectively renders when its own `a:rPr` sets no `@sz`,\n * walking the inheritance the way PowerPoint does (see {@link inheritedRunDefRPrs}):\n * the first `a:defRPr/@sz` (hundredths of a point) in the paragraph → slide →\n * (placeholder) layout → master → `p:txStyles` → `p:defaultTextStyle` chain,\n * converted to points. A non-placeholder run skips the placeholder tiers but still\n * reaches `p:defaultTextStyle`. `null` when nothing in the chain defines a size.\n */\nexport function resolveInheritedRunSize(\n\tph: PlaceholderRef | null,\n\tlevel: number,\n\tpPr: Element | null,\n\tslideLstStyle: Element | null,\n\tctx: ThemeContext\n): number | null {\n\tfor (const defRPr of inheritedRunDefRPrs(ph, level, pPr, slideLstStyle, ctx)) {\n\t\tconst sz = intValue(attr(defRPr, 'sz'))\n\t\tif (sz !== null) return sz / 100\n\t}\n\treturn null\n}\n\n/**\n * The typeface a run effectively renders when its own `a:rPr` sets no `a:latin`,\n * walking the same chain as {@link resolveInheritedRunSize}: the first\n * `a:defRPr/a:latin/@typeface` it finds, then resolving a `+mj-*`/`+mn-*` theme\n * font token to a literal face name through the theme `fontScheme`. A\n * non-placeholder run skips the placeholder tiers but still reaches\n * `p:defaultTextStyle` (whose level `a:latin` is `+mn-lt` in a PowerPoint-written\n * deck). `null` when nothing in the chain names a face, or the token cannot be\n * resolved.\n */\nexport function resolveInheritedRunFontFace(\n\tph: PlaceholderRef | null,\n\tlevel: number,\n\tpPr: Element | null,\n\tslideLstStyle: Element | null,\n\tctx: ThemeContext\n): string | null {\n\tfor (const defRPr of inheritedRunDefRPrs(ph, level, pPr, slideLstStyle, ctx)) {\n\t\tconst latin = firstChild(defRPr, 'a:latin')\n\t\tconst typeface = latin && attr(latin, 'typeface')\n\t\tif (typeface) return resolveThemeFont(typeface, ctx.fontScheme ?? null)\n\t}\n\treturn null\n}\n\n/**\n * Whether a run effectively renders bold when its own `a:rPr` sets no `@b`,\n * walking the same chain as {@link resolveInheritedRunSize}: the first\n * `a:defRPr/@b` (`1`/`true` → `true`, `0`/`false` → `false`) in the paragraph →\n * slide → (placeholder) layout → master → `p:txStyles` → `p:defaultTextStyle`\n * chain. A non-placeholder run skips the placeholder tiers but still reaches\n * `p:defaultTextStyle` (which sets no `@b` in a PowerPoint-written deck, so bold\n * stays `null` there). `null` when nothing in the chain defines bold.\n */\nexport function resolveInheritedRunBold(\n\tph: PlaceholderRef | null,\n\tlevel: number,\n\tpPr: Element | null,\n\tslideLstStyle: Element | null,\n\tctx: ThemeContext\n): boolean | null {\n\tfor (const defRPr of inheritedRunDefRPrs(ph, level, pPr, slideLstStyle, ctx)) {\n\t\tconst b = attr(defRPr, 'b')\n\t\tif (b !== null) return b === '1' || b === 'true'\n\t}\n\treturn null\n}\n\n/**\n * The vertical anchor a placeholder text frame effectively renders when its own\n * `a:bodyPr` sets no `@anchor`: the value inherited from the layout → master\n * placeholder `a:bodyPr` (see {@link placeholderInheritedAnchor}). `null` when the\n * frame is not in a placeholder or nothing in the chain sets an anchor (PowerPoint\n * then defaults to top).\n */\nexport function resolveInheritedAnchor(ph: PlaceholderRef, ctx: ThemeContext): string | null {\n\treturn placeholderInheritedAnchor(ph.type, ph.idx, ctx)\n}\n\n/** Which tier of the slide → layout → master chain a {@link ResolvedFrame} resolved from. */\nexport type GeometrySource = 'own' | 'layout' | 'master'\n\n/** A shape's effective position and size in EMU, tagged with where it resolved from. */\nexport interface ResolvedFrame {\n\tleft: number\n\ttop: number\n\twidth: number\n\theight: number\n\tsource: GeometrySource\n}\n\n/**\n * The position/size a placeholder inherits when its own `a:spPr` carries no\n * `a:xfrm`: the matching layout placeholder's geometry, else the master's (see\n * {@link placeholderInheritedXfrm}). `null` when the chain has no matching\n * placeholder geometry to inherit, or the matched `a:xfrm` is missing an\n * `a:off`/`a:ext` coordinate. Callers that also need the \"own `a:xfrm` wins\"\n * check (the common case) use {@link Shape.resolvedFrame}, which layers that on\n * top of this.\n */\nexport function resolveInheritedFrame(ph: PlaceholderRef, ctx: ThemeContext): ResolvedFrame | null {\n\tconst found = placeholderInheritedXfrm(ph.type, ph.idx, ctx)\n\tif (!found) return null\n\tconst off = firstChild(found.xfrm, 'a:off')\n\tconst ext = firstChild(found.xfrm, 'a:ext')\n\tconst left = off && intValue(attr(off, 'x'))\n\tconst top = off && intValue(attr(off, 'y'))\n\tconst width = ext && intValue(attr(ext, 'cx'))\n\tconst height = ext && intValue(attr(ext, 'cy'))\n\tif (left === null || left === undefined) return null\n\tif (top === null || top === undefined) return null\n\tif (width === null || width === undefined) return null\n\tif (height === null || height === undefined) return null\n\treturn { left, top, width, height, source: found.source }\n}\n\n/**\n * A DrawingML colour reference resolved against a slide's theme to a literal hex.\n *\n * `hex` is the **base** token colour and `transforms` reports the colour-transform\n * children (`lumMod`/`lumOff`/`shade`/`tint`/`alpha`/…) in document order as\n * `{ name, value }` pairs — both kept for traceability and for the\n * `theme: 'preserve'` flatten path that re-emits the transforms verbatim.\n *\n * `effectiveHex` is the colour a renderer actually paints: `hex` with its\n * `transforms` applied (see {@link applyColorTransforms}). Read this for the final\n * rendered colour. `alpha` (0–1) is present only when an `alpha*` transform set an\n * opacity.\n */\nexport interface ResolvedColor {\n\thex: string\n\ttransforms: { name: string; value: string | null }[]\n\teffectiveHex: string\n\talpha?: number\n}\n\n/**\n * Resolve a DrawingML colour *element* (`a:srgbClr`/`a:schemeClr`/`a:sysClr`)\n * against `ctx` into a full {@link ResolvedColor} — base hex, raw transform list,\n * and the `effectiveHex`/`alpha` after applying those transforms. `null` when the\n * element cannot be made literal (unmapped token, or a colour model we do not\n * resolve). Shared by the solid-fill and gradient-stop colour reads.\n */\nexport function resolveColorElement(colorEl: Element | null, ctx: ColorContext): ResolvedColor | null {\n\tconst resolved = resolveColor(colorEl, ctx)\n\tif (!resolved) return null\n\tconst transforms = resolved.transforms.map((t) => ({ name: t.localName ?? '', value: attr(t, 'val') }))\n\tconst { hex, alpha } = applyColorTransforms(resolved.hex, transforms)\n\treturn alpha === undefined\n\t\t? { hex: resolved.hex, transforms, effectiveHex: hex }\n\t\t: { hex: resolved.hex, transforms, effectiveHex: hex, alpha }\n}\n\n/**\n * Resolve the `a:solidFill` colour of a properties container (`p:spPr`,\n * `p:grpSpPr`, `a:ln`, or a run's `a:rPr`) to a literal hex through `ctx`.\n * `null` when the container has no solid fill, or the colour cannot be made\n * literal (an unmapped token, or a colour model we do not resolve).\n */\nexport function resolveSolidFillColor(container: Element | null, ctx: ColorContext): ResolvedColor | null {\n\tif (!container) return null\n\tconst solidFill = firstChild(container, 'a:solidFill')\n\tif (!solidFill) return null\n\treturn resolveColorElement(firstChildElement(solidFill), ctx)\n}\n\n/**\n * Resolve the fill colour a shape inherits from its `p:style` `a:fillRef`\n * (style-matrix fill) to a literal hex through `ctx`. Used as the fallback for\n * {@link import('./shapes.js').Shape.resolvedFill} when the shape carries no\n * explicit `spPr` fill choice. `null` when there is no `fillRef`, it cannot be\n * resolved, or the indexed style entry is not a solid fill (a gradient style fill\n * has no single colour — read it through `gradientStops` instead).\n */\nexport function resolveStyleFillColor(shape: Element, ctx: ThemeContext): ResolvedColor | null {\n\tconst style = firstChild(shape, 'p:style')\n\tconst fill = style && styleRefFill(firstChild(style, 'a:fillRef'), ctx)\n\tif (!fill || fill.localName !== 'solidFill') return null\n\treturn resolveColorElement(firstChildElement(fill), ctx)\n}\n\n/**\n * Resolve the line colour a shape inherits from its `p:style` `a:lnRef`\n * (style-matrix line) to a literal hex through `ctx`. Used as the fallback for\n * {@link import('./shapes.js').Shape.resolvedLine} when the shape carries no\n * explicit `spPr/a:ln`. `null` when there is no `lnRef` or it cannot be resolved.\n */\nexport function resolveStyleLineColor(shape: Element, ctx: ThemeContext): ResolvedColor | null {\n\tconst style = firstChild(shape, 'p:style')\n\tconst ln = style && styleRefLine(firstChild(style, 'a:lnRef'), ctx)\n\treturn ln ? resolveSolidFillColor(ln, ctx) : null\n}\n\n/** A shape's resolved `p:style/a:fontRef` text tier: its colour and theme face. */\nexport interface StyleFontRef {\n\t/** The `a:fontRef` child colour (`a:schemeClr`/`a:srgbClr`/…) resolved through the theme, or `null` when it names none / cannot be made literal. */\n\tcolor: ResolvedColor | null\n\t/** The face named by `a:fontRef/@idx` (`major`→`+mj-lt`, `minor`→`+mn-lt`) resolved through the theme `fontScheme`, or `null` for `idx=\"none\"` / an unresolvable token. */\n\tface: string | null\n}\n\n/**\n * Resolve the text colour and typeface a shape derives from its `p:style/a:fontRef`\n * (the style-matrix font reference) — the tier PowerPoint applies to a shape's runs\n * just below their own `a:rPr` and above the placeholder/`p:defaultTextStyle` chain.\n * The `a:fontRef` child colour resolves through `ctx` like any other (it can carry\n * `lumMod`/`shade` transforms); `@idx` (`major`|`minor`|`none`) maps to the theme's\n * major/minor Latin font. `null` when the shape has no `p:style/a:fontRef` at all.\n */\nexport function resolveStyleFontRef(shape: Element, ctx: ThemeContext): StyleFontRef | null {\n\tconst style = firstChild(shape, 'p:style')\n\tconst fontRef = style && firstChild(style, 'a:fontRef')\n\tif (!fontRef) return null\n\tconst color = resolveColorElement(firstChildElement(fontRef), ctx)\n\tconst idx = attr(fontRef, 'idx')\n\tconst token = idx === 'major' ? '+mj-lt' : idx === 'minor' ? '+mn-lt' : null\n\treturn { color, face: token ? resolveThemeFont(token, ctx.fontScheme ?? null) : null }\n}\n","/**\n * Shared gradient-fill reader for DrawingML colour-bearing containers: a shape's\n * `p:spPr`, a line's `a:ln`, and a slide's `p:bg/p:bgPr`. Decodes an `a:gradFill`\n * into its stops (colour + position) plus the linear/path geometry, resolving each\n * stop's colour against the slide theme.\n */\nimport { attr, firstChild, getElements, intValue, type Element } from '../oxml/dom.js'\nimport type { ColorContext } from '../oxml/theme.js'\nimport { resolveColorElement } from './theme-context.js'\n\n/** One stop of a gradient fill (`a:gsLst/a:gs`), as read from a shape. */\nexport interface GradientStop {\n\t/** Stop offset along the gradient, 0–1 (from `@pos`, thousandths of a percent), or `null` if unset. */\n\tposition: number | null\n\t/** Explicit RGB colour as 6-hex (`a:srgbClr/@val`), or `null` when the stop uses a scheme colour. */\n\tcolor: string | null\n\t/** Theme colour token (`a:schemeClr/@val`, e.g. `accent1`), or `null` when the stop uses an explicit colour. */\n\tschemeColor: string | null\n\t/**\n\t * The stop's colour resolved against the slide theme **with its colour\n\t * transforms applied** — the final rendered hex (the gradient counterpart of\n\t * {@link import('./theme-context.js').ResolvedColor.effectiveHex}). `null` when\n\t * the colour cannot be made literal (an unmapped token, or a colour model we do\n\t * not resolve).\n\t */\n\teffectiveHex: string | null\n\t/** The stop's opacity (0–1) when an `alpha*` transform set one, else `undefined`. */\n\talpha?: number\n}\n\n/**\n * A gradient fill (`a:gradFill`), as read from a container — the stops plus the\n * geometry that a bare stop list omits. `linear` gradients carry an\n * {@link GradientFill.angleDeg} (the `a:lin/@ang` direction); `radial`/`path`\n * gradients carry a {@link GradientFill.path} shape (`a:path/@path`, e.g.\n * `circle`). The angle is in **OOXML degrees** (clockwise from 3 o'clock), the\n * same convention the write-side `GradientFillProps.angle` expects, so it\n * round-trips directly.\n */\nexport interface GradientFill {\n\t/** `linear` (`a:lin`) or `path` (`a:path`, i.e. radial/rectangular). `null` when neither child is present. */\n\tkind: 'linear' | 'path' | null\n\t/** Linear direction in OOXML degrees (clockwise from 3 o'clock), or `null` for a path gradient / when unset. */\n\tangleDeg: number | null\n\t/** Path-gradient shape (`a:path/@path`: `circle`/`rect`/`shape`), or `null` for a linear gradient. */\n\tpath: string | null\n\t/** The gradient stops in document order. */\n\tstops: GradientStop[]\n}\n\n/**\n * Read `a:gradFill/a:gsLst` stops from a container (`p:spPr` for a fill, `a:ln`\n * for a line stroke, or `p:bgPr` for a slide background). `null` when the\n * container has no gradient; `[]` when the gradient carries no stop list.\n */\nexport function readGradientStops(container: Element, ctx: ColorContext): GradientStop[] | null {\n\tconst grad = firstChild(container, 'a:gradFill')\n\tif (!grad) return null\n\tconst gsLst = firstChild(grad, 'a:gsLst')\n\tif (!gsLst) return []\n\treturn getElements(gsLst, 'a:gs').map((gs) => {\n\t\tconst pos = intValue(attr(gs, 'pos'))\n\t\tconst srgb = firstChild(gs, 'a:srgbClr')\n\t\tconst scheme = firstChild(gs, 'a:schemeClr')\n\t\tconst resolved = resolveColorElement(srgb ?? scheme ?? null, ctx)\n\t\treturn {\n\t\t\tposition: pos === null ? null : pos / 100000,\n\t\t\tcolor: srgb ? attr(srgb, 'val') : null,\n\t\t\tschemeColor: scheme ? attr(scheme, 'val') : null,\n\t\t\teffectiveHex: resolved ? resolved.effectiveHex : null,\n\t\t\t...(resolved?.alpha !== undefined ? { alpha: resolved.alpha } : {}),\n\t\t}\n\t})\n}\n\n/**\n * Read the full `a:gradFill` (stops + linear angle / path shape) from a container\n * (`p:spPr` for a fill, `a:ln` for a line stroke, or `p:bgPr` for a slide\n * background). `null` when the container has no gradient.\n */\nexport function readGradientFill(container: Element, ctx: ColorContext): GradientFill | null {\n\tconst grad = firstChild(container, 'a:gradFill')\n\tif (!grad) return null\n\tconst lin = firstChild(grad, 'a:lin')\n\tconst path = firstChild(grad, 'a:path')\n\tconst ang = lin ? intValue(attr(lin, 'ang')) : null\n\treturn {\n\t\tkind: lin ? 'linear' : path ? 'path' : null,\n\t\tangleDeg: ang === null ? null : ang / 60000,\n\t\tpath: path ? (attr(path, 'path') ?? null) : null,\n\t\tstops: readGradientStops(container, ctx) ?? [],\n\t}\n}\n","/**\n * Shared picture-fill reader for DrawingML fill-bearing containers: a shape's\n * `p:spPr`, a table cell's `a:tcPr`, and a slide's `p:bg/p:bgPr`. Decodes an\n * `a:blipFill` into the embedded image reference plus the geometry that decides\n * how the image covers the surface — stretch vs tile, the source crop, and the\n * tile offsets/scale.\n *\n * A picture fill is not a colour, so the solid-fill accessors\n * (`AutoShape.resolvedFill`, `TableCell.resolvedFill`) report `null` for one and\n * a surface filled with an image reads as unfilled without this.\n */\nimport { attr, firstChild, intValue, boolValue, type Element } from '../oxml/dom.js'\nimport type { Relationships } from '../opc/relationships.js'\n\n/** A rectangle expressed as per-edge fractions (`a:srcRect`/`a:fillRect`), `0.1` = 10 %. */\nexport interface FillRect {\n\tleft: number\n\ttop: number\n\tright: number\n\tbottom: number\n}\n\n/**\n * The tiling geometry of a tiled picture fill (`a:blipFill/a:tile`). Offsets stay\n * in EMU (the attribute's own unit); scales are fractions (`1` = 100 %), matching\n * the read API's convention elsewhere.\n */\nexport interface PictureFillTile {\n\t/** Horizontal tile offset in EMU (`@tx`), `0` when unset. */\n\toffsetXEmu: number\n\t/** Vertical tile offset in EMU (`@ty`), `0` when unset. */\n\toffsetYEmu: number\n\t/** Horizontal tile scale as a fraction (`@sx`, thousandths of a percent), `1` when unset. */\n\tscaleX: number\n\t/** Vertical tile scale as a fraction (`@sy`), `1` when unset. */\n\tscaleY: number\n\t/** Tile mirroring (`@flip`: `none`/`x`/`y`/`xy`), or `null` when unset. */\n\tflip: string | null\n\t/** Tile alignment within the surface (`@algn`, e.g. `tl`), or `null` when unset. */\n\talign: string | null\n}\n\n/**\n * A picture (image) fill (`a:blipFill`) read from a fill-bearing container. The\n * image itself is {@link relId} / {@link partName}; the rest is the geometry a\n * faithful replica needs — {@link mode} (`stretch` or `tile`), the source crop\n * {@link srcRect}, the destination inset {@link fillRect}, and {@link tile}.\n *\n * Rect fields follow the read API's fraction convention (see\n * {@link import('./shapes.js').Picture.crop}): the raw attributes are\n * thousandths of a percent and are divided by 100000, so `0.1` is 10 % and a\n * negative value (a `fillRect` that bleeds past the edge) stays negative.\n */\nexport interface PictureFill {\n\t/** Relationship id of the embedded image (`a:blip/@r:embed`), or `null` when the blip embeds none. */\n\trelId: string | null\n\t/** Absolute partname of the embedded image, or `null` when it has no rel id / no resolvable target. */\n\tpartName: string | null\n\t/** `stretch` (`a:stretch`) or `tile` (`a:tile`); `null` when the fill states neither. */\n\tmode: 'stretch' | 'tile' | null\n\t/** Source crop as per-edge fractions (`a:srcRect`), or `null` when absent. An explicit `<a:srcRect/>` reports zeros. */\n\tsrcRect: FillRect | null\n\t/** Stretch destination rect as per-edge fractions (`a:stretch/a:fillRect`), or `null` when absent. */\n\tfillRect: FillRect | null\n\t/** Tiling geometry (`a:tile`), or `null` when the fill is not tiled. */\n\ttile: PictureFillTile | null\n\t/** Blip opacity 0–1 (`a:blip/a:alphaModFix/@amt`), or `null` when the blip sets none. */\n\talpha: number | null\n\t/** DPI override the image is rendered at (`@dpi`), or `null` when unset. `0` means \"use the image's own\". */\n\tdpi: number | null\n\t/** Whether the fill rotates with its shape (`@rotWithShape`), or `null` when unset. */\n\trotWithShape: boolean | null\n}\n\n/** Per-edge fractions of a rect element, absent attributes reading as `0`. */\nfunction readRect(rect: Element): FillRect {\n\tconst edge = (name: string): number => {\n\t\tconst v = intValue(attr(rect, name))\n\t\treturn v === null ? 0 : v / 100000\n\t}\n\treturn { left: edge('l'), top: edge('t'), right: edge('r'), bottom: edge('b') }\n}\n\n/** Decode an `a:tile`: offsets stay in EMU, scales become fractions defaulting to `1`. */\nfunction readTile(tile: Element): PictureFillTile {\n\tconst scale = (name: string): number => {\n\t\tconst v = intValue(attr(tile, name))\n\t\treturn v === null ? 1 : v / 100000\n\t}\n\treturn {\n\t\toffsetXEmu: intValue(attr(tile, 'tx')) ?? 0,\n\t\toffsetYEmu: intValue(attr(tile, 'ty')) ?? 0,\n\t\tscaleX: scale('sx'),\n\t\tscaleY: scale('sy'),\n\t\tflip: attr(tile, 'flip'),\n\t\talign: attr(tile, 'algn'),\n\t}\n}\n\n/** Resolve a rel id to an absolute partname, `null` for an absent/external/dangling one. */\nfunction resolvePartName(relId: string | null, rels: Relationships | null): string | null {\n\tif (!relId || !rels) return null\n\tconst rel = rels.get(relId)\n\tif (!rel || rel.targetMode === 'External') return null\n\treturn rels.resolveTarget(relId)\n}\n\n/**\n * Read an `a:blipFill` from a container (`p:spPr`, `a:tcPr`, or `p:bgPr`) into a\n * {@link PictureFill}. `rels` — the *owning part's* relationships — resolves the\n * blip's `r:embed` to an absolute partname; pass `null` (or omit) to read the\n * geometry without resolving the image. `null` when the container's fill is not\n * a picture.\n */\nexport function readPictureFill(container: Element, rels: Relationships | null = null): PictureFill | null {\n\tconst blipFill = firstChild(container, 'a:blipFill')\n\tif (!blipFill) return null\n\n\tconst blip = firstChild(blipFill, 'a:blip')\n\tconst relId = blip ? attr(blip, 'r:embed') : null\n\tconst alphaMod = blip && firstChild(blip, 'a:alphaModFix')\n\tconst amt = alphaMod ? intValue(attr(alphaMod, 'amt')) : null\n\n\tconst srcRect = firstChild(blipFill, 'a:srcRect')\n\tconst stretch = firstChild(blipFill, 'a:stretch')\n\tconst fillRect = stretch && firstChild(stretch, 'a:fillRect')\n\tconst tile = firstChild(blipFill, 'a:tile')\n\n\treturn {\n\t\trelId,\n\t\tpartName: resolvePartName(relId, rels),\n\t\tmode: stretch ? 'stretch' : tile ? 'tile' : null,\n\t\tsrcRect: srcRect ? readRect(srcRect) : null,\n\t\tfillRect: fillRect ? readRect(fillRect) : null,\n\t\ttile: tile ? readTile(tile) : null,\n\t\t// `a:alphaModFix` omits `amt` to mean fully opaque (the schema default).\n\t\talpha: alphaMod ? (amt === null ? 1 : amt / 100000) : null,\n\t\tdpi: intValue(attr(blipFill, 'dpi')),\n\t\trotWithShape: boolValue(attr(blipFill, 'rotWithShape')),\n\t}\n}\n","/**\n * Shared pattern-fill reader for DrawingML colour-bearing containers: a shape's `p:spPr`, a\n * slide's `p:bg/p:bgPr`, and a table's `a:tblPr` / cell's `a:tcPr`.\n *\n * `a:pattFill` is a preset hatch name plus two wrapped colours, and decoding it is three\n * lines — which is exactly why it had been open-coded in each place that needed it. Sharing\n * it is what keeps the three from drifting into different answers for the same element, the\n * same reason {@link import('./gradient.js').readGradientFill} and\n * {@link import('./picture-fill.js').readPictureFill} are shared.\n */\nimport { attr, firstChild, firstChildElement, type Element } from '../oxml/dom.js'\nimport type { ColorContext } from '../oxml/theme.js'\nimport { resolveColorElement, type ResolvedColor } from './theme-context.js'\n\n/**\n * A pattern fill (`a:pattFill`) — a two-colour preset hatch. The write-side\n * `fill: { type: 'pattern', pattern: { preset, fgColor, bgColor } }` emits the same element,\n * so the {@link preset} name and both colours round-trip. Colours resolve against the theme\n * (a scheme token → literal hex) the same way a solid fill does.\n */\nexport interface PatternFill {\n\t/** Preset pattern name (`@prst`, e.g. `pct50`/`diagCross`/`ltUpDiag`), or `null` when unset. */\n\tpreset: string | null\n\t/** Foreground colour (`a:fgClr`) resolved against the theme, or `null`. */\n\tforeground: ResolvedColor | null\n\t/** Background colour (`a:bgClr`) resolved against the theme, or `null`. */\n\tbackground: ResolvedColor | null\n}\n\n/**\n * Read a container's `a:pattFill`, or `null` when its fill is not a pattern.\n * @param {Element} container - the fill-bearing parent (`p:spPr`, `p:bgPr`, `a:tblPr`, `a:tcPr`, …)\n * @param {ColorContext} ctx - the theme colour context each colour resolves against\n * @returns {PatternFill | null} the decoded hatch, or `null`\n */\nexport function readPatternFill(container: Element, ctx: ColorContext): PatternFill | null {\n\tconst patt = firstChild(container, 'a:pattFill')\n\tif (!patt) return null\n\tconst wrapColor = (qname: string): ResolvedColor | null => {\n\t\tconst wrap = firstChild(patt, qname)\n\t\tconst colorEl = wrap && firstChildElement(wrap)\n\t\treturn colorEl ? resolveColorElement(colorEl, ctx) : null\n\t}\n\treturn {\n\t\tpreset: attr(patt, 'prst') ?? null,\n\t\tforeground: wrapColor('a:fgClr'),\n\t\tbackground: wrapColor('a:bgClr'),\n\t}\n}\n","/**\n * Shape-element plumbing: the small element lookups every shape kind performs, plus the\n * shape-scoped re-exports of the shared schema-successor lists.\n *\n * The successor arrays are the reason a setter can create a missing `a:xfrm` / `a:solidFill` /\n * `a:ln` without corrupting the part: `getOrAddChild` inserts before the first listed sibling it\n * finds, so each list must name exactly the children that legally *follow* the one being added.\n * They are declared once in `src/ooxml/sequence.ts` (derived from each complexType's sequence)\n * and re-exported here so the shape modules keep importing them from one place.\n */\n\nimport {\n\tELEMENT_NODE,\n\tOOXML_NS,\n\tattr,\n\tchildElements,\n\tfirstChild,\n\tgetOrAddChild,\n\tintValue,\n\ttype Element,\n} from '../../oxml/dom.js'\nimport { SHAPE_AFTER_SPPR, SPPR_AFTER_XFRM } from '../../../ooxml/sequence.js'\n\nexport {\n\tGRPSPPR_AFTER_XFRM,\n\tGRPSPPR_FILL_AFTER,\n\tLN_FILL_AFTER,\n\tSHAPE_AFTER_SPPR,\n\tSPPR_AFTER_XFRM,\n\tSPPR_FILL_AFTER,\n\tSPPR_LN_AFTER,\n} from '../../../ooxml/sequence.js'\n\n/**\n * A shape's properties element (`p:spPr` / `p:grpSpPr`) paired with the schema\n * successors for ordered insertion of its `a:solidFill` and `a:ln` children.\n * `lnAfter` is `null` for kinds with no `a:ln` (group shapes).\n */\nexport interface ShapeProperties {\n\tprops: Element\n\tfillAfter: string[]\n\tlnAfter: string[] | null\n}\n\n/** First `<p:cNvPr>` reached through the shape's non-visual properties wrapper (`p:nv*Pr`). */\nexport function nonVisualCNvPr(element: Element): Element | null {\n\tfor (let node = element.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\tconst child = node as Element\n\t\tif (child.namespaceURI === OOXML_NS.p && child.localName?.startsWith('nv')) {\n\t\t\treturn firstChild(child, 'p:cNvPr')\n\t\t}\n\t}\n\treturn null\n}\n\nexport function emuFrom(parent: Element | null, qname: string, attribute: string): number | null {\n\tconst element = parent && firstChild(parent, qname)\n\treturn element ? intValue(attr(element, attribute)) : null\n}\n\n/**\n * One EMU coordinate from a shape's own `p:spPr/a:xfrm`, or `null` when any link in that chain\n * is absent — which is how an inheriting placeholder (one with no `a:xfrm` of its own) reports\n * that its geometry comes from the layout/master instead. See `placeholderInheritedXfrm` for\n * resolving what it would inherit.\n */\nexport function spPrXfrmEmu(sp: Element, container: 'a:off' | 'a:ext', axis: string): number | null {\n\tconst spPr = firstChild(sp, 'p:spPr')\n\tconst xfrm = spPr && firstChild(spPr, 'a:xfrm')\n\tconst el = xfrm && firstChild(xfrm, container)\n\treturn el ? intValue(attr(el, axis)) : null\n}\n\nexport { childElements }\n\n/** Get-or-add `p:spPr/a:xfrm` for shapes whose transform lives in `p:spPr` (`p:sp`, `p:pic`, `p:cxnSp`). */\nexport function getOrAddSpPrXfrm(shapeElement: Element): Element {\n\tconst spPr = getOrAddChild(shapeElement, 'p:spPr', SHAPE_AFTER_SPPR)\n\treturn getOrAddChild(spPr, 'a:xfrm', SPPR_AFTER_XFRM)\n}\n","/**\n * Reading geometry out of a shape: transform boxes, rotation and flips, and custom-geometry paths.\n *\n * Every value here comes straight off `a:xfrm` / `a:path` attributes, so these are pure element\n * readers with no theme or relationship context.\n */\n\nimport {\n\tELEMENT_NODE,\n\tOOXML_NS,\n\tattr,\n\tboolValue,\n\tfirstChild,\n\tgetElements,\n\tintValue,\n\ttype Element,\n} from '../../oxml/dom.js'\nimport type { CustomGeometryPath, GeometryCommand } from './types.js'\nimport { InvalidOptionError } from '../../../errors.js'\n\n/**\n * One `a:pt` coordinate as a raw path-unit integer. A guide-name reference\n * (the `ST_AdjCoordinate` string form) is not produced by authored freeforms;\n * a non-numeric value degrades to `0` rather than crashing (documented edge).\n */\nfunction ptAxis(pt: Element | undefined, axis: 'x' | 'y'): number {\n\treturn (pt ? intValue(attr(pt, axis)) : null) ?? 0\n}\n\n/** Parse one `<a:path>` into its viewport attrs (with schema defaults) and ordered segments. */\nexport function readGeometryPath(path: Element): CustomGeometryPath {\n\tconst commands: GeometryCommand[] = []\n\tfor (let node = path.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\tconst seg = node as Element\n\t\tif (seg.namespaceURI !== OOXML_NS.a) continue\n\t\tconst pts = getElements(seg, 'a:pt')\n\t\tswitch (seg.localName) {\n\t\t\tcase 'moveTo':\n\t\t\t\tcommands.push({ cmd: 'moveTo', x: ptAxis(pts[0], 'x'), y: ptAxis(pts[0], 'y') })\n\t\t\t\tbreak\n\t\t\tcase 'lnTo':\n\t\t\t\tcommands.push({ cmd: 'lnTo', x: ptAxis(pts[0], 'x'), y: ptAxis(pts[0], 'y') })\n\t\t\t\tbreak\n\t\t\tcase 'cubicBezTo':\n\t\t\t\tcommands.push({\n\t\t\t\t\tcmd: 'cubicBezTo',\n\t\t\t\t\tx1: ptAxis(pts[0], 'x'),\n\t\t\t\t\ty1: ptAxis(pts[0], 'y'),\n\t\t\t\t\tx2: ptAxis(pts[1], 'x'),\n\t\t\t\t\ty2: ptAxis(pts[1], 'y'),\n\t\t\t\t\tx: ptAxis(pts[2], 'x'),\n\t\t\t\t\ty: ptAxis(pts[2], 'y'),\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase 'quadBezTo':\n\t\t\t\tcommands.push({\n\t\t\t\t\tcmd: 'quadBezTo',\n\t\t\t\t\tx1: ptAxis(pts[0], 'x'),\n\t\t\t\t\ty1: ptAxis(pts[0], 'y'),\n\t\t\t\t\tx: ptAxis(pts[1], 'x'),\n\t\t\t\t\ty: ptAxis(pts[1], 'y'),\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase 'arcTo':\n\t\t\t\tcommands.push({\n\t\t\t\t\tcmd: 'arcTo',\n\t\t\t\t\twR: intValue(attr(seg, 'wR')) ?? 0,\n\t\t\t\t\thR: intValue(attr(seg, 'hR')) ?? 0,\n\t\t\t\t\tstAng: (intValue(attr(seg, 'stAng')) ?? 0) / 60000,\n\t\t\t\t\tswAng: (intValue(attr(seg, 'swAng')) ?? 0) / 60000,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase 'close':\n\t\t\t\tcommands.push({ cmd: 'close' })\n\t\t\t\tbreak\n\t\t}\n\t}\n\treturn {\n\t\tw: intValue(attr(path, 'w')) ?? 0,\n\t\th: intValue(attr(path, 'h')) ?? 0,\n\t\tfill: attr(path, 'fill') ?? 'norm',\n\t\tstroke: boolValue(attr(path, 'stroke')) ?? true,\n\t\tcommands,\n\t}\n}\n\n/** Validate and round an EMU geometry value; extents (`cx`/`cy`) must be non-negative. */\nexport function toEmu(value: number, attribute: string, allowNegative: boolean): number {\n\tif (!Number.isFinite(value))\n\t\tthrow new InvalidOptionError('coord/non-finite', `${attribute} must be a finite number of EMU, got ${value}`)\n\tif (!allowNegative && value < 0)\n\t\tthrow new InvalidOptionError('coord/negative', `${attribute} must be non-negative, got ${value}`)\n\treturn Math.round(value)\n}\n\n/** A point + extent pair (`a:off`/`a:ext` or `a:chOff`/`a:chExt`) from a transform, or `null` if either is incomplete. */\nexport function readBox(\n\txfrm: Element,\n\toffName: string,\n\textName: string\n): { x: number; y: number; cx: number; cy: number } | null {\n\tconst off = firstChild(xfrm, offName)\n\tconst ext = firstChild(xfrm, extName)\n\tconst x = off && intValue(attr(off, 'x'))\n\tconst y = off && intValue(attr(off, 'y'))\n\tconst cx = ext && intValue(attr(ext, 'cx'))\n\tconst cy = ext && intValue(attr(ext, 'cy'))\n\tif (x === null || y === null || cx === null || cy === null) return null\n\treturn { x, y, cx, cy }\n}\n\nexport function rotationDegrees(xfrm: Element): number {\n\tconst rot = intValue(attr(xfrm, 'rot'))\n\treturn rot === null ? 0 : rot / 60000\n}\n\nexport function transformFlipH(xfrm: Element): boolean {\n\treturn boolValue(attr(xfrm, 'flipH')) === true\n}\n\nexport function transformFlipV(xfrm: Element): boolean {\n\treturn boolValue(attr(xfrm, 'flipV')) === true\n}\n","/**\n * Group-shape transform composition — the `p:grpSp` child-space mapping, shared\n * by every surface that needs slide-absolute geometry.\n *\n * A `p:grpSp` declares two frames on its `a:xfrm`: where it sits on the slide\n * (`a:off`/`a:ext`) and the coordinate space its children are authored in\n * (`a:chOff`/`a:chExt`). A child's own `a:off`/`a:ext` is expressed in that child\n * space, so it is not directly placeable on the slide — it must be mapped through\n * `off + (p - chOff) * (ext / chExt)` for every enclosing group, with the group's\n * `@rot`/`@flipH`/`@flipV` composed on top.\n *\n * This module is deliberately **pure**: it takes decoded numbers, not XML, so the\n * mapping stays one implementation no matter how many surfaces need it. It was\n * shared between two independent readers before the inspect surface became a\n * projection over the read model; today `Shape.absoluteFrame` is the only caller,\n * and the separation still earns its keep by keeping the arithmetic testable\n * without a package to parse.\n */\n\n/** A position + extent pair in EMU (`a:off`/`a:ext`, or `a:chOff`/`a:chExt`). */\ninterface TransformBox {\n\tx: number\n\ty: number\n\tcx: number\n\tcy: number\n}\n\n/** A shape's own `a:xfrm`, decoded. `rotation` is in degrees (the raw `@rot` / 60000). */\ninterface ShapeTransform {\n\tbox: TransformBox\n\trotation: number\n\tflipH: boolean\n\tflipV: boolean\n}\n\n/**\n * An enclosing `p:grpSp`'s `a:xfrm`, decoded: `outer` is the group's own frame on\n * the slide (`a:off`/`a:ext`), `child` the space its children are authored in\n * (`a:chOff`/`a:chExt`).\n */\nexport interface GroupTransform {\n\touter: TransformBox\n\tchild: TransformBox\n\trotation: number\n\tflipH: boolean\n\tflipV: boolean\n}\n\n/** A slide-absolute frame: the unrotated placement box plus effective orientation. */\ninterface ComposedFrame {\n\tbox: TransformBox\n\t/** Effective clockwise rotation in degrees, normalised to [0, 360). */\n\trotation: number\n\t/** Effective horizontal flip, XOR-composed across the group chain. */\n\tflipH: boolean\n\t/** Effective vertical flip, XOR-composed across the group chain. */\n\tflipV: boolean\n}\n\n/** Normalise a degree value into [0, 360). */\nfunction normalizeDegrees(value: number): number {\n\treturn ((value % 360) + 360) % 360\n}\n\n/** Rotate `point` clockwise about `center` by `degrees`. */\nfunction rotatePoint(\n\tpoint: { x: number; y: number },\n\tcenter: { x: number; y: number },\n\tdegrees: number\n): { x: number; y: number } {\n\tif (degrees === 0) return point\n\tconst angle = (degrees * Math.PI) / 180\n\tconst cos = Math.cos(angle)\n\tconst sin = Math.sin(angle)\n\tconst dx = point.x - center.x\n\tconst dy = point.y - center.y\n\treturn {\n\t\tx: center.x + cos * dx - sin * dy,\n\t\ty: center.y + sin * dx + cos * dy,\n\t}\n}\n\n/**\n * Compose a shape's own transform with every enclosing group transform into a\n * slide-absolute frame.\n *\n * `groups` runs **innermost first** (the shape's immediate `p:grpSp` parent, then\n * outward). An empty list returns the shape's own box and orientation unchanged.\n *\n * The returned `box` is the *unrotated* placement box — the same box PowerPoint\n * writes when you Ungroup — with the effective rotation reported separately.\n * Values are exact; callers round or convert units as they see fit.\n *\n * Returns `null` when a group's `a:chExt` is degenerate (zero on either axis):\n * the child-space ratio is then undefined and there is no resolvable frame.\n */\nexport function composeGroupFrame(shape: ShapeTransform, groups: GroupTransform[]): ComposedFrame | null {\n\tlet center = { x: shape.box.x + shape.box.cx / 2, y: shape.box.y + shape.box.cy / 2 }\n\tlet width = shape.box.cx\n\tlet height = shape.box.cy\n\tlet flipH = shape.flipH\n\tlet flipV = shape.flipV\n\n\t// Group centres are collected on the way out, then rotated on the way back in:\n\t// an outer group rotates the centres of the inner groups nested inside it, so\n\t// the two passes cannot be merged.\n\tconst chain: { center: { x: number; y: number }; rotation: number; flipH: boolean; flipV: boolean }[] = []\n\n\tfor (const group of groups) {\n\t\tif (group.child.cx === 0 || group.child.cy === 0) return null // degenerate child frame — no resolvable mapping\n\t\tconst ratioX = group.outer.cx / group.child.cx\n\t\tconst ratioY = group.outer.cy / group.child.cy\n\n\t\tconst mapPoint = (point: { x: number; y: number }): { x: number; y: number } => {\n\t\t\tlet x = group.outer.x + (point.x - group.child.x) * ratioX\n\t\t\tlet y = group.outer.y + (point.y - group.child.y) * ratioY\n\t\t\tif (group.flipH) x = group.outer.x + group.outer.cx - (x - group.outer.x)\n\t\t\tif (group.flipV) y = group.outer.y + group.outer.cy - (y - group.outer.y)\n\t\t\treturn { x, y }\n\t\t}\n\t\tcenter = mapPoint(center)\n\t\tfor (const entry of chain) entry.center = mapPoint(entry.center)\n\t\twidth *= Math.abs(ratioX)\n\t\theight *= Math.abs(ratioY)\n\t\tchain.push({\n\t\t\tcenter: { x: group.outer.x + group.outer.cx / 2, y: group.outer.y + group.outer.cy / 2 },\n\t\t\trotation: group.rotation,\n\t\t\tflipH: group.flipH,\n\t\t\tflipV: group.flipV,\n\t\t})\n\t\tflipH = flipH !== group.flipH\n\t\tflipV = flipV !== group.flipV\n\t}\n\n\tlet rotation = 0\n\t// A group flipped on exactly one axis mirrors the sense of every rotation\n\t// nested inside it, so track orientation as the chain is walked back inward.\n\tlet orientation = 1\n\tfor (let index = chain.length - 1; index >= 0; index--) {\n\t\tconst group = chain[index]\n\t\tif (!group) continue\n\t\tconst groupRotation = group.rotation * orientation\n\t\tcenter = rotatePoint(center, group.center, groupRotation)\n\t\tfor (let innerIndex = 0; innerIndex < index; innerIndex++) {\n\t\t\tconst inner = chain[innerIndex]\n\t\t\tif (inner) inner.center = rotatePoint(inner.center, group.center, groupRotation)\n\t\t}\n\t\trotation += groupRotation\n\t\tif (group.flipH !== group.flipV) orientation *= -1\n\t}\n\n\treturn {\n\t\tbox: { x: center.x - width / 2, y: center.y - height / 2, cx: width, cy: height },\n\t\trotation: normalizeDegrees(rotation + shape.rotation * orientation),\n\t\tflipH,\n\t\tflipV,\n\t}\n}\n","/**\n * Read/write proxies for a shape's text: `TextFrame → Paragraph[] → Run[]`.\n *\n * Each proxy wraps a live DOM element (`a:txBody`, `a:p`, `a:r`) and holds the\n * owning `Part`, so a setter can mutate the node in place and call\n * `part.markDirty()` — that single flag is what makes `save()` reserialize the\n * part. Getters compute from the DOM on each access rather than caching.\n */\nimport type { Part } from '../opc/part.js'\nimport type { Relationships } from '../opc/relationships.js'\nimport {\n\tELEMENT_NODE,\n\tattr,\n\tboolValue,\n\tchildElements,\n\tcreateElement,\n\tfirstChild,\n\tfirstChildElement,\n\tgetElements,\n\tgetOrAddChild,\n\tintValue,\n\tremoveAttr,\n\tremoveChildrenByQName,\n\tsetAttr,\n\ttype Element,\n} from '../oxml/dom.js'\nimport { normalizeHex, setSolidFill, solidFillColor } from '../oxml/fill.js'\nimport { resolveThemeFont, type ThemeContext } from '../oxml/theme.js'\nimport {\n\tresolveColorElement,\n\tresolveInheritedAnchor,\n\tresolveInheritedRunBold,\n\tresolveInheritedRunColor,\n\tresolveInheritedRunFontFace,\n\tresolveInheritedRunSize,\n\tresolveSolidFillColor,\n\ttype PlaceholderRef,\n\ttype ResolvedColor,\n\ttype StyleFontRef,\n} from './theme-context.js'\nimport { InternalError, InvalidOptionError } from '../../errors.js'\n\n/**\n * What a {@link Run}'s text body needs to resolve an *inherited* run\n * colour/size/face/bold: which placeholder the text lives in (or `null` for a\n * non-placeholder shape, which still resolves its `p:style/a:fontRef` and the\n * presentation `p:defaultTextStyle`), the slide theme context (with the\n * layout/master roots) to resolve against, and the shape's resolved\n * `p:style/a:fontRef` text tier. The owning slide's text body `a:lstStyle` is added\n * per text frame. Absent only for text reached without a theme context (table cells).\n */\ninterface PlaceholderTextContext {\n\tph: PlaceholderRef | null\n\tflatten: ThemeContext\n\t/** The shape's resolved `p:style/a:fontRef` colour + face tier, or `null` when it has none. */\n\tfontRef?: StyleFontRef | null\n}\n\n/**\n * A run's click hyperlink (`a:rPr/a:hlinkClick`): a link on a span of text. A URL\n * link carries an external {@link url}; a slide jump carries the internal\n * {@link targetPartName} (the linked slide's part) alongside its `hlinksldjump`\n * {@link action}. `tooltip` and `relId` are surfaced when present.\n */\nexport interface RunHyperlink {\n\t/** External URL target (its `@r:id` resolves to a `TargetMode=\"External\"` rel), or `null` for an internal/action-only link. */\n\turl: string | null\n\t/** Absolute partname of an internal target (e.g. the slide a jump points at), or `null`. */\n\ttargetPartName: string | null\n\t/** Navigation action token (`@action`, e.g. `ppaction://hlinksldjump`), or `null` when absent/empty. */\n\taction: string | null\n\t/** Tooltip text (`@tooltip`), or `null` when absent/empty. */\n\ttooltip: string | null\n\t/** The relationship id (`@r:id`) backing the link, or `null` when the link is action-only. */\n\trelId: string | null\n}\n\n/**\n * A paragraph's line spacing (`a:pPr/a:lnSpc`), in whichever of the two OOXML\n * forms the file uses: an exact point height (`a:spcPts`) or a percentage of the\n * single-line height (`a:spcPct` — e.g. `percent: 150` for 1.5× spacing).\n */\nexport type LineSpacing = { type: 'points'; valuePt: number } | { type: 'percent'; percent: number }\n\n/**\n * The bullet's own font, size and colour (`a:buFont` / `a:buSzPct` / `a:buSzPts` /\n * `a:buClr`) — the properties that style the glyph or number itself rather than\n * the text after it. Every field is `null` when the paragraph leaves it to be\n * inherited from the list style.\n *\n * These are siblings of the bullet kind in `a:pPr`, not children of it, so they\n * are carried alongside each kind rather than inside it.\n */\nexport interface BulletStyle {\n\t/** `a:buFont/@typeface` — the face the glyph is drawn in (a symbol font such as `Wingdings`), or `null`. */\n\tfont: string | null\n\t/** `a:buSzPct/@val` as a percentage of the run size (e.g. `80`; the raw attribute is thousandths of a percent), or `null`. */\n\tsizePct: number | null\n\t/** `a:buSzPts/@val` as an absolute point size (the raw attribute is hundredths of a point), or `null`. The alternative to {@link sizePct}; at most one is set. */\n\tsizePt: number | null\n\t/** Explicit RGB bullet colour as 6-hex (`a:buClr/a:srgbClr/@val`), or `null`. */\n\tcolor: string | null\n\t/** Theme colour token when the bullet colour is a scheme colour (`a:buClr/a:schemeClr/@val`), or `null`. */\n\tschemeColor: string | null\n\t/** The bullet colour resolved against the slide theme with its transforms applied, or `null` when unset or not resolvable to a literal. */\n\tresolvedColor: ResolvedColor | null\n}\n\n/**\n * A paragraph's bullet, as the structured counterpart of the `a:pPr` bullet\n * children. Discriminated on {@link kind}, which is one of the four mutually\n * exclusive choices the schema allows:\n *\n * - `'none'` — `a:buNone`, the bullet explicitly suppressed. Carries no style,\n * because there is no glyph to style.\n * - `'char'` — `a:buChar`, a literal glyph.\n * - `'autoNum'` — `a:buAutoNum`, an auto-numbered list.\n * - `'picture'` — `a:buBlip`, an image used as the glyph.\n *\n * A paragraph that names none of them inherits its bullet from the list style and\n * reports `null` rather than a member of this union.\n */\nexport type BulletDetail =\n\t| { kind: 'none' }\n\t| ({\n\t\t\tkind: 'char'\n\t\t\t/** The glyph itself (`a:buChar/@char`) — a bare character, never a tagged string. */\n\t\t\tchar: string\n\t } & BulletStyle)\n\t| ({\n\t\t\tkind: 'autoNum'\n\t\t\t/** The numbering scheme (`a:buAutoNum/@type`, e.g. `arabicPeriod`). */\n\t\t\tscheme: string\n\t\t\t/**\n\t\t\t * The number this list starts at (`a:buAutoNum/@startAt`), or `null` when\n\t\t\t * unset (the schema default is 1). Content rather than styling: a list\n\t\t\t * continuing \"5. Deploy\" that restarts at 1 is a different slide.\n\t\t\t */\n\t\t\tstartAt: number | null\n\t } & BulletStyle)\n\t| ({\n\t\t\tkind: 'picture'\n\t\t\t/**\n\t\t\t * Absolute partname of the image used as the glyph (`a:buBlip/a:blip/@r:embed`,\n\t\t\t * resolved through the owning part's relationships), or `null` when the\n\t\t\t * paragraph was reached without them or the blip carries no `r:embed`.\n\t\t\t */\n\t\t\timagePartName: string | null\n\t } & BulletStyle)\n\n// Schema successors used to keep `a:rPr` children in document order when a\n// setter has to create one (CT_TextCharacterProperties sequence).\nconst RPR_AFTER_FILL = [\n\t'a:effectLst',\n\t'a:effectDag',\n\t'a:highlight',\n\t'a:uLnTx',\n\t'a:uLn',\n\t'a:uFillTx',\n\t'a:uFill',\n\t'a:latin',\n\t'a:ea',\n\t'a:cs',\n\t'a:sym',\n\t'a:hlinkClick',\n\t'a:hlinkMouseOver',\n\t'a:rtl',\n\t'a:extLst',\n]\nconst RPR_AFTER_LATIN = ['a:ea', 'a:cs', 'a:sym', 'a:hlinkClick', 'a:hlinkMouseOver', 'a:rtl', 'a:extLst']\n\n/** One text run (`a:r`): a span of text with uniform character formatting. */\nexport class Run {\n\tconstructor(\n\t\tprivate readonly element: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme context (colour maps + `fontScheme`), for the `resolved*` getters; absent when the run was reached without one. */\n\t\tprivate readonly themeContext?: ThemeContext,\n\t\t/**\n\t\t * Resolves the colour this run inherits from its placeholder/list-style chain\n\t\t * when it sets none of its own (item A). Built by the owning {@link Paragraph}\n\t\t * for placeholder text; absent for non-placeholder runs. Called lazily.\n\t\t */\n\t\tprivate readonly inheritedColor?: () => ResolvedColor | null,\n\t\t/**\n\t\t * Resolves the point size this run inherits from the same chain when it sets no\n\t\t * own `@sz`. Built by the owning {@link Paragraph} for placeholder text; absent\n\t\t * for non-placeholder runs. Called lazily.\n\t\t */\n\t\tprivate readonly inheritedSize?: () => number | null,\n\t\t/**\n\t\t * Resolves the typeface this run inherits from the same chain (a `+mj-*`/`+mn-*`\n\t\t * theme token already resolved to a literal face) when it sets no own `a:latin`.\n\t\t * Built by the owning {@link Paragraph} for placeholder text; absent otherwise.\n\t\t * Called lazily.\n\t\t */\n\t\tprivate readonly inheritedFace?: () => string | null,\n\t\t/**\n\t\t * Resolves whether this run inherits bold from the same chain when it sets no\n\t\t * own `@b`. Built by the owning {@link Paragraph} for placeholder text; absent\n\t\t * for non-placeholder runs. Called lazily.\n\t\t */\n\t\tprivate readonly inheritedBold?: () => boolean | null,\n\t\t/**\n\t\t * The owning part's relationships, used to resolve a run hyperlink's `@r:id`\n\t\t * to its external URL or internal target partname. Absent when the run was\n\t\t * reached without them (e.g. table-cell or notes text), in which case\n\t\t * {@link hyperlink} still reports the raw `@r:id`/`@action`/`@tooltip`.\n\t\t */\n\t\tprivate readonly relationships?: Relationships,\n\t\t/**\n\t\t * The owning shape's resolved `p:style/a:fontRef` colour + face tier — the\n\t\t * fallback consulted for {@link resolvedColor}/{@link resolvedFontFace} just\n\t\t * below the run's own `a:rPr` and above the placeholder/`p:defaultTextStyle`\n\t\t * chain. Absent when the shape has no `p:style/a:fontRef`.\n\t\t */\n\t\tprivate readonly fontRef?: StyleFontRef | null\n\t) {}\n\n\t/** The run's text (`a:t`), verbatim — whitespace is not normalized. */\n\tget text(): string {\n\t\treturn firstChild(this.element, 'a:t')?.textContent ?? ''\n\t}\n\n\tset text(value: string) {\n\t\tconst t = getOrAddChild(this.element, 'a:t')\n\t\tt.textContent = value\n\t\t// Preserve significant leading/trailing whitespace per the XML spec.\n\t\tif (value !== value.trim()) setAttr(t, 'xml:space', 'preserve')\n\t\telse removeAttr(t, 'xml:space')\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Font size in points (`a:rPr/@sz` is hundredths of a point), or `null` if unset. */\n\tget fontSizePt(): number | null {\n\t\tconst size = this.#rPrAttr('sz')\n\t\treturn size === null ? null : size / 100\n\t}\n\n\tset fontSizePt(value: number | null) {\n\t\tif (value === null) {\n\t\t\tthis.#removeRPrAttr('sz')\n\t\t\treturn\n\t\t}\n\t\tif (!Number.isFinite(value) || value <= 0)\n\t\t\tthrow new InvalidOptionError('font/size-not-positive', `fontSizePt must be a positive number, got ${value}`)\n\t\tsetAttr(this.#getOrAddRPr(), 'sz', String(Math.round(value * 100)))\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Bold (`a:rPr/@b`), or `null` when unset (inherited from style). */\n\tget bold(): boolean | null {\n\t\treturn boolValue(this.#rPrAttrRaw('b'))\n\t}\n\n\tset bold(value: boolean | null) {\n\t\tthis.#setBoolRPrAttr('b', value)\n\t}\n\n\t/** Italic (`a:rPr/@i`), or `null` when unset (inherited from style). */\n\tget italic(): boolean | null {\n\t\treturn boolValue(this.#rPrAttrRaw('i'))\n\t}\n\n\tset italic(value: boolean | null) {\n\t\tthis.#setBoolRPrAttr('i', value)\n\t}\n\n\t/** Underline style token (`a:rPr/@u`, e.g. `sng`), or `null` when unset. */\n\tget underline(): string | null {\n\t\treturn this.#rPrAttrRaw('u')\n\t}\n\n\tset underline(value: string | null) {\n\t\tif (value === null) {\n\t\t\tthis.#removeRPrAttr('u')\n\t\t\treturn\n\t\t}\n\t\tsetAttr(this.#getOrAddRPr(), 'u', value)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Strikethrough token (`a:rPr/@strike`: `noStrike` | `sngStrike` |\n\t * `dblStrike`), or `null` when unset (inherited from the style). Surfaced as\n\t * the raw token — `sngStrike` is the writer's single-strike value.\n\t */\n\tget strike(): string | null {\n\t\treturn this.#rPrAttrRaw('strike')\n\t}\n\n\t/**\n\t * Capitalization token (`a:rPr/@cap`: `none` | `small` | `all`), or `null`\n\t * when unset. `small` renders small-caps, `all` renders all-caps.\n\t */\n\tget caps(): string | null {\n\t\treturn this.#rPrAttrRaw('cap')\n\t}\n\n\t/**\n\t * Baseline shift as a percentage of the font size (`a:rPr/@baseline`, stored\n\t * in 1000ths of a percent): positive for superscript (the writer's default is\n\t * `30`), negative for subscript (`-40`), or `null` when unset. Reported as the\n\t * percentage (`@baseline` ÷ 1000).\n\t */\n\tget baselinePct(): number | null {\n\t\tconst raw = this.#rPrAttr('baseline')\n\t\treturn raw === null ? null : raw / 1000\n\t}\n\n\t/**\n\t * Character spacing (tracking) in points (`a:rPr/@spc`, authored in hundredths\n\t * of a point), or `null` when unset. Negative tightens. The read counterpart of\n\t * the write-side `charSpacing` option.\n\t */\n\tget charSpacingPt(): number | null {\n\t\tconst raw = this.#rPrAttr('spc')\n\t\treturn raw === null ? null : raw / 100\n\t}\n\n\t/**\n\t * The run's highlight colour (`a:rPr/a:highlight`), resolved to a literal hex\n\t * through the owning slide's theme, or `null` when the run has no highlight\n\t * (or a token colour cannot be made literal without a theme context). The\n\t * writer authors highlights from a hex colour, so `effectiveHex` is that\n\t * colour; imported decks may carry a theme token, resolved here when possible.\n\t */\n\tget highlight(): ResolvedColor | null {\n\t\tconst rPr = this.#rPr()\n\t\tconst hl = rPr && firstChild(rPr, 'a:highlight')\n\t\tif (!hl) return null\n\t\tconst colorEl = firstChildElement(hl)\n\t\tif (!colorEl) return null\n\t\tif (this.themeContext) return resolveColorElement(colorEl, this.themeContext)\n\t\t// Without a theme context only a literal srgbClr can be made concrete.\n\t\tconst hex = colorEl.localName === 'srgbClr' ? attr(colorEl, 'val') : null\n\t\treturn hex ? { hex, transforms: [], effectiveHex: hex } : null\n\t}\n\n\t/**\n\t * The run's click hyperlink (`a:rPr/a:hlinkClick`), or `null` when the run\n\t * carries none. A URL link resolves its `@r:id` to the external target\n\t * ({@link RunHyperlink.url}); a slide jump resolves it to the linked slide's\n\t * partname ({@link RunHyperlink.targetPartName}). When the run was reached\n\t * without the owning part's relationships, only the raw `@r:id`/`@action`/\n\t * `@tooltip` are reported (the target stays `null`).\n\t */\n\tget hyperlink(): RunHyperlink | null {\n\t\tconst rPr = this.#rPr()\n\t\tconst hlink = rPr && firstChild(rPr, 'a:hlinkClick')\n\t\tif (!hlink) return null\n\t\tconst relId = attr(hlink, 'r:id') || null\n\t\tconst action = attr(hlink, 'action') || null\n\t\tconst tooltip = attr(hlink, 'tooltip') || null\n\t\tlet url: string | null = null\n\t\tlet targetPartName: string | null = null\n\t\tif (relId && this.relationships) {\n\t\t\tconst rel = this.relationships.get(relId)\n\t\t\tif (rel?.targetMode === 'External') url = rel.target\n\t\t\telse if (rel) targetPartName = this.relationships.resolveTarget(relId)\n\t\t}\n\t\treturn { url, targetPartName, action, tooltip, relId }\n\t}\n\n\t/** Latin typeface name (`a:rPr/a:latin/@typeface`), or `null` when unset. */\n\tget fontName(): string | null {\n\t\tconst rPr = this.#rPr()\n\t\tconst latin = rPr && firstChild(rPr, 'a:latin')\n\t\treturn latin ? attr(latin, 'typeface') : null\n\t}\n\n\tset fontName(value: string | null) {\n\t\tif (value === null) {\n\t\t\tconst rPr = this.#rPr()\n\t\t\tif (rPr) removeChildrenByQName(rPr, ['a:latin'])\n\t\t\tif (rPr) this.part.markDirty()\n\t\t\treturn\n\t\t}\n\t\tconst latin = getOrAddChild(this.#getOrAddRPr(), 'a:latin', RPR_AFTER_LATIN)\n\t\tsetAttr(latin, 'typeface', value)\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Explicit RGB fill colour as a 6-hex string (`a:solidFill/a:srgbClr/@val`), or `null`. */\n\tget color(): string | null {\n\t\treturn solidFillColor(this.#rPr(), 'a:srgbClr')\n\t}\n\n\tset color(value: string | null) {\n\t\tthis.#setSolidFill(value === null ? null : { qname: 'a:srgbClr', val: normalizeHex(value) })\n\t}\n\n\t/** Theme colour token when the fill is a scheme colour (`a:schemeClr/@val`, e.g. `accent2`), or `null`. */\n\tget schemeColor(): string | null {\n\t\treturn solidFillColor(this.#rPr(), 'a:schemeClr')\n\t}\n\n\tset schemeColor(value: string | null) {\n\t\tthis.#setSolidFill(value === null ? null : { qname: 'a:schemeClr', val: value })\n\t}\n\n\t/**\n\t * The colour this run effectively renders, resolved against the owning slide's\n\t * theme to a literal hex. It is the run's own solid fill\n\t * ({@link color}/{@link schemeColor}) when set; otherwise the shape's\n\t * `p:style/a:fontRef` colour, then — for a run inside a placeholder — the colour\n\t * it inherits from the placeholder/list-style chain (layout → master placeholder\n\t * `a:lstStyle` → master `p:txStyles`), then the presentation's\n\t * `p:defaultTextStyle`. `null` when the run sets no colour and inherits none, the\n\t * colour cannot be made literal, or the run was reached without a theme context.\n\t * The returned {@link ResolvedColor} carries `effectiveHex` — the base colour with\n\t * its child transforms (`lumMod`/`shade`/…) applied — for the final rendered colour.\n\t */\n\tget resolvedColor(): ResolvedColor | null {\n\t\tif (!this.themeContext) return null\n\t\treturn (\n\t\t\tresolveSolidFillColor(this.#rPr(), this.themeContext) ?? this.fontRef?.color ?? this.inheritedColor?.() ?? null\n\t\t)\n\t}\n\n\t/**\n\t * The point size this run effectively renders. It is the run's own `@sz`\n\t * ({@link fontSizePt}) when set; otherwise, for a run inside a placeholder, the\n\t * size it inherits from the placeholder/list-style chain (paragraph `a:defRPr` →\n\t * slide `a:lstStyle` → layout → master placeholder `a:lstStyle` → master\n\t * `p:txStyles`). `null` when the run sets no size and inherits none — the\n\t * resolved counterpart of {@link fontSizePt}, which reports only the run's own value.\n\t */\n\tget resolvedSizePt(): number | null {\n\t\treturn this.fontSizePt ?? this.inheritedSize?.() ?? null\n\t}\n\n\t/**\n\t * The typeface this run effectively renders, resolved to a literal face name. It\n\t * is the run's own `a:latin` ({@link fontName}) when set; otherwise the face named\n\t * by the shape's `p:style/a:fontRef` (`idx` → theme major/minor font), then — for a\n\t * run inside a placeholder — the face it inherits from the placeholder/list-style\n\t * chain, then the presentation's `p:defaultTextStyle`. A `+mj-*`/`+mn-*`\n\t * major/minor theme-font token — on the run itself or reached through the chain —\n\t * is resolved through the theme `fontScheme` to its concrete face. `null` when the\n\t * run names no face and inherits none, or a token cannot be resolved — the resolved\n\t * counterpart of {@link fontName}, which reports the raw `@typeface` (possibly a token).\n\t */\n\tget resolvedFontFace(): string | null {\n\t\tconst own = this.fontName\n\t\tif (own !== null) return resolveThemeFont(own, this.themeContext?.fontScheme ?? null)\n\t\treturn this.fontRef?.face ?? this.inheritedFace?.() ?? null\n\t}\n\n\t/**\n\t * Whether this run effectively renders bold. It is the run's own `@b`\n\t * ({@link bold}) when set; otherwise, for a run inside a placeholder, the bold\n\t * state it inherits from the placeholder/list-style chain (paragraph `a:defRPr` →\n\t * slide `a:lstStyle` → layout → master placeholder `a:lstStyle` → master\n\t * `p:txStyles`). `null` when the run sets no `@b` and inherits none — the\n\t * resolved counterpart of {@link bold}, which reports only the run's own value.\n\t */\n\tget resolvedBold(): boolean | null {\n\t\treturn this.bold ?? this.inheritedBold?.() ?? null\n\t}\n\n\t/** Escape hatch: the underlying `a:r` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.element\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n\n\t#rPr(): Element | null {\n\t\treturn firstChild(this.element, 'a:rPr')\n\t}\n\n\t#getOrAddRPr(): Element {\n\t\treturn getOrAddChild(this.element, 'a:rPr', ['a:t'])\n\t}\n\n\t#rPrAttrRaw(name: string): string | null {\n\t\tconst rPr = this.#rPr()\n\t\treturn rPr ? attr(rPr, name) : null\n\t}\n\n\t#rPrAttr(name: string): number | null {\n\t\treturn intValue(this.#rPrAttrRaw(name))\n\t}\n\n\t#removeRPrAttr(name: string): void {\n\t\tconst rPr = this.#rPr()\n\t\tif (!rPr) return\n\t\tremoveAttr(rPr, name)\n\t\tthis.part.markDirty()\n\t}\n\n\t#setBoolRPrAttr(name: string, value: boolean | null): void {\n\t\tif (value === null) {\n\t\t\tthis.#removeRPrAttr(name)\n\t\t\treturn\n\t\t}\n\t\tsetAttr(this.#getOrAddRPr(), name, value ? '1' : '0')\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Replace the run's solid fill with a single colour element, or clear it when `null`. */\n\t#setSolidFill(color: { qname: string; val: string } | null): void {\n\t\tif (color === null) {\n\t\t\tconst rPr = this.#rPr()\n\t\t\tif (!rPr) return\n\t\t\tremoveChildrenByQName(rPr, ['a:solidFill'])\n\t\t\tthis.part.markDirty()\n\t\t\treturn\n\t\t}\n\t\tsetSolidFill(this.#getOrAddRPr(), RPR_AFTER_FILL, color)\n\t\tthis.part.markDirty()\n\t}\n}\n\n/** One paragraph (`a:p`) of a text frame. */\nexport class Paragraph {\n\tconstructor(\n\t\tprivate readonly element: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Run} for the `resolved*` getters. */\n\t\tprivate readonly themeContext?: ThemeContext,\n\t\t/**\n\t\t * Placeholder + slide-list-style context for resolving a placeholder-inherited\n\t\t * run colour/size/face; absent for non-placeholder text. The owning\n\t\t * {@link TextFrame} supplies the placeholder identity and the text body's\n\t\t * `a:lstStyle`.\n\t\t */\n\t\tprivate readonly inherit?: { placeholder: PlaceholderTextContext; slideLstStyle: Element | null },\n\t\t/** The owning part's relationships, threaded to each {@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */\n\t\tprivate readonly relationships?: Relationships\n\t) {}\n\n\t/** The runs (`a:r`) in document order. Fields (`a:fld`) and breaks are not runs; see `text`. */\n\tget runs(): Run[] {\n\t\tconst inheritedColor = this.#inheritedColorResolver()\n\t\tconst inheritedSize = this.#inheritedResolver((ph, level, pPr, slideLst, ctx) =>\n\t\t\tresolveInheritedRunSize(ph, level, pPr, slideLst, ctx)\n\t\t)\n\t\tconst inheritedFace = this.#inheritedResolver((ph, level, pPr, slideLst, ctx) =>\n\t\t\tresolveInheritedRunFontFace(ph, level, pPr, slideLst, ctx)\n\t\t)\n\t\tconst inheritedBold = this.#inheritedResolver((ph, level, pPr, slideLst, ctx) =>\n\t\t\tresolveInheritedRunBold(ph, level, pPr, slideLst, ctx)\n\t\t)\n\t\tconst fontRef = this.inherit?.placeholder.fontRef ?? null\n\t\treturn getElements(this.element, 'a:r').map(\n\t\t\t(element) =>\n\t\t\t\tnew Run(\n\t\t\t\t\telement,\n\t\t\t\t\tthis.part,\n\t\t\t\t\tthis.themeContext,\n\t\t\t\t\tinheritedColor,\n\t\t\t\t\tinheritedSize,\n\t\t\t\t\tinheritedFace,\n\t\t\t\t\tinheritedBold,\n\t\t\t\t\tthis.relationships,\n\t\t\t\t\tfontRef\n\t\t\t\t)\n\t\t)\n\t}\n\n\t/**\n\t * A memoized thunk resolving the colour every run in this paragraph inherits\n\t * when it sets none of its own, or `undefined` for non-placeholder paragraphs.\n\t * Runs in one paragraph share a level and `a:pPr`, so the lookup runs at most\n\t * once per paragraph and only when a colourless run actually asks for it.\n\t */\n\t#inheritedColorResolver(): (() => ResolvedColor | null) | undefined {\n\t\treturn this.#inheritedResolver((ph, level, pPr, slideLst, ctx) =>\n\t\t\tresolveInheritedRunColor(ph, level, pPr, slideLst, ctx)\n\t\t)\n\t}\n\n\t/**\n\t * Build a memoized per-paragraph thunk for one inherited run property\n\t * (colour/size/face), or `undefined` for non-placeholder paragraphs. All runs in\n\t * a paragraph share its level and `a:pPr`, so each `resolve` runs at most once\n\t * and only when a run actually lacks its own value and asks.\n\t */\n\t#inheritedResolver<T>(\n\t\tresolve: (\n\t\t\tph: PlaceholderRef | null,\n\t\t\tlevel: number,\n\t\t\tpPr: Element | null,\n\t\t\tslideLstStyle: Element | null,\n\t\t\tctx: ThemeContext\n\t\t) => T | null\n\t): (() => T | null) | undefined {\n\t\tif (!this.inherit) return undefined\n\t\tconst { placeholder, slideLstStyle } = this.inherit\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\tconst level = this.level\n\t\tlet cached: T | null | undefined\n\t\treturn () =>\n\t\t\tcached === undefined ? (cached = resolve(placeholder.ph, level, pPr, slideLstStyle, placeholder.flatten)) : cached\n\t}\n\n\t/** Indent level (`a:pPr/@lvl`), 0 when unset. */\n\tget level(): number {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\treturn (pPr && intValue(attr(pPr, 'lvl'))) ?? 0\n\t}\n\n\t/**\n\t * Horizontal alignment token (`a:pPr/@algn`: `l` | `ctr` | `r` | `just` |\n\t * `dist` | `thaiDist`), or `null` when unset (inherited from the list style).\n\t */\n\tget align(): string | null {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\treturn pPr ? attr(pPr, 'algn') : null\n\t}\n\n\t/**\n\t * Space before the paragraph in points (`a:pPr/a:spcBef/a:spcPts/@val` is\n\t * hundredths of a point), or `null` when unset or expressed as a percentage\n\t * (`a:spcPct`, which has no fixed point value).\n\t */\n\tget spaceBeforePt(): number | null {\n\t\treturn this.#spacingPt('a:spcBef')\n\t}\n\n\t/** Space after the paragraph in points; see {@link spaceBeforePt} for the percentage caveat. */\n\tget spaceAfterPt(): number | null {\n\t\treturn this.#spacingPt('a:spcAft')\n\t}\n\n\t/**\n\t * The paragraph's line spacing (`a:pPr/a:lnSpc`), as an exact point height\n\t * (`a:spcPts`) or a percentage of the single-line height (`a:spcPct`), or\n\t * `null` when unset (inherited from the list style). See {@link LineSpacing}.\n\t */\n\tget lineSpacing(): LineSpacing | null {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\tconst lnSpc = pPr && firstChild(pPr, 'a:lnSpc')\n\t\tif (!lnSpc) return null\n\t\tconst pts = firstChild(lnSpc, 'a:spcPts')\n\t\tif (pts) {\n\t\t\tconst val = intValue(attr(pts, 'val'))\n\t\t\treturn val === null ? null : { type: 'points', valuePt: val / 100 }\n\t\t}\n\t\tconst pct = firstChild(lnSpc, 'a:spcPct')\n\t\tif (pct) {\n\t\t\tconst val = intValue(attr(pct, 'val'))\n\t\t\treturn val === null ? null : { type: 'percent', percent: val / 1000 }\n\t\t}\n\t\treturn null\n\t}\n\n\t/** Left margin of the paragraph in points (`a:pPr/@marL` is EMU; 12700 EMU = 1pt), or `null` when unset. */\n\tget marginLeftPt(): number | null {\n\t\treturn this.#emuAttrPt('marL')\n\t}\n\n\t/** First-line indent in points (`a:pPr/@indent` is EMU; negative for a hanging indent), or `null` when unset. */\n\tget indentPt(): number | null {\n\t\treturn this.#emuAttrPt('indent')\n\t}\n\n\t/**\n\t * This paragraph's bullet — its kind, and for a drawn bullet the glyph, the\n\t * numbering start, and the bullet's own font/size/colour. `null` when the\n\t * paragraph names no bullet at all and inherits one from the list style.\n\t *\n\t * Structured rather than a tagged string, which is not merely tidier. The\n\t * previous `bullet` accessor reported `'none'` / `'char:•'` /\n\t * `'autoNum:arabicPeriod'`, and that shape is ambiguous when the glyph is\n\t * itself a colon; worse, it reads as a bare glyph, which is exactly how the\n\t * script converter first consumed it — `'none'.codePointAt(0)` put a literal\n\t * `n` bullet on every converted deck, silently. See {@link BulletDetail}.\n\t */\n\tget bulletDetail(): BulletDetail | null {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\tif (!pPr) return null\n\t\tif (firstChild(pPr, 'a:buNone')) return { kind: 'none' }\n\n\t\tconst style = this.#bulletStyle(pPr)\n\t\tconst buChar = firstChild(pPr, 'a:buChar')\n\t\tif (buChar) return { kind: 'char', char: attr(buChar, 'char') ?? '', ...style }\n\n\t\tconst buAutoNum = firstChild(pPr, 'a:buAutoNum')\n\t\tif (buAutoNum) {\n\t\t\treturn {\n\t\t\t\tkind: 'autoNum',\n\t\t\t\tscheme: attr(buAutoNum, 'type') ?? '',\n\t\t\t\tstartAt: intValue(attr(buAutoNum, 'startAt')),\n\t\t\t\t...style,\n\t\t\t}\n\t\t}\n\n\t\tconst buBlip = firstChild(pPr, 'a:buBlip')\n\t\tif (buBlip) return { kind: 'picture', imagePartName: this.#bulletImagePartName(buBlip), ...style }\n\n\t\treturn null\n\t}\n\n\t/** The `a:buFont` / `a:buSz*` / `a:buClr` siblings of a `a:pPr` bullet choice. */\n\t#bulletStyle(pPr: Element): BulletStyle {\n\t\tconst buFont = firstChild(pPr, 'a:buFont')\n\t\tconst buSzPct = firstChild(pPr, 'a:buSzPct')\n\t\tconst buSzPts = firstChild(pPr, 'a:buSzPts')\n\t\tconst buClr = firstChild(pPr, 'a:buClr')\n\t\t// `a:buClr` holds the colour element directly (CT_Color), not wrapped in an\n\t\t// `a:solidFill` the way a run or a shape fill does.\n\t\tconst colorEl = buClr ? firstChildElement(buClr) : null\n\t\tconst pctVal = buSzPct ? intValue(attr(buSzPct, 'val')) : null\n\t\tconst ptVal = buSzPts ? intValue(attr(buSzPts, 'val')) : null\n\t\treturn {\n\t\t\tfont: buFont ? (attr(buFont, 'typeface') ?? null) : null,\n\t\t\tsizePct: pctVal === null ? null : pctVal / 1000,\n\t\t\tsizePt: ptVal === null ? null : ptVal / 100,\n\t\t\tcolor: colorEl?.localName === 'srgbClr' ? (attr(colorEl, 'val') ?? null) : null,\n\t\t\tschemeColor: colorEl?.localName === 'schemeClr' ? (attr(colorEl, 'val') ?? null) : null,\n\t\t\tresolvedColor: this.themeContext ? resolveColorElement(colorEl, this.themeContext) : null,\n\t\t}\n\t}\n\n\t/** Resolve a picture bullet's `a:buBlip/a:blip/@r:embed` to an absolute partname. */\n\t#bulletImagePartName(buBlip: Element): string | null {\n\t\tconst blip = firstChild(buBlip, 'a:blip')\n\t\tconst relId = blip && attr(blip, 'r:embed')\n\t\tif (!relId || !this.relationships) return null\n\t\treturn this.relationships.resolveTarget(relId)\n\t}\n\n\t/** Points from a spacing child's `a:spcPts/@val` (hundredths of a point), or `null`. */\n\t#spacingPt(qname: string): number | null {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\tconst spc = pPr && firstChild(pPr, qname)\n\t\tconst pts = spc && firstChild(spc, 'a:spcPts')\n\t\tconst val = pts ? intValue(attr(pts, 'val')) : null\n\t\treturn val === null ? null : val / 100\n\t}\n\n\t/** Points from an EMU-valued `a:pPr` attribute (`marL` / `indent`), or `null`. */\n\t#emuAttrPt(name: string): number | null {\n\t\tconst pPr = firstChild(this.element, 'a:pPr')\n\t\tconst emu = pPr ? intValue(attr(pPr, name)) : null\n\t\treturn emu === null ? null : emu / 12700\n\t}\n\n\t/**\n\t * The paragraph's text: run (`a:r`) and field (`a:fld`) text concatenated in\n\t * document order, with each line break (`a:br`) rendered as `\\n`.\n\t */\n\tget text(): string {\n\t\tlet out = ''\n\t\tfor (let node = this.element.firstChild; node; node = node.nextSibling) {\n\t\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\t\tconst element = node as Element\n\t\t\tif (element.localName === 'r' || element.localName === 'fld') {\n\t\t\t\tout += firstChild(element, 'a:t')?.textContent ?? ''\n\t\t\t} else if (element.localName === 'br') {\n\t\t\t\tout += '\\n'\n\t\t\t}\n\t\t}\n\t\treturn out\n\t}\n\n\t/** Escape hatch: the underlying `a:p` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.element\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n}\n\n/** A shape's text frame (`p:txBody`): an ordered list of paragraphs. */\n/**\n * A text frame's body properties (`a:bodyPr`), as read from a shape. Carries the\n * inset/anchor/vertical-text settings that govern where text sits inside its box\n * — the difference between a label that clears a left rail and one that overlaps\n * it. Only **explicitly set** attributes are reported; an absent inset means the\n * PowerPoint default (`lIns`/`rIns` = 0.1\", `tIns`/`bIns` = 0.05\").\n */\nexport interface BodyProperties {\n\t/** Text direction (`@vert`: `horz`/`vert`/`vert270`/`eaVert`/`wordArtVert`…), or `null` when horizontal/unset. */\n\tvert: string | null\n\t/** Vertical anchor (`@anchor`: `t`/`ctr`/`b`), or `null` when unset (defaults to top). */\n\tanchor: string | null\n\t/** Wrap mode (`@wrap`: `square`/`none`), or `null` when unset. */\n\twrap: string | null\n\t/** Explicitly-set text insets in points (`@lIns`/`@rIns`/`@tIns`/`@bIns` ÷ 12700); a missing side uses the PowerPoint default. */\n\tinsetsPt: { left?: number; right?: number; top?: number; bottom?: number }\n}\n\n/**\n * A text frame's vertical-autofit mode, read from its `a:bodyPr` autofit child:\n * - `'none'` — `a:noAutofit`, or no autofit child at all (the box has a fixed\n * size and text can overflow); write-side `fit: 'none'`.\n * - `'normAutofit'`— `a:normAutofit` (shrink text to fit); write-side `fit: 'shrink'`.\n * - `'spAutoFit'` — `a:spAutoFit` (resize the shape to fit text); write-side `fit: 'resize'`.\n */\nexport type AutofitMode = 'none' | 'normAutofit' | 'spAutoFit'\n\nexport class TextFrame {\n\tconstructor(\n\t\tprivate readonly txBody: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Paragraph}/{@link Run} for the `resolved*` getters. */\n\t\tprivate readonly themeContext?: ThemeContext,\n\t\t/**\n\t\t * The placeholder this text body lives in, when any — enables\n\t\t * placeholder-inherited run colour/size/face resolution. Absent for ordinary\n\t\t * text boxes and table cells.\n\t\t */\n\t\tprivate readonly placeholder?: PlaceholderTextContext,\n\t\t/** The owning part's relationships, threaded to each {@link Paragraph}/{@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */\n\t\tprivate readonly relationships?: Relationships\n\t) {}\n\n\t/** Paragraphs (`a:p`) in document order. */\n\tget paragraphs(): Paragraph[] {\n\t\t// The slide text body's own list style is the tier just below the run/paragraph\n\t\t// in the placeholder inheritance chain; resolve it once and share it.\n\t\tconst inherit = this.placeholder\n\t\t\t? { placeholder: this.placeholder, slideLstStyle: firstChild(this.txBody, 'a:lstStyle') }\n\t\t\t: undefined\n\t\treturn getElements(this.txBody, 'a:p').map(\n\t\t\t(element) => new Paragraph(element, this.part, this.themeContext, inherit, this.relationships)\n\t\t)\n\t}\n\n\t/**\n\t * The frame's body properties (`a:bodyPr`: insets, anchor, vertical text), or\n\t * `null` when there is no `a:bodyPr`. Only explicitly-set insets are reported\n\t * (a missing side is the PowerPoint default — see {@link BodyProperties}).\n\t */\n\tget bodyProperties(): BodyProperties | null {\n\t\tconst bodyPr = firstChild(this.txBody, 'a:bodyPr')\n\t\tif (!bodyPr) return null\n\t\tconst insetsPt: BodyProperties['insetsPt'] = {}\n\t\tconst inset = (qn: string, key: keyof BodyProperties['insetsPt']): void => {\n\t\t\tconst v = intValue(attr(bodyPr, qn))\n\t\t\tif (v !== null) insetsPt[key] = v / 12700\n\t\t}\n\t\tinset('lIns', 'left')\n\t\tinset('rIns', 'right')\n\t\tinset('tIns', 'top')\n\t\tinset('bIns', 'bottom')\n\t\treturn {\n\t\t\tvert: attr(bodyPr, 'vert') ?? null,\n\t\t\tanchor: attr(bodyPr, 'anchor') ?? null,\n\t\t\twrap: attr(bodyPr, 'wrap') ?? null,\n\t\t\tinsetsPt,\n\t\t}\n\t}\n\n\t/**\n\t * The effective vertical anchor (`t`/`ctr`/`b`): the frame's own\n\t * `a:bodyPr/@anchor` when set, else the anchor it inherits from its\n\t * layout → master placeholder `a:bodyPr`. `null` when nothing in the chain sets\n\t * one (PowerPoint then defaults to top). Unlike {@link bodyProperties}'s\n\t * `anchor` (own attribute only), this surfaces the inherited anchor a\n\t * placeholder title relies on — the difference between a top- and\n\t * centre-anchored title that own-attribute reads alone cannot see.\n\t */\n\tget resolvedAnchor(): string | null {\n\t\tconst own = this.bodyProperties?.anchor\n\t\tif (own) return own\n\t\t// Anchor inheritance is placeholder-only; a non-placeholder frame (ph null) has none.\n\t\tconst ph = this.placeholder?.ph\n\t\tif (!ph) return null\n\t\treturn resolveInheritedAnchor(ph, this.placeholder.flatten)\n\t}\n\n\t/**\n\t * The frame's vertical-autofit mode (`a:bodyPr` autofit child), or `null` when\n\t * there is no `a:bodyPr`. A `bodyPr` with no autofit child — or an explicit\n\t * `a:noAutofit` — reads `'none'`. See {@link AutofitMode}. This is the deep-model\n\t * counterpart of `inspectPptx`'s per-shape `autofit`; unlike the shallow surface\n\t * it hangs off the navigable text frame.\n\t */\n\tget autofit(): AutofitMode | null {\n\t\tconst bodyPr = firstChild(this.txBody, 'a:bodyPr')\n\t\tif (!bodyPr) return null\n\t\tif (firstChild(bodyPr, 'a:spAutoFit')) return 'spAutoFit'\n\t\tif (firstChild(bodyPr, 'a:normAutofit')) return 'normAutofit'\n\t\treturn 'none'\n\t}\n\n\t/**\n\t * The baked shrink scale of a `normAutofit` frame as a percent (62.5 = 62.5%),\n\t * or `null` when the frame has no `a:normAutofit` or bakes no scale. A bare\n\t * `<a:normAutofit/>` (write-side `fit: 'shrink'`) carries no scale — PowerPoint\n\t * computes it on edit and draws at 100% until then — so it too reads `null`; an\n\t * explicit scale comes from `fit: { type: 'shrink', fontScale }`.\n\t */\n\tget autofitFontScale(): number | null {\n\t\treturn this.#normAutofitPct('fontScale')\n\t}\n\n\t/**\n\t * The baked line-spacing reduction of a `normAutofit` frame as a percent\n\t * (`a:normAutofit/@lnSpcReduction` ÷ 1000), or `null` when unset. The companion\n\t * to {@link autofitFontScale} (write-side `fit: { type: 'shrink', lnSpcReduction }`).\n\t */\n\tget autofitLineSpaceReduction(): number | null {\n\t\treturn this.#normAutofitPct('lnSpcReduction')\n\t}\n\n\t/** A `a:normAutofit` percentage attribute (stored in 1000ths of a percent → percent), or `null`. */\n\t#normAutofitPct(name: string): number | null {\n\t\tconst bodyPr = firstChild(this.txBody, 'a:bodyPr')\n\t\tconst norm = bodyPr && firstChild(bodyPr, 'a:normAutofit')\n\t\tconst raw = norm ? intValue(attr(norm, name)) : null\n\t\treturn raw === null ? null : raw / 1000\n\t}\n\n\t/** All paragraph text joined by `\\n` (mirrors python-pptx `TextFrame.text`). */\n\tget text(): string {\n\t\treturn this.paragraphs.map((paragraph) => paragraph.text).join('\\n')\n\t}\n\n\t/**\n\t * Replace the frame's text with a single paragraph and run, preserving the\n\t * character formatting (`a:rPr`) of the frame's first existing run when there\n\t * is one. For multiple runs or per-run formatting, edit\n\t * `paragraphs[].runs[]` directly.\n\t */\n\tset text(value: string) {\n\t\tsetTextBodyText(this.txBody, value)\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Escape hatch: the underlying `p:txBody` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.txBody\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n}\n\n/**\n * Replace a text body's content (`a:txBody` or `a:txBody`-shaped element) with a\n * single paragraph and run, preserving the `a:rPr` of the body's first existing\n * run when there is one. Shared by {@link TextFrame.text} and `TableCell.text`.\n * Does **not** mark any part dirty — the caller owns the `Part` and must call\n * `markDirty()` after.\n */\nexport function setTextBodyText(txBody: Element, value: string): void {\n\tconst doc = txBody.ownerDocument\n\tif (!doc) throw new InternalError('oxml/node-has-no-document', 'Cannot set text: text body has no owner document')\n\n\tconst paragraphs = getElements(txBody, 'a:p')\n\t// Capture the first run's character formatting before we discard runs.\n\tconst firstRun = paragraphs[0] && firstChild(paragraphs[0], 'a:r')\n\tconst rPrTemplate = firstRun && firstChild(firstRun, 'a:rPr')\n\n\t// Collapse to a single paragraph, dropping any extras.\n\tfor (let i = paragraphs.length - 1; i >= 1; i--) {\n\t\tconst extra = paragraphs[i]\n\t\tif (extra) txBody.removeChild(extra)\n\t}\n\tlet p = paragraphs[0]\n\tif (!p) {\n\t\tp = createElement(doc, 'a:p')\n\t\ttxBody.appendChild(p)\n\t}\n\n\t// Remove every run-level child (runs, breaks, fields); keep a:pPr / a:endParaRPr.\n\tfor (const child of childElements(p)) {\n\t\tif (child.localName === 'r' || child.localName === 'br' || child.localName === 'fld') p.removeChild(child)\n\t}\n\n\t// Build a single run, carrying over the captured formatting if present.\n\tconst run = createElement(doc, 'a:r')\n\tif (rPrTemplate) run.appendChild(rPrTemplate.cloneNode(true))\n\tconst t = createElement(doc, 'a:t')\n\tt.textContent = value\n\tif (value !== value.trim()) setAttr(t, 'xml:space', 'preserve')\n\telse removeAttr(t, 'xml:space')\n\trun.appendChild(t)\n\n\t// Insert before a:endParaRPr if present (it must stay last), else append.\n\tconst endParaRPr = firstChild(p, 'a:endParaRPr')\n\tp.insertBefore(run, endParaRPr)\n}\n","/**\n * The abstract base every shape kind extends.\n *\n * It owns everything a shape has regardless of kind: non-visual identity (id / name / hidden /\n * description / decorative), geometry through the subclass-supplied `a:xfrm`, and the `p:spPr`\n * surface — fill, line, gradient, effects — resolved against the host's theme. Kind-specific\n * reads live on the subclasses in the sibling modules.\n *\n * A proxy holds a back-reference to its owning {@link ShapeHost} — a `Slide`, a `SlideLayout` or a\n * `SlideMaster` — so it can resolve relationships and theme colours, and so a mutation can mark\n * that host's part dirty.\n */\n\nimport {\n\tELEMENT_NODE,\n\tOOXML_NS,\n\tattr,\n\tboolValue,\n\tfirstChild,\n\tfirstChildElement,\n\tgetElements,\n\tgetOrAddChild,\n\tintValue,\n\tremoveAttr,\n\tremoveChildrenByQName,\n\tsetAttr,\n\ttype Element,\n} from '../../oxml/dom.js'\nimport { composeGroupFrame, type GroupTransform } from './group-transform.js'\nimport { FILL_CHOICES, normalizeHex, setSolidFill, solidFillColor } from '../../oxml/fill.js'\nimport {\n\tresolveColorElement,\n\tresolveInheritedFrame,\n\tresolveSolidFillColor,\n\tresolveStyleFillColor,\n\tresolveStyleLineColor,\n\ttype PlaceholderRef,\n\ttype ResolvedColor,\n\ttype ResolvedFrame,\n} from '../theme-context.js'\nimport { readGradientFill, readGradientStops, type GradientFill, type GradientStop } from '../gradient.js'\nimport { readPictureFill, type PictureFill } from '../picture-fill.js'\nimport { readPatternFill } from '../pattern-fill.js'\nimport { TextFrame } from '../text.js'\nimport type { ShapeHost } from './host.js'\nimport {\n\tchildElements,\n\temuFrom,\n\tnonVisualCNvPr,\n\tLN_FILL_AFTER,\n\tSHAPE_AFTER_SPPR,\n\tSPPR_FILL_AFTER,\n\tSPPR_LN_AFTER,\n\ttype ShapeProperties,\n} from './oxml.js'\nimport { readBox, rotationDegrees, toEmu, transformFlipH, transformFlipV } from './geometry.js'\nimport type {\n\tAbsoluteFrame,\n\tGlow,\n\tInnerShadow,\n\tLineEnd,\n\tLineEnds,\n\tOuterShadow,\n\tPatternFill,\n\tReflection,\n\tShapeType,\n\tSoftEdge,\n} from './types.js'\nimport { InternalError, PackageReadError, UnsupportedFeatureError } from '../../../errors.js'\n\n// Microsoft's \"decorative\" accessibility extension: p:cNvPr/a:extLst/a:ext\n// (uri {C183D7F6-B498-43B3-948B-1728B52AA6E4}) / adec:decorative. Confirmed\n// against real PowerPoint output (\"Mark as decorative\").\nconst ADEC_NS = 'http://schemas.microsoft.com/office/drawing/2017/decorative'\n\n/** Common base for every shape in a shape tree — a slide's, a layout's, or a master's. */\nexport abstract class Shape {\n\tconstructor(\n\t\tprotected readonly element: Element,\n\t\t/**\n\t\t * The part that owns this shape's tree — a `Slide`, a `SlideLayout`, or a\n\t\t * `SlideMaster`. Narrow it with `instanceof` when you need the concrete class;\n\t\t * {@link ShapeHost.partName} tells the tiers apart without one.\n\t\t */\n\t\treadonly host: ShapeHost\n\t) {}\n\n\t/** Which concrete shape kind this is. */\n\tabstract readonly shapeType: ShapeType\n\n\t/** The transform element (`a:xfrm` or `p:xfrm`) carrying this shape's geometry, or `null` if inherited. */\n\tprotected abstract xfrm(): Element | null\n\n\t/** The transform element, creating it (and its container) in document order if absent. */\n\tprotected abstract getOrAddXfrm(): Element\n\n\t/**\n\t * Mark the owning host's part dirty so `save()` reserializes it. Public\n\t * because {@link element_} hands out the live DOM node: the hatch and the\n\t * obligation that comes with it belong on the same object.\n\t */\n\tmarkDirty(): void {\n\t\tthis.host.part.markDirty()\n\t}\n\n\t/** Drawing id (`p:cNvPr/@id`), or `null` if absent. */\n\tget id(): number | null {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\treturn cNvPr ? intValue(attr(cNvPr, 'id')) : null\n\t}\n\n\t/** Shape name (`p:cNvPr/@name`), or `''` if unnamed. */\n\tget name(): string {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\treturn (cNvPr && attr(cNvPr, 'name')) ?? ''\n\t}\n\n\t/**\n\t * Whether the shape is explicitly hidden (`p:cNvPr/@hidden=\"1\"`); `false` when\n\t * the attribute is unset. A hidden shape stays in the slide XML but is not\n\t * rendered — decks use it as a fallback layer (e.g. a duotone-recolour source\n\t * sitting behind the visible icon), so a faithful reader must distinguish it\n\t * from the drawn shapes.\n\t */\n\tget hidden(): boolean {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\treturn boolValue(cNvPr && attr(cNvPr, 'hidden')) === true\n\t}\n\n\t/**\n\t * The shape's alt-text description (`p:cNvPr/@descr`), or `null` when unset.\n\t * This is the accessibility primitive a screen reader announces; an audit or\n\t * accessible-export tool reads it here. Distinct from {@link name}, which is\n\t * the authoring-time shape name and is never surfaced to assistive tech.\n\t */\n\tget description(): string | null {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\tconst v = cNvPr && attr(cNvPr, 'descr')\n\t\treturn v ?? null\n\t}\n\n\t/**\n\t * Set (or clear, with `''`) the alt-text description. Requires the shape's\n\t * `p:cNvPr` to exist, which every well-formed shape carries.\n\t */\n\tset description(value: string) {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\tif (!cNvPr)\n\t\t\tthrow new PackageReadError('shape/no-non-visual-properties', 'cannot set description: shape has no p:cNvPr')\n\t\tif (value === '') removeAttr(cNvPr, 'descr')\n\t\telse setAttr(cNvPr, 'descr', value)\n\t\tthis.markDirty()\n\t}\n\n\t/**\n\t * The shape's alt-text title (`p:cNvPr/@title`), or `null` when unset. Modern\n\t * PowerPoint no longer exposes a separate title field (only description +\n\t * \"mark as decorative\"), so this is usually `null`; it survives on decks\n\t * authored by older PowerPoint or other producers that still write it.\n\t */\n\tget title(): string | null {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\tconst v = cNvPr && attr(cNvPr, 'title')\n\t\treturn v ?? null\n\t}\n\n\t/**\n\t * Whether the shape is flagged **decorative** (`p:cNvPr/a:extLst/a:ext`\n\t * uri `{C183D7F6-…}` / `adec:decorative@val`), PowerPoint's \"Mark as\n\t * decorative\" — a purely visual element assistive tech should skip. `false`\n\t * when the extension is absent. A decorative shape typically has no\n\t * {@link description}; the two are alternatives, not companions.\n\t */\n\tget isDecorative(): boolean {\n\t\tconst cNvPr = nonVisualCNvPr(this.element)\n\t\tconst extLst = cNvPr && firstChild(cNvPr, 'a:extLst')\n\t\tif (!extLst) return false\n\t\tfor (const ext of getElements(extLst, 'a:ext')) {\n\t\t\tfor (const child of childElements(ext)) {\n\t\t\t\tif (child.localName === 'decorative' && child.namespaceURI === ADEC_NS) {\n\t\t\t\t\treturn boolValue(attr(child, 'val')) === true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\t/** Left edge in EMU (`a:off/@x`), or `null` when the shape has no own transform. */\n\tget left(): number | null {\n\t\treturn emuFrom(this.xfrm(), 'a:off', 'x')\n\t}\n\n\tset left(value: number) {\n\t\tthis.#setOffset('x', value, true)\n\t}\n\n\t/** Top edge in EMU (`a:off/@y`), or `null` when the shape has no own transform. */\n\tget top(): number | null {\n\t\treturn emuFrom(this.xfrm(), 'a:off', 'y')\n\t}\n\n\tset top(value: number) {\n\t\tthis.#setOffset('y', value, true)\n\t}\n\n\t/** Width in EMU (`a:ext/@cx`), or `null` when the shape has no own transform. */\n\tget width(): number | null {\n\t\treturn emuFrom(this.xfrm(), 'a:ext', 'cx')\n\t}\n\n\tset width(value: number) {\n\t\tthis.#setExtent('cx', value)\n\t}\n\n\t/** Height in EMU (`a:ext/@cy`), or `null` when the shape has no own transform. */\n\tget height(): number | null {\n\t\treturn emuFrom(this.xfrm(), 'a:ext', 'cy')\n\t}\n\n\tset height(value: number) {\n\t\tthis.#setExtent('cy', value)\n\t}\n\n\t/**\n\t * This shape's effective position and size in EMU: its own `a:xfrm` when it has\n\t * one ({@link left}/{@link top}/{@link width}/{@link height}, tagged\n\t * `source: 'own'`); otherwise, for a placeholder, the geometry it inherits from\n\t * the matching layout placeholder, else the master's (tagged accordingly). A\n\t * non-placeholder shape with no own transform has nothing to inherit from and\n\t * reads `null`, as does a placeholder whose layout/master chain defines no\n\t * matching geometry either.\n\t *\n\t * The writer always emits an explicit `a:xfrm` on every placeholder it authors,\n\t * so `source` reads `'own'` for every authored deck; `'layout'`/`'master'` is\n\t * the case an *imported* deck exercises, when PowerPoint itself leaves a\n\t * placeholder's geometry to inherit.\n\t */\n\tget resolvedFrame(): ResolvedFrame | null {\n\t\tconst left = this.left\n\t\tconst top = this.top\n\t\tconst width = this.width\n\t\tconst height = this.height\n\t\tif (left !== null && top !== null && width !== null && height !== null) {\n\t\t\treturn { left, top, width, height, source: 'own' }\n\t\t}\n\t\tconst ph = this.placeholder\n\t\tif (!ph) return null\n\t\treturn resolveInheritedFrame(ph, this.host.themeContext())\n\t}\n\n\t/**\n\t * Clockwise rotation in degrees (`a:xfrm/@rot` ÷ 60000), or `null` when the\n\t * shape has no own transform. A present xfrm with no `@rot` reads as `0`, so\n\t * — mirroring {@link left}/{@link top}/{@link width}/{@link height} — `null`\n\t * (\"inherits layout geometry\") stays distinct from `0` (\"has a transform, not\n\t * rotated\"). The value is faithful to the XML and not normalised to a signed\n\t * range, so a `@rot` past 360° (e.g. a negative angle stored as `19216344`)\n\t * reads back greater than 360. This is the shape's own orientation; use\n\t * {@link absoluteFrame} when you need the effective orientation after\n\t * enclosing group transforms are composed.\n\t */\n\tget rotation(): number | null {\n\t\tconst xfrm = this.xfrm()\n\t\tif (!xfrm) return null\n\t\treturn rotationDegrees(xfrm)\n\t}\n\n\t/**\n\t * Whether the shape is flipped horizontally (`a:xfrm/@flipH`); `false` when\n\t * unset or when the shape has no own transform. This is the shape's own\n\t * horizontal flip; use {@link absoluteFrame} for the effective value after\n\t * enclosing group transforms are composed.\n\t */\n\tget flipH(): boolean {\n\t\tconst xfrm = this.xfrm()\n\t\treturn xfrm !== null && transformFlipH(xfrm)\n\t}\n\n\t/**\n\t * Whether the shape is flipped vertically (`a:xfrm/@flipV`); `false` when\n\t * unset or when the shape has no own transform. This is the shape's own\n\t * vertical flip; use {@link absoluteFrame} for the effective value after\n\t * enclosing group transforms are composed.\n\t */\n\tget flipV(): boolean {\n\t\tconst xfrm = this.xfrm()\n\t\treturn xfrm !== null && transformFlipV(xfrm)\n\t}\n\n\t/**\n\t * This shape's position, size, and effective orientation in **slide-absolute**\n\t * EMU/degrees, composing every enclosing group transform.\n\t *\n\t * {@link left}/{@link top}/{@link width}/{@link height} report a group child's\n\t * geometry in its group's child coordinate space (`a:chOff`/`a:chExt`), which is\n\t * not directly placeable on the slide. This getter walks the `p:grpSp` ancestor\n\t * chain outward, mapping the box through each group's\n\t * `off + (p - chOff) * (ext / chExt)` transform, then composing group flips and\n\t * rotations about the group centre. For a shape already at slide level the box\n\t * equals its own `{ left, top, width, height }`, while `rotation`/`flipH`/`flipV`\n\t * equal the shape's own transform values.\n\t *\n\t * `null` when the shape (or any enclosing group) has no own transform, or a\n\t * group's `a:chExt` is degenerate (zero) — there is then no resolvable frame.\n\t *\n\t * A rotated shape's returned `left`/`top` remain PowerPoint's unrotated\n\t * placement box (the same box PowerPoint writes after Ungroup), with the\n\t * effective rotation exposed separately.\n\t */\n\tget absoluteFrame(): AbsoluteFrame | null {\n\t\tconst xfrm = this.xfrm()\n\t\tif (!xfrm) return null\n\t\tconst box = readBox(xfrm, 'a:off', 'a:ext')\n\t\tif (!box) return null\n\n\t\tconst groups: GroupTransform[] = []\n\t\tfor (let node = this.element.parentNode; node && node.nodeType === ELEMENT_NODE; node = node.parentNode) {\n\t\t\tconst parent = node as Element\n\t\t\tif (parent.namespaceURI !== OOXML_NS.p || parent.localName !== 'grpSp') break // reached the shape tree (or a non-group)\n\t\t\tconst grpSpPr = firstChild(parent, 'p:grpSpPr')\n\t\t\tconst groupXfrm = grpSpPr && firstChild(grpSpPr, 'a:xfrm')\n\t\t\tconst outer = groupXfrm && readBox(groupXfrm, 'a:off', 'a:ext')\n\t\t\tconst child = groupXfrm && readBox(groupXfrm, 'a:chOff', 'a:chExt')\n\t\t\tif (!groupXfrm || !outer || !child) return null\n\t\t\tgroups.push({\n\t\t\t\touter,\n\t\t\t\tchild,\n\t\t\t\trotation: rotationDegrees(groupXfrm),\n\t\t\t\tflipH: transformFlipH(groupXfrm),\n\t\t\t\tflipV: transformFlipV(groupXfrm),\n\t\t\t})\n\t\t}\n\n\t\tconst frame = composeGroupFrame(\n\t\t\t{ box, rotation: rotationDegrees(xfrm), flipH: transformFlipH(xfrm), flipV: transformFlipV(xfrm) },\n\t\t\tgroups\n\t\t)\n\t\tif (!frame) return null\n\t\treturn {\n\t\t\tleft: Math.round(frame.box.x),\n\t\t\ttop: Math.round(frame.box.y),\n\t\t\twidth: Math.round(frame.box.cx),\n\t\t\theight: Math.round(frame.box.cy),\n\t\t\trotation: frame.rotation,\n\t\t\tflipH: frame.flipH,\n\t\t\tflipV: frame.flipV,\n\t\t}\n\t}\n\n\t#setOffset(axis: 'x' | 'y', value: number, allowNegative: boolean): void {\n\t\tconst emu = toEmu(value, axis, allowNegative)\n\t\tconst off = getOrAddChild(this.getOrAddXfrm(), 'a:off', ['a:ext'])\n\t\tsetAttr(off, axis, String(emu))\n\t\tthis.markDirty()\n\t}\n\n\t#setExtent(axis: 'cx' | 'cy', value: number): void {\n\t\tconst emu = toEmu(value, axis, false)\n\t\tconst ext = getOrAddChild(this.getOrAddXfrm(), 'a:ext')\n\t\tsetAttr(ext, axis, String(emu))\n\t\tthis.markDirty()\n\t}\n\n\t/** The shape's properties element (`p:spPr` / `p:grpSpPr`), or `null` when absent. */\n\tprotected properties(): Element | null {\n\t\treturn firstChild(this.element, 'p:spPr')\n\t}\n\n\t/** Get-or-add the properties element in document order, with the successor\n\t * arrays for inserting its fill / line children. Subclasses override this\n\t * to point at `p:grpSpPr`, or to reject kinds with no properties element. */\n\tprotected getOrAddProperties(): ShapeProperties {\n\t\tconst props = getOrAddChild(this.element, 'p:spPr', SHAPE_AFTER_SPPR)\n\t\treturn { props, fillAfter: SPPR_FILL_AFTER, lnAfter: SPPR_LN_AFTER }\n\t}\n\n\t/** Whether a solid fill can be set on this shape kind. Pictures and graphic\n\t * frames opt out (they carry their own image / table-cell fill model). */\n\tprotected get supportsFill(): boolean {\n\t\treturn true\n\t}\n\n\t/** Explicit RGB fill colour as a 6-hex string (`spPr/a:solidFill/a:srgbClr/@val`), or `null`. */\n\tget fillColor(): string | null {\n\t\treturn solidFillColor(this.properties(), 'a:srgbClr')\n\t}\n\n\tset fillColor(value: string | null) {\n\t\tthis.#setFill(value === null ? null : { qname: 'a:srgbClr', val: normalizeHex(value) })\n\t}\n\n\t/** Theme colour token when the fill is a scheme colour (`a:solidFill/a:schemeClr/@val`, e.g. `accent2`), or `null`. */\n\tget fillSchemeColor(): string | null {\n\t\treturn solidFillColor(this.properties(), 'a:schemeClr')\n\t}\n\n\tset fillSchemeColor(value: string | null) {\n\t\tthis.#setFill(value === null ? null : { qname: 'a:schemeClr', val: value })\n\t}\n\n\t/**\n\t * `true` when the shape sets an explicit no-fill (`spPr/a:noFill`) — a\n\t * deliberately transparent surface. The fill-side counterpart of\n\t * {@link lineNoFill}, and the only accessor that separates it from a shape\n\t * carrying no fill child at all (one inheriting through `p:style/a:fillRef`):\n\t * every other fill accessor — {@link fillColor}, {@link fillSchemeColor},\n\t * {@link resolvedFill}, {@link gradientFill}, {@link patternFill},\n\t * {@link pictureFill} — reports `null` for both. The two paint completely\n\t * differently, so a consumer that cannot tell them apart paints a transparent\n\t * shape in the theme's accent colour.\n\t */\n\tget fillNoFill(): boolean {\n\t\tconst props = this.properties()\n\t\treturn !!(props && firstChild(props, 'a:noFill'))\n\t}\n\n\t/**\n\t * Set an explicit `<a:noFill/>` on the shape — a transparent surface. This is\n\t * distinct from clearing the fill (`fillColor = null`), which removes the\n\t * `a:solidFill` and lets the fill inherit from the shape's style/placeholder.\n\t * Read it back with {@link fillNoFill}.\n\t */\n\tnoFill(): void {\n\t\tif (!this.supportsFill)\n\t\t\tthrow new UnsupportedFeatureError(\n\t\t\t\t'shape/fill-unsupported',\n\t\t\t\t`${this.shapeType} shapes do not support a solid fill`\n\t\t\t)\n\t\tconst { props, fillAfter } = this.getOrAddProperties()\n\t\tremoveChildrenByQName(props, FILL_CHOICES)\n\t\tgetOrAddChild(props, 'a:noFill', fillAfter)\n\t\tthis.markDirty()\n\t}\n\n\t/** Explicit RGB line/border colour (`spPr/a:ln/a:solidFill/a:srgbClr/@val`), or `null`. */\n\tget lineColor(): string | null {\n\t\treturn solidFillColor(this.#line(), 'a:srgbClr')\n\t}\n\n\tset lineColor(value: string | null) {\n\t\tthis.#setLine(value === null ? null : { qname: 'a:srgbClr', val: normalizeHex(value) })\n\t}\n\n\t/** Theme colour token when the line is a scheme colour (`a:ln/a:solidFill/a:schemeClr/@val`), or `null`. */\n\tget lineSchemeColor(): string | null {\n\t\treturn solidFillColor(this.#line(), 'a:schemeClr')\n\t}\n\n\tset lineSchemeColor(value: string | null) {\n\t\tthis.#setLine(value === null ? null : { qname: 'a:schemeClr', val: value })\n\t}\n\n\t/** Line/border width in points (`spPr/a:ln/@w` is EMU; 12700 EMU = 1pt), or `null` when unset. */\n\tget lineWidthPt(): number | null {\n\t\tconst ln = this.#line()\n\t\tconst w = ln ? intValue(attr(ln, 'w')) : null\n\t\treturn w === null ? null : w / 12700\n\t}\n\n\t/**\n\t * The line/border dash style (`spPr/a:ln/a:prstDash/@val`), e.g. `'dash'`,\n\t * `'lgDashDot'`, `'sysDot'`, or `null` when the line is solid/unset. A faithful\n\t * replica of dashed dividers and dashed card borders needs this — it is\n\t * otherwise invisible in {@link lineColor}/{@link lineWidthPt} alone.\n\t */\n\tget lineDash(): string | null {\n\t\tconst ln = this.#line()\n\t\tconst dash = ln && firstChild(ln, 'a:prstDash')\n\t\treturn dash ? (attr(dash, 'val') ?? null) : null\n\t}\n\n\t/**\n\t * `true` when the shape sets an explicit no-line (`spPr/a:ln/a:noFill`) — a\n\t * deliberately border-less shape. Distinct from simply having no `a:ln`\n\t * (an inherited line), which {@link resolvedLine} cannot tell apart: both\n\t * report `null`. A replica that relies on a shadow instead of a border needs\n\t * to know the border was explicitly suppressed.\n\t */\n\tget lineNoFill(): boolean {\n\t\tconst ln = this.#line()\n\t\treturn !!(ln && firstChild(ln, 'a:noFill'))\n\t}\n\n\t/**\n\t * The line end cap (`spPr/a:ln/@cap`) as the raw OOXML token — `'flat'`,\n\t * `'rnd'` (round) or `'sq'` (square) — or `null` when unset (PowerPoint's\n\t * default is `flat`). The write API authors this attribute through\n\t * `ShapeLineProps.cap`, so without the accessor a deck this library produced\n\t * could not be read back without losing it.\n\t *\n\t * Not cosmetic on a thick dashed rule: the cap decides whether each dash reads\n\t * as a rectangle or a lozenge, and it extends every dash by the stroke width.\n\t * SVG's `stroke-linecap` is the exact equivalent (`flat`→`butt`, `rnd`→`round`,\n\t * `sq`→`square`).\n\t */\n\tget lineCap(): string | null {\n\t\tconst ln = this.#line()\n\t\treturn ln ? (attr(ln, 'cap') ?? null) : null\n\t}\n\n\t/**\n\t * The line alignment (`spPr/a:ln/@algn`) as the raw OOXML token — `'ctr'`\n\t * (centred on the shape's outline) or `'in'` (inset, drawn wholly inside it) —\n\t * or `null` when unset. It shifts a thick outline by half its width, so it\n\t * changes where the border sits relative to the fill.\n\t */\n\tget lineAlign(): string | null {\n\t\tconst ln = this.#line()\n\t\treturn ln ? (attr(ln, 'algn') ?? null) : null\n\t}\n\n\t/**\n\t * Preset geometry name (`spPr/a:prstGeom/@prst`, e.g. `rect`), or `null` for\n\t * custom geometry or none. Not an auto-shape-only property: PowerPoint gives a\n\t * picture and a connector a preset geometry too (a `p:pic` is `rect` unless it\n\t * has been cropped to a shape), so it reads off whichever properties element\n\t * this kind carries. A group has no geometry of its own and reads `null`.\n\t */\n\tget presetGeometry(): string | null {\n\t\tconst props = this.properties()\n\t\tconst prstGeom = props && firstChild(props, 'a:prstGeom')\n\t\treturn prstGeom ? attr(prstGeom, 'prst') : null\n\t}\n\n\t/**\n\t * Preset-geometry adjustment values (`spPr/a:prstGeom/a:avLst/a:gd`) as a\n\t * name → formula map, e.g. `{ adj: 'val 16667' }`. Empty when the shape has no\n\t * adjust handles (or uses custom geometry). Pair with {@link presetGeometry}.\n\t */\n\tget adjustValues(): Record<string, string> {\n\t\tconst props = this.properties()\n\t\tconst prstGeom = props && firstChild(props, 'a:prstGeom')\n\t\tconst avLst = prstGeom && firstChild(prstGeom, 'a:avLst')\n\t\tconst out: Record<string, string> = {}\n\t\tif (avLst) {\n\t\t\tfor (const gd of getElements(avLst, 'a:gd')) {\n\t\t\t\tconst name = attr(gd, 'name')\n\t\t\t\tif (name) out[name] = attr(gd, 'fmla') ?? ''\n\t\t\t}\n\t\t}\n\t\treturn out\n\t}\n\n\t/**\n\t * Gradient fill stops (`spPr/a:gradFill/a:gsLst/a:gs`) in document order, or\n\t * `null` when the shape's fill is not a gradient. Each stop carries its\n\t * position (0–1, from `@pos` in thousandths of a percent) and either an\n\t * explicit `color` (hex) or a `schemeColor` token, mirroring the\n\t * {@link fillColor} / {@link fillSchemeColor} split for solid fills.\n\t */\n\tget gradientStops(): GradientStop[] | null {\n\t\tconst props = this.properties()\n\t\treturn props ? this.#gradientStopsIn(props) : null\n\t}\n\n\t/**\n\t * Read `a:gradFill/a:gsLst` stops from a container (either `spPr` for a fill or\n\t * `a:ln` for a line stroke). `null` when the container has no gradient; `[]`\n\t * when the gradient carries no stop list.\n\t */\n\t#gradientStopsIn(container: Element): GradientStop[] | null {\n\t\treturn readGradientStops(container, this.host.themeContext())\n\t}\n\n\t/**\n\t * Read the full `a:gradFill` (stops + linear angle / path shape) from a\n\t * container (`spPr` for a fill or `a:ln` for a line stroke). `null` when the\n\t * container has no gradient.\n\t */\n\t#gradientFillIn(container: Element): GradientFill | null {\n\t\treturn readGradientFill(container, this.host.themeContext())\n\t}\n\n\t/**\n\t * The shape's gradient fill with its geometry (`spPr/a:gradFill`), or `null`\n\t * when the fill is not a gradient. Unlike {@link gradientStops} (stops only),\n\t * this also carries the linear {@link GradientFill.angleDeg} or the\n\t * {@link GradientFill.path} shape — the geometry a faithful replica needs and\n\t * which the bare stop list omits.\n\t */\n\tget gradientFill(): GradientFill | null {\n\t\tconst props = this.properties()\n\t\treturn props ? this.#gradientFillIn(props) : null\n\t}\n\n\t/**\n\t * The shape's line/border **gradient** stroke (`spPr/a:ln/a:gradFill`), or\n\t * `null` when the line is a solid, absent, or inherited border (see\n\t * {@link resolvedLine}). The line counterpart of {@link gradientFill}: a\n\t * gradient-stroked connector — common for faded process arrows in styled decks\n\t * — otherwise surfaces only its {@link lineWidthPt}, dropping the colour\n\t * entirely, so a replica cannot reproduce the stroke.\n\t */\n\tget lineGradient(): GradientFill | null {\n\t\tconst ln = this.#line()\n\t\treturn ln ? this.#gradientFillIn(ln) : null\n\t}\n\n\t/**\n\t * The shape's line/connector arrowheads (`a:ln/a:headEnd` + `a:tailEnd`), or\n\t * `null` when neither end carries one. Essential for replicating connectors,\n\t * whose dot/arrow ends are otherwise invisible in the geometry.\n\t */\n\tget lineEnds(): LineEnds | null {\n\t\tconst ln = this.#line()\n\t\tif (!ln) return null\n\t\tconst read = (qn: string): LineEnd | null => {\n\t\t\tconst el = firstChild(ln, qn)\n\t\t\tif (!el) return null\n\t\t\treturn { type: attr(el, 'type') ?? 'none', width: attr(el, 'w') ?? null, length: attr(el, 'len') ?? null }\n\t\t}\n\t\tconst head = read('a:headEnd')\n\t\tconst tail = read('a:tailEnd')\n\t\treturn head || tail ? { head, tail } : null\n\t}\n\n\t/**\n\t * The shape's outer drop shadow (`spPr/a:effectLst/a:outerShdw`), resolved\n\t * against the host's theme, or `null` when the shape has no outer shadow. The\n\t * soft brand shadows the eye reads as \"floating\" panels live here and are\n\t * invisible in geometry/fill alone.\n\t */\n\tget shadow(): OuterShadow | null {\n\t\tconst shdw = this.#effect('a:outerShdw')\n\t\treturn shdw ? this.#readShadow(shdw) : null\n\t}\n\n\t/**\n\t * The shape's **inner** shadow (`spPr/a:effectLst/a:innerShdw`), resolved against\n\t * the host's theme, or `null` when the shape has no inner shadow. The inset\n\t * counterpart of {@link shadow}: the write-side `shadow: { type: 'inner' }`\n\t * emits it, and it is invisible in geometry/fill alone.\n\t */\n\tget innerShadow(): InnerShadow | null {\n\t\tconst shdw = this.#effect('a:innerShdw')\n\t\treturn shdw ? this.#readShadow(shdw) : null\n\t}\n\n\t/**\n\t * The shape's glow halo (`spPr/a:effectLst/a:glow`), resolved against the host's\n\t * theme, or `null` when the shape has no glow. Same element the write-side text\n\t * glow emits, so its {@link Glow.radiusPt} and colour round-trip.\n\t */\n\tget glow(): Glow | null {\n\t\tconst glow = this.#effect('a:glow')\n\t\tif (!glow) return null\n\t\tconst out: Glow = { color: null }\n\t\tthis.#applyEffectColor(out, firstChildElement(glow))\n\t\tconst rad = intValue(attr(glow, 'rad'))\n\t\tif (rad !== null) out.radiusPt = rad / 12700\n\t\treturn out\n\t}\n\n\t/**\n\t * The shape's reflection (`spPr/a:effectLst/a:reflection`), or `null` when it has\n\t * none. Read-only: this library authors no reflection, so a replica should carry\n\t * the part rather than regenerate it — see {@link Reflection}.\n\t */\n\tget reflection(): Reflection | null {\n\t\tconst refl = this.#effect('a:reflection')\n\t\tif (!refl) return null\n\t\tconst out: Reflection = {}\n\t\tconst put = (target: keyof Reflection, name: string, div: number): void => {\n\t\t\tconst v = intValue(attr(refl, name))\n\t\t\tif (v !== null) out[target] = v / div\n\t\t}\n\t\tput('blurPt', 'blurRad', 12700)\n\t\tput('distPt', 'dist', 12700)\n\t\tput('angleDeg', 'dir', 60000)\n\t\tput('fadeAngleDeg', 'fadeDir', 60000)\n\t\tput('startAlpha', 'stA', 100000)\n\t\tput('startPos', 'stPos', 100000)\n\t\tput('endAlpha', 'endA', 100000)\n\t\tput('endPos', 'endPos', 100000)\n\t\treturn out\n\t}\n\n\t/**\n\t * The shape's soft (feathered) edge (`spPr/a:effectLst/a:softEdge`), or `null`\n\t * when it has none. Read-only like {@link reflection}: carry, don't regenerate.\n\t */\n\tget softEdge(): SoftEdge | null {\n\t\tconst soft = this.#effect('a:softEdge')\n\t\tif (!soft) return null\n\t\tconst rad = intValue(attr(soft, 'rad'))\n\t\treturn { radiusPt: rad === null ? 0 : rad / 12700 }\n\t}\n\n\t/**\n\t * The shape's pattern (hatch) fill (`spPr/a:pattFill`), or `null` when the fill\n\t * is not a pattern. Surfaces the {@link PatternFill.preset} name and both\n\t * colours resolved against the host's theme — the pattern counterpart of\n\t * {@link resolvedFill}, which reports `null` for a non-solid fill and so drops a\n\t * hatched surface entirely.\n\t */\n\tget patternFill(): PatternFill | null {\n\t\tconst props = this.properties()\n\t\treturn props ? readPatternFill(props, this.host.themeContext()) : null\n\t}\n\n\t/**\n\t * The shape's picture (image) fill (`spPr/a:blipFill`), or `null` when the fill\n\t * is not a picture. The image-fill counterpart of {@link patternFill}: a shape\n\t * whose *surface* is an image is not a {@link Picture} — it is an autoShape with\n\t * a blip fill — and {@link resolvedFill} reports `null` for one, so without this\n\t * an image-filled shape reads as unfilled. Carries the embedded image\n\t * ({@link PictureFill.relId}/{@link PictureFill.partName}) plus the stretch/tile\n\t * geometry.\n\t */\n\tget pictureFill(): PictureFill | null {\n\t\tconst props = this.properties()\n\t\treturn props ? readPictureFill(props, this.host.relationships) : null\n\t}\n\n\t/** A named child of the shape's effect list (`spPr/a:effectLst/<qname>`), or `null`. */\n\t#effect(qname: string): Element | null {\n\t\tconst props = this.properties()\n\t\tconst effectLst = props && firstChild(props, 'a:effectLst')\n\t\treturn effectLst ? firstChild(effectLst, qname) : null\n\t}\n\n\t/** Resolve `colorEl` against the theme and stamp `color`/`colorToken`/`alpha` onto an effect result. */\n\t#applyEffectColor(out: { color: string | null; colorToken?: string; alpha?: number }, colorEl: Element | null): void {\n\t\tconst resolved = resolveColorElement(colorEl, this.host.themeContext())\n\t\tif (resolved) {\n\t\t\tout.color = resolved.effectiveHex\n\t\t\tif (resolved.alpha !== undefined) out.alpha = resolved.alpha\n\t\t}\n\t\tif (colorEl && colorEl.localName === 'schemeClr') out.colorToken = attr(colorEl, 'val') ?? undefined\n\t}\n\n\t/** Decode a shadow element (`a:outerShdw`/`a:innerShdw` share the fields), resolving its colour. */\n\t#readShadow(shdw: Element): OuterShadow {\n\t\tconst out: OuterShadow = { color: null }\n\t\tthis.#applyEffectColor(out, firstChild(shdw, 'a:srgbClr') ?? firstChild(shdw, 'a:schemeClr'))\n\t\tconst blur = intValue(attr(shdw, 'blurRad'))\n\t\tconst dist = intValue(attr(shdw, 'dist'))\n\t\tconst dir = intValue(attr(shdw, 'dir'))\n\t\tif (blur !== null) out.blurPt = blur / 12700\n\t\tif (dist !== null) out.offsetPt = dist / 12700\n\t\tif (dir !== null) out.angleDeg = dir / 60000\n\t\treturn out\n\t}\n\n\t/**\n\t * The shape's solid fill resolved against the host's theme\n\t * ({@link Slide.themeContext}) to a literal hex — the resolved counterpart of\n\t * {@link fillColor}/{@link fillSchemeColor}, which report the raw reference.\n\t * `null` when the shape has no `a:solidFill` (a gradient/none/inherited fill)\n\t * or the colour cannot be made literal. The returned {@link ResolvedColor}\n\t * carries the base `hex` and raw transforms, and `effectiveHex` — the base with\n\t * its colour transforms (`lumMod`/`shade`/…) applied (read that for the final\n\t * rendered colour).\n\t *\n\t * When the shape carries no explicit `spPr` fill choice, this falls back to the\n\t * fill the shape inherits from its `p:style` `a:fillRef` (the theme style\n\t * matrix), resolved the same way the `theme: 'preserve'` flatten path bakes it.\n\t */\n\tget resolvedFill(): ResolvedColor | null {\n\t\tconst ctx = this.host.themeContext()\n\t\tconst props = this.properties()\n\t\tif (props && FILL_CHOICES.some((q) => firstChild(props, q))) return resolveSolidFillColor(props, ctx)\n\t\treturn resolveStyleFillColor(this.element, ctx)\n\t}\n\n\t/**\n\t * The shape's line/border solid fill resolved against the host's theme to a\n\t * literal hex — the resolved counterpart of {@link lineColor}/{@link lineSchemeColor}.\n\t * `null` when the shape has no `a:ln/a:solidFill` or it cannot be made literal.\n\t * Like {@link resolvedFill}, the result carries `effectiveHex` (the base colour\n\t * with its transforms applied) for the final rendered colour.\n\t *\n\t * When the shape carries no explicit `spPr/a:ln`, this falls back to the line\n\t * the shape inherits from its `p:style` `a:lnRef` (the theme style matrix).\n\t */\n\tget resolvedLine(): ResolvedColor | null {\n\t\tconst ctx = this.host.themeContext()\n\t\tconst ln = this.#line()\n\t\treturn ln ? resolveSolidFillColor(ln, ctx) : resolveStyleLineColor(this.element, ctx)\n\t}\n\n\t/** The line element (`spPr/a:ln`), or `null` when absent. */\n\t#line(): Element | null {\n\t\tconst props = this.properties()\n\t\treturn props ? firstChild(props, 'a:ln') : null\n\t}\n\n\t#setFill(color: { qname: string; val: string } | null): void {\n\t\tif (color === null) {\n\t\t\tconst props = this.properties()\n\t\t\tif (!props || !firstChild(props, 'a:solidFill')) return\n\t\t\tremoveChildrenByQName(props, ['a:solidFill'])\n\t\t\tthis.markDirty()\n\t\t\treturn\n\t\t}\n\t\tif (!this.supportsFill)\n\t\t\tthrow new UnsupportedFeatureError(\n\t\t\t\t'shape/fill-unsupported',\n\t\t\t\t`${this.shapeType} shapes do not support a solid fill`\n\t\t\t)\n\t\tconst { props, fillAfter } = this.getOrAddProperties()\n\t\tsetSolidFill(props, fillAfter, color)\n\t\tthis.markDirty()\n\t}\n\n\t#setLine(color: { qname: string; val: string } | null): void {\n\t\tif (color === null) {\n\t\t\tconst ln = this.#line()\n\t\t\tif (!ln || !firstChild(ln, 'a:solidFill')) return\n\t\t\tremoveChildrenByQName(ln, ['a:solidFill'])\n\t\t\tthis.markDirty()\n\t\t\treturn\n\t\t}\n\t\tconst { props, lnAfter } = this.getOrAddProperties()\n\t\tif (lnAfter === null)\n\t\t\tthrow new UnsupportedFeatureError(\n\t\t\t\t'shape/line-unsupported',\n\t\t\t\t`${this.shapeType} shapes do not support a line colour`\n\t\t\t)\n\t\tconst ln = getOrAddChild(props, 'a:ln', lnAfter)\n\t\tsetSolidFill(ln, LN_FILL_AFTER, color)\n\t\tthis.markDirty()\n\t}\n\n\t/** Whether this shape can hold text (only `p:sp` does in this read model). */\n\tget hasTextFrame(): boolean {\n\t\treturn false\n\t}\n\n\t/** The shape's text frame, or `null` when it cannot hold text. */\n\tget textFrame(): TextFrame | null {\n\t\treturn null\n\t}\n\n\t/** Convenience: the shape's full text, or `''` if it has none. */\n\tget text(): string {\n\t\treturn this.textFrame?.text ?? ''\n\t}\n\n\t/**\n\t * Convenience: replace the shape's text with a single run, preserving the\n\t * first existing run's formatting (see {@link TextFrame.text}). Throws when the\n\t * shape has no text frame. For multiple runs or per-run formatting, edit\n\t * `textFrame.paragraphs[].runs[]` directly.\n\t */\n\tset text(value: string) {\n\t\tconst frame = this.textFrame\n\t\tif (!frame) throw new UnsupportedFeatureError('shape/no-text-frame', 'Shape has no text frame to set text on')\n\t\tframe.text = value\n\t}\n\n\t/**\n\t * This shape's placeholder identity (`p:ph` `type`/`idx`), or `null` when it is\n\t * not a placeholder. Only `p:sp` shapes can be placeholders, so the base\n\t * implementation always returns `null`; {@link AutoShape} overrides it.\n\t */\n\tget placeholder(): PlaceholderRef | null {\n\t\treturn null\n\t}\n\n\t/**\n\t * Remove this shape from its parent (the host's shape tree, or an enclosing\n\t * group) and mark the owning host's part dirty. The proxy is dead afterwards.\n\t */\n\tdelete(): void {\n\t\tconst parent = this.element.parentNode\n\t\tif (!parent)\n\t\t\tthrow new InternalError('oxml/node-has-no-parent', 'Shape is not attached to a parent and cannot be deleted')\n\t\tparent.removeChild(this.element)\n\t\tthis.markDirty()\n\t}\n\n\t/** Escape hatch: the underlying shape element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.element\n\t}\n}\n","/**\n * An auto shape, text box, or placeholder (`p:sp`) — the only shape kind that holds text.\n */\n\nimport { attr, firstChild, getElements, type Element } from '../../oxml/dom.js'\nimport { resolveStyleFontRef, type PlaceholderRef } from '../theme-context.js'\nimport { TextFrame } from '../text.js'\nimport { Shape } from './base.js'\nimport { readGeometryPath } from './geometry.js'\nimport { getOrAddSpPrXfrm } from './oxml.js'\nimport type { CustomGeometry } from './types.js'\n\n/** An auto shape, text box, or placeholder (`p:sp`). The only kind that holds text. */\nexport class AutoShape extends Shape {\n\treadonly shapeType = 'autoShape' as const\n\n\tprotected xfrm(): Element | null {\n\t\tconst spPr = firstChild(this.element, 'p:spPr')\n\t\treturn spPr ? firstChild(spPr, 'a:xfrm') : null\n\t}\n\n\tprotected getOrAddXfrm(): Element {\n\t\treturn getOrAddSpPrXfrm(this.element)\n\t}\n\n\toverride get hasTextFrame(): boolean {\n\t\treturn firstChild(this.element, 'p:txBody') !== null\n\t}\n\n\toverride get textFrame(): TextFrame | null {\n\t\tconst txBody = firstChild(this.element, 'p:txBody')\n\t\tif (!txBody) return null\n\t\tconst flatten = this.host.themeContext()\n\t\t// Every shape resolves its `p:style/a:fontRef` and the presentation's\n\t\t// `p:defaultTextStyle`, so a context is always supplied; `ph` is null for a\n\t\t// non-placeholder shape, which then skips only the layout/master placeholder tiers.\n\t\tconst ph = this.placeholder\n\t\tconst fontRef = resolveStyleFontRef(this.element, flatten)\n\t\treturn new TextFrame(txBody, this.host.part, flatten, { ph, flatten, fontRef }, this.host.relationships)\n\t}\n\n\t/**\n\t * This shape's placeholder identity (`p:ph` `type`/`idx`), or `null` when it is\n\t * not a placeholder. `idx` defaults to `'0'` when the attribute is absent, as\n\t * PowerPoint does. Use {@link Slide.placeholder} to find a placeholder by type.\n\t */\n\toverride get placeholder(): PlaceholderRef | null {\n\t\tconst nvSpPr = firstChild(this.element, 'p:nvSpPr')\n\t\tconst nvPr = nvSpPr && firstChild(nvSpPr, 'p:nvPr')\n\t\tconst ph = nvPr && firstChild(nvPr, 'p:ph')\n\t\treturn ph ? { type: attr(ph, 'type'), idx: attr(ph, 'idx') ?? '0' } : null\n\t}\n\n\t/**\n\t * Custom freeform geometry (`spPr/a:custGeom/a:pathLst`), or `null` when the\n\t * shape uses preset geometry / none. The faithful, multi-path counterpart of\n\t * {@link presetGeometry}: each `a:path` keeps its own path-unit viewport\n\t * (`w`/`h`) and ordered {@link GeometryCommand}s. Coordinates are raw path-unit\n\t * integers, not EMU — pair the path `w`/`h` with the shape's box size to map\n\t * them into slide space.\n\t */\n\tget customGeometry(): CustomGeometry | null {\n\t\tconst props = this.properties()\n\t\tconst custGeom = props && firstChild(props, 'a:custGeom')\n\t\tif (!custGeom) return null\n\t\tconst pathLst = firstChild(custGeom, 'a:pathLst')\n\t\tconst paths = pathLst ? getElements(pathLst, 'a:path').map((p) => readGeometryPath(p)) : []\n\t\treturn { paths }\n\t}\n}\n","/**\n * A picture (`p:pic`).\n *\n * A picture's drawn data is its sibling `p:blipFill`, not a fill of `p:spPr`, which is why the\n * blip plumbing (content-type → extension, the SVG extension blip, the recolour effects) lives\n * here rather than on the base: no other shape kind carries it.\n */\n\nimport {\n\tELEMENT_NODE,\n\tattr,\n\tfirstChild,\n\tfirstChildElement,\n\tgetElements,\n\tgetOrAddChild,\n\tintValue,\n\tremoveChildrenByQName,\n\tsetAttr,\n\tOOXML_NS,\n\ttype Element,\n} from '../../oxml/dom.js'\nimport { fitSrcRectPercents, getImageSizeFromBytes } from '../../../media/image-size.js'\nimport { warn } from '../../../diagnostics.js'\nimport { relativePartName } from '../../opc/partnames.js'\nimport { Shape } from './base.js'\nimport { childElements, getOrAddSpPrXfrm } from './oxml.js'\nimport type { Recolor, RecolorColor } from './types.js'\nimport { IMAGE_REL } from '../../../ooxml/rel-types.js'\nimport { InvalidOptionError } from '../../../errors.js'\n\n// Microsoft's SVG blip extension namespace (a:blip/a:extLst/a:ext/asvg:svgBlip).\nconst ASVG_NS = 'http://schemas.microsoft.com/office/drawing/2016/SVG/main'\n\n// Schema successors within p:pic (CT_Picture: nvPicPr, blipFill, spPr, style?)\n// and within a:blipFill (blip?, srcRect?, (tile|stretch)?), used to keep a\n// get-or-added p:blipFill / a:blip in document order.\nconst PIC_AFTER_BLIPFILL = ['p:spPr', 'p:style']\nconst BLIPFILL_AFTER_BLIP = ['a:srcRect', 'a:tile', 'a:stretch']\n\n/** Known content-type → file-extension map for image media parts. */\nconst IMAGE_EXTENSION_BY_CONTENT_TYPE: Readonly<Record<string, string>> = Object.freeze({\n\t'image/png': 'png',\n\t'image/jpeg': 'jpeg',\n\t'image/gif': 'gif',\n\t'image/bmp': 'bmp',\n\t'image/tiff': 'tiff',\n\t'image/webp': 'webp',\n\t'image/svg+xml': 'svg',\n\t'image/x-emf': 'emf',\n\t'image/x-wmf': 'wmf',\n})\n\n/**\n * Default a media-part file extension from a content type. Known image types use\n * an explicit map; otherwise fall back to the content-type subtype (before any\n * `+suffix`, with a leading `x-` stripped), e.g. `image/x-foo` → `foo`.\n */\nfunction extFromContentType(contentType: string): string {\n\tconst known = IMAGE_EXTENSION_BY_CONTENT_TYPE[contentType.toLowerCase()]\n\tif (known) return known\n\tconst subtype = contentType.toLowerCase().split('/')[1] ?? ''\n\tconst ext = (subtype.split('+')[0] ?? '').replace(/^x-/, '')\n\tif (!ext)\n\t\tthrow new InvalidOptionError(\n\t\t\t'image/undeterminable-extension',\n\t\t\t`Cannot derive a file extension from content type \"${contentType}\"; pass { extension }`\n\t\t)\n\treturn ext\n}\n\n/** Convert a DrawingML colour element to a {@link RecolorColor}, or `null` when it is not an `a:` colour element. */\nfunction recolorColorOf(color: Element | null): RecolorColor | null {\n\tif (!color || color.namespaceURI !== OOXML_NS.a) return null\n\treturn {\n\t\tcolor: color.localName === 'srgbClr' ? attr(color, 'val') : null,\n\t\tschemeColor: color.localName === 'schemeClr' ? attr(color, 'val') : null,\n\t\tpresetColor: color.localName === 'prstClr' ? attr(color, 'val') : null,\n\t}\n}\n\n/** A picture (`p:pic`). */\nexport class Picture extends Shape {\n\treadonly shapeType = 'picture' as const\n\n\tprotected xfrm(): Element | null {\n\t\tconst spPr = firstChild(this.element, 'p:spPr')\n\t\treturn spPr ? firstChild(spPr, 'a:xfrm') : null\n\t}\n\n\tprotected getOrAddXfrm(): Element {\n\t\treturn getOrAddSpPrXfrm(this.element)\n\t}\n\n\t// A picture's image is its sibling `p:blipFill`, not a fill of `p:spPr`, so a\n\t// solid `spPr` fill would not clobber the image. v1 still omits fill setters\n\t// here — recolouring a picture surface is rarely what a caller means — and\n\t// exposes only the border via `lineColor`. Reads of `fillColor` stay valid.\n\tprotected override get supportsFill(): boolean {\n\t\treturn false\n\t}\n\n\t/** Relationship id of the embedded image (`p:blipFill/a:blip/@r:embed`), or `null`. */\n\tget imageRelId(): string | null {\n\t\tconst blipFill = firstChild(this.element, 'p:blipFill')\n\t\tconst blip = blipFill && firstChild(blipFill, 'a:blip')\n\t\treturn blip ? attr(blip, 'r:embed') : null\n\t}\n\n\t/**\n\t * Repoint the blip at a relationship id already present in the owning part's\n\t * relationships, without minting a new media part. The caller owns ensuring\n\t * the id exists and targets an image; use {@link setImage} to add fresh bytes.\n\t */\n\tset imageRelId(value: string) {\n\t\tsetAttr(this.#getOrAddBlip(), 'r:embed', value)\n\t\tthis.markDirty()\n\t}\n\n\t/** Absolute partname of the embedded image, resolved via the owning part's relationships, or `null`. */\n\tget imagePartName(): string | null {\n\t\tconst relId = this.imageRelId\n\t\treturn relId ? this.host.relationships.resolveTarget(relId) : null\n\t}\n\n\t/**\n\t * Relationship id of the embedded **vector (SVG)** image, read from the\n\t * Microsoft SVG blip extension (`a:blip/a:extLst/a:ext/asvg:svgBlip/@r:embed`),\n\t * or `null` when the picture has no SVG. PowerPoint usually pairs this with a\n\t * raster fallback in `a:blip/@r:embed` ({@link imageRelId}), but some exporters\n\t * emit an SVG-only blip where `imageRelId` is absent and only this resolves —\n\t * so a reader that wants the real drawn art must consult both.\n\t */\n\tget svgRelId(): string | null {\n\t\tconst svg = this.#svgBlip()\n\t\treturn svg ? attr(svg, 'r:embed') : null\n\t}\n\n\t/** Absolute partname of the embedded SVG image, resolved via the owning part's relationships, or `null`. */\n\tget svgPartName(): string | null {\n\t\tconst relId = this.svgRelId\n\t\treturn relId ? this.host.relationships.resolveTarget(relId) : null\n\t}\n\n\t/**\n\t * Which drawable media this picture carries:\n\t * - `'raster'` — only a raster blip (`a:blip/@r:embed`);\n\t * - `'svg'` — only a vector blip (`asvg:svgBlip/@r:embed`, no raster). This\n\t * is what PowerPoint's *Insert → Icons* and a plain SVG insert produce;\n\t * - `'both'` — a raster fallback *and* an SVG (PowerPoint's usual pairing);\n\t * - `'none'` — a `p:pic` with no embedded blip at all (e.g. a linked image).\n\t *\n\t * Lets a caller distinguish an SVG-only picture — where {@link imagePartName}\n\t * is legitimately `null` — from a genuinely empty one, without two null checks.\n\t */\n\tget mediaKind(): 'raster' | 'svg' | 'both' | 'none' {\n\t\tconst hasRaster = this.imageRelId != null\n\t\tconst hasSvg = this.svgRelId != null\n\t\tif (hasRaster && hasSvg) return 'both'\n\t\tif (hasRaster) return 'raster'\n\t\tif (hasSvg) return 'svg'\n\t\treturn 'none'\n\t}\n\n\t/**\n\t * Absolute partname of whichever part actually carries this picture's drawn\n\t * data — the raster part when present, otherwise the SVG part — or `null`\n\t * when the picture embeds neither. Use this when you just want \"the bytes\n\t * this picture shows\"; prefer {@link imagePartName} / {@link svgPartName}\n\t * (and {@link mediaKind}) when you need to know *which* kind it is. An\n\t * SVG-only picture returns its SVG part here even though `imagePartName` is\n\t * `null`.\n\t */\n\tget mediaPartName(): string | null {\n\t\treturn this.imagePartName ?? this.svgPartName\n\t}\n\n\t/**\n\t * The picture's crop as fractions of the *source image*, read from\n\t * `p:blipFill/a:srcRect` — `{ left, top, right, bottom }`, each the amount\n\t * trimmed off that edge (so `0.1` = 10 % cropped away, an uncropped edge is\n\t * `0`). `null` when there is no `a:srcRect` at all; an explicit\n\t * `{0,0,0,0}` crop still reports zeros, since its presence is meaningful.\n\t * The raw attributes are thousandths of a percent; this divides by 100000 to\n\t * match the fraction convention used elsewhere in the read API (see\n\t * {@link recolor}).\n\t */\n\tget crop(): { left: number; top: number; right: number; bottom: number } | null {\n\t\tconst blipFill = firstChild(this.element, 'p:blipFill')\n\t\tconst srcRect = blipFill && firstChild(blipFill, 'a:srcRect')\n\t\tif (!srcRect) return null\n\t\tconst edge = (name: string): number => {\n\t\t\tconst v = intValue(attr(srcRect, name))\n\t\t\treturn v === null ? 0 : v / 100000\n\t\t}\n\t\treturn { left: edge('l'), top: edge('t'), right: edge('r'), bottom: edge('b') }\n\t}\n\n\t/**\n\t * The picture's blip recolour effect (`p:blipFill/a:blip` recolour child), or\n\t * `null` when the blip carries none. Recognises the effects a faithful reader\n\t * needs to reproduce a recoloured image: `a:duotone` (the two-stop icon-tint\n\t * trick), `a:clrChange`, `a:grayscl`, `a:biLevel`, and `a:alphaModFix`; the\n\t * first such effect in document order wins. Colours mirror the\n\t * {@link GradientStop} split (`color`/`schemeColor`/`presetColor`) so theme\n\t * tokens resolve through {@link Slide.themeContext}. `threshold`/`amount` are\n\t * 0–1 fractions. {@link hidden} (the duotone fallback-layer trick) reports the\n\t * *visibility* of a recolour source; this reports the *tint* itself.\n\t */\n\tget recolor(): Recolor | null {\n\t\tconst blipFill = firstChild(this.element, 'p:blipFill')\n\t\tconst blip = blipFill && firstChild(blipFill, 'a:blip')\n\t\tif (!blip) return null\n\t\tfor (const child of childElements(blip)) {\n\t\t\tif (child.namespaceURI !== OOXML_NS.a) continue\n\t\t\tswitch (child.localName) {\n\t\t\t\tcase 'duotone':\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'duotone',\n\t\t\t\t\t\tstops: childElements(child)\n\t\t\t\t\t\t\t.map(recolorColorOf)\n\t\t\t\t\t\t\t.filter((c): c is RecolorColor => c !== null),\n\t\t\t\t\t}\n\t\t\t\tcase 'clrChange': {\n\t\t\t\t\tconst from = firstChild(child, 'a:clrFrom')\n\t\t\t\t\tconst to = firstChild(child, 'a:clrTo')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkind: 'clrChange',\n\t\t\t\t\t\tfrom: from ? recolorColorOf(firstChildElement(from)) : null,\n\t\t\t\t\t\tto: to ? recolorColorOf(firstChildElement(to)) : null,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase 'grayscl':\n\t\t\t\t\treturn { kind: 'grayscale' }\n\t\t\t\tcase 'biLevel': {\n\t\t\t\t\tconst thresh = intValue(attr(child, 'thresh'))\n\t\t\t\t\treturn { kind: 'biLevel', threshold: thresh === null ? null : thresh / 100000 }\n\t\t\t\t}\n\t\t\t\tcase 'alphaModFix': {\n\t\t\t\t\tconst amt = intValue(attr(child, 'amt'))\n\t\t\t\t\treturn { kind: 'alphaModFix', amount: amt === null ? 1 : amt / 100000 }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\t/** The `<asvg:svgBlip>` element inside the blip's extLst, or `null` when the picture carries no SVG. */\n\t#svgBlip(): Element | null {\n\t\tconst blipFill = firstChild(this.element, 'p:blipFill')\n\t\tconst blip = blipFill && firstChild(blipFill, 'a:blip')\n\t\tconst extLst = blip && firstChild(blip, 'a:extLst')\n\t\tif (!extLst) return null\n\t\tfor (const ext of getElements(extLst, 'a:ext')) {\n\t\t\tfor (let node = ext.firstChild; node; node = node.nextSibling) {\n\t\t\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\t\t\tconst el = node as Element\n\t\t\t\tif (el.localName === 'svgBlip' && el.namespaceURI === ASVG_NS) return el\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\t/**\n\t * Replace this picture's image with new bytes. Mints a fresh media part under\n\t * `/ppt/media/`, registers its content type, wires an `image` relationship\n\t * from the owning part, and repoints the blip's `@r:embed` at it.\n\t *\n\t * Copy-on-write: the previous media part is never mutated or removed, so any\n\t * other picture sharing it (common after `importSlide`/dedup) is unaffected;\n\t * an orphaned old part is left in place for a later GC pass to prune.\n\t *\n\t * `contentType` is required (e.g. `image/png`); the bytes are not sniffed.\n\t * `extension` defaults from the content type.\n\t *\n\t * `fit` controls the picture's `a:srcRect` crop against its current frame\n\t * extent (`a:xfrm/a:ext`):\n\t * - omitted (default): geometry and crop are left untouched — the caller owns\n\t * sizing. Note an inherited `a:srcRect` was tuned to the *previous* image's\n\t * aspect ratio, so swapping in an image of a different ratio reuses a crop\n\t * that no longer fits and the result looks stretched; pass `fit` to refit.\n\t * - `'cover'`: fill the frame, cropping the overflowing axis (no distortion).\n\t * - `'contain'`: fit the whole image inside the frame, letterboxing the short\n\t * axis (no distortion).\n\t * - `'stretch'`: drop any crop so the full image is stretched to the frame.\n\t *\n\t * `'cover'`/`'contain'` measure the new bytes' natural size; if unmeasurable\n\t * (e.g. an unknown format) the crop is left as-is and a warning is emitted.\n\t */\n\tsetImage(\n\t\tbytes: Uint8Array,\n\t\toptions: { contentType: string; extension?: string; fit?: 'cover' | 'contain' | 'stretch' }\n\t): void {\n\t\tconst { contentType } = options\n\t\tif (!contentType)\n\t\t\tthrow new InvalidOptionError('image/missing-content-type', 'setImage requires a contentType (e.g. \"image/png\")')\n\t\tconst extension = (options.extension ?? extFromContentType(contentType)).toLowerCase().replace(/^\\./, '')\n\n\t\tconst opc = this.host.opc\n\t\tconst mediaPartName = opc.reserveMediaPartName(extension)\n\t\topc.addPart(mediaPartName, contentType, bytes)\n\t\tconst relId = this.host.relationships.add(IMAGE_REL, relativePartName(this.host.partName, mediaPartName)).id\n\n\t\tsetAttr(this.#getOrAddBlip(), 'r:embed', relId)\n\t\tif (options.fit) this.#applyFit(options.fit, bytes)\n\t\tthis.markDirty()\n\t}\n\n\t/**\n\t * Refit the blip crop after a {@link setImage} swap. `stretch` removes any\n\t * `a:srcRect`; `cover`/`contain` recompute it from the new image's natural\n\t * size against the frame extent so the swap is aspect-correct.\n\t */\n\t#applyFit(fit: 'cover' | 'contain' | 'stretch', bytes: Uint8Array): void {\n\t\tconst blipFill = getOrAddChild(this.element, 'p:blipFill', PIC_AFTER_BLIPFILL)\n\t\tif (fit === 'stretch') {\n\t\t\tremoveChildrenByQName(blipFill, ['a:srcRect'])\n\t\t\treturn\n\t\t}\n\t\tconst natural = getImageSizeFromBytes(bytes)\n\t\tif (!natural) {\n\t\t\twarn(\n\t\t\t\t'image/unmeasurable-natural-size',\n\t\t\t\t`setImage fit '${fit}': could not measure the new image's natural size; leaving the crop unchanged (it may look stretched). Provide a raster (PNG/JPEG/GIF/BMP/WebP) or an SVG with width/height or a viewBox.`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tconst cx = this.width\n\t\tconst cy = this.height\n\t\tif (cx == null || cy == null) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'image/fit-needs-extent',\n\t\t\t\t`setImage fit '${fit}' needs a frame extent (a:xfrm/a:ext); this picture has no transform`\n\t\t\t)\n\t\t}\n\t\tconst { l, r, t, b } = fitSrcRectPercents(fit, { w: natural.w, h: natural.h }, { w: cx, h: cy })\n\t\tconst srcRect = getOrAddChild(blipFill, 'a:srcRect', ['a:tile', 'a:stretch'])\n\t\tsetAttr(srcRect, 'l', String(l))\n\t\tsetAttr(srcRect, 'r', String(r))\n\t\tsetAttr(srcRect, 't', String(t))\n\t\tsetAttr(srcRect, 'b', String(b))\n\t}\n\n\t/** Get-or-add `p:blipFill/a:blip`, keeping both in document order. */\n\t#getOrAddBlip(): Element {\n\t\tconst blipFill = getOrAddChild(this.element, 'p:blipFill', PIC_AFTER_BLIPFILL)\n\t\treturn getOrAddChild(blipFill, 'a:blip', BLIPFILL_AFTER_BLIP)\n\t}\n}\n","/**\n * A connector / line (`p:cxnSp`).\n */\n\nimport { attr, firstChild, intValue, type Element } from '../../oxml/dom.js'\nimport { Shape } from './base.js'\nimport { getOrAddSpPrXfrm } from './oxml.js'\nimport type { ConnectionSite } from './types.js'\n\n/** A connector / line (`p:cxnSp`). */\nexport class Connector extends Shape {\n\treadonly shapeType = 'connector' as const\n\n\tprotected xfrm(): Element | null {\n\t\tconst spPr = firstChild(this.element, 'p:spPr')\n\t\treturn spPr ? firstChild(spPr, 'a:xfrm') : null\n\t}\n\n\tprotected getOrAddXfrm(): Element {\n\t\treturn getOrAddSpPrXfrm(this.element)\n\t}\n\n\t/**\n\t * The connector's **start**-point shape binding (`p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn`),\n\t * or `null` when the start point is unbound (a bare `p:cNvCxnSpPr`, i.e. a\n\t * connector placed by static endpoint geometry). Mirrors the write API's\n\t * `startShape`/`startShapeIdx` split; see {@link endConnection} for the other end.\n\t */\n\tget startConnection(): ConnectionSite | null {\n\t\treturn this.#connection('a:stCxn')\n\t}\n\n\t/**\n\t * The connector's **end**-point shape binding (`p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn`),\n\t * or `null` when the end point is unbound. See {@link startConnection}.\n\t */\n\tget endConnection(): ConnectionSite | null {\n\t\treturn this.#connection('a:endCxn')\n\t}\n\n\t/** Decode one `a:stCxn` / `a:endCxn` binding, resolving its `@id` to a shape in the same tree. */\n\t#connection(qname: string): ConnectionSite | null {\n\t\tconst nvCxnSpPr = firstChild(this.element, 'p:nvCxnSpPr')\n\t\tconst cNvCxnSpPr = nvCxnSpPr && firstChild(nvCxnSpPr, 'p:cNvCxnSpPr')\n\t\tconst cxn = cNvCxnSpPr && firstChild(cNvCxnSpPr, qname)\n\t\tif (!cxn) return null\n\t\tconst shapeId = intValue(attr(cxn, 'id'))\n\t\tconst siteIndex = intValue(attr(cxn, 'idx'))\n\t\t// CT_Connection requires both @id and @idx; an unparseable pair degrades to null\n\t\t// rather than a half-populated site.\n\t\tif (shapeId === null || siteIndex === null) return null\n\t\treturn { shapeId, siteIndex, boundShape: this.host.shapeByIdDeep(shapeId) ?? null }\n\t}\n}\n","/**\n * Read-only proxies for a chart (`c:chart`) hosted in a `p:graphicFrame`.\n *\n * A chart lives in its own part (`/ppt/charts/chartN.xml`), referenced from the\n * graphic frame by relationship id. `Chart` reads the chart type, title, series,\n * and the **cached** category/value data (`c:numCache` / `c:strCache`) that\n * PowerPoint stores alongside the embedded workbook. Editing the underlying\n * workbook is out of scope; this surface is read-only.\n */\nimport type { Part } from '../opc/part.js'\nimport {\n\tELEMENT_NODE,\n\tOOXML_NS,\n\tattr,\n\tboolValue,\n\tfirstChild,\n\tgetElements,\n\tintValue,\n\ttype Element,\n} from '../oxml/dom.js'\n\n/** A chart axis number format (`c:numFmt`). */\nexport interface AxisNumberFormat {\n\t/** The format mask (`@formatCode`), e.g. `\"General\"`, `\"0.0%\"`. */\n\tformatCode: string | null\n\t/** Whether the mask is linked to the source cell format (`@sourceLinked`). */\n\tsourceLinked: boolean | null\n}\n\n/** A chart legend (`c:legend`). */\nexport interface ChartLegend {\n\t/** Legend position (`c:legendPos/@val`): `r`/`l`/`t`/`b`/`tr`. */\n\tposition: string | null\n\t/** Whether the legend overlays the plot area (`c:overlay/@val`). */\n\toverlay: boolean | null\n}\n\n/** A chart's data-label settings (`c:dLbls`), read from the first plot group. */\nexport interface ChartDataLabels {\n\t/** Show the point value (`c:showVal`). */\n\tshowValue: boolean | null\n\t/** Show the series name (`c:showSerName`). */\n\tshowSeriesName: boolean | null\n\t/** Show the category name (`c:showCatName`). */\n\tshowCategoryName: boolean | null\n\t/** Show the percentage (`c:showPercent`). */\n\tshowPercent: boolean | null\n\t/** Show the legend key swatch (`c:showLegendKey`). */\n\tshowLegendKey: boolean | null\n\t/** Show the bubble size (`c:showBubbleSize`). */\n\tshowBubbleSize: boolean | null\n\t/** Show leader lines (`c:showLeaderLines`). */\n\tshowLeaderLines: boolean | null\n\t/** Label position (`c:dLblPos/@val`), or `null` when auto. */\n\tposition: string | null\n\t/** Label number format (`c:numFmt`), or `null` when absent. */\n\tnumberFormat: AxisNumberFormat | null\n}\n\n/** A series' solid fill (`c:ser/c:spPr`). */\nexport interface ChartFill {\n\t/** Literal fill colour (`a:srgbClr/@val`), or `null` for a scheme/no fill. */\n\tcolor: string | null\n\t/** Raw scheme-colour token (`a:schemeClr/@val`), unresolved. */\n\tschemeColor: string | null\n\t/** Whether the fill is explicitly suppressed (`a:noFill`). */\n\tnoFill: boolean\n}\n\n/** A series' line/stroke (`c:ser/c:spPr/a:ln`). */\nexport interface ChartLine {\n\t/** Stroke width in points (`@w`/12700), or `null` when unset. */\n\twidthPt: number | null\n\t/** Dash style (`a:prstDash/@val`), or `null` when solid/unset. */\n\tdash: string | null\n\t/** Literal stroke colour (`a:srgbClr/@val`), or `null`. */\n\tcolor: string | null\n\t/** Raw scheme-colour token (`a:schemeClr/@val`), unresolved. */\n\tschemeColor: string | null\n\t/** Whether the line is explicitly suppressed (`a:noFill`). */\n\tnoFill: boolean\n}\n\n/** A chart graphic-frame's chart, backed by its chart part. */\nexport class Chart {\n\tconstructor(\n\t\t/** The chart's OPC part (`/ppt/charts/chartN.xml`). */\n\t\treadonly part: Part\n\t) {}\n\n\t/** Partname of the chart part. */\n\tget partName(): string {\n\t\treturn this.part.partName\n\t}\n\n\t/**\n\t * The chart-group type tokens present in the plot area, in document order\n\t * (e.g. `['line']`, `['bar']`, `['bar', 'line']` for a combo chart). Derived\n\t * from the plot-area element local names (`lineChart` → `line`).\n\t */\n\tget chartTypes(): string[] {\n\t\treturn this.#chartGroups().map((group) => (group.localName ?? '').replace(/Chart$/, ''))\n\t}\n\n\t/** The first chart-group type, or `null` for an empty plot area. */\n\tget chartType(): string | null {\n\t\treturn this.chartTypes[0] ?? null\n\t}\n\n\t/** The chart title (`c:chart/c:title` rich text), or `null` when absent/auto. */\n\tget title(): string | null {\n\t\tconst chart = this.#chart()\n\t\treturn readTitleText(chart && firstChild(chart, 'c:title'))\n\t}\n\n\t/**\n\t * The category/value/series axes (`c:catAx`/`c:valAx`/`c:dateAx`/`c:serAx`)\n\t * in plot-area document order. Empty for pie/doughnut charts (no axes).\n\t */\n\tget axes(): ChartAxis[] {\n\t\tconst plotArea = this.#plotArea()\n\t\tif (!plotArea) return []\n\t\tconst out: ChartAxis[] = []\n\t\tfor (let node = plotArea.firstChild; node; node = node.nextSibling) {\n\t\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\t\tconst element = node as Element\n\t\t\tif (element.namespaceURI === OOXML_NS.c && (element.localName ?? '').endsWith('Ax'))\n\t\t\t\tout.push(new ChartAxis(element, this.part))\n\t\t}\n\t\treturn out\n\t}\n\n\t/** The category axis (`c:catAx`/`c:dateAx`), or `null` when the chart has none. */\n\tget categoryAxis(): ChartAxis | null {\n\t\treturn this.axes.find((axis) => axis.kind === 'cat' || axis.kind === 'date') ?? null\n\t}\n\n\t/** The (primary) value axis (`c:valAx`), or `null` when the chart has none. */\n\tget valueAxis(): ChartAxis | null {\n\t\treturn this.axes.find((axis) => axis.kind === 'val') ?? null\n\t}\n\n\t/** The legend (`c:chart/c:legend`) position + overlay, or `null` when hidden. */\n\tget legend(): ChartLegend | null {\n\t\tconst chart = this.#chart()\n\t\tconst legend = chart && firstChild(chart, 'c:legend')\n\t\tif (!legend) return null\n\t\tconst pos = firstChild(legend, 'c:legendPos')\n\t\tconst overlay = firstChild(legend, 'c:overlay')\n\t\treturn {\n\t\t\tposition: pos ? attr(pos, 'val') : null,\n\t\t\toverlay: overlay ? boolValue(attr(overlay, 'val')) : null,\n\t\t}\n\t}\n\n\t/**\n\t * The chart-level data-label settings, read from the first plot group's\n\t * aggregate `c:dLbls` (the group-wide block after the series). `null` when the\n\t * plot group carries no data-label block (e.g. pie via a different builder).\n\t */\n\tget dataLabels(): ChartDataLabels | null {\n\t\tconst group = this.#chartGroups()[0]\n\t\tconst dLbls = group && firstChild(group, 'c:dLbls')\n\t\tif (!dLbls) return null\n\t\tconst flag = (qname: string): boolean | null => {\n\t\t\tconst el = firstChild(dLbls, qname)\n\t\t\treturn el ? boolValue(attr(el, 'val')) : null\n\t\t}\n\t\tconst pos = firstChild(dLbls, 'c:dLblPos')\n\t\treturn {\n\t\t\tshowValue: flag('c:showVal'),\n\t\t\tshowSeriesName: flag('c:showSerName'),\n\t\t\tshowCategoryName: flag('c:showCatName'),\n\t\t\tshowPercent: flag('c:showPercent'),\n\t\t\tshowLegendKey: flag('c:showLegendKey'),\n\t\t\tshowBubbleSize: flag('c:showBubbleSize'),\n\t\t\tshowLeaderLines: flag('c:showLeaderLines'),\n\t\t\tposition: pos ? attr(pos, 'val') : null,\n\t\t\tnumberFormat: readNumberFormat(dLbls),\n\t\t}\n\t}\n\n\t/** The data series (`c:ser`) across all chart groups, in document order. */\n\tget series(): ChartSeries[] {\n\t\treturn this.#chartGroups()\n\t\t\t.flatMap((group) => getElements(group, 'c:ser'))\n\t\t\t.map((ser) => new ChartSeries(ser, this.part))\n\t}\n\n\t/**\n\t * Category labels, read from the first series' cached categories\n\t * (`c:cat`), as written. Empty when the chart has no category axis.\n\t */\n\tget categories(): (string | null)[] {\n\t\tconst firstSer = this.series[0]\n\t\treturn firstSer ? firstSer.categories : []\n\t}\n\n\t/** Escape hatch: the underlying `c:chartSpace` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element | null {\n\t\treturn this.part.dom.documentElement\n\t}\n\n\t/** Mark the chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n\n\t#chart(): Element | null {\n\t\tconst root = this.part.dom.documentElement\n\t\treturn root ? firstChild(root, 'c:chart') : null\n\t}\n\n\t#plotArea(): Element | null {\n\t\tconst chart = this.#chart()\n\t\treturn chart ? firstChild(chart, 'c:plotArea') : null\n\t}\n\n\t/** Plot-area children that are chart groups (local name ends with `Chart`). */\n\t#chartGroups(): Element[] {\n\t\tconst plotArea = this.#plotArea()\n\t\tif (!plotArea) return []\n\t\tconst groups: Element[] = []\n\t\tfor (let node = plotArea.firstChild; node; node = node.nextSibling) {\n\t\t\tif (node.nodeType !== 1) continue\n\t\t\tconst element = node as Element\n\t\t\tif (element.namespaceURI === OOXML_NS.c && element.localName?.endsWith('Chart')) groups.push(element)\n\t\t}\n\t\treturn groups\n\t}\n}\n\n/**\n * One axis (`c:catAx`/`c:valAx`/`c:dateAx`/`c:serAx`) of a chart's plot area.\n * All four share the scaling/delete/position/tickmark structure; `kind`\n * distinguishes them.\n */\nexport class ChartAxis {\n\tconstructor(\n\t\tprivate readonly ax: Element,\n\t\t/** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */\n\t\tprivate readonly part: Part\n\t) {}\n\n\t/** Axis kind derived from the element name: `cat`/`val`/`date`/`ser`. */\n\tget kind(): 'cat' | 'val' | 'date' | 'ser' | null {\n\t\tswitch (this.ax.localName) {\n\t\t\tcase 'catAx':\n\t\t\t\treturn 'cat'\n\t\t\tcase 'valAx':\n\t\t\t\treturn 'val'\n\t\t\tcase 'dateAx':\n\t\t\t\treturn 'date'\n\t\t\tcase 'serAx':\n\t\t\t\treturn 'ser'\n\t\t\tdefault:\n\t\t\t\treturn null\n\t\t}\n\t}\n\n\t/** Axis id (`c:axId/@val`). */\n\tget id(): number | null {\n\t\tconst el = firstChild(this.ax, 'c:axId')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Scaling orientation (`c:scaling/c:orientation/@val`): `minMax`/`maxMin`. */\n\tget orientation(): string | null {\n\t\tconst orient = this.#scaling('c:orientation')\n\t\treturn orient ? attr(orient, 'val') : null\n\t}\n\n\t/** Scale minimum (`c:scaling/c:min/@val`), or `null` when auto. */\n\tget min(): number | null {\n\t\tconst el = this.#scaling('c:min')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Scale maximum (`c:scaling/c:max/@val`), or `null` when auto. */\n\tget max(): number | null {\n\t\tconst el = this.#scaling('c:max')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Logarithmic scale base (`c:scaling/c:logBase/@val`), or `null` when linear. */\n\tget logBase(): number | null {\n\t\tconst el = this.#scaling('c:logBase')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Whether the axis is hidden (`c:delete/@val` = 1). */\n\tget hidden(): boolean {\n\t\tconst el = firstChild(this.ax, 'c:delete')\n\t\treturn el ? boolValue(attr(el, 'val')) === true : false\n\t}\n\n\t/** Axis position (`c:axPos/@val`): `b`/`l`/`r`/`t`. */\n\tget position(): string | null {\n\t\tconst el = firstChild(this.ax, 'c:axPos')\n\t\treturn el ? attr(el, 'val') : null\n\t}\n\n\t/** Whether the axis draws major gridlines (`c:majorGridlines`). */\n\tget majorGridlines(): boolean {\n\t\treturn !!firstChild(this.ax, 'c:majorGridlines')\n\t}\n\n\t/** Whether the axis draws minor gridlines (`c:minorGridlines`). */\n\tget minorGridlines(): boolean {\n\t\treturn !!firstChild(this.ax, 'c:minorGridlines')\n\t}\n\n\t/** Axis title text (`c:title` rich text), or `null` when absent. */\n\tget title(): string | null {\n\t\treturn readTitleText(firstChild(this.ax, 'c:title'))\n\t}\n\n\t/** Axis number format (`c:numFmt`), or `null` when absent. */\n\tget numberFormat(): AxisNumberFormat | null {\n\t\treturn readNumberFormat(this.ax)\n\t}\n\n\t/** Major tick-mark style (`c:majorTickMark/@val`): `out`/`in`/`cross`/`none`. */\n\tget majorTickMark(): string | null {\n\t\tconst el = firstChild(this.ax, 'c:majorTickMark')\n\t\treturn el ? attr(el, 'val') : null\n\t}\n\n\t/** Minor tick-mark style (`c:minorTickMark/@val`). */\n\tget minorTickMark(): string | null {\n\t\tconst el = firstChild(this.ax, 'c:minorTickMark')\n\t\treturn el ? attr(el, 'val') : null\n\t}\n\n\t/** Tick-label position (`c:tickLblPos/@val`): `nextTo`/`high`/`low`/`none`. */\n\tget tickLabelPosition(): string | null {\n\t\tconst el = firstChild(this.ax, 'c:tickLblPos')\n\t\treturn el ? attr(el, 'val') : null\n\t}\n\n\t/** Major unit (`c:majorUnit/@val`), or `null` when auto. */\n\tget majorUnit(): number | null {\n\t\tconst el = firstChild(this.ax, 'c:majorUnit')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Minor unit (`c:minorUnit/@val`), or `null` when auto. */\n\tget minorUnit(): number | null {\n\t\tconst el = firstChild(this.ax, 'c:minorUnit')\n\t\treturn el ? intValue(attr(el, 'val')) : null\n\t}\n\n\t/** Escape hatch: the underlying axis element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.ax\n\t}\n\n\t/** Mark the owning chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n\n\t/** A named child of `c:scaling`. */\n\t#scaling(qname: string): Element | null {\n\t\tconst scaling = firstChild(this.ax, 'c:scaling')\n\t\treturn scaling ? firstChild(scaling, qname) : null\n\t}\n}\n\n/** One data series (`c:ser`) of a chart. */\nexport class ChartSeries {\n\tconstructor(\n\t\tprivate readonly ser: Element,\n\t\t/** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */\n\t\tprivate readonly part: Part\n\t) {}\n\n\t/**\n\t * Series fill (`c:spPr` solid fill / no-fill). `null` when the series carries\n\t * no `c:spPr` or its `c:spPr` declares no fill choice (inherits the theme).\n\t */\n\tget fill(): ChartFill | null {\n\t\tconst spPr = firstChild(this.ser, 'c:spPr')\n\t\tif (!spPr) return null\n\t\tconst solid = readSolid(spPr)\n\t\tif (solid.color === null && solid.schemeColor === null && !solid.noFill) return null\n\t\treturn solid\n\t}\n\n\t/**\n\t * Series line/stroke (`c:spPr/a:ln`) — width, dash, colour. `null` when the\n\t * series `c:spPr` has no `a:ln` (bar/area fills carry no line by default).\n\t */\n\tget line(): ChartLine | null {\n\t\tconst spPr = firstChild(this.ser, 'c:spPr')\n\t\tconst ln = spPr && firstChild(spPr, 'a:ln')\n\t\tif (!ln) return null\n\t\tconst w = intValue(attr(ln, 'w'))\n\t\tconst dash = firstChild(ln, 'a:prstDash')\n\t\tconst solid = readSolid(ln)\n\t\treturn {\n\t\t\twidthPt: w === null ? null : w / 12700,\n\t\t\tdash: dash ? (attr(dash, 'val') ?? null) : null,\n\t\t\tcolor: solid.color,\n\t\t\tschemeColor: solid.schemeColor,\n\t\t\tnoFill: solid.noFill,\n\t\t}\n\t}\n\n\t/** Series index (`c:idx/@val`), or `null` if absent. */\n\tget index(): number | null {\n\t\tconst idx = firstChild(this.ser, 'c:idx')\n\t\treturn idx ? intValue(attr(idx, 'val')) : null\n\t}\n\n\t/** Series name from the cached `c:tx`, or `null` when unnamed. */\n\tget name(): string | null {\n\t\tconst tx = firstChild(this.ser, 'c:tx')\n\t\tif (!tx) return null\n\t\tconst direct = firstChild(tx, 'c:v')\n\t\tif (direct) return direct.textContent ?? null\n\t\tconst points = readPoints(findCache(tx))\n\t\treturn points[0] ?? null\n\t}\n\n\t/** Cached numeric values (`c:val`); non-numeric or missing points are `null`. */\n\tget values(): (number | null)[] {\n\t\tconst val = firstChild(this.ser, 'c:val')\n\t\treturn readPoints(val && findCache(val)).map(intValue)\n\t}\n\n\t/** Cached category labels for this series (`c:cat`), as written. */\n\tget categories(): (string | null)[] {\n\t\tconst cat = firstChild(this.ser, 'c:cat')\n\t\treturn readPoints(cat && findCache(cat))\n\t}\n\n\t/** Escape hatch: the underlying `c:ser` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.ser\n\t}\n\n\t/** Mark the owning chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n}\n\n/** Concatenate the rich-text runs of a `c:title` element, or `null` when absent/empty. */\nfunction readTitleText(titleEl: Element | null): string | null {\n\tif (!titleEl) return null\n\tconst tx = firstChild(titleEl, 'c:tx')\n\tconst rich = tx && firstChild(tx, 'c:rich')\n\tif (!rich) return null\n\tlet out = ''\n\tfor (const t of rich.getElementsByTagNameNS(OOXML_NS.a, 't')) out += t.textContent ?? ''\n\treturn out === '' ? null : out\n}\n\n/** Read a `c:numFmt` child of `parent` into `{ formatCode, sourceLinked }`, or `null` when absent. */\nfunction readNumberFormat(parent: Element): AxisNumberFormat | null {\n\tconst nf = firstChild(parent, 'c:numFmt')\n\tif (!nf) return null\n\treturn { formatCode: attr(nf, 'formatCode'), sourceLinked: boolValue(attr(nf, 'sourceLinked')) }\n}\n\n/**\n * Decode the solid colour of a properties container (`c:spPr` or `a:ln`): the\n * literal `a:srgbClr` hex, the raw `a:schemeClr` token, and whether the fill is\n * explicitly suppressed via `a:noFill`. The chart part carries no theme context,\n * so scheme tokens are surfaced raw (unresolved) rather than flattened to hex.\n */\nfunction readSolid(container: Element): { color: string | null; schemeColor: string | null; noFill: boolean } {\n\tconst solidFill = firstChild(container, 'a:solidFill')\n\tconst srgb = solidFill && firstChild(solidFill, 'a:srgbClr')\n\tconst scheme = solidFill && firstChild(solidFill, 'a:schemeClr')\n\treturn {\n\t\tcolor: srgb ? (attr(srgb, 'val') ?? null) : null,\n\t\tschemeColor: scheme ? (attr(scheme, 'val') ?? null) : null,\n\t\tnoFill: !!firstChild(container, 'a:noFill'),\n\t}\n}\n\n/** Resolve a `c:cat`/`c:val`/`c:tx` container to its cache element (`c:numCache`/`c:strCache`/literal). */\nfunction findCache(container: Element | null): Element | null {\n\tif (!container) return null\n\tfor (const refName of ['c:numRef', 'c:strRef', 'c:multiLvlStrRef']) {\n\t\tconst ref = firstChild(container, refName)\n\t\tif (ref) {\n\t\t\tfor (const cacheName of ['c:numCache', 'c:strCache', 'c:multiLvlStrCache']) {\n\t\t\t\tconst cache = firstChild(ref, cacheName)\n\t\t\t\tif (cache) return cache\n\t\t\t}\n\t\t}\n\t}\n\t// Inline literals (no workbook reference).\n\treturn firstChild(container, 'c:numLit') ?? firstChild(container, 'c:strLit')\n}\n\n/** Read a cache's points (`c:pt[@idx]/c:v`) into an idx-ordered array sized by `c:ptCount`. */\nfunction readPoints(cache: Element | null): (string | null)[] {\n\tif (!cache) return []\n\tconst ptCount = firstChild(cache, 'c:ptCount')\n\tlet count = ptCount ? (intValue(attr(ptCount, 'val')) ?? 0) : 0\n\tconst pts = getElements(cache, 'c:pt')\n\tfor (const pt of pts) {\n\t\tconst idx = intValue(attr(pt, 'idx')) ?? 0\n\t\tif (idx + 1 > count) count = idx + 1\n\t}\n\tconst points: (string | null)[] = new Array<string | null>(count).fill(null)\n\tfor (const pt of pts) {\n\t\tconst idx = intValue(attr(pt, 'idx')) ?? 0\n\t\tpoints[idx] = firstChild(pt, 'c:v')?.textContent ?? null\n\t}\n\treturn points\n}\n","/**\n * Read-only proxies for a chartEx (`cx:chartSpace`) chart hosted in a\n * `p:graphicFrame`. chartEx is the Office-2016 chart family — waterfall, funnel,\n * treemap, sunburst, histogram, pareto, box-and-whisker, region map — a separate\n * subsystem from the classic `c:chart` (see {@link ./chart.js `Chart`}).\n *\n * A chartEx chart lives in its own part (`/ppt/charts/chartEx{N}.xml`) whose root\n * is `cx:chartSpace`, referenced from the graphic frame by relationship id (the MS\n * `chartEx` rel, not the ECMA `chart` rel). The frame itself is wrapped in an\n * `mc:AlternateContent` — the reader unwraps the `mc:Choice` to reach it.\n *\n * Unlike the classic side, the layout geometry is keyed on `cx:series/@layoutId`\n * (`waterfall`, `funnel`, `treemap`, `clusteredColumn` for histogram/pareto, …)\n * rather than the plot-group element name, and category/value data lives in a\n * top-level `cx:chartData/cx:data` block the series point at by `cx:dataId`. This\n * surface reads the layout, title, legend, series, and the cached data; the\n * embedded workbook, the style/colors sidecars, and (for a region map) the online\n * geo-cache are out of scope.\n */\nimport type { Part } from '../opc/part.js'\nimport { OOXML_NS, attr, firstChild, getElements, intValue, type Element } from '../oxml/dom.js'\n\n/** A chartEx legend (`cx:legend`) — a leaf element carrying position/alignment attributes. */\nexport interface ChartExLegend {\n\t/** Legend position (`@pos`): `t`/`b`/`l`/`r`. */\n\tposition: string | null\n\t/** Legend alignment along its edge (`@align`), e.g. `ctr`. */\n\talign: string | null\n\t/** Whether the legend overlays the plot area (`@overlay`). */\n\toverlay: boolean | null\n}\n\n/** A chartEx series' data-label toggles (`cx:dataLabels` + its `cx:visibility` child). */\nexport interface ChartExDataLabels {\n\t/** Label position (`@pos`), e.g. `outEnd`, or `null` when unset. */\n\tposition: string | null\n\t/** Show the point value (`cx:visibility/@value`). */\n\tvalue: boolean | null\n\t/** Show the series name (`cx:visibility/@seriesName`). */\n\tseriesName: boolean | null\n\t/** Show the category name (`cx:visibility/@categoryName`). */\n\tcategoryName: boolean | null\n}\n\n/** A chartEx graphic-frame's chart, backed by its `cx:chartSpace` part. */\nexport class ChartEx {\n\tconstructor(\n\t\t/** The chartEx chart's OPC part (`/ppt/charts/chartEx{N}.xml`). */\n\t\treadonly part: Part\n\t) {}\n\n\t/** Partname of the chartEx chart part. */\n\tget partName(): string {\n\t\treturn this.part.partName\n\t}\n\n\t/**\n\t * The `cx:series/@layoutId` tokens in plot-area document order — the raw chartEx\n\t * layout names (`waterfall`, `funnel`, `treemap`, `sunburst`, `boxWhisker`,\n\t * `regionMap`, or `clusteredColumn`/`paretoLine` for histogram & pareto). This is\n\t * the OOXML truth: a histogram and a pareto both surface as `clusteredColumn`, so\n\t * the token does not always round-trip to the write-side `ChartType`.\n\t */\n\tget layoutIds(): string[] {\n\t\treturn this.#seriesElements()\n\t\t\t.map((ser) => attr(ser, 'layoutId'))\n\t\t\t.filter((id): id is string => id !== null && id !== '')\n\t}\n\n\t/** The first series' `@layoutId`, or `null` for an empty plot area. */\n\tget layoutId(): string | null {\n\t\treturn this.layoutIds[0] ?? null\n\t}\n\n\t/** The chart title (`cx:chart/cx:title` rich text), or `null` when absent. */\n\tget title(): string | null {\n\t\tconst chart = this.#chart()\n\t\tconst title = chart && firstChild(chart, 'cx:title')\n\t\tif (!title) return null\n\t\tconst tx = firstChild(title, 'cx:tx')\n\t\tconst rich = tx && firstChild(tx, 'cx:rich')\n\t\tif (!rich) return null\n\t\tlet out = ''\n\t\tfor (const t of rich.getElementsByTagNameNS(OOXML_NS.a, 't')) out += t.textContent ?? ''\n\t\treturn out === '' ? null : out\n\t}\n\n\t/** The legend (`cx:chart/cx:legend`) position/alignment, or `null` when hidden. */\n\tget legend(): ChartExLegend | null {\n\t\tconst chart = this.#chart()\n\t\tconst legend = chart && firstChild(chart, 'cx:legend')\n\t\tif (!legend) return null\n\t\treturn {\n\t\t\tposition: attr(legend, 'pos'),\n\t\t\talign: attr(legend, 'align'),\n\t\t\toverlay: boolAttr(legend, 'overlay'),\n\t\t}\n\t}\n\n\t/** The data series (`cx:plotAreaRegion/cx:series`) in document order. */\n\tget series(): ChartExSeries[] {\n\t\treturn this.#seriesElements().map((ser) => new ChartExSeries(ser, this))\n\t}\n\n\t/** The plot-area axes (`cx:plotArea/cx:axis`) in document order. */\n\tget axes(): ChartExAxis[] {\n\t\tconst plotArea = this.#plotArea()\n\t\treturn plotArea ? getElements(plotArea, 'cx:axis').map((ax) => new ChartExAxis(ax, this)) : []\n\t}\n\n\t/**\n\t * Category labels from the first series' cached leaf level (`cx:strDim`'s first\n\t * `cx:lvl`). Empty for a category-less layout (a histogram bins raw observations).\n\t */\n\tget categories(): (string | null)[] {\n\t\treturn this.series[0]?.categories ?? []\n\t}\n\n\t/** Escape hatch: the underlying `cx:chartSpace` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element | null {\n\t\treturn this.part.dom.documentElement\n\t}\n\n\t/** Mark the chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * The `cx:data` block a series' `cx:dataId` points at (`cx:chartData/cx:data[@id]`),\n\t * or `null` when the id is unset or unmatched.\n\t */\n\tdataElementById(id: number | null): Element | null {\n\t\tif (id === null) return null\n\t\tconst chartData = this.#chartData()\n\t\tif (!chartData) return null\n\t\treturn getElements(chartData, 'cx:data').find((data) => intValue(attr(data, 'id')) === id) ?? null\n\t}\n\n\t#root(): Element | null {\n\t\treturn this.part.dom.documentElement\n\t}\n\n\t#chartData(): Element | null {\n\t\tconst root = this.#root()\n\t\treturn root ? firstChild(root, 'cx:chartData') : null\n\t}\n\n\t#chart(): Element | null {\n\t\tconst root = this.#root()\n\t\treturn root ? firstChild(root, 'cx:chart') : null\n\t}\n\n\t#plotArea(): Element | null {\n\t\tconst chart = this.#chart()\n\t\treturn chart ? firstChild(chart, 'cx:plotArea') : null\n\t}\n\n\t#seriesElements(): Element[] {\n\t\tconst plotArea = this.#plotArea()\n\t\tconst region = plotArea && firstChild(plotArea, 'cx:plotAreaRegion')\n\t\treturn region ? getElements(region, 'cx:series') : []\n\t}\n}\n\n/** One data series (`cx:series`) of a chartEx chart. */\nexport class ChartExSeries {\n\tconstructor(\n\t\tprivate readonly ser: Element,\n\t\tprivate readonly chart: ChartEx\n\t) {}\n\n\t/** The layout token (`@layoutId`) that keys this series' geometry, e.g. `waterfall`. */\n\tget layoutId(): string | null {\n\t\treturn attr(this.ser, 'layoutId')\n\t}\n\n\t/** The deterministic series GUID (`@uniqueId`), or `null`. */\n\tget uniqueId(): string | null {\n\t\treturn attr(this.ser, 'uniqueId')\n\t}\n\n\t/**\n\t * The owner series index (`@ownerIdx`) for a derived series (a `paretoLine`\n\t * derives its data from series 0), or `null` for a self-contained series.\n\t */\n\tget ownerIndex(): number | null {\n\t\treturn intValue(attr(this.ser, 'ownerIdx'))\n\t}\n\n\t/** Series name from the cached `cx:tx/cx:txData/cx:v`, or `null` when unnamed. */\n\tget name(): string | null {\n\t\tconst tx = firstChild(this.ser, 'cx:tx')\n\t\tconst txData = tx && firstChild(tx, 'cx:txData')\n\t\tconst v = txData && firstChild(txData, 'cx:v')\n\t\treturn v ? (v.textContent ?? null) : null\n\t}\n\n\t/** The data-block id this series plots (`cx:dataId/@val`), or `null`. */\n\tget dataId(): number | null {\n\t\tconst dataId = firstChild(this.ser, 'cx:dataId')\n\t\treturn dataId ? intValue(attr(dataId, 'val')) : null\n\t}\n\n\t/** Cached numeric values (`cx:numDim`); non-numeric or missing points are `null`. */\n\tget values(): (number | null)[] {\n\t\tconst data = this.chart.dataElementById(this.dataId)\n\t\tconst numDim = data && firstChild(data, 'cx:numDim')\n\t\treturn readLevelPoints(numDim && firstChild(numDim, 'cx:lvl')).map(intValue)\n\t}\n\n\t/**\n\t * Cached category labels (`cx:strDim`'s leaf `cx:lvl` — the first level, which\n\t * the writer emits leaf-first). Empty when the data block carries no `cx:strDim`.\n\t */\n\tget categories(): (string | null)[] {\n\t\tconst data = this.chart.dataElementById(this.dataId)\n\t\tconst strDim = data && firstChild(data, 'cx:strDim')\n\t\treturn readLevelPoints(strDim && firstChild(strDim, 'cx:lvl'))\n\t}\n\n\t/** The data-label toggles (`cx:dataLabels`), or `null` when the series shows none. */\n\tget dataLabels(): ChartExDataLabels | null {\n\t\tconst dLbls = firstChild(this.ser, 'cx:dataLabels')\n\t\tif (!dLbls) return null\n\t\tconst vis = firstChild(dLbls, 'cx:visibility')\n\t\treturn {\n\t\t\tposition: attr(dLbls, 'pos'),\n\t\t\tvalue: vis ? boolAttr(vis, 'value') : null,\n\t\t\tseriesName: vis ? boolAttr(vis, 'seriesName') : null,\n\t\t\tcategoryName: vis ? boolAttr(vis, 'categoryName') : null,\n\t\t}\n\t}\n\n\t/** Escape hatch: the underlying `cx:series` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.ser\n\t}\n\n\t/** Mark the owning chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.chart.part.markDirty()\n\t}\n}\n\n/**\n * One axis (`cx:axis`) of a chartEx plot area. chartEx axes carry no `catAx`/`valAx`\n * element-name distinction; the kind is read from the scaling child\n * (`cx:catScaling` vs `cx:valScaling`).\n */\nexport class ChartExAxis {\n\tconstructor(\n\t\tprivate readonly ax: Element,\n\t\t/** The owning chartEx chart, so {@link markDirty} can reach its part from {@link element_}. */\n\t\tprivate readonly chart: ChartEx\n\t) {}\n\n\t/** Axis id (`@id`), the value a series' `cx:axisId` binds to. */\n\tget id(): number | null {\n\t\treturn intValue(attr(this.ax, 'id'))\n\t}\n\n\t/** Axis kind from its scaling child: `cat` (`cx:catScaling`) / `val` (`cx:valScaling`). */\n\tget kind(): 'cat' | 'val' | null {\n\t\tif (firstChild(this.ax, 'cx:catScaling')) return 'cat'\n\t\tif (firstChild(this.ax, 'cx:valScaling')) return 'val'\n\t\treturn null\n\t}\n\n\t/**\n\t * Category-axis gap width (`cx:catScaling/@gapWidth`) as a fraction (1.0 = 100%,\n\t * the chartEx convention, unlike the classic integer percent), or `null`.\n\t */\n\tget gapWidth(): number | null {\n\t\tconst cat = firstChild(this.ax, 'cx:catScaling')\n\t\treturn cat ? floatValue(attr(cat, 'gapWidth')) : null\n\t}\n\n\t/** Value-axis scale minimum (`cx:valScaling/@min`), or `null` when auto. */\n\tget min(): number | null {\n\t\tconst val = firstChild(this.ax, 'cx:valScaling')\n\t\treturn val ? floatValue(attr(val, 'min')) : null\n\t}\n\n\t/** Value-axis scale maximum (`cx:valScaling/@max`), or `null` when auto. */\n\tget max(): number | null {\n\t\tconst val = firstChild(this.ax, 'cx:valScaling')\n\t\treturn val ? floatValue(attr(val, 'max')) : null\n\t}\n\n\t/** Whether the axis draws major gridlines (`cx:majorGridlines`). */\n\tget majorGridlines(): boolean {\n\t\treturn !!firstChild(this.ax, 'cx:majorGridlines')\n\t}\n\n\t/** Whether the axis draws tick labels (`cx:tickLabels`). */\n\tget tickLabels(): boolean {\n\t\treturn !!firstChild(this.ax, 'cx:tickLabels')\n\t}\n\n\t/** Escape hatch: the underlying `cx:axis` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.ax\n\t}\n\n\t/** Mark the owning chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.chart.part.markDirty()\n\t}\n}\n\n/** Read a `cx:lvl`'s points (`cx:pt[@idx]` text) into an idx-ordered array sized by `@ptCount`. */\nfunction readLevelPoints(lvl: Element | null): (string | null)[] {\n\tif (!lvl) return []\n\tconst ptCount = intValue(attr(lvl, 'ptCount'))\n\tconst pts = getElements(lvl, 'cx:pt')\n\tlet count = ptCount ?? 0\n\tfor (const pt of pts) {\n\t\tconst idx = intValue(attr(pt, 'idx')) ?? 0\n\t\tif (idx + 1 > count) count = idx + 1\n\t}\n\tconst points: (string | null)[] = new Array<string | null>(count).fill(null)\n\tfor (const pt of pts) {\n\t\tconst idx = intValue(attr(pt, 'idx')) ?? 0\n\t\tpoints[idx] = pt.textContent ?? null\n\t}\n\treturn points\n}\n\n/** Parse an attribute as a boolean (`1`/`true` → true, `0`/`false` → false), or `null` when absent. */\nfunction boolAttr(element: Element, name: string): boolean | null {\n\tconst value = attr(element, name)\n\tif (value === null) return null\n\treturn value === '1' || value === 'true'\n}\n\n/** Parse an attribute as a float (chartEx uses fractional `gapWidth`/scale values), or `null`. */\nfunction floatValue(value: string | null): number | null {\n\tif (value === null || value === '') return null\n\tconst number = Number(value)\n\treturn Number.isFinite(number) ? number : null\n}\n","/**\n * Ordered mutation of a table cell's `a:tcPr`, and the cell-scoped schema facts every such\n * edit needs.\n *\n * `CT_TableCellProperties` declares its children as a **sequence**, so an append-only\n * implementation produces an out-of-order `a:tcPr` — which PowerPoint reports as a corrupt\n * file rather than as a bad edit. Every insertion therefore goes through\n * {@link getOrAddChild} / {@link insertInOrder} with the new element's *successors*, which is\n * what `TCPR_AFTER` tabulates; it and the sequence it derives from live in\n * `src/ooxml/sequence.ts` alongside the other complexType orderings.\n *\n * The attribute values are the other half. A value outside its `ST_` union is equally fatal\n * and equally silent, so each is checked against the enum before it is written — the same\n * validate-at-the-boundary rule the write path follows, with the difference that here there\n * is a caller to throw at rather than a deck to degrade (see `ooxml/check-enum.ts`).\n */\nimport { InvalidOptionError } from '../../errors.js'\nimport type { InvalidOptionErrorCode } from '../../codes.js'\nimport { getOrAddChild, insertInOrder, type Element } from '../oxml/dom.js'\nimport { TCPR_AFTER } from '../../ooxml/sequence.js'\nimport { TEXT_ANCHORS, TEXT_HORZ_OVERFLOW, TEXT_VERTICAL } from '../../ooxml/st-enums.js'\n\nexport { TCPR_AFTER, TCPR_SEQUENCE } from '../../ooxml/sequence.js'\nexport { checkEnumOrThrow as checkEnum } from '../../ooxml/check-enum.js'\n\n/** `ST_TextAnchoringType` — `a:tcPr/@anchor`. */\nexport const ANCHOR_VALUES = TEXT_ANCHORS\n/** `ST_TextVerticalType` — `a:tcPr/@vert`. */\nexport const VERT_VALUES = TEXT_VERTICAL\n/** `ST_TextHorzOverflowType` — `a:tcPr/@horzOverflow`. */\nexport const HORZ_OVERFLOW_VALUES = TEXT_HORZ_OVERFLOW\n\n/** The four edges plus the two diagonals, keyed as {@link TableCellEdge} names them. */\nexport const EDGE_QNAMES = {\n\tleft: 'a:lnL',\n\tright: 'a:lnR',\n\ttop: 'a:lnT',\n\tbottom: 'a:lnB',\n\ttlToBr: 'a:lnTlToBr',\n\tblToTr: 'a:lnBlToTr',\n} as const\n\n/** Which border of a cell an edit addresses. */\nexport type TableCellEdge = keyof typeof EDGE_QNAMES\n\n/**\n * Get or create a child of `a:tcPr` at its schema position.\n * @param {Element} tcPr - the cell's properties element\n * @param {string} qname - the child to get or create\n * @returns {Element} the existing or newly-inserted child\n */\nexport function tcPrChild(tcPr: Element, qname: string): Element {\n\treturn getOrAddChild(tcPr, qname, TCPR_AFTER[qname] ?? [])\n}\n\n/**\n * Insert an already-built subtree into `a:tcPr` at its schema position.\n * @param {Element} tcPr - the cell's properties element\n * @param {string} qname - the qname of the node being inserted (decides where it goes)\n * @param {Element} node - the subtree to insert\n */\nexport function insertTcPrChild(tcPr: Element, qname: string, node: Element): void {\n\tinsertInOrder(tcPr, node, TCPR_AFTER[qname] ?? [])\n}\n\n/**\n * Round a measurement to whole EMU, rejecting a value that cannot be written.\n * `NaN`/`Infinity` would reach the attribute verbatim and make the part invalid, which is\n * exactly the \"silent coercion of invalid input\" the project's policy rules out.\n */\nexport function checkFiniteEmu(value: number, field: string, code: InvalidOptionErrorCode): number {\n\tif (!Number.isFinite(value))\n\t\tthrow new InvalidOptionError(code, `${field} must be a finite number of EMU, got: ${String(value)}`)\n\treturn Math.round(value)\n}\n","/**\n * Structural edits to an existing `a:tbl`: adding and removing rows and columns, and\n * merging and unmerging cells.\n *\n * The one fact that makes this tractable is that a stored table's grid is already\n * **rectangular**. Unlike the write path — which receives lopsided row arrays and has to\n * build the merge grid itself (`gen/slide/objects/table.ts` STEP 3) — every `a:tr` in a\n * conformant `a:tbl` holds exactly one `a:tc` per grid column, with the covered half of each\n * span present and flagged. So \"the cell at (r, c)\" is simply the c-th `a:tc` of the r-th\n * `a:tr`, and an edit's whole job is keeping that rectangle true.\n *\n * Three things have to stay in step, and every function here is written around them:\n *\n * 1. `a:tblGrid/a:gridCol` count == each row's `a:tc` count.\n * 2. A cell with `@gridSpan=\"n\"` is followed by exactly `n-1` cells carrying `@hMerge=\"1\"`,\n * and a cell with `@rowSpan=\"n\"` is under-hung by `n-1` cells carrying `@vMerge=\"1\"`, in\n * the same columns.\n * 3. A covered cell carries no span attributes of its own — its extent is the origin's.\n *\n * Breaking any of them produces a table PowerPoint reports as a corrupt file rather than as\n * a bad edit, which is why the span bookkeeping here is explicit rather than incidental.\n */\nimport { InvalidOptionError } from '../../errors.js'\nimport {\n\tattr,\n\tcreateElement,\n\tfirstChild,\n\tgetElements,\n\tintValue,\n\townerDocumentOf,\n\tremoveAttr,\n\tsetAttr,\n\ttype Document,\n\ttype Element,\n} from '../oxml/dom.js'\n\n/** Every `a:tr` of a table, in document order. */\nexport function rowsOf(tbl: Element): Element[] {\n\treturn getElements(tbl, 'a:tr')\n}\n\n/** Every `a:tc` of a row, in document (left-to-right) order. */\nfunction cellsOf(tr: Element): Element[] {\n\treturn getElements(tr, 'a:tc')\n}\n\n/** The table's `a:tblGrid`, or a thrown error — `CT_Table` requires one. */\nfunction gridOf(tbl: Element): Element {\n\tconst grid = firstChild(tbl, 'a:tblGrid')\n\tif (!grid)\n\t\tthrow new InvalidOptionError(\n\t\t\t'table/column-index-out-of-range',\n\t\t\t'This table has no a:tblGrid, so its columns cannot be edited'\n\t\t)\n\treturn grid\n}\n\n/** A cell's `@gridSpan`, defaulting to 1. */\nfunction gridSpanOf(tc: Element): number {\n\treturn intValue(attr(tc, 'gridSpan')) ?? 1\n}\n\n/** A cell's `@rowSpan`, defaulting to 1. */\nfunction rowSpanOf(tc: Element): number {\n\treturn intValue(attr(tc, 'rowSpan')) ?? 1\n}\n\n/** Whether a cell is the covered half of a horizontal merge. */\nfunction isHMerge(tc: Element): boolean {\n\treturn attr(tc, 'hMerge') === '1' || attr(tc, 'hMerge') === 'true'\n}\n\n/** Whether a cell is the covered half of a vertical merge. */\nfunction isVMerge(tc: Element): boolean {\n\treturn attr(tc, 'vMerge') === '1' || attr(tc, 'vMerge') === 'true'\n}\n\n/**\n * Set a span attribute, removing it when the span collapses to 1 — the schema default, and\n * what PowerPoint itself writes for an unmerged cell.\n */\nfunction setSpan(tc: Element, name: 'gridSpan' | 'rowSpan', value: number): void {\n\tif (value <= 1) removeAttr(tc, name)\n\telse setAttr(tc, name, String(value))\n}\n\n/**\n * Walk left from `col` to the origin of the horizontal run containing it.\n * A run is an origin followed by its `hMerge` continuations, so the origin is the first\n * cell at or left of `col` that is not one.\n * @returns the origin's column index, or `col` itself when the cell stands alone\n */\nfunction hRunOrigin(cells: Element[], col: number): number {\n\tlet idx = col\n\twhile (idx > 0) {\n\t\tconst cell = cells[idx]\n\t\tif (!cell || !isHMerge(cell)) break\n\t\tidx -= 1\n\t}\n\treturn idx\n}\n\n/**\n * Walk up from `row` to the origin of the vertical run containing `(row, col)`.\n * @returns the origin's row index, or `row` itself when the cell stands alone\n */\nfunction vRunOrigin(rows: Element[][], row: number, col: number): number {\n\tlet idx = row\n\twhile (idx > 0) {\n\t\tconst cell = rows[idx]?.[col]\n\t\tif (!cell || !isVMerge(cell)) break\n\t\tidx -= 1\n\t}\n\treturn idx\n}\n\n/** A fresh, empty `a:tc`, shaped the way PowerPoint writes one. */\nfunction makeCell(doc: Document): Element {\n\tconst tc = createElement(doc, 'a:tc')\n\tconst txBody = createElement(doc, 'a:txBody')\n\ttxBody.appendChild(createElement(doc, 'a:bodyPr'))\n\ttxBody.appendChild(createElement(doc, 'a:lstStyle'))\n\ttxBody.appendChild(createElement(doc, 'a:p'))\n\ttc.appendChild(txBody)\n\ttc.appendChild(createElement(doc, 'a:tcPr'))\n\treturn tc\n}\n\n/** The grid as a row-major array of `a:tc` elements. */\nfunction gridOfCells(tbl: Element): Element[][] {\n\treturn rowsOf(tbl).map((tr) => cellsOf(tr))\n}\n\n/** Guard an index against `[0, limit]` (inclusive upper bound, for insertion points). */\nfunction checkIndex(index: number, limit: number, what: 'row' | 'column', inclusive: boolean): number {\n\tconst max = inclusive ? limit : limit - 1\n\tif (!Number.isInteger(index) || index < 0 || index > max) {\n\t\tthrow new InvalidOptionError(\n\t\t\twhat === 'row' ? 'table/row-index-out-of-range' : 'table/column-index-out-of-range',\n\t\t\t`${what} index ${String(index)} is out of range (expected 0..${max})`\n\t\t)\n\t}\n\treturn index\n}\n\n/**\n * Insert a row at `index` (default: append).\n *\n * The subtle case is inserting **through** a vertical merge. If the row currently at `index`\n * holds a `vMerge` continuation in some column, the span it belongs to straddles the\n * insertion point — so the new row must continue that span rather than interrupt it: the\n * origin's `@rowSpan` grows by one and the new cell is another continuation. Interrupting it\n * instead would leave an origin claiming more rows than it has continuations, which is the\n * corrupt-file case.\n */\nexport function insertRow(tbl: Element, index?: number): Element {\n\tconst rows = rowsOf(tbl)\n\tconst at = index === undefined ? rows.length : checkIndex(index, rows.length, 'row', true)\n\tconst grid = gridOfCells(tbl)\n\tconst colCount = getElements(gridOf(tbl), 'a:gridCol').length\n\tconst doc = ownerDocumentOf(tbl)\n\n\tconst tr = createElement(doc, 'a:tr')\n\t// `@h` is required on CT_TableRow. Zero means \"auto — as tall as the content needs\",\n\t// which is the right default for a row nobody has sized.\n\tsetAttr(tr, 'h', '0')\n\n\tfor (let col = 0; col < colCount; col++) {\n\t\tconst tc = makeCell(doc)\n\t\t// A span crosses this insertion point only when the row being pushed down is itself a\n\t\t// continuation; if `at` is past the end, or the cell there starts its own span, nothing\n\t\t// is being split.\n\t\tconst displaced = grid[at]?.[col]\n\t\tif (displaced && isVMerge(displaced)) {\n\t\t\tconst originRow = vRunOrigin(grid, at, col)\n\t\t\tconst origin = grid[originRow]?.[col]\n\t\t\tif (origin) setSpan(origin, 'rowSpan', rowSpanOf(origin) + 1)\n\t\t\tsetAttr(tc, 'vMerge', '1')\n\t\t\t// The continuation must match the origin's horizontal extent too, or the row's cells\n\t\t\t// stop lining up with the grid columns.\n\t\t\tif (isHMerge(displaced)) setAttr(tc, 'hMerge', '1')\n\t\t\tconst span = gridSpanOf(displaced)\n\t\t\tif (span > 1) setSpan(tc, 'gridSpan', span)\n\t\t}\n\t\ttr.appendChild(tc)\n\t}\n\n\t// `CT_Table` sequences tblPr, tblGrid, then the rows, so an insert is always relative to\n\t// an existing `a:tr` (or appended, which lands after tblGrid either way).\n\tconst before = rows[at] ?? null\n\ttbl.insertBefore(tr, before)\n\treturn tr\n}\n\n/**\n * Remove the row at `index`.\n *\n * Two span cases, and they pull in opposite directions. A cell in this row that *continues*\n * a span from above shortens that span by one. A cell in this row that *starts* one cannot\n * simply take its span away — the rows below still hold its continuations — so the first\n * continuation is promoted to origin and inherits the remaining extent. Its content is gone\n * with the row, which is inherent to removing a row rather than a choice made here.\n */\nexport function removeRow(tbl: Element, index: number): void {\n\tconst rows = rowsOf(tbl)\n\tconst at = checkIndex(index, rows.length, 'row', false)\n\tconst grid = gridOfCells(tbl)\n\tconst row = grid[at] ?? []\n\n\tfor (let col = 0; col < row.length; col++) {\n\t\tconst tc = row[col]\n\t\tif (!tc) continue\n\t\tif (isVMerge(tc)) {\n\t\t\tconst origin = grid[vRunOrigin(grid, at, col)]?.[col]\n\t\t\tif (origin) setSpan(origin, 'rowSpan', rowSpanOf(origin) - 1)\n\t\t\tcontinue\n\t\t}\n\t\tconst span = rowSpanOf(tc)\n\t\tif (span > 1) {\n\t\t\tconst heir = grid[at + 1]?.[col]\n\t\t\tif (heir) {\n\t\t\t\tremoveAttr(heir, 'vMerge')\n\t\t\t\tsetSpan(heir, 'rowSpan', span - 1)\n\t\t\t\t// The promoted cell keeps whatever horizontal extent the origin had, so the row it\n\t\t\t\t// now leads still matches the grid.\n\t\t\t\tsetSpan(heir, 'gridSpan', gridSpanOf(tc))\n\t\t\t}\n\t\t}\n\t}\n\n\tconst tr = rows[at]\n\tif (tr) tbl.removeChild(tr)\n}\n\n/**\n * Insert a column at `index` (default: append), `widthEmu` wide.\n *\n * Mirrors {@link insertRow}'s split case on the other axis: when the cell currently at\n * `index` is an `hMerge` continuation, the insertion point falls inside a horizontal span,\n * so the span widens by one and the new cell joins it as another continuation.\n */\nexport function insertColumn(tbl: Element, index?: number, widthEmu = 914400): Element {\n\tconst grid = gridOf(tbl)\n\tconst cols = getElements(grid, 'a:gridCol')\n\tconst at = index === undefined ? cols.length : checkIndex(index, cols.length, 'column', true)\n\tconst doc = ownerDocumentOf(tbl)\n\n\tconst gridCol = createElement(doc, 'a:gridCol')\n\tsetAttr(gridCol, 'w', String(Math.round(widthEmu)))\n\tgrid.insertBefore(gridCol, cols[at] ?? null)\n\n\tfor (const tr of rowsOf(tbl)) {\n\t\tconst cells = cellsOf(tr)\n\t\tconst tc = makeCell(doc)\n\t\tconst displaced = cells[at]\n\t\tif (displaced && isHMerge(displaced)) {\n\t\t\tconst origin = cells[hRunOrigin(cells, at)]\n\t\t\tif (origin) setSpan(origin, 'gridSpan', gridSpanOf(origin) + 1)\n\t\t\tsetAttr(tc, 'hMerge', '1')\n\t\t\t// Same reasoning as the row case: match the vertical extent so the column still\n\t\t\t// lines up down the table.\n\t\t\tif (isVMerge(displaced)) setAttr(tc, 'vMerge', '1')\n\t\t\tconst span = rowSpanOf(displaced)\n\t\t\tif (span > 1) setSpan(tc, 'rowSpan', span)\n\t\t}\n\t\ttr.insertBefore(tc, cells[at] ?? firstChild(tr, 'a:extLst'))\n\t}\n\treturn gridCol\n}\n\n/**\n * Remove the column at `index`.\n *\n * When the column falls inside a horizontal span, the span shrinks by one and a\n * *continuation* is removed rather than the origin — so the merged region narrows but keeps\n * its content. Only a column whose cell stands alone loses that cell outright.\n */\nexport function removeColumn(tbl: Element, index: number): void {\n\tconst grid = gridOf(tbl)\n\tconst cols = getElements(grid, 'a:gridCol')\n\tconst at = checkIndex(index, cols.length, 'column', false)\n\tconst col = cols[at]\n\tif (col) grid.removeChild(col)\n\n\tfor (const tr of rowsOf(tbl)) {\n\t\tconst cells = cellsOf(tr)\n\t\tconst originIdx = hRunOrigin(cells, at)\n\t\tconst origin = cells[originIdx]\n\t\tif (!origin) continue\n\t\tconst span = gridSpanOf(origin)\n\t\tif (span > 1) {\n\t\t\tsetSpan(origin, 'gridSpan', span - 1)\n\t\t\t// Drop the run's last continuation: it carries no content, so removing it costs\n\t\t\t// nothing, while removing the origin would take the region's text with it.\n\t\t\tconst victim = cells[originIdx + span - 1]\n\t\t\tif (victim) tr.removeChild(victim)\n\t\t\tcontinue\n\t\t}\n\t\tconst tc = cells[at]\n\t\tif (tc) tr.removeChild(tc)\n\t}\n}\n\n/**\n * Merge the rectangle `(row1, col1)`–`(row2, col2)` into one cell.\n *\n * The top-left cell becomes the origin and keeps its content; every other cell in the\n * rectangle becomes a covered cell — flagged, stripped of its own span attributes, and\n * emptied, since a covered cell is never rendered.\n *\n * A rectangle whose boundary **cuts through** an existing merge is rejected rather than\n * silently widened. Widening would be the friendlier-looking choice and the wrong one: the\n * caller asked for a specific region, and quietly returning a different one is how a layout\n * ends up subtly wrong with nothing to point at.\n */\nexport function mergeCells(tbl: Element, row1: number, col1: number, row2: number, col2: number): void {\n\tconst grid = gridOfCells(tbl)\n\tconst rowCount = grid.length\n\tconst colCount = getElements(gridOf(tbl), 'a:gridCol').length\n\tconst r1 = Math.min(row1, row2)\n\tconst r2 = Math.max(row1, row2)\n\tconst c1 = Math.min(col1, col2)\n\tconst c2 = Math.max(col1, col2)\n\tcheckIndex(r1, rowCount, 'row', false)\n\tcheckIndex(r2, rowCount, 'row', false)\n\tcheckIndex(c1, colCount, 'column', false)\n\tcheckIndex(c2, colCount, 'column', false)\n\tif (r1 === r2 && c1 === c2) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'table/merge-range-invalid',\n\t\t\t'A merge needs at least two cells; the given range covers one'\n\t\t)\n\t}\n\n\t// Every span touching the rectangle must lie entirely inside it.\n\tfor (let r = r1; r <= r2; r++) {\n\t\tfor (let c = c1; c <= c2; c++) {\n\t\t\tconst tc = grid[r]?.[c]\n\t\t\tif (!tc) continue\n\t\t\tconst originRow = vRunOrigin(grid, r, c)\n\t\t\tconst originCol = hRunOrigin(grid[r] ?? [], c)\n\t\t\tconst origin = grid[originRow]?.[originCol]\n\t\t\tif (!origin) continue\n\t\t\tif (originRow < r1 || originCol < c1) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'table/merge-range-invalid',\n\t\t\t\t\t`The range (${r1},${c1})-(${r2},${c2}) starts inside an existing merged cell at (${originRow},${originCol}); unmerge it first`\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (originRow + rowSpanOf(origin) - 1 > r2 || originCol + gridSpanOf(origin) - 1 > c2) {\n\t\t\t\tthrow new InvalidOptionError(\n\t\t\t\t\t'table/merge-range-invalid',\n\t\t\t\t\t`The range (${r1},${c1})-(${r2},${c2}) cuts through an existing merged cell at (${originRow},${originCol}); unmerge it first`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst origin = grid[r1]?.[c1]\n\tif (!origin) return\n\tsetSpan(origin, 'gridSpan', c2 - c1 + 1)\n\tsetSpan(origin, 'rowSpan', r2 - r1 + 1)\n\tremoveAttr(origin, 'hMerge')\n\tremoveAttr(origin, 'vMerge')\n\n\tfor (let r = r1; r <= r2; r++) {\n\t\tfor (let c = c1; c <= c2; c++) {\n\t\t\tif (r === r1 && c === c1) continue\n\t\t\tconst tc = grid[r]?.[c]\n\t\t\tif (!tc) continue\n\t\t\tremoveAttr(tc, 'gridSpan')\n\t\t\tremoveAttr(tc, 'rowSpan')\n\t\t\tif (c > c1) setAttr(tc, 'hMerge', '1')\n\t\t\telse removeAttr(tc, 'hMerge')\n\t\t\tif (r > r1) setAttr(tc, 'vMerge', '1')\n\t\t\telse removeAttr(tc, 'vMerge')\n\t\t\temptyCellText(tc)\n\t\t}\n\t}\n}\n\n/**\n * Split the merged cell whose origin is `(row, col)` back into individual cells.\n * The origin keeps its content; the cells it covered come back empty, which is what they\n * already were.\n */\nexport function unmergeCell(tbl: Element, row: number, col: number): void {\n\tconst grid = gridOfCells(tbl)\n\tcheckIndex(row, grid.length, 'row', false)\n\tcheckIndex(col, getElements(gridOf(tbl), 'a:gridCol').length, 'column', false)\n\tconst origin = grid[row]?.[col]\n\tif (!origin) return\n\tif (isHMerge(origin) || isVMerge(origin)) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'table/merge-range-invalid',\n\t\t\t`The cell at (${row},${col}) is a covered cell, not a merge origin; unmerge the origin at (${vRunOrigin(grid, row, col)},${hRunOrigin(grid[row] ?? [], col)}) instead`\n\t\t)\n\t}\n\tconst rowSpan = rowSpanOf(origin)\n\tconst gridSpan = gridSpanOf(origin)\n\tif (rowSpan === 1 && gridSpan === 1) return\n\n\tremoveAttr(origin, 'gridSpan')\n\tremoveAttr(origin, 'rowSpan')\n\tfor (let r = row; r < row + rowSpan; r++) {\n\t\tfor (let c = col; c < col + gridSpan; c++) {\n\t\t\tif (r === row && c === col) continue\n\t\t\tconst tc = grid[r]?.[c]\n\t\t\tif (!tc) continue\n\t\t\tremoveAttr(tc, 'hMerge')\n\t\t\tremoveAttr(tc, 'vMerge')\n\t\t}\n\t}\n}\n\n/** Reduce a cell's text body to a single empty paragraph. */\nfunction emptyCellText(tc: Element): void {\n\tconst txBody = firstChild(tc, 'a:txBody')\n\tif (!txBody) return\n\tfor (const p of getElements(txBody, 'a:p')) txBody.removeChild(p)\n\ttxBody.appendChild(createElement(ownerDocumentOf(txBody), 'a:p'))\n}\n","/**\n * Resolve a table's `a:tableStyleId` against the deck-wide `tableStyles.xml` and\n * compose the style graph into a per-cell fill.\n *\n * A table cell that defines no own `a:tcPr` fill still renders shaded, because the\n * referenced `a:tblStyle` supplies conditional formatting: `wholeTbl` under\n * `band1H`/`band2H` (row banding), `band1V`/`band2V` (column banding),\n * `firstRow`/`lastRow`, `firstCol`/`lastCol`, and the four corner cells. Resolving\n * a cell means picking, in ECMA-376 precedence order, the highest-priority part\n * that actually defines a fill, then resolving that fill through the slide theme.\n *\n * This is read-only; it does not touch the import/copy path in `table-styles.ts`.\n */\n\nimport type { OpcPackage } from '../opc/package.js'\nimport { attr, firstChild, firstChildElement, getElements, type Element } from '../oxml/dom.js'\nimport { styleRefFill, type ThemeContext } from '../oxml/theme.js'\nimport { resolveColorElement, type ResolvedColor } from './theme-context.js'\n\nconst TABLE_STYLES_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml'\n\n/**\n * The `a:tblPr` condition flags that gate which style parts apply to a table.\n * `firstRow`/`bandRow` are the ones PowerPoint turns on by default; the rest are\n * off unless the author enabled the corresponding \"Header Column\" / \"Total Row\" /\n * \"Banded Columns\" toggle.\n */\nexport interface TableConditionFlags {\n\tfirstRow: boolean\n\tlastRow: boolean\n\tfirstCol: boolean\n\tlastCol: boolean\n\tbandRow: boolean\n\tbandCol: boolean\n}\n\n/** A table's resolved entry in `tableStyles.xml`: its GUID, display name, and raw element. */\nexport interface ResolvedTableStyle {\n\t/** The matched `@styleId` GUID (e.g. `{5C22544A-…}`). */\n\tstyleId: string\n\t/** The style's display name (`@styleName`, e.g. `Medium Style 2 - Accent 1`), or `null`. */\n\tname: string | null\n\t/** Escape hatch: the underlying `a:tblStyle` element. After mutating it call {@link ResolvedTableStyle.markDirty}, or `save()` writes the original bytes. */\n\telement_: Element\n\t/**\n\t * Mark `tableStyles.xml` dirty so `save()` reserializes it. Call after mutating\n\t * {@link ResolvedTableStyle.element_}. Note the part is deck-wide: an edit here\n\t * reaches every table bound to this style.\n\t */\n\tmarkDirty(): void\n}\n\n/**\n * Look up the `a:tblStyle` whose `@styleId` equals `styleId` in the deck's single\n * `tableStyles.xml`, or `null` when there is no such part or no matching style\n * (a built-in `[MS-OE376]` style the deck does not materialise resolves to `null`).\n */\nexport function resolveTableStyle(opc: OpcPackage, styleId: string | null): ResolvedTableStyle | null {\n\tif (!styleId) return null\n\tconst part = opc.partsByContentType(TABLE_STYLES_CONTENT_TYPE)[0]\n\tconst list = part?.dom.documentElement\n\tif (!part || !list) return null\n\tfor (const st of getElements(list, 'a:tblStyle')) {\n\t\tif (attr(st, 'styleId') === styleId) {\n\t\t\treturn {\n\t\t\t\tstyleId,\n\t\t\t\tname: attr(st, 'styleName'),\n\t\t\t\telement_: st,\n\t\t\t\tmarkDirty: () => {\n\t\t\t\t\tpart.markDirty()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\treturn null\n}\n\n/**\n * The style-part qnames that apply to the cell at `(row, col)`, highest precedence\n * first. Corner cells beat the row/column edge conditions, which beat banding,\n * which beats `wholeTbl`. Banding is suppressed on the header/footer rows and the\n * first/last columns, and its band ordinal is counted from the first body cell\n * (i.e. after a `firstRow` header), so the first body row is `band1H`.\n *\n * Only the `firstRow` / `band1H` / `band2H` / `wholeTbl` path is exercised by a\n * fixture today; the column/corner ordering follows the ECMA-376 conditional-format\n * precedence but is not render-verified.\n */\nfunction cellStyleParts(\n\tflags: TableConditionFlags,\n\trow: number,\n\tcol: number,\n\trowCount: number,\n\tcolCount: number\n): string[] {\n\tconst isFirstRow = flags.firstRow && row === 0\n\tconst isLastRow = flags.lastRow && row === rowCount - 1\n\tconst isFirstCol = flags.firstCol && col === 0\n\tconst isLastCol = flags.lastCol && col === colCount - 1\n\tconst parts: string[] = []\n\tif (isFirstRow && isFirstCol) parts.push('a:nwCell')\n\tif (isFirstRow && isLastCol) parts.push('a:neCell')\n\tif (isLastRow && isFirstCol) parts.push('a:swCell')\n\tif (isLastRow && isLastCol) parts.push('a:seCell')\n\tif (isFirstRow) parts.push('a:firstRow')\n\tif (isLastRow) parts.push('a:lastRow')\n\tif (isFirstCol) parts.push('a:firstCol')\n\tif (isLastCol) parts.push('a:lastCol')\n\tif (flags.bandRow && !isFirstRow && !isLastRow) {\n\t\tconst ordinal = row - (flags.firstRow ? 1 : 0)\n\t\tparts.push(ordinal % 2 === 0 ? 'a:band1H' : 'a:band2H')\n\t}\n\tif (flags.bandCol && !isFirstCol && !isLastCol) {\n\t\tconst ordinal = col - (flags.firstCol ? 1 : 0)\n\t\tparts.push(ordinal % 2 === 0 ? 'a:band1V' : 'a:band2V')\n\t}\n\tparts.push('a:wholeTbl')\n\treturn parts\n}\n\n/**\n * The fill a single `a:tcStyle` contributes. `fall` means the part defines no fill\n * (only borders, or nothing) so resolution continues to the next-lower part;\n * `stop` means the part settles the fill — either a resolved solid colour or `null`\n * for an explicit `a:noFill` / a non-solid style fill (a gradient has no single hex).\n */\nfunction tcStyleFill(\n\ttcStyle: Element,\n\tctx: ThemeContext\n): { stop: true; color: ResolvedColor | null } | { stop: false } {\n\tconst fillRef = firstChild(tcStyle, 'a:fillRef')\n\tif (fillRef) {\n\t\tconst fill = styleRefFill(fillRef, ctx)\n\t\tconst color = fill && fill.localName === 'solidFill' ? resolveColorElement(firstChildElement(fill), ctx) : null\n\t\treturn { stop: true, color }\n\t}\n\tconst fill = firstChild(tcStyle, 'a:fill')\n\tif (!fill) return { stop: false }\n\tconst solid = firstChild(fill, 'a:solidFill')\n\treturn { stop: true, color: solid ? resolveColorElement(firstChildElement(solid), ctx) : null }\n}\n\n/**\n * The fill the table style contributes to the cell at `(row, col)`, resolved to a\n * literal hex through the slide theme, or `null` when the applicable style parts\n * define no solid fill (an explicit `a:noFill`, e.g. a \"Light Style\" body cell,\n * also reads `null`). The caller supplies the resolved `a:tblStyle`, the table's\n * condition flags, and the grid dimensions.\n */\nexport function resolveTableCellStyleFill(\n\tstyle: Element,\n\tflags: TableConditionFlags,\n\trow: number,\n\tcol: number,\n\trowCount: number,\n\tcolCount: number,\n\tctx: ThemeContext\n): ResolvedColor | null {\n\tfor (const partName of cellStyleParts(flags, row, col, rowCount, colCount)) {\n\t\tconst part = firstChild(style, partName)\n\t\tconst tcStyle = part && firstChild(part, 'a:tcStyle')\n\t\tif (!tcStyle) continue\n\t\tconst outcome = tcStyleFill(tcStyle, ctx)\n\t\tif (outcome.stop) return outcome.color\n\t}\n\treturn null\n}\n","/**\n * Read/edit proxies for a table (`a:tbl`) hosted in a `p:graphicFrame`.\n *\n * `Table → TableRow[] → TableCell[]`, each wrapping a live DOM element and\n * holding the owning slide `Part` so edits mutate the node in place and call\n * `part.markDirty()`. Cell text reuses the `TextFrame`/`Paragraph`/`Run`\n * proxies, so per-run formatting edits work exactly as on a shape's text.\n */\nimport type { OpcPackage } from '../opc/package.js'\nimport type { Part } from '../opc/part.js'\nimport type { Relationships } from '../opc/relationships.js'\nimport {\n\tattr,\n\tcreateElement,\n\tfirstChild,\n\tgetElements,\n\tgetOrAddChild,\n\tintValue,\n\townerDocumentOf,\n\tremoveAttr,\n\tremoveChildrenByQName,\n\tsetAttr,\n\ttype Element,\n} from '../oxml/dom.js'\nimport { FILL_CHOICES, normalizeHex, setSolidFill } from '../oxml/fill.js'\nimport {\n\tANCHOR_VALUES,\n\tcheckEnum,\n\tcheckFiniteEmu,\n\tEDGE_QNAMES,\n\tHORZ_OVERFLOW_VALUES,\n\tinsertTcPrChild,\n\tTCPR_AFTER,\n\ttcPrChild,\n\tVERT_VALUES,\n\ttype TableCellEdge,\n} from './table-edit.js'\nimport { insertColumn, insertRow, mergeCells, removeColumn, removeRow, rowsOf, unmergeCell } from './table-structure.js'\nimport type { InvalidOptionErrorCode } from '../../codes.js'\nimport type { ThemeContext } from '../oxml/theme.js'\nimport { readPictureFill, type PictureFill } from './picture-fill.js'\nimport { readGradientFill, type GradientFill } from './gradient.js'\nimport { readPatternFill, type PatternFill } from './pattern-fill.js'\nimport {\n\tresolveTableCellStyleFill,\n\tresolveTableStyle,\n\ttype ResolvedTableStyle,\n\ttype TableConditionFlags,\n} from './table-style-resolve.js'\nimport { resolveSolidFillColor, type ResolvedColor } from './theme-context.js'\nimport { setTextBodyText, TextFrame } from './text.js'\nimport { InvalidOptionError, PackageReadError } from '../../errors.js'\n\n/**\n * One border as {@link TableCell.setBorder} takes it — the write-side mirror of\n * {@link CellBorder}, which is what reading one gives back.\n *\n * Deliberately not `CellBorder` itself: that type reports every field, `null` included, so\n * passing one back would make \"leave this alone\" unsayable. Here an omitted field is simply\n * not written, which is what an edit usually means.\n */\nexport interface TableCellBorderEdit {\n\t/** Border width in points; omitted leaves `@w` unset, which renders as a hairline. */\n\twidthPt?: number | null\n\t/** Dash preset (`a:prstDash/@val`, e.g. `sysDash`); omitted leaves the border solid. */\n\tdash?: string\n\t/** Explicit colour as 6-hex (`#` optional). Ignored when {@link schemeColor} is given. */\n\tcolor?: string\n\t/** Theme colour token (e.g. `accent1`); preferred over {@link color} when both are set. */\n\tschemeColor?: string\n\t/** Write an explicit `a:noFill` — a deliberately suppressed edge, not an absent one. */\n\tnoFill?: boolean\n}\n\n/**\n * The context a cell needs to resolve its style-graph fill: the table's resolved\n * `a:tblStyle`, its condition flags, and the grid dimensions. Threaded from\n * {@link Table} down to each {@link TableCell} alongside the cell's own position.\n * `null` when the table references no resolvable style.\n */\ninterface TableCellStyleContext {\n\tstyle: ResolvedTableStyle\n\tflags: TableConditionFlags\n\trowCount: number\n\tcolCount: number\n\tctx: ThemeContext\n}\n\n/**\n * One edge border of a table cell (`a:tcPr/a:lnL|lnR|lnT|lnB|lnTlToBr|lnBlToTr`).\n * Mirrors the `a:ln`-style decode used for shape strokes: {@link widthPt} from\n * `@w` (EMU → points), {@link dash} from `a:prstDash/@val`, and the stroke colour\n * split into a resolved {@link color} (literal hex) and the raw {@link schemeColor}\n * token — the cell-border counterpart of a shape's line accessors.\n */\nexport interface CellBorder {\n\t/** Border width in points (`@w` is EMU; 12700 EMU = 1pt), or `null` when unset. */\n\twidthPt: number | null\n\t/** Dash style (`a:prstDash/@val`, e.g. `solid`/`sysDash`), or `null` when unset. */\n\tdash: string | null\n\t/** The stroke colour resolved against the table theme to a literal hex (`effectiveHex`), or `null`. */\n\tcolor: string | null\n\t/** Raw `schemeClr` token of the stroke (`a:solidFill/a:schemeClr/@val`), or `null` for an srgb/absent colour. */\n\tschemeColor: string | null\n\t/** `true` when the edge is an explicit no-border (`a:noFill`) — a deliberately suppressed side. */\n\tnoFill: boolean\n}\n\n/**\n * A table cell's six possible borders, keyed by edge. Each side is `null` when the\n * cell defines no line for it; the diagonals ({@link tlToBr} `╲`, {@link blToTr} `╱`)\n * are rarely authored. The whole object is `null` when the cell carries no border\n * element at all (see {@link TableCell.borders}).\n */\nexport interface CellBorders {\n\tleft: CellBorder | null\n\tright: CellBorder | null\n\ttop: CellBorder | null\n\tbottom: CellBorder | null\n\ttlToBr: CellBorder | null\n\tblToTr: CellBorder | null\n}\n\n/**\n * A table cell's 3-D bevel (`a:tcPr/a:cell3D`), as read back. Every field is `null` when the\n * source leaves it to the schema default, so a reader can tell \"PowerPoint wrote `circle`\"\n * from \"PowerPoint wrote nothing and `circle` is what it means\".\n */\nexport interface CellThreeD {\n\t/** `a:cell3D/@prstMaterial` (`ST_PresetMaterialType`), or `null` when unset. */\n\tmaterial: string | null\n\t/** The required `a:bevel`. Present whenever the cell has a `a:cell3D` at all. */\n\tbevel: {\n\t\t/** `a:bevel/@prst` (`ST_BevelPresetType`), or `null` when unset. */\n\t\tpreset: string | null\n\t\t/** `a:bevel/@w` converted from EMU to points, or `null` when unset. */\n\t\twidthPt: number | null\n\t\t/** `a:bevel/@h` converted from EMU to points, or `null` when unset. */\n\t\theightPt: number | null\n\t}\n\t/** `a:cell3D/a:lightRig`, or `null` when the cell leaves lighting to the renderer. */\n\tlightRig: { rig: string | null; dir: string | null } | null\n}\n\n/** A table: a grid of rows and cells inside a graphic frame. */\nexport class Table {\n\tconstructor(\n\t\tprivate readonly tbl: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme colour context, threaded to each cell's text for `Run.resolvedColor`. */\n\t\tprivate readonly themeColors?: ThemeContext,\n\t\t/** The deck package, for resolving `a:tableStyleId` against `tableStyles.xml` (style-graph cell fills). */\n\t\tprivate readonly opc?: OpcPackage,\n\t\t/** The owning slide's relationships, for resolving a cell picture fill's `r:embed` to a partname. */\n\t\tprivate readonly rels?: Relationships\n\t) {}\n\n\t/** The table's rows (`a:tr`) in document (top-to-bottom) order. */\n\tget rows(): TableRow[] {\n\t\tconst style = this.#styleContext()\n\t\treturn getElements(this.tbl, 'a:tr').map(\n\t\t\t(tr, rowIndex) => new TableRow(tr, this.part, this.themeColors, style, rowIndex, this.rels)\n\t\t)\n\t}\n\n\t/**\n\t * The table's style graph entry (`styleId`, `name`, raw `a:tblStyle`) resolved\n\t * from the deck's `tableStyles.xml`, or `null` when the table names no\n\t * `a:tableStyleId`, the deck has no `tableStyles.xml`, or the id is a built-in\n\t * `[MS-OE376]` style the deck does not materialise. This is what supplies the\n\t * banded-row / header shading a cell with no own fill inherits — read the\n\t * resolved per-cell colour off {@link TableCell.resolvedFill}.\n\t */\n\tget resolvedStyle(): ResolvedTableStyle | null {\n\t\treturn this.opc ? resolveTableStyle(this.opc, this.styleId) : null\n\t}\n\n\t/** The per-cell style-resolution context, or `null` when no style resolves or there is no theme context. */\n\t#styleContext(): TableCellStyleContext | null {\n\t\tif (!this.opc || !this.themeColors) return null\n\t\tconst style = resolveTableStyle(this.opc, this.styleId)\n\t\tif (!style) return null\n\t\treturn {\n\t\t\tstyle,\n\t\t\tflags: {\n\t\t\t\tfirstRow: this.#tblPrFlag('firstRow'),\n\t\t\t\tlastRow: this.#tblPrFlag('lastRow'),\n\t\t\t\tfirstCol: this.#tblPrFlag('firstCol'),\n\t\t\t\tlastCol: this.#tblPrFlag('lastCol'),\n\t\t\t\tbandRow: this.#tblPrFlag('bandRow'),\n\t\t\t\tbandCol: this.#tblPrFlag('bandCol'),\n\t\t\t},\n\t\t\trowCount: this.rowCount,\n\t\t\tcolCount: this.columnCount,\n\t\t\tctx: this.themeColors,\n\t\t}\n\t}\n\n\t/** Number of rows (`a:tr`). */\n\tget rowCount(): number {\n\t\treturn getElements(this.tbl, 'a:tr').length\n\t}\n\n\t/** Number of grid columns (`a:tblGrid/a:gridCol`). */\n\tget columnCount(): number {\n\t\tconst grid = firstChild(this.tbl, 'a:tblGrid')\n\t\treturn grid ? getElements(grid, 'a:gridCol').length : 0\n\t}\n\n\t/** Column widths in EMU (`a:gridCol/@w`), one per grid column. */\n\tget columnWidths(): (number | null)[] {\n\t\tconst grid = firstChild(this.tbl, 'a:tblGrid')\n\t\tif (!grid) return []\n\t\treturn getElements(grid, 'a:gridCol').map((col) => intValue(attr(col, 'w')))\n\t}\n\n\t/**\n\t * The table's style GUID (`a:tblPr/a:tableStyleId` text), e.g.\n\t * `{5940675A-B579-460E-94D1-54222C63F5DA}`, or `null` when the table carries no\n\t * `a:tableStyleId`. This is the reference into `ppt/tableStyles.xml` (or a\n\t * built-in `[MS-OE376]` style) that supplies the banded-row / header shading the\n\t * `firstRow`/`bandRow` flags activate — without it a replica loses the whole\n\t * table style, so it is the read counterpart of the writer's `tableStyle` option.\n\t */\n\tget styleId(): string | null {\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\tconst idEl = tblPr && firstChild(tblPr, 'a:tableStyleId')\n\t\tconst id = idEl?.textContent?.trim()\n\t\treturn id ? id : null\n\t}\n\n\t/**\n\t * The table's own background (`a:tblPr` fill) resolved against the slide's theme colour\n\t * context to a literal hex, or `null` when the table carries no solid background.\n\t *\n\t * This is the table-level counterpart of {@link TableCell.resolvedFill}, and it is a\n\t * genuinely different thing from a cell fill: a `a:tblPr` fill sits *behind* the grid, so\n\t * a cell with no fill of its own shows it through. Reports `null` for a non-solid choice\n\t * (`a:blipFill`/`a:gradFill`/`a:pattFill`/`a:noFill`) — read {@link pictureFill} for an\n\t * image background — and `null` with no theme context.\n\t */\n\tget resolvedFill(): ResolvedColor | null {\n\t\tif (!this.themeColors) return null\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\tif (!tblPr || !FILL_CHOICES.some((q) => firstChild(tblPr, q))) return null\n\t\treturn resolveSolidFillColor(tblPr, this.themeColors)\n\t}\n\n\t/**\n\t * The table's picture background (`a:tblPr/a:blipFill`), or `null` when the table is not\n\t * image-backed. The table-level twin of {@link TableCell.pictureFill}, and needed for the\n\t * same reason: {@link resolvedFill} decodes only solid colours, so without this an\n\t * image-backed table is indistinguishable from an unfilled one.\n\t */\n\tget pictureFill(): PictureFill | null {\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\treturn tblPr ? readPictureFill(tblPr, this.rels ?? null) : null\n\t}\n\n\t/**\n\t * The table's gradient background (`a:tblPr/a:gradFill`), or `null` when it is not\n\t * gradient-filled. Needed for the same reason {@link pictureFill} is:\n\t * {@link resolvedFill} decodes only solid colours.\n\t */\n\tget gradientFill(): GradientFill | null {\n\t\tif (!this.themeColors) return null\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\treturn tblPr ? readGradientFill(tblPr, this.themeColors) : null\n\t}\n\n\t/**\n\t * The table's pattern (hatch) background (`a:tblPr/a:pattFill`), or `null` when it is not\n\t * pattern-filled.\n\t */\n\tget patternFill(): PatternFill | null {\n\t\tif (!this.themeColors) return null\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\treturn tblPr ? readPatternFill(tblPr, this.themeColors) : null\n\t}\n\n\t/**\n\t * The raw `schemeClr` token of the table's own background\n\t * (`a:tblPr/a:solidFill/a:schemeClr/@val`), or `null` for an absent or `srgbClr` fill.\n\t * {@link resolvedFill} is the literal it resolves to; this is the unresolved reference,\n\t * which is what a replica should carry so the copy still tracks its theme.\n\t */\n\tget fillSchemeColor(): string | null {\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\tconst fill = tblPr && firstChild(tblPr, 'a:solidFill')\n\t\tconst scheme = fill && firstChild(fill, 'a:schemeClr')\n\t\treturn scheme ? attr(scheme, 'val') : null\n\t}\n\n\t/** Whether the first row is styled as a header (`a:tblPr/@firstRow`). */\n\tget firstRowHeader(): boolean {\n\t\treturn this.#tblPrFlag('firstRow')\n\t}\n\n\t/** Whether rows are banded (`a:tblPr/@bandRow`). */\n\tget bandedRows(): boolean {\n\t\treturn this.#tblPrFlag('bandRow')\n\t}\n\n\t/**\n\t * The cell at `(rowIndex, columnIndex)` (both zero-based), or `null` when out\n\t * of range. Column index counts `a:tc` elements in the row, so a cell that\n\t * spans columns (`gridSpan`) occupies a single index here.\n\t */\n\tcell(rowIndex: number, columnIndex: number): TableCell | null {\n\t\treturn this.rows[rowIndex]?.cells[columnIndex] ?? null\n\t}\n\n\t/**\n\t * Insert a row, defaulting to the bottom of the table. Returns the new {@link TableRow}.\n\t *\n\t * The new row is auto-height (`a:tr/@h=\"0\"`) and its cells are empty. Inserting *through*\n\t * a vertical merge extends that merge rather than interrupting it: the span's origin\n\t * grows by a row and the new cell joins as a continuation, because an origin claiming\n\t * more rows than it has continuations is a table PowerPoint reports as corrupt.\n\t * @param {number} [index] - where to insert, `0`..`rowCount`; appended when omitted\n\t * @throws {InvalidOptionError} when `index` is outside that range\n\t */\n\taddRow(index?: number): TableRow {\n\t\tconst tr = insertRow(this.tbl, index)\n\t\tthis.part.markDirty()\n\t\treturn new TableRow(tr, this.part, this.themeColors, this.#styleContext(), rowsOf(this.tbl).indexOf(tr), this.rels)\n\t}\n\n\t/**\n\t * Remove the row at `index`, with its content.\n\t *\n\t * A cell in the row that *continues* a vertical merge shortens that merge. A cell that\n\t * *starts* one hands the region to its first continuation, which becomes the new origin —\n\t * the merged region survives one row shorter, and only the removed row's own text is lost.\n\t * @throws {InvalidOptionError} when `index` is out of range\n\t */\n\tremoveRow(index: number): void {\n\t\tremoveRow(this.tbl, index)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Insert a column, defaulting to the right-hand end. Updates `a:tblGrid` **and** every\n\t * row, which is the pair that has to stay in step.\n\t *\n\t * The mirror of {@link addRow}'s merge case: inserting inside a horizontal merge widens\n\t * it instead of splitting it.\n\t * @param {number} [index] - where to insert, `0`..`columnCount`; appended when omitted\n\t * @param {number} [widthEmu] - the new column's width; defaults to 1 inch\n\t * @throws {InvalidOptionError} when `index` is outside that range\n\t */\n\taddColumn(index?: number, widthEmu?: number): void {\n\t\tinsertColumn(this.tbl, index, widthEmu)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Remove the column at `index`, from `a:tblGrid` and from every row.\n\t *\n\t * Inside a horizontal merge the region narrows by one and keeps its content: a covered\n\t * cell is dropped rather than the origin. Elsewhere the column's cells go with it.\n\t * @throws {InvalidOptionError} when `index` is out of range\n\t */\n\tremoveColumn(index: number): void {\n\t\tremoveColumn(this.tbl, index)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Merge the rectangle between two cell positions into one cell. The top-left cell keeps\n\t * its content; the rest become covered cells and are emptied, since a covered cell is\n\t * never rendered.\n\t *\n\t * A rectangle that cuts through an existing merge is **rejected**, not silently widened\n\t * to fit — the caller asked for a specific region, and quietly producing a different one\n\t * is how a layout ends up wrong with nothing to point at. Unmerge first.\n\t * @throws {InvalidOptionError} when an index is out of range, the range covers one cell,\n\t * or it partially overlaps an existing merge\n\t */\n\tmergeCells(row1: number, col1: number, row2: number, col2: number): void {\n\t\tmergeCells(this.tbl, row1, col1, row2, col2)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Split the merged cell whose **origin** is `(row, col)` back into individual cells.\n\t * A no-op on a cell that is not merged; addressing a covered cell instead of the origin\n\t * throws, and the message names the origin to use.\n\t * @throws {InvalidOptionError} when an index is out of range or the cell is a covered cell\n\t */\n\tunmergeCell(row: number, col: number): void {\n\t\tunmergeCell(this.tbl, row, col)\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Escape hatch: the underlying `a:tbl` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.tbl\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n\n\t#tblPrFlag(name: string): boolean {\n\t\tconst tblPr = firstChild(this.tbl, 'a:tblPr')\n\t\treturn tblPr ? attr(tblPr, name) === '1' : false\n\t}\n}\n\n/** One table row (`a:tr`). */\nexport class TableRow {\n\tconstructor(\n\t\tprivate readonly tr: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme colour context, threaded to each {@link TableCell}. */\n\t\tprivate readonly themeColors?: ThemeContext,\n\t\t/** The table's style-resolution context, threaded to each cell for {@link TableCell.resolvedFill}. */\n\t\tprivate readonly style?: TableCellStyleContext | null,\n\t\t/** This row's zero-based index in the table, for style-graph banding/edge conditions. */\n\t\tprivate readonly rowIndex = 0,\n\t\t/** The owning slide's relationships, threaded to each cell for {@link TableCell.pictureFill}. */\n\t\tprivate readonly rels?: Relationships\n\t) {}\n\n\t/** The row's cells (`a:tc`) in left-to-right order. */\n\tget cells(): TableCell[] {\n\t\treturn getElements(this.tr, 'a:tc').map(\n\t\t\t(tc, colIndex) => new TableCell(tc, this.part, this.themeColors, this.style, this.rowIndex, colIndex, this.rels)\n\t\t)\n\t}\n\n\t/** Row height in EMU (`a:tr/@h`), or `null` if unset. */\n\tget heightEmu(): number | null {\n\t\treturn intValue(attr(this.tr, 'h'))\n\t}\n\n\t/** Escape hatch: the underlying `a:tr` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.tr\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n}\n\n/** One table cell (`a:tc`). */\nexport class TableCell {\n\tconstructor(\n\t\tprivate readonly tc: Element,\n\t\tprivate readonly part: Part,\n\t\t/** The owning slide's theme colour context, threaded to the cell's text for `Run.resolvedColor`. */\n\t\tprivate readonly themeColors?: ThemeContext,\n\t\t/** The table's style-resolution context, for the {@link resolvedFill} style-graph fallback. */\n\t\tprivate readonly style?: TableCellStyleContext | null,\n\t\t/** This cell's zero-based row index in the table. */\n\t\tprivate readonly rowIndex = 0,\n\t\t/** This cell's zero-based column index in its row. */\n\t\tprivate readonly colIndex = 0,\n\t\t/** The owning slide's relationships, for resolving {@link pictureFill}'s `r:embed` to a partname. */\n\t\tprivate readonly rels?: Relationships\n\t) {}\n\n\t/** The cell's text frame (`a:txBody`); `null` only if the cell has none (non-conformant). */\n\tget textFrame(): TextFrame | null {\n\t\tconst txBody = firstChild(this.tc, 'a:txBody')\n\t\treturn txBody ? new TextFrame(txBody, this.part, this.themeColors) : null\n\t}\n\n\t/** The cell's text, paragraphs joined by `\\n`. */\n\tget text(): string {\n\t\treturn this.textFrame?.text ?? ''\n\t}\n\n\t/**\n\t * Replace the cell's text with a single paragraph and run, preserving the\n\t * formatting (`a:rPr`) of the cell's first existing run when there is one.\n\t * For finer control (multiple runs, per-run formatting), edit\n\t * `textFrame.paragraphs[].runs[]` directly.\n\t */\n\tset text(value: string) {\n\t\tconst txBody = firstChild(this.tc, 'a:txBody')\n\t\tif (!txBody) throw new PackageReadError('table/cell-has-no-text-body', 'Table cell has no a:txBody to set text on')\n\t\tsetTextBodyText(txBody, value)\n\t\tthis.part.markDirty()\n\t}\n\n\t/** The cell's properties element (`a:tcPr`), or `null` when the cell defines none. */\n\t#tcPr(): Element | null {\n\t\treturn firstChild(this.tc, 'a:tcPr')\n\t}\n\n\t/**\n\t * The cell's `a:tcPr`, creating it when absent.\n\t *\n\t * `CT_TableCell` sequences `a:txBody` then `a:tcPr` then `a:extLst`, so a newly created\n\t * one is inserted before `a:extLst` — appending it blindly would put it after and make\n\t * the part invalid. Every setter below goes through here for that reason.\n\t */\n\t#getOrAddTcPr(): Element {\n\t\treturn getOrAddChild(this.tc, 'a:tcPr', ['a:extLst'])\n\t}\n\n\t/**\n\t * Set (or clear) the cell's vertical text anchor (`a:tcPr/@anchor`).\n\t * `null` removes the attribute, leaving PowerPoint's default of top.\n\t * @throws {InvalidOptionError} when the value is outside `ST_TextAnchoringType`\n\t */\n\tsetAnchor(value: string | null): void {\n\t\tthis.#setTcPrAttr('anchor', value, ANCHOR_VALUES, 'table/invalid-cell-anchor')\n\t}\n\n\t/**\n\t * Set (or clear) the cell's text direction (`a:tcPr/@vert`), e.g. `'vert270'`.\n\t * `null` removes the attribute, leaving the default horizontal text.\n\t * @throws {InvalidOptionError} when the value is outside `ST_TextVerticalType`\n\t */\n\tsetVerticalText(value: string | null): void {\n\t\tthis.#setTcPrAttr('vert', value, VERT_VALUES, 'table/invalid-cell-vert')\n\t}\n\n\t/**\n\t * Set (or clear) `a:tcPr/@horzOverflow` — what a single glyph too wide for the cell does.\n\t * `null` removes the attribute; so does `'clip'` in effect, since it is the schema\n\t * default, but the attribute is still written as asked.\n\t * @throws {InvalidOptionError} when the value is outside `ST_TextHorzOverflowType`\n\t */\n\tsetHorzOverflow(value: string | null): void {\n\t\tthis.#setTcPrAttr('horzOverflow', value, HORZ_OVERFLOW_VALUES, 'table/invalid-cell-overflow')\n\t}\n\n\t/**\n\t * Centre the cell's text block horizontally, or stop doing so (`a:tcPr/@anchorCtr`).\n\t * `false` removes the attribute rather than writing `\"0\"`, since `false` is the schema\n\t * default and the two are indistinguishable to a renderer.\n\t */\n\tsetAnchorCtr(value: boolean): void {\n\t\tconst tcPr = this.#getOrAddTcPr()\n\t\tif (value) setAttr(tcPr, 'anchorCtr', '1')\n\t\telse removeAttr(tcPr, 'anchorCtr')\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Set the cell's text insets in EMU (`a:tcPr/@marL`/`@marR`/`@marT`/`@marB`).\n\t *\n\t * Partial: only the sides named are touched, so `{ left: 0 }` flushes the text left and\n\t * leaves the other three alone. A side given as `null` has its attribute removed, which\n\t * returns it to the schema default (91440 EMU left/right, 45720 top/bottom) — not to\n\t * zero. Pass `{}` to change nothing.\n\t * @throws {InvalidOptionError} when a value is not a finite number\n\t */\n\tsetMarginsEmu(margins: {\n\t\tleft?: number | null\n\t\tright?: number | null\n\t\ttop?: number | null\n\t\tbottom?: number | null\n\t}): void {\n\t\tconst tcPr = this.#getOrAddTcPr()\n\t\tconst sides = [\n\t\t\t['marL', margins.left],\n\t\t\t['marR', margins.right],\n\t\t\t['marT', margins.top],\n\t\t\t['marB', margins.bottom],\n\t\t] as const\n\t\tfor (const [name, value] of sides) {\n\t\t\tif (value === undefined) continue\n\t\t\tif (value === null) removeAttr(tcPr, name)\n\t\t\telse setAttr(tcPr, name, String(checkFiniteEmu(value, name, 'table/invalid-cell-margin')))\n\t\t}\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Set (or clear) one of the cell's six borders — the four edges and the two diagonals.\n\t *\n\t * `null` removes the element entirely, which is \"inherit\", and is a different thing from\n\t * `{ noFill: true }`, which writes an explicit no-border and suppresses whatever would\n\t * otherwise be inherited. The element is inserted at its schema position rather than\n\t * appended: `CT_TableCellProperties` is a sequence, and an out-of-order `a:tcPr` is\n\t * reported by PowerPoint as a corrupt file rather than as a bad edit.\n\t *\n\t * Colour is either `color` (6-hex, `#` optional) or `schemeColor` (a theme token); giving\n\t * both prefers the token, matching how the read side reports them.\n\t * @throws {InvalidOptionError} when the width or colour cannot be written\n\t */\n\tsetBorder(edge: TableCellEdge, border: TableCellBorderEdit | null): void {\n\t\tconst qname = EDGE_QNAMES[edge]\n\t\tif (!qname) {\n\t\t\tthrow new InvalidOptionError(\n\t\t\t\t'table/invalid-cell-border',\n\t\t\t\t`Unknown table cell edge: ${JSON.stringify(edge)}. Expected one of: ${Object.keys(EDGE_QNAMES).join(', ')}.`\n\t\t\t)\n\t\t}\n\t\tif (border === null) {\n\t\t\tconst tcPr = this.#tcPr()\n\t\t\tif (!tcPr || !firstChild(tcPr, qname)) return\n\t\t\tremoveChildrenByQName(tcPr, [qname])\n\t\t\tthis.part.markDirty()\n\t\t\treturn\n\t\t}\n\n\t\tconst tcPr = this.#getOrAddTcPr()\n\t\t// Rebuilt rather than patched in place: a half-edited `a:ln` (say, a new colour left\n\t\t// beside a stale `a:noFill`) is a state neither the reader nor PowerPoint expects, and\n\t\t// the element is small enough that replacing it is simpler than reconciling it.\n\t\tremoveChildrenByQName(tcPr, [qname])\n\t\tconst doc = ownerDocumentOf(tcPr)\n\t\tconst ln = createElement(doc, qname)\n\t\tif (border.widthPt !== undefined && border.widthPt !== null) {\n\t\t\tsetAttr(ln, 'w', String(checkFiniteEmu(border.widthPt * 12700, 'widthPt', 'table/invalid-cell-border')))\n\t\t}\n\t\tif (border.noFill) {\n\t\t\tln.appendChild(createElement(doc, 'a:noFill'))\n\t\t} else if (border.schemeColor || border.color) {\n\t\t\tconst fill = createElement(doc, 'a:solidFill')\n\t\t\tconst scheme = border.schemeColor\n\t\t\tconst clr = createElement(doc, scheme ? 'a:schemeClr' : 'a:srgbClr')\n\t\t\tsetAttr(clr, 'val', scheme ? scheme : normalizeHex(border.color as string))\n\t\t\tfill.appendChild(clr)\n\t\t\tln.appendChild(fill)\n\t\t}\n\t\t// `a:prstDash` follows the fill group in CT_LineProperties, so it is appended after.\n\t\tif (border.dash) {\n\t\t\tconst dash = createElement(doc, 'a:prstDash')\n\t\t\tsetAttr(dash, 'val', border.dash)\n\t\t\tln.appendChild(dash)\n\t\t}\n\t\tinsertTcPrChild(tcPr, qname, ln)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * Replace the cell's fill with a solid colour (`a:tcPr/a:solidFill`), or clear it.\n\t *\n\t * `null` removes the `a:solidFill` and lets the cell inherit from the table style again.\n\t * That is not the same as {@link noFill}, which writes an explicit `a:noFill` and so\n\t * suppresses the inherited shading. Any competing fill choice (`a:gradFill`,\n\t * `a:blipFill`, …) is dropped first — `EG_FillProperties` admits one.\n\t * @throws {InvalidOptionError} when `color` is not a 6-digit hex string\n\t */\n\tsetFillColor(color: string | null): void {\n\t\tthis.#setFill(color === null ? null : { qname: 'a:srgbClr', val: normalizeHex(color) })\n\t}\n\n\t/**\n\t * Replace the cell's fill with a theme colour token (`a:solidFill/a:schemeClr/@val`), or\n\t * clear it. Preferred over {@link setFillColor} when the deck's theme should keep\n\t * driving the colour.\n\t */\n\tsetFillSchemeColor(token: string | null): void {\n\t\tthis.#setFill(token === null ? null : { qname: 'a:schemeClr', val: token })\n\t}\n\n\t/**\n\t * Write an explicit `<a:noFill/>` on the cell — a transparent cell that shows the table\n\t * background (or the slide) through. Distinct from `setFillColor(null)`, which removes\n\t * the fill and lets the table style's shading apply again.\n\t */\n\tnoFill(): void {\n\t\tconst tcPr = this.#getOrAddTcPr()\n\t\tremoveChildrenByQName(tcPr, FILL_CHOICES)\n\t\ttcPrChild(tcPr, 'a:noFill')\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Set or clear one `a:tcPr` attribute, vetting it against its schema enum first. */\n\t#setTcPrAttr(name: string, value: string | null, valid: readonly string[], code: InvalidOptionErrorCode): void {\n\t\tif (value === null) {\n\t\t\tconst tcPr = this.#tcPr()\n\t\t\tif (!tcPr) return\n\t\t\tremoveAttr(tcPr, name)\n\t\t\tthis.part.markDirty()\n\t\t\treturn\n\t\t}\n\t\tconst checked = checkEnum(value, valid, name, code)\n\t\tsetAttr(this.#getOrAddTcPr(), name, checked)\n\t\tthis.part.markDirty()\n\t}\n\n\t/** Replace (or remove) the cell's solid fill, keeping `EG_FillProperties` single-valued. */\n\t#setFill(color: { qname: string; val: string } | null): void {\n\t\tif (color === null) {\n\t\t\tconst tcPr = this.#tcPr()\n\t\t\tif (!tcPr || !firstChild(tcPr, 'a:solidFill')) return\n\t\t\tremoveChildrenByQName(tcPr, ['a:solidFill'])\n\t\t\tthis.part.markDirty()\n\t\t\treturn\n\t\t}\n\t\tsetSolidFill(this.#getOrAddTcPr(), TCPR_AFTER['a:solidFill'] ?? [], color)\n\t\tthis.part.markDirty()\n\t}\n\n\t/**\n\t * The cell's solid fill resolved against the table's theme colour context to a\n\t * literal hex — the table-cell counterpart of\n\t * {@link import('./shapes.js').AutoShape.resolvedFill}. The cell's own\n\t * `a:tcPr/a:solidFill` wins; when the cell defines none, this falls back to the\n\t * table **style** graph (the `firstRow`/banded/`wholeTbl` shading the\n\t * `a:tableStyleId` supplies — see {@link Table.resolvedStyle}), so a styled cell\n\t * with an empty `a:tcPr` reports the colour PowerPoint actually renders rather\n\t * than `null`.\n\t *\n\t * A cell that carries *some other* fill choice (`a:blipFill`/`a:gradFill`/\n\t * `a:pattFill`/`a:noFill`) overrides the style graph in PowerPoint, so this\n\t * reports `null` for one rather than falling through to the inherited shading —\n\t * the same guard {@link import('./shapes.js').AutoShape.resolvedFill} applies to\n\t * the style matrix. Read {@link pictureFill} for an image-filled cell. Also\n\t * `null` with no theme context, or when neither source yields a solid colour (an\n\t * unmapped token, an explicit style `a:noFill`). The returned\n\t * {@link ResolvedColor} carries `effectiveHex` (the base colour with its\n\t * `lumMod`/`lumOff`/… transforms applied) — read that for the final colour.\n\t */\n\tget resolvedFill(): ResolvedColor | null {\n\t\tif (!this.themeColors) return null\n\t\tif (this.hasOwnFill) return resolveSolidFillColor(this.#tcPr(), this.themeColors)\n\t\treturn this.style ? this.#styleFill() : null\n\t}\n\n\t/**\n\t * Whether the cell carries a fill of its **own** (`a:tcPr` holds an `EG_FillProperties`\n\t * child), as opposed to inheriting one from the table style's header/banding rules.\n\t *\n\t * This is the flag that disambiguates {@link resolvedFill}, which deliberately reports\n\t * either — it answers \"what colour does this cell render as\", and both sources are valid\n\t * answers to that. Anything that has to reproduce the cell rather than describe it needs\n\t * to know which: baking an inherited banding colour into a copy makes the copy look right\n\t * until someone changes its table style, and then nothing moves. `false` for a cell whose\n\t * `a:tcPr` is empty or absent, whatever the style graph would render it as.\n\t */\n\tget hasOwnFill(): boolean {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn !!tcPr && FILL_CHOICES.some((q) => firstChild(tcPr, q))\n\t}\n\n\t/**\n\t * `true` when the cell sets an explicit no-fill (`a:tcPr/a:noFill`) — a deliberately\n\t * transparent cell showing the table background (or the slide) through. The cell-side\n\t * counterpart of {@link import('./shapes.js').AutoShape.fillNoFill}, and what\n\t * {@link noFill} writes.\n\t *\n\t * {@link hasOwnFill} is not this question: it is `true` for *any* `EG_FillProperties`\n\t * child, so on its own it cannot separate a suppressed fill from a gradient or an image\n\t * one — and every colour accessor ({@link resolvedFill}, {@link fillColor},\n\t * {@link fillSchemeColor}) reports `null` for a no-fill cell exactly as it does for a\n\t * cell that inherits its shading from the table style. Deriving it as \"has a fill of its\n\t * own, and no accessor recognises it\" instead of reading it has two failure modes: it\n\t * folds `a:grpFill` in with `a:noFill`, and its meaning changes silently the day a\n\t * further fill kind gets an accessor. The two paint completely differently — an\n\t * inherited banding colour versus nothing at all — so a consumer that cannot tell them\n\t * apart paints a transparent cell in the style's shading.\n\t */\n\tget fillNoFill(): boolean {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn !!tcPr && !!firstChild(tcPr, 'a:noFill')\n\t}\n\n\t/**\n\t * The cell's picture (image) fill (`a:tcPr/a:blipFill`), or `null` when the cell\n\t * is not image-filled. The cell counterpart of\n\t * {@link import('./shapes.js').AutoShape.pictureFill}: {@link resolvedFill}\n\t * decodes only solid colours, so without this an image-filled cell is\n\t * indistinguishable from an empty one. Carries the embedded image\n\t * ({@link PictureFill.relId}/{@link PictureFill.partName}) plus the stretch/tile\n\t * geometry; {@link PictureFill.partName} needs the owning slide's relationships,\n\t * which a {@link Table} built without them cannot supply.\n\t */\n\tget pictureFill(): PictureFill | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn tcPr ? readPictureFill(tcPr, this.rels ?? null) : null\n\t}\n\n\t/** The fill this cell inherits from the table style graph, or `null` when the style defines none for it. */\n\t#styleFill(): ResolvedColor | null {\n\t\tconst s = this.style\n\t\tif (!s) return null\n\t\treturn resolveTableCellStyleFill(\n\t\t\ts.style.element_,\n\t\t\ts.flags,\n\t\t\tthis.rowIndex,\n\t\t\tthis.colIndex,\n\t\t\ts.rowCount,\n\t\t\ts.colCount,\n\t\t\ts.ctx\n\t\t)\n\t}\n\n\t/**\n\t * The cell's gradient fill (`a:tcPr/a:gradFill`), or `null` when the cell is not\n\t * gradient-filled. The cell twin of {@link Table.gradientFill}, and needed for the same\n\t * reason {@link pictureFill} is: {@link resolvedFill} reports `null` for every non-solid\n\t * choice, so without this a gradient cell is indistinguishable from an unfilled one.\n\t */\n\tget gradientFill(): GradientFill | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn tcPr && this.themeColors ? readGradientFill(tcPr, this.themeColors) : null\n\t}\n\n\t/**\n\t * The cell's pattern (hatch) fill (`a:tcPr/a:pattFill`), or `null` when the cell is not\n\t * pattern-filled.\n\t */\n\tget patternFill(): PatternFill | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn tcPr && this.themeColors ? readPatternFill(tcPr, this.themeColors) : null\n\t}\n\n\t/**\n\t * The raw `schemeClr` token of the cell's solid fill (`a:tcPr/a:solidFill/a:schemeClr/@val`),\n\t * e.g. `accent1`/`bg1`, or `null` when the fill is absent or an explicit `srgbClr`.\n\t * The resolved literal is {@link resolvedFill}; this is the unresolved reference.\n\t */\n\tget fillSchemeColor(): string | null {\n\t\treturn this.#fillSchemeColorOf(this.#tcPr() ?? this.tc)\n\t}\n\n\t/**\n\t * The cell's edge borders (`a:tcPr/a:lnL|lnR|lnT|lnB|lnTlToBr|lnBlToTr`), or\n\t * `null` when the cell defines none. Each present edge decodes to a\n\t * {@link CellBorder} (width / dash / resolved + raw colour / suppressed flag);\n\t * absent edges are `null`. Cell borders are the biggest visible table gap — a\n\t * replica built only from geometry and fill draws every cell edge-to-edge with\n\t * no rule, so this surfaces the per-side stroke the writer's `border` option emits.\n\t */\n\tget borders(): CellBorders | null {\n\t\tconst tcPr = this.#tcPr()\n\t\tif (!tcPr) return null\n\t\tconst decode = (qname: string): CellBorder | null => {\n\t\t\tconst ln = firstChild(tcPr, qname)\n\t\t\tif (!ln) return null\n\t\t\tconst w = intValue(attr(ln, 'w'))\n\t\t\tconst dash = firstChild(ln, 'a:prstDash')\n\t\t\tconst scheme = this.#fillSchemeColorOf(ln)\n\t\t\tconst resolved = this.themeColors ? resolveSolidFillColor(ln, this.themeColors) : null\n\t\t\treturn {\n\t\t\t\twidthPt: w === null ? null : w / 12700,\n\t\t\t\tdash: dash ? (attr(dash, 'val') ?? null) : null,\n\t\t\t\tcolor: resolved ? resolved.effectiveHex : null,\n\t\t\t\tschemeColor: scheme,\n\t\t\t\tnoFill: !!firstChild(ln, 'a:noFill'),\n\t\t\t}\n\t\t}\n\t\tconst borders: CellBorders = {\n\t\t\tleft: decode('a:lnL'),\n\t\t\tright: decode('a:lnR'),\n\t\t\ttop: decode('a:lnT'),\n\t\t\tbottom: decode('a:lnB'),\n\t\t\ttlToBr: decode('a:lnTlToBr'),\n\t\t\tblToTr: decode('a:lnBlToTr'),\n\t\t}\n\t\treturn Object.values(borders).some((b) => b !== null) ? borders : null\n\t}\n\n\t/** The `schemeClr` token of a container's solid fill (`a:solidFill/a:schemeClr/@val`), or `null`. */\n\t#fillSchemeColorOf(container: Element): string | null {\n\t\tconst fill = firstChild(container, 'a:solidFill')\n\t\tconst scheme = fill && firstChild(fill, 'a:schemeClr')\n\t\treturn scheme ? attr(scheme, 'val') : null\n\t}\n\n\t/**\n\t * The cell's text direction (`a:tcPr/@vert`), e.g. `vert270` for a bottom-to-top\n\t * vertical label, or `null` for default horizontal text.\n\t */\n\tget verticalText(): string | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn (tcPr && attr(tcPr, 'vert')) ?? null\n\t}\n\n\t/**\n\t * The cell's vertical text anchor (`a:tcPr/@anchor`): `t`/`ctr`/`b` (top/middle/\n\t * bottom), or `null` when unset (PowerPoint defaults to top).\n\t */\n\tget anchor(): string | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn (tcPr && attr(tcPr, 'anchor')) ?? null\n\t}\n\n\t/**\n\t * Whether the cell's whole text **block** is centred horizontally within it\n\t * (`a:tcPr/@anchorCtr`). `false` when unset — that is the schema default, and it is\n\t * what PowerPoint writes nothing for.\n\t *\n\t * Distinct from a paragraph's `align`, which decides where each *line* sits inside the\n\t * text block; this decides where the block sits inside the cell.\n\t */\n\tget anchorCtr(): boolean {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn tcPr ? attr(tcPr, 'anchorCtr') === '1' || attr(tcPr, 'anchorCtr') === 'true' : false\n\t}\n\n\t/**\n\t * The cell's 3-D bevel (`a:tcPr/a:cell3D`), or `null` when it has none.\n\t *\n\t * `CT_Cell3D` requires an `a:bevel`, so a present `cell3D` always reports a bevel;\n\t * `lightRig` is `null` when the cell leaves the scene lighting to the renderer. Sizes are\n\t * reported in **points** (the attributes are EMU), matching how the write option takes them.\n\t */\n\tget cell3D(): CellThreeD | null {\n\t\tconst tcPr = this.#tcPr()\n\t\tconst cell3D = tcPr && firstChild(tcPr, 'a:cell3D')\n\t\tif (!cell3D) return null\n\t\tconst bevel = firstChild(cell3D, 'a:bevel')\n\t\tconst rig = firstChild(cell3D, 'a:lightRig')\n\t\tconst pts = (value: string | null): number | null => {\n\t\t\tconst emu = intValue(value)\n\t\t\treturn emu === null ? null : emu / 12700\n\t\t}\n\t\treturn {\n\t\t\tmaterial: attr(cell3D, 'prstMaterial') ?? null,\n\t\t\tbevel: {\n\t\t\t\tpreset: bevel ? (attr(bevel, 'prst') ?? null) : null,\n\t\t\t\twidthPt: bevel ? pts(attr(bevel, 'w')) : null,\n\t\t\t\theightPt: bevel ? pts(attr(bevel, 'h')) : null,\n\t\t\t},\n\t\t\tlightRig: rig ? { rig: attr(rig, 'rig') ?? null, dir: attr(rig, 'dir') ?? null } : null,\n\t\t}\n\t}\n\n\t/**\n\t * The cell's unique identifier (`a:tc/@id`), or `null` when it has none.\n\t *\n\t * This is what {@link headerIds} references: a data cell names the header cells that\n\t * govern it by their `@id`, which is how a complex table tells a screen reader what a\n\t * value means. Unrelated to the shape-level `p:cNvPr/@id` — it is an `xs:string` scoped\n\t * to the table, not a slide-wide numeric id.\n\t *\n\t * **PowerPoint does not write this and strips it on save**, so it will read `null` on\n\t * any deck PowerPoint has saved, however it was produced. It is surfaced for decks from\n\t * other producers. There is deliberately no write-API counterpart — see\n\t * `test/read/fixtures/authoring/probe-table-cell-a11y-and-3d.ps1` for the measurement.\n\t */\n\tget id(): string | null {\n\t\treturn attr(this.tc, 'id') ?? null\n\t}\n\n\t/**\n\t * The `@id`s of the header cells that govern this cell\n\t * (`a:tcPr/a:headers/a:header/@val`), in document order. Empty when the cell declares no\n\t * header association — which is the common case, since only a complex table needs one.\n\t *\n\t * Carries the same caveat as {@link id}: PowerPoint strips `a:headers` on save, so this\n\t * is empty on any PowerPoint-saved deck. `Table.firstRowHeader` (`a:tblPr/@firstRow`) is\n\t * the header marker PowerPoint does keep.\n\t */\n\tget headerIds(): string[] {\n\t\tconst tcPr = this.#tcPr()\n\t\tconst headers = tcPr && firstChild(tcPr, 'a:headers')\n\t\tif (!headers) return []\n\t\treturn getElements(headers, 'a:header')\n\t\t\t.map((header) => attr(header, 'val'))\n\t\t\t.filter((val): val is string => val !== null && val !== '')\n\t}\n\n\t/**\n\t * How the cell treats a glyph too wide for its text width (`a:tcPr/@horzOverflow`):\n\t * `'clip'` cuts it at the cell edge, `'overflow'` lets it draw past. `null` when unset\n\t * (PowerPoint clips). Not a wrap flag — cell text always wraps to the column width.\n\t */\n\tget horzOverflow(): string | null {\n\t\tconst tcPr = this.#tcPr()\n\t\treturn (tcPr && attr(tcPr, 'horzOverflow')) ?? null\n\t}\n\n\t/**\n\t * The cell's text insets in EMU (`a:tcPr/@marL`/`@marR`/`@marT`/`@marB`), or\n\t * `null` when the cell sets none. Each side is `null` when only some are set.\n\t */\n\tget marginsEmu(): { left: number | null; right: number | null; top: number | null; bottom: number | null } | null {\n\t\tconst tcPr = this.#tcPr()\n\t\tif (!tcPr) return null\n\t\tconst left = intValue(attr(tcPr, 'marL'))\n\t\tconst right = intValue(attr(tcPr, 'marR'))\n\t\tconst top = intValue(attr(tcPr, 'marT'))\n\t\tconst bottom = intValue(attr(tcPr, 'marB'))\n\t\tif (left === null && right === null && top === null && bottom === null) return null\n\t\treturn { left, right, top, bottom }\n\t}\n\n\t/** Number of grid columns this cell spans (`a:tc/@gridSpan`), default 1. */\n\tget gridSpan(): number {\n\t\treturn intValue(attr(this.tc, 'gridSpan')) ?? 1\n\t}\n\n\t/** Number of rows this cell spans (`a:tc/@rowSpan`), default 1. */\n\tget rowSpan(): number {\n\t\treturn intValue(attr(this.tc, 'rowSpan')) ?? 1\n\t}\n\n\t/** Whether this cell is a continuation of a merge (`@hMerge` or `@vMerge`), i.e. not the merge origin. */\n\tget isMergeContinuation(): boolean {\n\t\treturn attr(this.tc, 'hMerge') === '1' || attr(this.tc, 'vMerge') === '1'\n\t}\n\n\t/** Escape hatch: the underlying `a:tc` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */\n\tget element_(): Element {\n\t\treturn this.tc\n\t}\n\n\t/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */\n\tmarkDirty(): void {\n\t\tthis.part.markDirty()\n\t}\n}\n","/**\n * A graphic frame (`p:graphicFrame`) — the host element for a table, a chart, or a chartEx chart.\n *\n * Which one it holds is told by the `a:graphicData/@uri`, so the accessors below each check that\n * URI before wrapping the payload; `graphicDataUri` is there for the frames this library does not\n * model (SmartArt, OLE, ink), which read as a frame with no table and no chart.\n */\n\nimport { attr, firstChild, getOrAddChild, type Element } from '../../oxml/dom.js'\nimport { Chart } from '../chart.js'\nimport { ChartEx } from '../chartex.js'\nimport { Table } from '../table.js'\nimport { Shape } from './base.js'\nimport type { ShapeProperties } from './oxml.js'\nimport { UnsupportedFeatureError } from '../../../errors.js'\n\nconst A_TABLE_URI = 'http://schemas.openxmlformats.org/drawingml/2006/table'\nconst A_CHART_URI = 'http://schemas.openxmlformats.org/drawingml/2006/chart'\n// chartEx (Office-2016 chart family) graphicData URI + `cx:chart` reference child namespace.\nconst A_CHARTEX_URI = 'http://schemas.microsoft.com/office/drawing/2014/chartex'\n\n/** A graphic frame (`p:graphicFrame`) — host for tables and charts. */\nexport class GraphicFrame extends Shape {\n\treadonly shapeType = 'graphicFrame' as const\n\n\tprotected xfrm(): Element | null {\n\t\t// graphicFrame carries its own `p:xfrm` directly, not inside `p:spPr`.\n\t\treturn firstChild(this.element, 'p:xfrm')\n\t}\n\n\tprotected getOrAddXfrm(): Element {\n\t\t// p:xfrm sits between p:nvGraphicFramePr and a:graphic.\n\t\treturn getOrAddChild(this.element, 'p:xfrm', ['a:graphic', 'p:extLst'])\n\t}\n\n\t// A graphicFrame has no p:spPr; its hosted table/chart carries its own fill\n\t// model. There is nothing to get-or-add, so fill and line setters reject it.\n\tprotected override getOrAddProperties(): ShapeProperties {\n\t\tthrow new UnsupportedFeatureError(\n\t\t\t'shape/shape-properties-unsupported',\n\t\t\t'graphicFrame shapes have no shape properties; fill and line colours are not supported'\n\t\t)\n\t}\n\n\t/** Whether this frame hosts a table (`a:graphicData/@uri` is the table URI). */\n\tget hasTable(): boolean {\n\t\treturn this.#graphicDataUri() === A_TABLE_URI\n\t}\n\n\t/** Whether this frame hosts a classic chart (`a:graphicData/@uri` is the chart URI). */\n\tget hasChart(): boolean {\n\t\treturn this.#graphicDataUri() === A_CHART_URI\n\t}\n\n\t/** Whether this frame hosts a chartEx chart (`a:graphicData/@uri` is the chartEx URI). */\n\tget hasChartEx(): boolean {\n\t\treturn this.#graphicDataUri() === A_CHARTEX_URI\n\t}\n\n\t/** The hosted table, or `null` when this frame is not a table. */\n\tget table(): Table | null {\n\t\tif (!this.hasTable) return null\n\t\tconst graphicData = this.#graphicData()\n\t\tconst tbl = graphicData && firstChild(graphicData, 'a:tbl')\n\t\tif (!tbl) return null\n\t\treturn new Table(tbl, this.host.part, this.host.themeContext(), this.host.opc, this.host.relationships)\n\t}\n\n\t/** The hosted chart, or `null` when this frame is not a chart or its part is missing. */\n\tget chart(): Chart | null {\n\t\tif (!this.hasChart) return null\n\t\tconst graphicData = this.#graphicData()\n\t\tconst chartRef = graphicData && firstChild(graphicData, 'c:chart')\n\t\tconst relId = chartRef && attr(chartRef, 'r:id')\n\t\tif (!relId) return null\n\t\tconst partName = this.host.relationships.resolveTarget(relId)\n\t\tconst part = this.host.opc.part(partName)\n\t\treturn part ? new Chart(part) : null\n\t}\n\n\t/**\n\t * The hosted chartEx chart (waterfall/funnel/treemap/…), or `null` when this\n\t * frame is not a chartEx chart or its part is missing. The reference child is\n\t * `cx:chart` (not the classic `c:chart`), carrying the MS `chartEx` rel id.\n\t */\n\tget chartEx(): ChartEx | null {\n\t\tif (!this.hasChartEx) return null\n\t\tconst graphicData = this.#graphicData()\n\t\tconst chartRef = graphicData && firstChild(graphicData, 'cx:chart')\n\t\tconst relId = chartRef && attr(chartRef, 'r:id')\n\t\tif (!relId) return null\n\t\tconst partName = this.host.relationships.resolveTarget(relId)\n\t\tconst part = this.host.opc.part(partName)\n\t\treturn part ? new ChartEx(part) : null\n\t}\n\n\t#graphicData(): Element | null {\n\t\tconst graphic = firstChild(this.element, 'a:graphic')\n\t\treturn graphic ? firstChild(graphic, 'a:graphicData') : null\n\t}\n\n\t#graphicDataUri(): string | null {\n\t\tconst graphicData = this.#graphicData()\n\t\treturn graphicData ? attr(graphicData, 'uri') : null\n\t}\n}\n","/**\n * Read-model proxies for the shapes in a `p:spTree`.\n *\n * The `p:spTree` holds five shape kinds; each wraps its element and exposes\n * non-visual identity (id/name), geometry (left/top/width/height in EMU), and\n * kind-specific reads. Proxies hold a back-reference to the owning\n * {@link ShapeHost} — the slide, layout, or master whose part carries the tree —\n * so pictures can resolve their image relationship and so edits can mark that\n * part dirty.\n *\n * This module is the entry point for that model: the `Shape` base and the four leaf kinds live in\n * `./shapes/`, and only the dispatch that turns an element into a proxy — plus `GroupShape`, which\n * recurses back through it — is here. Everything the read API surfaces is re-exported below, so\n * `ts-pptx/read` and its consumers keep importing shapes from one place.\n */\nimport { ELEMENT_NODE, OOXML_NS, firstChild, getElements, getOrAddChild, type Element } from '../oxml/dom.js'\nimport { GRPSPPR_AFTER_XFRM, GRPSPPR_FILL_AFTER, type ShapeProperties } from './shapes/oxml.js'\nimport { readBox } from './shapes/geometry.js'\nimport type { ChildFrame } from './shapes/types.js'\nimport { Shape } from './shapes/base.js'\nimport { AutoShape } from './shapes/autoshape.js'\nimport { Picture } from './shapes/picture.js'\nimport { Connector } from './shapes/connector.js'\nimport { GraphicFrame } from './shapes/graphic-frame.js'\nimport type { ShapeHost } from './shapes/host.js'\n\nexport { Shape } from './shapes/base.js'\nexport type { ShapeHost } from './shapes/host.js'\nexport { AutoShape } from './shapes/autoshape.js'\nexport { Picture } from './shapes/picture.js'\nexport { Connector } from './shapes/connector.js'\nexport { GraphicFrame } from './shapes/graphic-frame.js'\n\n// Re-exported so `ts-pptx/read` keeps surfacing the gradient types from here even\n// though their definitions moved to ./gradient.js (shared with the slide-background reader).\nexport type { GradientStop, GradientFill } from './gradient.js'\nexport type { PictureFill, PictureFillTile, FillRect } from './picture-fill.js'\n// Likewise for the shape value types, whose definitions live in ./shapes/types.js.\nexport type {\n\tAbsoluteFrame,\n\tChildFrame,\n\tConnectionSite,\n\tCustomGeometry,\n\tCustomGeometryPath,\n\tGeometryCommand,\n\tGlow,\n\tInnerShadow,\n\tLineEnd,\n\tLineEnds,\n\tOuterShadow,\n\tPatternFill,\n\tRecolor,\n\tRecolorColor,\n\tReflection,\n\tShapeType,\n\tSoftEdge,\n} from './shapes/types.js'\n\n/**\n * A group shape (`p:grpSp`) — contains nested shapes.\n *\n * It is the one kind defined here rather than under `./shapes/`: its `shapes` getter recurses\n * through `buildShapes` below, so putting it in a sibling module would make the dispatch and the\n * group import each other.\n */\nexport class GroupShape extends Shape {\n\treadonly shapeType = 'group' as const\n\n\tprotected xfrm(): Element | null {\n\t\tconst grpSpPr = firstChild(this.element, 'p:grpSpPr')\n\t\treturn grpSpPr ? firstChild(grpSpPr, 'a:xfrm') : null\n\t}\n\n\tprotected getOrAddXfrm(): Element {\n\t\treturn getOrAddChild(this.#getOrAddGrpSpPr(), 'a:xfrm', GRPSPPR_AFTER_XFRM)\n\t}\n\n\tprotected override properties(): Element | null {\n\t\treturn firstChild(this.element, 'p:grpSpPr')\n\t}\n\n\t// A group's fill lives in p:grpSpPr, which has no a:ln (no line colour).\n\tprotected override getOrAddProperties(): ShapeProperties {\n\t\treturn { props: this.#getOrAddGrpSpPr(), fillAfter: GRPSPPR_FILL_AFTER, lnAfter: null }\n\t}\n\n\t#getOrAddGrpSpPr(): Element {\n\t\treturn getOrAddChild(this.element, 'p:grpSpPr', ['p:sp', 'p:grpSp', 'p:pic', 'p:cxnSp', 'p:graphicFrame'])\n\t}\n\n\t/**\n\t * The group's own child coordinate space (`p:grpSpPr/a:xfrm/a:chOff` and\n\t * `a:chExt`) in EMU, or `null` when the group has no transform or either\n\t * element is incomplete.\n\t *\n\t * Most consumers should not need this: {@link Shape.absoluteFrame} already\n\t * composes the whole ancestor chain — child space, group flips and rotations —\n\t * and doing that arithmetic per consumer is how a shape in a nested group ends\n\t * up subtly displaced. It is here for a *replica* consumer rather than a\n\t * *paint* one: rebuilding this group and its children as OOXML needs the\n\t * source child space to reproduce the scaling, and without it only groups whose\n\t * child space is the identity can be rebuilt.\n\t */\n\tget childFrame(): ChildFrame | null {\n\t\tconst xfrm = this.xfrm()\n\t\tconst box = xfrm && readBox(xfrm, 'a:chOff', 'a:chExt')\n\t\tif (!box) return null\n\t\treturn { offsetX: box.x, offsetY: box.y, extentX: box.cx, extentY: box.cy }\n\t}\n\n\t/** The shapes nested directly inside this group, in document order. */\n\tget shapes(): AnyShape[] {\n\t\treturn buildShapes(this.element, this.host)\n\t}\n}\n\n/**\n * The concrete shape kinds as a discriminated union keyed on the\n * {@link Shape.shapeType} literal. The read API (`Slide.shapes`,\n * `Slide.shapeById`, `GroupShape.shapes`, `Presentation.importShape`, …) returns\n * this rather than the abstract {@link Shape} base, so a consumer can narrow to a\n * subtype by its discriminant and reach the subtype-only members — e.g.\n * `if (shape.shapeType === 'graphicFrame') shape.chart` or, equivalently, the\n * {@link isGraphicFrame} guard. The abstract {@link Shape} base is still exported\n * for the \"common members only\" case and for `instanceof` checks.\n */\nexport type AnyShape = AutoShape | Picture | Connector | GraphicFrame | GroupShape\n\n/** Narrow a shape to an {@link AutoShape} (`p:sp` — auto shape, text box, or placeholder). */\nexport function isAutoShape(shape: Shape): shape is AutoShape {\n\treturn shape.shapeType === 'autoShape'\n}\n\n/** Narrow a shape to a {@link Picture} (`p:pic`). */\nexport function isPicture(shape: Shape): shape is Picture {\n\treturn shape.shapeType === 'picture'\n}\n\n/** Narrow a shape to a {@link Connector} (`p:cxnSp`). */\nexport function isConnector(shape: Shape): shape is Connector {\n\treturn shape.shapeType === 'connector'\n}\n\n/** Narrow a shape to a {@link GraphicFrame} (`p:graphicFrame` — table/chart host). */\nexport function isGraphicFrame(shape: Shape): shape is GraphicFrame {\n\treturn shape.shapeType === 'graphicFrame'\n}\n\n/** Narrow a shape to a {@link GroupShape} (`p:grpSp`). */\nexport function isGroupShape(shape: Shape): shape is GroupShape {\n\treturn shape.shapeType === 'group'\n}\n\n/**\n * Wrap a single shape-tree element (`p:sp`/`p:pic`/`p:cxnSp`/`p:graphicFrame`/\n * `p:grpSp`) in its concrete `Shape` proxy, or `null` if it is not a shape kind\n * (e.g. `p:nvGrpSpPr`, `p:grpSpPr`, `p:extLst`).\n */\nexport function wrapShapeElement(element: Element, host: ShapeHost): AnyShape | null {\n\tif (element.namespaceURI !== OOXML_NS.p) return null\n\tswitch (element.localName) {\n\t\tcase 'sp':\n\t\t\treturn new AutoShape(element, host)\n\t\tcase 'pic':\n\t\t\treturn new Picture(element, host)\n\t\tcase 'cxnSp':\n\t\t\treturn new Connector(element, host)\n\t\tcase 'graphicFrame':\n\t\t\treturn new GraphicFrame(element, host)\n\t\tcase 'grpSp':\n\t\t\treturn new GroupShape(element, host)\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\n/**\n * The richer of an `mc:AlternateContent`'s two branches: the first `mc:Choice`\n * that carries a shape element (what PowerPoint renders when it understands the\n * required feature), falling back to `mc:Fallback`. PowerPoint wraps a shape this\n * way when its full form needs a feature namespace a plain consumer lacks — a\n * chartEx chart's `p:graphicFrame`, a zoom frame, an inline-math shape. Returns\n * the wrapped inner shape, or `null` when neither branch holds one.\n */\nfunction unwrapAlternateContent(altContent: Element, host: ShapeHost): AnyShape | null {\n\tconst branches = [...getElements(altContent, 'mc:Choice'), ...getElements(altContent, 'mc:Fallback')]\n\tfor (const branch of branches) {\n\t\tfor (let node = branch.firstChild; node; node = node.nextSibling) {\n\t\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\t\tconst shape = wrapShapeElement(node as Element, host)\n\t\t\tif (shape) return shape\n\t\t}\n\t}\n\treturn null\n}\n\n/**\n * Build shape proxies for the shape-tree children of `parent` (a `p:spTree` or\n * `p:grpSp`), skipping non-shape children (`p:nvGrpSpPr`, `p:grpSpPr`, …). An\n * `mc:AlternateContent` wrapper (chartEx charts, zoom frames, inline math) is\n * unwrapped to the shape inside its preferred branch.\n */\nexport function buildShapes(parent: Element, host: ShapeHost): AnyShape[] {\n\tconst shapes: AnyShape[] = []\n\tfor (let node = parent.firstChild; node; node = node.nextSibling) {\n\t\tif (node.nodeType !== ELEMENT_NODE) continue\n\t\tconst element = node as Element\n\t\tif (element.namespaceURI === OOXML_NS.mc && element.localName === 'AlternateContent') {\n\t\t\tconst unwrapped = unwrapAlternateContent(element, host)\n\t\t\tif (unwrapped) shapes.push(unwrapped)\n\t\t\tcontinue\n\t\t}\n\t\tconst shape = wrapShapeElement(element, host)\n\t\tif (shape) shapes.push(shape)\n\t}\n\treturn shapes\n}\n\n/**\n * The first shape in `shapes` with the given drawing id (`p:cNvPr/@id`), walked\n * pre-order so a group is visited before its children. Backs\n * {@link ShapeHost.shapeByIdDeep} on all three hosts — drawing ids are unique\n * within a part, so the first match is the only match and the walk order just\n * fixes a deterministic one.\n */\nexport function findShapeByIdDeep(shapes: AnyShape[], id: number): AnyShape | undefined {\n\tfor (const shape of shapes) {\n\t\tif (shape.id === id) return shape\n\t\tif (shape instanceof GroupShape) {\n\t\t\tconst found = findShapeByIdDeep(shape.shapes, id)\n\t\t\tif (found) return found\n\t\t}\n\t}\n\treturn undefined\n}\n"],"mappings":";;;;;AAyBA,SAAgB,SAAS,KAAuB;CAC/C,OAAO,IAAI,UAAU,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,KAAK,UAAU,QAAQ;AAC9F;;;;;;AAOA,SAAgB,aAAa,KAAuB;CACnD,OAAO,IAAI,cAAc,CAAC,CAAC,kBAAkB,GAAG;AACjD;;AAGA,MAAa,WAAW,OAAO,OAAO;CACrC,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,SAAS;CACT,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,KAAK;CACL,MAAM;CACN,IAAI;CACJ,GAAG;AACJ,CAAC;AASD,SAAS,WAAW,OAA+C;CAClE,MAAM,QAAQ,MAAM,QAAQ,GAAG;CAC/B,IAAI,QAAQ,GACX,MAAM,IAAI,mBAAmB,sBAAsB,gDAAgD,OAAO;CAC3G,MAAM,SAAS,MAAM,MAAM,GAAG,KAAK;CACnC,MAAM,MAAO,SAAoC;CACjD,IAAI,CAAC,KAAK,MAAM,IAAI,mBAAmB,iCAAiC,mCAAmC,QAAQ;CACnH,OAAO;EAAE;EAAK,OAAO,MAAM,MAAM,QAAQ,CAAC;CAAE;AAC7C;;;;;;AAOA,SAAgB,YAAY,QAAc,OAA0B;CACnE,MAAM,EAAE,KAAK,UAAU,WAAW,KAAK;CACvC,MAAM,MAAiB,CAAC;CACxB,KAAK,IAAI,OAAO,OAAO,YAAY,MAAM,OAAO,KAAK,aACpD,IAAI,KAAK,aAAA,GAA2B;EACnC,MAAM,UAAU;EAChB,IAAI,QAAQ,cAAc,SAAS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