@office-open/pptx 0.6.6 → 0.6.7

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.
@@ -1,5 +1,5 @@
1
- import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-DJOrGtkp.js";
2
- import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent, NextAttributeComponent, OoxmlMimeType, PPTX_NS, Relationships, XmlComponent, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, buildCorePropertiesXml, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPixels as convertEmuToPixels$1, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPixelsToEmu as convertPixelsToEmu$1, convertPointsToEmu, createPacker, createReplacer, escapeRegex, formatId, getReferencedMedia, hasPlaceholders, hashedId, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, toJson, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipSync, xsdLineEndSize, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, zipAndConvert } from "@office-open/core";
1
+ import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-090QGkrx.mjs";
2
+ import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent, NextAttributeComponent, OoxmlMimeType, PPTX_NS, Relationships, XmlComponent, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, buildCorePropertiesXml, buildCorePropertiesXmlString, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPixels as convertEmuToPixels$1, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPixelsToEmu as convertPixelsToEmu$1, convertPointsToEmu, createPacker, createReplacer, formatId, getReferencedMedia, hasPlaceholders, hashedId, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, toJson, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipSync, xsdLineEndSize, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, zipAndConvert } from "@office-open/core";
3
3
  import { BevelPresetType, CompoundLine, LineCap, LineJoin, PathShadeType, PenAlignment, PresetDash, PresetGeometry, PresetMaterialType, Stretch, TileFlipMode, buildFill, createBevel, createBlip, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createEffectList as createEffectList$1, createGradientFill, createGradientStop, createGroupTransform2D, createOutline, createOutline as createOutline$1, createScene3D, createScene3D as createScene3D$1, createShape3D, createShape3D as createShape3D$1, createTransform2D, extractBlipFillMedia } from "@office-open/core/drawingml";
4
4
  import { ChartCollection, ChartSpace } from "@office-open/core/chart";
5
5
  import { attr, attrBool, attrNum, children, colorAttr, escapeXml, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
@@ -116,7 +116,7 @@ function createPptxEffectList(options) {
116
116
  return effectListOpts ? createEffectList$1(effectListOpts) : null;
117
117
  }
118
118
  var ReflectionAlignment;
119
- var init_effects = __esmMin(() => {
119
+ var init_effects = __esmMin((() => {
120
120
  ReflectionAlignment = {
121
121
  TOP_LEFT: "topLeft",
122
122
  TOP: "top",
@@ -128,23 +128,23 @@ var init_effects = __esmMin(() => {
128
128
  BOTTOM: "bottom",
129
129
  BOTTOM_RIGHT: "bottomRight"
130
130
  };
131
- });
131
+ }));
132
132
  //#endregion
133
133
  //#region src/file/drawingml/fill.ts
134
- var init_fill = __esmMin(() => {});
134
+ var init_fill = __esmMin((() => {}));
135
135
  //#endregion
136
136
  //#region src/file/xml-components/base.ts
137
- var init_base = __esmMin(() => {});
137
+ var init_base = __esmMin((() => {}));
138
138
  //#endregion
139
139
  //#region src/file/xml-components/index.ts
140
- var init_xml_components = __esmMin(() => {
140
+ var init_xml_components = __esmMin((() => {
141
141
  init_base();
142
- });
142
+ }));
143
143
  //#endregion
144
144
  //#region src/file/background/background.ts
145
145
  var background_exports = /* @__PURE__ */ __exportAll({ Background: () => Background });
146
146
  var Background, BackgroundProperties;
147
- var init_background = __esmMin(() => {
147
+ var init_background = __esmMin((() => {
148
148
  init_effects();
149
149
  init_fill();
150
150
  init_xml_components();
@@ -179,7 +179,7 @@ var init_background = __esmMin(() => {
179
179
  return obj;
180
180
  }
181
181
  };
182
- });
182
+ }));
183
183
  //#endregion
184
184
  //#region src/file/chart/chart-collection.ts
185
185
  init_background();
@@ -480,6 +480,9 @@ var CoreProperties = class extends BaseXmlComponent {
480
480
  prepForXml(_context) {
481
481
  return buildCorePropertiesXml(this.options);
482
482
  }
483
+ toXml(_context) {
484
+ return buildCorePropertiesXmlString(this.options);
485
+ }
483
486
  };
484
487
  //#endregion
485
488
  //#region src/file/hyperlink-collection.ts
@@ -1300,6 +1303,9 @@ var PresentationProperties = class PresentationProperties extends ImportedXmlCom
1300
1303
  prepForXml() {
1301
1304
  return PresentationProperties.cache.get(this.key).prepForXml({ stack: [] });
1302
1305
  }
1306
+ toXml(context) {
1307
+ return PresentationProperties.cache.get(this.key).toXml(context);
1308
+ }
1303
1309
  };
1304
1310
  function presPropsKey(o) {
1305
1311
  return `l${o.loop ? 1 : 0}k${o.kiosk ? 1 : 0}n${o.showNarration ? 1 : 0}t${o.useTimings ? 1 : 0}`;
@@ -2732,24 +2738,12 @@ var DrawingTable = class extends BaseXmlComponent {
2732
2738
  bandCol: opts.bandCol
2733
2739
  }).prepForXml(context);
2734
2740
  if (tblPrObj) children.push(tblPrObj);
2735
- const gridObj = new TableGrid(opts.columnWidths && opts.columnWidths.length > 0 ? [...opts.columnWidths] : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0)).prepForXml(context);
2741
+ const gridObj = new TableGrid(opts.columnWidths && opts.columnWidths.length > 0 ? opts.columnWidths : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0)).prepForXml(context);
2736
2742
  if (gridObj) children.push(gridObj);
2737
- const tb = opts.borders;
2738
2743
  const rowCount = opts.rows.length;
2739
2744
  for (let ri = 0; ri < rowCount; ri++) {
2740
2745
  const row = opts.rows[ri];
2741
- const colCount = row.cells.length;
2742
- const cells = tb ? row.cells.map((cell, ci) => {
2743
- const b = { ...cell.borders };
2744
- if (ri === 0 && tb.top && !b.top) b.top = tb.top;
2745
- if (ri === rowCount - 1 && tb.bottom && !b.bottom) b.bottom = tb.bottom;
2746
- if (ci === 0 && tb.left && !b.left) b.left = tb.left;
2747
- if (ci === colCount - 1 && tb.right && !b.right) b.right = tb.right;
2748
- return Object.keys(b).length === 0 ? cell : {
2749
- ...cell,
2750
- borders: b
2751
- };
2752
- }) : row.cells;
2746
+ const cells = this.distributeBorders(row, ri, rowCount, opts.borders);
2753
2747
  const trObj = new TableRow({
2754
2748
  ...row,
2755
2749
  cells
@@ -2770,24 +2764,12 @@ var DrawingTable = class extends BaseXmlComponent {
2770
2764
  bandCol: opts.bandCol
2771
2765
  });
2772
2766
  parts.push(tblPr.toXml(context));
2773
- const colWidths = opts.columnWidths && opts.columnWidths.length > 0 ? [...opts.columnWidths] : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0);
2767
+ const colWidths = opts.columnWidths && opts.columnWidths.length > 0 ? opts.columnWidths : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0);
2774
2768
  parts.push(new TableGrid(colWidths).toXml(context));
2775
- const tb = opts.borders;
2776
2769
  const rowCount = opts.rows.length;
2777
2770
  for (let ri = 0; ri < rowCount; ri++) {
2778
2771
  const row = opts.rows[ri];
2779
- const colCount = row.cells.length;
2780
- const cells = tb ? row.cells.map((cell, ci) => {
2781
- const b = { ...cell.borders };
2782
- if (ri === 0 && tb.top && !b.top) b.top = tb.top;
2783
- if (ri === rowCount - 1 && tb.bottom && !b.bottom) b.bottom = tb.bottom;
2784
- if (ci === 0 && tb.left && !b.left) b.left = tb.left;
2785
- if (ci === colCount - 1 && tb.right && !b.right) b.right = tb.right;
2786
- return Object.keys(b).length === 0 ? cell : {
2787
- ...cell,
2788
- borders: b
2789
- };
2790
- }) : row.cells;
2772
+ const cells = this.distributeBorders(row, ri, rowCount, opts.borders);
2791
2773
  parts.push(new TableRow({
2792
2774
  ...row,
2793
2775
  cells
@@ -2795,6 +2777,29 @@ var DrawingTable = class extends BaseXmlComponent {
2795
2777
  }
2796
2778
  return `<a:tbl>${parts.join("")}</a:tbl>`;
2797
2779
  }
2780
+ /** Distribute table-level borders to edge cells only when needed. */
2781
+ distributeBorders(row, ri, rowCount, tb) {
2782
+ if (!tb) return row.cells;
2783
+ const colCount = row.cells.length;
2784
+ return row.cells.map((cell, ci) => {
2785
+ const needTop = ri === 0 && !!tb.top && !cell.borders?.top;
2786
+ const needBottom = ri === rowCount - 1 && !!tb.bottom && !cell.borders?.bottom;
2787
+ const needLeft = ci === 0 && !!tb.left && !cell.borders?.left;
2788
+ const needRight = ci === colCount - 1 && !!tb.right && !cell.borders?.right;
2789
+ if (!needTop && !needBottom && !needLeft && !needRight) return cell;
2790
+ const borders = {
2791
+ ...cell.borders,
2792
+ ...needTop && { top: tb.top },
2793
+ ...needBottom && { bottom: tb.bottom },
2794
+ ...needLeft && { left: tb.left },
2795
+ ...needRight && { right: tb.right }
2796
+ };
2797
+ return {
2798
+ ...cell,
2799
+ borders
2800
+ };
2801
+ });
2802
+ }
2798
2803
  };
2799
2804
  //#endregion
2800
2805
  //#region src/file/table/table-frame.ts
@@ -3055,6 +3060,9 @@ var SlideLayout = class SlideLayout extends ImportedXmlComponent {
3055
3060
  prepForXml() {
3056
3061
  return SlideLayout.cache.get(this.cacheKey).prepForXml({ stack: [] });
3057
3062
  }
3063
+ toXml(context) {
3064
+ return SlideLayout.cache.get(this.cacheKey).toXml(context);
3065
+ }
3058
3066
  };
3059
3067
  var DefaultSlideLayout = class extends SlideLayout {
3060
3068
  constructor() {
@@ -3175,6 +3183,9 @@ var DefaultSlideMaster = class DefaultSlideMaster extends ImportedXmlComponent {
3175
3183
  prepForXml() {
3176
3184
  return DefaultSlideMaster.cache.get(this.cacheKey).prepForXml({ stack: [] });
3177
3185
  }
3186
+ toXml(context) {
3187
+ return DefaultSlideMaster.cache.get(this.cacheKey).toXml(context);
3188
+ }
3178
3189
  };
3179
3190
  //#endregion
3180
3191
  //#region src/file/animation/timing.ts
@@ -4429,6 +4440,9 @@ var TableStyles = class TableStyles extends ImportedXmlComponent {
4429
4440
  prepForXml() {
4430
4441
  return TableStyles.instance.prepForXml({ stack: [] });
4431
4442
  }
4443
+ toXml(context) {
4444
+ return TableStyles.instance.toXml(context);
4445
+ }
4432
4446
  };
4433
4447
  //#endregion
4434
4448
  //#region src/file/theme/theme.ts
@@ -4566,6 +4580,9 @@ var ViewProperties = class ViewProperties extends ImportedXmlComponent {
4566
4580
  prepForXml() {
4567
4581
  return ViewProperties.instance.prepForXml({ stack: [] });
4568
4582
  }
4583
+ toXml(context) {
4584
+ return ViewProperties.instance.toXml(context);
4585
+ }
4569
4586
  };
4570
4587
  //#endregion
4571
4588
  //#region src/file/file.ts
@@ -5050,6 +5067,9 @@ var DefaultNotesMaster = class DefaultNotesMaster extends ImportedXmlComponent {
5050
5067
  prepForXml() {
5051
5068
  return DefaultNotesMaster.instance.prepForXml({ stack: [] });
5052
5069
  }
5070
+ toXml(context) {
5071
+ return DefaultNotesMaster.instance.toXml(context);
5072
+ }
5053
5073
  };
5054
5074
  //#endregion
5055
5075
  //#region src/file/header-footer/header-footer.ts
@@ -5116,7 +5136,7 @@ init_background();
5116
5136
  function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
5117
5137
  let result = xml;
5118
5138
  hyperlinks.forEach((h, i) => {
5119
- result = result.replace(new RegExp(`\\{hlink:${escapeRegex(h.key)}\\}`, "g"), formatId(offset, i, "rId"));
5139
+ result = result.replaceAll(`{hlink:${h.key}}`, formatId(offset, i, "rId"));
5120
5140
  });
5121
5141
  return result;
5122
5142
  }
@@ -5125,27 +5145,33 @@ function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
5125
5145
  function replaceMediaPlaceholders(xml, mediaData, offset) {
5126
5146
  let result = xml;
5127
5147
  mediaData.forEach((m, i) => {
5128
- result = result.replace(new RegExp(`\\{media:${escapeRegex(m.fileName)}\\}`, "g"), formatId(offset, i, "rId"));
5148
+ result = result.replaceAll(`{media:${m.fileName}}`, formatId(offset, i, "rId"));
5129
5149
  });
5130
5150
  return result;
5131
5151
  }
5132
5152
  function replaceVideoPlaceholders(xml, mediaData, offset) {
5133
5153
  let result = xml;
5134
5154
  mediaData.forEach((m, i) => {
5135
- result = result.replace(new RegExp(`\\{video:${escapeRegex(m.fileName)}\\}`, "g"), formatId(offset, i, "rId"));
5155
+ result = result.replaceAll(`{video:${m.fileName}}`, formatId(offset, i, "rId"));
5136
5156
  });
5137
5157
  return result;
5138
5158
  }
5139
5159
  function getMediaRefs(xml, mediaArray) {
5140
- return collectRefs(xml, "media:", mediaArray);
5160
+ return collectRefs(xml, "{media:", mediaArray);
5141
5161
  }
5142
5162
  function getVideoRefs(xml, mediaArray) {
5143
- return collectRefs(xml, "video:", mediaArray);
5163
+ return collectRefs(xml, "{video:", mediaArray);
5144
5164
  }
5145
- function collectRefs(xml, prefix, mediaArray) {
5146
- const pattern = new RegExp(`\\{${escapeRegex(prefix)}([^}]+)\\}`, "g");
5165
+ function collectRefs(xml, search, mediaArray) {
5147
5166
  const keys = /* @__PURE__ */ new Set();
5148
- for (const match of xml.matchAll(pattern)) keys.add(match[1]);
5167
+ let pos = 0;
5168
+ while ((pos = xml.indexOf(search, pos)) !== -1) {
5169
+ const keyStart = pos + search.length;
5170
+ const keyEnd = xml.indexOf("}", keyStart);
5171
+ if (keyEnd === -1) break;
5172
+ keys.add(xml.substring(keyStart, keyEnd));
5173
+ pos = keyEnd + 1;
5174
+ }
5149
5175
  return mediaArray.filter((m) => keys.has(m.fileName));
5150
5176
  }
5151
5177
  //#endregion
@@ -5155,18 +5181,17 @@ const encoder$1 = new TextEncoder();
5155
5181
  var Compiler = class {
5156
5182
  formatter = new Formatter$1();
5157
5183
  compile(file, overrides = []) {
5158
- const declaration = true;
5159
5184
  const context = {
5160
5185
  fileData: file,
5161
5186
  stack: []
5162
5187
  };
5163
5188
  const mapping = {
5164
5189
  AppProperties: {
5165
- data: this.formatter.formatToXml(file.appProperties, context, declaration),
5190
+ data: this.formatter.formatToXml(file.appProperties, context),
5166
5191
  path: "docProps/app.xml"
5167
5192
  },
5168
5193
  Properties: {
5169
- data: this.formatter.formatToXml(file.coreProperties, context, declaration),
5194
+ data: this.formatter.formatToXml(file.coreProperties, context),
5170
5195
  path: "docProps/core.xml"
5171
5196
  },
5172
5197
  FileRelationships: {
@@ -5176,26 +5201,26 @@ var Compiler = class {
5176
5201
  };
5177
5202
  const themes = file.themes;
5178
5203
  for (let ti = 0; ti < themes.length; ti++) mapping[`Theme${ti}`] = {
5179
- data: this.formatter.formatToXml(themes[ti], context, declaration),
5204
+ data: this.formatter.formatToXml(themes[ti], context),
5180
5205
  path: `ppt/theme/theme${ti + 1}.xml`
5181
5206
  };
5182
5207
  mapping["TableStyles"] = {
5183
- data: this.formatter.formatToXml(file.tableStyles, context, declaration),
5208
+ data: this.formatter.formatToXml(file.tableStyles, context),
5184
5209
  path: "ppt/tableStyles.xml"
5185
5210
  };
5186
5211
  mapping["PresProps"] = {
5187
- data: this.formatter.formatToXml(file.presProps, context, declaration),
5212
+ data: this.formatter.formatToXml(file.presProps, context),
5188
5213
  path: "ppt/presProps.xml"
5189
5214
  };
5190
5215
  mapping["ViewProps"] = {
5191
- data: this.formatter.formatToXml(file.viewProps, context, declaration),
5216
+ data: this.formatter.formatToXml(file.viewProps, context),
5192
5217
  path: "ppt/viewProps.xml"
5193
5218
  };
5194
5219
  const masters = file.slideMasters;
5195
5220
  const masterRels = file.slideMasterRelsArray;
5196
5221
  for (let mi = 0; mi < masters.length; mi++) {
5197
5222
  mapping[`SlideMaster${mi}`] = {
5198
- data: this.formatter.formatToXml(masters[mi], context, declaration),
5223
+ data: this.formatter.formatToXml(masters[mi], context),
5199
5224
  path: `ppt/slideMasters/slideMaster${mi + 1}.xml`
5200
5225
  };
5201
5226
  mapping[`SlideMasterRels${mi}`] = {
@@ -5207,7 +5232,7 @@ var Compiler = class {
5207
5232
  const layoutRels = file.allLayoutRelsArray;
5208
5233
  for (let li = 0; li < layouts.length; li++) {
5209
5234
  mapping[`SlideLayout${li}`] = {
5210
- data: this.formatter.formatToXml(layouts[li].layout, context, declaration),
5235
+ data: this.formatter.formatToXml(layouts[li].layout, context),
5211
5236
  path: `ppt/slideLayouts/slideLayout${li + 1}.xml`
5212
5237
  };
5213
5238
  mapping[`SlideLayoutRels${li}`] = {
@@ -5223,7 +5248,7 @@ var Compiler = class {
5223
5248
  if (file.notesSlides.length > 0) {
5224
5249
  file.presentationWrapper.relationships.addRelationship(file.presentationWrapper.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster", "notesMasters/notesMaster1.xml");
5225
5250
  mapping["NotesMaster"] = {
5226
- data: this.formatter.formatToXml(new DefaultNotesMaster(), context, declaration),
5251
+ data: this.formatter.formatToXml(new DefaultNotesMaster(), context),
5227
5252
  path: "ppt/notesMasters/notesMaster1.xml"
5228
5253
  };
5229
5254
  mapping["NotesMasterRelationships"] = {
@@ -5232,13 +5257,11 @@ var Compiler = class {
5232
5257
  };
5233
5258
  }
5234
5259
  if (file.commentAuthorList) file.presentationWrapper.relationships.addRelationship(file.presentationWrapper.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", "commentAuthors.xml");
5235
- const presentationXml = this.formatter.formatToXml(file.presentationWrapper.view, context, declaration);
5260
+ const presentationXml = this.formatter.formatToXml(file.presentationWrapper.view, context);
5236
5261
  let currentImageCount = 0;
5237
5262
  const mediaData = getReferencedMedia(presentationXml, file.media.array);
5238
5263
  const presImageOffset = file.presentationWrapper.relationships.relationshipCount + 1;
5239
- mediaData.forEach((image, idx) => {
5240
- file.presentationWrapper.relationships.addRelationship(presImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${image.fileName}`);
5241
- });
5264
+ for (let idx = 0; idx < mediaData.length; idx++) file.presentationWrapper.relationships.addRelationship(presImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${mediaData[idx].fileName}`);
5242
5265
  const replacedPresentationXml = replaceImagePlaceholders(presentationXml, mediaData, presImageOffset);
5243
5266
  currentImageCount += mediaData.length;
5244
5267
  mapping["Presentation"] = {
@@ -5251,28 +5274,29 @@ var Compiler = class {
5251
5274
  };
5252
5275
  for (let i = 0; i < file.slides.length; i++) {
5253
5276
  const slideWrapper = file.slideWrappers[i];
5254
- const slideXml = this.formatter.formatToXml(slideWrapper.view, context, declaration);
5277
+ const slideXml = this.formatter.formatToXml(slideWrapper.view, context);
5255
5278
  const slideMediaData = getReferencedMedia(slideXml, file.media.array);
5256
5279
  const slideImageOffset = slideWrapper.relationships.relationshipCount + 1;
5257
- slideMediaData.forEach((image, idx) => {
5258
- slideWrapper.relationships.addRelationship(slideImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${image.fileName}`);
5259
- });
5280
+ for (let idx = 0; idx < slideMediaData.length; idx++) slideWrapper.relationships.addRelationship(slideImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${slideMediaData[idx].fileName}`);
5260
5281
  let replacedSlideXml = replaceImagePlaceholders(slideXml, slideMediaData, slideImageOffset);
5261
5282
  currentImageCount += slideMediaData.length;
5262
5283
  if (hasPlaceholders(replacedSlideXml)) {
5263
5284
  const slideChartKeys = collectPlaceholderKeys(replacedSlideXml, "chart:");
5264
5285
  if (slideChartKeys.length > 0) {
5265
5286
  const slideChartOffset = slideWrapper.relationships.relationshipCount + 1;
5266
- const slideCharts = file.charts.array.filter((c) => slideChartKeys.includes(c.key));
5287
+ const slideChartKeySet = new Set(slideChartKeys);
5288
+ const slideCharts = file.charts.array.filter((c) => slideChartKeySet.has(c.key));
5267
5289
  replacedSlideXml = replaceChartPlaceholders(replacedSlideXml, slideCharts.map((c) => c.key), slideChartOffset);
5268
- slideCharts.forEach((chartData, ci) => {
5290
+ for (let ci = 0; ci < slideCharts.length; ci++) {
5291
+ const chartData = slideCharts[ci];
5269
5292
  const globalIndex = file.charts.array.indexOf(chartData);
5270
5293
  slideWrapper.relationships.addRelationship(slideChartOffset + ci, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `../charts/chart${globalIndex + 1}.xml`);
5271
- });
5294
+ }
5272
5295
  }
5273
5296
  const slideSmartArtKeys = collectPlaceholderKeys(replacedSlideXml, "smartart:");
5274
5297
  if (slideSmartArtKeys.length > 0) {
5275
- const slideSmartArts = file.smartArts.array.filter((s) => slideSmartArtKeys.includes(s.key));
5298
+ const slideSmartArtKeySet = new Set(slideSmartArtKeys);
5299
+ const slideSmartArts = file.smartArts.array.filter((s) => slideSmartArtKeySet.has(s.key));
5276
5300
  const saOffset = slideWrapper.relationships.relationshipCount + 1;
5277
5301
  replacedSlideXml = replaceSmartArtPlaceholders(replacedSlideXml, slideSmartArts.map((s) => s.key), saOffset);
5278
5302
  const saGlobalStart = file.smartArts.array.indexOf(slideSmartArts[0]);
@@ -5285,12 +5309,11 @@ var Compiler = class {
5285
5309
  }
5286
5310
  const slideHlinkKeys = collectPlaceholderKeys(replacedSlideXml, "hlink:");
5287
5311
  if (slideHlinkKeys.length > 0) {
5288
- const slideHlinks = file.hyperlinks.array.filter((h) => slideHlinkKeys.includes(h.key));
5312
+ const slideHlinkKeySet = new Set(slideHlinkKeys);
5313
+ const slideHlinks = file.hyperlinks.array.filter((h) => slideHlinkKeySet.has(h.key));
5289
5314
  const hlinkOffset = slideWrapper.relationships.relationshipCount + 1;
5290
5315
  replacedSlideXml = replaceHyperlinkPlaceholders(replacedSlideXml, slideHlinks, hlinkOffset);
5291
- slideHlinks.forEach((hlink, hi) => {
5292
- slideWrapper.relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hlink.url, "External");
5293
- });
5316
+ for (let hi = 0; hi < slideHlinks.length; hi++) slideWrapper.relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", slideHlinks[hi].url, "External");
5294
5317
  }
5295
5318
  const slideMediaRefs = getMediaRefs(replacedSlideXml, file.media.array);
5296
5319
  const slideVideoRefs = getVideoRefs(replacedSlideXml, file.media.array);
@@ -5299,12 +5322,8 @@ var Compiler = class {
5299
5322
  const videoOffset = mediaOffset + slideMediaRefs.length;
5300
5323
  replacedSlideXml = replaceMediaPlaceholders(replacedSlideXml, slideMediaRefs, mediaOffset);
5301
5324
  replacedSlideXml = replaceVideoPlaceholders(replacedSlideXml, slideVideoRefs, videoOffset);
5302
- slideMediaRefs.forEach((media, mi) => {
5303
- slideWrapper.relationships.addRelationship(mediaOffset + mi, "http://schemas.microsoft.com/office/2007/relationships/media", `../media/${media.fileName}`);
5304
- });
5305
- slideVideoRefs.forEach((video, vi) => {
5306
- slideWrapper.relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${video.fileName}`);
5307
- });
5325
+ for (let mi = 0; mi < slideMediaRefs.length; mi++) slideWrapper.relationships.addRelationship(mediaOffset + mi, "http://schemas.microsoft.com/office/2007/relationships/media", `../media/${slideMediaRefs[mi].fileName}`);
5326
+ for (let vi = 0; vi < slideVideoRefs.length; vi++) slideWrapper.relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${slideVideoRefs[vi].fileName}`);
5308
5327
  }
5309
5328
  }
5310
5329
  mapping[`Slide${i}`] = {
@@ -5319,16 +5338,14 @@ var Compiler = class {
5319
5338
  path: `ppt/slides/_rels/slide${i + 1}.xml.rels`
5320
5339
  };
5321
5340
  }
5322
- file.charts.array.forEach((_, i) => {
5323
- file.contentTypes.addChart(i + 1);
5324
- });
5325
- file.smartArts.array.forEach((_, i) => {
5341
+ for (let i = 0; i < file.charts.array.length; i++) file.contentTypes.addChart(i + 1);
5342
+ for (let i = 0; i < file.smartArts.array.length; i++) {
5326
5343
  file.contentTypes.addDiagramData(i + 1);
5327
5344
  file.contentTypes.addDiagramLayout(i + 1);
5328
5345
  file.contentTypes.addDiagramStyle(i + 1);
5329
5346
  file.contentTypes.addDiagramColors(i + 1);
5330
5347
  file.contentTypes.addDiagramDrawing(i + 1);
5331
- });
5348
+ }
5332
5349
  mapping["ContentTypes"] = {
5333
5350
  data: this.formatter.formatToXml(file.contentTypes, context),
5334
5351
  path: "[Content_Types].xml"
@@ -5336,7 +5353,7 @@ var Compiler = class {
5336
5353
  const files = compileMapping(mapping, overrides);
5337
5354
  for (let i = 0; i < file.charts.array.length; i++) {
5338
5355
  const chartData = file.charts.array[i];
5339
- files[`ppt/charts/chart${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(chartData.chartSpace, context, declaration));
5356
+ files[`ppt/charts/chart${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(chartData.chartSpace, context));
5340
5357
  files[`ppt/charts/_rels/chart${i + 1}.xml.rels`] = encoder$1.encode(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
5341
5358
  encoding: "UTF-8",
5342
5359
  standalone: "yes"
@@ -5344,7 +5361,7 @@ var Compiler = class {
5344
5361
  }
5345
5362
  for (let i = 0; i < file.smartArts.array.length; i++) {
5346
5363
  const smartArtData = file.smartArts.array[i];
5347
- files[`ppt/diagrams/data${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(smartArtData.dataModel, context, declaration));
5364
+ files[`ppt/diagrams/data${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(smartArtData.dataModel, context));
5348
5365
  files[`ppt/diagrams/layout${i + 1}.xml`] = encoder$1.encode(getLayoutXml(smartArtData.layout));
5349
5366
  files[`ppt/diagrams/quickStyle${i + 1}.xml`] = encoder$1.encode(getStyleXml(smartArtData.style));
5350
5367
  files[`ppt/diagrams/colors${i + 1}.xml`] = encoder$1.encode(getColorXml(smartArtData.color));
@@ -5352,15 +5369,15 @@ var Compiler = class {
5352
5369
  }
5353
5370
  for (let i = 0; i < file.notesSlides.length; i++) {
5354
5371
  const notesSlide = file.notesSlides[i];
5355
- files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(notesSlide, context, declaration));
5372
+ files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(notesSlide, context));
5356
5373
  files[`ppt/notesSlides/_rels/notesSlide${i + 1}.xml.rels`] = encoder$1.encode(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
5357
5374
  encoding: "UTF-8",
5358
5375
  standalone: "yes"
5359
5376
  } }));
5360
5377
  }
5361
- if (file.commentAuthorList) files["ppt/commentAuthors.xml"] = encoder$1.encode(this.formatter.formatToXml(file.commentAuthorList, context, declaration));
5378
+ if (file.commentAuthorList) files["ppt/commentAuthors.xml"] = encoder$1.encode(this.formatter.formatToXml(file.commentAuthorList, context));
5362
5379
  const commentLists = file.slideCommentLists;
5363
- for (let i = 0; i < commentLists.length; i++) if (commentLists[i]) files[`ppt/comments/comment${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(commentLists[i], context, declaration));
5380
+ for (let i = 0; i < commentLists.length; i++) if (commentLists[i]) files[`ppt/comments/comment${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(commentLists[i], context));
5364
5381
  for (const image of file.media.array) {
5365
5382
  files[`ppt/media/${image.fileName}`] = [image.data, { level: ZIP_STORED_LEVEL }];
5366
5383
  if (image.type === "svg" && "fallback" in image) {
@@ -7656,4 +7673,4 @@ __reExport(/* @__PURE__ */ __exportAll({
7656
7673
  //#endregion
7657
7674
  export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, Chart, ChartCollection, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, DrawingTable, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PatchType, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, ReflectionAlignment, Relationships, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideLayout, SlideNumberField, SlideSizePreset, SmartArt, StrikeStyle, Table, TableCell, TableCellProperties, TableProperties, TableRow, Text, TextAlignment, TextBody, TextCapitalization, TextRun, TileFlipMode, Transform2D, Transition, UnderlineStyle, VerticalAlignment, VideoFrame, buildFill, coerceChild, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPointsToEmu, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutlineCompat, createPptxEffectList, createScene3D, createShape3D, createTransformation, extractBlipFillMedia, hashedId, parseArchive, parsePptx, parsePresentation, patchPresentation, percentToTHousandths, uniqueId, uniqueNumericIdCreator, uniqueUuid };
7658
7675
 
7659
- //# sourceMappingURL=index.js.map
7676
+ //# sourceMappingURL=index.mjs.map