ooxml-core 1.46.0 → 1.48.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-6UQWMUVU.cjs +14 -0
- package/dist/{PptxHandler-HWEOIHEA.mjs → PptxHandler-PLSH2BAS.mjs} +2 -2
- package/dist/PptxHandler-QLKZVYCG.mjs +5 -0
- package/dist/{PresentationBuilder-66RV4F45.mjs → PresentationBuilder-3QXOJNRO.mjs} +2 -2
- package/dist/{PresentationBuilder-2BCCMZW7.cjs → PresentationBuilder-CRBFFHNW.cjs} +6 -6
- package/dist/{PresentationBuilder-AFD72LIG.mjs → PresentationBuilder-DQ3XFU4R.mjs} +3 -3
- package/dist/{chunk-G6LEU3Y5.mjs → chunk-32K7JG2Z.mjs} +1 -1
- package/dist/{chunk-5TOVSCVT.cjs → chunk-7RCBSNXT.cjs} +3 -3
- package/dist/{chunk-EI6555OK.mjs → chunk-CXIDPUT6.mjs} +1 -1
- package/dist/{chunk-E2TTMUKU.mjs → chunk-EKEE6BTU.mjs} +745 -65
- package/dist/{chunk-QUAFASFC.cjs → chunk-HBQBS7PO.cjs} +65 -0
- package/dist/{chunk-LXVE2VKR.mjs → chunk-I5REMIZR.mjs} +65 -1
- package/dist/{chunk-L6MJGE3Q.mjs → chunk-IKFTITJ7.mjs} +5 -5
- package/dist/{chunk-X2DC7XRL.mjs → chunk-K5G6MV37.mjs} +66 -2
- package/dist/{chunk-IBRV3AK3.cjs → chunk-RRA262A6.cjs} +2032 -1340
- package/dist/{chunk-H43QQVJU.mjs → chunk-WAYEYX4G.mjs} +1 -1
- package/dist/{chunk-HH3AYM63.mjs → chunk-WLKOLTBH.mjs} +760 -68
- package/dist/pptx/automation/index.cjs +45721 -44894
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-B4Z6N-Gz.d.ts → elements-CValElsy.d.ts} +3 -428
- package/dist/pptx/chunks/elements-CValElsy.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DtFoPmk7.d.ts → index-BaBgJR8i.d.ts} +203 -15
- package/dist/pptx/chunks/index-BaBgJR8i.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts → index-ClHCBGOf.d.ts} +10 -8
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts.map → index-ClHCBGOf.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts → index-DqkBjVqR.d.ts} +4 -4
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts.map → index-DqkBjVqR.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-BfgZfw5R.d.ts → table-DUO1H9-r.d.ts} +441 -2
- package/dist/pptx/chunks/table-DUO1H9-r.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts → text-operations-B3lZjvs_.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts.map → text-operations-B3lZjvs_.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +1047 -220
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +51837 -51026
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-FZ43IJFP.mjs +0 -5
- package/dist/PptxHandler-XAUKKK36.cjs +0 -14
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +0 -1
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NS, RELATIONSHIP_TYPES, 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, formatAutoNumberMarker, readText3DValues, readScene3DValues, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, LN_CHILD_ORDER, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER,
|
|
1
|
+
import { NS, RELATIONSHIP_TYPES, 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, formatAutoNumberMarker, readText3DValues, readScene3DValues, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, LN_CHILD_ORDER, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, hasShapeProperties, hasTextProperties, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, ooxmlGradientAngleToCssDegrees, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, drawingFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, drawingLineXml, parseDrawingTextBody, parseXml, parseDrawingFill, parseDrawingLine, first, buildXml, setDrawingFillXml, fillElementOf, patchDrawingLine, elements, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, drawingColorXml, applyDiagramRelationshipIds, buildSaveTimeCustomGeometryXml, applyCustomGeometryGuideOverrides, avLstForPreset, filterValidShapeAdjustmentEntries, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, writeShapeEffects, SHAPE_STYLE_ORDER, CAMERA_PRESETS, LIGHT_RIGS, LIGHT_DIRECTIONS, roundCoordinate, scaleVectorToIntegers, EMU_PER_PIXEL, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, reorderObjectKeysByLocalName, getSignaturePathsToStrip, mergeSmartArtPointXml, mergeSmartArtConnectionXml, withDiagramPictureSources, diagramPictureRelationships, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseDiagramDataModel, DEFAULT_GENERATED_DIAGRAM_SCHEME, previewDiagramLayout, parseDiagramColors, resolveDrawingColor, children, parseDrawingRichTextBody, writeGeneratedDiagramDrawing, descendants, GENERATED_DIAGRAM_CACHE_NS, generatedDrawingDigest, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, resolveThemeFillStyle, resolveThemeLineStyle, resolveThemeEffectStyle, relAttr, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, relationshipsPartFor, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, formatCellAddress, childrenNamed, childNamed, parseCellAddress, attr, parseDrawingEffects, drawingEffectsXml, readChartManualLayoutValues, worksheetData, buildEffectDagTreeFromXml, appendInSchemaOrder, RUN_PROPERTIES_ORDER, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, picturePercentage, ARTISTIC_PRIMARY_ATTRIBUTE, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, readPictureEffect, isAlternateContentChoiceSupported, SvgExporter, detectStrictConformance, normalizeStrictXml, normalizeStShapeType, applyCustomShows, applySections, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, xmlAttrBool, detectOleObjectType, inferOleExtensionFromTarget, deriveSlideTitles, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, encodeXmlAttributeValue, encodeXmlTextValue, stripXmlOrderMarkers, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS, patchDrawingColorIn, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, parsePptxJson, pptxDataFromJsonDocument, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, escAttr, buildRelationshipsXml, MIN_TABLE_DIMENSION, MAX_TABLE_DIMENSION, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, effectChild, mergeEffectNode, mergeAttributeEffectNode, parseDrawingLineDash, estimateMediaDurationMs, parseVmlElements, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, IncorrectPasswordError, applyThemeToData, detectFileFormat, parseOle2, decryptPptx, encryptPptx, base64Encode, patchPictureEffects, cssDegreesToOoxmlGradientAngle, escText, parseLineSpacingMultiplier, parseLineSpacingExactPt, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, formatSchemeKey, gradFill, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, parseKinsoku, deobfuscateFont, detectFontFormat, parseDataTable, parseChartAxes, parseBubbleChartOptions, extractGuidFromPartName, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, extractCxSeriesColor, parseCxDataLabels, parseCxRegionMapOptions, parseCxAxes, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, decodeBase64, parseSmartArtPresLayoutVars, parseDrawingColorIn, parseSmartArtConnection, connectionLabel, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, captureDiagramPictures, parseDiagramDrawing, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, collectTransitionText, parseSmartArtQuickStyleLabels, parseDiagramQuickStyle, parseDiagramLayoutSummary, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices } from './chunk-K5G6MV37.mjs';
|
|
2
2
|
import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openZip, MAX_ZIP_ENTRY_COUNT, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError } from './chunk-EYCM7RVL.mjs';
|
|
3
3
|
import { resolveSmartArtLayoutCategory } from './chunk-2N7RZQLC.mjs';
|
|
4
4
|
import { cloneXmlObject, applySmartArtLayoutDefinition, cloneSlide, parseSmartArtLayoutDefinition } from './chunk-VDUNZTJC.mjs';
|
|
@@ -6592,41 +6592,41 @@ function parseBorderSide(side) {
|
|
|
6592
6592
|
}
|
|
6593
6593
|
const ln = typeof side["a:ln"] === "object" ? side["a:ln"] : {};
|
|
6594
6594
|
const border = {};
|
|
6595
|
-
let
|
|
6595
|
+
let has3 = false;
|
|
6596
6596
|
if (ln["a:noFill"] !== void 0) {
|
|
6597
6597
|
border.noFill = true;
|
|
6598
|
-
|
|
6598
|
+
has3 = true;
|
|
6599
6599
|
}
|
|
6600
6600
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
6601
6601
|
if (widthEmu > 0) {
|
|
6602
6602
|
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL2));
|
|
6603
|
-
|
|
6603
|
+
has3 = true;
|
|
6604
6604
|
}
|
|
6605
6605
|
const prstDash = ln["a:prstDash"];
|
|
6606
6606
|
const dashVal = prstDash ? String(prstDash["@_val"] || "").trim() : "";
|
|
6607
6607
|
if (dashVal) {
|
|
6608
6608
|
border.dash = dashVal;
|
|
6609
|
-
|
|
6609
|
+
has3 = true;
|
|
6610
6610
|
}
|
|
6611
6611
|
const cmpd = String(ln["@_cmpd"] || "").trim();
|
|
6612
6612
|
if (cmpd && cmpd !== "sng") {
|
|
6613
6613
|
border.compound = cmpd;
|
|
6614
|
-
|
|
6614
|
+
has3 = true;
|
|
6615
6615
|
}
|
|
6616
6616
|
const solidFill2 = ln["a:solidFill"];
|
|
6617
6617
|
const fill3 = parseSolidFillStyle(solidFill2);
|
|
6618
6618
|
if (fill3) {
|
|
6619
6619
|
border.fill = fill3;
|
|
6620
|
-
|
|
6620
|
+
has3 = true;
|
|
6621
6621
|
} else {
|
|
6622
6622
|
const srgb = solidFill2?.["a:srgbClr"];
|
|
6623
6623
|
const hex3 = srgb ? String(srgb["@_val"] || "").trim() : "";
|
|
6624
6624
|
if (hex3) {
|
|
6625
6625
|
border.color = hex3.startsWith("#") ? hex3 : `#${hex3}`;
|
|
6626
|
-
|
|
6626
|
+
has3 = true;
|
|
6627
6627
|
}
|
|
6628
6628
|
}
|
|
6629
|
-
return
|
|
6629
|
+
return has3 ? border : void 0;
|
|
6630
6630
|
}
|
|
6631
6631
|
function parseTableStyleBorders(tcStyle) {
|
|
6632
6632
|
const tcBdr = tcStyle?.["a:tcBdr"];
|
|
@@ -6634,16 +6634,16 @@ function parseTableStyleBorders(tcStyle) {
|
|
|
6634
6634
|
return void 0;
|
|
6635
6635
|
}
|
|
6636
6636
|
const result = {};
|
|
6637
|
-
let
|
|
6637
|
+
let has3 = false;
|
|
6638
6638
|
for (const name of BORDER_SIDES) {
|
|
6639
6639
|
const node = tcBdr[`a:${name}`] ?? (name === "tr2bl" ? tcBdr["a:bl2tr"] : void 0);
|
|
6640
6640
|
const border = parseBorderSide(node);
|
|
6641
6641
|
if (border) {
|
|
6642
6642
|
result[name] = border;
|
|
6643
|
-
|
|
6643
|
+
has3 = true;
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
|
-
return
|
|
6646
|
+
return has3 ? result : void 0;
|
|
6647
6647
|
}
|
|
6648
6648
|
function parseTableStyleSectionCell3D(tcStyle) {
|
|
6649
6649
|
const cell3DNode = tcStyle?.["a:cell3D"];
|
|
@@ -9450,6 +9450,8 @@ var PptxSaveState = class {
|
|
|
9450
9450
|
emuPerPx;
|
|
9451
9451
|
usedSlideNumbers = /* @__PURE__ */ new Set();
|
|
9452
9452
|
usedMediaPaths = /* @__PURE__ */ new Set();
|
|
9453
|
+
/** New pictures' media parts in this save, by content (see `mediaPathForContent`). */
|
|
9454
|
+
newMediaByContent = /* @__PURE__ */ new Map();
|
|
9453
9455
|
usedInkPaths = /* @__PURE__ */ new Set();
|
|
9454
9456
|
maxInkPartIndex = 0;
|
|
9455
9457
|
existingCommentPaths = /* @__PURE__ */ new Set();
|
|
@@ -9490,6 +9492,23 @@ var PptxSaveState = class {
|
|
|
9490
9492
|
this.usedMediaPaths.add(filePath);
|
|
9491
9493
|
return filePath;
|
|
9492
9494
|
}
|
|
9495
|
+
/**
|
|
9496
|
+
* The media part for a NEW picture's bytes: the part an identical picture
|
|
9497
|
+
* already got in this save, or a fresh one. Pictures loaded from the deck
|
|
9498
|
+
* keep their own parts and never come through here.
|
|
9499
|
+
*/
|
|
9500
|
+
mediaPathForContent(bytes, extension) {
|
|
9501
|
+
const key2 = `${extension.toLowerCase()}:${bytes.length}:${fnv1a(bytes)}`;
|
|
9502
|
+
const candidates = this.newMediaByContent.get(key2) ?? [];
|
|
9503
|
+
const same6 = candidates.find((candidate) => sameBytes(candidate.bytes, bytes));
|
|
9504
|
+
if (same6) {
|
|
9505
|
+
return { path: same6.path, reused: true };
|
|
9506
|
+
}
|
|
9507
|
+
const path3 = this.nextMediaPath(extension);
|
|
9508
|
+
candidates.push({ bytes, path: path3 });
|
|
9509
|
+
this.newMediaByContent.set(key2, candidates);
|
|
9510
|
+
return { path: path3, reused: false };
|
|
9511
|
+
}
|
|
9493
9512
|
getUsedMediaPaths() {
|
|
9494
9513
|
return this.usedMediaPaths;
|
|
9495
9514
|
}
|
|
@@ -9686,6 +9705,25 @@ var PptxSaveStateBuilder = class {
|
|
|
9686
9705
|
});
|
|
9687
9706
|
}
|
|
9688
9707
|
};
|
|
9708
|
+
function fnv1a(bytes) {
|
|
9709
|
+
let hash2 = 2166136261;
|
|
9710
|
+
for (const byte of bytes) {
|
|
9711
|
+
hash2 ^= byte;
|
|
9712
|
+
hash2 = Math.imul(hash2, 16777619) >>> 0;
|
|
9713
|
+
}
|
|
9714
|
+
return hash2;
|
|
9715
|
+
}
|
|
9716
|
+
function sameBytes(a, b) {
|
|
9717
|
+
if (a.length !== b.length) {
|
|
9718
|
+
return false;
|
|
9719
|
+
}
|
|
9720
|
+
for (let i = 0; i < a.length; i++) {
|
|
9721
|
+
if (a[i] !== b[i]) {
|
|
9722
|
+
return false;
|
|
9723
|
+
}
|
|
9724
|
+
}
|
|
9725
|
+
return true;
|
|
9726
|
+
}
|
|
9689
9727
|
|
|
9690
9728
|
// pptx/core/core/builders/PptxShapeIdValidator.ts
|
|
9691
9729
|
function collectCnvPrNodes(node, results, ensureArray12) {
|
|
@@ -56454,6 +56492,27 @@ function buildChartSpaceXml(chartData) {
|
|
|
56454
56492
|
return result;
|
|
56455
56493
|
}
|
|
56456
56494
|
|
|
56495
|
+
// pptx/core/core/runtime/picture-svg-blip.ts
|
|
56496
|
+
var SVG_BLIP_EXT_URI = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}";
|
|
56497
|
+
var SVG_NS = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
|
|
56498
|
+
var TRANSPARENT_PNG_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
56499
|
+
function addSvgBlipExtension(picture, relationshipId) {
|
|
56500
|
+
const blipFill = picture["p:blipFill"];
|
|
56501
|
+
const blip = blipFill?.["a:blip"];
|
|
56502
|
+
if (!blip || typeof blip !== "object") {
|
|
56503
|
+
return;
|
|
56504
|
+
}
|
|
56505
|
+
const ext = {
|
|
56506
|
+
"@_uri": SVG_BLIP_EXT_URI,
|
|
56507
|
+
"asvg:svgBlip": { "@_xmlns:asvg": SVG_NS, "@_r:embed": relationshipId }
|
|
56508
|
+
};
|
|
56509
|
+
const extLst = blip["a:extLst"] ?? {};
|
|
56510
|
+
const existing = extLst["a:ext"];
|
|
56511
|
+
const list2 = existing === void 0 ? [] : Array.isArray(existing) ? existing : [existing];
|
|
56512
|
+
extLst["a:ext"] = list2.length === 0 ? ext : [...list2, ext];
|
|
56513
|
+
blip["a:extLst"] = extLst;
|
|
56514
|
+
}
|
|
56515
|
+
|
|
56457
56516
|
// pptx/core/core/runtime/paragraph-scoped-segment-state.ts
|
|
56458
56517
|
function paragraphStateOf(segment) {
|
|
56459
56518
|
const state = {};
|
|
@@ -61809,6 +61868,17 @@ function applyImageAlphaEffects(blip, effects2, parseColor) {
|
|
|
61809
61868
|
);
|
|
61810
61869
|
}
|
|
61811
61870
|
|
|
61871
|
+
// pptx/core/core/runtime/blip-extension-order.ts
|
|
61872
|
+
function keepExtensionListLast(blip) {
|
|
61873
|
+
const key2 = Object.keys(blip).find((candidate) => candidate.split(":").at(-1) === "extLst");
|
|
61874
|
+
if (key2 === void 0) {
|
|
61875
|
+
return;
|
|
61876
|
+
}
|
|
61877
|
+
const value = blip[key2];
|
|
61878
|
+
delete blip[key2];
|
|
61879
|
+
blip[key2] = value;
|
|
61880
|
+
}
|
|
61881
|
+
|
|
61812
61882
|
// pptx/core/core/runtime/image-color-effects.ts
|
|
61813
61883
|
var localName13 = (key2) => key2.split(":").at(-1) ?? key2;
|
|
61814
61884
|
function child16(parent, name) {
|
|
@@ -63784,17 +63854,37 @@ var PptxHandlerRuntime2 = class _PptxHandlerRuntime extends PptxHandlerRuntime {
|
|
|
63784
63854
|
|
|
63785
63855
|
// pptx/core/core/runtime/PptxHandlerRuntimeElementActions.ts
|
|
63786
63856
|
var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
63857
|
+
/**
|
|
63858
|
+
* Report a slide jump whose index names no slide of the deck being saved.
|
|
63859
|
+
* It is not written: PowerPoint does not open a file with a slide jump that
|
|
63860
|
+
* has no slide relationship.
|
|
63861
|
+
*/
|
|
63862
|
+
reportMissingSlideJumpTarget(elementId, index) {
|
|
63863
|
+
this.compatibilityService?.reportWarning({
|
|
63864
|
+
code: "SAVE_SLIDE_JUMP_TARGET_MISSING",
|
|
63865
|
+
message: `A slide jump to slide index ${index} has no such slide in the saved deck; the link was not written.`,
|
|
63866
|
+
severity: "warning",
|
|
63867
|
+
scope: "element",
|
|
63868
|
+
...elementId ? { elementId } : {}
|
|
63869
|
+
});
|
|
63870
|
+
}
|
|
63787
63871
|
/**
|
|
63788
63872
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
63789
63873
|
* a `p:cNvPr` parent.
|
|
63790
63874
|
*/
|
|
63791
|
-
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
63875
|
+
serializeSingleAction(cNvPr, nodeName, action, links, elementId) {
|
|
63792
63876
|
if (!action) {
|
|
63793
63877
|
delete cNvPr[nodeName];
|
|
63794
63878
|
return;
|
|
63795
63879
|
}
|
|
63796
63880
|
const node = {};
|
|
63797
|
-
const
|
|
63881
|
+
const slideJumpIndex = /^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? action.targetSlideIndex : void 0;
|
|
63882
|
+
const url = action.url?.trim() || (slideJumpIndex !== void 0 ? links.slideTargetAt?.(slideJumpIndex) : void 0);
|
|
63883
|
+
if (!url && slideJumpIndex !== void 0 && links.slideTargetAt) {
|
|
63884
|
+
this.reportMissingSlideJumpTarget(elementId, slideJumpIndex);
|
|
63885
|
+
delete cNvPr[nodeName];
|
|
63886
|
+
return;
|
|
63887
|
+
}
|
|
63798
63888
|
let rId = action.rId;
|
|
63799
63889
|
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
63800
63890
|
rId = void 0;
|
|
@@ -63885,8 +63975,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
63885
63975
|
}
|
|
63886
63976
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
63887
63977
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
63888
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
63889
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
63978
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links, el.id);
|
|
63979
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links, el.id);
|
|
63890
63980
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
63891
63981
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
63892
63982
|
}
|
|
@@ -67634,6 +67724,7 @@ var PptxHandlerRuntime16 = class extends PptxHandlerRuntime15 {
|
|
|
67634
67724
|
delete blip["a:blur"];
|
|
67635
67725
|
}
|
|
67636
67726
|
applyA14ImageExtension(blip, nextEffects);
|
|
67727
|
+
keepExtensionListLast(blip);
|
|
67637
67728
|
}
|
|
67638
67729
|
normalizePresetGeometry(shapeType) {
|
|
67639
67730
|
return this.elementXmlBuilder.normalizePresetGeometry(shapeType);
|
|
@@ -74738,6 +74829,53 @@ var PptxHandlerRuntime30 = class extends PptxHandlerRuntime29 {
|
|
|
74738
74829
|
}
|
|
74739
74830
|
};
|
|
74740
74831
|
|
|
74832
|
+
// pptx/core/core/runtime/run-slide-jump-targets.ts
|
|
74833
|
+
var SLIDE_JUMP_ACTION = "ppaction://hlinksldjump";
|
|
74834
|
+
function withRunSlideJumpTarget(style, slideTargetAt, onMissing) {
|
|
74835
|
+
if (!style || !slideTargetAt) {
|
|
74836
|
+
return style;
|
|
74837
|
+
}
|
|
74838
|
+
const index = style.hyperlinkTargetSlideIndex;
|
|
74839
|
+
if (typeof index !== "number" || style.hyperlinkRId) {
|
|
74840
|
+
return style;
|
|
74841
|
+
}
|
|
74842
|
+
const hyperlink = style.hyperlink?.trim();
|
|
74843
|
+
if (hyperlink && !hyperlink.startsWith("ppaction://")) {
|
|
74844
|
+
return style;
|
|
74845
|
+
}
|
|
74846
|
+
if (style.hyperlinkAction && style.hyperlinkAction !== SLIDE_JUMP_ACTION) {
|
|
74847
|
+
return style;
|
|
74848
|
+
}
|
|
74849
|
+
const target = slideTargetAt(index);
|
|
74850
|
+
if (!target) {
|
|
74851
|
+
onMissing?.(index);
|
|
74852
|
+
const {
|
|
74853
|
+
hyperlink: _hyperlink,
|
|
74854
|
+
hyperlinkAction: _action,
|
|
74855
|
+
hyperlinkTargetSlideIndex: _index,
|
|
74856
|
+
hyperlinkTooltip: _tooltip,
|
|
74857
|
+
...rest
|
|
74858
|
+
} = style;
|
|
74859
|
+
return rest;
|
|
74860
|
+
}
|
|
74861
|
+
return { ...style, hyperlink: target, hyperlinkAction: SLIDE_JUMP_ACTION };
|
|
74862
|
+
}
|
|
74863
|
+
function withSegmentSlideJumpTargets(segments, slideTargetAt, onMissing) {
|
|
74864
|
+
if (!segments || !slideTargetAt) {
|
|
74865
|
+
return segments;
|
|
74866
|
+
}
|
|
74867
|
+
let changed = false;
|
|
74868
|
+
const next = segments.map((segment) => {
|
|
74869
|
+
const style = withRunSlideJumpTarget(segment.style, slideTargetAt, onMissing);
|
|
74870
|
+
if (style === segment.style) {
|
|
74871
|
+
return segment;
|
|
74872
|
+
}
|
|
74873
|
+
changed = true;
|
|
74874
|
+
return { ...segment, style };
|
|
74875
|
+
});
|
|
74876
|
+
return changed ? next : segments;
|
|
74877
|
+
}
|
|
74878
|
+
|
|
74741
74879
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveTextWriter.ts
|
|
74742
74880
|
var ADJ1_WARP_PRESETS = /* @__PURE__ */ new Set([
|
|
74743
74881
|
"textWave1",
|
|
@@ -74762,7 +74900,7 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
74762
74900
|
* text chains), and delegates paragraph creation to
|
|
74763
74901
|
* `createParagraphsFromTextContent`.
|
|
74764
74902
|
*/
|
|
74765
|
-
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap) {
|
|
74903
|
+
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap, slideTargetAt) {
|
|
74766
74904
|
const hasEditableTextContent = typeof el.text === "string" || (el.textSegments?.length ?? 0) > 0;
|
|
74767
74905
|
if (!hasEditableTextContent) {
|
|
74768
74906
|
return;
|
|
@@ -74885,10 +75023,15 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
74885
75023
|
);
|
|
74886
75024
|
}
|
|
74887
75025
|
txBody["a:bodyPr"] = bodyPr;
|
|
75026
|
+
const onMissing = (index) => this.reportMissingSlideJumpTarget(el.id, index);
|
|
74888
75027
|
txBody["a:p"] = this.createParagraphsFromTextContent(
|
|
74889
75028
|
textValueForSave,
|
|
74890
|
-
|
|
74891
|
-
|
|
75029
|
+
withRunSlideJumpTarget(
|
|
75030
|
+
this.routeElementParagraphGeometry(txBody, el.textStyle),
|
|
75031
|
+
slideTargetAt,
|
|
75032
|
+
onMissing
|
|
75033
|
+
),
|
|
75034
|
+
withSegmentSlideJumpTargets(textSegmentsForSave, slideTargetAt, onMissing),
|
|
74892
75035
|
resolveHyperlinkRelationshipId
|
|
74893
75036
|
);
|
|
74894
75037
|
}
|
|
@@ -74999,6 +75142,94 @@ function shouldWritePictureGeometry(el, spPr) {
|
|
|
74999
75142
|
return Boolean(spPr["a:prstGeom"] || spPr["a:custGeom"]);
|
|
75000
75143
|
}
|
|
75001
75144
|
|
|
75145
|
+
// pptx/core/core/runtime/save-picture-fill.ts
|
|
75146
|
+
var has2 = (value) => value !== void 0;
|
|
75147
|
+
function drawingPictureLayout(layout, emuPerPx) {
|
|
75148
|
+
const offset = (px) => px === void 0 ? void 0 : Math.round(px * emuPerPx);
|
|
75149
|
+
if ([
|
|
75150
|
+
layout.tileOffsetX,
|
|
75151
|
+
layout.tileOffsetY,
|
|
75152
|
+
layout.tileScaleX,
|
|
75153
|
+
layout.tileScaleY,
|
|
75154
|
+
layout.tileFlip,
|
|
75155
|
+
layout.tileAlignment
|
|
75156
|
+
].some(has2)) {
|
|
75157
|
+
const tile = {};
|
|
75158
|
+
const offsetX = offset(layout.tileOffsetX);
|
|
75159
|
+
const offsetY = offset(layout.tileOffsetY);
|
|
75160
|
+
if (offsetX !== void 0) tile.offsetXEmu = offsetX;
|
|
75161
|
+
if (offsetY !== void 0) tile.offsetYEmu = offsetY;
|
|
75162
|
+
if (layout.tileScaleX !== void 0) tile.scaleX = layout.tileScaleX;
|
|
75163
|
+
if (layout.tileScaleY !== void 0) tile.scaleY = layout.tileScaleY;
|
|
75164
|
+
if (layout.tileFlip !== void 0) tile.flip = layout.tileFlip;
|
|
75165
|
+
if (layout.tileAlignment !== void 0) tile.alignment = layout.tileAlignment;
|
|
75166
|
+
return { tile };
|
|
75167
|
+
}
|
|
75168
|
+
if ([layout.fillRectLeft, layout.fillRectTop, layout.fillRectRight, layout.fillRectBottom].some(has2)) {
|
|
75169
|
+
return {
|
|
75170
|
+
fillRect: {
|
|
75171
|
+
l: layout.fillRectLeft ?? 0,
|
|
75172
|
+
t: layout.fillRectTop ?? 0,
|
|
75173
|
+
r: layout.fillRectRight ?? 0,
|
|
75174
|
+
b: layout.fillRectBottom ?? 0
|
|
75175
|
+
}
|
|
75176
|
+
};
|
|
75177
|
+
}
|
|
75178
|
+
return void 0;
|
|
75179
|
+
}
|
|
75180
|
+
function blipFillXml(relId, layout, parse) {
|
|
75181
|
+
const xml = drawingFillXml({ kind: "picture", relId, layout }) ?? "";
|
|
75182
|
+
const node = parse(xml)["a:blipFill"];
|
|
75183
|
+
delete node["@_xmlns:a"];
|
|
75184
|
+
delete node["@_xmlns:r"];
|
|
75185
|
+
return node;
|
|
75186
|
+
}
|
|
75187
|
+
function checkedBlipFill(relId, layout, ctx) {
|
|
75188
|
+
try {
|
|
75189
|
+
return blipFillXml(relId, layout, ctx.parse);
|
|
75190
|
+
} catch (error) {
|
|
75191
|
+
if (!(error instanceof RangeError)) {
|
|
75192
|
+
throw error;
|
|
75193
|
+
}
|
|
75194
|
+
ctx.warn(
|
|
75195
|
+
"SAVE_PICTURE_LAYOUT_INVALID",
|
|
75196
|
+
`Picture tile or fill rectangle could not be written (${error.message}); the picture is stretched over its frame instead.`
|
|
75197
|
+
);
|
|
75198
|
+
const { rotWithShape } = layout;
|
|
75199
|
+
return blipFillXml(relId, rotWithShape === void 0 ? {} : { rotWithShape }, ctx.parse);
|
|
75200
|
+
}
|
|
75201
|
+
}
|
|
75202
|
+
function writeNewShapePictureFill(spPr, style, ctx) {
|
|
75203
|
+
const relId = style.fillImageUrl ? ctx.embed(style.fillImageUrl) : void 0;
|
|
75204
|
+
if (!relId) {
|
|
75205
|
+
ctx.warn(
|
|
75206
|
+
"SAVE_SHAPE_PICTURE_FILL_UNSUPPORTED",
|
|
75207
|
+
"Shape picture fill could not be embedded (it needs a data: URL); the shape was saved without a fill."
|
|
75208
|
+
);
|
|
75209
|
+
return;
|
|
75210
|
+
}
|
|
75211
|
+
const layout = {
|
|
75212
|
+
...drawingPictureLayout(style.fillImageLayout ?? {}, ctx.emuPerPx),
|
|
75213
|
+
rotWithShape: style.fillImageRotWithShape ?? true
|
|
75214
|
+
};
|
|
75215
|
+
setFillChoice(spPr, "a:blipFill", checkedBlipFill(relId, layout, ctx));
|
|
75216
|
+
}
|
|
75217
|
+
function applyNewPictureLayout(blipFill, layout, ctx) {
|
|
75218
|
+
const drawingLayout = drawingPictureLayout(layout, ctx.emuPerPx);
|
|
75219
|
+
const relId = blipFill["a:blip"]?.["@_r:embed"];
|
|
75220
|
+
if (!drawingLayout || typeof relId !== "string") {
|
|
75221
|
+
return;
|
|
75222
|
+
}
|
|
75223
|
+
const built = checkedBlipFill(relId, drawingLayout, ctx);
|
|
75224
|
+
delete blipFill["a:stretch"];
|
|
75225
|
+
delete blipFill["a:tile"];
|
|
75226
|
+
for (const key2 of ["a:tile", "a:stretch"]) {
|
|
75227
|
+
if (built[key2] !== void 0) {
|
|
75228
|
+
blipFill[key2] = built[key2];
|
|
75229
|
+
}
|
|
75230
|
+
}
|
|
75231
|
+
}
|
|
75232
|
+
|
|
75002
75233
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveElementEmbedding.ts
|
|
75003
75234
|
function getMediaReferenceContainer(shape2) {
|
|
75004
75235
|
if (!shape2) {
|
|
@@ -75010,7 +75241,7 @@ function getMediaReferenceContainer(shape2) {
|
|
|
75010
75241
|
}
|
|
75011
75242
|
return shape2["a:graphic"]?.["a:graphicData"];
|
|
75012
75243
|
}
|
|
75013
|
-
var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
75244
|
+
var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime31 {
|
|
75014
75245
|
/** Serialize table, chart, and SmartArt data when applicable. */
|
|
75015
75246
|
applyDataSerialization(shape2, el, slideId) {
|
|
75016
75247
|
if (el.type === "table" && "tableData" in el && el.tableData) {
|
|
@@ -75097,15 +75328,29 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
75097
75328
|
if (parsedImage) {
|
|
75098
75329
|
let targetImagePath = el.imagePath;
|
|
75099
75330
|
if (!targetImagePath) {
|
|
75100
|
-
|
|
75101
|
-
|
|
75331
|
+
const media = ctx.saveSession.mediaPathForContent(parsedImage.bytes, parsedImage.extension);
|
|
75332
|
+
targetImagePath = media.path;
|
|
75102
75333
|
const relativeMediaPath = targetImagePath.replace(/^ppt\//u, "../");
|
|
75103
|
-
ctx.slideRelationships.
|
|
75104
|
-
"@
|
|
75105
|
-
|
|
75106
|
-
|
|
75107
|
-
|
|
75334
|
+
const existingRelationshipId = media.reused ? ctx.slideRelationships.find(
|
|
75335
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === relativeMediaPath
|
|
75336
|
+
)?.["@_Id"] : void 0;
|
|
75337
|
+
const relationshipId = typeof existingRelationshipId === "string" ? existingRelationshipId : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
75338
|
+
if (relationshipId !== existingRelationshipId) {
|
|
75339
|
+
ctx.slideRelationships.push({
|
|
75340
|
+
"@_Id": relationshipId,
|
|
75341
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
75342
|
+
"@_Target": relativeMediaPath
|
|
75343
|
+
});
|
|
75344
|
+
}
|
|
75108
75345
|
shape2 = this.createPictureXml(el, relationshipId);
|
|
75346
|
+
this.embedNewSvgVariant(el, shape2, ctx);
|
|
75347
|
+
const blipFill = shape2["p:blipFill"];
|
|
75348
|
+
if (blipFill) {
|
|
75349
|
+
applyNewPictureLayout(blipFill, el, this.pictureFillSaveContext(el, ctx));
|
|
75350
|
+
}
|
|
75351
|
+
if (media.reused) {
|
|
75352
|
+
return shape2;
|
|
75353
|
+
}
|
|
75109
75354
|
}
|
|
75110
75355
|
if (targetImagePath) {
|
|
75111
75356
|
const targetExt = targetImagePath.toLowerCase().match(/\.(?<ext>[^./\\]+)$/u)?.groups?.["ext"];
|
|
@@ -75126,6 +75371,71 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
75126
75371
|
}
|
|
75127
75372
|
return shape2;
|
|
75128
75373
|
}
|
|
75374
|
+
/** Add an image relationship from the slide to `mediaPath`; its id. */
|
|
75375
|
+
addSlideImageRelationship(mediaPath, ctx) {
|
|
75376
|
+
const relationshipId = ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
75377
|
+
ctx.slideRelationships.push({
|
|
75378
|
+
"@_Id": relationshipId,
|
|
75379
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
75380
|
+
"@_Target": mediaPath.replace(/^ppt\//u, "../")
|
|
75381
|
+
});
|
|
75382
|
+
return relationshipId;
|
|
75383
|
+
}
|
|
75384
|
+
/** What the picture-fill writers need, bound to `el` on the slide being saved. */
|
|
75385
|
+
pictureFillSaveContext(el, ctx) {
|
|
75386
|
+
return {
|
|
75387
|
+
emuPerPx: _PptxHandlerRuntime.EMU_PER_PX,
|
|
75388
|
+
parse: (xml) => this.parser.parse(xml),
|
|
75389
|
+
embed: (dataUrl) => {
|
|
75390
|
+
const parsed = this.parseDataUrlToBytes(dataUrl);
|
|
75391
|
+
if (!parsed) {
|
|
75392
|
+
return void 0;
|
|
75393
|
+
}
|
|
75394
|
+
const mediaPath = ctx.saveSession.nextMediaPath(parsed.extension);
|
|
75395
|
+
this.zip.file(mediaPath, parsed.bytes);
|
|
75396
|
+
return this.addSlideImageRelationship(mediaPath, ctx);
|
|
75397
|
+
},
|
|
75398
|
+
warn: (code, message) => this.compatibilityService.reportWarning({
|
|
75399
|
+
code,
|
|
75400
|
+
message,
|
|
75401
|
+
scope: "element",
|
|
75402
|
+
slideId: ctx.slide.id,
|
|
75403
|
+
elementId: el.id
|
|
75404
|
+
})
|
|
75405
|
+
};
|
|
75406
|
+
}
|
|
75407
|
+
/**
|
|
75408
|
+
* For a new SVG picture (`svgData` without a part yet), write the SVG part
|
|
75409
|
+
* and point the blip's `asvg:svgBlip` extension at it; the blip itself
|
|
75410
|
+
* embeds the raster (`imageData`).
|
|
75411
|
+
*/
|
|
75412
|
+
embedNewSvgVariant(el, picture, ctx) {
|
|
75413
|
+
const svgData = el.svgData;
|
|
75414
|
+
if (!svgData || el.svgPath) {
|
|
75415
|
+
return;
|
|
75416
|
+
}
|
|
75417
|
+
const parsed = this.parseDataUrlToBytes(svgData);
|
|
75418
|
+
if (!parsed || parsed.extension.toLowerCase() !== "svg") {
|
|
75419
|
+
return;
|
|
75420
|
+
}
|
|
75421
|
+
const media = ctx.saveSession.mediaPathForContent(parsed.bytes, "svg");
|
|
75422
|
+
const target = media.path.replace(/^ppt\//u, "../");
|
|
75423
|
+
const existing = media.reused ? ctx.slideRelationships.find(
|
|
75424
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === target
|
|
75425
|
+
)?.["@_Id"] : void 0;
|
|
75426
|
+
const relationshipId = typeof existing === "string" ? existing : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
75427
|
+
if (relationshipId !== existing) {
|
|
75428
|
+
ctx.slideRelationships.push({
|
|
75429
|
+
"@_Id": relationshipId,
|
|
75430
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
75431
|
+
"@_Target": target
|
|
75432
|
+
});
|
|
75433
|
+
}
|
|
75434
|
+
if (!media.reused) {
|
|
75435
|
+
this.zip.file(media.path, parsed.bytes);
|
|
75436
|
+
}
|
|
75437
|
+
addSvgBlipExtension(picture, relationshipId);
|
|
75438
|
+
}
|
|
75129
75439
|
/** Embed media data and manage relationships for media elements. */
|
|
75130
75440
|
processMediaEmbedding(mediaElement, shape2, ctx) {
|
|
75131
75441
|
const mediaType = mediaElement.mediaType === "audio" ? "audio" : "video";
|
|
@@ -76807,6 +77117,10 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
76807
77117
|
}
|
|
76808
77118
|
if (!shape2 && (el.type === "text" || el.type === "shape")) {
|
|
76809
77119
|
shape2 = this.createElementXml(el);
|
|
77120
|
+
const spPr = ensureXmlChild(shape2, "p:spPr");
|
|
77121
|
+
if (spPr && el.shapeStyle?.fillMode === "image") {
|
|
77122
|
+
writeNewShapePictureFill(spPr, el.shapeStyle, this.pictureFillSaveContext(el, ctx));
|
|
77123
|
+
}
|
|
76810
77124
|
}
|
|
76811
77125
|
if (!shape2 && el.type === "connector") {
|
|
76812
77126
|
shape2 = this.createConnectorXml(el);
|
|
@@ -76919,7 +77233,8 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
76919
77233
|
shape2,
|
|
76920
77234
|
el,
|
|
76921
77235
|
ctx.resolveHyperlinkRelationshipId,
|
|
76922
|
-
ctx.getSlideRelationshipMap
|
|
77236
|
+
ctx.getSlideRelationshipMap,
|
|
77237
|
+
ctx.slideTargetAt
|
|
76923
77238
|
);
|
|
76924
77239
|
}
|
|
76925
77240
|
this.applyDataSerialization(shape2, el, ctx.slide.id);
|
|
@@ -97603,6 +97918,215 @@ function applyChartInputLayout(element2, input) {
|
|
|
97603
97918
|
}
|
|
97604
97919
|
}
|
|
97605
97920
|
|
|
97921
|
+
// pptx/core/builders/sdk/picture-layout-input.ts
|
|
97922
|
+
var FLIPS = /* @__PURE__ */ new Set(["none", "x", "y", "xy"]);
|
|
97923
|
+
var ALIGNMENTS = /* @__PURE__ */ new Set([
|
|
97924
|
+
"tl",
|
|
97925
|
+
"t",
|
|
97926
|
+
"tr",
|
|
97927
|
+
"l",
|
|
97928
|
+
"ctr",
|
|
97929
|
+
"r",
|
|
97930
|
+
"bl",
|
|
97931
|
+
"b",
|
|
97932
|
+
"br"
|
|
97933
|
+
]);
|
|
97934
|
+
var MAX_INSET = 10;
|
|
97935
|
+
function finite4(where, name, value) {
|
|
97936
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
97937
|
+
throw new RangeError(`${where}.${name} must be a finite number, got ${String(value)}`);
|
|
97938
|
+
}
|
|
97939
|
+
return value;
|
|
97940
|
+
}
|
|
97941
|
+
function tileLayout(where, tile) {
|
|
97942
|
+
const scale = (name) => {
|
|
97943
|
+
const value = finite4(where, `tile.${name}`, tile[name] ?? 1);
|
|
97944
|
+
if (value <= 0) {
|
|
97945
|
+
throw new RangeError(`${where}.tile.${name} must be above 0, got ${value}`);
|
|
97946
|
+
}
|
|
97947
|
+
return value;
|
|
97948
|
+
};
|
|
97949
|
+
const flip = tile.flip ?? "none";
|
|
97950
|
+
if (!FLIPS.has(flip)) {
|
|
97951
|
+
throw new RangeError(`${where}.tile.flip must be none, x, y or xy, got ${String(flip)}`);
|
|
97952
|
+
}
|
|
97953
|
+
const alignment = tile.alignment ?? "tl";
|
|
97954
|
+
if (!ALIGNMENTS.has(alignment)) {
|
|
97955
|
+
throw new RangeError(
|
|
97956
|
+
`${where}.tile.alignment must be one of ${[...ALIGNMENTS].join(", ")}, got ${String(alignment)}`
|
|
97957
|
+
);
|
|
97958
|
+
}
|
|
97959
|
+
return {
|
|
97960
|
+
tileOffsetX: finite4(where, "tile.offsetX", tile.offsetX ?? 0),
|
|
97961
|
+
tileOffsetY: finite4(where, "tile.offsetY", tile.offsetY ?? 0),
|
|
97962
|
+
tileScaleX: scale("scaleX"),
|
|
97963
|
+
tileScaleY: scale("scaleY"),
|
|
97964
|
+
tileFlip: flip,
|
|
97965
|
+
tileAlignment: alignment
|
|
97966
|
+
};
|
|
97967
|
+
}
|
|
97968
|
+
function fillRectLayout(where, rect) {
|
|
97969
|
+
const inset = (name) => {
|
|
97970
|
+
const value = finite4(where, `fillRect.${name}`, rect[name]);
|
|
97971
|
+
if (Math.abs(value) > MAX_INSET) {
|
|
97972
|
+
throw new RangeError(
|
|
97973
|
+
`${where}.fillRect.${name} must be between -${MAX_INSET} and ${MAX_INSET}, got ${value}`
|
|
97974
|
+
);
|
|
97975
|
+
}
|
|
97976
|
+
return value;
|
|
97977
|
+
};
|
|
97978
|
+
const layout = {
|
|
97979
|
+
fillRectLeft: inset("l"),
|
|
97980
|
+
fillRectTop: inset("t"),
|
|
97981
|
+
fillRectRight: inset("r"),
|
|
97982
|
+
fillRectBottom: inset("b")
|
|
97983
|
+
};
|
|
97984
|
+
if (layout.fillRectLeft + layout.fillRectRight >= 1) {
|
|
97985
|
+
throw new RangeError(`${where}.fillRect.l + r must be below 1, which leaves no picture`);
|
|
97986
|
+
}
|
|
97987
|
+
if (layout.fillRectTop + layout.fillRectBottom >= 1) {
|
|
97988
|
+
throw new RangeError(`${where}.fillRect.t + b must be below 1, which leaves no picture`);
|
|
97989
|
+
}
|
|
97990
|
+
return layout;
|
|
97991
|
+
}
|
|
97992
|
+
function mapPictureLayoutInput(where, input) {
|
|
97993
|
+
const { mode, tile, fillRect } = input;
|
|
97994
|
+
if (mode !== void 0 && mode !== "stretch" && mode !== "tile") {
|
|
97995
|
+
throw new RangeError(`${where}.mode must be 'stretch' or 'tile', got ${String(mode)}`);
|
|
97996
|
+
}
|
|
97997
|
+
if (tile && fillRect) {
|
|
97998
|
+
throw new RangeError(`${where} takes a tile or a fillRect, not both`);
|
|
97999
|
+
}
|
|
98000
|
+
if (tile && mode === "stretch") {
|
|
98001
|
+
throw new RangeError(`${where}.tile needs mode 'tile', got 'stretch'`);
|
|
98002
|
+
}
|
|
98003
|
+
if (fillRect && mode === "tile") {
|
|
98004
|
+
throw new RangeError(`${where}.fillRect needs mode 'stretch', got 'tile'`);
|
|
98005
|
+
}
|
|
98006
|
+
if (tile || mode === "tile") {
|
|
98007
|
+
return tileLayout(where, tile ?? {});
|
|
98008
|
+
}
|
|
98009
|
+
return fillRect ? fillRectLayout(where, fillRect) : void 0;
|
|
98010
|
+
}
|
|
98011
|
+
|
|
98012
|
+
// pptx/core/builders/sdk/link-input.ts
|
|
98013
|
+
var SLIDE_JUMP_ACTION2 = "ppaction://hlinksldjump";
|
|
98014
|
+
function mapLinkToAction(link) {
|
|
98015
|
+
if (!link) {
|
|
98016
|
+
return void 0;
|
|
98017
|
+
}
|
|
98018
|
+
const tooltip = link.tooltip !== void 0 ? { tooltip: link.tooltip } : {};
|
|
98019
|
+
if ("url" in link) {
|
|
98020
|
+
return { url: assertUrl(link.url), ...tooltip };
|
|
98021
|
+
}
|
|
98022
|
+
assertSlideIndex(link.slideIndex);
|
|
98023
|
+
return { action: SLIDE_JUMP_ACTION2, targetSlideIndex: link.slideIndex, ...tooltip };
|
|
98024
|
+
}
|
|
98025
|
+
function mapLinkToRunStyle(link) {
|
|
98026
|
+
if (!link) {
|
|
98027
|
+
return {};
|
|
98028
|
+
}
|
|
98029
|
+
const tooltip = link.tooltip !== void 0 ? { hyperlinkTooltip: link.tooltip } : {};
|
|
98030
|
+
if ("url" in link) {
|
|
98031
|
+
return { hyperlink: assertUrl(link.url), ...tooltip };
|
|
98032
|
+
}
|
|
98033
|
+
assertSlideIndex(link.slideIndex);
|
|
98034
|
+
return {
|
|
98035
|
+
hyperlink: SLIDE_JUMP_ACTION2,
|
|
98036
|
+
hyperlinkAction: SLIDE_JUMP_ACTION2,
|
|
98037
|
+
hyperlinkTargetSlideIndex: link.slideIndex,
|
|
98038
|
+
...tooltip
|
|
98039
|
+
};
|
|
98040
|
+
}
|
|
98041
|
+
function assertUrl(url) {
|
|
98042
|
+
if (typeof url !== "string" || url.trim() === "") {
|
|
98043
|
+
throw new RangeError("LinkInput.url must be a non-empty address");
|
|
98044
|
+
}
|
|
98045
|
+
return url;
|
|
98046
|
+
}
|
|
98047
|
+
function assertSlideIndex(index) {
|
|
98048
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
98049
|
+
throw new RangeError(`LinkInput.slideIndex must be a 0-based slide position, got ${index}`);
|
|
98050
|
+
}
|
|
98051
|
+
}
|
|
98052
|
+
|
|
98053
|
+
// pptx/core/builders/sdk/svg-picture-input.ts
|
|
98054
|
+
var SVG_DATA_URL = /^data:image\/svg\+xml(?<params>[^,]*),(?<payload>[\s\S]*)$/iu;
|
|
98055
|
+
function svgPictureSource(source, svgFallback) {
|
|
98056
|
+
if (svgFallback !== void 0 && SVG_DATA_URL.test(svgFallback)) {
|
|
98057
|
+
throw new RangeError("ImageOptions.svgFallback must be a raster image, not SVG");
|
|
98058
|
+
}
|
|
98059
|
+
const match = SVG_DATA_URL.exec(source);
|
|
98060
|
+
if (!match?.groups) {
|
|
98061
|
+
if (svgFallback !== void 0) {
|
|
98062
|
+
throw new RangeError("ImageOptions.svgFallback applies only to an SVG data URL source");
|
|
98063
|
+
}
|
|
98064
|
+
return void 0;
|
|
98065
|
+
}
|
|
98066
|
+
const params = match.groups["params"] ?? "";
|
|
98067
|
+
const payload = match.groups["payload"] ?? "";
|
|
98068
|
+
const base64 = /;base64$/iu.test(params);
|
|
98069
|
+
const text = base64 ? decodeBase64Text(payload) : decodeURIComponent(payload);
|
|
98070
|
+
if (!/<svg[\s>]/iu.test(text)) {
|
|
98071
|
+
throw new RangeError("An SVG picture source must hold an <svg> element");
|
|
98072
|
+
}
|
|
98073
|
+
return {
|
|
98074
|
+
svgData: base64 ? `data:image/svg+xml;base64,${payload.replace(/\s+/gu, "")}` : `data:image/svg+xml;base64,${base64Encode(new TextEncoder().encode(text))}`,
|
|
98075
|
+
raster: svgFallback ?? TRANSPARENT_PNG_DATA_URL
|
|
98076
|
+
};
|
|
98077
|
+
}
|
|
98078
|
+
function decodeBase64Text(payload) {
|
|
98079
|
+
try {
|
|
98080
|
+
const binary = atob(payload.replace(/\s+/gu, ""));
|
|
98081
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
98082
|
+
return new TextDecoder().decode(bytes);
|
|
98083
|
+
} catch {
|
|
98084
|
+
throw new RangeError("An SVG picture source has base64 data that cannot be read");
|
|
98085
|
+
}
|
|
98086
|
+
}
|
|
98087
|
+
|
|
98088
|
+
// pptx/core/builders/sdk/picture-effects-input.ts
|
|
98089
|
+
function pictureEffectsFromInput(options2) {
|
|
98090
|
+
const { opacity: opacity2, brightness, contrast } = options2 ?? {};
|
|
98091
|
+
if (opacity2 !== void 0 && !(opacity2 >= 0 && opacity2 <= 1)) {
|
|
98092
|
+
throw new RangeError(`ImageOptions.opacity must be between 0 and 1, got ${opacity2}`);
|
|
98093
|
+
}
|
|
98094
|
+
const patch = {};
|
|
98095
|
+
if (opacity2 !== void 0 && opacity2 < 1) {
|
|
98096
|
+
patch.alpha = opacity2;
|
|
98097
|
+
}
|
|
98098
|
+
if (brightness !== void 0) {
|
|
98099
|
+
patch.brightness = brightness / 100;
|
|
98100
|
+
}
|
|
98101
|
+
if (contrast !== void 0) {
|
|
98102
|
+
patch.contrast = contrast / 100;
|
|
98103
|
+
}
|
|
98104
|
+
if (Object.keys(patch).length === 0) {
|
|
98105
|
+
return void 0;
|
|
98106
|
+
}
|
|
98107
|
+
let patched;
|
|
98108
|
+
try {
|
|
98109
|
+
patched = patchPictureEffects([], patch);
|
|
98110
|
+
} catch (error) {
|
|
98111
|
+
throw new RangeError(
|
|
98112
|
+
`ImageOptions.brightness and contrast must be finite percentages from -100 to 100 (${String(error)})`
|
|
98113
|
+
);
|
|
98114
|
+
}
|
|
98115
|
+
let effects2;
|
|
98116
|
+
for (const effect of patched) {
|
|
98117
|
+
effects2 ??= {};
|
|
98118
|
+
if (effect.kind === "alphaModFix") {
|
|
98119
|
+
effects2.alphaModFix = effect.amount * 100;
|
|
98120
|
+
} else if (effect.kind === "luminance") {
|
|
98121
|
+
effects2.lum = {
|
|
98122
|
+
...effect.brightness !== void 0 ? { bright: effect.brightness * 100 } : {},
|
|
98123
|
+
...effect.contrast !== void 0 ? { contrast: effect.contrast * 100 } : {}
|
|
98124
|
+
};
|
|
98125
|
+
}
|
|
98126
|
+
}
|
|
98127
|
+
return effects2;
|
|
98128
|
+
}
|
|
98129
|
+
|
|
97606
98130
|
// pptx/core/builders/sdk/shape-style-input.ts
|
|
97607
98131
|
var DASH_UNITS_PER_WIDTH = 1e5;
|
|
97608
98132
|
var MITER_UNITS_PER_RATIO = 1e5;
|
|
@@ -97641,12 +98165,18 @@ function mapFillToShapeStyle(fill3) {
|
|
|
97641
98165
|
...fill3.foreground !== void 0 ? { fillColor: fill3.foreground } : {},
|
|
97642
98166
|
fillPatternBackgroundColor: fill3.background
|
|
97643
98167
|
};
|
|
97644
|
-
case "image":
|
|
98168
|
+
case "image": {
|
|
98169
|
+
if (typeof fill3.url !== "string" || !fill3.url.startsWith("data:")) {
|
|
98170
|
+
throw new RangeError("FillInput.url of an image fill must be a data: URL");
|
|
98171
|
+
}
|
|
98172
|
+
const layout = mapPictureLayoutInput("FillInput", fill3);
|
|
97645
98173
|
return {
|
|
97646
98174
|
fillMode: "image",
|
|
97647
98175
|
fillImageUrl: fill3.url,
|
|
97648
|
-
fillImageMode:
|
|
98176
|
+
fillImageMode: layout?.tileScaleX !== void 0 ? "tile" : "stretch",
|
|
98177
|
+
...layout ? { fillImageLayout: layout } : {}
|
|
97649
98178
|
};
|
|
98179
|
+
}
|
|
97650
98180
|
case "none":
|
|
97651
98181
|
return { fillMode: "none" };
|
|
97652
98182
|
default:
|
|
@@ -97989,6 +98519,62 @@ function columnFractions(columnWidths, columnCount) {
|
|
|
97989
98519
|
return columnWidths.map((w) => w / sum);
|
|
97990
98520
|
}
|
|
97991
98521
|
|
|
98522
|
+
// pptx/core/builders/sdk/text-body-input.ts
|
|
98523
|
+
var EMU_PER_PX5 = 9525;
|
|
98524
|
+
var MAX_INSET_EMU = 51206400;
|
|
98525
|
+
var MAX_SPC = 4e5;
|
|
98526
|
+
var INSET_FIELDS = {
|
|
98527
|
+
left: "bodyInsetLeft",
|
|
98528
|
+
top: "bodyInsetTop",
|
|
98529
|
+
right: "bodyInsetRight",
|
|
98530
|
+
bottom: "bodyInsetBottom"
|
|
98531
|
+
};
|
|
98532
|
+
var AUTO_FIT = {
|
|
98533
|
+
// The model's `autoFitMode` names read the other way round: `'normal'` is
|
|
98534
|
+
// `a:normAutofit` (PowerPoint shrinks the text on overflow) and `'shrink'`
|
|
98535
|
+
// is `a:spAutoFit` (the shape grows to fit the text).
|
|
98536
|
+
shrinkText: { autoFit: true, autoFitMode: "normal" },
|
|
98537
|
+
resizeShape: { autoFit: true, autoFitMode: "shrink" },
|
|
98538
|
+
none: { autoFit: false, autoFitMode: "none" }
|
|
98539
|
+
};
|
|
98540
|
+
function mapTextBodyInput(input) {
|
|
98541
|
+
const style = {};
|
|
98542
|
+
if (!input) {
|
|
98543
|
+
return style;
|
|
98544
|
+
}
|
|
98545
|
+
const { insets, autoFit, wrap: wrap2 } = input;
|
|
98546
|
+
for (const side of Object.keys(INSET_FIELDS)) {
|
|
98547
|
+
const value = insets?.[side];
|
|
98548
|
+
if (value === void 0) {
|
|
98549
|
+
continue;
|
|
98550
|
+
}
|
|
98551
|
+
if (!Number.isFinite(value) || Math.abs(value * EMU_PER_PX5) > MAX_INSET_EMU) {
|
|
98552
|
+
throw new RangeError(`insets.${side} must be a finite px length, got ${value}`);
|
|
98553
|
+
}
|
|
98554
|
+
style[INSET_FIELDS[side]] = value;
|
|
98555
|
+
}
|
|
98556
|
+
if (autoFit !== void 0) {
|
|
98557
|
+
const mapped = AUTO_FIT[autoFit];
|
|
98558
|
+
if (!mapped) {
|
|
98559
|
+
throw new RangeError(
|
|
98560
|
+
`autoFit must be 'none', 'shrinkText' or 'resizeShape', got ${String(autoFit)}`
|
|
98561
|
+
);
|
|
98562
|
+
}
|
|
98563
|
+
Object.assign(style, mapped);
|
|
98564
|
+
}
|
|
98565
|
+
if (wrap2 !== void 0) {
|
|
98566
|
+
style.textWrap = wrap2 ? "square" : "none";
|
|
98567
|
+
}
|
|
98568
|
+
return style;
|
|
98569
|
+
}
|
|
98570
|
+
function characterSpacingToSpc(px) {
|
|
98571
|
+
const spc = Math.round(px * 75);
|
|
98572
|
+
if (!Number.isFinite(px) || Math.abs(spc) > MAX_SPC) {
|
|
98573
|
+
throw new RangeError(`characterSpacing must be a finite px length, got ${px}`);
|
|
98574
|
+
}
|
|
98575
|
+
return spc;
|
|
98576
|
+
}
|
|
98577
|
+
|
|
97992
98578
|
// pptx/core/builders/sdk/text-segment-style.ts
|
|
97993
98579
|
var RUN_KEYS = [
|
|
97994
98580
|
"fontFamily",
|
|
@@ -98100,6 +98686,12 @@ function mapTextStyleInput(opts) {
|
|
|
98100
98686
|
if (opts.spaceAfter !== void 0) {
|
|
98101
98687
|
ts.paragraphSpacingAfter = opts.spaceAfter;
|
|
98102
98688
|
}
|
|
98689
|
+
if (opts.characterSpacing !== void 0) {
|
|
98690
|
+
ts.characterSpacing = characterSpacingToSpc(opts.characterSpacing);
|
|
98691
|
+
}
|
|
98692
|
+
if (opts.link !== void 0) {
|
|
98693
|
+
Object.assign(ts, mapLinkToRunStyle(opts.link));
|
|
98694
|
+
}
|
|
98103
98695
|
return ts;
|
|
98104
98696
|
}
|
|
98105
98697
|
function buildTextSegments(input, baseStyle) {
|
|
@@ -98124,6 +98716,34 @@ function buildTextSegments(input, baseStyle) {
|
|
|
98124
98716
|
style: { ...base, ...mapTextStyleInput(seg.style) }
|
|
98125
98717
|
}));
|
|
98126
98718
|
}
|
|
98719
|
+
function flipsOf(options2) {
|
|
98720
|
+
return {
|
|
98721
|
+
...options2?.flipHorizontal ? { flipHorizontal: true } : {},
|
|
98722
|
+
...options2?.flipVertical ? { flipVertical: true } : {}
|
|
98723
|
+
};
|
|
98724
|
+
}
|
|
98725
|
+
function applyShapeText(el, options2) {
|
|
98726
|
+
const text = options2?.text;
|
|
98727
|
+
if (!text || text.length === 0) {
|
|
98728
|
+
const body = mapTextBodyInput(options2);
|
|
98729
|
+
if (Object.keys(body).length > 0) {
|
|
98730
|
+
el.text = "";
|
|
98731
|
+
el.textStyle = body;
|
|
98732
|
+
}
|
|
98733
|
+
return;
|
|
98734
|
+
}
|
|
98735
|
+
const textSegments = buildTextSegments(text, options2.textStyle);
|
|
98736
|
+
el.text = typeof text === "string" ? text : text.map((s) => s.text).join("");
|
|
98737
|
+
el.textStyle = {
|
|
98738
|
+
...elementStyleForSegments(mapTextStyleInput(options2.textStyle), textSegments),
|
|
98739
|
+
...mapTextBodyInput(options2)
|
|
98740
|
+
};
|
|
98741
|
+
el.textSegments = textSegments;
|
|
98742
|
+
}
|
|
98743
|
+
function withAction(link) {
|
|
98744
|
+
const actionClick = mapLinkToAction(link);
|
|
98745
|
+
return actionClick ? { actionClick } : {};
|
|
98746
|
+
}
|
|
98127
98747
|
var DEFAULTS = {
|
|
98128
98748
|
text: { x: 100, y: 100, width: 600, height: 50 },
|
|
98129
98749
|
shape: { x: 200, y: 200, width: 300, height: 200 },
|
|
@@ -98164,32 +98784,36 @@ function createTextElement(text, options2) {
|
|
|
98164
98784
|
id: generateId("txt"),
|
|
98165
98785
|
...p,
|
|
98166
98786
|
rotation: options2?.rotation,
|
|
98787
|
+
...flipsOf(options2),
|
|
98167
98788
|
opacity: options2?.opacity,
|
|
98168
98789
|
text: plainText,
|
|
98169
|
-
textStyle:
|
|
98790
|
+
textStyle: {
|
|
98791
|
+
...elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
|
|
98792
|
+
...mapTextBodyInput(options2)
|
|
98793
|
+
},
|
|
98170
98794
|
textSegments,
|
|
98171
|
-
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
|
|
98795
|
+
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill)),
|
|
98796
|
+
...withAction(options2?.link)
|
|
98172
98797
|
};
|
|
98173
98798
|
}
|
|
98174
|
-
|
|
98799
|
+
var DEFAULT_SHAPE_FILL = { type: "solid", color: "#4472C4" };
|
|
98800
|
+
function createShapeElement(shapeType, options2, defaults) {
|
|
98175
98801
|
const p = pos("shape", options2);
|
|
98176
98802
|
const el = {
|
|
98177
98803
|
type: "shape",
|
|
98178
98804
|
id: generateId("shp"),
|
|
98179
98805
|
...p,
|
|
98180
98806
|
rotation: options2?.rotation,
|
|
98807
|
+
...flipsOf(options2),
|
|
98181
98808
|
opacity: options2?.opacity,
|
|
98182
98809
|
shapeType,
|
|
98183
98810
|
shapeAdjustments: options2?.adjustments,
|
|
98184
98811
|
shapeStyle: buildShapeStyle(
|
|
98185
|
-
effectInputs(options2, options2?.fill ??
|
|
98186
|
-
)
|
|
98812
|
+
effectInputs(options2, options2?.fill ?? defaults?.fill ?? DEFAULT_SHAPE_FILL)
|
|
98813
|
+
),
|
|
98814
|
+
...withAction(options2?.link)
|
|
98187
98815
|
};
|
|
98188
|
-
|
|
98189
|
-
el.text = options2.text;
|
|
98190
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98191
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98192
|
-
}
|
|
98816
|
+
applyShapeText(el, options2);
|
|
98193
98817
|
return el;
|
|
98194
98818
|
}
|
|
98195
98819
|
function createConnectorElement(options2) {
|
|
@@ -98225,26 +98849,41 @@ function createConnectorElement(options2) {
|
|
|
98225
98849
|
id: generateId("cxn"),
|
|
98226
98850
|
...p,
|
|
98227
98851
|
rotation: options2?.rotation,
|
|
98852
|
+
...flipsOf(options2),
|
|
98228
98853
|
shapeType: connType,
|
|
98229
98854
|
shapeStyle: style
|
|
98230
98855
|
};
|
|
98231
98856
|
}
|
|
98232
98857
|
function createImageElement(source, options2) {
|
|
98233
98858
|
const p = pos("image", options2);
|
|
98859
|
+
const svg = svgPictureSource(source, options2?.svgFallback);
|
|
98860
|
+
if (svg) {
|
|
98861
|
+
const { svgFallback: _raster, ...rest } = options2 ?? {};
|
|
98862
|
+
const svgPicture = createImageElement(svg.raster, rest);
|
|
98863
|
+
svgPicture.svgData = svg.svgData;
|
|
98864
|
+
return svgPicture;
|
|
98865
|
+
}
|
|
98234
98866
|
const isDataUrl = source.startsWith("data:");
|
|
98867
|
+
const imageEffects = pictureEffectsFromInput(options2);
|
|
98235
98868
|
return {
|
|
98236
98869
|
type: "image",
|
|
98237
98870
|
id: generateId("img"),
|
|
98238
98871
|
...p,
|
|
98239
98872
|
rotation: options2?.rotation,
|
|
98240
|
-
|
|
98873
|
+
...flipsOf(options2),
|
|
98874
|
+
...imageEffects ? { imageEffects } : {},
|
|
98241
98875
|
imagePath: isDataUrl ? void 0 : source,
|
|
98242
98876
|
imageData: isDataUrl ? source : void 0,
|
|
98243
98877
|
altText: options2?.altText,
|
|
98244
98878
|
cropLeft: options2?.cropLeft,
|
|
98245
98879
|
cropTop: options2?.cropTop,
|
|
98246
98880
|
cropRight: options2?.cropRight,
|
|
98247
|
-
cropBottom: options2?.cropBottom
|
|
98881
|
+
cropBottom: options2?.cropBottom,
|
|
98882
|
+
...mapPictureLayoutInput("ImageOptions", {
|
|
98883
|
+
tile: options2?.tile,
|
|
98884
|
+
fillRect: options2?.fillRect
|
|
98885
|
+
}),
|
|
98886
|
+
...withAction(options2?.link)
|
|
98248
98887
|
};
|
|
98249
98888
|
}
|
|
98250
98889
|
function createTableCell(cellInput) {
|
|
@@ -98349,6 +98988,7 @@ function createMediaElement(mediaType, source, options2) {
|
|
|
98349
98988
|
id: generateId("med"),
|
|
98350
98989
|
...p,
|
|
98351
98990
|
rotation: options2?.rotation,
|
|
98991
|
+
...flipsOf(options2),
|
|
98352
98992
|
mediaType,
|
|
98353
98993
|
mediaPath: isDataUrl ? void 0 : source,
|
|
98354
98994
|
mediaData: isDataUrl ? source : void 0,
|
|
@@ -98367,6 +99007,7 @@ function createGroupElement(children6, options2) {
|
|
|
98367
99007
|
id: generateId("grp"),
|
|
98368
99008
|
...p,
|
|
98369
99009
|
rotation: options2?.rotation,
|
|
99010
|
+
...flipsOf(options2),
|
|
98370
99011
|
children: children6
|
|
98371
99012
|
};
|
|
98372
99013
|
}
|
|
@@ -98380,6 +99021,7 @@ function createFreeformElement(pathData, options2) {
|
|
|
98380
99021
|
id: generateId("frm"),
|
|
98381
99022
|
...p,
|
|
98382
99023
|
rotation: options2?.rotation,
|
|
99024
|
+
...flipsOf(options2),
|
|
98383
99025
|
opacity: options2?.opacity,
|
|
98384
99026
|
shapeType: "custom",
|
|
98385
99027
|
pathData,
|
|
@@ -98389,13 +99031,10 @@ function createFreeformElement(pathData, options2) {
|
|
|
98389
99031
|
shapeStyle: buildShapeStyle({
|
|
98390
99032
|
...effectInputs(options2, options2?.fill ?? { type: "none" }),
|
|
98391
99033
|
stroke: options2?.stroke ?? { color: "#000000", width: 2 }
|
|
98392
|
-
})
|
|
99034
|
+
}),
|
|
99035
|
+
...withAction(options2?.link)
|
|
98393
99036
|
};
|
|
98394
|
-
|
|
98395
|
-
el.text = options2.text;
|
|
98396
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98397
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98398
|
-
}
|
|
99037
|
+
applyShapeText(el, options2);
|
|
98399
99038
|
return el;
|
|
98400
99039
|
}
|
|
98401
99040
|
|
|
@@ -98406,9 +99045,12 @@ var SlideBuilder = class {
|
|
|
98406
99045
|
* @param layoutPath - Optional layout archive path.
|
|
98407
99046
|
* @param layoutName - Optional layout display name.
|
|
98408
99047
|
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
99048
|
+
* @param shapeDefaults - What `addShape` uses for an omitted option
|
|
99049
|
+
* (`PresentationOptions.shapeDefaults`).
|
|
98409
99050
|
*/
|
|
98410
|
-
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
99051
|
+
constructor(slideNumber, layoutPath, layoutName, handler, shapeDefaults) {
|
|
98411
99052
|
this.handler = handler;
|
|
99053
|
+
this.shapeDefaults = shapeDefaults;
|
|
98412
99054
|
this.slide = {
|
|
98413
99055
|
id: `slide${slideNumber}`,
|
|
98414
99056
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -98419,6 +99061,7 @@ var SlideBuilder = class {
|
|
|
98419
99061
|
};
|
|
98420
99062
|
}
|
|
98421
99063
|
handler;
|
|
99064
|
+
shapeDefaults;
|
|
98422
99065
|
slide;
|
|
98423
99066
|
/** Add a text box to the slide. */
|
|
98424
99067
|
addText(text, options2) {
|
|
@@ -98466,7 +99109,7 @@ var SlideBuilder = class {
|
|
|
98466
99109
|
}
|
|
98467
99110
|
/** Add a shape to the slide. */
|
|
98468
99111
|
addShape(shapeType, options2) {
|
|
98469
|
-
this.slide.elements.push(createShapeElement(shapeType, options2));
|
|
99112
|
+
this.slide.elements.push(createShapeElement(shapeType, options2, this.shapeDefaults));
|
|
98470
99113
|
return this;
|
|
98471
99114
|
}
|
|
98472
99115
|
/** Add a connector (line) to the slide. */
|
|
@@ -98890,6 +99533,56 @@ function findLayoutByType(data, type) {
|
|
|
98890
99533
|
return void 0;
|
|
98891
99534
|
}
|
|
98892
99535
|
|
|
99536
|
+
// pptx/core/builders/sdk/presentation-app-properties.ts
|
|
99537
|
+
var INPUT_FIELDS = /* @__PURE__ */ new Set([
|
|
99538
|
+
"application",
|
|
99539
|
+
"appVersion",
|
|
99540
|
+
"presentationFormat",
|
|
99541
|
+
"company",
|
|
99542
|
+
"manager",
|
|
99543
|
+
"template"
|
|
99544
|
+
]);
|
|
99545
|
+
var APP_VERSION = /^\d+\.\d{4}$/u;
|
|
99546
|
+
function blankAppXml(slideCount) {
|
|
99547
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
99548
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
99549
|
+
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
99550
|
+
<Application>pptx-viewer-sdk</Application>
|
|
99551
|
+
<Slides>${slideCount}</Slides>
|
|
99552
|
+
<ScaleCrop>false</ScaleCrop>
|
|
99553
|
+
<LinksUpToDate>false</LinksUpToDate>
|
|
99554
|
+
<SharedDoc>false</SharedDoc>
|
|
99555
|
+
<HyperlinksChanged>false</HyperlinksChanged>
|
|
99556
|
+
<AppVersion>1.0000</AppVersion>
|
|
99557
|
+
</Properties>`;
|
|
99558
|
+
}
|
|
99559
|
+
function validate(input) {
|
|
99560
|
+
for (const [field, value] of Object.entries(input)) {
|
|
99561
|
+
if (!INPUT_FIELDS.has(field)) {
|
|
99562
|
+
throw new RangeError(
|
|
99563
|
+
`appProperties.${field} cannot be set when a presentation is created; it takes ${[...INPUT_FIELDS].join(", ")} (counts are computed on save)`
|
|
99564
|
+
);
|
|
99565
|
+
}
|
|
99566
|
+
if (value !== void 0 && typeof value !== "string") {
|
|
99567
|
+
throw new RangeError(`appProperties.${field} must be a string`);
|
|
99568
|
+
}
|
|
99569
|
+
}
|
|
99570
|
+
const version = input.appVersion?.trim();
|
|
99571
|
+
if (version && !APP_VERSION.test(version)) {
|
|
99572
|
+
throw new RangeError(
|
|
99573
|
+
`appProperties.appVersion must be digits, a dot and four digits (e.g. "16.0000"), got "${input.appVersion}"`
|
|
99574
|
+
);
|
|
99575
|
+
}
|
|
99576
|
+
}
|
|
99577
|
+
function newPresentationAppXml(slideCount, input) {
|
|
99578
|
+
const xml = blankAppXml(slideCount);
|
|
99579
|
+
if (input === void 0) {
|
|
99580
|
+
return xml;
|
|
99581
|
+
}
|
|
99582
|
+
validate(input);
|
|
99583
|
+
return writeAppProperties(applyAppOverrides(parseAppProperties(xml), input), xml);
|
|
99584
|
+
}
|
|
99585
|
+
|
|
98893
99586
|
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
98894
99587
|
function standardLayoutPlaceholders(type, width, height) {
|
|
98895
99588
|
if (type === "blank") return [];
|
|
@@ -99247,19 +99940,6 @@ function corePropsXml(title, creator) {
|
|
|
99247
99940
|
<dcterms:modified xsi:type="dcterms:W3CDTF">${now}</dcterms:modified>
|
|
99248
99941
|
</cp:coreProperties>`;
|
|
99249
99942
|
}
|
|
99250
|
-
function appPropsXml(slideCount) {
|
|
99251
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
99252
|
-
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
99253
|
-
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
99254
|
-
<Application>pptx-viewer-sdk</Application>
|
|
99255
|
-
<Slides>${slideCount}</Slides>
|
|
99256
|
-
<ScaleCrop>false</ScaleCrop>
|
|
99257
|
-
<LinksUpToDate>false</LinksUpToDate>
|
|
99258
|
-
<SharedDoc>false</SharedDoc>
|
|
99259
|
-
<HyperlinksChanged>false</HyperlinksChanged>
|
|
99260
|
-
<AppVersion>1.0000</AppVersion>
|
|
99261
|
-
</Properties>`;
|
|
99262
|
-
}
|
|
99263
99943
|
async function buildBlankPresentationArchive(options2) {
|
|
99264
99944
|
const width = options2?.width ?? DEFAULT_WIDTH;
|
|
99265
99945
|
const height = options2?.height ?? DEFAULT_HEIGHT;
|
|
@@ -99301,7 +99981,7 @@ async function buildBlankPresentationArchive(options2) {
|
|
|
99301
99981
|
zip.file("ppt/viewProps.xml", viewPropsXml());
|
|
99302
99982
|
zip.file("ppt/tableStyles.xml", tableStylesXml());
|
|
99303
99983
|
zip.file("docProps/core.xml", corePropsXml(options2?.title, options2?.creator));
|
|
99304
|
-
zip.file("docProps/app.xml",
|
|
99984
|
+
zip.file("docProps/app.xml", newPresentationAppXml(initialSlideCount, options2?.appProperties));
|
|
99305
99985
|
return zip.generateAsync({ type: "arraybuffer" });
|
|
99306
99986
|
}
|
|
99307
99987
|
var PresentationBuilder = class {
|
|
@@ -99326,7 +100006,7 @@ var PresentationBuilder = class {
|
|
|
99326
100006
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
99327
100007
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
99328
100008
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
99329
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
100009
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler, options2?.shapeDefaults);
|
|
99330
100010
|
};
|
|
99331
100011
|
return { handler, data, createSlide };
|
|
99332
100012
|
}
|