ooxml-core 1.44.0 → 1.46.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 (93) hide show
  1. package/dist/PptxHandler-FZ43IJFP.mjs +5 -0
  2. package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-HWEOIHEA.mjs} +2 -2
  3. package/dist/PptxHandler-XAUKKK36.cjs +14 -0
  4. package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-2BCCMZW7.cjs} +6 -6
  5. package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-66RV4F45.mjs} +2 -2
  6. package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-AFD72LIG.mjs} +3 -3
  7. package/dist/automation/index.cjs +22 -8
  8. package/dist/automation/index.mjs +22 -8
  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/edit/group-options.d.ts +4 -0
  12. package/dist/chart/edit/group-options.d.ts.map +1 -1
  13. package/dist/chart/edit/new-chart-minimal.d.ts +13 -0
  14. package/dist/chart/edit/new-chart-minimal.d.ts.map +1 -0
  15. package/dist/chart/edit/new-chart.d.ts +34 -1
  16. package/dist/chart/edit/new-chart.d.ts.map +1 -1
  17. package/dist/chart/edit/secondary-axis.d.ts +8 -1
  18. package/dist/chart/edit/secondary-axis.d.ts.map +1 -1
  19. package/dist/chart/edit/type.d.ts +2 -0
  20. package/dist/chart/edit/type.d.ts.map +1 -1
  21. package/dist/chart/index.cjs +426 -266
  22. package/dist/chart/index.mjs +424 -267
  23. package/dist/{chunk-3J6VIKLP.cjs → chunk-5TOVSCVT.cjs} +3 -3
  24. package/dist/{chunk-4LEVL6ZW.mjs → chunk-E2TTMUKU.mjs} +681 -142
  25. package/dist/{chunk-7T3SJQA6.cjs → chunk-E5TGYYKO.cjs} +1 -0
  26. package/dist/{chunk-VKFKEVHK.mjs → chunk-EI6555OK.mjs} +1 -1
  27. package/dist/{chunk-R7NS42KQ.mjs → chunk-FKU2Z6ZB.mjs} +1 -1
  28. package/dist/{chunk-243ZYX2B.mjs → chunk-G6LEU3Y5.mjs} +1 -1
  29. package/dist/{chunk-JHYU7HGG.mjs → chunk-H43QQVJU.mjs} +1 -1
  30. package/dist/{chunk-HLYOHD2Z.mjs → chunk-HH3AYM63.mjs} +664 -146
  31. package/dist/{chunk-RNZQ2OU4.cjs → chunk-IBRV3AK3.cjs} +1930 -1412
  32. package/dist/{chunk-WEAWSXUX.mjs → chunk-L6MJGE3Q.mjs} +4 -4
  33. package/dist/{chunk-IPV3J3I5.mjs → chunk-LXVE2VKR.mjs} +4 -1
  34. package/dist/{chunk-QZPOPUI5.cjs → chunk-QUAFASFC.cjs} +4 -0
  35. package/dist/{chunk-XTUX5RMG.cjs → chunk-T4BVZTII.cjs} +9 -9
  36. package/dist/{chunk-KCDLTVUI.mjs → chunk-X2DC7XRL.mjs} +17 -16
  37. package/dist/{chunk-OORQCSVA.mjs → chunk-ZLUHU2SU.mjs} +1 -0
  38. package/dist/docx/index.cjs +300 -144
  39. package/dist/docx/index.mjs +300 -144
  40. package/dist/index.cjs +496 -336
  41. package/dist/index.mjs +496 -336
  42. package/dist/pptx/automation/index.cjs +879 -310
  43. package/dist/pptx/automation/index.d.ts +6 -6
  44. package/dist/pptx/automation/index.mjs +5 -5
  45. package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
  46. package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
  47. package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-BPGaFlm5.d.ts} +6 -6
  48. package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-BPGaFlm5.d.ts.map} +1 -1
  49. package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-D4-WJQ1r.d.ts} +4 -4
  50. package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-D4-WJQ1r.d.ts.map} +1 -1
  51. package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DtFoPmk7.d.ts} +108 -10
  52. package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +1 -0
  53. package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
  54. package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
  55. package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-CVHXOSit.d.ts} +19 -4
  56. package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-CVHXOSit.d.ts.map} +1 -1
  57. package/dist/pptx/cli/index.cjs +832 -263
  58. package/dist/pptx/cli/index.d.ts +1 -1
  59. package/dist/pptx/cli/index.mjs +4 -4
  60. package/dist/pptx/converter/index.cjs +1 -0
  61. package/dist/pptx/converter/index.d.ts +1 -1
  62. package/dist/pptx/converter/index.mjs +2 -2
  63. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +4 -4
  64. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +2 -2
  65. package/dist/pptx/editor/render/collaboration-reconcile.cjs +8 -8
  66. package/dist/pptx/editor/render/collaboration-reconcile.mjs +2 -2
  67. package/dist/pptx/editor/render/collaboration-sync.cjs +14 -14
  68. package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
  69. package/dist/pptx/editor/render/collaboration-sync.mjs +1 -1
  70. package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
  71. package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
  72. package/dist/pptx/editor/render/find-replace.cjs +15 -15
  73. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  74. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  75. package/dist/pptx/editor/render/slide-operations.cjs +9 -9
  76. package/dist/pptx/editor/render/slide-operations.mjs +3 -3
  77. package/dist/pptx/editor/render/table-layout.d.ts +1 -1
  78. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  79. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  80. package/dist/pptx/index.cjs +909 -315
  81. package/dist/pptx/index.d.ts +7 -7
  82. package/dist/pptx/index.mjs +5 -5
  83. package/dist/pptx/node/index.d.ts +1 -1
  84. package/dist/xlsx/index.cjs +22 -8
  85. package/dist/xlsx/index.mjs +22 -8
  86. package/dist/xlsx/ui/index.cjs +22 -8
  87. package/dist/xlsx/ui/index.mjs +22 -8
  88. package/package.json +1 -1
  89. package/dist/PptxHandler-V23RDNEX.cjs +0 -14
  90. package/dist/PptxHandler-WB3KL2WH.mjs +0 -5
  91. package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
  92. package/dist/pptx/chunks/index-CGNb1TV9.d.ts.map +0 -1
  93. package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
@@ -624,6 +624,7 @@ var init_collaboration_field_schema = __esm({
624
624
  backgroundImage: "scalar",
625
625
  backgroundImageProperties: "complex",
626
626
  backgroundGradient: "scalar",
627
+ backgroundGradientFill: "complex",
627
628
  backgroundStyleRef: "complex",
628
629
  backgroundPattern: "complex",
629
630
  backgroundShadeToTitle: "scalar",
@@ -1218,6 +1219,150 @@ var init_xml_utils = __esm({
1218
1219
  }
1219
1220
  });
1220
1221
 
1222
+ // pptx/core/utils/gradient-angle.ts
1223
+ function normalizeDegrees(deg) {
1224
+ if (!Number.isFinite(deg)) {
1225
+ return 0;
1226
+ }
1227
+ return (deg % 360 + 360) % 360;
1228
+ }
1229
+ function ooxmlGradientAngleToCssDegrees(angleDegrees) {
1230
+ return normalizeDegrees(angleDegrees + OOXML_TO_CSS_OFFSET_DEG);
1231
+ }
1232
+ function cssDegreesToOoxmlGradientAngle(cssDegrees) {
1233
+ return normalizeDegrees(cssDegrees - OOXML_TO_CSS_OFFSET_DEG);
1234
+ }
1235
+ var OOXML_TO_CSS_OFFSET_DEG;
1236
+ var init_gradient_angle = __esm({
1237
+ "pptx/core/utils/gradient-angle.ts"() {
1238
+ OOXML_TO_CSS_OFFSET_DEG = 90;
1239
+ }
1240
+ });
1241
+
1242
+ // pptx/core/utils/slide-background-gradient.ts
1243
+ function cssColor(color3, opacity2) {
1244
+ if (opacity2 === void 0 || opacity2 >= 1) {
1245
+ return color3;
1246
+ }
1247
+ const hex5 = color3.replace("#", "");
1248
+ const channel = (index2) => Number.parseInt(hex5.slice(index2, index2 + 2), 16);
1249
+ return `rgba(${channel(0)}, ${channel(2)}, ${channel(4)}, ${num(opacity2)})`;
1250
+ }
1251
+ function slideBackgroundGradientCss(gradient) {
1252
+ const stops = (gradient.fillGradientStops ?? []).map((stop) => `${cssColor(stop.color, stop.opacity)} ${num(stop.position)}%`).join(", ");
1253
+ if (gradient.fillGradientType !== "radial") {
1254
+ const angle = ooxmlGradientAngleToCssDegrees(gradient.fillGradientAngle ?? 0);
1255
+ return `linear-gradient(${num(angle)}deg, ${stops})`;
1256
+ }
1257
+ const focus = gradient.fillGradientFillToRect;
1258
+ const cx = focus ? (focus.l + (1 - focus.r)) / 2 * 100 : 50;
1259
+ const cy = focus ? (focus.t + (1 - focus.b)) / 2 * 100 : 50;
1260
+ const at2 = `at ${num(cx)}% ${num(cy)}%`;
1261
+ switch (gradient.fillGradientPathType) {
1262
+ case "rect":
1263
+ return `radial-gradient(${num(Math.max(cx, 100 - cx))}% ${num(Math.max(cy, 100 - cy))}% ${at2}, ${stops})`;
1264
+ case "shape":
1265
+ return `radial-gradient(farthest-side ${at2}, ${stops})`;
1266
+ default:
1267
+ return `radial-gradient(circle ${at2}, ${stops})`;
1268
+ }
1269
+ }
1270
+ function slideBackgroundGradientToWrite(slide) {
1271
+ const gradient = slide.backgroundGradientFill;
1272
+ if (!gradient || !slide.backgroundGradient) {
1273
+ return void 0;
1274
+ }
1275
+ return slide.backgroundGradient === slideBackgroundGradientCss(gradient) ? gradient : void 0;
1276
+ }
1277
+ var num;
1278
+ var init_slide_background_gradient = __esm({
1279
+ "pptx/core/utils/slide-background-gradient.ts"() {
1280
+ init_gradient_angle();
1281
+ num = (value) => String(Number(value.toFixed(3)));
1282
+ }
1283
+ });
1284
+
1285
+ // pptx/core/builders/sdk/background-gradient-input.ts
1286
+ function finite(name, value, min, max) {
1287
+ if (typeof value !== "number" || !Number.isFinite(value)) {
1288
+ throw new RangeError(`${WHERE}.${name} must be a finite number, got ${String(value)}`);
1289
+ }
1290
+ if (min !== void 0 && value < min || max !== void 0 && value > max) {
1291
+ throw new RangeError(`${WHERE}.${name} must be between ${min} and ${max}, got ${value}`);
1292
+ }
1293
+ return value;
1294
+ }
1295
+ function stopsOf(input2) {
1296
+ if (!Array.isArray(input2.stops) || input2.stops.length < 2) {
1297
+ throw new RangeError(`${WHERE}.stops needs at least two stops (a:gsLst)`);
1298
+ }
1299
+ return input2.stops.map((stop, index2) => {
1300
+ if (typeof stop.color !== "string" || !HEX.test(stop.color)) {
1301
+ throw new RangeError(
1302
+ `${WHERE}.stops[${index2}].color must be #RRGGBB, got ${String(stop.color)}`
1303
+ );
1304
+ }
1305
+ const position4 = finite(`stops[${index2}].position`, stop.position, 0, 1);
1306
+ const opacity2 = stop.opacity === void 0 ? void 0 : finite(`stops[${index2}].opacity`, stop.opacity, 0, 1);
1307
+ return {
1308
+ color: `#${stop.color.replace("#", "").toUpperCase()}`,
1309
+ // The shape gradient model keeps positions in percent.
1310
+ position: position4 * 100,
1311
+ ...opacity2 !== void 0 ? { opacity: opacity2 } : {}
1312
+ };
1313
+ });
1314
+ }
1315
+ function mapBackgroundGradientInput(input2) {
1316
+ const fillGradientStops = stopsOf(input2);
1317
+ let gradient;
1318
+ if (input2.path !== void 0) {
1319
+ if (!PATHS.has(input2.path)) {
1320
+ throw new RangeError(
1321
+ `${WHERE}.path must be circle, rect or shape, got ${String(input2.path)}`
1322
+ );
1323
+ }
1324
+ if (input2.angle !== void 0) {
1325
+ throw new RangeError(`${WHERE}.angle applies to a linear gradient, not a path one`);
1326
+ }
1327
+ const focus = input2.focus ?? { l: 0.5, t: 0.5, r: 0.5, b: 0.5 };
1328
+ gradient = {
1329
+ fillGradientType: "radial",
1330
+ fillGradientPathType: input2.path,
1331
+ fillGradientStops,
1332
+ fillGradientFillToRect: {
1333
+ l: finite("focus.l", focus.l),
1334
+ t: finite("focus.t", focus.t),
1335
+ r: finite("focus.r", focus.r),
1336
+ b: finite("focus.b", focus.b)
1337
+ }
1338
+ };
1339
+ } else {
1340
+ if (input2.focus !== void 0) {
1341
+ throw new RangeError(`${WHERE}.focus needs a path gradient`);
1342
+ }
1343
+ const cssAngle = finite("angle", input2.angle ?? 180);
1344
+ gradient = {
1345
+ fillGradientType: "linear",
1346
+ fillGradientAngle: cssDegreesToOoxmlGradientAngle(cssAngle),
1347
+ fillGradientStops
1348
+ };
1349
+ }
1350
+ return {
1351
+ backgroundGradient: slideBackgroundGradientCss(gradient),
1352
+ backgroundGradientFill: gradient
1353
+ };
1354
+ }
1355
+ var HEX, PATHS, WHERE;
1356
+ var init_background_gradient_input = __esm({
1357
+ "pptx/core/builders/sdk/background-gradient-input.ts"() {
1358
+ init_gradient_angle();
1359
+ init_slide_background_gradient();
1360
+ HEX = /^#?[0-9a-f]{6}$/iu;
1361
+ PATHS = /* @__PURE__ */ new Set(["circle", "rect", "shape"]);
1362
+ WHERE = "BackgroundInput";
1363
+ }
1364
+ });
1365
+
1221
1366
  // pptx/core/core/runtime/table-style-defaults.ts
1222
1367
  var DEFAULT_POWERPOINT_TABLE_STYLE_ID;
1223
1368
  var init_table_style_defaults = __esm({
@@ -1427,9 +1572,9 @@ function parseFormula(fmla) {
1427
1572
  return { op: op2, args };
1428
1573
  }
1429
1574
  function resolveOperand(token3, variables) {
1430
- const num4 = Number(token3);
1431
- if (Number.isFinite(num4)) {
1432
- return num4;
1575
+ const num5 = Number(token3);
1576
+ if (Number.isFinite(num5)) {
1577
+ return num5;
1433
1578
  }
1434
1579
  const value = variables.get(token3);
1435
1580
  if (value !== void 0) {
@@ -3257,8 +3402,8 @@ function authoredValue(node2) {
3257
3402
  return void 0;
3258
3403
  }
3259
3404
  const raw2 = node2["@_val"];
3260
- const num4 = raw2 === void 0 || raw2 === null || raw2 === "" ? NaN : Number.parseFloat(String(raw2));
3261
- return Number.isFinite(num4) ? num4 : void 0;
3405
+ const num5 = raw2 === void 0 || raw2 === null || raw2 === "" ? NaN : Number.parseFloat(String(raw2));
3406
+ return Number.isFinite(num5) ? num5 : void 0;
3262
3407
  }
3263
3408
  function applyChartGroupOptionsToXml(container2, containerLocal, chartData, getLocalName2) {
3264
3409
  let changed = false;
@@ -3450,6 +3595,44 @@ var init_chart_layout_input = __esm({
3450
3595
  }
3451
3596
  });
3452
3597
 
3598
+ // pptx/core/utils/chart-container-type-map.ts
3599
+ function chartContainerLocalNameToType(localName28) {
3600
+ return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
3601
+ }
3602
+ function isLineDrawnChartType(type) {
3603
+ return type !== void 0 && LINE_DRAWN_CHART_TYPES.has(type);
3604
+ }
3605
+ var CONTAINER_LOCAL_NAME_TO_TYPE, LINE_DRAWN_CHART_TYPES;
3606
+ var init_chart_container_type_map = __esm({
3607
+ "pptx/core/utils/chart-container-type-map.ts"() {
3608
+ CONTAINER_LOCAL_NAME_TO_TYPE = {
3609
+ barChart: "bar",
3610
+ bar3DChart: "bar3D",
3611
+ lineChart: "line",
3612
+ line3DChart: "line3D",
3613
+ pieChart: "pie",
3614
+ pie3DChart: "pie3D",
3615
+ ofPieChart: "ofPie",
3616
+ doughnutChart: "doughnut",
3617
+ areaChart: "area",
3618
+ area3DChart: "area3D",
3619
+ scatterChart: "scatter",
3620
+ bubbleChart: "bubble",
3621
+ radarChart: "radar",
3622
+ stockChart: "stock",
3623
+ surfaceChart: "surface",
3624
+ surface3DChart: "surface"
3625
+ };
3626
+ LINE_DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
3627
+ "line",
3628
+ "line3D",
3629
+ "scatter",
3630
+ "radar",
3631
+ "stock"
3632
+ ]);
3633
+ }
3634
+ });
3635
+
3453
3636
  // pptx/core/builders/sdk/chart-operations.ts
3454
3637
  function ensureChartData(element2) {
3455
3638
  if (!element2.chartData) {
@@ -3954,6 +4137,289 @@ var init_shape_style_input = __esm({
3954
4137
  }
3955
4138
  });
3956
4139
 
4140
+ // pptx/core/builders/sdk/table-border-input.ts
4141
+ function borderDashSegments(edge, lengths, width) {
4142
+ const name = `TableCellInput.borders.${edge}.dash`;
4143
+ if (lengths.length === 0) {
4144
+ throw new RangeError(`${name} must give at least one length`);
4145
+ }
4146
+ if (lengths.some((n) => !Number.isFinite(n) || n <= 0)) {
4147
+ throw new RangeError(`${name} lengths must be finite and above 0, got [${lengths.join(", ")}]`);
4148
+ }
4149
+ const segments = customDashSegments([...lengths], width !== void 0 && width > 0 ? width : 1);
4150
+ if (segments.some((s) => s.dash <= 0 || s.space <= 0)) {
4151
+ throw new RangeError(`${name} has a length too short to write: [${lengths.join(", ")}]`);
4152
+ }
4153
+ if (segments.some((s) => s.dash > MAX_DASH_UNITS || s.space > MAX_DASH_UNITS)) {
4154
+ throw new RangeError(`${name} has a length too long to write: [${lengths.join(", ")}]`);
4155
+ }
4156
+ return segments;
4157
+ }
4158
+ function edgeStyle(edge, prefix, input2) {
4159
+ if (input2.width !== void 0 && (!Number.isFinite(input2.width) || input2.width < 0)) {
4160
+ throw new RangeError(
4161
+ `TableCellInput.borders.${edge}.width must be a finite width of 0 or more, got ${input2.width}`
4162
+ );
4163
+ }
4164
+ const out = {};
4165
+ if (input2.width !== void 0) out[`${prefix}Width`] = input2.width;
4166
+ if (input2.color !== void 0) out[`${prefix}Color`] = input2.color;
4167
+ if (Array.isArray(input2.dash)) {
4168
+ out[`${prefix}Dash`] = "custom";
4169
+ out[`${prefix}DashSegments`] = borderDashSegments(edge, input2.dash, input2.width);
4170
+ } else if (input2.dash !== void 0) {
4171
+ if (input2.dash === "custom") {
4172
+ throw new RangeError(`TableCellInput.borders.${edge}.dash: give 'custom' as a length list`);
4173
+ }
4174
+ out[`${prefix}Dash`] = input2.dash;
4175
+ }
4176
+ return out;
4177
+ }
4178
+ function tableCellBorderStyle(borders) {
4179
+ if (!borders) {
4180
+ return {};
4181
+ }
4182
+ const out = {};
4183
+ for (const [edge, prefix] of EDGES) {
4184
+ const own2 = borders[edge];
4185
+ const input2 = borders.all || own2 ? { ...borders.all, ...own2 } : void 0;
4186
+ if (input2) {
4187
+ Object.assign(out, edgeStyle(own2 ? edge : "all", prefix, input2));
4188
+ }
4189
+ }
4190
+ return out;
4191
+ }
4192
+ var MAX_DASH_UNITS, EDGES;
4193
+ var init_table_border_input = __esm({
4194
+ "pptx/core/builders/sdk/table-border-input.ts"() {
4195
+ init_shape_style_input();
4196
+ MAX_DASH_UNITS = 2147483647;
4197
+ EDGES = [
4198
+ ["top", "borderTop"],
4199
+ ["right", "borderRight"],
4200
+ ["bottom", "borderBottom"],
4201
+ ["left", "borderLeft"]
4202
+ ];
4203
+ }
4204
+ });
4205
+
4206
+ // pptx/core/builders/sdk/table-cell-input.ts
4207
+ function refuseGradientExtras(fill3) {
4208
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4209
+ const unsupported3 = [
4210
+ fill3.tile !== void 0 ? "tile" : void 0,
4211
+ fill3.scaled === false ? "scaled: false" : void 0,
4212
+ fill3.rotWithShape !== void 0 ? "rotWithShape" : void 0,
4213
+ fill3.focus !== void 0 && !radial ? "focus on a linear gradient" : void 0
4214
+ ].filter((name) => name !== void 0);
4215
+ if (unsupported3.length > 0) {
4216
+ throw new RangeError(
4217
+ `TableCellInput.fill: ${unsupported3.join(", ")} cannot be written on a table cell`
4218
+ );
4219
+ }
4220
+ if (fill3.stops.length === 0) {
4221
+ throw new RangeError("TableCellInput.fill: a gradient needs at least one stop");
4222
+ }
4223
+ }
4224
+ function tableCellFillStyle(fill3) {
4225
+ switch (fill3?.type) {
4226
+ case void 0:
4227
+ return {};
4228
+ case "solid":
4229
+ if (fill3.opacity !== void 0 && fill3.opacity !== 1) {
4230
+ throw new RangeError(
4231
+ `TableCellInput.fill.opacity cannot be written on a table cell, got ${fill3.opacity}`
4232
+ );
4233
+ }
4234
+ return {
4235
+ fillMode: "solid",
4236
+ backgroundColor: fill3.color,
4237
+ ...fill3.themeColorRef ? { backgroundColorRef: fill3.themeColorRef } : {}
4238
+ };
4239
+ case "gradient": {
4240
+ refuseGradientExtras(fill3);
4241
+ const radial = fill3.path !== void 0 || fill3.gradientType === "radial";
4242
+ return {
4243
+ fillMode: "gradient",
4244
+ gradientFillType: radial ? "radial" : "linear",
4245
+ gradientFillAngle: fill3.angle ?? 0,
4246
+ gradientFillStops: fill3.stops.map((stop) => ({
4247
+ color: stop.color,
4248
+ position: stop.position,
4249
+ ...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
4250
+ })),
4251
+ ...radial ? { gradientFillPathType: fill3.path ?? "circle" } : {},
4252
+ ...fill3.focus ? { gradientFillFillToRect: { ...fill3.focus } } : {}
4253
+ };
4254
+ }
4255
+ case "pattern":
4256
+ if (!fill3.preset) {
4257
+ throw new RangeError("TableCellInput.fill: a pattern fill needs a preset");
4258
+ }
4259
+ return {
4260
+ fillMode: "pattern",
4261
+ patternFillPreset: fill3.preset,
4262
+ ...fill3.foreground !== void 0 ? { patternFillForeground: fill3.foreground } : {},
4263
+ ...fill3.background !== void 0 ? { patternFillBackground: fill3.background } : {}
4264
+ };
4265
+ case "image":
4266
+ throw new RangeError("TableCellInput.fill: an image fill cannot be written on a table cell");
4267
+ case "none":
4268
+ return { fillMode: "none" };
4269
+ }
4270
+ }
4271
+ function tableCellTextStyle(style) {
4272
+ const out = {};
4273
+ if (style?.fontSize !== void 0) out.fontSize = style.fontSize;
4274
+ if (style?.bold !== void 0) out.bold = style.bold;
4275
+ if (style?.italic !== void 0) out.italic = style.italic;
4276
+ if (style?.color !== void 0) out.color = style.color;
4277
+ if (style?.alignment !== void 0) out.align = style.alignment;
4278
+ return out;
4279
+ }
4280
+ function tableCellStyle(cell2) {
4281
+ const style = {
4282
+ ...tableCellTextStyle(cell2.style),
4283
+ ...tableCellFillStyle(cell2.fill),
4284
+ ...tableCellBorderStyle(cell2.borders)
4285
+ };
4286
+ return cell2.style || Object.keys(style).length > 0 ? style : void 0;
4287
+ }
4288
+ var init_table_cell_input = __esm({
4289
+ "pptx/core/builders/sdk/table-cell-input.ts"() {
4290
+ init_table_border_input();
4291
+ }
4292
+ });
4293
+
4294
+ // pptx/core/builders/sdk/table-merge-input.ts
4295
+ function span(value, name) {
4296
+ if (value === void 0) {
4297
+ return 1;
4298
+ }
4299
+ if (!Number.isInteger(value) || value < 1) {
4300
+ throw new RangeError(`TableCellInput.${name} must be a whole number from 1, got ${value}`);
4301
+ }
4302
+ return value;
4303
+ }
4304
+ function placeTableCells(input2) {
4305
+ const rowCount = input2.rows.length;
4306
+ const slots = input2.rows.map(() => []);
4307
+ input2.rows.forEach((row, ri) => {
4308
+ const rowSlots = slots[ri] ?? [];
4309
+ let ci = 0;
4310
+ for (const cell2 of row.cells) {
4311
+ while (rowSlots[ci]) {
4312
+ ci += 1;
4313
+ }
4314
+ const colSpan = span(cell2.gridSpan, "gridSpan");
4315
+ const rowSpan = span(cell2.rowSpan, "rowSpan");
4316
+ if (ri + rowSpan > rowCount) {
4317
+ throw new RangeError(
4318
+ `A cell in row ${ri} spans ${rowSpan} rows, past the table's ${rowCount} rows`
4319
+ );
4320
+ }
4321
+ for (let dr = 0; dr < rowSpan; dr++) {
4322
+ for (let dc = 0; dc < colSpan; dc++) {
4323
+ const target = slots[ri + dr] ?? [];
4324
+ if (target[ci + dc]) {
4325
+ throw new RangeError(
4326
+ `A cell in row ${ri} overlaps the merge covering row ${ri + dr}, column ${ci + dc}`
4327
+ );
4328
+ }
4329
+ target[ci + dc] = dr === 0 && dc === 0 ? { cell: cell2 } : { hMerge: dc > 0, vMerge: dr > 0 };
4330
+ }
4331
+ }
4332
+ ci += colSpan;
4333
+ }
4334
+ });
4335
+ const widest = Math.max(...slots.map((row) => row.length), 1);
4336
+ const declared = input2.columnWidths?.length;
4337
+ if (declared !== void 0 && widest > declared) {
4338
+ throw new RangeError(`A row takes ${widest} columns, but columnWidths gives ${declared}`);
4339
+ }
4340
+ const columnCount = declared ?? widest;
4341
+ return {
4342
+ columnCount,
4343
+ rows: slots.map(
4344
+ (row) => Array.from({ length: columnCount }, (_, ci) => row[ci] ?? { cell: { text: "" } })
4345
+ )
4346
+ };
4347
+ }
4348
+ function columnFractions(columnWidths, columnCount) {
4349
+ if (!columnWidths) {
4350
+ return Array.from({ length: columnCount }, () => 1 / columnCount);
4351
+ }
4352
+ if (columnWidths.length !== columnCount) {
4353
+ throw new RangeError(
4354
+ `columnWidths gives ${columnWidths.length} widths for a table of ${columnCount} columns`
4355
+ );
4356
+ }
4357
+ if (columnWidths.some((w) => !Number.isFinite(w) || w < 0)) {
4358
+ throw new RangeError("columnWidths must be finite widths of 0 or more");
4359
+ }
4360
+ const sum = columnWidths.reduce((a, b) => a + b, 0);
4361
+ if (sum <= 0) {
4362
+ throw new RangeError("columnWidths must not all be 0");
4363
+ }
4364
+ return columnWidths.map((w) => w / sum);
4365
+ }
4366
+ var init_table_merge_input = __esm({
4367
+ "pptx/core/builders/sdk/table-merge-input.ts"() {
4368
+ }
4369
+ });
4370
+
4371
+ // pptx/core/builders/sdk/text-segment-style.ts
4372
+ function elementStyleForSegments(textStyle, segments) {
4373
+ const styled = segments.filter((segment) => !segment.isParagraphBreak);
4374
+ const first2 = styled[0]?.style;
4375
+ if (!first2) {
4376
+ return textStyle;
4377
+ }
4378
+ const next = { ...textStyle };
4379
+ for (const key2 of RUN_KEYS) {
4380
+ const value = first2[key2];
4381
+ if (!styled.every((segment) => sameValue(segment.style?.[key2], value))) {
4382
+ continue;
4383
+ }
4384
+ if (value === void 0) {
4385
+ delete next[key2];
4386
+ } else {
4387
+ next[key2] = value;
4388
+ }
4389
+ }
4390
+ return next;
4391
+ }
4392
+ function sameValue(a, b) {
4393
+ if (a === b) {
4394
+ return true;
4395
+ }
4396
+ if (a && b && typeof a === "object" && typeof b === "object") {
4397
+ return JSON.stringify(a) === JSON.stringify(b);
4398
+ }
4399
+ return false;
4400
+ }
4401
+ var RUN_KEYS;
4402
+ var init_text_segment_style = __esm({
4403
+ "pptx/core/builders/sdk/text-segment-style.ts"() {
4404
+ RUN_KEYS = [
4405
+ "fontFamily",
4406
+ "fontSize",
4407
+ "bold",
4408
+ "italic",
4409
+ "underline",
4410
+ "strikethrough",
4411
+ "color",
4412
+ "colorRef",
4413
+ "characterSpacing",
4414
+ "hyperlink",
4415
+ "hyperlinkAction",
4416
+ "hyperlinkTargetSlideIndex",
4417
+ "hyperlinkTooltip",
4418
+ "align"
4419
+ ];
4420
+ }
4421
+ });
4422
+
3957
4423
  // pptx/core/builders/sdk/ElementFactory.ts
3958
4424
  function generateId(prefix) {
3959
4425
  idCounter += 1;
@@ -4062,6 +4528,7 @@ function createTextElement(text2, options2) {
4062
4528
  verticalAlignment: options2?.verticalAlignment,
4063
4529
  lineSpacing: options2?.lineSpacing
4064
4530
  };
4531
+ const textSegments = buildTextSegments(text2, textStyleBase);
4065
4532
  return {
4066
4533
  type: "text",
4067
4534
  id: generateId("txt"),
@@ -4069,8 +4536,8 @@ function createTextElement(text2, options2) {
4069
4536
  rotation: options2?.rotation,
4070
4537
  opacity: options2?.opacity,
4071
4538
  text: plainText,
4072
- textStyle: mapTextStyleInput(textStyleBase),
4073
- textSegments: buildTextSegments(text2, textStyleBase),
4539
+ textStyle: elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
4540
+ textSegments,
4074
4541
  shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
4075
4542
  };
4076
4543
  }
@@ -4150,32 +4617,30 @@ function createImageElement(source2, options2) {
4150
4617
  cropBottom: options2?.cropBottom
4151
4618
  };
4152
4619
  }
4620
+ function createTableCell(cellInput) {
4621
+ return {
4622
+ text: cellInput.text,
4623
+ gridSpan: cellInput.gridSpan,
4624
+ rowSpan: cellInput.rowSpan,
4625
+ style: tableCellStyle(cellInput)
4626
+ };
4627
+ }
4153
4628
  function createTableElement(input2, options2) {
4154
- const numCols = Math.max(...input2.rows.map((r) => r.cells.length), 1);
4629
+ const grid = input2.fillMergedCells ? placeTableCells(input2) : void 0;
4630
+ const numCols = grid?.columnCount ?? Math.max(...input2.rows.map((r) => r.cells.length), 1);
4155
4631
  const rowHeight = input2.rows.length > 0 ? Math.max(30, Math.floor(200 / input2.rows.length)) : 30;
4156
4632
  const totalHeight = options2?.height ?? Math.max(100, input2.rows.length * rowHeight);
4157
4633
  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) => ({
4634
+ const colWidths = columnFractions(input2.columnWidths, numCols);
4635
+ const rows = input2.rows.map((rowInput, ri) => ({
4166
4636
  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
- }))
4637
+ cells: grid ? (grid.rows[ri] ?? []).map(
4638
+ (slot2) => slot2.cell ? createTableCell(slot2.cell) : {
4639
+ text: "",
4640
+ ...slot2.hMerge ? { hMerge: true } : {},
4641
+ ...slot2.vMerge ? { vMerge: true } : {}
4642
+ }
4643
+ ) : rowInput.cells.map(createTableCell)
4179
4644
  }));
4180
4645
  const tableData = {
4181
4646
  rows,
@@ -4190,7 +4655,9 @@ function createTableElement(input2, options2) {
4190
4655
  // Accent 1 unless the caller picked a style. This is decided at
4191
4656
  // creation time so the save pipeline never has to invent a style for
4192
4657
  // loaded tables that legitimately have none.
4193
- tableStyleId: input2.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
4658
+ // `style: 'none'` (or '') opts out, so the cells' own formatting is not
4659
+ // painted over by the theme banding.
4660
+ tableStyleId: input2.style === "none" ? void 0 : input2.style ?? DEFAULT_POWERPOINT_TABLE_STYLE_ID
4194
4661
  };
4195
4662
  return {
4196
4663
  type: "table",
@@ -4308,6 +4775,9 @@ var init_ElementFactory = __esm({
4308
4775
  init_custom_geometry();
4309
4776
  init_chart_gradient_input();
4310
4777
  init_chart_layout_operations();
4778
+ init_table_cell_input();
4779
+ init_table_merge_input();
4780
+ init_text_segment_style();
4311
4781
  init_shape_style_input();
4312
4782
  idCounter = 0;
4313
4783
  DEFAULTS = {
@@ -4327,6 +4797,7 @@ var init_ElementFactory = __esm({
4327
4797
  var SlideBuilder;
4328
4798
  var init_SlideBuilder = __esm({
4329
4799
  "pptx/core/builders/sdk/SlideBuilder.ts"() {
4800
+ init_background_gradient_input();
4330
4801
  init_ElementFactory();
4331
4802
  SlideBuilder = class {
4332
4803
  /**
@@ -4437,12 +4908,12 @@ var init_SlideBuilder = __esm({
4437
4908
  switch (bg.type) {
4438
4909
  case "solid":
4439
4910
  this.slide.backgroundColor = bg.color;
4911
+ delete this.slide.backgroundGradient;
4912
+ delete this.slide.backgroundGradientFill;
4440
4913
  break;
4441
- case "gradient": {
4442
- const stops = bg.stops.map((s) => `${s.color} ${Math.round(s.position * 100)}%`).join(", ");
4443
- this.slide.backgroundGradient = `linear-gradient(${bg.angle ?? 180}deg, ${stops})`;
4914
+ case "gradient":
4915
+ Object.assign(this.slide, mapBackgroundGradientInput(bg));
4444
4916
  break;
4445
- }
4446
4917
  case "image":
4447
4918
  this.slide.backgroundImage = bg.source;
4448
4919
  break;
@@ -5900,9 +6371,9 @@ function resolveCoordinate(value, variables) {
5900
6371
  return value;
5901
6372
  }
5902
6373
  const trimmed2 = String(value).trim();
5903
- const num4 = Number(trimmed2);
5904
- if (Number.isFinite(num4)) {
5905
- return num4;
6374
+ const num5 = Number(trimmed2);
6375
+ if (Number.isFinite(num5)) {
6376
+ return num5;
5906
6377
  }
5907
6378
  return resolveOperand(trimmed2, variables);
5908
6379
  }
@@ -17118,9 +17589,9 @@ function resolveToken(token3, vars) {
17118
17589
  if (trimmed2 === "") {
17119
17590
  return 0;
17120
17591
  }
17121
- const num4 = Number(trimmed2);
17122
- if (Number.isFinite(num4)) {
17123
- return num4;
17592
+ const num5 = Number(trimmed2);
17593
+ if (Number.isFinite(num5)) {
17594
+ return num5;
17124
17595
  }
17125
17596
  return resolveOperand(trimmed2, vars);
17126
17597
  }
@@ -18035,23 +18506,6 @@ var init_element_actions = __esm({
18035
18506
  }
18036
18507
  });
18037
18508
 
18038
- // pptx/core/utils/gradient-angle.ts
18039
- function normalizeDegrees(deg) {
18040
- if (!Number.isFinite(deg)) {
18041
- return 0;
18042
- }
18043
- return (deg % 360 + 360) % 360;
18044
- }
18045
- function ooxmlGradientAngleToCssDegrees(angleDegrees) {
18046
- return normalizeDegrees(angleDegrees + OOXML_TO_CSS_OFFSET_DEG);
18047
- }
18048
- var OOXML_TO_CSS_OFFSET_DEG;
18049
- var init_gradient_angle = __esm({
18050
- "pptx/core/utils/gradient-angle.ts"() {
18051
- OOXML_TO_CSS_OFFSET_DEG = 90;
18052
- }
18053
- });
18054
-
18055
18509
  // pptx/core/utils/positive-fixed-angle.ts
18056
18510
  function normalizePositiveFixedAngleDegrees(degrees) {
18057
18511
  if (!Number.isFinite(degrees)) {
@@ -28766,7 +29220,7 @@ function boolean(value, fallback) {
28766
29220
  }
28767
29221
  return value === "1" || value === "true";
28768
29222
  }
28769
- function num(value, fallback) {
29223
+ function num2(value, fallback) {
28770
29224
  if (value === void 0 || value === "") {
28771
29225
  return fallback;
28772
29226
  }
@@ -28818,8 +29272,8 @@ function parseShape(element2) {
28818
29272
  const type = element2.attrs.type;
28819
29273
  return {
28820
29274
  type: type && type !== "none" ? type : void 0,
28821
- rot: num(element2.attrs.rot, 0),
28822
- zOrderOff: num(element2.attrs.zOrderOff, 0),
29275
+ rot: num2(element2.attrs.rot, 0),
29276
+ zOrderOff: num2(element2.attrs.zOrderOff, 0),
28823
29277
  hideGeom: boolean(element2.attrs.hideGeom, false),
28824
29278
  lkTxEntry: boolean(element2.attrs.lkTxEntry, false),
28825
29279
  blipPhldr: boolean(element2.attrs.blipPhldr, false),
@@ -28838,9 +29292,9 @@ function parseConstraint(attrs4) {
28838
29292
  refForName: attrs4.refForName || void 0,
28839
29293
  refPtType: attrs4.refPtType ?? "all",
28840
29294
  op: op2 === "equ" || op2 === "gte" || op2 === "lte" ? op2 : "none",
28841
- val: num(attrs4.val, 0),
29295
+ val: num2(attrs4.val, 0),
28842
29296
  hasVal: attrs4.val !== void 0,
28843
- fact: num(attrs4.fact, 1)
29297
+ fact: num2(attrs4.fact, 1)
28844
29298
  };
28845
29299
  }
28846
29300
  function parseRule(attrs4) {
@@ -32467,22 +32921,22 @@ var init_smartart_constraint_branch_index = __esm({
32467
32921
  });
32468
32922
 
32469
32923
  // diagram/layout/smartart-constraint-resolve.ts
32470
- function finite(value) {
32924
+ function finite2(value) {
32471
32925
  return typeof value === "number" && Number.isFinite(value);
32472
32926
  }
32473
32927
  function literalValue(constraint) {
32474
- if (finite(constraint.factor)) {
32928
+ if (finite2(constraint.factor)) {
32475
32929
  return constraint.factor;
32476
32930
  }
32477
- if (finite(constraint.value)) {
32931
+ if (finite2(constraint.value)) {
32478
32932
  return constraint.value;
32479
32933
  }
32480
32934
  return void 0;
32481
32935
  }
32482
32936
  function combine(constraint, referenced) {
32483
- const factor = finite(constraint.factor) ? constraint.factor : 1;
32937
+ const factor = finite2(constraint.factor) ? constraint.factor : 1;
32484
32938
  let result = referenced * factor;
32485
- if (finite(constraint.value)) {
32939
+ if (finite2(constraint.value)) {
32486
32940
  if (constraint.operator === "gte") {
32487
32941
  result = Math.max(result, constraint.value);
32488
32942
  } else if (constraint.operator === "lte") {
@@ -32520,7 +32974,7 @@ function resolveEntry(index2, entry2, visiting) {
32520
32974
  );
32521
32975
  const referenced = resolveInternal(index2, refRole, refType, visiting);
32522
32976
  if (referenced === void 0) {
32523
- return finite(constraint.value) ? constraint.value : void 0;
32977
+ return finite2(constraint.value) ? constraint.value : void 0;
32524
32978
  }
32525
32979
  return combine(constraint, referenced);
32526
32980
  }
@@ -34708,8 +35162,8 @@ var init_smartart_layout_interpreter_cycle_ring_nested_hub = __esm({
34708
35162
 
34709
35163
  // diagram/layout/smartart-layout-interpreter-cycle-ring-offset.ts
34710
35164
  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;
35165
+ const span2 = Math.max(1e-9, Math.max(...values) - Math.min(...values));
35166
+ const epsilon = span2 * TIE_EPSILON_FRACTION;
34713
35167
  const minValue = Math.min(...values);
34714
35168
  const maxValue = Math.max(...values);
34715
35169
  const lowCount = values.filter((v) => v - minValue <= epsilon).length;
@@ -37005,8 +37459,8 @@ function centeredAxisPitch(dimension2, itemSize, gapRatio, count2) {
37005
37459
  const n = Math.max(1, count2);
37006
37460
  const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
37007
37461
  const pitch = itemSize + gap;
37008
- const span = n * itemSize + Math.max(0, n - 1) * gap;
37009
- const shift = (dimension2 - span) / 2;
37462
+ const span2 = n * itemSize + Math.max(0, n - 1) * gap;
37463
+ const shift = (dimension2 - span2) / 2;
37010
37464
  return { pitch, shift };
37011
37465
  }
37012
37466
  function compositeFanPitch(dimension2, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
@@ -40370,18 +40824,18 @@ function collectNamedRules(definition) {
40370
40824
  walk3(definition.rootNode);
40371
40825
  return out;
40372
40826
  }
40373
- function finite2(value) {
40827
+ function finite3(value) {
40374
40828
  return typeof value === "number" && Number.isFinite(value);
40375
40829
  }
40376
40830
  function ruleValue(rule) {
40377
- let value = finite2(rule.value) ? rule.value : rule.max;
40378
- if (!finite2(value)) {
40831
+ let value = finite3(rule.value) ? rule.value : rule.max;
40832
+ if (!finite3(value)) {
40379
40833
  return void 0;
40380
40834
  }
40381
- if (finite2(rule.factor)) {
40835
+ if (finite3(rule.factor)) {
40382
40836
  value *= rule.factor;
40383
40837
  }
40384
- if (finite2(rule.max)) {
40838
+ if (finite3(rule.max)) {
40385
40839
  value = Math.min(value, rule.max);
40386
40840
  }
40387
40841
  return Number.isFinite(value) ? value : void 0;
@@ -47679,7 +48133,7 @@ var init_patch = __esm({
47679
48133
  init_xml2();
47680
48134
  XMLNS = "http://www.w3.org/2000/xmlns/";
47681
48135
  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] ?? "";
48136
+ qualifiedName = (xml, span2) => /^<([^\s/>]+)/.exec(xml.slice(span2.start, span2.openEnd))?.[1] ?? "";
47683
48137
  PartPatch = class {
47684
48138
  constructor(xml, rootElement) {
47685
48139
  this.xml = xml;
@@ -47706,9 +48160,9 @@ var init_patch = __esm({
47706
48160
  this.edits.push({ start, end, text: text2, seq: this.seq++ });
47707
48161
  }
47708
48162
  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;
48163
+ const span2 = this.spans.get(element2);
48164
+ if (!span2) throw new Error("Element is not a child of the patched root");
48165
+ return span2;
47712
48166
  }
47713
48167
  /** The prefix bound to `ns` on the root, declaring `preferred` for it when none is. */
47714
48168
  prefix(ns, preferred) {
@@ -47728,20 +48182,20 @@ var init_patch = __esm({
47728
48182
  }
47729
48183
  /** Replaces the element's content, keeping its start tag (and attributes) as written. */
47730
48184
  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);
48185
+ const span2 = this.span(element2);
48186
+ if (span2.selfClosing)
48187
+ this.add(span2.openEnd - 2, span2.openEnd, `>${content2}</${qualifiedName(this.xml, span2)}>`);
48188
+ else this.add(span2.openEnd, span2.closeStart, content2);
47735
48189
  }
47736
48190
  /** Adds ` name="value"` text to the element's start tag. */
47737
48191
  addAttribute(element2, attribute7) {
47738
- const span = this.span(element2);
47739
- const at2 = span.openEnd - (span.selfClosing ? 2 : 1);
48192
+ const span2 = this.span(element2);
48193
+ const at2 = span2.openEnd - (span2.selfClosing ? 2 : 1);
47740
48194
  this.add(at2, at2, attribute7);
47741
48195
  }
47742
48196
  remove(element2) {
47743
- const span = this.span(element2);
47744
- this.add(span.start, span.end, "");
48197
+ const span2 = this.span(element2);
48198
+ this.add(span2.start, span2.end, "");
47745
48199
  }
47746
48200
  /** Inserts `markup` before `before`, or as the root's last child. */
47747
48201
  insert(markup, before) {
@@ -49177,18 +49631,18 @@ function groupTransform(group, parent) {
49177
49631
  const ext = first(xfrm, "ext", NS.a);
49178
49632
  const chOff = first(xfrm, "chOff", NS.a);
49179
49633
  const chExt = first(xfrm, "chExt", NS.a);
49180
- const num4 = (element2, name) => Number.parseInt(element2?.getAttribute(name) ?? "", 10);
49181
- const cx = num4(ext, "cx");
49182
- const cy = num4(ext, "cy");
49183
- const chCx = num4(chExt, "cx");
49184
- const chCy = num4(chExt, "cy");
49634
+ const num5 = (element2, name) => Number.parseInt(element2?.getAttribute(name) ?? "", 10);
49635
+ const cx = num5(ext, "cx");
49636
+ const cy = num5(ext, "cy");
49637
+ const chCx = num5(chExt, "cx");
49638
+ const chCy = num5(chExt, "cy");
49185
49639
  if (!off || ![cx, cy, chCx, chCy].every(Number.isFinite) || chCx === 0 || chCy === 0)
49186
49640
  return parent;
49187
49641
  const scaleX = cx / chCx;
49188
49642
  const scaleY = cy / chCy;
49189
49643
  const local = {
49190
- offsetX: num4(off, "x") - (num4(chOff, "x") || 0) * scaleX,
49191
- offsetY: num4(off, "y") - (num4(chOff, "y") || 0) * scaleY,
49644
+ offsetX: num5(off, "x") - (num5(chOff, "x") || 0) * scaleX,
49645
+ offsetY: num5(off, "y") - (num5(chOff, "y") || 0) * scaleY,
49192
49646
  scaleX,
49193
49647
  scaleY
49194
49648
  };
@@ -55994,9 +56448,9 @@ function parseValueColorPositions(node2, xmlLookup) {
55994
56448
  const entry2 = { kind };
55995
56449
  const rawVal = posNode["@_val"];
55996
56450
  if (rawVal !== void 0) {
55997
- const num4 = Number.parseFloat(String(rawVal));
55998
- if (Number.isFinite(num4)) {
55999
- entry2.value = num4;
56451
+ const num5 = Number.parseFloat(String(rawVal));
56452
+ if (Number.isFinite(num5)) {
56453
+ entry2.value = num5;
56000
56454
  }
56001
56455
  }
56002
56456
  positions2.push(entry2);
@@ -56358,8 +56812,8 @@ var init_chart_cx_parser = __esm({
56358
56812
  // pptx/core/utils/chart-user-shapes-parser.ts
56359
56813
  function markerFraction(marker2, axis, xml) {
56360
56814
  const raw2 = xml.getScalarChildByLocalName(marker2, axis);
56361
- const num4 = Number.parseFloat(String(raw2 ?? ""));
56362
- return Number.isFinite(num4) ? num4 : 0;
56815
+ const num5 = Number.parseFloat(String(raw2 ?? ""));
56816
+ return Number.isFinite(num5) ? num5 : 0;
56363
56817
  }
56364
56818
  function parseShapeParagraphs(shape2, xml, colors) {
56365
56819
  const txBody = xml.getChildByLocalName(shape2, "txBody");
@@ -56482,13 +56936,13 @@ function buildUserShape(shape2, kind, base2, xml, colors) {
56482
56936
  };
56483
56937
  }
56484
56938
  function parseOffExt(offNode, extNode) {
56485
- const num4 = (node2, attr6) => {
56939
+ const num5 = (node2, attr6) => {
56486
56940
  const raw2 = Number.parseFloat(String(node2?.[attr6] ?? ""));
56487
56941
  return Number.isFinite(raw2) ? raw2 : 0;
56488
56942
  };
56489
56943
  return {
56490
- off: { x: num4(offNode, "@_x"), y: num4(offNode, "@_y") },
56491
- ext: { cx: num4(extNode, "@_cx"), cy: num4(extNode, "@_cy") }
56944
+ off: { x: num5(offNode, "@_x"), y: num5(offNode, "@_y") },
56945
+ ext: { cx: num5(extNode, "@_cx"), cy: num5(extNode, "@_cy") }
56492
56946
  };
56493
56947
  }
56494
56948
  function parseGroupTransform(group, xml) {
@@ -56784,8 +57238,8 @@ function resolveCellValue(cell2, sharedStrings) {
56784
57238
  case "inlineStr":
56785
57239
  return cell2.value;
56786
57240
  default: {
56787
- const num4 = Number.parseFloat(cell2.value);
56788
- return Number.isFinite(num4) ? num4 : cell2.value;
57241
+ const num5 = Number.parseFloat(cell2.value);
57242
+ return Number.isFinite(num5) ? num5 : cell2.value;
56789
57243
  }
56790
57244
  }
56791
57245
  }
@@ -56870,8 +57324,8 @@ async function parseEmbeddedXlsx(xlsxData) {
56870
57324
  } else if (typeof cellVal === "number") {
56871
57325
  values.push(cellVal);
56872
57326
  } else {
56873
- const num4 = Number.parseFloat(String(cellVal));
56874
- values.push(Number.isFinite(num4) ? num4 : 0);
57327
+ const num5 = Number.parseFloat(String(cellVal));
57328
+ values.push(Number.isFinite(num5) ? num5 : 0);
56875
57329
  }
56876
57330
  }
56877
57331
  series.push({ name, values });
@@ -57397,8 +57851,8 @@ function parseVmlOpacity(value) {
57397
57851
  const pct = parseFloat(trimmed2.slice(0, -1));
57398
57852
  return Number.isFinite(pct) ? pct / 100 : void 0;
57399
57853
  }
57400
- const num4 = parseFloat(trimmed2);
57401
- return Number.isFinite(num4) ? Math.min(1, Math.max(0, num4)) : void 0;
57854
+ const num5 = parseFloat(trimmed2);
57855
+ return Number.isFinite(num5) ? Math.min(1, Math.max(0, num5)) : void 0;
57402
57856
  }
57403
57857
  var NAMED_COLORS;
57404
57858
  var init_vml_color_parser = __esm({
@@ -57441,29 +57895,29 @@ function parseCssDimension(value, containerPx) {
57441
57895
  if (trimmed2.length === 0) {
57442
57896
  return 0;
57443
57897
  }
57444
- const num4 = parseFloat(trimmed2);
57445
- if (!Number.isFinite(num4)) {
57898
+ const num5 = parseFloat(trimmed2);
57899
+ if (!Number.isFinite(num5)) {
57446
57900
  return 0;
57447
57901
  }
57448
57902
  if (trimmed2.endsWith("pt")) {
57449
- return num4 / PT_PER_PX2;
57903
+ return num5 / PT_PER_PX2;
57450
57904
  }
57451
57905
  if (trimmed2.endsWith("in")) {
57452
- return num4 * 96;
57906
+ return num5 * 96;
57453
57907
  }
57454
57908
  if (trimmed2.endsWith("cm")) {
57455
- return num4 * (96 / 2.54);
57909
+ return num5 * (96 / 2.54);
57456
57910
  }
57457
57911
  if (trimmed2.endsWith("mm")) {
57458
- return num4 * (96 / 25.4);
57912
+ return num5 * (96 / 25.4);
57459
57913
  }
57460
57914
  if (trimmed2.endsWith("emu")) {
57461
- return num4 / EMU_PER_PX6;
57915
+ return num5 / EMU_PER_PX6;
57462
57916
  }
57463
57917
  if (trimmed2.endsWith("%")) {
57464
- return containerPx ? num4 / 100 * containerPx : 0;
57918
+ return containerPx ? num5 / 100 * containerPx : 0;
57465
57919
  }
57466
- return num4;
57920
+ return num5;
57467
57921
  }
57468
57922
  function parseVmlStyle(styleAttr) {
57469
57923
  const result = {};
@@ -58382,7 +58836,7 @@ function children3(node2, name) {
58382
58836
  (v) => typeof v === "object" && v !== null ? v : {}
58383
58837
  );
58384
58838
  }
58385
- function num2(node2, attr6) {
58839
+ function num3(node2, attr6) {
58386
58840
  const raw2 = node2?.[`@_${attr6}`];
58387
58841
  if (raw2 === void 0 || raw2 === "") {
58388
58842
  return void 0;
@@ -58397,15 +58851,15 @@ function vec(node2, keys) {
58397
58851
  if (!node2) {
58398
58852
  return void 0;
58399
58853
  }
58400
- const [x, y, z2] = keys.map((k) => num2(node2, k));
58854
+ const [x, y, z2] = keys.map((k) => num3(node2, k));
58401
58855
  if (x === void 0 && y === void 0 && z2 === void 0) {
58402
58856
  return void 0;
58403
58857
  }
58404
58858
  return { x: x ?? 0, y: y ?? 0, z: z2 ?? 0 };
58405
58859
  }
58406
58860
  function ratio(node2) {
58407
- const n = num2(node2, "n");
58408
- const d = num2(node2, "d");
58861
+ const n = num3(node2, "n");
58862
+ const d = num3(node2, "d");
58409
58863
  if (n === void 0 || d === void 0 || d === 0) {
58410
58864
  return void 0;
58411
58865
  }
@@ -58421,7 +58875,7 @@ function colour2(node2) {
58421
58875
  const scrgb = child9(clr, "a:scrgbClr");
58422
58876
  if (scrgb) {
58423
58877
  const chan = (a) => {
58424
- const pct = Math.min(1e5, Math.max(0, num2(scrgb, a) ?? 0)) / 1e5;
58878
+ const pct = Math.min(1e5, Math.max(0, num3(scrgb, a) ?? 0)) / 1e5;
58425
58879
  return Math.round(pct * 255).toString(16).padStart(2, "0");
58426
58880
  };
58427
58881
  return `#${chan("r")}${chan("g")}${chan("b")}`;
@@ -58434,14 +58888,14 @@ function parseCamera(node2) {
58434
58888
  }
58435
58889
  const ortho = am(node2, "orthographic");
58436
58890
  const persp = am(node2, "perspective");
58437
- const fov = num2(persp, "fov");
58891
+ const fov = num3(persp, "fov");
58438
58892
  return {
58439
58893
  position: point(am(node2, "pos")),
58440
58894
  up: delta(am(node2, "up")),
58441
58895
  lookAt: point(am(node2, "lookAt")),
58442
58896
  projection: ortho && !persp ? "orthographic" : "perspective",
58443
58897
  ...fov !== void 0 ? { fovDeg: fov / ANGLE_UNIT } : {},
58444
- ...ortho ? { orthoScale: num2(ortho, "sx") ?? num2(ortho, "scale") } : {}
58898
+ ...ortho ? { orthoScale: num3(ortho, "sx") ?? num3(ortho, "scale") } : {}
58445
58899
  };
58446
58900
  }
58447
58901
  function parseTransform2(node2) {
@@ -58453,7 +58907,7 @@ function parseTransform2(node2) {
58453
58907
  const sx = ratio(am(scaleNode, "sx"));
58454
58908
  const sy = ratio(am(scaleNode, "sy"));
58455
58909
  const sz = ratio(am(scaleNode, "sz"));
58456
- const angle = (a) => (num2(rot, a) ?? 0) / ANGLE_UNIT;
58910
+ const angle = (a) => (num3(rot, a) ?? 0) / ANGLE_UNIT;
58457
58911
  return {
58458
58912
  meterPerModelUnit: ratio(am(node2, "meterPerModelUnit")),
58459
58913
  preTranslate: delta(am(node2, "preTrans")),
@@ -58466,7 +58920,7 @@ function parseLights(model3d) {
58466
58920
  const lights = [];
58467
58921
  for (const [tag, kind] of LIGHT_TAGS) {
58468
58922
  for (const node2 of [...children3(model3d, `am3d:${tag}`), ...children3(model3d, tag)]) {
58469
- const spot = num2(am(node2, "spotAngle"), "angle") ?? num2(node2, "angle") ?? num2(node2, "spotAngle");
58923
+ const spot = num3(am(node2, "spotAngle"), "angle") ?? num3(node2, "angle") ?? num3(node2, "spotAngle");
58470
58924
  lights.push({
58471
58925
  kind,
58472
58926
  color: colour2(node2),
@@ -58483,7 +58937,7 @@ function parseModel3DScene(model3d) {
58483
58937
  const camera = parseCamera(am(model3d, "camera"));
58484
58938
  const transform8 = parseTransform2(am(model3d, "trans"));
58485
58939
  const lights = parseLights(model3d);
58486
- const viewportSizeEmu = num2(am(model3d, "objViewport"), "viewportSz");
58940
+ const viewportSizeEmu = num3(am(model3d, "objViewport"), "viewportSz");
58487
58941
  if (!camera && !transform8 && lights.length === 0) {
58488
58942
  return void 0;
58489
58943
  }
@@ -68194,8 +68648,8 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
68194
68648
  }
68195
68649
  continue;
68196
68650
  }
68197
- const span = oldText.slice(start, end);
68198
- if (span.length !== mention.length) {
68651
+ const span2 = oldText.slice(start, end);
68652
+ if (span2.length !== mention.length) {
68199
68653
  continue;
68200
68654
  }
68201
68655
  let next = -1;
@@ -68204,11 +68658,11 @@ function rebaseCommentMentions(mentions, oldText, newText, loaded) {
68204
68658
  } else if (start >= changeEnd) {
68205
68659
  next = start + delta2;
68206
68660
  }
68207
- if (next >= 0 && newText.slice(next, next + mention.length) === span) {
68661
+ if (next >= 0 && newText.slice(next, next + mention.length) === span2) {
68208
68662
  result.push(next === start ? mention : { ...mention, startIndex: next });
68209
68663
  continue;
68210
68664
  }
68211
- const relocated = nearestOccurrence(newText, span, next >= 0 ? next : start);
68665
+ const relocated = nearestOccurrence(newText, span2, next >= 0 ? next : start);
68212
68666
  if (relocated >= 0) {
68213
68667
  result.push({ ...mention, startIndex: relocated });
68214
68668
  }
@@ -68268,17 +68722,17 @@ var init_modern_comment_mentions = __esm({
68268
68722
  }
68269
68723
  return index2;
68270
68724
  };
68271
- nearestOccurrence = (text2, span, hint) => {
68725
+ nearestOccurrence = (text2, span2, hint) => {
68272
68726
  let best = -1;
68273
68727
  let bestDistance = Number.POSITIVE_INFINITY;
68274
- let at2 = text2.indexOf(span);
68728
+ let at2 = text2.indexOf(span2);
68275
68729
  while (at2 !== -1) {
68276
68730
  const distance = Math.abs(at2 - hint);
68277
68731
  if (distance < bestDistance) {
68278
68732
  best = at2;
68279
68733
  bestDistance = distance;
68280
68734
  }
68281
- at2 = text2.indexOf(span, at2 + 1);
68735
+ at2 = text2.indexOf(span2, at2 + 1);
68282
68736
  }
68283
68737
  return best;
68284
68738
  };
@@ -71737,7 +72191,15 @@ var init_PptxSlideBackgroundBuilder = __esm({
71737
72191
  init.reportUnsupportedBackground?.(rawBackgroundImage);
71738
72192
  }
71739
72193
  }
71740
- if (backgroundProperties["a:blipFill"] === void 0 && hasBackgroundColor && init.slide.backgroundColor) {
72194
+ if (backgroundProperties["a:blipFill"] === void 0 && hasBackgroundGradient) {
72195
+ const gradFill2 = init.buildBackgroundGradientFill?.();
72196
+ if (gradFill2) {
72197
+ backgroundProperties["a:gradFill"] = gradFill2;
72198
+ } else if (!hasBackgroundColor && !hasBackgroundImage) {
72199
+ init.reportUnsupportedGradient?.();
72200
+ }
72201
+ }
72202
+ if (backgroundProperties["a:blipFill"] === void 0 && backgroundProperties["a:gradFill"] === void 0 && hasBackgroundColor && init.slide.backgroundColor) {
71741
72203
  backgroundProperties["a:solidFill"] = {
71742
72204
  "a:srgbClr": {
71743
72205
  "@_val": init.slide.backgroundColor.replace("#", "").toUpperCase()
@@ -74795,6 +75257,10 @@ function applyCellFillStyle(cellProperties, style, context, slidePath) {
74795
75257
  }
74796
75258
  return hasStyle;
74797
75259
  }
75260
+ function presetDashValue(value) {
75261
+ const text2 = typeof value === "string" || typeof value === "number" ? String(value) : "";
75262
+ return text2 ? text2 : void 0;
75263
+ }
74798
75264
  function applyCellBorderStyle(cellProperties, style, context) {
74799
75265
  if (!cellProperties) {
74800
75266
  return false;
@@ -74832,13 +75298,13 @@ function applyCellBorderStyle(cellProperties, style, context) {
74832
75298
  style[`${prefix}Color`] = color3;
74833
75299
  hasStyle = true;
74834
75300
  }
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;
75301
+ const dash = parseDrawingLineDash(node2, presetDashValue);
75302
+ if (dash.strokeDash) {
75303
+ style[`${prefix}Dash`] = dash.strokeDash;
75304
+ if (dash.strokeDash === "custom") {
75305
+ style[`${prefix}DashSegments`] = dash.customDashSegments;
74841
75306
  }
75307
+ hasStyle = true;
74842
75308
  }
74843
75309
  }
74844
75310
  const firstBorderColor = style.borderTopColor || style.borderBottomColor || style.borderLeftColor || style.borderRightColor;
@@ -74930,6 +75396,7 @@ var init_table_cell_fill_border_helpers = __esm({
74930
75396
  "pptx/core/core/builders/table-cell-fill-border-helpers.ts"() {
74931
75397
  init_theme_color_ref();
74932
75398
  init_color_xml_preservation();
75399
+ init_drawing_line_dash();
74933
75400
  }
74934
75401
  });
74935
75402
 
@@ -76625,8 +77092,8 @@ function decodeAinkInk(inkRoot) {
76625
77092
  if (raw2.length === 0) {
76626
77093
  return 2;
76627
77094
  }
76628
- const num4 = Number(raw2);
76629
- return Number.isFinite(num4) && num4 > 0 ? num4 : 2;
77095
+ const num5 = Number(raw2);
77096
+ return Number.isFinite(num5) && num5 > 0 ? num5 : 2;
76630
77097
  })();
76631
77098
  const traces = ensureArrayLike3(inkRoot["aink:trace"]);
76632
77099
  for (const trace of traces) {
@@ -78787,9 +79254,9 @@ async function ensureCustomPropertiesPackagingArtifacts(context) {
78787
79254
  let maxId = 0;
78788
79255
  for (const rel of rels) {
78789
79256
  const id = String(rel?.["@_Id"] || "");
78790
- const num4 = Number.parseInt(id.replace(/^rId/, ""), 10);
78791
- if (Number.isFinite(num4) && num4 > maxId) {
78792
- maxId = num4;
79257
+ const num5 = Number.parseInt(id.replace(/^rId/, ""), 10);
79258
+ if (Number.isFinite(num5) && num5 > maxId) {
79259
+ maxId = num5;
78793
79260
  }
78794
79261
  }
78795
79262
  rels.push({
@@ -78874,11 +79341,11 @@ var init_PptxDocumentPropertiesUpdater = __esm({
78874
79341
  this.context = context;
78875
79342
  }
78876
79343
  async updateOnSave(slides, options2) {
78877
- await this.updateCoreProperties(options2?.coreProperties);
79344
+ await this.updateCoreProperties(options2?.coreProperties, options2?.fixedDate);
78878
79345
  await this.updateAppProperties(slides, options2?.appProperties);
78879
79346
  await this.updateCustomProperties(options2?.customProperties);
78880
79347
  }
78881
- async updateCoreProperties(overrides) {
79348
+ async updateCoreProperties(overrides, fixedDate) {
78882
79349
  const coreFile = this.context.zip.file("docProps/core.xml");
78883
79350
  if (!coreFile) {
78884
79351
  return;
@@ -78887,7 +79354,12 @@ var init_PptxDocumentPropertiesUpdater = __esm({
78887
79354
  const coreXml = await coreFile.async("string");
78888
79355
  const core = applyCoreOverrides(parseCoreProperties(coreXml), overrides);
78889
79356
  const revision = Number.parseInt(core.revision?.trim() ?? "", 10);
78890
- const next = {
79357
+ const next = fixedDate ? {
79358
+ ...core,
79359
+ revision: overrides?.revision ?? "1",
79360
+ created: overrides?.created ?? formatW3cdtf(fixedDate),
79361
+ modified: overrides?.modified ?? formatW3cdtf(fixedDate)
79362
+ } : {
78891
79363
  ...core,
78892
79364
  revision: String(Number.isFinite(revision) && revision >= 0 ? revision + 1 : 1),
78893
79365
  modified: formatW3cdtf(/* @__PURE__ */ new Date())
@@ -105661,14 +106133,14 @@ function valXml(local, value) {
105661
106133
  const text2 = typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? chartNumber(value) : escapeAttribute(value);
105662
106134
  return `<c:${local} val="${text2}"/>`;
105663
106135
  }
105664
- function sameValue(left, right) {
106136
+ function sameValue2(left, right) {
105665
106137
  if (left === right) return true;
105666
106138
  if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
105667
106139
  if (Array.isArray(left) !== Array.isArray(right)) return false;
105668
106140
  const entries = (value) => Object.entries(value).filter(([, item2]) => item2 !== void 0);
105669
106141
  const a = entries(left);
105670
106142
  const b = new Map(entries(right));
105671
- return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue(item2, b.get(key2)));
106143
+ return a.length === b.size && a.every(([key2, item2]) => b.has(key2) && sameValue2(item2, b.get(key2)));
105672
106144
  }
105673
106145
  var INVALID_XML, escapeText2, escapeAttribute, elementXml2, raw;
105674
106146
  var init_write_util = __esm({
@@ -106414,13 +106886,13 @@ function chartFillXml(fill3) {
106414
106886
  }
106415
106887
  function patchShape(root, shape2, read) {
106416
106888
  const doc = root.ownerDocument;
106417
- if (!sameValue(read.fill, shape2.fill)) {
106889
+ if (!sameValue2(read.fill, shape2.fill)) {
106418
106890
  const xml = shape2.fill && chartFillXml(shape2.fill);
106419
106891
  if (xml) setDrawingFillXml(root, xml);
106420
106892
  else if (!shape2.fill)
106421
106893
  for (let fill3 = fillElementOf(root); fill3; fill3 = fillElementOf(root)) root.removeChild(fill3);
106422
106894
  }
106423
- if (!sameValue(read.line, shape2.line)) {
106895
+ if (!sameValue2(read.line, shape2.line)) {
106424
106896
  let ln = first(root, "ln", NS.a);
106425
106897
  if (!shape2.line) {
106426
106898
  if (ln) root.removeChild(ln);
@@ -106452,7 +106924,7 @@ function shapePropertiesInnerXml(context, shape2) {
106452
106924
  if (sourceXml !== void 0) {
106453
106925
  const root = wrap("spPr", sourceXml);
106454
106926
  const read = readShapeFields(root);
106455
- if (sameValue(read, fields)) inner = sourceXml;
106927
+ if (sameValue2(read, fields)) inner = sourceXml;
106456
106928
  else {
106457
106929
  patchShape(root, fields, read);
106458
106930
  inner = innerXml(root);
@@ -106467,14 +106939,14 @@ function textBodyInnerXml(context, body) {
106467
106939
  const { sourceXml, ...fields } = body;
106468
106940
  if (sourceXml !== void 0) {
106469
106941
  const read = parseDrawingTextBody(wrap("txPr", sourceXml));
106470
- if (sameValue(read, fields)) return raw(context, sourceXml);
106942
+ if (sameValue2(read, fields)) return raw(context, sourceXml);
106471
106943
  }
106472
106944
  return raw(context, writeTextBody(fields));
106473
106945
  }
106474
106946
  function layoutXml(context, value) {
106475
106947
  if (!value) return "";
106476
106948
  const { sourceXml, ...layout } = value;
106477
- if (sourceXml !== void 0 && sameValue(readLayoutFields(wrap("layout", sourceXml)), layout))
106949
+ if (sourceXml !== void 0 && sameValue2(readLayoutFields(wrap("layout", sourceXml)), layout))
106478
106950
  return elementXml2("layout", raw(context, sourceXml));
106479
106951
  const manual = LAYOUT_FIELDS.map(([local, key2]) => {
106480
106952
  const value2 = layout[key2];
@@ -109764,7 +110236,16 @@ function repaintSeriesForFamily(series, toLine) {
109764
110236
  shape2.fill = structuredClone(shape2.line.fill);
109765
110237
  }
109766
110238
  function clearPointPaint(series, key2) {
109767
- for (const point2 of series.dataPoints) if (point2.spPr) delete point2.spPr[key2];
110239
+ const emptied2 = (part) => Object.keys(part).every((name) => name === "sourceXml");
110240
+ for (const point2 of series.dataPoints) {
110241
+ if (!point2.spPr) continue;
110242
+ delete point2.spPr[key2];
110243
+ if (point2.spPr.line && emptied2(point2.spPr.line)) delete point2.spPr.line;
110244
+ if (emptied2(point2.spPr)) delete point2.spPr;
110245
+ }
110246
+ series.dataPoints = series.dataPoints.filter(
110247
+ (point2) => Object.keys(point2).some((name) => name !== "index")
110248
+ );
109768
110249
  }
109769
110250
  function setChartSeriesFill(space, index2, fill3) {
109770
110251
  return editChartSpace(space, (draft) => {
@@ -109773,7 +110254,7 @@ function setChartSeriesFill(space, index2, fill3) {
109773
110254
  clearPointPaint(series, "fill");
109774
110255
  });
109775
110256
  }
109776
- function setChartSeriesColor(space, index2, color3) {
110257
+ function setChartSeriesColor(space, index2, color3, options2 = {}) {
109777
110258
  return editChartSpace(space, (draft) => {
109778
110259
  const { series } = chartSeriesEntryAt(draft, index2);
109779
110260
  const shape2 = series.spPr ??= {};
@@ -109783,7 +110264,7 @@ function setChartSeriesColor(space, index2, color3) {
109783
110264
  const fill3 = color3 ? { kind: "solid", color: withAlphaOf(color3, previous) } : void 0;
109784
110265
  if (line2) assignOrDelete(shape2.line ??= {}, "fill", fill3);
109785
110266
  else assignOrDelete(shape2, "fill", fill3);
109786
- clearPointPaint(series, line2 ? "line" : "fill");
110267
+ if (!options2.keepPointColors) clearPointPaint(series, line2 ? "line" : "fill");
109787
110268
  });
109788
110269
  }
109789
110270
  var paintsLine, painted;
@@ -111196,7 +111677,7 @@ var init_type_axes = __esm({
111196
111677
  });
111197
111678
 
111198
111679
  // chart/edit/type.ts
111199
- function elementFor(kind, is3D) {
111680
+ function chartGroupElement(kind, is3D) {
111200
111681
  const match = Object.entries(CHART_GROUP_ELEMENTS).find(
111201
111682
  ([, value]) => value.kind === kind && value.is3D === is3D
111202
111683
  );
@@ -111211,7 +111692,7 @@ function groupingFor(element2, grouping) {
111211
111692
  }
111212
111693
  function newGroup(base2, target, series) {
111213
111694
  const is3D = target.is3D ?? (base2.is3D && SWITCHABLE[target.kind] === true);
111214
- const element2 = elementFor(target.kind, is3D);
111695
+ const element2 = chartGroupElement(target.kind, is3D);
111215
111696
  const group = { kind: target.kind, element: element2, is3D, series, axisIds: [] };
111216
111697
  const allowed = GROUP_FIELDS[element2] ?? [];
111217
111698
  for (const key2 of allowed)
@@ -111420,6 +111901,11 @@ var init_target = __esm({
111420
111901
  });
111421
111902
 
111422
111903
  // chart/edit/group-options.ts
111904
+ function assertChartGroupOption(key2, value) {
111905
+ const [min, max] = RANGES[key2];
111906
+ if (!Number.isInteger(value) || value < min || value > max)
111907
+ throw new RangeError(`Chart ${key2} must be a whole number from ${min} to ${max}`);
111908
+ }
111423
111909
  function setChartGroupOptions2(space, seriesIndex, edit) {
111424
111910
  return editChartSpace(space, (draft) => {
111425
111911
  const { group } = chartSeriesEntryAt(draft, seriesIndex);
@@ -111432,9 +111918,7 @@ function setChartGroupOptions2(space, seriesIndex, edit) {
111432
111918
  delete group[key2];
111433
111919
  continue;
111434
111920
  }
111435
- const [min, max] = RANGES[key2];
111436
- if (!Number.isInteger(value) || value < min || value > max)
111437
- throw new RangeError(`Chart ${key2} must be a whole number from ${min} to ${max}`);
111921
+ assertChartGroupOption(key2, value);
111438
111922
  group[key2] = value;
111439
111923
  }
111440
111924
  });
@@ -113003,44 +113487,6 @@ var init_chart2 = __esm({
113003
113487
  }
113004
113488
  });
113005
113489
 
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
113490
  // pptx/core/utils/chart-from-neutral-labels.ts
113045
113491
  function setOrRemove(target, key2, value) {
113046
113492
  if (value === void 0) delete target[key2];
@@ -113181,8 +113627,8 @@ function titleText(title) {
113181
113627
  }
113182
113628
  function scalingFromNeutral(axis, out) {
113183
113629
  const { scaling } = axis;
113184
- setOrRemove(out, "min", finite3(scaling.min));
113185
- setOrRemove(out, "max", finite3(scaling.max));
113630
+ setOrRemove(out, "min", finite4(scaling.min));
113631
+ setOrRemove(out, "max", finite4(scaling.max));
113186
113632
  const logBase = scaling.logBase !== void 0 && scaling.logBase > 0 ? scaling.logBase : void 0;
113187
113633
  setOrRemove(out, "logBase", logBase);
113188
113634
  setOrRemove(out, "logScale", logBase !== void 0 ? true : void 0);
@@ -113194,7 +113640,7 @@ function labelsFromNeutral(axis, out) {
113194
113640
  setOrRemove(out, "minorTickMark", oneOf(TICK_MARKS2, axis.minorTickMark));
113195
113641
  setOrRemove(out, "tickLblPos", oneOf(["high", "low", "nextTo", "none"], axis.tickLabelPosition));
113196
113642
  setOrRemove(out, "crosses", oneOf(["autoZero", "min", "max"], axis.crosses));
113197
- setOrRemove(out, "crossesAt", finite3(axis.crossesAt));
113643
+ setOrRemove(out, "crossesAt", finite4(axis.crossesAt));
113198
113644
  const valueAxis = type === "valAx";
113199
113645
  const categoryOrDate = type === "catAx" || type === "dateAx";
113200
113646
  const skips = type === "catAx" || type === "serAx";
@@ -113248,8 +113694,8 @@ function axisFromNeutral(axis, out) {
113248
113694
  setOrRemove(out, "displayUnits", custom2 ? "custom" : builtIn);
113249
113695
  setOrRemove(out, "displayUnitsValue", custom2 || void 0);
113250
113696
  }
113251
- setOrRemove(out, "majorUnit", finite3(axis.majorUnit));
113252
- setOrRemove(out, "minorUnit", finite3(axis.minorUnit));
113697
+ setOrRemove(out, "majorUnit", finite4(axis.majorUnit));
113698
+ setOrRemove(out, "minorUnit", finite4(axis.minorUnit));
113253
113699
  setOrRemove(
113254
113700
  out,
113255
113701
  "baseTimeUnit",
@@ -113270,12 +113716,12 @@ function axesFromNeutral(axes, styled) {
113270
113716
  );
113271
113717
  });
113272
113718
  }
113273
- var oneOf, finite3, positiveInteger, TICK_MARKS2, TIME_UNITS2, BUILT_IN_UNITS2;
113719
+ var oneOf, finite4, positiveInteger, TICK_MARKS2, TIME_UNITS2, BUILT_IN_UNITS2;
113274
113720
  var init_chart_from_neutral_axes = __esm({
113275
113721
  "pptx/core/utils/chart-from-neutral-axes.ts"() {
113276
113722
  init_chart_from_neutral_labels();
113277
113723
  oneOf = (values, value) => value !== void 0 && values.includes(value) ? value : void 0;
113278
- finite3 = (value) => value !== void 0 && Number.isFinite(value) ? value : void 0;
113724
+ finite4 = (value) => value !== void 0 && Number.isFinite(value) ? value : void 0;
113279
113725
  positiveInteger = (value) => value !== void 0 && Number.isInteger(value) && value > 0 ? value : void 0;
113280
113726
  TICK_MARKS2 = ["cross", "in", "none", "out"];
113281
113727
  TIME_UNITS2 = ["days", "months", "years"];
@@ -120368,16 +120814,16 @@ function tableToShapeGroup(tableData, bounds) {
120368
120814
  const y = bounds.y + rowIndex * rowHeightEmu;
120369
120815
  let colIndex = 0;
120370
120816
  for (const cell2 of row.cells) {
120371
- const span = Math.max(1, cell2.gridSpan ?? 1);
120817
+ const span2 = Math.max(1, cell2.gridSpan ?? 1);
120372
120818
  if (cell2.vMerge) {
120373
120819
  vMergeActive[colIndex] = true;
120374
- colIndex += span;
120820
+ colIndex += span2;
120375
120821
  continue;
120376
120822
  }
120377
120823
  vMergeActive[colIndex] = false;
120378
120824
  if (!cell2.hMerge) {
120379
120825
  const x = colStartX[colIndex] ?? bounds.x;
120380
- const w = colEmuWidths.slice(colIndex, colIndex + span).reduce((s, v) => s + v, 0);
120826
+ const w = colEmuWidths.slice(colIndex, colIndex + span2).reduce((s, v) => s + v, 0);
120381
120827
  children16.push({
120382
120828
  kind: "shape",
120383
120829
  spt: 1,
@@ -120391,7 +120837,7 @@ function tableToShapeGroup(tableData, bounds) {
120391
120837
  text: { textType: 4, paragraphs: cellParagraphs(cell2.text) }
120392
120838
  });
120393
120839
  }
120394
- colIndex += span;
120840
+ colIndex += span2;
120395
120841
  }
120396
120842
  });
120397
120843
  return { kind: "group", anchor: bounds, children: children16 };
@@ -124010,7 +124456,7 @@ async function readSlideMasterPaths(zip) {
124010
124456
  }
124011
124457
  return paths;
124012
124458
  }
124013
- function num3(xml, pattern) {
124459
+ function num4(xml, pattern) {
124014
124460
  const value = pattern.exec(xml)?.[1];
124015
124461
  return value === void 0 ? void 0 : Number(value);
124016
124462
  }
@@ -124022,14 +124468,14 @@ function readPlaceholders(masterXml) {
124022
124468
  continue;
124023
124469
  }
124024
124470
  const kind = PLACEHOLDER_KINDS[/\btype="([^"]+)"/u.exec(phType)?.[1] ?? "body"];
124025
- const x = num3(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
124026
- const y = num3(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
124027
- const w = num3(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
124028
- const h2 = num3(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
124471
+ const x = num4(sp, /<a:off\b[^>]*\bx="(-?\d+)"/u);
124472
+ const y = num4(sp, /<a:off\b[^>]*\by="(-?\d+)"/u);
124473
+ const w = num4(sp, /<a:ext\b[^>]*\bcx="(\d+)"/u);
124474
+ const h2 = num4(sp, /<a:ext\b[^>]*\bcy="(\d+)"/u);
124029
124475
  if (!kind || x === void 0 || y === void 0 || !w || !h2 || out.some((p2) => p2.kind === kind)) {
124030
124476
  continue;
124031
124477
  }
124032
- const size = num3(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
124478
+ const size = num4(sp, /<a:lvl1pPr\b[\s\S]*?<a:defRPr\b[^>]*\bsz="(\d+)"/u);
124033
124479
  out.push({ kind, rect: { x, y, w, h: h2 }, ...size ? { sizePt: size / 100 } : {} });
124034
124480
  }
124035
124481
  return out;
@@ -130772,6 +131218,10 @@ var init_chart_neutral_save_chrome = __esm({
130772
131218
  });
130773
131219
 
130774
131220
  // pptx/core/utils/chart-neutral-save-points.ts
131221
+ function pointShape(shape2) {
131222
+ if (shape2.line && emptied(shape2.line)) delete shape2.line;
131223
+ return emptied(shape2) ? null : shape2;
131224
+ }
130775
131225
  function pointEdit(edits, seriesIndex, old, next) {
130776
131226
  for (const key2 of ["picture", "impliedPicture", "uniqueId"])
130777
131227
  if (!same6(old?.[key2], next[key2])) return false;
@@ -130794,6 +131244,7 @@ function pointEdit(edits, seriesIndex, old, next) {
130794
131244
  ) ?? null
130795
131245
  });
130796
131246
  }
131247
+ if (edit.spPr) edit.spPr = pointShape(edit.spPr);
130797
131248
  if (!same6(old?.marker, next.marker)) {
130798
131249
  if (!next.marker) edit.marker = null;
130799
131250
  else {
@@ -130836,6 +131287,7 @@ function planNeutralChartPoints(before, probe, edits) {
130836
131287
  series.dataPoints = previous.dataPoints;
130837
131288
  });
130838
131289
  }
131290
+ var emptied;
130839
131291
  var init_chart_neutral_save_points = __esm({
130840
131292
  "pptx/core/utils/chart-neutral-save-points.ts"() {
130841
131293
  init_chart2();
@@ -130843,6 +131295,7 @@ var init_chart_neutral_save_points = __esm({
130843
131295
  init_chart_neutral_save_common();
130844
131296
  init_chart_neutral_save_shape();
130845
131297
  init_chart_container_type_map();
131298
+ emptied = (part) => Object.keys(part).every((key2) => key2 === "sourceXml");
130846
131299
  }
130847
131300
  });
130848
131301
 
@@ -131058,7 +131511,9 @@ function planNeutralChartSeriesColors(before, probe, edits) {
131058
131511
  const value = series.color?.replace(/^#/, "");
131059
131512
  if (value !== void 0 && !/^[\da-f]{6}$/i.test(value)) return;
131060
131513
  edits.push(
131061
- (space) => setChartSeriesColor(space, index2, value ? { kind: "srgb", value, transforms: [] } : null)
131514
+ (space) => setChartSeriesColor(space, index2, value ? { kind: "srgb", value, transforms: [] } : null, {
131515
+ keepPointColors: true
131516
+ })
131062
131517
  );
131063
131518
  if (previous.color === void 0) delete series.color;
131064
131519
  else series.color = previous.color;
@@ -132510,26 +132965,26 @@ function buildImgEffects(effects2) {
132510
132965
  if (effects2.backgroundRemoval) {
132511
132966
  out.push({ "a14:backgroundRemoval": buildBackgroundRemovalNode(effects2.backgroundRemoval) });
132512
132967
  }
132513
- if (finite4(effects2.sharpenSoften?.amount)) {
132968
+ if (finite5(effects2.sharpenSoften?.amount)) {
132514
132969
  out.push({ "a14:sharpenSoften": { "@_amount": round4(effects2.sharpenSoften.amount) } });
132515
132970
  }
132516
132971
  const bc = effects2.brightnessContrast;
132517
- if (bc && (finite4(bc.bright) || finite4(bc.contrast))) {
132972
+ if (bc && (finite5(bc.bright) || finite5(bc.contrast))) {
132518
132973
  const node2 = {};
132519
- if (finite4(bc.bright)) {
132974
+ if (finite5(bc.bright)) {
132520
132975
  node2["@_bright"] = round4(bc.bright);
132521
132976
  }
132522
- if (finite4(bc.contrast)) {
132977
+ if (finite5(bc.contrast)) {
132523
132978
  node2["@_contrast"] = round4(bc.contrast);
132524
132979
  }
132525
132980
  out.push({ "a14:brightnessContrast": node2 });
132526
132981
  }
132527
- if (finite4(effects2.colorTemperature?.colorTemp)) {
132982
+ if (finite5(effects2.colorTemperature?.colorTemp)) {
132528
132983
  out.push({
132529
132984
  "a14:colorTemperature": { "@_colorTemp": round4(effects2.colorTemperature.colorTemp) }
132530
132985
  });
132531
132986
  }
132532
- if (finite4(effects2.colorSaturation?.sat)) {
132987
+ if (finite5(effects2.colorSaturation?.sat)) {
132533
132988
  out.push({ "a14:saturation": { "@_sat": round4(effects2.colorSaturation.sat) } });
132534
132989
  }
132535
132990
  const artistic = a14ArtisticElementName(effects2.artisticEffect);
@@ -132579,7 +133034,7 @@ function applyA14ImageExtension(blip, effects2) {
132579
133034
  extLst[extKey] = entries.length === 1 ? entries[0] : entries;
132580
133035
  blip[extLstKey] = extLst;
132581
133036
  }
132582
- var GALLERY_TO_A14, round4, finite4;
133037
+ var GALLERY_TO_A14, round4, finite5;
132583
133038
  var init_image_a14_effects_writer = __esm({
132584
133039
  "pptx/core/core/runtime/image-a14-effects-writer.ts"() {
132585
133040
  init_image_a14_effects();
@@ -132612,7 +133067,7 @@ var init_image_a14_effects_writer = __esm({
132612
133067
  watercolorSponge: "artisticWatercolorSponge"
132613
133068
  };
132614
133069
  round4 = (value) => String(Math.round(value));
132615
- finite4 = (value) => typeof value === "number" && Number.isFinite(value);
133070
+ finite5 = (value) => typeof value === "number" && Number.isFinite(value);
132616
133071
  }
132617
133072
  });
132618
133073
 
@@ -134174,8 +134629,8 @@ function renderBars(element2, x, y, w, h2) {
134174
134629
  const values = chartValues(element2);
134175
134630
  const min = Math.min(0, ...values);
134176
134631
  const max = Math.max(0, ...values);
134177
- const span = max - min || 1;
134178
- const zeroY = y + max / span * h2;
134632
+ const span2 = max - min || 1;
134633
+ const zeroY = y + max / span2 * h2;
134179
134634
  const categoryCount = Math.max(
134180
134635
  data.categories.length,
134181
134636
  ...data.series.map((s) => s.values.length),
@@ -134186,7 +134641,7 @@ function renderBars(element2, x, y, w, h2) {
134186
134641
  const parts = [`<line x1="${x}" y1="${zeroY}" x2="${x + w}" y2="${zeroY}" stroke="#666666" />`];
134187
134642
  data.series.forEach((series, seriesIndex) => {
134188
134643
  series.values.forEach((value, categoryIndex) => {
134189
- const valueY = y + (max - value) / span * h2;
134644
+ const valueY = y + (max - value) / span2 * h2;
134190
134645
  parts.push(
134191
134646
  `<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
134647
  );
@@ -134199,10 +134654,10 @@ function renderLines(element2, x, y, w, h2) {
134199
134654
  const values = chartValues(element2);
134200
134655
  const min = Math.min(...values);
134201
134656
  const max = Math.max(...values);
134202
- const span = max - min || 1;
134657
+ const span2 = max - min || 1;
134203
134658
  return data.series.map((series, seriesIndex) => {
134204
134659
  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(" ");
134660
+ const points7 = series.values.map((value, index2) => `${x + index2 / denominator * w},${y + (max - value) / span2 * h2}`).join(" ");
134206
134661
  return `<polyline data-chart-mark="line" points="${points7}" fill="none" stroke="${esc3(color2(series, seriesIndex))}" stroke-width="2" />`;
134207
134662
  }).join("");
134208
134663
  }
@@ -139238,6 +139693,17 @@ var init_save_group_fill = __esm({
139238
139693
  });
139239
139694
 
139240
139695
  // pptx/core/core/runtime/save-shape-xml-frames.ts
139696
+ function tableGridXml(el, widthEmu) {
139697
+ const fractions = el.tableData?.columnWidths ?? [];
139698
+ if (fractions.length === 0 || !(widthEmu > 0)) {
139699
+ return {};
139700
+ }
139701
+ const widths = fractions.map((fraction) => Math.max(0, Math.round(fraction * widthEmu)));
139702
+ const last = widths.length - 1;
139703
+ widths[last] = Math.max(0, (widths[last] ?? 0) + widthEmu - widths.reduce((a, b) => a + b, 0));
139704
+ const cols = widths.map((w) => ({ "@_w": String(w) }));
139705
+ return { "a:gridCol": cols.length === 1 ? cols[0] : cols };
139706
+ }
139241
139707
  function buildTableGraphicFrameXml(el, emuPerPx) {
139242
139708
  el.locks = { noGrouping: true, ...el.locks };
139243
139709
  const offX = String(Math.round(el.x * emuPerPx));
@@ -139268,7 +139734,7 @@ function buildTableGraphicFrameXml(el, emuPerPx) {
139268
139734
  "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
139269
139735
  "a:tbl": {
139270
139736
  "a:tblPr": tblPr,
139271
- "a:tblGrid": {}
139737
+ "a:tblGrid": tableGridXml(el, Number(extCx))
139272
139738
  }
139273
139739
  }
139274
139740
  }
@@ -139645,11 +140111,31 @@ var init_PptxHandlerRuntimeSaveShapeXml = __esm({
139645
140111
  * default) is correct at depth 0. See `group-xfrm-preservation.ts`'s
139646
140112
  * module doc for why a nested group must not re-derive this itself.
139647
140113
  */
140114
+ /**
140115
+ * `PptxHandlerSaveOptions.fixedDate` of the save in progress: set, the save
140116
+ * mints reproducible ids and names (new table columns' `a16:colId`, the
140117
+ * fallback name of a new group) instead of random or time-based ones.
140118
+ */
140119
+ saveFixedDate;
140120
+ /**
140121
+ * The `p:cNvPr/@name` of a group with neither a name nor one from its
140122
+ * file: its element id, or for a reproducible save (`fixedDate`), which
140123
+ * must not depend on the time-based ids of elements made in code,
140124
+ * `Group <shape id>` as PowerPoint names groups.
140125
+ */
140126
+ groupFallbackName(group) {
140127
+ return this.saveFixedDate ? `Group ${group.shapeId ?? ""}`.trim() : group.id;
140128
+ }
139648
140129
  buildGroupShapeXml(group, ctx, ownEmuOverride) {
139649
140130
  if (group.rawXml && group.children.length === 0) {
139650
140131
  return {
139651
140132
  ...group.rawXml,
139652
- "p:nvGrpSpPr": buildGroupNonVisualXml(group.rawXml, group.name, group.id, group.shapeId)
140133
+ "p:nvGrpSpPr": buildGroupNonVisualXml(
140134
+ group.rawXml,
140135
+ group.name,
140136
+ this.groupFallbackName(group),
140137
+ group.shapeId
140138
+ )
139653
140139
  };
139654
140140
  }
139655
140141
  const EMU = _PptxHandlerRuntime.EMU_PER_PX;
@@ -139658,7 +140144,12 @@ var init_PptxHandlerRuntimeSaveShapeXml = __esm({
139658
140144
  const xfrm = buildGroupTransformXml(group, EMU, ownEmuOverride, rewrap);
139659
140145
  const childSpace = group;
139660
140146
  const grpXml2 = {
139661
- "p:nvGrpSpPr": buildGroupNonVisualXml(rawGroupXml, group.name, group.id, group.shapeId),
140147
+ "p:nvGrpSpPr": buildGroupNonVisualXml(
140148
+ rawGroupXml,
140149
+ group.name,
140150
+ this.groupFallbackName(group),
140151
+ group.shapeId
140152
+ ),
139662
140153
  "p:grpSpPr": buildGroupPropertiesXml(rawGroupXml, xfrm)
139663
140154
  };
139664
140155
  const rawExtLst = rawGroupXml?.["p:extLst"];
@@ -141491,12 +141982,92 @@ var init_PptxHandlerRuntimeLayoutSwitching = __esm({
141491
141982
  }
141492
141983
  });
141493
141984
 
141985
+ // pptx/core/core/runtime/table-cell-border-save.ts
141986
+ function cellEdges(style) {
141987
+ return [
141988
+ {
141989
+ xmlKey: "a:lnT",
141990
+ width: style.borderTopWidth,
141991
+ color: style.borderTopColor,
141992
+ dash: style.borderTopDash,
141993
+ segments: style.borderTopDashSegments
141994
+ },
141995
+ {
141996
+ xmlKey: "a:lnB",
141997
+ width: style.borderBottomWidth,
141998
+ color: style.borderBottomColor,
141999
+ dash: style.borderBottomDash,
142000
+ segments: style.borderBottomDashSegments
142001
+ },
142002
+ {
142003
+ xmlKey: "a:lnL",
142004
+ width: style.borderLeftWidth,
142005
+ color: style.borderLeftColor,
142006
+ dash: style.borderLeftDash,
142007
+ segments: style.borderLeftDashSegments
142008
+ },
142009
+ {
142010
+ xmlKey: "a:lnR",
142011
+ width: style.borderRightWidth,
142012
+ color: style.borderRightColor,
142013
+ dash: style.borderRightDash,
142014
+ segments: style.borderRightDashSegments
142015
+ }
142016
+ ];
142017
+ }
142018
+ function writeEdgeDash(ln, edge) {
142019
+ if (edge.dash === void 0 || edge.dash === "") {
142020
+ return;
142021
+ }
142022
+ if (edge.dash === "solid") {
142023
+ delete ln["a:prstDash"];
142024
+ delete ln["a:custDash"];
142025
+ return;
142026
+ }
142027
+ if (edge.dash === "custom") {
142028
+ if (edge.segments && edge.segments.length > 0) {
142029
+ applyDrawingLineDash(ln, { strokeDash: "custom", customDashSegments: edge.segments });
142030
+ }
142031
+ return;
142032
+ }
142033
+ applyDrawingLineDash(ln, { strokeDash: edge.dash });
142034
+ }
142035
+ function writeCellEdgeBorders(tcPr, style, emuPerPx) {
142036
+ for (const edge of cellEdges(style)) {
142037
+ if (edge.width === void 0 && edge.color === void 0 && edge.dash === void 0) {
142038
+ continue;
142039
+ }
142040
+ const existing = tcPr[edge.xmlKey];
142041
+ const ln = existing && typeof existing === "object" ? existing : {};
142042
+ if (edge.width !== void 0) {
142043
+ ln["@_w"] = String(Math.round(edge.width * emuPerPx));
142044
+ }
142045
+ if (edge.color) {
142046
+ delete ln["a:noFill"];
142047
+ delete ln["a:gradFill"];
142048
+ delete ln["a:pattFill"];
142049
+ ln["a:solidFill"] = {
142050
+ "a:srgbClr": { "@_val": edge.color.replace("#", "") }
142051
+ };
142052
+ }
142053
+ writeEdgeDash(ln, edge);
142054
+ tcPr[edge.xmlKey] = reorderObjectKeys(ln, LN_CHILD_ORDER);
142055
+ }
142056
+ }
142057
+ var init_table_cell_border_save = __esm({
142058
+ "pptx/core/core/runtime/table-cell-border-save.ts"() {
142059
+ init_drawing_line_dash();
142060
+ init_xml_reorder();
142061
+ }
142062
+ });
142063
+
141494
142064
  // pptx/core/core/runtime/table-cell-save-helpers.ts
141495
142065
  function writeCellFill(tcPr, style, resolveColorXml) {
141496
142066
  if (style.fillMode === "gradient" && style.gradientFillStops && style.gradientFillStops.length > 0) {
141497
142067
  delete tcPr["a:solidFill"];
141498
142068
  delete tcPr["a:pattFill"];
141499
142069
  delete tcPr["a:blipFill"];
142070
+ delete tcPr["a:noFill"];
141500
142071
  const stops = style.gradientFillStops.map((stop) => {
141501
142072
  const posRaw = typeof stop.position === "number" ? stop.position : 0;
141502
142073
  const position4 = Math.round(Math.max(0, Math.min(1, posRaw / 100)) * 1e5);
@@ -141548,6 +142119,7 @@ function writeCellFill(tcPr, style, resolveColorXml) {
141548
142119
  delete tcPr["a:solidFill"];
141549
142120
  delete tcPr["a:gradFill"];
141550
142121
  delete tcPr["a:blipFill"];
142122
+ delete tcPr["a:noFill"];
141551
142123
  const pattXml = {
141552
142124
  "@_prst": style.patternFillPreset
141553
142125
  };
@@ -141571,10 +142143,12 @@ function writeCellFill(tcPr, style, resolveColorXml) {
141571
142143
  delete tcPr["a:gradFill"];
141572
142144
  delete tcPr["a:pattFill"];
141573
142145
  delete tcPr["a:blipFill"];
142146
+ tcPr["a:noFill"] = tcPr["a:noFill"] ?? {};
141574
142147
  } else if (style.fillMode !== "image" && style.backgroundColor) {
141575
142148
  delete tcPr["a:gradFill"];
141576
142149
  delete tcPr["a:pattFill"];
141577
142150
  delete tcPr["a:blipFill"];
142151
+ delete tcPr["a:noFill"];
141578
142152
  const resolvedOriginal = style.backgroundColorXml && resolveColorXml ? resolveColorXml(style.backgroundColorXml) : void 0;
141579
142153
  tcPr["a:solidFill"] = serializeColorChoiceWithRef(
141580
142154
  style.backgroundColorRef,
@@ -141805,6 +142379,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
141805
142379
  init_xml_access();
141806
142380
  init_xml_reorder();
141807
142381
  init_PptxHandlerRuntimeLayoutSwitching();
142382
+ init_table_cell_border_save();
141808
142383
  init_table_cell_save_helpers();
141809
142384
  init_table_cell_text_xml();
141810
142385
  PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime21 {
@@ -141882,53 +142457,7 @@ var init_PptxHandlerRuntimeSaveTableStyles = __esm({
141882
142457
  pPr["@_algn"] = token3;
141883
142458
  }
141884
142459
  }
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
- }
142460
+ writeCellEdgeBorders(tcPr, style, _PptxHandlerRuntime.EMU_PER_PX);
141932
142461
  const emuPerPx = _PptxHandlerRuntime.EMU_PER_PX;
141933
142462
  if (style.marginLeft !== void 0) {
141934
142463
  tcPr["@_marL"] = String(Math.round(style.marginLeft * emuPerPx));
@@ -142363,10 +142892,13 @@ var init_table_style_change_cell_clear = __esm({
142363
142892
  "a:grpFill"
142364
142893
  ];
142365
142894
  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"]],
142895
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash", "borderLeftDashSegments"]],
142896
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash", "borderRightDashSegments"]],
142897
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash", "borderTopDashSegments"]],
142898
+ [
142899
+ "a:lnB",
142900
+ ["borderBottomWidth", "borderBottomColor", "borderBottomDash", "borderBottomDashSegments"]
142901
+ ],
142370
142902
  ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
142371
142903
  ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
142372
142904
  ];
@@ -142610,7 +143142,15 @@ function slideContainsA16Element(node2) {
142610
143142
  function randomColumnId() {
142611
143143
  return String(Math.floor(Math.random() * 4294967295));
142612
143144
  }
142613
- function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
143145
+ function deterministicColumnId(index2) {
143146
+ let hash3 = 2166136261;
143147
+ for (const ch of `a16:colId:${index2}`) {
143148
+ hash3 ^= ch.charCodeAt(0);
143149
+ hash3 = Math.imul(hash3, 16777619) >>> 0;
143150
+ }
143151
+ return String(hash3);
143152
+ }
143153
+ function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn, newColumnId = randomColumnId) {
142614
143154
  const existingXmlRows = ensureArrayFn(tbl["a:tr"]);
142615
143155
  const existingGridCols = ensureArrayFn(
142616
143156
  tbl["a:tblGrid"]?.["a:gridCol"]
@@ -142641,7 +143181,7 @@ function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
142641
143181
  // `ensureA16NamespaceOnSlideRoot`; emitting it here too is
142642
143182
  // schema-redundant and PowerPoint flags it.
142643
143183
  "a16:colId": {
142644
- "@_val": existingColIds[i2] || randomColumnId()
143184
+ "@_val": existingColIds[i2] || newColumnId(i2)
142645
143185
  }
142646
143186
  }
142647
143187
  }
@@ -142706,8 +143246,8 @@ function cells(row) {
142706
143246
  return ensureArray19(row["a:tc"]);
142707
143247
  }
142708
143248
  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) {
143249
+ const span2 = axis === "row" ? "rowSpan" : "gridSpan";
143250
+ 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
143251
  return;
142712
143252
  }
142713
143253
  if (removed["a:txBody"] !== void 0) {
@@ -143117,6 +143657,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
143117
143657
  init_table_style_change_cell_clear();
143118
143658
  init_table_paragraph_save_order();
143119
143659
  init_table_structural_ops();
143660
+ init_table_xml_rebuild();
143120
143661
  init_table_tblpr_save();
143121
143662
  CHART_DATA_DISPLAY_OPTIONS_EXT_URI = "{56B9EC1D-385E-4148-901F-78D8002777C0}";
143122
143663
  PptxHandlerRuntime24 = class _PptxHandlerRuntime extends PptxHandlerRuntime23 {
@@ -143153,7 +143694,8 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
143153
143694
  tbl,
143154
143695
  tableData,
143155
143696
  _PptxHandlerRuntime.EMU_PER_PX,
143156
- this.ensureArray.bind(this)
143697
+ this.ensureArray.bind(this),
143698
+ this.saveFixedDate ? deterministicColumnId : void 0
143157
143699
  );
143158
143700
  const rebuiltRows = this.ensureArray(tbl["a:tr"]);
143159
143701
  for (let rIdx = 0; rIdx < tableData.rows.length; rIdx++) {
@@ -145762,9 +146304,9 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
145762
146304
  let maxId = 0;
145763
146305
  for (const rel of relationships3) {
145764
146306
  const id = String(rel?.["@_Id"] || "");
145765
- const num4 = parseInt(id.replace(/^rId/u, ""), 10);
145766
- if (Number.isFinite(num4) && num4 > maxId) {
145767
- maxId = num4;
146307
+ const num5 = parseInt(id.replace(/^rId/u, ""), 10);
146308
+ if (Number.isFinite(num5) && num5 > maxId) {
146309
+ maxId = num5;
145768
146310
  }
145769
146311
  }
145770
146312
  const existingFontTargets = /* @__PURE__ */ new Set();
@@ -145907,9 +146449,9 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
145907
146449
  let maxId = 0;
145908
146450
  for (const rel of relationships3) {
145909
146451
  const id = String(rel?.["@_Id"] || "");
145910
- const num4 = parseInt(id.replace(/^rId/u, ""), 10);
145911
- if (Number.isFinite(num4) && num4 > maxId) {
145912
- maxId = num4;
146452
+ const num5 = parseInt(id.replace(/^rId/u, ""), 10);
146453
+ if (Number.isFinite(num5) && num5 > maxId) {
146454
+ maxId = num5;
145913
146455
  }
145914
146456
  }
145915
146457
  relationships3.push({
@@ -150264,6 +150806,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
150264
150806
  init_slide_name();
150265
150807
  init_utils();
150266
150808
  init_modern_comment_package();
150809
+ init_slide_background_gradient();
150267
150810
  init_slide_synchronization();
150268
150811
  init_theme_override_utils();
150269
150812
  init_builders();
@@ -150521,6 +151064,16 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
150521
151064
  message: `Slide background image could not be embedded and was preserved as-is or omitted: ${imageUrl.slice(0, 120)}`,
150522
151065
  scope: "save",
150523
151066
  slideId: slide.id
151067
+ }),
151068
+ buildBackgroundGradientFill: () => {
151069
+ const gradient = slideBackgroundGradientToWrite(slide);
151070
+ return gradient ? this.buildGradientFillXml({ fillMode: "gradient", ...gradient }) : void 0;
151071
+ },
151072
+ reportUnsupportedGradient: () => this.compatibilityService.reportWarning({
151073
+ code: "SAVE_BACKGROUND_GRADIENT_UNSUPPORTED",
151074
+ message: "Slide background gradient has no structured form (backgroundGradientFill) matching its CSS gradient and could not be written; the slide was saved without a background of its own.",
151075
+ scope: "save",
151076
+ slideId: slide.id
150524
151077
  })
150525
151078
  });
150526
151079
  this.slideCommentPartWriter.writeComments({
@@ -152872,6 +153425,15 @@ var init_PptxHandlerRuntimeSaveStructuralIds = __esm({
152872
153425
  });
152873
153426
 
152874
153427
  // pptx/core/core/runtime/PptxHandlerRuntimeSavePipeline.ts
153428
+ function validFixedDate(date5) {
153429
+ if (date5 === void 0) {
153430
+ return void 0;
153431
+ }
153432
+ if (!(date5 instanceof Date) || Number.isNaN(date5.getTime())) {
153433
+ throw new RangeError("PptxHandlerSaveOptions.fixedDate must be a valid Date");
153434
+ }
153435
+ return date5;
153436
+ }
152875
153437
  var PptxHandlerRuntime54;
152876
153438
  var init_PptxHandlerRuntimeSavePipeline = __esm({
152877
153439
  "pptx/core/core/runtime/PptxHandlerRuntimeSavePipeline.ts"() {
@@ -152917,6 +153479,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
152917
153479
  /** One save, with the package to itself; callers go through {@link save}. */
152918
153480
  async saveNow(slides, options2) {
152919
153481
  validateSlideGeometry(slides);
153482
+ this.saveFixedDate = validFixedDate(options2?.fixedDate);
152920
153483
  const templates = [
152921
153484
  ...options2?.slideMasters ?? [],
152922
153485
  ...options2?.slideLayouts ?? [],
@@ -153107,7 +153670,8 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
153107
153670
  await this.documentPropertiesUpdater.updateOnSave(slides, {
153108
153671
  coreProperties: options2?.coreProperties,
153109
153672
  appProperties: options2?.appProperties,
153110
- customProperties: options2?.customProperties
153673
+ customProperties: options2?.customProperties,
153674
+ fixedDate: this.saveFixedDate
153111
153675
  });
153112
153676
  await this.applyTagCollectionChanges(options2?.tags);
153113
153677
  await this.applyNotesMasterChanges(options2?.notesMaster);
@@ -153151,6 +153715,11 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
153151
153715
  delete this.zip.files[name];
153152
153716
  }
153153
153717
  }
153718
+ if (this.saveFixedDate) {
153719
+ for (const file2 of Object.values(this.zip.files)) {
153720
+ file2.date = this.saveFixedDate;
153721
+ }
153722
+ }
153154
153723
  return await this.zip.generateAsync({
153155
153724
  type: "uint8array",
153156
153725
  compression: "DEFLATE",
@@ -163115,8 +163684,8 @@ function parseNumberVal(node2) {
163115
163684
  if (raw2 === void 0 || raw2 === null || raw2 === "") {
163116
163685
  return void 0;
163117
163686
  }
163118
- const num4 = Number.parseFloat(String(raw2));
163119
- return Number.isFinite(num4) ? num4 : void 0;
163687
+ const num5 = Number.parseFloat(String(raw2));
163688
+ return Number.isFinite(num5) ? num5 : void 0;
163120
163689
  }
163121
163690
  var CHART_DATA_DISPLAY_OPTIONS_EXT_URI2, PptxHandlerRuntime93;
163122
163691
  var init_PptxHandlerRuntimeChartParsingHelpers = __esm({
@@ -165709,12 +166278,12 @@ var init_PptxHandlerRuntimeThemeEffects = __esm({
165709
166278
  * in-memory format schemes of the masters on those parts and, when the deck's part is among
165710
166279
  * them, the deck's.
165711
166280
  */
165712
- async writeFormatScheme(elementFor2, themePaths) {
166281
+ async writeFormatScheme(elementFor, themePaths) {
165713
166282
  const deckBefore = this.getThemeFormatScheme();
165714
166283
  const replaced = /* @__PURE__ */ new Map();
165715
166284
  const schemes = /* @__PURE__ */ new Map();
165716
166285
  const written = await this.rewriteThemeParts(themePaths, (data, path4) => {
165717
- const element2 = elementFor2(path4);
166286
+ const element2 = elementFor(path4);
165718
166287
  const elements3 = data["a:theme"]?.["a:themeElements"];
165719
166288
  if (!element2 || !elements3) {
165720
166289
  return false;
@@ -165752,7 +166321,7 @@ var init_PptxHandlerRuntimeThemeEffects = __esm({
165752
166321
  this.themeFormatScheme = deck;
165753
166322
  this.heldFormatSchemes.holdParts(
165754
166323
  deck,
165755
- new Map(written.map((path4) => [path4, elementFor2(path4)]))
166324
+ new Map(written.map((path4) => [path4, elementFor(path4)]))
165756
166325
  );
165757
166326
  }
165758
166327
  return this.getThemeFormatScheme();
@@ -174278,12 +174847,12 @@ var OmmlLatexConverter = class {
174278
174847
  if (!f6) {
174279
174848
  return null;
174280
174849
  }
174281
- const num4 = this.renderNode(f6["m:num"]).trim();
174850
+ const num5 = this.renderNode(f6["m:num"]).trim();
174282
174851
  const den = this.renderNode(f6["m:den"]).trim();
174283
- if (!num4 && !den) {
174852
+ if (!num5 && !den) {
174284
174853
  return null;
174285
174854
  }
174286
- return `\\frac{${num4 || " "}}{${den || " "}}`;
174855
+ return `\\frac{${num5 || " "}}{${den || " "}}`;
174287
174856
  }
174288
174857
  trySuperscript(node2) {
174289
174858
  const value = node2["m:sSup"];
@@ -176386,8 +176955,8 @@ function updateIntersectingMerges(source2, rows, edit) {
176386
176955
  const rowSpan = anchor2.rowSpan ?? 1;
176387
176956
  const gridSpan = anchor2.gridSpan ?? 1;
176388
176957
  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)) {
176958
+ const span2 = isRowEdit ? rowSpan : gridSpan;
176959
+ if (edit.index < start || edit.index >= start + span2 || (inserting ? edit.index === start : span2 === 1)) {
176391
176960
  continue;
176392
176961
  }
176393
176962
  if (!Number.isInteger(rowSpan) || !Number.isInteger(gridSpan) || rowSpan < 1 || gridSpan < 1 || rowIndex + rowSpan > source2.rows.length || columnIndex + gridSpan > source2.columnWidths.length) {