pptx-react-viewer 4.11.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{AiChatPanel-537JJCV4.js → AiChatPanel-FV22KLWM.js} +27 -27
  3. package/dist/AiChatPanel-FV22KLWM.js.br +0 -0
  4. package/dist/AiChatPanel-FV22KLWM.js.gz +0 -0
  5. package/dist/{AiChatPanel-3IKRPPUX.mjs → AiChatPanel-ZMVKLTNX.mjs} +3 -3
  6. package/dist/AiChatPanel-ZMVKLTNX.mjs.br +0 -0
  7. package/dist/AiChatPanel-ZMVKLTNX.mjs.gz +0 -0
  8. package/dist/{Model3DScene-3XT5SBU4.js → Model3DScene-DWLMI554.js} +2 -2
  9. package/dist/Model3DScene-DWLMI554.js.br +0 -0
  10. package/dist/Model3DScene-DWLMI554.js.gz +0 -0
  11. package/dist/{Model3DScene-WBJV27OR.mjs → Model3DScene-JGW2QDN3.mjs} +1 -1
  12. package/dist/Model3DScene-JGW2QDN3.mjs.br +0 -0
  13. package/dist/Model3DScene-JGW2QDN3.mjs.gz +0 -0
  14. package/dist/{chunk-ZVBB3CC5.mjs → chunk-36223DLG.mjs} +1226 -1009
  15. package/dist/chunk-36223DLG.mjs.br +0 -0
  16. package/dist/chunk-36223DLG.mjs.gz +0 -0
  17. package/dist/{chunk-XGDCECDK.js → chunk-73CSPIMU.js} +187 -187
  18. package/dist/chunk-73CSPIMU.js.br +0 -0
  19. package/dist/chunk-73CSPIMU.js.gz +0 -0
  20. package/dist/{chunk-G353KKQX.mjs → chunk-HOIC3XAF.mjs} +3 -3
  21. package/dist/chunk-HOIC3XAF.mjs.br +0 -0
  22. package/dist/chunk-HOIC3XAF.mjs.gz +0 -0
  23. package/dist/{chunk-GLFTASJH.js → chunk-I2EV62KC.js} +806 -806
  24. package/dist/chunk-I2EV62KC.js.br +0 -0
  25. package/dist/chunk-I2EV62KC.js.gz +0 -0
  26. package/dist/{chunk-SDEBL4LY.mjs → chunk-NAL3FTKM.mjs} +7 -7
  27. package/dist/chunk-NAL3FTKM.mjs.br +0 -0
  28. package/dist/chunk-NAL3FTKM.mjs.gz +0 -0
  29. package/dist/{chunk-TLKFCZWS.js → chunk-QFTHDPEA.js} +1245 -1009
  30. package/dist/chunk-QFTHDPEA.js.br +0 -0
  31. package/dist/chunk-QFTHDPEA.js.gz +0 -0
  32. package/dist/{chunk-4MI3PMQT.mjs → chunk-R7FGWOEG.mjs} +1 -1
  33. package/dist/chunk-R7FGWOEG.mjs.br +0 -0
  34. package/dist/chunk-R7FGWOEG.mjs.gz +0 -0
  35. package/dist/{chunk-LVWMKZPS.js → chunk-RRT4LIRN.js} +5 -5
  36. package/dist/chunk-RRT4LIRN.js.br +0 -0
  37. package/dist/chunk-RRT4LIRN.js.gz +0 -0
  38. package/dist/{chunk-NCUM2X4H.js → chunk-XDTZVM5K.js} +1180 -1180
  39. package/dist/chunk-XDTZVM5K.js.br +0 -0
  40. package/dist/chunk-XDTZVM5K.js.gz +0 -0
  41. package/dist/{chunk-BR4GXQSN.mjs → chunk-YXRSLJEB.mjs} +1 -1
  42. package/dist/chunk-YXRSLJEB.mjs.br +0 -0
  43. package/dist/chunk-YXRSLJEB.mjs.gz +0 -0
  44. package/dist/index.js +61 -61
  45. package/dist/index.js.br +0 -0
  46. package/dist/index.js.gz +0 -0
  47. package/dist/index.mjs +5 -5
  48. package/dist/index.mjs.br +0 -0
  49. package/dist/index.mjs.gz +0 -0
  50. package/dist/internals.js +104 -104
  51. package/dist/internals.js.br +0 -0
  52. package/dist/internals.js.gz +0 -0
  53. package/dist/internals.mjs +3 -3
  54. package/dist/internals.mjs.br +0 -0
  55. package/dist/internals.mjs.gz +0 -0
  56. package/dist/viewer/index.js +26 -26
  57. package/dist/viewer/index.js.br +0 -0
  58. package/dist/viewer/index.js.gz +0 -0
  59. package/dist/viewer/index.mjs +5 -5
  60. package/dist/viewer/index.mjs.br +0 -0
  61. package/dist/viewer/index.mjs.gz +0 -0
  62. package/package.json +1 -1
  63. package/dist/AiChatPanel-3IKRPPUX.mjs.br +0 -0
  64. package/dist/AiChatPanel-3IKRPPUX.mjs.gz +0 -0
  65. package/dist/AiChatPanel-537JJCV4.js.br +0 -0
  66. package/dist/AiChatPanel-537JJCV4.js.gz +0 -0
  67. package/dist/Model3DScene-3XT5SBU4.js.br +0 -0
  68. package/dist/Model3DScene-3XT5SBU4.js.gz +0 -0
  69. package/dist/Model3DScene-WBJV27OR.mjs.br +0 -0
  70. package/dist/Model3DScene-WBJV27OR.mjs.gz +0 -0
  71. package/dist/chunk-4MI3PMQT.mjs.br +0 -0
  72. package/dist/chunk-4MI3PMQT.mjs.gz +0 -0
  73. package/dist/chunk-BR4GXQSN.mjs.br +0 -0
  74. package/dist/chunk-BR4GXQSN.mjs.gz +0 -0
  75. package/dist/chunk-G353KKQX.mjs.br +0 -0
  76. package/dist/chunk-G353KKQX.mjs.gz +0 -0
  77. package/dist/chunk-GLFTASJH.js.br +0 -0
  78. package/dist/chunk-GLFTASJH.js.gz +0 -0
  79. package/dist/chunk-LVWMKZPS.js.br +0 -0
  80. package/dist/chunk-LVWMKZPS.js.gz +0 -0
  81. package/dist/chunk-NCUM2X4H.js.br +0 -0
  82. package/dist/chunk-NCUM2X4H.js.gz +0 -0
  83. package/dist/chunk-SDEBL4LY.mjs.br +0 -0
  84. package/dist/chunk-SDEBL4LY.mjs.gz +0 -0
  85. package/dist/chunk-TLKFCZWS.js.br +0 -0
  86. package/dist/chunk-TLKFCZWS.js.gz +0 -0
  87. package/dist/chunk-XGDCECDK.js.br +0 -0
  88. package/dist/chunk-XGDCECDK.js.gz +0 -0
  89. package/dist/chunk-ZVBB3CC5.mjs.br +0 -0
  90. package/dist/chunk-ZVBB3CC5.mjs.gz +0 -0
@@ -2,12 +2,31 @@
2
2
 
3
3
  var JSZip3 = require('jszip');
4
4
  var fastXmlParser = require('fast-xml-parser');
5
- var opentype_js = require('opentype.js');
5
+ var opentypeModule = require('opentype.js');
6
6
  var DOMPurify = require('dompurify');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
10
28
  var JSZip3__default = /*#__PURE__*/_interopDefault(JSZip3);
29
+ var opentypeModule__namespace = /*#__PURE__*/_interopNamespace(opentypeModule);
11
30
  var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
12
31
 
13
32
  // ../core/dist/index.mjs
@@ -28717,7 +28736,7 @@ var ENTRY_TYPE_ROOT;
28717
28736
  var DIR_ENTRY_SIZE;
28718
28737
  var Ole2ParseError;
28719
28738
  var init_ole2_parser_types = __esm({
28720
- "src/core/utils/ole2-parser-types.ts"() {
28739
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
28721
28740
  OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
28722
28741
  ENDOFCHAIN = 4294967294;
28723
28742
  FREESECT = 4294967295;
@@ -28767,9 +28786,7 @@ function parseOle2(buffer) {
28767
28786
  function readSector(sector) {
28768
28787
  const offset = sectorOffset(sector);
28769
28788
  if (offset + sectorSize > data.length) {
28770
- throw new Ole2ParseError(
28771
- `Sector ${sector} at offset ${offset} exceeds file size ${data.length}`
28772
- );
28789
+ throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
28773
28790
  }
28774
28791
  return data.subarray(offset, offset + sectorSize);
28775
28792
  }
@@ -28829,11 +28846,7 @@ function parseOle2(buffer) {
28829
28846
  const miniFatEntries = [];
28830
28847
  if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
28831
28848
  const miniFatRaw = readSectorChain(firstMiniFATSector);
28832
- const miniFatView = new DataView(
28833
- miniFatRaw.buffer,
28834
- miniFatRaw.byteOffset,
28835
- miniFatRaw.byteLength
28836
- );
28849
+ const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
28837
28850
  for (let i2 = 0; i2 < miniFatRaw.length / 4; i2++) {
28838
28851
  miniFatEntries.push(miniFatView.getUint32(i2 * 4, true));
28839
28852
  }
@@ -28857,9 +28870,7 @@ function parseOle2(buffer) {
28857
28870
  const leftSiblingId = entryView.getUint32(68, true);
28858
28871
  const rightSiblingId = entryView.getUint32(72, true);
28859
28872
  const childId = entryView.getUint32(76, true);
28860
- const clsid = new Uint8Array(
28861
- entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96)
28862
- );
28873
+ const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
28863
28874
  const startSector = entryView.getUint32(116, true);
28864
28875
  const sizeLow = entryView.getUint32(120, true);
28865
28876
  let size = sizeLow;
@@ -28909,9 +28920,7 @@ function parseOle2(buffer) {
28909
28920
  return result.subarray(0, Math.min(size, result.length));
28910
28921
  }
28911
28922
  function getStream(name) {
28912
- const entry5 = entries2.find(
28913
- (e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name
28914
- );
28923
+ const entry5 = entries2.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name);
28915
28924
  if (!entry5) {
28916
28925
  return void 0;
28917
28926
  }
@@ -28923,7 +28932,17 @@ function parseOle2(buffer) {
28923
28932
  return { entries: entries2, getStream };
28924
28933
  }
28925
28934
  var init_ole2_parser_read = __esm({
28935
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
28936
+ init_ole2_parser_types();
28937
+ }
28938
+ });
28939
+ var init_ole2_parser_read2 = __esm({
28926
28940
  "src/core/utils/ole2-parser-read.ts"() {
28941
+ init_ole2_parser_read();
28942
+ }
28943
+ });
28944
+ var init_ole2_parser_types2 = __esm({
28945
+ "src/core/utils/ole2-parser-types.ts"() {
28927
28946
  init_ole2_parser_types();
28928
28947
  }
28929
28948
  });
@@ -29041,8 +29060,8 @@ var OLE10_NATIVE_STREAM_NAMES;
29041
29060
  var CONTENTS_STREAM;
29042
29061
  var init_ole_embedded_extract = __esm({
29043
29062
  "src/core/utils/ole-embedded-extract.ts"() {
29044
- init_ole2_parser_read();
29045
- init_ole2_parser_types();
29063
+ init_ole2_parser_read2();
29064
+ init_ole2_parser_types2();
29046
29065
  OLE10_NATIVE_STREAM_NAMES = [`${String.fromCharCode(1)}Ole10Native`, "Ole10Native"];
29047
29066
  CONTENTS_STREAM = "CONTENTS";
29048
29067
  }
@@ -29069,9 +29088,9 @@ function encodeName(name) {
29069
29088
  }
29070
29089
  return bytes;
29071
29090
  }
29072
- function writeFatChain(fat, chain) {
29073
- for (let i2 = 0; i2 < chain.sectors.length; i2++) {
29074
- fat[chain.sectors[i2]] = i2 < chain.sectors.length - 1 ? chain.sectors[i2 + 1] : ENDOFCHAIN;
29091
+ function writeFatChain(fat, chain2) {
29092
+ for (let i2 = 0; i2 < chain2.sectors.length; i2++) {
29093
+ fat[chain2.sectors[i2]] = i2 < chain2.sectors.length - 1 ? chain2.sectors[i2 + 1] : ENDOFCHAIN;
29075
29094
  }
29076
29095
  }
29077
29096
  function writeFatRun(fat, firstSector, count) {
@@ -29092,7 +29111,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
29092
29111
  }
29093
29112
  }
29094
29113
  var init_ole2_parser_write_helpers = __esm({
29095
- "src/core/utils/ole2-parser-write-helpers.ts"() {
29114
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
29096
29115
  init_ole2_parser_types();
29097
29116
  }
29098
29117
  });
@@ -29108,18 +29127,10 @@ function writeHeader(outView, outBytes, params) {
29108
29127
  outView.setUint32(48, params.firstDirSector, true);
29109
29128
  outView.setUint32(52, 0, true);
29110
29129
  outView.setUint32(56, params.miniStreamCutoff, true);
29111
- outView.setUint32(
29112
- 60,
29113
- params.numMiniFATSectors > 0 ? params.firstMiniFATSector : ENDOFCHAIN,
29114
- true
29115
- );
29130
+ outView.setUint32(60, params.numMiniFATSectors > 0 ? params.firstMiniFATSector : ENDOFCHAIN, true);
29116
29131
  outView.setUint32(64, params.numMiniFATSectors, true);
29117
29132
  const numDIFATSectors = params.numDIFATSectors ?? 0;
29118
- outView.setUint32(
29119
- 68,
29120
- numDIFATSectors > 0 ? params.firstDIFATSector ?? ENDOFCHAIN : ENDOFCHAIN,
29121
- true
29122
- );
29133
+ outView.setUint32(68, numDIFATSectors > 0 ? params.firstDIFATSector ?? ENDOFCHAIN : ENDOFCHAIN, true);
29123
29134
  outView.setUint32(72, numDIFATSectors, true);
29124
29135
  for (let i2 = 0; i2 < HEADER_DIFAT_ENTRIES; i2++) {
29125
29136
  if (i2 < params.numFATSectors) {
@@ -29151,11 +29162,7 @@ function writeDifatSectors(outView, params) {
29151
29162
  const base = (params.firstDIFATSector + d + 1) * params.sectorSize;
29152
29163
  for (let j = 0; j < perSector; j++) {
29153
29164
  const fatIndex = HEADER_DIFAT_ENTRIES + d * perSector + j;
29154
- outView.setUint32(
29155
- base + j * 4,
29156
- fatIndex < params.numFATSectors ? params.firstFATSector + fatIndex : FREESECT,
29157
- true
29158
- );
29165
+ outView.setUint32(base + j * 4, fatIndex < params.numFATSectors ? params.firstFATSector + fatIndex : FREESECT, true);
29159
29166
  }
29160
29167
  const next = d < params.numDIFATSectors - 1 ? params.firstDIFATSector + d + 1 : ENDOFCHAIN;
29161
29168
  outView.setUint32(base + perSector * 4, next, true);
@@ -29189,9 +29196,9 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
29189
29196
  }
29190
29197
  return dirData;
29191
29198
  }
29192
- function writeStreamSectors(outBytes, streamData, chain, sectorSize) {
29193
- for (let i2 = 0; i2 < chain.sectors.length; i2++) {
29194
- const sectorOffset = (chain.sectors[i2] + 1) * sectorSize;
29199
+ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
29200
+ for (let i2 = 0; i2 < chain2.sectors.length; i2++) {
29201
+ const sectorOffset = (chain2.sectors[i2] + 1) * sectorSize;
29195
29202
  const srcOffset = i2 * sectorSize;
29196
29203
  const srcEnd = Math.min(srcOffset + sectorSize, streamData.length);
29197
29204
  outBytes.set(streamData.subarray(srcOffset, srcEnd), sectorOffset);
@@ -29199,7 +29206,7 @@ function writeStreamSectors(outBytes, streamData, chain, sectorSize) {
29199
29206
  }
29200
29207
  var HEADER_DIFAT_ENTRIES;
29201
29208
  var init_ole2_parser_write_serialize = __esm({
29202
- "src/core/utils/ole2-parser-write-serialize.ts"() {
29209
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
29203
29210
  init_ole2_parser_types();
29204
29211
  init_ole2_parser_write_helpers();
29205
29212
  HEADER_DIFAT_ENTRIES = 109;
@@ -29271,20 +29278,20 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
29271
29278
  clsid: rootClsid
29272
29279
  });
29273
29280
  for (const stream of regularStreams) {
29274
- const chain = fatChains.get(stream.name);
29281
+ const chain2 = fatChains.get(stream.name);
29275
29282
  dirEntries.push({
29276
29283
  name: stream.name,
29277
29284
  type: ENTRY_TYPE_STREAM,
29278
- startSector: chain.start,
29285
+ startSector: chain2.start,
29279
29286
  size: stream.data.length
29280
29287
  });
29281
29288
  }
29282
29289
  for (const stream of miniStreams) {
29283
- const chain = miniFatChains.get(stream.name);
29290
+ const chain2 = miniFatChains.get(stream.name);
29284
29291
  dirEntries.push({
29285
29292
  name: stream.name,
29286
29293
  type: ENTRY_TYPE_STREAM,
29287
- startSector: chain.start,
29294
+ startSector: chain2.start,
29288
29295
  size: stream.data.length
29289
29296
  });
29290
29297
  }
@@ -29309,8 +29316,8 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
29309
29316
  const totalSectors = nextSector;
29310
29317
  const fat = new Int32Array(numFATSectors * (sectorSize / 4));
29311
29318
  fat.fill(-1);
29312
- for (const [, chain] of fatChains) {
29313
- writeFatChain(fat, chain);
29319
+ for (const [, chain2] of fatChains) {
29320
+ writeFatChain(fat, chain2);
29314
29321
  }
29315
29322
  writeFatChain(fat, { start: rootSectors[0] ?? 0, sectors: rootSectors });
29316
29323
  writeFatRun(fat, firstDirSector, numDirSectors);
@@ -29327,8 +29334,8 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
29327
29334
  if (miniStreams.length > 0) {
29328
29335
  miniFat = new Int32Array(numMiniFATSectors * (sectorSize / 4));
29329
29336
  miniFat.fill(-1);
29330
- for (const [, chain] of miniFatChains) {
29331
- writeFatChain(miniFat, chain);
29337
+ for (const [, chain2] of miniFatChains) {
29338
+ writeFatChain(miniFat, chain2);
29332
29339
  }
29333
29340
  }
29334
29341
  const fileSize = (totalSectors + 1) * sectorSize;
@@ -29349,12 +29356,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
29349
29356
  writeStreamSectors(outBytes, stream.data, fatChains.get(stream.name), sectorSize);
29350
29357
  }
29351
29358
  if (miniStreamContainer.length > 0) {
29352
- writeStreamSectors(
29353
- outBytes,
29354
- miniStreamContainer,
29355
- { start: rootSectors[0] ?? 0, sectors: rootSectors },
29356
- sectorSize
29357
- );
29359
+ writeStreamSectors(outBytes, miniStreamContainer, { start: rootSectors[0] ?? 0, sectors: rootSectors }, sectorSize);
29358
29360
  }
29359
29361
  const dirData = serializeDirectoryEntries(sortedDirEntries, numDirSectors, sectorSize);
29360
29362
  for (let i2 = 0; i2 < numDirSectors; i2++) {
@@ -29375,12 +29377,17 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
29375
29377
  return output;
29376
29378
  }
29377
29379
  var init_ole2_parser_write = __esm({
29378
- "src/core/utils/ole2-parser-write.ts"() {
29380
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
29379
29381
  init_ole2_parser_types();
29380
29382
  init_ole2_parser_write_helpers();
29381
29383
  init_ole2_parser_write_serialize();
29382
29384
  }
29383
29385
  });
29386
+ var init_ole2_parser_write2 = __esm({
29387
+ "src/core/utils/ole2-parser-write.ts"() {
29388
+ init_ole2_parser_write();
29389
+ }
29390
+ });
29384
29391
  function asciiZ(value) {
29385
29392
  const bytes = new Uint8Array(value.length + 1);
29386
29393
  for (let i2 = 0; i2 < value.length; i2++) {
@@ -29468,8 +29475,8 @@ var CONTENTS_STREAM2;
29468
29475
  var init_ole_embedded_replace = __esm({
29469
29476
  "src/core/utils/ole-embedded-replace.ts"() {
29470
29477
  init_ole_embedded_extract();
29471
- init_ole2_parser_read();
29472
- init_ole2_parser_write();
29478
+ init_ole2_parser_read2();
29479
+ init_ole2_parser_write2();
29473
29480
  OLE10_NATIVE_NAME = `${String.fromCharCode(1)}Ole10Native`;
29474
29481
  OLE10_NATIVE_NAME_UNPREFIXED = "Ole10Native";
29475
29482
  CONTENTS_STREAM2 = "CONTENTS";
@@ -29524,7 +29531,7 @@ var ZIP_MAGIC;
29524
29531
  var init_ole_payload_kind = __esm({
29525
29532
  "src/core/utils/ole-payload-kind.ts"() {
29526
29533
  init_ole_embedded_extract();
29527
- init_ole2_parser_read();
29534
+ init_ole2_parser_read2();
29528
29535
  ZIP_MAGIC = [80, 75, 3, 4];
29529
29536
  }
29530
29537
  });
@@ -30065,33 +30072,321 @@ var init_ole_sheet_xlsx_editor = __esm({
30065
30072
  DEFAULT_MAX_COLS = 26;
30066
30073
  }
30067
30074
  });
30075
+ function chain(table2, start, limit) {
30076
+ if (start === END && limit === 0)
30077
+ return [];
30078
+ const out = [], seen = /* @__PURE__ */ new Set();
30079
+ let id = start;
30080
+ while (id !== END) {
30081
+ if (id > MAX || id >= table2.length || seen.has(id) || out.length >= limit)
30082
+ throw new Error("Invalid CFB chain");
30083
+ seen.add(id);
30084
+ out.push(id);
30085
+ id = table2[id];
30086
+ }
30087
+ if (out.length !== limit)
30088
+ throw new Error("Unexpected CFB chain length");
30089
+ return out;
30090
+ }
30091
+ function chainToEnd(table2, start, max) {
30092
+ if (start === END)
30093
+ return [];
30094
+ const out = [], seen = /* @__PURE__ */ new Set();
30095
+ let id = start;
30096
+ while (id !== END) {
30097
+ if (id > MAX || id >= table2.length || seen.has(id) || out.length >= max)
30098
+ throw new Error("Invalid CFB chain");
30099
+ seen.add(id);
30100
+ out.push(id);
30101
+ id = table2[id];
30102
+ }
30103
+ return out;
30104
+ }
30105
+ function processCompoundFileStream(input, path, replacement) {
30106
+ const reject = () => replacement ? input : void 0;
30107
+ try {
30108
+ if (path.length === 0 || path.some((part) => !part) || input.length < 512)
30109
+ return reject();
30110
+ const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
30111
+ const read32 = (offset2) => view.getUint32(offset2, true);
30112
+ if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || view.getUint16(28, true) !== 65534)
30113
+ return reject();
30114
+ const major = view.getUint16(26, true), shift = view.getUint16(30, true), miniShift = view.getUint16(32, true);
30115
+ if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
30116
+ return reject();
30117
+ const sectorSize = 1 << shift, miniSize = 1 << miniShift;
30118
+ if (input.length % sectorSize !== 0)
30119
+ return reject();
30120
+ const sectorCount = input.length / sectorSize - 1;
30121
+ const offset = (id) => (id + 1) * sectorSize;
30122
+ const sector = (id) => {
30123
+ if (id > MAX || id >= sectorCount)
30124
+ throw new Error("Invalid sector");
30125
+ return input.subarray(offset(id), offset(id) + sectorSize);
30126
+ };
30127
+ const fatCount = read32(44), difatCount = read32(72), difatStart = read32(68);
30128
+ const fatIds = [];
30129
+ for (let i2 = 0; i2 < 109 && fatIds.length < fatCount; i2++) {
30130
+ const id = read32(76 + 4 * i2);
30131
+ if (id <= MAX)
30132
+ fatIds.push(id);
30133
+ }
30134
+ let difat = difatStart;
30135
+ const difatIds = /* @__PURE__ */ new Set();
30136
+ for (let i2 = 0; i2 < difatCount; i2++) {
30137
+ if (difatIds.has(difat) || difat > MAX)
30138
+ return reject();
30139
+ difatIds.add(difat);
30140
+ const bytes = sector(difat), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30141
+ for (let j = 0; j < (sectorSize - 4) / 4 && fatIds.length < fatCount; j++) {
30142
+ const id = dv.getUint32(j * 4, true);
30143
+ if (id <= MAX)
30144
+ fatIds.push(id);
30145
+ }
30146
+ difat = dv.getUint32(sectorSize - 4, true);
30147
+ }
30148
+ if (fatIds.length !== fatCount || new Set(fatIds).size !== fatIds.length || fatIds.some((id) => difatIds.has(id)))
30149
+ return reject();
30150
+ const fat = [];
30151
+ for (const id of fatIds) {
30152
+ const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30153
+ for (let j = 0; j < sectorSize / 4; j++)
30154
+ fat.push(dv.getUint32(j * 4, true));
30155
+ }
30156
+ const exactChain = (table2, start, bytes, unit2) => chain(table2, start, Math.ceil(bytes / unit2));
30157
+ const dirStart = read32(48), dirSectors = chainToEnd(fat, dirStart, sectorCount);
30158
+ const dirBytes = new Uint8Array(dirSectors.length * sectorSize);
30159
+ dirSectors.forEach((id, i2) => dirBytes.set(sector(id), i2 * sectorSize));
30160
+ const dvDir = new DataView(dirBytes.buffer);
30161
+ const entries2 = [];
30162
+ for (let p = 0, id = 0; p + SIZE <= dirBytes.length; p += SIZE, id++) {
30163
+ const type = dirBytes[p + 66];
30164
+ if (type === 0)
30165
+ continue;
30166
+ const nameLength = dvDir.getUint16(p + 64, true);
30167
+ if (nameLength < 2 || nameLength > 64 || nameLength % 2)
30168
+ return reject();
30169
+ let name = "";
30170
+ for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
30171
+ name += String.fromCharCode(dvDir.getUint16(p + i2, true));
30172
+ const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
30173
+ if (sizeHigh !== 0)
30174
+ return reject();
30175
+ entries2.push({
30176
+ id,
30177
+ name,
30178
+ type,
30179
+ left: dvDir.getUint32(p + 68, true),
30180
+ right: dvDir.getUint32(p + 72, true),
30181
+ child: dvDir.getUint32(p + 76, true),
30182
+ start: dvDir.getUint32(p + 116, true),
30183
+ size: sizeLow
30184
+ });
30185
+ }
30186
+ const byId = new Map(entries2.map((e) => [e.id, e]));
30187
+ const root = entries2.find((e) => e.type === 5);
30188
+ if (!root)
30189
+ return reject();
30190
+ let parent = root, target;
30191
+ for (let partIndex = 0; partIndex < path.length; partIndex++) {
30192
+ const matches2 = [], seen = /* @__PURE__ */ new Set();
30193
+ const visit = (id) => {
30194
+ if (id === NIL)
30195
+ return;
30196
+ if (seen.has(id))
30197
+ throw new Error("Cyclic directory tree");
30198
+ seen.add(id);
30199
+ const e = byId.get(id);
30200
+ if (!e)
30201
+ throw new Error("Invalid directory ID");
30202
+ visit(e.left);
30203
+ if (e.name.toLocaleLowerCase() === path[partIndex].toLocaleLowerCase())
30204
+ matches2.push(e);
30205
+ visit(e.right);
30206
+ };
30207
+ visit(parent.child);
30208
+ if (matches2.length !== 1)
30209
+ return reject();
30210
+ target = matches2[0];
30211
+ if (partIndex < path.length - 1) {
30212
+ if (target.type !== 1)
30213
+ return reject();
30214
+ parent = target;
30215
+ } else if (target.type !== 2 || replacement && replacement.length !== target.size)
30216
+ return reject();
30217
+ }
30218
+ if (!target)
30219
+ return reject();
30220
+ const names = entries2.map((e) => e.name.toLowerCase());
30221
+ if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
30222
+ return reject();
30223
+ for (const name of replacement ? ["book", "workbook"] : []) {
30224
+ if (!names.includes(name))
30225
+ continue;
30226
+ const workbook = readCompoundFileStream(input, [name]);
30227
+ if (!workbook)
30228
+ continue;
30229
+ for (let p = 0; p + 4 <= workbook.length; ) {
30230
+ const record2 = workbook[p] | workbook[p + 1] << 8;
30231
+ const length = workbook[p + 2] | workbook[p + 3] << 8;
30232
+ if (record2 === 47)
30233
+ return reject();
30234
+ if (p + 4 + length > workbook.length || record2 === 10)
30235
+ break;
30236
+ p += 4 + length;
30237
+ }
30238
+ }
30239
+ if (replacement && names.includes("worddocument")) {
30240
+ const word = readCompoundFileStream(input, ["WordDocument"]);
30241
+ if (word && word.length >= 12 && ((word[10] | word[11] << 8) & 256) !== 0)
30242
+ return reject();
30243
+ }
30244
+ const miniCutoff = read32(56), miniFatCount = read32(64), miniFatStart = read32(60);
30245
+ const miniFatSectors = miniFatCount ? chain(fat, miniFatStart, miniFatCount) : [];
30246
+ const metadataSectors = [...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors];
30247
+ if (new Set(metadataSectors).size !== metadataSectors.length)
30248
+ return reject();
30249
+ const miniFat = [];
30250
+ for (const id of miniFatSectors) {
30251
+ const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30252
+ for (let j = 0; j < sectorSize / 4; j++)
30253
+ miniFat.push(dv.getUint32(j * 4, true));
30254
+ }
30255
+ const reserved = /* @__PURE__ */ new Set([...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors]);
30256
+ const regularUsed = new Set(reserved);
30257
+ const rootMini = entries2.find((e) => e.type === 5);
30258
+ for (const entry5 of entries2) {
30259
+ if (entry5.type !== 2 && entry5.type !== 5 || entry5.size === 0)
30260
+ continue;
30261
+ if (entry5.type === 2 && entry5.size < miniCutoff)
30262
+ continue;
30263
+ for (const id of exactChain(fat, entry5.start, entry5.size, sectorSize)) {
30264
+ sector(id);
30265
+ if (regularUsed.has(id))
30266
+ return reject();
30267
+ regularUsed.add(id);
30268
+ }
30269
+ }
30270
+ const miniUsed = /* @__PURE__ */ new Set();
30271
+ for (const entry5 of entries2) {
30272
+ if (entry5.type !== 2 || entry5.size === 0 || entry5.size >= miniCutoff)
30273
+ continue;
30274
+ const ids = exactChain(miniFat, entry5.start, entry5.size, miniSize);
30275
+ for (const id of ids) {
30276
+ if (id * miniSize >= rootMini.size || miniUsed.has(id))
30277
+ return reject();
30278
+ miniUsed.add(id);
30279
+ }
30280
+ }
30281
+ if (!replacement) {
30282
+ if (target.size >= miniCutoff) {
30283
+ const ids2 = exactChain(fat, target.start, target.size, sectorSize);
30284
+ const result2 = new Uint8Array(ids2.length * sectorSize);
30285
+ ids2.forEach((id, i2) => result2.set(sector(id), i2 * sectorSize));
30286
+ return result2.slice(0, target.size);
30287
+ }
30288
+ const ids = exactChain(miniFat, target.start, target.size, miniSize);
30289
+ const rootSectors = exactChain(fat, rootMini.start, rootMini.size, sectorSize);
30290
+ const result = new Uint8Array(ids.length * miniSize);
30291
+ ids.forEach((id, i2) => {
30292
+ const start = id * miniSize;
30293
+ if (start + miniSize > rootMini.size)
30294
+ throw new Error("Mini stream out of bounds");
30295
+ const rootSector = rootSectors[Math.floor(start / sectorSize)];
30296
+ const source = sector(rootSector).subarray(start % sectorSize, start % sectorSize + miniSize);
30297
+ result.set(source, i2 * miniSize);
30298
+ });
30299
+ return result.slice(0, target.size);
30300
+ }
30301
+ const output = input.slice();
30302
+ if (target.size >= miniCutoff) {
30303
+ const sectors = exactChain(fat, target.start, target.size, sectorSize);
30304
+ sectors.forEach((id) => sector(id));
30305
+ for (let i2 = 0; i2 < sectors.length; i2++)
30306
+ output.set(replacement.subarray(i2 * sectorSize, Math.min((i2 + 1) * sectorSize, replacement.length)), offset(sectors[i2]));
30307
+ } else {
30308
+ if (!miniFat.length)
30309
+ return reject();
30310
+ const miniSectors = exactChain(miniFat, target.start, target.size, miniSize);
30311
+ const rootMini2 = entries2.find((e) => e.type === 5);
30312
+ const rootSectors = exactChain(fat, rootMini2.start, rootMini2.size, sectorSize);
30313
+ rootSectors.forEach((id) => sector(id));
30314
+ const rootData = new Uint8Array(rootMini2.size);
30315
+ rootSectors.forEach((id, i2) => rootData.set(sector(id).subarray(0, Math.min(sectorSize, rootData.length - i2 * sectorSize)), i2 * sectorSize));
30316
+ for (let i2 = 0; i2 < replacement.length; i2++) {
30317
+ const miniOffset = miniSectors[Math.floor(i2 / miniSize)] * miniSize + i2 % miniSize;
30318
+ if (miniOffset >= rootData.length)
30319
+ return reject();
30320
+ const rootSectorIndex = Math.floor(miniOffset / sectorSize);
30321
+ const rootSector = rootSectors[rootSectorIndex];
30322
+ if (rootSector === void 0)
30323
+ return reject();
30324
+ const physical = offset(rootSector) + miniOffset % sectorSize;
30325
+ output[physical] = replacement[i2];
30326
+ }
30327
+ }
30328
+ return output;
30329
+ } catch {
30330
+ return reject();
30331
+ }
30332
+ }
30333
+ function readCompoundFileStream(input, path) {
30334
+ return processCompoundFileStream(input, path);
30335
+ }
30336
+ function replaceCompoundFileStream(input, path, replacement) {
30337
+ return processCompoundFileStream(input, path, replacement) ?? input;
30338
+ }
30339
+ var END;
30340
+ var MAX;
30341
+ var NIL;
30342
+ var SIZE;
30343
+ var init_ole2_stream_edit = __esm({
30344
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js"() {
30345
+ END = 4294967294;
30346
+ MAX = 4294967290;
30347
+ NIL = 4294967295;
30348
+ SIZE = 128;
30349
+ }
30350
+ });
30068
30351
  function unwrapXlsBytes(bytes) {
30069
- if (!isOle2CompoundFile(bytes)) {
30352
+ if (!isCfb(bytes)) {
30070
30353
  return { workbookBytes: bytes };
30071
30354
  }
30072
30355
  try {
30073
- const buffer = bytes.buffer.slice(
30074
- bytes.byteOffset,
30075
- bytes.byteOffset + bytes.byteLength
30076
- );
30356
+ const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
30077
30357
  const ole = parseOle2(buffer);
30078
- const streamEntry = ole.entries.find(
30079
- (e) => e.type === ENTRY_TYPE_STREAM && WORKBOOK_STREAM_NAMES.includes(e.name)
30080
- );
30081
- const workbookBytes = streamEntry ? ole.getStream(streamEntry.name) : void 0;
30082
- if (!streamEntry || !workbookBytes) {
30358
+ const workbookEntries = ole.entries.filter((e) => e.type === ENTRY_TYPE_STREAM && WORKBOOK_STREAM_NAMES.includes(e.name.toLowerCase()));
30359
+ const rootWorkbooks = WORKBOOK_STREAM_NAMES.map((name) => ({
30360
+ name,
30361
+ data: readCompoundFileStream(bytes, [name])
30362
+ })).filter((item3) => item3.data !== void 0);
30363
+ if (rootWorkbooks.length !== 1)
30364
+ return { workbookBytes: bytes };
30365
+ const rootWorkbook = rootWorkbooks[0];
30366
+ const streamEntry = rootWorkbook ? workbookEntries.find((entry5) => entry5.name.toLowerCase() === rootWorkbook.name) : void 0;
30367
+ const workbookBytes = rootWorkbook?.data;
30368
+ if (!rootWorkbook || !streamEntry || !workbookBytes) {
30083
30369
  return { workbookBytes: bytes };
30084
30370
  }
30085
30371
  const rootClsid = ole.entries.find((e) => e.type === ENTRY_TYPE_ROOT)?.clsid;
30372
+ const originalBytes = bytes;
30373
+ const canRebuild = hasFlatUniqueStreamLayout(ole.entries, workbookEntries.length);
30086
30374
  return {
30087
30375
  workbookBytes,
30088
30376
  rewrap: (editedWorkbookBytes) => {
30377
+ if (equalBytes(editedWorkbookBytes, workbookBytes))
30378
+ return originalBytes;
30379
+ if (editedWorkbookBytes.length === workbookBytes.length) {
30380
+ return replaceCompoundFileStream(originalBytes, [streamEntry.name], editedWorkbookBytes);
30381
+ }
30382
+ if (!canRebuild)
30383
+ return originalBytes;
30089
30384
  const streams = /* @__PURE__ */ new Map();
30090
30385
  for (const entry5 of ole.entries) {
30091
30386
  if (entry5.type !== ENTRY_TYPE_STREAM) {
30092
30387
  continue;
30093
30388
  }
30094
- const data = entry5.name === streamEntry.name ? editedWorkbookBytes : ole.getStream(entry5.name);
30389
+ const data = entry5.name.toLowerCase() === streamEntry.name.toLowerCase() ? editedWorkbookBytes : ole.getStream(entry5.name);
30095
30390
  if (data) {
30096
30391
  streams.set(entry5.name, data);
30097
30392
  }
@@ -30103,14 +30398,28 @@ function unwrapXlsBytes(bytes) {
30103
30398
  return { workbookBytes: bytes };
30104
30399
  }
30105
30400
  }
30401
+ function hasFlatUniqueStreamLayout(entries2, workbookCount) {
30402
+ const rootEntries = entries2.filter((entry5) => entry5.type === ENTRY_TYPE_ROOT);
30403
+ const streamEntries = entries2.filter((entry5) => entry5.type === ENTRY_TYPE_STREAM);
30404
+ if (rootEntries.length !== 1 || workbookCount !== 1 || entries2.length !== rootEntries.length + streamEntries.length)
30405
+ return false;
30406
+ const names = streamEntries.map((entry5) => entry5.name.toLowerCase());
30407
+ return new Set(names).size === names.length;
30408
+ }
30409
+ function equalBytes(left, right) {
30410
+ return left.length === right.length && left.every((value, index) => value === right[index]);
30411
+ }
30412
+ function isCfb(bytes) {
30413
+ return OLE_MAGIC.every((value, index) => bytes[index] === value);
30414
+ }
30106
30415
  var WORKBOOK_STREAM_NAMES;
30107
- var init_ole_sheet_xls_cfb = __esm({
30108
- "src/core/utils/ole-sheet-xls-cfb.ts"() {
30109
- init_ole_embedded_extract();
30416
+ var init_legacy_excel_cfb = __esm({
30417
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js"() {
30110
30418
  init_ole2_parser_read();
30111
30419
  init_ole2_parser_types();
30112
30420
  init_ole2_parser_write();
30113
- WORKBOOK_STREAM_NAMES = ["Workbook", "Book"];
30421
+ init_ole2_stream_edit();
30422
+ WORKBOOK_STREAM_NAMES = ["workbook", "book"];
30114
30423
  }
30115
30424
  });
30116
30425
  function readRecords(bytes, start, end) {
@@ -30149,6 +30458,17 @@ function findAllWorksheetRanges(bytes) {
30149
30458
  }
30150
30459
  return ranges;
30151
30460
  }
30461
+ function isSupportedBiff8Workbook(bytes) {
30462
+ const records = readRecords(bytes, 0, bytes.length);
30463
+ const bof = records[0];
30464
+ if (!bof || bof.opcode !== OPCODE_BOF || bof.length < 4)
30465
+ return false;
30466
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30467
+ if (view.getUint16(bof.dataOffset, true) !== 1536 || view.getUint16(bof.dataOffset + 2, true) !== 5)
30468
+ return false;
30469
+ const globalsEnd = records.find((record2) => record2.opcode === OPCODE_EOF)?.headerOffset ?? bytes.length;
30470
+ return !records.some((record2) => record2.opcode === OPCODE_FILEPASS && record2.headerOffset < globalsEnd);
30471
+ }
30152
30472
  function findFirstWorksheetRange(bytes) {
30153
30473
  return findAllWorksheetRanges(bytes)[0];
30154
30474
  }
@@ -30199,6 +30519,8 @@ function parseSstSingleRecord(bytes) {
30199
30519
  }
30200
30520
  function readOleXlsGrid(inputBytes, maxRows = DEFAULT_MAX_ROWS2, maxCols = DEFAULT_MAX_COLS2) {
30201
30521
  const xlsBytes = unwrapXlsBytes(inputBytes).workbookBytes;
30522
+ if (!isSupportedBiff8Workbook(xlsBytes))
30523
+ return void 0;
30202
30524
  const range = findFirstWorksheetRange(xlsBytes);
30203
30525
  if (!range) {
30204
30526
  return void 0;
@@ -30273,6 +30595,8 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
30273
30595
  return inputBytes;
30274
30596
  }
30275
30597
  const { workbookBytes: xlsBytes, rewrap } = unwrapXlsBytes(inputBytes);
30598
+ if (!isSupportedBiff8Workbook(xlsBytes))
30599
+ return inputBytes;
30276
30600
  const range = findFirstWorksheetRange(xlsBytes);
30277
30601
  if (!range) {
30278
30602
  return inputBytes;
@@ -30301,6 +30625,7 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
30301
30625
  }
30302
30626
  var OPCODE_BOF;
30303
30627
  var OPCODE_EOF;
30628
+ var OPCODE_FILEPASS;
30304
30629
  var OPCODE_NUMBER;
30305
30630
  var OPCODE_RK;
30306
30631
  var OPCODE_LABELSST;
@@ -30315,11 +30640,12 @@ var OPCODE_BOUNDSHEET;
30315
30640
  var WORKSHEET_DT;
30316
30641
  var DEFAULT_MAX_ROWS2;
30317
30642
  var DEFAULT_MAX_COLS2;
30318
- var init_ole_sheet_xls_biff8 = __esm({
30319
- "src/core/utils/ole-sheet-xls-biff8.ts"() {
30320
- init_ole_sheet_xls_cfb();
30643
+ var init_legacy_excel_biff8 = __esm({
30644
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js"() {
30645
+ init_legacy_excel_cfb();
30321
30646
  OPCODE_BOF = 2057;
30322
30647
  OPCODE_EOF = 10;
30648
+ OPCODE_FILEPASS = 47;
30323
30649
  OPCODE_NUMBER = 515;
30324
30650
  OPCODE_RK = 638;
30325
30651
  OPCODE_LABELSST = 253;
@@ -30336,6 +30662,11 @@ var init_ole_sheet_xls_biff8 = __esm({
30336
30662
  DEFAULT_MAX_COLS2 = 26;
30337
30663
  }
30338
30664
  });
30665
+ var init_ole_sheet_xls_biff8 = __esm({
30666
+ "src/core/utils/ole-sheet-xls-biff8.ts"() {
30667
+ init_legacy_excel_biff8();
30668
+ }
30669
+ });
30339
30670
  function biffRecord(opcode, data) {
30340
30671
  return [
30341
30672
  opcode & 255,
@@ -30362,9 +30693,7 @@ function parseXlsGrid(bytes, range) {
30362
30693
  for (const rec of readRecords(bytes, range.start, range.end)) {
30363
30694
  if (rec.opcode === OPCODE_ROW && rec.length >= 16) {
30364
30695
  const rw = view.getUint16(rec.dataOffset, true);
30365
- rowFor(rw).extraRowBytes = Array.from(
30366
- bytes.subarray(rec.dataOffset + 6, rec.dataOffset + 16)
30367
- );
30696
+ rowFor(rw).extraRowBytes = Array.from(bytes.subarray(rec.dataOffset + 6, rec.dataOffset + 16));
30368
30697
  continue;
30369
30698
  }
30370
30699
  if (rec.length < 6) {
@@ -30411,9 +30740,7 @@ function buildXlsRowCellRegion(grid) {
30411
30740
  const colLast = cols.length > 0 ? cols[cols.length - 1] + 1 : 0;
30412
30741
  rowRecordOffsets.push(bytesOut.length);
30413
30742
  const extra = row.extraRowBytes ?? [255, 0, 0, 0, 0, 1, 15, 0];
30414
- bytesOut.push(
30415
- ...biffRecord(OPCODE_ROW, [...u16le(r), ...u16le(colFirst), ...u16le(colLast), ...extra])
30416
- );
30743
+ bytesOut.push(...biffRecord(OPCODE_ROW, [...u16le(r), ...u16le(colFirst), ...u16le(colLast), ...extra]));
30417
30744
  }
30418
30745
  for (const r of rows) {
30419
30746
  const row = grid.get(r);
@@ -30422,27 +30749,23 @@ function buildXlsRowCellRegion(grid) {
30422
30749
  for (const c of cols) {
30423
30750
  const cell = row.cells.get(c);
30424
30751
  if (cell.kind === "sst") {
30425
- bytesOut.push(
30426
- ...biffRecord(OPCODE_LABELSST, [
30427
- ...u16le(r),
30428
- ...u16le(c),
30429
- ...u16le(cell.ixfe),
30430
- ...u16le(cell.value),
30431
- 0,
30432
- 0
30433
- ])
30434
- );
30752
+ bytesOut.push(...biffRecord(OPCODE_LABELSST, [
30753
+ ...u16le(r),
30754
+ ...u16le(c),
30755
+ ...u16le(cell.ixfe),
30756
+ ...u16le(cell.value),
30757
+ 0,
30758
+ 0
30759
+ ]));
30435
30760
  } else if (cell.kind === "number") {
30436
30761
  const buffer = new ArrayBuffer(8);
30437
30762
  new DataView(buffer).setFloat64(0, cell.value, true);
30438
- bytesOut.push(
30439
- ...biffRecord(OPCODE_NUMBER, [
30440
- ...u16le(r),
30441
- ...u16le(c),
30442
- ...u16le(cell.ixfe),
30443
- ...Array.from(new Uint8Array(buffer))
30444
- ])
30445
- );
30763
+ bytesOut.push(...biffRecord(OPCODE_NUMBER, [
30764
+ ...u16le(r),
30765
+ ...u16le(c),
30766
+ ...u16le(cell.ixfe),
30767
+ ...Array.from(new Uint8Array(buffer))
30768
+ ]));
30446
30769
  } else {
30447
30770
  bytesOut.push(...biffRecord(OPCODE_BLANK, [...u16le(r), ...u16le(c), ...u16le(cell.ixfe)]));
30448
30771
  }
@@ -30463,9 +30786,9 @@ function buildXlsRowCellRegion(grid) {
30463
30786
  }
30464
30787
  return Uint8Array.from(bytesOut);
30465
30788
  }
30466
- var init_ole_sheet_xls_biff8_grid = __esm({
30467
- "src/core/utils/ole-sheet-xls-biff8-grid.ts"() {
30468
- init_ole_sheet_xls_biff8();
30789
+ var init_legacy_excel_biff8_grid = __esm({
30790
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js"() {
30791
+ init_legacy_excel_biff8();
30469
30792
  }
30470
30793
  });
30471
30794
  function resolveSstIndex(sharedStrings, value) {
@@ -30532,6 +30855,8 @@ function patchBoundsheetOffsets(bytes, delta) {
30532
30855
  function writeOleXlsStringCellEdit(inputBytes, edit) {
30533
30856
  try {
30534
30857
  const { workbookBytes: xlsBytes, rewrap } = unwrapXlsBytes(inputBytes);
30858
+ if (!isSupportedBiff8Workbook(xlsBytes))
30859
+ return inputBytes;
30535
30860
  const finish2 = (result) => rewrap ? rewrap(result) : result;
30536
30861
  const ranges = findAllWorksheetRanges(xlsBytes);
30537
30862
  const target = ranges[0];
@@ -30571,9 +30896,7 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
30571
30896
  const patchedXlsBytes = patchBoundsheetOffsets(xlsBytes, newSstSpanLength - oldSstSpanLength);
30572
30897
  const out = [
30573
30898
  ...patchedXlsBytes.subarray(0, sstRecord.headerOffset),
30574
- ...newSstRecord ?? Array.from(
30575
- patchedXlsBytes.subarray(sstRecord.headerOffset, sstRecord.dataOffset + sstRecord.length)
30576
- ),
30899
+ ...newSstRecord ?? Array.from(patchedXlsBytes.subarray(sstRecord.headerOffset, sstRecord.dataOffset + sstRecord.length)),
30577
30900
  // EXTSST is dropped; Excel recomputes it on open.
30578
30901
  ...patchedXlsBytes.subarray(sstEnd, region.start),
30579
30902
  ...newRegion,
@@ -30584,11 +30907,16 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
30584
30907
  return inputBytes;
30585
30908
  }
30586
30909
  }
30910
+ var init_legacy_excel_biff8_writer = __esm({
30911
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js"() {
30912
+ init_legacy_excel_biff8();
30913
+ init_legacy_excel_biff8_grid();
30914
+ init_legacy_excel_cfb();
30915
+ }
30916
+ });
30587
30917
  var init_ole_sheet_xls_biff8_writer = __esm({
30588
30918
  "src/core/utils/ole-sheet-xls-biff8-writer.ts"() {
30589
- init_ole_sheet_xls_biff8();
30590
- init_ole_sheet_xls_biff8_grid();
30591
- init_ole_sheet_xls_cfb();
30919
+ init_legacy_excel_biff8_writer();
30592
30920
  }
30593
30921
  });
30594
30922
  function createWordXmlParser() {
@@ -30746,7 +31074,7 @@ function patchDocFib(wordDoc, fib, patch) {
30746
31074
  var FC_LCB_INDEX;
30747
31075
  var F_COMPLEX_BIT;
30748
31076
  var init_ole_document_doc_fib = __esm({
30749
- "src/core/utils/ole-document-doc-fib.ts"() {
31077
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js"() {
30750
31078
  FC_LCB_INDEX = {
30751
31079
  plcfbteChpx: 12,
30752
31080
  plcfbtePapx: 13,
@@ -30757,14 +31085,11 @@ var init_ole_document_doc_fib = __esm({
30757
31085
  }
30758
31086
  });
30759
31087
  function unwrapDocBytes(bytes) {
30760
- if (!isOle2CompoundFile(bytes)) {
31088
+ if (bytes.length < 8 || bytes[0] !== 208 || bytes[1] !== 207 || bytes[2] !== 17 || bytes[3] !== 224 || bytes[4] !== 161 || bytes[5] !== 177 || bytes[6] !== 26 || bytes[7] !== 225) {
30761
31089
  return void 0;
30762
31090
  }
30763
31091
  try {
30764
- const buffer = bytes.buffer.slice(
30765
- bytes.byteOffset,
30766
- bytes.byteOffset + bytes.byteLength
30767
- );
31092
+ const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
30768
31093
  const ole = parseOle2(buffer);
30769
31094
  const wordDocBytes = ole.getStream("WordDocument");
30770
31095
  if (!wordDocBytes) {
@@ -30799,9 +31124,8 @@ function unwrapDocBytes(bytes) {
30799
31124
  }
30800
31125
  }
30801
31126
  var init_ole_document_doc_cfb = __esm({
30802
- "src/core/utils/ole-document-doc-cfb.ts"() {
31127
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js"() {
30803
31128
  init_ole_document_doc_fib();
30804
- init_ole_embedded_extract();
30805
31129
  init_ole2_parser_read();
30806
31130
  init_ole2_parser_types();
30807
31131
  init_ole2_parser_write();
@@ -30914,7 +31238,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
30914
31238
  }
30915
31239
  var PAGE_SIZE;
30916
31240
  var init_ole_document_doc_fkp = __esm({
30917
- "src/core/utils/ole-document-doc-fkp.ts"() {
31241
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js"() {
30918
31242
  PAGE_SIZE = 512;
30919
31243
  }
30920
31244
  });
@@ -30952,7 +31276,7 @@ function encodeCp1252(text22) {
30952
31276
  var CP1252_HIGH_BLOCK;
30953
31277
  var CP1252_HIGH_BLOCK_REVERSE;
30954
31278
  var init_ole_document_doc_cp1252 = __esm({
30955
- "src/core/utils/ole-document-doc-cp1252.ts"() {
31279
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js"() {
30956
31280
  CP1252_HIGH_BLOCK = [
30957
31281
  8364,
30958
31282
  129,
@@ -30987,9 +31311,7 @@ var init_ole_document_doc_cp1252 = __esm({
30987
31311
  382,
30988
31312
  376
30989
31313
  ];
30990
- CP1252_HIGH_BLOCK_REVERSE = new Map(
30991
- CP1252_HIGH_BLOCK.map((codePoint, i2) => [codePoint, 128 + i2])
30992
- );
31314
+ CP1252_HIGH_BLOCK_REVERSE = new Map(CP1252_HIGH_BLOCK.map((codePoint, i2) => [codePoint, 128 + i2]));
30993
31315
  }
30994
31316
  });
30995
31317
  function parsePieceTable(tableStream, clx) {
@@ -31153,7 +31475,7 @@ function buildClxBytes(pieces) {
31153
31475
  var CLXT_PRC;
31154
31476
  var CLXT_PCDT;
31155
31477
  var init_ole_document_doc_pieces = __esm({
31156
- "src/core/utils/ole-document-doc-pieces.ts"() {
31478
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js"() {
31157
31479
  init_ole_document_doc_cp1252();
31158
31480
  CLXT_PRC = 1;
31159
31481
  CLXT_PCDT = 2;
@@ -31286,9 +31608,7 @@ function writeOleDocParagraphEdit(docBytes, paragraphIndex, text22) {
31286
31608
  const clxBytes = buildClxBytes(newPieces);
31287
31609
  const papxBteBytes = buildBteTableBytes(newPapxBte);
31288
31610
  const chpxBteBytes = buildBteTableBytes(newChpxBte);
31289
- const newTableBytes = new Uint8Array(
31290
- cfb.tableBytes.length + clxBytes.length + papxBteBytes.length + chpxBteBytes.length
31291
- );
31611
+ const newTableBytes = new Uint8Array(cfb.tableBytes.length + clxBytes.length + papxBteBytes.length + chpxBteBytes.length);
31292
31612
  newTableBytes.set(cfb.tableBytes, 0);
31293
31613
  let tableOff = cfb.tableBytes.length;
31294
31614
  const newClx = { fc: tableOff, lcb: clxBytes.length };
@@ -31315,7 +31635,7 @@ function writeOleDocParagraphEdit(docBytes, paragraphIndex, text22) {
31315
31635
  var RISKY_PLCF_INDICES;
31316
31636
  var RISKY_STTB_INDICES;
31317
31637
  var init_ole_document_doc_editor = __esm({
31318
- "src/core/utils/ole-document-doc-editor.ts"() {
31638
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js"() {
31319
31639
  init_ole_document_doc_cfb();
31320
31640
  init_ole_document_doc_fib();
31321
31641
  init_ole_document_doc_fkp();
@@ -31324,6 +31644,11 @@ var init_ole_document_doc_editor = __esm({
31324
31644
  RISKY_STTB_INDICES = [21, 22, 23];
31325
31645
  }
31326
31646
  });
31647
+ var init_ole_document_doc_editor2 = __esm({
31648
+ "src/core/utils/ole-document-doc-editor.ts"() {
31649
+ init_ole_document_doc_editor();
31650
+ }
31651
+ });
31327
31652
  function isTextBearingElement(el) {
31328
31653
  return el.type === "text" || el.type === "shape";
31329
31654
  }
@@ -31473,9 +31798,7 @@ function buildChunk(type, data) {
31473
31798
  }
31474
31799
  function encodePng(width, height, rgba) {
31475
31800
  if (rgba.length !== width * height * 4) {
31476
- throw new Error(
31477
- `encodePng: rgba length ${rgba.length} does not match ${width}x${height}x4 = ${width * height * 4}`
31478
- );
31801
+ throw new Error(`encodePng: rgba length ${rgba.length} does not match ${width}x${height}x4 = ${width * height * 4}`);
31479
31802
  }
31480
31803
  const ihdr = new Uint8Array(13);
31481
31804
  const ihdrView = new DataView(ihdr.buffer);
@@ -31503,7 +31826,7 @@ function encodePng(width, height, rgba) {
31503
31826
  var CRC_TABLE;
31504
31827
  var PNG_SIGNATURE;
31505
31828
  var init_png_encoder = __esm({
31506
- "src/core/utils/png-encoder.ts"() {
31829
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
31507
31830
  CRC_TABLE = (() => {
31508
31831
  const table2 = new Uint32Array(256);
31509
31832
  for (let n = 0; n < 256; n++) {
@@ -31518,6 +31841,11 @@ var init_png_encoder = __esm({
31518
31841
  PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
31519
31842
  }
31520
31843
  });
31844
+ var init_png_encoder2 = __esm({
31845
+ "src/core/utils/png-encoder.ts"() {
31846
+ init_png_encoder();
31847
+ }
31848
+ });
31521
31849
  function rgb(r, g2, b, a = 255) {
31522
31850
  return { r, g: g2, b, a };
31523
31851
  }
@@ -31738,7 +32066,7 @@ var WHITE;
31738
32066
  var CAPTION_COLOR;
31739
32067
  var init_ole_icon_raster = __esm({
31740
32068
  "src/core/utils/ole-icon-raster.ts"() {
31741
- init_png_encoder();
32069
+ init_png_encoder2();
31742
32070
  init_raster_canvas();
31743
32071
  GLYPH_COLORS = {
31744
32072
  excel: rgb(33, 115, 70),
@@ -31829,7 +32157,7 @@ var MAX_ROWS;
31829
32157
  var MAX_COLS;
31830
32158
  var init_ole_content_preview_raster = __esm({
31831
32159
  "src/core/utils/ole-content-preview-raster.ts"() {
31832
- init_png_encoder();
32160
+ init_png_encoder2();
31833
32161
  init_raster_canvas();
31834
32162
  BORDER = rgb(192, 192, 192);
31835
32163
  TEXT = rgb(32, 32, 32);
@@ -31888,7 +32216,7 @@ async function commitPayload(element, kind, newPayload) {
31888
32216
  var init_ole_edit_commit = __esm({
31889
32217
  "src/core/utils/ole-edit-commit.ts"() {
31890
32218
  init_ole_content_preview_raster();
31891
- init_ole_document_doc_editor();
32219
+ init_ole_document_doc_editor2();
31892
32220
  init_ole_document_docx_editor();
31893
32221
  init_ole_embedded_extract();
31894
32222
  init_ole_icon_raster();
@@ -32012,7 +32340,7 @@ async function replaceOleFile(element, fileBytes, fileName) {
32012
32340
  var init_ole_edit_api = __esm({
32013
32341
  "src/core/utils/ole-edit-api.ts"() {
32014
32342
  init_data_url_utils();
32015
- init_ole_document_doc_editor();
32343
+ init_ole_document_doc_editor2();
32016
32344
  init_ole_document_docx_editor();
32017
32345
  init_ole_edit_commit();
32018
32346
  init_ole_embedded_extract();
@@ -43646,8 +43974,8 @@ function isCrossRoleReference(constraint) {
43646
43974
  return (constraint.referenceFor === "ch" || constraint.referenceFor === "des") && Boolean(constraint.referenceForName);
43647
43975
  }
43648
43976
  function dimDeclaredBy(role, type, declaringRole, box, index) {
43649
- const chain = typeof declaringRole === "string" ? [declaringRole] : declaringRole;
43650
- for (const candidateRole of chain) {
43977
+ const chain2 = typeof declaringRole === "string" ? [declaringRole] : declaringRole;
43978
+ for (const candidateRole of chain2) {
43651
43979
  const declared = firstConstraintDeclaredBy(index, role, type, candidateRole);
43652
43980
  if (!declared) {
43653
43981
  continue;
@@ -49903,9 +50231,9 @@ var init_encryption_detection = __esm({
49903
50231
  });
49904
50232
  var init_ole2_parser = __esm({
49905
50233
  "src/core/utils/ole2-parser.ts"() {
49906
- init_ole2_parser_types();
49907
- init_ole2_parser_read();
49908
- init_ole2_parser_write();
50234
+ init_ole2_parser_types2();
50235
+ init_ole2_parser_read2();
50236
+ init_ole2_parser_write2();
49909
50237
  }
49910
50238
  });
49911
50239
  var IncorrectPasswordError;
@@ -49930,9 +50258,7 @@ function getSubtle() {
49930
50258
  if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
49931
50259
  return globalThis.crypto.subtle;
49932
50260
  }
49933
- throw new Error(
49934
- "Web Crypto API (crypto.subtle) is not available in this environment. Password-protected PPTX files require a runtime with Web Crypto support."
49935
- );
50261
+ throw new Error("Web Crypto API (crypto.subtle) is not available in this environment. Password-protected PPTX files require a runtime with Web Crypto support.");
49936
50262
  }
49937
50263
  function getCrypto() {
49938
50264
  if (typeof globalThis.crypto !== "undefined") {
@@ -49969,10 +50295,6 @@ function uint32LE(value) {
49969
50295
  return buf;
49970
50296
  }
49971
50297
  function base64Decode(str) {
49972
- if (typeof Buffer !== "undefined") {
49973
- const buf = Buffer.from(str, "base64");
49974
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
49975
- }
49976
50298
  const binary = atob(str);
49977
50299
  const bytes = new Uint8Array(binary.length);
49978
50300
  for (let i2 = 0; i2 < binary.length; i2++) {
@@ -49981,9 +50303,6 @@ function base64Decode(str) {
49981
50303
  return bytes;
49982
50304
  }
49983
50305
  function base64Encode(bytes) {
49984
- if (typeof Buffer !== "undefined") {
49985
- return Buffer.from(bytes).toString("base64");
49986
- }
49987
50306
  let binary = "";
49988
50307
  for (let i2 = 0; i2 < bytes.length; i2++) {
49989
50308
  binary += String.fromCharCode(bytes[i2]);
@@ -50022,30 +50341,16 @@ async function aesCbcDecryptRaw(key2, iv, data) {
50022
50341
  if (data.length === 0) {
50023
50342
  return new Uint8Array(0);
50024
50343
  }
50025
- const cryptoKey = await subtle.importKey(
50026
- "raw",
50027
- key2,
50028
- { name: "AES-CBC" },
50029
- false,
50030
- ["encrypt", "decrypt"]
50031
- );
50344
+ const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, ["encrypt", "decrypt"]);
50032
50345
  const lastCiphertextBlock = data.subarray(data.length - blockSize);
50033
50346
  const paddingPlaintext = new Uint8Array(blockSize);
50034
50347
  paddingPlaintext.fill(blockSize);
50035
- const encryptedPadding = await subtle.encrypt(
50036
- { name: "AES-CBC", iv: lastCiphertextBlock },
50037
- cryptoKey,
50038
- paddingPlaintext
50039
- );
50348
+ const encryptedPadding = await subtle.encrypt({ name: "AES-CBC", iv: lastCiphertextBlock }, cryptoKey, paddingPlaintext);
50040
50349
  const encPadBlock = new Uint8Array(encryptedPadding).subarray(0, blockSize);
50041
50350
  const paddedData = new Uint8Array(data.length + blockSize);
50042
50351
  paddedData.set(data);
50043
50352
  paddedData.set(encPadBlock, data.length);
50044
- const result = await subtle.decrypt(
50045
- { name: "AES-CBC", iv },
50046
- cryptoKey,
50047
- paddedData
50048
- );
50353
+ const result = await subtle.decrypt({ name: "AES-CBC", iv }, cryptoKey, paddedData);
50049
50354
  return new Uint8Array(result).subarray(0, data.length);
50050
50355
  }
50051
50356
  async function aesCbcEncryptNoPad(key2, iv, data) {
@@ -50054,35 +50359,24 @@ async function aesCbcEncryptNoPad(key2, iv, data) {
50054
50359
  throw new Error("Data must be block-aligned for no-padding encryption");
50055
50360
  }
50056
50361
  const subtle = getSubtle();
50057
- const cryptoKey = await subtle.importKey(
50058
- "raw",
50059
- key2,
50060
- { name: "AES-CBC" },
50061
- false,
50062
- ["encrypt"]
50063
- );
50064
- const result = await subtle.encrypt(
50065
- { name: "AES-CBC", iv },
50066
- cryptoKey,
50067
- data
50068
- );
50362
+ const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, ["encrypt"]);
50363
+ const result = await subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, data);
50069
50364
  return new Uint8Array(result).subarray(0, data.length);
50070
50365
  }
50071
50366
  async function hmac(algorithm, key2, data) {
50072
50367
  const subtle = getSubtle();
50073
50368
  const webCryptoAlg = mapHashAlgorithm(algorithm);
50074
- const cryptoKey = await subtle.importKey(
50075
- "raw",
50076
- key2,
50077
- { name: "HMAC", hash: webCryptoAlg },
50078
- false,
50079
- ["sign"]
50080
- );
50369
+ const cryptoKey = await subtle.importKey("raw", key2, { name: "HMAC", hash: webCryptoAlg }, false, ["sign"]);
50081
50370
  const result = await subtle.sign("HMAC", cryptoKey, data);
50082
50371
  return new Uint8Array(result);
50083
50372
  }
50084
50373
  var init_ooxml_crypto_primitives = __esm({
50374
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
50375
+ }
50376
+ });
50377
+ var init_ooxml_crypto_primitives2 = __esm({
50085
50378
  "src/core/utils/ooxml-crypto-primitives.ts"() {
50379
+ init_ooxml_crypto_primitives();
50086
50380
  }
50087
50381
  });
50088
50382
  async function deriveAgileKey(password, salt, spinCount, hashAlgorithm, blockKey, keyBits, hashSize) {
@@ -50307,7 +50601,7 @@ var BLOCK_KEYS;
50307
50601
  var RC4_ALG_ID;
50308
50602
  var init_ooxml_crypto_key_derivation = __esm({
50309
50603
  "src/core/utils/ooxml-crypto-key-derivation.ts"() {
50310
- init_ooxml_crypto_primitives();
50604
+ init_ooxml_crypto_primitives2();
50311
50605
  BLOCK_KEYS = {
50312
50606
  verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
50313
50607
  verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
@@ -50480,7 +50774,7 @@ var init_ooxml_crypto_decrypt = __esm({
50480
50774
  "src/core/utils/ooxml-crypto-decrypt.ts"() {
50481
50775
  init_ooxml_crypto_errors();
50482
50776
  init_ooxml_crypto_key_derivation();
50483
- init_ooxml_crypto_primitives();
50777
+ init_ooxml_crypto_primitives2();
50484
50778
  }
50485
50779
  });
50486
50780
  async function encryptAgilePackage(packageData, key2, info) {
@@ -50618,7 +50912,7 @@ var init_ooxml_crypto_encrypt = __esm({
50618
50912
  "src/core/utils/ooxml-crypto-encrypt.ts"() {
50619
50913
  init_ole2_parser();
50620
50914
  init_ooxml_crypto_key_derivation();
50621
- init_ooxml_crypto_primitives();
50915
+ init_ooxml_crypto_primitives2();
50622
50916
  STANDARD_ALG_IDS = {
50623
50917
  128: 26126,
50624
50918
  // CALG_AES_128
@@ -50803,7 +51097,7 @@ var init_ooxml_crypto = __esm({
50803
51097
  init_ooxml_crypto_encrypt();
50804
51098
  init_ooxml_crypto_errors();
50805
51099
  init_ooxml_crypto_key_derivation();
50806
- init_ooxml_crypto_primitives();
51100
+ init_ooxml_crypto_primitives2();
50807
51101
  init_ooxml_crypto_errors();
50808
51102
  }
50809
51103
  });
@@ -51192,7 +51486,7 @@ function mdStyleDigest(message, initialState, transform6) {
51192
51486
  return out;
51193
51487
  }
51194
51488
  var init_bit_ops = __esm({
51195
- "src/core/utils/digests/bit-ops.ts"() {
51489
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
51196
51490
  }
51197
51491
  });
51198
51492
  function f1(x, y, z) {
@@ -51223,7 +51517,7 @@ var ROUND1;
51223
51517
  var ROUND2;
51224
51518
  var ROUND3;
51225
51519
  var init_md4 = __esm({
51226
- "src/core/utils/digests/md4.ts"() {
51520
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
51227
51521
  init_bit_ops();
51228
51522
  INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
51229
51523
  K2 = 1518500249;
@@ -51284,6 +51578,16 @@ var init_md4 = __esm({
51284
51578
  ];
51285
51579
  }
51286
51580
  });
51581
+ var init_md42 = __esm({
51582
+ "src/core/utils/digests/md4.ts"() {
51583
+ init_md4();
51584
+ }
51585
+ });
51586
+ var init_bit_ops2 = __esm({
51587
+ "src/core/utils/digests/bit-ops.ts"() {
51588
+ init_bit_ops();
51589
+ }
51590
+ });
51287
51591
  function f(x, y, z) {
51288
51592
  return x & y | ~x & z;
51289
51593
  }
@@ -51324,7 +51628,7 @@ var ROUND_FNS;
51324
51628
  var ROUNDS;
51325
51629
  var init_md5 = __esm({
51326
51630
  "src/core/utils/digests/md5.ts"() {
51327
- init_bit_ops();
51631
+ init_bit_ops2();
51328
51632
  INITIAL_STATE2 = [1732584193, 4023233417, 2562383102, 271733878];
51329
51633
  T = Array.from(
51330
51634
  { length: 64 },
@@ -51393,7 +51697,7 @@ var LEFT_FNS;
51393
51697
  var RIGHT_FNS;
51394
51698
  var init_ripemd128 = __esm({
51395
51699
  "src/core/utils/digests/ripemd128.ts"() {
51396
- init_bit_ops();
51700
+ init_bit_ops2();
51397
51701
  init_ripemd_functions();
51398
51702
  INITIAL_STATE3 = [1732584193, 4023233417, 2562383102, 271733878];
51399
51703
  LEFT_ROUNDS = [
@@ -51596,7 +51900,7 @@ var LEFT_FNS2;
51596
51900
  var RIGHT_FNS2;
51597
51901
  var init_ripemd160 = __esm({
51598
51902
  "src/core/utils/digests/ripemd160.ts"() {
51599
- init_bit_ops();
51903
+ init_bit_ops2();
51600
51904
  init_ripemd_functions();
51601
51905
  INITIAL_STATE4 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
51602
51906
  LEFT_ROUNDS2 = [
@@ -52173,7 +52477,7 @@ var init_digest = __esm({
52173
52477
  "src/core/utils/digests/digest.ts"() {
52174
52478
  init_algorithm_names();
52175
52479
  init_md2();
52176
- init_md4();
52480
+ init_md42();
52177
52481
  init_md5();
52178
52482
  init_ripemd128();
52179
52483
  init_ripemd160();
@@ -52193,7 +52497,7 @@ var init_digests = __esm({
52193
52497
  init_algorithm_names();
52194
52498
  init_digest();
52195
52499
  init_md2();
52196
- init_md4();
52500
+ init_md42();
52197
52501
  init_md5();
52198
52502
  init_ripemd128();
52199
52503
  init_ripemd160();
@@ -59095,15 +59399,15 @@ function buildLinkedTextBoxChains(elements2) {
59095
59399
  }
59096
59400
  const chainId = el.linkedTxbxId;
59097
59401
  const seq = el.linkedTxbxSeq ?? 0;
59098
- let chain = chains.get(chainId);
59099
- if (!chain) {
59100
- chain = { chainId, members: [] };
59101
- chains.set(chainId, chain);
59402
+ let chain2 = chains.get(chainId);
59403
+ if (!chain2) {
59404
+ chain2 = { chainId, members: [] };
59405
+ chains.set(chainId, chain2);
59102
59406
  }
59103
- chain.members.push({ element: el, seq });
59407
+ chain2.members.push({ element: el, seq });
59104
59408
  }
59105
- for (const chain of chains.values()) {
59106
- chain.members.sort((a, b) => a.seq - b.seq);
59409
+ for (const chain2 of chains.values()) {
59410
+ chain2.members.sort((a, b) => a.seq - b.seq);
59107
59411
  }
59108
59412
  return chains;
59109
59413
  }
@@ -59153,27 +59457,27 @@ function splitSegmentAt(segment, offset) {
59153
59457
  };
59154
59458
  return [before, after];
59155
59459
  }
59156
- function distributeSegmentsAcrossChain(chain) {
59460
+ function distributeSegmentsAcrossChain(chain2) {
59157
59461
  const result = /* @__PURE__ */ new Map();
59158
- if (chain.members.length === 0) {
59462
+ if (chain2.members.length === 0) {
59159
59463
  return result;
59160
59464
  }
59161
- const headMember = chain.members[0];
59465
+ const headMember = chain2.members[0];
59162
59466
  const allSegments = headMember.element.textSegments ?? [];
59163
59467
  if (allSegments.length === 0) {
59164
- for (const member of chain.members) {
59468
+ for (const member of chain2.members) {
59165
59469
  result.set(member.element.id, []);
59166
59470
  }
59167
59471
  return result;
59168
59472
  }
59169
- if (chain.members.length === 1) {
59473
+ if (chain2.members.length === 1) {
59170
59474
  result.set(headMember.element.id, [...allSegments]);
59171
59475
  return result;
59172
59476
  }
59173
59477
  let remainingSegments = [...allSegments];
59174
- for (let i2 = 0; i2 < chain.members.length; i2++) {
59175
- const member = chain.members[i2];
59176
- const isLast = i2 === chain.members.length - 1;
59478
+ for (let i2 = 0; i2 < chain2.members.length; i2++) {
59479
+ const member = chain2.members[i2];
59480
+ const isLast = i2 === chain2.members.length - 1;
59177
59481
  if (isLast || remainingSegments.length === 0) {
59178
59482
  result.set(member.element.id, remainingSegments);
59179
59483
  remainingSegments = [];
@@ -59208,7 +59512,7 @@ function distributeSegmentsAcrossChain(chain) {
59208
59512
  }
59209
59513
  result.set(member.element.id, boxSegments);
59210
59514
  }
59211
- for (const member of chain.members) {
59515
+ for (const member of chain2.members) {
59212
59516
  if (!result.has(member.element.id)) {
59213
59517
  result.set(member.element.id, []);
59214
59518
  }
@@ -59223,11 +59527,11 @@ function getLinkedTextBoxSegments(element, allElements) {
59223
59527
  return void 0;
59224
59528
  }
59225
59529
  const chains = buildLinkedTextBoxChains(allElements);
59226
- const chain = chains.get(element.linkedTxbxId);
59227
- if (!chain || chain.members.length <= 1) {
59530
+ const chain2 = chains.get(element.linkedTxbxId);
59531
+ if (!chain2 || chain2.members.length <= 1) {
59228
59532
  return void 0;
59229
59533
  }
59230
- const segmentMap = distributeSegmentsAcrossChain(chain);
59534
+ const segmentMap = distributeSegmentsAcrossChain(chain2);
59231
59535
  return segmentMap.get(element.id);
59232
59536
  }
59233
59537
  var DEFAULT_FONT_SIZE_PT;
@@ -67069,9 +67373,9 @@ var init_utils = __esm({
67069
67373
  init_ole_sheet_xls_biff8();
67070
67374
  init_ole_sheet_xls_biff8_writer();
67071
67375
  init_ole_document_docx_editor();
67072
- init_ole_document_doc_editor();
67376
+ init_ole_document_doc_editor2();
67073
67377
  init_ole_nested_deck_editor();
67074
- init_png_encoder();
67378
+ init_png_encoder2();
67075
67379
  init_raster_canvas();
67076
67380
  init_ole_icon_raster();
67077
67381
  init_ole_content_preview_raster();
@@ -73084,7 +73388,7 @@ function parseTableEffectChain(effectLst) {
73084
73388
  if (!effectLst) {
73085
73389
  return void 0;
73086
73390
  }
73087
- const chain = [];
73391
+ const chain2 = [];
73088
73392
  for (const key2 of Object.keys(effectLst)) {
73089
73393
  if (key2.startsWith("@_")) {
73090
73394
  continue;
@@ -73099,14 +73403,14 @@ function parseTableEffectChain(effectLst) {
73099
73403
  }
73100
73404
  const nodes = Array.isArray(raw) ? raw : [raw];
73101
73405
  for (const node of nodes) {
73102
- chain.push({ kind, xml: node ?? {} });
73406
+ chain2.push({ kind, xml: node ?? {} });
73103
73407
  }
73104
73408
  }
73105
- return chain.length > 0 ? chain : void 0;
73409
+ return chain2.length > 0 ? chain2 : void 0;
73106
73410
  }
73107
- function writeTableEffectChain(chain) {
73411
+ function writeTableEffectChain(chain2) {
73108
73412
  const effectLst = {};
73109
- for (const { kind, xml } of chain) {
73413
+ for (const { kind, xml } of chain2) {
73110
73414
  const key2 = `a:${kind}`;
73111
73415
  const existing = effectLst[key2];
73112
73416
  if (existing === void 0) {
@@ -79569,10 +79873,10 @@ function targetSpidOf(cTn) {
79569
79873
  }
79570
79874
  return void 0;
79571
79875
  }
79572
- function walkContainers(holder, chain, out) {
79876
+ function walkContainers(holder, chain2, out) {
79573
79877
  for (const key2 of CONTAINER_KEYS) {
79574
79878
  for (const node of ensureArray11(holder[key2])) {
79575
- const nextChain = [...chain, { holder, key: key2, node }];
79879
+ const nextChain = [...chain2, { holder, key: key2, node }];
79576
79880
  const cTn = node["p:cTn"];
79577
79881
  if (!isXmlObject5(cTn)) {
79578
79882
  continue;
@@ -79637,14 +79941,14 @@ function appendContainer(holder, key2, node) {
79637
79941
  holder[key2] = existing.length === 1 ? existing[0] : existing;
79638
79942
  }
79639
79943
  function removeEffectNode(ref) {
79640
- const chain = ref.chain;
79641
- const own = chain[chain.length - 1];
79944
+ const chain2 = ref.chain;
79945
+ const own = chain2[chain2.length - 1];
79642
79946
  if (!own) {
79643
79947
  return;
79644
79948
  }
79645
79949
  detach(own.holder, own.key, own.node);
79646
- for (let index = chain.length - 2; index >= 0; index -= 1) {
79647
- const link = chain[index];
79950
+ for (let index = chain2.length - 2; index >= 0; index -= 1) {
79951
+ const link = chain2[index];
79648
79952
  const cTn = link.node["p:cTn"];
79649
79953
  if (!isXmlObject5(cTn)) {
79650
79954
  return;
@@ -101790,9 +102094,9 @@ var init_PptxRuntimeDependencyFactory = __esm({
101790
102094
  // relocating it, and dropping is the honest half. Parts we do not parse
101791
102095
  // keep their comments regardless: they are copied through byte for byte.
101792
102096
  });
101793
- const parse2 = parser.parse.bind(parser);
102097
+ const parse = parser.parse.bind(parser);
101794
102098
  parser.parse = ((xml, validationOption) => {
101795
- const parsed = validationOption === void 0 ? parse2(xml) : parse2(xml, validationOption);
102099
+ const parsed = validationOption === void 0 ? parse(xml) : parse(xml, validationOption);
101796
102100
  if (typeof xml === "string" && xml.includes("custGeom")) {
101797
102101
  annotateCustomGeometryCommandOrder(xml, parsed);
101798
102102
  }
@@ -107715,7 +108019,7 @@ var EMU_PER_INCH;
107715
108019
  var init_picture_encode = __esm({
107716
108020
  "src/core/ppt/writer/picture-encode.ts"() {
107717
108021
  init_gif_decode();
107718
- init_png_encoder();
108022
+ init_png_encoder2();
107719
108023
  EMU_PER_HUNDREDTH_MM = 360;
107720
108024
  EMU_PER_INCH = 914400;
107721
108025
  }
@@ -107751,7 +108055,7 @@ function dataUrlToPicture(dataUrl) {
107751
108055
  }
107752
108056
  var init_raster_utils = __esm({
107753
108057
  "src/core/ppt/writer/raster-utils.ts"() {
107754
- init_ooxml_crypto_primitives();
108058
+ init_ooxml_crypto_primitives2();
107755
108059
  init_picture_encode();
107756
108060
  }
107757
108061
  });
@@ -108961,516 +109265,6 @@ var init_metro_blob_collect = __esm({
108961
109265
  ]);
108962
109266
  }
108963
109267
  });
108964
- function fontNameOf(style, themeFonts) {
108965
- const family2 = style.resolvedFontFamily ?? style.fontFamily;
108966
- if (family2?.startsWith("+mj-")) {
108967
- return themeFonts.major;
108968
- }
108969
- if (family2?.startsWith("+mn-")) {
108970
- return themeFonts.minor;
108971
- }
108972
- return family2 && !family2.startsWith("+") ? family2 : void 0;
108973
- }
108974
- function hexOf(color2) {
108975
- const hex42 = color2?.replace(/^#/u, "");
108976
- return hex42 && /^[0-9a-f]{6}$/iu.test(hex42) ? hex42.toUpperCase() : void 0;
108977
- }
108978
- function toLevel(style = {}, themeFonts = {}) {
108979
- const bulletChar = style.bulletNone ? void 0 : style.bulletChar;
108980
- return {
108981
- paragraph: {
108982
- align: style.alignment ? ALIGN_MAP3[style.alignment] : void 0,
108983
- hasBullet: style.bulletNone ? false : bulletChar ? true : void 0,
108984
- bulletChar,
108985
- bulletColorRgb: hexOf(style.bulletColor),
108986
- marginLeftEmu: style.marginLeft !== void 0 ? style.marginLeft * EMU_PER_PX : void 0,
108987
- indentEmu: style.indent !== void 0 ? style.indent * EMU_PER_PX : void 0
108988
- },
108989
- // Explicit, as PowerPoint's own master levels are (full CF masks): a
108990
- // binary master level otherwise inherits bold/italic from the level
108991
- // above it, unlike an OOXML `a:lvlNpPr`.
108992
- run: {
108993
- bold: style.bold ?? false,
108994
- italic: style.italic ?? false,
108995
- underline: false,
108996
- sizePt: style.fontSize !== void 0 ? style.fontSize * 72 / 96 : void 0,
108997
- colorRgb: hexOf(style.color),
108998
- fontName: fontNameOf(style, themeFonts)
108999
- }
109000
- };
109001
- }
109002
- function toLevels(levels, count, themeFonts) {
109003
- if (!levels) {
109004
- return void 0;
109005
- }
109006
- const defined = [0, 1, 2, 3, 4].filter((i2) => levels[i2] !== void 0);
109007
- if (defined.length === 0) {
109008
- return void 0;
109009
- }
109010
- const base = levels[-1];
109011
- return Array.from(
109012
- { length: count },
109013
- (_, i2) => toLevel(base || levels[i2] ? { ...base, ...levels[i2] } : void 0, themeFonts)
109014
- );
109015
- }
109016
- function convertMasterTextStyles(styles, themeFonts = {}) {
109017
- if (!styles) {
109018
- return void 0;
109019
- }
109020
- const out = {
109021
- title: toLevels(styles.titleStyle, TITLE_LEVELS, themeFonts),
109022
- body: toLevels(styles.bodyStyle, PPT_MASTER_LEVELS, themeFonts),
109023
- other: toLevels(styles.otherStyle, PPT_MASTER_LEVELS, themeFonts)
109024
- };
109025
- return out.title || out.body || out.other ? out : void 0;
109026
- }
109027
- function masterStyleFonts(styles) {
109028
- if (!styles) {
109029
- return [];
109030
- }
109031
- return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
109032
- }
109033
- var PPT_MASTER_LEVELS;
109034
- var TITLE_LEVELS;
109035
- var ALIGN_MAP3;
109036
- var init_master_style_convert = __esm({
109037
- "src/core/ppt/writer/master-style-convert.ts"() {
109038
- init_constants();
109039
- PPT_MASTER_LEVELS = 5;
109040
- TITLE_LEVELS = 1;
109041
- ALIGN_MAP3 = {
109042
- left: "l",
109043
- l: "l",
109044
- center: "ctr",
109045
- ctr: "ctr",
109046
- right: "r",
109047
- r: "r",
109048
- justify: "just",
109049
- just: "just",
109050
- justLow: "just",
109051
- dist: "just",
109052
- thaiDist: "just"
109053
- };
109054
- }
109055
- });
109056
- function relsPath(partPath) {
109057
- const slash = partPath.lastIndexOf("/");
109058
- return `${partPath.slice(0, slash)}/_rels/${partPath.slice(slash + 1)}.rels`;
109059
- }
109060
- async function readText(zip, path) {
109061
- return zip.file(path)?.async("string");
109062
- }
109063
- async function followRel(zip, from, type) {
109064
- const rels = await readText(zip, relsPath(from));
109065
- const rel = rels ? parseRels(rels).find((r) => r.type === `${REL}/${type}`) : void 0;
109066
- return rel && !rel.external ? resolveTarget2(from, rel.target) : void 0;
109067
- }
109068
- async function firstSlideMasterPath(zip) {
109069
- const presentation = "ppt/presentation.xml";
109070
- const xml = await readText(zip, presentation);
109071
- const firstSlideRid = xml ? /<p:sldId\b[^>]*\br:id="([^"]+)"/u.exec(xml)?.[1] : void 0;
109072
- const rels = await readText(zip, relsPath(presentation));
109073
- const slideRel = rels ? parseRels(rels).find((r) => r.id === firstSlideRid) : void 0;
109074
- const slide = slideRel ? resolveTarget2(presentation, slideRel.target) : void 0;
109075
- const layout = slide ? await followRel(zip, slide, "slideLayout") : void 0;
109076
- const master = layout ? await followRel(zip, layout, "slideMaster") : void 0;
109077
- return master && zip.file(master) ? master : FALLBACK_MASTER;
109078
- }
109079
- function num2(xml, pattern) {
109080
- const value = pattern.exec(xml)?.[1];
109081
- return value === void 0 ? void 0 : Number(value);
109082
- }
109083
- function readPlaceholders(masterXml) {
109084
- const out = [];
109085
- for (const [sp] of masterXml.matchAll(/<p:sp\b[\s\S]*?<\/p:sp>/gu)) {
109086
- const phType = /<p:ph\b([^>]*)>/u.exec(sp)?.[1];
109087
- if (phType === void 0) {
109088
- continue;
109089
- }
109090
- const kind = PLACEHOLDER_KINDS[/\btype="([^"]+)"/u.exec(phType)?.[1] ?? "body"];
109091
- const x = num2(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
109092
- const y = num2(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
109093
- const w = num2(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
109094
- const h2 = num2(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
109095
- if (!kind || x === void 0 || y === void 0 || !w || !h2 || out.some((p) => p.kind === kind)) {
109096
- continue;
109097
- }
109098
- const size = num2(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
109099
- out.push({ kind, rect: { x, y, w, h: h2 }, ...size ? { sizePt: size / 100 } : {} });
109100
- }
109101
- return out;
109102
- }
109103
- function readTxStyles(masterXml) {
109104
- const txStyles = /<p:txStyles\b[\s\S]*?<\/p:txStyles>/u.exec(masterXml)?.[0];
109105
- const root = /<p:sldMaster\b[^>]*>/u.exec(masterXml)?.[0] ?? "";
109106
- if (!txStyles) {
109107
- return void 0;
109108
- }
109109
- const startTag = /^<p:txStyles\b[^>]*>/u.exec(txStyles)?.[0] ?? "";
109110
- const declarations3 = [...root.matchAll(/\s(xmlns(?::\w+)?)="[^"]*"/gu)].filter((m) => !startTag.includes(` ${m[1]}=`)).map((m) => m[0]);
109111
- return txStyles.replace(/^<p:txStyles\b/u, `<p:txStyles${declarations3.join("")}`);
109112
- }
109113
- function themeColor(themeXml3, slot) {
109114
- const body = new RegExp(`<a:${slot}>([\\s\\S]*?)</a:${slot}>`, "u").exec(themeXml3)?.[1];
109115
- if (!body) {
109116
- return void 0;
109117
- }
109118
- return (/\bval="([0-9A-Fa-f]{6})"/u.exec(body) ?? /\blastClr="([0-9A-Fa-f]{6})"/u.exec(body))?.[1];
109119
- }
109120
- function schemeColorsFor(themeXml3, clrMapAttributes) {
109121
- const mapped = (alias, fallback) => clrMapAttributes && new RegExp(`\\b${alias}="(\\w+)"`, "u").exec(clrMapAttributes)?.[1] || fallback;
109122
- const slots = [
109123
- mapped("bg1", "lt1"),
109124
- mapped("tx1", "dk1"),
109125
- mapped("bg2", "lt2"),
109126
- mapped("tx2", "dk2"),
109127
- "accent1",
109128
- "accent2",
109129
- "hlink",
109130
- "folHlink"
109131
- ];
109132
- const colors = slots.map((slot) => themeColor(themeXml3, slot)?.toUpperCase());
109133
- return colors.every((c) => c !== void 0) ? colors : void 0;
109134
- }
109135
- function latinFace(themeXml3, scheme) {
109136
- const open = themeXml3.indexOf(`<a:${scheme}>`);
109137
- const close = open < 0 ? -1 : themeXml3.indexOf(`</a:${scheme}>`, open);
109138
- const body = close < 0 ? void 0 : themeXml3.slice(open, close);
109139
- return body && /<a:latin [^>]*typeface="([^"]+)"/u.exec(body)?.[1] || void 0;
109140
- }
109141
- async function readMasterRoundTripSource(zip) {
109142
- const masterPath = await firstSlideMasterPath(zip);
109143
- const masterXml = await readText(zip, masterPath);
109144
- if (!masterXml) {
109145
- return { placeholders: [], themeFonts: {} };
109146
- }
109147
- const clrMapAttributes = /<p:clrMap\b([^>]*?)\/?>/u.exec(masterXml)?.[1]?.trim();
109148
- const themePath = await followRel(zip, masterPath, "theme");
109149
- const themeXml3 = themePath ? await readText(zip, themePath) : void 0;
109150
- return {
109151
- placeholders: readPlaceholders(masterXml),
109152
- txStylesXml: readTxStyles(masterXml),
109153
- clrMapAttributes,
109154
- themeXml: themeXml3,
109155
- schemeColors: themeXml3 ? schemeColorsFor(themeXml3, clrMapAttributes) : void 0,
109156
- themeFonts: {
109157
- major: themeXml3 ? latinFace(themeXml3, "majorFont") : void 0,
109158
- minor: themeXml3 ? latinFace(themeXml3, "minorFont") : void 0
109159
- }
109160
- };
109161
- }
109162
- var REL;
109163
- var FALLBACK_MASTER;
109164
- var PLACEHOLDER_KINDS;
109165
- var init_master_roundtrip_source = __esm({
109166
- "src/core/ppt/writer/master-roundtrip-source.ts"() {
109167
- init_metro_blob_source();
109168
- REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
109169
- FALLBACK_MASTER = "ppt/slideMasters/slideMaster1.xml";
109170
- PLACEHOLDER_KINDS = {
109171
- title: "title",
109172
- body: "body",
109173
- dt: "date",
109174
- ftr: "footer",
109175
- sldNum: "slideNumber"
109176
- };
109177
- }
109178
- });
109179
- function contentTypes(overrides28) {
109180
- const parts = overrides28.map(([name, type]) => `<Override PartName="/${name}" ContentType="${PML_CT}.${type}"/>`).join("");
109181
- return `${XML_DECL2}\r
109182
- <Types xmlns="${CT_NS2}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${parts}</Types>`;
109183
- }
109184
- function relationships(type, target) {
109185
- return `${XML_DECL2}\r
109186
- <Relationships xmlns="${REL_NS2}"><Relationship Id="rId1" Type="${OFFICE_REL}/${type}" Target="${target}"/></Relationships>`;
109187
- }
109188
- function withDeclaration(xml) {
109189
- const body = xml.replace(/^?<\?xml[^>]*\?>\s*/u, "");
109190
- return `${XML_DECL2}\r
109191
- ${body}`;
109192
- }
109193
- async function zipParts(parts) {
109194
- const zip = new JSZip3__default.default();
109195
- for (const [name, text22] of parts) {
109196
- zip.file(name, text22);
109197
- }
109198
- return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
109199
- }
109200
- function buildOArtTextStylesPackage(txStylesXml) {
109201
- const part = "drs/slideMasters/slideMaster1.xml";
109202
- return zipParts([
109203
- ["[Content_Types].xml", contentTypes([[part, "presentationml.slideMaster+xml"]])],
109204
- ["_rels/.rels", relationships("slideMaster", part)],
109205
- [part, withDeclaration(txStylesXml)]
109206
- ]);
109207
- }
109208
- function buildThemePackage(themeXml3) {
109209
- const manager = "theme/theme/themeManager.xml";
109210
- return zipParts([
109211
- [
109212
- "[Content_Types].xml",
109213
- contentTypes([
109214
- [manager, "themeManager+xml"],
109215
- ["theme/theme/theme1.xml", "theme+xml"]
109216
- ])
109217
- ],
109218
- ["_rels/.rels", relationships("officeDocument", manager)],
109219
- [manager, `${XML_DECL2}\r
109220
- <a:themeManager xmlns:a="${A_NS2}"/>`],
109221
- ["theme/theme/_rels/themeManager.xml.rels", relationships("theme", "theme1.xml")],
109222
- ["theme/theme/theme1.xml", withDeclaration(themeXml3)]
109223
- ]);
109224
- }
109225
- function buildColorMapping(clrMapAttributes) {
109226
- const attributes = clrMapAttributes.replace(/\s*xmlns(?::\w+)?="[^"]*"/gu, "").trim();
109227
- return new TextEncoder().encode(`${XML_DECL2}\r
109228
- <a:clrMap xmlns:a="${A_NS2}" ${attributes}/>`);
109229
- }
109230
- async function buildMasterRoundTrip(source) {
109231
- return {
109232
- placeholders: source.placeholders,
109233
- schemeColors: source.schemeColors,
109234
- themeFonts: source.themeFonts,
109235
- oartTextStyles: source.txStylesXml ? await buildOArtTextStylesPackage(source.txStylesXml) : void 0,
109236
- theme: source.themeXml ? await buildThemePackage(source.themeXml) : void 0,
109237
- colorMapping: source.clrMapAttributes ? buildColorMapping(source.clrMapAttributes) : void 0
109238
- };
109239
- }
109240
- async function buildMasterRoundTripFromPptx(pptxBytes) {
109241
- return buildMasterRoundTrip(await readMasterRoundTripSource(await JSZip3__default.default.loadAsync(pptxBytes)));
109242
- }
109243
- var XML_DECL2;
109244
- var CT_NS2;
109245
- var REL_NS2;
109246
- var OFFICE_REL;
109247
- var A_NS2;
109248
- var PML_CT;
109249
- var init_master_roundtrip_writer = __esm({
109250
- "src/core/ppt/writer/master-roundtrip-writer.ts"() {
109251
- init_master_roundtrip_source();
109252
- XML_DECL2 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
109253
- CT_NS2 = "http://schemas.openxmlformats.org/package/2006/content-types";
109254
- REL_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships";
109255
- OFFICE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
109256
- A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
109257
- PML_CT = "application/vnd.openxmlformats-officedocument";
109258
- }
109259
- });
109260
- function isNodeCanvasModule(value) {
109261
- const candidate = value;
109262
- return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
109263
- }
109264
- function loadNodeCanvas() {
109265
- nodeCanvas ??= (async () => {
109266
- const runtime = globalThis.process;
109267
- if (!runtime?.versions?.node) {
109268
- return void 0;
109269
- }
109270
- try {
109271
- const imported = await import(
109272
- /* webpackIgnore: true */
109273
- /* @vite-ignore */
109274
- NODE_CANVAS_SPECIFIER
109275
- );
109276
- const withDefault = imported;
109277
- if (isNodeCanvasModule(imported)) {
109278
- return imported;
109279
- }
109280
- return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
109281
- } catch {
109282
- return void 0;
109283
- }
109284
- })();
109285
- return nodeCanvas;
109286
- }
109287
- async function rasterizeSvgInNode(svg, sizeFor) {
109288
- const canvasModule = await loadNodeCanvas();
109289
- if (!canvasModule) {
109290
- return void 0;
109291
- }
109292
- try {
109293
- const image = await canvasModule.loadImage(svg);
109294
- const { width, height } = sizeFor(image.width, image.height);
109295
- const canvas = canvasModule.createCanvas(width, height);
109296
- canvas.getContext("2d").drawImage(image, 0, 0, width, height);
109297
- return new Uint8Array(canvas.toBuffer("image/png"));
109298
- } catch {
109299
- return void 0;
109300
- }
109301
- }
109302
- var NODE_CANVAS_SPECIFIER;
109303
- var nodeCanvas;
109304
- var init_svg_rasterize_node = __esm({
109305
- "src/core/ppt/writer/svg-rasterize-node.ts"() {
109306
- NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
109307
- }
109308
- });
109309
- function hasDomRasteriser() {
109310
- return typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
109311
- }
109312
- function svgRasterSize(intrinsicW, intrinsicH, fallbackW, fallbackH) {
109313
- const baseW = intrinsicW || fallbackW;
109314
- const baseH = intrinsicH || fallbackH;
109315
- const scale2 = Math.min(2, MAX_EDGE_PX / Math.max(baseW, baseH, 1));
109316
- return {
109317
- width: Math.max(1, Math.round(baseW * scale2)),
109318
- height: Math.max(1, Math.round(baseH * scale2))
109319
- };
109320
- }
109321
- function loadImage(url) {
109322
- return new Promise((resolve3) => {
109323
- const img = new Image();
109324
- img.onload = () => resolve3(img);
109325
- img.onerror = () => resolve3(void 0);
109326
- img.src = url;
109327
- });
109328
- }
109329
- async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
109330
- const url = URL.createObjectURL(new Blob([svg.slice()], { type: "image/svg+xml" }));
109331
- try {
109332
- const img = await loadImage(url);
109333
- if (!img) {
109334
- return void 0;
109335
- }
109336
- const size = svgRasterSize(img.naturalWidth, img.naturalHeight, fallbackW, fallbackH);
109337
- const canvas = document.createElement("canvas");
109338
- canvas.width = size.width;
109339
- canvas.height = size.height;
109340
- const context = canvas.getContext("2d");
109341
- if (!context) {
109342
- return void 0;
109343
- }
109344
- context.drawImage(img, 0, 0, canvas.width, canvas.height);
109345
- const blob = await new Promise((resolve3) => {
109346
- canvas.toBlob(resolve3, "image/png");
109347
- });
109348
- return blob ? new Uint8Array(await blob.arrayBuffer()) : void 0;
109349
- } catch {
109350
- return void 0;
109351
- } finally {
109352
- URL.revokeObjectURL(url);
109353
- }
109354
- }
109355
- async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
109356
- const png = hasDomRasteriser() ? await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx) : await rasterizeSvgInNode(
109357
- svg,
109358
- (w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx)
109359
- );
109360
- return png ? { extension: "png", bytes: png } : void 0;
109361
- }
109362
- var MAX_EDGE_PX;
109363
- var init_svg_rasterize = __esm({
109364
- "src/core/ppt/writer/svg-rasterize.ts"() {
109365
- init_svg_rasterize_node();
109366
- MAX_EDGE_PX = 2048;
109367
- }
109368
- });
109369
- async function tiffToPicture(bytes) {
109370
- try {
109371
- const imported = await import('./UTIF-POYWAAGO.js');
109372
- const utif = "default" in imported ? imported.default : imported;
109373
- const buffer = bytes.slice().buffer;
109374
- const page = utif.decode(buffer)[0];
109375
- if (!page) {
109376
- return void 0;
109377
- }
109378
- utif.decodeImage(buffer, page);
109379
- const width = Number(page.width);
109380
- const height = Number(page.height);
109381
- if (!(width > 0 && height > 0)) {
109382
- return void 0;
109383
- }
109384
- return {
109385
- extension: "png",
109386
- bytes: encodePng(width, height, new Uint8Array(utif.toRGBA8(page)))
109387
- };
109388
- } catch {
109389
- return void 0;
109390
- }
109391
- }
109392
- async function fetchBlobUrl(url) {
109393
- if (!url?.startsWith("blob:") || typeof fetch === "undefined") {
109394
- return void 0;
109395
- }
109396
- try {
109397
- return new Uint8Array(await (await fetch(url)).arrayBuffer());
109398
- } catch {
109399
- return void 0;
109400
- }
109401
- }
109402
- function pathFormat(path) {
109403
- const ext = /\.([^./\\]+)$/u.exec(path)?.[1]?.toLowerCase();
109404
- return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
109405
- }
109406
- async function toPicture(bytes, el) {
109407
- const format2 = sniffImageFormat(bytes);
109408
- if (format2 === "tiff") {
109409
- return tiffToPicture(bytes);
109410
- }
109411
- if (format2 === "svg") {
109412
- return rasterizeSvg(bytes, el.width || 1, el.height || 1);
109413
- }
109414
- return bytesToPicture(bytes);
109415
- }
109416
- async function resolveOne(el, source, readPart) {
109417
- const inline = decodeBase64DataUrl(source.inline);
109418
- const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
109419
- const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
109420
- if (inline && (!partFormat || partFormat === inlineFormat)) {
109421
- return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
109422
- }
109423
- const part = source.partPath ? await readPart(source.partPath) : void 0;
109424
- const fromPart = part ? await toPicture(part, el) : void 0;
109425
- if (fromPart) {
109426
- return fromPart;
109427
- }
109428
- if (inline && bytesToPicture(inline)) {
109429
- return void 0;
109430
- }
109431
- const fetched = await fetchBlobUrl(source.inline);
109432
- const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
109433
- if (fromFetch || !source.svgPath) {
109434
- return fromFetch;
109435
- }
109436
- const svg = await readPart(source.svgPath);
109437
- return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
109438
- }
109439
- async function resolvePictureSources(slides, readPart) {
109440
- const pending = [];
109441
- const walk3 = (elements2) => {
109442
- for (const el of elements2) {
109443
- const source = pictureSourceOf(el);
109444
- if (source) {
109445
- pending.push([el, source]);
109446
- } else if (el.type === "group") {
109447
- walk3(el.children);
109448
- }
109449
- }
109450
- };
109451
- for (const slide of slides) {
109452
- walk3(slide.elements);
109453
- }
109454
- const resolved = /* @__PURE__ */ new Map();
109455
- await Promise.all(
109456
- pending.map(async ([el, source]) => {
109457
- const picture = await resolveOne(el, source, readPart);
109458
- if (picture) {
109459
- resolved.set(el, picture);
109460
- }
109461
- })
109462
- );
109463
- return resolved;
109464
- }
109465
- var init_picture_resolve = __esm({
109466
- "src/core/ppt/writer/picture-resolve.ts"() {
109467
- init_png_encoder();
109468
- init_picture_encode();
109469
- init_picture_source();
109470
- init_raster_utils();
109471
- init_svg_rasterize();
109472
- }
109473
- });
109474
109268
  function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
109475
109269
  const header = new Uint8Array(8);
109476
109270
  const view = new DataView(header.buffer);
@@ -109485,7 +109279,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
109485
109279
  }
109486
109280
  var ByteWriter;
109487
109281
  var init_byte_writer = __esm({
109488
- "src/core/ppt/writer/byte-writer.ts"() {
109282
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
109489
109283
  ByteWriter = class {
109490
109284
  chunks = [];
109491
109285
  length = 0;
@@ -109576,8 +109370,8 @@ var TEXT_TYPE;
109576
109370
  var HEADER_TOKEN_PLAIN;
109577
109371
  var HEADER_TOKEN_ENCRYPTED;
109578
109372
  var EMU_PER_MASTER;
109579
- var init_record_types = __esm({
109580
- "src/core/ppt/record-types.ts"() {
109373
+ var init_legacy_ppt_record_types = __esm({
109374
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
109581
109375
  RT = {
109582
109376
  Document: 1e3,
109583
109377
  DocumentAtom: 1001,
@@ -109705,6 +109499,11 @@ var init_record_types = __esm({
109705
109499
  EMU_PER_MASTER = 914400 / 576;
109706
109500
  }
109707
109501
  });
109502
+ var init_record_types = __esm({
109503
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
109504
+ init_legacy_ppt_record_types();
109505
+ }
109506
+ });
109708
109507
  function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
109709
109508
  const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
109710
109509
  const data = new ByteWriter().u32(20).u32(encrypted ? HEADER_TOKEN_ENCRYPTED : HEADER_TOKEN_PLAIN).u32(offsetToCurrentEdit).u16(nameBytes.length).u16(1012).u8(3).u8(0).bytes(new Uint8Array(2)).bytes(nameBytes).u32(8).toBytes();
@@ -109719,7 +109518,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
109719
109518
  var USER_NAME;
109720
109519
  var CURRENT_USER_STREAM_SIZE;
109721
109520
  var init_current_user_writer = __esm({
109722
- "src/core/ppt/writer/current-user-writer.ts"() {
109521
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
109723
109522
  init_record_types();
109724
109523
  init_byte_writer();
109725
109524
  USER_NAME = "pptx-viewer";
@@ -109749,8 +109548,8 @@ function buildFbse(picture, uid, foDelay, size) {
109749
109548
  var MSOBLIP_PICT;
109750
109549
  var BLIP_INFO;
109751
109550
  var init_blip_writer = __esm({
109752
- "src/core/ppt/writer/blip-writer.ts"() {
109753
- init_digests();
109551
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
109552
+ init_md4();
109754
109553
  init_png_encoder();
109755
109554
  init_record_types();
109756
109555
  init_byte_writer();
@@ -109801,7 +109600,7 @@ var OPT;
109801
109600
  var FBID_FLAG;
109802
109601
  var METRO_BLOB_OPID;
109803
109602
  var init_fopt_writer = __esm({
109804
- "src/core/ppt/writer/fopt-writer.ts"() {
109603
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
109805
109604
  init_record_types();
109806
109605
  init_byte_writer();
109807
109606
  OPT = {
@@ -109885,7 +109684,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
109885
109684
  }
109886
109685
  var SHAPE_ID_CLUSTER_SIZE;
109887
109686
  var init_bstore_writer = __esm({
109888
- "src/core/ppt/writer/bstore-writer.ts"() {
109687
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
109889
109688
  init_record_types();
109890
109689
  init_blip_writer();
109891
109690
  init_byte_writer();
@@ -109905,27 +109704,9 @@ function buildEnvironmentLeadingRecord() {
109905
109704
  return record(4040, child262, 2, true);
109906
109705
  }
109907
109706
  function buildEnvironmentTrailingRecords(otherTextStyle) {
109908
- const unknown0fa4 = record(
109909
- 4004,
109910
- new Uint8Array([128, 0, 64, 0, 0, 0, 0, 0]),
109911
- 0,
109912
- false,
109913
- 0
109914
- );
109915
- const unknown0fa5 = record(
109916
- 4005,
109917
- new Uint8Array([0, 0, 0, 8, 46, 0, 0, 0, 2, 0, 0, 0]),
109918
- 0,
109919
- false,
109920
- 0
109921
- );
109922
- const unknown0fa9 = record(
109923
- 4009,
109924
- new Uint8Array([7, 0, 0, 0, 2, 0, 9, 4, 0, 0]),
109925
- 0,
109926
- false,
109927
- 0
109928
- );
109707
+ const unknown0fa4 = record(4004, new Uint8Array([128, 0, 64, 0, 0, 0, 0, 0]), 0, false, 0);
109708
+ const unknown0fa5 = record(4005, new Uint8Array([0, 0, 0, 8, 46, 0, 0, 0, 2, 0, 0, 0]), 0, false, 0);
109709
+ const unknown0fa9 = record(4009, new Uint8Array([7, 0, 0, 0, 2, 0, 9, 4, 0, 0]), 0, false, 0);
109929
109710
  const style = otherTextStyle ?? record(RT.TextMasterStyleAtom, new ByteWriter().u16(1).u32(0).u32(0).toBytes(), 4, false, 0);
109930
109711
  return new ByteWriter().bytes(unknown0fa4).bytes(unknown0fa5).bytes(unknown0fa9).bytes(style).toBytes();
109931
109712
  }
@@ -109938,7 +109719,7 @@ function buildEnvironment(fonts, otherTextStyle) {
109938
109719
  }
109939
109720
  var LF_FACE_NAME_BYTES;
109940
109721
  var init_font_collection_writer = __esm({
109941
- "src/core/ppt/writer/font-collection-writer.ts"() {
109722
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
109942
109723
  init_record_types();
109943
109724
  init_byte_writer();
109944
109725
  LF_FACE_NAME_BYTES = 64;
@@ -109975,12 +109756,7 @@ function buildPaddingTag(size) {
109975
109756
  const fixedOverhead = 8 + 8 + nameRecord.length + 8;
109976
109757
  const blobData = new Uint8Array(Math.max(0, size - fixedOverhead));
109977
109758
  const blobRecord = record(RT_BINARY_TAG_DATA_BLOB, blobData, 0, false, 0);
109978
- const progBinaryTag = record(
109979
- RT.ProgBinaryTag,
109980
- new ByteWriter().bytes(nameRecord).bytes(blobRecord).toBytes(),
109981
- 0,
109982
- true
109983
- );
109759
+ const progBinaryTag = record(RT.ProgBinaryTag, new ByteWriter().bytes(nameRecord).bytes(blobRecord).toBytes(), 0, true);
109984
109760
  return record(RT.ProgTags, progBinaryTag, 0, true);
109985
109761
  }
109986
109762
  function buildDocumentContainer(input) {
@@ -110005,7 +109781,7 @@ var MASTER_SLIDE_ID_SENTINEL;
110005
109781
  var RT_CSTRING;
110006
109782
  var RT_BINARY_TAG_DATA_BLOB;
110007
109783
  var init_document_writer = __esm({
110008
- "src/core/ppt/writer/document-writer.ts"() {
109784
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
110009
109785
  init_record_types();
110010
109786
  init_byte_writer();
110011
109787
  init_font_collection_writer();
@@ -110153,7 +109929,7 @@ var LT;
110153
109929
  var FLAG_CUSTOM_SHOW_RETURN;
110154
109930
  var HyperlinkCollector;
110155
109931
  var init_hyperlink_writer = __esm({
110156
- "src/core/ppt/writer/hyperlink-writer.ts"() {
109932
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
110157
109933
  init_record_types();
110158
109934
  init_byte_writer();
110159
109935
  II_ACTION = {
@@ -110252,17 +110028,17 @@ var MediaCollector;
110252
110028
  var SOUND_EXTENSION_WAV;
110253
110029
  var SOUND_LENGTH_UNKNOWN;
110254
110030
  var init_media_writer = __esm({
110255
- "src/core/ppt/writer/media-writer.ts"() {
110031
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
110256
110032
  init_record_types();
110257
110033
  init_byte_writer();
110258
110034
  MediaCollector = class {
110035
+ hyperlinks;
110036
+ entries = [];
110037
+ nextSoundId = 1;
110259
110038
  /** @param hyperlinks - See `OleCollector`'s constructor doc for why `exObjId` is allocated here. */
110260
110039
  constructor(hyperlinks) {
110261
110040
  this.hyperlinks = hyperlinks;
110262
110041
  }
110263
- hyperlinks;
110264
- entries = [];
110265
- nextSoundId = 1;
110266
110042
  /** Register an embedded WAV, returning its newly allocated `exObjId`. */
110267
110043
  registerAudio(wavBytes, soundName) {
110268
110044
  const exObjId = this.hyperlinks.allocateId();
@@ -110354,7 +110130,7 @@ var EX_OLE_SUB_DEFAULT;
110354
110130
  var PACKAGER_MENU_NAME;
110355
110131
  var OleCollector;
110356
110132
  var init_ole_writer = __esm({
110357
- "src/core/ppt/writer/ole-writer.ts"() {
110133
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
110358
110134
  init_ole2_parser_write();
110359
110135
  init_record_types();
110360
110136
  init_byte_writer();
@@ -110382,6 +110158,8 @@ var init_ole_writer = __esm({
110382
110158
  EX_OLE_SUB_DEFAULT = 0;
110383
110159
  PACKAGER_MENU_NAME = "Packager Shell Object";
110384
110160
  OleCollector = class {
110161
+ hyperlinks;
110162
+ entries = [];
110385
110163
  /**
110386
110164
  * @param hyperlinks - `exObjId` and `ExHyperlinkId` share one id space
110387
110165
  * (see `HyperlinkCollector.allocateId`'s doc comment), so this
@@ -110391,8 +110169,6 @@ var init_ole_writer = __esm({
110391
110169
  constructor(hyperlinks) {
110392
110170
  this.hyperlinks = hyperlinks;
110393
110171
  }
110394
- hyperlinks;
110395
- entries = [];
110396
110172
  /** Register an embed, returning its newly allocated `exObjId`. */
110397
110173
  register(embed) {
110398
110174
  const exObjId = this.hyperlinks.allocateId();
@@ -110419,12 +110195,7 @@ function buildExObjList(hyperlinks, ole, media) {
110419
110195
  if (hyperlinks.isEmpty && oleEntries.length === 0 && mediaEntries.length === 0) {
110420
110196
  return void 0;
110421
110197
  }
110422
- const seed = Math.max(
110423
- hyperlinks.peekNextId(),
110424
- ...oleEntries.map((e) => e.exObjId + 1),
110425
- ...mediaEntries.map((e) => e.exObjId + 1),
110426
- 1
110427
- );
110198
+ const seed = Math.max(hyperlinks.peekNextId(), ...oleEntries.map((e) => e.exObjId + 1), ...mediaEntries.map((e) => e.exObjId + 1), 1);
110428
110199
  const atomData = new ByteWriter().i32(seed).toBytes();
110429
110200
  const w = new ByteWriter().bytes(record(RT.ExternalObjectListAtom, atomData, 0, false, 0));
110430
110201
  for (const entry5 of hyperlinks.all) {
@@ -110432,9 +110203,7 @@ function buildExObjList(hyperlinks, ole, media) {
110432
110203
  }
110433
110204
  for (const entry5 of oleEntries) {
110434
110205
  if (entry5.persistIdRef === void 0) {
110435
- throw new Error(
110436
- `OLE embed exObjId=${entry5.exObjId} has no persistIdRef; document-stream-layout.ts must assign one before calling buildExObjList`
110437
- );
110206
+ throw new Error(`OLE embed exObjId=${entry5.exObjId} has no persistIdRef; document-stream-layout.ts must assign one before calling buildExObjList`);
110438
110207
  }
110439
110208
  w.bytes(buildExOleEmbedContainer(entry5.exObjId, entry5.persistIdRef));
110440
110209
  }
@@ -110446,7 +110215,7 @@ function buildExObjList(hyperlinks, ole, media) {
110446
110215
  return record(RT.ExternalObjectList, w.toBytes(), 0, true);
110447
110216
  }
110448
110217
  var init_ex_obj_list_writer = __esm({
110449
- "src/core/ppt/writer/ex-obj-list-writer.ts"() {
110218
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
110450
110219
  init_record_types();
110451
110220
  init_byte_writer();
110452
110221
  init_hyperlink_writer();
@@ -110499,7 +110268,7 @@ function buildChildAnchor(rect22) {
110499
110268
  var INT16_MIN2;
110500
110269
  var INT16_MAX2;
110501
110270
  var init_anchor_writer = __esm({
110502
- "src/core/ppt/writer/anchor-writer.ts"() {
110271
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
110503
110272
  init_record_types();
110504
110273
  init_byte_writer();
110505
110274
  INT16_MIN2 = -32768;
@@ -110527,7 +110296,7 @@ function encodeColorIndex(rgb2) {
110527
110296
  }
110528
110297
  var DEFAULT_RGB;
110529
110298
  var init_colors = __esm({
110530
- "src/core/ppt/writer/colors.ts"() {
110299
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
110531
110300
  DEFAULT_RGB = "000000";
110532
110301
  }
110533
110302
  });
@@ -110621,7 +110390,7 @@ function writeCfException(w, run, fontIndex) {
110621
110390
  var ALIGN_CODE;
110622
110391
  var EMU_PER_MASTER_UNIT;
110623
110392
  var init_text_exception_writer = __esm({
110624
- "src/core/ppt/writer/text-exception-writer.ts"() {
110393
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
110625
110394
  init_colors();
110626
110395
  ALIGN_CODE = {
110627
110396
  l: 0,
@@ -110692,7 +110461,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
110692
110461
  return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text22)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
110693
110462
  }
110694
110463
  var init_text_atom_writer = __esm({
110695
- "src/core/ppt/writer/text-atom-writer.ts"() {
110464
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
110696
110465
  init_record_types();
110697
110466
  init_byte_writer();
110698
110467
  init_hyperlink_writer();
@@ -110722,12 +110491,9 @@ function promptText(textType, paragraphs2) {
110722
110491
  function fieldText(kind, sizePt, fontIndex) {
110723
110492
  const field = kind === "date" ? RT.GenericDateMCAtom : kind === "slideNumber" ? RT.SlideNumberMCAtom : 0;
110724
110493
  const text22 = field ? "*" : "";
110725
- const style = buildStyleTextPropAtom(
110726
- {
110727
- paragraphs: [{ indentLevel: 0, runs: [{ text: text22, ...sizePt ? { sizePt } : {} }] }]
110728
- },
110729
- () => fontIndex
110730
- );
110494
+ const style = buildStyleTextPropAtom({
110495
+ paragraphs: [{ indentLevel: 0, runs: [{ text: text22, ...sizePt ? { sizePt } : {} }] }]
110496
+ }, () => fontIndex);
110731
110497
  const w = new ByteWriter().bytes(textHeader(TEXT_TYPE_OTHER));
110732
110498
  if (text22) {
110733
110499
  w.bytes(atom(RT.TextCharsAtom, new ByteWriter().utf16(text22).toBytes()));
@@ -110750,13 +110516,7 @@ function clientTextbox(placeholder, fontIndex) {
110750
110516
  }
110751
110517
  function buildPlaceholderContainer(placeholder, allocator, fontIndex) {
110752
110518
  const spec2 = SPECS[placeholder.kind];
110753
- const fsp = record(
110754
- OA.FSP,
110755
- new ByteWriter().u32(allocator.next()).u32(FSP_FLAGS).toBytes(),
110756
- RECTANGLE_SPT,
110757
- false,
110758
- 2
110759
- );
110519
+ const fsp = record(OA.FSP, new ByteWriter().u32(allocator.next()).u32(FSP_FLAGS).toBytes(), RECTANGLE_SPT, false, 2);
110760
110520
  const simple = [
110761
110521
  { id: 127, value: 32440321 },
110762
110522
  // lock against grouping, as PowerPoint writes
@@ -110813,7 +110573,7 @@ var TITLE_PROMPT;
110813
110573
  var BODY_PROMPT;
110814
110574
  var DEFAULT_FRAMES;
110815
110575
  var init_master_placeholders_writer = __esm({
110816
- "src/core/ppt/writer/master-placeholders-writer.ts"() {
110576
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
110817
110577
  init_record_types();
110818
110578
  init_anchor_writer();
110819
110579
  init_byte_writer();
@@ -110879,6 +110639,15 @@ var init_master_placeholders_writer = __esm({
110879
110639
  };
110880
110640
  }
110881
110641
  });
110642
+ function masterStyleFonts(styles) {
110643
+ if (!styles)
110644
+ return [];
110645
+ return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
110646
+ }
110647
+ var init_master_style_fonts = __esm({
110648
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
110649
+ }
110650
+ });
110882
110651
  function buildMasterStyleAtom(recInstance, levels, fontIndex) {
110883
110652
  const w = new ByteWriter().u16(levels.length);
110884
110653
  for (const level2 of levels) {
@@ -110895,13 +110664,7 @@ function hexBytes(hex42) {
110895
110664
  return out;
110896
110665
  }
110897
110666
  function buildFixedInstanceAtom(recInstance) {
110898
- return record(
110899
- RT.TextMasterStyleAtom,
110900
- hexBytes(FIXED_INSTANCE_DATA[recInstance]),
110901
- recInstance,
110902
- false,
110903
- 0
110904
- );
110667
+ return record(RT.TextMasterStyleAtom, hexBytes(FIXED_INSTANCE_DATA[recInstance]), recInstance, false, 0);
110905
110668
  }
110906
110669
  function buildOtherTextStyle(styles, fontIndex) {
110907
110670
  return styles?.other ? buildMasterStyleAtom(4, styles.other, fontIndex) : buildFixedInstanceAtom(4);
@@ -110909,16 +110672,14 @@ function buildOtherTextStyle(styles, fontIndex) {
110909
110672
  function buildMasterTextStyles(styles, fontIndex) {
110910
110673
  const w = new ByteWriter().bytes(buildMasterStyleAtom(0, styles?.title ?? EMPTY_LEVELS, fontIndex)).bytes(buildMasterStyleAtom(1, styles?.body ?? EMPTY_LEVELS, fontIndex));
110911
110674
  for (const instance of [2, 4, 5, 6, 7, 8]) {
110912
- w.bytes(
110913
- instance === 4 ? buildOtherTextStyle(styles, fontIndex) : buildFixedInstanceAtom(instance)
110914
- );
110675
+ w.bytes(instance === 4 ? buildOtherTextStyle(styles, fontIndex) : buildFixedInstanceAtom(instance));
110915
110676
  }
110916
110677
  return w.toBytes();
110917
110678
  }
110918
110679
  var EMPTY_LEVELS;
110919
110680
  var FIXED_INSTANCE_DATA;
110920
110681
  var init_master_text_styles_writer = __esm({
110921
- "src/core/ppt/writer/master-text-styles-writer.ts"() {
110682
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
110922
110683
  init_record_types();
110923
110684
  init_byte_writer();
110924
110685
  init_text_exception_writer();
@@ -110987,7 +110748,7 @@ function buildShapeFoptProps(input) {
110987
110748
  }
110988
110749
  var DASH_CODE;
110989
110750
  var init_shape_props_writer = __esm({
110990
- "src/core/ppt/writer/shape-props-writer.ts"() {
110751
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
110991
110752
  init_colors();
110992
110753
  init_fopt_writer();
110993
110754
  DASH_CODE = {
@@ -111106,7 +110867,7 @@ var FSP_FLAG_OLE_SHAPE;
111106
110867
  var FSP_FLAG_CHILD;
111107
110868
  var PLACEHOLDER_ID;
111108
110869
  var init_shape_writer = __esm({
111109
- "src/core/ppt/writer/shape-writer.ts"() {
110870
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
111110
110871
  init_record_types();
111111
110872
  init_anchor_writer();
111112
110873
  init_byte_writer();
@@ -111159,13 +110920,9 @@ function buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds,
111159
110920
  return buildGroupContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, inGroup);
111160
110921
  }
111161
110922
  function buildGroupContainer(group2, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, inGroup = false) {
111162
- const data = new ByteWriter().bytes(
111163
- buildNestedGroupPatriarch(group2, allocator, hyperlinks, inGroup)
111164
- );
110923
+ const data = new ByteWriter().bytes(buildNestedGroupPatriarch(group2, allocator, hyperlinks, inGroup));
111165
110924
  for (const child262 of group2.children) {
111166
- data.bytes(
111167
- buildAnyShapeContainer(child262, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, true)
111168
- );
110925
+ data.bytes(buildAnyShapeContainer(child262, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, true));
111169
110926
  }
111170
110927
  return record(OA.SpgrContainer, data.toBytes(), 0, true);
111171
110928
  }
@@ -111174,7 +110931,7 @@ var FSP_FLAG_PATRIARCH;
111174
110931
  var FSP_FLAG_HAVE_ANCHOR;
111175
110932
  var ZERO_RECT;
111176
110933
  var init_group_writer = __esm({
111177
- "src/core/ppt/writer/group-writer.ts"() {
110934
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
111178
110935
  init_record_types();
111179
110936
  init_anchor_writer();
111180
110937
  init_byte_writer();
@@ -111187,7 +110944,7 @@ var init_group_writer = __esm({
111187
110944
  });
111188
110945
  var ShapeIdAllocator2;
111189
110946
  var init_shape_id_allocator = __esm({
111190
- "src/core/ppt/writer/shape-id-allocator.ts"() {
110947
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
111191
110948
  ShapeIdAllocator2 = class {
111192
110949
  current;
111193
110950
  constructor(drawingId, clusterSize) {
@@ -111232,9 +110989,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
111232
110989
  spgrData.bytes(container);
111233
110990
  }
111234
110991
  for (const shape of shapes) {
111235
- spgrData.bytes(
111236
- buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds)
111237
- );
110992
+ spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
111238
110993
  }
111239
110994
  const spgrContainer = record(OA.SpgrContainer, spgrData.toBytes(), 0, true);
111240
110995
  const lastShapeId = allocator.lastIssued;
@@ -111246,7 +111001,7 @@ var FSP_FLAG_BACKGROUND;
111246
111001
  var BACKGROUND_RECT_SPT;
111247
111002
  var SHAPE_ID_CLUSTER_SIZE2;
111248
111003
  var init_drawing_writer = __esm({
111249
- "src/core/ppt/writer/drawing-writer.ts"() {
111004
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
111250
111005
  init_record_types();
111251
111006
  init_byte_writer();
111252
111007
  init_colors();
@@ -111271,22 +111026,11 @@ function buildNotesContainer(paragraphs2, notesRect, slidePersistIdRef, fonts, d
111271
111026
  placeholderType: "body",
111272
111027
  text: { textType: 2, paragraphs: paragraphs2 }
111273
111028
  };
111274
- const data = new ByteWriter().bytes(buildNotesAtom(slidePersistIdRef)).bytes(
111275
- buildDrawing(
111276
- notesRect,
111277
- [bodyShape],
111278
- void 0,
111279
- fonts,
111280
- drawingId,
111281
- hyperlinks,
111282
- oleEmbeds,
111283
- mediaEmbeds
111284
- )
111285
- ).toBytes();
111029
+ const data = new ByteWriter().bytes(buildNotesAtom(slidePersistIdRef)).bytes(buildDrawing(notesRect, [bodyShape], void 0, fonts, drawingId, hyperlinks, oleEmbeds, mediaEmbeds)).toBytes();
111286
111030
  return record(RT.Notes, data, 0, true);
111287
111031
  }
111288
111032
  var init_notes_writer = __esm({
111289
- "src/core/ppt/writer/notes-writer.ts"() {
111033
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
111290
111034
  init_record_types();
111291
111035
  init_byte_writer();
111292
111036
  init_drawing_writer();
@@ -111365,8 +111109,8 @@ function recordBytes(data, rec) {
111365
111109
  }
111366
111110
  var PptParseError;
111367
111111
  var RECORD_HEADER_SIZE;
111368
- var init_record_stream = __esm({
111369
- "src/core/ppt/record-stream.ts"() {
111112
+ var init_legacy_ppt_record_stream = __esm({
111113
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
111370
111114
  PptParseError = class extends Error {
111371
111115
  constructor(message) {
111372
111116
  super(message);
@@ -111376,6 +111120,11 @@ var init_record_stream = __esm({
111376
111120
  RECORD_HEADER_SIZE = 8;
111377
111121
  }
111378
111122
  });
111123
+ var init_record_stream = __esm({
111124
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
111125
+ init_legacy_ppt_record_stream();
111126
+ }
111127
+ });
111379
111128
  function toHex3(r, g2, b) {
111380
111129
  return [r, g2, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
111381
111130
  }
@@ -111427,7 +111176,7 @@ function resolveEscherColor(colorRef, scheme) {
111427
111176
  var SCHEME;
111428
111177
  var DEFAULT_SCHEME;
111429
111178
  var init_color_scheme = __esm({
111430
- "src/core/ppt/color-scheme.ts"() {
111179
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
111431
111180
  init_record_stream();
111432
111181
  init_record_types();
111433
111182
  SCHEME = {
@@ -111460,7 +111209,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
111460
111209
  return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
111461
111210
  }
111462
111211
  var init_color_scheme_writer = __esm({
111463
- "src/core/ppt/writer/color-scheme-writer.ts"() {
111212
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
111464
111213
  init_color_scheme();
111465
111214
  init_record_types();
111466
111215
  init_byte_writer();
@@ -111482,18 +111231,7 @@ function buildMasterSlideAtom() {
111482
111231
  return buildSlideAtomRaw(0, 0, 0, SLIDE_FLAG_MASTER_SCHEME);
111483
111232
  }
111484
111233
  function buildSlideContainer(slide, slideRect, _masterIdRef, notesIdRef, fonts, drawingId, hyperlinks, oleEmbeds, mediaEmbeds) {
111485
- const data = new ByteWriter().bytes(buildSlideAtom(SLIDE_MASTER_ID_SENTINEL, notesIdRef, Boolean(slide.backgroundRgb))).bytes(
111486
- buildDrawing(
111487
- slideRect,
111488
- slide.shapes,
111489
- slide.backgroundRgb,
111490
- fonts,
111491
- drawingId,
111492
- hyperlinks,
111493
- oleEmbeds,
111494
- mediaEmbeds
111495
- )
111496
- ).bytes(buildColorSchemeAtom()).toBytes();
111234
+ const data = new ByteWriter().bytes(buildSlideAtom(SLIDE_MASTER_ID_SENTINEL, notesIdRef, Boolean(slide.backgroundRgb))).bytes(buildDrawing(slideRect, slide.shapes, slide.backgroundRgb, fonts, drawingId, hyperlinks, oleEmbeds, mediaEmbeds)).bytes(buildColorSchemeAtom()).toBytes();
111497
111235
  return record(RT.Slide, data, 0, true);
111498
111236
  }
111499
111237
  function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, mediaEmbeds, masterStyles, fonts, master) {
@@ -111501,25 +111239,9 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
111501
111239
  const idx = name ? fonts.indexOf(name) : -1;
111502
111240
  return idx >= 0 ? idx : void 0;
111503
111241
  };
111504
- const placeholders = completeMasterPlaceholders(
111505
- master?.placeholders ?? [],
111506
- slideRect.w,
111507
- slideRect.h
111508
- );
111242
+ const placeholders = completeMasterPlaceholders(master?.placeholders ?? [], slideRect.w, slideRect.h);
111509
111243
  const roundTrip = (recType, payload) => payload ? record(recType, payload, 0, false, 0) : new Uint8Array(0);
111510
- const data = new ByteWriter().bytes(buildMasterSlideAtom()).bytes(buildColorSchemeAtom(MASTER_FIRST_COLOR_SCHEME_INSTANCE, master?.schemeColors)).bytes(buildMasterTextStyles(masterStyles, fontIndex)).bytes(roundTrip(RT.RoundTripOArtTextStyles12Atom, master?.oartTextStyles)).bytes(
111511
- buildDrawing(
111512
- slideRect,
111513
- [],
111514
- void 0,
111515
- [],
111516
- drawingId,
111517
- hyperlinks,
111518
- oleEmbeds,
111519
- mediaEmbeds,
111520
- (allocator) => buildMasterPlaceholders(placeholders, allocator, fontIndex(master?.themeFonts?.minor))
111521
- )
111522
- ).bytes(buildColorSchemeAtom(void 0, master?.schemeColors)).bytes(roundTrip(RT.RoundTripTheme12Atom, master?.theme)).bytes(roundTrip(RT.RoundTripColorMapping12Atom, master?.colorMapping)).toBytes();
111244
+ const data = new ByteWriter().bytes(buildMasterSlideAtom()).bytes(buildColorSchemeAtom(MASTER_FIRST_COLOR_SCHEME_INSTANCE, master?.schemeColors)).bytes(buildMasterTextStyles(masterStyles, fontIndex)).bytes(roundTrip(RT.RoundTripOArtTextStyles12Atom, master?.oartTextStyles)).bytes(buildDrawing(slideRect, [], void 0, [], drawingId, hyperlinks, oleEmbeds, mediaEmbeds, (allocator) => buildMasterPlaceholders(placeholders, allocator, fontIndex(master?.themeFonts?.minor)))).bytes(buildColorSchemeAtom(void 0, master?.schemeColors)).bytes(roundTrip(RT.RoundTripTheme12Atom, master?.theme)).bytes(roundTrip(RT.RoundTripColorMapping12Atom, master?.colorMapping)).toBytes();
111523
111245
  return record(RT.MainMaster, data, 0, true);
111524
111246
  }
111525
111247
  var SLIDE_FLAG_MASTER_OBJECTS;
@@ -111528,7 +111250,7 @@ var SLIDE_FLAG_MASTER_BACKGROUND;
111528
111250
  var SLIDE_MASTER_ID_SENTINEL;
111529
111251
  var MASTER_FIRST_COLOR_SCHEME_INSTANCE;
111530
111252
  var init_slide_writer = __esm({
111531
- "src/core/ppt/writer/slide-writer.ts"() {
111253
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
111532
111254
  init_record_types();
111533
111255
  init_byte_writer();
111534
111256
  init_color_scheme_writer();
@@ -111563,18 +111285,14 @@ function collectFonts(deck) {
111563
111285
  if (shape.kind !== "shape" || !shape.text) {
111564
111286
  return [];
111565
111287
  }
111566
- return shape.text.paragraphs.flatMap(
111567
- (p) => p.runs.map((r) => r.fontName).filter((n) => Boolean(n))
111568
- );
111288
+ return shape.text.paragraphs.flatMap((p) => p.runs.map((r) => r.fontName).filter((n) => Boolean(n)));
111569
111289
  };
111570
111290
  const themeMinor = deck.master?.themeFonts?.minor;
111571
- const fonts = Array.from(
111572
- /* @__PURE__ */ new Set([
111573
- ...themeMinor ? [themeMinor] : [],
111574
- ...deck.slides.flatMap((slide) => slide.shapes.flatMap(collect2)),
111575
- ...masterStyleFonts(deck.masterStyles)
111576
- ])
111577
- );
111291
+ const fonts = Array.from(/* @__PURE__ */ new Set([
111292
+ ...themeMinor ? [themeMinor] : [],
111293
+ ...deck.slides.flatMap((slide) => slide.shapes.flatMap(collect2)),
111294
+ ...masterStyleFonts(deck.masterStyles)
111295
+ ]));
111578
111296
  return fonts.length > 0 ? fonts : ["Calibri"];
111579
111297
  }
111580
111298
  function layoutDocumentStream(deck) {
@@ -111586,9 +111304,7 @@ function layoutDocumentStream(deck) {
111586
111304
  const masterDrawingId = 1;
111587
111305
  const slideDrawingIds = deck.slides.map((_, i2) => 2 + i2);
111588
111306
  let nextDrawingId = 2 + deck.slides.length;
111589
- const notesDrawingIds = deck.slides.map(
111590
- (slide) => slide.notesParagraphs?.length ? nextDrawingId++ : 0
111591
- );
111307
+ const notesDrawingIds = deck.slides.map((slide) => slide.notesParagraphs?.length ? nextDrawingId++ : 0);
111592
111308
  const shapesPerDrawing = [
111593
111309
  1 + MASTER_PLACEHOLDER_ORDER.length,
111594
111310
  // master: patriarch + its placeholders
@@ -111601,41 +111317,9 @@ function layoutDocumentStream(deck) {
111601
111317
  const hyperlinks = new HyperlinkCollector();
111602
111318
  const oleEmbeds = new OleCollector(hyperlinks);
111603
111319
  const mediaEmbeds = new MediaCollector(hyperlinks);
111604
- const slideContainers = deck.slides.map(
111605
- (slide, i2) => buildSlideContainer(
111606
- slide,
111607
- slideRect,
111608
- MASTER_ID,
111609
- notesIds[i2],
111610
- fonts,
111611
- slideDrawingIds[i2],
111612
- hyperlinks,
111613
- oleEmbeds,
111614
- mediaEmbeds
111615
- )
111616
- );
111617
- const notesContainers = deck.slides.map(
111618
- (slide, i2) => notesIds[i2] ? buildNotesContainer(
111619
- slide.notesParagraphs,
111620
- notesRect,
111621
- slideIds[i2],
111622
- fonts,
111623
- notesDrawingIds[i2],
111624
- hyperlinks,
111625
- oleEmbeds,
111626
- mediaEmbeds
111627
- ) : void 0
111628
- ).filter((c) => c !== void 0);
111629
- const masterContainer = buildMainMasterContainer(
111630
- slideRect,
111631
- masterDrawingId,
111632
- hyperlinks,
111633
- oleEmbeds,
111634
- mediaEmbeds,
111635
- deck.masterStyles,
111636
- fonts,
111637
- deck.master
111638
- );
111320
+ const slideContainers = deck.slides.map((slide, i2) => buildSlideContainer(slide, slideRect, MASTER_ID, notesIds[i2], fonts, slideDrawingIds[i2], hyperlinks, oleEmbeds, mediaEmbeds));
111321
+ const notesContainers = deck.slides.map((slide, i2) => notesIds[i2] ? buildNotesContainer(slide.notesParagraphs, notesRect, slideIds[i2], fonts, notesDrawingIds[i2], hyperlinks, oleEmbeds, mediaEmbeds) : void 0).filter((c) => c !== void 0);
111322
+ const masterContainer = buildMainMasterContainer(slideRect, masterDrawingId, hyperlinks, oleEmbeds, mediaEmbeds, deck.masterStyles, fonts, deck.master);
111639
111323
  const masterPersistAtom = buildSlidePersistAtom(MASTER_ID, MASTER_SLIDE_ID_SENTINEL);
111640
111324
  const slidePersistAtoms = slideIds.map((id, i2) => buildSlidePersistAtom(id, 256 + i2, 4));
111641
111325
  const oleStgIds = oleEmbeds.all.map(() => nextId2++);
@@ -111692,14 +111376,14 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
111692
111376
  var DOC_ID;
111693
111377
  var MASTER_ID;
111694
111378
  var init_document_stream_layout = __esm({
111695
- "src/core/ppt/writer/document-stream-layout.ts"() {
111379
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
111696
111380
  init_bstore_writer();
111697
111381
  init_byte_writer();
111698
111382
  init_document_writer();
111699
111383
  init_ex_obj_list_writer();
111700
111384
  init_hyperlink_writer();
111701
111385
  init_master_placeholders_writer();
111702
- init_master_style_convert();
111386
+ init_master_style_fonts();
111703
111387
  init_master_text_styles_writer();
111704
111388
  init_media_writer();
111705
111389
  init_notes_writer();
@@ -111709,6 +111393,12 @@ var init_document_stream_layout = __esm({
111709
111393
  MASTER_ID = 2;
111710
111394
  }
111711
111395
  });
111396
+ var RC4_ALG_ID2;
111397
+ var init_crypto_constants = __esm({
111398
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
111399
+ RC4_ALG_ID2 = 26625;
111400
+ }
111401
+ });
111712
111402
  function rc4Cipher(key2, data) {
111713
111403
  if (key2.length === 0) {
111714
111404
  throw new Error("RC4 key must not be empty.");
@@ -111739,7 +111429,7 @@ function rc4Cipher(key2, data) {
111739
111429
  return out;
111740
111430
  }
111741
111431
  var init_rc4_cipher = __esm({
111742
- "src/core/utils/rc4-cipher.ts"() {
111432
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
111743
111433
  }
111744
111434
  });
111745
111435
  async function rc4CryptoApiKeyBase(password, salt) {
@@ -111782,7 +111472,7 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
111782
111472
  }
111783
111473
  var PADDED_40_BIT_KEY_BYTES;
111784
111474
  var init_rc4_cryptoapi_key = __esm({
111785
- "src/core/ppt/rc4-cryptoapi-key.ts"() {
111475
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
111786
111476
  init_ooxml_crypto_primitives();
111787
111477
  init_rc4_cipher();
111788
111478
  PADDED_40_BIT_KEY_BYTES = 16;
@@ -111860,7 +111550,7 @@ var BITMAP_TAG_SIZE;
111860
111550
  var METAFILE_BLIPS;
111861
111551
  var BITMAP_BLIPS;
111862
111552
  var init_rc4_cryptoapi_streams = __esm({
111863
- "src/core/ppt/rc4-cryptoapi-streams.ts"() {
111553
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
111864
111554
  init_rc4_cipher();
111865
111555
  init_record_stream();
111866
111556
  UID_SIZE = 16;
@@ -111877,12 +111567,9 @@ async function buildCryptSession(password) {
111877
111567
  const keyFor3 = (block) => rc4CryptoApiBlockKey(base, KEY_SIZE_BITS, block);
111878
111568
  const verifier = new Uint8Array(VERIFIER_SIZE);
111879
111569
  crypto.getRandomValues(verifier);
111880
- const { encryptedVerifier, encryptedVerifierHash } = await rc4CryptoApiEncryptVerifier(
111881
- await keyFor3(0),
111882
- verifier
111883
- );
111570
+ const { encryptedVerifier, encryptedVerifierHash } = await rc4CryptoApiEncryptVerifier(await keyFor3(0), verifier);
111884
111571
  const cspNameBytes = new ByteWriter().utf16(CSP_NAME).u16(0).toBytes();
111885
- const header = new ByteWriter().u32(ENCRYPTION_FLAGS).u32(0).u32(RC4_ALG_ID).u32(32772).u32(KEY_SIZE_BITS).u32(1).u32(0).u32(0).bytes(cspNameBytes).toBytes();
111572
+ const header = new ByteWriter().u32(ENCRYPTION_FLAGS).u32(0).u32(RC4_ALG_ID2).u32(32772).u32(KEY_SIZE_BITS).u32(1).u32(0).u32(0).bytes(cspNameBytes).toBytes();
111886
111573
  const verifierBlock = new ByteWriter().u32(SALT_SIZE).bytes(salt).bytes(encryptedVerifier).u32(VERIFIER_HASH_SIZE).bytes(encryptedVerifierHash).toBytes();
111887
111574
  const infoBlob = new ByteWriter().u16(4).u16(2).u32(ENCRYPTION_FLAGS).u32(header.length).bytes(header).bytes(verifierBlock).toBytes();
111888
111575
  return {
@@ -111905,8 +111592,8 @@ var VERIFIER_SIZE;
111905
111592
  var VERIFIER_HASH_SIZE;
111906
111593
  var ENCRYPTION_FLAGS;
111907
111594
  var init_encrypt_writer = __esm({
111908
- "src/core/ppt/writer/encrypt-writer.ts"() {
111909
- init_ooxml_crypto_key_derivation();
111595
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
111596
+ init_crypto_constants();
111910
111597
  init_rc4_cryptoapi_key();
111911
111598
  init_rc4_cryptoapi_streams();
111912
111599
  init_record_types();
@@ -111984,7 +111671,7 @@ function withMasterRelativeRunStyles(deck) {
111984
111671
  }
111985
111672
  var STYLE_KEYS;
111986
111673
  var init_master_relative_runs = __esm({
111987
- "src/core/ppt/writer/master-relative-runs.ts"() {
111674
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
111988
111675
  STYLE_KEYS = ["bold", "italic", "underline"];
111989
111676
  }
111990
111677
  });
@@ -112017,7 +111704,7 @@ function buildEncryptedUserEditAtom(input) {
112017
111704
  }
112018
111705
  var MAX_RUN;
112019
111706
  var init_persist_writer = __esm({
112020
- "src/core/ppt/writer/persist-writer.ts"() {
111707
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
112021
111708
  init_record_types();
112022
111709
  init_byte_writer();
112023
111710
  MAX_RUN = 4095;
@@ -112025,7 +111712,7 @@ var init_persist_writer = __esm({
112025
111712
  });
112026
111713
  var PPT_STORAGE_CLSID;
112027
111714
  var init_ppt_clsid = __esm({
112028
- "src/core/ppt/writer/ppt-clsid.ts"() {
111715
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
112029
111716
  PPT_STORAGE_CLSID = new Uint8Array([
112030
111717
  16,
112031
111718
  141,
@@ -112099,7 +111786,7 @@ async function buildPptFile(deck, options = {}) {
112099
111786
  return new Uint8Array(buildOle2(streams, PPT_STORAGE_CLSID, 0));
112100
111787
  }
112101
111788
  var init_write_ppt = __esm({
112102
- "src/core/ppt/writer/write-ppt.ts"() {
111789
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
112103
111790
  init_ole2_parser_write();
112104
111791
  init_byte_writer();
112105
111792
  init_current_user_writer();
@@ -112110,6 +111797,522 @@ var init_write_ppt = __esm({
112110
111797
  init_ppt_clsid();
112111
111798
  }
112112
111799
  });
111800
+ var init_legacy_ppt_writer = __esm({
111801
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
111802
+ init_write_ppt();
111803
+ init_master_style_fonts();
111804
+ }
111805
+ });
111806
+ function fontNameOf(style, themeFonts) {
111807
+ const family2 = style.resolvedFontFamily ?? style.fontFamily;
111808
+ if (family2?.startsWith("+mj-")) {
111809
+ return themeFonts.major;
111810
+ }
111811
+ if (family2?.startsWith("+mn-")) {
111812
+ return themeFonts.minor;
111813
+ }
111814
+ return family2 && !family2.startsWith("+") ? family2 : void 0;
111815
+ }
111816
+ function hexOf(color2) {
111817
+ const hex42 = color2?.replace(/^#/u, "");
111818
+ return hex42 && /^[0-9a-f]{6}$/iu.test(hex42) ? hex42.toUpperCase() : void 0;
111819
+ }
111820
+ function toLevel(style = {}, themeFonts = {}) {
111821
+ const bulletChar = style.bulletNone ? void 0 : style.bulletChar;
111822
+ return {
111823
+ paragraph: {
111824
+ align: style.alignment ? ALIGN_MAP3[style.alignment] : void 0,
111825
+ hasBullet: style.bulletNone ? false : bulletChar ? true : void 0,
111826
+ bulletChar,
111827
+ bulletColorRgb: hexOf(style.bulletColor),
111828
+ marginLeftEmu: style.marginLeft !== void 0 ? style.marginLeft * EMU_PER_PX : void 0,
111829
+ indentEmu: style.indent !== void 0 ? style.indent * EMU_PER_PX : void 0
111830
+ },
111831
+ // Explicit, as PowerPoint's own master levels are (full CF masks): a
111832
+ // binary master level otherwise inherits bold/italic from the level
111833
+ // above it, unlike an OOXML `a:lvlNpPr`.
111834
+ run: {
111835
+ bold: style.bold ?? false,
111836
+ italic: style.italic ?? false,
111837
+ underline: false,
111838
+ sizePt: style.fontSize !== void 0 ? style.fontSize * 72 / 96 : void 0,
111839
+ colorRgb: hexOf(style.color),
111840
+ fontName: fontNameOf(style, themeFonts)
111841
+ }
111842
+ };
111843
+ }
111844
+ function toLevels(levels, count, themeFonts) {
111845
+ if (!levels) {
111846
+ return void 0;
111847
+ }
111848
+ const defined = [0, 1, 2, 3, 4].filter((i2) => levels[i2] !== void 0);
111849
+ if (defined.length === 0) {
111850
+ return void 0;
111851
+ }
111852
+ const base = levels[-1];
111853
+ return Array.from(
111854
+ { length: count },
111855
+ (_, i2) => toLevel(base || levels[i2] ? { ...base, ...levels[i2] } : void 0, themeFonts)
111856
+ );
111857
+ }
111858
+ function convertMasterTextStyles(styles, themeFonts = {}) {
111859
+ if (!styles) {
111860
+ return void 0;
111861
+ }
111862
+ const out = {
111863
+ title: toLevels(styles.titleStyle, TITLE_LEVELS, themeFonts),
111864
+ body: toLevels(styles.bodyStyle, PPT_MASTER_LEVELS, themeFonts),
111865
+ other: toLevels(styles.otherStyle, PPT_MASTER_LEVELS, themeFonts)
111866
+ };
111867
+ return out.title || out.body || out.other ? out : void 0;
111868
+ }
111869
+ var PPT_MASTER_LEVELS;
111870
+ var TITLE_LEVELS;
111871
+ var ALIGN_MAP3;
111872
+ var init_master_style_convert = __esm({
111873
+ "src/core/ppt/writer/master-style-convert.ts"() {
111874
+ init_constants();
111875
+ init_legacy_ppt_writer();
111876
+ PPT_MASTER_LEVELS = 5;
111877
+ TITLE_LEVELS = 1;
111878
+ ALIGN_MAP3 = {
111879
+ left: "l",
111880
+ l: "l",
111881
+ center: "ctr",
111882
+ ctr: "ctr",
111883
+ right: "r",
111884
+ r: "r",
111885
+ justify: "just",
111886
+ just: "just",
111887
+ justLow: "just",
111888
+ dist: "just",
111889
+ thaiDist: "just"
111890
+ };
111891
+ }
111892
+ });
111893
+ function relsPath(partPath) {
111894
+ const slash = partPath.lastIndexOf("/");
111895
+ return `${partPath.slice(0, slash)}/_rels/${partPath.slice(slash + 1)}.rels`;
111896
+ }
111897
+ async function readText(zip, path) {
111898
+ return zip.file(path)?.async("string");
111899
+ }
111900
+ async function followRel(zip, from, type) {
111901
+ const rels = await readText(zip, relsPath(from));
111902
+ const rel = rels ? parseRels(rels).find((r) => r.type === `${REL}/${type}`) : void 0;
111903
+ return rel && !rel.external ? resolveTarget2(from, rel.target) : void 0;
111904
+ }
111905
+ async function firstSlideMasterPath(zip) {
111906
+ const presentation = "ppt/presentation.xml";
111907
+ const xml = await readText(zip, presentation);
111908
+ const firstSlideRid = xml ? /<p:sldId\b[^>]*\br:id="([^"]+)"/u.exec(xml)?.[1] : void 0;
111909
+ const rels = await readText(zip, relsPath(presentation));
111910
+ const slideRel = rels ? parseRels(rels).find((r) => r.id === firstSlideRid) : void 0;
111911
+ const slide = slideRel ? resolveTarget2(presentation, slideRel.target) : void 0;
111912
+ const layout = slide ? await followRel(zip, slide, "slideLayout") : void 0;
111913
+ const master = layout ? await followRel(zip, layout, "slideMaster") : void 0;
111914
+ return master && zip.file(master) ? master : FALLBACK_MASTER;
111915
+ }
111916
+ function num2(xml, pattern) {
111917
+ const value = pattern.exec(xml)?.[1];
111918
+ return value === void 0 ? void 0 : Number(value);
111919
+ }
111920
+ function readPlaceholders(masterXml) {
111921
+ const out = [];
111922
+ for (const [sp] of masterXml.matchAll(/<p:sp\b[\s\S]*?<\/p:sp>/gu)) {
111923
+ const phType = /<p:ph\b([^>]*)>/u.exec(sp)?.[1];
111924
+ if (phType === void 0) {
111925
+ continue;
111926
+ }
111927
+ const kind = PLACEHOLDER_KINDS[/\btype="([^"]+)"/u.exec(phType)?.[1] ?? "body"];
111928
+ const x = num2(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
111929
+ const y = num2(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
111930
+ const w = num2(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
111931
+ const h2 = num2(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
111932
+ if (!kind || x === void 0 || y === void 0 || !w || !h2 || out.some((p) => p.kind === kind)) {
111933
+ continue;
111934
+ }
111935
+ const size = num2(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
111936
+ out.push({ kind, rect: { x, y, w, h: h2 }, ...size ? { sizePt: size / 100 } : {} });
111937
+ }
111938
+ return out;
111939
+ }
111940
+ function readTxStyles(masterXml) {
111941
+ const txStyles = /<p:txStyles\b[\s\S]*?<\/p:txStyles>/u.exec(masterXml)?.[0];
111942
+ const root = /<p:sldMaster\b[^>]*>/u.exec(masterXml)?.[0] ?? "";
111943
+ if (!txStyles) {
111944
+ return void 0;
111945
+ }
111946
+ const startTag = /^<p:txStyles\b[^>]*>/u.exec(txStyles)?.[0] ?? "";
111947
+ const declarations3 = [...root.matchAll(/\s(xmlns(?::\w+)?)="[^"]*"/gu)].filter((m) => !startTag.includes(` ${m[1]}=`)).map((m) => m[0]);
111948
+ return txStyles.replace(/^<p:txStyles\b/u, `<p:txStyles${declarations3.join("")}`);
111949
+ }
111950
+ function themeColor(themeXml3, slot) {
111951
+ const body = new RegExp(`<a:${slot}>([\\s\\S]*?)</a:${slot}>`, "u").exec(themeXml3)?.[1];
111952
+ if (!body) {
111953
+ return void 0;
111954
+ }
111955
+ return (/\bval="([0-9A-Fa-f]{6})"/u.exec(body) ?? /\blastClr="([0-9A-Fa-f]{6})"/u.exec(body))?.[1];
111956
+ }
111957
+ function schemeColorsFor(themeXml3, clrMapAttributes) {
111958
+ const mapped = (alias, fallback) => clrMapAttributes && new RegExp(`\\b${alias}="(\\w+)"`, "u").exec(clrMapAttributes)?.[1] || fallback;
111959
+ const slots = [
111960
+ mapped("bg1", "lt1"),
111961
+ mapped("tx1", "dk1"),
111962
+ mapped("bg2", "lt2"),
111963
+ mapped("tx2", "dk2"),
111964
+ "accent1",
111965
+ "accent2",
111966
+ "hlink",
111967
+ "folHlink"
111968
+ ];
111969
+ const colors = slots.map((slot) => themeColor(themeXml3, slot)?.toUpperCase());
111970
+ return colors.every((c) => c !== void 0) ? colors : void 0;
111971
+ }
111972
+ function latinFace(themeXml3, scheme) {
111973
+ const open = themeXml3.indexOf(`<a:${scheme}>`);
111974
+ const close = open < 0 ? -1 : themeXml3.indexOf(`</a:${scheme}>`, open);
111975
+ const body = close < 0 ? void 0 : themeXml3.slice(open, close);
111976
+ return body && /<a:latin [^>]*typeface="([^"]+)"/u.exec(body)?.[1] || void 0;
111977
+ }
111978
+ async function readMasterRoundTripSource(zip) {
111979
+ const masterPath = await firstSlideMasterPath(zip);
111980
+ const masterXml = await readText(zip, masterPath);
111981
+ if (!masterXml) {
111982
+ return { placeholders: [], themeFonts: {} };
111983
+ }
111984
+ const clrMapAttributes = /<p:clrMap\b([^>]*?)\/?>/u.exec(masterXml)?.[1]?.trim();
111985
+ const themePath = await followRel(zip, masterPath, "theme");
111986
+ const themeXml3 = themePath ? await readText(zip, themePath) : void 0;
111987
+ return {
111988
+ placeholders: readPlaceholders(masterXml),
111989
+ txStylesXml: readTxStyles(masterXml),
111990
+ clrMapAttributes,
111991
+ themeXml: themeXml3,
111992
+ schemeColors: themeXml3 ? schemeColorsFor(themeXml3, clrMapAttributes) : void 0,
111993
+ themeFonts: {
111994
+ major: themeXml3 ? latinFace(themeXml3, "majorFont") : void 0,
111995
+ minor: themeXml3 ? latinFace(themeXml3, "minorFont") : void 0
111996
+ }
111997
+ };
111998
+ }
111999
+ var REL;
112000
+ var FALLBACK_MASTER;
112001
+ var PLACEHOLDER_KINDS;
112002
+ var init_master_roundtrip_source = __esm({
112003
+ "src/core/ppt/writer/master-roundtrip-source.ts"() {
112004
+ init_metro_blob_source();
112005
+ REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
112006
+ FALLBACK_MASTER = "ppt/slideMasters/slideMaster1.xml";
112007
+ PLACEHOLDER_KINDS = {
112008
+ title: "title",
112009
+ body: "body",
112010
+ dt: "date",
112011
+ ftr: "footer",
112012
+ sldNum: "slideNumber"
112013
+ };
112014
+ }
112015
+ });
112016
+ function contentTypes(overrides28) {
112017
+ const parts = overrides28.map(([name, type]) => `<Override PartName="/${name}" ContentType="${PML_CT}.${type}"/>`).join("");
112018
+ return `${XML_DECL2}\r
112019
+ <Types xmlns="${CT_NS2}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${parts}</Types>`;
112020
+ }
112021
+ function relationships(type, target) {
112022
+ return `${XML_DECL2}\r
112023
+ <Relationships xmlns="${REL_NS2}"><Relationship Id="rId1" Type="${OFFICE_REL}/${type}" Target="${target}"/></Relationships>`;
112024
+ }
112025
+ function withDeclaration(xml) {
112026
+ const body = xml.replace(/^?<\?xml[^>]*\?>\s*/u, "");
112027
+ return `${XML_DECL2}\r
112028
+ ${body}`;
112029
+ }
112030
+ async function zipParts(parts) {
112031
+ const zip = new JSZip3__default.default();
112032
+ for (const [name, text22] of parts) {
112033
+ zip.file(name, text22);
112034
+ }
112035
+ return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
112036
+ }
112037
+ function buildOArtTextStylesPackage(txStylesXml) {
112038
+ const part = "drs/slideMasters/slideMaster1.xml";
112039
+ return zipParts([
112040
+ ["[Content_Types].xml", contentTypes([[part, "presentationml.slideMaster+xml"]])],
112041
+ ["_rels/.rels", relationships("slideMaster", part)],
112042
+ [part, withDeclaration(txStylesXml)]
112043
+ ]);
112044
+ }
112045
+ function buildThemePackage(themeXml3) {
112046
+ const manager = "theme/theme/themeManager.xml";
112047
+ return zipParts([
112048
+ [
112049
+ "[Content_Types].xml",
112050
+ contentTypes([
112051
+ [manager, "themeManager+xml"],
112052
+ ["theme/theme/theme1.xml", "theme+xml"]
112053
+ ])
112054
+ ],
112055
+ ["_rels/.rels", relationships("officeDocument", manager)],
112056
+ [manager, `${XML_DECL2}\r
112057
+ <a:themeManager xmlns:a="${A_NS2}"/>`],
112058
+ ["theme/theme/_rels/themeManager.xml.rels", relationships("theme", "theme1.xml")],
112059
+ ["theme/theme/theme1.xml", withDeclaration(themeXml3)]
112060
+ ]);
112061
+ }
112062
+ function buildColorMapping(clrMapAttributes) {
112063
+ const attributes = clrMapAttributes.replace(/\s*xmlns(?::\w+)?="[^"]*"/gu, "").trim();
112064
+ return new TextEncoder().encode(`${XML_DECL2}\r
112065
+ <a:clrMap xmlns:a="${A_NS2}" ${attributes}/>`);
112066
+ }
112067
+ async function buildMasterRoundTrip(source) {
112068
+ return {
112069
+ placeholders: source.placeholders,
112070
+ schemeColors: source.schemeColors,
112071
+ themeFonts: source.themeFonts,
112072
+ oartTextStyles: source.txStylesXml ? await buildOArtTextStylesPackage(source.txStylesXml) : void 0,
112073
+ theme: source.themeXml ? await buildThemePackage(source.themeXml) : void 0,
112074
+ colorMapping: source.clrMapAttributes ? buildColorMapping(source.clrMapAttributes) : void 0
112075
+ };
112076
+ }
112077
+ async function buildMasterRoundTripFromPptx(pptxBytes) {
112078
+ return buildMasterRoundTrip(await readMasterRoundTripSource(await JSZip3__default.default.loadAsync(pptxBytes)));
112079
+ }
112080
+ var XML_DECL2;
112081
+ var CT_NS2;
112082
+ var REL_NS2;
112083
+ var OFFICE_REL;
112084
+ var A_NS2;
112085
+ var PML_CT;
112086
+ var init_master_roundtrip_writer = __esm({
112087
+ "src/core/ppt/writer/master-roundtrip-writer.ts"() {
112088
+ init_master_roundtrip_source();
112089
+ XML_DECL2 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
112090
+ CT_NS2 = "http://schemas.openxmlformats.org/package/2006/content-types";
112091
+ REL_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships";
112092
+ OFFICE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
112093
+ A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
112094
+ PML_CT = "application/vnd.openxmlformats-officedocument";
112095
+ }
112096
+ });
112097
+ function isNodeCanvasModule(value) {
112098
+ const candidate = value;
112099
+ return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
112100
+ }
112101
+ function loadNodeCanvas() {
112102
+ nodeCanvas ??= (async () => {
112103
+ const runtime = globalThis.process;
112104
+ if (!runtime?.versions?.node) {
112105
+ return void 0;
112106
+ }
112107
+ try {
112108
+ const imported = await import(
112109
+ /* webpackIgnore: true */
112110
+ /* @vite-ignore */
112111
+ NODE_CANVAS_SPECIFIER
112112
+ );
112113
+ const withDefault = imported;
112114
+ if (isNodeCanvasModule(imported)) {
112115
+ return imported;
112116
+ }
112117
+ return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
112118
+ } catch {
112119
+ return void 0;
112120
+ }
112121
+ })();
112122
+ return nodeCanvas;
112123
+ }
112124
+ async function rasterizeSvgInNode(svg, sizeFor) {
112125
+ const canvasModule = await loadNodeCanvas();
112126
+ if (!canvasModule) {
112127
+ return void 0;
112128
+ }
112129
+ try {
112130
+ const image = await canvasModule.loadImage(svg);
112131
+ const { width, height } = sizeFor(image.width, image.height);
112132
+ const canvas = canvasModule.createCanvas(width, height);
112133
+ canvas.getContext("2d").drawImage(image, 0, 0, width, height);
112134
+ return new Uint8Array(canvas.toBuffer("image/png"));
112135
+ } catch {
112136
+ return void 0;
112137
+ }
112138
+ }
112139
+ var NODE_CANVAS_SPECIFIER;
112140
+ var nodeCanvas;
112141
+ var init_svg_rasterize_node = __esm({
112142
+ "src/core/ppt/writer/svg-rasterize-node.ts"() {
112143
+ NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
112144
+ }
112145
+ });
112146
+ function hasDomRasteriser() {
112147
+ return typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
112148
+ }
112149
+ function svgRasterSize(intrinsicW, intrinsicH, fallbackW, fallbackH) {
112150
+ const baseW = intrinsicW || fallbackW;
112151
+ const baseH = intrinsicH || fallbackH;
112152
+ const scale2 = Math.min(2, MAX_EDGE_PX / Math.max(baseW, baseH, 1));
112153
+ return {
112154
+ width: Math.max(1, Math.round(baseW * scale2)),
112155
+ height: Math.max(1, Math.round(baseH * scale2))
112156
+ };
112157
+ }
112158
+ function loadImage(url) {
112159
+ return new Promise((resolve3) => {
112160
+ const img = new Image();
112161
+ img.onload = () => resolve3(img);
112162
+ img.onerror = () => resolve3(void 0);
112163
+ img.src = url;
112164
+ });
112165
+ }
112166
+ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
112167
+ const url = URL.createObjectURL(new Blob([svg.slice()], { type: "image/svg+xml" }));
112168
+ try {
112169
+ const img = await loadImage(url);
112170
+ if (!img) {
112171
+ return void 0;
112172
+ }
112173
+ const size = svgRasterSize(img.naturalWidth, img.naturalHeight, fallbackW, fallbackH);
112174
+ const canvas = document.createElement("canvas");
112175
+ canvas.width = size.width;
112176
+ canvas.height = size.height;
112177
+ const context = canvas.getContext("2d");
112178
+ if (!context) {
112179
+ return void 0;
112180
+ }
112181
+ context.drawImage(img, 0, 0, canvas.width, canvas.height);
112182
+ const blob = await new Promise((resolve3) => {
112183
+ canvas.toBlob(resolve3, "image/png");
112184
+ });
112185
+ return blob ? new Uint8Array(await blob.arrayBuffer()) : void 0;
112186
+ } catch {
112187
+ return void 0;
112188
+ } finally {
112189
+ URL.revokeObjectURL(url);
112190
+ }
112191
+ }
112192
+ async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
112193
+ const png = hasDomRasteriser() ? await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx) : await rasterizeSvgInNode(
112194
+ svg,
112195
+ (w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx)
112196
+ );
112197
+ return png ? { extension: "png", bytes: png } : void 0;
112198
+ }
112199
+ var MAX_EDGE_PX;
112200
+ var init_svg_rasterize = __esm({
112201
+ "src/core/ppt/writer/svg-rasterize.ts"() {
112202
+ init_svg_rasterize_node();
112203
+ MAX_EDGE_PX = 2048;
112204
+ }
112205
+ });
112206
+ async function tiffToPicture(bytes) {
112207
+ try {
112208
+ const imported = await import('./UTIF-POYWAAGO.js');
112209
+ const utif = "default" in imported ? imported.default : imported;
112210
+ const buffer = bytes.slice().buffer;
112211
+ const page = utif.decode(buffer)[0];
112212
+ if (!page) {
112213
+ return void 0;
112214
+ }
112215
+ utif.decodeImage(buffer, page);
112216
+ const width = Number(page.width);
112217
+ const height = Number(page.height);
112218
+ if (!(width > 0 && height > 0)) {
112219
+ return void 0;
112220
+ }
112221
+ return {
112222
+ extension: "png",
112223
+ bytes: encodePng(width, height, new Uint8Array(utif.toRGBA8(page)))
112224
+ };
112225
+ } catch {
112226
+ return void 0;
112227
+ }
112228
+ }
112229
+ async function fetchBlobUrl(url) {
112230
+ if (!url?.startsWith("blob:") || typeof fetch === "undefined") {
112231
+ return void 0;
112232
+ }
112233
+ try {
112234
+ return new Uint8Array(await (await fetch(url)).arrayBuffer());
112235
+ } catch {
112236
+ return void 0;
112237
+ }
112238
+ }
112239
+ function pathFormat(path) {
112240
+ const ext = /\.([^./\\]+)$/u.exec(path)?.[1]?.toLowerCase();
112241
+ return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
112242
+ }
112243
+ async function toPicture(bytes, el) {
112244
+ const format2 = sniffImageFormat(bytes);
112245
+ if (format2 === "tiff") {
112246
+ return tiffToPicture(bytes);
112247
+ }
112248
+ if (format2 === "svg") {
112249
+ return rasterizeSvg(bytes, el.width || 1, el.height || 1);
112250
+ }
112251
+ return bytesToPicture(bytes);
112252
+ }
112253
+ async function resolveOne(el, source, readPart) {
112254
+ const inline = decodeBase64DataUrl(source.inline);
112255
+ const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
112256
+ const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
112257
+ if (inline && (!partFormat || partFormat === inlineFormat)) {
112258
+ return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
112259
+ }
112260
+ const part = source.partPath ? await readPart(source.partPath) : void 0;
112261
+ const fromPart = part ? await toPicture(part, el) : void 0;
112262
+ if (fromPart) {
112263
+ return fromPart;
112264
+ }
112265
+ if (inline && bytesToPicture(inline)) {
112266
+ return void 0;
112267
+ }
112268
+ const fetched = await fetchBlobUrl(source.inline);
112269
+ const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
112270
+ if (fromFetch || !source.svgPath) {
112271
+ return fromFetch;
112272
+ }
112273
+ const svg = await readPart(source.svgPath);
112274
+ return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
112275
+ }
112276
+ async function resolvePictureSources(slides, readPart) {
112277
+ const pending = [];
112278
+ const walk3 = (elements2) => {
112279
+ for (const el of elements2) {
112280
+ const source = pictureSourceOf(el);
112281
+ if (source) {
112282
+ pending.push([el, source]);
112283
+ } else if (el.type === "group") {
112284
+ walk3(el.children);
112285
+ }
112286
+ }
112287
+ };
112288
+ for (const slide of slides) {
112289
+ walk3(slide.elements);
112290
+ }
112291
+ const resolved = /* @__PURE__ */ new Map();
112292
+ await Promise.all(
112293
+ pending.map(async ([el, source]) => {
112294
+ const picture = await resolveOne(el, source, readPart);
112295
+ if (picture) {
112296
+ resolved.set(el, picture);
112297
+ }
112298
+ })
112299
+ );
112300
+ return resolved;
112301
+ }
112302
+ var init_picture_resolve = __esm({
112303
+ "src/core/ppt/writer/picture-resolve.ts"() {
112304
+ init_png_encoder2();
112305
+ init_picture_encode();
112306
+ init_picture_source();
112307
+ init_raster_utils();
112308
+ init_svg_rasterize();
112309
+ }
112310
+ });
112311
+ var init_write_ppt2 = __esm({
112312
+ "src/core/ppt/writer/write-ppt.ts"() {
112313
+ init_legacy_ppt_writer();
112314
+ }
112315
+ });
112113
112316
  var init_writer = __esm({
112114
112317
  "src/core/ppt/writer/index.ts"() {
112115
112318
  init_element_to_write_model();
@@ -112117,7 +112320,7 @@ var init_writer = __esm({
112117
112320
  init_master_style_convert();
112118
112321
  init_master_roundtrip_writer();
112119
112322
  init_picture_resolve();
112120
- init_write_ppt();
112323
+ init_write_ppt2();
112121
112324
  }
112122
112325
  });
112123
112326
  function findViewKey(node, name) {
@@ -130653,7 +130856,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
130653
130856
  }
130654
130857
  });
130655
130858
  const rawParser = this._originalParser || this.parser;
130656
- const parse2 = typeof rawParser.parse === "function" ? rawParser.parse.bind(rawParser) : this.parser.parse.bind(this.parser);
130859
+ const parse = typeof rawParser.parse === "function" ? rawParser.parse.bind(rawParser) : this.parser.parse.bind(this.parser);
130657
130860
  for (const path of xmlPaths) {
130658
130861
  const file = this.zip.file(path);
130659
130862
  if (!file) {
@@ -130668,7 +130871,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
130668
130871
  continue;
130669
130872
  }
130670
130873
  try {
130671
- const parsed = parse2(xmlText2);
130874
+ const parsed = parse(xmlText2);
130672
130875
  if (typeof parsed !== "object" || parsed === null) {
130673
130876
  continue;
130674
130877
  }
@@ -146819,10 +147022,10 @@ function picBlipEmbedId(pic, getChild) {
146819
147022
  const embed = String(blip["@_r:embed"] || blip["@_embed"] || blip["@_r:link"] || "").trim();
146820
147023
  return embed.length > 0 ? embed : void 0;
146821
147024
  }
146822
- function parseDrawingRelTargets(relsXml, parse2, ensureArray20) {
147025
+ function parseDrawingRelTargets(relsXml, parse, ensureArray20) {
146823
147026
  const map = /* @__PURE__ */ new Map();
146824
147027
  try {
146825
- const relsRoot = parse2(relsXml)["Relationships"];
147028
+ const relsRoot = parse(relsXml)["Relationships"];
146826
147029
  if (!relsRoot) {
146827
147030
  return map;
146828
147031
  }
@@ -150266,6 +150469,16 @@ var init_core = __esm({
150266
150469
  init_table_style_entry_parse();
150267
150470
  }
150268
150471
  });
150472
+ var init_record_stream2 = __esm({
150473
+ "src/core/ppt/record-stream.ts"() {
150474
+ init_legacy_ppt_record_stream();
150475
+ }
150476
+ });
150477
+ var init_record_types2 = __esm({
150478
+ "src/core/ppt/record-types.ts"() {
150479
+ init_legacy_ppt_record_types();
150480
+ }
150481
+ });
150269
150482
  function parseCurrentUserAtom(stream) {
150270
150483
  const view = new DataView(stream.buffer, stream.byteOffset, stream.byteLength);
150271
150484
  const rec = readRecordOrThrow(view, 0);
@@ -150299,8 +150512,8 @@ function parseCurrentUserAtom(stream) {
150299
150512
  var EncryptedPptError;
150300
150513
  var init_current_user = __esm({
150301
150514
  "src/core/ppt/current-user.ts"() {
150302
- init_record_stream();
150303
- init_record_types();
150515
+ init_record_stream2();
150516
+ init_record_types2();
150304
150517
  EncryptedPptError = class extends Error {
150305
150518
  isEncrypted = true;
150306
150519
  constructor(message = "This is a password-protected PowerPoint 97-2003 (.ppt) file. Encrypted .ppt files are not supported.") {
@@ -150310,6 +150523,11 @@ var init_current_user = __esm({
150310
150523
  };
150311
150524
  }
150312
150525
  });
150526
+ var init_color_scheme2 = __esm({
150527
+ "src/core/ppt/color-scheme.ts"() {
150528
+ init_color_scheme();
150529
+ }
150530
+ });
150313
150531
  var ByteCursor;
150314
150532
  var init_byte_cursor = __esm({
150315
150533
  "src/core/ppt/text/byte-cursor.ts"() {
@@ -150519,7 +150737,7 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
150519
150737
  var ALIGN_MAP4;
150520
150738
  var init_style_props = __esm({
150521
150739
  "src/core/ppt/text/style-props.ts"() {
150522
- init_color_scheme();
150740
+ init_color_scheme2();
150523
150741
  init_byte_cursor();
150524
150742
  ALIGN_MAP4 = {
150525
150743
  0: "l",
@@ -150598,8 +150816,8 @@ function collectOutlineText(view, slideListWithText, scheme) {
150598
150816
  var CP1252_HIGH;
150599
150817
  var init_text_atoms = __esm({
150600
150818
  "src/core/ppt/text/text-atoms.ts"() {
150601
- init_record_stream();
150602
- init_record_types();
150819
+ init_record_stream2();
150820
+ init_record_types2();
150603
150821
  init_style_props();
150604
150822
  CP1252_HIGH = {
150605
150823
  128: 8364,
@@ -150751,8 +150969,8 @@ var II_ACTION2;
150751
150969
  var II_JUMP2;
150752
150970
  var init_hyperlink_parser = __esm({
150753
150971
  "src/core/ppt/hyperlink-parser.ts"() {
150754
- init_record_stream();
150755
- init_record_types();
150972
+ init_record_stream2();
150973
+ init_record_types2();
150756
150974
  init_text_atoms();
150757
150975
  LT2 = {
150758
150976
  customShow: 6,
@@ -150819,9 +151037,7 @@ var init_deflate_utils = __esm({
150819
151037
  function parseUserEditAtom(view, offset) {
150820
151038
  const rec = readRecordOrThrow(view, offset);
150821
151039
  if (rec.recType !== RT.UserEditAtom) {
150822
- throw new PptParseError(
150823
- `Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`
150824
- );
151040
+ throw new PptParseError(`Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
150825
151041
  }
150826
151042
  if (rec.recLen !== 28 && rec.recLen !== 32) {
150827
151043
  throw new PptParseError(`UserEditAtom has invalid length ${rec.recLen}`);
@@ -150837,9 +151053,7 @@ function parseUserEditAtom(view, offset) {
150837
151053
  function parsePersistDirectoryAtom(view, offset) {
150838
151054
  const rec = readRecordOrThrow(view, offset);
150839
151055
  if (rec.recType !== RT.PersistDirectoryAtom) {
150840
- throw new PptParseError(
150841
- `Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`
150842
- );
151056
+ throw new PptParseError(`Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
150843
151057
  }
150844
151058
  const pairs3 = [];
150845
151059
  let pos2 = rec.dataOffset;
@@ -150887,11 +151101,16 @@ function readPersistRecord(view, directory, persistId) {
150887
151101
  return readRecordOrThrow(view, offset);
150888
151102
  }
150889
151103
  var init_persist_directory = __esm({
150890
- "src/core/ppt/persist-directory.ts"() {
151104
+ "../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
150891
151105
  init_record_stream();
150892
151106
  init_record_types();
150893
151107
  }
150894
151108
  });
151109
+ var init_persist_directory2 = __esm({
151110
+ "src/core/ppt/persist-directory.ts"() {
151111
+ init_persist_directory();
151112
+ }
151113
+ });
150895
151114
  function readCString2(view, rec) {
150896
151115
  return decodeTextChars(view, rec.dataOffset, rec.recLen);
150897
151116
  }
@@ -150984,9 +151203,9 @@ var init_ole_embed_parser = __esm({
150984
151203
  init_ole_embedded_extract();
150985
151204
  init_ole2_parser();
150986
151205
  init_deflate_utils();
150987
- init_persist_directory();
150988
- init_record_stream();
150989
- init_record_types();
151206
+ init_persist_directory2();
151207
+ init_record_stream2();
151208
+ init_record_types2();
150990
151209
  init_text_atoms();
150991
151210
  }
150992
151211
  });
@@ -151111,8 +151330,8 @@ var BLIP_TYPES;
151111
151330
  var init_pictures = __esm({
151112
151331
  "src/core/ppt/pictures.ts"() {
151113
151332
  init_deflate_utils();
151114
- init_record_stream();
151115
- init_record_types();
151333
+ init_record_stream2();
151334
+ init_record_types2();
151116
151335
  BLIP_TYPES = /* @__PURE__ */ new Map([
151117
151336
  [OA.BlipEmf, { extension: "emf", isMetafile: true, singleUidInstance: 980 }],
151118
151337
  [OA.BlipWmf, { extension: "wmf", isMetafile: true, singleUidInstance: 534 }],
@@ -151275,7 +151494,7 @@ function buildTextBody2(raw, fonts, hyperlinkRanges = []) {
151275
151494
  }
151276
151495
  var init_text_builder = __esm({
151277
151496
  "src/core/ppt/text/text-builder.ts"() {
151278
- init_record_types();
151497
+ init_record_types2();
151279
151498
  }
151280
151499
  });
151281
151500
  function extractText(ctx, clientTextbox2) {
@@ -151314,8 +151533,8 @@ var PLACEHOLDER_TYPE_MAP;
151314
151533
  var init_client_data_extract = __esm({
151315
151534
  "src/core/ppt/escher/client-data-extract.ts"() {
151316
151535
  init_hyperlink_parser();
151317
- init_record_stream();
151318
- init_record_types();
151536
+ init_record_stream2();
151537
+ init_record_types2();
151319
151538
  init_text_atoms();
151320
151539
  init_text_builder();
151321
151540
  PLACEHOLDER_TYPE_MAP = {
@@ -151711,8 +151930,8 @@ function extractLine(props, scheme) {
151711
151930
  var GRADIENT_FILL_TYPES;
151712
151931
  var init_shape_props = __esm({
151713
151932
  "src/core/ppt/escher/shape-props.ts"() {
151714
- init_color_scheme();
151715
- init_record_types();
151933
+ init_color_scheme2();
151934
+ init_record_types2();
151716
151935
  init_geometry_map();
151717
151936
  init_properties();
151718
151937
  GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
@@ -151903,10 +152122,10 @@ var FSP_FLAG_FLIPV2;
151903
152122
  var FSP_FLAG_BACKGROUND2;
151904
152123
  var init_sp_container = __esm({
151905
152124
  "src/core/ppt/escher/sp-container.ts"() {
151906
- init_color_scheme();
152125
+ init_color_scheme2();
151907
152126
  init_hyperlink_parser();
151908
- init_record_stream();
151909
- init_record_types();
152127
+ init_record_stream2();
152128
+ init_record_types2();
151910
152129
  init_client_data_extract();
151911
152130
  init_geometry_map();
151912
152131
  init_properties();
@@ -151988,10 +152207,10 @@ var SLIDE_FLAG_MASTER_SCHEME2;
151988
152207
  var SLIDE_FLAG_MASTER_BACKGROUND2;
151989
152208
  var init_slide_parser = __esm({
151990
152209
  "src/core/ppt/slide-parser.ts"() {
151991
- init_color_scheme();
152210
+ init_color_scheme2();
151992
152211
  init_sp_container();
151993
- init_record_stream();
151994
- init_record_types();
152212
+ init_record_stream2();
152213
+ init_record_types2();
151995
152214
  SLIDE_FLAG_MASTER_OBJECTS2 = 1;
151996
152215
  SLIDE_FLAG_MASTER_SCHEME2 = 2;
151997
152216
  SLIDE_FLAG_MASTER_BACKGROUND2 = 4;
@@ -152071,8 +152290,8 @@ function collectMasterStyles(view, masterContainer, scheme, fonts) {
152071
152290
  }
152072
152291
  var init_master_styles = __esm({
152073
152292
  "src/core/ppt/text/master-styles.ts"() {
152074
- init_record_stream();
152075
- init_record_types();
152293
+ init_record_stream2();
152294
+ init_record_types2();
152076
152295
  init_style_props();
152077
152296
  }
152078
152297
  });
@@ -152256,19 +152475,29 @@ async function parseDeck(streams) {
152256
152475
  }
152257
152476
  var init_document_parser = __esm({
152258
152477
  "src/core/ppt/document-parser.ts"() {
152259
- init_color_scheme();
152478
+ init_color_scheme2();
152260
152479
  init_current_user();
152261
152480
  init_hyperlink_parser();
152262
152481
  init_ole_embed_parser();
152263
- init_persist_directory();
152482
+ init_persist_directory2();
152264
152483
  init_pictures();
152265
- init_record_stream();
152266
- init_record_types();
152484
+ init_record_stream2();
152485
+ init_record_types2();
152267
152486
  init_slide_parser();
152268
152487
  init_master_styles();
152269
152488
  init_text_atoms();
152270
152489
  }
152271
152490
  });
152491
+ var init_rc4_cryptoapi_key2 = __esm({
152492
+ "src/core/ppt/rc4-cryptoapi-key.ts"() {
152493
+ init_rc4_cryptoapi_key();
152494
+ }
152495
+ });
152496
+ var init_rc4_cryptoapi_streams2 = __esm({
152497
+ "src/core/ppt/rc4-cryptoapi-streams.ts"() {
152498
+ init_rc4_cryptoapi_streams();
152499
+ }
152500
+ });
152272
152501
  function parseLegacyPptEncryptionInfo(data) {
152273
152502
  const info = parseEncryptionInfo(data);
152274
152503
  if (!("isStandard" in info) || !info.isStandard) {
@@ -152327,11 +152556,11 @@ var init_ppt_encryption = __esm({
152327
152556
  init_ooxml_crypto_errors();
152328
152557
  init_ooxml_crypto_key_derivation();
152329
152558
  init_current_user();
152330
- init_persist_directory();
152331
- init_rc4_cryptoapi_key();
152332
- init_rc4_cryptoapi_streams();
152333
- init_record_stream();
152334
- init_record_types();
152559
+ init_persist_directory2();
152560
+ init_rc4_cryptoapi_key2();
152561
+ init_rc4_cryptoapi_streams2();
152562
+ init_record_stream2();
152563
+ init_record_types2();
152335
152564
  }
152336
152565
  });
152337
152566
  function hyperlinkClickXml(target, alloc, slideCount) {
@@ -152530,7 +152759,7 @@ function txBodyXml(text22, ctx) {
152530
152759
  }
152531
152760
  var init_txbody_writer = __esm({
152532
152761
  "src/core/ppt/pptx/txbody-writer.ts"() {
152533
- init_record_types();
152762
+ init_record_types2();
152534
152763
  init_hyperlink_xml();
152535
152764
  init_xml_utils();
152536
152765
  }
@@ -152755,7 +152984,7 @@ function themeXml2(deck) {
152755
152984
  var XMLNS;
152756
152985
  var init_master_writer = __esm({
152757
152986
  "src/core/ppt/pptx/master-writer.ts"() {
152758
- init_color_scheme();
152987
+ init_color_scheme2();
152759
152988
  init_shape_writer2();
152760
152989
  init_xml_utils();
152761
152990
  XMLNS = 'xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"';
@@ -153063,7 +153292,7 @@ ${mediaRels.join("\n")}
153063
153292
  var HYPERLINK_REL_TYPE;
153064
153293
  var init_package_writer = __esm({
153065
153294
  "src/core/ppt/pptx/package-writer.ts"() {
153066
- init_color_scheme();
153295
+ init_color_scheme2();
153067
153296
  init_master_writer();
153068
153297
  init_package_writer_ole();
153069
153298
  init_package_writer_parts();
@@ -153132,7 +153361,7 @@ var init_ppt_to_pptx = __esm({
153132
153361
  init_document_parser();
153133
153362
  init_ppt_encryption();
153134
153363
  init_package_writer();
153135
- init_record_stream();
153364
+ init_record_stream2();
153136
153365
  DOCUMENT_STREAM = "PowerPoint Document";
153137
153366
  CURRENT_USER_STREAM = "Current User";
153138
153367
  PICTURES_STREAM = "Pictures";
@@ -153142,11 +153371,11 @@ var init_ppt = __esm({
153142
153371
  "src/core/ppt/index.ts"() {
153143
153372
  init_current_user();
153144
153373
  init_document_parser();
153145
- init_persist_directory();
153374
+ init_persist_directory2();
153146
153375
  init_ppt_to_pptx();
153147
153376
  init_ppt_encryption();
153148
- init_record_stream();
153149
- init_record_types();
153377
+ init_record_stream2();
153378
+ init_record_types2();
153150
153379
  }
153151
153380
  });
153152
153381
  var PptxHandlerCore;
@@ -190009,6 +190238,13 @@ function buildUserFontFaceStyles(fonts) {
190009
190238
  }
190010
190239
  return rules.join("\n\n");
190011
190240
  }
190241
+ function parseOpenTypeFont(buffer, module = opentypeModule__namespace) {
190242
+ const parser = module.parse ?? module.default?.parse;
190243
+ if (!parser) {
190244
+ throw new Error("opentype.js does not expose a font parser");
190245
+ }
190246
+ return parser(buffer);
190247
+ }
190012
190248
  function toArrayBuffer(bytes) {
190013
190249
  const copy2 = bytes.slice();
190014
190250
  return copy2.buffer;
@@ -190055,7 +190291,7 @@ var GlyphOutlineFontCache = class {
190055
190291
  continue;
190056
190292
  }
190057
190293
  try {
190058
- this.fonts.set(key2, opentype_js.parse(toArrayBuffer(bytes)));
190294
+ this.fonts.set(key2, parseOpenTypeFont(toArrayBuffer(bytes)));
190059
190295
  } catch {
190060
190296
  }
190061
190297
  }
@@ -190073,7 +190309,7 @@ var GlyphOutlineFontCache = class {
190073
190309
  return false;
190074
190310
  }
190075
190311
  try {
190076
- this.fonts.set(key2, opentype_js.parse(toArrayBuffer(bytes)));
190312
+ this.fonts.set(key2, parseOpenTypeFont(toArrayBuffer(bytes)));
190077
190313
  return true;
190078
190314
  } catch {
190079
190315
  return false;