ooxml-core 1.47.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-NXHZ6ITL.mjs → PptxHandler-PLSH2BAS.mjs} +2 -2
- package/dist/PptxHandler-QLKZVYCG.mjs +5 -0
- package/dist/{PresentationBuilder-URSPID7L.mjs → PresentationBuilder-3QXOJNRO.mjs} +2 -2
- package/dist/{PresentationBuilder-IK6NIK6T.cjs → PresentationBuilder-CRBFFHNW.cjs} +6 -6
- package/dist/{PresentationBuilder-LHQ333UL.mjs → PresentationBuilder-DQ3XFU4R.mjs} +3 -3
- package/dist/{chunk-QHR726W3.mjs → chunk-32K7JG2Z.mjs} +1 -1
- package/dist/{chunk-APCA7N6Q.cjs → chunk-7RCBSNXT.cjs} +3 -3
- package/dist/{chunk-6MU4WKHS.mjs → chunk-CXIDPUT6.mjs} +1 -1
- package/dist/{chunk-553WFEHD.mjs → chunk-EKEE6BTU.mjs} +638 -50
- package/dist/{chunk-XVEJS7HN.mjs → chunk-IKFTITJ7.mjs} +4 -4
- package/dist/{chunk-7L6ZAA5Y.mjs → chunk-K5G6MV37.mjs} +2 -2
- package/dist/{chunk-4GPLQEEC.cjs → chunk-RRA262A6.cjs} +1926 -1326
- package/dist/{chunk-5HNRZOBX.mjs → chunk-WAYEYX4G.mjs} +1 -1
- package/dist/{chunk-Z734BYYR.mjs → chunk-WLKOLTBH.mjs} +653 -53
- package/dist/pptx/automation/index.cjs +45094 -44442
- 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-BDVzSboe.d.ts → index-BaBgJR8i.d.ts} +182 -15
- package/dist/pptx/chunks/index-BaBgJR8i.d.ts.map +1 -0
- package/dist/pptx/chunks/{index--HBUyILF.d.ts → index-ClHCBGOf.d.ts} +9 -7
- package/dist/pptx/chunks/{index--HBUyILF.d.ts.map → index-ClHCBGOf.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Dr3iIPt9.d.ts → index-DqkBjVqR.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Dr3iIPt9.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 +746 -94
- 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 +34610 -33974
- 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-JX62VKU4.cjs +0 -14
- package/dist/PptxHandler-SUGLNSZI.mjs +0 -5
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BDVzSboe.d.ts.map +0 -1
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +0 -1
- /package/dist/{chunk-WFN6ZU7N.cjs → chunk-HBQBS7PO.cjs} +0 -0
- /package/dist/{chunk-DEDK2J57.mjs → chunk-I5REMIZR.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, tableCellTextBodyMatches } from './chunk-
|
|
2
|
-
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, themeColorRefFromColorChoice, formatAutoNumberMarker, readText3DValues, cloneXmlObject, readScene3DValues, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, 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, 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, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, drawingLineXml, parseDrawingTextBody, parseXml, parseDrawingFill, parseDrawingLine, first, buildXml, setDrawingFillXml, fillElementOf, patchDrawingLine, elements,
|
|
1
|
+
import { DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, tableCellTextBodyMatches } from './chunk-CXIDPUT6.mjs';
|
|
2
|
+
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, themeColorRefFromColorChoice, formatAutoNumberMarker, readText3DValues, cloneXmlObject, readScene3DValues, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, 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, 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, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, drawingColorXml, applyDiagramRelationshipIds, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, CAMERA_PRESETS, LIGHT_RIGS, LIGHT_DIRECTIONS, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, reorderObjectKeysByLocalName, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, withDiagramPictureSources, diagramPictureRelationships, applySmartArtLayoutDefinition, 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, openZip, attr, parseDrawingEffects, drawingEffectsXml, readChartManualLayoutValues, buildEffectDagTreeFromXml, appendInSchemaOrder, RUN_PROPERTIES_ORDER, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, picturePercentage, ARTISTIC_PRIMARY_ATTRIBUTE, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, readPictureEffect, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, patchDrawingColorIn, 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, cssDegreesToOoxmlGradientAngle, svgToCustomGeometryPaths, IncorrectPasswordError, patchPictureEffects, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, stripXmlOrderMarkers, 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, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, deriveSlideTitles, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, cloneSlide, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, effectChild, mergeEffectNode, mergeAttributeEffectNode, parseDrawingLineDash, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, estimateMediaDurationMs, parseVmlElements, parseLineSpacingMultiplier, parseLineSpacingExactPt, formatSchemeKey, buildRelationshipsXml, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, guardZip, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, themeColorRefFromSchemeClr, ZipBombError, parseKinsoku, deobfuscateFont, detectFontFormat, parseDataTable, parseChartAxes, parseBubbleChartOptions, extractGuidFromPartName, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, extractCxSeriesColor, parseCxDataLabels, parseCxRegionMapOptions, parseCxAxes, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtLayoutDefinition, decodeBase64, parseSmartArtPresLayoutVars, parseDrawingColorIn, parseSmartArtConnection, connectionLabel, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, resolveDiagramLayoutCategory, captureDiagramPictures, parseDiagramDrawing, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, collectTransitionText, parseSmartArtQuickStyleLabels, parseDiagramQuickStyle, parseDiagramLayoutSummary, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, blendColorOntoWhite } from './chunk-I5REMIZR.mjs';
|
|
3
3
|
import { hasShapeProperties, hasTextProperties } from './chunk-GXHKNSZX.mjs';
|
|
4
4
|
import { EMU_PER_PX, EMU_PER_PIXEL, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, OOXML_PERCENT_UNITS, EMU_PER_POINT } from './chunk-CA7KCNL3.mjs';
|
|
5
5
|
import JSZip2 from 'jszip';
|
|
@@ -2005,6 +2005,18 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
2005
2005
|
};
|
|
2006
2006
|
}
|
|
2007
2007
|
|
|
2008
|
+
// pptx/core/utils/modify-verifier-codec.ts
|
|
2009
|
+
function base64Encode(bytes) {
|
|
2010
|
+
if (typeof Buffer !== "undefined") {
|
|
2011
|
+
return Buffer.from(bytes).toString("base64");
|
|
2012
|
+
}
|
|
2013
|
+
let binary = "";
|
|
2014
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
2015
|
+
binary += String.fromCharCode(bytes[i]);
|
|
2016
|
+
}
|
|
2017
|
+
return btoa(binary);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2008
2020
|
// chart/model-analysis.ts
|
|
2009
2021
|
var KIND_OF_TYPE = {
|
|
2010
2022
|
linear: "linear",
|
|
@@ -7681,41 +7693,41 @@ function parseBorderSide(side) {
|
|
|
7681
7693
|
}
|
|
7682
7694
|
const ln = typeof side["a:ln"] === "object" ? side["a:ln"] : {};
|
|
7683
7695
|
const border = {};
|
|
7684
|
-
let
|
|
7696
|
+
let has3 = false;
|
|
7685
7697
|
if (ln["a:noFill"] !== void 0) {
|
|
7686
7698
|
border.noFill = true;
|
|
7687
|
-
|
|
7699
|
+
has3 = true;
|
|
7688
7700
|
}
|
|
7689
7701
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
7690
7702
|
if (widthEmu > 0) {
|
|
7691
7703
|
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL2));
|
|
7692
|
-
|
|
7704
|
+
has3 = true;
|
|
7693
7705
|
}
|
|
7694
7706
|
const prstDash = ln["a:prstDash"];
|
|
7695
7707
|
const dashVal = prstDash ? String(prstDash["@_val"] || "").trim() : "";
|
|
7696
7708
|
if (dashVal) {
|
|
7697
7709
|
border.dash = dashVal;
|
|
7698
|
-
|
|
7710
|
+
has3 = true;
|
|
7699
7711
|
}
|
|
7700
7712
|
const cmpd = String(ln["@_cmpd"] || "").trim();
|
|
7701
7713
|
if (cmpd && cmpd !== "sng") {
|
|
7702
7714
|
border.compound = cmpd;
|
|
7703
|
-
|
|
7715
|
+
has3 = true;
|
|
7704
7716
|
}
|
|
7705
7717
|
const solidFill2 = ln["a:solidFill"];
|
|
7706
7718
|
const fill3 = parseSolidFillStyle(solidFill2);
|
|
7707
7719
|
if (fill3) {
|
|
7708
7720
|
border.fill = fill3;
|
|
7709
|
-
|
|
7721
|
+
has3 = true;
|
|
7710
7722
|
} else {
|
|
7711
7723
|
const srgb = solidFill2?.["a:srgbClr"];
|
|
7712
7724
|
const hex3 = srgb ? String(srgb["@_val"] || "").trim() : "";
|
|
7713
7725
|
if (hex3) {
|
|
7714
7726
|
border.color = hex3.startsWith("#") ? hex3 : `#${hex3}`;
|
|
7715
|
-
|
|
7727
|
+
has3 = true;
|
|
7716
7728
|
}
|
|
7717
7729
|
}
|
|
7718
|
-
return
|
|
7730
|
+
return has3 ? border : void 0;
|
|
7719
7731
|
}
|
|
7720
7732
|
function parseTableStyleBorders(tcStyle) {
|
|
7721
7733
|
const tcBdr = tcStyle?.["a:tcBdr"];
|
|
@@ -7723,16 +7735,16 @@ function parseTableStyleBorders(tcStyle) {
|
|
|
7723
7735
|
return void 0;
|
|
7724
7736
|
}
|
|
7725
7737
|
const result = {};
|
|
7726
|
-
let
|
|
7738
|
+
let has3 = false;
|
|
7727
7739
|
for (const name of BORDER_SIDES) {
|
|
7728
7740
|
const node = tcBdr[`a:${name}`] ?? (name === "tr2bl" ? tcBdr["a:bl2tr"] : void 0);
|
|
7729
7741
|
const border = parseBorderSide(node);
|
|
7730
7742
|
if (border) {
|
|
7731
7743
|
result[name] = border;
|
|
7732
|
-
|
|
7744
|
+
has3 = true;
|
|
7733
7745
|
}
|
|
7734
7746
|
}
|
|
7735
|
-
return
|
|
7747
|
+
return has3 ? result : void 0;
|
|
7736
7748
|
}
|
|
7737
7749
|
function parseTableStyleSectionCell3D(tcStyle) {
|
|
7738
7750
|
const cell3DNode = tcStyle?.["a:cell3D"];
|
|
@@ -10539,6 +10551,8 @@ var PptxSaveState = class {
|
|
|
10539
10551
|
emuPerPx;
|
|
10540
10552
|
usedSlideNumbers = /* @__PURE__ */ new Set();
|
|
10541
10553
|
usedMediaPaths = /* @__PURE__ */ new Set();
|
|
10554
|
+
/** New pictures' media parts in this save, by content (see `mediaPathForContent`). */
|
|
10555
|
+
newMediaByContent = /* @__PURE__ */ new Map();
|
|
10542
10556
|
usedInkPaths = /* @__PURE__ */ new Set();
|
|
10543
10557
|
maxInkPartIndex = 0;
|
|
10544
10558
|
existingCommentPaths = /* @__PURE__ */ new Set();
|
|
@@ -10579,6 +10593,23 @@ var PptxSaveState = class {
|
|
|
10579
10593
|
this.usedMediaPaths.add(filePath);
|
|
10580
10594
|
return filePath;
|
|
10581
10595
|
}
|
|
10596
|
+
/**
|
|
10597
|
+
* The media part for a NEW picture's bytes: the part an identical picture
|
|
10598
|
+
* already got in this save, or a fresh one. Pictures loaded from the deck
|
|
10599
|
+
* keep their own parts and never come through here.
|
|
10600
|
+
*/
|
|
10601
|
+
mediaPathForContent(bytes, extension) {
|
|
10602
|
+
const key2 = `${extension.toLowerCase()}:${bytes.length}:${fnv1a(bytes)}`;
|
|
10603
|
+
const candidates = this.newMediaByContent.get(key2) ?? [];
|
|
10604
|
+
const same6 = candidates.find((candidate) => sameBytes(candidate.bytes, bytes));
|
|
10605
|
+
if (same6) {
|
|
10606
|
+
return { path: same6.path, reused: true };
|
|
10607
|
+
}
|
|
10608
|
+
const path3 = this.nextMediaPath(extension);
|
|
10609
|
+
candidates.push({ bytes, path: path3 });
|
|
10610
|
+
this.newMediaByContent.set(key2, candidates);
|
|
10611
|
+
return { path: path3, reused: false };
|
|
10612
|
+
}
|
|
10582
10613
|
getUsedMediaPaths() {
|
|
10583
10614
|
return this.usedMediaPaths;
|
|
10584
10615
|
}
|
|
@@ -10775,6 +10806,25 @@ var PptxSaveStateBuilder = class {
|
|
|
10775
10806
|
});
|
|
10776
10807
|
}
|
|
10777
10808
|
};
|
|
10809
|
+
function fnv1a(bytes) {
|
|
10810
|
+
let hash2 = 2166136261;
|
|
10811
|
+
for (const byte of bytes) {
|
|
10812
|
+
hash2 ^= byte;
|
|
10813
|
+
hash2 = Math.imul(hash2, 16777619) >>> 0;
|
|
10814
|
+
}
|
|
10815
|
+
return hash2;
|
|
10816
|
+
}
|
|
10817
|
+
function sameBytes(a, b) {
|
|
10818
|
+
if (a.length !== b.length) {
|
|
10819
|
+
return false;
|
|
10820
|
+
}
|
|
10821
|
+
for (let i = 0; i < a.length; i++) {
|
|
10822
|
+
if (a[i] !== b[i]) {
|
|
10823
|
+
return false;
|
|
10824
|
+
}
|
|
10825
|
+
}
|
|
10826
|
+
return true;
|
|
10827
|
+
}
|
|
10778
10828
|
|
|
10779
10829
|
// pptx/core/core/builders/PptxShapeIdValidator.ts
|
|
10780
10830
|
function collectCnvPrNodes(node, results, ensureArray12) {
|
|
@@ -57134,6 +57184,27 @@ function buildChartSpaceXml(chartData) {
|
|
|
57134
57184
|
return result;
|
|
57135
57185
|
}
|
|
57136
57186
|
|
|
57187
|
+
// pptx/core/core/runtime/picture-svg-blip.ts
|
|
57188
|
+
var SVG_BLIP_EXT_URI = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}";
|
|
57189
|
+
var SVG_NS = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
|
|
57190
|
+
var TRANSPARENT_PNG_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
57191
|
+
function addSvgBlipExtension(picture, relationshipId) {
|
|
57192
|
+
const blipFill = picture["p:blipFill"];
|
|
57193
|
+
const blip = blipFill?.["a:blip"];
|
|
57194
|
+
if (!blip || typeof blip !== "object") {
|
|
57195
|
+
return;
|
|
57196
|
+
}
|
|
57197
|
+
const ext = {
|
|
57198
|
+
"@_uri": SVG_BLIP_EXT_URI,
|
|
57199
|
+
"asvg:svgBlip": { "@_xmlns:asvg": SVG_NS, "@_r:embed": relationshipId }
|
|
57200
|
+
};
|
|
57201
|
+
const extLst = blip["a:extLst"] ?? {};
|
|
57202
|
+
const existing = extLst["a:ext"];
|
|
57203
|
+
const list2 = existing === void 0 ? [] : Array.isArray(existing) ? existing : [existing];
|
|
57204
|
+
extLst["a:ext"] = list2.length === 0 ? ext : [...list2, ext];
|
|
57205
|
+
blip["a:extLst"] = extLst;
|
|
57206
|
+
}
|
|
57207
|
+
|
|
57137
57208
|
// pptx/core/core/runtime/paragraph-scoped-segment-state.ts
|
|
57138
57209
|
function paragraphStateOf(segment) {
|
|
57139
57210
|
const state = {};
|
|
@@ -63895,7 +63966,7 @@ function renderZoomPreviewSvg(element2) {
|
|
|
63895
63966
|
}
|
|
63896
63967
|
|
|
63897
63968
|
// pptx/converter/SvgExporter.ts
|
|
63898
|
-
var
|
|
63969
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
63899
63970
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
63900
63971
|
function escXml(s) {
|
|
63901
63972
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -64340,7 +64411,7 @@ var SvgExporter = class _SvgExporter {
|
|
|
64340
64411
|
}
|
|
64341
64412
|
const defsBlock = ctx.defs.length ? `<defs>${ctx.defs.join("")}</defs>` : "";
|
|
64342
64413
|
return `<svg${attrs2({
|
|
64343
|
-
xmlns:
|
|
64414
|
+
xmlns: SVG_NS2,
|
|
64344
64415
|
"xmlns:xlink": XLINK_NS,
|
|
64345
64416
|
viewBox: `0 0 ${width} ${height}`,
|
|
64346
64417
|
width,
|
|
@@ -65380,17 +65451,37 @@ var PptxHandlerRuntime2 = class _PptxHandlerRuntime extends PptxHandlerRuntime {
|
|
|
65380
65451
|
|
|
65381
65452
|
// pptx/core/core/runtime/PptxHandlerRuntimeElementActions.ts
|
|
65382
65453
|
var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
65454
|
+
/**
|
|
65455
|
+
* Report a slide jump whose index names no slide of the deck being saved.
|
|
65456
|
+
* It is not written: PowerPoint does not open a file with a slide jump that
|
|
65457
|
+
* has no slide relationship.
|
|
65458
|
+
*/
|
|
65459
|
+
reportMissingSlideJumpTarget(elementId, index) {
|
|
65460
|
+
this.compatibilityService?.reportWarning({
|
|
65461
|
+
code: "SAVE_SLIDE_JUMP_TARGET_MISSING",
|
|
65462
|
+
message: `A slide jump to slide index ${index} has no such slide in the saved deck; the link was not written.`,
|
|
65463
|
+
severity: "warning",
|
|
65464
|
+
scope: "element",
|
|
65465
|
+
...elementId ? { elementId } : {}
|
|
65466
|
+
});
|
|
65467
|
+
}
|
|
65383
65468
|
/**
|
|
65384
65469
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
65385
65470
|
* a `p:cNvPr` parent.
|
|
65386
65471
|
*/
|
|
65387
|
-
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
65472
|
+
serializeSingleAction(cNvPr, nodeName, action, links, elementId) {
|
|
65388
65473
|
if (!action) {
|
|
65389
65474
|
delete cNvPr[nodeName];
|
|
65390
65475
|
return;
|
|
65391
65476
|
}
|
|
65392
65477
|
const node = {};
|
|
65393
|
-
const
|
|
65478
|
+
const slideJumpIndex = /^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? action.targetSlideIndex : void 0;
|
|
65479
|
+
const url = action.url?.trim() || (slideJumpIndex !== void 0 ? links.slideTargetAt?.(slideJumpIndex) : void 0);
|
|
65480
|
+
if (!url && slideJumpIndex !== void 0 && links.slideTargetAt) {
|
|
65481
|
+
this.reportMissingSlideJumpTarget(elementId, slideJumpIndex);
|
|
65482
|
+
delete cNvPr[nodeName];
|
|
65483
|
+
return;
|
|
65484
|
+
}
|
|
65394
65485
|
let rId = action.rId;
|
|
65395
65486
|
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
65396
65487
|
rId = void 0;
|
|
@@ -65481,8 +65572,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
65481
65572
|
}
|
|
65482
65573
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
65483
65574
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
65484
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
65485
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
65575
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links, el.id);
|
|
65576
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links, el.id);
|
|
65486
65577
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
65487
65578
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
65488
65579
|
}
|
|
@@ -75801,6 +75892,53 @@ var PptxHandlerRuntime30 = class extends PptxHandlerRuntime29 {
|
|
|
75801
75892
|
}
|
|
75802
75893
|
};
|
|
75803
75894
|
|
|
75895
|
+
// pptx/core/core/runtime/run-slide-jump-targets.ts
|
|
75896
|
+
var SLIDE_JUMP_ACTION = "ppaction://hlinksldjump";
|
|
75897
|
+
function withRunSlideJumpTarget(style, slideTargetAt, onMissing) {
|
|
75898
|
+
if (!style || !slideTargetAt) {
|
|
75899
|
+
return style;
|
|
75900
|
+
}
|
|
75901
|
+
const index = style.hyperlinkTargetSlideIndex;
|
|
75902
|
+
if (typeof index !== "number" || style.hyperlinkRId) {
|
|
75903
|
+
return style;
|
|
75904
|
+
}
|
|
75905
|
+
const hyperlink = style.hyperlink?.trim();
|
|
75906
|
+
if (hyperlink && !hyperlink.startsWith("ppaction://")) {
|
|
75907
|
+
return style;
|
|
75908
|
+
}
|
|
75909
|
+
if (style.hyperlinkAction && style.hyperlinkAction !== SLIDE_JUMP_ACTION) {
|
|
75910
|
+
return style;
|
|
75911
|
+
}
|
|
75912
|
+
const target = slideTargetAt(index);
|
|
75913
|
+
if (!target) {
|
|
75914
|
+
onMissing?.(index);
|
|
75915
|
+
const {
|
|
75916
|
+
hyperlink: _hyperlink,
|
|
75917
|
+
hyperlinkAction: _action,
|
|
75918
|
+
hyperlinkTargetSlideIndex: _index,
|
|
75919
|
+
hyperlinkTooltip: _tooltip,
|
|
75920
|
+
...rest
|
|
75921
|
+
} = style;
|
|
75922
|
+
return rest;
|
|
75923
|
+
}
|
|
75924
|
+
return { ...style, hyperlink: target, hyperlinkAction: SLIDE_JUMP_ACTION };
|
|
75925
|
+
}
|
|
75926
|
+
function withSegmentSlideJumpTargets(segments, slideTargetAt, onMissing) {
|
|
75927
|
+
if (!segments || !slideTargetAt) {
|
|
75928
|
+
return segments;
|
|
75929
|
+
}
|
|
75930
|
+
let changed = false;
|
|
75931
|
+
const next = segments.map((segment) => {
|
|
75932
|
+
const style = withRunSlideJumpTarget(segment.style, slideTargetAt, onMissing);
|
|
75933
|
+
if (style === segment.style) {
|
|
75934
|
+
return segment;
|
|
75935
|
+
}
|
|
75936
|
+
changed = true;
|
|
75937
|
+
return { ...segment, style };
|
|
75938
|
+
});
|
|
75939
|
+
return changed ? next : segments;
|
|
75940
|
+
}
|
|
75941
|
+
|
|
75804
75942
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveTextWriter.ts
|
|
75805
75943
|
var ADJ1_WARP_PRESETS = /* @__PURE__ */ new Set([
|
|
75806
75944
|
"textWave1",
|
|
@@ -75825,7 +75963,7 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
75825
75963
|
* text chains), and delegates paragraph creation to
|
|
75826
75964
|
* `createParagraphsFromTextContent`.
|
|
75827
75965
|
*/
|
|
75828
|
-
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap) {
|
|
75966
|
+
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap, slideTargetAt) {
|
|
75829
75967
|
const hasEditableTextContent = typeof el.text === "string" || (el.textSegments?.length ?? 0) > 0;
|
|
75830
75968
|
if (!hasEditableTextContent) {
|
|
75831
75969
|
return;
|
|
@@ -75948,10 +76086,15 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
75948
76086
|
);
|
|
75949
76087
|
}
|
|
75950
76088
|
txBody["a:bodyPr"] = bodyPr;
|
|
76089
|
+
const onMissing = (index) => this.reportMissingSlideJumpTarget(el.id, index);
|
|
75951
76090
|
txBody["a:p"] = this.createParagraphsFromTextContent(
|
|
75952
76091
|
textValueForSave,
|
|
75953
|
-
|
|
75954
|
-
|
|
76092
|
+
withRunSlideJumpTarget(
|
|
76093
|
+
this.routeElementParagraphGeometry(txBody, el.textStyle),
|
|
76094
|
+
slideTargetAt,
|
|
76095
|
+
onMissing
|
|
76096
|
+
),
|
|
76097
|
+
withSegmentSlideJumpTargets(textSegmentsForSave, slideTargetAt, onMissing),
|
|
75955
76098
|
resolveHyperlinkRelationshipId
|
|
75956
76099
|
);
|
|
75957
76100
|
}
|
|
@@ -76062,6 +76205,94 @@ function shouldWritePictureGeometry(el, spPr) {
|
|
|
76062
76205
|
return Boolean(spPr["a:prstGeom"] || spPr["a:custGeom"]);
|
|
76063
76206
|
}
|
|
76064
76207
|
|
|
76208
|
+
// pptx/core/core/runtime/save-picture-fill.ts
|
|
76209
|
+
var has2 = (value) => value !== void 0;
|
|
76210
|
+
function drawingPictureLayout(layout, emuPerPx) {
|
|
76211
|
+
const offset = (px) => px === void 0 ? void 0 : Math.round(px * emuPerPx);
|
|
76212
|
+
if ([
|
|
76213
|
+
layout.tileOffsetX,
|
|
76214
|
+
layout.tileOffsetY,
|
|
76215
|
+
layout.tileScaleX,
|
|
76216
|
+
layout.tileScaleY,
|
|
76217
|
+
layout.tileFlip,
|
|
76218
|
+
layout.tileAlignment
|
|
76219
|
+
].some(has2)) {
|
|
76220
|
+
const tile = {};
|
|
76221
|
+
const offsetX = offset(layout.tileOffsetX);
|
|
76222
|
+
const offsetY = offset(layout.tileOffsetY);
|
|
76223
|
+
if (offsetX !== void 0) tile.offsetXEmu = offsetX;
|
|
76224
|
+
if (offsetY !== void 0) tile.offsetYEmu = offsetY;
|
|
76225
|
+
if (layout.tileScaleX !== void 0) tile.scaleX = layout.tileScaleX;
|
|
76226
|
+
if (layout.tileScaleY !== void 0) tile.scaleY = layout.tileScaleY;
|
|
76227
|
+
if (layout.tileFlip !== void 0) tile.flip = layout.tileFlip;
|
|
76228
|
+
if (layout.tileAlignment !== void 0) tile.alignment = layout.tileAlignment;
|
|
76229
|
+
return { tile };
|
|
76230
|
+
}
|
|
76231
|
+
if ([layout.fillRectLeft, layout.fillRectTop, layout.fillRectRight, layout.fillRectBottom].some(has2)) {
|
|
76232
|
+
return {
|
|
76233
|
+
fillRect: {
|
|
76234
|
+
l: layout.fillRectLeft ?? 0,
|
|
76235
|
+
t: layout.fillRectTop ?? 0,
|
|
76236
|
+
r: layout.fillRectRight ?? 0,
|
|
76237
|
+
b: layout.fillRectBottom ?? 0
|
|
76238
|
+
}
|
|
76239
|
+
};
|
|
76240
|
+
}
|
|
76241
|
+
return void 0;
|
|
76242
|
+
}
|
|
76243
|
+
function blipFillXml(relId, layout, parse) {
|
|
76244
|
+
const xml = drawingFillXml({ kind: "picture", relId, layout }) ?? "";
|
|
76245
|
+
const node = parse(xml)["a:blipFill"];
|
|
76246
|
+
delete node["@_xmlns:a"];
|
|
76247
|
+
delete node["@_xmlns:r"];
|
|
76248
|
+
return node;
|
|
76249
|
+
}
|
|
76250
|
+
function checkedBlipFill(relId, layout, ctx) {
|
|
76251
|
+
try {
|
|
76252
|
+
return blipFillXml(relId, layout, ctx.parse);
|
|
76253
|
+
} catch (error) {
|
|
76254
|
+
if (!(error instanceof RangeError)) {
|
|
76255
|
+
throw error;
|
|
76256
|
+
}
|
|
76257
|
+
ctx.warn(
|
|
76258
|
+
"SAVE_PICTURE_LAYOUT_INVALID",
|
|
76259
|
+
`Picture tile or fill rectangle could not be written (${error.message}); the picture is stretched over its frame instead.`
|
|
76260
|
+
);
|
|
76261
|
+
const { rotWithShape } = layout;
|
|
76262
|
+
return blipFillXml(relId, rotWithShape === void 0 ? {} : { rotWithShape }, ctx.parse);
|
|
76263
|
+
}
|
|
76264
|
+
}
|
|
76265
|
+
function writeNewShapePictureFill(spPr, style, ctx) {
|
|
76266
|
+
const relId = style.fillImageUrl ? ctx.embed(style.fillImageUrl) : void 0;
|
|
76267
|
+
if (!relId) {
|
|
76268
|
+
ctx.warn(
|
|
76269
|
+
"SAVE_SHAPE_PICTURE_FILL_UNSUPPORTED",
|
|
76270
|
+
"Shape picture fill could not be embedded (it needs a data: URL); the shape was saved without a fill."
|
|
76271
|
+
);
|
|
76272
|
+
return;
|
|
76273
|
+
}
|
|
76274
|
+
const layout = {
|
|
76275
|
+
...drawingPictureLayout(style.fillImageLayout ?? {}, ctx.emuPerPx),
|
|
76276
|
+
rotWithShape: style.fillImageRotWithShape ?? true
|
|
76277
|
+
};
|
|
76278
|
+
setFillChoice(spPr, "a:blipFill", checkedBlipFill(relId, layout, ctx));
|
|
76279
|
+
}
|
|
76280
|
+
function applyNewPictureLayout(blipFill, layout, ctx) {
|
|
76281
|
+
const drawingLayout = drawingPictureLayout(layout, ctx.emuPerPx);
|
|
76282
|
+
const relId = blipFill["a:blip"]?.["@_r:embed"];
|
|
76283
|
+
if (!drawingLayout || typeof relId !== "string") {
|
|
76284
|
+
return;
|
|
76285
|
+
}
|
|
76286
|
+
const built = checkedBlipFill(relId, drawingLayout, ctx);
|
|
76287
|
+
delete blipFill["a:stretch"];
|
|
76288
|
+
delete blipFill["a:tile"];
|
|
76289
|
+
for (const key2 of ["a:tile", "a:stretch"]) {
|
|
76290
|
+
if (built[key2] !== void 0) {
|
|
76291
|
+
blipFill[key2] = built[key2];
|
|
76292
|
+
}
|
|
76293
|
+
}
|
|
76294
|
+
}
|
|
76295
|
+
|
|
76065
76296
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveElementEmbedding.ts
|
|
76066
76297
|
function getMediaReferenceContainer(shape2) {
|
|
76067
76298
|
if (!shape2) {
|
|
@@ -76073,7 +76304,7 @@ function getMediaReferenceContainer(shape2) {
|
|
|
76073
76304
|
}
|
|
76074
76305
|
return shape2["a:graphic"]?.["a:graphicData"];
|
|
76075
76306
|
}
|
|
76076
|
-
var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
76307
|
+
var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime31 {
|
|
76077
76308
|
/** Serialize table, chart, and SmartArt data when applicable. */
|
|
76078
76309
|
applyDataSerialization(shape2, el, slideId) {
|
|
76079
76310
|
if (el.type === "table" && "tableData" in el && el.tableData) {
|
|
@@ -76160,15 +76391,29 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
76160
76391
|
if (parsedImage) {
|
|
76161
76392
|
let targetImagePath = el.imagePath;
|
|
76162
76393
|
if (!targetImagePath) {
|
|
76163
|
-
|
|
76164
|
-
|
|
76394
|
+
const media = ctx.saveSession.mediaPathForContent(parsedImage.bytes, parsedImage.extension);
|
|
76395
|
+
targetImagePath = media.path;
|
|
76165
76396
|
const relativeMediaPath = targetImagePath.replace(/^ppt\//u, "../");
|
|
76166
|
-
ctx.slideRelationships.
|
|
76167
|
-
"@
|
|
76168
|
-
|
|
76169
|
-
|
|
76170
|
-
|
|
76397
|
+
const existingRelationshipId = media.reused ? ctx.slideRelationships.find(
|
|
76398
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === relativeMediaPath
|
|
76399
|
+
)?.["@_Id"] : void 0;
|
|
76400
|
+
const relationshipId = typeof existingRelationshipId === "string" ? existingRelationshipId : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76401
|
+
if (relationshipId !== existingRelationshipId) {
|
|
76402
|
+
ctx.slideRelationships.push({
|
|
76403
|
+
"@_Id": relationshipId,
|
|
76404
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76405
|
+
"@_Target": relativeMediaPath
|
|
76406
|
+
});
|
|
76407
|
+
}
|
|
76171
76408
|
shape2 = this.createPictureXml(el, relationshipId);
|
|
76409
|
+
this.embedNewSvgVariant(el, shape2, ctx);
|
|
76410
|
+
const blipFill = shape2["p:blipFill"];
|
|
76411
|
+
if (blipFill) {
|
|
76412
|
+
applyNewPictureLayout(blipFill, el, this.pictureFillSaveContext(el, ctx));
|
|
76413
|
+
}
|
|
76414
|
+
if (media.reused) {
|
|
76415
|
+
return shape2;
|
|
76416
|
+
}
|
|
76172
76417
|
}
|
|
76173
76418
|
if (targetImagePath) {
|
|
76174
76419
|
const targetExt = targetImagePath.toLowerCase().match(/\.(?<ext>[^./\\]+)$/u)?.groups?.["ext"];
|
|
@@ -76189,6 +76434,71 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
76189
76434
|
}
|
|
76190
76435
|
return shape2;
|
|
76191
76436
|
}
|
|
76437
|
+
/** Add an image relationship from the slide to `mediaPath`; its id. */
|
|
76438
|
+
addSlideImageRelationship(mediaPath, ctx) {
|
|
76439
|
+
const relationshipId = ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76440
|
+
ctx.slideRelationships.push({
|
|
76441
|
+
"@_Id": relationshipId,
|
|
76442
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76443
|
+
"@_Target": mediaPath.replace(/^ppt\//u, "../")
|
|
76444
|
+
});
|
|
76445
|
+
return relationshipId;
|
|
76446
|
+
}
|
|
76447
|
+
/** What the picture-fill writers need, bound to `el` on the slide being saved. */
|
|
76448
|
+
pictureFillSaveContext(el, ctx) {
|
|
76449
|
+
return {
|
|
76450
|
+
emuPerPx: _PptxHandlerRuntime.EMU_PER_PX,
|
|
76451
|
+
parse: (xml) => this.parser.parse(xml),
|
|
76452
|
+
embed: (dataUrl) => {
|
|
76453
|
+
const parsed = this.parseDataUrlToBytes(dataUrl);
|
|
76454
|
+
if (!parsed) {
|
|
76455
|
+
return void 0;
|
|
76456
|
+
}
|
|
76457
|
+
const mediaPath = ctx.saveSession.nextMediaPath(parsed.extension);
|
|
76458
|
+
this.zip.file(mediaPath, parsed.bytes);
|
|
76459
|
+
return this.addSlideImageRelationship(mediaPath, ctx);
|
|
76460
|
+
},
|
|
76461
|
+
warn: (code, message) => this.compatibilityService.reportWarning({
|
|
76462
|
+
code,
|
|
76463
|
+
message,
|
|
76464
|
+
scope: "element",
|
|
76465
|
+
slideId: ctx.slide.id,
|
|
76466
|
+
elementId: el.id
|
|
76467
|
+
})
|
|
76468
|
+
};
|
|
76469
|
+
}
|
|
76470
|
+
/**
|
|
76471
|
+
* For a new SVG picture (`svgData` without a part yet), write the SVG part
|
|
76472
|
+
* and point the blip's `asvg:svgBlip` extension at it; the blip itself
|
|
76473
|
+
* embeds the raster (`imageData`).
|
|
76474
|
+
*/
|
|
76475
|
+
embedNewSvgVariant(el, picture, ctx) {
|
|
76476
|
+
const svgData = el.svgData;
|
|
76477
|
+
if (!svgData || el.svgPath) {
|
|
76478
|
+
return;
|
|
76479
|
+
}
|
|
76480
|
+
const parsed = this.parseDataUrlToBytes(svgData);
|
|
76481
|
+
if (!parsed || parsed.extension.toLowerCase() !== "svg") {
|
|
76482
|
+
return;
|
|
76483
|
+
}
|
|
76484
|
+
const media = ctx.saveSession.mediaPathForContent(parsed.bytes, "svg");
|
|
76485
|
+
const target = media.path.replace(/^ppt\//u, "../");
|
|
76486
|
+
const existing = media.reused ? ctx.slideRelationships.find(
|
|
76487
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === target
|
|
76488
|
+
)?.["@_Id"] : void 0;
|
|
76489
|
+
const relationshipId = typeof existing === "string" ? existing : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76490
|
+
if (relationshipId !== existing) {
|
|
76491
|
+
ctx.slideRelationships.push({
|
|
76492
|
+
"@_Id": relationshipId,
|
|
76493
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76494
|
+
"@_Target": target
|
|
76495
|
+
});
|
|
76496
|
+
}
|
|
76497
|
+
if (!media.reused) {
|
|
76498
|
+
this.zip.file(media.path, parsed.bytes);
|
|
76499
|
+
}
|
|
76500
|
+
addSvgBlipExtension(picture, relationshipId);
|
|
76501
|
+
}
|
|
76192
76502
|
/** Embed media data and manage relationships for media elements. */
|
|
76193
76503
|
processMediaEmbedding(mediaElement, shape2, ctx) {
|
|
76194
76504
|
const mediaType = mediaElement.mediaType === "audio" ? "audio" : "video";
|
|
@@ -77870,6 +78180,10 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
77870
78180
|
}
|
|
77871
78181
|
if (!shape2 && (el.type === "text" || el.type === "shape")) {
|
|
77872
78182
|
shape2 = this.createElementXml(el);
|
|
78183
|
+
const spPr = ensureXmlChild(shape2, "p:spPr");
|
|
78184
|
+
if (spPr && el.shapeStyle?.fillMode === "image") {
|
|
78185
|
+
writeNewShapePictureFill(spPr, el.shapeStyle, this.pictureFillSaveContext(el, ctx));
|
|
78186
|
+
}
|
|
77873
78187
|
}
|
|
77874
78188
|
if (!shape2 && el.type === "connector") {
|
|
77875
78189
|
shape2 = this.createConnectorXml(el);
|
|
@@ -77982,7 +78296,8 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
77982
78296
|
shape2,
|
|
77983
78297
|
el,
|
|
77984
78298
|
ctx.resolveHyperlinkRelationshipId,
|
|
77985
|
-
ctx.getSlideRelationshipMap
|
|
78299
|
+
ctx.getSlideRelationshipMap,
|
|
78300
|
+
ctx.slideTargetAt
|
|
77986
78301
|
);
|
|
77987
78302
|
}
|
|
77988
78303
|
this.applyDataSerialization(shape2, el, ctx.slide.id);
|
|
@@ -98109,6 +98424,173 @@ function applyChartInputLayout(element2, input) {
|
|
|
98109
98424
|
}
|
|
98110
98425
|
}
|
|
98111
98426
|
|
|
98427
|
+
// pptx/core/builders/sdk/picture-layout-input.ts
|
|
98428
|
+
var FLIPS = /* @__PURE__ */ new Set(["none", "x", "y", "xy"]);
|
|
98429
|
+
var ALIGNMENTS = /* @__PURE__ */ new Set([
|
|
98430
|
+
"tl",
|
|
98431
|
+
"t",
|
|
98432
|
+
"tr",
|
|
98433
|
+
"l",
|
|
98434
|
+
"ctr",
|
|
98435
|
+
"r",
|
|
98436
|
+
"bl",
|
|
98437
|
+
"b",
|
|
98438
|
+
"br"
|
|
98439
|
+
]);
|
|
98440
|
+
var MAX_INSET = 10;
|
|
98441
|
+
function finite4(where, name, value) {
|
|
98442
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
98443
|
+
throw new RangeError(`${where}.${name} must be a finite number, got ${String(value)}`);
|
|
98444
|
+
}
|
|
98445
|
+
return value;
|
|
98446
|
+
}
|
|
98447
|
+
function tileLayout(where, tile) {
|
|
98448
|
+
const scale = (name) => {
|
|
98449
|
+
const value = finite4(where, `tile.${name}`, tile[name] ?? 1);
|
|
98450
|
+
if (value <= 0) {
|
|
98451
|
+
throw new RangeError(`${where}.tile.${name} must be above 0, got ${value}`);
|
|
98452
|
+
}
|
|
98453
|
+
return value;
|
|
98454
|
+
};
|
|
98455
|
+
const flip = tile.flip ?? "none";
|
|
98456
|
+
if (!FLIPS.has(flip)) {
|
|
98457
|
+
throw new RangeError(`${where}.tile.flip must be none, x, y or xy, got ${String(flip)}`);
|
|
98458
|
+
}
|
|
98459
|
+
const alignment = tile.alignment ?? "tl";
|
|
98460
|
+
if (!ALIGNMENTS.has(alignment)) {
|
|
98461
|
+
throw new RangeError(
|
|
98462
|
+
`${where}.tile.alignment must be one of ${[...ALIGNMENTS].join(", ")}, got ${String(alignment)}`
|
|
98463
|
+
);
|
|
98464
|
+
}
|
|
98465
|
+
return {
|
|
98466
|
+
tileOffsetX: finite4(where, "tile.offsetX", tile.offsetX ?? 0),
|
|
98467
|
+
tileOffsetY: finite4(where, "tile.offsetY", tile.offsetY ?? 0),
|
|
98468
|
+
tileScaleX: scale("scaleX"),
|
|
98469
|
+
tileScaleY: scale("scaleY"),
|
|
98470
|
+
tileFlip: flip,
|
|
98471
|
+
tileAlignment: alignment
|
|
98472
|
+
};
|
|
98473
|
+
}
|
|
98474
|
+
function fillRectLayout(where, rect) {
|
|
98475
|
+
const inset = (name) => {
|
|
98476
|
+
const value = finite4(where, `fillRect.${name}`, rect[name]);
|
|
98477
|
+
if (Math.abs(value) > MAX_INSET) {
|
|
98478
|
+
throw new RangeError(
|
|
98479
|
+
`${where}.fillRect.${name} must be between -${MAX_INSET} and ${MAX_INSET}, got ${value}`
|
|
98480
|
+
);
|
|
98481
|
+
}
|
|
98482
|
+
return value;
|
|
98483
|
+
};
|
|
98484
|
+
const layout = {
|
|
98485
|
+
fillRectLeft: inset("l"),
|
|
98486
|
+
fillRectTop: inset("t"),
|
|
98487
|
+
fillRectRight: inset("r"),
|
|
98488
|
+
fillRectBottom: inset("b")
|
|
98489
|
+
};
|
|
98490
|
+
if (layout.fillRectLeft + layout.fillRectRight >= 1) {
|
|
98491
|
+
throw new RangeError(`${where}.fillRect.l + r must be below 1, which leaves no picture`);
|
|
98492
|
+
}
|
|
98493
|
+
if (layout.fillRectTop + layout.fillRectBottom >= 1) {
|
|
98494
|
+
throw new RangeError(`${where}.fillRect.t + b must be below 1, which leaves no picture`);
|
|
98495
|
+
}
|
|
98496
|
+
return layout;
|
|
98497
|
+
}
|
|
98498
|
+
function mapPictureLayoutInput(where, input) {
|
|
98499
|
+
const { mode, tile, fillRect } = input;
|
|
98500
|
+
if (mode !== void 0 && mode !== "stretch" && mode !== "tile") {
|
|
98501
|
+
throw new RangeError(`${where}.mode must be 'stretch' or 'tile', got ${String(mode)}`);
|
|
98502
|
+
}
|
|
98503
|
+
if (tile && fillRect) {
|
|
98504
|
+
throw new RangeError(`${where} takes a tile or a fillRect, not both`);
|
|
98505
|
+
}
|
|
98506
|
+
if (tile && mode === "stretch") {
|
|
98507
|
+
throw new RangeError(`${where}.tile needs mode 'tile', got 'stretch'`);
|
|
98508
|
+
}
|
|
98509
|
+
if (fillRect && mode === "tile") {
|
|
98510
|
+
throw new RangeError(`${where}.fillRect needs mode 'stretch', got 'tile'`);
|
|
98511
|
+
}
|
|
98512
|
+
if (tile || mode === "tile") {
|
|
98513
|
+
return tileLayout(where, tile ?? {});
|
|
98514
|
+
}
|
|
98515
|
+
return fillRect ? fillRectLayout(where, fillRect) : void 0;
|
|
98516
|
+
}
|
|
98517
|
+
|
|
98518
|
+
// pptx/core/builders/sdk/link-input.ts
|
|
98519
|
+
var SLIDE_JUMP_ACTION2 = "ppaction://hlinksldjump";
|
|
98520
|
+
function mapLinkToAction(link) {
|
|
98521
|
+
if (!link) {
|
|
98522
|
+
return void 0;
|
|
98523
|
+
}
|
|
98524
|
+
const tooltip = link.tooltip !== void 0 ? { tooltip: link.tooltip } : {};
|
|
98525
|
+
if ("url" in link) {
|
|
98526
|
+
return { url: assertUrl(link.url), ...tooltip };
|
|
98527
|
+
}
|
|
98528
|
+
assertSlideIndex(link.slideIndex);
|
|
98529
|
+
return { action: SLIDE_JUMP_ACTION2, targetSlideIndex: link.slideIndex, ...tooltip };
|
|
98530
|
+
}
|
|
98531
|
+
function mapLinkToRunStyle(link) {
|
|
98532
|
+
if (!link) {
|
|
98533
|
+
return {};
|
|
98534
|
+
}
|
|
98535
|
+
const tooltip = link.tooltip !== void 0 ? { hyperlinkTooltip: link.tooltip } : {};
|
|
98536
|
+
if ("url" in link) {
|
|
98537
|
+
return { hyperlink: assertUrl(link.url), ...tooltip };
|
|
98538
|
+
}
|
|
98539
|
+
assertSlideIndex(link.slideIndex);
|
|
98540
|
+
return {
|
|
98541
|
+
hyperlink: SLIDE_JUMP_ACTION2,
|
|
98542
|
+
hyperlinkAction: SLIDE_JUMP_ACTION2,
|
|
98543
|
+
hyperlinkTargetSlideIndex: link.slideIndex,
|
|
98544
|
+
...tooltip
|
|
98545
|
+
};
|
|
98546
|
+
}
|
|
98547
|
+
function assertUrl(url) {
|
|
98548
|
+
if (typeof url !== "string" || url.trim() === "") {
|
|
98549
|
+
throw new RangeError("LinkInput.url must be a non-empty address");
|
|
98550
|
+
}
|
|
98551
|
+
return url;
|
|
98552
|
+
}
|
|
98553
|
+
function assertSlideIndex(index) {
|
|
98554
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
98555
|
+
throw new RangeError(`LinkInput.slideIndex must be a 0-based slide position, got ${index}`);
|
|
98556
|
+
}
|
|
98557
|
+
}
|
|
98558
|
+
|
|
98559
|
+
// pptx/core/builders/sdk/svg-picture-input.ts
|
|
98560
|
+
var SVG_DATA_URL = /^data:image\/svg\+xml(?<params>[^,]*),(?<payload>[\s\S]*)$/iu;
|
|
98561
|
+
function svgPictureSource(source, svgFallback) {
|
|
98562
|
+
if (svgFallback !== void 0 && SVG_DATA_URL.test(svgFallback)) {
|
|
98563
|
+
throw new RangeError("ImageOptions.svgFallback must be a raster image, not SVG");
|
|
98564
|
+
}
|
|
98565
|
+
const match = SVG_DATA_URL.exec(source);
|
|
98566
|
+
if (!match?.groups) {
|
|
98567
|
+
if (svgFallback !== void 0) {
|
|
98568
|
+
throw new RangeError("ImageOptions.svgFallback applies only to an SVG data URL source");
|
|
98569
|
+
}
|
|
98570
|
+
return void 0;
|
|
98571
|
+
}
|
|
98572
|
+
const params = match.groups["params"] ?? "";
|
|
98573
|
+
const payload = match.groups["payload"] ?? "";
|
|
98574
|
+
const base64 = /;base64$/iu.test(params);
|
|
98575
|
+
const text = base64 ? decodeBase64Text(payload) : decodeURIComponent(payload);
|
|
98576
|
+
if (!/<svg[\s>]/iu.test(text)) {
|
|
98577
|
+
throw new RangeError("An SVG picture source must hold an <svg> element");
|
|
98578
|
+
}
|
|
98579
|
+
return {
|
|
98580
|
+
svgData: base64 ? `data:image/svg+xml;base64,${payload.replace(/\s+/gu, "")}` : `data:image/svg+xml;base64,${base64Encode(new TextEncoder().encode(text))}`,
|
|
98581
|
+
raster: svgFallback ?? TRANSPARENT_PNG_DATA_URL
|
|
98582
|
+
};
|
|
98583
|
+
}
|
|
98584
|
+
function decodeBase64Text(payload) {
|
|
98585
|
+
try {
|
|
98586
|
+
const binary = atob(payload.replace(/\s+/gu, ""));
|
|
98587
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
98588
|
+
return new TextDecoder().decode(bytes);
|
|
98589
|
+
} catch {
|
|
98590
|
+
throw new RangeError("An SVG picture source has base64 data that cannot be read");
|
|
98591
|
+
}
|
|
98592
|
+
}
|
|
98593
|
+
|
|
98112
98594
|
// pptx/core/builders/sdk/picture-effects-input.ts
|
|
98113
98595
|
function pictureEffectsFromInput(options2) {
|
|
98114
98596
|
const { opacity: opacity2, brightness, contrast } = options2 ?? {};
|
|
@@ -98189,12 +98671,18 @@ function mapFillToShapeStyle(fill3) {
|
|
|
98189
98671
|
...fill3.foreground !== void 0 ? { fillColor: fill3.foreground } : {},
|
|
98190
98672
|
fillPatternBackgroundColor: fill3.background
|
|
98191
98673
|
};
|
|
98192
|
-
case "image":
|
|
98674
|
+
case "image": {
|
|
98675
|
+
if (typeof fill3.url !== "string" || !fill3.url.startsWith("data:")) {
|
|
98676
|
+
throw new RangeError("FillInput.url of an image fill must be a data: URL");
|
|
98677
|
+
}
|
|
98678
|
+
const layout = mapPictureLayoutInput("FillInput", fill3);
|
|
98193
98679
|
return {
|
|
98194
98680
|
fillMode: "image",
|
|
98195
98681
|
fillImageUrl: fill3.url,
|
|
98196
|
-
fillImageMode:
|
|
98682
|
+
fillImageMode: layout?.tileScaleX !== void 0 ? "tile" : "stretch",
|
|
98683
|
+
...layout ? { fillImageLayout: layout } : {}
|
|
98197
98684
|
};
|
|
98685
|
+
}
|
|
98198
98686
|
case "none":
|
|
98199
98687
|
return { fillMode: "none" };
|
|
98200
98688
|
default:
|
|
@@ -98537,6 +99025,62 @@ function columnFractions(columnWidths, columnCount) {
|
|
|
98537
99025
|
return columnWidths.map((w) => w / sum);
|
|
98538
99026
|
}
|
|
98539
99027
|
|
|
99028
|
+
// pptx/core/builders/sdk/text-body-input.ts
|
|
99029
|
+
var EMU_PER_PX5 = 9525;
|
|
99030
|
+
var MAX_INSET_EMU = 51206400;
|
|
99031
|
+
var MAX_SPC = 4e5;
|
|
99032
|
+
var INSET_FIELDS = {
|
|
99033
|
+
left: "bodyInsetLeft",
|
|
99034
|
+
top: "bodyInsetTop",
|
|
99035
|
+
right: "bodyInsetRight",
|
|
99036
|
+
bottom: "bodyInsetBottom"
|
|
99037
|
+
};
|
|
99038
|
+
var AUTO_FIT = {
|
|
99039
|
+
// The model's `autoFitMode` names read the other way round: `'normal'` is
|
|
99040
|
+
// `a:normAutofit` (PowerPoint shrinks the text on overflow) and `'shrink'`
|
|
99041
|
+
// is `a:spAutoFit` (the shape grows to fit the text).
|
|
99042
|
+
shrinkText: { autoFit: true, autoFitMode: "normal" },
|
|
99043
|
+
resizeShape: { autoFit: true, autoFitMode: "shrink" },
|
|
99044
|
+
none: { autoFit: false, autoFitMode: "none" }
|
|
99045
|
+
};
|
|
99046
|
+
function mapTextBodyInput(input) {
|
|
99047
|
+
const style = {};
|
|
99048
|
+
if (!input) {
|
|
99049
|
+
return style;
|
|
99050
|
+
}
|
|
99051
|
+
const { insets, autoFit, wrap: wrap2 } = input;
|
|
99052
|
+
for (const side of Object.keys(INSET_FIELDS)) {
|
|
99053
|
+
const value = insets?.[side];
|
|
99054
|
+
if (value === void 0) {
|
|
99055
|
+
continue;
|
|
99056
|
+
}
|
|
99057
|
+
if (!Number.isFinite(value) || Math.abs(value * EMU_PER_PX5) > MAX_INSET_EMU) {
|
|
99058
|
+
throw new RangeError(`insets.${side} must be a finite px length, got ${value}`);
|
|
99059
|
+
}
|
|
99060
|
+
style[INSET_FIELDS[side]] = value;
|
|
99061
|
+
}
|
|
99062
|
+
if (autoFit !== void 0) {
|
|
99063
|
+
const mapped = AUTO_FIT[autoFit];
|
|
99064
|
+
if (!mapped) {
|
|
99065
|
+
throw new RangeError(
|
|
99066
|
+
`autoFit must be 'none', 'shrinkText' or 'resizeShape', got ${String(autoFit)}`
|
|
99067
|
+
);
|
|
99068
|
+
}
|
|
99069
|
+
Object.assign(style, mapped);
|
|
99070
|
+
}
|
|
99071
|
+
if (wrap2 !== void 0) {
|
|
99072
|
+
style.textWrap = wrap2 ? "square" : "none";
|
|
99073
|
+
}
|
|
99074
|
+
return style;
|
|
99075
|
+
}
|
|
99076
|
+
function characterSpacingToSpc(px) {
|
|
99077
|
+
const spc = Math.round(px * 75);
|
|
99078
|
+
if (!Number.isFinite(px) || Math.abs(spc) > MAX_SPC) {
|
|
99079
|
+
throw new RangeError(`characterSpacing must be a finite px length, got ${px}`);
|
|
99080
|
+
}
|
|
99081
|
+
return spc;
|
|
99082
|
+
}
|
|
99083
|
+
|
|
98540
99084
|
// pptx/core/builders/sdk/text-segment-style.ts
|
|
98541
99085
|
var RUN_KEYS = [
|
|
98542
99086
|
"fontFamily",
|
|
@@ -98645,6 +99189,12 @@ function mapTextStyleInput(opts) {
|
|
|
98645
99189
|
if (opts.spaceAfter !== void 0) {
|
|
98646
99190
|
ts.paragraphSpacingAfter = opts.spaceAfter;
|
|
98647
99191
|
}
|
|
99192
|
+
if (opts.characterSpacing !== void 0) {
|
|
99193
|
+
ts.characterSpacing = characterSpacingToSpc(opts.characterSpacing);
|
|
99194
|
+
}
|
|
99195
|
+
if (opts.link !== void 0) {
|
|
99196
|
+
Object.assign(ts, mapLinkToRunStyle(opts.link));
|
|
99197
|
+
}
|
|
98648
99198
|
return ts;
|
|
98649
99199
|
}
|
|
98650
99200
|
function buildTextSegments(input, baseStyle) {
|
|
@@ -98669,6 +99219,34 @@ function buildTextSegments(input, baseStyle) {
|
|
|
98669
99219
|
style: { ...base, ...mapTextStyleInput(seg.style) }
|
|
98670
99220
|
}));
|
|
98671
99221
|
}
|
|
99222
|
+
function flipsOf(options2) {
|
|
99223
|
+
return {
|
|
99224
|
+
...options2?.flipHorizontal ? { flipHorizontal: true } : {},
|
|
99225
|
+
...options2?.flipVertical ? { flipVertical: true } : {}
|
|
99226
|
+
};
|
|
99227
|
+
}
|
|
99228
|
+
function applyShapeText(el, options2) {
|
|
99229
|
+
const text = options2?.text;
|
|
99230
|
+
if (!text || text.length === 0) {
|
|
99231
|
+
const body = mapTextBodyInput(options2);
|
|
99232
|
+
if (Object.keys(body).length > 0) {
|
|
99233
|
+
el.text = "";
|
|
99234
|
+
el.textStyle = body;
|
|
99235
|
+
}
|
|
99236
|
+
return;
|
|
99237
|
+
}
|
|
99238
|
+
const textSegments = buildTextSegments(text, options2.textStyle);
|
|
99239
|
+
el.text = typeof text === "string" ? text : text.map((s) => s.text).join("");
|
|
99240
|
+
el.textStyle = {
|
|
99241
|
+
...elementStyleForSegments(mapTextStyleInput(options2.textStyle), textSegments),
|
|
99242
|
+
...mapTextBodyInput(options2)
|
|
99243
|
+
};
|
|
99244
|
+
el.textSegments = textSegments;
|
|
99245
|
+
}
|
|
99246
|
+
function withAction(link) {
|
|
99247
|
+
const actionClick = mapLinkToAction(link);
|
|
99248
|
+
return actionClick ? { actionClick } : {};
|
|
99249
|
+
}
|
|
98672
99250
|
var DEFAULTS = {
|
|
98673
99251
|
text: { x: 100, y: 100, width: 600, height: 50 },
|
|
98674
99252
|
shape: { x: 200, y: 200, width: 300, height: 200 },
|
|
@@ -98709,32 +99287,36 @@ function createTextElement(text, options2) {
|
|
|
98709
99287
|
id: generateId("txt"),
|
|
98710
99288
|
...p,
|
|
98711
99289
|
rotation: options2?.rotation,
|
|
99290
|
+
...flipsOf(options2),
|
|
98712
99291
|
opacity: options2?.opacity,
|
|
98713
99292
|
text: plainText,
|
|
98714
|
-
textStyle:
|
|
99293
|
+
textStyle: {
|
|
99294
|
+
...elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
|
|
99295
|
+
...mapTextBodyInput(options2)
|
|
99296
|
+
},
|
|
98715
99297
|
textSegments,
|
|
98716
|
-
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
|
|
99298
|
+
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill)),
|
|
99299
|
+
...withAction(options2?.link)
|
|
98717
99300
|
};
|
|
98718
99301
|
}
|
|
98719
|
-
|
|
99302
|
+
var DEFAULT_SHAPE_FILL = { type: "solid", color: "#4472C4" };
|
|
99303
|
+
function createShapeElement(shapeType, options2, defaults) {
|
|
98720
99304
|
const p = pos("shape", options2);
|
|
98721
99305
|
const el = {
|
|
98722
99306
|
type: "shape",
|
|
98723
99307
|
id: generateId("shp"),
|
|
98724
99308
|
...p,
|
|
98725
99309
|
rotation: options2?.rotation,
|
|
99310
|
+
...flipsOf(options2),
|
|
98726
99311
|
opacity: options2?.opacity,
|
|
98727
99312
|
shapeType,
|
|
98728
99313
|
shapeAdjustments: options2?.adjustments,
|
|
98729
99314
|
shapeStyle: buildShapeStyle(
|
|
98730
|
-
effectInputs(options2, options2?.fill ??
|
|
98731
|
-
)
|
|
99315
|
+
effectInputs(options2, options2?.fill ?? defaults?.fill ?? DEFAULT_SHAPE_FILL)
|
|
99316
|
+
),
|
|
99317
|
+
...withAction(options2?.link)
|
|
98732
99318
|
};
|
|
98733
|
-
|
|
98734
|
-
el.text = options2.text;
|
|
98735
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98736
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98737
|
-
}
|
|
99319
|
+
applyShapeText(el, options2);
|
|
98738
99320
|
return el;
|
|
98739
99321
|
}
|
|
98740
99322
|
function createConnectorElement(options2) {
|
|
@@ -98770,12 +99352,20 @@ function createConnectorElement(options2) {
|
|
|
98770
99352
|
id: generateId("cxn"),
|
|
98771
99353
|
...p,
|
|
98772
99354
|
rotation: options2?.rotation,
|
|
99355
|
+
...flipsOf(options2),
|
|
98773
99356
|
shapeType: connType,
|
|
98774
99357
|
shapeStyle: style
|
|
98775
99358
|
};
|
|
98776
99359
|
}
|
|
98777
99360
|
function createImageElement(source, options2) {
|
|
98778
99361
|
const p = pos("image", options2);
|
|
99362
|
+
const svg = svgPictureSource(source, options2?.svgFallback);
|
|
99363
|
+
if (svg) {
|
|
99364
|
+
const { svgFallback: _raster, ...rest } = options2 ?? {};
|
|
99365
|
+
const svgPicture = createImageElement(svg.raster, rest);
|
|
99366
|
+
svgPicture.svgData = svg.svgData;
|
|
99367
|
+
return svgPicture;
|
|
99368
|
+
}
|
|
98779
99369
|
const isDataUrl = source.startsWith("data:");
|
|
98780
99370
|
const imageEffects = pictureEffectsFromInput(options2);
|
|
98781
99371
|
return {
|
|
@@ -98783,6 +99373,7 @@ function createImageElement(source, options2) {
|
|
|
98783
99373
|
id: generateId("img"),
|
|
98784
99374
|
...p,
|
|
98785
99375
|
rotation: options2?.rotation,
|
|
99376
|
+
...flipsOf(options2),
|
|
98786
99377
|
...imageEffects ? { imageEffects } : {},
|
|
98787
99378
|
imagePath: isDataUrl ? void 0 : source,
|
|
98788
99379
|
imageData: isDataUrl ? source : void 0,
|
|
@@ -98790,7 +99381,12 @@ function createImageElement(source, options2) {
|
|
|
98790
99381
|
cropLeft: options2?.cropLeft,
|
|
98791
99382
|
cropTop: options2?.cropTop,
|
|
98792
99383
|
cropRight: options2?.cropRight,
|
|
98793
|
-
cropBottom: options2?.cropBottom
|
|
99384
|
+
cropBottom: options2?.cropBottom,
|
|
99385
|
+
...mapPictureLayoutInput("ImageOptions", {
|
|
99386
|
+
tile: options2?.tile,
|
|
99387
|
+
fillRect: options2?.fillRect
|
|
99388
|
+
}),
|
|
99389
|
+
...withAction(options2?.link)
|
|
98794
99390
|
};
|
|
98795
99391
|
}
|
|
98796
99392
|
function createTableCell(cellInput) {
|
|
@@ -98895,6 +99491,7 @@ function createMediaElement(mediaType, source, options2) {
|
|
|
98895
99491
|
id: generateId("med"),
|
|
98896
99492
|
...p,
|
|
98897
99493
|
rotation: options2?.rotation,
|
|
99494
|
+
...flipsOf(options2),
|
|
98898
99495
|
mediaType,
|
|
98899
99496
|
mediaPath: isDataUrl ? void 0 : source,
|
|
98900
99497
|
mediaData: isDataUrl ? source : void 0,
|
|
@@ -98913,6 +99510,7 @@ function createGroupElement(children6, options2) {
|
|
|
98913
99510
|
id: generateId("grp"),
|
|
98914
99511
|
...p,
|
|
98915
99512
|
rotation: options2?.rotation,
|
|
99513
|
+
...flipsOf(options2),
|
|
98916
99514
|
children: children6
|
|
98917
99515
|
};
|
|
98918
99516
|
}
|
|
@@ -98926,6 +99524,7 @@ function createFreeformElement(pathData, options2) {
|
|
|
98926
99524
|
id: generateId("frm"),
|
|
98927
99525
|
...p,
|
|
98928
99526
|
rotation: options2?.rotation,
|
|
99527
|
+
...flipsOf(options2),
|
|
98929
99528
|
opacity: options2?.opacity,
|
|
98930
99529
|
shapeType: "custom",
|
|
98931
99530
|
pathData,
|
|
@@ -98935,13 +99534,10 @@ function createFreeformElement(pathData, options2) {
|
|
|
98935
99534
|
shapeStyle: buildShapeStyle({
|
|
98936
99535
|
...effectInputs(options2, options2?.fill ?? { type: "none" }),
|
|
98937
99536
|
stroke: options2?.stroke ?? { color: "#000000", width: 2 }
|
|
98938
|
-
})
|
|
99537
|
+
}),
|
|
99538
|
+
...withAction(options2?.link)
|
|
98939
99539
|
};
|
|
98940
|
-
|
|
98941
|
-
el.text = options2.text;
|
|
98942
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98943
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98944
|
-
}
|
|
99540
|
+
applyShapeText(el, options2);
|
|
98945
99541
|
return el;
|
|
98946
99542
|
}
|
|
98947
99543
|
|
|
@@ -98952,9 +99548,12 @@ var SlideBuilder = class {
|
|
|
98952
99548
|
* @param layoutPath - Optional layout archive path.
|
|
98953
99549
|
* @param layoutName - Optional layout display name.
|
|
98954
99550
|
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
99551
|
+
* @param shapeDefaults - What `addShape` uses for an omitted option
|
|
99552
|
+
* (`PresentationOptions.shapeDefaults`).
|
|
98955
99553
|
*/
|
|
98956
|
-
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
99554
|
+
constructor(slideNumber, layoutPath, layoutName, handler, shapeDefaults) {
|
|
98957
99555
|
this.handler = handler;
|
|
99556
|
+
this.shapeDefaults = shapeDefaults;
|
|
98958
99557
|
this.slide = {
|
|
98959
99558
|
id: `slide${slideNumber}`,
|
|
98960
99559
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -98965,6 +99564,7 @@ var SlideBuilder = class {
|
|
|
98965
99564
|
};
|
|
98966
99565
|
}
|
|
98967
99566
|
handler;
|
|
99567
|
+
shapeDefaults;
|
|
98968
99568
|
slide;
|
|
98969
99569
|
/** Add a text box to the slide. */
|
|
98970
99570
|
addText(text, options2) {
|
|
@@ -99012,7 +99612,7 @@ var SlideBuilder = class {
|
|
|
99012
99612
|
}
|
|
99013
99613
|
/** Add a shape to the slide. */
|
|
99014
99614
|
addShape(shapeType, options2) {
|
|
99015
|
-
this.slide.elements.push(createShapeElement(shapeType, options2));
|
|
99615
|
+
this.slide.elements.push(createShapeElement(shapeType, options2, this.shapeDefaults));
|
|
99016
99616
|
return this;
|
|
99017
99617
|
}
|
|
99018
99618
|
/** Add a connector (line) to the slide. */
|
|
@@ -99788,7 +100388,7 @@ var PresentationBuilder = class {
|
|
|
99788
100388
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
99789
100389
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
99790
100390
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
99791
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
100391
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler, options2?.shapeDefaults);
|
|
99792
100392
|
};
|
|
99793
100393
|
return { handler, data, createSlide };
|
|
99794
100394
|
}
|