@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
@@ -1525,12 +1525,14 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
1525
1525
  return _exports;
1526
1526
  })();
1527
1527
 
1528
- const _m28 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
1528
+ const _m28 = _modules.get("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585") ?? (() => {
1529
1529
  const { OfficeIMOError } = _m2;
1530
1530
 
1531
1531
  const { ChunkedTextSink } = _m3;
1532
1532
 
1533
1533
  const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
1534
+ const xmlEscapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1535
+ "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1534
1536
  /** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
1535
1537
  function cleanXml(value, policy = "strip") {
1536
1538
  if (policy !== "strip" && policy !== "reject")
@@ -1542,9 +1544,7 @@ function cleanXml(value, policy = "strip") {
1542
1544
  }
1543
1545
  /** Escape data, including whitespace that XML parsers otherwise normalize. */
1544
1546
  function escapeXml(value, policy = "strip") {
1545
- const escapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
1546
- "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
1547
- return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
1547
+ return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
1548
1548
  }
1549
1549
  /** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
1550
1550
  function escapeOoxmlAttribute(value, policy = "strip") {
@@ -1603,11 +1603,11 @@ class XmlWriter {
1603
1603
  throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
1604
1604
  }
1605
1605
  const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
1606
- _modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
1606
+ _modules.set("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585", _exports);
1607
1607
  return _exports;
1608
1608
  })();
1609
1609
 
1610
- const _m27 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
1610
+ const _m27 = _modules.get("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a") ?? (() => {
1611
1611
  const { escapeXml, xmlDeclaration } = _m28;
1612
1612
 
1613
1613
  const { isDate } = _m6;
@@ -1629,7 +1629,7 @@ function appPropertiesXml(properties = {}, policy = "strip") {
1629
1629
  '<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
1630
1630
  }
1631
1631
  const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
1632
- _modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
1632
+ _modules.set("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a", _exports);
1633
1633
  return _exports;
1634
1634
  })();
1635
1635
 
@@ -2048,7 +2048,7 @@ _modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb",
2048
2048
  return _exports;
2049
2049
  })();
2050
2050
 
2051
- const _m25 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
2051
+ const _m25 = _modules.get("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5") ?? (() => {
2052
2052
 
2053
2053
 
2054
2054
 
@@ -2147,8 +2147,11 @@ class OpcPackage {
2147
2147
  return uri;
2148
2148
  }
2149
2149
  addPart(part) {
2150
- const uri = this.reserve(part.uri, part.contentType);
2151
- this.parts.set(uri.toLowerCase(), { ...part, uri, data: part.data instanceof Uint8Array ? new Uint8Array(part.data) : part.data });
2150
+ const { uri: requestedUri, contentType, data } = part;
2151
+ // Structural accessors and byte ownership are captured before reserving metadata.
2152
+ const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
2153
+ const uri = this.reserve(requestedUri, contentType);
2154
+ this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
2152
2155
  }
2153
2156
  /** @internal */
2154
2157
  addPrepared(uri, type, prepared) {
@@ -2173,17 +2176,19 @@ class OpcPackage {
2173
2176
  checkAbort(this.options.signal);
2174
2177
  this.open();
2175
2178
  source = source === "/" ? source : partUri(source);
2176
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(relationship.id))
2179
+ const { id, type, target: requestedTarget, external } = relationship;
2180
+ this.open();
2181
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
2177
2182
  throw new TypeError("Relationship id must be an XML ID.");
2178
- if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(relationship.type))
2183
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
2179
2184
  throw new TypeError("Relationship type must be an absolute URI.");
2180
- const target = relationship.external ? relationship.target : partUri(relationship.target);
2181
- if (relationship.external && (!target || /[\u0000-\u0020]/.test(target)))
2185
+ const target = external ? requestedTarget : partUri(requestedTarget);
2186
+ if (external && (!target || /[\u0000-\u0020]/.test(target)))
2182
2187
  throw new TypeError("Invalid external relationship target.");
2183
2188
  const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
2184
- if (list.has(relationship.id))
2185
- throw new TypeError("Duplicate relationship id: " + relationship.id);
2186
- list.set(relationship.id, { ...relationship, target });
2189
+ if (list.has(id))
2190
+ throw new TypeError("Duplicate relationship id: " + id);
2191
+ list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
2187
2192
  this.relationships.set(key, list);
2188
2193
  }
2189
2194
  setProperties(core = {}, app = {}) {
@@ -2293,7 +2298,7 @@ class OpcPackage {
2293
2298
  }
2294
2299
  }
2295
2300
  const _exports = Object.freeze({ partUri: _m26.partUri, relationshipPartUri: _m26.relationshipPartUri, relativePartTarget: _m26.relativePartTarget, corePropertiesXml: _m27.corePropertiesXml, appPropertiesXml: _m27.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
2296
- _modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
2301
+ _modules.set("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5", _exports);
2297
2302
  return _exports;
2298
2303
  })();
2299
2304
 
@@ -2309,7 +2314,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
2309
2314
  return _exports;
2310
2315
  })();
2311
2316
 
2312
- const _m34 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
2317
+ const _m34 = _modules.get("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148") ?? (() => {
2313
2318
  const { OfficeIMOError } = _m2;
2314
2319
 
2315
2320
  const { cleanXml, escapeOoxmlAttribute } = _m28;
@@ -2416,11 +2421,11 @@ function differentialXml(style, policy, numberFormat) {
2416
2421
  return xml;
2417
2422
  }
2418
2423
  const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
2419
- _modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
2424
+ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148", _exports);
2420
2425
  return _exports;
2421
2426
  })();
2422
2427
 
2423
- const _m32 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
2428
+ const _m32 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
2424
2429
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
2425
2430
 
2426
2431
  const { OfficeIMOError } = _m2;
@@ -2630,11 +2635,11 @@ class StyleRegistry {
2630
2635
  }
2631
2636
  }
2632
2637
  const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2633
- _modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
2638
+ _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
2634
2639
  return _exports;
2635
2640
  })();
2636
2641
 
2637
- const _m36 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
2642
+ const _m36 = _modules.get("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93") ?? (() => {
2638
2643
  const { NotSupportedError } = _m2;
2639
2644
 
2640
2645
  const { cleanXml, escapeXml } = _m28;
@@ -2742,11 +2747,11 @@ function formulaXml(cell) {
2742
2747
  return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
2743
2748
  }
2744
2749
  const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
2745
- _modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
2750
+ _modules.set("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93", _exports);
2746
2751
  return _exports;
2747
2752
  })();
2748
2753
 
2749
- const _m35 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
2754
+ const _m35 = _modules.get("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4") ?? (() => {
2750
2755
  const { cleanXml, escapeXml } = _m28;
2751
2756
 
2752
2757
  const { assertExportValue, assertScalar } = _m5;
@@ -2839,11 +2844,11 @@ function excelDate(date, mode) {
2839
2844
  return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
2840
2845
  }
2841
2846
  const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
2842
- _modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
2847
+ _modules.set("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4", _exports);
2843
2848
  return _exports;
2844
2849
  })();
2845
2850
 
2846
- const _m39 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
2851
+ const _m39 = _modules.get("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5") ?? (() => {
2847
2852
  const { ChunkedTextSink } = _m3;
2848
2853
 
2849
2854
  const { escapeXml, xmlDeclaration } = _m28;
@@ -2952,11 +2957,11 @@ async function writeChartXml(chart, destination, policy, signal) {
2952
2957
  await text.close();
2953
2958
  }
2954
2959
  const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
2955
- _modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
2960
+ _modules.set("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5", _exports);
2956
2961
  return _exports;
2957
2962
  })();
2958
2963
 
2959
- const _m38 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
2964
+ const _m38 = _modules.get("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4") ?? (() => {
2960
2965
  const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m28;
2961
2966
 
2962
2967
  const { copyExportLink } = _m7;
@@ -3030,11 +3035,11 @@ function drawingXml(images, policy, charts = []) {
3030
3035
  }
3031
3036
  const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
3032
3037
  const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
3033
- _modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
3038
+ _modules.set("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4", _exports);
3034
3039
  return _exports;
3035
3040
  })();
3036
3041
 
3037
- const _m41 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
3042
+ const _m41 = _modules.get("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc") ?? (() => {
3038
3043
  const { OfficeIMOError } = _m2;
3039
3044
 
3040
3045
  const { cellPosition } = _m38;
@@ -3135,11 +3140,11 @@ class MergeRegions {
3135
3140
  throw new RangeError("Merged ranges must stay within exported rows."); }
3136
3141
  }
3137
3142
  const _exports = Object.freeze({ MergeRegions: MergeRegions });
3138
- _modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
3143
+ _modules.set("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc", _exports);
3139
3144
  return _exports;
3140
3145
  })();
3141
3146
 
3142
- const _m42 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
3147
+ const _m42 = _modules.get("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360") ?? (() => {
3143
3148
  const { ExportCell } = _m5;
3144
3149
 
3145
3150
  const { tableSpans } = _m18;
@@ -3172,11 +3177,11 @@ class StructuredRows {
3172
3177
  }
3173
3178
  }
3174
3179
  const _exports = Object.freeze({ StructuredRows: StructuredRows });
3175
- _modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
3180
+ _modules.set("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360", _exports);
3176
3181
  return _exports;
3177
3182
  })();
3178
3183
 
3179
- const _m40 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
3184
+ const _m40 = _modules.get("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81") ?? (() => {
3180
3185
  const { ExportCell } = _m5;
3181
3186
 
3182
3187
  const { isDate } = _m6;
@@ -3373,11 +3378,11 @@ function printXml(options, policy) {
3373
3378
  (options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
3374
3379
  }
3375
3380
  const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
3376
- _modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
3381
+ _modules.set("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81", _exports);
3377
3382
  return _exports;
3378
3383
  })();
3379
3384
 
3380
- const _m44 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
3385
+ const _m44 = _modules.get("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491") ?? (() => {
3381
3386
  const { columnName } = _m35;
3382
3387
 
3383
3388
  /** @internal Data-column selectors use stable keys or one-based worksheet columns. */
@@ -3404,11 +3409,11 @@ function qualifiedCell(sheetName, column, row) {
3404
3409
  return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
3405
3410
  }
3406
3411
  const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
3407
- _modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
3412
+ _modules.set("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491", _exports);
3408
3413
  return _exports;
3409
3414
  })();
3410
3415
 
3411
- const _m45 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
3416
+ const _m45 = _modules.get("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35") ?? (() => {
3412
3417
  const { OfficeIMOError } = _m2;
3413
3418
 
3414
3419
  const { columnName } = _m35;
@@ -3451,11 +3456,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
3451
3456
  return reference || undefined;
3452
3457
  }
3453
3458
  const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
3454
- _modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
3459
+ _modules.set("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35", _exports);
3455
3460
  return _exports;
3456
3461
  })();
3457
3462
 
3458
- const _m43 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
3463
+ const _m43 = _modules.get("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118") ?? (() => {
3459
3464
  const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m28;
3460
3465
 
3461
3466
  const { cellPosition } = _m38;
@@ -3621,11 +3626,11 @@ class ConditionalFormats {
3621
3626
  }
3622
3627
  }
3623
3628
  const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
3624
- _modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
3629
+ _modules.set("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118", _exports);
3625
3630
  return _exports;
3626
3631
  })();
3627
3632
 
3628
- const _m46 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
3633
+ const _m46 = _modules.get("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61") ?? (() => {
3629
3634
  const { OfficeIMOError } = _m2;
3630
3635
 
3631
3636
  const { checkAbort } = _m4;
@@ -3725,11 +3730,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
3725
3730
  yield '</dataValidations>';
3726
3731
  }
3727
3732
  const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
3728
- _modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
3733
+ _modules.set("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61", _exports);
3729
3734
  return _exports;
3730
3735
  })();
3731
3736
 
3732
- const _m37 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
3737
+ const _m37 = _modules.get("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4") ?? (() => {
3733
3738
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3734
3739
 
3735
3740
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -4009,7 +4014,8 @@ class Worksheet {
4009
4014
  });
4010
4015
  const originalCharacters = typeof value === "string" ? value.length : 0;
4011
4016
  let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
4012
- if (type === "string" && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
4017
+ // Cleaning removes characters; ordinary strings cannot cross Excel's limit.
4018
+ if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
4013
4019
  const cell = col.letter + row;
4014
4020
  if (link || this.linkedCells.has(cell))
4015
4021
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
@@ -4451,11 +4457,11 @@ class Worksheet {
4451
4457
  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); }
4452
4458
  }
4453
4459
  const _exports = Object.freeze({ Worksheet: Worksheet });
4454
- _modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
4460
+ _modules.set("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4", _exports);
4455
4461
  return _exports;
4456
4462
  })();
4457
4463
 
4458
- const _m47 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
4464
+ const _m47 = _modules.get("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a") ?? (() => {
4459
4465
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m28;
4460
4466
 
4461
4467
  const { cellText, columnName } = _m35;
@@ -4498,11 +4504,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4498
4504
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4499
4505
  }
4500
4506
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4501
- _modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
4507
+ _modules.set("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a", _exports);
4502
4508
  return _exports;
4503
4509
  })();
4504
4510
 
4505
- const _m48 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
4511
+ const _m48 = _modules.get("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92") ?? (() => {
4506
4512
  const { OfficeIMOError } = _m2;
4507
4513
 
4508
4514
  const { cleanXml } = _m28;
@@ -4566,11 +4572,11 @@ function* splitText(text) {
4566
4572
  }
4567
4573
  }
4568
4574
  const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
4569
- _modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
4575
+ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92", _exports);
4570
4576
  return _exports;
4571
4577
  })();
4572
4578
 
4573
- const _m50 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
4579
+ const _m50 = _modules.get("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494") ?? (() => {
4574
4580
  const { checkAbort } = _m4;
4575
4581
 
4576
4582
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4698,11 +4704,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
4698
4704
  }, finish });
4699
4705
  }
4700
4706
  const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
4701
- _modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
4707
+ _modules.set("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494", _exports);
4702
4708
  return _exports;
4703
4709
  })();
4704
4710
 
4705
- const _m49 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
4711
+ const _m49 = _modules.get("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219") ?? (() => {
4706
4712
  const { checkAbort } = _m4;
4707
4713
 
4708
4714
  const { NotSupportedError, OfficeIMOError } = _m2;
@@ -4869,11 +4875,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
4869
4875
  points, textCharacters });
4870
4876
  }
4871
4877
  const _exports = Object.freeze({ prepareChart: prepareChart });
4872
- _modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
4878
+ _modules.set("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219", _exports);
4873
4879
  return _exports;
4874
4880
  })();
4875
4881
 
4876
- const _m24 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
4882
+ const _m24 = _modules.get("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681") ?? (() => {
4877
4883
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4878
4884
 
4879
4885
  const { OfficeIMOError } = _m2;
@@ -5212,12 +5218,15 @@ class Workbook {
5212
5218
  });
5213
5219
  }
5214
5220
  addPart(part) {
5221
+ this.assertOpen();
5222
+ const { uri, contentType, data, relationship } = part;
5223
+ const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
5215
5224
  this.assertOpen();
5216
5225
  // Reserve now so collisions and invalid names fail at the call site.
5217
- this.package.addPart(part);
5218
- if (part.relationship) {
5219
- const { source, ...rel } = part.relationship;
5220
- this.package.addRelationship(source ?? "/xl/workbook.xml", { ...rel, target: part.uri });
5226
+ this.package.addPart({ uri, contentType, data });
5227
+ if (capturedRelationship) {
5228
+ const { source, id, type } = capturedRelationship;
5229
+ this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
5221
5230
  }
5222
5231
  }
5223
5232
  /** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
@@ -5348,7 +5357,7 @@ class Workbook {
5348
5357
  }
5349
5358
  }
5350
5359
  const _exports = Object.freeze({ Workbook: Workbook });
5351
- _modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
5360
+ _modules.set("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681", _exports);
5352
5361
  return _exports;
5353
5362
  })();
5354
5363
 
@@ -5405,7 +5414,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
5405
5414
  return _exports;
5406
5415
  })();
5407
5416
 
5408
- const _m51 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
5417
+ const _m51 = _modules.get("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308") ?? (() => {
5409
5418
  const { withDestination } = _m3;
5410
5419
 
5411
5420
  const { copyColumns } = _m11;
@@ -5460,11 +5469,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5460
5469
  });
5461
5470
  }
5462
5471
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5463
- _modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
5472
+ _modules.set("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308", _exports);
5464
5473
  return _exports;
5465
5474
  })();
5466
5475
 
5467
- const _m54 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
5476
+ const _m54 = _modules.get("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f") ?? (() => {
5468
5477
  const { assertGroupedReportSource } = _m8;
5469
5478
 
5470
5479
  const { captureFields } = _m10;
@@ -5553,11 +5562,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5553
5562
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5554
5563
  }
5555
5564
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5556
- _modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
5565
+ _modules.set("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f", _exports);
5557
5566
  return _exports;
5558
5567
  })();
5559
5568
 
5560
- const _m53 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
5569
+ const _m53 = _modules.get("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e") ?? (() => {
5561
5570
  const { groupedReportOperation } = _m8;
5562
5571
 
5563
5572
  const { checkAbort, withAbort } = _m4;
@@ -5730,14 +5739,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5730
5739
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5731
5740
  }
5732
5741
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5733
- _modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
5742
+ _modules.set("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e", _exports);
5734
5743
  return _exports;
5735
5744
  })();
5736
5745
 
5737
- const _m23 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
5746
+ const _m23 = _modules.get("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195") ?? (() => {
5738
5747
 
5739
5748
  const _exports = Object.freeze({ Workbook: _m24.Workbook, writeXlsx: _m51.writeXlsx, writeXlsxTo: _m51.writeXlsxTo, writeGroupedXlsx: _m53.writeGroupedXlsx, writeGroupedXlsxTo: _m53.writeGroupedXlsxTo, addGroupedXlsx: _m53.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m37.Worksheet, Cell: _m35.Cell, FormulaCell: _m36.FormulaCell, StyleRegistry: _m32.StyleRegistry, NumberFormats: _m32.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
5740
- _modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
5749
+ _modules.set("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195", _exports);
5741
5750
  return _exports;
5742
5751
  })();
5743
5752
 
@@ -5763,7 +5772,7 @@ _modules.set("2f5c0823847e9209017d01b2a753f36056df2a9988fae1f3a1bd5fd186545220",
5763
5772
  return _exports;
5764
5773
  })();
5765
5774
 
5766
- const _m55 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
5775
+ const _m55 = _modules.get("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4") ?? (() => {
5767
5776
  const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
5768
5777
 
5769
5778
  const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
@@ -5788,29 +5797,32 @@ const { captureCsvOptions } = _m16;
5788
5797
 
5789
5798
 
5790
5799
 
5791
- function csvField(value, delimiter, protect, quote, booleanText, nullValue) {
5792
- if (value == null && nullValue !== undefined)
5793
- value = nullValue;
5800
+ function csvField(value, delimiter, protect, quote, booleanText) {
5801
+ const kind = typeof value;
5794
5802
  let text;
5795
5803
  if (value == null)
5796
5804
  text = "";
5805
+ else if (kind === "string")
5806
+ text = value;
5807
+ else if (kind === "number") {
5808
+ text = Number.isFinite(value) ? String(value) : "";
5809
+ // Numeric text has no CSV delimiter, quote or line break to escape.
5810
+ return quote === "all" ? '"' + text + '"' : text;
5811
+ }
5812
+ else if (kind === "boolean")
5813
+ text = booleanText[value ? "true" : "false"];
5797
5814
  else if (isDate(value))
5798
5815
  text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
5799
- else if (typeof value === "boolean")
5800
- text = booleanText[value ? "true" : "false"];
5801
- else if (typeof value === "number")
5802
- text = Number.isFinite(value) ? String(value) : "";
5803
- else if (typeof value === "string")
5804
- text = value;
5805
5816
  else {
5806
5817
  if (typeof value.then === "function")
5807
5818
  void Promise.resolve(value).catch(() => { });
5808
5819
  throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
5809
5820
  }
5810
- if (protect && (typeof value === "string" || typeof value === "boolean") && /^ *[=+\-@\t\r\n]/.test(text))
5821
+ // Only ASCII spaces, controls and markers through @ can begin the protected prefix.
5822
+ if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
5811
5823
  text = "'" + text;
5812
- return quote === "all" || (quote === "strings" && typeof value === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
5813
- ? '"' + text.replace(/"/g, '""') + '"' : text;
5824
+ return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
5825
+ ? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
5814
5826
  }
5815
5827
  async function writeCsvTo(rows, destination, configuration) {
5816
5828
  const options = captureCsvOptions(configuration);
@@ -5862,7 +5874,7 @@ async function write(rows, sink, options) {
5862
5874
  value = options.nullValue;
5863
5875
  budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
5864
5876
  checkAbort(signal);
5865
- text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText, options.nullValue);
5877
+ text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
5866
5878
  if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
5867
5879
  if (buffer.append(text))
5868
5880
  return buffer.flush().then(() => record(values, header, i + 1, snapshot));
@@ -5910,7 +5922,7 @@ async function writeCsv(rows, configuration) {
5910
5922
  }
5911
5923
  }
5912
5924
  const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
5913
- _modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
5925
+ _modules.set("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4", _exports);
5914
5926
  return _exports;
5915
5927
  })();
5916
5928
 
@@ -7235,7 +7247,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
7235
7247
  return _exports;
7236
7248
  })();
7237
7249
 
7238
- const _m62 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
7250
+ const _m62 = _modules.get("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3") ?? (() => {
7239
7251
  const { NotSupportedError, OfficeIMOError } = _m2;
7240
7252
 
7241
7253
  const { fontProgram } = _m63;
@@ -7246,7 +7258,8 @@ const { pdfNumber, unicodeHex } = _m60;
7246
7258
 
7247
7259
  const { checkAbort, pause, taskYieldDue } = _m4;
7248
7260
 
7249
- const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7261
+ const hexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
7262
+ function cidHex(cid) { return hexBytes[cid >>> 8] + hexBytes[cid & 255]; }
7250
7263
  class PdfFontResource {
7251
7264
  index;
7252
7265
  bold;
@@ -7277,12 +7290,16 @@ class PdfFontResource {
7277
7290
  width(scalar) {
7278
7291
  if (this.shared)
7279
7292
  return this.shared.width(scalar);
7280
- const existing = this.mappings.get(scalar);
7281
- if (existing)
7282
- return existing.width;
7283
- const standard = this.standardWidths.get(scalar);
7284
- if (standard !== undefined)
7285
- return standard;
7293
+ if (this.program) {
7294
+ const existing = this.mappings.get(scalar);
7295
+ if (existing)
7296
+ return existing.width;
7297
+ }
7298
+ else {
7299
+ const standard = this.standardWidths.get(scalar);
7300
+ if (standard !== undefined)
7301
+ return standard;
7302
+ }
7286
7303
  const resolved = resolveScalar(scalar, this.program, this.bold);
7287
7304
  if (!resolved.supported) {
7288
7305
  if (resolved.code === "unpaired-surrogate")
@@ -7295,7 +7312,8 @@ class PdfFontResource {
7295
7312
  }
7296
7313
  if (this.mappings.size >= 65535)
7297
7314
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct Unicode scalars.");
7298
- const mapping = { cid: this.mappings.size + 1, glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7315
+ const cid = this.mappings.size + 1;
7316
+ const mapping = { cid, hex: cidHex(cid), glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
7299
7317
  this.mappings.set(scalar, mapping);
7300
7318
  return mapping.width;
7301
7319
  }
@@ -7308,8 +7326,20 @@ class PdfFontResource {
7308
7326
  let hex = "";
7309
7327
  for (const char of text) {
7310
7328
  const cp = char.codePointAt(0);
7311
- this.width(cp);
7312
- hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
7329
+ if (this.program) {
7330
+ let mapping = this.mappings.get(cp);
7331
+ // Layout normally registered the scalar already; validate only a newly painted scalar.
7332
+ if (!mapping) {
7333
+ this.width(cp);
7334
+ mapping = this.mappings.get(cp);
7335
+ }
7336
+ hex += mapping.hex;
7337
+ }
7338
+ else {
7339
+ if (!this.standardWidths.has(cp))
7340
+ this.width(cp);
7341
+ hex += hexBytes[standardCode(cp)];
7342
+ }
7313
7343
  }
7314
7344
  return "<" + hex + ">";
7315
7345
  }
@@ -7324,10 +7354,11 @@ class PdfFontResource {
7324
7354
  if (!mapping) {
7325
7355
  if (this.mappings.size >= 65535)
7326
7356
  throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct CID mappings.");
7327
- mapping = { cid: this.mappings.size + 1, glyph, width: this.program.widths[glyph], text };
7357
+ const cid = this.mappings.size + 1;
7358
+ mapping = { cid, hex: cidHex(cid), glyph, width: this.program.widths[glyph], text };
7328
7359
  this.mappings.set(key, mapping);
7329
7360
  }
7330
- return "<" + mapping.cid.toString(16).padStart(4, "0") + ">";
7361
+ return "<" + mapping.hex + ">";
7331
7362
  }
7332
7363
  async write(objects, compression) {
7333
7364
  checkAbort(this.signal);
@@ -7376,7 +7407,7 @@ class PdfFontResource {
7376
7407
  const batch = mapped.slice(i, i + 100);
7377
7408
  cmap += batch.length + " beginbfchar\n";
7378
7409
  for (const [, m] of batch)
7379
- cmap += "<" + m.cid.toString(16).padStart(4, "0") + "> <" + unicodeHex(m.text) + ">\n";
7410
+ cmap += "<" + m.hex + "> <" + unicodeHex(m.text) + ">\n";
7380
7411
  cmap += "endbfchar\n";
7381
7412
  if (taskYieldDue())
7382
7413
  await pause();
@@ -7427,7 +7458,7 @@ class PdfFontResources {
7427
7458
  if (!found)
7428
7459
  this.explicitSelections.set(explicit, selections);
7429
7460
  }
7430
- const key = String(bold) + String(italic), existing = selections.get(key);
7461
+ const key = (bold ? 2 : 0) | (italic ? 1 : 0), existing = selections.get(key);
7431
7462
  if (existing)
7432
7463
  return existing;
7433
7464
  const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } : selectFont(this.fonts, bold, italic);
@@ -7444,7 +7475,7 @@ class PdfFontResources {
7444
7475
  dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
7445
7476
  }
7446
7477
  const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
7447
- _modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
7478
+ _modules.set("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3", _exports);
7448
7479
  return _exports;
7449
7480
  })();
7450
7481
 
@@ -7969,7 +8000,7 @@ _modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47",
7969
8000
  return _exports;
7970
8001
  })();
7971
8002
 
7972
- const _m73 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
8003
+ const _m73 = _modules.get("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea") ?? (() => {
7973
8004
  const { OfficeIMOError } = _m2;
7974
8005
 
7975
8006
  const { wrapPdfText } = _m71;
@@ -8017,6 +8048,14 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
8017
8048
  for (const row of rows) {
8018
8049
  const cells = [];
8019
8050
  for (const cell of row.cells) {
8051
+ // Ordinary data and leaf headings keep their captured width and lines in every band.
8052
+ // Look up their physical position without allocating another per-row column index.
8053
+ if (cell.span === 1) {
8054
+ const first = band.columns.indexOf(cell.first);
8055
+ if (first >= 0)
8056
+ cells.push({ ...cell, source: cell.source ?? cell, first });
8057
+ continue;
8058
+ }
8020
8059
  for (let first = 0; first < band.columns.length;) {
8021
8060
  const source = band.columns[first];
8022
8061
  if (source < cell.first || source >= cell.first + cell.span) {
@@ -8027,7 +8066,7 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
8027
8066
  while (end < band.columns.length && band.columns[end] === band.columns[end - 1] + 1 && band.columns[end] < cell.first + cell.span)
8028
8067
  end++;
8029
8068
  const width = band.columns.slice(first, end).reduce((sum, index) => sum + widths[index], 0);
8030
- const lines = cell.span === 1 ? cell.lines : await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
8069
+ const lines = await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
8031
8070
  cells.push({ ...cell, source: cell.source ?? cell, first, span: end - first, width, lines,
8032
8071
  lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), cell.font.lineHeight(settings.fontSize)) });
8033
8072
  first = end;
@@ -8056,11 +8095,11 @@ function alignBandBlocks(bands, settings) {
8056
8095
  cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
8057
8096
  }
8058
8097
  const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
8059
- _modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
8098
+ _modules.set("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea", _exports);
8060
8099
  return _exports;
8061
8100
  })();
8062
8101
 
8063
- const _m69 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
8102
+ const _m69 = _modules.get("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874") ?? (() => {
8064
8103
  const { ExportCell } = _m5;
8065
8104
 
8066
8105
  const { copyExportLink } = _m7;
@@ -8180,8 +8219,12 @@ class PdfTableLayout {
8180
8219
  lines };
8181
8220
  }
8182
8221
  row(cells) {
8183
- const lines = Math.max(1, ...cells.map(c => c.lines.length));
8184
- const lineHeight = Math.max(this.lineHeight, ...cells.map(c => c.lineHeight));
8222
+ let lines = 1, lineHeight = this.lineHeight;
8223
+ for (let index = 0; index < cells.length; index++) {
8224
+ const cell = cells[index];
8225
+ lines = Math.max(lines, cell.lines.length);
8226
+ lineHeight = Math.max(lineHeight, cell.lineHeight);
8227
+ }
8185
8228
  return { cells, lines, lineHeight, height: lines * lineHeight + this.settings.padding * 2 };
8186
8229
  }
8187
8230
  async headers() {
@@ -8287,11 +8330,11 @@ class PdfTableLayout {
8287
8330
  }
8288
8331
  }
8289
8332
  const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
8290
- _modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
8333
+ _modules.set("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874", _exports);
8291
8334
  return _exports;
8292
8335
  })();
8293
8336
 
8294
- const _m75 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
8337
+ const _m75 = _modules.get("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72") ?? (() => {
8295
8338
  const { OfficeIMOError } = _m2;
8296
8339
 
8297
8340
  const { checkAbort } = _m4;
@@ -8335,7 +8378,7 @@ class PdfTableBandFlow {
8335
8378
  await this.flush();
8336
8379
  }
8337
8380
  async row(row, allowFirstFragment = false) {
8338
- const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
8381
+ const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = minimumLines * row.lineHeight + padding * 2;
8339
8382
  if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
8340
8383
  throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
8341
8384
  // Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
@@ -8369,9 +8412,14 @@ class PdfTableBandFlow {
8369
8412
  let remaining = false;
8370
8413
  const cells = rows[0].cells.map(cell => {
8371
8414
  const source = this.layout.bands[index].columns[cell.first];
8372
- const repeated = this.layout.repeatedColumn(source), visible = repeated ? cell.lines : cell.lines.slice(first, first + lines);
8415
+ const repeated = this.layout.repeatedColumn(source), reusable = cell.span === 1 && (cell.source?.span ?? 1) === 1 && (cell.rowSpan ?? 1) === 1 &&
8416
+ cell.height === undefined && first === 0 && (repeated || lines >= cell.lines.length);
8417
+ const visible = repeated || reusable ? cell.lines : cell.lines.slice(first, first + lines);
8373
8418
  if (!repeated && (visible.length > 0 || cell.link !== undefined))
8374
8419
  remaining = true;
8420
+ // A complete first fragment already owns these lines and their maximum font metrics.
8421
+ if (reusable)
8422
+ return cell;
8375
8423
  const { height: _height, ...plain } = cell;
8376
8424
  return { ...plain, lines: visible,
8377
8425
  lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
@@ -8424,11 +8472,11 @@ class PdfTableBandFlow {
8424
8472
  }
8425
8473
  }
8426
8474
  const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
8427
- _modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
8475
+ _modules.set("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72", _exports);
8428
8476
  return _exports;
8429
8477
  })();
8430
8478
 
8431
- const _m76 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
8479
+ const _m76 = _modules.get("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf") ?? (() => {
8432
8480
  /** @internal Source-cell identities survive page fragments and horizontal band projections.
8433
8481
  * Only column headers and still-owned row objects remain reachable from this table owner. */
8434
8482
  class PdfTableStructure {
@@ -8480,30 +8528,31 @@ class PdfTableStructure {
8480
8528
  return row.cells.map(cell => this.cells.get(cell));
8481
8529
  const rowId = this.structure.element("TR", parent);
8482
8530
  this.rows.set(row, rowId);
8483
- const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
8484
8531
  // Allocate in source order, then resolve every row header before associating even earlier data cells.
8485
8532
  // Generated summary labels override detail roles so numeric subtotal cells never become row headers.
8486
8533
  const ids = row.cells.map((cell, index) => {
8487
- const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
8534
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8535
+ const id = this.structure.element(header ? "TH" : "TD", rowId);
8488
8536
  this.cells.set(cell, id);
8489
8537
  return id;
8490
8538
  });
8491
- const rowHeaders = [];
8539
+ let rowHeaders;
8492
8540
  for (let index = 0; index < ids.length; index++)
8493
- if (headers[index])
8494
- rowHeaders.push(await this.structure.identifier(ids[index]));
8541
+ if (rowHeaderIndex === undefined ? row.cells[index].rowHeader === true : index === rowHeaderIndex)
8542
+ (rowHeaders ??= []).push(await this.structure.identifier(ids[index]));
8495
8543
  for (let index = 0; index < row.cells.length; index++) {
8496
8544
  const cell = row.cells[index];
8497
- if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8545
+ if (!rowHeaders && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
8498
8546
  const attributes = this.ordinaryAttributes[cell.first] ??=
8499
8547
  await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
8500
8548
  this.structure.setAttributes(ids[index], attributes);
8501
8549
  continue;
8502
8550
  }
8503
8551
  const associations = this.associations(cell);
8504
- if (!headers[index])
8552
+ const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
8553
+ if (!header && rowHeaders)
8505
8554
  associations.push(...rowHeaders);
8506
- this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
8555
+ this.structure.setAttributes(ids[index], this.attributes(cell, associations, header ? "Row" : undefined));
8507
8556
  }
8508
8557
  return ids;
8509
8558
  }
@@ -8538,7 +8587,7 @@ class PdfTableStructure {
8538
8587
  }
8539
8588
  }
8540
8589
  const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
8541
- _modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
8590
+ _modules.set("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf", _exports);
8542
8591
  return _exports;
8543
8592
  })();
8544
8593
 
@@ -8656,7 +8705,7 @@ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052",
8656
8705
  return _exports;
8657
8706
  })();
8658
8707
 
8659
- const _m74 = _modules.get("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410") ?? (() => {
8708
+ const _m74 = _modules.get("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9") ?? (() => {
8660
8709
  const { OfficeIMOError } = _m2;
8661
8710
 
8662
8711
  const { checkAbort } = _m4;
@@ -8691,7 +8740,8 @@ class PdfPages {
8691
8740
  outlines;
8692
8741
  references = [];
8693
8742
  current = 0;
8694
- commands = [];
8743
+ commands = "";
8744
+ commandParts = [];
8695
8745
  commandBytes = 0;
8696
8746
  annotations = [];
8697
8747
  hyperlinks = 0;
@@ -8709,6 +8759,12 @@ class PdfPages {
8709
8759
  pendingBookmarks = [];
8710
8760
  pageNumberWidth = 0;
8711
8761
  colors = new Map();
8762
+ textFont;
8763
+ textSize = 0;
8764
+ textColor = "";
8765
+ textPrefix = "";
8766
+ rectangleLefts;
8767
+ rectangleColumns = [];
8712
8768
  externalObjects = new Map();
8713
8769
  bandFlow;
8714
8770
  bandCellBudget = false;
@@ -8775,7 +8831,7 @@ class PdfPages {
8775
8831
  }
8776
8832
  add(command) {
8777
8833
  this.retainPageBytes(command.length);
8778
- this.commands.push(command);
8834
+ this.commands += command;
8779
8835
  }
8780
8836
  retainPageBytes(length) {
8781
8837
  this.commandBytes += length;
@@ -8795,9 +8851,17 @@ class PdfPages {
8795
8851
  return this.structure ? "/Artifact << /Type /" + type + " >> BDC\n" + command + "EMC\n" : command;
8796
8852
  }
8797
8853
  text(text, font, size, x, baseline, foreground = "111827", element) {
8798
- const n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8799
- const command = "q " + this.rgb(foreground) + " rg " + this.rgb(foreground) + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8800
- (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";
8854
+ const n = pdfNumber;
8855
+ if (font !== this.textFont || size !== this.textSize || foreground !== this.textColor) {
8856
+ const shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(foreground);
8857
+ // Keep one prefix, independent of report size. Resource identity includes synthetic styling.
8858
+ this.textPrefix = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8859
+ (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 ";
8860
+ this.textFont = font;
8861
+ this.textSize = size;
8862
+ this.textColor = foreground;
8863
+ }
8864
+ const command = this.textPrefix + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
8801
8865
  this.add(this.structure && element !== undefined ? this.structure.mark(element) + command + "EMC\n" : this.artifact(command, "Pagination"));
8802
8866
  }
8803
8867
  link(link, x, bottom, width, height, element) {
@@ -8827,8 +8891,8 @@ class PdfPages {
8827
8891
  for (const segment of line.segments) {
8828
8892
  const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
8829
8893
  if (segment.glyphs) {
8830
- const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
8831
- let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8894
+ const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(segment.color ?? "111827");
8895
+ let cursor = x, command = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
8832
8896
  (font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ");
8833
8897
  for (const glyph of segment.glyphs) {
8834
8898
  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";
@@ -8876,7 +8940,8 @@ class PdfPages {
8876
8940
  this.current = this.objects.reserve();
8877
8941
  this.references.push(this.current);
8878
8942
  }
8879
- this.commands = [];
8943
+ this.commands = "";
8944
+ this.commandParts = [];
8880
8945
  this.annotations = [];
8881
8946
  this.commandBytes = 0;
8882
8947
  this.bodyAdded = false;
@@ -8941,7 +9006,7 @@ class PdfPages {
8941
9006
  // Charge physical repeats without recapturing callbacks or making them semantic duplicates.
8942
9007
  for (const cell of header.cells)
8943
9008
  if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
8944
- this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
9009
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
8945
9010
  const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
8946
9011
  const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
8947
9012
  this.draw(header, 0, header.lines, elements, repeated);
@@ -8959,14 +9024,32 @@ class PdfPages {
8959
9024
  if (!this.layout)
8960
9025
  throw new Error("A table layout is required before drawing rows.");
8961
9026
  this.bodyAdded = true;
8962
- const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
9027
+ const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2, lefts = this.layout.lefts;
9028
+ // One geometry token per active physical column; table/band changes release the old tokens.
9029
+ if (this.rectangleLefts !== lefts) {
9030
+ this.rectangleLefts = lefts;
9031
+ this.rectangleColumns = [];
9032
+ }
9033
+ let rectangleHeight, rectangleBottom = "", rectangleHeightText = "";
8963
9034
  for (const [index, cell] of row.cells.entries()) {
8964
9035
  if (this.bandCellBudget)
8965
- this.settings.budget.cell((cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
8966
- const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
9036
+ this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
9037
+ (cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
9038
+ const x = lefts[cell.first], cellHeight = cell.height ?? height;
9039
+ if (cellHeight !== rectangleHeight) {
9040
+ rectangleBottom = n(this.y - cellHeight);
9041
+ rectangleHeightText = n(cellHeight);
9042
+ rectangleHeight = cellHeight;
9043
+ }
9044
+ let horizontal = this.rectangleColumns[cell.first];
9045
+ if (!horizontal || horizontal.x !== x || horizontal.width !== cell.width) {
9046
+ horizontal = { x, width: cell.width, left: n(x), widthText: n(cell.width) };
9047
+ this.rectangleColumns[cell.first] = horizontal;
9048
+ }
9049
+ const rectangle = horizontal.left + " " + rectangleBottom + " " + horizontal.widthText + " " + rectangleHeightText;
8967
9050
  if (cell.style.background)
8968
- 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"));
8969
- 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"));
9051
+ this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + rectangle + " re f Q\n"));
9052
+ this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + rectangle + " re S Q\n"));
8970
9053
  const element = elements?.[index], artifact = cell.semanticArtifact || repeated[index], owner = cell.link && this.structure && element !== undefined ? this.structure.link(element, cell.link) : element;
8971
9054
  for (let line = firstLine; line < Math.min(cell.lines.length, cell.height ? cell.lines.length : firstLine + lineCount); line++) {
8972
9055
  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;
@@ -8976,6 +9059,7 @@ class PdfPages {
8976
9059
  this.link(cell.link, x, this.y - cellHeight, cell.width, cellHeight, owner);
8977
9060
  }
8978
9061
  this.y -= row.structured ? row.height : height;
9062
+ this.sealCommands();
8979
9063
  }
8980
9064
  async block(rows) {
8981
9065
  if (this.bandFlow)
@@ -9301,9 +9385,22 @@ class PdfPages {
9301
9385
  marker: { line: item.marker, gap: item.markerGap, ...(label === undefined ? {} : { owner: label }) } });
9302
9386
  await this.structure?.complete(li);
9303
9387
  }
9388
+ sealCommands() {
9389
+ if (this.commands) {
9390
+ this.commandParts.push(this.commands);
9391
+ this.commands = "";
9392
+ }
9393
+ }
9394
+ takeCommands() {
9395
+ this.sealCommands();
9396
+ const content = this.commandParts.join("");
9397
+ // Encoding and awaited delivery own the page value; the next page starts independently.
9398
+ this.commandParts = [];
9399
+ return content;
9400
+ }
9304
9401
  async finishPage() {
9305
9402
  const contents = this.objects.reserve(), { page, options } = this.settings;
9306
- await this.objects.stream(contents, this.commands.join(""), "", options.compression !== false);
9403
+ await this.objects.stream(contents, this.takeCommands(), "", options.compression !== false);
9307
9404
  const annotations = [];
9308
9405
  for (const annotation of this.annotations) {
9309
9406
  annotations.push(annotation.id);
@@ -9315,7 +9412,6 @@ class PdfPages {
9315
9412
  (annotations.length ? " /Annots [" + annotations.map(id => id + " 0 R").join(" ") + "]" : "") + " >>");
9316
9413
  if (this.structure)
9317
9414
  await this.structure.finishPage();
9318
- this.commands = [];
9319
9415
  this.annotations = [];
9320
9416
  this.commandBytes = 0;
9321
9417
  this.current = 0;
@@ -9347,7 +9443,7 @@ class PdfPages {
9347
9443
  }
9348
9444
  }
9349
9445
  const _exports = Object.freeze({ PdfPages: PdfPages });
9350
- _modules.set("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410", _exports);
9446
+ _modules.set("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9", _exports);
9351
9447
  return _exports;
9352
9448
  })();
9353
9449
 
@@ -9790,7 +9886,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
9790
9886
  return _exports;
9791
9887
  })();
9792
9888
 
9793
- const _m59 = _modules.get("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9") ?? (() => {
9889
+ const _m59 = _modules.get("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273") ?? (() => {
9794
9890
  const { PdfObjects, unicodeHex } = _m60;
9795
9891
 
9796
9892
  const { PdfFontResources } = _m62;
@@ -9853,11 +9949,11 @@ class PdfWriteSession {
9853
9949
  }
9854
9950
  }
9855
9951
  const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
9856
- _modules.set("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9", _exports);
9952
+ _modules.set("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273", _exports);
9857
9953
  return _exports;
9858
9954
  })();
9859
9955
 
9860
- const _m58 = _modules.get("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2") ?? (() => {
9956
+ const _m58 = _modules.get("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b") ?? (() => {
9861
9957
  const { BlobByteSink, withDestination } = _m3;
9862
9958
 
9863
9959
  const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
@@ -9922,7 +10018,7 @@ async function writePdfTo(rows, destination, configuration) {
9922
10018
  });
9923
10019
  }
9924
10020
  const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
9925
- _modules.set("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2", _exports);
10021
+ _modules.set("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b", _exports);
9926
10022
  return _exports;
9927
10023
  })();
9928
10024
 
@@ -10854,7 +10950,7 @@ _modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343",
10854
10950
  return _exports;
10855
10951
  })();
10856
10952
 
10857
- const _m91 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
10953
+ const _m91 = _modules.get("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0") ?? (() => {
10858
10954
  const { assertGroupedReportSource, groupedReportOperation } = _m8;
10859
10955
 
10860
10956
  const { consumeRows } = _m4;
@@ -11108,11 +11204,11 @@ async function renderGroupedPdfTable(block, context) {
11108
11204
  }
11109
11205
  }
11110
11206
  const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
11111
- _modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
11207
+ _modules.set("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0", _exports);
11112
11208
  return _exports;
11113
11209
  })();
11114
11210
 
11115
- const _m84 = _modules.get("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223") ?? (() => {
11211
+ const _m84 = _modules.get("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904") ?? (() => {
11116
11212
  const { BlobByteSink, withDestination } = _m3;
11117
11213
 
11118
11214
  const { OfficeIMOError } = _m2;
@@ -11402,11 +11498,11 @@ function captureTableOptions(options) {
11402
11498
  return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
11403
11499
  }
11404
11500
  const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
11405
- _modules.set("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223", _exports);
11501
+ _modules.set("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904", _exports);
11406
11502
  return _exports;
11407
11503
  })();
11408
11504
 
11409
- const _m83 = _modules.get("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557") ?? (() => {
11505
+ const _m83 = _modules.get("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba") ?? (() => {
11410
11506
  const { assertGroupedReportSource } = _m8;
11411
11507
 
11412
11508
  const { BlobByteSink } = _m3;
@@ -11452,7 +11548,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
11452
11548
  return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
11453
11549
  }
11454
11550
  const _exports = Object.freeze({ pdfGroupedTable: _m92.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
11455
- _modules.set("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557", _exports);
11551
+ _modules.set("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba", _exports);
11456
11552
  return _exports;
11457
11553
  })();
11458
11554
 
@@ -11496,10 +11592,10 @@ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86",
11496
11592
  return _exports;
11497
11593
  })();
11498
11594
 
11499
- const _m57 = _modules.get("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c") ?? (() => {
11595
+ const _m57 = _modules.get("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe") ?? (() => {
11500
11596
 
11501
11597
  const _exports = Object.freeze({ writePdf: _m58.writePdf, writePdfTo: _m58.writePdfTo, writeGroupedPdf: _m83.writeGroupedPdf, writeGroupedPdfTo: _m83.writeGroupedPdfTo, pdfGroupedTable: _m83.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m84.writePdfDocument, writePdfDocumentTo: _m84.writePdfDocumentTo, pdfTable: _m84.pdfTable, PdfFont: _m63.PdfFont, preflightPdfText: _m93.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
11502
- _modules.set("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c", _exports);
11598
+ _modules.set("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe", _exports);
11503
11599
  return _exports;
11504
11600
  })();
11505
11601
 
@@ -11543,7 +11639,76 @@ _modules.set("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f",
11543
11639
  return _exports;
11544
11640
  })();
11545
11641
 
11546
- const _m94 = _modules.get("91dbdf35d8f192b3c0ea92dfab6b9812872fbe3c8d85a5d2afe389bd61262ba2") ?? (() => {
11642
+ const _m96 = _modules.get("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8") ?? (() => {
11643
+ /** One policy for capture diagnostics and unsupported adapter mappings; callbacks stay synchronous. */
11644
+ function canopyDiagnostics(format, options) {
11645
+ const policy = options.unsupportedPresentation ?? (format === "csv" ? "text" : "reject"), notify = options.onDiagnostic;
11646
+ if (policy !== "reject" && policy !== "text")
11647
+ throw new TypeError("unsupportedPresentation must be reject or text.");
11648
+ if (notify !== undefined && typeof notify !== "function")
11649
+ throw new TypeError("onDiagnostic must be a synchronous function.");
11650
+ return diagnostic => {
11651
+ if (policy === "reject")
11652
+ throw new TypeError("Unsupported Canopy presentation: " + diagnostic.code + (diagnostic.columnId ? " (" + diagnostic.columnId + ")" : ""));
11653
+ const result = notify?.(Object.freeze(diagnostic));
11654
+ if (result && typeof result.then === "function") {
11655
+ void Promise.resolve(result).catch(() => { });
11656
+ throw new TypeError("onDiagnostic must be synchronous.");
11657
+ }
11658
+ };
11659
+ }
11660
+ const _exports = Object.freeze({ canopyDiagnostics: canopyDiagnostics });
11661
+ _modules.set("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8", _exports);
11662
+ return _exports;
11663
+ })();
11664
+
11665
+ const _m97 = _modules.get("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d") ?? (() => {
11666
+ /** Calibri 11, 96-DPI CSS pixels, seven-pixel maximum digit and five-pixel cell padding.
11667
+ * Quantize to native 1/256-character units; this is a reproducible profile, not pixel-identical rendering. */
11668
+ function canopyXlsxWidth(pixels) {
11669
+ const width = Math.floor((pixels < 12 ? pixels / 12 : (pixels - 5) / 7) * 256) / 256;
11670
+ if (!Number.isFinite(width) || width <= 0 || width > 255)
11671
+ throw new RangeError("Captured width exceeds the Calibri-11 XLSX width profile.");
11672
+ return width;
11673
+ }
11674
+ /** Escape literal prefixes/suffixes; no browser formatter or CSS becomes workbook code. */
11675
+ function canopyNumberFormat(input, report, id) {
11676
+ if (!input || typeof input !== "object" || Array.isArray(input))
11677
+ throw new TypeError("Canopy numeric format must be an object.");
11678
+ if (Object.keys(input).some(key => !["minimumFractionDigits", "maximumFractionDigits", "prefix", "suffix"].includes(key))) {
11679
+ report({ code: "UNSUPPORTED_NUMBER_FORMAT", columnId: id });
11680
+ return undefined;
11681
+ }
11682
+ const { minimumFractionDigits: minimum = 0, maximumFractionDigits: maximum = 3, prefix = "", suffix = "" } = input;
11683
+ if (!Number.isInteger(minimum) || !Number.isInteger(maximum) || minimum < 0 || maximum < minimum || maximum > 10 ||
11684
+ typeof prefix !== "string" || typeof suffix !== "string" || prefix.length > 16 || suffix.length > 16)
11685
+ throw new TypeError("Canopy numeric fraction bounds must be ordered integers from zero through ten, with literal affixes of at most sixteen characters.");
11686
+ const literal = (value) => value ? '"' + value.replace(/"/g, '"\\""') + '"' : "";
11687
+ return literal(prefix) + "0" + (maximum ? "." + "0".repeat(minimum) + "#".repeat(maximum - minimum) : "") + literal(suffix);
11688
+ }
11689
+ /** Only a contiguous leading left pin can be represented by an Excel freeze pane. */
11690
+ function canopyPins(columns, report) {
11691
+ let leading = 0, ended = false;
11692
+ for (const column of columns) {
11693
+ const pin = column.pinned;
11694
+ if (pin !== undefined && pin !== null && pin !== "left" && pin !== "right")
11695
+ throw new TypeError("Invalid Canopy pin.");
11696
+ if (!ended && pin === "left")
11697
+ leading++;
11698
+ else {
11699
+ ended = true;
11700
+ if (pin === "left" || pin === "right")
11701
+ report({ code: "UNREPRESENTABLE_PIN:" + pin, columnId: column.id });
11702
+ }
11703
+ }
11704
+ return leading;
11705
+ }
11706
+ const _exports = Object.freeze({ canopyXlsxWidth: canopyXlsxWidth, canopyNumberFormat: canopyNumberFormat, canopyPins: canopyPins });
11707
+ _modules.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d", _exports);
11708
+ return _exports;
11709
+ })();
11710
+
11711
+ const _m94 = _modules.get("a92d57114c08988b60d7dc46d24aeea3096cb6c695c12a7ea26761010692ef43") ?? (() => {
11547
11712
  const { ExportCell, checkAbort, inputRows } = _m1;
11548
11713
 
11549
11714
  const { datetime } = _m95;
@@ -11554,37 +11719,33 @@ const { copyColumns } = _m11;
11554
11719
 
11555
11720
  const { copyCellPresentation } = _m5;
11556
11721
 
11722
+ const { canopyDiagnostics } = _m96;
11723
+
11724
+ const { canopyNumberFormat, canopyXlsxWidth } = _m97;
11725
+
11557
11726
  const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
11558
11727
  /** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
11559
11728
  function createCanopyExport(capture, format, options = {}) {
11729
+ return prepareCanopyExport(capture, format, options).source;
11730
+ }
11731
+ /** @internal Capture the input once before full-writer metadata mapping and asynchronous enumeration. */
11732
+ function prepareCanopyExport(capture, format, options = {}) {
11560
11733
  options = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "signal", "onDiagnostic"]);
11561
11734
  if (format !== "xlsx" && format !== "csv" && format !== "pdf")
11562
11735
  throw new TypeError("Canopy export format must be xlsx, csv or pdf.");
11563
11736
  if (!capture || typeof capture.rows !== "function" || !capture.request)
11564
11737
  throw new TypeError("A portable CanopyX capture with request and rows() is required.");
11565
- const { request } = capture, signal = options.signal, values = request.values;
11738
+ const request = captureFields(capture.request, ["columns", "recordCount", "values", "presentation", "timeZone", "revision", "scope", "total", "matched", "selection", "query", "generatedAt", "grouping", "formatRules"]);
11739
+ const signal = options.signal, values = request.values;
11566
11740
  if (!Array.isArray(request.columns) || !request.columns.length || (request.recordCount !== null && (!Number.isSafeInteger(request.recordCount) || request.recordCount < 0)) ||
11567
11741
  (values !== "raw" && values !== "display") || (request.timeZone !== "utc" && request.timeZone !== "local") || typeof request.revision !== "string")
11568
11742
  throw new TypeError("Invalid portable CanopyX capture metadata.");
11569
- const policy = options.unsupportedPresentation ?? (format === "csv" ? "text" : "reject"), dateMode = options.datetime ?? "preserve", notify = options.onDiagnostic;
11743
+ const dateMode = options.datetime ?? "preserve", report = canopyDiagnostics(format, options);
11570
11744
  const clock = options.xlsx?.dateMode ?? request.timeZone;
11571
11745
  if (clock !== "utc" && clock !== "local")
11572
11746
  throw new TypeError("XLSX dateMode must be utc or local.");
11573
- if (policy !== "reject" && policy !== "text")
11574
- throw new TypeError("unsupportedPresentation must be reject or text.");
11575
11747
  if (dateMode !== "preserve" && dateMode !== "typed" && dateMode !== "text")
11576
11748
  throw new TypeError("datetime must be preserve, typed or text.");
11577
- if (notify !== undefined && typeof notify !== "function")
11578
- throw new TypeError("onDiagnostic must be a synchronous function.");
11579
- const report = (diagnostic) => {
11580
- if (policy === "reject")
11581
- throw new TypeError("Unsupported Canopy presentation: " + diagnostic.code + (diagnostic.columnId ? " (" + diagnostic.columnId + ")" : ""));
11582
- const result = notify?.(Object.freeze(diagnostic));
11583
- if (result && typeof result.then === "function") {
11584
- void Promise.resolve(result).catch(() => { });
11585
- throw new TypeError("onDiagnostic must be synchronous.");
11586
- }
11587
- };
11588
11749
  const diagnostics = (items, rowId, columnId) => {
11589
11750
  if (items === undefined)
11590
11751
  return;
@@ -11593,9 +11754,7 @@ function createCanopyExport(capture, format, options = {}) {
11593
11754
  for (const code of items)
11594
11755
  report({ code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) });
11595
11756
  };
11596
- if (request.presentation === "text")
11597
- report({ code: "TEXT_ONLY_CAPTURE" });
11598
- else if (request.presentation !== "semantic")
11757
+ if (request.presentation !== "text" && request.presentation !== "semantic")
11599
11758
  throw new TypeError("Canopy captures must declare text or semantic presentation.");
11600
11759
  const tones = new Map(Object.entries(options.tones ?? {}).map(([name, style]) => {
11601
11760
  if (!style || typeof style !== "object" || Array.isArray(style))
@@ -11608,12 +11767,16 @@ function createCanopyExport(capture, format, options = {}) {
11608
11767
  if (typeof name !== "string")
11609
11768
  throw new TypeError("Canopy tones must be strings.");
11610
11769
  const style = tones.get(name);
11611
- if (!style)
11770
+ if (!style && name !== "neutral")
11612
11771
  report({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
11613
11772
  return style;
11614
11773
  };
11615
11774
  const ids = new Set();
11616
- const specs = request.columns.map(column => {
11775
+ const specs = request.columns.map(input => {
11776
+ const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
11777
+ const column = Object.freeze({ ...fields,
11778
+ ...(fields.width === undefined ? {} : { width: Object.freeze(captureFields(fields.width, ["unit", "preferred", "minimum", "maximum"])) }),
11779
+ ...(fields.format === undefined ? {} : { format: Object.freeze(captureFields(fields.format, ["minimumFractionDigits", "maximumFractionDigits", "prefix", "suffix"])) }) });
11617
11780
  if (!column || typeof column.id !== "string" || !column.id || ids.has(column.id) || typeof column.title !== "string" ||
11618
11781
  !["text", "number", "datetime"].includes(column.kind) ||
11619
11782
  (column.wrap !== undefined && typeof column.wrap !== "boolean") || (column.alignment !== undefined && !["left", "right"].includes(column.alignment)) ||
@@ -11629,14 +11792,19 @@ function createCanopyExport(capture, format, options = {}) {
11629
11792
  if (!columnFields.includes(key))
11630
11793
  throw new TypeError("Unsupported Canopy column option: " + key);
11631
11794
  const override = captureFields(selected, columnFields);
11795
+ const numericFormat = format === "xlsx" && values === "raw" && column.kind === "number" && column.format !== undefined && override.format === undefined
11796
+ ? canopyNumberFormat(column.format, report, column.id) : undefined;
11632
11797
  const [captured] = copyColumns([{ ...override, key: column.id, header: column.title,
11798
+ ...(format === "xlsx" && override.width === undefined && column.width !== undefined ? { width: canopyXlsxWidth(column.width.preferred) } : {}),
11799
+ ...(override.format === undefined && numericFormat !== undefined ? { format: numericFormat } : {}),
11800
+ ...(format === "xlsx" && values === "raw" && column.kind === "datetime" && override.format === undefined ? { format: "yyyy-mm-dd hh:mm:ss.000" } : {}),
11633
11801
  ...(values === "raw" && column.kind === "number" ? { type: "number" } : {}),
11634
11802
  ...(override.wrapText === undefined && column.wrap === undefined ? {} : { wrapText: override.wrapText ?? column.wrap }),
11635
11803
  ...(override.alignment === undefined && column.alignment === undefined ? {} : { alignment: override.alignment ?? column.alignment }) }]);
11636
- return Object.freeze({ id: column.id, kind: column.kind, column: Object.freeze(captured) });
11804
+ return Object.freeze({ id: column.id, kind: column.kind, input: column, column: Object.freeze(captured) });
11637
11805
  });
11638
11806
  const rowCount = request.recordCount;
11639
- return Object.freeze({ columns: Object.freeze(specs.map(spec => spec.column)), rowCount, async *rows() {
11807
+ const source = Object.freeze({ columns: Object.freeze(specs.map(spec => spec.column)), rowCount, async *rows() {
11640
11808
  checkAbort(signal);
11641
11809
  let count = 0;
11642
11810
  for await (const row of inputRows(capture.rows(signal ? { signal } : {}), signal)) {
@@ -11670,14 +11838,638 @@ function createCanopyExport(capture, format, options = {}) {
11670
11838
  if (rowCount !== null && count !== rowCount)
11671
11839
  throw new TypeError("Canopy capture did not produce its declared recordCount.");
11672
11840
  } });
11841
+ return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones });
11842
+ }
11843
+ const _exports = Object.freeze({ createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
11844
+ _modules.set("a92d57114c08988b60d7dc46d24aeea3096cb6c695c12a7ea26761010692ef43", _exports);
11845
+ return _exports;
11846
+ })();
11847
+
11848
+ const _m99 = _modules.get("237239bcf5fa7675f75c53d2f367d843e089051bfd9f586770330a2c504ce1f7") ?? (() => {
11849
+ const { columnName, excelDate } = _m35;
11850
+
11851
+ const { captureFields } = _m10;
11852
+
11853
+ const { datetime } = _m95;
11854
+
11855
+ /** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
11856
+ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
11857
+ let nodes = 0;
11858
+ const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
11859
+ const numeric = (value) => {
11860
+ const number = typeof value === "boolean" ? Number(value) : typeof value === "string" ? Number(value) : value;
11861
+ // Use platform decimal conversion; separator/culture profiles need a diagnostic, not a second parser.
11862
+ if (typeof value === "string") {
11863
+ const text = value.trim().toLowerCase();
11864
+ if (Number.parseFloat(value) !== number || ["0x", "0b", "0o"].some(prefix => text.startsWith(prefix)))
11865
+ return unsupported("UNSUPPORTED_NUMERIC_RULE_LITERAL");
11866
+ }
11867
+ if (!Number.isFinite(number) || Math.abs(number) > Number.MAX_SAFE_INTEGER)
11868
+ throw new TypeError("Canopy rule comparison values must be finite safe-range numbers.");
11869
+ return number;
11870
+ };
11871
+ const date = (value) => {
11872
+ if (options.datetime !== "typed" || (options.xlsx?.dateMode ?? request.timeZone) !== "utc")
11873
+ return unsupported("DATETIME_RULE_REQUIRES_TYPED_UTC");
11874
+ if (typeof value === "boolean")
11875
+ return unsupported("UNSUPPORTED_DATETIME_RULE_LITERAL");
11876
+ if (typeof value === "number" && !Number.isSafeInteger(value))
11877
+ return unsupported("UNSUPPORTED_DATETIME_RULE_LITERAL");
11878
+ try {
11879
+ const literal = typeof value === "number" ? new Date(value).toISOString() : value;
11880
+ const captured = datetime(literal, "typed", "utc");
11881
+ if (!(captured instanceof Date))
11882
+ return unsupported("UNSUPPORTED_DATETIME_RULE_LITERAL");
11883
+ const serial = excelDate(captured, "utc");
11884
+ if (serial === null)
11885
+ return unsupported("UNSUPPORTED_DATETIME_RULE_LITERAL");
11886
+ return serial;
11887
+ }
11888
+ catch (error) {
11889
+ if (!(error instanceof TypeError) && !(error instanceof RangeError))
11890
+ throw error;
11891
+ return unsupported("UNSUPPORTED_DATETIME_RULE_LITERAL");
11892
+ }
11893
+ };
11894
+ const leaf = (input) => {
11895
+ if (++nodes > 64)
11896
+ return unsupported("RULE_PREDICATE_LIMIT");
11897
+ const filter = captureFields(input, ["column", "operator", "values"]), operation = operations[filter.operator];
11898
+ if (Object.keys(filter).some(key => !["column", "operator", "values"].includes(key)))
11899
+ return unsupported("UNSUPPORTED_RULE_FILTER_OPTIONS");
11900
+ const index = request.columns.findIndex(column => column.id === filter.column);
11901
+ if (index < 0)
11902
+ return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
11903
+ const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
11904
+ const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
11905
+ if (column.kind === "number")
11906
+ cellTypes.set(index, "number");
11907
+ if (column.kind === "datetime") {
11908
+ if (options.datetime !== "typed" || (options.xlsx?.dateMode ?? request.timeZone) !== "utc")
11909
+ return unsupported("DATETIME_RULE_REQUIRES_TYPED_UTC");
11910
+ cellTypes.set(index, "date");
11911
+ }
11912
+ if (filter.operator === "isNull" || filter.operator === "isNotNull") {
11913
+ if (filter.values !== undefined && filter.values.length)
11914
+ return unsupported("UNSUPPORTED_NULL_RULE_OPERANDS");
11915
+ return filter.operator === "isNull" ? "ISBLANK(" + reference + ")" : present;
11916
+ }
11917
+ if (!operation || !Array.isArray(filter.values) || filter.values.length !== 1)
11918
+ return unsupported("UNSUPPORTED_RULE_FILTER:" + filter.operator);
11919
+ const value = filter.values[0];
11920
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean")
11921
+ throw new TypeError("Canopy rule values must be portable scalars.");
11922
+ if (column.kind === "number" || column.kind === "datetime") {
11923
+ const operand = column.kind === "number" ? numeric(value) : date(value);
11924
+ return "AND(" + present + ",ISNUMBER(" + reference + ")," + reference + operation + String(operand) + ")";
11925
+ }
11926
+ if (filter.operator !== "eq" && filter.operator !== "ne")
11927
+ return unsupported("UNSUPPORTED_TEXT_RULE_COMPARISON");
11928
+ // Canopy's Unicode text folding is not the native workbook's comparison contract.
11929
+ if (typeof value === "string")
11930
+ return unsupported("UNQUALIFIED_NATIVE_TEXT_COMPARISON");
11931
+ const kind = typeof value === "boolean" ? "ISLOGICAL" : "ISNUMBER";
11932
+ const literal = typeof value === "boolean" ? value ? "TRUE" : "FALSE" : String(numeric(value));
11933
+ const sameType = kind + "(" + reference + ")", comparison = reference + operation + literal;
11934
+ return filter.operator === "eq" ? "AND(" + present + "," + sameType + "," + comparison + ")"
11935
+ : "AND(" + present + ",OR(NOT(" + sameType + ")," + comparison + "))";
11936
+ };
11937
+ const visit = (input, depth) => {
11938
+ if (depth > 4 || ++nodes > 64)
11939
+ return unsupported("RULE_PREDICATE_LIMIT");
11940
+ if (!input || typeof input !== "object")
11941
+ throw new TypeError("Canopy rule predicate must be an object.");
11942
+ const captured = captureFields(input, ["operator", "filters", "groups"]);
11943
+ if (captured.operator !== "and" && captured.operator !== "or")
11944
+ return unsupported("UNSUPPORTED_RULE_BOOLEAN:" + captured.operator);
11945
+ const filters = captured.filters ?? [], groups = captured.groups ?? [];
11946
+ if (!Array.isArray(filters) || !Array.isArray(groups))
11947
+ throw new TypeError("Canopy predicate filters and groups must be arrays.");
11948
+ const terms = [];
11949
+ for (const filter of filters)
11950
+ terms.push(leaf(filter));
11951
+ for (const group of groups)
11952
+ terms.push(visit(group, depth + 1));
11953
+ if (!terms.length)
11954
+ return unsupported("EMPTY_RULE_PREDICATE");
11955
+ return captured.operator.toUpperCase() + "(" + terms.join(",") + ")";
11956
+ };
11957
+ const formula = visit(root, 1);
11958
+ if (formula.length > 8192)
11959
+ return unsupported("RULE_FORMULA_LIMIT");
11960
+ return formula;
11961
+ }
11962
+ const _exports = Object.freeze({ canopyPredicate: canopyPredicate });
11963
+ _modules.set("237239bcf5fa7675f75c53d2f367d843e089051bfd9f586770330a2c504ce1f7", _exports);
11964
+ return _exports;
11965
+ })();
11966
+
11967
+ const _m98 = _modules.get("13582dc7ba6ecf2a33722c6fee326b500408542ffdaa5cdac26ae72c310ea1ba") ?? (() => {
11968
+ const { captureFields } = _m10;
11969
+
11970
+ const { canopyPredicate } = _m99;
11971
+
11972
+ // Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
11973
+ const palette = {
11974
+ info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
11975
+ success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
11976
+ warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
11977
+ danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
11978
+ };
11979
+ class UnsupportedRule extends Error {
11980
+ }
11981
+ const unsupported = (message) => { throw new UnsupportedRule(message); };
11982
+ /** Compile declarations in source order, then emit native target/aspect priorities.
11983
+ * Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
11984
+ function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
11985
+ if (request.formatRules === undefined || format === "csv")
11986
+ return [];
11987
+ if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
11988
+ throw new TypeError("Canopy formatRules must be a bounded array of at most 1,000 declarations.");
11989
+ const visuals = [], cells = [], rows = [], ids = new Set(), columns = request.columns;
11990
+ const inputs = request.formatRules;
11991
+ const declarations = inputs.map(input => {
11992
+ if (!input || typeof input !== "object")
11993
+ throw new TypeError("Canopy rule declarations must be objects.");
11994
+ const rule = captureFields(input, ["id", "enabled", "stopIfTrue", "column", "when", "target", "style"]);
11995
+ if (typeof rule.id !== "string" || !rule.id || ids.has(rule.id))
11996
+ throw new TypeError("Canopy rule IDs must be unique nonempty strings.");
11997
+ ids.add(rule.id);
11998
+ if (rule.enabled !== undefined && typeof rule.enabled !== "boolean" || rule.stopIfTrue !== undefined && typeof rule.stopIfTrue !== "boolean")
11999
+ throw new TypeError("Canopy rule flags must be boolean.");
12000
+ const style = rule.style && typeof rule.style === "object" ? captureFields(rule.style, ["tone", "bar", "scale"]) : rule.style;
12001
+ return { ...rule, style };
12002
+ });
12003
+ if (format === "pdf") {
12004
+ for (const rule of declarations)
12005
+ if (rule.enabled !== false)
12006
+ report({ code: "PDF_NATIVE_RULE_NOT_RENDERED:" + rule.id });
12007
+ return [];
12008
+ }
12009
+ const hasStops = declarations.some(rule => rule.enabled !== false && rule.stopIfTrue);
12010
+ if (hasStops && declarations.some(rule => rule.enabled !== false && (rule.style?.bar !== undefined || rule.style?.scale !== undefined))) {
12011
+ report({ code: "UNSUPPORTED_GLOBAL_STOP_WITH_NATIVE_VISUALS" });
12012
+ return [];
12013
+ }
12014
+ const barColumns = new Set(declarations.filter(rule => rule.enabled !== false && rule.style?.bar !== undefined).map(rule => rule.column));
12015
+ const barTone = declarations.find(rule => rule.enabled !== false && rule.target !== "row" && rule.style?.tone !== undefined && rule.column !== undefined && barColumns.has(rule.column));
12016
+ if (barTone) {
12017
+ // Canopy suppresses a cell tone's fill only where its bar resolves. A single native tone patch cannot express both cases.
12018
+ report({ code: "UNSUPPORTED_CELL_TONE_WITH_DATA_BAR", columnId: barTone.column });
12019
+ return [];
12020
+ }
12021
+ const priorStops = [];
12022
+ const priorRows = [], priorCells = new Map();
12023
+ const requiredCells = new Map();
12024
+ const column = (id) => {
12025
+ const index = columns.findIndex(column => column.id === id);
12026
+ if (index < 0)
12027
+ return unsupported("RULE_COLUMN_NOT_EXPORTED:" + id);
12028
+ return index;
12029
+ };
12030
+ const numeric = (id) => {
12031
+ if (columns[column(id)].kind !== "number")
12032
+ unsupported("RULE_COLUMN_NOT_NUMERIC:" + id);
12033
+ };
12034
+ const color = (name) => {
12035
+ const mapping = tones.get(name), value = mapping?.background ?? mapping?.color ?? palette[name]?.color;
12036
+ if (value === undefined)
12037
+ return unsupported("UNMAPPED_RULE_TONE:" + name);
12038
+ return value;
12039
+ };
12040
+ const style = (name) => {
12041
+ const defaults = palette[name];
12042
+ const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
12043
+ if (!mapping)
12044
+ return unsupported("UNMAPPED_RULE_TONE:" + name);
12045
+ if ("alignment" in mapping || "wrapText" in mapping)
12046
+ return unsupported("UNSUPPORTED_RULE_TONE_STYLE:" + name);
12047
+ return {
12048
+ ...("background" in mapping && mapping.background !== undefined ? { fill: { color: mapping.background } } : {}),
12049
+ font: { ...(mapping.color === undefined ? {} : { color: mapping.color }),
12050
+ ...("bold" in mapping && mapping.bold !== undefined ? { bold: mapping.bold } : {}),
12051
+ ...("italic" in mapping && mapping.italic !== undefined ? { italic: mapping.italic } : {}) },
12052
+ ...("numberFormat" in mapping && mapping.numberFormat !== undefined ? { numberFormat: mapping.numberFormat } : {})
12053
+ };
12054
+ };
12055
+ for (const rule of declarations) {
12056
+ if (rule.enabled === false)
12057
+ continue;
12058
+ try {
12059
+ if (request.values !== "raw")
12060
+ unsupported("NATIVE_RULE_REQUIRES_RAW_VALUES");
12061
+ if (rule.target === "columns" || "columns" in rule && rule.columns !== undefined)
12062
+ unsupported("UNSUPPORTED_RULE_COLUMNS_TARGET");
12063
+ if (!rule.style || typeof rule.style !== "object" || Array.isArray(rule.style))
12064
+ throw new TypeError("Canopy rule style must be an object.");
12065
+ const styleInput = captureFields(rule.style, ["tone", "bar", "scale"]);
12066
+ if (Object.keys(styleInput).some(key => !["tone", "bar", "scale"].includes(key)))
12067
+ unsupported("UNSUPPORTED_RULE_STYLE");
12068
+ const supplied = [styleInput.bar, styleInput.scale, styleInput.tone].filter(value => value !== undefined);
12069
+ if (supplied.length !== 1)
12070
+ unsupported("UNSUPPORTED_RULE_STYLE_COMBINATION");
12071
+ if (styleInput.bar !== undefined) {
12072
+ if (rule.column === undefined || rule.when !== undefined || rule.target === "row")
12073
+ unsupported("UNSUPPORTED_BAR_TARGET");
12074
+ numeric(rule.column);
12075
+ if (rule.stopIfTrue)
12076
+ unsupported("UNSUPPORTED_BAR_STOP");
12077
+ const { minimum, maximum, tone = "info", showValue } = captureFields(styleInput.bar, ["minimum", "maximum", "tone", "showValue"]);
12078
+ if (minimum === undefined || maximum === undefined)
12079
+ return unsupported("UNBOUNDED_CANOPY_BAR");
12080
+ if (!Number.isFinite(minimum) || !Number.isFinite(maximum) || maximum <= minimum)
12081
+ throw new TypeError("Canopy bar bounds must be finite and increasing.");
12082
+ visuals.push({ type: "dataBar", range: { column: rule.column }, color: color(tone),
12083
+ minimum: { type: "number", value: minimum }, maximum: { type: "number", value: maximum }, ...(showValue === undefined ? {} : { showValue }) });
12084
+ requiredCells.set(column(rule.column), "number");
12085
+ }
12086
+ else if (styleInput.scale !== undefined) {
12087
+ if (rule.stopIfTrue)
12088
+ unsupported("UNSUPPORTED_SCALE_STOP");
12089
+ if (rule.column === undefined || rule.when !== undefined || rule.target === "row")
12090
+ unsupported("UNSUPPORTED_SCALE_TARGET");
12091
+ numeric(rule.column);
12092
+ const { stops } = captureFields(styleInput.scale, ["stops"]);
12093
+ if (!Array.isArray(stops) || stops.length < 2 || stops.length > 3)
12094
+ unsupported("UNSUPPORTED_SCALE_STOPS");
12095
+ const mapped = stops.map((input) => {
12096
+ const stop = captureFields(input, ["type", "value", "tone"]);
12097
+ if (!["min", "max", "number", "percent", "percentile"].includes(stop.type))
12098
+ unsupported("UNSUPPORTED_SCALE_THRESHOLD:" + stop.type);
12099
+ const threshold = stop.type === "min" || stop.type === "max" ? { type: stop.type }
12100
+ : { type: stop.type, value: stop.value };
12101
+ return { threshold, color: color(stop.tone) };
12102
+ });
12103
+ visuals.push({ type: "colorScale", range: { column: rule.column },
12104
+ stops: mapped });
12105
+ requiredCells.set(column(rule.column), "number");
12106
+ }
12107
+ else {
12108
+ if (rule.when === undefined || styleInput.tone === undefined || rule.target !== "row" && rule.column === undefined)
12109
+ unsupported("UNSUPPORTED_HIGHLIGHT_TARGET");
12110
+ if (rule.target !== undefined && rule.target !== "row" && rule.target !== "cell")
12111
+ unsupported("UNSUPPORTED_RULE_TARGET");
12112
+ const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
12113
+ if (rule.column !== undefined)
12114
+ column(rule.column);
12115
+ const ruleCells = new Map();
12116
+ const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
12117
+ const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
12118
+ const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
12119
+ const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
12120
+ if (formula.length > 8192)
12121
+ unsupported("RULE_FORMULA_LIMIT");
12122
+ (rule.target === "row" ? rows : cells).push({ type: "expression", range, formula, style: style(styleInput.tone) });
12123
+ previous.push(ownPredicate);
12124
+ if (rule.target !== "row")
12125
+ priorCells.set(rule.column, previous);
12126
+ for (const [column, type] of ruleCells)
12127
+ requiredCells.set(column, type);
12128
+ // A matched declaration still stops the row when an earlier tone on that target already won.
12129
+ if (rule.stopIfTrue)
12130
+ priorStops.push(ownPredicate);
12131
+ }
12132
+ }
12133
+ catch (error) {
12134
+ if (!(error instanceof UnsupportedRule))
12135
+ throw error;
12136
+ report({ code: error.message + ":" + rule.id, ...(rule.column === undefined ? {} : { columnId: rule.column }) });
12137
+ if (hasStops)
12138
+ return []; // A partial sequence cannot claim to preserve its row-global stopping behavior.
12139
+ }
12140
+ }
12141
+ for (const [column, type] of requiredCells)
12142
+ cellTypes?.set(column, type);
12143
+ // Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
12144
+ return Object.freeze([...visuals, ...cells, ...rows]);
12145
+ }
12146
+ const _exports = Object.freeze({ canopyRules: canopyRules });
12147
+ _modules.set("13582dc7ba6ecf2a33722c6fee326b500408542ffdaa5cdac26ae72c310ea1ba", _exports);
12148
+ return _exports;
12149
+ })();
12150
+
12151
+ const _m100 = _modules.get("0f2b50bd606bf0a3273e7a3bec7ed6255f23cfee522a7cfeb2cb676c062ad40e") ?? (() => {
12152
+ const { createGroupedReport } = _m8;
12153
+
12154
+ const { ExportCell } = _m5;
12155
+
12156
+ const { checkAbort } = _m4;
12157
+
12158
+ const { createTotals } = _m12;
12159
+
12160
+ const { captureFields } = _m10;
12161
+
12162
+ const { datetime } = _m95;
12163
+
12164
+ const identity = (value) => value instanceof Date ? "date:" + value.getTime() : typeof value + ":" + String(value);
12165
+ const scalar = (value) => value instanceof ExportCell ? value.value : value;
12166
+ /** Validate captured ranges, then use the owned grouping factory and its existing writers.
12167
+ * Only ranges, labels and at most four active aggregate vectors are retained; no detail body is buffered. */
12168
+ function canopyGrouped(source, request, options, limits, report, format) {
12169
+ const input = request.grouping;
12170
+ if (input === undefined)
12171
+ return undefined; // query.groupBy never manufactures a group snapshot.
12172
+ if (request.values !== "raw") {
12173
+ report({ code: "GROUPING_REQUIRES_RAW_VALUES" });
12174
+ return undefined;
12175
+ }
12176
+ if (source.rowCount === null)
12177
+ throw new TypeError("Captured grouping requires its exact scope recordCount.");
12178
+ const grouping = captureFields(input, ["levels", "aggregates", "totals", "groups"]);
12179
+ if (!Array.isArray(grouping.levels) || grouping.levels.length < 1 || grouping.levels.length > 4 || !Array.isArray(grouping.aggregates) || !Array.isArray(grouping.groups))
12180
+ throw new TypeError("Canopy grouping needs one through four levels, aggregates and ordered groups.");
12181
+ const levels = grouping.levels.map(level => Object.freeze(captureFields(level, ["column", "direction", "title"])));
12182
+ if (levels.some(level => typeof level.column !== "string" || !level.column || level.direction !== "asc" && level.direction !== "desc") ||
12183
+ new Set(levels.map(level => level.column)).size !== levels.length)
12184
+ throw new TypeError("Canopy grouping levels need unique stable columns and directions.");
12185
+ const declarations = grouping.aggregates.map(aggregate => Object.freeze(captureFields(aggregate, ["id", "column", "operation", "label"])));
12186
+ const ids = new Set(), totals = Object.create(null);
12187
+ const operations = { sum: "sum", count: "count", average: "average", minimum: "min", maximum: "max" };
12188
+ for (const aggregate of declarations) {
12189
+ if (typeof aggregate.id !== "string" || !aggregate.id || ids.has(aggregate.id))
12190
+ throw new TypeError("Canopy aggregate IDs must be unique nonempty strings.");
12191
+ ids.add(aggregate.id);
12192
+ const column = source.columns.find(column => column.key === aggregate.column);
12193
+ if (!column || column.type !== "number")
12194
+ throw new TypeError("Canopy aggregate declarations require an exported raw numeric column.");
12195
+ if (Object.hasOwn(totals, aggregate.column))
12196
+ throw new TypeError("The grouped report supports one aggregate operation per column.");
12197
+ const operation = operations[aggregate.operation];
12198
+ if (operation === undefined) {
12199
+ report({ code: "UNSUPPORTED_GROUP_AGGREGATE:" + aggregate.operation, columnId: aggregate.column });
12200
+ return undefined;
12201
+ }
12202
+ totals[aggregate.column] = operation;
12203
+ }
12204
+ // Reuse the canonical operation validator rather than implementing aggregate semantics here.
12205
+ createTotals(source.columns, totals);
12206
+ const expected = (input) => {
12207
+ if (!input || typeof input !== "object" || Array.isArray(input))
12208
+ throw new TypeError("Canopy aggregate values must be an ID-keyed object.");
12209
+ const snapshot = { ...input };
12210
+ if (Object.keys(snapshot).some(key => !ids.has(key)) || declarations.some(aggregate => !Object.hasOwn(snapshot, aggregate.id)))
12211
+ throw new TypeError("Canopy aggregate values must reference exactly the captured declarations.");
12212
+ for (const value of Object.values(snapshot))
12213
+ if (value !== null && (typeof value !== "number" || !Number.isFinite(value)))
12214
+ throw new TypeError("Canopy aggregate values must be finite numbers or null.");
12215
+ return Object.freeze(snapshot);
12216
+ };
12217
+ const grandExpected = expected(grouping.totals), byDepth = levels.map(() => []), labels = levels.map(() => new Map());
12218
+ let groups = 0, characters = 0;
12219
+ const ranges = (inputs, offset, end, depth) => {
12220
+ if (!Array.isArray(inputs))
12221
+ throw new TypeError("Canopy groups must be ordered arrays.");
12222
+ let cursor = offset;
12223
+ const keys = new Set(), values = new Set();
12224
+ for (const input of inputs) {
12225
+ const group = captureFields(input, ["key", "value", "text", "offset", "count", "aggregates", "groups"]);
12226
+ if (!group || typeof group.key !== "string" || keys.has(group.key) || !Number.isSafeInteger(group.offset) || !Number.isSafeInteger(group.count) ||
12227
+ group.count <= 0 || group.offset !== cursor || group.count > end - group.offset)
12228
+ throw new TypeError("Canopy group ranges must be nonempty contiguous half-open partitions within their parent.");
12229
+ if (group.value !== null && !["string", "number", "boolean"].includes(typeof group.value) ||
12230
+ typeof group.value === "number" && !Number.isFinite(group.value))
12231
+ throw new TypeError("Canopy group values must be portable finite scalars.");
12232
+ const dateColumn = request.columns.find(column => column.id === levels[depth].column)?.kind === "datetime";
12233
+ const value = format === "xlsx" && dateColumn && typeof group.value === "string"
12234
+ ? datetime(group.value, options.datetime ?? "preserve", options.xlsx?.dateMode ?? request.timeZone) : group.value;
12235
+ const key = identity(value), text = group.text ?? String(group.value ?? "");
12236
+ if (typeof text !== "string" || values.has(key))
12237
+ throw new TypeError("A Canopy group key cannot recur within the same parent.");
12238
+ const previousLabel = labels[depth].get(key);
12239
+ if (previousLabel !== undefined && previousLabel !== text)
12240
+ throw new TypeError("The same grouping value needs consistent captured text at one level.");
12241
+ labels[depth].set(key, text);
12242
+ keys.add(group.key);
12243
+ values.add(key);
12244
+ if (++groups > 1000 || (characters += group.key.length + key.length + text.length) > 1000000)
12245
+ throw new RangeError("Canopy group metadata exceeds the existing bounded report profile.");
12246
+ const next = group.offset + group.count;
12247
+ byDepth[depth].push(Object.freeze({ offset: group.offset, end: next, value, text, expected: expected(group.aggregates) }));
12248
+ if (depth + 1 < levels.length)
12249
+ ranges(group.groups ?? [], group.offset, next, depth + 1);
12250
+ else if (group.groups !== undefined && group.groups.length)
12251
+ throw new TypeError("Canopy nested groups exceed their declared levels.");
12252
+ cursor = next;
12253
+ }
12254
+ if (cursor !== end)
12255
+ throw new TypeError("Canopy grouping does not cover its complete exported detail range.");
12256
+ };
12257
+ ranges(grouping.groups, 0, source.rowCount, 0);
12258
+ // Validate the producer's wire arithmetic separately from the grouped writer's native formula caches.
12259
+ // Canopy sum/average use compensated accumulation and return null without numeric inputs.
12260
+ const wireTotals = () => {
12261
+ const ordinary = createTotals(source.columns, totals), sums = source.columns.map(() => 0), corrections = source.columns.map(() => 0), counts = source.columns.map(() => 0);
12262
+ return {
12263
+ accept(values) {
12264
+ for (let index = 0; index < values.length; index++) {
12265
+ const value = scalar(values[index]), operation = totals[source.columns[index].key];
12266
+ if (operation !== "sum" && operation !== "average") {
12267
+ ordinary[index].accept(value);
12268
+ continue;
12269
+ }
12270
+ if (typeof value !== "number" || !Number.isFinite(value))
12271
+ continue;
12272
+ counts[index] = counts[index] + 1;
12273
+ const next = value - corrections[index], total = sums[index] + next;
12274
+ corrections[index] = total - sums[index] - next;
12275
+ sums[index] = total;
12276
+ }
12277
+ },
12278
+ value(index) {
12279
+ const operation = totals[source.columns[index].key];
12280
+ return operation === "sum" || operation === "average" ? !counts[index] ? null
12281
+ : operation === "sum" ? sums[index] : sums[index] / counts[index] : ordinary[index].value();
12282
+ }
12283
+ };
12284
+ };
12285
+ const indexes = levels.map(() => 0), active = levels.map(() => undefined);
12286
+ const at = (depth, row) => {
12287
+ const list = byDepth[depth];
12288
+ while (list[indexes[depth]] && list[indexes[depth]].end <= row)
12289
+ indexes[depth] = indexes[depth] + 1;
12290
+ const range = list[indexes[depth]];
12291
+ if (!range || row < range.offset || row >= range.end)
12292
+ throw new TypeError("A detail row is outside its captured Canopy grouping.");
12293
+ return range;
12294
+ };
12295
+ const verify = (actual, expected) => {
12296
+ for (const declaration of declarations) {
12297
+ const position = source.columns.findIndex(column => column.key === declaration.column), observed = actual.value(position), declared = expected[declaration.id];
12298
+ // Exact producer-wire comparison retains wrong-scope rejection without rounding native caches or applying an epsilon.
12299
+ if (observed !== declared)
12300
+ throw new TypeError("Canopy captured aggregate differs from its consumed rows: " + declaration.id + ".");
12301
+ }
12302
+ };
12303
+ const same = (actual, expected) => actual instanceof Date && expected instanceof Date
12304
+ ? actual.getTime() === expected.getTime() : actual === expected;
12305
+ async function* rows() {
12306
+ let index = 0;
12307
+ const grand = wireTotals();
12308
+ for await (const values of source.rows()) {
12309
+ checkAbort(options.signal);
12310
+ for (let depth = 0; depth < levels.length; depth++) {
12311
+ const range = at(depth, index), column = source.columns.findIndex(column => column.key === levels[depth].column);
12312
+ if (column >= 0 && !same(scalar(values[column]), range.value))
12313
+ throw new TypeError("Canopy detail value disagrees with its captured group range.");
12314
+ if (range.offset === index)
12315
+ active[depth] = { range, aggregates: wireTotals() };
12316
+ }
12317
+ grand.accept(values);
12318
+ for (const group of active)
12319
+ group.aggregates.accept(values);
12320
+ yield values;
12321
+ index++;
12322
+ for (let depth = levels.length - 1; depth >= 0; depth--) {
12323
+ const group = active[depth];
12324
+ if (group.range.end === index) {
12325
+ verify(group.aggregates, group.range.expected);
12326
+ active[depth] = undefined;
12327
+ }
12328
+ }
12329
+ }
12330
+ verify(grand, grandExpected);
12331
+ }
12332
+ const groupBy = levels.map((level, depth) => {
12333
+ const visible = source.columns.some(column => column.key === level.column);
12334
+ return { key: level.column,
12335
+ ...(visible ? {} : { value: (_row, context) => at(depth, context.rowIndex).value }),
12336
+ label: (value) => labels[depth].get(identity(value)) ?? String(value ?? "") };
12337
+ });
12338
+ const sourceLimits = limits === undefined ? undefined : {
12339
+ ...(limits.maxRows === undefined ? {} : { maxRows: limits.maxRows }),
12340
+ ...(limits.maxCells === undefined ? {} : { maxCells: limits.maxCells }),
12341
+ ...(limits.maxTextCharacters === undefined ? {} : { maxTextCharacters: limits.maxTextCharacters })
12342
+ };
12343
+ return createGroupedReport(rows(), { columns: source.columns, groupBy, totals,
12344
+ ...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
12345
+ }
12346
+ const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
12347
+ _modules.set("0f2b50bd606bf0a3273e7a3bec7ed6255f23cfee522a7cfeb2cb676c062ad40e", _exports);
12348
+ return _exports;
12349
+ })();
12350
+
12351
+ const _m101 = _modules.get("c3e14cc7c7a8367d216ab1ca0b2a41751cc8775866d730cb941d062509dd4886") ?? (() => {
12352
+ const { cellText } = _m35;
12353
+
12354
+ const { cleanXml } = _m28;
12355
+
12356
+ /** Snapshot optional About metadata before enumeration. The accepted query is serialized, never evaluated. */
12357
+ function canopyAbout(request, options) {
12358
+ const result = [["revision", request.revision], ["recordCount", request.recordCount === null ? "unknown" : request.recordCount]];
12359
+ if (request.scope !== undefined) {
12360
+ if (!["filtered", "selected", "all"].includes(request.scope))
12361
+ throw new TypeError("Invalid Canopy export scope.");
12362
+ result.push(["scope", request.scope]);
12363
+ }
12364
+ for (const key of ["total", "matched"])
12365
+ if (request[key] !== undefined) {
12366
+ const value = request[key];
12367
+ if (value === null) {
12368
+ result.push([key, "unknown"]);
12369
+ continue;
12370
+ }
12371
+ if (!Number.isSafeInteger(value) || value < 0)
12372
+ throw new TypeError("Canopy metadata counts must be nonnegative safe integers.");
12373
+ result.push([key, value]);
12374
+ }
12375
+ if (request.generatedAt !== undefined) {
12376
+ if (typeof request.generatedAt !== "string" || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,9})?Z$/.test(request.generatedAt) || !Number.isFinite(new Date(request.generatedAt).getTime()))
12377
+ throw new TypeError("Canopy generatedAt must be a captured UTC ISO instant.");
12378
+ result.push(["generatedAt", request.generatedAt]);
12379
+ }
12380
+ if (request.selection !== undefined) {
12381
+ if (!Array.isArray(request.selection) || request.selection.some(id => typeof id !== "string"))
12382
+ throw new TypeError("Canopy selection metadata must contain stable string IDs.");
12383
+ result.push(["selection", JSON.stringify(request.selection)]);
12384
+ }
12385
+ if (request.query !== undefined) {
12386
+ if (!request.query || typeof request.query !== "object" || Array.isArray(request.query))
12387
+ throw new TypeError("Canopy accepted query must be a captured object.");
12388
+ const query = JSON.stringify(request.query);
12389
+ if (typeof query !== "string")
12390
+ throw new TypeError("Canopy accepted query must serialize as JSON metadata.");
12391
+ result.push(["query", query]);
12392
+ }
12393
+ if (result.reduce((sum, row) => sum + row[0].length + String(row[1]).length, 0) > 65536)
12394
+ throw new RangeError("Canopy About metadata exceeds 65,536 captured characters.");
12395
+ // Validate known cell text before consuming details; overflow preservation and XML policy stay workbook-owned.
12396
+ for (const [field, value] of result) {
12397
+ cellText(field, options.invalidCharacterPolicy);
12398
+ if (options.oversizedText === "preserve")
12399
+ cleanXml(value, options.invalidCharacterPolicy);
12400
+ else
12401
+ cellText(value, options.invalidCharacterPolicy);
12402
+ }
12403
+ return Object.freeze(result.map(row => Object.freeze(row)));
12404
+ }
12405
+ const _exports = Object.freeze({ canopyAbout: canopyAbout });
12406
+ _modules.set("c3e14cc7c7a8367d216ab1ca0b2a41751cc8775866d730cb941d062509dd4886", _exports);
12407
+ return _exports;
12408
+ })();
12409
+
12410
+ const _m102 = _modules.get("e9bef8c7399cd0b119a8802014687efc2004572db8fa3045f2dbfe3c37ab6fb9") ?? (() => {
12411
+ const { Workbook, addGroupedXlsx } = _m23;
12412
+
12413
+ const { portableWorkbook } = _m52;
12414
+
12415
+ const { withDestination } = _m3;
12416
+
12417
+ /** Compose only the adapter's data/grouped sheet and optional metadata sheet in the existing workbook owner. */
12418
+ async function writeCanopyWorkbook(source, grouped, destination, options, labels, about) {
12419
+ const { sheet: sheetSettings = {}, columns: _columns, ...settings } = options;
12420
+ const { name = "Data", ...sheet } = sheetSettings;
12421
+ if (about && name.toLowerCase() === "about")
12422
+ throw new TypeError("The optional About worksheet needs a distinct data-sheet name.");
12423
+ if (grouped && settings.cellValueWriters !== undefined)
12424
+ throw new TypeError("Grouped Canopy exports use resolved source values rather than custom cellValueWriters.");
12425
+ return withDestination(destination, async (sink) => {
12426
+ const workbookOptions = { ...portableWorkbook(settings), sink };
12427
+ // Grouped worksheets generate native FormulaCells; flat tables keep the portable-value boundary.
12428
+ const book = grouped ? new Workbook(workbookOptions) : Workbook.forTable(workbookOptions);
12429
+ try {
12430
+ let rows, columns;
12431
+ if (grouped) {
12432
+ const { conditionalFormats, ...groupedSheet } = sheet;
12433
+ const written = await addGroupedXlsx(book, grouped, {
12434
+ labelColumn: { header: labels?.labelColumn?.header ?? "Group", width: 18 },
12435
+ subtotalLabel: labels?.subtotalLabel ?? (group => group.label + " total"),
12436
+ grandTotalLabel: labels?.grandTotalLabel ?? (() => "Grand total"),
12437
+ ...(labels?.includeGrandTotal === undefined ? {} : { includeGrandTotal: labels.includeGrandTotal }),
12438
+ sheet: { ...groupedSheet, name }, ...(conditionalFormats === undefined ? {} : { conditionalFormats })
12439
+ });
12440
+ rows = written.rows;
12441
+ columns = written.columns;
12442
+ }
12443
+ else {
12444
+ const data = book.addWorksheet(name, { boldHeader: true, autoFilter: sheet.includeHeader !== false,
12445
+ autoSize: { minWidth: 6, maxWidth: 54 }, ...sheet, columns: source.columns });
12446
+ await data.addRows(source.rows());
12447
+ await data.close();
12448
+ rows = data.rowCount;
12449
+ columns = source.columns.length;
12450
+ }
12451
+ if (about) {
12452
+ const metadata = book.addWorksheet("About", { columns: [{ header: "Field", width: 18 }, { header: "Value", width: 72, wrapText: true }],
12453
+ boldHeader: true, freezeHeader: true });
12454
+ await metadata.addRows(about);
12455
+ await metadata.close();
12456
+ }
12457
+ const result = await book.finish();
12458
+ return { rows, columns, bytes: result.bytes };
12459
+ }
12460
+ catch (error) {
12461
+ await book.discard(error);
12462
+ throw error;
12463
+ }
12464
+ });
11673
12465
  }
11674
- const _exports = Object.freeze({ createCanopyExport: createCanopyExport });
11675
- _modules.set("91dbdf35d8f192b3c0ea92dfab6b9812872fbe3c8d85a5d2afe389bd61262ba2", _exports);
12466
+ const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
12467
+ _modules.set("e9bef8c7399cd0b119a8802014687efc2004572db8fa3045f2dbfe3c37ab6fb9", _exports);
11676
12468
  return _exports;
11677
12469
  })();
11678
12470
 
11679
- const _m0 = _modules.get("6ebd256ad3ef99ead0a703b00c46781fd46dd9a03d21a4636e3fcecd8147d96c") ?? (() => {
11680
- const { BlobByteSink } = _m1;
12471
+ const _m0 = _modules.get("06222f91ea59fdd2aff673ab351a19c8b3372e05c612adf6136ffa05ee8bf037") ?? (() => {
12472
+ const { BlobByteSink, ExportCell } = _m1;
11681
12473
 
11682
12474
  const { notifyProgress } = _m14;
11683
12475
 
@@ -11689,36 +12481,98 @@ const { writeXlsxTo } = _m23;
11689
12481
 
11690
12482
  const { writeCsvTo } = _m55;
11691
12483
 
11692
- const { writePdfTo } = _m57;
12484
+ const { writePdfTo, writeGroupedPdfTo } = _m57;
12485
+
12486
+ const { prepareCanopyExport } = _m94;
12487
+
12488
+ const { canopyPins } = _m97;
12489
+
12490
+ const { canopyRules } = _m98;
11693
12491
 
11694
- const { createCanopyExport } = _m94;
12492
+ const { canopyGrouped } = _m100;
11695
12493
 
12494
+ const { canopyAbout } = _m101;
11696
12495
 
12496
+ const { writeCanopyWorkbook } = _m102;
11697
12497
 
11698
12498
 
11699
12499
 
11700
12500
 
11701
12501
 
11702
- /** Write a captured CanopyX grid to a caller-owned destination; its partial bytes remain caller-owned on failure. */
12502
+
12503
+
12504
+ /** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
11703
12505
  async function writeCanopyTo(capture, format, destination, options = {}) {
11704
- const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress"]);
12506
+ const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
11705
12507
  const { signal, onProgress } = selected, limits = captureCommonLimits(selected.limits);
11706
12508
  const xlsx = captureXlsxOptions(format === "xlsx" ? selected.xlsx : undefined);
11707
12509
  const csv = captureCsvOptions(format === "csv" ? selected.csv : undefined);
11708
12510
  const pdf = capturePdfOptions(format === "pdf" ? selected.pdf : undefined);
11709
- const source = createCanopyExport(capture, format, { ...selected, xlsx });
12511
+ const prepared = prepareCanopyExport(capture, format, { ...selected, xlsx }), { request, report, tones } = prepared;
12512
+ if (selected.about !== undefined && typeof selected.about !== "boolean")
12513
+ throw new TypeError("Canopy about must be boolean.");
12514
+ const labels = selected.grouped === undefined ? undefined : captureFields(selected.grouped, ["labelColumn", "subtotalLabel", "grandTotalLabel", "includeGrandTotal", "continuationLabel", "groupHeadingLevel"]);
12515
+ const capturedLabels = labels && { ...labels, ...(labels.labelColumn === undefined ? {} : { labelColumn: Object.freeze({ header: labels.labelColumn.header }) }) };
12516
+ const about = format === "xlsx" && selected.about ? canopyAbout(request, xlsx) : undefined;
12517
+ const ruleCellTypes = new Map();
12518
+ let consumed = 0;
12519
+ const source = Object.freeze({ ...prepared.source, async *rows() {
12520
+ for await (const row of prepared.source.rows()) {
12521
+ for (const [column, type] of ruleCellTypes) {
12522
+ const cell = row[column], raw = cell instanceof ExportCell ? cell.value : cell;
12523
+ if (raw == null || type === "number" && typeof raw === "number" && Number.isFinite(raw) || type === "date" && raw instanceof Date && Number.isFinite(raw.getTime()))
12524
+ continue;
12525
+ const code = "UNSUPPORTED_NATIVE_RULE_CELL_TYPE:" + type;
12526
+ report({ code, columnId: source.columns[column].key });
12527
+ // Text fallback cannot retract an already captured native declaration after streaming starts.
12528
+ throw new TypeError("Unsupported Canopy presentation: " + code + " (" + source.columns[column].key + ")");
12529
+ }
12530
+ consumed++;
12531
+ yield row;
12532
+ }
12533
+ } });
11710
12534
  const progress = onProgress ? { onProgress: (event) => {
11711
- notifyProgress(onProgress, { ...event, ...(source.rowCount === null ? {} : { totalRows: source.rowCount }) });
12535
+ // About and generated group rows consume output budgets, but never become exported source details.
12536
+ notifyProgress(onProgress, { ...event, rows: consumed,
12537
+ ...(event.sheetRows === undefined ? {} : { sheetRows: about !== undefined && event.sheetName === "About" ? 0 : consumed }),
12538
+ ...(source.rowCount === null ? {} : { totalRows: source.rowCount }) });
11712
12539
  } } : {};
11713
12540
  const stream = { ...(signal ? { signal } : {}), ...progress };
11714
- if (format === "xlsx")
11715
- return writeXlsxTo(source.rows(), destination, { ...xlsx, ...stream, columns: source.columns,
11716
- dateMode: xlsx.dateMode ?? capture.request.timeZone,
11717
- limits: mergeAdapterLimits(xlsx.limits, limits) });
11718
- if (format === "pdf")
11719
- return writePdfTo(source.rows(), destination, { ...pdf, ...stream, columns: source.columns,
11720
- limits: mergeAdapterLimits(pdf.limits, limits) });
11721
- return writeCsvTo(source.rows(), destination, { ...csv, ...stream, columns: source.columns, valueMode: capture.request.values,
12541
+ if (format === "xlsx") {
12542
+ const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
12543
+ const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
12544
+ const sheet = { ...xlsx.sheet,
12545
+ freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
12546
+ freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
12547
+ conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
12548
+ const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits };
12549
+ if (grouped || about)
12550
+ return writeCanopyWorkbook(source, grouped, destination, settings, capturedLabels, about);
12551
+ return writeXlsxTo(source.rows(), destination, settings);
12552
+ }
12553
+ if (format === "pdf") {
12554
+ const formatLimits = mergeAdapterLimits(pdf.limits, limits), grouped = canopyGrouped(source, request, selected, formatLimits, report, format);
12555
+ canopyRules(request, format, grouped !== undefined, tones, report, selected);
12556
+ // CSS pixels become points before the existing fit/band policy. Explicit PDF point widths win.
12557
+ const fitted = request.columns.every(column => column.width !== undefined) ? request.columns.map(column => column.width.preferred * 72 / 96) : undefined;
12558
+ const widths = pdf.columnWidths ?? fitted;
12559
+ const settings = { ...(fitted === undefined ? {} : { orientation: "landscape", wideTable: "fit" }), ...pdf, ...stream, limits: formatLimits };
12560
+ if (grouped) {
12561
+ if (pdf.headerRows !== undefined || pdf.footer !== undefined)
12562
+ throw new TypeError("Grouped Canopy PDF owns heading and summary rows.");
12563
+ const { headerRows: _headers, footer: _footer, ...groupedSettings } = settings;
12564
+ return writeGroupedPdfTo(grouped, destination, { ...groupedSettings,
12565
+ ...(widths === undefined ? {} : { columnWidths: [72, ...widths] }),
12566
+ labelColumn: { header: capturedLabels?.labelColumn?.header ?? "Group", width: 12 },
12567
+ subtotalLabel: capturedLabels?.subtotalLabel ?? (group => group.label + " total"),
12568
+ grandTotalLabel: capturedLabels?.grandTotalLabel ?? (() => "Grand total"),
12569
+ ...(capturedLabels?.includeGrandTotal === undefined ? {} : { includeGrandTotal: capturedLabels.includeGrandTotal }),
12570
+ ...(capturedLabels?.continuationLabel === undefined ? {} : { continuationLabel: capturedLabels.continuationLabel }),
12571
+ ...(capturedLabels?.groupHeadingLevel === undefined ? {} : { groupHeadingLevel: capturedLabels.groupHeadingLevel }) });
12572
+ }
12573
+ return writePdfTo(source.rows(), destination, { ...settings, columns: source.columns, ...(widths === undefined ? {} : { columnWidths: widths }) });
12574
+ }
12575
+ return writeCsvTo(source.rows(), destination, { ...csv, ...stream, columns: source.columns, valueMode: request.values,
11722
12576
  limits: mergeAdapterLimits(csv.limits, limits) });
11723
12577
  }
11724
12578
  /** Export an immutable native capture as a Blob without loading or registering CanopyX. */
@@ -11734,7 +12588,7 @@ async function exportCanopy(capture, format, options = {}) {
11734
12588
  }
11735
12589
  }
11736
12590
  const _exports = Object.freeze({ createCanopyExport: _m94.createCanopyExport, ExportCell: _m5.ExportCell, PdfFont: _m63.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
11737
- _modules.set("6ebd256ad3ef99ead0a703b00c46781fd46dd9a03d21a4636e3fcecd8147d96c", _exports);
12591
+ _modules.set("06222f91ea59fdd2aff673ab351a19c8b3372e05c612adf6136ffa05ee8bf037", _exports);
11738
12592
  return _exports;
11739
12593
  })();
11740
12594
  Object.assign(officeimo, _m0);