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
@@ -3837,6 +3837,70 @@ var init_chart_layout_input = __esm({
3837
3837
  }
3838
3838
  });
3839
3839
 
3840
+ // pptx/core/utils/chart-container-type-map.ts
3841
+ function chartContainerLocalNameToType(localName29) {
3842
+ return CONTAINER_LOCAL_NAME_TO_TYPE[localName29];
3843
+ }
3844
+ function isLineDrawnChartType(type) {
3845
+ return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
3846
+ }
3847
+ var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
3848
+ var init_chart_container_type_map = __esm({
3849
+ "pptx/core/utils/chart-container-type-map.ts"() {
3850
+ CONTAINER_LOCAL_NAME_TO_TYPE = {
3851
+ barChart: "bar",
3852
+ bar3DChart: "bar3D",
3853
+ lineChart: "line",
3854
+ line3DChart: "line3D",
3855
+ pieChart: "pie",
3856
+ pie3DChart: "pie3D",
3857
+ ofPieChart: "ofPie",
3858
+ doughnutChart: "doughnut",
3859
+ areaChart: "area",
3860
+ area3DChart: "area3D",
3861
+ scatterChart: "scatter",
3862
+ bubbleChart: "bubble",
3863
+ radarChart: "radar",
3864
+ stockChart: "stock",
3865
+ surfaceChart: "surface",
3866
+ surface3DChart: "surface"
3867
+ };
3868
+ LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
3869
+ "line",
3870
+ "line3D",
3871
+ "scatter",
3872
+ "radar",
3873
+ "stock"
3874
+ ]);
3875
+ }
3876
+ });
3877
+
3878
+ // pptx/core/builders/sdk/chart-series-point-paint.ts
3879
+ function paintsLine(data, series) {
3880
+ const type = series.seriesChartType ?? data.chartType;
3881
+ if (type === "radar") return data.radarStyle !== "filled";
3882
+ return isLineDrawnChartType(type);
3883
+ }
3884
+ function clearChartSeriesPointPaint(data, series) {
3885
+ if (!series.dataPoints) return;
3886
+ const line3 = paintsLine(data, series);
3887
+ for (const point2 of series.dataPoints) {
3888
+ if (!line3) delete point2.gradientFill;
3889
+ if (!point2.spPr) continue;
3890
+ const keys = line3 ? ["strokeColor", "strokeWidth", "strokeDashStyle", "lineNoFill"] : ["fillColor"];
3891
+ for (const key2 of keys) delete point2.spPr[key2];
3892
+ if (Object.keys(point2.spPr).length === 0) delete point2.spPr;
3893
+ }
3894
+ series.dataPoints = series.dataPoints.filter(
3895
+ (point2) => Object.entries(point2).some(([name, value]) => name !== "idx" && value !== void 0)
3896
+ );
3897
+ }
3898
+ var init_chart_series_point_paint = __esm({
3899
+ "pptx/core/builders/sdk/chart-series-point-paint.ts"() {
3900
+ init_chart_container_type_map();
3901
+ }
3902
+ });
3903
+
3840
3904
  // pptx/core/builders/sdk/chart-operations.ts
3841
3905
  function ensureChartData(element2) {
3842
3906
  if (!element2.chartData) {
@@ -4024,6 +4088,7 @@ function setChartSeriesColor(element2, seriesIndex, color3) {
4024
4088
  validateSeriesIndex(element2, seriesIndex);
4025
4089
  const series = element2.chartData.series[seriesIndex];
4026
4090
  Reflect.deleteProperty(series, "gradientFill");
4091
+ clearChartSeriesPointPaint(element2.chartData, series);
4027
4092
  if (!color3) {
4028
4093
  series.color = void 0;
4029
4094
  return;
@@ -4254,6 +4319,7 @@ function removeEmptyDataPoint(series, pointIndex2) {
4254
4319
  }
4255
4320
  var init_chart_operations = __esm({
4256
4321
  "pptx/core/builders/sdk/chart-operations.ts"() {
4322
+ init_chart_series_point_paint();
4257
4323
  }
4258
4324
  });
4259
4325
 
@@ -4467,6 +4533,289 @@ var init_shape_style_input = __esm({
4467
4533
  }
4468
4534
  });
4469
4535
 
4536
+ // pptx/core/builders/sdk/table-border-input.ts
4537
+ function borderDashSegments(edge, lengths, width) {
4538
+ const name = `TableCellInput.borders.${edge}.dash`;
4539
+ if (lengths.length === 0) {
4540
+ throw new RangeError(`${name} must give at least one length`);
4541
+ }
4542
+ if (lengths.some((n) => !Number.isFinite(n) || n <= 0)) {
4543
+ throw new RangeError(`${name} lengths must be finite and above 0, got [${lengths.join(", ")}]`);
4544
+ }
4545
+ const segments = customDashSegments([...lengths], width !== void 0 && width > 0 ? width : 1);
4546
+ if (segments.some((s) => s.dash <= 0 || s.space <= 0)) {
4547
+ throw new RangeError(`${name} has a length too short to write: [${lengths.join(", ")}]`);
4548
+ }
4549
+ if (segments.some((s) => s.dash > MAX_DASH_UNITS || s.space > MAX_DASH_UNITS)) {
4550
+ throw new RangeError(`${name} has a length too long to write: [${lengths.join(", ")}]`);
4551
+ }
4552
+ return segments;
4553
+ }
4554
+ function edgeStyle(edge, prefix, input) {
4555
+ if (input.width !== void 0 && (!Number.isFinite(input.width) || input.width < 0)) {
4556
+ throw new RangeError(
4557
+ `TableCellInput.borders.${edge}.width must be a finite width of 0 or more, got ${input.width}`
4558
+ );
4559
+ }
4560
+ const out = {};
4561
+ if (input.width !== void 0) out[`${prefix}Width`] = input.width;
4562
+ if (input.color !== void 0) out[`${prefix}Color`] = input.color;
4563
+ if (Array.isArray(input.dash)) {
4564
+ out[`${prefix}Dash`] = "custom";
4565
+ out[`${prefix}DashSegments`] = borderDashSegments(edge, input.dash, input.width);
4566
+ } else if (input.dash !== void 0) {
4567
+ if (input.dash === "custom") {
4568
+ throw new RangeError(`TableCellInput.borders.${edge}.dash: give 'custom' as a length list`);
4569
+ }
4570
+ out[`${prefix}Dash`] = input.dash;
4571
+ }
4572
+ return out;
4573
+ }
4574
+ function tableCellBorderStyle(borders) {
4575
+ if (!borders) {
4576
+ return {};
4577
+ }
4578
+ const out = {};
4579
+ for (const [edge, prefix] of EDGES) {
4580
+ const own = borders[edge];
4581
+ const input = borders.all || own ? { ...borders.all, ...own } : void 0;
4582
+ if (input) {
4583
+ Object.assign(out, edgeStyle(own ? edge : "all", prefix, input));
4584
+ }
4585
+ }
4586
+ return out;
4587
+ }
4588
+ var MAX_DASH_UNITS, EDGES;
4589
+ var init_table_border_input = __esm({
4590
+ "pptx/core/builders/sdk/table-border-input.ts"() {
4591
+ init_shape_style_input();
4592
+ MAX_DASH_UNITS = 2147483647;
4593
+ EDGES = [
4594
+ ["top", "borderTop"],
4595
+ ["right", "borderRight"],
4596
+ ["bottom", "borderBottom"],
4597
+ ["left", "borderLeft"]
4598
+ ];
4599
+ }
4600
+ });
4601
+
4602
+ // pptx/core/builders/sdk/table-cell-input.ts
4603
+ function refuseGradientExtras(fill3) {
4604
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4605
+ const unsupported3 = [
4606
+ fill3.tile !== void 0 ? "tile" : void 0,
4607
+ fill3.scaled === false ? "scaled: false" : void 0,
4608
+ fill3.rotWithShape !== void 0 ? "rotWithShape" : void 0,
4609
+ fill3.focus !== void 0 && !radial ? "focus on a linear gradient" : void 0
4610
+ ].filter((name) => name !== void 0);
4611
+ if (unsupported3.length > 0) {
4612
+ throw new RangeError(
4613
+ `TableCellInput.fill: ${unsupported3.join(", ")} cannot be written on a table cell`
4614
+ );
4615
+ }
4616
+ if (fill3.stops.length === 0) {
4617
+ throw new RangeError("TableCellInput.fill: a gradient needs at least one stop");
4618
+ }
4619
+ }
4620
+ function tableCellFillStyle(fill3) {
4621
+ switch (fill3?.type) {
4622
+ case void 0:
4623
+ return {};
4624
+ case "solid":
4625
+ if (fill3.opacity !== void 0 && fill3.opacity !== 1) {
4626
+ throw new RangeError(
4627
+ `TableCellInput.fill.opacity cannot be written on a table cell, got ${fill3.opacity}`
4628
+ );
4629
+ }
4630
+ return {
4631
+ fillMode: "solid",
4632
+ backgroundColor: fill3.color,
4633
+ ...fill3.themeColorRef ? { backgroundColorRef: fill3.themeColorRef } : {}
4634
+ };
4635
+ case "gradient": {
4636
+ refuseGradientExtras(fill3);
4637
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4638
+ return {
4639
+ fillMode: "gradient",
4640
+ gradientFillType: radial ? "radial" : "linear",
4641
+ gradientFillAngle: fill3.angle ?? 0,
4642
+ gradientFillStops: fill3.stops.map((stop) => ({
4643
+ color: stop.color,
4644
+ position: stop.position,
4645
+ ...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
4646
+ })),
4647
+ ...radial ? { gradientFillPathType: fill3.path ?? "circle" } : {},
4648
+ ...fill3.focus ? { gradientFillFillToRect: { ...fill3.focus } } : {}
4649
+ };
4650
+ }
4651
+ case "pattern":
4652
+ if (!fill3.preset) {
4653
+ throw new RangeError("TableCellInput.fill: a pattern fill needs a preset");
4654
+ }
4655
+ return {
4656
+ fillMode: "pattern",
4657
+ patternFillPreset: fill3.preset,
4658
+ ...fill3.foreground !== void 0 ? { patternFillForeground: fill3.foreground } : {},
4659
+ ...fill3.background !== void 0 ? { patternFillBackground: fill3.background } : {}
4660
+ };
4661
+ case "image":
4662
+ throw new RangeError("TableCellInput.fill: an image fill cannot be written on a table cell");
4663
+ case "none":
4664
+ return { fillMode: "none" };
4665
+ }
4666
+ }
4667
+ function tableCellTextStyle(style2) {
4668
+ const out = {};
4669
+ if (style2?.fontSize !== void 0) out.fontSize = style2.fontSize;
4670
+ if (style2?.bold !== void 0) out.bold = style2.bold;
4671
+ if (style2?.italic !== void 0) out.italic = style2.italic;
4672
+ if (style2?.color !== void 0) out.color = style2.color;
4673
+ if (style2?.alignment !== void 0) out.align = style2.alignment;
4674
+ return out;
4675
+ }
4676
+ function tableCellStyle(cell3) {
4677
+ const style2 = {
4678
+ ...tableCellTextStyle(cell3.style),
4679
+ ...tableCellFillStyle(cell3.fill),
4680
+ ...tableCellBorderStyle(cell3.borders)
4681
+ };
4682
+ return cell3.style || Object.keys(style2).length > 0 ? style2 : void 0;
4683
+ }
4684
+ var init_table_cell_input = __esm({
4685
+ "pptx/core/builders/sdk/table-cell-input.ts"() {
4686
+ init_table_border_input();
4687
+ }
4688
+ });
4689
+
4690
+ // pptx/core/builders/sdk/table-merge-input.ts
4691
+ function span(value, name) {
4692
+ if (value === void 0) {
4693
+ return 1;
4694
+ }
4695
+ if (!Number.isInteger(value) || value < 1) {
4696
+ throw new RangeError(`TableCellInput.${name} must be a whole number from 1, got ${value}`);
4697
+ }
4698
+ return value;
4699
+ }
4700
+ function placeTableCells(input) {
4701
+ const rowCount = input.rows.length;
4702
+ const slots = input.rows.map(() => []);
4703
+ input.rows.forEach((row, ri) => {
4704
+ const rowSlots = slots[ri] ?? [];
4705
+ let ci = 0;
4706
+ for (const cell3 of row.cells) {
4707
+ while (rowSlots[ci]) {
4708
+ ci += 1;
4709
+ }
4710
+ const colSpan = span(cell3.gridSpan, "gridSpan");
4711
+ const rowSpan = span(cell3.rowSpan, "rowSpan");
4712
+ if (ri + rowSpan > rowCount) {
4713
+ throw new RangeError(
4714
+ `A cell in row ${ri} spans ${rowSpan} rows, past the table's ${rowCount} rows`
4715
+ );
4716
+ }
4717
+ for (let dr = 0; dr < rowSpan; dr++) {
4718
+ for (let dc = 0; dc < colSpan; dc++) {
4719
+ const target = slots[ri + dr] ?? [];
4720
+ if (target[ci + dc]) {
4721
+ throw new RangeError(
4722
+ `A cell in row ${ri} overlaps the merge covering row ${ri + dr}, column ${ci + dc}`
4723
+ );
4724
+ }
4725
+ target[ci + dc] = dr === 0 && dc === 0 ? { cell: cell3 } : { hMerge: dc > 0, vMerge: dr > 0 };
4726
+ }
4727
+ }
4728
+ ci += colSpan;
4729
+ }
4730
+ });
4731
+ const widest = Math.max(...slots.map((row) => row.length), 1);
4732
+ const declared = input.columnWidths?.length;
4733
+ if (declared !== void 0 && widest > declared) {
4734
+ throw new RangeError(`A row takes ${widest} columns, but columnWidths gives ${declared}`);
4735
+ }
4736
+ const columnCount = declared ?? widest;
4737
+ return {
4738
+ columnCount,
4739
+ rows: slots.map(
4740
+ (row) => Array.from({ length: columnCount }, (_, ci) => row[ci] ?? { cell: { text: "" } })
4741
+ )
4742
+ };
4743
+ }
4744
+ function columnFractions(columnWidths, columnCount) {
4745
+ if (!columnWidths) {
4746
+ return Array.from({ length: columnCount }, () => 1 / columnCount);
4747
+ }
4748
+ if (columnWidths.length !== columnCount) {
4749
+ throw new RangeError(
4750
+ `columnWidths gives ${columnWidths.length} widths for a table of ${columnCount} columns`
4751
+ );
4752
+ }
4753
+ if (columnWidths.some((w) => !Number.isFinite(w) || w < 0)) {
4754
+ throw new RangeError("columnWidths must be finite widths of 0 or more");
4755
+ }
4756
+ const sum = columnWidths.reduce((a, b) => a + b, 0);
4757
+ if (sum <= 0) {
4758
+ throw new RangeError("columnWidths must not all be 0");
4759
+ }
4760
+ return columnWidths.map((w) => w / sum);
4761
+ }
4762
+ var init_table_merge_input = __esm({
4763
+ "pptx/core/builders/sdk/table-merge-input.ts"() {
4764
+ }
4765
+ });
4766
+
4767
+ // pptx/core/builders/sdk/text-segment-style.ts
4768
+ function elementStyleForSegments(textStyle, segments) {
4769
+ const styled = segments.filter((segment) => !segment.isParagraphBreak);
4770
+ const first2 = styled[0]?.style;
4771
+ if (!first2) {
4772
+ return textStyle;
4773
+ }
4774
+ const next = { ...textStyle };
4775
+ for (const key2 of RUN_KEYS) {
4776
+ const value = first2[key2];
4777
+ if (!styled.every((segment) => sameValue(segment.style?.[key2], value))) {
4778
+ continue;
4779
+ }
4780
+ if (value === void 0) {
4781
+ delete next[key2];
4782
+ } else {
4783
+ next[key2] = value;
4784
+ }
4785
+ }
4786
+ return next;
4787
+ }
4788
+ function sameValue(a, b) {
4789
+ if (a === b) {
4790
+ return true;
4791
+ }
4792
+ if (a && b && typeof a === "object" && typeof b === "object") {
4793
+ return JSON.stringify(a) === JSON.stringify(b);
4794
+ }
4795
+ return false;
4796
+ }
4797
+ var RUN_KEYS;
4798
+ var init_text_segment_style = __esm({
4799
+ "pptx/core/builders/sdk/text-segment-style.ts"() {
4800
+ RUN_KEYS = [
4801
+ "fontFamily",
4802
+ "fontSize",
4803
+ "bold",
4804
+ "italic",
4805
+ "underline",
4806
+ "strikethrough",
4807
+ "color",
4808
+ "colorRef",
4809
+ "characterSpacing",
4810
+ "hyperlink",
4811
+ "hyperlinkAction",
4812
+ "hyperlinkTargetSlideIndex",
4813
+ "hyperlinkTooltip",
4814
+ "align"
4815
+ ];
4816
+ }
4817
+ });
4818
+
4470
4819
  // pptx/core/builders/sdk/ElementFactory.ts
4471
4820
  function generateId(prefix) {
4472
4821
  idCounter += 1;
@@ -4578,6 +4927,7 @@ function createTextElement(text2, options2) {
4578
4927
  verticalAlignment: options2?.verticalAlignment,
4579
4928
  lineSpacing: options2?.lineSpacing
4580
4929
  };
4930
+ const textSegments = buildTextSegments(text2, textStyleBase);
4581
4931
  return {
4582
4932
  type: "text",
4583
4933
  id: generateId("txt"),
@@ -4585,8 +4935,8 @@ function createTextElement(text2, options2) {
4585
4935
  rotation: options2?.rotation,
4586
4936
  opacity: options2?.opacity,
4587
4937
  text: plainText,
4588
- textStyle: mapTextStyleInput(textStyleBase),
4589
- textSegments: buildTextSegments(text2, textStyleBase),
4938
+ textStyle: elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
4939
+ textSegments,
4590
4940
  shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
4591
4941
  };
4592
4942
  }
@@ -4666,32 +5016,30 @@ function createImageElement(source2, options2) {
4666
5016
  cropBottom: options2?.cropBottom
4667
5017
  };
4668
5018
  }
5019
+ function createTableCell(cellInput) {
5020
+ return {
5021
+ text: cellInput.text,
5022
+ gridSpan: cellInput.gridSpan,
5023
+ rowSpan: cellInput.rowSpan,
5024
+ style: tableCellStyle(cellInput)
5025
+ };
5026
+ }
4669
5027
  function createTableElement(input, options2) {
4670
- const numCols = Math.max(...input.rows.map((r) => r.cells.length), 1);
5028
+ const grid = input.fillMergedCells ? placeTableCells(input) : void 0;
5029
+ const numCols = grid?.columnCount ?? Math.max(...input.rows.map((r) => r.cells.length), 1);
4671
5030
  const rowHeight = input.rows.length > 0 ? Math.max(30, Math.floor(200 / input.rows.length)) : 30;
4672
5031
  const totalHeight = options2?.height ?? Math.max(100, input.rows.length * rowHeight);
4673
5032
  const p2 = pos("table", { ...options2, height: totalHeight });
4674
- let colWidths;
4675
- if (input.columnWidths && input.columnWidths.length === numCols) {
4676
- const sum = input.columnWidths.reduce((a, b) => a + b, 0);
4677
- colWidths = input.columnWidths.map((w) => w / sum);
4678
- } else {
4679
- colWidths = Array(numCols).fill(1 / numCols);
4680
- }
4681
- const rows = input.rows.map((rowInput) => ({
5033
+ const colWidths = columnFractions(input.columnWidths, numCols);
5034
+ const rows = input.rows.map((rowInput, ri) => ({
4682
5035
  height: rowInput.height ?? rowHeight,
4683
- cells: rowInput.cells.map((cellInput) => ({
4684
- text: cellInput.text,
4685
- gridSpan: cellInput.gridSpan,
4686
- rowSpan: cellInput.rowSpan,
4687
- style: cellInput.style ? {
4688
- fontSize: cellInput.style.fontSize,
4689
- bold: cellInput.style.bold,
4690
- italic: cellInput.style.italic,
4691
- color: cellInput.style.color,
4692
- align: cellInput.style.alignment
4693
- } : void 0
4694
- }))
5036
+ cells: grid ? (grid.rows[ri] ?? []).map(
5037
+ (slot2) => slot2.cell ? createTableCell(slot2.cell) : {
5038
+ text: "",
5039
+ ...slot2.hMerge ? { hMerge: true } : {},
5040
+ ...slot2.vMerge ? { vMerge: true } : {}
5041
+ }
5042
+ ) : rowInput.cells.map(createTableCell)
4695
5043
  }));
4696
5044
  const tableData = {
4697
5045
  rows,
@@ -4706,7 +5054,9 @@ function createTableElement(input, options2) {
4706
5054
  // Accent 1 unless the caller picked a style. This is decided at
4707
5055
  // creation time so the save pipeline never has to invent a style for
4708
5056
  // loaded tables that legitimately have none.
4709
- tableStyleId: input.style ?? exports.DEFAULT_POWERPOINT_TABLE_STYLE_ID
5057
+ // `style: 'none'` (or '') opts out, so the cells' own formatting is not
5058
+ // painted over by the theme banding.
5059
+ tableStyleId: input.style === "none" ? void 0 : input.style ?? exports.DEFAULT_POWERPOINT_TABLE_STYLE_ID
4710
5060
  };
4711
5061
  return {
4712
5062
  type: "table",
@@ -4824,6 +5174,9 @@ var init_ElementFactory = __esm({
4824
5174
  init_custom_geometry();
4825
5175
  init_chart_gradient_input();
4826
5176
  init_chart_layout_operations();
5177
+ init_table_cell_input();
5178
+ init_table_merge_input();
5179
+ init_text_segment_style();
4827
5180
  init_shape_style_input();
4828
5181
  idCounter = 0;
4829
5182
  DEFAULTS = {
@@ -41095,8 +41448,8 @@ var init_smartart_layout_interpreter_cycle_ring_nested_hub = __esm({
41095
41448
 
41096
41449
  // diagram/layout/smartart-layout-interpreter-cycle-ring-offset.ts
41097
41450
  function resolveRingAxisOffset(dimension2, boundSize, scale, values) {
41098
- const span = Math.max(1e-9, Math.max(...values) - Math.min(...values));
41099
- const epsilon = span * TIE_EPSILON_FRACTION;
41451
+ const span2 = Math.max(1e-9, Math.max(...values) - Math.min(...values));
41452
+ const epsilon = span2 * TIE_EPSILON_FRACTION;
41100
41453
  const minValue = Math.min(...values);
41101
41454
  const maxValue = Math.max(...values);
41102
41455
  const lowCount = values.filter((v) => v - minValue <= epsilon).length;
@@ -43392,8 +43745,8 @@ function centeredAxisPitch(dimension2, itemSize, gapRatio, count2) {
43392
43745
  const n = Math.max(1, count2);
43393
43746
  const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
43394
43747
  const pitch = itemSize + gap;
43395
- const span = n * itemSize + Math.max(0, n - 1) * gap;
43396
- const shift = (dimension2 - span) / 2;
43748
+ const span2 = n * itemSize + Math.max(0, n - 1) * gap;
43749
+ const shift = (dimension2 - span2) / 2;
43397
43750
  return { pitch, shift };
43398
43751
  }
43399
43752
  function compositeFanPitch(dimension2, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
@@ -54307,7 +54660,7 @@ var init_patch = __esm({
54307
54660
  init_xml2();
54308
54661
  XMLNS = "http://www.w3.org/2000/xmlns/";
54309
54662
  escapeText = (text2) => text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;");
54310
- qualifiedName = (xml2, span) => /^<([^\s/>]+)/.exec(xml2.slice(span.start, span.openEnd))?.[1] ?? "";
54663
+ qualifiedName = (xml2, span2) => /^<([^\s/>]+)/.exec(xml2.slice(span2.start, span2.openEnd))?.[1] ?? "";
54311
54664
  PartPatch = class {
54312
54665
  constructor(xml2, rootElement) {
54313
54666
  this.xml = xml2;
@@ -54334,9 +54687,9 @@ var init_patch = __esm({
54334
54687
  this.edits.push({ start, end, text: text2, seq: this.seq++ });
54335
54688
  }
54336
54689
  span(element2) {
54337
- const span = this.spans.get(element2);
54338
- if (!span) throw new Error("Element is not a child of the patched root");
54339
- return span;
54690
+ const span2 = this.spans.get(element2);
54691
+ if (!span2) throw new Error("Element is not a child of the patched root");
54692
+ return span2;
54340
54693
  }
54341
54694
  /** The prefix bound to `ns` on the root, declaring `preferred` for it when none is. */
54342
54695
  prefix(ns, preferred) {
@@ -54356,20 +54709,20 @@ var init_patch = __esm({
54356
54709
  }
54357
54710
  /** Replaces the element's content, keeping its start tag (and attributes) as written. */
54358
54711
  setContent(element2, content2) {
54359
- const span = this.span(element2);
54360
- if (span.selfClosing)
54361
- this.add(span.openEnd - 2, span.openEnd, `>${content2}</${qualifiedName(this.xml, span)}>`);
54362
- else this.add(span.openEnd, span.closeStart, content2);
54712
+ const span2 = this.span(element2);
54713
+ if (span2.selfClosing)
54714
+ this.add(span2.openEnd - 2, span2.openEnd, `>${content2}</${qualifiedName(this.xml, span2)}>`);
54715
+ else this.add(span2.openEnd, span2.closeStart, content2);
54363
54716
  }
54364
54717
  /** Adds ` name="value"` text to the element's start tag. */
54365
54718
  addAttribute(element2, attribute7) {
54366
- const span = this.span(element2);
54367
- const at2 = span.openEnd - (span.selfClosing ? 2 : 1);
54719
+ const span2 = this.span(element2);
54720
+ const at2 = span2.openEnd - (span2.selfClosing ? 2 : 1);
54368
54721
  this.add(at2, at2, attribute7);
54369
54722
  }
54370
54723
  remove(element2) {
54371
- const span = this.span(element2);
54372
- this.add(span.start, span.end, "");
54724
+ const span2 = this.span(element2);
54725
+ this.add(span2.start, span2.end, "");
54373
54726
  }
54374
54727
  /** Inserts `markup` before `before`, or as the root's last child. */
54375
54728
  insert(markup, before) {
@@ -79948,8 +80301,8 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
79948
80301
  }
79949
80302
  continue;
79950
80303
  }
79951
- const span = oldText.slice(start, end);
79952
- if (span.length !== mention.length) {
80304
+ const span2 = oldText.slice(start, end);
80305
+ if (span2.length !== mention.length) {
79953
80306
  continue;
79954
80307
  }
79955
80308
  let next = -1;
@@ -79958,11 +80311,11 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
79958
80311
  } else if (start >= changeEnd) {
79959
80312
  next = start + delta2;
79960
80313
  }
79961
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
80314
+ if (next >= 0 && newText.slice(next, next + mention.length) === span2) {
79962
80315
  result.push(next === start ? mention : { ...mention, startIndex: next });
79963
80316
  continue;
79964
80317
  }
79965
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
80318
+ const relocated = nearestOccurrence(newText, span2, next >= 0 ? next : start);
79966
80319
  if (relocated >= 0) {
79967
80320
  result.push({ ...mention, startIndex: relocated });
79968
80321
  }
@@ -80022,17 +80375,17 @@ var init_modern_comment_mentions = __esm({
80022
80375
  }
80023
80376
  return index;
80024
80377
  };
80025
- nearestOccurrence = (text2, span, hint) => {
80378
+ nearestOccurrence = (text2, span2, hint) => {
80026
80379
  let best = -1;
80027
80380
  let bestDistance = Number.POSITIVE_INFINITY;
80028
- let at2 = text2.indexOf(span);
80381
+ let at2 = text2.indexOf(span2);
80029
80382
  while (at2 !== -1) {
80030
80383
  const distance = Math.abs(at2 - hint);
80031
80384
  if (distance < bestDistance) {
80032
80385
  best = at2;
80033
80386
  bestDistance = distance;
80034
80387
  }
80035
- at2 = text2.indexOf(span, at2 + 1);
80388
+ at2 = text2.indexOf(span2, at2 + 1);
80036
80389
  }
80037
80390
  return best;
80038
80391
  };
@@ -88036,6 +88389,10 @@ function applyCellFillStyle(cellProperties, style2, context, slidePath) {
88036
88389
  }
88037
88390
  return hasStyle;
88038
88391
  }
88392
+ function presetDashValue(value) {
88393
+ const text2 = typeof value === "string" || typeof value === "number" ? String(value) : "";
88394
+ return text2 ? text2 : void 0;
88395
+ }
88039
88396
  function applyCellBorderStyle(cellProperties, style2, context) {
88040
88397
  if (!cellProperties) {
88041
88398
  return false;
@@ -88073,13 +88430,13 @@ function applyCellBorderStyle(cellProperties, style2, context) {
88073
88430
  style2[`${prefix}Color`] = color3;
88074
88431
  hasStyle = true;
88075
88432
  }
88076
- const prstDash = node["a:prstDash"];
88077
- if (prstDash) {
88078
- const dashVal = String(prstDash["@_val"] || "");
88079
- if (dashVal) {
88080
- style2[`${prefix}Dash`] = dashVal;
88081
- hasStyle = true;
88433
+ const dash = parseDrawingLineDash(node, presetDashValue);
88434
+ if (dash.strokeDash) {
88435
+ style2[`${prefix}Dash`] = dash.strokeDash;
88436
+ if (dash.strokeDash === "custom") {
88437
+ style2[`${prefix}DashSegments`] = dash.customDashSegments;
88082
88438
  }
88439
+ hasStyle = true;
88083
88440
  }
88084
88441
  }
88085
88442
  const firstBorderColor = style2.borderTopColor || style2.borderBottomColor || style2.borderLeftColor || style2.borderRightColor;
@@ -88171,6 +88528,7 @@ var init_table_cell_fill_border_helpers = __esm({
88171
88528
  "pptx/core/core/builders/table-cell-fill-border-helpers.ts"() {
88172
88529
  init_theme_color_ref();
88173
88530
  init_color_xml_preservation();
88531
+ init_drawing_line_dash();
88174
88532
  }
88175
88533
  });
88176
88534
 
@@ -119422,14 +119780,14 @@ function valXml(local, value) {
119422
119780
  const text2 = typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? chartNumber(value) : escapeAttribute(value);
119423
119781
  return `<c:${local} val="${text2}"/>`;
119424
119782
  }
119425
- function sameValue(left, right) {
119783
+ function sameValue2(left, right) {
119426
119784
  if (left === right) return true;
119427
119785
  if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
119428
119786
  if (Array.isArray(left) !== Array.isArray(right)) return false;
119429
119787
  const entries = (value) => Object.entries(value).filter(([, item2]) => item2 !== void 0);
119430
119788
  const a = entries(left);
119431
119789
  const b = new Map(entries(right));
119432
- return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue(item2, b.get(key2)));
119790
+ return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue2(item2, b.get(key2)));
119433
119791
  }
119434
119792
  var INVALID_XML, escapeText2, escapeAttribute, elementXml2, raw;
119435
119793
  var init_write_util = __esm({
@@ -120175,13 +120533,13 @@ function chartFillXml(fill3) {
120175
120533
  }
120176
120534
  function patchShape(root, shape3, read) {
120177
120535
  const doc = root.ownerDocument;
120178
- if (!sameValue(read.fill, shape3.fill)) {
120536
+ if (!sameValue2(read.fill, shape3.fill)) {
120179
120537
  const xml2 = shape3.fill && chartFillXml(shape3.fill);
120180
120538
  if (xml2) setDrawingFillXml(root, xml2);
120181
120539
  else if (!shape3.fill)
120182
120540
  for (let fill3 = fillElementOf(root); fill3; fill3 = fillElementOf(root)) root.removeChild(fill3);
120183
120541
  }
120184
- if (!sameValue(read.line, shape3.line)) {
120542
+ if (!sameValue2(read.line, shape3.line)) {
120185
120543
  let ln = first(root, "ln", NS.a);
120186
120544
  if (!shape3.line) {
120187
120545
  if (ln) root.removeChild(ln);
@@ -120213,7 +120571,7 @@ function shapePropertiesInnerXml(context, shape3) {
120213
120571
  if (sourceXml !== void 0) {
120214
120572
  const root = wrap("spPr", sourceXml);
120215
120573
  const read = readShapeFields(root);
120216
- if (sameValue(read, fields)) inner = sourceXml;
120574
+ if (sameValue2(read, fields)) inner = sourceXml;
120217
120575
  else {
120218
120576
  patchShape(root, fields, read);
120219
120577
  inner = innerXml(root);
@@ -120228,14 +120586,14 @@ function textBodyInnerXml(context, body) {
120228
120586
  const { sourceXml, ...fields } = body;
120229
120587
  if (sourceXml !== void 0) {
120230
120588
  const read = parseDrawingTextBody(wrap("txPr", sourceXml));
120231
- if (sameValue(read, fields)) return raw(context, sourceXml);
120589
+ if (sameValue2(read, fields)) return raw(context, sourceXml);
120232
120590
  }
120233
120591
  return raw(context, writeTextBody(fields));
120234
120592
  }
120235
120593
  function layoutXml(context, value) {
120236
120594
  if (!value) return "";
120237
120595
  const { sourceXml, ...layout } = value;
120238
- if (sourceXml !== void 0 && sameValue(readLayoutFields(wrap("layout", sourceXml)), layout))
120596
+ if (sourceXml !== void 0 && sameValue2(readLayoutFields(wrap("layout", sourceXml)), layout))
120239
120597
  return elementXml2("layout", raw(context, sourceXml));
120240
120598
  const manual = LAYOUT_FIELDS.map(([local, key2]) => {
120241
120599
  const value2 = layout[key2];
@@ -123525,7 +123883,16 @@ function repaintSeriesForFamily(series, toLine) {
123525
123883
  shape3.fill = structuredClone(shape3.line.fill);
123526
123884
  }
123527
123885
  function clearPointPaint(series, key2) {
123528
- for (const point2 of series.dataPoints) if (point2.spPr) delete point2.spPr[key2];
123886
+ const emptied2 = (part) => Object.keys(part).every((name) => name === "sourceXml");
123887
+ for (const point2 of series.dataPoints) {
123888
+ if (!point2.spPr) continue;
123889
+ delete point2.spPr[key2];
123890
+ if (point2.spPr.line && emptied2(point2.spPr.line)) delete point2.spPr.line;
123891
+ if (emptied2(point2.spPr)) delete point2.spPr;
123892
+ }
123893
+ series.dataPoints = series.dataPoints.filter(
123894
+ (point2) => Object.keys(point2).some((name) => name !== "index")
123895
+ );
123529
123896
  }
123530
123897
  function setChartSeriesFill(space, index, fill3) {
123531
123898
  return editChartSpace(space, (draft) => {
@@ -123534,27 +123901,27 @@ function setChartSeriesFill(space, index, fill3) {
123534
123901
  clearPointPaint(series, "fill");
123535
123902
  });
123536
123903
  }
123537
- function setChartSeriesColor2(space, index, color3) {
123904
+ function setChartSeriesColor2(space, index, color3, options2 = {}) {
123538
123905
  return editChartSpace(space, (draft) => {
123539
123906
  const { series } = chartSeriesEntryAt(draft, index);
123540
123907
  const shape3 = series.spPr ??= {};
123541
- const line3 = paintsLine(draft, index);
123908
+ const line3 = paintsLine2(draft, index);
123542
123909
  const current = line3 ? shape3.line?.fill : shape3.fill;
123543
123910
  const previous = current?.kind === "solid" ? current.color : void 0;
123544
123911
  const fill3 = color3 ? { kind: "solid", color: withAlphaOf(color3, previous) } : void 0;
123545
123912
  if (line3) assignOrDelete(shape3.line ??= {}, "fill", fill3);
123546
123913
  else assignOrDelete(shape3, "fill", fill3);
123547
- clearPointPaint(series, line3 ? "line" : "fill");
123914
+ if (!options2.keepPointColors) clearPointPaint(series, line3 ? "line" : "fill");
123548
123915
  });
123549
123916
  }
123550
- var paintsLine, painted;
123917
+ var paintsLine2, painted;
123551
123918
  var init_fill = __esm({
123552
123919
  "chart/edit/fill.ts"() {
123553
123920
  init_draft();
123554
123921
  init_paint();
123555
123922
  init_write_shape();
123556
123923
  init_xml_fragment();
123557
- paintsLine = (space, index) => chartGroupPaintsLine(chartSeriesEntryAt(space, index).group);
123924
+ paintsLine2 = (space, index) => chartGroupPaintsLine(chartSeriesEntryAt(space, index).group);
123558
123925
  painted = (fill3) => fill3 !== void 0 && fill3.kind !== "none";
123559
123926
  }
123560
123927
  });
@@ -126764,44 +127131,6 @@ var init_chart2 = __esm({
126764
127131
  }
126765
127132
  });
126766
127133
 
126767
- // pptx/core/utils/chart-container-type-map.ts
126768
- function chartContainerLocalNameToType(localName29) {
126769
- return CONTAINER_LOCAL_NAME_TO_TYPE[localName29];
126770
- }
126771
- function isLineDrawnChartType(type) {
126772
- return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
126773
- }
126774
- var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
126775
- var init_chart_container_type_map = __esm({
126776
- "pptx/core/utils/chart-container-type-map.ts"() {
126777
- CONTAINER_LOCAL_NAME_TO_TYPE = {
126778
- barChart: "bar",
126779
- bar3DChart: "bar3D",
126780
- lineChart: "line",
126781
- line3DChart: "line3D",
126782
- pieChart: "pie",
126783
- pie3DChart: "pie3D",
126784
- ofPieChart: "ofPie",
126785
- doughnutChart: "doughnut",
126786
- areaChart: "area",
126787
- area3DChart: "area3D",
126788
- scatterChart: "scatter",
126789
- bubbleChart: "bubble",
126790
- radarChart: "radar",
126791
- stockChart: "stock",
126792
- surfaceChart: "surface",
126793
- surface3DChart: "surface"
126794
- };
126795
- LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
126796
- "line",
126797
- "line3D",
126798
- "scatter",
126799
- "radar",
126800
- "stock"
126801
- ]);
126802
- }
126803
- });
126804
-
126805
127134
  // pptx/core/utils/chart-from-neutral-labels.ts
126806
127135
  function setOrRemove(target, key2, value) {
126807
127136
  if (value === void 0) delete target[key2];
@@ -134129,16 +134458,16 @@ function tableToShapeGroup(tableData, bounds) {
134129
134458
  const y = bounds.y + rowIndex * rowHeightEmu;
134130
134459
  let colIndex = 0;
134131
134460
  for (const cell3 of row.cells) {
134132
- const span = Math.max(1, cell3.gridSpan ?? 1);
134461
+ const span2 = Math.max(1, cell3.gridSpan ?? 1);
134133
134462
  if (cell3.vMerge) {
134134
134463
  vMergeActive[colIndex] = true;
134135
- colIndex += span;
134464
+ colIndex += span2;
134136
134465
  continue;
134137
134466
  }
134138
134467
  vMergeActive[colIndex] = false;
134139
134468
  if (!cell3.hMerge) {
134140
134469
  const x = colStartX[colIndex] ?? bounds.x;
134141
- const w = colEmuWidths.slice(colIndex, colIndex + span).reduce((s, v) => s + v, 0);
134470
+ const w = colEmuWidths.slice(colIndex, colIndex + span2).reduce((s, v) => s + v, 0);
134142
134471
  children17.push({
134143
134472
  kind: "shape",
134144
134473
  spt: 1,
@@ -134152,7 +134481,7 @@ function tableToShapeGroup(tableData, bounds) {
134152
134481
  text: { textType: 4, paragraphs: cellParagraphs(cell3.text) }
134153
134482
  });
134154
134483
  }
134155
- colIndex += span;
134484
+ colIndex += span2;
134156
134485
  }
134157
134486
  });
134158
134487
  return { kind: "group", anchor: bounds, children: children17 };
@@ -144551,6 +144880,10 @@ var init_chart_neutral_save_chrome = __esm({
144551
144880
  });
144552
144881
 
144553
144882
  // pptx/core/utils/chart-neutral-save-points.ts
144883
+ function pointShape(shape3) {
144884
+ if (shape3.line && emptied(shape3.line)) delete shape3.line;
144885
+ return emptied(shape3) ? null : shape3;
144886
+ }
144554
144887
  function pointEdit(edits, seriesIndex, old, next) {
144555
144888
  for (const key2 of ["picture", "impliedPicture", "uniqueId"])
144556
144889
  if (!same6(old?.[key2], next[key2])) return false;
@@ -144573,6 +144906,7 @@ function pointEdit(edits, seriesIndex, old, next) {
144573
144906
  ) ?? null
144574
144907
  });
144575
144908
  }
144909
+ if (edit.spPr) edit.spPr = pointShape(edit.spPr);
144576
144910
  if (!same6(old?.marker, next.marker)) {
144577
144911
  if (!next.marker) edit.marker = null;
144578
144912
  else {
@@ -144615,6 +144949,7 @@ function planNeutralChartPoints(before, probe, edits) {
144615
144949
  series.dataPoints = previous.dataPoints;
144616
144950
  });
144617
144951
  }
144952
+ var emptied;
144618
144953
  var init_chart_neutral_save_points = __esm({
144619
144954
  "pptx/core/utils/chart-neutral-save-points.ts"() {
144620
144955
  init_chart2();
@@ -144622,6 +144957,7 @@ var init_chart_neutral_save_points = __esm({
144622
144957
  init_chart_neutral_save_common();
144623
144958
  init_chart_neutral_save_shape();
144624
144959
  init_chart_container_type_map();
144960
+ emptied = (part) => Object.keys(part).every((key2) => key2 === "sourceXml");
144625
144961
  }
144626
144962
  });
144627
144963
 
@@ -144837,7 +145173,9 @@ function planNeutralChartSeriesColors(before, probe, edits) {
144837
145173
  const value = series.color?.replace(/^#/, "");
144838
145174
  if (value !== void 0 && !/^[\da-f]{6}$/i.test(value)) return;
144839
145175
  edits.push(
144840
- (space) => setChartSeriesColor2(space, index, value ? { kind: "srgb", value, transforms: [] } : null)
145176
+ (space) => setChartSeriesColor2(space, index, value ? { kind: "srgb", value, transforms: [] } : null, {
145177
+ keepPointColors: true
145178
+ })
144841
145179
  );
144842
145180
  if (previous.color === void 0) delete series.color;
144843
145181
  else series.color = previous.color;
@@ -147953,8 +148291,8 @@ function renderBars(element2, x, y, w, h2) {
147953
148291
  const values = chartValues(element2);
147954
148292
  const min = Math.min(0, ...values);
147955
148293
  const max = Math.max(0, ...values);
147956
- const span = max - min || 1;
147957
- const zeroY = y + max / span * h2;
148294
+ const span2 = max - min || 1;
148295
+ const zeroY = y + max / span2 * h2;
147958
148296
  const categoryCount = Math.max(
147959
148297
  data.categories.length,
147960
148298
  ...data.series.map((s) => s.values.length),
@@ -147965,7 +148303,7 @@ function renderBars(element2, x, y, w, h2) {
147965
148303
  const parts = [`<line x1="${x}" y1="${zeroY}" x2="${x + w}" y2="${zeroY}" stroke="#666666" />`];
147966
148304
  data.series.forEach((series, seriesIndex) => {
147967
148305
  series.values.forEach((value, categoryIndex) => {
147968
- const valueY = y + (max - value) / span * h2;
148306
+ const valueY = y + (max - value) / span2 * h2;
147969
148307
  parts.push(
147970
148308
  `<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(color2(series, seriesIndex))}" />`
147971
148309
  );
@@ -147978,10 +148316,10 @@ function renderLines(element2, x, y, w, h2) {
147978
148316
  const values = chartValues(element2);
147979
148317
  const min = Math.min(...values);
147980
148318
  const max = Math.max(...values);
147981
- const span = max - min || 1;
148319
+ const span2 = max - min || 1;
147982
148320
  return data.series.map((series, seriesIndex) => {
147983
148321
  const denominator = Math.max(series.values.length - 1, 1);
147984
- const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) / span * h2}`).join(" ");
148322
+ const points7 = series.values.map((value, index) => `${x + index / denominator * w},${y + (max - value) / span2 * h2}`).join(" ");
147985
148323
  return `<polyline data-chart-mark="line" points="${points7}" fill="none" stroke="${esc3(color2(series, seriesIndex))}" stroke-width="2" />`;
147986
148324
  }).join("");
147987
148325
  }
@@ -153017,6 +153355,17 @@ var init_save_group_fill = __esm({
153017
153355
  });
153018
153356
 
153019
153357
  // pptx/core/core/runtime/save-shape-xml-frames.ts
153358
+ function tableGridXml(el, widthEmu) {
153359
+ const fractions = el.tableData?.columnWidths ?? [];
153360
+ if (fractions.length === 0 || !(widthEmu > 0)) {
153361
+ return {};
153362
+ }
153363
+ const widths = fractions.map((fraction) => Math.max(0, Math.round(fraction * widthEmu)));
153364
+ const last = widths.length - 1;
153365
+ widths[last] = Math.max(0, (widths[last] ?? 0) + widthEmu - widths.reduce((a, b) => a + b, 0));
153366
+ const cols = widths.map((w) => ({ "@_w": String(w) }));
153367
+ return { "a:gridCol": cols.length === 1 ? cols[0] : cols };
153368
+ }
153020
153369
  function buildTableGraphicFrameXml(el, emuPerPx) {
153021
153370
  el.locks = { noGrouping: true, ...el.locks };
153022
153371
  const offX = String(Math.round(el.x * emuPerPx));
@@ -153047,7 +153396,7 @@ function buildTableGraphicFrameXml(el, emuPerPx) {
153047
153396
  "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
153048
153397
  "a:tbl": {
153049
153398
  "a:tblPr": tblPr,
153050
- "a:tblGrid": {}
153399
+ "a:tblGrid": tableGridXml(el, Number(extCx))
153051
153400
  }
153052
153401
  }
153053
153402
  }
@@ -155270,12 +155619,92 @@ var init_PptxHandlerRuntimeLayoutSwitching = __esm({
155270
155619
  }
155271
155620
  });
155272
155621
 
155622
+ // pptx/core/core/runtime/table-cell-border-save.ts
155623
+ function cellEdges(style2) {
155624
+ return [
155625
+ {
155626
+ xmlKey: "a:lnT",
155627
+ width: style2.borderTopWidth,
155628
+ color: style2.borderTopColor,
155629
+ dash: style2.borderTopDash,
155630
+ segments: style2.borderTopDashSegments
155631
+ },
155632
+ {
155633
+ xmlKey: "a:lnB",
155634
+ width: style2.borderBottomWidth,
155635
+ color: style2.borderBottomColor,
155636
+ dash: style2.borderBottomDash,
155637
+ segments: style2.borderBottomDashSegments
155638
+ },
155639
+ {
155640
+ xmlKey: "a:lnL",
155641
+ width: style2.borderLeftWidth,
155642
+ color: style2.borderLeftColor,
155643
+ dash: style2.borderLeftDash,
155644
+ segments: style2.borderLeftDashSegments
155645
+ },
155646
+ {
155647
+ xmlKey: "a:lnR",
155648
+ width: style2.borderRightWidth,
155649
+ color: style2.borderRightColor,
155650
+ dash: style2.borderRightDash,
155651
+ segments: style2.borderRightDashSegments
155652
+ }
155653
+ ];
155654
+ }
155655
+ function writeEdgeDash(ln, edge) {
155656
+ if (edge.dash === void 0 || edge.dash === "") {
155657
+ return;
155658
+ }
155659
+ if (edge.dash === "solid") {
155660
+ delete ln["a:prstDash"];
155661
+ delete ln["a:custDash"];
155662
+ return;
155663
+ }
155664
+ if (edge.dash === "custom") {
155665
+ if (edge.segments && edge.segments.length > 0) {
155666
+ applyDrawingLineDash(ln, { strokeDash: "custom", customDashSegments: edge.segments });
155667
+ }
155668
+ return;
155669
+ }
155670
+ applyDrawingLineDash(ln, { strokeDash: edge.dash });
155671
+ }
155672
+ function writeCellEdgeBorders(tcPr, style2, emuPerPx) {
155673
+ for (const edge of cellEdges(style2)) {
155674
+ if (edge.width === void 0 && edge.color === void 0 && edge.dash === void 0) {
155675
+ continue;
155676
+ }
155677
+ const existing = tcPr[edge.xmlKey];
155678
+ const ln = existing && typeof existing === "object" ? existing : {};
155679
+ if (edge.width !== void 0) {
155680
+ ln["@_w"] = String(Math.round(edge.width * emuPerPx));
155681
+ }
155682
+ if (edge.color) {
155683
+ delete ln["a:noFill"];
155684
+ delete ln["a:gradFill"];
155685
+ delete ln["a:pattFill"];
155686
+ ln["a:solidFill"] = {
155687
+ "a:srgbClr": { "@_val": edge.color.replace("#", "") }
155688
+ };
155689
+ }
155690
+ writeEdgeDash(ln, edge);
155691
+ tcPr[edge.xmlKey] = reorderObjectKeys(ln, LN_CHILD_ORDER);
155692
+ }
155693
+ }
155694
+ var init_table_cell_border_save = __esm({
155695
+ "pptx/core/core/runtime/table-cell-border-save.ts"() {
155696
+ init_drawing_line_dash();
155697
+ init_xml_reorder();
155698
+ }
155699
+ });
155700
+
155273
155701
  // pptx/core/core/runtime/table-cell-save-helpers.ts
155274
155702
  function writeCellFill(tcPr, style2, resolveColorXml) {
155275
155703
  if (style2.fillMode === "gradient" && style2.gradientFillStops && style2.gradientFillStops.length > 0) {
155276
155704
  delete tcPr["a:solidFill"];
155277
155705
  delete tcPr["a:pattFill"];
155278
155706
  delete tcPr["a:blipFill"];
155707
+ delete tcPr["a:noFill"];
155279
155708
  const stops = style2.gradientFillStops.map((stop) => {
155280
155709
  const posRaw = typeof stop.position === "number" ? stop.position : 0;
155281
155710
  const position4 = Math.round(Math.max(0, Math.min(1, posRaw / 100)) * 1e5);
@@ -155327,6 +155756,7 @@ function writeCellFill(tcPr, style2, resolveColorXml) {
155327
155756
  delete tcPr["a:solidFill"];
155328
155757
  delete tcPr["a:gradFill"];
155329
155758
  delete tcPr["a:blipFill"];
155759
+ delete tcPr["a:noFill"];
155330
155760
  const pattXml = {
155331
155761
  "@_prst": style2.patternFillPreset
155332
155762
  };
@@ -155350,10 +155780,12 @@ function writeCellFill(tcPr, style2, resolveColorXml) {
155350
155780
  delete tcPr["a:gradFill"];
155351
155781
  delete tcPr["a:pattFill"];
155352
155782
  delete tcPr["a:blipFill"];
155783
+ tcPr["a:noFill"] = tcPr["a:noFill"] ?? {};
155353
155784
  } else if (style2.fillMode !== "image" && style2.backgroundColor) {
155354
155785
  delete tcPr["a:gradFill"];
155355
155786
  delete tcPr["a:pattFill"];
155356
155787
  delete tcPr["a:blipFill"];
155788
+ delete tcPr["a:noFill"];
155357
155789
  const resolvedOriginal = style2.backgroundColorXml && resolveColorXml ? resolveColorXml(style2.backgroundColorXml) : void 0;
155358
155790
  tcPr["a:solidFill"] = serializeColorChoiceWithRef(
155359
155791
  style2.backgroundColorRef,
@@ -155611,6 +156043,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
155611
156043
  init_xml_access();
155612
156044
  init_xml_reorder();
155613
156045
  init_PptxHandlerRuntimeLayoutSwitching();
156046
+ init_table_cell_border_save();
155614
156047
  init_table_cell_save_helpers();
155615
156048
  init_table_cell_text_xml();
155616
156049
  PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime21 {
@@ -155688,53 +156121,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
155688
156121
  pPr["@_algn"] = token3;
155689
156122
  }
155690
156123
  }
155691
- const borderEdges = [
155692
- {
155693
- xmlKey: "a:lnT",
155694
- width: style2.borderTopWidth,
155695
- color: style2.borderTopColor,
155696
- dash: style2.borderTopDash
155697
- },
155698
- {
155699
- xmlKey: "a:lnB",
155700
- width: style2.borderBottomWidth,
155701
- color: style2.borderBottomColor,
155702
- dash: style2.borderBottomDash
155703
- },
155704
- {
155705
- xmlKey: "a:lnL",
155706
- width: style2.borderLeftWidth,
155707
- color: style2.borderLeftColor,
155708
- dash: style2.borderLeftDash
155709
- },
155710
- {
155711
- xmlKey: "a:lnR",
155712
- width: style2.borderRightWidth,
155713
- color: style2.borderRightColor,
155714
- dash: style2.borderRightDash
155715
- }
155716
- ];
155717
- for (const edge of borderEdges) {
155718
- if (edge.width !== void 0 || edge.color !== void 0 || edge.dash !== void 0) {
155719
- if (!tcPr[edge.xmlKey]) {
155720
- tcPr[edge.xmlKey] = {};
155721
- }
155722
- const ln = tcPr[edge.xmlKey];
155723
- if (edge.width !== void 0) {
155724
- ln["@_w"] = String(Math.round(edge.width * _PptxHandlerRuntime.EMU_PER_PX));
155725
- }
155726
- if (edge.color) {
155727
- ln["a:solidFill"] = {
155728
- "a:srgbClr": { "@_val": edge.color.replace("#", "") }
155729
- };
155730
- }
155731
- if (edge.dash && edge.dash !== "solid") {
155732
- ln["a:prstDash"] = { "@_val": edge.dash };
155733
- } else if (edge.dash === "solid") {
155734
- delete ln["a:prstDash"];
155735
- }
155736
- }
155737
- }
156124
+ writeCellEdgeBorders(tcPr, style2, _PptxHandlerRuntime.EMU_PER_PX);
155738
156125
  const emuPerPx = _PptxHandlerRuntime.EMU_PER_PX;
155739
156126
  if (style2.marginLeft !== void 0) {
155740
156127
  tcPr["@_marL"] = String(Math.round(style2.marginLeft * emuPerPx));
@@ -156169,10 +156556,13 @@ var init_table_style_change_cell_clear = __esm({
156169
156556
  "a:grpFill"
156170
156557
  ];
156171
156558
  LINE_KEYS = [
156172
- ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
156173
- ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
156174
- ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
156175
- ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
156559
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash", "borderLeftDashSegments"]],
156560
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash", "borderRightDashSegments"]],
156561
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash", "borderTopDashSegments"]],
156562
+ [
156563
+ "a:lnB",
156564
+ ["borderBottomWidth", "borderBottomColor", "borderBottomDash", "borderBottomDashSegments"]
156565
+ ],
156176
156566
  ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
156177
156567
  ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
156178
156568
  ];
@@ -156651,8 +157041,8 @@ function cells(row) {
156651
157041
  return ensureArray19(row["a:tc"]);
156652
157042
  }
156653
157043
  function promoteTextBody(source2, next, removed, survivor, axis) {
156654
- const span = axis === "row" ? "rowSpan" : "gridSpan";
156655
- if (!source2?.text || !next || !removed || !survivor || source2.hMerge || source2.vMerge || (source2[span] ?? 1) <= 1 || next.hMerge || next.vMerge || (next[span] ?? 1) !== (source2[span] ?? 1) - 1) {
157044
+ const span2 = axis === "row" ? "rowSpan" : "gridSpan";
157045
+ if (!source2?.text || !next || !removed || !survivor || source2.hMerge || source2.vMerge || (source2[span2] ?? 1) <= 1 || next.hMerge || next.vMerge || (next[span2] ?? 1) !== (source2[span2] ?? 1) - 1) {
156656
157046
  return;
156657
157047
  }
156658
157048
  if (removed["a:txBody"] !== void 0) {