ooxml-core 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-6ZGALYYM.cjs} +2 -2
- package/dist/{PptxHandler-5QBRBXRX.mjs → PptxHandler-HEPPGI32.mjs} +2 -2
- package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-NO7MNGOW.mjs} +1 -1
- package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-BCDRASRT.mjs} +2 -2
- package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-HFGK2BWN.cjs} +4 -4
- package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-OQOZE76H.mjs} +1 -1
- package/dist/{chunk-KONCS53X.mjs → chunk-4SGBL2H4.mjs} +4 -4
- package/dist/{chunk-ZXPPM63Y.mjs → chunk-63GRFYAN.mjs} +1 -1
- package/dist/{chunk-K6OFJ5GJ.mjs → chunk-7E45SAZJ.mjs} +201 -175
- package/dist/{chunk-EBJ724RB.mjs → chunk-ANIFYTKH.mjs} +1 -1
- package/dist/{chunk-EEHK52XB.cjs → chunk-HYCOBPCC.cjs} +201 -175
- package/dist/{chunk-4IIR2QEH.mjs → chunk-KE2FUFIU.mjs} +202 -176
- package/dist/{chunk-DNYZX6YG.mjs → chunk-VRJOOHWV.mjs} +1 -1
- package/dist/pptx/automation/index.cjs +209 -182
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts → index-CbFowkp4.d.ts} +3 -3
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts → index-D4FnOx6x.d.ts} +2 -2
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-B94RKk84.d.ts → index-D8DNpc1X.d.ts} +14 -4
- package/dist/pptx/chunks/{index-B94RKk84.d.ts.map → index-D8DNpc1X.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +209 -182
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +209 -182
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-
|
|
1
|
+
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-VRJOOHWV.mjs';
|
|
2
2
|
|
|
3
3
|
// pptx/converter/media-context.ts
|
|
4
4
|
var MIME_TO_EXT = {
|
|
@@ -36385,7 +36385,10 @@ async function resolveBulletImage(imageRelId, slidePath, resolver) {
|
|
|
36385
36385
|
if (!target) {
|
|
36386
36386
|
return void 0;
|
|
36387
36387
|
}
|
|
36388
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
36388
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
36389
|
+
return resolver.allowExternalImages ? target : void 0;
|
|
36390
|
+
}
|
|
36391
|
+
if (target.startsWith("data:")) {
|
|
36389
36392
|
return target;
|
|
36390
36393
|
}
|
|
36391
36394
|
const imagePath = resolver.resolveImagePath(slidePath, target);
|
|
@@ -50518,6 +50521,152 @@ function applyCommonViewContainer(root, name, props) {
|
|
|
50518
50521
|
root[key2] = container;
|
|
50519
50522
|
}
|
|
50520
50523
|
|
|
50524
|
+
// pptx/core/core/runtime/chart-part-registration.ts
|
|
50525
|
+
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50526
|
+
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50527
|
+
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50528
|
+
function asArray3(value) {
|
|
50529
|
+
if (value === void 0 || value === null) {
|
|
50530
|
+
return [];
|
|
50531
|
+
}
|
|
50532
|
+
return (Array.isArray(value) ? value : [value]).filter(
|
|
50533
|
+
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
50534
|
+
);
|
|
50535
|
+
}
|
|
50536
|
+
function nextFreeChartPartPath(zip, directory) {
|
|
50537
|
+
let n = 1;
|
|
50538
|
+
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
50539
|
+
n += 1;
|
|
50540
|
+
}
|
|
50541
|
+
return `${directory}/chart${n}.xml`;
|
|
50542
|
+
}
|
|
50543
|
+
function resolvePartTarget(fromPart, target) {
|
|
50544
|
+
if (target.startsWith("/")) {
|
|
50545
|
+
return target.slice(1);
|
|
50546
|
+
}
|
|
50547
|
+
const segments = fromPart.split("/").slice(0, -1);
|
|
50548
|
+
for (const segment of target.split("/")) {
|
|
50549
|
+
if (segment === "..") {
|
|
50550
|
+
segments.pop();
|
|
50551
|
+
} else if (segment !== "." && segment !== "") {
|
|
50552
|
+
segments.push(segment);
|
|
50553
|
+
}
|
|
50554
|
+
}
|
|
50555
|
+
return segments.join("/");
|
|
50556
|
+
}
|
|
50557
|
+
function relativePartTarget2(fromPart, toPart) {
|
|
50558
|
+
const from = fromPart.split("/").slice(0, -1);
|
|
50559
|
+
const to = toPart.split("/");
|
|
50560
|
+
let common = 0;
|
|
50561
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
50562
|
+
common += 1;
|
|
50563
|
+
}
|
|
50564
|
+
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
50565
|
+
}
|
|
50566
|
+
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
50567
|
+
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
50568
|
+
if (!xml) {
|
|
50569
|
+
return;
|
|
50570
|
+
}
|
|
50571
|
+
const tree = deps.parser.parse(xml);
|
|
50572
|
+
const types = tree["Types"] ?? {};
|
|
50573
|
+
const overrides = asArray3(types["Override"]);
|
|
50574
|
+
const partName = `/${partPath}`;
|
|
50575
|
+
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
50576
|
+
return;
|
|
50577
|
+
}
|
|
50578
|
+
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
50579
|
+
types["Override"] = overrides;
|
|
50580
|
+
tree["Types"] = types;
|
|
50581
|
+
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
50582
|
+
}
|
|
50583
|
+
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
50584
|
+
const slash = slidePath.lastIndexOf("/");
|
|
50585
|
+
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
50586
|
+
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
50587
|
+
if (!xml) {
|
|
50588
|
+
return void 0;
|
|
50589
|
+
}
|
|
50590
|
+
const tree = deps.parser.parse(xml);
|
|
50591
|
+
const root = tree["Relationships"];
|
|
50592
|
+
const relationships2 = asArray3(root?.["Relationship"]);
|
|
50593
|
+
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
50594
|
+
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
50595
|
+
);
|
|
50596
|
+
if (!match || !root) {
|
|
50597
|
+
return void 0;
|
|
50598
|
+
}
|
|
50599
|
+
match["@_Type"] = rewrite.relationshipType;
|
|
50600
|
+
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
50601
|
+
delete match["@_TargetMode"];
|
|
50602
|
+
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
50603
|
+
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
50604
|
+
return String(match["@_Id"]);
|
|
50605
|
+
}
|
|
50606
|
+
function rebindGraphicData(node, relationshipId, extended) {
|
|
50607
|
+
for (const key2 of Object.keys(node)) {
|
|
50608
|
+
delete node[key2];
|
|
50609
|
+
}
|
|
50610
|
+
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
50611
|
+
if (extended) {
|
|
50612
|
+
node["cx:chart"] = {
|
|
50613
|
+
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
50614
|
+
"@_xmlns:r": NS_R,
|
|
50615
|
+
"@_r:id": relationshipId
|
|
50616
|
+
};
|
|
50617
|
+
} else {
|
|
50618
|
+
node["c:chart"] = {
|
|
50619
|
+
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
50620
|
+
"@_xmlns:r": NS_R,
|
|
50621
|
+
"@_r:id": relationshipId
|
|
50622
|
+
};
|
|
50623
|
+
}
|
|
50624
|
+
}
|
|
50625
|
+
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
50626
|
+
if (!node || typeof node !== "object") {
|
|
50627
|
+
return 0;
|
|
50628
|
+
}
|
|
50629
|
+
if (Array.isArray(node)) {
|
|
50630
|
+
return node.reduce(
|
|
50631
|
+
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
50632
|
+
0
|
|
50633
|
+
);
|
|
50634
|
+
}
|
|
50635
|
+
const object = node;
|
|
50636
|
+
let count = 0;
|
|
50637
|
+
for (const key2 of Object.keys(object)) {
|
|
50638
|
+
if (key2.startsWith("@_")) {
|
|
50639
|
+
continue;
|
|
50640
|
+
}
|
|
50641
|
+
const value = object[key2];
|
|
50642
|
+
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
50643
|
+
for (const candidate of asArray3(value)) {
|
|
50644
|
+
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
50645
|
+
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
50646
|
+
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
50647
|
+
rebindGraphicData(candidate, relationshipId, extended);
|
|
50648
|
+
count += 1;
|
|
50649
|
+
}
|
|
50650
|
+
}
|
|
50651
|
+
continue;
|
|
50652
|
+
}
|
|
50653
|
+
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
50654
|
+
}
|
|
50655
|
+
return count;
|
|
50656
|
+
}
|
|
50657
|
+
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
50658
|
+
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
50659
|
+
if (!xml) {
|
|
50660
|
+
return 0;
|
|
50661
|
+
}
|
|
50662
|
+
const tree = deps.parser.parse(xml);
|
|
50663
|
+
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
50664
|
+
if (count > 0) {
|
|
50665
|
+
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
50666
|
+
}
|
|
50667
|
+
return count;
|
|
50668
|
+
}
|
|
50669
|
+
|
|
50521
50670
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
50522
50671
|
var METHODS = /* @__PURE__ */ new Set(["cycle", "withinLinear", "acrossLinear"]);
|
|
50523
50672
|
var COLOR_NAMES = /* @__PURE__ */ new Set(["scrgbClr", "srgbClr", "hslClr", "sysClr", "schemeClr", "prstClr"]);
|
|
@@ -50587,7 +50736,7 @@ function buildChartExLegend(legendPosition) {
|
|
|
50587
50736
|
// pptx/core/utils/chart-cx-generator.ts
|
|
50588
50737
|
var NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50589
50738
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
50590
|
-
var
|
|
50739
|
+
var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50591
50740
|
var NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50592
50741
|
function points4(values) {
|
|
50593
50742
|
return values.map((value, index) => ({ "@_idx": String(index), "#text": String(value) }));
|
|
@@ -50782,7 +50931,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
50782
50931
|
const chartSpace = {
|
|
50783
50932
|
"@_xmlns:cx": NS_CX,
|
|
50784
50933
|
"@_xmlns:a": NS_A,
|
|
50785
|
-
"@_xmlns:r":
|
|
50934
|
+
"@_xmlns:r": NS_R2,
|
|
50786
50935
|
"cx:chartData": {
|
|
50787
50936
|
"cx:data": chartData.series.map(
|
|
50788
50937
|
(series, index) => buildChartExData(chartData, series, index)
|
|
@@ -52345,7 +52494,7 @@ function buildGeneratedSeriesSpPr(series, family) {
|
|
|
52345
52494
|
// pptx/core/utils/chart-xml-generator.ts
|
|
52346
52495
|
var NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
52347
52496
|
var NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
52348
|
-
var
|
|
52497
|
+
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
52349
52498
|
var CAT_AX_ID = 111111111;
|
|
52350
52499
|
var VAL_AX_ID = 222222222;
|
|
52351
52500
|
var SER_AX_ID = 333333333;
|
|
@@ -52551,7 +52700,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
52551
52700
|
"c:chartSpace": {
|
|
52552
52701
|
"@_xmlns:c": NS_C2,
|
|
52553
52702
|
"@_xmlns:a": NS_A2,
|
|
52554
|
-
"@_xmlns:r":
|
|
52703
|
+
"@_xmlns:r": NS_R3,
|
|
52555
52704
|
"c:chart": chart
|
|
52556
52705
|
}
|
|
52557
52706
|
};
|
|
@@ -54600,7 +54749,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
|
|
|
54600
54749
|
}
|
|
54601
54750
|
return rPr;
|
|
54602
54751
|
}
|
|
54603
|
-
function
|
|
54752
|
+
function asArray4(value) {
|
|
54604
54753
|
if (Array.isArray(value)) {
|
|
54605
54754
|
return value;
|
|
54606
54755
|
}
|
|
@@ -54619,7 +54768,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54619
54768
|
return txKey;
|
|
54620
54769
|
}
|
|
54621
54770
|
const pKey = findKey19(rich, "p", getLocalName2) ?? "a:p";
|
|
54622
|
-
const paragraphs =
|
|
54771
|
+
const paragraphs = asArray4(rich[pKey]).map((para) => {
|
|
54623
54772
|
const next = { ...para };
|
|
54624
54773
|
const pPrKey = findKey19(next, "pPr", getLocalName2) ?? "a:pPr";
|
|
54625
54774
|
const pPr = { ...chunkMU3XSASV_cjs.ensureXmlChildOrCreate(next, pPrKey, "first") };
|
|
@@ -54632,7 +54781,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54632
54781
|
next[pPrKey] = pPr;
|
|
54633
54782
|
const rKey = findKey19(next, "r", getLocalName2);
|
|
54634
54783
|
if (rKey) {
|
|
54635
|
-
const runs =
|
|
54784
|
+
const runs = asArray4(next[rKey]).map((run2) => {
|
|
54636
54785
|
const rPrKey = findKey19(run2, "rPr", getLocalName2) ?? "a:rPr";
|
|
54637
54786
|
const existingRPr = run2[rPrKey] ?? {};
|
|
54638
54787
|
const nextRun = { ...run2 };
|
|
@@ -54996,7 +55145,7 @@ function saveChartPartThroughNeutral(xml, before, after) {
|
|
|
54996
55145
|
function findKey20(node, localName15, getLocalName2) {
|
|
54997
55146
|
return Object.keys(node).find((key2) => getLocalName2(key2) === localName15);
|
|
54998
55147
|
}
|
|
54999
|
-
function
|
|
55148
|
+
function asArray5(value) {
|
|
55000
55149
|
if (value === void 0 || value === null) {
|
|
55001
55150
|
return [];
|
|
55002
55151
|
}
|
|
@@ -55010,8 +55159,8 @@ function dimensionType(node) {
|
|
|
55010
55159
|
function replaceLevels(target, source, getLocalName2) {
|
|
55011
55160
|
const targetKey = findKey20(target, "lvl", getLocalName2) ?? "cx:lvl";
|
|
55012
55161
|
const sourceKey = findKey20(source, "lvl", getLocalName2);
|
|
55013
|
-
const oldLevels =
|
|
55014
|
-
const newLevels =
|
|
55162
|
+
const oldLevels = asArray5(target[targetKey]);
|
|
55163
|
+
const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
|
|
55015
55164
|
const old = oldLevels[index];
|
|
55016
55165
|
if (!old) {
|
|
55017
55166
|
return level;
|
|
@@ -55030,8 +55179,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
|
|
|
55030
55179
|
for (const kind of ["strDim", "numDim"]) {
|
|
55031
55180
|
const targetKey = findKey20(target, kind, getLocalName2) ?? `cx:${kind}`;
|
|
55032
55181
|
const freshKey = findKey20(fresh, kind, getLocalName2);
|
|
55033
|
-
const existing =
|
|
55034
|
-
const incoming =
|
|
55182
|
+
const existing = asArray5(target[targetKey]);
|
|
55183
|
+
const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
|
|
55035
55184
|
for (const dimension of incoming) {
|
|
55036
55185
|
const wantedType = dimensionType(dimension);
|
|
55037
55186
|
let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
|
|
@@ -55065,7 +55214,7 @@ function child13(node, localName15, getLocalName2) {
|
|
|
55065
55214
|
const value = key2 ? node[key2] : void 0;
|
|
55066
55215
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
55067
55216
|
}
|
|
55068
|
-
function
|
|
55217
|
+
function asArray6(value) {
|
|
55069
55218
|
if (value === void 0 || value === null) {
|
|
55070
55219
|
return [];
|
|
55071
55220
|
}
|
|
@@ -55247,7 +55396,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
|
|
|
55247
55396
|
getLocalName2
|
|
55248
55397
|
);
|
|
55249
55398
|
const seriesKey = region ? findKey21(region, "series", getLocalName2) : void 0;
|
|
55250
|
-
const first2 = region && seriesKey ?
|
|
55399
|
+
const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
|
|
55251
55400
|
const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
|
|
55252
55401
|
const series = chartData.series[0];
|
|
55253
55402
|
if (!existing || !series) {
|
|
@@ -55265,9 +55414,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
|
|
|
55265
55414
|
const chartDataKey = findKey21(chartSpace, "chartData", getLocalName2);
|
|
55266
55415
|
const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
|
|
55267
55416
|
const dataKey = findKey21(chartDataNode, "data", getLocalName2) ?? "cx:data";
|
|
55268
|
-
const dataNodes =
|
|
55417
|
+
const dataNodes = asArray6(chartDataNode[dataKey]);
|
|
55269
55418
|
const seriesKey = findKey21(region, "series", getLocalName2) ?? "cx:series";
|
|
55270
|
-
const existing =
|
|
55419
|
+
const existing = asArray6(region[seriesKey]);
|
|
55271
55420
|
const updated = [];
|
|
55272
55421
|
chartData.series.forEach((series, index) => {
|
|
55273
55422
|
const node = existing[index];
|
|
@@ -55337,152 +55486,6 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
55337
55486
|
);
|
|
55338
55487
|
}
|
|
55339
55488
|
|
|
55340
|
-
// pptx/core/core/runtime/chart-part-registration.ts
|
|
55341
|
-
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
55342
|
-
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
55343
|
-
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
55344
|
-
function asArray6(value) {
|
|
55345
|
-
if (value === void 0 || value === null) {
|
|
55346
|
-
return [];
|
|
55347
|
-
}
|
|
55348
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
55349
|
-
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
55350
|
-
);
|
|
55351
|
-
}
|
|
55352
|
-
function nextFreeChartPartPath(zip, directory) {
|
|
55353
|
-
let n = 1;
|
|
55354
|
-
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
55355
|
-
n += 1;
|
|
55356
|
-
}
|
|
55357
|
-
return `${directory}/chart${n}.xml`;
|
|
55358
|
-
}
|
|
55359
|
-
function resolvePartTarget(fromPart, target) {
|
|
55360
|
-
if (target.startsWith("/")) {
|
|
55361
|
-
return target.slice(1);
|
|
55362
|
-
}
|
|
55363
|
-
const segments = fromPart.split("/").slice(0, -1);
|
|
55364
|
-
for (const segment of target.split("/")) {
|
|
55365
|
-
if (segment === "..") {
|
|
55366
|
-
segments.pop();
|
|
55367
|
-
} else if (segment !== "." && segment !== "") {
|
|
55368
|
-
segments.push(segment);
|
|
55369
|
-
}
|
|
55370
|
-
}
|
|
55371
|
-
return segments.join("/");
|
|
55372
|
-
}
|
|
55373
|
-
function relativePartTarget2(fromPart, toPart) {
|
|
55374
|
-
const from = fromPart.split("/").slice(0, -1);
|
|
55375
|
-
const to = toPart.split("/");
|
|
55376
|
-
let common = 0;
|
|
55377
|
-
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
55378
|
-
common += 1;
|
|
55379
|
-
}
|
|
55380
|
-
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
55381
|
-
}
|
|
55382
|
-
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
55383
|
-
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
55384
|
-
if (!xml) {
|
|
55385
|
-
return;
|
|
55386
|
-
}
|
|
55387
|
-
const tree = deps.parser.parse(xml);
|
|
55388
|
-
const types = tree["Types"] ?? {};
|
|
55389
|
-
const overrides = asArray6(types["Override"]);
|
|
55390
|
-
const partName = `/${partPath}`;
|
|
55391
|
-
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
55392
|
-
return;
|
|
55393
|
-
}
|
|
55394
|
-
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
55395
|
-
types["Override"] = overrides;
|
|
55396
|
-
tree["Types"] = types;
|
|
55397
|
-
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
55398
|
-
}
|
|
55399
|
-
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
55400
|
-
const slash = slidePath.lastIndexOf("/");
|
|
55401
|
-
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
55402
|
-
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
55403
|
-
if (!xml) {
|
|
55404
|
-
return void 0;
|
|
55405
|
-
}
|
|
55406
|
-
const tree = deps.parser.parse(xml);
|
|
55407
|
-
const root = tree["Relationships"];
|
|
55408
|
-
const relationships2 = asArray6(root?.["Relationship"]);
|
|
55409
|
-
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
55410
|
-
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
55411
|
-
);
|
|
55412
|
-
if (!match || !root) {
|
|
55413
|
-
return void 0;
|
|
55414
|
-
}
|
|
55415
|
-
match["@_Type"] = rewrite.relationshipType;
|
|
55416
|
-
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
55417
|
-
delete match["@_TargetMode"];
|
|
55418
|
-
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
55419
|
-
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
55420
|
-
return String(match["@_Id"]);
|
|
55421
|
-
}
|
|
55422
|
-
function rebindGraphicData(node, relationshipId, extended) {
|
|
55423
|
-
for (const key2 of Object.keys(node)) {
|
|
55424
|
-
delete node[key2];
|
|
55425
|
-
}
|
|
55426
|
-
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
55427
|
-
if (extended) {
|
|
55428
|
-
node["cx:chart"] = {
|
|
55429
|
-
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
55430
|
-
"@_xmlns:r": NS_R3,
|
|
55431
|
-
"@_r:id": relationshipId
|
|
55432
|
-
};
|
|
55433
|
-
} else {
|
|
55434
|
-
node["c:chart"] = {
|
|
55435
|
-
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
55436
|
-
"@_xmlns:r": NS_R3,
|
|
55437
|
-
"@_r:id": relationshipId
|
|
55438
|
-
};
|
|
55439
|
-
}
|
|
55440
|
-
}
|
|
55441
|
-
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
55442
|
-
if (!node || typeof node !== "object") {
|
|
55443
|
-
return 0;
|
|
55444
|
-
}
|
|
55445
|
-
if (Array.isArray(node)) {
|
|
55446
|
-
return node.reduce(
|
|
55447
|
-
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
55448
|
-
0
|
|
55449
|
-
);
|
|
55450
|
-
}
|
|
55451
|
-
const object = node;
|
|
55452
|
-
let count = 0;
|
|
55453
|
-
for (const key2 of Object.keys(object)) {
|
|
55454
|
-
if (key2.startsWith("@_")) {
|
|
55455
|
-
continue;
|
|
55456
|
-
}
|
|
55457
|
-
const value = object[key2];
|
|
55458
|
-
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
55459
|
-
for (const candidate of asArray6(value)) {
|
|
55460
|
-
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
55461
|
-
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
55462
|
-
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
55463
|
-
rebindGraphicData(candidate, relationshipId, extended);
|
|
55464
|
-
count += 1;
|
|
55465
|
-
}
|
|
55466
|
-
}
|
|
55467
|
-
continue;
|
|
55468
|
-
}
|
|
55469
|
-
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
55470
|
-
}
|
|
55471
|
-
return count;
|
|
55472
|
-
}
|
|
55473
|
-
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
55474
|
-
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
55475
|
-
if (!xml) {
|
|
55476
|
-
return 0;
|
|
55477
|
-
}
|
|
55478
|
-
const tree = deps.parser.parse(xml);
|
|
55479
|
-
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
55480
|
-
if (count > 0) {
|
|
55481
|
-
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
55482
|
-
}
|
|
55483
|
-
return count;
|
|
55484
|
-
}
|
|
55485
|
-
|
|
55486
55489
|
// pptx/core/core/runtime/chart-part-family-switch.ts
|
|
55487
55490
|
var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
|
|
55488
55491
|
var CHART_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
@@ -59313,18 +59316,22 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59313
59316
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
59314
59317
|
* a `p:cNvPr` parent.
|
|
59315
59318
|
*/
|
|
59316
|
-
serializeSingleAction(cNvPr, nodeName, action,
|
|
59319
|
+
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
59317
59320
|
if (!action) {
|
|
59318
59321
|
delete cNvPr[nodeName];
|
|
59319
59322
|
return;
|
|
59320
59323
|
}
|
|
59321
59324
|
const node = {};
|
|
59325
|
+
const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
|
|
59322
59326
|
let rId = action.rId;
|
|
59323
|
-
if (
|
|
59327
|
+
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
59328
|
+
rId = void 0;
|
|
59329
|
+
}
|
|
59330
|
+
if (!rId && url) {
|
|
59324
59331
|
const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
|
|
59325
59332
|
action.action ?? ""
|
|
59326
59333
|
);
|
|
59327
|
-
rId = resolveHyperlinkRelationshipId(
|
|
59334
|
+
rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
|
|
59328
59335
|
}
|
|
59329
59336
|
node["@_r:id"] = rId ?? "";
|
|
59330
59337
|
if (action.action) {
|
|
@@ -59398,7 +59405,7 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59398
59405
|
* the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
|
|
59399
59406
|
* non-visual properties.
|
|
59400
59407
|
*/
|
|
59401
|
-
serializeElementActions(shape, el,
|
|
59408
|
+
serializeElementActions(shape, el, links) {
|
|
59402
59409
|
const key2 = this.getTreeBucketKeyForElementType(el.type);
|
|
59403
59410
|
const cNvPr = this.getCnvPrNode(shape, key2);
|
|
59404
59411
|
if (!cNvPr) {
|
|
@@ -59406,8 +59413,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59406
59413
|
}
|
|
59407
59414
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
59408
59415
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
59409
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick,
|
|
59410
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover,
|
|
59416
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
59417
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
59411
59418
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
59412
59419
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
59413
59420
|
}
|
|
@@ -71801,7 +71808,7 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
71801
71808
|
if (ctx.connectorShapeIds) {
|
|
71802
71809
|
applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
|
|
71803
71810
|
}
|
|
71804
|
-
this.serializeElementActions(shape, el, ctx
|
|
71811
|
+
this.serializeElementActions(shape, el, ctx);
|
|
71805
71812
|
this.serializeShapeLocks(shape, el);
|
|
71806
71813
|
this.applyHiddenToCnvPr(shape, el);
|
|
71807
71814
|
this.applyNameToCnvPr(shape, el);
|
|
@@ -72842,7 +72849,7 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
72842
72849
|
* Process a single slide during save: update slide XML, process elements,
|
|
72843
72850
|
* rebuild shape tree, and persist relationships.
|
|
72844
72851
|
*/
|
|
72845
|
-
async processSlideForSave(slide, saveSession, constants) {
|
|
72852
|
+
async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
|
|
72846
72853
|
if (this.canSkipSlideSave(slide)) {
|
|
72847
72854
|
return;
|
|
72848
72855
|
}
|
|
@@ -73027,6 +73034,10 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
73027
73034
|
slideRelationshipRegistry,
|
|
73028
73035
|
resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
|
|
73029
73036
|
getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
|
|
73037
|
+
slideTargetAt: (index) => {
|
|
73038
|
+
const target = slidePaths[index];
|
|
73039
|
+
return target ? relativePartTarget2(slide.id, target) : void 0;
|
|
73040
|
+
},
|
|
73030
73041
|
resolvedMediaBytes,
|
|
73031
73042
|
saveSession,
|
|
73032
73043
|
slideImageRelationshipType: constants.slideImageRelationshipType,
|
|
@@ -75251,8 +75262,9 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
75251
75262
|
await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
|
|
75252
75263
|
await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
|
|
75253
75264
|
this.templateElementBaselines.beginSave();
|
|
75265
|
+
const slidePaths = slides.map((slide) => slide.id);
|
|
75254
75266
|
for (const slide of slides) {
|
|
75255
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
75267
|
+
await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
|
|
75256
75268
|
}
|
|
75257
75269
|
this.templateElementBaselines.commitSave();
|
|
75258
75270
|
const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -75730,7 +75742,13 @@ var PptxHandlerRuntime55 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
75730
75742
|
if (posterRId && relsMap) {
|
|
75731
75743
|
const posterTarget = relsMap.get(posterRId);
|
|
75732
75744
|
if (posterTarget) {
|
|
75733
|
-
if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")
|
|
75745
|
+
if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")) {
|
|
75746
|
+
if (this.allowExternalImages === true) {
|
|
75747
|
+
posterImage = posterTarget;
|
|
75748
|
+
imagePath = posterTarget;
|
|
75749
|
+
imageData = posterTarget;
|
|
75750
|
+
}
|
|
75751
|
+
} else if (posterTarget.startsWith("data:")) {
|
|
75734
75752
|
posterImage = posterTarget;
|
|
75735
75753
|
imagePath = posterTarget;
|
|
75736
75754
|
imageData = posterTarget;
|
|
@@ -76860,7 +76878,12 @@ var PptxHandlerRuntime61 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
|
|
|
76860
76878
|
const slideRels = this.slideRelsMap.get(slidePath);
|
|
76861
76879
|
const target = slideRels?.get(relId);
|
|
76862
76880
|
if (target) {
|
|
76863
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
76881
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
76882
|
+
if (this.allowExternalImages === true) {
|
|
76883
|
+
imagePath = target;
|
|
76884
|
+
imageData = target;
|
|
76885
|
+
}
|
|
76886
|
+
} else if (target.startsWith("data:")) {
|
|
76864
76887
|
imagePath = target;
|
|
76865
76888
|
imageData = target;
|
|
76866
76889
|
} else {
|
|
@@ -77314,7 +77337,9 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
|
|
|
77314
77337
|
const target = slideRels?.get(imageRelId);
|
|
77315
77338
|
let imageDataUrl;
|
|
77316
77339
|
if (target) {
|
|
77317
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
77340
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
77341
|
+
imageDataUrl = this.allowExternalImages === true ? target : void 0;
|
|
77342
|
+
} else if (target.startsWith("data:")) {
|
|
77318
77343
|
imageDataUrl = target;
|
|
77319
77344
|
} else {
|
|
77320
77345
|
const imagePath = this.resolveImagePath(slidePath, target);
|
|
@@ -86625,6 +86650,7 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
|
|
|
86625
86650
|
async enrichBulletPictureElementsWithEmbeddedData(elements2, slidePath) {
|
|
86626
86651
|
await enrichBulletPictureImages(elements2, slidePath, {
|
|
86627
86652
|
slideRelsMap: this.slideRelsMap,
|
|
86653
|
+
allowExternalImages: this.allowExternalImages === true,
|
|
86628
86654
|
resolveImagePath: (path3, target) => this.resolveImagePath(path3, target),
|
|
86629
86655
|
getImageData: (imagePath) => this.getImageData(imagePath)
|
|
86630
86656
|
});
|