@office-open/docx 0.3.0 → 0.3.1

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/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { n as __reExport, t as __exportAll } from "./_chunks/chunk-DmsbSTSH.mjs";
2
- import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, EMPTY_OBJECT, EmptyElement, Formatter, HpsMeasureElement, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, NextAttributeComponent, NumberValueElement, OnOffElement, Relationships, StringContainer, StringEnumValueElement, StringValueElement, TargetModeType, XmlAttributeComponent, XmlAttributeComponent as XmlAttributeComponent$1, XmlComponent, chartAttr, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertToXmlComponent, getImageType, hashedId, hpsMeasureObj, numberValObj, onOffObj, parseCoreProperties, parseRels, readXmlFromZip, stringEnumValObj, stringValObj, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueNumericIdCreator as uniqueNumericIdCreator$1, uniqueUuid, unzipToMap, wrapEl } from "@office-open/core";
2
+ import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, EMPTY_OBJECT, EmptyElement, Formatter, HpsMeasureElement, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, NextAttributeComponent, NumberValueElement, OnOffElement, RawPassthrough, Relationships, StringContainer, StringEnumValueElement, StringValueElement, TargetModeType, XmlAttributeComponent, XmlAttributeComponent as XmlAttributeComponent$1, XmlComponent, chartAttr, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertToXmlComponent, getImageType, hashedId, hpsMeasureObj, isRaw, numberValObj, onOffObj, parseCoreProperties, parseRels, readAllXmlParts, readXmlFromZip, stringEnumValObj, stringValObj, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueNumericIdCreator as uniqueNumericIdCreator$1, uniqueUuid, unzipToMap, wrapEl } from "@office-open/core";
3
3
  import { textToUint8Array, toUint8Array } from "undio";
4
4
  import { PresetGeometry, buildFill, createBlipFill, createCustomGeometry, createEffectDag, createEffectList, createOutline, createScene3D, createShape3D, extractBlipFillMedia } from "@office-open/core/drawingml";
5
5
  import { ChartCollection, ChartTitle, createChartType } from "@office-open/core/chart";
6
6
  import { COLOR_CATEGORIES, COLOR_CATEGORIES as COLOR_CATEGORIES$1, LAYOUT_CATEGORIES, LAYOUT_CATEGORIES as LAYOUT_CATEGORIES$1, STYLE_CATEGORIES, STYLE_CATEGORIES as STYLE_CATEGORIES$1, SmartArtCollection, createDataModel } from "@office-open/core/smartart";
7
- import { attr, attrNum, children, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
7
+ import { attr, attrNum, children, colorAttr, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
8
8
  import { Readable } from "stream";
9
9
  import { Zip, ZipDeflate, ZipPassThrough, strFromU8, unzipSync, zipSync } from "fflate";
10
10
  export * from "@office-open/core/values";
@@ -24130,24 +24130,201 @@ function createDocxParseContext(zip) {
24130
24130
  const hyperlinks = /* @__PURE__ */ new Map();
24131
24131
  const media = /* @__PURE__ */ new Map();
24132
24132
  const documentRels = /* @__PURE__ */ new Map();
24133
+ const mediaPaths = /* @__PURE__ */ new Set();
24133
24134
  const rels = parseRels(zip, "word/_rels/document.xml.rels");
24134
24135
  for (const rel of rels) {
24135
24136
  documentRels.set(rel.id, rel);
24136
24137
  if (rel.targetMode === "External" || rel.type.includes("hyperlink")) hyperlinks.set(rel.id, rel.target);
24137
24138
  }
24138
- for (const [path, data] of zip) if (path.startsWith("word/media/")) {
24139
- const fileName = path.split("/").pop() ?? path;
24140
- media.set(path, {
24141
- data: uint8ToBase64(data),
24142
- type: getImageType(fileName)
24143
- });
24144
- }
24139
+ for (const path of zip.keys()) if (path.startsWith("word/media/")) mediaPaths.add(path);
24145
24140
  return {
24146
24141
  zip,
24147
24142
  hyperlinks,
24148
24143
  media,
24149
- documentRels
24144
+ documentRels,
24145
+ mediaPaths
24146
+ };
24147
+ }
24148
+ function getMediaData(ctx, path) {
24149
+ let entry = ctx.media.get(path);
24150
+ if (entry) return entry;
24151
+ const raw = ctx.zip.get(path);
24152
+ if (!raw || !ctx.mediaPaths.has(path)) return void 0;
24153
+ const fileName = path.split("/").pop() ?? path;
24154
+ entry = {
24155
+ data: uint8ToBase64(raw),
24156
+ type: getImageType(fileName)
24150
24157
  };
24158
+ ctx.media.set(path, entry);
24159
+ return entry;
24160
+ }
24161
+ //#endregion
24162
+ //#region src/parse/numbering.ts
24163
+ function parseNumbering(zip) {
24164
+ const xml = readXmlFromZip(zip, "word/numbering.xml");
24165
+ if (!xml) return {
24166
+ abstractNums: [],
24167
+ nums: []
24168
+ };
24169
+ const abstractNums = [];
24170
+ const nums = [];
24171
+ for (const child of xml.elements ?? []) if (child.name === "w:abstractNum") {
24172
+ const id = attr(child, "w:abstractNumId");
24173
+ if (id !== void 0) abstractNums.push({
24174
+ id,
24175
+ levels: parseLevels(child)
24176
+ });
24177
+ } else if (child.name === "w:num") {
24178
+ const numId = attr(child, "w:numId");
24179
+ const abstractNumIdEl = findChild(child, "w:abstractNumId");
24180
+ const abstractNumId = abstractNumIdEl ? attr(abstractNumIdEl, "w:val") : void 0;
24181
+ if (numId !== void 0 && abstractNumId !== void 0) nums.push({
24182
+ numId,
24183
+ abstractNumId,
24184
+ levelOverrides: parseLevelOverrides(child)
24185
+ });
24186
+ }
24187
+ return {
24188
+ abstractNums,
24189
+ nums
24190
+ };
24191
+ }
24192
+ function parseLevels(abstractNum) {
24193
+ const levels = [];
24194
+ for (const child of abstractNum.elements ?? []) if (child.name === "w:lvl") {
24195
+ const level = parseLevel(child);
24196
+ if (level) levels.push(level);
24197
+ }
24198
+ return levels;
24199
+ }
24200
+ function parseLevel(lvl) {
24201
+ const result = { level: attrNum(lvl, "w:ilvl") ?? 0 };
24202
+ const numFmt = findChild(lvl, "w:numFmt");
24203
+ if (numFmt) {
24204
+ const val = attr(numFmt, "w:val");
24205
+ if (val) result.format = val;
24206
+ }
24207
+ const lvlText = findChild(lvl, "w:lvlText");
24208
+ if (lvlText) {
24209
+ const val = attr(lvlText, "w:val");
24210
+ if (val) result.text = val;
24211
+ }
24212
+ const lvlJc = findChild(lvl, "w:lvlJc");
24213
+ if (lvlJc) {
24214
+ const val = attr(lvlJc, "w:val");
24215
+ if (val) result.alignment = val;
24216
+ }
24217
+ const start = findChild(lvl, "w:start");
24218
+ if (start) {
24219
+ const val = attrNum(start, "w:val");
24220
+ if (val !== void 0) result.start = val;
24221
+ }
24222
+ const suff = findChild(lvl, "w:suff");
24223
+ if (suff) {
24224
+ const val = attr(suff, "w:val");
24225
+ if (val) result.suffix = val;
24226
+ }
24227
+ const isLgl = findChild(lvl, "w:isLgl");
24228
+ if (isLgl) {
24229
+ const val = attr(isLgl, "w:val");
24230
+ if (val === "1" || val === "true") result.isLegalNumberingStyle = true;
24231
+ }
24232
+ const pPr = findChild(lvl, "w:pPr");
24233
+ if (pPr) {
24234
+ const ind = findChild(pPr, "w:ind");
24235
+ if (ind) {
24236
+ const left = attrNum(ind, "w:left");
24237
+ const hanging = attrNum(ind, "w:hanging");
24238
+ if (left !== void 0 || hanging !== void 0) {
24239
+ if (!result.style) result.style = {};
24240
+ result.style.paragraph = {};
24241
+ if (left !== void 0) result.style.paragraph.indent = {
24242
+ ...result.style.paragraph.indent,
24243
+ left
24244
+ };
24245
+ if (hanging !== void 0) result.style.paragraph.indent = {
24246
+ ...result.style.paragraph.indent,
24247
+ hanging
24248
+ };
24249
+ }
24250
+ }
24251
+ }
24252
+ return result;
24253
+ }
24254
+ function parseLevelOverrides(num) {
24255
+ const overrides = [];
24256
+ for (const child of num.elements ?? []) if (child.name === "w:lvlOverride") {
24257
+ const ilvl = attrNum(child, "w:ilvl");
24258
+ const startOverride = findChild(child, "w:startOverride");
24259
+ const start = startOverride ? attrNum(startOverride, "w:val") : void 0;
24260
+ if (ilvl !== void 0) overrides.push({
24261
+ ilvl,
24262
+ ...start !== void 0 && { startOverride: start }
24263
+ });
24264
+ }
24265
+ return overrides.length > 0 ? overrides : void 0;
24266
+ }
24267
+ /**
24268
+ * Build numbering config from parsed data and remap paragraph references.
24269
+ * Only includes numIds that are actually used by paragraphs.
24270
+ */
24271
+ function buildNumberingConfig(data, sections) {
24272
+ if (data.abstractNums.length === 0) return [];
24273
+ const abstractMap = new Map(data.abstractNums.map((a) => [a.id, a]));
24274
+ const numToAbstract = new Map(data.nums.map((n) => [n.numId, n.abstractNumId]));
24275
+ const usedNumIds = /* @__PURE__ */ new Set();
24276
+ for (const section of sections) collectUsedNumIds(section.children, usedNumIds);
24277
+ if (usedNumIds.size === 0) return [];
24278
+ const config = [];
24279
+ const numIdToReference = /* @__PURE__ */ new Map();
24280
+ for (const numId of usedNumIds) {
24281
+ const abstractId = numToAbstract.get(numId);
24282
+ if (!abstractId) continue;
24283
+ const abstract = abstractMap.get(abstractId);
24284
+ if (!abstract) continue;
24285
+ const reference = `num-${numId}`;
24286
+ numIdToReference.set(numId, reference);
24287
+ const levels = abstract.levels.map((l) => ({
24288
+ ...l,
24289
+ style: l.style ? {
24290
+ ...l.style,
24291
+ paragraph: l.style.paragraph ? {
24292
+ ...l.style.paragraph,
24293
+ indent: { ...l.style.paragraph.indent }
24294
+ } : void 0
24295
+ } : void 0
24296
+ }));
24297
+ const num = data.nums.find((n) => n.numId === numId);
24298
+ if (num?.levelOverrides) for (const override of num.levelOverrides) {
24299
+ const level = levels.find((l) => l.level === override.ilvl);
24300
+ if (level && override.startOverride !== void 0) level.start = override.startOverride;
24301
+ }
24302
+ config.push({
24303
+ reference,
24304
+ levels
24305
+ });
24306
+ }
24307
+ for (const section of sections) remapNumberingReferences(section.children, numIdToReference);
24308
+ return config;
24309
+ }
24310
+ function collectUsedNumIds(children, used) {
24311
+ for (const child of children) {
24312
+ const c = child;
24313
+ if (c.$type === "paragraph" && c.numbering) {
24314
+ const n = c.numbering;
24315
+ if (n.reference) used.add(n.reference);
24316
+ }
24317
+ }
24318
+ }
24319
+ function remapNumberingReferences(children, numIdToReference) {
24320
+ for (const child of children) {
24321
+ const c = child;
24322
+ if (c.$type === "paragraph" && c.numbering) {
24323
+ const n = c.numbering;
24324
+ const newRef = numIdToReference.get(n.reference);
24325
+ if (newRef) n.reference = newRef;
24326
+ }
24327
+ }
24151
24328
  }
24152
24329
  //#endregion
24153
24330
  //#region src/parse/run.ts
@@ -24155,7 +24332,10 @@ function parseRun(run, ctx) {
24155
24332
  const rPr = findChild(run, "w:rPr");
24156
24333
  const br = findChild(run, "w:br");
24157
24334
  if (br) {
24158
- if (attr(br, "w:type") === "page") return { $type: "pageBreak" };
24335
+ const brType = attr(br, "w:type");
24336
+ if (brType === "page" || brType === void 0) return { $type: "pageBreak" };
24337
+ if (brType === "column") return { $type: "columnBreak" };
24338
+ if (brType === "line" || brType === "textWrapping") return { $type: "lineBreak" };
24159
24339
  }
24160
24340
  const drawing = findChild(run, "w:drawing") ?? findChild(run, "mc:AlternateContent");
24161
24341
  if (drawing) {
@@ -24168,14 +24348,20 @@ function parseRun(run, ctx) {
24168
24348
  if (image) return image;
24169
24349
  }
24170
24350
  if (findChild(run, "w:tab")) return { $type: "tab" };
24171
- if (findChild(run, "w:footnoteReference")) return;
24351
+ const footnoteRef = findChild(run, "w:footnoteReference");
24352
+ const endnoteRef = findChild(run, "w:endnoteReference");
24353
+ if (footnoteRef || endnoteRef) return {
24354
+ $raw: true,
24355
+ element: footnoteRef ?? endnoteRef
24356
+ };
24172
24357
  const t = findChild(run, "w:t");
24173
24358
  const delText = findChild(run, "w:delText");
24174
24359
  const text = textOf(t ?? delText);
24175
24360
  if (!text && !rPr) return void 0;
24176
24361
  const result = {
24177
24362
  $type: "textRun",
24178
- text
24363
+ text,
24364
+ ...delText && !t && { deletedText: true }
24179
24365
  };
24180
24366
  if (rPr) parseRunProperties(rPr, result);
24181
24367
  return result;
@@ -24191,10 +24377,20 @@ function parseRunProperties(rPr, out) {
24191
24377
  const val = attr(i, "w:val");
24192
24378
  out.italics = val !== "0" && val !== "false";
24193
24379
  }
24380
+ const bCs = findChild(rPr, "w:bCs");
24381
+ if (bCs) {
24382
+ const val = attr(bCs, "w:val");
24383
+ if (val !== "0" && val !== "false") out.boldCs = true;
24384
+ }
24385
+ const iCs = findChild(rPr, "w:iCs");
24386
+ if (iCs) {
24387
+ const val = attr(iCs, "w:val");
24388
+ if (val !== "0" && val !== "false") out.italicCs = true;
24389
+ }
24194
24390
  const u = findChild(rPr, "w:u");
24195
24391
  if (u) {
24196
24392
  const val = attr(u, "w:val");
24197
- const color = attr(u, "w:color");
24393
+ const color = colorAttr(u, "w:color");
24198
24394
  if (val && val !== "none" && val !== "false") {
24199
24395
  out.underline = { type: val };
24200
24396
  if (color) out.underline.color = color;
@@ -24231,15 +24427,31 @@ function parseRunProperties(rPr, out) {
24231
24427
  const val = attrNum(sz, "w:val");
24232
24428
  if (val !== void 0) out.size = val;
24233
24429
  }
24234
- const color = findChild(rPr, "w:color");
24235
- if (color) {
24236
- const val = attr(color, "w:val");
24430
+ const szCs = findChild(rPr, "w:szCs");
24431
+ if (szCs) {
24432
+ const val = attrNum(szCs, "w:val");
24433
+ if (val !== void 0) out.sizeCs = val;
24434
+ }
24435
+ const colorEl = findChild(rPr, "w:color");
24436
+ if (colorEl) {
24437
+ const val = colorAttr(colorEl, "w:val");
24237
24438
  if (val && val !== "auto") out.color = val;
24238
24439
  }
24239
24440
  const rFonts = findChild(rPr, "w:rFonts");
24240
24441
  if (rFonts) {
24241
24442
  const ascii = attr(rFonts, "w:ascii");
24242
- if (ascii) out.font = ascii;
24443
+ const hAnsi = attr(rFonts, "w:hAnsi");
24444
+ const eastAsia = attr(rFonts, "w:eastAsia");
24445
+ const cs = attr(rFonts, "w:cs");
24446
+ const hint = attr(rFonts, "w:hint");
24447
+ if (hAnsi || eastAsia || cs || hint) out.font = {
24448
+ ...ascii && { ascii },
24449
+ ...hAnsi && { hAnsi },
24450
+ ...eastAsia && { eastAsia },
24451
+ ...cs && { cs },
24452
+ ...hint && hint !== "default" && { hint }
24453
+ };
24454
+ else if (ascii) out.font = ascii;
24243
24455
  }
24244
24456
  const highlight = findChild(rPr, "w:highlight");
24245
24457
  if (highlight) {
@@ -24259,7 +24471,11 @@ function parseRunProperties(rPr, out) {
24259
24471
  const shd = findChild(rPr, "w:shd");
24260
24472
  if (shd) {
24261
24473
  const fill = attr(shd, "w:fill");
24262
- if (fill && fill !== "auto") out.shading = { fill };
24474
+ const val = attr(shd, "w:val");
24475
+ if (fill && fill !== "auto") out.shading = {
24476
+ fill,
24477
+ ...val && val !== "clear" && { type: val }
24478
+ };
24263
24479
  }
24264
24480
  const kern = findChild(rPr, "w:kern");
24265
24481
  if (kern) {
@@ -24297,6 +24513,11 @@ function parseRunProperties(rPr, out) {
24297
24513
  if (val !== "0" && val !== "false") out.vanish = true;
24298
24514
  }
24299
24515
  if (findChild(rPr, "w:noProof")) out.noProof = true;
24516
+ const lang = findChild(rPr, "w:lang");
24517
+ if (lang) {
24518
+ const val = attr(lang, "w:val");
24519
+ if (val) out.lang = val;
24520
+ }
24300
24521
  if (findChild(rPr, "w:oMath")) out.math = true;
24301
24522
  }
24302
24523
  function parseDrawingImage(drawing, ctx) {
@@ -24307,8 +24528,7 @@ function parseDrawingImage(drawing, ctx) {
24307
24528
  if (!embedId) return void 0;
24308
24529
  const rel = ctx.documentRels.get(embedId);
24309
24530
  if (!rel) return void 0;
24310
- const mediaPath = rel.target.startsWith("../") ? rel.target.replace("../", "word/") : `word/${rel.target}`;
24311
- const mediaEntry = ctx.media.get(mediaPath);
24531
+ const mediaEntry = getMediaData(ctx, rel.target.startsWith("../") ? rel.target.replace("../", "word/") : `word/${rel.target}`);
24312
24532
  if (!mediaEntry) return void 0;
24313
24533
  const extent = findDeep(drawing, "wp:extent")[0] ?? findDeep(drawing, "wp:inline")[0];
24314
24534
  const cx = extent ? attrNum(extent, "cx") : void 0;
@@ -24331,8 +24551,7 @@ function parsePictImage(pict, ctx) {
24331
24551
  if (!rid) return void 0;
24332
24552
  const rel = ctx.documentRels.get(rid);
24333
24553
  if (!rel) return void 0;
24334
- const mediaPath = rel.target.startsWith("../") ? rel.target.replace("../", "word/") : `word/${rel.target}`;
24335
- const mediaEntry = ctx.media.get(mediaPath);
24554
+ const mediaEntry = getMediaData(ctx, rel.target.startsWith("../") ? rel.target.replace("../", "word/") : `word/${rel.target}`);
24336
24555
  if (!mediaEntry) return void 0;
24337
24556
  return {
24338
24557
  $type: "imageRun",
@@ -24341,27 +24560,340 @@ function parsePictImage(pict, ctx) {
24341
24560
  };
24342
24561
  }
24343
24562
  //#endregion
24563
+ //#region src/parse/table.ts
24564
+ function parseTable(tbl, ctx) {
24565
+ const result = {
24566
+ $type: "table",
24567
+ rows: []
24568
+ };
24569
+ const tblPr = findChild(tbl, "w:tblPr");
24570
+ if (tblPr) parseTableProperties(tblPr, result);
24571
+ const tblGrid = children(tbl, "w:tblGrid")[0];
24572
+ if (tblGrid) {
24573
+ const gridCols = children(tblGrid, "w:gridCol");
24574
+ if (gridCols.length > 0) result.columnWidths = gridCols.map((col) => attrNum(col, "w:w") ?? 0);
24575
+ }
24576
+ const rows = children(tbl, "w:tr");
24577
+ for (const tr of rows) result.rows.push(parseTableRow(tr, ctx));
24578
+ calculateRowSpans(result);
24579
+ return result;
24580
+ }
24581
+ function parseTableProperties(tblPr, out) {
24582
+ const tblW = findChild(tblPr, "w:tblW");
24583
+ if (tblW) {
24584
+ const size = attrNum(tblW, "w:w");
24585
+ const type = attr(tblW, "w:type");
24586
+ if (size !== void 0) out.width = {
24587
+ size,
24588
+ type: type ?? "auto"
24589
+ };
24590
+ }
24591
+ const tblStyle = findChild(tblPr, "w:tblStyle");
24592
+ if (tblStyle) {
24593
+ const val = attr(tblStyle, "w:val");
24594
+ if (val) out.style = val;
24595
+ }
24596
+ const jc = findChild(tblPr, "w:jc");
24597
+ if (jc) {
24598
+ const val = attr(jc, "w:val");
24599
+ if (val) out.alignment = val;
24600
+ }
24601
+ const tblBorders = findChild(tblPr, "w:tblBorders");
24602
+ if (tblBorders) {
24603
+ const borders = {};
24604
+ for (const child of tblBorders.elements ?? []) if (child.name && child.name.startsWith("w:")) {
24605
+ const borderName = child.name.replace("w:", "");
24606
+ const val = String(attr(child, "w:val") ?? "");
24607
+ const sz = attrNum(child, "w:sz");
24608
+ const color = colorAttr(child, "w:color");
24609
+ const space = attrNum(child, "w:space");
24610
+ if (val && val !== "none" && val !== "nil") {
24611
+ const borderDef = { style: val };
24612
+ if (sz !== void 0) borderDef.size = sz;
24613
+ if (color) borderDef.color = color;
24614
+ if (space !== void 0) borderDef.space = space;
24615
+ borders[borderName] = borderDef;
24616
+ }
24617
+ }
24618
+ if (Object.keys(borders).length > 0) out.borders = borders;
24619
+ }
24620
+ const tblCellMar = findChild(tblPr, "w:tblCellMar");
24621
+ if (tblCellMar) {
24622
+ const margins = {};
24623
+ for (const child of tblCellMar.elements ?? []) if (child.name && child.name.startsWith("w:")) {
24624
+ const name = child.name.replace("w:", "");
24625
+ const w = attrNum(child, "w:w");
24626
+ const type = attr(child, "w:type");
24627
+ if (w !== void 0) margins[name] = {
24628
+ w,
24629
+ type: type ?? "dxa"
24630
+ };
24631
+ }
24632
+ if (Object.keys(margins).length > 0) out.cellMargins = margins;
24633
+ }
24634
+ const tblInd = findChild(tblPr, "w:tblInd");
24635
+ if (tblInd) {
24636
+ const w = attrNum(tblInd, "w:w");
24637
+ const type = attr(tblInd, "w:type");
24638
+ if (w !== void 0) out.indentation = {
24639
+ w,
24640
+ type: type ?? "dxa"
24641
+ };
24642
+ }
24643
+ const tblLayout = findChild(tblPr, "w:tblLayout");
24644
+ if (tblLayout) {
24645
+ const val = attr(tblLayout, "w:type");
24646
+ if (val) out.layout = val;
24647
+ }
24648
+ }
24649
+ function parseTableRow(tr, ctx) {
24650
+ const result = { cells: [] };
24651
+ const trPr = findChild(tr, "w:trPr");
24652
+ if (trPr) {
24653
+ const trHeight = findChild(trPr, "w:trHeight");
24654
+ if (trHeight) {
24655
+ const val = attrNum(trHeight, "w:val");
24656
+ const rule = attr(trHeight, "w:hRule");
24657
+ if (val !== void 0) result.height = {
24658
+ value: val,
24659
+ rule: rule ?? void 0
24660
+ };
24661
+ }
24662
+ if (findChild(trPr, "w:tblHeader")) result.isHeader = true;
24663
+ }
24664
+ for (const child of tr.elements ?? []) if (child.name === "w:tc") result.cells.push(parseTableCell(child, ctx));
24665
+ return result;
24666
+ }
24667
+ function parseTableCell(tc, ctx) {
24668
+ const result = { children: [] };
24669
+ const tcPr = findChild(tc, "w:tcPr");
24670
+ if (tcPr) {
24671
+ const gridSpan = findChild(tcPr, "w:gridSpan");
24672
+ if (gridSpan) {
24673
+ const val = attrNum(gridSpan, "w:val");
24674
+ if (val !== void 0 && val > 1) result.columnSpan = val;
24675
+ }
24676
+ const vMerge = findChild(tcPr, "w:vMerge");
24677
+ if (vMerge) if (attr(vMerge, "w:val") === "restart") result.rowSpan = 1;
24678
+ else result.rowSpan = 0;
24679
+ const tcW = findChild(tcPr, "w:tcW");
24680
+ if (tcW) {
24681
+ const size = attrNum(tcW, "w:w");
24682
+ const type = attr(tcW, "w:type");
24683
+ if (size !== void 0) result.width = {
24684
+ size,
24685
+ type: type ?? "auto"
24686
+ };
24687
+ }
24688
+ const shd = findChild(tcPr, "w:shd");
24689
+ if (shd) {
24690
+ const fill = attr(shd, "w:fill");
24691
+ const val = attr(shd, "w:val");
24692
+ if (fill && fill !== "auto") result.shading = {
24693
+ fill,
24694
+ ...val && val !== "clear" && { type: val }
24695
+ };
24696
+ }
24697
+ const vAlign = findChild(tcPr, "w:vAlign");
24698
+ if (vAlign) {
24699
+ const val = attr(vAlign, "w:val");
24700
+ if (val) result.verticalAlign = val;
24701
+ }
24702
+ if (findChild(tcPr, "w:noWrap")) result.noWrap = true;
24703
+ const textDirection = findChild(tcPr, "w:textDirection");
24704
+ if (textDirection) {
24705
+ const val = attr(textDirection, "w:val");
24706
+ if (val) result.textDirection = val;
24707
+ }
24708
+ const tcMar = findChild(tcPr, "w:tcMar");
24709
+ if (tcMar) {
24710
+ const margins = {};
24711
+ for (const child of tcMar.elements ?? []) if (child.name && child.name.startsWith("w:")) {
24712
+ const name = child.name.replace("w:", "");
24713
+ const w = attrNum(child, "w:w");
24714
+ const type = attr(child, "w:type");
24715
+ if (w !== void 0) margins[name] = {
24716
+ w,
24717
+ type: type ?? "dxa"
24718
+ };
24719
+ }
24720
+ if (Object.keys(margins).length > 0) result.margins = margins;
24721
+ }
24722
+ const tcBorders = findChild(tcPr, "w:tcBorders");
24723
+ if (tcBorders) {
24724
+ const borders = {};
24725
+ for (const child of tcBorders.elements ?? []) if (child.name && child.name.startsWith("w:")) {
24726
+ const borderName = child.name.replace("w:", "");
24727
+ const val = String(attr(child, "w:val") ?? "");
24728
+ const sz = attrNum(child, "w:sz");
24729
+ const color = colorAttr(child, "w:color");
24730
+ const space = attrNum(child, "w:space");
24731
+ if (val && val !== "none" && val !== "nil") {
24732
+ const borderDef = { style: val };
24733
+ if (sz !== void 0) borderDef.size = sz;
24734
+ if (color) borderDef.color = color;
24735
+ if (space !== void 0) borderDef.space = space;
24736
+ borders[borderName] = borderDef;
24737
+ }
24738
+ }
24739
+ if (Object.keys(borders).length > 0) result.borders = borders;
24740
+ }
24741
+ }
24742
+ for (const child of tc.elements ?? []) if (child.name === "w:p") result.children.push(parseParagraph(child, ctx));
24743
+ else if (child.name === "w:tcPr") {} else if (child.name === "w:sdt") {
24744
+ const sdt = parseSdtContent(child, ctx);
24745
+ if (sdt) result.children.push(sdt);
24746
+ } else if (child.name === "w:tbl") result.children.push({
24747
+ $raw: true,
24748
+ element: child
24749
+ });
24750
+ else result.children.push({
24751
+ $raw: true,
24752
+ element: child
24753
+ });
24754
+ return result;
24755
+ }
24756
+ /** Post-process: calculate actual rowSpan values from vMerge patterns */
24757
+ function calculateRowSpans(table) {
24758
+ const mergeCounts = [];
24759
+ for (const row of table.rows) {
24760
+ let colIdx = 0;
24761
+ for (const cell of row.cells) {
24762
+ if (cell.rowSpan === 1) mergeCounts[colIdx] = 1;
24763
+ else if (cell.rowSpan === 0 || cell.rowSpan === void 0) {
24764
+ if (mergeCounts[colIdx] !== void 0) mergeCounts[colIdx]++;
24765
+ }
24766
+ const span = cell.columnSpan ?? 1;
24767
+ for (let i = 1; i < span; i++) {
24768
+ colIdx++;
24769
+ mergeCounts[colIdx] = 0;
24770
+ }
24771
+ colIdx++;
24772
+ }
24773
+ }
24774
+ for (const row of table.rows) {
24775
+ let colIdx = 0;
24776
+ for (const cell of row.cells) {
24777
+ if (cell.rowSpan === 1 && mergeCounts[colIdx] !== void 0) cell.rowSpan = mergeCounts[colIdx];
24778
+ else if (cell.rowSpan === 0) cell.rowSpan = void 0;
24779
+ const span = cell.columnSpan ?? 1;
24780
+ colIdx += span;
24781
+ }
24782
+ }
24783
+ }
24784
+ //#endregion
24785
+ //#region src/parse/sdt.ts
24786
+ function parseSdtPr(sdt) {
24787
+ return findChild(sdt, "w:sdtPr");
24788
+ }
24789
+ /** Parse block-level SDT (w:sdt in body or table cell) */
24790
+ function parseSdtContent(sdt, ctx) {
24791
+ const sdtPr = parseSdtPr(sdt);
24792
+ const sdtContent = findChild(sdt, "w:sdtContent");
24793
+ if (!sdtContent) return sdtPr ? {
24794
+ $type: "sdt",
24795
+ sdtPr
24796
+ } : void 0;
24797
+ const content = [];
24798
+ for (const child of sdtContent.elements ?? []) if (child.name === "w:p") content.push(parseParagraph(child, ctx));
24799
+ else if (child.name === "w:tbl") content.push(parseTable(child, ctx));
24800
+ else if (child.name === "w:sdt") {
24801
+ const nested = parseSdtContent(child, ctx);
24802
+ if (nested) content.push(nested);
24803
+ }
24804
+ const result = { $type: "sdt" };
24805
+ if (sdtPr) result.sdtPr = sdtPr;
24806
+ if (content.length > 0) result.content = content;
24807
+ return result;
24808
+ }
24809
+ /** Parse inline-level SDT (w:sdt inside w:p) */
24810
+ function parseSdtRun(sdt, ctx) {
24811
+ const sdtPr = parseSdtPr(sdt);
24812
+ const sdtContent = findChild(sdt, "w:sdtContent");
24813
+ if (!sdtContent) return sdtPr ? {
24814
+ $type: "sdtRun",
24815
+ sdtPr
24816
+ } : void 0;
24817
+ const content = [];
24818
+ for (const child of sdtContent.elements ?? []) if (child.name === "w:r") {
24819
+ const run = parseRun(child, ctx);
24820
+ if (run) content.push(run);
24821
+ } else if (child.name === "w:sdt") {
24822
+ const nested = parseSdtRun(child, ctx);
24823
+ if (nested) content.push(nested);
24824
+ }
24825
+ const result = { $type: "sdtRun" };
24826
+ if (sdtPr) result.sdtPr = sdtPr;
24827
+ if (content.length > 0) result.content = content;
24828
+ return result;
24829
+ }
24830
+ //#endregion
24344
24831
  //#region src/parse/paragraph.ts
24345
24832
  function parseParagraph(p, ctx) {
24346
24833
  const result = { $type: "paragraph" };
24347
24834
  const pPr = findChild(p, "w:pPr");
24348
24835
  if (pPr) parseParagraphProperties(pPr, result);
24349
24836
  const children = [];
24350
- for (const child of p.elements ?? []) if (child.name === "w:r") {
24351
- const run = parseRun(child, ctx);
24352
- if (run) children.push(run);
24353
- } else if (child.name === "w:hyperlink") {
24354
- const hyperlink = parseHyperlink(child, ctx);
24355
- if (hyperlink) children.push(hyperlink);
24356
- } else if (child.name === "w:bookmarkStart") {
24357
- const name = attr(child, "w:name");
24358
- if (name) children.push({
24359
- $type: "bookmark",
24360
- name
24837
+ const elements = p.elements ?? [];
24838
+ let i = 0;
24839
+ while (i < elements.length) {
24840
+ const child = elements[i];
24841
+ if (child.name === "w:r") {
24842
+ const fldChar = findChild(child, "w:fldChar");
24843
+ if (fldChar) {
24844
+ const fldCharType = attr(fldChar, "w:fldCharType");
24845
+ if (fldCharType === "begin") {
24846
+ const field = collectField(elements, i, ctx);
24847
+ if (field) children.push(field);
24848
+ while (i < elements.length) {
24849
+ const next = elements[i];
24850
+ if (next.name === "w:r") {
24851
+ const fc = findChild(next, "w:fldChar");
24852
+ if (fc && attr(fc, "w:fldCharType") === "end") {
24853
+ i++;
24854
+ break;
24855
+ }
24856
+ }
24857
+ i++;
24858
+ }
24859
+ continue;
24860
+ }
24861
+ if (fldCharType === "separate" || fldCharType === "end") {
24862
+ i++;
24863
+ continue;
24864
+ }
24865
+ }
24866
+ const run = parseRun(child, ctx);
24867
+ if (run) children.push(run);
24868
+ } else if (child.name === "w:hyperlink") {
24869
+ const hyperlink = parseHyperlink(child, ctx);
24870
+ if (hyperlink) children.push(hyperlink);
24871
+ } else if (child.name === "w:bookmarkStart") {
24872
+ const name = attr(child, "w:name");
24873
+ if (name) children.push({
24874
+ $type: "bookmark",
24875
+ name
24876
+ });
24877
+ } else if (child.name === "w:bookmarkEnd") {} else if (child.name === "w:sdt") {
24878
+ const sdt = parseSdtRun(child, ctx);
24879
+ if (sdt) children.push(sdt);
24880
+ else children.push({
24881
+ $raw: true,
24882
+ element: child
24883
+ });
24884
+ } else if (child.name === "w:oMath" || child.name === "w:oMathPara") children.push({
24885
+ $type: "math",
24886
+ element: child
24887
+ });
24888
+ else if (child.name === "w:pPr") {} else children.push({
24889
+ $raw: true,
24890
+ element: child
24361
24891
  });
24892
+ i++;
24362
24893
  }
24363
- if (children.length === 1 && children[0].$type === "textRun") {
24364
- const textRun = children[0];
24894
+ const first = children[0];
24895
+ if (children.length === 1 && !isRaw(first) && first.$type === "textRun") {
24896
+ const textRun = first;
24365
24897
  if (!Object.keys(textRun).some((k) => k !== "$type" && k !== "text") && textRun.text !== void 0) result.text = textRun.text;
24366
24898
  else result.children = children;
24367
24899
  } else if (children.length > 0) result.children = children;
@@ -24449,16 +24981,115 @@ function parseParagraphProperties(pPr, out) {
24449
24981
  const shd = findChild(pPr, "w:shd");
24450
24982
  if (shd) {
24451
24983
  const fill = attr(shd, "w:fill");
24452
- if (fill && fill !== "auto") out.shading = { fill };
24984
+ const val = attr(shd, "w:val");
24985
+ if (fill && fill !== "auto") out.shading = {
24986
+ fill,
24987
+ ...val && val !== "clear" && { type: val }
24988
+ };
24453
24989
  }
24454
24990
  const pBdr = findChild(pPr, "w:pBdr");
24455
24991
  if (pBdr) {
24456
- const bottom = findChild(pBdr, "w:bottom");
24457
- if (bottom) {
24458
- const val = attr(bottom, "w:val");
24459
- if (val && val !== "none" && val !== "nil") out.thematicBreak = true;
24992
+ const borderSides = [
24993
+ "top",
24994
+ "bottom",
24995
+ "left",
24996
+ "right",
24997
+ "between"
24998
+ ];
24999
+ const borders = {};
25000
+ let hasNonNoneBorder = false;
25001
+ for (const side of borderSides) {
25002
+ const borderEl = findChild(pBdr, `w:${side}`);
25003
+ if (borderEl && borderEl.attributes && Object.keys(borderEl.attributes).length > 0) {
25004
+ const val = String(attr(borderEl, "w:val") ?? "");
25005
+ const sz = attrNum(borderEl, "w:sz");
25006
+ const color = colorAttr(borderEl, "w:color");
25007
+ const space = attrNum(borderEl, "w:space");
25008
+ if (val && val !== "none" && val !== "nil") {
25009
+ hasNonNoneBorder = true;
25010
+ const borderDef = { style: val };
25011
+ if (sz !== void 0) borderDef.size = sz;
25012
+ if (color) borderDef.color = color;
25013
+ if (space !== void 0) borderDef.space = space;
25014
+ borders[side] = borderDef;
25015
+ }
25016
+ }
25017
+ }
25018
+ if (Object.keys(borders).length > 0) out.border = borders;
25019
+ if (hasNonNoneBorder) out.thematicBreak = true;
25020
+ }
25021
+ const tabs = findChild(pPr, "w:tabs");
25022
+ if (tabs) {
25023
+ const tabList = [];
25024
+ for (const tab of tabs.elements ?? []) if (tab.name === "w:tab") {
25025
+ const pos = attrNum(tab, "w:pos");
25026
+ const align = attr(tab, "w:val");
25027
+ const leader = attr(tab, "w:leader");
25028
+ if (pos !== void 0) tabList.push({
25029
+ pos,
25030
+ ...align && align !== "left" && { align },
25031
+ ...leader && leader !== "none" && { leader }
25032
+ });
25033
+ }
25034
+ if (tabList.length > 0) out.tabs = tabList;
25035
+ }
25036
+ const suppressLineNumbers = findChild(pPr, "w:suppressLineNumbers");
25037
+ if (suppressLineNumbers) {
25038
+ const val = attr(suppressLineNumbers, "w:val");
25039
+ if (val === void 0 || val !== "0" && val !== "false") out.suppressLineNumbers = true;
25040
+ }
25041
+ const contextualSpacing = findChild(pPr, "w:contextualSpacing");
25042
+ if (contextualSpacing) {
25043
+ const val = attr(contextualSpacing, "w:val");
25044
+ if (val === void 0 || val !== "0" && val !== "false") out.contextualSpacing = true;
25045
+ }
25046
+ const mirrorIndents = findChild(pPr, "w:mirrorIndents");
25047
+ if (mirrorIndents) {
25048
+ const val = attr(mirrorIndents, "w:val");
25049
+ if (val === void 0 || val !== "0" && val !== "false") out.mirrorIndents = true;
25050
+ }
25051
+ }
25052
+ /** Collect field code (begin → separate → end) into a FieldJson */
25053
+ function collectField(elements, startIndex, ctx) {
25054
+ let instruction = "";
25055
+ let locked = false;
25056
+ let dirty = false;
25057
+ const fieldChildren = [];
25058
+ let pastSeparate = false;
25059
+ for (let i = startIndex + 1; i < elements.length; i++) {
25060
+ const el = elements[i];
25061
+ if (el.name !== "w:r") continue;
25062
+ const fldChar = findChild(el, "w:fldChar");
25063
+ if (fldChar) {
25064
+ const type = attr(fldChar, "w:fldCharType");
25065
+ if (type === "end") break;
25066
+ if (type === "separate") {
25067
+ pastSeparate = true;
25068
+ continue;
25069
+ }
25070
+ }
25071
+ if (fldChar) {
25072
+ const fldLock = findChild(el, "w:fldChar");
25073
+ if (fldLock) {
25074
+ if (attr(fldLock, "w:fldLock") === "true") locked = true;
25075
+ if (attr(fldLock, "w:dirty") === "true") dirty = true;
25076
+ }
25077
+ continue;
25078
+ }
25079
+ if (!pastSeparate) {
25080
+ const instrText = findChild(el, "w:instrText");
25081
+ if (instrText) instruction += textOf(instrText);
25082
+ } else {
25083
+ const run = parseRun(el, ctx);
25084
+ if (run) fieldChildren.push(run);
24460
25085
  }
24461
25086
  }
25087
+ const field = { $type: "field" };
25088
+ if (instruction) field.instruction = instruction;
25089
+ if (locked) field.locked = true;
25090
+ if (dirty) field.dirty = true;
25091
+ if (fieldChildren.length > 0) field.children = fieldChildren;
25092
+ return field;
24462
25093
  }
24463
25094
  function parseHyperlink(hl, ctx) {
24464
25095
  const rid = attr(hl, "r:id");
@@ -24591,9 +25222,9 @@ function parseSectionProperties(sectPr) {
24591
25222
  const borders = {};
24592
25223
  for (const border of pgBorders.elements ?? []) if (border.name?.startsWith("w:")) {
24593
25224
  const borderName = border.name?.replace("w:", "") ?? "";
24594
- const val = attr(border, "w:val");
25225
+ const val = String(attr(border, "w:val") ?? "");
24595
25226
  const sz = attrNum(border, "w:sz");
24596
- const color = attr(border, "w:color");
25227
+ const color = colorAttr(border, "w:color");
24597
25228
  if (val && val !== "none" && val !== "nil") {
24598
25229
  const borderDef = { style: val };
24599
25230
  if (sz !== void 0) borderDef.size = sz;
@@ -24609,92 +25240,116 @@ function parseSectionProperties(sectPr) {
24609
25240
  return Object.keys(props).length > 0 ? props : void 0;
24610
25241
  }
24611
25242
  //#endregion
24612
- //#region src/parse/table.ts
24613
- function parseTable(tbl, ctx) {
24614
- const result = {
24615
- $type: "table",
24616
- rows: []
24617
- };
24618
- const tblPr = findChild(tbl, "w:tblPr");
24619
- if (tblPr) parseTableProperties(tblPr, result);
24620
- const rows = children(tbl, "w:tr");
24621
- for (const tr of rows) result.rows.push(parseTableRow(tr, ctx));
24622
- return result;
24623
- }
24624
- function parseTableProperties(tblPr, out) {
24625
- const tblW = findChild(tblPr, "w:tblW");
24626
- if (tblW) {
24627
- const size = attrNum(tblW, "w:w");
24628
- const type = attr(tblW, "w:type");
24629
- if (size !== void 0) out.width = {
24630
- size,
24631
- type: type ?? "auto"
24632
- };
25243
+ //#region src/parse/structural.ts
25244
+ /**
25245
+ * Parse footnotes.xml into FootnoteEntry[].
25246
+ */
25247
+ function parseFootnotes(zip) {
25248
+ const xml = readXmlFromZip(zip, "word/footnotes.xml");
25249
+ if (!xml) return [];
25250
+ const entries = [];
25251
+ for (const child of xml.elements ?? []) if (child.name === "w:footnote") {
25252
+ const id = attr(child, "w:id");
25253
+ const type = getFootnoteType(child);
25254
+ const children = parseNoteContent(child, zip, "footnote");
25255
+ entries.push({
25256
+ id: id ?? "",
25257
+ ...type && { type },
25258
+ ...children && { children }
25259
+ });
24633
25260
  }
24634
- const tblStyle = findChild(tblPr, "w:tblStyle");
24635
- if (tblStyle) {
24636
- const val = attr(tblStyle, "w:val");
24637
- if (val) out.style = val;
25261
+ return entries;
25262
+ }
25263
+ /**
25264
+ * Parse endnotes.xml into FootnoteEntry[].
25265
+ */
25266
+ function parseEndnotes(zip) {
25267
+ const xml = readXmlFromZip(zip, "word/endnotes.xml");
25268
+ if (!xml) return [];
25269
+ const entries = [];
25270
+ for (const child of xml.elements ?? []) if (child.name === "w:endnote") {
25271
+ const id = attr(child, "w:id");
25272
+ const type = getFootnoteType(child);
25273
+ const children = parseNoteContent(child, zip, "endnote");
25274
+ entries.push({
25275
+ id: id ?? "",
25276
+ ...type && { type },
25277
+ ...children && { children }
25278
+ });
24638
25279
  }
24639
- const jc = findChild(tblPr, "w:jc");
24640
- if (jc) {
24641
- const val = attr(jc, "w:val");
24642
- if (val) out.alignment = val;
25280
+ return entries;
25281
+ }
25282
+ /**
25283
+ * Parse comments.xml into CommentEntry[].
25284
+ */
25285
+ function parseComments(zip) {
25286
+ const xml = readXmlFromZip(zip, "word/comments.xml");
25287
+ if (!xml) return [];
25288
+ const entries = [];
25289
+ for (const child of xml.elements ?? []) if (child.name === "w:comment") {
25290
+ const id = attr(child, "w:id");
25291
+ const author = attr(child, "w:author");
25292
+ const date = attr(child, "w:date");
25293
+ const initials = attr(child, "w:initials");
25294
+ const children = [];
25295
+ for (const p of child.elements ?? []) if (p.name === "w:p") children.push(parseParagraph(p, createNoteContext(zip)));
25296
+ entries.push({
25297
+ id: id ?? "",
25298
+ ...author && { author },
25299
+ ...date && { date },
25300
+ ...initials && { initials },
25301
+ ...children.length > 0 && { children }
25302
+ });
24643
25303
  }
25304
+ return entries;
24644
25305
  }
24645
- function parseTableRow(tr, ctx) {
24646
- const cells = [];
24647
- for (const child of tr.elements ?? []) if (child.name === "w:tc") cells.push(parseTableCell(child, ctx));
24648
- return { cells };
25306
+ function getFootnoteType(note) {
25307
+ const type = attr(note, "w:type");
25308
+ if (type === "separator") return "separator";
25309
+ if (type === "continuationSeparator") return "continuationSeparator";
24649
25310
  }
24650
- function parseTableCell(tc, ctx) {
24651
- const result = { children: [] };
24652
- const tcPr = findChild(tc, "w:tcPr");
24653
- if (tcPr) {
24654
- const gridSpan = findChild(tcPr, "w:gridSpan");
24655
- if (gridSpan) {
24656
- const val = attrNum(gridSpan, "w:val");
24657
- if (val !== void 0 && val > 1) result.columnSpan = val;
24658
- }
24659
- const vMerge = findChild(tcPr, "w:vMerge");
24660
- if (vMerge) {
24661
- if (attr(vMerge, "w:val") === "restart") {}
24662
- }
24663
- const tcW = findChild(tcPr, "w:tcW");
24664
- if (tcW) {
24665
- const size = attrNum(tcW, "w:w");
24666
- const type = attr(tcW, "w:type");
24667
- if (size !== void 0) result.width = {
24668
- size,
24669
- type: type ?? "auto"
24670
- };
24671
- }
24672
- const shd = findChild(tcPr, "w:shd");
24673
- if (shd) {
24674
- const fill = attr(shd, "w:fill");
24675
- if (fill && fill !== "auto") result.shading = { fill };
24676
- }
24677
- const vAlign = findChild(tcPr, "w:vAlign");
24678
- if (vAlign) {
24679
- const val = attr(vAlign, "w:val");
24680
- if (val) result.verticalAlign = val;
24681
- }
24682
- }
24683
- for (const child of tc.elements ?? []) if (child.name === "w:p") result.children.push(parseParagraph(child, ctx));
24684
- return result;
25311
+ function parseNoteContent(note, zip, _partType) {
25312
+ const ctx = createNoteContext(zip);
25313
+ const children = [];
25314
+ for (const child of note.elements ?? []) if (child.name === "w:p") children.push(parseParagraph(child, ctx));
25315
+ return children;
25316
+ }
25317
+ /** Create a minimal parse context for note parsing (no hyperlinks/media) */
25318
+ function createNoteContext(zip) {
25319
+ return {
25320
+ zip,
25321
+ hyperlinks: /* @__PURE__ */ new Map(),
25322
+ media: /* @__PURE__ */ new Map(),
25323
+ documentRels: /* @__PURE__ */ new Map(),
25324
+ mediaPaths: /* @__PURE__ */ new Set()
25325
+ };
24685
25326
  }
24686
25327
  //#endregion
24687
25328
  //#region src/parse/document.ts
24688
- async function parseDocx(data) {
25329
+ async function parseDocx(data, options) {
24689
25330
  const zip = unzipToMap(data);
24690
25331
  const ctx = createDocxParseContext(zip);
25332
+ const includeRawParts = options?.includeRawParts !== false;
24691
25333
  const coreProps = parseCoreProperties(zip);
24692
25334
  const documentXml = readXmlFromZip(zip, "word/document.xml");
24693
25335
  if (!documentXml) throw new Error("Invalid DOCX file: missing word/document.xml");
24694
25336
  const body = findChild(documentXml, "w:body");
24695
25337
  if (!body) throw new Error("Invalid DOCX file: missing w:body element");
25338
+ const sections = parseBodySections(body, ctx);
25339
+ resolveHeadersFooters(sections, ctx);
25340
+ const numberingConfig = buildNumberingConfig(parseNumbering(zip), sections);
25341
+ const footnotes = parseFootnotes(zip);
25342
+ const endnotes = parseEndnotes(zip);
25343
+ const comments = parseComments(zip);
25344
+ let $parts;
25345
+ if (includeRawParts) $parts = readAllXmlParts(zip, { skipPaths: ["word/document.xml"] });
24696
25346
  return {
24697
- sections: parseBodySections(body, ctx),
25347
+ sections,
25348
+ ...$parts && { $parts },
25349
+ ...numberingConfig.length > 0 && { numbering: numberingConfig },
25350
+ ...footnotes.length > 0 && { footnotes },
25351
+ ...endnotes.length > 0 && { endnotes },
25352
+ ...comments.length > 0 && { comments },
24698
25353
  ...coreProps.title && { title: coreProps.title },
24699
25354
  ...coreProps.subject && { subject: coreProps.subject },
24700
25355
  ...coreProps.creator && { creator: coreProps.creator },
@@ -24726,12 +25381,228 @@ function parseBodySections(body, ctx) {
24726
25381
  }
24727
25382
  currentChildren.push(parseParagraph(element, ctx));
24728
25383
  } else if (element.name === "w:tbl") currentChildren.push(parseTable(element, ctx));
25384
+ else if (element.name === "w:sdt") {
25385
+ const sdt = parseSdtContent(element, ctx);
25386
+ if (sdt) currentChildren.push(sdt);
25387
+ else currentChildren.push({
25388
+ $raw: true,
25389
+ element
25390
+ });
25391
+ } else if (element.name === "w:oMath" || element.name === "w:oMathPara") currentChildren.push({
25392
+ $type: "math",
25393
+ element
25394
+ });
25395
+ else currentChildren.push({
25396
+ $raw: true,
25397
+ element
25398
+ });
24729
25399
  sections.push({
24730
25400
  properties: finalSectPr ? parseSectionProperties(finalSectPr) : void 0,
24731
25401
  children: currentChildren
24732
25402
  });
24733
25403
  return sections;
24734
25404
  }
25405
+ /** Resolve header/footer reference IDs to actual paragraph content */
25406
+ function resolveHeadersFooters(sections, ctx) {
25407
+ for (const section of sections) {
25408
+ const props = section.properties;
25409
+ if (!props) continue;
25410
+ const headerRefs = props.headerRefs;
25411
+ const footerRefs = props.footerRefs;
25412
+ if (headerRefs) {
25413
+ section.headers = {};
25414
+ for (const [type, rId] of Object.entries(headerRefs)) {
25415
+ const content = parseHeaderFooterContent(rId, ctx);
25416
+ if (content) section.headers[type] = { children: content };
25417
+ }
25418
+ }
25419
+ if (footerRefs) {
25420
+ section.footers = {};
25421
+ for (const [type, rId] of Object.entries(footerRefs)) {
25422
+ const content = parseHeaderFooterContent(rId, ctx);
25423
+ if (content) section.footers[type] = { children: content };
25424
+ }
25425
+ }
25426
+ }
25427
+ }
25428
+ function parseHeaderFooterContent(rId, ctx) {
25429
+ const rel = ctx.documentRels.get(rId);
25430
+ if (!rel) return void 0;
25431
+ const path = rel.target.startsWith("../") ? rel.target.replace("../", "word/") : `word/${rel.target}`;
25432
+ const xml = readXmlFromZip(ctx.zip, path);
25433
+ if (!xml) return void 0;
25434
+ const children = [];
25435
+ for (const child of xml.elements ?? []) if (child.name === "w:p") children.push(parseParagraph(child, ctx));
25436
+ else if (child.name === "w:tbl") children.push(parseTable(child, ctx));
25437
+ return children.length > 0 ? children : void 0;
25438
+ }
25439
+ //#endregion
25440
+ //#region src/parse/convert.ts
25441
+ /**
25442
+ * Convert parsed section children to constructor-ready FileChild[].
25443
+ */
25444
+ function toSectionChildren(children) {
25445
+ return children.map(convertFileChild);
25446
+ }
25447
+ /**
25448
+ * Convert parsed paragraph children to constructor-ready ParagraphChild[].
25449
+ */
25450
+ function toParagraphChildren(children) {
25451
+ return children.map(convertParagraphChild);
25452
+ }
25453
+ /**
25454
+ * Convert parsed DocxDocumentJson to constructor-ready Document options.
25455
+ * Handles numbering, headers/footers, and all section properties.
25456
+ */
25457
+ function toDocumentOptions(json) {
25458
+ return {
25459
+ ...json.title && { title: json.title },
25460
+ ...json.creator && { creator: json.creator },
25461
+ ...json.subject && { subject: json.subject },
25462
+ ...json.description && { description: json.description },
25463
+ ...json.keywords && { keywords: json.keywords },
25464
+ ...json.lastModifiedBy && { lastModifiedBy: json.lastModifiedBy },
25465
+ ...json.revision && { revision: json.revision },
25466
+ ...json.numbering && json.numbering.length > 0 && { numbering: { config: json.numbering } },
25467
+ sections: json.sections.map(convertSection)
25468
+ };
25469
+ }
25470
+ function convertSection(section) {
25471
+ const props = { ...section.properties };
25472
+ delete props.headerRefs;
25473
+ delete props.footerRefs;
25474
+ const result = {
25475
+ properties: props,
25476
+ children: toSectionChildren(section.children)
25477
+ };
25478
+ if (section.headers) {
25479
+ const headers = {};
25480
+ for (const [type, content] of Object.entries(section.headers)) headers[type] = new Header({ children: toSectionChildren(content.children) });
25481
+ result.headers = headers;
25482
+ }
25483
+ if (section.footers) {
25484
+ const footers = {};
25485
+ for (const [type, content] of Object.entries(section.footers)) footers[type] = new Footer({ children: toSectionChildren(content.children) });
25486
+ result.footers = footers;
25487
+ }
25488
+ return result;
25489
+ }
25490
+ function convertFileChild(child) {
25491
+ if (isRaw(child)) return new RawPassthrough(child.element);
25492
+ switch (child.$type) {
25493
+ case "paragraph": return convertParagraph(child);
25494
+ case "table": return convertTable(child);
25495
+ case "imageRun": return convertImageRun(child);
25496
+ case "externalHyperlink": return convertExternalHyperlink(child);
25497
+ case "pageBreak": return new PageBreak();
25498
+ case "sdt": return convertSdt(child);
25499
+ case "math": return new RawPassthrough(child.element);
25500
+ default: return new RawPassthrough(child.element);
25501
+ }
25502
+ }
25503
+ function convertParagraphChild(child) {
25504
+ if (isRaw(child)) return new RawPassthrough(child.element);
25505
+ switch (child.$type) {
25506
+ case "textRun": return convertRun(child);
25507
+ case "imageRun": return convertImageRun(child);
25508
+ case "externalHyperlink": return convertExternalHyperlink(child);
25509
+ case "pageBreak": return new PageBreak();
25510
+ case "lineBreak": return new ColumnBreak();
25511
+ case "columnBreak": return new ColumnBreak();
25512
+ case "tab": return new Tab();
25513
+ case "bookmark": return new RawPassthrough(child.element);
25514
+ case "sdtRun": return convertSdtRun(child);
25515
+ case "math": return new RawPassthrough(child.element);
25516
+ case "field": return convertField(child);
25517
+ default: return new RawPassthrough(child.element);
25518
+ }
25519
+ }
25520
+ function convertParagraph(json) {
25521
+ const { children, text, ...rest } = json;
25522
+ const runs = children ? toParagraphChildren(children) : text ? [new Run({ text })] : void 0;
25523
+ return new Paragraph({
25524
+ ...rest,
25525
+ children: runs
25526
+ });
25527
+ }
25528
+ function convertRun(json) {
25529
+ const { underline, strike, doubleStrike, size, sizeCs, ...rest } = json;
25530
+ return new Run({
25531
+ ...rest,
25532
+ underline: convertUnderline(underline),
25533
+ strike: strike ? true : void 0,
25534
+ doubleStrike: doubleStrike ? true : void 0,
25535
+ size,
25536
+ sizeComplexScript: sizeCs
25537
+ });
25538
+ }
25539
+ const EMU_PER_PIXEL = 9525;
25540
+ function convertImageRun(json) {
25541
+ const { data, type, transformation, altText } = json;
25542
+ const convertedTransform = transformation ? {
25543
+ width: Math.round(transformation.width / EMU_PER_PIXEL),
25544
+ height: Math.round(transformation.height / EMU_PER_PIXEL),
25545
+ ...transformation.flip && { flip: transformation.flip },
25546
+ ...transformation.offset && { offset: transformation.offset }
25547
+ } : {
25548
+ width: 100,
25549
+ height: 100
25550
+ };
25551
+ return new ImageRun({
25552
+ data: typeof data === "string" ? Uint8Array.from(atob(data), (c) => c.charCodeAt(0)) : data,
25553
+ type,
25554
+ transformation: convertedTransform,
25555
+ altText
25556
+ });
25557
+ }
25558
+ function convertExternalHyperlink(json) {
25559
+ const { children, link, tooltip } = json;
25560
+ return new ExternalHyperlink({
25561
+ link,
25562
+ tooltip,
25563
+ children: children ? toParagraphChildren(children) : [new Run({ text: link })]
25564
+ });
25565
+ }
25566
+ function convertSdt(json) {
25567
+ return new RawPassthrough(json.element);
25568
+ }
25569
+ function convertSdtRun(json) {
25570
+ return new RawPassthrough(json.element);
25571
+ }
25572
+ function convertField(json) {
25573
+ const { instruction, children } = json;
25574
+ const cachedText = children?.map((c) => {
25575
+ if (c.$type === "textRun" && c.text) return c.text;
25576
+ }).filter(Boolean).join("") ?? void 0;
25577
+ return new SimpleField(instruction ?? "", cachedText);
25578
+ }
25579
+ function convertTable(json) {
25580
+ const { rows, ...rest } = json;
25581
+ return new Table({
25582
+ ...rest,
25583
+ rows: rows.map(convertTableRow)
25584
+ });
25585
+ }
25586
+ function convertTableRow(row) {
25587
+ const { cells, height, ...rest } = row;
25588
+ return new TableRow({
25589
+ children: cells.map(convertTableCell),
25590
+ ...height && { height },
25591
+ ...rest
25592
+ });
25593
+ }
25594
+ function convertTableCell(cell) {
25595
+ const { children, ...rest } = cell;
25596
+ return new TableCell({
25597
+ ...rest,
25598
+ children: children ? toSectionChildren(children) : [new Paragraph({ text: "" })]
25599
+ });
25600
+ }
25601
+ function convertUnderline(underline) {
25602
+ if (!underline) return void 0;
25603
+ if (typeof underline === "string") return { type: underline };
25604
+ return underline;
25605
+ }
24735
25606
  //#endregion
24736
25607
  //#region src/index.ts
24737
25608
  var src_exports = /* @__PURE__ */ __exportAll({
@@ -25090,11 +25961,15 @@ var src_exports = /* @__PURE__ */ __exportAll({
25090
25961
  getLayoutXml: () => getLayoutXml,
25091
25962
  getStyleXml: () => getStyleXml,
25092
25963
  hashedId: () => hashedId,
25964
+ isRaw: () => isRaw,
25093
25965
  parseDocx: () => parseDocx,
25094
25966
  patchDetector: () => patchDetector,
25095
25967
  patchDocument: () => patchDocument,
25096
25968
  sectionMarginDefaults: () => sectionMarginDefaults,
25097
25969
  sectionPageSizeDefaults: () => sectionPageSizeDefaults,
25970
+ toDocumentOptions: () => toDocumentOptions,
25971
+ toParagraphChildren: () => toParagraphChildren,
25972
+ toSectionChildren: () => toSectionChildren,
25098
25973
  uniqueId: () => uniqueId,
25099
25974
  uniqueNumericIdCreator: () => uniqueNumericIdCreator,
25100
25975
  uniqueUuid: () => uniqueUuid,
@@ -25103,6 +25978,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
25103
25978
  __reExport(src_exports, file_exports);
25104
25979
  __reExport(src_exports, util_exports);
25105
25980
  //#endregion
25106
- export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, Attributes, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, buildDocumentAttributes, buildRunProperties, chartAttr, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, parseDocx, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
25981
+ export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, Attributes, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, buildDocumentAttributes, buildRunProperties, chartAttr, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, isRaw, parseDocx, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, toDocumentOptions, toParagraphChildren, toSectionChildren, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
25107
25982
 
25108
25983
  //# sourceMappingURL=index.mjs.map