pptxgenjs-plus 4.1.17 → 4.1.18

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.17 @ 2026-08-15T04:08:10.950Z */
1
+ /* PptxGenJS 4.1.18 @ 2026-08-19T14:19:18.293Z */
2
2
 
3
3
  "use strict";
4
4
  const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
@@ -273,6 +273,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
273
273
  ShapeType["accentCallout1"] = "accentCallout1";
274
274
  ShapeType["accentCallout2"] = "accentCallout2";
275
275
  ShapeType["accentCallout3"] = "accentCallout3";
276
+ ShapeType["accentCallout4"] = "accentCallout4";
277
+ ShapeType["accentBorderCallout4"] = "accentBorderCallout4";
278
+ ShapeType["borderCallout4"] = "borderCallout4";
279
+ ShapeType["callout4"] = "callout4";
276
280
  ShapeType["actionButtonBackPrevious"] = "actionButtonBackPrevious";
277
281
  ShapeType["actionButtonBeginning"] = "actionButtonBeginning";
278
282
  ShapeType["actionButtonBlank"] = "actionButtonBlank";
@@ -604,7 +608,7 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
604
608
  SHAPE_TYPE["LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR"] = "accentBorderCallout3";
605
609
  SHAPE_TYPE["LINE_CALLOUT_3_NO_BORDER"] = "callout3";
606
610
  SHAPE_TYPE["LINE_CALLOUT_4"] = "borderCallout4";
607
- SHAPE_TYPE["LINE_CALLOUT_4_ACCENT_BAR"] = "accentCallout3=4";
611
+ SHAPE_TYPE["LINE_CALLOUT_4_ACCENT_BAR"] = "accentCallout4";
608
612
  SHAPE_TYPE["LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR"] = "accentBorderCallout4";
609
613
  SHAPE_TYPE["LINE_CALLOUT_4_NO_BORDER"] = "callout4";
610
614
  SHAPE_TYPE["LINE"] = "line";
@@ -716,6 +720,7 @@ var core_enums_MASTER_OBJECTS = /*#__PURE__*/ function(MASTER_OBJECTS) {
716
720
  }({});
717
721
  var core_enums_SLIDE_OBJECT_TYPES = /*#__PURE__*/ function(SLIDE_OBJECT_TYPES) {
718
722
  SLIDE_OBJECT_TYPES["chart"] = "chart";
723
+ SLIDE_OBJECT_TYPES["group"] = "group";
719
724
  SLIDE_OBJECT_TYPES["hyperlink"] = "hyperlink";
720
725
  SLIDE_OBJECT_TYPES["image"] = "image";
721
726
  SLIDE_OBJECT_TYPES["media"] = "media";
@@ -730,13 +735,23 @@ var core_enums_SLIDE_OBJECT_TYPES = /*#__PURE__*/ function(SLIDE_OBJECT_TYPES) {
730
735
  SLIDE_OBJECT_TYPES["officeApp"] = "officeApp";
731
736
  return SLIDE_OBJECT_TYPES;
732
737
  }({});
733
- var core_enums_PLACEHOLDER_TYPES = /*#__PURE__*/ function(PLACEHOLDER_TYPES) {
738
+ /** ECMA-376 §4.8.14 `ST_PlaceholderType` (`standards/ecma/part-21_presentationml-reference-material-animation.txt`). Friendly keys `image`/`table` map to `pic`/`tbl`. */ var core_enums_PLACEHOLDER_TYPES = /*#__PURE__*/ function(PLACEHOLDER_TYPES) {
734
739
  PLACEHOLDER_TYPES["title"] = "title";
735
740
  PLACEHOLDER_TYPES["body"] = "body";
736
- PLACEHOLDER_TYPES["image"] = "pic";
741
+ PLACEHOLDER_TYPES["ctrTitle"] = "ctrTitle";
742
+ PLACEHOLDER_TYPES["subTitle"] = "subTitle";
743
+ PLACEHOLDER_TYPES["dt"] = "dt";
744
+ PLACEHOLDER_TYPES["sldNum"] = "sldNum";
745
+ PLACEHOLDER_TYPES["ftr"] = "ftr";
746
+ PLACEHOLDER_TYPES["hdr"] = "hdr";
747
+ PLACEHOLDER_TYPES["obj"] = "obj";
737
748
  PLACEHOLDER_TYPES["chart"] = "chart";
738
749
  PLACEHOLDER_TYPES["table"] = "tbl";
750
+ PLACEHOLDER_TYPES["clipArt"] = "clipArt";
751
+ PLACEHOLDER_TYPES["dgm"] = "dgm";
739
752
  PLACEHOLDER_TYPES["media"] = "media";
753
+ PLACEHOLDER_TYPES["sldImg"] = "sldImg";
754
+ PLACEHOLDER_TYPES["image"] = "pic";
740
755
  return PLACEHOLDER_TYPES;
741
756
  }({});
742
757
  /**
@@ -987,11 +1002,11 @@ function _object_spread_props(target, source) {
987
1002
  // FIRST: Convert string numeric value if reqd
988
1003
  if (typeof size === 'string' && !isNaN(Number(size))) size = Number(size);
989
1004
  // CASE 1: Number in inches
990
- // Assume any number less than 100 is inches
991
- if (typeof size === 'number' && size < 100) return inch2Emu(size);
1005
+ // Assume any number whose absolute value is less than 100 is inches (off-slide coords are negative)
1006
+ if (typeof size === 'number' && Math.abs(size) < 100) return inch2Emu(size);
992
1007
  // CASE 2: Number is already converted to something other than inches
993
- // Assume any number greater than 100 sure isnt inches! Just return it (assume value is EMU already).
994
- if (typeof size === 'number' && size >= 100) return size;
1008
+ // Assume any number whose absolute value is 100+ is EMU already.
1009
+ if (typeof size === 'number' && Math.abs(size) >= 100) return size;
995
1010
  // CASE 3: Percentage (ex: '50%')
996
1011
  if (typeof size === 'string' && size.includes('%')) {
997
1012
  if (xyDir && xyDir === 'X') return Math.round(parseFloat(size) / 100 * layout.width);
@@ -1041,8 +1056,8 @@ function _object_spread_props(target, source) {
1041
1056
  * @returns {number} EMU value
1042
1057
  */ function inch2Emu(inches) {
1043
1058
  // NOTE: Provide Caller Safety: Numbers may get conv<->conv during flight, so be kind and do some simple checks to ensure inches were passed
1044
- // Any value over 100 damn sure isnt inches, so lets assume its in EMU already, therefore, just return the same value
1045
- if (typeof inches === 'number' && inches > 100) return inches;
1059
+ // Any absolute value over 100 is not inches (negative EMU is off-slide), so return it unchanged
1060
+ if (typeof inches === 'number' && Math.abs(inches) > 100) return inches;
1046
1061
  if (typeof inches === 'string') inches = Number(inches.replace(/in*/gi, ''));
1047
1062
  return Math.round((/* inlined export .EMU */914400) * inches);
1048
1063
  }
@@ -1109,23 +1124,33 @@ function _object_spread_props(target, source) {
1109
1124
  * Invalid length or entries fall back to Office defaults (with a warning).
1110
1125
  */ function resolveThemeColors(theme) {
1111
1126
  const input = theme === null || theme === void 0 ? void 0 : theme.themeColors;
1112
- if (!input) return [
1113
- ...DEF_THEME_COLORS
1114
- ];
1115
- if (input.length !== 12) {
1127
+ let colors;
1128
+ if (!input) {
1129
+ colors = [
1130
+ ...DEF_THEME_COLORS
1131
+ ];
1132
+ } else if (input.length !== 12) {
1116
1133
  console.warn(`[pptxgenjs] theme.themeColors must contain exactly 12 hex colors (got ${input.length}); using Office defaults`);
1117
- return [
1134
+ colors = [
1118
1135
  ...DEF_THEME_COLORS
1119
1136
  ];
1137
+ } else {
1138
+ colors = input.map((raw, idx)=>{
1139
+ const hex = String(raw || '').replace('#', '').toUpperCase();
1140
+ if (!REGEX_HEX_COLOR.test(hex)) {
1141
+ console.warn(`[pptxgenjs] theme.themeColors[${idx}]="${raw}" is not a valid 6-digit hex; using default ${DEF_THEME_COLORS[idx]}`);
1142
+ return DEF_THEME_COLORS[idx];
1143
+ }
1144
+ return hex;
1145
+ });
1120
1146
  }
1121
- return input.map((raw, idx)=>{
1122
- const hex = String(raw || '').replace('#', '').toUpperCase();
1123
- if (!REGEX_HEX_COLOR.test(hex)) {
1124
- console.warn(`[pptxgenjs] theme.themeColors[${idx}]="${raw}" is not a valid 6-digit hex; using default ${DEF_THEME_COLORS[idx]}`);
1125
- return DEF_THEME_COLORS[idx];
1126
- }
1127
- return hex;
1128
- });
1147
+ // Additive override for `a:hlink` (ECMA-376 clrScheme). Reject non-strings and invalid hex.
1148
+ if (typeof (theme === null || theme === void 0 ? void 0 : theme.hlinkColor) === 'string') {
1149
+ const hex = theme.hlinkColor.replace('#', '').toUpperCase();
1150
+ if (REGEX_HEX_COLOR.test(hex)) colors[10] = hex;
1151
+ else console.warn(`[pptxgenjs] theme.hlinkColor="${theme.hlinkColor}" is not a valid 6-digit hex; using ${colors[10]}`);
1152
+ }
1153
+ return colors;
1129
1154
  }
1130
1155
  function isModifiedThemeColor(value) {
1131
1156
  return typeof value === 'object' && value !== null && 'baseColor' in value;
@@ -1355,6 +1380,9 @@ function createGlowElement(glow) {
1355
1380
  case 'pattern':
1356
1381
  outText += createPatternFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : String(colorVal.baseColor));
1357
1382
  break;
1383
+ case 'none':
1384
+ outText += '<a:noFill/>';
1385
+ break;
1358
1386
  default:
1359
1387
  outText += '';
1360
1388
  break;
@@ -1979,17 +2007,18 @@ function gen_tables_object_spread(target) {
1979
2007
  });
1980
2008
  // IMPORTANT: ^^^ add empty if there are no words to avoid "needs repair" issue triggered when cells have null content
1981
2009
  }
1982
- // 5: increase table height by the curr line height (if we're on the last column)
1983
- if (currCellIdx === numCols - 1) emuTabCurrH += emuLineMaxH;
1984
- // 6: advance column/cell index (or circle back to first one to continue adding lines)
1985
- currCellIdx = currCellIdx < numCols - 1 ? currCellIdx + 1 : 0;
1986
- // 7: WIP: done?
2010
+ // 5: done? Check before adding height so the last line of a non-last column still counts
2011
+ // (dunefront 9a4d283 — otherwise the row under-reports height and overflows the slide).
1987
2012
  const brent = rowCellLines.map((cell)=>{
1988
2013
  var _ref;
1989
2014
  var _cell__lines;
1990
2015
  return (_ref = (_cell__lines = cell._lines) === null || _cell__lines === void 0 ? void 0 : _cell__lines.length) !== null && _ref !== void 0 ? _ref : 0;
1991
2016
  }).reduce((prev, next)=>prev + next);
1992
2017
  if (brent === 0) isDone = true;
2018
+ // 6: increase table height by the curr line height (last column, or the row just finished)
2019
+ if (isDone || currCellIdx === numCols - 1) emuTabCurrH += emuLineMaxH;
2020
+ // 7: advance column/cell index (or circle back to first one to continue adding lines)
2021
+ currCellIdx = currCellIdx < numCols - 1 ? currCellIdx + 1 : 0;
1993
2022
  }
1994
2023
  // F: Flush/capture row buffer before it resets at the top of this loop
1995
2024
  if (currTableRow.length > 0) flushCurrentRowToSlide(newTableRowSlide, currTableRow);
@@ -2328,6 +2357,49 @@ function text_object_spread_props(target, source) {
2328
2357
  /**
2329
2358
  * Text-body, run, and placeholder rendering.
2330
2359
  */
2360
+ /** ECMA-376 §5.1.12.76 `ST_TextShapeType` — used to validate `a:prstTxWarp@prst`. */ const TEXT_SHAPE_TYPES = new Set([
2361
+ 'textNoShape',
2362
+ 'textPlain',
2363
+ 'textStop',
2364
+ 'textTriangle',
2365
+ 'textTriangleInverted',
2366
+ 'textChevron',
2367
+ 'textChevronInverted',
2368
+ 'textRingInside',
2369
+ 'textRingOutside',
2370
+ 'textArchUp',
2371
+ 'textArchDown',
2372
+ 'textCircle',
2373
+ 'textButton',
2374
+ 'textArchUpPour',
2375
+ 'textArchDownPour',
2376
+ 'textCirclePour',
2377
+ 'textButtonPour',
2378
+ 'textCurveUp',
2379
+ 'textCurveDown',
2380
+ 'textCanUp',
2381
+ 'textCanDown',
2382
+ 'textWave1',
2383
+ 'textWave2',
2384
+ 'textDoubleWave1',
2385
+ 'textWave4',
2386
+ 'textInflate',
2387
+ 'textDeflate',
2388
+ 'textInflateBottom',
2389
+ 'textDeflateBottom',
2390
+ 'textInflateTop',
2391
+ 'textDeflateTop',
2392
+ 'textDeflateInflate',
2393
+ 'textDeflateInflateDeflate',
2394
+ 'textFadeRight',
2395
+ 'textFadeLeft',
2396
+ 'textFadeUp',
2397
+ 'textFadeDown',
2398
+ 'textSlantUp',
2399
+ 'textSlantDown',
2400
+ 'textCascadeUp',
2401
+ 'textCascadeDown'
2402
+ ]);
2331
2403
 
2332
2404
  /**
2333
2405
  * Generate XML Paragraph Properties
@@ -2481,11 +2553,20 @@ function text_object_spread_props(target, source) {
2481
2553
  ].includes(opts.caps) ? ` cap="${opts.caps}"` : '';
2482
2554
  runProps += ' dirty="0">';
2483
2555
  // Color / Font / Highlight / Outline are children of <a:rPr>, so add them now before closing the runProperties tag
2484
- if (opts.color || opts.fontFace || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
2556
+ if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
2485
2557
  if (opts.outline && typeof opts.outline === 'object') {
2486
- runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection(opts.outline.color || 'FFFFFF')}</a:ln>`;
2487
- }
2488
- if (opts.color) runProps += genXmlColorSelection({
2558
+ runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection({
2559
+ color: opts.outline.color || 'FFFFFF',
2560
+ transparency: opts.outline.transparency
2561
+ })}</a:ln>`;
2562
+ }
2563
+ // Run fill: gradient (`a:gradFill`) takes precedence over solid `color` (WordArt / text gradient)
2564
+ if (opts.gradient) runProps += genXmlColorSelection({
2565
+ type: 'gradient',
2566
+ gradient: opts.gradient,
2567
+ transparency: opts.transparency
2568
+ });
2569
+ else if (opts.color) runProps += genXmlColorSelection({
2489
2570
  color: opts.color,
2490
2571
  transparency: opts.transparency
2491
2572
  });
@@ -2493,9 +2574,14 @@ function text_object_spread_props(target, source) {
2493
2574
  if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2494
2575
  const resolvedGlow = resolveGlowOptions(opts.glow);
2495
2576
  if (resolvedGlow) runProps += `<a:effectLst>${createGlowElement(resolvedGlow)}</a:effectLst>`;
2496
- if (opts.fontFace) {
2497
- // NOTE: 'cs' = Complex Script, 'ea' = East Asian (use "-120" instead of "0" - per Issue #174); ea must come first (Issue #174)
2498
- runProps += `<a:latin typeface="${opts.fontFace}" pitchFamily="34" charset="0"/><a:ea typeface="${opts.fontFace}" pitchFamily="34" charset="-122"/><a:cs typeface="${opts.fontFace}" pitchFamily="34" charset="-120"/>`;
2577
+ const latin = opts.fontFace;
2578
+ const ea = opts.fontFaceEa || opts.fontFace;
2579
+ const cs = opts.fontFaceCs || opts.fontFace;
2580
+ if (latin || ea || cs) {
2581
+ // NOTE: 'cs' = Complex Script, 'ea' = East Asian (use "-120" instead of "0" - per Issue #174)
2582
+ if (latin) runProps += `<a:latin typeface="${latin}" pitchFamily="34" charset="0"/>`;
2583
+ if (ea) runProps += `<a:ea typeface="${ea}" pitchFamily="34" charset="-122"/>`;
2584
+ if (cs) runProps += `<a:cs typeface="${cs}" pitchFamily="34" charset="-120"/>`;
2499
2585
  }
2500
2586
  }
2501
2587
  // Hyperlink support
@@ -2623,6 +2709,10 @@ function genXmlTextRun(textObj) {
2623
2709
  if (slideObject.options._bodyProp.vert) bodyProperties += ' vert="' + slideObject.options._bodyProp.vert + '"'; // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]
2624
2710
  // E: Close <a:bodyPr element
2625
2711
  bodyProperties += '>';
2712
+ // E.1: WordArt text warp (`a:prstTxWarp`) — first child of CT_TextBodyProperties, before autofit
2713
+ if (slideObject.options.presetShape && TEXT_SHAPE_TYPES.has(slideObject.options.presetShape)) {
2714
+ bodyProperties += `<a:prstTxWarp prst="${slideObject.options.presetShape}"><a:avLst/></a:prstTxWarp>`;
2715
+ }
2626
2716
  /**
2627
2717
  * F: Text Fit/AutoFit/Shrink option
2628
2718
  * @see: http://officeopenxml.com/drwSp-text-bodyPr-fit.php
@@ -2851,7 +2941,7 @@ function genXmlTextRun(textObj) {
2851
2941
  // NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
2852
2942
  // `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
2853
2943
  // `omml` is a run-level math payload — inheriting it would replace sibling plain-text runs
2854
- if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'omml') return;
2944
+ if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'omml') return;
2855
2945
  if (key !== 'bullet' && !textOpts[key]) textOpts[key] = val;
2856
2946
  });
2857
2947
  // D: Add formatted textrun
@@ -2864,12 +2954,15 @@ function genXmlTextRun(textObj) {
2864
2954
  });
2865
2955
  /* C: Append 'endParaRPr' (when needed) and close current open paragraph
2866
2956
  * NOTE: (ISSUE#20, ISSUE#193): Add 'endParaRPr' with font/size props or PPT default (Arial/18pt en-us) is used making row "too tall"/not honoring options
2867
- */ if (slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell") && (opts.fontSize || opts.fontFace)) {
2868
- if (opts.fontFace) {
2957
+ */ if (slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell") && (opts.fontSize || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs)) {
2958
+ const latin = opts.fontFace;
2959
+ const ea = opts.fontFaceEa || opts.fontFace;
2960
+ const cs = opts.fontFaceCs || opts.fontFace;
2961
+ if (latin || ea || cs) {
2869
2962
  strSlideXml += `<a:endParaRPr lang="${opts.lang || 'en-US'}"` + (opts.fontSize ? ` sz="${Math.round(opts.fontSize * 100)}"` : '') + ' dirty="0">';
2870
- strSlideXml += `<a:latin typeface="${opts.fontFace}" charset="0"/>`;
2871
- strSlideXml += `<a:ea typeface="${opts.fontFace}" charset="0"/>`;
2872
- strSlideXml += `<a:cs typeface="${opts.fontFace}" charset="0"/>`;
2963
+ if (latin) strSlideXml += `<a:latin typeface="${latin}" charset="0"/>`;
2964
+ if (ea) strSlideXml += `<a:ea typeface="${ea}" charset="0"/>`;
2965
+ if (cs) strSlideXml += `<a:cs typeface="${cs}" charset="0"/>`;
2873
2966
  strSlideXml += '</a:endParaRPr>';
2874
2967
  } else {
2875
2968
  strSlideXml += `<a:endParaRPr lang="${opts.lang || 'en-US'}"` + (opts.fontSize ? ` sz="${Math.round(opts.fontSize * 100)}"` : '') + ' dirty="0"/>';
@@ -2943,24 +3036,40 @@ const NS_P232 = 'http://schemas.microsoft.com/office/powerpoint/2023/02/main';
2943
3036
  const body = extraExts.join('') + genXmlNvPrDesignExts(options);
2944
3037
  return body ? `<p:extLst>${body}</p:extLst>` : '';
2945
3038
  }
3039
+ /**
3040
+ * Resolve a placeholder type to the ST_PlaceholderType token written on `p:ph@type`.
3041
+ * ECMA-376 §4.4.1.33 / CT_Placeholder: `type` is `use="optional" default="obj"`
3042
+ * (`standards/ecma/part-20_presentationml-reference-material-slides.txt`).
3043
+ * Omitting the attribute is therefore the generic object placeholder, not a picture/table slot.
3044
+ *
3045
+ * `PlaceholderProps.type` is the OOXML token ('pic', 'tbl', …) while PLACEHOLDER_TYPES is keyed
3046
+ * by friendly name ('image', 'table'). Accept both so `type: 'pic'` and `PLACEHOLDER_TYPES.image`
3047
+ * emit `type="pic"`. Port of gitbrent/PptxGenJS#1526; the prior double lookup dropped pic/tbl.
3048
+ * @param {string} type placeholder type as provided by the user
3049
+ * @returns OOXML placeholder type, or an empty string when unrecognized
3050
+ */ function resolvePlaceholderType(type) {
3051
+ var _ref;
3052
+ var _PLACEHOLDER_TYPES_type;
3053
+ if (!type) return '';
3054
+ // A) OOXML value ('pic'): the documented form of `PlaceholderProps.type`
3055
+ const ooxmlTypes = Object.values(core_enums_PLACEHOLDER_TYPES);
3056
+ if (ooxmlTypes.includes(type)) return type;
3057
+ // B) Enum key ('image'): tolerated so untyped (JS) callers keep working
3058
+ return (_ref = (_PLACEHOLDER_TYPES_type = core_enums_PLACEHOLDER_TYPES[type]) === null || _PLACEHOLDER_TYPES_type === void 0 ? void 0 : _PLACEHOLDER_TYPES_type.toString()) !== null && _ref !== void 0 ? _ref : '';
3059
+ }
2946
3060
  /**
2947
3061
  * Generate an XML Placeholder
2948
3062
  * @param {ISlideObject} placeholderObj
2949
3063
  * @param {ObjectOptions} extraOpts slide-object options (phTypeExt override)
2950
3064
  * @returns XML
2951
3065
  */ function genXmlPlaceholder(placeholderObj, extraOpts) {
2952
- var _ref, _ref1;
2953
- var _placeholderObj_options, _placeholderObj_options1, _PLACEHOLDER_TYPES_placeholderTyp, _placeholderObj_options2;
3066
+ var _ref;
3067
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2;
2954
3068
  if (!placeholderObj) return '';
2955
3069
  const placeholderIdx = ((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options._placeholderIdx) ? placeholderObj.options._placeholderIdx : '';
2956
- const placeholderTyp = ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType) ? placeholderObj.options._placeholderType : '';
2957
- // NOTE: accept both the friendly name ('image', 'table') and the OOXML code it maps to ('pic', 'tbl').
2958
- // The old code looked the mapped code back up in the enum, which only ever hit for the types whose
2959
- // name and code are identical - that is why picture/chart/table placeholders never got a `type` (issue #33).
2960
- const placeholderCodes = Object.values(core_enums_PLACEHOLDER_TYPES);
2961
- const placeholderType = (_ref = (_PLACEHOLDER_TYPES_placeholderTyp = core_enums_PLACEHOLDER_TYPES[placeholderTyp]) === null || _PLACEHOLDER_TYPES_placeholderTyp === void 0 ? void 0 : _PLACEHOLDER_TYPES_placeholderTyp.toString()) !== null && _ref !== void 0 ? _ref : placeholderCodes.includes(placeholderTyp) ? placeholderTyp : '';
3070
+ const placeholderType = resolvePlaceholderType((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType);
2962
3071
  const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
2963
- const phTypeExt = (_ref1 = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref1 !== void 0 ? _ref1 : (_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.phTypeExt;
3072
+ 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;
2964
3073
  if (phTypeExt === 'cameo' || phTypeExt === 'unknown') {
2965
3074
  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>';
2966
3075
  }
@@ -3133,6 +3242,42 @@ function gen_objects_object_spread_props(target, source) {
3133
3242
  }
3134
3243
  return target;
3135
3244
  }
3245
+ function _object_without_properties(source, excluded) {
3246
+ if (source == null) return {};
3247
+ var target = {}, sourceKeys, key, i;
3248
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
3249
+ sourceKeys = Reflect.ownKeys(Object(source));
3250
+ for(i = 0; i < sourceKeys.length; i++){
3251
+ key = sourceKeys[i];
3252
+ if (excluded.indexOf(key) >= 0) continue;
3253
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3254
+ target[key] = source[key];
3255
+ }
3256
+ return target;
3257
+ }
3258
+ target = _object_without_properties_loose(source, excluded);
3259
+ if (Object.getOwnPropertySymbols) {
3260
+ sourceKeys = Object.getOwnPropertySymbols(source);
3261
+ for(i = 0; i < sourceKeys.length; i++){
3262
+ key = sourceKeys[i];
3263
+ if (excluded.indexOf(key) >= 0) continue;
3264
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3265
+ target[key] = source[key];
3266
+ }
3267
+ }
3268
+ return target;
3269
+ }
3270
+ function _object_without_properties_loose(source, excluded) {
3271
+ if (source == null) return {};
3272
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
3273
+ for(i = 0; i < sourceKeys.length; i++){
3274
+ key = sourceKeys[i];
3275
+ if (excluded.indexOf(key) >= 0) continue;
3276
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3277
+ target[key] = source[key];
3278
+ }
3279
+ return target;
3280
+ }
3136
3281
  /**
3137
3282
  * PptxGenJS: Slide Object Generators
3138
3283
  */
@@ -3143,6 +3288,13 @@ function gen_objects_object_spread_props(target, source) {
3143
3288
  /** Type guard: true when `arr` is a flat (1-level) array rather than a nested one. */ function isFlatStringArray(arr) {
3144
3289
  return Array.isArray(arr) && (arr.length === 0 || !Array.isArray(arr[0]));
3145
3290
  }
3291
+ /** Unwrap master `text` / placeholder content so TextProps[] is not double-wrapped as a single run. */ function masterTextRuns(text) {
3292
+ return Array.isArray(text) ? text : [
3293
+ {
3294
+ text
3295
+ }
3296
+ ];
3297
+ }
3146
3298
  /**
3147
3299
  * Transforms a slide definition to a slide object that is then passed to the XML transformation process.
3148
3300
  * @param {SlideMasterProps} props - slide definition
@@ -3172,11 +3324,7 @@ function gen_objects_object_spread_props(target, source) {
3172
3324
  throw new Error('defineSlideMaster: tables on a master cannot auto-page');
3173
3325
  };
3174
3326
  addTableDefinition(target, object[key].rows, tableProps, target, target._presLayout, noPaging, noPaging);
3175
- } else if (core_enums_MASTER_OBJECTS[key] && key === 'text') addTextDefinition(target, [
3176
- {
3177
- text: object[key].text
3178
- }
3179
- ], object[key].options, false);
3327
+ } else if (core_enums_MASTER_OBJECTS[key] && key === 'text') addTextDefinition(target, masterTextRuns(object[key].text), object[key].options, false);
3180
3328
  else if (core_enums_MASTER_OBJECTS[key] && key === 'placeholder') {
3181
3329
  // TODO: 20180820: Check for existing `name`?
3182
3330
  object[key].options.placeholder = object[key].options.name;
@@ -3184,11 +3332,7 @@ function gen_objects_object_spread_props(target, source) {
3184
3332
  object[key].options._placeholderType = object[key].options.type;
3185
3333
  delete object[key].options.type; // remap name for earier handling internally
3186
3334
  object[key].options._placeholderIdx = 100 + idx;
3187
- addTextDefinition(target, [
3188
- {
3189
- text: object[key].text
3190
- }
3191
- ], object[key].options, true);
3335
+ addTextDefinition(target, masterTextRuns(object[key].text), object[key].options, true);
3192
3336
  // TODO: ISSUE#599 - only text is suported now (add more below)
3193
3337
  // else if (object[key].image) addImageDefinition(target, object[key].image)
3194
3338
  /* 20200120: So... image placeholders go into the "slideLayoutN.xml" file and addImage doesnt do this yet...
@@ -3312,8 +3456,12 @@ function gen_objects_object_spread_props(target, source) {
3312
3456
  */ // STEP 2: Set default options/decode user options
3313
3457
  // A: Core
3314
3458
  options._type = type;
3315
- options.x = typeof options.x !== 'undefined' && options.x != null && !isNaN(Number(options.x)) ? options.x : 1;
3316
- options.y = typeof options.y !== 'undefined' && options.y != null && !isNaN(Number(options.y)) ? options.y : 1;
3459
+ const explicitChartX = typeof options.x !== 'undefined' && options.x != null && !isNaN(Number(options.x));
3460
+ const explicitChartY = typeof options.y !== 'undefined' && options.y != null && !isNaN(Number(options.y));
3461
+ const explicitChartW = options.w !== undefined && options.w !== null;
3462
+ const explicitChartH = options.h !== undefined && options.h !== null;
3463
+ options.x = explicitChartX ? options.x : 1;
3464
+ options.y = explicitChartY ? options.y : 1;
3317
3465
  options.w = options.w || '50%';
3318
3466
  options.h = options.h || '50%';
3319
3467
  options.objectName = options.objectName ? encodeXmlEntities(options.objectName) : `Chart ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart")).length}`;
@@ -3532,7 +3680,11 @@ function gen_objects_object_spread_props(target, source) {
3532
3680
  // is a color string (vs ObjectOptions' ShapeFillProps) and is never read here, so it
3533
3681
  // is reconciled to undefined to keep the stored object a valid ObjectOptions.
3534
3682
  resultObject.options = gen_objects_object_spread_props(gen_objects_object_spread({}, options), {
3535
- fill: undefined
3683
+ fill: undefined,
3684
+ _explicitX: explicitChartX,
3685
+ _explicitY: explicitChartY,
3686
+ _explicitW: explicitChartW,
3687
+ _explicitH: explicitChartH
3536
3688
  });
3537
3689
  resultObject.chartRid = getNewRelId(target);
3538
3690
  // STEP 5: Add this chart to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)
@@ -3560,11 +3712,75 @@ function gen_objects_object_spread_props(target, source) {
3560
3712
  * 1000 and slides also reach 1000+), so a layout image `image-1002-1` would collide with slide #1002's
3561
3713
  * `image-1002-1` and one overwrites the other in the zip (issue #1416). Prefix layout/master media with
3562
3714
  * `layout-` so the two namespaces can never collide; the slide namespace keeps its plain `image-<n>-<i>`.
3563
- */ function imageTargetStem(target) {
3715
+ */ function imageBorderToLine(border) {
3716
+ var _side_width;
3717
+ if (!border) return undefined;
3718
+ const side = Array.isArray(border) ? border[0] : border;
3719
+ if (!side || side.type === 'none') return undefined;
3720
+ return {
3721
+ color: side.color,
3722
+ width: (_side_width = side.width) !== null && _side_width !== void 0 ? _side_width : side.pt
3723
+ };
3724
+ }
3725
+ function imageTargetStem(target) {
3564
3726
  // PresSlide has `_rId`; SlideLayout/master does not. Masters number from 1000 and collide with slide #1000+.
3565
3727
  if (!('_rId' in target)) return `layout-image-${target._relsMedia.length + 1}`;
3566
3728
  return `image-${target._slideNum}-${target._relsMedia.length + 1}`;
3567
3729
  }
3730
+ function isSvgFillSource(data, path) {
3731
+ const src = (data || path).toLowerCase();
3732
+ return src.includes('image/svg+xml') || src.endsWith('.svg') || src.includes('.svg?');
3733
+ }
3734
+ /**
3735
+ * Register a table-cell image fill as slide media so `a:blipFill` can embed it
3736
+ * (Dominik-von-Burg PR 1461). Must run at addTable time so encodeSlideMediaRels sees the rels.
3737
+ */ function registerTableCellImageFill(target, fill) {
3738
+ const data = typeof (fill === null || fill === void 0 ? void 0 : fill.data) === 'string' ? fill.data : '';
3739
+ const path = typeof (fill === null || fill === void 0 ? void 0 : fill.path) === 'string' ? fill.path : '';
3740
+ if (!data && !path) return undefined;
3741
+ const isSvg = isSvgFillSource(data, path);
3742
+ if (isSvg) {
3743
+ const pngRid = getNewRelId(target);
3744
+ target._relsMedia.push({
3745
+ path: path || data + 'png',
3746
+ type: 'image/png',
3747
+ extn: 'png',
3748
+ data: data || '',
3749
+ rId: pngRid,
3750
+ isDuplicate: false,
3751
+ isSvgPng: true,
3752
+ Target: `../media/${imageTargetStem(target)}.png`
3753
+ });
3754
+ const svgRid = getNewRelId(target);
3755
+ target._relsMedia.push({
3756
+ path: path || data,
3757
+ type: 'image/svg+xml',
3758
+ extn: 'svg',
3759
+ data: data || '',
3760
+ rId: svgRid,
3761
+ isDuplicate: false,
3762
+ Target: `../media/${imageTargetStem(target)}.svg`
3763
+ });
3764
+ return svgRid;
3765
+ }
3766
+ let extn = (path.split('?')[0].split('#')[0].split('.').pop() || 'png').toLowerCase();
3767
+ const mime = data ? /image\/([\w+]+);/.exec(data) : null;
3768
+ if (mime === null || mime === void 0 ? void 0 : mime[1]) extn = mime[1] === 'svg+xml' ? 'svg' : mime[1];
3769
+ if (extn === 'jpg') extn = 'jpeg';
3770
+ const imgType = 'image/' + extn;
3771
+ const dupeItem = target._relsMedia.filter((item)=>item.type === imgType && !item.isDuplicate && !item.isSvgPng && (path && item.path === path || data && item.data && item.data === data))[0];
3772
+ const rId = getNewRelId(target);
3773
+ target._relsMedia.push({
3774
+ path: path || 'preencoded.' + extn,
3775
+ type: imgType,
3776
+ extn,
3777
+ data: data || '',
3778
+ rId,
3779
+ isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
3780
+ Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/${imageTargetStem(target)}.${extn}`
3781
+ });
3782
+ return rId;
3783
+ }
3568
3784
  function addImageDefinition(target, opt) {
3569
3785
  var _strImagePath_substring_split__split_pop;
3570
3786
  const newObject = {
@@ -3632,8 +3848,18 @@ function addImageDefinition(target, opt) {
3632
3848
  transparency: opt.transparency || 0,
3633
3849
  objectName,
3634
3850
  shadow: opt.shadow ? correctShadowOptions(opt.shadow) : undefined,
3635
- line: opt.line,
3851
+ glow: opt.glow,
3852
+ softEdge: opt.softEdge,
3853
+ reflection: opt.reflection,
3854
+ blur: opt.blur,
3855
+ line: opt.line || imageBorderToLine(opt.border),
3636
3856
  _sizeFromImage: !intWidth && !intHeight,
3857
+ // addImage always writes x/y/w/h defaults, so remember which axes the caller actually set
3858
+ // (placeholder geometry must not overwrite explicit placement; fujita-h d7e3e93 / #996).
3859
+ _explicitX: opt.x !== undefined && opt.x !== null,
3860
+ _explicitY: opt.y !== undefined && opt.y !== null,
3861
+ _explicitW: opt.w !== undefined && opt.w !== null,
3862
+ _explicitH: opt.h !== undefined && opt.h !== null,
3637
3863
  // Images build options explicitly (unlike shape/text which pass through opts), so copy animation here
3638
3864
  animation: opt.animation,
3639
3865
  appearOnClick: opt.appearOnClick
@@ -3762,6 +3988,10 @@ function addImageDefinition(target, opt) {
3762
3988
  slideData.options.y = intPosY;
3763
3989
  slideData.options.w = intSizeX;
3764
3990
  slideData.options.h = intSizeY;
3991
+ slideData.options._explicitX = opt.x !== undefined && opt.x !== null;
3992
+ slideData.options._explicitY = opt.y !== undefined && opt.y !== null;
3993
+ slideData.options._explicitW = opt.w !== undefined && opt.w !== null;
3994
+ slideData.options._explicitH = opt.h !== undefined && opt.h !== null;
3765
3995
  slideData.options.objectName = objectName;
3766
3996
  slideData.options.animation = opt.animation;
3767
3997
  slideData.options.appearOnClick = opt.appearOnClick;
@@ -4077,7 +4307,7 @@ function addShapeDefinition(target, shapeName, opts) {
4077
4307
  // 1: ShapeLineProps defaults
4078
4308
  const hasConnectorEnds = options.line.sourceId != null || options.line.targetId != null;
4079
4309
  const newLineOpts = {
4080
- type: options.line.type || 'solid',
4310
+ type: options.line.type || (options.line.gradient ? 'gradient' : 'solid'),
4081
4311
  color: options.line.color || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4082
4312
  transparency: options.line.transparency || 0,
4083
4313
  gradient: options.line.gradient,
@@ -4096,6 +4326,11 @@ function addShapeDefinition(target, shapeName, opts) {
4096
4326
  };
4097
4327
  if (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts;
4098
4328
  // 2: Set options defaults
4329
+ const shapeOpts = options;
4330
+ shapeOpts._explicitX = options.x !== undefined && options.x !== null;
4331
+ shapeOpts._explicitY = options.y !== undefined && options.y !== null;
4332
+ shapeOpts._explicitW = options.w !== undefined && options.w !== null;
4333
+ shapeOpts._explicitH = options.h !== undefined && options.h !== null;
4099
4334
  options.x = options.x || (options.x === 0 ? 0 : 1);
4100
4335
  options.y = options.y || (options.y === 0 ? 0 : 1);
4101
4336
  options.w = options.w || (options.w === 0 ? 0 : 1);
@@ -4144,11 +4379,12 @@ function addShapeDefinition(target, shapeName, opts) {
4144
4379
  // STEP 2: Transform `tableRows` into well-formatted TableCell's
4145
4380
  // tableRows can be object or plain text array: `[{text:'cell 1'}, {text:'cell 2', options:{color:'ff0000'}}]` | `["cell 1", "cell 2"]`
4146
4381
  const arrRows = [];
4382
+ const tableFillRid = registerTableCellImageFill(target, opt.fill);
4147
4383
  tableRows.forEach((row)=>{
4148
4384
  const newRow = [];
4149
4385
  if (Array.isArray(row)) {
4150
4386
  row.forEach((cell)=>{
4151
- var _newCell_options;
4387
+ var _newCell_options, _registerTableCellImageFill;
4152
4388
  // A:
4153
4389
  const newCell = {
4154
4390
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
@@ -4214,9 +4450,12 @@ function addShapeDefinition(target, shapeName, opts) {
4214
4450
  cellBorder[idx] = {
4215
4451
  type: cellBorder[idx].type || DEF_CELL_BORDER.type,
4216
4452
  color: cellBorder[idx].color || DEF_CELL_BORDER.color,
4217
- pt: (_cellBorder_idx_width = cellBorder[idx].width) !== null && _cellBorder_idx_width !== void 0 ? _cellBorder_idx_width : typeof cellBorder[idx].pt === 'number' ? cellBorder[idx].pt : DEF_CELL_BORDER.pt
4453
+ pt: (_cellBorder_idx_width = cellBorder[idx].width) !== null && _cellBorder_idx_width !== void 0 ? _cellBorder_idx_width : typeof cellBorder[idx].pt === 'number' ? cellBorder[idx].pt : DEF_CELL_BORDER.pt,
4454
+ transparency: typeof cellBorder[idx].transparency === 'number' ? cellBorder[idx].transparency : undefined
4218
4455
  };
4219
4456
  });
4457
+ const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
4458
+ if (fillRid) cellOpts._fillRid = fillRid;
4220
4459
  // LAST:
4221
4460
  newRow.push(newCell);
4222
4461
  });
@@ -4227,6 +4466,11 @@ function addShapeDefinition(target, shapeName, opts) {
4227
4466
  arrRows.push(newRow);
4228
4467
  });
4229
4468
  // STEP 3: Set options
4469
+ const tableOpts = opt;
4470
+ tableOpts._explicitX = opt.x !== undefined && opt.x !== null;
4471
+ tableOpts._explicitY = opt.y !== undefined && opt.y !== null;
4472
+ tableOpts._explicitW = opt.w !== undefined && opt.w !== null;
4473
+ tableOpts._explicitH = opt.h !== undefined && opt.h !== null;
4230
4474
  opt.x = getSmartParseNumber(opt.x || (opt.x === 0 ? 0 : (/* inlined export .EMU */914400) / 2), 'X', presLayout);
4231
4475
  opt.y = getSmartParseNumber(opt.y || (opt.y === 0 ? 0 : (/* inlined export .EMU */914400) / 2), 'Y', presLayout);
4232
4476
  if (opt.h) opt.h = getSmartParseNumber(opt.h, 'Y', presLayout); // NOTE: Dont set default `h` - leaving it null triggers auto-rowH in `makeXMLSlide()`
@@ -4259,7 +4503,8 @@ function addShapeDefinition(target, shapeName, opts) {
4259
4503
  optBorder[idx] = optBorder[idx] ? {
4260
4504
  type: optBorder[idx].type || DEF_CELL_BORDER.type,
4261
4505
  color: optBorder[idx].color || DEF_CELL_BORDER.color,
4262
- pt: (_ref = (_optBorder_idx_width = optBorder[idx].width) !== null && _optBorder_idx_width !== void 0 ? _optBorder_idx_width : optBorder[idx].pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt
4506
+ pt: (_ref = (_optBorder_idx_width = optBorder[idx].width) !== null && _optBorder_idx_width !== void 0 ? _optBorder_idx_width : optBorder[idx].pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt,
4507
+ transparency: optBorder[idx].transparency
4263
4508
  } : {
4264
4509
  type: 'none'
4265
4510
  };
@@ -4440,27 +4685,40 @@ function addShapeDefinition(target, shapeName, opts) {
4440
4685
  if (itemOpts.placeholder || isPlaceholder) {
4441
4686
  itemOpts.bullet = itemOpts.bullet || false;
4442
4687
  }
4443
- // A.3: Text targeting a placeholder need to inherit the placeholders options (eg: margin, valign, etc.) (Issue #640)
4688
+ // A.3: Text targeting a placeholder inherits layout defaults (margin, valign, fill, …) (Issue #640).
4689
+ // Caller options win so a user fill/spacing is not wiped by the placeholder (fujita-h 11c4cb6).
4690
+ // Do not share the layout `_bodyProp` object — rebuild it below from the merged public options.
4691
+ itemOpts._explicitX = itemOpts.x !== undefined && itemOpts.x !== null;
4692
+ itemOpts._explicitY = itemOpts.y !== undefined && itemOpts.y !== null;
4693
+ itemOpts._explicitW = itemOpts.w !== undefined && itemOpts.w !== null;
4694
+ itemOpts._explicitH = itemOpts.h !== undefined && itemOpts.h !== null;
4444
4695
  if (itemOpts.placeholder && '_slideLayout' in target && target._slideLayout && target._slideLayout._slideObjects) {
4445
4696
  const placeHold = target._slideLayout._slideObjects.filter((item)=>item._type === 'placeholder' && item.options && item.options.placeholder && item.options.placeholder === itemOpts.placeholder)[0];
4446
- if (placeHold === null || placeHold === void 0 ? void 0 : placeHold.options) itemOpts = gen_objects_object_spread({}, itemOpts, placeHold.options);
4697
+ if (placeHold === null || placeHold === void 0 ? void 0 : placeHold.options) {
4698
+ const _placeHold_options = placeHold.options, { _bodyProp: _ignored } = _placeHold_options, layoutOpts = _object_without_properties(_placeHold_options, [
4699
+ "_bodyProp"
4700
+ ]);
4701
+ itemOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, layoutOpts, itemOpts), {
4702
+ _bodyProp: {}
4703
+ });
4704
+ }
4447
4705
  }
4448
4706
  // A.4: Other options
4449
4707
  itemOpts.objectName = itemOpts.objectName ? encodeXmlEntities(itemOpts.objectName) : `Text ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.text */"text")).length}`;
4450
4708
  // B:
4451
4709
  if (itemOpts.shape === core_enums_SHAPE_TYPE.LINE) {
4452
- var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8;
4710
+ var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8, _itemOpts_line9;
4453
4711
  // ShapeLineProps defaults
4454
4712
  const newLineOpts = {
4455
- type: ((_itemOpts_line = itemOpts.line) === null || _itemOpts_line === void 0 ? void 0 : _itemOpts_line.type) || 'solid',
4456
- color: ((_itemOpts_line1 = itemOpts.line) === null || _itemOpts_line1 === void 0 ? void 0 : _itemOpts_line1.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4457
- transparency: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.transparency) || 0,
4458
- gradient: (_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.gradient,
4459
- width: ((_itemOpts_line4 = itemOpts.line) === null || _itemOpts_line4 === void 0 ? void 0 : _itemOpts_line4.width) || 1,
4460
- dashType: ((_itemOpts_line5 = itemOpts.line) === null || _itemOpts_line5 === void 0 ? void 0 : _itemOpts_line5.dashType) || 'solid',
4461
- cap: (_itemOpts_line6 = itemOpts.line) === null || _itemOpts_line6 === void 0 ? void 0 : _itemOpts_line6.cap,
4462
- beginArrowType: ((_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.beginArrowType) || undefined,
4463
- endArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.endArrowType) || undefined
4713
+ type: ((_itemOpts_line = itemOpts.line) === null || _itemOpts_line === void 0 ? void 0 : _itemOpts_line.type) || (((_itemOpts_line1 = itemOpts.line) === null || _itemOpts_line1 === void 0 ? void 0 : _itemOpts_line1.gradient) ? 'gradient' : 'solid'),
4714
+ color: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4715
+ transparency: ((_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.transparency) || 0,
4716
+ gradient: (_itemOpts_line4 = itemOpts.line) === null || _itemOpts_line4 === void 0 ? void 0 : _itemOpts_line4.gradient,
4717
+ width: ((_itemOpts_line5 = itemOpts.line) === null || _itemOpts_line5 === void 0 ? void 0 : _itemOpts_line5.width) || 1,
4718
+ dashType: ((_itemOpts_line6 = itemOpts.line) === null || _itemOpts_line6 === void 0 ? void 0 : _itemOpts_line6.dashType) || 'solid',
4719
+ cap: (_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.cap,
4720
+ beginArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.beginArrowType) || undefined,
4721
+ endArrowType: ((_itemOpts_line9 = itemOpts.line) === null || _itemOpts_line9 === void 0 ? void 0 : _itemOpts_line9.endArrowType) || undefined
4464
4722
  };
4465
4723
  if (typeof itemOpts.line === 'object') itemOpts.line = newLineOpts;
4466
4724
  // 3: Handle line (lots of deprecated opts)
@@ -4666,6 +4924,77 @@ function addShapeDefinition(target, shapeName, opts) {
4666
4924
  }
4667
4925
  });
4668
4926
  }
4927
+ function makeGroupCollector(parent) {
4928
+ return {
4929
+ _slideObjects: [],
4930
+ _rels: parent._rels,
4931
+ _relsMedia: parent._relsMedia,
4932
+ _relsChart: parent._relsChart,
4933
+ _presLayout: parent._presLayout,
4934
+ _slideNum: parent._slideNum,
4935
+ _allocChartId: parent._allocChartId,
4936
+ _rId: '_rId' in parent ? parent._rId : 0
4937
+ };
4938
+ }
4939
+ /**
4940
+ * Adds a PresentationML group (`p:grpSp`, ECMA-376 §19.3.1.22).
4941
+ * Child coordinates are relative to the group origin (`chOff` 0,0 / `chExt` = group size).
4942
+ */ function addGroupDefinition(target, opts, objects) {
4943
+ var _opts_x, _opts_y, _opts_w, _opts_h, _opts_rotate;
4944
+ const groupCount = target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.group */"group")).length;
4945
+ const newObject = {
4946
+ _type: (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"),
4947
+ options: {
4948
+ x: (_opts_x = opts.x) !== null && _opts_x !== void 0 ? _opts_x : 0,
4949
+ y: (_opts_y = opts.y) !== null && _opts_y !== void 0 ? _opts_y : 0,
4950
+ w: (_opts_w = opts.w) !== null && _opts_w !== void 0 ? _opts_w : 1,
4951
+ h: (_opts_h = opts.h) !== null && _opts_h !== void 0 ? _opts_h : 1,
4952
+ rotate: (_opts_rotate = opts.rotate) !== null && _opts_rotate !== void 0 ? _opts_rotate : 0,
4953
+ shadow: opts.shadow ? correctShadowOptions(opts.shadow) : undefined,
4954
+ objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`
4955
+ },
4956
+ _objects: objects
4957
+ };
4958
+ target._slideObjects.push(newObject);
4959
+ return newObject;
4960
+ }
4961
+ function createGroupBuilder(parent, objects) {
4962
+ const builder = {
4963
+ addShape (shapeName, options) {
4964
+ const collector = makeGroupCollector(parent);
4965
+ addShapeDefinition(collector, shapeName, options !== null && options !== void 0 ? options : {});
4966
+ objects.push(...collector._slideObjects);
4967
+ return builder;
4968
+ },
4969
+ addText (text, options) {
4970
+ const collector = makeGroupCollector(parent);
4971
+ const textParam = typeof text === 'string' || typeof text === 'number' ? [
4972
+ {
4973
+ text,
4974
+ options
4975
+ }
4976
+ ] : text;
4977
+ addTextDefinition(collector, textParam, options !== null && options !== void 0 ? options : {}, false);
4978
+ objects.push(...collector._slideObjects);
4979
+ return builder;
4980
+ },
4981
+ addImage (options) {
4982
+ const collector = makeGroupCollector(parent);
4983
+ addImageDefinition(collector, options);
4984
+ objects.push(...collector._slideObjects);
4985
+ return builder;
4986
+ },
4987
+ addGroup (options, build) {
4988
+ const children = [];
4989
+ if (build) build(createGroupBuilder(parent, children));
4990
+ const collector = makeGroupCollector(parent);
4991
+ addGroupDefinition(collector, options, children);
4992
+ objects.push(...collector._slideObjects);
4993
+ return builder;
4994
+ }
4995
+ };
4996
+ return builder;
4997
+ }
4669
4998
 
4670
4999
  ;// CONCATENATED MODULE: ./src/slide.ts
4671
5000
  /**
@@ -4710,6 +5039,7 @@ function slide_object_spread(target) {
4710
5039
  delete runOpts.softEdge;
4711
5040
  delete runOpts.reflection;
4712
5041
  delete runOpts.shadow;
5042
+ delete runOpts.blur;
4713
5043
  return runOpts;
4714
5044
  }
4715
5045
  class Slide {
@@ -4792,6 +5122,18 @@ class Slide {
4792
5122
  addNotesDefinition(this, notes);
4793
5123
  return this;
4794
5124
  }
5125
+ /**
5126
+ * Add a group (`p:grpSp`) to this slide. Child x/y are relative to the group origin.
5127
+ * Existing addShape/addImage/addText APIs are unchanged.
5128
+ * @example slide.addGroup({ x: 1, y: 1, w: 4, h: 3 }, g => { g.addShape(pptx.ShapeType.rect, { x: 0, y: 0, w: 1, h: 1 }) })
5129
+ */ addGroup(options, build) {
5130
+ const children = options._objects ? [
5131
+ ...options._objects
5132
+ ] : [];
5133
+ if (build) build(createGroupBuilder(this, children));
5134
+ addGroupDefinition(this, cloneOpts(options), children);
5135
+ return this;
5136
+ }
4795
5137
  /**
4796
5138
  * Add a slide transition (`<p:transition>`, ECMA-376 §19.3.1.50 / MS-PPTX §2.2.1)
4797
5139
  * @param {SlideTransitionProps} options - transition options
@@ -4914,7 +5256,7 @@ class Slide {
4914
5256
  * @return {Slide} this Slide
4915
5257
  */ addText(text, options) {
4916
5258
  // String/number text is one run. Keep text styling on that run, but leave
4917
- // glow/softEdge/reflection/shadow on the shape `effectLst` (issue #84).
5259
+ // glow/softEdge/reflection/shadow/blur on the shape `effectLst` (issue #84).
4918
5260
  const textParam = typeof text === 'string' || typeof text === 'number' ? [
4919
5261
  {
4920
5262
  text,
@@ -4924,6 +5266,19 @@ class Slide {
4924
5266
  addTextDefinition(this, textParam, cloneOpts(options), false);
4925
5267
  return this;
4926
5268
  }
5269
+ /**
5270
+ * Add WordArt to Slide — text with a DrawingML warp (`a:prstTxWarp`) and/or a gradient run fill.
5271
+ * Defaults to centered `textNoShape` (no transform); options override.
5272
+ * @param {string|TextProps[]} text - text string or complex object
5273
+ * @param {TextPropsOptions} options - text/WordArt options (`presetShape`, `gradient`, etc.)
5274
+ * @return {Slide} this Slide
5275
+ */ addWordArt(text, options) {
5276
+ const opts = slide_object_spread({
5277
+ align: 'center',
5278
+ presetShape: 'textNoShape'
5279
+ }, options);
5280
+ return this.addText(text, opts);
5281
+ }
4927
5282
  constructor(params){
4928
5283
  var _this__slideLayout;
4929
5284
  slide_define_property(this, "_setSlideNum", void 0);
@@ -5216,6 +5571,33 @@ function createLineCap(lineCap) {
5216
5571
  throw new Error(`Invalid chart line cap: ${neverLineCap}`);
5217
5572
  }
5218
5573
  }
5574
+ /** DrawingML `a:prstDash` / ST_PresetLineDashVal — same set as `line.dashType` / chart `lineDash`. */ const CHART_LINE_DASH_TYPES = [
5575
+ 'solid',
5576
+ 'dash',
5577
+ 'dashDot',
5578
+ 'lgDash',
5579
+ 'lgDashDot',
5580
+ 'lgDashDotDot',
5581
+ 'sysDash',
5582
+ 'sysDot'
5583
+ ];
5584
+ /**
5585
+ * Per-series dash wins over chart-level `lineDash`. Unknown values fall back so we never
5586
+ * emit an illegal ST_PresetLineDashVal.
5587
+ */ function resolveSeriesLineDash(seriesDash, chartDash) {
5588
+ if (seriesDash && CHART_LINE_DASH_TYPES.includes(seriesDash)) return seriesDash;
5589
+ if (chartDash && CHART_LINE_DASH_TYPES.includes(chartDash)) return chartDash;
5590
+ return 'solid';
5591
+ }
5592
+ /** Area charts use `c:grouping` / ST_Grouping (standard|stacked|percentStacked), not ST_BarGrouping. */ const AREA_GROUPING = [
5593
+ 'standard',
5594
+ 'stacked',
5595
+ 'percentStacked'
5596
+ ];
5597
+ function resolveAreaGrouping(barGrouping) {
5598
+ if (barGrouping && AREA_GROUPING.includes(barGrouping)) return barGrouping;
5599
+ return 'standard';
5600
+ }
5219
5601
 
5220
5602
  ;// CONCATENATED MODULE: ./src/charts/axes.ts
5221
5603
  /**
@@ -5776,6 +6158,14 @@ function xml_object_spread_props(target, source) {
5776
6158
  * @example '<c:lineChart>'
5777
6159
  * @return {string} XML chart
5778
6160
  */ /**
6161
+ * Default run properties for scatter `c:dLbls` / `c:txPr` (`a:defRPr`).
6162
+ * ECMA-376 Part 1 §5.7.2.49 `CT_DLbls` + §5.1.5.3.5 `CT_TextCharacterProperties`
6163
+ * (`standards/ecma/part-23_drawingml-reference-material-drawingml-charts.txt`).
6164
+ * An empty `<a:defRPr/>` drops dataLabelFont* on scatter labels (gitbrent #1348).
6165
+ */ function genXmlDataLabelDefRPr(opts) {
6166
+ return `<a:defRPr sz="${Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.dataLabelFontBold ? 1 : 0}" i="${opts.dataLabelFontItalic ? 1 : 0}" u="none" strike="noStrike">` + `<a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>` + `<a:latin typeface="${opts.dataLabelFontFace || 'Arial'}"/>` + '</a:defRPr>';
6167
+ }
6168
+ /**
5779
6169
  * Rich-text body for a custom chart data label (`c:tx` / `c:rich`).
5780
6170
  * Escapes text and applies data-label font options.
5781
6171
  */ function genXmlDataLabelRichText(text, opts) {
@@ -5849,8 +6239,10 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5849
6239
  case core_enums_CHART_TYPE.RADAR:
5850
6240
  // 1: Start Chart
5851
6241
  strXml += `<c:${chartType}Chart>`;
5852
- if (chartType === core_enums_CHART_TYPE.AREA && opts.barGrouping === 'stacked') {
5853
- strXml += '<c:grouping val="' + opts.barGrouping + '"/>';
6242
+ // Area charts: `c:grouping` / ST_Grouping (ECMA-376 §5.7.2.76 / §5.7.3.17).
6243
+ // `barGrouping` is the public option name; the element is not `c:barGrouping` (that is ST_BarGrouping on bar charts).
6244
+ if (chartType === core_enums_CHART_TYPE.AREA) {
6245
+ strXml += '<c:grouping val="' + resolveAreaGrouping(opts.barGrouping) + '"/>';
5854
6246
  }
5855
6247
  if (chartType === core_enums_CHART_TYPE.BAR || chartType === core_enums_CHART_TYPE.BAR3D) {
5856
6248
  strXml += '<c:barDir val="' + opts.barDir + '"/>';
@@ -5924,7 +6316,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5924
6316
  strXml += '<a:ln><a:noFill/></a:ln>';
5925
6317
  } else {
5926
6318
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(seriesColor)}</a:solidFill>`;
5927
- strXml += '<a:prstDash val="' + (opts.lineDash || 'solid') + '"/><a:round/></a:ln>';
6319
+ strXml += '<a:prstDash val="' + resolveSeriesLineDash(obj.lineDash, opts.lineDash) + '"/><a:round/></a:ln>';
5928
6320
  }
5929
6321
  } else if (opts.dataBorder) {
5930
6322
  strXml += `<a:ln w="${valToPts(opts.dataBorder.pt)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(opts.dataBorder.color)}</a:solidFill><a:prstDash val="solid"/><a:round/></a:ln>`;
@@ -5987,7 +6379,8 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5987
6379
  strXml += ' <c:spPr>';
5988
6380
  if (opts.lineSize === 0) {
5989
6381
  strXml += '<a:ln><a:noFill/></a:ln>';
5990
- } else if (chartType === core_enums_CHART_TYPE.BAR) {
6382
+ } else if (chartType === core_enums_CHART_TYPE.BAR || chartType === core_enums_CHART_TYPE.BAR3D) {
6383
+ // CT_DPt.spPr is CT_ShapeProperties: series color is a fill (`a:solidFill`), not an outline (`a:ln`).
5991
6384
  strXml += `<a:solidFill>${createColorElement(arrColors[index % arrColors.length])}</a:solidFill>`;
5992
6385
  } else {
5993
6386
  strXml += `<a:ln><a:solidFill>${createColorElement(arrColors[index % arrColors.length])}</a:solidFill></a:ln>`;
@@ -6158,7 +6551,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6158
6551
  strXml += '<a:ln><a:noFill/></a:ln>';
6159
6552
  } else {
6160
6553
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(tmpSerColor)}</a:solidFill>`;
6161
- strXml += `<a:prstDash val="${opts.lineDash || 'solid'}"/><a:round/></a:ln>`;
6554
+ strXml += `<a:prstDash val="${resolveSeriesLineDash(obj.lineDash, opts.lineDash)}"/><a:round/></a:ln>`;
6162
6555
  }
6163
6556
  // Shadow
6164
6557
  strXml += createShadowElement(resolveShadowOptions(opts.shadow));
@@ -6201,7 +6594,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6201
6594
  strXml += ' <a:lstStyle/>';
6202
6595
  strXml += ' <a:p>';
6203
6596
  strXml += ' <a:pPr>';
6204
- strXml += ' <a:defRPr/>';
6597
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6205
6598
  strXml += ' </a:pPr>';
6206
6599
  strXml += ' <a:r>';
6207
6600
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" dirty="0"/>';
@@ -6218,7 +6611,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6218
6611
  strXml += ' <a:fld id="{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}" type="XVALUE">';
6219
6612
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" baseline="0"/>';
6220
6613
  strXml += ' <a:pPr>';
6221
- strXml += ' <a:defRPr/>';
6614
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6222
6615
  strXml += ' </a:pPr>';
6223
6616
  strXml += ' <a:t>[' + encodeXmlEntities(obj.name) + '</a:t>';
6224
6617
  strXml += ' </a:fld>';
@@ -6229,7 +6622,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6229
6622
  strXml += ' <a:fld id="{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}" type="YVALUE">';
6230
6623
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" baseline="0"/>';
6231
6624
  strXml += ' <a:pPr>';
6232
- strXml += ' <a:defRPr/>';
6625
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6233
6626
  strXml += ' </a:pPr>';
6234
6627
  strXml += ' <a:t>[' + encodeXmlEntities(obj.name) + ']</a:t>';
6235
6628
  strXml += ' </a:fld>';
@@ -6284,7 +6677,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6284
6677
  strXml += ' <a:lstStyle/>';
6285
6678
  strXml += ' <a:p>';
6286
6679
  strXml += ' <a:pPr>';
6287
- strXml += ' <a:defRPr/>';
6680
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6288
6681
  strXml += ' </a:pPr>';
6289
6682
  strXml += ' <a:endParaRPr lang="en-US"/>';
6290
6683
  strXml += ' </a:p>';
@@ -6434,7 +6827,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6434
6827
  strXml += `<a:ln w="${valToPts(opts.dataBorder.pt)}" cap="flat"><a:solidFill>${createColorElement(opts.dataBorder.color)}</a:solidFill><a:prstDash val="solid"/><a:round/></a:ln>`;
6435
6828
  } else {
6436
6829
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="flat"><a:solidFill>${createColorElement(tmpSerColor)}</a:solidFill>`;
6437
- strXml += `<a:prstDash val="${opts.lineDash || 'solid'}"/><a:round/></a:ln>`;
6830
+ strXml += `<a:prstDash val="${resolveSeriesLineDash(obj.lineDash, opts.lineDash)}"/><a:round/></a:ln>`;
6438
6831
  }
6439
6832
  // Shadow
6440
6833
  strXml += createShadowElement(resolveShadowOptions(opts.shadow));
@@ -15442,6 +15835,26 @@ function imageDimensions(bytes) {
15442
15835
  }
15443
15836
  return {};
15444
15837
  }
15838
+ /**
15839
+ * Natural pixel size from encoded image bytes (PNG/JPEG/GIF/BMP headers).
15840
+ * Returns null when the payload is missing, not a supported raster, or claims 0×0
15841
+ * (`imageDimensions` already rejects zero and bomb-sized headers).
15842
+ *
15843
+ * contain/cover `a:srcRect` (ECMA-376 §5.1.10.55) needs the *blip* aspect, not the
15844
+ * placement box — using w/h as imgSize makes srcRect a no-op whenever they match the sizing box.
15845
+ */ function getImagePixelSize(base64Data) {
15846
+ if (typeof base64Data !== 'string' || !base64Data || base64Data === IMG_BROKEN) return null;
15847
+ try {
15848
+ const dims = imageDimensions(base64ToBytes(base64Data));
15849
+ if (dims.width && dims.height) return {
15850
+ w: dims.width,
15851
+ h: dims.height
15852
+ };
15853
+ } catch (unused) {
15854
+ // unrecognized / truncated payload
15855
+ }
15856
+ return null;
15857
+ }
15445
15858
  /**
15446
15859
  * Size images added without `w`/`h` to their natural dimensions (issue #34)
15447
15860
  * @note must run after `encodeSlideMediaRels` has resolved - it reads the encoded image bytes
@@ -15491,11 +15904,19 @@ function imageDimensions(bytes) {
15491
15904
  rel.data = IMG_BROKEN;
15492
15905
  copyMediaToDuplicates(candidates, rel);
15493
15906
  }
15907
+ function mediaLoadFailed(candidates, rel, message, onError) {
15908
+ markMediaBroken(candidates, rel);
15909
+ if (onError === 'placeholder') {
15910
+ console.warn(`WARN: Unable to load image, using placeholder: ${rel.path}${message ? ` (${message})` : ''}`);
15911
+ return 'done';
15912
+ }
15913
+ throw new Error(message);
15914
+ }
15494
15915
  /**
15495
15916
  * Read one Node-local media source and encode it as base64.
15496
15917
  *
15497
15918
  * A read failure is recorded before rejection so duplicate references remain consistent.
15498
- */ function readNodeMediaFile(rel, candidates, fs) {
15919
+ */ function readNodeMediaFile(rel, candidates, fs, onError) {
15499
15920
  return gen_media_async_to_generator(function*() {
15500
15921
  try {
15501
15922
  var _rel_path;
@@ -15515,58 +15936,68 @@ function imageDimensions(bytes) {
15515
15936
  copyMediaToDuplicates(candidates, rel);
15516
15937
  return 'done';
15517
15938
  } catch (ex) {
15518
- markMediaBroken(candidates, rel);
15519
- throw new Error(`ERROR: Unable to read media: "${rel.path}"\n${String(ex)}`, {
15520
- cause: ex
15521
- });
15939
+ return mediaLoadFailed(candidates, rel, `ERROR: Unable to read media: "${rel.path}"\n${String(ex)}`, onError);
15522
15940
  }
15523
15941
  })();
15524
15942
  }
15525
15943
  /**
15526
15944
  * Load one HTTP(S) source in Node, draining error responses and handling both request and response errors.
15527
- */ function loadNodeMediaUrl(rel, candidates, https, http) {
15945
+ */ function loadNodeMediaUrl(rel, candidates, https, http, onError) {
15528
15946
  var _rel_path;
15529
15947
  const httpMod = ((_rel_path = rel.path) === null || _rel_path === void 0 ? void 0 : _rel_path.startsWith('http://')) ? http : https;
15530
15948
  return new Promise((resolve, reject)=>{
15531
- var _rel_path;
15532
15949
  const fail = (message)=>{
15533
- markMediaBroken(candidates, rel);
15534
- reject(new Error(message));
15535
- };
15536
- const req = httpMod.get((_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '', (res)=>{
15537
- var _res_statusCode;
15538
- const status = (_res_statusCode = res.statusCode) !== null && _res_statusCode !== void 0 ? _res_statusCode : 0;
15539
- if (status < 200 || status > 299) {
15540
- res.resume(); // drain so the socket is freed
15541
- fail(`ERROR! Unable to load image (HTTP ${status}): ${rel.path}`);
15542
- return;
15950
+ try {
15951
+ resolve(mediaLoadFailed(candidates, rel, message, onError));
15952
+ } catch (ex) {
15953
+ reject(ex);
15543
15954
  }
15544
- let raw = '';
15545
- res.setEncoding('binary'); // IMPORTANT: Only binary encoding works
15546
- res.on('data', (chunk)=>raw += chunk);
15547
- res.on('end', ()=>{
15548
- rel.data = binaryStringToBase64(raw);
15549
- copyMediaToDuplicates(candidates, rel);
15550
- resolve('done');
15955
+ };
15956
+ try {
15957
+ var _rel_path;
15958
+ const req = httpMod.get((_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '', (res)=>{
15959
+ var _res_statusCode;
15960
+ const status = (_res_statusCode = res.statusCode) !== null && _res_statusCode !== void 0 ? _res_statusCode : 0;
15961
+ if (status < 200 || status > 299) {
15962
+ res.resume(); // drain so the socket is freed
15963
+ fail(`ERROR! Unable to load image (HTTP ${status}): ${rel.path}`);
15964
+ return;
15965
+ }
15966
+ let raw = '';
15967
+ res.setEncoding('binary'); // IMPORTANT: Only binary encoding works
15968
+ res.on('data', (chunk)=>raw += chunk);
15969
+ res.on('end', ()=>{
15970
+ rel.data = binaryStringToBase64(raw);
15971
+ copyMediaToDuplicates(candidates, rel);
15972
+ resolve('done');
15973
+ });
15974
+ res.on('error', ()=>fail(`ERROR! Unable to load image (response): ${rel.path}`));
15551
15975
  });
15552
- res.on('error', ()=>fail(`ERROR! Unable to load image (response): ${rel.path}`));
15553
- });
15554
- // NOTE: without this, a DNS/TLS/connection failure emits an unhandled 'error' and kills the process
15555
- req.on('error', (ex)=>fail(`ERROR! Unable to load image (request): ${rel.path}\n${String(ex)}`));
15976
+ // NOTE: without this, a DNS/TLS/connection failure emits an unhandled 'error' and kills the process
15977
+ req.on('error', (ex)=>fail(`ERROR! Unable to load image (request): ${rel.path}\n${String(ex)}`));
15978
+ } catch (ex) {
15979
+ fail(`ERROR! Unable to load image (https.get): ${rel.path}\n${String(ex)}`);
15980
+ }
15556
15981
  });
15557
15982
  }
15558
15983
  /**
15559
15984
  * Fetch one browser media source and convert its Blob response to a data URL.
15560
15985
  * SVG previews are produced only after the source relation has been populated.
15561
- */ function loadBrowserMedia(rel, candidates) {
15986
+ */ function loadBrowserMedia(rel, candidates, onError) {
15562
15987
  return new Promise((resolve, reject)=>{
15563
15988
  var _rel_path;
15989
+ const fail = (message)=>{
15990
+ try {
15991
+ resolve(mediaLoadFailed(candidates, rel, message, onError));
15992
+ } catch (ex) {
15993
+ reject(ex);
15994
+ }
15995
+ };
15564
15996
  const xhr = new XMLHttpRequest();
15565
15997
  xhr.onload = ()=>{
15566
15998
  // status 0 = non-HTTP schemes (file://); anything outside 2xx is an error page, not image bytes
15567
15999
  if (xhr.status !== 0 && (xhr.status < 200 || xhr.status > 299)) {
15568
- markMediaBroken(candidates, rel);
15569
- reject(new Error(`ERROR! HTTP status ${xhr.status} loading image: ${rel.path}`));
16000
+ fail(`ERROR! HTTP status ${xhr.status} loading image: ${rel.path}`);
15570
16001
  return;
15571
16002
  }
15572
16003
  const reader = new FileReader();
@@ -15579,22 +16010,21 @@ function imageDimensions(bytes) {
15579
16010
  reader.readAsDataURL(xhr.response);
15580
16011
  };
15581
16012
  xhr.onerror = ()=>{
15582
- markMediaBroken(candidates, rel);
15583
- reject(new Error(`ERROR! Unable to load image (xhr.onerror): ${rel.path}`));
16013
+ fail(`ERROR! Unable to load image (xhr.onerror): ${rel.path}`);
15584
16014
  };
15585
16015
  xhr.open('GET', (_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '');
15586
16016
  xhr.responseType = 'blob';
15587
16017
  xhr.send();
15588
16018
  });
15589
16019
  }
15590
- /** Route one source relation to the loader valid for the active runtime. */ function encodeMediaRelation(rel, candidates, isNode, modules, loadNodeModules) {
16020
+ /** Route one source relation to the loader valid for the active runtime. */ function encodeMediaRelation(rel, candidates, isNode, modules, loadNodeModules, onError) {
15591
16021
  return gen_media_async_to_generator(function*() {
15592
16022
  var _rel_path;
15593
16023
  if (!modules.https) yield loadNodeModules();
15594
16024
  const path = (_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '';
15595
- if (isNode && modules.fs && !path.startsWith('http')) return readNodeMediaFile(rel, candidates, modules.fs);
15596
- if (isNode && modules.https && modules.http && path.startsWith('http')) return loadNodeMediaUrl(rel, candidates, modules.https, modules.http);
15597
- return loadBrowserMedia(rel, candidates);
16025
+ if (isNode && modules.fs && !path.startsWith('http')) return readNodeMediaFile(rel, candidates, modules.fs, onError);
16026
+ if (isNode && modules.https && modules.http && path.startsWith('http')) return loadNodeMediaUrl(rel, candidates, modules.https, modules.http, onError);
16027
+ return loadBrowserMedia(rel, candidates, onError);
15598
16028
  })();
15599
16029
  }
15600
16030
  /**
@@ -15616,7 +16046,7 @@ function imageDimensions(bytes) {
15616
16046
  * Encode Image/Audio/Video into base64
15617
16047
  * @param {PresSlide | SlideLayout} layout - slide layout
15618
16048
  * @return {Promise} promise
15619
- */ function encodeSlideMediaRels(layout) {
16049
+ */ function encodeSlideMediaRels(layout, opts) {
15620
16050
  // STEP 1: Detect a real Node process. Browser bundles often polyfill `process`
15621
16051
  // (and even `process.versions.node`), so also require a document-less runtime.
15622
16052
  const isNode = isNodeRuntime();
@@ -15638,7 +16068,8 @@ function imageDimensions(bytes) {
15638
16068
  // B: PERF: Mark dupes (same `path`) to avoid loading the same media over-and-over!
15639
16069
  markDuplicateMedia(candidateRels);
15640
16070
  // STEP 4: Read/Encode each unique media item
15641
- candidateRels.filter((rel)=>!rel.isDuplicate).forEach((rel)=>imageProms.push(encodeMediaRelation(rel, candidateRels, isNode, modules, loadNodeDeps)));
16071
+ const onError = (opts === null || opts === void 0 ? void 0 : opts.onError) === 'placeholder' ? 'placeholder' : 'throw';
16072
+ candidateRels.filter((rel)=>!rel.isDuplicate).forEach((rel)=>imageProms.push(encodeMediaRelation(rel, candidateRels, isNode, modules, loadNodeDeps, onError)));
15642
16073
  // STEP 5: SVG-PNG previews
15643
16074
  // ......: "SVG:" base64 data still requires a png to be generated
15644
16075
  // ......: (`isSvgPng` flag this as the preview image, not the SVG itself)
@@ -15793,11 +16224,6 @@ function imageDimensions(bytes) {
15793
16224
  class: 'entr',
15794
16225
  subtype: 16
15795
16226
  },
15796
- grow: {
15797
- id: 3,
15798
- class: 'entr',
15799
- subtype: 0
15800
- },
15801
16227
  growandturn: {
15802
16228
  id: 31,
15803
16229
  class: 'entr',
@@ -17794,7 +18220,13 @@ function imageDimensions(bytes) {
17794
18220
  var _anim_shapeId;
17795
18221
  const shapeId = (_anim_shapeId = anim.shapeId) !== null && _anim_shapeId !== void 0 ? _anim_shapeId : anim.objectIndex + 2 // Shapes start at ID 2
17796
18222
  ;
17797
- xml += `<p:bldP spid="${shapeId}" grpId="0" animBg="1"/>`;
18223
+ // Charts are graphic frames: ECMA-376 §19.5.13 bldGraphic + §19.5.11 bldAsOne
18224
+ // (object-level entrance, not series-by-category).
18225
+ if (anim.buildKind === 'chart') {
18226
+ xml += `<p:bldGraphic spid="${shapeId}" grpId="0"><p:bldAsOne/></p:bldGraphic>`;
18227
+ } else {
18228
+ xml += `<p:bldP spid="${shapeId}" grpId="0" animBg="1"/>`;
18229
+ }
17798
18230
  });
17799
18231
  xml += '</p:bldLst>';
17800
18232
  return xml;
@@ -18015,22 +18447,22 @@ function getNodeType(trigger) {
18015
18447
  }
18016
18448
 
18017
18449
  ;// CONCATENATED MODULE: ./src/gen-transition.ts
18018
- /**
18019
- * Slide transition XML generation (`<p:transition>`).
18020
- *
18021
- * ECMA-376 §19.3.1.50 `CT_SlideTransition` carries the base transition set.
18022
- * MS-PPTX §2.2.1 adds the 2010+ modern transitions inside an `<mc:AlternateContent>` wrapper
18023
- * (Choice in the `p14`/`p15` namespace, Fallback to a base transition) plus `morph` (§2.6.1.1,
18024
- * `p16` namespace). Modern consumers (PowerPoint 2010+) read the Choice; older readers and other
18025
- * tools use the Fallback, so the file stays valid everywhere.
18450
+ /**
18451
+ * Slide transition XML generation (`<p:transition>`).
18452
+ *
18453
+ * ECMA-376 §19.3.1.50 `CT_SlideTransition` carries the base transition set.
18454
+ * MS-PPTX §2.2.1 adds the 2010+ modern transitions inside an `<mc:AlternateContent>` wrapper
18455
+ * (Choice in the `p14`/`p15` namespace, Fallback to a base transition) plus `morph` (§2.6.1.1,
18456
+ * `p16` namespace). Modern consumers (PowerPoint 2010+) read the Choice; older readers and other
18457
+ * tools use the Fallback, so the file stays valid everywhere.
18026
18458
  */ const gen_transition_P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main';
18027
18459
  const P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
18028
18460
  const P16_NS = 'http://schemas.microsoft.com/office/powerpoint/2016/main';
18029
18461
  const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
18030
- /**
18031
- * Base ECMA-376 transition types and the attribute their inner element takes.
18032
- * Maps: type -> [element name, attribute kind]. The attribute kind selects which
18033
- * `dir`/`orient`/`spokes`/`thruBlk` attribute (if any) to emit (ECMA-376 §19.3.1.50 + §A.4).
18462
+ /**
18463
+ * Base ECMA-376 transition types and the attribute their inner element takes.
18464
+ * Maps: type -> [element name, attribute kind]. The attribute kind selects which
18465
+ * `dir`/`orient`/`spokes`/`thruBlk` attribute (if any) to emit (ECMA-376 §19.3.1.50 + §A.4).
18034
18466
  */ const BASE = {
18035
18467
  blinds: [
18036
18468
  'blinds',
@@ -18121,9 +18553,9 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18121
18553
  'inout'
18122
18554
  ]
18123
18555
  };
18124
- /**
18125
- * Modern (MS-PPTX) transitions: type -> [namespace, attribute kind, fallback base type].
18126
- * morph has no directional attribute (§2.6.3.1 CT_MorphTransition only takes `option`).
18556
+ /**
18557
+ * Modern (MS-PPTX) transitions: type -> [namespace, attribute kind, fallback base type].
18558
+ * morph has no directional attribute (§2.6.3.1 CT_MorphTransition only takes `option`).
18127
18559
  */ const MODERN = {
18128
18560
  conveyor: [
18129
18561
  gen_transition_P14_NS,
@@ -18226,24 +18658,60 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18226
18658
  'split'
18227
18659
  ]
18228
18660
  };
18661
+ /**
18662
+ * Map friendly caller names to ECMA-376 transition tokens.
18663
+ * OOXML short codes (`l`/`horz`/`ld`) stay as-is. `ll`/`rl` are accepted as aliases
18664
+ * for the spec corner tokens `ld`/`rd` (ST_TransitionCornerDirectionType).
18665
+ */ const DIR_ALIASES = {
18666
+ l: 'l',
18667
+ r: 'r',
18668
+ u: 'u',
18669
+ d: 'd',
18670
+ left: 'l',
18671
+ right: 'r',
18672
+ up: 'u',
18673
+ down: 'd',
18674
+ horz: 'horz',
18675
+ vert: 'vert',
18676
+ horizontal: 'horz',
18677
+ vertical: 'vert',
18678
+ lu: 'lu',
18679
+ ru: 'ru',
18680
+ ld: 'ld',
18681
+ rd: 'rd',
18682
+ leftup: 'lu',
18683
+ rightup: 'ru',
18684
+ leftdown: 'ld',
18685
+ rightdown: 'rd',
18686
+ ll: 'ld',
18687
+ rl: 'rd',
18688
+ in: 'in',
18689
+ out: 'out'
18690
+ };
18691
+ function normalizeDir(value) {
18692
+ var _DIR_ALIASES_key;
18693
+ if (!value) return undefined;
18694
+ const key = value.replace(/[-_\s]/g, '').toLowerCase();
18695
+ return (_DIR_ALIASES_key = DIR_ALIASES[key]) !== null && _DIR_ALIASES_key !== void 0 ? _DIR_ALIASES_key : value;
18696
+ }
18229
18697
  /** Build the inner element + its directional attribute for a base transition. */ function baseInner(type, kind, p) {
18230
18698
  switch(kind){
18231
18699
  case 'none':
18232
18700
  return `<p:${type}/>`;
18233
18701
  case 'side':
18234
- return `<p:${type}${gen_transition_dir([
18702
+ return `<p:${type}${dirAttr([
18235
18703
  'l',
18236
18704
  'r',
18237
18705
  'u',
18238
18706
  'd'
18239
- ], p, 'l')}/>`;
18707
+ ], p)}/>`;
18240
18708
  case 'orient':
18241
- return `<p:${type}${gen_transition_dir([
18709
+ return `<p:${type}${dirAttr([
18242
18710
  'horz',
18243
18711
  'vert'
18244
- ], p, 'horz')}/>`;
18712
+ ], p)}/>`;
18245
18713
  case 'eight':
18246
- return `<p:${type}${gen_transition_dir([
18714
+ return `<p:${type}${dirAttr([
18247
18715
  'l',
18248
18716
  'r',
18249
18717
  'u',
@@ -18252,21 +18720,28 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18252
18720
  'ru',
18253
18721
  'ld',
18254
18722
  'rd'
18255
- ], p, 'l')}/>`;
18723
+ ], p)}/>`;
18256
18724
  case 'corner':
18257
- return `<p:${type}${gen_transition_dir([
18725
+ return `<p:${type}${dirAttr([
18258
18726
  'lu',
18259
18727
  'ru',
18260
- 'll',
18261
- 'rl'
18262
- ], p, 'lu')}/>`;
18728
+ 'ld',
18729
+ 'rd'
18730
+ ], p)}/>`;
18263
18731
  case 'inout':
18264
- return `<p:${type}${gen_transition_dir([
18732
+ return `<p:${type}${dirAttr([
18265
18733
  'in',
18266
18734
  'out'
18267
- ], p, 'out')}/>`;
18735
+ ], p)}/>`;
18268
18736
  case 'split':
18269
- return `<p:${type} orient="${p.direction === 'vert' ? 'vert' : 'horz'}" dir="${p.direction === 'in' ? 'in' : 'out'}"/>`;
18737
+ {
18738
+ var _normalizeDir;
18739
+ // CT_SplitTransition: orient=ST_Direction (horz|vert), dir=ST_TransitionInOutDirectionType (in|out)
18740
+ const raw = normalizeDir(p.direction);
18741
+ const orient = (_normalizeDir = normalizeDir(p.orient)) !== null && _normalizeDir !== void 0 ? _normalizeDir : raw === 'vert' || raw === 'horz' ? raw : 'horz';
18742
+ const splitDir = raw === 'in' || raw === 'out' ? raw : 'out';
18743
+ return `<p:${type} orient="${orient === 'vert' ? 'vert' : 'horz'}" dir="${splitDir}"/>`;
18744
+ }
18270
18745
  case 'wheel':
18271
18746
  return `<p:${type}${p.spokes ? ` spokes="${p.spokes}"` : ''}/>`;
18272
18747
  case 'black':
@@ -18275,13 +18750,14 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18275
18750
  return `<p:${type}/>`;
18276
18751
  }
18277
18752
  }
18278
- /** Emit a `dir` attribute when the supplied direction is valid for this transition. */ function gen_transition_dir(valid, p, dflt) {
18279
- const d = p.direction && valid.includes(p.direction) ? p.direction : undefined;
18280
- return d && d !== dflt ? ` dir="${d}"` : d ? ` dir="${d}"` : '';
18753
+ /** Emit a `dir` attribute when the supplied direction is valid for this transition. */ function dirAttr(valid, p) {
18754
+ const d = normalizeDir(p.direction);
18755
+ const token = d && valid.includes(d) ? d : undefined;
18756
+ return token ? ` dir="${token}"` : '';
18281
18757
  }
18282
- /**
18283
- * Generates `<p:transition>...</p:transition>` for a slide, or '' if no transition is set.
18284
- * Placed after `<p:clrMapOvr>` and before `<p:timing>` in the `sld` content model (ECMA-376 §19.3.1.38).
18758
+ /**
18759
+ * Generates `<p:transition>...</p:transition>` for a slide, or '' if no transition is set.
18760
+ * Placed after `<p:clrMapOvr>` and before `<p:timing>` in the `sld` content model (ECMA-376 §19.3.1.38).
18285
18761
  */ function genXmlTransition(slide) {
18286
18762
  const t = slide.transition;
18287
18763
  if (!t || !t.type) return '';
@@ -18297,15 +18773,15 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18297
18773
  if (MODERN[type]) {
18298
18774
  const [ns, kind, fallbackType] = MODERN[type];
18299
18775
  const prefix = ns === P16_NS ? 'p16' : ns === P15_NS ? 'p15' : 'p14';
18300
- const inner = kind === 'side' ? `<${prefix}:${type}${gen_transition_dir([
18776
+ const inner = kind === 'side' ? `<${prefix}:${type}${dirAttr([
18301
18777
  'l',
18302
18778
  'r',
18303
18779
  'u',
18304
18780
  'd'
18305
- ], t, 'l')}/>` : kind === 'orient' ? `<${prefix}:${type}${gen_transition_dir([
18781
+ ], t)}/>` : kind === 'orient' ? `<${prefix}:${type}${dirAttr([
18306
18782
  'horz',
18307
18783
  'vert'
18308
- ], t, 'horz')}/>` : kind === 'eight' ? `<${prefix}:${type}${gen_transition_dir([
18784
+ ], t)}/>` : kind === 'eight' ? `<${prefix}:${type}${dirAttr([
18309
18785
  'l',
18310
18786
  'r',
18311
18787
  'u',
@@ -18314,10 +18790,10 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18314
18790
  'ru',
18315
18791
  'ld',
18316
18792
  'rd'
18317
- ], t, 'l')}/>` : kind === 'inout' ? `<${prefix}:${type}${gen_transition_dir([
18793
+ ], t)}/>` : kind === 'inout' ? `<${prefix}:${type}${dirAttr([
18318
18794
  'in',
18319
18795
  'out'
18320
- ], t, 'out')}/>` : `<${prefix}:${type}/>`;
18796
+ ], t)}/>` : `<${prefix}:${type}/>`;
18321
18797
  const [fbName, fbKind] = BASE[fallbackType];
18322
18798
  const fallback = baseInner(fbName, fbKind, {
18323
18799
  type: fallbackType
@@ -18693,7 +19169,11 @@ function replyXml(reply, authors, fallbackDate) {
18693
19169
  });
18694
19170
  (slide._relsChart || []).forEach((rel)=>{
18695
19171
  lastRid = Math.max(lastRid, rel.rId);
18696
- strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target}"/>`;
19172
+ // OPC Part 2: relationship Target is resolved from the source part. Stored `rel.Target`
19173
+ // is the absolute `/ppt/charts/chartN.xml` form reused as Content_Types PartName.
19174
+ // PowerPoint writes the relative `../charts/chartN.xml`; absolute targets are valid but
19175
+ // non-idiomatic and break stricter consumers (PR 1465 / eliasaronson).
19176
+ strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
18697
19177
  });
18698
19178
  (slide._relsMedia || []).forEach((rel)=>{
18699
19179
  const relRid = rel.rId.toString();
@@ -18820,7 +19300,7 @@ function replyXml(reply, authors, fallbackDate) {
18820
19300
  * @return {string} XML
18821
19301
  */ function makeXmlNotesMasterRel() {
18822
19302
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
18823
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
19303
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme2.xml"/>
18824
19304
  </Relationships>`;
18825
19305
  }
18826
19306
  /**
@@ -18902,6 +19382,55 @@ function unsignedInt(value) {
18902
19382
  }
18903
19383
 
18904
19384
  ;// CONCATENATED MODULE: ./src/xml/slide.ts
19385
+ function xml_slide_define_property(obj, key, value) {
19386
+ if (key in obj) {
19387
+ Object.defineProperty(obj, key, {
19388
+ value: value,
19389
+ enumerable: true,
19390
+ configurable: true,
19391
+ writable: true
19392
+ });
19393
+ } else obj[key] = value;
19394
+ return obj;
19395
+ }
19396
+ function xml_slide_object_spread(target) {
19397
+ for(var i = 1; i < arguments.length; i++){
19398
+ var source = arguments[i] != null ? arguments[i] : {};
19399
+ var ownKeys = Object.keys(source);
19400
+ if (typeof Object.getOwnPropertySymbols === "function") {
19401
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
19402
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19403
+ }));
19404
+ }
19405
+ ownKeys.forEach(function(key) {
19406
+ xml_slide_define_property(target, key, source[key]);
19407
+ });
19408
+ }
19409
+ return target;
19410
+ }
19411
+ function slide_ownKeys(object, enumerableOnly) {
19412
+ var keys = Object.keys(object);
19413
+ if (Object.getOwnPropertySymbols) {
19414
+ var symbols = Object.getOwnPropertySymbols(object);
19415
+ if (enumerableOnly) {
19416
+ symbols = symbols.filter(function(sym) {
19417
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19418
+ });
19419
+ }
19420
+ keys.push.apply(keys, symbols);
19421
+ }
19422
+ return keys;
19423
+ }
19424
+ function slide_object_spread_props(target, source) {
19425
+ source = source != null ? source : {};
19426
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
19427
+ else {
19428
+ slide_ownKeys(Object(source)).forEach(function(key) {
19429
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19430
+ });
19431
+ }
19432
+ return target;
19433
+ }
18905
19434
  /**
18906
19435
  * Slide, layout, and master shape-tree rendering.
18907
19436
  */
@@ -18909,6 +19438,7 @@ function unsignedInt(value) {
18909
19438
 
18910
19439
 
18911
19440
 
19441
+
18912
19442
  function nvPrModIdExt(modId) {
18913
19443
  return genXmlModIdExt(modId).replace(/^<p:extLst>|<\/p:extLst>$/g, '');
18914
19444
  }
@@ -19015,7 +19545,12 @@ function genXmlLine(line) {
19015
19545
  'rnd'
19016
19546
  ].includes(line.cap) ? ` cap="${line.cap}"` : '');
19017
19547
  let xml = `<a:ln${attrs}>`;
19018
- if (line.color) xml += genXmlColorSelection(line);
19548
+ const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
19549
+ if (line.type !== 'none' && (line.color || hasGrad)) {
19550
+ xml += genXmlColorSelection(hasGrad && !line.type ? slide_object_spread_props(xml_slide_object_spread({}, line), {
19551
+ type: 'gradient'
19552
+ }) : line);
19553
+ }
19019
19554
  if (line.dashType) xml += `<a:prstDash val="${line.dashType}"/>`;
19020
19555
  if (line.beginArrowType) xml += `<a:headEnd type="${line.beginArrowType}"/>`;
19021
19556
  if (line.endArrowType) xml += `<a:tailEnd type="${line.endArrowType}"/>`;
@@ -19056,11 +19591,19 @@ function genXmlLine(line) {
19056
19591
  return `<a:reflection blurRad="${blur}" stA="${stA}" endA="0" dist="${dist}" dir="${dir}" sy="${sy}" algn="bl" rotWithShape="0"/>`;
19057
19592
  }
19058
19593
  /**
19059
- * Create the shape/image `a:effectLst` block (shadow + glow + reflection + softEdge).
19060
- * Child order follows ECMA-376 `CT_EffectList`: glow, innerShdw, outerShdw, reflection, softEdge.
19594
+ * Create `a:blur` (ECMA-376 `CT_BlurEffect`). `rad` is EMUs; `grow` omitted unless set.
19595
+ */ function genXmlBlurElement(blur) {
19596
+ const rad = valToPts(blur.radius);
19597
+ const grow = blur.grow === false ? ' grow="0"' : blur.grow === true ? ' grow="1"' : '';
19598
+ return `<a:blur rad="${rad}"${grow}/>`;
19599
+ }
19600
+ /**
19601
+ * Create the shape/image `a:effectLst` block (blur + glow + shadow + reflection + softEdge).
19602
+ * Child order follows ECMA-376 `CT_EffectList`: blur, glow, innerShdw, outerShdw, reflection, softEdge.
19061
19603
  * @note pure - unit conversion must NOT be written back to the caller's options object (issue #20)
19062
19604
  */ function genXmlEffectLst(opts) {
19063
19605
  const parts = [];
19606
+ if (opts.blur && typeof opts.blur.radius === 'number') parts.push(genXmlBlurElement(opts.blur));
19064
19607
  const resolvedGlow = resolveGlowOptions(opts.glow);
19065
19608
  if (resolvedGlow) parts.push(createGlowElement(resolvedGlow));
19066
19609
  const shadow = opts.shadow;
@@ -19151,15 +19694,97 @@ function findShapeCoord(list, id) {
19151
19694
  flipV
19152
19695
  };
19153
19696
  }
19697
+ /**
19698
+ * DrawingML `a:ext` uses ST_PositiveCoordinate, so extents cannot be negative.
19699
+ * Lines treat w/h as endpoint deltas: fold a negative axis into the offset and
19700
+ * flip that axis so the same endpoints (and therefore head/tail arrows) remain.
19701
+ */ function normalizeLineExtents(x, y, cx, cy, flipH, flipV) {
19702
+ if (cx < 0) {
19703
+ x += cx;
19704
+ cx = -cx;
19705
+ flipH = !flipH;
19706
+ }
19707
+ if (cy < 0) {
19708
+ y += cy;
19709
+ cy = -cy;
19710
+ flipV = !flipV;
19711
+ }
19712
+ return {
19713
+ x,
19714
+ y,
19715
+ cx,
19716
+ cy,
19717
+ flipH,
19718
+ flipV
19719
+ };
19720
+ }
19154
19721
  function resolveShapeId(options, idx, usedIds) {
19155
19722
  const requested = options === null || options === void 0 ? void 0 : options.sId;
19156
- const shapeId = requested != null ? requested : idx + 2;
19157
- if (usedIds.has(shapeId)) {
19158
- throw new Error(requested != null ? `sId ${shapeId} is already in use on this slide — object/shape ids must be unique` : `auto-generated shape id ${shapeId} conflicts with an explicit sId — use a higher sId`);
19723
+ let shapeId = requested != null ? requested : idx + 2;
19724
+ if (requested != null) {
19725
+ if (usedIds.has(shapeId)) {
19726
+ throw new Error(`sId ${shapeId} is already in use on this slide — object/shape ids must be unique`);
19727
+ }
19728
+ } else {
19729
+ while(usedIds.has(shapeId))shapeId++;
19159
19730
  }
19160
19731
  usedIds.add(shapeId);
19161
19732
  return shapeId;
19162
19733
  }
19734
+ /** Next unused `p:cNvPr@id` (ECMA-376 §5.1.2.1.9 `CT_NonVisualDrawingProps`). Slide-number used to hardcode 25 (SCV-Soft 9f66206). */ function nextUnusedShapeId(usedIds, start = 2) {
19735
+ let shapeId = start;
19736
+ while(usedIds.has(shapeId))shapeId++;
19737
+ usedIds.add(shapeId);
19738
+ return shapeId;
19739
+ }
19740
+ /**
19741
+ * DrawingML `a:custGeom` (ECMA-376 §5.1.11.5).
19742
+ * `pathW`/`pathH` mean coordinates are already in the path EMU space (SVG-derived paths).
19743
+ */ function genCustGeomXml(slideItemObj, cx, cy, slide) {
19744
+ var _ref, _ref1;
19745
+ var _opts_paths;
19746
+ const opts = slideItemObj.options;
19747
+ const pathArrays = (opts === null || opts === void 0 ? void 0 : (_opts_paths = opts.paths) === null || _opts_paths === void 0 ? void 0 : _opts_paths.length) ? opts.paths : (opts === null || opts === void 0 ? void 0 : opts.points) ? [
19748
+ opts.points
19749
+ ] : [];
19750
+ const pathW = (_ref = opts === null || opts === void 0 ? void 0 : opts.pathW) !== null && _ref !== void 0 ? _ref : cx;
19751
+ const pathH = (_ref1 = opts === null || opts === void 0 ? void 0 : opts.pathH) !== null && _ref1 !== void 0 ? _ref1 : cy;
19752
+ const rawEmu = typeof (opts === null || opts === void 0 ? void 0 : opts.pathW) === 'number';
19753
+ const emuX = (v)=>rawEmu ? Math.round(Number(v) || 0) : getSmartParseNumber(v !== null && v !== void 0 ? v : 0, 'X', slide._presLayout);
19754
+ const emuY = (v)=>rawEmu ? Math.round(Number(v) || 0) : getSmartParseNumber(v !== null && v !== void 0 ? v : 0, 'Y', slide._presLayout);
19755
+ let xml = '<a:custGeom><a:avLst /><a:gdLst></a:gdLst><a:ahLst /><a:cxnLst></a:cxnLst>';
19756
+ xml += '<a:rect l="l" t="t" r="r" b="b" />';
19757
+ xml += '<a:pathLst>';
19758
+ for (const points of pathArrays){
19759
+ xml += `<a:path w="${Math.round(pathW)}" h="${Math.round(pathH)}">`;
19760
+ points === null || points === void 0 ? void 0 : points.forEach((point, i)=>{
19761
+ if ('curve' in point) {
19762
+ switch(point.curve.type){
19763
+ case 'arc':
19764
+ xml += `<a:arcTo hR="${emuY(point.curve.hR)}" wR="${emuX(point.curve.wR)}" stAng="${convertRotationDegrees(point.curve.stAng)}" swAng="${convertRotationDegrees(point.curve.swAng)}" />`;
19765
+ break;
19766
+ case 'cubic':
19767
+ xml += `<a:cubicBezTo><a:pt x="${emuX(point.curve.x1)}" y="${emuY(point.curve.y1)}" /><a:pt x="${emuX(point.curve.x2)}" y="${emuY(point.curve.y2)}" /><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:cubicBezTo>`;
19768
+ break;
19769
+ case 'quadratic':
19770
+ xml += `<a:quadBezTo><a:pt x="${emuX(point.curve.x1)}" y="${emuY(point.curve.y1)}" /><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:quadBezTo>`;
19771
+ break;
19772
+ default:
19773
+ break;
19774
+ }
19775
+ } else if ('close' in point) {
19776
+ xml += '<a:close />';
19777
+ } else if (point.moveTo || i === 0) {
19778
+ xml += `<a:moveTo><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:moveTo>`;
19779
+ } else {
19780
+ xml += `<a:lnTo><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:lnTo>`;
19781
+ }
19782
+ });
19783
+ xml += '</a:path>';
19784
+ }
19785
+ xml += '</a:pathLst></a:custGeom>';
19786
+ return xml;
19787
+ }
19163
19788
  /**
19164
19789
  * Transforms a slide or slideLayout to resulting XML string - Creates `ppt/slide*.xml`
19165
19790
  * @param {PresSlide|SlideLayout} slideObject - slide object created within createSlideObject
@@ -19201,142 +19826,154 @@ function slideObjectToXml(slide) {
19201
19826
  // STEP 3: Loop over all Slide.data objects and add them to this slide
19202
19827
  const usedShapeIds = new Set();
19203
19828
  const shapeCoordinates = [];
19204
- slide._slideObjects.forEach((slideItemObj, idx)=>{
19205
- var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
19206
- let x = 0;
19207
- let y = 0;
19208
- let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
19209
- let cy = 0;
19210
- let placeholderObj;
19211
- let locationAttr = '';
19212
- let arrTabRows = [];
19213
- let objTabOpts = {};
19214
- slideItemObj.options = slideItemObj.options || {};
19215
- const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
19216
- // Keep resolved id on options so animations / later passes can target the same cNvPr id
19217
- slideItemObj.options.sId = shapeId;
19218
- shapeCoordinates.push({
19219
- id: shapeId,
19220
- position: {
19221
- x: slideItemObj.options.x,
19222
- y: slideItemObj.options.y,
19223
- w: slideItemObj.options.w,
19224
- h: slideItemObj.options.h
19829
+ const renderObjectList = (objects)=>{
19830
+ objects.forEach((slideItemObj, idx)=>{
19831
+ var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
19832
+ let x = 0;
19833
+ let y = 0;
19834
+ let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
19835
+ let cy = 0;
19836
+ let placeholderObj;
19837
+ let locationAttr = '';
19838
+ let arrTabRows = [];
19839
+ let objTabOpts = {};
19840
+ slideItemObj.options = slideItemObj.options || {};
19841
+ const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
19842
+ // Keep resolved id on options so animations / later passes can target the same cNvPr id
19843
+ slideItemObj.options.sId = shapeId;
19844
+ shapeCoordinates.push({
19845
+ id: shapeId,
19846
+ position: {
19847
+ x: slideItemObj.options.x,
19848
+ y: slideItemObj.options.y,
19849
+ w: slideItemObj.options.w,
19850
+ h: slideItemObj.options.h
19851
+ }
19852
+ });
19853
+ let intColCnt = 0;
19854
+ let cellOpts;
19855
+ let strXml = '';
19856
+ const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
19857
+ const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
19858
+ if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
19859
+ placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
19860
+ var _object_options, _slideItemObj_options;
19861
+ return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
19862
+ })[0];
19225
19863
  }
19226
- });
19227
- let intColCnt = 0;
19228
- let cellOpts;
19229
- let strXml = '';
19230
- const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
19231
- const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
19232
- if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
19233
- placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
19234
- var _object_options, _slideItemObj_options;
19235
- return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
19236
- })[0];
19237
- }
19238
- // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19239
- 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;
19240
- if (connectorLayout) {
19241
- x = connectorLayout.x;
19242
- y = connectorLayout.y;
19243
- cx = connectorLayout.cx;
19244
- cy = connectorLayout.cy;
19245
- slideItemObj.options.flipH = connectorLayout.flipH;
19246
- slideItemObj.options.flipV = connectorLayout.flipV;
19247
- } else {
19248
- if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
19249
- if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
19250
- if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
19251
- if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
19252
- }
19253
- // Set w/h now that smart parse is done.
19254
- // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
19255
- // and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
19256
- // corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
19257
- let imgWidth = cx;
19258
- let imgHeight = cy;
19259
- if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
19260
- // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
19261
- // EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
19262
- // coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
19263
- const rawW = slideItemObj.options.w;
19264
- const rawH = slideItemObj.options.h;
19265
- if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
19266
- else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
19267
- }
19268
- // If using a placeholder then inherit it's position
19269
- if (placeholderObj) {
19270
- var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5, _placeholderObj_options6, _placeholderObj_options7, _placeholderObj_options8, _placeholderObj_options9, _placeholderObj_options10, _placeholderObj_options11;
19271
- if (((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options.x) || ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1.x) === 0) x = getSmartParseNumber((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.x, 'X', slide._presLayout);
19272
- if (((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.y) || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.y) === 0) y = getSmartParseNumber((_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.y, 'Y', slide._presLayout);
19273
- if (((_placeholderObj_options6 = placeholderObj.options) === null || _placeholderObj_options6 === void 0 ? void 0 : _placeholderObj_options6.w) || ((_placeholderObj_options7 = placeholderObj.options) === null || _placeholderObj_options7 === void 0 ? void 0 : _placeholderObj_options7.w) === 0) cx = getSmartParseNumber((_placeholderObj_options8 = placeholderObj.options) === null || _placeholderObj_options8 === void 0 ? void 0 : _placeholderObj_options8.w, 'X', slide._presLayout);
19274
- if (((_placeholderObj_options9 = placeholderObj.options) === null || _placeholderObj_options9 === void 0 ? void 0 : _placeholderObj_options9.h) || ((_placeholderObj_options10 = placeholderObj.options) === null || _placeholderObj_options10 === void 0 ? void 0 : _placeholderObj_options10.h) === 0) cy = getSmartParseNumber((_placeholderObj_options11 = placeholderObj.options) === null || _placeholderObj_options11 === void 0 ? void 0 : _placeholderObj_options11.h, 'Y', slide._presLayout);
19275
- // Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
19276
- // placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
19277
- imgWidth = cx;
19278
- imgHeight = cy;
19279
- }
19280
- //
19281
- if (slideItemObj.options.flipH) locationAttr += ' flipH="1"';
19282
- if (slideItemObj.options.flipV) locationAttr += ' flipV="1"';
19283
- if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
19284
- // B: Add OBJECT to the current Slide
19285
- switch(slideItemObj._type){
19286
- case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19287
- {
19288
- var _slideItemObj_arrTabRows, _slide__slideNum;
19289
- arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19290
- objTabOpts = slideItemObj.options;
19291
- intColCnt = 0;
19292
- // Calc number of columns
19293
- // NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
19294
- // ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
19295
- arrTabRows[0].forEach((cell)=>{
19296
- cellOpts = cell.options;
19297
- intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
19298
- });
19299
- // STEP 1: Start Table XML
19300
- // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19301
- 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}"/>`;
19302
- // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19303
- const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19304
- 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>';
19305
- strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19306
- typeof slideItemObj.options.modId === 'number' ? nvPrModIdExt(slideItemObj.options.modId) : tblModId
19307
- ])}` + '</p:nvGraphicFramePr>';
19308
- 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>`;
19309
- strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
19310
- // NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
19311
- strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
19312
- // STEP 2: Set column widths
19313
- // Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
19314
- // A: Col widths provided?
19315
- // B: Table Width provided without colW? Then distribute cols
19316
- if (Array.isArray(objTabOpts.colW)) {
19317
- strXml += '<a:tblGrid>';
19318
- for(let col = 0; col < intColCnt; col++){
19319
- let w = inch2Emu(objTabOpts.colW[col]);
19320
- if (w == null || isNaN(w)) {
19321
- w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
19864
+ // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19865
+ 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;
19866
+ if (connectorLayout) {
19867
+ x = connectorLayout.x;
19868
+ y = connectorLayout.y;
19869
+ cx = connectorLayout.cx;
19870
+ cy = connectorLayout.cy;
19871
+ slideItemObj.options.flipH = connectorLayout.flipH;
19872
+ slideItemObj.options.flipV = connectorLayout.flipV;
19873
+ } else {
19874
+ if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
19875
+ if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
19876
+ if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
19877
+ if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
19878
+ }
19879
+ // Set w/h now that smart parse is done.
19880
+ // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
19881
+ // and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
19882
+ // corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
19883
+ let imgWidth = cx;
19884
+ let imgHeight = cy;
19885
+ if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
19886
+ // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
19887
+ // EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
19888
+ // coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
19889
+ const rawW = slideItemObj.options.w;
19890
+ const rawH = slideItemObj.options.h;
19891
+ if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
19892
+ else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
19893
+ }
19894
+ // Inherit placeholder geometry only for axes the caller did not set (fujita-h d7e3e93).
19895
+ // addImage always writes x/y/w/h defaults, so `_explicit*` distinguishes unset vs explicit.
19896
+ if (placeholderObj) {
19897
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5, _placeholderObj_options6, _placeholderObj_options7, _placeholderObj_options8, _placeholderObj_options9, _placeholderObj_options10, _placeholderObj_options11;
19898
+ if (!slideItemObj.options._explicitX && (((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options.x) || ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1.x) === 0)) x = getSmartParseNumber((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.x, 'X', slide._presLayout);
19899
+ if (!slideItemObj.options._explicitY && (((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.y) || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.y) === 0)) y = getSmartParseNumber((_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.y, 'Y', slide._presLayout);
19900
+ if (!slideItemObj.options._explicitW && (((_placeholderObj_options6 = placeholderObj.options) === null || _placeholderObj_options6 === void 0 ? void 0 : _placeholderObj_options6.w) || ((_placeholderObj_options7 = placeholderObj.options) === null || _placeholderObj_options7 === void 0 ? void 0 : _placeholderObj_options7.w) === 0)) cx = getSmartParseNumber((_placeholderObj_options8 = placeholderObj.options) === null || _placeholderObj_options8 === void 0 ? void 0 : _placeholderObj_options8.w, 'X', slide._presLayout);
19901
+ if (!slideItemObj.options._explicitH && (((_placeholderObj_options9 = placeholderObj.options) === null || _placeholderObj_options9 === void 0 ? void 0 : _placeholderObj_options9.h) || ((_placeholderObj_options10 = placeholderObj.options) === null || _placeholderObj_options10 === void 0 ? void 0 : _placeholderObj_options10.h) === 0)) cy = getSmartParseNumber((_placeholderObj_options11 = placeholderObj.options) === null || _placeholderObj_options11 === void 0 ? void 0 : _placeholderObj_options11.h, 'Y', slide._presLayout);
19902
+ // Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
19903
+ // placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
19904
+ imgWidth = cx;
19905
+ imgHeight = cy;
19906
+ }
19907
+ let flipH = !!slideItemObj.options.flipH;
19908
+ let flipV = !!slideItemObj.options.flipV;
19909
+ if (slideItemObj.shape === core_enums_SHAPE_TYPE.LINE) {
19910
+ const line = normalizeLineExtents(x, y, cx, cy, flipH, flipV);
19911
+ x = line.x;
19912
+ y = line.y;
19913
+ cx = line.cx;
19914
+ cy = line.cy;
19915
+ flipH = line.flipH;
19916
+ flipV = line.flipV;
19917
+ }
19918
+ if (flipH) locationAttr += ' flipH="1"';
19919
+ if (flipV) locationAttr += ' flipV="1"';
19920
+ if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
19921
+ // B: Add OBJECT to the current Slide
19922
+ switch(slideItemObj._type){
19923
+ case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19924
+ {
19925
+ var _slideItemObj_arrTabRows, _slide__slideNum;
19926
+ arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19927
+ objTabOpts = slideItemObj.options;
19928
+ intColCnt = 0;
19929
+ // Calc number of columns
19930
+ // NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
19931
+ // ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
19932
+ arrTabRows[0].forEach((cell)=>{
19933
+ cellOpts = cell.options;
19934
+ intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
19935
+ });
19936
+ // STEP 1: Start Table XML
19937
+ // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19938
+ 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}"/>`;
19939
+ // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19940
+ const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19941
+ 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>';
19942
+ strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19943
+ typeof slideItemObj.options.modId === 'number' ? nvPrModIdExt(slideItemObj.options.modId) : tblModId
19944
+ ])}` + '</p:nvGraphicFramePr>';
19945
+ 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>`;
19946
+ strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
19947
+ // NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
19948
+ strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
19949
+ // STEP 2: Set column widths
19950
+ // Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
19951
+ // A: Col widths provided?
19952
+ // B: Table Width provided without colW? Then distribute cols
19953
+ if (Array.isArray(objTabOpts.colW)) {
19954
+ strXml += '<a:tblGrid>';
19955
+ for(let col = 0; col < intColCnt; col++){
19956
+ let w = inch2Emu(objTabOpts.colW[col]);
19957
+ if (w == null || isNaN(w)) {
19958
+ w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
19959
+ }
19960
+ strXml += `<a:gridCol w="${Math.round(w)}"/>`;
19322
19961
  }
19323
- strXml += `<a:gridCol w="${Math.round(w)}"/>`;
19324
- }
19325
- strXml += '</a:tblGrid>';
19326
- } else {
19327
- let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
19328
- if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
19329
- strXml += '<a:tblGrid>';
19330
- for(let colw = 0; colw < intColCnt; colw++){
19331
- strXml += `<a:gridCol w="${intColW}"/>`;
19962
+ strXml += '</a:tblGrid>';
19963
+ } else {
19964
+ let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
19965
+ if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
19966
+ strXml += '<a:tblGrid>';
19967
+ for(let colw = 0; colw < intColCnt; colw++){
19968
+ strXml += `<a:gridCol w="${intColW}"/>`;
19969
+ }
19970
+ strXml += '</a:tblGrid>';
19332
19971
  }
19333
- strXml += '</a:tblGrid>';
19334
- }
19335
- // STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
19336
- // Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
19337
- // so a simple loop below in XML building wont suffice to build table correctly.
19338
- // We have to build an actual grid now
19339
- /*
19972
+ // STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
19973
+ // Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
19974
+ // so a simple loop below in XML building wont suffice to build table correctly.
19975
+ // We have to build an actual grid now
19976
+ /*
19340
19977
  EX: (A0:rowspan=3, B1:rowspan=2, C1:colspan=2)
19341
19978
 
19342
19979
  /------|------|------|------\
@@ -19345,567 +19982,582 @@ function slideObjectToXml(slide) {
19345
19982
  | | | C2 | D2 |
19346
19983
  \------|------|------|------/
19347
19984
  */ // A: add _hmerge cell for colspan. should reserve rowspan
19348
- arrTabRows.forEach((cells)=>{
19349
- for(let cIdx = 0; cIdx < cells.length;){
19350
- var _cell_options, _cell_options1;
19351
- const cell = cells[cIdx];
19352
- const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
19353
- const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
19354
- if (colspan && colspan > 1) {
19355
- const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
19356
- return {
19985
+ arrTabRows.forEach((cells)=>{
19986
+ for(let cIdx = 0; cIdx < cells.length;){
19987
+ var _cell_options, _cell_options1;
19988
+ const cell = cells[cIdx];
19989
+ const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
19990
+ const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
19991
+ if (colspan && colspan > 1) {
19992
+ const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
19993
+ return {
19994
+ _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19995
+ options: {
19996
+ rowspan
19997
+ },
19998
+ _hmerge: true
19999
+ };
20000
+ });
20001
+ cells.splice(cIdx + 1, 0, ...vMergeCells);
20002
+ cIdx += colspan;
20003
+ } else {
20004
+ cIdx += 1;
20005
+ }
20006
+ }
20007
+ });
20008
+ // B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
20009
+ arrTabRows.forEach((cells, rIdx)=>{
20010
+ const nextRow = arrTabRows[rIdx + 1];
20011
+ if (!nextRow) return;
20012
+ cells.forEach((cell, cIdx)=>{
20013
+ var _cell_options, _cell_options1;
20014
+ const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
20015
+ const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
20016
+ const _hmerge = cell._hmerge;
20017
+ if (rowspan && rowspan > 1) {
20018
+ const hMergeCell = {
19357
20019
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19358
20020
  options: {
19359
- rowspan
20021
+ colspan
19360
20022
  },
19361
- _hmerge: true
20023
+ _rowContinue: rowspan - 1,
20024
+ _vmerge: true,
20025
+ _hmerge
19362
20026
  };
19363
- });
19364
- cells.splice(cIdx + 1, 0, ...vMergeCells);
19365
- cIdx += colspan;
19366
- } else {
19367
- cIdx += 1;
19368
- }
19369
- }
19370
- });
19371
- // B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
19372
- arrTabRows.forEach((cells, rIdx)=>{
19373
- const nextRow = arrTabRows[rIdx + 1];
19374
- if (!nextRow) return;
19375
- cells.forEach((cell, cIdx)=>{
19376
- var _cell_options, _cell_options1;
19377
- const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
19378
- const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
19379
- const _hmerge = cell._hmerge;
19380
- if (rowspan && rowspan > 1) {
19381
- const hMergeCell = {
19382
- _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19383
- options: {
19384
- colspan
19385
- },
19386
- _rowContinue: rowspan - 1,
19387
- _vmerge: true,
19388
- _hmerge
19389
- };
19390
- nextRow.splice(cIdx, 0, hMergeCell);
19391
- }
20027
+ nextRow.splice(cIdx, 0, hMergeCell);
20028
+ }
20029
+ });
19392
20030
  });
19393
- });
19394
- // STEP 4: Build table rows/cells
19395
- arrTabRows.forEach((cells, rIdx)=>{
19396
- var _slideItemObj_options;
19397
- const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
19398
- // A: Table Height provided without rowH? Then distribute rows
19399
- let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
19400
- ;
19401
- if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
19402
- else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
19403
- else if (itemOpts.cy || itemOpts.h) {
19404
- intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19405
- }
19406
- // B: Start row
19407
- strXml += `<a:tr h="${intRowH}">`;
19408
- // C: Loop over each CELL
19409
- cells.forEach((cellObj)=>{
19410
- var _ref, _ref1;
19411
- var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
19412
- const cell = cellObj;
19413
- const cellSpanAttrs = {
19414
- rowSpan: ((_ref = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan) !== null && _ref !== void 0 ? _ref : 0) > 1 ? (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan : undefined,
19415
- gridSpan: ((_ref1 = (_cell_options2 = cell.options) === null || _cell_options2 === void 0 ? void 0 : _cell_options2.colspan) !== null && _ref1 !== void 0 ? _ref1 : 0) > 1 ? (_cell_options3 = cell.options) === null || _cell_options3 === void 0 ? void 0 : _cell_options3.colspan : undefined,
19416
- vMerge: cell._vmerge ? 1 : undefined,
19417
- hMerge: cell._hmerge ? 1 : undefined
19418
- };
19419
- let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
19420
- k,
19421
- cellSpanAttrs[k]
19422
- ]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
19423
- if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
19424
- // 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
19425
- if (cell._hmerge || cell._vmerge) {
19426
- strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
19427
- return;
20031
+ // STEP 4: Build table rows/cells
20032
+ arrTabRows.forEach((cells, rIdx)=>{
20033
+ var _slideItemObj_options;
20034
+ const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
20035
+ // A: Table Height provided without rowH? Then distribute rows
20036
+ let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
20037
+ ;
20038
+ if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
20039
+ else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
20040
+ else if (itemOpts.cy || itemOpts.h) {
20041
+ intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19428
20042
  }
19429
- // 2: OPTIONS: Build/set cell options
19430
- const cellOpts = cell.options || {};
19431
- cell.options = cellOpts;
19432
- [
19433
- 'align',
19434
- 'bold',
19435
- 'border',
19436
- 'color',
19437
- 'fill',
19438
- 'fontFace',
19439
- 'fontSize',
19440
- 'margin',
19441
- 'textDirection',
19442
- 'vert',
19443
- 'underline',
19444
- 'valign'
19445
- ].forEach((name)=>{
19446
- if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
19447
- });
19448
- const cellValign = cellOpts.valign ? ` anchor="${cellOpts.valign.replace(/^c$/i, 'ctr').replace(/^m$/i, 'ctr').replace('center', 'ctr').replace('middle', 'ctr').replace('top', 't').replace('btm', 'b').replace('bottom', 'b')}"` : '';
19449
- // `vert` = Martin-N alias of `textDirection`
19450
- const cellDir = cellOpts.textDirection || cellOpts.vert;
19451
- const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
19452
- let fillColor = ((_cell__optImp = cell._optImp) === null || _cell__optImp === void 0 ? void 0 : (_cell__optImp_fill = _cell__optImp.fill) === null || _cell__optImp_fill === void 0 ? void 0 : _cell__optImp_fill.color) ? cell._optImp.fill.color : ((_cell__optImp1 = cell._optImp) === null || _cell__optImp1 === void 0 ? void 0 : _cell__optImp1.fill) && typeof cell._optImp.fill === 'string' ? cell._optImp.fill : '';
19453
- fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
19454
- const cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
19455
- let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
19456
- if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
19457
- cellMargin,
19458
- cellMargin,
19459
- cellMargin,
19460
- cellMargin
19461
- ];
19462
- // Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
19463
- if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
19464
- cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
19465
- /** FUTURE: DEPRECATED:
19466
- * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
19467
- * - We cant introduce a breaking change before v4.0, so...
19468
- */ 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])}"`;
19469
- // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
19470
- // 4: Set CELL content and properties ==================================
19471
- strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
19472
- // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
19473
- // FIXME: 20200525: ^^^
19474
- // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
19475
- // 5: Borders: Add any borders
19476
- if (cellOpts.border && Array.isArray(cellOpts.border)) {
19477
- const border = cellOpts.border;
20043
+ // B: Start row
20044
+ strXml += `<a:tr h="${intRowH}">`;
20045
+ // C: Loop over each CELL
20046
+ cells.forEach((cellObj)=>{
20047
+ var _ref, _ref1;
20048
+ var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
20049
+ const cell = cellObj;
20050
+ const cellSpanAttrs = {
20051
+ rowSpan: ((_ref = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan) !== null && _ref !== void 0 ? _ref : 0) > 1 ? (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan : undefined,
20052
+ gridSpan: ((_ref1 = (_cell_options2 = cell.options) === null || _cell_options2 === void 0 ? void 0 : _cell_options2.colspan) !== null && _ref1 !== void 0 ? _ref1 : 0) > 1 ? (_cell_options3 = cell.options) === null || _cell_options3 === void 0 ? void 0 : _cell_options3.colspan : undefined,
20053
+ vMerge: cell._vmerge ? 1 : undefined,
20054
+ hMerge: cell._hmerge ? 1 : undefined
20055
+ };
20056
+ let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
20057
+ k,
20058
+ cellSpanAttrs[k]
20059
+ ]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
20060
+ if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
20061
+ // 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
20062
+ if (cell._hmerge || cell._vmerge) {
20063
+ strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
20064
+ return;
20065
+ }
20066
+ // 2: OPTIONS: Build/set cell options
20067
+ const cellOpts = cell.options || {};
20068
+ cell.options = cellOpts;
19478
20069
  [
19479
- {
19480
- idx: 3,
19481
- name: 'lnL'
19482
- },
19483
- {
19484
- idx: 1,
19485
- name: 'lnR'
19486
- },
19487
- {
19488
- idx: 0,
19489
- name: 'lnT'
19490
- },
19491
- {
19492
- idx: 2,
19493
- name: 'lnB'
19494
- }
19495
- ].forEach((obj)=>{
19496
- if (border[obj.idx].type !== 'none') {
19497
- strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
19498
- strXml += `<a:solidFill>${createColorElement(border[obj.idx].color)}</a:solidFill>`;
19499
- 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"/>`;
19500
- strXml += `</a:${obj.name}>`;
20070
+ 'align',
20071
+ 'bold',
20072
+ 'border',
20073
+ 'color',
20074
+ 'fill',
20075
+ 'fontFace',
20076
+ 'fontSize',
20077
+ 'margin',
20078
+ 'textDirection',
20079
+ 'vert',
20080
+ 'underline',
20081
+ 'valign'
20082
+ ].forEach((name)=>{
20083
+ if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
20084
+ });
20085
+ const cellValign = cellOpts.valign ? ` anchor="${cellOpts.valign.replace(/^c$/i, 'ctr').replace(/^m$/i, 'ctr').replace('center', 'ctr').replace('middle', 'ctr').replace('top', 't').replace('btm', 'b').replace('bottom', 'b')}"` : '';
20086
+ // `vert` = Martin-N alias of `textDirection`
20087
+ const cellDir = cellOpts.textDirection || cellOpts.vert;
20088
+ const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
20089
+ let fillColor = ((_cell__optImp = cell._optImp) === null || _cell__optImp === void 0 ? void 0 : (_cell__optImp_fill = _cell__optImp.fill) === null || _cell__optImp_fill === void 0 ? void 0 : _cell__optImp_fill.color) ? cell._optImp.fill.color : ((_cell__optImp1 = cell._optImp) === null || _cell__optImp1 === void 0 ? void 0 : _cell__optImp1.fill) && typeof cell._optImp.fill === 'string' ? cell._optImp.fill : '';
20090
+ fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
20091
+ let cellFill;
20092
+ if (cellOpts._fillRid) {
20093
+ const fillRel = (slide._relsMedia || []).find((rel)=>rel.rId === cellOpts._fillRid);
20094
+ if ((fillRel === null || fillRel === void 0 ? void 0 : fillRel.extn) === 'svg') {
20095
+ var _cellOpts__fillRid;
20096
+ const pngRid = ((_cellOpts__fillRid = cellOpts._fillRid) !== null && _cellOpts__fillRid !== void 0 ? _cellOpts__fillRid : 0) - 1;
20097
+ cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${pngRid}"><a:extLst><a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}"><asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${cellOpts._fillRid}"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
19501
20098
  } else {
19502
- strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
20099
+ cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${cellOpts._fillRid}"/><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
19503
20100
  }
19504
- });
19505
- }
19506
- // 6: Close cell Properties & Cell
19507
- strXml += cellFill;
19508
- strXml += ' </a:tcPr>';
19509
- strXml += ' </a:tc>';
20101
+ } else {
20102
+ cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
20103
+ }
20104
+ let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
20105
+ if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
20106
+ cellMargin,
20107
+ cellMargin,
20108
+ cellMargin,
20109
+ cellMargin
20110
+ ];
20111
+ // Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
20112
+ if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
20113
+ cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
20114
+ /** FUTURE: DEPRECATED:
20115
+ * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
20116
+ * - We cant introduce a breaking change before v4.0, so...
20117
+ */ 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])}"`;
20118
+ // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
20119
+ // 4: Set CELL content and properties ==================================
20120
+ strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
20121
+ // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
20122
+ // FIXME: 20200525: ^^^
20123
+ // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
20124
+ // 5: Borders: Add any borders
20125
+ if (cellOpts.border && Array.isArray(cellOpts.border)) {
20126
+ const border = cellOpts.border;
20127
+ [
20128
+ {
20129
+ idx: 3,
20130
+ name: 'lnL'
20131
+ },
20132
+ {
20133
+ idx: 1,
20134
+ name: 'lnR'
20135
+ },
20136
+ {
20137
+ idx: 0,
20138
+ name: 'lnT'
20139
+ },
20140
+ {
20141
+ idx: 2,
20142
+ name: 'lnB'
20143
+ }
20144
+ ].forEach((obj)=>{
20145
+ if (border[obj.idx].type !== 'none') {
20146
+ const borderTransparency = border[obj.idx].transparency;
20147
+ const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
20148
+ strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
20149
+ strXml += `<a:solidFill>${createColorElement(border[obj.idx].color, borderAlpha)}</a:solidFill>`;
20150
+ 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"/>`;
20151
+ strXml += `</a:${obj.name}>`;
20152
+ } else {
20153
+ strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
20154
+ }
20155
+ });
20156
+ }
20157
+ // 6: Close cell Properties & Cell
20158
+ strXml += cellFill;
20159
+ strXml += ' </a:tcPr>';
20160
+ strXml += ' </a:tc>';
20161
+ });
20162
+ // D: Complete row
20163
+ strXml += '</a:tr>';
19510
20164
  });
19511
- // D: Complete row
19512
- strXml += '</a:tr>';
19513
- });
19514
- // STEP 5: Complete table
19515
- strXml += ' </a:tbl>';
19516
- strXml += ' </a:graphicData>';
19517
- strXml += ' </a:graphic>';
19518
- strXml += '</p:graphicFrame>';
19519
- // STEP 6: Set table XML
19520
- strSlideXml += strXml;
19521
- // LAST: Increment counter
19522
- intTableNum++;
19523
- break;
19524
- }
19525
- case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
19526
- case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
19527
- {
19528
- var _slideItemObj_options_line1;
19529
- const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
19530
- // Lines can have zero cy, but text should not
19531
- if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
19532
- // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
19533
- // A: Start SHAPE / CONNECTOR ============================================
19534
- if (isConnector) {
19535
- var _ref, _ref1;
19536
- var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
19537
- strSlideXml += '<p:cxnSp>';
19538
- strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
19539
- 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>`;
19540
- strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
19541
- nvPrModIdExt(slideItemObj.options.modId)
19542
- ])}</p:nvCxnSpPr><p:spPr>`;
19543
- } else {
19544
- var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
19545
- strSlideXml += '<p:sp>';
19546
- // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
19547
- strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
19548
- // <Hyperlink>
19549
- if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
19550
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
19551
- }
19552
- if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
19553
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
19554
- }
19555
- // </Hyperlink>
19556
- strSlideXml += '</p:cNvPr>';
19557
- // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
19558
- const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
19559
- strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
19560
- strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19561
- nvPrModIdExt(slideItemObj.options.modId)
19562
- ]);
19563
- strSlideXml += '</p:nvSpPr><p:spPr>';
20165
+ // STEP 5: Complete table
20166
+ strXml += ' </a:tbl>';
20167
+ strXml += ' </a:graphicData>';
20168
+ strXml += ' </a:graphic>';
20169
+ strXml += '</p:graphicFrame>';
20170
+ // STEP 6: Set table XML
20171
+ strSlideXml += strXml;
20172
+ // LAST: Increment counter
20173
+ intTableNum++;
20174
+ break;
19564
20175
  }
19565
- strSlideXml += `<a:xfrm${locationAttr}>`;
19566
- strSlideXml += `<a:off x="${x}" y="${y}"/>`;
19567
- strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19568
- if (!isConnector && slideItemObj.shape === 'custGeom') {
19569
- var _slideItemObj_options_points;
19570
- strSlideXml += '<a:custGeom><a:avLst />';
19571
- strSlideXml += '<a:gdLst>';
19572
- strSlideXml += '</a:gdLst>';
19573
- strSlideXml += '<a:ahLst />';
19574
- strSlideXml += '<a:cxnLst>';
19575
- strSlideXml += '</a:cxnLst>';
19576
- strSlideXml += '<a:rect l="l" t="t" r="r" b="b" />';
19577
- strSlideXml += '<a:pathLst>';
19578
- strSlideXml += `<a:path w="${cx}" h="${cy}">`;
19579
- (_slideItemObj_options_points = slideItemObj.options.points) === null || _slideItemObj_options_points === void 0 ? void 0 : _slideItemObj_options_points.forEach((point, i)=>{
19580
- if ('curve' in point) {
19581
- switch(point.curve.type){
19582
- case 'arc':
19583
- strSlideXml += `<a:arcTo hR="${getSmartParseNumber(point.curve.hR, 'Y', slide._presLayout)}" wR="${getSmartParseNumber(point.curve.wR, 'X', slide._presLayout)}" stAng="${convertRotationDegrees(point.curve.stAng)}" swAng="${convertRotationDegrees(point.curve.swAng)}" />`;
19584
- break;
19585
- case 'cubic':
19586
- strSlideXml += `<a:cubicBezTo>
19587
- <a:pt x="${getSmartParseNumber(point.curve.x1, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y1, 'Y', slide._presLayout)}" />
19588
- <a:pt x="${getSmartParseNumber(point.curve.x2, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y2, 'Y', slide._presLayout)}" />
19589
- <a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" />
19590
- </a:cubicBezTo>`;
19591
- break;
19592
- case 'quadratic':
19593
- strSlideXml += `<a:quadBezTo>
19594
- <a:pt x="${getSmartParseNumber(point.curve.x1, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y1, 'Y', slide._presLayout)}" />
19595
- <a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" />
19596
- </a:quadBezTo>`;
19597
- break;
19598
- default:
19599
- break;
20176
+ case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
20177
+ case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
20178
+ {
20179
+ var _slideItemObj_options_line1;
20180
+ const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
20181
+ // Lines can have zero cy, but text should not
20182
+ if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
20183
+ // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
20184
+ // A: Start SHAPE / CONNECTOR ============================================
20185
+ if (isConnector) {
20186
+ var _ref, _ref1;
20187
+ var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
20188
+ strSlideXml += '<p:cxnSp>';
20189
+ strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
20190
+ 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>`;
20191
+ strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
20192
+ nvPrModIdExt(slideItemObj.options.modId)
20193
+ ])}</p:nvCxnSpPr><p:spPr>`;
20194
+ } else {
20195
+ var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
20196
+ strSlideXml += '<p:sp>';
20197
+ // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
20198
+ strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
20199
+ // <Hyperlink>
20200
+ if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
20201
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
20202
+ }
20203
+ if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
20204
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20205
+ }
20206
+ // </Hyperlink>
20207
+ strSlideXml += '</p:cNvPr>';
20208
+ // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
20209
+ const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
20210
+ strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
20211
+ strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20212
+ nvPrModIdExt(slideItemObj.options.modId)
20213
+ ]);
20214
+ strSlideXml += '</p:nvSpPr><p:spPr>';
20215
+ }
20216
+ strSlideXml += `<a:xfrm${locationAttr}>`;
20217
+ strSlideXml += `<a:off x="${x}" y="${y}"/>`;
20218
+ strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20219
+ if (!isConnector && slideItemObj.shape === 'custGeom') {
20220
+ strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
20221
+ } else {
20222
+ var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
20223
+ strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
20224
+ // `rectRadius: 0` is a valid sharp-corner adj (ECMA-376 §5.1.11 preset geom `gd name="adj"`).
20225
+ if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
20226
+ strSlideXml += `<a:gd name="adj" fmla="val ${Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(cx, cy))}"/>`;
20227
+ } else if (slideItemObj.options.angleRange) {
20228
+ for(let i = 0; i < 2; i++){
20229
+ const angle = slideItemObj.options.angleRange[i];
20230
+ strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
19600
20231
  }
19601
- } else if ('close' in point) {
19602
- strSlideXml += '<a:close />';
19603
- } else if (point.moveTo || i === 0) {
19604
- strSlideXml += `<a:moveTo><a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" /></a:moveTo>`;
19605
- } else {
19606
- strSlideXml += `<a:lnTo><a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" /></a:lnTo>`;
20232
+ if (slideItemObj.options.arcThicknessRatio) {
20233
+ strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
20234
+ }
20235
+ }
20236
+ 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)) {
20237
+ slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
20238
+ strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20239
+ });
19607
20240
  }
20241
+ strSlideXml += '</a:avLst></a:prstGeom>';
20242
+ }
20243
+ // Option: FILL
20244
+ strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
20245
+ // shape Type: LINE: line color
20246
+ if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20247
+ // EFFECTS: shadow / glow / softEdge / reflection
20248
+ // REF: @see http://officeopenxml.com/drwSp-effects.php
20249
+ strSlideXml += genXmlEffectLst({
20250
+ shadow: slideItemObj.options.shadow,
20251
+ glow: slideItemObj.options.glow,
20252
+ softEdge: slideItemObj.options.softEdge,
20253
+ reflection: slideItemObj.options.reflection,
20254
+ blur: slideItemObj.options.blur
19608
20255
  });
19609
- strSlideXml += '</a:path>';
19610
- strSlideXml += '</a:pathLst>';
19611
- strSlideXml += '</a:custGeom>';
20256
+ // B: Close shape Properties
20257
+ strSlideXml += '</p:spPr>';
20258
+ if (isConnector) {
20259
+ // Connectors have no text body
20260
+ strSlideXml += '</p:cxnSp>';
20261
+ } else {
20262
+ // C: Add formatted text (text body "bodyPr")
20263
+ strSlideXml += genXmlTextBody(slideItemObj);
20264
+ // LAST: Close SHAPE =======================================================
20265
+ strSlideXml += '</p:sp>';
20266
+ }
20267
+ break;
20268
+ }
20269
+ case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
20270
+ var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
20271
+ strSlideXml += '<p:pic>';
20272
+ strSlideXml += ' <p:nvPicPr>';
20273
+ strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
20274
+ if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
20275
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
20276
+ }
20277
+ if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
20278
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20279
+ }
20280
+ strSlideXml += ' </p:cNvPr>';
20281
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
20282
+ strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20283
+ nvPrModIdExt(slideItemObj.options.modId)
20284
+ ]);
20285
+ strSlideXml += ' </p:nvPicPr>';
20286
+ strSlideXml += '<p:blipFill>';
20287
+ // NOTE: This works for both cases: either `path` or `data` contains the SVG
20288
+ if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
20289
+ var _slideItemObj_imageRid;
20290
+ strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
20291
+ strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
20292
+ strSlideXml += ' <a:extLst>';
20293
+ strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
20294
+ strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
20295
+ strSlideXml += ' </a:ext>';
20296
+ strSlideXml += ' </a:extLst>';
20297
+ strSlideXml += '</a:blip>';
19612
20298
  } else {
19613
- var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
19614
- strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
19615
- if (slideItemObj.options.rectRadius) {
19616
- strSlideXml += `<a:gd name="adj" fmla="val ${Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(cx, cy))}"/>`;
19617
- } else if (slideItemObj.options.angleRange) {
19618
- for(let i = 0; i < 2; i++){
19619
- const angle = slideItemObj.options.angleRange[i];
19620
- strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
19621
- }
19622
- if (slideItemObj.options.arcThicknessRatio) {
19623
- strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
19624
- }
20299
+ strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
20300
+ strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
20301
+ strSlideXml += '</a:blip>';
20302
+ }
20303
+ if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
20304
+ const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
20305
+ const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
20306
+ const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
20307
+ const boxY = getSmartParseNumber(sizing.y || 0, 'Y', slide._presLayout);
20308
+ let sourceSize = sizing.type !== 'crop' && typeof slideItemObj.options.w === 'number' && typeof slideItemObj.options.h === 'number' ? {
20309
+ w: slideItemObj.options.w,
20310
+ h: slideItemObj.options.h
20311
+ } : {
20312
+ w: imgWidth,
20313
+ h: imgHeight
20314
+ };
20315
+ // contain/cover only use imgSize as an aspect ratio. Prefer real pixel dims from the
20316
+ // blip so a square placement box does not yield an all-zero `a:srcRect` (no-op crop).
20317
+ // Crop offsets stay in placed-image EMU (ECMA-376 §5.1.10.55).
20318
+ if (sizing.type === 'contain' || sizing.type === 'cover') {
20319
+ const imgRel = (slide._relsMedia || []).find((rel)=>rel.rId === slideItemObj.imageRid);
20320
+ const pixelSize = getImagePixelSize(imgRel === null || imgRel === void 0 ? void 0 : imgRel.data);
20321
+ if (pixelSize) sourceSize = pixelSize;
19625
20322
  }
19626
- 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)) {
19627
- slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
19628
- strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20323
+ if (sourceSize.w > 0 && sourceSize.h > 0) {
20324
+ strSlideXml += ImageSizingXml[sizing.type](sourceSize, {
20325
+ w: boxW,
20326
+ h: boxH,
20327
+ x: boxX,
20328
+ y: boxY
19629
20329
  });
20330
+ } else {
20331
+ strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
20332
+ }
20333
+ // ECMA-376 §5.1.10.55: `srcRect` crops the source blip; the `<a:ext>` frame is the independent
20334
+ // on-slide bounding box. Only `cover`/`contain` resize the frame to the fitted box. For `crop`
20335
+ // the frame must keep the user's w/h container - collapsing it to the crop box (or 0) breaks
20336
+ // rendering (issue #1399).
20337
+ if (sizing.type !== 'crop') {
20338
+ imgWidth = boxW;
20339
+ imgHeight = boxH;
19630
20340
  }
19631
- strSlideXml += '</a:avLst></a:prstGeom>';
20341
+ } else {
20342
+ strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
20343
+ }
20344
+ strSlideXml += '</p:blipFill>';
20345
+ strSlideXml += '<p:spPr>';
20346
+ strSlideXml += ' <a:xfrm' + locationAttr + '>';
20347
+ strSlideXml += ` <a:off x="${x}" y="${y}"/>`;
20348
+ strSlideXml += ` <a:ext cx="${imgWidth}" cy="${imgHeight}"/>`;
20349
+ strSlideXml += ' </a:xfrm>';
20350
+ // Geometry: rectRadius → roundRect; rounding (legacy) → ellipse; else rect
20351
+ // Selective port of niranjan-uma-shankar/feature/html-to-pptx (keeps ellipse back-compat)
20352
+ if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
20353
+ const adjValue = Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(imgWidth, imgHeight));
20354
+ strSlideXml += ` <a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${adjValue}"/></a:avLst></a:prstGeom>`;
20355
+ } else {
20356
+ strSlideXml += ` <a:prstGeom prst="${rounding ? 'ellipse' : 'rect'}"><a:avLst/></a:prstGeom>`;
19632
20357
  }
19633
- // Option: FILL
19634
- strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
19635
- // shape Type: LINE: line color
20358
+ // OUTLINE: picture border/frame (issue #35)
19636
20359
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
19637
20360
  // EFFECTS: shadow / glow / softEdge / reflection
19638
- // REF: @see http://officeopenxml.com/drwSp-effects.php
19639
20361
  strSlideXml += genXmlEffectLst({
19640
20362
  shadow: slideItemObj.options.shadow,
19641
20363
  glow: slideItemObj.options.glow,
19642
20364
  softEdge: slideItemObj.options.softEdge,
19643
- reflection: slideItemObj.options.reflection
20365
+ reflection: slideItemObj.options.reflection,
20366
+ blur: slideItemObj.options.blur
19644
20367
  });
19645
- // B: Close shape Properties
19646
20368
  strSlideXml += '</p:spPr>';
19647
- if (isConnector) {
19648
- // Connectors have no text body
19649
- strSlideXml += '</p:cxnSp>';
20369
+ strSlideXml += '</p:pic>';
20370
+ break;
20371
+ case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
20372
+ if (slideItemObj.mtype === 'online') {
20373
+ var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
20374
+ strSlideXml += '<p:pic>';
20375
+ strSlideXml += ' <p:nvPicPr>';
20376
+ // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
20377
+ strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
20378
+ strSlideXml += ' <p:cNvPicPr/>';
20379
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
20380
+ strSlideXml += ' </p:nvPicPr>';
20381
+ // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
20382
+ 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!
20383
+ strSlideXml += ' <p:spPr>';
20384
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20385
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
20386
+ strSlideXml += ' </p:spPr>';
20387
+ strSlideXml += '</p:pic>';
19650
20388
  } else {
19651
- // C: Add formatted text (text body "bodyPr")
19652
- strSlideXml += genXmlTextBody(slideItemObj);
19653
- // LAST: Close SHAPE =======================================================
19654
- strSlideXml += '</p:sp>';
20389
+ var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
20390
+ // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
20391
+ const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
20392
+ strSlideXml += '<p:pic>';
20393
+ strSlideXml += ' <p:nvPicPr>';
20394
+ // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
20395
+ strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 2}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
20396
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
20397
+ const mediaExtras = genXmlMediaExtras(slideItemObj.options);
20398
+ 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>';
20399
+ 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>' : '';
20400
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
20401
+ mediaExt,
20402
+ narrationExt
20403
+ ] : [
20404
+ mediaExt
20405
+ ]);
20406
+ strSlideXml += ' </p:nvPicPr>';
20407
+ strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid5 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid5 !== void 0 ? _slideItemObj_mediaRid5 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
20408
+ strSlideXml += ' <p:spPr>';
20409
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20410
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
20411
+ strSlideXml += ' </p:spPr>';
20412
+ strSlideXml += '</p:pic>';
19655
20413
  }
19656
20414
  break;
19657
- }
19658
- case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
19659
- var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
19660
- strSlideXml += '<p:pic>';
19661
- strSlideXml += ' <p:nvPicPr>';
19662
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
19663
- if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
19664
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
19665
- }
19666
- if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
19667
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
19668
- }
19669
- strSlideXml += ' </p:cNvPr>';
19670
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
19671
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19672
- nvPrModIdExt(slideItemObj.options.modId)
19673
- ]);
19674
- strSlideXml += ' </p:nvPicPr>';
19675
- strSlideXml += '<p:blipFill>';
19676
- // NOTE: This works for both cases: either `path` or `data` contains the SVG
19677
- if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
19678
- var _slideItemObj_imageRid;
19679
- strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
19680
- strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
19681
- strSlideXml += ' <a:extLst>';
19682
- strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
19683
- strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
19684
- strSlideXml += ' </a:ext>';
19685
- strSlideXml += ' </a:extLst>';
19686
- strSlideXml += '</a:blip>';
19687
- } else {
19688
- strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
19689
- strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
19690
- strSlideXml += '</a:blip>';
19691
- }
19692
- if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
19693
- const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
19694
- const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
19695
- const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
19696
- const boxY = getSmartParseNumber(sizing.y || 0, 'Y', slide._presLayout);
19697
- const sourceSize = sizing.type !== 'crop' && typeof slideItemObj.options.w === 'number' && typeof slideItemObj.options.h === 'number' ? {
19698
- w: slideItemObj.options.w,
19699
- h: slideItemObj.options.h
19700
- } : {
19701
- w: imgWidth,
19702
- h: imgHeight
19703
- };
19704
- strSlideXml += ImageSizingXml[sizing.type](sourceSize, {
19705
- w: boxW,
19706
- h: boxH,
19707
- x: boxX,
19708
- y: boxY
19709
- });
19710
- // ECMA-376 §5.1.10.55: `srcRect` crops the source blip; the `<a:ext>` frame is the independent
19711
- // on-slide bounding box. Only `cover`/`contain` resize the frame to the fitted box. For `crop`
19712
- // the frame must keep the user's w/h container - collapsing it to the crop box (or 0) breaks
19713
- // rendering (issue #1399).
19714
- if (sizing.type !== 'crop') {
19715
- imgWidth = boxW;
19716
- imgHeight = boxH;
20415
+ case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
20416
+ {
20417
+ var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
20418
+ // MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
20419
+ const zOpts = slideItemObj.options;
20420
+ const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
20421
+ const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
20422
+ const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
20423
+ const zRet = zOpts.returnToParent === false ? '0' : '1';
20424
+ const zShowBg = zOpts.showBg === false ? '0' : '1';
20425
+ const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
20426
+ const zGeom = `<a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>`;
20427
+ const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
20428
+ const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
20429
+ const nsMap = {
20430
+ slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
20431
+ section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
20432
+ summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
20433
+ };
20434
+ const zNs = nsMap[zKind];
20435
+ strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
20436
+ strSlideXml += `<mc:Choice Requires="p16" xmlns:p16="${zNs}" xmlns:p166="http://schemas.microsoft.com/office/powerpoint/2016/6/main" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">`;
20437
+ if (zKind === 'slide') {
20438
+ var _slideItemObj_zoomSlideNum;
20439
+ const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
20440
+ strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
20441
+ } else if (zKind === 'section') {
20442
+ strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
20443
+ } else {
20444
+ // §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
20445
+ const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
20446
+ const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
20447
+ const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
20448
+ const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
20449
+ strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj><p16:gridLayout/></p16:summaryZm>`;
20450
+ }
20451
+ strSlideXml += '</mc:Choice>';
20452
+ // Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
20453
+ if (zKind === 'summary') {
20454
+ strSlideXml += `<mc:Fallback><p:grpSp><p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${zOpts.objectName}"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:grpSp></mc:Fallback>`;
20455
+ } else {
20456
+ strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
20457
+ strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
20458
+ strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
20459
+ strSlideXml += zFill;
20460
+ strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
20461
+ }
20462
+ strSlideXml += '</mc:AlternateContent>';
20463
+ break;
19717
20464
  }
19718
- } else {
19719
- strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
19720
- }
19721
- strSlideXml += '</p:blipFill>';
19722
- strSlideXml += '<p:spPr>';
19723
- strSlideXml += ' <a:xfrm' + locationAttr + '>';
19724
- strSlideXml += ` <a:off x="${x}" y="${y}"/>`;
19725
- strSlideXml += ` <a:ext cx="${imgWidth}" cy="${imgHeight}"/>`;
19726
- strSlideXml += ' </a:xfrm>';
19727
- // Geometry: rectRadius → roundRect; rounding (legacy) → ellipse; else rect
19728
- // Selective port of niranjan-uma-shankar/feature/html-to-pptx (keeps ellipse back-compat)
19729
- if (typeof slideItemObj.options.rectRadius === 'number') {
19730
- const adjValue = Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(imgWidth, imgHeight));
19731
- strSlideXml += ` <a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${adjValue}"/></a:avLst></a:prstGeom>`;
19732
- } else {
19733
- strSlideXml += ` <a:prstGeom prst="${rounding ? 'ellipse' : 'rect'}"><a:avLst/></a:prstGeom>`;
19734
- }
19735
- // OUTLINE: picture border/frame (issue #35)
19736
- if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
19737
- // EFFECTS: shadow / glow / softEdge / reflection
19738
- strSlideXml += genXmlEffectLst({
19739
- shadow: slideItemObj.options.shadow,
19740
- glow: slideItemObj.options.glow,
19741
- softEdge: slideItemObj.options.softEdge,
19742
- reflection: slideItemObj.options.reflection
19743
- });
19744
- strSlideXml += '</p:spPr>';
19745
- strSlideXml += '</p:pic>';
19746
- break;
19747
- case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
19748
- if (slideItemObj.mtype === 'online') {
19749
- var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
19750
- strSlideXml += '<p:pic>';
19751
- strSlideXml += ' <p:nvPicPr>';
19752
- // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
19753
- strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
19754
- strSlideXml += ' <p:cNvPicPr/>';
19755
- strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
19756
- strSlideXml += ' </p:nvPicPr>';
19757
- // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
19758
- 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!
19759
- strSlideXml += ' <p:spPr>';
19760
- strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19761
- strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
19762
- strSlideXml += ' </p:spPr>';
19763
- strSlideXml += '</p:pic>';
19764
- } else {
19765
- var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
19766
- // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
19767
- const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
19768
- strSlideXml += '<p:pic>';
19769
- strSlideXml += ' <p:nvPicPr>';
19770
- // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
19771
- strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 2}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
19772
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
19773
- const mediaExtras = genXmlMediaExtras(slideItemObj.options);
19774
- 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>';
19775
- 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>' : '';
19776
- strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
19777
- mediaExt,
19778
- narrationExt
19779
- ] : [
19780
- mediaExt
19781
- ]);
19782
- strSlideXml += ' </p:nvPicPr>';
19783
- strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid5 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid5 !== void 0 ? _slideItemObj_mediaRid5 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
19784
- strSlideXml += ' <p:spPr>';
19785
- strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19786
- strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
19787
- strSlideXml += ' </p:spPr>';
19788
- strSlideXml += '</p:pic>';
19789
- }
19790
- break;
19791
- case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
19792
- {
19793
- var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
19794
- // MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
19795
- const zOpts = slideItemObj.options;
19796
- const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
19797
- const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
19798
- const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
19799
- const zRet = zOpts.returnToParent === false ? '0' : '1';
19800
- const zShowBg = zOpts.showBg === false ? '0' : '1';
19801
- const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
19802
- const zGeom = `<a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>`;
19803
- const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
19804
- const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
19805
- const nsMap = {
19806
- slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
19807
- section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
19808
- summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
19809
- };
19810
- const zNs = nsMap[zKind];
19811
- strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
19812
- strSlideXml += `<mc:Choice Requires="p16" xmlns:p16="${zNs}" xmlns:p166="http://schemas.microsoft.com/office/powerpoint/2016/6/main" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">`;
19813
- if (zKind === 'slide') {
19814
- var _slideItemObj_zoomSlideNum;
19815
- const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
19816
- strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
19817
- } else if (zKind === 'section') {
19818
- strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
19819
- } else {
19820
- // §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
19821
- const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
19822
- const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
19823
- const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
19824
- const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
19825
- strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj><p16:gridLayout/></p16:summaryZm>`;
20465
+ case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
20466
+ {
20467
+ var _slideItemObj_contentPartRid;
20468
+ // MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
20469
+ const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
20470
+ strSlideXml += genXmlContentPartAlternate({
20471
+ kind: cpKind,
20472
+ rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
20473
+ shapeId,
20474
+ name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
20475
+ altText: slideItemObj.options.altText || '',
20476
+ x,
20477
+ y,
20478
+ cx,
20479
+ cy,
20480
+ locationAttr,
20481
+ bwMode: slideItemObj.contentPartBwMode,
20482
+ coverRid: slideItemObj.coverRid
20483
+ });
20484
+ break;
19826
20485
  }
19827
- strSlideXml += '</mc:Choice>';
19828
- // Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
19829
- if (zKind === 'summary') {
19830
- strSlideXml += `<mc:Fallback><p:grpSp><p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${zOpts.objectName}"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:grpSp></mc:Fallback>`;
19831
- } else {
19832
- strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
19833
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
19834
- strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
19835
- strSlideXml += zFill;
19836
- strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
20486
+ case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
20487
+ {
20488
+ var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
20489
+ // MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
20490
+ strSlideXml += genXmlOfficeAppAlternate({
20491
+ rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
20492
+ shapeId,
20493
+ name: slideItemObj.options.objectName || 'Office App 1',
20494
+ altText: slideItemObj.options.altText || '',
20495
+ x,
20496
+ y,
20497
+ cx,
20498
+ cy,
20499
+ locationAttr,
20500
+ coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
20501
+ });
20502
+ break;
19837
20503
  }
19838
- strSlideXml += '</mc:AlternateContent>';
19839
- break;
19840
- }
19841
- case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
19842
- {
19843
- var _slideItemObj_contentPartRid;
19844
- // MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
19845
- const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
19846
- strSlideXml += genXmlContentPartAlternate({
19847
- kind: cpKind,
19848
- rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
19849
- shapeId,
19850
- name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
19851
- altText: slideItemObj.options.altText || '',
19852
- x,
19853
- y,
19854
- cx,
19855
- cy,
19856
- locationAttr,
19857
- bwMode: slideItemObj.contentPartBwMode,
19858
- coverRid: slideItemObj.coverRid
19859
- });
20504
+ case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
20505
+ strSlideXml += '<p:graphicFrame>';
20506
+ strSlideXml += ' <p:nvGraphicFramePr>';
20507
+ strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
20508
+ strSlideXml += ' <p:cNvGraphicFramePr/>';
20509
+ strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20510
+ nvPrModIdExt(slideItemObj.options.modId)
20511
+ ]);
20512
+ strSlideXml += ' </p:nvGraphicFramePr>';
20513
+ strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
20514
+ strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
20515
+ strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
20516
+ strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
20517
+ strSlideXml += ' </a:graphicData>';
20518
+ strSlideXml += ' </a:graphic>';
20519
+ strSlideXml += '</p:graphicFrame>';
19860
20520
  break;
19861
- }
19862
- case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
19863
- {
19864
- var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
19865
- // MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
19866
- strSlideXml += genXmlOfficeAppAlternate({
19867
- rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
19868
- shapeId,
19869
- name: slideItemObj.options.objectName || 'Office App 1',
19870
- altText: slideItemObj.options.altText || '',
19871
- x,
19872
- y,
19873
- cx,
19874
- cy,
19875
- locationAttr,
19876
- coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
19877
- });
20521
+ case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
20522
+ {
20523
+ var _slideItemObj__objects;
20524
+ // PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
20525
+ // Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
20526
+ strSlideXml += '<p:grpSp>';
20527
+ strSlideXml += `<p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${encodeXmlEntities(slideItemObj.options.objectName || `Group ${shapeId}`)}"/>`;
20528
+ strSlideXml += '<p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>';
20529
+ strSlideXml += '<p:grpSpPr>';
20530
+ strSlideXml += `<a:xfrm${locationAttr}>`;
20531
+ strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
20532
+ strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
20533
+ strSlideXml += '</a:xfrm>';
20534
+ strSlideXml += genXmlEffectLst({
20535
+ shadow: slideItemObj.options.shadow,
20536
+ glow: slideItemObj.options.glow,
20537
+ softEdge: slideItemObj.options.softEdge,
20538
+ reflection: slideItemObj.options.reflection,
20539
+ blur: slideItemObj.options.blur
20540
+ });
20541
+ strSlideXml += '</p:grpSpPr>';
20542
+ renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
20543
+ strSlideXml += '</p:grpSp>';
20544
+ break;
20545
+ }
20546
+ default:
20547
+ strSlideXml += '';
19878
20548
  break;
19879
- }
19880
- case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
19881
- strSlideXml += '<p:graphicFrame>';
19882
- strSlideXml += ' <p:nvGraphicFramePr>';
19883
- strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
19884
- strSlideXml += ' <p:cNvGraphicFramePr/>';
19885
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19886
- nvPrModIdExt(slideItemObj.options.modId)
19887
- ]);
19888
- strSlideXml += ' </p:nvGraphicFramePr>';
19889
- strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
19890
- strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
19891
- strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
19892
- strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
19893
- strSlideXml += ' </a:graphicData>';
19894
- strSlideXml += ' </a:graphic>';
19895
- strSlideXml += '</p:graphicFrame>';
19896
- break;
19897
- default:
19898
- strSlideXml += '';
19899
- break;
19900
- }
19901
- });
20549
+ }
20550
+ });
20551
+ };
20552
+ renderObjectList(slide._slideObjects);
19902
20553
  // STEP 4: Add slide numbers (if any) last
19903
20554
  if (slide._slideNumberProps) {
19904
20555
  // Set some defaults (done here b/c SlideNumber canbe added to masters or slides and has numerous entry points)
19905
20556
  if (!slide._slideNumberProps.align) slide._slideNumberProps.align = 'left';
20557
+ const slideNumId = nextUnusedShapeId(usedShapeIds);
19906
20558
  strSlideXml += '<p:sp>';
19907
20559
  strSlideXml += ' <p:nvSpPr>';
19908
- strSlideXml += ' <p:cNvPr id="25" name="Slide Number Placeholder 0"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>';
20560
+ strSlideXml += ` <p:cNvPr id="${slideNumId}" name="Slide Number Placeholder 0"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>`;
19909
20561
  strSlideXml += ' <p:nvPr><p:ph type="sldNum" sz="quarter" idx="4294967295"/></p:nvPr>';
19910
20562
  strSlideXml += ' </p:nvSpPr>';
19911
20563
  strSlideXml += ' <p:spPr>';
@@ -20086,6 +20738,7 @@ function slideShowExtLst(slide) {
20086
20738
  strXml += '<Override PartName="/ppt/presProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"/>';
20087
20739
  strXml += '<Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/>';
20088
20740
  strXml += '<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>';
20741
+ strXml += '<Override PartName="/ppt/theme/theme2.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>';
20089
20742
  strXml += '<Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/>';
20090
20743
  // STEP 4: Add Slide Layouts
20091
20744
  slideLayouts.forEach((layout, idx)=>{
@@ -20191,8 +20844,12 @@ function slideShowExtLst(slide) {
20191
20844
  * @param {string} subject - metadata data
20192
20845
  * @param {string} author - metadata value
20193
20846
  * @param {string} revision - metadata value
20847
+ * @param {Date} [created] - OPC `dcterms:created` (defaults to now)
20848
+ * @param {Date} [modified] - OPC `dcterms:modified` (defaults to now)
20194
20849
  * @returns XML
20195
- */ function makeXmlCore(title, subject, author, revision) {
20850
+ */ function makeXmlCore(title, subject, author, revision, created, modified) {
20851
+ const createdAt = (created !== null && created !== void 0 ? created : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20852
+ const modifiedAt = (modified !== null && modified !== void 0 ? modified : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20196
20853
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20197
20854
  <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">
20198
20855
  <dc:title>${encodeXmlEntities(title)}</dc:title>
@@ -20200,8 +20857,8 @@ function slideShowExtLst(slide) {
20200
20857
  <dc:creator>${encodeXmlEntities(author)}</dc:creator>
20201
20858
  <cp:lastModifiedBy>${encodeXmlEntities(author)}</cp:lastModifiedBy>
20202
20859
  <cp:revision>${revision}</cp:revision>
20203
- <dcterms:created xsi:type="dcterms:W3CDTF">${new Date().toISOString().replace(/\.\d\d\dZ/, 'Z')}</dcterms:created>
20204
- <dcterms:modified xsi:type="dcterms:W3CDTF">${new Date().toISOString().replace(/\.\d\d\dZ/, 'Z')}</dcterms:modified>
20860
+ <dcterms:created xsi:type="dcterms:W3CDTF">${createdAt}</dcterms:created>
20861
+ <dcterms:modified xsi:type="dcterms:W3CDTF">${modifiedAt}</dcterms:modified>
20205
20862
  </cp:coreProperties>`;
20206
20863
  }
20207
20864
  /**
@@ -20303,10 +20960,13 @@ function collectSlideAnimations(slide) {
20303
20960
  delay: 0
20304
20961
  }, animConfig);
20305
20962
  }
20963
+ // Media cNvPr id is mediaRid+2 (not the auto shape index). Charts keep index+2 / sId.
20964
+ const shapeId = slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") && slideObj.mediaRid != null ? slideObj.mediaRid + 2 : (_ref = (_slideObj_options2 = slideObj.options) === null || _slideObj_options2 === void 0 ? void 0 : _slideObj_options2.sId) !== null && _ref !== void 0 ? _ref : index + 2;
20306
20965
  animations.push({
20307
20966
  objectIndex: index,
20308
- shapeId: (_ref = (_slideObj_options2 = slideObj.options) === null || _slideObj_options2 === void 0 ? void 0 : _slideObj_options2.sId) !== null && _ref !== void 0 ? _ref : index + 2,
20309
- animation
20967
+ shapeId,
20968
+ animation,
20969
+ buildKind: slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart") ? 'chart' : 'shape'
20310
20970
  });
20311
20971
  });
20312
20972
  return animations;
@@ -20365,7 +21025,12 @@ function collectSlideAnimations(slide) {
20365
21025
  * @param {PresSlide} slide - the slide object to transform into XML
20366
21026
  * @return {string} XML
20367
21027
  */ function makeXmlNotesSlide(slide) {
20368
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:notes 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:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" dirty="0"/><a:t>${encodeXmlEntities(getNotesFromSlide(slide))}</a:t></a:r><a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Slide Number Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="10"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="${SLDNUMFLDID}" type="slidenum"><a:rPr lang="en-US"/><a:t>${slide._slideNum}</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1024086991"/></p:ext></p:extLst></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`;
21028
+ const notesText = getNotesFromSlide(slide);
21029
+ // ECMA-376 §5.1.5.2.6 `CT_RegularTextRun` / `a:t` (`standards/ecma/part-22_drawingml-reference-material-drawingml-main.txt`):
21030
+ // an empty run is invalid. PowerPoint repair flags `<a:t></a:t>` on notesSlide (Juliussssssss 3260b6e).
21031
+ // Empty notes keep a valid paragraph with only `a:endParaRPr` (`CT_TextParagraph`).
21032
+ const notesRun = notesText ? `<a:r><a:rPr lang="en-US" dirty="0"/><a:t>${encodeXmlEntities(notesText)}</a:t></a:r>` : '';
21033
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:notes 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:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p>${notesRun}<a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Slide Number Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="10"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="${SLDNUMFLDID}" type="slidenum"><a:rPr lang="en-US"/><a:t>${slide._slideNum}</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1024086991"/></p:ext></p:extLst></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`;
20369
21034
  }
20370
21035
  /**
20371
21036
  * Generates the XML layout resource from a layout object
@@ -20390,25 +21055,35 @@ function collectSlideAnimations(slide) {
20390
21055
  strXml += slideObjectToXml(slide);
20391
21056
  strXml += '<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>';
20392
21057
  strXml += '<p:sldLayoutIdLst>' + layoutDefs.join('') + '</p:sldLayoutIdLst>';
20393
- strXml += '<p:hf sldNum="0" hdr="0" ftr="0" dt="0"/>';
21058
+ // ECMA-376 §4.4.1.22 `p:hf@sldNum` (default true) enables the slide-number placeholder.
21059
+ // Honour it only when the user set slideNumber — otherwise keep it off so unused masters
21060
+ // do not surface a default sldNum slot.
21061
+ strXml += `<p:hf sldNum="${slide._slideNumberProps ? '1' : '0'}" hdr="0" ftr="0" dt="0"/>`;
20394
21062
  strXml += '<p:txStyles>' + ' <p:titleStyle>' + ' <a:lvl1pPr algn="ctr" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr>' + ' </p:titleStyle>' + ' <p:bodyStyle>' + ' <a:lvl1pPr marL="342900" indent="-342900" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr>' + ' <a:lvl2pPr marL="742950" indent="-285750" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="–"/><a:defRPr sz="2800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr>' + ' <a:lvl3pPr marL="1143000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr>' + ' <a:lvl4pPr marL="1600200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="–"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr>' + ' <a:lvl5pPr marL="2057400" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="»"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr>' + ' <a:lvl6pPr marL="2514600" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr>' + ' <a:lvl7pPr marL="2971800" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr>' + ' <a:lvl8pPr marL="3429000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr>' + ' <a:lvl9pPr marL="3886200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr>' + ' </p:bodyStyle>' + ' <p:otherStyle>' + ' <a:defPPr><a:defRPr lang="en-US"/></a:defPPr>' + ' <a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr>' + ' <a:lvl2pPr marL="457200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr>' + ' <a:lvl3pPr marL="914400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr>' + ' <a:lvl4pPr marL="1371600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr>' + ' <a:lvl5pPr marL="1828800" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr>' + ' <a:lvl6pPr marL="2286000" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr>' + ' <a:lvl7pPr marL="2743200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr>' + ' <a:lvl8pPr marL="3200400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr>' + ' <a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr>' + ' </p:otherStyle>' + '</p:txStyles>';
20395
21063
  strXml += '</p:sldMaster>';
20396
21064
  return strXml;
20397
21065
  }
20398
21066
  // XML-GEN: Last 5 functions create root /ppt files
20399
21067
  /**
20400
- * Creates `ppt/theme/theme1.xml`
21068
+ * Creates `ppt/theme/theme1.xml` (slide master) or `ppt/theme/theme2.xml` (notes master).
21069
+ * Distinct `thm15:themeFamily` ids keep the notes theme from being a byte-identical twin
21070
+ * (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09 / SCV-Soft 1a1998e).
20401
21071
  * @return {string} XML
20402
- */ function makeXmlTheme(pres) {
20403
- var _pres_theme, _pres_theme1, _pres_theme2, _pres_theme3, _pres_theme4;
21072
+ */ function makeXmlTheme(pres, variant = 'slide') {
21073
+ var _ref, _ref1;
21074
+ var _pres_theme, _pres_theme1, _pres_theme2, _pres_theme3, _pres_theme4, _pres_theme5, _pres_theme6;
20404
21075
  const majorFont = ((_pres_theme = pres.theme) === null || _pres_theme === void 0 ? void 0 : _pres_theme.headFontFace) ? `<a:latin typeface="${(_pres_theme1 = pres.theme) === null || _pres_theme1 === void 0 ? void 0 : _pres_theme1.headFontFace}"/>` : '<a:latin typeface="Calibri Light" panose="020F0302020204030204"/>';
20405
21076
  const minorFont = ((_pres_theme2 = pres.theme) === null || _pres_theme2 === void 0 ? void 0 : _pres_theme2.bodyFontFace) ? `<a:latin typeface="${(_pres_theme3 = pres.theme) === null || _pres_theme3 === void 0 ? void 0 : _pres_theme3.bodyFontFace}"/>` : '<a:latin typeface="Calibri" panose="020F0502020204030204"/>';
21077
+ const eaFace = (_ref = (_pres_theme4 = pres.theme) === null || _pres_theme4 === void 0 ? void 0 : _pres_theme4.eaFontFace) !== null && _ref !== void 0 ? _ref : '';
21078
+ const csFace = (_ref1 = (_pres_theme5 = pres.theme) === null || _pres_theme5 === void 0 ? void 0 : _pres_theme5.csFontFace) !== null && _ref1 !== void 0 ? _ref1 : '';
21079
+ const themeFamilyId = variant === 'notes' ? '{2E142A2C-CD16-42D6-873A-C26D2A0506FA}' : '{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}';
21080
+ const themeFamilyVid = variant === 'notes' ? '{1BDDFF52-6CD6-40A5-AB3C-68EB2F1E4D0A}' : '{4A3C46E8-61CC-4603-A589-7422A47A8E4A}';
20406
21081
  // Exactly 12 hex colors required (upstream only checked truthy `.length`, which allowed short arrays → undefined attrs)
20407
- const isCustomColors = Array.isArray((_pres_theme4 = pres.theme) === null || _pres_theme4 === void 0 ? void 0 : _pres_theme4.themeColors) && pres.theme.themeColors.length === 12;
21082
+ const isCustomColors = Array.isArray((_pres_theme6 = pres.theme) === null || _pres_theme6 === void 0 ? void 0 : _pres_theme6.themeColors) && pres.theme.themeColors.length === 12;
20408
21083
  const c = resolveThemeColors(pres.theme);
20409
21084
  const themeName = isCustomColors ? 'Custom Theme' : 'Office Theme';
20410
21085
  const schemeName = isCustomColors ? 'Custom' : 'Office';
20411
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${themeName}"><a:themeElements><a:clrScheme name="${schemeName}"><a:dk1><a:sysClr val="windowText" lastClr="${c[0]}"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="${c[1]}"/></a:lt1><a:dk2><a:srgbClr val="${c[2]}"/></a:dk2><a:lt2><a:srgbClr val="${c[3]}"/></a:lt2><a:accent1><a:srgbClr val="${c[4]}"/></a:accent1><a:accent2><a:srgbClr val="${c[5]}"/></a:accent2><a:accent3><a:srgbClr val="${c[6]}"/></a:accent3><a:accent4><a:srgbClr val="${c[7]}"/></a:accent4><a:accent5><a:srgbClr val="${c[8]}"/></a:accent5><a:accent6><a:srgbClr val="${c[9]}"/></a:accent6><a:hlink><a:srgbClr val="${c[10]}"/></a:hlink><a:folHlink><a:srgbClr val="${c[11]}"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont>${majorFont}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${minorFont}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}" vid="{4A3C46E8-61CC-4603-A589-7422A47A8E4A}"/></a:ext></a:extLst></a:theme>`;
21086
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${themeName}"><a:themeElements><a:clrScheme name="${schemeName}"><a:dk1><a:sysClr val="windowText" lastClr="${c[0]}"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="${c[1]}"/></a:lt1><a:dk2><a:srgbClr val="${c[2]}"/></a:dk2><a:lt2><a:srgbClr val="${c[3]}"/></a:lt2><a:accent1><a:srgbClr val="${c[4]}"/></a:accent1><a:accent2><a:srgbClr val="${c[5]}"/></a:accent2><a:accent3><a:srgbClr val="${c[6]}"/></a:accent3><a:accent4><a:srgbClr val="${c[7]}"/></a:accent4><a:accent5><a:srgbClr val="${c[8]}"/></a:accent5><a:accent6><a:srgbClr val="${c[9]}"/></a:accent6><a:hlink><a:srgbClr val="${c[10]}"/></a:hlink><a:folHlink><a:srgbClr val="${c[11]}"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont>${majorFont}<a:ea typeface="${eaFace}"/><a:cs typeface="${csFace}"/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${minorFont}<a:ea typeface="${eaFace}"/><a:cs typeface="${csFace}"/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="${themeFamilyId}" vid="${themeFamilyVid}"/></a:ext></a:extLst></a:theme>`;
20412
21087
  }
20413
21088
  const package_P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
20414
21089
  const SLD_GUIDE_URI = '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}';
@@ -20664,6 +21339,24 @@ class PptxGenJS {
20664
21339
  get author() {
20665
21340
  return this._author;
20666
21341
  }
21342
+ set created(value) {
21343
+ this._created = value;
21344
+ }
21345
+ get created() {
21346
+ return this._created;
21347
+ }
21348
+ set modified(value) {
21349
+ this._modified = value;
21350
+ }
21351
+ get modified() {
21352
+ return this._modified;
21353
+ }
21354
+ set mediaOnError(value) {
21355
+ this._mediaOnError = value === 'placeholder' ? 'placeholder' : 'throw';
21356
+ }
21357
+ get mediaOnError() {
21358
+ return this._mediaOnError;
21359
+ }
20667
21360
  set company(value) {
20668
21361
  this._company = value;
20669
21362
  }
@@ -20948,6 +21641,7 @@ class PptxGenJS {
20948
21641
  });
20949
21642
  }
20950
21643
  }
21644
+ if (options === null || options === void 0 ? void 0 : options.transition) newSlide.transition = options.transition;
20951
21645
  return newSlide;
20952
21646
  }
20953
21647
  /**
@@ -21030,10 +21724,19 @@ class PptxGenJS {
21030
21724
  */ pptxgen_define_property(this, "_layout", void 0);
21031
21725
  /**
21032
21726
  * PptxGenJS Library Version
21033
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.17"));
21727
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.18"));
21034
21728
  /**
21035
21729
  * @type {string}
21036
21730
  */ pptxgen_define_property(this, "_author", void 0);
21731
+ /**
21732
+ * OPC `dcterms:created` written to `docProps/core.xml`.
21733
+ */ pptxgen_define_property(this, "_created", void 0);
21734
+ /**
21735
+ * OPC `dcterms:modified` written to `docProps/core.xml`.
21736
+ */ pptxgen_define_property(this, "_modified", void 0);
21737
+ /**
21738
+ * Failed image/media load policy. Default throws so invalid input still fails the export.
21739
+ */ pptxgen_define_property(this, "_mediaOnError", 'throw');
21037
21740
  /**
21038
21741
  * @type {string}
21039
21742
  */ pptxgen_define_property(this, "_company", void 0);
@@ -21163,7 +21866,7 @@ class PptxGenJS {
21163
21866
  * @param {PresSlide | SlideLayout} slide - slide with rels
21164
21867
  * @param {JSZip} zip - JSZip instance
21165
21868
  * @param {Promise<string>[]} chartPromises - promise array
21166
- */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises)=>{
21869
+ */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises, mediaPaths)=>{
21167
21870
  slide._relsChart.forEach((rel)=>chartPromises.push(createExcelWorksheet(rel, zip)));
21168
21871
  slide._relsMedia.forEach((rel)=>{
21169
21872
  if (rel.type !== 'online' && rel.type !== 'hyperlink') {
@@ -21174,8 +21877,11 @@ class PptxGenJS {
21174
21877
  if (!data.includes(',') && !data.includes(';')) data = 'image/png;base64,' + data;
21175
21878
  else if (!data.includes(',')) data = 'image/png;base64,' + data;
21176
21879
  else if (!data.includes(';')) data = 'image/png;' + data;
21177
- // C: Add media
21178
- zip.file(rel.Target.replace(/\.\./g, 'ppt'), (_data_split_pop = data.split(',').pop()) !== null && _data_split_pop !== void 0 ? _data_split_pop : '', {
21880
+ // C: Add media (skip if another rel already wrote this OPC part)
21881
+ const mediaPath = rel.Target.replace(/\.\./g, 'ppt');
21882
+ if (mediaPaths.has(mediaPath)) return;
21883
+ mediaPaths.add(mediaPath);
21884
+ zip.file(mediaPath, (_data_split_pop = data.split(',').pop()) !== null && _data_split_pop !== void 0 ? _data_split_pop : '', {
21179
21885
  base64: true
21180
21886
  });
21181
21887
  }
@@ -21223,12 +21929,18 @@ class PptxGenJS {
21223
21929
  const zip = new jszip_namespaceObject.JSZip();
21224
21930
  // STEP 1: Read/Encode all Media before zip as base64 content, etc. is required
21225
21931
  this.slides.forEach((slide)=>{
21226
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(slide));
21932
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(slide, {
21933
+ onError: this._mediaOnError
21934
+ }));
21227
21935
  });
21228
21936
  this.slideLayouts.forEach((layout)=>{
21229
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(layout));
21937
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(layout, {
21938
+ onError: this._mediaOnError
21939
+ }));
21230
21940
  });
21231
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(this.masterSlide));
21941
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(this.masterSlide, {
21942
+ onError: this._mediaOnError
21943
+ }));
21232
21944
  // STEP 2: Wait for Promises (if any) then generate the PPTX file
21233
21945
  return yield Promise.all(arrMediaPromises).then(()=>pptxgen_async_to_generator(function*() {
21234
21946
  var _zip_folder, _zip_folder1, _zip_folder2, _zip_folder3, _zip_folder4, _zip_folder5, _zip_folder6;
@@ -21260,9 +21972,11 @@ class PptxGenJS {
21260
21972
  zip.file('[Content_Types].xml', makeXmlContTypes(this.slides, this.slideLayouts, this.masterSlide, trackingParts)); // TODO: pass only `this` like below! 20200206
21261
21973
  zip.file('_rels/.rels', makeXmlRootRels());
21262
21974
  zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company)); // TODO: pass only `this` like below! 20200206
21263
- zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision)); // TODO: pass only `this` like below! 20200206
21975
+ 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
21264
21976
  zip.file('ppt/_rels/presentation.xml.rels', makeXmlPresentationRels(this.slides, trackingParts));
21265
21977
  zip.file('ppt/theme/theme1.xml', makeXmlTheme(this));
21978
+ // notesMaster gets its own theme part (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09).
21979
+ zip.file('ppt/theme/theme2.xml', makeXmlTheme(this, 'notes'));
21266
21980
  zip.file('ppt/presentation.xml', makeXmlPresentation(this));
21267
21981
  zip.file('ppt/presProps.xml', makeXmlPresProps(this));
21268
21982
  zip.file('ppt/tableStyles.xml', makeXmlTableStyles());
@@ -21306,13 +22020,14 @@ class PptxGenJS {
21306
22020
  zip.file('ppt/notesMasters/notesMaster1.xml', makeXmlNotesMaster());
21307
22021
  zip.file('ppt/notesMasters/_rels/notesMaster1.xml.rels', makeXmlNotesMasterRel());
21308
22022
  // D: Create all Rels (images, media, chart data)
22023
+ const mediaPaths = new Set();
21309
22024
  this.slideLayouts.forEach((layout)=>{
21310
- this.createChartMediaRels(layout, zip, arrChartPromises);
22025
+ this.createChartMediaRels(layout, zip, arrChartPromises, mediaPaths);
21311
22026
  });
21312
22027
  this.slides.forEach((slide)=>{
21313
- this.createChartMediaRels(slide, zip, arrChartPromises);
22028
+ this.createChartMediaRels(slide, zip, arrChartPromises, mediaPaths);
21314
22029
  });
21315
- this.createChartMediaRels(this.masterSlide, zip, arrChartPromises);
22030
+ this.createChartMediaRels(this.masterSlide, zip, arrChartPromises, mediaPaths);
21316
22031
  // E: Wait for Promises (if any) then generate the PPTX file
21317
22032
  return yield Promise.all(arrChartPromises).then(()=>pptxgen_async_to_generator(function*() {
21318
22033
  // E2: Embed custom fonts into the zip before packing (`addFont` → ppt/fonts/*.fntdata)
@@ -21431,6 +22146,8 @@ class PptxGenJS {
21431
22146
  addShape: notOnMaster,
21432
22147
  addTable: notOnMaster,
21433
22148
  addText: notOnMaster,
22149
+ addGroup: notOnMaster,
22150
+ addWordArt: notOnMaster,
21434
22151
  addTransition: notOnMaster,
21435
22152
  addAnimation: notOnMaster,
21436
22153
  addComment: notOnMaster,