pptx-react-viewer 1.1.6 → 1.1.7

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.
Files changed (31) hide show
  1. package/dist/{PowerPointViewer-CX0a7wz_.d.mts → PowerPointViewer-C5jGuKGB.d.mts} +3 -1
  2. package/dist/{PowerPointViewer-CX0a7wz_.d.ts → PowerPointViewer-C5jGuKGB.d.ts} +3 -1
  3. package/dist/index.d.mts +3 -2
  4. package/dist/index.d.ts +3 -2
  5. package/dist/index.js +1224 -454
  6. package/dist/index.mjs +1225 -455
  7. package/dist/pptx-viewer.css +1 -1
  8. package/dist/viewer/index.d.mts +6 -25
  9. package/dist/viewer/index.d.ts +6 -25
  10. package/dist/viewer/index.js +1224 -454
  11. package/dist/viewer/index.mjs +1225 -455
  12. package/node_modules/emf-converter/package.json +1 -1
  13. package/node_modules/mtx-decompressor/package.json +1 -1
  14. package/node_modules/pptx-viewer-core/dist/{SvgExporter-CTDG-t_z.d.ts → SvgExporter-BtZczTlB.d.ts} +1 -1
  15. package/node_modules/pptx-viewer-core/dist/{SvgExporter-BTkk4oNQ.d.mts → SvgExporter-D4mBWJHE.d.mts} +1 -1
  16. package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
  17. package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
  18. package/node_modules/pptx-viewer-core/dist/cli/index.js +0 -0
  19. package/node_modules/pptx-viewer-core/dist/cli/index.mjs +0 -0
  20. package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
  21. package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
  22. package/node_modules/pptx-viewer-core/dist/index.d.mts +108 -19
  23. package/node_modules/pptx-viewer-core/dist/index.d.ts +108 -19
  24. package/node_modules/pptx-viewer-core/dist/index.js +532 -306
  25. package/node_modules/pptx-viewer-core/dist/index.mjs +524 -307
  26. package/node_modules/pptx-viewer-core/dist/{presentation-4fhI3din.d.mts → presentation-nZxgWvXq.d.mts} +40 -1
  27. package/node_modules/pptx-viewer-core/dist/{presentation-4fhI3din.d.ts → presentation-nZxgWvXq.d.ts} +40 -1
  28. package/node_modules/pptx-viewer-core/dist/{text-operations-C89Jn6S0.d.mts → text-operations-DCTGMltY.d.mts} +1 -1
  29. package/node_modules/pptx-viewer-core/dist/{text-operations-B9EwbptL.d.ts → text-operations-DYmhoi7U.d.ts} +1 -1
  30. package/node_modules/pptx-viewer-core/package.json +1 -1
  31. package/package.json +4 -4
@@ -4277,6 +4277,96 @@ var PptxColorTransformCodec = class {
4277
4277
  }
4278
4278
  };
4279
4279
 
4280
+ // src/core/utils/xml-access.ts
4281
+ var ATTR_PREFIX = "@_";
4282
+ var TEXT_KEY = "#text";
4283
+ function isXmlObject(value) {
4284
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4285
+ }
4286
+ function coerceString(value) {
4287
+ if (typeof value === "string") {
4288
+ return value;
4289
+ }
4290
+ if (typeof value === "number" || typeof value === "boolean") {
4291
+ return String(value);
4292
+ }
4293
+ return void 0;
4294
+ }
4295
+ function xmlChild(node, key) {
4296
+ if (!isXmlObject(node)) {
4297
+ return void 0;
4298
+ }
4299
+ const value = node[key];
4300
+ if (Array.isArray(value)) {
4301
+ const first = value[0];
4302
+ return isXmlObject(first) ? first : void 0;
4303
+ }
4304
+ return isXmlObject(value) ? value : void 0;
4305
+ }
4306
+ function xmlChildren(node, key) {
4307
+ if (!isXmlObject(node)) {
4308
+ return [];
4309
+ }
4310
+ const value = node[key];
4311
+ if (value === void 0 || value === null) {
4312
+ return [];
4313
+ }
4314
+ if (Array.isArray(value)) {
4315
+ return value.filter(isXmlObject);
4316
+ }
4317
+ return isXmlObject(value) ? [value] : [];
4318
+ }
4319
+ function xmlAttr(node, name) {
4320
+ if (!isXmlObject(node)) {
4321
+ return void 0;
4322
+ }
4323
+ return coerceString(node[ATTR_PREFIX + name]);
4324
+ }
4325
+ function xmlAttrNumber(node, name) {
4326
+ const raw = xmlAttr(node, name);
4327
+ if (raw === void 0) {
4328
+ return void 0;
4329
+ }
4330
+ const parsed = Number(raw);
4331
+ return Number.isFinite(parsed) ? parsed : void 0;
4332
+ }
4333
+ function xmlAttrBool(node, name) {
4334
+ const raw = xmlAttr(node, name);
4335
+ if (raw === void 0) {
4336
+ return void 0;
4337
+ }
4338
+ const normalized = raw.trim().toLowerCase();
4339
+ if (normalized === "1" || normalized === "true") {
4340
+ return true;
4341
+ }
4342
+ if (normalized === "0" || normalized === "false") {
4343
+ return false;
4344
+ }
4345
+ return void 0;
4346
+ }
4347
+ function xmlText(node) {
4348
+ if (typeof node === "string") {
4349
+ return node;
4350
+ }
4351
+ if (!isXmlObject(node)) {
4352
+ return void 0;
4353
+ }
4354
+ return coerceString(node[TEXT_KEY]);
4355
+ }
4356
+ function xmlPath(node, ...keys) {
4357
+ let current = isXmlObject(node) ? node : void 0;
4358
+ for (const key of keys) {
4359
+ if (!current) {
4360
+ return void 0;
4361
+ }
4362
+ current = xmlChild(current, key);
4363
+ }
4364
+ return current;
4365
+ }
4366
+ function isXmlNode(value) {
4367
+ return isXmlObject(value);
4368
+ }
4369
+
4280
4370
  // src/core/core/builders/PptxGradientStyleCodec.ts
4281
4371
  var PptxGradientStyleCodec = class {
4282
4372
  context;
@@ -4284,7 +4374,9 @@ var PptxGradientStyleCodec = class {
4284
4374
  this.context = context;
4285
4375
  }
4286
4376
  extractGradientOpacity(gradFill) {
4287
- const gradientStops = this.context.ensureArray(gradFill?.["a:gsLst"]?.["a:gs"]);
4377
+ const gradientStops = this.context.ensureArray(
4378
+ xmlChild(gradFill, "a:gsLst")?.["a:gs"]
4379
+ );
4288
4380
  if (gradientStops.length === 0) {
4289
4381
  return void 0;
4290
4382
  }
@@ -4296,7 +4388,9 @@ var PptxGradientStyleCodec = class {
4296
4388
  return this.context.clampUnitInterval(opacityTotal / opacities.length);
4297
4389
  }
4298
4390
  extractGradientStops(gradFill) {
4299
- const gradientStops = this.context.ensureArray(gradFill?.["a:gsLst"]?.["a:gs"]);
4391
+ const gradientStops = this.context.ensureArray(
4392
+ xmlChild(gradFill, "a:gsLst")?.["a:gs"]
4393
+ );
4300
4394
  if (gradientStops.length === 0) {
4301
4395
  return [];
4302
4396
  }
@@ -4587,7 +4681,9 @@ var PptxGradientStyleCodec = class {
4587
4681
  );
4588
4682
  }
4589
4683
  extractStopsSorted(gradFill) {
4590
- const gradientStops = this.context.ensureArray(gradFill?.["a:gsLst"]?.["a:gs"]);
4684
+ const gradientStops = this.context.ensureArray(
4685
+ xmlChild(gradFill, "a:gsLst")?.["a:gs"]
4686
+ );
4591
4687
  if (gradientStops.length === 0) {
4592
4688
  return [];
4593
4689
  }
@@ -6352,7 +6448,9 @@ function applyCellFillStyle(cellProperties, style, context) {
6352
6448
  if (context.extractGradientFillCss) {
6353
6449
  style.gradientFillCss = context.extractGradientFillCss(gradFill);
6354
6450
  }
6355
- const gradStops = context.ensureArray(gradFill?.["a:gsLst"]?.["a:gs"]);
6451
+ const gradStops = context.ensureArray(
6452
+ gradFill?.["a:gsLst"]?.["a:gs"]
6453
+ );
6356
6454
  if (gradStops.length > 0 && !style.backgroundColor) {
6357
6455
  const firstStopColor = context.parseColor(gradStops[0]);
6358
6456
  if (firstStopColor) {
@@ -6562,11 +6660,11 @@ function applyCellTextFormat(tableCell, style, context) {
6562
6660
  }
6563
6661
  function applyRunProperties(runProperties, style, context) {
6564
6662
  let hasStyle = false;
6565
- if (runProperties["@_b"] === "1" || runProperties["@_b"] === true) {
6663
+ if (runProperties["@_b"] === "1") {
6566
6664
  style.bold = true;
6567
6665
  hasStyle = true;
6568
6666
  }
6569
- if (runProperties["@_i"] === "1" || runProperties["@_i"] === true) {
6667
+ if (runProperties["@_i"] === "1") {
6570
6668
  style.italic = true;
6571
6669
  hasStyle = true;
6572
6670
  }
@@ -6672,8 +6770,8 @@ var PptxTableDataParser = class {
6672
6770
  style: this.extractTableCellStyleFromXml(cellNode),
6673
6771
  gridSpan: cellNode["@_gridSpan"] ? parseInt(String(cellNode["@_gridSpan"]), 10) : void 0,
6674
6772
  rowSpan: cellNode["@_rowSpan"] ? parseInt(String(cellNode["@_rowSpan"]), 10) : void 0,
6675
- vMerge: cellNode["@_vMerge"] === "1" || cellNode["@_vMerge"] === true,
6676
- hMerge: cellNode["@_hMerge"] === "1" || cellNode["@_hMerge"] === true,
6773
+ vMerge: cellNode["@_vMerge"] === "1",
6774
+ hMerge: cellNode["@_hMerge"] === "1",
6677
6775
  ...extraAttributes ? { extraAttributes } : {}
6678
6776
  };
6679
6777
  })
@@ -6681,16 +6779,16 @@ var PptxTableDataParser = class {
6681
6779
  });
6682
6780
  const bandRowCycle = this.extractBandCycle(tableProperties, "bandRowCycle");
6683
6781
  const bandColCycle = this.extractBandCycle(tableProperties, "bandColCycle");
6684
- const rtl = tableProperties["@_rtl"] === "1" || tableProperties["@_rtl"] === true;
6782
+ const rtl = tableProperties["@_rtl"] === "1";
6685
6783
  return {
6686
6784
  rows,
6687
6785
  columnWidths,
6688
- bandedRows: tableProperties["@_bandRow"] === "1" || tableProperties["@_bandRow"] === true,
6689
- firstRowHeader: tableProperties["@_firstRow"] === "1" || tableProperties["@_firstRow"] === true,
6690
- bandedColumns: tableProperties["@_bandCol"] === "1" || tableProperties["@_bandCol"] === true,
6691
- lastRow: tableProperties["@_lastRow"] === "1" || tableProperties["@_lastRow"] === true,
6692
- firstCol: tableProperties["@_firstCol"] === "1" || tableProperties["@_firstCol"] === true,
6693
- lastCol: tableProperties["@_lastCol"] === "1" || tableProperties["@_lastCol"] === true,
6786
+ bandedRows: tableProperties["@_bandRow"] === "1",
6787
+ firstRowHeader: tableProperties["@_firstRow"] === "1",
6788
+ bandedColumns: tableProperties["@_bandCol"] === "1",
6789
+ lastRow: tableProperties["@_lastRow"] === "1",
6790
+ firstCol: tableProperties["@_firstCol"] === "1",
6791
+ lastCol: tableProperties["@_lastCol"] === "1",
6694
6792
  tableStyleId,
6695
6793
  bandRowCycle: bandRowCycle ?? 1,
6696
6794
  bandColCycle: bandColCycle ?? 1,
@@ -6775,7 +6873,9 @@ var PptxTableDataParser = class {
6775
6873
  return Object.keys(result).length > 0 ? result : void 0;
6776
6874
  }
6777
6875
  extractTableCellText(tableCell) {
6778
- const paragraphs = this.context.ensureArray(tableCell?.["a:txBody"]?.["a:p"]);
6876
+ const paragraphs = this.context.ensureArray(
6877
+ tableCell?.["a:txBody"]?.["a:p"]
6878
+ );
6779
6879
  const lines = [];
6780
6880
  for (const paragraph of paragraphs) {
6781
6881
  const runs = this.context.ensureArray(paragraph["a:r"]);
@@ -7283,7 +7383,9 @@ var PptxConnectorParser = class {
7283
7383
  if (!offset || !extent) {
7284
7384
  return null;
7285
7385
  }
7286
- const shapeType = String(shapeProperties?.["a:prstGeom"]?.["@_prst"] || "straightConnector1");
7386
+ const shapeType = String(
7387
+ shapeProperties?.["a:prstGeom"]?.["@_prst"] || "straightConnector1"
7388
+ );
7287
7389
  const shapeAdjustments = this.context.parseGeometryAdjustments(
7288
7390
  shapeProperties?.["a:prstGeom"]
7289
7391
  );
@@ -9276,7 +9378,7 @@ function extractChildMotionValues(childTnList) {
9276
9378
  }
9277
9379
  const zoom = scaleNode["@_zoomContents"];
9278
9380
  if (zoom !== void 0) {
9279
- scaleZoomContents = zoom === "1" || zoom === "true" || zoom === true;
9381
+ scaleZoomContents = zoom === "1" || zoom === "true";
9280
9382
  }
9281
9383
  }
9282
9384
  return {
@@ -9353,7 +9455,7 @@ function decodeKeyframeValue(valNode) {
9353
9455
  const boolVal = valNode["p:boolVal"];
9354
9456
  if (boolVal && boolVal["@_val"] !== void 0) {
9355
9457
  const raw = boolVal["@_val"];
9356
- const value = raw === true || raw === "1" || raw === "true";
9458
+ const value = raw === "1" || raw === "true";
9357
9459
  return { value, valueType: "bool" };
9358
9460
  }
9359
9461
  const intVal = valNode["p:intVal"];
@@ -9406,7 +9508,7 @@ function extractRepeatInfo(cTn) {
9406
9508
  const repeatToken = String(rawRepeat);
9407
9509
  repeatCount = repeatToken === "indefinite" ? Infinity : Number.parseInt(repeatToken, 10) / 1e3;
9408
9510
  }
9409
- if (cTn["@_autoRev"] === "1" || cTn["@_autoRev"] === true) {
9511
+ if (cTn["@_autoRev"] === "1") {
9410
9512
  autoReverse = true;
9411
9513
  }
9412
9514
  return { repeatCount, autoReverse };
@@ -9563,10 +9665,10 @@ function extractAfterEffect(cTn) {
9563
9665
  if (raw === void 0) {
9564
9666
  return void 0;
9565
9667
  }
9566
- if (raw === "1" || raw === 1 || raw === true || raw === "true") {
9668
+ if (raw === "1" || raw === "true") {
9567
9669
  return true;
9568
9670
  }
9569
- if (raw === "0" || raw === 0 || raw === false || raw === "false") {
9671
+ if (raw === "0" || raw === "false") {
9570
9672
  return false;
9571
9673
  }
9572
9674
  return void 0;
@@ -9576,11 +9678,11 @@ function ensureArray2(value) {
9576
9678
  return [];
9577
9679
  }
9578
9680
  if (!Array.isArray(value)) {
9579
- return isXmlObject(value) ? [value] : [];
9681
+ return isXmlObject2(value) ? [value] : [];
9580
9682
  }
9581
- return value.filter((entry) => isXmlObject(entry));
9683
+ return value.filter((entry) => isXmlObject2(entry));
9582
9684
  }
9583
- function isXmlObject(value) {
9685
+ function isXmlObject2(value) {
9584
9686
  return typeof value === "object" && value !== null && !Array.isArray(value);
9585
9687
  }
9586
9688
  var VALID_CONDITION_EVENTS = /* @__PURE__ */ new Set([
@@ -9831,7 +9933,7 @@ function extractIterate(cTn) {
9831
9933
  }
9832
9934
  const rawType = String(iterate["@_type"] || "el").toLowerCase();
9833
9935
  const type = rawType === "lt" ? "lt" : rawType === "wd" ? "wd" : "el";
9834
- const backwards = iterate["@_backwards"] === "1" || iterate["@_backwards"] === true ? true : void 0;
9936
+ const backwards = iterate["@_backwards"] === "1" ? true : void 0;
9835
9937
  const tmPctNode = iterate["p:tmPct"];
9836
9938
  const tmAbsNode = iterate["p:tmAbs"];
9837
9939
  let tmPct;
@@ -9886,7 +9988,7 @@ function extractOleChartBuilds(bldLst) {
9886
9988
  spid: String(e["@_spid"]),
9887
9989
  grpId: String(e["@_grpId"] || "0"),
9888
9990
  bld: String(e["@_bld"] || "allAtOnce"),
9889
- animBg: e["@_animBg"] === "1" || e["@_animBg"] === true ? true : void 0
9991
+ animBg: e["@_animBg"] === "1" ? true : void 0
9890
9992
  }));
9891
9993
  }
9892
9994
 
@@ -11074,7 +11176,7 @@ function updateEffectNodeAttributes(cTn, anim, currentPresetClass) {
11074
11176
  if (stCondList && anim.delayMs !== void 0) {
11075
11177
  const conditions = ensureArray2(stCondList["p:cond"]);
11076
11178
  for (const cond of conditions) {
11077
- if (isXmlObject(cond)) {
11179
+ if (isXmlObject2(cond)) {
11078
11180
  cond["@_delay"] = String(anim.delayMs);
11079
11181
  }
11080
11182
  }
@@ -12146,6 +12248,59 @@ ${nextText}` : nextText;
12146
12248
  }
12147
12249
  };
12148
12250
 
12251
+ // src/core/utils/layout-display-name.ts
12252
+ var TYPE_LABELS = {
12253
+ title: "Title Slide",
12254
+ tx: "Title and Text",
12255
+ twoColTx: "Two Column Text",
12256
+ tbl: "Title and Table",
12257
+ txOverObj: "Text Over Object",
12258
+ obj: "Title and Content",
12259
+ txAndObj: "Text and Content",
12260
+ objAndTx: "Content and Text",
12261
+ objOverTx: "Object Over Text",
12262
+ twoObj: "Two Content",
12263
+ twoObjAndObj: "Two Content and Content",
12264
+ objAndTwoObj: "Content and Two Content",
12265
+ twoObjAndTx: "Two Content and Text",
12266
+ twoObjOverTx: "Two Content Over Text",
12267
+ fourObj: "Four Content",
12268
+ twoTxTwoObj: "Comparison",
12269
+ blank: "Blank",
12270
+ vertTx: "Vertical Text",
12271
+ clipArtAndTx: "Clip Art and Text",
12272
+ clipArtAndVertTx: "Clip Art and Vertical Text",
12273
+ vertTitleAndTx: "Vertical Title and Text",
12274
+ vertTitleAndTxOverChart: "Vertical Title and Text Over Chart",
12275
+ titleOnly: "Title Only",
12276
+ objTx: "Content with Caption",
12277
+ picTx: "Picture with Caption",
12278
+ secHead: "Section Header",
12279
+ objOnly: "Object Only",
12280
+ mediaAndTx: "Media and Text",
12281
+ dgm: "Diagram",
12282
+ chart: "Chart",
12283
+ cust: "Custom"
12284
+ };
12285
+ function looksLikePath(value) {
12286
+ return /[\\/]/.test(value) || /\.xml$/i.test(value);
12287
+ }
12288
+ function fallbackFromPath(path) {
12289
+ const match = /slideLayout(\d+)\.xml$/i.exec(path);
12290
+ return match ? `Slide Layout ${match[1]}` : "Slide Layout";
12291
+ }
12292
+ function resolveLayoutDisplayName(input) {
12293
+ const trimmed = (input.name ?? "").trim();
12294
+ if (trimmed && !looksLikePath(trimmed)) {
12295
+ return trimmed;
12296
+ }
12297
+ const type = (input.type ?? "").trim();
12298
+ if (type && TYPE_LABELS[type]) {
12299
+ return TYPE_LABELS[type];
12300
+ }
12301
+ return fallbackFromPath(input.path);
12302
+ }
12303
+
12149
12304
  // src/core/utils/signature-constants.ts
12150
12305
  var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
12151
12306
  var DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
@@ -14134,11 +14289,11 @@ function parseSeriesTrendlines(seriesNode, xmlLookup, colorParser) {
14134
14289
  result.intercept = interceptVal;
14135
14290
  }
14136
14291
  const dispRSq = xmlLookup.getChildByLocalName(node, "dispRSqr");
14137
- if (dispRSq?.["@_val"] === "1" || dispRSq?.["@_val"] === true) {
14292
+ if (dispRSq?.["@_val"] === "1") {
14138
14293
  result.displayRSq = true;
14139
14294
  }
14140
14295
  const dispEq = xmlLookup.getChildByLocalName(node, "dispEq");
14141
- if (dispEq?.["@_val"] === "1" || dispEq?.["@_val"] === true) {
14296
+ if (dispEq?.["@_val"] === "1") {
14142
14297
  result.displayEq = true;
14143
14298
  }
14144
14299
  const spPr = xmlLookup.getChildByLocalName(node, "spPr");
@@ -14196,22 +14351,22 @@ function parseDataTable(plotArea, xmlLookup) {
14196
14351
  const result = {};
14197
14352
  let hasProps = false;
14198
14353
  const hBorder = xmlLookup.getChildByLocalName(dTable, "showHorzBorder");
14199
- if (hBorder?.["@_val"] === "1" || hBorder?.["@_val"] === true) {
14354
+ if (hBorder?.["@_val"] === "1") {
14200
14355
  result.showHorzBorder = true;
14201
14356
  hasProps = true;
14202
14357
  }
14203
14358
  const vBorder = xmlLookup.getChildByLocalName(dTable, "showVertBorder");
14204
- if (vBorder?.["@_val"] === "1" || vBorder?.["@_val"] === true) {
14359
+ if (vBorder?.["@_val"] === "1") {
14205
14360
  result.showVertBorder = true;
14206
14361
  hasProps = true;
14207
14362
  }
14208
14363
  const outline = xmlLookup.getChildByLocalName(dTable, "showOutline");
14209
- if (outline?.["@_val"] === "1" || outline?.["@_val"] === true) {
14364
+ if (outline?.["@_val"] === "1") {
14210
14365
  result.showOutline = true;
14211
14366
  hasProps = true;
14212
14367
  }
14213
14368
  const keys = xmlLookup.getChildByLocalName(dTable, "showKeys");
14214
- if (keys?.["@_val"] === "1" || keys?.["@_val"] === true) {
14369
+ if (keys?.["@_val"] === "1") {
14215
14370
  result.showKeys = true;
14216
14371
  hasProps = true;
14217
14372
  }
@@ -14352,7 +14507,7 @@ function parseSeriesDataPoints(seriesNode, xmlLookup, colorParser) {
14352
14507
  result.explosion = explosion;
14353
14508
  }
14354
14509
  const invertNode = xmlLookup.getChildByLocalName(node, "invertIfNegative");
14355
- if (invertNode?.["@_val"] === "1" || invertNode?.["@_val"] === true) {
14510
+ if (invertNode?.["@_val"] === "1") {
14356
14511
  result.invertIfNegative = true;
14357
14512
  }
14358
14513
  const markerResult = parseMarker(
@@ -14388,9 +14543,9 @@ function parseSeriesDataLabels(seriesNode, xmlLookup) {
14388
14543
  ];
14389
14544
  for (const [xmlName, propName] of boolFields) {
14390
14545
  const child = xmlLookup.getChildByLocalName(node, xmlName);
14391
- if (child?.["@_val"] === "1" || child?.["@_val"] === true) {
14546
+ if (child?.["@_val"] === "1") {
14392
14547
  result[propName] = true;
14393
- } else if (child?.["@_val"] === "0" || child?.["@_val"] === false) {
14548
+ } else if (child?.["@_val"] === "0") {
14394
14549
  result[propName] = false;
14395
14550
  }
14396
14551
  }
@@ -14495,7 +14650,7 @@ function parseSingleAxis(axisNode, axisType, xmlLookup, colorParser) {
14495
14650
  if (formatCode) {
14496
14651
  result.numFmt = {
14497
14652
  formatCode,
14498
- sourceLinked: numFmtNode["@_sourceLinked"] === "1" || numFmtNode["@_sourceLinked"] === true
14653
+ sourceLinked: numFmtNode["@_sourceLinked"] === "1"
14499
14654
  };
14500
14655
  }
14501
14656
  }
@@ -14533,7 +14688,7 @@ function parseSingleAxis(axisNode, axisType, xmlLookup, colorParser) {
14533
14688
  const deleteNode = xmlLookup.getChildByLocalName(axisNode, "delete");
14534
14689
  if (deleteNode) {
14535
14690
  const delVal = deleteNode["@_val"];
14536
- if (delVal === "1" || delVal === true) {
14691
+ if (delVal === "1") {
14537
14692
  result.deleted = true;
14538
14693
  }
14539
14694
  }
@@ -14658,7 +14813,7 @@ function parseTxPr(txPrNode, xmlLookup, colorParser, target) {
14658
14813
  if (sz !== void 0) {
14659
14814
  target.fontSize = sz / 100;
14660
14815
  }
14661
- if (defRPr["@_b"] === "1" || defRPr["@_b"] === true) {
14816
+ if (defRPr["@_b"] === "1") {
14662
14817
  target.fontBold = true;
14663
14818
  }
14664
14819
  const latin = xmlLookup.getChildByLocalName(defRPr, "latin");
@@ -16113,7 +16268,7 @@ function parseViewProperties(viewPrRoot) {
16113
16268
  }
16114
16269
  const showComments = viewPrRoot["@_showComments"];
16115
16270
  if (showComments !== void 0) {
16116
- props.showComments = showComments !== "0" && showComments !== false;
16271
+ props.showComments = showComments !== "0";
16117
16272
  }
16118
16273
  const normalViewPr = viewPrRoot["p:normalViewPr"];
16119
16274
  if (normalViewPr) {
@@ -16160,11 +16315,11 @@ function parseNormalViewPr(node) {
16160
16315
  const result = {};
16161
16316
  const showOutlineIcons = node["@_showOutlineIcons"];
16162
16317
  if (showOutlineIcons !== void 0) {
16163
- result.showOutlineIcons = showOutlineIcons !== "0" && showOutlineIcons !== false;
16318
+ result.showOutlineIcons = showOutlineIcons !== "0";
16164
16319
  }
16165
16320
  const snapVertSplitter = node["@_snapVertSplitter"];
16166
16321
  if (snapVertSplitter !== void 0) {
16167
- result.snapVertSplitter = snapVertSplitter === "1" || snapVertSplitter === true;
16322
+ result.snapVertSplitter = snapVertSplitter === "1";
16168
16323
  }
16169
16324
  const vertBarState = String(node["@_vertBarState"] || "").trim();
16170
16325
  if (vertBarState.length > 0) {
@@ -16176,7 +16331,7 @@ function parseNormalViewPr(node) {
16176
16331
  }
16177
16332
  const preferSingleView = node["@_preferSingleView"];
16178
16333
  if (preferSingleView !== void 0) {
16179
- result.preferSingleView = preferSingleView === "1" || preferSingleView === true;
16334
+ result.preferSingleView = preferSingleView === "1";
16180
16335
  }
16181
16336
  const restoredLeft = node["p:restoredLeft"];
16182
16337
  if (restoredLeft) {
@@ -16193,22 +16348,22 @@ function parseRestoredRegion(node) {
16193
16348
  const autoAdjust = node["@_autoAdjust"];
16194
16349
  return {
16195
16350
  sz: Number.isFinite(sz) ? sz : 0,
16196
- autoAdjust: autoAdjust !== void 0 ? autoAdjust !== "0" && autoAdjust !== false : void 0
16351
+ autoAdjust: autoAdjust !== void 0 ? autoAdjust !== "0" : void 0
16197
16352
  };
16198
16353
  }
16199
16354
  function parseCommonSlideViewPr(node) {
16200
16355
  const result = {};
16201
16356
  const snapToGrid = node["@_snapToGrid"];
16202
16357
  if (snapToGrid !== void 0) {
16203
- result.snapToGrid = snapToGrid !== "0" && snapToGrid !== false;
16358
+ result.snapToGrid = snapToGrid !== "0";
16204
16359
  }
16205
16360
  const snapToObjects = node["@_snapToObjects"];
16206
16361
  if (snapToObjects !== void 0) {
16207
- result.snapToObjects = snapToObjects !== "0" && snapToObjects !== false;
16362
+ result.snapToObjects = snapToObjects !== "0";
16208
16363
  }
16209
16364
  const showGuides = node["@_showGuides"];
16210
16365
  if (showGuides !== void 0) {
16211
- result.showGuides = showGuides !== "0" && showGuides !== false;
16366
+ result.showGuides = showGuides !== "0";
16212
16367
  }
16213
16368
  const origin = node["p:origin"];
16214
16369
  if (origin) {
@@ -26856,15 +27011,15 @@ async function repairPptx(buffer) {
26856
27011
  }
26857
27012
  await addMissingRelationships(zip, parser, repairs);
26858
27013
  const xmlPaths = Object.keys(zip.files).filter((p) => p.endsWith(".xml") && !zip.files[p].dir);
26859
- for (const xmlPath of xmlPaths) {
26860
- const xml = await readZipText(zip, xmlPath);
27014
+ for (const xmlPath2 of xmlPaths) {
27015
+ const xml = await readZipText(zip, xmlPath2);
26861
27016
  if (!xml) {
26862
27017
  continue;
26863
27018
  }
26864
27019
  const { fixed, didFix } = fixMalformedXml(xml);
26865
27020
  if (didFix) {
26866
- zip.file(xmlPath, fixed);
26867
- repairs.push(`Fixed malformed XML in "${xmlPath}"`);
27021
+ zip.file(xmlPath2, fixed);
27022
+ repairs.push(`Fixed malformed XML in "${xmlPath2}"`);
26868
27023
  }
26869
27024
  }
26870
27025
  const repairedBuffer = await zip.generateAsync({ type: "arraybuffer" });
@@ -30125,7 +30280,7 @@ function parseShowProperties(showPr) {
30125
30280
  }
30126
30281
  }
30127
30282
  }
30128
- props.loopContinuously = showPr["@_loop"] === "1" || showPr["@_loop"] === true;
30283
+ props.loopContinuously = showPr["@_loop"] === "1";
30129
30284
  props.showWithNarration = showPr["@_showNarration"] !== "0";
30130
30285
  props.showWithAnimation = showPr["@_showAnimation"] !== "0";
30131
30286
  if (showPr["@_useTimings"] === "0") {
@@ -30856,15 +31011,15 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
30856
31011
  }
30857
31012
  getCnvPrNode(shape, key) {
30858
31013
  if (key === "p:pic") {
30859
- return shape?.["p:nvPicPr"]?.["p:cNvPr"];
31014
+ return xmlPath(shape, "p:nvPicPr", "p:cNvPr");
30860
31015
  }
30861
31016
  if (key === "p:cxnSp") {
30862
- return shape?.["p:nvCxnSpPr"]?.["p:cNvPr"];
31017
+ return xmlPath(shape, "p:nvCxnSpPr", "p:cNvPr");
30863
31018
  }
30864
31019
  if (key === "p:graphicFrame") {
30865
- return shape?.["p:nvGraphicFramePr"]?.["p:cNvPr"];
31020
+ return xmlPath(shape, "p:nvGraphicFramePr", "p:cNvPr");
30866
31021
  }
30867
- return shape?.["p:nvSpPr"]?.["p:cNvPr"];
31022
+ return xmlPath(shape, "p:nvSpPr", "p:cNvPr");
30868
31023
  }
30869
31024
  /**
30870
31025
  * Serialize shape-level actions back onto the `p:cNvPr` node, updating
@@ -30894,13 +31049,13 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
30894
31049
  let container;
30895
31050
  let lockTag;
30896
31051
  if (key === "p:pic") {
30897
- container = shape?.["p:nvPicPr"]?.["p:cNvPicPr"];
31052
+ container = xmlPath(shape, "p:nvPicPr", "p:cNvPicPr");
30898
31053
  lockTag = "a:picLocks";
30899
31054
  } else if (key === "p:cxnSp") {
30900
- container = shape?.["p:nvCxnSpPr"]?.["p:cNvCxnSpPr"];
31055
+ container = xmlPath(shape, "p:nvCxnSpPr", "p:cNvCxnSpPr");
30901
31056
  lockTag = "a:cxnSpLocks";
30902
31057
  } else if (key === "p:sp") {
30903
- container = shape?.["p:nvSpPr"]?.["p:cNvSpPr"];
31058
+ container = xmlPath(shape, "p:nvSpPr", "p:cNvSpPr");
30904
31059
  lockTag = "a:spLocks";
30905
31060
  } else {
30906
31061
  return;
@@ -31321,13 +31476,13 @@ var PptxHandlerRuntime5 = class extends PptxHandlerRuntime4 {
31321
31476
  effects.blur = blurEffect;
31322
31477
  hasAny = true;
31323
31478
  }
31324
- const extLst = blip["a:extLst"];
31479
+ const extLst = xmlChild(blip, "a:extLst");
31325
31480
  if (extLst) {
31326
31481
  const exts = this.ensureArray(extLst["a:ext"]);
31327
31482
  for (const ext of exts) {
31328
- const uri = String(ext["@_uri"] || "");
31483
+ const uri = xmlAttr(ext, "uri") || "";
31329
31484
  if (uri === "{BEBA8EAE-BF5A-486C-A8C5-ECC9F3942E4B}") {
31330
- const imgEffect = ext["a14:imgEffect"] || ext["a14:imgLayer"];
31485
+ const imgEffect = xmlChild(ext, "a14:imgEffect") || xmlChild(ext, "a14:imgLayer");
31331
31486
  if (imgEffect) {
31332
31487
  const keys = Object.keys(imgEffect).filter((k) => k.startsWith("a14:artistic"));
31333
31488
  if (keys.length > 0) {
@@ -31362,17 +31517,17 @@ var PptxHandlerRuntime5 = class extends PptxHandlerRuntime4 {
31362
31517
  if (!blip) {
31363
31518
  return void 0;
31364
31519
  }
31365
- const extLst = blip["a:extLst"];
31520
+ const extLst = xmlChild(blip, "a:extLst");
31366
31521
  if (!extLst) {
31367
31522
  return void 0;
31368
31523
  }
31369
31524
  const exts = this.ensureArray(extLst["a:ext"]);
31370
31525
  for (const ext of exts) {
31371
- const uri = String(ext["@_uri"] || "");
31526
+ const uri = xmlAttr(ext, "uri") || "";
31372
31527
  if (uri === "{96DAC541-7B7A-43D3-8B79-37D633B846F1}") {
31373
- const svgBlip = ext["asvg:svgBlip"] || ext["a16:svgBlip"];
31528
+ const svgBlip = xmlChild(ext, "asvg:svgBlip") || xmlChild(ext, "a16:svgBlip");
31374
31529
  if (svgBlip) {
31375
- return String(svgBlip["@_r:embed"] || svgBlip["@_r:link"] || "");
31530
+ return xmlAttr(svgBlip, "r:embed") || xmlAttr(svgBlip, "r:link") || "";
31376
31531
  }
31377
31532
  }
31378
31533
  }
@@ -31501,7 +31656,7 @@ function parseCtnMediaTiming(cTn, mediaTag) {
31501
31656
  loop = true;
31502
31657
  }
31503
31658
  const nodeType = cTn["@_nodeType"];
31504
- if (nodeType === "1" || nodeType === "2" || nodeType === 1 || nodeType === 2) {
31659
+ if (nodeType === "1" || nodeType === "2") {
31505
31660
  autoPlay = true;
31506
31661
  }
31507
31662
  const dur = cTn["@_dur"];
@@ -31622,7 +31777,7 @@ var PptxHandlerRuntime6 = class extends PptxHandlerRuntime5 {
31622
31777
  }
31623
31778
  const cTn2 = cMediaNode["p:cTn"];
31624
31779
  const timing = parseCtnMediaTiming(cTn2, mediaTag);
31625
- const fullScreen = cMediaNode["@_fullScrn"] === "1" || cMediaNode["@_fullScrn"] === true;
31780
+ const fullScreen = cMediaNode["@_fullScrn"] === "1";
31626
31781
  let volume;
31627
31782
  const volRaw = cMediaNode["@_vol"];
31628
31783
  if (volRaw !== void 0) {
@@ -31631,7 +31786,7 @@ var PptxHandlerRuntime6 = class extends PptxHandlerRuntime5 {
31631
31786
  volume = Math.max(0, Math.min(1, volVal / 1e5));
31632
31787
  }
31633
31788
  }
31634
- const hideWhenNotPlaying = cMediaNode["@_showWhenStopped"] === "0" || cMediaNode["@_showWhenStopped"] === false;
31789
+ const hideWhenNotPlaying = cMediaNode["@_showWhenStopped"] === "0";
31635
31790
  let posterFramePath;
31636
31791
  const posterRId = cMediaNode["@_posterFrame"];
31637
31792
  if (posterRId) {
@@ -32264,11 +32419,11 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32264
32419
  if (!bg) {
32265
32420
  return void 0;
32266
32421
  }
32267
- const bgPr = bg["p:bgPr"];
32422
+ const bgPr = xmlChild(bg, "p:bgPr");
32268
32423
  if (bgPr) {
32269
- return this.parseColor(bgPr["a:solidFill"]);
32424
+ return this.parseColor(xmlChild(bgPr, "a:solidFill"));
32270
32425
  }
32271
- const bgRef = bg["p:bgRef"];
32426
+ const bgRef = xmlChild(bg, "p:bgRef");
32272
32427
  if (bgRef) {
32273
32428
  return this.parseColor(bgRef);
32274
32429
  }
@@ -32284,13 +32439,12 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32284
32439
  const shapes = this.ensureArray(spTree["p:sp"]);
32285
32440
  const result = [];
32286
32441
  for (const sp of shapes) {
32287
- const nvPr = sp?.["p:nvSpPr"]?.["p:nvPr"];
32288
- const ph = nvPr?.["p:ph"];
32442
+ const ph = xmlPath(sp, "p:nvSpPr", "p:nvPr", "p:ph");
32289
32443
  if (!ph) {
32290
32444
  continue;
32291
32445
  }
32292
- const type = String(ph["@_type"] || "body").trim();
32293
- const idx = ph["@_idx"] !== void 0 ? String(ph["@_idx"]) : void 0;
32446
+ const type = (xmlAttr(ph, "type") ?? "body").trim();
32447
+ const idx = xmlAttr(ph, "idx");
32294
32448
  result.push({ type, idx });
32295
32449
  }
32296
32450
  return result;
@@ -32381,7 +32535,7 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32381
32535
  const relsXml = await relsFile.async("string");
32382
32536
  const relsData = this.parser.parse(relsXml);
32383
32537
  const rels = this.ensureArray(
32384
- relsData?.["Relationships"]?.["Relationship"]
32538
+ xmlChild(relsData, "Relationships")?.["Relationship"]
32385
32539
  );
32386
32540
  for (const rel of rels) {
32387
32541
  const relType = String(rel["@_Type"] || "");
@@ -32396,7 +32550,7 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32396
32550
  const relsXml = await relsFile.async("string");
32397
32551
  const relsData = this.parser.parse(relsXml);
32398
32552
  const rels = this.ensureArray(
32399
- relsData?.["Relationships"]?.["Relationship"]
32553
+ xmlChild(relsData, "Relationships")?.["Relationship"]
32400
32554
  );
32401
32555
  for (const rel of rels) {
32402
32556
  const relType = String(rel["@_Type"] || "");
@@ -32442,9 +32596,9 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32442
32596
  if (!master) {
32443
32597
  return void 0;
32444
32598
  }
32445
- const bg = master["p:cSld"]?.["p:bg"];
32599
+ const bg = xmlPath(master, "p:cSld", "p:bg");
32446
32600
  const bgColor = this.parseBackgroundColor(bg);
32447
- const spTree = master["p:cSld"]?.["p:spTree"];
32601
+ const spTree = xmlPath(master, "p:cSld", "p:spTree");
32448
32602
  const placeholders = this.extractPlaceholderList(spTree);
32449
32603
  const result = { path, backgroundColor: bgColor, placeholders };
32450
32604
  const hf = parseHeaderFooterFlags(master["p:hf"]);
@@ -32473,9 +32627,9 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32473
32627
  if (!master) {
32474
32628
  return void 0;
32475
32629
  }
32476
- const bg = master["p:cSld"]?.["p:bg"];
32630
+ const bg = xmlPath(master, "p:cSld", "p:bg");
32477
32631
  const bgColor = this.parseBackgroundColor(bg);
32478
- const spTree = master["p:cSld"]?.["p:spTree"];
32632
+ const spTree = xmlPath(master, "p:cSld", "p:spTree");
32479
32633
  const placeholders = this.extractPlaceholderList(spTree);
32480
32634
  const result = { path, backgroundColor: bgColor, placeholders };
32481
32635
  const hf = parseHeaderFooterFlags(master["p:hf"]);
@@ -32507,7 +32661,7 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32507
32661
  this.layoutXmlMap.set(layoutPath, data);
32508
32662
  }
32509
32663
  const layout = { path: layoutPath };
32510
- const cSldName = String(sldLayout["p:cSld"]?.["@_name"] || "").trim();
32664
+ const cSldName = (xmlAttr(xmlChild(sldLayout, "p:cSld"), "name") ?? "").trim();
32511
32665
  if (cSldName) {
32512
32666
  layout.name = cSldName;
32513
32667
  }
@@ -32564,12 +32718,12 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32564
32718
  }
32565
32719
  }
32566
32720
  }
32567
- const bg = sldLayout["p:cSld"]?.["p:bg"];
32721
+ const bg = xmlPath(sldLayout, "p:cSld", "p:bg");
32568
32722
  const bgColor = this.parseBackgroundColor(bg);
32569
32723
  if (bgColor) {
32570
32724
  layout.backgroundColor = bgColor;
32571
32725
  }
32572
- const spTree = sldLayout["p:cSld"]?.["p:spTree"];
32726
+ const spTree = xmlPath(sldLayout, "p:cSld", "p:spTree");
32573
32727
  const placeholders = this.extractPlaceholderList(spTree);
32574
32728
  if (placeholders.length > 0) {
32575
32729
  layout.placeholders = placeholders;
@@ -32585,7 +32739,7 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
32585
32739
  */
32586
32740
  parseCustomShows() {
32587
32741
  try {
32588
- const custShowLst = this.presentationData?.["p:presentation"]?.["p:custShowLst"];
32742
+ const custShowLst = xmlPath(this.presentationData, "p:presentation", "p:custShowLst");
32589
32743
  if (!custShowLst) {
32590
32744
  return void 0;
32591
32745
  }
@@ -32643,7 +32797,7 @@ var PptxHandlerRuntime10 = class extends PptxHandlerRuntime9 {
32643
32797
  }
32644
32798
  const prnPr = presProps["p:prnPr"];
32645
32799
  if (prnPr) {
32646
- props.printFrameSlides = prnPr["@_frameSlides"] === "1" || prnPr["@_frameSlides"] === true;
32800
+ props.printFrameSlides = prnPr["@_frameSlides"] === "1";
32647
32801
  const slidesPerPageRaw = prnPr["@_sldPerPg"] ?? prnPr["@_slidesPerPage"];
32648
32802
  if (slidesPerPageRaw !== void 0) {
32649
32803
  const slidesPerPage = Number.parseInt(String(slidesPerPageRaw), 10);
@@ -32907,7 +33061,11 @@ var PptxHandlerRuntime11 = class extends PptxHandlerRuntime10 {
32907
33061
  }
32908
33062
  const cSld = pSld["p:cSld"];
32909
33063
  if (!cSld["p:spTree"]) {
32910
- cSld["p:spTree"] = this.createEmptySlideXml()["p:sld"]["p:cSld"]["p:spTree"];
33064
+ const emptySlide = this.createEmptySlideXml();
33065
+ const emptyTree = emptySlide["p:sld"]?.["p:cSld"]?.["p:spTree"];
33066
+ if (emptyTree) {
33067
+ cSld["p:spTree"] = emptyTree;
33068
+ }
32911
33069
  }
32912
33070
  pSld["p:cSld"] = cSld;
32913
33071
  xmlObj["p:sld"] = pSld;
@@ -33512,7 +33670,7 @@ var PptxHandlerRuntime13 = class extends PptxHandlerRuntime12 {
33512
33670
  resolveHyperlinkRelationshipId
33513
33671
  );
33514
33672
  }
33515
- brNode.__isLineBreak = true;
33673
+ brNode["__isLineBreak"] = true;
33516
33674
  currentRuns.push(brNode);
33517
33675
  return;
33518
33676
  }
@@ -34809,7 +34967,7 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
34809
34967
  }
34810
34968
  }
34811
34969
  if (runProperties["a:highlight"]) {
34812
- const highlightHex = this.parseColor(runProperties["a:highlight"]);
34970
+ const highlightHex = this.parseColor(xmlChild(runProperties, "a:highlight"));
34813
34971
  if (highlightHex) {
34814
34972
  style.highlightColor = highlightHex;
34815
34973
  }
@@ -34830,29 +34988,23 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
34830
34988
  if (runRtl !== void 0) {
34831
34989
  style.rtl = runRtl;
34832
34990
  }
34833
- const latin = runProperties["a:latin"];
34834
- const eastAsian = runProperties["a:ea"];
34835
- const complexScript = runProperties["a:cs"];
34836
- const chosenTypeface = latin?.["@_typeface"] || eastAsian?.["@_typeface"] || complexScript?.["@_typeface"];
34837
- const resolvedTypeface = this.resolveThemeTypeface(
34838
- typeof chosenTypeface === "string" ? chosenTypeface : void 0
34839
- );
34991
+ const latin = xmlChild(runProperties, "a:latin");
34992
+ const eastAsian = xmlChild(runProperties, "a:ea");
34993
+ const complexScript = xmlChild(runProperties, "a:cs");
34994
+ const chosenTypeface = xmlAttr(latin, "typeface") || xmlAttr(eastAsian, "typeface") || xmlAttr(complexScript, "typeface");
34995
+ const resolvedTypeface = this.resolveThemeTypeface(chosenTypeface);
34840
34996
  if (resolvedTypeface) {
34841
34997
  style.fontFamily = resolvedTypeface;
34842
34998
  }
34843
- const eaTypeface = this.resolveThemeTypeface(
34844
- typeof eastAsian?.["@_typeface"] === "string" ? eastAsian["@_typeface"] : void 0
34845
- );
34999
+ const eaTypeface = this.resolveThemeTypeface(xmlAttr(eastAsian, "typeface"));
34846
35000
  if (eaTypeface) {
34847
35001
  style.eastAsiaFont = eaTypeface;
34848
35002
  }
34849
- const csTypeface = this.resolveThemeTypeface(
34850
- typeof complexScript?.["@_typeface"] === "string" ? complexScript["@_typeface"] : void 0
34851
- );
35003
+ const csTypeface = this.resolveThemeTypeface(xmlAttr(complexScript, "typeface"));
34852
35004
  if (csTypeface) {
34853
35005
  style.complexScriptFont = csTypeface;
34854
35006
  }
34855
- const solidFill = runProperties["a:solidFill"];
35007
+ const solidFill = xmlChild(runProperties, "a:solidFill");
34856
35008
  if (solidFill) {
34857
35009
  style.color = this.parseColor(solidFill);
34858
35010
  const colorXml = extractColorChoiceXml(solidFill);
@@ -34865,11 +35017,9 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
34865
35017
  if (capAttr === "all" || capAttr === "small") {
34866
35018
  style.textCaps = capAttr;
34867
35019
  }
34868
- const symNode = runProperties["a:sym"];
35020
+ const symNode = xmlChild(runProperties, "a:sym");
34869
35021
  if (symNode) {
34870
- const symTypeface = this.normalizeTypefaceToken(
34871
- typeof symNode["@_typeface"] === "string" ? symNode["@_typeface"] : ""
34872
- );
35022
+ const symTypeface = this.normalizeTypefaceToken(xmlAttr(symNode, "typeface") || "");
34873
35023
  if (symTypeface) {
34874
35024
  style.symbolFont = symTypeface;
34875
35025
  }
@@ -34919,7 +35069,7 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
34919
35069
  this.applyTextFontMetadata(style, latin, "latin");
34920
35070
  this.applyTextFontMetadata(style, eastAsian, "eastAsia");
34921
35071
  this.applyTextFontMetadata(style, complexScript, "complexScript");
34922
- this.applyTextFontMetadata(style, runProperties["a:sym"], "symbol");
35072
+ this.applyTextFontMetadata(style, symNode, "symbol");
34923
35073
  const runEffectList = runProperties["a:effectLst"];
34924
35074
  if (runEffectList) {
34925
35075
  this.applyTextRunEffects(style, runEffectList);
@@ -35207,7 +35357,7 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
35207
35357
  if (!raw) {
35208
35358
  return null;
35209
35359
  }
35210
- const nvPr = raw["p:nvSpPr"]?.["p:nvPr"] ?? raw["p:nvPicPr"]?.["p:nvPr"] ?? raw["p:nvGraphicFramePr"]?.["p:nvPr"];
35360
+ const nvPr = xmlPath(raw, "p:nvSpPr", "p:nvPr") ?? xmlPath(raw, "p:nvPicPr", "p:nvPr") ?? xmlPath(raw, "p:nvGraphicFramePr", "p:nvPr");
35211
35361
  return this.readPlaceholderInfoFromNvPr(nvPr);
35212
35362
  }
35213
35363
  // ── Layout placeholder extraction ───────────────────────────────────
@@ -35216,15 +35366,14 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
35216
35366
  * their placeholder info and their transform (position/size in EMU).
35217
35367
  */
35218
35368
  extractLayoutPlaceholders(layoutXml) {
35219
- const sldLayout = layoutXml["p:sldLayout"];
35220
- const spTree = sldLayout?.["p:cSld"]?.["p:spTree"];
35369
+ const spTree = xmlPath(layoutXml, "p:sldLayout", "p:cSld", "p:spTree");
35221
35370
  if (!spTree) {
35222
35371
  return [];
35223
35372
  }
35224
35373
  const result = [];
35225
35374
  const shapes = this.ensureArray(spTree["p:sp"]);
35226
35375
  for (const shape of shapes) {
35227
- const nvPr = shape?.["p:nvSpPr"]?.["p:nvPr"];
35376
+ const nvPr = xmlPath(shape, "p:nvSpPr", "p:nvPr");
35228
35377
  const phInfo = this.readPlaceholderInfoFromNvPr(nvPr);
35229
35378
  if (!phInfo) {
35230
35379
  continue;
@@ -35547,7 +35696,9 @@ function writeCellTextFormatting(xmlCell, style, ensureArray7) {
35547
35696
  if (style.bold === void 0 && style.italic === void 0 && style.underline === void 0 && style.fontSize === void 0 && style.color === void 0) {
35548
35697
  return;
35549
35698
  }
35550
- const paragraphs = ensureArray7(xmlCell["a:txBody"]?.["a:p"]);
35699
+ const paragraphs = ensureArray7(
35700
+ xmlCell["a:txBody"]?.["a:p"]
35701
+ );
35551
35702
  for (const paragraph of paragraphs) {
35552
35703
  const runs = ensureArray7(paragraph?.["a:r"]);
35553
35704
  const rebuiltRuns = [];
@@ -35650,7 +35801,9 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
35650
35801
  tcPr["@_vert"] = style.textDirection;
35651
35802
  }
35652
35803
  if (style.align) {
35653
- const firstP = this.ensureArray(xmlCell["a:txBody"]?.["a:p"])[0];
35804
+ const firstP = this.ensureArray(
35805
+ xmlCell["a:txBody"]?.["a:p"]
35806
+ )[0];
35654
35807
  if (firstP) {
35655
35808
  if (!firstP["a:pPr"]) {
35656
35809
  firstP["a:pPr"] = {};
@@ -36014,14 +36167,14 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
36014
36167
  */
36015
36168
  serializeTableDataToXml(shape, tableData) {
36016
36169
  try {
36017
- const graphicData = shape["a:graphic"]?.["a:graphicData"];
36018
- const tbl = graphicData?.["a:tbl"];
36170
+ const graphicData = xmlPath(shape, "a:graphic", "a:graphicData");
36171
+ const tbl = xmlChild(graphicData, "a:tbl");
36019
36172
  if (!tbl) {
36020
36173
  return;
36021
36174
  }
36022
36175
  serializeTablePropertyFlags(tbl, tableData);
36023
36176
  const xmlRows = this.ensureArray(tbl["a:tr"]);
36024
- const xmlColCount = this.ensureArray(tbl["a:tblGrid"]?.["a:gridCol"]).length;
36177
+ const xmlColCount = this.ensureArray(xmlChild(tbl, "a:tblGrid")?.["a:gridCol"]).length;
36025
36178
  const dataRowCount = tableData.rows.length;
36026
36179
  const dataColCount = tableData.columnWidths.length;
36027
36180
  const structureChanged = dataRowCount !== xmlRows.length || dataColCount !== xmlColCount;
@@ -37194,12 +37347,12 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
37194
37347
  if (!file) {
37195
37348
  continue;
37196
37349
  }
37197
- const xmlText = await file.async("string");
37198
- if (!xmlText.trim()) {
37350
+ const xmlText2 = await file.async("string");
37351
+ if (!xmlText2.trim()) {
37199
37352
  continue;
37200
37353
  }
37201
37354
  try {
37202
- const parsed = parse(xmlText);
37355
+ const parsed = parse(xmlText2);
37203
37356
  if (typeof parsed !== "object" || parsed === null) {
37204
37357
  continue;
37205
37358
  }
@@ -37223,7 +37376,9 @@ var PptxHandlerRuntime25 = class extends PptxHandlerRuntime24 {
37223
37376
  if (relsXml) {
37224
37377
  try {
37225
37378
  const relsData = this.parser.parse(relsXml);
37226
- const relNodes = this.ensureArray(relsData?.Relationships?.Relationship);
37379
+ const relNodes = this.ensureArray(
37380
+ relsData?.Relationships?.Relationship
37381
+ );
37227
37382
  const relNode = relNodes.find((node) => {
37228
37383
  const relType = String(node?.["@_Type"] || "");
37229
37384
  const relTarget = String(node?.["@_Target"] || "");
@@ -37597,7 +37752,9 @@ var PptxHandlerRuntime27 = class extends PptxHandlerRuntime26 {
37597
37752
  if (!rawExts) {
37598
37753
  continue;
37599
37754
  }
37600
- const extsArray = Array.isArray(rawExts) ? rawExts : [rawExts];
37755
+ const extsArray = (Array.isArray(rawExts) ? rawExts : [rawExts]).filter(
37756
+ (ext) => typeof ext === "object" && ext !== null
37757
+ );
37601
37758
  if (extsArray.length <= 1) {
37602
37759
  continue;
37603
37760
  }
@@ -38109,13 +38266,13 @@ var PptxHandlerRuntime29 = class extends PptxHandlerRuntime28 {
38109
38266
  if (s3d.cameraRotX !== void 0 || s3d.cameraRotY !== void 0 || s3d.cameraRotZ !== void 0) {
38110
38267
  const rot = {};
38111
38268
  if (s3d.cameraRotX !== void 0) {
38112
- rot["@_lat"] = s3d.cameraRotX;
38269
+ rot["@_lat"] = String(s3d.cameraRotX);
38113
38270
  }
38114
38271
  if (s3d.cameraRotY !== void 0) {
38115
- rot["@_lon"] = s3d.cameraRotY;
38272
+ rot["@_lon"] = String(s3d.cameraRotY);
38116
38273
  }
38117
38274
  if (s3d.cameraRotZ !== void 0) {
38118
- rot["@_rev"] = s3d.cameraRotZ;
38275
+ rot["@_rev"] = String(s3d.cameraRotZ);
38119
38276
  }
38120
38277
  cameraObj["a:rot"] = rot;
38121
38278
  }
@@ -38135,9 +38292,9 @@ var PptxHandlerRuntime29 = class extends PptxHandlerRuntime28 {
38135
38292
  const backdropObj = {};
38136
38293
  if (s3d.backdropAnchorX !== void 0 || s3d.backdropAnchorY !== void 0 || s3d.backdropAnchorZ !== void 0) {
38137
38294
  backdropObj["a:anchor"] = {
38138
- "@_x": s3d.backdropAnchorX ?? 0,
38139
- "@_y": s3d.backdropAnchorY ?? 0,
38140
- "@_z": s3d.backdropAnchorZ ?? 0
38295
+ "@_x": String(s3d.backdropAnchorX ?? 0),
38296
+ "@_y": String(s3d.backdropAnchorY ?? 0),
38297
+ "@_z": String(s3d.backdropAnchorZ ?? 0)
38141
38298
  };
38142
38299
  }
38143
38300
  scene3dXml["a:backdrop"] = backdropObj;
@@ -38155,10 +38312,10 @@ var PptxHandlerRuntime29 = class extends PptxHandlerRuntime28 {
38155
38312
  if (hasData) {
38156
38313
  const sp3dXml = {};
38157
38314
  if (sh3d.extrusionHeight !== void 0) {
38158
- sp3dXml["@_extrusionH"] = sh3d.extrusionHeight;
38315
+ sp3dXml["@_extrusionH"] = String(sh3d.extrusionHeight);
38159
38316
  }
38160
38317
  if (sh3d.contourWidth !== void 0) {
38161
- sp3dXml["@_contourW"] = sh3d.contourWidth;
38318
+ sp3dXml["@_contourW"] = String(sh3d.contourWidth);
38162
38319
  }
38163
38320
  if (sh3d.presetMaterial) {
38164
38321
  sp3dXml["@_prstMaterial"] = sh3d.presetMaterial;
@@ -38166,20 +38323,20 @@ var PptxHandlerRuntime29 = class extends PptxHandlerRuntime28 {
38166
38323
  if (sh3d.bevelTopType) {
38167
38324
  const bevelT = { "@_prst": sh3d.bevelTopType };
38168
38325
  if (sh3d.bevelTopWidth !== void 0) {
38169
- bevelT["@_w"] = sh3d.bevelTopWidth;
38326
+ bevelT["@_w"] = String(sh3d.bevelTopWidth);
38170
38327
  }
38171
38328
  if (sh3d.bevelTopHeight !== void 0) {
38172
- bevelT["@_h"] = sh3d.bevelTopHeight;
38329
+ bevelT["@_h"] = String(sh3d.bevelTopHeight);
38173
38330
  }
38174
38331
  sp3dXml["a:bevelT"] = bevelT;
38175
38332
  }
38176
38333
  if (sh3d.bevelBottomType) {
38177
38334
  const bevelB = { "@_prst": sh3d.bevelBottomType };
38178
38335
  if (sh3d.bevelBottomWidth !== void 0) {
38179
- bevelB["@_w"] = sh3d.bevelBottomWidth;
38336
+ bevelB["@_w"] = String(sh3d.bevelBottomWidth);
38180
38337
  }
38181
38338
  if (sh3d.bevelBottomHeight !== void 0) {
38182
- bevelB["@_h"] = sh3d.bevelBottomHeight;
38339
+ bevelB["@_h"] = String(sh3d.bevelBottomHeight);
38183
38340
  }
38184
38341
  sp3dXml["a:bevelB"] = bevelB;
38185
38342
  }
@@ -38401,7 +38558,7 @@ var PptxHandlerRuntime30 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
38401
38558
  if (t3d && Object.keys(t3d).length > 0) {
38402
38559
  const sp3dXml = {};
38403
38560
  if (t3d.extrusionHeight) {
38404
- sp3dXml["@_extrusionH"] = t3d.extrusionHeight;
38561
+ sp3dXml["@_extrusionH"] = String(t3d.extrusionHeight);
38405
38562
  }
38406
38563
  if (t3d.presetMaterial) {
38407
38564
  sp3dXml["@_prstMaterial"] = t3d.presetMaterial;
@@ -38409,20 +38566,20 @@ var PptxHandlerRuntime30 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
38409
38566
  if (t3d.bevelTopType && t3d.bevelTopType !== "none") {
38410
38567
  const bvt = { "@_prst": t3d.bevelTopType };
38411
38568
  if (t3d.bevelTopWidth) {
38412
- bvt["@_w"] = t3d.bevelTopWidth;
38569
+ bvt["@_w"] = String(t3d.bevelTopWidth);
38413
38570
  }
38414
38571
  if (t3d.bevelTopHeight) {
38415
- bvt["@_h"] = t3d.bevelTopHeight;
38572
+ bvt["@_h"] = String(t3d.bevelTopHeight);
38416
38573
  }
38417
38574
  sp3dXml["a:bevelT"] = bvt;
38418
38575
  }
38419
38576
  if (t3d.bevelBottomType && t3d.bevelBottomType !== "none") {
38420
38577
  const bvb = { "@_prst": t3d.bevelBottomType };
38421
38578
  if (t3d.bevelBottomWidth) {
38422
- bvb["@_w"] = t3d.bevelBottomWidth;
38579
+ bvb["@_w"] = String(t3d.bevelBottomWidth);
38423
38580
  }
38424
38581
  if (t3d.bevelBottomHeight) {
38425
- bvb["@_h"] = t3d.bevelBottomHeight;
38582
+ bvb["@_h"] = String(t3d.bevelBottomHeight);
38426
38583
  }
38427
38584
  sp3dXml["a:bevelB"] = bvb;
38428
38585
  }
@@ -39637,7 +39794,9 @@ var PptxHandlerRuntime39 = class extends PptxHandlerRuntime38 {
39637
39794
  }
39638
39795
  try {
39639
39796
  const relsData = this.parser.parse(relsXml);
39640
- const relNodes = this.ensureArray(relsData?.Relationships?.Relationship);
39797
+ const relNodes = this.ensureArray(
39798
+ relsData?.Relationships?.Relationship
39799
+ );
39641
39800
  const relNode = relNodes.find((node) => {
39642
39801
  const relType = String(node?.["@_Type"] || "");
39643
39802
  const relTarget = String(node?.["@_Target"] || "");
@@ -40221,9 +40380,7 @@ var PptxHandlerRuntime42 = class extends PptxHandlerRuntime41 {
40221
40380
  }
40222
40381
  const shapes = this.ensureArray(spTree["p:sp"]);
40223
40382
  for (const shape of shapes) {
40224
- const info = this.extractPlaceholderInfo(
40225
- shape?.["p:nvSpPr"]?.["p:nvPr"]
40226
- );
40383
+ const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
40227
40384
  if (!this.placeholderMatches(expected, info)) {
40228
40385
  continue;
40229
40386
  }
@@ -40231,9 +40388,7 @@ var PptxHandlerRuntime42 = class extends PptxHandlerRuntime41 {
40231
40388
  }
40232
40389
  const pictures = this.ensureArray(spTree["p:pic"]);
40233
40390
  for (const picture of pictures) {
40234
- const info = this.extractPlaceholderInfo(
40235
- picture?.["p:nvPicPr"]?.["p:nvPr"]
40236
- );
40391
+ const info = this.extractPlaceholderInfo(xmlPath(picture, "p:nvPicPr", "p:nvPr"));
40237
40392
  if (!this.placeholderMatches(expected, info)) {
40238
40393
  continue;
40239
40394
  }
@@ -40248,7 +40403,7 @@ var PptxHandlerRuntime42 = class extends PptxHandlerRuntime41 {
40248
40403
  }
40249
40404
  const layoutXmlObj = this.layoutXmlMap.get(layoutPath);
40250
40405
  const layoutContext = this.findPlaceholderInShapeTree(
40251
- layoutXmlObj?.["p:sldLayout"]?.["p:cSld"]?.["p:spTree"],
40406
+ xmlPath(layoutXmlObj, "p:sldLayout", "p:cSld", "p:spTree"),
40252
40407
  expected
40253
40408
  );
40254
40409
  if (layoutContext) {
@@ -40260,7 +40415,7 @@ var PptxHandlerRuntime42 = class extends PptxHandlerRuntime41 {
40260
40415
  }
40261
40416
  const masterXmlObj = this.masterXmlMap.get(masterPath);
40262
40417
  return this.findPlaceholderInShapeTree(
40263
- masterXmlObj?.["p:sldMaster"]?.["p:cSld"]?.["p:spTree"],
40418
+ xmlPath(masterXmlObj, "p:sldMaster", "p:cSld", "p:spTree"),
40264
40419
  expected
40265
40420
  );
40266
40421
  }
@@ -40385,7 +40540,9 @@ var PptxHandlerRuntime43 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40385
40540
  if (!prstGeom) {
40386
40541
  return void 0;
40387
40542
  }
40388
- const gdNodes = this.ensureArray(prstGeom?.["a:avLst"]?.["a:gd"]);
40543
+ const gdNodes = this.ensureArray(
40544
+ prstGeom?.["a:avLst"]?.["a:gd"]
40545
+ );
40389
40546
  if (gdNodes.length === 0) {
40390
40547
  return void 0;
40391
40548
  }
@@ -40809,10 +40966,8 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40809
40966
  */
40810
40967
  async parseShapeWithImageFill(shape, id, slidePath) {
40811
40968
  try {
40812
- const spPr = shape["p:spPr"];
40813
- const placeholderInfo = this.extractPlaceholderInfo(
40814
- shape?.["p:nvSpPr"]?.["p:nvPr"]
40815
- );
40969
+ const spPr = xmlChild(shape, "p:spPr");
40970
+ const placeholderInfo = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
40816
40971
  const inheritedPlaceholder = placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
40817
40972
  const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
40818
40973
  const effectiveSpPr = this.mergeXmlObjects(inheritedSpPr, spPr);
@@ -40820,20 +40975,22 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40820
40975
  if (!xfrm) {
40821
40976
  return null;
40822
40977
  }
40823
- const off = xfrm["a:off"];
40824
- const ext = xfrm["a:ext"];
40978
+ const off = xmlChild(xfrm, "a:off");
40979
+ const ext = xmlChild(xfrm, "a:ext");
40825
40980
  if (!off || !ext) {
40826
40981
  return null;
40827
40982
  }
40828
- const x = Math.round(parseInt(off["@_x"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40829
- const y = Math.round(parseInt(off["@_y"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40830
- const width = Math.round(parseInt(ext["@_cx"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40831
- const height = Math.round(parseInt(ext["@_cy"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40983
+ const x = Math.round(parseInt(xmlAttr(off, "x") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40984
+ const y = Math.round(parseInt(xmlAttr(off, "y") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40985
+ const width = Math.round(parseInt(xmlAttr(ext, "cx") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
40986
+ const height = Math.round(
40987
+ parseInt(xmlAttr(ext, "cy") || "0") / _PptxHandlerRuntime.EMU_PER_PX
40988
+ );
40832
40989
  const rotation = xfrm["@_rot"] ? parseInt(xfrm["@_rot"]) / 6e4 : void 0;
40833
40990
  const skewX = xfrm["@_skewX"] ? parseInt(String(xfrm["@_skewX"]), 10) / 6e4 : void 0;
40834
40991
  const skewY = xfrm["@_skewY"] ? parseInt(String(xfrm["@_skewY"]), 10) / 6e4 : void 0;
40835
40992
  const { flipHorizontal, flipVertical } = this.readFlipState(xfrm);
40836
- const prstGeom = effectiveSpPr?.["a:prstGeom"]?.["@_prst"];
40993
+ const prstGeom = xmlAttr(xmlChild(effectiveSpPr, "a:prstGeom"), "prst");
40837
40994
  const shapeAdjustments = this.parseGeometryAdjustments(
40838
40995
  effectiveSpPr?.["a:prstGeom"]
40839
40996
  );
@@ -40859,9 +41016,9 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40859
41016
  shapeAdjustments
40860
41017
  );
40861
41018
  const blipFill = effectiveSpPr?.["a:blipFill"] || spPr?.["a:blipFill"];
40862
- const blip = blipFill?.["a:blip"];
40863
- const rEmbed = blip?.["@_r:embed"];
40864
- const rLink = blip?.["@_r:link"];
41019
+ const blip = xmlChild(blipFill, "a:blip");
41020
+ const rEmbed = xmlAttr(blip, "r:embed");
41021
+ const rLink = xmlAttr(blip, "r:link");
40865
41022
  const crop = this.readImageCropFromBlipFill(blipFill);
40866
41023
  const tileNode = blipFill?.["a:tile"];
40867
41024
  const tileProps = {};
@@ -40900,9 +41057,10 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40900
41057
  );
40901
41058
  let imageData;
40902
41059
  let imagePath;
40903
- if (rEmbed || rLink) {
41060
+ const relId = rEmbed || rLink;
41061
+ if (relId) {
40904
41062
  const slideRels = this.slideRelsMap.get(slidePath);
40905
- const target = slideRels?.get(rEmbed || rLink);
41063
+ const target = slideRels?.get(relId);
40906
41064
  if (target) {
40907
41065
  if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
40908
41066
  imagePath = target;
@@ -40916,7 +41074,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
40916
41074
  }
40917
41075
  }
40918
41076
  const styleNode = shape["p:style"] || inheritedPlaceholder?.shape?.["p:style"] || inheritedPlaceholder?.picture?.["p:style"];
40919
- const sifCNvPr = shape?.["p:nvSpPr"]?.["p:cNvPr"];
41077
+ const sifCNvPr = xmlPath(shape, "p:nvSpPr", "p:cNvPr");
40920
41078
  const sifSlideRels = this.slideRelsMap.get(slidePath);
40921
41079
  const { actionClick: sifActionClick, actionHover: sifActionHover } = this.parseElementActions(
40922
41080
  sifCNvPr,
@@ -41138,10 +41296,10 @@ var PptxHandlerRuntime46 = class extends PptxHandlerRuntime45 {
41138
41296
  const level = Number.parseInt(String(paragraphProps?.["@_lvl"] || "0"), 10);
41139
41297
  const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1;
41140
41298
  const levelKey = `a:lvl${normalizedLevel}pPr`;
41141
- const inheritedLevelProps = inheritedTxBody?.["a:lstStyle"]?.[levelKey];
41142
- const bodyLevelProps = txBody?.["a:lstStyle"]?.[levelKey];
41143
- const defaultBodyProps = txBody?.["a:lstStyle"]?.["a:defPPr"];
41144
- const inheritedDefaultBodyProps = inheritedTxBody?.["a:lstStyle"]?.["a:defPPr"];
41299
+ const inheritedLevelProps = xmlChild(xmlChild(inheritedTxBody, "a:lstStyle"), levelKey);
41300
+ const bodyLevelProps = xmlChild(xmlChild(txBody, "a:lstStyle"), levelKey);
41301
+ const defaultBodyProps = xmlPath(txBody, "a:lstStyle", "a:defPPr");
41302
+ const inheritedDefaultBodyProps = xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr");
41145
41303
  const bulletPropsCandidates = [
41146
41304
  paragraphProps,
41147
41305
  bodyLevelProps,
@@ -41891,11 +42049,7 @@ var PptxHandlerRuntime49 = class extends PptxHandlerRuntime48 {
41891
42049
  const appendRun = (runText, runProps) => {
41892
42050
  const runStyle = {
41893
42051
  ...mergedDefaultRunStyle,
41894
- ...this.extractTextRunStyle(
41895
- runProps,
41896
- paraAlign,
41897
- ctx.slideRelationshipMap
41898
- )
42052
+ ...this.extractTextRunStyle(runProps, paraAlign, ctx.slideRelationshipMap)
41899
42053
  };
41900
42054
  parts.push(runText);
41901
42055
  segments.push({ text: runText, style: runStyle });
@@ -42074,10 +42228,11 @@ var PptxHandlerRuntime49 = class extends PptxHandlerRuntime48 {
42074
42228
  * </a:ruby>
42075
42229
  * ```
42076
42230
  */
42077
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42078
42231
  parseRubyElement(rubyNode, runProps, paraAlign, mergedDefaultRunStyle, slideRelationshipMap) {
42079
42232
  const rubyPr = rubyNode["a:rubyPr"];
42080
- const rubyAlign = String(rubyPr?.["@_algn"] ?? rubyPr?.["a:rubyAlign"]?.["@_val"] ?? "ctr").trim() || "ctr";
42233
+ const rubyAlign = String(
42234
+ rubyPr?.["@_algn"] ?? rubyPr?.["a:rubyAlign"]?.["@_val"] ?? "ctr"
42235
+ ).trim() || "ctr";
42081
42236
  const rtNode = rubyNode["a:rt"];
42082
42237
  let rubyText = "";
42083
42238
  let rubyFontSize;
@@ -42182,20 +42337,22 @@ var PptxHandlerRuntime50 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
42182
42337
  if (!xfrm) {
42183
42338
  return null;
42184
42339
  }
42185
- const off = xfrm["a:off"];
42186
- const ext = xfrm["a:ext"];
42340
+ const off = xmlChild(xfrm, "a:off");
42341
+ const ext = xmlChild(xfrm, "a:ext");
42187
42342
  if (!off || !ext) {
42188
42343
  return null;
42189
42344
  }
42190
- const x = Math.round(parseInt(off["@_x"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42191
- const y = Math.round(parseInt(off["@_y"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42192
- const width = Math.round(parseInt(ext["@_cx"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42193
- const height = Math.round(parseInt(ext["@_cy"] || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42345
+ const x = Math.round(parseInt(xmlAttr(off, "x") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42346
+ const y = Math.round(parseInt(xmlAttr(off, "y") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42347
+ const width = Math.round(parseInt(xmlAttr(ext, "cx") || "0") / _PptxHandlerRuntime.EMU_PER_PX);
42348
+ const height = Math.round(
42349
+ parseInt(xmlAttr(ext, "cy") || "0") / _PptxHandlerRuntime.EMU_PER_PX
42350
+ );
42194
42351
  const rotation = xfrm["@_rot"] ? parseInt(xfrm["@_rot"]) / 6e4 : void 0;
42195
42352
  const skewX = xfrm["@_skewX"] ? parseInt(String(xfrm["@_skewX"]), 10) / 6e4 : void 0;
42196
42353
  const skewY = xfrm["@_skewY"] ? parseInt(String(xfrm["@_skewY"]), 10) / 6e4 : void 0;
42197
42354
  const { flipHorizontal, flipVertical } = this.readFlipState(xfrm);
42198
- const prstGeom = effectiveSpPr?.["a:prstGeom"]?.["@_prst"];
42355
+ const prstGeom = xmlAttr(xmlChild(effectiveSpPr, "a:prstGeom"), "prst");
42199
42356
  const shapeAdjustments = this.parseGeometryAdjustments(
42200
42357
  effectiveSpPr?.["a:prstGeom"]
42201
42358
  );
@@ -42251,14 +42408,14 @@ var PptxHandlerRuntime50 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
42251
42408
  const textSegments = [];
42252
42409
  const paragraphIndents = [];
42253
42410
  const inheritedBodyDefaultRunStyle = this.extractTextRunStyle(
42254
- inheritedTxBody?.["a:lstStyle"]?.["a:defPPr"]?.["a:defRPr"],
42411
+ xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
42255
42412
  "left",
42256
42413
  slideRelationshipMap
42257
42414
  );
42258
42415
  const bodyDefaultRunStyle = {
42259
42416
  ...inheritedBodyDefaultRunStyle,
42260
42417
  ...this.extractTextRunStyle(
42261
- txBody?.["a:lstStyle"]?.["a:defPPr"]?.["a:defRPr"],
42418
+ xmlPath(txBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
42262
42419
  "left",
42263
42420
  slideRelationshipMap
42264
42421
  )
@@ -42291,13 +42448,14 @@ var PptxHandlerRuntime50 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
42291
42448
  if (this.presentationDefaultTextStyle) {
42292
42449
  this.applyPlaceholderBodyDefaults(textStyle, this.presentationDefaultTextStyle);
42293
42450
  }
42294
- if (txBody?.["a:p"]) {
42295
- const paras = this.ensureArray(txBody["a:p"]);
42451
+ const txBodyObj = txBody;
42452
+ if (txBodyObj?.["a:p"]) {
42453
+ const paras = this.ensureArray(txBodyObj["a:p"]);
42296
42454
  const textParts = [];
42297
42455
  let didSeedPrimaryTextStyle = false;
42298
42456
  const effectiveLevelStyles = phDefaults?.levelStyles ?? this.presentationDefaultTextStyle?.levelStyles;
42299
42457
  const ctx = {
42300
- txBody,
42458
+ txBody: txBodyObj,
42301
42459
  inheritedTxBody,
42302
42460
  bodyDefaultRunStyle,
42303
42461
  slideRelationshipMap,
@@ -42344,7 +42502,7 @@ var PptxHandlerRuntime50 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
42344
42502
  const cNvSpPr = shape?.["p:nvSpPr"]?.["p:cNvSpPr"];
42345
42503
  const spLocksNode = cNvSpPr?.["a:spLocks"];
42346
42504
  const slideLocks = this.parseShapeLocks(spLocksNode);
42347
- const inheritedCNvSpPr = inheritedPlaceholder?.shape?.["p:nvSpPr"]?.["p:cNvSpPr"] ?? inheritedPlaceholder?.picture?.["p:nvPicPr"]?.["p:cNvPicPr"];
42505
+ const inheritedCNvSpPr = xmlPath(inheritedPlaceholder?.shape, "p:nvSpPr", "p:cNvSpPr") ?? xmlPath(inheritedPlaceholder?.picture, "p:nvPicPr", "p:cNvPicPr");
42348
42506
  const inheritedLockNode = inheritedCNvSpPr?.["a:spLocks"] ?? inheritedCNvSpPr?.["a:picLocks"];
42349
42507
  const inheritedLocks = this.parseShapeLocks(inheritedLockNode);
42350
42508
  const locks = inheritedLocks ? { ...inheritedLocks, ...slideLocks } : slideLocks;
@@ -42431,15 +42589,15 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42431
42589
  if (!xfrm) {
42432
42590
  return null;
42433
42591
  }
42434
- const off = xfrm["a:off"];
42435
- const ext = xfrm["a:ext"];
42592
+ const off = xmlChild(xfrm, "a:off");
42593
+ const ext = xmlChild(xfrm, "a:ext");
42436
42594
  if (!off || !ext) {
42437
42595
  return null;
42438
42596
  }
42439
- const x = Math.round(parseEmuInt(off["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
42440
- const y = Math.round(parseEmuInt(off["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
42441
- const width = Math.round(parseEmuInt(ext["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
42442
- const height = Math.round(parseEmuInt(ext["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
42597
+ const x = Math.round(parseEmuInt(xmlAttr(off, "x")) / _PptxHandlerRuntime.EMU_PER_PX);
42598
+ const y = Math.round(parseEmuInt(xmlAttr(off, "y")) / _PptxHandlerRuntime.EMU_PER_PX);
42599
+ const width = Math.round(parseEmuInt(xmlAttr(ext, "cx")) / _PptxHandlerRuntime.EMU_PER_PX);
42600
+ const height = Math.round(parseEmuInt(xmlAttr(ext, "cy")) / _PptxHandlerRuntime.EMU_PER_PX);
42443
42601
  const rotation = xfrm["@_rot"] ? parseEmuInt(xfrm["@_rot"]) / 6e4 : void 0;
42444
42602
  const skewX = xfrm["@_skewX"] ? parseEmuInt(xfrm["@_skewX"]) / 6e4 : void 0;
42445
42603
  const skewY = xfrm["@_skewY"] ? parseEmuInt(xfrm["@_skewY"]) / 6e4 : void 0;
@@ -42465,9 +42623,10 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42465
42623
  const posterBlip = posterBlipFill?.["a:blip"];
42466
42624
  const posterREmbed = posterBlip?.["@_r:embed"];
42467
42625
  const posterRLink = posterBlip?.["@_r:link"];
42468
- if (posterREmbed || posterRLink) {
42626
+ const posterRelId = posterREmbed || posterRLink;
42627
+ if (posterRelId) {
42469
42628
  const slideRels = this.slideRelsMap.get(slidePath);
42470
- const posterTarget = slideRels?.get(posterREmbed || posterRLink);
42629
+ const posterTarget = slideRels?.get(posterRelId);
42471
42630
  if (posterTarget) {
42472
42631
  const isExternal = posterTarget.startsWith("http://") || posterTarget.startsWith("https://");
42473
42632
  if (isExternal) {
@@ -42506,7 +42665,7 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42506
42665
  rawXml: pic
42507
42666
  };
42508
42667
  }
42509
- const prstGeom = effectiveSpPr?.["a:prstGeom"]?.["@_prst"];
42668
+ const prstGeom = xmlAttr(xmlChild(effectiveSpPr, "a:prstGeom"), "prst");
42510
42669
  const shapeAdjustments = this.parseGeometryAdjustments(
42511
42670
  effectiveSpPr?.["a:prstGeom"]
42512
42671
  );
@@ -42539,6 +42698,7 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42539
42698
  const blip = blipFill?.["a:blip"];
42540
42699
  const rEmbed = blip?.["@_r:embed"];
42541
42700
  const rLink = blip?.["@_r:link"];
42701
+ const relId = rEmbed || rLink;
42542
42702
  const crop = this.readImageCropFromBlipFill(blipFill);
42543
42703
  const tileNode = blipFill?.["a:tile"];
42544
42704
  const tileProps = {};
@@ -42591,9 +42751,9 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42591
42751
  }
42592
42752
  let imageData;
42593
42753
  let imagePath;
42594
- if (rEmbed || rLink) {
42754
+ if (relId) {
42595
42755
  const slideRels = this.slideRelsMap.get(slidePath);
42596
- const target = slideRels?.get(rEmbed || rLink);
42756
+ const target = slideRels?.get(relId);
42597
42757
  if (target) {
42598
42758
  const isExternal = target.startsWith("http://") || target.startsWith("https://");
42599
42759
  if (isExternal) {
@@ -42613,7 +42773,9 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
42613
42773
  }
42614
42774
  }
42615
42775
  const styleNode = pic["p:style"] || inheritedPlaceholder?.picture?.["p:style"] || inheritedPlaceholder?.shape?.["p:style"];
42616
- const altTextRaw = String(pic?.["p:nvPicPr"]?.["p:cNvPr"]?.["@_descr"] || "").trim();
42776
+ const altTextRaw = String(
42777
+ pic?.["p:nvPicPr"]?.["p:cNvPr"]?.["@_descr"] || ""
42778
+ ).trim();
42617
42779
  const imageEffects = this.extractImageEffects(blip);
42618
42780
  const picCNvPr = pic?.["p:nvPicPr"]?.["p:cNvPr"];
42619
42781
  const picSlideRels = this.slideRelsMap.get(slidePath);
@@ -43069,21 +43231,25 @@ var PptxHandlerRuntime53 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
43069
43231
  let parentX = 0, parentY = 0, parentW = 0, parentH = 0;
43070
43232
  let chX = 0, chY = 0, chW = 0, chH = 0;
43071
43233
  if (xfrm) {
43072
- if (xfrm["a:off"]) {
43073
- parentX = Math.round(parseEmuInt2(xfrm["a:off"]["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43074
- parentY = Math.round(parseEmuInt2(xfrm["a:off"]["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43234
+ const off = xfrm["a:off"];
43235
+ if (off) {
43236
+ parentX = Math.round(parseEmuInt2(off["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43237
+ parentY = Math.round(parseEmuInt2(off["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43075
43238
  }
43076
- if (xfrm["a:ext"]) {
43077
- parentW = Math.round(parseEmuInt2(xfrm["a:ext"]["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43078
- parentH = Math.round(parseEmuInt2(xfrm["a:ext"]["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43239
+ const ext = xfrm["a:ext"];
43240
+ if (ext) {
43241
+ parentW = Math.round(parseEmuInt2(ext["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43242
+ parentH = Math.round(parseEmuInt2(ext["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43079
43243
  }
43080
- if (xfrm["a:chOff"]) {
43081
- chX = Math.round(parseEmuInt2(xfrm["a:chOff"]["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43082
- chY = Math.round(parseEmuInt2(xfrm["a:chOff"]["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43244
+ const chOff = xfrm["a:chOff"];
43245
+ if (chOff) {
43246
+ chX = Math.round(parseEmuInt2(chOff["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43247
+ chY = Math.round(parseEmuInt2(chOff["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43083
43248
  }
43084
- if (xfrm["a:chExt"]) {
43085
- chW = Math.round(parseEmuInt2(xfrm["a:chExt"]["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43086
- chH = Math.round(parseEmuInt2(xfrm["a:chExt"]["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43249
+ const chExt = xfrm["a:chExt"];
43250
+ if (chExt) {
43251
+ chW = Math.round(parseEmuInt2(chExt["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43252
+ chH = Math.round(parseEmuInt2(chExt["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43087
43253
  }
43088
43254
  }
43089
43255
  const scaleX = chW > 0 ? parentW / chW : 1;
@@ -43161,13 +43327,15 @@ var PptxHandlerRuntime53 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
43161
43327
  const xfrm = grpSpPr?.["a:xfrm"];
43162
43328
  let parentX = 0, parentY = 0, parentW = 0, parentH = 0;
43163
43329
  if (xfrm) {
43164
- if (xfrm["a:off"]) {
43165
- parentX = Math.round(parseEmuInt2(xfrm["a:off"]["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43166
- parentY = Math.round(parseEmuInt2(xfrm["a:off"]["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43330
+ const off = xfrm["a:off"];
43331
+ if (off) {
43332
+ parentX = Math.round(parseEmuInt2(off["@_x"]) / _PptxHandlerRuntime.EMU_PER_PX);
43333
+ parentY = Math.round(parseEmuInt2(off["@_y"]) / _PptxHandlerRuntime.EMU_PER_PX);
43167
43334
  }
43168
- if (xfrm["a:ext"]) {
43169
- parentW = Math.round(parseEmuInt2(xfrm["a:ext"]["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43170
- parentH = Math.round(parseEmuInt2(xfrm["a:ext"]["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43335
+ const ext = xfrm["a:ext"];
43336
+ if (ext) {
43337
+ parentW = Math.round(parseEmuInt2(ext["@_cx"]) / _PptxHandlerRuntime.EMU_PER_PX);
43338
+ parentH = Math.round(parseEmuInt2(ext["@_cy"]) / _PptxHandlerRuntime.EMU_PER_PX);
43171
43339
  }
43172
43340
  }
43173
43341
  const grpFillStyle = grpSpPr ? this.extractShapeStyle(grpSpPr) : void 0;
@@ -43280,11 +43448,7 @@ var PptxHandlerRuntime54 = class extends PptxHandlerRuntime53 {
43280
43448
  const appendRun = (runText, runProps) => {
43281
43449
  const runStyle = {
43282
43450
  ...mergedDefaultRunStyle,
43283
- ...this.extractTextRunStyle(
43284
- runProps,
43285
- paraAlign,
43286
- slideRelationshipMap
43287
- )
43451
+ ...this.extractTextRunStyle(runProps, paraAlign, slideRelationshipMap)
43288
43452
  };
43289
43453
  textParts.push(runText);
43290
43454
  textSegments.push({ text: runText, style: runStyle });
@@ -43486,29 +43650,32 @@ var PptxHandlerRuntime55 = class extends PptxHandlerRuntime54 {
43486
43650
  var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43487
43651
  async extractBackgroundImage(slideXml2, slidePath, rootElement = "p:sld") {
43488
43652
  try {
43489
- const bg = slideXml2[rootElement]?.["p:cSld"]?.["p:bg"];
43490
- if (!bg) {
43653
+ const blip = xmlPath(
43654
+ slideXml2,
43655
+ rootElement,
43656
+ "p:cSld",
43657
+ "p:bg",
43658
+ "p:bgPr",
43659
+ "a:blipFill",
43660
+ "a:blip"
43661
+ );
43662
+ const rEmbed = xmlAttr(blip, "r:embed");
43663
+ if (!rEmbed) {
43491
43664
  return void 0;
43492
43665
  }
43493
- const bgPr = bg["p:bgPr"];
43494
- if (bgPr?.["a:blipFill"]) {
43495
- const blip = bgPr["a:blipFill"]["a:blip"];
43496
- const rEmbed = blip?.["@_r:embed"];
43497
- if (rEmbed) {
43498
- const slideRels = this.slideRelsMap.get(slidePath);
43499
- const target = slideRels?.get(rEmbed);
43500
- if (target) {
43501
- if (target.startsWith("http://") || target.startsWith("https://")) {
43502
- if (this.allowExternalImages !== true) {
43503
- return void 0;
43504
- }
43505
- return target;
43506
- }
43507
- const imagePath = this.resolveImagePath(slidePath, target);
43508
- return this.getImageData(imagePath);
43509
- }
43666
+ const slideRels = this.slideRelsMap.get(slidePath);
43667
+ const target = slideRels?.get(rEmbed);
43668
+ if (!target) {
43669
+ return void 0;
43670
+ }
43671
+ if (target.startsWith("http://") || target.startsWith("https://")) {
43672
+ if (this.allowExternalImages !== true) {
43673
+ return void 0;
43510
43674
  }
43675
+ return target;
43511
43676
  }
43677
+ const imagePath = this.resolveImagePath(slidePath, target);
43678
+ return this.getImageData(imagePath);
43512
43679
  } catch (e) {
43513
43680
  console.warn("Failed to extract background image:", e);
43514
43681
  }
@@ -43516,29 +43683,29 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43516
43683
  }
43517
43684
  extractBackgroundColor(slideXml2, rootElement = "p:sld") {
43518
43685
  try {
43519
- const bg = slideXml2[rootElement]?.["p:cSld"]?.["p:bg"];
43686
+ const bg = xmlPath(slideXml2, rootElement, "p:cSld", "p:bg");
43520
43687
  if (!bg) {
43521
43688
  return void 0;
43522
43689
  }
43523
- const bgPr = bg["p:bgPr"];
43690
+ const bgPr = xmlChild(bg, "p:bgPr");
43524
43691
  if (bgPr) {
43525
- const solidFill = bgPr["a:solidFill"];
43692
+ const solidFill = xmlChild(bgPr, "a:solidFill");
43526
43693
  if (solidFill) {
43527
43694
  return this.parseColor(solidFill);
43528
43695
  }
43529
- const pattFill = bgPr["a:pattFill"];
43696
+ const pattFill = xmlChild(bgPr, "a:pattFill");
43530
43697
  if (pattFill) {
43531
- const fgClr = this.parseColor(pattFill["a:fgClr"]);
43698
+ const fgClr = this.parseColor(xmlChild(pattFill, "a:fgClr"));
43532
43699
  if (fgClr) {
43533
43700
  return fgClr;
43534
43701
  }
43535
- const bgClr = this.parseColor(pattFill["a:bgClr"]);
43702
+ const bgClr = this.parseColor(xmlChild(pattFill, "a:bgClr"));
43536
43703
  if (bgClr) {
43537
43704
  return bgClr;
43538
43705
  }
43539
43706
  }
43540
43707
  }
43541
- const bgRef = bg["p:bgRef"];
43708
+ const bgRef = xmlChild(bg, "p:bgRef");
43542
43709
  if (bgRef) {
43543
43710
  return this.resolveBackgroundRefColor(bgRef);
43544
43711
  }
@@ -43563,17 +43730,16 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43563
43730
  * referenced fill definition.
43564
43731
  */
43565
43732
  resolveBackgroundRefColor(bgRef) {
43566
- const rawIdx = bgRef["@_idx"];
43567
- const idx = parseInt(String(rawIdx ?? "0"), 10);
43568
- if (Number.isFinite(idx) && idx === 0) {
43733
+ const idx = xmlAttrNumber(bgRef, "idx") ?? 0;
43734
+ if (idx === 0) {
43569
43735
  return void 0;
43570
43736
  }
43571
- const solidFill = bgRef["a:solidFill"];
43737
+ const solidFill = xmlChild(bgRef, "a:solidFill");
43572
43738
  if (solidFill) {
43573
43739
  return this.parseColor(solidFill);
43574
43740
  }
43575
43741
  const overrideColor = this.parseColor(bgRef);
43576
- if (Number.isFinite(idx) && this.themeFormatScheme) {
43742
+ if (this.themeFormatScheme) {
43577
43743
  let fillDef = void 0;
43578
43744
  if (idx >= 1 && idx <= 999) {
43579
43745
  fillDef = this.themeFormatScheme.fillStyles[idx - 1];
@@ -43596,7 +43762,7 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43596
43762
  if (overrideColor) {
43597
43763
  return overrideColor;
43598
43764
  }
43599
- if (Number.isFinite(idx) && idx !== 0) {
43765
+ if (idx !== 0) {
43600
43766
  console.warn(
43601
43767
  `bgRef @idx=${idx} did not resolve to a fill style (theme has ${this.themeFormatScheme?.fillStyles.length ?? 0} fillStyleLst / ${this.themeFormatScheme?.backgroundFillStyles.length ?? 0} bgFillStyleLst entries); falling back to #FFFFFF.`
43602
43768
  );
@@ -43612,17 +43778,16 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43612
43778
  */
43613
43779
  extractBackgroundPattern(slideXml2, rootElement = "p:sld") {
43614
43780
  try {
43615
- const bg = slideXml2[rootElement]?.["p:cSld"]?.["p:bg"];
43616
- const pattFill = bg?.["p:bgPr"]?.["a:pattFill"];
43781
+ const pattFill = xmlPath(slideXml2, rootElement, "p:cSld", "p:bg", "p:bgPr", "a:pattFill");
43617
43782
  if (!pattFill) {
43618
43783
  return void 0;
43619
43784
  }
43620
- const preset = String(pattFill["@_prst"] || "").trim();
43785
+ const preset = (xmlAttr(pattFill, "prst") ?? "").trim();
43621
43786
  if (!preset) {
43622
43787
  return void 0;
43623
43788
  }
43624
- const fgColor = this.parseColor(pattFill["a:fgClr"]);
43625
- const bgColor = this.parseColor(pattFill["a:bgClr"]);
43789
+ const fgColor = this.parseColor(xmlChild(pattFill, "a:fgClr"));
43790
+ const bgColor = this.parseColor(xmlChild(pattFill, "a:bgClr"));
43626
43791
  return {
43627
43792
  preset,
43628
43793
  fgColor,
@@ -43642,16 +43807,15 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43642
43807
  */
43643
43808
  extractBackgroundShadeToTitle(slideXml2, rootElement = "p:sld") {
43644
43809
  try {
43645
- const bg = slideXml2[rootElement]?.["p:cSld"]?.["p:bg"];
43646
- const bgPr = bg?.["p:bgPr"];
43810
+ const bgPr = xmlPath(slideXml2, rootElement, "p:cSld", "p:bg", "p:bgPr");
43647
43811
  if (!bgPr) {
43648
43812
  return void 0;
43649
43813
  }
43650
- const raw = bgPr["@_shadeToTitle"];
43814
+ const raw = xmlAttr(bgPr, "shadeToTitle");
43651
43815
  if (raw === void 0) {
43652
43816
  return void 0;
43653
43817
  }
43654
- const normalized = String(raw).trim().toLowerCase();
43818
+ const normalized = raw.trim().toLowerCase();
43655
43819
  return normalized === "1" || normalized === "true";
43656
43820
  } catch {
43657
43821
  return void 0;
@@ -43663,20 +43827,17 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
43663
43827
  */
43664
43828
  extractBackgroundGradient(slideXml2, rootElement = "p:sld") {
43665
43829
  try {
43666
- const bg = slideXml2[rootElement]?.["p:cSld"]?.["p:bg"];
43830
+ const bg = xmlPath(slideXml2, rootElement, "p:cSld", "p:bg");
43667
43831
  if (!bg) {
43668
43832
  return void 0;
43669
43833
  }
43670
- const bgPr = bg["p:bgPr"];
43671
- if (bgPr) {
43672
- const gradFill = bgPr["a:gradFill"];
43673
- if (gradFill) {
43674
- return this.extractGradientFillCss(gradFill);
43675
- }
43834
+ const gradFill = xmlPath(bg, "p:bgPr", "a:gradFill");
43835
+ if (gradFill) {
43836
+ return this.extractGradientFillCss(gradFill);
43676
43837
  }
43677
- const bgRef = bg["p:bgRef"];
43838
+ const bgRef = xmlChild(bg, "p:bgRef");
43678
43839
  if (bgRef && this.themeFormatScheme) {
43679
- const idx = parseInt(String(bgRef["@_idx"] || "0"), 10);
43840
+ const idx = xmlAttrNumber(bgRef, "idx") ?? 0;
43680
43841
  if (idx >= 1001) {
43681
43842
  const offset = idx - 1001;
43682
43843
  const fillDef = this.themeFormatScheme.backgroundFillStyles[offset];
@@ -43970,7 +44131,9 @@ var PptxHandlerRuntime57 = class extends PptxHandlerRuntime56 {
43970
44131
  return normalized !== "0" && normalized !== "false";
43971
44132
  }
43972
44133
  isSlideHidden(slideXmlObj, slideIdEntry) {
43973
- const slideShowValue = String(slideXmlObj?.["p:sld"]?.["@_show"] ?? "").toLowerCase();
44134
+ const slideShowValue = String(
44135
+ slideXmlObj?.["p:sld"]?.["@_show"] ?? ""
44136
+ ).toLowerCase();
43974
44137
  if (slideShowValue === "0" || slideShowValue === "false") {
43975
44138
  return true;
43976
44139
  }
@@ -44214,10 +44377,10 @@ var PptxHandlerRuntime58 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
44214
44377
  }
44215
44378
  }
44216
44379
  if (defRPr["@_b"] !== void 0) {
44217
- style.bold = defRPr["@_b"] === "1" || defRPr["@_b"] === true;
44380
+ style.bold = defRPr["@_b"] === "1";
44218
44381
  }
44219
44382
  if (defRPr["@_i"] !== void 0) {
44220
- style.italic = defRPr["@_i"] === "1" || defRPr["@_i"] === true;
44383
+ style.italic = defRPr["@_i"] === "1";
44221
44384
  }
44222
44385
  const color = this.parseColor(defRPr["a:solidFill"]);
44223
44386
  if (color) {
@@ -44690,8 +44853,7 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
44690
44853
  const placeholderShapeIndices = /* @__PURE__ */ new Set();
44691
44854
  for (let idx = 0; idx < shapes.length; idx++) {
44692
44855
  const shape = shapes[idx];
44693
- const nvSpPr = shape["p:nvSpPr"];
44694
- const ph = nvSpPr?.["p:nvPr"]?.["p:ph"];
44856
+ const ph = xmlPath(shape, "p:nvSpPr", "p:nvPr", "p:ph");
44695
44857
  if (ph) {
44696
44858
  placeholderShapeIndices.add(idx);
44697
44859
  const phDefaults = this.extractPlaceholderDefaultsFromShape(shape);
@@ -44723,9 +44885,9 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
44723
44885
  if (!shape) {
44724
44886
  continue;
44725
44887
  }
44726
- const spPr = shape["p:spPr"];
44888
+ const spPr = xmlChild(shape, "p:spPr");
44727
44889
  let element = null;
44728
- if (spPr?.["a:blipFill"]) {
44890
+ if (spPr && xmlChild(spPr, "a:blipFill")) {
44729
44891
  element = await this.parseShapeWithImageFill(
44730
44892
  shape,
44731
44893
  `layout-shape-img-${entry.indexInType}`,
@@ -44770,8 +44932,11 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
44770
44932
  }
44771
44933
  }
44772
44934
  }
44773
- const layoutShowMasterSp = layoutXmlObj["p:sldLayout"]?.["@_showMasterSp"];
44774
- const showMasterSp = layoutShowMasterSp === void 0 || String(layoutShowMasterSp).trim().toLowerCase() !== "0" && String(layoutShowMasterSp).trim().toLowerCase() !== "false";
44935
+ const layoutShowMasterSp = xmlAttr(
44936
+ xmlChild(layoutXmlObj, "p:sldLayout"),
44937
+ "showMasterSp"
44938
+ );
44939
+ const showMasterSp = layoutShowMasterSp === void 0 || layoutShowMasterSp.trim().toLowerCase() !== "0" && layoutShowMasterSp.trim().toLowerCase() !== "false";
44775
44940
  const masterElements = showMasterSp ? await this.getMasterElements(layoutPath) : [];
44776
44941
  this.currentSlideClrMapOverride = prevClrMapOverride;
44777
44942
  const allElements = [...masterElements, ...elements];
@@ -45592,7 +45757,9 @@ var PptxHandlerRuntime65 = class extends PptxHandlerRuntime64 {
45592
45757
  // eslint-disable-next-line no-await-in-loop
45593
45758
  await relsXml.async("string")
45594
45759
  );
45595
- const relNodes = this.ensureArray(relsData?.Relationships?.Relationship);
45760
+ const relNodes = this.ensureArray(
45761
+ relsData?.Relationships?.Relationship
45762
+ );
45596
45763
  for (const rel of relNodes) {
45597
45764
  const target = String(rel["@_Target"] || "");
45598
45765
  if (!target.includes("theme")) {
@@ -45910,7 +46077,9 @@ var PptxHandlerRuntime65 = class extends PptxHandlerRuntime64 {
45910
46077
  return void 0;
45911
46078
  }
45912
46079
  const relsData = this.parser.parse(await relsXml.async("string"));
45913
- const relNodes = this.ensureArray(relsData?.Relationships?.Relationship);
46080
+ const relNodes = this.ensureArray(
46081
+ relsData?.Relationships?.Relationship
46082
+ );
45914
46083
  for (const rel of relNodes) {
45915
46084
  const target = String(rel["@_Target"] || "");
45916
46085
  if (!target.includes("theme")) {
@@ -46146,7 +46315,9 @@ var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
46146
46315
  return [];
46147
46316
  }
46148
46317
  const relsData = this.parser.parse(relsXml);
46149
- const rels = this.ensureArray(relsData?.Relationships?.Relationship);
46318
+ const rels = this.ensureArray(
46319
+ xmlChild(relsData, "Relationships")?.Relationship
46320
+ );
46150
46321
  const modernCommentRels = rels.filter((rel) => {
46151
46322
  const type = String(rel?.["@_Type"] || "").toLowerCase();
46152
46323
  return type.includes("comments-extended") || type.includes("comments/authors") || type.includes("/p188/") || type.includes("/p15/");
@@ -46184,7 +46355,7 @@ var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
46184
46355
  const txBodyKey = Object.keys(cm2 || {}).find((k) => k.endsWith("txBody"));
46185
46356
  let text = "";
46186
46357
  if (txBodyKey) {
46187
- const paragraphs = this.ensureArray(cm2[txBodyKey]?.["a:p"]);
46358
+ const paragraphs = this.ensureArray(xmlChild(cm2, txBodyKey)?.["a:p"]);
46188
46359
  const lines = [];
46189
46360
  for (const p of paragraphs) {
46190
46361
  const runs = this.ensureArray(p?.["a:r"]);
@@ -46247,7 +46418,9 @@ var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
46247
46418
  }
46248
46419
  try {
46249
46420
  const relsData = this.parser.parse(relsXml);
46250
- const rels = this.ensureArray(relsData?.Relationships?.Relationship);
46421
+ const rels = this.ensureArray(
46422
+ xmlChild(relsData, "Relationships")?.Relationship
46423
+ );
46251
46424
  const commentRelation = rels.find((relation) => {
46252
46425
  const relationType = String(relation?.["@_Type"] || "").toLowerCase();
46253
46426
  return relationType.endsWith("/comments");
@@ -46985,7 +47158,7 @@ function parseBoolVal(node) {
46985
47158
  if (val === void 0 || val === null || val === "") {
46986
47159
  return true;
46987
47160
  }
46988
- if (val === "0" || val === "false" || val === false) {
47161
+ if (val === "0" || val === "false") {
46989
47162
  return false;
46990
47163
  }
46991
47164
  return true;
@@ -47020,7 +47193,7 @@ var PptxHandlerRuntime72 = class extends PptxHandlerRuntime71 {
47020
47193
  return void 0;
47021
47194
  }
47022
47195
  const val = plotVisOnlyNode["@_val"];
47023
- if (val === "0" || val === "false" || val === false) {
47196
+ if (val === "0" || val === "false") {
47024
47197
  return false;
47025
47198
  }
47026
47199
  return true;
@@ -48000,7 +48173,7 @@ var PptxHandlerRuntime76 = class extends PptxHandlerRuntime75 {
48000
48173
  var PptxHandlerRuntime77 = class extends PptxHandlerRuntime76 {
48001
48174
  async getEmbeddedFonts() {
48002
48175
  const embeddedFontEntries = this.ensureArray(
48003
- this.presentationData?.["p:presentation"]?.["p:embeddedFontLst"]?.["p:embeddedFont"]
48176
+ xmlPath(this.presentationData, "p:presentation", "p:embeddedFontLst")?.["p:embeddedFont"]
48004
48177
  );
48005
48178
  if (embeddedFontEntries.length === 0) {
48006
48179
  return [];
@@ -48011,7 +48184,7 @@ var PptxHandlerRuntime77 = class extends PptxHandlerRuntime76 {
48011
48184
  }
48012
48185
  const results = [];
48013
48186
  for (const entry of embeddedFontEntries) {
48014
- const typeface = String(entry?.["p:font"]?.["@_typeface"] || "").trim();
48187
+ const typeface = (xmlAttr(xmlChild(entry, "p:font"), "typeface") || "").trim();
48015
48188
  if (!typeface) {
48016
48189
  continue;
48017
48190
  }
@@ -48055,7 +48228,9 @@ var PptxHandlerRuntime77 = class extends PptxHandlerRuntime76 {
48055
48228
  return map;
48056
48229
  }
48057
48230
  const relsData = this.parser.parse(relsXml);
48058
- const rels = this.ensureArray(relsData?.Relationships?.Relationship);
48231
+ const rels = this.ensureArray(
48232
+ xmlChild(relsData, "Relationships")?.Relationship
48233
+ );
48059
48234
  for (const rel of rels) {
48060
48235
  const type = String(rel?.["@_Type"] || "");
48061
48236
  if (!type.includes("/font")) {
@@ -48160,12 +48335,44 @@ var PptxHandlerRuntime77 = class extends PptxHandlerRuntime76 {
48160
48335
  const options = [];
48161
48336
  for (const [path, xmlObj] of this.layoutXmlMap.entries()) {
48162
48337
  const sldLayout = xmlObj["p:sldLayout"];
48163
- const name = String(sldLayout?.["p:cSld"]?.["@_name"] || "").trim() || path;
48338
+ const rawName = (xmlAttr(xmlChild(sldLayout, "p:cSld"), "name") || "").trim();
48164
48339
  const type = sldLayout?.["@_type"] !== void 0 ? String(sldLayout["@_type"]).trim() : void 0;
48165
- options.push({ path, name, ...type ? { type } : {} });
48340
+ const name = resolveLayoutDisplayName({ name: rawName, type, path });
48341
+ const masterPath = this.resolveMasterPathForLayout(path);
48342
+ options.push({
48343
+ path,
48344
+ name,
48345
+ ...type ? { type } : {},
48346
+ ...masterPath ? { masterPath } : {}
48347
+ });
48166
48348
  }
48167
48349
  return options;
48168
48350
  }
48351
+ resolveMasterPathForLayout(layoutPath) {
48352
+ const layoutRels = this.slideRelsMap.get(layoutPath);
48353
+ if (!layoutRels) {
48354
+ return void 0;
48355
+ }
48356
+ for (const [, target] of layoutRels.entries()) {
48357
+ if (target.includes("slideMaster")) {
48358
+ const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
48359
+ if (target.startsWith("..")) {
48360
+ const segments = (layoutDir + target).split("/");
48361
+ const stack = [];
48362
+ for (const seg of segments) {
48363
+ if (seg === "..") {
48364
+ stack.pop();
48365
+ } else if (seg && seg !== ".") {
48366
+ stack.push(seg);
48367
+ }
48368
+ }
48369
+ return stack.join("/");
48370
+ }
48371
+ return `ppt/${target.replace("../", "")}`;
48372
+ }
48373
+ }
48374
+ return void 0;
48375
+ }
48169
48376
  };
48170
48377
 
48171
48378
  // src/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
@@ -48696,20 +48903,14 @@ var PptxHandlerRuntime79 = class extends PptxHandlerRuntime78 {
48696
48903
  for (const lp of masterLayoutPaths) {
48697
48904
  const xmlObj = this.layoutXmlMap.get(lp);
48698
48905
  if (xmlObj) {
48699
- const sldLayout = xmlObj["p:sldLayout"];
48700
- const name = String(sldLayout?.["p:cSld"]?.["@_name"] || "").trim() || lp;
48701
- const type = sldLayout?.["@_type"] !== null ? String(sldLayout["@_type"]).trim() : void 0;
48702
- options.push({ path: lp, name, ...type ? { type } : {} });
48906
+ options.push(this.buildLayoutOption(lp, xmlObj));
48703
48907
  } else {
48704
48908
  try {
48705
48909
  const layoutXmlStr = await this.zip.file(lp)?.async("string");
48706
48910
  if (layoutXmlStr) {
48707
48911
  const layoutXmlObj = this.parser.parse(layoutXmlStr);
48708
48912
  this.layoutXmlMap.set(lp, layoutXmlObj);
48709
- const sldLayout = layoutXmlObj["p:sldLayout"];
48710
- const name = String(sldLayout?.["p:cSld"]?.["@_name"] || "").trim() || lp;
48711
- const type = sldLayout?.["@_type"] !== null ? String(sldLayout["@_type"]).trim() : void 0;
48712
- options.push({ path: lp, name, ...type ? { type } : {} });
48913
+ options.push(this.buildLayoutOption(lp, layoutXmlObj));
48713
48914
  }
48714
48915
  } catch {
48715
48916
  }
@@ -48717,6 +48918,22 @@ var PptxHandlerRuntime79 = class extends PptxHandlerRuntime78 {
48717
48918
  }
48718
48919
  return options;
48719
48920
  }
48921
+ buildLayoutOption(path, xmlObj) {
48922
+ const sldLayout = xmlObj["p:sldLayout"];
48923
+ const rawName = String(
48924
+ sldLayout?.["p:cSld"]?.["@_name"] || ""
48925
+ ).trim();
48926
+ const typeAttr = sldLayout?.["@_type"];
48927
+ const type = typeAttr !== void 0 && typeAttr !== null ? String(typeAttr).trim() : void 0;
48928
+ const name = resolveLayoutDisplayName({ name: rawName, type, path });
48929
+ const masterPath = this.findMasterPathForLayout(path);
48930
+ return {
48931
+ path,
48932
+ name,
48933
+ ...type ? { type } : {},
48934
+ ...masterPath ? { masterPath } : {}
48935
+ };
48936
+ }
48720
48937
  /**
48721
48938
  * Apply a different layout to an existing slide.
48722
48939
  *
@@ -66543,6 +66760,7 @@ exports.isTemplateElement = isTemplateElement;
66543
66760
  exports.isTextElement = isTextElement;
66544
66761
  exports.isTransitionalNamespaceUri = isTransitionalNamespaceUri;
66545
66762
  exports.isValidBase64 = isValidBase64;
66763
+ exports.isXmlNode = isXmlNode;
66546
66764
  exports.isZoomElement = isZoomElement;
66547
66765
  exports.isZoomElementUtil = isZoomElement2;
66548
66766
  exports.layoutEngineShapesToDrawingShapes = layoutEngineShapesToDrawingShapes;
@@ -66632,6 +66850,7 @@ exports.resetSectionIdCounter = resetSectionIdCounter;
66632
66850
  exports.resetSmartArtEditCounter = resetSmartArtEditCounter;
66633
66851
  exports.resolveCoordinate = resolveCoordinate;
66634
66852
  exports.resolveCustomShowSlideIndices = resolveCustomShowSlideIndices;
66853
+ exports.resolveLayoutDisplayName = resolveLayoutDisplayName;
66635
66854
  exports.resolveModel3DMimeType = resolveModel3DMimeType;
66636
66855
  exports.resolveReferenceUriToPart = resolveReferenceUriToPart;
66637
66856
  exports.resolveTableCellStyle = resolveTableCellStyle;
@@ -66666,3 +66885,10 @@ exports.verifyModifyPassword = verifyModifyPassword;
66666
66885
  exports.verifyPassword = verifyPassword;
66667
66886
  exports.verifySignatureDigests = verifySignatureDigests;
66668
66887
  exports.writeBodyPrBooleanAttrs = writeBodyPrBooleanAttrs;
66888
+ exports.xmlAttr = xmlAttr;
66889
+ exports.xmlAttrBool = xmlAttrBool;
66890
+ exports.xmlAttrNumber = xmlAttrNumber;
66891
+ exports.xmlChild = xmlChild;
66892
+ exports.xmlChildren = xmlChildren;
66893
+ exports.xmlPath = xmlPath;
66894
+ exports.xmlText = xmlText;