pptxgenjs-plus 4.1.19 → 4.2.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.
@@ -1,4 +1,4 @@
1
- /* PptxGenJS 4.1.19 @ 2026-08-20T04:59:53.032Z */
1
+ /* PptxGenJS 4.2.0 @ 2026-08-24T12:56:09.653Z */
2
2
 
3
3
  import { JSZip } from "@node-projects/jszip";
4
4
  import { parseXml } from "@rgrove/parse-xml";
@@ -15,6 +15,34 @@ const ONEPT = 12700 // One (1) point (pt)
15
15
  const CRLF = '\r\n' // AKA: Chr(13) & Chr(10)
16
16
  ;
17
17
  const LAYOUT_IDX_SERIES_BASE = 2147483649;
18
+ /** ECMA-376 20.1.10.55 ST_RectAlignment — where a tiled picture fill starts */ const TILE_ALIGNMENTS = new Set([
19
+ 'tl',
20
+ 't',
21
+ 'tr',
22
+ 'l',
23
+ 'ctr',
24
+ 'r',
25
+ 'bl',
26
+ 'b',
27
+ 'br'
28
+ ]);
29
+ /**
30
+ * ECMA-376 20.1.6.2 CT_ColorMapping - the identity map, which is what `a:masterClrMapping` means
31
+ * - all twelve attributes are required, so a partial `colorMapOverride` is filled from this
32
+ */ const DEF_COLOR_MAP = Object.freeze({
33
+ bg1: 'lt1',
34
+ tx1: 'dk1',
35
+ bg2: 'lt2',
36
+ tx2: 'dk2',
37
+ accent1: 'accent1',
38
+ accent2: 'accent2',
39
+ accent3: 'accent3',
40
+ accent4: 'accent4',
41
+ accent5: 'accent5',
42
+ accent6: 'accent6',
43
+ hlink: 'hlink',
44
+ folHlink: 'folHlink'
45
+ });
18
46
  const REGEX_HEX_COLOR = /^[0-9a-fA-F]{6}$/;
19
47
  const LINEH_MODIFIER = 1.67 // AKA: Golden Ratio Typography
20
48
  ;
@@ -90,6 +118,51 @@ const AXIS_ID_VALUE_SECONDARY = '2094734553';
90
118
  const AXIS_ID_CATEGORY_PRIMARY = '2094734554';
91
119
  const AXIS_ID_CATEGORY_SECONDARY = '2094734555';
92
120
  const AXIS_ID_SERIES_PRIMARY = '2094734556';
121
+ /**
122
+ * Chart style and chart colour-style parts (MS-ODRAWXML)
123
+ * - verified against Microsoft's own `ChartStylePart`/`ChartColorStylePart` definitions in
124
+ * dotnet/Open-XML-SDK, cross-checked against LibreOffice, rubyXL and OpenXLSX
125
+ * - note the asymmetry: the namespace is dated 2012, the relationships 2011. That is correct.
126
+ */ const CHART_STYLE = Object.freeze({
127
+ ns: 'http://schemas.microsoft.com/office/drawing/2012/chartStyle',
128
+ styleContentType: 'application/vnd.ms-office.chartstyle+xml',
129
+ colorsContentType: 'application/vnd.ms-office.chartcolorstyle+xml',
130
+ styleRelType: 'http://schemas.microsoft.com/office/2011/relationships/chartStyle',
131
+ colorsRelType: 'http://schemas.microsoft.com/office/2011/relationships/chartColorStyle'
132
+ });
133
+ /**
134
+ * ChartEx (PowerPoint 2016+) package contract - MS-ODRAWXML 2.1.
135
+ *
136
+ * These chart types have no ECMA-376 representation: they live in their own `cx:chartSpace` part with a
137
+ * Microsoft content type and relationship type, and the slide-level `p:graphicFrame` must sit inside an
138
+ * `mc:AlternateContent` so consumers that predate them still get a fallback.
139
+ *
140
+ * The `requires` namespace is the schema generation a consumer must understand before it may take the
141
+ * `mc:Choice`; funnel arrived a revision after the 2016 launch set, so it gates on a later one.
142
+ */ const OOXML_CHARTEX = {
143
+ /** `cx` - the chartex part's own namespace, and the `a:graphicData@uri` that identifies the frame */ ns: 'http://schemas.microsoft.com/office/drawing/2014/chartex',
144
+ partContentType: 'application/vnd.ms-office.chartex+xml',
145
+ relType: 'http://schemas.microsoft.com/office/2014/relationships/chartEx',
146
+ /** `mc:Choice@Requires` namespace for the Office 2016 launch layouts */ requires2016: 'http://schemas.microsoft.com/office/drawing/2015/9/8/chartex',
147
+ /** `mc:Choice@Requires` namespace for funnel, which shipped a schema revision later */ requiresFunnel: 'http://schemas.microsoft.com/office/drawing/2015/10/21/chartex'
148
+ };
149
+ /** `cx:series@layoutId` per chart type - a histogram is a `clusteredColumn` layout carrying `cx:binning` */ const CHARTEX_LAYOUT_ID = {
150
+ boxWhisker: 'boxWhisker',
151
+ funnel: 'funnel',
152
+ histogram: 'clusteredColumn',
153
+ sunburst: 'sunburst',
154
+ treemap: 'treemap',
155
+ waterfall: 'waterfall'
156
+ };
157
+ /**
158
+ * `mc:Choice@Requires` namespace gating a chartex chart type
159
+ * - funnel arrived a schema revision after the 2016 launch layouts, so it gates on a later generation
160
+ */ function chartExRequiresNs(chartType) {
161
+ return chartType === 'funnel' ? OOXML_CHARTEX.requiresFunnel : OOXML_CHARTEX.requires2016;
162
+ }
163
+ /** True when `type` is emitted through the chartex pipeline rather than the ECMA-376 one */ function isChartexType(type) {
164
+ return typeof type === 'string' && Object.prototype.hasOwnProperty.call(CHARTEX_LAYOUT_ID, type);
165
+ }
93
166
  /**
94
167
  * Slide transition type.
95
168
  * Base set is ECMA-376 §19.3.1.50; the rest are MS-PPTX §2.2.1 modern transitions (emitted via mc:AlternateContent).
@@ -206,6 +279,27 @@ var core_enums_TEXT_VALIGN = /*#__PURE__*/ function(TEXT_VALIGN) {
206
279
  return TEXT_VALIGN;
207
280
  }({});
208
281
  const SLDNUMFLDID = '{F7021451-1387-4CA6-816F-3879F97B5CBC}';
282
+ /** ECMA-376 21.1.2.2.4 — `a:fld@type` values PowerPoint refreshes */ const TEXT_FIELD_TYPES = new Set([
283
+ 'slidenum',
284
+ 'datetime',
285
+ 'datetimeFigureOut',
286
+ 'datetime1',
287
+ 'datetime2',
288
+ 'datetime3',
289
+ 'datetime4',
290
+ 'datetime5',
291
+ 'datetime6',
292
+ 'datetime7',
293
+ 'datetime8',
294
+ 'datetime9',
295
+ 'datetime10',
296
+ 'datetime11',
297
+ 'datetime12',
298
+ 'datetime13',
299
+ 'headerfooter',
300
+ 'hdr',
301
+ 'ftr'
302
+ ]);
209
303
  // ENUM
210
304
  // TODO: 3.5 or v4.0: rationalize ts-def exported enum names/case!
211
305
  // NOTE: First tsdef enum named correctly (shapes -> 'Shape', colors -> 'Color'), etc.
@@ -229,6 +323,12 @@ var core_enums_ChartType = /*#__PURE__*/ function(ChartType) {
229
323
  ChartType["pie"] = "pie";
230
324
  ChartType["radar"] = "radar";
231
325
  ChartType["scatter"] = "scatter";
326
+ ChartType["boxWhisker"] = "boxWhisker";
327
+ ChartType["funnel"] = "funnel";
328
+ ChartType["histogram"] = "histogram";
329
+ ChartType["sunburst"] = "sunburst";
330
+ ChartType["treemap"] = "treemap";
331
+ ChartType["waterfall"] = "waterfall";
232
332
  return ChartType;
233
333
  }({});
234
334
  var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
@@ -256,6 +356,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
256
356
  ShapeType["actionButtonSound"] = "actionButtonSound";
257
357
  ShapeType["arc"] = "arc";
258
358
  ShapeType["bentArrow"] = "bentArrow";
359
+ ShapeType["bentConnector2"] = "bentConnector2";
360
+ ShapeType["bentConnector3"] = "bentConnector3";
361
+ ShapeType["bentConnector4"] = "bentConnector4";
362
+ ShapeType["bentConnector5"] = "bentConnector5";
259
363
  ShapeType["bentUpArrow"] = "bentUpArrow";
260
364
  ShapeType["bevel"] = "bevel";
261
365
  ShapeType["blockArc"] = "blockArc";
@@ -279,6 +383,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
279
383
  ShapeType["corner"] = "corner";
280
384
  ShapeType["cornerTabs"] = "cornerTabs";
281
385
  ShapeType["cube"] = "cube";
386
+ ShapeType["curvedConnector2"] = "curvedConnector2";
387
+ ShapeType["curvedConnector3"] = "curvedConnector3";
388
+ ShapeType["curvedConnector4"] = "curvedConnector4";
389
+ ShapeType["curvedConnector5"] = "curvedConnector5";
282
390
  ShapeType["curvedDownArrow"] = "curvedDownArrow";
283
391
  ShapeType["curvedLeftArrow"] = "curvedLeftArrow";
284
392
  ShapeType["curvedRightArrow"] = "curvedRightArrow";
@@ -399,6 +507,7 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
399
507
  ShapeType["star6"] = "star6";
400
508
  ShapeType["star7"] = "star7";
401
509
  ShapeType["star8"] = "star8";
510
+ ShapeType["straightConnector1"] = "straightConnector1";
402
511
  ShapeType["stripedRightArrow"] = "stripedRightArrow";
403
512
  ShapeType["sun"] = "sun";
404
513
  ShapeType["swooshArrow"] = "swooshArrow";
@@ -472,6 +581,10 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
472
581
  SHAPE_TYPE["ARC"] = "arc";
473
582
  SHAPE_TYPE["BALLOON"] = "wedgeRoundRectCallout";
474
583
  SHAPE_TYPE["BENT_ARROW"] = "bentArrow";
584
+ SHAPE_TYPE["BENT_CONNECTOR_2"] = "bentConnector2";
585
+ SHAPE_TYPE["BENT_CONNECTOR_3"] = "bentConnector3";
586
+ SHAPE_TYPE["BENT_CONNECTOR_4"] = "bentConnector4";
587
+ SHAPE_TYPE["BENT_CONNECTOR_5"] = "bentConnector5";
475
588
  SHAPE_TYPE["BENT_UP_ARROW"] = "bentUpArrow";
476
589
  SHAPE_TYPE["BEVEL"] = "bevel";
477
590
  SHAPE_TYPE["BLOCK_ARC"] = "blockArc";
@@ -488,6 +601,10 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
488
601
  SHAPE_TYPE["CORNER_TABS"] = "cornerTabs";
489
602
  SHAPE_TYPE["CROSS"] = "plus";
490
603
  SHAPE_TYPE["CUBE"] = "cube";
604
+ SHAPE_TYPE["CURVED_CONNECTOR_2"] = "curvedConnector2";
605
+ SHAPE_TYPE["CURVED_CONNECTOR_3"] = "curvedConnector3";
606
+ SHAPE_TYPE["CURVED_CONNECTOR_4"] = "curvedConnector4";
607
+ SHAPE_TYPE["CURVED_CONNECTOR_5"] = "curvedConnector5";
491
608
  SHAPE_TYPE["CURVED_DOWN_ARROW"] = "curvedDownArrow";
492
609
  SHAPE_TYPE["CURVED_DOWN_RIBBON"] = "ellipseRibbon";
493
610
  SHAPE_TYPE["CURVED_LEFT_ARROW"] = "curvedLeftArrow";
@@ -629,6 +746,7 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
629
746
  SHAPE_TYPE["STAR_6_POINT"] = "star6";
630
747
  SHAPE_TYPE["STAR_7_POINT"] = "star7";
631
748
  SHAPE_TYPE["STAR_8_POINT"] = "star8";
749
+ SHAPE_TYPE["STRAIGHT_CONNECTOR_1"] = "straightConnector1";
632
750
  SHAPE_TYPE["STRIPED_RIGHT_ARROW"] = "stripedRightArrow";
633
751
  SHAPE_TYPE["SUN"] = "sun";
634
752
  SHAPE_TYPE["SWOOSH_ARROW"] = "swooshArrow";
@@ -648,13 +766,19 @@ var core_enums_CHART_TYPE = /*#__PURE__*/ function(CHART_TYPE) {
648
766
  CHART_TYPE["AREA"] = "area";
649
767
  CHART_TYPE["BAR"] = "bar";
650
768
  CHART_TYPE["BAR3D"] = "bar3D";
769
+ CHART_TYPE["BOX_WHISKER"] = "boxWhisker";
651
770
  CHART_TYPE["BUBBLE"] = "bubble";
652
771
  CHART_TYPE["BUBBLE3D"] = "bubble3D";
653
772
  CHART_TYPE["DOUGHNUT"] = "doughnut";
773
+ CHART_TYPE["FUNNEL"] = "funnel";
774
+ CHART_TYPE["HISTOGRAM"] = "histogram";
654
775
  CHART_TYPE["LINE"] = "line";
655
776
  CHART_TYPE["PIE"] = "pie";
656
777
  CHART_TYPE["RADAR"] = "radar";
657
778
  CHART_TYPE["SCATTER"] = "scatter";
779
+ CHART_TYPE["SUNBURST"] = "sunburst";
780
+ CHART_TYPE["TREEMAP"] = "treemap";
781
+ CHART_TYPE["WATERFALL"] = "waterfall";
658
782
  return CHART_TYPE;
659
783
  }({});
660
784
  var core_enums_SCHEME_COLOR_NAMES = /*#__PURE__*/ function(SCHEME_COLOR_NAMES) {
@@ -954,13 +1078,37 @@ function _object_spread_props(target, source) {
954
1078
  }
955
1079
  return code;
956
1080
  }
1081
+ /** Units per inch, for the length suffixes accepted on `x`/`y`/`w`/`h` and the other inch-valued options */ const UNITS_PER_INCH = {
1082
+ in: 1,
1083
+ cm: 2.54,
1084
+ mm: 25.4,
1085
+ pt: 72
1086
+ };
1087
+ /**
1088
+ * A number with a length suffix - `'2.5cm'`, `'-4mm'`, `'18pt'`, `'5in'`
1089
+ * - the mantissa alternates rather than using `\d*\.?\d+`: that form lets the two digit runs
1090
+ * split a plain integer many ways, so a long non-matching digit string backtracks quadratically
1091
+ */ const REGEX_UNIT_LENGTH = /^\s*(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt)\s*$/i;
1092
+ /**
1093
+ * Parse a unit-suffixed length into inches
1094
+ * - a suffixed value carries its own unit, so it bypasses the inches-vs-EMU magnitude heuristic entirely
1095
+ * @param {string} value - ex: `'2.5cm'`, `'18pt'`
1096
+ * @returns {number|undefined} inches, or `undefined` when `value` is not a suffixed length
1097
+ */ function parseUnitLength(value) {
1098
+ const match = REGEX_UNIT_LENGTH.exec(value);
1099
+ if (!match) return undefined;
1100
+ const num = Number(match[1]);
1101
+ if (!Number.isFinite(num)) return undefined;
1102
+ return num / UNITS_PER_INCH[match[2].toLowerCase()];
1103
+ }
957
1104
  /**
958
1105
  * Translates any type of `x`/`y`/`w`/`h` prop to EMU
959
1106
  * - guaranteed to return a result regardless of undefined, null, etc. (0)
960
1107
  * - {number} - 12800 (EMU)
961
1108
  * - {number} - 0.5 (inches)
962
1109
  * - {string} - "75%"
963
- * @param {number|string} size - numeric ("5.5") or percentage ("90%")
1110
+ * - {string} - "2.5cm" (also in/mm/pt)
1111
+ * @param {number|string} size - numeric ("5.5"), unit-suffixed ("2.5cm") or percentage ("90%")
964
1112
  * @param {'X' | 'Y'} xyDir - direction
965
1113
  * @param {PresLayout} layout - presentation layout
966
1114
  * @returns {number} calculated size
@@ -973,7 +1121,12 @@ function _object_spread_props(target, source) {
973
1121
  // CASE 2: Number is already converted to something other than inches
974
1122
  // Assume any number whose absolute value is 100+ is EMU already.
975
1123
  if (typeof size === 'number' && Math.abs(size) >= 100) return size;
976
- // CASE 3: Percentage (ex: '50%')
1124
+ // CASE 3: Unit-suffixed length (ex: '2.5cm') - unambiguous, so no magnitude heuristic
1125
+ if (typeof size === 'string') {
1126
+ const inches = parseUnitLength(size);
1127
+ if (inches !== undefined) return Math.round((/* inlined export .EMU */914400) * inches);
1128
+ }
1129
+ // CASE 4: Percentage (ex: '50%')
977
1130
  if (typeof size === 'string' && size.includes('%')) {
978
1131
  if (xyDir && xyDir === 'X') return Math.round(parseFloat(size) / 100 * layout.width);
979
1132
  if (xyDir && xyDir === 'Y') return Math.round(parseFloat(size) / 100 * layout.height);
@@ -1037,6 +1190,11 @@ function _object_spread_props(target, source) {
1037
1190
  * @param {number|string} inches - as string or number
1038
1191
  * @returns {number} EMU value
1039
1192
  */ function inch2Emu(inches) {
1193
+ // A unit-suffixed string states its own unit - convert it before any inches assumption
1194
+ if (typeof inches === 'string') {
1195
+ const parsed = parseUnitLength(inches);
1196
+ if (parsed !== undefined) return Math.round((/* inlined export .EMU */914400) * parsed);
1197
+ }
1040
1198
  // NOTE: Provide Caller Safety: Numbers may get conv<->conv during flight, so be kind and do some simple checks to ensure inches were passed
1041
1199
  // Any absolute value over 100 is not inches (negative EMU is off-slide), so return it unchanged
1042
1200
  if (typeof inches === 'number' && Math.abs(inches) > 100) return inches;
@@ -1330,6 +1488,23 @@ function createGlowElement(glow) {
1330
1488
  const bg = String((pattern === null || pattern === void 0 ? void 0 : pattern.bgColor) || 'FFFFFF');
1331
1489
  return `<a:pattFill prst="${prst}"><a:bgClr>${createColorElement(bg)}</a:bgClr><a:fgClr>${createColorElement(fg)}</a:fgClr></a:pattFill>`;
1332
1490
  }
1491
+ /**
1492
+ * Create a DrawingML `a:blipFill` for a picture fill (ECMA-376 20.1.8.14)
1493
+ * - the image relationship is resolved when the object is created
1494
+ */ function createImageFillElement(image, rId) {
1495
+ let mode = '<a:stretch><a:fillRect/></a:stretch>';
1496
+ if (image.sizing === 'tile') {
1497
+ var _image_alignment;
1498
+ const scale = typeof image.scale === 'number' && isFinite(image.scale) && image.scale > 0 ? Math.round(image.scale * 1000) : 100000;
1499
+ const rawAlgn = (_image_alignment = image.alignment) !== null && _image_alignment !== void 0 ? _image_alignment : 'tl';
1500
+ const algn = TILE_ALIGNMENTS.has(rawAlgn) ? rawAlgn : 'tl';
1501
+ if (image.alignment && !TILE_ALIGNMENTS.has(image.alignment)) {
1502
+ console.warn(`[pptxgenjs] unknown tile alignment "${String(image.alignment)}" - "tl" used instead`);
1503
+ }
1504
+ mode = `<a:tile tx="0" ty="0" sx="${scale}" sy="${scale}" flip="none" algn="${algn}"/>`;
1505
+ }
1506
+ return `<a:blipFill rotWithShape="${image.rotateWithShape === false ? '0' : '1'}"><a:blip r:embed="rId${rId}"/>${mode}</a:blipFill>`;
1507
+ }
1333
1508
  /**
1334
1509
  * Create color selection
1335
1510
  * @param {Color | ShapeFillProps | ShapeLineProps} props fill props
@@ -1346,7 +1521,9 @@ function createGlowElement(glow) {
1346
1521
  } else if (isModifiedThemeColor(props)) {
1347
1522
  colorVal = props;
1348
1523
  } else {
1524
+ var _props_image;
1349
1525
  if (props.type) fillType = props.type;
1526
+ else if (((_props_image = props.image) === null || _props_image === void 0 ? void 0 : _props_image._rId) || props._rId) fillType = 'image';
1350
1527
  if (props.color) colorVal = props.color;
1351
1528
  if (props.alpha) internalElements += `<a:alpha val="${Math.round((100 - props.alpha) * 1000)}"/>`; // DEPRECATED: @deprecated v3.3.0
1352
1529
  if (props.transparency) internalElements += `<a:alpha val="${Math.round((100 - props.transparency) * 1000)}"/>`;
@@ -1362,6 +1539,21 @@ function createGlowElement(glow) {
1362
1539
  case 'pattern':
1363
1540
  outText += createPatternFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : String(colorVal.baseColor));
1364
1541
  break;
1542
+ case 'image':
1543
+ {
1544
+ var _ref;
1545
+ const image = typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.image;
1546
+ const rId = (_ref = image === null || image === void 0 ? void 0 : image._rId) !== null && _ref !== void 0 ? _ref : typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props._rId;
1547
+ if (rId) {
1548
+ outText += createImageFillElement(image !== null && image !== void 0 ? image : {}, rId);
1549
+ } else {
1550
+ console.warn('[pptxgenjs] `fill.type:"image"` requires `fill.image.data` or `fill.image.path` - fill omitted');
1551
+ }
1552
+ break;
1553
+ }
1554
+ case 'group':
1555
+ outText += '<a:grpFill/>';
1556
+ break;
1365
1557
  case 'none':
1366
1558
  outText += '<a:noFill/>';
1367
1559
  break;
@@ -1390,8 +1582,8 @@ function createGlowElement(glow) {
1390
1582
  // Work on a copy - never mutate the caller's options object
1391
1583
  ShadowProps = _object_spread({}, ShadowProps);
1392
1584
  // OPT: `type`
1393
- if (ShadowProps.type !== 'outer' && ShadowProps.type !== 'inner' && ShadowProps.type !== 'none') {
1394
- console.warn('Warning: shadow.type options are `outer`, `inner` or `none`.');
1585
+ if (ShadowProps.type !== 'outer' && ShadowProps.type !== 'inner' && ShadowProps.type !== 'none' && ShadowProps.type !== 'preset') {
1586
+ console.warn('Warning: shadow.type options are `outer`, `inner`, `preset` or `none`.');
1395
1587
  ShadowProps.type = 'outer';
1396
1588
  }
1397
1589
  // OPT: `angle`
@@ -2285,6 +2477,57 @@ function gen_tables_object_spread(target) {
2285
2477
  });
2286
2478
  }
2287
2479
 
2480
+ /**
2481
+ * Hyperlinks and mouse-over actions.
2482
+ *
2483
+ * DrawingML gives the same concept two element names depending on where it appears:
2484
+ *
2485
+ * | host | click | mouse-over |
2486
+ * | :-- | :-- | :-- |
2487
+ * | `p:cNvPr` (shapes, pictures) | `a:hlinkClick` (20.1.2.2.22) | `a:hlinkHover` (20.1.2.2.23) |
2488
+ * | `a:rPr` (text runs) | `a:hlinkClick` | `a:hlinkMouseOver` (21.1.2.3.6) |
2489
+ *
2490
+ * Emitting `a:hlinkHover` inside `a:rPr` — or `a:hlinkMouseOver` inside `p:cNvPr` — produces markup
2491
+ * PowerPoint cannot parse, so the host decides the element name here rather than at each call site.
2492
+ */
2493
+ /**
2494
+ * Build one `a:hlinkClick` / mouse-over element
2495
+ * @param {HyperlinkProps} link - link props
2496
+ * @param {'click' | 'hover'} trigger - which interaction this element describes
2497
+ * @param {HyperlinkHost} host - the element the link is attached to
2498
+ * @param {string} children - child elements (`a:snd`, `a:extLst`); self-closes when empty
2499
+ * @returns {string} XML string
2500
+ */ function genXmlHyperlink(link, trigger, host, children = '') {
2501
+ var _link__rId;
2502
+ const tag = trigger === 'click' ? 'a:hlinkClick' : host === 'run' ? 'a:hlinkMouseOver' : 'a:hlinkHover';
2503
+ let attrs = `r:id="rId${(_link__rId = link._rId) !== null && _link__rId !== void 0 ? _link__rId : 0}"`;
2504
+ if (link.slide) {
2505
+ // an internal jump has no URL; the action attribute names the target kind
2506
+ attrs += ' action="ppaction://hlinksldjump"';
2507
+ } else {
2508
+ attrs += ' invalidUrl="" action="" tgtFrame=""';
2509
+ }
2510
+ attrs += ` tooltip="${link.tooltip ? encodeXmlEntities(link.tooltip) : ''}"`;
2511
+ if (!link.slide) attrs += ' history="1"';
2512
+ // both default to false in the schema, so only write them when turned on
2513
+ if (link.highlightClick === true) attrs += ' highlightClick="1"';
2514
+ if (link.stopSoundsOnClick === true) attrs += ' endSnd="1"';
2515
+ const sound = genXmlHyperlinkSound(link);
2516
+ const inner = sound + children;
2517
+ return inner ? `<${tag} ${attrs}>${inner}</${tag}>` : `<${tag} ${attrs}/>`;
2518
+ }
2519
+ /**
2520
+ * Build the `a:snd` action sound (ECMA-376 20.1.2.2.32 `CT_EmbeddedWAVAudioFile`)
2521
+ * - the relationship is resolved when the object is created, so `_sndRId` is set by then
2522
+ * @param {HyperlinkProps} link - link props
2523
+ * @returns {string} XML string
2524
+ */ function genXmlHyperlinkSound(link) {
2525
+ var _link_sound_name;
2526
+ var _link_sound;
2527
+ if (!((_link_sound = link.sound) === null || _link_sound === void 0 ? void 0 : _link_sound._sndRId)) return '';
2528
+ return `<a:snd r:embed="rId${link.sound._sndRId}" name="${encodeXmlEntities((_link_sound_name = link.sound.name) !== null && _link_sound_name !== void 0 ? _link_sound_name : 'sound.wav')}"/>`;
2529
+ }
2530
+
2288
2531
  function text_define_property(obj, key, value) {
2289
2532
  if (key in obj) {
2290
2533
  Object.defineProperty(obj, key, {
@@ -2337,6 +2580,7 @@ function text_object_spread_props(target, source) {
2337
2580
  /**
2338
2581
  * Text-body, run, and placeholder rendering.
2339
2582
  */
2583
+
2340
2584
  /** ECMA-376 §5.1.12.76 `ST_TextShapeType` — used to validate `a:prstTxWarp@prst`. */ const TEXT_SHAPE_TYPES = new Set([
2341
2585
  'textNoShape',
2342
2586
  'textPlain',
@@ -2381,6 +2625,25 @@ function text_object_spread_props(target, source) {
2381
2625
  'textCascadeDown'
2382
2626
  ]);
2383
2627
 
2628
+ /**
2629
+ * Build the `a:buClr` / `a:buSzPct` / `a:buSzPts` / `a:buFont` prefix shared by every bullet kind
2630
+ * - the size defaults to 100% because that is what every branch emitted before
2631
+ */ function genXmlBulletPrefix(bullet) {
2632
+ let xml = '';
2633
+ if (bullet.color) xml += `<a:buClr>${createColorElement(bullet.color)}</a:buClr>`;
2634
+ // `a:buSzPct` and `a:buSzPts` are the same choice, so only one may appear
2635
+ if (typeof bullet.sizePts === 'number' && isFinite(bullet.sizePts) && bullet.sizePts > 0) {
2636
+ xml += `<a:buSzPts val="${Math.round(bullet.sizePts * 100)}"/>`;
2637
+ } else {
2638
+ const pct = typeof bullet.size === 'number' && isFinite(bullet.size) ? Math.min(400, Math.max(25, bullet.size)) : 100;
2639
+ if (typeof bullet.size === 'number' && (bullet.size < 25 || bullet.size > 400)) {
2640
+ console.warn(`[pptxgenjs] bullet \`size\` must be between 25 and 400 percent - "${String(bullet.size)}" clamped`);
2641
+ }
2642
+ xml += `<a:buSzPct val="${Math.round(pct * 1000)}"/>`;
2643
+ }
2644
+ if (bullet.fontFace) xml += `<a:buFont typeface="${encodeXmlEntities(bullet.fontFace)}"/>`;
2645
+ return xml;
2646
+ }
2384
2647
  /**
2385
2648
  * Generate XML Paragraph Properties
2386
2649
  * @param {ISlideObject|TextProps} textObj - text object
@@ -2389,7 +2652,6 @@ function text_object_spread_props(target, source) {
2389
2652
  */ function genXmlParagraphProperties(textObj, isDefault) {
2390
2653
  var _textObj_options;
2391
2654
  let strXmlBullet = '';
2392
- let strXmlBulletColor = '';
2393
2655
  let strXmlLnSpc = '';
2394
2656
  let strXmlParaSpc = '';
2395
2657
  let strXmlTabStops = '';
@@ -2441,10 +2703,17 @@ function text_object_spread_props(target, source) {
2441
2703
  if (typeof options.bullet === 'object') {
2442
2704
  var _options_bullet;
2443
2705
  if ((_options_bullet = options.bullet) === null || _options_bullet === void 0 ? void 0 : _options_bullet.indent) bulletMarL = valToPts(options.bullet.indent);
2444
- if (options.bullet.type && options.bullet.type.toString().toLowerCase() === 'number') {
2706
+ const buPrefix = genXmlBulletPrefix(options.bullet);
2707
+ const buIndent = ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2708
+ if (options.bullet.image && options.bullet._imageRId) {
2709
+ // `a:buBlip` replaces the character or number bullet entirely
2710
+ paragraphPropXml += buIndent;
2711
+ strXmlBullet = `${buPrefix}<a:buBlip><a:blip r:embed="rId${options.bullet._imageRId}"/></a:buBlip>`;
2712
+ } else if (options.bullet.type && options.bullet.type.toString().toLowerCase() === 'number') {
2445
2713
  // NOTE: only `type: 'number'` is a distinct branch; any other `type` (e.g. 'bullet') falls through to the char-bullet cases below (issue #1432)
2446
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2447
- strXmlBullet = `<a:buSzPct val="100000"/><a:buFont typeface="+mj-lt"/><a:buAutoNum type="${options.bullet.style || 'arabicPeriod'}" startAt="${options.bullet.numberStartAt || options.bullet.startAt || '1'}"/>`;
2714
+ paragraphPropXml += buIndent;
2715
+ // auto-numbered bullets fall back to the major latin face when none is given
2716
+ strXmlBullet = `${buPrefix}${options.bullet.fontFace ? '' : '<a:buFont typeface="+mj-lt"/>'}<a:buAutoNum type="${options.bullet.numberType || options.bullet.style || 'arabicPeriod'}" startAt="${options.bullet.numberStartAt || options.bullet.startAt || '1'}"/>`;
2448
2717
  } else if (options.bullet.characterCode) {
2449
2718
  let bulletCode = `&#x${options.bullet.characterCode};`;
2450
2719
  // Check value for hex-ness (s/b 4 char hex)
@@ -2452,8 +2721,8 @@ function text_object_spread_props(target, source) {
2452
2721
  console.warn('Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!');
2453
2722
  bulletCode = (/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;");
2454
2723
  }
2455
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2456
- strXmlBullet = '<a:buSzPct val="100000"/><a:buChar char="' + bulletCode + '"/>';
2724
+ paragraphPropXml += buIndent;
2725
+ strXmlBullet = `${buPrefix}<a:buChar char="${bulletCode}"/>`;
2457
2726
  } else if (options.bullet.code) {
2458
2727
  // @deprecated `bullet.code` v3.3.0
2459
2728
  let bulletCode = `&#x${options.bullet.code};`;
@@ -2462,15 +2731,11 @@ function text_object_spread_props(target, source) {
2462
2731
  console.warn('Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!');
2463
2732
  bulletCode = (/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;");
2464
2733
  }
2465
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2466
- strXmlBullet = '<a:buSzPct val="100000"/><a:buChar char="' + bulletCode + '"/>';
2734
+ paragraphPropXml += buIndent;
2735
+ strXmlBullet = `${buPrefix}<a:buChar char="${bulletCode}"/>`;
2467
2736
  } else {
2468
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2469
- strXmlBullet = `<a:buSzPct val="100000"/><a:buChar char="${(/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;")}"/>`;
2470
- }
2471
- // mikemeerschaert/add-color-option-to-bullets — buClr must precede buSz*/buChar (OOXML order)
2472
- if (options.bullet.color) {
2473
- strXmlBulletColor = `<a:buClr>${createColorElement(options.bullet.color)}</a:buClr>`;
2737
+ paragraphPropXml += buIndent;
2738
+ strXmlBullet = `${buPrefix}<a:buChar char="${(/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;")}"/>`;
2474
2739
  }
2475
2740
  } else if (options.bullet) {
2476
2741
  paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
@@ -2487,7 +2752,7 @@ function text_object_spread_props(target, source) {
2487
2752
  }
2488
2753
  // B: Close Paragraph-Properties
2489
2754
  // IMPORTANT: strXmlLnSpc, strXmlParaSpc, buClr, and strXmlBullet require strict ordering - anything out of order is ignored. (PPT-Online, PPT for Mac)
2490
- paragraphPropXml += '>' + strXmlLnSpc + strXmlParaSpc + strXmlBulletColor + strXmlBullet + strXmlTabStops;
2755
+ paragraphPropXml += '>' + strXmlLnSpc + strXmlParaSpc + strXmlBullet + strXmlTabStops;
2491
2756
  if (isDefault) paragraphPropXml += genXmlTextRunProperties(options, true);
2492
2757
  paragraphPropXml += '</' + tag + '>';
2493
2758
  }
@@ -2499,7 +2764,7 @@ function text_object_spread_props(target, source) {
2499
2764
  * @param {boolean} isDefault - whether these are the default text run properties
2500
2765
  * @return {string} XML
2501
2766
  */ function genXmlTextRunProperties(opts, isDefault) {
2502
- var _opts_underline;
2767
+ var _opts_underline, _opts_hyperlinkHover;
2503
2768
  let runProps = '';
2504
2769
  const runPropsTag = isDefault ? 'a:defRPr' : 'a:rPr';
2505
2770
  // BEGIN runProperties (ex: `<a:rPr lang="en-US" sz="1600" b="1" dirty="0">`)
@@ -2531,6 +2796,7 @@ function text_object_spread_props(target, source) {
2531
2796
  'small',
2532
2797
  'all'
2533
2798
  ].includes(opts.caps) ? ` cap="${opts.caps}"` : '';
2799
+ if (opts.kumimoji === true) runProps += ' kumimoji="1"';
2534
2800
  runProps += ' dirty="0">';
2535
2801
  // Color / Font / Highlight / Outline are children of <a:rPr>, so add them now before closing the runProperties tag
2536
2802
  if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
@@ -2568,21 +2834,13 @@ function text_object_spread_props(target, source) {
2568
2834
  if (opts.hyperlink) {
2569
2835
  if (typeof opts.hyperlink !== 'object') throw new Error('ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:\'https://github.com\'}` ');
2570
2836
  else if (!opts.hyperlink.url && !opts.hyperlink.slide) throw new Error('ERROR: \'hyperlink requires either `url` or `slide`\'');
2571
- else if (opts.hyperlink.url) {
2572
- // runProps += '<a:uFill>'+ genXmlColorSelection('0000FF') +'</a:uFill>'; // Breaks PPT2010! (Issue#74)
2573
- runProps += `<a:hlinkClick r:id="rId${opts.hyperlink._rId}" invalidUrl="" action="" tgtFrame="" tooltip="${opts.hyperlink.tooltip ? encodeXmlEntities(opts.hyperlink.tooltip) : ''}" history="1" highlightClick="0" endSnd="0"${opts.color ? '>' : '/>'}`;
2574
- } else if (opts.hyperlink.slide) {
2575
- runProps += `<a:hlinkClick r:id="rId${opts.hyperlink._rId}" action="ppaction://hlinksldjump" tooltip="${opts.hyperlink.tooltip ? encodeXmlEntities(opts.hyperlink.tooltip) : ''}"${opts.color ? '>' : '/>'}`;
2576
- }
2577
- if (opts.color) {
2578
- runProps += ' <a:extLst>';
2579
- runProps += ' <a:ext uri="{A12FA001-AC4F-418D-AE19-62706E023703}">';
2580
- runProps += ' <ahyp:hlinkClr xmlns:ahyp="http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor" val="tx"/>';
2581
- runProps += ' </a:ext>';
2582
- runProps += ' </a:extLst>';
2583
- runProps += '</a:hlinkClick>';
2584
- }
2837
+ // A colored link keeps its run color instead of the theme's hyperlink color (issue #74: an
2838
+ // `a:uFill` here breaks PPT2010, so the extension is used rather than an underline fill)
2839
+ const linkColorExt = opts.color ? '<a:extLst><a:ext uri="{A12FA001-AC4F-418D-AE19-62706E023703}"><ahyp:hlinkClr xmlns:ahyp="http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor" val="tx"/></a:ext></a:extLst>' : '';
2840
+ runProps += genXmlHyperlink(opts.hyperlink, 'click', 'run', linkColorExt);
2585
2841
  }
2842
+ // `a:hlinkMouseOver` follows `a:hlinkClick` in CT_TextCharacterProperties
2843
+ if ((_opts_hyperlinkHover = opts.hyperlinkHover) === null || _opts_hyperlinkHover === void 0 ? void 0 : _opts_hyperlinkHover._rId) runProps += genXmlHyperlink(opts.hyperlinkHover, 'hover', 'run');
2586
2844
  // END runProperties
2587
2845
  runProps += `</${runPropsTag}>`;
2588
2846
  return runProps;
@@ -2621,6 +2879,15 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
2621
2879
  }
2622
2880
  return `<a14:m xmlns:a14="${A14_NS}">${trimmed}</a14:m>`;
2623
2881
  }
2882
+ /**
2883
+ * A stable GUID for a field, derived from its type and cached value
2884
+ * - `a:fld@id` must be a GUID; deriving it keeps repeated exports byte-identical
2885
+ */ function fieldGuid(type, cached) {
2886
+ let hash = 0;
2887
+ for (const char of `${type}:${cached}`)hash = hash * 31 + char.charCodeAt(0) >>> 0;
2888
+ const hex = hash.toString(16).padStart(8, '0');
2889
+ return `{${hex}-0000-0000-0000-${hex}0000}`;
2890
+ }
2624
2891
  function textRunsHaveOmml(text) {
2625
2892
  if (!Array.isArray(text)) return false;
2626
2893
  return text.some((t)=>{
@@ -2630,7 +2897,7 @@ function textRunsHaveOmml(text) {
2630
2897
  }
2631
2898
  function genXmlTextRun(textObj) {
2632
2899
  var _textObj_options;
2633
- var _textObj_options1;
2900
+ var _textObj_options1, _textObj_options2;
2634
2901
  // Native Office Math run — editable in PowerPoint (not an image).
2635
2902
  const omml = (_textObj_options1 = textObj.options) === null || _textObj_options1 === void 0 ? void 0 : _textObj_options1.omml;
2636
2903
  if (typeof omml === 'string' && omml.trim()) {
@@ -2661,7 +2928,18 @@ function genXmlTextRun(textObj) {
2661
2928
  </a:r>
2662
2929
  <a:endParaRPr lang="en-US" dirty="0"/>
2663
2930
  </a:p>
2664
- */ // Return paragraph with text run
2931
+ */ /* A field is a run the consumer refreshes on open (ECMA-376 21.1.2.2.4). The `a:t` child holds
2932
+ * the cached value so a consumer that does not refresh still renders something. `id` must be a
2933
+ * GUID; it is derived from the field type and text so repeated exports stay reproducible. */ const field = (_textObj_options2 = textObj.options) === null || _textObj_options2 === void 0 ? void 0 : _textObj_options2.field;
2934
+ if (field) {
2935
+ if (!TEXT_FIELD_TYPES.has(field)) {
2936
+ console.warn(`[pptxgenjs] unknown text field "${String(field)}" - run emitted as plain text instead`);
2937
+ } else {
2938
+ var _textObj_text, _textObj_options3, _textObj_text1;
2939
+ return `<a:fld id="${fieldGuid(field, (_textObj_text = textObj.text) !== null && _textObj_text !== void 0 ? _textObj_text : '')}" type="${field}">` + genXmlTextRunProperties((_textObj_options3 = textObj.options) !== null && _textObj_options3 !== void 0 ? _textObj_options3 : {}, false) + `<a:t>${encodeXmlEntities((_textObj_text1 = textObj.text) !== null && _textObj_text1 !== void 0 ? _textObj_text1 : '')}</a:t>` + '</a:fld>';
2940
+ }
2941
+ }
2942
+ // Return paragraph with text run
2665
2943
  return textObj.text ? `<a:r>${genXmlTextRunProperties((_textObj_options = textObj.options) !== null && _textObj_options !== void 0 ? _textObj_options : {}, false)}<a:t>${encodeXmlEntities(textObj.text)}</a:t></a:r>` : '';
2666
2944
  }
2667
2945
  /**
@@ -2683,13 +2961,14 @@ function genXmlTextRun(textObj) {
2683
2961
  if (slideObject.options._bodyProp.tIns || slideObject.options._bodyProp.tIns === 0) bodyProperties += ` tIns="${slideObject.options._bodyProp.tIns}"`;
2684
2962
  if (slideObject.options._bodyProp.rIns || slideObject.options._bodyProp.rIns === 0) bodyProperties += ` rIns="${slideObject.options._bodyProp.rIns}"`;
2685
2963
  if (slideObject.options._bodyProp.bIns || slideObject.options._bodyProp.bIns === 0) bodyProperties += ` bIns="${slideObject.options._bodyProp.bIns}"`;
2686
- // C: Add rtl after margins
2687
- bodyProperties += ' rtlCol="0"';
2688
2964
  // Text columns — ECMA-376 §5.1.5.1.4 CT_TextBodyProperties@numCol/@spcCol (issue #1320)
2689
2965
  if (slideObject.options._bodyProp.numCol && slideObject.options._bodyProp.numCol > 1) {
2690
2966
  bodyProperties += ` numCol="${slideObject.options._bodyProp.numCol}"`;
2691
2967
  if (slideObject.options._bodyProp.spcCol) bodyProperties += ` spcCol="${slideObject.options._bodyProp.spcCol}"`;
2692
2968
  }
2969
+ // `rtlCol` follows the text box's RTL mode unless overridden, so RTL columns flow correctly
2970
+ const rtlCols = typeof slideObject.options.rtlColumns === 'boolean' ? slideObject.options.rtlColumns : slideObject.options.rtlMode === true;
2971
+ bodyProperties += ` rtlCol="${rtlCols ? '1' : '0'}"`;
2693
2972
  // D: Add anchorPoints
2694
2973
  if (slideObject.options._bodyProp.anchor) bodyProperties += ' anchor="' + slideObject.options._bodyProp.anchor + '"'; // VALS: [t,ctr,b]
2695
2974
  if (slideObject.options._bodyProp.vert) bodyProperties += ' vert="' + slideObject.options._bodyProp.vert + '"'; // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]
@@ -2725,7 +3004,9 @@ function genXmlTextRun(textObj) {
2725
3004
  bodyProperties += '</a:bodyPr>';
2726
3005
  } else {
2727
3006
  // DEFAULT:
2728
- bodyProperties += ' wrap="square" rtlCol="0">';
3007
+ const opts = slideObject.options;
3008
+ const rtlCols = typeof (opts === null || opts === void 0 ? void 0 : opts.rtlColumns) === 'boolean' ? opts.rtlColumns : (opts === null || opts === void 0 ? void 0 : opts.rtlMode) === true;
3009
+ bodyProperties += ` wrap="square" rtlCol="${rtlCols ? '1' : '0'}">`;
2729
3010
  bodyProperties += '</a:bodyPr>';
2730
3011
  }
2731
3012
  // LAST: Return Close _bodyProp
@@ -2812,6 +3093,8 @@ function genXmlTextRun(textObj) {
2812
3093
  delete runOpts.softEdge;
2813
3094
  delete runOpts.reflection;
2814
3095
  delete runOpts.shadow;
3096
+ delete runOpts.fillOverlay;
3097
+ delete runOpts.effectDag;
2815
3098
  itext.options = runOpts;
2816
3099
  }
2817
3100
  if (idx === 0 && itext.options && !itext.options.bullet && opts.bullet) itext.options.bullet = opts.bullet;
@@ -2927,7 +3210,7 @@ function genXmlTextRun(textObj) {
2927
3210
  // NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
2928
3211
  // `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
2929
3212
  // `omml` is a run-level math payload — inheriting it would replace sibling plain-text runs
2930
- if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'omml') return;
3213
+ if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml') return;
2931
3214
  if (key !== 'bullet' && !textOpts[key]) textOpts[key] = val;
2932
3215
  });
2933
3216
  // D: Add formatted textrun
@@ -3050,12 +3333,15 @@ const NS_P232 = 'http://schemas.microsoft.com/office/powerpoint/2023/02/main';
3050
3333
  * @returns XML
3051
3334
  */ function genXmlPlaceholder(placeholderObj, extraOpts) {
3052
3335
  var _ref;
3053
- var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2;
3336
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5;
3054
3337
  if (!placeholderObj) return '';
3055
3338
  const placeholderIdx = ((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options._placeholderIdx) ? placeholderObj.options._placeholderIdx : '';
3056
3339
  const placeholderType = resolvePlaceholderType((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType);
3057
- const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
3058
- const phTypeExt = (_ref = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref !== void 0 ? _ref : (_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.phTypeExt;
3340
+ // `orient` and `sz` default to horz/full in the schema, so only a non-default is written
3341
+ const placeholderOrient = ((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.orient) === 'vert' ? ' orient="vert"' : '';
3342
+ const placeholderSize = ((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.sz) === 'half' || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.sz) === 'quarter' ? ` sz="${placeholderObj.options.sz}"` : '';
3343
+ const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + placeholderOrient + placeholderSize + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
3344
+ const phTypeExt = (_ref = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref !== void 0 ? _ref : (_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.phTypeExt;
3059
3345
  if (phTypeExt === 'cameo' || phTypeExt === 'unknown') {
3060
3346
  return `<p:ph${attrs}>` + `<p:extLst><p:ext uri="${URI_PH_TYPE_EXT}">` + `<p232:phTypeExt xmlns:p232="${NS_P232}"><p232:type><p232:${phTypeExt}/></p232:type></p232:phTypeExt>` + '</p:ext></p:extLst></p:ph>';
3061
3347
  }
@@ -3399,6 +3685,10 @@ function _object_without_properties_loose(source, excluded) {
3399
3685
  let tmpOpt;
3400
3686
  let tmpData = [];
3401
3687
  if (Array.isArray(type)) {
3688
+ // A chartex layout owns the whole `cx:plotArea` and cannot share one with an ECMA-376 chart type,
3689
+ // so a multi-type spec that names one would silently render as an empty frame
3690
+ const chartexSpec = type.find((obj)=>isChartexType(obj.type));
3691
+ if (chartexSpec) throw new Error(`pptxgenjs: chart type "${String(chartexSpec.type)}" cannot be combined in a multi-type chart`);
3402
3692
  // For multi-type charts there needs to be data for each type,
3403
3693
  // as well as a single data source for non-series operations.
3404
3694
  // The data is indexed below to keep the data in order when segmented
@@ -3486,8 +3776,21 @@ function _object_without_properties_loose(source, excluded) {
3486
3776
  // NOTE: a multi-type chart has no single type to validate against, so only the name translation applies there
3487
3777
  if (options.dataLabelPosition) {
3488
3778
  const chartType = Array.isArray(options._type) ? undefined : options._type;
3489
- options.dataLabelPosition = resolveDataLabelPosition(options.dataLabelPosition, chartType, options.barGrouping);
3490
- if (!options.dataLabelPosition) delete options.dataLabelPosition;
3779
+ if (isChartexType(chartType)) {
3780
+ // `cx:dataLabels@pos` is its own vocabulary, not `c:dLblPos`; these three are the values the
3781
+ // shipped chartex writers emit, so anything else falls back to the layout's own default
3782
+ if (![
3783
+ 'ctr',
3784
+ 'inEnd',
3785
+ 'outEnd'
3786
+ ].includes(options.dataLabelPosition)) {
3787
+ console.warn(`[pptxgenjs] dataLabelPosition '${options.dataLabelPosition}' is not valid for a '${chartType}' chart - ignoring it (valid: ctr, inEnd, outEnd)`);
3788
+ delete options.dataLabelPosition;
3789
+ }
3790
+ } else {
3791
+ options.dataLabelPosition = resolveDataLabelPosition(options.dataLabelPosition, chartType, options.barGrouping);
3792
+ if (!options.dataLabelPosition) delete options.dataLabelPosition;
3793
+ }
3491
3794
  }
3492
3795
  options.dataLabelBkgrdColors = options.dataLabelBkgrdColors || !options.dataLabelBkgrdColors ? options.dataLabelBkgrdColors : false;
3493
3796
  if (![
@@ -3659,6 +3962,59 @@ function _object_without_properties_loose(source, excluded) {
3659
3962
  } else {
3660
3963
  delete options.catAxisMultiLevelLabels;
3661
3964
  }
3965
+ // ChartEx: reject values PowerPoint would reject, so a bad option degrades to the layout default
3966
+ // rather than to the repair dialog
3967
+ if (isChartexType(options._type)) {
3968
+ // Only box & whisker plots more than one distribution; the other layouts own the whole plot area
3969
+ // and a second `cx:series` is either dropped or flagged for repair
3970
+ if (options._type !== core_enums_CHART_TYPE.BOX_WHISKER && tmpData.length > 1) {
3971
+ console.warn(`Warning: a ${options._type} chart plots one series - ignoring ${tmpData.length - 1} extra series.`);
3972
+ tmpData = tmpData.slice(0, 1);
3973
+ }
3974
+ tmpData.forEach((item)=>{
3975
+ var _item_values;
3976
+ var _item_labels;
3977
+ // ChartEx cell references assume one label column; the multi-level worksheet layout shifts the
3978
+ // series columns right, so the extra levels are dropped rather than silently misaddressed
3979
+ if (item.labels && item.labels.length > 1) {
3980
+ console.warn('Warning: chartex charts take single-level category labels - using the first level.');
3981
+ item.labels = [
3982
+ item.labels[0]
3983
+ ];
3984
+ }
3985
+ // A histogram bins raw values and needs no categories, but the embedded worksheet still writes a
3986
+ // row per label, so a label-less series is padded rather than left to fail during write()
3987
+ const labels = (_item_labels = item.labels) === null || _item_labels === void 0 ? void 0 : _item_labels[0];
3988
+ if (!labels || labels.length === 0) item.labels = [
3989
+ Array(((_item_values = item.values) !== null && _item_values !== void 0 ? _item_values : []).length).fill('')
3990
+ ];
3991
+ });
3992
+ const pointCount = Math.max(...tmpData.map((item)=>{
3993
+ var _item_values;
3994
+ return ((_item_values = item.values) !== null && _item_values !== void 0 ? _item_values : []).length;
3995
+ }), 0);
3996
+ if (options.chartExSubtotals) {
3997
+ const valid = options.chartExSubtotals.filter((idx)=>Number.isInteger(idx) && idx >= 0 && idx < pointCount);
3998
+ if (valid.length !== options.chartExSubtotals.length) console.warn(`Warning: chart.chartExSubtotals must be data point indexes 0-${pointCount - 1}.`);
3999
+ options.chartExSubtotals = valid;
4000
+ }
4001
+ if (options.chartExBinCount !== undefined && (!Number.isInteger(options.chartExBinCount) || options.chartExBinCount < 1)) {
4002
+ console.warn('Warning: chart.chartExBinCount must be a positive integer.');
4003
+ delete options.chartExBinCount;
4004
+ }
4005
+ if (options.chartExBinSize !== undefined && (isNaN(options.chartExBinSize) || options.chartExBinSize <= 0)) {
4006
+ console.warn('Warning: chart.chartExBinSize must be greater than 0.');
4007
+ delete options.chartExBinSize;
4008
+ }
4009
+ if (options.chartExParentLabels && ![
4010
+ 'none',
4011
+ 'overlapping',
4012
+ 'banner'
4013
+ ].includes(options.chartExParentLabels)) {
4014
+ console.warn('Warning: chart.chartExParentLabels options: `none`, `overlapping`, `banner`.');
4015
+ delete options.chartExParentLabels;
4016
+ }
4017
+ }
3662
4018
  // STEP 4: Set props (_type already set to chart on the literal above).
3663
4019
  // The chart object stores the position/placeholder that gen-xml reads; chart `fill`
3664
4020
  // is a color string (vs ObjectOptions' ShapeFillProps) and is never read here, so it
@@ -3672,14 +4028,17 @@ function _object_without_properties_loose(source, excluded) {
3672
4028
  });
3673
4029
  resultObject.chartRid = getNewRelId(target);
3674
4030
  // STEP 5: Add this chart to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)
4031
+ // ChartEx charts are a separate part type with their own content type and relationship type,
4032
+ // so the file name is what every downstream emitter keys off (see `xml/package.ts`)
4033
+ const fileName = isChartexType(options._type) ? `chartEx${chartId}.xml` : `chart${chartId}.xml`;
3675
4034
  target._relsChart.push({
3676
4035
  rId: getNewRelId(target),
3677
4036
  data: tmpData,
3678
4037
  opts: options,
3679
4038
  type: options._type,
3680
4039
  globalId: chartId,
3681
- fileName: `chart${chartId}.xml`,
3682
- Target: `/ppt/charts/chart${chartId}.xml`
4040
+ fileName,
4041
+ Target: `/ppt/charts/${fileName}`
3683
4042
  });
3684
4043
  target._slideObjects.push(resultObject);
3685
4044
  return resultObject;
@@ -3765,8 +4124,45 @@ function isSvgFillSource(data, path) {
3765
4124
  });
3766
4125
  return rId;
3767
4126
  }
4127
+ function isStructuredImageFill(fill) {
4128
+ return !!fill && (fill.type === 'image' || !!fill.image);
4129
+ }
4130
+ /**
4131
+ * Resolve a picture fill's image into a slide relationship.
4132
+ * `genXmlColorSelection` is pure, so the rId has to be attached before XML is generated.
4133
+ */ function resolveImageFill(target, fill) {
4134
+ var _ref, _ref1, _ref2, _ref3;
4135
+ var _fill_image, _fill_image1;
4136
+ if (!fill || typeof fill !== 'object') return;
4137
+ if (!isStructuredImageFill(fill) && !(fill.data || fill.path)) return;
4138
+ if (!isStructuredImageFill(fill) && (fill.color || fill.type && fill.type !== 'image')) return;
4139
+ const data = (_ref = (_ref1 = (_fill_image = fill.image) === null || _fill_image === void 0 ? void 0 : _fill_image.data) !== null && _ref1 !== void 0 ? _ref1 : fill.data) !== null && _ref !== void 0 ? _ref : '';
4140
+ const path = (_ref2 = (_ref3 = (_fill_image1 = fill.image) === null || _fill_image1 === void 0 ? void 0 : _fill_image1.path) !== null && _ref3 !== void 0 ? _ref3 : fill.path) !== null && _ref2 !== void 0 ? _ref2 : '';
4141
+ if (!data && !path) {
4142
+ console.warn('[pptxgenjs] `fill.type:"image"` requires `fill.image.data` or `fill.image.path` - fill ignored');
4143
+ return;
4144
+ }
4145
+ if (data && !data.toLowerCase().includes('base64,')) {
4146
+ console.warn('[pptxgenjs] `fill.image.data` lacks a base64 header (ex: \'image/png;base64,iV[...]\') - fill ignored');
4147
+ return;
4148
+ }
4149
+ const rId = registerTableCellImageFill(target, {
4150
+ data,
4151
+ path
4152
+ });
4153
+ if (!rId) return;
4154
+ if (fill.image) fill.image._rId = rId;
4155
+ else fill._rId = rId;
4156
+ }
4157
+ function resolveObjectImageFills(target, options) {
4158
+ var _options_fillOverlay;
4159
+ if (!options) return;
4160
+ if (options.fill) resolveImageFill(target, options.fill);
4161
+ if ((_options_fillOverlay = options.fillOverlay) === null || _options_fillOverlay === void 0 ? void 0 : _options_fillOverlay.fill) resolveImageFill(target, options.fillOverlay.fill);
4162
+ }
3768
4163
  function addImageDefinition(target, opt) {
3769
- var _strImagePath_substring_split__split_pop;
4164
+ var _opt_fillOverlay, _strImagePath_substring_split__split_pop;
4165
+ if ((_opt_fillOverlay = opt.fillOverlay) === null || _opt_fillOverlay === void 0 ? void 0 : _opt_fillOverlay.fill) resolveImageFill(target, opt.fillOverlay.fill);
3770
4166
  const newObject = {
3771
4167
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"),
3772
4168
  text: undefined,
@@ -3836,7 +4232,16 @@ function addImageDefinition(target, opt) {
3836
4232
  softEdge: opt.softEdge,
3837
4233
  reflection: opt.reflection,
3838
4234
  blur: opt.blur,
4235
+ fillOverlay: opt.fillOverlay,
4236
+ effectDag: opt.effectDag,
4237
+ alphaEffects: opt.alphaEffects,
4238
+ recolor: opt.recolor,
4239
+ styleRef: opt.styleRef,
3839
4240
  line: opt.line || imageBorderToLine(opt.border),
4241
+ // non-visual props and locks are part of the object's identity, not its geometry
4242
+ title: opt.title,
4243
+ hidden: opt.hidden,
4244
+ lock: opt.lock,
3840
4245
  _sizeFromImage: !intWidth && !intHeight,
3841
4246
  // addImage always writes x/y/w/h defaults, so remember which axes the caller actually set
3842
4247
  // (placeholder geometry must not overwrite explicit placement; fujita-h d7e3e93 / #996).
@@ -3916,8 +4321,14 @@ function addImageDefinition(target, opt) {
3916
4321
  });
3917
4322
  objHyperlink._rId = imageRelId;
3918
4323
  newObject.hyperlink = objHyperlink;
4324
+ // the action sound (if any) needs its own relationship
4325
+ resolveHyperlinkRels(target, objHyperlink);
3919
4326
  }
3920
4327
  }
4328
+ if (typeof opt.hyperlinkHover === 'object') {
4329
+ resolveHyperlinkRels(target, opt.hyperlinkHover);
4330
+ newObject.hyperlinkHover = opt.hyperlinkHover;
4331
+ }
3921
4332
  // STEP 6: Add object to slide
3922
4333
  target._slideObjects.push(newObject);
3923
4334
  }
@@ -3940,12 +4351,25 @@ function addImageDefinition(target, opt) {
3940
4351
  const slideData = {
3941
4352
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.media */"media")
3942
4353
  };
3943
- // STEP 1: REALITY-CHECK
3944
- if (!strPath && !strData && strType !== 'online') {
4354
+ // `link` with no `path`/`data` used to throw, so treating it as "reference, do not embed" cannot
4355
+ // change any deck that works today
4356
+ const isLinked = !!strLink && !strPath && !strData && (strType === 'audio' || strType === 'video');
4357
+ if (strLink && (strPath || strData) && strType !== 'online') {
4358
+ console.warn('[pptxgenjs] addMedia: `link` is ignored when `path` or `data` is given - the media is embedded');
4359
+ }
4360
+ // STEP 1: REALITY-CHECK - what each media kind needs, rather than one chain of conditions
4361
+ if (strType === 'audioCd') {
4362
+ var _opt_audioCd_start, _opt_audioCd, _opt_audioCd_end, _opt_audioCd1;
4363
+ // `a:st`/`a:end` and their `@track` are all required by CT_AudioCD
4364
+ if (typeof ((_opt_audioCd = opt.audioCd) === null || _opt_audioCd === void 0 ? void 0 : (_opt_audioCd_start = _opt_audioCd.start) === null || _opt_audioCd_start === void 0 ? void 0 : _opt_audioCd_start.track) !== 'number' || typeof ((_opt_audioCd1 = opt.audioCd) === null || _opt_audioCd1 === void 0 ? void 0 : (_opt_audioCd_end = _opt_audioCd1.end) === null || _opt_audioCd_end === void 0 ? void 0 : _opt_audioCd_end.track) !== 'number') {
4365
+ throw new Error('addMedia() error: `type:"audioCd"` requires `audioCd.start.track` and `audioCd.end.track`');
4366
+ }
4367
+ } else if (!strPath && !strData && strType !== 'online' && !isLinked) {
3945
4368
  throw new Error('addMedia() error: either `data` or `path` are required!');
3946
4369
  } else if (strData && !strData.toLowerCase().includes('base64,')) {
3947
4370
  throw new Error('addMedia() error: `data` value lacks a base64 header! Ex: \'video/mpeg;base64,NMP[...]\')');
3948
- } else if (strCover && !strCover.toLowerCase().includes('base64,')) {
4371
+ }
4372
+ if (strCover && !strCover.toLowerCase().includes('base64,')) {
3949
4373
  throw new Error('addMedia() error: `cover` value lacks a base64 header! Ex: \'data:image/png;base64,iV[...]\')');
3950
4374
  }
3951
4375
  // Online Video: requires `link`
@@ -3954,7 +4378,7 @@ function addImageDefinition(target, opt) {
3954
4378
  }
3955
4379
  // Timing-tree playback (ECMA-376 §19.5 CT_TLMediaNode): no silent fallbacks.
3956
4380
  // `fullScrn` exists only on CT_TLMediaNodeVideo; linked `online` media has no embedded media node.
3957
- if (strType === 'audio' && opt.fullScreen) {
4381
+ if (opt.fullScreen && strType !== 'video') {
3958
4382
  throw new Error('addMedia() error: `fullScreen` is only valid on type "video"');
3959
4383
  }
3960
4384
  if (strType === 'online' && (opt.autoplay || opt.loop || opt.fullScreen || opt.mute)) {
@@ -3962,7 +4386,7 @@ function addImageDefinition(target, opt) {
3962
4386
  }
3963
4387
  // FIXME: 20190707
3964
4388
  // strType = strData ? strData.split(';')[0].split('/')[0] : strType
3965
- strExtn = opt.extn || (strData ? strData.split(';')[0].split('/')[1] : strPath.split('.').pop()) || 'mp3';
4389
+ strExtn = opt.extn || (strType === 'wav' ? 'wav' : strData ? strData.split(';')[0].split('/')[1] : (strPath || strLink).split('.').pop()) || 'mp3';
3966
4390
  // STEP 2: Set type, media
3967
4391
  slideData.mtype = strType;
3968
4392
  slideData.media = strPath || 'preencoded.mov';
@@ -3989,6 +4413,11 @@ function addImageDefinition(target, opt) {
3989
4413
  slideData.options.loop = opt.loop;
3990
4414
  slideData.options.fullScreen = opt.fullScreen;
3991
4415
  slideData.options.mute = opt.mute;
4416
+ slideData.options.contentType = opt.contentType;
4417
+ slideData.options.audioCd = opt.audioCd;
4418
+ slideData.options.isPhoto = opt.isPhoto;
4419
+ slideData.options.userDrawn = opt.userDrawn;
4420
+ slideData.options.isLinked = isLinked;
3992
4421
  // STEP 4: Add this media to this Slide Rels (rId/rels count spans all slides! Count all media to get next rId)
3993
4422
  /**
3994
4423
  * NOTE:
@@ -3998,7 +4427,41 @@ function addImageDefinition(target, opt) {
3998
4427
  * - Audio/Video files consume *TWO* rId's:
3999
4428
  * <Relationship Id="rId2" Target="../media/media1.mov" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"/>
4000
4429
  * <Relationship Id="rId3" Target="../media/media1.mov" Type="http://schemas.microsoft.com/office/2007/relationships/media"/>
4001
- */ if (strType === 'online') {
4430
+ */ if (strType === 'audioCd') {
4431
+ // CD audio references the listener's drive: no media part, no media relationship, cover only
4432
+ const coverRid = getNewRelId(target);
4433
+ target._relsMedia.push({
4434
+ path: 'preencoded.png',
4435
+ type: 'image/png',
4436
+ extn: 'png',
4437
+ data: strCover,
4438
+ rId: coverRid,
4439
+ Target: `../media/${imageTargetStem(target)}.png`
4440
+ });
4441
+ slideData._coverRid = coverRid;
4442
+ } else if (strType === 'wav') {
4443
+ // `a:wavAudioFile` is the legacy embedded-WAV element: one audio relationship, no `p14:media`
4444
+ const relId1 = getNewRelId(target);
4445
+ target._relsMedia.push({
4446
+ path: strPath || 'preencoded.wav',
4447
+ type: 'audio/wav',
4448
+ extn: 'wav',
4449
+ data: strData || '',
4450
+ rId: relId1,
4451
+ Target: `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.wav`
4452
+ });
4453
+ slideData.mediaRid = relId1;
4454
+ const coverRid = getNewRelId(target);
4455
+ target._relsMedia.push({
4456
+ path: 'preencoded.png',
4457
+ type: 'image/png',
4458
+ extn: 'png',
4459
+ data: strCover,
4460
+ rId: coverRid,
4461
+ Target: `../media/${imageTargetStem(target)}.png`
4462
+ });
4463
+ slideData._coverRid = coverRid;
4464
+ } else if (strType === 'online') {
4002
4465
  const relId1 = getNewRelId(target);
4003
4466
  // A: Add video
4004
4467
  target._relsMedia.push({
@@ -4023,6 +4486,8 @@ function addImageDefinition(target, opt) {
4023
4486
  // PERF: Duplicate media should reuse existing `Target` value and not create an additional copy
4024
4487
  const dupeItem = target._relsMedia.filter((item)=>item.path && item.path === strPath && item.type === strType + '/' + strExtn && !item.isDuplicate)[0];
4025
4488
  // A: "relationships/video"
4489
+ // Linked media keeps this exact three-relationship shape - the rIds the emitter derives from
4490
+ // `mediaRid` stay valid - and only points the targets outside the package
4026
4491
  const relId1 = getNewRelId(target);
4027
4492
  target._relsMedia.push({
4028
4493
  path: strPath || 'preencoded' + strExtn,
@@ -4031,7 +4496,8 @@ function addImageDefinition(target, opt) {
4031
4496
  data: strData || '',
4032
4497
  rId: relId1,
4033
4498
  isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
4034
- Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.${strExtn}`
4499
+ isLinked,
4500
+ Target: isLinked ? strLink : (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.${strExtn}`
4035
4501
  });
4036
4502
  slideData.mediaRid = relId1;
4037
4503
  // B: "relationships/media"
@@ -4042,7 +4508,8 @@ function addImageDefinition(target, opt) {
4042
4508
  data: strData || '',
4043
4509
  rId: getNewRelId(target),
4044
4510
  isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
4045
- Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 0}.${strExtn}`
4511
+ isLinked,
4512
+ Target: isLinked ? strLink : (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 0}.${strExtn}`
4046
4513
  });
4047
4514
  // C: Add cover (preview/overlay) image
4048
4515
  target._relsMedia.push({
@@ -4079,7 +4546,16 @@ function addImageDefinition(target, opt) {
4079
4546
  * Adds a Summary Zoom object (MS-PPTX §2.11) — anchors to a section by title, carries layout factors.
4080
4547
  */ function addSummaryZoomDefinition(target, opt) {
4081
4548
  pushZoomObject(target, 'summary', opt, (obj)=>{
4082
- obj.zoomSectionTitle = opt.sectionTitle;
4549
+ var _opt_sectionTitles;
4550
+ const titles = [
4551
+ ...opt.sectionTitle ? [
4552
+ opt.sectionTitle
4553
+ ] : [],
4554
+ ...(_opt_sectionTitles = opt.sectionTitles) !== null && _opt_sectionTitles !== void 0 ? _opt_sectionTitles : []
4555
+ ].filter((title, idx, all)=>title && all.indexOf(title) === idx);
4556
+ if (titles.length === 0) throw new Error('addSummaryZoom() error: provide `sectionTitle` or `sectionTitles`');
4557
+ obj.zoomSectionTitle = titles[0];
4558
+ obj.zoomSectionTitles = titles.slice(1);
4083
4559
  if (obj.options) {
4084
4560
  obj.options.zoomTitle = opt.title;
4085
4561
  obj.options.zoomDescr = opt.descr;
@@ -4269,11 +4745,107 @@ function nextExtPartName(target, prefix, extn) {
4269
4745
  opts.line.endArrowType = opts.lineTail;
4270
4746
  }
4271
4747
  }
4748
+ /**
4749
+ * Create the relationships a hyperlink needs: the link target, and its action sound when set
4750
+ * - `genXmlHyperlink` is pure, so both ids have to exist before the XML is generated
4751
+ */ function resolveHyperlinkRels(target, link) {
4752
+ if (!link || typeof link !== 'object') return;
4753
+ if (!link._rId) {
4754
+ var _link_url;
4755
+ var _link_slide;
4756
+ if (!link.url && !link.slide) {
4757
+ console.warn('[pptxgenjs] a hyperlink requires either `url` or `slide` - link ignored');
4758
+ return;
4759
+ }
4760
+ const relId = getNewRelId(target);
4761
+ target._rels.push({
4762
+ type: (/* inlined export .SLIDE_OBJECT_TYPES.hyperlink */"hyperlink"),
4763
+ data: link.slide ? 'slide' : 'dummy',
4764
+ rId: relId,
4765
+ Target: encodeXmlEntities((_link_url = link.url) !== null && _link_url !== void 0 ? _link_url : '') || ((_link_slide = link.slide) === null || _link_slide === void 0 ? void 0 : _link_slide.toString()) || ''
4766
+ });
4767
+ link._rId = relId;
4768
+ } else if (target._rels.filter((rel)=>rel.rId === link._rId).length === 0) {
4769
+ var _link_url1;
4770
+ var _link_slide1;
4771
+ target._rels.push({
4772
+ type: (/* inlined export .SLIDE_OBJECT_TYPES.hyperlink */"hyperlink"),
4773
+ data: link.slide ? 'slide' : 'dummy',
4774
+ rId: link._rId,
4775
+ Target: encodeXmlEntities((_link_url1 = link.url) !== null && _link_url1 !== void 0 ? _link_url1 : '') || ((_link_slide1 = link.slide) === null || _link_slide1 === void 0 ? void 0 : _link_slide1.toString()) || ''
4776
+ });
4777
+ }
4778
+ // ECMA-376 20.1.2.2.32 allows only WAV here, so anything else is dropped rather than linked
4779
+ const sound = link.sound;
4780
+ if (!sound) return;
4781
+ if (!sound._sndRId) {
4782
+ var _sound_data, _sound_path;
4783
+ const data = (_sound_data = sound.data) !== null && _sound_data !== void 0 ? _sound_data : '';
4784
+ const path = (_sound_path = sound.path) !== null && _sound_path !== void 0 ? _sound_path : '';
4785
+ if (!data && !path) {
4786
+ console.warn('[pptxgenjs] hyperlink `sound` requires `data` or `path` - sound ignored');
4787
+ link.sound = undefined;
4788
+ return;
4789
+ }
4790
+ if (data && !data.toLowerCase().includes('base64,')) {
4791
+ console.warn('[pptxgenjs] hyperlink `sound.data` lacks a base64 header - sound ignored');
4792
+ link.sound = undefined;
4793
+ return;
4794
+ }
4795
+ const rId = getNewRelId(target);
4796
+ target._relsMedia.push({
4797
+ path: path || 'preencoded.wav',
4798
+ type: 'audio/wav',
4799
+ extn: 'wav',
4800
+ data,
4801
+ rId,
4802
+ Target: `../media/audio-${target._slideNum}-${target._relsMedia.length + 1}.wav`
4803
+ });
4804
+ sound._sndRId = rId;
4805
+ } else if (!target._relsMedia.some((rel)=>rel.rId === sound._sndRId)) {
4806
+ target._relsMedia.push({
4807
+ path: sound.path || 'preencoded.wav',
4808
+ type: 'audio/wav',
4809
+ extn: 'wav',
4810
+ data: sound.data,
4811
+ rId: sound._sndRId,
4812
+ Target: `../media/audio-${target._slideNum}-${target._relsMedia.length + 1}.wav`
4813
+ });
4814
+ }
4815
+ }
4816
+ /**
4817
+ * Resolve a picture bullet's image into a slide relationship
4818
+ * - the paragraph emitter is pure, so the rId has to exist before the XML is generated
4819
+ */ function resolveBulletImage(target, opts) {
4820
+ var _ref;
4821
+ var _exec;
4822
+ const bullet = typeof (opts === null || opts === void 0 ? void 0 : opts.bullet) === 'object' ? opts.bullet : undefined;
4823
+ if (!(bullet === null || bullet === void 0 ? void 0 : bullet.image) || bullet._imageRId) return;
4824
+ if (!bullet.image.toLowerCase().includes('base64,')) {
4825
+ console.warn('[pptxgenjs] `bullet.image` must be base64 image data (ex: \'image/png;base64,iV[...]\') - picture bullet ignored');
4826
+ bullet.image = undefined;
4827
+ return;
4828
+ }
4829
+ const extn = (_ref = (_exec = /image\/(\w+);/.exec(bullet.image)) === null || _exec === void 0 ? void 0 : _exec[1]) !== null && _ref !== void 0 ? _ref : 'png';
4830
+ const rId = getNewRelId(target);
4831
+ target._relsMedia.push({
4832
+ path: `preencoded.${extn}`,
4833
+ type: `image/${extn}`,
4834
+ extn,
4835
+ data: bullet.image,
4836
+ rId,
4837
+ Target: `../media/${imageTargetStem(target)}.${extn}`
4838
+ });
4839
+ bullet._imageRId = rId;
4840
+ }
4272
4841
  function addShapeDefinition(target, shapeName, opts) {
4273
4842
  const options = typeof opts === 'object' ? opts : {};
4274
4843
  options.line = options.line || {
4275
4844
  type: 'none'
4276
4845
  };
4846
+ resolveHyperlinkRels(target, options.hyperlink);
4847
+ resolveHyperlinkRels(target, options.hyperlinkHover);
4848
+ resolveObjectImageFills(target, options);
4277
4849
  const newObject = {
4278
4850
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
4279
4851
  shape: shapeName || core_enums_SHAPE_TYPE.RECTANGLE,
@@ -4306,7 +4878,9 @@ function addShapeDefinition(target, shapeName, opts) {
4306
4878
  sourceAnchorPos: options.line.sourceAnchorPos,
4307
4879
  targetAnchorPos: options.line.targetAnchorPos,
4308
4880
  isConnector: options.line.isConnector || hasConnectorEnds,
4309
- curveadjust: options.line.curveadjust
4881
+ curveadjust: options.line.curveadjust,
4882
+ _sourceName: options.line._sourceName,
4883
+ _targetName: options.line._targetName
4310
4884
  };
4311
4885
  if (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts;
4312
4886
  // 2: Set options defaults
@@ -4341,7 +4915,7 @@ function addShapeDefinition(target, shapeName, opts) {
4341
4915
  target
4342
4916
  ] // Create array of Slides as more may be added by auto-paging
4343
4917
  ;
4344
- const opt = options && typeof options === 'object' ? options : {};
4918
+ const opt = options && typeof options === 'object' ? gen_objects_object_spread({}, options) : {};
4345
4919
  opt.objectName = opt.objectName ? encodeXmlEntities(opt.objectName) : `Table ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.table */"table")).length}`;
4346
4920
  // STEP 1: REALITY-CHECK
4347
4921
  {
@@ -4363,12 +4937,13 @@ function addShapeDefinition(target, shapeName, opts) {
4363
4937
  // STEP 2: Transform `tableRows` into well-formatted TableCell's
4364
4938
  // tableRows can be object or plain text array: `[{text:'cell 1'}, {text:'cell 2', options:{color:'ff0000'}}]` | `["cell 1", "cell 2"]`
4365
4939
  const arrRows = [];
4366
- const tableFillRid = registerTableCellImageFill(target, opt.fill);
4940
+ if (isStructuredImageFill(opt.fill)) resolveImageFill(target, opt.fill);
4941
+ const tableFillRid = isStructuredImageFill(opt.fill) ? undefined : registerTableCellImageFill(target, opt.fill);
4367
4942
  tableRows.forEach((row)=>{
4368
4943
  const newRow = [];
4369
4944
  if (Array.isArray(row)) {
4370
4945
  row.forEach((cell)=>{
4371
- var _newCell_options, _registerTableCellImageFill;
4946
+ var _newCell_options;
4372
4947
  // A:
4373
4948
  const newCell = {
4374
4949
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
@@ -4438,8 +5013,13 @@ function addShapeDefinition(target, shapeName, opts) {
4438
5013
  transparency: typeof cellBorder[idx].transparency === 'number' ? cellBorder[idx].transparency : undefined
4439
5014
  };
4440
5015
  });
4441
- const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
4442
- if (fillRid) cellOpts._fillRid = fillRid;
5016
+ if (isStructuredImageFill(cellOpts.fill)) {
5017
+ resolveImageFill(target, cellOpts.fill);
5018
+ } else {
5019
+ var _registerTableCellImageFill;
5020
+ const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
5021
+ if (fillRid) cellOpts._fillRid = fillRid;
5022
+ }
4443
5023
  // LAST:
4444
5024
  newRow.push(newCell);
4445
5025
  });
@@ -4646,7 +5226,8 @@ function addShapeDefinition(target, shapeName, opts) {
4646
5226
  */ function addTextDefinition(target, text, opts, isPlaceholder) {
4647
5227
  var _newObject_options;
4648
5228
  var // STEP 2: Create/Clean text options
4649
- _newObject_text;
5229
+ _newObject_text, _newObject_options1, _newObject_options2, _newObject_text1;
5230
+ resolveObjectImageFills(target, opts);
4650
5231
  const newObject = {
4651
5232
  _type: isPlaceholder ? (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder") : (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
4652
5233
  shape: (opts === null || opts === void 0 ? void 0 : opts.shape) || core_enums_SHAPE_TYPE.RECTANGLE,
@@ -4777,8 +5358,18 @@ function addShapeDefinition(target, shapeName, opts) {
4777
5358
  // STEP 1: Create/Clean object options
4778
5359
  newObject.options = cleanOpts((_newObject_options = newObject.options) !== null && _newObject_options !== void 0 ? _newObject_options : {});
4779
5360
  (_newObject_text = newObject.text) === null || _newObject_text === void 0 ? void 0 : _newObject_text.forEach((item)=>item.options = cleanOpts(item.options || {}));
4780
- // STEP 3: Create hyperlinks
5361
+ // STEP 3: Create hyperlinks, hover actions, and any picture-bullet relationships
4781
5362
  createHyperlinkRels(target, newObject.text || '');
5363
+ resolveHyperlinkRels(target, (_newObject_options1 = newObject.options) === null || _newObject_options1 === void 0 ? void 0 : _newObject_options1.hyperlink);
5364
+ resolveHyperlinkRels(target, (_newObject_options2 = newObject.options) === null || _newObject_options2 === void 0 ? void 0 : _newObject_options2.hyperlinkHover);
5365
+ resolveBulletImage(target, newObject.options);
5366
+ (_newObject_text1 = newObject.text) === null || _newObject_text1 === void 0 ? void 0 : _newObject_text1.forEach((item)=>{
5367
+ var _item_options, _item_options_hyperlink, _item_options1;
5368
+ resolveHyperlinkRels(target, (_item_options = item.options) === null || _item_options === void 0 ? void 0 : _item_options.hyperlinkHover);
5369
+ // a click link already has its target rel; this adds its action sound
5370
+ if ((_item_options1 = item.options) === null || _item_options1 === void 0 ? void 0 : (_item_options_hyperlink = _item_options1.hyperlink) === null || _item_options_hyperlink === void 0 ? void 0 : _item_options_hyperlink.sound) resolveHyperlinkRels(target, item.options.hyperlink);
5371
+ resolveBulletImage(target, item.options);
5372
+ });
4782
5373
  // LAST: Add object to Slide
4783
5374
  target._slideObjects.push(newObject);
4784
5375
  }
@@ -4906,6 +5497,11 @@ function addShapeDefinition(target, shapeName, opts) {
4906
5497
  });
4907
5498
  }
4908
5499
  }
5500
+ if (text && typeof text === 'object' && !Array.isArray(text) && text.options) {
5501
+ var _text_options_hyperlink;
5502
+ resolveHyperlinkRels(target, text.options.hyperlinkHover);
5503
+ if ((_text_options_hyperlink = text.options.hyperlink) === null || _text_options_hyperlink === void 0 ? void 0 : _text_options_hyperlink.sound) resolveHyperlinkRels(target, text.options.hyperlink);
5504
+ }
4909
5505
  });
4910
5506
  }
4911
5507
  function makeGroupCollector(parent) {
@@ -4925,6 +5521,7 @@ function makeGroupCollector(parent) {
4925
5521
  * Child coordinates are relative to the group origin (`chOff` 0,0 / `chExt` = group size).
4926
5522
  */ function addGroupDefinition(target, opts, objects) {
4927
5523
  var _opts_x, _opts_y, _opts_w, _opts_h, _opts_rotate;
5524
+ if (opts.fill) resolveImageFill(target, opts.fill);
4928
5525
  const groupCount = target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.group */"group")).length;
4929
5526
  const newObject = {
4930
5527
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"),
@@ -4935,7 +5532,11 @@ function makeGroupCollector(parent) {
4935
5532
  h: (_opts_h = opts.h) !== null && _opts_h !== void 0 ? _opts_h : 1,
4936
5533
  rotate: (_opts_rotate = opts.rotate) !== null && _opts_rotate !== void 0 ? _opts_rotate : 0,
4937
5534
  shadow: opts.shadow ? correctShadowOptions(opts.shadow) : undefined,
4938
- objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`
5535
+ fill: opts.fill,
5536
+ objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`,
5537
+ title: opts.title,
5538
+ hidden: opts.hidden,
5539
+ lock: opts.lock
4939
5540
  },
4940
5541
  _objects: objects
4941
5542
  };
@@ -4975,10 +5576,60 @@ function createGroupBuilder(parent, objects) {
4975
5576
  addGroupDefinition(collector, options, children);
4976
5577
  objects.push(...collector._slideObjects);
4977
5578
  return builder;
5579
+ },
5580
+ addConnector (options) {
5581
+ const collector = makeGroupCollector(parent);
5582
+ addConnectorDefinition(collector, options !== null && options !== void 0 ? options : {});
5583
+ objects.push(...collector._slideObjects);
5584
+ return builder;
4978
5585
  }
4979
5586
  };
4980
5587
  return builder;
4981
5588
  }
5589
+ const CONNECTOR_PRESETS = new Set([
5590
+ 'line',
5591
+ 'straightConnector1',
5592
+ 'bentConnector2',
5593
+ 'bentConnector3',
5594
+ 'bentConnector4',
5595
+ 'bentConnector5',
5596
+ 'curvedConnector2',
5597
+ 'curvedConnector3',
5598
+ 'curvedConnector4',
5599
+ 'curvedConnector5'
5600
+ ]);
5601
+ /**
5602
+ * Additive connector convenience: maps onto `addShape` + `line.isConnector`.
5603
+ * `start`/`end` `objectName`s are resolved to `sourceId`/`targetId` at emit time.
5604
+ */ function addConnectorDefinition(target, opt) {
5605
+ var _opt_line, _ref, _ref1;
5606
+ var _opt_line1, _opt_line2, _opt_start, _opt_line3, _opt_end, _opt_line4, _opt_start1, _opt_end1;
5607
+ const requested = opt.type && CONNECTOR_PRESETS.has(opt.type) ? opt.type : 'straightConnector1';
5608
+ const shapeName = requested === 'line' ? core_enums_SHAPE_TYPE.LINE : requested;
5609
+ const line = gen_objects_object_spread_props(gen_objects_object_spread({}, (_opt_line = opt.line) !== null && _opt_line !== void 0 ? _opt_line : {}), {
5610
+ isConnector: true,
5611
+ sourceId: (_opt_line1 = opt.line) === null || _opt_line1 === void 0 ? void 0 : _opt_line1.sourceId,
5612
+ targetId: (_opt_line2 = opt.line) === null || _opt_line2 === void 0 ? void 0 : _opt_line2.targetId,
5613
+ sourceAnchorPos: (_ref = (_opt_start = opt.start) === null || _opt_start === void 0 ? void 0 : _opt_start.site) !== null && _ref !== void 0 ? _ref : (_opt_line3 = opt.line) === null || _opt_line3 === void 0 ? void 0 : _opt_line3.sourceAnchorPos,
5614
+ targetAnchorPos: (_ref1 = (_opt_end = opt.end) === null || _opt_end === void 0 ? void 0 : _opt_end.site) !== null && _ref1 !== void 0 ? _ref1 : (_opt_line4 = opt.line) === null || _opt_line4 === void 0 ? void 0 : _opt_line4.targetAnchorPos,
5615
+ _sourceName: (_opt_start1 = opt.start) === null || _opt_start1 === void 0 ? void 0 : _opt_start1.shape,
5616
+ _targetName: (_opt_end1 = opt.end) === null || _opt_end1 === void 0 ? void 0 : _opt_end1.shape
5617
+ });
5618
+ addShapeDefinition(target, shapeName, {
5619
+ x: opt.x,
5620
+ y: opt.y,
5621
+ w: opt.w,
5622
+ h: opt.h,
5623
+ objectName: opt.objectName,
5624
+ rotate: opt.rotate,
5625
+ flipH: opt.flipH,
5626
+ flipV: opt.flipV,
5627
+ fill: opt.fill,
5628
+ shadow: opt.shadow,
5629
+ styleRef: opt.styleRef,
5630
+ line
5631
+ });
5632
+ }
4982
5633
 
4983
5634
  /**
4984
5635
  * PptxGenJS: Slide Class
@@ -5023,6 +5674,8 @@ function slide_object_spread(target) {
5023
5674
  delete runOpts.reflection;
5024
5675
  delete runOpts.shadow;
5025
5676
  delete runOpts.blur;
5677
+ delete runOpts.fillOverlay;
5678
+ delete runOpts.effectDag;
5026
5679
  return runOpts;
5027
5680
  }
5028
5681
  class Slide {
@@ -5117,6 +5770,14 @@ class Slide {
5117
5770
  addGroupDefinition(this, cloneOpts(options), children);
5118
5771
  return this;
5119
5772
  }
5773
+ /**
5774
+ * Add a connector (`p:cxnSp`). Additive convenience over `line.isConnector`.
5775
+ * Glue with `start`/`end` `objectName`s, or pass numeric `line.sourceId`/`targetId`.
5776
+ * @example slide.addConnector({ type: 'straightConnector1', start: { shape: 'BoxA', site: 3 }, end: { shape: 'BoxB', site: 1 } })
5777
+ */ addConnector(options) {
5778
+ addConnectorDefinition(this, cloneOpts(options !== null && options !== void 0 ? options : {}));
5779
+ return this;
5780
+ }
5120
5781
  /**
5121
5782
  * Add a slide transition (`<p:transition>`, ECMA-376 §19.3.1.50 / MS-PPTX §2.2.1)
5122
5783
  * @param {SlideTransitionProps} options - transition options
@@ -5330,62 +5991,6 @@ class Slide {
5330
5991
 
5331
5992
 
5332
5993
 
5333
- /**
5334
- * Chart title rendering.
5335
- */
5336
-
5337
- /**
5338
- * Create char title elements
5339
- * @param {IChartPropsTitle} opts - options
5340
- * @return {string} XML `<c:title>`
5341
- */ function genXmlTitle(opts, chartX, chartY) {
5342
- const align = opts.titleAlign === 'left' || opts.titleAlign === 'right' ? `<a:pPr algn="${opts.titleAlign.substring(0, 1)}">` : '<a:pPr>';
5343
- const rotate = opts.titleRotate ? `<a:bodyPr rot="${convertRotationDegrees(opts.titleRotate)}"/>` : '<a:bodyPr/>' // don't specify rotation to get default (ex. vertical for cat axis)
5344
- ;
5345
- const sizeAttr = opts.fontSize ? `sz="${Math.round(opts.fontSize * 100)}"` : '' // only set the font size if specified. Powerpoint will handle the default size
5346
- ;
5347
- const titleBold = opts.titleBold ? 1 : 0;
5348
- const titleItalic = opts.titleItalic ? 1 : 0;
5349
- let layout = '<c:layout/>';
5350
- if (opts.titlePos && typeof opts.titlePos.x === 'number' && typeof opts.titlePos.y === 'number') {
5351
- // NOTE: manualLayout x/y vals are *relative to entire slide*
5352
- const totalX = opts.titlePos.x + (chartX !== null && chartX !== void 0 ? chartX : 0);
5353
- const totalY = opts.titlePos.y + (chartY !== null && chartY !== void 0 ? chartY : 0);
5354
- let valX = totalX === 0 ? 0 : totalX * (totalX / 5) / 10;
5355
- if (valX >= 1) valX = valX / 10;
5356
- if (valX >= 0.1) valX = valX / 10;
5357
- let valY = totalY === 0 ? 0 : totalY * (totalY / 5) / 10;
5358
- if (valY >= 1) valY = valY / 10;
5359
- if (valY >= 0.1) valY = valY / 10;
5360
- layout = `<c:layout><c:manualLayout><c:xMode val="edge"/><c:yMode val="edge"/><c:x val="${valX}"/><c:y val="${valY}"/></c:manualLayout></c:layout>`;
5361
- }
5362
- return `<c:title>
5363
- <c:tx>
5364
- <c:rich>
5365
- ${rotate}
5366
- <a:lstStyle/>
5367
- <a:p>
5368
- ${align}
5369
- <a:defRPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
5370
- <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
5371
- <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5372
- </a:defRPr>
5373
- </a:pPr>
5374
- <a:r>
5375
- <a:rPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
5376
- <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
5377
- <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5378
- </a:rPr>
5379
- <a:t>${encodeXmlEntities(opts.title) || ''}</a:t>
5380
- </a:r>
5381
- </a:p>
5382
- </c:rich>
5383
- </c:tx>
5384
- ${layout}
5385
- <c:overlay val="0"/>
5386
- </c:title>`;
5387
- }
5388
-
5389
5994
  function utils_define_property(obj, key, value) {
5390
5995
  if (key in obj) {
5391
5996
  Object.defineProperty(obj, key, {
@@ -5581,6 +6186,302 @@ function resolveAreaGrouping(barGrouping) {
5581
6186
  return 'standard';
5582
6187
  }
5583
6188
 
6189
+ /**
6190
+ * ChartEx (`cx:chartSpace`) rendering - MS-ODRAWXML 2.1.
6191
+ *
6192
+ * PowerPoint 2016 introduced chart layouts that ECMA-376 has no markup for. They are written to their
6193
+ * own part, in the `cx` namespace, and share nothing with the `c:` emitter in `xml.ts` beyond the
6194
+ * embedded workbook: the data lives in `cx:chartData` (one `cx:data` per series) and the layout is
6195
+ * selected by `cx:series@layoutId` rather than by the element name.
6196
+ *
6197
+ * The cell references point at the same worksheet `workbook.ts` writes for classic charts - column A
6198
+ * holds the category labels, columns B.. hold one series each, row 1 holds the series names - so no
6199
+ * chartex-specific workbook layout is needed.
6200
+ */
6201
+
6202
+
6203
+ /** Sheet name written by `workbook.ts`; chartex cell references are absolute and always single-sheet */ const SHEET = 'Sheet1';
6204
+ /**
6205
+ * Category-axis gap width per layout, matching what PowerPoint writes for a freshly inserted chart.
6206
+ * A layout absent here (treemap, sunburst) draws no axes at all.
6207
+ */ const CAT_GAP_WIDTH = {
6208
+ boxWhisker: '1',
6209
+ funnel: '0.0599999987',
6210
+ histogram: '0',
6211
+ waterfall: '0.5'
6212
+ };
6213
+ function firstLabelLevel(data) {
6214
+ var _data_;
6215
+ const labels = (_data_ = data[0]) === null || _data_ === void 0 ? void 0 : _data_.labels;
6216
+ if (!labels || labels.length === 0) return [];
6217
+ const level = labels[0];
6218
+ return Array.isArray(level) ? level : [];
6219
+ }
6220
+ /**
6221
+ * `<cx:pt idx="N">value</cx:pt>` for every point of one dimension
6222
+ * - a missing point is written empty: `cx:pt` inside a `cx:numDim` must be a number, so the string
6223
+ * "null" would be a schema violation (the ECMA-376 emitter blanks the same case)
6224
+ */ function makePoints(values) {
6225
+ return values.map((value, idx)=>`<cx:pt idx="${idx}">${value === null || value === undefined ? '' : encodeXmlEntities(String(value))}</cx:pt>`).join('');
6226
+ }
6227
+ /**
6228
+ * Absolute A1 reference for one column of the embedded worksheet, excluding the header row.
6229
+ * The range length must equal the dimension's own `ptCount`, so each dimension passes its own.
6230
+ */ function columnRef(colIdx, pointCount) {
6231
+ const col = getExcelColName(colIdx);
6232
+ return `${SHEET}!$${col}$2:$${col}$${pointCount + 1}`;
6233
+ }
6234
+ /**
6235
+ * One `cx:data` block per series.
6236
+ * - hierarchical layouts (treemap, sunburst) size their segments through a `size` dimension
6237
+ * - a histogram bins raw values itself, so it carries no category dimension at all
6238
+ */ function makeChartData(rel, chartType) {
6239
+ const labels = firstLabelLevel(rel.data);
6240
+ const dimType = chartType === 'treemap' || chartType === 'sunburst' ? 'size' : 'val';
6241
+ return rel.data.map((series, seriesIdx)=>{
6242
+ var _series_values;
6243
+ const values = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : [];
6244
+ const catDim = chartType === 'histogram' || labels.length === 0 ? '' : `<cx:strDim type="cat"><cx:f>${columnRef(1, labels.length)}</cx:f><cx:lvl ptCount="${labels.length}">${makePoints(labels)}</cx:lvl></cx:strDim>`;
6245
+ const valDim = `<cx:numDim type="${dimType}"><cx:f>${columnRef(seriesIdx + 2, values.length)}</cx:f>` + `<cx:lvl ptCount="${values.length}" formatCode="General">${makePoints(values)}</cx:lvl></cx:numDim>`;
6246
+ return `<cx:data id="${seriesIdx}">${catDim}${valDim}</cx:data>`;
6247
+ }).join('');
6248
+ }
6249
+ /** `cx:dataLabels` - chartex has no `c:dLbls`, visibility is a single element with three flags */ function makeDataLabels(opts, chartType) {
6250
+ var _opts_showValue, _opts_showLabel, _opts_dataLabelPosition;
6251
+ const showValue = (_opts_showValue = opts.showValue) !== null && _opts_showValue !== void 0 ? _opts_showValue : false;
6252
+ const showCategory = (_opts_showLabel = opts.showLabel) !== null && _opts_showLabel !== void 0 ? _opts_showLabel : false;
6253
+ if (!showValue && !showCategory) return '';
6254
+ // `outEnd` is invalid on the layouts that draw labels inside their segments
6255
+ const defaultPos = chartType === 'treemap' || chartType === 'sunburst' || chartType === 'funnel' ? 'ctr' : 'outEnd';
6256
+ const pos = (_opts_dataLabelPosition = opts.dataLabelPosition) !== null && _opts_dataLabelPosition !== void 0 ? _opts_dataLabelPosition : defaultPos;
6257
+ const size = Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100);
6258
+ const txPr = '<cx:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr>' + `<a:defRPr sz="${size}" b="${opts.dataLabelFontBold ? 1 : 0}" i="${opts.dataLabelFontItalic ? 1 : 0}">` + `<a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>` + `<a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace || 'Arial')}"/>` + '</a:defRPr></a:pPr></a:p></cx:txPr>';
6259
+ const numFmt = opts.dataLabelFormatCode ? `<cx:numFmt formatCode="${encodeXmlEntities(opts.dataLabelFormatCode)}" sourceLinked="0"/>` : '';
6260
+ return `<cx:dataLabels pos="${pos}">` + `<cx:visibility seriesName="0" categoryName="${showCategory ? 1 : 0}" value="${showValue ? 1 : 0}"/>` + numFmt + txPr + '</cx:dataLabels>';
6261
+ }
6262
+ /**
6263
+ * `cx:layoutPr` carries everything that is layout-specific rather than series-generic.
6264
+ * Anything absent here is left to PowerPoint's own default for that layout.
6265
+ */ function makeLayoutProps(opts, chartType) {
6266
+ switch(chartType){
6267
+ case 'waterfall':
6268
+ {
6269
+ var _opts_chartExSubtotals;
6270
+ const subtotals = (_opts_chartExSubtotals = opts.chartExSubtotals) !== null && _opts_chartExSubtotals !== void 0 ? _opts_chartExSubtotals : [];
6271
+ if (subtotals.length === 0) return '';
6272
+ return `<cx:layoutPr><cx:subtotals>${subtotals.map((idx)=>`<cx:idx val="${idx}"/>`).join('')}</cx:subtotals></cx:layoutPr>`;
6273
+ }
6274
+ case 'histogram':
6275
+ {
6276
+ const binSize = opts.chartExBinSize;
6277
+ const binCount = opts.chartExBinCount;
6278
+ // PowerPoint accepts exactly one binning rule; an explicit size wins over a count, and neither
6279
+ // means "let PowerPoint choose" (its automatic Scott's-rule binning)
6280
+ const rule = binSize !== undefined ? `<cx:binSize val="${binSize}"/>` : binCount !== undefined ? `<cx:binCount val="${binCount}"/>` : '';
6281
+ const binning = rule ? `<cx:binning intervalClosed="r">${rule}</cx:binning>` : '<cx:binning intervalClosed="r"/>';
6282
+ return `<cx:layoutPr>${binning}</cx:layoutPr>`;
6283
+ }
6284
+ case 'boxWhisker':
6285
+ return '<cx:layoutPr>' + `<cx:visibility meanLine="${opts.chartExMeanLine ? 1 : 0}" meanMarker="1" nonoutliers="0" outliers="1"/>` + '<cx:statistics quartileMethod="exclusive"/>' + '</cx:layoutPr>';
6286
+ case 'treemap':
6287
+ var _opts_chartExParentLabels;
6288
+ return `<cx:layoutPr><cx:parentLabelLayout val="${(_opts_chartExParentLabels = opts.chartExParentLabels) !== null && _opts_chartExParentLabels !== void 0 ? _opts_chartExParentLabels : 'overlapping'}"/></cx:layoutPr>`;
6289
+ default:
6290
+ return '';
6291
+ }
6292
+ }
6293
+ /** One `cx:series` per data row. Order follows CT_Series: tx, spPr, dataLabels, dataId, layoutPr, axisId. */ function makeSeries(rel, chartType) {
6294
+ const layoutId = CHARTEX_LAYOUT_ID[chartType];
6295
+ const dataLabels = makeDataLabels(rel.opts, chartType);
6296
+ const layoutPr = makeLayoutProps(rel.opts, chartType);
6297
+ return rel.data.map((series, idx)=>{
6298
+ var _series_name;
6299
+ const nameCell = `${SHEET}!$${getExcelColName(idx + 2)}$1`;
6300
+ // These layouts color each data point from the chart color style, so `chartColors` does not
6301
+ // apply - a series-level fill would flatten a treemap to one color. Only `color` overrides it.
6302
+ const spPr = series.color && series.color !== 'transparent' ? `<cx:spPr><a:solidFill>${createColorElement(series.color)}</a:solidFill></cx:spPr>` : '';
6303
+ return `<cx:series layoutId="${layoutId}" uniqueId="{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}">` + `<cx:tx><cx:txData><cx:f>${nameCell}</cx:f><cx:v>${encodeXmlEntities((_series_name = series.name) !== null && _series_name !== void 0 ? _series_name : `Series ${idx + 1}`)}</cx:v></cx:txData></cx:tx>` + spPr + dataLabels + `<cx:dataId val="${idx}"/>` + layoutPr + '</cx:series>';
6304
+ }).join('');
6305
+ }
6306
+ /**
6307
+ * `cx:axis` elements for the layouts that have axes. CT_Axis order: scaling, gridlines, tickLabels.
6308
+ * - a funnel is drawn along a single category axis, which PowerPoint numbers `1`
6309
+ * - treemap and sunburst have no axes; the series carries no `cx:axisId` in either case
6310
+ */ function makeAxes(rel, chartType) {
6311
+ var _rel_opts_valGridLine;
6312
+ const gapWidth = CAT_GAP_WIDTH[chartType];
6313
+ if (gapWidth === undefined) return '';
6314
+ if (chartType === 'funnel') return `<cx:axis id="1"><cx:catScaling gapWidth="${gapWidth}"/><cx:tickLabels/></cx:axis>`;
6315
+ const valGridlines = ((_rel_opts_valGridLine = rel.opts.valGridLine) === null || _rel_opts_valGridLine === void 0 ? void 0 : _rel_opts_valGridLine.style) === 'none' ? '' : '<cx:majorGridlines/>';
6316
+ return `<cx:axis id="0"><cx:catScaling gapWidth="${gapWidth}"/><cx:tickLabels/></cx:axis>` + `<cx:axis id="1"><cx:valScaling/>${valGridlines}<cx:tickLabels/></cx:axis>`;
6317
+ }
6318
+ function makeTitle(opts) {
6319
+ if (!opts.showTitle) return '';
6320
+ const size = Math.round((opts.titleFontSize || (/* inlined export .DEF_FONT_TITLE_SIZE */18)) * 100);
6321
+ const color = opts.titleColor ? `<a:solidFill>${createColorElement(opts.titleColor)}</a:solidFill>` : '';
6322
+ const face = opts.titleFontFace ? `<a:latin typeface="${encodeXmlEntities(opts.titleFontFace)}"/>` : '';
6323
+ return '<cx:title pos="t" align="ctr" overlay="0"><cx:tx><cx:rich><a:bodyPr/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r>' + `<a:rPr lang="${opts.lang || 'en-US'}" sz="${size}" b="${opts.titleBold ? 1 : 0}">${color}${face}</a:rPr>` + `<a:t>${encodeXmlEntities(opts.title || 'Chart Title')}</a:t>` + '</a:r></a:p></cx:rich></cx:tx></cx:title>';
6324
+ }
6325
+ function makeLegend(opts) {
6326
+ if (!opts.showLegend) return '';
6327
+ // `cx:legend@pos` takes l/r/t/b only; PowerPoint stores the library's `tr` as a top-aligned right legend
6328
+ const isTopRight = opts.legendPos === 'tr';
6329
+ return `<cx:legend pos="${isTopRight ? 'r' : opts.legendPos || 'r'}" align="${isTopRight ? 'min' : 'ctr'}" overlay="0"/>`;
6330
+ }
6331
+ /**
6332
+ * Build the `cx:chartSpace` part for one chartex chart.
6333
+ * @param {ISlideRelChart} rel - chart relationship, with `opts._type` narrowed to a chartex type
6334
+ * @returns {string} chartex part XML
6335
+ */ function makeXmlChartEx(rel) {
6336
+ const type = rel.opts._type;
6337
+ if (!isChartexType(type)) throw new Error(`pptxgenjs: "${String(type)}" is not a chartex chart type`);
6338
+ return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<cx:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"' + ' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"' + ` xmlns:cx="${OOXML_CHARTEX.ns}">` + '<cx:chartData>' + '<cx:externalData r:id="rId1" cx:autoUpdate="0"/>' + makeChartData(rel, type) + '</cx:chartData>' + '<cx:chart>' + makeTitle(rel.opts) + '<cx:plotArea>' + `<cx:plotAreaRegion>${makeSeries(rel, type)}</cx:plotAreaRegion>` + makeAxes(rel, type) + '</cx:plotArea>' + makeLegend(rel.opts) + '</cx:chart>' + '</cx:chartSpace>';
6339
+ }
6340
+
6341
+ /**
6342
+ * Chart style and chart colour-style parts (`ppt/charts/styleN.xml`, `ppt/charts/colorsN.xml`).
6343
+ *
6344
+ * Classic `c:chart` parts write these only when `chartStyle` or `chartColorStyle` is set.
6345
+ * ChartEx layouts always need both: PowerPoint resolves their visual properties through them.
6346
+ *
6347
+ * PowerPoint finds both parts by relationship type from the chart's own `.rels` - nothing inside
6348
+ * `chartN.xml` points at them.
6349
+ */
6350
+
6351
+ const XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
6352
+ const NS_ATTRS = `xmlns:cs="${CHART_STYLE.ns}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"`;
6353
+ /** The luminance variations Office writes for a six-colour cycling palette */ const DEF_VARIATIONS = [
6354
+ '',
6355
+ '<a:lumMod val="60000"/>',
6356
+ '<a:lumMod val="80000"/><a:lumOff val="20000"/>',
6357
+ '<a:lumMod val="80000"/>',
6358
+ '<a:lumMod val="60000"/><a:lumOff val="40000"/>',
6359
+ '<a:lumMod val="50000"/>',
6360
+ '<a:lumMod val="70000"/><a:lumOff val="30000"/>',
6361
+ '<a:lumMod val="70000"/>',
6362
+ '<a:lumMod val="50000"/><a:lumOff val="50000"/>'
6363
+ ];
6364
+ /** The six theme accents, which is what Office's default colour style cycles through */ const DEF_ACCENTS = [
6365
+ 'accent1',
6366
+ 'accent2',
6367
+ 'accent3',
6368
+ 'accent4',
6369
+ 'accent5',
6370
+ 'accent6'
6371
+ ];
6372
+ /**
6373
+ * Whether this chart should write `styleN.xml` / `colorsN.xml`.
6374
+ * ChartEx always needs them; classic charts only write them when the caller opts in.
6375
+ */ function wantsChartStyleParts(opts) {
6376
+ if (!opts) return false;
6377
+ if (isChartexType(opts._type)) return true;
6378
+ return opts.chartStyle !== undefined || opts.chartColorStyle !== undefined;
6379
+ }
6380
+ /**
6381
+ * Part name for a chart's colour style, matching the chart's own number
6382
+ * @param {number} chartNum - the N in `chartN.xml`
6383
+ * @returns {string} part name
6384
+ */ function chartColorsPartName(chartNum) {
6385
+ return `ppt/charts/colors${chartNum}.xml`;
6386
+ }
6387
+ /**
6388
+ * Part name for a chart's style, matching the chart's own number
6389
+ * @param {number} chartNum - the N in `chartN.xml`
6390
+ * @returns {string} part name
6391
+ */ function chartStylePartName(chartNum) {
6392
+ return `ppt/charts/style${chartNum}.xml`;
6393
+ }
6394
+ /**
6395
+ * Creates a chart's colour-style part (`cs:colorStyle`).
6396
+ * @param {ChartColorStyleProps} [props] - colour style options
6397
+ * @returns {string} XML
6398
+ */ function makeXmlChartColors(props) {
6399
+ const methods = [
6400
+ 'cycle',
6401
+ 'withinLinear',
6402
+ 'acrossLinear',
6403
+ 'withinLinearReversed',
6404
+ 'acrossLinearReversed'
6405
+ ];
6406
+ const method = (props === null || props === void 0 ? void 0 : props.method) && methods.includes(props.method) ? props.method : 'cycle';
6407
+ const id = typeof (props === null || props === void 0 ? void 0 : props.id) === 'number' && isFinite(props.id) && props.id > 0 ? Math.round(props.id) : 10;
6408
+ const colors = Array.isArray(props === null || props === void 0 ? void 0 : props.colors) && props.colors.length > 0 ? props.colors.map((color)=>createColorElement(color)).join('') : DEF_ACCENTS.map((accent)=>`<a:schemeClr val="${accent}"/>`).join('');
6409
+ return `${XML_HEADER}<cs:colorStyle ${NS_ATTRS} meth="${method}" id="${id}">` + colors + DEF_VARIATIONS.map((variation)=>variation ? `<cs:variation>${variation}</cs:variation>` : '<cs:variation/>').join('') + '</cs:colorStyle>';
6410
+ }
6411
+ /**
6412
+ * Office's default chart style definitions, verbatim.
6413
+ *
6414
+ * The `@id` names which entry of PowerPoint's gallery is selected; the ~30 `cs:*` children are the
6415
+ * definitions themselves. Only this one set is shipped - reproducing every gallery entry would mean
6416
+ * ~150 more, none of which can be verified from a published schema.
6417
+ */ const DEF_CHART_STYLE = '<cs:chartStyle xmlns:cs="http://schemas.microsoft.com/office/drawing/2012/chartStyle" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" id="201"><cs:axisTitle><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1330" kern="1200"/></cs:axisTitle><cs:categoryAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/></cs:categoryAxis><cs:chartArea mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="bg1"/></a:solidFill><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1330" kern="1200"/></cs:chartArea><cs:dataLabel><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="75000"/><a:lumOff val="25000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:dataLabel><cs:dataLabelCallout><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="lt1"/></a:solidFill><a:ln><a:solidFill><a:schemeClr val="dk1"><a:lumMod val="25000"/><a:lumOff val="75000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/><cs:bodyPr rot="0" spcFirstLastPara="1" vertOverflow="clip" horzOverflow="clip" vert="horz" wrap="square" lIns="36576" tIns="18288" rIns="36576" bIns="18288" anchor="ctr" anchorCtr="1"><a:spAutoFit/></cs:bodyPr></cs:dataLabelCallout><cs:dataPoint><cs:lnRef idx="0"/><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:dataPoint><cs:dataPoint3D><cs:lnRef idx="0"/><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:dataPoint3D><cs:dataPointLine><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="28575" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointLine><cs:dataPointMarker><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></cs:spPr></cs:dataPointMarker><cs:dataPointMarkerLayout symbol="circle" size="5"/><cs:dataPointWireframe><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointWireframe><cs:dataTable><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:noFill/><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/></cs:dataTable><cs:downBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="dk1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill><a:ln w="9525"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:downBar><cs:dropLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:dropLine><cs:errorBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:errorBar><cs:floor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:noFill/><a:ln><a:noFill/></a:ln></cs:spPr></cs:floor><cs:gridlineMajor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMajor><cs:gridlineMinor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="5000"/><a:lumOff val="95000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMinor><cs:hiLoLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="75000"/><a:lumOff val="25000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:hiLoLine><cs:leaderLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:leaderLine><cs:legend><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:legend><cs:plotArea mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:plotArea><cs:plotArea3D mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:plotArea3D><cs:seriesAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:seriesAxis><cs:seriesLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:seriesLine><cs:title><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1862" b="0" kern="1200" spc="0" baseline="0"/></cs:title><cs:trendline><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="19050" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="sysDot"/></a:ln></cs:spPr></cs:trendline><cs:trendlineLabel><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:trendlineLabel><cs:upBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="lt1"/></a:solidFill><a:ln w="9525"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:upBar><cs:valueAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:valueAxis><cs:wall><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:noFill/><a:ln><a:noFill/></a:ln></cs:spPr></cs:wall></cs:chartStyle>';
6418
+ /**
6419
+ * Creates a chart's style part (`cs:chartStyle`).
6420
+ * @param {number} [styleId] - which gallery entry is selected; the definitions are Office's defaults
6421
+ * @returns {string} XML
6422
+ */ function makeXmlChartStyle(styleId) {
6423
+ const body = typeof styleId === 'number' && isFinite(styleId) && styleId > 0 ? DEF_CHART_STYLE.replace(/ id="\d+">/, ` id="${Math.round(styleId)}">`) : DEF_CHART_STYLE;
6424
+ return XML_HEADER + body;
6425
+ }
6426
+
6427
+ /**
6428
+ * Chart title rendering.
6429
+ */
6430
+
6431
+ /**
6432
+ * Create char title elements
6433
+ * @param {IChartPropsTitle} opts - options
6434
+ * @return {string} XML `<c:title>`
6435
+ */ function genXmlTitle(opts, chartX, chartY) {
6436
+ const align = opts.titleAlign === 'left' || opts.titleAlign === 'right' ? `<a:pPr algn="${opts.titleAlign.substring(0, 1)}">` : '<a:pPr>';
6437
+ const rotate = opts.titleRotate ? `<a:bodyPr rot="${convertRotationDegrees(opts.titleRotate)}"/>` : '<a:bodyPr/>' // don't specify rotation to get default (ex. vertical for cat axis)
6438
+ ;
6439
+ const sizeAttr = opts.fontSize ? `sz="${Math.round(opts.fontSize * 100)}"` : '' // only set the font size if specified. Powerpoint will handle the default size
6440
+ ;
6441
+ const titleBold = opts.titleBold ? 1 : 0;
6442
+ const titleItalic = opts.titleItalic ? 1 : 0;
6443
+ let layout = '<c:layout/>';
6444
+ if (opts.titlePos && typeof opts.titlePos.x === 'number' && typeof opts.titlePos.y === 'number') {
6445
+ // NOTE: manualLayout x/y vals are *relative to entire slide*
6446
+ const totalX = opts.titlePos.x + (chartX !== null && chartX !== void 0 ? chartX : 0);
6447
+ const totalY = opts.titlePos.y + (chartY !== null && chartY !== void 0 ? chartY : 0);
6448
+ let valX = totalX === 0 ? 0 : totalX * (totalX / 5) / 10;
6449
+ if (valX >= 1) valX = valX / 10;
6450
+ if (valX >= 0.1) valX = valX / 10;
6451
+ let valY = totalY === 0 ? 0 : totalY * (totalY / 5) / 10;
6452
+ if (valY >= 1) valY = valY / 10;
6453
+ if (valY >= 0.1) valY = valY / 10;
6454
+ layout = `<c:layout><c:manualLayout><c:xMode val="edge"/><c:yMode val="edge"/><c:x val="${valX}"/><c:y val="${valY}"/></c:manualLayout></c:layout>`;
6455
+ }
6456
+ return `<c:title>
6457
+ <c:tx>
6458
+ <c:rich>
6459
+ ${rotate}
6460
+ <a:lstStyle/>
6461
+ <a:p>
6462
+ ${align}
6463
+ <a:defRPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
6464
+ <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
6465
+ <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6466
+ <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6467
+ </a:defRPr>
6468
+ </a:pPr>
6469
+ <a:r>
6470
+ <a:rPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
6471
+ <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
6472
+ <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6473
+ <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6474
+ </a:rPr>
6475
+ <a:t>${encodeXmlEntities(opts.title) || ''}</a:t>
6476
+ </a:r>
6477
+ </a:p>
6478
+ </c:rich>
6479
+ </c:tx>
6480
+ ${layout}
6481
+ <c:overlay val="0"/>
6482
+ </c:title>`;
6483
+ }
6484
+
5584
6485
  /**
5585
6486
  * Chart axis rendering.
5586
6487
  */
@@ -5661,6 +6562,7 @@ function resolveAreaGrouping(barGrouping) {
5661
6562
  strXml += ` <a:defRPr sz="${Math.round((opts.catAxisLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.catAxisLabelFontBold ? 1 : 0}" i="${opts.catAxisLabelFontItalic ? 1 : 0}" u="none" strike="noStrike">`;
5662
6563
  strXml += ' <a:solidFill>' + createColorElement(opts.catAxisLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000")) + '</a:solidFill>';
5663
6564
  strXml += ' <a:latin typeface="' + (encodeXmlEntities(opts.catAxisLabelFontFace) || 'Arial') + '"/>';
6565
+ strXml += ' <a:ea typeface="' + (encodeXmlEntities(opts.catAxisLabelFontFace) || 'Arial') + '"/>';
5664
6566
  strXml += ' </a:defRPr>';
5665
6567
  strXml += ' </a:pPr>';
5666
6568
  strXml += ' <a:endParaRPr lang="' + (opts.lang || 'en-US') + '"/>';
@@ -5765,6 +6667,7 @@ function resolveAreaGrouping(barGrouping) {
5765
6667
  strXml += ` <a:defRPr sz="${Math.round((opts.valAxisLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.valAxisLabelFontBold ? 1 : 0}" i="${opts.valAxisLabelFontItalic ? 1 : 0}" u="none" strike="noStrike">`;
5766
6668
  strXml += ' <a:solidFill>' + createColorElement(opts.valAxisLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000")) + '</a:solidFill>';
5767
6669
  strXml += ' <a:latin typeface="' + (encodeXmlEntities(opts.valAxisLabelFontFace) || 'Arial') + '"/>';
6670
+ strXml += ' <a:ea typeface="' + (encodeXmlEntities(opts.valAxisLabelFontFace) || 'Arial') + '"/>';
5768
6671
  strXml += ' </a:defRPr>';
5769
6672
  strXml += ' </a:pPr>';
5770
6673
  strXml += ' <a:endParaRPr lang="' + (opts.lang || 'en-US') + '"/>';
@@ -5836,6 +6739,7 @@ function resolveAreaGrouping(barGrouping) {
5836
6739
  strXml += ` <a:defRPr sz="${Math.round((opts.serAxisLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.serAxisLabelFontBold ? '1' : '0'}" i="${opts.serAxisLabelFontItalic ? '1' : '0'}" u="none" strike="noStrike">`;
5837
6740
  strXml += ` <a:solidFill>${createColorElement(opts.serAxisLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>`;
5838
6741
  strXml += ` <a:latin typeface="${encodeXmlEntities(opts.serAxisLabelFontFace) || 'Arial'}"/>`;
6742
+ strXml += ` <a:ea typeface="${encodeXmlEntities(opts.serAxisLabelFontFace) || 'Arial'}"/>`;
5839
6743
  strXml += ' </a:defRPr>';
5840
6744
  strXml += ' </a:pPr>';
5841
6745
  strXml += ' <a:endParaRPr lang="' + (opts.lang || 'en-US') + '"/>';
@@ -5998,7 +6902,7 @@ function xml_object_spread_props(target, source) {
5998
6902
  usesSecondaryValAxis = usesSecondaryValAxis || ((_options_secondaryValAxis = options.secondaryValAxis) !== null && _options_secondaryValAxis !== void 0 ? _options_secondaryValAxis : false);
5999
6903
  strXml += makeChartType(type.type, type.data, options, valAxisId, catAxisId, true, rel.data);
6000
6904
  });
6001
- } else if (rel.opts._type) {
6905
+ } else if (rel.opts._type && !isChartexType(rel.opts._type)) {
6002
6906
  strXml += makeChartType(rel.opts._type, rel.data, rel.opts, AXIS_ID_VALUE_PRIMARY, AXIS_ID_CATEGORY_PRIMARY, false, rel.data);
6003
6907
  }
6004
6908
  // B: Axes -----------------------------------------------------------
@@ -6100,6 +7004,7 @@ function xml_object_spread_props(target, source) {
6100
7004
  strXml += rel.opts.legendFontSize ? `<a:defRPr sz="${Math.round(Number(rel.opts.legendFontSize) * 100)}">` : '<a:defRPr>';
6101
7005
  if (rel.opts.legendColor) strXml += genXmlColorSelection(rel.opts.legendColor);
6102
7006
  if (rel.opts.legendFontFace) strXml += '<a:latin typeface="' + encodeXmlEntities(rel.opts.legendFontFace) + '"/>';
7007
+ if (rel.opts.legendFontFace) strXml += '<a:ea typeface="' + encodeXmlEntities(rel.opts.legendFontFace) + '"/>';
6103
7008
  if (rel.opts.legendFontFace) strXml += '<a:cs typeface="' + encodeXmlEntities(rel.opts.legendFontFace) + '"/>';
6104
7009
  strXml += ' </a:defRPr>';
6105
7010
  strXml += ' </a:pPr>';
@@ -7042,6 +7947,8 @@ function _async_to_generator(fn) {
7042
7947
 
7043
7948
 
7044
7949
 
7950
+
7951
+
7045
7952
  function getDataTableStyles(chartObject) {
7046
7953
  const dataTableFormats = Array.isArray(chartObject.opts._type) ? chartObject.opts._type.flatMap((type)=>{
7047
7954
  var _ref;
@@ -7546,8 +8453,19 @@ function makeNumberStyles(formats) {
7546
8453
  base64: true
7547
8454
  });
7548
8455
  // 2: Create the chart.xml and rel files
7549
- zip.file('ppt/charts/_rels/' + chartObject.fileName + '.rels', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' + `<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx"/>` + '</Relationships>');
7550
- zip.file(`ppt/charts/${chartObject.fileName}`, makeXmlCharts(chartObject));
8456
+ // PowerPoint finds the style and colour-style parts by relationship type, so they are
8457
+ // declared here rather than referenced from inside `chartN.xml`.
8458
+ // Classic charts write them only when requested; ChartEx layouts always need them.
8459
+ const isChartex = isChartexType(chartObject.opts._type);
8460
+ const writeStyleParts = wantsChartStyleParts(chartObject.opts);
8461
+ const styleRels = writeStyleParts ? `<Relationship Id="rId2" Type="${CHART_STYLE.colorsRelType}" Target="colors${chartObject.globalId}.xml"/>` + `<Relationship Id="rId3" Type="${CHART_STYLE.styleRelType}" Target="style${chartObject.globalId}.xml"/>` : '';
8462
+ zip.file('ppt/charts/_rels/' + chartObject.fileName + '.rels', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' + `<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx"/>` + styleRels + '</Relationships>');
8463
+ zip.file(`ppt/charts/${chartObject.fileName}`, isChartex ? makeXmlChartEx(chartObject) : makeXmlCharts(chartObject));
8464
+ if (writeStyleParts) {
8465
+ var _chartObject_opts, _chartObject_opts1;
8466
+ zip.file(chartColorsPartName(chartObject.globalId), makeXmlChartColors((_chartObject_opts = chartObject.opts) === null || _chartObject_opts === void 0 ? void 0 : _chartObject_opts.chartColorStyle));
8467
+ zip.file(chartStylePartName(chartObject.globalId), makeXmlChartStyle((_chartObject_opts1 = chartObject.opts) === null || _chartObject_opts1 === void 0 ? void 0 : _chartObject_opts1.chartStyle));
8468
+ }
7551
8469
  // 3: Done
7552
8470
  resolve('');
7553
8471
  }).catch((strErr)=>{
@@ -7559,6 +8477,8 @@ function makeNumberStyles(formats) {
7559
8477
 
7560
8478
 
7561
8479
 
8480
+
8481
+
7562
8482
  /**
7563
8483
  * @file 语言相关函数
7564
8484
  * @author mengke01(kekee000@gmail.com)
@@ -15790,7 +16710,7 @@ function imageDimensions(bytes) {
15790
16710
  });
15791
16711
  }
15792
16712
  /** Select relations that still need their local or remote media encoded. */ function getMediaCandidates(layout) {
15793
- return layout._relsMedia.filter((rel)=>rel.type !== 'online' && !rel.data && (!rel.path || rel.path && !rel.path.includes('preencoded')));
16713
+ return layout._relsMedia.filter((rel)=>!rel.isLinked && rel.type !== 'online' && !rel.data && (!rel.path || rel.path && !rel.path.includes('preencoded')));
15794
16714
  }
15795
16715
  /**
15796
16716
  * Mark repeated source paths so only the first relation performs I/O.
@@ -18673,7 +19593,9 @@ function normalizeDir(value) {
18673
19593
  'fast'
18674
19594
  ].includes(t.speed) ? t.speed : undefined;
18675
19595
  const dur = typeof t.duration === 'number' && t.duration > 0 ? ` p14:dur="${Math.round(t.duration)}"` : '';
18676
- const attrs = (speed && !dur ? ` spd="${speed}"` : '') + dur + (t.advClick === false ? ' advClick="0"' : '') + (typeof t.advTm === 'number' && t.advTm >= 0 ? ` advTm="${Math.round(t.advTm)}"` : '');
19596
+ // Fallback must stay in the ECMA-376 attribute set (`spd`); `p14:dur` is Choice-only.
19597
+ const fallbackAttrs = (speed ? ` spd="${speed}"` : '') + (t.advClick === false ? ' advClick="0"' : '') + (typeof t.advTm === 'number' && t.advTm >= 0 ? ` advTm="${Math.round(t.advTm)}"` : '');
19598
+ const attrs = fallbackAttrs + dur;
18677
19599
  const type = t.type;
18678
19600
  // Modern transition: wrap in mc:AlternateContent with a base-type Fallback.
18679
19601
  if (MODERN[type]) {
@@ -18704,7 +19626,7 @@ function normalizeDir(value) {
18704
19626
  const fallback = baseInner(fbName, fbKind, {
18705
19627
  type: fallbackType
18706
19628
  });
18707
- return `<mc:AlternateContent xmlns:mc="${gen_transition_MC_NS}" xmlns:${prefix}="${ns}">` + `<mc:Choice Requires="${prefix}">` + `<p:transition${attrs}>${inner}</p:transition>` + '</mc:Choice>' + `<mc:Fallback><p:transition${attrs}>${fallback}</p:transition></mc:Fallback>` + '</mc:AlternateContent>';
19629
+ return `<mc:AlternateContent xmlns:mc="${gen_transition_MC_NS}" xmlns:${prefix}="${ns}">` + `<mc:Choice Requires="${prefix}">` + `<p:transition${attrs}>${inner}</p:transition>` + '</mc:Choice>' + `<mc:Fallback><p:transition${fallbackAttrs}>${fallback}</p:transition></mc:Fallback>` + '</mc:AlternateContent>';
18708
19630
  }
18709
19631
  // Base ECMA-376 transition.
18710
19632
  if (BASE[type]) {
@@ -19077,7 +19999,8 @@ function replyXml(reply, authors, fallbackDate) {
19077
19999
  // is the absolute `/ppt/charts/chartN.xml` form reused as Content_Types PartName.
19078
20000
  // PowerPoint writes the relative `../charts/chartN.xml`; absolute targets are valid but
19079
20001
  // non-idiomatic and break stricter consumers (PR 1465 / eliasaronson).
19080
- strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
20002
+ const relType = isChartexType(rel.opts._type) ? OOXML_CHARTEX.relType : 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart';
20003
+ strXml += `<Relationship Id="rId${rel.rId}" Type="${relType}" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
19081
20004
  });
19082
20005
  (slide._relsMedia || []).forEach((rel)=>{
19083
20006
  const relRid = rel.rId.toString();
@@ -19086,17 +20009,19 @@ function replyXml(reply, authors, fallbackDate) {
19086
20009
  strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="' + rel.Target + '"/>';
19087
20010
  } else if (rel.type.toLowerCase().includes('audio')) {
19088
20011
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
20012
+ const externalAttr = rel.isLinked ? ' TargetMode="External"' : '';
19089
20013
  if (strXml.includes(' Target="' + rel.Target + '"')) {
19090
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"/>';
20014
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"' + externalAttr + '/>';
19091
20015
  } else {
19092
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio" Target="' + rel.Target + '"/>';
20016
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio" Target="' + rel.Target + '"' + externalAttr + '/>';
19093
20017
  }
19094
20018
  } else if (rel.type.toLowerCase().includes('video')) {
19095
20019
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
20020
+ const externalAttr = rel.isLinked ? ' TargetMode="External"' : '';
19096
20021
  if (strXml.includes(' Target="' + rel.Target + '"')) {
19097
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"/>';
20022
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"' + externalAttr + '/>';
19098
20023
  } else {
19099
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" Target="' + rel.Target + '"/>';
20024
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" Target="' + rel.Target + '"' + externalAttr + '/>';
19100
20025
  }
19101
20026
  } else if (rel.type.toLowerCase().includes('online')) {
19102
20027
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
@@ -19241,6 +20166,8 @@ const CHANGES_INFO_NS = 'http://schemas.microsoft.com/office/powerpoint/2013/mai
19241
20166
  const gen_revision_P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main';
19242
20167
  const CREATION_ID_URI = '{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}';
19243
20168
  const MOD_ID_URI = '{D42A27DB-BD31-4B8C-83A1-F6EECF244321}';
20169
+ /** Deterministic, unique-per-object `p14:modId` base (MS-PPTX §2.3.1.19). */ const TABLE_MOD_ID_BASE = 1579011935;
20170
+ /** Deterministic `p14:creationId` base when `slide.creationId === true` (MS-PPTX §2.3.1.4). */ const CREATION_ID_BASE = 2147483648;
19244
20171
  /** True when the caller opted into the Revision Information part. */ function wantsRevisionInfo(value) {
19245
20172
  return value === true || typeof value === 'object' && value !== null;
19246
20173
  }
@@ -19253,9 +20180,25 @@ function unsignedInt(value) {
19253
20180
  /** `p14:creationId` / `p14:modId` `val` — xsd:unsignedInt. */ function randomIdVal(value) {
19254
20181
  return String(unsignedInt(value));
19255
20182
  }
19256
- /** `p:ext` wrapper for `p14:creationId` on `cSld` (MS-PPTX §2.2.9 / §2.3.1.4). */ function genXmlCreationIdExt(creationId) {
19257
- if (typeof creationId !== 'number' || !Number.isFinite(creationId)) return '';
19258
- return `<p:extLst><p:ext uri="${CREATION_ID_URI}"><p14:creationId xmlns:p14="${gen_revision_P14_NS}" val="${randomIdVal(creationId)}"/></p:ext></p:extLst>`;
20183
+ /**
20184
+ * Resolve `slide.creationId` to an unsigned 32-bit integer, or `undefined` when unset/invalid.
20185
+ * `true` assigns a reproducible id from the slide number so callers can opt in without picking one.
20186
+ */ function resolveCreationId(creationId, slideNum) {
20187
+ if (creationId === true) return CREATION_ID_BASE + (slideNum !== null && slideNum !== void 0 ? slideNum : 0);
20188
+ if (typeof creationId !== 'number' || !Number.isFinite(creationId)) {
20189
+ if (creationId !== undefined) console.warn(`[pptxgenjs] creationId must be \`true\` or an unsigned 32-bit integer - "${String(creationId)}" ignored`);
20190
+ return undefined;
20191
+ }
20192
+ if (creationId < 0 || creationId > 0xffffffff || Math.floor(creationId) !== creationId) {
20193
+ console.warn(`[pptxgenjs] creationId must be an integer between 0 and 4294967295 - "${String(creationId)}" ignored`);
20194
+ return undefined;
20195
+ }
20196
+ return creationId;
20197
+ }
20198
+ /** `p:ext` wrapper for `p14:creationId` on `cSld` (MS-PPTX §2.2.9 / §2.3.1.4). */ function genXmlCreationIdExt(creationId, slideNum) {
20199
+ const resolved = resolveCreationId(creationId, slideNum);
20200
+ if (resolved === undefined) return '';
20201
+ return `<p:extLst><p:ext uri="${CREATION_ID_URI}"><p14:creationId xmlns:p14="${gen_revision_P14_NS}" val="${randomIdVal(resolved)}"/></p:ext></p:extLst>`;
19259
20202
  }
19260
20203
  /** `p:ext` wrapper for `p14:modId` on `nvPr` (MS-PPTX §2.2.9 / §2.3.1.19). */ function genXmlModIdExt(modId) {
19261
20204
  if (typeof modId !== 'number' || !Number.isFinite(modId)) return '';
@@ -19284,6 +20227,170 @@ function unsignedInt(value) {
19284
20227
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<pc:chgInfo xmlns:pc="${CHANGES_INFO_NS}"/>`;
19285
20228
  }
19286
20229
 
20230
+ /**
20231
+ * PptxGenJS: Non-visual drawing properties (`p:cNvPr`) and editing locks
20232
+ *
20233
+ * Every drawable object carries a `p:cNvPr` with its id, name, and alt text, and a sibling
20234
+ * `p:cNv*Pr` holding the lock element for its kind - `a:spLocks` for shapes, `a:picLocks` for
20235
+ * pictures, `a:graphicFrameLocks` for frames, `a:grpSpLocks` for groups, `a:cxnSpLocks` for
20236
+ * connectors. The lock attributes are shared, so one emitter serves all five.
20237
+ */
20238
+ /** Lock attribute names, in the order the schema declares them */ const LOCK_ATTRS = [
20239
+ [
20240
+ 'noGroup',
20241
+ 'noGrp'
20242
+ ],
20243
+ [
20244
+ 'noSelect',
20245
+ 'noSelect'
20246
+ ],
20247
+ [
20248
+ 'noRotate',
20249
+ 'noRot'
20250
+ ],
20251
+ [
20252
+ 'noChangeAspect',
20253
+ 'noChangeAspect'
20254
+ ],
20255
+ [
20256
+ 'noMove',
20257
+ 'noMove'
20258
+ ],
20259
+ [
20260
+ 'noResize',
20261
+ 'noResize'
20262
+ ],
20263
+ [
20264
+ 'noEditPoints',
20265
+ 'noEditPoints'
20266
+ ],
20267
+ [
20268
+ 'noAdjustHandles',
20269
+ 'noAdjustHandles'
20270
+ ],
20271
+ [
20272
+ 'noChangeArrowheads',
20273
+ 'noChangeArrowheads'
20274
+ ],
20275
+ [
20276
+ 'noChangeShapeType',
20277
+ 'noChangeShapeType'
20278
+ ],
20279
+ [
20280
+ 'noTextEdit',
20281
+ 'noTextEdit'
20282
+ ],
20283
+ [
20284
+ 'noCrop',
20285
+ 'noCrop'
20286
+ ]
20287
+ ];
20288
+ /** Which lock attributes each element actually permits */ const ALLOWED = {
20289
+ 'a:spLocks': new Set([
20290
+ 'noGrp',
20291
+ 'noSelect',
20292
+ 'noRot',
20293
+ 'noChangeAspect',
20294
+ 'noMove',
20295
+ 'noResize',
20296
+ 'noEditPoints',
20297
+ 'noAdjustHandles',
20298
+ 'noChangeArrowheads',
20299
+ 'noChangeShapeType',
20300
+ 'noTextEdit'
20301
+ ]),
20302
+ 'a:picLocks': new Set([
20303
+ 'noGrp',
20304
+ 'noSelect',
20305
+ 'noRot',
20306
+ 'noChangeAspect',
20307
+ 'noMove',
20308
+ 'noResize',
20309
+ 'noEditPoints',
20310
+ 'noAdjustHandles',
20311
+ 'noChangeArrowheads',
20312
+ 'noChangeShapeType',
20313
+ 'noCrop'
20314
+ ]),
20315
+ 'a:graphicFrameLocks': new Set([
20316
+ 'noGrp',
20317
+ 'noSelect',
20318
+ 'noChangeAspect',
20319
+ 'noMove',
20320
+ 'noResize',
20321
+ 'noDrilldown'
20322
+ ]),
20323
+ 'a:grpSpLocks': new Set([
20324
+ 'noGrp',
20325
+ 'noSelect',
20326
+ 'noRot',
20327
+ 'noChangeAspect',
20328
+ 'noMove',
20329
+ 'noResize',
20330
+ 'noUngrp'
20331
+ ]),
20332
+ 'a:cxnSpLocks': new Set([
20333
+ 'noGrp',
20334
+ 'noSelect',
20335
+ 'noRot',
20336
+ 'noChangeAspect',
20337
+ 'noMove',
20338
+ 'noResize',
20339
+ 'noEditPoints',
20340
+ 'noAdjustHandles',
20341
+ 'noChangeArrowheads',
20342
+ 'noChangeShapeType'
20343
+ ])
20344
+ };
20345
+ /**
20346
+ * Create a lock element, or `''` when nothing is locked
20347
+ * - attributes the element does not permit are dropped: an unexpected one is a schema violation
20348
+ * @param {string} tag - lock element name for the object's kind
20349
+ * @param {ShapeLockProps} lock - lock props
20350
+ * @param {string} defaults - attributes the library already emits for this object
20351
+ * @returns {string} XML string
20352
+ */ function genXmlLocks(tag, lock, defaults = '') {
20353
+ var _ALLOWED_tag;
20354
+ const allowed = (_ALLOWED_tag = ALLOWED[tag]) !== null && _ALLOWED_tag !== void 0 ? _ALLOWED_tag : new Set();
20355
+ let attrs = defaults;
20356
+ LOCK_ATTRS.forEach(([prop, attr])=>{
20357
+ if ((lock === null || lock === void 0 ? void 0 : lock[prop]) !== true) return;
20358
+ if (!allowed.has(attr)) {
20359
+ console.warn(`[pptxgenjs] \`${String(prop)}\` does not apply to this object type - ignored`);
20360
+ return;
20361
+ }
20362
+ // do not repeat an attribute the caller already gets by default
20363
+ if (defaults.includes(`${attr}="`)) return;
20364
+ attrs += ` ${attr}="1"`;
20365
+ });
20366
+ return attrs ? `<${tag}${attrs}/>` : '';
20367
+ }
20368
+ /**
20369
+ * Create the `p:cNvPr` element
20370
+ * @param {number} id - shape id, unique on the slide
20371
+ * @param {string} name - shape name shown in the selection pane (already XML-escaped by callers)
20372
+ * @param {NonVisualProps} props - non-visual options
20373
+ * @param {string} descr - alt-text description
20374
+ * @param {string} children - child elements (ex: hyperlinks); self-closes when empty
20375
+ * @returns {string} XML string
20376
+ */ function genXmlCNvPr(id, name, props, descr = '', children = '') {
20377
+ let attrs = `id="${id}" name="${name}"`;
20378
+ // `descr` is the alt-text description; `title` is the separate alt-text title
20379
+ if (descr) attrs += ` descr="${encodeXmlEntities(descr)}"`;
20380
+ if (props === null || props === void 0 ? void 0 : props.title) attrs += ` title="${encodeXmlEntities(props.title)}"`;
20381
+ if ((props === null || props === void 0 ? void 0 : props.hidden) === true) attrs += ' hidden="1"';
20382
+ return children ? `<p:cNvPr ${attrs}>${children}</p:cNvPr>` : `<p:cNvPr ${attrs}/>`;
20383
+ }
20384
+ /**
20385
+ * Create `p:cNvSpPr`, carrying the text-box flag and any shape locks
20386
+ * @param {object} options - shape options
20387
+ * @returns {string} XML string
20388
+ */ function genXmlCNvSpPr(options) {
20389
+ const txBox = (options === null || options === void 0 ? void 0 : options.isTextBox) ? ' txBox="1"' : '';
20390
+ const locks = genXmlLocks('a:spLocks', options === null || options === void 0 ? void 0 : options.lock);
20391
+ return locks ? `<p:cNvSpPr${txBox}>${locks}</p:cNvSpPr>` : `<p:cNvSpPr${txBox}/>`;
20392
+ }
20393
+
19287
20394
  function xml_slide_define_property(obj, key, value) {
19288
20395
  if (key in obj) {
19289
20396
  Object.defineProperty(obj, key, {
@@ -19341,11 +20448,33 @@ function slide_object_spread_props(target, source) {
19341
20448
 
19342
20449
 
19343
20450
 
20451
+
20452
+
19344
20453
  function nvPrModIdExt(modId) {
19345
20454
  return genXmlModIdExt(modId).replace(/^<p:extLst>|<\/p:extLst>$/g, '');
19346
20455
  }
19347
20456
  function genXmlNvPr(options, phXml = '', extraExts = []) {
19348
- return `<p:nvPr>${phXml}${genXmlNvPrExtLst(options, extraExts)}</p:nvPr>`;
20457
+ const attrs = ((options === null || options === void 0 ? void 0 : options.isPhoto) === true ? ' isPhoto="1"' : '') + ((options === null || options === void 0 ? void 0 : options.userDrawn) === true ? ' userDrawn="1"' : '');
20458
+ return `<p:nvPr${attrs}>${phXml}${genXmlNvPrExtLst(options, extraExts)}</p:nvPr>`;
20459
+ }
20460
+ /**
20461
+ * Fallback shape for a chartex graphic frame (`mc:Fallback`).
20462
+ *
20463
+ * PowerPoint writes a rendered preview picture here, which this library cannot produce without a
20464
+ * rasterizer. A locked, non-editable text shape occupying the same box is the closest honest
20465
+ * substitute: a consumer that rejects the `mc:Choice` still sees where the chart is and why it is
20466
+ * not drawn, and cannot silently edit it into something that no longer matches the chart part.
20467
+ */ function genXmlChartExFallback(shapeId, slideItemObj, box) {
20468
+ var _slideItemObj_options, _options_objectName, _options_altText;
20469
+ const options = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
20470
+ const name = (_options_objectName = options.objectName) !== null && _options_objectName !== void 0 ? _options_objectName : 'Chart';
20471
+ const message = 'This chart is not available in your version of PowerPoint. Editing this shape or saving this file in a different format will permanently break the chart.';
20472
+ // A chart's `title` is the chart title, not the alt-text title `p:cNvPr@title` carries.
20473
+ // `noTextEdit` is not optional: an edited fallback would no longer match the chart part.
20474
+ return '<p:sp>' + '<p:nvSpPr>' + `<p:cNvPr id="${shapeId}" name="${encodeXmlEntities(name)}" descr="${encodeXmlEntities((_options_altText = options.altText) !== null && _options_altText !== void 0 ? _options_altText : message)}"/>` + '<p:cNvSpPr><a:spLocks noTextEdit="1"/></p:cNvSpPr>' + '<p:nvPr/>' + '</p:nvSpPr>' + `<p:spPr><a:xfrm><a:off x="${box.x}" y="${box.y}"/><a:ext cx="${box.cx}" cy="${box.cy}"/></a:xfrm>` + '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>' + '<a:solidFill><a:prstClr val="white"/></a:solidFill>' + '<a:ln><a:solidFill><a:prstClr val="black"/></a:solidFill></a:ln></p:spPr>' + '<p:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="square"><a:normAutofit/></a:bodyPr><a:lstStyle/>' + `<a:p><a:r><a:rPr lang="en-US" sz="1100"/><a:t>${encodeXmlEntities(message)}</a:t></a:r></a:p>` + '</p:txBody>' + '</p:sp>';
20475
+ }
20476
+ function genXmlCNvPrLinks(click, hover) {
20477
+ return ((click === null || click === void 0 ? void 0 : click._rId) ? genXmlHyperlink(click, 'click', 'shape') : '') + ((hover === null || hover === void 0 ? void 0 : hover._rId) ? genXmlHyperlink(hover, 'hover', 'shape') : '');
19349
20478
  }
19350
20479
  const ImageSizingXml = {
19351
20480
  cover: function(imgSize, boxDim) {
@@ -19426,10 +20555,6 @@ const ImageSizingXml = {
19426
20555
  return opts.tableStyleId ? `<a:tblPr${attrs}><a:tableStyleId>${encodeXmlEntities(opts.tableStyleId)}</a:tableStyleId></a:tblPr>` : `<a:tblPr${attrs}/>`;
19427
20556
  }
19428
20557
  /**
19429
- * Create the `a:ln` outline block for a shape/image
19430
- * @param {ShapeLineProps} line - line options
19431
- * @return {string} XML
19432
- */ /**
19433
20558
  * Builds `<p14:trim>` / `<p14:fade>` / `<p14:bmkLst>` children of `<p14:media>` (MS-PPTX §2.3.3.14).
19434
20559
  * Times are ST_UniversalTimeOffset (ms).
19435
20560
  */ function genXmlMediaExtras(opts) {
@@ -19439,7 +20564,34 @@ const ImageSizingXml = {
19439
20564
  if (opts.bookmarks && opts.bookmarks.length > 0) xml += `<p14:bmkLst>${opts.bookmarks.map((b)=>`<p14:bmk name="${encodeXmlEntities(b.name)}" time="${Math.round(b.time)}"/>`).join('')}</p14:bmkLst>`;
19440
20565
  return xml;
19441
20566
  }
19442
- function genXmlLine(line) {
20567
+ /**
20568
+ * One `a:tcPr` border line (`a:lnL`, `a:lnTlToBr`, ...)
20569
+ * - the four edges and the two diagonals share CT_LineProperties, so they share this emitter
20570
+ * @param {string} name - element name without the `a:` prefix
20571
+ * @param {BorderProps} border - border definition
20572
+ * @returns {string} XML
20573
+ */ function genXmlCellBorder(name, border) {
20574
+ var _ref, _border_width, _border_color;
20575
+ if (border.type === 'none') return `<a:${name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${name}>`;
20576
+ const width = (_ref = (_border_width = border.width) !== null && _border_width !== void 0 ? _border_width : border.pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt;
20577
+ const borderTransparency = border.transparency;
20578
+ const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
20579
+ return `<a:${name} w="${valToPts(width)}" cap="flat" cmpd="sng" algn="ctr">` + `<a:solidFill>${createColorElement((_border_color = border.color) !== null && _border_color !== void 0 ? _border_color : DEF_CELL_BORDER.color, borderAlpha)}</a:solidFill>` + `<a:prstDash val="${border.type === 'dash' ? 'sysDash' : 'solid'}"/><a:round/>` + '<a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>' + `</a:${name}>`;
20580
+ }
20581
+ /**
20582
+ * One `a:audioCd` endpoint (`a:st` or `a:end`).
20583
+ * - `@track` is required and is an `xsd:unsignedByte`, so it is clamped; `@time` defaults to 0
20584
+ */ function genXmlAudioCdTime(tag, point) {
20585
+ var _ref;
20586
+ const track = Math.min(255, Math.max(0, Math.round((_ref = point === null || point === void 0 ? void 0 : point.track) !== null && _ref !== void 0 ? _ref : 0)));
20587
+ const time = typeof (point === null || point === void 0 ? void 0 : point.time) === 'number' && isFinite(point.time) && point.time > 0 ? ` time="${Math.round(point.time)}"` : '';
20588
+ return `<${tag} track="${track}"${time}/>`;
20589
+ }
20590
+ /**
20591
+ * Create the `a:ln` outline block for a shape/image
20592
+ * @param {ShapeLineProps} line - line options
20593
+ * @return {string} XML
20594
+ */ function genXmlLine(line) {
19443
20595
  // ECMA-376 §5.1.2.1.34: `<a:ln>` carries `w` and `cap` attributes (cap = line ending style, issue #782)
19444
20596
  const attrs = (line.width ? ` w="${valToPts(line.width)}"` : '') + (line.cap && [
19445
20597
  'flat',
@@ -19464,15 +20616,20 @@ function genXmlLine(line) {
19464
20616
  * Create a single `a:outerShdw` / `a:innerShdw` element (no `effectLst` wrapper).
19465
20617
  * @note pure - unit conversion must NOT mutate the caller's options (issue #20)
19466
20618
  */ function genXmlShadowElement(shadow) {
19467
- var _shadow_blur, _shadow_offset, _shadow_angle, _shadow_opacity;
19468
- const type = shadow.type === 'inner' ? 'inner' : 'outer';
19469
- const blur = valToPts((_shadow_blur = shadow.blur) !== null && _shadow_blur !== void 0 ? _shadow_blur : 8);
20619
+ var _shadow_offset, _shadow_angle, _shadow_opacity, _shadow_blur;
19470
20620
  const offset = valToPts((_shadow_offset = shadow.offset) !== null && _shadow_offset !== void 0 ? _shadow_offset : 4);
19471
20621
  const angle = Math.round(((_shadow_angle = shadow.angle) !== null && _shadow_angle !== void 0 ? _shadow_angle : 270) * 60000);
19472
20622
  const opacity = Math.round(((_shadow_opacity = shadow.opacity) !== null && _shadow_opacity !== void 0 ? _shadow_opacity : 0.75) * 100000);
19473
20623
  const color = shadow.color || DEF_TEXT_SHADOW.color;
20624
+ const colorXml = `<a:srgbClr val="${color}"><a:alpha val="${opacity}"/></a:srgbClr>`;
20625
+ if (shadow.type === 'preset') {
20626
+ if (!shadow.preset) return '';
20627
+ return `<a:prstShdw prst="${shadow.preset}" dist="${offset}" dir="${angle}">${colorXml}</a:prstShdw>`;
20628
+ }
20629
+ const type = shadow.type === 'inner' ? 'inner' : 'outer';
20630
+ const blur = valToPts((_shadow_blur = shadow.blur) !== null && _shadow_blur !== void 0 ? _shadow_blur : 8);
19474
20631
  const attrs = type === 'outer' ? 'sx="100000" sy="100000" kx="0" ky="0" algn="bl" rotWithShape="0"' : '';
19475
- return `<a:${type}Shdw ${attrs} blurRad="${blur}" dist="${offset}" dir="${angle}"><a:srgbClr val="${color}"><a:alpha val="${opacity}"/></a:srgbClr></a:${type}Shdw>`;
20632
+ return `<a:${type}Shdw ${attrs} blurRad="${blur}" dist="${offset}" dir="${angle}">${colorXml}</a:${type}Shdw>`;
19476
20633
  }
19477
20634
  /**
19478
20635
  * Create `a:softEdge` element
@@ -19500,22 +20657,98 @@ function genXmlLine(line) {
19500
20657
  return `<a:blur rad="${rad}"${grow}/>`;
19501
20658
  }
19502
20659
  /**
19503
- * Create the shape/image `a:effectLst` block (blur + glow + shadow + reflection + softEdge).
19504
- * Child order follows ECMA-376 `CT_EffectList`: blur, glow, innerShdw, outerShdw, reflection, softEdge.
20660
+ * Create `a:fillOverlay` (CT_FillOverlayEffect). `@blend` and a fill are both required.
20661
+ */ function genXmlFillOverlayElement(overlay) {
20662
+ if (!overlay.blend || !overlay.fill) return '';
20663
+ const fill = genXmlColorSelection(overlay.fill);
20664
+ return fill ? `<a:fillOverlay blend="${overlay.blend}">${fill}</a:fillOverlay>` : '';
20665
+ }
20666
+ /**
20667
+ * Create the shape/image effect block (blur + fillOverlay + glow + shadow + reflection + softEdge).
20668
+ * Child order follows ECMA-376 `CT_EffectList`: blur, fillOverlay, glow, innerShdw, outerShdw,
20669
+ * prstShdw, reflection, softEdge. `effectDag` replaces `effectLst` (EG_EffectProperties choice).
19505
20670
  * @note pure - unit conversion must NOT be written back to the caller's options object (issue #20)
19506
20671
  */ function genXmlEffectLst(opts) {
19507
20672
  const parts = [];
19508
20673
  if (opts.blur && typeof opts.blur.radius === 'number') parts.push(genXmlBlurElement(opts.blur));
20674
+ if (opts.fillOverlay) {
20675
+ const overlay = genXmlFillOverlayElement(opts.fillOverlay);
20676
+ if (overlay) parts.push(overlay);
20677
+ }
19509
20678
  const resolvedGlow = resolveGlowOptions(opts.glow);
19510
20679
  if (resolvedGlow) parts.push(createGlowElement(resolvedGlow));
19511
20680
  const shadow = opts.shadow;
19512
20681
  if (shadow && shadow.type !== 'none') {
19513
- parts.push(genXmlShadowElement(shadow));
20682
+ const shadowXml = genXmlShadowElement(shadow);
20683
+ if (shadowXml) parts.push(shadowXml);
19514
20684
  }
19515
20685
  if (opts.reflection) parts.push(genXmlReflectionElement(opts.reflection));
19516
20686
  if (opts.softEdge) parts.push(genXmlSoftEdgeElement(opts.softEdge));
19517
20687
  if (!parts.length) return '';
19518
- return `<a:effectLst>${parts.join('')}</a:effectLst>`;
20688
+ const xml = parts.join('');
20689
+ if (opts.effectDag) return `<a:effectDag type="${opts.effectDag.type === 'tree' ? 'tree' : 'sib'}">${xml}</a:effectDag>`;
20690
+ return `<a:effectLst>${xml}</a:effectLst>`;
20691
+ }
20692
+ /**
20693
+ * Theme style references for a shape (`p:style`).
20694
+ * CT_ShapeStyle requires all four children; an unset property references nothing (`idx="0"` / `none`).
20695
+ */ function genXmlShapeStyle(style) {
20696
+ var _style_color;
20697
+ if (!style) return '';
20698
+ let color = (_style_color = style.color) !== null && _style_color !== void 0 ? _style_color : 'accent1';
20699
+ if (color === 'phClr') {
20700
+ console.warn('[pptxgenjs] `styleRef.color` cannot be `phClr` - it is the placeholder a theme reference resolves, not a color. Using `accent1`.');
20701
+ color = 'accent1';
20702
+ }
20703
+ let fontColor = style.fontColor;
20704
+ if (fontColor === 'phClr') {
20705
+ console.warn('[pptxgenjs] `styleRef.fontColor` cannot be `phClr` - using `lt1`.');
20706
+ fontColor = undefined;
20707
+ }
20708
+ const idx = (value)=>typeof value === 'number' && isFinite(value) && value > 0 ? Math.round(value) : 0;
20709
+ const matrixColor = createColorElement(color);
20710
+ const fontColorXml = fontColor ? createColorElement(fontColor) : '<a:schemeClr val="lt1"/>';
20711
+ return '<p:style>' + `<a:lnRef idx="${idx(style.line)}">${matrixColor}</a:lnRef>` + `<a:fillRef idx="${idx(style.fill)}">${matrixColor}</a:fillRef>` + `<a:effectRef idx="${idx(style.effect)}">${matrixColor}</a:effectRef>` + `<a:fontRef idx="${style.font === 'major' || style.font === 'minor' ? style.font : 'none'}">${fontColorXml}</a:fontRef>` + '</p:style>';
20712
+ }
20713
+ /**
20714
+ * Recolor and correction effects for an image's `a:blip`.
20715
+ */ function genXmlBlipRecolor(recolor) {
20716
+ if (!recolor) return '';
20717
+ let xml = '';
20718
+ if (Array.isArray(recolor.duotone)) {
20719
+ if (recolor.duotone.length === 2) xml += `<a:duotone>${recolor.duotone.map((color)=>createColorElement(color)).join('')}</a:duotone>`;
20720
+ else console.warn(`[pptxgenjs] image \`recolor.duotone\` needs exactly two colors - ${recolor.duotone.length} given, effect omitted`);
20721
+ }
20722
+ if (recolor.grayscale === true) xml += '<a:grayscl/>';
20723
+ const bright = typeof recolor.brightness === 'number' && isFinite(recolor.brightness) ? Math.round(Math.min(100, Math.max(-100, recolor.brightness)) * 1000) : undefined;
20724
+ const contrast = typeof recolor.contrast === 'number' && isFinite(recolor.contrast) ? Math.round(Math.min(100, Math.max(-100, recolor.contrast)) * 1000) : undefined;
20725
+ if (bright !== undefined || contrast !== undefined) {
20726
+ xml += `<a:lum${bright !== undefined ? ` bright="${bright}"` : ''}${contrast !== undefined ? ` contrast="${contrast}"` : ''}/>`;
20727
+ }
20728
+ if (typeof recolor.blackWhiteThreshold === 'number' && isFinite(recolor.blackWhiteThreshold)) {
20729
+ xml += `<a:biLevel thresh="${Math.round(Math.min(100, Math.max(0, recolor.blackWhiteThreshold)) * 1000)}"/>`;
20730
+ }
20731
+ if (recolor.colorChange) {
20732
+ if (recolor.colorChange.from && recolor.colorChange.to) {
20733
+ const useA = recolor.colorChange.useAlpha === false ? ' useA="0"' : '';
20734
+ xml += `<a:clrChange${useA}><a:clrFrom>${createColorElement(recolor.colorChange.from)}</a:clrFrom><a:clrTo>${createColorElement(recolor.colorChange.to)}</a:clrTo></a:clrChange>`;
20735
+ } else {
20736
+ console.warn('[pptxgenjs] image `recolor.colorChange` needs both `from` and `to` - effect omitted');
20737
+ }
20738
+ }
20739
+ return xml;
20740
+ }
20741
+ /**
20742
+ * Alpha + recolor effects for an image's `a:blip`.
20743
+ */ function genXmlBlipEffects(transparency, alpha, recolor) {
20744
+ let xml = transparency ? `<a:alphaModFix amt="${Math.round((100 - transparency) * 1000)}"/>` : '';
20745
+ xml += genXmlBlipRecolor(recolor);
20746
+ if (!alpha) return xml;
20747
+ if (typeof alpha.replace === 'number' && isFinite(alpha.replace)) xml += `<a:alphaRepl a="${Math.round(Math.min(100, Math.max(0, alpha.replace)) * 1000)}"/>`;
20748
+ if (alpha.invert === true) xml += '<a:alphaInv/>';
20749
+ if (alpha.floor === true) xml += '<a:alphaFloor/>';
20750
+ if (alpha.ceiling === true) xml += '<a:alphaCeiling/>';
20751
+ return xml;
19519
20752
  }
19520
20753
  function findShapeCoord(list, id) {
19521
20754
  if (id == null) return undefined;
@@ -19560,7 +20793,19 @@ function findShapeCoord(list, id) {
19560
20793
  /**
19561
20794
  * When a connector references shapes with numeric inch positions + rect anchors,
19562
20795
  * compute the line's x/y/w/h and flip flags (ZentoSoft auto-layout).
19563
- */ function applyConnectorAutoLayout(line, coordinates, presLayout) {
20796
+ */ function resolveConnectorObjectNames(line, coordinates) {
20797
+ if (line._sourceName) {
20798
+ const found = coordinates.find((item)=>item.objectName === line._sourceName);
20799
+ if (found) line.sourceId = found.id;
20800
+ else console.warn(`[pptxgenjs] connector start shape "${line._sourceName}" not found - attachment omitted`);
20801
+ }
20802
+ if (line._targetName) {
20803
+ const found = coordinates.find((item)=>item.objectName === line._targetName);
20804
+ if (found) line.targetId = found.id;
20805
+ else console.warn(`[pptxgenjs] connector end shape "${line._targetName}" not found - attachment omitted`);
20806
+ }
20807
+ }
20808
+ function applyConnectorAutoLayout(line, coordinates, presLayout) {
19564
20809
  const source = findShapeCoord(coordinates, line.sourceId);
19565
20810
  const target = findShapeCoord(coordinates, line.targetId);
19566
20811
  if (!source || !target) return undefined;
@@ -19696,23 +20941,30 @@ function resolveShapeId(options, idx, usedIds) {
19696
20941
  * Throws if the named section doesn't exist, since a dangling anchor produces a repair prompt.
19697
20942
  */ function resolveZoomSections(slide, sections) {
19698
20943
  var _slide__slideObjects;
19699
- ;
19700
- ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).forEach((obj)=>{
19701
- if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom") || obj.zoomKind === 'slide' || !obj.zoomSectionTitle) return;
19702
- const sect = (sections !== null && sections !== void 0 ? sections : []).find((s)=>s.title === obj.zoomSectionTitle);
19703
- if (!sect) throw new Error(`addZoom() error: no section named "${obj.zoomSectionTitle}" — call addSection({ title }) first`);
20944
+ const resolveTitle = (title)=>{
20945
+ const sect = (sections !== null && sections !== void 0 ? sections : []).find((s)=>s.title === title);
20946
+ if (!sect) throw new Error(`addZoom() error: no section named "${title}" — call addSection({ title }) first`);
19704
20947
  if (!sect._id) sect._id = getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
19705
- obj.zoomSectionId = `{${sect._id}}`;
20948
+ return `{${sect._id}}`;
20949
+ };
20950
+ ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).forEach((obj)=>{
20951
+ if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom") || obj.zoomKind === 'slide') return;
20952
+ if (obj.zoomSectionTitle) obj.zoomSectionId = resolveTitle(obj.zoomSectionTitle);
20953
+ if (obj.zoomSectionTitles && obj.zoomSectionTitles.length > 0) {
20954
+ obj.zoomSectionIds = obj.zoomSectionTitles.map(resolveTitle);
20955
+ }
19706
20956
  });
19707
20957
  }
19708
20958
  function slideObjectToXml(slide) {
19709
- var _ref;
20959
+ var _ref, _slide__slideNum;
19710
20960
  var _slide_background, _slide_background1, _slide_background2, _slide_background_stops;
19711
20961
  let strSlideXml = slide._name ? `<p:cSld name="${encodeXmlEntities(slide._name)}">` : '<p:cSld>';
19712
20962
  let intTableNum = 1;
19713
20963
  // STEP 1: Add background color/image (ensure only a single `<p:bg>` tag is created, ex: when master-baskground has both `color` and `path`)
19714
20964
  if (slide._bkgdImgRid) {
19715
- strSlideXml += `<p:bg><p:bgPr><a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${slide._bkgdImgRid}"><a:lum/></a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>`;
20965
+ var _slide_background3;
20966
+ const bkgdEffects = genXmlBlipRecolor((_slide_background3 = slide.background) === null || _slide_background3 === void 0 ? void 0 : _slide_background3.recolor);
20967
+ strSlideXml += `<p:bg><p:bgPr><a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${slide._bkgdImgRid}">${bkgdEffects || '<a:lum/>'}</a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>`;
19716
20968
  } else if (((_slide_background = slide.background) === null || _slide_background === void 0 ? void 0 : _slide_background.color) || ((_slide_background1 = slide.background) === null || _slide_background1 === void 0 ? void 0 : _slide_background1.type) === 'gradient' && slide.background.gradient || ((_slide_background2 = slide.background) === null || _slide_background2 === void 0 ? void 0 : _slide_background2.type) === 'linearGradient' && ((_ref = (_slide_background_stops = slide.background.stops) === null || _slide_background_stops === void 0 ? void 0 : _slide_background_stops.length) !== null && _ref !== void 0 ? _ref : 0) >= 2) {
19717
20969
  // NOTE: `<a:effectLst/>` is required by PowerPoint (matches image-bg path above); omitting it triggers the repair dialog
19718
20970
  strSlideXml += `<p:bg><p:bgPr>${genXmlColorSelection(slide.background)}<a:effectLst/></p:bgPr></p:bg>`;
@@ -19730,7 +20982,7 @@ function slideObjectToXml(slide) {
19730
20982
  const shapeCoordinates = [];
19731
20983
  const renderObjectList = (objects)=>{
19732
20984
  objects.forEach((slideItemObj, idx)=>{
19733
- var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
20985
+ var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_line1, _slideItemObj_options_sizing, _slideItemObj_options2;
19734
20986
  let x = 0;
19735
20987
  let y = 0;
19736
20988
  let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
@@ -19745,6 +20997,7 @@ function slideObjectToXml(slide) {
19745
20997
  slideItemObj.options.sId = shapeId;
19746
20998
  shapeCoordinates.push({
19747
20999
  id: shapeId,
21000
+ objectName: slideItemObj.options.objectName,
19748
21001
  position: {
19749
21002
  x: slideItemObj.options.x,
19750
21003
  y: slideItemObj.options.y,
@@ -19764,7 +21017,10 @@ function slideObjectToXml(slide) {
19764
21017
  })[0];
19765
21018
  }
19766
21019
  // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19767
- const connectorLayout = ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
21020
+ if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
21021
+ resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
21022
+ }
21023
+ const connectorLayout = ((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
19768
21024
  if (connectorLayout) {
19769
21025
  x = connectorLayout.x;
19770
21026
  y = connectorLayout.y;
@@ -19824,7 +21080,7 @@ function slideObjectToXml(slide) {
19824
21080
  switch(slideItemObj._type){
19825
21081
  case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19826
21082
  {
19827
- var _slideItemObj_arrTabRows, _slide__slideNum;
21083
+ var _slideItemObj_arrTabRows, _slide__slideNum, _slideItemObj_options_objectName;
19828
21084
  arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19829
21085
  objTabOpts = slideItemObj.options;
19830
21086
  intColCnt = 0;
@@ -19837,12 +21093,13 @@ function slideObjectToXml(slide) {
19837
21093
  });
19838
21094
  // STEP 1: Start Table XML
19839
21095
  // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19840
- strXml = `<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="${intTableNum * ((_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : 0) + 1}" name="${slideItemObj.options.objectName}"/>`;
21096
+ strXml = '<p:graphicFrame><p:nvGraphicFramePr>' + genXmlCNvPr(intTableNum * ((_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : 0) + 1, String((_slideItemObj_options_objectName = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName !== void 0 ? _slideItemObj_options_objectName : ''), slideItemObj.options);
19841
21097
  // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19842
21098
  const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19843
- const tblModId = '<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"><p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1579011935"/></p:ext>';
19844
- strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19845
- typeof slideItemObj.options.modId === 'number' ? nvPrModIdExt(slideItemObj.options.modId) : tblModId
21099
+ // MS-PPTX §2.3.1.19: each p14:modId must be unique on the slide (not a constant).
21100
+ const tableModId = typeof slideItemObj.options.modId === 'number' ? slideItemObj.options.modId : TABLE_MOD_ID_BASE + idx;
21101
+ strXml += `<p:cNvGraphicFramePr>${genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock, ' noGrp="1"')}</p:cNvGraphicFramePr>` + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
21102
+ nvPrModIdExt(tableModId)
19846
21103
  ])}` + '</p:nvGraphicFramePr>';
19847
21104
  strXml += `<p:xfrm><a:off x="${x || (x === 0 ? 0 : (/* inlined export .EMU */914400))}" y="${y || (y === 0 ? 0 : (/* inlined export .EMU */914400))}"/><a:ext cx="${cx || (cx === 0 ? 0 : (/* inlined export .EMU */914400))}" cy="${cy || (/* inlined export .EMU */914400)}"/></p:xfrm>`;
19848
21105
  strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
@@ -19937,8 +21194,10 @@ function slideObjectToXml(slide) {
19937
21194
  // A: Table Height provided without rowH? Then distribute rows
19938
21195
  let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
19939
21196
  ;
19940
- if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
19941
- else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
21197
+ // `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
21198
+ const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
21199
+ const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
21200
+ if (!isNaN(rowHEmu)) intRowH = rowHEmu;
19942
21201
  else if (itemOpts.cy || itemOpts.h) {
19943
21202
  intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19944
21203
  }
@@ -20017,9 +21276,10 @@ function slideObjectToXml(slide) {
20017
21276
  * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
20018
21277
  * - We cant introduce a breaking change before v4.0, so...
20019
21278
  */ const cellMarginXml = cellMargin[0] >= 1 ? ` marL="${valToPts(cellMargin[3])}" marR="${valToPts(cellMargin[1])}" marT="${valToPts(cellMargin[0])}" marB="${valToPts(cellMargin[2])}"` : ` marL="${inch2Emu(cellMargin[3])}" marR="${inch2Emu(cellMargin[1])}" marT="${inch2Emu(cellMargin[0])}" marB="${inch2Emu(cellMargin[2])}"`;
20020
- // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
21279
+ const cellOverflow = cellOpts.horzOverflow === 'overflow' || cellOpts.horzOverflow === 'clip' ? ` horzOverflow="${cellOpts.horzOverflow}"` : '';
21280
+ const cellAnchorCtr = cellOpts.anchorCtr === true ? ' anchorCtr="1"' : '';
20021
21281
  // 4: Set CELL content and properties ==================================
20022
- strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
21282
+ strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}${cellAnchorCtr}${cellOverflow}>`;
20023
21283
  // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
20024
21284
  // FIXME: 20200525: ^^^
20025
21285
  // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
@@ -20044,18 +21304,29 @@ function slideObjectToXml(slide) {
20044
21304
  name: 'lnB'
20045
21305
  }
20046
21306
  ].forEach((obj)=>{
20047
- if (border[obj.idx].type !== 'none') {
20048
- const borderTransparency = border[obj.idx].transparency;
20049
- const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
20050
- strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
20051
- strXml += `<a:solidFill>${createColorElement(border[obj.idx].color, borderAlpha)}</a:solidFill>`;
20052
- strXml += `<a:prstDash val="${border[obj.idx].type === 'dash' ? 'sysDash' : 'solid'}"/><a:round/><a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>`;
20053
- strXml += `</a:${obj.name}>`;
20054
- } else {
20055
- strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
20056
- }
21307
+ strXml += genXmlCellBorder(obj.name, border[obj.idx]);
20057
21308
  });
20058
21309
  }
21310
+ // 5b: Diagonals follow the four edges in the CT_TableCellProperties sequence, and are
21311
+ // written only when asked for - unlike the edges, which are always emitted as a set
21312
+ if (cellOpts.borderDiagonalDown) strXml += genXmlCellBorder('lnTlToBr', cellOpts.borderDiagonalDown);
21313
+ if (cellOpts.borderDiagonalUp) strXml += genXmlCellBorder('lnBlToTr', cellOpts.borderDiagonalUp);
21314
+ // 5c: `a:cell3D` follows the diagonals and precedes the fill
21315
+ if (cellOpts.cell3D) {
21316
+ var _cell3D_bevel;
21317
+ var _cell3D_lightRig;
21318
+ const cell3D = cellOpts.cell3D;
21319
+ const bevel = (_cell3D_bevel = cell3D.bevel) !== null && _cell3D_bevel !== void 0 ? _cell3D_bevel : {};
21320
+ let bevelAttrs = '';
21321
+ if (typeof bevel.width === 'number' && isFinite(bevel.width) && bevel.width >= 0) bevelAttrs += ` w="${inch2Emu(bevel.width)}"`;
21322
+ if (typeof bevel.height === 'number' && isFinite(bevel.height) && bevel.height >= 0) bevelAttrs += ` h="${inch2Emu(bevel.height)}"`;
21323
+ if (bevel.preset) bevelAttrs += ` prst="${bevel.preset}"`;
21324
+ // `rig` and `dir` are both required on CT_LightRig, so a partial rig is dropped rather
21325
+ // than emitted as an element PowerPoint would refuse to open
21326
+ const lightRig = ((_cell3D_lightRig = cell3D.lightRig) === null || _cell3D_lightRig === void 0 ? void 0 : _cell3D_lightRig.rig) && cell3D.lightRig.dir ? `<a:lightRig rig="${cell3D.lightRig.rig}" dir="${cell3D.lightRig.dir}"/>` : '';
21327
+ // `a:bevel` is required by the schema, so it is always written
21328
+ strXml += `<a:cell3D${cell3D.material ? ` prstMaterial="${cell3D.material}"` : ''}><a:bevel${bevelAttrs}/>${lightRig}</a:cell3D>`;
21329
+ }
20059
21330
  // 6: Close cell Properties & Cell
20060
21331
  strXml += cellFill;
20061
21332
  strXml += ' </a:tcPr>';
@@ -20078,38 +21349,38 @@ function slideObjectToXml(slide) {
20078
21349
  case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
20079
21350
  case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
20080
21351
  {
20081
- var _slideItemObj_options_line1;
20082
- const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
21352
+ var _slideItemObj_options_line2, _slideItemObj_options_styleRef;
21353
+ const isConnector = !!((_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.isConnector);
20083
21354
  // Lines can have zero cy, but text should not
20084
21355
  if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
20085
21356
  // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
20086
21357
  // A: Start SHAPE / CONNECTOR ============================================
20087
21358
  if (isConnector) {
20088
- var _ref, _ref1;
20089
- var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
21359
+ var _slideItemObj_options_objectName1, _ref, _ref1;
21360
+ var _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5, _slideItemObj_options_line6;
20090
21361
  strSlideXml += '<p:cxnSp>';
20091
- strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
20092
- strSlideXml += `<p:cNvCxnSpPr><a:stCxn id="${(_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.sourceId}" idx="${(_ref = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/><a:endCxn id="${(_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId}" idx="${(_ref1 = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/></p:cNvCxnSpPr>`;
21362
+ strSlideXml += `<p:nvCxnSpPr>${genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName1 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName1 !== void 0 ? _slideItemObj_options_objectName1 : ''), slideItemObj.options)}`;
21363
+ const cxnLocks = genXmlLocks('a:cxnSpLocks', slideItemObj.options.lock);
21364
+ const stId = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceId;
21365
+ const endId = (_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId;
21366
+ strSlideXml += `<p:cNvCxnSpPr>${cxnLocks}`;
21367
+ if (stId != null) strSlideXml += `<a:stCxn id="${stId}" idx="${(_ref = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/>`;
21368
+ if (endId != null) strSlideXml += `<a:endCxn id="${endId}" idx="${(_ref1 = (_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : _slideItemObj_options_line6.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/>`;
21369
+ strSlideXml += '</p:cNvCxnSpPr>';
20093
21370
  strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
20094
21371
  nvPrModIdExt(slideItemObj.options.modId)
20095
21372
  ])}</p:nvCxnSpPr><p:spPr>`;
20096
21373
  } else {
20097
- var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
21374
+ var _slideItemObj_options_objectName2;
21375
+ var _slideItemObj_options3;
20098
21376
  strSlideXml += '<p:sp>';
20099
21377
  // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
20100
- strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
20101
- // <Hyperlink>
20102
- if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
20103
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
20104
- }
20105
- if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
20106
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20107
- }
20108
- // </Hyperlink>
20109
- strSlideXml += '</p:cNvPr>';
21378
+ strSlideXml += '<p:nvSpPr>' + genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName2 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName2 !== void 0 ? _slideItemObj_options_objectName2 : ''), slideItemObj.options, '', genXmlCNvPrLinks(slideItemObj.options.hyperlink, slideItemObj.options.hyperlinkHover));
20110
21379
  // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
20111
21380
  const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
20112
- strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
21381
+ strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
21382
+ isTextBox: useTxBox
21383
+ }));
20113
21384
  strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20114
21385
  nvPrModIdExt(slideItemObj.options.modId)
20115
21386
  ]);
@@ -20121,7 +21392,7 @@ function slideObjectToXml(slide) {
20121
21392
  if (!isConnector && slideItemObj.shape === 'custGeom') {
20122
21393
  strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
20123
21394
  } else {
20124
- var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
21395
+ var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
20125
21396
  strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
20126
21397
  // `rectRadius: 0` is a valid sharp-corner adj (ECMA-376 §5.1.11 preset geom `gd name="adj"`).
20127
21398
  if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
@@ -20135,7 +21406,7 @@ function slideObjectToXml(slide) {
20135
21406
  strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
20136
21407
  }
20137
21408
  }
20138
- if (isConnector && ((_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line6.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
21409
+ if (isConnector && ((_slideItemObj_options_line7 = slideItemObj.options.line) === null || _slideItemObj_options_line7 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line7.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
20139
21410
  slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
20140
21411
  strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20141
21412
  });
@@ -20143,20 +21414,26 @@ function slideObjectToXml(slide) {
20143
21414
  strSlideXml += '</a:avLst></a:prstGeom>';
20144
21415
  }
20145
21416
  // Option: FILL
20146
- strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
21417
+ // With a fillRef and no explicit fill, omit the fill element so the theme inherits
21418
+ if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
21419
+ else if (!((_slideItemObj_options_styleRef = slideItemObj.options.styleRef) === null || _slideItemObj_options_styleRef === void 0 ? void 0 : _slideItemObj_options_styleRef.fill)) strSlideXml += '<a:noFill/>';
20147
21420
  // shape Type: LINE: line color
20148
21421
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20149
- // EFFECTS: shadow / glow / softEdge / reflection
21422
+ // EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
20150
21423
  // REF: @see http://officeopenxml.com/drwSp-effects.php
20151
21424
  strSlideXml += genXmlEffectLst({
20152
21425
  shadow: slideItemObj.options.shadow,
20153
21426
  glow: slideItemObj.options.glow,
20154
21427
  softEdge: slideItemObj.options.softEdge,
20155
21428
  reflection: slideItemObj.options.reflection,
20156
- blur: slideItemObj.options.blur
21429
+ blur: slideItemObj.options.blur,
21430
+ fillOverlay: slideItemObj.options.fillOverlay,
21431
+ effectDag: slideItemObj.options.effectDag
20157
21432
  });
20158
21433
  // B: Close shape Properties
20159
21434
  strSlideXml += '</p:spPr>';
21435
+ // `p:style` follows `p:spPr` in CT_Shape / CT_Connector
21436
+ strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
20160
21437
  if (isConnector) {
20161
21438
  // Connectors have no text body
20162
21439
  strSlideXml += '</p:cxnSp>';
@@ -20169,18 +21446,13 @@ function slideObjectToXml(slide) {
20169
21446
  break;
20170
21447
  }
20171
21448
  case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
20172
- var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
21449
+ var _slideItemObj_options_objectName3;
21450
+ var _slideItemObj_options_lock;
20173
21451
  strSlideXml += '<p:pic>';
20174
21452
  strSlideXml += ' <p:nvPicPr>';
20175
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
20176
- if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
20177
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
20178
- }
20179
- if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
20180
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20181
- }
20182
- strSlideXml += ' </p:cNvPr>';
20183
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
21453
+ strSlideXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName3 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName3 !== void 0 ? _slideItemObj_options_objectName3 : ''), slideItemObj.options, slideItemObj.options.altText || slideItemObj.image, genXmlCNvPrLinks(slideItemObj.hyperlink, slideItemObj.hyperlinkHover));
21454
+ // `noChangeAspect` has always been emitted here; caller locks are added to it
21455
+ strSlideXml += ` <p:cNvPicPr${((_slideItemObj_options_lock = slideItemObj.options.lock) === null || _slideItemObj_options_lock === void 0 ? void 0 : _slideItemObj_options_lock.preferRelativeResize) === true ? ' preferRelativeResize="1"' : ''}>${genXmlLocks('a:picLocks', slideItemObj.options.lock, ' noChangeAspect="1"')}</p:cNvPicPr>`;
20184
21456
  strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20185
21457
  nvPrModIdExt(slideItemObj.options.modId)
20186
21458
  ]);
@@ -20190,7 +21462,7 @@ function slideObjectToXml(slide) {
20190
21462
  if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
20191
21463
  var _slideItemObj_imageRid;
20192
21464
  strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
20193
- strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
21465
+ strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
20194
21466
  strSlideXml += ' <a:extLst>';
20195
21467
  strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
20196
21468
  strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
@@ -20199,7 +21471,7 @@ function slideObjectToXml(slide) {
20199
21471
  strSlideXml += '</a:blip>';
20200
21472
  } else {
20201
21473
  strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
20202
- strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
21474
+ strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
20203
21475
  strSlideXml += '</a:blip>';
20204
21476
  }
20205
21477
  if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
@@ -20259,26 +21531,53 @@ function slideObjectToXml(slide) {
20259
21531
  }
20260
21532
  // OUTLINE: picture border/frame (issue #35)
20261
21533
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20262
- // EFFECTS: shadow / glow / softEdge / reflection
21534
+ // EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
20263
21535
  strSlideXml += genXmlEffectLst({
20264
21536
  shadow: slideItemObj.options.shadow,
20265
21537
  glow: slideItemObj.options.glow,
20266
21538
  softEdge: slideItemObj.options.softEdge,
20267
21539
  reflection: slideItemObj.options.reflection,
20268
- blur: slideItemObj.options.blur
21540
+ blur: slideItemObj.options.blur,
21541
+ fillOverlay: slideItemObj.options.fillOverlay,
21542
+ effectDag: slideItemObj.options.effectDag
20269
21543
  });
20270
21544
  strSlideXml += '</p:spPr>';
21545
+ strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
20271
21546
  strSlideXml += '</p:pic>';
20272
21547
  break;
20273
21548
  case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
20274
- if (slideItemObj.mtype === 'online') {
21549
+ if (slideItemObj.mtype === 'audioCd' || slideItemObj.mtype === 'wav') {
21550
+ var _slideItemObj__coverRid;
21551
+ // EG_Media is a choice, so these carry exactly one media element and no `p14:media`:
21552
+ // `a:audioCd` references the listener's drive and `a:wavAudioFile` is the legacy
21553
+ // embedded-WAV element, so neither has an embedded media part to point at
21554
+ const coverRid = (_slideItemObj__coverRid = slideItemObj._coverRid) !== null && _slideItemObj__coverRid !== void 0 ? _slideItemObj__coverRid : 2;
21555
+ strSlideXml += '<p:pic>';
21556
+ strSlideXml += ' <p:nvPicPr>';
21557
+ strSlideXml += `<p:cNvPr id="${coverRid}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
21558
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
21559
+ if (slideItemObj.mtype === 'audioCd') {
21560
+ const cd = slideItemObj.options.audioCd;
21561
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:audioCd>${genXmlAudioCdTime('a:st', cd === null || cd === void 0 ? void 0 : cd.start)}${genXmlAudioCdTime('a:end', cd === null || cd === void 0 ? void 0 : cd.end)}</a:audioCd>`);
21562
+ } else {
21563
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
21564
+ }
21565
+ strSlideXml += ' </p:nvPicPr>';
21566
+ strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
21567
+ strSlideXml += ' <p:spPr>';
21568
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
21569
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
21570
+ strSlideXml += ' </p:spPr>';
21571
+ strSlideXml += '</p:pic>';
21572
+ } else if (slideItemObj.mtype === 'online') {
20275
21573
  var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
21574
+ const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
20276
21575
  strSlideXml += '<p:pic>';
20277
21576
  strSlideXml += ' <p:nvPicPr>';
20278
21577
  // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
20279
21578
  strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
20280
21579
  strSlideXml += ' <p:cNvPicPr/>';
20281
- strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
21580
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
20282
21581
  strSlideXml += ' </p:nvPicPr>';
20283
21582
  // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
20284
21583
  strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid1 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid1 !== void 0 ? _slideItemObj_mediaRid1 : 0) + 1}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
@@ -20291,6 +21590,7 @@ function slideObjectToXml(slide) {
20291
21590
  var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
20292
21591
  // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
20293
21592
  const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
21593
+ const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
20294
21594
  strSlideXml += '<p:pic>';
20295
21595
  strSlideXml += ' <p:nvPicPr>';
20296
21596
  // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
@@ -20299,7 +21599,7 @@ function slideObjectToXml(slide) {
20299
21599
  const mediaExtras = genXmlMediaExtras(slideItemObj.options);
20300
21600
  const mediaExt = '<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">' + (mediaExtras ? ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid3 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid3 !== void 0 ? _slideItemObj_mediaRid3 : 0) + 1}">${mediaExtras} </p14:media>` : ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid4 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid4 !== void 0 ? _slideItemObj_mediaRid4 : 0) + 1}"/>`) + '</p:ext>';
20301
21601
  const narrationExt = slideItemObj.options.isNarration ? '<p:ext uri="{42D2F446-02D8-4167-A562-619A0277C38B}"><p15:isNarration xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>' : '';
20302
- strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
21602
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
20303
21603
  mediaExt,
20304
21604
  narrationExt
20305
21605
  ] : [
@@ -20343,12 +21643,14 @@ function slideObjectToXml(slide) {
20343
21643
  } else if (zKind === 'section') {
20344
21644
  strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
20345
21645
  } else {
21646
+ var _slideItemObj_zoomSectionIds;
20346
21647
  // §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
20347
21648
  const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
20348
21649
  const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
20349
21650
  const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
20350
21651
  const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
20351
- strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj><p16:gridLayout/></p16:summaryZm>`;
21652
+ const extraZm = ((_slideItemObj_zoomSectionIds = slideItemObj.zoomSectionIds) !== null && _slideItemObj_zoomSectionIds !== void 0 ? _slideItemObj_zoomSectionIds : []).map((id)=>`<p16:summaryZmObj sectionId="${id}">${zmPr}</p16:summaryZmObj>`).join('');
21653
+ strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj>${extraZm}<p16:gridLayout/></p16:summaryZm>`;
20352
21654
  }
20353
21655
  strSlideXml += '</mc:Choice>';
20354
21656
  // Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
@@ -20404,41 +21706,64 @@ function slideObjectToXml(slide) {
20404
21706
  break;
20405
21707
  }
20406
21708
  case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
20407
- strSlideXml += '<p:graphicFrame>';
20408
- strSlideXml += ' <p:nvGraphicFramePr>';
20409
- strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
20410
- strSlideXml += ' <p:cNvGraphicFramePr/>';
20411
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20412
- nvPrModIdExt(slideItemObj.options.modId)
20413
- ]);
20414
- strSlideXml += ' </p:nvGraphicFramePr>';
20415
- strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
20416
- strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
20417
- strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
20418
- strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
20419
- strSlideXml += ' </a:graphicData>';
20420
- strSlideXml += ' </a:graphic>';
20421
- strSlideXml += '</p:graphicFrame>';
20422
- break;
21709
+ {
21710
+ var _slideItemObj_options_objectName4;
21711
+ var _slideItemObj_options4;
21712
+ const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
21713
+ const isChartex = isChartexType(chartType);
21714
+ const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
21715
+ const chartRef = isChartex ? `<cx:chart xmlns:cx="${OOXML_CHARTEX.ns}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId${slideItemObj.chartRid}"/>` : `<c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
21716
+ const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
21717
+ let frameXml = '<p:graphicFrame>';
21718
+ frameXml += ' <p:nvGraphicFramePr>';
21719
+ frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
21720
+ frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
21721
+ frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
21722
+ nvPrModIdExt(slideItemObj.options.modId)
21723
+ ]);
21724
+ frameXml += ' </p:nvGraphicFramePr>';
21725
+ frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
21726
+ frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
21727
+ frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
21728
+ frameXml += ` ${chartRef}`;
21729
+ frameXml += ' </a:graphicData>';
21730
+ frameXml += ' </a:graphic>';
21731
+ frameXml += '</p:graphicFrame>';
21732
+ // A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
21733
+ // through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
21734
+ // cannot be produced here - a locked text shape carrying the same message is the honest
21735
+ // equivalent for a consumer that does not understand the chartex namespace.
21736
+ strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
21737
+ x,
21738
+ y,
21739
+ cx,
21740
+ cy
21741
+ })}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
21742
+ break;
21743
+ }
20423
21744
  case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
20424
21745
  {
20425
21746
  var _slideItemObj__objects;
20426
21747
  // PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
20427
21748
  // Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
20428
21749
  strSlideXml += '<p:grpSp>';
20429
- strSlideXml += `<p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${encodeXmlEntities(slideItemObj.options.objectName || `Group ${shapeId}`)}"/>`;
20430
- strSlideXml += '<p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>';
21750
+ strSlideXml += `<p:nvGrpSpPr>${genXmlCNvPr(shapeId, slideItemObj.options.objectName || `Group ${shapeId}`, slideItemObj.options)}`;
21751
+ const grpLocks = genXmlLocks('a:grpSpLocks', slideItemObj.options.lock);
21752
+ strSlideXml += (grpLocks ? `<p:cNvGrpSpPr>${grpLocks}</p:cNvGrpSpPr>` : '<p:cNvGrpSpPr/>') + `${genXmlNvPr(slideItemObj.options)}</p:nvGrpSpPr>`;
20431
21753
  strSlideXml += '<p:grpSpPr>';
20432
21754
  strSlideXml += `<a:xfrm${locationAttr}>`;
20433
21755
  strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
20434
21756
  strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
20435
21757
  strSlideXml += '</a:xfrm>';
21758
+ if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
20436
21759
  strSlideXml += genXmlEffectLst({
20437
21760
  shadow: slideItemObj.options.shadow,
20438
21761
  glow: slideItemObj.options.glow,
20439
21762
  softEdge: slideItemObj.options.softEdge,
20440
21763
  reflection: slideItemObj.options.reflection,
20441
- blur: slideItemObj.options.blur
21764
+ blur: slideItemObj.options.blur,
21765
+ fillOverlay: slideItemObj.options.fillOverlay,
21766
+ effectDag: slideItemObj.options.effectDag
20442
21767
  });
20443
21768
  strSlideXml += '</p:grpSpPr>';
20444
21769
  renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
@@ -20502,7 +21827,7 @@ function slideObjectToXml(slide) {
20502
21827
  }
20503
21828
  // STEP 5: Close spTree and finalize slide XML
20504
21829
  strSlideXml += '</p:spTree>';
20505
- strSlideXml += genXmlCreationIdExt('creationId' in slide ? slide.creationId : undefined);
21830
+ strSlideXml += genXmlCreationIdExt('creationId' in slide ? slide.creationId : undefined, (_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : undefined);
20506
21831
  strSlideXml += '</p:cSld>';
20507
21832
  // LAST: Return
20508
21833
  return strSlideXml;
@@ -20546,6 +21871,20 @@ function package_object_spread(target) {
20546
21871
 
20547
21872
 
20548
21873
 
21874
+
21875
+ /**
21876
+ * Content-type overrides a chart needs: the chart itself plus, when requested, its style and colour-style parts.
21877
+ * - one helper because charts appear on slides, layouts and the master, and a part with no declared
21878
+ * content type is a repair-dialog cause
21879
+ */ function chartContentTypes(rel) {
21880
+ const partContentType = isChartexType(rel.opts._type) ? OOXML_CHARTEX.partContentType : 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml';
21881
+ let xml = `<Override PartName="${rel.Target}" ContentType="${partContentType}"/>`;
21882
+ if (wantsChartStyleParts(rel.opts)) {
21883
+ xml += `<Override PartName="/${chartColorsPartName(rel.globalId)}" ContentType="${CHART_STYLE.colorsContentType}"/>`;
21884
+ xml += `<Override PartName="/${chartStylePartName(rel.globalId)}" ContentType="${CHART_STYLE.styleContentType}"/>`;
21885
+ }
21886
+ return xml;
21887
+ }
20549
21888
  /** MS-PPTX §2.2.6 showPr browseMode */ const URI_BROWSE_MODE = '{F99C55AA-B7CB-42B0-86F8-08522FDF87E8}';
20550
21889
  /** MS-PPTX §2.2.6 showPr laserClr */ const URI_LASER_CLR = '{EC167BDD-8182-4AB7-AECC-EB403E3ABB37}';
20551
21890
  /** MS-PPTX §2.2.6 sld laserTraceLst */ const URI_LASER_TRACE_LST = '{3A86A75C-4F4B-4683-9AE1-C65F6400EC91}';
@@ -20611,7 +21950,7 @@ function slideShowExtLst(slide) {
20611
21950
  strXml += '<Default Extension="mp4" ContentType="video/mp4"/>'; // NOTE: Hard-Code this extension as it wont be created in loop below (as extn !== type)
20612
21951
  slides.forEach((slide)=>{
20613
21952
  (slide._relsMedia || []).forEach((rel)=>{
20614
- if (rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
21953
+ if (!rel.isLinked && rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
20615
21954
  strXml += '<Default Extension="' + rel.extn + '" ContentType="' + rel.type + '"/>';
20616
21955
  }
20617
21956
  });
@@ -20632,7 +21971,7 @@ function slideShowExtLst(slide) {
20632
21971
  strXml += `<Override PartName="/ppt/slides/slide${idx + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`;
20633
21972
  // Add charts if any
20634
21973
  slide._relsChart.forEach((rel)=>{
20635
- strXml += `<Override PartName="${rel.Target}" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`;
21974
+ strXml += chartContentTypes(rel);
20636
21975
  });
20637
21976
  });
20638
21977
  // STEP 3: Core PPT
@@ -20645,7 +21984,7 @@ function slideShowExtLst(slide) {
20645
21984
  slideLayouts.forEach((layout, idx)=>{
20646
21985
  strXml += `<Override PartName="/ppt/slideLayouts/slideLayout${idx + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
20647
21986
  (layout._relsChart || []).forEach((rel)=>{
20648
- strXml += ' <Override PartName="' + rel.Target + '" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>';
21987
+ strXml += chartContentTypes(rel);
20649
21988
  });
20650
21989
  });
20651
21990
  // STEP 5: Add notes slide(s)
@@ -20674,10 +22013,10 @@ function slideShowExtLst(slide) {
20674
22013
  if (tracking === null || tracking === void 0 ? void 0 : tracking.revisionInfo) strXml += `<Override PartName="/ppt/revisionInfo.xml" ContentType="${REVISION_INFO_CONTENT_TYPE}"/>`;
20675
22014
  if (tracking === null || tracking === void 0 ? void 0 : tracking.changesInfo) strXml += `<Override PartName="/ppt/changesInfo.xml" ContentType="${CHANGES_INFO_CONTENT_TYPE}"/>`;
20676
22015
  ((_ref = masterSlide === null || masterSlide === void 0 ? void 0 : masterSlide._relsChart) !== null && _ref !== void 0 ? _ref : []).forEach((rel)=>{
20677
- strXml += ' <Override PartName="' + rel.Target + '" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>';
22016
+ strXml += chartContentTypes(rel);
20678
22017
  });
20679
22018
  ((_ref1 = masterSlide === null || masterSlide === void 0 ? void 0 : masterSlide._relsMedia) !== null && _ref1 !== void 0 ? _ref1 : []).forEach((rel)=>{
20680
- if (rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
22019
+ if (!rel.isLinked && rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
20681
22020
  strXml += ' <Default Extension="' + rel.extn + '" ContentType="' + rel.type + '"/>';
20682
22021
  }
20683
22022
  });
@@ -20697,22 +22036,46 @@ function slideShowExtLst(slide) {
20697
22036
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
20698
22037
  </Relationships>`;
20699
22038
  }
22039
+ /**
22040
+ * Count text paragraphs across the deck for `app.xml`
22041
+ * - derived rather than exposed: the value is a fact about the deck, not a caller preference
22042
+ * @param {PresSlide[]} slides - presentation slides
22043
+ * @returns {number} paragraph count
22044
+ */ function countParagraphs(slides) {
22045
+ return slides.reduce((total, slide)=>{
22046
+ var _slide__slideObjects;
22047
+ return total + ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).reduce((count, obj)=>{
22048
+ var _obj_text;
22049
+ if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.text */"text") && obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder")) return count;
22050
+ return count + Math.max(1, ((_obj_text = obj.text) !== null && _obj_text !== void 0 ? _obj_text : []).length);
22051
+ }, 0);
22052
+ }, 0);
22053
+ }
20700
22054
  /**
20701
22055
  * Creates `docProps/app.xml`
20702
22056
  * @param {PresSlide[]} slides - Presenation Slides
20703
22057
  * @param {string} company - "Company" metadata
22058
+ * @param {DocumentProps} [props] - optional extended properties
20704
22059
  * @returns XML
20705
- */ function makeXmlApp(slides, company) {
22060
+ */ function makeXmlApp(slides, company, props) {
20706
22061
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
20707
- <TotalTime>0</TotalTime>
22062
+ ${(props === null || props === void 0 ? void 0 : props.template) ? `<Template>${encodeXmlEntities(props.template)}</Template>` : ''}
22063
+ ${(props === null || props === void 0 ? void 0 : props.manager) ? `<Manager>${encodeXmlEntities(props.manager)}</Manager>` : ''}
22064
+ <TotalTime>${typeof (props === null || props === void 0 ? void 0 : props.totalEditTime) === 'number' && isFinite(props.totalEditTime) && props.totalEditTime >= 0 ? Math.round(props.totalEditTime) : 0}</TotalTime>
20708
22065
  <Words>0</Words>
20709
22066
  <Application>Microsoft Office PowerPoint</Application>
20710
22067
  <PresentationFormat>On-screen Show (16:9)</PresentationFormat>
20711
- <Paragraphs>0</Paragraphs>
22068
+ <Paragraphs>${countParagraphs(slides)}</Paragraphs>
20712
22069
  <Slides>${slides.length}</Slides>
20713
- <Notes>${slides.length}</Notes>
20714
- <HiddenSlides>0</HiddenSlides>
20715
- <MMClips>0</MMClips>
22070
+ <Notes>${slides.filter((slide)=>{
22071
+ var _slide__slideObjects;
22072
+ return ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).some((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes"));
22073
+ }).length}</Notes>
22074
+ <HiddenSlides>${slides.filter((slide)=>slide.hidden).length}</HiddenSlides>
22075
+ <MMClips>${slides.reduce((sum, slide)=>{
22076
+ var _slide__slideObjects;
22077
+ return sum + ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.media */"media")).length;
22078
+ }, 0)}</MMClips>
20716
22079
  <ScaleCrop>false</ScaleCrop>
20717
22080
  <HeadingPairs>
20718
22081
  <vt:vector size="6" baseType="variant">
@@ -20735,6 +22098,7 @@ function slideShowExtLst(slide) {
20735
22098
  <Company>${encodeXmlEntities(company)}</Company>
20736
22099
  <LinksUpToDate>false</LinksUpToDate>
20737
22100
  <SharedDoc>false</SharedDoc>
22101
+ ${(props === null || props === void 0 ? void 0 : props.hyperlinkBase) ? `<HyperlinkBase>${encodeXmlEntities(props.hyperlinkBase)}</HyperlinkBase>` : ''}
20738
22102
  <HyperlinksChanged>false</HyperlinksChanged>
20739
22103
  <AppVersion>16.0000</AppVersion>
20740
22104
  </Properties>`;
@@ -20747,14 +22111,23 @@ function slideShowExtLst(slide) {
20747
22111
  * @param {string} revision - metadata value
20748
22112
  * @param {Date} [created] - OPC `dcterms:created` (defaults to now)
20749
22113
  * @param {Date} [modified] - OPC `dcterms:modified` (defaults to now)
22114
+ * @param {DocumentProps} [props] - optional extra core properties
20750
22115
  * @returns XML
20751
- */ function makeXmlCore(title, subject, author, revision, created, modified) {
22116
+ */ function makeXmlCore(title, subject, author, revision, created, modified, props) {
20752
22117
  const createdAt = (created !== null && created !== void 0 ? created : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20753
22118
  const modifiedAt = (modified !== null && modified !== void 0 ? modified : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20754
22119
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20755
22120
  <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20756
22121
  <dc:title>${encodeXmlEntities(title)}</dc:title>
20757
22122
  <dc:subject>${encodeXmlEntities(subject)}</dc:subject>
22123
+ ${(props === null || props === void 0 ? void 0 : props.description) ? `<dc:description>${encodeXmlEntities(props.description)}</dc:description>` : ''}
22124
+ ${(props === null || props === void 0 ? void 0 : props.keywords) ? `<cp:keywords>${encodeXmlEntities(props.keywords)}</cp:keywords>` : ''}
22125
+ ${(props === null || props === void 0 ? void 0 : props.category) ? `<cp:category>${encodeXmlEntities(props.category)}</cp:category>` : ''}
22126
+ ${(props === null || props === void 0 ? void 0 : props.contentStatus) ? `<cp:contentStatus>${encodeXmlEntities(props.contentStatus)}</cp:contentStatus>` : ''}
22127
+ ${(props === null || props === void 0 ? void 0 : props.version) ? `<cp:version>${encodeXmlEntities(props.version)}</cp:version>` : ''}
22128
+ ${(props === null || props === void 0 ? void 0 : props.language) ? `<dc:language>${encodeXmlEntities(props.language)}</dc:language>` : ''}
22129
+ ${(props === null || props === void 0 ? void 0 : props.identifier) ? `<dc:identifier>${encodeXmlEntities(props.identifier)}</dc:identifier>` : ''}
22130
+ ${(props === null || props === void 0 ? void 0 : props.lastPrinted) ? `<cp:lastPrinted>${encodeXmlEntities(props.lastPrinted)}</cp:lastPrinted>` : ''}
20758
22131
  <dc:creator>${encodeXmlEntities(author)}</dc:creator>
20759
22132
  <cp:lastModifiedBy>${encodeXmlEntities(author)}</cp:lastModifiedBy>
20760
22133
  <cp:revision>${revision}</cp:revision>
@@ -20803,7 +22176,7 @@ function slideShowExtLst(slide) {
20803
22176
  const entries = [];
20804
22177
  ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).forEach((obj)=>{
20805
22178
  var _obj_mediaRid;
20806
- if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") || obj.mtype === 'online') return;
22179
+ if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") || obj.mtype !== 'audio' && obj.mtype !== 'video') return;
20807
22180
  const o = obj.options;
20808
22181
  // Defaults are all false: no timing node unless at least one playback flag is set.
20809
22182
  if (!o || !(o.autoplay || o.loop || o.fullScreen || o.mute)) return;
@@ -20938,10 +22311,29 @@ function collectSlideAnimations(slide) {
20938
22311
  * @param {SlideLayout} layout - slide layout (master)
20939
22312
  * @return {string} XML
20940
22313
  */ function makeXmlLayout(layout) {
22314
+ // `preserve` has always been written as "1", so it stays on unless the caller turns it off
22315
+ let attrs = layout.preserve === false ? '' : ' preserve="1"';
22316
+ if (layout.layoutType) attrs += ` type="${layout.layoutType}"`;
22317
+ if (layout.matchingName) attrs += ` matchingName="${encodeXmlEntities(layout.matchingName)}"`;
22318
+ // both default to true in the schema, so only the "off" case is written
22319
+ if (layout.showMasterShapes === false) attrs += ' showMasterSp="0"';
22320
+ if (layout.showMasterPlaceholderAnimation === false) attrs += ' showMasterPhAnim="0"';
22321
+ if (layout.userDrawn === true) attrs += ' userDrawn="1"';
22322
+ // CT_ColorMapping requires all twelve attributes, so a partial override is filled from the
22323
+ // identity map - which is exactly what inheriting `a:masterClrMapping` means
22324
+ const clrMapOvr = layout.colorMapOverride ? `<p:clrMapOvr><a:overrideClrMapping${Object.entries(DEF_COLOR_MAP).map(([slot, fallback])=>{
22325
+ var _ref;
22326
+ var _layout_colorMapOverride;
22327
+ return ` ${slot}="${(_ref = (_layout_colorMapOverride = layout.colorMapOverride) === null || _layout_colorMapOverride === void 0 ? void 0 : _layout_colorMapOverride[slot]) !== null && _ref !== void 0 ? _ref : fallback}"`;
22328
+ }).join('')}/></p:clrMapOvr>` : '<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>';
22329
+ const transitionXml = genXmlTransition(layout);
22330
+ const hasP14 = transitionXml.includes('p14:') || transitionXml.includes('xmlns:p14');
22331
+ const ns = hasP14 ? ` xmlns:p14="${P14_NS}"` : '';
22332
+ // CT_SlideLayout sequence: cSld, clrMapOvr, transition, timing, hf, extLst
20941
22333
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20942
- <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" preserve="1">
22334
+ <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"${ns}${attrs}>
20943
22335
  ${slideObjectToXml(layout)}
20944
- <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`;
22336
+ ${clrMapOvr}${transitionXml}</p:sldLayout>`;
20945
22337
  }
20946
22338
  /**
20947
22339
  * Creates Slide Master 1 (`ppt/slideMasters/slideMaster1.xml`)
@@ -21012,6 +22404,7 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21012
22404
  * @param {IPresentationProps} pres - presentation
21013
22405
  * @return {string} XML
21014
22406
  */ function makeXmlPresentation(pres) {
22407
+ var _pres_kinsoku;
21015
22408
  let strXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" ' + `xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" firstSlideNum="${pres.firstSlideNum}" ${pres.rtlMode ? 'rtl="1"' : ''} saveSubsetFonts="1" autoCompressPictures="0">`;
21016
22409
  // STEP 1: Add slide master (SPEC: tag 1 under <presentation>)
21017
22410
  strXml += '<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>';
@@ -21035,8 +22428,26 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21035
22428
  // Presentations open without warning without this line, but then they aren't previewed in Finder or viewable on iOS.
21036
22429
  strXml += `<p:notesMasterIdLst><p:notesMasterId r:id="rId${pres.slides.length + 2}"/></p:notesMasterIdLst>`;
21037
22430
  // STEP 4: Add sizes
21038
- strXml += `<p:sldSz cx="${pres.presLayout.width}" cy="${pres.presLayout.height}"/>`;
22431
+ // `@type` records which preset the dimensions match; omitted when the caller does not say
22432
+ strXml += `<p:sldSz cx="${pres.presLayout.width}" cy="${pres.presLayout.height}"${pres.slideSizeType ? ` type="${pres.slideSizeType}"` : ''}/>`;
21039
22433
  strXml += `<p:notesSz cx="${pres.presLayout.height}" cy="${pres.presLayout.width}"/>`;
22434
+ // CT_Presentation sequence puts these between `notesSz` and `defaultTextStyle` (photoAlbum, kinsoku)
22435
+ if (pres.photoAlbum) {
22436
+ const album = pres.photoAlbum;
22437
+ let attrs = '';
22438
+ if (album.blackWhite === true) attrs += ' bw="1"';
22439
+ if (album.showCaptions === true) attrs += ' showCaptions="1"';
22440
+ if (album.layout) attrs += ` layout="${album.layout}"`;
22441
+ if (album.frame) attrs += ` frame="${album.frame}"`;
22442
+ strXml += `<p:photoAlbum${attrs}/>`;
22443
+ }
22444
+ // `invalStChars` and `invalEndChars` are required on CT_Kinsoku, so a partial value is dropped
22445
+ // rather than emitted as an element PowerPoint would refuse to open
22446
+ if (((_pres_kinsoku = pres.kinsoku) === null || _pres_kinsoku === void 0 ? void 0 : _pres_kinsoku.invalidStartChars) && pres.kinsoku.invalidEndChars) {
22447
+ const kin = pres.kinsoku;
22448
+ const lang = kin.lang ? ` lang="${encodeXmlEntities(kin.lang)}"` : '';
22449
+ strXml += `<p:kinsoku${lang} invalStChars="${encodeXmlEntities(kin.invalidStartChars)}" invalEndChars="${encodeXmlEntities(kin.invalidEndChars)}"/>`;
22450
+ }
21040
22451
  // STEP 5: Add text styles
21041
22452
  strXml += '<p:defaultTextStyle>';
21042
22453
  for(let idy = 1; idy < 10; idy++){
@@ -21076,32 +22487,214 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21076
22487
  * Create `ppt/presProps.xml`
21077
22488
  * @return {string} XML
21078
22489
  */ function makeXmlPresProps(pres) {
21079
- // MS-PPTX §2.2.6 showPr (browseMode / laserClr) and §2.2.7/§2.2.16/§2.2.12
21080
- // presentationPr extLst. Opt-in: emit an ext only when the property is set.
22490
+ // CT_PresentationProperties sequence: htmlPubPr, webPr, prnPr, showPr, clrMru, extLst.
22491
+ // Opt-in: emit nothing extra unless set. prnPr/clrMru live here (not on CT_Presentation).
22492
+ const prnPr = makeXmlPrnPr(pres);
22493
+ const showPr = makeXmlShowPr(pres);
22494
+ const clrMru = makeXmlClrMru(pres);
22495
+ const extLst = makeXmlPresPropsExtLst(pres);
22496
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentationPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">' + `${prnPr}${showPr}${clrMru}${extLst}</p:presentationPr>`;
22497
+ }
22498
+ function makeXmlPrnPr(pres) {
22499
+ if (!(pres === null || pres === void 0 ? void 0 : pres.printProps)) return '';
22500
+ const prn = pres.printProps;
22501
+ let attrs = '';
22502
+ if (prn.what) attrs += ` prnWhat="${prn.what}"`;
22503
+ if (prn.colorMode) attrs += ` clrMode="${prn.colorMode}"`;
22504
+ if (prn.hiddenSlides === true) attrs += ' hiddenSlides="1"';
22505
+ if (prn.scaleToFitPaper === true) attrs += ' scaleToFitPaper="1"';
22506
+ if (prn.frameSlides === true) attrs += ' frameSlides="1"';
22507
+ return `<p:prnPr${attrs}/>`;
22508
+ }
22509
+ function makeXmlClrMru(pres) {
22510
+ if (!Array.isArray(pres === null || pres === void 0 ? void 0 : pres.recentColors) || pres.recentColors.length === 0) return '';
22511
+ return `<p:clrMru>${pres.recentColors.map((color)=>createColorElement(color)).join('')}</p:clrMru>`;
22512
+ }
22513
+ /**
22514
+ * `p:showPr` for slide-show options, or '' when none are set.
22515
+ * ECMA-376 §19.2.1.30 requires a present/browse/kiosk choice whenever `showPr` is written.
22516
+ */ function makeXmlShowPr(pres) {
22517
+ var _ref, _show_browseMode, _show_laserColor, _show_mode;
22518
+ const show = (_ref = pres === null || pres === void 0 ? void 0 : pres.slideShow) !== null && _ref !== void 0 ? _ref : {};
22519
+ const browseMode = (_show_browseMode = show.browseMode) !== null && _show_browseMode !== void 0 ? _show_browseMode : pres === null || pres === void 0 ? void 0 : pres.browseMode;
22520
+ const laserColor = (_show_laserColor = show.laserColor) !== null && _show_laserColor !== void 0 ? _show_laserColor : pres === null || pres === void 0 ? void 0 : pres.laserColor;
22521
+ const hasShow = !!(pres === null || pres === void 0 ? void 0 : pres.slideShow) && Object.keys(show).length > 0;
22522
+ const hasExt = typeof browseMode === 'boolean' || !!laserColor;
22523
+ if (!hasShow && !hasExt) return '';
22524
+ const mode = (_show_mode = show.mode) !== null && _show_mode !== void 0 ? _show_mode : 'present';
22525
+ if (show.mode && ![
22526
+ 'present',
22527
+ 'browse',
22528
+ 'kiosk'
22529
+ ].includes(show.mode)) {
22530
+ console.warn(`[pptxgenjs] slideShow.mode must be 'present' | 'browse' | 'kiosk' - "${String(show.mode)}" ignored, 'present' used`);
22531
+ }
22532
+ let attrs = '';
22533
+ if (show.loop === true) attrs += ' loop="1"';
22534
+ if (show.showNarration === false) attrs += ' showNarration="0"';
22535
+ if (show.showAnimation === false) attrs += ' showAnimation="0"';
22536
+ if (show.useTimings === false) attrs += ' useTimings="0"';
22537
+ const resolvedMode = [
22538
+ 'present',
22539
+ 'browse',
22540
+ 'kiosk'
22541
+ ].includes(mode) ? mode : 'present';
22542
+ const choice = resolvedMode === 'browse' ? `<p:browse${show.showScrollbar === true ? ' showScrollbar="1"' : ''}/>` : resolvedMode === 'kiosk' ? '<p:kiosk/>' : '<p:present/>';
21081
22543
  const showExts = [];
21082
- if (typeof (pres === null || pres === void 0 ? void 0 : pres.browseMode) === 'boolean') showExts.push(`<p:ext uri="${URI_BROWSE_MODE}"><p14:browseMode xmlns:p14="${P14_NS}" showStatus="${pres.browseMode ? '1' : '0'}"/></p:ext>`);
21083
- if (pres === null || pres === void 0 ? void 0 : pres.laserColor) showExts.push(`<p:ext uri="${URI_LASER_CLR}"><p14:laserClr xmlns:p14="${P14_NS}">${createColorElement(pres.laserColor)}</p14:laserClr></p:ext>`);
21084
- const showPr = showExts.length > 0 ? `<p:showPr><p:extLst>${showExts.join('')}</p:extLst></p:showPr>` : '';
22544
+ if (typeof browseMode === 'boolean') showExts.push(`<p:ext uri="${URI_BROWSE_MODE}"><p14:browseMode xmlns:p14="${P14_NS}" showStatus="${browseMode ? '1' : '0'}"/></p:ext>`);
22545
+ if (laserColor) showExts.push(`<p:ext uri="${URI_LASER_CLR}"><p14:laserClr xmlns:p14="${P14_NS}">${createColorElement(laserColor)}</p14:laserClr></p:ext>`);
22546
+ return `<p:showPr${attrs}>${choice}${showExts.length > 0 ? `<p:extLst>${showExts.join('')}</p:extLst>` : ''}</p:showPr>`;
22547
+ }
22548
+ function makeXmlPresPropsExtLst(pres) {
21085
22549
  const exts = [];
21086
- if ((pres === null || pres === void 0 ? void 0 : pres.defaultImageDpi) && pres.defaultImageDpi > 0) exts.push(`<p:ext uri="${URI_DEFAULT_IMAGE_DPI}"><p14:defaultImageDpi xmlns:p14="${P14_NS}" val="${Math.round(pres.defaultImageDpi)}"/></p:ext>`);
22550
+ if (typeof (pres === null || pres === void 0 ? void 0 : pres.defaultImageDpi) === 'number' && Number.isFinite(pres.defaultImageDpi) && pres.defaultImageDpi >= 0) exts.push(`<p:ext uri="${URI_DEFAULT_IMAGE_DPI}"><p14:defaultImageDpi xmlns:p14="${P14_NS}" val="${Math.round(pres.defaultImageDpi)}"/></p:ext>`);
21087
22551
  if (pres === null || pres === void 0 ? void 0 : pres.discardImageEditData) exts.push(`<p:ext uri="${URI_DISCARD_IMAGE_EDIT_DATA}"><p14:discardImageEditData xmlns:p14="${P14_NS}" val="1"/></p:ext>`);
21088
22552
  if (pres === null || pres === void 0 ? void 0 : pres.readonlyRecommended) exts.push(`<p:ext uri="${URI_READONLY_RECOMMENDED}"><p1710:readonlyRecommended xmlns:p1710="${P1710_NS}" val="1"/></p:ext>`);
21089
22553
  if (pres === null || pres === void 0 ? void 0 : pres.chartTrackingRefBased) exts.push('<p:ext uri="{FD5EFAAD-0ECE-453E-9831-46B23BE46B34}"><p15:chartTrackingRefBased xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>');
21090
- const extLst = exts.length > 0 ? `<p:extLst>${exts.join('')}</p:extLst>` : '';
21091
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentationPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">' + `${showPr}${extLst}</p:presentationPr>`;
22554
+ return exts.length > 0 ? `<p:extLst>${exts.join('')}</p:extLst>` : '';
21092
22555
  }
21093
22556
  /**
21094
22557
  * Create `ppt/tableStyles.xml`
21095
22558
  * @see: http://openxmldeveloper.org/discussions/formats/f/13/p/2398/8107.aspx
21096
22559
  * @return {string} XML
21097
- */ function makeXmlTableStyles() {
21098
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>`;
22560
+ */ /**
22561
+ * The GUID `a:tblStyleLst@def` has always carried - PowerPoint's "Medium Style 2 - Accent 1"
22562
+ */ const DEF_TABLE_STYLE_ID = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}';
22563
+ /**
22564
+ * CT_TableStyle fixes this child order, and it is neither alphabetical nor the intuitive one:
22565
+ * `lastCol` precedes `firstCol`, and `firstRow` sits between `swCell` and `neCell`.
22566
+ */ const TABLE_STYLE_PARTS = [
22567
+ [
22568
+ 'wholeTable',
22569
+ 'wholeTbl'
22570
+ ],
22571
+ [
22572
+ 'band1H',
22573
+ 'band1H'
22574
+ ],
22575
+ [
22576
+ 'band2H',
22577
+ 'band2H'
22578
+ ],
22579
+ [
22580
+ 'band1V',
22581
+ 'band1V'
22582
+ ],
22583
+ [
22584
+ 'band2V',
22585
+ 'band2V'
22586
+ ],
22587
+ [
22588
+ 'lastCol',
22589
+ 'lastCol'
22590
+ ],
22591
+ [
22592
+ 'firstCol',
22593
+ 'firstCol'
22594
+ ],
22595
+ [
22596
+ 'lastRow',
22597
+ 'lastRow'
22598
+ ],
22599
+ [
22600
+ 'seCell',
22601
+ 'seCell'
22602
+ ],
22603
+ [
22604
+ 'swCell',
22605
+ 'swCell'
22606
+ ],
22607
+ [
22608
+ 'firstRow',
22609
+ 'firstRow'
22610
+ ],
22611
+ [
22612
+ 'neCell',
22613
+ 'neCell'
22614
+ ],
22615
+ [
22616
+ 'nwCell',
22617
+ 'nwCell'
22618
+ ]
22619
+ ];
22620
+ /** CT_TableCellBorderStyle child order */ const TABLE_STYLE_BORDERS = [
22621
+ 'left',
22622
+ 'right',
22623
+ 'top',
22624
+ 'bottom',
22625
+ 'insideH',
22626
+ 'insideV'
22627
+ ];
22628
+ /**
22629
+ * One part of a table style (`a:wholeTbl`, `a:band1H`, ...).
22630
+ * - `a:tcTxStyle` precedes `a:tcStyle`; inside the cell style, `a:tcBdr` precedes the fill
22631
+ */ function genXmlTableStylePart(tag, part) {
22632
+ // `b`/`i` are ST_OnOffStyleType: an unset property means "def", i.e. leave it to the theme
22633
+ const bold = typeof part.bold === 'boolean' ? ` b="${part.bold ? 'on' : 'off'}"` : '';
22634
+ const italic = typeof part.italic === 'boolean' ? ` i="${part.italic ? 'on' : 'off'}"` : '';
22635
+ const txStyle = bold || italic || part.color ? `<a:tcTxStyle${bold}${italic}>${part.color ? createColorElement(part.color) : ''}</a:tcTxStyle>` : '';
22636
+ const borders = TABLE_STYLE_BORDERS.filter((edge)=>{
22637
+ var _part_borders;
22638
+ return (_part_borders = part.borders) === null || _part_borders === void 0 ? void 0 : _part_borders[edge];
22639
+ }).map((edge)=>{
22640
+ var _part_borders;
22641
+ const line = (_part_borders = part.borders) === null || _part_borders === void 0 ? void 0 : _part_borders[edge];
22642
+ return line ? `<a:${edge}>${genXmlLine(line)}</a:${edge}>` : '';
22643
+ }).join('');
22644
+ const fill = part.fill ? `<a:fill>${genXmlColorSelection(part.fill)}</a:fill>` : '';
22645
+ const cellStyle = borders || fill ? `<a:tcStyle>${borders ? `<a:tcBdr>${borders}</a:tcBdr>` : ''}${fill}</a:tcStyle>` : '';
22646
+ return txStyle || cellStyle ? `<a:${tag}>${txStyle}${cellStyle}</a:${tag}>` : '';
22647
+ }
22648
+ /**
22649
+ * Creates `ppt/tableStyles.xml`
22650
+ * - with no custom styles this is the same self-closing stub earlier versions wrote
22651
+ * @param {TableStyleProps[]} [styles] - custom table style definitions
22652
+ * @return {string} XML
22653
+ */ function makeXmlTableStyles(styles) {
22654
+ const valid = (styles !== null && styles !== void 0 ? styles : []).filter((style)=>{
22655
+ var _ref;
22656
+ // `@styleId` is an ST_Guid and `@styleName` is required; a malformed id would be rejected on open
22657
+ if (!/^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$/.test((_ref = style === null || style === void 0 ? void 0 : style.id) !== null && _ref !== void 0 ? _ref : '')) {
22658
+ console.warn(`[pptxgenjs] table style \`id\` must be a braced GUID, e.g. '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}' - "${String(style === null || style === void 0 ? void 0 : style.id)}" ignored`);
22659
+ return false;
22660
+ }
22661
+ if (!style.name) {
22662
+ console.warn(`[pptxgenjs] table style ${style.id} has no \`name\` - ignored`);
22663
+ return false;
22664
+ }
22665
+ return true;
22666
+ });
22667
+ const head = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="${DEF_TABLE_STYLE_ID}"`;
22668
+ if (valid.length === 0) return `${head}/>`;
22669
+ const body = valid.map((style)=>{
22670
+ const parts = TABLE_STYLE_PARTS.map(([prop, tag])=>{
22671
+ const part = style[prop];
22672
+ return part && typeof part === 'object' ? genXmlTableStylePart(tag, part) : '';
22673
+ }).join('');
22674
+ return `<a:tblStyle styleId="${style.id}" styleName="${encodeXmlEntities(style.name)}">${parts}</a:tblStyle>`;
22675
+ }).join('');
22676
+ return `${head}>${body}</a:tblStyleLst>`;
21099
22677
  }
21100
22678
  /**
21101
22679
  * Creates `ppt/viewProps.xml`
22680
+ * - the hardcoded literal is kept when the caller sets no `viewProps`, so default packages stay byte-identical
21102
22681
  * @return {string} XML
21103
- */ function makeXmlViewProps() {
21104
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:viewPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr snapToGrid="0" snapToObjects="1"><p:cViewPr varScale="1"><p:scale><a:sx n="136" d="100"/><a:sy n="136" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr><p:guideLst/></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="76200" cy="76200"/></p:viewPr>`;
22682
+ */ function makeXmlViewProps(pres) {
22683
+ var _view_guides;
22684
+ if (!(pres === null || pres === void 0 ? void 0 : pres.viewProps)) {
22685
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:viewPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr snapToGrid="0" snapToObjects="1"><p:cViewPr varScale="1"><p:scale><a:sx n="136" d="100"/><a:sy n="136" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr><p:guideLst/></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="76200" cy="76200"/></p:viewPr>`;
22686
+ }
22687
+ const view = pres.viewProps;
22688
+ const zoom = typeof view.zoom === 'number' && isFinite(view.zoom) && view.zoom > 0 ? Math.round(view.zoom) : 136;
22689
+ const grid = typeof view.gridSpacing === 'number' && isFinite(view.gridSpacing) && view.gridSpacing > 0 ? inch2Emu(view.gridSpacing) : 76200;
22690
+ const snapGrid = view.snapToGrid === true ? '1' : '0';
22691
+ const snapObj = view.snapToObjects === false ? '0' : '1';
22692
+ const showGuides = view.showGuides === true ? ' showGuides="1"' : '';
22693
+ const showComments = view.showComments === false ? ' showComments="0"' : '';
22694
+ const lastView = view.lastView ? ` lastView="${view.lastView}"` : '';
22695
+ // `p:guideLst` is the classic guide list, distinct from the MS-PPTX `p15:sldGuideLst` extension
22696
+ const guides = ((_view_guides = view.guides) !== null && _view_guides !== void 0 ? _view_guides : []).filter((guide)=>typeof guide.pos === 'number' && isFinite(guide.pos) && guide.pos >= 0).map((guide)=>`<p:guide${guide.orient === 'vert' ? ' orient="vert"' : ''} pos="${Math.round(guide.pos * 96)}"/>`).join('');
22697
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + `<p:viewPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"${lastView}${showComments}>` + '<p:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr>' + `<p:slideViewPr><p:cSldViewPr snapToGrid="${snapGrid}" snapToObjects="${snapObj}"${showGuides}>` + `<p:cViewPr varScale="1"><p:scale><a:sx n="${zoom}" d="100"/><a:sy n="${zoom}" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr>` + (guides ? `<p:guideLst>${guides}</p:guideLst>` : '<p:guideLst/>') + '</p:cSldViewPr></p:slideViewPr>' + '<p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr>' + `<p:gridSpacing cx="${grid}" cy="${grid}"/>` + '</p:viewPr>';
21105
22698
  }
21106
22699
 
21107
22700
 
@@ -21110,6 +22703,7 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21110
22703
 
21111
22704
 
21112
22705
 
22706
+
21113
22707
  function pptxgen_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21114
22708
  try {
21115
22709
  var info = gen[key](arg);
@@ -21292,6 +22886,12 @@ class PptxGenJS {
21292
22886
  get rtlMode() {
21293
22887
  return this._rtlMode;
21294
22888
  }
22889
+ set tableStyles(value) {
22890
+ this._tableStyles = value;
22891
+ }
22892
+ get tableStyles() {
22893
+ return this._tableStyles;
22894
+ }
21295
22895
  get firstSlideNum() {
21296
22896
  return this._firstSlideNum;
21297
22897
  }
@@ -21587,7 +23187,15 @@ class PptxGenJS {
21587
23187
  _slideNumberProps: propsClone.slideNumber || null,
21588
23188
  _slideObjects: [],
21589
23189
  background: propsClone.background || null,
21590
- bkgd: propsClone.bkgd || null
23190
+ bkgd: propsClone.bkgd || null,
23191
+ layoutType: propsClone.layoutType,
23192
+ matchingName: propsClone.matchingName,
23193
+ preserve: propsClone.preserve,
23194
+ showMasterShapes: propsClone.showMasterShapes,
23195
+ showMasterPlaceholderAnimation: propsClone.showMasterPlaceholderAnimation,
23196
+ userDrawn: propsClone.userDrawn,
23197
+ colorMapOverride: propsClone.colorMapOverride,
23198
+ transition: propsClone.transition
21591
23199
  };
21592
23200
  // STEP 1: Create the Slide Master/Layout
21593
23201
  createSlideMaster(propsClone, newLayout);
@@ -21623,7 +23231,7 @@ class PptxGenJS {
21623
23231
  */ pptxgen_define_property(this, "_layout", void 0);
21624
23232
  /**
21625
23233
  * PptxGenJS Library Version
21626
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.19"));
23234
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.2.0"));
21627
23235
  /**
21628
23236
  * @type {string}
21629
23237
  */ pptxgen_define_property(this, "_author", void 0);
@@ -21656,6 +23264,7 @@ class PptxGenJS {
21656
23264
  * Whether Right-to-Left (RTL) mode is enabled
21657
23265
  * @type {boolean}
21658
23266
  */ pptxgen_define_property(this, "_rtlMode", void 0);
23267
+ /** tableStyles - custom table style definitions written into `ppt/tableStyles.xml` */ pptxgen_define_property(this, "_tableStyles", void 0);
21659
23268
  /**
21660
23269
  * Starting slide number (`p:presentation@firstSlideNum`)
21661
23270
  * @default 1
@@ -21678,6 +23287,10 @@ class PptxGenJS {
21678
23287
  /** Recommend opening read-only. MS-PPTX §2.14.1.1 `p1710:readonlyRecommended`. */ pptxgen_define_property(this, "readonlyRecommended", void 0);
21679
23288
  /** Browse-mode status bar. MS-PPTX §2.3.1.2 `p14:browseMode` on `showPr`. */ pptxgen_define_property(this, "browseMode", void 0);
21680
23289
  /** Laser-pointer color. MS-PPTX §2.3.1.16 `p14:laserClr` on `showPr`. */ pptxgen_define_property(this, "laserColor", void 0);
23290
+ /**
23291
+ * Slide-show options (`p:showPr`). Opt-in — omitted unless set.
23292
+ * @example pptx.slideShow = { mode: 'kiosk', loop: true }
23293
+ */ pptxgen_define_property(this, "slideShow", void 0);
21681
23294
  /**
21682
23295
  * Chart data-point properties and datalabels follow their cell references.
21683
23296
  * MS-PPTX §2.4.1.1 `chartTrackingRefBased` on `presentationPr` extLst.
@@ -21687,6 +23300,13 @@ class PptxGenJS {
21687
23300
  * Notes-page alignment guides (MS-PPTX §2.4.1.3). Emitted as `p15:notesGuideLst`.
21688
23301
  * @example pptx.notesGuides = [{ orient: 'horz', pos: 2 }]
21689
23302
  */ pptxgen_define_property(this, "notesGuides", []);
23303
+ /** Additional document properties written to `docProps`. */ pptxgen_define_property(this, "documentProps", void 0);
23304
+ /** Slide-size preset (`p:sldSz@type`). */ pptxgen_define_property(this, "slideSizeType", void 0);
23305
+ /** Photo-album mode (`p:photoAlbum`). */ pptxgen_define_property(this, "photoAlbum", void 0);
23306
+ /** East Asian line-breaking rules (`p:kinsoku`). */ pptxgen_define_property(this, "kinsoku", void 0);
23307
+ /** Print defaults (`p:prnPr` on `presentationPr`). */ pptxgen_define_property(this, "printProps", void 0);
23308
+ /** Recently-used colours (`p:clrMru` on `presentationPr`). */ pptxgen_define_property(this, "recentColors", void 0);
23309
+ /** View properties (`ppt/viewProps.xml`). Unset keeps the previous hardcoded viewPr. */ pptxgen_define_property(this, "viewProps", void 0);
21690
23310
  /**
21691
23311
  * Modern comment authors (MS-PPTX §2.16). Emitted to `ppt/authors.xml`.
21692
23312
  * Auto-populated from slide `addComment` author names if left empty.
@@ -21768,7 +23388,7 @@ class PptxGenJS {
21768
23388
  */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises, mediaPaths)=>{
21769
23389
  slide._relsChart.forEach((rel)=>chartPromises.push(createExcelWorksheet(rel, zip)));
21770
23390
  slide._relsMedia.forEach((rel)=>{
21771
- if (rel.type !== 'online' && rel.type !== 'hyperlink') {
23391
+ if (!rel.isLinked && rel.type !== 'online' && rel.type !== 'hyperlink') {
21772
23392
  var _data_split_pop;
21773
23393
  // A: Loop vars
21774
23394
  let data = rel.data && typeof rel.data === 'string' ? rel.data : '';
@@ -21870,16 +23490,16 @@ class PptxGenJS {
21870
23490
  };
21871
23491
  zip.file('[Content_Types].xml', makeXmlContTypes(this.slides, this.slideLayouts, this.masterSlide, trackingParts)); // TODO: pass only `this` like below! 20200206
21872
23492
  zip.file('_rels/.rels', makeXmlRootRels());
21873
- zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company)); // TODO: pass only `this` like below! 20200206
21874
- zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision, this.created, this.modified)); // TODO: pass only `this` like below! 20200206
23493
+ zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company, this.documentProps)); // TODO: pass only `this` like below! 20200206
23494
+ zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision, this.created, this.modified, this.documentProps)); // TODO: pass only `this` like below! 20200206
21875
23495
  zip.file('ppt/_rels/presentation.xml.rels', makeXmlPresentationRels(this.slides, trackingParts));
21876
23496
  zip.file('ppt/theme/theme1.xml', makeXmlTheme(this));
21877
23497
  // notesMaster gets its own theme part (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09).
21878
23498
  zip.file('ppt/theme/theme2.xml', makeXmlTheme(this, 'notes'));
21879
23499
  zip.file('ppt/presentation.xml', makeXmlPresentation(this));
21880
23500
  zip.file('ppt/presProps.xml', makeXmlPresProps(this));
21881
- zip.file('ppt/tableStyles.xml', makeXmlTableStyles());
21882
- zip.file('ppt/viewProps.xml', makeXmlViewProps());
23501
+ zip.file('ppt/tableStyles.xml', makeXmlTableStyles(this._tableStyles));
23502
+ zip.file('ppt/viewProps.xml', makeXmlViewProps(this));
21883
23503
  // C: Create a Layout/Master/Rel/Slide file for each SlideLayout and Slide
21884
23504
  this.slideLayouts.forEach((layout, idx)=>{
21885
23505
  zip.file(`ppt/slideLayouts/slideLayout${idx + 1}.xml`, makeXmlLayout(layout));
@@ -22046,6 +23666,7 @@ class PptxGenJS {
22046
23666
  addTable: notOnMaster,
22047
23667
  addText: notOnMaster,
22048
23668
  addGroup: notOnMaster,
23669
+ addConnector: notOnMaster,
22049
23670
  addWordArt: notOnMaster,
22050
23671
  addTransition: notOnMaster,
22051
23672
  addAnimation: notOnMaster,