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.
- package/CHANGELOG.md +21 -0
- package/dist/{AiChatPanel-537JJCV4.js → AiChatPanel-FV22KLWM.js} +27 -27
- package/dist/AiChatPanel-FV22KLWM.js.br +0 -0
- package/dist/AiChatPanel-FV22KLWM.js.gz +0 -0
- package/dist/{AiChatPanel-3IKRPPUX.mjs → AiChatPanel-ZMVKLTNX.mjs} +3 -3
- package/dist/AiChatPanel-ZMVKLTNX.mjs.br +0 -0
- package/dist/AiChatPanel-ZMVKLTNX.mjs.gz +0 -0
- package/dist/{Model3DScene-3XT5SBU4.js → Model3DScene-DWLMI554.js} +2 -2
- package/dist/Model3DScene-DWLMI554.js.br +0 -0
- package/dist/Model3DScene-DWLMI554.js.gz +0 -0
- package/dist/{Model3DScene-WBJV27OR.mjs → Model3DScene-JGW2QDN3.mjs} +1 -1
- package/dist/Model3DScene-JGW2QDN3.mjs.br +0 -0
- package/dist/Model3DScene-JGW2QDN3.mjs.gz +0 -0
- package/dist/{chunk-ZVBB3CC5.mjs → chunk-36223DLG.mjs} +1226 -1009
- package/dist/chunk-36223DLG.mjs.br +0 -0
- package/dist/chunk-36223DLG.mjs.gz +0 -0
- package/dist/{chunk-XGDCECDK.js → chunk-73CSPIMU.js} +187 -187
- package/dist/chunk-73CSPIMU.js.br +0 -0
- package/dist/chunk-73CSPIMU.js.gz +0 -0
- package/dist/{chunk-G353KKQX.mjs → chunk-HOIC3XAF.mjs} +3 -3
- package/dist/chunk-HOIC3XAF.mjs.br +0 -0
- package/dist/chunk-HOIC3XAF.mjs.gz +0 -0
- package/dist/{chunk-GLFTASJH.js → chunk-I2EV62KC.js} +806 -806
- package/dist/chunk-I2EV62KC.js.br +0 -0
- package/dist/chunk-I2EV62KC.js.gz +0 -0
- package/dist/{chunk-SDEBL4LY.mjs → chunk-NAL3FTKM.mjs} +7 -7
- package/dist/chunk-NAL3FTKM.mjs.br +0 -0
- package/dist/chunk-NAL3FTKM.mjs.gz +0 -0
- package/dist/{chunk-TLKFCZWS.js → chunk-QFTHDPEA.js} +1245 -1009
- package/dist/chunk-QFTHDPEA.js.br +0 -0
- package/dist/chunk-QFTHDPEA.js.gz +0 -0
- package/dist/{chunk-4MI3PMQT.mjs → chunk-R7FGWOEG.mjs} +1 -1
- package/dist/chunk-R7FGWOEG.mjs.br +0 -0
- package/dist/chunk-R7FGWOEG.mjs.gz +0 -0
- package/dist/{chunk-LVWMKZPS.js → chunk-RRT4LIRN.js} +5 -5
- package/dist/chunk-RRT4LIRN.js.br +0 -0
- package/dist/chunk-RRT4LIRN.js.gz +0 -0
- package/dist/{chunk-NCUM2X4H.js → chunk-XDTZVM5K.js} +1180 -1180
- package/dist/chunk-XDTZVM5K.js.br +0 -0
- package/dist/chunk-XDTZVM5K.js.gz +0 -0
- package/dist/{chunk-BR4GXQSN.mjs → chunk-YXRSLJEB.mjs} +1 -1
- package/dist/chunk-YXRSLJEB.mjs.br +0 -0
- package/dist/chunk-YXRSLJEB.mjs.gz +0 -0
- package/dist/index.js +61 -61
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.js +104 -104
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/viewer/index.js +26 -26
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-3IKRPPUX.mjs.br +0 -0
- package/dist/AiChatPanel-3IKRPPUX.mjs.gz +0 -0
- package/dist/AiChatPanel-537JJCV4.js.br +0 -0
- package/dist/AiChatPanel-537JJCV4.js.gz +0 -0
- package/dist/Model3DScene-3XT5SBU4.js.br +0 -0
- package/dist/Model3DScene-3XT5SBU4.js.gz +0 -0
- package/dist/Model3DScene-WBJV27OR.mjs.br +0 -0
- package/dist/Model3DScene-WBJV27OR.mjs.gz +0 -0
- package/dist/chunk-4MI3PMQT.mjs.br +0 -0
- package/dist/chunk-4MI3PMQT.mjs.gz +0 -0
- package/dist/chunk-BR4GXQSN.mjs.br +0 -0
- package/dist/chunk-BR4GXQSN.mjs.gz +0 -0
- package/dist/chunk-G353KKQX.mjs.br +0 -0
- package/dist/chunk-G353KKQX.mjs.gz +0 -0
- package/dist/chunk-GLFTASJH.js.br +0 -0
- package/dist/chunk-GLFTASJH.js.gz +0 -0
- package/dist/chunk-LVWMKZPS.js.br +0 -0
- package/dist/chunk-LVWMKZPS.js.gz +0 -0
- package/dist/chunk-NCUM2X4H.js.br +0 -0
- package/dist/chunk-NCUM2X4H.js.gz +0 -0
- package/dist/chunk-SDEBL4LY.mjs.br +0 -0
- package/dist/chunk-SDEBL4LY.mjs.gz +0 -0
- package/dist/chunk-TLKFCZWS.js.br +0 -0
- package/dist/chunk-TLKFCZWS.js.gz +0 -0
- package/dist/chunk-XGDCECDK.js.br +0 -0
- package/dist/chunk-XGDCECDK.js.gz +0 -0
- package/dist/chunk-ZVBB3CC5.mjs.br +0 -0
- package/dist/chunk-ZVBB3CC5.mjs.gz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import JSZip3 from 'jszip';
|
|
2
2
|
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
|
3
|
-
import
|
|
3
|
+
import * as opentypeModule from 'opentype.js';
|
|
4
4
|
import DOMPurify from 'dompurify';
|
|
5
5
|
|
|
6
6
|
// ../core/dist/index.mjs
|
|
@@ -28710,7 +28710,7 @@ var ENTRY_TYPE_ROOT;
|
|
|
28710
28710
|
var DIR_ENTRY_SIZE;
|
|
28711
28711
|
var Ole2ParseError;
|
|
28712
28712
|
var init_ole2_parser_types = __esm({
|
|
28713
|
-
"
|
|
28713
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
|
|
28714
28714
|
OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
28715
28715
|
ENDOFCHAIN = 4294967294;
|
|
28716
28716
|
FREESECT = 4294967295;
|
|
@@ -28760,9 +28760,7 @@ function parseOle2(buffer) {
|
|
|
28760
28760
|
function readSector(sector) {
|
|
28761
28761
|
const offset = sectorOffset(sector);
|
|
28762
28762
|
if (offset + sectorSize > data.length) {
|
|
28763
|
-
throw new Ole2ParseError(
|
|
28764
|
-
`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`
|
|
28765
|
-
);
|
|
28763
|
+
throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
|
|
28766
28764
|
}
|
|
28767
28765
|
return data.subarray(offset, offset + sectorSize);
|
|
28768
28766
|
}
|
|
@@ -28822,11 +28820,7 @@ function parseOle2(buffer) {
|
|
|
28822
28820
|
const miniFatEntries = [];
|
|
28823
28821
|
if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
|
|
28824
28822
|
const miniFatRaw = readSectorChain(firstMiniFATSector);
|
|
28825
|
-
const miniFatView = new DataView(
|
|
28826
|
-
miniFatRaw.buffer,
|
|
28827
|
-
miniFatRaw.byteOffset,
|
|
28828
|
-
miniFatRaw.byteLength
|
|
28829
|
-
);
|
|
28823
|
+
const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
|
|
28830
28824
|
for (let i2 = 0; i2 < miniFatRaw.length / 4; i2++) {
|
|
28831
28825
|
miniFatEntries.push(miniFatView.getUint32(i2 * 4, true));
|
|
28832
28826
|
}
|
|
@@ -28850,9 +28844,7 @@ function parseOle2(buffer) {
|
|
|
28850
28844
|
const leftSiblingId = entryView.getUint32(68, true);
|
|
28851
28845
|
const rightSiblingId = entryView.getUint32(72, true);
|
|
28852
28846
|
const childId = entryView.getUint32(76, true);
|
|
28853
|
-
const clsid = new Uint8Array(
|
|
28854
|
-
entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96)
|
|
28855
|
-
);
|
|
28847
|
+
const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
|
|
28856
28848
|
const startSector = entryView.getUint32(116, true);
|
|
28857
28849
|
const sizeLow = entryView.getUint32(120, true);
|
|
28858
28850
|
let size = sizeLow;
|
|
@@ -28902,9 +28894,7 @@ function parseOle2(buffer) {
|
|
|
28902
28894
|
return result.subarray(0, Math.min(size, result.length));
|
|
28903
28895
|
}
|
|
28904
28896
|
function getStream(name) {
|
|
28905
|
-
const entry5 = entries2.find(
|
|
28906
|
-
(e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name
|
|
28907
|
-
);
|
|
28897
|
+
const entry5 = entries2.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name);
|
|
28908
28898
|
if (!entry5) {
|
|
28909
28899
|
return void 0;
|
|
28910
28900
|
}
|
|
@@ -28916,7 +28906,17 @@ function parseOle2(buffer) {
|
|
|
28916
28906
|
return { entries: entries2, getStream };
|
|
28917
28907
|
}
|
|
28918
28908
|
var init_ole2_parser_read = __esm({
|
|
28909
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
|
|
28910
|
+
init_ole2_parser_types();
|
|
28911
|
+
}
|
|
28912
|
+
});
|
|
28913
|
+
var init_ole2_parser_read2 = __esm({
|
|
28919
28914
|
"src/core/utils/ole2-parser-read.ts"() {
|
|
28915
|
+
init_ole2_parser_read();
|
|
28916
|
+
}
|
|
28917
|
+
});
|
|
28918
|
+
var init_ole2_parser_types2 = __esm({
|
|
28919
|
+
"src/core/utils/ole2-parser-types.ts"() {
|
|
28920
28920
|
init_ole2_parser_types();
|
|
28921
28921
|
}
|
|
28922
28922
|
});
|
|
@@ -29034,8 +29034,8 @@ var OLE10_NATIVE_STREAM_NAMES;
|
|
|
29034
29034
|
var CONTENTS_STREAM;
|
|
29035
29035
|
var init_ole_embedded_extract = __esm({
|
|
29036
29036
|
"src/core/utils/ole-embedded-extract.ts"() {
|
|
29037
|
-
|
|
29038
|
-
|
|
29037
|
+
init_ole2_parser_read2();
|
|
29038
|
+
init_ole2_parser_types2();
|
|
29039
29039
|
OLE10_NATIVE_STREAM_NAMES = [`${String.fromCharCode(1)}Ole10Native`, "Ole10Native"];
|
|
29040
29040
|
CONTENTS_STREAM = "CONTENTS";
|
|
29041
29041
|
}
|
|
@@ -29062,9 +29062,9 @@ function encodeName(name) {
|
|
|
29062
29062
|
}
|
|
29063
29063
|
return bytes;
|
|
29064
29064
|
}
|
|
29065
|
-
function writeFatChain(fat,
|
|
29066
|
-
for (let i2 = 0; i2 <
|
|
29067
|
-
fat[
|
|
29065
|
+
function writeFatChain(fat, chain2) {
|
|
29066
|
+
for (let i2 = 0; i2 < chain2.sectors.length; i2++) {
|
|
29067
|
+
fat[chain2.sectors[i2]] = i2 < chain2.sectors.length - 1 ? chain2.sectors[i2 + 1] : ENDOFCHAIN;
|
|
29068
29068
|
}
|
|
29069
29069
|
}
|
|
29070
29070
|
function writeFatRun(fat, firstSector, count) {
|
|
@@ -29085,7 +29085,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
29085
29085
|
}
|
|
29086
29086
|
}
|
|
29087
29087
|
var init_ole2_parser_write_helpers = __esm({
|
|
29088
|
-
"
|
|
29088
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
|
|
29089
29089
|
init_ole2_parser_types();
|
|
29090
29090
|
}
|
|
29091
29091
|
});
|
|
@@ -29101,18 +29101,10 @@ function writeHeader(outView, outBytes, params) {
|
|
|
29101
29101
|
outView.setUint32(48, params.firstDirSector, true);
|
|
29102
29102
|
outView.setUint32(52, 0, true);
|
|
29103
29103
|
outView.setUint32(56, params.miniStreamCutoff, true);
|
|
29104
|
-
outView.setUint32(
|
|
29105
|
-
60,
|
|
29106
|
-
params.numMiniFATSectors > 0 ? params.firstMiniFATSector : ENDOFCHAIN,
|
|
29107
|
-
true
|
|
29108
|
-
);
|
|
29104
|
+
outView.setUint32(60, params.numMiniFATSectors > 0 ? params.firstMiniFATSector : ENDOFCHAIN, true);
|
|
29109
29105
|
outView.setUint32(64, params.numMiniFATSectors, true);
|
|
29110
29106
|
const numDIFATSectors = params.numDIFATSectors ?? 0;
|
|
29111
|
-
outView.setUint32(
|
|
29112
|
-
68,
|
|
29113
|
-
numDIFATSectors > 0 ? params.firstDIFATSector ?? ENDOFCHAIN : ENDOFCHAIN,
|
|
29114
|
-
true
|
|
29115
|
-
);
|
|
29107
|
+
outView.setUint32(68, numDIFATSectors > 0 ? params.firstDIFATSector ?? ENDOFCHAIN : ENDOFCHAIN, true);
|
|
29116
29108
|
outView.setUint32(72, numDIFATSectors, true);
|
|
29117
29109
|
for (let i2 = 0; i2 < HEADER_DIFAT_ENTRIES; i2++) {
|
|
29118
29110
|
if (i2 < params.numFATSectors) {
|
|
@@ -29144,11 +29136,7 @@ function writeDifatSectors(outView, params) {
|
|
|
29144
29136
|
const base = (params.firstDIFATSector + d + 1) * params.sectorSize;
|
|
29145
29137
|
for (let j = 0; j < perSector; j++) {
|
|
29146
29138
|
const fatIndex = HEADER_DIFAT_ENTRIES + d * perSector + j;
|
|
29147
|
-
outView.setUint32(
|
|
29148
|
-
base + j * 4,
|
|
29149
|
-
fatIndex < params.numFATSectors ? params.firstFATSector + fatIndex : FREESECT,
|
|
29150
|
-
true
|
|
29151
|
-
);
|
|
29139
|
+
outView.setUint32(base + j * 4, fatIndex < params.numFATSectors ? params.firstFATSector + fatIndex : FREESECT, true);
|
|
29152
29140
|
}
|
|
29153
29141
|
const next = d < params.numDIFATSectors - 1 ? params.firstDIFATSector + d + 1 : ENDOFCHAIN;
|
|
29154
29142
|
outView.setUint32(base + perSector * 4, next, true);
|
|
@@ -29182,9 +29170,9 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
|
|
|
29182
29170
|
}
|
|
29183
29171
|
return dirData;
|
|
29184
29172
|
}
|
|
29185
|
-
function writeStreamSectors(outBytes, streamData,
|
|
29186
|
-
for (let i2 = 0; i2 <
|
|
29187
|
-
const sectorOffset = (
|
|
29173
|
+
function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
29174
|
+
for (let i2 = 0; i2 < chain2.sectors.length; i2++) {
|
|
29175
|
+
const sectorOffset = (chain2.sectors[i2] + 1) * sectorSize;
|
|
29188
29176
|
const srcOffset = i2 * sectorSize;
|
|
29189
29177
|
const srcEnd = Math.min(srcOffset + sectorSize, streamData.length);
|
|
29190
29178
|
outBytes.set(streamData.subarray(srcOffset, srcEnd), sectorOffset);
|
|
@@ -29192,7 +29180,7 @@ function writeStreamSectors(outBytes, streamData, chain, sectorSize) {
|
|
|
29192
29180
|
}
|
|
29193
29181
|
var HEADER_DIFAT_ENTRIES;
|
|
29194
29182
|
var init_ole2_parser_write_serialize = __esm({
|
|
29195
|
-
"
|
|
29183
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
|
|
29196
29184
|
init_ole2_parser_types();
|
|
29197
29185
|
init_ole2_parser_write_helpers();
|
|
29198
29186
|
HEADER_DIFAT_ENTRIES = 109;
|
|
@@ -29264,20 +29252,20 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
29264
29252
|
clsid: rootClsid
|
|
29265
29253
|
});
|
|
29266
29254
|
for (const stream of regularStreams) {
|
|
29267
|
-
const
|
|
29255
|
+
const chain2 = fatChains.get(stream.name);
|
|
29268
29256
|
dirEntries.push({
|
|
29269
29257
|
name: stream.name,
|
|
29270
29258
|
type: ENTRY_TYPE_STREAM,
|
|
29271
|
-
startSector:
|
|
29259
|
+
startSector: chain2.start,
|
|
29272
29260
|
size: stream.data.length
|
|
29273
29261
|
});
|
|
29274
29262
|
}
|
|
29275
29263
|
for (const stream of miniStreams) {
|
|
29276
|
-
const
|
|
29264
|
+
const chain2 = miniFatChains.get(stream.name);
|
|
29277
29265
|
dirEntries.push({
|
|
29278
29266
|
name: stream.name,
|
|
29279
29267
|
type: ENTRY_TYPE_STREAM,
|
|
29280
|
-
startSector:
|
|
29268
|
+
startSector: chain2.start,
|
|
29281
29269
|
size: stream.data.length
|
|
29282
29270
|
});
|
|
29283
29271
|
}
|
|
@@ -29302,8 +29290,8 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
29302
29290
|
const totalSectors = nextSector;
|
|
29303
29291
|
const fat = new Int32Array(numFATSectors * (sectorSize / 4));
|
|
29304
29292
|
fat.fill(-1);
|
|
29305
|
-
for (const [,
|
|
29306
|
-
writeFatChain(fat,
|
|
29293
|
+
for (const [, chain2] of fatChains) {
|
|
29294
|
+
writeFatChain(fat, chain2);
|
|
29307
29295
|
}
|
|
29308
29296
|
writeFatChain(fat, { start: rootSectors[0] ?? 0, sectors: rootSectors });
|
|
29309
29297
|
writeFatRun(fat, firstDirSector, numDirSectors);
|
|
@@ -29320,8 +29308,8 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
29320
29308
|
if (miniStreams.length > 0) {
|
|
29321
29309
|
miniFat = new Int32Array(numMiniFATSectors * (sectorSize / 4));
|
|
29322
29310
|
miniFat.fill(-1);
|
|
29323
|
-
for (const [,
|
|
29324
|
-
writeFatChain(miniFat,
|
|
29311
|
+
for (const [, chain2] of miniFatChains) {
|
|
29312
|
+
writeFatChain(miniFat, chain2);
|
|
29325
29313
|
}
|
|
29326
29314
|
}
|
|
29327
29315
|
const fileSize = (totalSectors + 1) * sectorSize;
|
|
@@ -29342,12 +29330,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
29342
29330
|
writeStreamSectors(outBytes, stream.data, fatChains.get(stream.name), sectorSize);
|
|
29343
29331
|
}
|
|
29344
29332
|
if (miniStreamContainer.length > 0) {
|
|
29345
|
-
writeStreamSectors(
|
|
29346
|
-
outBytes,
|
|
29347
|
-
miniStreamContainer,
|
|
29348
|
-
{ start: rootSectors[0] ?? 0, sectors: rootSectors },
|
|
29349
|
-
sectorSize
|
|
29350
|
-
);
|
|
29333
|
+
writeStreamSectors(outBytes, miniStreamContainer, { start: rootSectors[0] ?? 0, sectors: rootSectors }, sectorSize);
|
|
29351
29334
|
}
|
|
29352
29335
|
const dirData = serializeDirectoryEntries(sortedDirEntries, numDirSectors, sectorSize);
|
|
29353
29336
|
for (let i2 = 0; i2 < numDirSectors; i2++) {
|
|
@@ -29368,12 +29351,17 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
29368
29351
|
return output;
|
|
29369
29352
|
}
|
|
29370
29353
|
var init_ole2_parser_write = __esm({
|
|
29371
|
-
"
|
|
29354
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
|
|
29372
29355
|
init_ole2_parser_types();
|
|
29373
29356
|
init_ole2_parser_write_helpers();
|
|
29374
29357
|
init_ole2_parser_write_serialize();
|
|
29375
29358
|
}
|
|
29376
29359
|
});
|
|
29360
|
+
var init_ole2_parser_write2 = __esm({
|
|
29361
|
+
"src/core/utils/ole2-parser-write.ts"() {
|
|
29362
|
+
init_ole2_parser_write();
|
|
29363
|
+
}
|
|
29364
|
+
});
|
|
29377
29365
|
function asciiZ(value) {
|
|
29378
29366
|
const bytes = new Uint8Array(value.length + 1);
|
|
29379
29367
|
for (let i2 = 0; i2 < value.length; i2++) {
|
|
@@ -29461,8 +29449,8 @@ var CONTENTS_STREAM2;
|
|
|
29461
29449
|
var init_ole_embedded_replace = __esm({
|
|
29462
29450
|
"src/core/utils/ole-embedded-replace.ts"() {
|
|
29463
29451
|
init_ole_embedded_extract();
|
|
29464
|
-
|
|
29465
|
-
|
|
29452
|
+
init_ole2_parser_read2();
|
|
29453
|
+
init_ole2_parser_write2();
|
|
29466
29454
|
OLE10_NATIVE_NAME = `${String.fromCharCode(1)}Ole10Native`;
|
|
29467
29455
|
OLE10_NATIVE_NAME_UNPREFIXED = "Ole10Native";
|
|
29468
29456
|
CONTENTS_STREAM2 = "CONTENTS";
|
|
@@ -29517,7 +29505,7 @@ var ZIP_MAGIC;
|
|
|
29517
29505
|
var init_ole_payload_kind = __esm({
|
|
29518
29506
|
"src/core/utils/ole-payload-kind.ts"() {
|
|
29519
29507
|
init_ole_embedded_extract();
|
|
29520
|
-
|
|
29508
|
+
init_ole2_parser_read2();
|
|
29521
29509
|
ZIP_MAGIC = [80, 75, 3, 4];
|
|
29522
29510
|
}
|
|
29523
29511
|
});
|
|
@@ -30058,33 +30046,321 @@ var init_ole_sheet_xlsx_editor = __esm({
|
|
|
30058
30046
|
DEFAULT_MAX_COLS = 26;
|
|
30059
30047
|
}
|
|
30060
30048
|
});
|
|
30049
|
+
function chain(table2, start, limit) {
|
|
30050
|
+
if (start === END && limit === 0)
|
|
30051
|
+
return [];
|
|
30052
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
30053
|
+
let id = start;
|
|
30054
|
+
while (id !== END) {
|
|
30055
|
+
if (id > MAX || id >= table2.length || seen.has(id) || out.length >= limit)
|
|
30056
|
+
throw new Error("Invalid CFB chain");
|
|
30057
|
+
seen.add(id);
|
|
30058
|
+
out.push(id);
|
|
30059
|
+
id = table2[id];
|
|
30060
|
+
}
|
|
30061
|
+
if (out.length !== limit)
|
|
30062
|
+
throw new Error("Unexpected CFB chain length");
|
|
30063
|
+
return out;
|
|
30064
|
+
}
|
|
30065
|
+
function chainToEnd(table2, start, max) {
|
|
30066
|
+
if (start === END)
|
|
30067
|
+
return [];
|
|
30068
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
30069
|
+
let id = start;
|
|
30070
|
+
while (id !== END) {
|
|
30071
|
+
if (id > MAX || id >= table2.length || seen.has(id) || out.length >= max)
|
|
30072
|
+
throw new Error("Invalid CFB chain");
|
|
30073
|
+
seen.add(id);
|
|
30074
|
+
out.push(id);
|
|
30075
|
+
id = table2[id];
|
|
30076
|
+
}
|
|
30077
|
+
return out;
|
|
30078
|
+
}
|
|
30079
|
+
function processCompoundFileStream(input, path, replacement) {
|
|
30080
|
+
const reject = () => replacement ? input : void 0;
|
|
30081
|
+
try {
|
|
30082
|
+
if (path.length === 0 || path.some((part) => !part) || input.length < 512)
|
|
30083
|
+
return reject();
|
|
30084
|
+
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
30085
|
+
const read32 = (offset2) => view.getUint32(offset2, true);
|
|
30086
|
+
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)
|
|
30087
|
+
return reject();
|
|
30088
|
+
const major = view.getUint16(26, true), shift = view.getUint16(30, true), miniShift = view.getUint16(32, true);
|
|
30089
|
+
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
30090
|
+
return reject();
|
|
30091
|
+
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
30092
|
+
if (input.length % sectorSize !== 0)
|
|
30093
|
+
return reject();
|
|
30094
|
+
const sectorCount = input.length / sectorSize - 1;
|
|
30095
|
+
const offset = (id) => (id + 1) * sectorSize;
|
|
30096
|
+
const sector = (id) => {
|
|
30097
|
+
if (id > MAX || id >= sectorCount)
|
|
30098
|
+
throw new Error("Invalid sector");
|
|
30099
|
+
return input.subarray(offset(id), offset(id) + sectorSize);
|
|
30100
|
+
};
|
|
30101
|
+
const fatCount = read32(44), difatCount = read32(72), difatStart = read32(68);
|
|
30102
|
+
const fatIds = [];
|
|
30103
|
+
for (let i2 = 0; i2 < 109 && fatIds.length < fatCount; i2++) {
|
|
30104
|
+
const id = read32(76 + 4 * i2);
|
|
30105
|
+
if (id <= MAX)
|
|
30106
|
+
fatIds.push(id);
|
|
30107
|
+
}
|
|
30108
|
+
let difat = difatStart;
|
|
30109
|
+
const difatIds = /* @__PURE__ */ new Set();
|
|
30110
|
+
for (let i2 = 0; i2 < difatCount; i2++) {
|
|
30111
|
+
if (difatIds.has(difat) || difat > MAX)
|
|
30112
|
+
return reject();
|
|
30113
|
+
difatIds.add(difat);
|
|
30114
|
+
const bytes = sector(difat), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30115
|
+
for (let j = 0; j < (sectorSize - 4) / 4 && fatIds.length < fatCount; j++) {
|
|
30116
|
+
const id = dv.getUint32(j * 4, true);
|
|
30117
|
+
if (id <= MAX)
|
|
30118
|
+
fatIds.push(id);
|
|
30119
|
+
}
|
|
30120
|
+
difat = dv.getUint32(sectorSize - 4, true);
|
|
30121
|
+
}
|
|
30122
|
+
if (fatIds.length !== fatCount || new Set(fatIds).size !== fatIds.length || fatIds.some((id) => difatIds.has(id)))
|
|
30123
|
+
return reject();
|
|
30124
|
+
const fat = [];
|
|
30125
|
+
for (const id of fatIds) {
|
|
30126
|
+
const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30127
|
+
for (let j = 0; j < sectorSize / 4; j++)
|
|
30128
|
+
fat.push(dv.getUint32(j * 4, true));
|
|
30129
|
+
}
|
|
30130
|
+
const exactChain = (table2, start, bytes, unit2) => chain(table2, start, Math.ceil(bytes / unit2));
|
|
30131
|
+
const dirStart = read32(48), dirSectors = chainToEnd(fat, dirStart, sectorCount);
|
|
30132
|
+
const dirBytes = new Uint8Array(dirSectors.length * sectorSize);
|
|
30133
|
+
dirSectors.forEach((id, i2) => dirBytes.set(sector(id), i2 * sectorSize));
|
|
30134
|
+
const dvDir = new DataView(dirBytes.buffer);
|
|
30135
|
+
const entries2 = [];
|
|
30136
|
+
for (let p = 0, id = 0; p + SIZE <= dirBytes.length; p += SIZE, id++) {
|
|
30137
|
+
const type = dirBytes[p + 66];
|
|
30138
|
+
if (type === 0)
|
|
30139
|
+
continue;
|
|
30140
|
+
const nameLength = dvDir.getUint16(p + 64, true);
|
|
30141
|
+
if (nameLength < 2 || nameLength > 64 || nameLength % 2)
|
|
30142
|
+
return reject();
|
|
30143
|
+
let name = "";
|
|
30144
|
+
for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
|
|
30145
|
+
name += String.fromCharCode(dvDir.getUint16(p + i2, true));
|
|
30146
|
+
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
30147
|
+
if (sizeHigh !== 0)
|
|
30148
|
+
return reject();
|
|
30149
|
+
entries2.push({
|
|
30150
|
+
id,
|
|
30151
|
+
name,
|
|
30152
|
+
type,
|
|
30153
|
+
left: dvDir.getUint32(p + 68, true),
|
|
30154
|
+
right: dvDir.getUint32(p + 72, true),
|
|
30155
|
+
child: dvDir.getUint32(p + 76, true),
|
|
30156
|
+
start: dvDir.getUint32(p + 116, true),
|
|
30157
|
+
size: sizeLow
|
|
30158
|
+
});
|
|
30159
|
+
}
|
|
30160
|
+
const byId = new Map(entries2.map((e) => [e.id, e]));
|
|
30161
|
+
const root = entries2.find((e) => e.type === 5);
|
|
30162
|
+
if (!root)
|
|
30163
|
+
return reject();
|
|
30164
|
+
let parent = root, target;
|
|
30165
|
+
for (let partIndex = 0; partIndex < path.length; partIndex++) {
|
|
30166
|
+
const matches2 = [], seen = /* @__PURE__ */ new Set();
|
|
30167
|
+
const visit = (id) => {
|
|
30168
|
+
if (id === NIL)
|
|
30169
|
+
return;
|
|
30170
|
+
if (seen.has(id))
|
|
30171
|
+
throw new Error("Cyclic directory tree");
|
|
30172
|
+
seen.add(id);
|
|
30173
|
+
const e = byId.get(id);
|
|
30174
|
+
if (!e)
|
|
30175
|
+
throw new Error("Invalid directory ID");
|
|
30176
|
+
visit(e.left);
|
|
30177
|
+
if (e.name.toLocaleLowerCase() === path[partIndex].toLocaleLowerCase())
|
|
30178
|
+
matches2.push(e);
|
|
30179
|
+
visit(e.right);
|
|
30180
|
+
};
|
|
30181
|
+
visit(parent.child);
|
|
30182
|
+
if (matches2.length !== 1)
|
|
30183
|
+
return reject();
|
|
30184
|
+
target = matches2[0];
|
|
30185
|
+
if (partIndex < path.length - 1) {
|
|
30186
|
+
if (target.type !== 1)
|
|
30187
|
+
return reject();
|
|
30188
|
+
parent = target;
|
|
30189
|
+
} else if (target.type !== 2 || replacement && replacement.length !== target.size)
|
|
30190
|
+
return reject();
|
|
30191
|
+
}
|
|
30192
|
+
if (!target)
|
|
30193
|
+
return reject();
|
|
30194
|
+
const names = entries2.map((e) => e.name.toLowerCase());
|
|
30195
|
+
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
30196
|
+
return reject();
|
|
30197
|
+
for (const name of replacement ? ["book", "workbook"] : []) {
|
|
30198
|
+
if (!names.includes(name))
|
|
30199
|
+
continue;
|
|
30200
|
+
const workbook = readCompoundFileStream(input, [name]);
|
|
30201
|
+
if (!workbook)
|
|
30202
|
+
continue;
|
|
30203
|
+
for (let p = 0; p + 4 <= workbook.length; ) {
|
|
30204
|
+
const record2 = workbook[p] | workbook[p + 1] << 8;
|
|
30205
|
+
const length = workbook[p + 2] | workbook[p + 3] << 8;
|
|
30206
|
+
if (record2 === 47)
|
|
30207
|
+
return reject();
|
|
30208
|
+
if (p + 4 + length > workbook.length || record2 === 10)
|
|
30209
|
+
break;
|
|
30210
|
+
p += 4 + length;
|
|
30211
|
+
}
|
|
30212
|
+
}
|
|
30213
|
+
if (replacement && names.includes("worddocument")) {
|
|
30214
|
+
const word = readCompoundFileStream(input, ["WordDocument"]);
|
|
30215
|
+
if (word && word.length >= 12 && ((word[10] | word[11] << 8) & 256) !== 0)
|
|
30216
|
+
return reject();
|
|
30217
|
+
}
|
|
30218
|
+
const miniCutoff = read32(56), miniFatCount = read32(64), miniFatStart = read32(60);
|
|
30219
|
+
const miniFatSectors = miniFatCount ? chain(fat, miniFatStart, miniFatCount) : [];
|
|
30220
|
+
const metadataSectors = [...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors];
|
|
30221
|
+
if (new Set(metadataSectors).size !== metadataSectors.length)
|
|
30222
|
+
return reject();
|
|
30223
|
+
const miniFat = [];
|
|
30224
|
+
for (const id of miniFatSectors) {
|
|
30225
|
+
const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30226
|
+
for (let j = 0; j < sectorSize / 4; j++)
|
|
30227
|
+
miniFat.push(dv.getUint32(j * 4, true));
|
|
30228
|
+
}
|
|
30229
|
+
const reserved = /* @__PURE__ */ new Set([...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors]);
|
|
30230
|
+
const regularUsed = new Set(reserved);
|
|
30231
|
+
const rootMini = entries2.find((e) => e.type === 5);
|
|
30232
|
+
for (const entry5 of entries2) {
|
|
30233
|
+
if (entry5.type !== 2 && entry5.type !== 5 || entry5.size === 0)
|
|
30234
|
+
continue;
|
|
30235
|
+
if (entry5.type === 2 && entry5.size < miniCutoff)
|
|
30236
|
+
continue;
|
|
30237
|
+
for (const id of exactChain(fat, entry5.start, entry5.size, sectorSize)) {
|
|
30238
|
+
sector(id);
|
|
30239
|
+
if (regularUsed.has(id))
|
|
30240
|
+
return reject();
|
|
30241
|
+
regularUsed.add(id);
|
|
30242
|
+
}
|
|
30243
|
+
}
|
|
30244
|
+
const miniUsed = /* @__PURE__ */ new Set();
|
|
30245
|
+
for (const entry5 of entries2) {
|
|
30246
|
+
if (entry5.type !== 2 || entry5.size === 0 || entry5.size >= miniCutoff)
|
|
30247
|
+
continue;
|
|
30248
|
+
const ids = exactChain(miniFat, entry5.start, entry5.size, miniSize);
|
|
30249
|
+
for (const id of ids) {
|
|
30250
|
+
if (id * miniSize >= rootMini.size || miniUsed.has(id))
|
|
30251
|
+
return reject();
|
|
30252
|
+
miniUsed.add(id);
|
|
30253
|
+
}
|
|
30254
|
+
}
|
|
30255
|
+
if (!replacement) {
|
|
30256
|
+
if (target.size >= miniCutoff) {
|
|
30257
|
+
const ids2 = exactChain(fat, target.start, target.size, sectorSize);
|
|
30258
|
+
const result2 = new Uint8Array(ids2.length * sectorSize);
|
|
30259
|
+
ids2.forEach((id, i2) => result2.set(sector(id), i2 * sectorSize));
|
|
30260
|
+
return result2.slice(0, target.size);
|
|
30261
|
+
}
|
|
30262
|
+
const ids = exactChain(miniFat, target.start, target.size, miniSize);
|
|
30263
|
+
const rootSectors = exactChain(fat, rootMini.start, rootMini.size, sectorSize);
|
|
30264
|
+
const result = new Uint8Array(ids.length * miniSize);
|
|
30265
|
+
ids.forEach((id, i2) => {
|
|
30266
|
+
const start = id * miniSize;
|
|
30267
|
+
if (start + miniSize > rootMini.size)
|
|
30268
|
+
throw new Error("Mini stream out of bounds");
|
|
30269
|
+
const rootSector = rootSectors[Math.floor(start / sectorSize)];
|
|
30270
|
+
const source = sector(rootSector).subarray(start % sectorSize, start % sectorSize + miniSize);
|
|
30271
|
+
result.set(source, i2 * miniSize);
|
|
30272
|
+
});
|
|
30273
|
+
return result.slice(0, target.size);
|
|
30274
|
+
}
|
|
30275
|
+
const output = input.slice();
|
|
30276
|
+
if (target.size >= miniCutoff) {
|
|
30277
|
+
const sectors = exactChain(fat, target.start, target.size, sectorSize);
|
|
30278
|
+
sectors.forEach((id) => sector(id));
|
|
30279
|
+
for (let i2 = 0; i2 < sectors.length; i2++)
|
|
30280
|
+
output.set(replacement.subarray(i2 * sectorSize, Math.min((i2 + 1) * sectorSize, replacement.length)), offset(sectors[i2]));
|
|
30281
|
+
} else {
|
|
30282
|
+
if (!miniFat.length)
|
|
30283
|
+
return reject();
|
|
30284
|
+
const miniSectors = exactChain(miniFat, target.start, target.size, miniSize);
|
|
30285
|
+
const rootMini2 = entries2.find((e) => e.type === 5);
|
|
30286
|
+
const rootSectors = exactChain(fat, rootMini2.start, rootMini2.size, sectorSize);
|
|
30287
|
+
rootSectors.forEach((id) => sector(id));
|
|
30288
|
+
const rootData = new Uint8Array(rootMini2.size);
|
|
30289
|
+
rootSectors.forEach((id, i2) => rootData.set(sector(id).subarray(0, Math.min(sectorSize, rootData.length - i2 * sectorSize)), i2 * sectorSize));
|
|
30290
|
+
for (let i2 = 0; i2 < replacement.length; i2++) {
|
|
30291
|
+
const miniOffset = miniSectors[Math.floor(i2 / miniSize)] * miniSize + i2 % miniSize;
|
|
30292
|
+
if (miniOffset >= rootData.length)
|
|
30293
|
+
return reject();
|
|
30294
|
+
const rootSectorIndex = Math.floor(miniOffset / sectorSize);
|
|
30295
|
+
const rootSector = rootSectors[rootSectorIndex];
|
|
30296
|
+
if (rootSector === void 0)
|
|
30297
|
+
return reject();
|
|
30298
|
+
const physical = offset(rootSector) + miniOffset % sectorSize;
|
|
30299
|
+
output[physical] = replacement[i2];
|
|
30300
|
+
}
|
|
30301
|
+
}
|
|
30302
|
+
return output;
|
|
30303
|
+
} catch {
|
|
30304
|
+
return reject();
|
|
30305
|
+
}
|
|
30306
|
+
}
|
|
30307
|
+
function readCompoundFileStream(input, path) {
|
|
30308
|
+
return processCompoundFileStream(input, path);
|
|
30309
|
+
}
|
|
30310
|
+
function replaceCompoundFileStream(input, path, replacement) {
|
|
30311
|
+
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
30312
|
+
}
|
|
30313
|
+
var END;
|
|
30314
|
+
var MAX;
|
|
30315
|
+
var NIL;
|
|
30316
|
+
var SIZE;
|
|
30317
|
+
var init_ole2_stream_edit = __esm({
|
|
30318
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js"() {
|
|
30319
|
+
END = 4294967294;
|
|
30320
|
+
MAX = 4294967290;
|
|
30321
|
+
NIL = 4294967295;
|
|
30322
|
+
SIZE = 128;
|
|
30323
|
+
}
|
|
30324
|
+
});
|
|
30061
30325
|
function unwrapXlsBytes(bytes) {
|
|
30062
|
-
if (!
|
|
30326
|
+
if (!isCfb(bytes)) {
|
|
30063
30327
|
return { workbookBytes: bytes };
|
|
30064
30328
|
}
|
|
30065
30329
|
try {
|
|
30066
|
-
const buffer = bytes.buffer.slice(
|
|
30067
|
-
bytes.byteOffset,
|
|
30068
|
-
bytes.byteOffset + bytes.byteLength
|
|
30069
|
-
);
|
|
30330
|
+
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
30070
30331
|
const ole = parseOle2(buffer);
|
|
30071
|
-
const
|
|
30072
|
-
|
|
30073
|
-
|
|
30074
|
-
|
|
30075
|
-
|
|
30332
|
+
const workbookEntries = ole.entries.filter((e) => e.type === ENTRY_TYPE_STREAM && WORKBOOK_STREAM_NAMES.includes(e.name.toLowerCase()));
|
|
30333
|
+
const rootWorkbooks = WORKBOOK_STREAM_NAMES.map((name) => ({
|
|
30334
|
+
name,
|
|
30335
|
+
data: readCompoundFileStream(bytes, [name])
|
|
30336
|
+
})).filter((item3) => item3.data !== void 0);
|
|
30337
|
+
if (rootWorkbooks.length !== 1)
|
|
30338
|
+
return { workbookBytes: bytes };
|
|
30339
|
+
const rootWorkbook = rootWorkbooks[0];
|
|
30340
|
+
const streamEntry = rootWorkbook ? workbookEntries.find((entry5) => entry5.name.toLowerCase() === rootWorkbook.name) : void 0;
|
|
30341
|
+
const workbookBytes = rootWorkbook?.data;
|
|
30342
|
+
if (!rootWorkbook || !streamEntry || !workbookBytes) {
|
|
30076
30343
|
return { workbookBytes: bytes };
|
|
30077
30344
|
}
|
|
30078
30345
|
const rootClsid = ole.entries.find((e) => e.type === ENTRY_TYPE_ROOT)?.clsid;
|
|
30346
|
+
const originalBytes = bytes;
|
|
30347
|
+
const canRebuild = hasFlatUniqueStreamLayout(ole.entries, workbookEntries.length);
|
|
30079
30348
|
return {
|
|
30080
30349
|
workbookBytes,
|
|
30081
30350
|
rewrap: (editedWorkbookBytes) => {
|
|
30351
|
+
if (equalBytes(editedWorkbookBytes, workbookBytes))
|
|
30352
|
+
return originalBytes;
|
|
30353
|
+
if (editedWorkbookBytes.length === workbookBytes.length) {
|
|
30354
|
+
return replaceCompoundFileStream(originalBytes, [streamEntry.name], editedWorkbookBytes);
|
|
30355
|
+
}
|
|
30356
|
+
if (!canRebuild)
|
|
30357
|
+
return originalBytes;
|
|
30082
30358
|
const streams = /* @__PURE__ */ new Map();
|
|
30083
30359
|
for (const entry5 of ole.entries) {
|
|
30084
30360
|
if (entry5.type !== ENTRY_TYPE_STREAM) {
|
|
30085
30361
|
continue;
|
|
30086
30362
|
}
|
|
30087
|
-
const data = entry5.name === streamEntry.name ? editedWorkbookBytes : ole.getStream(entry5.name);
|
|
30363
|
+
const data = entry5.name.toLowerCase() === streamEntry.name.toLowerCase() ? editedWorkbookBytes : ole.getStream(entry5.name);
|
|
30088
30364
|
if (data) {
|
|
30089
30365
|
streams.set(entry5.name, data);
|
|
30090
30366
|
}
|
|
@@ -30096,14 +30372,28 @@ function unwrapXlsBytes(bytes) {
|
|
|
30096
30372
|
return { workbookBytes: bytes };
|
|
30097
30373
|
}
|
|
30098
30374
|
}
|
|
30375
|
+
function hasFlatUniqueStreamLayout(entries2, workbookCount) {
|
|
30376
|
+
const rootEntries = entries2.filter((entry5) => entry5.type === ENTRY_TYPE_ROOT);
|
|
30377
|
+
const streamEntries = entries2.filter((entry5) => entry5.type === ENTRY_TYPE_STREAM);
|
|
30378
|
+
if (rootEntries.length !== 1 || workbookCount !== 1 || entries2.length !== rootEntries.length + streamEntries.length)
|
|
30379
|
+
return false;
|
|
30380
|
+
const names = streamEntries.map((entry5) => entry5.name.toLowerCase());
|
|
30381
|
+
return new Set(names).size === names.length;
|
|
30382
|
+
}
|
|
30383
|
+
function equalBytes(left, right) {
|
|
30384
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
30385
|
+
}
|
|
30386
|
+
function isCfb(bytes) {
|
|
30387
|
+
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
30388
|
+
}
|
|
30099
30389
|
var WORKBOOK_STREAM_NAMES;
|
|
30100
|
-
var
|
|
30101
|
-
"
|
|
30102
|
-
init_ole_embedded_extract();
|
|
30390
|
+
var init_legacy_excel_cfb = __esm({
|
|
30391
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js"() {
|
|
30103
30392
|
init_ole2_parser_read();
|
|
30104
30393
|
init_ole2_parser_types();
|
|
30105
30394
|
init_ole2_parser_write();
|
|
30106
|
-
|
|
30395
|
+
init_ole2_stream_edit();
|
|
30396
|
+
WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
30107
30397
|
}
|
|
30108
30398
|
});
|
|
30109
30399
|
function readRecords(bytes, start, end) {
|
|
@@ -30142,6 +30432,17 @@ function findAllWorksheetRanges(bytes) {
|
|
|
30142
30432
|
}
|
|
30143
30433
|
return ranges;
|
|
30144
30434
|
}
|
|
30435
|
+
function isSupportedBiff8Workbook(bytes) {
|
|
30436
|
+
const records = readRecords(bytes, 0, bytes.length);
|
|
30437
|
+
const bof = records[0];
|
|
30438
|
+
if (!bof || bof.opcode !== OPCODE_BOF || bof.length < 4)
|
|
30439
|
+
return false;
|
|
30440
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30441
|
+
if (view.getUint16(bof.dataOffset, true) !== 1536 || view.getUint16(bof.dataOffset + 2, true) !== 5)
|
|
30442
|
+
return false;
|
|
30443
|
+
const globalsEnd = records.find((record2) => record2.opcode === OPCODE_EOF)?.headerOffset ?? bytes.length;
|
|
30444
|
+
return !records.some((record2) => record2.opcode === OPCODE_FILEPASS && record2.headerOffset < globalsEnd);
|
|
30445
|
+
}
|
|
30145
30446
|
function findFirstWorksheetRange(bytes) {
|
|
30146
30447
|
return findAllWorksheetRanges(bytes)[0];
|
|
30147
30448
|
}
|
|
@@ -30192,6 +30493,8 @@ function parseSstSingleRecord(bytes) {
|
|
|
30192
30493
|
}
|
|
30193
30494
|
function readOleXlsGrid(inputBytes, maxRows = DEFAULT_MAX_ROWS2, maxCols = DEFAULT_MAX_COLS2) {
|
|
30194
30495
|
const xlsBytes = unwrapXlsBytes(inputBytes).workbookBytes;
|
|
30496
|
+
if (!isSupportedBiff8Workbook(xlsBytes))
|
|
30497
|
+
return void 0;
|
|
30195
30498
|
const range = findFirstWorksheetRange(xlsBytes);
|
|
30196
30499
|
if (!range) {
|
|
30197
30500
|
return void 0;
|
|
@@ -30266,6 +30569,8 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
|
|
|
30266
30569
|
return inputBytes;
|
|
30267
30570
|
}
|
|
30268
30571
|
const { workbookBytes: xlsBytes, rewrap } = unwrapXlsBytes(inputBytes);
|
|
30572
|
+
if (!isSupportedBiff8Workbook(xlsBytes))
|
|
30573
|
+
return inputBytes;
|
|
30269
30574
|
const range = findFirstWorksheetRange(xlsBytes);
|
|
30270
30575
|
if (!range) {
|
|
30271
30576
|
return inputBytes;
|
|
@@ -30294,6 +30599,7 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
|
|
|
30294
30599
|
}
|
|
30295
30600
|
var OPCODE_BOF;
|
|
30296
30601
|
var OPCODE_EOF;
|
|
30602
|
+
var OPCODE_FILEPASS;
|
|
30297
30603
|
var OPCODE_NUMBER;
|
|
30298
30604
|
var OPCODE_RK;
|
|
30299
30605
|
var OPCODE_LABELSST;
|
|
@@ -30308,11 +30614,12 @@ var OPCODE_BOUNDSHEET;
|
|
|
30308
30614
|
var WORKSHEET_DT;
|
|
30309
30615
|
var DEFAULT_MAX_ROWS2;
|
|
30310
30616
|
var DEFAULT_MAX_COLS2;
|
|
30311
|
-
var
|
|
30312
|
-
"
|
|
30313
|
-
|
|
30617
|
+
var init_legacy_excel_biff8 = __esm({
|
|
30618
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js"() {
|
|
30619
|
+
init_legacy_excel_cfb();
|
|
30314
30620
|
OPCODE_BOF = 2057;
|
|
30315
30621
|
OPCODE_EOF = 10;
|
|
30622
|
+
OPCODE_FILEPASS = 47;
|
|
30316
30623
|
OPCODE_NUMBER = 515;
|
|
30317
30624
|
OPCODE_RK = 638;
|
|
30318
30625
|
OPCODE_LABELSST = 253;
|
|
@@ -30329,6 +30636,11 @@ var init_ole_sheet_xls_biff8 = __esm({
|
|
|
30329
30636
|
DEFAULT_MAX_COLS2 = 26;
|
|
30330
30637
|
}
|
|
30331
30638
|
});
|
|
30639
|
+
var init_ole_sheet_xls_biff8 = __esm({
|
|
30640
|
+
"src/core/utils/ole-sheet-xls-biff8.ts"() {
|
|
30641
|
+
init_legacy_excel_biff8();
|
|
30642
|
+
}
|
|
30643
|
+
});
|
|
30332
30644
|
function biffRecord(opcode, data) {
|
|
30333
30645
|
return [
|
|
30334
30646
|
opcode & 255,
|
|
@@ -30355,9 +30667,7 @@ function parseXlsGrid(bytes, range) {
|
|
|
30355
30667
|
for (const rec of readRecords(bytes, range.start, range.end)) {
|
|
30356
30668
|
if (rec.opcode === OPCODE_ROW && rec.length >= 16) {
|
|
30357
30669
|
const rw = view.getUint16(rec.dataOffset, true);
|
|
30358
|
-
rowFor(rw).extraRowBytes = Array.from(
|
|
30359
|
-
bytes.subarray(rec.dataOffset + 6, rec.dataOffset + 16)
|
|
30360
|
-
);
|
|
30670
|
+
rowFor(rw).extraRowBytes = Array.from(bytes.subarray(rec.dataOffset + 6, rec.dataOffset + 16));
|
|
30361
30671
|
continue;
|
|
30362
30672
|
}
|
|
30363
30673
|
if (rec.length < 6) {
|
|
@@ -30404,9 +30714,7 @@ function buildXlsRowCellRegion(grid) {
|
|
|
30404
30714
|
const colLast = cols.length > 0 ? cols[cols.length - 1] + 1 : 0;
|
|
30405
30715
|
rowRecordOffsets.push(bytesOut.length);
|
|
30406
30716
|
const extra = row.extraRowBytes ?? [255, 0, 0, 0, 0, 1, 15, 0];
|
|
30407
|
-
bytesOut.push(
|
|
30408
|
-
...biffRecord(OPCODE_ROW, [...u16le(r), ...u16le(colFirst), ...u16le(colLast), ...extra])
|
|
30409
|
-
);
|
|
30717
|
+
bytesOut.push(...biffRecord(OPCODE_ROW, [...u16le(r), ...u16le(colFirst), ...u16le(colLast), ...extra]));
|
|
30410
30718
|
}
|
|
30411
30719
|
for (const r of rows) {
|
|
30412
30720
|
const row = grid.get(r);
|
|
@@ -30415,27 +30723,23 @@ function buildXlsRowCellRegion(grid) {
|
|
|
30415
30723
|
for (const c of cols) {
|
|
30416
30724
|
const cell = row.cells.get(c);
|
|
30417
30725
|
if (cell.kind === "sst") {
|
|
30418
|
-
bytesOut.push(
|
|
30419
|
-
...
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
])
|
|
30427
|
-
);
|
|
30726
|
+
bytesOut.push(...biffRecord(OPCODE_LABELSST, [
|
|
30727
|
+
...u16le(r),
|
|
30728
|
+
...u16le(c),
|
|
30729
|
+
...u16le(cell.ixfe),
|
|
30730
|
+
...u16le(cell.value),
|
|
30731
|
+
0,
|
|
30732
|
+
0
|
|
30733
|
+
]));
|
|
30428
30734
|
} else if (cell.kind === "number") {
|
|
30429
30735
|
const buffer = new ArrayBuffer(8);
|
|
30430
30736
|
new DataView(buffer).setFloat64(0, cell.value, true);
|
|
30431
|
-
bytesOut.push(
|
|
30432
|
-
...
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
])
|
|
30438
|
-
);
|
|
30737
|
+
bytesOut.push(...biffRecord(OPCODE_NUMBER, [
|
|
30738
|
+
...u16le(r),
|
|
30739
|
+
...u16le(c),
|
|
30740
|
+
...u16le(cell.ixfe),
|
|
30741
|
+
...Array.from(new Uint8Array(buffer))
|
|
30742
|
+
]));
|
|
30439
30743
|
} else {
|
|
30440
30744
|
bytesOut.push(...biffRecord(OPCODE_BLANK, [...u16le(r), ...u16le(c), ...u16le(cell.ixfe)]));
|
|
30441
30745
|
}
|
|
@@ -30456,9 +30760,9 @@ function buildXlsRowCellRegion(grid) {
|
|
|
30456
30760
|
}
|
|
30457
30761
|
return Uint8Array.from(bytesOut);
|
|
30458
30762
|
}
|
|
30459
|
-
var
|
|
30460
|
-
"
|
|
30461
|
-
|
|
30763
|
+
var init_legacy_excel_biff8_grid = __esm({
|
|
30764
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js"() {
|
|
30765
|
+
init_legacy_excel_biff8();
|
|
30462
30766
|
}
|
|
30463
30767
|
});
|
|
30464
30768
|
function resolveSstIndex(sharedStrings, value) {
|
|
@@ -30525,6 +30829,8 @@ function patchBoundsheetOffsets(bytes, delta) {
|
|
|
30525
30829
|
function writeOleXlsStringCellEdit(inputBytes, edit) {
|
|
30526
30830
|
try {
|
|
30527
30831
|
const { workbookBytes: xlsBytes, rewrap } = unwrapXlsBytes(inputBytes);
|
|
30832
|
+
if (!isSupportedBiff8Workbook(xlsBytes))
|
|
30833
|
+
return inputBytes;
|
|
30528
30834
|
const finish2 = (result) => rewrap ? rewrap(result) : result;
|
|
30529
30835
|
const ranges = findAllWorksheetRanges(xlsBytes);
|
|
30530
30836
|
const target = ranges[0];
|
|
@@ -30564,9 +30870,7 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
|
|
|
30564
30870
|
const patchedXlsBytes = patchBoundsheetOffsets(xlsBytes, newSstSpanLength - oldSstSpanLength);
|
|
30565
30871
|
const out = [
|
|
30566
30872
|
...patchedXlsBytes.subarray(0, sstRecord.headerOffset),
|
|
30567
|
-
...newSstRecord ?? Array.from(
|
|
30568
|
-
patchedXlsBytes.subarray(sstRecord.headerOffset, sstRecord.dataOffset + sstRecord.length)
|
|
30569
|
-
),
|
|
30873
|
+
...newSstRecord ?? Array.from(patchedXlsBytes.subarray(sstRecord.headerOffset, sstRecord.dataOffset + sstRecord.length)),
|
|
30570
30874
|
// EXTSST is dropped; Excel recomputes it on open.
|
|
30571
30875
|
...patchedXlsBytes.subarray(sstEnd, region.start),
|
|
30572
30876
|
...newRegion,
|
|
@@ -30577,11 +30881,16 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
|
|
|
30577
30881
|
return inputBytes;
|
|
30578
30882
|
}
|
|
30579
30883
|
}
|
|
30884
|
+
var init_legacy_excel_biff8_writer = __esm({
|
|
30885
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js"() {
|
|
30886
|
+
init_legacy_excel_biff8();
|
|
30887
|
+
init_legacy_excel_biff8_grid();
|
|
30888
|
+
init_legacy_excel_cfb();
|
|
30889
|
+
}
|
|
30890
|
+
});
|
|
30580
30891
|
var init_ole_sheet_xls_biff8_writer = __esm({
|
|
30581
30892
|
"src/core/utils/ole-sheet-xls-biff8-writer.ts"() {
|
|
30582
|
-
|
|
30583
|
-
init_ole_sheet_xls_biff8_grid();
|
|
30584
|
-
init_ole_sheet_xls_cfb();
|
|
30893
|
+
init_legacy_excel_biff8_writer();
|
|
30585
30894
|
}
|
|
30586
30895
|
});
|
|
30587
30896
|
function createWordXmlParser() {
|
|
@@ -30739,7 +31048,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
30739
31048
|
var FC_LCB_INDEX;
|
|
30740
31049
|
var F_COMPLEX_BIT;
|
|
30741
31050
|
var init_ole_document_doc_fib = __esm({
|
|
30742
|
-
"
|
|
31051
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js"() {
|
|
30743
31052
|
FC_LCB_INDEX = {
|
|
30744
31053
|
plcfbteChpx: 12,
|
|
30745
31054
|
plcfbtePapx: 13,
|
|
@@ -30750,14 +31059,11 @@ var init_ole_document_doc_fib = __esm({
|
|
|
30750
31059
|
}
|
|
30751
31060
|
});
|
|
30752
31061
|
function unwrapDocBytes(bytes) {
|
|
30753
|
-
if (
|
|
31062
|
+
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) {
|
|
30754
31063
|
return void 0;
|
|
30755
31064
|
}
|
|
30756
31065
|
try {
|
|
30757
|
-
const buffer = bytes.buffer.slice(
|
|
30758
|
-
bytes.byteOffset,
|
|
30759
|
-
bytes.byteOffset + bytes.byteLength
|
|
30760
|
-
);
|
|
31066
|
+
const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
30761
31067
|
const ole = parseOle2(buffer);
|
|
30762
31068
|
const wordDocBytes = ole.getStream("WordDocument");
|
|
30763
31069
|
if (!wordDocBytes) {
|
|
@@ -30792,9 +31098,8 @@ function unwrapDocBytes(bytes) {
|
|
|
30792
31098
|
}
|
|
30793
31099
|
}
|
|
30794
31100
|
var init_ole_document_doc_cfb = __esm({
|
|
30795
|
-
"
|
|
31101
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js"() {
|
|
30796
31102
|
init_ole_document_doc_fib();
|
|
30797
|
-
init_ole_embedded_extract();
|
|
30798
31103
|
init_ole2_parser_read();
|
|
30799
31104
|
init_ole2_parser_types();
|
|
30800
31105
|
init_ole2_parser_write();
|
|
@@ -30907,7 +31212,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
30907
31212
|
}
|
|
30908
31213
|
var PAGE_SIZE;
|
|
30909
31214
|
var init_ole_document_doc_fkp = __esm({
|
|
30910
|
-
"
|
|
31215
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js"() {
|
|
30911
31216
|
PAGE_SIZE = 512;
|
|
30912
31217
|
}
|
|
30913
31218
|
});
|
|
@@ -30945,7 +31250,7 @@ function encodeCp1252(text22) {
|
|
|
30945
31250
|
var CP1252_HIGH_BLOCK;
|
|
30946
31251
|
var CP1252_HIGH_BLOCK_REVERSE;
|
|
30947
31252
|
var init_ole_document_doc_cp1252 = __esm({
|
|
30948
|
-
"
|
|
31253
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js"() {
|
|
30949
31254
|
CP1252_HIGH_BLOCK = [
|
|
30950
31255
|
8364,
|
|
30951
31256
|
129,
|
|
@@ -30980,9 +31285,7 @@ var init_ole_document_doc_cp1252 = __esm({
|
|
|
30980
31285
|
382,
|
|
30981
31286
|
376
|
|
30982
31287
|
];
|
|
30983
|
-
CP1252_HIGH_BLOCK_REVERSE = new Map(
|
|
30984
|
-
CP1252_HIGH_BLOCK.map((codePoint, i2) => [codePoint, 128 + i2])
|
|
30985
|
-
);
|
|
31288
|
+
CP1252_HIGH_BLOCK_REVERSE = new Map(CP1252_HIGH_BLOCK.map((codePoint, i2) => [codePoint, 128 + i2]));
|
|
30986
31289
|
}
|
|
30987
31290
|
});
|
|
30988
31291
|
function parsePieceTable(tableStream, clx) {
|
|
@@ -31146,7 +31449,7 @@ function buildClxBytes(pieces) {
|
|
|
31146
31449
|
var CLXT_PRC;
|
|
31147
31450
|
var CLXT_PCDT;
|
|
31148
31451
|
var init_ole_document_doc_pieces = __esm({
|
|
31149
|
-
"
|
|
31452
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js"() {
|
|
31150
31453
|
init_ole_document_doc_cp1252();
|
|
31151
31454
|
CLXT_PRC = 1;
|
|
31152
31455
|
CLXT_PCDT = 2;
|
|
@@ -31279,9 +31582,7 @@ function writeOleDocParagraphEdit(docBytes, paragraphIndex, text22) {
|
|
|
31279
31582
|
const clxBytes = buildClxBytes(newPieces);
|
|
31280
31583
|
const papxBteBytes = buildBteTableBytes(newPapxBte);
|
|
31281
31584
|
const chpxBteBytes = buildBteTableBytes(newChpxBte);
|
|
31282
|
-
const newTableBytes = new Uint8Array(
|
|
31283
|
-
cfb.tableBytes.length + clxBytes.length + papxBteBytes.length + chpxBteBytes.length
|
|
31284
|
-
);
|
|
31585
|
+
const newTableBytes = new Uint8Array(cfb.tableBytes.length + clxBytes.length + papxBteBytes.length + chpxBteBytes.length);
|
|
31285
31586
|
newTableBytes.set(cfb.tableBytes, 0);
|
|
31286
31587
|
let tableOff = cfb.tableBytes.length;
|
|
31287
31588
|
const newClx = { fc: tableOff, lcb: clxBytes.length };
|
|
@@ -31308,7 +31609,7 @@ function writeOleDocParagraphEdit(docBytes, paragraphIndex, text22) {
|
|
|
31308
31609
|
var RISKY_PLCF_INDICES;
|
|
31309
31610
|
var RISKY_STTB_INDICES;
|
|
31310
31611
|
var init_ole_document_doc_editor = __esm({
|
|
31311
|
-
"
|
|
31612
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js"() {
|
|
31312
31613
|
init_ole_document_doc_cfb();
|
|
31313
31614
|
init_ole_document_doc_fib();
|
|
31314
31615
|
init_ole_document_doc_fkp();
|
|
@@ -31317,6 +31618,11 @@ var init_ole_document_doc_editor = __esm({
|
|
|
31317
31618
|
RISKY_STTB_INDICES = [21, 22, 23];
|
|
31318
31619
|
}
|
|
31319
31620
|
});
|
|
31621
|
+
var init_ole_document_doc_editor2 = __esm({
|
|
31622
|
+
"src/core/utils/ole-document-doc-editor.ts"() {
|
|
31623
|
+
init_ole_document_doc_editor();
|
|
31624
|
+
}
|
|
31625
|
+
});
|
|
31320
31626
|
function isTextBearingElement(el) {
|
|
31321
31627
|
return el.type === "text" || el.type === "shape";
|
|
31322
31628
|
}
|
|
@@ -31466,9 +31772,7 @@ function buildChunk(type, data) {
|
|
|
31466
31772
|
}
|
|
31467
31773
|
function encodePng(width, height, rgba) {
|
|
31468
31774
|
if (rgba.length !== width * height * 4) {
|
|
31469
|
-
throw new Error(
|
|
31470
|
-
`encodePng: rgba length ${rgba.length} does not match ${width}x${height}x4 = ${width * height * 4}`
|
|
31471
|
-
);
|
|
31775
|
+
throw new Error(`encodePng: rgba length ${rgba.length} does not match ${width}x${height}x4 = ${width * height * 4}`);
|
|
31472
31776
|
}
|
|
31473
31777
|
const ihdr = new Uint8Array(13);
|
|
31474
31778
|
const ihdrView = new DataView(ihdr.buffer);
|
|
@@ -31496,7 +31800,7 @@ function encodePng(width, height, rgba) {
|
|
|
31496
31800
|
var CRC_TABLE;
|
|
31497
31801
|
var PNG_SIGNATURE;
|
|
31498
31802
|
var init_png_encoder = __esm({
|
|
31499
|
-
"
|
|
31803
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
|
|
31500
31804
|
CRC_TABLE = (() => {
|
|
31501
31805
|
const table2 = new Uint32Array(256);
|
|
31502
31806
|
for (let n = 0; n < 256; n++) {
|
|
@@ -31511,6 +31815,11 @@ var init_png_encoder = __esm({
|
|
|
31511
31815
|
PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
31512
31816
|
}
|
|
31513
31817
|
});
|
|
31818
|
+
var init_png_encoder2 = __esm({
|
|
31819
|
+
"src/core/utils/png-encoder.ts"() {
|
|
31820
|
+
init_png_encoder();
|
|
31821
|
+
}
|
|
31822
|
+
});
|
|
31514
31823
|
function rgb(r, g2, b, a = 255) {
|
|
31515
31824
|
return { r, g: g2, b, a };
|
|
31516
31825
|
}
|
|
@@ -31731,7 +32040,7 @@ var WHITE;
|
|
|
31731
32040
|
var CAPTION_COLOR;
|
|
31732
32041
|
var init_ole_icon_raster = __esm({
|
|
31733
32042
|
"src/core/utils/ole-icon-raster.ts"() {
|
|
31734
|
-
|
|
32043
|
+
init_png_encoder2();
|
|
31735
32044
|
init_raster_canvas();
|
|
31736
32045
|
GLYPH_COLORS = {
|
|
31737
32046
|
excel: rgb(33, 115, 70),
|
|
@@ -31822,7 +32131,7 @@ var MAX_ROWS;
|
|
|
31822
32131
|
var MAX_COLS;
|
|
31823
32132
|
var init_ole_content_preview_raster = __esm({
|
|
31824
32133
|
"src/core/utils/ole-content-preview-raster.ts"() {
|
|
31825
|
-
|
|
32134
|
+
init_png_encoder2();
|
|
31826
32135
|
init_raster_canvas();
|
|
31827
32136
|
BORDER = rgb(192, 192, 192);
|
|
31828
32137
|
TEXT = rgb(32, 32, 32);
|
|
@@ -31881,7 +32190,7 @@ async function commitPayload(element, kind, newPayload) {
|
|
|
31881
32190
|
var init_ole_edit_commit = __esm({
|
|
31882
32191
|
"src/core/utils/ole-edit-commit.ts"() {
|
|
31883
32192
|
init_ole_content_preview_raster();
|
|
31884
|
-
|
|
32193
|
+
init_ole_document_doc_editor2();
|
|
31885
32194
|
init_ole_document_docx_editor();
|
|
31886
32195
|
init_ole_embedded_extract();
|
|
31887
32196
|
init_ole_icon_raster();
|
|
@@ -32005,7 +32314,7 @@ async function replaceOleFile(element, fileBytes, fileName) {
|
|
|
32005
32314
|
var init_ole_edit_api = __esm({
|
|
32006
32315
|
"src/core/utils/ole-edit-api.ts"() {
|
|
32007
32316
|
init_data_url_utils();
|
|
32008
|
-
|
|
32317
|
+
init_ole_document_doc_editor2();
|
|
32009
32318
|
init_ole_document_docx_editor();
|
|
32010
32319
|
init_ole_edit_commit();
|
|
32011
32320
|
init_ole_embedded_extract();
|
|
@@ -43639,8 +43948,8 @@ function isCrossRoleReference(constraint) {
|
|
|
43639
43948
|
return (constraint.referenceFor === "ch" || constraint.referenceFor === "des") && Boolean(constraint.referenceForName);
|
|
43640
43949
|
}
|
|
43641
43950
|
function dimDeclaredBy(role, type, declaringRole, box, index) {
|
|
43642
|
-
const
|
|
43643
|
-
for (const candidateRole of
|
|
43951
|
+
const chain2 = typeof declaringRole === "string" ? [declaringRole] : declaringRole;
|
|
43952
|
+
for (const candidateRole of chain2) {
|
|
43644
43953
|
const declared = firstConstraintDeclaredBy(index, role, type, candidateRole);
|
|
43645
43954
|
if (!declared) {
|
|
43646
43955
|
continue;
|
|
@@ -49896,9 +50205,9 @@ var init_encryption_detection = __esm({
|
|
|
49896
50205
|
});
|
|
49897
50206
|
var init_ole2_parser = __esm({
|
|
49898
50207
|
"src/core/utils/ole2-parser.ts"() {
|
|
49899
|
-
|
|
49900
|
-
|
|
49901
|
-
|
|
50208
|
+
init_ole2_parser_types2();
|
|
50209
|
+
init_ole2_parser_read2();
|
|
50210
|
+
init_ole2_parser_write2();
|
|
49902
50211
|
}
|
|
49903
50212
|
});
|
|
49904
50213
|
var IncorrectPasswordError;
|
|
@@ -49923,9 +50232,7 @@ function getSubtle() {
|
|
|
49923
50232
|
if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
|
|
49924
50233
|
return globalThis.crypto.subtle;
|
|
49925
50234
|
}
|
|
49926
|
-
throw new Error(
|
|
49927
|
-
"Web Crypto API (crypto.subtle) is not available in this environment. Password-protected PPTX files require a runtime with Web Crypto support."
|
|
49928
|
-
);
|
|
50235
|
+
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.");
|
|
49929
50236
|
}
|
|
49930
50237
|
function getCrypto() {
|
|
49931
50238
|
if (typeof globalThis.crypto !== "undefined") {
|
|
@@ -49962,10 +50269,6 @@ function uint32LE(value) {
|
|
|
49962
50269
|
return buf;
|
|
49963
50270
|
}
|
|
49964
50271
|
function base64Decode(str) {
|
|
49965
|
-
if (typeof Buffer !== "undefined") {
|
|
49966
|
-
const buf = Buffer.from(str, "base64");
|
|
49967
|
-
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
49968
|
-
}
|
|
49969
50272
|
const binary = atob(str);
|
|
49970
50273
|
const bytes = new Uint8Array(binary.length);
|
|
49971
50274
|
for (let i2 = 0; i2 < binary.length; i2++) {
|
|
@@ -49974,9 +50277,6 @@ function base64Decode(str) {
|
|
|
49974
50277
|
return bytes;
|
|
49975
50278
|
}
|
|
49976
50279
|
function base64Encode(bytes) {
|
|
49977
|
-
if (typeof Buffer !== "undefined") {
|
|
49978
|
-
return Buffer.from(bytes).toString("base64");
|
|
49979
|
-
}
|
|
49980
50280
|
let binary = "";
|
|
49981
50281
|
for (let i2 = 0; i2 < bytes.length; i2++) {
|
|
49982
50282
|
binary += String.fromCharCode(bytes[i2]);
|
|
@@ -50015,30 +50315,16 @@ async function aesCbcDecryptRaw(key2, iv, data) {
|
|
|
50015
50315
|
if (data.length === 0) {
|
|
50016
50316
|
return new Uint8Array(0);
|
|
50017
50317
|
}
|
|
50018
|
-
const cryptoKey = await subtle.importKey(
|
|
50019
|
-
"raw",
|
|
50020
|
-
key2,
|
|
50021
|
-
{ name: "AES-CBC" },
|
|
50022
|
-
false,
|
|
50023
|
-
["encrypt", "decrypt"]
|
|
50024
|
-
);
|
|
50318
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, ["encrypt", "decrypt"]);
|
|
50025
50319
|
const lastCiphertextBlock = data.subarray(data.length - blockSize);
|
|
50026
50320
|
const paddingPlaintext = new Uint8Array(blockSize);
|
|
50027
50321
|
paddingPlaintext.fill(blockSize);
|
|
50028
|
-
const encryptedPadding = await subtle.encrypt(
|
|
50029
|
-
{ name: "AES-CBC", iv: lastCiphertextBlock },
|
|
50030
|
-
cryptoKey,
|
|
50031
|
-
paddingPlaintext
|
|
50032
|
-
);
|
|
50322
|
+
const encryptedPadding = await subtle.encrypt({ name: "AES-CBC", iv: lastCiphertextBlock }, cryptoKey, paddingPlaintext);
|
|
50033
50323
|
const encPadBlock = new Uint8Array(encryptedPadding).subarray(0, blockSize);
|
|
50034
50324
|
const paddedData = new Uint8Array(data.length + blockSize);
|
|
50035
50325
|
paddedData.set(data);
|
|
50036
50326
|
paddedData.set(encPadBlock, data.length);
|
|
50037
|
-
const result = await subtle.decrypt(
|
|
50038
|
-
{ name: "AES-CBC", iv },
|
|
50039
|
-
cryptoKey,
|
|
50040
|
-
paddedData
|
|
50041
|
-
);
|
|
50327
|
+
const result = await subtle.decrypt({ name: "AES-CBC", iv }, cryptoKey, paddedData);
|
|
50042
50328
|
return new Uint8Array(result).subarray(0, data.length);
|
|
50043
50329
|
}
|
|
50044
50330
|
async function aesCbcEncryptNoPad(key2, iv, data) {
|
|
@@ -50047,35 +50333,24 @@ async function aesCbcEncryptNoPad(key2, iv, data) {
|
|
|
50047
50333
|
throw new Error("Data must be block-aligned for no-padding encryption");
|
|
50048
50334
|
}
|
|
50049
50335
|
const subtle = getSubtle();
|
|
50050
|
-
const cryptoKey = await subtle.importKey(
|
|
50051
|
-
|
|
50052
|
-
key2,
|
|
50053
|
-
{ name: "AES-CBC" },
|
|
50054
|
-
false,
|
|
50055
|
-
["encrypt"]
|
|
50056
|
-
);
|
|
50057
|
-
const result = await subtle.encrypt(
|
|
50058
|
-
{ name: "AES-CBC", iv },
|
|
50059
|
-
cryptoKey,
|
|
50060
|
-
data
|
|
50061
|
-
);
|
|
50336
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, ["encrypt"]);
|
|
50337
|
+
const result = await subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, data);
|
|
50062
50338
|
return new Uint8Array(result).subarray(0, data.length);
|
|
50063
50339
|
}
|
|
50064
50340
|
async function hmac(algorithm, key2, data) {
|
|
50065
50341
|
const subtle = getSubtle();
|
|
50066
50342
|
const webCryptoAlg = mapHashAlgorithm(algorithm);
|
|
50067
|
-
const cryptoKey = await subtle.importKey(
|
|
50068
|
-
"raw",
|
|
50069
|
-
key2,
|
|
50070
|
-
{ name: "HMAC", hash: webCryptoAlg },
|
|
50071
|
-
false,
|
|
50072
|
-
["sign"]
|
|
50073
|
-
);
|
|
50343
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "HMAC", hash: webCryptoAlg }, false, ["sign"]);
|
|
50074
50344
|
const result = await subtle.sign("HMAC", cryptoKey, data);
|
|
50075
50345
|
return new Uint8Array(result);
|
|
50076
50346
|
}
|
|
50077
50347
|
var init_ooxml_crypto_primitives = __esm({
|
|
50348
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
|
|
50349
|
+
}
|
|
50350
|
+
});
|
|
50351
|
+
var init_ooxml_crypto_primitives2 = __esm({
|
|
50078
50352
|
"src/core/utils/ooxml-crypto-primitives.ts"() {
|
|
50353
|
+
init_ooxml_crypto_primitives();
|
|
50079
50354
|
}
|
|
50080
50355
|
});
|
|
50081
50356
|
async function deriveAgileKey(password, salt, spinCount, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
@@ -50300,7 +50575,7 @@ var BLOCK_KEYS;
|
|
|
50300
50575
|
var RC4_ALG_ID;
|
|
50301
50576
|
var init_ooxml_crypto_key_derivation = __esm({
|
|
50302
50577
|
"src/core/utils/ooxml-crypto-key-derivation.ts"() {
|
|
50303
|
-
|
|
50578
|
+
init_ooxml_crypto_primitives2();
|
|
50304
50579
|
BLOCK_KEYS = {
|
|
50305
50580
|
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
50306
50581
|
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
@@ -50473,7 +50748,7 @@ var init_ooxml_crypto_decrypt = __esm({
|
|
|
50473
50748
|
"src/core/utils/ooxml-crypto-decrypt.ts"() {
|
|
50474
50749
|
init_ooxml_crypto_errors();
|
|
50475
50750
|
init_ooxml_crypto_key_derivation();
|
|
50476
|
-
|
|
50751
|
+
init_ooxml_crypto_primitives2();
|
|
50477
50752
|
}
|
|
50478
50753
|
});
|
|
50479
50754
|
async function encryptAgilePackage(packageData, key2, info) {
|
|
@@ -50611,7 +50886,7 @@ var init_ooxml_crypto_encrypt = __esm({
|
|
|
50611
50886
|
"src/core/utils/ooxml-crypto-encrypt.ts"() {
|
|
50612
50887
|
init_ole2_parser();
|
|
50613
50888
|
init_ooxml_crypto_key_derivation();
|
|
50614
|
-
|
|
50889
|
+
init_ooxml_crypto_primitives2();
|
|
50615
50890
|
STANDARD_ALG_IDS = {
|
|
50616
50891
|
128: 26126,
|
|
50617
50892
|
// CALG_AES_128
|
|
@@ -50796,7 +51071,7 @@ var init_ooxml_crypto = __esm({
|
|
|
50796
51071
|
init_ooxml_crypto_encrypt();
|
|
50797
51072
|
init_ooxml_crypto_errors();
|
|
50798
51073
|
init_ooxml_crypto_key_derivation();
|
|
50799
|
-
|
|
51074
|
+
init_ooxml_crypto_primitives2();
|
|
50800
51075
|
init_ooxml_crypto_errors();
|
|
50801
51076
|
}
|
|
50802
51077
|
});
|
|
@@ -51185,7 +51460,7 @@ function mdStyleDigest(message, initialState, transform6) {
|
|
|
51185
51460
|
return out;
|
|
51186
51461
|
}
|
|
51187
51462
|
var init_bit_ops = __esm({
|
|
51188
|
-
"
|
|
51463
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
|
|
51189
51464
|
}
|
|
51190
51465
|
});
|
|
51191
51466
|
function f1(x, y, z) {
|
|
@@ -51216,7 +51491,7 @@ var ROUND1;
|
|
|
51216
51491
|
var ROUND2;
|
|
51217
51492
|
var ROUND3;
|
|
51218
51493
|
var init_md4 = __esm({
|
|
51219
|
-
"
|
|
51494
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
51220
51495
|
init_bit_ops();
|
|
51221
51496
|
INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
|
|
51222
51497
|
K2 = 1518500249;
|
|
@@ -51277,6 +51552,16 @@ var init_md4 = __esm({
|
|
|
51277
51552
|
];
|
|
51278
51553
|
}
|
|
51279
51554
|
});
|
|
51555
|
+
var init_md42 = __esm({
|
|
51556
|
+
"src/core/utils/digests/md4.ts"() {
|
|
51557
|
+
init_md4();
|
|
51558
|
+
}
|
|
51559
|
+
});
|
|
51560
|
+
var init_bit_ops2 = __esm({
|
|
51561
|
+
"src/core/utils/digests/bit-ops.ts"() {
|
|
51562
|
+
init_bit_ops();
|
|
51563
|
+
}
|
|
51564
|
+
});
|
|
51280
51565
|
function f(x, y, z) {
|
|
51281
51566
|
return x & y | ~x & z;
|
|
51282
51567
|
}
|
|
@@ -51317,7 +51602,7 @@ var ROUND_FNS;
|
|
|
51317
51602
|
var ROUNDS;
|
|
51318
51603
|
var init_md5 = __esm({
|
|
51319
51604
|
"src/core/utils/digests/md5.ts"() {
|
|
51320
|
-
|
|
51605
|
+
init_bit_ops2();
|
|
51321
51606
|
INITIAL_STATE2 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
51322
51607
|
T = Array.from(
|
|
51323
51608
|
{ length: 64 },
|
|
@@ -51386,7 +51671,7 @@ var LEFT_FNS;
|
|
|
51386
51671
|
var RIGHT_FNS;
|
|
51387
51672
|
var init_ripemd128 = __esm({
|
|
51388
51673
|
"src/core/utils/digests/ripemd128.ts"() {
|
|
51389
|
-
|
|
51674
|
+
init_bit_ops2();
|
|
51390
51675
|
init_ripemd_functions();
|
|
51391
51676
|
INITIAL_STATE3 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
51392
51677
|
LEFT_ROUNDS = [
|
|
@@ -51589,7 +51874,7 @@ var LEFT_FNS2;
|
|
|
51589
51874
|
var RIGHT_FNS2;
|
|
51590
51875
|
var init_ripemd160 = __esm({
|
|
51591
51876
|
"src/core/utils/digests/ripemd160.ts"() {
|
|
51592
|
-
|
|
51877
|
+
init_bit_ops2();
|
|
51593
51878
|
init_ripemd_functions();
|
|
51594
51879
|
INITIAL_STATE4 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
51595
51880
|
LEFT_ROUNDS2 = [
|
|
@@ -52166,7 +52451,7 @@ var init_digest = __esm({
|
|
|
52166
52451
|
"src/core/utils/digests/digest.ts"() {
|
|
52167
52452
|
init_algorithm_names();
|
|
52168
52453
|
init_md2();
|
|
52169
|
-
|
|
52454
|
+
init_md42();
|
|
52170
52455
|
init_md5();
|
|
52171
52456
|
init_ripemd128();
|
|
52172
52457
|
init_ripemd160();
|
|
@@ -52186,7 +52471,7 @@ var init_digests = __esm({
|
|
|
52186
52471
|
init_algorithm_names();
|
|
52187
52472
|
init_digest();
|
|
52188
52473
|
init_md2();
|
|
52189
|
-
|
|
52474
|
+
init_md42();
|
|
52190
52475
|
init_md5();
|
|
52191
52476
|
init_ripemd128();
|
|
52192
52477
|
init_ripemd160();
|
|
@@ -59088,15 +59373,15 @@ function buildLinkedTextBoxChains(elements2) {
|
|
|
59088
59373
|
}
|
|
59089
59374
|
const chainId = el.linkedTxbxId;
|
|
59090
59375
|
const seq = el.linkedTxbxSeq ?? 0;
|
|
59091
|
-
let
|
|
59092
|
-
if (!
|
|
59093
|
-
|
|
59094
|
-
chains.set(chainId,
|
|
59376
|
+
let chain2 = chains.get(chainId);
|
|
59377
|
+
if (!chain2) {
|
|
59378
|
+
chain2 = { chainId, members: [] };
|
|
59379
|
+
chains.set(chainId, chain2);
|
|
59095
59380
|
}
|
|
59096
|
-
|
|
59381
|
+
chain2.members.push({ element: el, seq });
|
|
59097
59382
|
}
|
|
59098
|
-
for (const
|
|
59099
|
-
|
|
59383
|
+
for (const chain2 of chains.values()) {
|
|
59384
|
+
chain2.members.sort((a, b) => a.seq - b.seq);
|
|
59100
59385
|
}
|
|
59101
59386
|
return chains;
|
|
59102
59387
|
}
|
|
@@ -59146,27 +59431,27 @@ function splitSegmentAt(segment, offset) {
|
|
|
59146
59431
|
};
|
|
59147
59432
|
return [before, after];
|
|
59148
59433
|
}
|
|
59149
|
-
function distributeSegmentsAcrossChain(
|
|
59434
|
+
function distributeSegmentsAcrossChain(chain2) {
|
|
59150
59435
|
const result = /* @__PURE__ */ new Map();
|
|
59151
|
-
if (
|
|
59436
|
+
if (chain2.members.length === 0) {
|
|
59152
59437
|
return result;
|
|
59153
59438
|
}
|
|
59154
|
-
const headMember =
|
|
59439
|
+
const headMember = chain2.members[0];
|
|
59155
59440
|
const allSegments = headMember.element.textSegments ?? [];
|
|
59156
59441
|
if (allSegments.length === 0) {
|
|
59157
|
-
for (const member of
|
|
59442
|
+
for (const member of chain2.members) {
|
|
59158
59443
|
result.set(member.element.id, []);
|
|
59159
59444
|
}
|
|
59160
59445
|
return result;
|
|
59161
59446
|
}
|
|
59162
|
-
if (
|
|
59447
|
+
if (chain2.members.length === 1) {
|
|
59163
59448
|
result.set(headMember.element.id, [...allSegments]);
|
|
59164
59449
|
return result;
|
|
59165
59450
|
}
|
|
59166
59451
|
let remainingSegments = [...allSegments];
|
|
59167
|
-
for (let i2 = 0; i2 <
|
|
59168
|
-
const member =
|
|
59169
|
-
const isLast = i2 ===
|
|
59452
|
+
for (let i2 = 0; i2 < chain2.members.length; i2++) {
|
|
59453
|
+
const member = chain2.members[i2];
|
|
59454
|
+
const isLast = i2 === chain2.members.length - 1;
|
|
59170
59455
|
if (isLast || remainingSegments.length === 0) {
|
|
59171
59456
|
result.set(member.element.id, remainingSegments);
|
|
59172
59457
|
remainingSegments = [];
|
|
@@ -59201,7 +59486,7 @@ function distributeSegmentsAcrossChain(chain) {
|
|
|
59201
59486
|
}
|
|
59202
59487
|
result.set(member.element.id, boxSegments);
|
|
59203
59488
|
}
|
|
59204
|
-
for (const member of
|
|
59489
|
+
for (const member of chain2.members) {
|
|
59205
59490
|
if (!result.has(member.element.id)) {
|
|
59206
59491
|
result.set(member.element.id, []);
|
|
59207
59492
|
}
|
|
@@ -59216,11 +59501,11 @@ function getLinkedTextBoxSegments(element, allElements) {
|
|
|
59216
59501
|
return void 0;
|
|
59217
59502
|
}
|
|
59218
59503
|
const chains = buildLinkedTextBoxChains(allElements);
|
|
59219
|
-
const
|
|
59220
|
-
if (!
|
|
59504
|
+
const chain2 = chains.get(element.linkedTxbxId);
|
|
59505
|
+
if (!chain2 || chain2.members.length <= 1) {
|
|
59221
59506
|
return void 0;
|
|
59222
59507
|
}
|
|
59223
|
-
const segmentMap = distributeSegmentsAcrossChain(
|
|
59508
|
+
const segmentMap = distributeSegmentsAcrossChain(chain2);
|
|
59224
59509
|
return segmentMap.get(element.id);
|
|
59225
59510
|
}
|
|
59226
59511
|
var DEFAULT_FONT_SIZE_PT;
|
|
@@ -67062,9 +67347,9 @@ var init_utils = __esm({
|
|
|
67062
67347
|
init_ole_sheet_xls_biff8();
|
|
67063
67348
|
init_ole_sheet_xls_biff8_writer();
|
|
67064
67349
|
init_ole_document_docx_editor();
|
|
67065
|
-
|
|
67350
|
+
init_ole_document_doc_editor2();
|
|
67066
67351
|
init_ole_nested_deck_editor();
|
|
67067
|
-
|
|
67352
|
+
init_png_encoder2();
|
|
67068
67353
|
init_raster_canvas();
|
|
67069
67354
|
init_ole_icon_raster();
|
|
67070
67355
|
init_ole_content_preview_raster();
|
|
@@ -73077,7 +73362,7 @@ function parseTableEffectChain(effectLst) {
|
|
|
73077
73362
|
if (!effectLst) {
|
|
73078
73363
|
return void 0;
|
|
73079
73364
|
}
|
|
73080
|
-
const
|
|
73365
|
+
const chain2 = [];
|
|
73081
73366
|
for (const key2 of Object.keys(effectLst)) {
|
|
73082
73367
|
if (key2.startsWith("@_")) {
|
|
73083
73368
|
continue;
|
|
@@ -73092,14 +73377,14 @@ function parseTableEffectChain(effectLst) {
|
|
|
73092
73377
|
}
|
|
73093
73378
|
const nodes = Array.isArray(raw) ? raw : [raw];
|
|
73094
73379
|
for (const node of nodes) {
|
|
73095
|
-
|
|
73380
|
+
chain2.push({ kind, xml: node ?? {} });
|
|
73096
73381
|
}
|
|
73097
73382
|
}
|
|
73098
|
-
return
|
|
73383
|
+
return chain2.length > 0 ? chain2 : void 0;
|
|
73099
73384
|
}
|
|
73100
|
-
function writeTableEffectChain(
|
|
73385
|
+
function writeTableEffectChain(chain2) {
|
|
73101
73386
|
const effectLst = {};
|
|
73102
|
-
for (const { kind, xml } of
|
|
73387
|
+
for (const { kind, xml } of chain2) {
|
|
73103
73388
|
const key2 = `a:${kind}`;
|
|
73104
73389
|
const existing = effectLst[key2];
|
|
73105
73390
|
if (existing === void 0) {
|
|
@@ -79562,10 +79847,10 @@ function targetSpidOf(cTn) {
|
|
|
79562
79847
|
}
|
|
79563
79848
|
return void 0;
|
|
79564
79849
|
}
|
|
79565
|
-
function walkContainers(holder,
|
|
79850
|
+
function walkContainers(holder, chain2, out) {
|
|
79566
79851
|
for (const key2 of CONTAINER_KEYS) {
|
|
79567
79852
|
for (const node of ensureArray11(holder[key2])) {
|
|
79568
|
-
const nextChain = [...
|
|
79853
|
+
const nextChain = [...chain2, { holder, key: key2, node }];
|
|
79569
79854
|
const cTn = node["p:cTn"];
|
|
79570
79855
|
if (!isXmlObject5(cTn)) {
|
|
79571
79856
|
continue;
|
|
@@ -79630,14 +79915,14 @@ function appendContainer(holder, key2, node) {
|
|
|
79630
79915
|
holder[key2] = existing.length === 1 ? existing[0] : existing;
|
|
79631
79916
|
}
|
|
79632
79917
|
function removeEffectNode(ref) {
|
|
79633
|
-
const
|
|
79634
|
-
const own =
|
|
79918
|
+
const chain2 = ref.chain;
|
|
79919
|
+
const own = chain2[chain2.length - 1];
|
|
79635
79920
|
if (!own) {
|
|
79636
79921
|
return;
|
|
79637
79922
|
}
|
|
79638
79923
|
detach(own.holder, own.key, own.node);
|
|
79639
|
-
for (let index =
|
|
79640
|
-
const link =
|
|
79924
|
+
for (let index = chain2.length - 2; index >= 0; index -= 1) {
|
|
79925
|
+
const link = chain2[index];
|
|
79641
79926
|
const cTn = link.node["p:cTn"];
|
|
79642
79927
|
if (!isXmlObject5(cTn)) {
|
|
79643
79928
|
return;
|
|
@@ -101783,9 +102068,9 @@ var init_PptxRuntimeDependencyFactory = __esm({
|
|
|
101783
102068
|
// relocating it, and dropping is the honest half. Parts we do not parse
|
|
101784
102069
|
// keep their comments regardless: they are copied through byte for byte.
|
|
101785
102070
|
});
|
|
101786
|
-
const
|
|
102071
|
+
const parse = parser.parse.bind(parser);
|
|
101787
102072
|
parser.parse = ((xml, validationOption) => {
|
|
101788
|
-
const parsed = validationOption === void 0 ?
|
|
102073
|
+
const parsed = validationOption === void 0 ? parse(xml) : parse(xml, validationOption);
|
|
101789
102074
|
if (typeof xml === "string" && xml.includes("custGeom")) {
|
|
101790
102075
|
annotateCustomGeometryCommandOrder(xml, parsed);
|
|
101791
102076
|
}
|
|
@@ -107708,7 +107993,7 @@ var EMU_PER_INCH;
|
|
|
107708
107993
|
var init_picture_encode = __esm({
|
|
107709
107994
|
"src/core/ppt/writer/picture-encode.ts"() {
|
|
107710
107995
|
init_gif_decode();
|
|
107711
|
-
|
|
107996
|
+
init_png_encoder2();
|
|
107712
107997
|
EMU_PER_HUNDREDTH_MM = 360;
|
|
107713
107998
|
EMU_PER_INCH = 914400;
|
|
107714
107999
|
}
|
|
@@ -107744,7 +108029,7 @@ function dataUrlToPicture(dataUrl) {
|
|
|
107744
108029
|
}
|
|
107745
108030
|
var init_raster_utils = __esm({
|
|
107746
108031
|
"src/core/ppt/writer/raster-utils.ts"() {
|
|
107747
|
-
|
|
108032
|
+
init_ooxml_crypto_primitives2();
|
|
107748
108033
|
init_picture_encode();
|
|
107749
108034
|
}
|
|
107750
108035
|
});
|
|
@@ -108954,516 +109239,6 @@ var init_metro_blob_collect = __esm({
|
|
|
108954
109239
|
]);
|
|
108955
109240
|
}
|
|
108956
109241
|
});
|
|
108957
|
-
function fontNameOf(style, themeFonts) {
|
|
108958
|
-
const family2 = style.resolvedFontFamily ?? style.fontFamily;
|
|
108959
|
-
if (family2?.startsWith("+mj-")) {
|
|
108960
|
-
return themeFonts.major;
|
|
108961
|
-
}
|
|
108962
|
-
if (family2?.startsWith("+mn-")) {
|
|
108963
|
-
return themeFonts.minor;
|
|
108964
|
-
}
|
|
108965
|
-
return family2 && !family2.startsWith("+") ? family2 : void 0;
|
|
108966
|
-
}
|
|
108967
|
-
function hexOf(color2) {
|
|
108968
|
-
const hex42 = color2?.replace(/^#/u, "");
|
|
108969
|
-
return hex42 && /^[0-9a-f]{6}$/iu.test(hex42) ? hex42.toUpperCase() : void 0;
|
|
108970
|
-
}
|
|
108971
|
-
function toLevel(style = {}, themeFonts = {}) {
|
|
108972
|
-
const bulletChar = style.bulletNone ? void 0 : style.bulletChar;
|
|
108973
|
-
return {
|
|
108974
|
-
paragraph: {
|
|
108975
|
-
align: style.alignment ? ALIGN_MAP3[style.alignment] : void 0,
|
|
108976
|
-
hasBullet: style.bulletNone ? false : bulletChar ? true : void 0,
|
|
108977
|
-
bulletChar,
|
|
108978
|
-
bulletColorRgb: hexOf(style.bulletColor),
|
|
108979
|
-
marginLeftEmu: style.marginLeft !== void 0 ? style.marginLeft * EMU_PER_PX : void 0,
|
|
108980
|
-
indentEmu: style.indent !== void 0 ? style.indent * EMU_PER_PX : void 0
|
|
108981
|
-
},
|
|
108982
|
-
// Explicit, as PowerPoint's own master levels are (full CF masks): a
|
|
108983
|
-
// binary master level otherwise inherits bold/italic from the level
|
|
108984
|
-
// above it, unlike an OOXML `a:lvlNpPr`.
|
|
108985
|
-
run: {
|
|
108986
|
-
bold: style.bold ?? false,
|
|
108987
|
-
italic: style.italic ?? false,
|
|
108988
|
-
underline: false,
|
|
108989
|
-
sizePt: style.fontSize !== void 0 ? style.fontSize * 72 / 96 : void 0,
|
|
108990
|
-
colorRgb: hexOf(style.color),
|
|
108991
|
-
fontName: fontNameOf(style, themeFonts)
|
|
108992
|
-
}
|
|
108993
|
-
};
|
|
108994
|
-
}
|
|
108995
|
-
function toLevels(levels, count, themeFonts) {
|
|
108996
|
-
if (!levels) {
|
|
108997
|
-
return void 0;
|
|
108998
|
-
}
|
|
108999
|
-
const defined = [0, 1, 2, 3, 4].filter((i2) => levels[i2] !== void 0);
|
|
109000
|
-
if (defined.length === 0) {
|
|
109001
|
-
return void 0;
|
|
109002
|
-
}
|
|
109003
|
-
const base = levels[-1];
|
|
109004
|
-
return Array.from(
|
|
109005
|
-
{ length: count },
|
|
109006
|
-
(_, i2) => toLevel(base || levels[i2] ? { ...base, ...levels[i2] } : void 0, themeFonts)
|
|
109007
|
-
);
|
|
109008
|
-
}
|
|
109009
|
-
function convertMasterTextStyles(styles, themeFonts = {}) {
|
|
109010
|
-
if (!styles) {
|
|
109011
|
-
return void 0;
|
|
109012
|
-
}
|
|
109013
|
-
const out = {
|
|
109014
|
-
title: toLevels(styles.titleStyle, TITLE_LEVELS, themeFonts),
|
|
109015
|
-
body: toLevels(styles.bodyStyle, PPT_MASTER_LEVELS, themeFonts),
|
|
109016
|
-
other: toLevels(styles.otherStyle, PPT_MASTER_LEVELS, themeFonts)
|
|
109017
|
-
};
|
|
109018
|
-
return out.title || out.body || out.other ? out : void 0;
|
|
109019
|
-
}
|
|
109020
|
-
function masterStyleFonts(styles) {
|
|
109021
|
-
if (!styles) {
|
|
109022
|
-
return [];
|
|
109023
|
-
}
|
|
109024
|
-
return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
|
|
109025
|
-
}
|
|
109026
|
-
var PPT_MASTER_LEVELS;
|
|
109027
|
-
var TITLE_LEVELS;
|
|
109028
|
-
var ALIGN_MAP3;
|
|
109029
|
-
var init_master_style_convert = __esm({
|
|
109030
|
-
"src/core/ppt/writer/master-style-convert.ts"() {
|
|
109031
|
-
init_constants();
|
|
109032
|
-
PPT_MASTER_LEVELS = 5;
|
|
109033
|
-
TITLE_LEVELS = 1;
|
|
109034
|
-
ALIGN_MAP3 = {
|
|
109035
|
-
left: "l",
|
|
109036
|
-
l: "l",
|
|
109037
|
-
center: "ctr",
|
|
109038
|
-
ctr: "ctr",
|
|
109039
|
-
right: "r",
|
|
109040
|
-
r: "r",
|
|
109041
|
-
justify: "just",
|
|
109042
|
-
just: "just",
|
|
109043
|
-
justLow: "just",
|
|
109044
|
-
dist: "just",
|
|
109045
|
-
thaiDist: "just"
|
|
109046
|
-
};
|
|
109047
|
-
}
|
|
109048
|
-
});
|
|
109049
|
-
function relsPath(partPath) {
|
|
109050
|
-
const slash = partPath.lastIndexOf("/");
|
|
109051
|
-
return `${partPath.slice(0, slash)}/_rels/${partPath.slice(slash + 1)}.rels`;
|
|
109052
|
-
}
|
|
109053
|
-
async function readText(zip, path) {
|
|
109054
|
-
return zip.file(path)?.async("string");
|
|
109055
|
-
}
|
|
109056
|
-
async function followRel(zip, from, type) {
|
|
109057
|
-
const rels = await readText(zip, relsPath(from));
|
|
109058
|
-
const rel = rels ? parseRels(rels).find((r) => r.type === `${REL}/${type}`) : void 0;
|
|
109059
|
-
return rel && !rel.external ? resolveTarget2(from, rel.target) : void 0;
|
|
109060
|
-
}
|
|
109061
|
-
async function firstSlideMasterPath(zip) {
|
|
109062
|
-
const presentation = "ppt/presentation.xml";
|
|
109063
|
-
const xml = await readText(zip, presentation);
|
|
109064
|
-
const firstSlideRid = xml ? /<p:sldId\b[^>]*\br:id="([^"]+)"/u.exec(xml)?.[1] : void 0;
|
|
109065
|
-
const rels = await readText(zip, relsPath(presentation));
|
|
109066
|
-
const slideRel = rels ? parseRels(rels).find((r) => r.id === firstSlideRid) : void 0;
|
|
109067
|
-
const slide = slideRel ? resolveTarget2(presentation, slideRel.target) : void 0;
|
|
109068
|
-
const layout = slide ? await followRel(zip, slide, "slideLayout") : void 0;
|
|
109069
|
-
const master = layout ? await followRel(zip, layout, "slideMaster") : void 0;
|
|
109070
|
-
return master && zip.file(master) ? master : FALLBACK_MASTER;
|
|
109071
|
-
}
|
|
109072
|
-
function num2(xml, pattern) {
|
|
109073
|
-
const value = pattern.exec(xml)?.[1];
|
|
109074
|
-
return value === void 0 ? void 0 : Number(value);
|
|
109075
|
-
}
|
|
109076
|
-
function readPlaceholders(masterXml) {
|
|
109077
|
-
const out = [];
|
|
109078
|
-
for (const [sp] of masterXml.matchAll(/<p:sp\b[\s\S]*?<\/p:sp>/gu)) {
|
|
109079
|
-
const phType = /<p:ph\b([^>]*)>/u.exec(sp)?.[1];
|
|
109080
|
-
if (phType === void 0) {
|
|
109081
|
-
continue;
|
|
109082
|
-
}
|
|
109083
|
-
const kind = PLACEHOLDER_KINDS[/\btype="([^"]+)"/u.exec(phType)?.[1] ?? "body"];
|
|
109084
|
-
const x = num2(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
|
|
109085
|
-
const y = num2(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
|
|
109086
|
-
const w = num2(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
|
|
109087
|
-
const h2 = num2(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
|
|
109088
|
-
if (!kind || x === void 0 || y === void 0 || !w || !h2 || out.some((p) => p.kind === kind)) {
|
|
109089
|
-
continue;
|
|
109090
|
-
}
|
|
109091
|
-
const size = num2(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
|
|
109092
|
-
out.push({ kind, rect: { x, y, w, h: h2 }, ...size ? { sizePt: size / 100 } : {} });
|
|
109093
|
-
}
|
|
109094
|
-
return out;
|
|
109095
|
-
}
|
|
109096
|
-
function readTxStyles(masterXml) {
|
|
109097
|
-
const txStyles = /<p:txStyles\b[\s\S]*?<\/p:txStyles>/u.exec(masterXml)?.[0];
|
|
109098
|
-
const root = /<p:sldMaster\b[^>]*>/u.exec(masterXml)?.[0] ?? "";
|
|
109099
|
-
if (!txStyles) {
|
|
109100
|
-
return void 0;
|
|
109101
|
-
}
|
|
109102
|
-
const startTag = /^<p:txStyles\b[^>]*>/u.exec(txStyles)?.[0] ?? "";
|
|
109103
|
-
const declarations3 = [...root.matchAll(/\s(xmlns(?::\w+)?)="[^"]*"/gu)].filter((m) => !startTag.includes(` ${m[1]}=`)).map((m) => m[0]);
|
|
109104
|
-
return txStyles.replace(/^<p:txStyles\b/u, `<p:txStyles${declarations3.join("")}`);
|
|
109105
|
-
}
|
|
109106
|
-
function themeColor(themeXml3, slot) {
|
|
109107
|
-
const body = new RegExp(`<a:${slot}>([\\s\\S]*?)</a:${slot}>`, "u").exec(themeXml3)?.[1];
|
|
109108
|
-
if (!body) {
|
|
109109
|
-
return void 0;
|
|
109110
|
-
}
|
|
109111
|
-
return (/\bval="([0-9A-Fa-f]{6})"/u.exec(body) ?? /\blastClr="([0-9A-Fa-f]{6})"/u.exec(body))?.[1];
|
|
109112
|
-
}
|
|
109113
|
-
function schemeColorsFor(themeXml3, clrMapAttributes) {
|
|
109114
|
-
const mapped = (alias, fallback) => clrMapAttributes && new RegExp(`\\b${alias}="(\\w+)"`, "u").exec(clrMapAttributes)?.[1] || fallback;
|
|
109115
|
-
const slots = [
|
|
109116
|
-
mapped("bg1", "lt1"),
|
|
109117
|
-
mapped("tx1", "dk1"),
|
|
109118
|
-
mapped("bg2", "lt2"),
|
|
109119
|
-
mapped("tx2", "dk2"),
|
|
109120
|
-
"accent1",
|
|
109121
|
-
"accent2",
|
|
109122
|
-
"hlink",
|
|
109123
|
-
"folHlink"
|
|
109124
|
-
];
|
|
109125
|
-
const colors = slots.map((slot) => themeColor(themeXml3, slot)?.toUpperCase());
|
|
109126
|
-
return colors.every((c) => c !== void 0) ? colors : void 0;
|
|
109127
|
-
}
|
|
109128
|
-
function latinFace(themeXml3, scheme) {
|
|
109129
|
-
const open = themeXml3.indexOf(`<a:${scheme}>`);
|
|
109130
|
-
const close = open < 0 ? -1 : themeXml3.indexOf(`</a:${scheme}>`, open);
|
|
109131
|
-
const body = close < 0 ? void 0 : themeXml3.slice(open, close);
|
|
109132
|
-
return body && /<a:latin [^>]*typeface="([^"]+)"/u.exec(body)?.[1] || void 0;
|
|
109133
|
-
}
|
|
109134
|
-
async function readMasterRoundTripSource(zip) {
|
|
109135
|
-
const masterPath = await firstSlideMasterPath(zip);
|
|
109136
|
-
const masterXml = await readText(zip, masterPath);
|
|
109137
|
-
if (!masterXml) {
|
|
109138
|
-
return { placeholders: [], themeFonts: {} };
|
|
109139
|
-
}
|
|
109140
|
-
const clrMapAttributes = /<p:clrMap\b([^>]*?)\/?>/u.exec(masterXml)?.[1]?.trim();
|
|
109141
|
-
const themePath = await followRel(zip, masterPath, "theme");
|
|
109142
|
-
const themeXml3 = themePath ? await readText(zip, themePath) : void 0;
|
|
109143
|
-
return {
|
|
109144
|
-
placeholders: readPlaceholders(masterXml),
|
|
109145
|
-
txStylesXml: readTxStyles(masterXml),
|
|
109146
|
-
clrMapAttributes,
|
|
109147
|
-
themeXml: themeXml3,
|
|
109148
|
-
schemeColors: themeXml3 ? schemeColorsFor(themeXml3, clrMapAttributes) : void 0,
|
|
109149
|
-
themeFonts: {
|
|
109150
|
-
major: themeXml3 ? latinFace(themeXml3, "majorFont") : void 0,
|
|
109151
|
-
minor: themeXml3 ? latinFace(themeXml3, "minorFont") : void 0
|
|
109152
|
-
}
|
|
109153
|
-
};
|
|
109154
|
-
}
|
|
109155
|
-
var REL;
|
|
109156
|
-
var FALLBACK_MASTER;
|
|
109157
|
-
var PLACEHOLDER_KINDS;
|
|
109158
|
-
var init_master_roundtrip_source = __esm({
|
|
109159
|
-
"src/core/ppt/writer/master-roundtrip-source.ts"() {
|
|
109160
|
-
init_metro_blob_source();
|
|
109161
|
-
REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
109162
|
-
FALLBACK_MASTER = "ppt/slideMasters/slideMaster1.xml";
|
|
109163
|
-
PLACEHOLDER_KINDS = {
|
|
109164
|
-
title: "title",
|
|
109165
|
-
body: "body",
|
|
109166
|
-
dt: "date",
|
|
109167
|
-
ftr: "footer",
|
|
109168
|
-
sldNum: "slideNumber"
|
|
109169
|
-
};
|
|
109170
|
-
}
|
|
109171
|
-
});
|
|
109172
|
-
function contentTypes(overrides28) {
|
|
109173
|
-
const parts = overrides28.map(([name, type]) => `<Override PartName="/${name}" ContentType="${PML_CT}.${type}"/>`).join("");
|
|
109174
|
-
return `${XML_DECL2}\r
|
|
109175
|
-
<Types xmlns="${CT_NS2}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${parts}</Types>`;
|
|
109176
|
-
}
|
|
109177
|
-
function relationships(type, target) {
|
|
109178
|
-
return `${XML_DECL2}\r
|
|
109179
|
-
<Relationships xmlns="${REL_NS2}"><Relationship Id="rId1" Type="${OFFICE_REL}/${type}" Target="${target}"/></Relationships>`;
|
|
109180
|
-
}
|
|
109181
|
-
function withDeclaration(xml) {
|
|
109182
|
-
const body = xml.replace(/^?<\?xml[^>]*\?>\s*/u, "");
|
|
109183
|
-
return `${XML_DECL2}\r
|
|
109184
|
-
${body}`;
|
|
109185
|
-
}
|
|
109186
|
-
async function zipParts(parts) {
|
|
109187
|
-
const zip = new JSZip3();
|
|
109188
|
-
for (const [name, text22] of parts) {
|
|
109189
|
-
zip.file(name, text22);
|
|
109190
|
-
}
|
|
109191
|
-
return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
|
|
109192
|
-
}
|
|
109193
|
-
function buildOArtTextStylesPackage(txStylesXml) {
|
|
109194
|
-
const part = "drs/slideMasters/slideMaster1.xml";
|
|
109195
|
-
return zipParts([
|
|
109196
|
-
["[Content_Types].xml", contentTypes([[part, "presentationml.slideMaster+xml"]])],
|
|
109197
|
-
["_rels/.rels", relationships("slideMaster", part)],
|
|
109198
|
-
[part, withDeclaration(txStylesXml)]
|
|
109199
|
-
]);
|
|
109200
|
-
}
|
|
109201
|
-
function buildThemePackage(themeXml3) {
|
|
109202
|
-
const manager = "theme/theme/themeManager.xml";
|
|
109203
|
-
return zipParts([
|
|
109204
|
-
[
|
|
109205
|
-
"[Content_Types].xml",
|
|
109206
|
-
contentTypes([
|
|
109207
|
-
[manager, "themeManager+xml"],
|
|
109208
|
-
["theme/theme/theme1.xml", "theme+xml"]
|
|
109209
|
-
])
|
|
109210
|
-
],
|
|
109211
|
-
["_rels/.rels", relationships("officeDocument", manager)],
|
|
109212
|
-
[manager, `${XML_DECL2}\r
|
|
109213
|
-
<a:themeManager xmlns:a="${A_NS2}"/>`],
|
|
109214
|
-
["theme/theme/_rels/themeManager.xml.rels", relationships("theme", "theme1.xml")],
|
|
109215
|
-
["theme/theme/theme1.xml", withDeclaration(themeXml3)]
|
|
109216
|
-
]);
|
|
109217
|
-
}
|
|
109218
|
-
function buildColorMapping(clrMapAttributes) {
|
|
109219
|
-
const attributes = clrMapAttributes.replace(/\s*xmlns(?::\w+)?="[^"]*"/gu, "").trim();
|
|
109220
|
-
return new TextEncoder().encode(`${XML_DECL2}\r
|
|
109221
|
-
<a:clrMap xmlns:a="${A_NS2}" ${attributes}/>`);
|
|
109222
|
-
}
|
|
109223
|
-
async function buildMasterRoundTrip(source) {
|
|
109224
|
-
return {
|
|
109225
|
-
placeholders: source.placeholders,
|
|
109226
|
-
schemeColors: source.schemeColors,
|
|
109227
|
-
themeFonts: source.themeFonts,
|
|
109228
|
-
oartTextStyles: source.txStylesXml ? await buildOArtTextStylesPackage(source.txStylesXml) : void 0,
|
|
109229
|
-
theme: source.themeXml ? await buildThemePackage(source.themeXml) : void 0,
|
|
109230
|
-
colorMapping: source.clrMapAttributes ? buildColorMapping(source.clrMapAttributes) : void 0
|
|
109231
|
-
};
|
|
109232
|
-
}
|
|
109233
|
-
async function buildMasterRoundTripFromPptx(pptxBytes) {
|
|
109234
|
-
return buildMasterRoundTrip(await readMasterRoundTripSource(await JSZip3.loadAsync(pptxBytes)));
|
|
109235
|
-
}
|
|
109236
|
-
var XML_DECL2;
|
|
109237
|
-
var CT_NS2;
|
|
109238
|
-
var REL_NS2;
|
|
109239
|
-
var OFFICE_REL;
|
|
109240
|
-
var A_NS2;
|
|
109241
|
-
var PML_CT;
|
|
109242
|
-
var init_master_roundtrip_writer = __esm({
|
|
109243
|
-
"src/core/ppt/writer/master-roundtrip-writer.ts"() {
|
|
109244
|
-
init_master_roundtrip_source();
|
|
109245
|
-
XML_DECL2 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
109246
|
-
CT_NS2 = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
109247
|
-
REL_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
109248
|
-
OFFICE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
109249
|
-
A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
109250
|
-
PML_CT = "application/vnd.openxmlformats-officedocument";
|
|
109251
|
-
}
|
|
109252
|
-
});
|
|
109253
|
-
function isNodeCanvasModule(value) {
|
|
109254
|
-
const candidate = value;
|
|
109255
|
-
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
109256
|
-
}
|
|
109257
|
-
function loadNodeCanvas() {
|
|
109258
|
-
nodeCanvas ??= (async () => {
|
|
109259
|
-
const runtime = globalThis.process;
|
|
109260
|
-
if (!runtime?.versions?.node) {
|
|
109261
|
-
return void 0;
|
|
109262
|
-
}
|
|
109263
|
-
try {
|
|
109264
|
-
const imported = await import(
|
|
109265
|
-
/* webpackIgnore: true */
|
|
109266
|
-
/* @vite-ignore */
|
|
109267
|
-
NODE_CANVAS_SPECIFIER
|
|
109268
|
-
);
|
|
109269
|
-
const withDefault = imported;
|
|
109270
|
-
if (isNodeCanvasModule(imported)) {
|
|
109271
|
-
return imported;
|
|
109272
|
-
}
|
|
109273
|
-
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
109274
|
-
} catch {
|
|
109275
|
-
return void 0;
|
|
109276
|
-
}
|
|
109277
|
-
})();
|
|
109278
|
-
return nodeCanvas;
|
|
109279
|
-
}
|
|
109280
|
-
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
109281
|
-
const canvasModule = await loadNodeCanvas();
|
|
109282
|
-
if (!canvasModule) {
|
|
109283
|
-
return void 0;
|
|
109284
|
-
}
|
|
109285
|
-
try {
|
|
109286
|
-
const image = await canvasModule.loadImage(svg);
|
|
109287
|
-
const { width, height } = sizeFor(image.width, image.height);
|
|
109288
|
-
const canvas = canvasModule.createCanvas(width, height);
|
|
109289
|
-
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
109290
|
-
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
109291
|
-
} catch {
|
|
109292
|
-
return void 0;
|
|
109293
|
-
}
|
|
109294
|
-
}
|
|
109295
|
-
var NODE_CANVAS_SPECIFIER;
|
|
109296
|
-
var nodeCanvas;
|
|
109297
|
-
var init_svg_rasterize_node = __esm({
|
|
109298
|
-
"src/core/ppt/writer/svg-rasterize-node.ts"() {
|
|
109299
|
-
NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
109300
|
-
}
|
|
109301
|
-
});
|
|
109302
|
-
function hasDomRasteriser() {
|
|
109303
|
-
return typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
|
|
109304
|
-
}
|
|
109305
|
-
function svgRasterSize(intrinsicW, intrinsicH, fallbackW, fallbackH) {
|
|
109306
|
-
const baseW = intrinsicW || fallbackW;
|
|
109307
|
-
const baseH = intrinsicH || fallbackH;
|
|
109308
|
-
const scale2 = Math.min(2, MAX_EDGE_PX / Math.max(baseW, baseH, 1));
|
|
109309
|
-
return {
|
|
109310
|
-
width: Math.max(1, Math.round(baseW * scale2)),
|
|
109311
|
-
height: Math.max(1, Math.round(baseH * scale2))
|
|
109312
|
-
};
|
|
109313
|
-
}
|
|
109314
|
-
function loadImage(url) {
|
|
109315
|
-
return new Promise((resolve3) => {
|
|
109316
|
-
const img = new Image();
|
|
109317
|
-
img.onload = () => resolve3(img);
|
|
109318
|
-
img.onerror = () => resolve3(void 0);
|
|
109319
|
-
img.src = url;
|
|
109320
|
-
});
|
|
109321
|
-
}
|
|
109322
|
-
async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
109323
|
-
const url = URL.createObjectURL(new Blob([svg.slice()], { type: "image/svg+xml" }));
|
|
109324
|
-
try {
|
|
109325
|
-
const img = await loadImage(url);
|
|
109326
|
-
if (!img) {
|
|
109327
|
-
return void 0;
|
|
109328
|
-
}
|
|
109329
|
-
const size = svgRasterSize(img.naturalWidth, img.naturalHeight, fallbackW, fallbackH);
|
|
109330
|
-
const canvas = document.createElement("canvas");
|
|
109331
|
-
canvas.width = size.width;
|
|
109332
|
-
canvas.height = size.height;
|
|
109333
|
-
const context = canvas.getContext("2d");
|
|
109334
|
-
if (!context) {
|
|
109335
|
-
return void 0;
|
|
109336
|
-
}
|
|
109337
|
-
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
109338
|
-
const blob = await new Promise((resolve3) => {
|
|
109339
|
-
canvas.toBlob(resolve3, "image/png");
|
|
109340
|
-
});
|
|
109341
|
-
return blob ? new Uint8Array(await blob.arrayBuffer()) : void 0;
|
|
109342
|
-
} catch {
|
|
109343
|
-
return void 0;
|
|
109344
|
-
} finally {
|
|
109345
|
-
URL.revokeObjectURL(url);
|
|
109346
|
-
}
|
|
109347
|
-
}
|
|
109348
|
-
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
109349
|
-
const png = hasDomRasteriser() ? await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx) : await rasterizeSvgInNode(
|
|
109350
|
-
svg,
|
|
109351
|
-
(w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx)
|
|
109352
|
-
);
|
|
109353
|
-
return png ? { extension: "png", bytes: png } : void 0;
|
|
109354
|
-
}
|
|
109355
|
-
var MAX_EDGE_PX;
|
|
109356
|
-
var init_svg_rasterize = __esm({
|
|
109357
|
-
"src/core/ppt/writer/svg-rasterize.ts"() {
|
|
109358
|
-
init_svg_rasterize_node();
|
|
109359
|
-
MAX_EDGE_PX = 2048;
|
|
109360
|
-
}
|
|
109361
|
-
});
|
|
109362
|
-
async function tiffToPicture(bytes) {
|
|
109363
|
-
try {
|
|
109364
|
-
const imported = await import('./UTIF-LAD5QYGQ.mjs');
|
|
109365
|
-
const utif = "default" in imported ? imported.default : imported;
|
|
109366
|
-
const buffer = bytes.slice().buffer;
|
|
109367
|
-
const page = utif.decode(buffer)[0];
|
|
109368
|
-
if (!page) {
|
|
109369
|
-
return void 0;
|
|
109370
|
-
}
|
|
109371
|
-
utif.decodeImage(buffer, page);
|
|
109372
|
-
const width = Number(page.width);
|
|
109373
|
-
const height = Number(page.height);
|
|
109374
|
-
if (!(width > 0 && height > 0)) {
|
|
109375
|
-
return void 0;
|
|
109376
|
-
}
|
|
109377
|
-
return {
|
|
109378
|
-
extension: "png",
|
|
109379
|
-
bytes: encodePng(width, height, new Uint8Array(utif.toRGBA8(page)))
|
|
109380
|
-
};
|
|
109381
|
-
} catch {
|
|
109382
|
-
return void 0;
|
|
109383
|
-
}
|
|
109384
|
-
}
|
|
109385
|
-
async function fetchBlobUrl(url) {
|
|
109386
|
-
if (!url?.startsWith("blob:") || typeof fetch === "undefined") {
|
|
109387
|
-
return void 0;
|
|
109388
|
-
}
|
|
109389
|
-
try {
|
|
109390
|
-
return new Uint8Array(await (await fetch(url)).arrayBuffer());
|
|
109391
|
-
} catch {
|
|
109392
|
-
return void 0;
|
|
109393
|
-
}
|
|
109394
|
-
}
|
|
109395
|
-
function pathFormat(path) {
|
|
109396
|
-
const ext = /\.([^./\\]+)$/u.exec(path)?.[1]?.toLowerCase();
|
|
109397
|
-
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
109398
|
-
}
|
|
109399
|
-
async function toPicture(bytes, el) {
|
|
109400
|
-
const format2 = sniffImageFormat(bytes);
|
|
109401
|
-
if (format2 === "tiff") {
|
|
109402
|
-
return tiffToPicture(bytes);
|
|
109403
|
-
}
|
|
109404
|
-
if (format2 === "svg") {
|
|
109405
|
-
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
109406
|
-
}
|
|
109407
|
-
return bytesToPicture(bytes);
|
|
109408
|
-
}
|
|
109409
|
-
async function resolveOne(el, source, readPart) {
|
|
109410
|
-
const inline = decodeBase64DataUrl(source.inline);
|
|
109411
|
-
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
109412
|
-
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
109413
|
-
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
109414
|
-
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
109415
|
-
}
|
|
109416
|
-
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
109417
|
-
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
109418
|
-
if (fromPart) {
|
|
109419
|
-
return fromPart;
|
|
109420
|
-
}
|
|
109421
|
-
if (inline && bytesToPicture(inline)) {
|
|
109422
|
-
return void 0;
|
|
109423
|
-
}
|
|
109424
|
-
const fetched = await fetchBlobUrl(source.inline);
|
|
109425
|
-
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
109426
|
-
if (fromFetch || !source.svgPath) {
|
|
109427
|
-
return fromFetch;
|
|
109428
|
-
}
|
|
109429
|
-
const svg = await readPart(source.svgPath);
|
|
109430
|
-
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
109431
|
-
}
|
|
109432
|
-
async function resolvePictureSources(slides, readPart) {
|
|
109433
|
-
const pending = [];
|
|
109434
|
-
const walk3 = (elements2) => {
|
|
109435
|
-
for (const el of elements2) {
|
|
109436
|
-
const source = pictureSourceOf(el);
|
|
109437
|
-
if (source) {
|
|
109438
|
-
pending.push([el, source]);
|
|
109439
|
-
} else if (el.type === "group") {
|
|
109440
|
-
walk3(el.children);
|
|
109441
|
-
}
|
|
109442
|
-
}
|
|
109443
|
-
};
|
|
109444
|
-
for (const slide of slides) {
|
|
109445
|
-
walk3(slide.elements);
|
|
109446
|
-
}
|
|
109447
|
-
const resolved = /* @__PURE__ */ new Map();
|
|
109448
|
-
await Promise.all(
|
|
109449
|
-
pending.map(async ([el, source]) => {
|
|
109450
|
-
const picture = await resolveOne(el, source, readPart);
|
|
109451
|
-
if (picture) {
|
|
109452
|
-
resolved.set(el, picture);
|
|
109453
|
-
}
|
|
109454
|
-
})
|
|
109455
|
-
);
|
|
109456
|
-
return resolved;
|
|
109457
|
-
}
|
|
109458
|
-
var init_picture_resolve = __esm({
|
|
109459
|
-
"src/core/ppt/writer/picture-resolve.ts"() {
|
|
109460
|
-
init_png_encoder();
|
|
109461
|
-
init_picture_encode();
|
|
109462
|
-
init_picture_source();
|
|
109463
|
-
init_raster_utils();
|
|
109464
|
-
init_svg_rasterize();
|
|
109465
|
-
}
|
|
109466
|
-
});
|
|
109467
109242
|
function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
|
|
109468
109243
|
const header = new Uint8Array(8);
|
|
109469
109244
|
const view = new DataView(header.buffer);
|
|
@@ -109478,7 +109253,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
|
|
|
109478
109253
|
}
|
|
109479
109254
|
var ByteWriter;
|
|
109480
109255
|
var init_byte_writer = __esm({
|
|
109481
|
-
"
|
|
109256
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
|
|
109482
109257
|
ByteWriter = class {
|
|
109483
109258
|
chunks = [];
|
|
109484
109259
|
length = 0;
|
|
@@ -109569,8 +109344,8 @@ var TEXT_TYPE;
|
|
|
109569
109344
|
var HEADER_TOKEN_PLAIN;
|
|
109570
109345
|
var HEADER_TOKEN_ENCRYPTED;
|
|
109571
109346
|
var EMU_PER_MASTER;
|
|
109572
|
-
var
|
|
109573
|
-
"
|
|
109347
|
+
var init_legacy_ppt_record_types = __esm({
|
|
109348
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
|
|
109574
109349
|
RT = {
|
|
109575
109350
|
Document: 1e3,
|
|
109576
109351
|
DocumentAtom: 1001,
|
|
@@ -109698,6 +109473,11 @@ var init_record_types = __esm({
|
|
|
109698
109473
|
EMU_PER_MASTER = 914400 / 576;
|
|
109699
109474
|
}
|
|
109700
109475
|
});
|
|
109476
|
+
var init_record_types = __esm({
|
|
109477
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
|
|
109478
|
+
init_legacy_ppt_record_types();
|
|
109479
|
+
}
|
|
109480
|
+
});
|
|
109701
109481
|
function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
|
|
109702
109482
|
const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
|
|
109703
109483
|
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();
|
|
@@ -109712,7 +109492,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
|
|
|
109712
109492
|
var USER_NAME;
|
|
109713
109493
|
var CURRENT_USER_STREAM_SIZE;
|
|
109714
109494
|
var init_current_user_writer = __esm({
|
|
109715
|
-
"
|
|
109495
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
|
|
109716
109496
|
init_record_types();
|
|
109717
109497
|
init_byte_writer();
|
|
109718
109498
|
USER_NAME = "pptx-viewer";
|
|
@@ -109742,8 +109522,8 @@ function buildFbse(picture, uid, foDelay, size) {
|
|
|
109742
109522
|
var MSOBLIP_PICT;
|
|
109743
109523
|
var BLIP_INFO;
|
|
109744
109524
|
var init_blip_writer = __esm({
|
|
109745
|
-
"
|
|
109746
|
-
|
|
109525
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
|
|
109526
|
+
init_md4();
|
|
109747
109527
|
init_png_encoder();
|
|
109748
109528
|
init_record_types();
|
|
109749
109529
|
init_byte_writer();
|
|
@@ -109794,7 +109574,7 @@ var OPT;
|
|
|
109794
109574
|
var FBID_FLAG;
|
|
109795
109575
|
var METRO_BLOB_OPID;
|
|
109796
109576
|
var init_fopt_writer = __esm({
|
|
109797
|
-
"
|
|
109577
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
|
|
109798
109578
|
init_record_types();
|
|
109799
109579
|
init_byte_writer();
|
|
109800
109580
|
OPT = {
|
|
@@ -109878,7 +109658,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
|
|
|
109878
109658
|
}
|
|
109879
109659
|
var SHAPE_ID_CLUSTER_SIZE;
|
|
109880
109660
|
var init_bstore_writer = __esm({
|
|
109881
|
-
"
|
|
109661
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
|
|
109882
109662
|
init_record_types();
|
|
109883
109663
|
init_blip_writer();
|
|
109884
109664
|
init_byte_writer();
|
|
@@ -109898,27 +109678,9 @@ function buildEnvironmentLeadingRecord() {
|
|
|
109898
109678
|
return record(4040, child262, 2, true);
|
|
109899
109679
|
}
|
|
109900
109680
|
function buildEnvironmentTrailingRecords(otherTextStyle) {
|
|
109901
|
-
const unknown0fa4 = record(
|
|
109902
|
-
|
|
109903
|
-
|
|
109904
|
-
0,
|
|
109905
|
-
false,
|
|
109906
|
-
0
|
|
109907
|
-
);
|
|
109908
|
-
const unknown0fa5 = record(
|
|
109909
|
-
4005,
|
|
109910
|
-
new Uint8Array([0, 0, 0, 8, 46, 0, 0, 0, 2, 0, 0, 0]),
|
|
109911
|
-
0,
|
|
109912
|
-
false,
|
|
109913
|
-
0
|
|
109914
|
-
);
|
|
109915
|
-
const unknown0fa9 = record(
|
|
109916
|
-
4009,
|
|
109917
|
-
new Uint8Array([7, 0, 0, 0, 2, 0, 9, 4, 0, 0]),
|
|
109918
|
-
0,
|
|
109919
|
-
false,
|
|
109920
|
-
0
|
|
109921
|
-
);
|
|
109681
|
+
const unknown0fa4 = record(4004, new Uint8Array([128, 0, 64, 0, 0, 0, 0, 0]), 0, false, 0);
|
|
109682
|
+
const unknown0fa5 = record(4005, new Uint8Array([0, 0, 0, 8, 46, 0, 0, 0, 2, 0, 0, 0]), 0, false, 0);
|
|
109683
|
+
const unknown0fa9 = record(4009, new Uint8Array([7, 0, 0, 0, 2, 0, 9, 4, 0, 0]), 0, false, 0);
|
|
109922
109684
|
const style = otherTextStyle ?? record(RT.TextMasterStyleAtom, new ByteWriter().u16(1).u32(0).u32(0).toBytes(), 4, false, 0);
|
|
109923
109685
|
return new ByteWriter().bytes(unknown0fa4).bytes(unknown0fa5).bytes(unknown0fa9).bytes(style).toBytes();
|
|
109924
109686
|
}
|
|
@@ -109931,7 +109693,7 @@ function buildEnvironment(fonts, otherTextStyle) {
|
|
|
109931
109693
|
}
|
|
109932
109694
|
var LF_FACE_NAME_BYTES;
|
|
109933
109695
|
var init_font_collection_writer = __esm({
|
|
109934
|
-
"
|
|
109696
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
|
|
109935
109697
|
init_record_types();
|
|
109936
109698
|
init_byte_writer();
|
|
109937
109699
|
LF_FACE_NAME_BYTES = 64;
|
|
@@ -109968,12 +109730,7 @@ function buildPaddingTag(size) {
|
|
|
109968
109730
|
const fixedOverhead = 8 + 8 + nameRecord.length + 8;
|
|
109969
109731
|
const blobData = new Uint8Array(Math.max(0, size - fixedOverhead));
|
|
109970
109732
|
const blobRecord = record(RT_BINARY_TAG_DATA_BLOB, blobData, 0, false, 0);
|
|
109971
|
-
const progBinaryTag = record(
|
|
109972
|
-
RT.ProgBinaryTag,
|
|
109973
|
-
new ByteWriter().bytes(nameRecord).bytes(blobRecord).toBytes(),
|
|
109974
|
-
0,
|
|
109975
|
-
true
|
|
109976
|
-
);
|
|
109733
|
+
const progBinaryTag = record(RT.ProgBinaryTag, new ByteWriter().bytes(nameRecord).bytes(blobRecord).toBytes(), 0, true);
|
|
109977
109734
|
return record(RT.ProgTags, progBinaryTag, 0, true);
|
|
109978
109735
|
}
|
|
109979
109736
|
function buildDocumentContainer(input) {
|
|
@@ -109998,7 +109755,7 @@ var MASTER_SLIDE_ID_SENTINEL;
|
|
|
109998
109755
|
var RT_CSTRING;
|
|
109999
109756
|
var RT_BINARY_TAG_DATA_BLOB;
|
|
110000
109757
|
var init_document_writer = __esm({
|
|
110001
|
-
"
|
|
109758
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
|
|
110002
109759
|
init_record_types();
|
|
110003
109760
|
init_byte_writer();
|
|
110004
109761
|
init_font_collection_writer();
|
|
@@ -110146,7 +109903,7 @@ var LT;
|
|
|
110146
109903
|
var FLAG_CUSTOM_SHOW_RETURN;
|
|
110147
109904
|
var HyperlinkCollector;
|
|
110148
109905
|
var init_hyperlink_writer = __esm({
|
|
110149
|
-
"
|
|
109906
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
|
|
110150
109907
|
init_record_types();
|
|
110151
109908
|
init_byte_writer();
|
|
110152
109909
|
II_ACTION = {
|
|
@@ -110245,17 +110002,17 @@ var MediaCollector;
|
|
|
110245
110002
|
var SOUND_EXTENSION_WAV;
|
|
110246
110003
|
var SOUND_LENGTH_UNKNOWN;
|
|
110247
110004
|
var init_media_writer = __esm({
|
|
110248
|
-
"
|
|
110005
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
|
|
110249
110006
|
init_record_types();
|
|
110250
110007
|
init_byte_writer();
|
|
110251
110008
|
MediaCollector = class {
|
|
110009
|
+
hyperlinks;
|
|
110010
|
+
entries = [];
|
|
110011
|
+
nextSoundId = 1;
|
|
110252
110012
|
/** @param hyperlinks - See `OleCollector`'s constructor doc for why `exObjId` is allocated here. */
|
|
110253
110013
|
constructor(hyperlinks) {
|
|
110254
110014
|
this.hyperlinks = hyperlinks;
|
|
110255
110015
|
}
|
|
110256
|
-
hyperlinks;
|
|
110257
|
-
entries = [];
|
|
110258
|
-
nextSoundId = 1;
|
|
110259
110016
|
/** Register an embedded WAV, returning its newly allocated `exObjId`. */
|
|
110260
110017
|
registerAudio(wavBytes, soundName) {
|
|
110261
110018
|
const exObjId = this.hyperlinks.allocateId();
|
|
@@ -110347,7 +110104,7 @@ var EX_OLE_SUB_DEFAULT;
|
|
|
110347
110104
|
var PACKAGER_MENU_NAME;
|
|
110348
110105
|
var OleCollector;
|
|
110349
110106
|
var init_ole_writer = __esm({
|
|
110350
|
-
"
|
|
110107
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
|
|
110351
110108
|
init_ole2_parser_write();
|
|
110352
110109
|
init_record_types();
|
|
110353
110110
|
init_byte_writer();
|
|
@@ -110375,6 +110132,8 @@ var init_ole_writer = __esm({
|
|
|
110375
110132
|
EX_OLE_SUB_DEFAULT = 0;
|
|
110376
110133
|
PACKAGER_MENU_NAME = "Packager Shell Object";
|
|
110377
110134
|
OleCollector = class {
|
|
110135
|
+
hyperlinks;
|
|
110136
|
+
entries = [];
|
|
110378
110137
|
/**
|
|
110379
110138
|
* @param hyperlinks - `exObjId` and `ExHyperlinkId` share one id space
|
|
110380
110139
|
* (see `HyperlinkCollector.allocateId`'s doc comment), so this
|
|
@@ -110384,8 +110143,6 @@ var init_ole_writer = __esm({
|
|
|
110384
110143
|
constructor(hyperlinks) {
|
|
110385
110144
|
this.hyperlinks = hyperlinks;
|
|
110386
110145
|
}
|
|
110387
|
-
hyperlinks;
|
|
110388
|
-
entries = [];
|
|
110389
110146
|
/** Register an embed, returning its newly allocated `exObjId`. */
|
|
110390
110147
|
register(embed) {
|
|
110391
110148
|
const exObjId = this.hyperlinks.allocateId();
|
|
@@ -110412,12 +110169,7 @@ function buildExObjList(hyperlinks, ole, media) {
|
|
|
110412
110169
|
if (hyperlinks.isEmpty && oleEntries.length === 0 && mediaEntries.length === 0) {
|
|
110413
110170
|
return void 0;
|
|
110414
110171
|
}
|
|
110415
|
-
const seed = Math.max(
|
|
110416
|
-
hyperlinks.peekNextId(),
|
|
110417
|
-
...oleEntries.map((e) => e.exObjId + 1),
|
|
110418
|
-
...mediaEntries.map((e) => e.exObjId + 1),
|
|
110419
|
-
1
|
|
110420
|
-
);
|
|
110172
|
+
const seed = Math.max(hyperlinks.peekNextId(), ...oleEntries.map((e) => e.exObjId + 1), ...mediaEntries.map((e) => e.exObjId + 1), 1);
|
|
110421
110173
|
const atomData = new ByteWriter().i32(seed).toBytes();
|
|
110422
110174
|
const w = new ByteWriter().bytes(record(RT.ExternalObjectListAtom, atomData, 0, false, 0));
|
|
110423
110175
|
for (const entry5 of hyperlinks.all) {
|
|
@@ -110425,9 +110177,7 @@ function buildExObjList(hyperlinks, ole, media) {
|
|
|
110425
110177
|
}
|
|
110426
110178
|
for (const entry5 of oleEntries) {
|
|
110427
110179
|
if (entry5.persistIdRef === void 0) {
|
|
110428
|
-
throw new Error(
|
|
110429
|
-
`OLE embed exObjId=${entry5.exObjId} has no persistIdRef; document-stream-layout.ts must assign one before calling buildExObjList`
|
|
110430
|
-
);
|
|
110180
|
+
throw new Error(`OLE embed exObjId=${entry5.exObjId} has no persistIdRef; document-stream-layout.ts must assign one before calling buildExObjList`);
|
|
110431
110181
|
}
|
|
110432
110182
|
w.bytes(buildExOleEmbedContainer(entry5.exObjId, entry5.persistIdRef));
|
|
110433
110183
|
}
|
|
@@ -110439,7 +110189,7 @@ function buildExObjList(hyperlinks, ole, media) {
|
|
|
110439
110189
|
return record(RT.ExternalObjectList, w.toBytes(), 0, true);
|
|
110440
110190
|
}
|
|
110441
110191
|
var init_ex_obj_list_writer = __esm({
|
|
110442
|
-
"
|
|
110192
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
|
|
110443
110193
|
init_record_types();
|
|
110444
110194
|
init_byte_writer();
|
|
110445
110195
|
init_hyperlink_writer();
|
|
@@ -110492,7 +110242,7 @@ function buildChildAnchor(rect22) {
|
|
|
110492
110242
|
var INT16_MIN2;
|
|
110493
110243
|
var INT16_MAX2;
|
|
110494
110244
|
var init_anchor_writer = __esm({
|
|
110495
|
-
"
|
|
110245
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
|
|
110496
110246
|
init_record_types();
|
|
110497
110247
|
init_byte_writer();
|
|
110498
110248
|
INT16_MIN2 = -32768;
|
|
@@ -110520,7 +110270,7 @@ function encodeColorIndex(rgb2) {
|
|
|
110520
110270
|
}
|
|
110521
110271
|
var DEFAULT_RGB;
|
|
110522
110272
|
var init_colors = __esm({
|
|
110523
|
-
"
|
|
110273
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
|
|
110524
110274
|
DEFAULT_RGB = "000000";
|
|
110525
110275
|
}
|
|
110526
110276
|
});
|
|
@@ -110614,7 +110364,7 @@ function writeCfException(w, run, fontIndex) {
|
|
|
110614
110364
|
var ALIGN_CODE;
|
|
110615
110365
|
var EMU_PER_MASTER_UNIT;
|
|
110616
110366
|
var init_text_exception_writer = __esm({
|
|
110617
|
-
"
|
|
110367
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
|
|
110618
110368
|
init_colors();
|
|
110619
110369
|
ALIGN_CODE = {
|
|
110620
110370
|
l: 0,
|
|
@@ -110685,7 +110435,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
|
|
|
110685
110435
|
return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text22)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
|
|
110686
110436
|
}
|
|
110687
110437
|
var init_text_atom_writer = __esm({
|
|
110688
|
-
"
|
|
110438
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
|
|
110689
110439
|
init_record_types();
|
|
110690
110440
|
init_byte_writer();
|
|
110691
110441
|
init_hyperlink_writer();
|
|
@@ -110715,12 +110465,9 @@ function promptText(textType, paragraphs2) {
|
|
|
110715
110465
|
function fieldText(kind, sizePt, fontIndex) {
|
|
110716
110466
|
const field = kind === "date" ? RT.GenericDateMCAtom : kind === "slideNumber" ? RT.SlideNumberMCAtom : 0;
|
|
110717
110467
|
const text22 = field ? "*" : "";
|
|
110718
|
-
const style = buildStyleTextPropAtom(
|
|
110719
|
-
{
|
|
110720
|
-
|
|
110721
|
-
},
|
|
110722
|
-
() => fontIndex
|
|
110723
|
-
);
|
|
110468
|
+
const style = buildStyleTextPropAtom({
|
|
110469
|
+
paragraphs: [{ indentLevel: 0, runs: [{ text: text22, ...sizePt ? { sizePt } : {} }] }]
|
|
110470
|
+
}, () => fontIndex);
|
|
110724
110471
|
const w = new ByteWriter().bytes(textHeader(TEXT_TYPE_OTHER));
|
|
110725
110472
|
if (text22) {
|
|
110726
110473
|
w.bytes(atom(RT.TextCharsAtom, new ByteWriter().utf16(text22).toBytes()));
|
|
@@ -110743,13 +110490,7 @@ function clientTextbox(placeholder, fontIndex) {
|
|
|
110743
110490
|
}
|
|
110744
110491
|
function buildPlaceholderContainer(placeholder, allocator, fontIndex) {
|
|
110745
110492
|
const spec2 = SPECS[placeholder.kind];
|
|
110746
|
-
const fsp = record(
|
|
110747
|
-
OA.FSP,
|
|
110748
|
-
new ByteWriter().u32(allocator.next()).u32(FSP_FLAGS).toBytes(),
|
|
110749
|
-
RECTANGLE_SPT,
|
|
110750
|
-
false,
|
|
110751
|
-
2
|
|
110752
|
-
);
|
|
110493
|
+
const fsp = record(OA.FSP, new ByteWriter().u32(allocator.next()).u32(FSP_FLAGS).toBytes(), RECTANGLE_SPT, false, 2);
|
|
110753
110494
|
const simple = [
|
|
110754
110495
|
{ id: 127, value: 32440321 },
|
|
110755
110496
|
// lock against grouping, as PowerPoint writes
|
|
@@ -110806,7 +110547,7 @@ var TITLE_PROMPT;
|
|
|
110806
110547
|
var BODY_PROMPT;
|
|
110807
110548
|
var DEFAULT_FRAMES;
|
|
110808
110549
|
var init_master_placeholders_writer = __esm({
|
|
110809
|
-
"
|
|
110550
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
|
|
110810
110551
|
init_record_types();
|
|
110811
110552
|
init_anchor_writer();
|
|
110812
110553
|
init_byte_writer();
|
|
@@ -110872,6 +110613,15 @@ var init_master_placeholders_writer = __esm({
|
|
|
110872
110613
|
};
|
|
110873
110614
|
}
|
|
110874
110615
|
});
|
|
110616
|
+
function masterStyleFonts(styles) {
|
|
110617
|
+
if (!styles)
|
|
110618
|
+
return [];
|
|
110619
|
+
return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
|
|
110620
|
+
}
|
|
110621
|
+
var init_master_style_fonts = __esm({
|
|
110622
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
|
|
110623
|
+
}
|
|
110624
|
+
});
|
|
110875
110625
|
function buildMasterStyleAtom(recInstance, levels, fontIndex) {
|
|
110876
110626
|
const w = new ByteWriter().u16(levels.length);
|
|
110877
110627
|
for (const level2 of levels) {
|
|
@@ -110888,13 +110638,7 @@ function hexBytes(hex42) {
|
|
|
110888
110638
|
return out;
|
|
110889
110639
|
}
|
|
110890
110640
|
function buildFixedInstanceAtom(recInstance) {
|
|
110891
|
-
return record(
|
|
110892
|
-
RT.TextMasterStyleAtom,
|
|
110893
|
-
hexBytes(FIXED_INSTANCE_DATA[recInstance]),
|
|
110894
|
-
recInstance,
|
|
110895
|
-
false,
|
|
110896
|
-
0
|
|
110897
|
-
);
|
|
110641
|
+
return record(RT.TextMasterStyleAtom, hexBytes(FIXED_INSTANCE_DATA[recInstance]), recInstance, false, 0);
|
|
110898
110642
|
}
|
|
110899
110643
|
function buildOtherTextStyle(styles, fontIndex) {
|
|
110900
110644
|
return styles?.other ? buildMasterStyleAtom(4, styles.other, fontIndex) : buildFixedInstanceAtom(4);
|
|
@@ -110902,16 +110646,14 @@ function buildOtherTextStyle(styles, fontIndex) {
|
|
|
110902
110646
|
function buildMasterTextStyles(styles, fontIndex) {
|
|
110903
110647
|
const w = new ByteWriter().bytes(buildMasterStyleAtom(0, styles?.title ?? EMPTY_LEVELS, fontIndex)).bytes(buildMasterStyleAtom(1, styles?.body ?? EMPTY_LEVELS, fontIndex));
|
|
110904
110648
|
for (const instance of [2, 4, 5, 6, 7, 8]) {
|
|
110905
|
-
w.bytes(
|
|
110906
|
-
instance === 4 ? buildOtherTextStyle(styles, fontIndex) : buildFixedInstanceAtom(instance)
|
|
110907
|
-
);
|
|
110649
|
+
w.bytes(instance === 4 ? buildOtherTextStyle(styles, fontIndex) : buildFixedInstanceAtom(instance));
|
|
110908
110650
|
}
|
|
110909
110651
|
return w.toBytes();
|
|
110910
110652
|
}
|
|
110911
110653
|
var EMPTY_LEVELS;
|
|
110912
110654
|
var FIXED_INSTANCE_DATA;
|
|
110913
110655
|
var init_master_text_styles_writer = __esm({
|
|
110914
|
-
"
|
|
110656
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
|
|
110915
110657
|
init_record_types();
|
|
110916
110658
|
init_byte_writer();
|
|
110917
110659
|
init_text_exception_writer();
|
|
@@ -110980,7 +110722,7 @@ function buildShapeFoptProps(input) {
|
|
|
110980
110722
|
}
|
|
110981
110723
|
var DASH_CODE;
|
|
110982
110724
|
var init_shape_props_writer = __esm({
|
|
110983
|
-
"
|
|
110725
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
|
|
110984
110726
|
init_colors();
|
|
110985
110727
|
init_fopt_writer();
|
|
110986
110728
|
DASH_CODE = {
|
|
@@ -111099,7 +110841,7 @@ var FSP_FLAG_OLE_SHAPE;
|
|
|
111099
110841
|
var FSP_FLAG_CHILD;
|
|
111100
110842
|
var PLACEHOLDER_ID;
|
|
111101
110843
|
var init_shape_writer = __esm({
|
|
111102
|
-
"
|
|
110844
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
|
|
111103
110845
|
init_record_types();
|
|
111104
110846
|
init_anchor_writer();
|
|
111105
110847
|
init_byte_writer();
|
|
@@ -111152,13 +110894,9 @@ function buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds,
|
|
|
111152
110894
|
return buildGroupContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, inGroup);
|
|
111153
110895
|
}
|
|
111154
110896
|
function buildGroupContainer(group2, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, inGroup = false) {
|
|
111155
|
-
const data = new ByteWriter().bytes(
|
|
111156
|
-
buildNestedGroupPatriarch(group2, allocator, hyperlinks, inGroup)
|
|
111157
|
-
);
|
|
110897
|
+
const data = new ByteWriter().bytes(buildNestedGroupPatriarch(group2, allocator, hyperlinks, inGroup));
|
|
111158
110898
|
for (const child262 of group2.children) {
|
|
111159
|
-
data.bytes(
|
|
111160
|
-
buildAnyShapeContainer(child262, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, true)
|
|
111161
|
-
);
|
|
110899
|
+
data.bytes(buildAnyShapeContainer(child262, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds, true));
|
|
111162
110900
|
}
|
|
111163
110901
|
return record(OA.SpgrContainer, data.toBytes(), 0, true);
|
|
111164
110902
|
}
|
|
@@ -111167,7 +110905,7 @@ var FSP_FLAG_PATRIARCH;
|
|
|
111167
110905
|
var FSP_FLAG_HAVE_ANCHOR;
|
|
111168
110906
|
var ZERO_RECT;
|
|
111169
110907
|
var init_group_writer = __esm({
|
|
111170
|
-
"
|
|
110908
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
|
|
111171
110909
|
init_record_types();
|
|
111172
110910
|
init_anchor_writer();
|
|
111173
110911
|
init_byte_writer();
|
|
@@ -111180,7 +110918,7 @@ var init_group_writer = __esm({
|
|
|
111180
110918
|
});
|
|
111181
110919
|
var ShapeIdAllocator2;
|
|
111182
110920
|
var init_shape_id_allocator = __esm({
|
|
111183
|
-
"
|
|
110921
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
|
|
111184
110922
|
ShapeIdAllocator2 = class {
|
|
111185
110923
|
current;
|
|
111186
110924
|
constructor(drawingId, clusterSize) {
|
|
@@ -111225,9 +110963,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
|
|
|
111225
110963
|
spgrData.bytes(container);
|
|
111226
110964
|
}
|
|
111227
110965
|
for (const shape of shapes) {
|
|
111228
|
-
spgrData.bytes(
|
|
111229
|
-
buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds)
|
|
111230
|
-
);
|
|
110966
|
+
spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
|
|
111231
110967
|
}
|
|
111232
110968
|
const spgrContainer = record(OA.SpgrContainer, spgrData.toBytes(), 0, true);
|
|
111233
110969
|
const lastShapeId = allocator.lastIssued;
|
|
@@ -111239,7 +110975,7 @@ var FSP_FLAG_BACKGROUND;
|
|
|
111239
110975
|
var BACKGROUND_RECT_SPT;
|
|
111240
110976
|
var SHAPE_ID_CLUSTER_SIZE2;
|
|
111241
110977
|
var init_drawing_writer = __esm({
|
|
111242
|
-
"
|
|
110978
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
|
|
111243
110979
|
init_record_types();
|
|
111244
110980
|
init_byte_writer();
|
|
111245
110981
|
init_colors();
|
|
@@ -111264,22 +111000,11 @@ function buildNotesContainer(paragraphs2, notesRect, slidePersistIdRef, fonts, d
|
|
|
111264
111000
|
placeholderType: "body",
|
|
111265
111001
|
text: { textType: 2, paragraphs: paragraphs2 }
|
|
111266
111002
|
};
|
|
111267
|
-
const data = new ByteWriter().bytes(buildNotesAtom(slidePersistIdRef)).bytes(
|
|
111268
|
-
buildDrawing(
|
|
111269
|
-
notesRect,
|
|
111270
|
-
[bodyShape],
|
|
111271
|
-
void 0,
|
|
111272
|
-
fonts,
|
|
111273
|
-
drawingId,
|
|
111274
|
-
hyperlinks,
|
|
111275
|
-
oleEmbeds,
|
|
111276
|
-
mediaEmbeds
|
|
111277
|
-
)
|
|
111278
|
-
).toBytes();
|
|
111003
|
+
const data = new ByteWriter().bytes(buildNotesAtom(slidePersistIdRef)).bytes(buildDrawing(notesRect, [bodyShape], void 0, fonts, drawingId, hyperlinks, oleEmbeds, mediaEmbeds)).toBytes();
|
|
111279
111004
|
return record(RT.Notes, data, 0, true);
|
|
111280
111005
|
}
|
|
111281
111006
|
var init_notes_writer = __esm({
|
|
111282
|
-
"
|
|
111007
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
|
|
111283
111008
|
init_record_types();
|
|
111284
111009
|
init_byte_writer();
|
|
111285
111010
|
init_drawing_writer();
|
|
@@ -111358,8 +111083,8 @@ function recordBytes(data, rec) {
|
|
|
111358
111083
|
}
|
|
111359
111084
|
var PptParseError;
|
|
111360
111085
|
var RECORD_HEADER_SIZE;
|
|
111361
|
-
var
|
|
111362
|
-
"
|
|
111086
|
+
var init_legacy_ppt_record_stream = __esm({
|
|
111087
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
|
|
111363
111088
|
PptParseError = class extends Error {
|
|
111364
111089
|
constructor(message) {
|
|
111365
111090
|
super(message);
|
|
@@ -111369,6 +111094,11 @@ var init_record_stream = __esm({
|
|
|
111369
111094
|
RECORD_HEADER_SIZE = 8;
|
|
111370
111095
|
}
|
|
111371
111096
|
});
|
|
111097
|
+
var init_record_stream = __esm({
|
|
111098
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
|
|
111099
|
+
init_legacy_ppt_record_stream();
|
|
111100
|
+
}
|
|
111101
|
+
});
|
|
111372
111102
|
function toHex3(r, g2, b) {
|
|
111373
111103
|
return [r, g2, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
|
|
111374
111104
|
}
|
|
@@ -111420,7 +111150,7 @@ function resolveEscherColor(colorRef, scheme) {
|
|
|
111420
111150
|
var SCHEME;
|
|
111421
111151
|
var DEFAULT_SCHEME;
|
|
111422
111152
|
var init_color_scheme = __esm({
|
|
111423
|
-
"
|
|
111153
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
|
|
111424
111154
|
init_record_stream();
|
|
111425
111155
|
init_record_types();
|
|
111426
111156
|
SCHEME = {
|
|
@@ -111453,7 +111183,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
|
|
|
111453
111183
|
return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
|
|
111454
111184
|
}
|
|
111455
111185
|
var init_color_scheme_writer = __esm({
|
|
111456
|
-
"
|
|
111186
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
|
|
111457
111187
|
init_color_scheme();
|
|
111458
111188
|
init_record_types();
|
|
111459
111189
|
init_byte_writer();
|
|
@@ -111475,18 +111205,7 @@ function buildMasterSlideAtom() {
|
|
|
111475
111205
|
return buildSlideAtomRaw(0, 0, 0, SLIDE_FLAG_MASTER_SCHEME);
|
|
111476
111206
|
}
|
|
111477
111207
|
function buildSlideContainer(slide, slideRect, _masterIdRef, notesIdRef, fonts, drawingId, hyperlinks, oleEmbeds, mediaEmbeds) {
|
|
111478
|
-
const data = new ByteWriter().bytes(buildSlideAtom(SLIDE_MASTER_ID_SENTINEL, notesIdRef, Boolean(slide.backgroundRgb))).bytes(
|
|
111479
|
-
buildDrawing(
|
|
111480
|
-
slideRect,
|
|
111481
|
-
slide.shapes,
|
|
111482
|
-
slide.backgroundRgb,
|
|
111483
|
-
fonts,
|
|
111484
|
-
drawingId,
|
|
111485
|
-
hyperlinks,
|
|
111486
|
-
oleEmbeds,
|
|
111487
|
-
mediaEmbeds
|
|
111488
|
-
)
|
|
111489
|
-
).bytes(buildColorSchemeAtom()).toBytes();
|
|
111208
|
+
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();
|
|
111490
111209
|
return record(RT.Slide, data, 0, true);
|
|
111491
111210
|
}
|
|
111492
111211
|
function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, mediaEmbeds, masterStyles, fonts, master) {
|
|
@@ -111494,25 +111213,9 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
|
|
|
111494
111213
|
const idx = name ? fonts.indexOf(name) : -1;
|
|
111495
111214
|
return idx >= 0 ? idx : void 0;
|
|
111496
111215
|
};
|
|
111497
|
-
const placeholders = completeMasterPlaceholders(
|
|
111498
|
-
master?.placeholders ?? [],
|
|
111499
|
-
slideRect.w,
|
|
111500
|
-
slideRect.h
|
|
111501
|
-
);
|
|
111216
|
+
const placeholders = completeMasterPlaceholders(master?.placeholders ?? [], slideRect.w, slideRect.h);
|
|
111502
111217
|
const roundTrip = (recType, payload) => payload ? record(recType, payload, 0, false, 0) : new Uint8Array(0);
|
|
111503
|
-
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(
|
|
111504
|
-
buildDrawing(
|
|
111505
|
-
slideRect,
|
|
111506
|
-
[],
|
|
111507
|
-
void 0,
|
|
111508
|
-
[],
|
|
111509
|
-
drawingId,
|
|
111510
|
-
hyperlinks,
|
|
111511
|
-
oleEmbeds,
|
|
111512
|
-
mediaEmbeds,
|
|
111513
|
-
(allocator) => buildMasterPlaceholders(placeholders, allocator, fontIndex(master?.themeFonts?.minor))
|
|
111514
|
-
)
|
|
111515
|
-
).bytes(buildColorSchemeAtom(void 0, master?.schemeColors)).bytes(roundTrip(RT.RoundTripTheme12Atom, master?.theme)).bytes(roundTrip(RT.RoundTripColorMapping12Atom, master?.colorMapping)).toBytes();
|
|
111218
|
+
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();
|
|
111516
111219
|
return record(RT.MainMaster, data, 0, true);
|
|
111517
111220
|
}
|
|
111518
111221
|
var SLIDE_FLAG_MASTER_OBJECTS;
|
|
@@ -111521,7 +111224,7 @@ var SLIDE_FLAG_MASTER_BACKGROUND;
|
|
|
111521
111224
|
var SLIDE_MASTER_ID_SENTINEL;
|
|
111522
111225
|
var MASTER_FIRST_COLOR_SCHEME_INSTANCE;
|
|
111523
111226
|
var init_slide_writer = __esm({
|
|
111524
|
-
"
|
|
111227
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
|
|
111525
111228
|
init_record_types();
|
|
111526
111229
|
init_byte_writer();
|
|
111527
111230
|
init_color_scheme_writer();
|
|
@@ -111556,18 +111259,14 @@ function collectFonts(deck) {
|
|
|
111556
111259
|
if (shape.kind !== "shape" || !shape.text) {
|
|
111557
111260
|
return [];
|
|
111558
111261
|
}
|
|
111559
|
-
return shape.text.paragraphs.flatMap(
|
|
111560
|
-
(p) => p.runs.map((r) => r.fontName).filter((n) => Boolean(n))
|
|
111561
|
-
);
|
|
111262
|
+
return shape.text.paragraphs.flatMap((p) => p.runs.map((r) => r.fontName).filter((n) => Boolean(n)));
|
|
111562
111263
|
};
|
|
111563
111264
|
const themeMinor = deck.master?.themeFonts?.minor;
|
|
111564
|
-
const fonts = Array.from(
|
|
111565
|
-
|
|
111566
|
-
|
|
111567
|
-
|
|
111568
|
-
|
|
111569
|
-
])
|
|
111570
|
-
);
|
|
111265
|
+
const fonts = Array.from(/* @__PURE__ */ new Set([
|
|
111266
|
+
...themeMinor ? [themeMinor] : [],
|
|
111267
|
+
...deck.slides.flatMap((slide) => slide.shapes.flatMap(collect2)),
|
|
111268
|
+
...masterStyleFonts(deck.masterStyles)
|
|
111269
|
+
]));
|
|
111571
111270
|
return fonts.length > 0 ? fonts : ["Calibri"];
|
|
111572
111271
|
}
|
|
111573
111272
|
function layoutDocumentStream(deck) {
|
|
@@ -111579,9 +111278,7 @@ function layoutDocumentStream(deck) {
|
|
|
111579
111278
|
const masterDrawingId = 1;
|
|
111580
111279
|
const slideDrawingIds = deck.slides.map((_, i2) => 2 + i2);
|
|
111581
111280
|
let nextDrawingId = 2 + deck.slides.length;
|
|
111582
|
-
const notesDrawingIds = deck.slides.map(
|
|
111583
|
-
(slide) => slide.notesParagraphs?.length ? nextDrawingId++ : 0
|
|
111584
|
-
);
|
|
111281
|
+
const notesDrawingIds = deck.slides.map((slide) => slide.notesParagraphs?.length ? nextDrawingId++ : 0);
|
|
111585
111282
|
const shapesPerDrawing = [
|
|
111586
111283
|
1 + MASTER_PLACEHOLDER_ORDER.length,
|
|
111587
111284
|
// master: patriarch + its placeholders
|
|
@@ -111594,41 +111291,9 @@ function layoutDocumentStream(deck) {
|
|
|
111594
111291
|
const hyperlinks = new HyperlinkCollector();
|
|
111595
111292
|
const oleEmbeds = new OleCollector(hyperlinks);
|
|
111596
111293
|
const mediaEmbeds = new MediaCollector(hyperlinks);
|
|
111597
|
-
const slideContainers = deck.slides.map(
|
|
111598
|
-
|
|
111599
|
-
|
|
111600
|
-
slideRect,
|
|
111601
|
-
MASTER_ID,
|
|
111602
|
-
notesIds[i2],
|
|
111603
|
-
fonts,
|
|
111604
|
-
slideDrawingIds[i2],
|
|
111605
|
-
hyperlinks,
|
|
111606
|
-
oleEmbeds,
|
|
111607
|
-
mediaEmbeds
|
|
111608
|
-
)
|
|
111609
|
-
);
|
|
111610
|
-
const notesContainers = deck.slides.map(
|
|
111611
|
-
(slide, i2) => notesIds[i2] ? buildNotesContainer(
|
|
111612
|
-
slide.notesParagraphs,
|
|
111613
|
-
notesRect,
|
|
111614
|
-
slideIds[i2],
|
|
111615
|
-
fonts,
|
|
111616
|
-
notesDrawingIds[i2],
|
|
111617
|
-
hyperlinks,
|
|
111618
|
-
oleEmbeds,
|
|
111619
|
-
mediaEmbeds
|
|
111620
|
-
) : void 0
|
|
111621
|
-
).filter((c) => c !== void 0);
|
|
111622
|
-
const masterContainer = buildMainMasterContainer(
|
|
111623
|
-
slideRect,
|
|
111624
|
-
masterDrawingId,
|
|
111625
|
-
hyperlinks,
|
|
111626
|
-
oleEmbeds,
|
|
111627
|
-
mediaEmbeds,
|
|
111628
|
-
deck.masterStyles,
|
|
111629
|
-
fonts,
|
|
111630
|
-
deck.master
|
|
111631
|
-
);
|
|
111294
|
+
const slideContainers = deck.slides.map((slide, i2) => buildSlideContainer(slide, slideRect, MASTER_ID, notesIds[i2], fonts, slideDrawingIds[i2], hyperlinks, oleEmbeds, mediaEmbeds));
|
|
111295
|
+
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);
|
|
111296
|
+
const masterContainer = buildMainMasterContainer(slideRect, masterDrawingId, hyperlinks, oleEmbeds, mediaEmbeds, deck.masterStyles, fonts, deck.master);
|
|
111632
111297
|
const masterPersistAtom = buildSlidePersistAtom(MASTER_ID, MASTER_SLIDE_ID_SENTINEL);
|
|
111633
111298
|
const slidePersistAtoms = slideIds.map((id, i2) => buildSlidePersistAtom(id, 256 + i2, 4));
|
|
111634
111299
|
const oleStgIds = oleEmbeds.all.map(() => nextId2++);
|
|
@@ -111685,14 +111350,14 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
|
|
|
111685
111350
|
var DOC_ID;
|
|
111686
111351
|
var MASTER_ID;
|
|
111687
111352
|
var init_document_stream_layout = __esm({
|
|
111688
|
-
"
|
|
111353
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
|
|
111689
111354
|
init_bstore_writer();
|
|
111690
111355
|
init_byte_writer();
|
|
111691
111356
|
init_document_writer();
|
|
111692
111357
|
init_ex_obj_list_writer();
|
|
111693
111358
|
init_hyperlink_writer();
|
|
111694
111359
|
init_master_placeholders_writer();
|
|
111695
|
-
|
|
111360
|
+
init_master_style_fonts();
|
|
111696
111361
|
init_master_text_styles_writer();
|
|
111697
111362
|
init_media_writer();
|
|
111698
111363
|
init_notes_writer();
|
|
@@ -111702,6 +111367,12 @@ var init_document_stream_layout = __esm({
|
|
|
111702
111367
|
MASTER_ID = 2;
|
|
111703
111368
|
}
|
|
111704
111369
|
});
|
|
111370
|
+
var RC4_ALG_ID2;
|
|
111371
|
+
var init_crypto_constants = __esm({
|
|
111372
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
|
|
111373
|
+
RC4_ALG_ID2 = 26625;
|
|
111374
|
+
}
|
|
111375
|
+
});
|
|
111705
111376
|
function rc4Cipher(key2, data) {
|
|
111706
111377
|
if (key2.length === 0) {
|
|
111707
111378
|
throw new Error("RC4 key must not be empty.");
|
|
@@ -111732,7 +111403,7 @@ function rc4Cipher(key2, data) {
|
|
|
111732
111403
|
return out;
|
|
111733
111404
|
}
|
|
111734
111405
|
var init_rc4_cipher = __esm({
|
|
111735
|
-
"
|
|
111406
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
|
|
111736
111407
|
}
|
|
111737
111408
|
});
|
|
111738
111409
|
async function rc4CryptoApiKeyBase(password, salt) {
|
|
@@ -111775,7 +111446,7 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
|
|
|
111775
111446
|
}
|
|
111776
111447
|
var PADDED_40_BIT_KEY_BYTES;
|
|
111777
111448
|
var init_rc4_cryptoapi_key = __esm({
|
|
111778
|
-
"
|
|
111449
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
|
|
111779
111450
|
init_ooxml_crypto_primitives();
|
|
111780
111451
|
init_rc4_cipher();
|
|
111781
111452
|
PADDED_40_BIT_KEY_BYTES = 16;
|
|
@@ -111853,7 +111524,7 @@ var BITMAP_TAG_SIZE;
|
|
|
111853
111524
|
var METAFILE_BLIPS;
|
|
111854
111525
|
var BITMAP_BLIPS;
|
|
111855
111526
|
var init_rc4_cryptoapi_streams = __esm({
|
|
111856
|
-
"
|
|
111527
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
|
|
111857
111528
|
init_rc4_cipher();
|
|
111858
111529
|
init_record_stream();
|
|
111859
111530
|
UID_SIZE = 16;
|
|
@@ -111870,12 +111541,9 @@ async function buildCryptSession(password) {
|
|
|
111870
111541
|
const keyFor3 = (block) => rc4CryptoApiBlockKey(base, KEY_SIZE_BITS, block);
|
|
111871
111542
|
const verifier = new Uint8Array(VERIFIER_SIZE);
|
|
111872
111543
|
crypto.getRandomValues(verifier);
|
|
111873
|
-
const { encryptedVerifier, encryptedVerifierHash } = await rc4CryptoApiEncryptVerifier(
|
|
111874
|
-
await keyFor3(0),
|
|
111875
|
-
verifier
|
|
111876
|
-
);
|
|
111544
|
+
const { encryptedVerifier, encryptedVerifierHash } = await rc4CryptoApiEncryptVerifier(await keyFor3(0), verifier);
|
|
111877
111545
|
const cspNameBytes = new ByteWriter().utf16(CSP_NAME).u16(0).toBytes();
|
|
111878
|
-
const header = new ByteWriter().u32(ENCRYPTION_FLAGS).u32(0).u32(
|
|
111546
|
+
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();
|
|
111879
111547
|
const verifierBlock = new ByteWriter().u32(SALT_SIZE).bytes(salt).bytes(encryptedVerifier).u32(VERIFIER_HASH_SIZE).bytes(encryptedVerifierHash).toBytes();
|
|
111880
111548
|
const infoBlob = new ByteWriter().u16(4).u16(2).u32(ENCRYPTION_FLAGS).u32(header.length).bytes(header).bytes(verifierBlock).toBytes();
|
|
111881
111549
|
return {
|
|
@@ -111898,8 +111566,8 @@ var VERIFIER_SIZE;
|
|
|
111898
111566
|
var VERIFIER_HASH_SIZE;
|
|
111899
111567
|
var ENCRYPTION_FLAGS;
|
|
111900
111568
|
var init_encrypt_writer = __esm({
|
|
111901
|
-
"
|
|
111902
|
-
|
|
111569
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
|
|
111570
|
+
init_crypto_constants();
|
|
111903
111571
|
init_rc4_cryptoapi_key();
|
|
111904
111572
|
init_rc4_cryptoapi_streams();
|
|
111905
111573
|
init_record_types();
|
|
@@ -111977,7 +111645,7 @@ function withMasterRelativeRunStyles(deck) {
|
|
|
111977
111645
|
}
|
|
111978
111646
|
var STYLE_KEYS;
|
|
111979
111647
|
var init_master_relative_runs = __esm({
|
|
111980
|
-
"
|
|
111648
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
|
|
111981
111649
|
STYLE_KEYS = ["bold", "italic", "underline"];
|
|
111982
111650
|
}
|
|
111983
111651
|
});
|
|
@@ -112010,7 +111678,7 @@ function buildEncryptedUserEditAtom(input) {
|
|
|
112010
111678
|
}
|
|
112011
111679
|
var MAX_RUN;
|
|
112012
111680
|
var init_persist_writer = __esm({
|
|
112013
|
-
"
|
|
111681
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
|
|
112014
111682
|
init_record_types();
|
|
112015
111683
|
init_byte_writer();
|
|
112016
111684
|
MAX_RUN = 4095;
|
|
@@ -112018,7 +111686,7 @@ var init_persist_writer = __esm({
|
|
|
112018
111686
|
});
|
|
112019
111687
|
var PPT_STORAGE_CLSID;
|
|
112020
111688
|
var init_ppt_clsid = __esm({
|
|
112021
|
-
"
|
|
111689
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
|
|
112022
111690
|
PPT_STORAGE_CLSID = new Uint8Array([
|
|
112023
111691
|
16,
|
|
112024
111692
|
141,
|
|
@@ -112092,7 +111760,7 @@ async function buildPptFile(deck, options = {}) {
|
|
|
112092
111760
|
return new Uint8Array(buildOle2(streams, PPT_STORAGE_CLSID, 0));
|
|
112093
111761
|
}
|
|
112094
111762
|
var init_write_ppt = __esm({
|
|
112095
|
-
"
|
|
111763
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
|
|
112096
111764
|
init_ole2_parser_write();
|
|
112097
111765
|
init_byte_writer();
|
|
112098
111766
|
init_current_user_writer();
|
|
@@ -112103,6 +111771,522 @@ var init_write_ppt = __esm({
|
|
|
112103
111771
|
init_ppt_clsid();
|
|
112104
111772
|
}
|
|
112105
111773
|
});
|
|
111774
|
+
var init_legacy_ppt_writer = __esm({
|
|
111775
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
|
|
111776
|
+
init_write_ppt();
|
|
111777
|
+
init_master_style_fonts();
|
|
111778
|
+
}
|
|
111779
|
+
});
|
|
111780
|
+
function fontNameOf(style, themeFonts) {
|
|
111781
|
+
const family2 = style.resolvedFontFamily ?? style.fontFamily;
|
|
111782
|
+
if (family2?.startsWith("+mj-")) {
|
|
111783
|
+
return themeFonts.major;
|
|
111784
|
+
}
|
|
111785
|
+
if (family2?.startsWith("+mn-")) {
|
|
111786
|
+
return themeFonts.minor;
|
|
111787
|
+
}
|
|
111788
|
+
return family2 && !family2.startsWith("+") ? family2 : void 0;
|
|
111789
|
+
}
|
|
111790
|
+
function hexOf(color2) {
|
|
111791
|
+
const hex42 = color2?.replace(/^#/u, "");
|
|
111792
|
+
return hex42 && /^[0-9a-f]{6}$/iu.test(hex42) ? hex42.toUpperCase() : void 0;
|
|
111793
|
+
}
|
|
111794
|
+
function toLevel(style = {}, themeFonts = {}) {
|
|
111795
|
+
const bulletChar = style.bulletNone ? void 0 : style.bulletChar;
|
|
111796
|
+
return {
|
|
111797
|
+
paragraph: {
|
|
111798
|
+
align: style.alignment ? ALIGN_MAP3[style.alignment] : void 0,
|
|
111799
|
+
hasBullet: style.bulletNone ? false : bulletChar ? true : void 0,
|
|
111800
|
+
bulletChar,
|
|
111801
|
+
bulletColorRgb: hexOf(style.bulletColor),
|
|
111802
|
+
marginLeftEmu: style.marginLeft !== void 0 ? style.marginLeft * EMU_PER_PX : void 0,
|
|
111803
|
+
indentEmu: style.indent !== void 0 ? style.indent * EMU_PER_PX : void 0
|
|
111804
|
+
},
|
|
111805
|
+
// Explicit, as PowerPoint's own master levels are (full CF masks): a
|
|
111806
|
+
// binary master level otherwise inherits bold/italic from the level
|
|
111807
|
+
// above it, unlike an OOXML `a:lvlNpPr`.
|
|
111808
|
+
run: {
|
|
111809
|
+
bold: style.bold ?? false,
|
|
111810
|
+
italic: style.italic ?? false,
|
|
111811
|
+
underline: false,
|
|
111812
|
+
sizePt: style.fontSize !== void 0 ? style.fontSize * 72 / 96 : void 0,
|
|
111813
|
+
colorRgb: hexOf(style.color),
|
|
111814
|
+
fontName: fontNameOf(style, themeFonts)
|
|
111815
|
+
}
|
|
111816
|
+
};
|
|
111817
|
+
}
|
|
111818
|
+
function toLevels(levels, count, themeFonts) {
|
|
111819
|
+
if (!levels) {
|
|
111820
|
+
return void 0;
|
|
111821
|
+
}
|
|
111822
|
+
const defined = [0, 1, 2, 3, 4].filter((i2) => levels[i2] !== void 0);
|
|
111823
|
+
if (defined.length === 0) {
|
|
111824
|
+
return void 0;
|
|
111825
|
+
}
|
|
111826
|
+
const base = levels[-1];
|
|
111827
|
+
return Array.from(
|
|
111828
|
+
{ length: count },
|
|
111829
|
+
(_, i2) => toLevel(base || levels[i2] ? { ...base, ...levels[i2] } : void 0, themeFonts)
|
|
111830
|
+
);
|
|
111831
|
+
}
|
|
111832
|
+
function convertMasterTextStyles(styles, themeFonts = {}) {
|
|
111833
|
+
if (!styles) {
|
|
111834
|
+
return void 0;
|
|
111835
|
+
}
|
|
111836
|
+
const out = {
|
|
111837
|
+
title: toLevels(styles.titleStyle, TITLE_LEVELS, themeFonts),
|
|
111838
|
+
body: toLevels(styles.bodyStyle, PPT_MASTER_LEVELS, themeFonts),
|
|
111839
|
+
other: toLevels(styles.otherStyle, PPT_MASTER_LEVELS, themeFonts)
|
|
111840
|
+
};
|
|
111841
|
+
return out.title || out.body || out.other ? out : void 0;
|
|
111842
|
+
}
|
|
111843
|
+
var PPT_MASTER_LEVELS;
|
|
111844
|
+
var TITLE_LEVELS;
|
|
111845
|
+
var ALIGN_MAP3;
|
|
111846
|
+
var init_master_style_convert = __esm({
|
|
111847
|
+
"src/core/ppt/writer/master-style-convert.ts"() {
|
|
111848
|
+
init_constants();
|
|
111849
|
+
init_legacy_ppt_writer();
|
|
111850
|
+
PPT_MASTER_LEVELS = 5;
|
|
111851
|
+
TITLE_LEVELS = 1;
|
|
111852
|
+
ALIGN_MAP3 = {
|
|
111853
|
+
left: "l",
|
|
111854
|
+
l: "l",
|
|
111855
|
+
center: "ctr",
|
|
111856
|
+
ctr: "ctr",
|
|
111857
|
+
right: "r",
|
|
111858
|
+
r: "r",
|
|
111859
|
+
justify: "just",
|
|
111860
|
+
just: "just",
|
|
111861
|
+
justLow: "just",
|
|
111862
|
+
dist: "just",
|
|
111863
|
+
thaiDist: "just"
|
|
111864
|
+
};
|
|
111865
|
+
}
|
|
111866
|
+
});
|
|
111867
|
+
function relsPath(partPath) {
|
|
111868
|
+
const slash = partPath.lastIndexOf("/");
|
|
111869
|
+
return `${partPath.slice(0, slash)}/_rels/${partPath.slice(slash + 1)}.rels`;
|
|
111870
|
+
}
|
|
111871
|
+
async function readText(zip, path) {
|
|
111872
|
+
return zip.file(path)?.async("string");
|
|
111873
|
+
}
|
|
111874
|
+
async function followRel(zip, from, type) {
|
|
111875
|
+
const rels = await readText(zip, relsPath(from));
|
|
111876
|
+
const rel = rels ? parseRels(rels).find((r) => r.type === `${REL}/${type}`) : void 0;
|
|
111877
|
+
return rel && !rel.external ? resolveTarget2(from, rel.target) : void 0;
|
|
111878
|
+
}
|
|
111879
|
+
async function firstSlideMasterPath(zip) {
|
|
111880
|
+
const presentation = "ppt/presentation.xml";
|
|
111881
|
+
const xml = await readText(zip, presentation);
|
|
111882
|
+
const firstSlideRid = xml ? /<p:sldId\b[^>]*\br:id="([^"]+)"/u.exec(xml)?.[1] : void 0;
|
|
111883
|
+
const rels = await readText(zip, relsPath(presentation));
|
|
111884
|
+
const slideRel = rels ? parseRels(rels).find((r) => r.id === firstSlideRid) : void 0;
|
|
111885
|
+
const slide = slideRel ? resolveTarget2(presentation, slideRel.target) : void 0;
|
|
111886
|
+
const layout = slide ? await followRel(zip, slide, "slideLayout") : void 0;
|
|
111887
|
+
const master = layout ? await followRel(zip, layout, "slideMaster") : void 0;
|
|
111888
|
+
return master && zip.file(master) ? master : FALLBACK_MASTER;
|
|
111889
|
+
}
|
|
111890
|
+
function num2(xml, pattern) {
|
|
111891
|
+
const value = pattern.exec(xml)?.[1];
|
|
111892
|
+
return value === void 0 ? void 0 : Number(value);
|
|
111893
|
+
}
|
|
111894
|
+
function readPlaceholders(masterXml) {
|
|
111895
|
+
const out = [];
|
|
111896
|
+
for (const [sp] of masterXml.matchAll(/<p:sp\b[\s\S]*?<\/p:sp>/gu)) {
|
|
111897
|
+
const phType = /<p:ph\b([^>]*)>/u.exec(sp)?.[1];
|
|
111898
|
+
if (phType === void 0) {
|
|
111899
|
+
continue;
|
|
111900
|
+
}
|
|
111901
|
+
const kind = PLACEHOLDER_KINDS[/\btype="([^"]+)"/u.exec(phType)?.[1] ?? "body"];
|
|
111902
|
+
const x = num2(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
|
|
111903
|
+
const y = num2(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
|
|
111904
|
+
const w = num2(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
|
|
111905
|
+
const h2 = num2(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
|
|
111906
|
+
if (!kind || x === void 0 || y === void 0 || !w || !h2 || out.some((p) => p.kind === kind)) {
|
|
111907
|
+
continue;
|
|
111908
|
+
}
|
|
111909
|
+
const size = num2(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
|
|
111910
|
+
out.push({ kind, rect: { x, y, w, h: h2 }, ...size ? { sizePt: size / 100 } : {} });
|
|
111911
|
+
}
|
|
111912
|
+
return out;
|
|
111913
|
+
}
|
|
111914
|
+
function readTxStyles(masterXml) {
|
|
111915
|
+
const txStyles = /<p:txStyles\b[\s\S]*?<\/p:txStyles>/u.exec(masterXml)?.[0];
|
|
111916
|
+
const root = /<p:sldMaster\b[^>]*>/u.exec(masterXml)?.[0] ?? "";
|
|
111917
|
+
if (!txStyles) {
|
|
111918
|
+
return void 0;
|
|
111919
|
+
}
|
|
111920
|
+
const startTag = /^<p:txStyles\b[^>]*>/u.exec(txStyles)?.[0] ?? "";
|
|
111921
|
+
const declarations3 = [...root.matchAll(/\s(xmlns(?::\w+)?)="[^"]*"/gu)].filter((m) => !startTag.includes(` ${m[1]}=`)).map((m) => m[0]);
|
|
111922
|
+
return txStyles.replace(/^<p:txStyles\b/u, `<p:txStyles${declarations3.join("")}`);
|
|
111923
|
+
}
|
|
111924
|
+
function themeColor(themeXml3, slot) {
|
|
111925
|
+
const body = new RegExp(`<a:${slot}>([\\s\\S]*?)</a:${slot}>`, "u").exec(themeXml3)?.[1];
|
|
111926
|
+
if (!body) {
|
|
111927
|
+
return void 0;
|
|
111928
|
+
}
|
|
111929
|
+
return (/\bval="([0-9A-Fa-f]{6})"/u.exec(body) ?? /\blastClr="([0-9A-Fa-f]{6})"/u.exec(body))?.[1];
|
|
111930
|
+
}
|
|
111931
|
+
function schemeColorsFor(themeXml3, clrMapAttributes) {
|
|
111932
|
+
const mapped = (alias, fallback) => clrMapAttributes && new RegExp(`\\b${alias}="(\\w+)"`, "u").exec(clrMapAttributes)?.[1] || fallback;
|
|
111933
|
+
const slots = [
|
|
111934
|
+
mapped("bg1", "lt1"),
|
|
111935
|
+
mapped("tx1", "dk1"),
|
|
111936
|
+
mapped("bg2", "lt2"),
|
|
111937
|
+
mapped("tx2", "dk2"),
|
|
111938
|
+
"accent1",
|
|
111939
|
+
"accent2",
|
|
111940
|
+
"hlink",
|
|
111941
|
+
"folHlink"
|
|
111942
|
+
];
|
|
111943
|
+
const colors = slots.map((slot) => themeColor(themeXml3, slot)?.toUpperCase());
|
|
111944
|
+
return colors.every((c) => c !== void 0) ? colors : void 0;
|
|
111945
|
+
}
|
|
111946
|
+
function latinFace(themeXml3, scheme) {
|
|
111947
|
+
const open = themeXml3.indexOf(`<a:${scheme}>`);
|
|
111948
|
+
const close = open < 0 ? -1 : themeXml3.indexOf(`</a:${scheme}>`, open);
|
|
111949
|
+
const body = close < 0 ? void 0 : themeXml3.slice(open, close);
|
|
111950
|
+
return body && /<a:latin [^>]*typeface="([^"]+)"/u.exec(body)?.[1] || void 0;
|
|
111951
|
+
}
|
|
111952
|
+
async function readMasterRoundTripSource(zip) {
|
|
111953
|
+
const masterPath = await firstSlideMasterPath(zip);
|
|
111954
|
+
const masterXml = await readText(zip, masterPath);
|
|
111955
|
+
if (!masterXml) {
|
|
111956
|
+
return { placeholders: [], themeFonts: {} };
|
|
111957
|
+
}
|
|
111958
|
+
const clrMapAttributes = /<p:clrMap\b([^>]*?)\/?>/u.exec(masterXml)?.[1]?.trim();
|
|
111959
|
+
const themePath = await followRel(zip, masterPath, "theme");
|
|
111960
|
+
const themeXml3 = themePath ? await readText(zip, themePath) : void 0;
|
|
111961
|
+
return {
|
|
111962
|
+
placeholders: readPlaceholders(masterXml),
|
|
111963
|
+
txStylesXml: readTxStyles(masterXml),
|
|
111964
|
+
clrMapAttributes,
|
|
111965
|
+
themeXml: themeXml3,
|
|
111966
|
+
schemeColors: themeXml3 ? schemeColorsFor(themeXml3, clrMapAttributes) : void 0,
|
|
111967
|
+
themeFonts: {
|
|
111968
|
+
major: themeXml3 ? latinFace(themeXml3, "majorFont") : void 0,
|
|
111969
|
+
minor: themeXml3 ? latinFace(themeXml3, "minorFont") : void 0
|
|
111970
|
+
}
|
|
111971
|
+
};
|
|
111972
|
+
}
|
|
111973
|
+
var REL;
|
|
111974
|
+
var FALLBACK_MASTER;
|
|
111975
|
+
var PLACEHOLDER_KINDS;
|
|
111976
|
+
var init_master_roundtrip_source = __esm({
|
|
111977
|
+
"src/core/ppt/writer/master-roundtrip-source.ts"() {
|
|
111978
|
+
init_metro_blob_source();
|
|
111979
|
+
REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
111980
|
+
FALLBACK_MASTER = "ppt/slideMasters/slideMaster1.xml";
|
|
111981
|
+
PLACEHOLDER_KINDS = {
|
|
111982
|
+
title: "title",
|
|
111983
|
+
body: "body",
|
|
111984
|
+
dt: "date",
|
|
111985
|
+
ftr: "footer",
|
|
111986
|
+
sldNum: "slideNumber"
|
|
111987
|
+
};
|
|
111988
|
+
}
|
|
111989
|
+
});
|
|
111990
|
+
function contentTypes(overrides28) {
|
|
111991
|
+
const parts = overrides28.map(([name, type]) => `<Override PartName="/${name}" ContentType="${PML_CT}.${type}"/>`).join("");
|
|
111992
|
+
return `${XML_DECL2}\r
|
|
111993
|
+
<Types xmlns="${CT_NS2}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${parts}</Types>`;
|
|
111994
|
+
}
|
|
111995
|
+
function relationships(type, target) {
|
|
111996
|
+
return `${XML_DECL2}\r
|
|
111997
|
+
<Relationships xmlns="${REL_NS2}"><Relationship Id="rId1" Type="${OFFICE_REL}/${type}" Target="${target}"/></Relationships>`;
|
|
111998
|
+
}
|
|
111999
|
+
function withDeclaration(xml) {
|
|
112000
|
+
const body = xml.replace(/^?<\?xml[^>]*\?>\s*/u, "");
|
|
112001
|
+
return `${XML_DECL2}\r
|
|
112002
|
+
${body}`;
|
|
112003
|
+
}
|
|
112004
|
+
async function zipParts(parts) {
|
|
112005
|
+
const zip = new JSZip3();
|
|
112006
|
+
for (const [name, text22] of parts) {
|
|
112007
|
+
zip.file(name, text22);
|
|
112008
|
+
}
|
|
112009
|
+
return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
|
|
112010
|
+
}
|
|
112011
|
+
function buildOArtTextStylesPackage(txStylesXml) {
|
|
112012
|
+
const part = "drs/slideMasters/slideMaster1.xml";
|
|
112013
|
+
return zipParts([
|
|
112014
|
+
["[Content_Types].xml", contentTypes([[part, "presentationml.slideMaster+xml"]])],
|
|
112015
|
+
["_rels/.rels", relationships("slideMaster", part)],
|
|
112016
|
+
[part, withDeclaration(txStylesXml)]
|
|
112017
|
+
]);
|
|
112018
|
+
}
|
|
112019
|
+
function buildThemePackage(themeXml3) {
|
|
112020
|
+
const manager = "theme/theme/themeManager.xml";
|
|
112021
|
+
return zipParts([
|
|
112022
|
+
[
|
|
112023
|
+
"[Content_Types].xml",
|
|
112024
|
+
contentTypes([
|
|
112025
|
+
[manager, "themeManager+xml"],
|
|
112026
|
+
["theme/theme/theme1.xml", "theme+xml"]
|
|
112027
|
+
])
|
|
112028
|
+
],
|
|
112029
|
+
["_rels/.rels", relationships("officeDocument", manager)],
|
|
112030
|
+
[manager, `${XML_DECL2}\r
|
|
112031
|
+
<a:themeManager xmlns:a="${A_NS2}"/>`],
|
|
112032
|
+
["theme/theme/_rels/themeManager.xml.rels", relationships("theme", "theme1.xml")],
|
|
112033
|
+
["theme/theme/theme1.xml", withDeclaration(themeXml3)]
|
|
112034
|
+
]);
|
|
112035
|
+
}
|
|
112036
|
+
function buildColorMapping(clrMapAttributes) {
|
|
112037
|
+
const attributes = clrMapAttributes.replace(/\s*xmlns(?::\w+)?="[^"]*"/gu, "").trim();
|
|
112038
|
+
return new TextEncoder().encode(`${XML_DECL2}\r
|
|
112039
|
+
<a:clrMap xmlns:a="${A_NS2}" ${attributes}/>`);
|
|
112040
|
+
}
|
|
112041
|
+
async function buildMasterRoundTrip(source) {
|
|
112042
|
+
return {
|
|
112043
|
+
placeholders: source.placeholders,
|
|
112044
|
+
schemeColors: source.schemeColors,
|
|
112045
|
+
themeFonts: source.themeFonts,
|
|
112046
|
+
oartTextStyles: source.txStylesXml ? await buildOArtTextStylesPackage(source.txStylesXml) : void 0,
|
|
112047
|
+
theme: source.themeXml ? await buildThemePackage(source.themeXml) : void 0,
|
|
112048
|
+
colorMapping: source.clrMapAttributes ? buildColorMapping(source.clrMapAttributes) : void 0
|
|
112049
|
+
};
|
|
112050
|
+
}
|
|
112051
|
+
async function buildMasterRoundTripFromPptx(pptxBytes) {
|
|
112052
|
+
return buildMasterRoundTrip(await readMasterRoundTripSource(await JSZip3.loadAsync(pptxBytes)));
|
|
112053
|
+
}
|
|
112054
|
+
var XML_DECL2;
|
|
112055
|
+
var CT_NS2;
|
|
112056
|
+
var REL_NS2;
|
|
112057
|
+
var OFFICE_REL;
|
|
112058
|
+
var A_NS2;
|
|
112059
|
+
var PML_CT;
|
|
112060
|
+
var init_master_roundtrip_writer = __esm({
|
|
112061
|
+
"src/core/ppt/writer/master-roundtrip-writer.ts"() {
|
|
112062
|
+
init_master_roundtrip_source();
|
|
112063
|
+
XML_DECL2 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
112064
|
+
CT_NS2 = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
112065
|
+
REL_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
112066
|
+
OFFICE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
112067
|
+
A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
112068
|
+
PML_CT = "application/vnd.openxmlformats-officedocument";
|
|
112069
|
+
}
|
|
112070
|
+
});
|
|
112071
|
+
function isNodeCanvasModule(value) {
|
|
112072
|
+
const candidate = value;
|
|
112073
|
+
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
112074
|
+
}
|
|
112075
|
+
function loadNodeCanvas() {
|
|
112076
|
+
nodeCanvas ??= (async () => {
|
|
112077
|
+
const runtime = globalThis.process;
|
|
112078
|
+
if (!runtime?.versions?.node) {
|
|
112079
|
+
return void 0;
|
|
112080
|
+
}
|
|
112081
|
+
try {
|
|
112082
|
+
const imported = await import(
|
|
112083
|
+
/* webpackIgnore: true */
|
|
112084
|
+
/* @vite-ignore */
|
|
112085
|
+
NODE_CANVAS_SPECIFIER
|
|
112086
|
+
);
|
|
112087
|
+
const withDefault = imported;
|
|
112088
|
+
if (isNodeCanvasModule(imported)) {
|
|
112089
|
+
return imported;
|
|
112090
|
+
}
|
|
112091
|
+
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
112092
|
+
} catch {
|
|
112093
|
+
return void 0;
|
|
112094
|
+
}
|
|
112095
|
+
})();
|
|
112096
|
+
return nodeCanvas;
|
|
112097
|
+
}
|
|
112098
|
+
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
112099
|
+
const canvasModule = await loadNodeCanvas();
|
|
112100
|
+
if (!canvasModule) {
|
|
112101
|
+
return void 0;
|
|
112102
|
+
}
|
|
112103
|
+
try {
|
|
112104
|
+
const image = await canvasModule.loadImage(svg);
|
|
112105
|
+
const { width, height } = sizeFor(image.width, image.height);
|
|
112106
|
+
const canvas = canvasModule.createCanvas(width, height);
|
|
112107
|
+
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
112108
|
+
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
112109
|
+
} catch {
|
|
112110
|
+
return void 0;
|
|
112111
|
+
}
|
|
112112
|
+
}
|
|
112113
|
+
var NODE_CANVAS_SPECIFIER;
|
|
112114
|
+
var nodeCanvas;
|
|
112115
|
+
var init_svg_rasterize_node = __esm({
|
|
112116
|
+
"src/core/ppt/writer/svg-rasterize-node.ts"() {
|
|
112117
|
+
NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
112118
|
+
}
|
|
112119
|
+
});
|
|
112120
|
+
function hasDomRasteriser() {
|
|
112121
|
+
return typeof document !== "undefined" && typeof Image !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function";
|
|
112122
|
+
}
|
|
112123
|
+
function svgRasterSize(intrinsicW, intrinsicH, fallbackW, fallbackH) {
|
|
112124
|
+
const baseW = intrinsicW || fallbackW;
|
|
112125
|
+
const baseH = intrinsicH || fallbackH;
|
|
112126
|
+
const scale2 = Math.min(2, MAX_EDGE_PX / Math.max(baseW, baseH, 1));
|
|
112127
|
+
return {
|
|
112128
|
+
width: Math.max(1, Math.round(baseW * scale2)),
|
|
112129
|
+
height: Math.max(1, Math.round(baseH * scale2))
|
|
112130
|
+
};
|
|
112131
|
+
}
|
|
112132
|
+
function loadImage(url) {
|
|
112133
|
+
return new Promise((resolve3) => {
|
|
112134
|
+
const img = new Image();
|
|
112135
|
+
img.onload = () => resolve3(img);
|
|
112136
|
+
img.onerror = () => resolve3(void 0);
|
|
112137
|
+
img.src = url;
|
|
112138
|
+
});
|
|
112139
|
+
}
|
|
112140
|
+
async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
112141
|
+
const url = URL.createObjectURL(new Blob([svg.slice()], { type: "image/svg+xml" }));
|
|
112142
|
+
try {
|
|
112143
|
+
const img = await loadImage(url);
|
|
112144
|
+
if (!img) {
|
|
112145
|
+
return void 0;
|
|
112146
|
+
}
|
|
112147
|
+
const size = svgRasterSize(img.naturalWidth, img.naturalHeight, fallbackW, fallbackH);
|
|
112148
|
+
const canvas = document.createElement("canvas");
|
|
112149
|
+
canvas.width = size.width;
|
|
112150
|
+
canvas.height = size.height;
|
|
112151
|
+
const context = canvas.getContext("2d");
|
|
112152
|
+
if (!context) {
|
|
112153
|
+
return void 0;
|
|
112154
|
+
}
|
|
112155
|
+
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
112156
|
+
const blob = await new Promise((resolve3) => {
|
|
112157
|
+
canvas.toBlob(resolve3, "image/png");
|
|
112158
|
+
});
|
|
112159
|
+
return blob ? new Uint8Array(await blob.arrayBuffer()) : void 0;
|
|
112160
|
+
} catch {
|
|
112161
|
+
return void 0;
|
|
112162
|
+
} finally {
|
|
112163
|
+
URL.revokeObjectURL(url);
|
|
112164
|
+
}
|
|
112165
|
+
}
|
|
112166
|
+
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
112167
|
+
const png = hasDomRasteriser() ? await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx) : await rasterizeSvgInNode(
|
|
112168
|
+
svg,
|
|
112169
|
+
(w, h2) => svgRasterSize(w, h2, fallbackWidthPx, fallbackHeightPx)
|
|
112170
|
+
);
|
|
112171
|
+
return png ? { extension: "png", bytes: png } : void 0;
|
|
112172
|
+
}
|
|
112173
|
+
var MAX_EDGE_PX;
|
|
112174
|
+
var init_svg_rasterize = __esm({
|
|
112175
|
+
"src/core/ppt/writer/svg-rasterize.ts"() {
|
|
112176
|
+
init_svg_rasterize_node();
|
|
112177
|
+
MAX_EDGE_PX = 2048;
|
|
112178
|
+
}
|
|
112179
|
+
});
|
|
112180
|
+
async function tiffToPicture(bytes) {
|
|
112181
|
+
try {
|
|
112182
|
+
const imported = await import('./UTIF-LAD5QYGQ.mjs');
|
|
112183
|
+
const utif = "default" in imported ? imported.default : imported;
|
|
112184
|
+
const buffer = bytes.slice().buffer;
|
|
112185
|
+
const page = utif.decode(buffer)[0];
|
|
112186
|
+
if (!page) {
|
|
112187
|
+
return void 0;
|
|
112188
|
+
}
|
|
112189
|
+
utif.decodeImage(buffer, page);
|
|
112190
|
+
const width = Number(page.width);
|
|
112191
|
+
const height = Number(page.height);
|
|
112192
|
+
if (!(width > 0 && height > 0)) {
|
|
112193
|
+
return void 0;
|
|
112194
|
+
}
|
|
112195
|
+
return {
|
|
112196
|
+
extension: "png",
|
|
112197
|
+
bytes: encodePng(width, height, new Uint8Array(utif.toRGBA8(page)))
|
|
112198
|
+
};
|
|
112199
|
+
} catch {
|
|
112200
|
+
return void 0;
|
|
112201
|
+
}
|
|
112202
|
+
}
|
|
112203
|
+
async function fetchBlobUrl(url) {
|
|
112204
|
+
if (!url?.startsWith("blob:") || typeof fetch === "undefined") {
|
|
112205
|
+
return void 0;
|
|
112206
|
+
}
|
|
112207
|
+
try {
|
|
112208
|
+
return new Uint8Array(await (await fetch(url)).arrayBuffer());
|
|
112209
|
+
} catch {
|
|
112210
|
+
return void 0;
|
|
112211
|
+
}
|
|
112212
|
+
}
|
|
112213
|
+
function pathFormat(path) {
|
|
112214
|
+
const ext = /\.([^./\\]+)$/u.exec(path)?.[1]?.toLowerCase();
|
|
112215
|
+
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
112216
|
+
}
|
|
112217
|
+
async function toPicture(bytes, el) {
|
|
112218
|
+
const format2 = sniffImageFormat(bytes);
|
|
112219
|
+
if (format2 === "tiff") {
|
|
112220
|
+
return tiffToPicture(bytes);
|
|
112221
|
+
}
|
|
112222
|
+
if (format2 === "svg") {
|
|
112223
|
+
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
112224
|
+
}
|
|
112225
|
+
return bytesToPicture(bytes);
|
|
112226
|
+
}
|
|
112227
|
+
async function resolveOne(el, source, readPart) {
|
|
112228
|
+
const inline = decodeBase64DataUrl(source.inline);
|
|
112229
|
+
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
112230
|
+
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
112231
|
+
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
112232
|
+
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
112233
|
+
}
|
|
112234
|
+
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
112235
|
+
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
112236
|
+
if (fromPart) {
|
|
112237
|
+
return fromPart;
|
|
112238
|
+
}
|
|
112239
|
+
if (inline && bytesToPicture(inline)) {
|
|
112240
|
+
return void 0;
|
|
112241
|
+
}
|
|
112242
|
+
const fetched = await fetchBlobUrl(source.inline);
|
|
112243
|
+
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
112244
|
+
if (fromFetch || !source.svgPath) {
|
|
112245
|
+
return fromFetch;
|
|
112246
|
+
}
|
|
112247
|
+
const svg = await readPart(source.svgPath);
|
|
112248
|
+
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
112249
|
+
}
|
|
112250
|
+
async function resolvePictureSources(slides, readPart) {
|
|
112251
|
+
const pending = [];
|
|
112252
|
+
const walk3 = (elements2) => {
|
|
112253
|
+
for (const el of elements2) {
|
|
112254
|
+
const source = pictureSourceOf(el);
|
|
112255
|
+
if (source) {
|
|
112256
|
+
pending.push([el, source]);
|
|
112257
|
+
} else if (el.type === "group") {
|
|
112258
|
+
walk3(el.children);
|
|
112259
|
+
}
|
|
112260
|
+
}
|
|
112261
|
+
};
|
|
112262
|
+
for (const slide of slides) {
|
|
112263
|
+
walk3(slide.elements);
|
|
112264
|
+
}
|
|
112265
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
112266
|
+
await Promise.all(
|
|
112267
|
+
pending.map(async ([el, source]) => {
|
|
112268
|
+
const picture = await resolveOne(el, source, readPart);
|
|
112269
|
+
if (picture) {
|
|
112270
|
+
resolved.set(el, picture);
|
|
112271
|
+
}
|
|
112272
|
+
})
|
|
112273
|
+
);
|
|
112274
|
+
return resolved;
|
|
112275
|
+
}
|
|
112276
|
+
var init_picture_resolve = __esm({
|
|
112277
|
+
"src/core/ppt/writer/picture-resolve.ts"() {
|
|
112278
|
+
init_png_encoder2();
|
|
112279
|
+
init_picture_encode();
|
|
112280
|
+
init_picture_source();
|
|
112281
|
+
init_raster_utils();
|
|
112282
|
+
init_svg_rasterize();
|
|
112283
|
+
}
|
|
112284
|
+
});
|
|
112285
|
+
var init_write_ppt2 = __esm({
|
|
112286
|
+
"src/core/ppt/writer/write-ppt.ts"() {
|
|
112287
|
+
init_legacy_ppt_writer();
|
|
112288
|
+
}
|
|
112289
|
+
});
|
|
112106
112290
|
var init_writer = __esm({
|
|
112107
112291
|
"src/core/ppt/writer/index.ts"() {
|
|
112108
112292
|
init_element_to_write_model();
|
|
@@ -112110,7 +112294,7 @@ var init_writer = __esm({
|
|
|
112110
112294
|
init_master_style_convert();
|
|
112111
112295
|
init_master_roundtrip_writer();
|
|
112112
112296
|
init_picture_resolve();
|
|
112113
|
-
|
|
112297
|
+
init_write_ppt2();
|
|
112114
112298
|
}
|
|
112115
112299
|
});
|
|
112116
112300
|
function findViewKey(node, name) {
|
|
@@ -130646,7 +130830,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130646
130830
|
}
|
|
130647
130831
|
});
|
|
130648
130832
|
const rawParser = this._originalParser || this.parser;
|
|
130649
|
-
const
|
|
130833
|
+
const parse = typeof rawParser.parse === "function" ? rawParser.parse.bind(rawParser) : this.parser.parse.bind(this.parser);
|
|
130650
130834
|
for (const path of xmlPaths) {
|
|
130651
130835
|
const file = this.zip.file(path);
|
|
130652
130836
|
if (!file) {
|
|
@@ -130661,7 +130845,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130661
130845
|
continue;
|
|
130662
130846
|
}
|
|
130663
130847
|
try {
|
|
130664
|
-
const parsed =
|
|
130848
|
+
const parsed = parse(xmlText2);
|
|
130665
130849
|
if (typeof parsed !== "object" || parsed === null) {
|
|
130666
130850
|
continue;
|
|
130667
130851
|
}
|
|
@@ -146812,10 +146996,10 @@ function picBlipEmbedId(pic, getChild) {
|
|
|
146812
146996
|
const embed = String(blip["@_r:embed"] || blip["@_embed"] || blip["@_r:link"] || "").trim();
|
|
146813
146997
|
return embed.length > 0 ? embed : void 0;
|
|
146814
146998
|
}
|
|
146815
|
-
function parseDrawingRelTargets(relsXml,
|
|
146999
|
+
function parseDrawingRelTargets(relsXml, parse, ensureArray20) {
|
|
146816
147000
|
const map = /* @__PURE__ */ new Map();
|
|
146817
147001
|
try {
|
|
146818
|
-
const relsRoot =
|
|
147002
|
+
const relsRoot = parse(relsXml)["Relationships"];
|
|
146819
147003
|
if (!relsRoot) {
|
|
146820
147004
|
return map;
|
|
146821
147005
|
}
|
|
@@ -150259,6 +150443,16 @@ var init_core = __esm({
|
|
|
150259
150443
|
init_table_style_entry_parse();
|
|
150260
150444
|
}
|
|
150261
150445
|
});
|
|
150446
|
+
var init_record_stream2 = __esm({
|
|
150447
|
+
"src/core/ppt/record-stream.ts"() {
|
|
150448
|
+
init_legacy_ppt_record_stream();
|
|
150449
|
+
}
|
|
150450
|
+
});
|
|
150451
|
+
var init_record_types2 = __esm({
|
|
150452
|
+
"src/core/ppt/record-types.ts"() {
|
|
150453
|
+
init_legacy_ppt_record_types();
|
|
150454
|
+
}
|
|
150455
|
+
});
|
|
150262
150456
|
function parseCurrentUserAtom(stream) {
|
|
150263
150457
|
const view = new DataView(stream.buffer, stream.byteOffset, stream.byteLength);
|
|
150264
150458
|
const rec = readRecordOrThrow(view, 0);
|
|
@@ -150292,8 +150486,8 @@ function parseCurrentUserAtom(stream) {
|
|
|
150292
150486
|
var EncryptedPptError;
|
|
150293
150487
|
var init_current_user = __esm({
|
|
150294
150488
|
"src/core/ppt/current-user.ts"() {
|
|
150295
|
-
|
|
150296
|
-
|
|
150489
|
+
init_record_stream2();
|
|
150490
|
+
init_record_types2();
|
|
150297
150491
|
EncryptedPptError = class extends Error {
|
|
150298
150492
|
isEncrypted = true;
|
|
150299
150493
|
constructor(message = "This is a password-protected PowerPoint 97-2003 (.ppt) file. Encrypted .ppt files are not supported.") {
|
|
@@ -150303,6 +150497,11 @@ var init_current_user = __esm({
|
|
|
150303
150497
|
};
|
|
150304
150498
|
}
|
|
150305
150499
|
});
|
|
150500
|
+
var init_color_scheme2 = __esm({
|
|
150501
|
+
"src/core/ppt/color-scheme.ts"() {
|
|
150502
|
+
init_color_scheme();
|
|
150503
|
+
}
|
|
150504
|
+
});
|
|
150306
150505
|
var ByteCursor;
|
|
150307
150506
|
var init_byte_cursor = __esm({
|
|
150308
150507
|
"src/core/ppt/text/byte-cursor.ts"() {
|
|
@@ -150512,7 +150711,7 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
|
|
|
150512
150711
|
var ALIGN_MAP4;
|
|
150513
150712
|
var init_style_props = __esm({
|
|
150514
150713
|
"src/core/ppt/text/style-props.ts"() {
|
|
150515
|
-
|
|
150714
|
+
init_color_scheme2();
|
|
150516
150715
|
init_byte_cursor();
|
|
150517
150716
|
ALIGN_MAP4 = {
|
|
150518
150717
|
0: "l",
|
|
@@ -150591,8 +150790,8 @@ function collectOutlineText(view, slideListWithText, scheme) {
|
|
|
150591
150790
|
var CP1252_HIGH;
|
|
150592
150791
|
var init_text_atoms = __esm({
|
|
150593
150792
|
"src/core/ppt/text/text-atoms.ts"() {
|
|
150594
|
-
|
|
150595
|
-
|
|
150793
|
+
init_record_stream2();
|
|
150794
|
+
init_record_types2();
|
|
150596
150795
|
init_style_props();
|
|
150597
150796
|
CP1252_HIGH = {
|
|
150598
150797
|
128: 8364,
|
|
@@ -150744,8 +150943,8 @@ var II_ACTION2;
|
|
|
150744
150943
|
var II_JUMP2;
|
|
150745
150944
|
var init_hyperlink_parser = __esm({
|
|
150746
150945
|
"src/core/ppt/hyperlink-parser.ts"() {
|
|
150747
|
-
|
|
150748
|
-
|
|
150946
|
+
init_record_stream2();
|
|
150947
|
+
init_record_types2();
|
|
150749
150948
|
init_text_atoms();
|
|
150750
150949
|
LT2 = {
|
|
150751
150950
|
customShow: 6,
|
|
@@ -150812,9 +151011,7 @@ var init_deflate_utils = __esm({
|
|
|
150812
151011
|
function parseUserEditAtom(view, offset) {
|
|
150813
151012
|
const rec = readRecordOrThrow(view, offset);
|
|
150814
151013
|
if (rec.recType !== RT.UserEditAtom) {
|
|
150815
|
-
throw new PptParseError(
|
|
150816
|
-
`Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`
|
|
150817
|
-
);
|
|
151014
|
+
throw new PptParseError(`Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
|
|
150818
151015
|
}
|
|
150819
151016
|
if (rec.recLen !== 28 && rec.recLen !== 32) {
|
|
150820
151017
|
throw new PptParseError(`UserEditAtom has invalid length ${rec.recLen}`);
|
|
@@ -150830,9 +151027,7 @@ function parseUserEditAtom(view, offset) {
|
|
|
150830
151027
|
function parsePersistDirectoryAtom(view, offset) {
|
|
150831
151028
|
const rec = readRecordOrThrow(view, offset);
|
|
150832
151029
|
if (rec.recType !== RT.PersistDirectoryAtom) {
|
|
150833
|
-
throw new PptParseError(
|
|
150834
|
-
`Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`
|
|
150835
|
-
);
|
|
151030
|
+
throw new PptParseError(`Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
|
|
150836
151031
|
}
|
|
150837
151032
|
const pairs3 = [];
|
|
150838
151033
|
let pos2 = rec.dataOffset;
|
|
@@ -150880,11 +151075,16 @@ function readPersistRecord(view, directory, persistId) {
|
|
|
150880
151075
|
return readRecordOrThrow(view, offset);
|
|
150881
151076
|
}
|
|
150882
151077
|
var init_persist_directory = __esm({
|
|
150883
|
-
"
|
|
151078
|
+
"../../node_modules/.bun/@christophervr+ole2@0.2.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
|
|
150884
151079
|
init_record_stream();
|
|
150885
151080
|
init_record_types();
|
|
150886
151081
|
}
|
|
150887
151082
|
});
|
|
151083
|
+
var init_persist_directory2 = __esm({
|
|
151084
|
+
"src/core/ppt/persist-directory.ts"() {
|
|
151085
|
+
init_persist_directory();
|
|
151086
|
+
}
|
|
151087
|
+
});
|
|
150888
151088
|
function readCString2(view, rec) {
|
|
150889
151089
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
150890
151090
|
}
|
|
@@ -150977,9 +151177,9 @@ var init_ole_embed_parser = __esm({
|
|
|
150977
151177
|
init_ole_embedded_extract();
|
|
150978
151178
|
init_ole2_parser();
|
|
150979
151179
|
init_deflate_utils();
|
|
150980
|
-
|
|
150981
|
-
|
|
150982
|
-
|
|
151180
|
+
init_persist_directory2();
|
|
151181
|
+
init_record_stream2();
|
|
151182
|
+
init_record_types2();
|
|
150983
151183
|
init_text_atoms();
|
|
150984
151184
|
}
|
|
150985
151185
|
});
|
|
@@ -151104,8 +151304,8 @@ var BLIP_TYPES;
|
|
|
151104
151304
|
var init_pictures = __esm({
|
|
151105
151305
|
"src/core/ppt/pictures.ts"() {
|
|
151106
151306
|
init_deflate_utils();
|
|
151107
|
-
|
|
151108
|
-
|
|
151307
|
+
init_record_stream2();
|
|
151308
|
+
init_record_types2();
|
|
151109
151309
|
BLIP_TYPES = /* @__PURE__ */ new Map([
|
|
151110
151310
|
[OA.BlipEmf, { extension: "emf", isMetafile: true, singleUidInstance: 980 }],
|
|
151111
151311
|
[OA.BlipWmf, { extension: "wmf", isMetafile: true, singleUidInstance: 534 }],
|
|
@@ -151268,7 +151468,7 @@ function buildTextBody2(raw, fonts, hyperlinkRanges = []) {
|
|
|
151268
151468
|
}
|
|
151269
151469
|
var init_text_builder = __esm({
|
|
151270
151470
|
"src/core/ppt/text/text-builder.ts"() {
|
|
151271
|
-
|
|
151471
|
+
init_record_types2();
|
|
151272
151472
|
}
|
|
151273
151473
|
});
|
|
151274
151474
|
function extractText(ctx, clientTextbox2) {
|
|
@@ -151307,8 +151507,8 @@ var PLACEHOLDER_TYPE_MAP;
|
|
|
151307
151507
|
var init_client_data_extract = __esm({
|
|
151308
151508
|
"src/core/ppt/escher/client-data-extract.ts"() {
|
|
151309
151509
|
init_hyperlink_parser();
|
|
151310
|
-
|
|
151311
|
-
|
|
151510
|
+
init_record_stream2();
|
|
151511
|
+
init_record_types2();
|
|
151312
151512
|
init_text_atoms();
|
|
151313
151513
|
init_text_builder();
|
|
151314
151514
|
PLACEHOLDER_TYPE_MAP = {
|
|
@@ -151704,8 +151904,8 @@ function extractLine(props, scheme) {
|
|
|
151704
151904
|
var GRADIENT_FILL_TYPES;
|
|
151705
151905
|
var init_shape_props = __esm({
|
|
151706
151906
|
"src/core/ppt/escher/shape-props.ts"() {
|
|
151707
|
-
|
|
151708
|
-
|
|
151907
|
+
init_color_scheme2();
|
|
151908
|
+
init_record_types2();
|
|
151709
151909
|
init_geometry_map();
|
|
151710
151910
|
init_properties();
|
|
151711
151911
|
GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
|
|
@@ -151896,10 +152096,10 @@ var FSP_FLAG_FLIPV2;
|
|
|
151896
152096
|
var FSP_FLAG_BACKGROUND2;
|
|
151897
152097
|
var init_sp_container = __esm({
|
|
151898
152098
|
"src/core/ppt/escher/sp-container.ts"() {
|
|
151899
|
-
|
|
152099
|
+
init_color_scheme2();
|
|
151900
152100
|
init_hyperlink_parser();
|
|
151901
|
-
|
|
151902
|
-
|
|
152101
|
+
init_record_stream2();
|
|
152102
|
+
init_record_types2();
|
|
151903
152103
|
init_client_data_extract();
|
|
151904
152104
|
init_geometry_map();
|
|
151905
152105
|
init_properties();
|
|
@@ -151981,10 +152181,10 @@ var SLIDE_FLAG_MASTER_SCHEME2;
|
|
|
151981
152181
|
var SLIDE_FLAG_MASTER_BACKGROUND2;
|
|
151982
152182
|
var init_slide_parser = __esm({
|
|
151983
152183
|
"src/core/ppt/slide-parser.ts"() {
|
|
151984
|
-
|
|
152184
|
+
init_color_scheme2();
|
|
151985
152185
|
init_sp_container();
|
|
151986
|
-
|
|
151987
|
-
|
|
152186
|
+
init_record_stream2();
|
|
152187
|
+
init_record_types2();
|
|
151988
152188
|
SLIDE_FLAG_MASTER_OBJECTS2 = 1;
|
|
151989
152189
|
SLIDE_FLAG_MASTER_SCHEME2 = 2;
|
|
151990
152190
|
SLIDE_FLAG_MASTER_BACKGROUND2 = 4;
|
|
@@ -152064,8 +152264,8 @@ function collectMasterStyles(view, masterContainer, scheme, fonts) {
|
|
|
152064
152264
|
}
|
|
152065
152265
|
var init_master_styles = __esm({
|
|
152066
152266
|
"src/core/ppt/text/master-styles.ts"() {
|
|
152067
|
-
|
|
152068
|
-
|
|
152267
|
+
init_record_stream2();
|
|
152268
|
+
init_record_types2();
|
|
152069
152269
|
init_style_props();
|
|
152070
152270
|
}
|
|
152071
152271
|
});
|
|
@@ -152249,19 +152449,29 @@ async function parseDeck(streams) {
|
|
|
152249
152449
|
}
|
|
152250
152450
|
var init_document_parser = __esm({
|
|
152251
152451
|
"src/core/ppt/document-parser.ts"() {
|
|
152252
|
-
|
|
152452
|
+
init_color_scheme2();
|
|
152253
152453
|
init_current_user();
|
|
152254
152454
|
init_hyperlink_parser();
|
|
152255
152455
|
init_ole_embed_parser();
|
|
152256
|
-
|
|
152456
|
+
init_persist_directory2();
|
|
152257
152457
|
init_pictures();
|
|
152258
|
-
|
|
152259
|
-
|
|
152458
|
+
init_record_stream2();
|
|
152459
|
+
init_record_types2();
|
|
152260
152460
|
init_slide_parser();
|
|
152261
152461
|
init_master_styles();
|
|
152262
152462
|
init_text_atoms();
|
|
152263
152463
|
}
|
|
152264
152464
|
});
|
|
152465
|
+
var init_rc4_cryptoapi_key2 = __esm({
|
|
152466
|
+
"src/core/ppt/rc4-cryptoapi-key.ts"() {
|
|
152467
|
+
init_rc4_cryptoapi_key();
|
|
152468
|
+
}
|
|
152469
|
+
});
|
|
152470
|
+
var init_rc4_cryptoapi_streams2 = __esm({
|
|
152471
|
+
"src/core/ppt/rc4-cryptoapi-streams.ts"() {
|
|
152472
|
+
init_rc4_cryptoapi_streams();
|
|
152473
|
+
}
|
|
152474
|
+
});
|
|
152265
152475
|
function parseLegacyPptEncryptionInfo(data) {
|
|
152266
152476
|
const info = parseEncryptionInfo(data);
|
|
152267
152477
|
if (!("isStandard" in info) || !info.isStandard) {
|
|
@@ -152320,11 +152530,11 @@ var init_ppt_encryption = __esm({
|
|
|
152320
152530
|
init_ooxml_crypto_errors();
|
|
152321
152531
|
init_ooxml_crypto_key_derivation();
|
|
152322
152532
|
init_current_user();
|
|
152323
|
-
|
|
152324
|
-
|
|
152325
|
-
|
|
152326
|
-
|
|
152327
|
-
|
|
152533
|
+
init_persist_directory2();
|
|
152534
|
+
init_rc4_cryptoapi_key2();
|
|
152535
|
+
init_rc4_cryptoapi_streams2();
|
|
152536
|
+
init_record_stream2();
|
|
152537
|
+
init_record_types2();
|
|
152328
152538
|
}
|
|
152329
152539
|
});
|
|
152330
152540
|
function hyperlinkClickXml(target, alloc, slideCount) {
|
|
@@ -152523,7 +152733,7 @@ function txBodyXml(text22, ctx) {
|
|
|
152523
152733
|
}
|
|
152524
152734
|
var init_txbody_writer = __esm({
|
|
152525
152735
|
"src/core/ppt/pptx/txbody-writer.ts"() {
|
|
152526
|
-
|
|
152736
|
+
init_record_types2();
|
|
152527
152737
|
init_hyperlink_xml();
|
|
152528
152738
|
init_xml_utils();
|
|
152529
152739
|
}
|
|
@@ -152748,7 +152958,7 @@ function themeXml2(deck) {
|
|
|
152748
152958
|
var XMLNS;
|
|
152749
152959
|
var init_master_writer = __esm({
|
|
152750
152960
|
"src/core/ppt/pptx/master-writer.ts"() {
|
|
152751
|
-
|
|
152961
|
+
init_color_scheme2();
|
|
152752
152962
|
init_shape_writer2();
|
|
152753
152963
|
init_xml_utils();
|
|
152754
152964
|
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"';
|
|
@@ -153056,7 +153266,7 @@ ${mediaRels.join("\n")}
|
|
|
153056
153266
|
var HYPERLINK_REL_TYPE;
|
|
153057
153267
|
var init_package_writer = __esm({
|
|
153058
153268
|
"src/core/ppt/pptx/package-writer.ts"() {
|
|
153059
|
-
|
|
153269
|
+
init_color_scheme2();
|
|
153060
153270
|
init_master_writer();
|
|
153061
153271
|
init_package_writer_ole();
|
|
153062
153272
|
init_package_writer_parts();
|
|
@@ -153125,7 +153335,7 @@ var init_ppt_to_pptx = __esm({
|
|
|
153125
153335
|
init_document_parser();
|
|
153126
153336
|
init_ppt_encryption();
|
|
153127
153337
|
init_package_writer();
|
|
153128
|
-
|
|
153338
|
+
init_record_stream2();
|
|
153129
153339
|
DOCUMENT_STREAM = "PowerPoint Document";
|
|
153130
153340
|
CURRENT_USER_STREAM = "Current User";
|
|
153131
153341
|
PICTURES_STREAM = "Pictures";
|
|
@@ -153135,11 +153345,11 @@ var init_ppt = __esm({
|
|
|
153135
153345
|
"src/core/ppt/index.ts"() {
|
|
153136
153346
|
init_current_user();
|
|
153137
153347
|
init_document_parser();
|
|
153138
|
-
|
|
153348
|
+
init_persist_directory2();
|
|
153139
153349
|
init_ppt_to_pptx();
|
|
153140
153350
|
init_ppt_encryption();
|
|
153141
|
-
|
|
153142
|
-
|
|
153351
|
+
init_record_stream2();
|
|
153352
|
+
init_record_types2();
|
|
153143
153353
|
}
|
|
153144
153354
|
});
|
|
153145
153355
|
var PptxHandlerCore;
|
|
@@ -190002,6 +190212,13 @@ function buildUserFontFaceStyles(fonts) {
|
|
|
190002
190212
|
}
|
|
190003
190213
|
return rules.join("\n\n");
|
|
190004
190214
|
}
|
|
190215
|
+
function parseOpenTypeFont(buffer, module = opentypeModule) {
|
|
190216
|
+
const parser = module.parse ?? module.default?.parse;
|
|
190217
|
+
if (!parser) {
|
|
190218
|
+
throw new Error("opentype.js does not expose a font parser");
|
|
190219
|
+
}
|
|
190220
|
+
return parser(buffer);
|
|
190221
|
+
}
|
|
190005
190222
|
function toArrayBuffer(bytes) {
|
|
190006
190223
|
const copy2 = bytes.slice();
|
|
190007
190224
|
return copy2.buffer;
|
|
@@ -190048,7 +190265,7 @@ var GlyphOutlineFontCache = class {
|
|
|
190048
190265
|
continue;
|
|
190049
190266
|
}
|
|
190050
190267
|
try {
|
|
190051
|
-
this.fonts.set(key2,
|
|
190268
|
+
this.fonts.set(key2, parseOpenTypeFont(toArrayBuffer(bytes)));
|
|
190052
190269
|
} catch {
|
|
190053
190270
|
}
|
|
190054
190271
|
}
|
|
@@ -190066,7 +190283,7 @@ var GlyphOutlineFontCache = class {
|
|
|
190066
190283
|
return false;
|
|
190067
190284
|
}
|
|
190068
190285
|
try {
|
|
190069
|
-
this.fonts.set(key2,
|
|
190286
|
+
this.fonts.set(key2, parseOpenTypeFont(toArrayBuffer(bytes)));
|
|
190070
190287
|
return true;
|
|
190071
190288
|
} catch {
|
|
190072
190289
|
return false;
|