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
@@ -3450,6 +3450,44 @@ var init_chart_layout_input = __esm({
3450
3450
  }
3451
3451
  });
3452
3452
 
3453
+ // pptx/core/utils/chart-container-type-map.ts
3454
+ function chartContainerLocalNameToType(localName28) {
3455
+ return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
3456
+ }
3457
+ function isLineDrawnChartType(type) {
3458
+ return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
3459
+ }
3460
+ var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
3461
+ var init_chart_container_type_map = __esm({
3462
+ "pptx/core/utils/chart-container-type-map.ts"() {
3463
+ CONTAINER_LOCAL_NAME_TO_TYPE = {
3464
+ barChart: "bar",
3465
+ bar3DChart: "bar3D",
3466
+ lineChart: "line",
3467
+ line3DChart: "line3D",
3468
+ pieChart: "pie",
3469
+ pie3DChart: "pie3D",
3470
+ ofPieChart: "ofPie",
3471
+ doughnutChart: "doughnut",
3472
+ areaChart: "area",
3473
+ area3DChart: "area3D",
3474
+ scatterChart: "scatter",
3475
+ bubbleChart: "bubble",
3476
+ radarChart: "radar",
3477
+ stockChart: "stock",
3478
+ surfaceChart: "surface",
3479
+ surface3DChart: "surface"
3480
+ };
3481
+ LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
3482
+ "line",
3483
+ "line3D",
3484
+ "scatter",
3485
+ "radar",
3486
+ "stock"
3487
+ ]);
3488
+ }
3489
+ });
3490
+
3453
3491
  // pptx/core/builders/sdk/chart-operations.ts
3454
3492
  function ensureChartData(element2) {
3455
3493
  if (!element2.chartData) {
@@ -3954,6 +3992,289 @@ var init_shape_style_input = __esm({
3954
3992
  }
3955
3993
  });
3956
3994
 
3995
+ // pptx/core/builders/sdk/table-border-input.ts
3996
+ function borderDashSegments(edge, lengths, width) {
3997
+ const name = `TableCellInput.borders.${edge}.dash`;
3998
+ if (lengths.length === 0) {
3999
+ throw new RangeError(`${name} must give at least one length`);
4000
+ }
4001
+ if (lengths.some((n) => !Number.isFinite(n) || n <= 0)) {
4002
+ throw new RangeError(`${name} lengths must be finite and above 0, got [${lengths.join(", ")}]`);
4003
+ }
4004
+ const segments = customDashSegments([...lengths], width !== void 0 && width > 0 ? width : 1);
4005
+ if (segments.some((s) => s.dash <= 0 || s.space <= 0)) {
4006
+ throw new RangeError(`${name} has a length too short to write: [${lengths.join(", ")}]`);
4007
+ }
4008
+ if (segments.some((s) => s.dash > MAX_DASH_UNITS || s.space > MAX_DASH_UNITS)) {
4009
+ throw new RangeError(`${name} has a length too long to write: [${lengths.join(", ")}]`);
4010
+ }
4011
+ return segments;
4012
+ }
4013
+ function edgeStyle(edge, prefix, input2) {
4014
+ if (input2.width !== void 0 && (!Number.isFinite(input2.width) || input2.width < 0)) {
4015
+ throw new RangeError(
4016
+ `TableCellInput.borders.${edge}.width must be a finite width of 0 or more, got ${input2.width}`
4017
+ );
4018
+ }
4019
+ const out = {};
4020
+ if (input2.width !== void 0) out[`${prefix}Width`] = input2.width;
4021
+ if (input2.color !== void 0) out[`${prefix}Color`] = input2.color;
4022
+ if (Array.isArray(input2.dash)) {
4023
+ out[`${prefix}Dash`] = "custom";
4024
+ out[`${prefix}DashSegments`] = borderDashSegments(edge, input2.dash, input2.width);
4025
+ } else if (input2.dash !== void 0) {
4026
+ if (input2.dash === "custom") {
4027
+ throw new RangeError(`TableCellInput.borders.${edge}.dash: give 'custom' as a length list`);
4028
+ }
4029
+ out[`${prefix}Dash`] = input2.dash;
4030
+ }
4031
+ return out;
4032
+ }
4033
+ function tableCellBorderStyle(borders) {
4034
+ if (!borders) {
4035
+ return {};
4036
+ }
4037
+ const out = {};
4038
+ for (const [edge, prefix] of EDGES) {
4039
+ const own2 = borders[edge];
4040
+ const input2 = borders.all || own2 ? { ...borders.all, ...own2 } : void 0;
4041
+ if (input2) {
4042
+ Object.assign(out, edgeStyle(own2 ? edge : "all", prefix, input2));
4043
+ }
4044
+ }
4045
+ return out;
4046
+ }
4047
+ var MAX_DASH_UNITS, EDGES;
4048
+ var init_table_border_input = __esm({
4049
+ "pptx/core/builders/sdk/table-border-input.ts"() {
4050
+ init_shape_style_input();
4051
+ MAX_DASH_UNITS = 2147483647;
4052
+ EDGES = [
4053
+ ["top", "borderTop"],
4054
+ ["right", "borderRight"],
4055
+ ["bottom", "borderBottom"],
4056
+ ["left", "borderLeft"]
4057
+ ];
4058
+ }
4059
+ });
4060
+
4061
+ // pptx/core/builders/sdk/table-cell-input.ts
4062
+ function refuseGradientExtras(fill3) {
4063
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4064
+ const unsupported3 = [
4065
+ fill3.tile !== void 0 ? "tile" : void 0,
4066
+ fill3.scaled === false ? "scaled: false" : void 0,
4067
+ fill3.rotWithShape !== void 0 ? "rotWithShape" : void 0,
4068
+ fill3.focus !== void 0 && !radial ? "focus on a linear gradient" : void 0
4069
+ ].filter((name) => name !== void 0);
4070
+ if (unsupported3.length > 0) {
4071
+ throw new RangeError(
4072
+ `TableCellInput.fill: ${unsupported3.join(", ")} cannot be written on a table cell`
4073
+ );
4074
+ }
4075
+ if (fill3.stops.length === 0) {
4076
+ throw new RangeError("TableCellInput.fill: a gradient needs at least one stop");
4077
+ }
4078
+ }
4079
+ function tableCellFillStyle(fill3) {
4080
+ switch (fill3?.type) {
4081
+ case void 0:
4082
+ return {};
4083
+ case "solid":
4084
+ if (fill3.opacity !== void 0 && fill3.opacity !== 1) {
4085
+ throw new RangeError(
4086
+ `TableCellInput.fill.opacity cannot be written on a table cell, got ${fill3.opacity}`
4087
+ );
4088
+ }
4089
+ return {
4090
+ fillMode: "solid",
4091
+ backgroundColor: fill3.color,
4092
+ ...fill3.themeColorRef ? { backgroundColorRef: fill3.themeColorRef } : {}
4093
+ };
4094
+ case "gradient": {
4095
+ refuseGradientExtras(fill3);
4096
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4097
+ return {
4098
+ fillMode: "gradient",
4099
+ gradientFillType: radial ? "radial" : "linear",
4100
+ gradientFillAngle: fill3.angle ?? 0,
4101
+ gradientFillStops: fill3.stops.map((stop) => ({
4102
+ color: stop.color,
4103
+ position: stop.position,
4104
+ ...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
4105
+ })),
4106
+ ...radial ? { gradientFillPathType: fill3.path ?? "circle" } : {},
4107
+ ...fill3.focus ? { gradientFillFillToRect: { ...fill3.focus } } : {}
4108
+ };
4109
+ }
4110
+ case "pattern":
4111
+ if (!fill3.preset) {
4112
+ throw new RangeError("TableCellInput.fill: a pattern fill needs a preset");
4113
+ }
4114
+ return {
4115
+ fillMode: "pattern",
4116
+ patternFillPreset: fill3.preset,
4117
+ ...fill3.foreground !== void 0 ? { patternFillForeground: fill3.foreground } : {},
4118
+ ...fill3.background !== void 0 ? { patternFillBackground: fill3.background } : {}
4119
+ };
4120
+ case "image":
4121
+ throw new RangeError("TableCellInput.fill: an image fill cannot be written on a table cell");
4122
+ case "none":
4123
+ return { fillMode: "none" };
4124
+ }
4125
+ }
4126
+ function tableCellTextStyle(style) {
4127
+ const out = {};
4128
+ if (style?.fontSize !== void 0) out.fontSize = style.fontSize;
4129
+ if (style?.bold !== void 0) out.bold = style.bold;
4130
+ if (style?.italic !== void 0) out.italic = style.italic;
4131
+ if (style?.color !== void 0) out.color = style.color;
4132
+ if (style?.alignment !== void 0) out.align = style.alignment;
4133
+ return out;
4134
+ }
4135
+ function tableCellStyle(cell2) {
4136
+ const style = {
4137
+ ...tableCellTextStyle(cell2.style),
4138
+ ...tableCellFillStyle(cell2.fill),
4139
+ ...tableCellBorderStyle(cell2.borders)
4140
+ };
4141
+ return cell2.style || Object.keys(style).length > 0 ? style : void 0;
4142
+ }
4143
+ var init_table_cell_input = __esm({
4144
+ "pptx/core/builders/sdk/table-cell-input.ts"() {
4145
+ init_table_border_input();
4146
+ }
4147
+ });
4148
+
4149
+ // pptx/core/builders/sdk/table-merge-input.ts
4150
+ function span(value, name) {
4151
+ if (value === void 0) {
4152
+ return 1;
4153
+ }
4154
+ if (!Number.isInteger(value) || value < 1) {
4155
+ throw new RangeError(`TableCellInput.${name} must be a whole number from 1, got ${value}`);
4156
+ }
4157
+ return value;
4158
+ }
4159
+ function placeTableCells(input2) {
4160
+ const rowCount = input2.rows.length;
4161
+ const slots = input2.rows.map(() => []);
4162
+ input2.rows.forEach((row, ri) => {
4163
+ const rowSlots = slots[ri] ?? [];
4164
+ let ci = 0;
4165
+ for (const cell2 of row.cells) {
4166
+ while (rowSlots[ci]) {
4167
+ ci += 1;
4168
+ }
4169
+ const colSpan = span(cell2.gridSpan, "gridSpan");
4170
+ const rowSpan = span(cell2.rowSpan, "rowSpan");
4171
+ if (ri + rowSpan > rowCount) {
4172
+ throw new RangeError(
4173
+ `A cell in row ${ri} spans ${rowSpan} rows, past the table's ${rowCount} rows`
4174
+ );
4175
+ }
4176
+ for (let dr = 0; dr < rowSpan; dr++) {
4177
+ for (let dc = 0; dc < colSpan; dc++) {
4178
+ const target = slots[ri + dr] ?? [];
4179
+ if (target[ci + dc]) {
4180
+ throw new RangeError(
4181
+ `A cell in row ${ri} overlaps the merge covering row ${ri + dr}, column ${ci + dc}`
4182
+ );
4183
+ }
4184
+ target[ci + dc] = dr === 0 && dc === 0 ? { cell: cell2 } : { hMerge: dc > 0, vMerge: dr > 0 };
4185
+ }
4186
+ }
4187
+ ci += colSpan;
4188
+ }
4189
+ });
4190
+ const widest = Math.max(...slots.map((row) => row.length), 1);
4191
+ const declared = input2.columnWidths?.length;
4192
+ if (declared !== void 0 && widest > declared) {
4193
+ throw new RangeError(`A row takes ${widest} columns, but columnWidths gives ${declared}`);
4194
+ }
4195
+ const columnCount = declared ?? widest;
4196
+ return {
4197
+ columnCount,
4198
+ rows: slots.map(
4199
+ (row) => Array.from({ length: columnCount }, (_, ci) => row[ci] ?? { cell: { text: "" } })
4200
+ )
4201
+ };
4202
+ }
4203
+ function columnFractions(columnWidths, columnCount) {
4204
+ if (!columnWidths) {
4205
+ return Array.from({ length: columnCount }, () => 1 / columnCount);
4206
+ }
4207
+ if (columnWidths.length !== columnCount) {
4208
+ throw new RangeError(
4209
+ `columnWidths gives ${columnWidths.length} widths for a table of ${columnCount} columns`
4210
+ );
4211
+ }
4212
+ if (columnWidths.some((w) => !Number.isFinite(w) || w < 0)) {
4213
+ throw new RangeError("columnWidths must be finite widths of 0 or more");
4214
+ }
4215
+ const sum = columnWidths.reduce((a, b) => a + b, 0);
4216
+ if (sum <= 0) {
4217
+ throw new RangeError("columnWidths must not all be 0");
4218
+ }
4219
+ return columnWidths.map((w) => w / sum);
4220
+ }
4221
+ var init_table_merge_input = __esm({
4222
+ "pptx/core/builders/sdk/table-merge-input.ts"() {
4223
+ }
4224
+ });
4225
+
4226
+ // pptx/core/builders/sdk/text-segment-style.ts
4227
+ function elementStyleForSegments(textStyle, segments) {
4228
+ const styled = segments.filter((segment) => !segment.isParagraphBreak);
4229
+ const first2 = styled[0]?.style;
4230
+ if (!first2) {
4231
+ return textStyle;
4232
+ }
4233
+ const next = { ...textStyle };
4234
+ for (const key2 of RUN_KEYS) {
4235
+ const value = first2[key2];
4236
+ if (!styled.every((segment) => sameValue(segment.style?.[key2], value))) {
4237
+ continue;
4238
+ }
4239
+ if (value === void 0) {
4240
+ delete next[key2];
4241
+ } else {
4242
+ next[key2] = value;
4243
+ }
4244
+ }
4245
+ return next;
4246
+ }
4247
+ function sameValue(a, b) {
4248
+ if (a === b) {
4249
+ return true;
4250
+ }
4251
+ if (a && b && typeof a === "object" && typeof b === "object") {
4252
+ return JSON.stringify(a) === JSON.stringify(b);
4253
+ }
4254
+ return false;
4255
+ }
4256
+ var RUN_KEYS;
4257
+ var init_text_segment_style = __esm({
4258
+ "pptx/core/builders/sdk/text-segment-style.ts"() {
4259
+ RUN_KEYS = [
4260
+ "fontFamily",
4261
+ "fontSize",
4262
+ "bold",
4263
+ "italic",
4264
+ "underline",
4265
+ "strikethrough",
4266
+ "color",
4267
+ "colorRef",
4268
+ "characterSpacing",
4269
+ "hyperlink",
4270
+ "hyperlinkAction",
4271
+ "hyperlinkTargetSlideIndex",
4272
+ "hyperlinkTooltip",
4273
+ "align"
4274
+ ];
4275
+ }
4276
+ });
4277
+
3957
4278
  // pptx/core/builders/sdk/ElementFactory.ts
3958
4279
  function generateId(prefix) {
3959
4280
  idCounter += 1;
@@ -4062,6 +4383,7 @@ function createTextElement(text2, options2) {
4062
4383
  verticalAlignment: options2?.verticalAlignment,
4063
4384
  lineSpacing: options2?.lineSpacing
4064
4385
  };
4386
+ const textSegments = buildTextSegments(text2, textStyleBase);
4065
4387
  return {
4066
4388
  type: "text",
4067
4389
  id: generateId("txt"),
@@ -4069,8 +4391,8 @@ function createTextElement(text2, options2) {
4069
4391
  rotation: options2?.rotation,
4070
4392
  opacity: options2?.opacity,
4071
4393
  text: plainText,
4072
- textStyle: mapTextStyleInput(textStyleBase),
4073
- textSegments: buildTextSegments(text2, textStyleBase),
4394
+ textStyle: elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
4395
+ textSegments,
4074
4396
  shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
4075
4397
  };
4076
4398
  }
@@ -4150,32 +4472,30 @@ function createImageElement(source2, options2) {
4150
4472
  cropBottom: options2?.cropBottom
4151
4473
  };
4152
4474
  }
4475
+ function createTableCell(cellInput) {
4476
+ return {
4477
+ text: cellInput.text,
4478
+ gridSpan: cellInput.gridSpan,
4479
+ rowSpan: cellInput.rowSpan,
4480
+ style: tableCellStyle(cellInput)
4481
+ };
4482
+ }
4153
4483
  function createTableElement(input2, options2) {
4154
- const numCols = Math.max(...input2.rows.map((r) => r.cells.length), 1);
4484
+ const grid = input2.fillMergedCells ? placeTableCells(input2) : void 0;
4485
+ const numCols = grid?.columnCount ?? Math.max(...input2.rows.map((r) => r.cells.length), 1);
4155
4486
  const rowHeight = input2.rows.length > 0 ? Math.max(30, Math.floor(200 / input2.rows.length)) : 30;
4156
4487
  const totalHeight = options2?.height ?? Math.max(100, input2.rows.length * rowHeight);
4157
4488
  const p2 = pos("table", { ...options2, height: totalHeight });
4158
- let colWidths;
4159
- if (input2.columnWidths && input2.columnWidths.length === numCols) {
4160
- const sum = input2.columnWidths.reduce((a, b) => a + b, 0);
4161
- colWidths = input2.columnWidths.map((w) => w / sum);
4162
- } else {
4163
- colWidths = Array(numCols).fill(1 / numCols);
4164
- }
4165
- const rows = input2.rows.map((rowInput) => ({
4489
+ const colWidths = columnFractions(input2.columnWidths, numCols);
4490
+ const rows = input2.rows.map((rowInput, ri) => ({
4166
4491
  height: rowInput.height ?? rowHeight,
4167
- cells: rowInput.cells.map((cellInput) => ({
4168
- text: cellInput.text,
4169
- gridSpan: cellInput.gridSpan,
4170
- rowSpan: cellInput.rowSpan,
4171
- style: cellInput.style ? {
4172
- fontSize: cellInput.style.fontSize,
4173
- bold: cellInput.style.bold,
4174
- italic: cellInput.style.italic,
4175
- color: cellInput.style.color,
4176
- align: cellInput.style.alignment
4177
- } : void 0
4178
- }))
4492
+ cells: grid ? (grid.rows[ri] ?? []).map(
4493
+ (slot2) => slot2.cell ? createTableCell(slot2.cell) : {
4494
+ text: "",
4495
+ ...slot2.hMerge ? { hMerge: true } : {},
4496
+ ...slot2.vMerge ? { vMerge: true } : {}
4497
+ }
4498
+ ) : rowInput.cells.map(createTableCell)
4179
4499
  }));
4180
4500
  const tableData = {
4181
4501
  rows,
@@ -4190,7 +4510,9 @@ function createTableElement(input2, options2) {
4190
4510
  // Accent 1 unless the caller picked a style. This is decided at
4191
4511
  // creation time so the save pipeline never has to invent a style for
4192
4512
  // loaded tables that legitimately have none.
4193
- tableStyleId: input2.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
4513
+ // `style: 'none'` (or '') opts out, so the cells' own formatting is not
4514
+ // painted over by the theme banding.
4515
+ tableStyleId: input2.style === "none" ? void 0 : input2.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
4194
4516
  };
4195
4517
  return {
4196
4518
  type: "table",
@@ -4308,6 +4630,9 @@ var init_ElementFactory = __esm({
4308
4630
  init_custom_geometry();
4309
4631
  init_chart_gradient_input();
4310
4632
  init_chart_layout_operations();
4633
+ init_table_cell_input();
4634
+ init_table_merge_input();
4635
+ init_text_segment_style();
4311
4636
  init_shape_style_input();
4312
4637
  idCounter = 0;
4313
4638
  DEFAULTS = {
@@ -34708,8 +35033,8 @@ var init_smartart_layout_interpreter_cycle_ring_nested_hub = __esm({
34708
35033
 
34709
35034
  // diagram/layout/smartart-layout-interpreter-cycle-ring-offset.ts
34710
35035
  function resolveRingAxisOffset(dimension2, boundSize, scale, values) {
34711
- const span = Math.max(1e-9, Math.max(...values) - Math.min(...values));
34712
- const epsilon = span * TIE_EPSILON_FRACTION;
35036
+ const span2 = Math.max(1e-9, Math.max(...values) - Math.min(...values));
35037
+ const epsilon = span2 * TIE_EPSILON_FRACTION;
34713
35038
  const minValue = Math.min(...values);
34714
35039
  const maxValue = Math.max(...values);
34715
35040
  const lowCount = values.filter((v) => v - minValue <= epsilon).length;
@@ -37005,8 +37330,8 @@ function centeredAxisPitch(dimension2, itemSize, gapRatio, count2) {
37005
37330
  const n = Math.max(1, count2);
37006
37331
  const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
37007
37332
  const pitch = itemSize + gap;
37008
- const span = n * itemSize + Math.max(0, n - 1) * gap;
37009
- const shift = (dimension2 - span) / 2;
37333
+ const span2 = n * itemSize + Math.max(0, n - 1) * gap;
37334
+ const shift = (dimension2 - span2) / 2;
37010
37335
  return { pitch, shift };
37011
37336
  }
37012
37337
  function compositeFanPitch(dimension2, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
@@ -47679,7 +48004,7 @@ var init_patch = __esm({
47679
48004
  init_xml2();
47680
48005
  XMLNS = "http://www.w3.org/2000/xmlns/";
47681
48006
  escapeText = (text2) => text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;");
47682
- qualifiedName = (xml, span) => /^<([^\s/>]+)/.exec(xml.slice(span.start, span.openEnd))?.[1] ?? "";
48007
+ qualifiedName = (xml, span2) => /^<([^\s/>]+)/.exec(xml.slice(span2.start, span2.openEnd))?.[1] ?? "";
47683
48008
  PartPatch = class {
47684
48009
  constructor(xml, rootElement) {
47685
48010
  this.xml = xml;
@@ -47706,9 +48031,9 @@ var init_patch = __esm({
47706
48031
  this.edits.push({ start, end, text: text2, seq: this.seq++ });
47707
48032
  }
47708
48033
  span(element2) {
47709
- const span = this.spans.get(element2);
47710
- if (!span) throw new Error("Element is not a child of the patched root");
47711
- return span;
48034
+ const span2 = this.spans.get(element2);
48035
+ if (!span2) throw new Error("Element is not a child of the patched root");
48036
+ return span2;
47712
48037
  }
47713
48038
  /** The prefix bound to `ns` on the root, declaring `preferred` for it when none is. */
47714
48039
  prefix(ns, preferred) {
@@ -47728,20 +48053,20 @@ var init_patch = __esm({
47728
48053
  }
47729
48054
  /** Replaces the element's content, keeping its start tag (and attributes) as written. */
47730
48055
  setContent(element2, content2) {
47731
- const span = this.span(element2);
47732
- if (span.selfClosing)
47733
- this.add(span.openEnd - 2, span.openEnd, `>${content2}</${qualifiedName(this.xml, span)}>`);
47734
- else this.add(span.openEnd, span.closeStart, content2);
48056
+ const span2 = this.span(element2);
48057
+ if (span2.selfClosing)
48058
+ this.add(span2.openEnd - 2, span2.openEnd, `>${content2}</${qualifiedName(this.xml, span2)}>`);
48059
+ else this.add(span2.openEnd, span2.closeStart, content2);
47735
48060
  }
47736
48061
  /** Adds ` name="value"` text to the element's start tag. */
47737
48062
  addAttribute(element2, attribute7) {
47738
- const span = this.span(element2);
47739
- const at2 = span.openEnd - (span.selfClosing ? 2 : 1);
48063
+ const span2 = this.span(element2);
48064
+ const at2 = span2.openEnd - (span2.selfClosing ? 2 : 1);
47740
48065
  this.add(at2, at2, attribute7);
47741
48066
  }
47742
48067
  remove(element2) {
47743
- const span = this.span(element2);
47744
- this.add(span.start, span.end, "");
48068
+ const span2 = this.span(element2);
48069
+ this.add(span2.start, span2.end, "");
47745
48070
  }
47746
48071
  /** Inserts `markup` before `before`, or as the root's last child. */
47747
48072
  insert(markup, before) {
@@ -68194,8 +68519,8 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
68194
68519
  }
68195
68520
  continue;
68196
68521
  }
68197
- const span = oldText.slice(start, end);
68198
- if (span.length !== mention.length) {
68522
+ const span2 = oldText.slice(start, end);
68523
+ if (span2.length !== mention.length) {
68199
68524
  continue;
68200
68525
  }
68201
68526
  let next = -1;
@@ -68204,11 +68529,11 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
68204
68529
  } else if (start >= changeEnd) {
68205
68530
  next = start + delta2;
68206
68531
  }
68207
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
68532
+ if (next >= 0 && newText.slice(next, next + mention.length) === span2) {
68208
68533
  result.push(next === start ? mention : { ...mention, startIndex: next });
68209
68534
  continue;
68210
68535
  }
68211
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
68536
+ const relocated = nearestOccurrence(newText, span2, next >= 0 ? next : start);
68212
68537
  if (relocated >= 0) {
68213
68538
  result.push({ ...mention, startIndex: relocated });
68214
68539
  }
@@ -68268,17 +68593,17 @@ var init_modern_comment_mentions = __esm({
68268
68593
  }
68269
68594
  return index2;
68270
68595
  };
68271
- nearestOccurrence = (text2, span, hint) => {
68596
+ nearestOccurrence = (text2, span2, hint) => {
68272
68597
  let best = -1;
68273
68598
  let bestDistance = Number.POSITIVE_INFINITY;
68274
- let at2 = text2.indexOf(span);
68599
+ let at2 = text2.indexOf(span2);
68275
68600
  while (at2 !== -1) {
68276
68601
  const distance = Math.abs(at2 - hint);
68277
68602
  if (distance < bestDistance) {
68278
68603
  best = at2;
68279
68604
  bestDistance = distance;
68280
68605
  }
68281
- at2 = text2.indexOf(span, at2 + 1);
68606
+ at2 = text2.indexOf(span2, at2 + 1);
68282
68607
  }
68283
68608
  return best;
68284
68609
  };
@@ -74795,6 +75120,10 @@ function applyCellFillStyle(cellProperties, style, context, slidePath) {
74795
75120
  }
74796
75121
  return hasStyle;
74797
75122
  }
75123
+ function presetDashValue(value) {
75124
+ const text2 = typeof value === "string" || typeof value === "number" ? String(value) : "";
75125
+ return text2 ? text2 : void 0;
75126
+ }
74798
75127
  function applyCellBorderStyle(cellProperties, style, context) {
74799
75128
  if (!cellProperties) {
74800
75129
  return false;
@@ -74832,13 +75161,13 @@ function applyCellBorderStyle(cellProperties, style, context) {
74832
75161
  style[`${prefix}Color`] = color3;
74833
75162
  hasStyle = true;
74834
75163
  }
74835
- const prstDash = node2["a:prstDash"];
74836
- if (prstDash) {
74837
- const dashVal = String(prstDash["@_val"] || "");
74838
- if (dashVal) {
74839
- style[`${prefix}Dash`] = dashVal;
74840
- hasStyle = true;
75164
+ const dash = parseDrawingLineDash(node2, presetDashValue);
75165
+ if (dash.strokeDash) {
75166
+ style[`${prefix}Dash`] = dash.strokeDash;
75167
+ if (dash.strokeDash === "custom") {
75168
+ style[`${prefix}DashSegments`] = dash.customDashSegments;
74841
75169
  }
75170
+ hasStyle = true;
74842
75171
  }
74843
75172
  }
74844
75173
  const firstBorderColor = style.borderTopColor || style.borderBottomColor || style.borderLeftColor || style.borderRightColor;
@@ -74930,6 +75259,7 @@ var init_table_cell_fill_border_helpers = __esm({
74930
75259
  "pptx/core/core/builders/table-cell-fill-border-helpers.ts"() {
74931
75260
  init_theme_color_ref();
74932
75261
  init_color_xml_preservation();
75262
+ init_drawing_line_dash();
74933
75263
  }
74934
75264
  });
74935
75265
 
@@ -105661,14 +105991,14 @@ function valXml(local, value) {
105661
105991
  const text2 = typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? chartNumber(value) : escapeAttribute(value);
105662
105992
  return `<c:${local} val="${text2}"/>`;
105663
105993
  }
105664
- function sameValue(left, right) {
105994
+ function sameValue2(left, right) {
105665
105995
  if (left === right) return true;
105666
105996
  if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
105667
105997
  if (Array.isArray(left) !== Array.isArray(right)) return false;
105668
105998
  const entries = (value) => Object.entries(value).filter(([, item2]) => item2 !== void 0);
105669
105999
  const a = entries(left);
105670
106000
  const b = new Map(entries(right));
105671
- return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue(item2, b.get(key2)));
106001
+ return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue2(item2, b.get(key2)));
105672
106002
  }
105673
106003
  var INVALID_XML, escapeText2, escapeAttribute, elementXml2, raw;
105674
106004
  var init_write_util = __esm({
@@ -106414,13 +106744,13 @@ function chartFillXml(fill3) {
106414
106744
  }
106415
106745
  function patchShape(root, shape2, read) {
106416
106746
  const doc = root.ownerDocument;
106417
- if (!sameValue(read.fill, shape2.fill)) {
106747
+ if (!sameValue2(read.fill, shape2.fill)) {
106418
106748
  const xml = shape2.fill && chartFillXml(shape2.fill);
106419
106749
  if (xml) setDrawingFillXml(root, xml);
106420
106750
  else if (!shape2.fill)
106421
106751
  for (let fill3 = fillElementOf(root); fill3; fill3 = fillElementOf(root)) root.removeChild(fill3);
106422
106752
  }
106423
- if (!sameValue(read.line, shape2.line)) {
106753
+ if (!sameValue2(read.line, shape2.line)) {
106424
106754
  let ln = first(root, "ln", NS.a);
106425
106755
  if (!shape2.line) {
106426
106756
  if (ln) root.removeChild(ln);
@@ -106452,7 +106782,7 @@ function shapePropertiesInnerXml(context, shape2) {
106452
106782
  if (sourceXml !== void 0) {
106453
106783
  const root = wrap("spPr", sourceXml);
106454
106784
  const read = readShapeFields(root);
106455
- if (sameValue(read, fields)) inner = sourceXml;
106785
+ if (sameValue2(read, fields)) inner = sourceXml;
106456
106786
  else {
106457
106787
  patchShape(root, fields, read);
106458
106788
  inner = innerXml(root);
@@ -106467,14 +106797,14 @@ function textBodyInnerXml(context, body) {
106467
106797
  const { sourceXml, ...fields } = body;
106468
106798
  if (sourceXml !== void 0) {
106469
106799
  const read = parseDrawingTextBody(wrap("txPr", sourceXml));
106470
- if (sameValue(read, fields)) return raw(context, sourceXml);
106800
+ if (sameValue2(read, fields)) return raw(context, sourceXml);
106471
106801
  }
106472
106802
  return raw(context, writeTextBody(fields));
106473
106803
  }
106474
106804
  function layoutXml(context, value) {
106475
106805
  if (!value) return "";
106476
106806
  const { sourceXml, ...layout } = value;
106477
- if (sourceXml !== void 0 && sameValue(readLayoutFields(wrap("layout", sourceXml)), layout))
106807
+ if (sourceXml !== void 0 && sameValue2(readLayoutFields(wrap("layout", sourceXml)), layout))
106478
106808
  return elementXml2("layout", raw(context, sourceXml));
106479
106809
  const manual = LAYOUT_FIELDS.map(([local, key2]) => {
106480
106810
  const value2 = layout[key2];
@@ -109764,7 +110094,16 @@ function repaintSeriesForFamily(series, toLine) {
109764
110094
  shape2.fill = structuredClone(shape2.line.fill);
109765
110095
  }
109766
110096
  function clearPointPaint(series, key2) {
109767
- for (const point2 of series.dataPoints) if (point2.spPr) delete point2.spPr[key2];
110097
+ const emptied2 = (part) => Object.keys(part).every((name) => name === "sourceXml");
110098
+ for (const point2 of series.dataPoints) {
110099
+ if (!point2.spPr) continue;
110100
+ delete point2.spPr[key2];
110101
+ if (point2.spPr.line && emptied2(point2.spPr.line)) delete point2.spPr.line;
110102
+ if (emptied2(point2.spPr)) delete point2.spPr;
110103
+ }
110104
+ series.dataPoints = series.dataPoints.filter(
110105
+ (point2) => Object.keys(point2).some((name) => name !== "index")
110106
+ );
109768
110107
  }
109769
110108
  function setChartSeriesFill(space, index2, fill3) {
109770
110109
  return editChartSpace(space, (draft) => {
@@ -109773,7 +110112,7 @@ function setChartSeriesFill(space, index2, fill3) {
109773
110112
  clearPointPaint(series, "fill");
109774
110113
  });
109775
110114
  }
109776
- function setChartSeriesColor(space, index2, color3) {
110115
+ function setChartSeriesColor(space, index2, color3, options2 = {}) {
109777
110116
  return editChartSpace(space, (draft) => {
109778
110117
  const { series } = chartSeriesEntryAt(draft, index2);
109779
110118
  const shape2 = series.spPr ??= {};
@@ -109783,7 +110122,7 @@ function setChartSeriesColor(space, index2, color3) {
109783
110122
  const fill3 = color3 ? { kind: "solid", color: withAlphaOf(color3, previous) } : void 0;
109784
110123
  if (line2) assignOrDelete(shape2.line ??= {}, "fill", fill3);
109785
110124
  else assignOrDelete(shape2, "fill", fill3);
109786
- clearPointPaint(series, line2 ? "line" : "fill");
110125
+ if (!options2.keepPointColors) clearPointPaint(series, line2 ? "line" : "fill");
109787
110126
  });
109788
110127
  }
109789
110128
  var paintsLine, painted;
@@ -113003,44 +113342,6 @@ var init_chart2 = __esm({
113003
113342
  }
113004
113343
  });
113005
113344
 
113006
- // pptx/core/utils/chart-container-type-map.ts
113007
- function chartContainerLocalNameToType(localName28) {
113008
- return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
113009
- }
113010
- function isLineDrawnChartType(type) {
113011
- return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
113012
- }
113013
- var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
113014
- var init_chart_container_type_map = __esm({
113015
- "pptx/core/utils/chart-container-type-map.ts"() {
113016
- CONTAINER_LOCAL_NAME_TO_TYPE = {
113017
- barChart: "bar",
113018
- bar3DChart: "bar3D",
113019
- lineChart: "line",
113020
- line3DChart: "line3D",
113021
- pieChart: "pie",
113022
- pie3DChart: "pie3D",
113023
- ofPieChart: "ofPie",
113024
- doughnutChart: "doughnut",
113025
- areaChart: "area",
113026
- area3DChart: "area3D",
113027
- scatterChart: "scatter",
113028
- bubbleChart: "bubble",
113029
- radarChart: "radar",
113030
- stockChart: "stock",
113031
- surfaceChart: "surface",
113032
- surface3DChart: "surface"
113033
- };
113034
- LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
113035
- "line",
113036
- "line3D",
113037
- "scatter",
113038
- "radar",
113039
- "stock"
113040
- ]);
113041
- }
113042
- });
113043
-
113044
113345
  // pptx/core/utils/chart-from-neutral-labels.ts
113045
113346
  function setOrRemove(target, key2, value) {
113046
113347
  if (value === void 0) delete target[key2];
@@ -120368,16 +120669,16 @@ function tableToShapeGroup(tableData, bounds) {
120368
120669
  const y = bounds.y + rowIndex * rowHeightEmu;
120369
120670
  let colIndex = 0;
120370
120671
  for (const cell2 of row.cells) {
120371
- const span = Math.max(1, cell2.gridSpan ?? 1);
120672
+ const span2 = Math.max(1, cell2.gridSpan ?? 1);
120372
120673
  if (cell2.vMerge) {
120373
120674
  vMergeActive[colIndex] = true;
120374
- colIndex += span;
120675
+ colIndex += span2;
120375
120676
  continue;
120376
120677
  }
120377
120678
  vMergeActive[colIndex] = false;
120378
120679
  if (!cell2.hMerge) {
120379
120680
  const x = colStartX[colIndex] ?? bounds.x;
120380
- const w = colEmuWidths.slice(colIndex, colIndex + span).reduce((s, v) => s + v, 0);
120681
+ const w = colEmuWidths.slice(colIndex, colIndex + span2).reduce((s, v) => s + v, 0);
120381
120682
  children16.push({
120382
120683
  kind: "shape",
120383
120684
  spt: 1,
@@ -120391,7 +120692,7 @@ function tableToShapeGroup(tableData, bounds) {
120391
120692
  text: { textType: 4, paragraphs: cellParagraphs(cell2.text) }
120392
120693
  });
120393
120694
  }
120394
- colIndex += span;
120695
+ colIndex += span2;
120395
120696
  }
120396
120697
  });
120397
120698
  return { kind: "group", anchor: bounds, children: children16 };
@@ -130772,6 +131073,10 @@ var init_chart_neutral_save_chrome = __esm({
130772
131073
  });
130773
131074
 
130774
131075
  // pptx/core/utils/chart-neutral-save-points.ts
131076
+ function pointShape(shape2) {
131077
+ if (shape2.line && emptied(shape2.line)) delete shape2.line;
131078
+ return emptied(shape2) ? null : shape2;
131079
+ }
130775
131080
  function pointEdit(edits, seriesIndex, old, next) {
130776
131081
  for (const key2 of ["picture", "impliedPicture", "uniqueId"])
130777
131082
  if (!same6(old?.[key2], next[key2])) return false;
@@ -130794,6 +131099,7 @@ function pointEdit(edits, seriesIndex, old, next) {
130794
131099
  ) ?? null
130795
131100
  });
130796
131101
  }
131102
+ if (edit.spPr) edit.spPr = pointShape(edit.spPr);
130797
131103
  if (!same6(old?.marker, next.marker)) {
130798
131104
  if (!next.marker) edit.marker = null;
130799
131105
  else {
@@ -130836,6 +131142,7 @@ function planNeutralChartPoints(before, probe, edits) {
130836
131142
  series.dataPoints = previous.dataPoints;
130837
131143
  });
130838
131144
  }
131145
+ var emptied;
130839
131146
  var init_chart_neutral_save_points = __esm({
130840
131147
  "pptx/core/utils/chart-neutral-save-points.ts"() {
130841
131148
  init_chart2();
@@ -130843,6 +131150,7 @@ var init_chart_neutral_save_points = __esm({
130843
131150
  init_chart_neutral_save_common();
130844
131151
  init_chart_neutral_save_shape();
130845
131152
  init_chart_container_type_map();
131153
+ emptied = (part) => Object.keys(part).every((key2) => key2 === "sourceXml");
130846
131154
  }
130847
131155
  });
130848
131156
 
@@ -131058,7 +131366,9 @@ function planNeutralChartSeriesColors(before, probe, edits) {
131058
131366
  const value = series.color?.replace(/^#/, "");
131059
131367
  if (value !== void 0 && !/^[\da-f]{6}$/i.test(value)) return;
131060
131368
  edits.push(
131061
- (space) => setChartSeriesColor(space, index2, value ? { kind: "srgb", value, transforms: [] } : null)
131369
+ (space) => setChartSeriesColor(space, index2, value ? { kind: "srgb", value, transforms: [] } : null, {
131370
+ keepPointColors: true
131371
+ })
131062
131372
  );
131063
131373
  if (previous.color === void 0) delete series.color;
131064
131374
  else series.color = previous.color;
@@ -134174,8 +134484,8 @@ function renderBars(element2, x, y, w, h2) {
134174
134484
  const values = chartValues(element2);
134175
134485
  const min = Math.min(0, ...values);
134176
134486
  const max = Math.max(0, ...values);
134177
- const span = max - min || 1;
134178
- const zeroY = y + max / span * h2;
134487
+ const span2 = max - min || 1;
134488
+ const zeroY = y + max / span2 * h2;
134179
134489
  const categoryCount = Math.max(
134180
134490
  data.categories.length,
134181
134491
  ...data.series.map((s) => s.values.length),
@@ -134186,7 +134496,7 @@ function renderBars(element2, x, y, w, h2) {
134186
134496
  const parts = [`<line x1="${x}" y1="${zeroY}" x2="${x + w}" y2="${zeroY}" stroke="#666666" />`];
134187
134497
  data.series.forEach((series, seriesIndex) => {
134188
134498
  series.values.forEach((value, categoryIndex) => {
134189
- const valueY = y + (max - value) / span * h2;
134499
+ const valueY = y + (max - value) / span2 * h2;
134190
134500
  parts.push(
134191
134501
  `<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))}" />`
134192
134502
  );
@@ -134199,10 +134509,10 @@ function renderLines(element2, x, y, w, h2) {
134199
134509
  const values = chartValues(element2);
134200
134510
  const min = Math.min(...values);
134201
134511
  const max = Math.max(...values);
134202
- const span = max - min || 1;
134512
+ const span2 = max - min || 1;
134203
134513
  return data.series.map((series, seriesIndex) => {
134204
134514
  const denominator = Math.max(series.values.length - 1, 1);
134205
- const points7 = series.values.map((value, index2) => `${x + index2 / denominator * w},${y + (max - value) / span * h2}`).join(" ");
134515
+ const points7 = series.values.map((value, index2) => `${x + index2 / denominator * w},${y + (max - value) / span2 * h2}`).join(" ");
134206
134516
  return `<polyline data-chart-mark="line" points="${points7}" fill="none" stroke="${esc3(color2(series, seriesIndex))}" stroke-width="2" />`;
134207
134517
  }).join("");
134208
134518
  }
@@ -139238,6 +139548,17 @@ var init_save_group_fill = __esm({
139238
139548
  });
139239
139549
 
139240
139550
  // pptx/core/core/runtime/save-shape-xml-frames.ts
139551
+ function tableGridXml(el, widthEmu) {
139552
+ const fractions = el.tableData?.columnWidths ?? [];
139553
+ if (fractions.length === 0 || !(widthEmu > 0)) {
139554
+ return {};
139555
+ }
139556
+ const widths = fractions.map((fraction) => Math.max(0, Math.round(fraction * widthEmu)));
139557
+ const last = widths.length - 1;
139558
+ widths[last] = Math.max(0, (widths[last] ?? 0) + widthEmu - widths.reduce((a, b) => a + b, 0));
139559
+ const cols = widths.map((w) => ({ "@_w": String(w) }));
139560
+ return { "a:gridCol": cols.length === 1 ? cols[0] : cols };
139561
+ }
139241
139562
  function buildTableGraphicFrameXml(el, emuPerPx) {
139242
139563
  el.locks = { noGrouping: true, ...el.locks };
139243
139564
  const offX = String(Math.round(el.x * emuPerPx));
@@ -139268,7 +139589,7 @@ function buildTableGraphicFrameXml(el, emuPerPx) {
139268
139589
  "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
139269
139590
  "a:tbl": {
139270
139591
  "a:tblPr": tblPr,
139271
- "a:tblGrid": {}
139592
+ "a:tblGrid": tableGridXml(el, Number(extCx))
139272
139593
  }
139273
139594
  }
139274
139595
  }
@@ -141491,12 +141812,92 @@ var init_PptxHandlerRuntimeLayoutSwitching = __esm({
141491
141812
  }
141492
141813
  });
141493
141814
 
141815
+ // pptx/core/core/runtime/table-cell-border-save.ts
141816
+ function cellEdges(style) {
141817
+ return [
141818
+ {
141819
+ xmlKey: "a:lnT",
141820
+ width: style.borderTopWidth,
141821
+ color: style.borderTopColor,
141822
+ dash: style.borderTopDash,
141823
+ segments: style.borderTopDashSegments
141824
+ },
141825
+ {
141826
+ xmlKey: "a:lnB",
141827
+ width: style.borderBottomWidth,
141828
+ color: style.borderBottomColor,
141829
+ dash: style.borderBottomDash,
141830
+ segments: style.borderBottomDashSegments
141831
+ },
141832
+ {
141833
+ xmlKey: "a:lnL",
141834
+ width: style.borderLeftWidth,
141835
+ color: style.borderLeftColor,
141836
+ dash: style.borderLeftDash,
141837
+ segments: style.borderLeftDashSegments
141838
+ },
141839
+ {
141840
+ xmlKey: "a:lnR",
141841
+ width: style.borderRightWidth,
141842
+ color: style.borderRightColor,
141843
+ dash: style.borderRightDash,
141844
+ segments: style.borderRightDashSegments
141845
+ }
141846
+ ];
141847
+ }
141848
+ function writeEdgeDash(ln, edge) {
141849
+ if (edge.dash === void 0 || edge.dash === "") {
141850
+ return;
141851
+ }
141852
+ if (edge.dash === "solid") {
141853
+ delete ln["a:prstDash"];
141854
+ delete ln["a:custDash"];
141855
+ return;
141856
+ }
141857
+ if (edge.dash === "custom") {
141858
+ if (edge.segments && edge.segments.length > 0) {
141859
+ applyDrawingLineDash(ln, { strokeDash: "custom", customDashSegments: edge.segments });
141860
+ }
141861
+ return;
141862
+ }
141863
+ applyDrawingLineDash(ln, { strokeDash: edge.dash });
141864
+ }
141865
+ function writeCellEdgeBorders(tcPr, style, emuPerPx) {
141866
+ for (const edge of cellEdges(style)) {
141867
+ if (edge.width === void 0 && edge.color === void 0 && edge.dash === void 0) {
141868
+ continue;
141869
+ }
141870
+ const existing = tcPr[edge.xmlKey];
141871
+ const ln = existing && typeof existing === "object" ? existing : {};
141872
+ if (edge.width !== void 0) {
141873
+ ln["@_w"] = String(Math.round(edge.width * emuPerPx));
141874
+ }
141875
+ if (edge.color) {
141876
+ delete ln["a:noFill"];
141877
+ delete ln["a:gradFill"];
141878
+ delete ln["a:pattFill"];
141879
+ ln["a:solidFill"] = {
141880
+ "a:srgbClr": { "@_val": edge.color.replace("#", "") }
141881
+ };
141882
+ }
141883
+ writeEdgeDash(ln, edge);
141884
+ tcPr[edge.xmlKey] = reorderObjectKeys(ln, LN_CHILD_ORDER);
141885
+ }
141886
+ }
141887
+ var init_table_cell_border_save = __esm({
141888
+ "pptx/core/core/runtime/table-cell-border-save.ts"() {
141889
+ init_drawing_line_dash();
141890
+ init_xml_reorder();
141891
+ }
141892
+ });
141893
+
141494
141894
  // pptx/core/core/runtime/table-cell-save-helpers.ts
141495
141895
  function writeCellFill(tcPr, style, resolveColorXml) {
141496
141896
  if (style.fillMode === "gradient" && style.gradientFillStops && style.gradientFillStops.length > 0) {
141497
141897
  delete tcPr["a:solidFill"];
141498
141898
  delete tcPr["a:pattFill"];
141499
141899
  delete tcPr["a:blipFill"];
141900
+ delete tcPr["a:noFill"];
141500
141901
  const stops = style.gradientFillStops.map((stop) => {
141501
141902
  const posRaw = typeof stop.position === "number" ? stop.position : 0;
141502
141903
  const position4 = Math.round(Math.max(0, Math.min(1, posRaw / 100)) * 1e5);
@@ -141548,6 +141949,7 @@ function writeCellFill(tcPr, style, resolveColorXml) {
141548
141949
  delete tcPr["a:solidFill"];
141549
141950
  delete tcPr["a:gradFill"];
141550
141951
  delete tcPr["a:blipFill"];
141952
+ delete tcPr["a:noFill"];
141551
141953
  const pattXml = {
141552
141954
  "@_prst": style.patternFillPreset
141553
141955
  };
@@ -141571,10 +141973,12 @@ function writeCellFill(tcPr, style, resolveColorXml) {
141571
141973
  delete tcPr["a:gradFill"];
141572
141974
  delete tcPr["a:pattFill"];
141573
141975
  delete tcPr["a:blipFill"];
141976
+ tcPr["a:noFill"] = tcPr["a:noFill"] ?? {};
141574
141977
  } else if (style.fillMode !== "image" && style.backgroundColor) {
141575
141978
  delete tcPr["a:gradFill"];
141576
141979
  delete tcPr["a:pattFill"];
141577
141980
  delete tcPr["a:blipFill"];
141981
+ delete tcPr["a:noFill"];
141578
141982
  const resolvedOriginal = style.backgroundColorXml && resolveColorXml ? resolveColorXml(style.backgroundColorXml) : void 0;
141579
141983
  tcPr["a:solidFill"] = serializeColorChoiceWithRef(
141580
141984
  style.backgroundColorRef,
@@ -141805,6 +142209,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
141805
142209
  init_xml_access();
141806
142210
  init_xml_reorder();
141807
142211
  init_PptxHandlerRuntimeLayoutSwitching();
142212
+ init_table_cell_border_save();
141808
142213
  init_table_cell_save_helpers();
141809
142214
  init_table_cell_text_xml();
141810
142215
  PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime21 {
@@ -141882,53 +142287,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
141882
142287
  pPr["@_algn"] = token3;
141883
142288
  }
141884
142289
  }
141885
- const borderEdges = [
141886
- {
141887
- xmlKey: "a:lnT",
141888
- width: style.borderTopWidth,
141889
- color: style.borderTopColor,
141890
- dash: style.borderTopDash
141891
- },
141892
- {
141893
- xmlKey: "a:lnB",
141894
- width: style.borderBottomWidth,
141895
- color: style.borderBottomColor,
141896
- dash: style.borderBottomDash
141897
- },
141898
- {
141899
- xmlKey: "a:lnL",
141900
- width: style.borderLeftWidth,
141901
- color: style.borderLeftColor,
141902
- dash: style.borderLeftDash
141903
- },
141904
- {
141905
- xmlKey: "a:lnR",
141906
- width: style.borderRightWidth,
141907
- color: style.borderRightColor,
141908
- dash: style.borderRightDash
141909
- }
141910
- ];
141911
- for (const edge of borderEdges) {
141912
- if (edge.width !== void 0 || edge.color !== void 0 || edge.dash !== void 0) {
141913
- if (!tcPr[edge.xmlKey]) {
141914
- tcPr[edge.xmlKey] = {};
141915
- }
141916
- const ln = tcPr[edge.xmlKey];
141917
- if (edge.width !== void 0) {
141918
- ln["@_w"] = String(Math.round(edge.width * _PptxHandlerRuntime.EMU_PER_PX));
141919
- }
141920
- if (edge.color) {
141921
- ln["a:solidFill"] = {
141922
- "a:srgbClr": { "@_val": edge.color.replace("#", "") }
141923
- };
141924
- }
141925
- if (edge.dash && edge.dash !== "solid") {
141926
- ln["a:prstDash"] = { "@_val": edge.dash };
141927
- } else if (edge.dash === "solid") {
141928
- delete ln["a:prstDash"];
141929
- }
141930
- }
141931
- }
142290
+ writeCellEdgeBorders(tcPr, style, _PptxHandlerRuntime.EMU_PER_PX);
141932
142291
  const emuPerPx = _PptxHandlerRuntime.EMU_PER_PX;
141933
142292
  if (style.marginLeft !== void 0) {
141934
142293
  tcPr["@_marL"] = String(Math.round(style.marginLeft * emuPerPx));
@@ -142363,10 +142722,13 @@ var init_table_style_change_cell_clear = __esm({
142363
142722
  "a:grpFill"
142364
142723
  ];
142365
142724
  LINE_KEYS = [
142366
- ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
142367
- ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
142368
- ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
142369
- ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
142725
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash", "borderLeftDashSegments"]],
142726
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash", "borderRightDashSegments"]],
142727
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash", "borderTopDashSegments"]],
142728
+ [
142729
+ "a:lnB",
142730
+ ["borderBottomWidth", "borderBottomColor", "borderBottomDash", "borderBottomDashSegments"]
142731
+ ],
142370
142732
  ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
142371
142733
  ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
142372
142734
  ];
@@ -142706,8 +143068,8 @@ function cells(row) {
142706
143068
  return ensureArray19(row["a:tc"]);
142707
143069
  }
142708
143070
  function promoteTextBody(source2, next, removed, survivor, axis) {
142709
- const span = axis === "row" ? "rowSpan" : "gridSpan";
142710
- 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) {
143071
+ const span2 = axis === "row" ? "rowSpan" : "gridSpan";
143072
+ 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) {
142711
143073
  return;
142712
143074
  }
142713
143075
  if (removed["a:txBody"] !== void 0) {
@@ -176386,8 +176748,8 @@ function updateIntersectingMerges(source2, rows, edit) {
176386
176748
  const rowSpan = anchor2.rowSpan ?? 1;
176387
176749
  const gridSpan = anchor2.gridSpan ?? 1;
176388
176750
  const start = isRowEdit ? rowIndex : columnIndex;
176389
- const span = isRowEdit ? rowSpan : gridSpan;
176390
- if (edit.index < start || edit.index >= start + span || (inserting ? edit.index === start : span === 1)) {
176751
+ const span2 = isRowEdit ? rowSpan : gridSpan;
176752
+ if (edit.index < start || edit.index >= start + span2 || (inserting ? edit.index === start : span2 === 1)) {
176391
176753
  continue;
176392
176754
  }
176393
176755
  if (!Number.isInteger(rowSpan) || !Number.isInteger(gridSpan) || rowSpan < 1 || gridSpan < 1 || rowIndex + rowSpan > source2.rows.length || columnIndex + gridSpan > source2.columnWidths.length) {