@evotecit/officeimo 0.1.19 → 0.1.43

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 (102) hide show
  1. package/README.md +44 -10
  2. package/bundles/officeimo-canopyx-adapter.js +147 -65
  3. package/bundles/officeimo-canopyx-adapter.min.js +1 -1
  4. package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
  5. package/bundles/officeimo-canopyx-adapter.mjs +134 -53
  6. package/bundles/officeimo-canopyx.js +554 -234
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +477 -158
  10. package/bundles/officeimo-chartforgex-adapter.js +1924 -0
  11. package/bundles/officeimo-chartforgex-adapter.min.js +2 -0
  12. package/bundles/officeimo-chartforgex-adapter.min.mjs +2 -0
  13. package/bundles/officeimo-chartforgex-adapter.mjs +1910 -0
  14. package/bundles/officeimo-chartforgex.js +13594 -0
  15. package/bundles/officeimo-chartforgex.min.js +2 -0
  16. package/bundles/officeimo-chartforgex.min.mjs +2 -0
  17. package/bundles/officeimo-chartforgex.mjs +13487 -0
  18. package/bundles/officeimo-csv.js +12 -7
  19. package/bundles/officeimo-csv.min.js +1 -1
  20. package/bundles/officeimo-csv.min.mjs +1 -1
  21. package/bundles/officeimo-csv.mjs +8 -3
  22. package/bundles/officeimo-datatables-adapter.js +11 -11
  23. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  24. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  25. package/bundles/officeimo-datatables-adapter.mjs +7 -7
  26. package/bundles/officeimo-datatables.js +418 -180
  27. package/bundles/officeimo-datatables.min.js +1 -1
  28. package/bundles/officeimo-datatables.min.mjs +1 -1
  29. package/bundles/officeimo-datatables.mjs +350 -112
  30. package/bundles/officeimo-execution.js +14 -9
  31. package/bundles/officeimo-execution.min.js +1 -1
  32. package/bundles/officeimo-execution.min.mjs +1 -1
  33. package/bundles/officeimo-execution.mjs +8 -3
  34. package/bundles/officeimo-pdf.js +286 -120
  35. package/bundles/officeimo-pdf.min.js +1 -1
  36. package/bundles/officeimo-pdf.min.mjs +1 -1
  37. package/bundles/officeimo-pdf.mjs +244 -78
  38. package/bundles/officeimo-xlsx.js +136 -59
  39. package/bundles/officeimo-xlsx.min.js +1 -1
  40. package/bundles/officeimo-xlsx.min.mjs +1 -1
  41. package/bundles/officeimo-xlsx.mjs +114 -37
  42. package/bundles/officeimo.js +416 -178
  43. package/bundles/officeimo.min.js +1 -1
  44. package/bundles/officeimo.min.mjs +1 -1
  45. package/bundles/officeimo.mjs +351 -113
  46. package/dist/core/progress.js +7 -2
  47. package/dist/index.d.ts +1 -1
  48. package/dist/integrations/canopyx/index.js +13 -4
  49. package/dist/integrations/canopyx/pdf-number.js +9 -6
  50. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  51. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  52. package/dist/integrations/canopyx/rules.d.ts +1 -1
  53. package/dist/integrations/canopyx/rules.js +11 -13
  54. package/dist/integrations/canopyx/source.js +57 -7
  55. package/dist/integrations/canopyx/tones.d.ts +10 -0
  56. package/dist/integrations/canopyx/tones.js +12 -0
  57. package/dist/integrations/canopyx/types.d.ts +8 -1
  58. package/dist/integrations/chartforgex/capture.d.ts +31 -0
  59. package/dist/integrations/chartforgex/capture.js +103 -0
  60. package/dist/integrations/chartforgex/index.d.ts +13 -0
  61. package/dist/integrations/chartforgex/index.js +88 -0
  62. package/dist/integrations/chartforgex/svg-drawing.d.ts +5 -0
  63. package/dist/integrations/chartforgex/svg-drawing.js +775 -0
  64. package/dist/integrations/chartforgex/svg-geometry.d.ts +23 -0
  65. package/dist/integrations/chartforgex/svg-geometry.js +304 -0
  66. package/dist/integrations/chartforgex/svg-image.d.ts +9 -0
  67. package/dist/integrations/chartforgex/svg-image.js +46 -0
  68. package/dist/integrations/chartforgex/svg-markup.d.ts +10 -0
  69. package/dist/integrations/chartforgex/svg-markup.js +124 -0
  70. package/dist/integrations/chartforgex/svg-paint.d.ts +16 -0
  71. package/dist/integrations/chartforgex/svg-paint.js +146 -0
  72. package/dist/integrations/chartforgex/types.d.ts +77 -0
  73. package/dist/integrations/chartforgex/types.js +1 -0
  74. package/dist/integrations/chartforgex/winansi.d.ts +4 -0
  75. package/dist/integrations/chartforgex/winansi.js +48 -0
  76. package/dist/integrations/chartforgex/workbook.d.ts +12 -0
  77. package/dist/integrations/chartforgex/workbook.js +137 -0
  78. package/dist/pdf/document-drawings.d.ts +1 -1
  79. package/dist/pdf/document-drawings.js +91 -17
  80. package/dist/pdf/document-images.d.ts +7 -1
  81. package/dist/pdf/document-images.js +59 -24
  82. package/dist/pdf/document-types.d.ts +3 -1
  83. package/dist/pdf/document.d.ts +2 -2
  84. package/dist/pdf/document.js +3 -1
  85. package/dist/pdf/drawing-types.d.ts +37 -10
  86. package/dist/pdf/font-resources.d.ts +1 -1
  87. package/dist/pdf/font-resources.js +6 -3
  88. package/dist/pdf/index.d.ts +1 -1
  89. package/dist/pdf/pages.js +15 -0
  90. package/dist/pdf/png.d.ts +11 -2
  91. package/dist/pdf/png.js +50 -23
  92. package/dist/pdf/session.js +3 -2
  93. package/dist/pdf/settings.d.ts +2 -2
  94. package/dist/pdf/settings.js +7 -3
  95. package/dist/xlsx/options.js +2 -2
  96. package/dist/xlsx/portable.js +1 -1
  97. package/dist/xlsx/styles.js +28 -18
  98. package/dist/xlsx/types.d.ts +13 -1
  99. package/dist/xlsx/workbook.js +9 -1
  100. package/dist/xlsx/worksheet.d.ts +13 -1
  101. package/dist/xlsx/worksheet.js +65 -11
  102. package/package.json +9 -2
@@ -192,15 +192,20 @@ return _exports;
192
192
  const _m4 = (() => {
193
193
  /** @internal Notify synchronously; observe an accidental promise before rejecting its unsupported use. */
194
194
  function notifyProgress(callback, progress) {
195
+ notifySynchronously("onProgress", callback, progress);
196
+ }
197
+ /** @internal Run a host notification that must finish before the export continues. A returned promise is observed,
198
+ * so its rejection is never unhandled, and the export fails instead of reporting success before the callback ends. */
199
+ function notifySynchronously(name, callback, value) {
195
200
  if (!callback)
196
201
  return;
197
- const result = callback(progress);
202
+ const result = callback(value);
198
203
  if (result && typeof result.then === "function") {
199
204
  void Promise.resolve(result).catch(() => { });
200
- throw new TypeError("onProgress must be synchronous.");
205
+ throw new TypeError(name + " must be synchronous.");
201
206
  }
202
207
  }
203
- const _exports = Object.freeze({ notifyProgress: notifyProgress });
208
+ const _exports = Object.freeze({ notifyProgress: notifyProgress, notifySynchronously: notifySynchronously });
204
209
  return _exports;
205
210
  })();
206
211
 
@@ -1376,6 +1381,24 @@ const { DifferentialStyles } = _m18;
1376
1381
 
1377
1382
 
1378
1383
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
1384
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
1385
+ /** @internal Validate and normalize border edges without registering a workbook style. */
1386
+ function normalizeBorder(border) {
1387
+ if (!border || typeof border !== "object")
1388
+ throw new TypeError("A border must be an object of edges.");
1389
+ const result = {};
1390
+ for (const side of ["left", "right", "top", "bottom"]) {
1391
+ const edge = border[side];
1392
+ if (edge) {
1393
+ // Read each property once, so the validated edge is the one that is stored.
1394
+ const { style, color } = edge;
1395
+ if (!borderStyles.includes(style))
1396
+ throw new TypeError("Invalid border style.");
1397
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
1398
+ }
1399
+ }
1400
+ return result;
1401
+ }
1379
1402
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
1380
1403
  function index(value, count, kind) {
1381
1404
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -1448,32 +1471,24 @@ class StyleRegistry {
1448
1471
  /** @internal */
1449
1472
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
1450
1473
  addFont(font) {
1451
- if (font.name !== undefined && typeof font.name !== "string")
1474
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
1475
+ if (requested !== undefined && typeof requested !== "string")
1452
1476
  throw new TypeError("Font name must be a string.");
1453
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
1477
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
1454
1478
  if (typeof name !== "string" || !name || name.length > 31)
1455
1479
  throw new TypeError("Font name must contain 1 through 31 characters.");
1456
1480
  if (!Number.isFinite(size) || size <= 0 || size > 409)
1457
1481
  throw new RangeError("Font size must be positive and at most 409.");
1458
- return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!font.bold, italic: !!font.italic, underline: !!font.underline, strike: !!font.strike, color: font.color ? colorArgb(font.color) : "" }, this.maximum);
1482
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
1459
1483
  }
1460
1484
  addFill(fill) {
1461
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
1462
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
1485
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
1486
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
1463
1487
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
1464
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
1488
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
1465
1489
  }
1466
1490
  addBorder(border) {
1467
- const result = {};
1468
- for (const side of ["left", "right", "top", "bottom"]) {
1469
- const edge = border[side];
1470
- if (edge) {
1471
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
1472
- throw new TypeError("Invalid border style.");
1473
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
1474
- }
1475
- }
1476
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
1491
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
1477
1492
  }
1478
1493
  addNumberFormat(format) {
1479
1494
  if (typeof format !== "string" || !format || format.length > 255)
@@ -1539,7 +1554,7 @@ class StyleRegistry {
1539
1554
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
1540
1555
  }
1541
1556
  /** @internal Column shorthand and header style composition. */
1542
- forColumn(column, header = false, fill, date = false) {
1557
+ forColumn(column, header = false, fill, date = false, border) {
1543
1558
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
1544
1559
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
1545
1560
  return this.add({
@@ -1548,7 +1563,7 @@ class StyleRegistry {
1548
1563
  wrapText: column.wrapText ?? base?.wrapText ?? false,
1549
1564
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
1550
1565
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
1551
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
1566
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
1552
1567
  });
1553
1568
  }
1554
1569
  toXml() {
@@ -1573,7 +1588,7 @@ class StyleRegistry {
1573
1588
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
1574
1589
  }
1575
1590
  }
1576
- const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1591
+ const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1577
1592
  return _exports;
1578
1593
  })();
1579
1594
 
@@ -3026,7 +3041,7 @@ const { ChunkedTextSink, BlobByteSink } = _m5;
3026
3041
 
3027
3042
  const { OfficeIMOError } = _m3;
3028
3043
 
3029
- const { notifyProgress } = _m4;
3044
+ const { notifyProgress, notifySynchronously } = _m4;
3030
3045
 
3031
3046
  const { copyColumns, createRowProjector } = _m24;
3032
3047
 
@@ -3098,8 +3113,14 @@ class Worksheet {
3098
3113
  pendingCharacters = 0;
3099
3114
  reservedLayout = false;
3100
3115
  internalLinks = [];
3116
+ // Evicted entries become holes and are compacted in one pass when the links are read, keeping eviction O(1).
3101
3117
  links = [];
3118
+ evictedLinks = 0;
3102
3119
  linkedCells = new Set();
3120
+ /** Indexes in `links` of data-cell links that `hyperlinkOverflow: "drop"` may give up, in row order. */
3121
+ droppable = [];
3122
+ droppableLinks = new WeakSet();
3123
+ droppedLinks = 0;
3103
3124
  pictures = [];
3104
3125
  nativeCharts = [];
3105
3126
  conditional;
@@ -3130,8 +3151,9 @@ class Worksheet {
3130
3151
  book.checkLinks(this.links.length);
3131
3152
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3132
3153
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3133
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3134
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3154
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3155
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3156
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3135
3157
  }));
3136
3158
  // Register conditional styles only after worksheet construction can no longer reject its options.
3137
3159
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3183,6 +3205,8 @@ class Worksheet {
3183
3205
  throw new TypeError("A frozen header or autofilter requires a header row.");
3184
3206
  if (options.headerFill !== undefined)
3185
3207
  colorArgb(options.headerFill);
3208
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3209
+ throw new TypeError("headerWrap must be boolean.");
3186
3210
  if (options.headerStyle !== undefined)
3187
3211
  book.styles.validateStyle(options.headerStyle);
3188
3212
  if (options.alternatingRowStyle !== undefined)
@@ -3308,7 +3332,8 @@ class Worksheet {
3308
3332
  const cell = col.letter + row;
3309
3333
  if (link || this.linkedCells.has(cell))
3310
3334
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
3311
- checkHyperlinkCount(this.links.length + this.internalLinks.length + 1);
3335
+ this.makeLinkRoom();
3336
+ checkHyperlinkCount(this.linkCount + 1);
3312
3337
  this.book.checkLinks(1);
3313
3338
  // Replace a generated cell's original reservation with its preview and overflow records.
3314
3339
  if (reservedCharacters !== undefined) {
@@ -3322,7 +3347,7 @@ class Worksheet {
3322
3347
  value = preserved.preview;
3323
3348
  }
3324
3349
  if (link)
3325
- this.appendHyperlink({ cell: col.letter + row, ...link });
3350
+ this.appendHyperlink({ cell: col.letter + row, ...link }, !header && !footer && !title && this.book.settings.hyperlinkOverflow === "drop");
3326
3351
  if (type === "date")
3327
3352
  value = excelDate(value, this.book.settings.dateMode);
3328
3353
  if (!header && !footer && visible && (!formula || !isSubtotalFormula(formula)))
@@ -3631,20 +3656,61 @@ class Worksheet {
3631
3656
  throw this.error;
3632
3657
  this.appendHyperlink(link);
3633
3658
  }
3634
- appendHyperlink(link) {
3659
+ appendHyperlink(link, droppable = false) {
3660
+ // Validate before any overflow decision, so a dropped link can never hide an unsafe target.
3635
3661
  const copied = copyHyperlink(link, this.book.settings.invalidCharacterPolicy);
3636
3662
  const position = cellPosition(copied.cell);
3637
3663
  if (this.layout.regions.covered(position.column, position.row))
3638
3664
  throw new TypeError("Hyperlinks cannot address a covered merged cell.");
3639
3665
  if (this.linkedCells.has(copied.cell))
3640
3666
  throw new TypeError("Duplicate hyperlink cell: " + copied.cell);
3641
- checkHyperlinkCount(this.links.length + this.internalLinks.length + 1);
3667
+ if (droppable && this.linkCount >= maximumHyperlinks) {
3668
+ this.droppedLinks++;
3669
+ return;
3670
+ }
3671
+ if (!droppable)
3672
+ this.makeLinkRoom();
3673
+ checkHyperlinkCount(this.linkCount + 1);
3642
3674
  this.book.retainLink();
3675
+ if (droppable) {
3676
+ this.droppable.push(this.links.length);
3677
+ this.droppableLinks.add(copied);
3678
+ }
3643
3679
  this.links.push(copied);
3644
3680
  this.linkedCells.add(copied.cell);
3645
3681
  }
3682
+ /** Links the worksheet holds now, not counting evicted holes. */
3683
+ get linkCount() { return this.links.length - this.evictedLinks + this.internalLinks.length; }
3684
+ /** A full worksheet gives up its latest data-cell link for a link that cannot be dropped. Hyperlinks are serialized after
3685
+ * the rows, so the cell keeps its written value. The entry becomes a hole, so other indexes stay valid until compaction. */
3686
+ makeLinkRoom() {
3687
+ if (this.linkCount < maximumHyperlinks || !this.droppable.length)
3688
+ return;
3689
+ const index = this.droppable.pop(), removed = this.links[index];
3690
+ this.links[index] = undefined;
3691
+ this.evictedLinks++;
3692
+ this.linkedCells.delete(removed.cell);
3693
+ this.book.releaseLink();
3694
+ this.droppedLinks++;
3695
+ }
3696
+ /** One ordered pass removes evicted holes and rebuilds the droppable indexes. */
3697
+ compactLinks() {
3698
+ if (this.evictedLinks) {
3699
+ const kept = [], droppable = [];
3700
+ for (const link of this.links)
3701
+ if (link) {
3702
+ if (this.droppableLinks.has(link))
3703
+ droppable.push(kept.length);
3704
+ kept.push(link);
3705
+ }
3706
+ this.links = kept;
3707
+ this.droppable = droppable;
3708
+ this.evictedLinks = 0;
3709
+ }
3710
+ return this.links;
3711
+ }
3646
3712
  /** @internal */
3647
- get hyperlinks() { return this.links; }
3713
+ get hyperlinks() { return this.compactLinks(); }
3648
3714
  /** @internal */
3649
3715
  get images() { return this.pictures; }
3650
3716
  /** @internal An empty export has no data table; it still emits the declared headers. */
@@ -3695,7 +3761,7 @@ class Worksheet {
3695
3761
  for (const binding of this.chartSources)
3696
3762
  binding.finish();
3697
3763
  this.chartSources.length = 0;
3698
- for (const link of this.links) {
3764
+ for (const link of this.compactLinks()) {
3699
3765
  const position = cellPosition(link.cell);
3700
3766
  if (position.column > this.columns.length || position.row > this.totalRows)
3701
3767
  throw new RangeError("Hyperlinks must address cells within the exported rows and columns.");
@@ -3725,8 +3791,11 @@ class Worksheet {
3725
3791
  await this.buffer.write(xml);
3726
3792
  for (const xml of dataValidationsXml(this.validations, this.headerRows, this.count, detailRanges))
3727
3793
  await this.buffer.write(xml);
3728
- if (this.links.length || this.internalLinks.length)
3729
- await this.buffer.write(hyperlinksXml(this.links, this.book.settings.invalidCharacterPolicy, this.internalLinks));
3794
+ if (this.droppedLinks)
3795
+ notifySynchronously("onHyperlinkOverflow", this.book.settings.onHyperlinkOverflow, Object.freeze({ sheetName: this.name, dropped: this.droppedLinks }));
3796
+ const links = this.compactLinks();
3797
+ if (links.length || this.internalLinks.length)
3798
+ await this.buffer.write(hyperlinksXml(links, this.book.settings.invalidCharacterPolicy, this.internalLinks));
3730
3799
  await this.buffer.write(printXml(this.options.print, this.book.settings.invalidCharacterPolicy));
3731
3800
  if (this.pictures.length || this.nativeCharts.length)
3732
3801
  await this.buffer.write('<drawing r:id="drawing"/>');
@@ -3871,9 +3940,9 @@ const _m40 = (() => {
3871
3940
  const { captureFields } = _m7;
3872
3941
 
3873
3942
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
3874
- const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
3943
+ const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "hyperlinkOverflow", "onHyperlinkOverflow", "creator", "title", "subject", "description", "created", "modified"];
3875
3944
  /** @internal Worksheet settings also used by the portable sheet owner. */
3876
- const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
3945
+ const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
3877
3946
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
3878
3947
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
3879
3948
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -4205,7 +4274,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4205
4274
 
4206
4275
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m11;
4207
4276
 
4208
- const { StyleRegistry, spreadsheetNamespace } = _m16;
4277
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m16;
4209
4278
 
4210
4279
  const { sheetName, assertXlsxValue, copyValue } = _m19;
4211
4280
 
@@ -4246,6 +4315,8 @@ function captureSheet(options, policy) {
4246
4315
  return { ...captured, columns,
4247
4316
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4248
4317
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4318
+ // Preflight and every header style read this one snapshot of the edges.
4319
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4249
4320
  ...(footer ? { footer: { ...footer,
4250
4321
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4251
4322
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -4321,6 +4392,10 @@ class Workbook {
4321
4392
  throw new RangeError("compression must be auto or store.");
4322
4393
  if (options.oversizedText !== undefined && !["reject", "preserve"].includes(options.oversizedText))
4323
4394
  throw new RangeError("oversizedText must be reject or preserve.");
4395
+ if (options.hyperlinkOverflow !== undefined && !["reject", "drop"].includes(options.hyperlinkOverflow))
4396
+ throw new RangeError("hyperlinkOverflow must be reject or drop.");
4397
+ if (options.onHyperlinkOverflow !== undefined && typeof options.onHyperlinkOverflow !== "function")
4398
+ throw new TypeError("onHyperlinkOverflow must be a function.");
4324
4399
  cleanXml("", policy);
4325
4400
  corePropertiesXml(options, policy);
4326
4401
  this.budget = new ExportBudget(options.limits);
@@ -4398,6 +4473,8 @@ class Workbook {
4398
4473
  }
4399
4474
  /** @internal Reserve a preflighted worksheet batch or one row hyperlink. */
4400
4475
  retainLink(count = 1) { this.checkLinks(count); this.links += count; }
4476
+ /** @internal A worksheet dropped a data-cell link it had retained. */
4477
+ releaseLink() { this.links--; }
4401
4478
  /** @internal */
4402
4479
  checkImage(bytes) {
4403
4480
  if (this.settings.limits?.maxImageBytes !== undefined && this.imageBytes + bytes > this.settings.limits.maxImageBytes)
@@ -4696,7 +4773,7 @@ function value(result) {
4696
4773
  function portableSheet(options = {}) {
4697
4774
  options = captureFields(options, sheetOptionFields);
4698
4775
  if (options.headerStyle !== undefined)
4699
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
4776
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
4700
4777
  style(options.alternatingRowStyle);
4701
4778
  style(options.title?.style);
4702
4779
  style(options.footer?.style);