pptx-react-viewer 1.0.12 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PowerPointViewer-DtLlYf0r.d.mts → PowerPointViewer-CX0a7wz_.d.mts} +2 -0
- package/dist/{PowerPointViewer-DtLlYf0r.d.ts → PowerPointViewer-CX0a7wz_.d.ts} +2 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +373 -64
- package/dist/index.mjs +373 -64
- package/dist/pptx-viewer.css +1 -1
- package/dist/viewer/index.d.mts +11 -3
- package/dist/viewer/index.d.ts +11 -3
- package/dist/viewer/index.js +373 -64
- package/dist/viewer/index.mjs +373 -64
- package/node_modules/emf-converter/package.json +1 -1
- package/node_modules/mtx-decompressor/dist/index.d.mts +2 -1
- package/node_modules/mtx-decompressor/dist/index.d.ts +2 -1
- package/node_modules/mtx-decompressor/dist/index.js +85 -93
- package/node_modules/mtx-decompressor/dist/index.mjs +85 -93
- package/node_modules/mtx-decompressor/package.json +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-CPr1npgo.d.ts → SvgExporter--H1PDfAY.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-B4-1_Hjp.d.mts → SvgExporter-Dq_2eV_r.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.js +339 -235
- package/node_modules/pptx-viewer-core/dist/cli/index.mjs +339 -235
- package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
- package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
- package/node_modules/pptx-viewer-core/dist/index.d.mts +297 -6
- package/node_modules/pptx-viewer-core/dist/index.d.ts +297 -6
- package/node_modules/pptx-viewer-core/dist/index.js +1309 -235
- package/node_modules/pptx-viewer-core/dist/index.mjs +1285 -236
- package/node_modules/pptx-viewer-core/dist/{presentation-DgkIYhXo.d.mts → presentation-BozkirFp.d.mts} +17 -1
- package/node_modules/pptx-viewer-core/dist/{presentation-DgkIYhXo.d.ts → presentation-BozkirFp.d.ts} +17 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-dYKZp3zE.d.mts → text-operations-B2JbPA5H.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-B6U6XxWt.d.ts → text-operations-zwF6i4eH.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/package.json +1 -1
- package/package.json +4 -4
|
@@ -6281,33 +6281,10 @@ var PptxPresentationSaveBuilder = class {
|
|
|
6281
6281
|
init.presentationData["p:presentation"] = presentation;
|
|
6282
6282
|
return init.presentationData;
|
|
6283
6283
|
}
|
|
6284
|
-
applyHeaderFooter(presentation,
|
|
6285
|
-
if (
|
|
6286
|
-
|
|
6287
|
-
}
|
|
6288
|
-
const hf = presentation["p:hf"] || {};
|
|
6289
|
-
if (headerFooter.hasHeader !== void 0) {
|
|
6290
|
-
hf["@_hdr"] = headerFooter.hasHeader ? "1" : "0";
|
|
6291
|
-
}
|
|
6292
|
-
if (headerFooter.hasFooter !== void 0) {
|
|
6293
|
-
hf["@_ftr"] = headerFooter.hasFooter ? "1" : "0";
|
|
6294
|
-
}
|
|
6295
|
-
if (headerFooter.hasDateTime !== void 0) {
|
|
6296
|
-
hf["@_dt"] = headerFooter.hasDateTime ? "1" : "0";
|
|
6297
|
-
}
|
|
6298
|
-
if (headerFooter.hasSlideNumber !== void 0) {
|
|
6299
|
-
hf["@_sldNum"] = headerFooter.hasSlideNumber ? "1" : "0";
|
|
6300
|
-
}
|
|
6301
|
-
if (headerFooter.footerText !== void 0) {
|
|
6302
|
-
hf["@_ftrText"] = headerFooter.footerText;
|
|
6303
|
-
}
|
|
6304
|
-
if (headerFooter.dateTimeText !== void 0) {
|
|
6305
|
-
hf["@_dtText"] = headerFooter.dateTimeText;
|
|
6284
|
+
applyHeaderFooter(presentation, _headerFooter) {
|
|
6285
|
+
if (presentation["p:hf"] !== void 0) {
|
|
6286
|
+
delete presentation["p:hf"];
|
|
6306
6287
|
}
|
|
6307
|
-
if (headerFooter.dateFormat !== void 0) {
|
|
6308
|
-
hf["@_dtFmt"] = headerFooter.dateFormat;
|
|
6309
|
-
}
|
|
6310
|
-
presentation["p:hf"] = hf;
|
|
6311
6288
|
}
|
|
6312
6289
|
applySlideDimensions(presentation, rawSlideWidthEmu, rawSlideHeightEmu, rawSlideSizeType) {
|
|
6313
6290
|
const slideSize = presentation["p:sldSz"];
|
|
@@ -6983,7 +6960,9 @@ var PptxSlideNotesPartUpdater = class {
|
|
|
6983
6960
|
var PptxSlideBackgroundBuilder = class {
|
|
6984
6961
|
applyBackground(init) {
|
|
6985
6962
|
const hasBackgroundColor = typeof init.slide.backgroundColor === "string" && init.slide.backgroundColor.length > 0 && init.slide.backgroundColor !== "transparent";
|
|
6986
|
-
const
|
|
6963
|
+
const rawBackgroundImage = typeof init.slide.backgroundImage === "string" ? init.slide.backgroundImage : "";
|
|
6964
|
+
const hasBackgroundImage = rawBackgroundImage.length > 0;
|
|
6965
|
+
const hasDataUrlBackgroundImage = hasBackgroundImage && rawBackgroundImage.startsWith("data:");
|
|
6987
6966
|
const hasBackgroundGradient = typeof init.slide.backgroundGradient === "string" && init.slide.backgroundGradient.length > 0;
|
|
6988
6967
|
const cSld = init.slideNode["p:cSld"] || {};
|
|
6989
6968
|
if (!(hasBackgroundColor || hasBackgroundImage || hasBackgroundGradient)) {
|
|
@@ -6991,9 +6970,17 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
6991
6970
|
init.slideNode["p:cSld"] = cSld;
|
|
6992
6971
|
return;
|
|
6993
6972
|
}
|
|
6973
|
+
const existingBg = cSld["p:bg"];
|
|
6974
|
+
const existingBgPr = existingBg?.["p:bgPr"];
|
|
6975
|
+
const existingHasBlipFill = existingBgPr?.["a:blipFill"] !== void 0;
|
|
6976
|
+
if (!hasDataUrlBackgroundImage && existingHasBlipFill) {
|
|
6977
|
+
this.reorderCSldBgFirst(cSld, existingBg);
|
|
6978
|
+
init.slideNode["p:cSld"] = cSld;
|
|
6979
|
+
return;
|
|
6980
|
+
}
|
|
6994
6981
|
const backgroundProperties = {};
|
|
6995
|
-
if (
|
|
6996
|
-
const parsedBackgroundImage = init.parseDataUrlToBytes(
|
|
6982
|
+
if (hasDataUrlBackgroundImage) {
|
|
6983
|
+
const parsedBackgroundImage = init.parseDataUrlToBytes(rawBackgroundImage);
|
|
6997
6984
|
if (parsedBackgroundImage) {
|
|
6998
6985
|
const backgroundImagePath = init.saveState.nextMediaPath(parsedBackgroundImage.extension);
|
|
6999
6986
|
init.zip.file(backgroundImagePath, parsedBackgroundImage.bytes);
|
|
@@ -7016,9 +7003,42 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
7016
7003
|
}
|
|
7017
7004
|
};
|
|
7018
7005
|
}
|
|
7019
|
-
backgroundProperties["a:
|
|
7020
|
-
|
|
7021
|
-
|
|
7006
|
+
const hasFillChild = backgroundProperties["a:blipFill"] !== void 0 || backgroundProperties["a:solidFill"] !== void 0 || backgroundProperties["a:gradFill"] !== void 0 || backgroundProperties["a:pattFill"] !== void 0 || backgroundProperties["a:noFill"] !== void 0 || backgroundProperties["a:grpFill"] !== void 0;
|
|
7007
|
+
if (hasFillChild) {
|
|
7008
|
+
backgroundProperties["a:effectLst"] = {};
|
|
7009
|
+
}
|
|
7010
|
+
if (!hasFillChild) {
|
|
7011
|
+
delete cSld["p:bg"];
|
|
7012
|
+
init.slideNode["p:cSld"] = cSld;
|
|
7013
|
+
return;
|
|
7014
|
+
}
|
|
7015
|
+
const rebuiltCSld = { "p:bg": { "p:bgPr": backgroundProperties } };
|
|
7016
|
+
for (const key of Object.keys(cSld)) {
|
|
7017
|
+
if (key === "p:bg") {
|
|
7018
|
+
continue;
|
|
7019
|
+
}
|
|
7020
|
+
rebuiltCSld[key] = cSld[key];
|
|
7021
|
+
}
|
|
7022
|
+
init.slideNode["p:cSld"] = rebuiltCSld;
|
|
7023
|
+
}
|
|
7024
|
+
reorderCSldBgFirst(cSld, bg) {
|
|
7025
|
+
const keys = Object.keys(cSld);
|
|
7026
|
+
if (keys.length > 0 && keys[0] === "p:bg") {
|
|
7027
|
+
return;
|
|
7028
|
+
}
|
|
7029
|
+
const reordered = { "p:bg": bg };
|
|
7030
|
+
for (const key of keys) {
|
|
7031
|
+
if (key === "p:bg") {
|
|
7032
|
+
continue;
|
|
7033
|
+
}
|
|
7034
|
+
reordered[key] = cSld[key];
|
|
7035
|
+
}
|
|
7036
|
+
for (const key of Object.keys(cSld)) {
|
|
7037
|
+
delete cSld[key];
|
|
7038
|
+
}
|
|
7039
|
+
for (const key of Object.keys(reordered)) {
|
|
7040
|
+
cSld[key] = reordered[key];
|
|
7041
|
+
}
|
|
7022
7042
|
}
|
|
7023
7043
|
};
|
|
7024
7044
|
|
|
@@ -9895,6 +9915,7 @@ var PptxConnectorParser = class {
|
|
|
9895
9915
|
slideRelationships,
|
|
9896
9916
|
this.context.getOrderedSlidePaths()
|
|
9897
9917
|
);
|
|
9918
|
+
const connElementName = cNvPr?.["@_name"] ? String(cNvPr["@_name"]).trim() : void 0;
|
|
9898
9919
|
const locks = this.context.parseShapeLocks(
|
|
9899
9920
|
cNvConnectionShapeProperties?.["a:cxnSpLocks"] ?? cNvConnectionShapeProperties?.["a:spLocks"]
|
|
9900
9921
|
);
|
|
@@ -9902,6 +9923,7 @@ var PptxConnectorParser = class {
|
|
|
9902
9923
|
const textResult = this.context.parseConnectorTextBody?.(txBody, slidePath);
|
|
9903
9924
|
return {
|
|
9904
9925
|
id,
|
|
9926
|
+
name: connElementName || void 0,
|
|
9905
9927
|
type: "connector",
|
|
9906
9928
|
x: Math.round(parseInt(String(offset["@_x"] || "0"), 10) / this.context.emuPerPx),
|
|
9907
9929
|
y: Math.round(parseInt(String(offset["@_y"] || "0"), 10) / this.context.emuPerPx),
|
|
@@ -13431,7 +13453,16 @@ var PptxRuntimeDependencyFactory = class {
|
|
|
13431
13453
|
return new fastXmlParser.XMLParser({
|
|
13432
13454
|
ignoreAttributes: false,
|
|
13433
13455
|
attributeNamePrefix: "@_",
|
|
13434
|
-
parseAttributeValue: false
|
|
13456
|
+
parseAttributeValue: false,
|
|
13457
|
+
// Keep element text as strings. When true (the fast-xml-parser
|
|
13458
|
+
// default), `<AppVersion>16.0000</AppVersion>` is coerced to the
|
|
13459
|
+
// JS number 16, losing the trailing zeros. On save we write back
|
|
13460
|
+
// "16", which fails PowerPoint's strict `[0-9]+\.[0-9]{4}` match
|
|
13461
|
+
// on AppVersion — the loader rejects the package with HRESULT
|
|
13462
|
+
// 0x80070570 (ERROR_FILE_CORRUPT) and shows the repair dialog.
|
|
13463
|
+
// More generally, OOXML element text is always an untyped string;
|
|
13464
|
+
// downstream callers coerce where needed.
|
|
13465
|
+
parseTagValue: false
|
|
13435
13466
|
});
|
|
13436
13467
|
}
|
|
13437
13468
|
createBuilder() {
|
|
@@ -14107,7 +14138,7 @@ var TRIPLET_ENCODINGS = [
|
|
|
14107
14138
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: -1 },
|
|
14108
14139
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: -1, ySign: 1 },
|
|
14109
14140
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: 1 },
|
|
14110
|
-
// Indices 84-
|
|
14141
|
+
// Indices 84-119: 8-bit X + 8-bit Y (3 bytes total)
|
|
14111
14142
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: -1 },
|
|
14112
14143
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: 1, ySign: -1 },
|
|
14113
14144
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: 1 },
|
|
@@ -14144,12 +14175,12 @@ var TRIPLET_ENCODINGS = [
|
|
|
14144
14175
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: -1 },
|
|
14145
14176
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: -1, ySign: 1 },
|
|
14146
14177
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: 1 },
|
|
14147
|
-
// Indices
|
|
14178
|
+
// Indices 120-123: 12-bit X + 12-bit Y (4 bytes total)
|
|
14148
14179
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14149
14180
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14150
14181
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
14151
14182
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: 1 },
|
|
14152
|
-
// Indices
|
|
14183
|
+
// Indices 124-127: 16-bit X + 16-bit Y (5 bytes total)
|
|
14153
14184
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14154
14185
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14155
14186
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
@@ -14238,14 +14269,15 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14238
14269
|
if (pushCount === 0) {
|
|
14239
14270
|
return;
|
|
14240
14271
|
}
|
|
14241
|
-
const
|
|
14242
|
-
let isShort = false;
|
|
14272
|
+
const data = [];
|
|
14243
14273
|
let remaining = pushCount;
|
|
14274
|
+
let isShort = false;
|
|
14275
|
+
const runValues = [];
|
|
14244
14276
|
function flush() {
|
|
14245
|
-
if (
|
|
14277
|
+
if (runValues.length === 0) {
|
|
14246
14278
|
return;
|
|
14247
14279
|
}
|
|
14248
|
-
const count =
|
|
14280
|
+
const count = runValues.length;
|
|
14249
14281
|
if (isShort) {
|
|
14250
14282
|
if (count < 8) {
|
|
14251
14283
|
sOut.writeU8(PUSHW + (count - 1));
|
|
@@ -14253,7 +14285,7 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14253
14285
|
sOut.writeU8(NPUSHW);
|
|
14254
14286
|
sOut.writeU8(count);
|
|
14255
14287
|
}
|
|
14256
|
-
for (const v of
|
|
14288
|
+
for (const v of runValues) {
|
|
14257
14289
|
sOut.writeS16(v);
|
|
14258
14290
|
}
|
|
14259
14291
|
} else {
|
|
@@ -14263,54 +14295,50 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14263
14295
|
sOut.writeU8(NPUSHB);
|
|
14264
14296
|
sOut.writeU8(count);
|
|
14265
14297
|
}
|
|
14266
|
-
for (const v of
|
|
14298
|
+
for (const v of runValues) {
|
|
14267
14299
|
sOut.writeU8(v & 255);
|
|
14268
14300
|
}
|
|
14269
14301
|
}
|
|
14270
|
-
|
|
14302
|
+
runValues.length = 0;
|
|
14271
14303
|
}
|
|
14272
|
-
function
|
|
14304
|
+
function put(v) {
|
|
14305
|
+
data.push(v);
|
|
14273
14306
|
const needsShort = v < 0 || v > 255;
|
|
14274
|
-
if (
|
|
14307
|
+
if (runValues.length > 0 && needsShort !== isShort) {
|
|
14275
14308
|
flush();
|
|
14276
14309
|
}
|
|
14277
|
-
if (
|
|
14310
|
+
if (runValues.length === 0) {
|
|
14278
14311
|
isShort = needsShort;
|
|
14279
14312
|
}
|
|
14280
|
-
|
|
14281
|
-
if (
|
|
14313
|
+
runValues.push(v);
|
|
14314
|
+
if (runValues.length >= 255) {
|
|
14282
14315
|
flush();
|
|
14283
14316
|
}
|
|
14284
14317
|
}
|
|
14285
14318
|
while (remaining > 0) {
|
|
14286
|
-
const code = sIn.
|
|
14287
|
-
if (code === 251 && remaining >=
|
|
14288
|
-
|
|
14289
|
-
const
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
14299
|
-
const b = read255Short(sIn);
|
|
14319
|
+
const code = sIn.peekU8();
|
|
14320
|
+
if (code === 251 && remaining >= 3 && data.length >= 2) {
|
|
14321
|
+
sIn.readU8();
|
|
14322
|
+
const prev = data[data.length - 2];
|
|
14323
|
+
put(prev);
|
|
14324
|
+
const val = read255Short(sIn);
|
|
14325
|
+
put(val);
|
|
14326
|
+
put(prev);
|
|
14327
|
+
remaining -= 3;
|
|
14328
|
+
} else if (code === 252 && remaining >= 5 && data.length >= 2) {
|
|
14329
|
+
sIn.readU8();
|
|
14330
|
+
const prev = data[data.length - 2];
|
|
14331
|
+
put(prev);
|
|
14300
14332
|
const c = read255Short(sIn);
|
|
14333
|
+
put(c);
|
|
14334
|
+
put(prev);
|
|
14301
14335
|
const d = read255Short(sIn);
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
addValue(c);
|
|
14306
|
-
addValue(a);
|
|
14307
|
-
addValue(d);
|
|
14308
|
-
addValue(a);
|
|
14309
|
-
remaining -= 7;
|
|
14336
|
+
put(d);
|
|
14337
|
+
put(prev);
|
|
14338
|
+
remaining -= 5;
|
|
14310
14339
|
} else {
|
|
14311
|
-
sIn.seekRelative(-1);
|
|
14312
14340
|
const v = read255Short(sIn);
|
|
14313
|
-
|
|
14341
|
+
put(v);
|
|
14314
14342
|
remaining -= 1;
|
|
14315
14343
|
}
|
|
14316
14344
|
}
|
|
@@ -14338,6 +14366,9 @@ function makeGlyphFlags(x, y, onCurve, firstTime) {
|
|
|
14338
14366
|
return flags;
|
|
14339
14367
|
}
|
|
14340
14368
|
function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX, maxY) {
|
|
14369
|
+
if (numContours === 0) {
|
|
14370
|
+
return;
|
|
14371
|
+
}
|
|
14341
14372
|
const sGlyph = streams[0];
|
|
14342
14373
|
out.writeS16(numContours);
|
|
14343
14374
|
const bboxPos = out.pos;
|
|
@@ -14358,13 +14389,12 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14358
14389
|
}
|
|
14359
14390
|
let totalPoints = 0;
|
|
14360
14391
|
for (let c = 0; c < numContours; c++) {
|
|
14361
|
-
const pointsInContour = read255UShort(sGlyph);
|
|
14362
|
-
totalPoints += pointsInContour;
|
|
14363
14392
|
if (c === 0) {
|
|
14364
|
-
|
|
14365
|
-
} else {
|
|
14366
|
-
out.writeU16(totalPoints - 1);
|
|
14393
|
+
totalPoints = 1;
|
|
14367
14394
|
}
|
|
14395
|
+
const pointsInContour = read255UShort(sGlyph);
|
|
14396
|
+
totalPoints += pointsInContour;
|
|
14397
|
+
out.writeU16(totalPoints - 1);
|
|
14368
14398
|
}
|
|
14369
14399
|
const flagBytes = new Uint8Array(totalPoints);
|
|
14370
14400
|
for (let i = 0; i < totalPoints; i++) {
|
|
@@ -14377,7 +14407,7 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14377
14407
|
let cumulativeY = 0;
|
|
14378
14408
|
for (let i = 0; i < totalPoints; i++) {
|
|
14379
14409
|
const flag = flagBytes[i];
|
|
14380
|
-
onCurve[i] = flag
|
|
14410
|
+
onCurve[i] = flag & 128 ? 0 : 1;
|
|
14381
14411
|
const enc = TRIPLET_ENCODINGS[flag & 127];
|
|
14382
14412
|
const extraBytes = enc.byteCount - 1;
|
|
14383
14413
|
const subBuf = new Uint8Array(extraBytes);
|
|
@@ -14716,7 +14746,10 @@ var AHuff = class _AHuff {
|
|
|
14716
14746
|
this.bio = bio;
|
|
14717
14747
|
this.range = range;
|
|
14718
14748
|
this.bitCount = bitsUsed(range - 1);
|
|
14719
|
-
this.bitCount2 =
|
|
14749
|
+
this.bitCount2 = 0;
|
|
14750
|
+
if (range > 256 && range < 512) {
|
|
14751
|
+
this.bitCount2 = bitsUsed(range - 256 - 1) + 1;
|
|
14752
|
+
}
|
|
14720
14753
|
const treeSize = 2 * range;
|
|
14721
14754
|
this.tree = Array.from({ length: treeSize });
|
|
14722
14755
|
for (let i = 0; i < treeSize; i++) {
|
|
@@ -14724,6 +14757,7 @@ var AHuff = class _AHuff {
|
|
|
14724
14757
|
}
|
|
14725
14758
|
for (let i = 2; i < treeSize; i++) {
|
|
14726
14759
|
this.tree[i].up = i >> 1;
|
|
14760
|
+
this.tree[i].weight = 1;
|
|
14727
14761
|
}
|
|
14728
14762
|
for (let i = 1; i < range; i++) {
|
|
14729
14763
|
this.tree[i].left = 2 * i;
|
|
@@ -14733,7 +14767,8 @@ var AHuff = class _AHuff {
|
|
|
14733
14767
|
for (let i = 0; i < range; i++) {
|
|
14734
14768
|
const leafIdx = range + i;
|
|
14735
14769
|
this.tree[leafIdx].code = i;
|
|
14736
|
-
this.tree[leafIdx].
|
|
14770
|
+
this.tree[leafIdx].left = -1;
|
|
14771
|
+
this.tree[leafIdx].right = -1;
|
|
14737
14772
|
}
|
|
14738
14773
|
this.symbolIndex = Array.from({ length: range });
|
|
14739
14774
|
for (let i = 0; i < range; i++) {
|
|
@@ -14773,15 +14808,13 @@ var AHuff = class _AHuff {
|
|
|
14773
14808
|
*/
|
|
14774
14809
|
readSymbol() {
|
|
14775
14810
|
let a = _AHuff.ROOT;
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
}
|
|
14782
|
-
}
|
|
14811
|
+
let symbol;
|
|
14812
|
+
do {
|
|
14813
|
+
a = this.bio.inputBit() ? this.tree[a].right : this.tree[a].left;
|
|
14814
|
+
symbol = this.tree[a].code;
|
|
14815
|
+
} while (symbol < 0);
|
|
14783
14816
|
this.updateWeight(a);
|
|
14784
|
-
return
|
|
14817
|
+
return symbol;
|
|
14785
14818
|
}
|
|
14786
14819
|
// --------------------------------------------------------------------
|
|
14787
14820
|
// Private helpers
|
|
@@ -14805,17 +14838,19 @@ var AHuff = class _AHuff {
|
|
|
14805
14838
|
updateWeight(a) {
|
|
14806
14839
|
const tree = this.tree;
|
|
14807
14840
|
for (; a !== _AHuff.ROOT; a = tree[a].up) {
|
|
14841
|
+
const weightA = tree[a].weight;
|
|
14808
14842
|
let b = a - 1;
|
|
14809
|
-
if (
|
|
14810
|
-
|
|
14843
|
+
if (tree[b].weight === weightA) {
|
|
14844
|
+
do {
|
|
14811
14845
|
b--;
|
|
14812
|
-
}
|
|
14813
|
-
|
|
14846
|
+
} while (tree[b].weight === weightA);
|
|
14847
|
+
b++;
|
|
14848
|
+
if (b > _AHuff.ROOT) {
|
|
14814
14849
|
this.swapNodes(a, b);
|
|
14815
14850
|
a = b;
|
|
14816
14851
|
}
|
|
14817
14852
|
}
|
|
14818
|
-
tree[a].weight
|
|
14853
|
+
tree[a].weight = weightA + 1;
|
|
14819
14854
|
}
|
|
14820
14855
|
tree[_AHuff.ROOT].weight++;
|
|
14821
14856
|
}
|
|
@@ -14835,38 +14870,26 @@ var AHuff = class _AHuff {
|
|
|
14835
14870
|
*/
|
|
14836
14871
|
swapNodes(a, b) {
|
|
14837
14872
|
const tree = this.tree;
|
|
14838
|
-
const
|
|
14839
|
-
const
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
na.weight = nb.weight;
|
|
14852
|
-
nb.weight = tmp;
|
|
14853
|
-
if (na.left) {
|
|
14854
|
-
tree[na.left].up = a;
|
|
14855
|
-
}
|
|
14856
|
-
if (na.right) {
|
|
14857
|
-
tree[na.right].up = a;
|
|
14858
|
-
}
|
|
14859
|
-
if (nb.left) {
|
|
14860
|
-
tree[nb.left].up = b;
|
|
14861
|
-
}
|
|
14862
|
-
if (nb.right) {
|
|
14863
|
-
tree[nb.right].up = b;
|
|
14864
|
-
}
|
|
14865
|
-
if (na.code >= 0) {
|
|
14866
|
-
this.symbolIndex[na.code] = a;
|
|
14873
|
+
const upa = tree[a].up;
|
|
14874
|
+
const upb = tree[b].up;
|
|
14875
|
+
const tmp = tree[a];
|
|
14876
|
+
tree[a] = tree[b];
|
|
14877
|
+
tree[b] = tmp;
|
|
14878
|
+
tree[a].up = upa;
|
|
14879
|
+
tree[b].up = upb;
|
|
14880
|
+
let code = tree[a].code;
|
|
14881
|
+
if (code < 0) {
|
|
14882
|
+
tree[tree[a].left].up = a;
|
|
14883
|
+
tree[tree[a].right].up = a;
|
|
14884
|
+
} else {
|
|
14885
|
+
this.symbolIndex[code] = a;
|
|
14867
14886
|
}
|
|
14868
|
-
|
|
14869
|
-
|
|
14887
|
+
code = tree[b].code;
|
|
14888
|
+
if (code < 0) {
|
|
14889
|
+
tree[tree[b].left].up = b;
|
|
14890
|
+
tree[tree[b].right].up = b;
|
|
14891
|
+
} else {
|
|
14892
|
+
this.symbolIndex[code] = b;
|
|
14870
14893
|
}
|
|
14871
14894
|
}
|
|
14872
14895
|
/**
|
|
@@ -15245,12 +15268,12 @@ function unpackMtx(data, size) {
|
|
|
15245
15268
|
const offset2 = data[4] << 16 | data[5] << 8 | data[6];
|
|
15246
15269
|
const offset3 = data[7] << 16 | data[8] << 8 | data[9];
|
|
15247
15270
|
const offsets = [10, offset2, offset3];
|
|
15248
|
-
const
|
|
15271
|
+
const blockSizes = [offset2 - 10, offset3 - offset2, size - offset3];
|
|
15249
15272
|
const streams = [];
|
|
15250
15273
|
const decompressedSizes = [];
|
|
15251
15274
|
for (let i = 0; i < 3; i++) {
|
|
15252
15275
|
const block = data.subarray(offsets[i]);
|
|
15253
|
-
const decompressed = lzcompDecompress(block,
|
|
15276
|
+
const decompressed = lzcompDecompress(block, blockSizes[i], versionMagic);
|
|
15254
15277
|
streams.push(decompressed);
|
|
15255
15278
|
decompressedSizes.push(decompressed.length);
|
|
15256
15279
|
}
|
|
@@ -15342,6 +15365,15 @@ function parseEotHeader(data) {
|
|
|
15342
15365
|
const fullName = readNameString();
|
|
15343
15366
|
if (version >= 131074) {
|
|
15344
15367
|
readNameString();
|
|
15368
|
+
offset += 8;
|
|
15369
|
+
if (offset + 4 <= data.length) {
|
|
15370
|
+
const signatureSize = readUint16LE(data, offset + 2);
|
|
15371
|
+
offset += 4 + signatureSize;
|
|
15372
|
+
}
|
|
15373
|
+
if (offset + 8 <= data.length) {
|
|
15374
|
+
const eudcFontSize = readUint32LE(data, offset + 4);
|
|
15375
|
+
offset += 8 + eudcFontSize;
|
|
15376
|
+
}
|
|
15345
15377
|
}
|
|
15346
15378
|
return {
|
|
15347
15379
|
eotSize,
|
|
@@ -23440,12 +23472,6 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23440
23472
|
if (textStyle?.rtl !== void 0) {
|
|
23441
23473
|
paragraphProps["@_rtl"] = textStyle.rtl ? "1" : "0";
|
|
23442
23474
|
}
|
|
23443
|
-
if (spacing.spacingBefore) {
|
|
23444
|
-
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23445
|
-
}
|
|
23446
|
-
if (spacing.spacingAfter) {
|
|
23447
|
-
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23448
|
-
}
|
|
23449
23475
|
if (spacing.lineSpacing) {
|
|
23450
23476
|
paragraphProps["a:lnSpc"] = spacing.lineSpacing;
|
|
23451
23477
|
} else if (typeof spacing.lineSpacingExactPt === "number" && Number.isFinite(spacing.lineSpacingExactPt)) {
|
|
@@ -23455,6 +23481,12 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23455
23481
|
}
|
|
23456
23482
|
};
|
|
23457
23483
|
}
|
|
23484
|
+
if (spacing.spacingBefore) {
|
|
23485
|
+
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23486
|
+
}
|
|
23487
|
+
if (spacing.spacingAfter) {
|
|
23488
|
+
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23489
|
+
}
|
|
23458
23490
|
if (typeof textStyle?.paragraphMarginLeft === "number" && Number.isFinite(textStyle.paragraphMarginLeft)) {
|
|
23459
23491
|
paragraphProps["@_marL"] = String(Math.round(textStyle.paragraphMarginLeft * EMU_PER_PX4));
|
|
23460
23492
|
}
|
|
@@ -23505,9 +23537,10 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23505
23537
|
paragraphProps["a:buNone"] = {};
|
|
23506
23538
|
return;
|
|
23507
23539
|
}
|
|
23508
|
-
if (bulletInfo.
|
|
23509
|
-
|
|
23510
|
-
|
|
23540
|
+
if (bulletInfo.color) {
|
|
23541
|
+
const colorHex = bulletInfo.color.replace("#", "");
|
|
23542
|
+
paragraphProps["a:buClr"] = {
|
|
23543
|
+
"a:srgbClr": { "@_val": colorHex }
|
|
23511
23544
|
};
|
|
23512
23545
|
}
|
|
23513
23546
|
if (bulletInfo.sizePercent !== void 0) {
|
|
@@ -23520,10 +23553,9 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23520
23553
|
"@_val": String(Math.round(bulletInfo.sizePts * 100))
|
|
23521
23554
|
};
|
|
23522
23555
|
}
|
|
23523
|
-
if (bulletInfo.
|
|
23524
|
-
|
|
23525
|
-
|
|
23526
|
-
"a:srgbClr": { "@_val": colorHex }
|
|
23556
|
+
if (bulletInfo.fontFamily) {
|
|
23557
|
+
paragraphProps["a:buFont"] = {
|
|
23558
|
+
"@_typeface": bulletInfo.fontFamily
|
|
23527
23559
|
};
|
|
23528
23560
|
}
|
|
23529
23561
|
if (bulletInfo.char) {
|
|
@@ -23546,9 +23578,8 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23546
23578
|
}
|
|
23547
23579
|
function assembleParagraphXml(runs, paragraphProps) {
|
|
23548
23580
|
const paragraph = {
|
|
23549
|
-
"a:
|
|
23581
|
+
"a:pPr": paragraphProps
|
|
23550
23582
|
};
|
|
23551
|
-
paragraph["a:pPr"] = paragraphProps;
|
|
23552
23583
|
const regularRuns = runs.filter((r) => !r.__isField);
|
|
23553
23584
|
const fieldRuns = runs.filter((r) => r.__isField).map((r) => {
|
|
23554
23585
|
const { __isField, ...rest } = r;
|
|
@@ -23567,6 +23598,7 @@ function assembleParagraphXml(runs, paragraphProps) {
|
|
|
23567
23598
|
if (cleanRegularRuns.length === 0 && fieldRuns.length === 0) {
|
|
23568
23599
|
paragraph["a:r"] = runs.length > 1 ? runs : runs[0];
|
|
23569
23600
|
}
|
|
23601
|
+
paragraph["a:endParaRPr"] = { "@_lang": "en-US" };
|
|
23570
23602
|
return paragraph;
|
|
23571
23603
|
}
|
|
23572
23604
|
function computeUniformSegmentOverrides(textStyle, textSegments) {
|
|
@@ -26405,9 +26437,6 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26405
26437
|
if (style.textCaps && style.textCaps !== "none") {
|
|
26406
26438
|
runProps["@_cap"] = style.textCaps;
|
|
26407
26439
|
}
|
|
26408
|
-
if (style.rtl !== void 0) {
|
|
26409
|
-
runProps["@_rtl"] = style.rtl ? "1" : "0";
|
|
26410
|
-
}
|
|
26411
26440
|
if (style.kumimoji !== void 0) {
|
|
26412
26441
|
runProps["@_kumimoji"] = style.kumimoji ? "1" : "0";
|
|
26413
26442
|
}
|
|
@@ -26429,17 +26458,19 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26429
26458
|
if (style.bookmark) {
|
|
26430
26459
|
runProps["@_bmk"] = style.bookmark;
|
|
26431
26460
|
}
|
|
26432
|
-
if (style.
|
|
26433
|
-
|
|
26434
|
-
|
|
26435
|
-
"@
|
|
26436
|
-
}
|
|
26437
|
-
|
|
26438
|
-
"
|
|
26439
|
-
|
|
26440
|
-
|
|
26441
|
-
|
|
26442
|
-
|
|
26461
|
+
if (style.textOutlineWidth || style.textOutlineColor) {
|
|
26462
|
+
const lnObj = {};
|
|
26463
|
+
if (typeof style.textOutlineWidth === "number" && style.textOutlineWidth > 0) {
|
|
26464
|
+
lnObj["@_w"] = String(Math.round(style.textOutlineWidth * _PptxHandlerRuntime.EMU_PER_PX));
|
|
26465
|
+
}
|
|
26466
|
+
if (style.textOutlineColor) {
|
|
26467
|
+
lnObj["a:solidFill"] = {
|
|
26468
|
+
"a:srgbClr": {
|
|
26469
|
+
"@_val": style.textOutlineColor.replace("#", "")
|
|
26470
|
+
}
|
|
26471
|
+
};
|
|
26472
|
+
}
|
|
26473
|
+
runProps["a:ln"] = lnObj;
|
|
26443
26474
|
}
|
|
26444
26475
|
if (style.color) {
|
|
26445
26476
|
runProps["a:solidFill"] = {
|
|
@@ -26447,15 +26478,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26447
26478
|
"@_val": style.color.replace("#", "")
|
|
26448
26479
|
}
|
|
26449
26480
|
};
|
|
26450
|
-
}
|
|
26451
|
-
if (style.highlightColor) {
|
|
26452
|
-
runProps["a:highlight"] = {
|
|
26453
|
-
"a:srgbClr": {
|
|
26454
|
-
"@_val": style.highlightColor.replace("#", "")
|
|
26455
|
-
}
|
|
26456
|
-
};
|
|
26457
|
-
}
|
|
26458
|
-
if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26481
|
+
} else if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26459
26482
|
const gradStops = style.textFillGradientStops.filter((stop) => Boolean(stop?.color)).map((stop) => {
|
|
26460
26483
|
const rawPos = (stop.position ?? 0) / 100;
|
|
26461
26484
|
const posVal = Math.round(Math.max(0, Math.min(1, rawPos)) * 1e5);
|
|
@@ -26488,8 +26511,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26488
26511
|
}
|
|
26489
26512
|
runProps["a:gradFill"] = gradFillXml;
|
|
26490
26513
|
}
|
|
26491
|
-
}
|
|
26492
|
-
if (style.textFillPattern) {
|
|
26514
|
+
} else if (style.textFillPattern) {
|
|
26493
26515
|
const pattFill = { "@_prst": style.textFillPattern };
|
|
26494
26516
|
if (style.textFillPatternForeground) {
|
|
26495
26517
|
pattFill["a:fgClr"] = {
|
|
@@ -26507,6 +26529,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26507
26529
|
}
|
|
26508
26530
|
runProps["a:pattFill"] = pattFill;
|
|
26509
26531
|
}
|
|
26532
|
+
const textEffectLst = buildTextRunEffectListXml(style);
|
|
26533
|
+
if (textEffectLst) {
|
|
26534
|
+
runProps["a:effectLst"] = textEffectLst;
|
|
26535
|
+
}
|
|
26536
|
+
if (style.highlightColor) {
|
|
26537
|
+
runProps["a:highlight"] = {
|
|
26538
|
+
"a:srgbClr": {
|
|
26539
|
+
"@_val": style.highlightColor.replace("#", "")
|
|
26540
|
+
}
|
|
26541
|
+
};
|
|
26542
|
+
}
|
|
26510
26543
|
if (style.underline && style.underlineColor) {
|
|
26511
26544
|
runProps["a:uFill"] = {
|
|
26512
26545
|
"a:solidFill": {
|
|
@@ -26516,23 +26549,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26516
26549
|
}
|
|
26517
26550
|
};
|
|
26518
26551
|
}
|
|
26519
|
-
if (style.
|
|
26520
|
-
|
|
26521
|
-
|
|
26522
|
-
|
|
26523
|
-
}
|
|
26524
|
-
|
|
26525
|
-
|
|
26526
|
-
|
|
26527
|
-
"@_val": style.textOutlineColor.replace("#", "")
|
|
26528
|
-
}
|
|
26529
|
-
};
|
|
26530
|
-
}
|
|
26531
|
-
runProps["a:ln"] = lnObj;
|
|
26552
|
+
if (style.fontFamily) {
|
|
26553
|
+
runProps["a:latin"] = { "@_typeface": style.fontFamily };
|
|
26554
|
+
runProps["a:ea"] = {
|
|
26555
|
+
"@_typeface": style.eastAsiaFont || style.fontFamily
|
|
26556
|
+
};
|
|
26557
|
+
runProps["a:cs"] = {
|
|
26558
|
+
"@_typeface": style.complexScriptFont || style.fontFamily
|
|
26559
|
+
};
|
|
26532
26560
|
}
|
|
26533
|
-
|
|
26534
|
-
|
|
26535
|
-
runProps["a:effectLst"] = textEffectLst;
|
|
26561
|
+
if (style.symbolFont) {
|
|
26562
|
+
runProps["a:sym"] = { "@_typeface": style.symbolFont };
|
|
26536
26563
|
}
|
|
26537
26564
|
if (style.hyperlink && resolveHyperlinkRelationshipId) {
|
|
26538
26565
|
const hyperlinkTarget = String(style.hyperlink).trim();
|
|
@@ -29453,32 +29480,58 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
29453
29480
|
};
|
|
29454
29481
|
for (const variant of variants) {
|
|
29455
29482
|
const fontData = variant.rawFontData;
|
|
29456
|
-
const
|
|
29457
|
-
const
|
|
29458
|
-
const
|
|
29459
|
-
|
|
29460
|
-
|
|
29461
|
-
|
|
29483
|
+
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
29484
|
+
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
29485
|
+
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
29486
|
+
let guid;
|
|
29487
|
+
let fontPartPath;
|
|
29488
|
+
let relativeTarget;
|
|
29462
29489
|
let rId;
|
|
29463
|
-
|
|
29464
|
-
|
|
29465
|
-
)
|
|
29466
|
-
|
|
29467
|
-
|
|
29490
|
+
let bytesToWrite;
|
|
29491
|
+
let fontKeyForXml;
|
|
29492
|
+
if (reuseObfuscation) {
|
|
29493
|
+
guid = variant.fontGuid;
|
|
29494
|
+
fontPartPath = variant.partPath;
|
|
29495
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29496
|
+
rId = variant.originalRId;
|
|
29497
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29498
|
+
fontKeyForXml = `{${guid}}`;
|
|
29499
|
+
} else if (reuseVerbatim) {
|
|
29500
|
+
guid = "";
|
|
29501
|
+
fontPartPath = variant.partPath;
|
|
29502
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29503
|
+
rId = variant.originalRId;
|
|
29504
|
+
bytesToWrite = variant.originalPartBytes;
|
|
29505
|
+
fontKeyForXml = void 0;
|
|
29468
29506
|
} else {
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29507
|
+
guid = variant.fontGuid ?? generateFontGuid();
|
|
29508
|
+
const fileName = `{${guid}}.fntdata`;
|
|
29509
|
+
fontPartPath = `ppt/fonts/${fileName}`;
|
|
29510
|
+
relativeTarget = `fonts/${fileName}`;
|
|
29511
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29512
|
+
fontKeyForXml = `{${guid}}`;
|
|
29513
|
+
const existingRel = relationships.find(
|
|
29514
|
+
(r) => String(r?.["@_Target"] || "") === relativeTarget
|
|
29515
|
+
);
|
|
29516
|
+
if (existingRel) {
|
|
29517
|
+
rId = String(existingRel["@_Id"]);
|
|
29518
|
+
} else {
|
|
29519
|
+
maxId++;
|
|
29520
|
+
rId = `rId${maxId}`;
|
|
29521
|
+
relationships.push({
|
|
29522
|
+
"@_Id": rId,
|
|
29523
|
+
"@_Type": _PptxHandlerRuntime.FONT_REL_TYPE,
|
|
29524
|
+
"@_Target": relativeTarget
|
|
29525
|
+
});
|
|
29526
|
+
}
|
|
29476
29527
|
}
|
|
29528
|
+
this.zip.file(fontPartPath, bytesToWrite);
|
|
29477
29529
|
const variantKey = variant.bold && variant.italic ? "p:boldItalic" : variant.bold ? "p:bold" : variant.italic ? "p:italic" : "p:regular";
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
"@_fontKey"
|
|
29481
|
-
}
|
|
29530
|
+
const variantEntry = { "@_r:id": rId };
|
|
29531
|
+
if (fontKeyForXml) {
|
|
29532
|
+
variantEntry["@_fontKey"] = fontKeyForXml;
|
|
29533
|
+
}
|
|
29534
|
+
entry[variantKey] = variantEntry;
|
|
29482
29535
|
}
|
|
29483
29536
|
embeddedFontEntries.push(entry);
|
|
29484
29537
|
}
|
|
@@ -29622,54 +29675,59 @@ var PptxHandlerRuntime25 = class extends PptxHandlerRuntime24 {
|
|
|
29622
29675
|
}
|
|
29623
29676
|
};
|
|
29624
29677
|
const root = propsData["p:presentationPr"] || {};
|
|
29625
|
-
const
|
|
29626
|
-
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
|
|
29630
|
-
showPr["p:browse"] = {};
|
|
29631
|
-
} else if (properties.showType === "kiosk") {
|
|
29632
|
-
const kioskNode = {};
|
|
29633
|
-
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29634
|
-
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29678
|
+
const existingShowPr = root["p:showPr"] || {};
|
|
29679
|
+
const rebuiltShowPr = {};
|
|
29680
|
+
for (const key of Object.keys(existingShowPr)) {
|
|
29681
|
+
if (key.startsWith("@_")) {
|
|
29682
|
+
rebuiltShowPr[key] = existingShowPr[key];
|
|
29635
29683
|
}
|
|
29636
|
-
showPr["p:kiosk"] = kioskNode;
|
|
29637
|
-
} else {
|
|
29638
|
-
showPr["p:present"] = {};
|
|
29639
29684
|
}
|
|
29640
29685
|
if (properties.loopContinuously !== void 0) {
|
|
29641
|
-
|
|
29686
|
+
rebuiltShowPr["@_loop"] = properties.loopContinuously ? "1" : "0";
|
|
29642
29687
|
}
|
|
29643
29688
|
if (properties.showWithNarration !== void 0) {
|
|
29644
|
-
|
|
29689
|
+
rebuiltShowPr["@_showNarration"] = properties.showWithNarration ? "1" : "0";
|
|
29645
29690
|
}
|
|
29646
29691
|
if (properties.showWithAnimation !== void 0) {
|
|
29647
|
-
|
|
29692
|
+
rebuiltShowPr["@_showAnimation"] = properties.showWithAnimation ? "1" : "0";
|
|
29648
29693
|
}
|
|
29649
29694
|
if (properties.advanceMode !== void 0) {
|
|
29650
|
-
|
|
29695
|
+
rebuiltShowPr["@_useTimings"] = properties.advanceMode === "useTimings" ? "1" : "0";
|
|
29651
29696
|
}
|
|
29652
|
-
if (properties.
|
|
29653
|
-
|
|
29654
|
-
|
|
29655
|
-
};
|
|
29697
|
+
if (properties.showType === "browsed") {
|
|
29698
|
+
rebuiltShowPr["p:browse"] = {};
|
|
29699
|
+
} else if (properties.showType === "kiosk") {
|
|
29700
|
+
const kioskNode = {};
|
|
29701
|
+
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29702
|
+
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29703
|
+
}
|
|
29704
|
+
rebuiltShowPr["p:kiosk"] = kioskNode;
|
|
29705
|
+
} else {
|
|
29706
|
+
rebuiltShowPr["p:present"] = {};
|
|
29656
29707
|
}
|
|
29657
|
-
delete showPr["p:sldAll"];
|
|
29658
|
-
delete showPr["p:sldRg"];
|
|
29659
|
-
delete showPr["p:custShow"];
|
|
29660
29708
|
if (properties.showSlidesMode === "range") {
|
|
29661
|
-
|
|
29709
|
+
rebuiltShowPr["p:sldRg"] = {
|
|
29662
29710
|
"@_st": String(properties.showSlidesFrom ?? 1),
|
|
29663
29711
|
"@_end": String(properties.showSlidesTo ?? 1)
|
|
29664
29712
|
};
|
|
29665
29713
|
} else if (properties.showSlidesMode === "customShow" && properties.showSlidesCustomShowId) {
|
|
29666
|
-
|
|
29714
|
+
rebuiltShowPr["p:custShow"] = {
|
|
29667
29715
|
"@_id": properties.showSlidesCustomShowId
|
|
29668
29716
|
};
|
|
29669
29717
|
} else {
|
|
29670
|
-
|
|
29718
|
+
rebuiltShowPr["p:sldAll"] = {};
|
|
29671
29719
|
}
|
|
29672
|
-
|
|
29720
|
+
if (properties.penColor) {
|
|
29721
|
+
rebuiltShowPr["p:penClr"] = {
|
|
29722
|
+
"a:srgbClr": { "@_val": properties.penColor.replace("#", "") }
|
|
29723
|
+
};
|
|
29724
|
+
} else if (existingShowPr["p:penClr"] !== void 0) {
|
|
29725
|
+
rebuiltShowPr["p:penClr"] = existingShowPr["p:penClr"];
|
|
29726
|
+
}
|
|
29727
|
+
if (existingShowPr["p:extLst"] !== void 0) {
|
|
29728
|
+
rebuiltShowPr["p:extLst"] = existingShowPr["p:extLst"];
|
|
29729
|
+
}
|
|
29730
|
+
root["p:showPr"] = rebuiltShowPr;
|
|
29673
29731
|
if (properties.printFrameSlides !== void 0 || properties.printSlidesPerPage !== void 0 || properties.printColorMode !== void 0) {
|
|
29674
29732
|
const prnPr = root["p:prnPr"] || {};
|
|
29675
29733
|
if (properties.printFrameSlides !== void 0) {
|
|
@@ -30800,7 +30858,12 @@ var PptxHandlerRuntime31 = class extends PptxHandlerRuntime30 {
|
|
|
30800
30858
|
shape = this.createPictureXml(el, relationshipId);
|
|
30801
30859
|
}
|
|
30802
30860
|
if (targetImagePath) {
|
|
30803
|
-
|
|
30861
|
+
const targetExt = targetImagePath.toLowerCase().match(/\.([^./\\]+)$/)?.[1];
|
|
30862
|
+
const parsedExt = parsedImage.extension.toLowerCase();
|
|
30863
|
+
const extensionMismatch = targetExt !== void 0 && targetExt !== parsedExt && !(targetExt === "jpg" && parsedExt === "jpeg") && !(targetExt === "jpeg" && parsedExt === "jpg");
|
|
30864
|
+
if (!extensionMismatch) {
|
|
30865
|
+
this.zip.file(targetImagePath, parsedImage.bytes);
|
|
30866
|
+
}
|
|
30804
30867
|
}
|
|
30805
30868
|
} else {
|
|
30806
30869
|
this.compatibilityService.reportWarning({
|
|
@@ -31205,6 +31268,7 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31205
31268
|
);
|
|
31206
31269
|
} else {
|
|
31207
31270
|
this.zip.remove("ppt/commentAuthors.xml");
|
|
31271
|
+
await this.stripPresentationCommentAuthorsRelationship();
|
|
31208
31272
|
}
|
|
31209
31273
|
const contentTypesXmlAfterComments = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
31210
31274
|
if (contentTypesXmlAfterComments) {
|
|
@@ -31278,8 +31342,39 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31278
31342
|
if (effectiveConformance === "strict") {
|
|
31279
31343
|
await this.convertZipToStrictConformance();
|
|
31280
31344
|
}
|
|
31345
|
+
for (const name of Object.keys(this.zip.files)) {
|
|
31346
|
+
if (this.zip.files[name].dir) {
|
|
31347
|
+
delete this.zip.files[name];
|
|
31348
|
+
}
|
|
31349
|
+
}
|
|
31281
31350
|
return await this.zip.generateAsync({ type: "uint8array" });
|
|
31282
31351
|
}
|
|
31352
|
+
/**
|
|
31353
|
+
* Remove any Relationship in presentation.xml.rels whose Type matches either
|
|
31354
|
+
* the Transitional or Strict commentAuthors relationship URI.
|
|
31355
|
+
*/
|
|
31356
|
+
async stripPresentationCommentAuthorsRelationship() {
|
|
31357
|
+
const relsPath = "ppt/_rels/presentation.xml.rels";
|
|
31358
|
+
const relsXml = await this.zip.file(relsPath)?.async("string");
|
|
31359
|
+
if (!relsXml) {
|
|
31360
|
+
return;
|
|
31361
|
+
}
|
|
31362
|
+
const relsData = this.parser.parse(relsXml);
|
|
31363
|
+
const root = relsData["Relationships"];
|
|
31364
|
+
if (!root) {
|
|
31365
|
+
return;
|
|
31366
|
+
}
|
|
31367
|
+
const relationships = this.ensureArray(root["Relationship"]);
|
|
31368
|
+
const filtered = relationships.filter((relationship) => {
|
|
31369
|
+
const type = String(relationship?.["@_Type"] ?? "");
|
|
31370
|
+
return type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" && type !== "http://purl.oclc.org/ooxml/officeDocument/relationships/commentAuthors";
|
|
31371
|
+
});
|
|
31372
|
+
if (filtered.length === relationships.length) {
|
|
31373
|
+
return;
|
|
31374
|
+
}
|
|
31375
|
+
root["Relationship"] = filtered;
|
|
31376
|
+
this.zip.file(relsPath, this.builder.build(relsData));
|
|
31377
|
+
}
|
|
31283
31378
|
};
|
|
31284
31379
|
|
|
31285
31380
|
// src/core/core/runtime/PptxHandlerRuntimeElementParsing.ts
|
|
@@ -33264,7 +33359,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33264
33359
|
}
|
|
33265
33360
|
const shapeStyle = this.extractShapeStyle(effectiveSpPr, styleNode);
|
|
33266
33361
|
const hasText = text.trim().length > 0;
|
|
33267
|
-
const isPlainRect = !prstGeom || prstGeom === "rect";
|
|
33362
|
+
const isPlainRect = (!prstGeom || prstGeom === "rect") && !custGeom;
|
|
33268
33363
|
const hasVisibleStyle = shapeStyle.fillColor && shapeStyle.fillColor !== "transparent" || (shapeStyle.strokeWidth || 0) > 0;
|
|
33269
33364
|
let type = "shape";
|
|
33270
33365
|
if (hasText && isPlainRect && !hasVisibleStyle) {
|
|
@@ -33276,6 +33371,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33276
33371
|
slideRelationshipMap,
|
|
33277
33372
|
this.orderedSlidePaths
|
|
33278
33373
|
);
|
|
33374
|
+
const elementName = cNvPrForActions?.["@_name"] ? String(cNvPrForActions["@_name"]).trim() : void 0;
|
|
33279
33375
|
const cNvSpPr = shape?.["p:nvSpPr"]?.["p:cNvSpPr"];
|
|
33280
33376
|
const spLocksNode = cNvSpPr?.["a:spLocks"];
|
|
33281
33377
|
const slideLocks = this.parseShapeLocks(spLocksNode);
|
|
@@ -33286,6 +33382,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33286
33382
|
const promptText = !hasText && phDefaults?.promptText ? phDefaults.promptText : void 0;
|
|
33287
33383
|
const commonProps = {
|
|
33288
33384
|
id,
|
|
33385
|
+
name: elementName || void 0,
|
|
33289
33386
|
x,
|
|
33290
33387
|
y,
|
|
33291
33388
|
width,
|
|
@@ -33522,12 +33619,14 @@ var PptxHandlerRuntime45 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33522
33619
|
picSlideRels,
|
|
33523
33620
|
this.orderedSlidePaths
|
|
33524
33621
|
);
|
|
33622
|
+
const picElementName = picCNvPr?.["@_name"] ? String(picCNvPr["@_name"]).trim() : void 0;
|
|
33525
33623
|
const picCNvPicPr = pic?.["p:nvPicPr"]?.["p:cNvPicPr"];
|
|
33526
33624
|
const picLocks = this.parseShapeLocks(
|
|
33527
33625
|
picCNvPicPr?.["a:picLocks"] ?? picCNvPicPr?.["a:spLocks"]
|
|
33528
33626
|
);
|
|
33529
33627
|
return {
|
|
33530
33628
|
id,
|
|
33629
|
+
name: picElementName || void 0,
|
|
33531
33630
|
type: "picture",
|
|
33532
33631
|
x,
|
|
33533
33632
|
y,
|
|
@@ -34074,9 +34173,11 @@ var PptxHandlerRuntime47 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
34074
34173
|
grpSlideRels,
|
|
34075
34174
|
this.orderedSlidePaths
|
|
34076
34175
|
);
|
|
34176
|
+
const grpElementName = grpCNvPr?.["@_name"] ? String(grpCNvPr["@_name"]).trim() : void 0;
|
|
34077
34177
|
const groupElement = {
|
|
34078
34178
|
type: "group",
|
|
34079
34179
|
id: baseId,
|
|
34180
|
+
name: grpElementName || void 0,
|
|
34080
34181
|
x: parentX,
|
|
34081
34182
|
y: parentY,
|
|
34082
34183
|
width: parentW || Math.max(...children.map((c) => c.x + c.width)),
|
|
@@ -37956,6 +38057,7 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
37956
38057
|
if (!fontBinary || fontBinary.length === 0) {
|
|
37957
38058
|
return null;
|
|
37958
38059
|
}
|
|
38060
|
+
const originalPartBytes = new Uint8Array(fontBinary);
|
|
37959
38061
|
let fontData;
|
|
37960
38062
|
let resolvedGuid;
|
|
37961
38063
|
if (isEotFormat(fontBinary)) {
|
|
@@ -38009,7 +38111,9 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
38009
38111
|
format,
|
|
38010
38112
|
rawFontData: fontData,
|
|
38011
38113
|
partPath: fontPath,
|
|
38012
|
-
fontGuid: resolvedGuid
|
|
38114
|
+
fontGuid: resolvedGuid,
|
|
38115
|
+
originalRId: rId,
|
|
38116
|
+
originalPartBytes
|
|
38013
38117
|
};
|
|
38014
38118
|
} catch {
|
|
38015
38119
|
return null;
|