@evotecit/officeimo 0.1.19 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -10
- package/bundles/officeimo-canopyx-adapter.js +147 -65
- package/bundles/officeimo-canopyx-adapter.min.js +1 -1
- package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
- package/bundles/officeimo-canopyx-adapter.mjs +134 -53
- package/bundles/officeimo-canopyx.js +554 -234
- package/bundles/officeimo-canopyx.min.js +1 -1
- package/bundles/officeimo-canopyx.min.mjs +1 -1
- package/bundles/officeimo-canopyx.mjs +477 -158
- 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 +418 -180
- package/bundles/officeimo-datatables.min.js +1 -1
- package/bundles/officeimo-datatables.min.mjs +1 -1
- package/bundles/officeimo-datatables.mjs +350 -112
- 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 +136 -59
- package/bundles/officeimo-xlsx.min.js +1 -1
- package/bundles/officeimo-xlsx.min.mjs +1 -1
- package/bundles/officeimo-xlsx.mjs +114 -37
- package/bundles/officeimo.js +416 -178
- package/bundles/officeimo.min.js +1 -1
- package/bundles/officeimo.min.mjs +1 -1
- package/bundles/officeimo.mjs +351 -113
- package/dist/core/progress.js +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/integrations/canopyx/index.js +13 -4
- package/dist/integrations/canopyx/pdf-number.js +9 -6
- package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
- package/dist/integrations/canopyx/rule-predicates.js +2 -1
- package/dist/integrations/canopyx/rules.d.ts +1 -1
- package/dist/integrations/canopyx/rules.js +11 -13
- package/dist/integrations/canopyx/source.js +57 -7
- package/dist/integrations/canopyx/tones.d.ts +10 -0
- package/dist/integrations/canopyx/tones.js +12 -0
- package/dist/integrations/canopyx/types.d.ts +8 -1
- 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 +2 -2
- package/dist/xlsx/portable.js +1 -1
- package/dist/xlsx/styles.js +28 -18
- package/dist/xlsx/types.d.ts +13 -1
- package/dist/xlsx/workbook.js +9 -1
- package/dist/xlsx/worksheet.d.ts +13 -1
- package/dist/xlsx/worksheet.js +65 -11
- package/package.json +9 -2
|
@@ -972,19 +972,24 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
|
|
|
972
972
|
return _exports;
|
|
973
973
|
})();
|
|
974
974
|
|
|
975
|
-
const _m14 = _modules.get("
|
|
975
|
+
const _m14 = _modules.get("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244") ?? (() => {
|
|
976
976
|
/** @internal Notify synchronously; observe an accidental promise before rejecting its unsupported use. */
|
|
977
977
|
function notifyProgress(callback, progress) {
|
|
978
|
+
notifySynchronously("onProgress", callback, progress);
|
|
979
|
+
}
|
|
980
|
+
/** @internal Run a host notification that must finish before the export continues. A returned promise is observed,
|
|
981
|
+
* so its rejection is never unhandled, and the export fails instead of reporting success before the callback ends. */
|
|
982
|
+
function notifySynchronously(name, callback, value) {
|
|
978
983
|
if (!callback)
|
|
979
984
|
return;
|
|
980
|
-
const result = callback(
|
|
985
|
+
const result = callback(value);
|
|
981
986
|
if (result && typeof result.then === "function") {
|
|
982
987
|
void Promise.resolve(result).catch(() => { });
|
|
983
|
-
throw new TypeError("
|
|
988
|
+
throw new TypeError(name + " must be synchronous.");
|
|
984
989
|
}
|
|
985
990
|
}
|
|
986
|
-
const _exports = Object.freeze({ notifyProgress: notifyProgress });
|
|
987
|
-
_modules.set("
|
|
991
|
+
const _exports = Object.freeze({ notifyProgress: notifyProgress, notifySynchronously: notifySynchronously });
|
|
992
|
+
_modules.set("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244", _exports);
|
|
988
993
|
return _exports;
|
|
989
994
|
})();
|
|
990
995
|
|
|
@@ -1197,7 +1202,7 @@ _modules.set("9b33d9107e62ba8299c576072de40d24a261464f118de4ace64f23154fc78307",
|
|
|
1197
1202
|
return _exports;
|
|
1198
1203
|
})();
|
|
1199
1204
|
|
|
1200
|
-
const _m17 = _modules.get("
|
|
1205
|
+
const _m17 = _modules.get("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02") ?? (() => {
|
|
1201
1206
|
const { OfficeIMOError } = _m2;
|
|
1202
1207
|
|
|
1203
1208
|
const { ExportBudget } = _m9;
|
|
@@ -1224,12 +1229,16 @@ const sizes = {
|
|
|
1224
1229
|
};
|
|
1225
1230
|
/** @internal Shared capture schema for thin format adapters and the grouped writer. */
|
|
1226
1231
|
const pdfOptionFields = ["columns", "signal", "onProgress", "limits", "textShaper", "textDirection", "pageSize", "orientation", "margins", "fonts", "tagged", "fontSize",
|
|
1227
|
-
"title", "messageTop", "messageBottom", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "padding",
|
|
1232
|
+
"title", "metadataTitle", "messageTop", "messageBottom", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "padding",
|
|
1228
1233
|
"columnWidths", "wideTable", "pageHeader", "pageFooter", "pageNumbers", "pageNumberLabels", "booleanText", "formatValue", "formatRuns", "compression", "paragraphStyles"];
|
|
1229
1234
|
/** @internal Complete PDF limit schema used when a host combines format and shared limits. */
|
|
1230
1235
|
const pdfLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxPages", "maxColumns", "maxTableBands", "maxTableWindowRows", "maxCellCharacters", "maxTextRuns", "maxGroupBlocks", "maxRowLines",
|
|
1231
1236
|
"maxFontBytes", "maxPageBytes", "maxHyperlinks", "maxImageBytes", "maxImagePixels", "maxImageWorkingBytes", "maxVectorCommands", "maxDrawingElements", "maxStructureElements",
|
|
1232
1237
|
"maxMarkedContentReferences", "maxSections", "maxBookmarks", "maxListItems", "maxParagraphStyles"];
|
|
1238
|
+
/** @internal Default ceilings shared by the drawing writer and its producers. */
|
|
1239
|
+
const pdfDrawingLimits = Object.freeze({ maxVectorCommands: 100000, maxDrawingElements: 100000 });
|
|
1240
|
+
/** @internal Maximum number of retained drawing levels including the leaf. */
|
|
1241
|
+
const pdfDrawingMaxDepth = 32;
|
|
1233
1242
|
/** @internal Capture supported structural properties once, including class-based options with prototype accessors. */
|
|
1234
1243
|
function capturePdfOptions(input) {
|
|
1235
1244
|
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
@@ -1340,7 +1349,7 @@ function settings(input, document = false) {
|
|
|
1340
1349
|
footerPresentation: Object.freeze({ background: "eef2f6", bold: true, ...presentation(configuration.footerPresentation) }) };
|
|
1341
1350
|
const budget = new ExportBudget(options.limits);
|
|
1342
1351
|
const limits = { maxPages: 10000, maxColumns: 1024, maxTableBands: 64, maxTableWindowRows: 256, maxCellCharacters: 1000000, maxTextRuns: 10000, maxGroupBlocks: 256, maxRowLines: 100000, maxFontBytes: 16 * 1024 * 1024, maxPageBytes: 8 * 1024 * 1024, maxHyperlinks: 100000,
|
|
1343
|
-
maxImageBytes: 32 * 1024 * 1024, maxImagePixels: 16 * 1024 * 1024,
|
|
1352
|
+
maxImageBytes: 32 * 1024 * 1024, maxImagePixels: 16 * 1024 * 1024, ...pdfDrawingLimits,
|
|
1344
1353
|
maxStructureElements: 1000000, maxMarkedContentReferences: 2000000,
|
|
1345
1354
|
maxListItems: 100000, maxParagraphStyles: 256, maxSections: 1000, maxBookmarks: 10000 };
|
|
1346
1355
|
for (const key of Object.keys(limits)) {
|
|
@@ -1368,7 +1377,7 @@ function settings(input, document = false) {
|
|
|
1368
1377
|
const fontSize = positive(options.fontSize ?? 9, "Font size", 144), padding = options.padding ?? 4;
|
|
1369
1378
|
if (!Number.isFinite(padding) || padding < 0 || padding > 72)
|
|
1370
1379
|
throw new RangeError("PDF padding must be from 0 through 72 points.");
|
|
1371
|
-
for (const key of ["title", "messageTop", "messageBottom"])
|
|
1380
|
+
for (const key of ["title", "metadataTitle", "messageTop", "messageBottom"])
|
|
1372
1381
|
if (options[key] !== undefined && typeof options[key] !== "string")
|
|
1373
1382
|
throw new TypeError(key + " must be text.");
|
|
1374
1383
|
for (const key of ["pageHeader", "pageFooter"])
|
|
@@ -1404,18 +1413,18 @@ function settings(input, document = false) {
|
|
|
1404
1413
|
repeatedColumns: document ? Object.freeze([]) : repeatedColumns(options.wideTable, columns),
|
|
1405
1414
|
limits: { ...limits, ...(maxImageWorkingBytes === undefined ? {} : { maxImageWorkingBytes }) }, budget };
|
|
1406
1415
|
}
|
|
1407
|
-
const _exports = Object.freeze({ positive: _m20.positive, color: _m20.color, presentation: _m20.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
1408
|
-
_modules.set("
|
|
1416
|
+
const _exports = Object.freeze({ positive: _m20.positive, color: _m20.color, presentation: _m20.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, pdfDrawingLimits: pdfDrawingLimits, pdfDrawingMaxDepth: pdfDrawingMaxDepth, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
1417
|
+
_modules.set("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02", _exports);
|
|
1409
1418
|
return _exports;
|
|
1410
1419
|
})();
|
|
1411
1420
|
|
|
1412
|
-
const _m22 = _modules.get("
|
|
1421
|
+
const _m22 = _modules.get("fd70ccda89f27c6b874c8840ac944b3ec723dbdef3dfe7600f7bdb81f4660c96") ?? (() => {
|
|
1413
1422
|
const { captureFields } = _m10;
|
|
1414
1423
|
|
|
1415
1424
|
/** @internal The workbook owner captures these settings before validation or adapter merging. */
|
|
1416
|
-
const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
|
|
1425
|
+
const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "hyperlinkOverflow", "onHyperlinkOverflow", "creator", "title", "subject", "description", "created", "modified"];
|
|
1417
1426
|
/** @internal Worksheet settings also used by the portable sheet owner. */
|
|
1418
|
-
const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
|
|
1427
|
+
const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
|
|
1419
1428
|
/** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
|
|
1420
1429
|
const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
|
|
1421
1430
|
/** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
|
|
@@ -1428,11 +1437,11 @@ function captureWorkbookOptions(options) {
|
|
|
1428
1437
|
return { ...captured, ...(captured.limits === undefined ? {} : { limits: captureWorkbookLimits(captured.limits) }) };
|
|
1429
1438
|
}
|
|
1430
1439
|
const _exports = Object.freeze({ workbookOptionFields: workbookOptionFields, sheetOptionFields: sheetOptionFields, workbookLimitFields: workbookLimitFields, captureWorkbookLimits: captureWorkbookLimits, captureWorkbookOptions: captureWorkbookOptions });
|
|
1431
|
-
_modules.set("
|
|
1440
|
+
_modules.set("fd70ccda89f27c6b874c8840ac944b3ec723dbdef3dfe7600f7bdb81f4660c96", _exports);
|
|
1432
1441
|
return _exports;
|
|
1433
1442
|
})();
|
|
1434
1443
|
|
|
1435
|
-
const _m15 = _modules.get("
|
|
1444
|
+
const _m15 = _modules.get("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9") ?? (() => {
|
|
1436
1445
|
const { captureFields } = _m10;
|
|
1437
1446
|
|
|
1438
1447
|
const { ExportBudget } = _m9;
|
|
@@ -1473,7 +1482,7 @@ function capturePdfOptions(input = {}) {
|
|
|
1473
1482
|
return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
|
|
1474
1483
|
}
|
|
1475
1484
|
const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
|
|
1476
|
-
_modules.set("
|
|
1485
|
+
_modules.set("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9", _exports);
|
|
1477
1486
|
return _exports;
|
|
1478
1487
|
})();
|
|
1479
1488
|
|
|
@@ -2434,7 +2443,7 @@ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148",
|
|
|
2434
2443
|
return _exports;
|
|
2435
2444
|
})();
|
|
2436
2445
|
|
|
2437
|
-
const _m32 = _modules.get("
|
|
2446
|
+
const _m32 = _modules.get("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a") ?? (() => {
|
|
2438
2447
|
const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
|
|
2439
2448
|
|
|
2440
2449
|
const { OfficeIMOError } = _m2;
|
|
@@ -2446,6 +2455,24 @@ const { DifferentialStyles } = _m34;
|
|
|
2446
2455
|
|
|
2447
2456
|
|
|
2448
2457
|
const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
2458
|
+
const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
|
|
2459
|
+
/** @internal Validate and normalize border edges without registering a workbook style. */
|
|
2460
|
+
function normalizeBorder(border) {
|
|
2461
|
+
if (!border || typeof border !== "object")
|
|
2462
|
+
throw new TypeError("A border must be an object of edges.");
|
|
2463
|
+
const result = {};
|
|
2464
|
+
for (const side of ["left", "right", "top", "bottom"]) {
|
|
2465
|
+
const edge = border[side];
|
|
2466
|
+
if (edge) {
|
|
2467
|
+
// Read each property once, so the validated edge is the one that is stored.
|
|
2468
|
+
const { style, color } = edge;
|
|
2469
|
+
if (!borderStyles.includes(style))
|
|
2470
|
+
throw new TypeError("Invalid border style.");
|
|
2471
|
+
result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
return result;
|
|
2475
|
+
}
|
|
2449
2476
|
const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
|
|
2450
2477
|
function index(value, count, kind) {
|
|
2451
2478
|
if (!Number.isInteger(value) || value < 0 || value >= count)
|
|
@@ -2518,32 +2545,24 @@ class StyleRegistry {
|
|
|
2518
2545
|
/** @internal */
|
|
2519
2546
|
addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
|
|
2520
2547
|
addFont(font) {
|
|
2521
|
-
|
|
2548
|
+
const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
|
|
2549
|
+
if (requested !== undefined && typeof requested !== "string")
|
|
2522
2550
|
throw new TypeError("Font name must be a string.");
|
|
2523
|
-
const name = cleanXml(
|
|
2551
|
+
const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
|
|
2524
2552
|
if (typeof name !== "string" || !name || name.length > 31)
|
|
2525
2553
|
throw new TypeError("Font name must contain 1 through 31 characters.");
|
|
2526
2554
|
if (!Number.isFinite(size) || size <= 0 || size > 409)
|
|
2527
2555
|
throw new RangeError("Font size must be positive and at most 409.");
|
|
2528
|
-
return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!
|
|
2556
|
+
return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
|
|
2529
2557
|
}
|
|
2530
2558
|
addFill(fill) {
|
|
2531
|
-
const pattern = fill.pattern ?? (
|
|
2532
|
-
if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !
|
|
2559
|
+
const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
|
|
2560
|
+
if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
|
|
2533
2561
|
throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
|
|
2534
|
-
return deduplicate(this.fills, this.fillIndexes, { pattern, color:
|
|
2562
|
+
return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
|
|
2535
2563
|
}
|
|
2536
2564
|
addBorder(border) {
|
|
2537
|
-
|
|
2538
|
-
for (const side of ["left", "right", "top", "bottom"]) {
|
|
2539
|
-
const edge = border[side];
|
|
2540
|
-
if (edge) {
|
|
2541
|
-
if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
|
|
2542
|
-
throw new TypeError("Invalid border style.");
|
|
2543
|
-
result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
|
|
2565
|
+
return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
|
|
2547
2566
|
}
|
|
2548
2567
|
addNumberFormat(format) {
|
|
2549
2568
|
if (typeof format !== "string" || !format || format.length > 255)
|
|
@@ -2609,7 +2628,7 @@ class StyleRegistry {
|
|
|
2609
2628
|
return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
|
|
2610
2629
|
}
|
|
2611
2630
|
/** @internal Column shorthand and header style composition. */
|
|
2612
|
-
forColumn(column, header = false, fill, date = false) {
|
|
2631
|
+
forColumn(column, header = false, fill, date = false, border) {
|
|
2613
2632
|
const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
|
|
2614
2633
|
const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
|
|
2615
2634
|
return this.add({
|
|
@@ -2618,7 +2637,7 @@ class StyleRegistry {
|
|
|
2618
2637
|
wrapText: column.wrapText ?? base?.wrapText ?? false,
|
|
2619
2638
|
...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
|
|
2620
2639
|
...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
|
|
2621
|
-
...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
|
|
2640
|
+
...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
|
|
2622
2641
|
});
|
|
2623
2642
|
}
|
|
2624
2643
|
toXml() {
|
|
@@ -2643,8 +2662,8 @@ class StyleRegistry {
|
|
|
2643
2662
|
}).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
|
|
2644
2663
|
}
|
|
2645
2664
|
}
|
|
2646
|
-
const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
|
|
2647
|
-
_modules.set("
|
|
2665
|
+
const _exports = Object.freeze({ colorArgb: _m33.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
|
|
2666
|
+
_modules.set("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a", _exports);
|
|
2648
2667
|
return _exports;
|
|
2649
2668
|
})();
|
|
2650
2669
|
|
|
@@ -3798,14 +3817,14 @@ _modules.set("13fa96d976e4dec7343dd3a392829567f1fcb574324a98f5a5d3a61c9a0dc27d",
|
|
|
3798
3817
|
return _exports;
|
|
3799
3818
|
})();
|
|
3800
3819
|
|
|
3801
|
-
const _m38 = _modules.get("
|
|
3820
|
+
const _m38 = _modules.get("d5957683aa1945575924c89c63b427878e6e6e47ef5c229dc524b1879d146499") ?? (() => {
|
|
3802
3821
|
const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
|
|
3803
3822
|
|
|
3804
3823
|
const { ChunkedTextSink, BlobByteSink } = _m3;
|
|
3805
3824
|
|
|
3806
3825
|
const { OfficeIMOError } = _m2;
|
|
3807
3826
|
|
|
3808
|
-
const { notifyProgress } = _m14;
|
|
3827
|
+
const { notifyProgress, notifySynchronously } = _m14;
|
|
3809
3828
|
|
|
3810
3829
|
const { copyColumns, createRowProjector } = _m11;
|
|
3811
3830
|
|
|
@@ -3877,8 +3896,14 @@ class Worksheet {
|
|
|
3877
3896
|
pendingCharacters = 0;
|
|
3878
3897
|
reservedLayout = false;
|
|
3879
3898
|
internalLinks = [];
|
|
3899
|
+
// Evicted entries become holes and are compacted in one pass when the links are read, keeping eviction O(1).
|
|
3880
3900
|
links = [];
|
|
3901
|
+
evictedLinks = 0;
|
|
3881
3902
|
linkedCells = new Set();
|
|
3903
|
+
/** Indexes in `links` of data-cell links that `hyperlinkOverflow: "drop"` may give up, in row order. */
|
|
3904
|
+
droppable = [];
|
|
3905
|
+
droppableLinks = new WeakSet();
|
|
3906
|
+
droppedLinks = 0;
|
|
3882
3907
|
pictures = [];
|
|
3883
3908
|
nativeCharts = [];
|
|
3884
3909
|
conditional;
|
|
@@ -3909,8 +3934,9 @@ class Worksheet {
|
|
|
3909
3934
|
book.checkLinks(this.links.length);
|
|
3910
3935
|
this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
|
|
3911
3936
|
style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
|
|
3912
|
-
headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
|
|
3913
|
-
...(column.
|
|
3937
|
+
headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
|
|
3938
|
+
...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
|
|
3939
|
+
...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
|
|
3914
3940
|
}));
|
|
3915
3941
|
// Register conditional styles only after worksheet construction can no longer reject its options.
|
|
3916
3942
|
this.conditional = new ConditionalFormats(conditional, book.styles);
|
|
@@ -3962,6 +3988,8 @@ class Worksheet {
|
|
|
3962
3988
|
throw new TypeError("A frozen header or autofilter requires a header row.");
|
|
3963
3989
|
if (options.headerFill !== undefined)
|
|
3964
3990
|
colorArgb(options.headerFill);
|
|
3991
|
+
if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
|
|
3992
|
+
throw new TypeError("headerWrap must be boolean.");
|
|
3965
3993
|
if (options.headerStyle !== undefined)
|
|
3966
3994
|
book.styles.validateStyle(options.headerStyle);
|
|
3967
3995
|
if (options.alternatingRowStyle !== undefined)
|
|
@@ -4087,7 +4115,8 @@ class Worksheet {
|
|
|
4087
4115
|
const cell = col.letter + row;
|
|
4088
4116
|
if (link || this.linkedCells.has(cell))
|
|
4089
4117
|
throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
|
|
4090
|
-
|
|
4118
|
+
this.makeLinkRoom();
|
|
4119
|
+
checkHyperlinkCount(this.linkCount + 1);
|
|
4091
4120
|
this.book.checkLinks(1);
|
|
4092
4121
|
// Replace a generated cell's original reservation with its preview and overflow records.
|
|
4093
4122
|
if (reservedCharacters !== undefined) {
|
|
@@ -4101,7 +4130,7 @@ class Worksheet {
|
|
|
4101
4130
|
value = preserved.preview;
|
|
4102
4131
|
}
|
|
4103
4132
|
if (link)
|
|
4104
|
-
this.appendHyperlink({ cell: col.letter + row, ...link });
|
|
4133
|
+
this.appendHyperlink({ cell: col.letter + row, ...link }, !header && !footer && !title && this.book.settings.hyperlinkOverflow === "drop");
|
|
4105
4134
|
if (type === "date")
|
|
4106
4135
|
value = excelDate(value, this.book.settings.dateMode);
|
|
4107
4136
|
if (!header && !footer && visible && (!formula || !isSubtotalFormula(formula)))
|
|
@@ -4410,20 +4439,61 @@ class Worksheet {
|
|
|
4410
4439
|
throw this.error;
|
|
4411
4440
|
this.appendHyperlink(link);
|
|
4412
4441
|
}
|
|
4413
|
-
appendHyperlink(link) {
|
|
4442
|
+
appendHyperlink(link, droppable = false) {
|
|
4443
|
+
// Validate before any overflow decision, so a dropped link can never hide an unsafe target.
|
|
4414
4444
|
const copied = copyHyperlink(link, this.book.settings.invalidCharacterPolicy);
|
|
4415
4445
|
const position = cellPosition(copied.cell);
|
|
4416
4446
|
if (this.layout.regions.covered(position.column, position.row))
|
|
4417
4447
|
throw new TypeError("Hyperlinks cannot address a covered merged cell.");
|
|
4418
4448
|
if (this.linkedCells.has(copied.cell))
|
|
4419
4449
|
throw new TypeError("Duplicate hyperlink cell: " + copied.cell);
|
|
4420
|
-
|
|
4450
|
+
if (droppable && this.linkCount >= maximumHyperlinks) {
|
|
4451
|
+
this.droppedLinks++;
|
|
4452
|
+
return;
|
|
4453
|
+
}
|
|
4454
|
+
if (!droppable)
|
|
4455
|
+
this.makeLinkRoom();
|
|
4456
|
+
checkHyperlinkCount(this.linkCount + 1);
|
|
4421
4457
|
this.book.retainLink();
|
|
4458
|
+
if (droppable) {
|
|
4459
|
+
this.droppable.push(this.links.length);
|
|
4460
|
+
this.droppableLinks.add(copied);
|
|
4461
|
+
}
|
|
4422
4462
|
this.links.push(copied);
|
|
4423
4463
|
this.linkedCells.add(copied.cell);
|
|
4424
4464
|
}
|
|
4465
|
+
/** Links the worksheet holds now, not counting evicted holes. */
|
|
4466
|
+
get linkCount() { return this.links.length - this.evictedLinks + this.internalLinks.length; }
|
|
4467
|
+
/** A full worksheet gives up its latest data-cell link for a link that cannot be dropped. Hyperlinks are serialized after
|
|
4468
|
+
* the rows, so the cell keeps its written value. The entry becomes a hole, so other indexes stay valid until compaction. */
|
|
4469
|
+
makeLinkRoom() {
|
|
4470
|
+
if (this.linkCount < maximumHyperlinks || !this.droppable.length)
|
|
4471
|
+
return;
|
|
4472
|
+
const index = this.droppable.pop(), removed = this.links[index];
|
|
4473
|
+
this.links[index] = undefined;
|
|
4474
|
+
this.evictedLinks++;
|
|
4475
|
+
this.linkedCells.delete(removed.cell);
|
|
4476
|
+
this.book.releaseLink();
|
|
4477
|
+
this.droppedLinks++;
|
|
4478
|
+
}
|
|
4479
|
+
/** One ordered pass removes evicted holes and rebuilds the droppable indexes. */
|
|
4480
|
+
compactLinks() {
|
|
4481
|
+
if (this.evictedLinks) {
|
|
4482
|
+
const kept = [], droppable = [];
|
|
4483
|
+
for (const link of this.links)
|
|
4484
|
+
if (link) {
|
|
4485
|
+
if (this.droppableLinks.has(link))
|
|
4486
|
+
droppable.push(kept.length);
|
|
4487
|
+
kept.push(link);
|
|
4488
|
+
}
|
|
4489
|
+
this.links = kept;
|
|
4490
|
+
this.droppable = droppable;
|
|
4491
|
+
this.evictedLinks = 0;
|
|
4492
|
+
}
|
|
4493
|
+
return this.links;
|
|
4494
|
+
}
|
|
4425
4495
|
/** @internal */
|
|
4426
|
-
get hyperlinks() { return this.
|
|
4496
|
+
get hyperlinks() { return this.compactLinks(); }
|
|
4427
4497
|
/** @internal */
|
|
4428
4498
|
get images() { return this.pictures; }
|
|
4429
4499
|
/** @internal An empty export has no data table; it still emits the declared headers. */
|
|
@@ -4474,7 +4544,7 @@ class Worksheet {
|
|
|
4474
4544
|
for (const binding of this.chartSources)
|
|
4475
4545
|
binding.finish();
|
|
4476
4546
|
this.chartSources.length = 0;
|
|
4477
|
-
for (const link of this.
|
|
4547
|
+
for (const link of this.compactLinks()) {
|
|
4478
4548
|
const position = cellPosition(link.cell);
|
|
4479
4549
|
if (position.column > this.columns.length || position.row > this.totalRows)
|
|
4480
4550
|
throw new RangeError("Hyperlinks must address cells within the exported rows and columns.");
|
|
@@ -4504,8 +4574,11 @@ class Worksheet {
|
|
|
4504
4574
|
await this.buffer.write(xml);
|
|
4505
4575
|
for (const xml of dataValidationsXml(this.validations, this.headerRows, this.count, detailRanges))
|
|
4506
4576
|
await this.buffer.write(xml);
|
|
4507
|
-
if (this.
|
|
4508
|
-
|
|
4577
|
+
if (this.droppedLinks)
|
|
4578
|
+
notifySynchronously("onHyperlinkOverflow", this.book.settings.onHyperlinkOverflow, Object.freeze({ sheetName: this.name, dropped: this.droppedLinks }));
|
|
4579
|
+
const links = this.compactLinks();
|
|
4580
|
+
if (links.length || this.internalLinks.length)
|
|
4581
|
+
await this.buffer.write(hyperlinksXml(links, this.book.settings.invalidCharacterPolicy, this.internalLinks));
|
|
4509
4582
|
await this.buffer.write(printXml(this.options.print, this.book.settings.invalidCharacterPolicy));
|
|
4510
4583
|
if (this.pictures.length || this.nativeCharts.length)
|
|
4511
4584
|
await this.buffer.write('<drawing r:id="drawing"/>');
|
|
@@ -4530,11 +4603,11 @@ class Worksheet {
|
|
|
4530
4603
|
async discard(error) { this.failed = true; this.error = error; this.pending = []; this.pendingCharacters = 0; this.prepared = undefined; this.buffer = undefined; this.nativeCharts.length = 0; this.chartSources.length = 0; this.output.discard(); await this.entry?.discard(error); }
|
|
4531
4604
|
}
|
|
4532
4605
|
const _exports = Object.freeze({ Worksheet: Worksheet });
|
|
4533
|
-
_modules.set("
|
|
4606
|
+
_modules.set("d5957683aa1945575924c89c63b427878e6e6e47ef5c229dc524b1879d146499", _exports);
|
|
4534
4607
|
return _exports;
|
|
4535
4608
|
})();
|
|
4536
4609
|
|
|
4537
|
-
const _m48 = _modules.get("
|
|
4610
|
+
const _m48 = _modules.get("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0") ?? (() => {
|
|
4538
4611
|
const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m28;
|
|
4539
4612
|
|
|
4540
4613
|
const { cellText, columnName } = _m35;
|
|
@@ -4577,7 +4650,7 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
|
|
|
4577
4650
|
'" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
|
|
4578
4651
|
}
|
|
4579
4652
|
const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
|
|
4580
|
-
_modules.set("
|
|
4653
|
+
_modules.set("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0", _exports);
|
|
4581
4654
|
return _exports;
|
|
4582
4655
|
})();
|
|
4583
4656
|
|
|
@@ -4952,7 +5025,7 @@ _modules.set("24f1417c3c320a8a41137c28f70b72091256c63010be0c88b684dce85f54950c",
|
|
|
4952
5025
|
return _exports;
|
|
4953
5026
|
})();
|
|
4954
5027
|
|
|
4955
|
-
const _m24 = _modules.get("
|
|
5028
|
+
const _m24 = _modules.get("a34a46ed9564c388d5f3ca087c70819f8aa897e469ca50f8547233c264a8e8af") ?? (() => {
|
|
4956
5029
|
const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
|
|
4957
5030
|
|
|
4958
5031
|
const { OfficeIMOError } = _m2;
|
|
@@ -4967,7 +5040,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
|
|
|
4967
5040
|
|
|
4968
5041
|
const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m28;
|
|
4969
5042
|
|
|
4970
|
-
const { StyleRegistry, spreadsheetNamespace } = _m32;
|
|
5043
|
+
const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m32;
|
|
4971
5044
|
|
|
4972
5045
|
const { sheetName, assertXlsxValue, copyValue } = _m35;
|
|
4973
5046
|
|
|
@@ -5008,6 +5081,8 @@ function captureSheet(options, policy) {
|
|
|
5008
5081
|
return { ...captured, columns,
|
|
5009
5082
|
...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
|
|
5010
5083
|
...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
|
|
5084
|
+
// Preflight and every header style read this one snapshot of the edges.
|
|
5085
|
+
...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
|
|
5011
5086
|
...(footer ? { footer: { ...footer,
|
|
5012
5087
|
...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
|
|
5013
5088
|
...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
|
|
@@ -5083,6 +5158,10 @@ class Workbook {
|
|
|
5083
5158
|
throw new RangeError("compression must be auto or store.");
|
|
5084
5159
|
if (options.oversizedText !== undefined && !["reject", "preserve"].includes(options.oversizedText))
|
|
5085
5160
|
throw new RangeError("oversizedText must be reject or preserve.");
|
|
5161
|
+
if (options.hyperlinkOverflow !== undefined && !["reject", "drop"].includes(options.hyperlinkOverflow))
|
|
5162
|
+
throw new RangeError("hyperlinkOverflow must be reject or drop.");
|
|
5163
|
+
if (options.onHyperlinkOverflow !== undefined && typeof options.onHyperlinkOverflow !== "function")
|
|
5164
|
+
throw new TypeError("onHyperlinkOverflow must be a function.");
|
|
5086
5165
|
cleanXml("", policy);
|
|
5087
5166
|
corePropertiesXml(options, policy);
|
|
5088
5167
|
this.budget = new ExportBudget(options.limits);
|
|
@@ -5160,6 +5239,8 @@ class Workbook {
|
|
|
5160
5239
|
}
|
|
5161
5240
|
/** @internal Reserve a preflighted worksheet batch or one row hyperlink. */
|
|
5162
5241
|
retainLink(count = 1) { this.checkLinks(count); this.links += count; }
|
|
5242
|
+
/** @internal A worksheet dropped a data-cell link it had retained. */
|
|
5243
|
+
releaseLink() { this.links--; }
|
|
5163
5244
|
/** @internal */
|
|
5164
5245
|
checkImage(bytes) {
|
|
5165
5246
|
if (this.settings.limits?.maxImageBytes !== undefined && this.imageBytes + bytes > this.settings.limits.maxImageBytes)
|
|
@@ -5433,11 +5514,11 @@ class Workbook {
|
|
|
5433
5514
|
}
|
|
5434
5515
|
}
|
|
5435
5516
|
const _exports = Object.freeze({ Workbook: Workbook });
|
|
5436
|
-
_modules.set("
|
|
5517
|
+
_modules.set("a34a46ed9564c388d5f3ca087c70819f8aa897e469ca50f8547233c264a8e8af", _exports);
|
|
5437
5518
|
return _exports;
|
|
5438
5519
|
})();
|
|
5439
5520
|
|
|
5440
|
-
const _m53 = _modules.get("
|
|
5521
|
+
const _m53 = _modules.get("d6884428c3e4d15a691ecf2523372a03b32de22a890edfbfc9961f2dc92711c2") ?? (() => {
|
|
5441
5522
|
const { ExportCell, assertScalar } = _m5;
|
|
5442
5523
|
|
|
5443
5524
|
const { captureWorkbookOptions, sheetOptionFields } = _m22;
|
|
@@ -5459,7 +5540,7 @@ function value(result) {
|
|
|
5459
5540
|
function portableSheet(options = {}) {
|
|
5460
5541
|
options = captureFields(options, sheetOptionFields);
|
|
5461
5542
|
if (options.headerStyle !== undefined)
|
|
5462
|
-
throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and
|
|
5543
|
+
throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
|
|
5463
5544
|
style(options.alternatingRowStyle);
|
|
5464
5545
|
style(options.title?.style);
|
|
5465
5546
|
style(options.footer?.style);
|
|
@@ -5486,11 +5567,11 @@ function portableWorkbook(options = {}) {
|
|
|
5486
5567
|
return { ...options, cellValueWriters: wrapped };
|
|
5487
5568
|
}
|
|
5488
5569
|
const _exports = Object.freeze({ portableSheet: portableSheet, portableWorkbook: portableWorkbook });
|
|
5489
|
-
_modules.set("
|
|
5570
|
+
_modules.set("d6884428c3e4d15a691ecf2523372a03b32de22a890edfbfc9961f2dc92711c2", _exports);
|
|
5490
5571
|
return _exports;
|
|
5491
5572
|
})();
|
|
5492
5573
|
|
|
5493
|
-
const _m52 = _modules.get("
|
|
5574
|
+
const _m52 = _modules.get("b9b1793c41e466048fe823422088a6fcc1fd8393c67293df3f0cd83a5d5ec7e1") ?? (() => {
|
|
5494
5575
|
const { withDestination } = _m3;
|
|
5495
5576
|
|
|
5496
5577
|
const { copyColumns } = _m11;
|
|
@@ -5545,11 +5626,11 @@ async function writeXlsxTo(rows, destination, configuration) {
|
|
|
5545
5626
|
});
|
|
5546
5627
|
}
|
|
5547
5628
|
const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
|
|
5548
|
-
_modules.set("
|
|
5629
|
+
_modules.set("b9b1793c41e466048fe823422088a6fcc1fd8393c67293df3f0cd83a5d5ec7e1", _exports);
|
|
5549
5630
|
return _exports;
|
|
5550
5631
|
})();
|
|
5551
5632
|
|
|
5552
|
-
const _m55 = _modules.get("
|
|
5633
|
+
const _m55 = _modules.get("ba0e1f29c8de5d46b966b7b097260529e42b80f662e92a7f9e8add22df747a50") ?? (() => {
|
|
5553
5634
|
const { assertGroupedReportSource } = _m8;
|
|
5554
5635
|
|
|
5555
5636
|
const { captureFields } = _m10;
|
|
@@ -5638,11 +5719,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
|
|
|
5638
5719
|
...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
|
|
5639
5720
|
}
|
|
5640
5721
|
const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
|
|
5641
|
-
_modules.set("
|
|
5722
|
+
_modules.set("ba0e1f29c8de5d46b966b7b097260529e42b80f662e92a7f9e8add22df747a50", _exports);
|
|
5642
5723
|
return _exports;
|
|
5643
5724
|
})();
|
|
5644
5725
|
|
|
5645
|
-
const _m54 = _modules.get("
|
|
5726
|
+
const _m54 = _modules.get("d7cfa6a7b1be9758925a4ccb860a80a33eb0de2c88c80cc55e438213595f2b71") ?? (() => {
|
|
5646
5727
|
const { groupedReportOperation } = _m8;
|
|
5647
5728
|
|
|
5648
5729
|
const { checkAbort, withAbort } = _m4;
|
|
@@ -5815,14 +5896,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
|
|
|
5815
5896
|
return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
|
|
5816
5897
|
}
|
|
5817
5898
|
const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
|
|
5818
|
-
_modules.set("
|
|
5899
|
+
_modules.set("d7cfa6a7b1be9758925a4ccb860a80a33eb0de2c88c80cc55e438213595f2b71", _exports);
|
|
5819
5900
|
return _exports;
|
|
5820
5901
|
})();
|
|
5821
5902
|
|
|
5822
|
-
const _m23 = _modules.get("
|
|
5903
|
+
const _m23 = _modules.get("edf1bf5cb6d749de0e6823397df6610a6c1cc88768898c1b4d7083ee96ef6759") ?? (() => {
|
|
5823
5904
|
|
|
5824
5905
|
const _exports = Object.freeze({ Workbook: _m24.Workbook, writeXlsx: _m52.writeXlsx, writeXlsxTo: _m52.writeXlsxTo, writeGroupedXlsx: _m54.writeGroupedXlsx, writeGroupedXlsxTo: _m54.writeGroupedXlsxTo, addGroupedXlsx: _m54.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m38.Worksheet, Cell: _m35.Cell, FormulaCell: _m36.FormulaCell, StyleRegistry: _m32.StyleRegistry, NumberFormats: _m32.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
|
|
5825
|
-
_modules.set("
|
|
5906
|
+
_modules.set("edf1bf5cb6d749de0e6823397df6610a6c1cc88768898c1b4d7083ee96ef6759", _exports);
|
|
5826
5907
|
return _exports;
|
|
5827
5908
|
})();
|
|
5828
5909
|
|
|
@@ -5848,7 +5929,7 @@ _modules.set("2f5c0823847e9209017d01b2a753f36056df2a9988fae1f3a1bd5fd186545220",
|
|
|
5848
5929
|
return _exports;
|
|
5849
5930
|
})();
|
|
5850
5931
|
|
|
5851
|
-
const _m56 = _modules.get("
|
|
5932
|
+
const _m56 = _modules.get("406ac6c93ee68eae70c6f52a1e6f4c56b84f43cae12576040c766dcc5598a580") ?? (() => {
|
|
5852
5933
|
const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
|
|
5853
5934
|
|
|
5854
5935
|
const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
|
|
@@ -5998,7 +6079,7 @@ async function writeCsv(rows, configuration) {
|
|
|
5998
6079
|
}
|
|
5999
6080
|
}
|
|
6000
6081
|
const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
|
|
6001
|
-
_modules.set("
|
|
6082
|
+
_modules.set("406ac6c93ee68eae70c6f52a1e6f4c56b84f43cae12576040c766dcc5598a580", _exports);
|
|
6002
6083
|
return _exports;
|
|
6003
6084
|
})();
|
|
6004
6085
|
|
|
@@ -7323,7 +7404,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
|
|
|
7323
7404
|
return _exports;
|
|
7324
7405
|
})();
|
|
7325
7406
|
|
|
7326
|
-
const _m63 = _modules.get("
|
|
7407
|
+
const _m63 = _modules.get("7825c87ba92a9992baf6b5c8a5e146948268985c31584ef9c8bf395359942e4f") ?? (() => {
|
|
7327
7408
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7328
7409
|
|
|
7329
7410
|
const { fontProgram } = _m64;
|
|
@@ -7524,7 +7605,7 @@ class PdfFontResources {
|
|
|
7524
7605
|
this.fontBytes += bytes;
|
|
7525
7606
|
this.registered.add(font);
|
|
7526
7607
|
}
|
|
7527
|
-
select(bold = false, italic = false, explicit) {
|
|
7608
|
+
select(bold = false, italic = false, explicit, standardForMissingFace = false) {
|
|
7528
7609
|
if (explicit)
|
|
7529
7610
|
this.registerFont(explicit);
|
|
7530
7611
|
let selections = this.selections;
|
|
@@ -7534,10 +7615,13 @@ class PdfFontResources {
|
|
|
7534
7615
|
if (!found)
|
|
7535
7616
|
this.explicitSelections.set(explicit, selections);
|
|
7536
7617
|
}
|
|
7537
|
-
const
|
|
7618
|
+
const fallback = standardForMissingFace && !explicit && this.fonts !== undefined &&
|
|
7619
|
+
this.fonts[bold ? italic ? "boldItalic" : "bold" : italic ? "italic" : "regular"] === undefined;
|
|
7620
|
+
const key = (bold ? 2 : 0) | (italic ? 1 : 0) | (fallback ? 4 : 0), existing = selections.get(key);
|
|
7538
7621
|
if (existing)
|
|
7539
7622
|
return existing;
|
|
7540
|
-
const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } :
|
|
7623
|
+
const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } :
|
|
7624
|
+
selectFont(fallback ? undefined : this.fonts, bold, italic);
|
|
7541
7625
|
const shared = font ? this.programs.get(font) : undefined;
|
|
7542
7626
|
const resource = new PdfFontResource(this.resources.length + 1, bold, italic, font, this.objects, syntheticBold, syntheticItalic, shared, this.signal);
|
|
7543
7627
|
if (!shared) {
|
|
@@ -7551,7 +7635,7 @@ class PdfFontResources {
|
|
|
7551
7635
|
dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
|
|
7552
7636
|
}
|
|
7553
7637
|
const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
|
|
7554
|
-
_modules.set("
|
|
7638
|
+
_modules.set("7825c87ba92a9992baf6b5c8a5e146948268985c31584ef9c8bf395359942e4f", _exports);
|
|
7555
7639
|
return _exports;
|
|
7556
7640
|
})();
|
|
7557
7641
|
|
|
@@ -7880,7 +7964,7 @@ _modules.set("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6",
|
|
|
7880
7964
|
return _exports;
|
|
7881
7965
|
})();
|
|
7882
7966
|
|
|
7883
|
-
const _m72 = _modules.get("
|
|
7967
|
+
const _m72 = _modules.get("abbfad7ffb3c318822659c9fbde9126630ce2c137dc2e2b88402148424255e2d") ?? (() => {
|
|
7884
7968
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7885
7969
|
|
|
7886
7970
|
const { copyExportLink } = _m7;
|
|
@@ -8072,11 +8156,11 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
8072
8156
|
return lines;
|
|
8073
8157
|
}
|
|
8074
8158
|
const _exports = Object.freeze({ capturePdfText: capturePdfText, wrapPdfText: wrapPdfText });
|
|
8075
|
-
_modules.set("
|
|
8159
|
+
_modules.set("abbfad7ffb3c318822659c9fbde9126630ce2c137dc2e2b88402148424255e2d", _exports);
|
|
8076
8160
|
return _exports;
|
|
8077
8161
|
})();
|
|
8078
8162
|
|
|
8079
|
-
const _m74 = _modules.get("
|
|
8163
|
+
const _m74 = _modules.get("04b189837f06067364240b6731efdf86d61d81fd0848fac3666f25c5f27817b8") ?? (() => {
|
|
8080
8164
|
const { OfficeIMOError } = _m2;
|
|
8081
8165
|
|
|
8082
8166
|
const { wrapPdfText } = _m72;
|
|
@@ -8171,11 +8255,11 @@ function alignBandBlocks(bands, settings) {
|
|
|
8171
8255
|
cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
|
|
8172
8256
|
}
|
|
8173
8257
|
const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
|
|
8174
|
-
_modules.set("
|
|
8258
|
+
_modules.set("04b189837f06067364240b6731efdf86d61d81fd0848fac3666f25c5f27817b8", _exports);
|
|
8175
8259
|
return _exports;
|
|
8176
8260
|
})();
|
|
8177
8261
|
|
|
8178
|
-
const _m70 = _modules.get("
|
|
8262
|
+
const _m70 = _modules.get("6fd77694f46f8c87510a82e8a58a3c424099d6172bfb1942f92d048b39169945") ?? (() => {
|
|
8179
8263
|
const { ExportCell } = _m5;
|
|
8180
8264
|
|
|
8181
8265
|
const { copyExportLink } = _m7;
|
|
@@ -8406,7 +8490,7 @@ class PdfTableLayout {
|
|
|
8406
8490
|
}
|
|
8407
8491
|
}
|
|
8408
8492
|
const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
|
|
8409
|
-
_modules.set("
|
|
8493
|
+
_modules.set("6fd77694f46f8c87510a82e8a58a3c424099d6172bfb1942f92d048b39169945", _exports);
|
|
8410
8494
|
return _exports;
|
|
8411
8495
|
})();
|
|
8412
8496
|
|
|
@@ -8762,7 +8846,7 @@ _modules.set("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f",
|
|
|
8762
8846
|
return _exports;
|
|
8763
8847
|
})();
|
|
8764
8848
|
|
|
8765
|
-
const _m80 = _modules.get("
|
|
8849
|
+
const _m80 = _modules.get("8fc594bfca7312071f0f128ad25fb929d023d176323e66e389cddd27032a4d15") ?? (() => {
|
|
8766
8850
|
const { settings } = _m17;
|
|
8767
8851
|
|
|
8768
8852
|
/** @internal Every section derives from captured document defaults, never the preceding section. */
|
|
@@ -8777,11 +8861,11 @@ function sectionSettings(base, section) {
|
|
|
8777
8861
|
return { ...base, page: derived.page, margins: derived.margins, options };
|
|
8778
8862
|
}
|
|
8779
8863
|
const _exports = Object.freeze({ sectionSettings: sectionSettings });
|
|
8780
|
-
_modules.set("
|
|
8864
|
+
_modules.set("8fc594bfca7312071f0f128ad25fb929d023d176323e66e389cddd27032a4d15", _exports);
|
|
8781
8865
|
return _exports;
|
|
8782
8866
|
})();
|
|
8783
8867
|
|
|
8784
|
-
const _m75 = _modules.get("
|
|
8868
|
+
const _m75 = _modules.get("c16c0303d9d4be12ab9e0bab7cfdac73b252ed233c9689e3e0141cc8115aa941") ?? (() => {
|
|
8785
8869
|
const { OfficeIMOError } = _m2;
|
|
8786
8870
|
|
|
8787
8871
|
const { checkAbort } = _m4;
|
|
@@ -8842,6 +8926,7 @@ class PdfPages {
|
|
|
8842
8926
|
rectangleLefts;
|
|
8843
8927
|
rectangleColumns = [];
|
|
8844
8928
|
externalObjects = new Map();
|
|
8929
|
+
opacityStates = new Map();
|
|
8845
8930
|
bandFlow;
|
|
8846
8931
|
bandCellBudget = false;
|
|
8847
8932
|
tableElement;
|
|
@@ -9424,6 +9509,20 @@ class PdfPages {
|
|
|
9424
9509
|
}
|
|
9425
9510
|
async pageBreak() { await this.ensureStarted(); await this.finishPage(); await this.start(false); }
|
|
9426
9511
|
registerXObject(name, id) { this.externalObjects.set(name, id); }
|
|
9512
|
+
/** One shared constant-opacity graphics state per serialized alpha value. */
|
|
9513
|
+
opacityState(alpha) {
|
|
9514
|
+
const value = pdfNumber(alpha);
|
|
9515
|
+
let name = this.opacityStates.get(value);
|
|
9516
|
+
if (!name) {
|
|
9517
|
+
name = "GA" + (this.opacityStates.size + 1);
|
|
9518
|
+
this.opacityStates.set(value, name);
|
|
9519
|
+
}
|
|
9520
|
+
return name;
|
|
9521
|
+
}
|
|
9522
|
+
graphicsStates() {
|
|
9523
|
+
const entries = [...this.opacityStates].map(([alpha, name]) => "/" + name + " << /ca " + alpha + " /CA " + alpha + " >>");
|
|
9524
|
+
return entries.length ? " /ExtGState << " + entries.join(" ") + " >>" : "";
|
|
9525
|
+
}
|
|
9427
9526
|
/** Height after the existing fit-to-page graphic policy, used by heading keep constraints. */
|
|
9428
9527
|
graphicHeight(width, height) {
|
|
9429
9528
|
const { page, margins } = this.settings;
|
|
@@ -9519,7 +9618,7 @@ class PdfPages {
|
|
|
9519
9618
|
}
|
|
9520
9619
|
}
|
|
9521
9620
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
9522
|
-
_modules.set("
|
|
9621
|
+
_modules.set("c16c0303d9d4be12ab9e0bab7cfdac73b252ed233c9689e3e0141cc8115aa941", _exports);
|
|
9523
9622
|
return _exports;
|
|
9524
9623
|
})();
|
|
9525
9624
|
|
|
@@ -9962,7 +10061,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
|
|
|
9962
10061
|
return _exports;
|
|
9963
10062
|
})();
|
|
9964
10063
|
|
|
9965
|
-
const _m60 = _modules.get("
|
|
10064
|
+
const _m60 = _modules.get("3de6cb5a744388b84e9e2295a2e580e70ab993d44bbb4c94da5f98daba11c350") ?? (() => {
|
|
9966
10065
|
const { PdfObjects, unicodeHex } = _m61;
|
|
9967
10066
|
|
|
9968
10067
|
const { PdfFontResources } = _m63;
|
|
@@ -10014,22 +10113,23 @@ class PdfWriteSession {
|
|
|
10014
10113
|
await pages.finish();
|
|
10015
10114
|
for (const font of fonts.resources)
|
|
10016
10115
|
await font.write(objects, options.compression !== false);
|
|
10017
|
-
await objects.object(this.resources, "<< /Font " + fonts.dictionary() + pages.xobjects() + " >>");
|
|
10116
|
+
await objects.object(this.resources, "<< /Font " + fonts.dictionary() + pages.xobjects() + pages.graphicsStates() + " >>");
|
|
10018
10117
|
await objects.object(this.parent, "<< /Type /Pages /Count " + pages.references.length + " /Kids [" + pages.references.map(id => id + " 0 R").join(" ") + "] >>");
|
|
10019
10118
|
if (this.structure)
|
|
10020
10119
|
await this.structure.finish();
|
|
10021
10120
|
await this.outlines.finish();
|
|
10022
10121
|
await objects.object(this.root, "<< /Type /Catalog /Pages " + this.parent + " 0 R" + (this.structure?.catalogDictionary ?? "") + this.outlines.catalogDictionary + " >>");
|
|
10023
|
-
|
|
10122
|
+
const title = options.metadataTitle ?? options.title;
|
|
10123
|
+
await objects.object(this.info, "<< /Producer (OfficeIMO.js)" + (title === undefined ? "" : " /Title <feff" + unicodeHex(title) + ">") + " >>");
|
|
10024
10124
|
await objects.finish(this.root, this.info);
|
|
10025
10125
|
}
|
|
10026
10126
|
}
|
|
10027
10127
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
10028
|
-
_modules.set("
|
|
10128
|
+
_modules.set("3de6cb5a744388b84e9e2295a2e580e70ab993d44bbb4c94da5f98daba11c350", _exports);
|
|
10029
10129
|
return _exports;
|
|
10030
10130
|
})();
|
|
10031
10131
|
|
|
10032
|
-
const _m59 = _modules.get("
|
|
10132
|
+
const _m59 = _modules.get("01ffda1779a340d72e953fd6e02429f341c89fcab28eb0fce4dc8beb65a5fd43") ?? (() => {
|
|
10033
10133
|
const { BlobByteSink, withDestination } = _m3;
|
|
10034
10134
|
|
|
10035
10135
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
|
|
@@ -10094,11 +10194,11 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
10094
10194
|
});
|
|
10095
10195
|
}
|
|
10096
10196
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
10097
|
-
_modules.set("
|
|
10197
|
+
_modules.set("01ffda1779a340d72e953fd6e02429f341c89fcab28eb0fce4dc8beb65a5fd43", _exports);
|
|
10098
10198
|
return _exports;
|
|
10099
10199
|
})();
|
|
10100
10200
|
|
|
10101
|
-
const _m87 = _modules.get("
|
|
10201
|
+
const _m87 = _modules.get("6b0244b5ec6d550c705b4e4cbb47997331f1ecd99e2bf8a06f7c646eebbffbf8") ?? (() => {
|
|
10102
10202
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
10103
10203
|
|
|
10104
10204
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
|
|
@@ -10107,15 +10207,10 @@ const { Crc32 } = _m31;
|
|
|
10107
10207
|
|
|
10108
10208
|
const signature = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
10109
10209
|
const unsupportedChunks = new Set(["PLTE", "tRNS", "iCCP", "sRGB", "gAMA", "cHRM", "cICP", "mDCV", "cLLI", "sBIT", "eXIf", "acTL", "fcTL", "fdAT"]);
|
|
10110
|
-
/** Decode
|
|
10111
|
-
async function pngPixels(
|
|
10210
|
+
/** Decode an owned static unprofiled PNG without canvas or a second compression engine. */
|
|
10211
|
+
async function pngPixels(source, shape, signal) {
|
|
10112
10212
|
checkAbort(signal);
|
|
10113
|
-
const shape = pngShape(inputSource, maxPixels);
|
|
10114
10213
|
const imagePixels = shape.width * shape.height;
|
|
10115
|
-
const workingBytes = inputSource.length + imagePixels * shape.components + (shape.components === 4 ? shape.width * 8 : 0);
|
|
10116
|
-
if (maxWorkingBytes !== undefined && workingBytes > maxWorkingBytes)
|
|
10117
|
-
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by PNG source, image planes and scanlines.");
|
|
10118
|
-
const source = new Uint8Array(inputSource);
|
|
10119
10214
|
const header = await pngHeader(source, shape, signal);
|
|
10120
10215
|
checkAbort(signal);
|
|
10121
10216
|
let stream;
|
|
@@ -10129,9 +10224,6 @@ async function pngPixels(inputSource, maxPixels, signal, maxWorkingBytes) {
|
|
|
10129
10224
|
}
|
|
10130
10225
|
const { width, height, components } = header, rowBytes = width * components;
|
|
10131
10226
|
const expected = (rowBytes + 1) * height;
|
|
10132
|
-
// All dimensions and the exact filtered length are bounded before allocating decoded pixels.
|
|
10133
|
-
if (!Number.isSafeInteger(expected) || expected > 0x7fffffff)
|
|
10134
|
-
throw new OfficeIMOError("RESOURCE_LIMIT", "PNG filtered data exceeds the supported decoded byte length.");
|
|
10135
10227
|
// RGBA is reconstructed one scanline at a time directly into PDF RGB/alpha planes.
|
|
10136
10228
|
// It never retains an additional full interleaved RGBA image.
|
|
10137
10229
|
const pixels = new Uint8Array(width * height * 3), alpha = components === 4 ? new Uint8Array(imagePixels) : undefined;
|
|
@@ -10279,20 +10371,55 @@ async function verifyPngZlibEnd(source, header, expected, signal) {
|
|
|
10279
10371
|
reader.releaseLock();
|
|
10280
10372
|
}
|
|
10281
10373
|
}
|
|
10374
|
+
function pngChunk(source, view, offset) {
|
|
10375
|
+
if (offset + 12 > source.length)
|
|
10376
|
+
throw new TypeError("Truncated PNG chunk.");
|
|
10377
|
+
const length = view.getUint32(offset), end = offset + 12 + length;
|
|
10378
|
+
if (length > 0x7fffffff || end > source.length)
|
|
10379
|
+
throw new TypeError("Truncated or oversized PNG chunk.");
|
|
10380
|
+
const type = String.fromCharCode(...source.subarray(offset + 4, offset + 8));
|
|
10381
|
+
if (!/^[A-Za-z]{2}[A-Z][A-Za-z]$/.test(type))
|
|
10382
|
+
throw new TypeError("Invalid PNG chunk type.");
|
|
10383
|
+
return { length, end, type };
|
|
10384
|
+
}
|
|
10385
|
+
function checkAncillaryChunk(type) {
|
|
10386
|
+
if (unsupportedChunks.has(type))
|
|
10387
|
+
throw new NotSupportedError("PNG chunk " + type + "; normalize color, orientation, transparency or animation first");
|
|
10388
|
+
if (type.charCodeAt(0) < 97)
|
|
10389
|
+
throw new NotSupportedError("Required PNG chunk " + type);
|
|
10390
|
+
}
|
|
10391
|
+
/** Check the image profile for SVG placement without inflating pixels. Embedding still verifies CRCs and image data. */
|
|
10392
|
+
function pngEmbeddableSize(source) {
|
|
10393
|
+
const shape = pngShape(source, Infinity);
|
|
10394
|
+
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
10395
|
+
let hasData = false, dataClosed = false;
|
|
10396
|
+
for (let offset = 33; offset < source.length;) {
|
|
10397
|
+
const { length, end, type } = pngChunk(source, view, offset);
|
|
10398
|
+
if (type === "IEND") {
|
|
10399
|
+
if (length === 0 && hasData && end === source.length)
|
|
10400
|
+
return shape;
|
|
10401
|
+
break;
|
|
10402
|
+
}
|
|
10403
|
+
if (type === "IDAT") {
|
|
10404
|
+
if (dataClosed)
|
|
10405
|
+
throw new TypeError("PNG IDAT chunks must be consecutive.");
|
|
10406
|
+
hasData = true;
|
|
10407
|
+
}
|
|
10408
|
+
else {
|
|
10409
|
+
checkAncillaryChunk(type);
|
|
10410
|
+
dataClosed ||= hasData;
|
|
10411
|
+
}
|
|
10412
|
+
offset = end;
|
|
10413
|
+
}
|
|
10414
|
+
throw new TypeError("PNG requires a final empty IEND after IDAT.");
|
|
10415
|
+
}
|
|
10282
10416
|
/** Verify the complete source and critical chunk order before any decompressed image allocation. */
|
|
10283
10417
|
async function pngHeader(source, shape, signal) {
|
|
10284
10418
|
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
10285
10419
|
let firstData = 0, dataEnd = 0, lastDataByte = -1, dataClosed = false;
|
|
10286
10420
|
for (let offset = 8; offset < source.length;) {
|
|
10287
10421
|
checkAbort(signal);
|
|
10288
|
-
|
|
10289
|
-
throw new TypeError("Truncated PNG chunk.");
|
|
10290
|
-
const length = view.getUint32(offset), end = offset + 12 + length;
|
|
10291
|
-
if (length > 0x7fffffff || end > source.length)
|
|
10292
|
-
throw new TypeError("Truncated or oversized PNG chunk.");
|
|
10293
|
-
const type = String.fromCharCode(...source.subarray(offset + 4, offset + 8));
|
|
10294
|
-
if (!/^[A-Za-z]{2}[A-Z][A-Za-z]$/.test(type))
|
|
10295
|
-
throw new TypeError("Invalid PNG chunk type.");
|
|
10422
|
+
const { length, end, type } = pngChunk(source, view, offset);
|
|
10296
10423
|
const crc = new Crc32();
|
|
10297
10424
|
for (let p = offset + 4; p < end - 4; p += 65536) {
|
|
10298
10425
|
crc.update(source.subarray(p, Math.min(end - 4, p + 65536)));
|
|
@@ -10324,17 +10451,14 @@ async function pngHeader(source, shape, signal) {
|
|
|
10324
10451
|
throw new TypeError("PNG requires a final empty IEND after IDAT.");
|
|
10325
10452
|
return { ...shape, firstData, dataEnd, lastDataByte };
|
|
10326
10453
|
}
|
|
10327
|
-
|
|
10328
|
-
throw new NotSupportedError("PNG chunk " + type + "; normalize color, orientation, transparency or animation first");
|
|
10329
|
-
if ((source[offset + 4] & 32) === 0)
|
|
10330
|
-
throw new NotSupportedError("Required PNG chunk " + type);
|
|
10454
|
+
checkAncillaryChunk(type);
|
|
10331
10455
|
}
|
|
10332
10456
|
offset = end;
|
|
10333
10457
|
}
|
|
10334
10458
|
throw new TypeError("PNG requires a complete final IEND chunk.");
|
|
10335
10459
|
}
|
|
10336
10460
|
/** Check source metadata synchronously, before capturing source bytes or allocating any image plane. */
|
|
10337
|
-
function pngShape(source, maxPixels) {
|
|
10461
|
+
function pngShape(source, maxPixels, maxWorkingBytes) {
|
|
10338
10462
|
if (source.length < 33 || signature.some((value, index) => source[index] !== value))
|
|
10339
10463
|
throw new TypeError("Invalid PNG signature or truncated IHDR.");
|
|
10340
10464
|
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
@@ -10354,6 +10478,9 @@ function pngShape(source, maxPixels) {
|
|
|
10354
10478
|
const components = source[25] === 6 ? 4 : 3;
|
|
10355
10479
|
if (!Number.isSafeInteger((width * components + 1) * height) || (width * components + 1) * height > 0x7fffffff)
|
|
10356
10480
|
throw new OfficeIMOError("RESOURCE_LIMIT", "PNG filtered data exceeds the supported decoded byte length.");
|
|
10481
|
+
const workingBytes = source.length + width * height * components + (components === 4 ? width * 8 : 0);
|
|
10482
|
+
if (maxWorkingBytes !== undefined && workingBytes > maxWorkingBytes)
|
|
10483
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by PNG source, image planes and scanlines.");
|
|
10357
10484
|
return { width, height, components };
|
|
10358
10485
|
}
|
|
10359
10486
|
function paeth(left, up, upperLeft) {
|
|
@@ -10361,64 +10488,93 @@ function paeth(left, up, upperLeft) {
|
|
|
10361
10488
|
const a = Math.abs(prediction - left), b = Math.abs(prediction - up), c = Math.abs(prediction - upperLeft);
|
|
10362
10489
|
return a <= b && a <= c ? left : b <= c ? up : upperLeft;
|
|
10363
10490
|
}
|
|
10364
|
-
const _exports = Object.freeze({ pngPixels: pngPixels });
|
|
10365
|
-
_modules.set("
|
|
10491
|
+
const _exports = Object.freeze({ pngPixels: pngPixels, pngEmbeddableSize: pngEmbeddableSize, pngShape: pngShape });
|
|
10492
|
+
_modules.set("6b0244b5ec6d550c705b4e4cbb47997331f1ecd99e2bf8a06f7c646eebbffbf8", _exports);
|
|
10366
10493
|
return _exports;
|
|
10367
10494
|
})();
|
|
10368
10495
|
|
|
10369
|
-
const _m86 = _modules.get("
|
|
10496
|
+
const _m86 = _modules.get("32ca4982f963f400829c2e364b7d3479f36d91740dafb32d600f29b5cac487ec") ?? (() => {
|
|
10370
10497
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
10371
10498
|
|
|
10372
10499
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
10373
10500
|
|
|
10374
|
-
const { pngPixels } = _m87;
|
|
10501
|
+
const { pngPixels, pngShape } = _m87;
|
|
10375
10502
|
|
|
10376
10503
|
/** Shared document image resources; source objects are captured on first consumption. */
|
|
10377
10504
|
class PdfDocumentImages {
|
|
10378
10505
|
objects;
|
|
10379
10506
|
settings;
|
|
10380
10507
|
images = new Map();
|
|
10508
|
+
snapshots = new WeakMap();
|
|
10381
10509
|
bytes = 0;
|
|
10510
|
+
pendingBytes = 0;
|
|
10382
10511
|
constructor(objects, settings) {
|
|
10383
10512
|
this.objects = objects;
|
|
10384
10513
|
this.settings = settings;
|
|
10385
10514
|
}
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
if (
|
|
10389
|
-
return
|
|
10515
|
+
/** Own a drawing image before preparing earlier elements can yield to the caller. */
|
|
10516
|
+
snapshot(image) {
|
|
10517
|
+
if (this.images.has(image) || this.snapshots.has(image))
|
|
10518
|
+
return;
|
|
10519
|
+
const captured = this.capture(image);
|
|
10520
|
+
this.snapshots.set(image, captured);
|
|
10521
|
+
this.pendingBytes += captured.data.length;
|
|
10522
|
+
}
|
|
10523
|
+
capture(image) {
|
|
10390
10524
|
const { limits, options } = this.settings;
|
|
10525
|
+
checkAbort(options.signal);
|
|
10391
10526
|
if (!image || typeof image !== "object")
|
|
10392
10527
|
throw new TypeError("PDF images require a byte array.");
|
|
10393
|
-
const
|
|
10528
|
+
const format = image.format;
|
|
10529
|
+
// Dimension getters may change a resizable backing buffer. Read them before measuring the byte view.
|
|
10530
|
+
const raw = format === "rgb" || format === "rgba" ? image : undefined;
|
|
10531
|
+
const widthValue = raw?.width, heightValue = raw?.height;
|
|
10532
|
+
const data = image.data;
|
|
10394
10533
|
if (!(data instanceof Uint8Array))
|
|
10395
10534
|
throw new TypeError("PDF images require a byte array.");
|
|
10396
10535
|
const byteLength = data.length;
|
|
10397
|
-
if (this.bytes + byteLength > limits.maxImageBytes)
|
|
10536
|
+
if (this.bytes + this.pendingBytes + byteLength > limits.maxImageBytes)
|
|
10398
10537
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageBytes exceeded.");
|
|
10399
|
-
let width, height, components, decoded, decodedAlpha;
|
|
10400
10538
|
const maximumWorkingBytes = limits.maxImageWorkingBytes;
|
|
10401
|
-
if (format === "png")
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10539
|
+
if (format === "png") {
|
|
10540
|
+
const shape = pngShape(data, limits.maxImagePixels, maximumWorkingBytes);
|
|
10541
|
+
return { format, shape, data: new Uint8Array(data) };
|
|
10542
|
+
}
|
|
10543
|
+
let shape;
|
|
10544
|
+
if (format === "jpeg")
|
|
10545
|
+
shape = jpegSize(data);
|
|
10405
10546
|
else if (format === "rgb" || format === "rgba") {
|
|
10406
|
-
|
|
10407
|
-
components = format === "rgba" ? 4 : 3;
|
|
10547
|
+
shape = { width: widthValue, height: heightValue, components: format === "rgba" ? 4 : 3 };
|
|
10408
10548
|
}
|
|
10409
10549
|
else
|
|
10410
10550
|
throw new NotSupportedError("PDF images support unprofiled PNG/JPEG or decoded RGB/RGBA pixels.");
|
|
10551
|
+
const { width, height, components } = shape;
|
|
10411
10552
|
if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 1 || height < 1 ||
|
|
10412
10553
|
!Number.isSafeInteger(width * height) || width * height > limits.maxImagePixels)
|
|
10413
10554
|
throw new OfficeIMOError("RESOURCE_LIMIT", "Image dimensions must be positive integers within maxImagePixels.");
|
|
10414
|
-
if (
|
|
10555
|
+
if (format !== "jpeg" && byteLength !== width * height * components)
|
|
10415
10556
|
throw new RangeError("Raw image bytes must match width × height × channels exactly.");
|
|
10416
|
-
if (
|
|
10557
|
+
if (maximumWorkingBytes !== undefined && byteLength + (components === 4 ? width * height : 0) > maximumWorkingBytes)
|
|
10417
10558
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by image snapshot and alpha plane.");
|
|
10559
|
+
return { format, shape, data: new Uint8Array(data) };
|
|
10560
|
+
}
|
|
10561
|
+
async prepare(image) {
|
|
10562
|
+
const existing = this.images.get(image);
|
|
10563
|
+
if (existing)
|
|
10564
|
+
return existing;
|
|
10565
|
+
const { options } = this.settings, snapshot = this.snapshots.get(image);
|
|
10566
|
+
const source = snapshot ?? this.capture(image);
|
|
10567
|
+
if (snapshot) {
|
|
10568
|
+
this.snapshots.delete(image);
|
|
10569
|
+
this.pendingBytes -= source.data.length;
|
|
10570
|
+
}
|
|
10571
|
+
this.bytes += source.data.length;
|
|
10572
|
+
const { format } = source;
|
|
10573
|
+
const decoded = format === "png" ? await pngPixels(source.data, source.shape, options.signal) : undefined;
|
|
10574
|
+
const { width, height, components } = decoded ?? source.shape;
|
|
10418
10575
|
checkAbort(options.signal);
|
|
10419
10576
|
const id = this.objects.reserve(), name = "Image" + (this.images.size + 1);
|
|
10420
|
-
|
|
10421
|
-
const captured = decoded ?? new Uint8Array(data);
|
|
10577
|
+
const captured = decoded?.data ?? source.data, decodedAlpha = decoded?.alpha;
|
|
10422
10578
|
let pixels = captured, alpha = decodedAlpha, mask;
|
|
10423
10579
|
if (components === 4) {
|
|
10424
10580
|
// Compact the owned RGBA snapshot in place. Forward writes never overwrite unread channels.
|
|
@@ -10440,20 +10596,22 @@ class PdfDocumentImages {
|
|
|
10440
10596
|
mask = this.objects.reserve();
|
|
10441
10597
|
await this.objects.stream(mask, alpha, "/Type /XObject /Subtype /Image /Width " + width + " /Height " + height + " /ColorSpace /DeviceGray /BitsPerComponent 8", options.compression !== false, true);
|
|
10442
10598
|
}
|
|
10599
|
+
const jpegFilter = format === "jpeg" ? " /Filter /DCTDecode" +
|
|
10600
|
+
(source.shape.colorTransform === 0 ? " /DecodeParms << /ColorTransform 0 >>" : "") : "";
|
|
10443
10601
|
const dictionary = "/Type /XObject /Subtype /Image /Width " + width + " /Height " + height + " /ColorSpace /" +
|
|
10444
10602
|
(components === 1 ? "DeviceGray" : "DeviceRGB") + " /BitsPerComponent 8" + (mask ? " /SMask " + mask + " 0 R" : "") +
|
|
10445
|
-
|
|
10603
|
+
jpegFilter;
|
|
10446
10604
|
await this.objects.stream(id, pixels, dictionary, format === "jpeg" ? false : options.compression !== false, true);
|
|
10447
10605
|
const resource = { name, id, width, height };
|
|
10448
10606
|
this.images.set(image, resource);
|
|
10449
10607
|
return resource;
|
|
10450
10608
|
}
|
|
10451
10609
|
}
|
|
10452
|
-
/** Inspect bounded JPEG headers; JPEG entropy decoding remains the independent reader's job. */
|
|
10610
|
+
/** @internal Inspect bounded JPEG headers; JPEG entropy decoding remains the independent reader's job. */
|
|
10453
10611
|
function jpegSize(bytes) {
|
|
10454
10612
|
if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216 || bytes[bytes.length - 2] !== 255 || bytes[bytes.length - 1] !== 217)
|
|
10455
10613
|
throw new TypeError("JPEG images need complete SOI/EOI markers.");
|
|
10456
|
-
let result;
|
|
10614
|
+
let result, rgb = false, adobe = false;
|
|
10457
10615
|
for (let p = 2; p < bytes.length;) {
|
|
10458
10616
|
if (bytes[p++] !== 255)
|
|
10459
10617
|
throw new TypeError("Invalid JPEG marker.");
|
|
@@ -10463,7 +10621,8 @@ function jpegSize(bytes) {
|
|
|
10463
10621
|
if (marker === 218) {
|
|
10464
10622
|
if (!result)
|
|
10465
10623
|
throw new TypeError("JPEG scan precedes its frame header.");
|
|
10466
|
-
|
|
10624
|
+
// PDF decoders otherwise assume a color transform for three-component JPEGs.
|
|
10625
|
+
return rgb && !adobe ? { ...result, colorTransform: 0 } : result;
|
|
10467
10626
|
}
|
|
10468
10627
|
if (marker === 217)
|
|
10469
10628
|
break;
|
|
@@ -10472,6 +10631,8 @@ function jpegSize(bytes) {
|
|
|
10472
10631
|
const length = bytes[p] * 256 + bytes[p + 1], end = p + length;
|
|
10473
10632
|
if (length < 2 || end > bytes.length)
|
|
10474
10633
|
throw new TypeError("Truncated JPEG segment.");
|
|
10634
|
+
if (marker === 238 && length >= 14 && String.fromCharCode(...bytes.subarray(p + 2, p + 7)) === "Adobe")
|
|
10635
|
+
adobe = true;
|
|
10475
10636
|
if (marker === 226 && length >= 14 && String.fromCharCode(...bytes.subarray(p + 2, p + 14)) === "ICC_PROFILE\0")
|
|
10476
10637
|
throw new NotSupportedError("Normalize ICC-profiled JPEG colors before PDF embedding.");
|
|
10477
10638
|
if (marker === 225 && length >= 8 && String.fromCharCode(...bytes.subarray(p + 2, p + 8)) === "Exif\0\0")
|
|
@@ -10484,7 +10645,8 @@ function jpegSize(bytes) {
|
|
|
10484
10645
|
throw new NotSupportedError("PDF JPEG images require grayscale or RGB components; CMYK is unsupported.");
|
|
10485
10646
|
if (components === 3) {
|
|
10486
10647
|
const ids = [bytes[p + 8], bytes[p + 11], bytes[p + 14]].join(",");
|
|
10487
|
-
|
|
10648
|
+
rgb = ids === "82,71,66";
|
|
10649
|
+
if (ids !== "1,2,3" && !rgb)
|
|
10488
10650
|
throw new NotSupportedError("Unsupported JPEG component color layout.");
|
|
10489
10651
|
}
|
|
10490
10652
|
if (result)
|
|
@@ -10495,12 +10657,12 @@ function jpegSize(bytes) {
|
|
|
10495
10657
|
}
|
|
10496
10658
|
throw new TypeError("JPEG image has no complete frame and scan.");
|
|
10497
10659
|
}
|
|
10498
|
-
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages });
|
|
10499
|
-
_modules.set("
|
|
10660
|
+
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages, jpegSize: jpegSize });
|
|
10661
|
+
_modules.set("32ca4982f963f400829c2e364b7d3479f36d91740dafb32d600f29b5cac487ec", _exports);
|
|
10500
10662
|
return _exports;
|
|
10501
10663
|
})();
|
|
10502
10664
|
|
|
10503
|
-
const _m88 = _modules.get("
|
|
10665
|
+
const _m88 = _modules.get("9ba2dfd6f5c8ef9b1a51427ddee0d0971b139afdd49a175bf6525812ca7d87c8") ?? (() => {
|
|
10504
10666
|
const { OfficeIMOError } = _m2;
|
|
10505
10667
|
|
|
10506
10668
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -10583,16 +10745,16 @@ async function vectorCommands(block, settings, used) {
|
|
|
10583
10745
|
commands.join("") + (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
10584
10746
|
}
|
|
10585
10747
|
const _exports = Object.freeze({ vectorCommands: vectorCommands });
|
|
10586
|
-
_modules.set("
|
|
10748
|
+
_modules.set("9ba2dfd6f5c8ef9b1a51427ddee0d0971b139afdd49a175bf6525812ca7d87c8", _exports);
|
|
10587
10749
|
return _exports;
|
|
10588
10750
|
})();
|
|
10589
10751
|
|
|
10590
|
-
const _m89 = _modules.get("
|
|
10752
|
+
const _m89 = _modules.get("da0657c49ac1393409d051be5e5dd70d2a0dc5221d363b422d7da31e9b940ea2") ?? (() => {
|
|
10591
10753
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
10592
10754
|
|
|
10593
10755
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
10594
10756
|
|
|
10595
|
-
const { color, positive } = _m17;
|
|
10757
|
+
const { color, pdfDrawingMaxDepth, positive } = _m17;
|
|
10596
10758
|
|
|
10597
10759
|
const { pdfNumber: n } = _m61;
|
|
10598
10760
|
|
|
@@ -10614,22 +10776,50 @@ function clipRectangle(value) {
|
|
|
10614
10776
|
const clip = record(value, ["x", "y", "width", "height"], "drawing clip");
|
|
10615
10777
|
return { x: coordinate(clip.x), y: coordinate(clip.y), width: positive(clip.width, "Drawing clip width", 1000000), height: positive(clip.height, "Drawing clip height", 1000000) };
|
|
10616
10778
|
}
|
|
10779
|
+
/** A PDF dash array: 1 through 16 nonnegative lengths, not all zero, and a finite phase. */
|
|
10780
|
+
function dashPattern(value, offset) {
|
|
10781
|
+
if (value === undefined) {
|
|
10782
|
+
if (offset !== undefined)
|
|
10783
|
+
throw new TypeError("Drawing dashOffset requires dash.");
|
|
10784
|
+
return "";
|
|
10785
|
+
}
|
|
10786
|
+
if (!Array.isArray(value) || !value.length || value.length > 16)
|
|
10787
|
+
throw new TypeError("Drawing dash must list 1 through 16 nonnegative lengths with at least one positive length.");
|
|
10788
|
+
const lengths = Array.from(value, item => {
|
|
10789
|
+
if (typeof item !== "number" || !Number.isFinite(item) || item < 0 || item > 14400)
|
|
10790
|
+
throw new TypeError("Drawing dash lengths must be from 0 through 14,400 points.");
|
|
10791
|
+
return n(item);
|
|
10792
|
+
});
|
|
10793
|
+
if (lengths.every(length => length === "0"))
|
|
10794
|
+
throw new TypeError("Drawing dash needs a positive length after PDF rounding.");
|
|
10795
|
+
let phase = coordinate(offset ?? 0);
|
|
10796
|
+
if (phase < 0) {
|
|
10797
|
+
// Work in serialized thousandths of a point. Odd arrays repeat twice before the paint state repeats.
|
|
10798
|
+
const period = lengths.reduce((sum, length) => sum + Math.round(Number(length) * 1000), 0) * (lengths.length % 2 ? 2 : 1);
|
|
10799
|
+
phase = ((Math.round(phase * 1000) % period + period) % period) / 1000;
|
|
10800
|
+
}
|
|
10801
|
+
return "[" + lengths.join(" ") + "] " + n(phase) + " d\n";
|
|
10802
|
+
}
|
|
10617
10803
|
async function cooperate(settings) {
|
|
10618
10804
|
if (taskYieldDue())
|
|
10619
10805
|
await pause();
|
|
10620
10806
|
checkAbort(settings.options.signal);
|
|
10621
10807
|
}
|
|
10622
10808
|
/** Take ownership of one bounded schema before any cooperative or font work can run caller code. */
|
|
10623
|
-
function captureDrawing(drawing, settings, used) {
|
|
10809
|
+
function captureDrawing(drawing, settings, used, images) {
|
|
10624
10810
|
checkAbort(settings.options.signal);
|
|
10625
|
-
const root = record(drawing, ["version", "width", "height", "elements"], "drawing");
|
|
10626
|
-
|
|
10627
|
-
|
|
10811
|
+
const root = record(drawing, ["version", "width", "height", "elements", "standardFonts"], "drawing");
|
|
10812
|
+
const standardFonts = root.standardFonts;
|
|
10813
|
+
if (standardFonts !== undefined && typeof standardFonts !== "boolean")
|
|
10814
|
+
throw new TypeError("Drawing standardFonts must be boolean.");
|
|
10815
|
+
const version = root.version;
|
|
10816
|
+
if (version !== 1 && version !== 2)
|
|
10817
|
+
throw new NotSupportedError("Only portable drawing versions 1 and 2 are supported.");
|
|
10628
10818
|
const width = positive(root.width, "Drawing width"), height = positive(root.height, "Drawing height");
|
|
10629
10819
|
let commands = used.commands, elements = used.elements;
|
|
10630
10820
|
const ancestors = new Set();
|
|
10631
10821
|
function path(value) {
|
|
10632
|
-
record(value, ["kind", "commands", "fill", "stroke", "strokeWidth", "fillRule", "lineCap", "lineJoin"], "drawing path");
|
|
10822
|
+
record(value, ["kind", "commands", "fill", "stroke", "strokeWidth", "fillRule", "lineCap", "lineJoin", "miterLimit", "dash", "dashOffset"], "drawing path");
|
|
10633
10823
|
const source = value.commands;
|
|
10634
10824
|
if (!Array.isArray(source))
|
|
10635
10825
|
throw new TypeError("Drawing path commands must be an array.");
|
|
@@ -10651,6 +10841,10 @@ function captureDrawing(drawing, settings, used) {
|
|
|
10651
10841
|
throw new TypeError("Invalid drawing lineCap.");
|
|
10652
10842
|
if (lineJoin !== undefined && !["miter", "round", "bevel"].includes(lineJoin))
|
|
10653
10843
|
throw new TypeError("Invalid drawing lineJoin.");
|
|
10844
|
+
const miterLimit = positive(value.miterLimit ?? 10, "Drawing miter limit", 1000000);
|
|
10845
|
+
if (miterLimit < 1)
|
|
10846
|
+
throw new RangeError("Drawing miter limit must be at least 1.");
|
|
10847
|
+
const dash = dashPattern(value.dash, value.dashOffset);
|
|
10654
10848
|
for (let i = 0; i < snapshot.length; i++) {
|
|
10655
10849
|
const c = snapshot[i];
|
|
10656
10850
|
if (!c || typeof c !== "object")
|
|
@@ -10683,11 +10877,12 @@ function captureDrawing(drawing, settings, used) {
|
|
|
10683
10877
|
if (!started)
|
|
10684
10878
|
throw new TypeError("A drawing path needs at least one command.");
|
|
10685
10879
|
return { kind: "path", commands: copied, style: (fill === undefined ? "" : fill + " rg\n") + (stroke === undefined ? "" : stroke + " RG\n" + n(strokeWidth) + " w\n") +
|
|
10686
|
-
String(["butt", "round", "square"].indexOf(lineCap ?? "butt")) + " J\n" + String(["miter", "round", "bevel"].indexOf(lineJoin ?? "miter")) +
|
|
10880
|
+
String(["butt", "round", "square"].indexOf(lineCap ?? "butt")) + " J\n" + String(["miter", "round", "bevel"].indexOf(lineJoin ?? "miter")) +
|
|
10881
|
+
" j\n" + n(miterLimit) + " M\n" + dash,
|
|
10687
10882
|
paint: (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
10688
10883
|
}
|
|
10689
10884
|
function text(value) {
|
|
10690
|
-
record(value, ["kind", "text", "x", "y", "font", "fontSize", "color"], "drawing text");
|
|
10885
|
+
record(value, ["kind", "text", "x", "y", "font", "fontSize", "color", "anchor", "rotation"], "drawing text");
|
|
10691
10886
|
const snapshot = value.text, slot = value.font;
|
|
10692
10887
|
if (typeof snapshot !== "string")
|
|
10693
10888
|
throw new TypeError("Drawing text must be a string.");
|
|
@@ -10698,14 +10893,33 @@ function captureDrawing(drawing, settings, used) {
|
|
|
10698
10893
|
if (!["regular", "bold", "italic", "boldItalic"].includes(slot))
|
|
10699
10894
|
throw new TypeError("Invalid drawing font slot.");
|
|
10700
10895
|
const x = coordinate(value.x), y = coordinate(value.y), size = positive(value.fontSize, "Drawing font size"), foreground = color(value.color);
|
|
10896
|
+
const anchor = value.anchor, rotation = value.rotation ?? 0;
|
|
10897
|
+
if (anchor !== undefined && !["start", "middle", "end"].includes(anchor))
|
|
10898
|
+
throw new TypeError("Invalid drawing text anchor.");
|
|
10899
|
+
if (typeof rotation !== "number" || !Number.isFinite(rotation) || Math.abs(rotation) > 360)
|
|
10900
|
+
throw new RangeError("Drawing text rotation must be finite degrees within -360 through 360.");
|
|
10701
10901
|
settings.budget.cell(snapshot);
|
|
10702
|
-
|
|
10902
|
+
// Quarter turns stay exact so upright and vertical axis labels keep integral matrices.
|
|
10903
|
+
const turn = rotation % 90 === 0 ? (((rotation / 90) % 4) + 4) % 4 : -1, radians = rotation * Math.PI / 180;
|
|
10904
|
+
const cos = turn < 0 ? Math.cos(radians) : [1, 0, -1, 0][turn], sin = turn < 0 ? Math.sin(radians) : [0, 1, 0, -1][turn];
|
|
10905
|
+
return { kind: "text", text: snapshot, x, y, size, color: foreground, font: slot, anchor: anchor === "middle" ? .5 : anchor === "end" ? 1 : 0, cos, sin };
|
|
10906
|
+
}
|
|
10907
|
+
function image(value) {
|
|
10908
|
+
record(value, ["kind", "image", "x", "y", "width", "height", "opacity"], "drawing image");
|
|
10909
|
+
const x = coordinate(value.x), y = coordinate(value.y), suppliedOpacity = value.opacity;
|
|
10910
|
+
const opacity = suppliedOpacity === undefined ? 1 : suppliedOpacity;
|
|
10911
|
+
const width = positive(value.width, "Drawing image width", 1000000), height = positive(value.height, "Drawing image height", 1000000);
|
|
10912
|
+
if (typeof opacity !== "number" || !(opacity >= 0 && opacity <= 1))
|
|
10913
|
+
throw new RangeError("Drawing image opacity must be from 0 through 1.");
|
|
10914
|
+
const source = value.image;
|
|
10915
|
+
images.snapshot(source);
|
|
10916
|
+
return { kind: "image", image: source, x, y, width, height, opacity };
|
|
10703
10917
|
}
|
|
10704
10918
|
function children(input, depth) {
|
|
10705
10919
|
if (!Array.isArray(input))
|
|
10706
10920
|
throw new TypeError("Drawing elements must be an array.");
|
|
10707
|
-
if (depth >
|
|
10708
|
-
throw new RangeError("Drawing groups support at most
|
|
10921
|
+
if (depth > pdfDrawingMaxDepth && input.length)
|
|
10922
|
+
throw new RangeError("Drawing groups support at most " + pdfDrawingMaxDepth + " element levels.");
|
|
10709
10923
|
if (elements + input.length > settings.limits.maxDrawingElements)
|
|
10710
10924
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxDrawingElements exceeded.");
|
|
10711
10925
|
checkAbort(settings.options.signal);
|
|
@@ -10723,6 +10937,8 @@ function captureDrawing(drawing, settings, used) {
|
|
|
10723
10937
|
output.push(path(value));
|
|
10724
10938
|
else if (kind === "text")
|
|
10725
10939
|
output.push(text(value));
|
|
10940
|
+
else if (kind === "image" && version === 2)
|
|
10941
|
+
output.push(image(value));
|
|
10726
10942
|
else if (kind === "group") {
|
|
10727
10943
|
record(value, ["kind", "clip", "elements"], "drawing group");
|
|
10728
10944
|
const clipValue = value.clip, clip = clipValue === undefined ? undefined : clipRectangle(clipValue);
|
|
@@ -10739,29 +10955,35 @@ function captureDrawing(drawing, settings, used) {
|
|
|
10739
10955
|
}
|
|
10740
10956
|
const plan = children(root.elements, 1);
|
|
10741
10957
|
checkAbort(settings.options.signal);
|
|
10742
|
-
return { width, height, plan, commands: commands - used.commands, elements: elements - used.elements };
|
|
10958
|
+
return { width, height, plan, commands: commands - used.commands, elements: elements - used.elements, standardFonts: standardFonts === true };
|
|
10743
10959
|
}
|
|
10744
10960
|
/** Preflight and paint owned records. The existing font owner retains glyph maps and subsets. */
|
|
10745
|
-
async function prepareDrawing(drawing, settings, fonts, used) {
|
|
10961
|
+
async function prepareDrawing(drawing, settings, fonts, used, resources) {
|
|
10746
10962
|
// A drawing's bounded capture is synchronous; yielding here would leave later caller records borrowed.
|
|
10747
|
-
const captured = captureDrawing(drawing, settings, used), drawingFonts = new Map();
|
|
10963
|
+
const { images } = resources, captured = captureDrawing(drawing, settings, used, images), drawingFonts = new Map();
|
|
10748
10964
|
function fontFor(slot) {
|
|
10749
10965
|
const existing = drawingFonts.get(slot);
|
|
10750
10966
|
if (existing)
|
|
10751
10967
|
return existing;
|
|
10752
|
-
const font = fonts.select(slot === "bold" || slot === "boldItalic", slot === "italic" || slot === "boldItalic");
|
|
10753
|
-
if (
|
|
10968
|
+
const font = fonts.select(slot === "bold" || slot === "boldItalic", slot === "italic" || slot === "boldItalic", undefined, captured.standardFonts);
|
|
10969
|
+
if (font.syntheticBold || font.syntheticItalic || !font.program && !captured.standardFonts)
|
|
10754
10970
|
throw new NotSupportedError("Drawing text without an exact embedded font face at fonts." + slot);
|
|
10755
10971
|
drawingFonts.set(slot, font);
|
|
10756
10972
|
return font;
|
|
10757
10973
|
}
|
|
10758
10974
|
// The work budget belongs to the drawing, including short runs in separate sibling groups.
|
|
10759
10975
|
let preflightCharacters = 0, preflightElements = 0;
|
|
10976
|
+
const imageNames = new Map();
|
|
10760
10977
|
async function preflight(nodes) {
|
|
10761
10978
|
for (let i = 0; i < nodes.length; i++) {
|
|
10762
10979
|
const node = nodes[i];
|
|
10763
10980
|
if (node.kind === "group")
|
|
10764
10981
|
await preflight(node.children);
|
|
10982
|
+
else if (node.kind === "image" && !imageNames.has(node.image)) {
|
|
10983
|
+
const resource = await images.prepare(node.image);
|
|
10984
|
+
resources.registerImage(resource.name, resource.id);
|
|
10985
|
+
imageNames.set(node.image, resource.name);
|
|
10986
|
+
}
|
|
10765
10987
|
else if (node.kind === "text") {
|
|
10766
10988
|
const font = fontFor(node.font);
|
|
10767
10989
|
for (const character of node.text) {
|
|
@@ -10804,9 +11026,23 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
10804
11026
|
}
|
|
10805
11027
|
add(node.paint);
|
|
10806
11028
|
}
|
|
11029
|
+
else if (node.kind === "image") {
|
|
11030
|
+
// Image space is a unit square with a bottom-left origin; the drawing's y axis points down.
|
|
11031
|
+
if (node.opacity < 1)
|
|
11032
|
+
add("/" + resources.opacity(node.opacity) + " gs\n");
|
|
11033
|
+
add([node.width, 0, 0, -node.height, node.x, node.y + node.height].map(n).join(" ") + " cm /" + imageNames.get(node.image) + " Do\n");
|
|
11034
|
+
}
|
|
10807
11035
|
else {
|
|
10808
11036
|
const font = fontFor(node.font);
|
|
10809
|
-
|
|
11037
|
+
let shift = 0;
|
|
11038
|
+
if (node.anchor) {
|
|
11039
|
+
for (const character of node.text)
|
|
11040
|
+
shift += font.width(character.codePointAt(0));
|
|
11041
|
+
shift *= node.size / 1000 * node.anchor;
|
|
11042
|
+
}
|
|
11043
|
+
// Text space is upright in the drawing's downward y axis; rotation turns the baseline clockwise about its anchor.
|
|
11044
|
+
add(node.color + " rg\nBT /" + font.name + " " + n(node.size) + " Tf 0 Tr " +
|
|
11045
|
+
[node.cos, node.sin, node.sin, -node.cos, node.x - shift * node.cos, node.y - shift * node.sin].map(n).join(" ") + " Tm <");
|
|
10810
11046
|
let chunk = "";
|
|
10811
11047
|
for (const character of node.text) {
|
|
10812
11048
|
chunk += character;
|
|
@@ -10830,11 +11066,11 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
10830
11066
|
return { width: captured.width, height: captured.height, content: fragments.join(""), commands: captured.commands, elements: captured.elements };
|
|
10831
11067
|
}
|
|
10832
11068
|
const _exports = Object.freeze({ checkDrawingBlock: checkDrawingBlock, prepareDrawing: prepareDrawing });
|
|
10833
|
-
_modules.set("
|
|
11069
|
+
_modules.set("da0657c49ac1393409d051be5e5dd70d2a0dc5221d363b422d7da31e9b940ea2", _exports);
|
|
10834
11070
|
return _exports;
|
|
10835
11071
|
})();
|
|
10836
11072
|
|
|
10837
|
-
const _m90 = _modules.get("
|
|
11073
|
+
const _m90 = _modules.get("37923737a6bcae4c342ab023bd3cb01ddeaced28543718aad078b51b54d8f31d") ?? (() => {
|
|
10838
11074
|
const { OfficeIMOError } = _m2;
|
|
10839
11075
|
|
|
10840
11076
|
const { capturePdfText, wrapPdfText } = _m72;
|
|
@@ -10914,11 +11150,11 @@ function paragraphStartHeight(paragraphs) {
|
|
|
10914
11150
|
return required;
|
|
10915
11151
|
}
|
|
10916
11152
|
const _exports = Object.freeze({ captureParagraph: captureParagraph, captureCaption: captureCaption, prepareParagraph: prepareParagraph, checkParagraphBuffer: checkParagraphBuffer, paragraphStartHeight: paragraphStartHeight });
|
|
10917
|
-
_modules.set("
|
|
11153
|
+
_modules.set("37923737a6bcae4c342ab023bd3cb01ddeaced28543718aad078b51b54d8f31d", _exports);
|
|
10918
11154
|
return _exports;
|
|
10919
11155
|
})();
|
|
10920
11156
|
|
|
10921
|
-
const _m91 = _modules.get("
|
|
11157
|
+
const _m91 = _modules.get("964206f2e7c45a34e414d4d690243bf90eb4cf99793e13d1cda834de3d386773") ?? (() => {
|
|
10922
11158
|
const { capturePdfText, wrapPdfText } = _m72;
|
|
10923
11159
|
|
|
10924
11160
|
const { captureParagraph, prepareParagraph } = _m90;
|
|
@@ -10972,11 +11208,11 @@ async function prepareListItem(item, index, options, settings, fonts) {
|
|
|
10972
11208
|
height: paragraph.height + lineHeight - first.lineHeight, firstHeight: paragraph.spaceBefore + lineHeight } };
|
|
10973
11209
|
}
|
|
10974
11210
|
const _exports = Object.freeze({ captureListOptions: captureListOptions, prepareListItem: prepareListItem });
|
|
10975
|
-
_modules.set("
|
|
11211
|
+
_modules.set("964206f2e7c45a34e414d4d690243bf90eb4cf99793e13d1cda834de3d386773", _exports);
|
|
10976
11212
|
return _exports;
|
|
10977
11213
|
})();
|
|
10978
11214
|
|
|
10979
|
-
const _m93 = _modules.get("
|
|
11215
|
+
const _m93 = _modules.get("f254a333f483757dc21be9d40dbd3ca51013d32a3c646b564270e3902226a590") ?? (() => {
|
|
10980
11216
|
const { assertGroupedReportSource } = _m8;
|
|
10981
11217
|
|
|
10982
11218
|
const { captureFields } = _m10;
|
|
@@ -11022,11 +11258,11 @@ function captureGroupedPdfTableOptions(configuration) {
|
|
|
11022
11258
|
...(captured.footerPresentation === undefined ? {} : { footerPresentation: presentation(captured.footerPresentation) }) });
|
|
11023
11259
|
}
|
|
11024
11260
|
const _exports = Object.freeze({ groupedPdfLabelFields: groupedPdfLabelFields, groupedPdfTableFields: groupedPdfTableFields, pdfGroupedTable: pdfGroupedTable, captureGroupedPdfTableOptions: captureGroupedPdfTableOptions });
|
|
11025
|
-
_modules.set("
|
|
11261
|
+
_modules.set("f254a333f483757dc21be9d40dbd3ca51013d32a3c646b564270e3902226a590", _exports);
|
|
11026
11262
|
return _exports;
|
|
11027
11263
|
})();
|
|
11028
11264
|
|
|
11029
|
-
const _m92 = _modules.get("
|
|
11265
|
+
const _m92 = _modules.get("a3ebee86ff33369e9ebc8b994d71bad32497a55433a313c426676277cb660d2f") ?? (() => {
|
|
11030
11266
|
const { assertGroupedReportSource, groupedReportOperation } = _m8;
|
|
11031
11267
|
|
|
11032
11268
|
const { consumeRows } = _m4;
|
|
@@ -11280,11 +11516,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
11280
11516
|
}
|
|
11281
11517
|
}
|
|
11282
11518
|
const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
|
|
11283
|
-
_modules.set("
|
|
11519
|
+
_modules.set("a3ebee86ff33369e9ebc8b994d71bad32497a55433a313c426676277cb660d2f", _exports);
|
|
11284
11520
|
return _exports;
|
|
11285
11521
|
})();
|
|
11286
11522
|
|
|
11287
|
-
const _m85 = _modules.get("
|
|
11523
|
+
const _m85 = _modules.get("e7fe5a5c6b675c6217db5f5a72d8883609e8417ee3c6f3c2184d375463f93231") ?? (() => {
|
|
11288
11524
|
const { BlobByteSink, withDestination } = _m3;
|
|
11289
11525
|
|
|
11290
11526
|
const { OfficeIMOError } = _m2;
|
|
@@ -11534,7 +11770,9 @@ async function writePdfDocumentTo(blocks, destination, configuration = {}) {
|
|
|
11534
11770
|
const inputDrawing = block.drawing, capturedCaption = snapshotCaption(block.caption), alternative = graphicAlternative(block, pages.settings), alignment = graphicAlignment(block.alignment);
|
|
11535
11771
|
if (capturedCaption && alternative === undefined)
|
|
11536
11772
|
throw new TypeError("A captioned PDF graphic requires alternativeText and cannot be decorative.");
|
|
11537
|
-
const drawing = await prepareDrawing(inputDrawing, pages.settings, fonts, { commands, elements: drawingElements }
|
|
11773
|
+
const drawing = await prepareDrawing(inputDrawing, pages.settings, fonts, { commands, elements: drawingElements }, {
|
|
11774
|
+
images, registerImage: (name, id) => pages.registerXObject(name, id), opacity: alpha => pages.opacityState(alpha)
|
|
11775
|
+
}), caption = await prepareCaption(capturedCaption);
|
|
11538
11776
|
commands += drawing.commands;
|
|
11539
11777
|
drawingElements += drawing.elements;
|
|
11540
11778
|
await flushParagraphs((caption?.height ?? 0) + pages.graphicHeight(drawing.width, drawing.height));
|
|
@@ -11574,11 +11812,11 @@ function captureTableOptions(options) {
|
|
|
11574
11812
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
11575
11813
|
}
|
|
11576
11814
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
11577
|
-
_modules.set("
|
|
11815
|
+
_modules.set("e7fe5a5c6b675c6217db5f5a72d8883609e8417ee3c6f3c2184d375463f93231", _exports);
|
|
11578
11816
|
return _exports;
|
|
11579
11817
|
})();
|
|
11580
11818
|
|
|
11581
|
-
const _m84 = _modules.get("
|
|
11819
|
+
const _m84 = _modules.get("37e4a768d57818c4335fd3d61b9b7aae633cde303e7634579655a6a3de4a86ce") ?? (() => {
|
|
11582
11820
|
const { assertGroupedReportSource } = _m8;
|
|
11583
11821
|
|
|
11584
11822
|
const { BlobByteSink } = _m3;
|
|
@@ -11624,7 +11862,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
11624
11862
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
11625
11863
|
}
|
|
11626
11864
|
const _exports = Object.freeze({ pdfGroupedTable: _m93.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
11627
|
-
_modules.set("
|
|
11865
|
+
_modules.set("37e4a768d57818c4335fd3d61b9b7aae633cde303e7634579655a6a3de4a86ce", _exports);
|
|
11628
11866
|
return _exports;
|
|
11629
11867
|
})();
|
|
11630
11868
|
|
|
@@ -11668,10 +11906,10 @@ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86",
|
|
|
11668
11906
|
return _exports;
|
|
11669
11907
|
})();
|
|
11670
11908
|
|
|
11671
|
-
const _m58 = _modules.get("
|
|
11909
|
+
const _m58 = _modules.get("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca") ?? (() => {
|
|
11672
11910
|
|
|
11673
11911
|
const _exports = Object.freeze({ writePdf: _m59.writePdf, writePdfTo: _m59.writePdfTo, writeGroupedPdf: _m84.writeGroupedPdf, writeGroupedPdfTo: _m84.writeGroupedPdfTo, pdfGroupedTable: _m84.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m85.writePdfDocument, writePdfDocumentTo: _m85.writePdfDocumentTo, pdfTable: _m85.pdfTable, PdfFont: _m64.PdfFont, preflightPdfText: _m94.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
|
|
11674
|
-
_modules.set("
|
|
11912
|
+
_modules.set("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca", _exports);
|
|
11675
11913
|
return _exports;
|
|
11676
11914
|
})();
|
|
11677
11915
|
|
|
@@ -11861,7 +12099,25 @@ _modules.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",
|
|
|
11861
12099
|
return _exports;
|
|
11862
12100
|
})();
|
|
11863
12101
|
|
|
11864
|
-
const
|
|
12102
|
+
const _m100 = _modules.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac") ?? (() => {
|
|
12103
|
+
/** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
|
|
12104
|
+
* Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
|
|
12105
|
+
const canopyTonePalette = Object.freeze({
|
|
12106
|
+
info: Object.freeze({ color: "4472C4", background: "DDEBF7", foreground: "1F4E78" }),
|
|
12107
|
+
success: Object.freeze({ color: "70AD47", background: "E2F0D9", foreground: "375623" }),
|
|
12108
|
+
warning: Object.freeze({ color: "FFC000", background: "FFF2CC", foreground: "7F5000" }),
|
|
12109
|
+
danger: Object.freeze({ color: "C00000", background: "FFC7CE", foreground: "9C0006" }),
|
|
12110
|
+
// Muted tones dim the text rather than painting the cell.
|
|
12111
|
+
muted: Object.freeze({ color: "A6A6A6", foreground: "595959" })
|
|
12112
|
+
});
|
|
12113
|
+
/** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
|
|
12114
|
+
const canopyDefaultTones = new Map(Object.entries(canopyTonePalette).map(([name, tone]) => [name, Object.freeze({ ...(tone.background === undefined ? {} : { background: tone.background }), color: tone.foreground })]));
|
|
12115
|
+
const _exports = Object.freeze({ canopyTonePalette: canopyTonePalette, canopyDefaultTones: canopyDefaultTones });
|
|
12116
|
+
_modules.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac", _exports);
|
|
12117
|
+
return _exports;
|
|
12118
|
+
})();
|
|
12119
|
+
|
|
12120
|
+
const _m96 = _modules.get("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7") ?? (() => {
|
|
11865
12121
|
const { ExportCell, checkAbort, inputRows } = _m1;
|
|
11866
12122
|
|
|
11867
12123
|
const { canopyPivot, pivotNumberFormat } = _m97;
|
|
@@ -11878,8 +12134,21 @@ const { canopyDiagnostics } = _m95;
|
|
|
11878
12134
|
|
|
11879
12135
|
const { canopyNumberFormat, canopyXlsxWidth } = _m99;
|
|
11880
12136
|
|
|
12137
|
+
const { canopyDefaultTones } = _m100;
|
|
12138
|
+
|
|
11881
12139
|
const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
|
|
12140
|
+
// Captured presentations whose cell text already carries the readable content (badge labels are appended below).
|
|
12141
|
+
// Their visual loss is reported, never treated as an unsupported export.
|
|
12142
|
+
const textFallbacks = new Set(["relative-link", "history-series", "badges", "custom-class", "custom-renderer"]);
|
|
12143
|
+
const badgeSeparator = " \u00b7 ";
|
|
11882
12144
|
const rawIdentities = new WeakMap();
|
|
12145
|
+
// Appended badge labels, kept apart so later passes that re-render a cell's text (PDF numbers) can carry them over.
|
|
12146
|
+
const badgeSuffixes = new WeakMap();
|
|
12147
|
+
/** @internal The text a later pass may re-render, and the badge suffix it must append back unchanged. */
|
|
12148
|
+
function canopyBadgeSplit(cell) {
|
|
12149
|
+
const suffix = badgeSuffixes.get(cell), text = cell.text ?? "";
|
|
12150
|
+
return suffix !== undefined && text.endsWith(suffix) ? { text: text.slice(0, text.length - suffix.length), suffix } : { text, suffix: "" };
|
|
12151
|
+
}
|
|
11883
12152
|
/** @internal Grouping uses captured identity even when a detail cell displays a relative-link label. */
|
|
11884
12153
|
function canopyIdentityValue(value) {
|
|
11885
12154
|
if (!(value instanceof ExportCell))
|
|
@@ -11887,6 +12156,30 @@ function canopyIdentityValue(value) {
|
|
|
11887
12156
|
const original = rawIdentities.get(value);
|
|
11888
12157
|
return original === undefined ? value.value : original;
|
|
11889
12158
|
}
|
|
12159
|
+
// Grids accept any number of badges. Exports keep the first labels that stay readable and fit an Excel text cell,
|
|
12160
|
+
// and report how many were left out instead of failing the whole document.
|
|
12161
|
+
const maximumBadges = 64, maximumCellText = 32767;
|
|
12162
|
+
function badgeText(input, text) {
|
|
12163
|
+
if (!Array.isArray(input))
|
|
12164
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
12165
|
+
let labels = "", kept = 0, dropped = 0;
|
|
12166
|
+
for (const badge of input) {
|
|
12167
|
+
const value = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
|
|
12168
|
+
if (typeof value !== "string")
|
|
12169
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
12170
|
+
const label = value.trim();
|
|
12171
|
+
if (!label)
|
|
12172
|
+
continue;
|
|
12173
|
+
const next = labels ? labels + badgeSeparator + label : label;
|
|
12174
|
+
if (kept >= maximumBadges || (text ? text.length + badgeSeparator.length : 0) + next.length > maximumCellText) {
|
|
12175
|
+
dropped++;
|
|
12176
|
+
continue;
|
|
12177
|
+
}
|
|
12178
|
+
labels = next;
|
|
12179
|
+
kept++;
|
|
12180
|
+
}
|
|
12181
|
+
return { labels: labels || undefined, dropped };
|
|
12182
|
+
}
|
|
11890
12183
|
/** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
|
|
11891
12184
|
function createCanopyExport(capture, format, options = {}) {
|
|
11892
12185
|
return prepareCanopyExport(capture, format, options).source;
|
|
@@ -11920,7 +12213,7 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
11920
12213
|
throw new TypeError("Canopy presentation diagnostics must be strings.");
|
|
11921
12214
|
for (const code of items) {
|
|
11922
12215
|
const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
|
|
11923
|
-
(code
|
|
12216
|
+
(textFallbacks.has(code) ? fallback : report)(diagnostic);
|
|
11924
12217
|
}
|
|
11925
12218
|
};
|
|
11926
12219
|
if (request.presentation !== "text" && request.presentation !== "semantic")
|
|
@@ -11935,11 +12228,13 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
11935
12228
|
return undefined;
|
|
11936
12229
|
if (typeof name !== "string")
|
|
11937
12230
|
throw new TypeError("Canopy tones must be strings.");
|
|
11938
|
-
const style = tones.get(name);
|
|
12231
|
+
const style = tones.get(name) ?? canopyDefaultTones.get(name);
|
|
11939
12232
|
if (!style && name !== "neutral")
|
|
11940
12233
|
fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
|
|
11941
12234
|
return style;
|
|
11942
12235
|
};
|
|
12236
|
+
// The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
|
|
12237
|
+
const ruleOperands = new Set();
|
|
11943
12238
|
const ids = new Set();
|
|
11944
12239
|
const specs = (pivot?.columns ?? request.columns).map(input => {
|
|
11945
12240
|
const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
|
|
@@ -11998,8 +12293,17 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
11998
12293
|
diagnostics(cell.diagnostics, row.id, spec.id);
|
|
11999
12294
|
// A relative destination is navigation metadata, not the visible label.
|
|
12000
12295
|
// History captures already carry their frozen latest scalar (or null).
|
|
12001
|
-
|
|
12002
|
-
|
|
12296
|
+
// Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
|
|
12297
|
+
const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
|
|
12298
|
+
const badged = cell.badges === undefined ? undefined : badgeText(cell.badges, cell.text), badges = badged?.labels;
|
|
12299
|
+
if (badged?.dropped)
|
|
12300
|
+
fallback({ code: "BADGES_TRUNCATED:" + badged.dropped, rowId: row.id, columnId: spec.id });
|
|
12301
|
+
const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
|
|
12302
|
+
// Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
|
|
12303
|
+
// Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
|
|
12304
|
+
// A cell whose badges were all left out still exports its captured label, as it would with the badges.
|
|
12305
|
+
const badgedValue = (!!badges || !!badged?.dropped) && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
|
|
12306
|
+
let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
|
|
12003
12307
|
if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
|
|
12004
12308
|
value = datetime(value, dateMode, clock);
|
|
12005
12309
|
const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
|
|
@@ -12014,9 +12318,12 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
12014
12318
|
if (format === "csv")
|
|
12015
12319
|
result.push(value);
|
|
12016
12320
|
else {
|
|
12017
|
-
const exported = new ExportCell(value, { text
|
|
12018
|
-
if (relativeLabel)
|
|
12321
|
+
const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
|
|
12322
|
+
if (relativeLabel || badgedValue)
|
|
12019
12323
|
rawIdentities.set(exported, cell.value);
|
|
12324
|
+
// A badge-only label is all suffix: later passes then see the captured label as empty.
|
|
12325
|
+
if (badges)
|
|
12326
|
+
badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
|
|
12020
12327
|
result.push(exported);
|
|
12021
12328
|
}
|
|
12022
12329
|
}
|
|
@@ -12028,14 +12335,14 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
12028
12335
|
if (rowCount !== null && count !== rowCount)
|
|
12029
12336
|
throw new TypeError("Canopy capture did not produce its declared recordCount.");
|
|
12030
12337
|
} });
|
|
12031
|
-
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
|
|
12338
|
+
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
|
|
12032
12339
|
}
|
|
12033
|
-
const _exports = Object.freeze({ canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
|
|
12034
|
-
_modules.set("
|
|
12340
|
+
const _exports = Object.freeze({ canopyBadgeSplit: canopyBadgeSplit, canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
|
|
12341
|
+
_modules.set("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7", _exports);
|
|
12035
12342
|
return _exports;
|
|
12036
12343
|
})();
|
|
12037
12344
|
|
|
12038
|
-
const
|
|
12345
|
+
const _m102 = _modules.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c") ?? (() => {
|
|
12039
12346
|
const { columnName, excelDate } = _m35;
|
|
12040
12347
|
|
|
12041
12348
|
const { captureFields } = _m10;
|
|
@@ -12043,7 +12350,7 @@ const { captureFields } = _m10;
|
|
|
12043
12350
|
const { datetime } = _m98;
|
|
12044
12351
|
|
|
12045
12352
|
/** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
|
|
12046
|
-
function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
|
|
12353
|
+
function canopyPredicate(request, grouped, options, root, unsupported, cellTypes, operands) {
|
|
12047
12354
|
let nodes = 0;
|
|
12048
12355
|
const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
|
|
12049
12356
|
const numeric = (value) => {
|
|
@@ -12090,6 +12397,7 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
|
|
|
12090
12397
|
const index = request.columns.findIndex(column => column.id === filter.column);
|
|
12091
12398
|
if (index < 0)
|
|
12092
12399
|
return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
|
|
12400
|
+
operands?.add(filter.column);
|
|
12093
12401
|
const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
|
|
12094
12402
|
const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
|
|
12095
12403
|
if (column.kind === "number")
|
|
@@ -12150,28 +12458,23 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
|
|
|
12150
12458
|
return formula;
|
|
12151
12459
|
}
|
|
12152
12460
|
const _exports = Object.freeze({ canopyPredicate: canopyPredicate });
|
|
12153
|
-
_modules.set("
|
|
12461
|
+
_modules.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c", _exports);
|
|
12154
12462
|
return _exports;
|
|
12155
12463
|
})();
|
|
12156
12464
|
|
|
12157
|
-
const
|
|
12465
|
+
const _m101 = _modules.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8") ?? (() => {
|
|
12158
12466
|
const { captureFields } = _m10;
|
|
12159
12467
|
|
|
12160
|
-
const { canopyPredicate } =
|
|
12468
|
+
const { canopyPredicate } = _m102;
|
|
12469
|
+
|
|
12470
|
+
const { canopyDefaultTones, canopyTonePalette: palette } = _m100;
|
|
12161
12471
|
|
|
12162
|
-
// Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
|
|
12163
|
-
const palette = {
|
|
12164
|
-
info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
|
|
12165
|
-
success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
|
|
12166
|
-
warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
|
|
12167
|
-
danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
|
|
12168
|
-
};
|
|
12169
12472
|
class UnsupportedRule extends Error {
|
|
12170
12473
|
}
|
|
12171
12474
|
const unsupported = (message) => { throw new UnsupportedRule(message); };
|
|
12172
12475
|
/** Compile declarations in source order, then emit native target/aspect priorities.
|
|
12173
12476
|
* Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
|
|
12174
|
-
function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
|
|
12477
|
+
function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes, operands) {
|
|
12175
12478
|
if (request.formatRules === undefined || format === "csv")
|
|
12176
12479
|
return [];
|
|
12177
12480
|
if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
|
|
@@ -12210,7 +12513,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
12210
12513
|
}
|
|
12211
12514
|
const priorStops = [];
|
|
12212
12515
|
const priorRows = [], priorCells = new Map();
|
|
12213
|
-
const requiredCells = new Map();
|
|
12516
|
+
const requiredCells = new Map(), emittedOperands = new Set();
|
|
12214
12517
|
const column = (id) => {
|
|
12215
12518
|
const index = columns.findIndex(column => column.id === id);
|
|
12216
12519
|
if (index < 0)
|
|
@@ -12228,8 +12531,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
12228
12531
|
return value;
|
|
12229
12532
|
};
|
|
12230
12533
|
const style = (name) => {
|
|
12231
|
-
const
|
|
12232
|
-
const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
|
|
12534
|
+
const mapping = tones.get(name) ?? canopyDefaultTones.get(name);
|
|
12233
12535
|
if (!mapping)
|
|
12234
12536
|
return unsupported("UNMAPPED_RULE_TONE:" + name);
|
|
12235
12537
|
if ("alignment" in mapping || "wrapText" in mapping)
|
|
@@ -12302,8 +12604,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
12302
12604
|
const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
|
|
12303
12605
|
if (rule.column !== undefined)
|
|
12304
12606
|
column(rule.column);
|
|
12305
|
-
const ruleCells = new Map();
|
|
12306
|
-
const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
|
|
12607
|
+
const ruleCells = new Map(), ruleOperands = new Set();
|
|
12608
|
+
const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells, ruleOperands);
|
|
12307
12609
|
const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
|
|
12308
12610
|
const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
|
|
12309
12611
|
const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
|
|
@@ -12315,6 +12617,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
12315
12617
|
priorCells.set(rule.column, previous);
|
|
12316
12618
|
for (const [column, type] of ruleCells)
|
|
12317
12619
|
requiredCells.set(column, type);
|
|
12620
|
+
for (const id of ruleOperands)
|
|
12621
|
+
emittedOperands.add(id);
|
|
12318
12622
|
// A matched declaration still stops the row when an earlier tone on that target already won.
|
|
12319
12623
|
if (rule.stopIfTrue)
|
|
12320
12624
|
priorStops.push(ownPredicate);
|
|
@@ -12330,15 +12634,18 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
12330
12634
|
}
|
|
12331
12635
|
for (const [column, type] of requiredCells)
|
|
12332
12636
|
cellTypes?.set(column, type);
|
|
12637
|
+
// Only emitted rules read raw cells; a rejected comparison leaves its column free to carry badge labels.
|
|
12638
|
+
for (const id of emittedOperands)
|
|
12639
|
+
operands?.add(id);
|
|
12333
12640
|
// Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
|
|
12334
12641
|
return Object.freeze([...visuals, ...cells, ...rows]);
|
|
12335
12642
|
}
|
|
12336
12643
|
const _exports = Object.freeze({ canopyRules: canopyRules });
|
|
12337
|
-
_modules.set("
|
|
12644
|
+
_modules.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8", _exports);
|
|
12338
12645
|
return _exports;
|
|
12339
12646
|
})();
|
|
12340
12647
|
|
|
12341
|
-
const
|
|
12648
|
+
const _m103 = _modules.get("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a") ?? (() => {
|
|
12342
12649
|
const { createGroupedReport } = _m8;
|
|
12343
12650
|
|
|
12344
12651
|
const { checkAbort } = _m4;
|
|
@@ -12544,11 +12851,11 @@ function canopyGrouped(source, request, options, limits, report, format) {
|
|
|
12544
12851
|
...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
|
|
12545
12852
|
}
|
|
12546
12853
|
const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
|
|
12547
|
-
_modules.set("
|
|
12854
|
+
_modules.set("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a", _exports);
|
|
12548
12855
|
return _exports;
|
|
12549
12856
|
})();
|
|
12550
12857
|
|
|
12551
|
-
const
|
|
12858
|
+
const _m104 = _modules.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8") ?? (() => {
|
|
12552
12859
|
const { cellText } = _m35;
|
|
12553
12860
|
|
|
12554
12861
|
const { cleanXml } = _m28;
|
|
@@ -12607,7 +12914,7 @@ _modules.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",
|
|
|
12607
12914
|
return _exports;
|
|
12608
12915
|
})();
|
|
12609
12916
|
|
|
12610
|
-
const
|
|
12917
|
+
const _m105 = _modules.get("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8") ?? (() => {
|
|
12611
12918
|
const { Workbook, addGroupedXlsx } = _m23;
|
|
12612
12919
|
|
|
12613
12920
|
const { portableWorkbook } = _m53;
|
|
@@ -12664,13 +12971,15 @@ async function writeCanopyWorkbook(source, grouped, destination, options, labels
|
|
|
12664
12971
|
});
|
|
12665
12972
|
}
|
|
12666
12973
|
const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
|
|
12667
|
-
_modules.set("
|
|
12974
|
+
_modules.set("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8", _exports);
|
|
12668
12975
|
return _exports;
|
|
12669
12976
|
})();
|
|
12670
12977
|
|
|
12671
|
-
const
|
|
12978
|
+
const _m107 = _modules.get("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d") ?? (() => {
|
|
12672
12979
|
const { ExportCell } = _m1;
|
|
12673
12980
|
|
|
12981
|
+
const { canopyBadgeSplit } = _m96;
|
|
12982
|
+
|
|
12674
12983
|
/** Fixed numeric formats affect PDF text, not the frozen numeric value used by other writers. */
|
|
12675
12984
|
function numericProfile(format) {
|
|
12676
12985
|
// No declared precision: whole values (including counts) stay whole.
|
|
@@ -12718,11 +13027,11 @@ function documentDecimal(sample, columns) {
|
|
|
12718
13027
|
const profile = numericProfile(cell.presentation?.numberFormat ?? column.format);
|
|
12719
13028
|
if (!profile)
|
|
12720
13029
|
continue;
|
|
12721
|
-
const
|
|
13030
|
+
const label = canopyBadgeSplit(cell).text, captured = capturedNumber(label, profile);
|
|
12722
13031
|
if (!captured)
|
|
12723
13032
|
continue;
|
|
12724
13033
|
// A literal percent label is a culture signal without requesting numeric scaling.
|
|
12725
|
-
const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") ||
|
|
13034
|
+
const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || label.includes("%");
|
|
12726
13035
|
if (percentageSignal !== percent)
|
|
12727
13036
|
continue;
|
|
12728
13037
|
const match = /([.,])(\d+)$/.exec(captured.number.trimEnd());
|
|
@@ -12749,10 +13058,12 @@ function canopyPdfNumbers(sample, columns) {
|
|
|
12749
13058
|
return value;
|
|
12750
13059
|
const format = value.presentation?.numberFormat ?? columns[index].format;
|
|
12751
13060
|
let profile = numericProfile(format);
|
|
12752
|
-
|
|
13061
|
+
// Badge labels are not part of the number: format the captured label alone, then append them unchanged.
|
|
13062
|
+
const { text: label, suffix: badges } = canopyBadgeSplit(value);
|
|
13063
|
+
if (!profile || label === "")
|
|
12753
13064
|
return value;
|
|
12754
|
-
const captured = capturedNumber(
|
|
12755
|
-
if (
|
|
13065
|
+
const captured = capturedNumber(label, profile);
|
|
13066
|
+
if (label && !captured)
|
|
12756
13067
|
return value;
|
|
12757
13068
|
// Undeclared formats normalize only plain numeric labels; a decoration
|
|
12758
13069
|
// alone does not declare how the raw value was transformed for display.
|
|
@@ -12784,16 +13095,16 @@ function canopyPdfNumbers(sample, columns) {
|
|
|
12784
13095
|
let suffix = captured?.suffix || profile.suffix;
|
|
12785
13096
|
if (profile.percent && !profile.suffix)
|
|
12786
13097
|
suffix = suffix.replace(/%/g, "");
|
|
12787
|
-
return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix,
|
|
13098
|
+
return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix + badges,
|
|
12788
13099
|
...(value.presentation ? { presentation: value.presentation } : {}), ...(value.link ? { link: value.link } : {}) });
|
|
12789
13100
|
});
|
|
12790
13101
|
}
|
|
12791
13102
|
const _exports = Object.freeze({ canopyPdfNumbers: canopyPdfNumbers });
|
|
12792
|
-
_modules.set("
|
|
13103
|
+
_modules.set("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d", _exports);
|
|
12793
13104
|
return _exports;
|
|
12794
13105
|
})();
|
|
12795
13106
|
|
|
12796
|
-
const
|
|
13107
|
+
const _m106 = _modules.get("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49") ?? (() => {
|
|
12797
13108
|
const { ExportCell, NotSupportedError, OfficeIMOError } = _m1;
|
|
12798
13109
|
|
|
12799
13110
|
const { inputRows, checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -12804,7 +13115,7 @@ const { resolveScalar, selectFont, validateFonts } = _m68;
|
|
|
12804
13115
|
|
|
12805
13116
|
const { settings } = _m17;
|
|
12806
13117
|
|
|
12807
|
-
const { canopyPdfNumbers } =
|
|
13118
|
+
const { canopyPdfNumbers } = _m107;
|
|
12808
13119
|
|
|
12809
13120
|
/** A bounded lookahead is replayed once; no second capture, full-dataset copy or smaller font is needed. */
|
|
12810
13121
|
async function withCanopyPdfLayout(source, captured, options, write) {
|
|
@@ -12898,14 +13209,14 @@ async function withCanopyPdfLayout(source, captured, options, write) {
|
|
|
12898
13209
|
}
|
|
12899
13210
|
}
|
|
12900
13211
|
const _exports = Object.freeze({ withCanopyPdfLayout: withCanopyPdfLayout });
|
|
12901
|
-
_modules.set("
|
|
13212
|
+
_modules.set("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49", _exports);
|
|
12902
13213
|
return _exports;
|
|
12903
13214
|
})();
|
|
12904
13215
|
|
|
12905
|
-
const _m0 = _modules.get("
|
|
13216
|
+
const _m0 = _modules.get("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54") ?? (() => {
|
|
12906
13217
|
const { BlobByteSink, ExportCell } = _m1;
|
|
12907
13218
|
|
|
12908
|
-
const { notifyProgress } = _m14;
|
|
13219
|
+
const { notifyProgress, notifySynchronously } = _m14;
|
|
12909
13220
|
|
|
12910
13221
|
const { captureFields } = _m10;
|
|
12911
13222
|
|
|
@@ -12923,15 +13234,15 @@ const { prepareCanopyExport } = _m96;
|
|
|
12923
13234
|
|
|
12924
13235
|
const { canopyPins } = _m99;
|
|
12925
13236
|
|
|
12926
|
-
const { canopyRules } =
|
|
13237
|
+
const { canopyRules } = _m101;
|
|
12927
13238
|
|
|
12928
|
-
const { canopyGrouped } =
|
|
13239
|
+
const { canopyGrouped } = _m103;
|
|
12929
13240
|
|
|
12930
|
-
const { canopyAbout } =
|
|
13241
|
+
const { canopyAbout } = _m104;
|
|
12931
13242
|
|
|
12932
|
-
const { writeCanopyWorkbook } =
|
|
13243
|
+
const { writeCanopyWorkbook } = _m105;
|
|
12933
13244
|
|
|
12934
|
-
const { withCanopyPdfLayout } =
|
|
13245
|
+
const { withCanopyPdfLayout } = _m106;
|
|
12935
13246
|
|
|
12936
13247
|
|
|
12937
13248
|
|
|
@@ -12939,6 +13250,7 @@ const { withCanopyPdfLayout } = _m105;
|
|
|
12939
13250
|
|
|
12940
13251
|
|
|
12941
13252
|
|
|
13253
|
+
const canopyHeaderFill = "E7EDF5", canopyHeaderBorder = Object.freeze({ bottom: Object.freeze({ style: "thin", color: "A6B4C8" }) });
|
|
12942
13254
|
/** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
|
|
12943
13255
|
async function writeCanopyTo(capture, format, destination, options = {}) {
|
|
12944
13256
|
const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
|
|
@@ -12978,17 +13290,25 @@ async function writeCanopyTo(capture, format, destination, options = {}) {
|
|
|
12978
13290
|
const stream = { ...(signal ? { signal } : {}), ...progress };
|
|
12979
13291
|
if (format === "xlsx") {
|
|
12980
13292
|
const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = pivot ? undefined : canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
|
|
12981
|
-
const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
|
|
13293
|
+
const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes, prepared.ruleOperands);
|
|
12982
13294
|
if (pivot && (xlsx.sheet?.rowOutline !== undefined || xlsx.sheet?.columnOutlines !== undefined || xlsx.sheet?.maxOutlineLevel !== undefined ||
|
|
12983
13295
|
xlsx.sheet?.outlineSummaryBelow !== undefined || xlsx.sheet?.outlineSummaryRight !== undefined || xlsx.sheet?.table !== undefined || xlsx.sheet?.footer !== undefined))
|
|
12984
13296
|
throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");
|
|
12985
13297
|
if (pivot && xlsx.cellValueWriters !== undefined)
|
|
12986
13298
|
throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");
|
|
12987
|
-
|
|
13299
|
+
// The header matches the PDF table heading: shaded, bold, wrapped and ruled off from the data.
|
|
13300
|
+
const sheet = { headerFill: canopyHeaderFill, headerBorder: canopyHeaderBorder, headerWrap: true, ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
|
|
12988
13301
|
freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
|
|
12989
13302
|
freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
|
|
12990
13303
|
conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
|
|
12991
|
-
|
|
13304
|
+
// Data-cell links past Excel's per-worksheet limit keep their label; the worksheet reserves every link it cannot drop.
|
|
13305
|
+
const linkFallback = canopyDiagnostics(format, { ...selected, unsupportedPresentation: "text" }), onHyperlinkOverflow = xlsx.onHyperlinkOverflow;
|
|
13306
|
+
const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits,
|
|
13307
|
+
hyperlinkOverflow: xlsx.hyperlinkOverflow ?? "drop",
|
|
13308
|
+
onHyperlinkOverflow: (overflow) => {
|
|
13309
|
+
notifySynchronously("onHyperlinkOverflow", onHyperlinkOverflow, overflow);
|
|
13310
|
+
linkFallback({ code: "LINKS_TRUNCATED:" + overflow.dropped });
|
|
13311
|
+
} };
|
|
12992
13312
|
if (grouped || about)
|
|
12993
13313
|
return writeCanopyWorkbook(source, grouped, destination, settings, capturedLabels, about);
|
|
12994
13314
|
return writeXlsxTo(source.rows(), destination, settings);
|
|
@@ -13041,7 +13361,7 @@ async function exportCanopy(capture, format, options = {}) {
|
|
|
13041
13361
|
}
|
|
13042
13362
|
}
|
|
13043
13363
|
const _exports = Object.freeze({ createCanopyExport: _m96.createCanopyExport, ExportCell: _m5.ExportCell, PdfFont: _m64.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
|
|
13044
|
-
_modules.set("
|
|
13364
|
+
_modules.set("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54", _exports);
|
|
13045
13365
|
return _exports;
|
|
13046
13366
|
})();
|
|
13047
13367
|
Object.assign(officeimo, _m0);
|