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
package/dist/pptx/index.cjs
CHANGED
|
@@ -109081,7 +109081,10 @@ async function resolveBulletImage(imageRelId, slidePath, resolver) {
|
|
|
109081
109081
|
if (!target) {
|
|
109082
109082
|
return void 0;
|
|
109083
109083
|
}
|
|
109084
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
109084
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
109085
|
+
return resolver.allowExternalImages ? target : void 0;
|
|
109086
|
+
}
|
|
109087
|
+
if (target.startsWith("data:")) {
|
|
109085
109088
|
return target;
|
|
109086
109089
|
}
|
|
109087
109090
|
const imagePath = resolver.resolveImagePath(slidePath, target);
|
|
@@ -125066,6 +125069,157 @@ var init_pptx_view_props_helpers = __esm({
|
|
|
125066
125069
|
}
|
|
125067
125070
|
});
|
|
125068
125071
|
|
|
125072
|
+
// pptx/core/core/runtime/chart-part-registration.ts
|
|
125073
|
+
function asArray4(value) {
|
|
125074
|
+
if (value === void 0 || value === null) {
|
|
125075
|
+
return [];
|
|
125076
|
+
}
|
|
125077
|
+
return (Array.isArray(value) ? value : [value]).filter(
|
|
125078
|
+
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
125079
|
+
);
|
|
125080
|
+
}
|
|
125081
|
+
function nextFreeChartPartPath(zip, directory) {
|
|
125082
|
+
let n = 1;
|
|
125083
|
+
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
125084
|
+
n += 1;
|
|
125085
|
+
}
|
|
125086
|
+
return `${directory}/chart${n}.xml`;
|
|
125087
|
+
}
|
|
125088
|
+
function resolvePartTarget(fromPart, target) {
|
|
125089
|
+
if (target.startsWith("/")) {
|
|
125090
|
+
return target.slice(1);
|
|
125091
|
+
}
|
|
125092
|
+
const segments = fromPart.split("/").slice(0, -1);
|
|
125093
|
+
for (const segment of target.split("/")) {
|
|
125094
|
+
if (segment === "..") {
|
|
125095
|
+
segments.pop();
|
|
125096
|
+
} else if (segment !== "." && segment !== "") {
|
|
125097
|
+
segments.push(segment);
|
|
125098
|
+
}
|
|
125099
|
+
}
|
|
125100
|
+
return segments.join("/");
|
|
125101
|
+
}
|
|
125102
|
+
function relativePartTarget2(fromPart, toPart) {
|
|
125103
|
+
const from = fromPart.split("/").slice(0, -1);
|
|
125104
|
+
const to = toPart.split("/");
|
|
125105
|
+
let common = 0;
|
|
125106
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
125107
|
+
common += 1;
|
|
125108
|
+
}
|
|
125109
|
+
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
125110
|
+
}
|
|
125111
|
+
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
125112
|
+
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
125113
|
+
if (!xml) {
|
|
125114
|
+
return;
|
|
125115
|
+
}
|
|
125116
|
+
const tree = deps.parser.parse(xml);
|
|
125117
|
+
const types = tree["Types"] ?? {};
|
|
125118
|
+
const overrides28 = asArray4(types["Override"]);
|
|
125119
|
+
const partName = `/${partPath}`;
|
|
125120
|
+
if (overrides28.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
125121
|
+
return;
|
|
125122
|
+
}
|
|
125123
|
+
overrides28.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
125124
|
+
types["Override"] = overrides28;
|
|
125125
|
+
tree["Types"] = types;
|
|
125126
|
+
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
125127
|
+
}
|
|
125128
|
+
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
125129
|
+
const slash = slidePath.lastIndexOf("/");
|
|
125130
|
+
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
125131
|
+
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
125132
|
+
if (!xml) {
|
|
125133
|
+
return void 0;
|
|
125134
|
+
}
|
|
125135
|
+
const tree = deps.parser.parse(xml);
|
|
125136
|
+
const root = tree["Relationships"];
|
|
125137
|
+
const relationships3 = asArray4(root?.["Relationship"]);
|
|
125138
|
+
const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
|
|
125139
|
+
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
125140
|
+
);
|
|
125141
|
+
if (!match || !root) {
|
|
125142
|
+
return void 0;
|
|
125143
|
+
}
|
|
125144
|
+
match["@_Type"] = rewrite.relationshipType;
|
|
125145
|
+
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
125146
|
+
delete match["@_TargetMode"];
|
|
125147
|
+
root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
|
|
125148
|
+
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
125149
|
+
return String(match["@_Id"]);
|
|
125150
|
+
}
|
|
125151
|
+
function rebindGraphicData(node, relationshipId2, extended) {
|
|
125152
|
+
for (const key2 of Object.keys(node)) {
|
|
125153
|
+
delete node[key2];
|
|
125154
|
+
}
|
|
125155
|
+
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
125156
|
+
if (extended) {
|
|
125157
|
+
node["cx:chart"] = {
|
|
125158
|
+
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
125159
|
+
"@_xmlns:r": NS_R,
|
|
125160
|
+
"@_r:id": relationshipId2
|
|
125161
|
+
};
|
|
125162
|
+
} else {
|
|
125163
|
+
node["c:chart"] = {
|
|
125164
|
+
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
125165
|
+
"@_xmlns:r": NS_R,
|
|
125166
|
+
"@_r:id": relationshipId2
|
|
125167
|
+
};
|
|
125168
|
+
}
|
|
125169
|
+
}
|
|
125170
|
+
function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
|
|
125171
|
+
if (!node || typeof node !== "object") {
|
|
125172
|
+
return 0;
|
|
125173
|
+
}
|
|
125174
|
+
if (Array.isArray(node)) {
|
|
125175
|
+
return node.reduce(
|
|
125176
|
+
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
|
|
125177
|
+
0
|
|
125178
|
+
);
|
|
125179
|
+
}
|
|
125180
|
+
const object = node;
|
|
125181
|
+
let count = 0;
|
|
125182
|
+
for (const key2 of Object.keys(object)) {
|
|
125183
|
+
if (key2.startsWith("@_")) {
|
|
125184
|
+
continue;
|
|
125185
|
+
}
|
|
125186
|
+
const value = object[key2];
|
|
125187
|
+
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
125188
|
+
for (const candidate of asArray4(value)) {
|
|
125189
|
+
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
125190
|
+
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
125191
|
+
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
125192
|
+
rebindGraphicData(candidate, relationshipId2, extended);
|
|
125193
|
+
count += 1;
|
|
125194
|
+
}
|
|
125195
|
+
}
|
|
125196
|
+
continue;
|
|
125197
|
+
}
|
|
125198
|
+
count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
|
|
125199
|
+
}
|
|
125200
|
+
return count;
|
|
125201
|
+
}
|
|
125202
|
+
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
|
|
125203
|
+
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
125204
|
+
if (!xml) {
|
|
125205
|
+
return 0;
|
|
125206
|
+
}
|
|
125207
|
+
const tree = deps.parser.parse(xml);
|
|
125208
|
+
const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
|
|
125209
|
+
if (count > 0) {
|
|
125210
|
+
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
125211
|
+
}
|
|
125212
|
+
return count;
|
|
125213
|
+
}
|
|
125214
|
+
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
|
|
125215
|
+
var init_chart_part_registration = __esm({
|
|
125216
|
+
"pptx/core/core/runtime/chart-part-registration.ts"() {
|
|
125217
|
+
CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
125218
|
+
CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
125219
|
+
NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
125220
|
+
}
|
|
125221
|
+
});
|
|
125222
|
+
|
|
125069
125223
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
125070
125224
|
function localName23(key2) {
|
|
125071
125225
|
return key2.replace(/^.*:/u, "");
|
|
@@ -125335,7 +125489,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
125335
125489
|
const chartSpace = {
|
|
125336
125490
|
"@_xmlns:cx": NS_CX,
|
|
125337
125491
|
"@_xmlns:a": NS_A,
|
|
125338
|
-
"@_xmlns:r":
|
|
125492
|
+
"@_xmlns:r": NS_R2,
|
|
125339
125493
|
"cx:chartData": {
|
|
125340
125494
|
"cx:data": chartData.series.map(
|
|
125341
125495
|
(series, index) => buildChartExData(chartData, series, index)
|
|
@@ -125349,7 +125503,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
125349
125503
|
}
|
|
125350
125504
|
return { "cx:chartSpace": chartSpace };
|
|
125351
125505
|
}
|
|
125352
|
-
var NS_CX, NS_A,
|
|
125506
|
+
var NS_CX, NS_A, NS_R2, NS_C;
|
|
125353
125507
|
var init_chart_cx_generator = __esm({
|
|
125354
125508
|
"pptx/core/utils/chart-cx-generator.ts"() {
|
|
125355
125509
|
init_chart_cx_legend();
|
|
@@ -125357,7 +125511,7 @@ var init_chart_cx_generator = __esm({
|
|
|
125357
125511
|
init_chart_cx_legend();
|
|
125358
125512
|
NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
125359
125513
|
NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
125360
|
-
|
|
125514
|
+
NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
125361
125515
|
NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
125362
125516
|
}
|
|
125363
125517
|
});
|
|
@@ -126984,7 +127138,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
126984
127138
|
"c:chartSpace": {
|
|
126985
127139
|
"@_xmlns:c": NS_C2,
|
|
126986
127140
|
"@_xmlns:a": NS_A2,
|
|
126987
|
-
"@_xmlns:r":
|
|
127141
|
+
"@_xmlns:r": NS_R3,
|
|
126988
127142
|
"c:chart": chart
|
|
126989
127143
|
}
|
|
126990
127144
|
};
|
|
@@ -126992,7 +127146,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
126992
127146
|
applyGeneratedChartSpaceFormat(result, chartData);
|
|
126993
127147
|
return result;
|
|
126994
127148
|
}
|
|
126995
|
-
var NS_C2, NS_A2,
|
|
127149
|
+
var NS_C2, NS_A2, NS_R3, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
|
|
126996
127150
|
var init_chart_xml_generator = __esm({
|
|
126997
127151
|
"pptx/core/utils/chart-xml-generator.ts"() {
|
|
126998
127152
|
init_chart_bubble_options();
|
|
@@ -127013,7 +127167,7 @@ var init_chart_xml_generator = __esm({
|
|
|
127013
127167
|
init_chart_xml_series_fill();
|
|
127014
127168
|
NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
127015
127169
|
NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
127016
|
-
|
|
127170
|
+
NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
127017
127171
|
CAT_AX_ID = 111111111;
|
|
127018
127172
|
VAL_AX_ID = 222222222;
|
|
127019
127173
|
SER_AX_ID = 333333333;
|
|
@@ -129165,7 +129319,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
|
|
|
129165
129319
|
}
|
|
129166
129320
|
return rPr;
|
|
129167
129321
|
}
|
|
129168
|
-
function
|
|
129322
|
+
function asArray5(value) {
|
|
129169
129323
|
if (Array.isArray(value)) {
|
|
129170
129324
|
return value;
|
|
129171
129325
|
}
|
|
@@ -129184,7 +129338,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
129184
129338
|
return txKey;
|
|
129185
129339
|
}
|
|
129186
129340
|
const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
|
|
129187
|
-
const paragraphs =
|
|
129341
|
+
const paragraphs = asArray5(rich[pKey]).map((para) => {
|
|
129188
129342
|
const next = { ...para };
|
|
129189
129343
|
const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
|
|
129190
129344
|
const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
|
|
@@ -129197,7 +129351,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
129197
129351
|
next[pPrKey] = pPr;
|
|
129198
129352
|
const rKey = findKey30(next, "r", getLocalName2);
|
|
129199
129353
|
if (rKey) {
|
|
129200
|
-
const runs =
|
|
129354
|
+
const runs = asArray5(next[rKey]).map((run2) => {
|
|
129201
129355
|
const rPrKey = findKey30(run2, "rPr", getLocalName2) ?? "a:rPr";
|
|
129202
129356
|
const existingRPr = run2[rPrKey] ?? {};
|
|
129203
129357
|
const nextRun = { ...run2 };
|
|
@@ -129591,7 +129745,7 @@ var init_chart_neutral_save = __esm({
|
|
|
129591
129745
|
function findKey31(node, localName29, getLocalName2) {
|
|
129592
129746
|
return Object.keys(node).find((key2) => getLocalName2(key2) === localName29);
|
|
129593
129747
|
}
|
|
129594
|
-
function
|
|
129748
|
+
function asArray6(value) {
|
|
129595
129749
|
if (value === void 0 || value === null) {
|
|
129596
129750
|
return [];
|
|
129597
129751
|
}
|
|
@@ -129605,8 +129759,8 @@ function dimensionType(node) {
|
|
|
129605
129759
|
function replaceLevels(target, source, getLocalName2) {
|
|
129606
129760
|
const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
|
|
129607
129761
|
const sourceKey = findKey31(source, "lvl", getLocalName2);
|
|
129608
|
-
const oldLevels =
|
|
129609
|
-
const newLevels =
|
|
129762
|
+
const oldLevels = asArray6(target[targetKey]);
|
|
129763
|
+
const newLevels = asArray6(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
|
|
129610
129764
|
const old = oldLevels[index];
|
|
129611
129765
|
if (!old) {
|
|
129612
129766
|
return level2;
|
|
@@ -129625,8 +129779,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
|
|
|
129625
129779
|
for (const kind of ["strDim", "numDim"]) {
|
|
129626
129780
|
const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
|
|
129627
129781
|
const freshKey = findKey31(fresh, kind, getLocalName2);
|
|
129628
|
-
const existing =
|
|
129629
|
-
const incoming =
|
|
129782
|
+
const existing = asArray6(target[targetKey]);
|
|
129783
|
+
const incoming = asArray6(freshKey ? fresh[freshKey] : void 0);
|
|
129630
129784
|
for (const dimension of incoming) {
|
|
129631
129785
|
const wantedType = dimensionType(dimension);
|
|
129632
129786
|
let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
|
|
@@ -129664,7 +129818,7 @@ function child29(node, localName29, getLocalName2) {
|
|
|
129664
129818
|
const value = key2 ? node[key2] : void 0;
|
|
129665
129819
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
129666
129820
|
}
|
|
129667
|
-
function
|
|
129821
|
+
function asArray7(value) {
|
|
129668
129822
|
if (value === void 0 || value === null) {
|
|
129669
129823
|
return [];
|
|
129670
129824
|
}
|
|
@@ -129853,7 +130007,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
|
|
|
129853
130007
|
getLocalName2
|
|
129854
130008
|
);
|
|
129855
130009
|
const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
|
|
129856
|
-
const first2 = region && seriesKey ?
|
|
130010
|
+
const first2 = region && seriesKey ? asArray7(region[seriesKey])[0] : void 0;
|
|
129857
130011
|
const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
|
|
129858
130012
|
const series = chartData.series[0];
|
|
129859
130013
|
if (!existing || !series) {
|
|
@@ -129871,9 +130025,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
|
|
|
129871
130025
|
const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
|
|
129872
130026
|
const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
|
|
129873
130027
|
const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
|
|
129874
|
-
const dataNodes =
|
|
130028
|
+
const dataNodes = asArray7(chartDataNode[dataKey]);
|
|
129875
130029
|
const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
|
|
129876
|
-
const existing =
|
|
130030
|
+
const existing = asArray7(region[seriesKey]);
|
|
129877
130031
|
const updated = [];
|
|
129878
130032
|
chartData.series.forEach((series, index) => {
|
|
129879
130033
|
const node = existing[index];
|
|
@@ -129955,157 +130109,6 @@ var init_chart_external_workbook_save = __esm({
|
|
|
129955
130109
|
}
|
|
129956
130110
|
});
|
|
129957
130111
|
|
|
129958
|
-
// pptx/core/core/runtime/chart-part-registration.ts
|
|
129959
|
-
function asArray7(value) {
|
|
129960
|
-
if (value === void 0 || value === null) {
|
|
129961
|
-
return [];
|
|
129962
|
-
}
|
|
129963
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
129964
|
-
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
129965
|
-
);
|
|
129966
|
-
}
|
|
129967
|
-
function nextFreeChartPartPath(zip, directory) {
|
|
129968
|
-
let n = 1;
|
|
129969
|
-
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
129970
|
-
n += 1;
|
|
129971
|
-
}
|
|
129972
|
-
return `${directory}/chart${n}.xml`;
|
|
129973
|
-
}
|
|
129974
|
-
function resolvePartTarget(fromPart, target) {
|
|
129975
|
-
if (target.startsWith("/")) {
|
|
129976
|
-
return target.slice(1);
|
|
129977
|
-
}
|
|
129978
|
-
const segments = fromPart.split("/").slice(0, -1);
|
|
129979
|
-
for (const segment of target.split("/")) {
|
|
129980
|
-
if (segment === "..") {
|
|
129981
|
-
segments.pop();
|
|
129982
|
-
} else if (segment !== "." && segment !== "") {
|
|
129983
|
-
segments.push(segment);
|
|
129984
|
-
}
|
|
129985
|
-
}
|
|
129986
|
-
return segments.join("/");
|
|
129987
|
-
}
|
|
129988
|
-
function relativePartTarget2(fromPart, toPart) {
|
|
129989
|
-
const from = fromPart.split("/").slice(0, -1);
|
|
129990
|
-
const to = toPart.split("/");
|
|
129991
|
-
let common = 0;
|
|
129992
|
-
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
129993
|
-
common += 1;
|
|
129994
|
-
}
|
|
129995
|
-
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
129996
|
-
}
|
|
129997
|
-
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
129998
|
-
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
129999
|
-
if (!xml) {
|
|
130000
|
-
return;
|
|
130001
|
-
}
|
|
130002
|
-
const tree = deps.parser.parse(xml);
|
|
130003
|
-
const types = tree["Types"] ?? {};
|
|
130004
|
-
const overrides28 = asArray7(types["Override"]);
|
|
130005
|
-
const partName = `/${partPath}`;
|
|
130006
|
-
if (overrides28.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
130007
|
-
return;
|
|
130008
|
-
}
|
|
130009
|
-
overrides28.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
130010
|
-
types["Override"] = overrides28;
|
|
130011
|
-
tree["Types"] = types;
|
|
130012
|
-
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
130013
|
-
}
|
|
130014
|
-
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
130015
|
-
const slash = slidePath.lastIndexOf("/");
|
|
130016
|
-
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
130017
|
-
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
130018
|
-
if (!xml) {
|
|
130019
|
-
return void 0;
|
|
130020
|
-
}
|
|
130021
|
-
const tree = deps.parser.parse(xml);
|
|
130022
|
-
const root = tree["Relationships"];
|
|
130023
|
-
const relationships3 = asArray7(root?.["Relationship"]);
|
|
130024
|
-
const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
|
|
130025
|
-
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
130026
|
-
);
|
|
130027
|
-
if (!match || !root) {
|
|
130028
|
-
return void 0;
|
|
130029
|
-
}
|
|
130030
|
-
match["@_Type"] = rewrite.relationshipType;
|
|
130031
|
-
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
130032
|
-
delete match["@_TargetMode"];
|
|
130033
|
-
root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
|
|
130034
|
-
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
130035
|
-
return String(match["@_Id"]);
|
|
130036
|
-
}
|
|
130037
|
-
function rebindGraphicData(node, relationshipId2, extended) {
|
|
130038
|
-
for (const key2 of Object.keys(node)) {
|
|
130039
|
-
delete node[key2];
|
|
130040
|
-
}
|
|
130041
|
-
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
130042
|
-
if (extended) {
|
|
130043
|
-
node["cx:chart"] = {
|
|
130044
|
-
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
130045
|
-
"@_xmlns:r": NS_R3,
|
|
130046
|
-
"@_r:id": relationshipId2
|
|
130047
|
-
};
|
|
130048
|
-
} else {
|
|
130049
|
-
node["c:chart"] = {
|
|
130050
|
-
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
130051
|
-
"@_xmlns:r": NS_R3,
|
|
130052
|
-
"@_r:id": relationshipId2
|
|
130053
|
-
};
|
|
130054
|
-
}
|
|
130055
|
-
}
|
|
130056
|
-
function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
|
|
130057
|
-
if (!node || typeof node !== "object") {
|
|
130058
|
-
return 0;
|
|
130059
|
-
}
|
|
130060
|
-
if (Array.isArray(node)) {
|
|
130061
|
-
return node.reduce(
|
|
130062
|
-
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
|
|
130063
|
-
0
|
|
130064
|
-
);
|
|
130065
|
-
}
|
|
130066
|
-
const object = node;
|
|
130067
|
-
let count = 0;
|
|
130068
|
-
for (const key2 of Object.keys(object)) {
|
|
130069
|
-
if (key2.startsWith("@_")) {
|
|
130070
|
-
continue;
|
|
130071
|
-
}
|
|
130072
|
-
const value = object[key2];
|
|
130073
|
-
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
130074
|
-
for (const candidate of asArray7(value)) {
|
|
130075
|
-
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
130076
|
-
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
130077
|
-
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
130078
|
-
rebindGraphicData(candidate, relationshipId2, extended);
|
|
130079
|
-
count += 1;
|
|
130080
|
-
}
|
|
130081
|
-
}
|
|
130082
|
-
continue;
|
|
130083
|
-
}
|
|
130084
|
-
count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
|
|
130085
|
-
}
|
|
130086
|
-
return count;
|
|
130087
|
-
}
|
|
130088
|
-
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
|
|
130089
|
-
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
130090
|
-
if (!xml) {
|
|
130091
|
-
return 0;
|
|
130092
|
-
}
|
|
130093
|
-
const tree = deps.parser.parse(xml);
|
|
130094
|
-
const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
|
|
130095
|
-
if (count > 0) {
|
|
130096
|
-
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
130097
|
-
}
|
|
130098
|
-
return count;
|
|
130099
|
-
}
|
|
130100
|
-
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R3;
|
|
130101
|
-
var init_chart_part_registration = __esm({
|
|
130102
|
-
"pptx/core/core/runtime/chart-part-registration.ts"() {
|
|
130103
|
-
CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
130104
|
-
CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
130105
|
-
NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
130106
|
-
}
|
|
130107
|
-
});
|
|
130108
|
-
|
|
130109
130112
|
// pptx/core/core/runtime/chart-part-family-switch.ts
|
|
130110
130113
|
function detectChartPartFamily(chartSpace, getLocalName2) {
|
|
130111
130114
|
const keys = Object.keys(chartSpace);
|
|
@@ -134152,18 +134155,22 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
134152
134155
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
134153
134156
|
* a `p:cNvPr` parent.
|
|
134154
134157
|
*/
|
|
134155
|
-
serializeSingleAction(cNvPr, nodeName, action,
|
|
134158
|
+
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
134156
134159
|
if (!action) {
|
|
134157
134160
|
delete cNvPr[nodeName];
|
|
134158
134161
|
return;
|
|
134159
134162
|
}
|
|
134160
134163
|
const node = {};
|
|
134164
|
+
const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
|
|
134161
134165
|
let rId = action.rId;
|
|
134162
|
-
if (
|
|
134166
|
+
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
134167
|
+
rId = void 0;
|
|
134168
|
+
}
|
|
134169
|
+
if (!rId && url) {
|
|
134163
134170
|
const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
|
|
134164
134171
|
action.action ?? ""
|
|
134165
134172
|
);
|
|
134166
|
-
rId = resolveHyperlinkRelationshipId(
|
|
134173
|
+
rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
|
|
134167
134174
|
}
|
|
134168
134175
|
node["@_r:id"] = rId ?? "";
|
|
134169
134176
|
if (action.action) {
|
|
@@ -134237,7 +134244,7 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
134237
134244
|
* the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
|
|
134238
134245
|
* non-visual properties.
|
|
134239
134246
|
*/
|
|
134240
|
-
serializeElementActions(shape, el,
|
|
134247
|
+
serializeElementActions(shape, el, links) {
|
|
134241
134248
|
const key2 = this.getTreeBucketKeyForElementType(el.type);
|
|
134242
134249
|
const cNvPr = this.getCnvPrNode(shape, key2);
|
|
134243
134250
|
if (!cNvPr) {
|
|
@@ -134245,8 +134252,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
134245
134252
|
}
|
|
134246
134253
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
134247
134254
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
134248
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick,
|
|
134249
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover,
|
|
134255
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
134256
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
134250
134257
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
134251
134258
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
134252
134259
|
}
|
|
@@ -147874,7 +147881,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
|
|
|
147874
147881
|
if (ctx.connectorShapeIds) {
|
|
147875
147882
|
applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
|
|
147876
147883
|
}
|
|
147877
|
-
this.serializeElementActions(shape, el, ctx
|
|
147884
|
+
this.serializeElementActions(shape, el, ctx);
|
|
147878
147885
|
this.serializeShapeLocks(shape, el);
|
|
147879
147886
|
this.applyHiddenToCnvPr(shape, el);
|
|
147880
147887
|
this.applyNameToCnvPr(shape, el);
|
|
@@ -148852,6 +148859,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
148852
148859
|
init_theme_override_utils();
|
|
148853
148860
|
init_builders();
|
|
148854
148861
|
init_authored_slide_background();
|
|
148862
|
+
init_chart_part_registration();
|
|
148855
148863
|
init_PptxHandlerRuntimeSaveElementWriter();
|
|
148856
148864
|
init_save_structural_id_gate();
|
|
148857
148865
|
init_slide_fingerprint();
|
|
@@ -148987,7 +148995,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
148987
148995
|
* Process a single slide during save: update slide XML, process elements,
|
|
148988
148996
|
* rebuild shape tree, and persist relationships.
|
|
148989
148997
|
*/
|
|
148990
|
-
async processSlideForSave(slide, saveSession, constants) {
|
|
148998
|
+
async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
|
|
148991
148999
|
if (this.canSkipSlideSave(slide)) {
|
|
148992
149000
|
return;
|
|
148993
149001
|
}
|
|
@@ -149172,6 +149180,10 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
|
|
|
149172
149180
|
slideRelationshipRegistry,
|
|
149173
149181
|
resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
|
|
149174
149182
|
getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
|
|
149183
|
+
slideTargetAt: (index) => {
|
|
149184
|
+
const target = slidePaths[index];
|
|
149185
|
+
return target ? relativePartTarget2(slide.id, target) : void 0;
|
|
149186
|
+
},
|
|
149175
149187
|
resolvedMediaBytes,
|
|
149176
149188
|
saveSession,
|
|
149177
149189
|
slideImageRelationshipType: constants.slideImageRelationshipType,
|
|
@@ -151547,8 +151559,9 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
151547
151559
|
await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
|
|
151548
151560
|
await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
|
|
151549
151561
|
this.templateElementBaselines.beginSave();
|
|
151562
|
+
const slidePaths = slides.map((slide) => slide.id);
|
|
151550
151563
|
for (const slide of slides) {
|
|
151551
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
151564
|
+
await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
|
|
151552
151565
|
}
|
|
151553
151566
|
this.templateElementBaselines.commitSave();
|
|
151554
151567
|
const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -152034,7 +152047,13 @@ var init_PptxHandlerRuntimeElementParsing = __esm({
|
|
|
152034
152047
|
if (posterRId && relsMap) {
|
|
152035
152048
|
const posterTarget = relsMap.get(posterRId);
|
|
152036
152049
|
if (posterTarget) {
|
|
152037
|
-
if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")
|
|
152050
|
+
if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")) {
|
|
152051
|
+
if (this.allowExternalImages === true) {
|
|
152052
|
+
posterImage = posterTarget;
|
|
152053
|
+
imagePath = posterTarget;
|
|
152054
|
+
imageData = posterTarget;
|
|
152055
|
+
}
|
|
152056
|
+
} else if (posterTarget.startsWith("data:")) {
|
|
152038
152057
|
posterImage = posterTarget;
|
|
152039
152058
|
imagePath = posterTarget;
|
|
152040
152059
|
imageData = posterTarget;
|
|
@@ -153220,7 +153239,12 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
|
153220
153239
|
const slideRels = this.slideRelsMap.get(slidePath);
|
|
153221
153240
|
const target = slideRels?.get(relId);
|
|
153222
153241
|
if (target) {
|
|
153223
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
153242
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
153243
|
+
if (this.allowExternalImages === true) {
|
|
153244
|
+
imagePath = target;
|
|
153245
|
+
imageData = target;
|
|
153246
|
+
}
|
|
153247
|
+
} else if (target.startsWith("data:")) {
|
|
153224
153248
|
imagePath = target;
|
|
153225
153249
|
imageData = target;
|
|
153226
153250
|
} else {
|
|
@@ -153693,7 +153717,9 @@ var init_PptxHandlerRuntimeBulletParsing = __esm({
|
|
|
153693
153717
|
const target = slideRels?.get(imageRelId);
|
|
153694
153718
|
let imageDataUrl;
|
|
153695
153719
|
if (target) {
|
|
153696
|
-
if (target.startsWith("http://") || target.startsWith("https://")
|
|
153720
|
+
if (target.startsWith("http://") || target.startsWith("https://")) {
|
|
153721
|
+
imageDataUrl = this.allowExternalImages === true ? target : void 0;
|
|
153722
|
+
} else if (target.startsWith("data:")) {
|
|
153697
153723
|
imageDataUrl = target;
|
|
153698
153724
|
} else {
|
|
153699
153725
|
const imagePath = this.resolveImagePath(slidePath, target);
|
|
@@ -163423,6 +163449,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
163423
163449
|
async enrichBulletPictureElementsWithEmbeddedData(elements3, slidePath) {
|
|
163424
163450
|
await enrichBulletPictureImages(elements3, slidePath, {
|
|
163425
163451
|
slideRelsMap: this.slideRelsMap,
|
|
163452
|
+
allowExternalImages: this.allowExternalImages === true,
|
|
163426
163453
|
resolveImagePath: (path3, target) => this.resolveImagePath(path3, target),
|
|
163427
163454
|
getImageData: (imagePath) => this.getImageData(imagePath)
|
|
163428
163455
|
});
|