ooxml-core 1.27.2 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-WRJXTPGV.mjs → PptxHandler-AFVUHNJO.mjs} +3 -3
- package/dist/PptxHandler-EZW4YAWL.mjs +4 -0
- package/dist/{PptxHandler-FRQKHTCM.cjs → PptxHandler-WI23AJHM.cjs} +3 -3
- package/dist/{PresentationBuilder-POXKHTV7.mjs → PresentationBuilder-DYEHCRHX.mjs} +2 -2
- package/dist/{PresentationBuilder-YO5YOTA3.cjs → PresentationBuilder-KUNPJTRL.cjs} +5 -5
- package/dist/{PresentationBuilder-LWR5X3JA.mjs → PresentationBuilder-WGTZPVOG.mjs} +3 -3
- package/dist/automation/index.cjs +16 -7
- package/dist/automation/index.mjs +16 -7
- package/dist/chart/index.cjs +16 -7
- package/dist/chart/index.mjs +16 -7
- package/dist/{chunk-36TR3PER.cjs → chunk-A2PC3CBO.cjs} +28 -7
- package/dist/{chunk-XW4XB6P4.mjs → chunk-D7CAHL6J.mjs} +1 -1
- package/dist/{chunk-JJ37PCNR.mjs → chunk-EYCM7RVL.mjs} +28 -7
- package/dist/{chunk-K6DNX3YC.cjs → chunk-IQ7CB7BJ.cjs} +1581 -1232
- package/dist/{chunk-G67MARDL.mjs → chunk-LGSBK3BV.mjs} +258 -258
- package/dist/{chunk-I57SMSU6.mjs → chunk-LNPVKKR5.mjs} +28 -7
- package/dist/{chunk-RNUYMB73.mjs → chunk-N5ROEHEQ.mjs} +509 -160
- package/dist/{chunk-TIQWSSGI.mjs → chunk-RCEHCVLC.mjs} +1 -1
- package/dist/{chunk-3VIPI6IA.mjs → chunk-V33RUK4D.mjs} +5 -5
- package/dist/{chunk-6LCBTFNL.mjs → chunk-YNGMSNF4.mjs} +528 -159
- package/dist/docx/embedded.cjs +16 -7
- package/dist/docx/embedded.mjs +16 -7
- package/dist/docx/index.cjs +16 -7
- package/dist/docx/index.mjs +16 -7
- package/dist/docx/load/index.cjs +16 -7
- package/dist/docx/load/index.mjs +16 -7
- package/dist/index.cjs +16 -7
- package/dist/index.mjs +16 -7
- package/dist/opc/index.cjs +16 -7
- package/dist/opc/index.mjs +16 -7
- package/dist/opc/zip-limits.d.ts +8 -1
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +807 -418
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-D_d4NTVP.d.ts → index-0slnMhMO.d.ts} +126 -10
- package/dist/pptx/chunks/index-0slnMhMO.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CdRlUz-v.d.ts → index-DP-R2qY1.d.ts} +3 -3
- package/dist/pptx/chunks/{index-CdRlUz-v.d.ts.map → index-DP-R2qY1.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-lwMA6pP5.d.ts → index-OQwOyNYK.d.ts} +4 -4
- package/dist/pptx/chunks/{index-lwMA6pP5.d.ts.map → index-OQwOyNYK.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts → text-operations-dyvh8gyE.d.ts} +23 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts.map → text-operations-dyvh8gyE.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +632 -246
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +1047 -639
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/signature-node/index.cjs +28 -7
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/visio/index.cjs +14 -6
- package/dist/visio/index.mjs +14 -6
- package/dist/visio/ui/index.cjs +14 -6
- package/dist/visio/ui/index.mjs +14 -6
- package/dist/xlsx/index.cjs +14 -6
- package/dist/xlsx/index.mjs +14 -6
- package/dist/xlsx/load/index.cjs +14 -6
- package/dist/xlsx/load/index.mjs +14 -6
- package/dist/xlsx/ui/index.cjs +14 -6
- package/dist/xlsx/ui/index.mjs +14 -6
- package/package.json +5 -5
- package/dist/PptxHandler-RETSKQ5E.mjs +0 -4
- package/dist/pptx/chunks/index-D_d4NTVP.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, themeColorRefFromColorChoice, formatAutoNumberMarker, cloneXmlObject, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, applySmartArtLayoutDefinition, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, tableCellTextBodyMatches, ensureXmlChildren, TC_PR_BORDERS_ORDER, relAttr, buildXml, writeChartColorChoice, first, stripParentDirSegments, children, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, attr, openZip, readChartManualLayoutValues, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS, themeColorRefToSolidFillWithOpacity, FONT_ADVANCE_TABLES, DEFAULT_FONT_ADVANCE_TABLE, measureTextWidth, applyDrawingColorTransforms, applyThemeToData, detectFileFormat, parseOle2, EncryptedFileError, decryptPptx, encryptPptx, encodeXmlAttributeValue, encodeXmlTextValue, svgToCustomGeometryPaths, IncorrectPasswordError, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, stripXmlOrderMarkers, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, deriveSlideTitles, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, cloneSlide, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, effectChild, mergeEffectNode, mergeAttributeEffectNode, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, estimateMediaDurationMs, parseVmlElements, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, formatSchemeKey, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName,
|
|
1
|
+
import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, themeColorRefFromColorChoice, formatAutoNumberMarker, cloneXmlObject, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, applySmartArtLayoutDefinition, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, tableCellTextBodyMatches, ensureXmlChildren, TC_PR_BORDERS_ORDER, relAttr, buildXml, writeChartColorChoice, first, stripParentDirSegments, children, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, attr, openZip, readChartManualLayoutValues, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS, themeColorRefToSolidFillWithOpacity, FONT_ADVANCE_TABLES, DEFAULT_FONT_ADVANCE_TABLE, measureTextWidth, applyDrawingColorTransforms, applyThemeToData, detectFileFormat, parseOle2, EncryptedFileError, decryptPptx, encryptPptx, MAX_ZIP_ENTRY_COUNT, DEFAULT_MAX_UNCOMPRESSED_BYTES, encodeXmlAttributeValue, encodeXmlTextValue, svgToCustomGeometryPaths, IncorrectPasswordError, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, stripXmlOrderMarkers, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, deriveSlideTitles, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, cloneSlide, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, effectChild, mergeEffectNode, mergeAttributeEffectNode, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, estimateMediaDurationMs, parseVmlElements, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, formatSchemeKey, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, guardZip, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, themeColorRefFromSchemeClr, ZipBombError, parseKinsoku, deobfuscateFont, detectFontFormat, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, extractGuidFromPartName, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtLayoutDefinition, parseSmartArtPresLayoutVars, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, blendColorOntoWhite } from './chunk-LNPVKKR5.mjs';
|
|
2
2
|
import { hasShapeProperties, hasTextProperties } from './chunk-GXHKNSZX.mjs';
|
|
3
3
|
import { EMU_PER_PX, EMU_PER_PIXEL, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, OOXML_PERCENT_UNITS, EMU_PER_POINT } from './chunk-CA7KCNL3.mjs';
|
|
4
4
|
import JSZip from 'jszip';
|
|
@@ -498,9 +498,6 @@ function pptxDataFromJsonDocument(document2) {
|
|
|
498
498
|
data.slides = document2.slides.map((slide) => deserializeSlide(slide));
|
|
499
499
|
return data;
|
|
500
500
|
}
|
|
501
|
-
function deserializePptxFromJson(text) {
|
|
502
|
-
return pptxDataFromJsonDocument(parsePptxJson(text));
|
|
503
|
-
}
|
|
504
501
|
function deserializeSlide(encoded) {
|
|
505
502
|
const slide = {};
|
|
506
503
|
for (const key2 of Object.keys(SLIDE_FIELD_KIND)) {
|
|
@@ -548,6 +545,181 @@ function applyImportedPptxData(base, imported) {
|
|
|
548
545
|
return base;
|
|
549
546
|
}
|
|
550
547
|
|
|
548
|
+
// pptx/core/core/load-limits.ts
|
|
549
|
+
var DEFAULT_PPTX_LOAD_LIMITS = Object.freeze({
|
|
550
|
+
maxInputBytes: Number.POSITIVE_INFINITY,
|
|
551
|
+
maxUncompressedBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
552
|
+
maxEntries: MAX_ZIP_ENTRY_COUNT,
|
|
553
|
+
maxSlides: Number.POSITIVE_INFINITY,
|
|
554
|
+
maxShapes: Number.POSITIVE_INFINITY
|
|
555
|
+
});
|
|
556
|
+
var LIMIT_NAMES = Object.keys(DEFAULT_PPTX_LOAD_LIMITS);
|
|
557
|
+
var PptxLoadLimitError = class extends Error {
|
|
558
|
+
code = "PPTX_LOAD_LIMIT";
|
|
559
|
+
/** The limit that was exceeded. */
|
|
560
|
+
limit;
|
|
561
|
+
/** The value of that limit. */
|
|
562
|
+
maximum;
|
|
563
|
+
/**
|
|
564
|
+
* The observed value: exact for `maxSlides` and for `maxInputBytes` on
|
|
565
|
+
* `load()`; for `maxShapes`, and for `maxInputBytes` on `loadFromJson()`
|
|
566
|
+
* (which stops counting once past the limit), a lower bound.
|
|
567
|
+
*/
|
|
568
|
+
actual;
|
|
569
|
+
constructor(message, limit, maximum, actual) {
|
|
570
|
+
super(message);
|
|
571
|
+
this.name = "PptxLoadLimitError";
|
|
572
|
+
this.limit = limit;
|
|
573
|
+
this.maximum = maximum;
|
|
574
|
+
this.actual = actual;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
function resolvePptxLoadLimits(options = {}) {
|
|
578
|
+
const resolved = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
579
|
+
const legacy = options.maxUncompressedBytes;
|
|
580
|
+
if (typeof legacy === "number" && legacy > 0) {
|
|
581
|
+
resolved.maxUncompressedBytes = legacy;
|
|
582
|
+
}
|
|
583
|
+
const limits = options.limits;
|
|
584
|
+
if (limits === void 0 || limits === null) {
|
|
585
|
+
return resolved;
|
|
586
|
+
}
|
|
587
|
+
for (const name of LIMIT_NAMES) {
|
|
588
|
+
const value = limits[name];
|
|
589
|
+
if (value === void 0) {
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
593
|
+
throw new RangeError(`limits.${name} must be a positive finite number`);
|
|
594
|
+
}
|
|
595
|
+
if (name === "maxEntries" && value > MAX_ZIP_ENTRY_COUNT) {
|
|
596
|
+
throw new RangeError(`limits.maxEntries must not exceed ${MAX_ZIP_ENTRY_COUNT}`);
|
|
597
|
+
}
|
|
598
|
+
resolved[name] = value;
|
|
599
|
+
}
|
|
600
|
+
return resolved;
|
|
601
|
+
}
|
|
602
|
+
function createPptxZipBombError(message, details) {
|
|
603
|
+
const { limit, kind, actual } = details;
|
|
604
|
+
if (kind === "maxEntries") {
|
|
605
|
+
return new ZipBombError(message, {
|
|
606
|
+
limit,
|
|
607
|
+
loadLimit: "maxEntries",
|
|
608
|
+
...actual === void 0 ? {} : { entryCount: actual, actual }
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
if (kind === "maxEntryBytes" || kind === "maxTotalBytes") {
|
|
612
|
+
return new ZipBombError(message, {
|
|
613
|
+
limit,
|
|
614
|
+
loadLimit: "maxUncompressedBytes",
|
|
615
|
+
...actual === void 0 ? {} : { uncompressedBytes: actual, actual }
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
return new ZipBombError(message, { limit });
|
|
619
|
+
}
|
|
620
|
+
var count = (value) => value.toLocaleString("en-US");
|
|
621
|
+
function assertPptxInputWithinLimits(byteLength, limits) {
|
|
622
|
+
if (byteLength > limits.maxInputBytes) {
|
|
623
|
+
throw new PptxLoadLimitError(
|
|
624
|
+
`PPTX input is ${count(byteLength)} bytes, more than the maxInputBytes limit of ${count(limits.maxInputBytes)}`,
|
|
625
|
+
"maxInputBytes",
|
|
626
|
+
limits.maxInputBytes,
|
|
627
|
+
byteLength
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function assertPptxTextWithinLimits(text, limits) {
|
|
632
|
+
const maximum = limits.maxInputBytes;
|
|
633
|
+
if (text.length * 3 <= maximum) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const bytes = text.length > maximum ? text.length : utf8ByteLengthPast(text, maximum);
|
|
637
|
+
if (bytes > maximum) {
|
|
638
|
+
throw new PptxLoadLimitError(
|
|
639
|
+
`PPTX input is at least ${count(bytes)} bytes, more than the maxInputBytes limit of ${count(maximum)}`,
|
|
640
|
+
"maxInputBytes",
|
|
641
|
+
maximum,
|
|
642
|
+
bytes
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function utf8ByteLengthPast(text, maximum) {
|
|
647
|
+
let bytes = 0;
|
|
648
|
+
for (let index = 0; index < text.length && bytes <= maximum; index++) {
|
|
649
|
+
const unit = text.charCodeAt(index);
|
|
650
|
+
if (unit < 128) {
|
|
651
|
+
bytes += 1;
|
|
652
|
+
} else if (unit < 2048) {
|
|
653
|
+
bytes += 2;
|
|
654
|
+
} else if (unit >= 55296 && unit <= 56319 && isLowSurrogate(text.charCodeAt(index + 1))) {
|
|
655
|
+
bytes += 4;
|
|
656
|
+
index++;
|
|
657
|
+
} else {
|
|
658
|
+
bytes += 3;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return bytes;
|
|
662
|
+
}
|
|
663
|
+
function isLowSurrogate(unit) {
|
|
664
|
+
return unit >= 56320 && unit <= 57343;
|
|
665
|
+
}
|
|
666
|
+
function assertPptxSlideCountWithinLimits(slideCount, limits) {
|
|
667
|
+
if (slideCount > limits.maxSlides) {
|
|
668
|
+
throw new PptxLoadLimitError(
|
|
669
|
+
`PPTX presentation has ${count(slideCount)} slides, more than the maxSlides limit of ${count(limits.maxSlides)}`,
|
|
670
|
+
"maxSlides",
|
|
671
|
+
limits.maxSlides,
|
|
672
|
+
slideCount
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function countPptxShapesWithinLimits(counted, elements2, limits) {
|
|
677
|
+
const maximum = limits.maxShapes;
|
|
678
|
+
if (maximum === Number.POSITIVE_INFINITY) {
|
|
679
|
+
return counted;
|
|
680
|
+
}
|
|
681
|
+
const total = counted + countAuthoredElements(elements2);
|
|
682
|
+
if (total > maximum) {
|
|
683
|
+
throw new PptxLoadLimitError(
|
|
684
|
+
`PPTX presentation has at least ${count(total)} shapes, more than the maxShapes limit of ${count(maximum)}`,
|
|
685
|
+
"maxShapes",
|
|
686
|
+
maximum,
|
|
687
|
+
total
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
return total;
|
|
691
|
+
}
|
|
692
|
+
function countAuthoredElements(elements2) {
|
|
693
|
+
let total = 0;
|
|
694
|
+
const lists = [elements2];
|
|
695
|
+
const positions = [0];
|
|
696
|
+
while (lists.length > 0) {
|
|
697
|
+
const top = lists.length - 1;
|
|
698
|
+
const list2 = lists[top];
|
|
699
|
+
const position2 = positions[top];
|
|
700
|
+
if (position2 >= list2.length) {
|
|
701
|
+
lists.pop();
|
|
702
|
+
positions.pop();
|
|
703
|
+
continue;
|
|
704
|
+
}
|
|
705
|
+
positions[top] = position2 + 1;
|
|
706
|
+
const element = list2[position2];
|
|
707
|
+
if (typeof element !== "object" || element === null) {
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
const { id, type, children: children6 } = element;
|
|
711
|
+
if (typeof id === "string" && isTemplateElementId(id)) {
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
total++;
|
|
715
|
+
if (type === "group" && Array.isArray(children6) && children6.length > 0) {
|
|
716
|
+
lists.push(children6);
|
|
717
|
+
positions.push(0);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return total;
|
|
721
|
+
}
|
|
722
|
+
|
|
551
723
|
// pptx/core/geometry/preset-adjustment-validation.ts
|
|
552
724
|
function filterValidShapeAdjustmentEntries(presetGeometry, adjustments) {
|
|
553
725
|
if (!adjustments) {
|
|
@@ -627,21 +799,21 @@ function parseChartFormulaRange(formula2) {
|
|
|
627
799
|
}
|
|
628
800
|
return { sheetName, start, end };
|
|
629
801
|
}
|
|
630
|
-
function expandRangeAddresses(range,
|
|
802
|
+
function expandRangeAddresses(range, count2) {
|
|
631
803
|
const { start, end } = range;
|
|
632
|
-
if (
|
|
804
|
+
if (count2 <= 0) {
|
|
633
805
|
return void 0;
|
|
634
806
|
}
|
|
635
807
|
if (start.col === end.col && start.row === end.row) {
|
|
636
|
-
return
|
|
808
|
+
return count2 === 1 ? [formatCellAddress(start)] : void 0;
|
|
637
809
|
}
|
|
638
810
|
if (start.col === end.col) {
|
|
639
811
|
const length = end.row - start.row + 1;
|
|
640
|
-
return length ===
|
|
812
|
+
return length === count2 ? Array.from({ length }, (_, i) => formatCellAddress({ col: start.col, row: start.row + i })) : void 0;
|
|
641
813
|
}
|
|
642
814
|
if (start.row === end.row) {
|
|
643
815
|
const length = end.col - start.col + 1;
|
|
644
|
-
return length ===
|
|
816
|
+
return length === count2 ? Array.from({ length }, (_, i) => formatCellAddress({ col: start.col + i, row: start.row })) : void 0;
|
|
645
817
|
}
|
|
646
818
|
return void 0;
|
|
647
819
|
}
|
|
@@ -1414,8 +1586,8 @@ function readPairs(element, vt) {
|
|
|
1414
1586
|
const out = [];
|
|
1415
1587
|
for (let i = 0; i + 1 < variants.length; i += 2) {
|
|
1416
1588
|
const name = variants[i]?.textContent ?? "";
|
|
1417
|
-
const
|
|
1418
|
-
out.push({ name, count: Number.isFinite(
|
|
1589
|
+
const count2 = Number.parseInt(variants[i + 1]?.textContent ?? "", 10);
|
|
1590
|
+
out.push({ name, count: Number.isFinite(count2) ? count2 : 0 });
|
|
1419
1591
|
}
|
|
1420
1592
|
return out;
|
|
1421
1593
|
}
|
|
@@ -1585,9 +1757,9 @@ function customPropertyFromText(name, type, text) {
|
|
|
1585
1757
|
function titleGroups(headingPairs, titlesOfParts) {
|
|
1586
1758
|
let offset = 0;
|
|
1587
1759
|
return headingPairs.map((pair) => {
|
|
1588
|
-
const
|
|
1589
|
-
const titles = titlesOfParts.slice(offset, offset +
|
|
1590
|
-
offset +=
|
|
1760
|
+
const count2 = Math.max(0, pair.count);
|
|
1761
|
+
const titles = titlesOfParts.slice(offset, offset + count2);
|
|
1762
|
+
offset += count2;
|
|
1591
1763
|
return { name: pair.name, titles };
|
|
1592
1764
|
});
|
|
1593
1765
|
}
|
|
@@ -8232,7 +8404,7 @@ function parsedParagraphSignature(paragraph2) {
|
|
|
8232
8404
|
return signatureOf(counts);
|
|
8233
8405
|
}
|
|
8234
8406
|
function signatureOf(counts) {
|
|
8235
|
-
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name,
|
|
8407
|
+
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
|
|
8236
8408
|
}
|
|
8237
8409
|
function collectParsedParagraphs(root) {
|
|
8238
8410
|
const result = [];
|
|
@@ -11386,23 +11558,23 @@ function classify(chars, index) {
|
|
|
11386
11558
|
}
|
|
11387
11559
|
function countParagraphWords(text) {
|
|
11388
11560
|
const chars = Array.from(text);
|
|
11389
|
-
let
|
|
11561
|
+
let count2 = 0;
|
|
11390
11562
|
let previous = "none";
|
|
11391
11563
|
for (let index = 0; index < chars.length; index++) {
|
|
11392
11564
|
const kind = classify(chars, index);
|
|
11393
11565
|
if (kind === "space") {
|
|
11394
11566
|
if (previous === "none" || previous === "control") {
|
|
11395
|
-
|
|
11567
|
+
count2++;
|
|
11396
11568
|
}
|
|
11397
11569
|
previous = "space";
|
|
11398
11570
|
continue;
|
|
11399
11571
|
}
|
|
11400
11572
|
if (kind === "ideograph" || kind === "control" || kind !== previous) {
|
|
11401
|
-
|
|
11573
|
+
count2++;
|
|
11402
11574
|
}
|
|
11403
11575
|
previous = kind;
|
|
11404
11576
|
}
|
|
11405
|
-
return
|
|
11577
|
+
return count2;
|
|
11406
11578
|
}
|
|
11407
11579
|
|
|
11408
11580
|
// pptx/core/utils/app-properties-text-stats.ts
|
|
@@ -14121,10 +14293,10 @@ function assertAfterAnimationClearSupported(effectCTn) {
|
|
|
14121
14293
|
if (!isXmlObject3(sub)) return;
|
|
14122
14294
|
const countAfterFlags = (value) => {
|
|
14123
14295
|
if (Array.isArray(value))
|
|
14124
|
-
return value.reduce((
|
|
14296
|
+
return value.reduce((count2, child16) => count2 + countAfterFlags(child16), 0);
|
|
14125
14297
|
if (!isXmlObject3(value)) return 0;
|
|
14126
14298
|
return Object.entries(value).reduce(
|
|
14127
|
-
(
|
|
14299
|
+
(count2, [key2, child16]) => count2 + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child16)) ? 1 : countAfterFlags(child16)),
|
|
14128
14300
|
0
|
|
14129
14301
|
);
|
|
14130
14302
|
};
|
|
@@ -35514,8 +35686,8 @@ function reorderContainer(node, rawInner) {
|
|
|
35514
35686
|
if (isGroupedByTag(children6.map((child16) => child16.tag))) {
|
|
35515
35687
|
return;
|
|
35516
35688
|
}
|
|
35517
|
-
for (const [tag,
|
|
35518
|
-
if (ensureItems(node[tag]).length !==
|
|
35689
|
+
for (const [tag, count2] of occurrence) {
|
|
35690
|
+
if (ensureItems(node[tag]).length !== count2) {
|
|
35519
35691
|
return;
|
|
35520
35692
|
}
|
|
35521
35693
|
}
|
|
@@ -35537,8 +35709,8 @@ function annotateOmmlSiblingOrder(xml, parsed) {
|
|
|
35537
35709
|
return;
|
|
35538
35710
|
}
|
|
35539
35711
|
const nodes = collectParsedOmathNodes(parsed);
|
|
35540
|
-
const
|
|
35541
|
-
for (let index = 0; index <
|
|
35712
|
+
const count2 = Math.min(fragments.length, nodes.length);
|
|
35713
|
+
for (let index = 0; index < count2; index++) {
|
|
35542
35714
|
if (fragments[index]) {
|
|
35543
35715
|
reorderContainer(nodes[index], fragments[index]);
|
|
35544
35716
|
}
|
|
@@ -36596,6 +36768,174 @@ function extractFontFromEot(data) {
|
|
|
36596
36768
|
return { fontData, header };
|
|
36597
36769
|
}
|
|
36598
36770
|
|
|
36771
|
+
// pptx/core/utils/deferred-embedded-font.ts
|
|
36772
|
+
function resolveEmbeddedFontGuid(source) {
|
|
36773
|
+
if (isEotFormat(source.originalPartBytes)) {
|
|
36774
|
+
return void 0;
|
|
36775
|
+
}
|
|
36776
|
+
const { fontKey } = source;
|
|
36777
|
+
const fromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
36778
|
+
return fromKey || extractGuidFromPartName(source.partPath) || void 0;
|
|
36779
|
+
}
|
|
36780
|
+
function hasSfntSignature(bytes) {
|
|
36781
|
+
if (bytes.length < 4) {
|
|
36782
|
+
return false;
|
|
36783
|
+
}
|
|
36784
|
+
const [v0, v1, v2, v3] = bytes;
|
|
36785
|
+
return v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0 || v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79 || v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102 || v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
36786
|
+
}
|
|
36787
|
+
function warnInvalidSignature(name, bytes) {
|
|
36788
|
+
const hex3 = Array.from(bytes.subarray(0, 4), (b) => b.toString(16)).join(",");
|
|
36789
|
+
console.warn(
|
|
36790
|
+
`[pptx-viewer] Embedded font "${name}" has invalid sfnt header [${hex3}] after processing; skipping (web font fallback will be used)`
|
|
36791
|
+
);
|
|
36792
|
+
}
|
|
36793
|
+
function isEmbeddedFontPartPlausible(source) {
|
|
36794
|
+
const bytes = source.originalPartBytes;
|
|
36795
|
+
if (bytes.length === 0) {
|
|
36796
|
+
return false;
|
|
36797
|
+
}
|
|
36798
|
+
if (isEotFormat(bytes)) {
|
|
36799
|
+
return true;
|
|
36800
|
+
}
|
|
36801
|
+
const guid = resolveEmbeddedFontGuid(source);
|
|
36802
|
+
if (!guid) {
|
|
36803
|
+
console.warn(
|
|
36804
|
+
`[pptx-viewer] Embedded font "${source.name}" at "${source.partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
36805
|
+
);
|
|
36806
|
+
return false;
|
|
36807
|
+
}
|
|
36808
|
+
const header = deobfuscateFont(bytes.subarray(0, Math.min(bytes.length, 32)), guid);
|
|
36809
|
+
if (header.length < 4) {
|
|
36810
|
+
return false;
|
|
36811
|
+
}
|
|
36812
|
+
if (!hasSfntSignature(header)) {
|
|
36813
|
+
warnInvalidSignature(source.name, header);
|
|
36814
|
+
return false;
|
|
36815
|
+
}
|
|
36816
|
+
return true;
|
|
36817
|
+
}
|
|
36818
|
+
function uint8ArrayToBase64(bytes) {
|
|
36819
|
+
let binary = "";
|
|
36820
|
+
const chunkSize = 8192;
|
|
36821
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
36822
|
+
const chunk = bytes.subarray(i, Math.min(i + chunkSize, bytes.length));
|
|
36823
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
36824
|
+
binary += String.fromCharCode(chunk[j]);
|
|
36825
|
+
}
|
|
36826
|
+
}
|
|
36827
|
+
return btoa(binary);
|
|
36828
|
+
}
|
|
36829
|
+
function decodeEmbeddedFontPart(source) {
|
|
36830
|
+
const { name, partPath, originalPartBytes } = source;
|
|
36831
|
+
try {
|
|
36832
|
+
let fontData;
|
|
36833
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
36834
|
+
if (isEotFormat(originalPartBytes)) {
|
|
36835
|
+
const extracted = extractFontFromEot(originalPartBytes);
|
|
36836
|
+
if (!extracted) {
|
|
36837
|
+
const header = parseEotHeader(originalPartBytes);
|
|
36838
|
+
console.info(
|
|
36839
|
+
`[pptx-viewer] Embedded font "${name}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""}; extraction failed, will use web font fallback`
|
|
36840
|
+
);
|
|
36841
|
+
return null;
|
|
36842
|
+
}
|
|
36843
|
+
fontData = extracted.fontData;
|
|
36844
|
+
} else if (fontGuid) {
|
|
36845
|
+
fontData = deobfuscateFont(originalPartBytes, fontGuid);
|
|
36846
|
+
} else {
|
|
36847
|
+
console.warn(
|
|
36848
|
+
`[pptx-viewer] Embedded font "${name}" at "${partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
36849
|
+
);
|
|
36850
|
+
return null;
|
|
36851
|
+
}
|
|
36852
|
+
if (fontData.length < 4) {
|
|
36853
|
+
return null;
|
|
36854
|
+
}
|
|
36855
|
+
if (!hasSfntSignature(fontData)) {
|
|
36856
|
+
warnInvalidSignature(name, fontData);
|
|
36857
|
+
return null;
|
|
36858
|
+
}
|
|
36859
|
+
const format = detectFontFormat(fontData);
|
|
36860
|
+
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
36861
|
+
return {
|
|
36862
|
+
name,
|
|
36863
|
+
dataUrl: `data:${mimeType};base64,${uint8ArrayToBase64(fontData)}`,
|
|
36864
|
+
bold: source.bold,
|
|
36865
|
+
italic: source.italic,
|
|
36866
|
+
format,
|
|
36867
|
+
rawFontData: fontData,
|
|
36868
|
+
partPath,
|
|
36869
|
+
fontGuid,
|
|
36870
|
+
originalRId: source.originalRId,
|
|
36871
|
+
originalPartBytes
|
|
36872
|
+
};
|
|
36873
|
+
} catch {
|
|
36874
|
+
return null;
|
|
36875
|
+
}
|
|
36876
|
+
}
|
|
36877
|
+
function createDeferredEmbeddedFont(source) {
|
|
36878
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
36879
|
+
let fields;
|
|
36880
|
+
let pending;
|
|
36881
|
+
const decode = () => {
|
|
36882
|
+
if (!fields) {
|
|
36883
|
+
const decoded = decodeEmbeddedFontPart(source);
|
|
36884
|
+
fields = {
|
|
36885
|
+
dataUrl: decoded?.dataUrl ?? "",
|
|
36886
|
+
format: decoded?.format,
|
|
36887
|
+
rawFontData: decoded?.rawFontData
|
|
36888
|
+
};
|
|
36889
|
+
}
|
|
36890
|
+
return fields;
|
|
36891
|
+
};
|
|
36892
|
+
const font = {
|
|
36893
|
+
name: source.name,
|
|
36894
|
+
get dataUrl() {
|
|
36895
|
+
return decode().dataUrl;
|
|
36896
|
+
},
|
|
36897
|
+
set dataUrl(value) {
|
|
36898
|
+
decode().dataUrl = value;
|
|
36899
|
+
},
|
|
36900
|
+
bold: source.bold,
|
|
36901
|
+
italic: source.italic,
|
|
36902
|
+
get format() {
|
|
36903
|
+
return decode().format;
|
|
36904
|
+
},
|
|
36905
|
+
set format(value) {
|
|
36906
|
+
decode().format = value;
|
|
36907
|
+
},
|
|
36908
|
+
get rawFontData() {
|
|
36909
|
+
return decode().rawFontData;
|
|
36910
|
+
},
|
|
36911
|
+
set rawFontData(value) {
|
|
36912
|
+
decode().rawFontData = value;
|
|
36913
|
+
},
|
|
36914
|
+
partPath: source.partPath,
|
|
36915
|
+
fontGuid,
|
|
36916
|
+
originalRId: source.originalRId,
|
|
36917
|
+
originalPartBytes: source.originalPartBytes
|
|
36918
|
+
};
|
|
36919
|
+
Object.defineProperties(font, {
|
|
36920
|
+
load: {
|
|
36921
|
+
value: () => pending ??= Promise.resolve().then(
|
|
36922
|
+
() => decode().rawFontData?.length || decode().dataUrl ? font : null
|
|
36923
|
+
)
|
|
36924
|
+
},
|
|
36925
|
+
isLoaded: { get: () => fields !== void 0 }
|
|
36926
|
+
});
|
|
36927
|
+
return font;
|
|
36928
|
+
}
|
|
36929
|
+
function shouldSaveEmbeddedFontVerbatim(font) {
|
|
36930
|
+
if (font.isLoaded === void 0 || !font.originalPartBytes?.length) {
|
|
36931
|
+
return false;
|
|
36932
|
+
}
|
|
36933
|
+
if (!font.originalRId || !font.partPath) {
|
|
36934
|
+
return false;
|
|
36935
|
+
}
|
|
36936
|
+
return font.isLoaded === false || !font.rawFontData?.length;
|
|
36937
|
+
}
|
|
36938
|
+
|
|
36599
36939
|
// pptx/core/core/runtime/header-footer-parts.ts
|
|
36600
36940
|
var DEFAULT_DATE_FIELD_TYPE = "datetime1";
|
|
36601
36941
|
function asArray2(value) {
|
|
@@ -38643,10 +38983,10 @@ function collectFilteredSeriesIndices(container, xmlLookup) {
|
|
|
38643
38983
|
}
|
|
38644
38984
|
return reserved;
|
|
38645
38985
|
}
|
|
38646
|
-
function assignSeriesIndices(
|
|
38986
|
+
function assignSeriesIndices(count2, reservedIndices) {
|
|
38647
38987
|
const assigned = [];
|
|
38648
38988
|
let cursor = 0;
|
|
38649
|
-
for (let i = 0; i <
|
|
38989
|
+
for (let i = 0; i < count2; i++) {
|
|
38650
38990
|
while (reservedIndices.has(cursor)) {
|
|
38651
38991
|
cursor++;
|
|
38652
38992
|
}
|
|
@@ -38965,8 +39305,8 @@ function parseCache(node) {
|
|
|
38965
39305
|
return point;
|
|
38966
39306
|
})
|
|
38967
39307
|
};
|
|
38968
|
-
const
|
|
38969
|
-
if (Number.isInteger(
|
|
39308
|
+
const count2 = Number(cVal(node, "ptCount") ?? Number.NaN);
|
|
39309
|
+
if (Number.isInteger(count2) && count2 >= 0) cache.pointCount = count2;
|
|
38970
39310
|
const formatCode2 = cChild(node, "formatCode")?.textContent;
|
|
38971
39311
|
if (formatCode2) cache.formatCode = formatCode2;
|
|
38972
39312
|
return cache;
|
|
@@ -38984,8 +39324,8 @@ function parseDataSource(element) {
|
|
|
38984
39324
|
const levels = cChild(ref, "multiLvlStrCache");
|
|
38985
39325
|
if (levels) {
|
|
38986
39326
|
source.levels = children(levels, "lvl", NS.c).map(parseCache);
|
|
38987
|
-
const
|
|
38988
|
-
if (Number.isInteger(
|
|
39327
|
+
const count2 = Number(cVal(levels, "ptCount") ?? Number.NaN);
|
|
39328
|
+
if (Number.isInteger(count2) && count2 >= 0) source.levelPointCount = count2;
|
|
38989
39329
|
}
|
|
38990
39330
|
return source;
|
|
38991
39331
|
}
|
|
@@ -47626,9 +47966,9 @@ function buildFopt(simple, complex = []) {
|
|
|
47626
47966
|
payload.bytes(bytes);
|
|
47627
47967
|
}
|
|
47628
47968
|
}
|
|
47629
|
-
const
|
|
47969
|
+
const count2 = simple.length + complex.length;
|
|
47630
47970
|
const data = new ByteWriter().append(entries).append(payload).toBytes();
|
|
47631
|
-
return record(OA.FOPT, data,
|
|
47971
|
+
return record(OA.FOPT, data, count2, false, 3);
|
|
47632
47972
|
}
|
|
47633
47973
|
var METRO_BLOB_OPID = 937;
|
|
47634
47974
|
function buildMetroBlobTertiaryFopt(metroBlob) {
|
|
@@ -47665,9 +48005,9 @@ function buildDgg(shapesPerDrawing, totalShapes) {
|
|
|
47665
48005
|
const cidcl = drawingCount + 1;
|
|
47666
48006
|
const cspSaved = totalShapes - drawingCount;
|
|
47667
48007
|
const w = new ByteWriter().u32(maxShapeId).u32(cidcl).u32(cspSaved).u32(drawingCount);
|
|
47668
|
-
shapesPerDrawing.forEach((
|
|
48008
|
+
shapesPerDrawing.forEach((count2, i) => {
|
|
47669
48009
|
const drawingId = i + 1;
|
|
47670
|
-
w.u32(drawingId).u32(
|
|
48010
|
+
w.u32(drawingId).u32(count2);
|
|
47671
48011
|
});
|
|
47672
48012
|
return record(OA.Dgg, w.toBytes(), 0, false, 0);
|
|
47673
48013
|
}
|
|
@@ -48464,8 +48804,8 @@ function atom(recType, data) {
|
|
|
48464
48804
|
function textHeader(textType) {
|
|
48465
48805
|
return atom(RT.TextHeaderAtom, new ByteWriter().u32(textType).toBytes());
|
|
48466
48806
|
}
|
|
48467
|
-
function textSpecInfo(
|
|
48468
|
-
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(
|
|
48807
|
+
function textSpecInfo(count2) {
|
|
48808
|
+
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(count2).u32(1).u16(0).toBytes());
|
|
48469
48809
|
}
|
|
48470
48810
|
function promptText(textType, paragraphs) {
|
|
48471
48811
|
const text = paragraphs.join("\r");
|
|
@@ -49113,17 +49453,17 @@ function slideMasterIndex(masterIndex, masterCount) {
|
|
|
49113
49453
|
return masterIndex !== void 0 && Number.isInteger(masterIndex) && masterIndex >= 0 && masterIndex < masterCount ? masterIndex : 0;
|
|
49114
49454
|
}
|
|
49115
49455
|
function countDrawingShapes(shapes) {
|
|
49116
|
-
let
|
|
49456
|
+
let count2 = 1;
|
|
49117
49457
|
const walk = (list2) => {
|
|
49118
49458
|
for (const shape of list2) {
|
|
49119
|
-
|
|
49459
|
+
count2++;
|
|
49120
49460
|
if (shape.kind === "group") {
|
|
49121
49461
|
walk(shape.children);
|
|
49122
49462
|
}
|
|
49123
49463
|
}
|
|
49124
49464
|
};
|
|
49125
49465
|
walk(shapes);
|
|
49126
|
-
return
|
|
49466
|
+
return count2;
|
|
49127
49467
|
}
|
|
49128
49468
|
function collectFonts(deck, masters) {
|
|
49129
49469
|
const collect = (shape) => {
|
|
@@ -49632,7 +49972,7 @@ function toLevel(style = {}, themeFonts = {}) {
|
|
|
49632
49972
|
}
|
|
49633
49973
|
};
|
|
49634
49974
|
}
|
|
49635
|
-
function toLevels(levels,
|
|
49975
|
+
function toLevels(levels, count2, themeFonts) {
|
|
49636
49976
|
if (!levels) {
|
|
49637
49977
|
return void 0;
|
|
49638
49978
|
}
|
|
@@ -49642,7 +49982,7 @@ function toLevels(levels, count, themeFonts) {
|
|
|
49642
49982
|
}
|
|
49643
49983
|
const base = levels[-1];
|
|
49644
49984
|
return Array.from(
|
|
49645
|
-
{ length:
|
|
49985
|
+
{ length: count2 },
|
|
49646
49986
|
(_, i) => toLevel(base || levels[i] ? { ...base, ...levels[i] } : void 0, themeFonts)
|
|
49647
49987
|
);
|
|
49648
49988
|
}
|
|
@@ -50478,12 +50818,12 @@ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
|
50478
50818
|
}
|
|
50479
50819
|
if (Array.isArray(node)) {
|
|
50480
50820
|
return node.reduce(
|
|
50481
|
-
(
|
|
50821
|
+
(count3, entry2) => count3 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
50482
50822
|
0
|
|
50483
50823
|
);
|
|
50484
50824
|
}
|
|
50485
50825
|
const object = node;
|
|
50486
|
-
let
|
|
50826
|
+
let count2 = 0;
|
|
50487
50827
|
for (const key2 of Object.keys(object)) {
|
|
50488
50828
|
if (key2.startsWith("@_")) {
|
|
50489
50829
|
continue;
|
|
@@ -50495,14 +50835,14 @@ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
|
50495
50835
|
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
50496
50836
|
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
50497
50837
|
rebindGraphicData(candidate, relationshipId, extended);
|
|
50498
|
-
|
|
50838
|
+
count2 += 1;
|
|
50499
50839
|
}
|
|
50500
50840
|
}
|
|
50501
50841
|
continue;
|
|
50502
50842
|
}
|
|
50503
|
-
|
|
50843
|
+
count2 += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
50504
50844
|
}
|
|
50505
|
-
return
|
|
50845
|
+
return count2;
|
|
50506
50846
|
}
|
|
50507
50847
|
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
50508
50848
|
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
@@ -50510,11 +50850,11 @@ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extend
|
|
|
50510
50850
|
return 0;
|
|
50511
50851
|
}
|
|
50512
50852
|
const tree = deps.parser.parse(xml);
|
|
50513
|
-
const
|
|
50514
|
-
if (
|
|
50853
|
+
const count2 = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
50854
|
+
if (count2 > 0) {
|
|
50515
50855
|
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
50516
50856
|
}
|
|
50517
|
-
return
|
|
50857
|
+
return count2;
|
|
50518
50858
|
}
|
|
50519
50859
|
|
|
50520
50860
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
@@ -58562,6 +58902,8 @@ var PptxHandlerRuntime = class {
|
|
|
58562
58902
|
alternateContentBlockByRawXml = /* @__PURE__ */ new WeakMap();
|
|
58563
58903
|
/** Embedded fonts extracted during load, preserved for automatic re-embedding on save. */
|
|
58564
58904
|
loadedEmbeddedFonts = [];
|
|
58905
|
+
/** Decode every embedded font variant during load (see `PptxHandlerLoadOptions`). */
|
|
58906
|
+
eagerDecodeEmbeddedFonts = false;
|
|
58565
58907
|
/** Typed source metadata for lossless embedded-font list round trips. */
|
|
58566
58908
|
loadedEmbeddedFontList;
|
|
58567
58909
|
/**
|
|
@@ -63154,10 +63496,10 @@ function detectDominantScript(text) {
|
|
|
63154
63496
|
}
|
|
63155
63497
|
let best;
|
|
63156
63498
|
let bestCount = 0;
|
|
63157
|
-
for (const [cat,
|
|
63158
|
-
if (
|
|
63499
|
+
for (const [cat, count2] of Object.entries(counts)) {
|
|
63500
|
+
if (count2 > bestCount) {
|
|
63159
63501
|
best = cat;
|
|
63160
|
-
bestCount =
|
|
63502
|
+
bestCount = count2;
|
|
63161
63503
|
}
|
|
63162
63504
|
}
|
|
63163
63505
|
return best;
|
|
@@ -68290,7 +68632,9 @@ var PptxHandlerRuntime25 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
68290
68632
|
return;
|
|
68291
68633
|
}
|
|
68292
68634
|
const fonts = explicitFonts ?? this.loadedEmbeddedFonts;
|
|
68293
|
-
const fontsWithData = fonts.filter(
|
|
68635
|
+
const fontsWithData = fonts.filter(
|
|
68636
|
+
(f) => shouldSaveEmbeddedFontVerbatim(f) || f.rawFontData && f.rawFontData.length > 0
|
|
68637
|
+
);
|
|
68294
68638
|
if (fontsWithData.length === 0) {
|
|
68295
68639
|
const metadata = explicitFontList ?? this.loadedEmbeddedFontList;
|
|
68296
68640
|
if (metadata && this.presentationData) {
|
|
@@ -68333,10 +68677,11 @@ var PptxHandlerRuntime25 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
68333
68677
|
"p:font": { "@_typeface": typeface }
|
|
68334
68678
|
};
|
|
68335
68679
|
for (const variant of variants) {
|
|
68336
|
-
const
|
|
68680
|
+
const verbatim = shouldSaveEmbeddedFontVerbatim(variant);
|
|
68681
|
+
const fontData = verbatim ? void 0 : variant.rawFontData;
|
|
68337
68682
|
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
68338
|
-
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
68339
|
-
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
68683
|
+
const reuseObfuscation = hasOriginal && !verbatim && Boolean(variant.fontGuid);
|
|
68684
|
+
const reuseVerbatim = hasOriginal && (verbatim || !variant.fontGuid) && Boolean(variant.originalPartBytes);
|
|
68340
68685
|
let guid;
|
|
68341
68686
|
let fontPartPath;
|
|
68342
68687
|
let relativeTarget4;
|
|
@@ -71778,13 +72123,13 @@ function countDeclaredIds(node, counts, ensureArray12) {
|
|
|
71778
72123
|
if (!countDeclaredIds(branch, branchCounts, ensureArray12)) {
|
|
71779
72124
|
return false;
|
|
71780
72125
|
}
|
|
71781
|
-
for (const [id,
|
|
71782
|
-
merged.set(id, Math.max(merged.get(id) ?? 0,
|
|
72126
|
+
for (const [id, count2] of branchCounts) {
|
|
72127
|
+
merged.set(id, Math.max(merged.get(id) ?? 0, count2));
|
|
71783
72128
|
}
|
|
71784
72129
|
}
|
|
71785
72130
|
}
|
|
71786
|
-
for (const [id,
|
|
71787
|
-
counts.set(id, (counts.get(id) ?? 0) +
|
|
72131
|
+
for (const [id, count2] of merged) {
|
|
72132
|
+
counts.set(id, (counts.get(id) ?? 0) + count2);
|
|
71788
72133
|
}
|
|
71789
72134
|
}
|
|
71790
72135
|
return true;
|
|
@@ -71794,8 +72139,8 @@ function hasStructuralIdDefects(spTree, ensureArray12) {
|
|
|
71794
72139
|
if (!countDeclaredIds(spTree, counts, ensureArray12)) {
|
|
71795
72140
|
return true;
|
|
71796
72141
|
}
|
|
71797
|
-
for (const
|
|
71798
|
-
if (
|
|
72142
|
+
for (const count2 of counts.values()) {
|
|
72143
|
+
if (count2 > 1) {
|
|
71799
72144
|
return true;
|
|
71800
72145
|
}
|
|
71801
72146
|
}
|
|
@@ -86080,7 +86425,13 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
|
|
|
86080
86425
|
}
|
|
86081
86426
|
return map;
|
|
86082
86427
|
}
|
|
86083
|
-
/**
|
|
86428
|
+
/**
|
|
86429
|
+
* Read one variant's part. By default the result is a deferred descriptor
|
|
86430
|
+
* that decodes on first use (see `createDeferredEmbeddedFont`); parts that
|
|
86431
|
+
* fail the checks possible without decoding are skipped, as before. With
|
|
86432
|
+
* `eagerDecodeEmbeddedFonts` the variant is decoded now and skipped when
|
|
86433
|
+
* decoding fails.
|
|
86434
|
+
*/
|
|
86084
86435
|
async extractEmbeddedFontVariant(typeface, rId, bold, italic, relsMap, fontKey) {
|
|
86085
86436
|
const fontPath = relsMap.get(rId);
|
|
86086
86437
|
if (!fontPath) {
|
|
@@ -86091,80 +86442,25 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
|
|
|
86091
86442
|
if (!fontBinary || fontBinary.length === 0) {
|
|
86092
86443
|
return null;
|
|
86093
86444
|
}
|
|
86094
|
-
const
|
|
86095
|
-
let fontData;
|
|
86096
|
-
let resolvedGuid;
|
|
86097
|
-
if (isEotFormat(fontBinary)) {
|
|
86098
|
-
const extracted = extractFontFromEot(fontBinary);
|
|
86099
|
-
if (extracted) {
|
|
86100
|
-
fontData = extracted.fontData;
|
|
86101
|
-
} else {
|
|
86102
|
-
const header = parseEotHeader(fontBinary);
|
|
86103
|
-
console.info(
|
|
86104
|
-
`[pptx-viewer] Embedded font "${typeface}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""} \u2014 extraction failed, will use web font fallback`
|
|
86105
|
-
);
|
|
86106
|
-
return null;
|
|
86107
|
-
}
|
|
86108
|
-
} else {
|
|
86109
|
-
const guidFromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
86110
|
-
const guidFromPath = extractGuidFromPartName(fontPath);
|
|
86111
|
-
const guid = guidFromKey || guidFromPath;
|
|
86112
|
-
if (guid) {
|
|
86113
|
-
fontData = deobfuscateFont(fontBinary, guid);
|
|
86114
|
-
resolvedGuid = guid;
|
|
86115
|
-
} else {
|
|
86116
|
-
console.warn(
|
|
86117
|
-
`[pptx-viewer] Embedded font "${typeface}" at "${fontPath}" has no fontKey attribute and no GUID in filename \u2014 skipping`
|
|
86118
|
-
);
|
|
86119
|
-
return null;
|
|
86120
|
-
}
|
|
86121
|
-
}
|
|
86122
|
-
if (fontData.length < 4) {
|
|
86123
|
-
return null;
|
|
86124
|
-
}
|
|
86125
|
-
const v0 = fontData[0], v1 = fontData[1], v2 = fontData[2], v3 = fontData[3];
|
|
86126
|
-
const isTrueType = v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0;
|
|
86127
|
-
const isOTTO = v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79;
|
|
86128
|
-
const isTTC = v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102;
|
|
86129
|
-
const isWOFF = v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
86130
|
-
if (!(isTrueType || isOTTO || isTTC || isWOFF)) {
|
|
86131
|
-
console.warn(
|
|
86132
|
-
`[pptx-viewer] Embedded font "${typeface}" has invalid sfnt header [${v0.toString(16)},${v1.toString(16)},${v2.toString(16)},${v3.toString(16)}] after processing \u2014 skipping (web font fallback will be used)`
|
|
86133
|
-
);
|
|
86134
|
-
return null;
|
|
86135
|
-
}
|
|
86136
|
-
const format = detectFontFormat(fontData);
|
|
86137
|
-
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
86138
|
-
const base64 = this.uint8ArrayToBase64(fontData);
|
|
86139
|
-
const dataUrl = `data:${mimeType};base64,${base64}`;
|
|
86140
|
-
return {
|
|
86445
|
+
const source = {
|
|
86141
86446
|
name: typeface,
|
|
86142
|
-
dataUrl,
|
|
86143
86447
|
bold,
|
|
86144
86448
|
italic,
|
|
86145
|
-
format,
|
|
86146
|
-
rawFontData: fontData,
|
|
86147
|
-
partPath: fontPath,
|
|
86148
|
-
fontGuid: resolvedGuid,
|
|
86149
86449
|
originalRId: rId,
|
|
86150
|
-
|
|
86450
|
+
partPath: fontPath,
|
|
86451
|
+
// The descriptor owns a copy, so it outlives this handler's ZIP and
|
|
86452
|
+
// the save pipeline can write it back verbatim.
|
|
86453
|
+
originalPartBytes: new Uint8Array(fontBinary),
|
|
86454
|
+
fontKey
|
|
86151
86455
|
};
|
|
86456
|
+
if (this.eagerDecodeEmbeddedFonts) {
|
|
86457
|
+
return decodeEmbeddedFontPart(source);
|
|
86458
|
+
}
|
|
86459
|
+
return isEmbeddedFontPartPlausible(source) ? createDeferredEmbeddedFont(source) : null;
|
|
86152
86460
|
} catch {
|
|
86153
86461
|
return null;
|
|
86154
86462
|
}
|
|
86155
86463
|
}
|
|
86156
|
-
/** Convert Uint8Array to base64 string. */
|
|
86157
|
-
uint8ArrayToBase64(bytes) {
|
|
86158
|
-
let binary = "";
|
|
86159
|
-
const chunkSize = 8192;
|
|
86160
|
-
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
86161
|
-
const chunk = bytes.subarray(i, Math.min(i + chunkSize, bytes.length));
|
|
86162
|
-
for (let j = 0; j < chunk.length; j++) {
|
|
86163
|
-
binary += String.fromCharCode(chunk[j]);
|
|
86164
|
-
}
|
|
86165
|
-
}
|
|
86166
|
-
return btoa(binary);
|
|
86167
|
-
}
|
|
86168
86464
|
getLayoutOptions() {
|
|
86169
86465
|
const options = [];
|
|
86170
86466
|
for (const [path3, xmlObj] of this.layoutXmlMap.entries()) {
|
|
@@ -86212,6 +86508,10 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
|
|
|
86212
86508
|
// pptx/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
|
|
86213
86509
|
var MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
|
|
86214
86510
|
var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
|
|
86511
|
+
/** The limits of the load in progress (see `PptxHandlerLoadOptions.limits`). */
|
|
86512
|
+
loadLimits = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
86513
|
+
/** Slide elements parsed so far by the load in progress, for `maxShapes`. */
|
|
86514
|
+
loadedShapeCount = 0;
|
|
86215
86515
|
isZipContainer(data) {
|
|
86216
86516
|
const bytes = new Uint8Array(data);
|
|
86217
86517
|
if (bytes.byteLength < 4) {
|
|
@@ -86220,7 +86520,9 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86220
86520
|
return bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
86221
86521
|
}
|
|
86222
86522
|
async initializeLoadSession(data, options) {
|
|
86523
|
+
const limits = resolvePptxLoadLimits(options);
|
|
86223
86524
|
this.eagerDecodeImages = options.eagerDecodeImages ?? false;
|
|
86525
|
+
this.eagerDecodeEmbeddedFonts = options.eagerDecodeEmbeddedFonts === true;
|
|
86224
86526
|
this.allowExternalImages = options.allowExternalImages === true;
|
|
86225
86527
|
if (data.byteLength < 4) {
|
|
86226
86528
|
throw new Error("Invalid PPTX binary: file is empty or truncated.");
|
|
@@ -86230,7 +86532,7 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86230
86532
|
"Invalid PPTX binary: not a ZIP/OpenXML package. The file is neither an OpenXML archive nor an OLE compound file (which is how legacy .ppt and encrypted presentations arrive), so it is most likely corrupt, truncated, or not a presentation at all."
|
|
86231
86533
|
);
|
|
86232
86534
|
}
|
|
86233
|
-
const maxBytes =
|
|
86535
|
+
const maxBytes = limits.maxUncompressedBytes;
|
|
86234
86536
|
let loaded;
|
|
86235
86537
|
try {
|
|
86236
86538
|
loaded = await JSZip.loadAsync(data);
|
|
@@ -86240,11 +86542,13 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86240
86542
|
}
|
|
86241
86543
|
this.zip = guardZip(loaded, {
|
|
86242
86544
|
label: "PPTX",
|
|
86243
|
-
maxEntries:
|
|
86545
|
+
maxEntries: limits.maxEntries,
|
|
86244
86546
|
maxEntryBytes: maxBytes,
|
|
86245
86547
|
maxTotalBytes: maxBytes,
|
|
86246
|
-
createError:
|
|
86548
|
+
createError: createPptxZipBombError
|
|
86247
86549
|
});
|
|
86550
|
+
this.loadLimits = limits;
|
|
86551
|
+
this.loadedShapeCount = 0;
|
|
86248
86552
|
try {
|
|
86249
86553
|
this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
|
|
86250
86554
|
this.zip,
|
|
@@ -86410,6 +86714,11 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86410
86714
|
}
|
|
86411
86715
|
this.presentationData = this.parser.parse(presentationXml3);
|
|
86412
86716
|
this.detectAndSetStrictConformance(this.presentationData);
|
|
86717
|
+
const slideIds = this.presentationData?.["p:presentation"]?.["p:sldIdLst"]?.["p:sldId"];
|
|
86718
|
+
assertPptxSlideCountWithinLimits(
|
|
86719
|
+
Array.isArray(slideIds) ? slideIds.length : slideIds ? 1 : 0,
|
|
86720
|
+
this.loadLimits
|
|
86721
|
+
);
|
|
86413
86722
|
await this.loadThemeData();
|
|
86414
86723
|
this.parsePresentationDefaultTextStyle();
|
|
86415
86724
|
await this.loadCommentAuthors();
|
|
@@ -86539,7 +86848,17 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86539
86848
|
loadThemeOverride: (partBasePath) => this.loadThemeOverride(partBasePath),
|
|
86540
86849
|
applyThemeOverrideState: (override) => this.applyThemeOverrideState(override),
|
|
86541
86850
|
getLayoutElements: (slidePath) => this.getLayoutElements(slidePath),
|
|
86542
|
-
|
|
86851
|
+
// `maxShapes`: each slide's own elements are counted as soon as they are
|
|
86852
|
+
// parsed, before that slide's media is resolved and before the next slide.
|
|
86853
|
+
parseSlide: async (slideXml3, slidePath) => {
|
|
86854
|
+
const elements2 = await this.parseSlide(slideXml3, slidePath);
|
|
86855
|
+
this.loadedShapeCount = countPptxShapesWithinLimits(
|
|
86856
|
+
this.loadedShapeCount,
|
|
86857
|
+
elements2,
|
|
86858
|
+
this.loadLimits
|
|
86859
|
+
);
|
|
86860
|
+
return elements2;
|
|
86861
|
+
},
|
|
86543
86862
|
extractMediaTimingMap: (slideXml3, slidePath) => this.extractMediaTimingMap(slideXml3, slidePath),
|
|
86544
86863
|
enrichMediaElementsWithTiming: (elements2, timingMap) => this.enrichMediaElementsWithTiming(elements2, timingMap),
|
|
86545
86864
|
enrichOleElementsWithEmbeddedData: (elements2, slidePath) => this.enrichOleElementsWithEmbeddedData(elements2, slidePath),
|
|
@@ -86776,21 +87095,31 @@ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
|
|
|
86776
87095
|
try {
|
|
86777
87096
|
await this.initializeLoadSession(data, options);
|
|
86778
87097
|
reader = this.beginPartReads();
|
|
86779
|
-
|
|
86780
|
-
|
|
86781
|
-
|
|
86782
|
-
|
|
86783
|
-
|
|
86784
|
-
|
|
86785
|
-
|
|
86786
|
-
|
|
86787
|
-
this.resetElementIdCounter(slides);
|
|
86788
|
-
recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
|
|
86789
|
-
return await this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
87098
|
+
try {
|
|
87099
|
+
return await this.loadInitializedSession();
|
|
87100
|
+
} catch (error) {
|
|
87101
|
+
if (error instanceof PptxLoadLimitError) {
|
|
87102
|
+
this.dispose();
|
|
87103
|
+
}
|
|
87104
|
+
throw error;
|
|
87105
|
+
}
|
|
86790
87106
|
} finally {
|
|
86791
87107
|
this.endPartReads(reader);
|
|
86792
87108
|
}
|
|
86793
87109
|
}
|
|
87110
|
+
async loadInitializedSession() {
|
|
87111
|
+
await this.detectAndPreserveVbaProject();
|
|
87112
|
+
this.detectDigitalSignatureParts();
|
|
87113
|
+
await this.parseCustomXmlParts();
|
|
87114
|
+
const presentationState = await this.loadPresentationState();
|
|
87115
|
+
const slideMasters = await this.parseSlideMasters();
|
|
87116
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
87117
|
+
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
87118
|
+
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
87119
|
+
this.resetElementIdCounter(slides);
|
|
87120
|
+
recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
|
|
87121
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
87122
|
+
}
|
|
86794
87123
|
/**
|
|
86795
87124
|
* Retrieve the current background colour for a layout or master.
|
|
86796
87125
|
*/
|
|
@@ -88073,24 +88402,24 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
|
|
|
88073
88402
|
const charRuns = [];
|
|
88074
88403
|
let covered = 0;
|
|
88075
88404
|
while (covered < total && c.canRead(6)) {
|
|
88076
|
-
const
|
|
88405
|
+
const count2 = c.u32();
|
|
88077
88406
|
const indentLevel = c.u16();
|
|
88078
|
-
const props = { count, indentLevel };
|
|
88407
|
+
const props = { count: count2, indentLevel };
|
|
88079
88408
|
if (!parsePfException(c, scheme, props)) {
|
|
88080
88409
|
break;
|
|
88081
88410
|
}
|
|
88082
88411
|
paragraphRuns.push(props);
|
|
88083
|
-
covered +=
|
|
88412
|
+
covered += count2;
|
|
88084
88413
|
}
|
|
88085
88414
|
covered = 0;
|
|
88086
88415
|
while (covered < total && c.canRead(8)) {
|
|
88087
|
-
const
|
|
88088
|
-
const props = { count };
|
|
88416
|
+
const count2 = c.u32();
|
|
88417
|
+
const props = { count: count2 };
|
|
88089
88418
|
if (!parseCfException(c, scheme, props)) {
|
|
88090
88419
|
break;
|
|
88091
88420
|
}
|
|
88092
88421
|
charRuns.push(props);
|
|
88093
|
-
covered +=
|
|
88422
|
+
covered += count2;
|
|
88094
88423
|
}
|
|
88095
88424
|
return { paragraphRuns, charRuns };
|
|
88096
88425
|
}
|
|
@@ -89087,13 +89416,13 @@ var OPT2 = {
|
|
|
89087
89416
|
function parseProperties2(view, data, rec) {
|
|
89088
89417
|
const values = /* @__PURE__ */ new Map();
|
|
89089
89418
|
const complex = /* @__PURE__ */ new Map();
|
|
89090
|
-
const
|
|
89091
|
-
const entriesEnd = rec.dataOffset +
|
|
89419
|
+
const count2 = rec.recInstance;
|
|
89420
|
+
const entriesEnd = rec.dataOffset + count2 * 6;
|
|
89092
89421
|
if (entriesEnd > rec.dataOffset + rec.recLen) {
|
|
89093
89422
|
return { values, complex };
|
|
89094
89423
|
}
|
|
89095
89424
|
const complexRefs = [];
|
|
89096
|
-
for (let i = 0; i <
|
|
89425
|
+
for (let i = 0; i < count2; i++) {
|
|
89097
89426
|
const at = rec.dataOffset + i * 6;
|
|
89098
89427
|
const opid = view.getUint16(at, true);
|
|
89099
89428
|
const value = view.getUint32(at + 2, true);
|
|
@@ -90139,8 +90468,8 @@ function levelXml(tag, level, fallbackSizePt) {
|
|
|
90139
90468
|
}
|
|
90140
90469
|
function styleLevels(levels, fallbackSizePt) {
|
|
90141
90470
|
const result = [];
|
|
90142
|
-
const
|
|
90143
|
-
for (let i = 0; i <
|
|
90471
|
+
const count2 = Math.max(1, Math.min(levels.length, 9));
|
|
90472
|
+
for (let i = 0; i < count2; i++) {
|
|
90144
90473
|
result.push(levelXml(`lvl${i + 1}pPr`, levels[i] ?? {}, fallbackSizePt));
|
|
90145
90474
|
}
|
|
90146
90475
|
return result.join("");
|
|
@@ -90968,6 +91297,7 @@ var PptxHandlerCore = class {
|
|
|
90968
91297
|
* ```
|
|
90969
91298
|
*/
|
|
90970
91299
|
async load(data, options = {}) {
|
|
91300
|
+
assertPptxInputWithinLimits(data.byteLength, resolvePptxLoadLimits(options));
|
|
90971
91301
|
const detection = detectFileFormat(data);
|
|
90972
91302
|
if (detection.format === "ole") {
|
|
90973
91303
|
let ole;
|
|
@@ -91279,13 +91609,15 @@ var PptxHandler = class extends PptxHandlerCore {
|
|
|
91279
91609
|
* archives and portable `pptx-viewer-json` documents.
|
|
91280
91610
|
*
|
|
91281
91611
|
* The buffer is sniffed first: JSON documents (leading `{` plus the
|
|
91282
|
-
* `"pptx-viewer-json"` format marker) are
|
|
91283
|
-
* everything else goes through the regular ZIP/OLE2 pipeline.
|
|
91612
|
+
* `"pptx-viewer-json"` format marker) are imported as {@link loadFromJson}
|
|
91613
|
+
* does; everything else goes through the regular ZIP/OLE2 pipeline.
|
|
91284
91614
|
*/
|
|
91285
91615
|
async load(data, options = {}) {
|
|
91616
|
+
const limits = resolvePptxLoadLimits(options);
|
|
91617
|
+
assertPptxInputWithinLimits(data.byteLength, limits);
|
|
91286
91618
|
const jsonText = decodePptxJsonText(data);
|
|
91287
91619
|
if (jsonText !== null) {
|
|
91288
|
-
return this.
|
|
91620
|
+
return this.importJson(jsonText, options, limits);
|
|
91289
91621
|
}
|
|
91290
91622
|
return super.load(data, options);
|
|
91291
91623
|
}
|
|
@@ -91296,9 +91628,26 @@ var PptxHandler = class extends PptxHandlerCore {
|
|
|
91296
91628
|
* handler keeps a valid in-memory archive (editing and {@link save} keep
|
|
91297
91629
|
* working), then the imported model is overlaid on top: imported
|
|
91298
91630
|
* presentation fields win, and the slide array is replaced wholesale.
|
|
91631
|
+
*
|
|
91632
|
+
* `options.limits` applies as it does for {@link load}: `maxInputBytes` to
|
|
91633
|
+
* the UTF-8 size of `text` (checked before it is parsed), and `maxSlides`
|
|
91634
|
+
* and `maxShapes` to the document's slides with the same counting rule as
|
|
91635
|
+
* a `.pptx` package (layout and master elements are not counted).
|
|
91299
91636
|
*/
|
|
91300
91637
|
async loadFromJson(text, options = {}) {
|
|
91301
|
-
const
|
|
91638
|
+
const limits = resolvePptxLoadLimits(options);
|
|
91639
|
+
assertPptxTextWithinLimits(text, limits);
|
|
91640
|
+
return this.importJson(text, options, limits);
|
|
91641
|
+
}
|
|
91642
|
+
async importJson(text, options, limits) {
|
|
91643
|
+
const document2 = parsePptxJson(text);
|
|
91644
|
+
assertPptxSlideCountWithinLimits(document2.slides.length, limits);
|
|
91645
|
+
let shapes = 0;
|
|
91646
|
+
for (const slide of document2.slides) {
|
|
91647
|
+
const elements2 = Array.isArray(slide.elements) ? slide.elements : [];
|
|
91648
|
+
shapes = countPptxShapesWithinLimits(shapes, elements2, limits);
|
|
91649
|
+
}
|
|
91650
|
+
const imported = pptxDataFromJsonDocument(document2);
|
|
91302
91651
|
const blankBytes = await buildBlankPresentationArchive({
|
|
91303
91652
|
width: imported.widthEmu,
|
|
91304
91653
|
height: imported.heightEmu,
|
|
@@ -91306,7 +91655,7 @@ var PptxHandler = class extends PptxHandlerCore {
|
|
|
91306
91655
|
// the overlaid model, so the archive must carry the value itself.
|
|
91307
91656
|
firstSlideNumber: imported.firstSlideNumber
|
|
91308
91657
|
});
|
|
91309
|
-
const base = await super.load(blankBytes, options);
|
|
91658
|
+
const base = await super.load(blankBytes, { ...options, limits: void 0 });
|
|
91310
91659
|
return applyImportedPptxData(base, imported);
|
|
91311
91660
|
}
|
|
91312
91661
|
};
|