🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@office-open/docx

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@office-open/docx - npm Package Compare versions

Comparing version
0.10.11
to
0.10.12
+479
dist/context-CiyAhqTX.mjs
import { F as extractStyleId, L as DefaultStylesFactory, Ln as Media, M as Styles, Tt as FontWrapper, rt as Numbering } from "./parts-B7Sfx_F0.mjs";
import { Relationships } from "@office-open/core";
import { js2xml, xml2js } from "@office-open/xml";
import { ChartCollection } from "@office-open/core/chart";
import { SmartArtCollection } from "@office-open/core/smartart";
//#region src/parts/alt-chunk/alt-chunk-collection.ts
/**
* Manages alternative format chunk parts in a document.
*
* Stores external content (HTML, RTF, plain text) that will be
* serialized into separate parts in the DOCX package.
*/
var AltChunkCollection = class {
map;
constructor() {
this.map = /* @__PURE__ */ new Map();
}
addAltChunk(key, data) {
this.map.set(key, data);
}
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/parts/sub-doc/sub-doc-collection.ts
/**
* Manages sub-document parts in a document.
*/
var SubDocCollection = class {
map;
constructor() {
this.map = /* @__PURE__ */ new Map();
}
addSubDoc(key, data) {
this.map.set(key, data);
}
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/parts/styles/external-styles-factory.ts
/**
* External styles factory module for WordprocessingML documents.
*
* Parses styles from external XML and returns raw XML strings.
* No XmlComponent dependency.
*
* Reference: http://officeopenxml.com/WPstyles.php
*
* @module
*/
/**
* Factory for creating styles from external XML sources.
*
* Parses styles from XML (typically from a styles.xml file)
* and returns raw XML strings for each style element.
*/
var ExternalStylesFactory = class {
/**
* Creates new Styles based on the given XML data.
*
* Parses the styles XML and converts each child to a raw XML string.
*/
newInstance(xmlData) {
const xmlObj = xml2js(xmlData, { compact: false });
let stylesXmlElement;
for (const xmlElm of xmlObj.elements || []) if (xmlElm.name === "w:styles") stylesXmlElement = xmlElm;
if (stylesXmlElement === void 0) return {
importedStyles: [],
initialAttributes: {}
};
return {
importedStyles: (stylesXmlElement.elements || []).map((childElm) => ({ _raw: js2xml({ elements: [childElm] }) })),
initialAttributes: stylesXmlElement.attributes ?? {}
};
}
};
//#endregion
//#region src/shared/embeddings/embeddings.ts
/**
* Collects OLE embeddings allocated during document generation. Each embedding
* is stored under a sequential `oleObjectN.bin` name in word/embeddings/,
* mirroring MS Office's numbering so output is deterministic and diffable.
*/
var EmbeddingCollection = class {
map = /* @__PURE__ */ new Map();
counter = 0;
/** Allocate the next sequential embedding file name (oleObject1.bin, …). */
nextEmbeddingName() {
return `oleObject${++this.counter}.bin`;
}
/** Register an embedding under a unique key. */
addEmbedding(key, data) {
this.map.set(key, data);
}
/** All registered embeddings in insertion order. */
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/context.ts
/**
* DOCX compilation context.
*
* DocxWriteContext holds all mutable state needed during document compilation.
* generateDocument() creates a DocxWriteContext internally.
*
* @module
*/
/** User styles override factory defaults with the same styleId; keep the rest. */
function mergeById(factoryStyles, userStyles) {
const factory = factoryStyles ?? [];
if (!userStyles || userStyles.length === 0) return factory;
const userIds = new Set(userStyles.map((s) => s.id));
return [...factory.filter((s) => !userIds.has(s.id)), ...userStyles];
}
/**
* Highest comment id in an explicit comments list, or -1 when there are none.
* Seeds the comment id allocator so auto-allocated ids never collide with ids
* the caller already assigned (e.g. round-tripped from an existing document).
*/
function maxCommentId(comments) {
let max = -1;
if (comments) {
for (const c of comments) if (c.id > max) max = c.id;
}
return max;
}
/** Narrows an object to a `{ id: number }` marker without an `as` cast. */
function isNumericIdMarker(value) {
return typeof value === "object" && value !== null && "id" in value && typeof value.id === "number";
}
/**
* Highest w:id among explicit bookmark + move-range start markers (`range`) and
* explicit movedFrom/movedTo runs (`moveRun`) anywhere in the body tree
* (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).
* Seeds the markup id allocators so `{ bookmark }` / `{ moveFrom }` / `{ moveTo }`
* sugars never collide with ids the caller already assigned. Comment ids live in
* their own namespace (comments.nextId) and are intentionally excluded.
*/
function collectMaxMarkupIds(value, acc) {
if (value === null || value === void 0 || typeof value !== "object") return;
if (value instanceof Uint8Array || value instanceof Date) return;
if (Array.isArray(value)) {
for (const item of value) collectMaxMarkupIds(item, acc);
return;
}
const obj = value;
const rangeMarker = obj.bookmarkStart ?? obj.moveFromRangeStart ?? obj.moveToRangeStart;
if (isNumericIdMarker(rangeMarker) && rangeMarker.id > acc.range) acc.range = rangeMarker.id;
const moveRun = obj.movedFrom ?? obj.movedTo;
if (isNumericIdMarker(moveRun) && moveRun.id > acc.moveRun) acc.moveRun = moveRun.id;
for (const key of Object.keys(obj)) collectMaxMarkupIds(obj[key], acc);
}
/**
* Whether any `{ comment }` sugar child appears anywhere in the body tree
* (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).
* The document→comments relationship must exist whenever comments.xml will be
* generated; since sugar entries are registered during stringify — after the
* constructor wires relationships — this pre-scan predicts them so the part and
* its relationship stay in sync (OPC consistency). Every `{ comment }` always
* stringifies, so the prediction matches the entries actually registered.
*/
function bodyContainsCommentSugar(value) {
if (value === null || value === void 0) return false;
if (typeof value !== "object") return false;
if (value instanceof Uint8Array || value instanceof Date) return false;
if (Array.isArray(value)) {
for (const item of value) if (bodyContainsCommentSugar(item)) return true;
return false;
}
const obj = value;
if (typeof obj.comment === "object" && obj.comment !== null) return true;
for (const key of Object.keys(obj)) if (bodyContainsCommentSugar(obj[key])) return true;
return false;
}
var DocxWriteContext = class {
_currentRelationshipId = 1;
_sectionProperties = [];
get sectionProperties() {
return this._sectionProperties;
}
_hasFootnotes;
_hasEndnotes;
_hasNumbering;
get hasFootnotes() {
return this._hasFootnotes;
}
get hasEndnotes() {
return this._hasEndnotes;
}
get hasNumbering() {
return this._hasNumbering;
}
addRelationship(_type, _target, _mode) {
return `rId${this._currentRelationshipId++}`;
}
addMedia(data, type) {
return `{${this.media.addMedia(data, type, (fileName) => ({
data,
fileName,
type,
transformation: {
pixels: {
x: 0,
y: 0
},
emus: {
x: 0,
y: 0
}
}
})).fileName}}`;
}
_headers = [];
_footers = [];
constructor(options) {
this._options = options;
this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
this.comments = {
relationships: new Relationships(),
entries: [],
nextId: maxCommentId(options.comments?.children) + 1
};
const markupSeed = {
range: -1,
moveRun: -1
};
collectMaxMarkupIds(options.sections, markupSeed);
this.markupIds = {
rangeNext: markupSeed.range + 1,
moveRunNext: markupSeed.moveRun + 1
};
this.fileRelationships = new Relationships();
this.footNotes = {
relationships: new Relationships(),
notes: /* @__PURE__ */ new Map()
};
this.endnotes = {
relationships: new Relationships(),
notes: /* @__PURE__ */ new Map()
};
this.document = { relationships: new Relationships() };
this._settingsOptions = {
compatibility: options.compatibility,
compatibilityModeVersion: options.compatabilityModeVersion,
defaultTabStop: options.defaultTabStop,
evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
characterSpacingControl: options.characterSpacingControl,
hyphenation: {
autoHyphenation: options.hyphenation?.autoHyphenation,
consecutiveHyphenLimit: options.hyphenation?.consecutiveHyphenLimit,
doNotHyphenateCaps: options.hyphenation?.doNotHyphenateCaps,
hyphenationZone: options.hyphenation?.hyphenationZone
},
trackRevisions: options.features?.trackRevisions,
updateFields: options.features?.updateFields,
documentProtection: options.features?.documentProtection,
view: options.view,
zoom: options.zoom,
writeProtection: options.writeProtection,
displayBackgroundShape: options.displayBackgroundShape ?? (options.background?.image ? true : void 0),
embedTrueTypeFonts: options.embedTrueTypeFonts,
embedSystemFonts: options.embedSystemFonts,
saveSubsetFonts: options.saveSubsetFonts,
docVars: options.docVars,
colorSchemeMapping: options.colorSchemeMapping,
mailMerge: options.mailMerge,
...options.settings
};
this.media = new Media();
this.charts = new ChartCollection();
this.smartArts = new SmartArtCollection();
this.embeddings = new EmbeddingCollection();
this.altChunks = new AltChunkCollection();
this.subDocs = new SubDocCollection();
if (options.externalStyles !== void 0) {
const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);
const defaultStyles = new DefaultStylesFactory().newInstance(options.styles?.default ?? {});
const externalIds = /* @__PURE__ */ new Set();
for (const s of externalStyles.importedStyles ?? []) {
const id = extractStyleId(s._raw);
if (id) externalIds.add(id);
}
const notInExternal = (arr) => (arr ?? []).filter((s) => !externalIds.has(s.id));
this.styles = new Styles({
importedStyles: externalStyles.importedStyles,
initialAttributes: externalStyles.initialAttributes ?? defaultStyles.initialAttributes,
paragraphStyles: notInExternal(defaultStyles.paragraphStyles),
characterStyles: notInExternal(defaultStyles.characterStyles),
tableStyles: notInExternal(defaultStyles.tableStyles),
numberingStyles: notInExternal(defaultStyles.numberingStyles)
});
} else if (options.styles) {
const s = options.styles;
if (s.roundTripped) {
const f = new DefaultStylesFactory().newInstance({});
const docDefaults = s.docDefaultsXml ?? f.importedStyles?.[0]?._raw ?? "";
const latentStyles = s.latentStylesXml ?? f.importedStyles?.[1]?._raw ?? "";
this.styles = new Styles({
importedStyles: [{ _raw: docDefaults }, { _raw: latentStyles }],
initialAttributes: s.initialAttributes ?? f.initialAttributes,
paragraphStyles: s.paragraphStyles,
characterStyles: s.characterStyles,
tableStyles: s.tableStyles,
numberingStyles: s.numberingStyles
});
} else {
const f = new DefaultStylesFactory().newInstance(s.default);
this.styles = new Styles({
importedStyles: f.importedStyles,
initialAttributes: s.initialAttributes ?? f.initialAttributes,
paragraphStyles: mergeById(f.paragraphStyles, s.paragraphStyles),
characterStyles: mergeById(f.characterStyles, s.characterStyles),
tableStyles: mergeById(f.tableStyles, s.tableStyles),
numberingStyles: mergeById(f.numberingStyles, s.numberingStyles)
});
}
} else {
const stylesFactory = new DefaultStylesFactory();
this.styles = new Styles(stylesFactory.newInstance());
}
if (options.styles?.paragraphStyles) for (const style of options.styles.paragraphStyles) {
const num = style.paragraph?.numbering;
if (num) this.numbering.createConcreteNumberingInstance(num.reference, num.instance ?? 0);
}
const sourceOverrides = options.contentTypes?.overrides ?? [];
this._hasFootnotes = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/footnotes.xml");
this._hasEndnotes = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/endnotes.xml");
this._hasNumbering = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/numbering.xml");
this.addDefaultRelationships();
for (const section of options.sections) this.addSection(section);
if (options.footnotes) {
for (const key in options.footnotes) {
if (key === "separator" || key === "continuationSeparator") continue;
this.footNotes.notes.set(parseFloat(key), options.footnotes[key].children);
}
this.footNotes.separator = options.footnotes.separator;
this.footNotes.continuationSeparator = options.footnotes.continuationSeparator;
}
if (options.endnotes) {
for (const key in options.endnotes) {
if (key === "separator" || key === "continuationSeparator") continue;
this.endnotes.notes.set(parseFloat(key), options.endnotes[key].children);
}
this.endnotes.separator = options.endnotes.separator;
this.endnotes.continuationSeparator = options.endnotes.continuationSeparator;
}
this.fontTable = new FontWrapper(options.fonts ?? []);
this.glossaryOptions = options.glossary;
this.webSettings = options.webSettings ?? void 0;
if (options.glossary) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument", "glossary/document.xml");
if (this.webSettings) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", "webSettings.xml");
}
get headers() {
return this._headers;
}
get footers() {
return this._footers;
}
addSection({ headers = {}, footers = {}, properties }) {
const sectPrOptions = {
...properties,
footerWrapperGroup: {
default: footers.default ? this.createFooter(footers.default) : void 0,
even: footers.even ? this.createFooter(footers.even) : void 0,
first: footers.first ? this.createFooter(footers.first) : void 0
},
headerWrapperGroup: {
default: headers.default ? this.createHeader(headers.default) : void 0,
even: headers.even ? this.createHeader(headers.even) : void 0,
first: headers.first ? this.createHeader(headers.first) : void 0
}
};
this._sectionProperties.push(sectPrOptions);
}
createHeader(header) {
const referenceId = this._currentRelationshipId++;
const entry = {
children: header,
relationships: new Relationships(),
referenceId
};
this.addHeaderToDocument(entry);
return entry;
}
createFooter(footer) {
const referenceId = this._currentRelationshipId++;
const entry = {
children: footer,
relationships: new Relationships(),
referenceId
};
this.addFooterToDocument(entry);
return entry;
}
addHeaderToDocument(header) {
this._headers.push(header);
this.document.relationships.addRelationship(header.referenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", `header${this._headers.length}.xml`);
}
addFooterToDocument(footer) {
this._footers.push(footer);
this.document.relationships.addRelationship(footer.referenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", `footer${this._footers.length}.xml`);
}
addDefaultRelationships() {
this.fileRelationships.addRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "word/document.xml");
this.fileRelationships.addRelationship(2, "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", "docProps/core.xml");
this.fileRelationships.addRelationship(3, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", "docProps/app.xml");
this.fileRelationships.addRelationship(4, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties", "docProps/custom.xml");
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml");
if (this._hasNumbering) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", "numbering.xml");
if (this._hasFootnotes) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", "footnotes.xml");
if (this._hasEndnotes) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", "endnotes.xml");
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", "settings.xml");
if (this._options.comments?.children?.length || bodyContainsCommentSugar(this._options.sections)) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", "comments.xml");
if (this._options.bibliography) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography", "bibliography.xml");
const themePart = this._options.rawParts?.find((p) => p.path.startsWith("word/theme/"));
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", themePart ? themePart.path.replace(/^word\//, "") : "theme/theme1.xml");
for (const part of this._options.rawParts ?? []) if (part.path.startsWith("customXml/") && part.path.endsWith(".xml") && !part.path.includes("/_rels/") && !part.path.includes("itemProps")) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", `../${part.path}`);
}
};
/**
* DOCX-specific read context.
*
* Holds references to the parsed DocxDocument and cached style/numbering data
* used throughout the DOCX parsing pipeline. Implements ReadContext for
* descriptor pipeline compatibility.
*/
var DocxReadContext = class {
docx;
styleCache;
numberingCache;
/**
* Path of the part currently being parsed. Each part carries its own .rels
* with independent rId numbering, so drawings inside a part must resolve
* image relationships against that part's rels. Defaults to the document body.
*/
currentPart = "word/document.xml";
constructor(docx, styleCache, numberingCache) {
this.docx = docx;
this.styleCache = styleCache;
this.numberingCache = numberingCache;
}
resolveRelationship(rId) {
const partMedia = this.docx.partRefs.partMedia.get(this.currentPart);
if (partMedia) {
const media = partMedia.get(rId);
if (media) return media;
}
return this.docx.partRefs.headers.get(rId) ?? this.docx.partRefs.footers.get(rId) ?? this.docx.partRefs.media.get(rId) ?? this.docx.partRefs.charts.get(rId) ?? this.docx.partRefs.diagramData.get(rId) ?? this.docx.partRefs.afChunks.get(rId) ?? this.docx.partRefs.subDocs.get(rId) ?? this.docx.partRefs.hyperlinks.get(rId);
}
/**
* Run `fn` with `currentPart` temporarily set to `partPath`, restoring the
* previous value afterwards. Use when parsing a sub-document part (header,
* footer, footnotes, …) so its drawings resolve images from its own rels.
*/
withPart(partPath, fn) {
const prev = this.currentPart;
this.currentPart = partPath;
try {
return fn();
} finally {
this.currentPart = prev;
}
}
getPart(path) {
return this.docx.doc.get(path);
}
getRaw(path) {
return this.docx.doc.getRaw(path);
}
};
//#endregion
export { AltChunkCollection as i, DocxWriteContext as n, SubDocCollection as r, DocxReadContext as t };
//# sourceMappingURL=context-CiyAhqTX.mjs.map
{"version":3,"file":"context-CiyAhqTX.mjs","names":[],"sources":["../src/parts/alt-chunk/alt-chunk-collection.ts","../src/parts/sub-doc/sub-doc-collection.ts","../src/parts/styles/external-styles-factory.ts","../src/shared/embeddings/embeddings.ts","../src/context.ts"],"sourcesContent":["/**\n * AltChunk collection module for managing alternative format content parts.\n *\n * @module\n */\n\n/**\n * Stores alternative format chunk data for later serialization by the compiler.\n */\nexport interface AltChunkData {\n /** Unique key for this alt chunk (e.g., relId) */\n key: string;\n /** Raw content data */\n data: Uint8Array;\n /** Part sub-path within word/ (e.g., \"afchunks/afchunk1.html\") */\n path: string;\n /** File extension (e.g., \"html\", \"rtf\", \"txt\") */\n extension: string;\n /** MIME content type (e.g., \"text/html\", \"application/rtf\") */\n contentType: string;\n}\n\n/**\n * Manages alternative format chunk parts in a document.\n *\n * Stores external content (HTML, RTF, plain text) that will be\n * serialized into separate parts in the DOCX package.\n */\nexport class AltChunkCollection {\n private map: Map<string, AltChunkData>;\n\n public constructor() {\n this.map = new Map<string, AltChunkData>();\n }\n\n public addAltChunk(key: string, data: AltChunkData): void {\n this.map.set(key, data);\n }\n\n public get array(): AltChunkData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * Sub-document collection module for managing sub-document parts.\n *\n * @module\n */\n\n/**\n * Stores sub-document data for later serialization by the compiler.\n */\nexport interface SubDocData {\n /** Raw document data (.docx bytes) */\n data: Uint8Array;\n /** Part sub-path within word/ (e.g., \"subdocs/subdoc1.docx\") */\n path: string;\n}\n\n/**\n * Manages sub-document parts in a document.\n */\nexport class SubDocCollection {\n private map: Map<string, SubDocData>;\n\n public constructor() {\n this.map = new Map<string, SubDocData>();\n }\n\n public addSubDoc(key: string, data: SubDocData): void {\n this.map.set(key, data);\n }\n\n public get array(): SubDocData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * External styles factory module for WordprocessingML documents.\n *\n * Parses styles from external XML and returns raw XML strings.\n * No XmlComponent dependency.\n *\n * Reference: http://officeopenxml.com/WPstyles.php\n *\n * @module\n */\nimport { js2xml, xml2js } from \"@office-open/xml\";\nimport type { Element as XMLElement } from \"@office-open/xml\";\n\nimport type { StylesOptions } from \"./styles\";\n\n/**\n * Factory for creating styles from external XML sources.\n *\n * Parses styles from XML (typically from a styles.xml file)\n * and returns raw XML strings for each style element.\n */\nexport class ExternalStylesFactory {\n /**\n * Creates new Styles based on the given XML data.\n *\n * Parses the styles XML and converts each child to a raw XML string.\n */\n public newInstance(xmlData: string): StylesOptions {\n const xmlObj = xml2js(xmlData, { compact: false }) as XMLElement;\n\n let stylesXmlElement: XMLElement | undefined;\n for (const xmlElm of xmlObj.elements || []) {\n if (xmlElm.name === \"w:styles\") {\n stylesXmlElement = xmlElm;\n }\n }\n\n if (stylesXmlElement === undefined) {\n return { importedStyles: [], initialAttributes: {} };\n }\n\n const stylesElements = stylesXmlElement.elements || [];\n\n return {\n importedStyles: stylesElements.map((childElm) => ({\n _raw: js2xml({ elements: [childElm] }),\n })),\n initialAttributes: (stylesXmlElement.attributes as Record<string, string>) ?? {},\n };\n }\n}\n","/**\n * Embeddings module for WordprocessingML documents.\n *\n * Manages OLE object embeddings (word/embeddings/oleObjectN.bin) referenced by\n * w:object elements. Mirrors the Media collection pattern but targets binary\n * OLE container parts instead of images.\n *\n * @module\n */\n\n/** OLE embedding data stored under word/embeddings/. */\nexport interface EmbeddingData {\n /** File name within word/embeddings/ (e.g. \"oleObject1.bin\"). */\n fileName: string;\n /** Raw OLE container bytes. */\n data: Uint8Array;\n /** OLE program id (e.g. \"Excel.Sheet.12\") — informational only. */\n progId?: string;\n}\n\n/**\n * Collects OLE embeddings allocated during document generation. Each embedding\n * is stored under a sequential `oleObjectN.bin` name in word/embeddings/,\n * mirroring MS Office's numbering so output is deterministic and diffable.\n */\nexport class EmbeddingCollection {\n private map = new Map<string, EmbeddingData>();\n private counter = 0;\n\n /** Allocate the next sequential embedding file name (oleObject1.bin, …). */\n public nextEmbeddingName(): string {\n return `oleObject${++this.counter}.bin`;\n }\n\n /** Register an embedding under a unique key. */\n public addEmbedding(key: string, data: EmbeddingData): void {\n this.map.set(key, data);\n }\n\n /** All registered embeddings in insertion order. */\n public get array(): EmbeddingData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * DOCX compilation context.\n *\n * DocxWriteContext holds all mutable state needed during document compilation.\n * generateDocument() creates a DocxWriteContext internally.\n *\n * @module\n */\n\nimport { Relationships } from \"@office-open/core\";\nimport { ChartCollection } from \"@office-open/core/chart\";\nimport type { ReadContext, WriteContext } from \"@office-open/core/descriptor\";\nimport { SmartArtCollection } from \"@office-open/core/smartart\";\nimport type { Element } from \"@office-open/xml\";\nimport { AltChunkCollection } from \"@parts/alt-chunk/alt-chunk-collection\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport type { SectionPropertiesOptions } from \"@parts/document/body/section-properties/section-properties\";\nimport type { EndnoteSeparator } from \"@parts/endnotes/descriptor\";\nimport { FontWrapper } from \"@parts/fonts/font-wrapper\";\nimport type { FootnoteSeparator } from \"@parts/footnotes/descriptor\";\nimport type { GlossaryDocumentOptions } from \"@parts/glossary-document\";\nimport type { HeaderFooterEntry } from \"@parts/header-footer\";\nimport { Numbering } from \"@parts/numbering\";\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\nimport type { SettingsOptions } from \"@parts/settings/settings\";\nimport { Styles, extractStyleId } from \"@parts/styles\";\nimport { ExternalStylesFactory } from \"@parts/styles/external-styles-factory\";\nimport { DefaultStylesFactory } from \"@parts/styles/factory\";\nimport { SubDocCollection } from \"@parts/sub-doc/sub-doc-collection\";\nimport type { WebSettingsOptions } from \"@parts/web-settings\";\nimport { EmbeddingCollection } from \"@shared/embeddings/embeddings\";\nimport { Media } from \"@shared/media\";\nimport type { MediaData } from \"@shared/media/data\";\nimport type { SectionOptions } from \"@shared/section\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport type { DocxDocument } from \"./parse\";\n\n/** User styles override factory defaults with the same styleId; keep the rest. */\nfunction mergeById<T extends { id: string }>(\n factoryStyles: T[] | undefined,\n userStyles: T[] | undefined,\n): T[] {\n const factory = factoryStyles ?? [];\n if (!userStyles || userStyles.length === 0) return factory;\n const userIds = new Set(userStyles.map((s) => s.id));\n return [...factory.filter((s) => !userIds.has(s.id)), ...userStyles];\n}\n\n/**\n * Highest comment id in an explicit comments list, or -1 when there are none.\n * Seeds the comment id allocator so auto-allocated ids never collide with ids\n * the caller already assigned (e.g. round-tripped from an existing document).\n */\nfunction maxCommentId(comments: readonly CommentOptions[] | undefined): number {\n let max = -1;\n if (comments) {\n for (const c of comments) {\n if (c.id > max) max = c.id;\n }\n }\n return max;\n}\n\n/** Narrows an object to a `{ id: number }` marker without an `as` cast. */\nfunction isNumericIdMarker(value: unknown): value is { id: number } {\n return (\n typeof value === \"object\" && value !== null && \"id\" in value && typeof value.id === \"number\"\n );\n}\n\n/**\n * Highest w:id among explicit bookmark + move-range start markers (`range`) and\n * explicit movedFrom/movedTo runs (`moveRun`) anywhere in the body tree\n * (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).\n * Seeds the markup id allocators so `{ bookmark }` / `{ moveFrom }` / `{ moveTo }`\n * sugars never collide with ids the caller already assigned. Comment ids live in\n * their own namespace (comments.nextId) and are intentionally excluded.\n */\nfunction collectMaxMarkupIds(value: unknown, acc: { range: number; moveRun: number }): void {\n if (value === null || value === undefined || typeof value !== \"object\") return;\n if (value instanceof Uint8Array || value instanceof Date) return;\n if (Array.isArray(value)) {\n for (const item of value) collectMaxMarkupIds(item, acc);\n return;\n }\n const obj = value as Record<string, unknown>;\n const rangeMarker = obj.bookmarkStart ?? obj.moveFromRangeStart ?? obj.moveToRangeStart;\n if (isNumericIdMarker(rangeMarker) && rangeMarker.id > acc.range) acc.range = rangeMarker.id;\n const moveRun = obj.movedFrom ?? obj.movedTo;\n if (isNumericIdMarker(moveRun) && moveRun.id > acc.moveRun) acc.moveRun = moveRun.id;\n for (const key of Object.keys(obj)) collectMaxMarkupIds(obj[key], acc);\n}\n\n/**\n * Whether any `{ comment }` sugar child appears anywhere in the body tree\n * (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).\n * The document→comments relationship must exist whenever comments.xml will be\n * generated; since sugar entries are registered during stringify — after the\n * constructor wires relationships — this pre-scan predicts them so the part and\n * its relationship stay in sync (OPC consistency). Every `{ comment }` always\n * stringifies, so the prediction matches the entries actually registered.\n */\nfunction bodyContainsCommentSugar(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value !== \"object\") return false;\n if (value instanceof Uint8Array || value instanceof Date) return false;\n if (Array.isArray(value)) {\n for (const item of value) {\n if (bodyContainsCommentSugar(item)) return true;\n }\n return false;\n }\n const obj = value as Record<string, unknown>;\n if (typeof obj.comment === \"object\" && obj.comment !== null) return true;\n for (const key of Object.keys(obj)) {\n if (bodyContainsCommentSugar(obj[key])) return true;\n }\n return false;\n}\n\n/** Interface for document view wrappers — provides relationships access. */\nexport interface ViewWrapper {\n relationships: Relationships;\n}\n\n// ── BodyContext ──\n\n/**\n * Context for body-level stringification.\n *\n * Pure JSON pipeline context — extends WriteContext for descriptor compatibility.\n * No dependency on XmlComponent Context (compile/ uses zero toXml calls).\n */\nexport interface BodyContext extends WriteContext {\n /** The root write context with all mutable document state. */\n fileData: DocxWriteContext;\n /** Alias for fileData — some descriptor internals access context.file. */\n file: DocxWriteContext;\n /** Current view wrapper for relationship access. */\n viewWrapper: { relationships: Relationships };\n /** Stringify a body-level child element — injected to break circular imports. */\n stringifyChild: (child: SectionChild, ctx: BodyContext) => string;\n}\n\n// ── DocxWriteContext ──\n\nexport class DocxWriteContext implements WriteContext {\n private _currentRelationshipId = 1;\n\n // --- Accessed by XmlComponent via context.file.* during toXml() ---\n declare public document: { relationships: Relationships };\n declare public numbering: Numbering;\n declare public media: Media<MediaData>;\n declare public charts: ChartCollection;\n declare public smartArts: SmartArtCollection;\n declare public embeddings: EmbeddingCollection;\n declare public altChunks: AltChunkCollection;\n declare public subDocs: SubDocCollection;\n declare public comments: {\n relationships: Relationships;\n /** Comment entries registered by `{ comment }` sugar children during stringify. */\n entries: CommentOptions[];\n /** Next auto-allocated comment id (seeded above any explicit comment id). */\n nextId: number;\n };\n declare public markupIds: {\n /** Next id for bookmark + move-range markers (CT_MarkupRange) — shared, like Word. */\n rangeNext: number;\n /** Next id for movedFrom/movedTo runs (CT_TrackChange). */\n moveRunNext: number;\n };\n declare public footNotes: {\n relationships: Relationships;\n notes: Map<number, (ParagraphOptions | string)[]>;\n separator?: FootnoteSeparator;\n continuationSeparator?: FootnoteSeparator;\n };\n declare public endnotes: {\n relationships: Relationships;\n notes: Map<number, (ParagraphOptions | string)[]>;\n separator?: EndnoteSeparator;\n continuationSeparator?: EndnoteSeparator;\n };\n\n // --- Additional state used by the compiler ---\n declare public fileRelationships: Relationships;\n declare public _settingsOptions: SettingsOptions;\n declare public styles: Styles;\n declare public fontTable: FontWrapper;\n declare public glossaryOptions: GlossaryDocumentOptions | undefined;\n declare public webSettings: WebSettingsOptions | undefined;\n\n // --- Section properties (one per section, raw options for descriptor pipeline) ---\n private _sectionProperties: SectionPropertiesOptions[] = [];\n public get sectionProperties(): readonly SectionPropertiesOptions[] {\n return this._sectionProperties;\n }\n\n // Footnotes/endnotes are optional parts. Fresh compile always emits them\n // (Word ships a separators-only file); round-trip emits them only when the\n // source package declared the part — otherwise emitting the part + document\n // relationship without a [Content_Types] Override is an OPC violation that\n // makes Word reject the package as unreadable content.\n private readonly _hasFootnotes: boolean;\n private readonly _hasEndnotes: boolean;\n private readonly _hasNumbering: boolean;\n public get hasFootnotes(): boolean {\n return this._hasFootnotes;\n }\n public get hasEndnotes(): boolean {\n return this._hasEndnotes;\n }\n public get hasNumbering(): boolean {\n return this._hasNumbering;\n }\n\n // --- WriteContext interface (core descriptor pipeline) ---\n\n public addRelationship(_type: string, _target: string, _mode?: string): string {\n const id = this._currentRelationshipId++;\n return `rId${id}`;\n }\n\n public addMedia(data: Uint8Array, type: string): string {\n const entry = this.media.addMedia(\n data,\n type,\n (fileName) =>\n ({\n data,\n fileName,\n type,\n transformation: { pixels: { x: 0, y: 0 }, emus: { x: 0, y: 0 } },\n }) as MediaData,\n );\n return `{${entry.fileName}}`;\n }\n\n // --- Internal tracking ---\n private _headers: HeaderFooterEntry[] = [];\n private _footers: HeaderFooterEntry[] = [];\n\n // --- Original input preserved for descriptor usage ---\n declare public _options: DocumentOptions;\n\n constructor(options: DocumentOptions) {\n this._options = options;\n\n this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });\n\n this.comments = {\n relationships: new Relationships(),\n entries: [],\n nextId: maxCommentId(options.comments?.children) + 1,\n };\n const markupSeed = { range: -1, moveRun: -1 };\n collectMaxMarkupIds(options.sections, markupSeed);\n this.markupIds = {\n rangeNext: markupSeed.range + 1,\n moveRunNext: markupSeed.moveRun + 1,\n };\n this.fileRelationships = new Relationships();\n this.footNotes = { relationships: new Relationships(), notes: new Map() };\n this.endnotes = { relationships: new Relationships(), notes: new Map() };\n this.document = { relationships: new Relationships() };\n this._settingsOptions = {\n compatibility: options.compatibility,\n compatibilityModeVersion: options.compatabilityModeVersion,\n defaultTabStop: options.defaultTabStop,\n evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,\n characterSpacingControl: options.characterSpacingControl,\n hyphenation: {\n autoHyphenation: options.hyphenation?.autoHyphenation,\n consecutiveHyphenLimit: options.hyphenation?.consecutiveHyphenLimit,\n doNotHyphenateCaps: options.hyphenation?.doNotHyphenateCaps,\n hyphenationZone: options.hyphenation?.hyphenationZone,\n },\n trackRevisions: options.features?.trackRevisions,\n updateFields: options.features?.updateFields,\n documentProtection: options.features?.documentProtection,\n view: options.view,\n zoom: options.zoom,\n writeProtection: options.writeProtection,\n displayBackgroundShape:\n options.displayBackgroundShape ?? (options.background?.image ? true : undefined),\n embedTrueTypeFonts: options.embedTrueTypeFonts,\n embedSystemFonts: options.embedSystemFonts,\n saveSubsetFonts: options.saveSubsetFonts,\n docVars: options.docVars,\n colorSchemeMapping: options.colorSchemeMapping,\n mailMerge: options.mailMerge,\n ...options.settings,\n };\n\n this.media = new Media<MediaData>();\n this.charts = new ChartCollection();\n this.smartArts = new SmartArtCollection();\n this.embeddings = new EmbeddingCollection();\n this.altChunks = new AltChunkCollection();\n this.subDocs = new SubDocCollection();\n\n if (options.externalStyles !== undefined) {\n const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);\n const defaultStyles = new DefaultStylesFactory().newInstance(options.styles?.default ?? {});\n // External (user-provided full styles.xml) wins; factory builtins fill\n // any gaps. Drop factory builtins whose styleId the external XML already\n // defines (no duplicate styleId). docDefaults/latentStyles come from the\n // external XML — the factory's are not mixed in.\n const externalIds = new Set<string>();\n for (const s of externalStyles.importedStyles ?? []) {\n const id = extractStyleId(s._raw);\n if (id) externalIds.add(id);\n }\n const notInExternal = <T extends { id: string }>(arr: T[] | undefined) =>\n (arr ?? []).filter((s) => !externalIds.has(s.id));\n this.styles = new Styles({\n importedStyles: externalStyles.importedStyles,\n initialAttributes: externalStyles.initialAttributes ?? defaultStyles.initialAttributes,\n paragraphStyles: notInExternal(defaultStyles.paragraphStyles),\n characterStyles: notInExternal(defaultStyles.characterStyles),\n tableStyles: notInExternal(defaultStyles.tableStyles),\n numberingStyles: notInExternal(defaultStyles.numberingStyles),\n });\n } else if (options.styles) {\n const s = options.styles;\n if (s.roundTripped) {\n // Round-trip origin (parseStyleDefinitions): parsed structured\n // builtin/custom styles win. The factory only supplies docDefaults +\n // latentStyles verbatim defaults; parsed docDefaultsXml/latentStylesXml\n // override when present. No factory builtin rebuild — parsed builtins\n // already carry the source document's customizations.\n const f = new DefaultStylesFactory().newInstance({});\n const docDefaults = s.docDefaultsXml ?? f.importedStyles?.[0]?._raw ?? \"\";\n const latentStyles = s.latentStylesXml ?? f.importedStyles?.[1]?._raw ?? \"\";\n this.styles = new Styles({\n importedStyles: [{ _raw: docDefaults }, { _raw: latentStyles }],\n initialAttributes: s.initialAttributes ?? f.initialAttributes,\n paragraphStyles: s.paragraphStyles,\n characterStyles: s.characterStyles,\n tableStyles: s.tableStyles,\n numberingStyles: s.numberingStyles,\n });\n } else {\n // Fresh generation: factory default builtins (structured) + user\n // overrides. User paragraphStyles/characterStyles/tableStyles/\n // numberingStyles override factory builtins with the same styleId.\n const f = new DefaultStylesFactory().newInstance(s.default);\n this.styles = new Styles({\n importedStyles: f.importedStyles,\n initialAttributes: s.initialAttributes ?? f.initialAttributes,\n paragraphStyles: mergeById(f.paragraphStyles, s.paragraphStyles),\n characterStyles: mergeById(f.characterStyles, s.characterStyles),\n tableStyles: mergeById(f.tableStyles, s.tableStyles),\n numberingStyles: mergeById(f.numberingStyles, s.numberingStyles),\n });\n }\n } else {\n const stylesFactory = new DefaultStylesFactory();\n this.styles = new Styles(stylesFactory.newInstance());\n }\n\n // Register numbering references from custom paragraph/character styles.\n // Style definitions may contain numbering properties whose concrete instances\n // are never created through the body paragraph processing path.\n if (options.styles?.paragraphStyles) {\n for (const style of options.styles.paragraphStyles) {\n const num = style.paragraph?.numbering;\n if (num) {\n this.numbering.createConcreteNumberingInstance(num.reference, num.instance ?? 0);\n }\n }\n }\n\n // Resolve footnote/endnote presence from the source [Content_Types]: a\n // round-tripped package only carries these parts when the source declared\n // them. Fresh compile (no contentTypes) always emits both.\n const sourceOverrides = options.contentTypes?.overrides ?? [];\n this._hasFootnotes =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/footnotes.xml\");\n this._hasEndnotes =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/endnotes.xml\");\n // Numbering follows the source [Content_Types] on round-trip — the part is\n // optional, and emitting it without a matching Override is an OPC violation.\n // Fresh compile always emits it (Word ships a default bullet list).\n this._hasNumbering =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/numbering.xml\");\n\n this.addDefaultRelationships();\n\n for (const section of options.sections) {\n this.addSection(section);\n }\n\n if (options.footnotes) {\n for (const key in options.footnotes) {\n // Skip the round-tripped separator markers (they carry no .children).\n if (key === \"separator\" || key === \"continuationSeparator\") continue;\n this.footNotes.notes.set(parseFloat(key), options.footnotes[key].children);\n }\n this.footNotes.separator = options.footnotes.separator;\n this.footNotes.continuationSeparator = options.footnotes.continuationSeparator;\n }\n\n if (options.endnotes) {\n for (const key in options.endnotes) {\n if (key === \"separator\" || key === \"continuationSeparator\") continue;\n this.endnotes.notes.set(parseFloat(key), options.endnotes[key].children);\n }\n this.endnotes.separator = options.endnotes.separator;\n this.endnotes.continuationSeparator = options.endnotes.continuationSeparator;\n }\n\n this.fontTable = new FontWrapper(options.fonts ?? []);\n this.glossaryOptions = options.glossary;\n this.webSettings = options.webSettings ?? undefined;\n\n if (options.glossary) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument\",\n \"glossary/document.xml\",\n );\n }\n\n if (this.webSettings) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\",\n \"webSettings.xml\",\n );\n }\n }\n\n get headers(): HeaderFooterEntry[] {\n return this._headers;\n }\n\n get footers(): HeaderFooterEntry[] {\n return this._footers;\n }\n\n // --- Private helpers ---\n\n private addSection({ headers = {}, footers = {}, properties }: SectionOptions): void {\n const sectPrOptions: SectionPropertiesOptions = {\n ...properties,\n footerWrapperGroup: {\n default: footers.default ? this.createFooter(footers.default) : undefined,\n even: footers.even ? this.createFooter(footers.even) : undefined,\n first: footers.first ? this.createFooter(footers.first) : undefined,\n },\n headerWrapperGroup: {\n default: headers.default ? this.createHeader(headers.default) : undefined,\n even: headers.even ? this.createHeader(headers.even) : undefined,\n first: headers.first ? this.createHeader(headers.first) : undefined,\n },\n };\n this._sectionProperties.push(sectPrOptions);\n }\n\n private createHeader(header: SectionChild[]): HeaderFooterEntry {\n const referenceId = this._currentRelationshipId++;\n const entry: HeaderFooterEntry = {\n children: header,\n relationships: new Relationships(),\n referenceId,\n };\n this.addHeaderToDocument(entry);\n return entry;\n }\n\n private createFooter(footer: SectionChild[]): HeaderFooterEntry {\n const referenceId = this._currentRelationshipId++;\n const entry: HeaderFooterEntry = {\n children: footer,\n relationships: new Relationships(),\n referenceId,\n };\n this.addFooterToDocument(entry);\n return entry;\n }\n\n private addHeaderToDocument(header: HeaderFooterEntry): void {\n this._headers.push(header);\n this.document.relationships.addRelationship(\n header.referenceId,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\",\n `header${this._headers.length}.xml`,\n );\n }\n\n private addFooterToDocument(footer: HeaderFooterEntry): void {\n this._footers.push(footer);\n this.document.relationships.addRelationship(\n footer.referenceId,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer\",\n `footer${this._footers.length}.xml`,\n );\n }\n\n private addDefaultRelationships(): void {\n this.fileRelationships.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n \"word/document.xml\",\n );\n this.fileRelationships.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n this.fileRelationships.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n this.fileRelationships.addRelationship(\n 4,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\",\n \"docProps/custom.xml\",\n );\n\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\",\n \"styles.xml\",\n );\n if (this._hasNumbering) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\",\n \"numbering.xml\",\n );\n }\n if (this._hasFootnotes) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\",\n \"footnotes.xml\",\n );\n }\n if (this._hasEndnotes) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\",\n \"endnotes.xml\",\n );\n }\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\",\n \"settings.xml\",\n );\n // Comments is an optional part — only wire the document→comments relationship\n // when the document actually carries comments. Emitting it unconditionally\n // produces an orphan comments.xml that Word rejects as an OPC violation\n // (empty part with no [Content_Types] Override when content types are\n // passed through from the source on round-trip).\n if (\n this._options.comments?.children?.length ||\n bodyContainsCommentSugar(this._options.sections)\n ) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\",\n \"comments.xml\",\n );\n }\n if (this._options.bibliography) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography\",\n \"bibliography.xml\",\n );\n }\n\n // Theme — always present: fresh-compile generates a default theme, round-trip\n // passes the source theme through rawParts. Word needs the document→theme\n // relationship to resolve theme colors/fonts.\n const themePart = this._options.rawParts?.find((p) => p.path.startsWith(\"word/theme/\"));\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\",\n themePart ? themePart.path.replace(/^word\\//, \"\") : \"theme/theme1.xml\",\n );\n\n // customXml storage — raw-passthrough parts. Declare the document→customXml\n // relationship for each item (itemProps are linked via the item's own .rels,\n // not directly by the document) so Word can bind cover-page metadata, etc.\n for (const part of this._options.rawParts ?? []) {\n if (\n part.path.startsWith(\"customXml/\") &&\n part.path.endsWith(\".xml\") &&\n !part.path.includes(\"/_rels/\") &&\n !part.path.includes(\"itemProps\")\n ) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml\",\n `../${part.path}`,\n );\n }\n }\n }\n}\n\n// ── DocxReadContext ──\n\n/**\n * DOCX-specific read context.\n *\n * Holds references to the parsed DocxDocument and cached style/numbering data\n * used throughout the DOCX parsing pipeline. Implements ReadContext for\n * descriptor pipeline compatibility.\n */\nexport class DocxReadContext implements ReadContext {\n /**\n * Path of the part currently being parsed. Each part carries its own .rels\n * with independent rId numbering, so drawings inside a part must resolve\n * image relationships against that part's rels. Defaults to the document body.\n */\n public currentPart = \"word/document.xml\";\n\n constructor(\n public docx: DocxDocument,\n public styleCache: Map<string, Element>,\n public numberingCache: Map<string, Element>,\n ) {}\n\n resolveRelationship(rId: string): string | undefined {\n const partMedia = this.docx.partRefs.partMedia.get(this.currentPart);\n if (partMedia) {\n const media = partMedia.get(rId);\n if (media) return media;\n }\n return (\n this.docx.partRefs.headers.get(rId) ??\n this.docx.partRefs.footers.get(rId) ??\n this.docx.partRefs.media.get(rId) ??\n this.docx.partRefs.charts.get(rId) ??\n this.docx.partRefs.diagramData.get(rId) ??\n this.docx.partRefs.afChunks.get(rId) ??\n this.docx.partRefs.subDocs.get(rId) ??\n this.docx.partRefs.hyperlinks.get(rId)\n );\n }\n\n /**\n * Run `fn` with `currentPart` temporarily set to `partPath`, restoring the\n * previous value afterwards. Use when parsing a sub-document part (header,\n * footer, footnotes, …) so its drawings resolve images from its own rels.\n */\n withPart<T>(partPath: string, fn: () => T): T {\n const prev = this.currentPart;\n this.currentPart = partPath;\n try {\n return fn();\n } finally {\n this.currentPart = prev;\n }\n }\n\n getPart(path: string): Element | undefined {\n return this.docx.doc.get(path);\n }\n\n getRaw(path: string): Uint8Array | undefined {\n return this.docx.doc.getRaw(path);\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAa,qBAAb,MAAgC;CAC9B;CAEA,cAA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;CACF;CAEA,QAAQ,MAAmC;EACzC,OAAO,KAAK,KAAK,IAAI,IAAI,IAAI;CAC/B;CAEA,OAAO,MAAsC;EAC3C,OAAO,KAAK,KAAK,IAAI,OAAO,IAAI;CAClC;AACF"}
import { C as footnotesDesc, S as endnotesDesc, _ as glossaryDesc, a as appPropertiesDesc, bt as stringifyDocumentXml, d as withAltChunkOverrides, f as withMediaDefaults, i as webSettingsDesc, j as settingsDesc, l as buildContentTypesFromRegistry, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, p as commentsDesc, s as corePropertiesDesc, u as contentTypesDesc, v as bibliographyDesc, y as fontTableDesc, yt as stringifyBodyChild } from "./parts-B7Sfx_F0.mjs";
import { n as DocxWriteContext } from "./context-CiyAhqTX.mjs";
import { OoxmlMimeType, addSmartArtRelationships, createPacker, createThemeXml, findAndReplaceImagePlaceholders, formatId, hasPlaceholders, levelForMediaName, optionalRelsPart, replaceAllPlaceholders, replaceNumberingPlaceholders } from "@office-open/core";
import { escapeXml } from "@office-open/xml";
import { DEFAULT_DRAWING_XML, getColorXml, getLayoutXml, getStyleXml } from "@office-open/core/smartart";
//#region src/parts/fonts/obfuscate-ttf-to-odttf.ts
/**
* Font obfuscation module for embedding fonts in WordprocessingML documents.
*
* This module implements the OOXML font obfuscation algorithm used to embed
* fonts in DOCX documents. Obfuscation is required by the OOXML specification
* to prevent simple extraction of embedded font files.
*
* Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
*
* @module
*/
/** Start offset for obfuscation in the font file */
const obfuscatedStartOffset = 0;
/** End offset for obfuscation (first 32 bytes are obfuscated) */
const obfuscatedEndOffset = 32;
/** Expected GUID size (32 hex characters without dashes) */
const guidSize = 32;
/**
* Obfuscates a TrueType font file for embedding in OOXML documents.
*
* The obfuscation algorithm XORs the first 32 bytes of the font file
* with a reversed byte sequence derived from the font's GUID key.
* This prevents simple extraction while maintaining font functionality.
*
* @param buf - The original font file as a byte array
* @param fontKey - The GUID key for the font (with or without dashes)
* @returns The obfuscated font data
* @throws Error if the fontKey is not a valid 32-character GUID
*
* @example
* ```typescript
* const fontData = readFileSync("font.ttf");
* const fontKey = "00000000-0000-0000-0000-000000000000";
* const obfuscatedData = obfuscate(fontData, fontKey);
* ```
*
* @internal
*/
const obfuscate = (buf, fontKey) => {
const guid = fontKey.replace(/-/g, "");
if (guid.length !== guidSize) throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);
const hexNumbers = guid.replace(/(..)/g, "$1 ").trim().split(" ").map((hexString) => parseInt(hexString, 16));
hexNumbers.reverse();
const obfuscatedBytes = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset).map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]);
const out = new Uint8Array(obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset));
out.set(buf.slice(0, obfuscatedStartOffset));
out.set(obfuscatedBytes, obfuscatedStartOffset);
out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);
return out;
};
//#endregion
//#region src/parts/header-footer.ts
/**
* Namespace keys used by header elements.
* @internal
*/
const HEADER_NAMESPACES = [
"cx",
"cx1",
"cx2",
"cx3",
"cx4",
"cx5",
"cx6",
"cx7",
"cx8",
"m",
"mc",
"o",
"r",
"v",
"w",
"w10",
"w14",
"w15",
"w16cid",
"w16se",
"wne",
"wp",
"wp14",
"wpc",
"wpg",
"wpi",
"wps"
];
/**
* Namespace keys used by footer elements.
* @internal
*/
const FOOTER_NAMESPACES = [
"m",
"mc",
"o",
"r",
"v",
"w",
"w10",
"w14",
"w15",
"wne",
"wp",
"wp14",
"wpc",
"wpg",
"wpi",
"wps"
];
/**
* Serialize a header or footer to XML.
*
* Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,
* then serializes each child element via `stringifyBodyChild()`.
*
* @param tag - Element tag name ("w:hdr" or "w:ftr")
* @param namespaces - Namespace keys to declare on the root element
* @param children - Block-level child elements (raw SectionChild objects)
* @param ctx - Body context for stringification
*/
function stringifyHeaderFooter(tag, namespaces, children, ctx) {
const attrParts = [];
for (const ns of namespaces) attrParts.push(`xmlns:${ns}="${escapeXml(DocumentAttributeNamespaces[ns])}"`);
attrParts.push("mc:Ignorable=\"w14 w15 wp14\"");
const attrStr = attrParts.join(" ");
const childParts = [];
for (const child of children) childParts.push(stringifyBodyChild(child, ctx));
const body = childParts.join("");
return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;
}
//#endregion
//#region src/compiler.ts
/**
* DOCX document compiler — pure function entry point.
*
* compileDocument() accepts DocumentOptions directly,
* creates a DocxWriteContext internally, and produces a Zippable result.
* All XML parts are produced via descriptors or serialize() —
* no Formatter dependency.
*
* @module
*/
/** Reusable TextEncoder (stateless, safe to share). */
const encoder = new TextEncoder();
/** XML declaration prepended to every OOXML part. */
const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
/**
* Compile document options into a flat file map suitable for fflate zipSync.
*
* This is the primary entry point for DOCX generation — accepts DocumentOptions
* directly.
*/
function compileDocument(options, overrides = [], mediaLevel = 0) {
const ctx = new DocxWriteContext(options);
const files = {};
const xmlifiedFileMapping = xmlifyContext(ctx, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
const map = new Map(Object.entries(xmlifiedFileMapping));
for (const [, obj] of map) {
if (obj === void 0) continue;
if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = typeof subFile.data === "string" ? encoder.encode(subFile.data) : subFile.data;
else files[obj.path] = typeof obj.data === "string" ? encoder.encode(obj.data) : obj.data;
}
for (const subFile of overrides) files[subFile.path] = typeof subFile.data === "string" ? encoder.encode(subFile.data) : subFile.data;
const mediaArray = ctx.media.array;
for (const mediaData of mediaArray) {
files[`word/media/${mediaData.fileName}`] = [mediaData.data, { level: levelForMediaName(mediaData.fileName, mediaLevel) }];
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [mediaData.fallback.data, { level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) }];
}
for (const embedding of ctx.embeddings.array) files[`word/embeddings/${embedding.fileName}`] = [embedding.data, { level: levelForMediaName(embedding.fileName, mediaLevel) }];
for (const font of ctx.fontTable.fontOptionsWithKey) {
if (font.data === void 0) continue;
const [nameWithoutExtension] = font.name.split(".");
const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;
files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);
}
for (const part of ctx._options.rawParts ?? []) files[part.path] = part.data;
files["[Content_Types].xml"] = encoder.encode(buildContentTypesData(ctx, files));
return files;
}
/**
* Comments carried by the document: those the caller listed explicitly
* (`options.comments`) plus entries registered by `{ comment }` sugar children
* during body stringification. Drives both word/comments.xml generation and the
* [Content_Types] comments Override, which must stay in sync (OPC consistency).
*/
function mergedCommentChildren(ctx) {
return [...ctx._options.comments?.children ?? [], ...ctx.comments.entries];
}
/**
* Serialize [Content_Types].xml from the part registry, then backfill media/
* font/embedding `<Default>` entries from the parts actually written.
*
* Must run after every part has been stringified (parts call `ctx.addMedia`
* during stringify), so call this once `xmlifyContext` has finished — not from
* inside its object literal, where ContentTypes would evaluate before the
* later-defined header/footer/font parts have registered their media.
*/
function buildContentTypesData(ctx, files) {
const altChunks = ctx.altChunks.array.map((ac) => ({
path: `/word/${ac.path}`,
contentType: ac.contentType ?? "application/xhtml+xml"
}));
const withMedia = withMediaDefaults(ctx._options.contentTypes ? withAltChunkOverrides(ctx._options.contentTypes, altChunks) : buildContentTypesFromRegistry(new Map([
["freshCompile", true],
["hasComments", mergedCommentChildren(ctx).length > 0],
["hasBibliography", !!ctx._options.bibliography],
["hasGlossary", !!ctx.glossaryOptions],
["hasWebSettings", !!ctx.webSettings],
["headerCount", ctx.headers.length],
["footerCount", ctx.footers.length],
["chartCount", ctx.charts.array.length],
["smartArtCount", ctx.smartArts.array.length]
]), {
altChunks,
subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` }))
}), Object.keys(files));
return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? "");
}
function xmlifyContext(ctx, headerFormattedViews, footerFormattedViews) {
const mkCtx = (viewWrapper = ctx.document) => ({
fileData: ctx,
file: ctx,
viewWrapper,
stringifyChild: stringifyBodyChild,
addRelationship: (type, target, mode) => ctx.addRelationship(type, target, mode),
addMedia: (data, type) => ctx.addMedia(data, type)
});
const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;
const footerMediaResults = /* @__PURE__ */ new Map();
const headerMediaResults = /* @__PURE__ */ new Map();
const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, mkCtx(ctx.document));
const mergedCommentChildrenList = mergedCommentChildren(ctx);
const hasComments = mergedCommentChildrenList.length > 0;
const commentRelationshipCount = hasComments ? ctx.comments.relationships.relationshipCount + 1 : 0;
const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;
const commentXmlData = commentCtx ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx) : "";
const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;
const footnoteCtx = mkCtx({ relationships: ctx.footNotes.relationships });
const footnoteXmlData = XML_DECL + (footnotesDesc.stringify({
notes: ctx.footNotes.notes,
separator: ctx.footNotes.separator,
continuationSeparator: ctx.footNotes.continuationSeparator
}, footnoteCtx) ?? "");
const documentMedia = findAndReplaceImagePlaceholders(documentXmlData, ctx.media.array, documentRelationshipCount);
const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;
const documentEmbeddings = findAndReplaceImagePlaceholders(documentMedia.xml, ctx.embeddings.array, documentEmbeddingOffset);
const commentMedia = hasComments ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount) : {
xml: "",
referenced: []
};
const footnoteMedia = findAndReplaceImagePlaceholders(footnoteXmlData, ctx.media.array, footnoteRelationshipCount);
for (let i = 0; i < footnoteMedia.referenced.length; i++) ctx.footNotes.relationships.addRelationship(footnoteRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${footnoteMedia.referenced[i].fileName}`);
return {
AppProperties: {
data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? ""),
path: "docProps/app.xml"
},
...hasComments ? {
Comments: {
data: (() => {
return replaceNumberingPlaceholders(commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/comments.xml"
},
CommentsRelationships: (() => {
for (let i = 0; i < commentMedia.referenced.length; i++) ctx.comments.relationships.addRelationship(commentRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${commentMedia.referenced[i].fileName}`);
return optionalRelsPart(ctx.comments.relationships, XML_DECL, "word/_rels/comments.xml.rels");
})()
} : {},
CustomProperties: {
data: XML_DECL + (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ?? ""),
path: "docProps/custom.xml"
},
Document: {
data: (() => {
let xmlData = documentEmbeddings.xml;
if (hasPlaceholders(xmlData)) {
const mediaCount = documentMedia.referenced.length;
const embeddingCount = documentEmbeddings.referenced.length;
const chartKeys = ctx.charts.array.map((c) => c.key);
const smartArtKeys = ctx.smartArts.array.map((s) => s.key);
const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;
const smartArtOffset = chartOffset + chartKeys.length;
const entries = [];
for (let i = 0; i < chartKeys.length; i++) entries.push({
prefix: "chart:",
key: chartKeys[i],
value: formatId(chartOffset, i, "rId")
});
const saPrefixes = [
"smartart:",
"smartart-lo:",
"smartart-qs:",
"smartart-cs:"
];
for (let i = 0; i < smartArtKeys.length; i++) for (let p = 0; p < saPrefixes.length; p++) entries.push({
prefix: saPrefixes[p],
key: smartArtKeys[i],
value: formatId(smartArtOffset + p * smartArtKeys.length, i, "rId")
});
for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) entries.push({
key: `${reference}-${instance}`,
value: numId.toString()
});
xmlData = replaceAllPlaceholders(xmlData, entries);
} else xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);
return xmlData;
})(),
path: "word/document.xml"
},
...ctx._options.rawParts?.some((part) => part.path.startsWith("word/theme/")) ? {} : { Theme: {
data: XML_DECL + createThemeXml(),
path: "word/theme/theme1.xml"
} },
...ctx.hasEndnotes ? {
Endnotes: {
data: (() => {
const endnoteCtx = mkCtx({ relationships: ctx.endnotes.relationships });
const xmlData = XML_DECL + (endnotesDesc.stringify({
notes: ctx.endnotes.notes,
separator: ctx.endnotes.separator,
continuationSeparator: ctx.endnotes.continuationSeparator
}, endnoteCtx) ?? "");
const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;
const endnoteMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, endnoteRelCount);
if (endnoteMedia.referenced.length > 0) {
for (let i = 0; i < endnoteMedia.referenced.length; i++) ctx.endnotes.relationships.addRelationship(endnoteRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${endnoteMedia.referenced[i].fileName}`);
return replaceNumberingPlaceholders(endnoteMedia.xml, ctx.numbering.concreteNumbering);
}
return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/endnotes.xml"
},
EndnotesRelationships: ctx.endnotes.relationships.relationshipCount > 0 ? {
data: XML_DECL + ctx.endnotes.relationships.serialize(),
path: "word/_rels/endnotes.xml.rels"
} : void 0
} : {},
FileRelationships: {
data: XML_DECL + ctx.fileRelationships.serialize(),
path: "_rels/.rels"
},
FontTable: {
data: XML_DECL + (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? ""),
path: "word/fontTable.xml"
},
FontTableRelationships: optionalRelsPart(ctx.fontTable.relationships, XML_DECL, "word/_rels/fontTable.xml.rels"),
...ctx.hasFootnotes ? {
FootNotes: {
data: (() => {
return replaceNumberingPlaceholders(footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/footnotes.xml"
},
FootNotesRelationships: ctx.footNotes.relationships.relationshipCount > 0 ? {
data: XML_DECL + ctx.footNotes.relationships.serialize(),
path: "word/_rels/footnotes.xml.rels"
} : void 0
} : {},
FooterRelationships: ctx.footers.map((entry, index) => {
const footerCtx = mkCtx({ relationships: entry.relationships });
const xmlData = XML_DECL + stringifyHeaderFooter("w:ftr", FOOTER_NAMESPACES, entry.children, footerCtx);
footerFormattedViews.set(index, xmlData);
const footerRelCount = entry.relationships.relationshipCount + 1;
const footerMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, footerRelCount);
footerMediaResults.set(index, footerMedia);
for (let i = 0; i < footerMedia.referenced.length; i++) entry.relationships.addRelationship(footerRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${footerMedia.referenced[i].fileName}`);
return optionalRelsPart(entry.relationships, XML_DECL, `word/_rels/footer${index + 1}.xml.rels`);
}).filter((r) => r !== void 0),
Footers: ctx.footers.map((_entry, index) => {
const footerMedia = footerMediaResults.get(index);
const tempXmlData = footerFormattedViews.get(index);
return {
data: replaceNumberingPlaceholders(footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData, ctx.numbering.concreteNumbering),
path: `word/footer${index + 1}.xml`
};
}),
HeaderRelationships: ctx.headers.map((entry, index) => {
const headerCtx = mkCtx({ relationships: entry.relationships });
const xmlData = XML_DECL + stringifyHeaderFooter("w:hdr", HEADER_NAMESPACES, entry.children, headerCtx);
headerFormattedViews.set(index, xmlData);
const headerRelCount = entry.relationships.relationshipCount + 1;
const headerMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, headerRelCount);
headerMediaResults.set(index, headerMedia);
for (let i = 0; i < headerMedia.referenced.length; i++) entry.relationships.addRelationship(headerRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${headerMedia.referenced[i].fileName}`);
return optionalRelsPart(entry.relationships, XML_DECL, `word/_rels/header${index + 1}.xml.rels`);
}).filter((r) => r !== void 0),
Headers: ctx.headers.map((_entry, index) => {
const headerMedia = headerMediaResults.get(index);
const tempXmlData = headerFormattedViews.get(index);
return {
data: replaceNumberingPlaceholders(headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData, ctx.numbering.concreteNumbering),
path: `word/header${index + 1}.xml`
};
}),
...ctx.hasNumbering ? { Numbering: {
data: ctx.numbering.serialize(),
path: "word/numbering.xml"
} } : {},
Properties: {
data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? ""),
path: "docProps/core.xml"
},
Relationships: {
data: (() => {
for (let i = 0; i < documentMedia.referenced.length; i++) ctx.document.relationships.addRelationship(documentRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${documentMedia.referenced[i].fileName}`);
for (let i = 0; i < documentEmbeddings.referenced.length; i++) ctx.document.relationships.addRelationship(documentEmbeddingOffset + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", `embeddings/${documentEmbeddings.referenced[i].fileName}`);
const chartOffset = documentRelationshipCount + documentMedia.referenced.length + documentEmbeddings.referenced.length;
for (let i = 0; i < ctx.charts.array.length; i++) ctx.document.relationships.addRelationship(chartOffset + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `charts/chart${i + 1}.xml`);
addSmartArtRelationships(ctx.smartArts.array.map((s) => s.key), (id, type, target) => {
ctx.document.relationships.addRelationship(id, type, target);
}, documentRelationshipCount + documentMedia.referenced.length + documentEmbeddings.referenced.length + ctx.charts.array.length, 0, {
pathPrefix: "",
styleRelType: "http://schemas.microsoft.com/office/2007/relationships/diagramStyle"
});
ctx.document.relationships.addRelationship(ctx.document.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", "fontTable.xml");
return XML_DECL + ctx.document.relationships.serialize();
})(),
path: "word/_rels/document.xml.rels"
},
Settings: {
data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? ""),
path: "word/settings.xml"
},
Styles: {
data: (() => {
return replaceNumberingPlaceholders(ctx.styles.serialize(), ctx.numbering.concreteNumbering);
})(),
path: "word/styles.xml"
},
...ctx._options.bibliography ? { Bibliography: {
data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? ""),
path: "word/bibliography.xml"
} } : {},
...ctx.charts.array.length > 0 ? { Charts: ctx.charts.array.map((chartData, i) => ({
data: XML_DECL + chartData.chartSpaceXml,
path: `word/charts/chart${i + 1}.xml`
})) } : {},
...ctx.smartArts.array.length > 0 ? {
DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({
data: XML_DECL + smartArtData.dataModelXml,
path: `word/diagrams/data${i + 1}.xml`
})),
DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({
data: getLayoutXml(smartArtData.layout),
path: `word/diagrams/layout${i + 1}.xml`
})),
DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({
data: getStyleXml(smartArtData.style),
path: `word/diagrams/quickStyle${i + 1}.xml`
})),
DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({
data: getColorXml(smartArtData.color),
path: `word/diagrams/colors${i + 1}.xml`
})),
DiagramDrawing: ctx.smartArts.array.map((_, i) => ({
data: DEFAULT_DRAWING_XML,
path: `word/diagrams/drawing${i + 1}.xml`
}))
} : {},
...ctx.altChunks.array.length > 0 ? { AltChunks: ctx.altChunks.array.map((altChunkData) => ({
data: altChunkData.data,
path: `word/${altChunkData.path}`
})) } : {},
...ctx.subDocs.array.length > 0 ? { SubDocs: ctx.subDocs.array.map((subDocData) => ({
data: subDocData.data,
path: `word/${subDocData.path}`
})) } : {},
...ctx.glossaryOptions ? { Glossary: {
data: (() => {
const glossaryCtx = mkCtx(void 0);
return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions, glossaryCtx) ?? "");
})(),
path: "word/glossary/document.xml"
} } : {},
...ctx.webSettings ? { WebSettings: {
data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? ""),
path: "word/webSettings.xml"
} } : {}
};
}
//#endregion
//#region src/generate.ts
/**
* Pure function API for generating DOCX files.
*
* @module
*/
/** @internal Packer instance for DOCX generation. */
const Packer = createPacker({
compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),
mimeType: OoxmlMimeType.DOCX
});
/**
* Generate a DOCX file from pure JSON options.
*
* The output format is controlled by `packerOptions.type` (default: `"nodebuffer"` → Buffer).
* For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.
*
* @param options - Document options (sections, styles, numbering, etc.)
* @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)
*
* @example
* ```typescript
* import { generateDocument } from "@office-open/docx";
*
* const buffer = await generateDocument({ sections: [...] });
* const bytes = await generateDocument({ sections: [...] }, { type: "uint8array" });
* const blob = await generateDocument({ sections: [...] }, { type: "blob" });
* ```
*/
function generateDocument(options, packerOptions) {
return Packer.pack(options, packerOptions);
}
/**
* Synchronously generate a DOCX file from pure JSON options.
*/
function generateDocumentSync(options, packerOptions) {
return Packer.packSync(options, packerOptions);
}
/**
* Generate a DOCX file as a `ReadableStream<Uint8Array>`.
*/
function generateDocumentStream(options, packerOptions) {
return Packer.toStream(options, packerOptions);
}
//#endregion
export { compileDocument as i, generateDocumentStream as n, generateDocumentSync as r, generateDocument as t };
//# sourceMappingURL=generate-DjODfjQ1.mjs.map
{"version":3,"file":"generate-DjODfjQ1.mjs","names":[],"sources":["../src/parts/fonts/obfuscate-ttf-to-odttf.ts","../src/parts/header-footer.ts","../src/compiler.ts","../src/generate.ts"],"sourcesContent":["/**\n * Font obfuscation module for embedding fonts in WordprocessingML documents.\n *\n * This module implements the OOXML font obfuscation algorithm used to embed\n * fonts in DOCX documents. Obfuscation is required by the OOXML specification\n * to prevent simple extraction of embedded font files.\n *\n * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)\n *\n * @module\n */\n\n/** Start offset for obfuscation in the font file */\nconst obfuscatedStartOffset = 0;\n/** End offset for obfuscation (first 32 bytes are obfuscated) */\nconst obfuscatedEndOffset = 32;\n/** Expected GUID size (32 hex characters without dashes) */\nconst guidSize = 32;\n\n/**\n * Obfuscates a TrueType font file for embedding in OOXML documents.\n *\n * The obfuscation algorithm XORs the first 32 bytes of the font file\n * with a reversed byte sequence derived from the font's GUID key.\n * This prevents simple extraction while maintaining font functionality.\n *\n * @param buf - The original font file as a byte array\n * @param fontKey - The GUID key for the font (with or without dashes)\n * @returns The obfuscated font data\n * @throws Error if the fontKey is not a valid 32-character GUID\n *\n * @example\n * ```typescript\n * const fontData = readFileSync(\"font.ttf\");\n * const fontKey = \"00000000-0000-0000-0000-000000000000\";\n * const obfuscatedData = obfuscate(fontData, fontKey);\n * ```\n *\n * @internal\n */\nexport const obfuscate = (buf: Uint8Array, fontKey: string): Uint8Array => {\n const guid = fontKey.replace(/-/g, \"\");\n if (guid.length !== guidSize) {\n throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);\n }\n\n const hexStrings = guid.replace(/(..)/g, \"$1 \").trim().split(\" \");\n const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16));\n hexNumbers.reverse();\n\n const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset);\n const obfuscatedBytes = bytesToObfuscate.map(\n (byte, i) => byte ^ hexNumbers[i % hexNumbers.length],\n );\n\n const out = new Uint8Array(\n obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset),\n );\n out.set(buf.slice(0, obfuscatedStartOffset));\n out.set(obfuscatedBytes, obfuscatedStartOffset);\n out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);\n return out;\n};\n","/**\n * Header/Footer entry module for WordprocessingML documents.\n *\n * Replaces the former HeaderWrapper/FooterWrapper/Header/Footer/HeaderFooterBase\n * class hierarchy with a simple data structure + pure serialization function.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_HdrFtr\n *\n * @module\n */\n\nimport type { Relationships } from \"@office-open/core\";\nimport { escapeXml } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { stringifyBodyChild } from \"../body\";\nimport type { BodyContext } from \"../context\";\nimport { DocumentAttributeNamespaces } from \"./document/document-attributes\";\nimport type { DocumentAttributeNamespace } from \"./document/document-attributes\";\n\n/**\n * Simple data structure for a header or footer entry.\n *\n * Replaces HeaderWrapper/FooterWrapper — holds children, relationships,\n * and the reference ID needed for section property references.\n *\n * Children are raw SectionChild objects (plain JSON or class instances).\n */\nexport interface HeaderFooterEntry {\n children: SectionChild[];\n relationships: Relationships;\n referenceId: number;\n}\n\n/**\n * Namespace keys used by header elements.\n * @internal\n */\nexport const HEADER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"cx\",\n \"cx1\",\n \"cx2\",\n \"cx3\",\n \"cx4\",\n \"cx5\",\n \"cx6\",\n \"cx7\",\n \"cx8\",\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"w16cid\",\n \"w16se\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Namespace keys used by footer elements.\n * @internal\n */\nexport const FOOTER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Serialize a header or footer to XML.\n *\n * Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,\n * then serializes each child element via `stringifyBodyChild()`.\n *\n * @param tag - Element tag name (\"w:hdr\" or \"w:ftr\")\n * @param namespaces - Namespace keys to declare on the root element\n * @param children - Block-level child elements (raw SectionChild objects)\n * @param ctx - Body context for stringification\n */\nexport function stringifyHeaderFooter(\n tag: string,\n namespaces: DocumentAttributeNamespace[],\n children: SectionChild[],\n ctx: BodyContext,\n): string {\n const attrParts: string[] = [];\n for (const ns of namespaces) {\n attrParts.push(`xmlns:${ns}=\"${escapeXml(DocumentAttributeNamespaces[ns])}\"`);\n }\n // mc:Ignorable must declare the ignorable namespaces (w14/w15/wp14) that\n // header/footer content uses (e.g. w14:paraId). Without it, Word in\n // compatibility mode 14 rejects the part as unreadable content.\n attrParts.push('mc:Ignorable=\"w14 w15 wp14\"');\n const attrStr = attrParts.join(\" \");\n\n const childParts: string[] = [];\n for (const child of children) {\n childParts.push(stringifyBodyChild(child, ctx));\n }\n\n const body = childParts.join(\"\");\n return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;\n}\n","/**\n * DOCX document compiler — pure function entry point.\n *\n * compileDocument() accepts DocumentOptions directly,\n * creates a DocxWriteContext internally, and produces a Zippable result.\n * All XML parts are produced via descriptors or serialize() —\n * no Formatter dependency.\n *\n * @module\n */\n\nimport {\n addSmartArtRelationships,\n createThemeXml,\n findAndReplaceImagePlaceholders,\n formatId,\n hasPlaceholders,\n levelForMediaName,\n optionalRelsPart,\n replaceAllPlaceholders,\n replaceNumberingPlaceholders,\n} from \"@office-open/core\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"@office-open/core\";\nimport {\n DEFAULT_DRAWING_XML,\n getColorXml,\n getLayoutXml,\n getStyleXml,\n} from \"@office-open/core/smartart\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { obfuscate } from \"@parts/fonts/obfuscate-ttf-to-odttf\";\nimport { HEADER_NAMESPACES, FOOTER_NAMESPACES, stringifyHeaderFooter } from \"@parts/header-footer\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\n\nimport { stringifyDocumentXml, stringifyBodyChild, type BodyContext } from \"./body\";\nimport { DocxWriteContext } from \"./context\";\nimport {\n corePropertiesDesc,\n customPropertiesDesc,\n appPropertiesDesc,\n contentTypesDesc,\n buildContentTypesFromRegistry,\n withAltChunkOverrides,\n withMediaDefaults,\n fontTableDesc,\n webSettingsDesc,\n commentsDesc,\n bibliographyDesc,\n settingsDesc,\n footnotesDesc,\n endnotesDesc,\n glossaryDesc,\n} from \"./parts\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\n/** XML declaration prepended to every OOXML part. */\nconst XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';\n\n/** Extended context for header/footer formatted view caching. */\ntype DocxContext = BodyContext & {\n headerFormattedViews?: Map<number, string>;\n footerFormattedViews?: Map<number, string>;\n};\n\n// ── Public API ──\n\n/**\n * Compile document options into a flat file map suitable for fflate zipSync.\n *\n * This is the primary entry point for DOCX generation — accepts DocumentOptions\n * directly.\n */\nexport function compileDocument(\n options: DocumentOptions,\n overrides: XmlifyedFile[] = [],\n mediaLevel: number = 0,\n): Zippable {\n const ctx = new DocxWriteContext(options);\n const files: Zippable = {};\n\n const headerFormattedViews = new Map<number, string>();\n const footerFormattedViews = new Map<number, string>();\n\n const xmlifiedFileMapping = xmlifyContext(ctx, headerFormattedViews, footerFormattedViews);\n const map = new Map<string, XmlifyedFile | XmlifyedFile[]>(Object.entries(xmlifiedFileMapping));\n\n for (const [, obj] of map) {\n if (obj === undefined) continue;\n if (Array.isArray(obj)) {\n for (const subFile of obj) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n } else {\n files[obj.path] = typeof obj.data === \"string\" ? encoder.encode(obj.data) : obj.data;\n }\n }\n\n for (const subFile of overrides) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n\n // Media files\n const mediaArray = ctx.media.array;\n for (const mediaData of mediaArray) {\n files[`word/media/${mediaData.fileName}`] = [\n mediaData.data as Uint8Array,\n { level: levelForMediaName(mediaData.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n if (mediaData.type === \"svg\") {\n files[`word/media/${mediaData.fallback.fileName}`] = [\n mediaData.fallback.data as Uint8Array,\n {\n level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) as ZipOptions[\"level\"],\n },\n ];\n }\n }\n\n // OLE embedding binaries (word/embeddings/oleObjectN.bin)\n for (const embedding of ctx.embeddings.array) {\n files[`word/embeddings/${embedding.fileName}`] = [\n embedding.data as Uint8Array,\n { level: levelForMediaName(embedding.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n }\n\n // Font files — only fonts carrying binary data produce a .odttf part.\n // Round-tripped fonts (rawOdttf) keep their original obfuscated bytes.\n for (const font of ctx.fontTable.fontOptionsWithKey) {\n if (font.data === undefined) continue;\n const [nameWithoutExtension] = font.name.split(\".\");\n const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;\n files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);\n }\n\n // Raw passthrough parts (word/theme/*, customXml/*, …) — generate doesn't\n // rebuild these, so copy their original bytes verbatim to keep [Content_Types]\n // declarations valid and the package openable in Word.\n for (const part of ctx._options.rawParts ?? []) {\n files[part.path] = part.data;\n }\n\n // [Content_Types].xml is serialized last: parts register their media/fonts\n // during stringify (run by xmlifyContext above), so backfilling <Default>\n // extensions from `ctx` now sees the complete set. Building it inside\n // xmlifyContext's object literal evaluated it before header/footer/font media\n // was registered, leaving jpg/gif/odttf without a covering Default.\n files[\"[Content_Types].xml\"] = encoder.encode(buildContentTypesData(ctx, files));\n\n return files;\n}\n\n// ── Internal ──\n\n/**\n * Complete mapping of all XML files in an OOXML document package.\n */\ninterface XmlifyedFileMapping {\n Document: XmlifyedFile;\n Styles: XmlifyedFile;\n Properties: XmlifyedFile;\n Numbering?: XmlifyedFile;\n Relationships: XmlifyedFile;\n FileRelationships: XmlifyedFile;\n Headers: XmlifyedFile[];\n Footers: XmlifyedFile[];\n HeaderRelationships: XmlifyedFile[];\n FooterRelationships: XmlifyedFile[];\n CustomProperties: XmlifyedFile;\n AppProperties: XmlifyedFile;\n FootNotes?: XmlifyedFile;\n FootNotesRelationships?: XmlifyedFile;\n Endnotes?: XmlifyedFile;\n EndnotesRelationships?: XmlifyedFile;\n Settings: XmlifyedFile;\n Comments?: XmlifyedFile;\n CommentsRelationships?: XmlifyedFile;\n FontTable?: XmlifyedFile;\n FontTableRelationships?: XmlifyedFile;\n Bibliography?: XmlifyedFile;\n Charts?: XmlifyedFile[];\n DiagramData?: XmlifyedFile[];\n DiagramLayout?: XmlifyedFile[];\n DiagramStyle?: XmlifyedFile[];\n DiagramColors?: XmlifyedFile[];\n DiagramDrawing?: XmlifyedFile[];\n AltChunks?: XmlifyedFile[];\n SubDocs?: XmlifyedFile[];\n Glossary?: XmlifyedFile;\n WebSettings?: XmlifyedFile;\n}\n\n/**\n * Comments carried by the document: those the caller listed explicitly\n * (`options.comments`) plus entries registered by `{ comment }` sugar children\n * during body stringification. Drives both word/comments.xml generation and the\n * [Content_Types] comments Override, which must stay in sync (OPC consistency).\n */\nfunction mergedCommentChildren(ctx: DocxWriteContext): CommentOptions[] {\n return [...(ctx._options.comments?.children ?? []), ...ctx.comments.entries];\n}\n\n/**\n * Serialize [Content_Types].xml from the part registry, then backfill media/\n * font/embedding `<Default>` entries from the parts actually written.\n *\n * Must run after every part has been stringified (parts call `ctx.addMedia`\n * during stringify), so call this once `xmlifyContext` has finished — not from\n * inside its object literal, where ContentTypes would evaluate before the\n * later-defined header/footer/font parts have registered their media.\n */\nfunction buildContentTypesData(ctx: DocxWriteContext, files: Zippable): string {\n const altChunks = ctx.altChunks.array.map((ac) => ({\n path: `/word/${ac.path}`,\n contentType: ac.contentType ?? \"application/xhtml+xml\",\n }));\n // Round-trip passes the source [Content_Types] through, but the compiler\n // regenerates altChunk part paths — realign the afchunk Overrides to the\n // freshly written parts (else O5/O6).\n const base = ctx._options.contentTypes\n ? withAltChunkOverrides(ctx._options.contentTypes, altChunks)\n : buildContentTypesFromRegistry(\n new Map<string, boolean | number>([\n [\"freshCompile\", true],\n [\"hasComments\", mergedCommentChildren(ctx).length > 0],\n [\"hasBibliography\", !!ctx._options.bibliography],\n [\"hasGlossary\", !!ctx.glossaryOptions],\n [\"hasWebSettings\", !!ctx.webSettings],\n [\"headerCount\", ctx.headers.length],\n [\"footerCount\", ctx.footers.length],\n [\"chartCount\", ctx.charts.array.length],\n [\"smartArtCount\", ctx.smartArts.array.length],\n ]),\n {\n altChunks,\n subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` })),\n },\n );\n // Backfill <Default> extensions from every part actually written to the\n // package — the parts on disk are the single source of truth, so media/font/\n // embedding defaults can never drift from what the package contains (e.g. a\n // font written via the fallback path when `odttfPath` is unset).\n const withMedia = withMediaDefaults(base, Object.keys(files));\n return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? \"\");\n}\n\nfunction xmlifyContext(\n ctx: DocxWriteContext,\n headerFormattedViews: Map<number, string>,\n footerFormattedViews: Map<number, string>,\n): XmlifyedFileMapping {\n const mkCtx = (viewWrapper: DocxContext[\"viewWrapper\"] = ctx.document): DocxContext => ({\n fileData: ctx,\n file: ctx,\n viewWrapper,\n stringifyChild: stringifyBodyChild,\n addRelationship: (type: string, target: string, mode?: string) =>\n ctx.addRelationship(type, target, mode),\n addMedia: (data: Uint8Array, type: string) => ctx.addMedia(data, type),\n });\n\n const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;\n // Per-part media-replacement results shared between the .rels pass and the\n // body-XML pass so both use identical rId offsets. Each header/footer part\n // has its own relationship numbering (independent of the document part).\n const footerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const headerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const docCtx = mkCtx(ctx.document);\n const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, docCtx);\n\n // Comments is an optional part — skip it entirely (no comments.xml, no\n // comments rels, no [Content_Types] Override) when the document carries none.\n // Emitting an empty comments.xml with a dangling relationship is the OPC\n // violation that makes Word reject the package on open.\n const mergedCommentChildrenList = mergedCommentChildren(ctx);\n const hasComments = mergedCommentChildrenList.length > 0;\n const commentRelationshipCount = hasComments\n ? ctx.comments.relationships.relationshipCount + 1\n : 0;\n const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;\n const commentXmlData = commentCtx\n ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx)\n : \"\";\n\n const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;\n const footnoteCtx = mkCtx({\n relationships: ctx.footNotes.relationships,\n });\n const footnoteXmlData =\n XML_DECL +\n (footnotesDesc.stringify(\n {\n notes: ctx.footNotes.notes,\n separator: ctx.footNotes.separator,\n continuationSeparator: ctx.footNotes.continuationSeparator,\n },\n footnoteCtx,\n ) ?? \"\");\n\n const documentMedia = findAndReplaceImagePlaceholders(\n documentXmlData,\n ctx.media.array,\n documentRelationshipCount,\n );\n // OLE embeddings reuse the same {fileName} placeholder bridge as images; run\n // after media so {oleObjectN.bin} placeholders resolve against the embedding array.\n const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;\n const documentEmbeddings = findAndReplaceImagePlaceholders(\n documentMedia.xml,\n ctx.embeddings.array,\n documentEmbeddingOffset,\n );\n const commentMedia = hasComments\n ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount)\n : { xml: \"\", referenced: [] as { fileName: string }[] };\n const footnoteMedia = findAndReplaceImagePlaceholders(\n footnoteXmlData,\n ctx.media.array,\n footnoteRelationshipCount,\n );\n // Register footnote media relationships eagerly so the relationshipCount used\n // to gate footnotes.xml.rels reflects the final state (see FootNotesRelationships).\n for (let i = 0; i < footnoteMedia.referenced.length; i++) {\n ctx.footNotes.relationships.addRelationship(\n footnoteRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footnoteMedia.referenced[i].fileName}`,\n );\n }\n\n return {\n AppProperties: {\n data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? \"\"),\n path: \"docProps/app.xml\",\n },\n ...(hasComments\n ? {\n Comments: {\n data: (() => {\n const xmlData =\n commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/comments.xml\",\n },\n CommentsRelationships: (() => {\n for (let i = 0; i < commentMedia.referenced.length; i++) {\n ctx.comments.relationships.addRelationship(\n commentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${commentMedia.referenced[i].fileName}`,\n );\n }\n return optionalRelsPart(\n ctx.comments.relationships,\n XML_DECL,\n \"word/_rels/comments.xml.rels\",\n );\n })(),\n }\n : {}),\n CustomProperties: {\n data:\n XML_DECL +\n (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ??\n \"\"),\n path: \"docProps/custom.xml\",\n },\n Document: {\n data: (() => {\n let xmlData = documentEmbeddings.xml;\n if (hasPlaceholders(xmlData)) {\n const mediaCount = documentMedia.referenced.length;\n const embeddingCount = documentEmbeddings.referenced.length;\n const chartKeys = ctx.charts.array.map((c) => c.key);\n const smartArtKeys = ctx.smartArts.array.map((s) => s.key);\n const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;\n const smartArtOffset = chartOffset + chartKeys.length;\n\n // Build combined replacement entries for charts, smartart, and numbering\n const entries: Array<{ prefix?: string; key: string; value: string }> = [];\n for (let i = 0; i < chartKeys.length; i++) {\n entries.push({\n prefix: \"chart:\",\n key: chartKeys[i],\n value: formatId(chartOffset, i, \"rId\"),\n });\n }\n const saPrefixes = [\"smartart:\", \"smartart-lo:\", \"smartart-qs:\", \"smartart-cs:\"];\n for (let i = 0; i < smartArtKeys.length; i++) {\n for (let p = 0; p < saPrefixes.length; p++) {\n entries.push({\n prefix: saPrefixes[p],\n key: smartArtKeys[i],\n value: formatId(smartArtOffset + p * smartArtKeys.length, i, \"rId\"),\n });\n }\n }\n for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) {\n entries.push({ key: `${reference}-${instance}`, value: numId.toString() });\n }\n xmlData = replaceAllPlaceholders(xmlData, entries);\n } else {\n xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n }\n return xmlData;\n })(),\n path: \"word/document.xml\",\n },\n // Theme — fresh-compile emits a language-neutral default theme\n // (createThemeXml). Round-trip carries the source theme in rawParts,\n // already copied verbatim above, so skip emitting here to avoid a duplicate.\n ...(ctx._options.rawParts?.some((part) => part.path.startsWith(\"word/theme/\"))\n ? {}\n : {\n Theme: {\n data: XML_DECL + createThemeXml(),\n path: \"word/theme/theme1.xml\",\n },\n }),\n ...(ctx.hasEndnotes\n ? {\n Endnotes: {\n data: (() => {\n const endnoteCtx = mkCtx({\n relationships: ctx.endnotes.relationships,\n });\n const xmlData =\n XML_DECL +\n (endnotesDesc.stringify(\n {\n notes: ctx.endnotes.notes,\n separator: ctx.endnotes.separator,\n continuationSeparator: ctx.endnotes.continuationSeparator,\n },\n endnoteCtx,\n ) ?? \"\");\n const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;\n const endnoteMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n endnoteRelCount,\n );\n if (endnoteMedia.referenced.length > 0) {\n for (let i = 0; i < endnoteMedia.referenced.length; i++) {\n ctx.endnotes.relationships.addRelationship(\n endnoteRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${endnoteMedia.referenced[i].fileName}`,\n );\n }\n return replaceNumberingPlaceholders(\n endnoteMedia.xml,\n ctx.numbering.concreteNumbering,\n );\n }\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/endnotes.xml\",\n },\n EndnotesRelationships:\n ctx.endnotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.endnotes.relationships.serialize(),\n path: \"word/_rels/endnotes.xml.rels\",\n }\n : undefined,\n }\n : {}),\n FileRelationships: {\n data: XML_DECL + ctx.fileRelationships.serialize(),\n path: \"_rels/.rels\",\n },\n FontTable: {\n data:\n XML_DECL +\n (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? \"\"),\n path: \"word/fontTable.xml\",\n },\n FontTableRelationships: optionalRelsPart(\n ctx.fontTable.relationships,\n XML_DECL,\n \"word/_rels/fontTable.xml.rels\",\n ),\n ...(ctx.hasFootnotes\n ? {\n FootNotes: {\n data: (() => {\n const xmlData =\n footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/footnotes.xml\",\n },\n FootNotesRelationships:\n ctx.footNotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.footNotes.relationships.serialize(),\n path: \"word/_rels/footnotes.xml.rels\",\n }\n : undefined,\n }\n : {}),\n FooterRelationships: ctx.footers\n .map((entry, index) => {\n const footerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:ftr\", FOOTER_NAMESPACES, entry.children, footerCtx);\n footerFormattedViews.set(index, xmlData);\n // Footer images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const footerRelCount = entry.relationships.relationshipCount + 1;\n const footerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n footerRelCount,\n );\n footerMediaResults.set(index, footerMedia);\n\n for (let i = 0; i < footerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n footerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/footer${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Footers: ctx.footers.map((_entry, index) => {\n const footerMedia = footerMediaResults.get(index)!;\n const tempXmlData = footerFormattedViews.get(index)!;\n const xmlData = footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/footer${index + 1}.xml`,\n };\n }),\n HeaderRelationships: ctx.headers\n .map((entry, index) => {\n const headerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:hdr\", HEADER_NAMESPACES, entry.children, headerCtx);\n headerFormattedViews.set(index, xmlData);\n // Header images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const headerRelCount = entry.relationships.relationshipCount + 1;\n const headerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n headerRelCount,\n );\n headerMediaResults.set(index, headerMedia);\n\n for (let i = 0; i < headerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n headerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${headerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/header${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Headers: ctx.headers.map((_entry, index) => {\n const headerMedia = headerMediaResults.get(index)!;\n const tempXmlData = headerFormattedViews.get(index)!;\n const xmlData = headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/header${index + 1}.xml`,\n };\n }),\n ...(ctx.hasNumbering\n ? {\n Numbering: {\n data: ctx.numbering.serialize(),\n path: \"word/numbering.xml\",\n },\n }\n : {}),\n Properties: {\n data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? \"\"),\n path: \"docProps/core.xml\",\n },\n Relationships: {\n data: (() => {\n for (let i = 0; i < documentMedia.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${documentMedia.referenced[i].fileName}`,\n );\n }\n for (let i = 0; i < documentEmbeddings.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentEmbeddingOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\",\n `embeddings/${documentEmbeddings.referenced[i].fileName}`,\n );\n }\n\n const chartOffset =\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length;\n for (let i = 0; i < ctx.charts.array.length; i++) {\n ctx.document.relationships.addRelationship(\n chartOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `charts/chart${i + 1}.xml`,\n );\n }\n\n addSmartArtRelationships(\n ctx.smartArts.array.map((s) => s.key),\n (id, type, target) => {\n ctx.document.relationships.addRelationship(id, type, target);\n },\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length +\n ctx.charts.array.length,\n 0,\n {\n pathPrefix: \"\",\n styleRelType: \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\",\n },\n );\n\n ctx.document.relationships.addRelationship(\n ctx.document.relationships.relationshipCount + 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\",\n \"fontTable.xml\",\n );\n\n return XML_DECL + ctx.document.relationships.serialize();\n })(),\n path: \"word/_rels/document.xml.rels\",\n },\n Settings: {\n data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? \"\"),\n path: \"word/settings.xml\",\n },\n Styles: {\n data: (() => {\n const xmlStyles = ctx.styles.serialize();\n return replaceNumberingPlaceholders(xmlStyles, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/styles.xml\",\n },\n ...(ctx._options.bibliography\n ? {\n Bibliography: {\n data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? \"\"),\n path: \"word/bibliography.xml\",\n },\n }\n : {}),\n ...(ctx.charts.array.length > 0\n ? {\n Charts: ctx.charts.array.map((chartData, i) => ({\n data: XML_DECL + chartData.chartSpaceXml,\n path: `word/charts/chart${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.smartArts.array.length > 0\n ? {\n DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({\n data: XML_DECL + smartArtData.dataModelXml,\n path: `word/diagrams/data${i + 1}.xml`,\n })),\n DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getLayoutXml(smartArtData.layout),\n path: `word/diagrams/layout${i + 1}.xml`,\n })),\n DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getStyleXml(smartArtData.style),\n path: `word/diagrams/quickStyle${i + 1}.xml`,\n })),\n DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getColorXml(smartArtData.color),\n path: `word/diagrams/colors${i + 1}.xml`,\n })),\n DiagramDrawing: ctx.smartArts.array.map((_, i) => ({\n data: DEFAULT_DRAWING_XML,\n path: `word/diagrams/drawing${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.altChunks.array.length > 0\n ? {\n AltChunks: ctx.altChunks.array.map((altChunkData) => ({\n data: altChunkData.data,\n path: `word/${altChunkData.path}`,\n })),\n }\n : {}),\n ...(ctx.subDocs.array.length > 0\n ? {\n SubDocs: ctx.subDocs.array.map((subDocData) => ({\n data: subDocData.data,\n path: `word/${subDocData.path}`,\n })),\n }\n : {}),\n ...(ctx.glossaryOptions\n ? {\n Glossary: {\n data: (() => {\n const glossaryCtx = mkCtx(undefined);\n return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions!, glossaryCtx) ?? \"\");\n })(),\n path: \"word/glossary/document.xml\",\n },\n }\n : {}),\n ...(ctx.webSettings\n ? {\n WebSettings: {\n data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? \"\"),\n path: \"word/webSettings.xml\",\n },\n }\n : {}),\n };\n}\n","/**\n * Pure function API for generating DOCX files.\n *\n * @module\n */\n\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\nimport type { OutputByType, OutputType, PackerOptions } from \"@office-open/core\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\n\nimport { compileDocument } from \"./compiler\";\n\n/** @internal Packer instance for DOCX generation. */\nconst Packer = createPacker<DocumentOptions>({\n compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),\n mimeType: OoxmlMimeType.DOCX,\n});\n\n/**\n * Generate a DOCX file from pure JSON options.\n *\n * The output format is controlled by `packerOptions.type` (default: `\"nodebuffer\"` → Buffer).\n * For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.\n *\n * @param options - Document options (sections, styles, numbering, etc.)\n * @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)\n *\n * @example\n * ```typescript\n * import { generateDocument } from \"@office-open/docx\";\n *\n * const buffer = await generateDocument({ sections: [...] });\n * const bytes = await generateDocument({ sections: [...] }, { type: \"uint8array\" });\n * const blob = await generateDocument({ sections: [...] }, { type: \"blob\" });\n * ```\n */\nexport function generateDocument<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): Promise<OutputByType[T]> {\n return Packer.pack(options, packerOptions) as Promise<OutputByType[T]>;\n}\n\n/**\n * Synchronously generate a DOCX file from pure JSON options.\n */\nexport function generateDocumentSync<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): OutputByType[T] {\n return Packer.packSync(options, packerOptions) as OutputByType[T];\n}\n\n/**\n * Generate a DOCX file as a `ReadableStream<Uint8Array>`.\n */\nexport function generateDocumentStream(\n options: DocumentOptions,\n packerOptions?: PackerOptions,\n): ReadableStream<Uint8Array> {\n return Packer.toStream(options, packerOptions);\n}\n"],"mapp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/C;;;;AAKA,SAAgB,uBACd,SACA,eAC4B;CAC5B,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C"}

Sorry, the diff of this file is too big to display

{"version":3,"file":"parse-DDWWDGbX.mjs","names":[],"sources":["../src/parts/alt-chunk/alt-chunk-parse.ts","../src/parts/custom-xml/custom-xml-parse.ts","../src/parts/sub-doc/sub-doc-parse.ts","../src/parts/textbox/textbox-parse.ts","../src/parse/body.ts","../src/parse.ts"],"sourcesContent":["/**\n * AltChunk parser for DOCX documents.\n *\n * Parses w:altChunk elements and extracts embedded content from the ZIP.\n *\n * @module\n */\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { AltChunkOptions } from \"@parts/alt-chunk/alt-chunk\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse a w:altChunk element into AltChunkOptions.\n * Reads the referenced data from the ZIP package.\n */\nexport function parseAltChunk(el: Element, ctx: DocxReadContext): AltChunkOptions {\n const rId = attr(el, \"r:id\");\n if (!rId) {\n throw new Error(\"w:altChunk missing r:id attribute\");\n }\n\n // Look up the path from relationships\n const path = ctx.docx.partRefs.afChunks.get(rId);\n if (!path) {\n throw new Error(`AltChunk relationship ${rId} not found`);\n }\n\n // Read raw data from ZIP\n const data = ctx.docx.doc.getRaw(path);\n if (!data) {\n throw new Error(`AltChunk data not found at ${path}`);\n }\n\n // Determine content type from extension\n const ext = path.split(\".\").pop() ?? \"txt\";\n let contentType: \"text/html\" | \"application/rtf\" | \"text/plain\";\n let extension: \"html\" | \"rtf\" | \"txt\";\n\n switch (ext) {\n case \"html\":\n contentType = \"text/html\";\n extension = \"html\";\n break;\n case \"rtf\":\n contentType = \"application/rtf\";\n extension = \"rtf\";\n break;\n default:\n contentType = \"text/plain\";\n extension = \"txt\";\n break;\n }\n\n return {\n data,\n contentType,\n extension,\n };\n}\n","/**\n * Parser for custom XML block elements (w:customXml).\n *\n * @module\n */\nimport { attr, findChild } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport type { DocxReadContext } from \"../../context\";\nimport { parseCustomXmlProperties } from \"../bodychildren\";\nimport type { CustomXmlBlockOptions } from \"./custom-xml\";\n\n/**\n * Parse w:customXml element into CustomXmlBlockOptions.\n *\n * Uses a callback for child parsing to avoid circular dependencies\n * (same pattern as parseTable).\n */\nexport function parseCustomXmlBlock(\n el: Element,\n ctx: DocxReadContext,\n parseChild: (el: Element, ctx: DocxReadContext) => SectionChild,\n): CustomXmlBlockOptions {\n const opts: Partial<CustomXmlBlockOptions> = {};\n\n // Required attribute\n const element = attr(el, \"w:element\");\n if (element) opts.element = element;\n\n // Optional URI\n const uri = attr(el, \"w:uri\");\n if (uri) opts.uri = uri;\n\n // Parse w:customXmlPr\n const xmlPr = findChild(el, \"w:customXmlPr\");\n if (xmlPr) {\n opts.customXmlPr = parseCustomXmlProperties(xmlPr);\n }\n\n // Parse block-level children\n const children: SectionChild[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"w:customXmlPr\") continue;\n const parsed = parseChild(child, ctx);\n children.push(parsed);\n }\n if (children.length > 0) opts.children = children;\n\n return opts as CustomXmlBlockOptions;\n}\n","/**\n * SubDoc parser for DOCX documents.\n *\n * Parses w:subDoc elements and extracts embedded document data.\n *\n * @module\n */\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { SubDocOptions } from \"@parts/sub-doc/sub-doc\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse a w:subDoc element into SubDocOptions.\n * Reads the referenced document data from the ZIP package.\n */\nexport function parseSubDoc(el: Element, ctx: DocxReadContext): SubDocOptions {\n const rId = attr(el, \"r:id\");\n if (!rId) {\n throw new Error(\"w:subDoc missing r:id attribute\");\n }\n\n const path = ctx.docx.partRefs.subDocs.get(rId);\n if (!path) {\n throw new Error(`SubDoc relationship ${rId} not found`);\n }\n\n const data = ctx.docx.doc.getRaw(path);\n if (!data) {\n throw new Error(`SubDoc data not found at ${path}`);\n }\n\n return { data };\n}\n","/**\n * Textbox parser for DOCX documents.\n *\n * Parses w:pict → v:shape → v:textbox → w:txbxContent elements.\n *\n * @module\n */\nimport { attr, findChild, findFirst } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse VML shape style string into VmlShapeStyle-like object.\n */\nfunction parseVmlStyle(styleStr: string): Record<string, string> {\n const style: Record<string, string> = {};\n for (const part of styleStr.split(\";\")) {\n const [key, val] = part.split(\":\").map((s) => s.trim());\n if (key && val) style[key] = val;\n }\n return style;\n}\n\n/**\n * Parse a w:pict element that contains a textbox.\n * Returns an object suitable for the { textbox: ... } SectionChild variant.\n */\nexport function parseTextbox(\n el: Element,\n ctx: DocxReadContext,\n parseChildren: (elements: Element[], ctx: DocxReadContext) => unknown[],\n): {\n style?: Record<string, string>;\n children?: unknown[];\n} {\n const shape = findFirst(el, \"v:shape\");\n if (!shape) return {};\n\n const opts: Record<string, unknown> = {};\n\n // Parse VML style\n const styleAttr = attr(shape, \"style\");\n if (styleAttr) {\n opts.style = parseVmlStyle(styleAttr);\n }\n\n // Parse textbox content\n const textbox = findFirst(shape, \"v:textbox\");\n if (textbox) {\n const txbxContent = findChild(textbox, \"w:txbxContent\");\n if (txbxContent) {\n const childList = parseChildren(txbxContent.elements ?? [], ctx);\n if (childList.length > 0) opts.children = childList;\n }\n }\n\n return opts as { style?: Record<string, string>; children?: unknown[] };\n}\n","/**\n * Body parser for DOCX documents.\n *\n * Parses w:body → SectionOptions[] by splitting at w:sectPr boundaries.\n *\n * @module\n */\nimport { attr, findChild, findDeep, findFirst, textOf } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { parseAltChunk } from \"@parts/alt-chunk/alt-chunk-parse\";\nimport { parseCustomXmlBlock } from \"@parts/custom-xml/custom-xml-parse\";\nimport { parseSectionPropertiesEl } from \"@parts/document/body/section-properties/descriptor\";\nimport type { SectionPropertiesOptions } from \"@parts/document/body/section-properties/section-properties\";\nimport type { MarkupRangeOptions, BookmarkStartOptions } from \"@parts/paragraph/links/bookmark\";\nimport { parseSdtBlock } from \"@parts/sdt/sdt-parse\";\nimport { parseSubDoc } from \"@parts/sub-doc/sub-doc-parse\";\nimport {\n parseToc,\n parseTocFieldFromElements,\n selectTocEntryElements,\n} from \"@parts/table-of-contents/toc-parse\";\nimport { tableDesc } from \"@parts/table/descriptor\";\nimport type { TableOptions } from \"@parts/table/table\";\nimport { parseTextbox } from \"@parts/textbox/textbox-parse\";\nimport type { SectionOptions } from \"@shared/section\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { parseParagraph } from \"../body\";\nimport { DocxReadContext } from \"../context\";\nimport { setBodyParseChild } from \"../parts\";\nimport { stringifyElement } from \"../util/stringify-element\";\n\n// ── Section properties parser ────────────────────────────────────────────────\n\n/** Internal parse result: section properties with extracted header/footer refs. */\ntype ParsedSectionProperties = SectionPropertiesOptions & {\n parsedHeaders?: Record<string, SectionChild[]>;\n parsedFooters?: Record<string, SectionChild[]>;\n};\n\n/**\n * Parse w:sectPr element into SectionPropertiesOptions.\n * Delegates to the section properties descriptor's parse method.\n */\nfunction parseSectionProperties(el: Element, ctx: DocxReadContext): ParsedSectionProperties {\n const opts: ParsedSectionProperties = parseSectionPropertiesEl(el);\n\n // Headers/footers - parse from references and store in a separate field\n const headerRefs: Record<string, SectionChild[]> = {};\n const footerRefs: Record<string, SectionChild[]> = {};\n\n for (const child of el.elements ?? []) {\n if (child.name === \"w:headerReference\") {\n const rId = attr(child, \"r:id\");\n const type = attr(child, \"w:type\");\n if (rId && type) {\n const headerChildren = parseHeaderFooterRef(rId, ctx);\n if (headerChildren) headerRefs[type] = headerChildren;\n }\n }\n if (child.name === \"w:footerReference\") {\n const rId = attr(child, \"r:id\");\n const type = attr(child, \"w:type\");\n if (rId && type) {\n const footerChildren = parseHeaderFooterRef(rId, ctx);\n if (footerChildren) footerRefs[type] = footerChildren;\n }\n }\n }\n\n if (Object.keys(headerRefs).length > 0) {\n opts.parsedHeaders = headerRefs;\n }\n if (Object.keys(footerRefs).length > 0) {\n opts.parsedFooters = footerRefs;\n }\n\n return opts;\n}\n\n/**\n * Parse a header/footer reference by following the relationship to its XML part.\n */\nfunction parseHeaderFooterRef(rId: string, ctx: DocxReadContext): SectionChild[] | undefined {\n const path = ctx.docx.partRefs.headers.get(rId) ?? ctx.docx.partRefs.footers.get(rId);\n if (!path) return undefined;\n\n const partEl = ctx.docx.doc.get(path);\n if (!partEl) return undefined;\n\n // The header/footer XML root element contains w:p, w:tbl, etc. Parse under\n // the part's own relationship scope so its drawings resolve images correctly.\n const children: SectionChild[] = [];\n ctx.withPart(path, () => {\n for (const child of partEl.elements ?? []) {\n const sectionChild = parseSectionChild(child, ctx);\n if (sectionChild !== undefined) {\n children.push(sectionChild);\n }\n }\n });\n\n return children.length > 0 ? children : undefined;\n}\n\n// ── Section child dispatch ───────────────────────────────────────────────────\n\n/**\n * Parse a single body child element into a SectionChild.\n */\nexport function parseSectionChild(el: Element, ctx: DocxReadContext): SectionChild {\n switch (el.name) {\n case \"w:p\": {\n // Check for textbox (w:pict containing v:textbox)\n const pict = findChild(el, \"w:pict\");\n if (pict) {\n const textbox = findFirst(pict, \"v:textbox\");\n if (textbox) {\n const textboxOpts = parseTextbox(pict, ctx, parseSectionChildrenElements);\n return { textbox: textboxOpts as SectionChild extends { textbox: infer T } ? T : never };\n }\n }\n\n return { paragraph: parseParagraph(el, ctx) };\n }\n case \"w:tbl\":\n return { table: tableDesc.parse(el, ctx) as TableOptions };\n case \"w:sdt\": {\n // Try TOC first\n const tocResult = parseToc(el, ctx, parseSectionChildrenElements);\n if (tocResult) {\n return { toc: tocResult };\n }\n // Otherwise parse as generic SDT block\n const sdtResult = parseSdtBlock(el, ctx, parseSectionChildrenElements);\n return {\n sdt: {\n properties: sdtResult.properties,\n children: sdtResult.children as SectionChild[] | undefined,\n },\n };\n }\n case \"w:altChunk\":\n return { altChunk: parseAltChunk(el, ctx) };\n case \"w:subDoc\":\n return { subDoc: parseSubDoc(el, ctx) };\n case \"w:customXml\":\n return { customXml: parseCustomXmlBlock(el, ctx, parseSectionChild) };\n case \"w:bookmarkStart\": {\n // Body-level range markers sitting between paragraphs (e.g. _Toc bookmark\n // ends grouped after a heading). Carry them as first-class children so\n // they round-trip even though they are not wrapped in a paragraph.\n const idRaw = attr(el, \"w:id\");\n const name = attr(el, \"w:name\");\n if (idRaw !== undefined && name) {\n const bookmarkStart: Partial<BookmarkStartOptions> = { id: Number(idRaw), name };\n const disp = attr(el, \"w:displacedByCustomXml\");\n if (disp === \"before\" || disp === \"after\") bookmarkStart.displacedByCustomXml = disp;\n const colFirstRaw = attr(el, \"w:colFirst\");\n if (colFirstRaw !== undefined) bookmarkStart.colFirst = Number(colFirstRaw);\n const colLastRaw = attr(el, \"w:colLast\");\n if (colLastRaw !== undefined) bookmarkStart.colLast = Number(colLastRaw);\n return { bookmarkStart: bookmarkStart as BookmarkStartOptions };\n }\n return { rawXml: stringifyElement(el) };\n }\n case \"w:bookmarkEnd\": {\n const idRaw = attr(el, \"w:id\");\n if (idRaw !== undefined) {\n const bookmarkEnd: Partial<MarkupRangeOptions> = { id: Number(idRaw) };\n const disp = attr(el, \"w:displacedByCustomXml\");\n if (disp === \"before\" || disp === \"after\") bookmarkEnd.displacedByCustomXml = disp;\n return { bookmarkEnd: bookmarkEnd as MarkupRangeOptions };\n }\n return { rawXml: stringifyElement(el) };\n }\n default:\n return { rawXml: stringifyElement(el) };\n }\n}\n\n// ── Body parsing with section splitting ───────────────────────────────────────\n\n/**\n * Parse w:body element into SectionOptions[].\n *\n * Splits body content at w:sectPr boundaries to create sections.\n * The last w:sectPr (child of w:body directly) defines the last section.\n * Previous w:sectPr elements appear inside w:pPr elements.\n */\nexport function parseBody(body: Element, ctx: DocxReadContext): SectionOptions[] {\n // Register the body child parser for descriptor parse callbacks\n setBodyParseChild(parseSectionChild);\n\n // Collect body children and detect section breaks\n interface SectionBoundary {\n index: number;\n sectPr: Element;\n }\n\n const bodyChildren: Element[] = [];\n const boundaries: SectionBoundary[] = [];\n\n for (const child of body.elements ?? []) {\n if (child.name === \"w:sectPr\") {\n // Final section properties (last section)\n boundaries.push({ index: bodyChildren.length, sectPr: child });\n } else {\n bodyChildren.push(child);\n\n // Check for inline sectPr in paragraph properties\n if (child.name === \"w:p\") {\n const pPr = findChild(child, \"w:pPr\");\n if (pPr) {\n const sectPr = findChild(pPr, \"w:sectPr\");\n if (sectPr) {\n boundaries.push({ index: bodyChildren.length, sectPr });\n }\n }\n }\n }\n }\n\n // If no boundaries, the whole body is one section\n if (boundaries.length === 0) {\n return [\n {\n children: parseBodyChildren(bodyChildren, ctx),\n },\n ];\n }\n\n // Split into sections\n const sections: SectionOptions[] = [];\n let start = 0;\n\n for (let i = 0; i < boundaries.length; i++) {\n const boundary = boundaries[i];\n // A sectPr inside a paragraph's pPr marks that paragraph as the final\n // content paragraph of its section. Its runs/drawings ARE section content\n // (e.g. an inline image), so include it in the slice — the paragraph parser\n // ignores pPr/w:sectPr, and stringify re-injects the sectPr into this same\n // paragraph's pPr. The last boundary is a body-level sectPr (never in a\n // paragraph), so boundary.index already points past every real child.\n const endIdx = boundary.index;\n const sectionElements = bodyChildren.slice(start, endIdx);\n const parsedProps = parseSectionProperties(boundary.sectPr, ctx);\n\n // Extract headers/footers that were stored as parsedHeaders/parsedFooters\n const { parsedHeaders, parsedFooters } = parsedProps;\n\n // Build clean properties without internal fields\n const cleanProps = { ...parsedProps };\n delete cleanProps.parsedHeaders;\n delete cleanProps.parsedFooters;\n\n const section = {\n children: parseBodyChildren(sectionElements, ctx),\n properties: cleanProps,\n ...(parsedHeaders ? { headers: parsedHeaders } : {}),\n ...(parsedFooters ? { footers: parsedFooters } : {}),\n } as SectionOptions;\n\n sections.push(section);\n start = boundary.index;\n }\n\n // If there are elements after the last boundary, they form the last section\n // with the body-level w:sectPr (already captured)\n // Actually the body-level sectPr IS the last boundary\n\n return sections;\n}\n\n// ── Cross-paragraph TOC field aggregation ───────────────────────────────────\n\n/**\n * Net field-nesting change across all descendant fldChar markers\n * (begin: +1, end: -1). Balances cross-paragraph field boundaries without a\n * stack — the running depth hits 0 exactly when the outermost field closes.\n */\nfunction countFieldDelta(el: Element): number {\n let delta = 0;\n const walk = (node: Element): void => {\n if (node.name === \"w:fldChar\") {\n const type = attr(node, \"w:fldCharType\");\n if (type === \"begin\") delta += 1;\n else if (type === \"end\") delta -= 1;\n }\n for (const c of node.elements ?? []) {\n if (c.type === \"element\") walk(c);\n }\n };\n walk(el);\n return delta;\n}\n\n/**\n * True when a w:p opens a bare TOC complex field: it carries a fldChar begin\n * whose instrText starts with \"TOC\". Such fields span multiple paragraphs and\n * defeat the per-paragraph field accumulator, so they are aggregated as rawXml.\n */\nfunction isTocFieldBegin(el: Element): boolean {\n if (el.name !== \"w:p\") return false;\n let hasBegin = false;\n let instr = \"\";\n const walk = (node: Element): void => {\n if (node.name === \"w:fldChar\" && attr(node, \"w:fldCharType\") === \"begin\") hasBegin = true;\n if (node.name === \"w:instrText\") instr += textOf(node);\n for (const c of node.elements ?? []) {\n if (c.type === \"element\") walk(c);\n }\n };\n walk(el);\n return hasBegin && instr.trim().toUpperCase().startsWith(\"TOC\");\n}\n\n/**\n * Parse a run of body-level elements into SectionChild[], aggregating any\n * cross-paragraph TOC complex field into a single rawXml child so its nested\n * HYPERLINK/PAGEREF fields and bookmark markers round-trip intact.\n */\nfunction parseBodyChildren(elements: Element[], ctx: DocxReadContext): SectionChild[] {\n const children: SectionChild[] = [];\n let tocBuffer: Element[] | null = null;\n let tocDepth = 0;\n\n const flushToc = (): void => {\n if (!tocBuffer) return;\n children.push(buildTocChild(tocBuffer, ctx));\n // buildTocChild preserves the rendered entries (paragraphs between the\n // separate and end markers) but not the end-closing paragraph, which often\n // carries a trailing page break (the section break before the first\n // heading). Rescue that page break as a standalone child to avoid silently\n // dropping it on round-trip.\n const lastEl = tocBuffer[tocBuffer.length - 1];\n const pageBreakCount = findDeep(lastEl, \"w:br\").filter(\n (b) => attr(b, \"w:type\") === \"page\",\n ).length;\n for (let i = 0; i < pageBreakCount; i++) {\n children.push({ paragraph: { children: [{ pageBreak: true }] } });\n }\n tocBuffer = null;\n tocDepth = 0;\n };\n\n for (const el of elements) {\n if (tocBuffer !== null) {\n tocBuffer.push(el);\n tocDepth += countFieldDelta(el);\n if (tocDepth <= 0) flushToc();\n continue;\n }\n if (isTocFieldBegin(el)) {\n tocBuffer = [el];\n tocDepth = countFieldDelta(el);\n if (tocDepth <= 0) flushToc();\n continue;\n }\n children.push(parseSectionChild(el, ctx));\n }\n\n // Unclosed TOC field at end of content — flush what we have (best effort).\n flushToc();\n\n return children;\n}\n\n/**\n * Build a structured TOC SectionChild from a captured bare TOC field. Extracts\n * the field instruction (switches → TableOfContentsOptions) and preserves the\n * rendered entries (separate→end paragraphs) structurally so MS Office and WPS\n * both display the existing TOC. The field is emitted clean (no dirty flag).\n */\nfunction buildTocChild(els: Element[], ctx: DocxReadContext): SectionChild {\n const tocOpts = parseTocFieldFromElements(els);\n const entryEls = selectTocEntryElements(els);\n if (entryEls.length > 0) {\n tocOpts.entries = entryEls.map((el) => parseSectionChild(el, ctx));\n }\n return { toc: tocOpts };\n}\n\n/**\n * Parse a list of elements into SectionChild[].\n * Used by SDT and textbox parsers for their content.\n */\nfunction parseSectionChildrenElements(elements: Element[], ctx: DocxReadContext): SectionChild[] {\n return parseBodyChildren(elements, ctx);\n}\n","import type { ParsedArchive } from \"@office-open/core\";\nimport { parseArchive } from \"@office-open/core\";\nimport type { DataType } from \"@office-open/core\";\nimport { toUint8Array } from \"@office-open/core\";\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { appPropertiesDesc } from \"@parts/app-properties\";\nimport { bibliographyDesc } from \"@parts/bibliography\";\nimport { setBodyParseChild } from \"@parts/bodychildren\";\nimport { commentsDesc } from \"@parts/comments\";\nimport { contentTypesDesc } from \"@parts/contenttypes\";\nimport { corePropertiesDesc } from \"@parts/core-properties\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { customPropertiesDesc } from \"@parts/custom-properties\";\nimport { endnotesDesc } from \"@parts/endnotes/descriptor\";\nimport { fontTableDesc } from \"@parts/fonts/descriptor\";\nimport type { EmbeddedFontOptionsWithKey } from \"@parts/fonts/font-wrapper\";\nimport { footnotesDesc } from \"@parts/footnotes/descriptor\";\nimport { glossaryDesc } from \"@parts/glossary-document\";\nimport { parseNumberingDefinitions } from \"@parts/numbering/numbering\";\nimport { settingsDesc } from \"@parts/settings/descriptor\";\nimport { buildStyleCache, buildNumberingCache, parseStyleDefinitions } from \"@parts/styles/styles\";\nimport { setTableParseChild } from \"@parts/table/descriptor\";\nimport { webSettingsDesc } from \"@parts/web-settings\";\n\nimport { parseParagraphProperties } from \"./body\";\nimport { DocxReadContext } from \"./context\";\nimport { parseBody, parseSectionChild } from \"./parse/body\";\nimport { replaceRelsWithPlaceholders } from \"./util/replace-media-placeholders\";\nimport { stringifyElement } from \"./util/stringify-element\";\n\nexport { parseArchive };\n\n/**\n * All part paths extracted from the DOCX package.\n * Field names correspond directly to the OOXML directory structure.\n */\nexport interface DocxPartRefs {\n /** word/headerN.xml keyed by rId */\n headers: Map<string, string>;\n /** word/footerN.xml keyed by rId */\n footers: Map<string, string>;\n /** word/footnotes.xml */\n footnotes?: string;\n /** word/endnotes.xml */\n endnotes?: string;\n /** word/comments.xml */\n comments?: string;\n /** Hyperlink targets keyed by rId (external URLs) */\n hyperlinks: Map<string, string>;\n /** word/charts/chartN.xml keyed by rId */\n charts: Map<string, string>;\n /** word/diagrams/dataN.xml keyed by rId */\n diagramData: Map<string, string>;\n /** word/media/* keyed by rId (from document.xml.rels) */\n media: Map<string, string>;\n /**\n * Per-part image/media relationships. Each part (document, headers, footers,\n * footnotes, …) has its own .rels with independent rId numbering, so drawings\n * inside a part must resolve images against that part's rels. Maps\n * partPath → (rId → mediaPath).\n */\n partMedia: Map<string, Map<string, string>>;\n /** Alternative format chunks (word/afchunkN.*) keyed by rId */\n afChunks: Map<string, string>;\n /** Sub-documents (word/subdocs/subdocN.docx) keyed by rId */\n subDocs: Map<string, string>;\n /** word/bibliography.xml */\n bibliography?: string;\n /** word/glossary/document.xml */\n glossary?: string;\n}\n\nexport interface DocxDocument {\n doc: ParsedArchive;\n /** word/document.xml → root w:document element */\n documentRoot: Element;\n /** word/document.xml → w:body element */\n body: Element;\n /** word/document.xml → w:background element */\n background?: Element;\n /** word/styles.xml */\n styles?: Element;\n /** word/numbering.xml */\n numbering?: Element;\n /** word/settings.xml */\n settings?: Element;\n /** word/fontTable.xml */\n fontTable?: Element;\n /** word/webSettings.xml */\n webSettings?: Element;\n partRefs: DocxPartRefs;\n /** docProps/core.xml */\n coreProps?: string;\n /** docProps/app.xml */\n appProps?: string;\n /** docProps/custom.xml */\n customProps?: string;\n /** [Content_Types].xml */\n contentTypes?: Element;\n}\n\nfunction resolveRelsPath(target: string): string {\n if (target.startsWith(\"/\")) return target.slice(1);\n if (target.startsWith(\"../\")) return target.replace(\"../\", \"\");\n return `word/${target}`;\n}\n\n/**\n * Resolve each embedded font's .odttf bytes through fontTable.xml.rels.\n * Reads the binary verbatim and flags it raw so the compiler copies it as-is\n * instead of re-obfuscating (the fontKey already matches the bytes).\n */\nfunction resolveEmbeddedFontData(fonts: EmbeddedFontOptionsWithKey[], doc: ParsedArchive): void {\n const relsEl = doc.get(\"word/_rels/fontTable.xml.rels\");\n if (!relsEl) return;\n const ridToPath = new Map<string, string>();\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n if (!type.includes(\"/font\")) continue;\n const id = attr(child, \"Id\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (id && target) ridToPath.set(id, resolveRelsPath(target));\n }\n for (const font of fonts) {\n if (!font.embedRid) continue;\n const odttfPath = ridToPath.get(font.embedRid);\n if (!odttfPath) continue;\n const bytes = doc.getRaw(odttfPath);\n if (bytes) {\n font.data = Buffer.from(bytes);\n font.rawOdttf = true;\n font.odttfPath = odttfPath;\n }\n }\n}\n\nfunction parseDocPartRefs(doc: ParsedArchive): DocxPartRefs {\n const refs: DocxPartRefs = {\n headers: new Map(),\n footers: new Map(),\n hyperlinks: new Map(),\n charts: new Map(),\n diagramData: new Map(),\n media: new Map(),\n partMedia: new Map(),\n afChunks: new Map(),\n subDocs: new Map(),\n };\n\n const relsEl = doc.get(\"word/_rels/document.xml.rels\");\n if (!relsEl) return refs;\n\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n const id = attr(child, \"Id\") ?? \"\";\n if (!target) continue;\n\n const path = resolveRelsPath(target);\n\n if (type.includes(\"/header\")) {\n refs.headers.set(id, path);\n } else if (type.includes(\"/footer\")) {\n refs.footers.set(id, path);\n } else if (type.includes(\"/footnotes\")) {\n refs.footnotes = path;\n } else if (type.includes(\"/endnotes\")) {\n refs.endnotes = path;\n } else if (type.includes(\"/comments\")) {\n refs.comments = path;\n } else if (type.includes(\"/chart\")) {\n refs.charts.set(id, path);\n } else if (type.includes(\"/diagramData\")) {\n refs.diagramData.set(id, path);\n } else if (type.includes(\"/image\") || type.includes(\"/media\")) {\n refs.media.set(id, path);\n } else if (type.includes(\"/aFChunk\")) {\n refs.afChunks.set(id, path);\n } else if (type.includes(\"/subDocument\")) {\n refs.subDocs.set(id, path);\n } else if (type.includes(\"/bibliography\")) {\n refs.bibliography = path;\n } else if (type.includes(\"/glossaryDocument\")) {\n refs.glossary = path;\n } else if (type.includes(\"/hyperlink\")) {\n refs.hyperlinks.set(id, target);\n }\n }\n\n // Per-part image relationships. Each part carries its own .rels with\n // independent rId numbering (document rId1 ≠ header rId1), so collect them\n // keyed by part path; drawings inside a part resolve images through its\n // own rels. Covers document, headers, footers, footnotes, endnotes, comments.\n for (const relsPath of doc.keys(\"word/_rels/\")) {\n if (!relsPath.endsWith(\".rels\")) continue;\n const relsEl = doc.get(relsPath);\n if (!relsEl) continue;\n const partPath = \"word/\" + relsPath.slice(\"word/_rels/\".length, -\".rels\".length);\n for (const rel of relsEl.elements ?? []) {\n if (rel.name !== \"Relationship\") continue;\n const type = attr(rel, \"Type\") ?? \"\";\n if (!type.includes(\"/image\") && !type.includes(\"/media\")) continue;\n const id = attr(rel, \"Id\") ?? \"\";\n const target = attr(rel, \"Target\") ?? \"\";\n if (!id || !target) continue;\n let partMap = refs.partMedia.get(partPath);\n if (!partMap) {\n partMap = new Map();\n refs.partMedia.set(partPath, partMap);\n }\n partMap.set(id, resolveRelsPath(target));\n }\n }\n\n return refs;\n}\n\nfunction parseRootRels(doc: ParsedArchive): {\n coreProps?: string;\n appProps?: string;\n customProps?: string;\n} {\n const relsEl = doc.get(\"_rels/.rels\");\n if (!relsEl) return {};\n\n let coreProps: string | undefined;\n let appProps: string | undefined;\n let customProps: string | undefined;\n\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (!target) continue;\n\n const path = target.startsWith(\"/\") ? target.slice(1) : target;\n\n if (type.includes(\"/core-properties\")) {\n coreProps = path;\n } else if (type.includes(\"/extended-properties\")) {\n appProps = path;\n } else if (type.includes(\"/custom-properties\")) {\n customProps = path;\n }\n }\n\n return { coreProps, appProps, customProps };\n}\n\n/**\n * Parse a .docx file and convert it into DocumentOptions.\n *\n * This is the main public API for parsing DOCX files.\n * The returned options can be passed directly to `new Document(parsed)`\n * to recreate the document.\n *\n * @param data - Raw bytes of a .docx file\n * @returns Document options including sections and metadata\n */\nexport function parseDocument(data: DataType): DocumentOptions {\n const docx = parseDocx(data);\n const ctx = new DocxReadContext(\n docx,\n buildStyleCache(docx.styles),\n buildNumberingCache(docx.numbering),\n );\n\n // Register the child parser for table and body child descriptors\n setTableParseChild(parseSectionChild);\n setBodyParseChild(parseSectionChild);\n\n const sections = parseBody(docx.body, ctx);\n\n const opts: Partial<DocumentOptions> = { sections };\n\n // Document conformance class (w:document/@w:conformance)\n const conformance = attr(docx.documentRoot, \"w:conformance\");\n if (conformance === \"strict\" || conformance === \"transitional\") opts.conformance = conformance;\n\n // Background (w:background in document.xml)\n if (docx.background) {\n const hasChildren = (docx.background.elements ?? []).some((e) => e.type === \"element\");\n if (hasChildren) {\n // VML/structured background (e.g. v:background/v:fill pattern with a\n // texture image) that doesn't fit the color/theme model: carry the\n // element verbatim, rewriting relationship refs to {fileName} placeholders\n // so the media round-trips via the compiler's placeholder pass.\n const { rawXml, rawMedia } = replaceRelsWithPlaceholders(\n stringifyElement(docx.background),\n ctx,\n \"background\",\n );\n opts.background = rawMedia.length > 0 ? { rawXml, rawMedia } : { rawXml };\n } else {\n const bg: NonNullable<DocumentOptions[\"background\"]> = {};\n const color = attr(docx.background, \"w:color\");\n if (color) bg.color = color;\n const themeColor = attr(docx.background, \"w:themeColor\");\n if (themeColor) bg.themeColor = themeColor;\n const themeShade = attr(docx.background, \"w:themeShade\");\n if (themeShade) bg.themeShade = themeShade;\n const themeTint = attr(docx.background, \"w:themeTint\");\n if (themeTint) bg.themeTint = themeTint;\n if (Object.keys(bg).length > 0) opts.background = bg;\n }\n }\n\n // Core properties\n if (docx.coreProps) {\n const corePropsEl = docx.doc.get(docx.coreProps);\n if (corePropsEl) {\n const cp = corePropertiesDesc.parse(corePropsEl, ctx);\n if (cp.title) opts.title = cp.title;\n if (cp.subject) opts.subject = cp.subject;\n if (cp.creator) opts.creator = cp.creator;\n if (cp.keywords) opts.keywords = cp.keywords;\n if (cp.description) opts.description = cp.description;\n if (cp.lastModifiedBy) opts.lastModifiedBy = cp.lastModifiedBy;\n if (cp.revision) opts.revision = cp.revision;\n if (cp.lastPrinted) opts.lastPrinted = cp.lastPrinted;\n if (cp.created) opts.created = cp.created;\n if (cp.modified) opts.modified = cp.modified;\n }\n }\n\n // App (extended) properties\n if (docx.appProps) {\n const appPropsEl = docx.doc.get(docx.appProps);\n if (appPropsEl) {\n const ap = appPropertiesDesc.parse(appPropsEl, ctx);\n if (Object.keys(ap).length > 0) opts.appProperties = ap;\n }\n }\n\n // Settings — parse produces a structured SettingsOptions aligned with\n // generate (no verbatim rawXml fallback). Assign wholesale so context.ts\n // spreads it into _settingsOptions for the descriptor's stringify input.\n if (docx.settings) {\n opts.settings = settingsDesc.parse(docx.settings, ctx);\n }\n\n // Web settings — preserve the part on round-trip even when it has no\n // children. Dropping it leaves an orphaned Override in the passthrough\n // [Content_Types].xml (the part is gone but its Override remains), which is\n // an OPC violation; keeping presence keeps part + rel + Override in sync.\n if (docx.webSettings) {\n opts.webSettings = webSettingsDesc.parse(docx.webSettings, ctx);\n }\n\n // Custom properties\n if (docx.customProps) {\n const customPropsEl = docx.doc.get(docx.customProps);\n if (customPropsEl) {\n const cpResult = customPropertiesDesc.parse(customPropsEl, ctx);\n if (cpResult.properties && cpResult.properties.length > 0) {\n opts.customProperties = cpResult.properties;\n }\n }\n }\n\n // Comments content\n if (docx.partRefs.comments) {\n const commentsEl = docx.doc.get(docx.partRefs.comments);\n if (commentsEl) {\n const commentsResult = ctx.withPart(docx.partRefs.comments, () =>\n commentsDesc.parse(commentsEl, ctx),\n );\n const children = commentsResult.children;\n if (children && children.length > 0) {\n opts.comments = { children };\n }\n }\n }\n\n // Footnotes content\n if (docx.partRefs.footnotes) {\n const footnotesEl = docx.doc.get(docx.partRefs.footnotes);\n if (footnotesEl) {\n const fnResult = ctx.withPart(docx.partRefs.footnotes, () =>\n footnotesDesc.parse(footnotesEl, ctx),\n );\n const footnotesMap: NonNullable<DocumentOptions[\"footnotes\"]> = {};\n for (const [id, paragraphs] of fnResult.notes) {\n footnotesMap[String(id)] = { children: paragraphs };\n }\n // Preserve round-tripped separators so the generated ids stay consistent\n // with settings.footnotePr (which references them).\n if (\n Object.keys(footnotesMap).length > 0 ||\n fnResult.separator ||\n fnResult.continuationSeparator\n ) {\n if (fnResult.separator) footnotesMap.separator = fnResult.separator;\n if (fnResult.continuationSeparator)\n footnotesMap.continuationSeparator = fnResult.continuationSeparator;\n opts.footnotes = footnotesMap;\n }\n }\n }\n\n // Endnotes content\n if (docx.partRefs.endnotes) {\n const endnotesEl = docx.doc.get(docx.partRefs.endnotes);\n if (endnotesEl) {\n const enResult = ctx.withPart(docx.partRefs.endnotes, () =>\n endnotesDesc.parse(endnotesEl, ctx),\n );\n const endnotesMap: NonNullable<DocumentOptions[\"endnotes\"]> = {};\n for (const [id, paragraphs] of enResult.notes) {\n endnotesMap[String(id)] = { children: paragraphs };\n }\n if (\n Object.keys(endnotesMap).length > 0 ||\n enResult.separator ||\n enResult.continuationSeparator\n ) {\n if (enResult.separator) endnotesMap.separator = enResult.separator;\n if (enResult.continuationSeparator)\n endnotesMap.continuationSeparator = enResult.continuationSeparator;\n opts.endnotes = endnotesMap;\n }\n }\n }\n\n // Styles definitions\n if (docx.styles) {\n const styleOpts = parseStyleDefinitions(docx.styles, parseParagraphProperties, ctx);\n if (styleOpts) opts.styles = styleOpts;\n }\n\n // Numbering definitions\n if (docx.numbering) {\n const numOpts = parseNumberingDefinitions(docx.numbering, parseParagraphProperties, ctx);\n if (numOpts) opts.numbering = numOpts;\n }\n\n // Font table\n if (docx.fontTable) {\n const ftResult = fontTableDesc.parse(docx.fontTable, ctx);\n if (ftResult.fonts && ftResult.fonts.length > 0) {\n resolveEmbeddedFontData(ftResult.fonts, docx.doc);\n opts.fonts = ftResult.fonts;\n }\n }\n\n // Bibliography\n if (docx.partRefs.bibliography) {\n const bibEl = docx.doc.get(docx.partRefs.bibliography);\n if (bibEl) {\n const bibResult = bibliographyDesc.parse(bibEl, ctx);\n if (bibResult.sources && bibResult.sources.length > 0) opts.bibliography = bibResult;\n }\n }\n\n // Glossary document\n if (docx.partRefs.glossary) {\n const glossaryEl = docx.doc.get(docx.partRefs.glossary);\n if (glossaryEl) {\n const glossaryResult = ctx.withPart(docx.partRefs.glossary, () =>\n glossaryDesc.parse(glossaryEl, ctx),\n );\n if (glossaryResult.parts && glossaryResult.parts.length > 0) opts.glossary = glossaryResult;\n }\n }\n\n // Content types\n if (docx.contentTypes) {\n const ctResult = contentTypesDesc.parse(docx.contentTypes, ctx);\n if (ctResult) opts.contentTypes = ctResult;\n }\n\n // Raw passthrough: parts generate() doesn't rebuild (word/theme/*, customXml/*).\n // Carried verbatim so their [Content_Types] declarations stay valid and the\n // package opens in Word. (Media/fonts/headers/etc. are rebuilt by the compiler\n // and must NOT be passed through — they'd otherwise duplicate under renamed paths.)\n const rawParts: { path: string; data: Uint8Array }[] = [];\n for (const prefix of [\"word/theme/\", \"customXml/\"]) {\n for (const p of docx.doc.keys(prefix)) {\n if (p.endsWith(\"/\")) continue;\n const data = docx.doc.getRaw(p);\n if (data) rawParts.push({ path: p, data });\n }\n }\n if (rawParts.length > 0) opts.rawParts = rawParts;\n\n return opts as DocumentOptions;\n}\n\nexport function parseDocx(data: DataType): DocxDocument {\n const uint8 = toUint8Array(data);\n const doc = parseArchive(uint8);\n\n const documentEl = doc.get(\"word/document.xml\");\n if (!documentEl) throw new Error(\"word/document.xml not found\");\n const body = documentEl.elements?.find((e) => e.name === \"w:body\");\n if (!body) throw new Error(\"w:body not found in word/document.xml\");\n const background = documentEl.elements?.find((e) => e.name === \"w:background\");\n\n const styles = doc.get(\"word/styles.xml\");\n const numbering = doc.get(\"word/numbering.xml\");\n const settings = doc.get(\"word/settings.xml\");\n const fontTable = doc.get(\"word/fontTable.xml\");\n const webSettings = doc.get(\"word/webSettings.xml\");\n\n const partRefs = parseDocPartRefs(doc);\n const { coreProps, appProps, customProps } = parseRootRels(doc);\n\n const contentTypes = doc.get(\"[Content_Types].xml\");\n\n return {\n doc,\n documentRoot: documentEl,\n body,\n background,\n styles,\n numbering,\n settings,\n fontTable,\n webSettings,\n partRefs,\n coreProps,\n appProps,\n customProps,\n contentTypes,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AW,UAAU,MAAM,MAAM,EAAE,SAAS,cAAc;CAE7E,MAAM,SAAS,IAAI,IAAI,iBAAiB;CACxC,MAAM,YAAY,IAAI,IAAI,oBAAoB;CAC9C,MAAM,WAAW,IAAI,IAAI,mBAAmB;CAC5C,MAAM,YAAY,IAAI,IAAI,oBAAoB;CAC9C,MAAM,cAAc,IAAI,IAAI,sBAAsB;CAElD,MAAM,WAAW,iBAAiB,GAAG;CACrC,MAAM,EAAE,WAAW,UAAU,gBAAgB,cAAc,GAAG;CAI9D,OAAO;EACL;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAhBmB,IAAI,IAAI,qBAgBhB;CACb;AACF"}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"core-properties-CIG9ZnsW.d.mts","names":[],"sources":["../src/parts/bibliography.ts","../src/parts/contenttypes.ts","../src/parts/fonts/font.ts","../src/parts/alt-chunk/alt-chunk-collection.ts","../src/parts/alt-chunk/alt-chunk.ts","../src/shared/border.ts","../src/shared/shading.ts","../src/shared/track-revision/track-revision.ts","../src/parts/paragraph/run/east-asian-layout.ts","../src/parts/paragraph/run/emphasis-mark.ts","../src/parts/paragraph/run/formatting.ts","../src/parts/paragraph/run/language.ts","../src/parts/paragraph/run/run-fonts.ts","../src/parts/paragraph/run/underline.ts","../src/parts/paragraph/run/properties.ts","../src/parts/table-of-contents/table-of-contents-properties.ts","../src/parts/table-of-contents/sdt-properties.ts","../src/parts/table-of-contents/toc-parse.ts","../src/parts/table-of-contents/descriptor.ts","../src/shared/track-revision/track-revision-components/cell-merge.ts","../src/shared/vertical-align.ts","../src/parts/table/table-width.ts","../src/parts/table/table-properties/table-cell-margin.ts","../src/parts/paragraph/formatting/alignment.ts","../src/parts/paragraph/formatting/border.ts","../src/parts/paragraph/formatting/cnf-style.ts","../src/parts/paragraph/formatting/indent.ts","../src/parts/paragraph/formatting/break.ts","../src/parts/paragraph/formatting/spacing.ts","../src/parts/paragraph/formatting/style.ts","../src/parts/paragraph/formatting/tab-stop.ts","../src/parts/object/object-element.ts","../src/parts/paragraph/run/empty-children.ts","../src/parts/paragraph/run/run.ts","../src/parts/paragraph/links/bookmark.ts","../src/parts/paragraph/math.ts","../src/parts/table/grid.ts","../src/parts/table/table-cell-spacing.ts","../src/parts/table/table-properties/table-borders.ts","../src/parts/table/table-properties/table-float-properties.ts","../src/parts/table/table-properties/table-layout.ts","../src/parts/table/table-properties/table-look.ts","../src/parts/table/table-properties/table-properties.ts","../src/parts/table/table-properties/table-property-exceptions.ts","../src/parts/table/table-cell/table-cell-components.ts","../src/parts/table/table-row/table-row.ts","../src/parts/table/table-row/table-row-height.ts","../src/parts/table/table.ts","../src/parts/table/stringify.ts","../src/parts/table/descriptor.ts","../src/shared/constants.ts","../src/parts/paragraph/frame/frame-properties.ts","../src/parts/paragraph/properties.ts","../src/parts/paragraph/run/symbol-run.ts","../src/parts/drawing/doc-properties/doc-properties.ts","../src/parts/drawing/drawing.ts","../src/parts/drawing/text-wrap/text-wrapping.ts","../src/parts/drawing/text-wrap/wrap-tight.ts","../src/parts/drawing/text-wrap/wrap-through.ts","../src/parts/drawing/floating/floating-position.ts","../src/parts/drawing/floating/horizontal-position.ts","../src/parts/drawing/floating/vertical-position.ts","../src/parts/drawing/descriptor.ts","../src/parts/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/body-properties.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/non-visual-shape-properties.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/wps-shape.ts","../src/shared/media/data.ts","../src/shared/media/media.ts","../src/parts/paragraph/run/image-run.ts","../src/parts/paragraph/run/chart-run.ts","../src/parts/paragraph/run/smartart-run.ts","../src/parts/document/document-background/document-background.ts","../src/parts/paragraph/run/wps-shape-run.ts","../src/parts/paragraph/run/wpg-group-run.ts","../src/parts/paragraph/run/simple-field.ts","../src/parts/paragraph/run/comment-run.ts","../src/parts/paragraph/run/positional-tab.ts","../src/parts/paragraph/run/ruby.ts","../src/parts/paragraph/run/form-field.ts","../src/parts/paragraph/run/smart-tag-run.ts","../src/parts/paragraph/run/proof-error.ts","../src/parts/paragraph/paragraph.ts","../src/parts/paragraph/links/hyperlink.ts","../src/parts/paragraph/links/numbered-item-ref.ts","../src/parts/paragraph/links/bidi.ts","../src/parts/table/table-row/table-row-properties.ts","../src/parts/table/table-cell/table-cell-properties.ts","../src/parts/table/table-cell/table-cell.ts","../src/parts/custom-xml/custom-xml.ts","../src/parts/document/body/section-properties/properties/column.ts","../src/parts/document/body/section-properties/properties/columns.ts","../src/parts/document/body/section-properties/properties/doc-grid.ts","../src/parts/document/body/section-properties/properties/page-size.ts","../src/parts/document/body/section-properties/properties/page-number.ts","../src/parts/document/body/section-properties/properties/page-borders.ts","../src/parts/document/body/section-properties/properties/page-margin.ts","../src/parts/document/body/section-properties/properties/page-text-direction.ts","../src/parts/document/body/section-properties/properties/line-number.ts","../src/parts/document/body/section-properties/properties/section-type.ts","../src/parts/document/body/section-properties/properties/header-footer-reference.ts","../src/parts/document/body/section-properties/descriptor.ts","../src/parts/sub-doc/sub-doc.ts","../src/parts/textbox/types.ts","../src/parts/textbox/shape/shape.ts","../src/shared/section.ts","../src/parts/document/document-attributes.ts","../src/parts/header-footer.ts","../src/parts/document/body/section-properties/properties/footnote-endnote-properties.ts","../src/parts/document/body/section-properties/section-properties.ts","../src/parts/endnotes/descriptor.ts","../src/parts/footnotes/descriptor.ts","../src/parts/glossary-document.ts","../src/parts/numbering/level.ts","../src/parts/numbering/numbering.ts","../src/parts/numbering/abstract-numbering.ts","../src/parts/numbering/num.ts","../src/parts/settings/compatibility.ts","../src/parts/settings/settings.ts","../src/parts/styles/factory.ts","../src/parts/styles/styles.ts","../src/parts/sub-doc/sub-doc-collection.ts","../src/parts/frameset.ts","../src/parts/web-settings.ts","../src/shared/embeddings/embeddings.ts","../src/parse.ts","../src/context.ts","../src/parts/fonts/font-wrapper.ts","../src/parts/fonts/font-table.ts","../src/parts/settings/descriptor.ts","../src/parts/core-properties.ts"],"mappings":";;;;;;;;UAkCiB,iBAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;EACA,KAAA;EACA,GAAA;EACA,SAAA;EACA,OAAA;EACA,MAAA;EACA,KAAA;EACA,KAAA;EACA,SAAA;EACA,IAAA;EACA,GAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,UASe,mBAAA;EACf,OAAA,EAAS,iBAAiB;EAC1B,SAAA;AAAA;AAAA,cA2BW,gBAAA,EAAkB,gBAAgB,CAAC,mBAAA;;;UC7E/B,kBAAA;EACf,SAAA;EACA,WAAW;AAAA;AAAA,UAGI,mBAAA;EACf,QAAA;EACA,WAAW;AAAA;AAAA,UAGI,iBAAA;EACf,QAAA,EAAU,kBAAA;EACV,SAAA,EAAW,mBAAmB;AAAA;AAAA,cAWnB,gBAAA,EAAkB,gBAAgB,CAAC,iBAAA;AAAA,iBAsEhC,iBAAA,CACd,KAAA,EAAO,iBAAA,EACP,cAAA,aACC,iBAAiB;AAAA,iBA+BJ,qBAAA,CACd,KAAA,EAAO,iBAAA,EACP,SAAA;EAAsB,IAAA;EAAc,WAAA;AAAA,MACnC,iBAAiB;AAAA,iBA6BJ,6BAAA,CACd,KAAA,EAAO,WAAA,4BACP,OAAA;EACE,SAAA,GAAY,aAAA;IAAgB,IAAA;IAAc,WAAA;EAAA;EAC1C,OAAA,GAAU,aAAA;IAAgB,IAAA;EAAA;AAAA,IAE3B,iBAAA;;;cC1IU,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;UC7BI,YAAA;EAEf,GAAA;EAEA,IAAA,EAAM,UAAU;EAEhB,IAAA;EAEA,SAAA;EAEA,WAAA;AAAA;AAAA,cASW,kBAAA;EAAA,QACH,GAAA;;EAMD,WAAA,CAAY,GAAA,UAAa,IAAA,EAAM,YAAA;EAAA,IAI3B,KAA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mts","names":[],"sources":["../src/parts/bibliography.ts","../src/parts/contenttypes.ts","../src/parts/fonts/font.ts","../src/parts/alt-chunk/alt-chunk-collection.ts","../src/parts/alt-chunk/alt-chunk.ts","../src/shared/border.ts","../src/shared/shading.ts","../src/shared/track-revision/track-revision.ts","../src/parts/paragraph/run/east-asian-layout.ts","../src/parts/paragraph/run/emphasis-mark.ts","../src/parts/paragraph/run/formatting.ts","../src/parts/paragraph/run/language.ts","../src/parts/paragraph/run/run-fonts.ts","../src/parts/paragraph/run/underline.ts","../src/parts/paragraph/run/properties.ts","../src/parts/table-of-contents/table-of-contents-properties.ts","../src/parts/table-of-contents/sdt-properties.ts","../src/parts/table-of-contents/toc-parse.ts","../src/parts/table-of-contents/descriptor.ts","../src/shared/track-revision/track-revision-components/cell-merge.ts","../src/shared/vertical-align.ts","../src/parts/table/table-width.ts","../src/parts/table/table-properties/table-cell-margin.ts","../src/parts/paragraph/formatting/alignment.ts","../src/parts/paragraph/formatting/border.ts","../src/parts/paragraph/formatting/cnf-style.ts","../src/parts/paragraph/formatting/indent.ts","../src/parts/paragraph/formatting/break.ts","../src/parts/paragraph/formatting/spacing.ts","../src/parts/paragraph/formatting/style.ts","../src/parts/paragraph/formatting/tab-stop.ts","../src/parts/object/object-element.ts","../src/parts/paragraph/run/empty-children.ts","../src/parts/paragraph/run/run.ts","../src/parts/paragraph/links/bookmark.ts","../src/parts/paragraph/math.ts","../src/parts/table/grid.ts","../src/parts/table/table-cell-spacing.ts","../src/parts/table/table-properties/table-borders.ts","../src/parts/table/table-properties/table-float-properties.ts","../src/parts/table/table-properties/table-layout.ts","../src/parts/table/table-properties/table-look.ts","../src/parts/table/table-properties/table-properties.ts","../src/parts/table/table-properties/table-property-exceptions.ts","../src/parts/table/table-cell/table-cell-components.ts","../src/parts/table/table-row/table-row.ts","../src/parts/table/table-row/table-row-height.ts","../src/parts/table/table.ts","../src/parts/table/stringify.ts","../src/parts/table/descriptor.ts","../src/shared/constants.ts","../src/parts/paragraph/frame/frame-properties.ts","../src/parts/paragraph/properties.ts","../src/parts/paragraph/run/symbol-run.ts","../src/parts/drawing/doc-properties/doc-properties.ts","../src/parts/drawing/drawing.ts","../src/parts/drawing/text-wrap/text-wrapping.ts","../src/parts/drawing/text-wrap/wrap-tight.ts","../src/parts/drawing/text-wrap/wrap-through.ts","../src/parts/drawing/floating/floating-position.ts","../src/parts/drawing/floating/horizontal-position.ts","../src/parts/drawing/floating/vertical-position.ts","../src/parts/drawing/descriptor.ts","../src/parts/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/body-properties.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/non-visual-shape-properties.ts","../src/parts/drawing/inline/graphic/graphic-data/wps/wps-shape.ts","../src/shared/media/data.ts","../src/shared/media/media.ts","../src/parts/paragraph/run/image-run.ts","../src/parts/paragraph/run/chart-run.ts","../src/parts/paragraph/run/smartart-run.ts","../src/parts/document/document-background/document-background.ts","../src/parts/paragraph/run/wps-shape-run.ts","../src/parts/paragraph/run/wpg-group-run.ts","../src/parts/paragraph/run/simple-field.ts","../src/parts/paragraph/run/comment-run.ts","../src/parts/paragraph/run/positional-tab.ts","../src/parts/paragraph/run/ruby.ts","../src/parts/paragraph/run/form-field.ts","../src/parts/paragraph/run/smart-tag-run.ts","../src/parts/paragraph/run/proof-error.ts","../src/parts/paragraph/paragraph.ts","../src/parts/paragraph/links/hyperlink.ts","../src/parts/paragraph/links/numbered-item-ref.ts","../src/parts/paragraph/links/bidi.ts","../src/parts/table/table-row/table-row-properties.ts","../src/parts/table/table-cell/table-cell-properties.ts","../src/parts/table/table-cell/table-cell.ts","../src/parts/custom-xml/custom-xml.ts","../src/parts/document/body/section-properties/properties/column.ts","../src/parts/document/body/section-properties/properties/columns.ts","../src/parts/document/body/section-properties/properties/doc-grid.ts","../src/parts/document/body/section-properties/properties/page-size.ts","../src/parts/document/body/section-properties/properties/page-number.ts","../src/parts/document/body/section-properties/properties/page-borders.ts","../src/parts/document/body/section-properties/properties/page-margin.ts","../src/parts/document/body/section-properties/properties/page-text-direction.ts","../src/parts/document/body/section-properties/properties/line-number.ts","../src/parts/document/body/section-properties/properties/section-type.ts","../src/parts/document/body/section-properties/properties/header-footer-reference.ts","../src/parts/document/body/section-properties/descriptor.ts","../src/parts/sub-doc/sub-doc.ts","../src/parts/textbox/types.ts","../src/parts/textbox/shape/shape.ts","../src/shared/section.ts","../src/parts/document/document-attributes.ts","../src/parts/header-footer.ts","../src/parts/document/body/section-properties/properties/footnote-endnote-properties.ts","../src/parts/document/body/section-properties/section-properties.ts","../src/parts/endnotes/descriptor.ts","../src/parts/footnotes/descriptor.ts","../src/parts/glossary-document.ts","../src/parts/numbering/level.ts","../src/parts/numbering/numbering.ts","../src/parts/numbering/abstract-numbering.ts","../src/parts/numbering/num.ts","../src/parts/settings/compatibility.ts","../src/parts/settings/settings.ts","../src/parts/styles/factory.ts","../src/parts/styles/styles.ts","../src/parts/sub-doc/sub-doc-collection.ts","../src/parts/frameset.ts","../src/parts/web-settings.ts","../src/shared/embeddings/embeddings.ts","../src/parse.ts","../src/context.ts","../src/parts/fonts/font-wrapper.ts","../src/parts/fonts/font-table.ts","../src/parts/settings/descriptor.ts","../src/parts/core-properties.ts"],"mappings":";;;;;;;;UAkCiB,iBAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;EACA,KAAA;EACA,GAAA;EACA,SAAA;EACA,OAAA;EACA,MAAA;EACA,KAAA;EACA,KAAA;EACA,SAAA;EACA,IAAA;EACA,GAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,UASe,mBAAA;EACf,OAAA,EAAS,iBAAiB;EAC1B,SAAA;AAAA;AAAA,cA2BW,gBAAA,EAAkB,gBAAgB,CAAC,mBAAA;;;UC7E/B,kBAAA;EACf,SAAA;EACA,WAAW;AAAA;AAAA,UAGI,mBAAA;EACf,QAAA;EACA,WAAW;AAAA;AAAA,UAGI,iBAAA;EACf,QAAA,EA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A;EACb,QAAA,GAAW,eAAA;EACX,wBAAA;EACA,aAAA,GAAgB,oBAAA;EAChB,gBAAA,GAAmB,qBAAA;EACnB,0BAAA;EACA,cAAA;EACA,KAAA,GAAQ,mBAAA;EACR,WAAA,GAAc,kBAAA;EAEd,WAAA;EAEA,uBAAA;EAEA,IAAA;EAEA,IAAA;IACE,OAAA;IACA,GAAA;EAAA;EAGF,eAAA,GAAkB,sBAAA;EAElB,sBAAA;EAEA,kBAAA;EAEA,gBAAA;EAEA,eAAA;EAEA,OAAA;IAAY,IAAA;IAAc,GAAA;EAAA;EAE1B,kBAAA,GAAqB,eAAA;EAErB,SAAA,GAAY,eAAA;EAEZ,QAAA,GAAW,uBAAA;EAEX,QAAA,GAAW,eAAA;EAEX,WAAA,GAAc,kBAAA;EAEd,YAAA,GAAe,iBAAA;EAOf,QAAA;IAAa,IAAA;IAAc,IAAA,EAAM,UAAA;EAAA;EAEjC,aAAA,GAAgB,oBAAA;AAAA;AAAA,cASL,kBAAA,EAAoB,gBAAgB,CAAC,qBAAA"}

@@ -1,2 +0,2 @@

import { n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-CG1wp4pb.mjs";
import { n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-DjODfjQ1.mjs";
export { generateDocument, generateDocumentStream, generateDocumentSync };

@@ -1,6 +0,6 @@

import { $ as PageBorderZOrder, $t as stringifyCustomXmlShell, A as StyleLevel, An as TextHorzOverflowType, At as sectionPageSizeDefaults, B as stringifyNumberingStyle, Bn as TextEffect, Bt as NumberFormat, C as footnotesDesc, Cn as RubyAlign, Ct as parseSdtBlock, D as selectTocEntryElements, Dn as EmphasisMarkType, Dt as sectionPropertiesDesc, E as parseTocFieldInstruction, En as PositionalTabRelativeTo, Et as parseSectionPropertiesEl, F as extractStyleId, Fn as parseBodyProperties, Ft as createVerticalPosition, G as createHeaderFooterReference, Gn as TextboxTightWrapType, Gt as TextWrappingSide, H as stringifyTableStyle, Hn as PageNumber, Ht as VerticalPositionAlign, I as parseStyleDefinitions, In as createImageData, It as createHorizontalPosition, J as LineNumberRestartFormat, Jn as AlignmentType, Jt as checkboxSymbolRunInner, K as SectionType, Kn as HeadingLevel, Kt as TextWrappingType, L as DefaultStylesFactory, Ln as Media, Lt as HorizontalPositionRelativeFrom, M as Styles, Mn as TextVerticalType, Mt as PageOrientation, N as buildNumberingCache, Nn as VerticalAnchor, Nt as PageNumberSeparator, O as SdtDateMappingType, On as UnderlineType, Ot as stringifySectionPropertiesXml, P as buildStyleCache, Pn as createBodyProperties, Pt as createPageNumberType, Q as PageBorderOffsetFrom, Qt as setBodyParseChild, R as stringifyCharacterStyle, Rn as createTransformation, Rt as VerticalPositionRelativeFrom, S as endnotesDesc, Sn as parseFormFieldData, St as stringifyTableOfContents, T as parseTocFieldFromElements, Tn as PositionalTabLeader, U as HeaderFooterReferenceType, Un as breakXml, Ut as createWrapThrough, V as stringifyParagraphStyle, Vn as EMPTY_RUN_ELEMENTS, Vt as SpaceType, W as HeaderFooterType, Wn as TextAlignmentType, Wt as createWrapTight, X as createPageMargin, Xt as parseCustomXmlProperties, Y as createLineNumberType, Yt as customXmlBlockDesc, Z as PageBorderDisplay, Zt as sdtBlockDesc, _ as glossaryDesc, _n as TextDirection, a as appPropertiesDesc, an as parseShading, at as LevelFormat, b as CharacterSet, bn as FormFieldTextType, c as relationshipsDesc, cn as widthFiftiethsToPct, ct as parseTablePropertiesEl, d as withAltChunkOverrides, dn as BorderStyle, dt as tableDesc, en as stringifySdtPr, et as DocumentGridType, f as withMediaDefaults, fn as TableLayoutType, ft as stringifyChildDispatch, g as DocPartType, gn as TableAnchorType, gt as resetDrawingIdGen, h as DocPartGallery, hn as RelativeVerticalPosition, ht as drawingDesc, i as webSettingsDesc, in as ShadingType, it as parseNumberingDefinitions, j as settingsDesc, jn as TextVertOverflowType, jt as PageTextDirectionType, k as SdtLock, kn as TextBodyWrappingType, kt as sectionMarginDefaults, l as buildContentTypesFromRegistry, ln as widthPctToFiftieths, lt as parseTableRowPropertiesEl, m as DocPartBehavior, mn as RelativeHorizontalPosition, mt as stringifyRunInline, n as frameXml, nn as subDocDesc, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, on as objectDesc, ot as LevelSuffix, p as commentsDesc, pn as OverlapType, pt as stringifyParagraphInline, q as createSectionType, qn as LineRuleType, qt as altChunkDesc, r as framesetXml, rt as Numbering, s as corePropertiesDesc, sn as WidthType, st as parseTableCellPropertiesEl, t as TargetScreenSize, tn as stringifySdtShell, tt as createDocumentGrid, u as contentTypesDesc, un as TABLE_BORDERS_NONE, ut as setTableParseChild, v as bibliographyDesc, vn as VerticalMergeType, w as parseToc, wn as PositionalTabAlignment, wt as parseSdtProperties, x as EditGroupType, xn as createFormFieldData, y as fontTableDesc, yn as ProofErrorType, z as stringifyConditionalTableStyle, zn as HighlightColor, zt as HorizontalPositionAlign } from "./parts-D0KoDfg7.mjs";
import { i as AltChunkCollection, n as DocxWriteContext, r as SubDocCollection, t as DocxReadContext } from "./context-nyQP2Fkk.mjs";
import { $ as PageBorderZOrder, $t as stringifyCustomXmlShell, A as StyleLevel, An as TextHorzOverflowType, At as sectionPageSizeDefaults, B as stringifyNumberingStyle, Bn as TextEffect, Bt as NumberFormat, C as footnotesDesc, Cn as RubyAlign, Ct as parseSdtBlock, D as selectTocEntryElements, Dn as EmphasisMarkType, Dt as sectionPropertiesDesc, E as parseTocFieldInstruction, En as PositionalTabRelativeTo, Et as parseSectionPropertiesEl, F as extractStyleId, Fn as parseBodyProperties, Ft as createVerticalPosition, G as createHeaderFooterReference, Gn as TextboxTightWrapType, Gt as TextWrappingSide, H as stringifyTableStyle, Hn as PageNumber, Ht as VerticalPositionAlign, I as parseStyleDefinitions, In as createImageData, It as createHorizontalPosition, J as LineNumberRestartFormat, Jn as AlignmentType, Jt as checkboxSymbolRunInner, K as SectionType, Kn as HeadingLevel, Kt as TextWrappingType, L as DefaultStylesFactory, Ln as Media, Lt as HorizontalPositionRelativeFrom, M as Styles, Mn as TextVerticalType, Mt as PageOrientation, N as buildNumberingCache, Nn as VerticalAnchor, Nt as PageNumberSeparator, O as SdtDateMappingType, On as UnderlineType, Ot as stringifySectionPropertiesXml, P as buildStyleCache, Pn as createBodyProperties, Pt as createPageNumberType, Q as PageBorderOffsetFrom, Qt as setBodyParseChild, R as stringifyCharacterStyle, Rn as createTransformation, Rt as VerticalPositionRelativeFrom, S as endnotesDesc, Sn as parseFormFieldData, St as stringifyTableOfContents, T as parseTocFieldFromElements, Tn as PositionalTabLeader, U as HeaderFooterReferenceType, Un as breakXml, Ut as createWrapThrough, V as stringifyParagraphStyle, Vn as EMPTY_RUN_ELEMENTS, Vt as SpaceType, W as HeaderFooterType, Wn as TextAlignmentType, Wt as createWrapTight, X as createPageMargin, Xt as parseCustomXmlProperties, Y as createLineNumberType, Yt as customXmlBlockDesc, Z as PageBorderDisplay, Zt as sdtBlockDesc, _ as glossaryDesc, _n as TextDirection, a as appPropertiesDesc, an as parseShading, at as LevelFormat, b as CharacterSet, bn as FormFieldTextType, c as relationshipsDesc, cn as widthFiftiethsToPct, ct as parseTablePropertiesEl, d as withAltChunkOverrides, dn as BorderStyle, dt as tableDesc, en as stringifySdtPr, et as DocumentGridType, f as withMediaDefaults, fn as TableLayoutType, ft as stringifyChildDispatch, g as DocPartType, gn as TableAnchorType, gt as resetDrawingIdGen, h as DocPartGallery, hn as RelativeVerticalPosition, ht as drawingDesc, i as webSettingsDesc, in as ShadingType, it as parseNumberingDefinitions, j as settingsDesc, jn as TextVertOverflowType, jt as PageTextDirectionType, k as SdtLock, kn as TextBodyWrappingType, kt as sectionMarginDefaults, l as buildContentTypesFromRegistry, ln as widthPctToFiftieths, lt as parseTableRowPropertiesEl, m as DocPartBehavior, mn as RelativeHorizontalPosition, mt as stringifyRunInline, n as frameXml, nn as subDocDesc, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, on as objectDesc, ot as LevelSuffix, p as commentsDesc, pn as OverlapType, pt as stringifyParagraphInline, q as createSectionType, qn as LineRuleType, qt as altChunkDesc, r as framesetXml, rt as Numbering, s as corePropertiesDesc, sn as WidthType, st as parseTableCellPropertiesEl, t as TargetScreenSize, tn as stringifySdtShell, tt as createDocumentGrid, u as contentTypesDesc, un as TABLE_BORDERS_NONE, ut as setTableParseChild, v as bibliographyDesc, vn as VerticalMergeType, w as parseToc, wn as PositionalTabAlignment, wt as parseSdtProperties, x as EditGroupType, xn as createFormFieldData, y as fontTableDesc, yn as ProofErrorType, z as stringifyConditionalTableStyle, zn as HighlightColor, zt as HorizontalPositionAlign } from "./parts-B7Sfx_F0.mjs";
import { i as AltChunkCollection, n as DocxWriteContext, r as SubDocCollection, t as DocxReadContext } from "./context-CiyAhqTX.mjs";
import { patchDetector, patchDocument } from "./patch/index.mjs";
import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-IeJ0NXYz.mjs";
import { i as compileDocument, n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-CG1wp4pb.mjs";
import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-DDWWDGbX.mjs";
import { i as compileDocument, n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-DjODfjQ1.mjs";
//#region src/parts/paragraph/formatting/break.ts

@@ -7,0 +7,0 @@ /**

@@ -1,2 +0,2 @@

import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-IeJ0NXYz.mjs";
import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-DDWWDGbX.mjs";
export { parseArchive, parseDocument, parseDocx };

@@ -1,2 +0,2 @@

import { Ln as Media, dt as tableDesc, ft as stringifyChildDispatch, mt as stringifyRunInline, nt as DocumentAttributeNamespaces, p as commentsDesc, pt as stringifyParagraphInline } from "../parts-D0KoDfg7.mjs";
import { Ln as Media, dt as tableDesc, ft as stringifyChildDispatch, mt as stringifyRunInline, nt as DocumentAttributeNamespaces, p as commentsDesc, pt as stringifyParagraphInline } from "../parts-B7Sfx_F0.mjs";
import { DOCX_NS, OoxmlMimeType, TargetModeType, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, createReplacer, createTraverser, getNextRelationshipIndex, getReferencedMedia, nextNumericId, replaceImagePlaceholders, strFromU8, toJson, toUint8Array, unzipSync, zipAndConvert } from "@office-open/core";

@@ -3,0 +3,0 @@ import { escapeXml, js2xml, xml2js } from "@office-open/xml";

{
"name": "@office-open/docx",
"version": "0.10.11",
"version": "0.10.12",
"description": "Generate, parse, and patch .docx documents with a declarative TypeScript API",

@@ -56,4 +56,4 @@ "keywords": [

"dependencies": {
"@office-open/core": "0.10.11",
"@office-open/xml": "0.10.11"
"@office-open/core": "0.10.12",
"@office-open/xml": "0.10.12"
},

@@ -60,0 +60,0 @@ "scripts": {

import { F as extractStyleId, L as DefaultStylesFactory, Ln as Media, M as Styles, Tt as FontWrapper, rt as Numbering } from "./parts-D0KoDfg7.mjs";
import { Relationships } from "@office-open/core";
import { js2xml, xml2js } from "@office-open/xml";
import { ChartCollection } from "@office-open/core/chart";
import { SmartArtCollection } from "@office-open/core/smartart";
//#region src/parts/alt-chunk/alt-chunk-collection.ts
/**
* Manages alternative format chunk parts in a document.
*
* Stores external content (HTML, RTF, plain text) that will be
* serialized into separate parts in the DOCX package.
*/
var AltChunkCollection = class {
map;
constructor() {
this.map = /* @__PURE__ */ new Map();
}
addAltChunk(key, data) {
this.map.set(key, data);
}
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/parts/sub-doc/sub-doc-collection.ts
/**
* Manages sub-document parts in a document.
*/
var SubDocCollection = class {
map;
constructor() {
this.map = /* @__PURE__ */ new Map();
}
addSubDoc(key, data) {
this.map.set(key, data);
}
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/parts/styles/external-styles-factory.ts
/**
* External styles factory module for WordprocessingML documents.
*
* Parses styles from external XML and returns raw XML strings.
* No XmlComponent dependency.
*
* Reference: http://officeopenxml.com/WPstyles.php
*
* @module
*/
/**
* Factory for creating styles from external XML sources.
*
* Parses styles from XML (typically from a styles.xml file)
* and returns raw XML strings for each style element.
*/
var ExternalStylesFactory = class {
/**
* Creates new Styles based on the given XML data.
*
* Parses the styles XML and converts each child to a raw XML string.
*/
newInstance(xmlData) {
const xmlObj = xml2js(xmlData, { compact: false });
let stylesXmlElement;
for (const xmlElm of xmlObj.elements || []) if (xmlElm.name === "w:styles") stylesXmlElement = xmlElm;
if (stylesXmlElement === void 0) return {
importedStyles: [],
initialAttributes: {}
};
return {
importedStyles: (stylesXmlElement.elements || []).map((childElm) => ({ _raw: js2xml({ elements: [childElm] }) })),
initialAttributes: stylesXmlElement.attributes ?? {}
};
}
};
//#endregion
//#region src/shared/embeddings/embeddings.ts
/**
* Collects OLE embeddings allocated during document generation. Each embedding
* is stored under a sequential `oleObjectN.bin` name in word/embeddings/,
* mirroring MS Office's numbering so output is deterministic and diffable.
*/
var EmbeddingCollection = class {
map = /* @__PURE__ */ new Map();
counter = 0;
/** Allocate the next sequential embedding file name (oleObject1.bin, …). */
nextEmbeddingName() {
return `oleObject${++this.counter}.bin`;
}
/** Register an embedding under a unique key. */
addEmbedding(key, data) {
this.map.set(key, data);
}
/** All registered embeddings in insertion order. */
get array() {
return [...this.map.values()];
}
};
//#endregion
//#region src/context.ts
/**
* DOCX compilation context.
*
* DocxWriteContext holds all mutable state needed during document compilation.
* generateDocument() creates a DocxWriteContext internally.
*
* @module
*/
/** User styles override factory defaults with the same styleId; keep the rest. */
function mergeById(factoryStyles, userStyles) {
const factory = factoryStyles ?? [];
if (!userStyles || userStyles.length === 0) return factory;
const userIds = new Set(userStyles.map((s) => s.id));
return [...factory.filter((s) => !userIds.has(s.id)), ...userStyles];
}
/**
* Highest comment id in an explicit comments list, or -1 when there are none.
* Seeds the comment id allocator so auto-allocated ids never collide with ids
* the caller already assigned (e.g. round-tripped from an existing document).
*/
function maxCommentId(comments) {
let max = -1;
if (comments) {
for (const c of comments) if (c.id > max) max = c.id;
}
return max;
}
/** Narrows an object to a `{ id: number }` marker without an `as` cast. */
function isNumericIdMarker(value) {
return typeof value === "object" && value !== null && "id" in value && typeof value.id === "number";
}
/**
* Highest w:id among explicit bookmark + move-range start markers (`range`) and
* explicit movedFrom/movedTo runs (`moveRun`) anywhere in the body tree
* (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).
* Seeds the markup id allocators so `{ bookmark }` / `{ moveFrom }` / `{ moveTo }`
* sugars never collide with ids the caller already assigned. Comment ids live in
* their own namespace (comments.nextId) and are intentionally excluded.
*/
function collectMaxMarkupIds(value, acc) {
if (value === null || value === void 0 || typeof value !== "object") return;
if (value instanceof Uint8Array || value instanceof Date) return;
if (Array.isArray(value)) {
for (const item of value) collectMaxMarkupIds(item, acc);
return;
}
const obj = value;
const rangeMarker = obj.bookmarkStart ?? obj.moveFromRangeStart ?? obj.moveToRangeStart;
if (isNumericIdMarker(rangeMarker) && rangeMarker.id > acc.range) acc.range = rangeMarker.id;
const moveRun = obj.movedFrom ?? obj.movedTo;
if (isNumericIdMarker(moveRun) && moveRun.id > acc.moveRun) acc.moveRun = moveRun.id;
for (const key of Object.keys(obj)) collectMaxMarkupIds(obj[key], acc);
}
/**
* Whether any `{ comment }` sugar child appears anywhere in the body tree
* (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).
* The document→comments relationship must exist whenever comments.xml will be
* generated; since sugar entries are registered during stringify — after the
* constructor wires relationships — this pre-scan predicts them so the part and
* its relationship stay in sync (OPC consistency). Every `{ comment }` always
* stringifies, so the prediction matches the entries actually registered.
*/
function bodyContainsCommentSugar(value) {
if (value === null || value === void 0) return false;
if (typeof value !== "object") return false;
if (value instanceof Uint8Array || value instanceof Date) return false;
if (Array.isArray(value)) {
for (const item of value) if (bodyContainsCommentSugar(item)) return true;
return false;
}
const obj = value;
if (typeof obj.comment === "object" && obj.comment !== null) return true;
for (const key of Object.keys(obj)) if (bodyContainsCommentSugar(obj[key])) return true;
return false;
}
var DocxWriteContext = class {
_currentRelationshipId = 1;
_sectionProperties = [];
get sectionProperties() {
return this._sectionProperties;
}
_hasFootnotes;
_hasEndnotes;
_hasNumbering;
get hasFootnotes() {
return this._hasFootnotes;
}
get hasEndnotes() {
return this._hasEndnotes;
}
get hasNumbering() {
return this._hasNumbering;
}
addRelationship(_type, _target, _mode) {
return `rId${this._currentRelationshipId++}`;
}
addMedia(data, type) {
return `{${this.media.addMedia(data, type, (fileName) => ({
data,
fileName,
type,
transformation: {
pixels: {
x: 0,
y: 0
},
emus: {
x: 0,
y: 0
}
}
})).fileName}}`;
}
_headers = [];
_footers = [];
constructor(options) {
this._options = options;
this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
this.comments = {
relationships: new Relationships(),
entries: [],
nextId: maxCommentId(options.comments?.children) + 1
};
const markupSeed = {
range: -1,
moveRun: -1
};
collectMaxMarkupIds(options.sections, markupSeed);
this.markupIds = {
rangeNext: markupSeed.range + 1,
moveRunNext: markupSeed.moveRun + 1
};
this.fileRelationships = new Relationships();
this.footNotes = {
relationships: new Relationships(),
notes: /* @__PURE__ */ new Map()
};
this.endnotes = {
relationships: new Relationships(),
notes: /* @__PURE__ */ new Map()
};
this.document = { relationships: new Relationships() };
this._settingsOptions = {
compatibility: options.compatibility,
compatibilityModeVersion: options.compatabilityModeVersion,
defaultTabStop: options.defaultTabStop,
evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,
characterSpacingControl: options.characterSpacingControl,
hyphenation: {
autoHyphenation: options.hyphenation?.autoHyphenation,
consecutiveHyphenLimit: options.hyphenation?.consecutiveHyphenLimit,
doNotHyphenateCaps: options.hyphenation?.doNotHyphenateCaps,
hyphenationZone: options.hyphenation?.hyphenationZone
},
trackRevisions: options.features?.trackRevisions,
updateFields: options.features?.updateFields,
documentProtection: options.features?.documentProtection,
view: options.view,
zoom: options.zoom,
writeProtection: options.writeProtection,
displayBackgroundShape: options.displayBackgroundShape ?? (options.background?.image ? true : void 0),
embedTrueTypeFonts: options.embedTrueTypeFonts,
embedSystemFonts: options.embedSystemFonts,
saveSubsetFonts: options.saveSubsetFonts,
docVars: options.docVars,
colorSchemeMapping: options.colorSchemeMapping,
mailMerge: options.mailMerge,
...options.settings
};
this.media = new Media();
this.charts = new ChartCollection();
this.smartArts = new SmartArtCollection();
this.embeddings = new EmbeddingCollection();
this.altChunks = new AltChunkCollection();
this.subDocs = new SubDocCollection();
if (options.externalStyles !== void 0) {
const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);
const defaultStyles = new DefaultStylesFactory().newInstance(options.styles?.default ?? {});
const externalIds = /* @__PURE__ */ new Set();
for (const s of externalStyles.importedStyles ?? []) {
const id = extractStyleId(s._raw);
if (id) externalIds.add(id);
}
const notInExternal = (arr) => (arr ?? []).filter((s) => !externalIds.has(s.id));
this.styles = new Styles({
importedStyles: externalStyles.importedStyles,
initialAttributes: externalStyles.initialAttributes ?? defaultStyles.initialAttributes,
paragraphStyles: notInExternal(defaultStyles.paragraphStyles),
characterStyles: notInExternal(defaultStyles.characterStyles),
tableStyles: notInExternal(defaultStyles.tableStyles),
numberingStyles: notInExternal(defaultStyles.numberingStyles)
});
} else if (options.styles) {
const s = options.styles;
if (s.roundTripped) {
const f = new DefaultStylesFactory().newInstance({});
const docDefaults = s.docDefaultsXml ?? f.importedStyles?.[0]?._raw ?? "";
const latentStyles = s.latentStylesXml ?? f.importedStyles?.[1]?._raw ?? "";
this.styles = new Styles({
importedStyles: [{ _raw: docDefaults }, { _raw: latentStyles }],
initialAttributes: s.initialAttributes ?? f.initialAttributes,
paragraphStyles: s.paragraphStyles,
characterStyles: s.characterStyles,
tableStyles: s.tableStyles,
numberingStyles: s.numberingStyles
});
} else {
const f = new DefaultStylesFactory().newInstance(s.default);
this.styles = new Styles({
importedStyles: f.importedStyles,
initialAttributes: s.initialAttributes ?? f.initialAttributes,
paragraphStyles: mergeById(f.paragraphStyles, s.paragraphStyles),
characterStyles: mergeById(f.characterStyles, s.characterStyles),
tableStyles: mergeById(f.tableStyles, s.tableStyles),
numberingStyles: mergeById(f.numberingStyles, s.numberingStyles)
});
}
} else {
const stylesFactory = new DefaultStylesFactory();
this.styles = new Styles(stylesFactory.newInstance());
}
if (options.styles?.paragraphStyles) for (const style of options.styles.paragraphStyles) {
const num = style.paragraph?.numbering;
if (num) this.numbering.createConcreteNumberingInstance(num.reference, num.instance ?? 0);
}
const sourceOverrides = options.contentTypes?.overrides ?? [];
this._hasFootnotes = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/footnotes.xml");
this._hasEndnotes = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/endnotes.xml");
this._hasNumbering = !options.contentTypes || sourceOverrides.some((o) => o.partName === "/word/numbering.xml");
this.addDefaultRelationships();
for (const section of options.sections) this.addSection(section);
if (options.footnotes) {
for (const key in options.footnotes) {
if (key === "separator" || key === "continuationSeparator") continue;
this.footNotes.notes.set(parseFloat(key), options.footnotes[key].children);
}
this.footNotes.separator = options.footnotes.separator;
this.footNotes.continuationSeparator = options.footnotes.continuationSeparator;
}
if (options.endnotes) {
for (const key in options.endnotes) {
if (key === "separator" || key === "continuationSeparator") continue;
this.endnotes.notes.set(parseFloat(key), options.endnotes[key].children);
}
this.endnotes.separator = options.endnotes.separator;
this.endnotes.continuationSeparator = options.endnotes.continuationSeparator;
}
this.fontTable = new FontWrapper(options.fonts ?? []);
this.glossaryOptions = options.glossary;
this.webSettings = options.webSettings ?? void 0;
if (options.glossary) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument", "glossary/document.xml");
if (this.webSettings) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", "webSettings.xml");
}
get headers() {
return this._headers;
}
get footers() {
return this._footers;
}
addSection({ headers = {}, footers = {}, properties }) {
const sectPrOptions = {
...properties,
footerWrapperGroup: {
default: footers.default ? this.createFooter(footers.default) : void 0,
even: footers.even ? this.createFooter(footers.even) : void 0,
first: footers.first ? this.createFooter(footers.first) : void 0
},
headerWrapperGroup: {
default: headers.default ? this.createHeader(headers.default) : void 0,
even: headers.even ? this.createHeader(headers.even) : void 0,
first: headers.first ? this.createHeader(headers.first) : void 0
}
};
this._sectionProperties.push(sectPrOptions);
}
createHeader(header) {
const referenceId = this._currentRelationshipId++;
const entry = {
children: header,
relationships: new Relationships(),
referenceId
};
this.addHeaderToDocument(entry);
return entry;
}
createFooter(footer) {
const referenceId = this._currentRelationshipId++;
const entry = {
children: footer,
relationships: new Relationships(),
referenceId
};
this.addFooterToDocument(entry);
return entry;
}
addHeaderToDocument(header) {
this._headers.push(header);
this.document.relationships.addRelationship(header.referenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", `header${this._headers.length}.xml`);
}
addFooterToDocument(footer) {
this._footers.push(footer);
this.document.relationships.addRelationship(footer.referenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", `footer${this._footers.length}.xml`);
}
addDefaultRelationships() {
this.fileRelationships.addRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "word/document.xml");
this.fileRelationships.addRelationship(2, "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", "docProps/core.xml");
this.fileRelationships.addRelationship(3, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", "docProps/app.xml");
this.fileRelationships.addRelationship(4, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties", "docProps/custom.xml");
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml");
if (this._hasNumbering) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", "numbering.xml");
if (this._hasFootnotes) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", "footnotes.xml");
if (this._hasEndnotes) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", "endnotes.xml");
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", "settings.xml");
if (this._options.comments?.children?.length || bodyContainsCommentSugar(this._options.sections)) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", "comments.xml");
if (this._options.bibliography) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography", "bibliography.xml");
const themePart = this._options.rawParts?.find((p) => p.path.startsWith("word/theme/"));
this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", themePart ? themePart.path.replace(/^word\//, "") : "theme/theme1.xml");
for (const part of this._options.rawParts ?? []) if (part.path.startsWith("customXml/") && part.path.endsWith(".xml") && !part.path.includes("/_rels/") && !part.path.includes("itemProps")) this.document.relationships.addRelationship(this._currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", `../${part.path}`);
}
};
/**
* DOCX-specific read context.
*
* Holds references to the parsed DocxDocument and cached style/numbering data
* used throughout the DOCX parsing pipeline. Implements ReadContext for
* descriptor pipeline compatibility.
*/
var DocxReadContext = class {
docx;
styleCache;
numberingCache;
/**
* Path of the part currently being parsed. Each part carries its own .rels
* with independent rId numbering, so drawings inside a part must resolve
* image relationships against that part's rels. Defaults to the document body.
*/
currentPart = "word/document.xml";
constructor(docx, styleCache, numberingCache) {
this.docx = docx;
this.styleCache = styleCache;
this.numberingCache = numberingCache;
}
resolveRelationship(rId) {
const partMedia = this.docx.partRefs.partMedia.get(this.currentPart);
if (partMedia) {
const media = partMedia.get(rId);
if (media) return media;
}
return this.docx.partRefs.headers.get(rId) ?? this.docx.partRefs.footers.get(rId) ?? this.docx.partRefs.media.get(rId) ?? this.docx.partRefs.charts.get(rId) ?? this.docx.partRefs.diagramData.get(rId) ?? this.docx.partRefs.afChunks.get(rId) ?? this.docx.partRefs.subDocs.get(rId) ?? this.docx.partRefs.hyperlinks.get(rId);
}
/**
* Run `fn` with `currentPart` temporarily set to `partPath`, restoring the
* previous value afterwards. Use when parsing a sub-document part (header,
* footer, footnotes, …) so its drawings resolve images from its own rels.
*/
withPart(partPath, fn) {
const prev = this.currentPart;
this.currentPart = partPath;
try {
return fn();
} finally {
this.currentPart = prev;
}
}
getPart(path) {
return this.docx.doc.get(path);
}
getRaw(path) {
return this.docx.doc.getRaw(path);
}
};
//#endregion
export { AltChunkCollection as i, DocxWriteContext as n, SubDocCollection as r, DocxReadContext as t };
//# sourceMappingURL=context-nyQP2Fkk.mjs.map
{"version":3,"file":"context-nyQP2Fkk.mjs","names":[],"sources":["../src/parts/alt-chunk/alt-chunk-collection.ts","../src/parts/sub-doc/sub-doc-collection.ts","../src/parts/styles/external-styles-factory.ts","../src/shared/embeddings/embeddings.ts","../src/context.ts"],"sourcesContent":["/**\n * AltChunk collection module for managing alternative format content parts.\n *\n * @module\n */\n\n/**\n * Stores alternative format chunk data for later serialization by the compiler.\n */\nexport interface AltChunkData {\n /** Unique key for this alt chunk (e.g., relId) */\n key: string;\n /** Raw content data */\n data: Uint8Array;\n /** Part sub-path within word/ (e.g., \"afchunks/afchunk1.html\") */\n path: string;\n /** File extension (e.g., \"html\", \"rtf\", \"txt\") */\n extension: string;\n /** MIME content type (e.g., \"text/html\", \"application/rtf\") */\n contentType: string;\n}\n\n/**\n * Manages alternative format chunk parts in a document.\n *\n * Stores external content (HTML, RTF, plain text) that will be\n * serialized into separate parts in the DOCX package.\n */\nexport class AltChunkCollection {\n private map: Map<string, AltChunkData>;\n\n public constructor() {\n this.map = new Map<string, AltChunkData>();\n }\n\n public addAltChunk(key: string, data: AltChunkData): void {\n this.map.set(key, data);\n }\n\n public get array(): AltChunkData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * Sub-document collection module for managing sub-document parts.\n *\n * @module\n */\n\n/**\n * Stores sub-document data for later serialization by the compiler.\n */\nexport interface SubDocData {\n /** Raw document data (.docx bytes) */\n data: Uint8Array;\n /** Part sub-path within word/ (e.g., \"subdocs/subdoc1.docx\") */\n path: string;\n}\n\n/**\n * Manages sub-document parts in a document.\n */\nexport class SubDocCollection {\n private map: Map<string, SubDocData>;\n\n public constructor() {\n this.map = new Map<string, SubDocData>();\n }\n\n public addSubDoc(key: string, data: SubDocData): void {\n this.map.set(key, data);\n }\n\n public get array(): SubDocData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * External styles factory module for WordprocessingML documents.\n *\n * Parses styles from external XML and returns raw XML strings.\n * No XmlComponent dependency.\n *\n * Reference: http://officeopenxml.com/WPstyles.php\n *\n * @module\n */\nimport { js2xml, xml2js } from \"@office-open/xml\";\nimport type { Element as XMLElement } from \"@office-open/xml\";\n\nimport type { StylesOptions } from \"./styles\";\n\n/**\n * Factory for creating styles from external XML sources.\n *\n * Parses styles from XML (typically from a styles.xml file)\n * and returns raw XML strings for each style element.\n */\nexport class ExternalStylesFactory {\n /**\n * Creates new Styles based on the given XML data.\n *\n * Parses the styles XML and converts each child to a raw XML string.\n */\n public newInstance(xmlData: string): StylesOptions {\n const xmlObj = xml2js(xmlData, { compact: false }) as XMLElement;\n\n let stylesXmlElement: XMLElement | undefined;\n for (const xmlElm of xmlObj.elements || []) {\n if (xmlElm.name === \"w:styles\") {\n stylesXmlElement = xmlElm;\n }\n }\n\n if (stylesXmlElement === undefined) {\n return { importedStyles: [], initialAttributes: {} };\n }\n\n const stylesElements = stylesXmlElement.elements || [];\n\n return {\n importedStyles: stylesElements.map((childElm) => ({\n _raw: js2xml({ elements: [childElm] }),\n })),\n initialAttributes: (stylesXmlElement.attributes as Record<string, string>) ?? {},\n };\n }\n}\n","/**\n * Embeddings module for WordprocessingML documents.\n *\n * Manages OLE object embeddings (word/embeddings/oleObjectN.bin) referenced by\n * w:object elements. Mirrors the Media collection pattern but targets binary\n * OLE container parts instead of images.\n *\n * @module\n */\n\n/** OLE embedding data stored under word/embeddings/. */\nexport interface EmbeddingData {\n /** File name within word/embeddings/ (e.g. \"oleObject1.bin\"). */\n fileName: string;\n /** Raw OLE container bytes. */\n data: Uint8Array;\n /** OLE program id (e.g. \"Excel.Sheet.12\") — informational only. */\n progId?: string;\n}\n\n/**\n * Collects OLE embeddings allocated during document generation. Each embedding\n * is stored under a sequential `oleObjectN.bin` name in word/embeddings/,\n * mirroring MS Office's numbering so output is deterministic and diffable.\n */\nexport class EmbeddingCollection {\n private map = new Map<string, EmbeddingData>();\n private counter = 0;\n\n /** Allocate the next sequential embedding file name (oleObject1.bin, …). */\n public nextEmbeddingName(): string {\n return `oleObject${++this.counter}.bin`;\n }\n\n /** Register an embedding under a unique key. */\n public addEmbedding(key: string, data: EmbeddingData): void {\n this.map.set(key, data);\n }\n\n /** All registered embeddings in insertion order. */\n public get array(): EmbeddingData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * DOCX compilation context.\n *\n * DocxWriteContext holds all mutable state needed during document compilation.\n * generateDocument() creates a DocxWriteContext internally.\n *\n * @module\n */\n\nimport { Relationships } from \"@office-open/core\";\nimport { ChartCollection } from \"@office-open/core/chart\";\nimport type { ReadContext, WriteContext } from \"@office-open/core/descriptor\";\nimport { SmartArtCollection } from \"@office-open/core/smartart\";\nimport type { Element } from \"@office-open/xml\";\nimport { AltChunkCollection } from \"@parts/alt-chunk/alt-chunk-collection\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport type { SectionPropertiesOptions } from \"@parts/document/body/section-properties/section-properties\";\nimport type { EndnoteSeparator } from \"@parts/endnotes/descriptor\";\nimport { FontWrapper } from \"@parts/fonts/font-wrapper\";\nimport type { FootnoteSeparator } from \"@parts/footnotes/descriptor\";\nimport type { GlossaryDocumentOptions } from \"@parts/glossary-document\";\nimport type { HeaderFooterEntry } from \"@parts/header-footer\";\nimport { Numbering } from \"@parts/numbering\";\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\nimport type { SettingsOptions } from \"@parts/settings/settings\";\nimport { Styles, extractStyleId } from \"@parts/styles\";\nimport { ExternalStylesFactory } from \"@parts/styles/external-styles-factory\";\nimport { DefaultStylesFactory } from \"@parts/styles/factory\";\nimport { SubDocCollection } from \"@parts/sub-doc/sub-doc-collection\";\nimport type { WebSettingsOptions } from \"@parts/web-settings\";\nimport { EmbeddingCollection } from \"@shared/embeddings/embeddings\";\nimport { Media } from \"@shared/media\";\nimport type { MediaData } from \"@shared/media/data\";\nimport type { SectionOptions } from \"@shared/section\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport type { DocxDocument } from \"./parse\";\n\n/** User styles override factory defaults with the same styleId; keep the rest. */\nfunction mergeById<T extends { id: string }>(\n factoryStyles: T[] | undefined,\n userStyles: T[] | undefined,\n): T[] {\n const factory = factoryStyles ?? [];\n if (!userStyles || userStyles.length === 0) return factory;\n const userIds = new Set(userStyles.map((s) => s.id));\n return [...factory.filter((s) => !userIds.has(s.id)), ...userStyles];\n}\n\n/**\n * Highest comment id in an explicit comments list, or -1 when there are none.\n * Seeds the comment id allocator so auto-allocated ids never collide with ids\n * the caller already assigned (e.g. round-tripped from an existing document).\n */\nfunction maxCommentId(comments: readonly CommentOptions[] | undefined): number {\n let max = -1;\n if (comments) {\n for (const c of comments) {\n if (c.id > max) max = c.id;\n }\n }\n return max;\n}\n\n/** Narrows an object to a `{ id: number }` marker without an `as` cast. */\nfunction isNumericIdMarker(value: unknown): value is { id: number } {\n return (\n typeof value === \"object\" && value !== null && \"id\" in value && typeof value.id === \"number\"\n );\n}\n\n/**\n * Highest w:id among explicit bookmark + move-range start markers (`range`) and\n * explicit movedFrom/movedTo runs (`moveRun`) anywhere in the body tree\n * (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).\n * Seeds the markup id allocators so `{ bookmark }` / `{ moveFrom }` / `{ moveTo }`\n * sugars never collide with ids the caller already assigned. Comment ids live in\n * their own namespace (comments.nextId) and are intentionally excluded.\n */\nfunction collectMaxMarkupIds(value: unknown, acc: { range: number; moveRun: number }): void {\n if (value === null || value === undefined || typeof value !== \"object\") return;\n if (value instanceof Uint8Array || value instanceof Date) return;\n if (Array.isArray(value)) {\n for (const item of value) collectMaxMarkupIds(item, acc);\n return;\n }\n const obj = value as Record<string, unknown>;\n const rangeMarker = obj.bookmarkStart ?? obj.moveFromRangeStart ?? obj.moveToRangeStart;\n if (isNumericIdMarker(rangeMarker) && rangeMarker.id > acc.range) acc.range = rangeMarker.id;\n const moveRun = obj.movedFrom ?? obj.movedTo;\n if (isNumericIdMarker(moveRun) && moveRun.id > acc.moveRun) acc.moveRun = moveRun.id;\n for (const key of Object.keys(obj)) collectMaxMarkupIds(obj[key], acc);\n}\n\n/**\n * Whether any `{ comment }` sugar child appears anywhere in the body tree\n * (paragraphs, tables, textboxes, SDTs, headers/footers nested in sections).\n * The document→comments relationship must exist whenever comments.xml will be\n * generated; since sugar entries are registered during stringify — after the\n * constructor wires relationships — this pre-scan predicts them so the part and\n * its relationship stay in sync (OPC consistency). Every `{ comment }` always\n * stringifies, so the prediction matches the entries actually registered.\n */\nfunction bodyContainsCommentSugar(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value !== \"object\") return false;\n if (value instanceof Uint8Array || value instanceof Date) return false;\n if (Array.isArray(value)) {\n for (const item of value) {\n if (bodyContainsCommentSugar(item)) return true;\n }\n return false;\n }\n const obj = value as Record<string, unknown>;\n if (typeof obj.comment === \"object\" && obj.comment !== null) return true;\n for (const key of Object.keys(obj)) {\n if (bodyContainsCommentSugar(obj[key])) return true;\n }\n return false;\n}\n\n/** Interface for document view wrappers — provides relationships access. */\nexport interface ViewWrapper {\n relationships: Relationships;\n}\n\n// ── BodyContext ──\n\n/**\n * Context for body-level stringification.\n *\n * Pure JSON pipeline context — extends WriteContext for descriptor compatibility.\n * No dependency on XmlComponent Context (compile/ uses zero toXml calls).\n */\nexport interface BodyContext extends WriteContext {\n /** The root write context with all mutable document state. */\n fileData: DocxWriteContext;\n /** Alias for fileData — some descriptor internals access context.file. */\n file: DocxWriteContext;\n /** Current view wrapper for relationship access. */\n viewWrapper: { relationships: Relationships };\n /** Stringify a body-level child element — injected to break circular imports. */\n stringifyChild: (child: SectionChild, ctx: BodyContext) => string;\n}\n\n// ── DocxWriteContext ──\n\nexport class DocxWriteContext implements WriteContext {\n private _currentRelationshipId = 1;\n\n // --- Accessed by XmlComponent via context.file.* during toXml() ---\n declare public document: { relationships: Relationships };\n declare public numbering: Numbering;\n declare public media: Media<MediaData>;\n declare public charts: ChartCollection;\n declare public smartArts: SmartArtCollection;\n declare public embeddings: EmbeddingCollection;\n declare public altChunks: AltChunkCollection;\n declare public subDocs: SubDocCollection;\n declare public comments: {\n relationships: Relationships;\n /** Comment entries registered by `{ comment }` sugar children during stringify. */\n entries: CommentOptions[];\n /** Next auto-allocated comment id (seeded above any explicit comment id). */\n nextId: number;\n };\n declare public markupIds: {\n /** Next id for bookmark + move-range markers (CT_MarkupRange) — shared, like Word. */\n rangeNext: number;\n /** Next id for movedFrom/movedTo runs (CT_TrackChange). */\n moveRunNext: number;\n };\n declare public footNotes: {\n relationships: Relationships;\n notes: Map<number, (ParagraphOptions | string)[]>;\n separator?: FootnoteSeparator;\n continuationSeparator?: FootnoteSeparator;\n };\n declare public endnotes: {\n relationships: Relationships;\n notes: Map<number, (ParagraphOptions | string)[]>;\n separator?: EndnoteSeparator;\n continuationSeparator?: EndnoteSeparator;\n };\n\n // --- Additional state used by the compiler ---\n declare public fileRelationships: Relationships;\n declare public _settingsOptions: SettingsOptions;\n declare public styles: Styles;\n declare public fontTable: FontWrapper;\n declare public glossaryOptions: GlossaryDocumentOptions | undefined;\n declare public webSettings: WebSettingsOptions | undefined;\n\n // --- Section properties (one per section, raw options for descriptor pipeline) ---\n private _sectionProperties: SectionPropertiesOptions[] = [];\n public get sectionProperties(): readonly SectionPropertiesOptions[] {\n return this._sectionProperties;\n }\n\n // Footnotes/endnotes are optional parts. Fresh compile always emits them\n // (Word ships a separators-only file); round-trip emits them only when the\n // source package declared the part — otherwise emitting the part + document\n // relationship without a [Content_Types] Override is an OPC violation that\n // makes Word reject the package as unreadable content.\n private readonly _hasFootnotes: boolean;\n private readonly _hasEndnotes: boolean;\n private readonly _hasNumbering: boolean;\n public get hasFootnotes(): boolean {\n return this._hasFootnotes;\n }\n public get hasEndnotes(): boolean {\n return this._hasEndnotes;\n }\n public get hasNumbering(): boolean {\n return this._hasNumbering;\n }\n\n // --- WriteContext interface (core descriptor pipeline) ---\n\n public addRelationship(_type: string, _target: string, _mode?: string): string {\n const id = this._currentRelationshipId++;\n return `rId${id}`;\n }\n\n public addMedia(data: Uint8Array, type: string): string {\n const entry = this.media.addMedia(\n data,\n type,\n (fileName) =>\n ({\n data,\n fileName,\n type,\n transformation: { pixels: { x: 0, y: 0 }, emus: { x: 0, y: 0 } },\n }) as MediaData,\n );\n return `{${entry.fileName}}`;\n }\n\n // --- Internal tracking ---\n private _headers: HeaderFooterEntry[] = [];\n private _footers: HeaderFooterEntry[] = [];\n\n // --- Original input preserved for descriptor usage ---\n declare public _options: DocumentOptions;\n\n constructor(options: DocumentOptions) {\n this._options = options;\n\n this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });\n\n this.comments = {\n relationships: new Relationships(),\n entries: [],\n nextId: maxCommentId(options.comments?.children) + 1,\n };\n const markupSeed = { range: -1, moveRun: -1 };\n collectMaxMarkupIds(options.sections, markupSeed);\n this.markupIds = {\n rangeNext: markupSeed.range + 1,\n moveRunNext: markupSeed.moveRun + 1,\n };\n this.fileRelationships = new Relationships();\n this.footNotes = { relationships: new Relationships(), notes: new Map() };\n this.endnotes = { relationships: new Relationships(), notes: new Map() };\n this.document = { relationships: new Relationships() };\n this._settingsOptions = {\n compatibility: options.compatibility,\n compatibilityModeVersion: options.compatabilityModeVersion,\n defaultTabStop: options.defaultTabStop,\n evenAndOddHeaders: options.evenAndOddHeaderAndFooters ? true : false,\n characterSpacingControl: options.characterSpacingControl,\n hyphenation: {\n autoHyphenation: options.hyphenation?.autoHyphenation,\n consecutiveHyphenLimit: options.hyphenation?.consecutiveHyphenLimit,\n doNotHyphenateCaps: options.hyphenation?.doNotHyphenateCaps,\n hyphenationZone: options.hyphenation?.hyphenationZone,\n },\n trackRevisions: options.features?.trackRevisions,\n updateFields: options.features?.updateFields,\n documentProtection: options.features?.documentProtection,\n view: options.view,\n zoom: options.zoom,\n writeProtection: options.writeProtection,\n displayBackgroundShape:\n options.displayBackgroundShape ?? (options.background?.image ? true : undefined),\n embedTrueTypeFonts: options.embedTrueTypeFonts,\n embedSystemFonts: options.embedSystemFonts,\n saveSubsetFonts: options.saveSubsetFonts,\n docVars: options.docVars,\n colorSchemeMapping: options.colorSchemeMapping,\n mailMerge: options.mailMerge,\n ...options.settings,\n };\n\n this.media = new Media<MediaData>();\n this.charts = new ChartCollection();\n this.smartArts = new SmartArtCollection();\n this.embeddings = new EmbeddingCollection();\n this.altChunks = new AltChunkCollection();\n this.subDocs = new SubDocCollection();\n\n if (options.externalStyles !== undefined) {\n const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);\n const defaultStyles = new DefaultStylesFactory().newInstance(options.styles?.default ?? {});\n // External (user-provided full styles.xml) wins; factory builtins fill\n // any gaps. Drop factory builtins whose styleId the external XML already\n // defines (no duplicate styleId). docDefaults/latentStyles come from the\n // external XML — the factory's are not mixed in.\n const externalIds = new Set<string>();\n for (const s of externalStyles.importedStyles ?? []) {\n const id = extractStyleId(s._raw);\n if (id) externalIds.add(id);\n }\n const notInExternal = <T extends { id: string }>(arr: T[] | undefined) =>\n (arr ?? []).filter((s) => !externalIds.has(s.id));\n this.styles = new Styles({\n importedStyles: externalStyles.importedStyles,\n initialAttributes: externalStyles.initialAttributes ?? defaultStyles.initialAttributes,\n paragraphStyles: notInExternal(defaultStyles.paragraphStyles),\n characterStyles: notInExternal(defaultStyles.characterStyles),\n tableStyles: notInExternal(defaultStyles.tableStyles),\n numberingStyles: notInExternal(defaultStyles.numberingStyles),\n });\n } else if (options.styles) {\n const s = options.styles;\n if (s.roundTripped) {\n // Round-trip origin (parseStyleDefinitions): parsed structured\n // builtin/custom styles win. The factory only supplies docDefaults +\n // latentStyles verbatim defaults; parsed docDefaultsXml/latentStylesXml\n // override when present. No factory builtin rebuild — parsed builtins\n // already carry the source document's customizations.\n const f = new DefaultStylesFactory().newInstance({});\n const docDefaults = s.docDefaultsXml ?? f.importedStyles?.[0]?._raw ?? \"\";\n const latentStyles = s.latentStylesXml ?? f.importedStyles?.[1]?._raw ?? \"\";\n this.styles = new Styles({\n importedStyles: [{ _raw: docDefaults }, { _raw: latentStyles }],\n initialAttributes: s.initialAttributes ?? f.initialAttributes,\n paragraphStyles: s.paragraphStyles,\n characterStyles: s.characterStyles,\n tableStyles: s.tableStyles,\n numberingStyles: s.numberingStyles,\n });\n } else {\n // Fresh generation: factory default builtins (structured) + user\n // overrides. User paragraphStyles/characterStyles/tableStyles/\n // numberingStyles override factory builtins with the same styleId.\n const f = new DefaultStylesFactory().newInstance(s.default);\n this.styles = new Styles({\n importedStyles: f.importedStyles,\n initialAttributes: s.initialAttributes ?? f.initialAttributes,\n paragraphStyles: mergeById(f.paragraphStyles, s.paragraphStyles),\n characterStyles: mergeById(f.characterStyles, s.characterStyles),\n tableStyles: mergeById(f.tableStyles, s.tableStyles),\n numberingStyles: mergeById(f.numberingStyles, s.numberingStyles),\n });\n }\n } else {\n const stylesFactory = new DefaultStylesFactory();\n this.styles = new Styles(stylesFactory.newInstance());\n }\n\n // Register numbering references from custom paragraph/character styles.\n // Style definitions may contain numbering properties whose concrete instances\n // are never created through the body paragraph processing path.\n if (options.styles?.paragraphStyles) {\n for (const style of options.styles.paragraphStyles) {\n const num = style.paragraph?.numbering;\n if (num) {\n this.numbering.createConcreteNumberingInstance(num.reference, num.instance ?? 0);\n }\n }\n }\n\n // Resolve footnote/endnote presence from the source [Content_Types]: a\n // round-tripped package only carries these parts when the source declared\n // them. Fresh compile (no contentTypes) always emits both.\n const sourceOverrides = options.contentTypes?.overrides ?? [];\n this._hasFootnotes =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/footnotes.xml\");\n this._hasEndnotes =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/endnotes.xml\");\n // Numbering follows the source [Content_Types] on round-trip — the part is\n // optional, and emitting it without a matching Override is an OPC violation.\n // Fresh compile always emits it (Word ships a default bullet list).\n this._hasNumbering =\n !options.contentTypes || sourceOverrides.some((o) => o.partName === \"/word/numbering.xml\");\n\n this.addDefaultRelationships();\n\n for (const section of options.sections) {\n this.addSection(section);\n }\n\n if (options.footnotes) {\n for (const key in options.footnotes) {\n // Skip the round-tripped separator markers (they carry no .children).\n if (key === \"separator\" || key === \"continuationSeparator\") continue;\n this.footNotes.notes.set(parseFloat(key), options.footnotes[key].children);\n }\n this.footNotes.separator = options.footnotes.separator;\n this.footNotes.continuationSeparator = options.footnotes.continuationSeparator;\n }\n\n if (options.endnotes) {\n for (const key in options.endnotes) {\n if (key === \"separator\" || key === \"continuationSeparator\") continue;\n this.endnotes.notes.set(parseFloat(key), options.endnotes[key].children);\n }\n this.endnotes.separator = options.endnotes.separator;\n this.endnotes.continuationSeparator = options.endnotes.continuationSeparator;\n }\n\n this.fontTable = new FontWrapper(options.fonts ?? []);\n this.glossaryOptions = options.glossary;\n this.webSettings = options.webSettings ?? undefined;\n\n if (options.glossary) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument\",\n \"glossary/document.xml\",\n );\n }\n\n if (this.webSettings) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\",\n \"webSettings.xml\",\n );\n }\n }\n\n get headers(): HeaderFooterEntry[] {\n return this._headers;\n }\n\n get footers(): HeaderFooterEntry[] {\n return this._footers;\n }\n\n // --- Private helpers ---\n\n private addSection({ headers = {}, footers = {}, properties }: SectionOptions): void {\n const sectPrOptions: SectionPropertiesOptions = {\n ...properties,\n footerWrapperGroup: {\n default: footers.default ? this.createFooter(footers.default) : undefined,\n even: footers.even ? this.createFooter(footers.even) : undefined,\n first: footers.first ? this.createFooter(footers.first) : undefined,\n },\n headerWrapperGroup: {\n default: headers.default ? this.createHeader(headers.default) : undefined,\n even: headers.even ? this.createHeader(headers.even) : undefined,\n first: headers.first ? this.createHeader(headers.first) : undefined,\n },\n };\n this._sectionProperties.push(sectPrOptions);\n }\n\n private createHeader(header: SectionChild[]): HeaderFooterEntry {\n const referenceId = this._currentRelationshipId++;\n const entry: HeaderFooterEntry = {\n children: header,\n relationships: new Relationships(),\n referenceId,\n };\n this.addHeaderToDocument(entry);\n return entry;\n }\n\n private createFooter(footer: SectionChild[]): HeaderFooterEntry {\n const referenceId = this._currentRelationshipId++;\n const entry: HeaderFooterEntry = {\n children: footer,\n relationships: new Relationships(),\n referenceId,\n };\n this.addFooterToDocument(entry);\n return entry;\n }\n\n private addHeaderToDocument(header: HeaderFooterEntry): void {\n this._headers.push(header);\n this.document.relationships.addRelationship(\n header.referenceId,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\",\n `header${this._headers.length}.xml`,\n );\n }\n\n private addFooterToDocument(footer: HeaderFooterEntry): void {\n this._footers.push(footer);\n this.document.relationships.addRelationship(\n footer.referenceId,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer\",\n `footer${this._footers.length}.xml`,\n );\n }\n\n private addDefaultRelationships(): void {\n this.fileRelationships.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n \"word/document.xml\",\n );\n this.fileRelationships.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n this.fileRelationships.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n this.fileRelationships.addRelationship(\n 4,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\",\n \"docProps/custom.xml\",\n );\n\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\",\n \"styles.xml\",\n );\n if (this._hasNumbering) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\",\n \"numbering.xml\",\n );\n }\n if (this._hasFootnotes) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\",\n \"footnotes.xml\",\n );\n }\n if (this._hasEndnotes) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\",\n \"endnotes.xml\",\n );\n }\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\",\n \"settings.xml\",\n );\n // Comments is an optional part — only wire the document→comments relationship\n // when the document actually carries comments. Emitting it unconditionally\n // produces an orphan comments.xml that Word rejects as an OPC violation\n // (empty part with no [Content_Types] Override when content types are\n // passed through from the source on round-trip).\n if (\n this._options.comments?.children?.length ||\n bodyContainsCommentSugar(this._options.sections)\n ) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\",\n \"comments.xml\",\n );\n }\n if (this._options.bibliography) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography\",\n \"bibliography.xml\",\n );\n }\n\n // Theme — always present: fresh-compile generates a default theme, round-trip\n // passes the source theme through rawParts. Word needs the document→theme\n // relationship to resolve theme colors/fonts.\n const themePart = this._options.rawParts?.find((p) => p.path.startsWith(\"word/theme/\"));\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\",\n themePart ? themePart.path.replace(/^word\\//, \"\") : \"theme/theme1.xml\",\n );\n\n // customXml storage — raw-passthrough parts. Declare the document→customXml\n // relationship for each item (itemProps are linked via the item's own .rels,\n // not directly by the document) so Word can bind cover-page metadata, etc.\n for (const part of this._options.rawParts ?? []) {\n if (\n part.path.startsWith(\"customXml/\") &&\n part.path.endsWith(\".xml\") &&\n !part.path.includes(\"/_rels/\") &&\n !part.path.includes(\"itemProps\")\n ) {\n this.document.relationships.addRelationship(\n this._currentRelationshipId++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml\",\n `../${part.path}`,\n );\n }\n }\n }\n}\n\n// ── DocxReadContext ──\n\n/**\n * DOCX-specific read context.\n *\n * Holds references to the parsed DocxDocument and cached style/numbering data\n * used throughout the DOCX parsing pipeline. Implements ReadContext for\n * descriptor pipeline compatibility.\n */\nexport class DocxReadContext implements ReadContext {\n /**\n * Path of the part currently being parsed. Each part carries its own .rels\n * with independent rId numbering, so drawings inside a part must resolve\n * image relationships against that part's rels. Defaults to the document body.\n */\n public currentPart = \"word/document.xml\";\n\n constructor(\n public docx: DocxDocument,\n public styleCache: Map<string, Element>,\n public numberingCache: Map<string, Element>,\n ) {}\n\n resolveRelationship(rId: string): string | undefined {\n const partMedia = this.docx.partRefs.partMedia.get(this.currentPart);\n if (partMedia) {\n const media = partMedia.get(rId);\n if (media) return media;\n }\n return (\n this.docx.partRefs.headers.get(rId) ??\n this.docx.partRefs.footers.get(rId) ??\n this.docx.partRefs.media.get(rId) ??\n this.docx.partRefs.charts.get(rId) ??\n this.docx.partRefs.diagramData.get(rId) ??\n this.docx.partRefs.afChunks.get(rId) ??\n this.docx.partRefs.subDocs.get(rId) ??\n this.docx.partRefs.hyperlinks.get(rId)\n );\n }\n\n /**\n * Run `fn` with `currentPart` temporarily set to `partPath`, restoring the\n * previous value afterwards. Use when parsing a sub-document part (header,\n * footer, footnotes, …) so its drawings resolve images from its own rels.\n */\n withPart<T>(partPath: string, fn: () => T): T {\n const prev = this.currentPart;\n this.currentPart = partPath;\n try {\n return fn();\n } finally {\n this.currentPart = prev;\n }\n }\n\n getPart(path: string): Element | undefined {\n return this.docx.doc.get(path);\n }\n\n getRaw(path: string): Uint8Array | undefined {\n return this.docx.doc.getRaw(path);\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAa,qBAAb,MAAgC;CAC9B;CAEA,cAAqB;EACnB,KAAK,sBAAM,IAAI,IAA0B;CAC3C;CAEA,YAAmB,KAAa,MAA0B;EACxD,KAAK,IAAI,IAAI,KAAK,IAAI;CACxB;CAEA,IAAW,QAAwB;EACjC,OAAO,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC;CAC9B;AACF;;;;;;ACvBA,IAAa,mBAAb,MAA8B;CAC5B;CAEA,cAAqB;EACnB,KAAK,sBAAM,IAAI,IAAwB;CACzC;CAEA,UAAiB,KAAa,MAAwB;EACpD,KAAK,IAAI,IAAI,KAAK,IAAI;CACxB;CAEA,IAAW,QAAsB;EAC/B,OAAO,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC;CAC9B;AACF;;;;;;;;;;;;;;;;;;;ACZA,IAAa,wBAAb,MAAmC;;;;;;CAMjC,YAAmB,SAAgC;EACjD,MAAM,SAAS,OAAO,SAAS,EAAE,SAAS,MAAM,CAAC;EAEjD,IAAI;EACJ,KAAK,MAAM,UAAU,OAAO,YAAY,CAAC,GACvC,IAAI,OAAO,SAAS,YAClB,mBAAmB;EAIvB,IAAI,qBAAqB,KAAA,GACvB,OAAO;GAAE,gBAAgB,CAAC;GAAG,mBAAmB,CAAC;EAAE;EAKrD,OAAO;GACL,iBAHqB,iBAAiB,YAAY,CAAC,EAAA,CAGpB,KAAK,cAAc,EAChD,MAAM,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,EACvC,EAAE;GACF,mBAAoB,iBAAiB,cAAyC,CAAC;EACjF;CACF;AACF;;;;;;;;ACzBA,IAAa,sBAAb,MAAiC;CAC/B,sBAAc,IAAI,IAA2B;CAC7C,UAAkB;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,KAAK,SAAS,QAAQ,IAAI,GAAG,KAClC,KAAK,KAAK,SAAS,WAAW,IAAI,GAAG;CAEzC;;;;;;CAOA,SAAY,UAAkB,IAAgB;EAC5C,MAAM,OAAO,KAAK;EAClB,KAAK,cAAc;EACnB,IAAI;GACF,OAAO,GAAG;EACZ,UAAU;GACR,KAAK,cAAc;EACrB;CACF;CAEA,QAAQ,MAAmC;EACzC,OAAO,KAAK,KAAK,IAAI,IAAI,IAAI;CAC/B;CAEA,OAAO,MAAsC;EAC3C,OAAO,KAAK,KAAK,IAAI,OAAO,IAAI;CAClC;AACF"}
import { C as footnotesDesc, S as endnotesDesc, _ as glossaryDesc, a as appPropertiesDesc, bt as stringifyDocumentXml, d as withAltChunkOverrides, f as withMediaDefaults, i as webSettingsDesc, j as settingsDesc, l as buildContentTypesFromRegistry, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, p as commentsDesc, s as corePropertiesDesc, u as contentTypesDesc, v as bibliographyDesc, y as fontTableDesc, yt as stringifyBodyChild } from "./parts-D0KoDfg7.mjs";
import { n as DocxWriteContext } from "./context-nyQP2Fkk.mjs";
import { OoxmlMimeType, addSmartArtRelationships, createPacker, createThemeXml, findAndReplaceImagePlaceholders, formatId, hasPlaceholders, levelForMediaName, optionalRelsPart, replaceAllPlaceholders, replaceNumberingPlaceholders } from "@office-open/core";
import { escapeXml } from "@office-open/xml";
import { DEFAULT_DRAWING_XML, getColorXml, getLayoutXml, getStyleXml } from "@office-open/core/smartart";
//#region src/parts/fonts/obfuscate-ttf-to-odttf.ts
/**
* Font obfuscation module for embedding fonts in WordprocessingML documents.
*
* This module implements the OOXML font obfuscation algorithm used to embed
* fonts in DOCX documents. Obfuscation is required by the OOXML specification
* to prevent simple extraction of embedded font files.
*
* Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
*
* @module
*/
/** Start offset for obfuscation in the font file */
const obfuscatedStartOffset = 0;
/** End offset for obfuscation (first 32 bytes are obfuscated) */
const obfuscatedEndOffset = 32;
/** Expected GUID size (32 hex characters without dashes) */
const guidSize = 32;
/**
* Obfuscates a TrueType font file for embedding in OOXML documents.
*
* The obfuscation algorithm XORs the first 32 bytes of the font file
* with a reversed byte sequence derived from the font's GUID key.
* This prevents simple extraction while maintaining font functionality.
*
* @param buf - The original font file as a byte array
* @param fontKey - The GUID key for the font (with or without dashes)
* @returns The obfuscated font data
* @throws Error if the fontKey is not a valid 32-character GUID
*
* @example
* ```typescript
* const fontData = readFileSync("font.ttf");
* const fontKey = "00000000-0000-0000-0000-000000000000";
* const obfuscatedData = obfuscate(fontData, fontKey);
* ```
*
* @internal
*/
const obfuscate = (buf, fontKey) => {
const guid = fontKey.replace(/-/g, "");
if (guid.length !== guidSize) throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);
const hexNumbers = guid.replace(/(..)/g, "$1 ").trim().split(" ").map((hexString) => parseInt(hexString, 16));
hexNumbers.reverse();
const obfuscatedBytes = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset).map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]);
const out = new Uint8Array(obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset));
out.set(buf.slice(0, obfuscatedStartOffset));
out.set(obfuscatedBytes, obfuscatedStartOffset);
out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);
return out;
};
//#endregion
//#region src/parts/header-footer.ts
/**
* Namespace keys used by header elements.
* @internal
*/
const HEADER_NAMESPACES = [
"cx",
"cx1",
"cx2",
"cx3",
"cx4",
"cx5",
"cx6",
"cx7",
"cx8",
"m",
"mc",
"o",
"r",
"v",
"w",
"w10",
"w14",
"w15",
"w16cid",
"w16se",
"wne",
"wp",
"wp14",
"wpc",
"wpg",
"wpi",
"wps"
];
/**
* Namespace keys used by footer elements.
* @internal
*/
const FOOTER_NAMESPACES = [
"m",
"mc",
"o",
"r",
"v",
"w",
"w10",
"w14",
"w15",
"wne",
"wp",
"wp14",
"wpc",
"wpg",
"wpi",
"wps"
];
/**
* Serialize a header or footer to XML.
*
* Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,
* then serializes each child element via `stringifyBodyChild()`.
*
* @param tag - Element tag name ("w:hdr" or "w:ftr")
* @param namespaces - Namespace keys to declare on the root element
* @param children - Block-level child elements (raw SectionChild objects)
* @param ctx - Body context for stringification
*/
function stringifyHeaderFooter(tag, namespaces, children, ctx) {
const attrParts = [];
for (const ns of namespaces) attrParts.push(`xmlns:${ns}="${escapeXml(DocumentAttributeNamespaces[ns])}"`);
attrParts.push("mc:Ignorable=\"w14 w15 wp14\"");
const attrStr = attrParts.join(" ");
const childParts = [];
for (const child of children) childParts.push(stringifyBodyChild(child, ctx));
const body = childParts.join("");
return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;
}
//#endregion
//#region src/compiler.ts
/**
* DOCX document compiler — pure function entry point.
*
* compileDocument() accepts DocumentOptions directly,
* creates a DocxWriteContext internally, and produces a Zippable result.
* All XML parts are produced via descriptors or serialize() —
* no Formatter dependency.
*
* @module
*/
/** Reusable TextEncoder (stateless, safe to share). */
const encoder = new TextEncoder();
/** XML declaration prepended to every OOXML part. */
const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
/**
* Compile document options into a flat file map suitable for fflate zipSync.
*
* This is the primary entry point for DOCX generation — accepts DocumentOptions
* directly.
*/
function compileDocument(options, overrides = [], mediaLevel = 0) {
const ctx = new DocxWriteContext(options);
const files = {};
const xmlifiedFileMapping = xmlifyContext(ctx, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
const map = new Map(Object.entries(xmlifiedFileMapping));
for (const [, obj] of map) {
if (obj === void 0) continue;
if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = typeof subFile.data === "string" ? encoder.encode(subFile.data) : subFile.data;
else files[obj.path] = typeof obj.data === "string" ? encoder.encode(obj.data) : obj.data;
}
for (const subFile of overrides) files[subFile.path] = typeof subFile.data === "string" ? encoder.encode(subFile.data) : subFile.data;
const mediaArray = ctx.media.array;
for (const mediaData of mediaArray) {
files[`word/media/${mediaData.fileName}`] = [mediaData.data, { level: levelForMediaName(mediaData.fileName, mediaLevel) }];
if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [mediaData.fallback.data, { level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) }];
}
for (const embedding of ctx.embeddings.array) files[`word/embeddings/${embedding.fileName}`] = [embedding.data, { level: levelForMediaName(embedding.fileName, mediaLevel) }];
for (const font of ctx.fontTable.fontOptionsWithKey) {
if (font.data === void 0) continue;
const [nameWithoutExtension] = font.name.split(".");
const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;
files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);
}
for (const part of ctx._options.rawParts ?? []) files[part.path] = part.data;
files["[Content_Types].xml"] = encoder.encode(buildContentTypesData(ctx, files));
return files;
}
/**
* Comments carried by the document: those the caller listed explicitly
* (`options.comments`) plus entries registered by `{ comment }` sugar children
* during body stringification. Drives both word/comments.xml generation and the
* [Content_Types] comments Override, which must stay in sync (OPC consistency).
*/
function mergedCommentChildren(ctx) {
return [...ctx._options.comments?.children ?? [], ...ctx.comments.entries];
}
/**
* Serialize [Content_Types].xml from the part registry, then backfill media/
* font/embedding `<Default>` entries from the parts actually written.
*
* Must run after every part has been stringified (parts call `ctx.addMedia`
* during stringify), so call this once `xmlifyContext` has finished — not from
* inside its object literal, where ContentTypes would evaluate before the
* later-defined header/footer/font parts have registered their media.
*/
function buildContentTypesData(ctx, files) {
const altChunks = ctx.altChunks.array.map((ac) => ({
path: `/word/${ac.path}`,
contentType: ac.contentType ?? "application/xhtml+xml"
}));
const withMedia = withMediaDefaults(ctx._options.contentTypes ? withAltChunkOverrides(ctx._options.contentTypes, altChunks) : buildContentTypesFromRegistry(new Map([
["freshCompile", true],
["hasComments", mergedCommentChildren(ctx).length > 0],
["hasBibliography", !!ctx._options.bibliography],
["hasGlossary", !!ctx.glossaryOptions],
["hasWebSettings", !!ctx.webSettings],
["headerCount", ctx.headers.length],
["footerCount", ctx.footers.length],
["chartCount", ctx.charts.array.length],
["smartArtCount", ctx.smartArts.array.length]
]), {
altChunks,
subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` }))
}), Object.keys(files));
return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? "");
}
function xmlifyContext(ctx, headerFormattedViews, footerFormattedViews) {
const mkCtx = (viewWrapper = ctx.document) => ({
fileData: ctx,
file: ctx,
viewWrapper,
stringifyChild: stringifyBodyChild,
addRelationship: (type, target, mode) => ctx.addRelationship(type, target, mode),
addMedia: (data, type) => ctx.addMedia(data, type)
});
const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;
const footerMediaResults = /* @__PURE__ */ new Map();
const headerMediaResults = /* @__PURE__ */ new Map();
const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, mkCtx(ctx.document));
const mergedCommentChildrenList = mergedCommentChildren(ctx);
const hasComments = mergedCommentChildrenList.length > 0;
const commentRelationshipCount = hasComments ? ctx.comments.relationships.relationshipCount + 1 : 0;
const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;
const commentXmlData = commentCtx ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx) : "";
const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;
const footnoteCtx = mkCtx({ relationships: ctx.footNotes.relationships });
const footnoteXmlData = XML_DECL + (footnotesDesc.stringify({
notes: ctx.footNotes.notes,
separator: ctx.footNotes.separator,
continuationSeparator: ctx.footNotes.continuationSeparator
}, footnoteCtx) ?? "");
const documentMedia = findAndReplaceImagePlaceholders(documentXmlData, ctx.media.array, documentRelationshipCount);
const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;
const documentEmbeddings = findAndReplaceImagePlaceholders(documentMedia.xml, ctx.embeddings.array, documentEmbeddingOffset);
const commentMedia = hasComments ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount) : {
xml: "",
referenced: []
};
const footnoteMedia = findAndReplaceImagePlaceholders(footnoteXmlData, ctx.media.array, footnoteRelationshipCount);
for (let i = 0; i < footnoteMedia.referenced.length; i++) ctx.footNotes.relationships.addRelationship(footnoteRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${footnoteMedia.referenced[i].fileName}`);
return {
AppProperties: {
data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? ""),
path: "docProps/app.xml"
},
...hasComments ? {
Comments: {
data: (() => {
return replaceNumberingPlaceholders(commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/comments.xml"
},
CommentsRelationships: (() => {
for (let i = 0; i < commentMedia.referenced.length; i++) ctx.comments.relationships.addRelationship(commentRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${commentMedia.referenced[i].fileName}`);
return optionalRelsPart(ctx.comments.relationships, XML_DECL, "word/_rels/comments.xml.rels");
})()
} : {},
CustomProperties: {
data: XML_DECL + (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ?? ""),
path: "docProps/custom.xml"
},
Document: {
data: (() => {
let xmlData = documentEmbeddings.xml;
if (hasPlaceholders(xmlData)) {
const mediaCount = documentMedia.referenced.length;
const embeddingCount = documentEmbeddings.referenced.length;
const chartKeys = ctx.charts.array.map((c) => c.key);
const smartArtKeys = ctx.smartArts.array.map((s) => s.key);
const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;
const smartArtOffset = chartOffset + chartKeys.length;
const entries = [];
for (let i = 0; i < chartKeys.length; i++) entries.push({
prefix: "chart:",
key: chartKeys[i],
value: formatId(chartOffset, i, "rId")
});
const saPrefixes = [
"smartart:",
"smartart-lo:",
"smartart-qs:",
"smartart-cs:"
];
for (let i = 0; i < smartArtKeys.length; i++) for (let p = 0; p < saPrefixes.length; p++) entries.push({
prefix: saPrefixes[p],
key: smartArtKeys[i],
value: formatId(smartArtOffset + p * smartArtKeys.length, i, "rId")
});
for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) entries.push({
key: `${reference}-${instance}`,
value: numId.toString()
});
xmlData = replaceAllPlaceholders(xmlData, entries);
} else xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);
return xmlData;
})(),
path: "word/document.xml"
},
...ctx._options.rawParts?.some((part) => part.path.startsWith("word/theme/")) ? {} : { Theme: {
data: XML_DECL + createThemeXml(),
path: "word/theme/theme1.xml"
} },
...ctx.hasEndnotes ? {
Endnotes: {
data: (() => {
const endnoteCtx = mkCtx({ relationships: ctx.endnotes.relationships });
const xmlData = XML_DECL + (endnotesDesc.stringify({
notes: ctx.endnotes.notes,
separator: ctx.endnotes.separator,
continuationSeparator: ctx.endnotes.continuationSeparator
}, endnoteCtx) ?? "");
const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;
const endnoteMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, endnoteRelCount);
if (endnoteMedia.referenced.length > 0) {
for (let i = 0; i < endnoteMedia.referenced.length; i++) ctx.endnotes.relationships.addRelationship(endnoteRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${endnoteMedia.referenced[i].fileName}`);
return replaceNumberingPlaceholders(endnoteMedia.xml, ctx.numbering.concreteNumbering);
}
return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/endnotes.xml"
},
EndnotesRelationships: ctx.endnotes.relationships.relationshipCount > 0 ? {
data: XML_DECL + ctx.endnotes.relationships.serialize(),
path: "word/_rels/endnotes.xml.rels"
} : void 0
} : {},
FileRelationships: {
data: XML_DECL + ctx.fileRelationships.serialize(),
path: "_rels/.rels"
},
FontTable: {
data: XML_DECL + (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? ""),
path: "word/fontTable.xml"
},
FontTableRelationships: optionalRelsPart(ctx.fontTable.relationships, XML_DECL, "word/_rels/fontTable.xml.rels"),
...ctx.hasFootnotes ? {
FootNotes: {
data: (() => {
return replaceNumberingPlaceholders(footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData, ctx.numbering.concreteNumbering);
})(),
path: "word/footnotes.xml"
},
FootNotesRelationships: ctx.footNotes.relationships.relationshipCount > 0 ? {
data: XML_DECL + ctx.footNotes.relationships.serialize(),
path: "word/_rels/footnotes.xml.rels"
} : void 0
} : {},
FooterRelationships: ctx.footers.map((entry, index) => {
const footerCtx = mkCtx({ relationships: entry.relationships });
const xmlData = XML_DECL + stringifyHeaderFooter("w:ftr", FOOTER_NAMESPACES, entry.children, footerCtx);
footerFormattedViews.set(index, xmlData);
const footerRelCount = entry.relationships.relationshipCount + 1;
const footerMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, footerRelCount);
footerMediaResults.set(index, footerMedia);
for (let i = 0; i < footerMedia.referenced.length; i++) entry.relationships.addRelationship(footerRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${footerMedia.referenced[i].fileName}`);
return optionalRelsPart(entry.relationships, XML_DECL, `word/_rels/footer${index + 1}.xml.rels`);
}).filter((r) => r !== void 0),
Footers: ctx.footers.map((_entry, index) => {
const footerMedia = footerMediaResults.get(index);
const tempXmlData = footerFormattedViews.get(index);
return {
data: replaceNumberingPlaceholders(footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData, ctx.numbering.concreteNumbering),
path: `word/footer${index + 1}.xml`
};
}),
HeaderRelationships: ctx.headers.map((entry, index) => {
const headerCtx = mkCtx({ relationships: entry.relationships });
const xmlData = XML_DECL + stringifyHeaderFooter("w:hdr", HEADER_NAMESPACES, entry.children, headerCtx);
headerFormattedViews.set(index, xmlData);
const headerRelCount = entry.relationships.relationshipCount + 1;
const headerMedia = findAndReplaceImagePlaceholders(xmlData, ctx.media.array, headerRelCount);
headerMediaResults.set(index, headerMedia);
for (let i = 0; i < headerMedia.referenced.length; i++) entry.relationships.addRelationship(headerRelCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${headerMedia.referenced[i].fileName}`);
return optionalRelsPart(entry.relationships, XML_DECL, `word/_rels/header${index + 1}.xml.rels`);
}).filter((r) => r !== void 0),
Headers: ctx.headers.map((_entry, index) => {
const headerMedia = headerMediaResults.get(index);
const tempXmlData = headerFormattedViews.get(index);
return {
data: replaceNumberingPlaceholders(headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData, ctx.numbering.concreteNumbering),
path: `word/header${index + 1}.xml`
};
}),
...ctx.hasNumbering ? { Numbering: {
data: ctx.numbering.serialize(),
path: "word/numbering.xml"
} } : {},
Properties: {
data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? ""),
path: "docProps/core.xml"
},
Relationships: {
data: (() => {
for (let i = 0; i < documentMedia.referenced.length; i++) ctx.document.relationships.addRelationship(documentRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${documentMedia.referenced[i].fileName}`);
for (let i = 0; i < documentEmbeddings.referenced.length; i++) ctx.document.relationships.addRelationship(documentEmbeddingOffset + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", `embeddings/${documentEmbeddings.referenced[i].fileName}`);
const chartOffset = documentRelationshipCount + documentMedia.referenced.length + documentEmbeddings.referenced.length;
for (let i = 0; i < ctx.charts.array.length; i++) ctx.document.relationships.addRelationship(chartOffset + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `charts/chart${i + 1}.xml`);
addSmartArtRelationships(ctx.smartArts.array.map((s) => s.key), (id, type, target) => {
ctx.document.relationships.addRelationship(id, type, target);
}, documentRelationshipCount + documentMedia.referenced.length + documentEmbeddings.referenced.length + ctx.charts.array.length, 0, {
pathPrefix: "",
styleRelType: "http://schemas.microsoft.com/office/2007/relationships/diagramStyle"
});
ctx.document.relationships.addRelationship(ctx.document.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", "fontTable.xml");
return XML_DECL + ctx.document.relationships.serialize();
})(),
path: "word/_rels/document.xml.rels"
},
Settings: {
data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? ""),
path: "word/settings.xml"
},
Styles: {
data: (() => {
return replaceNumberingPlaceholders(ctx.styles.serialize(), ctx.numbering.concreteNumbering);
})(),
path: "word/styles.xml"
},
...ctx._options.bibliography ? { Bibliography: {
data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? ""),
path: "word/bibliography.xml"
} } : {},
...ctx.charts.array.length > 0 ? { Charts: ctx.charts.array.map((chartData, i) => ({
data: XML_DECL + chartData.chartSpaceXml,
path: `word/charts/chart${i + 1}.xml`
})) } : {},
...ctx.smartArts.array.length > 0 ? {
DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({
data: XML_DECL + smartArtData.dataModelXml,
path: `word/diagrams/data${i + 1}.xml`
})),
DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({
data: getLayoutXml(smartArtData.layout),
path: `word/diagrams/layout${i + 1}.xml`
})),
DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({
data: getStyleXml(smartArtData.style),
path: `word/diagrams/quickStyle${i + 1}.xml`
})),
DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({
data: getColorXml(smartArtData.color),
path: `word/diagrams/colors${i + 1}.xml`
})),
DiagramDrawing: ctx.smartArts.array.map((_, i) => ({
data: DEFAULT_DRAWING_XML,
path: `word/diagrams/drawing${i + 1}.xml`
}))
} : {},
...ctx.altChunks.array.length > 0 ? { AltChunks: ctx.altChunks.array.map((altChunkData) => ({
data: altChunkData.data,
path: `word/${altChunkData.path}`
})) } : {},
...ctx.subDocs.array.length > 0 ? { SubDocs: ctx.subDocs.array.map((subDocData) => ({
data: subDocData.data,
path: `word/${subDocData.path}`
})) } : {},
...ctx.glossaryOptions ? { Glossary: {
data: (() => {
const glossaryCtx = mkCtx(void 0);
return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions, glossaryCtx) ?? "");
})(),
path: "word/glossary/document.xml"
} } : {},
...ctx.webSettings ? { WebSettings: {
data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? ""),
path: "word/webSettings.xml"
} } : {}
};
}
//#endregion
//#region src/generate.ts
/**
* Pure function API for generating DOCX files.
*
* @module
*/
/** @internal Packer instance for DOCX generation. */
const Packer = createPacker({
compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),
mimeType: OoxmlMimeType.DOCX
});
/**
* Generate a DOCX file from pure JSON options.
*
* The output format is controlled by `packerOptions.type` (default: `"nodebuffer"` → Buffer).
* For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.
*
* @param options - Document options (sections, styles, numbering, etc.)
* @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)
*
* @example
* ```typescript
* import { generateDocument } from "@office-open/docx";
*
* const buffer = await generateDocument({ sections: [...] });
* const bytes = await generateDocument({ sections: [...] }, { type: "uint8array" });
* const blob = await generateDocument({ sections: [...] }, { type: "blob" });
* ```
*/
function generateDocument(options, packerOptions) {
return Packer.pack(options, packerOptions);
}
/**
* Synchronously generate a DOCX file from pure JSON options.
*/
function generateDocumentSync(options, packerOptions) {
return Packer.packSync(options, packerOptions);
}
/**
* Generate a DOCX file as a `ReadableStream<Uint8Array>`.
*/
function generateDocumentStream(options, packerOptions) {
return Packer.toStream(options, packerOptions);
}
//#endregion
export { compileDocument as i, generateDocumentStream as n, generateDocumentSync as r, generateDocument as t };
//# sourceMappingURL=generate-CG1wp4pb.mjs.map
{"version":3,"file":"generate-CG1wp4pb.mjs","names":[],"sources":["../src/parts/fonts/obfuscate-ttf-to-odttf.ts","../src/parts/header-footer.ts","../src/compiler.ts","../src/generate.ts"],"sourcesContent":["/**\n * Font obfuscation module for embedding fonts in WordprocessingML documents.\n *\n * This module implements the OOXML font obfuscation algorithm used to embed\n * fonts in DOCX documents. Obfuscation is required by the OOXML specification\n * to prevent simple extraction of embedded font files.\n *\n * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)\n *\n * @module\n */\n\n/** Start offset for obfuscation in the font file */\nconst obfuscatedStartOffset = 0;\n/** End offset for obfuscation (first 32 bytes are obfuscated) */\nconst obfuscatedEndOffset = 32;\n/** Expected GUID size (32 hex characters without dashes) */\nconst guidSize = 32;\n\n/**\n * Obfuscates a TrueType font file for embedding in OOXML documents.\n *\n * The obfuscation algorithm XORs the first 32 bytes of the font file\n * with a reversed byte sequence derived from the font's GUID key.\n * This prevents simple extraction while maintaining font functionality.\n *\n * @param buf - The original font file as a byte array\n * @param fontKey - The GUID key for the font (with or without dashes)\n * @returns The obfuscated font data\n * @throws Error if the fontKey is not a valid 32-character GUID\n *\n * @example\n * ```typescript\n * const fontData = readFileSync(\"font.ttf\");\n * const fontKey = \"00000000-0000-0000-0000-000000000000\";\n * const obfuscatedData = obfuscate(fontData, fontKey);\n * ```\n *\n * @internal\n */\nexport const obfuscate = (buf: Uint8Array, fontKey: string): Uint8Array => {\n const guid = fontKey.replace(/-/g, \"\");\n if (guid.length !== guidSize) {\n throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);\n }\n\n const hexStrings = guid.replace(/(..)/g, \"$1 \").trim().split(\" \");\n const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16));\n hexNumbers.reverse();\n\n const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset);\n const obfuscatedBytes = bytesToObfuscate.map(\n (byte, i) => byte ^ hexNumbers[i % hexNumbers.length],\n );\n\n const out = new Uint8Array(\n obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset),\n );\n out.set(buf.slice(0, obfuscatedStartOffset));\n out.set(obfuscatedBytes, obfuscatedStartOffset);\n out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);\n return out;\n};\n","/**\n * Header/Footer entry module for WordprocessingML documents.\n *\n * Replaces the former HeaderWrapper/FooterWrapper/Header/Footer/HeaderFooterBase\n * class hierarchy with a simple data structure + pure serialization function.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_HdrFtr\n *\n * @module\n */\n\nimport type { Relationships } from \"@office-open/core\";\nimport { escapeXml } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { stringifyBodyChild } from \"../body\";\nimport type { BodyContext } from \"../context\";\nimport { DocumentAttributeNamespaces } from \"./document/document-attributes\";\nimport type { DocumentAttributeNamespace } from \"./document/document-attributes\";\n\n/**\n * Simple data structure for a header or footer entry.\n *\n * Replaces HeaderWrapper/FooterWrapper — holds children, relationships,\n * and the reference ID needed for section property references.\n *\n * Children are raw SectionChild objects (plain JSON or class instances).\n */\nexport interface HeaderFooterEntry {\n children: SectionChild[];\n relationships: Relationships;\n referenceId: number;\n}\n\n/**\n * Namespace keys used by header elements.\n * @internal\n */\nexport const HEADER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"cx\",\n \"cx1\",\n \"cx2\",\n \"cx3\",\n \"cx4\",\n \"cx5\",\n \"cx6\",\n \"cx7\",\n \"cx8\",\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"w16cid\",\n \"w16se\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Namespace keys used by footer elements.\n * @internal\n */\nexport const FOOTER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Serialize a header or footer to XML.\n *\n * Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,\n * then serializes each child element via `stringifyBodyChild()`.\n *\n * @param tag - Element tag name (\"w:hdr\" or \"w:ftr\")\n * @param namespaces - Namespace keys to declare on the root element\n * @param children - Block-level child elements (raw SectionChild objects)\n * @param ctx - Body context for stringification\n */\nexport function stringifyHeaderFooter(\n tag: string,\n namespaces: DocumentAttributeNamespace[],\n children: SectionChild[],\n ctx: BodyContext,\n): string {\n const attrParts: string[] = [];\n for (const ns of namespaces) {\n attrParts.push(`xmlns:${ns}=\"${escapeXml(DocumentAttributeNamespaces[ns])}\"`);\n }\n // mc:Ignorable must declare the ignorable namespaces (w14/w15/wp14) that\n // header/footer content uses (e.g. w14:paraId). Without it, Word in\n // compatibility mode 14 rejects the part as unreadable content.\n attrParts.push('mc:Ignorable=\"w14 w15 wp14\"');\n const attrStr = attrParts.join(\" \");\n\n const childParts: string[] = [];\n for (const child of children) {\n childParts.push(stringifyBodyChild(child, ctx));\n }\n\n const body = childParts.join(\"\");\n return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;\n}\n","/**\n * DOCX document compiler — pure function entry point.\n *\n * compileDocument() accepts DocumentOptions directly,\n * creates a DocxWriteContext internally, and produces a Zippable result.\n * All XML parts are produced via descriptors or serialize() —\n * no Formatter dependency.\n *\n * @module\n */\n\nimport {\n addSmartArtRelationships,\n createThemeXml,\n findAndReplaceImagePlaceholders,\n formatId,\n hasPlaceholders,\n levelForMediaName,\n optionalRelsPart,\n replaceAllPlaceholders,\n replaceNumberingPlaceholders,\n} from \"@office-open/core\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"@office-open/core\";\nimport {\n DEFAULT_DRAWING_XML,\n getColorXml,\n getLayoutXml,\n getStyleXml,\n} from \"@office-open/core/smartart\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { obfuscate } from \"@parts/fonts/obfuscate-ttf-to-odttf\";\nimport { HEADER_NAMESPACES, FOOTER_NAMESPACES, stringifyHeaderFooter } from \"@parts/header-footer\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\n\nimport { stringifyDocumentXml, stringifyBodyChild, type BodyContext } from \"./body\";\nimport { DocxWriteContext } from \"./context\";\nimport {\n corePropertiesDesc,\n customPropertiesDesc,\n appPropertiesDesc,\n contentTypesDesc,\n buildContentTypesFromRegistry,\n withAltChunkOverrides,\n withMediaDefaults,\n fontTableDesc,\n webSettingsDesc,\n commentsDesc,\n bibliographyDesc,\n settingsDesc,\n footnotesDesc,\n endnotesDesc,\n glossaryDesc,\n} from \"./parts\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\n/** XML declaration prepended to every OOXML part. */\nconst XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';\n\n/** Extended context for header/footer formatted view caching. */\ntype DocxContext = BodyContext & {\n headerFormattedViews?: Map<number, string>;\n footerFormattedViews?: Map<number, string>;\n};\n\n// ── Public API ──\n\n/**\n * Compile document options into a flat file map suitable for fflate zipSync.\n *\n * This is the primary entry point for DOCX generation — accepts DocumentOptions\n * directly.\n */\nexport function compileDocument(\n options: DocumentOptions,\n overrides: XmlifyedFile[] = [],\n mediaLevel: number = 0,\n): Zippable {\n const ctx = new DocxWriteContext(options);\n const files: Zippable = {};\n\n const headerFormattedViews = new Map<number, string>();\n const footerFormattedViews = new Map<number, string>();\n\n const xmlifiedFileMapping = xmlifyContext(ctx, headerFormattedViews, footerFormattedViews);\n const map = new Map<string, XmlifyedFile | XmlifyedFile[]>(Object.entries(xmlifiedFileMapping));\n\n for (const [, obj] of map) {\n if (obj === undefined) continue;\n if (Array.isArray(obj)) {\n for (const subFile of obj) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n } else {\n files[obj.path] = typeof obj.data === \"string\" ? encoder.encode(obj.data) : obj.data;\n }\n }\n\n for (const subFile of overrides) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n\n // Media files\n const mediaArray = ctx.media.array;\n for (const mediaData of mediaArray) {\n files[`word/media/${mediaData.fileName}`] = [\n mediaData.data as Uint8Array,\n { level: levelForMediaName(mediaData.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n if (mediaData.type === \"svg\") {\n files[`word/media/${mediaData.fallback.fileName}`] = [\n mediaData.fallback.data as Uint8Array,\n {\n level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) as ZipOptions[\"level\"],\n },\n ];\n }\n }\n\n // OLE embedding binaries (word/embeddings/oleObjectN.bin)\n for (const embedding of ctx.embeddings.array) {\n files[`word/embeddings/${embedding.fileName}`] = [\n embedding.data as Uint8Array,\n { level: levelForMediaName(embedding.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n }\n\n // Font files — only fonts carrying binary data produce a .odttf part.\n // Round-tripped fonts (rawOdttf) keep their original obfuscated bytes.\n for (const font of ctx.fontTable.fontOptionsWithKey) {\n if (font.data === undefined) continue;\n const [nameWithoutExtension] = font.name.split(\".\");\n const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;\n files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);\n }\n\n // Raw passthrough parts (word/theme/*, customXml/*, …) — generate doesn't\n // rebuild these, so copy their original bytes verbatim to keep [Content_Types]\n // declarations valid and the package openable in Word.\n for (const part of ctx._options.rawParts ?? []) {\n files[part.path] = part.data;\n }\n\n // [Content_Types].xml is serialized last: parts register their media/fonts\n // during stringify (run by xmlifyContext above), so backfilling <Default>\n // extensions from `ctx` now sees the complete set. Building it inside\n // xmlifyContext's object literal evaluated it before header/footer/font media\n // was registered, leaving jpg/gif/odttf without a covering Default.\n files[\"[Content_Types].xml\"] = encoder.encode(buildContentTypesData(ctx, files));\n\n return files;\n}\n\n// ── Internal ──\n\n/**\n * Complete mapping of all XML files in an OOXML document package.\n */\ninterface XmlifyedFileMapping {\n Document: XmlifyedFile;\n Styles: XmlifyedFile;\n Properties: XmlifyedFile;\n Numbering?: XmlifyedFile;\n Relationships: XmlifyedFile;\n FileRelationships: XmlifyedFile;\n Headers: XmlifyedFile[];\n Footers: XmlifyedFile[];\n HeaderRelationships: XmlifyedFile[];\n FooterRelationships: XmlifyedFile[];\n CustomProperties: XmlifyedFile;\n AppProperties: XmlifyedFile;\n FootNotes?: XmlifyedFile;\n FootNotesRelationships?: XmlifyedFile;\n Endnotes?: XmlifyedFile;\n EndnotesRelationships?: XmlifyedFile;\n Settings: XmlifyedFile;\n Comments?: XmlifyedFile;\n CommentsRelationships?: XmlifyedFile;\n FontTable?: XmlifyedFile;\n FontTableRelationships?: XmlifyedFile;\n Bibliography?: XmlifyedFile;\n Charts?: XmlifyedFile[];\n DiagramData?: XmlifyedFile[];\n DiagramLayout?: XmlifyedFile[];\n DiagramStyle?: XmlifyedFile[];\n DiagramColors?: XmlifyedFile[];\n DiagramDrawing?: XmlifyedFile[];\n AltChunks?: XmlifyedFile[];\n SubDocs?: XmlifyedFile[];\n Glossary?: XmlifyedFile;\n WebSettings?: XmlifyedFile;\n}\n\n/**\n * Comments carried by the document: those the caller listed explicitly\n * (`options.comments`) plus entries registered by `{ comment }` sugar children\n * during body stringification. Drives both word/comments.xml generation and the\n * [Content_Types] comments Override, which must stay in sync (OPC consistency).\n */\nfunction mergedCommentChildren(ctx: DocxWriteContext): CommentOptions[] {\n return [...(ctx._options.comments?.children ?? []), ...ctx.comments.entries];\n}\n\n/**\n * Serialize [Content_Types].xml from the part registry, then backfill media/\n * font/embedding `<Default>` entries from the parts actually written.\n *\n * Must run after every part has been stringified (parts call `ctx.addMedia`\n * during stringify), so call this once `xmlifyContext` has finished — not from\n * inside its object literal, where ContentTypes would evaluate before the\n * later-defined header/footer/font parts have registered their media.\n */\nfunction buildContentTypesData(ctx: DocxWriteContext, files: Zippable): string {\n const altChunks = ctx.altChunks.array.map((ac) => ({\n path: `/word/${ac.path}`,\n contentType: ac.contentType ?? \"application/xhtml+xml\",\n }));\n // Round-trip passes the source [Content_Types] through, but the compiler\n // regenerates altChunk part paths — realign the afchunk Overrides to the\n // freshly written parts (else O5/O6).\n const base = ctx._options.contentTypes\n ? withAltChunkOverrides(ctx._options.contentTypes, altChunks)\n : buildContentTypesFromRegistry(\n new Map<string, boolean | number>([\n [\"freshCompile\", true],\n [\"hasComments\", mergedCommentChildren(ctx).length > 0],\n [\"hasBibliography\", !!ctx._options.bibliography],\n [\"hasGlossary\", !!ctx.glossaryOptions],\n [\"hasWebSettings\", !!ctx.webSettings],\n [\"headerCount\", ctx.headers.length],\n [\"footerCount\", ctx.footers.length],\n [\"chartCount\", ctx.charts.array.length],\n [\"smartArtCount\", ctx.smartArts.array.length],\n ]),\n {\n altChunks,\n subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` })),\n },\n );\n // Backfill <Default> extensions from every part actually written to the\n // package — the parts on disk are the single source of truth, so media/font/\n // embedding defaults can never drift from what the package contains (e.g. a\n // font written via the fallback path when `odttfPath` is unset).\n const withMedia = withMediaDefaults(base, Object.keys(files));\n return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? \"\");\n}\n\nfunction xmlifyContext(\n ctx: DocxWriteContext,\n headerFormattedViews: Map<number, string>,\n footerFormattedViews: Map<number, string>,\n): XmlifyedFileMapping {\n const mkCtx = (viewWrapper: DocxContext[\"viewWrapper\"] = ctx.document): DocxContext => ({\n fileData: ctx,\n file: ctx,\n viewWrapper,\n stringifyChild: stringifyBodyChild,\n addRelationship: (type: string, target: string, mode?: string) =>\n ctx.addRelationship(type, target, mode),\n addMedia: (data: Uint8Array, type: string) => ctx.addMedia(data, type),\n });\n\n const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;\n // Per-part media-replacement results shared between the .rels pass and the\n // body-XML pass so both use identical rId offsets. Each header/footer part\n // has its own relationship numbering (independent of the document part).\n const footerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const headerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const docCtx = mkCtx(ctx.document);\n const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, docCtx);\n\n // Comments is an optional part — skip it entirely (no comments.xml, no\n // comments rels, no [Content_Types] Override) when the document carries none.\n // Emitting an empty comments.xml with a dangling relationship is the OPC\n // violation that makes Word reject the package on open.\n const mergedCommentChildrenList = mergedCommentChildren(ctx);\n const hasComments = mergedCommentChildrenList.length > 0;\n const commentRelationshipCount = hasComments\n ? ctx.comments.relationships.relationshipCount + 1\n : 0;\n const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;\n const commentXmlData = commentCtx\n ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx)\n : \"\";\n\n const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;\n const footnoteCtx = mkCtx({\n relationships: ctx.footNotes.relationships,\n });\n const footnoteXmlData =\n XML_DECL +\n (footnotesDesc.stringify(\n {\n notes: ctx.footNotes.notes,\n separator: ctx.footNotes.separator,\n continuationSeparator: ctx.footNotes.continuationSeparator,\n },\n footnoteCtx,\n ) ?? \"\");\n\n const documentMedia = findAndReplaceImagePlaceholders(\n documentXmlData,\n ctx.media.array,\n documentRelationshipCount,\n );\n // OLE embeddings reuse the same {fileName} placeholder bridge as images; run\n // after media so {oleObjectN.bin} placeholders resolve against the embedding array.\n const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;\n const documentEmbeddings = findAndReplaceImagePlaceholders(\n documentMedia.xml,\n ctx.embeddings.array,\n documentEmbeddingOffset,\n );\n const commentMedia = hasComments\n ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount)\n : { xml: \"\", referenced: [] as { fileName: string }[] };\n const footnoteMedia = findAndReplaceImagePlaceholders(\n footnoteXmlData,\n ctx.media.array,\n footnoteRelationshipCount,\n );\n // Register footnote media relationships eagerly so the relationshipCount used\n // to gate footnotes.xml.rels reflects the final state (see FootNotesRelationships).\n for (let i = 0; i < footnoteMedia.referenced.length; i++) {\n ctx.footNotes.relationships.addRelationship(\n footnoteRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footnoteMedia.referenced[i].fileName}`,\n );\n }\n\n return {\n AppProperties: {\n data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? \"\"),\n path: \"docProps/app.xml\",\n },\n ...(hasComments\n ? {\n Comments: {\n data: (() => {\n const xmlData =\n commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/comments.xml\",\n },\n CommentsRelationships: (() => {\n for (let i = 0; i < commentMedia.referenced.length; i++) {\n ctx.comments.relationships.addRelationship(\n commentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${commentMedia.referenced[i].fileName}`,\n );\n }\n return optionalRelsPart(\n ctx.comments.relationships,\n XML_DECL,\n \"word/_rels/comments.xml.rels\",\n );\n })(),\n }\n : {}),\n CustomProperties: {\n data:\n XML_DECL +\n (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ??\n \"\"),\n path: \"docProps/custom.xml\",\n },\n Document: {\n data: (() => {\n let xmlData = documentEmbeddings.xml;\n if (hasPlaceholders(xmlData)) {\n const mediaCount = documentMedia.referenced.length;\n const embeddingCount = documentEmbeddings.referenced.length;\n const chartKeys = ctx.charts.array.map((c) => c.key);\n const smartArtKeys = ctx.smartArts.array.map((s) => s.key);\n const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;\n const smartArtOffset = chartOffset + chartKeys.length;\n\n // Build combined replacement entries for charts, smartart, and numbering\n const entries: Array<{ prefix?: string; key: string; value: string }> = [];\n for (let i = 0; i < chartKeys.length; i++) {\n entries.push({\n prefix: \"chart:\",\n key: chartKeys[i],\n value: formatId(chartOffset, i, \"rId\"),\n });\n }\n const saPrefixes = [\"smartart:\", \"smartart-lo:\", \"smartart-qs:\", \"smartart-cs:\"];\n for (let i = 0; i < smartArtKeys.length; i++) {\n for (let p = 0; p < saPrefixes.length; p++) {\n entries.push({\n prefix: saPrefixes[p],\n key: smartArtKeys[i],\n value: formatId(smartArtOffset + p * smartArtKeys.length, i, \"rId\"),\n });\n }\n }\n for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) {\n entries.push({ key: `${reference}-${instance}`, value: numId.toString() });\n }\n xmlData = replaceAllPlaceholders(xmlData, entries);\n } else {\n xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n }\n return xmlData;\n })(),\n path: \"word/document.xml\",\n },\n // Theme — fresh-compile emits a language-neutral default theme\n // (createThemeXml). Round-trip carries the source theme in rawParts,\n // already copied verbatim above, so skip emitting here to avoid a duplicate.\n ...(ctx._options.rawParts?.some((part) => part.path.startsWith(\"word/theme/\"))\n ? {}\n : {\n Theme: {\n data: XML_DECL + createThemeXml(),\n path: \"word/theme/theme1.xml\",\n },\n }),\n ...(ctx.hasEndnotes\n ? {\n Endnotes: {\n data: (() => {\n const endnoteCtx = mkCtx({\n relationships: ctx.endnotes.relationships,\n });\n const xmlData =\n XML_DECL +\n (endnotesDesc.stringify(\n {\n notes: ctx.endnotes.notes,\n separator: ctx.endnotes.separator,\n continuationSeparator: ctx.endnotes.continuationSeparator,\n },\n endnoteCtx,\n ) ?? \"\");\n const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;\n const endnoteMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n endnoteRelCount,\n );\n if (endnoteMedia.referenced.length > 0) {\n for (let i = 0; i < endnoteMedia.referenced.length; i++) {\n ctx.endnotes.relationships.addRelationship(\n endnoteRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${endnoteMedia.referenced[i].fileName}`,\n );\n }\n return replaceNumberingPlaceholders(\n endnoteMedia.xml,\n ctx.numbering.concreteNumbering,\n );\n }\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/endnotes.xml\",\n },\n EndnotesRelationships:\n ctx.endnotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.endnotes.relationships.serialize(),\n path: \"word/_rels/endnotes.xml.rels\",\n }\n : undefined,\n }\n : {}),\n FileRelationships: {\n data: XML_DECL + ctx.fileRelationships.serialize(),\n path: \"_rels/.rels\",\n },\n FontTable: {\n data:\n XML_DECL +\n (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? \"\"),\n path: \"word/fontTable.xml\",\n },\n FontTableRelationships: optionalRelsPart(\n ctx.fontTable.relationships,\n XML_DECL,\n \"word/_rels/fontTable.xml.rels\",\n ),\n ...(ctx.hasFootnotes\n ? {\n FootNotes: {\n data: (() => {\n const xmlData =\n footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/footnotes.xml\",\n },\n FootNotesRelationships:\n ctx.footNotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.footNotes.relationships.serialize(),\n path: \"word/_rels/footnotes.xml.rels\",\n }\n : undefined,\n }\n : {}),\n FooterRelationships: ctx.footers\n .map((entry, index) => {\n const footerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:ftr\", FOOTER_NAMESPACES, entry.children, footerCtx);\n footerFormattedViews.set(index, xmlData);\n // Footer images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const footerRelCount = entry.relationships.relationshipCount + 1;\n const footerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n footerRelCount,\n );\n footerMediaResults.set(index, footerMedia);\n\n for (let i = 0; i < footerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n footerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/footer${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Footers: ctx.footers.map((_entry, index) => {\n const footerMedia = footerMediaResults.get(index)!;\n const tempXmlData = footerFormattedViews.get(index)!;\n const xmlData = footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/footer${index + 1}.xml`,\n };\n }),\n HeaderRelationships: ctx.headers\n .map((entry, index) => {\n const headerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:hdr\", HEADER_NAMESPACES, entry.children, headerCtx);\n headerFormattedViews.set(index, xmlData);\n // Header images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const headerRelCount = entry.relationships.relationshipCount + 1;\n const headerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n headerRelCount,\n );\n headerMediaResults.set(index, headerMedia);\n\n for (let i = 0; i < headerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n headerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${headerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/header${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Headers: ctx.headers.map((_entry, index) => {\n const headerMedia = headerMediaResults.get(index)!;\n const tempXmlData = headerFormattedViews.get(index)!;\n const xmlData = headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/header${index + 1}.xml`,\n };\n }),\n ...(ctx.hasNumbering\n ? {\n Numbering: {\n data: ctx.numbering.serialize(),\n path: \"word/numbering.xml\",\n },\n }\n : {}),\n Properties: {\n data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? \"\"),\n path: \"docProps/core.xml\",\n },\n Relationships: {\n data: (() => {\n for (let i = 0; i < documentMedia.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${documentMedia.referenced[i].fileName}`,\n );\n }\n for (let i = 0; i < documentEmbeddings.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentEmbeddingOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\",\n `embeddings/${documentEmbeddings.referenced[i].fileName}`,\n );\n }\n\n const chartOffset =\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length;\n for (let i = 0; i < ctx.charts.array.length; i++) {\n ctx.document.relationships.addRelationship(\n chartOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `charts/chart${i + 1}.xml`,\n );\n }\n\n addSmartArtRelationships(\n ctx.smartArts.array.map((s) => s.key),\n (id, type, target) => {\n ctx.document.relationships.addRelationship(id, type, target);\n },\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length +\n ctx.charts.array.length,\n 0,\n {\n pathPrefix: \"\",\n styleRelType: \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\",\n },\n );\n\n ctx.document.relationships.addRelationship(\n ctx.document.relationships.relationshipCount + 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\",\n \"fontTable.xml\",\n );\n\n return XML_DECL + ctx.document.relationships.serialize();\n })(),\n path: \"word/_rels/document.xml.rels\",\n },\n Settings: {\n data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? \"\"),\n path: \"word/settings.xml\",\n },\n Styles: {\n data: (() => {\n const xmlStyles = ctx.styles.serialize();\n return replaceNumberingPlaceholders(xmlStyles, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/styles.xml\",\n },\n ...(ctx._options.bibliography\n ? {\n Bibliography: {\n data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? \"\"),\n path: \"word/bibliography.xml\",\n },\n }\n : {}),\n ...(ctx.charts.array.length > 0\n ? {\n Charts: ctx.charts.array.map((chartData, i) => ({\n data: XML_DECL + chartData.chartSpaceXml,\n path: `word/charts/chart${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.smartArts.array.length > 0\n ? {\n DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({\n data: XML_DECL + smartArtData.dataModelXml,\n path: `word/diagrams/data${i + 1}.xml`,\n })),\n DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getLayoutXml(smartArtData.layout),\n path: `word/diagrams/layout${i + 1}.xml`,\n })),\n DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getStyleXml(smartArtData.style),\n path: `word/diagrams/quickStyle${i + 1}.xml`,\n })),\n DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getColorXml(smartArtData.color),\n path: `word/diagrams/colors${i + 1}.xml`,\n })),\n DiagramDrawing: ctx.smartArts.array.map((_, i) => ({\n data: DEFAULT_DRAWING_XML,\n path: `word/diagrams/drawing${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.altChunks.array.length > 0\n ? {\n AltChunks: ctx.altChunks.array.map((altChunkData) => ({\n data: altChunkData.data,\n path: `word/${altChunkData.path}`,\n })),\n }\n : {}),\n ...(ctx.subDocs.array.length > 0\n ? {\n SubDocs: ctx.subDocs.array.map((subDocData) => ({\n data: subDocData.data,\n path: `word/${subDocData.path}`,\n })),\n }\n : {}),\n ...(ctx.glossaryOptions\n ? {\n Glossary: {\n data: (() => {\n const glossaryCtx = mkCtx(undefined);\n return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions!, glossaryCtx) ?? \"\");\n })(),\n path: \"word/glossary/document.xml\",\n },\n }\n : {}),\n ...(ctx.webSettings\n ? {\n WebSettings: {\n data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? \"\"),\n path: \"word/webSettings.xml\",\n },\n }\n : {}),\n };\n}\n","/**\n * Pure function API for generating DOCX files.\n *\n * @module\n */\n\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\nimport type { OutputByType, OutputType, PackerOptions } from \"@office-open/core\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\n\nimport { compileDocument } from \"./compiler\";\n\n/** @internal Packer instance for DOCX generation. */\nconst Packer = createPacker<DocumentOptions>({\n compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),\n mimeType: OoxmlMimeType.DOCX,\n});\n\n/**\n * Generate a DOCX file from pure JSON options.\n *\n * The output format is controlled by `packerOptions.type` (default: `\"nodebuffer\"` → Buffer).\n * For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.\n *\n * @param options - Document options (sections, styles, numbering, etc.)\n * @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)\n *\n * @example\n * ```typescript\n * import { generateDocument } from \"@office-open/docx\";\n *\n * const buffer = await generateDocument({ sections: [...] });\n * const bytes = await generateDocument({ sections: [...] }, { type: \"uint8array\" });\n * const blob = await generateDocument({ sections: [...] }, { type: \"blob\" });\n * ```\n */\nexport function generateDocument<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): Promise<OutputByType[T]> {\n return Packer.pack(options, packerOptions) as Promise<OutputByType[T]>;\n}\n\n/**\n * Synchronously generate a DOCX file from pure JSON options.\n */\nexport function generateDocumentSync<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): OutputByType[T] {\n return Packer.packSync(options, packerOptions) as OutputByType[T];\n}\n\n/**\n * Generate a DOCX file as a `ReadableStream<Uint8Array>`.\n */\nexport function generateDocumentStream(\n options: DocumentOptions,\n packerOptions?: PackerOptions,\n): ReadableStream<Uint8Array> {\n return Packer.toStream(options, packerOptions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,wBAAwB;;AAE9B,MAAM,sBAAsB;;AAE5B,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;AAuBjB,MAAa,aAAa,KAAiB,YAAgC;CACzE,MAAM,OAAO,QAAQ,QAAQ,MAAM,EAAE;CACrC,IAAI,KAAK,WAAW,UAClB,MAAM,IAAI,MAAM,kDAAkD,SAAS;CAI7E,MAAM,aADa,KAAK,QAAQ,SAAS,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GACjC,CAAC,CAAC,KAAK,cAAc,SAAS,WAAW,EAAE,CAAC;CACxE,WAAW,QAAQ;CAGnB,MAAM,kBADmB,IAAI,MAAM,uBAAuB,mBACnB,CAAC,CAAC,KACtC,MAAM,MAAM,OAAO,WAAW,IAAI,WAAW,OAChD;CAEA,MAAM,MAAM,IAAI,WACd,wBAAwB,gBAAgB,SAAS,KAAK,IAAI,GAAG,IAAI,SAAS,mBAAmB,CAC/F;CACA,IAAI,IAAI,IAAI,MAAM,GAAG,qBAAqB,CAAC;CAC3C,IAAI,IAAI,iBAAiB,qBAAqB;CAC9C,IAAI,IAAI,IAAI,MAAM,mBAAmB,GAAG,wBAAwB,gBAAgB,MAAM;CACtF,OAAO;AACT;;;;;;;ACxBA,MAAa,oBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAa,oBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;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AS,WAAW,UAAU;CAC3F,UAAU,cAAc;AAC1B,CAAC;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,iBACd,SACA,eAC0B;CAC1B,OAAO,OAAO,KAAK,SAAS,aAAa;AAC3C;;;;AAKA,SAAgB,qBACd,SACA,eACiB;CACjB,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C;;;;AAKA,SAAgB,uBACd,SACA,eAC4B;CAC5B,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C"}

Sorry, the diff of this file is too big to display

{"version":3,"file":"parse-IeJ0NXYz.mjs","names":[],"sources":["../src/parts/alt-chunk/alt-chunk-parse.ts","../src/parts/custom-xml/custom-xml-parse.ts","../src/parts/sub-doc/sub-doc-parse.ts","../src/parts/textbox/textbox-parse.ts","../src/parse/body.ts","../src/parse.ts"],"sourcesContent":["/**\n * AltChunk parser for DOCX documents.\n *\n * Parses w:altChunk elements and extracts embedded content from the ZIP.\n *\n * @module\n */\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { AltChunkOptions } from \"@parts/alt-chunk/alt-chunk\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse a w:altChunk element into AltChunkOptions.\n * Reads the referenced data from the ZIP package.\n */\nexport function parseAltChunk(el: Element, ctx: DocxReadContext): AltChunkOptions {\n const rId = attr(el, \"r:id\");\n if (!rId) {\n throw new Error(\"w:altChunk missing r:id attribute\");\n }\n\n // Look up the path from relationships\n const path = ctx.docx.partRefs.afChunks.get(rId);\n if (!path) {\n throw new Error(`AltChunk relationship ${rId} not found`);\n }\n\n // Read raw data from ZIP\n const data = ctx.docx.doc.getRaw(path);\n if (!data) {\n throw new Error(`AltChunk data not found at ${path}`);\n }\n\n // Determine content type from extension\n const ext = path.split(\".\").pop() ?? \"txt\";\n let contentType: \"text/html\" | \"application/rtf\" | \"text/plain\";\n let extension: \"html\" | \"rtf\" | \"txt\";\n\n switch (ext) {\n case \"html\":\n contentType = \"text/html\";\n extension = \"html\";\n break;\n case \"rtf\":\n contentType = \"application/rtf\";\n extension = \"rtf\";\n break;\n default:\n contentType = \"text/plain\";\n extension = \"txt\";\n break;\n }\n\n return {\n data,\n contentType,\n extension,\n };\n}\n","/**\n * Parser for custom XML block elements (w:customXml).\n *\n * @module\n */\nimport { attr, findChild } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport type { DocxReadContext } from \"../../context\";\nimport { parseCustomXmlProperties } from \"../bodychildren\";\nimport type { CustomXmlBlockOptions } from \"./custom-xml\";\n\n/**\n * Parse w:customXml element into CustomXmlBlockOptions.\n *\n * Uses a callback for child parsing to avoid circular dependencies\n * (same pattern as parseTable).\n */\nexport function parseCustomXmlBlock(\n el: Element,\n ctx: DocxReadContext,\n parseChild: (el: Element, ctx: DocxReadContext) => SectionChild,\n): CustomXmlBlockOptions {\n const opts: Partial<CustomXmlBlockOptions> = {};\n\n // Required attribute\n const element = attr(el, \"w:element\");\n if (element) opts.element = element;\n\n // Optional URI\n const uri = attr(el, \"w:uri\");\n if (uri) opts.uri = uri;\n\n // Parse w:customXmlPr\n const xmlPr = findChild(el, \"w:customXmlPr\");\n if (xmlPr) {\n opts.customXmlPr = parseCustomXmlProperties(xmlPr);\n }\n\n // Parse block-level children\n const children: SectionChild[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"w:customXmlPr\") continue;\n const parsed = parseChild(child, ctx);\n children.push(parsed);\n }\n if (children.length > 0) opts.children = children;\n\n return opts as CustomXmlBlockOptions;\n}\n","/**\n * SubDoc parser for DOCX documents.\n *\n * Parses w:subDoc elements and extracts embedded document data.\n *\n * @module\n */\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport type { SubDocOptions } from \"@parts/sub-doc/sub-doc\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse a w:subDoc element into SubDocOptions.\n * Reads the referenced document data from the ZIP package.\n */\nexport function parseSubDoc(el: Element, ctx: DocxReadContext): SubDocOptions {\n const rId = attr(el, \"r:id\");\n if (!rId) {\n throw new Error(\"w:subDoc missing r:id attribute\");\n }\n\n const path = ctx.docx.partRefs.subDocs.get(rId);\n if (!path) {\n throw new Error(`SubDoc relationship ${rId} not found`);\n }\n\n const data = ctx.docx.doc.getRaw(path);\n if (!data) {\n throw new Error(`SubDoc data not found at ${path}`);\n }\n\n return { data };\n}\n","/**\n * Textbox parser for DOCX documents.\n *\n * Parses w:pict → v:shape → v:textbox → w:txbxContent elements.\n *\n * @module\n */\nimport { attr, findChild, findFirst } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { DocxReadContext } from \"../../context\";\n\n/**\n * Parse VML shape style string into VmlShapeStyle-like object.\n */\nfunction parseVmlStyle(styleStr: string): Record<string, string> {\n const style: Record<string, string> = {};\n for (const part of styleStr.split(\";\")) {\n const [key, val] = part.split(\":\").map((s) => s.trim());\n if (key && val) style[key] = val;\n }\n return style;\n}\n\n/**\n * Parse a w:pict element that contains a textbox.\n * Returns an object suitable for the { textbox: ... } SectionChild variant.\n */\nexport function parseTextbox(\n el: Element,\n ctx: DocxReadContext,\n parseChildren: (elements: Element[], ctx: DocxReadContext) => unknown[],\n): {\n style?: Record<string, string>;\n children?: unknown[];\n} {\n const shape = findFirst(el, \"v:shape\");\n if (!shape) return {};\n\n const opts: Record<string, unknown> = {};\n\n // Parse VML style\n const styleAttr = attr(shape, \"style\");\n if (styleAttr) {\n opts.style = parseVmlStyle(styleAttr);\n }\n\n // Parse textbox content\n const textbox = findFirst(shape, \"v:textbox\");\n if (textbox) {\n const txbxContent = findChild(textbox, \"w:txbxContent\");\n if (txbxContent) {\n const childList = parseChildren(txbxContent.elements ?? [], ctx);\n if (childList.length > 0) opts.children = childList;\n }\n }\n\n return opts as { style?: Record<string, string>; children?: unknown[] };\n}\n","/**\n * Body parser for DOCX documents.\n *\n * Parses w:body → SectionOptions[] by splitting at w:sectPr boundaries.\n *\n * @module\n */\nimport { attr, findChild, findDeep, findFirst, textOf } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { parseAltChunk } from \"@parts/alt-chunk/alt-chunk-parse\";\nimport { parseCustomXmlBlock } from \"@parts/custom-xml/custom-xml-parse\";\nimport { parseSectionPropertiesEl } from \"@parts/document/body/section-properties/descriptor\";\nimport type { SectionPropertiesOptions } from \"@parts/document/body/section-properties/section-properties\";\nimport type { MarkupRangeOptions, BookmarkStartOptions } from \"@parts/paragraph/links/bookmark\";\nimport { parseSdtBlock } from \"@parts/sdt/sdt-parse\";\nimport { parseSubDoc } from \"@parts/sub-doc/sub-doc-parse\";\nimport {\n parseToc,\n parseTocFieldFromElements,\n selectTocEntryElements,\n} from \"@parts/table-of-contents/toc-parse\";\nimport { tableDesc } from \"@parts/table/descriptor\";\nimport type { TableOptions } from \"@parts/table/table\";\nimport { parseTextbox } from \"@parts/textbox/textbox-parse\";\nimport type { SectionOptions } from \"@shared/section\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { parseParagraph } from \"../body\";\nimport { DocxReadContext } from \"../context\";\nimport { setBodyParseChild } from \"../parts\";\nimport { stringifyElement } from \"../util/stringify-element\";\n\n// ── Section properties parser ────────────────────────────────────────────────\n\n/** Internal parse result: section properties with extracted header/footer refs. */\ntype ParsedSectionProperties = SectionPropertiesOptions & {\n parsedHeaders?: Record<string, SectionChild[]>;\n parsedFooters?: Record<string, SectionChild[]>;\n};\n\n/**\n * Parse w:sectPr element into SectionPropertiesOptions.\n * Delegates to the section properties descriptor's parse method.\n */\nfunction parseSectionProperties(el: Element, ctx: DocxReadContext): ParsedSectionProperties {\n const opts: ParsedSectionProperties = parseSectionPropertiesEl(el);\n\n // Headers/footers - parse from references and store in a separate field\n const headerRefs: Record<string, SectionChild[]> = {};\n const footerRefs: Record<string, SectionChild[]> = {};\n\n for (const child of el.elements ?? []) {\n if (child.name === \"w:headerReference\") {\n const rId = attr(child, \"r:id\");\n const type = attr(child, \"w:type\");\n if (rId && type) {\n const headerChildren = parseHeaderFooterRef(rId, ctx);\n if (headerChildren) headerRefs[type] = headerChildren;\n }\n }\n if (child.name === \"w:footerReference\") {\n const rId = attr(child, \"r:id\");\n const type = attr(child, \"w:type\");\n if (rId && type) {\n const footerChildren = parseHeaderFooterRef(rId, ctx);\n if (footerChildren) footerRefs[type] = footerChildren;\n }\n }\n }\n\n if (Object.keys(headerRefs).length > 0) {\n opts.parsedHeaders = headerRefs;\n }\n if (Object.keys(footerRefs).length > 0) {\n opts.parsedFooters = footerRefs;\n }\n\n return opts;\n}\n\n/**\n * Parse a header/footer reference by following the relationship to its XML part.\n */\nfunction parseHeaderFooterRef(rId: string, ctx: DocxReadContext): SectionChild[] | undefined {\n const path = ctx.docx.partRefs.headers.get(rId) ?? ctx.docx.partRefs.footers.get(rId);\n if (!path) return undefined;\n\n const partEl = ctx.docx.doc.get(path);\n if (!partEl) return undefined;\n\n // The header/footer XML root element contains w:p, w:tbl, etc. Parse under\n // the part's own relationship scope so its drawings resolve images correctly.\n const children: SectionChild[] = [];\n ctx.withPart(path, () => {\n for (const child of partEl.elements ?? []) {\n const sectionChild = parseSectionChild(child, ctx);\n if (sectionChild !== undefined) {\n children.push(sectionChild);\n }\n }\n });\n\n return children.length > 0 ? children : undefined;\n}\n\n// ── Section child dispatch ───────────────────────────────────────────────────\n\n/**\n * Parse a single body child element into a SectionChild.\n */\nexport function parseSectionChild(el: Element, ctx: DocxReadContext): SectionChild {\n switch (el.name) {\n case \"w:p\": {\n // Check for textbox (w:pict containing v:textbox)\n const pict = findChild(el, \"w:pict\");\n if (pict) {\n const textbox = findFirst(pict, \"v:textbox\");\n if (textbox) {\n const textboxOpts = parseTextbox(pict, ctx, parseSectionChildrenElements);\n return { textbox: textboxOpts as SectionChild extends { textbox: infer T } ? T : never };\n }\n }\n\n return { paragraph: parseParagraph(el, ctx) };\n }\n case \"w:tbl\":\n return { table: tableDesc.parse(el, ctx) as TableOptions };\n case \"w:sdt\": {\n // Try TOC first\n const tocResult = parseToc(el, ctx, parseSectionChildrenElements);\n if (tocResult) {\n return { toc: tocResult };\n }\n // Otherwise parse as generic SDT block\n const sdtResult = parseSdtBlock(el, ctx, parseSectionChildrenElements);\n return {\n sdt: {\n properties: sdtResult.properties,\n children: sdtResult.children as SectionChild[] | undefined,\n },\n };\n }\n case \"w:altChunk\":\n return { altChunk: parseAltChunk(el, ctx) };\n case \"w:subDoc\":\n return { subDoc: parseSubDoc(el, ctx) };\n case \"w:customXml\":\n return { customXml: parseCustomXmlBlock(el, ctx, parseSectionChild) };\n case \"w:bookmarkStart\": {\n // Body-level range markers sitting between paragraphs (e.g. _Toc bookmark\n // ends grouped after a heading). Carry them as first-class children so\n // they round-trip even though they are not wrapped in a paragraph.\n const idRaw = attr(el, \"w:id\");\n const name = attr(el, \"w:name\");\n if (idRaw !== undefined && name) {\n const bookmarkStart: Partial<BookmarkStartOptions> = { id: Number(idRaw), name };\n const disp = attr(el, \"w:displacedByCustomXml\");\n if (disp === \"before\" || disp === \"after\") bookmarkStart.displacedByCustomXml = disp;\n const colFirstRaw = attr(el, \"w:colFirst\");\n if (colFirstRaw !== undefined) bookmarkStart.colFirst = Number(colFirstRaw);\n const colLastRaw = attr(el, \"w:colLast\");\n if (colLastRaw !== undefined) bookmarkStart.colLast = Number(colLastRaw);\n return { bookmarkStart: bookmarkStart as BookmarkStartOptions };\n }\n return { rawXml: stringifyElement(el) };\n }\n case \"w:bookmarkEnd\": {\n const idRaw = attr(el, \"w:id\");\n if (idRaw !== undefined) {\n const bookmarkEnd: Partial<MarkupRangeOptions> = { id: Number(idRaw) };\n const disp = attr(el, \"w:displacedByCustomXml\");\n if (disp === \"before\" || disp === \"after\") bookmarkEnd.displacedByCustomXml = disp;\n return { bookmarkEnd: bookmarkEnd as MarkupRangeOptions };\n }\n return { rawXml: stringifyElement(el) };\n }\n default:\n return { rawXml: stringifyElement(el) };\n }\n}\n\n// ── Body parsing with section splitting ───────────────────────────────────────\n\n/**\n * Parse w:body element into SectionOptions[].\n *\n * Splits body content at w:sectPr boundaries to create sections.\n * The last w:sectPr (child of w:body directly) defines the last section.\n * Previous w:sectPr elements appear inside w:pPr elements.\n */\nexport function parseBody(body: Element, ctx: DocxReadContext): SectionOptions[] {\n // Register the body child parser for descriptor parse callbacks\n setBodyParseChild(parseSectionChild);\n\n // Collect body children and detect section breaks\n interface SectionBoundary {\n index: number;\n sectPr: Element;\n }\n\n const bodyChildren: Element[] = [];\n const boundaries: SectionBoundary[] = [];\n\n for (const child of body.elements ?? []) {\n if (child.name === \"w:sectPr\") {\n // Final section properties (last section)\n boundaries.push({ index: bodyChildren.length, sectPr: child });\n } else {\n bodyChildren.push(child);\n\n // Check for inline sectPr in paragraph properties\n if (child.name === \"w:p\") {\n const pPr = findChild(child, \"w:pPr\");\n if (pPr) {\n const sectPr = findChild(pPr, \"w:sectPr\");\n if (sectPr) {\n boundaries.push({ index: bodyChildren.length, sectPr });\n }\n }\n }\n }\n }\n\n // If no boundaries, the whole body is one section\n if (boundaries.length === 0) {\n return [\n {\n children: parseBodyChildren(bodyChildren, ctx),\n },\n ];\n }\n\n // Split into sections\n const sections: SectionOptions[] = [];\n let start = 0;\n\n for (let i = 0; i < boundaries.length; i++) {\n const boundary = boundaries[i];\n // For inline sectPr (inside w:pPr), the containing paragraph was pushed to\n // bodyChildren. Exclude it — it's a section break marker, not content.\n // The last boundary uses a body-level sectPr, so no paragraph to exclude.\n const isInlineSectPr = i < boundaries.length - 1;\n const endIdx = isInlineSectPr ? Math.max(start, boundary.index - 1) : boundary.index;\n const sectionElements = bodyChildren.slice(start, endIdx);\n const parsedProps = parseSectionProperties(boundary.sectPr, ctx);\n\n // Extract headers/footers that were stored as parsedHeaders/parsedFooters\n const { parsedHeaders, parsedFooters } = parsedProps;\n\n // Build clean properties without internal fields\n const cleanProps = { ...parsedProps };\n delete cleanProps.parsedHeaders;\n delete cleanProps.parsedFooters;\n\n const section = {\n children: parseBodyChildren(sectionElements, ctx),\n properties: cleanProps,\n ...(parsedHeaders ? { headers: parsedHeaders } : {}),\n ...(parsedFooters ? { footers: parsedFooters } : {}),\n } as SectionOptions;\n\n sections.push(section);\n start = boundary.index;\n }\n\n // If there are elements after the last boundary, they form the last section\n // with the body-level w:sectPr (already captured)\n // Actually the body-level sectPr IS the last boundary\n\n return sections;\n}\n\n// ── Cross-paragraph TOC field aggregation ───────────────────────────────────\n\n/**\n * Net field-nesting change across all descendant fldChar markers\n * (begin: +1, end: -1). Balances cross-paragraph field boundaries without a\n * stack — the running depth hits 0 exactly when the outermost field closes.\n */\nfunction countFieldDelta(el: Element): number {\n let delta = 0;\n const walk = (node: Element): void => {\n if (node.name === \"w:fldChar\") {\n const type = attr(node, \"w:fldCharType\");\n if (type === \"begin\") delta += 1;\n else if (type === \"end\") delta -= 1;\n }\n for (const c of node.elements ?? []) {\n if (c.type === \"element\") walk(c);\n }\n };\n walk(el);\n return delta;\n}\n\n/**\n * True when a w:p opens a bare TOC complex field: it carries a fldChar begin\n * whose instrText starts with \"TOC\". Such fields span multiple paragraphs and\n * defeat the per-paragraph field accumulator, so they are aggregated as rawXml.\n */\nfunction isTocFieldBegin(el: Element): boolean {\n if (el.name !== \"w:p\") return false;\n let hasBegin = false;\n let instr = \"\";\n const walk = (node: Element): void => {\n if (node.name === \"w:fldChar\" && attr(node, \"w:fldCharType\") === \"begin\") hasBegin = true;\n if (node.name === \"w:instrText\") instr += textOf(node);\n for (const c of node.elements ?? []) {\n if (c.type === \"element\") walk(c);\n }\n };\n walk(el);\n return hasBegin && instr.trim().toUpperCase().startsWith(\"TOC\");\n}\n\n/**\n * Parse a run of body-level elements into SectionChild[], aggregating any\n * cross-paragraph TOC complex field into a single rawXml child so its nested\n * HYPERLINK/PAGEREF fields and bookmark markers round-trip intact.\n */\nfunction parseBodyChildren(elements: Element[], ctx: DocxReadContext): SectionChild[] {\n const children: SectionChild[] = [];\n let tocBuffer: Element[] | null = null;\n let tocDepth = 0;\n\n const flushToc = (): void => {\n if (!tocBuffer) return;\n children.push(buildTocChild(tocBuffer, ctx));\n // buildTocChild preserves the rendered entries (paragraphs between the\n // separate and end markers) but not the end-closing paragraph, which often\n // carries a trailing page break (the section break before the first\n // heading). Rescue that page break as a standalone child to avoid silently\n // dropping it on round-trip.\n const lastEl = tocBuffer[tocBuffer.length - 1];\n const pageBreakCount = findDeep(lastEl, \"w:br\").filter(\n (b) => attr(b, \"w:type\") === \"page\",\n ).length;\n for (let i = 0; i < pageBreakCount; i++) {\n children.push({ paragraph: { children: [{ pageBreak: true }] } });\n }\n tocBuffer = null;\n tocDepth = 0;\n };\n\n for (const el of elements) {\n if (tocBuffer !== null) {\n tocBuffer.push(el);\n tocDepth += countFieldDelta(el);\n if (tocDepth <= 0) flushToc();\n continue;\n }\n if (isTocFieldBegin(el)) {\n tocBuffer = [el];\n tocDepth = countFieldDelta(el);\n if (tocDepth <= 0) flushToc();\n continue;\n }\n children.push(parseSectionChild(el, ctx));\n }\n\n // Unclosed TOC field at end of content — flush what we have (best effort).\n flushToc();\n\n return children;\n}\n\n/**\n * Build a structured TOC SectionChild from a captured bare TOC field. Extracts\n * the field instruction (switches → TableOfContentsOptions) and preserves the\n * rendered entries (separate→end paragraphs) structurally so MS Office and WPS\n * both display the existing TOC. The field is emitted clean (no dirty flag).\n */\nfunction buildTocChild(els: Element[], ctx: DocxReadContext): SectionChild {\n const tocOpts = parseTocFieldFromElements(els);\n const entryEls = selectTocEntryElements(els);\n if (entryEls.length > 0) {\n tocOpts.entries = entryEls.map((el) => parseSectionChild(el, ctx));\n }\n return { toc: tocOpts };\n}\n\n/**\n * Parse a list of elements into SectionChild[].\n * Used by SDT and textbox parsers for their content.\n */\nfunction parseSectionChildrenElements(elements: Element[], ctx: DocxReadContext): SectionChild[] {\n return parseBodyChildren(elements, ctx);\n}\n","import type { ParsedArchive } from \"@office-open/core\";\nimport { parseArchive } from \"@office-open/core\";\nimport type { DataType } from \"@office-open/core\";\nimport { toUint8Array } from \"@office-open/core\";\nimport { attr } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { appPropertiesDesc } from \"@parts/app-properties\";\nimport { bibliographyDesc } from \"@parts/bibliography\";\nimport { setBodyParseChild } from \"@parts/bodychildren\";\nimport { commentsDesc } from \"@parts/comments\";\nimport { contentTypesDesc } from \"@parts/contenttypes\";\nimport { corePropertiesDesc } from \"@parts/core-properties\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { customPropertiesDesc } from \"@parts/custom-properties\";\nimport { endnotesDesc } from \"@parts/endnotes/descriptor\";\nimport { fontTableDesc } from \"@parts/fonts/descriptor\";\nimport type { EmbeddedFontOptionsWithKey } from \"@parts/fonts/font-wrapper\";\nimport { footnotesDesc } from \"@parts/footnotes/descriptor\";\nimport { glossaryDesc } from \"@parts/glossary-document\";\nimport { parseNumberingDefinitions } from \"@parts/numbering/numbering\";\nimport { settingsDesc } from \"@parts/settings/descriptor\";\nimport { buildStyleCache, buildNumberingCache, parseStyleDefinitions } from \"@parts/styles/styles\";\nimport { setTableParseChild } from \"@parts/table/descriptor\";\nimport { webSettingsDesc } from \"@parts/web-settings\";\n\nimport { parseParagraphProperties } from \"./body\";\nimport { DocxReadContext } from \"./context\";\nimport { parseBody, parseSectionChild } from \"./parse/body\";\nimport { replaceRelsWithPlaceholders } from \"./util/replace-media-placeholders\";\nimport { stringifyElement } from \"./util/stringify-element\";\n\nexport { parseArchive };\n\n/**\n * All part paths extracted from the DOCX package.\n * Field names correspond directly to the OOXML directory structure.\n */\nexport interface DocxPartRefs {\n /** word/headerN.xml keyed by rId */\n headers: Map<string, string>;\n /** word/footerN.xml keyed by rId */\n footers: Map<string, string>;\n /** word/footnotes.xml */\n footnotes?: string;\n /** word/endnotes.xml */\n endnotes?: string;\n /** word/comments.xml */\n comments?: string;\n /** Hyperlink targets keyed by rId (external URLs) */\n hyperlinks: Map<string, string>;\n /** word/charts/chartN.xml keyed by rId */\n charts: Map<string, string>;\n /** word/diagrams/dataN.xml keyed by rId */\n diagramData: Map<string, string>;\n /** word/media/* keyed by rId (from document.xml.rels) */\n media: Map<string, string>;\n /**\n * Per-part image/media relationships. Each part (document, headers, footers,\n * footnotes, …) has its own .rels with independent rId numbering, so drawings\n * inside a part must resolve images against that part's rels. Maps\n * partPath → (rId → mediaPath).\n */\n partMedia: Map<string, Map<string, string>>;\n /** Alternative format chunks (word/afchunkN.*) keyed by rId */\n afChunks: Map<string, string>;\n /** Sub-documents (word/subdocs/subdocN.docx) keyed by rId */\n subDocs: Map<string, string>;\n /** word/bibliography.xml */\n bibliography?: string;\n /** word/glossary/document.xml */\n glossary?: string;\n}\n\nexport interface DocxDocument {\n doc: ParsedArchive;\n /** word/document.xml → root w:document element */\n documentRoot: Element;\n /** word/document.xml → w:body element */\n body: Element;\n /** word/document.xml → w:background element */\n background?: Element;\n /** word/styles.xml */\n styles?: Element;\n /** word/numbering.xml */\n numbering?: Element;\n /** word/settings.xml */\n settings?: Element;\n /** word/fontTable.xml */\n fontTable?: Element;\n /** word/webSettings.xml */\n webSettings?: Element;\n partRefs: DocxPartRefs;\n /** docProps/core.xml */\n coreProps?: string;\n /** docProps/app.xml */\n appProps?: string;\n /** docProps/custom.xml */\n customProps?: string;\n /** [Content_Types].xml */\n contentTypes?: Element;\n}\n\nfunction resolveRelsPath(target: string): string {\n if (target.startsWith(\"/\")) return target.slice(1);\n if (target.startsWith(\"../\")) return target.replace(\"../\", \"\");\n return `word/${target}`;\n}\n\n/**\n * Resolve each embedded font's .odttf bytes through fontTable.xml.rels.\n * Reads the binary verbatim and flags it raw so the compiler copies it as-is\n * instead of re-obfuscating (the fontKey already matches the bytes).\n */\nfunction resolveEmbeddedFontData(fonts: EmbeddedFontOptionsWithKey[], doc: ParsedArchive): void {\n const relsEl = doc.get(\"word/_rels/fontTable.xml.rels\");\n if (!relsEl) return;\n const ridToPath = new Map<string, string>();\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n if (!type.includes(\"/font\")) continue;\n const id = attr(child, \"Id\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (id && target) ridToPath.set(id, resolveRelsPath(target));\n }\n for (const font of fonts) {\n if (!font.embedRid) continue;\n const odttfPath = ridToPath.get(font.embedRid);\n if (!odttfPath) continue;\n const bytes = doc.getRaw(odttfPath);\n if (bytes) {\n font.data = Buffer.from(bytes);\n font.rawOdttf = true;\n font.odttfPath = odttfPath;\n }\n }\n}\n\nfunction parseDocPartRefs(doc: ParsedArchive): DocxPartRefs {\n const refs: DocxPartRefs = {\n headers: new Map(),\n footers: new Map(),\n hyperlinks: new Map(),\n charts: new Map(),\n diagramData: new Map(),\n media: new Map(),\n partMedia: new Map(),\n afChunks: new Map(),\n subDocs: new Map(),\n };\n\n const relsEl = doc.get(\"word/_rels/document.xml.rels\");\n if (!relsEl) return refs;\n\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n const id = attr(child, \"Id\") ?? \"\";\n if (!target) continue;\n\n const path = resolveRelsPath(target);\n\n if (type.includes(\"/header\")) {\n refs.headers.set(id, path);\n } else if (type.includes(\"/footer\")) {\n refs.footers.set(id, path);\n } else if (type.includes(\"/footnotes\")) {\n refs.footnotes = path;\n } else if (type.includes(\"/endnotes\")) {\n refs.endnotes = path;\n } else if (type.includes(\"/comments\")) {\n refs.comments = path;\n } else if (type.includes(\"/chart\")) {\n refs.charts.set(id, path);\n } else if (type.includes(\"/diagramData\")) {\n refs.diagramData.set(id, path);\n } else if (type.includes(\"/image\") || type.includes(\"/media\")) {\n refs.media.set(id, path);\n } else if (type.includes(\"/aFChunk\")) {\n refs.afChunks.set(id, path);\n } else if (type.includes(\"/subDocument\")) {\n refs.subDocs.set(id, path);\n } else if (type.includes(\"/bibliography\")) {\n refs.bibliography = path;\n } else if (type.includes(\"/glossaryDocument\")) {\n refs.glossary = path;\n } else if (type.includes(\"/hyperlink\")) {\n refs.hyperlinks.set(id, target);\n }\n }\n\n // Per-part image relationships. Each part carries its own .rels with\n // independent rId numbering (document rId1 ≠ header rId1), so collect them\n // keyed by part path; drawings inside a part resolve images through its\n // own rels. Covers document, headers, footers, footnotes, endnotes, comments.\n for (const relsPath of doc.keys(\"word/_rels/\")) {\n if (!relsPath.endsWith(\".rels\")) continue;\n const relsEl = doc.get(relsPath);\n if (!relsEl) continue;\n const partPath = \"word/\" + relsPath.slice(\"word/_rels/\".length, -\".rels\".length);\n for (const rel of relsEl.elements ?? []) {\n if (rel.name !== \"Relationship\") continue;\n const type = attr(rel, \"Type\") ?? \"\";\n if (!type.includes(\"/image\") && !type.includes(\"/media\")) continue;\n const id = attr(rel, \"Id\") ?? \"\";\n const target = attr(rel, \"Target\") ?? \"\";\n if (!id || !target) continue;\n let partMap = refs.partMedia.get(partPath);\n if (!partMap) {\n partMap = new Map();\n refs.partMedia.set(partPath, partMap);\n }\n partMap.set(id, resolveRelsPath(target));\n }\n }\n\n return refs;\n}\n\nfunction parseRootRels(doc: ParsedArchive): {\n coreProps?: string;\n appProps?: string;\n customProps?: string;\n} {\n const relsEl = doc.get(\"_rels/.rels\");\n if (!relsEl) return {};\n\n let coreProps: string | undefined;\n let appProps: string | undefined;\n let customProps: string | undefined;\n\n for (const child of relsEl.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (!target) continue;\n\n const path = target.startsWith(\"/\") ? target.slice(1) : target;\n\n if (type.includes(\"/core-properties\")) {\n coreProps = path;\n } else if (type.includes(\"/extended-properties\")) {\n appProps = path;\n } else if (type.includes(\"/custom-properties\")) {\n customProps = path;\n }\n }\n\n return { coreProps, appProps, customProps };\n}\n\n/**\n * Parse a .docx file and convert it into DocumentOptions.\n *\n * This is the main public API for parsing DOCX files.\n * The returned options can be passed directly to `new Document(parsed)`\n * to recreate the document.\n *\n * @param data - Raw bytes of a .docx file\n * @returns Document options including sections and metadata\n */\nexport function parseDocument(data: DataType): DocumentOptions {\n const docx = parseDocx(data);\n const ctx = new DocxReadContext(\n docx,\n buildStyleCache(docx.styles),\n buildNumberingCache(docx.numbering),\n );\n\n // Register the child parser for table and body child descriptors\n setTableParseChild(parseSectionChild);\n setBodyParseChild(parseSectionChild);\n\n const sections = parseBody(docx.body, ctx);\n\n const opts: Partial<DocumentOptions> = { sections };\n\n // Document conformance class (w:document/@w:conformance)\n const conformance = attr(docx.documentRoot, \"w:conformance\");\n if (conformance === \"strict\" || conformance === \"transitional\") opts.conformance = conformance;\n\n // Background (w:background in document.xml)\n if (docx.background) {\n const hasChildren = (docx.background.elements ?? []).some((e) => e.type === \"element\");\n if (hasChildren) {\n // VML/structured background (e.g. v:background/v:fill pattern with a\n // texture image) that doesn't fit the color/theme model: carry the\n // element verbatim, rewriting relationship refs to {fileName} placeholders\n // so the media round-trips via the compiler's placeholder pass.\n const { rawXml, rawMedia } = replaceRelsWithPlaceholders(\n stringifyElement(docx.background),\n ctx,\n \"background\",\n );\n opts.background = rawMedia.length > 0 ? { rawXml, rawMedia } : { rawXml };\n } else {\n const bg: NonNullable<DocumentOptions[\"background\"]> = {};\n const color = attr(docx.background, \"w:color\");\n if (color) bg.color = color;\n const themeColor = attr(docx.background, \"w:themeColor\");\n if (themeColor) bg.themeColor = themeColor;\n const themeShade = attr(docx.background, \"w:themeShade\");\n if (themeShade) bg.themeShade = themeShade;\n const themeTint = attr(docx.background, \"w:themeTint\");\n if (themeTint) bg.themeTint = themeTint;\n if (Object.keys(bg).length > 0) opts.background = bg;\n }\n }\n\n // Core properties\n if (docx.coreProps) {\n const corePropsEl = docx.doc.get(docx.coreProps);\n if (corePropsEl) {\n const cp = corePropertiesDesc.parse(corePropsEl, ctx);\n if (cp.title) opts.title = cp.title;\n if (cp.subject) opts.subject = cp.subject;\n if (cp.creator) opts.creator = cp.creator;\n if (cp.keywords) opts.keywords = cp.keywords;\n if (cp.description) opts.description = cp.description;\n if (cp.lastModifiedBy) opts.lastModifiedBy = cp.lastModifiedBy;\n if (cp.revision) opts.revision = cp.revision;\n if (cp.lastPrinted) opts.lastPrinted = cp.lastPrinted;\n if (cp.created) opts.created = cp.created;\n if (cp.modified) opts.modified = cp.modified;\n }\n }\n\n // App (extended) properties\n if (docx.appProps) {\n const appPropsEl = docx.doc.get(docx.appProps);\n if (appPropsEl) {\n const ap = appPropertiesDesc.parse(appPropsEl, ctx);\n if (Object.keys(ap).length > 0) opts.appProperties = ap;\n }\n }\n\n // Settings — parse produces a structured SettingsOptions aligned with\n // generate (no verbatim rawXml fallback). Assign wholesale so context.ts\n // spreads it into _settingsOptions for the descriptor's stringify input.\n if (docx.settings) {\n opts.settings = settingsDesc.parse(docx.settings, ctx);\n }\n\n // Web settings — preserve the part on round-trip even when it has no\n // children. Dropping it leaves an orphaned Override in the passthrough\n // [Content_Types].xml (the part is gone but its Override remains), which is\n // an OPC violation; keeping presence keeps part + rel + Override in sync.\n if (docx.webSettings) {\n opts.webSettings = webSettingsDesc.parse(docx.webSettings, ctx);\n }\n\n // Custom properties\n if (docx.customProps) {\n const customPropsEl = docx.doc.get(docx.customProps);\n if (customPropsEl) {\n const cpResult = customPropertiesDesc.parse(customPropsEl, ctx);\n if (cpResult.properties && cpResult.properties.length > 0) {\n opts.customProperties = cpResult.properties;\n }\n }\n }\n\n // Comments content\n if (docx.partRefs.comments) {\n const commentsEl = docx.doc.get(docx.partRefs.comments);\n if (commentsEl) {\n const commentsResult = ctx.withPart(docx.partRefs.comments, () =>\n commentsDesc.parse(commentsEl, ctx),\n );\n const children = commentsResult.children;\n if (children && children.length > 0) {\n opts.comments = { children };\n }\n }\n }\n\n // Footnotes content\n if (docx.partRefs.footnotes) {\n const footnotesEl = docx.doc.get(docx.partRefs.footnotes);\n if (footnotesEl) {\n const fnResult = ctx.withPart(docx.partRefs.footnotes, () =>\n footnotesDesc.parse(footnotesEl, ctx),\n );\n const footnotesMap: NonNullable<DocumentOptions[\"footnotes\"]> = {};\n for (const [id, paragraphs] of fnResult.notes) {\n footnotesMap[String(id)] = { children: paragraphs };\n }\n // Preserve round-tripped separators so the generated ids stay consistent\n // with settings.footnotePr (which references them).\n if (\n Object.keys(footnotesMap).length > 0 ||\n fnResult.separator ||\n fnResult.continuationSeparator\n ) {\n if (fnResult.separator) footnotesMap.separator = fnResult.separator;\n if (fnResult.continuationSeparator)\n footnotesMap.continuationSeparator = fnResult.continuationSeparator;\n opts.footnotes = footnotesMap;\n }\n }\n }\n\n // Endnotes content\n if (docx.partRefs.endnotes) {\n const endnotesEl = docx.doc.get(docx.partRefs.endnotes);\n if (endnotesEl) {\n const enResult = ctx.withPart(docx.partRefs.endnotes, () =>\n endnotesDesc.parse(endnotesEl, ctx),\n );\n const endnotesMap: NonNullable<DocumentOptions[\"endnotes\"]> = {};\n for (const [id, paragraphs] of enResult.notes) {\n endnotesMap[String(id)] = { children: paragraphs };\n }\n if (\n Object.keys(endnotesMap).length > 0 ||\n enResult.separator ||\n enResult.continuationSeparator\n ) {\n if (enResult.separator) endnotesMap.separator = enResult.separator;\n if (enResult.continuationSeparator)\n endnotesMap.continuationSeparator = enResult.continuationSeparator;\n opts.endnotes = endnotesMap;\n }\n }\n }\n\n // Styles definitions\n if (docx.styles) {\n const styleOpts = parseStyleDefinitions(docx.styles, parseParagraphProperties, ctx);\n if (styleOpts) opts.styles = styleOpts;\n }\n\n // Numbering definitions\n if (docx.numbering) {\n const numOpts = parseNumberingDefinitions(docx.numbering, parseParagraphProperties, ctx);\n if (numOpts) opts.numbering = numOpts;\n }\n\n // Font table\n if (docx.fontTable) {\n const ftResult = fontTableDesc.parse(docx.fontTable, ctx);\n if (ftResult.fonts && ftResult.fonts.length > 0) {\n resolveEmbeddedFontData(ftResult.fonts, docx.doc);\n opts.fonts = ftResult.fonts;\n }\n }\n\n // Bibliography\n if (docx.partRefs.bibliography) {\n const bibEl = docx.doc.get(docx.partRefs.bibliography);\n if (bibEl) {\n const bibResult = bibliographyDesc.parse(bibEl, ctx);\n if (bibResult.sources && bibResult.sources.length > 0) opts.bibliography = bibResult;\n }\n }\n\n // Glossary document\n if (docx.partRefs.glossary) {\n const glossaryEl = docx.doc.get(docx.partRefs.glossary);\n if (glossaryEl) {\n const glossaryResult = ctx.withPart(docx.partRefs.glossary, () =>\n glossaryDesc.parse(glossaryEl, ctx),\n );\n if (glossaryResult.parts && glossaryResult.parts.length > 0) opts.glossary = glossaryResult;\n }\n }\n\n // Content types\n if (docx.contentTypes) {\n const ctResult = contentTypesDesc.parse(docx.contentTypes, ctx);\n if (ctResult) opts.contentTypes = ctResult;\n }\n\n // Raw passthrough: parts generate() doesn't rebuild (word/theme/*, customXml/*).\n // Carried verbatim so their [Content_Types] declarations stay valid and the\n // package opens in Word. (Media/fonts/headers/etc. are rebuilt by the compiler\n // and must NOT be passed through — they'd otherwise duplicate under renamed paths.)\n const rawParts: { path: string; data: Uint8Array }[] = [];\n for (const prefix of [\"word/theme/\", \"customXml/\"]) {\n for (const p of docx.doc.keys(prefix)) {\n if (p.endsWith(\"/\")) continue;\n const data = docx.doc.getRaw(p);\n if (data) rawParts.push({ path: p, data });\n }\n }\n if (rawParts.length > 0) opts.rawParts = rawParts;\n\n return opts as DocumentOptions;\n}\n\nexport function parseDocx(data: DataType): DocxDocument {\n const uint8 = toUint8Array(data);\n const doc = parseArchive(uint8);\n\n const documentEl = doc.get(\"word/document.xml\");\n if (!documentEl) throw new Error(\"word/document.xml not found\");\n const body = documentEl.elements?.find((e) => e.name === \"w:body\");\n if (!body) throw new Error(\"w:body not found in word/document.xml\");\n const background = documentEl.elements?.find((e) => e.name === \"w:background\");\n\n const styles = doc.get(\"word/styles.xml\");\n const numbering = doc.get(\"word/numbering.xml\");\n const settings = doc.get(\"word/settings.xml\");\n const fontTable = doc.get(\"word/fontTable.xml\");\n const webSettings = doc.get(\"word/webSettings.xml\");\n\n const partRefs = parseDocPartRefs(doc);\n const { coreProps, appProps, customProps } = parseRootRels(doc);\n\n const contentTypes = doc.get(\"[Content_Types].xml\");\n\n return {\n doc,\n documentRoot: documentEl,\n body,\n background,\n styles,\n numbering,\n settings,\n fontTable,\n webSettings,\n partRefs,\n coreProps,\n appProps,\n customProps,\n contentTypes,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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