@evotecit/officeimo 0.1.9 → 0.1.21

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 +6 -3
  2. package/bundles/officeimo-canopyx-adapter.js +123 -61
  3. package/bundles/officeimo-canopyx-adapter.min.js +1 -1
  4. package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
  5. package/bundles/officeimo-canopyx-adapter.mjs +109 -48
  6. package/bundles/officeimo-canopyx.js +179 -102
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +145 -69
  10. package/bundles/officeimo-datatables-adapter.js +7 -7
  11. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  12. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  13. package/bundles/officeimo-datatables-adapter.mjs +3 -3
  14. package/bundles/officeimo-datatables.js +63 -48
  15. package/bundles/officeimo-datatables.min.js +1 -1
  16. package/bundles/officeimo-datatables.min.mjs +1 -1
  17. package/bundles/officeimo-datatables.mjs +39 -24
  18. package/bundles/officeimo-xlsx.js +59 -44
  19. package/bundles/officeimo-xlsx.min.js +1 -1
  20. package/bundles/officeimo-xlsx.min.mjs +1 -1
  21. package/bundles/officeimo-xlsx.mjs +39 -24
  22. package/bundles/officeimo.js +61 -46
  23. package/bundles/officeimo.min.js +1 -1
  24. package/bundles/officeimo.min.mjs +1 -1
  25. package/bundles/officeimo.mjs +40 -25
  26. package/dist/integrations/canopyx/index.js +4 -2
  27. package/dist/integrations/canopyx/metadata.js +1 -1
  28. package/dist/integrations/canopyx/pdf-number.js +9 -6
  29. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  30. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  31. package/dist/integrations/canopyx/rules.d.ts +1 -1
  32. package/dist/integrations/canopyx/rules.js +11 -13
  33. package/dist/integrations/canopyx/source.js +44 -7
  34. package/dist/integrations/canopyx/tones.d.ts +10 -0
  35. package/dist/integrations/canopyx/tones.js +12 -0
  36. package/dist/integrations/canopyx/types.d.ts +10 -2
  37. package/dist/xlsx/options.js +1 -1
  38. package/dist/xlsx/portable.js +1 -1
  39. package/dist/xlsx/styles.js +28 -18
  40. package/dist/xlsx/types.d.ts +5 -1
  41. package/dist/xlsx/workbook.js +3 -1
  42. package/dist/xlsx/worksheet.js +5 -2
  43. package/package.json +1 -1
@@ -1409,13 +1409,13 @@ _modules.set("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38",
1409
1409
  return _exports;
1410
1410
  })();
1411
1411
 
1412
- const _m22 = _modules.get("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865") ?? (() => {
1412
+ const _m22 = _modules.get("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e") ?? (() => {
1413
1413
  const { captureFields } = _m10;
1414
1414
 
1415
1415
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
1416
1416
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
1417
1417
  /** @internal Worksheet settings also used by the portable sheet owner. */
1418
- const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
1418
+ const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
1419
1419
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
1420
1420
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
1421
1421
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -1428,11 +1428,11 @@ function captureWorkbookOptions(options) {
1428
1428
  return { ...captured, ...(captured.limits === undefined ? {} : { limits: captureWorkbookLimits(captured.limits) }) };
1429
1429
  }
1430
1430
  const _exports = Object.freeze({ workbookOptionFields: workbookOptionFields, sheetOptionFields: sheetOptionFields, workbookLimitFields: workbookLimitFields, captureWorkbookLimits: captureWorkbookLimits, captureWorkbookOptions: captureWorkbookOptions });
1431
- _modules.set("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865", _exports);
1431
+ _modules.set("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e", _exports);
1432
1432
  return _exports;
1433
1433
  })();
1434
1434
 
1435
- const _m15 = _modules.get("7b12a415e92cc9ef7212fb3a88007cb6dc37f9f30077165d4897cfa8052f9a3c") ?? (() => {
1435
+ const _m15 = _modules.get("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4") ?? (() => {
1436
1436
  const { captureFields } = _m10;
1437
1437
 
1438
1438
  const { ExportBudget } = _m9;
@@ -1473,7 +1473,7 @@ function capturePdfOptions(input = {}) {
1473
1473
  return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
1474
1474
  }
1475
1475
  const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
1476
- _modules.set("7b12a415e92cc9ef7212fb3a88007cb6dc37f9f30077165d4897cfa8052f9a3c", _exports);
1476
+ _modules.set("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4", _exports);
1477
1477
  return _exports;
1478
1478
  })();
1479
1479
 
@@ -2434,7 +2434,7 @@ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148",
2434
2434
  return _exports;
2435
2435
  })();
2436
2436
 
2437
- const _m32 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
2437
+ const _m32 = _modules.get("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a") ?? (() => {
2438
2438
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
2439
2439
 
2440
2440
  const { OfficeIMOError } = _m2;
@@ -2446,6 +2446,24 @@ const { DifferentialStyles } = _m34;
2446
2446
 
2447
2447
 
2448
2448
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
2449
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
2450
+ /** @internal Validate and normalize border edges without registering a workbook style. */
2451
+ function normalizeBorder(border) {
2452
+ if (!border || typeof border !== "object")
2453
+ throw new TypeError("A border must be an object of edges.");
2454
+ const result = {};
2455
+ for (const side of ["left", "right", "top", "bottom"]) {
2456
+ const edge = border[side];
2457
+ if (edge) {
2458
+ // Read each property once, so the validated edge is the one that is stored.
2459
+ const { style, color } = edge;
2460
+ if (!borderStyles.includes(style))
2461
+ throw new TypeError("Invalid border style.");
2462
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
2463
+ }
2464
+ }
2465
+ return result;
2466
+ }
2449
2467
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
2450
2468
  function index(value, count, kind) {
2451
2469
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -2518,32 +2536,24 @@ class StyleRegistry {
2518
2536
  /** @internal */
2519
2537
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
2520
2538
  addFont(font) {
2521
- if (font.name !== undefined && typeof font.name !== "string")
2539
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
2540
+ if (requested !== undefined && typeof requested !== "string")
2522
2541
  throw new TypeError("Font name must be a string.");
2523
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
2542
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
2524
2543
  if (typeof name !== "string" || !name || name.length > 31)
2525
2544
  throw new TypeError("Font name must contain 1 through 31 characters.");
2526
2545
  if (!Number.isFinite(size) || size <= 0 || size > 409)
2527
2546
  throw new RangeError("Font size must be positive and at most 409.");
2528
- return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!font.bold, italic: !!font.italic, underline: !!font.underline, strike: !!font.strike, color: font.color ? colorArgb(font.color) : "" }, this.maximum);
2547
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
2529
2548
  }
2530
2549
  addFill(fill) {
2531
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
2532
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
2550
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
2551
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
2533
2552
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
2534
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
2553
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
2535
2554
  }
2536
2555
  addBorder(border) {
2537
- const result = {};
2538
- for (const side of ["left", "right", "top", "bottom"]) {
2539
- const edge = border[side];
2540
- if (edge) {
2541
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
2542
- throw new TypeError("Invalid border style.");
2543
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
2544
- }
2545
- }
2546
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
2556
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
2547
2557
  }
2548
2558
  addNumberFormat(format) {
2549
2559
  if (typeof format !== "string" || !format || format.length > 255)
@@ -2609,7 +2619,7 @@ class StyleRegistry {
2609
2619
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
2610
2620
  }
2611
2621
  /** @internal Column shorthand and header style composition. */
2612
- forColumn(column, header = false, fill, date = false) {
2622
+ forColumn(column, header = false, fill, date = false, border) {
2613
2623
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
2614
2624
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
2615
2625
  return this.add({
@@ -2618,7 +2628,7 @@ class StyleRegistry {
2618
2628
  wrapText: column.wrapText ?? base?.wrapText ?? false,
2619
2629
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
2620
2630
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
2621
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
2631
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
2622
2632
  });
2623
2633
  }
2624
2634
  toXml() {
@@ -2643,8 +2653,8 @@ class StyleRegistry {
2643
2653
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
2644
2654
  }
2645
2655
  }
2646
- const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2647
- _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
2656
+ const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2657
+ _modules.set("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a", _exports);
2648
2658
  return _exports;
2649
2659
  })();
2650
2660
 
@@ -3798,7 +3808,7 @@ _modules.set("13fa96d976e4dec7343dd3a392829567f1fcb574324a98f5a5d3a61c9a0dc27d",
3798
3808
  return _exports;
3799
3809
  })();
3800
3810
 
3801
- const _m38 = _modules.get("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376") ?? (() => {
3811
+ const _m38 = _modules.get("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a") ?? (() => {
3802
3812
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3803
3813
 
3804
3814
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -3909,8 +3919,9 @@ class Worksheet {
3909
3919
  book.checkLinks(this.links.length);
3910
3920
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3911
3921
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3912
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3913
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3922
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3923
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3924
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3914
3925
  }));
3915
3926
  // Register conditional styles only after worksheet construction can no longer reject its options.
3916
3927
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3962,6 +3973,8 @@ class Worksheet {
3962
3973
  throw new TypeError("A frozen header or autofilter requires a header row.");
3963
3974
  if (options.headerFill !== undefined)
3964
3975
  colorArgb(options.headerFill);
3976
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3977
+ throw new TypeError("headerWrap must be boolean.");
3965
3978
  if (options.headerStyle !== undefined)
3966
3979
  book.styles.validateStyle(options.headerStyle);
3967
3980
  if (options.alternatingRowStyle !== undefined)
@@ -4530,11 +4543,11 @@ class Worksheet {
4530
4543
  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); }
4531
4544
  }
4532
4545
  const _exports = Object.freeze({ Worksheet: Worksheet });
4533
- _modules.set("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376", _exports);
4546
+ _modules.set("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a", _exports);
4534
4547
  return _exports;
4535
4548
  })();
4536
4549
 
4537
- const _m48 = _modules.get("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4") ?? (() => {
4550
+ const _m48 = _modules.get("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0") ?? (() => {
4538
4551
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m28;
4539
4552
 
4540
4553
  const { cellText, columnName } = _m35;
@@ -4577,7 +4590,7 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4577
4590
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4578
4591
  }
4579
4592
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4580
- _modules.set("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4", _exports);
4593
+ _modules.set("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0", _exports);
4581
4594
  return _exports;
4582
4595
  })();
4583
4596
 
@@ -4952,7 +4965,7 @@ _modules.set("24f1417c3c320a8a41137c28f70b72091256c63010be0c88b684dce85f54950c",
4952
4965
  return _exports;
4953
4966
  })();
4954
4967
 
4955
- const _m24 = _modules.get("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a") ?? (() => {
4968
+ const _m24 = _modules.get("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0") ?? (() => {
4956
4969
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4957
4970
 
4958
4971
  const { OfficeIMOError } = _m2;
@@ -4967,7 +4980,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4967
4980
 
4968
4981
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
4969
4982
 
4970
- const { StyleRegistry, spreadsheetNamespace } = _m32;
4983
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m32;
4971
4984
 
4972
4985
  const { sheetName, assertXlsxValue, copyValue } = _m35;
4973
4986
 
@@ -5008,6 +5021,8 @@ function captureSheet(options, policy) {
5008
5021
  return { ...captured, columns,
5009
5022
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
5010
5023
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
5024
+ // Preflight and every header style read this one snapshot of the edges.
5025
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
5011
5026
  ...(footer ? { footer: { ...footer,
5012
5027
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
5013
5028
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -5433,11 +5448,11 @@ class Workbook {
5433
5448
  }
5434
5449
  }
5435
5450
  const _exports = Object.freeze({ Workbook: Workbook });
5436
- _modules.set("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a", _exports);
5451
+ _modules.set("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0", _exports);
5437
5452
  return _exports;
5438
5453
  })();
5439
5454
 
5440
- const _m53 = _modules.get("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0") ?? (() => {
5455
+ const _m53 = _modules.get("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba") ?? (() => {
5441
5456
  const { ExportCell, assertScalar } = _m5;
5442
5457
 
5443
5458
  const { captureWorkbookOptions, sheetOptionFields } = _m22;
@@ -5459,7 +5474,7 @@ function value(result) {
5459
5474
  function portableSheet(options = {}) {
5460
5475
  options = captureFields(options, sheetOptionFields);
5461
5476
  if (options.headerStyle !== undefined)
5462
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
5477
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
5463
5478
  style(options.alternatingRowStyle);
5464
5479
  style(options.title?.style);
5465
5480
  style(options.footer?.style);
@@ -5486,11 +5501,11 @@ function portableWorkbook(options = {}) {
5486
5501
  return { ...options, cellValueWriters: wrapped };
5487
5502
  }
5488
5503
  const _exports = Object.freeze({ portableSheet: portableSheet, portableWorkbook: portableWorkbook });
5489
- _modules.set("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0", _exports);
5504
+ _modules.set("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba", _exports);
5490
5505
  return _exports;
5491
5506
  })();
5492
5507
 
5493
- const _m52 = _modules.get("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63") ?? (() => {
5508
+ const _m52 = _modules.get("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471") ?? (() => {
5494
5509
  const { withDestination } = _m3;
5495
5510
 
5496
5511
  const { copyColumns } = _m11;
@@ -5545,11 +5560,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5545
5560
  });
5546
5561
  }
5547
5562
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5548
- _modules.set("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63", _exports);
5563
+ _modules.set("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471", _exports);
5549
5564
  return _exports;
5550
5565
  })();
5551
5566
 
5552
- const _m55 = _modules.get("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c") ?? (() => {
5567
+ const _m55 = _modules.get("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576") ?? (() => {
5553
5568
  const { assertGroupedReportSource } = _m8;
5554
5569
 
5555
5570
  const { captureFields } = _m10;
@@ -5638,11 +5653,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5638
5653
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5639
5654
  }
5640
5655
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5641
- _modules.set("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c", _exports);
5656
+ _modules.set("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576", _exports);
5642
5657
  return _exports;
5643
5658
  })();
5644
5659
 
5645
- const _m54 = _modules.get("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4") ?? (() => {
5660
+ const _m54 = _modules.get("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a") ?? (() => {
5646
5661
  const { groupedReportOperation } = _m8;
5647
5662
 
5648
5663
  const { checkAbort, withAbort } = _m4;
@@ -5815,14 +5830,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5815
5830
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5816
5831
  }
5817
5832
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5818
- _modules.set("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4", _exports);
5833
+ _modules.set("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a", _exports);
5819
5834
  return _exports;
5820
5835
  })();
5821
5836
 
5822
- const _m23 = _modules.get("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6") ?? (() => {
5837
+ const _m23 = _modules.get("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974") ?? (() => {
5823
5838
 
5824
5839
  const _exports = Object.freeze({ Workbook: _m24.Workbook, writeXlsx: _m52.writeXlsx, writeXlsxTo: _m52.writeXlsxTo, writeGroupedXlsx: _m54.writeGroupedXlsx, writeGroupedXlsxTo: _m54.writeGroupedXlsxTo, addGroupedXlsx: _m54.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m38.Worksheet, Cell: _m35.Cell, FormulaCell: _m36.FormulaCell, StyleRegistry: _m32.StyleRegistry, NumberFormats: _m32.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
5825
- _modules.set("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6", _exports);
5840
+ _modules.set("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974", _exports);
5826
5841
  return _exports;
5827
5842
  })();
5828
5843
 
@@ -11861,7 +11876,25 @@ _modules.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",
11861
11876
  return _exports;
11862
11877
  })();
11863
11878
 
11864
- const _m96 = _modules.get("40e200b77947621ffacdfa2e1326760a78a52a7dfb6d0cbaa7c7a71607b119a2") ?? (() => {
11879
+ const _m100 = _modules.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac") ?? (() => {
11880
+ /** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
11881
+ * Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
11882
+ const canopyTonePalette = Object.freeze({
11883
+ info: Object.freeze({ color: "4472C4", background: "DDEBF7", foreground: "1F4E78" }),
11884
+ success: Object.freeze({ color: "70AD47", background: "E2F0D9", foreground: "375623" }),
11885
+ warning: Object.freeze({ color: "FFC000", background: "FFF2CC", foreground: "7F5000" }),
11886
+ danger: Object.freeze({ color: "C00000", background: "FFC7CE", foreground: "9C0006" }),
11887
+ // Muted tones dim the text rather than painting the cell.
11888
+ muted: Object.freeze({ color: "A6A6A6", foreground: "595959" })
11889
+ });
11890
+ /** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
11891
+ const canopyDefaultTones = new Map(Object.entries(canopyTonePalette).map(([name, tone]) => [name, Object.freeze({ ...(tone.background === undefined ? {} : { background: tone.background }), color: tone.foreground })]));
11892
+ const _exports = Object.freeze({ canopyTonePalette: canopyTonePalette, canopyDefaultTones: canopyDefaultTones });
11893
+ _modules.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac", _exports);
11894
+ return _exports;
11895
+ })();
11896
+
11897
+ const _m96 = _modules.get("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50") ?? (() => {
11865
11898
  const { ExportCell, checkAbort, inputRows } = _m1;
11866
11899
 
11867
11900
  const { canopyPivot, pivotNumberFormat } = _m97;
@@ -11878,8 +11911,21 @@ const { canopyDiagnostics } = _m95;
11878
11911
 
11879
11912
  const { canopyNumberFormat, canopyXlsxWidth } = _m99;
11880
11913
 
11914
+ const { canopyDefaultTones } = _m100;
11915
+
11881
11916
  const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
11917
+ // Captured presentations whose cell text already carries the readable content (badge labels are appended below).
11918
+ // Their visual loss is reported, never treated as an unsupported export.
11919
+ const textFallbacks = new Set(["relative-link", "history-series", "badges", "custom-class", "custom-renderer"]);
11920
+ const badgeSeparator = " \u00b7 ";
11882
11921
  const rawIdentities = new WeakMap();
11922
+ // Appended badge labels, kept apart so later passes that re-render a cell's text (PDF numbers) can carry them over.
11923
+ const badgeSuffixes = new WeakMap();
11924
+ /** @internal The text a later pass may re-render, and the badge suffix it must append back unchanged. */
11925
+ function canopyBadgeSplit(cell) {
11926
+ const suffix = badgeSuffixes.get(cell), text = cell.text ?? "";
11927
+ return suffix !== undefined && text.endsWith(suffix) ? { text: text.slice(0, text.length - suffix.length), suffix } : { text, suffix: "" };
11928
+ }
11883
11929
  /** @internal Grouping uses captured identity even when a detail cell displays a relative-link label. */
11884
11930
  function canopyIdentityValue(value) {
11885
11931
  if (!(value instanceof ExportCell))
@@ -11887,6 +11933,20 @@ function canopyIdentityValue(value) {
11887
11933
  const original = rawIdentities.get(value);
11888
11934
  return original === undefined ? value.value : original;
11889
11935
  }
11936
+ function badgeText(input) {
11937
+ if (!Array.isArray(input) || input.length > 64)
11938
+ throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
11939
+ const labels = [];
11940
+ for (const badge of input) {
11941
+ const text = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
11942
+ if (typeof text !== "string")
11943
+ throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
11944
+ const label = text.trim();
11945
+ if (label)
11946
+ labels.push(label);
11947
+ }
11948
+ return labels.length ? labels.join(badgeSeparator) : undefined;
11949
+ }
11890
11950
  /** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
11891
11951
  function createCanopyExport(capture, format, options = {}) {
11892
11952
  return prepareCanopyExport(capture, format, options).source;
@@ -11920,7 +11980,7 @@ function prepareCanopyExport(capture, format, options = {}) {
11920
11980
  throw new TypeError("Canopy presentation diagnostics must be strings.");
11921
11981
  for (const code of items) {
11922
11982
  const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
11923
- (code === "relative-link" || code === "history-series" ? fallback : report)(diagnostic);
11983
+ (textFallbacks.has(code) ? fallback : report)(diagnostic);
11924
11984
  }
11925
11985
  };
11926
11986
  if (request.presentation !== "text" && request.presentation !== "semantic")
@@ -11935,11 +11995,13 @@ function prepareCanopyExport(capture, format, options = {}) {
11935
11995
  return undefined;
11936
11996
  if (typeof name !== "string")
11937
11997
  throw new TypeError("Canopy tones must be strings.");
11938
- const style = tones.get(name);
11998
+ const style = tones.get(name) ?? canopyDefaultTones.get(name);
11939
11999
  if (!style && name !== "neutral")
11940
12000
  fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
11941
12001
  return style;
11942
12002
  };
12003
+ // The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
12004
+ const ruleOperands = new Set();
11943
12005
  const ids = new Set();
11944
12006
  const specs = (pivot?.columns ?? request.columns).map(input => {
11945
12007
  const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
@@ -11998,8 +12060,14 @@ function prepareCanopyExport(capture, format, options = {}) {
11998
12060
  diagnostics(cell.diagnostics, row.id, spec.id);
11999
12061
  // A relative destination is navigation metadata, not the visible label.
12000
12062
  // History captures already carry their frozen latest scalar (or null).
12001
- const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link");
12002
- let value = values === "display" || relativeLabel ? cell.text : cell.value;
12063
+ // Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
12064
+ const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
12065
+ const badges = cell.badges === undefined ? undefined : badgeText(cell.badges);
12066
+ const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
12067
+ // Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
12068
+ // Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
12069
+ const badgedValue = !!badges && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
12070
+ let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
12003
12071
  if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
12004
12072
  value = datetime(value, dateMode, clock);
12005
12073
  const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
@@ -12014,9 +12082,12 @@ function prepareCanopyExport(capture, format, options = {}) {
12014
12082
  if (format === "csv")
12015
12083
  result.push(value);
12016
12084
  else {
12017
- const exported = new ExportCell(value, { text: cell.text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
12018
- if (relativeLabel)
12085
+ const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
12086
+ if (relativeLabel || badgedValue)
12019
12087
  rawIdentities.set(exported, cell.value);
12088
+ // A badge-only label is all suffix: later passes then see the captured label as empty.
12089
+ if (badges)
12090
+ badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
12020
12091
  result.push(exported);
12021
12092
  }
12022
12093
  }
@@ -12028,14 +12099,14 @@ function prepareCanopyExport(capture, format, options = {}) {
12028
12099
  if (rowCount !== null && count !== rowCount)
12029
12100
  throw new TypeError("Canopy capture did not produce its declared recordCount.");
12030
12101
  } });
12031
- return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
12102
+ return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
12032
12103
  }
12033
- const _exports = Object.freeze({ canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
12034
- _modules.set("40e200b77947621ffacdfa2e1326760a78a52a7dfb6d0cbaa7c7a71607b119a2", _exports);
12104
+ const _exports = Object.freeze({ canopyBadgeSplit: canopyBadgeSplit, canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
12105
+ _modules.set("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50", _exports);
12035
12106
  return _exports;
12036
12107
  })();
12037
12108
 
12038
- const _m101 = _modules.get("2b0b73e8c376d24e6a5b498c0f710966b00de0eff44f474d7b2aece7af64fa96") ?? (() => {
12109
+ const _m102 = _modules.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c") ?? (() => {
12039
12110
  const { columnName, excelDate } = _m35;
12040
12111
 
12041
12112
  const { captureFields } = _m10;
@@ -12043,7 +12114,7 @@ const { captureFields } = _m10;
12043
12114
  const { datetime } = _m98;
12044
12115
 
12045
12116
  /** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
12046
- function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
12117
+ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes, operands) {
12047
12118
  let nodes = 0;
12048
12119
  const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
12049
12120
  const numeric = (value) => {
@@ -12090,6 +12161,7 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
12090
12161
  const index = request.columns.findIndex(column => column.id === filter.column);
12091
12162
  if (index < 0)
12092
12163
  return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
12164
+ operands?.add(filter.column);
12093
12165
  const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
12094
12166
  const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
12095
12167
  if (column.kind === "number")
@@ -12150,28 +12222,23 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
12150
12222
  return formula;
12151
12223
  }
12152
12224
  const _exports = Object.freeze({ canopyPredicate: canopyPredicate });
12153
- _modules.set("2b0b73e8c376d24e6a5b498c0f710966b00de0eff44f474d7b2aece7af64fa96", _exports);
12225
+ _modules.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c", _exports);
12154
12226
  return _exports;
12155
12227
  })();
12156
12228
 
12157
- const _m100 = _modules.get("eb8cf81d2a340cdb41301d59c667cef44f3ad1d6a19f717eb8137257b545115e") ?? (() => {
12229
+ const _m101 = _modules.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8") ?? (() => {
12158
12230
  const { captureFields } = _m10;
12159
12231
 
12160
- const { canopyPredicate } = _m101;
12232
+ const { canopyPredicate } = _m102;
12233
+
12234
+ const { canopyDefaultTones, canopyTonePalette: palette } = _m100;
12161
12235
 
12162
- // Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
12163
- const palette = {
12164
- info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
12165
- success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
12166
- warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
12167
- danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
12168
- };
12169
12236
  class UnsupportedRule extends Error {
12170
12237
  }
12171
12238
  const unsupported = (message) => { throw new UnsupportedRule(message); };
12172
12239
  /** Compile declarations in source order, then emit native target/aspect priorities.
12173
12240
  * Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
12174
- function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
12241
+ function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes, operands) {
12175
12242
  if (request.formatRules === undefined || format === "csv")
12176
12243
  return [];
12177
12244
  if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
@@ -12210,7 +12277,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
12210
12277
  }
12211
12278
  const priorStops = [];
12212
12279
  const priorRows = [], priorCells = new Map();
12213
- const requiredCells = new Map();
12280
+ const requiredCells = new Map(), emittedOperands = new Set();
12214
12281
  const column = (id) => {
12215
12282
  const index = columns.findIndex(column => column.id === id);
12216
12283
  if (index < 0)
@@ -12228,8 +12295,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
12228
12295
  return value;
12229
12296
  };
12230
12297
  const style = (name) => {
12231
- const defaults = palette[name];
12232
- const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
12298
+ const mapping = tones.get(name) ?? canopyDefaultTones.get(name);
12233
12299
  if (!mapping)
12234
12300
  return unsupported("UNMAPPED_RULE_TONE:" + name);
12235
12301
  if ("alignment" in mapping || "wrapText" in mapping)
@@ -12302,8 +12368,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
12302
12368
  const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
12303
12369
  if (rule.column !== undefined)
12304
12370
  column(rule.column);
12305
- const ruleCells = new Map();
12306
- const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
12371
+ const ruleCells = new Map(), ruleOperands = new Set();
12372
+ const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells, ruleOperands);
12307
12373
  const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
12308
12374
  const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
12309
12375
  const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
@@ -12315,6 +12381,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
12315
12381
  priorCells.set(rule.column, previous);
12316
12382
  for (const [column, type] of ruleCells)
12317
12383
  requiredCells.set(column, type);
12384
+ for (const id of ruleOperands)
12385
+ emittedOperands.add(id);
12318
12386
  // A matched declaration still stops the row when an earlier tone on that target already won.
12319
12387
  if (rule.stopIfTrue)
12320
12388
  priorStops.push(ownPredicate);
@@ -12330,15 +12398,18 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
12330
12398
  }
12331
12399
  for (const [column, type] of requiredCells)
12332
12400
  cellTypes?.set(column, type);
12401
+ // Only emitted rules read raw cells; a rejected comparison leaves its column free to carry badge labels.
12402
+ for (const id of emittedOperands)
12403
+ operands?.add(id);
12333
12404
  // Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
12334
12405
  return Object.freeze([...visuals, ...cells, ...rows]);
12335
12406
  }
12336
12407
  const _exports = Object.freeze({ canopyRules: canopyRules });
12337
- _modules.set("eb8cf81d2a340cdb41301d59c667cef44f3ad1d6a19f717eb8137257b545115e", _exports);
12408
+ _modules.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8", _exports);
12338
12409
  return _exports;
12339
12410
  })();
12340
12411
 
12341
- const _m102 = _modules.get("97b7bd3037e8060328387470a7e471b6933f1fa062e9562c7908f8ea9a29044b") ?? (() => {
12412
+ const _m103 = _modules.get("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014") ?? (() => {
12342
12413
  const { createGroupedReport } = _m8;
12343
12414
 
12344
12415
  const { checkAbort } = _m4;
@@ -12544,11 +12615,11 @@ function canopyGrouped(source, request, options, limits, report, format) {
12544
12615
  ...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
12545
12616
  }
12546
12617
  const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
12547
- _modules.set("97b7bd3037e8060328387470a7e471b6933f1fa062e9562c7908f8ea9a29044b", _exports);
12618
+ _modules.set("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014", _exports);
12548
12619
  return _exports;
12549
12620
  })();
12550
12621
 
12551
- const _m103 = _modules.get("9ee68b08aff01ebcd88790854ac27b71235c5df5cab4a9575ffcf267e8fea5ea") ?? (() => {
12622
+ const _m104 = _modules.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8") ?? (() => {
12552
12623
  const { cellText } = _m35;
12553
12624
 
12554
12625
  const { cleanXml } = _m28;
@@ -12557,7 +12628,7 @@ const { cleanXml } = _m28;
12557
12628
  function canopyAbout(request, options) {
12558
12629
  const result = [["revision", request.revision], ["recordCount", request.recordCount === null ? "unknown" : request.recordCount]];
12559
12630
  if (request.scope !== undefined) {
12560
- if (!["filtered", "selected", "all"].includes(request.scope))
12631
+ if (!["filtered", "visible", "selected", "all"].includes(request.scope))
12561
12632
  throw new TypeError("Invalid Canopy export scope.");
12562
12633
  result.push(["scope", request.scope]);
12563
12634
  }
@@ -12603,11 +12674,11 @@ function canopyAbout(request, options) {
12603
12674
  return Object.freeze(result.map(row => Object.freeze(row)));
12604
12675
  }
12605
12676
  const _exports = Object.freeze({ canopyAbout: canopyAbout });
12606
- _modules.set("9ee68b08aff01ebcd88790854ac27b71235c5df5cab4a9575ffcf267e8fea5ea", _exports);
12677
+ _modules.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8", _exports);
12607
12678
  return _exports;
12608
12679
  })();
12609
12680
 
12610
- const _m104 = _modules.get("ccfefc97a47cc288f2c9a2eed33fff323570e35193cedbd876ebb3e8fb78a42e") ?? (() => {
12681
+ const _m105 = _modules.get("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca") ?? (() => {
12611
12682
  const { Workbook, addGroupedXlsx } = _m23;
12612
12683
 
12613
12684
  const { portableWorkbook } = _m53;
@@ -12664,13 +12735,15 @@ async function writeCanopyWorkbook(source, grouped, destination, options, labels
12664
12735
  });
12665
12736
  }
12666
12737
  const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
12667
- _modules.set("ccfefc97a47cc288f2c9a2eed33fff323570e35193cedbd876ebb3e8fb78a42e", _exports);
12738
+ _modules.set("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca", _exports);
12668
12739
  return _exports;
12669
12740
  })();
12670
12741
 
12671
- const _m106 = _modules.get("a0c020124a53cd7be15e3d53388b8393c981c3abc0f8d4aee76a442a2458457f") ?? (() => {
12742
+ const _m107 = _modules.get("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d") ?? (() => {
12672
12743
  const { ExportCell } = _m1;
12673
12744
 
12745
+ const { canopyBadgeSplit } = _m96;
12746
+
12674
12747
  /** Fixed numeric formats affect PDF text, not the frozen numeric value used by other writers. */
12675
12748
  function numericProfile(format) {
12676
12749
  // No declared precision: whole values (including counts) stay whole.
@@ -12718,11 +12791,11 @@ function documentDecimal(sample, columns) {
12718
12791
  const profile = numericProfile(cell.presentation?.numberFormat ?? column.format);
12719
12792
  if (!profile)
12720
12793
  continue;
12721
- const captured = capturedNumber(cell.text ?? "", profile);
12794
+ const label = canopyBadgeSplit(cell).text, captured = capturedNumber(label, profile);
12722
12795
  if (!captured)
12723
12796
  continue;
12724
12797
  // A literal percent label is a culture signal without requesting numeric scaling.
12725
- const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || (cell.text ?? "").includes("%");
12798
+ const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || label.includes("%");
12726
12799
  if (percentageSignal !== percent)
12727
12800
  continue;
12728
12801
  const match = /([.,])(\d+)$/.exec(captured.number.trimEnd());
@@ -12749,10 +12822,12 @@ function canopyPdfNumbers(sample, columns) {
12749
12822
  return value;
12750
12823
  const format = value.presentation?.numberFormat ?? columns[index].format;
12751
12824
  let profile = numericProfile(format);
12752
- if (!profile || value.text === "")
12825
+ // Badge labels are not part of the number: format the captured label alone, then append them unchanged.
12826
+ const { text: label, suffix: badges } = canopyBadgeSplit(value);
12827
+ if (!profile || label === "")
12753
12828
  return value;
12754
- const captured = capturedNumber(value.text ?? "", profile);
12755
- if (value.text && !captured)
12829
+ const captured = capturedNumber(label, profile);
12830
+ if (label && !captured)
12756
12831
  return value;
12757
12832
  // Undeclared formats normalize only plain numeric labels; a decoration
12758
12833
  // alone does not declare how the raw value was transformed for display.
@@ -12784,16 +12859,16 @@ function canopyPdfNumbers(sample, columns) {
12784
12859
  let suffix = captured?.suffix || profile.suffix;
12785
12860
  if (profile.percent && !profile.suffix)
12786
12861
  suffix = suffix.replace(/%/g, "");
12787
- return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix,
12862
+ return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix + badges,
12788
12863
  ...(value.presentation ? { presentation: value.presentation } : {}), ...(value.link ? { link: value.link } : {}) });
12789
12864
  });
12790
12865
  }
12791
12866
  const _exports = Object.freeze({ canopyPdfNumbers: canopyPdfNumbers });
12792
- _modules.set("a0c020124a53cd7be15e3d53388b8393c981c3abc0f8d4aee76a442a2458457f", _exports);
12867
+ _modules.set("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d", _exports);
12793
12868
  return _exports;
12794
12869
  })();
12795
12870
 
12796
- const _m105 = _modules.get("dab3e04542b3619c5c937162b41068f7cb1c3021b4620987c0fb95d4bd98d8e2") ?? (() => {
12871
+ const _m106 = _modules.get("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30") ?? (() => {
12797
12872
  const { ExportCell, NotSupportedError, OfficeIMOError } = _m1;
12798
12873
 
12799
12874
  const { inputRows, checkAbort, pause, taskYieldDue } = _m4;
@@ -12804,7 +12879,7 @@ const { resolveScalar, selectFont, validateFonts } = _m68;
12804
12879
 
12805
12880
  const { settings } = _m17;
12806
12881
 
12807
- const { canopyPdfNumbers } = _m106;
12882
+ const { canopyPdfNumbers } = _m107;
12808
12883
 
12809
12884
  /** A bounded lookahead is replayed once; no second capture, full-dataset copy or smaller font is needed. */
12810
12885
  async function withCanopyPdfLayout(source, captured, options, write) {
@@ -12898,11 +12973,11 @@ async function withCanopyPdfLayout(source, captured, options, write) {
12898
12973
  }
12899
12974
  }
12900
12975
  const _exports = Object.freeze({ withCanopyPdfLayout: withCanopyPdfLayout });
12901
- _modules.set("dab3e04542b3619c5c937162b41068f7cb1c3021b4620987c0fb95d4bd98d8e2", _exports);
12976
+ _modules.set("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30", _exports);
12902
12977
  return _exports;
12903
12978
  })();
12904
12979
 
12905
- const _m0 = _modules.get("1f0435c9bc6e437b986c72df8ed33a7636aea9e87db25a98bdb2a48a43985e5d") ?? (() => {
12980
+ const _m0 = _modules.get("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027") ?? (() => {
12906
12981
  const { BlobByteSink, ExportCell } = _m1;
12907
12982
 
12908
12983
  const { notifyProgress } = _m14;
@@ -12923,15 +12998,15 @@ const { prepareCanopyExport } = _m96;
12923
12998
 
12924
12999
  const { canopyPins } = _m99;
12925
13000
 
12926
- const { canopyRules } = _m100;
13001
+ const { canopyRules } = _m101;
12927
13002
 
12928
- const { canopyGrouped } = _m102;
13003
+ const { canopyGrouped } = _m103;
12929
13004
 
12930
- const { canopyAbout } = _m103;
13005
+ const { canopyAbout } = _m104;
12931
13006
 
12932
- const { writeCanopyWorkbook } = _m104;
13007
+ const { writeCanopyWorkbook } = _m105;
12933
13008
 
12934
- const { withCanopyPdfLayout } = _m105;
13009
+ const { withCanopyPdfLayout } = _m106;
12935
13010
 
12936
13011
 
12937
13012
 
@@ -12939,6 +13014,7 @@ const { withCanopyPdfLayout } = _m105;
12939
13014
 
12940
13015
 
12941
13016
 
13017
+ const canopyHeaderFill = "E7EDF5", canopyHeaderBorder = Object.freeze({ bottom: Object.freeze({ style: "thin", color: "A6B4C8" }) });
12942
13018
  /** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
12943
13019
  async function writeCanopyTo(capture, format, destination, options = {}) {
12944
13020
  const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
@@ -12978,13 +13054,14 @@ async function writeCanopyTo(capture, format, destination, options = {}) {
12978
13054
  const stream = { ...(signal ? { signal } : {}), ...progress };
12979
13055
  if (format === "xlsx") {
12980
13056
  const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = pivot ? undefined : canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
12981
- const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
13057
+ const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes, prepared.ruleOperands);
12982
13058
  if (pivot && (xlsx.sheet?.rowOutline !== undefined || xlsx.sheet?.columnOutlines !== undefined || xlsx.sheet?.maxOutlineLevel !== undefined ||
12983
13059
  xlsx.sheet?.outlineSummaryBelow !== undefined || xlsx.sheet?.outlineSummaryRight !== undefined || xlsx.sheet?.table !== undefined || xlsx.sheet?.footer !== undefined))
12984
13060
  throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");
12985
13061
  if (pivot && xlsx.cellValueWriters !== undefined)
12986
13062
  throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");
12987
- const sheet = { ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
13063
+ // The header matches the PDF table heading: shaded, bold, wrapped and ruled off from the data.
13064
+ const sheet = { headerFill: canopyHeaderFill, headerBorder: canopyHeaderBorder, headerWrap: true, ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
12988
13065
  freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
12989
13066
  freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
12990
13067
  conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
@@ -13041,7 +13118,7 @@ async function exportCanopy(capture, format, options = {}) {
13041
13118
  }
13042
13119
  }
13043
13120
  const _exports = Object.freeze({ createCanopyExport: _m96.createCanopyExport, ExportCell: _m5.ExportCell, PdfFont: _m64.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
13044
- _modules.set("1f0435c9bc6e437b986c72df8ed33a7636aea9e87db25a98bdb2a48a43985e5d", _exports);
13121
+ _modules.set("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027", _exports);
13045
13122
  return _exports;
13046
13123
  })();
13047
13124
  Object.assign(officeimo, _m0);