pptx-viewer-core 1.1.33 → 1.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6209,16 +6209,16 @@ var PptxShapeStyleExtractor = class {
6209
6209
  extractShapeStyle(spPr, styleNode) {
6210
6210
  const style = {};
6211
6211
  const shapeProps = spPr || {};
6212
- const solidFill = shapeProps["a:solidFill"];
6212
+ const solidFill2 = shapeProps["a:solidFill"];
6213
6213
  const gradFill = shapeProps["a:gradFill"];
6214
6214
  const pattFill = shapeProps["a:pattFill"];
6215
6215
  const noFill = shapeProps["a:noFill"];
6216
6216
  const blipFill = shapeProps["a:blipFill"];
6217
- if (solidFill) {
6217
+ if (solidFill2) {
6218
6218
  style.fillMode = "solid";
6219
- style.fillColor = this.context.parseColor(solidFill);
6220
- style.fillOpacity = this.context.extractColorOpacity(solidFill);
6221
- const solidFillColorXml = extractColorChoiceXml(solidFill);
6219
+ style.fillColor = this.context.parseColor(solidFill2);
6220
+ style.fillOpacity = this.context.extractColorOpacity(solidFill2);
6221
+ const solidFillColorXml = extractColorChoiceXml(solidFill2);
6222
6222
  if (solidFillColorXml) {
6223
6223
  style.fillColorXml = solidFillColorXml;
6224
6224
  }
@@ -6984,15 +6984,15 @@ var PptxMediaDataParser = class {
6984
6984
 
6985
6985
  // src/core/utils/ole-utils.ts
6986
6986
  var PROG_ID_MAP = [
6987
- { pattern: /^Excel\./i, type: "excel", extension: "xlsx" },
6988
- { pattern: /^Word\./i, type: "word", extension: "docx" },
6989
- { pattern: /^PowerPoint\./i, type: "excel", extension: "pptx" },
6990
- { pattern: /^Visio\./i, type: "visio", extension: "vsdx" },
6991
- { pattern: /^Equation\./i, type: "mathtype", extension: "wmf" },
6992
- { pattern: /^MathType/i, type: "mathtype", extension: "wmf" },
6993
- { pattern: /^AcroExch\./i, type: "pdf", extension: "pdf" },
6994
- { pattern: /^Acrobat\./i, type: "pdf", extension: "pdf" },
6995
- { pattern: /^Package$/i, type: "package", extension: "bin" }
6987
+ { pattern: /^Excel\./iu, type: "excel", extension: "xlsx" },
6988
+ { pattern: /^Word\./iu, type: "word", extension: "docx" },
6989
+ { pattern: /^PowerPoint\./iu, type: "excel", extension: "pptx" },
6990
+ { pattern: /^Visio\./iu, type: "visio", extension: "vsdx" },
6991
+ { pattern: /^Equation\./iu, type: "mathtype", extension: "wmf" },
6992
+ { pattern: /^MathType/iu, type: "mathtype", extension: "wmf" },
6993
+ { pattern: /^AcroExch\./iu, type: "pdf", extension: "pdf" },
6994
+ { pattern: /^Acrobat\./iu, type: "pdf", extension: "pdf" },
6995
+ { pattern: /^Package$/iu, type: "package", extension: "bin" }
6996
6996
  ];
6997
6997
  var CLSID_MAP = /* @__PURE__ */ new Map([
6998
6998
  // Excel Workbook
@@ -7019,7 +7019,7 @@ function detectOleObjectType(progId, clsId) {
7019
7019
  }
7020
7020
  }
7021
7021
  if (clsId) {
7022
- const normalised = clsId.replace(/[{}]/g, "").toUpperCase().trim();
7022
+ const normalised = clsId.replace(/[{}]/gu, "").toUpperCase().trim();
7023
7023
  const match = CLSID_MAP.get(normalised);
7024
7024
  if (match) {
7025
7025
  return { oleObjectType: match.type, oleFileExtension: match.extension };
@@ -7041,6 +7041,38 @@ function inferOleExtensionFromTarget(oleTarget) {
7041
7041
  }
7042
7042
  return void 0;
7043
7043
  }
7044
+ var OLE_EXTENSION_MIME_MAP = /* @__PURE__ */ new Map([
7045
+ ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
7046
+ ["xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12"],
7047
+ ["xls", "application/vnd.ms-excel"],
7048
+ ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
7049
+ ["docm", "application/vnd.ms-word.document.macroEnabled.12"],
7050
+ ["doc", "application/msword"],
7051
+ ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"],
7052
+ ["ppt", "application/vnd.ms-powerpoint"],
7053
+ ["vsdx", "application/vnd.ms-visio.drawing"],
7054
+ ["vsd", "application/vnd.visio"],
7055
+ ["pdf", "application/pdf"],
7056
+ ["rtf", "application/rtf"],
7057
+ ["txt", "text/plain"],
7058
+ ["csv", "text/csv"],
7059
+ ["png", "image/png"],
7060
+ ["jpg", "image/jpeg"],
7061
+ ["jpeg", "image/jpeg"],
7062
+ ["gif", "image/gif"],
7063
+ ["wmf", "image/wmf"],
7064
+ ["emf", "image/emf"],
7065
+ ["zip", "application/zip"]
7066
+ ]);
7067
+ function mimeTypeForOleFile(fileNameOrExtension) {
7068
+ const fallback = "application/octet-stream";
7069
+ if (!fileNameOrExtension) {
7070
+ return fallback;
7071
+ }
7072
+ const lastDot = fileNameOrExtension.lastIndexOf(".");
7073
+ const ext = (lastDot === -1 ? fileNameOrExtension : fileNameOrExtension.slice(lastDot + 1)).toLowerCase().trim();
7074
+ return OLE_EXTENSION_MIME_MAP.get(ext) ?? fallback;
7075
+ }
7044
7076
  function getOleObjectTypeLabel(oleObjectType) {
7045
7077
  switch (oleObjectType) {
7046
7078
  case "excel":
@@ -8767,6 +8799,7 @@ var PptxSlideLoaderService = class {
8767
8799
  if (mediaTimingMap.size > 0) {
8768
8800
  await params.enrichMediaElementsWithTiming(slideElements, mediaTimingMap);
8769
8801
  }
8802
+ await params.enrichOleElementsWithEmbeddedData(slideElements, path);
8770
8803
  const elements = [...layoutElements, ...slideElements];
8771
8804
  const backgroundColor = params.extractBackgroundColor(slideXmlObj) || await params.getLayoutBackgroundColor(path);
8772
8805
  const backgroundGradient = params.extractBackgroundGradient(slideXmlObj) || await params.getLayoutBackgroundGradient(path);
@@ -8916,15 +8949,15 @@ var PptxSlideLoaderService = class {
8916
8949
 
8917
8950
  // src/core/services/PptxXmlLookupService.ts
8918
8951
  var PptxXmlLookupService = class {
8919
- getChildByLocalName(parent, localName) {
8952
+ getChildByLocalName(parent, localName2) {
8920
8953
  if (!parent) {
8921
8954
  return void 0;
8922
8955
  }
8923
- const direct = parent[localName];
8956
+ const direct = parent[localName2];
8924
8957
  if (direct && typeof direct === "object" && !Array.isArray(direct)) {
8925
8958
  return direct;
8926
8959
  }
8927
- const suffix = `:${localName}`;
8960
+ const suffix = `:${localName2}`;
8928
8961
  const matchingKey = Object.keys(parent).find((key) => key.endsWith(suffix));
8929
8962
  if (!matchingKey) {
8930
8963
  return void 0;
@@ -8935,32 +8968,32 @@ var PptxXmlLookupService = class {
8935
8968
  }
8936
8969
  return value;
8937
8970
  }
8938
- getChildrenArrayByLocalName(parent, localName) {
8971
+ getChildrenArrayByLocalName(parent, localName2) {
8939
8972
  if (!parent) {
8940
8973
  return [];
8941
8974
  }
8942
- const direct = parent[localName];
8975
+ const direct = parent[localName2];
8943
8976
  if (direct !== void 0) {
8944
8977
  return this.toXmlArray(direct);
8945
8978
  }
8946
- const suffix = `:${localName}`;
8979
+ const suffix = `:${localName2}`;
8947
8980
  const matchingKey = Object.keys(parent).find((key) => key.endsWith(suffix));
8948
8981
  if (!matchingKey) {
8949
8982
  return [];
8950
8983
  }
8951
8984
  return this.toXmlArray(parent[matchingKey]);
8952
8985
  }
8953
- getScalarChildByLocalName(parent, localName) {
8986
+ getScalarChildByLocalName(parent, localName2) {
8954
8987
  if (!parent) {
8955
8988
  return void 0;
8956
8989
  }
8957
- const direct = parent[localName];
8990
+ const direct = parent[localName2];
8958
8991
  if (typeof direct === "string" || typeof direct === "number") {
8959
8992
  return String(direct);
8960
8993
  }
8961
- const suffix = `:${localName}`;
8994
+ const suffix = `:${localName2}`;
8962
8995
  for (const [key, value] of Object.entries(parent)) {
8963
- if (key !== localName && !key.endsWith(suffix)) {
8996
+ if (key !== localName2 && !key.endsWith(suffix)) {
8964
8997
  continue;
8965
8998
  }
8966
8999
  if (typeof value === "string" || typeof value === "number") {
@@ -10405,11 +10438,11 @@ function parseP14FromExtLst(extLstNode, xmlLookupService, getXmlLocalName) {
10405
10438
  if (key.startsWith("@_")) {
10406
10439
  continue;
10407
10440
  }
10408
- const localName = getXmlLocalName(key);
10409
- if (!P14_TRANSITION_TYPES.has(localName)) {
10441
+ const localName2 = getXmlLocalName(key);
10442
+ if (!P14_TRANSITION_TYPES.has(localName2)) {
10410
10443
  continue;
10411
10444
  }
10412
- const type = localName;
10445
+ const type = localName2;
10413
10446
  let direction;
10414
10447
  let orient;
10415
10448
  let pattern;
@@ -10459,8 +10492,8 @@ function buildP14ExtLst(transitionType, direction, orient, pattern, rawExtLst, x
10459
10492
  if (key.startsWith("@_")) {
10460
10493
  continue;
10461
10494
  }
10462
- const localName = getXmlLocalName(key);
10463
- if (P14_TRANSITION_TYPES.has(localName)) {
10495
+ const localName2 = getXmlLocalName(key);
10496
+ if (P14_TRANSITION_TYPES.has(localName2)) {
10464
10497
  return false;
10465
10498
  }
10466
10499
  }
@@ -10523,17 +10556,17 @@ var PptxSlideTransitionService = class {
10523
10556
  if (key.startsWith("@_")) {
10524
10557
  continue;
10525
10558
  }
10526
- const localName = this.getXmlLocalName(key);
10527
- if (localName === "sndAc") {
10559
+ const localName2 = this.getXmlLocalName(key);
10560
+ if (localName2 === "sndAc") {
10528
10561
  rawSoundAction = value;
10529
10562
  continue;
10530
10563
  }
10531
- if (localName === "extLst") {
10564
+ if (localName2 === "extLst") {
10532
10565
  rawExtLst = value;
10533
10566
  continue;
10534
10567
  }
10535
- if (TRANSITION_TYPES.has(localName)) {
10536
- transitionType = localName;
10568
+ if (TRANSITION_TYPES.has(localName2)) {
10569
+ transitionType = localName2;
10537
10570
  }
10538
10571
  if (value && typeof value === "object" && !Array.isArray(value)) {
10539
10572
  const detail = value;
@@ -12348,6 +12381,321 @@ function resolveLayoutDisplayName(input) {
12348
12381
  return fallbackFromPath(input.path);
12349
12382
  }
12350
12383
 
12384
+ // src/core/utils/ole2-parser-types.ts
12385
+ var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 27, 26, 225]);
12386
+ var ENDOFCHAIN = 4294967294;
12387
+ var FREESECT = 4294967295;
12388
+ var FATSECT = 4294967293;
12389
+ var MAXREGSECT = 4294967290;
12390
+ var ENTRY_TYPE_EMPTY = 0;
12391
+ var ENTRY_TYPE_STREAM = 2;
12392
+ var ENTRY_TYPE_ROOT = 5;
12393
+ var DIR_ENTRY_SIZE = 128;
12394
+ var Ole2ParseError = class extends Error {
12395
+ constructor(message) {
12396
+ super(message);
12397
+ this.name = "Ole2ParseError";
12398
+ }
12399
+ };
12400
+
12401
+ // src/core/utils/ole2-parser-read.ts
12402
+ function parseOle2(buffer) {
12403
+ const data = new Uint8Array(buffer);
12404
+ const view = new DataView(buffer);
12405
+ for (let i = 0; i < OLE_MAGIC.length; i++) {
12406
+ if (data[i] !== OLE_MAGIC[i]) {
12407
+ throw new Ole2ParseError("Not a valid OLE2 compound file");
12408
+ }
12409
+ }
12410
+ view.getUint16(24, true);
12411
+ const majorVersion = view.getUint16(26, true);
12412
+ const byteOrder = view.getUint16(28, true);
12413
+ if (byteOrder !== 65534) {
12414
+ throw new Ole2ParseError("Invalid byte order mark");
12415
+ }
12416
+ const sectorSizePower = view.getUint16(30, true);
12417
+ const miniSectorSizePower = view.getUint16(32, true);
12418
+ const sectorSize = 1 << sectorSizePower;
12419
+ const miniSectorSize = 1 << miniSectorSizePower;
12420
+ const totalFATSectors = view.getUint32(44, true);
12421
+ const firstDirectorySector = view.getUint32(48, true);
12422
+ const miniStreamCutoff = view.getUint32(56, true);
12423
+ const firstMiniFATSector = view.getUint32(60, true);
12424
+ const totalMiniFATSectors = view.getUint32(64, true);
12425
+ const firstDIFATSector = view.getUint32(68, true);
12426
+ const totalDIFATSectors = view.getUint32(72, true);
12427
+ function sectorOffset(sector) {
12428
+ return (sector + 1) * sectorSize;
12429
+ }
12430
+ function readSector(sector) {
12431
+ const offset = sectorOffset(sector);
12432
+ if (offset + sectorSize > data.length) {
12433
+ throw new Ole2ParseError(
12434
+ `Sector ${sector} at offset ${offset} exceeds file size ${data.length}`
12435
+ );
12436
+ }
12437
+ return data.subarray(offset, offset + sectorSize);
12438
+ }
12439
+ const fatSectors = [];
12440
+ for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
12441
+ const sector = view.getUint32(76 + i * 4, true);
12442
+ if (sector <= MAXREGSECT) {
12443
+ fatSectors.push(sector);
12444
+ }
12445
+ }
12446
+ let difatSector = firstDIFATSector;
12447
+ for (let d = 0; d < totalDIFATSectors && difatSector <= MAXREGSECT; d++) {
12448
+ const difatData = readSector(difatSector);
12449
+ const difatView = new DataView(difatData.buffer, difatData.byteOffset, difatData.byteLength);
12450
+ const entriesPerSector = (sectorSize - 4) / 4;
12451
+ for (let i = 0; i < entriesPerSector && fatSectors.length < totalFATSectors; i++) {
12452
+ const sector = difatView.getUint32(i * 4, true);
12453
+ if (sector <= MAXREGSECT) {
12454
+ fatSectors.push(sector);
12455
+ }
12456
+ }
12457
+ difatSector = difatView.getUint32(sectorSize - 4, true);
12458
+ }
12459
+ const fatEntries = [];
12460
+ for (const fatSector of fatSectors) {
12461
+ const fatData = readSector(fatSector);
12462
+ const fatView = new DataView(fatData.buffer, fatData.byteOffset, fatData.byteLength);
12463
+ for (let i = 0; i < sectorSize / 4; i++) {
12464
+ fatEntries.push(fatView.getUint32(i * 4, true));
12465
+ }
12466
+ }
12467
+ function readSectorChain(startSector) {
12468
+ const sectors = [];
12469
+ let current = startSector;
12470
+ const visited = /* @__PURE__ */ new Set();
12471
+ while (current <= MAXREGSECT) {
12472
+ if (visited.has(current)) {
12473
+ throw new Ole2ParseError(`Circular reference in FAT chain at sector ${current}`);
12474
+ }
12475
+ visited.add(current);
12476
+ sectors.push(readSector(current));
12477
+ current = fatEntries[current] ?? ENDOFCHAIN;
12478
+ }
12479
+ const totalLength = sectors.length * sectorSize;
12480
+ const result = new Uint8Array(totalLength);
12481
+ let offset = 0;
12482
+ for (const sector of sectors) {
12483
+ result.set(sector, offset);
12484
+ offset += sectorSize;
12485
+ }
12486
+ return result;
12487
+ }
12488
+ function readStream(startSector, size) {
12489
+ const raw = readSectorChain(startSector);
12490
+ return raw.subarray(0, Math.min(size, raw.length));
12491
+ }
12492
+ const miniFatEntries = [];
12493
+ if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
12494
+ const miniFatRaw = readSectorChain(firstMiniFATSector);
12495
+ const miniFatView = new DataView(
12496
+ miniFatRaw.buffer,
12497
+ miniFatRaw.byteOffset,
12498
+ miniFatRaw.byteLength
12499
+ );
12500
+ for (let i = 0; i < miniFatRaw.length / 4; i++) {
12501
+ miniFatEntries.push(miniFatView.getUint32(i * 4, true));
12502
+ }
12503
+ }
12504
+ const dirRaw = readSectorChain(firstDirectorySector);
12505
+ const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
12506
+ const entries = [];
12507
+ for (let i = 0; i < numEntries; i++) {
12508
+ const entryOffset = i * DIR_ENTRY_SIZE;
12509
+ const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
12510
+ const nameLen = entryView.getUint16(64, true);
12511
+ const objectType = entryView.getUint8(66);
12512
+ if (objectType === ENTRY_TYPE_EMPTY) {
12513
+ continue;
12514
+ }
12515
+ const nameBytes = Math.max(0, nameLen - 2);
12516
+ let name = "";
12517
+ for (let j = 0; j < nameBytes; j += 2) {
12518
+ name += String.fromCharCode(entryView.getUint16(j, true));
12519
+ }
12520
+ const leftSiblingId = entryView.getUint32(68, true);
12521
+ const rightSiblingId = entryView.getUint32(72, true);
12522
+ const childId = entryView.getUint32(76, true);
12523
+ const startSector = entryView.getUint32(116, true);
12524
+ const sizeLow = entryView.getUint32(120, true);
12525
+ let size = sizeLow;
12526
+ if (majorVersion === 4) {
12527
+ entryView.getUint32(124, true);
12528
+ size = sizeLow;
12529
+ }
12530
+ entries.push({
12531
+ name,
12532
+ type: objectType,
12533
+ startSector,
12534
+ size,
12535
+ childId: childId === 4294967295 ? -1 : childId,
12536
+ leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
12537
+ rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId
12538
+ });
12539
+ }
12540
+ const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
12541
+ let miniStreamData;
12542
+ if (rootEntry && rootEntry.startSector <= MAXREGSECT) {
12543
+ miniStreamData = readSectorChain(rootEntry.startSector);
12544
+ }
12545
+ function readMiniStream(startSector, size) {
12546
+ if (!miniStreamData) {
12547
+ throw new Ole2ParseError("Mini stream container not found");
12548
+ }
12549
+ const sectors = [];
12550
+ let current = startSector;
12551
+ const visited = /* @__PURE__ */ new Set();
12552
+ while (current <= MAXREGSECT) {
12553
+ if (visited.has(current)) {
12554
+ throw new Ole2ParseError(`Circular reference in mini FAT chain at sector ${current}`);
12555
+ }
12556
+ visited.add(current);
12557
+ const offset2 = current * miniSectorSize;
12558
+ sectors.push(miniStreamData.subarray(offset2, offset2 + miniSectorSize));
12559
+ current = miniFatEntries[current] ?? ENDOFCHAIN;
12560
+ }
12561
+ const totalLength = sectors.length * miniSectorSize;
12562
+ const result = new Uint8Array(totalLength);
12563
+ let offset = 0;
12564
+ for (const sector of sectors) {
12565
+ result.set(sector, offset);
12566
+ offset += miniSectorSize;
12567
+ }
12568
+ return result.subarray(0, Math.min(size, result.length));
12569
+ }
12570
+ function getStream(name) {
12571
+ const entry = entries.find(
12572
+ (e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name
12573
+ );
12574
+ if (!entry) {
12575
+ return void 0;
12576
+ }
12577
+ if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
12578
+ return readMiniStream(entry.startSector, entry.size);
12579
+ }
12580
+ return readStream(entry.startSector, entry.size);
12581
+ }
12582
+ return { entries, getStream };
12583
+ }
12584
+
12585
+ // src/core/utils/ole-embedded-extract.ts
12586
+ function oleBytesToDataUrl(bytes, mimeType) {
12587
+ let binary = "";
12588
+ const chunkSize = 32768;
12589
+ for (let i = 0; i < bytes.length; i += chunkSize) {
12590
+ const chunk = bytes.subarray(i, i + chunkSize);
12591
+ binary += String.fromCharCode.apply(null, Array.from(chunk));
12592
+ }
12593
+ return `data:${mimeType};base64,${btoa(binary)}`;
12594
+ }
12595
+ var OLE10_NATIVE_STREAM_NAMES = [`${String.fromCharCode(1)}Ole10Native`, "Ole10Native"];
12596
+ var CONTENTS_STREAM = "CONTENTS";
12597
+ function isOle2CompoundFile(bytes) {
12598
+ if (bytes.length < OLE_MAGIC.length) {
12599
+ return false;
12600
+ }
12601
+ for (let i = 0; i < OLE_MAGIC.length; i++) {
12602
+ if (bytes[i] !== OLE_MAGIC[i]) {
12603
+ return false;
12604
+ }
12605
+ }
12606
+ return true;
12607
+ }
12608
+ function baseNameFromPath(raw) {
12609
+ const trimmed = raw.trim();
12610
+ if (trimmed.length === 0) {
12611
+ return void 0;
12612
+ }
12613
+ const lastSlash = Math.max(trimmed.lastIndexOf("\\"), trimmed.lastIndexOf("/"));
12614
+ const base = lastSlash === -1 ? trimmed : trimmed.slice(lastSlash + 1);
12615
+ return base.length > 0 ? base : void 0;
12616
+ }
12617
+ function readAsciiZ(bytes, offset) {
12618
+ let end = offset;
12619
+ while (end < bytes.length && bytes[end] !== 0) {
12620
+ end++;
12621
+ }
12622
+ let value = "";
12623
+ for (let i = offset; i < end; i++) {
12624
+ value += String.fromCharCode(bytes[i]);
12625
+ }
12626
+ return { value, next: end < bytes.length ? end + 1 : end };
12627
+ }
12628
+ function decodeOle10Native(stream) {
12629
+ if (stream.length < 6) {
12630
+ return void 0;
12631
+ }
12632
+ const view = new DataView(stream.buffer, stream.byteOffset, stream.byteLength);
12633
+ const declaredSize = view.getUint32(0, true);
12634
+ const bodyEnd = Math.min(stream.length, 4 + declaredSize);
12635
+ if (bodyEnd <= 4) {
12636
+ return void 0;
12637
+ }
12638
+ let cursor = 6;
12639
+ const label = readAsciiZ(stream, cursor);
12640
+ cursor = label.next;
12641
+ const sourcePath = readAsciiZ(stream, cursor);
12642
+ cursor = sourcePath.next;
12643
+ if (cursor + 8 > stream.length) {
12644
+ return void 0;
12645
+ }
12646
+ cursor += 4;
12647
+ const tempLen = view.getUint32(cursor, true);
12648
+ cursor += 4;
12649
+ if (tempLen > stream.length) {
12650
+ return void 0;
12651
+ }
12652
+ cursor += tempLen;
12653
+ if (cursor + 4 > stream.length) {
12654
+ return void 0;
12655
+ }
12656
+ const nativeSize = view.getUint32(cursor, true);
12657
+ cursor += 4;
12658
+ const dataEnd = Math.min(stream.length, cursor + nativeSize);
12659
+ if (dataEnd <= cursor) {
12660
+ return void 0;
12661
+ }
12662
+ const data = stream.subarray(cursor, dataEnd);
12663
+ const fileName = baseNameFromPath(sourcePath.value) ?? baseNameFromPath(label.value) ?? void 0;
12664
+ return { fileName, data };
12665
+ }
12666
+ function unwrapOleEmbedding(bytes) {
12667
+ if (bytes.length === 0) {
12668
+ return { data: bytes };
12669
+ }
12670
+ if (!isOle2CompoundFile(bytes)) {
12671
+ return { data: bytes };
12672
+ }
12673
+ try {
12674
+ const buffer = bytes.buffer.slice(
12675
+ bytes.byteOffset,
12676
+ bytes.byteOffset + bytes.byteLength
12677
+ );
12678
+ const ole = parseOle2(buffer);
12679
+ for (const name of OLE10_NATIVE_STREAM_NAMES) {
12680
+ const ole10 = ole.getStream(name);
12681
+ if (!ole10) {
12682
+ continue;
12683
+ }
12684
+ const decoded = decodeOle10Native(ole10);
12685
+ if (decoded && decoded.data.length > 0) {
12686
+ return decoded;
12687
+ }
12688
+ return { data: ole10 };
12689
+ }
12690
+ const contents = ole.getStream(CONTENTS_STREAM);
12691
+ if (contents && contents.length > 0) {
12692
+ return { data: contents };
12693
+ }
12694
+ } catch {
12695
+ }
12696
+ return { data: bytes };
12697
+ }
12698
+
12351
12699
  // src/core/utils/signature-constants.ts
12352
12700
  var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
12353
12701
  var DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
@@ -12395,27 +12743,27 @@ function detectDigitalSignatures(zipEntryPaths) {
12395
12743
  function getSignaturePathsToStrip(zipEntryPaths) {
12396
12744
  return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
12397
12745
  }
12398
- function findByLocalName(parent, localName) {
12746
+ function findByLocalName(parent, localName2) {
12399
12747
  if (!parent) {
12400
12748
  return void 0;
12401
12749
  }
12402
- if (parent[localName] !== void 0 && typeof parent[localName] === "object") {
12403
- return parent[localName];
12750
+ if (parent[localName2] !== void 0 && typeof parent[localName2] === "object") {
12751
+ return parent[localName2];
12404
12752
  }
12405
12753
  for (const key of Object.keys(parent)) {
12406
12754
  const parts = key.split(":");
12407
- if (parts[parts.length - 1] === localName && typeof parent[key] === "object") {
12755
+ if (parts[parts.length - 1] === localName2 && typeof parent[key] === "object") {
12408
12756
  return parent[key];
12409
12757
  }
12410
12758
  }
12411
12759
  return void 0;
12412
12760
  }
12413
- function findScalarByLocalName(parent, localName) {
12761
+ function findScalarByLocalName(parent, localName2) {
12414
12762
  if (!parent) {
12415
12763
  return void 0;
12416
12764
  }
12417
- if (parent[localName] !== void 0) {
12418
- const v = parent[localName];
12765
+ if (parent[localName2] !== void 0) {
12766
+ const v = parent[localName2];
12419
12767
  if (typeof v === "string") {
12420
12768
  return v;
12421
12769
  }
@@ -12428,7 +12776,7 @@ function findScalarByLocalName(parent, localName) {
12428
12776
  }
12429
12777
  for (const key of Object.keys(parent)) {
12430
12778
  const parts = key.split(":");
12431
- if (parts[parts.length - 1] === localName) {
12779
+ if (parts[parts.length - 1] === localName2) {
12432
12780
  const v = parent[key];
12433
12781
  if (typeof v === "string") {
12434
12782
  return v;
@@ -12443,13 +12791,13 @@ function findScalarByLocalName(parent, localName) {
12443
12791
  }
12444
12792
  return void 0;
12445
12793
  }
12446
- function findAllByLocalName(parent, localName) {
12794
+ function findAllByLocalName(parent, localName2) {
12447
12795
  if (!parent) {
12448
12796
  return [];
12449
12797
  }
12450
12798
  for (const key of Object.keys(parent)) {
12451
12799
  const parts = key.split(":");
12452
- if (parts[parts.length - 1] === localName) {
12800
+ if (parts[parts.length - 1] === localName2) {
12453
12801
  const v = parent[key];
12454
12802
  if (Array.isArray(v)) {
12455
12803
  return v;
@@ -12926,8 +13274,8 @@ function parseLineStyle(container, elementName, xmlLookup, colorParser) {
12926
13274
  if (spPr) {
12927
13275
  const lnNode = xmlLookup.getChildByLocalName(spPr, "ln");
12928
13276
  if (lnNode) {
12929
- const solidFill = xmlLookup.getChildByLocalName(lnNode, "solidFill");
12930
- const lineColor = colorParser.parseColor(solidFill);
13277
+ const solidFill2 = xmlLookup.getChildByLocalName(lnNode, "solidFill");
13278
+ const lineColor = colorParser.parseColor(solidFill2);
12931
13279
  if (lineColor) {
12932
13280
  result.color = lineColor;
12933
13281
  }
@@ -12969,8 +13317,8 @@ function parseShapeProps(spPrNode, xmlLookup, colorParser) {
12969
13317
  }
12970
13318
  const result = {};
12971
13319
  let hasProps = false;
12972
- const solidFill = xmlLookup.getChildByLocalName(spPrNode, "solidFill");
12973
- const fillColor = colorParser.parseColor(solidFill);
13320
+ const solidFill2 = xmlLookup.getChildByLocalName(spPrNode, "solidFill");
13321
+ const fillColor = colorParser.parseColor(solidFill2);
12974
13322
  if (fillColor) {
12975
13323
  result.fillColor = fillColor;
12976
13324
  hasProps = true;
@@ -13150,8 +13498,8 @@ var AXIS_TYPE_MAP = {
13150
13498
  dateAx: "dateAx",
13151
13499
  serAx: "serAx"
13152
13500
  };
13153
- function upsertChartAxisChild(parent, localName, value, getLocalName) {
13154
- const existingKey = Object.keys(parent).find((k) => getLocalName(k) === localName);
13501
+ function upsertChartAxisChild(parent, localName2, value, getLocalName) {
13502
+ const existingKey = Object.keys(parent).find((k) => getLocalName(k) === localName2);
13155
13503
  if (value === void 0) {
13156
13504
  if (existingKey) {
13157
13505
  delete parent[existingKey];
@@ -13161,18 +13509,18 @@ function upsertChartAxisChild(parent, localName, value, getLocalName) {
13161
13509
  if (existingKey) {
13162
13510
  parent[existingKey]["@_val"] = value;
13163
13511
  } else {
13164
- parent[`c:${localName}`] = { "@_val": value };
13512
+ parent[`c:${localName2}`] = { "@_val": value };
13165
13513
  }
13166
13514
  }
13167
13515
  function parseChartAxes(plotArea, xmlLookup, colorParser, getLocalName) {
13168
13516
  const result = [];
13169
13517
  for (const key of Object.keys(plotArea)) {
13170
- const localName = getLocalName(key);
13171
- const axisType = AXIS_TYPE_MAP[localName];
13518
+ const localName2 = getLocalName(key);
13519
+ const axisType = AXIS_TYPE_MAP[localName2];
13172
13520
  if (!axisType) {
13173
13521
  continue;
13174
13522
  }
13175
- const axisNodes = xmlLookup.getChildrenArrayByLocalName(plotArea, localName);
13523
+ const axisNodes = xmlLookup.getChildrenArrayByLocalName(plotArea, localName2);
13176
13524
  for (const axisNode of axisNodes) {
13177
13525
  const axis = parseSingleAxis(axisNode, axisType, xmlLookup, colorParser);
13178
13526
  if (axis) {
@@ -13369,8 +13717,8 @@ function parseTxPr(txPrNode, xmlLookup, colorParser, target) {
13369
13717
  if (latin?.["@_typeface"]) {
13370
13718
  target.fontFamily = String(latin["@_typeface"]);
13371
13719
  }
13372
- const solidFill = xmlLookup.getChildByLocalName(defRPr, "solidFill");
13373
- const fontColor = colorParser.parseColor(solidFill);
13720
+ const solidFill2 = xmlLookup.getChildByLocalName(defRPr, "solidFill");
13721
+ const fontColor = colorParser.parseColor(solidFill2);
13374
13722
  if (fontColor) {
13375
13723
  target.fontColor = fontColor;
13376
13724
  }
@@ -13445,8 +13793,8 @@ var CONTAINER_LOCAL_NAME_TO_TYPE = {
13445
13793
  surfaceChart: "surface",
13446
13794
  surface3DChart: "surface"
13447
13795
  };
13448
- function chartContainerLocalNameToType(localName) {
13449
- return CONTAINER_LOCAL_NAME_TO_TYPE[localName];
13796
+ function chartContainerLocalNameToType(localName2) {
13797
+ return CONTAINER_LOCAL_NAME_TO_TYPE[localName2];
13450
13798
  }
13451
13799
 
13452
13800
  // src/core/utils/chart-cx-parser.ts
@@ -13455,11 +13803,11 @@ function extractCxSeriesColor(ser, xmlLookup) {
13455
13803
  if (!spPr) {
13456
13804
  return void 0;
13457
13805
  }
13458
- const solidFill = xmlLookup.getChildByLocalName(spPr, "solidFill");
13459
- if (!solidFill) {
13806
+ const solidFill2 = xmlLookup.getChildByLocalName(spPr, "solidFill");
13807
+ if (!solidFill2) {
13460
13808
  return void 0;
13461
13809
  }
13462
- const srgb = xmlLookup.getChildByLocalName(solidFill, "srgbClr");
13810
+ const srgb = xmlLookup.getChildByLocalName(solidFill2, "srgbClr");
13463
13811
  if (srgb) {
13464
13812
  const val = String(srgb["@_val"] || "").trim();
13465
13813
  if (val.length === 6) {
@@ -13667,18 +14015,18 @@ function parseWorksheetCells(xml) {
13667
14015
  }
13668
14016
  return cells;
13669
14017
  }
13670
- function findByLocalName2(obj, localName) {
14018
+ function findByLocalName2(obj, localName2) {
13671
14019
  for (const key of Object.keys(obj)) {
13672
14020
  const parts = key.split(":");
13673
14021
  const local = parts[parts.length - 1];
13674
- if (local === localName) {
14022
+ if (local === localName2) {
13675
14023
  return obj[key];
13676
14024
  }
13677
14025
  }
13678
14026
  return void 0;
13679
14027
  }
13680
- function getChildArray(parent, localName) {
13681
- const child = findByLocalName2(parent, localName);
14028
+ function getChildArray(parent, localName2) {
14029
+ const child = findByLocalName2(parent, localName2);
13682
14030
  if (!child) {
13683
14031
  return [];
13684
14032
  }
@@ -13690,8 +14038,8 @@ function getChildArray(parent, localName) {
13690
14038
  }
13691
14039
  return [];
13692
14040
  }
13693
- function getTextValue(parent, localName) {
13694
- const child = findByLocalName2(parent, localName);
14041
+ function getTextValue(parent, localName2) {
14042
+ const child = findByLocalName2(parent, localName2);
13695
14043
  if (child === void 0 || child === null) {
13696
14044
  return void 0;
13697
14045
  }
@@ -16157,8 +16505,8 @@ function createSimpleLookup() {
16157
16505
  return void 0;
16158
16506
  }
16159
16507
  for (const [key, value] of Object.entries(obj)) {
16160
- const localName = key.includes(":") ? key.split(":").pop() : key;
16161
- if (localName === name && value && typeof value === "object" && !Array.isArray(value)) {
16508
+ const localName2 = key.includes(":") ? key.split(":").pop() : key;
16509
+ if (localName2 === name && value && typeof value === "object" && !Array.isArray(value)) {
16162
16510
  return value;
16163
16511
  }
16164
16512
  }
@@ -16169,8 +16517,8 @@ function createSimpleLookup() {
16169
16517
  return [];
16170
16518
  }
16171
16519
  for (const [key, value] of Object.entries(obj)) {
16172
- const localName = key.includes(":") ? key.split(":").pop() : key;
16173
- if (localName === name) {
16520
+ const localName2 = key.includes(":") ? key.split(":").pop() : key;
16521
+ if (localName2 === name) {
16174
16522
  if (Array.isArray(value)) {
16175
16523
  return value.filter(
16176
16524
  (v) => v !== null && typeof v === "object"
@@ -17297,6 +17645,62 @@ function layoutRelationship(nodes, bounds, themeColorMap) {
17297
17645
  return elements;
17298
17646
  }
17299
17647
 
17648
+ // src/core/utils/smartart-node-style-apply.ts
17649
+ function styledContentNodes(nodes) {
17650
+ return getContentNodes(nodes);
17651
+ }
17652
+ function applyNodeStylesToElements(elements, nodes) {
17653
+ const contentNodes = styledContentNodes(nodes);
17654
+ if (contentNodes.length === 0) {
17655
+ return elements;
17656
+ }
17657
+ let shapeIndex = 0;
17658
+ return elements.map((element) => {
17659
+ if (element.type !== "shape") {
17660
+ return element;
17661
+ }
17662
+ const node = contentNodes[shapeIndex++];
17663
+ const style = node?.style;
17664
+ if (!style || Object.keys(style).length === 0) {
17665
+ return element;
17666
+ }
17667
+ const shapeStyle = { ...element.shapeStyle };
17668
+ if (style.fillColor !== void 0) {
17669
+ shapeStyle.fillColor = style.fillColor;
17670
+ shapeStyle.fillMode = "solid";
17671
+ }
17672
+ if (style.lineColor !== void 0) {
17673
+ shapeStyle.strokeColor = style.lineColor;
17674
+ }
17675
+ const baseTextStyle = element.textStyle ?? {};
17676
+ const textStyle = { ...baseTextStyle };
17677
+ if (style.fontColor !== void 0) {
17678
+ textStyle.color = style.fontColor;
17679
+ }
17680
+ if (style.bold !== void 0) {
17681
+ textStyle.bold = style.bold;
17682
+ }
17683
+ if (style.italic !== void 0) {
17684
+ textStyle.italic = style.italic;
17685
+ }
17686
+ const segments = element.textSegments?.map((seg) => ({
17687
+ ...seg,
17688
+ style: {
17689
+ ...seg.style,
17690
+ ...style.fontColor !== void 0 ? { color: style.fontColor } : {},
17691
+ ...style.bold !== void 0 ? { bold: style.bold } : {},
17692
+ ...style.italic !== void 0 ? { italic: style.italic } : {}
17693
+ }
17694
+ }));
17695
+ return {
17696
+ ...element,
17697
+ shapeStyle,
17698
+ textStyle,
17699
+ ...segments ? { textSegments: segments } : {}
17700
+ };
17701
+ });
17702
+ }
17703
+
17300
17704
  // src/core/utils/smartart-decompose.ts
17301
17705
  function quickStyleStrokeScale(quickStyle) {
17302
17706
  if (!quickStyle?.effectIntensity) {
@@ -17393,9 +17797,13 @@ function decomposeSmartArt(smartArtData, containerBounds, themeColorMap, layoutD
17393
17797
  if (namedLayout) {
17394
17798
  const namedResult = dispatchNamedLayout(namedLayout, nodes, containerBounds, effectiveThemeMap);
17395
17799
  if (namedResult) {
17396
- return namedResult;
17800
+ return applyNodeStylesToElements(namedResult, nodes);
17397
17801
  }
17398
17802
  }
17803
+ const algorithmic = dispatchLayoutByType(layoutType, nodes, containerBounds, effectiveThemeMap);
17804
+ return algorithmic ? applyNodeStylesToElements(algorithmic, nodes) : algorithmic;
17805
+ }
17806
+ function dispatchLayoutByType(layoutType, nodes, containerBounds, effectiveThemeMap) {
17399
17807
  switch (layoutType) {
17400
17808
  case "list":
17401
17809
  return layoutList(nodes, containerBounds, effectiveThemeMap);
@@ -17742,6 +18150,46 @@ function reorderSmartArtNodeToIndex(data, nodeId, newIndex) {
17742
18150
  };
17743
18151
  }
17744
18152
 
18153
+ // src/core/utils/smartart-editing-node-style.ts
18154
+ function mergeNodeStyle(current, patch) {
18155
+ const merged = { ...current };
18156
+ for (const key of Object.keys(patch)) {
18157
+ const value = patch[key];
18158
+ if (value === void 0) {
18159
+ delete merged[key];
18160
+ } else {
18161
+ merged[key] = value;
18162
+ }
18163
+ }
18164
+ return merged;
18165
+ }
18166
+ function setSmartArtNodeStyle(data, nodeId, style) {
18167
+ let matched = false;
18168
+ const nodes = data.nodes.map((node) => {
18169
+ if (node.id !== nodeId) {
18170
+ return node;
18171
+ }
18172
+ matched = true;
18173
+ const nextStyle = mergeNodeStyle(node.style, style);
18174
+ const hasStyle = Object.keys(nextStyle).length > 0;
18175
+ const updated = { ...node };
18176
+ if (hasStyle) {
18177
+ updated.style = nextStyle;
18178
+ } else {
18179
+ delete updated.style;
18180
+ }
18181
+ return updated;
18182
+ });
18183
+ if (!matched) {
18184
+ return data;
18185
+ }
18186
+ return {
18187
+ ...data,
18188
+ nodes,
18189
+ drawingShapes: void 0
18190
+ };
18191
+ }
18192
+
17745
18193
  // src/core/utils/smartart-editing-reflow-layouts-geometric.ts
17746
18194
  function reflowCycle(nodes, bounds) {
17747
18195
  const size = Math.min(bounds.width, bounds.height);
@@ -18314,14 +18762,14 @@ function resolveLayoutCategory(layoutType) {
18314
18762
  }
18315
18763
 
18316
18764
  // src/core/utils/encryption-detection.ts
18317
- var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 27, 26, 225]);
18765
+ var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161, 27, 26, 225]);
18318
18766
  var ZIP_MAGIC = new Uint8Array([80, 75]);
18319
18767
  function detectFileFormat(data) {
18320
18768
  if (data.byteLength < 8) {
18321
18769
  return { format: "unknown", encrypted: false };
18322
18770
  }
18323
18771
  const header = new Uint8Array(data, 0, 8);
18324
- if (OLE_MAGIC.every((byte, i) => header[i] === byte)) {
18772
+ if (OLE_MAGIC2.every((byte, i) => header[i] === byte)) {
18325
18773
  return { format: "ole", encrypted: true };
18326
18774
  }
18327
18775
  if (header[0] === ZIP_MAGIC[0] && header[1] === ZIP_MAGIC[1]) {
@@ -18337,207 +18785,6 @@ var EncryptedFileError = class extends Error {
18337
18785
  }
18338
18786
  };
18339
18787
 
18340
- // src/core/utils/ole2-parser-types.ts
18341
- var OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161, 27, 26, 225]);
18342
- var ENDOFCHAIN = 4294967294;
18343
- var FREESECT = 4294967295;
18344
- var FATSECT = 4294967293;
18345
- var MAXREGSECT = 4294967290;
18346
- var ENTRY_TYPE_EMPTY = 0;
18347
- var ENTRY_TYPE_STREAM = 2;
18348
- var ENTRY_TYPE_ROOT = 5;
18349
- var DIR_ENTRY_SIZE = 128;
18350
- var Ole2ParseError = class extends Error {
18351
- constructor(message) {
18352
- super(message);
18353
- this.name = "Ole2ParseError";
18354
- }
18355
- };
18356
-
18357
- // src/core/utils/ole2-parser-read.ts
18358
- function parseOle2(buffer) {
18359
- const data = new Uint8Array(buffer);
18360
- const view = new DataView(buffer);
18361
- for (let i = 0; i < OLE_MAGIC2.length; i++) {
18362
- if (data[i] !== OLE_MAGIC2[i]) {
18363
- throw new Ole2ParseError("Not a valid OLE2 compound file");
18364
- }
18365
- }
18366
- view.getUint16(24, true);
18367
- const majorVersion = view.getUint16(26, true);
18368
- const byteOrder = view.getUint16(28, true);
18369
- if (byteOrder !== 65534) {
18370
- throw new Ole2ParseError("Invalid byte order mark");
18371
- }
18372
- const sectorSizePower = view.getUint16(30, true);
18373
- const miniSectorSizePower = view.getUint16(32, true);
18374
- const sectorSize = 1 << sectorSizePower;
18375
- const miniSectorSize = 1 << miniSectorSizePower;
18376
- const totalFATSectors = view.getUint32(44, true);
18377
- const firstDirectorySector = view.getUint32(48, true);
18378
- const miniStreamCutoff = view.getUint32(56, true);
18379
- const firstMiniFATSector = view.getUint32(60, true);
18380
- const totalMiniFATSectors = view.getUint32(64, true);
18381
- const firstDIFATSector = view.getUint32(68, true);
18382
- const totalDIFATSectors = view.getUint32(72, true);
18383
- function sectorOffset(sector) {
18384
- return (sector + 1) * sectorSize;
18385
- }
18386
- function readSector(sector) {
18387
- const offset = sectorOffset(sector);
18388
- if (offset + sectorSize > data.length) {
18389
- throw new Ole2ParseError(
18390
- `Sector ${sector} at offset ${offset} exceeds file size ${data.length}`
18391
- );
18392
- }
18393
- return data.subarray(offset, offset + sectorSize);
18394
- }
18395
- const fatSectors = [];
18396
- for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
18397
- const sector = view.getUint32(76 + i * 4, true);
18398
- if (sector <= MAXREGSECT) {
18399
- fatSectors.push(sector);
18400
- }
18401
- }
18402
- let difatSector = firstDIFATSector;
18403
- for (let d = 0; d < totalDIFATSectors && difatSector <= MAXREGSECT; d++) {
18404
- const difatData = readSector(difatSector);
18405
- const difatView = new DataView(difatData.buffer, difatData.byteOffset, difatData.byteLength);
18406
- const entriesPerSector = (sectorSize - 4) / 4;
18407
- for (let i = 0; i < entriesPerSector && fatSectors.length < totalFATSectors; i++) {
18408
- const sector = difatView.getUint32(i * 4, true);
18409
- if (sector <= MAXREGSECT) {
18410
- fatSectors.push(sector);
18411
- }
18412
- }
18413
- difatSector = difatView.getUint32(sectorSize - 4, true);
18414
- }
18415
- const fatEntries = [];
18416
- for (const fatSector of fatSectors) {
18417
- const fatData = readSector(fatSector);
18418
- const fatView = new DataView(fatData.buffer, fatData.byteOffset, fatData.byteLength);
18419
- for (let i = 0; i < sectorSize / 4; i++) {
18420
- fatEntries.push(fatView.getUint32(i * 4, true));
18421
- }
18422
- }
18423
- function readSectorChain(startSector) {
18424
- const sectors = [];
18425
- let current = startSector;
18426
- const visited = /* @__PURE__ */ new Set();
18427
- while (current <= MAXREGSECT) {
18428
- if (visited.has(current)) {
18429
- throw new Ole2ParseError(`Circular reference in FAT chain at sector ${current}`);
18430
- }
18431
- visited.add(current);
18432
- sectors.push(readSector(current));
18433
- current = fatEntries[current] ?? ENDOFCHAIN;
18434
- }
18435
- const totalLength = sectors.length * sectorSize;
18436
- const result = new Uint8Array(totalLength);
18437
- let offset = 0;
18438
- for (const sector of sectors) {
18439
- result.set(sector, offset);
18440
- offset += sectorSize;
18441
- }
18442
- return result;
18443
- }
18444
- function readStream(startSector, size) {
18445
- const raw = readSectorChain(startSector);
18446
- return raw.subarray(0, Math.min(size, raw.length));
18447
- }
18448
- const miniFatEntries = [];
18449
- if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
18450
- const miniFatRaw = readSectorChain(firstMiniFATSector);
18451
- const miniFatView = new DataView(
18452
- miniFatRaw.buffer,
18453
- miniFatRaw.byteOffset,
18454
- miniFatRaw.byteLength
18455
- );
18456
- for (let i = 0; i < miniFatRaw.length / 4; i++) {
18457
- miniFatEntries.push(miniFatView.getUint32(i * 4, true));
18458
- }
18459
- }
18460
- const dirRaw = readSectorChain(firstDirectorySector);
18461
- const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
18462
- const entries = [];
18463
- for (let i = 0; i < numEntries; i++) {
18464
- const entryOffset = i * DIR_ENTRY_SIZE;
18465
- const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
18466
- const nameLen = entryView.getUint16(64, true);
18467
- const objectType = entryView.getUint8(66);
18468
- if (objectType === ENTRY_TYPE_EMPTY) {
18469
- continue;
18470
- }
18471
- const nameBytes = Math.max(0, nameLen - 2);
18472
- let name = "";
18473
- for (let j = 0; j < nameBytes; j += 2) {
18474
- name += String.fromCharCode(entryView.getUint16(j, true));
18475
- }
18476
- const leftSiblingId = entryView.getUint32(68, true);
18477
- const rightSiblingId = entryView.getUint32(72, true);
18478
- const childId = entryView.getUint32(76, true);
18479
- const startSector = entryView.getUint32(116, true);
18480
- const sizeLow = entryView.getUint32(120, true);
18481
- let size = sizeLow;
18482
- if (majorVersion === 4) {
18483
- entryView.getUint32(124, true);
18484
- size = sizeLow;
18485
- }
18486
- entries.push({
18487
- name,
18488
- type: objectType,
18489
- startSector,
18490
- size,
18491
- childId: childId === 4294967295 ? -1 : childId,
18492
- leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
18493
- rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId
18494
- });
18495
- }
18496
- const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
18497
- let miniStreamData;
18498
- if (rootEntry && rootEntry.startSector <= MAXREGSECT) {
18499
- miniStreamData = readSectorChain(rootEntry.startSector);
18500
- }
18501
- function readMiniStream(startSector, size) {
18502
- if (!miniStreamData) {
18503
- throw new Ole2ParseError("Mini stream container not found");
18504
- }
18505
- const sectors = [];
18506
- let current = startSector;
18507
- const visited = /* @__PURE__ */ new Set();
18508
- while (current <= MAXREGSECT) {
18509
- if (visited.has(current)) {
18510
- throw new Ole2ParseError(`Circular reference in mini FAT chain at sector ${current}`);
18511
- }
18512
- visited.add(current);
18513
- const offset2 = current * miniSectorSize;
18514
- sectors.push(miniStreamData.subarray(offset2, offset2 + miniSectorSize));
18515
- current = miniFatEntries[current] ?? ENDOFCHAIN;
18516
- }
18517
- const totalLength = sectors.length * miniSectorSize;
18518
- const result = new Uint8Array(totalLength);
18519
- let offset = 0;
18520
- for (const sector of sectors) {
18521
- result.set(sector, offset);
18522
- offset += miniSectorSize;
18523
- }
18524
- return result.subarray(0, Math.min(size, result.length));
18525
- }
18526
- function getStream(name) {
18527
- const entry = entries.find(
18528
- (e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name
18529
- );
18530
- if (!entry) {
18531
- return void 0;
18532
- }
18533
- if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
18534
- return readMiniStream(entry.startSector, entry.size);
18535
- }
18536
- return readStream(entry.startSector, entry.size);
18537
- }
18538
- return { entries, getStream };
18539
- }
18540
-
18541
18788
  // src/core/utils/ole2-parser-write.ts
18542
18789
  function compareDirEntryNames(a, b) {
18543
18790
  if (a.length !== b.length) {
@@ -18584,7 +18831,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
18584
18831
  }
18585
18832
  }
18586
18833
  function writeHeader(outView, outBytes, params) {
18587
- outBytes.set(OLE_MAGIC2, 0);
18834
+ outBytes.set(OLE_MAGIC, 0);
18588
18835
  outView.setUint16(24, 62, true);
18589
18836
  outView.setUint16(26, 3, true);
18590
18837
  outView.setUint16(28, 65534, true);
@@ -19755,18 +20002,18 @@ function extractTagAttribute(xml, tagName, attributeName) {
19755
20002
  const match = xml.match(pattern);
19756
20003
  return match?.groups?.["attributeValue"]?.trim();
19757
20004
  }
19758
- function extractFirstTagText(xml, localName) {
20005
+ function extractFirstTagText(xml, localName2) {
19759
20006
  const pattern = new RegExp(
19760
- `<([\\w.-]+:)?${localName}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName}>`,
20007
+ `<([\\w.-]+:)?${localName2}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName2}>`,
19761
20008
  "i"
19762
20009
  );
19763
20010
  const match = xml.match(pattern);
19764
20011
  return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
19765
20012
  }
19766
- function extractAllTagText(xml, localName) {
20013
+ function extractAllTagText(xml, localName2) {
19767
20014
  const result = [];
19768
20015
  const regex = new RegExp(
19769
- `<([\\w.-]+:)?${localName}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName}>`,
20016
+ `<([\\w.-]+:)?${localName2}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName2}>`,
19770
20017
  "gi"
19771
20018
  );
19772
20019
  let match = regex.exec(xml);
@@ -26399,8 +26646,8 @@ var PptxHandlerRuntime2 = class extends PptxHandlerRuntime {
26399
26646
  return void 0;
26400
26647
  }
26401
26648
  const fillNode = tblBg["a:fill"];
26402
- const solidFill = fillNode?.["a:solidFill"] ?? tblBg["a:solidFill"];
26403
- const schemeClr = solidFill?.["a:schemeClr"];
26649
+ const solidFill2 = fillNode?.["a:solidFill"] ?? tblBg["a:solidFill"];
26650
+ const schemeClr = solidFill2?.["a:schemeClr"];
26404
26651
  const schemeColor = schemeClr ? String(schemeClr["@_val"] || "").trim() || void 0 : void 0;
26405
26652
  const fill = schemeColor ? { schemeColor } : void 0;
26406
26653
  const hasEffectLst = Boolean(tblBg["a:effectLst"]);
@@ -26428,11 +26675,11 @@ var PptxHandlerRuntime2 = class extends PptxHandlerRuntime {
26428
26675
  if (!fill) {
26429
26676
  return void 0;
26430
26677
  }
26431
- const solidFill = fill["a:solidFill"];
26432
- if (!solidFill) {
26678
+ const solidFill2 = fill["a:solidFill"];
26679
+ if (!solidFill2) {
26433
26680
  return void 0;
26434
26681
  }
26435
- const schemeClr = solidFill["a:schemeClr"];
26682
+ const schemeClr = solidFill2["a:schemeClr"];
26436
26683
  if (!schemeClr) {
26437
26684
  return void 0;
26438
26685
  }
@@ -30711,10 +30958,10 @@ var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
30711
30958
  if (csTypeface) {
30712
30959
  style.complexScriptFont = csTypeface;
30713
30960
  }
30714
- const solidFill = xmlChild(runProperties, "a:solidFill");
30715
- if (solidFill) {
30716
- style.color = this.parseColor(solidFill);
30717
- const colorXml = extractColorChoiceXml(solidFill);
30961
+ const solidFill2 = xmlChild(runProperties, "a:solidFill");
30962
+ if (solidFill2) {
30963
+ style.color = this.parseColor(solidFill2);
30964
+ const colorXml = extractColorChoiceXml(solidFill2);
30718
30965
  if (colorXml) {
30719
30966
  style.colorXml = colorXml;
30720
30967
  }
@@ -31679,13 +31926,13 @@ function serializeTablePropertyFlags(tbl, tableData) {
31679
31926
  }
31680
31927
  tbl["a:tblPr"] = tblPr;
31681
31928
  }
31682
- function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName) {
31929
+ function replaceFirstTextValueInTree(node, localName2, newValue, getXmlLocalName) {
31683
31930
  if (node === null || node === void 0) {
31684
31931
  return false;
31685
31932
  }
31686
31933
  if (Array.isArray(node)) {
31687
31934
  for (const entry of node) {
31688
- if (replaceFirstTextValueInTree(entry, localName, newValue, getXmlLocalName)) {
31935
+ if (replaceFirstTextValueInTree(entry, localName2, newValue, getXmlLocalName)) {
31689
31936
  return true;
31690
31937
  }
31691
31938
  }
@@ -31696,13 +31943,13 @@ function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName)
31696
31943
  }
31697
31944
  const objectNode = node;
31698
31945
  for (const [key, value] of Object.entries(objectNode)) {
31699
- if (getXmlLocalName(key) === localName) {
31946
+ if (getXmlLocalName(key) === localName2) {
31700
31947
  if (typeof value === "string" || typeof value === "number") {
31701
31948
  objectNode[key] = newValue;
31702
31949
  return true;
31703
31950
  }
31704
31951
  }
31705
- if (replaceFirstTextValueInTree(value, localName, newValue, getXmlLocalName)) {
31952
+ if (replaceFirstTextValueInTree(value, localName2, newValue, getXmlLocalName)) {
31706
31953
  return true;
31707
31954
  }
31708
31955
  }
@@ -32790,10 +33037,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
32790
33037
  * Upsert a `c:<localName>` child with `@_val` on an axis or scaling node.
32791
33038
  * When `value` is undefined, removes any existing child of that local name.
32792
33039
  */
32793
- upsertChartAxisChild(parent, localName, value) {
33040
+ upsertChartAxisChild(parent, localName2, value) {
32794
33041
  upsertChartAxisChild(
32795
33042
  parent,
32796
- localName,
33043
+ localName2,
32797
33044
  value,
32798
33045
  (key) => this.compatibilityService.getXmlLocalName(key)
32799
33046
  );
@@ -32827,10 +33074,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
32827
33074
  cacheNode[ptKey] = buildChartPoints(values);
32828
33075
  }
32829
33076
  /** Replace the first text value found deep in the node tree. */
32830
- replaceFirstTextValue(node, localName, newValue) {
33077
+ replaceFirstTextValue(node, localName2, newValue) {
32831
33078
  return replaceFirstTextValueInTree(
32832
33079
  node,
32833
- localName,
33080
+ localName2,
32834
33081
  newValue,
32835
33082
  (key) => this.compatibilityService.getXmlLocalName(key)
32836
33083
  );
@@ -32842,10 +33089,10 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
32842
33089
  * Upsert a `c:<localName>` child carrying only an `@_val` attribute on
32843
33090
  * `parent`. When `value` is `undefined` the existing child is removed.
32844
33091
  */
32845
- upsertValChild(parent, localName, value) {
32846
- const existing = this.xmlLookupService.getChildByLocalName(parent, localName);
33092
+ upsertValChild(parent, localName2, value) {
33093
+ const existing = this.xmlLookupService.getChildByLocalName(parent, localName2);
32847
33094
  const existingKey = Object.keys(parent).find(
32848
- (k) => this.compatibilityService.getXmlLocalName(k) === localName
33095
+ (k) => this.compatibilityService.getXmlLocalName(k) === localName2
32849
33096
  );
32850
33097
  if (value === void 0) {
32851
33098
  if (existingKey) {
@@ -32856,7 +33103,7 @@ var PptxHandlerRuntime23 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
32856
33103
  if (existing && existingKey) {
32857
33104
  parent[existingKey] = { ...existing, "@_val": value };
32858
33105
  } else {
32859
- parent[`c:${localName}`] = { "@_val": value };
33106
+ parent[`c:${localName2}`] = { "@_val": value };
32860
33107
  }
32861
33108
  }
32862
33109
  /**
@@ -33176,27 +33423,27 @@ function applySmartArtChrome(dataModel, chrome, getLocalName) {
33176
33423
  if (!chrome || !chrome.backgroundColor && !chrome.outlineColor && (chrome.outlineWidth === null || chrome.outlineWidth === void 0)) {
33177
33424
  return;
33178
33425
  }
33179
- const findKey12 = (obj, name) => Object.keys(obj).find((k) => getLocalName(k) === name);
33426
+ const findKey13 = (obj, name) => Object.keys(obj).find((k) => getLocalName(k) === name);
33180
33427
  if (chrome.backgroundColor) {
33181
33428
  const hex8 = chrome.backgroundColor.replace("#", "");
33182
- const bgKey = findKey12(dataModel, "bg") ?? "dgm:bg";
33429
+ const bgKey = findKey13(dataModel, "bg") ?? "dgm:bg";
33183
33430
  const bg = asObject2(dataModel[bgKey]);
33184
- const fillKey = findKey12(bg, "solidFill") ?? "a:solidFill";
33431
+ const fillKey = findKey13(bg, "solidFill") ?? "a:solidFill";
33185
33432
  bg[fillKey] = { "a:srgbClr": { "@_val": hex8 } };
33186
33433
  dataModel[bgKey] = bg;
33187
33434
  }
33188
33435
  const hasOutlineWidth = chrome.outlineWidth !== null && chrome.outlineWidth !== void 0;
33189
33436
  if (chrome.outlineColor || hasOutlineWidth) {
33190
- const wholeKey = findKey12(dataModel, "whole") ?? "dgm:whole";
33437
+ const wholeKey = findKey13(dataModel, "whole") ?? "dgm:whole";
33191
33438
  const whole = asObject2(dataModel[wholeKey]);
33192
- const lnKey = findKey12(whole, "ln") ?? "a:ln";
33439
+ const lnKey = findKey13(whole, "ln") ?? "a:ln";
33193
33440
  const ln = asObject2(whole[lnKey]);
33194
33441
  if (hasOutlineWidth) {
33195
33442
  ln["@_w"] = String(Math.round(chrome.outlineWidth * 12700));
33196
33443
  }
33197
33444
  if (chrome.outlineColor) {
33198
33445
  const hex8 = chrome.outlineColor.replace("#", "");
33199
- const fillKey = findKey12(ln, "solidFill") ?? "a:solidFill";
33446
+ const fillKey = findKey13(ln, "solidFill") ?? "a:solidFill";
33200
33447
  ln[fillKey] = { "a:srgbClr": { "@_val": hex8 } };
33201
33448
  }
33202
33449
  whole[lnKey] = ln;
@@ -33204,6 +33451,102 @@ function applySmartArtChrome(dataModel, chrome, getLocalName) {
33204
33451
  }
33205
33452
  }
33206
33453
 
33454
+ // src/core/core/runtime/smartart-style-xml.ts
33455
+ function localName(key) {
33456
+ const idx = key.indexOf(":");
33457
+ return idx >= 0 ? key.slice(idx + 1) : key;
33458
+ }
33459
+ function findKey12(obj, local) {
33460
+ return Object.keys(obj).find((k) => localName(k) === local);
33461
+ }
33462
+ function ensureChild(obj, local, prefixedFallback) {
33463
+ const key = findKey12(obj, local) ?? prefixedFallback;
33464
+ const existing = obj[key];
33465
+ if (existing && typeof existing === "object" && !Array.isArray(existing)) {
33466
+ return existing;
33467
+ }
33468
+ const created = {};
33469
+ obj[key] = created;
33470
+ return created;
33471
+ }
33472
+ function hexValue(color) {
33473
+ return color.replace(/^#/u, "").toUpperCase();
33474
+ }
33475
+ function solidFill(color) {
33476
+ return { "a:srgbClr": { "@_val": hexValue(color) } };
33477
+ }
33478
+ function setSolidFill(parent, color) {
33479
+ const key = findKey12(parent, "solidFill") ?? "a:solidFill";
33480
+ parent[key] = solidFill(color);
33481
+ }
33482
+ function applyShapeStyle(pt2, style) {
33483
+ if (style.fillColor === void 0 && style.lineColor === void 0) {
33484
+ return;
33485
+ }
33486
+ const spPr = ensureChild(pt2, "spPr", "dgm:spPr");
33487
+ if (style.fillColor !== void 0) {
33488
+ setSolidFill(spPr, style.fillColor);
33489
+ }
33490
+ if (style.lineColor !== void 0) {
33491
+ const ln = ensureChild(spPr, "ln", "a:ln");
33492
+ setSolidFill(ln, style.lineColor);
33493
+ }
33494
+ }
33495
+ function ensureFirstRunRPr(pt2) {
33496
+ const tKey = findKey12(pt2, "t");
33497
+ if (!tKey) {
33498
+ return void 0;
33499
+ }
33500
+ const body = pt2[tKey];
33501
+ if (!body || typeof body !== "object" || Array.isArray(body)) {
33502
+ return void 0;
33503
+ }
33504
+ const pKey = findKey12(body, "p");
33505
+ if (!pKey) {
33506
+ return void 0;
33507
+ }
33508
+ const paragraph = body[pKey];
33509
+ const firstP = Array.isArray(paragraph) ? paragraph[0] : paragraph;
33510
+ if (!firstP || typeof firstP !== "object") {
33511
+ return void 0;
33512
+ }
33513
+ const rKey = findKey12(firstP, "r");
33514
+ if (!rKey) {
33515
+ return void 0;
33516
+ }
33517
+ const run = firstP[rKey];
33518
+ const firstR = Array.isArray(run) ? run[0] : run;
33519
+ if (!firstR || typeof firstR !== "object") {
33520
+ return void 0;
33521
+ }
33522
+ return ensureChild(firstR, "rPr", "a:rPr");
33523
+ }
33524
+ function applyRunStyle(pt2, style) {
33525
+ if (style.bold === void 0 && style.italic === void 0 && style.fontColor === void 0) {
33526
+ return;
33527
+ }
33528
+ const rPr = ensureFirstRunRPr(pt2);
33529
+ if (!rPr) {
33530
+ return;
33531
+ }
33532
+ if (style.bold !== void 0) {
33533
+ rPr["@_b"] = style.bold ? "1" : "0";
33534
+ }
33535
+ if (style.italic !== void 0) {
33536
+ rPr["@_i"] = style.italic ? "1" : "0";
33537
+ }
33538
+ if (style.fontColor !== void 0) {
33539
+ setSolidFill(rPr, style.fontColor);
33540
+ }
33541
+ }
33542
+ function applySmartArtNodeStyleToPoint(pt2, style) {
33543
+ if (!style || Object.keys(style).length === 0) {
33544
+ return;
33545
+ }
33546
+ applyShapeStyle(pt2, style);
33547
+ applyRunStyle(pt2, style);
33548
+ }
33549
+
33207
33550
  // src/core/core/runtime/smartart-xml-builders.ts
33208
33551
  var NON_CONTENT_POINT_TYPES = /* @__PURE__ */ new Set([
33209
33552
  "doc",
@@ -33343,6 +33686,7 @@ function mergeSmartArtPointXml(existingPts, nodes) {
33343
33686
  continue;
33344
33687
  }
33345
33688
  applyTextToExistingPoint(pt2, desired);
33689
+ applySmartArtNodeStyleToPoint(pt2, desired.style);
33346
33690
  seenContentIds.add(modelId);
33347
33691
  merged.push(pt2);
33348
33692
  }
@@ -33356,6 +33700,7 @@ function mergeSmartArtPointXml(existingPts, nodes) {
33356
33700
  ptNode["@_type"] = node.nodeType;
33357
33701
  }
33358
33702
  ptNode["dgm:t"] = shouldRebuildFromRuns(node) ? buildPointFromRuns(node.runs) : buildPointText(node.text);
33703
+ applySmartArtNodeStyleToPoint(ptNode, node.style);
33359
33704
  merged.push(ptNode);
33360
33705
  }
33361
33706
  return merged;
@@ -34329,8 +34674,8 @@ var PptxHandlerRuntime27 = class extends PptxHandlerRuntime26 {
34329
34674
  }
34330
34675
  const obj = node;
34331
34676
  for (const [key, value] of Object.entries(obj)) {
34332
- const localName = this.compatibilityService.getXmlLocalName(key);
34333
- if (localName === "extLst" && value && typeof value === "object") {
34677
+ const localName2 = this.compatibilityService.getXmlLocalName(key);
34678
+ if (localName2 === "extLst" && value && typeof value === "object") {
34334
34679
  const extLst = value;
34335
34680
  for (const extKey of Object.keys(extLst)) {
34336
34681
  const extLocalName = this.compatibilityService.getXmlLocalName(extKey);
@@ -36546,9 +36891,9 @@ function applyTableStyleEntryToNode(styleNode, entry) {
36546
36891
  }
36547
36892
  function applyFillToSection(styleNode, sectionKey, fill) {
36548
36893
  const section = ensureSection(styleNode, sectionKey);
36549
- const tcStyle = ensureChild(section, "a:tcStyle");
36550
- const fillNode = ensureChild(tcStyle, "a:fill");
36551
- const solidFill = ensureChild(fillNode, "a:solidFill");
36894
+ const tcStyle = ensureChild2(section, "a:tcStyle");
36895
+ const fillNode = ensureChild2(tcStyle, "a:fill");
36896
+ const solidFill2 = ensureChild2(fillNode, "a:solidFill");
36552
36897
  const schemeClr = { "@_val": fill.schemeColor };
36553
36898
  if (fill.tint !== void 0) {
36554
36899
  schemeClr["a:tint"] = { "@_val": String(fill.tint) };
@@ -36556,14 +36901,14 @@ function applyFillToSection(styleNode, sectionKey, fill) {
36556
36901
  if (fill.shade !== void 0) {
36557
36902
  schemeClr["a:shade"] = { "@_val": String(fill.shade) };
36558
36903
  }
36559
- for (const key of Object.keys(solidFill)) {
36560
- delete solidFill[key];
36904
+ for (const key of Object.keys(solidFill2)) {
36905
+ delete solidFill2[key];
36561
36906
  }
36562
- solidFill["a:schemeClr"] = schemeClr;
36907
+ solidFill2["a:schemeClr"] = schemeClr;
36563
36908
  }
36564
36909
  function applyTextToSection(styleNode, sectionKey, text) {
36565
36910
  const section = ensureSection(styleNode, sectionKey);
36566
- const tcTxStyle = ensureChild(section, "a:tcTxStyle");
36911
+ const tcTxStyle = ensureChild2(section, "a:tcTxStyle");
36567
36912
  if (text.bold !== void 0) {
36568
36913
  if (text.bold) {
36569
36914
  tcTxStyle["@_b"] = "on";
@@ -36603,7 +36948,7 @@ function ensureSection(styleNode, sectionKey) {
36603
36948
  styleNode[sectionKey] = created;
36604
36949
  return created;
36605
36950
  }
36606
- function ensureChild(parent, key) {
36951
+ function ensureChild2(parent, key) {
36607
36952
  const existing = parent[key];
36608
36953
  if (Array.isArray(existing) && existing.length > 0) {
36609
36954
  return existing[0];
@@ -40361,9 +40706,9 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
40361
40706
  }
40362
40707
  const bgPr = xmlChild(bg, "p:bgPr");
40363
40708
  if (bgPr) {
40364
- const solidFill = xmlChild(bgPr, "a:solidFill");
40365
- if (solidFill) {
40366
- return this.parseColor(solidFill);
40709
+ const solidFill2 = xmlChild(bgPr, "a:solidFill");
40710
+ if (solidFill2) {
40711
+ return this.parseColor(solidFill2);
40367
40712
  }
40368
40713
  const pattFill = xmlChild(bgPr, "a:pattFill");
40369
40714
  if (pattFill) {
@@ -40406,9 +40751,9 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
40406
40751
  if (idx === 0) {
40407
40752
  return void 0;
40408
40753
  }
40409
- const solidFill = xmlChild(bgRef, "a:solidFill");
40410
- if (solidFill) {
40411
- return this.parseColor(solidFill);
40754
+ const solidFill2 = xmlChild(bgRef, "a:solidFill");
40755
+ if (solidFill2) {
40756
+ return this.parseColor(solidFill2);
40412
40757
  }
40413
40758
  const overrideColor = this.parseColor(bgRef);
40414
40759
  if (this.themeFormatScheme) {
@@ -43227,7 +43572,7 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
43227
43572
  partPath
43228
43573
  };
43229
43574
  }
43230
- collectLocalTextValues(node, localName, output) {
43575
+ collectLocalTextValues(node, localName2, output) {
43231
43576
  const MAX_NODES = 1e6;
43232
43577
  const stack = [node];
43233
43578
  let visited = 0;
@@ -43250,7 +43595,7 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
43250
43595
  }
43251
43596
  const objectNode = current;
43252
43597
  for (const [key, value] of Object.entries(objectNode)) {
43253
- if (this.compatibilityService.getXmlLocalName(key) === localName) {
43598
+ if (this.compatibilityService.getXmlLocalName(key) === localName2) {
43254
43599
  if (typeof value === "string" || typeof value === "number") {
43255
43600
  const textValue = String(value).trim();
43256
43601
  if (textValue.length > 0) {
@@ -43304,6 +43649,71 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
43304
43649
  }
43305
43650
  return runs.length > 0 ? runs : void 0;
43306
43651
  }
43652
+ /**
43653
+ * Extract a content point's per-node visual override.
43654
+ *
43655
+ * Reads the point's presentation `spPr` solid fill and line colour, and the
43656
+ * first run's `rPr` bold / italic / solid fill, into a
43657
+ * {@link PptxSmartArtNodeStyle}. Every field is optional and only set when
43658
+ * present, so an unstyled point yields `undefined` (never throws on missing
43659
+ * structure). This lets the editing UI display the node's current colours.
43660
+ */
43661
+ extractSmartArtNodeStyle(point) {
43662
+ const style = {};
43663
+ const spPr = this.xmlLookupService.getChildByLocalName(point, "spPr");
43664
+ if (spPr) {
43665
+ const fill = this.parseColor(this.xmlLookupService.getChildByLocalName(spPr, "solidFill"));
43666
+ if (fill) {
43667
+ style.fillColor = fill;
43668
+ }
43669
+ const ln = this.xmlLookupService.getChildByLocalName(spPr, "ln");
43670
+ if (ln) {
43671
+ const lineColor = this.parseColor(
43672
+ this.xmlLookupService.getChildByLocalName(ln, "solidFill")
43673
+ );
43674
+ if (lineColor) {
43675
+ style.lineColor = lineColor;
43676
+ }
43677
+ }
43678
+ }
43679
+ const rPr = this.firstRunProperties(point);
43680
+ if (rPr) {
43681
+ if (this.xmlBoolean(rPr["@_b"])) {
43682
+ style.bold = true;
43683
+ }
43684
+ if (this.xmlBoolean(rPr["@_i"])) {
43685
+ style.italic = true;
43686
+ }
43687
+ const fontColor = this.parseColor(
43688
+ this.xmlLookupService.getChildByLocalName(rPr, "solidFill")
43689
+ );
43690
+ if (fontColor) {
43691
+ style.fontColor = fontColor;
43692
+ }
43693
+ }
43694
+ return Object.keys(style).length > 0 ? style : void 0;
43695
+ }
43696
+ /** Read the first run's `rPr` of a content point's first paragraph. */
43697
+ firstRunProperties(point) {
43698
+ const tBody = this.xmlLookupService.getChildByLocalName(point, "t");
43699
+ if (!tBody) {
43700
+ return void 0;
43701
+ }
43702
+ const paragraph = this.xmlLookupService.getChildrenArrayByLocalName(tBody, "p")[0];
43703
+ if (!paragraph) {
43704
+ return void 0;
43705
+ }
43706
+ const run = this.xmlLookupService.getChildrenArrayByLocalName(paragraph, "r")[0];
43707
+ if (!run) {
43708
+ return void 0;
43709
+ }
43710
+ return this.xmlLookupService.getChildByLocalName(run, "rPr");
43711
+ }
43712
+ /** Interpret an OOXML boolean attribute ("1"/"true"/"on" => true). */
43713
+ xmlBoolean(value) {
43714
+ const v = String(value ?? "").trim().toLowerCase();
43715
+ return v === "1" || v === "true" || v === "on";
43716
+ }
43307
43717
  /**
43308
43718
  * Parse background and outline chrome from `dgm:bg` and `dgm:whole`.
43309
43719
  */
@@ -43318,8 +43728,8 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
43318
43728
  }
43319
43729
  const chrome = {};
43320
43730
  if (bg) {
43321
- const solidFill = this.xmlLookupService.getChildByLocalName(bg, "solidFill");
43322
- const bgColor = this.parseColor(solidFill);
43731
+ const solidFill2 = this.xmlLookupService.getChildByLocalName(bg, "solidFill");
43732
+ const bgColor = this.parseColor(solidFill2);
43323
43733
  if (bgColor) {
43324
43734
  chrome.backgroundColor = bgColor;
43325
43735
  }
@@ -43327,8 +43737,8 @@ var PptxHandlerRuntime68 = class extends PptxHandlerRuntime67 {
43327
43737
  if (whole) {
43328
43738
  const lnNode = this.xmlLookupService.getChildByLocalName(whole, "ln");
43329
43739
  if (lnNode) {
43330
- const solidFill = this.xmlLookupService.getChildByLocalName(lnNode, "solidFill");
43331
- const outlineColor = this.parseColor(solidFill);
43740
+ const solidFill2 = this.xmlLookupService.getChildByLocalName(lnNode, "solidFill");
43741
+ const outlineColor = this.parseColor(solidFill2);
43332
43742
  if (outlineColor) {
43333
43743
  chrome.outlineColor = outlineColor;
43334
43744
  }
@@ -43503,8 +43913,8 @@ var PptxHandlerRuntime69 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
43503
43913
  const skewY = xfrm?.["@_skewY"] ? parseInt(String(xfrm["@_skewY"]), 10) / 6e4 : void 0;
43504
43914
  const prstGeom = this.xmlLookupService.getChildByLocalName(spPr, "prstGeom");
43505
43915
  const shapeType = prstGeom ? String(prstGeom["@_prst"] || "rect") : "rect";
43506
- const solidFill = this.xmlLookupService.getChildByLocalName(spPr, "solidFill");
43507
- const fillColor = this.parseColor(solidFill);
43916
+ const solidFill2 = this.xmlLookupService.getChildByLocalName(spPr, "solidFill");
43917
+ const fillColor = this.parseColor(solidFill2);
43508
43918
  const lnNode = this.xmlLookupService.getChildByLocalName(spPr, "ln");
43509
43919
  const lnFill = lnNode ? this.xmlLookupService.getChildByLocalName(lnNode, "solidFill") : void 0;
43510
43920
  const strokeColor = this.parseColor(lnFill);
@@ -43608,12 +44018,14 @@ var PptxHandlerRuntime70 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
43608
44018
  return null;
43609
44019
  }
43610
44020
  const runs = this.extractSmartArtNodeRuns(point);
44021
+ const style = this.extractSmartArtNodeStyle(point);
43611
44022
  return {
43612
44023
  id: pointId,
43613
44024
  text: resolvedText.trim(),
43614
44025
  parentId: parentByNodeId.get(pointId),
43615
44026
  nodeType,
43616
- runs
44027
+ runs,
44028
+ style
43617
44029
  };
43618
44030
  }).filter((entry) => Boolean(entry)).slice(0, MAX_SMARTART_NODES);
43619
44031
  if (nodes.length === 0) {
@@ -43778,10 +44190,10 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
43778
44190
  };
43779
44191
  const matchedKeys = [];
43780
44192
  for (const key of Object.keys(plotArea)) {
43781
- const localName = this.compatibilityService.getXmlLocalName(key);
43782
- const mapped = chartElementMap[localName];
44193
+ const localName2 = this.compatibilityService.getXmlLocalName(key);
44194
+ const mapped = chartElementMap[localName2];
43783
44195
  if (mapped) {
43784
- matchedKeys.push(localName);
44196
+ matchedKeys.push(localName2);
43785
44197
  }
43786
44198
  }
43787
44199
  if (matchedKeys.length >= 2) {
@@ -43791,8 +44203,8 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
43791
44203
  return chartElementMap[matchedKeys[0]];
43792
44204
  }
43793
44205
  for (const key of Object.keys(plotArea)) {
43794
- const localName = this.compatibilityService.getXmlLocalName(key);
43795
- if (localName === "plotAreaRegion" || localName === "plotSurface") {
44206
+ const localName2 = this.compatibilityService.getXmlLocalName(key);
44207
+ if (localName2 === "plotAreaRegion" || localName2 === "plotSurface") {
43796
44208
  const seriesArr = this.xmlLookupService.getChildrenArrayByLocalName(
43797
44209
  plotArea[key],
43798
44210
  "series"
@@ -44319,8 +44731,8 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
44319
44731
  if (key.startsWith("@_")) {
44320
44732
  continue;
44321
44733
  }
44322
- const localName = this.compatibilityService.getXmlLocalName(key);
44323
- if (localName === "schemeClr") {
44734
+ const localName2 = this.compatibilityService.getXmlLocalName(key);
44735
+ if (localName2 === "schemeClr") {
44324
44736
  const items = Array.isArray(value) ? value : [value];
44325
44737
  for (const item of items) {
44326
44738
  const resolved = this.resolveChartSchemeColor(item);
@@ -44328,7 +44740,7 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
44328
44740
  output.push(resolved);
44329
44741
  }
44330
44742
  }
44331
- } else if (localName === "srgbClr") {
44743
+ } else if (localName2 === "srgbClr") {
44332
44744
  const items = Array.isArray(value) ? value : [value];
44333
44745
  for (const item of items) {
44334
44746
  const hex8 = String(
@@ -45131,6 +45543,7 @@ var PptxHandlerRuntime77 = class extends PptxHandlerRuntime76 {
45131
45543
  };
45132
45544
 
45133
45545
  // src/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
45546
+ var MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
45134
45547
  var PptxHandlerRuntime78 = class _PptxHandlerRuntime extends PptxHandlerRuntime77 {
45135
45548
  isZipContainer(data) {
45136
45549
  const bytes = new Uint8Array(data);
@@ -45350,6 +45763,59 @@ var PptxHandlerRuntime78 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
45350
45763
  orderedSections
45351
45764
  };
45352
45765
  }
45766
+ /**
45767
+ * Recover and attach the real embedded binary for each OLE element on a
45768
+ * slide so callers can download / open the inner file.
45769
+ *
45770
+ * For each embedded (non-linked) OLE object: resolve its relationship
45771
+ * target to a zip path (same resolution as images), read the bytes, unwrap
45772
+ * a generic "Package" wrapper (recovering the original file name) when
45773
+ * present, derive a MIME type, and expose the payload as a data-URL on the
45774
+ * element. Linked objects, missing targets, oversized payloads, and parse
45775
+ * failures are skipped silently so existing behaviour is preserved.
45776
+ */
45777
+ async enrichOleElementsWithEmbeddedData(elements, slidePath, depth = 0) {
45778
+ const MAX_OLE_DEPTH = 32;
45779
+ if (depth > MAX_OLE_DEPTH) {
45780
+ return;
45781
+ }
45782
+ for (const el of elements) {
45783
+ if (el.type === "group" && el.children) {
45784
+ await this.enrichOleElementsWithEmbeddedData(el.children, slidePath, depth + 1);
45785
+ continue;
45786
+ }
45787
+ if (el.type !== "ole" || el.isLinked || !el.oleTarget) {
45788
+ continue;
45789
+ }
45790
+ try {
45791
+ const embeddingPath = this.resolveImagePath(slidePath, el.oleTarget);
45792
+ if (!embeddingPath) {
45793
+ continue;
45794
+ }
45795
+ const file = this.zip.file(embeddingPath);
45796
+ if (!file) {
45797
+ continue;
45798
+ }
45799
+ const buffer = await file.async("arraybuffer");
45800
+ if (buffer.byteLength === 0 || buffer.byteLength > MAX_OLE_EMBEDDING_BYTES) {
45801
+ continue;
45802
+ }
45803
+ const unwrapped = unwrapOleEmbedding(new Uint8Array(buffer));
45804
+ if (unwrapped.data.length === 0) {
45805
+ continue;
45806
+ }
45807
+ const fileName = unwrapped.fileName ?? el.fileName ?? (el.oleName && el.oleFileExtension ? `${el.oleName}.${el.oleFileExtension}` : void 0);
45808
+ const mimeType = mimeTypeForOleFile(fileName ?? `x.${el.oleFileExtension ?? "bin"}`);
45809
+ el.oleEmbeddedData = oleBytesToDataUrl(unwrapped.data, mimeType);
45810
+ el.oleEmbeddedByteSize = unwrapped.data.length;
45811
+ el.oleEmbeddedMimeType = mimeType;
45812
+ if (fileName) {
45813
+ el.oleEmbeddedFileName = fileName;
45814
+ }
45815
+ } catch {
45816
+ }
45817
+ }
45818
+ }
45353
45819
  async loadSlidesForPresentation(sectionBySlideId) {
45354
45820
  if (!this.presentationData) {
45355
45821
  return [];
@@ -45377,6 +45843,7 @@ var PptxHandlerRuntime78 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
45377
45843
  parseSlide: (slideXml2, slidePath) => this.parseSlide(slideXml2, slidePath),
45378
45844
  extractMediaTimingMap: (slideXml2, slidePath) => this.extractMediaTimingMap(slideXml2, slidePath),
45379
45845
  enrichMediaElementsWithTiming: (elements, timingMap) => this.enrichMediaElementsWithTiming(elements, timingMap),
45846
+ enrichOleElementsWithEmbeddedData: (elements, slidePath) => this.enrichOleElementsWithEmbeddedData(elements, slidePath),
45380
45847
  extractBackgroundColor: (slideXml2) => this.extractBackgroundColor(slideXml2),
45381
45848
  getLayoutBackgroundColor: (slidePath) => this.getLayoutBackgroundColor(slidePath),
45382
45849
  extractBackgroundGradient: (slideXml2) => this.extractBackgroundGradient(slideXml2),
@@ -63707,6 +64174,7 @@ exports.createTemplateShapeRawXml = createTemplateShapeRawXml;
63707
64174
  exports.createTextElement = createTextElement;
63708
64175
  exports.createUniformTextSegments = createUniformTextSegments;
63709
64176
  exports.dataUrlToMediaBytes = dataUrlToMediaBytes;
64177
+ exports.decodeOle10Native = decodeOle10Native;
63710
64178
  exports.decomposeSmartArt = decomposeSmartArt;
63711
64179
  exports.decryptPptx = decryptPptx;
63712
64180
  exports.demoteSmartArtNode = demoteSmartArtNode;
@@ -63814,6 +64282,7 @@ exports.isEditableTextElement = isEditableTextElement;
63814
64282
  exports.isImageLikeElement = isImageLikeElement;
63815
64283
  exports.isInkElement = isInkElement;
63816
64284
  exports.isNamespaceSupported = isNamespaceSupported;
64285
+ exports.isOle2CompoundFile = isOle2CompoundFile;
63817
64286
  exports.isShapeElement = isShapeElement;
63818
64287
  exports.isStrictNamespaceUri = isStrictNamespaceUri;
63819
64288
  exports.isSummaryZoomSlide = isSummaryZoomSlide;
@@ -63832,6 +64301,7 @@ exports.mergePresentation = mergePresentation;
63832
64301
  exports.mergeShapes = mergeShapes;
63833
64302
  exports.mergeStyleParts = mergeStyleParts;
63834
64303
  exports.mergeThemeColorOverride = mergeThemeColorOverride;
64304
+ exports.mimeTypeForOleFile = mimeTypeForOleFile;
63835
64305
  exports.mm = mm;
63836
64306
  exports.moveSlidesToSection = moveSlidesToSection;
63837
64307
  exports.navigateCustomShow = navigateCustomShow;
@@ -63842,6 +64312,7 @@ exports.normalizePath = normalizePath;
63842
64312
  exports.normalizeStrictXml = normalizeStrictXml;
63843
64313
  exports.normalizeStrokeDashType = normalizeStrokeDashType;
63844
64314
  exports.obfuscateFont = obfuscateFont;
64315
+ exports.oleBytesToDataUrl = oleBytesToDataUrl;
63845
64316
  exports.ooxmlArcToSvg = ooxmlArcToSvg;
63846
64317
  exports.ooxmlToPresetName = ooxmlToPresetName;
63847
64318
  exports.parseActiveXControlsFromSlide = parseActiveXControlsFromSlide;
@@ -63941,6 +64412,7 @@ exports.setChartSeriesMarker = setChartSeriesMarker;
63941
64412
  exports.setChartSeriesTrendline = setChartSeriesTrendline;
63942
64413
  exports.setChartTitle = setChartTitle;
63943
64414
  exports.setChartType = setChartType;
64415
+ exports.setSmartArtNodeStyle = setSmartArtNodeStyle;
63944
64416
  exports.shouldRenderFallbackLabel = shouldRenderFallbackLabel;
63945
64417
  exports.shouldReturnToZoomSlide = shouldReturnToZoomSlide;
63946
64418
  exports.subtractPolygons = subtractPolygons;
@@ -63954,6 +64426,7 @@ exports.unionPolygons = unionPolygons;
63954
64426
  exports.unionShapes = unionShapes;
63955
64427
  exports.unionSvgPaths = unionSvgPaths;
63956
64428
  exports.unwrapAlternateContent = unwrapAlternateContent;
64429
+ exports.unwrapOleEmbedding = unwrapOleEmbedding;
63957
64430
  exports.updateCellTextInRawXml = updateCellTextInRawXml;
63958
64431
  exports.updateCellTextStyleInRawXml = updateCellTextStyleInRawXml;
63959
64432
  exports.updateChartDataPoint = updateChartDataPoint;