pptx-react-viewer 1.1.1 → 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
|
@@ -6255,33 +6255,10 @@ var PptxPresentationSaveBuilder = class {
|
|
|
6255
6255
|
init.presentationData["p:presentation"] = presentation;
|
|
6256
6256
|
return init.presentationData;
|
|
6257
6257
|
}
|
|
6258
|
-
applyHeaderFooter(presentation,
|
|
6259
|
-
if (
|
|
6260
|
-
|
|
6261
|
-
}
|
|
6262
|
-
const hf = presentation["p:hf"] || {};
|
|
6263
|
-
if (headerFooter.hasHeader !== void 0) {
|
|
6264
|
-
hf["@_hdr"] = headerFooter.hasHeader ? "1" : "0";
|
|
6265
|
-
}
|
|
6266
|
-
if (headerFooter.hasFooter !== void 0) {
|
|
6267
|
-
hf["@_ftr"] = headerFooter.hasFooter ? "1" : "0";
|
|
6268
|
-
}
|
|
6269
|
-
if (headerFooter.hasDateTime !== void 0) {
|
|
6270
|
-
hf["@_dt"] = headerFooter.hasDateTime ? "1" : "0";
|
|
6271
|
-
}
|
|
6272
|
-
if (headerFooter.hasSlideNumber !== void 0) {
|
|
6273
|
-
hf["@_sldNum"] = headerFooter.hasSlideNumber ? "1" : "0";
|
|
6274
|
-
}
|
|
6275
|
-
if (headerFooter.footerText !== void 0) {
|
|
6276
|
-
hf["@_ftrText"] = headerFooter.footerText;
|
|
6277
|
-
}
|
|
6278
|
-
if (headerFooter.dateTimeText !== void 0) {
|
|
6279
|
-
hf["@_dtText"] = headerFooter.dateTimeText;
|
|
6258
|
+
applyHeaderFooter(presentation, _headerFooter) {
|
|
6259
|
+
if (presentation["p:hf"] !== void 0) {
|
|
6260
|
+
delete presentation["p:hf"];
|
|
6280
6261
|
}
|
|
6281
|
-
if (headerFooter.dateFormat !== void 0) {
|
|
6282
|
-
hf["@_dtFmt"] = headerFooter.dateFormat;
|
|
6283
|
-
}
|
|
6284
|
-
presentation["p:hf"] = hf;
|
|
6285
6262
|
}
|
|
6286
6263
|
applySlideDimensions(presentation, rawSlideWidthEmu, rawSlideHeightEmu, rawSlideSizeType) {
|
|
6287
6264
|
const slideSize = presentation["p:sldSz"];
|
|
@@ -6957,7 +6934,9 @@ var PptxSlideNotesPartUpdater = class {
|
|
|
6957
6934
|
var PptxSlideBackgroundBuilder = class {
|
|
6958
6935
|
applyBackground(init) {
|
|
6959
6936
|
const hasBackgroundColor = typeof init.slide.backgroundColor === "string" && init.slide.backgroundColor.length > 0 && init.slide.backgroundColor !== "transparent";
|
|
6960
|
-
const
|
|
6937
|
+
const rawBackgroundImage = typeof init.slide.backgroundImage === "string" ? init.slide.backgroundImage : "";
|
|
6938
|
+
const hasBackgroundImage = rawBackgroundImage.length > 0;
|
|
6939
|
+
const hasDataUrlBackgroundImage = hasBackgroundImage && rawBackgroundImage.startsWith("data:");
|
|
6961
6940
|
const hasBackgroundGradient = typeof init.slide.backgroundGradient === "string" && init.slide.backgroundGradient.length > 0;
|
|
6962
6941
|
const cSld = init.slideNode["p:cSld"] || {};
|
|
6963
6942
|
if (!(hasBackgroundColor || hasBackgroundImage || hasBackgroundGradient)) {
|
|
@@ -6965,9 +6944,17 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
6965
6944
|
init.slideNode["p:cSld"] = cSld;
|
|
6966
6945
|
return;
|
|
6967
6946
|
}
|
|
6947
|
+
const existingBg = cSld["p:bg"];
|
|
6948
|
+
const existingBgPr = existingBg?.["p:bgPr"];
|
|
6949
|
+
const existingHasBlipFill = existingBgPr?.["a:blipFill"] !== void 0;
|
|
6950
|
+
if (!hasDataUrlBackgroundImage && existingHasBlipFill) {
|
|
6951
|
+
this.reorderCSldBgFirst(cSld, existingBg);
|
|
6952
|
+
init.slideNode["p:cSld"] = cSld;
|
|
6953
|
+
return;
|
|
6954
|
+
}
|
|
6968
6955
|
const backgroundProperties = {};
|
|
6969
|
-
if (
|
|
6970
|
-
const parsedBackgroundImage = init.parseDataUrlToBytes(
|
|
6956
|
+
if (hasDataUrlBackgroundImage) {
|
|
6957
|
+
const parsedBackgroundImage = init.parseDataUrlToBytes(rawBackgroundImage);
|
|
6971
6958
|
if (parsedBackgroundImage) {
|
|
6972
6959
|
const backgroundImagePath = init.saveState.nextMediaPath(parsedBackgroundImage.extension);
|
|
6973
6960
|
init.zip.file(backgroundImagePath, parsedBackgroundImage.bytes);
|
|
@@ -6990,9 +6977,42 @@ var PptxSlideBackgroundBuilder = class {
|
|
|
6990
6977
|
}
|
|
6991
6978
|
};
|
|
6992
6979
|
}
|
|
6993
|
-
backgroundProperties["a:
|
|
6994
|
-
|
|
6995
|
-
|
|
6980
|
+
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;
|
|
6981
|
+
if (hasFillChild) {
|
|
6982
|
+
backgroundProperties["a:effectLst"] = {};
|
|
6983
|
+
}
|
|
6984
|
+
if (!hasFillChild) {
|
|
6985
|
+
delete cSld["p:bg"];
|
|
6986
|
+
init.slideNode["p:cSld"] = cSld;
|
|
6987
|
+
return;
|
|
6988
|
+
}
|
|
6989
|
+
const rebuiltCSld = { "p:bg": { "p:bgPr": backgroundProperties } };
|
|
6990
|
+
for (const key of Object.keys(cSld)) {
|
|
6991
|
+
if (key === "p:bg") {
|
|
6992
|
+
continue;
|
|
6993
|
+
}
|
|
6994
|
+
rebuiltCSld[key] = cSld[key];
|
|
6995
|
+
}
|
|
6996
|
+
init.slideNode["p:cSld"] = rebuiltCSld;
|
|
6997
|
+
}
|
|
6998
|
+
reorderCSldBgFirst(cSld, bg) {
|
|
6999
|
+
const keys = Object.keys(cSld);
|
|
7000
|
+
if (keys.length > 0 && keys[0] === "p:bg") {
|
|
7001
|
+
return;
|
|
7002
|
+
}
|
|
7003
|
+
const reordered = { "p:bg": bg };
|
|
7004
|
+
for (const key of keys) {
|
|
7005
|
+
if (key === "p:bg") {
|
|
7006
|
+
continue;
|
|
7007
|
+
}
|
|
7008
|
+
reordered[key] = cSld[key];
|
|
7009
|
+
}
|
|
7010
|
+
for (const key of Object.keys(cSld)) {
|
|
7011
|
+
delete cSld[key];
|
|
7012
|
+
}
|
|
7013
|
+
for (const key of Object.keys(reordered)) {
|
|
7014
|
+
cSld[key] = reordered[key];
|
|
7015
|
+
}
|
|
6996
7016
|
}
|
|
6997
7017
|
};
|
|
6998
7018
|
|
|
@@ -9869,6 +9889,7 @@ var PptxConnectorParser = class {
|
|
|
9869
9889
|
slideRelationships,
|
|
9870
9890
|
this.context.getOrderedSlidePaths()
|
|
9871
9891
|
);
|
|
9892
|
+
const connElementName = cNvPr?.["@_name"] ? String(cNvPr["@_name"]).trim() : void 0;
|
|
9872
9893
|
const locks = this.context.parseShapeLocks(
|
|
9873
9894
|
cNvConnectionShapeProperties?.["a:cxnSpLocks"] ?? cNvConnectionShapeProperties?.["a:spLocks"]
|
|
9874
9895
|
);
|
|
@@ -9876,6 +9897,7 @@ var PptxConnectorParser = class {
|
|
|
9876
9897
|
const textResult = this.context.parseConnectorTextBody?.(txBody, slidePath);
|
|
9877
9898
|
return {
|
|
9878
9899
|
id,
|
|
9900
|
+
name: connElementName || void 0,
|
|
9879
9901
|
type: "connector",
|
|
9880
9902
|
x: Math.round(parseInt(String(offset["@_x"] || "0"), 10) / this.context.emuPerPx),
|
|
9881
9903
|
y: Math.round(parseInt(String(offset["@_y"] || "0"), 10) / this.context.emuPerPx),
|
|
@@ -13405,7 +13427,16 @@ var PptxRuntimeDependencyFactory = class {
|
|
|
13405
13427
|
return new XMLParser({
|
|
13406
13428
|
ignoreAttributes: false,
|
|
13407
13429
|
attributeNamePrefix: "@_",
|
|
13408
|
-
parseAttributeValue: false
|
|
13430
|
+
parseAttributeValue: false,
|
|
13431
|
+
// Keep element text as strings. When true (the fast-xml-parser
|
|
13432
|
+
// default), `<AppVersion>16.0000</AppVersion>` is coerced to the
|
|
13433
|
+
// JS number 16, losing the trailing zeros. On save we write back
|
|
13434
|
+
// "16", which fails PowerPoint's strict `[0-9]+\.[0-9]{4}` match
|
|
13435
|
+
// on AppVersion — the loader rejects the package with HRESULT
|
|
13436
|
+
// 0x80070570 (ERROR_FILE_CORRUPT) and shows the repair dialog.
|
|
13437
|
+
// More generally, OOXML element text is always an untyped string;
|
|
13438
|
+
// downstream callers coerce where needed.
|
|
13439
|
+
parseTagValue: false
|
|
13409
13440
|
});
|
|
13410
13441
|
}
|
|
13411
13442
|
createBuilder() {
|
|
@@ -14081,7 +14112,7 @@ var TRIPLET_ENCODINGS = [
|
|
|
14081
14112
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: -1 },
|
|
14082
14113
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: -1, ySign: 1 },
|
|
14083
14114
|
{ byteCount: 2, xBits: 4, yBits: 4, deltaX: 49, deltaY: 49, xSign: 1, ySign: 1 },
|
|
14084
|
-
// Indices 84-
|
|
14115
|
+
// Indices 84-119: 8-bit X + 8-bit Y (3 bytes total)
|
|
14085
14116
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: -1 },
|
|
14086
14117
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: 1, ySign: -1 },
|
|
14087
14118
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 1, deltaY: 1, xSign: -1, ySign: 1 },
|
|
@@ -14118,12 +14149,12 @@ var TRIPLET_ENCODINGS = [
|
|
|
14118
14149
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: -1 },
|
|
14119
14150
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: -1, ySign: 1 },
|
|
14120
14151
|
{ byteCount: 3, xBits: 8, yBits: 8, deltaX: 513, deltaY: 513, xSign: 1, ySign: 1 },
|
|
14121
|
-
// Indices
|
|
14152
|
+
// Indices 120-123: 12-bit X + 12-bit Y (4 bytes total)
|
|
14122
14153
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14123
14154
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14124
14155
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
14125
14156
|
{ byteCount: 4, xBits: 12, yBits: 12, deltaX: 0, deltaY: 0, xSign: 1, ySign: 1 },
|
|
14126
|
-
// Indices
|
|
14157
|
+
// Indices 124-127: 16-bit X + 16-bit Y (5 bytes total)
|
|
14127
14158
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: -1 },
|
|
14128
14159
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: 1, ySign: -1 },
|
|
14129
14160
|
{ byteCount: 5, xBits: 16, yBits: 16, deltaX: 0, deltaY: 0, xSign: -1, ySign: 1 },
|
|
@@ -14212,14 +14243,15 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14212
14243
|
if (pushCount === 0) {
|
|
14213
14244
|
return;
|
|
14214
14245
|
}
|
|
14215
|
-
const
|
|
14216
|
-
let isShort = false;
|
|
14246
|
+
const data = [];
|
|
14217
14247
|
let remaining = pushCount;
|
|
14248
|
+
let isShort = false;
|
|
14249
|
+
const runValues = [];
|
|
14218
14250
|
function flush() {
|
|
14219
|
-
if (
|
|
14251
|
+
if (runValues.length === 0) {
|
|
14220
14252
|
return;
|
|
14221
14253
|
}
|
|
14222
|
-
const count =
|
|
14254
|
+
const count = runValues.length;
|
|
14223
14255
|
if (isShort) {
|
|
14224
14256
|
if (count < 8) {
|
|
14225
14257
|
sOut.writeU8(PUSHW + (count - 1));
|
|
@@ -14227,7 +14259,7 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14227
14259
|
sOut.writeU8(NPUSHW);
|
|
14228
14260
|
sOut.writeU8(count);
|
|
14229
14261
|
}
|
|
14230
|
-
for (const v of
|
|
14262
|
+
for (const v of runValues) {
|
|
14231
14263
|
sOut.writeS16(v);
|
|
14232
14264
|
}
|
|
14233
14265
|
} else {
|
|
@@ -14237,54 +14269,50 @@ function decodePushInstructions(sIn, sOut, pushCount) {
|
|
|
14237
14269
|
sOut.writeU8(NPUSHB);
|
|
14238
14270
|
sOut.writeU8(count);
|
|
14239
14271
|
}
|
|
14240
|
-
for (const v of
|
|
14272
|
+
for (const v of runValues) {
|
|
14241
14273
|
sOut.writeU8(v & 255);
|
|
14242
14274
|
}
|
|
14243
14275
|
}
|
|
14244
|
-
|
|
14276
|
+
runValues.length = 0;
|
|
14245
14277
|
}
|
|
14246
|
-
function
|
|
14278
|
+
function put(v) {
|
|
14279
|
+
data.push(v);
|
|
14247
14280
|
const needsShort = v < 0 || v > 255;
|
|
14248
|
-
if (
|
|
14281
|
+
if (runValues.length > 0 && needsShort !== isShort) {
|
|
14249
14282
|
flush();
|
|
14250
14283
|
}
|
|
14251
|
-
if (
|
|
14284
|
+
if (runValues.length === 0) {
|
|
14252
14285
|
isShort = needsShort;
|
|
14253
14286
|
}
|
|
14254
|
-
|
|
14255
|
-
if (
|
|
14287
|
+
runValues.push(v);
|
|
14288
|
+
if (runValues.length >= 255) {
|
|
14256
14289
|
flush();
|
|
14257
14290
|
}
|
|
14258
14291
|
}
|
|
14259
14292
|
while (remaining > 0) {
|
|
14260
|
-
const code = sIn.
|
|
14261
|
-
if (code === 251 && remaining >=
|
|
14262
|
-
|
|
14263
|
-
const
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
const b = read255Short(sIn);
|
|
14293
|
+
const code = sIn.peekU8();
|
|
14294
|
+
if (code === 251 && remaining >= 3 && data.length >= 2) {
|
|
14295
|
+
sIn.readU8();
|
|
14296
|
+
const prev = data[data.length - 2];
|
|
14297
|
+
put(prev);
|
|
14298
|
+
const val = read255Short(sIn);
|
|
14299
|
+
put(val);
|
|
14300
|
+
put(prev);
|
|
14301
|
+
remaining -= 3;
|
|
14302
|
+
} else if (code === 252 && remaining >= 5 && data.length >= 2) {
|
|
14303
|
+
sIn.readU8();
|
|
14304
|
+
const prev = data[data.length - 2];
|
|
14305
|
+
put(prev);
|
|
14274
14306
|
const c = read255Short(sIn);
|
|
14307
|
+
put(c);
|
|
14308
|
+
put(prev);
|
|
14275
14309
|
const d = read255Short(sIn);
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
addValue(c);
|
|
14280
|
-
addValue(a);
|
|
14281
|
-
addValue(d);
|
|
14282
|
-
addValue(a);
|
|
14283
|
-
remaining -= 7;
|
|
14310
|
+
put(d);
|
|
14311
|
+
put(prev);
|
|
14312
|
+
remaining -= 5;
|
|
14284
14313
|
} else {
|
|
14285
|
-
sIn.seekRelative(-1);
|
|
14286
14314
|
const v = read255Short(sIn);
|
|
14287
|
-
|
|
14315
|
+
put(v);
|
|
14288
14316
|
remaining -= 1;
|
|
14289
14317
|
}
|
|
14290
14318
|
}
|
|
@@ -14312,6 +14340,9 @@ function makeGlyphFlags(x, y, onCurve, firstTime) {
|
|
|
14312
14340
|
return flags;
|
|
14313
14341
|
}
|
|
14314
14342
|
function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX, maxY) {
|
|
14343
|
+
if (numContours === 0) {
|
|
14344
|
+
return;
|
|
14345
|
+
}
|
|
14315
14346
|
const sGlyph = streams[0];
|
|
14316
14347
|
out.writeS16(numContours);
|
|
14317
14348
|
const bboxPos = out.pos;
|
|
@@ -14332,13 +14363,12 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14332
14363
|
}
|
|
14333
14364
|
let totalPoints = 0;
|
|
14334
14365
|
for (let c = 0; c < numContours; c++) {
|
|
14335
|
-
const pointsInContour = read255UShort(sGlyph);
|
|
14336
|
-
totalPoints += pointsInContour;
|
|
14337
14366
|
if (c === 0) {
|
|
14338
|
-
|
|
14339
|
-
} else {
|
|
14340
|
-
out.writeU16(totalPoints - 1);
|
|
14367
|
+
totalPoints = 1;
|
|
14341
14368
|
}
|
|
14369
|
+
const pointsInContour = read255UShort(sGlyph);
|
|
14370
|
+
totalPoints += pointsInContour;
|
|
14371
|
+
out.writeU16(totalPoints - 1);
|
|
14342
14372
|
}
|
|
14343
14373
|
const flagBytes = new Uint8Array(totalPoints);
|
|
14344
14374
|
for (let i = 0; i < totalPoints; i++) {
|
|
@@ -14351,7 +14381,7 @@ function decodeSimpleGlyph(numContours, streams, out, calcBBox, minX, minY, maxX
|
|
|
14351
14381
|
let cumulativeY = 0;
|
|
14352
14382
|
for (let i = 0; i < totalPoints; i++) {
|
|
14353
14383
|
const flag = flagBytes[i];
|
|
14354
|
-
onCurve[i] = flag
|
|
14384
|
+
onCurve[i] = flag & 128 ? 0 : 1;
|
|
14355
14385
|
const enc = TRIPLET_ENCODINGS[flag & 127];
|
|
14356
14386
|
const extraBytes = enc.byteCount - 1;
|
|
14357
14387
|
const subBuf = new Uint8Array(extraBytes);
|
|
@@ -14690,7 +14720,10 @@ var AHuff = class _AHuff {
|
|
|
14690
14720
|
this.bio = bio;
|
|
14691
14721
|
this.range = range;
|
|
14692
14722
|
this.bitCount = bitsUsed(range - 1);
|
|
14693
|
-
this.bitCount2 =
|
|
14723
|
+
this.bitCount2 = 0;
|
|
14724
|
+
if (range > 256 && range < 512) {
|
|
14725
|
+
this.bitCount2 = bitsUsed(range - 256 - 1) + 1;
|
|
14726
|
+
}
|
|
14694
14727
|
const treeSize = 2 * range;
|
|
14695
14728
|
this.tree = Array.from({ length: treeSize });
|
|
14696
14729
|
for (let i = 0; i < treeSize; i++) {
|
|
@@ -14698,6 +14731,7 @@ var AHuff = class _AHuff {
|
|
|
14698
14731
|
}
|
|
14699
14732
|
for (let i = 2; i < treeSize; i++) {
|
|
14700
14733
|
this.tree[i].up = i >> 1;
|
|
14734
|
+
this.tree[i].weight = 1;
|
|
14701
14735
|
}
|
|
14702
14736
|
for (let i = 1; i < range; i++) {
|
|
14703
14737
|
this.tree[i].left = 2 * i;
|
|
@@ -14707,7 +14741,8 @@ var AHuff = class _AHuff {
|
|
|
14707
14741
|
for (let i = 0; i < range; i++) {
|
|
14708
14742
|
const leafIdx = range + i;
|
|
14709
14743
|
this.tree[leafIdx].code = i;
|
|
14710
|
-
this.tree[leafIdx].
|
|
14744
|
+
this.tree[leafIdx].left = -1;
|
|
14745
|
+
this.tree[leafIdx].right = -1;
|
|
14711
14746
|
}
|
|
14712
14747
|
this.symbolIndex = Array.from({ length: range });
|
|
14713
14748
|
for (let i = 0; i < range; i++) {
|
|
@@ -14747,15 +14782,13 @@ var AHuff = class _AHuff {
|
|
|
14747
14782
|
*/
|
|
14748
14783
|
readSymbol() {
|
|
14749
14784
|
let a = _AHuff.ROOT;
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
}
|
|
14756
|
-
}
|
|
14785
|
+
let symbol;
|
|
14786
|
+
do {
|
|
14787
|
+
a = this.bio.inputBit() ? this.tree[a].right : this.tree[a].left;
|
|
14788
|
+
symbol = this.tree[a].code;
|
|
14789
|
+
} while (symbol < 0);
|
|
14757
14790
|
this.updateWeight(a);
|
|
14758
|
-
return
|
|
14791
|
+
return symbol;
|
|
14759
14792
|
}
|
|
14760
14793
|
// --------------------------------------------------------------------
|
|
14761
14794
|
// Private helpers
|
|
@@ -14779,17 +14812,19 @@ var AHuff = class _AHuff {
|
|
|
14779
14812
|
updateWeight(a) {
|
|
14780
14813
|
const tree = this.tree;
|
|
14781
14814
|
for (; a !== _AHuff.ROOT; a = tree[a].up) {
|
|
14815
|
+
const weightA = tree[a].weight;
|
|
14782
14816
|
let b = a - 1;
|
|
14783
|
-
if (
|
|
14784
|
-
|
|
14817
|
+
if (tree[b].weight === weightA) {
|
|
14818
|
+
do {
|
|
14785
14819
|
b--;
|
|
14786
|
-
}
|
|
14787
|
-
|
|
14820
|
+
} while (tree[b].weight === weightA);
|
|
14821
|
+
b++;
|
|
14822
|
+
if (b > _AHuff.ROOT) {
|
|
14788
14823
|
this.swapNodes(a, b);
|
|
14789
14824
|
a = b;
|
|
14790
14825
|
}
|
|
14791
14826
|
}
|
|
14792
|
-
tree[a].weight
|
|
14827
|
+
tree[a].weight = weightA + 1;
|
|
14793
14828
|
}
|
|
14794
14829
|
tree[_AHuff.ROOT].weight++;
|
|
14795
14830
|
}
|
|
@@ -14809,38 +14844,26 @@ var AHuff = class _AHuff {
|
|
|
14809
14844
|
*/
|
|
14810
14845
|
swapNodes(a, b) {
|
|
14811
14846
|
const tree = this.tree;
|
|
14812
|
-
const
|
|
14813
|
-
const
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
na.weight = nb.weight;
|
|
14826
|
-
nb.weight = tmp;
|
|
14827
|
-
if (na.left) {
|
|
14828
|
-
tree[na.left].up = a;
|
|
14829
|
-
}
|
|
14830
|
-
if (na.right) {
|
|
14831
|
-
tree[na.right].up = a;
|
|
14832
|
-
}
|
|
14833
|
-
if (nb.left) {
|
|
14834
|
-
tree[nb.left].up = b;
|
|
14835
|
-
}
|
|
14836
|
-
if (nb.right) {
|
|
14837
|
-
tree[nb.right].up = b;
|
|
14838
|
-
}
|
|
14839
|
-
if (na.code >= 0) {
|
|
14840
|
-
this.symbolIndex[na.code] = a;
|
|
14847
|
+
const upa = tree[a].up;
|
|
14848
|
+
const upb = tree[b].up;
|
|
14849
|
+
const tmp = tree[a];
|
|
14850
|
+
tree[a] = tree[b];
|
|
14851
|
+
tree[b] = tmp;
|
|
14852
|
+
tree[a].up = upa;
|
|
14853
|
+
tree[b].up = upb;
|
|
14854
|
+
let code = tree[a].code;
|
|
14855
|
+
if (code < 0) {
|
|
14856
|
+
tree[tree[a].left].up = a;
|
|
14857
|
+
tree[tree[a].right].up = a;
|
|
14858
|
+
} else {
|
|
14859
|
+
this.symbolIndex[code] = a;
|
|
14841
14860
|
}
|
|
14842
|
-
|
|
14843
|
-
|
|
14861
|
+
code = tree[b].code;
|
|
14862
|
+
if (code < 0) {
|
|
14863
|
+
tree[tree[b].left].up = b;
|
|
14864
|
+
tree[tree[b].right].up = b;
|
|
14865
|
+
} else {
|
|
14866
|
+
this.symbolIndex[code] = b;
|
|
14844
14867
|
}
|
|
14845
14868
|
}
|
|
14846
14869
|
/**
|
|
@@ -15219,12 +15242,12 @@ function unpackMtx(data, size) {
|
|
|
15219
15242
|
const offset2 = data[4] << 16 | data[5] << 8 | data[6];
|
|
15220
15243
|
const offset3 = data[7] << 16 | data[8] << 8 | data[9];
|
|
15221
15244
|
const offsets = [10, offset2, offset3];
|
|
15222
|
-
const
|
|
15245
|
+
const blockSizes = [offset2 - 10, offset3 - offset2, size - offset3];
|
|
15223
15246
|
const streams = [];
|
|
15224
15247
|
const decompressedSizes = [];
|
|
15225
15248
|
for (let i = 0; i < 3; i++) {
|
|
15226
15249
|
const block = data.subarray(offsets[i]);
|
|
15227
|
-
const decompressed = lzcompDecompress(block,
|
|
15250
|
+
const decompressed = lzcompDecompress(block, blockSizes[i], versionMagic);
|
|
15228
15251
|
streams.push(decompressed);
|
|
15229
15252
|
decompressedSizes.push(decompressed.length);
|
|
15230
15253
|
}
|
|
@@ -15316,6 +15339,15 @@ function parseEotHeader(data) {
|
|
|
15316
15339
|
const fullName = readNameString();
|
|
15317
15340
|
if (version >= 131074) {
|
|
15318
15341
|
readNameString();
|
|
15342
|
+
offset += 8;
|
|
15343
|
+
if (offset + 4 <= data.length) {
|
|
15344
|
+
const signatureSize = readUint16LE(data, offset + 2);
|
|
15345
|
+
offset += 4 + signatureSize;
|
|
15346
|
+
}
|
|
15347
|
+
if (offset + 8 <= data.length) {
|
|
15348
|
+
const eudcFontSize = readUint32LE(data, offset + 4);
|
|
15349
|
+
offset += 8 + eudcFontSize;
|
|
15350
|
+
}
|
|
15319
15351
|
}
|
|
15320
15352
|
return {
|
|
15321
15353
|
eotSize,
|
|
@@ -23414,12 +23446,6 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23414
23446
|
if (textStyle?.rtl !== void 0) {
|
|
23415
23447
|
paragraphProps["@_rtl"] = textStyle.rtl ? "1" : "0";
|
|
23416
23448
|
}
|
|
23417
|
-
if (spacing.spacingBefore) {
|
|
23418
|
-
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23419
|
-
}
|
|
23420
|
-
if (spacing.spacingAfter) {
|
|
23421
|
-
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23422
|
-
}
|
|
23423
23449
|
if (spacing.lineSpacing) {
|
|
23424
23450
|
paragraphProps["a:lnSpc"] = spacing.lineSpacing;
|
|
23425
23451
|
} else if (typeof spacing.lineSpacingExactPt === "number" && Number.isFinite(spacing.lineSpacingExactPt)) {
|
|
@@ -23429,6 +23455,12 @@ function buildParagraphPropertiesXml(textStyle, paragraphAlign, bulletInfo, spac
|
|
|
23429
23455
|
}
|
|
23430
23456
|
};
|
|
23431
23457
|
}
|
|
23458
|
+
if (spacing.spacingBefore) {
|
|
23459
|
+
paragraphProps["a:spcBef"] = spacing.spacingBefore;
|
|
23460
|
+
}
|
|
23461
|
+
if (spacing.spacingAfter) {
|
|
23462
|
+
paragraphProps["a:spcAft"] = spacing.spacingAfter;
|
|
23463
|
+
}
|
|
23432
23464
|
if (typeof textStyle?.paragraphMarginLeft === "number" && Number.isFinite(textStyle.paragraphMarginLeft)) {
|
|
23433
23465
|
paragraphProps["@_marL"] = String(Math.round(textStyle.paragraphMarginLeft * EMU_PER_PX4));
|
|
23434
23466
|
}
|
|
@@ -23479,9 +23511,10 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23479
23511
|
paragraphProps["a:buNone"] = {};
|
|
23480
23512
|
return;
|
|
23481
23513
|
}
|
|
23482
|
-
if (bulletInfo.
|
|
23483
|
-
|
|
23484
|
-
|
|
23514
|
+
if (bulletInfo.color) {
|
|
23515
|
+
const colorHex = bulletInfo.color.replace("#", "");
|
|
23516
|
+
paragraphProps["a:buClr"] = {
|
|
23517
|
+
"a:srgbClr": { "@_val": colorHex }
|
|
23485
23518
|
};
|
|
23486
23519
|
}
|
|
23487
23520
|
if (bulletInfo.sizePercent !== void 0) {
|
|
@@ -23494,10 +23527,9 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23494
23527
|
"@_val": String(Math.round(bulletInfo.sizePts * 100))
|
|
23495
23528
|
};
|
|
23496
23529
|
}
|
|
23497
|
-
if (bulletInfo.
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
"a:srgbClr": { "@_val": colorHex }
|
|
23530
|
+
if (bulletInfo.fontFamily) {
|
|
23531
|
+
paragraphProps["a:buFont"] = {
|
|
23532
|
+
"@_typeface": bulletInfo.fontFamily
|
|
23501
23533
|
};
|
|
23502
23534
|
}
|
|
23503
23535
|
if (bulletInfo.char) {
|
|
@@ -23520,9 +23552,8 @@ function applyBulletProperties(paragraphProps, bulletInfo) {
|
|
|
23520
23552
|
}
|
|
23521
23553
|
function assembleParagraphXml(runs, paragraphProps) {
|
|
23522
23554
|
const paragraph = {
|
|
23523
|
-
"a:
|
|
23555
|
+
"a:pPr": paragraphProps
|
|
23524
23556
|
};
|
|
23525
|
-
paragraph["a:pPr"] = paragraphProps;
|
|
23526
23557
|
const regularRuns = runs.filter((r) => !r.__isField);
|
|
23527
23558
|
const fieldRuns = runs.filter((r) => r.__isField).map((r) => {
|
|
23528
23559
|
const { __isField, ...rest } = r;
|
|
@@ -23541,6 +23572,7 @@ function assembleParagraphXml(runs, paragraphProps) {
|
|
|
23541
23572
|
if (cleanRegularRuns.length === 0 && fieldRuns.length === 0) {
|
|
23542
23573
|
paragraph["a:r"] = runs.length > 1 ? runs : runs[0];
|
|
23543
23574
|
}
|
|
23575
|
+
paragraph["a:endParaRPr"] = { "@_lang": "en-US" };
|
|
23544
23576
|
return paragraph;
|
|
23545
23577
|
}
|
|
23546
23578
|
function computeUniformSegmentOverrides(textStyle, textSegments) {
|
|
@@ -26379,9 +26411,6 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26379
26411
|
if (style.textCaps && style.textCaps !== "none") {
|
|
26380
26412
|
runProps["@_cap"] = style.textCaps;
|
|
26381
26413
|
}
|
|
26382
|
-
if (style.rtl !== void 0) {
|
|
26383
|
-
runProps["@_rtl"] = style.rtl ? "1" : "0";
|
|
26384
|
-
}
|
|
26385
26414
|
if (style.kumimoji !== void 0) {
|
|
26386
26415
|
runProps["@_kumimoji"] = style.kumimoji ? "1" : "0";
|
|
26387
26416
|
}
|
|
@@ -26403,17 +26432,19 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26403
26432
|
if (style.bookmark) {
|
|
26404
26433
|
runProps["@_bmk"] = style.bookmark;
|
|
26405
26434
|
}
|
|
26406
|
-
if (style.
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
"@
|
|
26410
|
-
}
|
|
26411
|
-
|
|
26412
|
-
"
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26435
|
+
if (style.textOutlineWidth || style.textOutlineColor) {
|
|
26436
|
+
const lnObj = {};
|
|
26437
|
+
if (typeof style.textOutlineWidth === "number" && style.textOutlineWidth > 0) {
|
|
26438
|
+
lnObj["@_w"] = String(Math.round(style.textOutlineWidth * _PptxHandlerRuntime.EMU_PER_PX));
|
|
26439
|
+
}
|
|
26440
|
+
if (style.textOutlineColor) {
|
|
26441
|
+
lnObj["a:solidFill"] = {
|
|
26442
|
+
"a:srgbClr": {
|
|
26443
|
+
"@_val": style.textOutlineColor.replace("#", "")
|
|
26444
|
+
}
|
|
26445
|
+
};
|
|
26446
|
+
}
|
|
26447
|
+
runProps["a:ln"] = lnObj;
|
|
26417
26448
|
}
|
|
26418
26449
|
if (style.color) {
|
|
26419
26450
|
runProps["a:solidFill"] = {
|
|
@@ -26421,15 +26452,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26421
26452
|
"@_val": style.color.replace("#", "")
|
|
26422
26453
|
}
|
|
26423
26454
|
};
|
|
26424
|
-
}
|
|
26425
|
-
if (style.highlightColor) {
|
|
26426
|
-
runProps["a:highlight"] = {
|
|
26427
|
-
"a:srgbClr": {
|
|
26428
|
-
"@_val": style.highlightColor.replace("#", "")
|
|
26429
|
-
}
|
|
26430
|
-
};
|
|
26431
|
-
}
|
|
26432
|
-
if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26455
|
+
} else if (style.textFillGradientStops && style.textFillGradientStops.length > 0) {
|
|
26433
26456
|
const gradStops = style.textFillGradientStops.filter((stop) => Boolean(stop?.color)).map((stop) => {
|
|
26434
26457
|
const rawPos = (stop.position ?? 0) / 100;
|
|
26435
26458
|
const posVal = Math.round(Math.max(0, Math.min(1, rawPos)) * 1e5);
|
|
@@ -26462,8 +26485,7 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26462
26485
|
}
|
|
26463
26486
|
runProps["a:gradFill"] = gradFillXml;
|
|
26464
26487
|
}
|
|
26465
|
-
}
|
|
26466
|
-
if (style.textFillPattern) {
|
|
26488
|
+
} else if (style.textFillPattern) {
|
|
26467
26489
|
const pattFill = { "@_prst": style.textFillPattern };
|
|
26468
26490
|
if (style.textFillPatternForeground) {
|
|
26469
26491
|
pattFill["a:fgClr"] = {
|
|
@@ -26481,6 +26503,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26481
26503
|
}
|
|
26482
26504
|
runProps["a:pattFill"] = pattFill;
|
|
26483
26505
|
}
|
|
26506
|
+
const textEffectLst = buildTextRunEffectListXml(style);
|
|
26507
|
+
if (textEffectLst) {
|
|
26508
|
+
runProps["a:effectLst"] = textEffectLst;
|
|
26509
|
+
}
|
|
26510
|
+
if (style.highlightColor) {
|
|
26511
|
+
runProps["a:highlight"] = {
|
|
26512
|
+
"a:srgbClr": {
|
|
26513
|
+
"@_val": style.highlightColor.replace("#", "")
|
|
26514
|
+
}
|
|
26515
|
+
};
|
|
26516
|
+
}
|
|
26484
26517
|
if (style.underline && style.underlineColor) {
|
|
26485
26518
|
runProps["a:uFill"] = {
|
|
26486
26519
|
"a:solidFill": {
|
|
@@ -26490,23 +26523,17 @@ var PptxHandlerRuntime12 = class _PptxHandlerRuntime extends PptxHandlerRuntime1
|
|
|
26490
26523
|
}
|
|
26491
26524
|
};
|
|
26492
26525
|
}
|
|
26493
|
-
if (style.
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
}
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
"@_val": style.textOutlineColor.replace("#", "")
|
|
26502
|
-
}
|
|
26503
|
-
};
|
|
26504
|
-
}
|
|
26505
|
-
runProps["a:ln"] = lnObj;
|
|
26526
|
+
if (style.fontFamily) {
|
|
26527
|
+
runProps["a:latin"] = { "@_typeface": style.fontFamily };
|
|
26528
|
+
runProps["a:ea"] = {
|
|
26529
|
+
"@_typeface": style.eastAsiaFont || style.fontFamily
|
|
26530
|
+
};
|
|
26531
|
+
runProps["a:cs"] = {
|
|
26532
|
+
"@_typeface": style.complexScriptFont || style.fontFamily
|
|
26533
|
+
};
|
|
26506
26534
|
}
|
|
26507
|
-
|
|
26508
|
-
|
|
26509
|
-
runProps["a:effectLst"] = textEffectLst;
|
|
26535
|
+
if (style.symbolFont) {
|
|
26536
|
+
runProps["a:sym"] = { "@_typeface": style.symbolFont };
|
|
26510
26537
|
}
|
|
26511
26538
|
if (style.hyperlink && resolveHyperlinkRelationshipId) {
|
|
26512
26539
|
const hyperlinkTarget = String(style.hyperlink).trim();
|
|
@@ -29427,32 +29454,58 @@ var PptxHandlerRuntime24 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
|
|
|
29427
29454
|
};
|
|
29428
29455
|
for (const variant of variants) {
|
|
29429
29456
|
const fontData = variant.rawFontData;
|
|
29430
|
-
const
|
|
29431
|
-
const
|
|
29432
|
-
const
|
|
29433
|
-
|
|
29434
|
-
|
|
29435
|
-
|
|
29457
|
+
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
29458
|
+
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
29459
|
+
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
29460
|
+
let guid;
|
|
29461
|
+
let fontPartPath;
|
|
29462
|
+
let relativeTarget;
|
|
29436
29463
|
let rId;
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
)
|
|
29440
|
-
|
|
29441
|
-
|
|
29464
|
+
let bytesToWrite;
|
|
29465
|
+
let fontKeyForXml;
|
|
29466
|
+
if (reuseObfuscation) {
|
|
29467
|
+
guid = variant.fontGuid;
|
|
29468
|
+
fontPartPath = variant.partPath;
|
|
29469
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29470
|
+
rId = variant.originalRId;
|
|
29471
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29472
|
+
fontKeyForXml = `{${guid}}`;
|
|
29473
|
+
} else if (reuseVerbatim) {
|
|
29474
|
+
guid = "";
|
|
29475
|
+
fontPartPath = variant.partPath;
|
|
29476
|
+
relativeTarget = fontPartPath.startsWith("ppt/") ? fontPartPath.substring(4) : fontPartPath;
|
|
29477
|
+
rId = variant.originalRId;
|
|
29478
|
+
bytesToWrite = variant.originalPartBytes;
|
|
29479
|
+
fontKeyForXml = void 0;
|
|
29442
29480
|
} else {
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
|
|
29448
|
-
|
|
29449
|
-
|
|
29481
|
+
guid = variant.fontGuid ?? generateFontGuid();
|
|
29482
|
+
const fileName = `{${guid}}.fntdata`;
|
|
29483
|
+
fontPartPath = `ppt/fonts/${fileName}`;
|
|
29484
|
+
relativeTarget = `fonts/${fileName}`;
|
|
29485
|
+
bytesToWrite = obfuscateFont(fontData, guid);
|
|
29486
|
+
fontKeyForXml = `{${guid}}`;
|
|
29487
|
+
const existingRel = relationships.find(
|
|
29488
|
+
(r) => String(r?.["@_Target"] || "") === relativeTarget
|
|
29489
|
+
);
|
|
29490
|
+
if (existingRel) {
|
|
29491
|
+
rId = String(existingRel["@_Id"]);
|
|
29492
|
+
} else {
|
|
29493
|
+
maxId++;
|
|
29494
|
+
rId = `rId${maxId}`;
|
|
29495
|
+
relationships.push({
|
|
29496
|
+
"@_Id": rId,
|
|
29497
|
+
"@_Type": _PptxHandlerRuntime.FONT_REL_TYPE,
|
|
29498
|
+
"@_Target": relativeTarget
|
|
29499
|
+
});
|
|
29500
|
+
}
|
|
29450
29501
|
}
|
|
29502
|
+
this.zip.file(fontPartPath, bytesToWrite);
|
|
29451
29503
|
const variantKey = variant.bold && variant.italic ? "p:boldItalic" : variant.bold ? "p:bold" : variant.italic ? "p:italic" : "p:regular";
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
"@_fontKey"
|
|
29455
|
-
}
|
|
29504
|
+
const variantEntry = { "@_r:id": rId };
|
|
29505
|
+
if (fontKeyForXml) {
|
|
29506
|
+
variantEntry["@_fontKey"] = fontKeyForXml;
|
|
29507
|
+
}
|
|
29508
|
+
entry[variantKey] = variantEntry;
|
|
29456
29509
|
}
|
|
29457
29510
|
embeddedFontEntries.push(entry);
|
|
29458
29511
|
}
|
|
@@ -29596,54 +29649,59 @@ var PptxHandlerRuntime25 = class extends PptxHandlerRuntime24 {
|
|
|
29596
29649
|
}
|
|
29597
29650
|
};
|
|
29598
29651
|
const root = propsData["p:presentationPr"] || {};
|
|
29599
|
-
const
|
|
29600
|
-
|
|
29601
|
-
|
|
29602
|
-
|
|
29603
|
-
|
|
29604
|
-
showPr["p:browse"] = {};
|
|
29605
|
-
} else if (properties.showType === "kiosk") {
|
|
29606
|
-
const kioskNode = {};
|
|
29607
|
-
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29608
|
-
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29652
|
+
const existingShowPr = root["p:showPr"] || {};
|
|
29653
|
+
const rebuiltShowPr = {};
|
|
29654
|
+
for (const key of Object.keys(existingShowPr)) {
|
|
29655
|
+
if (key.startsWith("@_")) {
|
|
29656
|
+
rebuiltShowPr[key] = existingShowPr[key];
|
|
29609
29657
|
}
|
|
29610
|
-
showPr["p:kiosk"] = kioskNode;
|
|
29611
|
-
} else {
|
|
29612
|
-
showPr["p:present"] = {};
|
|
29613
29658
|
}
|
|
29614
29659
|
if (properties.loopContinuously !== void 0) {
|
|
29615
|
-
|
|
29660
|
+
rebuiltShowPr["@_loop"] = properties.loopContinuously ? "1" : "0";
|
|
29616
29661
|
}
|
|
29617
29662
|
if (properties.showWithNarration !== void 0) {
|
|
29618
|
-
|
|
29663
|
+
rebuiltShowPr["@_showNarration"] = properties.showWithNarration ? "1" : "0";
|
|
29619
29664
|
}
|
|
29620
29665
|
if (properties.showWithAnimation !== void 0) {
|
|
29621
|
-
|
|
29666
|
+
rebuiltShowPr["@_showAnimation"] = properties.showWithAnimation ? "1" : "0";
|
|
29622
29667
|
}
|
|
29623
29668
|
if (properties.advanceMode !== void 0) {
|
|
29624
|
-
|
|
29669
|
+
rebuiltShowPr["@_useTimings"] = properties.advanceMode === "useTimings" ? "1" : "0";
|
|
29625
29670
|
}
|
|
29626
|
-
if (properties.
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
};
|
|
29671
|
+
if (properties.showType === "browsed") {
|
|
29672
|
+
rebuiltShowPr["p:browse"] = {};
|
|
29673
|
+
} else if (properties.showType === "kiosk") {
|
|
29674
|
+
const kioskNode = {};
|
|
29675
|
+
if (properties.kioskRestartTime !== void 0 && properties.kioskRestartTime > 0) {
|
|
29676
|
+
kioskNode["@_restart"] = String(properties.kioskRestartTime);
|
|
29677
|
+
}
|
|
29678
|
+
rebuiltShowPr["p:kiosk"] = kioskNode;
|
|
29679
|
+
} else {
|
|
29680
|
+
rebuiltShowPr["p:present"] = {};
|
|
29630
29681
|
}
|
|
29631
|
-
delete showPr["p:sldAll"];
|
|
29632
|
-
delete showPr["p:sldRg"];
|
|
29633
|
-
delete showPr["p:custShow"];
|
|
29634
29682
|
if (properties.showSlidesMode === "range") {
|
|
29635
|
-
|
|
29683
|
+
rebuiltShowPr["p:sldRg"] = {
|
|
29636
29684
|
"@_st": String(properties.showSlidesFrom ?? 1),
|
|
29637
29685
|
"@_end": String(properties.showSlidesTo ?? 1)
|
|
29638
29686
|
};
|
|
29639
29687
|
} else if (properties.showSlidesMode === "customShow" && properties.showSlidesCustomShowId) {
|
|
29640
|
-
|
|
29688
|
+
rebuiltShowPr["p:custShow"] = {
|
|
29641
29689
|
"@_id": properties.showSlidesCustomShowId
|
|
29642
29690
|
};
|
|
29643
29691
|
} else {
|
|
29644
|
-
|
|
29692
|
+
rebuiltShowPr["p:sldAll"] = {};
|
|
29645
29693
|
}
|
|
29646
|
-
|
|
29694
|
+
if (properties.penColor) {
|
|
29695
|
+
rebuiltShowPr["p:penClr"] = {
|
|
29696
|
+
"a:srgbClr": { "@_val": properties.penColor.replace("#", "") }
|
|
29697
|
+
};
|
|
29698
|
+
} else if (existingShowPr["p:penClr"] !== void 0) {
|
|
29699
|
+
rebuiltShowPr["p:penClr"] = existingShowPr["p:penClr"];
|
|
29700
|
+
}
|
|
29701
|
+
if (existingShowPr["p:extLst"] !== void 0) {
|
|
29702
|
+
rebuiltShowPr["p:extLst"] = existingShowPr["p:extLst"];
|
|
29703
|
+
}
|
|
29704
|
+
root["p:showPr"] = rebuiltShowPr;
|
|
29647
29705
|
if (properties.printFrameSlides !== void 0 || properties.printSlidesPerPage !== void 0 || properties.printColorMode !== void 0) {
|
|
29648
29706
|
const prnPr = root["p:prnPr"] || {};
|
|
29649
29707
|
if (properties.printFrameSlides !== void 0) {
|
|
@@ -30774,7 +30832,12 @@ var PptxHandlerRuntime31 = class extends PptxHandlerRuntime30 {
|
|
|
30774
30832
|
shape = this.createPictureXml(el, relationshipId);
|
|
30775
30833
|
}
|
|
30776
30834
|
if (targetImagePath) {
|
|
30777
|
-
|
|
30835
|
+
const targetExt = targetImagePath.toLowerCase().match(/\.([^./\\]+)$/)?.[1];
|
|
30836
|
+
const parsedExt = parsedImage.extension.toLowerCase();
|
|
30837
|
+
const extensionMismatch = targetExt !== void 0 && targetExt !== parsedExt && !(targetExt === "jpg" && parsedExt === "jpeg") && !(targetExt === "jpeg" && parsedExt === "jpg");
|
|
30838
|
+
if (!extensionMismatch) {
|
|
30839
|
+
this.zip.file(targetImagePath, parsedImage.bytes);
|
|
30840
|
+
}
|
|
30778
30841
|
}
|
|
30779
30842
|
} else {
|
|
30780
30843
|
this.compatibilityService.reportWarning({
|
|
@@ -31179,6 +31242,7 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31179
31242
|
);
|
|
31180
31243
|
} else {
|
|
31181
31244
|
this.zip.remove("ppt/commentAuthors.xml");
|
|
31245
|
+
await this.stripPresentationCommentAuthorsRelationship();
|
|
31182
31246
|
}
|
|
31183
31247
|
const contentTypesXmlAfterComments = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
31184
31248
|
if (contentTypesXmlAfterComments) {
|
|
@@ -31252,8 +31316,39 @@ var PptxHandlerRuntime34 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
31252
31316
|
if (effectiveConformance === "strict") {
|
|
31253
31317
|
await this.convertZipToStrictConformance();
|
|
31254
31318
|
}
|
|
31319
|
+
for (const name of Object.keys(this.zip.files)) {
|
|
31320
|
+
if (this.zip.files[name].dir) {
|
|
31321
|
+
delete this.zip.files[name];
|
|
31322
|
+
}
|
|
31323
|
+
}
|
|
31255
31324
|
return await this.zip.generateAsync({ type: "uint8array" });
|
|
31256
31325
|
}
|
|
31326
|
+
/**
|
|
31327
|
+
* Remove any Relationship in presentation.xml.rels whose Type matches either
|
|
31328
|
+
* the Transitional or Strict commentAuthors relationship URI.
|
|
31329
|
+
*/
|
|
31330
|
+
async stripPresentationCommentAuthorsRelationship() {
|
|
31331
|
+
const relsPath = "ppt/_rels/presentation.xml.rels";
|
|
31332
|
+
const relsXml = await this.zip.file(relsPath)?.async("string");
|
|
31333
|
+
if (!relsXml) {
|
|
31334
|
+
return;
|
|
31335
|
+
}
|
|
31336
|
+
const relsData = this.parser.parse(relsXml);
|
|
31337
|
+
const root = relsData["Relationships"];
|
|
31338
|
+
if (!root) {
|
|
31339
|
+
return;
|
|
31340
|
+
}
|
|
31341
|
+
const relationships = this.ensureArray(root["Relationship"]);
|
|
31342
|
+
const filtered = relationships.filter((relationship) => {
|
|
31343
|
+
const type = String(relationship?.["@_Type"] ?? "");
|
|
31344
|
+
return type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" && type !== "http://purl.oclc.org/ooxml/officeDocument/relationships/commentAuthors";
|
|
31345
|
+
});
|
|
31346
|
+
if (filtered.length === relationships.length) {
|
|
31347
|
+
return;
|
|
31348
|
+
}
|
|
31349
|
+
root["Relationship"] = filtered;
|
|
31350
|
+
this.zip.file(relsPath, this.builder.build(relsData));
|
|
31351
|
+
}
|
|
31257
31352
|
};
|
|
31258
31353
|
|
|
31259
31354
|
// src/core/core/runtime/PptxHandlerRuntimeElementParsing.ts
|
|
@@ -33238,7 +33333,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33238
33333
|
}
|
|
33239
33334
|
const shapeStyle = this.extractShapeStyle(effectiveSpPr, styleNode);
|
|
33240
33335
|
const hasText = text.trim().length > 0;
|
|
33241
|
-
const isPlainRect = !prstGeom || prstGeom === "rect";
|
|
33336
|
+
const isPlainRect = (!prstGeom || prstGeom === "rect") && !custGeom;
|
|
33242
33337
|
const hasVisibleStyle = shapeStyle.fillColor && shapeStyle.fillColor !== "transparent" || (shapeStyle.strokeWidth || 0) > 0;
|
|
33243
33338
|
let type = "shape";
|
|
33244
33339
|
if (hasText && isPlainRect && !hasVisibleStyle) {
|
|
@@ -33250,6 +33345,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33250
33345
|
slideRelationshipMap,
|
|
33251
33346
|
this.orderedSlidePaths
|
|
33252
33347
|
);
|
|
33348
|
+
const elementName = cNvPrForActions?.["@_name"] ? String(cNvPrForActions["@_name"]).trim() : void 0;
|
|
33253
33349
|
const cNvSpPr = shape?.["p:nvSpPr"]?.["p:cNvSpPr"];
|
|
33254
33350
|
const spLocksNode = cNvSpPr?.["a:spLocks"];
|
|
33255
33351
|
const slideLocks = this.parseShapeLocks(spLocksNode);
|
|
@@ -33260,6 +33356,7 @@ var PptxHandlerRuntime44 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33260
33356
|
const promptText = !hasText && phDefaults?.promptText ? phDefaults.promptText : void 0;
|
|
33261
33357
|
const commonProps = {
|
|
33262
33358
|
id,
|
|
33359
|
+
name: elementName || void 0,
|
|
33263
33360
|
x,
|
|
33264
33361
|
y,
|
|
33265
33362
|
width,
|
|
@@ -33496,12 +33593,14 @@ var PptxHandlerRuntime45 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
33496
33593
|
picSlideRels,
|
|
33497
33594
|
this.orderedSlidePaths
|
|
33498
33595
|
);
|
|
33596
|
+
const picElementName = picCNvPr?.["@_name"] ? String(picCNvPr["@_name"]).trim() : void 0;
|
|
33499
33597
|
const picCNvPicPr = pic?.["p:nvPicPr"]?.["p:cNvPicPr"];
|
|
33500
33598
|
const picLocks = this.parseShapeLocks(
|
|
33501
33599
|
picCNvPicPr?.["a:picLocks"] ?? picCNvPicPr?.["a:spLocks"]
|
|
33502
33600
|
);
|
|
33503
33601
|
return {
|
|
33504
33602
|
id,
|
|
33603
|
+
name: picElementName || void 0,
|
|
33505
33604
|
type: "picture",
|
|
33506
33605
|
x,
|
|
33507
33606
|
y,
|
|
@@ -34048,9 +34147,11 @@ var PptxHandlerRuntime47 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
34048
34147
|
grpSlideRels,
|
|
34049
34148
|
this.orderedSlidePaths
|
|
34050
34149
|
);
|
|
34150
|
+
const grpElementName = grpCNvPr?.["@_name"] ? String(grpCNvPr["@_name"]).trim() : void 0;
|
|
34051
34151
|
const groupElement = {
|
|
34052
34152
|
type: "group",
|
|
34053
34153
|
id: baseId,
|
|
34154
|
+
name: grpElementName || void 0,
|
|
34054
34155
|
x: parentX,
|
|
34055
34156
|
y: parentY,
|
|
34056
34157
|
width: parentW || Math.max(...children.map((c) => c.x + c.width)),
|
|
@@ -37930,6 +38031,7 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
37930
38031
|
if (!fontBinary || fontBinary.length === 0) {
|
|
37931
38032
|
return null;
|
|
37932
38033
|
}
|
|
38034
|
+
const originalPartBytes = new Uint8Array(fontBinary);
|
|
37933
38035
|
let fontData;
|
|
37934
38036
|
let resolvedGuid;
|
|
37935
38037
|
if (isEotFormat(fontBinary)) {
|
|
@@ -37983,7 +38085,9 @@ var PptxHandlerRuntime71 = class extends PptxHandlerRuntime70 {
|
|
|
37983
38085
|
format,
|
|
37984
38086
|
rawFontData: fontData,
|
|
37985
38087
|
partPath: fontPath,
|
|
37986
|
-
fontGuid: resolvedGuid
|
|
38088
|
+
fontGuid: resolvedGuid,
|
|
38089
|
+
originalRId: rId,
|
|
38090
|
+
originalPartBytes
|
|
37987
38091
|
};
|
|
37988
38092
|
} catch {
|
|
37989
38093
|
return null;
|