ooxml-core 1.26.0 → 1.26.1
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-5QBRBXRX.mjs → PptxHandler-64BZOBWX.mjs} +2 -2
- package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-AILFLRH7.cjs} +2 -2
- package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-PMLQGMFQ.mjs} +1 -1
- package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-EJY2TYWL.mjs} +1 -1
- package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-HBCCO2CF.mjs} +2 -2
- package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-RBQP6A37.cjs} +4 -4
- package/dist/{chunk-EBJ724RB.mjs → chunk-DHAZSMC7.mjs} +1 -1
- package/dist/{chunk-4IIR2QEH.mjs → chunk-FZBAMWCJ.mjs} +181 -172
- package/dist/{chunk-EEHK52XB.cjs → chunk-NXTHB2M3.cjs} +180 -171
- package/dist/{chunk-KONCS53X.mjs → chunk-OQPT5IC3.mjs} +4 -4
- package/dist/{chunk-K6OFJ5GJ.mjs → chunk-OTXJVFMY.mjs} +180 -171
- package/dist/{chunk-DNYZX6YG.mjs → chunk-R7RL7W43.mjs} +1 -1
- package/dist/{chunk-ZXPPM63Y.mjs → chunk-WRFMS5CL.mjs} +1 -1
- package/dist/pptx/automation/index.cjs +188 -178
- 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 +188 -178
- 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 +188 -178
- 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
|
@@ -50512,6 +50512,152 @@ function applyCommonViewContainer(root, name, props) {
|
|
|
50512
50512
|
root[key2] = container;
|
|
50513
50513
|
}
|
|
50514
50514
|
|
|
50515
|
+
// pptx/core/core/runtime/chart-part-registration.ts
|
|
50516
|
+
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50517
|
+
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50518
|
+
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50519
|
+
function asArray3(value) {
|
|
50520
|
+
if (value === void 0 || value === null) {
|
|
50521
|
+
return [];
|
|
50522
|
+
}
|
|
50523
|
+
return (Array.isArray(value) ? value : [value]).filter(
|
|
50524
|
+
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
50525
|
+
);
|
|
50526
|
+
}
|
|
50527
|
+
function nextFreeChartPartPath(zip, directory) {
|
|
50528
|
+
let n = 1;
|
|
50529
|
+
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
50530
|
+
n += 1;
|
|
50531
|
+
}
|
|
50532
|
+
return `${directory}/chart${n}.xml`;
|
|
50533
|
+
}
|
|
50534
|
+
function resolvePartTarget(fromPart, target) {
|
|
50535
|
+
if (target.startsWith("/")) {
|
|
50536
|
+
return target.slice(1);
|
|
50537
|
+
}
|
|
50538
|
+
const segments = fromPart.split("/").slice(0, -1);
|
|
50539
|
+
for (const segment of target.split("/")) {
|
|
50540
|
+
if (segment === "..") {
|
|
50541
|
+
segments.pop();
|
|
50542
|
+
} else if (segment !== "." && segment !== "") {
|
|
50543
|
+
segments.push(segment);
|
|
50544
|
+
}
|
|
50545
|
+
}
|
|
50546
|
+
return segments.join("/");
|
|
50547
|
+
}
|
|
50548
|
+
function relativePartTarget2(fromPart, toPart) {
|
|
50549
|
+
const from = fromPart.split("/").slice(0, -1);
|
|
50550
|
+
const to = toPart.split("/");
|
|
50551
|
+
let common = 0;
|
|
50552
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
50553
|
+
common += 1;
|
|
50554
|
+
}
|
|
50555
|
+
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
50556
|
+
}
|
|
50557
|
+
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
50558
|
+
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
50559
|
+
if (!xml) {
|
|
50560
|
+
return;
|
|
50561
|
+
}
|
|
50562
|
+
const tree = deps.parser.parse(xml);
|
|
50563
|
+
const types = tree["Types"] ?? {};
|
|
50564
|
+
const overrides = asArray3(types["Override"]);
|
|
50565
|
+
const partName = `/${partPath}`;
|
|
50566
|
+
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
50567
|
+
return;
|
|
50568
|
+
}
|
|
50569
|
+
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
50570
|
+
types["Override"] = overrides;
|
|
50571
|
+
tree["Types"] = types;
|
|
50572
|
+
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
50573
|
+
}
|
|
50574
|
+
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
50575
|
+
const slash = slidePath.lastIndexOf("/");
|
|
50576
|
+
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
50577
|
+
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
50578
|
+
if (!xml) {
|
|
50579
|
+
return void 0;
|
|
50580
|
+
}
|
|
50581
|
+
const tree = deps.parser.parse(xml);
|
|
50582
|
+
const root = tree["Relationships"];
|
|
50583
|
+
const relationships2 = asArray3(root?.["Relationship"]);
|
|
50584
|
+
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
50585
|
+
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
50586
|
+
);
|
|
50587
|
+
if (!match || !root) {
|
|
50588
|
+
return void 0;
|
|
50589
|
+
}
|
|
50590
|
+
match["@_Type"] = rewrite.relationshipType;
|
|
50591
|
+
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
50592
|
+
delete match["@_TargetMode"];
|
|
50593
|
+
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
50594
|
+
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
50595
|
+
return String(match["@_Id"]);
|
|
50596
|
+
}
|
|
50597
|
+
function rebindGraphicData(node, relationshipId, extended) {
|
|
50598
|
+
for (const key2 of Object.keys(node)) {
|
|
50599
|
+
delete node[key2];
|
|
50600
|
+
}
|
|
50601
|
+
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
50602
|
+
if (extended) {
|
|
50603
|
+
node["cx:chart"] = {
|
|
50604
|
+
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
50605
|
+
"@_xmlns:r": NS_R,
|
|
50606
|
+
"@_r:id": relationshipId
|
|
50607
|
+
};
|
|
50608
|
+
} else {
|
|
50609
|
+
node["c:chart"] = {
|
|
50610
|
+
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
50611
|
+
"@_xmlns:r": NS_R,
|
|
50612
|
+
"@_r:id": relationshipId
|
|
50613
|
+
};
|
|
50614
|
+
}
|
|
50615
|
+
}
|
|
50616
|
+
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
50617
|
+
if (!node || typeof node !== "object") {
|
|
50618
|
+
return 0;
|
|
50619
|
+
}
|
|
50620
|
+
if (Array.isArray(node)) {
|
|
50621
|
+
return node.reduce(
|
|
50622
|
+
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
50623
|
+
0
|
|
50624
|
+
);
|
|
50625
|
+
}
|
|
50626
|
+
const object = node;
|
|
50627
|
+
let count = 0;
|
|
50628
|
+
for (const key2 of Object.keys(object)) {
|
|
50629
|
+
if (key2.startsWith("@_")) {
|
|
50630
|
+
continue;
|
|
50631
|
+
}
|
|
50632
|
+
const value = object[key2];
|
|
50633
|
+
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
50634
|
+
for (const candidate of asArray3(value)) {
|
|
50635
|
+
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
50636
|
+
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
50637
|
+
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
50638
|
+
rebindGraphicData(candidate, relationshipId, extended);
|
|
50639
|
+
count += 1;
|
|
50640
|
+
}
|
|
50641
|
+
}
|
|
50642
|
+
continue;
|
|
50643
|
+
}
|
|
50644
|
+
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
50645
|
+
}
|
|
50646
|
+
return count;
|
|
50647
|
+
}
|
|
50648
|
+
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
50649
|
+
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
50650
|
+
if (!xml) {
|
|
50651
|
+
return 0;
|
|
50652
|
+
}
|
|
50653
|
+
const tree = deps.parser.parse(xml);
|
|
50654
|
+
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
50655
|
+
if (count > 0) {
|
|
50656
|
+
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
50657
|
+
}
|
|
50658
|
+
return count;
|
|
50659
|
+
}
|
|
50660
|
+
|
|
50515
50661
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
50516
50662
|
var METHODS = /* @__PURE__ */ new Set(["cycle", "withinLinear", "acrossLinear"]);
|
|
50517
50663
|
var COLOR_NAMES = /* @__PURE__ */ new Set(["scrgbClr", "srgbClr", "hslClr", "sysClr", "schemeClr", "prstClr"]);
|
|
@@ -50581,7 +50727,7 @@ function buildChartExLegend(legendPosition) {
|
|
|
50581
50727
|
// pptx/core/utils/chart-cx-generator.ts
|
|
50582
50728
|
var NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50583
50729
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
50584
|
-
var
|
|
50730
|
+
var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50585
50731
|
var NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50586
50732
|
function points4(values) {
|
|
50587
50733
|
return values.map((value, index) => ({ "@_idx": String(index), "#text": String(value) }));
|
|
@@ -50776,7 +50922,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
50776
50922
|
const chartSpace = {
|
|
50777
50923
|
"@_xmlns:cx": NS_CX,
|
|
50778
50924
|
"@_xmlns:a": NS_A,
|
|
50779
|
-
"@_xmlns:r":
|
|
50925
|
+
"@_xmlns:r": NS_R2,
|
|
50780
50926
|
"cx:chartData": {
|
|
50781
50927
|
"cx:data": chartData.series.map(
|
|
50782
50928
|
(series, index) => buildChartExData(chartData, series, index)
|
|
@@ -52339,7 +52485,7 @@ function buildGeneratedSeriesSpPr(series, family) {
|
|
|
52339
52485
|
// pptx/core/utils/chart-xml-generator.ts
|
|
52340
52486
|
var NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
52341
52487
|
var NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
52342
|
-
var
|
|
52488
|
+
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
52343
52489
|
var CAT_AX_ID = 111111111;
|
|
52344
52490
|
var VAL_AX_ID = 222222222;
|
|
52345
52491
|
var SER_AX_ID = 333333333;
|
|
@@ -52545,7 +52691,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
52545
52691
|
"c:chartSpace": {
|
|
52546
52692
|
"@_xmlns:c": NS_C2,
|
|
52547
52693
|
"@_xmlns:a": NS_A2,
|
|
52548
|
-
"@_xmlns:r":
|
|
52694
|
+
"@_xmlns:r": NS_R3,
|
|
52549
52695
|
"c:chart": chart
|
|
52550
52696
|
}
|
|
52551
52697
|
};
|
|
@@ -54594,7 +54740,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
|
|
|
54594
54740
|
}
|
|
54595
54741
|
return rPr;
|
|
54596
54742
|
}
|
|
54597
|
-
function
|
|
54743
|
+
function asArray4(value) {
|
|
54598
54744
|
if (Array.isArray(value)) {
|
|
54599
54745
|
return value;
|
|
54600
54746
|
}
|
|
@@ -54613,7 +54759,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54613
54759
|
return txKey;
|
|
54614
54760
|
}
|
|
54615
54761
|
const pKey = findKey19(rich, "p", getLocalName2) ?? "a:p";
|
|
54616
|
-
const paragraphs =
|
|
54762
|
+
const paragraphs = asArray4(rich[pKey]).map((para) => {
|
|
54617
54763
|
const next = { ...para };
|
|
54618
54764
|
const pPrKey = findKey19(next, "pPr", getLocalName2) ?? "a:pPr";
|
|
54619
54765
|
const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
|
|
@@ -54626,7 +54772,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54626
54772
|
next[pPrKey] = pPr;
|
|
54627
54773
|
const rKey = findKey19(next, "r", getLocalName2);
|
|
54628
54774
|
if (rKey) {
|
|
54629
|
-
const runs =
|
|
54775
|
+
const runs = asArray4(next[rKey]).map((run2) => {
|
|
54630
54776
|
const rPrKey = findKey19(run2, "rPr", getLocalName2) ?? "a:rPr";
|
|
54631
54777
|
const existingRPr = run2[rPrKey] ?? {};
|
|
54632
54778
|
const nextRun = { ...run2 };
|
|
@@ -54990,7 +55136,7 @@ function saveChartPartThroughNeutral(xml, before, after) {
|
|
|
54990
55136
|
function findKey20(node, localName15, getLocalName2) {
|
|
54991
55137
|
return Object.keys(node).find((key2) => getLocalName2(key2) === localName15);
|
|
54992
55138
|
}
|
|
54993
|
-
function
|
|
55139
|
+
function asArray5(value) {
|
|
54994
55140
|
if (value === void 0 || value === null) {
|
|
54995
55141
|
return [];
|
|
54996
55142
|
}
|
|
@@ -55004,8 +55150,8 @@ function dimensionType(node) {
|
|
|
55004
55150
|
function replaceLevels(target, source, getLocalName2) {
|
|
55005
55151
|
const targetKey = findKey20(target, "lvl", getLocalName2) ?? "cx:lvl";
|
|
55006
55152
|
const sourceKey = findKey20(source, "lvl", getLocalName2);
|
|
55007
|
-
const oldLevels =
|
|
55008
|
-
const newLevels =
|
|
55153
|
+
const oldLevels = asArray5(target[targetKey]);
|
|
55154
|
+
const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
|
|
55009
55155
|
const old = oldLevels[index];
|
|
55010
55156
|
if (!old) {
|
|
55011
55157
|
return level;
|
|
@@ -55024,8 +55170,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
|
|
|
55024
55170
|
for (const kind of ["strDim", "numDim"]) {
|
|
55025
55171
|
const targetKey = findKey20(target, kind, getLocalName2) ?? `cx:${kind}`;
|
|
55026
55172
|
const freshKey = findKey20(fresh, kind, getLocalName2);
|
|
55027
|
-
const existing =
|
|
55028
|
-
const incoming =
|
|
55173
|
+
const existing = asArray5(target[targetKey]);
|
|
55174
|
+
const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
|
|
55029
55175
|
for (const dimension of incoming) {
|
|
55030
55176
|
const wantedType = dimensionType(dimension);
|
|
55031
55177
|
let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
|
|
@@ -55059,7 +55205,7 @@ function child13(node, localName15, getLocalName2) {
|
|
|
55059
55205
|
const value = key2 ? node[key2] : void 0;
|
|
55060
55206
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
55061
55207
|
}
|
|
55062
|
-
function
|
|
55208
|
+
function asArray6(value) {
|
|
55063
55209
|
if (value === void 0 || value === null) {
|
|
55064
55210
|
return [];
|
|
55065
55211
|
}
|
|
@@ -55241,7 +55387,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
|
|
|
55241
55387
|
getLocalName2
|
|
55242
55388
|
);
|
|
55243
55389
|
const seriesKey = region ? findKey21(region, "series", getLocalName2) : void 0;
|
|
55244
|
-
const first2 = region && seriesKey ?
|
|
55390
|
+
const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
|
|
55245
55391
|
const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
|
|
55246
55392
|
const series = chartData.series[0];
|
|
55247
55393
|
if (!existing || !series) {
|
|
@@ -55259,9 +55405,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
|
|
|
55259
55405
|
const chartDataKey = findKey21(chartSpace, "chartData", getLocalName2);
|
|
55260
55406
|
const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
|
|
55261
55407
|
const dataKey = findKey21(chartDataNode, "data", getLocalName2) ?? "cx:data";
|
|
55262
|
-
const dataNodes =
|
|
55408
|
+
const dataNodes = asArray6(chartDataNode[dataKey]);
|
|
55263
55409
|
const seriesKey = findKey21(region, "series", getLocalName2) ?? "cx:series";
|
|
55264
|
-
const existing =
|
|
55410
|
+
const existing = asArray6(region[seriesKey]);
|
|
55265
55411
|
const updated = [];
|
|
55266
55412
|
chartData.series.forEach((series, index) => {
|
|
55267
55413
|
const node = existing[index];
|
|
@@ -55331,152 +55477,6 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
55331
55477
|
);
|
|
55332
55478
|
}
|
|
55333
55479
|
|
|
55334
|
-
// pptx/core/core/runtime/chart-part-registration.ts
|
|
55335
|
-
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
55336
|
-
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
55337
|
-
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
55338
|
-
function asArray6(value) {
|
|
55339
|
-
if (value === void 0 || value === null) {
|
|
55340
|
-
return [];
|
|
55341
|
-
}
|
|
55342
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
55343
|
-
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
55344
|
-
);
|
|
55345
|
-
}
|
|
55346
|
-
function nextFreeChartPartPath(zip, directory) {
|
|
55347
|
-
let n = 1;
|
|
55348
|
-
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
55349
|
-
n += 1;
|
|
55350
|
-
}
|
|
55351
|
-
return `${directory}/chart${n}.xml`;
|
|
55352
|
-
}
|
|
55353
|
-
function resolvePartTarget(fromPart, target) {
|
|
55354
|
-
if (target.startsWith("/")) {
|
|
55355
|
-
return target.slice(1);
|
|
55356
|
-
}
|
|
55357
|
-
const segments = fromPart.split("/").slice(0, -1);
|
|
55358
|
-
for (const segment of target.split("/")) {
|
|
55359
|
-
if (segment === "..") {
|
|
55360
|
-
segments.pop();
|
|
55361
|
-
} else if (segment !== "." && segment !== "") {
|
|
55362
|
-
segments.push(segment);
|
|
55363
|
-
}
|
|
55364
|
-
}
|
|
55365
|
-
return segments.join("/");
|
|
55366
|
-
}
|
|
55367
|
-
function relativePartTarget2(fromPart, toPart) {
|
|
55368
|
-
const from = fromPart.split("/").slice(0, -1);
|
|
55369
|
-
const to = toPart.split("/");
|
|
55370
|
-
let common = 0;
|
|
55371
|
-
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
55372
|
-
common += 1;
|
|
55373
|
-
}
|
|
55374
|
-
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
55375
|
-
}
|
|
55376
|
-
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
55377
|
-
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
55378
|
-
if (!xml) {
|
|
55379
|
-
return;
|
|
55380
|
-
}
|
|
55381
|
-
const tree = deps.parser.parse(xml);
|
|
55382
|
-
const types = tree["Types"] ?? {};
|
|
55383
|
-
const overrides = asArray6(types["Override"]);
|
|
55384
|
-
const partName = `/${partPath}`;
|
|
55385
|
-
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
55386
|
-
return;
|
|
55387
|
-
}
|
|
55388
|
-
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
55389
|
-
types["Override"] = overrides;
|
|
55390
|
-
tree["Types"] = types;
|
|
55391
|
-
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
55392
|
-
}
|
|
55393
|
-
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
55394
|
-
const slash = slidePath.lastIndexOf("/");
|
|
55395
|
-
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
55396
|
-
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
55397
|
-
if (!xml) {
|
|
55398
|
-
return void 0;
|
|
55399
|
-
}
|
|
55400
|
-
const tree = deps.parser.parse(xml);
|
|
55401
|
-
const root = tree["Relationships"];
|
|
55402
|
-
const relationships2 = asArray6(root?.["Relationship"]);
|
|
55403
|
-
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
55404
|
-
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
55405
|
-
);
|
|
55406
|
-
if (!match || !root) {
|
|
55407
|
-
return void 0;
|
|
55408
|
-
}
|
|
55409
|
-
match["@_Type"] = rewrite.relationshipType;
|
|
55410
|
-
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
55411
|
-
delete match["@_TargetMode"];
|
|
55412
|
-
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
55413
|
-
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
55414
|
-
return String(match["@_Id"]);
|
|
55415
|
-
}
|
|
55416
|
-
function rebindGraphicData(node, relationshipId, extended) {
|
|
55417
|
-
for (const key2 of Object.keys(node)) {
|
|
55418
|
-
delete node[key2];
|
|
55419
|
-
}
|
|
55420
|
-
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
55421
|
-
if (extended) {
|
|
55422
|
-
node["cx:chart"] = {
|
|
55423
|
-
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
55424
|
-
"@_xmlns:r": NS_R3,
|
|
55425
|
-
"@_r:id": relationshipId
|
|
55426
|
-
};
|
|
55427
|
-
} else {
|
|
55428
|
-
node["c:chart"] = {
|
|
55429
|
-
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
55430
|
-
"@_xmlns:r": NS_R3,
|
|
55431
|
-
"@_r:id": relationshipId
|
|
55432
|
-
};
|
|
55433
|
-
}
|
|
55434
|
-
}
|
|
55435
|
-
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
55436
|
-
if (!node || typeof node !== "object") {
|
|
55437
|
-
return 0;
|
|
55438
|
-
}
|
|
55439
|
-
if (Array.isArray(node)) {
|
|
55440
|
-
return node.reduce(
|
|
55441
|
-
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
55442
|
-
0
|
|
55443
|
-
);
|
|
55444
|
-
}
|
|
55445
|
-
const object = node;
|
|
55446
|
-
let count = 0;
|
|
55447
|
-
for (const key2 of Object.keys(object)) {
|
|
55448
|
-
if (key2.startsWith("@_")) {
|
|
55449
|
-
continue;
|
|
55450
|
-
}
|
|
55451
|
-
const value = object[key2];
|
|
55452
|
-
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
55453
|
-
for (const candidate of asArray6(value)) {
|
|
55454
|
-
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
55455
|
-
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
55456
|
-
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
55457
|
-
rebindGraphicData(candidate, relationshipId, extended);
|
|
55458
|
-
count += 1;
|
|
55459
|
-
}
|
|
55460
|
-
}
|
|
55461
|
-
continue;
|
|
55462
|
-
}
|
|
55463
|
-
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
55464
|
-
}
|
|
55465
|
-
return count;
|
|
55466
|
-
}
|
|
55467
|
-
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
55468
|
-
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
55469
|
-
if (!xml) {
|
|
55470
|
-
return 0;
|
|
55471
|
-
}
|
|
55472
|
-
const tree = deps.parser.parse(xml);
|
|
55473
|
-
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
55474
|
-
if (count > 0) {
|
|
55475
|
-
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
55476
|
-
}
|
|
55477
|
-
return count;
|
|
55478
|
-
}
|
|
55479
|
-
|
|
55480
55480
|
// pptx/core/core/runtime/chart-part-family-switch.ts
|
|
55481
55481
|
var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
|
|
55482
55482
|
var CHART_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
@@ -59307,18 +59307,22 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59307
59307
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
59308
59308
|
* a `p:cNvPr` parent.
|
|
59309
59309
|
*/
|
|
59310
|
-
serializeSingleAction(cNvPr, nodeName, action,
|
|
59310
|
+
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
59311
59311
|
if (!action) {
|
|
59312
59312
|
delete cNvPr[nodeName];
|
|
59313
59313
|
return;
|
|
59314
59314
|
}
|
|
59315
59315
|
const node = {};
|
|
59316
|
+
const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
|
|
59316
59317
|
let rId = action.rId;
|
|
59317
|
-
if (
|
|
59318
|
+
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
59319
|
+
rId = void 0;
|
|
59320
|
+
}
|
|
59321
|
+
if (!rId && url) {
|
|
59318
59322
|
const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
|
|
59319
59323
|
action.action ?? ""
|
|
59320
59324
|
);
|
|
59321
|
-
rId = resolveHyperlinkRelationshipId(
|
|
59325
|
+
rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
|
|
59322
59326
|
}
|
|
59323
59327
|
node["@_r:id"] = rId ?? "";
|
|
59324
59328
|
if (action.action) {
|
|
@@ -59392,7 +59396,7 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59392
59396
|
* the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
|
|
59393
59397
|
* non-visual properties.
|
|
59394
59398
|
*/
|
|
59395
|
-
serializeElementActions(shape, el,
|
|
59399
|
+
serializeElementActions(shape, el, links) {
|
|
59396
59400
|
const key2 = this.getTreeBucketKeyForElementType(el.type);
|
|
59397
59401
|
const cNvPr = this.getCnvPrNode(shape, key2);
|
|
59398
59402
|
if (!cNvPr) {
|
|
@@ -59400,8 +59404,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59400
59404
|
}
|
|
59401
59405
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
59402
59406
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
59403
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick,
|
|
59404
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover,
|
|
59407
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
59408
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
59405
59409
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
59406
59410
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
59407
59411
|
}
|
|
@@ -71795,7 +71799,7 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
71795
71799
|
if (ctx.connectorShapeIds) {
|
|
71796
71800
|
applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
|
|
71797
71801
|
}
|
|
71798
|
-
this.serializeElementActions(shape, el, ctx
|
|
71802
|
+
this.serializeElementActions(shape, el, ctx);
|
|
71799
71803
|
this.serializeShapeLocks(shape, el);
|
|
71800
71804
|
this.applyHiddenToCnvPr(shape, el);
|
|
71801
71805
|
this.applyNameToCnvPr(shape, el);
|
|
@@ -72836,7 +72840,7 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
72836
72840
|
* Process a single slide during save: update slide XML, process elements,
|
|
72837
72841
|
* rebuild shape tree, and persist relationships.
|
|
72838
72842
|
*/
|
|
72839
|
-
async processSlideForSave(slide, saveSession, constants) {
|
|
72843
|
+
async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
|
|
72840
72844
|
if (this.canSkipSlideSave(slide)) {
|
|
72841
72845
|
return;
|
|
72842
72846
|
}
|
|
@@ -73021,6 +73025,10 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
73021
73025
|
slideRelationshipRegistry,
|
|
73022
73026
|
resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
|
|
73023
73027
|
getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
|
|
73028
|
+
slideTargetAt: (index) => {
|
|
73029
|
+
const target = slidePaths[index];
|
|
73030
|
+
return target ? relativePartTarget2(slide.id, target) : void 0;
|
|
73031
|
+
},
|
|
73024
73032
|
resolvedMediaBytes,
|
|
73025
73033
|
saveSession,
|
|
73026
73034
|
slideImageRelationshipType: constants.slideImageRelationshipType,
|
|
@@ -75245,8 +75253,9 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
75245
75253
|
await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
|
|
75246
75254
|
await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
|
|
75247
75255
|
this.templateElementBaselines.beginSave();
|
|
75256
|
+
const slidePaths = slides.map((slide) => slide.id);
|
|
75248
75257
|
for (const slide of slides) {
|
|
75249
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
75258
|
+
await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
|
|
75250
75259
|
}
|
|
75251
75260
|
this.templateElementBaselines.commitSave();
|
|
75252
75261
|
const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -21977,7 +21977,7 @@ function findTextBearingElementById(elements3, elementId) {
|
|
|
21977
21977
|
}
|
|
21978
21978
|
async function loadNestedDeck(pptxBytes) {
|
|
21979
21979
|
try {
|
|
21980
|
-
const { PptxHandler } = await import('./PptxHandler-
|
|
21980
|
+
const { PptxHandler } = await import('./PptxHandler-64BZOBWX.mjs');
|
|
21981
21981
|
const handler = new PptxHandler();
|
|
21982
21982
|
const data = await handler.load(pptxBytes.buffer.slice(0));
|
|
21983
21983
|
return { handler, slides: data.slides };
|