@office-open/docx 0.10.9 → 0.10.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{context-CAYk5WLu.mjs → context-YVFle0J6.mjs} +2 -2
- package/dist/{context-CAYk5WLu.mjs.map → context-YVFle0J6.mjs.map} +1 -1
- package/dist/{core-properties-i25gKEDT.d.mts → core-properties-C510YJhg.d.mts} +5 -2
- package/dist/core-properties-C510YJhg.d.mts.map +1 -0
- package/dist/{generate-Di_7M9eJ.mjs → generate-fsy5ESN0.mjs} +3 -3
- package/dist/{generate-Di_7M9eJ.mjs.map → generate-fsy5ESN0.mjs.map} +1 -1
- package/dist/generate.d.mts +1 -1
- package/dist/generate.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +5 -5
- package/dist/{parse-DPBWKO12.mjs → parse-BcxcUGsx.mjs} +3 -3
- package/dist/{parse-DPBWKO12.mjs.map → parse-BcxcUGsx.mjs.map} +1 -1
- package/dist/parse.d.mts +1 -1
- package/dist/parse.mjs +1 -1
- package/dist/{parts-CATV83XR.mjs → parts-7TLJ0TNR.mjs} +31 -15
- package/dist/parts-7TLJ0TNR.mjs.map +1 -0
- package/dist/patch/index.d.mts +1 -1
- package/dist/patch/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/core-properties-i25gKEDT.d.mts.map +0 -1
- package/dist/parts-CATV83XR.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-DPBWKO12.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\n if (docx.webSettings) {\n const wsOpts = webSettingsDesc.parse(docx.webSettings, ctx);\n if (Object.keys(wsOpts).length > 0) opts.webSettings = wsOpts;\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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;EACA;EACA;EACA;EACA;EACA,cAhBmB,IAAI,IAAI,qBAgBhB;CACb;AACF"}
|
|
1
|
+
{"version":3,"file":"parse-BcxcUGsx.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\n if (docx.webSettings) {\n const wsOpts = webSettingsDesc.parse(docx.webSettings, ctx);\n if (Object.keys(wsOpts).length > 0) opts.webSettings = wsOpts;\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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M,aAAa,WAAW,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"}
|
package/dist/parse.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as parseArchive, g as DocxPartRefs, h as DocxDocument, v as parseDocument, y as parseDocx } from "./core-properties-
|
|
1
|
+
import { _ as parseArchive, g as DocxPartRefs, h as DocxDocument, v as parseDocument, y as parseDocx } from "./core-properties-C510YJhg.mjs";
|
|
2
2
|
export { DocxDocument, DocxPartRefs, parseArchive, parseDocument, parseDocx };
|
package/dist/parse.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-
|
|
1
|
+
import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-BcxcUGsx.mjs";
|
|
2
2
|
export { parseArchive, parseDocument, parseDocx };
|
|
@@ -1271,6 +1271,22 @@ const WidthType = {
|
|
|
1271
1271
|
/** Value is in percentage. */
|
|
1272
1272
|
PERCENTAGE: "pct"
|
|
1273
1273
|
};
|
|
1274
|
+
/**
|
|
1275
|
+
* OOXML stores width percentages as fiftieths-of-a-percent integer
|
|
1276
|
+
* (`w:w="5000"`, `w:type="pct"` = 100%). The public API exposes them as plain
|
|
1277
|
+
* percentages (`size: 100` = 100%); these helpers convert at the stringify/parse
|
|
1278
|
+
* boundary so callers never handle the raw 5000 value. A bare number must never
|
|
1279
|
+
* be emitted with a "%" suffix — that is a different XSD branch (`s:ST_Percentage`)
|
|
1280
|
+
* meaning 5000%, which Word treats as `auto` on `tblW`.
|
|
1281
|
+
*/
|
|
1282
|
+
/** Stringify: percentage (`100`, `"50%"`) → OOXML fiftieths integer (`5000`). */
|
|
1283
|
+
const widthPctToFiftieths = (size) => {
|
|
1284
|
+
if (typeof size === "number") return Math.round(size * 50);
|
|
1285
|
+
if (size.endsWith("%")) return Math.round(Number(size.slice(0, -1)) * 50);
|
|
1286
|
+
return size;
|
|
1287
|
+
};
|
|
1288
|
+
/** Parse: OOXML fiftieths (`5000`) → percentage (`100`) when `type` is `"pct"`. */
|
|
1289
|
+
const widthFiftiethsToPct = (size, type) => type === "pct" && typeof size === "number" ? size / 50 : size;
|
|
1274
1290
|
//#endregion
|
|
1275
1291
|
//#region src/parts/object/object-element.ts
|
|
1276
1292
|
/**
|
|
@@ -1586,7 +1602,7 @@ function parseRunProperties(el) {
|
|
|
1586
1602
|
}
|
|
1587
1603
|
const kern = findChild(el, "w:kern");
|
|
1588
1604
|
if (kern) {
|
|
1589
|
-
const val =
|
|
1605
|
+
const val = attrMeasure(kern, "w:val");
|
|
1590
1606
|
if (val !== void 0) opts.kern = val;
|
|
1591
1607
|
}
|
|
1592
1608
|
const position = findChild(el, "w:position");
|
|
@@ -7808,8 +7824,7 @@ function stringifyParagraphInline(opts, ctx) {
|
|
|
7808
7824
|
*/
|
|
7809
7825
|
function tableWidthStr(name, opts) {
|
|
7810
7826
|
const type = opts.type ?? WidthType.AUTO;
|
|
7811
|
-
|
|
7812
|
-
if (type === WidthType.PERCENTAGE && typeof w === "number") w = `${w}%`;
|
|
7827
|
+
const w = type === WidthType.PERCENTAGE ? widthPctToFiftieths(opts.size) : opts.size;
|
|
7813
7828
|
return `<${name} ${attrParts({
|
|
7814
7829
|
"w:w": w !== void 0 ? measurementOrPercentValue(w) : void 0,
|
|
7815
7830
|
"w:type": type
|
|
@@ -7919,9 +7934,10 @@ function cellMergeStr(opts) {
|
|
|
7919
7934
|
return `<w:cellMerge ${attrParts(attrs)}/>`;
|
|
7920
7935
|
}
|
|
7921
7936
|
function cellSpacingStr(opts) {
|
|
7937
|
+
const w = opts.type === WidthType.PERCENTAGE ? widthPctToFiftieths(opts.size) : opts.size;
|
|
7922
7938
|
return `<w:tblCellSpacing ${attrParts({
|
|
7923
|
-
"w:
|
|
7924
|
-
"w:
|
|
7939
|
+
"w:w": w !== void 0 ? measurementOrPercentValue(w) : void 0,
|
|
7940
|
+
"w:type": opts.type
|
|
7925
7941
|
})}/>`;
|
|
7926
7942
|
}
|
|
7927
7943
|
function stringifyTablePropertiesChangeInner(options) {
|
|
@@ -8241,7 +8257,7 @@ function parseCellMargins(marginEl) {
|
|
|
8241
8257
|
const sideEl = findChild(marginEl, `w:${side}`);
|
|
8242
8258
|
if (sideEl) {
|
|
8243
8259
|
const type = attr(sideEl, "w:type");
|
|
8244
|
-
const size = attrMeasure(sideEl, "w:w", type);
|
|
8260
|
+
const size = widthFiftiethsToPct(attrMeasure(sideEl, "w:w"), type);
|
|
8245
8261
|
if (size !== void 0) margins[side] = type ? {
|
|
8246
8262
|
size,
|
|
8247
8263
|
type
|
|
@@ -8421,7 +8437,7 @@ function parseTablePropertiesEl(el) {
|
|
|
8421
8437
|
const tblW = findChild(el, "w:tblW");
|
|
8422
8438
|
if (tblW) {
|
|
8423
8439
|
const type = attr(tblW, "w:type");
|
|
8424
|
-
const size = attrMeasure(tblW, "w:w", type);
|
|
8440
|
+
const size = widthFiftiethsToPct(attrMeasure(tblW, "w:w"), type);
|
|
8425
8441
|
if (size !== void 0 || type) opts.width = {
|
|
8426
8442
|
size: size ?? 0,
|
|
8427
8443
|
...type ? { type } : {}
|
|
@@ -8524,7 +8540,7 @@ function parseTablePropertiesEl(el) {
|
|
|
8524
8540
|
const tblInd = findChild(el, "w:tblInd");
|
|
8525
8541
|
if (tblInd) {
|
|
8526
8542
|
const type = attr(tblInd, "w:type");
|
|
8527
|
-
const size = attrMeasure(tblInd, "w:w", type);
|
|
8543
|
+
const size = widthFiftiethsToPct(attrMeasure(tblInd, "w:w"), type);
|
|
8528
8544
|
if (size !== void 0) opts.indent = {
|
|
8529
8545
|
size,
|
|
8530
8546
|
...type ? { type } : {}
|
|
@@ -8550,7 +8566,7 @@ function parseTablePropertiesEl(el) {
|
|
|
8550
8566
|
const tblCellSpacing = findChild(el, "w:tblCellSpacing");
|
|
8551
8567
|
if (tblCellSpacing) {
|
|
8552
8568
|
const type = attr(tblCellSpacing, "w:type");
|
|
8553
|
-
const w = attrMeasure(tblCellSpacing, "w:w", type);
|
|
8569
|
+
const w = widthFiftiethsToPct(attrMeasure(tblCellSpacing, "w:w"), type);
|
|
8554
8570
|
if (w !== void 0) opts.cellSpacing = {
|
|
8555
8571
|
size: w,
|
|
8556
8572
|
...type ? { type } : {}
|
|
@@ -8649,7 +8665,7 @@ function parseTableRowPropertiesEl(el) {
|
|
|
8649
8665
|
const wBefore = findChild(el, "w:wBefore");
|
|
8650
8666
|
if (wBefore) {
|
|
8651
8667
|
const type = attr(wBefore, "w:type");
|
|
8652
|
-
const size = attrMeasure(wBefore, "w:w", type);
|
|
8668
|
+
const size = widthFiftiethsToPct(attrMeasure(wBefore, "w:w"), type);
|
|
8653
8669
|
if (size !== void 0) opts.widthBefore = {
|
|
8654
8670
|
size,
|
|
8655
8671
|
...type ? { type } : {}
|
|
@@ -8658,7 +8674,7 @@ function parseTableRowPropertiesEl(el) {
|
|
|
8658
8674
|
const wAfter = findChild(el, "w:wAfter");
|
|
8659
8675
|
if (wAfter) {
|
|
8660
8676
|
const type = attr(wAfter, "w:type");
|
|
8661
|
-
const size = attrMeasure(wAfter, "w:w", type);
|
|
8677
|
+
const size = widthFiftiethsToPct(attrMeasure(wAfter, "w:w"), type);
|
|
8662
8678
|
if (size !== void 0) opts.widthAfter = {
|
|
8663
8679
|
size,
|
|
8664
8680
|
...type ? { type } : {}
|
|
@@ -8674,7 +8690,7 @@ function parseTableRowPropertiesEl(el) {
|
|
|
8674
8690
|
const tblCellSpacing = findChild(el, "w:tblCellSpacing");
|
|
8675
8691
|
if (tblCellSpacing) {
|
|
8676
8692
|
const type = attr(tblCellSpacing, "w:type");
|
|
8677
|
-
const w = attrMeasure(tblCellSpacing, "w:w", type);
|
|
8693
|
+
const w = widthFiftiethsToPct(attrMeasure(tblCellSpacing, "w:w"), type);
|
|
8678
8694
|
if (w !== void 0) opts.cellSpacing = {
|
|
8679
8695
|
size: w,
|
|
8680
8696
|
...type ? { type } : {}
|
|
@@ -8713,7 +8729,7 @@ function parseTableCellPropertiesEl(el) {
|
|
|
8713
8729
|
const tcW = findChild(el, "w:tcW");
|
|
8714
8730
|
if (tcW) {
|
|
8715
8731
|
const type = attr(tcW, "w:type");
|
|
8716
|
-
const size = attrMeasure(tcW, "w:w", type);
|
|
8732
|
+
const size = widthFiftiethsToPct(attrMeasure(tcW, "w:w"), type);
|
|
8717
8733
|
if (size !== void 0) opts.width = {
|
|
8718
8734
|
size,
|
|
8719
8735
|
...type ? { type } : {}
|
|
@@ -13603,6 +13619,6 @@ const webSettingsDesc = {
|
|
|
13603
13619
|
}
|
|
13604
13620
|
};
|
|
13605
13621
|
//#endregion
|
|
13606
|
-
export { PageBorderZOrder as $, stringifyCustomXmlShell as $t, StyleLevel as A,
|
|
13622
|
+
export { PageBorderZOrder as $, stringifyCustomXmlShell as $t, StyleLevel as A, TextVerticalType as An, sectionPageSizeDefaults as At, stringifyNumberingStyle as B, breakXml as Bn, NumberFormat as Bt, footnotesDesc as C, PositionalTabLeader as Cn, parseSdtBlock as Ct, selectTocEntryElements as D, TextBodyWrappingType as Dn, sectionPropertiesDesc as Dt, parseTocFieldInstruction as E, UnderlineType as En, parseSectionPropertiesEl as Et, extractStyleId as F, Media as Fn, createVerticalPosition as Ft, createHeaderFooterReference as G, AlignmentType as Gn, TextWrappingSide as Gt, stringifyTableStyle as H, TextboxTightWrapType as Hn, VerticalPositionAlign as Ht, parseStyleDefinitions as I, createTransformation as In, createHorizontalPosition as It, LineNumberRestartFormat as J, checkboxSymbolRunInner as Jt, SectionType as K, TextWrappingType as Kt, DefaultStylesFactory as L, HighlightColor as Ln, HorizontalPositionRelativeFrom as Lt, Styles as M, createBodyProperties as Mn, PageOrientation as Mt, buildNumberingCache as N, parseBodyProperties as Nn, PageNumberSeparator as Nt, SdtDateMappingType as O, TextHorzOverflowType as On, stringifySectionPropertiesXml as Ot, buildStyleCache as P, createImageData$1 as Pn, createPageNumberType as Pt, PageBorderOffsetFrom as Q, setBodyParseChild as Qt, stringifyCharacterStyle as R, TextEffect as Rn, VerticalPositionRelativeFrom as Rt, endnotesDesc as S, PositionalTabAlignment as Sn, stringifyTableOfContents as St, parseTocFieldFromElements as T, EmphasisMarkType as Tn, FontWrapper as Tt, HeaderFooterReferenceType as U, HeadingLevel as Un, createWrapThrough as Ut, stringifyParagraphStyle as V, TextAlignmentType as Vn, SpaceType as Vt, HeaderFooterType as W, LineRuleType as Wn, createWrapTight as Wt, createPageMargin as X, parseCustomXmlProperties as Xt, createLineNumberType as Y, customXmlBlockDesc as Yt, PageBorderDisplay as Z, sdtBlockDesc as Zt, glossaryDesc as _, ProofErrorType as _n, parseParagraph as _t, appPropertiesDesc as a, WidthType as an, LevelFormat as at, CharacterSet as b, parseFormFieldData as bn, stringifyDocumentXml as bt, relationshipsDesc as c, TABLE_BORDERS_NONE as cn, parseTablePropertiesEl as ct, withAltChunkOverrides as d, OverlapType as dn, tableDesc as dt, stringifySdtPr as en, DocumentGridType as et, withMediaDefaults as f, RelativeHorizontalPosition as fn, stringifyChildDispatch as ft, DocPartType as g, VerticalMergeType as gn, resetDrawingIdGen as gt, DocPartGallery as h, TextDirection as hn, drawingDesc as ht, webSettingsDesc as i, objectDesc as in, parseNumberingDefinitions as it, settingsDesc as j, VerticalAnchor as jn, PageTextDirectionType as jt, SdtLock as k, TextVertOverflowType as kn, sectionMarginDefaults as kt, buildContentTypesFromRegistry as l, BorderStyle as ln, parseTableRowPropertiesEl as lt, DocPartBehavior as m, TableAnchorType as mn, stringifyRunInline as mt, frameXml as n, subDocDesc as nn, DocumentAttributeNamespaces as nt, customPropertiesDesc as o, widthFiftiethsToPct as on, LevelSuffix as ot, commentsDesc as p, RelativeVerticalPosition as pn, stringifyParagraphInline as pt, createSectionType as q, altChunkDesc as qt, framesetXml as r, stringifyElement as rn, Numbering as rt, corePropertiesDesc as s, widthPctToFiftieths as sn, parseTableCellPropertiesEl as st, TargetScreenSize as t, stringifySdtShell as tn, createDocumentGrid as tt, contentTypesDesc as u, TableLayoutType as un, setTableParseChild as ut, bibliographyDesc as v, FormFieldTextType as vn, parseParagraphProperties as vt, parseToc as w, PositionalTabRelativeTo as wn, parseSdtProperties as wt, EditGroupType as x, RubyAlign as xn, replaceRelsWithPlaceholders as xt, fontTableDesc as y, createFormFieldData as yn, stringifyBodyChild as yt, stringifyConditionalTableStyle as z, PageNumber as zn, HorizontalPositionAlign as zt };
|
|
13607
13623
|
|
|
13608
|
-
//# sourceMappingURL=parts-
|
|
13624
|
+
//# sourceMappingURL=parts-7TLJ0TNR.mjs.map
|