@evotecit/officeimo 0.1.1 → 0.1.3

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 (43) hide show
  1. package/README.md +43 -49
  2. package/bundles/officeimo-canopyx.js +1047 -193
  3. package/bundles/officeimo-canopyx.mjs +958 -111
  4. package/bundles/officeimo-csv.js +18 -15
  5. package/bundles/officeimo-csv.mjs +16 -13
  6. package/bundles/officeimo-datatables.js +249 -153
  7. package/bundles/officeimo-datatables.mjs +169 -73
  8. package/bundles/officeimo-pdf.js +151 -67
  9. package/bundles/officeimo-pdf.mjs +127 -43
  10. package/bundles/officeimo-xlsx.js +78 -69
  11. package/bundles/officeimo-xlsx.mjs +26 -17
  12. package/bundles/officeimo.js +249 -153
  13. package/bundles/officeimo.mjs +169 -73
  14. package/dist/csv/index.js +16 -13
  15. package/dist/integrations/canopyx/diagnostics.d.ts +3 -0
  16. package/dist/integrations/canopyx/diagnostics.js +17 -0
  17. package/dist/integrations/canopyx/grouping.d.ts +6 -0
  18. package/dist/integrations/canopyx/grouping.js +188 -0
  19. package/dist/integrations/canopyx/index.d.ts +2 -2
  20. package/dist/integrations/canopyx/index.js +72 -15
  21. package/dist/integrations/canopyx/metadata.d.ts +4 -0
  22. package/dist/integrations/canopyx/metadata.js +51 -0
  23. package/dist/integrations/canopyx/presentation.d.ts +8 -0
  24. package/dist/integrations/canopyx/presentation.js +40 -0
  25. package/dist/integrations/canopyx/rule-predicates.d.ts +3 -0
  26. package/dist/integrations/canopyx/rule-predicates.js +110 -0
  27. package/dist/integrations/canopyx/rules.d.ts +6 -0
  28. package/dist/integrations/canopyx/rules.js +176 -0
  29. package/dist/integrations/canopyx/source.js +24 -22
  30. package/dist/integrations/canopyx/types.d.ts +89 -8
  31. package/dist/integrations/canopyx/workbook.d.ts +6 -0
  32. package/dist/integrations/canopyx/workbook.js +52 -0
  33. package/dist/opc/index.js +14 -9
  34. package/dist/pdf/font-resources.js +33 -14
  35. package/dist/pdf/pages.js +63 -16
  36. package/dist/pdf/table-band-flow.js +7 -2
  37. package/dist/pdf/table-band-plan.js +9 -1
  38. package/dist/pdf/table-layout.js +6 -2
  39. package/dist/pdf/table-structure.js +9 -8
  40. package/dist/xlsx/workbook.js +7 -4
  41. package/dist/xlsx/worksheet.js +2 -1
  42. package/dist/xml/index.js +3 -3
  43. package/package.json +1 -1
@@ -1387,12 +1387,14 @@ _modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb",
1387
1387
  return _exports;
1388
1388
  })();
1389
1389
 
1390
- const _m17 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
1390
+ const _m17 = _modules.get("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585") ?? (() => {
1391
1391
  const { OfficeIMOError } = _m2;
1392
1392
 
1393
1393
  const { ChunkedTextSink } = _m3;
1394
1394
 
1395
1395
  const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
1396
+ const xmlEscapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1397
+ "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1396
1398
  /** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
1397
1399
  function cleanXml(value, policy = "strip") {
1398
1400
  if (policy !== "strip" && policy !== "reject")
@@ -1404,9 +1406,7 @@ function cleanXml(value, policy = "strip") {
1404
1406
  }
1405
1407
  /** Escape data, including whitespace that XML parsers otherwise normalize. */
1406
1408
  function escapeXml(value, policy = "strip") {
1407
- const escapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1408
- "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1409
- return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
1409
+ return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
1410
1410
  }
1411
1411
  /** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
1412
1412
  function escapeOoxmlAttribute(value, policy = "strip") {
@@ -1465,7 +1465,7 @@ class XmlWriter {
1465
1465
  throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
1466
1466
  }
1467
1467
  const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
1468
- _modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
1468
+ _modules.set("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585", _exports);
1469
1469
  return _exports;
1470
1470
  })();
1471
1471
 
@@ -1517,7 +1517,7 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
1517
1517
  return _exports;
1518
1518
  })();
1519
1519
 
1520
- const _m20 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
1520
+ const _m20 = _modules.get("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a") ?? (() => {
1521
1521
  const { escapeXml, xmlDeclaration } = _m17;
1522
1522
 
1523
1523
  const { isDate } = _m6;
@@ -1539,11 +1539,11 @@ function appPropertiesXml(properties = {}, policy = "strip") {
1539
1539
  '<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
1540
1540
  }
1541
1541
  const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
1542
- _modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
1542
+ _modules.set("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a", _exports);
1543
1543
  return _exports;
1544
1544
  })();
1545
1545
 
1546
- const _m18 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
1546
+ const _m18 = _modules.get("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5") ?? (() => {
1547
1547
 
1548
1548
 
1549
1549
 
@@ -1642,8 +1642,11 @@ class OpcPackage {
1642
1642
  return uri;
1643
1643
  }
1644
1644
  addPart(part) {
1645
- const uri = this.reserve(part.uri, part.contentType);
1646
- this.parts.set(uri.toLowerCase(), { ...part, uri, data: part.data instanceof Uint8Array ? new Uint8Array(part.data) : part.data });
1645
+ const { uri: requestedUri, contentType, data } = part;
1646
+ // Structural accessors and byte ownership are captured before reserving metadata.
1647
+ const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
1648
+ const uri = this.reserve(requestedUri, contentType);
1649
+ this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
1647
1650
  }
1648
1651
  /** @internal */
1649
1652
  addPrepared(uri, type, prepared) {
@@ -1668,17 +1671,19 @@ class OpcPackage {
1668
1671
  checkAbort(this.options.signal);
1669
1672
  this.open();
1670
1673
  source = source === "/" ? source : partUri(source);
1671
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(relationship.id))
1674
+ const { id, type, target: requestedTarget, external } = relationship;
1675
+ this.open();
1676
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
1672
1677
  throw new TypeError("Relationship id must be an XML ID.");
1673
- if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(relationship.type))
1678
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
1674
1679
  throw new TypeError("Relationship type must be an absolute URI.");
1675
- const target = relationship.external ? relationship.target : partUri(relationship.target);
1676
- if (relationship.external && (!target || /[\u0000-\u0020]/.test(target)))
1680
+ const target = external ? requestedTarget : partUri(requestedTarget);
1681
+ if (external && (!target || /[\u0000-\u0020]/.test(target)))
1677
1682
  throw new TypeError("Invalid external relationship target.");
1678
1683
  const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
1679
- if (list.has(relationship.id))
1680
- throw new TypeError("Duplicate relationship id: " + relationship.id);
1681
- list.set(relationship.id, { ...relationship, target });
1684
+ if (list.has(id))
1685
+ throw new TypeError("Duplicate relationship id: " + id);
1686
+ list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
1682
1687
  this.relationships.set(key, list);
1683
1688
  }
1684
1689
  setProperties(core = {}, app = {}) {
@@ -1788,7 +1793,7 @@ class OpcPackage {
1788
1793
  }
1789
1794
  }
1790
1795
  const _exports = Object.freeze({ partUri: _m19.partUri, relationshipPartUri: _m19.relationshipPartUri, relativePartTarget: _m19.relativePartTarget, corePropertiesXml: _m20.corePropertiesXml, appPropertiesXml: _m20.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
1791
- _modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
1796
+ _modules.set("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5", _exports);
1792
1797
  return _exports;
1793
1798
  })();
1794
1799
 
@@ -1820,7 +1825,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
1820
1825
  return _exports;
1821
1826
  })();
1822
1827
 
1823
- const _m26 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
1828
+ const _m26 = _modules.get("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148") ?? (() => {
1824
1829
  const { OfficeIMOError } = _m2;
1825
1830
 
1826
1831
  const { cleanXml, escapeOoxmlAttribute } = _m17;
@@ -1927,11 +1932,11 @@ function differentialXml(style, policy, numberFormat) {
1927
1932
  return xml;
1928
1933
  }
1929
1934
  const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
1930
- _modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
1935
+ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148", _exports);
1931
1936
  return _exports;
1932
1937
  })();
1933
1938
 
1934
- const _m24 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
1939
+ const _m24 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
1935
1940
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m17;
1936
1941
 
1937
1942
  const { OfficeIMOError } = _m2;
@@ -2141,11 +2146,11 @@ class StyleRegistry {
2141
2146
  }
2142
2147
  }
2143
2148
  const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2144
- _modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
2149
+ _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
2145
2150
  return _exports;
2146
2151
  })();
2147
2152
 
2148
- const _m28 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
2153
+ const _m28 = _modules.get("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93") ?? (() => {
2149
2154
  const { NotSupportedError } = _m2;
2150
2155
 
2151
2156
  const { cleanXml, escapeXml } = _m17;
@@ -2253,11 +2258,11 @@ function formulaXml(cell) {
2253
2258
  return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
2254
2259
  }
2255
2260
  const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
2256
- _modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
2261
+ _modules.set("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93", _exports);
2257
2262
  return _exports;
2258
2263
  })();
2259
2264
 
2260
- const _m27 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
2265
+ const _m27 = _modules.get("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4") ?? (() => {
2261
2266
  const { cleanXml, escapeXml } = _m17;
2262
2267
 
2263
2268
  const { assertExportValue, assertScalar } = _m5;
@@ -2350,7 +2355,7 @@ function excelDate(date, mode) {
2350
2355
  return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
2351
2356
  }
2352
2357
  const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
2353
- _modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
2358
+ _modules.set("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4", _exports);
2354
2359
  return _exports;
2355
2360
  })();
2356
2361
 
@@ -2420,7 +2425,7 @@ _modules.set("d56b24243cff6f3552a2f7b45521af4491494375ec76117e9ac1ebb047ce02da",
2420
2425
  return _exports;
2421
2426
  })();
2422
2427
 
2423
- const _m32 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
2428
+ const _m32 = _modules.get("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5") ?? (() => {
2424
2429
  const { ChunkedTextSink } = _m3;
2425
2430
 
2426
2431
  const { escapeXml, xmlDeclaration } = _m17;
@@ -2529,11 +2534,11 @@ async function writeChartXml(chart, destination, policy, signal) {
2529
2534
  await text.close();
2530
2535
  }
2531
2536
  const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
2532
- _modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
2537
+ _modules.set("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5", _exports);
2533
2538
  return _exports;
2534
2539
  })();
2535
2540
 
2536
- const _m31 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
2541
+ const _m31 = _modules.get("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4") ?? (() => {
2537
2542
  const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m17;
2538
2543
 
2539
2544
  const { copyExportLink } = _m7;
@@ -2607,11 +2612,11 @@ function drawingXml(images, policy, charts = []) {
2607
2612
  }
2608
2613
  const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
2609
2614
  const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
2610
- _modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
2615
+ _modules.set("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4", _exports);
2611
2616
  return _exports;
2612
2617
  })();
2613
2618
 
2614
- const _m34 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
2619
+ const _m34 = _modules.get("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc") ?? (() => {
2615
2620
  const { OfficeIMOError } = _m2;
2616
2621
 
2617
2622
  const { cellPosition } = _m31;
@@ -2712,11 +2717,11 @@ class MergeRegions {
2712
2717
  throw new RangeError("Merged ranges must stay within exported rows."); }
2713
2718
  }
2714
2719
  const _exports = Object.freeze({ MergeRegions: MergeRegions });
2715
- _modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
2720
+ _modules.set("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc", _exports);
2716
2721
  return _exports;
2717
2722
  })();
2718
2723
 
2719
- const _m35 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
2724
+ const _m35 = _modules.get("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360") ?? (() => {
2720
2725
  const { ExportCell } = _m5;
2721
2726
 
2722
2727
  const { tableSpans } = _m29;
@@ -2749,11 +2754,11 @@ class StructuredRows {
2749
2754
  }
2750
2755
  }
2751
2756
  const _exports = Object.freeze({ StructuredRows: StructuredRows });
2752
- _modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
2757
+ _modules.set("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360", _exports);
2753
2758
  return _exports;
2754
2759
  })();
2755
2760
 
2756
- const _m33 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
2761
+ const _m33 = _modules.get("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81") ?? (() => {
2757
2762
  const { ExportCell } = _m5;
2758
2763
 
2759
2764
  const { isDate } = _m6;
@@ -2950,11 +2955,11 @@ function printXml(options, policy) {
2950
2955
  (options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
2951
2956
  }
2952
2957
  const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
2953
- _modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
2958
+ _modules.set("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81", _exports);
2954
2959
  return _exports;
2955
2960
  })();
2956
2961
 
2957
- const _m37 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
2962
+ const _m37 = _modules.get("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491") ?? (() => {
2958
2963
  const { columnName } = _m27;
2959
2964
 
2960
2965
  /** @internal Data-column selectors use stable keys or one-based worksheet columns. */
@@ -2981,11 +2986,11 @@ function qualifiedCell(sheetName, column, row) {
2981
2986
  return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
2982
2987
  }
2983
2988
  const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
2984
- _modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
2989
+ _modules.set("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491", _exports);
2985
2990
  return _exports;
2986
2991
  })();
2987
2992
 
2988
- const _m38 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
2993
+ const _m38 = _modules.get("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35") ?? (() => {
2989
2994
  const { OfficeIMOError } = _m2;
2990
2995
 
2991
2996
  const { columnName } = _m27;
@@ -3028,11 +3033,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
3028
3033
  return reference || undefined;
3029
3034
  }
3030
3035
  const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
3031
- _modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
3036
+ _modules.set("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35", _exports);
3032
3037
  return _exports;
3033
3038
  })();
3034
3039
 
3035
- const _m36 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
3040
+ const _m36 = _modules.get("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118") ?? (() => {
3036
3041
  const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m17;
3037
3042
 
3038
3043
  const { cellPosition } = _m31;
@@ -3198,11 +3203,11 @@ class ConditionalFormats {
3198
3203
  }
3199
3204
  }
3200
3205
  const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
3201
- _modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
3206
+ _modules.set("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118", _exports);
3202
3207
  return _exports;
3203
3208
  })();
3204
3209
 
3205
- const _m39 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
3210
+ const _m39 = _modules.get("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61") ?? (() => {
3206
3211
  const { OfficeIMOError } = _m2;
3207
3212
 
3208
3213
  const { checkAbort } = _m4;
@@ -3302,11 +3307,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
3302
3307
  yield '</dataValidations>';
3303
3308
  }
3304
3309
  const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
3305
- _modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
3310
+ _modules.set("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61", _exports);
3306
3311
  return _exports;
3307
3312
  })();
3308
3313
 
3309
- const _m30 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
3314
+ const _m30 = _modules.get("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4") ?? (() => {
3310
3315
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3311
3316
 
3312
3317
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -3586,7 +3591,8 @@ class Worksheet {
3586
3591
  });
3587
3592
  const originalCharacters = typeof value === "string" ? value.length : 0;
3588
3593
  let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
3589
- if (type === "string" && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3594
+ // Cleaning removes characters; ordinary strings cannot cross Excel's limit.
3595
+ if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3590
3596
  const cell = col.letter + row;
3591
3597
  if (link || this.linkedCells.has(cell))
3592
3598
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
@@ -4028,11 +4034,11 @@ class Worksheet {
4028
4034
  async discard(error) { this.failed = true; this.error = error; this.pending = []; this.pendingCharacters = 0; this.prepared = undefined; this.buffer = undefined; this.nativeCharts.length = 0; this.chartSources.length = 0; this.output.discard(); await this.entry?.discard(error); }
4029
4035
  }
4030
4036
  const _exports = Object.freeze({ Worksheet: Worksheet });
4031
- _modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
4037
+ _modules.set("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4", _exports);
4032
4038
  return _exports;
4033
4039
  })();
4034
4040
 
4035
- const _m40 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
4041
+ const _m40 = _modules.get("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a") ?? (() => {
4036
4042
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m17;
4037
4043
 
4038
4044
  const { cellText, columnName } = _m27;
@@ -4075,11 +4081,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4075
4081
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4076
4082
  }
4077
4083
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4078
- _modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
4084
+ _modules.set("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a", _exports);
4079
4085
  return _exports;
4080
4086
  })();
4081
4087
 
4082
- const _m41 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
4088
+ const _m41 = _modules.get("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92") ?? (() => {
4083
4089
  const { OfficeIMOError } = _m2;
4084
4090
 
4085
4091
  const { cleanXml } = _m17;
@@ -4143,7 +4149,7 @@ function* splitText(text) {
4143
4149
  }
4144
4150
  }
4145
4151
  const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
4146
- _modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
4152
+ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92", _exports);
4147
4153
  return _exports;
4148
4154
  })();
4149
4155
 
@@ -4170,7 +4176,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
4170
4176
  return _exports;
4171
4177
  })();
4172
4178
 
4173
- const _m44 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
4179
+ const _m44 = _modules.get("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494") ?? (() => {
4174
4180
  const { checkAbort } = _m4;
4175
4181
 
4176
4182
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4298,11 +4304,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
4298
4304
  }, finish });
4299
4305
  }
4300
4306
  const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
4301
- _modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
4307
+ _modules.set("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494", _exports);
4302
4308
  return _exports;
4303
4309
  })();
4304
4310
 
4305
- const _m43 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
4311
+ const _m43 = _modules.get("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219") ?? (() => {
4306
4312
  const { checkAbort } = _m4;
4307
4313
 
4308
4314
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4469,11 +4475,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
4469
4475
  points, textCharacters });
4470
4476
  }
4471
4477
  const _exports = Object.freeze({ prepareChart: prepareChart });
4472
- _modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
4478
+ _modules.set("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219", _exports);
4473
4479
  return _exports;
4474
4480
  })();
4475
4481
 
4476
- const _m22 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
4482
+ const _m22 = _modules.get("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681") ?? (() => {
4477
4483
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4478
4484
 
4479
4485
  const { OfficeIMOError } = _m2;
@@ -4812,12 +4818,15 @@ class Workbook {
4812
4818
  });
4813
4819
  }
4814
4820
  addPart(part) {
4821
+ this.assertOpen();
4822
+ const { uri, contentType, data, relationship } = part;
4823
+ const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
4815
4824
  this.assertOpen();
4816
4825
  // Reserve now so collisions and invalid names fail at the call site.
4817
- this.package.addPart(part);
4818
- if (part.relationship) {
4819
- const { source, ...rel } = part.relationship;
4820
- this.package.addRelationship(source ?? "/xl/workbook.xml", { ...rel, target: part.uri });
4826
+ this.package.addPart({ uri, contentType, data });
4827
+ if (capturedRelationship) {
4828
+ const { source, id, type } = capturedRelationship;
4829
+ this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
4821
4830
  }
4822
4831
  }
4823
4832
  /** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
@@ -4948,7 +4957,7 @@ class Workbook {
4948
4957
  }
4949
4958
  }
4950
4959
  const _exports = Object.freeze({ Workbook: Workbook });
4951
- _modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
4960
+ _modules.set("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681", _exports);
4952
4961
  return _exports;
4953
4962
  })();
4954
4963
 
@@ -5005,7 +5014,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
5005
5014
  return _exports;
5006
5015
  })();
5007
5016
 
5008
- const _m45 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
5017
+ const _m45 = _modules.get("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308") ?? (() => {
5009
5018
  const { withDestination } = _m3;
5010
5019
 
5011
5020
  const { copyColumns } = _m11;
@@ -5060,11 +5069,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5060
5069
  });
5061
5070
  }
5062
5071
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5063
- _modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
5072
+ _modules.set("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308", _exports);
5064
5073
  return _exports;
5065
5074
  })();
5066
5075
 
5067
- const _m48 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
5076
+ const _m48 = _modules.get("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f") ?? (() => {
5068
5077
  const { assertGroupedReportSource } = _m8;
5069
5078
 
5070
5079
  const { captureFields } = _m10;
@@ -5153,11 +5162,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5153
5162
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5154
5163
  }
5155
5164
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5156
- _modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
5165
+ _modules.set("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f", _exports);
5157
5166
  return _exports;
5158
5167
  })();
5159
5168
 
5160
- const _m47 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
5169
+ const _m47 = _modules.get("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e") ?? (() => {
5161
5170
  const { groupedReportOperation } = _m8;
5162
5171
 
5163
5172
  const { checkAbort, withAbort } = _m4;
@@ -5330,14 +5339,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5330
5339
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5331
5340
  }
5332
5341
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5333
- _modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
5342
+ _modules.set("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e", _exports);
5334
5343
  return _exports;
5335
5344
  })();
5336
5345
 
5337
- const _m21 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
5346
+ const _m21 = _modules.get("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195") ?? (() => {
5338
5347
 
5339
5348
  const _exports = Object.freeze({ Workbook: _m22.Workbook, writeXlsx: _m45.writeXlsx, writeXlsxTo: _m45.writeXlsxTo, writeGroupedXlsx: _m47.writeGroupedXlsx, writeGroupedXlsxTo: _m47.writeGroupedXlsxTo, addGroupedXlsx: _m47.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m30.Worksheet, Cell: _m27.Cell, FormulaCell: _m28.FormulaCell, StyleRegistry: _m24.StyleRegistry, NumberFormats: _m24.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
5340
- _modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
5349
+ _modules.set("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195", _exports);
5341
5350
  return _exports;
5342
5351
  })();
5343
5352
 
@@ -5397,7 +5406,7 @@ _modules.set("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208",
5397
5406
  return _exports;
5398
5407
  })();
5399
5408
 
5400
- const _m49 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
5409
+ const _m49 = _modules.get("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4") ?? (() => {
5401
5410
  const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
5402
5411
 
5403
5412
  const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
@@ -5422,29 +5431,32 @@ const { captureCsvOptions } = _m52;
5422
5431
 
5423
5432
 
5424
5433
 
5425
- function csvField(value, delimiter, protect, quote, booleanText, nullValue) {
5426
- if (value == null && nullValue !== undefined)
5427
- value = nullValue;
5434
+ function csvField(value, delimiter, protect, quote, booleanText) {
5435
+ const kind = typeof value;
5428
5436
  let text;
5429
5437
  if (value == null)
5430
5438
  text = "";
5439
+ else if (kind === "string")
5440
+ text = value;
5441
+ else if (kind === "number") {
5442
+ text = Number.isFinite(value) ? String(value) : "";
5443
+ // Numeric text has no CSV delimiter, quote or line break to escape.
5444
+ return quote === "all" ? '"' + text + '"' : text;
5445
+ }
5446
+ else if (kind === "boolean")
5447
+ text = booleanText[value ? "true" : "false"];
5431
5448
  else if (isDate(value))
5432
5449
  text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
5433
- else if (typeof value === "boolean")
5434
- text = booleanText[value ? "true" : "false"];
5435
- else if (typeof value === "number")
5436
- text = Number.isFinite(value) ? String(value) : "";
5437
- else if (typeof value === "string")
5438
- text = value;
5439
5450
  else {
5440
5451
  if (typeof value.then === "function")
5441
5452
  void Promise.resolve(value).catch(() => { });
5442
5453
  throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
5443
5454
  }
5444
- if (protect && (typeof value === "string" || typeof value === "boolean") && /^ *[=+\-@\t\r\n]/.test(text))
5455
+ // Only ASCII spaces, controls and markers through @ can begin the protected prefix.
5456
+ if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
5445
5457
  text = "'" + text;
5446
- return quote === "all" || (quote === "strings" && typeof value === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
5447
- ? '"' + text.replace(/"/g, '""') + '"' : text;
5458
+ return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
5459
+ ? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
5448
5460
  }
5449
5461
  async function writeCsvTo(rows, destination, configuration) {
5450
5462
  const options = captureCsvOptions(configuration);
@@ -5496,7 +5508,7 @@ async function write(rows, sink, options) {
5496
5508
  value = options.nullValue;
5497
5509
  budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
5498
5510
  checkAbort(signal);
5499
- text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText, options.nullValue);
5511
+ text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
5500
5512
  if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
5501
5513
  if (buffer.append(text))
5502
5514
  return buffer.flush().then(() => record(values, header, i + 1, snapshot));
@@ -5544,7 +5556,7 @@ async function writeCsv(rows, configuration) {
5544
5556
  }
5545
5557
  }
5546
5558
  const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
5547
- _modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
5559
+ _modules.set("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4", _exports);
5548
5560
  return _exports;
5549
5561
  })();
5550
5562
 
@@ -7190,7 +7202,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
7190
7202
  return _exports;
7191
7203
  })();
7192
7204
 
7193
- const _m61 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
7205
+ const _m61 = _modules.get("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3") ?? (() => {
7194
7206
  const { NotSupportedError, OfficeIMOError } = _m2;
7195
7207
 
7196
7208
  const { fontProgram } = _m62;
@@ -7201,7 +7213,8 @@ const { pdfNumber, unicodeHex } = _m59;
7201
7213
 
7202
7214
  const { checkAbort, pause, taskYieldDue } = _m4;
7203
7215
 
7204
- const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7216
+ const hexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7217
+ function cidHex(cid) { return hexBytes[cid >>> 8] + hexBytes[cid & 255]; }
7205
7218
  class PdfFontResource {
7206
7219
  index;
7207
7220
  bold;
@@ -7232,12 +7245,16 @@ class PdfFontResource {
7232
7245
  width(scalar) {
7233
7246
  if (this.shared)
7234
7247
  return this.shared.width(scalar);
7235
- const existing = this.mappings.get(scalar);
7236
- if (existing)
7237
- return existing.width;
7238
- const standard = this.standardWidths.get(scalar);
7239
- if (standard !== undefined)
7240
- return standard;
7248
+ if (this.program) {
7249
+ const existing = this.mappings.get(scalar);
7250
+ if (existing)
7251
+ return existing.width;
7252
+ }
7253
+ else {
7254
+ const standard = this.standardWidths.get(scalar);
7255
+ if (standard !== undefined)
7256
+ return standard;
7257
+ }
7241
7258
  const resolved = resolveScalar(scalar, this.program, this.bold);
7242
7259
  if (!resolved.supported) {
7243
7260
  if (resolved.code === "unpaired-surrogate")
@@ -7250,7 +7267,8 @@ class PdfFontResource {
7250
7267
  }
7251
7268
  if (this.mappings.size >= 65535)
7252
7269
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct Unicode scalars.");
7253
- const mapping = { cid: this.mappings.size + 1, glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7270
+ const cid = this.mappings.size + 1;
7271
+ const mapping = { cid, hex: cidHex(cid), glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7254
7272
  this.mappings.set(scalar, mapping);
7255
7273
  return mapping.width;
7256
7274
  }
@@ -7263,8 +7281,20 @@ class PdfFontResource {
7263
7281
  let hex = "";
7264
7282
  for (const char of text) {
7265
7283
  const cp = char.codePointAt(0);
7266
- this.width(cp);
7267
- hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
7284
+ if (this.program) {
7285
+ let mapping = this.mappings.get(cp);
7286
+ // Layout normally registered the scalar already; validate only a newly painted scalar.
7287
+ if (!mapping) {
7288
+ this.width(cp);
7289
+ mapping = this.mappings.get(cp);
7290
+ }
7291
+ hex += mapping.hex;
7292
+ }
7293
+ else {
7294
+ if (!this.standardWidths.has(cp))
7295
+ this.width(cp);
7296
+ hex += hexBytes[standardCode(cp)];
7297
+ }
7268
7298
  }
7269
7299
  return "<" + hex + ">";
7270
7300
  }
@@ -7279,10 +7309,11 @@ class PdfFontResource {
7279
7309
  if (!mapping) {
7280
7310
  if (this.mappings.size >= 65535)
7281
7311
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct CID mappings.");
7282
- mapping = { cid: this.mappings.size + 1, glyph, width: this.program.widths[glyph], text };
7312
+ const cid = this.mappings.size + 1;
7313
+ mapping = { cid, hex: cidHex(cid), glyph, width: this.program.widths[glyph], text };
7283
7314
  this.mappings.set(key, mapping);
7284
7315
  }
7285
- return "<" + mapping.cid.toString(16).padStart(4, "0") + ">";
7316
+ return "<" + mapping.hex + ">";
7286
7317
  }
7287
7318
  async write(objects, compression) {
7288
7319
  checkAbort(this.signal);
@@ -7331,7 +7362,7 @@ class PdfFontResource {
7331
7362
  const batch = mapped.slice(i, i + 100);
7332
7363
  cmap += batch.length + " beginbfchar\n";
7333
7364
  for (const [, m] of batch)
7334
- cmap += "<" + m.cid.toString(16).padStart(4, "0") + "> <" + unicodeHex(m.text) + ">\n";
7365
+ cmap += "<" + m.hex + "> <" + unicodeHex(m.text) + ">\n";
7335
7366
  cmap += "endbfchar\n";
7336
7367
  if (taskYieldDue())
7337
7368
  await pause();
@@ -7382,7 +7413,7 @@ class PdfFontResources {
7382
7413
  if (!found)
7383
7414
  this.explicitSelections.set(explicit, selections);
7384
7415
  }
7385
- const key = String(bold) + String(italic), existing = selections.get(key);
7416
+ const key = (bold ? 2 : 0) | (italic ? 1 : 0), existing = selections.get(key);
7386
7417
  if (existing)
7387
7418
  return existing;
7388
7419
  const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } : selectFont(this.fonts, bold, italic);
@@ -7399,7 +7430,7 @@ class PdfFontResources {
7399
7430
  dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
7400
7431
  }
7401
7432
  const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
7402
- _modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
7433
+ _modules.set("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3", _exports);
7403
7434
  return _exports;
7404
7435
  })();
7405
7436
 
@@ -7924,7 +7955,7 @@ _modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47",
7924
7955
  return _exports;
7925
7956
  })();
7926
7957
 
7927
- const _m72 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
7958
+ const _m72 = _modules.get("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea") ?? (() => {
7928
7959
  const { OfficeIMOError } = _m2;
7929
7960
 
7930
7961
  const { wrapPdfText } = _m70;
@@ -7972,6 +8003,14 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
7972
8003
  for (const row of rows) {
7973
8004
  const cells = [];
7974
8005
  for (const cell of row.cells) {
8006
+ // Ordinary data and leaf headings keep their captured width and lines in every band.
8007
+ // Look up their physical position without allocating another per-row column index.
8008
+ if (cell.span === 1) {
8009
+ const first = band.columns.indexOf(cell.first);
8010
+ if (first >= 0)
8011
+ cells.push({ ...cell, source: cell.source ?? cell, first });
8012
+ continue;
8013
+ }
7975
8014
  for (let first = 0; first < band.columns.length;) {
7976
8015
  const source = band.columns[first];
7977
8016
  if (source < cell.first || source >= cell.first + cell.span) {
@@ -7982,7 +8021,7 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
7982
8021
  while (end < band.columns.length && band.columns[end] === band.columns[end - 1] + 1 && band.columns[end] < cell.first + cell.span)
7983
8022
  end++;
7984
8023
  const width = band.columns.slice(first, end).reduce((sum, index) => sum + widths[index], 0);
7985
- const lines = cell.span === 1 ? cell.lines : await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
8024
+ const lines = await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
7986
8025
  cells.push({ ...cell, source: cell.source ?? cell, first, span: end - first, width, lines,
7987
8026
  lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), cell.font.lineHeight(settings.fontSize)) });
7988
8027
  first = end;
@@ -8011,11 +8050,11 @@ function alignBandBlocks(bands, settings) {
8011
8050
  cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
8012
8051
  }
8013
8052
  const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
8014
- _modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
8053
+ _modules.set("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea", _exports);
8015
8054
  return _exports;
8016
8055
  })();
8017
8056
 
8018
- const _m68 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
8057
+ const _m68 = _modules.get("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874") ?? (() => {
8019
8058
  const { ExportCell } = _m5;
8020
8059
 
8021
8060
  const { copyExportLink } = _m7;
@@ -8135,8 +8174,12 @@ class PdfTableLayout {
8135
8174
  lines };
8136
8175
  }
8137
8176
  row(cells) {
8138
- const lines = Math.max(1, ...cells.map(c => c.lines.length));
8139
- const lineHeight = Math.max(this.lineHeight, ...cells.map(c => c.lineHeight));
8177
+ let lines = 1, lineHeight = this.lineHeight;
8178
+ for (let index = 0; index < cells.length; index++) {
8179
+ const cell = cells[index];
8180
+ lines = Math.max(lines, cell.lines.length);
8181
+ lineHeight = Math.max(lineHeight, cell.lineHeight);
8182
+ }
8140
8183
  return { cells, lines, lineHeight, height: lines * lineHeight + this.settings.padding * 2 };
8141
8184
  }
8142
8185
  async headers() {
@@ -8242,11 +8285,11 @@ class PdfTableLayout {
8242
8285
  }
8243
8286
  }
8244
8287
  const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
8245
- _modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
8288
+ _modules.set("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874", _exports);
8246
8289
  return _exports;
8247
8290
  })();
8248
8291
 
8249
- const _m74 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
8292
+ const _m74 = _modules.get("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72") ?? (() => {
8250
8293
  const { OfficeIMOError } = _m2;
8251
8294
 
8252
8295
  const { checkAbort } = _m4;
@@ -8290,7 +8333,7 @@ class PdfTableBandFlow {
8290
8333
  await this.flush();
8291
8334
  }
8292
8335
  async row(row, allowFirstFragment = false) {
8293
- const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
8336
+ const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = minimumLines * row.lineHeight + padding * 2;
8294
8337
  if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
8295
8338
  throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
8296
8339
  // Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
@@ -8324,9 +8367,14 @@ class PdfTableBandFlow {
8324
8367
  let remaining = false;
8325
8368
  const cells = rows[0].cells.map(cell => {
8326
8369
  const source = this.layout.bands[index].columns[cell.first];
8327
- const repeated = this.layout.repeatedColumn(source), visible = repeated ? cell.lines : cell.lines.slice(first, first + lines);
8370
+ const repeated = this.layout.repeatedColumn(source), reusable = cell.span === 1 && (cell.source?.span ?? 1) === 1 && (cell.rowSpan ?? 1) === 1 &&
8371
+ cell.height === undefined && first === 0 && (repeated || lines >= cell.lines.length);
8372
+ const visible = repeated || reusable ? cell.lines : cell.lines.slice(first, first + lines);
8328
8373
  if (!repeated && (visible.length > 0 || cell.link !== undefined))
8329
8374
  remaining = true;
8375
+ // A complete first fragment already owns these lines and their maximum font metrics.
8376
+ if (reusable)
8377
+ return cell;
8330
8378
  const { height: _height, ...plain } = cell;
8331
8379
  return { ...plain, lines: visible,
8332
8380
  lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
@@ -8379,11 +8427,11 @@ class PdfTableBandFlow {
8379
8427
  }
8380
8428
  }
8381
8429
  const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
8382
- _modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
8430
+ _modules.set("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72", _exports);
8383
8431
  return _exports;
8384
8432
  })();
8385
8433
 
8386
- const _m75 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
8434
+ const _m75 = _modules.get("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf") ?? (() => {
8387
8435
  /** @internal Source-cell identities survive page fragments and horizontal band projections.
8388
8436
  * Only column headers and still-owned row objects remain reachable from this table owner. */
8389
8437
  class PdfTableStructure {
@@ -8435,30 +8483,31 @@ class PdfTableStructure {
8435
8483
  return row.cells.map(cell => this.cells.get(cell));
8436
8484
  const rowId = this.structure.element("TR", parent);
8437
8485
  this.rows.set(row, rowId);
8438
- const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
8439
8486
  // Allocate in source order, then resolve every row header before associating even earlier data cells.
8440
8487
  // Generated summary labels override detail roles so numeric subtotal cells never become row headers.
8441
8488
  const ids = row.cells.map((cell, index) => {
8442
- const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
8489
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8490
+ const id = this.structure.element(header ? "TH" : "TD", rowId);
8443
8491
  this.cells.set(cell, id);
8444
8492
  return id;
8445
8493
  });
8446
- const rowHeaders = [];
8494
+ let rowHeaders;
8447
8495
  for (let index = 0; index < ids.length; index++)
8448
- if (headers[index])
8449
- rowHeaders.push(await this.structure.identifier(ids[index]));
8496
+ if (rowHeaderIndex === undefined ? row.cells[index].rowHeader === true : index === rowHeaderIndex)
8497
+ (rowHeaders ??= []).push(await this.structure.identifier(ids[index]));
8450
8498
  for (let index = 0; index < row.cells.length; index++) {
8451
8499
  const cell = row.cells[index];
8452
- if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8500
+ if (!rowHeaders && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8453
8501
  const attributes = this.ordinaryAttributes[cell.first] ??=
8454
8502
  await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
8455
8503
  this.structure.setAttributes(ids[index], attributes);
8456
8504
  continue;
8457
8505
  }
8458
8506
  const associations = this.associations(cell);
8459
- if (!headers[index])
8507
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8508
+ if (!header && rowHeaders)
8460
8509
  associations.push(...rowHeaders);
8461
- this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
8510
+ this.structure.setAttributes(ids[index], this.attributes(cell, associations, header ? "Row" : undefined));
8462
8511
  }
8463
8512
  return ids;
8464
8513
  }
@@ -8493,7 +8542,7 @@ class PdfTableStructure {
8493
8542
  }
8494
8543
  }
8495
8544
  const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
8496
- _modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
8545
+ _modules.set("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf", _exports);
8497
8546
  return _exports;
8498
8547
  })();
8499
8548
 
@@ -8611,7 +8660,7 @@ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052",
8611
8660
  return _exports;
8612
8661
  })();
8613
8662
 
8614
- const _m73 = _modules.get("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410") ?? (() => {
8663
+ const _m73 = _modules.get("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9") ?? (() => {
8615
8664
  const { OfficeIMOError } = _m2;
8616
8665
 
8617
8666
  const { checkAbort } = _m4;
@@ -8646,7 +8695,8 @@ class PdfPages {
8646
8695
  outlines;
8647
8696
  references = [];
8648
8697
  current = 0;
8649
- commands = [];
8698
+ commands = "";
8699
+ commandParts = [];
8650
8700
  commandBytes = 0;
8651
8701
  annotations = [];
8652
8702
  hyperlinks = 0;
@@ -8664,6 +8714,12 @@ class PdfPages {
8664
8714
  pendingBookmarks = [];
8665
8715
  pageNumberWidth = 0;
8666
8716
  colors = new Map();
8717
+ textFont;
8718
+ textSize = 0;
8719
+ textColor = "";
8720
+ textPrefix = "";
8721
+ rectangleLefts;
8722
+ rectangleColumns = [];
8667
8723
  externalObjects = new Map();
8668
8724
  bandFlow;
8669
8725
  bandCellBudget = false;
@@ -8730,7 +8786,7 @@ class PdfPages {
8730
8786
  }
8731
8787
  add(command) {
8732
8788
  this.retainPageBytes(command.length);
8733
- this.commands.push(command);
8789
+ this.commands += command;
8734
8790
  }
8735
8791
  retainPageBytes(length) {
8736
8792
  this.commandBytes += length;
@@ -8750,9 +8806,17 @@ class PdfPages {
8750
8806
  return this.structure ? "/Artifact << /Type /" + type + " >> BDC\n" + command + "EMC\n" : command;
8751
8807
  }
8752
8808
  text(text, font, size, x, baseline, foreground = "111827", element) {
8753
- const n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8754
- const command = "q " + this.rgb(foreground) + " rg " + this.rgb(foreground) + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8755
- (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 " + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
8809
+ const n = pdfNumber;
8810
+ if (font !== this.textFont || size !== this.textSize || foreground !== this.textColor) {
8811
+ const shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(foreground);
8812
+ // Keep one prefix, independent of report size. Resource identity includes synthetic styling.
8813
+ this.textPrefix = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8814
+ (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 ";
8815
+ this.textFont = font;
8816
+ this.textSize = size;
8817
+ this.textColor = foreground;
8818
+ }
8819
+ const command = this.textPrefix + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
8756
8820
  this.add(this.structure && element !== undefined ? this.structure.mark(element) + command + "EMC\n" : this.artifact(command, "Pagination"));
8757
8821
  }
8758
8822
  link(link, x, bottom, width, height, element) {
@@ -8782,8 +8846,8 @@ class PdfPages {
8782
8846
  for (const segment of line.segments) {
8783
8847
  const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
8784
8848
  if (segment.glyphs) {
8785
- const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8786
- let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8849
+ const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(segment.color ?? "111827");
8850
+ let cursor = x, command = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8787
8851
  (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ");
8788
8852
  for (const glyph of segment.glyphs) {
8789
8853
  command += "1 0 " + n(shear) + " 1 " + n(cursor + (glyph.xOffset + shear * glyph.yOffset) * size / 1000) + " " + n(baseline + glyph.yOffset * size / 1000) + " Tm " + font.encodeGlyph(glyph.id, glyph.logicalText) + " Tj\n";
@@ -8831,7 +8895,8 @@ class PdfPages {
8831
8895
  this.current = this.objects.reserve();
8832
8896
  this.references.push(this.current);
8833
8897
  }
8834
- this.commands = [];
8898
+ this.commands = "";
8899
+ this.commandParts = [];
8835
8900
  this.annotations = [];
8836
8901
  this.commandBytes = 0;
8837
8902
  this.bodyAdded = false;
@@ -8896,7 +8961,7 @@ class PdfPages {
8896
8961
  // Charge physical repeats without recapturing callbacks or making them semantic duplicates.
8897
8962
  for (const cell of header.cells)
8898
8963
  if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
8899
- this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
8964
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
8900
8965
  const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
8901
8966
  const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
8902
8967
  this.draw(header, 0, header.lines, elements, repeated);
@@ -8914,14 +8979,32 @@ class PdfPages {
8914
8979
  if (!this.layout)
8915
8980
  throw new Error("A table layout is required before drawing rows.");
8916
8981
  this.bodyAdded = true;
8917
- const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
8982
+ const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2, lefts = this.layout.lefts;
8983
+ // One geometry token per active physical column; table/band changes release the old tokens.
8984
+ if (this.rectangleLefts !== lefts) {
8985
+ this.rectangleLefts = lefts;
8986
+ this.rectangleColumns = [];
8987
+ }
8988
+ let rectangleHeight, rectangleBottom = "", rectangleHeightText = "";
8918
8989
  for (const [index, cell] of row.cells.entries()) {
8919
8990
  if (this.bandCellBudget)
8920
- this.settings.budget.cell((cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
8921
- const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
8991
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
8992
+ (cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
8993
+ const x = lefts[cell.first], cellHeight = cell.height ?? height;
8994
+ if (cellHeight !== rectangleHeight) {
8995
+ rectangleBottom = n(this.y - cellHeight);
8996
+ rectangleHeightText = n(cellHeight);
8997
+ rectangleHeight = cellHeight;
8998
+ }
8999
+ let horizontal = this.rectangleColumns[cell.first];
9000
+ if (!horizontal || horizontal.x !== x || horizontal.width !== cell.width) {
9001
+ horizontal = { x, width: cell.width, left: n(x), widthText: n(cell.width) };
9002
+ this.rectangleColumns[cell.first] = horizontal;
9003
+ }
9004
+ const rectangle = horizontal.left + " " + rectangleBottom + " " + horizontal.widthText + " " + rectangleHeightText;
8922
9005
  if (cell.style.background)
8923
- this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
8924
- this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re S Q\n"));
9006
+ this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + rectangle + " re f Q\n"));
9007
+ this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + rectangle + " re S Q\n"));
8925
9008
  const element = elements?.[index], artifact = cell.semanticArtifact || repeated[index], owner = cell.link && this.structure && element !== undefined ? this.structure.link(element, cell.link) : element;
8926
9009
  for (let line = firstLine; line < Math.min(cell.lines.length, cell.height ? cell.lines.length : firstLine + lineCount); line++) {
8927
9010
  const text = cell.lines[line], left = cell.style.alignment === "right" ? cell.width - padding - text.width : cell.style.alignment === "center" ? (cell.width - text.width) / 2 : padding;
@@ -8931,6 +9014,7 @@ class PdfPages {
8931
9014
  this.link(cell.link, x, this.y - cellHeight, cell.width, cellHeight, owner);
8932
9015
  }
8933
9016
  this.y -= row.structured ? row.height : height;
9017
+ this.sealCommands();
8934
9018
  }
8935
9019
  async block(rows) {
8936
9020
  if (this.bandFlow)
@@ -9256,9 +9340,22 @@ class PdfPages {
9256
9340
  marker: { line: item.marker, gap: item.markerGap, ...(label === undefined ? {} : { owner: label }) } });
9257
9341
  await this.structure?.complete(li);
9258
9342
  }
9343
+ sealCommands() {
9344
+ if (this.commands) {
9345
+ this.commandParts.push(this.commands);
9346
+ this.commands = "";
9347
+ }
9348
+ }
9349
+ takeCommands() {
9350
+ this.sealCommands();
9351
+ const content = this.commandParts.join("");
9352
+ // Encoding and awaited delivery own the page value; the next page starts independently.
9353
+ this.commandParts = [];
9354
+ return content;
9355
+ }
9259
9356
  async finishPage() {
9260
9357
  const contents = this.objects.reserve(), { page, options } = this.settings;
9261
- await this.objects.stream(contents, this.commands.join(""), "", options.compression !== false);
9358
+ await this.objects.stream(contents, this.takeCommands(), "", options.compression !== false);
9262
9359
  const annotations = [];
9263
9360
  for (const annotation of this.annotations) {
9264
9361
  annotations.push(annotation.id);
@@ -9270,7 +9367,6 @@ class PdfPages {
9270
9367
  (annotations.length ? " /Annots [" + annotations.map(id => id + " 0 R").join(" ") + "]" : "") + " >>");
9271
9368
  if (this.structure)
9272
9369
  await this.structure.finishPage();
9273
- this.commands = [];
9274
9370
  this.annotations = [];
9275
9371
  this.commandBytes = 0;
9276
9372
  this.current = 0;
@@ -9302,7 +9398,7 @@ class PdfPages {
9302
9398
  }
9303
9399
  }
9304
9400
  const _exports = Object.freeze({ PdfPages: PdfPages });
9305
- _modules.set("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410", _exports);
9401
+ _modules.set("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9", _exports);
9306
9402
  return _exports;
9307
9403
  })();
9308
9404
 
@@ -9745,7 +9841,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
9745
9841
  return _exports;
9746
9842
  })();
9747
9843
 
9748
- const _m58 = _modules.get("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9") ?? (() => {
9844
+ const _m58 = _modules.get("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273") ?? (() => {
9749
9845
  const { PdfObjects, unicodeHex } = _m59;
9750
9846
 
9751
9847
  const { PdfFontResources } = _m61;
@@ -9808,11 +9904,11 @@ class PdfWriteSession {
9808
9904
  }
9809
9905
  }
9810
9906
  const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
9811
- _modules.set("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9", _exports);
9907
+ _modules.set("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273", _exports);
9812
9908
  return _exports;
9813
9909
  })();
9814
9910
 
9815
- const _m54 = _modules.get("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2") ?? (() => {
9911
+ const _m54 = _modules.get("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b") ?? (() => {
9816
9912
  const { BlobByteSink, withDestination } = _m3;
9817
9913
 
9818
9914
  const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
@@ -9877,7 +9973,7 @@ async function writePdfTo(rows, destination, configuration) {
9877
9973
  });
9878
9974
  }
9879
9975
  const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
9880
- _modules.set("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2", _exports);
9976
+ _modules.set("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b", _exports);
9881
9977
  return _exports;
9882
9978
  })();
9883
9979
 
@@ -10809,7 +10905,7 @@ _modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343",
10809
10905
  return _exports;
10810
10906
  })();
10811
10907
 
10812
- const _m90 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
10908
+ const _m90 = _modules.get("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0") ?? (() => {
10813
10909
  const { assertGroupedReportSource, groupedReportOperation } = _m8;
10814
10910
 
10815
10911
  const { consumeRows } = _m4;
@@ -11063,11 +11159,11 @@ async function renderGroupedPdfTable(block, context) {
11063
11159
  }
11064
11160
  }
11065
11161
  const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
11066
- _modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
11162
+ _modules.set("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0", _exports);
11067
11163
  return _exports;
11068
11164
  })();
11069
11165
 
11070
- const _m83 = _modules.get("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223") ?? (() => {
11166
+ const _m83 = _modules.get("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904") ?? (() => {
11071
11167
  const { BlobByteSink, withDestination } = _m3;
11072
11168
 
11073
11169
  const { OfficeIMOError } = _m2;
@@ -11357,11 +11453,11 @@ function captureTableOptions(options) {
11357
11453
  return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
11358
11454
  }
11359
11455
  const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
11360
- _modules.set("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223", _exports);
11456
+ _modules.set("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904", _exports);
11361
11457
  return _exports;
11362
11458
  })();
11363
11459
 
11364
- const _m82 = _modules.get("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557") ?? (() => {
11460
+ const _m82 = _modules.get("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba") ?? (() => {
11365
11461
  const { assertGroupedReportSource } = _m8;
11366
11462
 
11367
11463
  const { BlobByteSink } = _m3;
@@ -11407,7 +11503,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
11407
11503
  return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
11408
11504
  }
11409
11505
  const _exports = Object.freeze({ pdfGroupedTable: _m91.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
11410
- _modules.set("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557", _exports);
11506
+ _modules.set("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba", _exports);
11411
11507
  return _exports;
11412
11508
  })();
11413
11509
 
@@ -11451,17 +11547,17 @@ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86",
11451
11547
  return _exports;
11452
11548
  })();
11453
11549
 
11454
- const _m53 = _modules.get("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c") ?? (() => {
11550
+ const _m53 = _modules.get("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe") ?? (() => {
11455
11551
 
11456
11552
  const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m83.writePdfDocument, writePdfDocumentTo: _m83.writePdfDocumentTo, pdfTable: _m83.pdfTable, PdfFont: _m62.PdfFont, preflightPdfText: _m92.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
11457
- _modules.set("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c", _exports);
11553
+ _modules.set("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe", _exports);
11458
11554
  return _exports;
11459
11555
  })();
11460
11556
 
11461
- const _m0 = _modules.get("2326f5920286bdb2ad00162f44943363623b3dd7175dc21d18d864aa4b52e4fc") ?? (() => {
11557
+ const _m0 = _modules.get("35bc55b225e3877fa9dcfb53e6200bd8637a4df890d7feaa3def46ac188fce8f") ?? (() => {
11462
11558
 
11463
11559
  const _exports = Object.freeze({ core: _m1, zip: _m14, xml: _m17, opc: _m18, xlsx: _m21, csv: _m49, pdf: _m53, Workbook: _m21.Workbook, Worksheet: _m21.Worksheet, Cell: _m21.Cell, FormulaCell: _m21.FormulaCell, StyleRegistry: _m21.StyleRegistry, NumberFormats: _m21.NumberFormats, writeXlsx: _m21.writeXlsx, writeXlsxTo: _m21.writeXlsxTo, writeCsv: _m49.writeCsv, writeCsvTo: _m49.writeCsvTo, createGroupedReport: _m8.createGroupedReport, writeGroupedXlsx: _m47.writeGroupedXlsx, writeGroupedXlsxTo: _m47.writeGroupedXlsxTo, addGroupedXlsx: _m47.addGroupedXlsx, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, writePdf: _m53.writePdf, writePdfTo: _m53.writePdfTo, writePdfDocument: _m53.writePdfDocument, writePdfDocumentTo: _m53.writePdfDocumentTo, pdfTable: _m53.pdfTable, PdfFont: _m53.PdfFont, preflightPdfText: _m53.preflightPdfText, OfficeIMOError: _m1.OfficeIMOError, NotSupportedError: _m1.NotSupportedError, detectFeatures: _m1.detectFeatures, saveBlob: _m1.saveBlob, ExportCell: _m1.ExportCell });
11464
- _modules.set("2326f5920286bdb2ad00162f44943363623b3dd7175dc21d18d864aa4b52e4fc", _exports);
11560
+ _modules.set("35bc55b225e3877fa9dcfb53e6200bd8637a4df890d7feaa3def46ac188fce8f", _exports);
11465
11561
  return _exports;
11466
11562
  })();
11467
11563
  Object.assign(officeimo, _m0);