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.
Files changed (34) hide show
  1. package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-6ZGALYYM.cjs} +2 -2
  2. package/dist/{PptxHandler-5QBRBXRX.mjs → PptxHandler-HEPPGI32.mjs} +2 -2
  3. package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-NO7MNGOW.mjs} +1 -1
  4. package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-BCDRASRT.mjs} +2 -2
  5. package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-HFGK2BWN.cjs} +4 -4
  6. package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-OQOZE76H.mjs} +1 -1
  7. package/dist/{chunk-KONCS53X.mjs → chunk-4SGBL2H4.mjs} +4 -4
  8. package/dist/{chunk-ZXPPM63Y.mjs → chunk-63GRFYAN.mjs} +1 -1
  9. package/dist/{chunk-K6OFJ5GJ.mjs → chunk-7E45SAZJ.mjs} +201 -175
  10. package/dist/{chunk-EBJ724RB.mjs → chunk-ANIFYTKH.mjs} +1 -1
  11. package/dist/{chunk-EEHK52XB.cjs → chunk-HYCOBPCC.cjs} +201 -175
  12. package/dist/{chunk-4IIR2QEH.mjs → chunk-KE2FUFIU.mjs} +202 -176
  13. package/dist/{chunk-DNYZX6YG.mjs → chunk-VRJOOHWV.mjs} +1 -1
  14. package/dist/pptx/automation/index.cjs +209 -182
  15. package/dist/pptx/automation/index.d.ts +3 -3
  16. package/dist/pptx/automation/index.mjs +5 -5
  17. package/dist/pptx/chunks/{index-D3gKRIAi.d.ts → index-CbFowkp4.d.ts} +3 -3
  18. package/dist/pptx/chunks/{index-D3gKRIAi.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
  19. package/dist/pptx/chunks/{index-BOpULlxB.d.ts → index-D4FnOx6x.d.ts} +2 -2
  20. package/dist/pptx/chunks/{index-BOpULlxB.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
  21. package/dist/pptx/chunks/{index-B94RKk84.d.ts → index-D8DNpc1X.d.ts} +14 -4
  22. package/dist/pptx/chunks/{index-B94RKk84.d.ts.map → index-D8DNpc1X.d.ts.map} +1 -1
  23. package/dist/pptx/cli/index.cjs +209 -182
  24. package/dist/pptx/cli/index.mjs +4 -4
  25. package/dist/pptx/converter/index.d.ts +1 -1
  26. package/dist/pptx/converter/index.mjs +2 -2
  27. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  28. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  29. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  30. package/dist/pptx/index.cjs +209 -182
  31. package/dist/pptx/index.d.ts +3 -3
  32. package/dist/pptx/index.mjs +5 -5
  33. package/dist/pptx/node/index.d.ts +1 -1
  34. package/package.json +1 -1
@@ -90124,7 +90124,10 @@ async function resolveBulletImage(imageRelId, slidePath, resolver) {
90124
90124
  if (!target) {
90125
90125
  return void 0;
90126
90126
  }
90127
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
90127
+ if (target.startsWith("http://") || target.startsWith("https://")) {
90128
+ return resolver.allowExternalImages ? target : void 0;
90129
+ }
90130
+ if (target.startsWith("data:")) {
90128
90131
  return target;
90129
90132
  }
90130
90133
  const imagePath = resolver.resolveImagePath(slidePath, target);
@@ -106026,6 +106029,157 @@ var init_pptx_view_props_helpers = __esm({
106026
106029
  }
106027
106030
  });
106028
106031
 
106032
+ // pptx/core/core/runtime/chart-part-registration.ts
106033
+ function asArray4(value) {
106034
+ if (value === void 0 || value === null) {
106035
+ return [];
106036
+ }
106037
+ return (Array.isArray(value) ? value : [value]).filter(
106038
+ (entry2) => Boolean(entry2) && typeof entry2 === "object"
106039
+ );
106040
+ }
106041
+ function nextFreeChartPartPath(zip, directory) {
106042
+ let n = 1;
106043
+ while (zip.file(`${directory}/chart${n}.xml`)) {
106044
+ n += 1;
106045
+ }
106046
+ return `${directory}/chart${n}.xml`;
106047
+ }
106048
+ function resolvePartTarget(fromPart, target) {
106049
+ if (target.startsWith("/")) {
106050
+ return target.slice(1);
106051
+ }
106052
+ const segments = fromPart.split("/").slice(0, -1);
106053
+ for (const segment of target.split("/")) {
106054
+ if (segment === "..") {
106055
+ segments.pop();
106056
+ } else if (segment !== "." && segment !== "") {
106057
+ segments.push(segment);
106058
+ }
106059
+ }
106060
+ return segments.join("/");
106061
+ }
106062
+ function relativePartTarget2(fromPart, toPart) {
106063
+ const from = fromPart.split("/").slice(0, -1);
106064
+ const to = toPart.split("/");
106065
+ let common = 0;
106066
+ while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
106067
+ common += 1;
106068
+ }
106069
+ return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
106070
+ }
106071
+ async function ensureContentTypeOverride2(deps, partPath, contentType) {
106072
+ const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
106073
+ if (!xml) {
106074
+ return;
106075
+ }
106076
+ const tree = deps.parser.parse(xml);
106077
+ const types = tree["Types"] ?? {};
106078
+ const overrides = asArray4(types["Override"]);
106079
+ const partName = `/${partPath}`;
106080
+ if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
106081
+ return;
106082
+ }
106083
+ overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
106084
+ types["Override"] = overrides;
106085
+ tree["Types"] = types;
106086
+ deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
106087
+ }
106088
+ async function rewriteChartRelationship(deps, slidePath, rewrite) {
106089
+ const slash = slidePath.lastIndexOf("/");
106090
+ const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
106091
+ const xml = await deps.zip.file(relsPath2)?.async("string");
106092
+ if (!xml) {
106093
+ return void 0;
106094
+ }
106095
+ const tree = deps.parser.parse(xml);
106096
+ const root = tree["Relationships"];
106097
+ const relationships3 = asArray4(root?.["Relationship"]);
106098
+ const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
106099
+ (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
106100
+ );
106101
+ if (!match || !root) {
106102
+ return void 0;
106103
+ }
106104
+ match["@_Type"] = rewrite.relationshipType;
106105
+ match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
106106
+ delete match["@_TargetMode"];
106107
+ root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
106108
+ deps.zip.file(relsPath2, deps.builder.build(tree));
106109
+ return String(match["@_Id"]);
106110
+ }
106111
+ function rebindGraphicData(node, relationshipId2, extended) {
106112
+ for (const key2 of Object.keys(node)) {
106113
+ delete node[key2];
106114
+ }
106115
+ node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
106116
+ if (extended) {
106117
+ node["cx:chart"] = {
106118
+ "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
106119
+ "@_xmlns:r": NS_R,
106120
+ "@_r:id": relationshipId2
106121
+ };
106122
+ } else {
106123
+ node["c:chart"] = {
106124
+ "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
106125
+ "@_xmlns:r": NS_R,
106126
+ "@_r:id": relationshipId2
106127
+ };
106128
+ }
106129
+ }
106130
+ function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
106131
+ if (!node || typeof node !== "object") {
106132
+ return 0;
106133
+ }
106134
+ if (Array.isArray(node)) {
106135
+ return node.reduce(
106136
+ (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
106137
+ 0
106138
+ );
106139
+ }
106140
+ const object = node;
106141
+ let count = 0;
106142
+ for (const key2 of Object.keys(object)) {
106143
+ if (key2.startsWith("@_")) {
106144
+ continue;
106145
+ }
106146
+ const value = object[key2];
106147
+ if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
106148
+ for (const candidate of asArray4(value)) {
106149
+ const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
106150
+ const chart = chartKey ? candidate[chartKey] : void 0;
106151
+ if (chart && String(chart["@_r:id"]) === relationshipId2) {
106152
+ rebindGraphicData(candidate, relationshipId2, extended);
106153
+ count += 1;
106154
+ }
106155
+ }
106156
+ continue;
106157
+ }
106158
+ count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
106159
+ }
106160
+ return count;
106161
+ }
106162
+ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
106163
+ const xml = await deps.zip.file(slidePath)?.async("string");
106164
+ if (!xml) {
106165
+ return 0;
106166
+ }
106167
+ const tree = deps.parser.parse(xml);
106168
+ const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
106169
+ if (count > 0) {
106170
+ deps.zip.file(slidePath, deps.builder.build(tree));
106171
+ }
106172
+ return count;
106173
+ }
106174
+ var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
106175
+ var init_chart_part_registration = __esm({
106176
+ "pptx/core/core/runtime/chart-part-registration.ts"() {
106177
+ CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
106178
+ CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
106179
+ NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
106180
+ }
106181
+ });
106182
+
106029
106183
  // pptx/core/utils/chart-color-style-writer.ts
106030
106184
  function localName22(key2) {
106031
106185
  return key2.replace(/^.*:/u, "");
@@ -106295,7 +106449,7 @@ function buildChartExSpaceXml(chartData) {
106295
106449
  const chartSpace = {
106296
106450
  "@_xmlns:cx": NS_CX,
106297
106451
  "@_xmlns:a": NS_A,
106298
- "@_xmlns:r": NS_R,
106452
+ "@_xmlns:r": NS_R2,
106299
106453
  "cx:chartData": {
106300
106454
  "cx:data": chartData.series.map(
106301
106455
  (series, index) => buildChartExData(chartData, series, index)
@@ -106309,7 +106463,7 @@ function buildChartExSpaceXml(chartData) {
106309
106463
  }
106310
106464
  return { "cx:chartSpace": chartSpace };
106311
106465
  }
106312
- var NS_CX, NS_A, NS_R, NS_C;
106466
+ var NS_CX, NS_A, NS_R2, NS_C;
106313
106467
  var init_chart_cx_generator = __esm({
106314
106468
  "pptx/core/utils/chart-cx-generator.ts"() {
106315
106469
  init_chart_cx_legend();
@@ -106317,7 +106471,7 @@ var init_chart_cx_generator = __esm({
106317
106471
  init_chart_cx_legend();
106318
106472
  NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
106319
106473
  NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
106320
- NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
106474
+ NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
106321
106475
  NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
106322
106476
  }
106323
106477
  });
@@ -107944,7 +108098,7 @@ function buildChartSpaceXml(chartData) {
107944
108098
  "c:chartSpace": {
107945
108099
  "@_xmlns:c": NS_C2,
107946
108100
  "@_xmlns:a": NS_A2,
107947
- "@_xmlns:r": NS_R2,
108101
+ "@_xmlns:r": NS_R3,
107948
108102
  "c:chart": chart
107949
108103
  }
107950
108104
  };
@@ -107952,7 +108106,7 @@ function buildChartSpaceXml(chartData) {
107952
108106
  applyGeneratedChartSpaceFormat(result, chartData);
107953
108107
  return result;
107954
108108
  }
107955
- var NS_C2, NS_A2, NS_R2, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
108109
+ var NS_C2, NS_A2, NS_R3, CAT_AX_ID, VAL_AX_ID, SER_AX_ID, SCATTER_LIKE;
107956
108110
  var init_chart_xml_generator = __esm({
107957
108111
  "pptx/core/utils/chart-xml-generator.ts"() {
107958
108112
  init_chart_bubble_options();
@@ -107973,7 +108127,7 @@ var init_chart_xml_generator = __esm({
107973
108127
  init_chart_xml_series_fill();
107974
108128
  NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
107975
108129
  NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
107976
- NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
108130
+ NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
107977
108131
  CAT_AX_ID = 111111111;
107978
108132
  VAL_AX_ID = 222222222;
107979
108133
  SER_AX_ID = 333333333;
@@ -110125,7 +110279,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
110125
110279
  }
110126
110280
  return rPr;
110127
110281
  }
110128
- function asArray4(value) {
110282
+ function asArray5(value) {
110129
110283
  if (Array.isArray(value)) {
110130
110284
  return value;
110131
110285
  }
@@ -110144,7 +110298,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
110144
110298
  return txKey;
110145
110299
  }
110146
110300
  const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
110147
- const paragraphs = asArray4(rich[pKey]).map((para) => {
110301
+ const paragraphs = asArray5(rich[pKey]).map((para) => {
110148
110302
  const next = { ...para };
110149
110303
  const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
110150
110304
  const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
@@ -110157,7 +110311,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
110157
110311
  next[pPrKey] = pPr;
110158
110312
  const rKey = findKey30(next, "r", getLocalName2);
110159
110313
  if (rKey) {
110160
- const runs = asArray4(next[rKey]).map((run2) => {
110314
+ const runs = asArray5(next[rKey]).map((run2) => {
110161
110315
  const rPrKey = findKey30(run2, "rPr", getLocalName2) ?? "a:rPr";
110162
110316
  const existingRPr = run2[rPrKey] ?? {};
110163
110317
  const nextRun = { ...run2 };
@@ -110551,7 +110705,7 @@ var init_chart_neutral_save = __esm({
110551
110705
  function findKey31(node, localName28, getLocalName2) {
110552
110706
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
110553
110707
  }
110554
- function asArray5(value) {
110708
+ function asArray6(value) {
110555
110709
  if (value === void 0 || value === null) {
110556
110710
  return [];
110557
110711
  }
@@ -110565,8 +110719,8 @@ function dimensionType(node) {
110565
110719
  function replaceLevels(target, source, getLocalName2) {
110566
110720
  const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
110567
110721
  const sourceKey = findKey31(source, "lvl", getLocalName2);
110568
- const oldLevels = asArray5(target[targetKey]);
110569
- const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
110722
+ const oldLevels = asArray6(target[targetKey]);
110723
+ const newLevels = asArray6(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
110570
110724
  const old = oldLevels[index];
110571
110725
  if (!old) {
110572
110726
  return level2;
@@ -110585,8 +110739,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
110585
110739
  for (const kind of ["strDim", "numDim"]) {
110586
110740
  const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
110587
110741
  const freshKey = findKey31(fresh, kind, getLocalName2);
110588
- const existing = asArray5(target[targetKey]);
110589
- const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
110742
+ const existing = asArray6(target[targetKey]);
110743
+ const incoming = asArray6(freshKey ? fresh[freshKey] : void 0);
110590
110744
  for (const dimension of incoming) {
110591
110745
  const wantedType = dimensionType(dimension);
110592
110746
  let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
@@ -110624,7 +110778,7 @@ function child28(node, localName28, getLocalName2) {
110624
110778
  const value = key2 ? node[key2] : void 0;
110625
110779
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
110626
110780
  }
110627
- function asArray6(value) {
110781
+ function asArray7(value) {
110628
110782
  if (value === void 0 || value === null) {
110629
110783
  return [];
110630
110784
  }
@@ -110813,7 +110967,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
110813
110967
  getLocalName2
110814
110968
  );
110815
110969
  const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
110816
- const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
110970
+ const first2 = region && seriesKey ? asArray7(region[seriesKey])[0] : void 0;
110817
110971
  const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
110818
110972
  const series = chartData.series[0];
110819
110973
  if (!existing || !series) {
@@ -110831,9 +110985,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
110831
110985
  const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
110832
110986
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
110833
110987
  const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
110834
- const dataNodes = asArray6(chartDataNode[dataKey]);
110988
+ const dataNodes = asArray7(chartDataNode[dataKey]);
110835
110989
  const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
110836
- const existing = asArray6(region[seriesKey]);
110990
+ const existing = asArray7(region[seriesKey]);
110837
110991
  const updated = [];
110838
110992
  chartData.series.forEach((series, index) => {
110839
110993
  const node = existing[index];
@@ -110915,157 +111069,6 @@ var init_chart_external_workbook_save = __esm({
110915
111069
  }
110916
111070
  });
110917
111071
 
110918
- // pptx/core/core/runtime/chart-part-registration.ts
110919
- function asArray7(value) {
110920
- if (value === void 0 || value === null) {
110921
- return [];
110922
- }
110923
- return (Array.isArray(value) ? value : [value]).filter(
110924
- (entry2) => Boolean(entry2) && typeof entry2 === "object"
110925
- );
110926
- }
110927
- function nextFreeChartPartPath(zip, directory) {
110928
- let n = 1;
110929
- while (zip.file(`${directory}/chart${n}.xml`)) {
110930
- n += 1;
110931
- }
110932
- return `${directory}/chart${n}.xml`;
110933
- }
110934
- function resolvePartTarget(fromPart, target) {
110935
- if (target.startsWith("/")) {
110936
- return target.slice(1);
110937
- }
110938
- const segments = fromPart.split("/").slice(0, -1);
110939
- for (const segment of target.split("/")) {
110940
- if (segment === "..") {
110941
- segments.pop();
110942
- } else if (segment !== "." && segment !== "") {
110943
- segments.push(segment);
110944
- }
110945
- }
110946
- return segments.join("/");
110947
- }
110948
- function relativePartTarget2(fromPart, toPart) {
110949
- const from = fromPart.split("/").slice(0, -1);
110950
- const to = toPart.split("/");
110951
- let common = 0;
110952
- while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
110953
- common += 1;
110954
- }
110955
- return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
110956
- }
110957
- async function ensureContentTypeOverride2(deps, partPath, contentType) {
110958
- const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
110959
- if (!xml) {
110960
- return;
110961
- }
110962
- const tree = deps.parser.parse(xml);
110963
- const types = tree["Types"] ?? {};
110964
- const overrides = asArray7(types["Override"]);
110965
- const partName = `/${partPath}`;
110966
- if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
110967
- return;
110968
- }
110969
- overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
110970
- types["Override"] = overrides;
110971
- tree["Types"] = types;
110972
- deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
110973
- }
110974
- async function rewriteChartRelationship(deps, slidePath, rewrite) {
110975
- const slash = slidePath.lastIndexOf("/");
110976
- const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
110977
- const xml = await deps.zip.file(relsPath2)?.async("string");
110978
- if (!xml) {
110979
- return void 0;
110980
- }
110981
- const tree = deps.parser.parse(xml);
110982
- const root = tree["Relationships"];
110983
- const relationships3 = asArray7(root?.["Relationship"]);
110984
- const match = relationships3.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships3.find(
110985
- (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
110986
- );
110987
- if (!match || !root) {
110988
- return void 0;
110989
- }
110990
- match["@_Type"] = rewrite.relationshipType;
110991
- match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
110992
- delete match["@_TargetMode"];
110993
- root["Relationship"] = relationships3.length === 1 ? relationships3[0] : relationships3;
110994
- deps.zip.file(relsPath2, deps.builder.build(tree));
110995
- return String(match["@_Id"]);
110996
- }
110997
- function rebindGraphicData(node, relationshipId2, extended) {
110998
- for (const key2 of Object.keys(node)) {
110999
- delete node[key2];
111000
- }
111001
- node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
111002
- if (extended) {
111003
- node["cx:chart"] = {
111004
- "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
111005
- "@_xmlns:r": NS_R3,
111006
- "@_r:id": relationshipId2
111007
- };
111008
- } else {
111009
- node["c:chart"] = {
111010
- "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
111011
- "@_xmlns:r": NS_R3,
111012
- "@_r:id": relationshipId2
111013
- };
111014
- }
111015
- }
111016
- function visitGraphicData(node, relationshipId2, extended, getLocalName2) {
111017
- if (!node || typeof node !== "object") {
111018
- return 0;
111019
- }
111020
- if (Array.isArray(node)) {
111021
- return node.reduce(
111022
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId2, extended, getLocalName2),
111023
- 0
111024
- );
111025
- }
111026
- const object = node;
111027
- let count = 0;
111028
- for (const key2 of Object.keys(object)) {
111029
- if (key2.startsWith("@_")) {
111030
- continue;
111031
- }
111032
- const value = object[key2];
111033
- if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
111034
- for (const candidate of asArray7(value)) {
111035
- const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
111036
- const chart = chartKey ? candidate[chartKey] : void 0;
111037
- if (chart && String(chart["@_r:id"]) === relationshipId2) {
111038
- rebindGraphicData(candidate, relationshipId2, extended);
111039
- count += 1;
111040
- }
111041
- }
111042
- continue;
111043
- }
111044
- count += visitGraphicData(value, relationshipId2, extended, getLocalName2);
111045
- }
111046
- return count;
111047
- }
111048
- async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended) {
111049
- const xml = await deps.zip.file(slidePath)?.async("string");
111050
- if (!xml) {
111051
- return 0;
111052
- }
111053
- const tree = deps.parser.parse(xml);
111054
- const count = visitGraphicData(tree, relationshipId2, extended, deps.getLocalName);
111055
- if (count > 0) {
111056
- deps.zip.file(slidePath, deps.builder.build(tree));
111057
- }
111058
- return count;
111059
- }
111060
- var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R3;
111061
- var init_chart_part_registration = __esm({
111062
- "pptx/core/core/runtime/chart-part-registration.ts"() {
111063
- CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
111064
- CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
111065
- NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
111066
- }
111067
- });
111068
-
111069
111072
  // pptx/core/core/runtime/chart-part-family-switch.ts
111070
111073
  function detectChartPartFamily(chartSpace, getLocalName2) {
111071
111074
  const keys = Object.keys(chartSpace);
@@ -114145,18 +114148,22 @@ var init_PptxHandlerRuntimeElementActions = __esm({
114145
114148
  * Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
114146
114149
  * a `p:cNvPr` parent.
114147
114150
  */
114148
- serializeSingleAction(cNvPr, nodeName, action, resolveHyperlinkRelationshipId) {
114151
+ serializeSingleAction(cNvPr, nodeName, action, links) {
114149
114152
  if (!action) {
114150
114153
  delete cNvPr[nodeName];
114151
114154
  return;
114152
114155
  }
114153
114156
  const node = {};
114157
+ const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
114154
114158
  let rId = action.rId;
114155
- if (!rId && action.url) {
114159
+ if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
114160
+ rId = void 0;
114161
+ }
114162
+ if (!rId && url) {
114156
114163
  const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
114157
114164
  action.action ?? ""
114158
114165
  );
114159
- rId = resolveHyperlinkRelationshipId(action.url, forceExternal) ?? void 0;
114166
+ rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
114160
114167
  }
114161
114168
  node["@_r:id"] = rId ?? "";
114162
114169
  if (action.action) {
@@ -114230,7 +114237,7 @@ var init_PptxHandlerRuntimeElementActions = __esm({
114230
114237
  * the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
114231
114238
  * non-visual properties.
114232
114239
  */
114233
- serializeElementActions(shape, el, resolveHyperlinkRelationshipId) {
114240
+ serializeElementActions(shape, el, links) {
114234
114241
  const key2 = this.getTreeBucketKeyForElementType(el.type);
114235
114242
  const cNvPr = this.getCnvPrNode(shape, key2);
114236
114243
  if (!cNvPr) {
@@ -114238,8 +114245,8 @@ var init_PptxHandlerRuntimeElementActions = __esm({
114238
114245
  }
114239
114246
  const actionClick = "actionClick" in el ? el.actionClick : void 0;
114240
114247
  const actionHover = "actionHover" in el ? el.actionHover : void 0;
114241
- this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, resolveHyperlinkRelationshipId);
114242
- this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, resolveHyperlinkRelationshipId);
114248
+ this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
114249
+ this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
114243
114250
  const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
114244
114251
  serializeDecorativeExtension(cNvPr, isDecorative);
114245
114252
  }
@@ -127354,7 +127361,7 @@ var init_PptxHandlerRuntimeSaveElementWriter = __esm({
127354
127361
  if (ctx.connectorShapeIds) {
127355
127362
  applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
127356
127363
  }
127357
- this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
127364
+ this.serializeElementActions(shape, el, ctx);
127358
127365
  this.serializeShapeLocks(shape, el);
127359
127366
  this.applyHiddenToCnvPr(shape, el);
127360
127367
  this.applyNameToCnvPr(shape, el);
@@ -128332,6 +128339,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
128332
128339
  init_theme_override_utils();
128333
128340
  init_builders();
128334
128341
  init_authored_slide_background();
128342
+ init_chart_part_registration();
128335
128343
  init_PptxHandlerRuntimeSaveElementWriter();
128336
128344
  init_save_structural_id_gate();
128337
128345
  init_slide_fingerprint();
@@ -128467,7 +128475,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
128467
128475
  * Process a single slide during save: update slide XML, process elements,
128468
128476
  * rebuild shape tree, and persist relationships.
128469
128477
  */
128470
- async processSlideForSave(slide, saveSession, constants) {
128478
+ async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
128471
128479
  if (this.canSkipSlideSave(slide)) {
128472
128480
  return;
128473
128481
  }
@@ -128652,6 +128660,10 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
128652
128660
  slideRelationshipRegistry,
128653
128661
  resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
128654
128662
  getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
128663
+ slideTargetAt: (index) => {
128664
+ const target = slidePaths[index];
128665
+ return target ? relativePartTarget2(slide.id, target) : void 0;
128666
+ },
128655
128667
  resolvedMediaBytes,
128656
128668
  saveSession,
128657
128669
  slideImageRelationshipType: constants.slideImageRelationshipType,
@@ -131027,8 +131039,9 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
131027
131039
  await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
131028
131040
  await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
131029
131041
  this.templateElementBaselines.beginSave();
131042
+ const slidePaths = slides.map((slide) => slide.id);
131030
131043
  for (const slide of slides) {
131031
- await this.processSlideForSave(slide, saveSession, saveConstants);
131044
+ await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
131032
131045
  }
131033
131046
  this.templateElementBaselines.commitSave();
131034
131047
  const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
@@ -131514,7 +131527,13 @@ var init_PptxHandlerRuntimeElementParsing = __esm({
131514
131527
  if (posterRId && relsMap) {
131515
131528
  const posterTarget = relsMap.get(posterRId);
131516
131529
  if (posterTarget) {
131517
- if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://") || posterTarget.startsWith("data:")) {
131530
+ if (posterTarget.startsWith("http://") || posterTarget.startsWith("https://")) {
131531
+ if (this.allowExternalImages === true) {
131532
+ posterImage = posterTarget;
131533
+ imagePath = posterTarget;
131534
+ imageData = posterTarget;
131535
+ }
131536
+ } else if (posterTarget.startsWith("data:")) {
131518
131537
  posterImage = posterTarget;
131519
131538
  imagePath = posterTarget;
131520
131539
  imageData = posterTarget;
@@ -132700,7 +132719,12 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
132700
132719
  const slideRels = this.slideRelsMap.get(slidePath);
132701
132720
  const target = slideRels?.get(relId);
132702
132721
  if (target) {
132703
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
132722
+ if (target.startsWith("http://") || target.startsWith("https://")) {
132723
+ if (this.allowExternalImages === true) {
132724
+ imagePath = target;
132725
+ imageData = target;
132726
+ }
132727
+ } else if (target.startsWith("data:")) {
132704
132728
  imagePath = target;
132705
132729
  imageData = target;
132706
132730
  } else {
@@ -133173,7 +133197,9 @@ var init_PptxHandlerRuntimeBulletParsing = __esm({
133173
133197
  const target = slideRels?.get(imageRelId);
133174
133198
  let imageDataUrl;
133175
133199
  if (target) {
133176
- if (target.startsWith("http://") || target.startsWith("https://") || target.startsWith("data:")) {
133200
+ if (target.startsWith("http://") || target.startsWith("https://")) {
133201
+ imageDataUrl = this.allowExternalImages === true ? target : void 0;
133202
+ } else if (target.startsWith("data:")) {
133177
133203
  imageDataUrl = target;
133178
133204
  } else {
133179
133205
  const imagePath = this.resolveImagePath(slidePath, target);
@@ -142903,6 +142929,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
142903
142929
  async enrichBulletPictureElementsWithEmbeddedData(elements2, slidePath) {
142904
142930
  await enrichBulletPictureImages(elements2, slidePath, {
142905
142931
  slideRelsMap: this.slideRelsMap,
142932
+ allowExternalImages: this.allowExternalImages === true,
142906
142933
  resolveImagePath: (path4, target) => this.resolveImagePath(path4, target),
142907
142934
  getImageData: (imagePath) => this.getImageData(imagePath)
142908
142935
  });
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { replaceText, findText, mergePresentation } from '../../chunk-ZXPPM63Y.mjs';
3
- import { PptxMarkdownConverter } from '../../chunk-EBJ724RB.mjs';
4
- import { PptxHandler } from '../../chunk-4IIR2QEH.mjs';
5
- import { SvgExporter, isImageLikeElement, blobUrlToDataUrl } from '../../chunk-DNYZX6YG.mjs';
2
+ import { replaceText, findText, mergePresentation } from '../../chunk-63GRFYAN.mjs';
3
+ import { PptxMarkdownConverter } from '../../chunk-ANIFYTKH.mjs';
4
+ import { PptxHandler } from '../../chunk-KE2FUFIU.mjs';
5
+ import { SvgExporter, isImageLikeElement, blobUrlToDataUrl } from '../../chunk-VRJOOHWV.mjs';
6
6
  import '../../chunk-JJ37PCNR.mjs';
7
7
  import '../../chunk-3GXV5MPC.mjs';
8
8
  import '../../chunk-54S5A5PZ.mjs';
@@ -1,2 +1,2 @@
1
- import { A as SlideProcessor, B as generateMediaFilename, C as PptxJsonAssetStats, D as SvgExportOptions, E as isPptxJsonText, F as deriveOutputPath, H as ConversionResult, I as getDirectory, L as normalizePath, M as PptxConverterOptions, N as PptxMarkdownConverter, O as SvgExporter, P as DocumentConverter, R as MediaContext, S as PPTX_JSON_VERSION, T as decodePptxJsonText, U as FileSystemAdapter, V as ConversionOptions, _ as decodeJsonValue, a as deserializePptxFromJson, b as PPTX_JSON_FORMAT, c as pptxDataFromJsonDocument, d as serializePptxToJson, f as PRESENTATION_FIELD_KEYS, g as bytesToBase64, h as base64ToBytes, i as PptxJsonFormatError, j as SlideProcessorOptions, k as SlideMetadataRenderer, l as PptxJsonSerializeOptions, m as JsonAssetAccumulator, n as PptxJsonConverterOptions, o as parsePptxJson, p as PRESENTATION_FIELD_NAMES, r as applyImportedPptxData, s as parsePptxJsonDocument, t as PptxJsonConverter, u as buildPptxJsonDocument, v as encodeJsonValue, w as PptxJsonDocument, x as PPTX_JSON_MIME_TYPE, y as PPTX_JSON_FILE_EXTENSION, z as dataUrlToMediaBytes } from "../chunks/index-BOpULlxB.js";
1
+ import { A as SlideProcessor, B as generateMediaFilename, C as PptxJsonAssetStats, D as SvgExportOptions, E as isPptxJsonText, F as deriveOutputPath, H as ConversionResult, I as getDirectory, L as normalizePath, M as PptxConverterOptions, N as PptxMarkdownConverter, O as SvgExporter, P as DocumentConverter, R as MediaContext, S as PPTX_JSON_VERSION, T as decodePptxJsonText, U as FileSystemAdapter, V as ConversionOptions, _ as decodeJsonValue, a as deserializePptxFromJson, b as PPTX_JSON_FORMAT, c as pptxDataFromJsonDocument, d as serializePptxToJson, f as PRESENTATION_FIELD_KEYS, g as bytesToBase64, h as base64ToBytes, i as PptxJsonFormatError, j as SlideProcessorOptions, k as SlideMetadataRenderer, l as PptxJsonSerializeOptions, m as JsonAssetAccumulator, n as PptxJsonConverterOptions, o as parsePptxJson, p as PRESENTATION_FIELD_NAMES, r as applyImportedPptxData, s as parsePptxJsonDocument, t as PptxJsonConverter, u as buildPptxJsonDocument, v as encodeJsonValue, w as PptxJsonDocument, x as PPTX_JSON_MIME_TYPE, y as PPTX_JSON_FILE_EXTENSION, z as dataUrlToMediaBytes } from "../chunks/index-D4FnOx6x.js";
2
2
  export { type ConversionOptions, type ConversionResult, DocumentConverter, type FileSystemAdapter, type JsonAssetAccumulator, MediaContext, PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, type PptxConverterOptions, type PptxJsonAssetStats, PptxJsonConverter, type PptxJsonConverterOptions, type PptxJsonDocument, PptxJsonFormatError, type PptxJsonSerializeOptions, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, type SlideProcessorOptions, type SvgExportOptions, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, dataUrlToMediaBytes, decodeJsonValue, decodePptxJsonText, deriveOutputPath, deserializePptxFromJson, encodeJsonValue, generateMediaFilename, getDirectory, isPptxJsonText, normalizePath, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson };
@@ -1,6 +1,6 @@
1
1
  import '../../chunk-6Q7TP72Y.mjs';
2
- export { DocumentConverter, MediaContext, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, dataUrlToMediaBytes, deriveOutputPath, generateMediaFilename, getDirectory, normalizePath } from '../../chunk-EBJ724RB.mjs';
3
- export { PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PptxJsonConverter, PptxJsonFormatError, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, decodeJsonValue, decodePptxJsonText, deserializePptxFromJson, encodeJsonValue, isPptxJsonText, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson } from '../../chunk-DNYZX6YG.mjs';
2
+ export { DocumentConverter, MediaContext, PptxMarkdownConverter, SlideMetadataRenderer, SlideProcessor, dataUrlToMediaBytes, deriveOutputPath, generateMediaFilename, getDirectory, normalizePath } from '../../chunk-ANIFYTKH.mjs';
3
+ export { PPTX_JSON_FILE_EXTENSION, PPTX_JSON_FORMAT, PPTX_JSON_MIME_TYPE, PPTX_JSON_VERSION, PRESENTATION_FIELD_KEYS, PRESENTATION_FIELD_NAMES, PptxJsonConverter, PptxJsonFormatError, SvgExporter, applyImportedPptxData, base64ToBytes, buildPptxJsonDocument, bytesToBase64, decodeJsonValue, decodePptxJsonText, deserializePptxFromJson, encodeJsonValue, isPptxJsonText, parsePptxJson, parsePptxJsonDocument, pptxDataFromJsonDocument, serializePptxToJson } from '../../chunk-VRJOOHWV.mjs';
4
4
  import '../../chunk-JJ37PCNR.mjs';
5
5
  import '../../chunk-54S5A5PZ.mjs';
6
6
  import '../../chunk-KII4AAYH.mjs';
@@ -1,4 +1,4 @@
1
- import "../../chunks/index-D3gKRIAi.js";
1
+ import "../../chunks/index-CbFowkp4.js";
2
2
  import { C as PptxSlide } from "../../chunks/text-operations-CNfUj45U.js";
3
3
  //#region pptx/editor/render/find-replace.d.ts
4
4
  /** Identifies a single match of the find query at segment-level precision. */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- require('../../../chunk-EEHK52XB.cjs');
3
+ require('../../../chunk-HYCOBPCC.cjs');
4
4
  var chunkMU3XSASV_cjs = require('../../../chunk-MU3XSASV.cjs');
5
5
  require('../../../chunk-XZPZHXV4.cjs');
6
6
  require('../../../chunk-5W2QL4SB.cjs');
@@ -1,4 +1,4 @@
1
- import '../../../chunk-K6OFJ5GJ.mjs';
1
+ import '../../../chunk-7E45SAZJ.mjs';
2
2
  import { cloneSlide, cloneElement } from '../../../chunk-2XMK5SXU.mjs';
3
3
  import '../../../chunk-GXHKNSZX.mjs';
4
4
  import '../../../chunk-CA7KCNL3.mjs';