ooxml-core 1.44.0 → 1.45.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 (58) hide show
  1. package/dist/{PptxHandler-V23RDNEX.cjs → PptxHandler-3RDVJFQV.cjs} +2 -2
  2. package/dist/{PptxHandler-WB3KL2WH.mjs → PptxHandler-EI6DMHPM.mjs} +1 -1
  3. package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-FXLXIOLT.mjs} +2 -2
  4. package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-3FKFRSSV.mjs} +2 -2
  5. package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-CSKLG64K.cjs} +4 -4
  6. package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-DDYHRV26.mjs} +1 -1
  7. package/dist/automation/index.cjs +10 -1
  8. package/dist/automation/index.mjs +10 -1
  9. package/dist/chart/edit/fill.d.ts +6 -2
  10. package/dist/chart/edit/fill.d.ts.map +1 -1
  11. package/dist/chart/index.cjs +12 -3
  12. package/dist/chart/index.mjs +12 -3
  13. package/dist/{chunk-HLYOHD2Z.mjs → chunk-CVJX6NNO.mjs} +438 -108
  14. package/dist/{chunk-243ZYX2B.mjs → chunk-GGJUWJXB.mjs} +1 -1
  15. package/dist/{chunk-KCDLTVUI.mjs → chunk-GXYK3H4O.mjs} +1 -1
  16. package/dist/{chunk-WEAWSXUX.mjs → chunk-LCXBTJXE.mjs} +4 -4
  17. package/dist/{chunk-JHYU7HGG.mjs → chunk-RVYGAYCP.mjs} +1 -1
  18. package/dist/{chunk-4LEVL6ZW.mjs → chunk-U5BXJQZG.mjs} +457 -105
  19. package/dist/{chunk-RNZQ2OU4.cjs → chunk-YBSNMVSN.cjs} +437 -107
  20. package/dist/index.cjs +12 -3
  21. package/dist/index.mjs +12 -3
  22. package/dist/pptx/automation/index.cjs +529 -167
  23. package/dist/pptx/automation/index.d.ts +6 -6
  24. package/dist/pptx/automation/index.mjs +5 -5
  25. package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
  26. package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
  27. package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-6Ot1b-4U.d.ts} +6 -6
  28. package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-6Ot1b-4U.d.ts.map} +1 -1
  29. package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DGKI80Hj.d.ts} +61 -6
  30. package/dist/pptx/chunks/{index-CGNb1TV9.d.ts.map → index-DGKI80Hj.d.ts.map} +1 -1
  31. package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-jdZUtLGB.d.ts} +4 -4
  32. package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-jdZUtLGB.d.ts.map} +1 -1
  33. package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
  34. package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
  35. package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-Mek86RBL.d.ts} +3 -3
  36. package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-Mek86RBL.d.ts.map} +1 -1
  37. package/dist/pptx/cli/index.cjs +525 -163
  38. package/dist/pptx/cli/index.d.ts +1 -1
  39. package/dist/pptx/cli/index.mjs +4 -4
  40. package/dist/pptx/converter/index.d.ts +1 -1
  41. package/dist/pptx/converter/index.mjs +2 -2
  42. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  43. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  44. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  45. package/dist/pptx/editor/render/table-layout.d.ts +1 -1
  46. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  47. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  48. package/dist/pptx/index.cjs +558 -168
  49. package/dist/pptx/index.d.ts +7 -7
  50. package/dist/pptx/index.mjs +5 -5
  51. package/dist/pptx/node/index.d.ts +1 -1
  52. package/dist/xlsx/index.cjs +10 -1
  53. package/dist/xlsx/index.mjs +10 -1
  54. package/dist/xlsx/ui/index.cjs +10 -1
  55. package/dist/xlsx/ui/index.mjs +10 -1
  56. package/package.json +1 -1
  57. package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
  58. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
@@ -27423,8 +27423,8 @@ var init_smartart_layout_interpreter_cycle_ring_nested_hub = __esm({
27423
27423
 
27424
27424
  // diagram/layout/smartart-layout-interpreter-cycle-ring-offset.ts
27425
27425
  function resolveRingAxisOffset(dimension2, boundSize, scale, values) {
27426
- const span = Math.max(1e-9, Math.max(...values) - Math.min(...values));
27427
- const epsilon = span * TIE_EPSILON_FRACTION;
27426
+ const span2 = Math.max(1e-9, Math.max(...values) - Math.min(...values));
27427
+ const epsilon = span2 * TIE_EPSILON_FRACTION;
27428
27428
  const minValue = Math.min(...values);
27429
27429
  const maxValue = Math.max(...values);
27430
27430
  const lowCount = values.filter((v) => v - minValue <= epsilon).length;
@@ -29720,8 +29720,8 @@ function centeredAxisPitch(dimension2, itemSize, gapRatio, count2) {
29720
29720
  const n = Math.max(1, count2);
29721
29721
  const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
29722
29722
  const pitch = itemSize + gap;
29723
- const span = n * itemSize + Math.max(0, n - 1) * gap;
29724
- const shift = (dimension2 - span) / 2;
29723
+ const span2 = n * itemSize + Math.max(0, n - 1) * gap;
29724
+ const shift = (dimension2 - span2) / 2;
29725
29725
  return { pitch, shift };
29726
29726
  }
29727
29727
  function compositeFanPitch(dimension2, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
@@ -40196,7 +40196,7 @@ var init_patch = __esm({
40196
40196
  init_xml2();
40197
40197
  XMLNS = "http://www.w3.org/2000/xmlns/";
40198
40198
  escapeText = (text2) => text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;");
40199
- qualifiedName = (xml, span) => /^<([^\s/>]+)/.exec(xml.slice(span.start, span.openEnd))?.[1] ?? "";
40199
+ qualifiedName = (xml, span2) => /^<([^\s/>]+)/.exec(xml.slice(span2.start, span2.openEnd))?.[1] ?? "";
40200
40200
  PartPatch = class {
40201
40201
  constructor(xml, rootElement) {
40202
40202
  this.xml = xml;
@@ -40223,9 +40223,9 @@ var init_patch = __esm({
40223
40223
  this.edits.push({ start, end, text: text2, seq: this.seq++ });
40224
40224
  }
40225
40225
  span(element2) {
40226
- const span = this.spans.get(element2);
40227
- if (!span) throw new Error("Element is not a child of the patched root");
40228
- return span;
40226
+ const span2 = this.spans.get(element2);
40227
+ if (!span2) throw new Error("Element is not a child of the patched root");
40228
+ return span2;
40229
40229
  }
40230
40230
  /** The prefix bound to `ns` on the root, declaring `preferred` for it when none is. */
40231
40231
  prefix(ns, preferred) {
@@ -40245,20 +40245,20 @@ var init_patch = __esm({
40245
40245
  }
40246
40246
  /** Replaces the element's content, keeping its start tag (and attributes) as written. */
40247
40247
  setContent(element2, content2) {
40248
- const span = this.span(element2);
40249
- if (span.selfClosing)
40250
- this.add(span.openEnd - 2, span.openEnd, `>${content2}</${qualifiedName(this.xml, span)}>`);
40251
- else this.add(span.openEnd, span.closeStart, content2);
40248
+ const span2 = this.span(element2);
40249
+ if (span2.selfClosing)
40250
+ this.add(span2.openEnd - 2, span2.openEnd, `>${content2}</${qualifiedName(this.xml, span2)}>`);
40251
+ else this.add(span2.openEnd, span2.closeStart, content2);
40252
40252
  }
40253
40253
  /** Adds ` name="value"` text to the element's start tag. */
40254
40254
  addAttribute(element2, attribute5) {
40255
- const span = this.span(element2);
40256
- const at2 = span.openEnd - (span.selfClosing ? 2 : 1);
40255
+ const span2 = this.span(element2);
40256
+ const at2 = span2.openEnd - (span2.selfClosing ? 2 : 1);
40257
40257
  this.add(at2, at2, attribute5);
40258
40258
  }
40259
40259
  remove(element2) {
40260
- const span = this.span(element2);
40261
- this.add(span.start, span.end, "");
40260
+ const span2 = this.span(element2);
40261
+ this.add(span2.start, span2.end, "");
40262
40262
  }
40263
40263
  /** Inserts `markup` before `before`, or as the root's last child. */
40264
40264
  insert(markup, before) {
@@ -58583,8 +58583,8 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
58583
58583
  }
58584
58584
  continue;
58585
58585
  }
58586
- const span = oldText.slice(start, end);
58587
- if (span.length !== mention.length) {
58586
+ const span2 = oldText.slice(start, end);
58587
+ if (span2.length !== mention.length) {
58588
58588
  continue;
58589
58589
  }
58590
58590
  let next = -1;
@@ -58593,11 +58593,11 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
58593
58593
  } else if (start >= changeEnd) {
58594
58594
  next = start + delta2;
58595
58595
  }
58596
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
58596
+ if (next >= 0 && newText.slice(next, next + mention.length) === span2) {
58597
58597
  result.push(next === start ? mention : { ...mention, startIndex: next });
58598
58598
  continue;
58599
58599
  }
58600
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
58600
+ const relocated = nearestOccurrence(newText, span2, next >= 0 ? next : start);
58601
58601
  if (relocated >= 0) {
58602
58602
  result.push({ ...mention, startIndex: relocated });
58603
58603
  }
@@ -58657,17 +58657,17 @@ var init_modern_comment_mentions = __esm({
58657
58657
  }
58658
58658
  return index;
58659
58659
  };
58660
- nearestOccurrence = (text2, span, hint) => {
58660
+ nearestOccurrence = (text2, span2, hint) => {
58661
58661
  let best = -1;
58662
58662
  let bestDistance = Number.POSITIVE_INFINITY;
58663
- let at2 = text2.indexOf(span);
58663
+ let at2 = text2.indexOf(span2);
58664
58664
  while (at2 !== -1) {
58665
58665
  const distance = Math.abs(at2 - hint);
58666
58666
  if (distance < bestDistance) {
58667
58667
  best = at2;
58668
58668
  bestDistance = distance;
58669
58669
  }
58670
- at2 = text2.indexOf(span, at2 + 1);
58670
+ at2 = text2.indexOf(span2, at2 + 1);
58671
58671
  }
58672
58672
  return best;
58673
58673
  };
@@ -59494,8 +59494,8 @@ function renderBars(element2, x, y, w, h2) {
59494
59494
  const values = chartValues(element2);
59495
59495
  const min = Math.min(0, ...values);
59496
59496
  const max = Math.max(0, ...values);
59497
- const span = max - min || 1;
59498
- const zeroY = y + max / span * h2;
59497
+ const span2 = max - min || 1;
59498
+ const zeroY = y + max / span2 * h2;
59499
59499
  const categoryCount = Math.max(
59500
59500
  data.categories.length,
59501
59501
  ...data.series.map((s) => s.values.length),
@@ -59506,7 +59506,7 @@ function renderBars(element2, x, y, w, h2) {
59506
59506
  const parts = [`<line x1="${x}" y1="${zeroY}" x2="${x + w}" y2="${zeroY}" stroke="#666666" />`];
59507
59507
  data.series.forEach((series, seriesIndex) => {
59508
59508
  series.values.forEach((value, categoryIndex) => {
59509
- const valueY = y + (max - value) / span * h2;
59509
+ const valueY = y + (max - value) / span2 * h2;
59510
59510
  parts.push(
59511
59511
  `<rect data-chart-mark="bar" x="${x + categoryIndex * clusterWidth + clusterWidth * 0.14 + seriesIndex * barWidth}" y="${Math.min(valueY, zeroY)}" width="${Math.max(barWidth - 1, 1)}" height="${Math.max(Math.abs(zeroY - valueY), 0.5)}" fill="${esc3(color(series, seriesIndex))}" />`
59512
59512
  );
@@ -59519,10 +59519,10 @@ function renderLines(element2, x, y, w, h2) {
59519
59519
  const values = chartValues(element2);
59520
59520
  const min = Math.min(...values);
59521
59521
  const max = Math.max(...values);
59522
- const span = max - min || 1;
59522
+ const span2 = max - min || 1;
59523
59523
  return data.series.map((series, seriesIndex) => {
59524
59524
  const denominator = Math.max(series.values.length - 1, 1);
59525
- const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) / span * h2}`).join(" ");
59525
+ const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) / span2 * h2}`).join(" ");
59526
59526
  return `<polyline data-chart-mark="line" points="${points7}" fill="none" stroke="${esc3(color(series, seriesIndex))}" stroke-width="2" />`;
59527
59527
  }).join("");
59528
59528
  }
@@ -61003,6 +61003,44 @@ var init_chart_layout_input = __esm({
61003
61003
  }
61004
61004
  });
61005
61005
 
61006
+ // pptx/core/utils/chart-container-type-map.ts
61007
+ function chartContainerLocalNameToType(localName28) {
61008
+ return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
61009
+ }
61010
+ function isLineDrawnChartType(type) {
61011
+ return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
61012
+ }
61013
+ var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
61014
+ var init_chart_container_type_map = __esm({
61015
+ "pptx/core/utils/chart-container-type-map.ts"() {
61016
+ CONTAINER_LOCAL_NAME_TO_TYPE = {
61017
+ barChart: "bar",
61018
+ bar3DChart: "bar3D",
61019
+ lineChart: "line",
61020
+ line3DChart: "line3D",
61021
+ pieChart: "pie",
61022
+ pie3DChart: "pie3D",
61023
+ ofPieChart: "ofPie",
61024
+ doughnutChart: "doughnut",
61025
+ areaChart: "area",
61026
+ area3DChart: "area3D",
61027
+ scatterChart: "scatter",
61028
+ bubbleChart: "bubble",
61029
+ radarChart: "radar",
61030
+ stockChart: "stock",
61031
+ surfaceChart: "surface",
61032
+ surface3DChart: "surface"
61033
+ };
61034
+ LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
61035
+ "line",
61036
+ "line3D",
61037
+ "scatter",
61038
+ "radar",
61039
+ "stock"
61040
+ ]);
61041
+ }
61042
+ });
61043
+
61006
61044
  // pptx/core/builders/sdk/chart-operations.ts
61007
61045
  function ensureChartData(element2) {
61008
61046
  if (!element2.chartData) {
@@ -61277,6 +61315,289 @@ var init_shape_style_input = __esm({
61277
61315
  }
61278
61316
  });
61279
61317
 
61318
+ // pptx/core/builders/sdk/table-border-input.ts
61319
+ function borderDashSegments(edge, lengths, width) {
61320
+ const name = `TableCellInput.borders.${edge}.dash`;
61321
+ if (lengths.length === 0) {
61322
+ throw new RangeError(`${name} must give at least one length`);
61323
+ }
61324
+ if (lengths.some((n) => !Number.isFinite(n) || n <= 0)) {
61325
+ throw new RangeError(`${name} lengths must be finite and above 0, got [${lengths.join(", ")}]`);
61326
+ }
61327
+ const segments = customDashSegments([...lengths], width !== void 0 && width > 0 ? width : 1);
61328
+ if (segments.some((s) => s.dash <= 0 || s.space <= 0)) {
61329
+ throw new RangeError(`${name} has a length too short to write: [${lengths.join(", ")}]`);
61330
+ }
61331
+ if (segments.some((s) => s.dash > MAX_DASH_UNITS || s.space > MAX_DASH_UNITS)) {
61332
+ throw new RangeError(`${name} has a length too long to write: [${lengths.join(", ")}]`);
61333
+ }
61334
+ return segments;
61335
+ }
61336
+ function edgeStyle(edge, prefix, input) {
61337
+ if (input.width !== void 0 && (!Number.isFinite(input.width) || input.width < 0)) {
61338
+ throw new RangeError(
61339
+ `TableCellInput.borders.${edge}.width must be a finite width of 0 or more, got ${input.width}`
61340
+ );
61341
+ }
61342
+ const out = {};
61343
+ if (input.width !== void 0) out[`${prefix}Width`] = input.width;
61344
+ if (input.color !== void 0) out[`${prefix}Color`] = input.color;
61345
+ if (Array.isArray(input.dash)) {
61346
+ out[`${prefix}Dash`] = "custom";
61347
+ out[`${prefix}DashSegments`] = borderDashSegments(edge, input.dash, input.width);
61348
+ } else if (input.dash !== void 0) {
61349
+ if (input.dash === "custom") {
61350
+ throw new RangeError(`TableCellInput.borders.${edge}.dash: give 'custom' as a length list`);
61351
+ }
61352
+ out[`${prefix}Dash`] = input.dash;
61353
+ }
61354
+ return out;
61355
+ }
61356
+ function tableCellBorderStyle(borders) {
61357
+ if (!borders) {
61358
+ return {};
61359
+ }
61360
+ const out = {};
61361
+ for (const [edge, prefix] of EDGES) {
61362
+ const own = borders[edge];
61363
+ const input = borders.all || own ? { ...borders.all, ...own } : void 0;
61364
+ if (input) {
61365
+ Object.assign(out, edgeStyle(own ? edge : "all", prefix, input));
61366
+ }
61367
+ }
61368
+ return out;
61369
+ }
61370
+ var MAX_DASH_UNITS, EDGES;
61371
+ var init_table_border_input = __esm({
61372
+ "pptx/core/builders/sdk/table-border-input.ts"() {
61373
+ init_shape_style_input();
61374
+ MAX_DASH_UNITS = 2147483647;
61375
+ EDGES = [
61376
+ ["top", "borderTop"],
61377
+ ["right", "borderRight"],
61378
+ ["bottom", "borderBottom"],
61379
+ ["left", "borderLeft"]
61380
+ ];
61381
+ }
61382
+ });
61383
+
61384
+ // pptx/core/builders/sdk/table-cell-input.ts
61385
+ function refuseGradientExtras(fill3) {
61386
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
61387
+ const unsupported3 = [
61388
+ fill3.tile !== void 0 ? "tile" : void 0,
61389
+ fill3.scaled === false ? "scaled: false" : void 0,
61390
+ fill3.rotWithShape !== void 0 ? "rotWithShape" : void 0,
61391
+ fill3.focus !== void 0 && !radial ? "focus on a linear gradient" : void 0
61392
+ ].filter((name) => name !== void 0);
61393
+ if (unsupported3.length > 0) {
61394
+ throw new RangeError(
61395
+ `TableCellInput.fill: ${unsupported3.join(", ")} cannot be written on a table cell`
61396
+ );
61397
+ }
61398
+ if (fill3.stops.length === 0) {
61399
+ throw new RangeError("TableCellInput.fill: a gradient needs at least one stop");
61400
+ }
61401
+ }
61402
+ function tableCellFillStyle(fill3) {
61403
+ switch (fill3?.type) {
61404
+ case void 0:
61405
+ return {};
61406
+ case "solid":
61407
+ if (fill3.opacity !== void 0 && fill3.opacity !== 1) {
61408
+ throw new RangeError(
61409
+ `TableCellInput.fill.opacity cannot be written on a table cell, got ${fill3.opacity}`
61410
+ );
61411
+ }
61412
+ return {
61413
+ fillMode: "solid",
61414
+ backgroundColor: fill3.color,
61415
+ ...fill3.themeColorRef ? { backgroundColorRef: fill3.themeColorRef } : {}
61416
+ };
61417
+ case "gradient": {
61418
+ refuseGradientExtras(fill3);
61419
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
61420
+ return {
61421
+ fillMode: "gradient",
61422
+ gradientFillType: radial ? "radial" : "linear",
61423
+ gradientFillAngle: fill3.angle ?? 0,
61424
+ gradientFillStops: fill3.stops.map((stop) => ({
61425
+ color: stop.color,
61426
+ position: stop.position,
61427
+ ...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
61428
+ })),
61429
+ ...radial ? { gradientFillPathType: fill3.path ?? "circle" } : {},
61430
+ ...fill3.focus ? { gradientFillFillToRect: { ...fill3.focus } } : {}
61431
+ };
61432
+ }
61433
+ case "pattern":
61434
+ if (!fill3.preset) {
61435
+ throw new RangeError("TableCellInput.fill: a pattern fill needs a preset");
61436
+ }
61437
+ return {
61438
+ fillMode: "pattern",
61439
+ patternFillPreset: fill3.preset,
61440
+ ...fill3.foreground !== void 0 ? { patternFillForeground: fill3.foreground } : {},
61441
+ ...fill3.background !== void 0 ? { patternFillBackground: fill3.background } : {}
61442
+ };
61443
+ case "image":
61444
+ throw new RangeError("TableCellInput.fill: an image fill cannot be written on a table cell");
61445
+ case "none":
61446
+ return { fillMode: "none" };
61447
+ }
61448
+ }
61449
+ function tableCellTextStyle(style) {
61450
+ const out = {};
61451
+ if (style?.fontSize !== void 0) out.fontSize = style.fontSize;
61452
+ if (style?.bold !== void 0) out.bold = style.bold;
61453
+ if (style?.italic !== void 0) out.italic = style.italic;
61454
+ if (style?.color !== void 0) out.color = style.color;
61455
+ if (style?.alignment !== void 0) out.align = style.alignment;
61456
+ return out;
61457
+ }
61458
+ function tableCellStyle(cell2) {
61459
+ const style = {
61460
+ ...tableCellTextStyle(cell2.style),
61461
+ ...tableCellFillStyle(cell2.fill),
61462
+ ...tableCellBorderStyle(cell2.borders)
61463
+ };
61464
+ return cell2.style || Object.keys(style).length > 0 ? style : void 0;
61465
+ }
61466
+ var init_table_cell_input = __esm({
61467
+ "pptx/core/builders/sdk/table-cell-input.ts"() {
61468
+ init_table_border_input();
61469
+ }
61470
+ });
61471
+
61472
+ // pptx/core/builders/sdk/table-merge-input.ts
61473
+ function span(value, name) {
61474
+ if (value === void 0) {
61475
+ return 1;
61476
+ }
61477
+ if (!Number.isInteger(value) || value < 1) {
61478
+ throw new RangeError(`TableCellInput.${name} must be a whole number from 1, got ${value}`);
61479
+ }
61480
+ return value;
61481
+ }
61482
+ function placeTableCells(input) {
61483
+ const rowCount = input.rows.length;
61484
+ const slots = input.rows.map(() => []);
61485
+ input.rows.forEach((row, ri) => {
61486
+ const rowSlots = slots[ri] ?? [];
61487
+ let ci = 0;
61488
+ for (const cell2 of row.cells) {
61489
+ while (rowSlots[ci]) {
61490
+ ci += 1;
61491
+ }
61492
+ const colSpan = span(cell2.gridSpan, "gridSpan");
61493
+ const rowSpan = span(cell2.rowSpan, "rowSpan");
61494
+ if (ri + rowSpan > rowCount) {
61495
+ throw new RangeError(
61496
+ `A cell in row ${ri} spans ${rowSpan} rows, past the table's ${rowCount} rows`
61497
+ );
61498
+ }
61499
+ for (let dr = 0; dr < rowSpan; dr++) {
61500
+ for (let dc = 0; dc < colSpan; dc++) {
61501
+ const target = slots[ri + dr] ?? [];
61502
+ if (target[ci + dc]) {
61503
+ throw new RangeError(
61504
+ `A cell in row ${ri} overlaps the merge covering row ${ri + dr}, column ${ci + dc}`
61505
+ );
61506
+ }
61507
+ target[ci + dc] = dr === 0 && dc === 0 ? { cell: cell2 } : { hMerge: dc > 0, vMerge: dr > 0 };
61508
+ }
61509
+ }
61510
+ ci += colSpan;
61511
+ }
61512
+ });
61513
+ const widest = Math.max(...slots.map((row) => row.length), 1);
61514
+ const declared = input.columnWidths?.length;
61515
+ if (declared !== void 0 && widest > declared) {
61516
+ throw new RangeError(`A row takes ${widest} columns, but columnWidths gives ${declared}`);
61517
+ }
61518
+ const columnCount = declared ?? widest;
61519
+ return {
61520
+ columnCount,
61521
+ rows: slots.map(
61522
+ (row) => Array.from({ length: columnCount }, (_, ci) => row[ci] ?? { cell: { text: "" } })
61523
+ )
61524
+ };
61525
+ }
61526
+ function columnFractions(columnWidths, columnCount) {
61527
+ if (!columnWidths) {
61528
+ return Array.from({ length: columnCount }, () => 1 / columnCount);
61529
+ }
61530
+ if (columnWidths.length !== columnCount) {
61531
+ throw new RangeError(
61532
+ `columnWidths gives ${columnWidths.length} widths for a table of ${columnCount} columns`
61533
+ );
61534
+ }
61535
+ if (columnWidths.some((w) => !Number.isFinite(w) || w < 0)) {
61536
+ throw new RangeError("columnWidths must be finite widths of 0 or more");
61537
+ }
61538
+ const sum = columnWidths.reduce((a, b) => a + b, 0);
61539
+ if (sum <= 0) {
61540
+ throw new RangeError("columnWidths must not all be 0");
61541
+ }
61542
+ return columnWidths.map((w) => w / sum);
61543
+ }
61544
+ var init_table_merge_input = __esm({
61545
+ "pptx/core/builders/sdk/table-merge-input.ts"() {
61546
+ }
61547
+ });
61548
+
61549
+ // pptx/core/builders/sdk/text-segment-style.ts
61550
+ function elementStyleForSegments(textStyle, segments) {
61551
+ const styled = segments.filter((segment) => !segment.isParagraphBreak);
61552
+ const first2 = styled[0]?.style;
61553
+ if (!first2) {
61554
+ return textStyle;
61555
+ }
61556
+ const next = { ...textStyle };
61557
+ for (const key2 of RUN_KEYS) {
61558
+ const value = first2[key2];
61559
+ if (!styled.every((segment) => sameValue(segment.style?.[key2], value))) {
61560
+ continue;
61561
+ }
61562
+ if (value === void 0) {
61563
+ delete next[key2];
61564
+ } else {
61565
+ next[key2] = value;
61566
+ }
61567
+ }
61568
+ return next;
61569
+ }
61570
+ function sameValue(a, b) {
61571
+ if (a === b) {
61572
+ return true;
61573
+ }
61574
+ if (a && b && typeof a === "object" && typeof b === "object") {
61575
+ return JSON.stringify(a) === JSON.stringify(b);
61576
+ }
61577
+ return false;
61578
+ }
61579
+ var RUN_KEYS;
61580
+ var init_text_segment_style = __esm({
61581
+ "pptx/core/builders/sdk/text-segment-style.ts"() {
61582
+ RUN_KEYS = [
61583
+ "fontFamily",
61584
+ "fontSize",
61585
+ "bold",
61586
+ "italic",
61587
+ "underline",
61588
+ "strikethrough",
61589
+ "color",
61590
+ "colorRef",
61591
+ "characterSpacing",
61592
+ "hyperlink",
61593
+ "hyperlinkAction",
61594
+ "hyperlinkTargetSlideIndex",
61595
+ "hyperlinkTooltip",
61596
+ "align"
61597
+ ];
61598
+ }
61599
+ });
61600
+
61280
61601
  // pptx/core/builders/sdk/ElementFactory.ts
61281
61602
  function generateId(prefix) {
61282
61603
  idCounter += 1;
@@ -61385,6 +61706,7 @@ function createTextElement(text2, options2) {
61385
61706
  verticalAlignment: options2?.verticalAlignment,
61386
61707
  lineSpacing: options2?.lineSpacing
61387
61708
  };
61709
+ const textSegments = buildTextSegments(text2, textStyleBase);
61388
61710
  return {
61389
61711
  type: "text",
61390
61712
  id: generateId("txt"),
@@ -61392,8 +61714,8 @@ function createTextElement(text2, options2) {
61392
61714
  rotation: options2?.rotation,
61393
61715
  opacity: options2?.opacity,
61394
61716
  text: plainText,
61395
- textStyle: mapTextStyleInput(textStyleBase),
61396
- textSegments: buildTextSegments(text2, textStyleBase),
61717
+ textStyle: elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
61718
+ textSegments,
61397
61719
  shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
61398
61720
  };
61399
61721
  }
@@ -61473,32 +61795,30 @@ function createImageElement(source2, options2) {
61473
61795
  cropBottom: options2?.cropBottom
61474
61796
  };
61475
61797
  }
61798
+ function createTableCell(cellInput) {
61799
+ return {
61800
+ text: cellInput.text,
61801
+ gridSpan: cellInput.gridSpan,
61802
+ rowSpan: cellInput.rowSpan,
61803
+ style: tableCellStyle(cellInput)
61804
+ };
61805
+ }
61476
61806
  function createTableElement(input, options2) {
61477
- const numCols = Math.max(...input.rows.map((r) => r.cells.length), 1);
61807
+ const grid = input.fillMergedCells ? placeTableCells(input) : void 0;
61808
+ const numCols = grid?.columnCount ?? Math.max(...input.rows.map((r) => r.cells.length), 1);
61478
61809
  const rowHeight = input.rows.length > 0 ? Math.max(30, Math.floor(200 / input.rows.length)) : 30;
61479
61810
  const totalHeight = options2?.height ?? Math.max(100, input.rows.length * rowHeight);
61480
61811
  const p2 = pos("table", { ...options2, height: totalHeight });
61481
- let colWidths;
61482
- if (input.columnWidths && input.columnWidths.length === numCols) {
61483
- const sum = input.columnWidths.reduce((a, b) => a + b, 0);
61484
- colWidths = input.columnWidths.map((w) => w / sum);
61485
- } else {
61486
- colWidths = Array(numCols).fill(1 / numCols);
61487
- }
61488
- const rows = input.rows.map((rowInput) => ({
61812
+ const colWidths = columnFractions(input.columnWidths, numCols);
61813
+ const rows = input.rows.map((rowInput, ri) => ({
61489
61814
  height: rowInput.height ?? rowHeight,
61490
- cells: rowInput.cells.map((cellInput) => ({
61491
- text: cellInput.text,
61492
- gridSpan: cellInput.gridSpan,
61493
- rowSpan: cellInput.rowSpan,
61494
- style: cellInput.style ? {
61495
- fontSize: cellInput.style.fontSize,
61496
- bold: cellInput.style.bold,
61497
- italic: cellInput.style.italic,
61498
- color: cellInput.style.color,
61499
- align: cellInput.style.alignment
61500
- } : void 0
61501
- }))
61815
+ cells: grid ? (grid.rows[ri] ?? []).map(
61816
+ (slot2) => slot2.cell ? createTableCell(slot2.cell) : {
61817
+ text: "",
61818
+ ...slot2.hMerge ? { hMerge: true } : {},
61819
+ ...slot2.vMerge ? { vMerge: true } : {}
61820
+ }
61821
+ ) : rowInput.cells.map(createTableCell)
61502
61822
  }));
61503
61823
  const tableData = {
61504
61824
  rows,
@@ -61513,7 +61833,9 @@ function createTableElement(input, options2) {
61513
61833
  // Accent 1 unless the caller picked a style. This is decided at
61514
61834
  // creation time so the save pipeline never has to invent a style for
61515
61835
  // loaded tables that legitimately have none.
61516
- tableStyleId: input.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
61836
+ // `style: 'none'` (or '') opts out, so the cells' own formatting is not
61837
+ // painted over by the theme banding.
61838
+ tableStyleId: input.style === "none" ? void 0 : input.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
61517
61839
  };
61518
61840
  return {
61519
61841
  type: "table",
@@ -61631,6 +61953,9 @@ var init_ElementFactory = __esm({
61631
61953
  init_custom_geometry();
61632
61954
  init_chart_gradient_input();
61633
61955
  init_chart_layout_operations();
61956
+ init_table_cell_input();
61957
+ init_table_merge_input();
61958
+ init_text_segment_style();
61634
61959
  init_shape_style_input();
61635
61960
  idCounter = 0;
61636
61961
  DEFAULTS = {
@@ -68726,6 +69051,10 @@ function applyCellFillStyle(cellProperties, style, context, slidePath) {
68726
69051
  }
68727
69052
  return hasStyle;
68728
69053
  }
69054
+ function presetDashValue(value) {
69055
+ const text2 = typeof value === "string" || typeof value === "number" ? String(value) : "";
69056
+ return text2 ? text2 : void 0;
69057
+ }
68729
69058
  function applyCellBorderStyle(cellProperties, style, context) {
68730
69059
  if (!cellProperties) {
68731
69060
  return false;
@@ -68763,13 +69092,13 @@ function applyCellBorderStyle(cellProperties, style, context) {
68763
69092
  style[`${prefix}Color`] = color3;
68764
69093
  hasStyle = true;
68765
69094
  }
68766
- const prstDash = node["a:prstDash"];
68767
- if (prstDash) {
68768
- const dashVal = String(prstDash["@_val"] || "");
68769
- if (dashVal) {
68770
- style[`${prefix}Dash`] = dashVal;
68771
- hasStyle = true;
69095
+ const dash = parseDrawingLineDash(node, presetDashValue);
69096
+ if (dash.strokeDash) {
69097
+ style[`${prefix}Dash`] = dash.strokeDash;
69098
+ if (dash.strokeDash === "custom") {
69099
+ style[`${prefix}DashSegments`] = dash.customDashSegments;
68772
69100
  }
69101
+ hasStyle = true;
68773
69102
  }
68774
69103
  }
68775
69104
  const firstBorderColor = style.borderTopColor || style.borderBottomColor || style.borderLeftColor || style.borderRightColor;
@@ -68861,6 +69190,7 @@ var init_table_cell_fill_border_helpers = __esm({
68861
69190
  "pptx/core/core/builders/table-cell-fill-border-helpers.ts"() {
68862
69191
  init_theme_color_ref();
68863
69192
  init_color_xml_preservation();
69193
+ init_drawing_line_dash();
68864
69194
  }
68865
69195
  });
68866
69196
 
@@ -99592,14 +99922,14 @@ function valXml(local, value) {
99592
99922
  const text2 = typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? chartNumber(value) : escapeAttribute(value);
99593
99923
  return `<c:${local} val="${text2}"/>`;
99594
99924
  }
99595
- function sameValue(left, right) {
99925
+ function sameValue2(left, right) {
99596
99926
  if (left === right) return true;
99597
99927
  if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
99598
99928
  if (Array.isArray(left) !== Array.isArray(right)) return false;
99599
99929
  const entries = (value) => Object.entries(value).filter(([, item2]) => item2 !== void 0);
99600
99930
  const a = entries(left);
99601
99931
  const b = new Map(entries(right));
99602
- return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue(item2, b.get(key2)));
99932
+ return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue2(item2, b.get(key2)));
99603
99933
  }
99604
99934
  var INVALID_XML, escapeText2, escapeAttribute, elementXml, raw;
99605
99935
  var init_write_util = __esm({
@@ -100345,13 +100675,13 @@ function chartFillXml(fill3) {
100345
100675
  }
100346
100676
  function patchShape(root, shape2, read) {
100347
100677
  const doc = root.ownerDocument;
100348
- if (!sameValue(read.fill, shape2.fill)) {
100678
+ if (!sameValue2(read.fill, shape2.fill)) {
100349
100679
  const xml = shape2.fill && chartFillXml(shape2.fill);
100350
100680
  if (xml) setDrawingFillXml(root, xml);
100351
100681
  else if (!shape2.fill)
100352
100682
  for (let fill3 = fillElementOf(root); fill3; fill3 = fillElementOf(root)) root.removeChild(fill3);
100353
100683
  }
100354
- if (!sameValue(read.line, shape2.line)) {
100684
+ if (!sameValue2(read.line, shape2.line)) {
100355
100685
  let ln = first(root, "ln", NS.a);
100356
100686
  if (!shape2.line) {
100357
100687
  if (ln) root.removeChild(ln);
@@ -100383,7 +100713,7 @@ function shapePropertiesInnerXml(context, shape2) {
100383
100713
  if (sourceXml !== void 0) {
100384
100714
  const root = wrap("spPr", sourceXml);
100385
100715
  const read = readShapeFields(root);
100386
- if (sameValue(read, fields)) inner = sourceXml;
100716
+ if (sameValue2(read, fields)) inner = sourceXml;
100387
100717
  else {
100388
100718
  patchShape(root, fields, read);
100389
100719
  inner = innerXml(root);
@@ -100398,14 +100728,14 @@ function textBodyInnerXml(context, body) {
100398
100728
  const { sourceXml, ...fields } = body;
100399
100729
  if (sourceXml !== void 0) {
100400
100730
  const read = parseDrawingTextBody(wrap("txPr", sourceXml));
100401
- if (sameValue(read, fields)) return raw(context, sourceXml);
100731
+ if (sameValue2(read, fields)) return raw(context, sourceXml);
100402
100732
  }
100403
100733
  return raw(context, writeTextBody(fields));
100404
100734
  }
100405
100735
  function layoutXml(context, value) {
100406
100736
  if (!value) return "";
100407
100737
  const { sourceXml, ...layout } = value;
100408
- if (sourceXml !== void 0 && sameValue(readLayoutFields(wrap("layout", sourceXml)), layout))
100738
+ if (sourceXml !== void 0 && sameValue2(readLayoutFields(wrap("layout", sourceXml)), layout))
100409
100739
  return elementXml("layout", raw(context, sourceXml));
100410
100740
  const manual = LAYOUT_FIELDS.map(([local, key2]) => {
100411
100741
  const value2 = layout[key2];
@@ -103626,7 +103956,16 @@ function repaintSeriesForFamily(series, toLine) {
103626
103956
  shape2.fill = structuredClone(shape2.line.fill);
103627
103957
  }
103628
103958
  function clearPointPaint(series, key2) {
103629
- for (const point2 of series.dataPoints) if (point2.spPr) delete point2.spPr[key2];
103959
+ const emptied2 = (part) => Object.keys(part).every((name) => name === "sourceXml");
103960
+ for (const point2 of series.dataPoints) {
103961
+ if (!point2.spPr) continue;
103962
+ delete point2.spPr[key2];
103963
+ if (point2.spPr.line && emptied2(point2.spPr.line)) delete point2.spPr.line;
103964
+ if (emptied2(point2.spPr)) delete point2.spPr;
103965
+ }
103966
+ series.dataPoints = series.dataPoints.filter(
103967
+ (point2) => Object.keys(point2).some((name) => name !== "index")
103968
+ );
103630
103969
  }
103631
103970
  function setChartSeriesFill(space, index, fill3) {
103632
103971
  return editChartSpace(space, (draft) => {
@@ -103635,7 +103974,7 @@ function setChartSeriesFill(space, index, fill3) {
103635
103974
  clearPointPaint(series, "fill");
103636
103975
  });
103637
103976
  }
103638
- function setChartSeriesColor(space, index, color3) {
103977
+ function setChartSeriesColor(space, index, color3, options2 = {}) {
103639
103978
  return editChartSpace(space, (draft) => {
103640
103979
  const { series } = chartSeriesEntryAt(draft, index);
103641
103980
  const shape2 = series.spPr ??= {};
@@ -103645,7 +103984,7 @@ function setChartSeriesColor(space, index, color3) {
103645
103984
  const fill3 = color3 ? { kind: "solid", color: withAlphaOf(color3, previous) } : void 0;
103646
103985
  if (line2) assignOrDelete(shape2.line ??= {}, "fill", fill3);
103647
103986
  else assignOrDelete(shape2, "fill", fill3);
103648
- clearPointPaint(series, line2 ? "line" : "fill");
103987
+ if (!options2.keepPointColors) clearPointPaint(series, line2 ? "line" : "fill");
103649
103988
  });
103650
103989
  }
103651
103990
  var paintsLine, painted;
@@ -106865,44 +107204,6 @@ var init_chart2 = __esm({
106865
107204
  }
106866
107205
  });
106867
107206
 
106868
- // pptx/core/utils/chart-container-type-map.ts
106869
- function chartContainerLocalNameToType(localName28) {
106870
- return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
106871
- }
106872
- function isLineDrawnChartType(type) {
106873
- return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
106874
- }
106875
- var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
106876
- var init_chart_container_type_map = __esm({
106877
- "pptx/core/utils/chart-container-type-map.ts"() {
106878
- CONTAINER_LOCAL_NAME_TO_TYPE = {
106879
- barChart: "bar",
106880
- bar3DChart: "bar3D",
106881
- lineChart: "line",
106882
- line3DChart: "line3D",
106883
- pieChart: "pie",
106884
- pie3DChart: "pie3D",
106885
- ofPieChart: "ofPie",
106886
- doughnutChart: "doughnut",
106887
- areaChart: "area",
106888
- area3DChart: "area3D",
106889
- scatterChart: "scatter",
106890
- bubbleChart: "bubble",
106891
- radarChart: "radar",
106892
- stockChart: "stock",
106893
- surfaceChart: "surface",
106894
- surface3DChart: "surface"
106895
- };
106896
- LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
106897
- "line",
106898
- "line3D",
106899
- "scatter",
106900
- "radar",
106901
- "stock"
106902
- ]);
106903
- }
106904
- });
106905
-
106906
107207
  // pptx/core/utils/chart-from-neutral-labels.ts
106907
107208
  function setOrRemove(target, key2, value) {
106908
107209
  if (value === void 0) delete target[key2];
@@ -114230,16 +114531,16 @@ function tableToShapeGroup(tableData, bounds) {
114230
114531
  const y = bounds.y + rowIndex * rowHeightEmu;
114231
114532
  let colIndex = 0;
114232
114533
  for (const cell2 of row.cells) {
114233
- const span = Math.max(1, cell2.gridSpan ?? 1);
114534
+ const span2 = Math.max(1, cell2.gridSpan ?? 1);
114234
114535
  if (cell2.vMerge) {
114235
114536
  vMergeActive[colIndex] = true;
114236
- colIndex += span;
114537
+ colIndex += span2;
114237
114538
  continue;
114238
114539
  }
114239
114540
  vMergeActive[colIndex] = false;
114240
114541
  if (!cell2.hMerge) {
114241
114542
  const x = colStartX[colIndex] ?? bounds.x;
114242
- const w = colEmuWidths.slice(colIndex, colIndex + span).reduce((s, v) => s + v, 0);
114543
+ const w = colEmuWidths.slice(colIndex, colIndex + span2).reduce((s, v) => s + v, 0);
114243
114544
  children16.push({
114244
114545
  kind: "shape",
114245
114546
  spt: 1,
@@ -114253,7 +114554,7 @@ function tableToShapeGroup(tableData, bounds) {
114253
114554
  text: { textType: 4, paragraphs: cellParagraphs(cell2.text) }
114254
114555
  });
114255
114556
  }
114256
- colIndex += span;
114557
+ colIndex += span2;
114257
114558
  }
114258
114559
  });
114259
114560
  return { kind: "group", anchor: bounds, children: children16 };
@@ -124634,6 +124935,10 @@ var init_chart_neutral_save_chrome = __esm({
124634
124935
  });
124635
124936
 
124636
124937
  // pptx/core/utils/chart-neutral-save-points.ts
124938
+ function pointShape(shape2) {
124939
+ if (shape2.line && emptied(shape2.line)) delete shape2.line;
124940
+ return emptied(shape2) ? null : shape2;
124941
+ }
124637
124942
  function pointEdit(edits, seriesIndex, old, next) {
124638
124943
  for (const key2 of ["picture", "impliedPicture", "uniqueId"])
124639
124944
  if (!same6(old?.[key2], next[key2])) return false;
@@ -124656,6 +124961,7 @@ function pointEdit(edits, seriesIndex, old, next) {
124656
124961
  ) ?? null
124657
124962
  });
124658
124963
  }
124964
+ if (edit.spPr) edit.spPr = pointShape(edit.spPr);
124659
124965
  if (!same6(old?.marker, next.marker)) {
124660
124966
  if (!next.marker) edit.marker = null;
124661
124967
  else {
@@ -124698,6 +125004,7 @@ function planNeutralChartPoints(before, probe, edits) {
124698
125004
  series.dataPoints = previous.dataPoints;
124699
125005
  });
124700
125006
  }
125007
+ var emptied;
124701
125008
  var init_chart_neutral_save_points = __esm({
124702
125009
  "pptx/core/utils/chart-neutral-save-points.ts"() {
124703
125010
  init_chart2();
@@ -124705,6 +125012,7 @@ var init_chart_neutral_save_points = __esm({
124705
125012
  init_chart_neutral_save_common();
124706
125013
  init_chart_neutral_save_shape();
124707
125014
  init_chart_container_type_map();
125015
+ emptied = (part) => Object.keys(part).every((key2) => key2 === "sourceXml");
124708
125016
  }
124709
125017
  });
124710
125018
 
@@ -124920,7 +125228,9 @@ function planNeutralChartSeriesColors(before, probe, edits) {
124920
125228
  const value = series.color?.replace(/^#/, "");
124921
125229
  if (value !== void 0 && !/^[\da-f]{6}$/i.test(value)) return;
124922
125230
  edits.push(
124923
- (space) => setChartSeriesColor(space, index, value ? { kind: "srgb", value, transforms: [] } : null)
125231
+ (space) => setChartSeriesColor(space, index, value ? { kind: "srgb", value, transforms: [] } : null, {
125232
+ keepPointColors: true
125233
+ })
124924
125234
  );
124925
125235
  if (previous.color === void 0) delete series.color;
124926
125236
  else series.color = previous.color;
@@ -132133,6 +132443,17 @@ var init_save_group_fill = __esm({
132133
132443
  });
132134
132444
 
132135
132445
  // pptx/core/core/runtime/save-shape-xml-frames.ts
132446
+ function tableGridXml(el, widthEmu) {
132447
+ const fractions = el.tableData?.columnWidths ?? [];
132448
+ if (fractions.length === 0 || !(widthEmu > 0)) {
132449
+ return {};
132450
+ }
132451
+ const widths = fractions.map((fraction) => Math.max(0, Math.round(fraction * widthEmu)));
132452
+ const last = widths.length - 1;
132453
+ widths[last] = Math.max(0, (widths[last] ?? 0) + widthEmu - widths.reduce((a, b) => a + b, 0));
132454
+ const cols = widths.map((w) => ({ "@_w": String(w) }));
132455
+ return { "a:gridCol": cols.length === 1 ? cols[0] : cols };
132456
+ }
132136
132457
  function buildTableGraphicFrameXml(el, emuPerPx) {
132137
132458
  el.locks = { noGrouping: true, ...el.locks };
132138
132459
  const offX = String(Math.round(el.x * emuPerPx));
@@ -132163,7 +132484,7 @@ function buildTableGraphicFrameXml(el, emuPerPx) {
132163
132484
  "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
132164
132485
  "a:tbl": {
132165
132486
  "a:tblPr": tblPr,
132166
- "a:tblGrid": {}
132487
+ "a:tblGrid": tableGridXml(el, Number(extCx))
132167
132488
  }
132168
132489
  }
132169
132490
  }
@@ -134386,12 +134707,92 @@ var init_PptxHandlerRuntimeLayoutSwitching = __esm({
134386
134707
  }
134387
134708
  });
134388
134709
 
134710
+ // pptx/core/core/runtime/table-cell-border-save.ts
134711
+ function cellEdges(style) {
134712
+ return [
134713
+ {
134714
+ xmlKey: "a:lnT",
134715
+ width: style.borderTopWidth,
134716
+ color: style.borderTopColor,
134717
+ dash: style.borderTopDash,
134718
+ segments: style.borderTopDashSegments
134719
+ },
134720
+ {
134721
+ xmlKey: "a:lnB",
134722
+ width: style.borderBottomWidth,
134723
+ color: style.borderBottomColor,
134724
+ dash: style.borderBottomDash,
134725
+ segments: style.borderBottomDashSegments
134726
+ },
134727
+ {
134728
+ xmlKey: "a:lnL",
134729
+ width: style.borderLeftWidth,
134730
+ color: style.borderLeftColor,
134731
+ dash: style.borderLeftDash,
134732
+ segments: style.borderLeftDashSegments
134733
+ },
134734
+ {
134735
+ xmlKey: "a:lnR",
134736
+ width: style.borderRightWidth,
134737
+ color: style.borderRightColor,
134738
+ dash: style.borderRightDash,
134739
+ segments: style.borderRightDashSegments
134740
+ }
134741
+ ];
134742
+ }
134743
+ function writeEdgeDash(ln, edge) {
134744
+ if (edge.dash === void 0 || edge.dash === "") {
134745
+ return;
134746
+ }
134747
+ if (edge.dash === "solid") {
134748
+ delete ln["a:prstDash"];
134749
+ delete ln["a:custDash"];
134750
+ return;
134751
+ }
134752
+ if (edge.dash === "custom") {
134753
+ if (edge.segments && edge.segments.length > 0) {
134754
+ applyDrawingLineDash(ln, { strokeDash: "custom", customDashSegments: edge.segments });
134755
+ }
134756
+ return;
134757
+ }
134758
+ applyDrawingLineDash(ln, { strokeDash: edge.dash });
134759
+ }
134760
+ function writeCellEdgeBorders(tcPr, style, emuPerPx) {
134761
+ for (const edge of cellEdges(style)) {
134762
+ if (edge.width === void 0 && edge.color === void 0 && edge.dash === void 0) {
134763
+ continue;
134764
+ }
134765
+ const existing = tcPr[edge.xmlKey];
134766
+ const ln = existing && typeof existing === "object" ? existing : {};
134767
+ if (edge.width !== void 0) {
134768
+ ln["@_w"] = String(Math.round(edge.width * emuPerPx));
134769
+ }
134770
+ if (edge.color) {
134771
+ delete ln["a:noFill"];
134772
+ delete ln["a:gradFill"];
134773
+ delete ln["a:pattFill"];
134774
+ ln["a:solidFill"] = {
134775
+ "a:srgbClr": { "@_val": edge.color.replace("#", "") }
134776
+ };
134777
+ }
134778
+ writeEdgeDash(ln, edge);
134779
+ tcPr[edge.xmlKey] = reorderObjectKeys(ln, LN_CHILD_ORDER);
134780
+ }
134781
+ }
134782
+ var init_table_cell_border_save = __esm({
134783
+ "pptx/core/core/runtime/table-cell-border-save.ts"() {
134784
+ init_drawing_line_dash();
134785
+ init_xml_reorder();
134786
+ }
134787
+ });
134788
+
134389
134789
  // pptx/core/core/runtime/table-cell-save-helpers.ts
134390
134790
  function writeCellFill(tcPr, style, resolveColorXml) {
134391
134791
  if (style.fillMode === "gradient" && style.gradientFillStops && style.gradientFillStops.length > 0) {
134392
134792
  delete tcPr["a:solidFill"];
134393
134793
  delete tcPr["a:pattFill"];
134394
134794
  delete tcPr["a:blipFill"];
134795
+ delete tcPr["a:noFill"];
134395
134796
  const stops = style.gradientFillStops.map((stop) => {
134396
134797
  const posRaw = typeof stop.position === "number" ? stop.position : 0;
134397
134798
  const position4 = Math.round(Math.max(0, Math.min(1, posRaw / 100)) * 1e5);
@@ -134443,6 +134844,7 @@ function writeCellFill(tcPr, style, resolveColorXml) {
134443
134844
  delete tcPr["a:solidFill"];
134444
134845
  delete tcPr["a:gradFill"];
134445
134846
  delete tcPr["a:blipFill"];
134847
+ delete tcPr["a:noFill"];
134446
134848
  const pattXml = {
134447
134849
  "@_prst": style.patternFillPreset
134448
134850
  };
@@ -134466,10 +134868,12 @@ function writeCellFill(tcPr, style, resolveColorXml) {
134466
134868
  delete tcPr["a:gradFill"];
134467
134869
  delete tcPr["a:pattFill"];
134468
134870
  delete tcPr["a:blipFill"];
134871
+ tcPr["a:noFill"] = tcPr["a:noFill"] ?? {};
134469
134872
  } else if (style.fillMode !== "image" && style.backgroundColor) {
134470
134873
  delete tcPr["a:gradFill"];
134471
134874
  delete tcPr["a:pattFill"];
134472
134875
  delete tcPr["a:blipFill"];
134876
+ delete tcPr["a:noFill"];
134473
134877
  const resolvedOriginal = style.backgroundColorXml && resolveColorXml ? resolveColorXml(style.backgroundColorXml) : void 0;
134474
134878
  tcPr["a:solidFill"] = serializeColorChoiceWithRef(
134475
134879
  style.backgroundColorRef,
@@ -134689,6 +135093,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
134689
135093
  init_xml_access();
134690
135094
  init_xml_reorder();
134691
135095
  init_PptxHandlerRuntimeLayoutSwitching();
135096
+ init_table_cell_border_save();
134692
135097
  init_table_cell_save_helpers();
134693
135098
  init_table_cell_text_xml();
134694
135099
  PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime21 {
@@ -134766,53 +135171,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
134766
135171
  pPr["@_algn"] = token3;
134767
135172
  }
134768
135173
  }
134769
- const borderEdges = [
134770
- {
134771
- xmlKey: "a:lnT",
134772
- width: style.borderTopWidth,
134773
- color: style.borderTopColor,
134774
- dash: style.borderTopDash
134775
- },
134776
- {
134777
- xmlKey: "a:lnB",
134778
- width: style.borderBottomWidth,
134779
- color: style.borderBottomColor,
134780
- dash: style.borderBottomDash
134781
- },
134782
- {
134783
- xmlKey: "a:lnL",
134784
- width: style.borderLeftWidth,
134785
- color: style.borderLeftColor,
134786
- dash: style.borderLeftDash
134787
- },
134788
- {
134789
- xmlKey: "a:lnR",
134790
- width: style.borderRightWidth,
134791
- color: style.borderRightColor,
134792
- dash: style.borderRightDash
134793
- }
134794
- ];
134795
- for (const edge of borderEdges) {
134796
- if (edge.width !== void 0 || edge.color !== void 0 || edge.dash !== void 0) {
134797
- if (!tcPr[edge.xmlKey]) {
134798
- tcPr[edge.xmlKey] = {};
134799
- }
134800
- const ln = tcPr[edge.xmlKey];
134801
- if (edge.width !== void 0) {
134802
- ln["@_w"] = String(Math.round(edge.width * _PptxHandlerRuntime.EMU_PER_PX));
134803
- }
134804
- if (edge.color) {
134805
- ln["a:solidFill"] = {
134806
- "a:srgbClr": { "@_val": edge.color.replace("#", "") }
134807
- };
134808
- }
134809
- if (edge.dash && edge.dash !== "solid") {
134810
- ln["a:prstDash"] = { "@_val": edge.dash };
134811
- } else if (edge.dash === "solid") {
134812
- delete ln["a:prstDash"];
134813
- }
134814
- }
134815
- }
135174
+ writeCellEdgeBorders(tcPr, style, _PptxHandlerRuntime.EMU_PER_PX);
134816
135175
  const emuPerPx = _PptxHandlerRuntime.EMU_PER_PX;
134817
135176
  if (style.marginLeft !== void 0) {
134818
135177
  tcPr["@_marL"] = String(Math.round(style.marginLeft * emuPerPx));
@@ -135247,10 +135606,13 @@ var init_table_style_change_cell_clear = __esm({
135247
135606
  "a:grpFill"
135248
135607
  ];
135249
135608
  LINE_KEYS = [
135250
- ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
135251
- ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
135252
- ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
135253
- ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
135609
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash", "borderLeftDashSegments"]],
135610
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash", "borderRightDashSegments"]],
135611
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash", "borderTopDashSegments"]],
135612
+ [
135613
+ "a:lnB",
135614
+ ["borderBottomWidth", "borderBottomColor", "borderBottomDash", "borderBottomDashSegments"]
135615
+ ],
135254
135616
  ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
135255
135617
  ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
135256
135618
  ];