@office-open/core 0.10.12 → 0.10.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +10 -9
  2. package/dist/chart/index.d.mts +1 -1
  3. package/dist/chart/index.mjs +1 -1
  4. package/dist/{chart-DwE8FCFk.mjs → chart-DOO1st0K.mjs} +3 -1
  5. package/dist/chart-DOO1st0K.mjs.map +1 -0
  6. package/dist/converters-C_Y2QX1w.mjs +1789 -0
  7. package/dist/converters-C_Y2QX1w.mjs.map +1 -0
  8. package/dist/data-type-CZMKVaaT.d.mts +10 -0
  9. package/dist/data-type-CZMKVaaT.d.mts.map +1 -0
  10. package/dist/descriptor/index.d.mts +2 -2
  11. package/dist/descriptor/index.mjs +2 -2
  12. package/dist/{descriptor-DAER86Rt.mjs → descriptor-BjNkn5jo.mjs} +3 -33
  13. package/dist/descriptor-BjNkn5jo.mjs.map +1 -0
  14. package/dist/drawingml/index.d.mts +2 -2
  15. package/dist/drawingml/index.mjs +2 -2
  16. package/dist/{src-bVqU5Bh3.mjs → drawingml-sj1J3lb0.mjs} +22 -3728
  17. package/dist/drawingml-sj1J3lb0.mjs.map +1 -0
  18. package/dist/index-BVK2dv6C.d.mts +63 -0
  19. package/dist/index-BVK2dv6C.d.mts.map +1 -0
  20. package/dist/index-BfHfKuKy.d.mts +275 -0
  21. package/dist/index-BfHfKuKy.d.mts.map +1 -0
  22. package/dist/index-CE53SwpZ.d.mts +1463 -0
  23. package/dist/index-CE53SwpZ.d.mts.map +1 -0
  24. package/dist/{index-3STznXzZ.d.mts → index-D6VE-MnJ.d.mts} +3 -15
  25. package/dist/index-D6VE-MnJ.d.mts.map +1 -0
  26. package/dist/{index-CN0YjNSx.d.mts → index-DDyd2ErZ.d.mts} +3 -15
  27. package/dist/index-DDyd2ErZ.d.mts.map +1 -0
  28. package/dist/{index-CsQP7Cl4.d.mts → index-DlPA26cw.d.mts} +2 -47
  29. package/dist/index-DlPA26cw.d.mts.map +1 -0
  30. package/dist/index-k8WKLXnA.d.mts +150 -0
  31. package/dist/index-k8WKLXnA.d.mts.map +1 -0
  32. package/dist/index.d.mts +650 -8
  33. package/dist/index.d.mts.map +1 -0
  34. package/dist/index.mjs +1271 -7
  35. package/dist/index.mjs.map +1 -0
  36. package/dist/output-D_G_JR_8.d.mts +24 -0
  37. package/dist/output-D_G_JR_8.d.mts.map +1 -0
  38. package/dist/patch/index.d.mts +2 -2
  39. package/dist/patch/index.mjs +1 -1
  40. package/dist/{patch-OSbQIQAi.mjs → patch-BmRfghOo.mjs} +65 -84
  41. package/dist/patch-BmRfghOo.mjs.map +1 -0
  42. package/dist/smartart/index.d.mts +1 -1
  43. package/dist/smartart/index.mjs +1 -1
  44. package/dist/{smartart-DCY-Vdv7.mjs → smartart-B7ukZ-Tw.mjs} +5 -3
  45. package/dist/smartart-B7ukZ-Tw.mjs.map +1 -0
  46. package/dist/theme/index.d.mts +1 -1
  47. package/dist/theme-CiNzdl-9.mjs +2 -0
  48. package/dist/theme-CiNzdl-9.mjs.map +1 -0
  49. package/dist/util/index.d.mts +4 -0
  50. package/dist/util/index.mjs +3 -0
  51. package/dist/util-Tq9PSjK0.mjs +1113 -0
  52. package/dist/util-Tq9PSjK0.mjs.map +1 -0
  53. package/dist/values-8di32lIe.d.mts +56 -0
  54. package/dist/values-8di32lIe.d.mts.map +1 -0
  55. package/package.json +7 -6
  56. package/dist/index-CHGFwCCQ.d.mts +0 -266
  57. package/dist/index-CpNwAcem.d.mts +0 -169
  58. package/dist/index-DdXU1_sq.d.mts +0 -5029
  59. package/dist/util/values.d.mts +0 -2
  60. package/dist/util/values.mjs +0 -2
  61. package/dist/values-CVIZcTRw.mjs +0 -371
  62. package/dist/values-DQfI1FSg.d.mts +0 -426
package/dist/index.mjs CHANGED
@@ -1,8 +1,1272 @@
1
- import { $ as convertUniversalMeasureToTwip, $n as createGradientStop, $r as levelForMediaName, $t as createGroupLocking, A as customGeometryDesc, An as createGlowEffect, Ar as SystemColor, At as createStyleLabel, B as convertEmuToPoints, Bn as LineEndType, Br as buildContentTypeOverrides, Bt as AnimateOneByOneValue, C as diagramStyleDesc, Cn as createSoftEdgeEffect, Cr as uniqueId, Ct as FontCollectionIndex, D as shape3DDesc, Dn as RectAlignment, Dr as toUint8Array, Dt as createEffectColorList, E as scene3DDesc, En as createPresetShadowEffect, Er as isBase64DataURL, Et as createDiagramStyle, F as shapeLockingDesc, Fn as LineJoin, Fr as createRgbColor, Ft as createColorsDefinitionHeaderList, G as convertPointsToEmu, Gn as createNoFill, Gr as summarizeOpcIssues, Gt as createAnimateOneByOne, H as convertInchesToTwip, Hn as createLineEnd, Hr as PART_REGISTRIES, Ht as HierBranchStyle, I as effectListDesc, In as PenAlignment, Ir as PresetColor, It as createLayoutDefinitionHeader, J as convertToPt, Jn as PresetPattern, Jr as parseArchive, Jt as createMaxChildren, K as convertToEmu, Kn as buildFill, Kr as validateOpcConsistency, Kt as createAnimationLevel, L as outlineDesc, Ln as PresetDash, Lr as createPresetColor, Lt as createLayoutDefinitionHeaderList, M as graphicFrameLockingDesc, Mn as createFillOverlayEffect, Mr as SchemeColor, Mt as createTextFillColorList, N as groupLockingDesc, Nn as CompoundLine, Nr as createSchemeColor, Nt as createTextLineColorList, O as groupTransform2DDesc, On as createOuterShadowEffect, Or as createColorElement, Ot as createFillColorList, P as pictureLockingDesc, Pn as LineCap, Pr as createScRgbColor, Pt as createColorsDefinitionHeader, Q as convertUniversalMeasureToPt, Qn as createGradientFill, Qr as createZipStream, Qt as createGraphicFrameLocking, R as convertEmuToInches, Rn as createOutline, Rr as createHslColor, Rt as createStyleDefinitionHeader, S as diagramRelationshipIdsDesc, Sn as createEffectList, Sr as hashedId, St as ColorMethod, T as bevelDesc, Tn as PresetShadowVal, Tr as uniqueUuid, Tt as StyleMatrixIndex, U as convertMillimetersToTwip, Un as createCustomDash, Ur as PPTX_PARTS, Ut as createAdjust, V as convertInchesToEmu, Vn as LineEndWidth, Vr as DOCX_PARTS, Vt as AnimationLevelValue, W as convertPixelsToEmu, Wn as createGroupFill, Wr as XLSX_PARTS, Wt as createAdjustList, X as convertUniversalMeasureToEmu, Xn as PathShadeType, Xr as ZIP_STORED_LEVEL, Xt as createPreferredChildren, Y as convertToTwip, Yn as createPatternFill, Yr as ZIP_DEFLATE_LEVEL, Yt as createOrgChart, Z as convertUniversalMeasureToInch, Zn as TileFlipMode, Zr as createPacker, Zt as createPresentationLayoutVariables, _ as derivePasswordHash, _n as createBevel, _r as xsdTextCaps, _t as systemColorDesc, a as getMediaRefs, ai as convertOutput, an as createGroupTransform2D, ar as xsdEffectContainer, at as blipFillDesc, b as compileMapping, bn as createEffectDag, br as createSourceRectangle, bt as createDiagramTextProperties, c as hasPlaceholders, ci as customPropertiesDesc, cn as createBlipFill, cr as xsdMaterialType, ct as tileDesc, d as replaceHyperlinkPlaceholders, di as createOverride, dn as createCustomGeometry, dr as xsdPenAlignment, dt as presetColorDesc, ei as strFromU8, en as createPictureLocking, er as TileAlignment, et as parseUniversalMeasure, f as replaceImagePlaceholders, fi as Media, fn as stringifyPresetGeometry, fr as xsdPresetShadow, ft as rgbColorDesc, g as replaceVideoPlaceholders, gn as BevelPresetType, gr as xsdTextAnchor, gt as stringifyColorChoice, h as replaceSmartArtPlaceholders, hi as optionalRelsPart, hn as createShape3D, hr as xsdTextAlign, ht as solidFillDesc, i as formatId, ii as OoxmlMimeType, in as parseTableStyleList, ir as xsdCompoundLine, it as blipDesc, j as presetGeometryDesc, jn as BlendMode, jr as createSystemColor, jt as createTextEffectColorList, k as transform2DDesc, kn as createInnerShadowEffect, kr as createSolidFill, kt as createLineColorList, l as replaceAllPlaceholders, li as appPropertiesDesc, ln as createBlip, lr as xsdPathFillMode, lt as hslColorDesc, m as replaceNumberingPlaceholders, mi as TargetModeType, mn as PresetMaterialType, mr as xsdStrikeStyle, mt as schemeColorDesc, n as collectPlaceholderKeys, ni as zipAndConvert, nn as createTableStyle, nr as invertMap, nt as gradientFillDesc, o as getReferencedMedia, oi as decodeBase64, on as createTransform2D, or as xsdLineCap, ot as sourceRectangleDesc, p as replaceMediaPlaceholders, pi as Relationships, pn as stringifyAdjustmentValues, pr as xsdRectAlignment, pt as scRgbColorDesc, q as convertToInch, qn as extractBlipFillMedia, qr as ParsedArchive, qt as createHierBranch, r as findAndReplaceImagePlaceholders, ri as zipSyncAndConvert, rn as createTableStyleList, rr as xsdBlendMode, rt as patternFillDesc, s as getVideoRefs, si as encodeBase64, sn as stringifyStretch, sr as xsdLineEndSize, st as stretchDesc, t as addSmartArtRelationships, ti as unzipSync, tn as createShapeLocking, tr as createTileInfo, tt as fillDesc, u as replaceChartPlaceholders, ui as createDefault, un as createExtentionList, ur as xsdPattern, ut as parseColorChoice, v as hashPasswordAgile, vn as createBottomBevel, vr as xsdUnderlineStyle, vt as createDiagramExtensionList, w as presentationLayoutVariablesDesc, wn as createReflectionEffect, wr as uniqueNumericIdCreator, wt as HueDirection, x as diagramExtensionListDesc, xn as calculateEffectExtent, xr as createBlipEffects, xt as createDiagramRelationshipIds, y as randomBytes, yn as createScene3D, yr as xsdVerticalMergeRev, yt as createDiagramShape3D, z as convertEmuToPixels, zn as LineEndLength, zr as createColorTransforms, zt as createStyleDefinitionHeaderList } from "./src-bVqU5Bh3.mjs";
2
- import { _ as DOCX_NS, a as appendOverride, b as buildCorePropertiesXmlString, c as createRunRenderer, d as createSplitInject, f as createTextElementContents, g as toJson, h as patchSpaceAttribute, i as appendContentType, l as createTokenReplacer, m as nextNumericId, n as appendRelationship, o as createReplacer, p as getFirstLevelElements, r as getNextRelationshipIndex, s as createTraverser, t as applyCorePropertiesOverride, u as TokenNotFoundError, v as PPTX_NS, x as parseCorePropsElement, y as buildCorePropertiesXml } from "./patch-OSbQIQAi.mjs";
3
- import { a as stringifyDataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as stringifyTransPoint, l as getLayoutXml, n as SmartArtCollection, o as stringifyConnection, p as STYLE_CATEGORIES, r as stringifyPoint, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-DCY-Vdv7.mjs";
4
- import { a as TimeUnit, c as ChartCollection, i as ErrorValueType, n as ErrorBarDirection, o as TrendlineType, r as ErrorBarType, s as chartSpaceDesc, t as DataLabelPosition } from "./chart-DwE8FCFk.mjs";
5
- import { a as roundTripFields, c as enumDecode, d as stringify, i as diffTagSets, l as enumEncode, n as findFieldSpec, o as boolDecode, r as checkOrder, s as boolEncode, t as FIELD_SPECS, u as parse } from "./descriptor-DAER86Rt.mjs";
1
+ import { _ as DOCX_NS, a as appendOverride, b as parseCorePropsElement, c as createRunRenderer, d as createSplitInject, f as createTextElementContents, g as toJson, h as patchSpaceAttribute, i as appendContentType, l as createTokenReplacer, m as nextNumericId, n as appendRelationship, o as createReplacer, p as getFirstLevelElements, r as getNextRelationshipIndex, s as createTraverser, t as applyCorePropertiesOverride, u as TokenNotFoundError, v as PPTX_NS, y as buildCorePropertiesXmlString } from "./patch-BmRfghOo.mjs";
2
+ import { A as xsdStrikeStyle, B as isBase64DataURL, C as xsdLineEndSize, D as xsdPenAlignment, E as xsdPattern, F as xsdVerticalMergeRev, H as decodeBase64, I as hashedId, L as uniqueId, M as xsdTextAnchor, N as xsdTextCaps, O as xsdPresetShadow, P as xsdUnderlineStyle, R as uniqueNumericIdCreator, S as xsdLineCap, T as xsdPathFillMode, U as encodeBase64, V as toUint8Array, _ as parseUniversalMeasure, a as convertInchesToTwip, b as xsdCompoundLine, c as convertPointsToEmu, d as convertToPt, f as convertToTwip, g as convertUniversalMeasureToTwip, h as convertUniversalMeasureToPt, i as convertInchesToEmu, j as xsdTextAlign, k as xsdRectAlignment, l as convertToEmu, m as convertUniversalMeasureToInch, n as convertEmuToPixels, o as convertMillimetersToTwip, p as convertUniversalMeasureToEmu, r as convertEmuToPoints, s as convertPixelsToEmu, t as convertEmuToInches, u as convertToInch, v as invertMap, w as xsdMaterialType, x as xsdEffectContainer, y as xsdBlendMode, z as uniqueUuid } from "./converters-C_Y2QX1w.mjs";
3
+ import { $ as convertOutput, A as replaceChartPlaceholders, B as compileMapping, C as findAndReplaceImagePlaceholders, D as getVideoRefs, E as getReferencedMedia, F as replaceSmartArtPlaceholders, G as levelForMediaName, H as ZIP_STORED_LEVEL, I as replaceVideoPlaceholders, J as zipAndConvert, K as strFromU8, L as derivePasswordHash, M as replaceImagePlaceholders, N as replaceMediaPlaceholders, O as hasPlaceholders, P as replaceNumberingPlaceholders, Q as OoxmlMimeType, R as hashPasswordAgile, S as collectPlaceholderKeys, T as getMediaRefs, U as createPacker, V as ZIP_DEFLATE_LEVEL, W as createZipStream, X as hasNativeInflate, Y as zipSyncAndConvert, Z as nativeUnzip, _ as twipsMeasureValue, a as eighthPointMeasureValue, b as unsignedDecimalNumber, c as hpsMeasureValue, d as percentageValue, f as pointMeasureValue, g as signedTwipsMeasureValue, h as signedHpsMeasureValue, i as decimalNumber, j as replaceHyperlinkPlaceholders, k as replaceAllPlaceholders, l as longHexNumber, m as shortHexNumber, n as ThemeFont, o as hexBinary, p as positiveUniversalMeasureValue, q as unzipSync, r as dateTimeValue, s as hexColorValue, t as ThemeColor, u as measurementOrPercentValue, v as uCharHexNumber, w as formatId, x as addSmartArtRelationships, y as universalMeasureValue, z as randomBytes } from "./util-Tq9PSjK0.mjs";
4
+ import { a as stringifyDataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as stringifyTransPoint, l as getLayoutXml, n as SmartArtCollection, o as stringifyConnection, p as STYLE_CATEGORIES, r as stringifyPoint, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-B7ukZ-Tw.mjs";
5
+ import { a as TimeUnit, c as ChartCollection, i as ErrorValueType, n as ErrorBarDirection, o as TrendlineType, r as ErrorBarType, s as chartSpaceDesc, t as DataLabelPosition } from "./chart-DOO1st0K.mjs";
6
+ import { $ as createLayoutDefinitionHeader, $t as PenAlignment, A as scRgbColorDesc, An as createPresetColor, At as stringifyAdjustmentValues, B as FontCollectionIndex, Bt as createSoftEdgeEffect, C as sourceRectangleDesc, Cn as SystemColor, Ct as createTransform2D, D as parseColorChoice, Dn as createScRgbColor, Dt as createExtensionList, E as hslColorDesc, En as createSchemeColor, Et as createBlip, F as createDiagramExtensionList, Ft as createBottomBevel, G as createFillColorList, Gt as createOuterShadowEffect, H as StyleMatrixIndex, Ht as PresetShadowVal, I as createDiagramShape3D, It as createScene3D, J as createTextEffectColorList, Jt as BlendMode, K as createLineColorList, Kt as createInnerShadowEffect, L as createDiagramTextProperties, Lt as createEffectDag, M as solidFillDesc, Mn as createColorTransforms, Mt as createShape3D, N as stringifyColorChoice, Nt as BevelPresetType, O as presetColorDesc, On as createRgbColor, Ot as createCustomGeometry, P as systemColorDesc, Pt as createBevel, Q as createColorsDefinitionHeaderList, Qt as LineJoin, R as createDiagramRelationshipIds, Rt as calculateEffectExtent, S as blipFillDesc, Sn as createSolidFill, St as createGroupTransform2D, T as tileDesc, Tn as SchemeColor, Tt as createBlipFill, U as createDiagramStyle, Ut as createPresetShadowEffect, V as HueDirection, Vt as createReflectionEffect, W as createEffectColorList, Wt as RectAlignment, X as createTextLineColorList, Xt as CompoundLine, Y as createTextFillColorList, Yt as createFillOverlayEffect, Z as createColorsDefinitionHeader, Zt as LineCap, _ as outlineDesc, _n as TileAlignment, _t as createPictureLocking, a as bevelDesc, an as createLineEnd, at as HierBranchStyle, b as patternFillDesc, bn as createBlipEffects, bt as createTableStyleList, c as groupTransform2DDesc, cn as createNoFill, ct as createAnimateOneByOne, d as presetGeometryDesc, dn as PresetPattern, dt as createMaxChildren, en as PresetDash, et as createLayoutDefinitionHeaderList, f as graphicFrameLockingDesc, fn as createPatternFill, ft as createOrgChart, g as effectListDesc, gn as createGradientStop, gt as createGroupLocking, h as shapeLockingDesc, hn as createGradientFill, ht as createGraphicFrameLocking, i as presentationLayoutVariablesDesc, in as LineEndWidth, it as AnimationLevelValue, j as schemeColorDesc, jn as createHslColor, jt as PresetMaterialType, k as rgbColorDesc, kn as PresetColor, kt as stringifyPresetGeometry, l as transform2DDesc, ln as buildFill, lt as createAnimationLevel, m as pictureLockingDesc, mn as TileFlipMode, mt as createPresentationLayoutVariables, n as diagramRelationshipIdsDesc, nn as LineEndLength, nt as createStyleDefinitionHeaderList, o as scene3DDesc, on as createCustomDash, ot as createAdjust, p as groupLockingDesc, pn as PathShadeType, pt as createPreferredChildren, q as createStyleLabel, qt as createGlowEffect, r as diagramStyleDesc, rn as LineEndType, rt as AnimateOneByOneValue, s as shape3DDesc, sn as createGroupFill, st as createAdjustList, t as diagramExtensionListDesc, tn as createOutline, tt as createStyleDefinitionHeader, u as customGeometryDesc, un as extractBlipFillMedia, ut as createHierBranch, v as fillDesc, vn as createTileInfo, vt as createShapeLocking, w as stretchDesc, wn as createSystemColor, wt as stringifyStretch, x as blipDesc, xn as createColorElement, xt as parseTableStyleList, y as gradientFillDesc, yn as createSourceRectangle, yt as createTableStyle, z as ColorMethod, zt as createEffectList } from "./drawingml-sj1J3lb0.mjs";
7
+ import { a as roundTripFields, i as diffTagSets, n as findFieldSpec, o as parse, r as checkOrder, s as stringify, t as FIELD_SPECS } from "./descriptor-BjNkn5jo.mjs";
6
8
  import { i as DEFAULT_COLORS, n as createThemeXml, r as buildThemeXml, t as themeDesc } from "./theme-CiNzdl-9.mjs";
7
- import { _ as twipsMeasureValue, a as eighthPointMeasureValue, b as unsignedDecimalNumber, c as hpsMeasureValue, d as percentageValue, f as pointMeasureValue, g as signedTwipsMeasureValue, h as signedHpsMeasureValue, i as decimalNumber, l as longHexNumber, m as shortHexNumber, n as ThemeFont, o as hexBinary, p as positiveUniversalMeasureValue, r as dateTimeValue, s as hexColorValue, t as ThemeColor, u as measurementOrPercentValue, v as uCharHexNumber, y as universalMeasureValue } from "./values-CVIZcTRw.mjs";
8
- export { AnimateOneByOneValue, AnimationLevelValue, BevelPresetType, BlendMode, COLOR_CATEGORIES, ChartCollection, ColorMethod, CompoundLine, DEFAULT_COLORS, DEFAULT_DRAWING_XML, DOCX_NS, DOCX_PARTS, DataLabelPosition, ErrorBarDirection, ErrorBarType, ErrorValueType, FIELD_SPECS, FontCollectionIndex, HierBranchStyle, HueDirection, LAYOUT_CATEGORIES, LineCap, LineEndLength, LineEndType, LineEndWidth, LineJoin, Media, OoxmlMimeType, PART_REGISTRIES, PPTX_NS, PPTX_PARTS, ParsedArchive, PathShadeType, PenAlignment, PresetColor, PresetDash, PresetMaterialType, PresetPattern, PresetShadowVal, RectAlignment, Relationships, STYLE_CATEGORIES, SchemeColor, SmartArtCollection, StyleMatrixIndex, SystemColor, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TimeUnit, TokenNotFoundError, TrendlineType, XLSX_PARTS, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, appPropertiesDesc, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, bevelDesc, blipDesc, blipFillDesc, boolDecode, boolEncode, buildContentTypeOverrides, buildCorePropertiesXml, buildCorePropertiesXmlString, buildFill, buildThemeXml, calculateEffectExtent, chartSpaceDesc, checkOrder, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertToEmu, convertToInch, convertToPt, convertToTwip, convertUniversalMeasureToEmu, convertUniversalMeasureToInch, convertUniversalMeasureToPt, convertUniversalMeasureToTwip, createAdjust, createAdjustList, createAnimateOneByOne, createAnimationLevel, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createColorsDefinitionHeader, createColorsDefinitionHeaderList, createCustomDash, createCustomGeometry, createDataModel, createDefault, createDiagramExtensionList, createDiagramRelationshipIds, createDiagramShape3D, createDiagramStyle, createDiagramTextProperties, createEffectColorList, createEffectDag, createEffectList, createExtentionList, createFillColorList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGraphicFrameLocking, createGroupFill, createGroupLocking, createGroupTransform2D, createHierBranch, createHslColor, createInnerShadowEffect, createLayoutDefinitionHeader, createLayoutDefinitionHeaderList, createLineColorList, createLineEnd, createMaxChildren, createNoFill, createOrgChart, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPictureLocking, createPreferredChildren, createPresentationLayoutVariables, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createShapeLocking, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStyleDefinitionHeader, createStyleDefinitionHeaderList, createStyleLabel, createSystemColor, createTableStyle, createTableStyleList, createTextEffectColorList, createTextElementContents, createTextFillColorList, createTextLineColorList, createThemeXml, createTileInfo, createTokenReplacer, createTransform2D, createTraverser, createZipStream, customGeometryDesc, customPropertiesDesc, dateTimeValue, decimalNumber, decodeBase64, derivePasswordHash, diagramExtensionListDesc, diagramRelationshipIdsDesc, diagramStyleDesc, diffTagSets, effectListDesc, eighthPointMeasureValue, encodeBase64, enumDecode, enumEncode, extractBlipFillMedia, fillDesc, findAndReplaceImagePlaceholders, findFieldSpec, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getMediaRefs, getNextRelationshipIndex, getReferencedMedia, getStyleXml, getVideoRefs, gradientFillDesc, graphicFrameLockingDesc, groupLockingDesc, groupTransform2DDesc, hasPlaceholders, hashPasswordAgile, hashedId, hexBinary, hexColorValue, hpsMeasureValue, hslColorDesc, invertMap, isBase64DataURL, levelForMediaName, longHexNumber, measurementOrPercentValue, nextNumericId, optionalRelsPart, outlineDesc, parse, parseArchive, parseColorChoice, parseCorePropsElement, parseTableStyleList, parseUniversalMeasure, patchSpaceAttribute, patternFillDesc, percentageValue, pictureLockingDesc, pointMeasureValue, positiveUniversalMeasureValue, presentationLayoutVariablesDesc, presetColorDesc, presetGeometryDesc, randomBytes, replaceAllPlaceholders, replaceChartPlaceholders, replaceHyperlinkPlaceholders, replaceImagePlaceholders, replaceMediaPlaceholders, replaceNumberingPlaceholders, replaceSmartArtPlaceholders, replaceVideoPlaceholders, rgbColorDesc, roundTripFields, scRgbColorDesc, scene3DDesc, schemeColorDesc, shape3DDesc, shapeLockingDesc, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, solidFillDesc, sourceRectangleDesc, strFromU8, stretchDesc, stringify, stringifyAdjustmentValues, stringifyColorChoice, stringifyConnection, stringifyDataModel, stringifyPoint, stringifyPresetGeometry, stringifyStretch, stringifyTransPoint, summarizeOpcIssues, systemColorDesc, themeDesc, tileDesc, toJson, toUint8Array, transform2DDesc, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, validateOpcConsistency, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
9
+ import { attr, escapeXml, js2xml, textOf, xml2js } from "@office-open/xml";
10
+ import { strFromU8 as strFromU8$1, strToU8, unzipSync as unzipSync$1, zipSync } from "fflate";
11
+ //#region src/opc/relationships.ts
12
+ const TargetModeType = { EXTERNAL: "External" };
13
+ /**
14
+ * Manages OOXML relationship entries and serializes to XML.
15
+ *
16
+ * Standalone class — no XmlComponent inheritance.
17
+ * Pure string concatenation for zero-allocation XML output.
18
+ */
19
+ var Relationships = class {
20
+ entries = [];
21
+ addRelationship(id, type, target, targetMode) {
22
+ this.entries.push({
23
+ id: `rId${id}`,
24
+ type,
25
+ target,
26
+ targetMode
27
+ });
28
+ }
29
+ get relationshipCount() {
30
+ return this.entries.length;
31
+ }
32
+ /** Directly builds XML string — zero intermediate tree allocation. */
33
+ serialize() {
34
+ const p = ["<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"];
35
+ for (const e of this.entries) {
36
+ const tm = e.targetMode ? ` TargetMode="${escapeXml(e.targetMode)}"` : "";
37
+ p.push(`<Relationship Id="${escapeXml(e.id)}" Type="${escapeXml(e.type)}" Target="${escapeXml(e.target)}"${tm}/>`);
38
+ }
39
+ p.push("</Relationships>");
40
+ return p.join("");
41
+ }
42
+ };
43
+ /**
44
+ * Serialize a Relationships part only when it carries at least one
45
+ * relationship. Optional parts (fontTable, headers, footers, charts, drawings,
46
+ * worksheets, …) emit no .rels part when empty — Office strips empty rels
47
+ * shells when re-saving, so skipping them keeps generated packages free of
48
+ * redundant empty parts and matches Office's normalized output.
49
+ *
50
+ * Always-on parts (the package `_rels/.rels` and the main
51
+ * document/presentation/workbook parts) carry relationships by construction
52
+ * and must NOT use this gate.
53
+ */
54
+ function optionalRelsPart(rel, xmlDeclaration, path) {
55
+ return rel.relationshipCount > 0 ? {
56
+ data: xmlDeclaration + rel.serialize(),
57
+ path
58
+ } : void 0;
59
+ }
60
+ //#endregion
61
+ //#region src/opc/media.ts
62
+ /**
63
+ * FNV-1a hash is a pure function of the bytes, so memoize it across
64
+ * {@link Media} instances — repeated `generate()` calls that reuse the same
65
+ * buffer objects (the common case) skip recomputation entirely.
66
+ */
67
+ const hashKeyCache = /* @__PURE__ */ new WeakMap();
68
+ /**
69
+ * Shared media collection for docx/pptx/xlsx. Generic over the package's entry
70
+ * type so each package keeps its own metadata while sharing the registration +
71
+ * dedup logic.
72
+ */
73
+ var Media = class {
74
+ map = /* @__PURE__ */ new Map();
75
+ /** FNV-1a content key ("len:hash") -> canonical file name, for cross-object dedup. */
76
+ byContent = /* @__PURE__ */ new Map();
77
+ /** Memoized result per input buffer — the repeated-reference hot path. */
78
+ verified = /* @__PURE__ */ new WeakMap();
79
+ counter = 0;
80
+ /**
81
+ * Register media, reusing the existing entry when the bytes already exist.
82
+ * Returns the canonical entry (shared across all identical references) —
83
+ * callers read `entry.fileName` for placeholders/relationship targets or use
84
+ * the whole entry (e.g. drawing XML). The `build` callback constructs the
85
+ * package-specific entry from the allocated file name.
86
+ *
87
+ * Pass `fileName` to pin the name (round-trip scenarios preserving a source
88
+ * file name); omit it to allocate the next sequential `imageN.ext`.
89
+ */
90
+ addMedia(data, type, build, fileName) {
91
+ const verifiedName = this.verified.get(data);
92
+ if (verifiedName !== void 0) {
93
+ const existing = this.map.get(verifiedName);
94
+ if (existing.type === type) return existing;
95
+ }
96
+ const key = `${type}:${this.contentKey(data)}`;
97
+ const existingName = this.byContent.get(key);
98
+ if (existingName !== void 0) {
99
+ const existing = this.map.get(existingName);
100
+ if (existing.type === type && this.byteEqual(existing.data, data)) {
101
+ this.verified.set(data, existingName);
102
+ return existing;
103
+ }
104
+ }
105
+ const resolvedName = fileName ?? this.nextName(type);
106
+ const finalName = this.map.has(resolvedName) ? this.nextName(type) : resolvedName;
107
+ const entry = build(finalName);
108
+ this.map.set(finalName, entry);
109
+ this.byContent.set(key, finalName);
110
+ this.verified.set(data, finalName);
111
+ return entry;
112
+ }
113
+ /** Next sequential `imageN.${type}` that isn't already in use. */
114
+ nextName(type) {
115
+ let name = `image${++this.counter}.${type}`;
116
+ while (this.map.has(name)) name = `image${++this.counter}.${type}`;
117
+ return name;
118
+ }
119
+ /** "length:hash" content key for `data` (FNV-1a over the raw bytes), memoized. */
120
+ contentKey(data) {
121
+ const cached = hashKeyCache.get(data);
122
+ if (cached !== void 0) return cached;
123
+ let hash = 2166136261;
124
+ for (const byte of data) {
125
+ hash ^= byte;
126
+ hash = Math.imul(hash, 16777619);
127
+ }
128
+ const key = `${data.length}:${(hash >>> 0).toString(16)}`;
129
+ hashKeyCache.set(data, key);
130
+ return key;
131
+ }
132
+ /** Structural equality with early exit on the first mismatch. */
133
+ byteEqual(a, b) {
134
+ if (a.length !== b.length) return false;
135
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
136
+ return true;
137
+ }
138
+ /** All registered media entries. */
139
+ get array() {
140
+ return [...this.map.values()];
141
+ }
142
+ };
143
+ //#endregion
144
+ //#region src/opc/content-types.ts
145
+ /**
146
+ * Creates a Default element mapping a file extension to a MIME content type.
147
+ */
148
+ const createDefault = (contentType, extension) => extension !== void 0 ? `<Default ContentType="${contentType}" Extension="${extension}"/>` : `<Default ContentType="${contentType}"/>`;
149
+ /**
150
+ * Creates an Override element mapping a specific part path to a MIME content type.
151
+ */
152
+ const createOverride = (contentType, partName) => partName !== void 0 ? `<Override ContentType="${contentType}" PartName="${partName}"/>` : `<Override ContentType="${contentType}"/>`;
153
+ //#endregion
154
+ //#region src/opc/app-properties.ts
155
+ /**
156
+ * Extended (App) Properties module — shared OPC part (docProps/app.xml).
157
+ *
158
+ * Format-agnostic: CT_Properties (ISO-IEC29500-2_2016 shared-documentPropertiesExtended.xsd)
159
+ * is identical across docx/pptx/xlsx. Each package surfaces only the fields it populates
160
+ * (Pages/Words for docx, Slides for pptx, etc.) — all fields are optional.
161
+ *
162
+ * @module
163
+ */
164
+ /** xsd:boolean lexical form — spec canonical form is "true"/"false" (Word's convention). */
165
+ const xsdBoolean = (value) => value ? "true" : "false";
166
+ const appPropertiesDesc = {
167
+ kind: "custom",
168
+ stringify(opts, _ctx) {
169
+ const p = ["<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">"];
170
+ if (opts.template !== void 0) p.push(`<Template>${escapeXml(opts.template)}</Template>`);
171
+ if (opts.manager !== void 0) p.push(`<Manager>${escapeXml(opts.manager)}</Manager>`);
172
+ if (opts.company !== void 0) p.push(`<Company>${escapeXml(opts.company)}</Company>`);
173
+ if (opts.pages !== void 0) p.push(`<Pages>${opts.pages}</Pages>`);
174
+ if (opts.words !== void 0) p.push(`<Words>${opts.words}</Words>`);
175
+ if (opts.characters !== void 0) p.push(`<Characters>${opts.characters}</Characters>`);
176
+ if (opts.lines !== void 0) p.push(`<Lines>${opts.lines}</Lines>`);
177
+ if (opts.paragraphs !== void 0) p.push(`<Paragraphs>${opts.paragraphs}</Paragraphs>`);
178
+ if (opts.slides !== void 0) p.push(`<Slides>${opts.slides}</Slides>`);
179
+ if (opts.notes !== void 0) p.push(`<Notes>${opts.notes}</Notes>`);
180
+ if (opts.totalTime !== void 0) p.push(`<TotalTime>${opts.totalTime}</TotalTime>`);
181
+ if (opts.hiddenSlides !== void 0) p.push(`<HiddenSlides>${opts.hiddenSlides}</HiddenSlides>`);
182
+ if (opts.mmClips !== void 0) p.push(`<MMClips>${opts.mmClips}</MMClips>`);
183
+ if (opts.scaleCrop !== void 0) p.push(`<ScaleCrop>${xsdBoolean(opts.scaleCrop)}</ScaleCrop>`);
184
+ if (opts.linksUpToDate !== void 0) p.push(`<LinksUpToDate>${xsdBoolean(opts.linksUpToDate)}</LinksUpToDate>`);
185
+ if (opts.charactersWithSpaces !== void 0) p.push(`<CharactersWithSpaces>${opts.charactersWithSpaces}</CharactersWithSpaces>`);
186
+ if (opts.sharedDoc !== void 0) p.push(`<SharedDoc>${xsdBoolean(opts.sharedDoc)}</SharedDoc>`);
187
+ if (opts.hyperlinkBase !== void 0) p.push(`<HyperlinkBase>${escapeXml(opts.hyperlinkBase)}</HyperlinkBase>`);
188
+ if (opts.hyperlinksChanged !== void 0) p.push(`<HyperlinksChanged>${xsdBoolean(opts.hyperlinksChanged)}</HyperlinksChanged>`);
189
+ if (opts.application !== void 0) p.push(`<Application>${escapeXml(opts.application)}</Application>`);
190
+ if (opts.appVersion !== void 0) p.push(`<AppVersion>${escapeXml(opts.appVersion)}</AppVersion>`);
191
+ if (opts.docSecurity !== void 0) p.push(`<DocSecurity>${opts.docSecurity}</DocSecurity>`);
192
+ p.push("</Properties>");
193
+ return p.join("");
194
+ },
195
+ parse(el, _ctx) {
196
+ const result = {};
197
+ for (const child of el.elements ?? []) {
198
+ if (typeof child.name !== "string") continue;
199
+ const text = child.elements?.[0]?.text;
200
+ switch (child.name) {
201
+ case "Template":
202
+ if (typeof text === "string") result.template = text;
203
+ break;
204
+ case "Manager":
205
+ if (typeof text === "string") result.manager = text;
206
+ break;
207
+ case "Company":
208
+ if (typeof text === "string") result.company = text;
209
+ break;
210
+ case "Pages":
211
+ if (typeof text === "string") result.pages = Number(text);
212
+ break;
213
+ case "Words":
214
+ if (typeof text === "string") result.words = Number(text);
215
+ break;
216
+ case "Characters":
217
+ if (typeof text === "string") result.characters = Number(text);
218
+ break;
219
+ case "Lines":
220
+ if (typeof text === "string") result.lines = Number(text);
221
+ break;
222
+ case "Paragraphs":
223
+ if (typeof text === "string") result.paragraphs = Number(text);
224
+ break;
225
+ case "Slides":
226
+ if (typeof text === "string") result.slides = Number(text);
227
+ break;
228
+ case "Notes":
229
+ if (typeof text === "string") result.notes = Number(text);
230
+ break;
231
+ case "TotalTime":
232
+ if (typeof text === "string") result.totalTime = Number(text);
233
+ break;
234
+ case "HiddenSlides":
235
+ if (typeof text === "string") result.hiddenSlides = Number(text);
236
+ break;
237
+ case "MMClips":
238
+ if (typeof text === "string") result.mmClips = Number(text);
239
+ break;
240
+ case "ScaleCrop":
241
+ if (typeof text === "string") result.scaleCrop = text === "1" || text === "true";
242
+ break;
243
+ case "LinksUpToDate":
244
+ if (typeof text === "string") result.linksUpToDate = text === "1" || text === "true";
245
+ break;
246
+ case "CharactersWithSpaces":
247
+ if (typeof text === "string") result.charactersWithSpaces = Number(text);
248
+ break;
249
+ case "SharedDoc":
250
+ if (typeof text === "string") result.sharedDoc = text === "1" || text === "true";
251
+ break;
252
+ case "HyperlinkBase":
253
+ if (typeof text === "string") result.hyperlinkBase = text;
254
+ break;
255
+ case "HyperlinksChanged":
256
+ if (typeof text === "string") result.hyperlinksChanged = text === "1" || text === "true";
257
+ break;
258
+ case "Application":
259
+ if (typeof text === "string") result.application = text;
260
+ break;
261
+ case "AppVersion":
262
+ if (typeof text === "string") result.appVersion = text;
263
+ break;
264
+ case "DocSecurity":
265
+ if (typeof text === "string") result.docSecurity = Number(text);
266
+ break;
267
+ }
268
+ }
269
+ return result;
270
+ }
271
+ };
272
+ //#endregion
273
+ //#region src/opc/custom-properties.ts
274
+ /**
275
+ * Custom Properties module — shared OPC part (docProps/custom.xml).
276
+ *
277
+ * Format-agnostic: CT_CustomProperties (ISO-IEC29500-4_2016 shared-documentPropertiesCustom.xsd)
278
+ * is identical across docx/pptx/xlsx.
279
+ *
280
+ * @module
281
+ */
282
+ const customPropertiesDesc = {
283
+ kind: "custom",
284
+ stringify(opts, _ctx) {
285
+ const p = ["<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">"];
286
+ let pid = 2;
287
+ for (const prop of opts.properties) {
288
+ p.push(`<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="${pid}" name="${escapeXml(prop.name)}"><vt:lpwstr>${escapeXml(prop.value)}</vt:lpwstr></property>`);
289
+ pid++;
290
+ }
291
+ p.push("</Properties>");
292
+ return p.join("");
293
+ },
294
+ parse(el, _ctx) {
295
+ const properties = [];
296
+ for (const child of el.elements ?? []) {
297
+ if (child.name !== "property") continue;
298
+ const name = attr(child, "name");
299
+ if (!name) continue;
300
+ const valueEl = child.elements?.find((e) => e.name?.startsWith("vt:"));
301
+ const value = valueEl ? textOf(valueEl) ?? "" : "";
302
+ properties.push({
303
+ name,
304
+ value
305
+ });
306
+ }
307
+ return { properties };
308
+ }
309
+ };
310
+ //#endregion
311
+ //#region src/opc/parser.ts
312
+ const XML_PARSE_OPTIONS = {
313
+ nativeTypeAttributes: true,
314
+ captureSpacesBetweenElements: true
315
+ };
316
+ /**
317
+ * Parsed OOXML archive backed by an unzipped ZIP map.
318
+ *
319
+ * Provides unstorage-style API (get/set/getRaw/setRaw/remove/has/keys)
320
+ * for reading and modifying individual parts, then serializing back to a ZIP buffer.
321
+ */
322
+ var ParsedArchive = class {
323
+ zip;
324
+ modified = /* @__PURE__ */ new Map();
325
+ wrapperCache = /* @__PURE__ */ new Map();
326
+ constructor(data) {
327
+ let unzipped;
328
+ try {
329
+ unzipped = hasNativeInflate() ? nativeUnzip(data) : unzipSync$1(data);
330
+ } catch {
331
+ unzipped = unzipSync$1(data);
332
+ }
333
+ this.zip = new Map(Object.entries(unzipped));
334
+ }
335
+ /** Read an XML part as an Element tree. */
336
+ get(path) {
337
+ const modData = this.modified.get(path);
338
+ if (modData) {
339
+ const wrapper = xml2js(strFromU8$1(modData), XML_PARSE_OPTIONS);
340
+ this.wrapperCache.set(path, wrapper);
341
+ return wrapper.elements?.find((e) => e.type === "element");
342
+ }
343
+ const data = this.zip.get(path);
344
+ if (data === void 0) return void 0;
345
+ const cached = this.wrapperCache.get(path);
346
+ if (cached) return cached.elements?.find((e) => e.type === "element");
347
+ const wrapper = xml2js(strFromU8$1(data), XML_PARSE_OPTIONS);
348
+ this.wrapperCache.set(path, wrapper);
349
+ return wrapper.elements?.find((e) => e.type === "element");
350
+ }
351
+ /** Write an XML part (Element → XML string). */
352
+ set(path, element) {
353
+ const wrapper = this.wrapperCache.get(path);
354
+ const xml = js2xml(wrapper ? {
355
+ ...wrapper,
356
+ elements: [{
357
+ ...element,
358
+ type: "element"
359
+ }]
360
+ } : { elements: [{
361
+ ...element,
362
+ type: "element"
363
+ }] });
364
+ this.modified.set(path, strToU8(xml));
365
+ }
366
+ /** Read raw binary data (images, media, etc.). */
367
+ getRaw(path) {
368
+ return this.modified.get(path) ?? this.zip.get(path);
369
+ }
370
+ /** Write raw binary data. */
371
+ setRaw(path, data) {
372
+ this.modified.set(path, data);
373
+ this.wrapperCache.delete(path);
374
+ }
375
+ /** Remove a part. Returns true if it existed. */
376
+ remove(path) {
377
+ this.wrapperCache.delete(path);
378
+ return this.modified.delete(path) || this.zip.delete(path);
379
+ }
380
+ /** Check if a part exists. */
381
+ has(path) {
382
+ return this.modified.has(path) || this.zip.has(path);
383
+ }
384
+ /** List all paths matching an optional prefix. */
385
+ keys(prefix) {
386
+ const all = /* @__PURE__ */ new Set();
387
+ for (const key of this.zip.keys()) if (!prefix || key.startsWith(prefix)) all.add(key);
388
+ for (const key of this.modified.keys()) if (!prefix || key.startsWith(prefix)) all.add(key);
389
+ return [...all];
390
+ }
391
+ /** Serialize back to a ZIP buffer, merging original zip + modifications. */
392
+ save() {
393
+ const files = {};
394
+ for (const [path, data] of this.zip) if (!this.modified.has(path)) files[path] = isMediaPath(path) ? [data, { level: MEDIA_STORED_LEVEL }] : data;
395
+ for (const [path, data] of this.modified) files[path] = isMediaPath(path) ? [data, { level: MEDIA_STORED_LEVEL }] : data;
396
+ return zipSync(files);
397
+ }
398
+ };
399
+ /** Media file extensions that should use STORE (no compression). */
400
+ const MEDIA_EXTENSIONS = new Set([
401
+ ".png",
402
+ ".jpg",
403
+ ".jpeg",
404
+ ".gif",
405
+ ".wmf",
406
+ ".emf",
407
+ ".tif",
408
+ ".tiff",
409
+ ".avi",
410
+ ".mp4",
411
+ ".mp3",
412
+ ".wav"
413
+ ]);
414
+ /** Check if a file path has a media extension that should use STORE (no compression). */
415
+ function isMediaPath(path) {
416
+ const dot = path.lastIndexOf(".");
417
+ if (dot === -1) return false;
418
+ return MEDIA_EXTENSIONS.has(path.slice(dot).toLowerCase());
419
+ }
420
+ /** STORE level for already-compressed media formats. */
421
+ const MEDIA_STORED_LEVEL = 0;
422
+ /** Parse an OOXML archive (.docx, .pptx, .xlsx) into a ParsedArchive. */
423
+ function parseArchive(data) {
424
+ return new ParsedArchive(data);
425
+ }
426
+ //#endregion
427
+ //#region src/opc/opc-consistency.ts
428
+ /**
429
+ * OPC (Open Packaging Convention) consistency validator.
430
+ *
431
+ * Pure function operating on an already-unzipped part map. Detects the three
432
+ * classes of cross-part breakage that single-part XSD validation cannot see:
433
+ *
434
+ * - relationship integrity — dangling targets, duplicate rIds (O3/O7)
435
+ * - content-type integrity — parts with no Override/Default, stale
436
+ * Overrides pointing at absent parts (O5/O6)
437
+ * - structural integrity — missing `always` parts, undeclared orphans
438
+ * (O1/O2)
439
+ *
440
+ * O3/O5/O6/O7 are derived directly from the ZIP + `.rels` + `[Content_Types].xml`
441
+ * and need no registry. O1/O2 consult {@link PackagePartRegistry}.
442
+ *
443
+ * Reference: ECMA-376 Part 2 (OPC).
444
+ *
445
+ * @module
446
+ */
447
+ function rootElement(xml) {
448
+ try {
449
+ return xml2js(xml).elements?.find((e) => e.type === "element");
450
+ } catch {
451
+ return;
452
+ }
453
+ }
454
+ function parseContentTypes(entries) {
455
+ const defaults = /* @__PURE__ */ new Map();
456
+ const overrides = /* @__PURE__ */ new Map();
457
+ const xml = entries.get("[Content_Types].xml");
458
+ const root = xml ? rootElement(xml) : void 0;
459
+ if (!root) return {
460
+ defaults,
461
+ overrides
462
+ };
463
+ for (const child of root.elements ?? []) {
464
+ if (child.type !== "element") continue;
465
+ if (child.name === "Default") {
466
+ const ext = String(child.attributes?.Extension ?? "").toLowerCase();
467
+ const ct = String(child.attributes?.ContentType ?? "");
468
+ if (ext && ct) defaults.set(ext, ct);
469
+ } else if (child.name === "Override") {
470
+ const partName = normalizePartName(String(child.attributes?.PartName ?? ""));
471
+ const ct = String(child.attributes?.ContentType ?? "");
472
+ if (partName && ct) overrides.set(partName, ct);
473
+ }
474
+ }
475
+ return {
476
+ defaults,
477
+ overrides
478
+ };
479
+ }
480
+ function parseAllRels(entries) {
481
+ const out = [];
482
+ for (const [relsPath, xml] of entries) {
483
+ if (!relsPath.endsWith(".rels")) continue;
484
+ const root = rootElement(xml);
485
+ if (!root) continue;
486
+ const list = [];
487
+ for (const child of root.elements ?? []) {
488
+ if (child.type !== "element" || child.name !== "Relationship") continue;
489
+ list.push({
490
+ id: String(child.attributes?.Id ?? ""),
491
+ type: String(child.attributes?.Type ?? ""),
492
+ target: String(child.attributes?.Target ?? ""),
493
+ targetMode: child.attributes?.TargetMode ? String(child.attributes?.TargetMode) : void 0
494
+ });
495
+ }
496
+ out.push({
497
+ relsPath,
498
+ entries: list
499
+ });
500
+ }
501
+ return out;
502
+ }
503
+ /** Strip the leading slash OPC uses on `PartName` to align with ZIP paths. */
504
+ function normalizePartName(partName) {
505
+ return partName.startsWith("/") ? partName.slice(1) : partName;
506
+ }
507
+ /**
508
+ * Resolve a relationship `Target` (relative to its owning `.rels`) against the
509
+ * ZIP root. Handles the `..` segments slides/masters use to reference siblings.
510
+ */
511
+ function resolveRelTarget(relsPath, target) {
512
+ const slash = relsPath.lastIndexOf("/");
513
+ const relsDir = slash === -1 ? "" : relsPath.slice(0, slash);
514
+ const base = relsDir === "_rels" ? "" : relsDir.endsWith("/_rels") ? relsDir.slice(0, -6) : relsDir;
515
+ const segments = (base ? base.split("/") : []).concat(target.split("/"));
516
+ const resolved = [];
517
+ for (const seg of segments) {
518
+ if (seg === "" || seg === ".") continue;
519
+ if (seg === "..") resolved.pop();
520
+ else resolved.push(seg);
521
+ }
522
+ return resolved.join("/");
523
+ }
524
+ /** Compile a registry path template (with `${i}`) into an anchored matcher. */
525
+ function pathMatcher(template) {
526
+ const pattern = template.replace(/\$\{i\}/g, "\0").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(//g, "(\\d+)");
527
+ return new RegExp(`^${pattern}$`);
528
+ }
529
+ function extensionOf(path) {
530
+ const dot = path.lastIndexOf(".");
531
+ return dot === -1 ? "" : path.slice(dot + 1).toLowerCase();
532
+ }
533
+ /**
534
+ * Validate OPC consistency of an unzipped package.
535
+ *
536
+ * @param entries ZIP path → decoded XML/binary text. Binary parts (media,
537
+ * fonts) are never parsed here — only their presence matters.
538
+ * @param registry Declarative part expectations for the package format.
539
+ * @returns Issues sorted by code then part. Empty array = consistent.
540
+ */
541
+ function validateOpcConsistency(entries, registry) {
542
+ const issues = [];
543
+ const contentTypes = parseContentTypes(entries);
544
+ const relsFiles = parseAllRels(entries);
545
+ for (const def of registry.parts) {
546
+ if (def.presence.kind !== "always" || def.path.includes("${i}")) continue;
547
+ if (!entries.has(def.path)) issues.push({
548
+ code: "O2",
549
+ severity: "error",
550
+ part: def.path,
551
+ message: `required ${registry.format} part is absent from the package`
552
+ });
553
+ }
554
+ const matchers = registry.parts.map((def) => pathMatcher(def.path));
555
+ for (const path of entries.keys()) {
556
+ if (path === "[Content_Types].xml") continue;
557
+ if (path.endsWith(".rels")) continue;
558
+ if (registry.orphanWhitelist.some((prefix) => path.startsWith(prefix))) continue;
559
+ if (matchers.some((re) => re.test(path))) continue;
560
+ issues.push({
561
+ code: "O1",
562
+ severity: "warn",
563
+ part: path,
564
+ message: `part not declared in the ${registry.format} registry (possible orphan)`
565
+ });
566
+ }
567
+ for (const rf of relsFiles) for (const rel of rf.entries) {
568
+ if (rel.targetMode === "External") continue;
569
+ if (/^https?:\/\//i.test(rel.target)) continue;
570
+ const resolved = resolveRelTarget(rf.relsPath, rel.target);
571
+ if (!resolved || entries.has(resolved)) continue;
572
+ issues.push({
573
+ code: "O3",
574
+ severity: "error",
575
+ part: rf.relsPath,
576
+ message: `relationship ${rel.id || "(no Id)"} (${rel.type}) Target "${rel.target}" resolves to absent part "${resolved}"`
577
+ });
578
+ }
579
+ for (const path of entries.keys()) {
580
+ if (path === "[Content_Types].xml" || path.endsWith(".rels")) continue;
581
+ if (contentTypes.overrides.has(path)) continue;
582
+ const ext = extensionOf(path);
583
+ if (ext && contentTypes.defaults.has(ext)) continue;
584
+ issues.push({
585
+ code: "O5",
586
+ severity: "error",
587
+ part: path,
588
+ message: `part has no [Content_Types] Override and no Default covers extension "${ext || "(none)"}"`
589
+ });
590
+ }
591
+ for (const partName of contentTypes.overrides.keys()) {
592
+ if (entries.has(partName)) continue;
593
+ issues.push({
594
+ code: "O6",
595
+ severity: "error",
596
+ part: `/${partName}`,
597
+ message: `[Content_Types] Override references absent part "${partName}"`
598
+ });
599
+ }
600
+ for (const rf of relsFiles) {
601
+ const counts = /* @__PURE__ */ new Map();
602
+ for (const rel of rf.entries) {
603
+ if (!rel.id) continue;
604
+ counts.set(rel.id, (counts.get(rel.id) ?? 0) + 1);
605
+ }
606
+ for (const [id, count] of counts) {
607
+ if (count <= 1) continue;
608
+ issues.push({
609
+ code: "O7",
610
+ severity: "warn",
611
+ part: rf.relsPath,
612
+ message: `duplicate relationship Id "${id}" appears ${count} times`
613
+ });
614
+ }
615
+ }
616
+ return issues.sort((a, b) => a.code === b.code ? a.part.localeCompare(b.part) : a.code.localeCompare(b.code));
617
+ }
618
+ function summarizeOpcIssues(issues) {
619
+ let errors = 0;
620
+ let warnings = 0;
621
+ for (const i of issues) if (i.severity === "error") errors++;
622
+ else warnings++;
623
+ return {
624
+ errors,
625
+ warnings
626
+ };
627
+ }
628
+ //#endregion
629
+ //#region src/opc/part-registry.ts
630
+ const DOCX_PARTS = {
631
+ format: "docx",
632
+ orphanWhitelist: [
633
+ "word/media/",
634
+ "word/fonts/",
635
+ "word/embeddings/",
636
+ "word/afchunks/",
637
+ "customXml/",
638
+ "_rels/",
639
+ "word/_rels/",
640
+ "docProps/",
641
+ "[Content_Types].xml"
642
+ ],
643
+ parts: [
644
+ {
645
+ path: "[Content_Types].xml",
646
+ presence: { kind: "always" }
647
+ },
648
+ {
649
+ path: "_rels/.rels",
650
+ presence: { kind: "always" }
651
+ },
652
+ {
653
+ path: "word/document.xml",
654
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
655
+ presence: { kind: "always" }
656
+ },
657
+ {
658
+ path: "word/styles.xml",
659
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
660
+ presence: {
661
+ kind: "conditional",
662
+ flag: "freshCompile"
663
+ }
664
+ },
665
+ {
666
+ path: "word/numbering.xml",
667
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
668
+ presence: {
669
+ kind: "conditional",
670
+ flag: "freshCompile"
671
+ }
672
+ },
673
+ {
674
+ path: "word/footnotes.xml",
675
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",
676
+ presence: {
677
+ kind: "conditional",
678
+ flag: "freshCompile"
679
+ }
680
+ },
681
+ {
682
+ path: "word/endnotes.xml",
683
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",
684
+ presence: {
685
+ kind: "conditional",
686
+ flag: "freshCompile"
687
+ }
688
+ },
689
+ {
690
+ path: "word/settings.xml",
691
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
692
+ presence: {
693
+ kind: "conditional",
694
+ flag: "freshCompile"
695
+ }
696
+ },
697
+ {
698
+ path: "word/fontTable.xml",
699
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml",
700
+ presence: {
701
+ kind: "conditional",
702
+ flag: "freshCompile"
703
+ }
704
+ },
705
+ {
706
+ path: "docProps/core.xml",
707
+ contentType: "application/vnd.openxmlformats-package.core-properties+xml",
708
+ presence: {
709
+ kind: "conditional",
710
+ flag: "freshCompile"
711
+ }
712
+ },
713
+ {
714
+ path: "docProps/app.xml",
715
+ contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
716
+ presence: {
717
+ kind: "conditional",
718
+ flag: "freshCompile"
719
+ }
720
+ },
721
+ {
722
+ path: "docProps/custom.xml",
723
+ contentType: "application/vnd.openxmlformats-officedocument.custom-properties+xml",
724
+ presence: {
725
+ kind: "conditional",
726
+ flag: "freshCompile"
727
+ }
728
+ },
729
+ {
730
+ path: "word/comments.xml",
731
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
732
+ presence: {
733
+ kind: "conditional",
734
+ flag: "hasComments"
735
+ }
736
+ },
737
+ {
738
+ path: "word/header${i}.xml",
739
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
740
+ presence: {
741
+ kind: "repeated",
742
+ countFrom: "headerCount"
743
+ }
744
+ },
745
+ {
746
+ path: "word/footer${i}.xml",
747
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
748
+ presence: {
749
+ kind: "repeated",
750
+ countFrom: "footerCount"
751
+ }
752
+ },
753
+ {
754
+ path: "word/charts/chart${i}.xml",
755
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
756
+ presence: {
757
+ kind: "repeated",
758
+ countFrom: "chartCount"
759
+ }
760
+ },
761
+ {
762
+ path: "word/diagrams/data${i}.xml",
763
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",
764
+ presence: {
765
+ kind: "repeated",
766
+ countFrom: "smartArtCount"
767
+ }
768
+ },
769
+ {
770
+ path: "word/diagrams/layout${i}.xml",
771
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml",
772
+ presence: {
773
+ kind: "repeated",
774
+ countFrom: "smartArtCount"
775
+ }
776
+ },
777
+ {
778
+ path: "word/diagrams/quickStyle${i}.xml",
779
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml",
780
+ presence: {
781
+ kind: "repeated",
782
+ countFrom: "smartArtCount"
783
+ }
784
+ },
785
+ {
786
+ path: "word/diagrams/colors${i}.xml",
787
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml",
788
+ presence: {
789
+ kind: "repeated",
790
+ countFrom: "smartArtCount"
791
+ }
792
+ },
793
+ {
794
+ path: "word/diagrams/drawing${i}.xml",
795
+ contentType: "application/vnd.ms-office.drawingml.diagramDrawing+xml",
796
+ presence: {
797
+ kind: "repeated",
798
+ countFrom: "smartArtCount"
799
+ }
800
+ },
801
+ {
802
+ path: "word/bibliography.xml",
803
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.bibliography+xml",
804
+ presence: {
805
+ kind: "conditional",
806
+ flag: "hasBibliography"
807
+ }
808
+ },
809
+ {
810
+ path: "word/glossary/document.xml",
811
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.glossary+xml",
812
+ presence: {
813
+ kind: "conditional",
814
+ flag: "hasGlossary"
815
+ }
816
+ },
817
+ {
818
+ path: "word/webSettings.xml",
819
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml",
820
+ presence: {
821
+ kind: "conditional",
822
+ flag: "hasWebSettings"
823
+ }
824
+ },
825
+ {
826
+ path: "word/theme/theme1.xml",
827
+ contentType: "application/vnd.openxmlformats-officedocument.theme+xml",
828
+ presence: {
829
+ kind: "conditional",
830
+ flag: "freshCompile"
831
+ }
832
+ }
833
+ ]
834
+ };
835
+ const PPTX_PARTS = {
836
+ format: "pptx",
837
+ orphanWhitelist: [
838
+ "ppt/media/",
839
+ "ppt/embeddings/",
840
+ "_rels/",
841
+ "ppt/_rels/",
842
+ "ppt/slideMasters/_rels/",
843
+ "ppt/slideLayouts/_rels/",
844
+ "ppt/slides/_rels/",
845
+ "ppt/notesMasters/_rels/",
846
+ "ppt/notesSlides/_rels/",
847
+ "ppt/charts/_rels/",
848
+ "ppt/diagrams/_rels/",
849
+ "docProps/",
850
+ "[Content_Types].xml"
851
+ ],
852
+ parts: [
853
+ {
854
+ path: "[Content_Types].xml",
855
+ presence: { kind: "always" }
856
+ },
857
+ {
858
+ path: "_rels/.rels",
859
+ presence: { kind: "always" }
860
+ },
861
+ {
862
+ path: "ppt/presentation.xml",
863
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",
864
+ presence: { kind: "always" }
865
+ },
866
+ {
867
+ path: "docProps/core.xml",
868
+ contentType: "application/vnd.openxmlformats-package.core-properties+xml",
869
+ presence: {
870
+ kind: "conditional",
871
+ flag: "freshCompile"
872
+ }
873
+ },
874
+ {
875
+ path: "docProps/app.xml",
876
+ contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
877
+ presence: {
878
+ kind: "conditional",
879
+ flag: "freshCompile"
880
+ }
881
+ },
882
+ {
883
+ path: "ppt/theme/theme${i}.xml",
884
+ contentType: "application/vnd.openxmlformats-officedocument.theme+xml",
885
+ presence: {
886
+ kind: "repeated",
887
+ countFrom: "masters + notes/handout masters"
888
+ }
889
+ },
890
+ {
891
+ path: "ppt/presProps.xml",
892
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml",
893
+ presence: {
894
+ kind: "conditional",
895
+ flag: "freshCompile"
896
+ }
897
+ },
898
+ {
899
+ path: "ppt/viewProps.xml",
900
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml",
901
+ presence: {
902
+ kind: "conditional",
903
+ flag: "freshCompile"
904
+ }
905
+ },
906
+ {
907
+ path: "ppt/tableStyles.xml",
908
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",
909
+ presence: {
910
+ kind: "conditional",
911
+ flag: "freshCompile"
912
+ }
913
+ },
914
+ {
915
+ path: "ppt/slideMasters/slideMaster${i}.xml",
916
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",
917
+ presence: {
918
+ kind: "repeated",
919
+ countFrom: "masters.length"
920
+ }
921
+ },
922
+ {
923
+ path: "ppt/slideLayouts/slideLayout${i}.xml",
924
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",
925
+ presence: {
926
+ kind: "repeated",
927
+ countFrom: "layouts.length"
928
+ }
929
+ },
930
+ {
931
+ path: "ppt/slides/slide${i}.xml",
932
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.slide+xml",
933
+ presence: {
934
+ kind: "repeated",
935
+ countFrom: "slides.length"
936
+ }
937
+ },
938
+ {
939
+ path: "ppt/notesMasters/notesMaster1.xml",
940
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml",
941
+ presence: {
942
+ kind: "conditional",
943
+ flag: "any slide has notes"
944
+ }
945
+ },
946
+ {
947
+ path: "ppt/handoutMasters/handoutMaster1.xml",
948
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml",
949
+ presence: {
950
+ kind: "conditional",
951
+ flag: "includeHandoutMaster"
952
+ }
953
+ },
954
+ {
955
+ path: "ppt/notesSlides/notesSlide${i}.xml",
956
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",
957
+ presence: {
958
+ kind: "repeated",
959
+ countFrom: "slides with notes"
960
+ }
961
+ },
962
+ {
963
+ path: "ppt/commentAuthors.xml",
964
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml",
965
+ presence: {
966
+ kind: "conditional",
967
+ flag: "any slide has comments"
968
+ }
969
+ },
970
+ {
971
+ path: "ppt/comments/comment${i}.xml",
972
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.comments+xml",
973
+ presence: {
974
+ kind: "repeated",
975
+ countFrom: "slides with comments"
976
+ }
977
+ },
978
+ {
979
+ path: "ppt/charts/chart${i}.xml",
980
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
981
+ presence: {
982
+ kind: "repeated",
983
+ countFrom: "charts"
984
+ }
985
+ },
986
+ {
987
+ path: "ppt/diagrams/data${i}.xml",
988
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",
989
+ presence: {
990
+ kind: "repeated",
991
+ countFrom: "smartArts"
992
+ }
993
+ },
994
+ {
995
+ path: "ppt/diagrams/layout${i}.xml",
996
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml",
997
+ presence: {
998
+ kind: "repeated",
999
+ countFrom: "smartArts"
1000
+ }
1001
+ },
1002
+ {
1003
+ path: "ppt/diagrams/quickStyle${i}.xml",
1004
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml",
1005
+ presence: {
1006
+ kind: "repeated",
1007
+ countFrom: "smartArts"
1008
+ }
1009
+ },
1010
+ {
1011
+ path: "ppt/diagrams/colors${i}.xml",
1012
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml",
1013
+ presence: {
1014
+ kind: "repeated",
1015
+ countFrom: "smartArts"
1016
+ }
1017
+ },
1018
+ {
1019
+ path: "ppt/diagrams/drawing${i}.xml",
1020
+ contentType: "application/vnd.ms-office.drawingml.diagramDrawing+xml",
1021
+ presence: {
1022
+ kind: "repeated",
1023
+ countFrom: "smartArts"
1024
+ }
1025
+ },
1026
+ {
1027
+ path: "ppt/slideSyncPr/slideSyncPr${i}.xml",
1028
+ contentType: "application/vnd.openxmlformats-officedocument.presentationml.slideSyncProperties+xml",
1029
+ presence: {
1030
+ kind: "repeated",
1031
+ countFrom: "slides with slideSync"
1032
+ }
1033
+ }
1034
+ ]
1035
+ };
1036
+ const XLSX_PARTS = {
1037
+ format: "xlsx",
1038
+ orphanWhitelist: [
1039
+ "xl/media/",
1040
+ "xl/embeddings/",
1041
+ "_rels/",
1042
+ "xl/_rels/",
1043
+ "xl/worksheets/_rels/",
1044
+ "xl/chartsheets/_rels/",
1045
+ "xl/drawings/_rels/",
1046
+ "xl/pivotTables/_rels/",
1047
+ "xl/pivotCache/_rels/",
1048
+ "xl/externalLinks/_rels/",
1049
+ "docProps/",
1050
+ "[Content_Types].xml"
1051
+ ],
1052
+ parts: [
1053
+ {
1054
+ path: "[Content_Types].xml",
1055
+ presence: { kind: "always" }
1056
+ },
1057
+ {
1058
+ path: "_rels/.rels",
1059
+ presence: { kind: "always" }
1060
+ },
1061
+ {
1062
+ path: "xl/workbook.xml",
1063
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
1064
+ presence: { kind: "always" }
1065
+ },
1066
+ {
1067
+ path: "docProps/core.xml",
1068
+ contentType: "application/vnd.openxmlformats-package.core-properties+xml",
1069
+ presence: {
1070
+ kind: "conditional",
1071
+ flag: "freshCompile"
1072
+ }
1073
+ },
1074
+ {
1075
+ path: "docProps/app.xml",
1076
+ contentType: "application/vnd.openxmlformats-officedocument.extended-properties+xml",
1077
+ presence: {
1078
+ kind: "conditional",
1079
+ flag: "freshCompile"
1080
+ }
1081
+ },
1082
+ {
1083
+ path: "xl/styles.xml",
1084
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
1085
+ presence: {
1086
+ kind: "conditional",
1087
+ flag: "freshCompile"
1088
+ }
1089
+ },
1090
+ {
1091
+ path: "xl/theme/theme1.xml",
1092
+ contentType: "application/vnd.openxmlformats-officedocument.theme+xml",
1093
+ presence: {
1094
+ kind: "conditional",
1095
+ flag: "freshCompile"
1096
+ }
1097
+ },
1098
+ {
1099
+ path: "xl/sharedStrings.xml",
1100
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
1101
+ presence: {
1102
+ kind: "conditional",
1103
+ flag: "sharedStrings.count > 0"
1104
+ }
1105
+ },
1106
+ {
1107
+ path: "xl/worksheets/sheet${i}.xml",
1108
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
1109
+ presence: {
1110
+ kind: "repeated",
1111
+ countFrom: "worksheets.length"
1112
+ }
1113
+ },
1114
+ {
1115
+ path: "xl/chartsheets/sheet${i}.xml",
1116
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",
1117
+ presence: {
1118
+ kind: "repeated",
1119
+ countFrom: "chartsheets.length"
1120
+ }
1121
+ },
1122
+ {
1123
+ path: "xl/drawings/drawing${i}.xml",
1124
+ contentType: "application/vnd.openxmlformats-officedocument.drawing+xml",
1125
+ presence: {
1126
+ kind: "conditional",
1127
+ flag: "worksheet has drawing"
1128
+ }
1129
+ },
1130
+ {
1131
+ path: "xl/comments${i}.xml",
1132
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
1133
+ presence: {
1134
+ kind: "conditional",
1135
+ flag: "worksheet.comments.length > 0"
1136
+ }
1137
+ },
1138
+ {
1139
+ path: "xl/drawings/vmlDrawing${i}.vml",
1140
+ presence: {
1141
+ kind: "conditional",
1142
+ flag: "worksheet.comments (legacy VML)"
1143
+ }
1144
+ },
1145
+ {
1146
+ path: "xl/charts/chart${i}.xml",
1147
+ contentType: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
1148
+ presence: {
1149
+ kind: "repeated",
1150
+ countFrom: "charts"
1151
+ }
1152
+ },
1153
+ {
1154
+ path: "xl/pivotTables/pivotTable${i}.xml",
1155
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
1156
+ presence: {
1157
+ kind: "repeated",
1158
+ countFrom: "pivotTables"
1159
+ }
1160
+ },
1161
+ {
1162
+ path: "xl/pivotCache/pivotCacheDefinition${i}.xml",
1163
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml",
1164
+ presence: {
1165
+ kind: "repeated",
1166
+ countFrom: "pivotCaches"
1167
+ }
1168
+ },
1169
+ {
1170
+ path: "xl/pivotCache/pivotCacheRecords${i}.xml",
1171
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml",
1172
+ presence: {
1173
+ kind: "repeated",
1174
+ countFrom: "pivotCaches"
1175
+ }
1176
+ },
1177
+ {
1178
+ path: "xl/tables/table${i}.xml",
1179
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
1180
+ presence: {
1181
+ kind: "repeated",
1182
+ countFrom: "tables"
1183
+ }
1184
+ },
1185
+ {
1186
+ path: "xl/externalLinks/externalLink${i}.xml",
1187
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml",
1188
+ presence: {
1189
+ kind: "repeated",
1190
+ countFrom: "externalLinks.length"
1191
+ }
1192
+ },
1193
+ {
1194
+ path: "xl/calcChain.xml",
1195
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml",
1196
+ presence: {
1197
+ kind: "conditional",
1198
+ flag: "any formula cell"
1199
+ }
1200
+ },
1201
+ {
1202
+ path: "xl/revisionHeaders.xml",
1203
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml",
1204
+ presence: {
1205
+ kind: "conditional",
1206
+ flag: "revisionLog"
1207
+ }
1208
+ },
1209
+ {
1210
+ path: "xl/revisions/revision${i}.xml",
1211
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml",
1212
+ presence: {
1213
+ kind: "repeated",
1214
+ countFrom: "revisionLog.logs.length"
1215
+ }
1216
+ },
1217
+ {
1218
+ path: "xl/users.xml",
1219
+ contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.users+xml",
1220
+ presence: {
1221
+ kind: "conditional",
1222
+ flag: "revisionLog.users"
1223
+ }
1224
+ }
1225
+ ]
1226
+ };
1227
+ const PART_REGISTRIES = {
1228
+ docx: DOCX_PARTS,
1229
+ pptx: PPTX_PARTS,
1230
+ xlsx: XLSX_PARTS
1231
+ };
1232
+ //#endregion
1233
+ //#region src/opc/content-type-overrides.ts
1234
+ /** Ensure a part path carries the leading slash an Override PartName requires. */
1235
+ function withLeadingSlash(partPath) {
1236
+ return partPath.startsWith("/") ? partPath : `/${partPath}`;
1237
+ }
1238
+ /**
1239
+ * Derive [Content_Types].xml Override entries for every registry part present
1240
+ * under `facts`. The `facts` keys mirror the registry's `flag` / `countFrom`
1241
+ * tokens: a boolean for `conditional` parts, a count for `repeated` parts.
1242
+ * Order follows `registry.parts`; OPC does not mandate Override order.
1243
+ */
1244
+ function buildContentTypeOverrides(registry, facts) {
1245
+ const overrides = [];
1246
+ for (const part of registry.parts) {
1247
+ if (!part.contentType) continue;
1248
+ const presence = part.presence;
1249
+ if (presence.kind === "always") {
1250
+ if (!part.path.includes("${i}")) overrides.push({
1251
+ partName: withLeadingSlash(part.path),
1252
+ contentType: part.contentType
1253
+ });
1254
+ } else if (presence.kind === "conditional") {
1255
+ if (facts.get(presence.flag)) overrides.push({
1256
+ partName: withLeadingSlash(part.path),
1257
+ contentType: part.contentType
1258
+ });
1259
+ } else {
1260
+ const count = Number(facts.get(presence.countFrom) ?? 0);
1261
+ for (let i = 1; i <= count; i++) overrides.push({
1262
+ partName: withLeadingSlash(part.path.replace("${i}", String(i))),
1263
+ contentType: part.contentType
1264
+ });
1265
+ }
1266
+ }
1267
+ return overrides;
1268
+ }
1269
+ //#endregion
1270
+ export { AnimateOneByOneValue, AnimationLevelValue, BevelPresetType, BlendMode, COLOR_CATEGORIES, ChartCollection, ColorMethod, CompoundLine, DEFAULT_COLORS, DEFAULT_DRAWING_XML, DOCX_NS, DOCX_PARTS, DataLabelPosition, ErrorBarDirection, ErrorBarType, ErrorValueType, FIELD_SPECS, FontCollectionIndex, HierBranchStyle, HueDirection, LAYOUT_CATEGORIES, LineCap, LineEndLength, LineEndType, LineEndWidth, LineJoin, Media, OoxmlMimeType, PART_REGISTRIES, PPTX_NS, PPTX_PARTS, ParsedArchive, PathShadeType, PenAlignment, PresetColor, PresetDash, PresetMaterialType, PresetPattern, PresetShadowVal, RectAlignment, Relationships, STYLE_CATEGORIES, SchemeColor, SmartArtCollection, StyleMatrixIndex, SystemColor, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TimeUnit, TokenNotFoundError, TrendlineType, XLSX_PARTS, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, appPropertiesDesc, appendContentType, appendOverride, appendRelationship, applyCorePropertiesOverride, bevelDesc, blipDesc, blipFillDesc, buildContentTypeOverrides, buildCorePropertiesXmlString, buildFill, buildThemeXml, calculateEffectExtent, chartSpaceDesc, checkOrder, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertToEmu, convertToInch, convertToPt, convertToTwip, convertUniversalMeasureToEmu, convertUniversalMeasureToInch, convertUniversalMeasureToPt, convertUniversalMeasureToTwip, createAdjust, createAdjustList, createAnimateOneByOne, createAnimationLevel, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createColorsDefinitionHeader, createColorsDefinitionHeaderList, createCustomDash, createCustomGeometry, createDataModel, createDefault, createDiagramExtensionList, createDiagramRelationshipIds, createDiagramShape3D, createDiagramStyle, createDiagramTextProperties, createEffectColorList, createEffectDag, createEffectList, createExtensionList, createFillColorList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGraphicFrameLocking, createGroupFill, createGroupLocking, createGroupTransform2D, createHierBranch, createHslColor, createInnerShadowEffect, createLayoutDefinitionHeader, createLayoutDefinitionHeaderList, createLineColorList, createLineEnd, createMaxChildren, createNoFill, createOrgChart, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPictureLocking, createPreferredChildren, createPresentationLayoutVariables, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createShapeLocking, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStyleDefinitionHeader, createStyleDefinitionHeaderList, createStyleLabel, createSystemColor, createTableStyle, createTableStyleList, createTextEffectColorList, createTextElementContents, createTextFillColorList, createTextLineColorList, createThemeXml, createTileInfo, createTokenReplacer, createTransform2D, createTraverser, createZipStream, customGeometryDesc, customPropertiesDesc, dateTimeValue, decimalNumber, decodeBase64, derivePasswordHash, diagramExtensionListDesc, diagramRelationshipIdsDesc, diagramStyleDesc, diffTagSets, effectListDesc, eighthPointMeasureValue, encodeBase64, extractBlipFillMedia, fillDesc, findAndReplaceImagePlaceholders, findFieldSpec, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getMediaRefs, getNextRelationshipIndex, getReferencedMedia, getStyleXml, getVideoRefs, gradientFillDesc, graphicFrameLockingDesc, groupLockingDesc, groupTransform2DDesc, hasPlaceholders, hashPasswordAgile, hashedId, hexBinary, hexColorValue, hpsMeasureValue, hslColorDesc, invertMap, isBase64DataURL, levelForMediaName, longHexNumber, measurementOrPercentValue, nextNumericId, optionalRelsPart, outlineDesc, parse, parseArchive, parseColorChoice, parseCorePropsElement, parseTableStyleList, parseUniversalMeasure, patchSpaceAttribute, patternFillDesc, percentageValue, pictureLockingDesc, pointMeasureValue, positiveUniversalMeasureValue, presentationLayoutVariablesDesc, presetColorDesc, presetGeometryDesc, randomBytes, replaceAllPlaceholders, replaceChartPlaceholders, replaceHyperlinkPlaceholders, replaceImagePlaceholders, replaceMediaPlaceholders, replaceNumberingPlaceholders, replaceSmartArtPlaceholders, replaceVideoPlaceholders, rgbColorDesc, roundTripFields, scRgbColorDesc, scene3DDesc, schemeColorDesc, shape3DDesc, shapeLockingDesc, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, solidFillDesc, sourceRectangleDesc, strFromU8, stretchDesc, stringify, stringifyAdjustmentValues, stringifyColorChoice, stringifyConnection, stringifyDataModel, stringifyPoint, stringifyPresetGeometry, stringifyStretch, stringifyTransPoint, summarizeOpcIssues, systemColorDesc, themeDesc, tileDesc, toJson, toUint8Array, transform2DDesc, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, validateOpcConsistency, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
1271
+
1272
+ //# sourceMappingURL=index.mjs.map