@evotecit/officeimo 0.1.21 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -8
- package/bundles/officeimo-canopyx-adapter.js +56 -36
- package/bundles/officeimo-canopyx-adapter.min.js +1 -1
- package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
- package/bundles/officeimo-canopyx-adapter.mjs +42 -22
- package/bundles/officeimo-canopyx.js +420 -177
- package/bundles/officeimo-canopyx.min.js +1 -1
- package/bundles/officeimo-canopyx.min.mjs +1 -1
- package/bundles/officeimo-canopyx.mjs +346 -103
- package/bundles/officeimo-chartforgex-adapter.js +1924 -0
- package/bundles/officeimo-chartforgex-adapter.min.js +2 -0
- package/bundles/officeimo-chartforgex-adapter.min.mjs +2 -0
- package/bundles/officeimo-chartforgex-adapter.mjs +1910 -0
- package/bundles/officeimo-chartforgex.js +13594 -0
- package/bundles/officeimo-chartforgex.min.js +2 -0
- package/bundles/officeimo-chartforgex.min.mjs +2 -0
- package/bundles/officeimo-chartforgex.mjs +13487 -0
- package/bundles/officeimo-csv.js +12 -7
- package/bundles/officeimo-csv.min.js +1 -1
- package/bundles/officeimo-csv.min.mjs +1 -1
- package/bundles/officeimo-csv.mjs +8 -3
- package/bundles/officeimo-datatables-adapter.js +11 -11
- package/bundles/officeimo-datatables-adapter.min.js +1 -1
- package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
- package/bundles/officeimo-datatables-adapter.mjs +7 -7
- package/bundles/officeimo-datatables.js +375 -152
- package/bundles/officeimo-datatables.min.js +1 -1
- package/bundles/officeimo-datatables.min.mjs +1 -1
- package/bundles/officeimo-datatables.mjs +311 -88
- package/bundles/officeimo-execution.js +14 -9
- package/bundles/officeimo-execution.min.js +1 -1
- package/bundles/officeimo-execution.min.mjs +1 -1
- package/bundles/officeimo-execution.mjs +8 -3
- package/bundles/officeimo-pdf.js +286 -120
- package/bundles/officeimo-pdf.min.js +1 -1
- package/bundles/officeimo-pdf.min.mjs +1 -1
- package/bundles/officeimo-pdf.mjs +244 -78
- package/bundles/officeimo-xlsx.js +93 -31
- package/bundles/officeimo-xlsx.min.js +1 -1
- package/bundles/officeimo-xlsx.min.mjs +1 -1
- package/bundles/officeimo-xlsx.mjs +75 -13
- package/bundles/officeimo.js +373 -150
- package/bundles/officeimo.min.js +1 -1
- package/bundles/officeimo.min.mjs +1 -1
- package/bundles/officeimo.mjs +312 -89
- package/dist/core/progress.js +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/integrations/canopyx/index.js +9 -2
- package/dist/integrations/canopyx/source.js +26 -13
- package/dist/integrations/chartforgex/capture.d.ts +31 -0
- package/dist/integrations/chartforgex/capture.js +103 -0
- package/dist/integrations/chartforgex/index.d.ts +13 -0
- package/dist/integrations/chartforgex/index.js +88 -0
- package/dist/integrations/chartforgex/svg-drawing.d.ts +5 -0
- package/dist/integrations/chartforgex/svg-drawing.js +775 -0
- package/dist/integrations/chartforgex/svg-geometry.d.ts +23 -0
- package/dist/integrations/chartforgex/svg-geometry.js +304 -0
- package/dist/integrations/chartforgex/svg-image.d.ts +9 -0
- package/dist/integrations/chartforgex/svg-image.js +46 -0
- package/dist/integrations/chartforgex/svg-markup.d.ts +10 -0
- package/dist/integrations/chartforgex/svg-markup.js +124 -0
- package/dist/integrations/chartforgex/svg-paint.d.ts +16 -0
- package/dist/integrations/chartforgex/svg-paint.js +146 -0
- package/dist/integrations/chartforgex/types.d.ts +77 -0
- package/dist/integrations/chartforgex/types.js +1 -0
- package/dist/integrations/chartforgex/winansi.d.ts +4 -0
- package/dist/integrations/chartforgex/winansi.js +48 -0
- package/dist/integrations/chartforgex/workbook.d.ts +12 -0
- package/dist/integrations/chartforgex/workbook.js +137 -0
- package/dist/pdf/document-drawings.d.ts +1 -1
- package/dist/pdf/document-drawings.js +91 -17
- package/dist/pdf/document-images.d.ts +7 -1
- package/dist/pdf/document-images.js +59 -24
- package/dist/pdf/document-types.d.ts +3 -1
- package/dist/pdf/document.d.ts +2 -2
- package/dist/pdf/document.js +3 -1
- package/dist/pdf/drawing-types.d.ts +37 -10
- package/dist/pdf/font-resources.d.ts +1 -1
- package/dist/pdf/font-resources.js +6 -3
- package/dist/pdf/index.d.ts +1 -1
- package/dist/pdf/pages.js +15 -0
- package/dist/pdf/png.d.ts +11 -2
- package/dist/pdf/png.js +50 -23
- package/dist/pdf/session.js +3 -2
- package/dist/pdf/settings.d.ts +2 -2
- package/dist/pdf/settings.js +7 -3
- package/dist/xlsx/options.js +1 -1
- package/dist/xlsx/types.d.ts +8 -0
- package/dist/xlsx/workbook.js +6 -0
- package/dist/xlsx/worksheet.d.ts +13 -1
- package/dist/xlsx/worksheet.js +60 -9
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -196,9 +196,9 @@ const blob = await exportCanopy(capture, "xlsx", {
|
|
|
196
196
|
| Numeric format intent | Fraction digits from 0 through 10 and literal prefixes/suffixes become invariant Excel formats; text such as `Usage %` does not change a raw value of 17 into a percentage |
|
|
197
197
|
| Standard row and cell tones | `info`, `success`, `warning` and `danger` get a pale fill with a dark font (`DDEBF7`/`1F4E78`, `E2F0D9`/`375623`, `FFF2CC`/`7F5000`, `FFC7CE`/`9C0006`, each at least 4.5:1 contrast); `muted` gets a grey `595959` font. Applies to XLSX cells and PDF cells; an entry in `tones` replaces that tone's default |
|
|
198
198
|
| Canonical neutral tone | No override unless explicitly mapped in `tones`; cell styles override overlapping row-style properties |
|
|
199
|
-
| Badges, custom classes and host renderers | Exported as the captured value or text. Badge labels in `cell.badges` are appended to the cell's display text, for example `Alice · Disabled · Stale`, and a badged text cell exports that label. Typed number and date columns, and text columns read by an emitted native rule, keep their raw value and show badges in the text only (PDF). Each reports a `badges`, `custom-class` or `custom-renderer` diagnostic without failing the export |
|
|
199
|
+
| Badges, custom classes and host renderers | Exported as the captured value or text. Badge labels in `cell.badges` are appended to the cell's display text, for example `Alice · Disabled · Stale`, and a badged text cell exports that label. Typed number and date columns, and text columns read by an emitted native rule, keep their raw value and show badges in the text only (PDF). Each reports a `badges`, `custom-class` or `custom-renderer` diagnostic without failing the export. A cell keeps its first 64 badge labels, and only as many as fit in 32,767 characters with its text; `BADGES_TRUNCATED:<count>` reports how many were left out |
|
|
200
200
|
| XLSX header row | Bold, wrapped, filled `E7EDF5` with a thin bottom rule, matching the PDF heading; `xlsx.sheet.headerFill`, `headerBorder` and `headerWrap` override it |
|
|
201
|
-
| Safe resolved links | Native XLSX relationships and PDF annotations; a hidden source URL column is not required |
|
|
201
|
+
| Safe resolved links | Native XLSX relationships and PDF annotations; a hidden source URL column is not required. Excel allows 65,530 hyperlinks per worksheet. The adapter sets XLSX `hyperlinkOverflow: "drop"`: configured, heading, footer and text-preservation links are always kept, later data cells keep their label without the link, and one `LINKS_TRUNCATED:<count>` diagnostic per worksheet reports how many were dropped. Links left out are still validated |
|
|
202
202
|
| Relative navigation links | Text columns export the captured visible label, including null-valued links, without inventing an absolute URL; raw numeric and datetime columns retain their typed-value policy |
|
|
203
203
|
| History series | Raw captures export the captured latest scalar, or an empty value when none exists; display captures export the rendered cell text. No sparkline or historical-series reconstruction |
|
|
204
204
|
| Unknown row and cell tones | Preserves status text and typed values without inventing a style and reports `UNMAPPED_TONE`; explicit `tones` mappings still apply |
|
|
@@ -240,6 +240,34 @@ Captured group identity is checked against the original raw scalar before relati
|
|
|
240
240
|
|
|
241
241
|
`createCanopyExport(capture, format, options)` remains the flat source API: frozen columns, `rowCount` and fresh `rows()` enumerations. Full adapter writers add captured grouping, native rules and optional metadata. Each enumeration passes its cancellation signal into CanopyX's page requests. A live grid remains page-owned; worker hosts own and release their bounded capture/row bridge. CanopyX may retain identity/cursor bookkeeping, so streamed output does not imply constant memory for the source itself.
|
|
242
242
|
|
|
243
|
+
## ChartForgeX chart exports
|
|
244
|
+
|
|
245
|
+
`exportChartForgeX(capture, "xlsx" | "pdf", options)` turns a chart capture from the ChartForgeX browser runtime into a typed workbook of the chart's series, or a PDF with the chart's title, description and SVG as vector paths and text. It runs offline: no server, browser layout or chart runtime is involved. `writeChartForgeXTo` writes to a caller-owned destination.
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
import { exportChartForgeX, type ChartForgeXCapture } from "@evotecit/officeimo/integrations/chartforgex";
|
|
249
|
+
|
|
250
|
+
const capture = {
|
|
251
|
+
version: 1, title: "Sign-ins", description: "Weekly sign-ins by method.",
|
|
252
|
+
x: { kind: "date", title: "Week" }, y: { title: "Sign-ins", unit: "count", format: "#,##0" },
|
|
253
|
+
series: [
|
|
254
|
+
{ id: "passkey", name: "Passkey", points: [{ x: "2026-01-05", xCaption: "W1", y: 120, caption: "120" }] },
|
|
255
|
+
{ id: "password", name: "Password", format: "0.0", points: [{ x: "2026-01-05", y: 300.5 }] }
|
|
256
|
+
],
|
|
257
|
+
svg: serializedChartSvg
|
|
258
|
+
} satisfies ChartForgeXCapture;
|
|
259
|
+
const excel = await exportChartForgeX(capture, "xlsx");
|
|
260
|
+
const pdf = await exportChartForgeX(capture, "pdf", { onDiagnostic: d => console.info(d.code) });
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`x.kind` types the x values: `date` takes ISO 8601 strings or `Date` values (a string without an offset is a UTC wall-clock time, which is how ChartForgeX serializes time axes), `number` takes finite numbers and `category` takes labels. `y` values are finite numbers or `null`. `xCaption` and `caption` are the texts the chart displays. Axis and series `format` values are native Excel number formats. Dates default to `yyyy-mm-dd` and add time, seconds or milliseconds when the data has them.
|
|
264
|
+
|
|
265
|
+
The workbook has one sheet, `Chart data` by default (`xlsx.sheetName`), with the title above the headings and the title and description in the document properties. With `layout: "wide"` there is a row per x value and a column per series, in series order. Rows follow ascending dates and numbers, and categories keep their first-seen order. `layout: "long"` has a row per point with `Series`, `Series ID`, x and value columns. The default `auto` uses long layout when an x value is missing, a series repeats an x value, or series give the same x different display captions. Display columns, headed `<name> (display)`, preserve captions alongside the typed cells. Units appear in value headings or in a `Unit` column when long-layout rows use different units. A repeated series name gets its ID in brackets.
|
|
266
|
+
|
|
267
|
+
The PDF puts the title on the first page and in the document information, the description as a paragraph, and the chart as a centred drawing whose figure alternative is the description (or title). It is landscape when the chart is wider than tall. The SVG must carry resolved paint inline, as style declarations or presentation attributes; stylesheets and classes are not evaluated. ChartForgeX's own SVG export produces this. The converter reads shapes, path data (arcs and quadratic curves become cubic curves), transforms, nested `svg` viewports, `use` and `symbol`, rectangular `clipPath`s, unprofiled PNG and JPEG `image`s from base64 `data:` URLs, dashes, text with `tspan` lines, anchors and rotation, and colours in hex, named, `rgb()`, `hsl()`, `oklab()`, `oklch()` and `color(srgb …)` forms. Effects without a vector equivalent are skipped and reported once per code through `onDiagnostic`: translucency and gradients are flattened over white (`OPACITY_FLATTENED`, `GRADIENT_FLATTENED`), and filters, masks, markers, pattern fills, non-rectangular clips and text paths are left out, as are images that are external, SVG, rotated, mirrored or in an unsupported color profile (`IMAGE_SKIPPED`). Images keep their opacity, and each distinct image is embedded once however often the chart repeats it, as pictorial charts do. `unsupported: "reject"` fails instead. Without `pdf.fonts`, text uses the standard Helvetica faces: typographic minus and spaces become ASCII, and other Latin letters outside WinAnsi lose their diacritics (`Łódź` becomes `Lódz`) and anything else becomes `?`, reported as `TEXT_SUBSTITUTED`. Supply `pdf.fonts.regular` (and the emphasis faces the chart uses) to keep Unicode text: the PDF then embeds a subset of that TrueType font with a Unicode map, so the text copies and searches with its accents intact. Decomposed accents are composed when possible. In a classic page, `new OfficeIMO.PdfFont(new Uint8Array(await response.arrayBuffer()))` prepares a font the host has fetched or bundled. `chartForgeXDrawing(svg)` returns a version 1 [portable drawing](#portable-drawings) for composing into a larger document. `chartForgeXDrawing(svg, 2)` returns a version 2 drawing with images.
|
|
268
|
+
|
|
269
|
+
In a classic page, load `officeimo.min.js` and then `officeimo-chartforgex-adapter.min.js`; they add `OfficeIMO.exportChartForgeX`, which the ChartForgeX chart menu looks for to offer Excel and PDF downloads.
|
|
270
|
+
|
|
243
271
|
## PDF tables
|
|
244
272
|
|
|
245
273
|
`writePdf` and `writePdfTo` use the same `Column<T>` projection and `ExportCell` values as Excel and CSV. The PDF owner lays out and writes one page at a time, repeats grouped headings, splits oversized data rows across pages and appends a table footer. `writePdfTo` awaits the destination and retains page references, font mappings and the current page rather than the complete report body. Blob mode also retains the finished file.
|
|
@@ -512,11 +540,11 @@ const report = await writePdfDocument([
|
|
|
512
540
|
], { tagged: { language: "en-US" } });
|
|
513
541
|
```
|
|
514
542
|
|
|
515
|
-
Version 1 accepts `path`, `text` and `group` elements
|
|
543
|
+
Version 1 accepts `path`, `text` and `group` elements. Version 2 adds `image` elements, including inside groups. In TypeScript, use `PdfDrawing<2>` and `PdfDrawingBlock<2>` for version 2 drawings. Paths use the existing `move`, `line`, `cubic` and `close` commands, RGB fills/strokes, positive `strokeWidth`, `fillRule`, `lineCap: "butt" | "round" | "square"`, and `lineJoin: "miter" | "round" | "bevel"`, and an optional stroke `dash` (1 through 16 nonnegative lengths in points, at least one positive) with `dashOffset`. Set `miterLimit` to override the default of 10. Image elements place an unprofiled PNG, JPEG or raw RGB(A) `image` (the same values an image block takes) over the rectangle `x`, `y`, `width`, `height`, with an optional constant `opacity` from 0 through 1. Every placement of the same image object shares one embedded image, and its bytes count toward `maxImageBytes`. Groups contain ordered `elements` and an optional rectangular `clip`. Every drawing is also clipped to its own bounds. Coordinates use points from the top left. Finite values from -1,000,000 through 1,000,000 allow geometry to extend beyond a clip. Drawing dimensions are positive and at most 14,400 points. Rectangular clip dimensions may reach 1,000,000 points.
|
|
516
544
|
|
|
517
|
-
Text elements declare `text`, `x`, `y`, `font`, `fontSize` and RGB `color`; `y` is the baseline. The font slot is `regular`, `bold`, `italic` or `boldItalic`, and that exact embedded static TrueType face must be supplied in the document's `fonts`. Use the same licensed static family in the .NET producer and the JavaScript writer. Missing faces and synthetic emphasis are rejected. Text stays at its authored position without wrapping or shaping; line breaks, control characters, unsupported scripts and missing glyphs fail explicitly under the existing scalar-text rules.
|
|
545
|
+
Text elements declare `text`, `x`, `y`, `font`, `fontSize` and RGB `color`; `y` is the baseline. The font slot is `regular`, `bold`, `italic` or `boldItalic`, and that exact embedded static TrueType face must be supplied in the document's `fonts`. Use the same licensed static family in the .NET producer and the JavaScript writer. Missing faces and synthetic emphasis are rejected, unless the drawing sets `standardFonts: true`: then a slot the document supplies no face for uses the standard Helvetica face, which covers WinAnsi characters only. Optional `anchor: "start" | "middle" | "end"` places the measured run's start, middle or end at `x`, and `rotation` turns the baseline clockwise by degrees (-360 through 360) about that point, for example `-90` for a vertical axis title. Text stays at its authored position without wrapping or shaping; line breaks, control characters, unsupported scripts and missing glyphs fail explicitly under the existing scalar-text rules.
|
|
518
546
|
|
|
519
|
-
The wire format rejects unknown properties, versions, commands and element kinds. It does not parse SVG/CSS or load fonts and external resources. `maxDrawingElements` (default 100,000) counts paths, text and groups across drawing blocks; nesting is limited to 32 element levels. Drawing path commands share `maxVectorCommands` with vector blocks. Text shares cell/character budgets with the rest of the document. Serialized drawing content obeys `maxPageBytes`, and preflight and serialization cooperate with cancellation. Keep the supplied drawing stable until its block is consumed.
|
|
547
|
+
The wire format rejects unknown properties, versions, commands and element kinds. It does not parse SVG/CSS or load fonts and external resources; the [ChartForgeX integration](#chartforgex-chart-exports) converts chart SVG into this format. `maxDrawingElements` (default 100,000) counts paths, text, images and groups across drawing blocks; nesting is limited to 32 element levels. Drawing path commands share `maxVectorCommands` with vector blocks. Text shares cell/character budgets with the rest of the document. Serialized drawing content obeys `maxPageBytes`, and preflight and serialization cooperate with cancellation. Keep the supplied drawing stable until its block is consumed.
|
|
520
548
|
|
|
521
549
|
### Tagged PDF reports
|
|
522
550
|
|
|
@@ -644,6 +672,8 @@ Native XLSX charts add workbook-wide `maxCharts` (100 by default), `maxChartPoin
|
|
|
644
672
|
|
|
645
673
|
XLSX rejects oversized text by default. Set `oversizedText: "preserve"` to write a bounded preview with an internal link to the full value on a `Text overflow` worksheet. Each overflow record identifies the source sheet/cell, one-based part number, text and total part count. Concatenate its `Text` values in part order to reconstruct the complete XML-valid value. Chunks never split a supplementary Unicode character. The same strip/reject policy applies to invalid XML characters. Preserve mode does not replace an existing external link on that cell; that conflict throws.
|
|
646
674
|
|
|
675
|
+
Excel allows 65,530 hyperlinks per worksheet, and XLSX rejects more by default. Set `hyperlinkOverflow: "drop"` to keep every configured, heading, footer and text-preservation link and fill the remaining room with data-cell links in row order. Later data cells keep their value without the link; when a link that cannot be dropped needs room, the latest data-cell link gives way. Every link is still validated. `onHyperlinkOverflow({ sheetName, dropped })` is called synchronously once for each worksheet that dropped links; a callback that returns a promise fails the export.
|
|
676
|
+
|
|
647
677
|
ZIP entries cannot interleave, so preservation retains a bounded text spool until the report worksheets finish. `maxOverflowCharacters` defaults to 4,000,000 UTF-16 units. Width sampling has separate defaults of 100,000 retained cells and 1,000,000 UTF-16 units of encoded row XML, including markup, configurable through `maxBufferedCells` and `maxBufferedCharacters`. Automatic width sampling stops within these budgets; an explicitly requested sample that exceeds them fails visibly. Full cell values are preserved in both cases. CSV retains long text directly and is an alternative when Excel's cell/storage constraints do not suit the data.
|
|
648
678
|
|
|
649
679
|
### Node writable streams
|
|
@@ -1218,17 +1248,18 @@ The archive exports `@evotecit/officeimo/classic.js`, `/xlsx.js`, `/csv.js`, `/p
|
|
|
1218
1248
|
|
|
1219
1249
|
The combined bundle exposes all seven namespaces on global `OfficeIMO` plus the established root helpers. The XLSX bundle exposes `core`, `zip`, `xml`, `opc`, `xlsx`; CSV exposes `core`, `csv`; PDF exposes `core`, `pdf`. Load `officeimo-execution.js` beside the chosen writer to add `executeWorkerExport` and `handleWorkerExports` to `OfficeIMO`. The standalone bundles compose in either order.
|
|
1220
1250
|
|
|
1221
|
-
The DataTables and
|
|
1251
|
+
The DataTables, CanopyX and ChartForgeX integrations also ship as thin adapters that take their document writers from the combined bundle instead of carrying their own copy. A page that uses both integrations, or also calls the writers directly, downloads the writers once:
|
|
1222
1252
|
|
|
1223
1253
|
```html
|
|
1224
1254
|
<script src="officeimo.min.js"></script>
|
|
1225
1255
|
<script src="officeimo-datatables-adapter.min.js"></script>
|
|
1226
1256
|
<script src="officeimo-canopyx-adapter.min.js"></script>
|
|
1257
|
+
<script src="officeimo-chartforgex-adapter.min.js"></script>
|
|
1227
1258
|
```
|
|
1228
1259
|
|
|
1229
|
-
Load `officeimo.js` (or `officeimo.min.js`) from the same build before an adapter script; an adapter loaded alone throws an error that names the missing file. The `officeimo-*-adapter.mjs` modules import the sibling `officeimo.mjs` (and `.min.mjs` the sibling `officeimo.min.mjs`), so serve them from one folder. The single-file `officeimo-datatables.js` and `officeimo-
|
|
1260
|
+
Load `officeimo.js` (or `officeimo.min.js`) from the same build before an adapter script; an adapter loaded alone throws an error that names the missing file. The `officeimo-*-adapter.mjs` modules import the sibling `officeimo.mjs` (and `.min.mjs` the sibling `officeimo.min.mjs`), so serve them from one folder. The single-file `officeimo-datatables.js`, `officeimo-canopyx.js` and `officeimo-chartforgex.js` remain for pages that embed one integration only.
|
|
1230
1261
|
|
|
1231
|
-
Every bundle also has a minified `.min.js`/`.min.mjs` variant. It has the same API. Classic `.min.js` scripts share module and class identities with the readable scripts of the same build, so the two can be mixed on one page. Each `.mjs` file is its own module graph: a `FormulaCell` or `PdfFont` from `officeimo.mjs` is not accepted by a writer from `officeimo.min.mjs`, so ES module consumers use one variant throughout. Keep the readable variant for debugging. The package exports the adapters as `@evotecit/officeimo/datatables-adapter.js` and `/
|
|
1262
|
+
Every bundle also has a minified `.min.js`/`.min.mjs` variant. It has the same API. Classic `.min.js` scripts share module and class identities with the readable scripts of the same build, so the two can be mixed on one page. Each `.mjs` file is its own module graph: a `FormulaCell` or `PdfFont` from `officeimo.mjs` is not accepted by a writer from `officeimo.min.mjs`, so ES module consumers use one variant throughout. Keep the readable variant for debugging. The package exports the adapters as `@evotecit/officeimo/datatables-adapter.js`, `/canopyx-adapter.js` and `/chartforgex-adapter.js`, and every bundle file under `@evotecit/officeimo/bundles/*`. Classic scripts work from `file://` and in host-owned workers without a module loader. ES modules use normal import paths on HTTP(S) and in Node; browser local-file module policy can block `file://` imports.
|
|
1232
1263
|
|
|
1233
1264
|
[OfficeIMO.JavaScript.Assets](../OfficeIMO.JavaScript.Assets/README.md) embeds the same committed TypeScript-built bundles in .NET. Its `JavaScriptAsset` API returns exact content and content-hashed filenames; consuming .NET applications require no Node tooling. Standalone `.mjs` assemblies preserve the asset package's module API. The npm subpaths remain genuine separate `tsc` modules with generated declarations.
|
|
1234
1265
|
|
|
@@ -6,15 +6,15 @@ const cacheKey = Symbol.for("@evotecit/officeimo/modules");
|
|
|
6
6
|
const _modules = officeimo[cacheKey];
|
|
7
7
|
const _core = key => { const value = _modules && _modules.get(key); if (!value) throw new Error("officeimo-canopyx-adapter.js needs officeimo.js or officeimo.min.js from the same OfficeIMO build, loaded first."); return value; };
|
|
8
8
|
const _c0 = _core("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00");
|
|
9
|
-
const _c1 = _core("
|
|
9
|
+
const _c1 = _core("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244");
|
|
10
10
|
const _c2 = _core("50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669");
|
|
11
11
|
const _c3 = _core("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671");
|
|
12
12
|
const _c4 = _core("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208");
|
|
13
|
-
const _c5 = _core("
|
|
14
|
-
const _c6 = _core("
|
|
15
|
-
const _c7 = _core("
|
|
16
|
-
const _c8 = _core("
|
|
17
|
-
const _c9 = _core("
|
|
13
|
+
const _c5 = _core("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02");
|
|
14
|
+
const _c6 = _core("fd70ccda89f27c6b874c8840ac944b3ec723dbdef3dfe7600f7bdb81f4660c96");
|
|
15
|
+
const _c7 = _core("edf1bf5cb6d749de0e6823397df6610a6c1cc88768898c1b4d7083ee96ef6759");
|
|
16
|
+
const _c8 = _core("406ac6c93ee68eae70c6f52a1e6f4c56b84f43cae12576040c766dcc5598a580");
|
|
17
|
+
const _c9 = _core("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca");
|
|
18
18
|
const _c10 = _core("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc");
|
|
19
19
|
const _c11 = _core("732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5");
|
|
20
20
|
const _c12 = _core("e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8");
|
|
@@ -22,11 +22,11 @@ const _c13 = _core("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a
|
|
|
22
22
|
const _c14 = _core("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3");
|
|
23
23
|
const _c15 = _core("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b");
|
|
24
24
|
const _c16 = _core("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585");
|
|
25
|
-
const _c17 = _core("
|
|
25
|
+
const _c17 = _core("d6884428c3e4d15a691ecf2523372a03b32de22a890edfbfc9961f2dc92711c2");
|
|
26
26
|
const _c18 = _core("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b");
|
|
27
27
|
const _c19 = _core("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596");
|
|
28
28
|
const _c20 = _core("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070");
|
|
29
|
-
const _m4 = _modules.get("
|
|
29
|
+
const _m4 = _modules.get("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9") ?? (() => {
|
|
30
30
|
const { captureFields } = _c2;
|
|
31
31
|
|
|
32
32
|
const { ExportBudget } = _c3;
|
|
@@ -67,7 +67,7 @@ function capturePdfOptions(input = {}) {
|
|
|
67
67
|
return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
|
|
68
68
|
}
|
|
69
69
|
const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
|
|
70
|
-
_modules.set("
|
|
70
|
+
_modules.set("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9", _exports);
|
|
71
71
|
return _exports;
|
|
72
72
|
})();
|
|
73
73
|
|
|
@@ -275,7 +275,7 @@ _modules.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac",
|
|
|
275
275
|
return _exports;
|
|
276
276
|
})();
|
|
277
277
|
|
|
278
|
-
const _m13 = _modules.get("
|
|
278
|
+
const _m13 = _modules.get("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7") ?? (() => {
|
|
279
279
|
const { ExportCell, checkAbort, inputRows } = _c0;
|
|
280
280
|
|
|
281
281
|
const { canopyPivot, pivotNumberFormat } = _m14;
|
|
@@ -314,19 +314,29 @@ function canopyIdentityValue(value) {
|
|
|
314
314
|
const original = rawIdentities.get(value);
|
|
315
315
|
return original === undefined ? value.value : original;
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
// Grids accept any number of badges. Exports keep the first labels that stay readable and fit an Excel text cell,
|
|
318
|
+
// and report how many were left out instead of failing the whole document.
|
|
319
|
+
const maximumBadges = 64, maximumCellText = 32767;
|
|
320
|
+
function badgeText(input, text) {
|
|
321
|
+
if (!Array.isArray(input))
|
|
322
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
323
|
+
let labels = "", kept = 0, dropped = 0;
|
|
321
324
|
for (const badge of input) {
|
|
322
|
-
const
|
|
323
|
-
if (typeof
|
|
324
|
-
throw new TypeError("Canopy cell badges must be
|
|
325
|
-
const label =
|
|
326
|
-
if (label)
|
|
327
|
-
|
|
325
|
+
const value = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
|
|
326
|
+
if (typeof value !== "string")
|
|
327
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
328
|
+
const label = value.trim();
|
|
329
|
+
if (!label)
|
|
330
|
+
continue;
|
|
331
|
+
const next = labels ? labels + badgeSeparator + label : label;
|
|
332
|
+
if (kept >= maximumBadges || (text ? text.length + badgeSeparator.length : 0) + next.length > maximumCellText) {
|
|
333
|
+
dropped++;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
labels = next;
|
|
337
|
+
kept++;
|
|
328
338
|
}
|
|
329
|
-
return labels
|
|
339
|
+
return { labels: labels || undefined, dropped };
|
|
330
340
|
}
|
|
331
341
|
/** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
|
|
332
342
|
function createCanopyExport(capture, format, options = {}) {
|
|
@@ -443,11 +453,14 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
443
453
|
// History captures already carry their frozen latest scalar (or null).
|
|
444
454
|
// Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
|
|
445
455
|
const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
|
|
446
|
-
const
|
|
456
|
+
const badged = cell.badges === undefined ? undefined : badgeText(cell.badges, cell.text), badges = badged?.labels;
|
|
457
|
+
if (badged?.dropped)
|
|
458
|
+
fallback({ code: "BADGES_TRUNCATED:" + badged.dropped, rowId: row.id, columnId: spec.id });
|
|
447
459
|
const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
|
|
448
460
|
// Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
|
|
449
461
|
// Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
|
|
450
|
-
|
|
462
|
+
// A cell whose badges were all left out still exports its captured label, as it would with the badges.
|
|
463
|
+
const badgedValue = (!!badges || !!badged?.dropped) && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
|
|
451
464
|
let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
|
|
452
465
|
if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
|
|
453
466
|
value = datetime(value, dateMode, clock);
|
|
@@ -483,7 +496,7 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
483
496
|
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
|
|
484
497
|
}
|
|
485
498
|
const _exports = Object.freeze({ canopyBadgeSplit: canopyBadgeSplit, canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
|
|
486
|
-
_modules.set("
|
|
499
|
+
_modules.set("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7", _exports);
|
|
487
500
|
return _exports;
|
|
488
501
|
})();
|
|
489
502
|
|
|
@@ -790,7 +803,7 @@ _modules.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8",
|
|
|
790
803
|
return _exports;
|
|
791
804
|
})();
|
|
792
805
|
|
|
793
|
-
const _m23 = _modules.get("
|
|
806
|
+
const _m23 = _modules.get("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a") ?? (() => {
|
|
794
807
|
const { createGroupedReport } = _c13;
|
|
795
808
|
|
|
796
809
|
const { checkAbort } = _c14;
|
|
@@ -996,7 +1009,7 @@ function canopyGrouped(source, request, options, limits, report, format) {
|
|
|
996
1009
|
...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
|
|
997
1010
|
}
|
|
998
1011
|
const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
|
|
999
|
-
_modules.set("
|
|
1012
|
+
_modules.set("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a", _exports);
|
|
1000
1013
|
return _exports;
|
|
1001
1014
|
})();
|
|
1002
1015
|
|
|
@@ -1059,7 +1072,7 @@ _modules.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",
|
|
|
1059
1072
|
return _exports;
|
|
1060
1073
|
})();
|
|
1061
1074
|
|
|
1062
|
-
const _m29 = _modules.get("
|
|
1075
|
+
const _m29 = _modules.get("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8") ?? (() => {
|
|
1063
1076
|
const { Workbook, addGroupedXlsx } = _c7;
|
|
1064
1077
|
|
|
1065
1078
|
const { portableWorkbook } = _c17;
|
|
@@ -1116,11 +1129,11 @@ async function writeCanopyWorkbook(source, grouped, destination, options, labels
|
|
|
1116
1129
|
});
|
|
1117
1130
|
}
|
|
1118
1131
|
const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
|
|
1119
|
-
_modules.set("
|
|
1132
|
+
_modules.set("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8", _exports);
|
|
1120
1133
|
return _exports;
|
|
1121
1134
|
})();
|
|
1122
1135
|
|
|
1123
|
-
const _m35 = _modules.get("
|
|
1136
|
+
const _m35 = _modules.get("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d") ?? (() => {
|
|
1124
1137
|
const { ExportCell } = _c0;
|
|
1125
1138
|
|
|
1126
1139
|
const { canopyBadgeSplit } = _m13;
|
|
@@ -1245,11 +1258,11 @@ function canopyPdfNumbers(sample, columns) {
|
|
|
1245
1258
|
});
|
|
1246
1259
|
}
|
|
1247
1260
|
const _exports = Object.freeze({ canopyPdfNumbers: canopyPdfNumbers });
|
|
1248
|
-
_modules.set("
|
|
1261
|
+
_modules.set("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d", _exports);
|
|
1249
1262
|
return _exports;
|
|
1250
1263
|
})();
|
|
1251
1264
|
|
|
1252
|
-
const _m32 = _modules.get("
|
|
1265
|
+
const _m32 = _modules.get("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49") ?? (() => {
|
|
1253
1266
|
const { ExportCell, NotSupportedError, OfficeIMOError } = _c0;
|
|
1254
1267
|
|
|
1255
1268
|
const { inputRows, checkAbort, pause, taskYieldDue } = _c14;
|
|
@@ -1354,14 +1367,14 @@ async function withCanopyPdfLayout(source, captured, options, write) {
|
|
|
1354
1367
|
}
|
|
1355
1368
|
}
|
|
1356
1369
|
const _exports = Object.freeze({ withCanopyPdfLayout: withCanopyPdfLayout });
|
|
1357
|
-
_modules.set("
|
|
1370
|
+
_modules.set("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49", _exports);
|
|
1358
1371
|
return _exports;
|
|
1359
1372
|
})();
|
|
1360
1373
|
|
|
1361
|
-
const _m0 = _modules.get("
|
|
1374
|
+
const _m0 = _modules.get("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54") ?? (() => {
|
|
1362
1375
|
const { BlobByteSink, ExportCell } = _c0;
|
|
1363
1376
|
|
|
1364
|
-
const { notifyProgress } = _c1;
|
|
1377
|
+
const { notifyProgress, notifySynchronously } = _c1;
|
|
1365
1378
|
|
|
1366
1379
|
const { captureFields } = _c2;
|
|
1367
1380
|
|
|
@@ -1446,7 +1459,14 @@ async function writeCanopyTo(capture, format, destination, options = {}) {
|
|
|
1446
1459
|
freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
|
|
1447
1460
|
freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
|
|
1448
1461
|
conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
|
|
1449
|
-
|
|
1462
|
+
// Data-cell links past Excel's per-worksheet limit keep their label; the worksheet reserves every link it cannot drop.
|
|
1463
|
+
const linkFallback = canopyDiagnostics(format, { ...selected, unsupportedPresentation: "text" }), onHyperlinkOverflow = xlsx.onHyperlinkOverflow;
|
|
1464
|
+
const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits,
|
|
1465
|
+
hyperlinkOverflow: xlsx.hyperlinkOverflow ?? "drop",
|
|
1466
|
+
onHyperlinkOverflow: (overflow) => {
|
|
1467
|
+
notifySynchronously("onHyperlinkOverflow", onHyperlinkOverflow, overflow);
|
|
1468
|
+
linkFallback({ code: "LINKS_TRUNCATED:" + overflow.dropped });
|
|
1469
|
+
} };
|
|
1450
1470
|
if (grouped || about)
|
|
1451
1471
|
return writeCanopyWorkbook(source, grouped, destination, settings, capturedLabels, about);
|
|
1452
1472
|
return writeXlsxTo(source.rows(), destination, settings);
|
|
@@ -1499,7 +1519,7 @@ async function exportCanopy(capture, format, options = {}) {
|
|
|
1499
1519
|
}
|
|
1500
1520
|
}
|
|
1501
1521
|
const _exports = Object.freeze({ createCanopyExport: _m13.createCanopyExport, ExportCell: _c11.ExportCell, PdfFont: _c19.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
|
|
1502
|
-
_modules.set("
|
|
1522
|
+
_modules.set("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54", _exports);
|
|
1503
1523
|
return _exports;
|
|
1504
1524
|
})();
|
|
1505
1525
|
Object.assign(officeimo, _m0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by OfficeIMO.JavaScript/scripts/bundles.mjs from tsc output. MIT.
|
|
2
|
-
(function(le){"use strict";const pe=le.OfficeIMO||(le.OfficeIMO={}),X=pe[Symbol.for("@evotecit/officeimo/modules")],$=_=>{const z=X&&X.get(_);if(!z)throw new Error("officeimo-canopyx-adapter.min.js needs officeimo.js or officeimo.min.js from the same OfficeIMO build, loaded first.");return z},de=$("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00"),Ce=$("6cfd3e806439f6301003a2d1699a74fdfa574d935550ab62b97b528728eaee1f"),re=$("50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669"),Oe=$("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671"),_e=$("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208"),me=$("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38"),ve=$("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e"),be=$("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974"),Ae=$("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4"),Ne=$("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe"),Re=$("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc"),ye=$("732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5"),ge=$("e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8"),Pe=$("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0"),he=$("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3"),Se=$("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b"),Ue=$("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585"),Le=$("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba"),Ie=$("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b"),we=$("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596"),ke=$("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070"),De=X.get("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4")??(()=>{const{captureFields:_}=re,{ExportBudget:z}=Oe,{captureCsvOptions:G}=_e,{capturePdfOptions:k,capturePdfLimits:c,pdfLimitFields:o}=me,{captureWorkbookLimits:y,workbookLimitFields:b,workbookOptionFields:f,sheetOptionFields:l}=ve,t=[...new Set([...b,...o])],U=f.filter(A=>A!=="sink");function u(A){return A===void 0?void 0:new z(_(A,t)).limits}function g(A,T){const w={...A};for(const[p,P]of Object.entries(T??{}))P!==void 0&&(w[p]=P);return w}function v(A={}){const T=_(A,[...U,"sheet"]),w=T.sheet&&_(T.sheet,[...l,"name"]),p=w?.footer&&_(w.footer,["rows","values","totals","style"]);return{...T,...w===void 0?{}:{sheet:{...w,...p===void 0?{}:{footer:p}}},...T.limits===void 0?{}:{limits:y(T.limits)}}}function D(A={}){const T=G(A);return{...T,...T.limits===void 0?{}:{limits:new z(T.limits).limits}}}function O(A={}){const T=k(A);return{...T,...T.limits===void 0?{}:{limits:c(T.limits)}}}const R=Object.freeze({captureCommonLimits:u,mergeAdapterLimits:g,captureXlsxOptions:v,captureCsvOptions:D,capturePdfOptions:O});return X.set("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4",R),R})(),Te=X.get("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8")??(()=>{function _(G,k){const c=k.unsupportedPresentation??(G==="csv"?"text":"reject"),o=k.onDiagnostic;if(c!=="reject"&&c!=="text")throw new TypeError("unsupportedPresentation must be reject or text.");if(o!==void 0&&typeof o!="function")throw new TypeError("onDiagnostic must be a synchronous function.");return y=>{if(c==="reject")throw new TypeError("Unsupported Canopy presentation: "+y.code+(y.columnId?" ("+y.columnId+")":""));const b=o?.(Object.freeze(y));if(b&&typeof b.then=="function")throw Promise.resolve(b).catch(()=>{}),new TypeError("onDiagnostic must be synchronous.")}}const z=Object.freeze({canopyDiagnostics:_});return X.set("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8",z),z})(),Fe=X.get("5e0a9bdc75106268fcdff0cc6d7778080db216c7597514163f5fe5ff8ce93be1")??(()=>{function _(c,o){const{axisKey:y,outlineLevel:b,summary:f,grandTotal:l,hidden:t,collapsed:U}=c;if(typeof y!="string"||!o.has(y)||!Number.isInteger(b)||b<0||b>7||[f,l,t,U].some(u=>typeof u!="boolean"))throw new TypeError("Invalid frozen Canopy pivot axis presentation.");return Object.freeze({level:b,hidden:t,collapsed:U})}function z(c){if(c.pivot===void 0)return;const o=c.pivot;if(!o||typeof o!="object"||c.grouping!==void 0||!Array.isArray(c.columns)||c.scope!=="filtered"||!Number.isSafeInteger(c.recordCount)||c.recordCount<0||!o.definition||!Array.isArray(o.definition.rows)||o.definition.rows.length>4||!Array.isArray(o.definition.columns)||o.definition.columns.length>2||!Array.isArray(o.definition.values)||!o.definition.values.length||o.definition.values.length>32||o.definition.values.some(u=>typeof u!="string")||!Number.isSafeInteger(o.distinctColumns)||o.distinctColumns<0||typeof o.columnsLimited!="boolean"||!Array.isArray(o.retainedColumns)||!Array.isArray(o.columnGroups))throw new TypeError("Invalid explicit Canopy pivot descriptor.");const y=u=>{if(!Array.isArray(u)||u.length>100001)throw new TypeError("Pivot axes require bounded accepted identities.");const g=new Set;for(const v of u){if(!v||typeof v.key!="string"||!v.key||g.has(v.key)||!Array.isArray(v.path)||typeof v.other!="boolean")throw new TypeError("Invalid or duplicate Canopy pivot axis identity.");g.add(v.key)}for(const v of u)if(v.parent!==void 0&&!g.has(v.parent))throw new TypeError("Unknown Canopy pivot parent identity.");return g},b=y(o.rowAxis),f=y(o.columnAxis),l=c.columns.map((u,g)=>{if(g===0&&u.axisKey===void 0&&u.kind==="text")return Object.freeze({...u});const v=_(u,f);return Object.freeze({...u,outlineLevel:v.level,hidden:v.hidden,collapsed:v.collapsed})});if(o.columnGroups.length>l.length)throw new RangeError("Pivot column group count exceeds projected columns.");for(const u of o.columnGroups)if(!u||!f.has(u.key)||!Number.isSafeInteger(u.firstColumn)||u.firstColumn<0||!Number.isSafeInteger(u.columnCount)||u.columnCount<1||u.firstColumn+u.columnCount>l.length||!Number.isInteger(u.depth)||u.depth<1||u.depth>7||typeof u.hidden!="boolean"||typeof u.collapsed!="boolean")throw new TypeError("Invalid Canopy pivot column range.");let t;const U=Object.freeze({outlineSummaryBelow:!1,outlineSummaryRight:!1,maxOutlineLevel:7,rowOutline:()=>t,columnOutlines:Object.freeze(l.flatMap((u,g)=>u.axisKey===void 0?[]:[Object.freeze({firstColumn:g,columnCount:1,level:u.outlineLevel,hidden:u.hidden,collapsed:u.collapsed})]))});return Object.freeze({columns:Object.freeze(l),sheet:U,observe(u){t=_(u,b)}})}function G(c){if(!(c.mode==="value"&&c.numberFormat===void 0)){if(!["value","percentGrandTotal","percentParent","percentColumn","percentRow","runningTotal","rank","difference","percentChange"].includes(c.mode??"")||typeof c.numberFormat!="string"||!c.numberFormat.length)throw new TypeError("Numeric pivot cells require a frozen mode and native numberFormat.");return c.numberFormat}}const k=Object.freeze({canopyPivot:z,pivotNumberFormat:G});return X.set("5e0a9bdc75106268fcdff0cc6d7778080db216c7597514163f5fe5ff8ce93be1",k),k})(),fe=X.get("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f")??(()=>{function _(G,k,c){if(k==="text")return G;const o=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/.exec(G);if(!o)throw new TypeError("Canopy datetime values require an ISO timestamp with an explicit time zone.");const y=new Date(G),b=o[8]==="Z"?0:(o[8][0]==="+"?1:-1)*(Number(o[8].slice(1,3))*60+Number(o[8].slice(4))),f=Number(o[1]),l=Number(o[2]),t=Number(o[3]),U=Number(o[4]),u=Number(o[5]),g=Number(o[6]??"0"),v=o[7]??"",D=new Date(0);if(D.setUTCFullYear(f,l-1,t),!Number.isFinite(y.getTime())||Number(o[8].slice(1,3))>23||Number(o[8].slice(4))>59||D.getUTCFullYear()!==f||D.getUTCMonth()+1!==l||D.getUTCDate()!==t||U>24||u>59||g>59||U===24&&(u!==0||g!==0||/[1-9]/.test(v)))throw new TypeError("Invalid Canopy datetime value.");if(D.setUTCHours(U,u,g,Number((v+"000").slice(0,3))),D.getTime()!==y.getTime()+b*6e4)throw new TypeError("Invalid Canopy datetime value.");if(/[1-9]/.test(v.slice(3))){if(k==="typed")throw new TypeError("Typed Excel dates cannot preserve sub-millisecond precision; use datetime: preserve or text.");return G}const O=c==="utc"?y.getUTCFullYear():y.getFullYear();if(O<1900||O>9999){if(k==="typed")throw new TypeError("Typed Excel dates require years 1900 through 9999; use datetime: preserve or text.");return G}return y}const z=Object.freeze({datetime:_});return X.set("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f",z),z})(),xe=X.get("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d")??(()=>{function _(c){const o=Math.floor((c<12?c/12:(c-5)/7)*256)/256;if(!Number.isFinite(o)||o<=0||o>255)throw new RangeError("Captured width exceeds the Calibri-11 XLSX width profile.");return o}function z(c,o,y){if(!c||typeof c!="object"||Array.isArray(c))throw new TypeError("Canopy numeric format must be an object.");if(Object.keys(c).some(u=>!["minimumFractionDigits","maximumFractionDigits","prefix","suffix"].includes(u))){o({code:"UNSUPPORTED_NUMBER_FORMAT",columnId:y});return}const{minimumFractionDigits:b=0,maximumFractionDigits:f=3,prefix:l="",suffix:t=""}=c;if(!Number.isInteger(b)||!Number.isInteger(f)||b<0||f<b||f>10||typeof l!="string"||typeof t!="string"||l.length>16||t.length>16)throw new TypeError("Canopy numeric fraction bounds must be ordered integers from zero through ten, with literal affixes of at most sixteen characters.");const U=u=>u?'"'+u.replace(/"/g,'"\\""')+'"':"";return U(l)+"0"+(f?"."+"0".repeat(b)+"#".repeat(f-b):"")+U(t)}function G(c,o){let y=0,b=!1;for(const f of c){const l=f.pinned;if(l!=null&&l!=="left"&&l!=="right")throw new TypeError("Invalid Canopy pin.");!b&&l==="left"?y++:(b=!0,(l==="left"||l==="right")&&o({code:"UNREPRESENTABLE_PIN:"+l,columnId:f.id}))}return y}const k=Object.freeze({canopyXlsxWidth:_,canopyNumberFormat:z,canopyPins:G});return X.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",k),k})(),Ee=X.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac")??(()=>{const _=Object.freeze({info:Object.freeze({color:"4472C4",background:"DDEBF7",foreground:"1F4E78"}),success:Object.freeze({color:"70AD47",background:"E2F0D9",foreground:"375623"}),warning:Object.freeze({color:"FFC000",background:"FFF2CC",foreground:"7F5000"}),danger:Object.freeze({color:"C00000",background:"FFC7CE",foreground:"9C0006"}),muted:Object.freeze({color:"A6A6A6",foreground:"595959"})}),z=new Map(Object.entries(_).map(([k,c])=>[k,Object.freeze({...c.background===void 0?{}:{background:c.background},color:c.foreground})])),G=Object.freeze({canopyTonePalette:_,canopyDefaultTones:z});return X.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac",G),G})(),ue=X.get("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50")??(()=>{const{ExportCell:_,checkAbort:z,inputRows:G}=de,{canopyPivot:k,pivotNumberFormat:c}=Fe,{datetime:o}=fe,{captureFields:y}=re,{copyColumns:b}=Re,{copyCellPresentation:f}=ye,{canopyDiagnostics:l}=Te,{canopyNumberFormat:t,canopyXlsxWidth:U}=xe,{canopyDefaultTones:u}=Ee,g=["width","format","wrapText","alignment","rowHeader","groups"],v=new Set(["relative-link","history-series","badges","custom-class","custom-renderer"]),D=" · ",O=new WeakMap,R=new WeakMap;function A(I){const m=R.get(I),x=I.text??"";return m!==void 0&&x.endsWith(m)?{text:x.slice(0,x.length-m.length),suffix:m}:{text:x,suffix:""}}function T(I){if(!(I instanceof _))return I;const m=O.get(I);return m===void 0?I.value:m}function w(I){if(!Array.isArray(I)||I.length>64)throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");const m=[];for(const x of I){const C=typeof x=="string"?x:x&&typeof x=="object"?x.text:void 0;if(typeof C!="string")throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");const F=C.trim();F&&m.push(F)}return m.length?m.join(D):void 0}function p(I,m,x={}){return P(I,m,x).source}function P(I,m,x={}){if(x=y(x,["tones","columnOptions","unsupportedPresentation","datetime","xlsx","signal","onDiagnostic"]),m!=="xlsx"&&m!=="csv"&&m!=="pdf")throw new TypeError("Canopy export format must be xlsx, csv or pdf.");if(!I||typeof I.rows!="function"||!I.request)throw new TypeError("A portable CanopyX capture with request and rows() is required.");const C=y(I.request,["columns","recordCount","values","presentation","timeZone","revision","scope","total","matched","selection","query","generatedAt","grouping","pivot","formatRules"]),F=k(C),Y=x.signal,j=C.values;if(!Array.isArray(C.columns)||!C.columns.length||C.recordCount!==null&&(!Number.isSafeInteger(C.recordCount)||C.recordCount<0)||j!=="raw"&&j!=="display"||C.timeZone!=="utc"&&C.timeZone!=="local"||typeof C.revision!="string")throw new TypeError("Invalid portable CanopyX capture metadata.");const Z=x.datetime??"preserve",J=l(m,x),K=l(m,{...x,unsupportedPresentation:"text"}),B=x.xlsx?.dateMode??C.timeZone;if(B!=="utc"&&B!=="local")throw new TypeError("XLSX dateMode must be utc or local.");if(Z!=="preserve"&&Z!=="typed"&&Z!=="text")throw new TypeError("datetime must be preserve, typed or text.");const n=(r,i,e)=>{if(r!==void 0){if(!Array.isArray(r)||r.some(W=>typeof W!="string"))throw new TypeError("Canopy presentation diagnostics must be strings.");for(const W of r){const N={code:W,...i===void 0?{}:{rowId:i},...e===void 0?{}:{columnId:e}};(v.has(W)?K:J)(N)}}};if(C.presentation!=="text"&&C.presentation!=="semantic")throw new TypeError("Canopy captures must declare text or semantic presentation.");const s=new Map(Object.entries(x.tones??{}).map(([r,i])=>{if(!i||typeof i!="object"||Array.isArray(i))throw new TypeError("Tone mappings must be portable presentation objects.");return[r,f(i)]})),H=(r,i,e)=>{if(r===void 0)return;if(typeof r!="string")throw new TypeError("Canopy tones must be strings.");const W=s.get(r)??u.get(r);return!W&&r!=="neutral"&&K({code:"UNMAPPED_TONE:"+r,rowId:i,...e===void 0?{}:{columnId:e}}),W},S=new Set,M=new Set,a=(F?.columns??C.columns).map(r=>{const i=y(r,["id","title","kind","width","pinned","format","wrap","alignment","diagnostics"]),e=Object.freeze({...i,...i.width===void 0?{}:{width:Object.freeze(y(i.width,["unit","preferred","minimum","maximum"]))},...i.format===void 0?{}:{format:Object.freeze(y(i.format,["minimumFractionDigits","maximumFractionDigits","prefix","suffix"]))}});if(!e||typeof e.id!="string"||!e.id||M.has(e.id)||typeof e.title!="string"||!["text","number","datetime"].includes(e.kind)||e.wrap!==void 0&&typeof e.wrap!="boolean"||e.alignment!==void 0&&!["left","right"].includes(e.alignment)||e.width!==void 0&&(e.width.unit!=="css-px"||!Number.isFinite(e.width.preferred)||!Number.isFinite(e.width.minimum)||e.width.minimum<=0||e.width.preferred<e.width.minimum||e.width.maximum!==void 0&&(!Number.isFinite(e.width.maximum)||e.width.maximum<e.width.preferred))||!F&&C.presentation==="semantic"&&(e.wrap===void 0||e.alignment===void 0||e.width===void 0))throw new TypeError("Invalid or duplicate Canopy export column.");M.add(e.id),n(e.diagnostics,void 0,e.id);const W=Object.hasOwn(x.columnOptions??{},e.id)?x.columnOptions[e.id]:{};for(const V of Object.keys(W))if(!g.includes(V))throw new TypeError("Unsupported Canopy column option: "+V);const N=y(W,g),h=(m==="xlsx"||m==="pdf")&&j==="raw"&&e.kind==="number"&&e.format!==void 0&&N.format===void 0?t(e.format,J,e.id):void 0,[oe]=b([{...N,key:e.id,header:e.title,...m==="xlsx"&&N.width===void 0&&e.width!==void 0?{width:U(e.width.preferred)}:{},...N.format===void 0&&h!==void 0?{format:h}:{},...m==="xlsx"&&j==="raw"&&e.kind==="datetime"&&N.format===void 0?{format:"yyyy-mm-dd hh:mm:ss.000"}:{},...j==="raw"&&e.kind==="number"?{type:"number"}:{},...m==="pdf"?{wrapText:N.wrapText??!0}:N.wrapText===void 0&&e.wrap===void 0?{}:{wrapText:N.wrapText??e.wrap},...N.alignment===void 0&&e.alignment===void 0?m==="pdf"&&e.kind==="number"?{alignment:"right"}:{}:{alignment:N.alignment??e.alignment}}]);return Object.freeze({id:e.id,kind:e.kind,input:e,nativeFormatOverride:N.format,column:Object.freeze(oe)})}),d=C.recordCount,E=Object.freeze({columns:Object.freeze(a.map(r=>r.column)),rowCount:d,async*rows(){z(Y);let r=0;for await(const i of G(I.rows(Y?{signal:Y}:{}),Y)){if(z(Y),!i||typeof i.id!="string"||!i.cells||typeof i.cells!="object")throw new TypeError("Invalid Canopy export record.");F?.observe(i),n(i.diagnostics,i.id);const e=H(i.tone,i.id),W=[];for(const N of a){if(!Object.hasOwn(i.cells,N.id))throw new TypeError("Canopy record is missing column "+N.id+".");const h=i.cells[N.id];if(!h||typeof h!="object"||typeof h.text!="string"||h.value!==null&&!["string","number","boolean"].includes(typeof h.value)||typeof h.value=="number"&&(!Number.isFinite(h.value)||Math.abs(h.value)>Number.MAX_SAFE_INTEGER))throw new TypeError("A portable Canopy GridExportCell with scalar value and resolved text is required.");n(h.diagnostics,i.id,N.id);const oe=N.kind==="text"&&h.diagnostics?.includes("relative-link")&&!S.has(N.id),V=h.badges===void 0?void 0:w(h.badges),Q=V?h.text?h.text+D+V:V:h.text,ee=!!V&&j==="raw"&&!oe&&N.kind==="text"&&!S.has(N.id);let te=j==="display"||oe||ee?Q:h.value;m==="xlsx"&&j==="raw"&&N.kind==="datetime"&&typeof te=="string"&&(te=o(te,Z,B));const ne=F&&N.kind==="number"&&h.value!==null?c(h):void 0,q=N.nativeFormatOverride===""?"General":N.nativeFormatOverride??ne,ae=m==="pdf"&&F&&(i.summary||i.grandTotal),ie=H(h.tone,i.id,N.id),se=e||ie||q||ae?{...e,...ae?{bold:!0}:{},...ie,...(m==="pdf"||m==="xlsx"&&F)&&j==="raw"&&q!==void 0?{numberFormat:q}:{}}:void 0;if(m==="csv")W.push(te);else{const ce=new _(te,{text:Q,...se?{presentation:se}:{},...h.link===void 0?{}:{link:h.link}});(oe||ee)&&O.set(ce,h.value),V&&R.set(ce,h.text?D+V:V),W.push(ce)}}if(d!==null&&r>=d)throw new TypeError("Canopy capture exceeded its declared recordCount.");r++,yield W}if(d!==null&&r!==d)throw new TypeError("Canopy capture did not produce its declared recordCount.")}});return Object.freeze({source:E,request:Object.freeze({...C,columns:Object.freeze(a.map(r=>r.input))}),report:J,tones:s,pivot:F,ruleOperands:S})}const L=Object.freeze({canopyBadgeSplit:A,canopyIdentityValue:T,createCanopyExport:p,prepareCanopyExport:P});return X.set("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50",L),L})(),je=X.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c")??(()=>{const{columnName:_,excelDate:z}=ge,{captureFields:G}=re,{datetime:k}=fe;function c(y,b,f,l,t,U,u){let g=0;const v={eq:"=",ne:"<>",gt:">",ge:">=",lt:"<",le:"<="},D=w=>{const p=typeof w=="boolean"||typeof w=="string"?Number(w):w;if(typeof w=="string"){const P=w.trim().toLowerCase();if(Number.parseFloat(w)!==p||["0x","0b","0o"].some(L=>P.startsWith(L)))return t("UNSUPPORTED_NUMERIC_RULE_LITERAL")}if(!Number.isFinite(p)||Math.abs(p)>Number.MAX_SAFE_INTEGER)throw new TypeError("Canopy rule comparison values must be finite safe-range numbers.");return p},O=w=>{if(f.datetime!=="typed"||(f.xlsx?.dateMode??y.timeZone)!=="utc")return t("DATETIME_RULE_REQUIRES_TYPED_UTC");if(typeof w=="boolean"||typeof w=="number"&&!Number.isSafeInteger(w))return t("UNSUPPORTED_DATETIME_RULE_LITERAL");try{const p=typeof w=="number"?new Date(w).toISOString():w,P=k(p,"typed","utc");if(!(P instanceof Date))return t("UNSUPPORTED_DATETIME_RULE_LITERAL");const L=z(P,"utc");return L===null?t("UNSUPPORTED_DATETIME_RULE_LITERAL"):L}catch(p){if(!(p instanceof TypeError)&&!(p instanceof RangeError))throw p;return t("UNSUPPORTED_DATETIME_RULE_LITERAL")}},R=w=>{if(++g>64)return t("RULE_PREDICATE_LIMIT");const p=G(w,["column","operator","values"]),P=v[p.operator];if(Object.keys(p).some(K=>!["column","operator","values"].includes(K)))return t("UNSUPPORTED_RULE_FILTER_OPTIONS");const L=y.columns.findIndex(K=>K.id===p.column);if(L<0)return t("RULE_COLUMN_NOT_EXPORTED:"+p.column);u?.add(p.column);const I=y.columns[L],m=_(L+1+(b?1:0)),x="INDEX($"+m+":$"+m+",ROW())",C="NOT(ISBLANK("+x+"))";if(I.kind==="number"&&U.set(L,"number"),I.kind==="datetime"){if(f.datetime!=="typed"||(f.xlsx?.dateMode??y.timeZone)!=="utc")return t("DATETIME_RULE_REQUIRES_TYPED_UTC");U.set(L,"date")}if(p.operator==="isNull"||p.operator==="isNotNull")return p.values!==void 0&&p.values.length?t("UNSUPPORTED_NULL_RULE_OPERANDS"):p.operator==="isNull"?"ISBLANK("+x+")":C;if(!P||!Array.isArray(p.values)||p.values.length!==1)return t("UNSUPPORTED_RULE_FILTER:"+p.operator);const F=p.values[0];if(typeof F!="string"&&typeof F!="number"&&typeof F!="boolean")throw new TypeError("Canopy rule values must be portable scalars.");if(I.kind==="number"||I.kind==="datetime"){const K=I.kind==="number"?D(F):O(F);return"AND("+C+",ISNUMBER("+x+"),"+x+P+String(K)+")"}if(p.operator!=="eq"&&p.operator!=="ne")return t("UNSUPPORTED_TEXT_RULE_COMPARISON");if(typeof F=="string")return t("UNQUALIFIED_NATIVE_TEXT_COMPARISON");const Y=typeof F=="boolean"?"ISLOGICAL":"ISNUMBER",j=typeof F=="boolean"?F?"TRUE":"FALSE":String(D(F)),Z=Y+"("+x+")",J=x+P+j;return p.operator==="eq"?"AND("+C+","+Z+","+J+")":"AND("+C+",OR(NOT("+Z+"),"+J+"))"},A=(w,p)=>{if(p>4||++g>64)return t("RULE_PREDICATE_LIMIT");if(!w||typeof w!="object")throw new TypeError("Canopy rule predicate must be an object.");const P=G(w,["operator","filters","groups"]);if(P.operator!=="and"&&P.operator!=="or")return t("UNSUPPORTED_RULE_BOOLEAN:"+P.operator);const L=P.filters??[],I=P.groups??[];if(!Array.isArray(L)||!Array.isArray(I))throw new TypeError("Canopy predicate filters and groups must be arrays.");const m=[];for(const x of L)m.push(R(x));for(const x of I)m.push(A(x,p+1));return m.length?P.operator.toUpperCase()+"("+m.join(",")+")":t("EMPTY_RULE_PREDICATE")},T=A(l,1);return T.length>8192?t("RULE_FORMULA_LIMIT"):T}const o=Object.freeze({canopyPredicate:c});return X.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c",o),o})(),Me=X.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8")??(()=>{const{captureFields:_}=re,{canopyPredicate:z}=je,{canopyDefaultTones:G,canopyTonePalette:k}=Ee;class c extends Error{}const o=f=>{throw new c(f)};function y(f,l,t,U,u,g={},v,D){if(f.formatRules===void 0||l==="csv")return[];if(!Array.isArray(f.formatRules)||f.formatRules.length>1e3)throw new TypeError("Canopy formatRules must be a bounded array of at most 1,000 declarations.");const O=[],R=[],A=[],T=new Set,w=f.columns,P=f.formatRules.map(n=>{if(!n||typeof n!="object")throw new TypeError("Canopy rule declarations must be objects.");const s=_(n,["id","enabled","stopIfTrue","column","when","target","style"]);if(typeof s.id!="string"||!s.id||T.has(s.id))throw new TypeError("Canopy rule IDs must be unique nonempty strings.");if(T.add(s.id),s.enabled!==void 0&&typeof s.enabled!="boolean"||s.stopIfTrue!==void 0&&typeof s.stopIfTrue!="boolean")throw new TypeError("Canopy rule flags must be boolean.");const H=s.style&&typeof s.style=="object"?_(s.style,["tone","bar","scale"]):s.style;return{...s,style:H}});if(l==="pdf"){for(const n of P)n.enabled!==!1&&u({code:"PDF_NATIVE_RULE_NOT_RENDERED:"+n.id});return[]}const L=P.some(n=>n.enabled!==!1&&n.stopIfTrue);if(L&&P.some(n=>n.enabled!==!1&&(n.style?.bar!==void 0||n.style?.scale!==void 0)))return u({code:"UNSUPPORTED_GLOBAL_STOP_WITH_NATIVE_VISUALS"}),[];const I=new Set(P.filter(n=>n.enabled!==!1&&n.style?.bar!==void 0).map(n=>n.column)),m=P.find(n=>n.enabled!==!1&&n.target!=="row"&&n.style?.tone!==void 0&&n.column!==void 0&&I.has(n.column));if(m)return u({code:"UNSUPPORTED_CELL_TONE_WITH_DATA_BAR",columnId:m.column}),[];const x=[],C=[],F=new Map,Y=new Map,j=new Set,Z=n=>{const s=w.findIndex(H=>H.id===n);return s<0?o("RULE_COLUMN_NOT_EXPORTED:"+n):s},J=n=>{w[Z(n)].kind!=="number"&&o("RULE_COLUMN_NOT_NUMERIC:"+n)},K=n=>{const s=U.get(n),H=s?.background??s?.color??k[n]?.color;return H===void 0?o("UNMAPPED_RULE_TONE:"+n):H},B=n=>{const s=U.get(n)??G.get(n);return s?"alignment"in s||"wrapText"in s?o("UNSUPPORTED_RULE_TONE_STYLE:"+n):{..."background"in s&&s.background!==void 0?{fill:{color:s.background}}:{},font:{...s.color===void 0?{}:{color:s.color},..."bold"in s&&s.bold!==void 0?{bold:s.bold}:{},..."italic"in s&&s.italic!==void 0?{italic:s.italic}:{}},..."numberFormat"in s&&s.numberFormat!==void 0?{numberFormat:s.numberFormat}:{}}:o("UNMAPPED_RULE_TONE:"+n)};for(const n of P)if(n.enabled!==!1)try{if(f.values!=="raw"&&o("NATIVE_RULE_REQUIRES_RAW_VALUES"),(n.target==="columns"||"columns"in n&&n.columns!==void 0)&&o("UNSUPPORTED_RULE_COLUMNS_TARGET"),!n.style||typeof n.style!="object"||Array.isArray(n.style))throw new TypeError("Canopy rule style must be an object.");const s=_(n.style,["tone","bar","scale"]);if(Object.keys(s).some(S=>!["tone","bar","scale"].includes(S))&&o("UNSUPPORTED_RULE_STYLE"),[s.bar,s.scale,s.tone].filter(S=>S!==void 0).length!==1&&o("UNSUPPORTED_RULE_STYLE_COMBINATION"),s.bar!==void 0){(n.column===void 0||n.when!==void 0||n.target==="row")&&o("UNSUPPORTED_BAR_TARGET"),J(n.column),n.stopIfTrue&&o("UNSUPPORTED_BAR_STOP");const{minimum:S,maximum:M,tone:a="info",showValue:d}=_(s.bar,["minimum","maximum","tone","showValue"]);if(S===void 0||M===void 0)return o("UNBOUNDED_CANOPY_BAR");if(!Number.isFinite(S)||!Number.isFinite(M)||M<=S)throw new TypeError("Canopy bar bounds must be finite and increasing.");O.push({type:"dataBar",range:{column:n.column},color:K(a),minimum:{type:"number",value:S},maximum:{type:"number",value:M},...d===void 0?{}:{showValue:d}}),Y.set(Z(n.column),"number")}else if(s.scale!==void 0){n.stopIfTrue&&o("UNSUPPORTED_SCALE_STOP"),(n.column===void 0||n.when!==void 0||n.target==="row")&&o("UNSUPPORTED_SCALE_TARGET"),J(n.column);const{stops:S}=_(s.scale,["stops"]);(!Array.isArray(S)||S.length<2||S.length>3)&&o("UNSUPPORTED_SCALE_STOPS");const M=S.map(a=>{const d=_(a,["type","value","tone"]);return["min","max","number","percent","percentile"].includes(d.type)||o("UNSUPPORTED_SCALE_THRESHOLD:"+d.type),{threshold:d.type==="min"||d.type==="max"?{type:d.type}:{type:d.type,value:d.value},color:K(d.tone)}});O.push({type:"colorScale",range:{column:n.column},stops:M}),Y.set(Z(n.column),"number")}else{(n.when===void 0||s.tone===void 0||n.target!=="row"&&n.column===void 0)&&o("UNSUPPORTED_HIGHLIGHT_TARGET"),n.target!==void 0&&n.target!=="row"&&n.target!=="cell"&&o("UNSUPPORTED_RULE_TARGET");const S=n.target==="row"?{column:w[0].id,through:w.at(-1).id}:{column:n.column};n.column!==void 0&&Z(n.column);const M=new Map,a=new Set,d=z(f,t,g,n.when,o,M,a),E=x.length?"AND("+d+",NOT(OR("+x.join(",")+")))":d,r=n.target==="row"?C:F.get(n.column)??[],i=r.length?"AND("+E+",NOT(OR("+r.join(",")+")))":E;i.length>8192&&o("RULE_FORMULA_LIMIT"),(n.target==="row"?A:R).push({type:"expression",range:S,formula:i,style:B(s.tone)}),r.push(d),n.target!=="row"&&F.set(n.column,r);for(const[e,W]of M)Y.set(e,W);for(const e of a)j.add(e);n.stopIfTrue&&x.push(d)}}catch(s){if(!(s instanceof c))throw s;if(u({code:s.message+":"+n.id,...n.column===void 0?{}:{columnId:n.column}}),L)return[]}for(const[n,s]of Y)v?.set(n,s);for(const n of j)D?.add(n);return Object.freeze([...O,...R,...A])}const b=Object.freeze({canopyRules:y});return X.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8",b),b})(),ze=X.get("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014")??(()=>{const{createGroupedReport:_}=Pe,{checkAbort:z}=he,{createTotals:G}=Se,{captureFields:k}=re,{datetime:c}=fe,{canopyIdentityValue:o}=ue,y=t=>t instanceof Date?"date:"+t.getTime():typeof t+":"+String(t),b=o;function f(t,U,u,g,v,D){const O=U.grouping;if(O===void 0)return;if(U.values!=="raw"){v({code:"GROUPING_REQUIRES_RAW_VALUES"});return}if(t.rowCount===null)throw new TypeError("Captured grouping requires its exact scope recordCount.");const R=k(O,["levels","aggregates","totals","groups"]);if(!Array.isArray(R.levels)||R.levels.length<1||R.levels.length>4||!Array.isArray(R.aggregates)||!Array.isArray(R.groups))throw new TypeError("Canopy grouping needs one through four levels, aggregates and ordered groups.");const A=R.levels.map(a=>Object.freeze(k(a,["column","direction","title"])));if(A.some(a=>typeof a.column!="string"||!a.column||a.direction!=="asc"&&a.direction!=="desc")||new Set(A.map(a=>a.column)).size!==A.length)throw new TypeError("Canopy grouping levels need unique stable columns and directions.");const T=R.aggregates.map(a=>Object.freeze(k(a,["id","column","operation","label"]))),w=new Set,p=Object.create(null),P={sum:"sum",count:"count",average:"average",minimum:"min",maximum:"max"};for(const a of T){if(typeof a.id!="string"||!a.id||w.has(a.id))throw new TypeError("Canopy aggregate IDs must be unique nonempty strings.");w.add(a.id);const d=t.columns.find(r=>r.key===a.column);if(!d||d.type!=="number")throw new TypeError("Canopy aggregate declarations require an exported raw numeric column.");if(Object.hasOwn(p,a.column))throw new TypeError("The grouped report supports one aggregate operation per column.");const E=P[a.operation];if(E===void 0){v({code:"UNSUPPORTED_GROUP_AGGREGATE:"+a.operation,columnId:a.column});return}p[a.column]=E}G(t.columns,p);const L=a=>{if(!a||typeof a!="object"||Array.isArray(a))throw new TypeError("Canopy aggregate values must be an ID-keyed object.");const d={...a};if(Object.keys(d).some(E=>!w.has(E))||T.some(E=>!Object.hasOwn(d,E.id)))throw new TypeError("Canopy aggregate values must reference exactly the captured declarations.");for(const E of Object.values(d))if(E!==null&&(typeof E!="number"||!Number.isFinite(E)))throw new TypeError("Canopy aggregate values must be finite numbers or null.");return Object.freeze(d)},I=L(R.totals),m=A.map(()=>[]),x=A.map(()=>new Map);let C=0,F=0;const Y=(a,d,E,r)=>{if(!Array.isArray(a))throw new TypeError("Canopy groups must be ordered arrays.");let i=d;const e=new Set,W=new Set;for(const N of a){const h=k(N,["key","value","text","offset","count","aggregates","groups"]);if(!h||typeof h.key!="string"||e.has(h.key)||!Number.isSafeInteger(h.offset)||!Number.isSafeInteger(h.count)||h.count<=0||h.offset!==i||h.count>E-h.offset)throw new TypeError("Canopy group ranges must be nonempty contiguous half-open partitions within their parent.");if(h.value!==null&&!["string","number","boolean"].includes(typeof h.value)||typeof h.value=="number"&&!Number.isFinite(h.value))throw new TypeError("Canopy group values must be portable finite scalars.");const oe=U.columns.find(q=>q.id===A[r].column)?.kind==="datetime",V=D==="xlsx"&&oe&&typeof h.value=="string"?c(h.value,u.datetime??"preserve",u.xlsx?.dateMode??U.timeZone):h.value,Q=y(V),ee=h.text??String(h.value??"");if(typeof ee!="string"||W.has(Q))throw new TypeError("A Canopy group key cannot recur within the same parent.");const te=x[r].get(Q);if(te!==void 0&&te!==ee)throw new TypeError("The same grouping value needs consistent captured text at one level.");if(x[r].set(Q,ee),e.add(h.key),W.add(Q),++C>1e3||(F+=h.key.length+Q.length+ee.length)>1e6)throw new RangeError("Canopy group metadata exceeds the existing bounded report profile.");const ne=h.offset+h.count;if(m[r].push(Object.freeze({offset:h.offset,end:ne,value:V,text:ee,expected:L(h.aggregates)})),r+1<A.length)Y(h.groups??[],h.offset,ne,r+1);else if(h.groups!==void 0&&h.groups.length)throw new TypeError("Canopy nested groups exceed their declared levels.");i=ne}if(i!==E)throw new TypeError("Canopy grouping does not cover its complete exported detail range.")};Y(R.groups,0,t.rowCount,0);const j=()=>{const a=G(t.columns,p),d=t.columns.map(()=>0),E=t.columns.map(()=>0),r=t.columns.map(()=>0);return{accept(i){for(let e=0;e<i.length;e++){const W=b(i[e]),N=p[t.columns[e].key];if(N!=="sum"&&N!=="average"){a[e].accept(W);continue}if(typeof W!="number"||!Number.isFinite(W))continue;r[e]=r[e]+1;const h=W-E[e],oe=d[e]+h;E[e]=oe-d[e]-h,d[e]=oe}},value(i){const e=p[t.columns[i].key];return e==="sum"||e==="average"?r[i]?e==="sum"?d[i]:d[i]/r[i]:null:a[i].value()}}},Z=A.map(()=>0),J=A.map(()=>{}),K=(a,d)=>{const E=m[a];for(;E[Z[a]]&&E[Z[a]].end<=d;)Z[a]=Z[a]+1;const r=E[Z[a]];if(!r||d<r.offset||d>=r.end)throw new TypeError("A detail row is outside its captured Canopy grouping.");return r},B=(a,d)=>{for(const E of T){const r=t.columns.findIndex(W=>W.key===E.column),i=a.value(r),e=d[E.id];if(i!==e)throw new TypeError("Canopy captured aggregate differs from its consumed rows: "+E.id+".")}},n=(a,d)=>a instanceof Date&&d instanceof Date?a.getTime()===d.getTime():a===d;async function*s(){let a=0;const d=j();for await(const E of t.rows()){z(u.signal);for(let r=0;r<A.length;r++){const i=K(r,a),e=t.columns.findIndex(W=>W.key===A[r].column);if(e>=0&&!n(b(E[e]),i.value))throw new TypeError("Canopy detail value disagrees with its captured group range.");i.offset===a&&(J[r]={range:i,aggregates:j()})}d.accept(E);for(const r of J)r.aggregates.accept(E);yield E,a++;for(let r=A.length-1;r>=0;r--){const i=J[r];i.range.end===a&&(B(i.aggregates,i.range.expected),J[r]=void 0)}}B(d,I)}const H=new Set([...t.columns.map(a=>a.key),...A.map(a=>a.column)]),S=A.map((a,d)=>{const E=t.columns.findIndex(i=>i.key===a.column);let r=a.column;if(E>=0){do r+="#raw";while(H.has(r));H.add(r)}return{key:r,value:(i,e)=>E<0?K(d,e.rowIndex).value:b(i[E]),label:i=>x[d].get(y(i))??String(i??"")}}),M=g===void 0?void 0:{...g.maxRows===void 0?{}:{maxRows:g.maxRows},...g.maxCells===void 0?{}:{maxCells:g.maxCells},...g.maxTextCharacters===void 0?{}:{maxTextCharacters:g.maxTextCharacters}};return _(s(),{columns:t.columns,groupBy:S,totals:p,...u.signal===void 0?{}:{signal:u.signal},...M===void 0?{}:{limits:M}})}const l=Object.freeze({canopyGrouped:f});return X.set("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014",l),l})(),Ge=X.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8")??(()=>{const{cellText:_}=ge,{cleanXml:z}=Ue;function G(c,o){const y=[["revision",c.revision],["recordCount",c.recordCount===null?"unknown":c.recordCount]];if(c.scope!==void 0){if(!["filtered","visible","selected","all"].includes(c.scope))throw new TypeError("Invalid Canopy export scope.");y.push(["scope",c.scope])}for(const b of["total","matched"])if(c[b]!==void 0){const f=c[b];if(f===null){y.push([b,"unknown"]);continue}if(!Number.isSafeInteger(f)||f<0)throw new TypeError("Canopy metadata counts must be nonnegative safe integers.");y.push([b,f])}if(c.generatedAt!==void 0){if(typeof c.generatedAt!="string"||!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,9})?Z$/.test(c.generatedAt)||!Number.isFinite(new Date(c.generatedAt).getTime()))throw new TypeError("Canopy generatedAt must be a captured UTC ISO instant.");y.push(["generatedAt",c.generatedAt])}if(c.selection!==void 0){if(!Array.isArray(c.selection)||c.selection.some(b=>typeof b!="string"))throw new TypeError("Canopy selection metadata must contain stable string IDs.");y.push(["selection",JSON.stringify(c.selection)])}if(c.query!==void 0){if(!c.query||typeof c.query!="object"||Array.isArray(c.query))throw new TypeError("Canopy accepted query must be a captured object.");const b=JSON.stringify(c.query);if(typeof b!="string")throw new TypeError("Canopy accepted query must serialize as JSON metadata.");y.push(["query",b])}if(y.reduce((b,f)=>b+f[0].length+String(f[1]).length,0)>65536)throw new RangeError("Canopy About metadata exceeds 65,536 captured characters.");for(const[b,f]of y)_(b,o.invalidCharacterPolicy),o.oversizedText==="preserve"?z(f,o.invalidCharacterPolicy):_(f,o.invalidCharacterPolicy);return Object.freeze(y.map(b=>Object.freeze(b)))}const k=Object.freeze({canopyAbout:G});return X.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",k),k})(),We=X.get("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca")??(()=>{const{Workbook:_,addGroupedXlsx:z}=be,{portableWorkbook:G}=Le,{withDestination:k}=Ie;async function c(y,b,f,l,t,U){const{sheet:u={},columns:g,...v}=l,{name:D="Data",...O}=u;if(U&&D.toLowerCase()==="about")throw new TypeError("The optional About worksheet needs a distinct data-sheet name.");if(b&&v.cellValueWriters!==void 0)throw new TypeError("Grouped Canopy exports use resolved source values rather than custom cellValueWriters.");return k(f,async R=>{const A={...G(v),sink:R},T=b?new _(A):_.forTable(A);try{let w,p;if(b){const{conditionalFormats:L,...I}=O,m=await z(T,b,{labelColumn:{header:t?.labelColumn?.header??"Group",width:18},subtotalLabel:t?.subtotalLabel??(x=>x.label+" total"),grandTotalLabel:t?.grandTotalLabel??(()=>"Grand total"),...t?.includeGrandTotal===void 0?{}:{includeGrandTotal:t.includeGrandTotal},sheet:{...I,name:D},...L===void 0?{}:{conditionalFormats:L}});w=m.rows,p=m.columns}else{const L=T.addWorksheet(D,{boldHeader:!0,autoFilter:O.includeHeader!==!1,autoSize:{minWidth:6,maxWidth:54},...O,columns:y.columns});await L.addRows(y.rows()),await L.close(),w=L.rowCount,p=y.columns.length}if(U){const L=T.addWorksheet("About",{columns:[{header:"Field",width:18},{header:"Value",width:72,wrapText:!0}],boldHeader:!0,freezeHeader:!0});await L.addRows(U),await L.close()}const P=await T.finish();return{rows:w,columns:p,bytes:P.bytes}}catch(w){throw await T.discard(w),w}})}const o=Object.freeze({writeCanopyWorkbook:c});return X.set("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca",o),o})(),Be=X.get("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d")??(()=>{const{ExportCell:_}=de,{canopyBadgeSplit:z}=ue;function G(f){if(f===void 0||f==="General")return{minimumFractionDigits:0,maximumFractionDigits:20,percent:!1,grouping:!1,prefix:"",suffix:""};const l=/^((?:"[^"]*"|\\["%])*)(#,##)?0(?:\.([0#]+))?(%)?((?:"[^"]*"|\\["%])*)$/.exec(f);if(!l||(l[3]?.length??0)>10)return;const t=U=>U.replace(/"([^"]*)"|\\(["%])/g,(u,g,v)=>g??v);return{minimumFractionDigits:(l[3]?.match(/0/g)??[]).length,maximumFractionDigits:l[3]?.length??0,percent:!!l[4],grouping:!!l[2],prefix:t(l[1]),suffix:t(l[5])}}function k(f,l){let t=f,U=!1;l.prefix&&t.startsWith(l.prefix)?t=t.slice(l.prefix.length):l.prefix&&/^[+\-\u2212]/.test(t)&&t.slice(1).startsWith(l.prefix)&&(U=!0,t=t[0]+t.slice(1+l.prefix.length)),l.suffix&&t.endsWith(l.suffix)&&(t=t.slice(0,-l.suffix.length));const u=/^([^0-9+\-\u2212]*)([+\-\u2212]?\d[\d., \u00a0\u202f]*?)([^0-9]*)$/.exec(t);return u?{prefix:l.prefix||u[1],number:u[2],suffix:l.suffix||u[3],signBeforePrefix:U}:void 0}function c(f,l){if(!/^[+\-\u2212]?\d{1,3}(?:,\d{3})+$/.test(f)&&!/^[+\-\u2212]?\d{1,3}(?:\.\d{3})+$/.test(f))return!1;const t=Number(f.replace(/[.,]/g,"").replace("−","-"));return t!==0&&Math.abs(t-l)<=.5}function o(f,l){let t;for(const U of[!0,!1]){for(const u of f)for(let g=0;g<l.length;g++){const v=u[g],D=l[g];if(!(v instanceof _)||typeof v.value!="number")continue;const O=G(v.presentation?.numberFormat??D.format);if(!O)continue;const R=z(v).text,A=k(R,O);if(!A)continue;const T=O.percent||O.prefix.includes("%")||O.suffix.includes("%")||R.includes("%");if(T!==U)continue;const w=/([.,])(\d+)$/.exec(A.number.trimEnd());if(w){const p=A.number;if(c(p,v.value)||T&&c(p,v.value*100)){t=w[1]===","?".":",";continue}return w[1]}}if(t!==void 0)return t}return"."}function y(f,l){const t=new Map,U=o(f,l);return u=>u.map((g,v)=>{if(!(g instanceof _)||typeof g.value!="number")return g;const D=g.presentation?.numberFormat??l[v].format;let O=G(D);const{text:R,suffix:A}=z(g);if(!O||R==="")return g;const T=k(R,O);if(R&&!T||(D===void 0||D==="General")&&T&&(T.prefix.trim()||T.suffix.trim()))return g;if(D===void 0||D==="General"){const x=Number.isInteger(g.value)||T&&c(T.number,g.value)?0:T?/[.,](\d+)$/.exec(T.number.trimEnd())?.[1]?.length??0:void 0;x!==void 0&&x<=20&&(O={...O,minimumFractionDigits:x,maximumFractionDigits:x})}const w=[O.minimumFractionDigits,O.maximumFractionDigits,O.grouping].join(":");let p=t.get(w);p||(p=new Intl.NumberFormat(U===","?"de-DE":"en-US",{minimumFractionDigits:O.minimumFractionDigits,maximumFractionDigits:O.maximumFractionDigits,useGrouping:O.grouping}),t.set(w,p));let P=p.format(g.value*(O.percent?100:1));T?.number.startsWith("+")&&!P.startsWith("-")&&(P="+"+P);const L=T?.signBeforePrefix?/^[+-]/.exec(P)?.[0]??"":"";L&&(P=P.slice(1));const I=T?.prefix||O.prefix;let m=T?.suffix||O.suffix;return O.percent&&!O.suffix&&(m=m.replace(/%/g,"")),new _(g.value,{text:L+I+P+(O.percent?"%":"")+m+A,...g.presentation?{presentation:g.presentation}:{},...g.link?{link:g.link}:{}})})}const b=Object.freeze({canopyPdfNumbers:y});return X.set("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d",b),b})(),Xe=X.get("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30")??(()=>{const{ExportCell:_,NotSupportedError:z,OfficeIMOError:G}=de,{inputRows:k,checkAbort:c,pause:o,taskYieldDue:y}=he,{fontProgram:b}=we,{resolveScalar:f,selectFont:l,validateFonts:t}=ke,{settings:U}=me,{canopyPdfNumbers:u}=Be;async function g(D,O,R,A){const T=U({...R,columns:D.columns}),{fontSize:w,padding:p,page:P,margins:L,limits:I}=T;R=T.options,t(R.fonts,I.maxFontBytes);const m=P.width-L.left-L.right,x=k(D.rows(),R.signal)[Symbol.asyncIterator](),C=[];let F=!1,Y=0;try{for(;C.length<Math.min(128,R.limits?.maxRows??128)&&Y<262144;){const s=await x.next();if(s.done){F=!0;break}C.push(s.value),Y+=s.value.reduce((H,S)=>H+(S instanceof _?S.text?.length??0:String(S??"").length),0)}const j=u(C,D.columns),Z=C.map(j),J=(s,H=!1,S=!1)=>{if(s.length>I.maxCellCharacters)throw new G("RESOURCE_LIMIT","maxCellCharacters exceeded.");const M=l(R.fonts,H,S),a=M.font?b(M.font):void 0;let d=0;for(const E of s.replace(/\t/g," ")){const r=f(E.codePointAt(0),a,H);if(!r.supported)throw new z(r.message);d+=r.width*w/1e3}return d},K=(s,H=!1,S=!1)=>s.reduce((M,a)=>Math.max(M,J(a,H,S)),0);let B={};if(!R.columnWidths&&typeof R.wideTable!="object"&&!R.textShaper){const s=D.columns.map(a=>Math.min(m,K(a.header.split(/\s+/),T.options.headerPresentation?.bold)+p*2+.01)),H=D.columns.map((a,d)=>Math.min(m,Math.max(s[d],K(a.header.split(/\r\n?|\n/),T.options.headerPresentation?.bold)+p*2+.01)));for(const a of Z){for(let d=0;d<a.length;d++){const E=a[d],r=E instanceof _?E.text??String(E.value??""):String(E??""),i=E instanceof _?E.presentation:void 0,e=K(r.split(/\r\n?|\n/),i?.bold,i?.italic)+p*2+.01,W=K(r.split(/\s+/),i?.bold,i?.italic)+p*2+.01;H[d]=Math.min(m,Math.max(H[d],e)),s[d]=Math.min(m,Math.max(s[d],O[d].kind==="text"?W:e))}y()&&await o(),c(R.signal)}const S=s.reduce((a,d)=>a+d,0),M=[...s];if(S>m+.001)B={columnWidths:M,wideTable:R.wideTable==="reject"?"reject":{mode:"bands",repeatColumns:M[0]+Math.max(...M.slice(1))<=m?[0]:[]}};else{let a=m-S;const d=H.map((i,e)=>Math.max(0,i-M[e])),E=d.reduce((i,e)=>i+e,0);for(let i=0;i<M.length;i++)M[i]+=E?d[i]*Math.min(1,a/E):0;a=m-M.reduce((i,e)=>i+e,0);const r=O.flatMap((i,e)=>i.kind==="text"?[e]:[]);for(const i of r.length?r:M.map((e,W)=>W))M[i]+=a/(r.length||M.length);B={columnWidths:M}}}return await A(async function*(){for(const s of Z)yield s;for(;!F;){const s=await x.next();if(s.done){F=!0;break}yield j(s.value)}}(),B,T.options)}finally{if(!F)try{x.return(void 0).catch(()=>{})}catch{}}}const v=Object.freeze({withCanopyPdfLayout:g});return X.set("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30",v),v})(),He=X.get("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027")??(()=>{const{BlobByteSink:_,ExportCell:z}=de,{notifyProgress:G}=Ce,{captureFields:k}=re,{captureCommonLimits:c,captureXlsxOptions:o,captureCsvOptions:y,capturePdfOptions:b,mergeAdapterLimits:f}=De,{writeXlsxTo:l}=be,{writeCsvTo:t}=Ae,{writePdfTo:U,writeGroupedPdfTo:u}=Ne,{canopyDiagnostics:g}=Te,{prepareCanopyExport:v}=ue,{canopyPins:D}=xe,{canopyRules:O}=Me,{canopyGrouped:R}=ze,{canopyAbout:A}=Ge,{writeCanopyWorkbook:T}=We,{withCanopyPdfLayout:w}=Xe,p="E7EDF5",P=Object.freeze({bottom:Object.freeze({style:"thin",color:"A6B4C8"})});async function L(x,C,F,Y={}){const j=k(Y,["tones","columnOptions","unsupportedPresentation","datetime","xlsx","csv","pdf","signal","onDiagnostic","limits","onProgress","grouped","about"]),{signal:Z,onProgress:J}=j,K=c(j.limits),B=o(C==="xlsx"?j.xlsx:void 0),n=y(C==="csv"?j.csv:void 0),s=b(C==="pdf"?j.pdf:void 0),H=v(x,C,{...j,xlsx:B}),{request:S,report:M,tones:a,pivot:d}=H;if(j.about!==void 0&&typeof j.about!="boolean")throw new TypeError("Canopy about must be boolean.");const E=j.grouped===void 0?void 0:k(j.grouped,["labelColumn","subtotalLabel","grandTotalLabel","includeGrandTotal","continuationLabel","groupHeadingLevel"]),r=E&&{...E,...E.labelColumn===void 0?{}:{labelColumn:Object.freeze({header:E.labelColumn.header})}},i=C==="xlsx"&&j.about?A(S,B):void 0,e=new Map;let W=0;const N=Object.freeze({...H.source,async*rows(){for await(const V of H.source.rows()){for(const[Q,ee]of e){const te=V[Q],ne=te instanceof z?te.value:te;if(ne==null||ee==="number"&&typeof ne=="number"&&Number.isFinite(ne)||ee==="date"&&ne instanceof Date&&Number.isFinite(ne.getTime()))continue;const q="UNSUPPORTED_NATIVE_RULE_CELL_TYPE:"+ee;throw M({code:q,columnId:N.columns[Q].key}),new TypeError("Unsupported Canopy presentation: "+q+" ("+N.columns[Q].key+")")}W++,yield V}}}),oe={...Z?{signal:Z}:{},...J?{onProgress:V=>{G(J,{...V,rows:W,...V.sheetRows===void 0?{}:{sheetRows:i!==void 0&&V.sheetName==="About"?0:W},...N.rowCount===null?{}:{totalRows:N.rowCount}})}}:{}};if(C==="xlsx"){const V=f(B.limits,K),Q=d?void 0:R(N,S,{...j,xlsx:B},V,M,C),ee=D(S.columns,M),te=O(S,C,Q!==void 0,a,M,{...j,xlsx:B},e,H.ruleOperands);if(d&&(B.sheet?.rowOutline!==void 0||B.sheet?.columnOutlines!==void 0||B.sheet?.maxOutlineLevel!==void 0||B.sheet?.outlineSummaryBelow!==void 0||B.sheet?.outlineSummaryRight!==void 0||B.sheet?.table!==void 0||B.sheet?.footer!==void 0))throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");if(d&&B.cellValueWriters!==void 0)throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");const ne={headerFill:p,headerBorder:P,headerWrap:!0,...B.sheet,...d?.sheet??{},...d?{autoFilter:!1}:{},freezeHeader:B.sheet?.freezeHeader??B.sheet?.includeHeader!==!1,freezeColumns:B.sheet?.freezeColumns??(ee?ee+(Q?1:0):0),conditionalFormats:[...te,...B.sheet?.conditionalFormats??[]]},q={...B,...oe,columns:N.columns,sheet:ne,dateMode:B.dateMode??S.timeZone,limits:V};return Q||i?T(N,Q,F,q,r,i):l(N.rows(),F,q)}if(d&&g(C,{...j,unsupportedPresentation:"text"})({code:"PIVOT_OUTLINES_XLSX_ONLY"}),C==="pdf"){if(d&&s.footer?.totals!==void 0)throw new TypeError("Captured pivot metadata owns totals; PDF footer totals cannot recalculate it.");const V=f(s.limits,K),Q=d?void 0:R(N,S,j,V,M,C);O(S,C,Q!==void 0,a,M,j);const ee=S.columns.every(q=>q.width!==void 0)?S.columns.map(q=>q.width.preferred*72/96):void 0,te=s.columnWidths??ee,ne={orientation:"landscape",wideTable:"fit",...s,...oe,limits:V};if(Q){if(s.headerRows!==void 0||s.footer!==void 0)throw new TypeError("Grouped Canopy PDF owns heading and summary rows.");const{headerRows:q,footer:ae,...ie}=ne;return u(Q,F,{...ie,...te===void 0?{}:{columnWidths:[72,...te]},labelColumn:{header:r?.labelColumn?.header??"Group",width:12},subtotalLabel:r?.subtotalLabel??(se=>se.label+" total"),grandTotalLabel:r?.grandTotalLabel??(()=>"Grand total"),...r?.includeGrandTotal===void 0?{}:{includeGrandTotal:r.includeGrandTotal},...r?.continuationLabel===void 0?{}:{continuationLabel:r.continuationLabel},...r?.groupHeadingLevel===void 0?{}:{groupHeadingLevel:r.groupHeadingLevel}})}return w(H.source,S.columns,ne,async(q,ae,ie)=>U(async function*(){for await(const ce of q)W++,yield ce}(),F,{...ie,...ae,columns:N.columns}))}return t(N.rows(),F,{...n,...oe,columns:N.columns,valueMode:S.values,limits:f(n.limits,K)})}async function I(x,C,F={}){const Y=new _;try{return await L(x,C,Y,F),Y.toBlob(C==="xlsx"?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":C==="pdf"?"application/pdf":"text/csv;charset=utf-8")}catch(j){throw Y.discard(),j}}const m=Object.freeze({createCanopyExport:ue.createCanopyExport,ExportCell:ye.ExportCell,PdfFont:we.PdfFont,writeCanopyTo:L,exportCanopy:I});return X.set("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027",m),m})();Object.assign(pe,He)})(globalThis);
|
|
2
|
+
(function(me){"use strict";const be=me.OfficeIMO||(me.OfficeIMO={}),X=be[Symbol.for("@evotecit/officeimo/modules")],q=A=>{const M=X&&X.get(A);if(!M)throw new Error("officeimo-canopyx-adapter.min.js needs officeimo.js or officeimo.min.js from the same OfficeIMO build, loaded first.");return M},de=q("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00"),ve=q("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244"),se=q("50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669"),Ae=q("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671"),Ne=q("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208"),ye=q("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02"),Re=q("fd70ccda89f27c6b874c8840ac944b3ec723dbdef3dfe7600f7bdb81f4660c96"),ge=q("edf1bf5cb6d749de0e6823397df6610a6c1cc88768898c1b4d7083ee96ef6759"),Pe=q("406ac6c93ee68eae70c6f52a1e6f4c56b84f43cae12576040c766dcc5598a580"),Se=q("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca"),Ue=q("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc"),he=q("732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5"),we=q("e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8"),Le=q("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0"),Te=q("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3"),ke=q("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b"),Ie=q("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585"),De=q("d6884428c3e4d15a691ecf2523372a03b32de22a890edfbfc9961f2dc92711c2"),Fe=q("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b"),xe=q("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596"),je=q("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070"),Me=X.get("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9")??(()=>{const{captureFields:A}=se,{ExportBudget:M}=Ae,{captureCsvOptions:z}=Ne,{capturePdfOptions:F,capturePdfLimits:r,pdfLimitFields:n}=ye,{captureWorkbookLimits:h,workbookLimitFields:b,workbookOptionFields:u,sheetOptionFields:c}=Re,t=[...new Set([...b,...n])],L=u.filter(v=>v!=="sink");function a(v){return v===void 0?void 0:new M(A(v,t)).limits}function w(v,E){const x={...v};for(const[f,k]of Object.entries(E??{}))k!==void 0&&(x[f]=k);return x}function _(v={}){const E=A(v,[...L,"sheet"]),x=E.sheet&&A(E.sheet,[...c,"name"]),f=x?.footer&&A(x.footer,["rows","values","totals","style"]);return{...E,...x===void 0?{}:{sheet:{...x,...f===void 0?{}:{footer:f}}},...E.limits===void 0?{}:{limits:h(E.limits)}}}function D(v={}){const E=z(v);return{...E,...E.limits===void 0?{}:{limits:new M(E.limits).limits}}}function N(v={}){const E=F(v);return{...E,...E.limits===void 0?{}:{limits:r(E.limits)}}}const S=Object.freeze({captureCommonLimits:a,mergeAdapterLimits:w,captureXlsxOptions:_,captureCsvOptions:D,capturePdfOptions:N});return X.set("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9",S),S})(),Ee=X.get("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8")??(()=>{function A(z,F){const r=F.unsupportedPresentation??(z==="csv"?"text":"reject"),n=F.onDiagnostic;if(r!=="reject"&&r!=="text")throw new TypeError("unsupportedPresentation must be reject or text.");if(n!==void 0&&typeof n!="function")throw new TypeError("onDiagnostic must be a synchronous function.");return h=>{if(r==="reject")throw new TypeError("Unsupported Canopy presentation: "+h.code+(h.columnId?" ("+h.columnId+")":""));const b=n?.(Object.freeze(h));if(b&&typeof b.then=="function")throw Promise.resolve(b).catch(()=>{}),new TypeError("onDiagnostic must be synchronous.")}}const M=Object.freeze({canopyDiagnostics:A});return X.set("3d1862d8ab32171bca4b3ba5fe0bdcc073f67ce940aaff0ee735635893f86ee8",M),M})(),ze=X.get("5e0a9bdc75106268fcdff0cc6d7778080db216c7597514163f5fe5ff8ce93be1")??(()=>{function A(r,n){const{axisKey:h,outlineLevel:b,summary:u,grandTotal:c,hidden:t,collapsed:L}=r;if(typeof h!="string"||!n.has(h)||!Number.isInteger(b)||b<0||b>7||[u,c,t,L].some(a=>typeof a!="boolean"))throw new TypeError("Invalid frozen Canopy pivot axis presentation.");return Object.freeze({level:b,hidden:t,collapsed:L})}function M(r){if(r.pivot===void 0)return;const n=r.pivot;if(!n||typeof n!="object"||r.grouping!==void 0||!Array.isArray(r.columns)||r.scope!=="filtered"||!Number.isSafeInteger(r.recordCount)||r.recordCount<0||!n.definition||!Array.isArray(n.definition.rows)||n.definition.rows.length>4||!Array.isArray(n.definition.columns)||n.definition.columns.length>2||!Array.isArray(n.definition.values)||!n.definition.values.length||n.definition.values.length>32||n.definition.values.some(a=>typeof a!="string")||!Number.isSafeInteger(n.distinctColumns)||n.distinctColumns<0||typeof n.columnsLimited!="boolean"||!Array.isArray(n.retainedColumns)||!Array.isArray(n.columnGroups))throw new TypeError("Invalid explicit Canopy pivot descriptor.");const h=a=>{if(!Array.isArray(a)||a.length>100001)throw new TypeError("Pivot axes require bounded accepted identities.");const w=new Set;for(const _ of a){if(!_||typeof _.key!="string"||!_.key||w.has(_.key)||!Array.isArray(_.path)||typeof _.other!="boolean")throw new TypeError("Invalid or duplicate Canopy pivot axis identity.");w.add(_.key)}for(const _ of a)if(_.parent!==void 0&&!w.has(_.parent))throw new TypeError("Unknown Canopy pivot parent identity.");return w},b=h(n.rowAxis),u=h(n.columnAxis),c=r.columns.map((a,w)=>{if(w===0&&a.axisKey===void 0&&a.kind==="text")return Object.freeze({...a});const _=A(a,u);return Object.freeze({...a,outlineLevel:_.level,hidden:_.hidden,collapsed:_.collapsed})});if(n.columnGroups.length>c.length)throw new RangeError("Pivot column group count exceeds projected columns.");for(const a of n.columnGroups)if(!a||!u.has(a.key)||!Number.isSafeInteger(a.firstColumn)||a.firstColumn<0||!Number.isSafeInteger(a.columnCount)||a.columnCount<1||a.firstColumn+a.columnCount>c.length||!Number.isInteger(a.depth)||a.depth<1||a.depth>7||typeof a.hidden!="boolean"||typeof a.collapsed!="boolean")throw new TypeError("Invalid Canopy pivot column range.");let t;const L=Object.freeze({outlineSummaryBelow:!1,outlineSummaryRight:!1,maxOutlineLevel:7,rowOutline:()=>t,columnOutlines:Object.freeze(c.flatMap((a,w)=>a.axisKey===void 0?[]:[Object.freeze({firstColumn:w,columnCount:1,level:a.outlineLevel,hidden:a.hidden,collapsed:a.collapsed})]))});return Object.freeze({columns:Object.freeze(c),sheet:L,observe(a){t=A(a,b)}})}function z(r){if(!(r.mode==="value"&&r.numberFormat===void 0)){if(!["value","percentGrandTotal","percentParent","percentColumn","percentRow","runningTotal","rank","difference","percentChange"].includes(r.mode??"")||typeof r.numberFormat!="string"||!r.numberFormat.length)throw new TypeError("Numeric pivot cells require a frozen mode and native numberFormat.");return r.numberFormat}}const F=Object.freeze({canopyPivot:M,pivotNumberFormat:z});return X.set("5e0a9bdc75106268fcdff0cc6d7778080db216c7597514163f5fe5ff8ce93be1",F),F})(),le=X.get("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f")??(()=>{function A(z,F,r){if(F==="text")return z;const n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/.exec(z);if(!n)throw new TypeError("Canopy datetime values require an ISO timestamp with an explicit time zone.");const h=new Date(z),b=n[8]==="Z"?0:(n[8][0]==="+"?1:-1)*(Number(n[8].slice(1,3))*60+Number(n[8].slice(4))),u=Number(n[1]),c=Number(n[2]),t=Number(n[3]),L=Number(n[4]),a=Number(n[5]),w=Number(n[6]??"0"),_=n[7]??"",D=new Date(0);if(D.setUTCFullYear(u,c-1,t),!Number.isFinite(h.getTime())||Number(n[8].slice(1,3))>23||Number(n[8].slice(4))>59||D.getUTCFullYear()!==u||D.getUTCMonth()+1!==c||D.getUTCDate()!==t||L>24||a>59||w>59||L===24&&(a!==0||w!==0||/[1-9]/.test(_)))throw new TypeError("Invalid Canopy datetime value.");if(D.setUTCHours(L,a,w,Number((_+"000").slice(0,3))),D.getTime()!==h.getTime()+b*6e4)throw new TypeError("Invalid Canopy datetime value.");if(/[1-9]/.test(_.slice(3))){if(F==="typed")throw new TypeError("Typed Excel dates cannot preserve sub-millisecond precision; use datetime: preserve or text.");return z}const N=r==="utc"?h.getUTCFullYear():h.getFullYear();if(N<1900||N>9999){if(F==="typed")throw new TypeError("Typed Excel dates require years 1900 through 9999; use datetime: preserve or text.");return z}return h}const M=Object.freeze({datetime:A});return X.set("c0aee2c5df0df3e62ca31fc685243cdd4b449f083834e8d28cf92c20dfa7b27f",M),M})(),Ce=X.get("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d")??(()=>{function A(r){const n=Math.floor((r<12?r/12:(r-5)/7)*256)/256;if(!Number.isFinite(n)||n<=0||n>255)throw new RangeError("Captured width exceeds the Calibri-11 XLSX width profile.");return n}function M(r,n,h){if(!r||typeof r!="object"||Array.isArray(r))throw new TypeError("Canopy numeric format must be an object.");if(Object.keys(r).some(a=>!["minimumFractionDigits","maximumFractionDigits","prefix","suffix"].includes(a))){n({code:"UNSUPPORTED_NUMBER_FORMAT",columnId:h});return}const{minimumFractionDigits:b=0,maximumFractionDigits:u=3,prefix:c="",suffix:t=""}=r;if(!Number.isInteger(b)||!Number.isInteger(u)||b<0||u<b||u>10||typeof c!="string"||typeof t!="string"||c.length>16||t.length>16)throw new TypeError("Canopy numeric fraction bounds must be ordered integers from zero through ten, with literal affixes of at most sixteen characters.");const L=a=>a?'"'+a.replace(/"/g,'"\\""')+'"':"";return L(c)+"0"+(u?"."+"0".repeat(b)+"#".repeat(u-b):"")+L(t)}function z(r,n){let h=0,b=!1;for(const u of r){const c=u.pinned;if(c!=null&&c!=="left"&&c!=="right")throw new TypeError("Invalid Canopy pin.");!b&&c==="left"?h++:(b=!0,(c==="left"||c==="right")&&n({code:"UNREPRESENTABLE_PIN:"+c,columnId:u.id}))}return h}const F=Object.freeze({canopyXlsxWidth:A,canopyNumberFormat:M,canopyPins:z});return X.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",F),F})(),Oe=X.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac")??(()=>{const A=Object.freeze({info:Object.freeze({color:"4472C4",background:"DDEBF7",foreground:"1F4E78"}),success:Object.freeze({color:"70AD47",background:"E2F0D9",foreground:"375623"}),warning:Object.freeze({color:"FFC000",background:"FFF2CC",foreground:"7F5000"}),danger:Object.freeze({color:"C00000",background:"FFC7CE",foreground:"9C0006"}),muted:Object.freeze({color:"A6A6A6",foreground:"595959"})}),M=new Map(Object.entries(A).map(([F,r])=>[F,Object.freeze({...r.background===void 0?{}:{background:r.background},color:r.foreground})])),z=Object.freeze({canopyTonePalette:A,canopyDefaultTones:M});return X.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac",z),z})(),ue=X.get("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7")??(()=>{const{ExportCell:A,checkAbort:M,inputRows:z}=de,{canopyPivot:F,pivotNumberFormat:r}=ze,{datetime:n}=le,{captureFields:h}=se,{copyColumns:b}=Ue,{copyCellPresentation:u}=he,{canopyDiagnostics:c}=Ee,{canopyNumberFormat:t,canopyXlsxWidth:L}=Ce,{canopyDefaultTones:a}=Oe,w=["width","format","wrapText","alignment","rowHeader","groups"],_=new Set(["relative-link","history-series","badges","custom-class","custom-renderer"]),D=" · ",N=new WeakMap,S=new WeakMap;function v(O){const P=S.get(O),g=O.text??"";return P!==void 0&&g.endsWith(P)?{text:g.slice(0,g.length-P.length),suffix:P}:{text:g,suffix:""}}function E(O){if(!(O instanceof A))return O;const P=N.get(O);return P===void 0?O.value:P}const x=64,f=32767;function k(O,P){if(!Array.isArray(O))throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");let g="",I=0,Z=0;for(const R of O){const Y=typeof R=="string"?R:R&&typeof R=="object"?R.text:void 0;if(typeof Y!="string")throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");const K=Y.trim();if(!K)continue;const ee=g?g+D+K:K;if(I>=x||(P?P.length+D.length:0)+ee.length>f){Z++;continue}g=ee,I++}return{labels:g||void 0,dropped:Z}}function j(O,P,g={}){return Q(O,P,g).source}function Q(O,P,g={}){if(g=h(g,["tones","columnOptions","unsupportedPresentation","datetime","xlsx","signal","onDiagnostic"]),P!=="xlsx"&&P!=="csv"&&P!=="pdf")throw new TypeError("Canopy export format must be xlsx, csv or pdf.");if(!O||typeof O.rows!="function"||!O.request)throw new TypeError("A portable CanopyX capture with request and rows() is required.");const I=h(O.request,["columns","recordCount","values","presentation","timeZone","revision","scope","total","matched","selection","query","generatedAt","grouping","pivot","formatRules"]),Z=F(I),R=g.signal,Y=I.values;if(!Array.isArray(I.columns)||!I.columns.length||I.recordCount!==null&&(!Number.isSafeInteger(I.recordCount)||I.recordCount<0)||Y!=="raw"&&Y!=="display"||I.timeZone!=="utc"&&I.timeZone!=="local"||typeof I.revision!="string")throw new TypeError("Invalid portable CanopyX capture metadata.");const K=g.datetime??"preserve",ee=c(P,g),e=c(P,{...g,unsupportedPresentation:"text"}),i=g.xlsx?.dateMode??I.timeZone;if(i!=="utc"&&i!=="local")throw new TypeError("XLSX dateMode must be utc or local.");if(K!=="preserve"&&K!=="typed"&&K!=="text")throw new TypeError("datetime must be preserve, typed or text.");const V=(d,C,p)=>{if(d!==void 0){if(!Array.isArray(d)||d.some(T=>typeof T!="string"))throw new TypeError("Canopy presentation diagnostics must be strings.");for(const T of d){const B={code:T,...C===void 0?{}:{rowId:C},...p===void 0?{}:{columnId:p}};(_.has(T)?e:ee)(B)}}};if(I.presentation!=="text"&&I.presentation!=="semantic")throw new TypeError("Canopy captures must declare text or semantic presentation.");const G=new Map(Object.entries(g.tones??{}).map(([d,C])=>{if(!C||typeof C!="object"||Array.isArray(C))throw new TypeError("Tone mappings must be portable presentation objects.");return[d,u(C)]})),U=(d,C,p)=>{if(d===void 0)return;if(typeof d!="string")throw new TypeError("Canopy tones must be strings.");const T=G.get(d)??a.get(d);return!T&&d!=="neutral"&&e({code:"UNMAPPED_TONE:"+d,rowId:C,...p===void 0?{}:{columnId:p}}),T},o=new Set,s=new Set,y=(Z?.columns??I.columns).map(d=>{const C=h(d,["id","title","kind","width","pinned","format","wrap","alignment","diagnostics"]),p=Object.freeze({...C,...C.width===void 0?{}:{width:Object.freeze(h(C.width,["unit","preferred","minimum","maximum"]))},...C.format===void 0?{}:{format:Object.freeze(h(C.format,["minimumFractionDigits","maximumFractionDigits","prefix","suffix"]))}});if(!p||typeof p.id!="string"||!p.id||s.has(p.id)||typeof p.title!="string"||!["text","number","datetime"].includes(p.kind)||p.wrap!==void 0&&typeof p.wrap!="boolean"||p.alignment!==void 0&&!["left","right"].includes(p.alignment)||p.width!==void 0&&(p.width.unit!=="css-px"||!Number.isFinite(p.width.preferred)||!Number.isFinite(p.width.minimum)||p.width.minimum<=0||p.width.preferred<p.width.minimum||p.width.maximum!==void 0&&(!Number.isFinite(p.width.maximum)||p.width.maximum<p.width.preferred))||!Z&&I.presentation==="semantic"&&(p.wrap===void 0||p.alignment===void 0||p.width===void 0))throw new TypeError("Invalid or duplicate Canopy export column.");s.add(p.id),V(p.diagnostics,void 0,p.id);const T=Object.hasOwn(g.columnOptions??{},p.id)?g.columnOptions[p.id]:{};for(const $ of Object.keys(T))if(!w.includes($))throw new TypeError("Unsupported Canopy column option: "+$);const B=h(T,w),H=(P==="xlsx"||P==="pdf")&&Y==="raw"&&p.kind==="number"&&p.format!==void 0&&B.format===void 0?t(p.format,ee,p.id):void 0,[J]=b([{...B,key:p.id,header:p.title,...P==="xlsx"&&B.width===void 0&&p.width!==void 0?{width:L(p.width.preferred)}:{},...B.format===void 0&&H!==void 0?{format:H}:{},...P==="xlsx"&&Y==="raw"&&p.kind==="datetime"&&B.format===void 0?{format:"yyyy-mm-dd hh:mm:ss.000"}:{},...Y==="raw"&&p.kind==="number"?{type:"number"}:{},...P==="pdf"?{wrapText:B.wrapText??!0}:B.wrapText===void 0&&p.wrap===void 0?{}:{wrapText:B.wrapText??p.wrap},...B.alignment===void 0&&p.alignment===void 0?P==="pdf"&&p.kind==="number"?{alignment:"right"}:{}:{alignment:B.alignment??p.alignment}}]);return Object.freeze({id:p.id,kind:p.kind,input:p,nativeFormatOverride:B.format,column:Object.freeze(J)})}),m=I.recordCount,l=Object.freeze({columns:Object.freeze(y.map(d=>d.column)),rowCount:m,async*rows(){M(R);let d=0;for await(const C of z(O.rows(R?{signal:R}:{}),R)){if(M(R),!C||typeof C.id!="string"||!C.cells||typeof C.cells!="object")throw new TypeError("Invalid Canopy export record.");Z?.observe(C),V(C.diagnostics,C.id);const p=U(C.tone,C.id),T=[];for(const B of y){if(!Object.hasOwn(C.cells,B.id))throw new TypeError("Canopy record is missing column "+B.id+".");const H=C.cells[B.id];if(!H||typeof H!="object"||typeof H.text!="string"||H.value!==null&&!["string","number","boolean"].includes(typeof H.value)||typeof H.value=="number"&&(!Number.isFinite(H.value)||Math.abs(H.value)>Number.MAX_SAFE_INTEGER))throw new TypeError("A portable Canopy GridExportCell with scalar value and resolved text is required.");V(H.diagnostics,C.id,B.id);const J=B.kind==="text"&&H.diagnostics?.includes("relative-link")&&!o.has(B.id),$=H.badges===void 0?void 0:k(H.badges,H.text),te=$?.labels;$?.dropped&&e({code:"BADGES_TRUNCATED:"+$.dropped,rowId:C.id,columnId:B.id});const oe=te?H.text?H.text+D+te:te:H.text,re=(!!te||!!$?.dropped)&&Y==="raw"&&!J&&B.kind==="text"&&!o.has(B.id);let ne=Y==="display"||J||re?oe:H.value;P==="xlsx"&&Y==="raw"&&B.kind==="datetime"&&typeof ne=="string"&&(ne=n(ne,K,i));const ce=Z&&B.kind==="number"&&H.value!==null?r(H):void 0,ie=B.nativeFormatOverride===""?"General":B.nativeFormatOverride??ce,ae=P==="pdf"&&Z&&(C.summary||C.grandTotal),fe=U(H.tone,C.id,B.id),_e=p||fe||ie||ae?{...p,...ae?{bold:!0}:{},...fe,...(P==="pdf"||P==="xlsx"&&Z)&&Y==="raw"&&ie!==void 0?{numberFormat:ie}:{}}:void 0;if(P==="csv")T.push(ne);else{const pe=new A(ne,{text:oe,..._e?{presentation:_e}:{},...H.link===void 0?{}:{link:H.link}});(J||re)&&N.set(pe,H.value),te&&S.set(pe,H.text?D+te:te),T.push(pe)}}if(m!==null&&d>=m)throw new TypeError("Canopy capture exceeded its declared recordCount.");d++,yield T}if(m!==null&&d!==m)throw new TypeError("Canopy capture did not produce its declared recordCount.")}});return Object.freeze({source:l,request:Object.freeze({...I,columns:Object.freeze(y.map(d=>d.input))}),report:ee,tones:G,pivot:Z,ruleOperands:o})}const W=Object.freeze({canopyBadgeSplit:v,canopyIdentityValue:E,createCanopyExport:j,prepareCanopyExport:Q});return X.set("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7",W),W})(),Ge=X.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c")??(()=>{const{columnName:A,excelDate:M}=we,{captureFields:z}=se,{datetime:F}=le;function r(h,b,u,c,t,L,a){let w=0;const _={eq:"=",ne:"<>",gt:">",ge:">=",lt:"<",le:"<="},D=x=>{const f=typeof x=="boolean"||typeof x=="string"?Number(x):x;if(typeof x=="string"){const k=x.trim().toLowerCase();if(Number.parseFloat(x)!==f||["0x","0b","0o"].some(j=>k.startsWith(j)))return t("UNSUPPORTED_NUMERIC_RULE_LITERAL")}if(!Number.isFinite(f)||Math.abs(f)>Number.MAX_SAFE_INTEGER)throw new TypeError("Canopy rule comparison values must be finite safe-range numbers.");return f},N=x=>{if(u.datetime!=="typed"||(u.xlsx?.dateMode??h.timeZone)!=="utc")return t("DATETIME_RULE_REQUIRES_TYPED_UTC");if(typeof x=="boolean"||typeof x=="number"&&!Number.isSafeInteger(x))return t("UNSUPPORTED_DATETIME_RULE_LITERAL");try{const f=typeof x=="number"?new Date(x).toISOString():x,k=F(f,"typed","utc");if(!(k instanceof Date))return t("UNSUPPORTED_DATETIME_RULE_LITERAL");const j=M(k,"utc");return j===null?t("UNSUPPORTED_DATETIME_RULE_LITERAL"):j}catch(f){if(!(f instanceof TypeError)&&!(f instanceof RangeError))throw f;return t("UNSUPPORTED_DATETIME_RULE_LITERAL")}},S=x=>{if(++w>64)return t("RULE_PREDICATE_LIMIT");const f=z(x,["column","operator","values"]),k=_[f.operator];if(Object.keys(f).some(K=>!["column","operator","values"].includes(K)))return t("UNSUPPORTED_RULE_FILTER_OPTIONS");const j=h.columns.findIndex(K=>K.id===f.column);if(j<0)return t("RULE_COLUMN_NOT_EXPORTED:"+f.column);a?.add(f.column);const Q=h.columns[j],W=A(j+1+(b?1:0)),O="INDEX($"+W+":$"+W+",ROW())",P="NOT(ISBLANK("+O+"))";if(Q.kind==="number"&&L.set(j,"number"),Q.kind==="datetime"){if(u.datetime!=="typed"||(u.xlsx?.dateMode??h.timeZone)!=="utc")return t("DATETIME_RULE_REQUIRES_TYPED_UTC");L.set(j,"date")}if(f.operator==="isNull"||f.operator==="isNotNull")return f.values!==void 0&&f.values.length?t("UNSUPPORTED_NULL_RULE_OPERANDS"):f.operator==="isNull"?"ISBLANK("+O+")":P;if(!k||!Array.isArray(f.values)||f.values.length!==1)return t("UNSUPPORTED_RULE_FILTER:"+f.operator);const g=f.values[0];if(typeof g!="string"&&typeof g!="number"&&typeof g!="boolean")throw new TypeError("Canopy rule values must be portable scalars.");if(Q.kind==="number"||Q.kind==="datetime"){const K=Q.kind==="number"?D(g):N(g);return"AND("+P+",ISNUMBER("+O+"),"+O+k+String(K)+")"}if(f.operator!=="eq"&&f.operator!=="ne")return t("UNSUPPORTED_TEXT_RULE_COMPARISON");if(typeof g=="string")return t("UNQUALIFIED_NATIVE_TEXT_COMPARISON");const I=typeof g=="boolean"?"ISLOGICAL":"ISNUMBER",Z=typeof g=="boolean"?g?"TRUE":"FALSE":String(D(g)),R=I+"("+O+")",Y=O+k+Z;return f.operator==="eq"?"AND("+P+","+R+","+Y+")":"AND("+P+",OR(NOT("+R+"),"+Y+"))"},v=(x,f)=>{if(f>4||++w>64)return t("RULE_PREDICATE_LIMIT");if(!x||typeof x!="object")throw new TypeError("Canopy rule predicate must be an object.");const k=z(x,["operator","filters","groups"]);if(k.operator!=="and"&&k.operator!=="or")return t("UNSUPPORTED_RULE_BOOLEAN:"+k.operator);const j=k.filters??[],Q=k.groups??[];if(!Array.isArray(j)||!Array.isArray(Q))throw new TypeError("Canopy predicate filters and groups must be arrays.");const W=[];for(const O of j)W.push(S(O));for(const O of Q)W.push(v(O,f+1));return W.length?k.operator.toUpperCase()+"("+W.join(",")+")":t("EMPTY_RULE_PREDICATE")},E=v(c,1);return E.length>8192?t("RULE_FORMULA_LIMIT"):E}const n=Object.freeze({canopyPredicate:r});return X.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c",n),n})(),We=X.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8")??(()=>{const{captureFields:A}=se,{canopyPredicate:M}=Ge,{canopyDefaultTones:z,canopyTonePalette:F}=Oe;class r extends Error{}const n=u=>{throw new r(u)};function h(u,c,t,L,a,w={},_,D){if(u.formatRules===void 0||c==="csv")return[];if(!Array.isArray(u.formatRules)||u.formatRules.length>1e3)throw new TypeError("Canopy formatRules must be a bounded array of at most 1,000 declarations.");const N=[],S=[],v=[],E=new Set,x=u.columns,k=u.formatRules.map(e=>{if(!e||typeof e!="object")throw new TypeError("Canopy rule declarations must be objects.");const i=A(e,["id","enabled","stopIfTrue","column","when","target","style"]);if(typeof i.id!="string"||!i.id||E.has(i.id))throw new TypeError("Canopy rule IDs must be unique nonempty strings.");if(E.add(i.id),i.enabled!==void 0&&typeof i.enabled!="boolean"||i.stopIfTrue!==void 0&&typeof i.stopIfTrue!="boolean")throw new TypeError("Canopy rule flags must be boolean.");const V=i.style&&typeof i.style=="object"?A(i.style,["tone","bar","scale"]):i.style;return{...i,style:V}});if(c==="pdf"){for(const e of k)e.enabled!==!1&&a({code:"PDF_NATIVE_RULE_NOT_RENDERED:"+e.id});return[]}const j=k.some(e=>e.enabled!==!1&&e.stopIfTrue);if(j&&k.some(e=>e.enabled!==!1&&(e.style?.bar!==void 0||e.style?.scale!==void 0)))return a({code:"UNSUPPORTED_GLOBAL_STOP_WITH_NATIVE_VISUALS"}),[];const Q=new Set(k.filter(e=>e.enabled!==!1&&e.style?.bar!==void 0).map(e=>e.column)),W=k.find(e=>e.enabled!==!1&&e.target!=="row"&&e.style?.tone!==void 0&&e.column!==void 0&&Q.has(e.column));if(W)return a({code:"UNSUPPORTED_CELL_TONE_WITH_DATA_BAR",columnId:W.column}),[];const O=[],P=[],g=new Map,I=new Map,Z=new Set,R=e=>{const i=x.findIndex(V=>V.id===e);return i<0?n("RULE_COLUMN_NOT_EXPORTED:"+e):i},Y=e=>{x[R(e)].kind!=="number"&&n("RULE_COLUMN_NOT_NUMERIC:"+e)},K=e=>{const i=L.get(e),V=i?.background??i?.color??F[e]?.color;return V===void 0?n("UNMAPPED_RULE_TONE:"+e):V},ee=e=>{const i=L.get(e)??z.get(e);return i?"alignment"in i||"wrapText"in i?n("UNSUPPORTED_RULE_TONE_STYLE:"+e):{..."background"in i&&i.background!==void 0?{fill:{color:i.background}}:{},font:{...i.color===void 0?{}:{color:i.color},..."bold"in i&&i.bold!==void 0?{bold:i.bold}:{},..."italic"in i&&i.italic!==void 0?{italic:i.italic}:{}},..."numberFormat"in i&&i.numberFormat!==void 0?{numberFormat:i.numberFormat}:{}}:n("UNMAPPED_RULE_TONE:"+e)};for(const e of k)if(e.enabled!==!1)try{if(u.values!=="raw"&&n("NATIVE_RULE_REQUIRES_RAW_VALUES"),(e.target==="columns"||"columns"in e&&e.columns!==void 0)&&n("UNSUPPORTED_RULE_COLUMNS_TARGET"),!e.style||typeof e.style!="object"||Array.isArray(e.style))throw new TypeError("Canopy rule style must be an object.");const i=A(e.style,["tone","bar","scale"]);if(Object.keys(i).some(G=>!["tone","bar","scale"].includes(G))&&n("UNSUPPORTED_RULE_STYLE"),[i.bar,i.scale,i.tone].filter(G=>G!==void 0).length!==1&&n("UNSUPPORTED_RULE_STYLE_COMBINATION"),i.bar!==void 0){(e.column===void 0||e.when!==void 0||e.target==="row")&&n("UNSUPPORTED_BAR_TARGET"),Y(e.column),e.stopIfTrue&&n("UNSUPPORTED_BAR_STOP");const{minimum:G,maximum:U,tone:o="info",showValue:s}=A(i.bar,["minimum","maximum","tone","showValue"]);if(G===void 0||U===void 0)return n("UNBOUNDED_CANOPY_BAR");if(!Number.isFinite(G)||!Number.isFinite(U)||U<=G)throw new TypeError("Canopy bar bounds must be finite and increasing.");N.push({type:"dataBar",range:{column:e.column},color:K(o),minimum:{type:"number",value:G},maximum:{type:"number",value:U},...s===void 0?{}:{showValue:s}}),I.set(R(e.column),"number")}else if(i.scale!==void 0){e.stopIfTrue&&n("UNSUPPORTED_SCALE_STOP"),(e.column===void 0||e.when!==void 0||e.target==="row")&&n("UNSUPPORTED_SCALE_TARGET"),Y(e.column);const{stops:G}=A(i.scale,["stops"]);(!Array.isArray(G)||G.length<2||G.length>3)&&n("UNSUPPORTED_SCALE_STOPS");const U=G.map(o=>{const s=A(o,["type","value","tone"]);return["min","max","number","percent","percentile"].includes(s.type)||n("UNSUPPORTED_SCALE_THRESHOLD:"+s.type),{threshold:s.type==="min"||s.type==="max"?{type:s.type}:{type:s.type,value:s.value},color:K(s.tone)}});N.push({type:"colorScale",range:{column:e.column},stops:U}),I.set(R(e.column),"number")}else{(e.when===void 0||i.tone===void 0||e.target!=="row"&&e.column===void 0)&&n("UNSUPPORTED_HIGHLIGHT_TARGET"),e.target!==void 0&&e.target!=="row"&&e.target!=="cell"&&n("UNSUPPORTED_RULE_TARGET");const G=e.target==="row"?{column:x[0].id,through:x.at(-1).id}:{column:e.column};e.column!==void 0&&R(e.column);const U=new Map,o=new Set,s=M(u,t,w,e.when,n,U,o),y=O.length?"AND("+s+",NOT(OR("+O.join(",")+")))":s,m=e.target==="row"?P:g.get(e.column)??[],l=m.length?"AND("+y+",NOT(OR("+m.join(",")+")))":y;l.length>8192&&n("RULE_FORMULA_LIMIT"),(e.target==="row"?v:S).push({type:"expression",range:G,formula:l,style:ee(i.tone)}),m.push(s),e.target!=="row"&&g.set(e.column,m);for(const[d,C]of U)I.set(d,C);for(const d of o)Z.add(d);e.stopIfTrue&&O.push(s)}}catch(i){if(!(i instanceof r))throw i;if(a({code:i.message+":"+e.id,...e.column===void 0?{}:{columnId:e.column}}),j)return[]}for(const[e,i]of I)_?.set(e,i);for(const e of Z)D?.add(e);return Object.freeze([...N,...S,...v])}const b=Object.freeze({canopyRules:h});return X.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8",b),b})(),Be=X.get("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a")??(()=>{const{createGroupedReport:A}=Le,{checkAbort:M}=Te,{createTotals:z}=ke,{captureFields:F}=se,{datetime:r}=le,{canopyIdentityValue:n}=ue,h=t=>t instanceof Date?"date:"+t.getTime():typeof t+":"+String(t),b=n;function u(t,L,a,w,_,D){const N=L.grouping;if(N===void 0)return;if(L.values!=="raw"){_({code:"GROUPING_REQUIRES_RAW_VALUES"});return}if(t.rowCount===null)throw new TypeError("Captured grouping requires its exact scope recordCount.");const S=F(N,["levels","aggregates","totals","groups"]);if(!Array.isArray(S.levels)||S.levels.length<1||S.levels.length>4||!Array.isArray(S.aggregates)||!Array.isArray(S.groups))throw new TypeError("Canopy grouping needs one through four levels, aggregates and ordered groups.");const v=S.levels.map(o=>Object.freeze(F(o,["column","direction","title"])));if(v.some(o=>typeof o.column!="string"||!o.column||o.direction!=="asc"&&o.direction!=="desc")||new Set(v.map(o=>o.column)).size!==v.length)throw new TypeError("Canopy grouping levels need unique stable columns and directions.");const E=S.aggregates.map(o=>Object.freeze(F(o,["id","column","operation","label"]))),x=new Set,f=Object.create(null),k={sum:"sum",count:"count",average:"average",minimum:"min",maximum:"max"};for(const o of E){if(typeof o.id!="string"||!o.id||x.has(o.id))throw new TypeError("Canopy aggregate IDs must be unique nonempty strings.");x.add(o.id);const s=t.columns.find(m=>m.key===o.column);if(!s||s.type!=="number")throw new TypeError("Canopy aggregate declarations require an exported raw numeric column.");if(Object.hasOwn(f,o.column))throw new TypeError("The grouped report supports one aggregate operation per column.");const y=k[o.operation];if(y===void 0){_({code:"UNSUPPORTED_GROUP_AGGREGATE:"+o.operation,columnId:o.column});return}f[o.column]=y}z(t.columns,f);const j=o=>{if(!o||typeof o!="object"||Array.isArray(o))throw new TypeError("Canopy aggregate values must be an ID-keyed object.");const s={...o};if(Object.keys(s).some(y=>!x.has(y))||E.some(y=>!Object.hasOwn(s,y.id)))throw new TypeError("Canopy aggregate values must reference exactly the captured declarations.");for(const y of Object.values(s))if(y!==null&&(typeof y!="number"||!Number.isFinite(y)))throw new TypeError("Canopy aggregate values must be finite numbers or null.");return Object.freeze(s)},Q=j(S.totals),W=v.map(()=>[]),O=v.map(()=>new Map);let P=0,g=0;const I=(o,s,y,m)=>{if(!Array.isArray(o))throw new TypeError("Canopy groups must be ordered arrays.");let l=s;const d=new Set,C=new Set;for(const p of o){const T=F(p,["key","value","text","offset","count","aggregates","groups"]);if(!T||typeof T.key!="string"||d.has(T.key)||!Number.isSafeInteger(T.offset)||!Number.isSafeInteger(T.count)||T.count<=0||T.offset!==l||T.count>y-T.offset)throw new TypeError("Canopy group ranges must be nonempty contiguous half-open partitions within their parent.");if(T.value!==null&&!["string","number","boolean"].includes(typeof T.value)||typeof T.value=="number"&&!Number.isFinite(T.value))throw new TypeError("Canopy group values must be portable finite scalars.");const B=L.columns.find(re=>re.id===v[m].column)?.kind==="datetime",H=D==="xlsx"&&B&&typeof T.value=="string"?r(T.value,a.datetime??"preserve",a.xlsx?.dateMode??L.timeZone):T.value,J=h(H),$=T.text??String(T.value??"");if(typeof $!="string"||C.has(J))throw new TypeError("A Canopy group key cannot recur within the same parent.");const te=O[m].get(J);if(te!==void 0&&te!==$)throw new TypeError("The same grouping value needs consistent captured text at one level.");if(O[m].set(J,$),d.add(T.key),C.add(J),++P>1e3||(g+=T.key.length+J.length+$.length)>1e6)throw new RangeError("Canopy group metadata exceeds the existing bounded report profile.");const oe=T.offset+T.count;if(W[m].push(Object.freeze({offset:T.offset,end:oe,value:H,text:$,expected:j(T.aggregates)})),m+1<v.length)I(T.groups??[],T.offset,oe,m+1);else if(T.groups!==void 0&&T.groups.length)throw new TypeError("Canopy nested groups exceed their declared levels.");l=oe}if(l!==y)throw new TypeError("Canopy grouping does not cover its complete exported detail range.")};I(S.groups,0,t.rowCount,0);const Z=()=>{const o=z(t.columns,f),s=t.columns.map(()=>0),y=t.columns.map(()=>0),m=t.columns.map(()=>0);return{accept(l){for(let d=0;d<l.length;d++){const C=b(l[d]),p=f[t.columns[d].key];if(p!=="sum"&&p!=="average"){o[d].accept(C);continue}if(typeof C!="number"||!Number.isFinite(C))continue;m[d]=m[d]+1;const T=C-y[d],B=s[d]+T;y[d]=B-s[d]-T,s[d]=B}},value(l){const d=f[t.columns[l].key];return d==="sum"||d==="average"?m[l]?d==="sum"?s[l]:s[l]/m[l]:null:o[l].value()}}},R=v.map(()=>0),Y=v.map(()=>{}),K=(o,s)=>{const y=W[o];for(;y[R[o]]&&y[R[o]].end<=s;)R[o]=R[o]+1;const m=y[R[o]];if(!m||s<m.offset||s>=m.end)throw new TypeError("A detail row is outside its captured Canopy grouping.");return m},ee=(o,s)=>{for(const y of E){const m=t.columns.findIndex(C=>C.key===y.column),l=o.value(m),d=s[y.id];if(l!==d)throw new TypeError("Canopy captured aggregate differs from its consumed rows: "+y.id+".")}},e=(o,s)=>o instanceof Date&&s instanceof Date?o.getTime()===s.getTime():o===s;async function*i(){let o=0;const s=Z();for await(const y of t.rows()){M(a.signal);for(let m=0;m<v.length;m++){const l=K(m,o),d=t.columns.findIndex(C=>C.key===v[m].column);if(d>=0&&!e(b(y[d]),l.value))throw new TypeError("Canopy detail value disagrees with its captured group range.");l.offset===o&&(Y[m]={range:l,aggregates:Z()})}s.accept(y);for(const m of Y)m.aggregates.accept(y);yield y,o++;for(let m=v.length-1;m>=0;m--){const l=Y[m];l.range.end===o&&(ee(l.aggregates,l.range.expected),Y[m]=void 0)}}ee(s,Q)}const V=new Set([...t.columns.map(o=>o.key),...v.map(o=>o.column)]),G=v.map((o,s)=>{const y=t.columns.findIndex(l=>l.key===o.column);let m=o.column;if(y>=0){do m+="#raw";while(V.has(m));V.add(m)}return{key:m,value:(l,d)=>y<0?K(s,d.rowIndex).value:b(l[y]),label:l=>O[s].get(h(l))??String(l??"")}}),U=w===void 0?void 0:{...w.maxRows===void 0?{}:{maxRows:w.maxRows},...w.maxCells===void 0?{}:{maxCells:w.maxCells},...w.maxTextCharacters===void 0?{}:{maxTextCharacters:w.maxTextCharacters}};return A(i(),{columns:t.columns,groupBy:G,totals:f,...a.signal===void 0?{}:{signal:a.signal},...U===void 0?{}:{limits:U}})}const c=Object.freeze({canopyGrouped:u});return X.set("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a",c),c})(),He=X.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8")??(()=>{const{cellText:A}=we,{cleanXml:M}=Ie;function z(r,n){const h=[["revision",r.revision],["recordCount",r.recordCount===null?"unknown":r.recordCount]];if(r.scope!==void 0){if(!["filtered","visible","selected","all"].includes(r.scope))throw new TypeError("Invalid Canopy export scope.");h.push(["scope",r.scope])}for(const b of["total","matched"])if(r[b]!==void 0){const u=r[b];if(u===null){h.push([b,"unknown"]);continue}if(!Number.isSafeInteger(u)||u<0)throw new TypeError("Canopy metadata counts must be nonnegative safe integers.");h.push([b,u])}if(r.generatedAt!==void 0){if(typeof r.generatedAt!="string"||!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,9})?Z$/.test(r.generatedAt)||!Number.isFinite(new Date(r.generatedAt).getTime()))throw new TypeError("Canopy generatedAt must be a captured UTC ISO instant.");h.push(["generatedAt",r.generatedAt])}if(r.selection!==void 0){if(!Array.isArray(r.selection)||r.selection.some(b=>typeof b!="string"))throw new TypeError("Canopy selection metadata must contain stable string IDs.");h.push(["selection",JSON.stringify(r.selection)])}if(r.query!==void 0){if(!r.query||typeof r.query!="object"||Array.isArray(r.query))throw new TypeError("Canopy accepted query must be a captured object.");const b=JSON.stringify(r.query);if(typeof b!="string")throw new TypeError("Canopy accepted query must serialize as JSON metadata.");h.push(["query",b])}if(h.reduce((b,u)=>b+u[0].length+String(u[1]).length,0)>65536)throw new RangeError("Canopy About metadata exceeds 65,536 captured characters.");for(const[b,u]of h)A(b,n.invalidCharacterPolicy),n.oversizedText==="preserve"?M(u,n.invalidCharacterPolicy):A(u,n.invalidCharacterPolicy);return Object.freeze(h.map(b=>Object.freeze(b)))}const F=Object.freeze({canopyAbout:z});return X.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",F),F})(),Xe=X.get("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8")??(()=>{const{Workbook:A,addGroupedXlsx:M}=ge,{portableWorkbook:z}=De,{withDestination:F}=Fe;async function r(h,b,u,c,t,L){const{sheet:a={},columns:w,..._}=c,{name:D="Data",...N}=a;if(L&&D.toLowerCase()==="about")throw new TypeError("The optional About worksheet needs a distinct data-sheet name.");if(b&&_.cellValueWriters!==void 0)throw new TypeError("Grouped Canopy exports use resolved source values rather than custom cellValueWriters.");return F(u,async S=>{const v={...z(_),sink:S},E=b?new A(v):A.forTable(v);try{let x,f;if(b){const{conditionalFormats:j,...Q}=N,W=await M(E,b,{labelColumn:{header:t?.labelColumn?.header??"Group",width:18},subtotalLabel:t?.subtotalLabel??(O=>O.label+" total"),grandTotalLabel:t?.grandTotalLabel??(()=>"Grand total"),...t?.includeGrandTotal===void 0?{}:{includeGrandTotal:t.includeGrandTotal},sheet:{...Q,name:D},...j===void 0?{}:{conditionalFormats:j}});x=W.rows,f=W.columns}else{const j=E.addWorksheet(D,{boldHeader:!0,autoFilter:N.includeHeader!==!1,autoSize:{minWidth:6,maxWidth:54},...N,columns:h.columns});await j.addRows(h.rows()),await j.close(),x=j.rowCount,f=h.columns.length}if(L){const j=E.addWorksheet("About",{columns:[{header:"Field",width:18},{header:"Value",width:72,wrapText:!0}],boldHeader:!0,freezeHeader:!0});await j.addRows(L),await j.close()}const k=await E.finish();return{rows:x,columns:f,bytes:k.bytes}}catch(x){throw await E.discard(x),x}})}const n=Object.freeze({writeCanopyWorkbook:r});return X.set("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8",n),n})(),Ve=X.get("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d")??(()=>{const{ExportCell:A}=de,{canopyBadgeSplit:M}=ue;function z(u){if(u===void 0||u==="General")return{minimumFractionDigits:0,maximumFractionDigits:20,percent:!1,grouping:!1,prefix:"",suffix:""};const c=/^((?:"[^"]*"|\\["%])*)(#,##)?0(?:\.([0#]+))?(%)?((?:"[^"]*"|\\["%])*)$/.exec(u);if(!c||(c[3]?.length??0)>10)return;const t=L=>L.replace(/"([^"]*)"|\\(["%])/g,(a,w,_)=>w??_);return{minimumFractionDigits:(c[3]?.match(/0/g)??[]).length,maximumFractionDigits:c[3]?.length??0,percent:!!c[4],grouping:!!c[2],prefix:t(c[1]),suffix:t(c[5])}}function F(u,c){let t=u,L=!1;c.prefix&&t.startsWith(c.prefix)?t=t.slice(c.prefix.length):c.prefix&&/^[+\-\u2212]/.test(t)&&t.slice(1).startsWith(c.prefix)&&(L=!0,t=t[0]+t.slice(1+c.prefix.length)),c.suffix&&t.endsWith(c.suffix)&&(t=t.slice(0,-c.suffix.length));const a=/^([^0-9+\-\u2212]*)([+\-\u2212]?\d[\d., \u00a0\u202f]*?)([^0-9]*)$/.exec(t);return a?{prefix:c.prefix||a[1],number:a[2],suffix:c.suffix||a[3],signBeforePrefix:L}:void 0}function r(u,c){if(!/^[+\-\u2212]?\d{1,3}(?:,\d{3})+$/.test(u)&&!/^[+\-\u2212]?\d{1,3}(?:\.\d{3})+$/.test(u))return!1;const t=Number(u.replace(/[.,]/g,"").replace("−","-"));return t!==0&&Math.abs(t-c)<=.5}function n(u,c){let t;for(const L of[!0,!1]){for(const a of u)for(let w=0;w<c.length;w++){const _=a[w],D=c[w];if(!(_ instanceof A)||typeof _.value!="number")continue;const N=z(_.presentation?.numberFormat??D.format);if(!N)continue;const S=M(_).text,v=F(S,N);if(!v)continue;const E=N.percent||N.prefix.includes("%")||N.suffix.includes("%")||S.includes("%");if(E!==L)continue;const x=/([.,])(\d+)$/.exec(v.number.trimEnd());if(x){const f=v.number;if(r(f,_.value)||E&&r(f,_.value*100)){t=x[1]===","?".":",";continue}return x[1]}}if(t!==void 0)return t}return"."}function h(u,c){const t=new Map,L=n(u,c);return a=>a.map((w,_)=>{if(!(w instanceof A)||typeof w.value!="number")return w;const D=w.presentation?.numberFormat??c[_].format;let N=z(D);const{text:S,suffix:v}=M(w);if(!N||S==="")return w;const E=F(S,N);if(S&&!E||(D===void 0||D==="General")&&E&&(E.prefix.trim()||E.suffix.trim()))return w;if(D===void 0||D==="General"){const O=Number.isInteger(w.value)||E&&r(E.number,w.value)?0:E?/[.,](\d+)$/.exec(E.number.trimEnd())?.[1]?.length??0:void 0;O!==void 0&&O<=20&&(N={...N,minimumFractionDigits:O,maximumFractionDigits:O})}const x=[N.minimumFractionDigits,N.maximumFractionDigits,N.grouping].join(":");let f=t.get(x);f||(f=new Intl.NumberFormat(L===","?"de-DE":"en-US",{minimumFractionDigits:N.minimumFractionDigits,maximumFractionDigits:N.maximumFractionDigits,useGrouping:N.grouping}),t.set(x,f));let k=f.format(w.value*(N.percent?100:1));E?.number.startsWith("+")&&!k.startsWith("-")&&(k="+"+k);const j=E?.signBeforePrefix?/^[+-]/.exec(k)?.[0]??"":"";j&&(k=k.slice(1));const Q=E?.prefix||N.prefix;let W=E?.suffix||N.suffix;return N.percent&&!N.suffix&&(W=W.replace(/%/g,"")),new A(w.value,{text:j+Q+k+(N.percent?"%":"")+W+v,...w.presentation?{presentation:w.presentation}:{},...w.link?{link:w.link}:{}})})}const b=Object.freeze({canopyPdfNumbers:h});return X.set("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d",b),b})(),Ye=X.get("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49")??(()=>{const{ExportCell:A,NotSupportedError:M,OfficeIMOError:z}=de,{inputRows:F,checkAbort:r,pause:n,taskYieldDue:h}=Te,{fontProgram:b}=xe,{resolveScalar:u,selectFont:c,validateFonts:t}=je,{settings:L}=ye,{canopyPdfNumbers:a}=Ve;async function w(D,N,S,v){const E=L({...S,columns:D.columns}),{fontSize:x,padding:f,page:k,margins:j,limits:Q}=E;S=E.options,t(S.fonts,Q.maxFontBytes);const W=k.width-j.left-j.right,O=F(D.rows(),S.signal)[Symbol.asyncIterator](),P=[];let g=!1,I=0;try{for(;P.length<Math.min(128,S.limits?.maxRows??128)&&I<262144;){const i=await O.next();if(i.done){g=!0;break}P.push(i.value),I+=i.value.reduce((V,G)=>V+(G instanceof A?G.text?.length??0:String(G??"").length),0)}const Z=a(P,D.columns),R=P.map(Z),Y=(i,V=!1,G=!1)=>{if(i.length>Q.maxCellCharacters)throw new z("RESOURCE_LIMIT","maxCellCharacters exceeded.");const U=c(S.fonts,V,G),o=U.font?b(U.font):void 0;let s=0;for(const y of i.replace(/\t/g," ")){const m=u(y.codePointAt(0),o,V);if(!m.supported)throw new M(m.message);s+=m.width*x/1e3}return s},K=(i,V=!1,G=!1)=>i.reduce((U,o)=>Math.max(U,Y(o,V,G)),0);let ee={};if(!S.columnWidths&&typeof S.wideTable!="object"&&!S.textShaper){const i=D.columns.map(o=>Math.min(W,K(o.header.split(/\s+/),E.options.headerPresentation?.bold)+f*2+.01)),V=D.columns.map((o,s)=>Math.min(W,Math.max(i[s],K(o.header.split(/\r\n?|\n/),E.options.headerPresentation?.bold)+f*2+.01)));for(const o of R){for(let s=0;s<o.length;s++){const y=o[s],m=y instanceof A?y.text??String(y.value??""):String(y??""),l=y instanceof A?y.presentation:void 0,d=K(m.split(/\r\n?|\n/),l?.bold,l?.italic)+f*2+.01,C=K(m.split(/\s+/),l?.bold,l?.italic)+f*2+.01;V[s]=Math.min(W,Math.max(V[s],d)),i[s]=Math.min(W,Math.max(i[s],N[s].kind==="text"?C:d))}h()&&await n(),r(S.signal)}const G=i.reduce((o,s)=>o+s,0),U=[...i];if(G>W+.001)ee={columnWidths:U,wideTable:S.wideTable==="reject"?"reject":{mode:"bands",repeatColumns:U[0]+Math.max(...U.slice(1))<=W?[0]:[]}};else{let o=W-G;const s=V.map((l,d)=>Math.max(0,l-U[d])),y=s.reduce((l,d)=>l+d,0);for(let l=0;l<U.length;l++)U[l]+=y?s[l]*Math.min(1,o/y):0;o=W-U.reduce((l,d)=>l+d,0);const m=N.flatMap((l,d)=>l.kind==="text"?[d]:[]);for(const l of m.length?m:U.map((d,C)=>C))U[l]+=o/(m.length||U.length);ee={columnWidths:U}}}return await v(async function*(){for(const i of R)yield i;for(;!g;){const i=await O.next();if(i.done){g=!0;break}yield Z(i.value)}}(),ee,E.options)}finally{if(!g)try{O.return(void 0).catch(()=>{})}catch{}}}const _=Object.freeze({withCanopyPdfLayout:w});return X.set("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49",_),_})(),Ke=X.get("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54")??(()=>{const{BlobByteSink:A,ExportCell:M}=de,{notifyProgress:z,notifySynchronously:F}=ve,{captureFields:r}=se,{captureCommonLimits:n,captureXlsxOptions:h,captureCsvOptions:b,capturePdfOptions:u,mergeAdapterLimits:c}=Me,{writeXlsxTo:t}=ge,{writeCsvTo:L}=Pe,{writePdfTo:a,writeGroupedPdfTo:w}=Se,{canopyDiagnostics:_}=Ee,{prepareCanopyExport:D}=ue,{canopyPins:N}=Ce,{canopyRules:S}=We,{canopyGrouped:v}=Be,{canopyAbout:E}=He,{writeCanopyWorkbook:x}=Xe,{withCanopyPdfLayout:f}=Ye,k="E7EDF5",j=Object.freeze({bottom:Object.freeze({style:"thin",color:"A6B4C8"})});async function Q(P,g,I,Z={}){const R=r(Z,["tones","columnOptions","unsupportedPresentation","datetime","xlsx","csv","pdf","signal","onDiagnostic","limits","onProgress","grouped","about"]),{signal:Y,onProgress:K}=R,ee=n(R.limits),e=h(g==="xlsx"?R.xlsx:void 0),i=b(g==="csv"?R.csv:void 0),V=u(g==="pdf"?R.pdf:void 0),G=D(P,g,{...R,xlsx:e}),{request:U,report:o,tones:s,pivot:y}=G;if(R.about!==void 0&&typeof R.about!="boolean")throw new TypeError("Canopy about must be boolean.");const m=R.grouped===void 0?void 0:r(R.grouped,["labelColumn","subtotalLabel","grandTotalLabel","includeGrandTotal","continuationLabel","groupHeadingLevel"]),l=m&&{...m,...m.labelColumn===void 0?{}:{labelColumn:Object.freeze({header:m.labelColumn.header})}},d=g==="xlsx"&&R.about?E(U,e):void 0,C=new Map;let p=0;const T=Object.freeze({...G.source,async*rows(){for await(const J of G.source.rows()){for(const[$,te]of C){const oe=J[$],re=oe instanceof M?oe.value:oe;if(re==null||te==="number"&&typeof re=="number"&&Number.isFinite(re)||te==="date"&&re instanceof Date&&Number.isFinite(re.getTime()))continue;const ne="UNSUPPORTED_NATIVE_RULE_CELL_TYPE:"+te;throw o({code:ne,columnId:T.columns[$].key}),new TypeError("Unsupported Canopy presentation: "+ne+" ("+T.columns[$].key+")")}p++,yield J}}}),H={...Y?{signal:Y}:{},...K?{onProgress:J=>{z(K,{...J,rows:p,...J.sheetRows===void 0?{}:{sheetRows:d!==void 0&&J.sheetName==="About"?0:p},...T.rowCount===null?{}:{totalRows:T.rowCount}})}}:{}};if(g==="xlsx"){const J=c(e.limits,ee),$=y?void 0:v(T,U,{...R,xlsx:e},J,o,g),te=N(U.columns,o),oe=S(U,g,$!==void 0,s,o,{...R,xlsx:e},C,G.ruleOperands);if(y&&(e.sheet?.rowOutline!==void 0||e.sheet?.columnOutlines!==void 0||e.sheet?.maxOutlineLevel!==void 0||e.sheet?.outlineSummaryBelow!==void 0||e.sheet?.outlineSummaryRight!==void 0||e.sheet?.table!==void 0||e.sheet?.footer!==void 0))throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");if(y&&e.cellValueWriters!==void 0)throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");const re={headerFill:k,headerBorder:j,headerWrap:!0,...e.sheet,...y?.sheet??{},...y?{autoFilter:!1}:{},freezeHeader:e.sheet?.freezeHeader??e.sheet?.includeHeader!==!1,freezeColumns:e.sheet?.freezeColumns??(te?te+($?1:0):0),conditionalFormats:[...oe,...e.sheet?.conditionalFormats??[]]},ne=_(g,{...R,unsupportedPresentation:"text"}),ce=e.onHyperlinkOverflow,ie={...e,...H,columns:T.columns,sheet:re,dateMode:e.dateMode??U.timeZone,limits:J,hyperlinkOverflow:e.hyperlinkOverflow??"drop",onHyperlinkOverflow:ae=>{F("onHyperlinkOverflow",ce,ae),ne({code:"LINKS_TRUNCATED:"+ae.dropped})}};return $||d?x(T,$,I,ie,l,d):t(T.rows(),I,ie)}if(y&&_(g,{...R,unsupportedPresentation:"text"})({code:"PIVOT_OUTLINES_XLSX_ONLY"}),g==="pdf"){if(y&&V.footer?.totals!==void 0)throw new TypeError("Captured pivot metadata owns totals; PDF footer totals cannot recalculate it.");const J=c(V.limits,ee),$=y?void 0:v(T,U,R,J,o,g);S(U,g,$!==void 0,s,o,R);const te=U.columns.every(ne=>ne.width!==void 0)?U.columns.map(ne=>ne.width.preferred*72/96):void 0,oe=V.columnWidths??te,re={orientation:"landscape",wideTable:"fit",...V,...H,limits:J};if($){if(V.headerRows!==void 0||V.footer!==void 0)throw new TypeError("Grouped Canopy PDF owns heading and summary rows.");const{headerRows:ne,footer:ce,...ie}=re;return w($,I,{...ie,...oe===void 0?{}:{columnWidths:[72,...oe]},labelColumn:{header:l?.labelColumn?.header??"Group",width:12},subtotalLabel:l?.subtotalLabel??(ae=>ae.label+" total"),grandTotalLabel:l?.grandTotalLabel??(()=>"Grand total"),...l?.includeGrandTotal===void 0?{}:{includeGrandTotal:l.includeGrandTotal},...l?.continuationLabel===void 0?{}:{continuationLabel:l.continuationLabel},...l?.groupHeadingLevel===void 0?{}:{groupHeadingLevel:l.groupHeadingLevel}})}return f(G.source,U.columns,re,async(ne,ce,ie)=>a(async function*(){for await(const fe of ne)p++,yield fe}(),I,{...ie,...ce,columns:T.columns}))}return L(T.rows(),I,{...i,...H,columns:T.columns,valueMode:U.values,limits:c(i.limits,ee)})}async function W(P,g,I={}){const Z=new A;try{return await Q(P,g,Z,I),Z.toBlob(g==="xlsx"?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":g==="pdf"?"application/pdf":"text/csv;charset=utf-8")}catch(R){throw Z.discard(),R}}const O=Object.freeze({createCanopyExport:ue.createCanopyExport,ExportCell:he.ExportCell,PdfFont:xe.PdfFont,writeCanopyTo:Q,exportCanopy:W});return X.set("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54",O),O})();Object.assign(be,Ke)})(globalThis);
|