@aixa-transformation/pptx-viewer 2.0.3 → 2.0.24
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/{Model3DScene-UD6SIIUP.mjs → Model3DScene-QPOSBRM4.mjs} +2 -2
- package/dist/{Model3DScene-AXKDOUCK.js → Model3DScene-VK4AKXGO.js} +3 -3
- package/dist/{SurfaceChart3DScene-JBEJR7Z4.mjs → SurfaceChart3DScene-GIAS6HZ7.mjs} +2 -2
- package/dist/{SurfaceChart3DScene-JU2MS2BP.js → SurfaceChart3DScene-LBHZDSGV.js} +3 -3
- package/dist/{chunk-34H7NGLC.mjs → chunk-45A3IISI.mjs} +8 -2
- package/dist/{chunk-CHHLFKT6.js → chunk-DHNQHQ66.js} +48 -42
- package/dist/{chunk-ODMFBYAP.js → chunk-HUD73YBT.js} +282 -59
- package/dist/{chunk-7H2BJF4H.mjs → chunk-LTBO2ZJC.mjs} +282 -59
- package/dist/chunk-OUD7I3ER.mjs +34907 -0
- package/dist/{chunk-3HJVAFGP.mjs → chunk-RI6OBMEG.mjs} +89 -21
- package/dist/chunk-VFVF632V.js +34921 -0
- package/dist/{chunk-ZIXTDOJD.js → chunk-ZSZ2WR4A.js} +565 -497
- package/dist/{dist-OEO77LEX.mjs → dist-DPZ5B7L7.mjs} +1 -1
- package/dist/{dist-CPLP356W.js → dist-L2EUDG6W.js} +568 -568
- package/dist/index.js +34 -34
- package/dist/index.mjs +4 -4
- package/dist/internals.js +78 -78
- package/dist/internals.mjs +3 -3
- package/dist/pptx-viewer.css +1 -1
- package/dist/presentation.js +2 -2
- package/dist/presentation.mjs +1 -1
- package/dist/viewer/index.js +20 -20
- package/dist/viewer/index.mjs +4 -4
- package/package.json +3 -2
- package/dist/chunk-E4CJYQAL.mjs +0 -34612
- package/dist/chunk-N57QTSTQ.js +0 -34626
|
@@ -17157,6 +17157,11 @@ var PptxSlideLoaderService = class {
|
|
|
17157
17157
|
id: path,
|
|
17158
17158
|
rId,
|
|
17159
17159
|
slideNumber: slideIndex + 1,
|
|
17160
|
+
// Preserve the authoritative slide -> slideLayout relationship on the
|
|
17161
|
+
// loaded model. The editor uses this identity to mark the current
|
|
17162
|
+
// layout in the gallery and to scope layout choices to the slide's
|
|
17163
|
+
// master. Without it, the gallery cannot reliably reflect PowerPoint.
|
|
17164
|
+
layoutPath: layoutPathForOverride,
|
|
17160
17165
|
hidden,
|
|
17161
17166
|
sectionId: sectionMeta?.sectionId,
|
|
17162
17167
|
sectionName: sectionMeta?.sectionName,
|
|
@@ -42214,6 +42219,11 @@ function getSectionSlideRange(zoomElement, slides) {
|
|
|
42214
42219
|
}
|
|
42215
42220
|
var FONT_SUBSTITUTION_MAP = {
|
|
42216
42221
|
// Microsoft Office default fonts
|
|
42222
|
+
// Aptos replaced Calibri as Office's default and is intentionally close in
|
|
42223
|
+
// metrics. Calibri/Calibri Light are better fidelity fallbacks than Segoe UI
|
|
42224
|
+
// (which is wider and makes authored one-line titles wrap).
|
|
42225
|
+
Aptos: ["Calibri", "Arial", "sans-serif"],
|
|
42226
|
+
"Aptos Display": ["Calibri Light", "Calibri", "Arial", "sans-serif"],
|
|
42217
42227
|
Calibri: ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
|
|
42218
42228
|
"Calibri Light": ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
|
|
42219
42229
|
Cambria: ["Caladea", "Liberation Serif", "Times New Roman", "serif"],
|
|
@@ -52742,6 +52752,37 @@ function parseShowProperties(showPr) {
|
|
|
52742
52752
|
}
|
|
52743
52753
|
return props;
|
|
52744
52754
|
}
|
|
52755
|
+
function asArray2(value) {
|
|
52756
|
+
if (value === void 0 || value === null) return [];
|
|
52757
|
+
return Array.isArray(value) ? value : [value];
|
|
52758
|
+
}
|
|
52759
|
+
function resolveSlideLayoutOrder(sldMaster, relationships, resolveTarget) {
|
|
52760
|
+
const layoutRelationships = relationships.filter(
|
|
52761
|
+
(relationship) => String(relationship["@_Type"] ?? "").includes("/slideLayout")
|
|
52762
|
+
);
|
|
52763
|
+
const targetById = new Map(
|
|
52764
|
+
layoutRelationships.map((relationship) => [
|
|
52765
|
+
String(relationship["@_Id"] ?? ""),
|
|
52766
|
+
String(relationship["@_Target"] ?? "")
|
|
52767
|
+
])
|
|
52768
|
+
);
|
|
52769
|
+
const orderedIds = asArray2(xmlChild(sldMaster, "p:sldLayoutIdLst")?.["p:sldLayoutId"]).map((layoutId) => xmlAttr(layoutId, "r:id")).filter((id) => Boolean(id));
|
|
52770
|
+
const orderedTargets = [];
|
|
52771
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
52772
|
+
for (const id of orderedIds) {
|
|
52773
|
+
const target = targetById.get(id);
|
|
52774
|
+
if (target) {
|
|
52775
|
+
orderedTargets.push(resolveTarget(target));
|
|
52776
|
+
usedIds.add(id);
|
|
52777
|
+
}
|
|
52778
|
+
}
|
|
52779
|
+
for (const relationship of layoutRelationships) {
|
|
52780
|
+
const id = String(relationship["@_Id"] ?? "");
|
|
52781
|
+
const target = String(relationship["@_Target"] ?? "");
|
|
52782
|
+
if (target && !usedIds.has(id)) orderedTargets.push(resolveTarget(target));
|
|
52783
|
+
}
|
|
52784
|
+
return orderedTargets;
|
|
52785
|
+
}
|
|
52745
52786
|
function parseMasterColorMap(node) {
|
|
52746
52787
|
if (!node) {
|
|
52747
52788
|
return void 0;
|
|
@@ -55007,7 +55048,22 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
|
|
|
55007
55048
|
}
|
|
55008
55049
|
const type = (xmlAttr(ph, "type") ?? "body").trim();
|
|
55009
55050
|
const idx = xmlAttr(ph, "idx");
|
|
55010
|
-
|
|
55051
|
+
const xfrm = xmlPath(sp, "p:spPr", "a:xfrm");
|
|
55052
|
+
const off = xmlChild(xfrm, "a:off");
|
|
55053
|
+
const ext = xmlChild(xfrm, "a:ext");
|
|
55054
|
+
const emu = _PptxHandlerRuntime.EMU_PER_PX;
|
|
55055
|
+
const x = off ? Number(xmlAttr(off, "x")) / emu : void 0;
|
|
55056
|
+
const y = off ? Number(xmlAttr(off, "y")) / emu : void 0;
|
|
55057
|
+
const width = ext ? Number(xmlAttr(ext, "cx")) / emu : void 0;
|
|
55058
|
+
const height = ext ? Number(xmlAttr(ext, "cy")) / emu : void 0;
|
|
55059
|
+
result.push({
|
|
55060
|
+
type,
|
|
55061
|
+
idx,
|
|
55062
|
+
...Number.isFinite(x) ? { x } : {},
|
|
55063
|
+
...Number.isFinite(y) ? { y } : {},
|
|
55064
|
+
...Number.isFinite(width) ? { width } : {},
|
|
55065
|
+
...Number.isFinite(height) ? { height } : {}
|
|
55066
|
+
});
|
|
55011
55067
|
}
|
|
55012
55068
|
return result;
|
|
55013
55069
|
}
|
|
@@ -55114,12 +55170,13 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
|
|
|
55114
55170
|
const rels = this.ensureArray(
|
|
55115
55171
|
xmlChild(relsData, "Relationships")?.["Relationship"]
|
|
55116
55172
|
);
|
|
55117
|
-
|
|
55118
|
-
|
|
55119
|
-
|
|
55120
|
-
|
|
55121
|
-
|
|
55122
|
-
|
|
55173
|
+
layoutPaths.push(
|
|
55174
|
+
...resolveSlideLayoutOrder(
|
|
55175
|
+
sldMaster,
|
|
55176
|
+
rels,
|
|
55177
|
+
(target) => this.resolveImagePath(path, target)
|
|
55178
|
+
)
|
|
55179
|
+
);
|
|
55123
55180
|
}
|
|
55124
55181
|
const layouts = [];
|
|
55125
55182
|
for (const lp of layoutPaths) {
|
|
@@ -55224,6 +55281,28 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
|
|
|
55224
55281
|
if (!this.layoutXmlMap.has(layoutPath)) {
|
|
55225
55282
|
this.layoutXmlMap.set(layoutPath, data);
|
|
55226
55283
|
}
|
|
55284
|
+
if (!this.slideRelsMap.has(layoutPath)) {
|
|
55285
|
+
const layoutRelsPath = `${layoutPath.replace(
|
|
55286
|
+
"slideLayouts/",
|
|
55287
|
+
"slideLayouts/_rels/"
|
|
55288
|
+
)}.rels`;
|
|
55289
|
+
const layoutRelsXml2 = await this.zip.file(layoutRelsPath)?.async("string");
|
|
55290
|
+
if (layoutRelsXml2) {
|
|
55291
|
+
const layoutRelsData = this.parser.parse(layoutRelsXml2);
|
|
55292
|
+
const relationships = this.ensureArray(
|
|
55293
|
+
xmlChild(layoutRelsData, "Relationships")?.["Relationship"]
|
|
55294
|
+
);
|
|
55295
|
+
const relationshipMap = /* @__PURE__ */ new Map();
|
|
55296
|
+
for (const relationship of relationships) {
|
|
55297
|
+
const id = String(relationship["@_Id"] || "").trim();
|
|
55298
|
+
const target = String(relationship["@_Target"] || "").trim();
|
|
55299
|
+
if (id && target) {
|
|
55300
|
+
relationshipMap.set(id, target);
|
|
55301
|
+
}
|
|
55302
|
+
}
|
|
55303
|
+
this.slideRelsMap.set(layoutPath, relationshipMap);
|
|
55304
|
+
}
|
|
55305
|
+
}
|
|
55227
55306
|
const layout = { path: layoutPath };
|
|
55228
55307
|
const cSldName = (xmlAttr(xmlChild(sldLayout, "p:cSld"), "name") ?? "").trim();
|
|
55229
55308
|
if (cSldName) {
|
|
@@ -58099,9 +58178,13 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58099
58178
|
return [];
|
|
58100
58179
|
}
|
|
58101
58180
|
const result = [];
|
|
58102
|
-
const shapes =
|
|
58181
|
+
const shapes = [
|
|
58182
|
+
...this.ensureArray(spTree["p:sp"]),
|
|
58183
|
+
...this.ensureArray(spTree["p:pic"]),
|
|
58184
|
+
...this.ensureArray(spTree["p:graphicFrame"])
|
|
58185
|
+
];
|
|
58103
58186
|
for (const shape of shapes) {
|
|
58104
|
-
const nvPr = xmlPath(shape, "p:nvSpPr", "p:nvPr");
|
|
58187
|
+
const nvPr = xmlPath(shape, "p:nvSpPr", "p:nvPr") ?? xmlPath(shape, "p:nvPicPr", "p:nvPr") ?? xmlPath(shape, "p:nvGraphicFramePr", "p:nvPr");
|
|
58105
58188
|
const phInfo = this.readPlaceholderInfoFromNvPr(nvPr);
|
|
58106
58189
|
if (!phInfo) {
|
|
58107
58190
|
continue;
|
|
@@ -58130,13 +58213,54 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58130
58213
|
}
|
|
58131
58214
|
return type;
|
|
58132
58215
|
}
|
|
58216
|
+
placeholderRole(phInfo) {
|
|
58217
|
+
const type = phInfo.type || "body";
|
|
58218
|
+
if (type === "title" || type === "ctrtitle") {
|
|
58219
|
+
return "title";
|
|
58220
|
+
}
|
|
58221
|
+
if (type === "body" || type === "obj" || type === "subtitle" || type === "pic" || type === "chart" || type === "tbl" || type === "media") {
|
|
58222
|
+
return "content";
|
|
58223
|
+
}
|
|
58224
|
+
return type;
|
|
58225
|
+
}
|
|
58226
|
+
preferredPlaceholderTypes(element) {
|
|
58227
|
+
switch (element.type) {
|
|
58228
|
+
case "image":
|
|
58229
|
+
return ["pic", "obj"];
|
|
58230
|
+
case "chart":
|
|
58231
|
+
return ["chart", "obj"];
|
|
58232
|
+
case "table":
|
|
58233
|
+
return ["tbl", "obj"];
|
|
58234
|
+
case "video":
|
|
58235
|
+
case "audio":
|
|
58236
|
+
return ["media", "obj"];
|
|
58237
|
+
case "text":
|
|
58238
|
+
return ["body", "subtitle", "obj"];
|
|
58239
|
+
default:
|
|
58240
|
+
return ["obj", "body"];
|
|
58241
|
+
}
|
|
58242
|
+
}
|
|
58243
|
+
placeholderMatchScore(element, source, target) {
|
|
58244
|
+
const sourceType = source.type || "body";
|
|
58245
|
+
const targetType = target.type || "body";
|
|
58246
|
+
const sourceRole = this.placeholderRole(source);
|
|
58247
|
+
const targetRole = this.placeholderRole(target);
|
|
58248
|
+
if (sourceRole !== targetRole) return -1;
|
|
58249
|
+
let score = 0;
|
|
58250
|
+
if (source.idx !== void 0 && target.idx === source.idx) score += 100;
|
|
58251
|
+
if (targetType === sourceType) score += 50;
|
|
58252
|
+
const preferredIndex = this.preferredPlaceholderTypes(element).indexOf(targetType);
|
|
58253
|
+
if (preferredIndex >= 0) score += 30 - preferredIndex * 5;
|
|
58254
|
+
if (targetType === "obj") score += 10;
|
|
58255
|
+
return score;
|
|
58256
|
+
}
|
|
58133
58257
|
// ── Core layout switching logic ─────────────────────────────────────
|
|
58134
58258
|
/**
|
|
58135
58259
|
* Re-map slide elements to a new layout's placeholders.
|
|
58136
58260
|
*
|
|
58137
58261
|
* - Placeholder elements whose type matches a new-layout placeholder
|
|
58138
58262
|
* get their position/size updated to the new layout's values.
|
|
58139
|
-
* - Placeholder elements with no match in the new layout are
|
|
58263
|
+
* - Placeholder elements with no match in the new layout are preserved.
|
|
58140
58264
|
* - New-layout placeholders with no matching slide element produce
|
|
58141
58265
|
* empty text elements that are appended to the slide.
|
|
58142
58266
|
* - Non-placeholder elements are left untouched.
|
|
@@ -58145,10 +58269,9 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58145
58269
|
*/
|
|
58146
58270
|
remapElementsToNewLayout(elements2, newLayoutXml, newLayoutPath) {
|
|
58147
58271
|
const layoutPlaceholders = this.extractLayoutPlaceholders(newLayoutXml);
|
|
58148
|
-
const
|
|
58272
|
+
const targetPlaceholders = [];
|
|
58149
58273
|
for (const lp of layoutPlaceholders) {
|
|
58150
|
-
|
|
58151
|
-
layoutPhMap.set(key, { ...lp, matched: false });
|
|
58274
|
+
targetPlaceholders.push({ ...lp, matched: false });
|
|
58152
58275
|
}
|
|
58153
58276
|
const resultElements = [];
|
|
58154
58277
|
for (const element of elements2) {
|
|
@@ -58157,20 +58280,22 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58157
58280
|
resultElements.push(element);
|
|
58158
58281
|
continue;
|
|
58159
58282
|
}
|
|
58160
|
-
|
|
58161
|
-
|
|
58162
|
-
|
|
58163
|
-
|
|
58164
|
-
|
|
58165
|
-
|
|
58166
|
-
|
|
58167
|
-
|
|
58168
|
-
}
|
|
58283
|
+
let resolvedLayoutPh;
|
|
58284
|
+
let bestScore = -1;
|
|
58285
|
+
for (const candidate of targetPlaceholders) {
|
|
58286
|
+
if (candidate.matched) continue;
|
|
58287
|
+
const score = this.placeholderMatchScore(element, phInfo, candidate.phInfo);
|
|
58288
|
+
if (score > bestScore) {
|
|
58289
|
+
bestScore = score;
|
|
58290
|
+
resolvedLayoutPh = candidate;
|
|
58169
58291
|
}
|
|
58170
58292
|
}
|
|
58171
58293
|
if (resolvedLayoutPh) {
|
|
58172
58294
|
resolvedLayoutPh.matched = true;
|
|
58173
|
-
const updatedElement = {
|
|
58295
|
+
const updatedElement = {
|
|
58296
|
+
...element,
|
|
58297
|
+
rawXml: element.rawXml ? cloneXmlObject(element.rawXml) : element.rawXml
|
|
58298
|
+
};
|
|
58174
58299
|
if (resolvedLayoutPh.cxEmu > 0 && resolvedLayoutPh.cyEmu > 0) {
|
|
58175
58300
|
updatedElement.x = Math.round(resolvedLayoutPh.xEmu / EMU_PER_PX);
|
|
58176
58301
|
updatedElement.y = Math.round(resolvedLayoutPh.yEmu / EMU_PER_PX);
|
|
@@ -58186,10 +58311,15 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58186
58311
|
resolvedLayoutPh.cyEmu
|
|
58187
58312
|
);
|
|
58188
58313
|
}
|
|
58314
|
+
if (updatedElement.rawXml) {
|
|
58315
|
+
this.updateElementRawXmlPlaceholder(updatedElement.rawXml, resolvedLayoutPh.phInfo);
|
|
58316
|
+
}
|
|
58189
58317
|
resultElements.push(updatedElement);
|
|
58318
|
+
} else {
|
|
58319
|
+
resultElements.push(element);
|
|
58190
58320
|
}
|
|
58191
58321
|
}
|
|
58192
|
-
for (const
|
|
58322
|
+
for (const lp of targetPlaceholders) {
|
|
58193
58323
|
if (lp.matched) {
|
|
58194
58324
|
continue;
|
|
58195
58325
|
}
|
|
@@ -58211,6 +58341,24 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
|
|
|
58211
58341
|
}
|
|
58212
58342
|
return resultElements;
|
|
58213
58343
|
}
|
|
58344
|
+
updateElementRawXmlPlaceholder(rawXml, phInfo) {
|
|
58345
|
+
const nvPr = xmlPath(rawXml, "p:nvSpPr", "p:nvPr") ?? xmlPath(rawXml, "p:nvPicPr", "p:nvPr") ?? xmlPath(rawXml, "p:nvGraphicFramePr", "p:nvPr");
|
|
58346
|
+
if (!nvPr) {
|
|
58347
|
+
return;
|
|
58348
|
+
}
|
|
58349
|
+
const ph = nvPr["p:ph"] ?? {};
|
|
58350
|
+
nvPr["p:ph"] = ph;
|
|
58351
|
+
if (phInfo.type) {
|
|
58352
|
+
ph["@_type"] = phInfo.type;
|
|
58353
|
+
} else {
|
|
58354
|
+
delete ph["@_type"];
|
|
58355
|
+
}
|
|
58356
|
+
if (phInfo.idx !== void 0) {
|
|
58357
|
+
ph["@_idx"] = phInfo.idx;
|
|
58358
|
+
} else {
|
|
58359
|
+
delete ph["@_idx"];
|
|
58360
|
+
}
|
|
58361
|
+
}
|
|
58214
58362
|
// ── rawXml transform update ─────────────────────────────────────────
|
|
58215
58363
|
/**
|
|
58216
58364
|
* Update the transform (`a:xfrm`) inside an element's rawXml to
|
|
@@ -66450,7 +66598,7 @@ function ensureChild2(parent, key) {
|
|
|
66450
66598
|
return created;
|
|
66451
66599
|
}
|
|
66452
66600
|
var NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
66453
|
-
function
|
|
66601
|
+
function asArray3(value) {
|
|
66454
66602
|
return Array.isArray(value) ? value : value ? [value] : [];
|
|
66455
66603
|
}
|
|
66456
66604
|
function relationshipBase(strict) {
|
|
@@ -66497,7 +66645,7 @@ var PptxHandlerRuntime49 = class extends PptxHandlerRuntime48 {
|
|
|
66497
66645
|
}
|
|
66498
66646
|
const relsData = this.parser.parse(relsXml);
|
|
66499
66647
|
const relsRoot = relsData["Relationships"] ?? {};
|
|
66500
|
-
const relationships =
|
|
66648
|
+
const relationships = asArray3(relsRoot["Relationship"]);
|
|
66501
66649
|
const usedIds = new Set(relationships.map((rel) => String(rel["@_Id"] ?? "")));
|
|
66502
66650
|
let index = 1;
|
|
66503
66651
|
while (usedIds.has(`rId${index}`)) {
|
|
@@ -66581,7 +66729,7 @@ var PptxHandlerRuntime49 = class extends PptxHandlerRuntime48 {
|
|
|
66581
66729
|
}
|
|
66582
66730
|
const data = this.parser.parse(xml);
|
|
66583
66731
|
const root = data["Types"] ?? {};
|
|
66584
|
-
const overrides10 =
|
|
66732
|
+
const overrides10 = asArray3(root["Override"]);
|
|
66585
66733
|
if (!overrides10.some((entry) => entry["@_PartName"] === partName)) {
|
|
66586
66734
|
overrides10.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
66587
66735
|
}
|
|
@@ -66591,7 +66739,7 @@ var PptxHandlerRuntime49 = class extends PptxHandlerRuntime48 {
|
|
|
66591
66739
|
}
|
|
66592
66740
|
};
|
|
66593
66741
|
var HANDOUT_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml";
|
|
66594
|
-
function
|
|
66742
|
+
function asArray4(value) {
|
|
66595
66743
|
return Array.isArray(value) ? value : value ? [value] : [];
|
|
66596
66744
|
}
|
|
66597
66745
|
function relationshipBase2(strict) {
|
|
@@ -66622,7 +66770,7 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
66622
66770
|
}
|
|
66623
66771
|
const relsData = this.parser.parse(relsXml);
|
|
66624
66772
|
const relsRoot = relsData["Relationships"] ?? {};
|
|
66625
|
-
const relationships =
|
|
66773
|
+
const relationships = asArray4(relsRoot["Relationship"]);
|
|
66626
66774
|
const target = masterPath.startsWith("ppt/") ? masterPath.slice(4) : masterPath;
|
|
66627
66775
|
let relationship = relationships.find(
|
|
66628
66776
|
(rel) => String(rel["@_Type"] ?? "").endsWith("/handoutMaster") && String(rel["@_Target"] ?? "").replace(/^\.\//u, "") === target
|
|
@@ -66655,7 +66803,7 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
66655
66803
|
if (existingXml) {
|
|
66656
66804
|
const data = this.parser.parse(existingXml);
|
|
66657
66805
|
const root = data["Relationships"] ?? {};
|
|
66658
|
-
const relationships =
|
|
66806
|
+
const relationships = asArray4(root["Relationship"]);
|
|
66659
66807
|
if (relationships.some((rel) => String(rel["@_Type"] ?? "").endsWith("/theme"))) {
|
|
66660
66808
|
return;
|
|
66661
66809
|
}
|
|
@@ -66766,7 +66914,7 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
66766
66914
|
}
|
|
66767
66915
|
const data = this.parser.parse(xml);
|
|
66768
66916
|
const root = data["Types"] ?? {};
|
|
66769
|
-
const overrides10 =
|
|
66917
|
+
const overrides10 = asArray4(root["Override"]);
|
|
66770
66918
|
const partName = `/${masterPath}`;
|
|
66771
66919
|
if (!overrides10.some((entry) => entry["@_PartName"] === partName)) {
|
|
66772
66920
|
overrides10.push({ "@_PartName": partName, "@_ContentType": HANDOUT_MASTER_CONTENT_TYPE });
|
|
@@ -67557,12 +67705,20 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
|
|
|
67557
67705
|
}
|
|
67558
67706
|
const phKey = this.buildPlaceholderDefaultsKey(phInfo);
|
|
67559
67707
|
const layoutMap = this.layoutPlaceholderDefaultsCache.get(layoutPath);
|
|
67560
|
-
const
|
|
67708
|
+
const lookupDefaults = (map) => {
|
|
67709
|
+
const exact = map?.get(phKey);
|
|
67710
|
+
if (exact || phInfo.type !== void 0 || phInfo.idx === void 0) {
|
|
67711
|
+
return exact;
|
|
67712
|
+
}
|
|
67713
|
+
return map?.get(`obj_${phInfo.idx}`) ?? map?.get(`body_${phInfo.idx}`);
|
|
67714
|
+
};
|
|
67715
|
+
const layoutDefaults = lookupDefaults(layoutMap);
|
|
67561
67716
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
67562
67717
|
const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
|
|
67563
|
-
const masterDefaults = masterMap
|
|
67718
|
+
const masterDefaults = lookupDefaults(masterMap);
|
|
67564
67719
|
const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
|
|
67565
|
-
const
|
|
67720
|
+
const effectivePlaceholderType = phInfo.type ?? "obj";
|
|
67721
|
+
const masterTextStyleType = effectivePlaceholderType === "title" || effectivePlaceholderType === "ctrtitle" ? "title" : effectivePlaceholderType === "body" || effectivePlaceholderType === "obj" || effectivePlaceholderType === "subtitle" ? "body" : "other";
|
|
67566
67722
|
const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
|
|
67567
67723
|
const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
|
|
67568
67724
|
const resolvedMasterDefaults = masterTextLevels ? {
|
|
@@ -68246,6 +68402,17 @@ var PptxHandlerRuntime58 = class _PptxHandlerRuntime24 extends PptxHandlerRuntim
|
|
|
68246
68402
|
return void 0;
|
|
68247
68403
|
}
|
|
68248
68404
|
};
|
|
68405
|
+
function parseOoxmlPercentage(value) {
|
|
68406
|
+
const raw = String(value ?? "").trim();
|
|
68407
|
+
if (!raw) {
|
|
68408
|
+
return void 0;
|
|
68409
|
+
}
|
|
68410
|
+
const numeric = Number.parseFloat(raw.endsWith("%") ? raw.slice(0, -1) : raw);
|
|
68411
|
+
if (!Number.isFinite(numeric)) {
|
|
68412
|
+
return void 0;
|
|
68413
|
+
}
|
|
68414
|
+
return raw.endsWith("%") ? numeric / 100 : numeric / 1e5;
|
|
68415
|
+
}
|
|
68249
68416
|
var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
68250
68417
|
/**
|
|
68251
68418
|
* Apply {@link PlaceholderDefaults} body-level properties to a
|
|
@@ -68292,12 +68459,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
68292
68459
|
if (Number.isFinite(spacingPointsRaw)) {
|
|
68293
68460
|
return this.pointsToPixels(spacingPointsRaw / 100);
|
|
68294
68461
|
}
|
|
68295
|
-
const
|
|
68296
|
-
|
|
68297
|
-
10
|
|
68462
|
+
const spacingPercent = parseOoxmlPercentage(
|
|
68463
|
+
spacingNode["a:spcPct"]?.["@_val"]
|
|
68298
68464
|
);
|
|
68299
|
-
if (
|
|
68300
|
-
return
|
|
68465
|
+
if (spacingPercent !== void 0 && typeof basisFontSizePx === "number" && basisFontSizePx > 0) {
|
|
68466
|
+
return spacingPercent * basisFontSizePx;
|
|
68301
68467
|
}
|
|
68302
68468
|
return void 0;
|
|
68303
68469
|
}
|
|
@@ -68305,12 +68471,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
68305
68471
|
if (!lineSpacingNode) {
|
|
68306
68472
|
return void 0;
|
|
68307
68473
|
}
|
|
68308
|
-
const
|
|
68309
|
-
|
|
68310
|
-
10
|
|
68474
|
+
const spacingPercent = parseOoxmlPercentage(
|
|
68475
|
+
lineSpacingNode["a:spcPct"]?.["@_val"]
|
|
68311
68476
|
);
|
|
68312
|
-
if (
|
|
68313
|
-
return Math.max(0.1, Math.min(5,
|
|
68477
|
+
if (spacingPercent !== void 0) {
|
|
68478
|
+
return Math.max(0.1, Math.min(5, spacingPercent));
|
|
68314
68479
|
}
|
|
68315
68480
|
return void 0;
|
|
68316
68481
|
}
|
|
@@ -68348,8 +68513,13 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
|
|
|
68348
68513
|
if (textStyle.italic === void 0 && levelStyle.italic !== void 0) {
|
|
68349
68514
|
textStyle.italic = levelStyle.italic;
|
|
68350
68515
|
}
|
|
68351
|
-
if (textStyle.color === void 0
|
|
68352
|
-
|
|
68516
|
+
if (textStyle.color === void 0) {
|
|
68517
|
+
const currentSlideColor = levelStyle.colorXml ? this.parseColor(levelStyle.colorXml) : void 0;
|
|
68518
|
+
if (currentSlideColor !== void 0) {
|
|
68519
|
+
textStyle.color = currentSlideColor;
|
|
68520
|
+
} else if (levelStyle.color !== void 0) {
|
|
68521
|
+
textStyle.color = levelStyle.color;
|
|
68522
|
+
}
|
|
68353
68523
|
}
|
|
68354
68524
|
if (textStyle.paragraphMarginLeft === void 0 && levelStyle.marginLeft !== void 0) {
|
|
68355
68525
|
textStyle.paragraphMarginLeft = levelStyle.marginLeft;
|
|
@@ -69314,25 +69484,31 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
|
|
|
69314
69484
|
"mc:AlternateContent",
|
|
69315
69485
|
"a:br"
|
|
69316
69486
|
]);
|
|
69487
|
+
const paragraphRuns = this.ensureArray(p["a:r"]);
|
|
69488
|
+
const paragraphBreaks = this.ensureArray(p["a:br"]);
|
|
69489
|
+
const hasCollapsedRunBreakOrder = paragraphRuns.length > 1 && paragraphBreaks.length > 0;
|
|
69317
69490
|
for (const key of Object.keys(p)) {
|
|
69318
69491
|
if (!contentTagSet.has(key)) {
|
|
69319
69492
|
continue;
|
|
69320
69493
|
}
|
|
69321
69494
|
const items = this.ensureArray(p[key]);
|
|
69322
|
-
const
|
|
69323
|
-
const
|
|
69324
|
-
const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
|
|
69495
|
+
const breakCount = paragraphBreaks.length;
|
|
69496
|
+
const insertCollapsedBreaks = key === "a:r" && hasCollapsedRunBreakOrder;
|
|
69325
69497
|
for (const [itemIndex, item] of items.entries()) {
|
|
69326
69498
|
switch (key) {
|
|
69327
69499
|
case "a:r": {
|
|
69328
69500
|
processRun(item);
|
|
69329
|
-
if (insertCollapsedBreaks && itemIndex <
|
|
69330
|
-
|
|
69331
|
-
|
|
69332
|
-
|
|
69333
|
-
|
|
69334
|
-
|
|
69335
|
-
|
|
69501
|
+
if (insertCollapsedBreaks && itemIndex < items.length - 1) {
|
|
69502
|
+
const gapCount = items.length - 1;
|
|
69503
|
+
const breaksHere = Math.floor(breakCount / gapCount) + (itemIndex < breakCount % gapCount ? 1 : 0);
|
|
69504
|
+
for (let breakIndex = 0; breakIndex < breaksHere; breakIndex++) {
|
|
69505
|
+
parts.push("\n");
|
|
69506
|
+
segments.push({
|
|
69507
|
+
text: "\n",
|
|
69508
|
+
style: { ...mergedDefaultRunStyle },
|
|
69509
|
+
isLineBreak: true
|
|
69510
|
+
});
|
|
69511
|
+
}
|
|
69336
69512
|
}
|
|
69337
69513
|
break;
|
|
69338
69514
|
}
|
|
@@ -69353,7 +69529,7 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
|
|
|
69353
69529
|
processAlternateContent(item);
|
|
69354
69530
|
break;
|
|
69355
69531
|
case "a:br": {
|
|
69356
|
-
if (
|
|
69532
|
+
if (hasCollapsedRunBreakOrder) {
|
|
69357
69533
|
break;
|
|
69358
69534
|
}
|
|
69359
69535
|
const brNode = item ?? {};
|
|
@@ -69377,6 +69553,14 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
|
|
|
69377
69553
|
}
|
|
69378
69554
|
}
|
|
69379
69555
|
}
|
|
69556
|
+
const markerSegment = segments.find((segment) => segment.bulletInfo);
|
|
69557
|
+
const firstVisibleRun = segments.find(
|
|
69558
|
+
(segment) => !segment.bulletInfo && segment.text !== "\n" && segment.text.length > 0
|
|
69559
|
+
);
|
|
69560
|
+
if (markerSegment && firstVisibleRun) {
|
|
69561
|
+
markerSegment.style = { ...firstVisibleRun.style };
|
|
69562
|
+
seedStyle = { ...firstVisibleRun.style };
|
|
69563
|
+
}
|
|
69380
69564
|
if (pIdx < paraCount - 1) {
|
|
69381
69565
|
parts.push("\n");
|
|
69382
69566
|
segments.push({ text: "\n", style: { ...mergedDefaultRunStyle } });
|
|
@@ -71676,10 +71860,14 @@ var PptxHandlerRuntime72 = class _PptxHandlerRuntime31 extends PptxHandlerRuntim
|
|
|
71676
71860
|
if (defRPr["@_i"] !== void 0) {
|
|
71677
71861
|
style.italic = defRPr["@_i"] === "1";
|
|
71678
71862
|
}
|
|
71679
|
-
const
|
|
71863
|
+
const colorXml2 = defRPr["a:solidFill"];
|
|
71864
|
+
const color2 = this.parseColor(colorXml2);
|
|
71680
71865
|
if (color2) {
|
|
71681
71866
|
style.color = color2;
|
|
71682
71867
|
}
|
|
71868
|
+
if (colorXml2) {
|
|
71869
|
+
style.colorXml = colorXml2;
|
|
71870
|
+
}
|
|
71683
71871
|
const latin = defRPr["a:latin"];
|
|
71684
71872
|
if (latin?.["@_typeface"]) {
|
|
71685
71873
|
const typeface = String(latin["@_typeface"]);
|
|
@@ -76623,12 +76811,47 @@ var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
|
|
|
76623
76811
|
const kinsoku = this.extractKinsoku();
|
|
76624
76812
|
const customerData = await this.parsePresentationCustomerData();
|
|
76625
76813
|
this.thumbnailData = await this.parseThumbnail() ?? null;
|
|
76814
|
+
const previousEagerDecodeImages = this.eagerDecodeImages;
|
|
76815
|
+
this.eagerDecodeImages = true;
|
|
76816
|
+
try {
|
|
76817
|
+
for (const master of slideMasters) {
|
|
76818
|
+
for (const layout of master.layouts ?? []) {
|
|
76819
|
+
const previewSlidePath = `ppt/slides/__layout_preview_${layout.path.split("/").pop()}`;
|
|
76820
|
+
this.slideRelsMap.set(
|
|
76821
|
+
previewSlidePath,
|
|
76822
|
+
/* @__PURE__ */ new Map([["rIdLayoutPreview", `/${layout.path}`]])
|
|
76823
|
+
);
|
|
76824
|
+
this.layoutCache.delete(layout.path);
|
|
76825
|
+
layout.elements = await this.getLayoutElements(previewSlidePath);
|
|
76826
|
+
this.slideRelsMap.delete(previewSlidePath);
|
|
76827
|
+
layout.backgroundColor ??= master.backgroundColor;
|
|
76828
|
+
}
|
|
76829
|
+
}
|
|
76830
|
+
} finally {
|
|
76831
|
+
this.eagerDecodeImages = previousEagerDecodeImages;
|
|
76832
|
+
}
|
|
76833
|
+
const layoutPreviewMap = new Map(
|
|
76834
|
+
slideMasters.flatMap(
|
|
76835
|
+
(master) => (master.layouts ?? []).map((layout) => [layout.path, layout])
|
|
76836
|
+
)
|
|
76837
|
+
);
|
|
76838
|
+
const layoutOptions = this.getLayoutOptions().map((option) => {
|
|
76839
|
+
const preview = layoutPreviewMap.get(option.path);
|
|
76840
|
+
return preview ? {
|
|
76841
|
+
...option,
|
|
76842
|
+
previewElements: preview.elements,
|
|
76843
|
+
previewBackgroundColor: preview.backgroundColor,
|
|
76844
|
+
previewWidth: presentationState.width,
|
|
76845
|
+
previewHeight: presentationState.height,
|
|
76846
|
+
previewPlaceholders: preview.placeholders
|
|
76847
|
+
} : option;
|
|
76848
|
+
});
|
|
76626
76849
|
return new PptxLoadDataBuilder().withDimensions(
|
|
76627
76850
|
presentationState.width,
|
|
76628
76851
|
presentationState.height,
|
|
76629
76852
|
this.rawSlideWidthEmu,
|
|
76630
76853
|
this.rawSlideHeightEmu
|
|
76631
|
-
).withNotesDimensions(presentationState.notesWidthEmu, presentationState.notesHeightEmu).withSlides(slidesWithWarnings).withLayoutOptions(
|
|
76854
|
+
).withNotesDimensions(presentationState.notesWidthEmu, presentationState.notesHeightEmu).withSlides(slidesWithWarnings).withLayoutOptions(layoutOptions).withHeaderFooter(headerFooter).withPresentationProperties(presentationProperties).withViewProperties(viewProperties).withCustomShows(customShows).withSections(
|
|
76632
76855
|
presentationState.orderedSections.length > 0 ? presentationState.orderedSections : void 0
|
|
76633
76856
|
).withWarnings(this.compatibilityService.getWarnings()).withThemeColorMap({ ...this.themeColorMap }).withTheme(this.buildThemeObject()).withThemeOptions(themeOptions.length > 0 ? themeOptions : void 0).withTableStyleMap(tableStyleMap).withEmbeddedFonts(embeddedFonts.length > 0 ? embeddedFonts : void 0).withEmbeddedFontList(embeddedFontList).withMruColors(presentationProperties?.mruColors).withNotesMaster(notesMaster).withHandoutMaster(handoutMaster).withSlideMasters(slideMasters.length > 0 ? slideMasters : void 0).withTags(tags.length > 0 ? tags : void 0).withCustomProperties(customProperties.length > 0 ? customProperties : void 0).withCoreProperties(coreProperties).withAppProperties(appProperties).withHasMacros(this.vbaProjectBin !== null ? true : void 0).withHasDigitalSignatures(this.signatureDetection?.hasSignatures || void 0).withDigitalSignatureCount(
|
|
76634
76857
|
this.signatureDetection?.signatureCount && this.signatureDetection.signatureCount > 0 ? this.signatureDetection.signatureCount : void 0
|