@evotecit/officeimo 0.1.0 → 0.1.1
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 +13 -10
- package/bundles/officeimo-canopyx.js +813 -358
- package/bundles/officeimo-canopyx.mjs +700 -246
- package/bundles/officeimo-csv.js +29 -19
- package/bundles/officeimo-csv.mjs +17 -7
- package/bundles/officeimo-datatables.js +806 -360
- package/bundles/officeimo-datatables.mjs +694 -249
- package/bundles/officeimo-execution.js +35 -25
- package/bundles/officeimo-execution.mjs +17 -7
- package/bundles/officeimo-pdf.js +734 -289
- package/bundles/officeimo-pdf.mjs +685 -241
- package/bundles/officeimo-xlsx.js +88 -77
- package/bundles/officeimo-xlsx.mjs +22 -11
- package/bundles/officeimo.js +790 -344
- package/bundles/officeimo.mjs +680 -235
- package/dist/core/index.d.ts +2 -0
- package/dist/core/iteration.js +2 -2
- package/dist/core/sinks.js +2 -1
- package/dist/integrations/canopyx/source.js +13 -7
- package/dist/integrations/datatables/snapshot.js +3 -3
- package/dist/internal/rows.js +13 -4
- package/dist/pdf/document-grouped.js +72 -22
- package/dist/pdf/font-resources.js +2 -1
- package/dist/pdf/inline-text.js +50 -9
- package/dist/pdf/objects.js +188 -11
- package/dist/pdf/pages.js +25 -26
- package/dist/pdf/paragraph-layout.d.ts +2 -0
- package/dist/pdf/paragraph-layout.js +9 -4
- package/dist/pdf/session.js +1 -1
- package/dist/pdf/settings.d.ts +2 -0
- package/dist/pdf/settings.js +27 -2
- package/dist/pdf/structure.js +80 -28
- package/dist/pdf/table-band-flow.js +26 -11
- package/dist/pdf/table-band-plan.js +1 -3
- package/dist/pdf/table-layout.d.ts +4 -0
- package/dist/pdf/table-layout.js +22 -10
- package/dist/pdf/table-structure.js +28 -12
- package/dist/pdf/text.js +5 -0
- package/dist/pdf/types.d.ts +4 -2
- package/dist/pdf/xref.d.ts +1 -0
- package/dist/pdf/xref.js +30 -0
- package/dist/xlsx/values.js +3 -2
- package/dist/zip/entry.js +1 -1
- package/dist/zip/index.js +1 -1
- package/package.json +1 -1
package/bundles/officeimo.js
CHANGED
|
@@ -42,10 +42,10 @@ _modules.set("d5c945064d81fdd257960f48c421125e106e5f270427d170bb05587dd96a44ea",
|
|
|
42
42
|
return _exports;
|
|
43
43
|
})();
|
|
44
44
|
|
|
45
|
-
const _m4 = _modules.get("
|
|
45
|
+
const _m4 = _modules.get("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3") ?? (() => {
|
|
46
46
|
function checkAbort(signal) {
|
|
47
47
|
if (signal?.aborted)
|
|
48
|
-
throw signal.reason
|
|
48
|
+
throw signal.reason;
|
|
49
49
|
}
|
|
50
50
|
/** Race a pending producer or sink operation without leaving abort listeners behind. */
|
|
51
51
|
function withAbort(promise, signal) {
|
|
@@ -53,7 +53,7 @@ function withAbort(promise, signal) {
|
|
|
53
53
|
return Promise.resolve(promise);
|
|
54
54
|
return new Promise((resolve, reject) => {
|
|
55
55
|
const cleanup = () => signal.removeEventListener("abort", abort);
|
|
56
|
-
const abort = () => { cleanup(); reject(signal.reason
|
|
56
|
+
const abort = () => { cleanup(); reject(signal.reason); };
|
|
57
57
|
signal.addEventListener("abort", abort, { once: true });
|
|
58
58
|
Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); });
|
|
59
59
|
if (signal.aborted)
|
|
@@ -193,11 +193,11 @@ function pause() {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
const _exports = Object.freeze({ checkAbort: checkAbort, withAbort: withAbort, inputRows: inputRows, rowsFromBatches: rowsFromBatches, concatRows: concatRows, consumeRows: consumeRows, beginTask: beginTask, taskYieldDue: taskYieldDue, pause: pause });
|
|
196
|
-
_modules.set("
|
|
196
|
+
_modules.set("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3", _exports);
|
|
197
197
|
return _exports;
|
|
198
198
|
})();
|
|
199
199
|
|
|
200
|
-
const _m3 = _modules.get("
|
|
200
|
+
const _m3 = _modules.get("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b") ?? (() => {
|
|
201
201
|
const { checkAbort, consumeRows, withAbort, pause, taskYieldDue } = _m4;
|
|
202
202
|
|
|
203
203
|
const { OfficeIMOError } = _m2;
|
|
@@ -207,8 +207,9 @@ async function withDestination(destination, operation) {
|
|
|
207
207
|
// Native streams can belong to another browser realm; constructor identity is not portable.
|
|
208
208
|
if (destination && typeof destination.getWriter === "function") {
|
|
209
209
|
const writer = destination.getWriter();
|
|
210
|
+
// Native streams may retain accepted chunks after write resolves.
|
|
210
211
|
try {
|
|
211
|
-
return await operation({ write: bytes => writer.write(bytes) });
|
|
212
|
+
return await operation({ write: bytes => writer.write(new Uint8Array(bytes)) });
|
|
212
213
|
}
|
|
213
214
|
finally {
|
|
214
215
|
writer.releaseLock();
|
|
@@ -302,7 +303,7 @@ async function writeBytes(source, sink, signal) {
|
|
|
302
303
|
});
|
|
303
304
|
}
|
|
304
305
|
const _exports = Object.freeze({ withDestination: withDestination, BlobByteSink: BlobByteSink, ChunkedTextSink: ChunkedTextSink, writeBytes: writeBytes });
|
|
305
|
-
_modules.set("
|
|
306
|
+
_modules.set("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b", _exports);
|
|
306
307
|
return _exports;
|
|
307
308
|
})();
|
|
308
309
|
|
|
@@ -499,7 +500,7 @@ _modules.set("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671",
|
|
|
499
500
|
return _exports;
|
|
500
501
|
})();
|
|
501
502
|
|
|
502
|
-
const _m11 = _modules.get("
|
|
503
|
+
const _m11 = _modules.get("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc") ?? (() => {
|
|
503
504
|
const { assertExportValue } = _m5;
|
|
504
505
|
|
|
505
506
|
const { checkAbort } = _m4;
|
|
@@ -512,11 +513,18 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
512
513
|
const getters = columns.some(column => column.value);
|
|
513
514
|
return (row, rowIndex = 0) => {
|
|
514
515
|
if (Array.isArray(row) && !getters) {
|
|
515
|
-
|
|
516
|
+
const length = row.length;
|
|
517
|
+
if (length > columns.length)
|
|
516
518
|
throw new RangeError("Row has more values than declared columns.");
|
|
517
|
-
|
|
519
|
+
// Resolve each positional value once, just like key/value projections. Returning the
|
|
520
|
+
// source array would let an accessor change a value after the portable-value check.
|
|
521
|
+
const values = new Array(length);
|
|
522
|
+
for (let index = 0; index < length; index++) {
|
|
523
|
+
const value = row[index];
|
|
518
524
|
validate(value);
|
|
519
|
-
|
|
525
|
+
values[index] = value;
|
|
526
|
+
}
|
|
527
|
+
return values;
|
|
520
528
|
}
|
|
521
529
|
if (!row || typeof row !== "object" || isDate(row))
|
|
522
530
|
throw new TypeError("A row must be an array or object.");
|
|
@@ -545,7 +553,7 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
545
553
|
};
|
|
546
554
|
}
|
|
547
555
|
/** @internal Shared metadata fields for full columns and adapter-owned partial overrides. */
|
|
548
|
-
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "groups", "style", "valueFormatter"];
|
|
556
|
+
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "rowHeader", "groups", "style", "valueFormatter"];
|
|
549
557
|
function copyColumns(columns, workbookStyles = false) {
|
|
550
558
|
if (!Array.isArray(columns))
|
|
551
559
|
throw new TypeError("Declare the columns in export order.");
|
|
@@ -561,6 +569,8 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
561
569
|
throw new TypeError("Each column needs a string header and an optional string key.");
|
|
562
570
|
if (captured.value !== undefined && typeof captured.value !== "function")
|
|
563
571
|
throw new TypeError("Column value getters must be functions.");
|
|
572
|
+
if (captured.rowHeader !== undefined && typeof captured.rowHeader !== "boolean")
|
|
573
|
+
throw new TypeError("Column rowHeader must be boolean.");
|
|
564
574
|
if (captured.groups !== undefined) {
|
|
565
575
|
if (!Array.isArray(captured.groups))
|
|
566
576
|
throw new TypeError("Column groups must be an array of strings.");
|
|
@@ -573,7 +583,7 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
573
583
|
});
|
|
574
584
|
}
|
|
575
585
|
const _exports = Object.freeze({ createRowProjector: createRowProjector, columnOptionFields: columnOptionFields, copyColumns: copyColumns });
|
|
576
|
-
_modules.set("
|
|
586
|
+
_modules.set("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc", _exports);
|
|
577
587
|
return _exports;
|
|
578
588
|
})();
|
|
579
589
|
|
|
@@ -647,7 +657,7 @@ _modules.set("e95bb0e3f342d1379b67a3d541fa808e06361da8460169a6aec152ee7deb69b2",
|
|
|
647
657
|
return _exports;
|
|
648
658
|
})();
|
|
649
659
|
|
|
650
|
-
const _m8 = _modules.get("
|
|
660
|
+
const _m8 = _modules.get("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0") ?? (() => {
|
|
651
661
|
const { ExportCell, assertScalar } = _m5;
|
|
652
662
|
|
|
653
663
|
const { isDate } = _m6;
|
|
@@ -909,11 +919,11 @@ function createGroupedReport(rows, options) {
|
|
|
909
919
|
return source;
|
|
910
920
|
}
|
|
911
921
|
const _exports = Object.freeze({ assertGroupedReportSource: assertGroupedReportSource, groupedReportEvents: groupedReportEvents, groupedReportOperation: groupedReportOperation, createGroupedReport: createGroupedReport });
|
|
912
|
-
_modules.set("
|
|
922
|
+
_modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0", _exports);
|
|
913
923
|
return _exports;
|
|
914
924
|
})();
|
|
915
925
|
|
|
916
|
-
const _m1 = _modules.get("
|
|
926
|
+
const _m1 = _modules.get("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00") ?? (() => {
|
|
917
927
|
|
|
918
928
|
|
|
919
929
|
|
|
@@ -958,7 +968,7 @@ function saveBlob(blob, fileName) {
|
|
|
958
968
|
}
|
|
959
969
|
}
|
|
960
970
|
const _exports = Object.freeze({ OfficeIMOError: _m2.OfficeIMOError, NotSupportedError: _m2.NotSupportedError, BlobByteSink: _m3.BlobByteSink, ChunkedTextSink: _m3.ChunkedTextSink, writeBytes: _m3.writeBytes, ExportCell: _m5.ExportCell, createGroupedReport: _m8.createGroupedReport, checkAbort: _m4.checkAbort, withAbort: _m4.withAbort, inputRows: _m4.inputRows, pause: _m4.pause, detectFeatures: detectFeatures, saveBlob: saveBlob });
|
|
961
|
-
_modules.set("
|
|
971
|
+
_modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00", _exports);
|
|
962
972
|
return _exports;
|
|
963
973
|
})();
|
|
964
974
|
|
|
@@ -985,7 +995,7 @@ _modules.set("790c15edc51b308be3e7d8222630d407f8c79c31ab21ba0b9f92c00f44ab4021",
|
|
|
985
995
|
return _exports;
|
|
986
996
|
})();
|
|
987
997
|
|
|
988
|
-
const _m15 = _modules.get("
|
|
998
|
+
const _m15 = _modules.get("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd") ?? (() => {
|
|
989
999
|
const { checkAbort, withAbort } = _m4;
|
|
990
1000
|
|
|
991
1001
|
const { OfficeIMOError } = _m2;
|
|
@@ -1016,7 +1026,7 @@ class EntryWriter {
|
|
|
1016
1026
|
closed = false;
|
|
1017
1027
|
cleaned = false;
|
|
1018
1028
|
lifetime = new AbortController();
|
|
1019
|
-
abort = () => { this.fail(this.signal?.reason
|
|
1029
|
+
abort = () => { this.fail(this.signal?.reason); };
|
|
1020
1030
|
constructor(compression, sink, signal) {
|
|
1021
1031
|
this.sink = sink;
|
|
1022
1032
|
this.signal = signal;
|
|
@@ -1113,11 +1123,11 @@ class EntryWriter {
|
|
|
1113
1123
|
}
|
|
1114
1124
|
}
|
|
1115
1125
|
const _exports = Object.freeze({ Crc32: _m16.Crc32, zipLimit: zipLimit, zipSize: zipSize, EntryWriter: EntryWriter });
|
|
1116
|
-
_modules.set("
|
|
1126
|
+
_modules.set("597d152d20a2a28ee5cd6d4243a79a71ce8b83769a77441bfc944aadc0a6efbd", _exports);
|
|
1117
1127
|
return _exports;
|
|
1118
1128
|
})();
|
|
1119
1129
|
|
|
1120
|
-
const _m14 = _modules.get("
|
|
1130
|
+
const _m14 = _modules.get("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb") ?? (() => {
|
|
1121
1131
|
|
|
1122
1132
|
|
|
1123
1133
|
const { EntryWriter, zipSize } = _m15;
|
|
@@ -1181,7 +1191,7 @@ class ZipWriter {
|
|
|
1181
1191
|
/** Pending header/directory writes and source reads must also stop on explicit discard. */
|
|
1182
1192
|
async acceptance(operation) {
|
|
1183
1193
|
const signal = this.options.signal;
|
|
1184
|
-
const abort = () => this.lifetime.abort(signal?.reason
|
|
1194
|
+
const abort = () => this.lifetime.abort(signal?.reason);
|
|
1185
1195
|
signal?.addEventListener("abort", abort, { once: true });
|
|
1186
1196
|
try {
|
|
1187
1197
|
checkAbort(signal);
|
|
@@ -1373,11 +1383,11 @@ class ZipWriter {
|
|
|
1373
1383
|
}
|
|
1374
1384
|
}
|
|
1375
1385
|
const _exports = Object.freeze({ Crc32: _m15.Crc32, validateEntryName: validateEntryName, ZipWriter: ZipWriter });
|
|
1376
|
-
_modules.set("
|
|
1386
|
+
_modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb", _exports);
|
|
1377
1387
|
return _exports;
|
|
1378
1388
|
})();
|
|
1379
1389
|
|
|
1380
|
-
const _m17 = _modules.get("
|
|
1390
|
+
const _m17 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
|
|
1381
1391
|
const { OfficeIMOError } = _m2;
|
|
1382
1392
|
|
|
1383
1393
|
const { ChunkedTextSink } = _m3;
|
|
@@ -1455,7 +1465,7 @@ class XmlWriter {
|
|
|
1455
1465
|
throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
|
|
1456
1466
|
}
|
|
1457
1467
|
const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
|
|
1458
|
-
_modules.set("
|
|
1468
|
+
_modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
|
|
1459
1469
|
return _exports;
|
|
1460
1470
|
})();
|
|
1461
1471
|
|
|
@@ -1507,7 +1517,7 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
|
|
|
1507
1517
|
return _exports;
|
|
1508
1518
|
})();
|
|
1509
1519
|
|
|
1510
|
-
const _m20 = _modules.get("
|
|
1520
|
+
const _m20 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
|
|
1511
1521
|
const { escapeXml, xmlDeclaration } = _m17;
|
|
1512
1522
|
|
|
1513
1523
|
const { isDate } = _m6;
|
|
@@ -1529,11 +1539,11 @@ function appPropertiesXml(properties = {}, policy = "strip") {
|
|
|
1529
1539
|
'<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
|
|
1530
1540
|
}
|
|
1531
1541
|
const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
|
|
1532
|
-
_modules.set("
|
|
1542
|
+
_modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
|
|
1533
1543
|
return _exports;
|
|
1534
1544
|
})();
|
|
1535
1545
|
|
|
1536
|
-
const _m18 = _modules.get("
|
|
1546
|
+
const _m18 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
|
|
1537
1547
|
|
|
1538
1548
|
|
|
1539
1549
|
|
|
@@ -1778,7 +1788,7 @@ class OpcPackage {
|
|
|
1778
1788
|
}
|
|
1779
1789
|
}
|
|
1780
1790
|
const _exports = Object.freeze({ partUri: _m19.partUri, relationshipPartUri: _m19.relationshipPartUri, relativePartTarget: _m19.relativePartTarget, corePropertiesXml: _m20.corePropertiesXml, appPropertiesXml: _m20.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
|
|
1781
|
-
_modules.set("
|
|
1791
|
+
_modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
|
|
1782
1792
|
return _exports;
|
|
1783
1793
|
})();
|
|
1784
1794
|
|
|
@@ -1810,7 +1820,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
|
|
|
1810
1820
|
return _exports;
|
|
1811
1821
|
})();
|
|
1812
1822
|
|
|
1813
|
-
const _m26 = _modules.get("
|
|
1823
|
+
const _m26 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
|
|
1814
1824
|
const { OfficeIMOError } = _m2;
|
|
1815
1825
|
|
|
1816
1826
|
const { cleanXml, escapeOoxmlAttribute } = _m17;
|
|
@@ -1917,11 +1927,11 @@ function differentialXml(style, policy, numberFormat) {
|
|
|
1917
1927
|
return xml;
|
|
1918
1928
|
}
|
|
1919
1929
|
const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
|
|
1920
|
-
_modules.set("
|
|
1930
|
+
_modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
|
|
1921
1931
|
return _exports;
|
|
1922
1932
|
})();
|
|
1923
1933
|
|
|
1924
|
-
const _m24 = _modules.get("
|
|
1934
|
+
const _m24 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
|
|
1925
1935
|
const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m17;
|
|
1926
1936
|
|
|
1927
1937
|
const { OfficeIMOError } = _m2;
|
|
@@ -2131,11 +2141,11 @@ class StyleRegistry {
|
|
|
2131
2141
|
}
|
|
2132
2142
|
}
|
|
2133
2143
|
const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
|
|
2134
|
-
_modules.set("
|
|
2144
|
+
_modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
|
|
2135
2145
|
return _exports;
|
|
2136
2146
|
})();
|
|
2137
2147
|
|
|
2138
|
-
const _m28 = _modules.get("
|
|
2148
|
+
const _m28 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
|
|
2139
2149
|
const { NotSupportedError } = _m2;
|
|
2140
2150
|
|
|
2141
2151
|
const { cleanXml, escapeXml } = _m17;
|
|
@@ -2243,11 +2253,11 @@ function formulaXml(cell) {
|
|
|
2243
2253
|
return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
|
|
2244
2254
|
}
|
|
2245
2255
|
const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
|
|
2246
|
-
_modules.set("
|
|
2256
|
+
_modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
|
|
2247
2257
|
return _exports;
|
|
2248
2258
|
})();
|
|
2249
2259
|
|
|
2250
|
-
const _m27 = _modules.get("
|
|
2260
|
+
const _m27 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
|
|
2251
2261
|
const { cleanXml, escapeXml } = _m17;
|
|
2252
2262
|
|
|
2253
2263
|
const { assertExportValue, assertScalar } = _m5;
|
|
@@ -2311,12 +2321,13 @@ function sheetName(requested, names, policy, register = true) {
|
|
|
2311
2321
|
throw new TypeError("Sheet name must be a string.");
|
|
2312
2322
|
// Validate and deduplicate the decoded literal value, before ST_Xstring attribute encoding.
|
|
2313
2323
|
// A requested _xHHHH_ token is literal text; the serializer protects its leading underscore.
|
|
2314
|
-
let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").
|
|
2324
|
+
let base = cleanXml(requested, policy).replace(/[\[\]:*?/\\]/g, "_").replace(/^[\s']+|[\s']+$/g, "");
|
|
2325
|
+
// Clipping can expose an internal apostrophe or the reserved History name.
|
|
2326
|
+
base = clipName(base, 31).replace(/[\s']+$/g, "");
|
|
2315
2327
|
if (!base)
|
|
2316
2328
|
base = "Sheet";
|
|
2317
2329
|
if (base.toLowerCase() === "history")
|
|
2318
2330
|
base += "_";
|
|
2319
|
-
base = clipName(base, 31);
|
|
2320
2331
|
let name = base, suffix = 2;
|
|
2321
2332
|
while (names.has(name.toLowerCase())) {
|
|
2322
2333
|
const tail = " (" + suffix++ + ")";
|
|
@@ -2339,7 +2350,7 @@ function excelDate(date, mode) {
|
|
|
2339
2350
|
return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
|
|
2340
2351
|
}
|
|
2341
2352
|
const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
|
|
2342
|
-
_modules.set("
|
|
2353
|
+
_modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
|
|
2343
2354
|
return _exports;
|
|
2344
2355
|
})();
|
|
2345
2356
|
|
|
@@ -2409,7 +2420,7 @@ _modules.set("d56b24243cff6f3552a2f7b45521af4491494375ec76117e9ac1ebb047ce02da",
|
|
|
2409
2420
|
return _exports;
|
|
2410
2421
|
})();
|
|
2411
2422
|
|
|
2412
|
-
const _m32 = _modules.get("
|
|
2423
|
+
const _m32 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
|
|
2413
2424
|
const { ChunkedTextSink } = _m3;
|
|
2414
2425
|
|
|
2415
2426
|
const { escapeXml, xmlDeclaration } = _m17;
|
|
@@ -2518,11 +2529,11 @@ async function writeChartXml(chart, destination, policy, signal) {
|
|
|
2518
2529
|
await text.close();
|
|
2519
2530
|
}
|
|
2520
2531
|
const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
|
|
2521
|
-
_modules.set("
|
|
2532
|
+
_modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
|
|
2522
2533
|
return _exports;
|
|
2523
2534
|
})();
|
|
2524
2535
|
|
|
2525
|
-
const _m31 = _modules.get("
|
|
2536
|
+
const _m31 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
|
|
2526
2537
|
const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m17;
|
|
2527
2538
|
|
|
2528
2539
|
const { copyExportLink } = _m7;
|
|
@@ -2596,11 +2607,11 @@ function drawingXml(images, policy, charts = []) {
|
|
|
2596
2607
|
}
|
|
2597
2608
|
const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
|
|
2598
2609
|
const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
|
|
2599
|
-
_modules.set("
|
|
2610
|
+
_modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
|
|
2600
2611
|
return _exports;
|
|
2601
2612
|
})();
|
|
2602
2613
|
|
|
2603
|
-
const _m34 = _modules.get("
|
|
2614
|
+
const _m34 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
|
|
2604
2615
|
const { OfficeIMOError } = _m2;
|
|
2605
2616
|
|
|
2606
2617
|
const { cellPosition } = _m31;
|
|
@@ -2701,11 +2712,11 @@ class MergeRegions {
|
|
|
2701
2712
|
throw new RangeError("Merged ranges must stay within exported rows."); }
|
|
2702
2713
|
}
|
|
2703
2714
|
const _exports = Object.freeze({ MergeRegions: MergeRegions });
|
|
2704
|
-
_modules.set("
|
|
2715
|
+
_modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
|
|
2705
2716
|
return _exports;
|
|
2706
2717
|
})();
|
|
2707
2718
|
|
|
2708
|
-
const _m35 = _modules.get("
|
|
2719
|
+
const _m35 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
|
|
2709
2720
|
const { ExportCell } = _m5;
|
|
2710
2721
|
|
|
2711
2722
|
const { tableSpans } = _m29;
|
|
@@ -2738,11 +2749,11 @@ class StructuredRows {
|
|
|
2738
2749
|
}
|
|
2739
2750
|
}
|
|
2740
2751
|
const _exports = Object.freeze({ StructuredRows: StructuredRows });
|
|
2741
|
-
_modules.set("
|
|
2752
|
+
_modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
|
|
2742
2753
|
return _exports;
|
|
2743
2754
|
})();
|
|
2744
2755
|
|
|
2745
|
-
const _m33 = _modules.get("
|
|
2756
|
+
const _m33 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
|
|
2746
2757
|
const { ExportCell } = _m5;
|
|
2747
2758
|
|
|
2748
2759
|
const { isDate } = _m6;
|
|
@@ -2939,11 +2950,11 @@ function printXml(options, policy) {
|
|
|
2939
2950
|
(options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
|
|
2940
2951
|
}
|
|
2941
2952
|
const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
|
|
2942
|
-
_modules.set("
|
|
2953
|
+
_modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
|
|
2943
2954
|
return _exports;
|
|
2944
2955
|
})();
|
|
2945
2956
|
|
|
2946
|
-
const _m37 = _modules.get("
|
|
2957
|
+
const _m37 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
|
|
2947
2958
|
const { columnName } = _m27;
|
|
2948
2959
|
|
|
2949
2960
|
/** @internal Data-column selectors use stable keys or one-based worksheet columns. */
|
|
@@ -2970,11 +2981,11 @@ function qualifiedCell(sheetName, column, row) {
|
|
|
2970
2981
|
return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
|
|
2971
2982
|
}
|
|
2972
2983
|
const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
|
|
2973
|
-
_modules.set("
|
|
2984
|
+
_modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
|
|
2974
2985
|
return _exports;
|
|
2975
2986
|
})();
|
|
2976
2987
|
|
|
2977
|
-
const _m38 = _modules.get("
|
|
2988
|
+
const _m38 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
|
|
2978
2989
|
const { OfficeIMOError } = _m2;
|
|
2979
2990
|
|
|
2980
2991
|
const { columnName } = _m27;
|
|
@@ -3017,11 +3028,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
|
|
|
3017
3028
|
return reference || undefined;
|
|
3018
3029
|
}
|
|
3019
3030
|
const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
|
|
3020
|
-
_modules.set("
|
|
3031
|
+
_modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
|
|
3021
3032
|
return _exports;
|
|
3022
3033
|
})();
|
|
3023
3034
|
|
|
3024
|
-
const _m36 = _modules.get("
|
|
3035
|
+
const _m36 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
|
|
3025
3036
|
const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m17;
|
|
3026
3037
|
|
|
3027
3038
|
const { cellPosition } = _m31;
|
|
@@ -3187,11 +3198,11 @@ class ConditionalFormats {
|
|
|
3187
3198
|
}
|
|
3188
3199
|
}
|
|
3189
3200
|
const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
|
|
3190
|
-
_modules.set("
|
|
3201
|
+
_modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
|
|
3191
3202
|
return _exports;
|
|
3192
3203
|
})();
|
|
3193
3204
|
|
|
3194
|
-
const _m39 = _modules.get("
|
|
3205
|
+
const _m39 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
|
|
3195
3206
|
const { OfficeIMOError } = _m2;
|
|
3196
3207
|
|
|
3197
3208
|
const { checkAbort } = _m4;
|
|
@@ -3291,11 +3302,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
|
|
|
3291
3302
|
yield '</dataValidations>';
|
|
3292
3303
|
}
|
|
3293
3304
|
const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
|
|
3294
|
-
_modules.set("
|
|
3305
|
+
_modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
|
|
3295
3306
|
return _exports;
|
|
3296
3307
|
})();
|
|
3297
3308
|
|
|
3298
|
-
const _m30 = _modules.get("
|
|
3309
|
+
const _m30 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
|
|
3299
3310
|
const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
|
|
3300
3311
|
|
|
3301
3312
|
const { ChunkedTextSink, BlobByteSink } = _m3;
|
|
@@ -4017,11 +4028,11 @@ class Worksheet {
|
|
|
4017
4028
|
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); }
|
|
4018
4029
|
}
|
|
4019
4030
|
const _exports = Object.freeze({ Worksheet: Worksheet });
|
|
4020
|
-
_modules.set("
|
|
4031
|
+
_modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
|
|
4021
4032
|
return _exports;
|
|
4022
4033
|
})();
|
|
4023
4034
|
|
|
4024
|
-
const _m40 = _modules.get("
|
|
4035
|
+
const _m40 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
|
|
4025
4036
|
const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m17;
|
|
4026
4037
|
|
|
4027
4038
|
const { cellText, columnName } = _m27;
|
|
@@ -4064,11 +4075,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
|
|
|
4064
4075
|
'" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
|
|
4065
4076
|
}
|
|
4066
4077
|
const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
|
|
4067
|
-
_modules.set("
|
|
4078
|
+
_modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
|
|
4068
4079
|
return _exports;
|
|
4069
4080
|
})();
|
|
4070
4081
|
|
|
4071
|
-
const _m41 = _modules.get("
|
|
4082
|
+
const _m41 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
|
|
4072
4083
|
const { OfficeIMOError } = _m2;
|
|
4073
4084
|
|
|
4074
4085
|
const { cleanXml } = _m17;
|
|
@@ -4132,7 +4143,7 @@ function* splitText(text) {
|
|
|
4132
4143
|
}
|
|
4133
4144
|
}
|
|
4134
4145
|
const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
|
|
4135
|
-
_modules.set("
|
|
4146
|
+
_modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
|
|
4136
4147
|
return _exports;
|
|
4137
4148
|
})();
|
|
4138
4149
|
|
|
@@ -4159,7 +4170,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
|
|
|
4159
4170
|
return _exports;
|
|
4160
4171
|
})();
|
|
4161
4172
|
|
|
4162
|
-
const _m44 = _modules.get("
|
|
4173
|
+
const _m44 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
|
|
4163
4174
|
const { checkAbort } = _m4;
|
|
4164
4175
|
|
|
4165
4176
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
@@ -4287,11 +4298,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
|
|
|
4287
4298
|
}, finish });
|
|
4288
4299
|
}
|
|
4289
4300
|
const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
|
|
4290
|
-
_modules.set("
|
|
4301
|
+
_modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
|
|
4291
4302
|
return _exports;
|
|
4292
4303
|
})();
|
|
4293
4304
|
|
|
4294
|
-
const _m43 = _modules.get("
|
|
4305
|
+
const _m43 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
|
|
4295
4306
|
const { checkAbort } = _m4;
|
|
4296
4307
|
|
|
4297
4308
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
@@ -4458,11 +4469,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
|
|
|
4458
4469
|
points, textCharacters });
|
|
4459
4470
|
}
|
|
4460
4471
|
const _exports = Object.freeze({ prepareChart: prepareChart });
|
|
4461
|
-
_modules.set("
|
|
4472
|
+
_modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
|
|
4462
4473
|
return _exports;
|
|
4463
4474
|
})();
|
|
4464
4475
|
|
|
4465
|
-
const _m22 = _modules.get("
|
|
4476
|
+
const _m22 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
|
|
4466
4477
|
const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
|
|
4467
4478
|
|
|
4468
4479
|
const { OfficeIMOError } = _m2;
|
|
@@ -4937,7 +4948,7 @@ class Workbook {
|
|
|
4937
4948
|
}
|
|
4938
4949
|
}
|
|
4939
4950
|
const _exports = Object.freeze({ Workbook: Workbook });
|
|
4940
|
-
_modules.set("
|
|
4951
|
+
_modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
|
|
4941
4952
|
return _exports;
|
|
4942
4953
|
})();
|
|
4943
4954
|
|
|
@@ -4994,7 +5005,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
|
|
|
4994
5005
|
return _exports;
|
|
4995
5006
|
})();
|
|
4996
5007
|
|
|
4997
|
-
const _m45 = _modules.get("
|
|
5008
|
+
const _m45 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
|
|
4998
5009
|
const { withDestination } = _m3;
|
|
4999
5010
|
|
|
5000
5011
|
const { copyColumns } = _m11;
|
|
@@ -5049,11 +5060,11 @@ async function writeXlsxTo(rows, destination, configuration) {
|
|
|
5049
5060
|
});
|
|
5050
5061
|
}
|
|
5051
5062
|
const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
|
|
5052
|
-
_modules.set("
|
|
5063
|
+
_modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
|
|
5053
5064
|
return _exports;
|
|
5054
5065
|
})();
|
|
5055
5066
|
|
|
5056
|
-
const _m48 = _modules.get("
|
|
5067
|
+
const _m48 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
|
|
5057
5068
|
const { assertGroupedReportSource } = _m8;
|
|
5058
5069
|
|
|
5059
5070
|
const { captureFields } = _m10;
|
|
@@ -5142,11 +5153,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
|
|
|
5142
5153
|
...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
|
|
5143
5154
|
}
|
|
5144
5155
|
const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
|
|
5145
|
-
_modules.set("
|
|
5156
|
+
_modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
|
|
5146
5157
|
return _exports;
|
|
5147
5158
|
})();
|
|
5148
5159
|
|
|
5149
|
-
const _m47 = _modules.get("
|
|
5160
|
+
const _m47 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
|
|
5150
5161
|
const { groupedReportOperation } = _m8;
|
|
5151
5162
|
|
|
5152
5163
|
const { checkAbort, withAbort } = _m4;
|
|
@@ -5319,14 +5330,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
|
|
|
5319
5330
|
return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
|
|
5320
5331
|
}
|
|
5321
5332
|
const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
|
|
5322
|
-
_modules.set("
|
|
5333
|
+
_modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
|
|
5323
5334
|
return _exports;
|
|
5324
5335
|
})();
|
|
5325
5336
|
|
|
5326
|
-
const _m21 = _modules.get("
|
|
5337
|
+
const _m21 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
|
|
5327
5338
|
|
|
5328
5339
|
const _exports = Object.freeze({ Workbook: _m22.Workbook, writeXlsx: _m45.writeXlsx, writeXlsxTo: _m45.writeXlsxTo, writeGroupedXlsx: _m47.writeGroupedXlsx, writeGroupedXlsxTo: _m47.writeGroupedXlsxTo, addGroupedXlsx: _m47.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m30.Worksheet, Cell: _m27.Cell, FormulaCell: _m28.FormulaCell, StyleRegistry: _m24.StyleRegistry, NumberFormats: _m24.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
|
|
5329
|
-
_modules.set("
|
|
5340
|
+
_modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
|
|
5330
5341
|
return _exports;
|
|
5331
5342
|
})();
|
|
5332
5343
|
|
|
@@ -5386,7 +5397,7 @@ _modules.set("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208",
|
|
|
5386
5397
|
return _exports;
|
|
5387
5398
|
})();
|
|
5388
5399
|
|
|
5389
|
-
const _m49 = _modules.get("
|
|
5400
|
+
const _m49 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
|
|
5390
5401
|
const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
|
|
5391
5402
|
|
|
5392
5403
|
const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
|
|
@@ -5533,7 +5544,7 @@ async function writeCsv(rows, configuration) {
|
|
|
5533
5544
|
}
|
|
5534
5545
|
}
|
|
5535
5546
|
const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
|
|
5536
|
-
_modules.set("
|
|
5547
|
+
_modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
|
|
5537
5548
|
return _exports;
|
|
5538
5549
|
})();
|
|
5539
5550
|
|
|
@@ -5646,7 +5657,7 @@ _modules.set("278e6adc6a5d4491e688589ef165bd1aa9cc74f557da6f9d6bdf53ecc0c6df47",
|
|
|
5646
5657
|
return _exports;
|
|
5647
5658
|
})();
|
|
5648
5659
|
|
|
5649
|
-
const _m55 = _modules.get("
|
|
5660
|
+
const _m55 = _modules.get("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38") ?? (() => {
|
|
5650
5661
|
const { OfficeIMOError } = _m2;
|
|
5651
5662
|
|
|
5652
5663
|
const { ExportBudget } = _m9;
|
|
@@ -5721,10 +5732,34 @@ function captureWideTable(input) {
|
|
|
5721
5732
|
if (repeatColumns !== undefined && !Array.isArray(repeatColumns))
|
|
5722
5733
|
throw new TypeError("repeatColumns must be an array.");
|
|
5723
5734
|
const repeats = repeatColumns === undefined ? [] : [...repeatColumns];
|
|
5724
|
-
if (repeats.some(
|
|
5725
|
-
throw new RangeError("repeatColumns must contain
|
|
5735
|
+
if (repeats.some(value => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !value.length))
|
|
5736
|
+
throw new RangeError("repeatColumns must contain nonnegative indices or nonempty stable keys.");
|
|
5737
|
+
if (repeats.every(value => typeof value === "number") && repeats.some((value, index) => index > 0 && value <= repeats[index - 1]))
|
|
5738
|
+
throw new RangeError("Numeric repeatColumns must contain sorted unique nonnegative indices.");
|
|
5726
5739
|
return Object.freeze({ mode, ...(minimumColumnWidth === undefined ? {} : { minimumColumnWidth }), repeatColumns: Object.freeze(repeats) });
|
|
5727
5740
|
}
|
|
5741
|
+
/** Resolve identities against this table's captured selection, without consulting a grid or opening its rows. */
|
|
5742
|
+
function repeatedColumns(policy, columns) {
|
|
5743
|
+
if (typeof policy !== "object")
|
|
5744
|
+
return Object.freeze([]);
|
|
5745
|
+
const selected = new Set();
|
|
5746
|
+
for (const selector of policy.repeatColumns ?? []) {
|
|
5747
|
+
let position;
|
|
5748
|
+
if (typeof selector === "number")
|
|
5749
|
+
position = selector;
|
|
5750
|
+
else {
|
|
5751
|
+
position = columns.findIndex(column => column.key === selector);
|
|
5752
|
+
if (position < 0 || columns.some((column, index) => index !== position && column.key === selector))
|
|
5753
|
+
throw new TypeError("repeatColumns requires an unambiguous selected column key: " + selector);
|
|
5754
|
+
}
|
|
5755
|
+
if (position >= columns.length)
|
|
5756
|
+
throw new RangeError("repeatColumns index exceeds the declared columns.");
|
|
5757
|
+
if (selected.has(position))
|
|
5758
|
+
throw new TypeError("repeatColumns selects the same column more than once.");
|
|
5759
|
+
selected.add(position);
|
|
5760
|
+
}
|
|
5761
|
+
return Object.freeze([...selected].sort((left, right) => left - right));
|
|
5762
|
+
}
|
|
5728
5763
|
function settings(input, document = false) {
|
|
5729
5764
|
const configuration = { ...capturePdfOptions(input) };
|
|
5730
5765
|
configuration.booleanText = captureBooleanText(configuration.booleanText);
|
|
@@ -5826,18 +5861,78 @@ function settings(input, document = false) {
|
|
|
5826
5861
|
}
|
|
5827
5862
|
const maxImageWorkingBytes = options.limits?.maxImageWorkingBytes;
|
|
5828
5863
|
return { options: { ...options, paragraphStyles }, paragraphStyles, page, margins, fontSize, padding,
|
|
5864
|
+
repeatedColumns: document ? Object.freeze([]) : repeatedColumns(options.wideTable, columns),
|
|
5829
5865
|
limits: { ...limits, ...(maxImageWorkingBytes === undefined ? {} : { maxImageWorkingBytes }) }, budget };
|
|
5830
5866
|
}
|
|
5831
5867
|
const _exports = Object.freeze({ positive: _m57.positive, color: _m57.color, presentation: _m57.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
5832
|
-
_modules.set("
|
|
5868
|
+
_modules.set("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38", _exports);
|
|
5869
|
+
return _exports;
|
|
5870
|
+
})();
|
|
5871
|
+
|
|
5872
|
+
const _m60 = _modules.get("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01") ?? (() => {
|
|
5873
|
+
/** @internal One type byte, an eight-byte offset/container number and a two-byte generation/index. */
|
|
5874
|
+
const pdfXrefEntryBytes = 11;
|
|
5875
|
+
function unsigned(bytes, offset, value, width) {
|
|
5876
|
+
if (!Number.isSafeInteger(value) || value < 0 || value >= 2 ** (width * 8))
|
|
5877
|
+
throw new RangeError("Invalid PDF cross-reference field.");
|
|
5878
|
+
// Bitwise shifts truncate to 32 bits. Arithmetic preserves every supported byte offset.
|
|
5879
|
+
for (let index = width - 1; index >= 0; index--) {
|
|
5880
|
+
bytes[offset + index] = value % 256;
|
|
5881
|
+
value = Math.floor(value / 256);
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
/** @internal Stream a complete single-section xref, including its own ordinary-object entry.
|
|
5885
|
+
* A defined member index means that the location is an object-stream number rather than a byte offset. */
|
|
5886
|
+
function* pdfXrefChunks(locations, indices) {
|
|
5887
|
+
if (locations.length !== indices.length)
|
|
5888
|
+
throw new Error("PDF cross-reference locations must align.");
|
|
5889
|
+
const perChunk = Math.floor(32768 / pdfXrefEntryBytes);
|
|
5890
|
+
for (let first = 0; first < locations.length; first += perChunk) {
|
|
5891
|
+
const count = Math.min(perChunk, locations.length - first), bytes = new Uint8Array(count * pdfXrefEntryBytes);
|
|
5892
|
+
for (let index = 0; index < count; index++) {
|
|
5893
|
+
const id = first + index, position = index * pdfXrefEntryBytes, location = locations[id], member = indices.at(id);
|
|
5894
|
+
if (location === undefined)
|
|
5895
|
+
throw new Error("PDF contains unwritten objects.");
|
|
5896
|
+
bytes[position] = id === 0 ? 0 : member === undefined ? 1 : 2;
|
|
5897
|
+
unsigned(bytes, position + 1, location, 8);
|
|
5898
|
+
unsigned(bytes, position + 9, id === 0 ? 65535 : member ?? 0, 2);
|
|
5899
|
+
}
|
|
5900
|
+
yield bytes;
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
const _exports = Object.freeze({ pdfXrefEntryBytes: pdfXrefEntryBytes, pdfXrefChunks: pdfXrefChunks });
|
|
5904
|
+
_modules.set("e3d39f39aebcbaf063fd8221df0d9cb5902ad2545a9d9e474bb59d47f15e2c01", _exports);
|
|
5833
5905
|
return _exports;
|
|
5834
5906
|
})();
|
|
5835
5907
|
|
|
5836
|
-
const _m59 = _modules.get("
|
|
5908
|
+
const _m59 = _modules.get("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f") ?? (() => {
|
|
5837
5909
|
const { checkAbort, withAbort, pause, taskYieldDue } = _m4;
|
|
5838
5910
|
|
|
5839
5911
|
const { OfficeIMOError } = _m2;
|
|
5840
5912
|
|
|
5913
|
+
const { pdfXrefChunks, pdfXrefEntryBytes } = _m60;
|
|
5914
|
+
|
|
5915
|
+
const compactObjectCount = 256, compactObjectBytes = 32768;
|
|
5916
|
+
const compactIndexChunkEntries = 4096;
|
|
5917
|
+
/** Lazy Uint16 chunks store compact membership; untouched zero slots denote ordinary objects. */
|
|
5918
|
+
class PdfCompactIndices {
|
|
5919
|
+
count;
|
|
5920
|
+
chunks = [];
|
|
5921
|
+
constructor(count) {
|
|
5922
|
+
this.count = count;
|
|
5923
|
+
}
|
|
5924
|
+
get length() { return this.count; }
|
|
5925
|
+
reserve() { this.count++; }
|
|
5926
|
+
set(id, member) {
|
|
5927
|
+
const chunk = this.chunks[Math.floor(id / compactIndexChunkEntries)] ??= new Uint16Array(compactIndexChunkEntries);
|
|
5928
|
+
// The current batch cap permits indices 0..255; adding one preserves index 255 as 256.
|
|
5929
|
+
chunk[id % compactIndexChunkEntries] = member + 1;
|
|
5930
|
+
}
|
|
5931
|
+
at(id) {
|
|
5932
|
+
const encoded = this.chunks[Math.floor(id / compactIndexChunkEntries)]?.[id % compactIndexChunkEntries] ?? 0;
|
|
5933
|
+
return encoded ? encoded - 1 : undefined;
|
|
5934
|
+
}
|
|
5935
|
+
}
|
|
5841
5936
|
function pdfNumber(value) {
|
|
5842
5937
|
if (!Number.isFinite(value) || Math.abs(value) > 1e9)
|
|
5843
5938
|
throw new RangeError("PDF coordinates and metrics must be finite and bounded.");
|
|
@@ -5854,25 +5949,33 @@ function unicodeHex(text) {
|
|
|
5854
5949
|
}
|
|
5855
5950
|
return hex;
|
|
5856
5951
|
}
|
|
5857
|
-
/** @internal Forward-only PDF objects.
|
|
5952
|
+
/** @internal Forward-only PDF objects. Completed objects retain only their xref location. */
|
|
5858
5953
|
class PdfObjects {
|
|
5859
5954
|
sink;
|
|
5860
5955
|
signal;
|
|
5861
5956
|
maxBytes;
|
|
5957
|
+
compressObjects;
|
|
5862
5958
|
offsets = [0];
|
|
5959
|
+
// A defined index changes the corresponding full-width offset into an object-stream number.
|
|
5960
|
+
// Membership chunks are allocated only when a compact member needs their ID range.
|
|
5961
|
+
compactIndices;
|
|
5962
|
+
compactBatch;
|
|
5963
|
+
compactArena;
|
|
5964
|
+
compactUnavailable = false;
|
|
5863
5965
|
encoder = new TextEncoder();
|
|
5864
5966
|
buffer = new Uint8Array(32768);
|
|
5865
5967
|
buffered = 0;
|
|
5866
5968
|
bytes = 0;
|
|
5867
|
-
constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER) {
|
|
5969
|
+
constructor(sink, signal, maxBytes = Number.MAX_SAFE_INTEGER, compressObjects = false) {
|
|
5868
5970
|
this.sink = sink;
|
|
5869
5971
|
this.signal = signal;
|
|
5870
5972
|
this.maxBytes = maxBytes;
|
|
5973
|
+
this.compressObjects = compressObjects;
|
|
5871
5974
|
}
|
|
5872
|
-
reserve() { this.offsets.push(undefined); return this.offsets.length - 1; }
|
|
5975
|
+
reserve() { this.offsets.push(undefined); this.compactIndices?.reserve(); return this.offsets.length - 1; }
|
|
5873
5976
|
async raw(bytes) {
|
|
5874
5977
|
checkAbort(this.signal);
|
|
5875
|
-
if (this.bytes + bytes.length > this.maxBytes)
|
|
5978
|
+
if (!Number.isSafeInteger(this.bytes + bytes.length) || this.bytes + bytes.length > this.maxBytes)
|
|
5876
5979
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxOutputBytes exceeded.");
|
|
5877
5980
|
this.bytes += bytes.length;
|
|
5878
5981
|
for (let offset = 0; offset < bytes.length;) {
|
|
@@ -5881,21 +5984,139 @@ class PdfObjects {
|
|
|
5881
5984
|
offset += n;
|
|
5882
5985
|
this.buffered += n;
|
|
5883
5986
|
if (this.buffered === this.buffer.length)
|
|
5884
|
-
await this.
|
|
5987
|
+
await this.flushBytes();
|
|
5885
5988
|
}
|
|
5886
5989
|
}
|
|
5887
5990
|
async text(text) { await this.raw(this.encoder.encode(text)); }
|
|
5888
5991
|
async flush() {
|
|
5992
|
+
await this.flushCompact();
|
|
5993
|
+
await this.flushBytes();
|
|
5994
|
+
}
|
|
5995
|
+
/** Publish completed page bytes without forcing a partial structure container to end. */
|
|
5996
|
+
async flushBytes() {
|
|
5889
5997
|
if (this.buffered) {
|
|
5890
5998
|
const bytes = this.buffer.subarray(0, this.buffered);
|
|
5891
5999
|
await withAbort(Promise.resolve(this.sink.write(bytes)), this.signal);
|
|
5892
|
-
this
|
|
6000
|
+
// The sink borrows this view until acceptance; failed or cancelled writes must not reuse it.
|
|
5893
6001
|
this.buffered = 0;
|
|
5894
6002
|
}
|
|
5895
6003
|
if (taskYieldDue())
|
|
5896
6004
|
await pause();
|
|
5897
6005
|
checkAbort(this.signal);
|
|
5898
6006
|
}
|
|
6007
|
+
/** @internal Append only when an existing compact batch can accept a member without async work. */
|
|
6008
|
+
tryCompactObject(id, body) {
|
|
6009
|
+
checkAbort(this.signal);
|
|
6010
|
+
this.validateObject(id);
|
|
6011
|
+
const batch = this.compactBatch;
|
|
6012
|
+
if (!batch || !this.compressObjects || this.compactUnavailable || typeof CompressionStream !== "function" ||
|
|
6013
|
+
body.length > compactObjectBytes || batch.ids.length + 1 >= compactObjectCount)
|
|
6014
|
+
return false;
|
|
6015
|
+
const indexBytes = String(id).length + String(batch.bodyBytes).length + 2;
|
|
6016
|
+
const written = this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2);
|
|
6017
|
+
if (written === undefined)
|
|
6018
|
+
return false;
|
|
6019
|
+
this.storeCompactBody(batch, id, written);
|
|
6020
|
+
return true;
|
|
6021
|
+
}
|
|
6022
|
+
/** Small logical structure values share one bounded object-stream container. Other callers keep
|
|
6023
|
+
* ordinary objects; unavailable deflate preserves the classic representation before packing starts. */
|
|
6024
|
+
async compactObject(id, body) {
|
|
6025
|
+
checkAbort(this.signal);
|
|
6026
|
+
this.validateObject(id);
|
|
6027
|
+
if (!this.compressObjects || this.compactUnavailable || body.length > compactObjectBytes)
|
|
6028
|
+
return this.object(id, body);
|
|
6029
|
+
if (typeof CompressionStream !== "function") {
|
|
6030
|
+
if (this.compactIndices)
|
|
6031
|
+
throw new Error("PDF object compression became unavailable.");
|
|
6032
|
+
this.compactUnavailable = true;
|
|
6033
|
+
return this.object(id, body);
|
|
6034
|
+
}
|
|
6035
|
+
const firstIndexBytes = String(id).length + 4;
|
|
6036
|
+
let batch = this.compactBatch;
|
|
6037
|
+
const indexBytes = String(id).length + String(batch?.bodyBytes ?? 0).length + 2;
|
|
6038
|
+
let written = batch && batch.ids.length < compactObjectCount ? this.encodeCompactBody(body, batch.bodyBytes, compactObjectBytes - batch.indexBytes - indexBytes - batch.bodyBytes - 2) : undefined;
|
|
6039
|
+
if (batch && written === undefined) {
|
|
6040
|
+
// Partial encodings only touch the uncommitted suffix. Flush the committed prefix and retry
|
|
6041
|
+
// the whole string so a multibyte scalar is never split between containers.
|
|
6042
|
+
await this.flushCompact();
|
|
6043
|
+
batch = undefined;
|
|
6044
|
+
checkAbort(this.signal);
|
|
6045
|
+
}
|
|
6046
|
+
if (!batch) {
|
|
6047
|
+
written = this.encodeCompactBody(body, 0, compactObjectBytes - firstIndexBytes - 1);
|
|
6048
|
+
if (written === undefined)
|
|
6049
|
+
return this.object(id, body);
|
|
6050
|
+
let compressor;
|
|
6051
|
+
// Probe before selecting the compact representation. Later batches need no idle native
|
|
6052
|
+
// codec while they accumulate, including while ordinary page streams are compressed.
|
|
6053
|
+
if (!this.compactIndices) {
|
|
6054
|
+
try {
|
|
6055
|
+
compressor = new CompressionStream("deflate");
|
|
6056
|
+
}
|
|
6057
|
+
catch {
|
|
6058
|
+
this.compactUnavailable = true;
|
|
6059
|
+
return this.object(id, body);
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
batch = { id: this.reserve(), compressor, ids: [], bodyOffsets: [], bodyBytes: 0, indexBytes: 1 };
|
|
6063
|
+
this.compactIndices ??= new PdfCompactIndices(this.offsets.length);
|
|
6064
|
+
this.compactBatch = batch;
|
|
6065
|
+
}
|
|
6066
|
+
this.storeCompactBody(batch, id, written);
|
|
6067
|
+
if (batch.ids.length === compactObjectCount)
|
|
6068
|
+
await this.flushCompact();
|
|
6069
|
+
}
|
|
6070
|
+
storeCompactBody(batch, id, written) {
|
|
6071
|
+
this.offsets[id] = batch.id;
|
|
6072
|
+
this.compactIndices.set(id, batch.ids.length);
|
|
6073
|
+
batch.indexBytes += String(id).length + String(batch.bodyBytes).length + 2;
|
|
6074
|
+
batch.ids.push(id);
|
|
6075
|
+
batch.bodyOffsets.push(batch.bodyBytes);
|
|
6076
|
+
this.compactArena[batch.bodyBytes + written] = 10;
|
|
6077
|
+
batch.bodyBytes += written + 1;
|
|
6078
|
+
}
|
|
6079
|
+
/** An incomplete encoding leaves only scratch bytes beyond the committed batch prefix. */
|
|
6080
|
+
encodeCompactBody(body, offset, available) {
|
|
6081
|
+
if (available < 0)
|
|
6082
|
+
return undefined;
|
|
6083
|
+
const destination = (this.compactArena ??= new Uint8Array(compactObjectBytes)).subarray(offset, offset + available);
|
|
6084
|
+
if (typeof this.encoder.encodeInto === "function") {
|
|
6085
|
+
const result = this.encoder.encodeInto(body, destination);
|
|
6086
|
+
return result.read === body.length ? result.written : undefined;
|
|
6087
|
+
}
|
|
6088
|
+
// Preserve TextEncoder implementations that only expose encode().
|
|
6089
|
+
const bytes = this.encoder.encode(body);
|
|
6090
|
+
if (bytes.length > available)
|
|
6091
|
+
return undefined;
|
|
6092
|
+
destination.set(bytes);
|
|
6093
|
+
return bytes.length;
|
|
6094
|
+
}
|
|
6095
|
+
async flushCompact() {
|
|
6096
|
+
const batch = this.compactBatch;
|
|
6097
|
+
if (!batch)
|
|
6098
|
+
return;
|
|
6099
|
+
this.compactBatch = undefined;
|
|
6100
|
+
let index = "";
|
|
6101
|
+
for (let member = 0; member < batch.ids.length; member++)
|
|
6102
|
+
index += batch.ids[member] + " " + batch.bodyOffsets[member] + " ";
|
|
6103
|
+
const header = this.encoder.encode(index + "\n"), count = batch.ids.length;
|
|
6104
|
+
// Keep the index separate from the arena. Reuse waits for the compressed read or all raw
|
|
6105
|
+
// writes below, so later members cannot overwrite a borrowed batch body.
|
|
6106
|
+
const body = this.compactArena.subarray(0, batch.bodyBytes);
|
|
6107
|
+
batch.ids.length = 0;
|
|
6108
|
+
batch.bodyOffsets.length = 0;
|
|
6109
|
+
if (batch.compressor) {
|
|
6110
|
+
await this.compressedStream(batch.id, body, "/Type /ObjStm /N " + count + " /First " + header.length, batch.compressor, header);
|
|
6111
|
+
}
|
|
6112
|
+
else {
|
|
6113
|
+
this.start(batch.id);
|
|
6114
|
+
await this.text(batch.id + " 0 obj\n<< /Length " + (header.length + body.length) + " /Type /ObjStm /N " + count + " /First " + header.length + " >>\nstream\n");
|
|
6115
|
+
await this.raw(header);
|
|
6116
|
+
await this.raw(body);
|
|
6117
|
+
await this.text("\nendstream\nendobj\n");
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
5899
6120
|
async object(id, body) {
|
|
5900
6121
|
this.start(id);
|
|
5901
6122
|
if (typeof body === "string") {
|
|
@@ -5919,9 +6140,12 @@ class PdfObjects {
|
|
|
5919
6140
|
}
|
|
5920
6141
|
await this.text(chunk + "\nendobj\n");
|
|
5921
6142
|
}
|
|
5922
|
-
|
|
5923
|
-
if (!Number.
|
|
6143
|
+
validateObject(id) {
|
|
6144
|
+
if (!Number.isSafeInteger(id) || id <= 0 || id >= this.offsets.length || this.offsets[id] !== undefined)
|
|
5924
6145
|
throw new Error("Invalid PDF object state.");
|
|
6146
|
+
}
|
|
6147
|
+
start(id) {
|
|
6148
|
+
this.validateObject(id);
|
|
5925
6149
|
this.offsets[id] = this.bytes;
|
|
5926
6150
|
}
|
|
5927
6151
|
async stream(id, source, dictionary = "", compression = true, owned = false) {
|
|
@@ -5942,7 +6166,15 @@ class PdfObjects {
|
|
|
5942
6166
|
}
|
|
5943
6167
|
// Verified internal producers can transfer immutable ownership; other byte sources retain the defensive snapshot.
|
|
5944
6168
|
const sourceBytes = typeof source === "string" || owned ? bytes : new Uint8Array(bytes);
|
|
5945
|
-
|
|
6169
|
+
await this.compressedStream(id, sourceBytes, dictionary, compressor);
|
|
6170
|
+
}
|
|
6171
|
+
async compressedStream(id, sourceBytes, dictionary, compressor, prefix) {
|
|
6172
|
+
const input = new ReadableStream({ start(controller) {
|
|
6173
|
+
if (prefix)
|
|
6174
|
+
controller.enqueue(prefix);
|
|
6175
|
+
controller.enqueue(sourceBytes);
|
|
6176
|
+
controller.close();
|
|
6177
|
+
} });
|
|
5946
6178
|
const reader = input.pipeThrough(compressor).getReader(), lengthId = this.reserve();
|
|
5947
6179
|
let length = 0, complete = false;
|
|
5948
6180
|
try {
|
|
@@ -5967,10 +6199,14 @@ class PdfObjects {
|
|
|
5967
6199
|
}
|
|
5968
6200
|
}
|
|
5969
6201
|
async finish(root, info) {
|
|
5970
|
-
|
|
5971
|
-
|
|
6202
|
+
await this.flushCompact();
|
|
6203
|
+
for (let id = 1; id < this.offsets.length; id++)
|
|
6204
|
+
if (this.offsets[id] === undefined)
|
|
6205
|
+
throw new Error("PDF contains unwritten objects.");
|
|
5972
6206
|
if (this.bytes > 9999999999)
|
|
5973
6207
|
throw new OfficeIMOError("RESOURCE_LIMIT", "PDF exceeds classic cross-reference offset capacity.");
|
|
6208
|
+
if (this.compactIndices)
|
|
6209
|
+
return this.finishCompact(root, info);
|
|
5974
6210
|
const start = this.bytes;
|
|
5975
6211
|
await this.text("xref\n0 " + this.offsets.length + "\n0000000000 65535 f \n");
|
|
5976
6212
|
for (let i = 1; i < this.offsets.length; i++)
|
|
@@ -5978,13 +6214,27 @@ class PdfObjects {
|
|
|
5978
6214
|
await this.text("trailer\n<< /Size " + this.offsets.length + " /Root " + root + " 0 R /Info " + info + " 0 R >>\nstartxref\n" + start + "\n%%EOF\n");
|
|
5979
6215
|
await this.flush();
|
|
5980
6216
|
}
|
|
6217
|
+
/** Xref payloads have a known length and are emitted in bounded chunks, without another copy
|
|
6218
|
+
* of the document's random-access location arrays or a whole-xref compression buffer. */
|
|
6219
|
+
async finishCompact(root, info) {
|
|
6220
|
+
const id = this.reserve(), start = this.bytes, length = this.offsets.length * pdfXrefEntryBytes;
|
|
6221
|
+
if (!Number.isSafeInteger(length))
|
|
6222
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "PDF cross-reference stream is too large.");
|
|
6223
|
+
this.start(id);
|
|
6224
|
+
await this.text(id + " 0 obj\n<< /Type /XRef /Size " + this.offsets.length + " /W [1 8 2] /Root " + root + " 0 R /Info " + info +
|
|
6225
|
+
" 0 R /Length " + length + " >>\nstream\n");
|
|
6226
|
+
for (const chunk of pdfXrefChunks(this.offsets, this.compactIndices))
|
|
6227
|
+
await this.raw(chunk);
|
|
6228
|
+
await this.text("\nendstream\nendobj\nstartxref\n" + start + "\n%%EOF\n");
|
|
6229
|
+
await this.flushBytes();
|
|
6230
|
+
}
|
|
5981
6231
|
}
|
|
5982
6232
|
const _exports = Object.freeze({ pdfNumber: pdfNumber, unicodeHex: unicodeHex, PdfObjects: PdfObjects });
|
|
5983
|
-
_modules.set("
|
|
6233
|
+
_modules.set("e716b8b1da464094622f5f671518493c78e63ff22a029d61544d2d193b63ce8f", _exports);
|
|
5984
6234
|
return _exports;
|
|
5985
6235
|
})();
|
|
5986
6236
|
|
|
5987
|
-
const
|
|
6237
|
+
const _m64 = _modules.get("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c") ?? (() => {
|
|
5988
6238
|
/** @internal Bounded big-endian reader used for caller-provided TrueType programs. */
|
|
5989
6239
|
class FontReader {
|
|
5990
6240
|
bytes;
|
|
@@ -6014,8 +6264,8 @@ _modules.set("1e169e6ecdeceff319b5da4bf01f4c653c1a3d9e8ad696b141bf8ac52d9f446c",
|
|
|
6014
6264
|
return _exports;
|
|
6015
6265
|
})();
|
|
6016
6266
|
|
|
6017
|
-
const
|
|
6018
|
-
const { align4 } =
|
|
6267
|
+
const _m65 = _modules.get("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c") ?? (() => {
|
|
6268
|
+
const { align4 } = _m64;
|
|
6019
6269
|
|
|
6020
6270
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6021
6271
|
|
|
@@ -6235,16 +6485,16 @@ function* checksumSteps(bytes) {
|
|
|
6235
6485
|
return sum;
|
|
6236
6486
|
}
|
|
6237
6487
|
const _exports = Object.freeze({ subsetTrueType: subsetTrueType, subsetTrueTypeCooperatively: subsetTrueTypeCooperatively });
|
|
6238
|
-
_modules.set("
|
|
6488
|
+
_modules.set("ecf6c6ab2f9c5f747338d0d59d9f2cae0b006d9d2a210bcb1545db1f046eb80c", _exports);
|
|
6239
6489
|
return _exports;
|
|
6240
6490
|
})();
|
|
6241
6491
|
|
|
6242
|
-
const
|
|
6492
|
+
const _m63 = _modules.get("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d") ?? (() => {
|
|
6243
6493
|
const { NotSupportedError } = _m2;
|
|
6244
6494
|
|
|
6245
|
-
const { FontReader } =
|
|
6495
|
+
const { FontReader } = _m64;
|
|
6246
6496
|
|
|
6247
|
-
const { subsetTrueType, subsetTrueTypeCooperatively } =
|
|
6497
|
+
const { subsetTrueType, subsetTrueTypeCooperatively } = _m65;
|
|
6248
6498
|
|
|
6249
6499
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6250
6500
|
|
|
@@ -6480,12 +6730,12 @@ function* parseFont(reader) {
|
|
|
6480
6730
|
return { tables, glyphCount, units, ascent, descent, bbox, widths, offsets, canSubset, cmaps };
|
|
6481
6731
|
}
|
|
6482
6732
|
const _exports = Object.freeze({ TrueTypeFont: TrueTypeFont });
|
|
6483
|
-
_modules.set("
|
|
6733
|
+
_modules.set("2e1fa1582af797386e2e2914c0a27237309b1692a3cc2be688f46590eb74480d", _exports);
|
|
6484
6734
|
return _exports;
|
|
6485
6735
|
})();
|
|
6486
6736
|
|
|
6487
|
-
const
|
|
6488
|
-
const { TrueTypeFont } =
|
|
6737
|
+
const _m62 = _modules.get("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596") ?? (() => {
|
|
6738
|
+
const { TrueTypeFont } = _m63;
|
|
6489
6739
|
|
|
6490
6740
|
const { beginTask, checkAbort } = _m4;
|
|
6491
6741
|
|
|
@@ -6544,11 +6794,11 @@ class PdfFont {
|
|
|
6544
6794
|
toBytes() { return fontProgram(this).bytes.slice(); }
|
|
6545
6795
|
}
|
|
6546
6796
|
const _exports = Object.freeze({ fontProgram: fontProgram, PdfFont: PdfFont });
|
|
6547
|
-
_modules.set("
|
|
6797
|
+
_modules.set("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596", _exports);
|
|
6548
6798
|
return _exports;
|
|
6549
6799
|
})();
|
|
6550
6800
|
|
|
6551
|
-
const
|
|
6801
|
+
const _m67 = _modules.get("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61") ?? (() => {
|
|
6552
6802
|
// Generated by scripts/pdf-widths.mjs from OfficeIMO.Pdf's Adobe AFM-derived metrics.
|
|
6553
6803
|
const helveticaWidths = new Map([
|
|
6554
6804
|
[32, [278, 278]],
|
|
@@ -6871,12 +7121,12 @@ _modules.set("1ed4965a6e2963a91190baa8a58ada8ce0edde8fe653bcb6609002e872af0d61",
|
|
|
6871
7121
|
return _exports;
|
|
6872
7122
|
})();
|
|
6873
7123
|
|
|
6874
|
-
const
|
|
7124
|
+
const _m66 = _modules.get("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070") ?? (() => {
|
|
6875
7125
|
const { OfficeIMOError } = _m2;
|
|
6876
7126
|
|
|
6877
|
-
const { PdfFont, fontProgram } =
|
|
7127
|
+
const { PdfFont, fontProgram } = _m62;
|
|
6878
7128
|
|
|
6879
|
-
const { helveticaWidths } =
|
|
7129
|
+
const { helveticaWidths } = _m67;
|
|
6880
7130
|
|
|
6881
7131
|
const winAnsiExtras = new Map([0x20ac, 0, 0x201a, 0x192, 0x201e, 0x2026, 0x2020, 0x2021, 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0, 0x17d, 0, 0, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x2dc, 0x2122, 0x161, 0x203a, 0x153, 0, 0x17e, 0x178].map((cp, i) => [cp, i + 128]));
|
|
6882
7132
|
/** @internal Called after scalar support succeeds when encoding a standard-font run. */
|
|
@@ -6936,21 +7186,22 @@ function selectFont(fonts, bold, italic) {
|
|
|
6936
7186
|
return { font, syntheticBold: !!font && bold && !exact, syntheticItalic: !!font && italic && !exact };
|
|
6937
7187
|
}
|
|
6938
7188
|
const _exports = Object.freeze({ standardCode: standardCode, resolveScalar: resolveScalar, validateFonts: validateFonts, selectFont: selectFont });
|
|
6939
|
-
_modules.set("
|
|
7189
|
+
_modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070", _exports);
|
|
6940
7190
|
return _exports;
|
|
6941
7191
|
})();
|
|
6942
7192
|
|
|
6943
|
-
const
|
|
7193
|
+
const _m61 = _modules.get("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7") ?? (() => {
|
|
6944
7194
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
6945
7195
|
|
|
6946
|
-
const { fontProgram } =
|
|
7196
|
+
const { fontProgram } = _m62;
|
|
6947
7197
|
|
|
6948
|
-
const { resolveScalar, selectFont, standardCode, validateFonts } =
|
|
7198
|
+
const { resolveScalar, selectFont, standardCode, validateFonts } = _m66;
|
|
6949
7199
|
|
|
6950
7200
|
const { pdfNumber, unicodeHex } = _m59;
|
|
6951
7201
|
|
|
6952
7202
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
6953
7203
|
|
|
7204
|
+
const standardHexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
|
|
6954
7205
|
class PdfFontResource {
|
|
6955
7206
|
index;
|
|
6956
7207
|
bold;
|
|
@@ -7013,7 +7264,7 @@ class PdfFontResource {
|
|
|
7013
7264
|
for (const char of text) {
|
|
7014
7265
|
const cp = char.codePointAt(0);
|
|
7015
7266
|
this.width(cp);
|
|
7016
|
-
hex +=
|
|
7267
|
+
hex += this.program ? this.mappings.get(cp).cid.toString(16).padStart(4, "0") : standardHexBytes[standardCode(cp)];
|
|
7017
7268
|
}
|
|
7018
7269
|
return "<" + hex + ">";
|
|
7019
7270
|
}
|
|
@@ -7148,11 +7399,11 @@ class PdfFontResources {
|
|
|
7148
7399
|
dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
|
|
7149
7400
|
}
|
|
7150
7401
|
const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
|
|
7151
|
-
_modules.set("
|
|
7402
|
+
_modules.set("7da602b40c346a3838e75963f9a3f10c95ac5ce08a7b0a23b9d96f8898a01db7", _exports);
|
|
7152
7403
|
return _exports;
|
|
7153
7404
|
})();
|
|
7154
7405
|
|
|
7155
|
-
const
|
|
7406
|
+
const _m69 = _modules.get("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27") ?? (() => {
|
|
7156
7407
|
const { OfficeIMOError } = _m2;
|
|
7157
7408
|
|
|
7158
7409
|
const { ExportCell, assertExportValue } = _m5;
|
|
@@ -7163,6 +7414,11 @@ const { isDate } = _m6;
|
|
|
7163
7414
|
|
|
7164
7415
|
const { defaultBooleanText } = _m51;
|
|
7165
7416
|
|
|
7417
|
+
/** @internal Charge displayed characters: tabs paint four spaces, while CR/LF only separate lines.
|
|
7418
|
+
* Raw text remains authoritative for input limits and layout. Skip normalization when no text ceiling observes it. */
|
|
7419
|
+
function pdfBudgetText(text, budget) {
|
|
7420
|
+
return budget.limits.maxTextCharacters === undefined ? text : text.replace(/[\t\r\n]/g, character => character === "\t" ? " " : "");
|
|
7421
|
+
}
|
|
7166
7422
|
function synchronousText(value, name) {
|
|
7167
7423
|
if (typeof value === "string")
|
|
7168
7424
|
return value;
|
|
@@ -7254,12 +7510,12 @@ function* wrapSteps(text, font, size, width, maxCharacters, maxLines, wrap) {
|
|
|
7254
7510
|
}
|
|
7255
7511
|
return lines;
|
|
7256
7512
|
}
|
|
7257
|
-
const _exports = Object.freeze({ synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
|
|
7258
|
-
_modules.set("
|
|
7513
|
+
const _exports = Object.freeze({ pdfBudgetText: pdfBudgetText, synchronousText: synchronousText, displayText: displayText, wrapText: wrapText, wrapTextCooperatively: wrapTextCooperatively });
|
|
7514
|
+
_modules.set("253db2c0eab1f298fda61fb40a5ddaacbf6ad12a7408ee3d8c12d27f88e7ca27", _exports);
|
|
7259
7515
|
return _exports;
|
|
7260
7516
|
})();
|
|
7261
7517
|
|
|
7262
|
-
const
|
|
7518
|
+
const _m71 = _modules.get("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6") ?? (() => {
|
|
7263
7519
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7264
7520
|
|
|
7265
7521
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
|
|
@@ -7468,11 +7724,11 @@ async function wrapShapedPdfText(captured, fonts, size, width, settings, wrap) {
|
|
|
7468
7724
|
return lines;
|
|
7469
7725
|
}
|
|
7470
7726
|
const _exports = Object.freeze({ wrapShapedPdfText: wrapShapedPdfText });
|
|
7471
|
-
_modules.set("
|
|
7727
|
+
_modules.set("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6", _exports);
|
|
7472
7728
|
return _exports;
|
|
7473
7729
|
})();
|
|
7474
7730
|
|
|
7475
|
-
const
|
|
7731
|
+
const _m70 = _modules.get("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47") ?? (() => {
|
|
7476
7732
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7477
7733
|
|
|
7478
7734
|
const { copyExportLink } = _m7;
|
|
@@ -7481,21 +7737,30 @@ const { checkAbort, pause, taskYieldDue } = _m4;
|
|
|
7481
7737
|
|
|
7482
7738
|
const { presentation, color } = _m55;
|
|
7483
7739
|
|
|
7484
|
-
const { wrapShapedPdfText } =
|
|
7740
|
+
const { wrapShapedPdfText } = _m71;
|
|
7741
|
+
|
|
7742
|
+
const { PdfFont } = _m62;
|
|
7485
7743
|
|
|
7486
|
-
const {
|
|
7744
|
+
const { pdfBudgetText } = _m69;
|
|
7487
7745
|
|
|
7488
|
-
/** @internal A run list is a PDF presentation value, never an alternate shared table value model. */
|
|
7489
|
-
function capturePdfText(value, base, settings, fonts, countEmpty = true) {
|
|
7490
|
-
|
|
7746
|
+
/** @internal Callers supply an owned, validated, frozen base presentation. A run list is a PDF presentation value, never an alternate shared table value model. */
|
|
7747
|
+
function capturePdfText(value, base, settings, fonts, countEmpty = true, reserveBudget = true) {
|
|
7748
|
+
if (typeof value === "string") {
|
|
7749
|
+
if (value.length > settings.limits.maxCellCharacters)
|
|
7750
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
|
|
7751
|
+
if (reserveBudget && (value.length || countEmpty))
|
|
7752
|
+
settings.budget.reserve(1, pdfBudgetText(value, settings.budget).length);
|
|
7753
|
+
return Object.freeze({ text: value, runs: Object.freeze([Object.freeze({ text: value, style: base })]) });
|
|
7754
|
+
}
|
|
7755
|
+
const input = value;
|
|
7491
7756
|
if (!Array.isArray(input)) {
|
|
7492
7757
|
if (input && typeof input.then === "function")
|
|
7493
7758
|
void Promise.resolve(input).catch(() => { });
|
|
7494
7759
|
throw new TypeError("PDF text must be a string or a synchronous array of text runs.");
|
|
7495
7760
|
}
|
|
7496
|
-
if (
|
|
7761
|
+
if (input.length > settings.limits.maxTextRuns)
|
|
7497
7762
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxTextRuns exceeded.");
|
|
7498
|
-
let characters = 0;
|
|
7763
|
+
let characters = 0, budgetCharacters = 0;
|
|
7499
7764
|
const runs = [];
|
|
7500
7765
|
for (const run of input) {
|
|
7501
7766
|
if (!run || typeof run !== "object" || Object.keys(run).some(key => !["text", "bold", "italic", "color", "link", "font"].includes(key)))
|
|
@@ -7511,14 +7776,16 @@ function capturePdfText(value, base, settings, fonts, countEmpty = true) {
|
|
|
7511
7776
|
characters += text.length;
|
|
7512
7777
|
if (characters > settings.limits.maxCellCharacters)
|
|
7513
7778
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxCellCharacters exceeded.");
|
|
7779
|
+
if (reserveBudget)
|
|
7780
|
+
budgetCharacters += pdfBudgetText(text, settings.budget).length;
|
|
7514
7781
|
const style = presentation({ ...base, ...(bold === undefined ? {} : { bold }), ...(italic === undefined ? {} : { italic }), ...(color === undefined ? {} : { color }) });
|
|
7515
7782
|
if (settings.options.tagged && link !== undefined && text.length && !text.trim())
|
|
7516
7783
|
throw new TypeError("Tagged PDF inline links require nonempty displayed text.");
|
|
7517
7784
|
runs.push(Object.freeze({ text, style, ...(font === undefined ? {} : { font }), ...(link === undefined ? {} : { link: copyExportLink(link) }) }));
|
|
7518
7785
|
}
|
|
7519
7786
|
// Reserve before allocating a joined rich-text value or retaining it in a kept paragraph chain.
|
|
7520
|
-
if (characters || countEmpty)
|
|
7521
|
-
settings.budget.reserve(1,
|
|
7787
|
+
if (reserveBudget && (characters || countEmpty))
|
|
7788
|
+
settings.budget.reserve(1, budgetCharacters);
|
|
7522
7789
|
return Object.freeze({ text: runs.map(run => run.text).join(""), runs: Object.freeze(runs) });
|
|
7523
7790
|
}
|
|
7524
7791
|
/** @internal Greedy wrapping over the continuous text stream, preserving run emphasis and URI geometry. */
|
|
@@ -7527,8 +7794,39 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
7527
7794
|
return wrapShapedPdfText(captured, fonts, size, width, settings, wrap);
|
|
7528
7795
|
const { signal } = settings.options, { text, runs } = captured;
|
|
7529
7796
|
checkAbort(signal);
|
|
7530
|
-
|
|
7531
|
-
const
|
|
7797
|
+
// Keep font-selection order while deferring a single-run face array until wrapping needs it.
|
|
7798
|
+
const single = runs.length === 1 ? runs[0] : undefined;
|
|
7799
|
+
const singleFace = single && fonts.select(single.style.bold, single.style.italic, single.font);
|
|
7800
|
+
const selectedFaces = singleFace ? undefined : runs.map(run => fonts.select(run.style.bold, run.style.italic, run.font));
|
|
7801
|
+
const fallback = fonts.select();
|
|
7802
|
+
// Short fitting runs need no per-character layout arrays. Longer text keeps the existing
|
|
7803
|
+
// cooperative checkpoints; controls or the first overflowing advance use the general path.
|
|
7804
|
+
if (single && text.length > 0 && text.length < 4096) {
|
|
7805
|
+
const run = single, font = singleFace;
|
|
7806
|
+
let widthSoFar = 0, fits = true;
|
|
7807
|
+
for (let offset = 0; offset < text.length;) {
|
|
7808
|
+
const scalar = text.codePointAt(offset);
|
|
7809
|
+
if (scalar === 9 || scalar === 10 || scalar === 13) {
|
|
7810
|
+
fits = false;
|
|
7811
|
+
break;
|
|
7812
|
+
}
|
|
7813
|
+
const advance = font.width(scalar) * size / 1000;
|
|
7814
|
+
if (advance > width + .001 || widthSoFar + advance > width + .001) {
|
|
7815
|
+
fits = false;
|
|
7816
|
+
break;
|
|
7817
|
+
}
|
|
7818
|
+
widthSoFar += advance;
|
|
7819
|
+
offset += scalar > 0xffff ? 2 : 1;
|
|
7820
|
+
}
|
|
7821
|
+
if (fits) {
|
|
7822
|
+
if (settings.limits.maxRowLines < 1)
|
|
7823
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxRowLines exceeded.");
|
|
7824
|
+
return [{ text, width: widthSoFar, segments: [{ text, width: widthSoFar, font,
|
|
7825
|
+
...(run.style.color === undefined ? {} : { color: run.style.color }), ...(run.link ? { link: run.link } : {}) }],
|
|
7826
|
+
lineHeight: font.lineHeight(size), ascent: Math.max(0, (font.program?.ascent ?? 800) * size / 1000) }];
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
const faces = selectedFaces ?? [singleFace], lines = [];
|
|
7532
7830
|
let chars = [], advances = [], owners = [], measured = 0, breakAt = -1;
|
|
7533
7831
|
let runIndex = 0, runEnd = runs[0]?.text.length ?? 0, scanned = 0;
|
|
7534
7832
|
const emit = (count) => {
|
|
@@ -7622,23 +7920,21 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
7622
7920
|
return lines;
|
|
7623
7921
|
}
|
|
7624
7922
|
const _exports = Object.freeze({ capturePdfText: capturePdfText, wrapPdfText: wrapPdfText });
|
|
7625
|
-
_modules.set("
|
|
7923
|
+
_modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47", _exports);
|
|
7626
7924
|
return _exports;
|
|
7627
7925
|
})();
|
|
7628
7926
|
|
|
7629
|
-
const
|
|
7927
|
+
const _m72 = _modules.get("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96") ?? (() => {
|
|
7630
7928
|
const { OfficeIMOError } = _m2;
|
|
7631
7929
|
|
|
7632
|
-
const { wrapPdfText } =
|
|
7930
|
+
const { wrapPdfText } = _m70;
|
|
7633
7931
|
|
|
7634
7932
|
/** Plan without opening a source. Exact column widths never shrink in band mode. */
|
|
7635
7933
|
function planTableBands(widths, settings) {
|
|
7636
7934
|
const policy = settings.options.wideTable;
|
|
7637
7935
|
if (typeof policy !== "object")
|
|
7638
7936
|
return undefined;
|
|
7639
|
-
const available = settings.page.width - settings.margins.left - settings.margins.right, repeats =
|
|
7640
|
-
if (repeats.some(index => index >= widths.length))
|
|
7641
|
-
throw new RangeError("repeatColumns index exceeds the declared columns.");
|
|
7937
|
+
const available = settings.page.width - settings.margins.left - settings.margins.right, repeats = settings.repeatedColumns;
|
|
7642
7938
|
const repeated = new Set(repeats), rest = widths.map((_, index) => index).filter(index => !repeated.has(index));
|
|
7643
7939
|
const prefix = repeats.reduce((sum, index) => sum + widths[index], 0);
|
|
7644
7940
|
if (prefix > available + .001)
|
|
@@ -7715,11 +8011,11 @@ function alignBandBlocks(bands, settings) {
|
|
|
7715
8011
|
cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
|
|
7716
8012
|
}
|
|
7717
8013
|
const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
|
|
7718
|
-
_modules.set("
|
|
8014
|
+
_modules.set("9a88773878eacc51df9f05bb5ee90cc2b683b083ebea8fb54375092301388e96", _exports);
|
|
7719
8015
|
return _exports;
|
|
7720
8016
|
})();
|
|
7721
8017
|
|
|
7722
|
-
const
|
|
8018
|
+
const _m68 = _modules.get("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305") ?? (() => {
|
|
7723
8019
|
const { ExportCell } = _m5;
|
|
7724
8020
|
|
|
7725
8021
|
const { copyExportLink } = _m7;
|
|
@@ -7730,11 +8026,11 @@ const { createTotals } = _m12;
|
|
|
7730
8026
|
|
|
7731
8027
|
const { presentation, positive } = _m55;
|
|
7732
8028
|
|
|
7733
|
-
const { displayText } =
|
|
8029
|
+
const { displayText, pdfBudgetText } = _m69;
|
|
7734
8030
|
|
|
7735
|
-
const { capturePdfText, wrapPdfText } =
|
|
8031
|
+
const { capturePdfText, wrapPdfText } = _m70;
|
|
7736
8032
|
|
|
7737
|
-
const { planTableBands, projectBandRows, alignBandBlocks } =
|
|
8033
|
+
const { planTableBands, projectBandRows, alignBandBlocks } = _m72;
|
|
7738
8034
|
|
|
7739
8035
|
class PdfTableLayout {
|
|
7740
8036
|
settings;
|
|
@@ -7747,11 +8043,13 @@ class PdfTableLayout {
|
|
|
7747
8043
|
totals;
|
|
7748
8044
|
repeatedColumns;
|
|
7749
8045
|
structuredBandRows = new WeakMap();
|
|
8046
|
+
/** Plain/alternate ordinary-data defaults, validated only when a column first needs them. */
|
|
8047
|
+
dataPresentations = [];
|
|
7750
8048
|
constructor(settings, fonts) {
|
|
7751
8049
|
this.settings = settings;
|
|
7752
8050
|
this.fonts = fonts;
|
|
7753
8051
|
const { options, padding, fontSize, page, margins } = settings, columns = options.columns, available = page.width - margins.left - margins.right;
|
|
7754
|
-
this.repeatedColumns = new Set(
|
|
8052
|
+
this.repeatedColumns = new Set(settings.repeatedColumns);
|
|
7755
8053
|
let digit;
|
|
7756
8054
|
if (options.columnWidths && options.columnWidths.length !== columns.length)
|
|
7757
8055
|
throw new RangeError("columnWidths must declare one point width per column.");
|
|
@@ -7792,13 +8090,22 @@ class PdfTableLayout {
|
|
|
7792
8090
|
this.headings = headings;
|
|
7793
8091
|
this.totals = createTotals(columns, options.footer?.totals);
|
|
7794
8092
|
}
|
|
7795
|
-
async cell(value, first, span, row, style) {
|
|
8093
|
+
async cell(value, first, span, row, style, ordinaryData = false) {
|
|
7796
8094
|
const { options, padding, fontSize, budget } = this.settings, column = options.columns[first];
|
|
7797
8095
|
const own = value instanceof ExportCell ? value.presentation : undefined;
|
|
7798
8096
|
const link = value instanceof ExportCell && value.link ? copyExportLink(value.link) : undefined;
|
|
7799
|
-
const
|
|
7800
|
-
|
|
7801
|
-
|
|
8097
|
+
const alternate = ordinaryData && row % 2 && options.alternateRowColor ? options.alternateRowColor : undefined;
|
|
8098
|
+
const slot = first * 2 + (alternate ? 1 : 0), reusable = ordinaryData && own === undefined;
|
|
8099
|
+
let combined = reusable ? this.dataPresentations[slot] : undefined;
|
|
8100
|
+
if (!combined) {
|
|
8101
|
+
const rowStyle = ordinaryData ? alternate ? { background: alternate } : {} : style;
|
|
8102
|
+
combined = presentation({ ...(column.alignment === undefined ? {} : { alignment: column.alignment }),
|
|
8103
|
+
...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }), ...rowStyle, ...own });
|
|
8104
|
+
// Validate only the first reached default; an authored cell may override invalid column defaults.
|
|
8105
|
+
if (reusable)
|
|
8106
|
+
this.dataPresentations[slot] = combined;
|
|
8107
|
+
}
|
|
8108
|
+
const font = this.fonts.select(combined.bold, combined.italic), width = span === 1 ? this.widths[first] : this.widths.slice(first, first + span).reduce((n, w) => n + w, 0);
|
|
7802
8109
|
const context = { rowIndex: row, columnIndex: first, column }, raw = value instanceof ExportCell ? value.value : value;
|
|
7803
8110
|
let text;
|
|
7804
8111
|
if (options.formatRuns && row >= 0 && !(value instanceof ExportCell && value.text !== undefined)) {
|
|
@@ -7817,10 +8124,11 @@ class PdfTableLayout {
|
|
|
7817
8124
|
throw new TypeError("Tagged PDF cell links require nonempty displayed text.");
|
|
7818
8125
|
if (link && captured.runs.some(run => run.link))
|
|
7819
8126
|
throw new TypeError("A PDF cell link cannot be combined with inline run links.");
|
|
8127
|
+
const budgetText = pdfBudgetText(captured.text, budget);
|
|
7820
8128
|
if (this.bands)
|
|
7821
|
-
budget.release(1,
|
|
8129
|
+
budget.release(1, budgetText.length);
|
|
7822
8130
|
else
|
|
7823
|
-
budget.cell(
|
|
8131
|
+
budget.cell(budgetText, budgetText.length);
|
|
7824
8132
|
const lines = await wrapPdfText(captured, this.fonts, fontSize, width - padding * 2, this.settings, combined.wrapText !== false);
|
|
7825
8133
|
return { first, span, width, font, style: combined, lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), font.lineHeight(fontSize)),
|
|
7826
8134
|
...(link ? { link } : {}), ...(this.bands ? { captured } : {}),
|
|
@@ -7919,8 +8227,8 @@ class PdfTableLayout {
|
|
|
7919
8227
|
const value = values[column], raw = value instanceof ExportCell ? value.value : value;
|
|
7920
8228
|
if (!footer)
|
|
7921
8229
|
this.totals[column].accept(raw);
|
|
7922
|
-
const
|
|
7923
|
-
cells.push(
|
|
8230
|
+
const cell = await this.cell(value, column, 1, index, footer ? options.footerPresentation ?? {} : undefined, !footer);
|
|
8231
|
+
cells.push(!footer && options.columns[column].rowHeader ? { ...cell, rowHeader: true } : cell);
|
|
7924
8232
|
}
|
|
7925
8233
|
return this.row(cells);
|
|
7926
8234
|
}
|
|
@@ -7934,11 +8242,11 @@ class PdfTableLayout {
|
|
|
7934
8242
|
}
|
|
7935
8243
|
}
|
|
7936
8244
|
const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
|
|
7937
|
-
_modules.set("
|
|
8245
|
+
_modules.set("07d2da8d8b93f12f172a48b97c1807e485555cf608e2eaa5b7610aa91d4a5305", _exports);
|
|
7938
8246
|
return _exports;
|
|
7939
8247
|
})();
|
|
7940
8248
|
|
|
7941
|
-
const
|
|
8249
|
+
const _m74 = _modules.get("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4") ?? (() => {
|
|
7942
8250
|
const { OfficeIMOError } = _m2;
|
|
7943
8251
|
|
|
7944
8252
|
const { checkAbort } = _m4;
|
|
@@ -7982,7 +8290,7 @@ class PdfTableBandFlow {
|
|
|
7982
8290
|
await this.flush();
|
|
7983
8291
|
}
|
|
7984
8292
|
async row(row, allowFirstFragment = false) {
|
|
7985
|
-
const { padding, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
|
|
8293
|
+
const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = this.layout.minimumRowHeight(row);
|
|
7986
8294
|
if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
|
|
7987
8295
|
throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
|
|
7988
8296
|
// Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
|
|
@@ -8008,16 +8316,29 @@ class PdfTableBandFlow {
|
|
|
8008
8316
|
const lines = Math.min(row.lines - first, Math.floor((this.capacity - this.height - padding * 2 + .001) / row.lineHeight));
|
|
8009
8317
|
if (lines < 1)
|
|
8010
8318
|
throw new RangeError("PDF page cannot fit a table line below horizontal band headings.");
|
|
8011
|
-
|
|
8319
|
+
// Reserve one shared logical fragment, but paint only each band's visible cell geometry.
|
|
8320
|
+
const reservedLines = Math.max(lines, minimumLines), height = reservedLines * row.lineHeight + padding * 2;
|
|
8012
8321
|
const projected = await this.layout.bandRows([row]);
|
|
8013
|
-
const
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8322
|
+
const exhaustedBands = [];
|
|
8323
|
+
const fragments = projected.map((rows, index) => {
|
|
8324
|
+
let remaining = false;
|
|
8325
|
+
const cells = rows[0].cells.map(cell => {
|
|
8326
|
+
const source = this.layout.bands[index].columns[cell.first];
|
|
8327
|
+
const repeated = this.layout.repeatedColumn(source), visible = repeated ? cell.lines : cell.lines.slice(first, first + lines);
|
|
8328
|
+
if (!repeated && (visible.length > 0 || cell.link !== undefined))
|
|
8329
|
+
remaining = true;
|
|
8330
|
+
const { height: _height, ...plain } = cell;
|
|
8331
|
+
return { ...plain, lines: visible,
|
|
8332
|
+
lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
|
|
8333
|
+
...(first > 0 && repeated ? { semanticArtifact: true } : {}) };
|
|
8334
|
+
});
|
|
8335
|
+
const fragmentLines = Math.max(1, ...cells.map(cell => cell.lines.length));
|
|
8336
|
+
const lineHeight = Math.max(this.layout.lineHeight, ...cells.filter(cell => cell.lines.length > 0).map(cell => cell.lineHeight));
|
|
8337
|
+
// Never omit an initial/new row, a structured block, or a nonrepeated link obligation.
|
|
8338
|
+
exhaustedBands.push(first > 0 && !remaining);
|
|
8339
|
+
return [{ ...rows[0], cells, lines: fragmentLines, lineHeight, height: fragmentLines * lineHeight + padding * 2 }];
|
|
8340
|
+
});
|
|
8341
|
+
await this.accept({ rows: fragments, height, count: 1, completed: first + lines >= row.lines ? [row] : [], exhaustedBands });
|
|
8021
8342
|
first += lines;
|
|
8022
8343
|
if (first < row.lines)
|
|
8023
8344
|
await this.flush();
|
|
@@ -8029,7 +8350,7 @@ class PdfTableBandFlow {
|
|
|
8029
8350
|
throw new OfficeIMOError("RESOURCE_LIMIT", "A structured PDF block exceeds maxTableWindowRows.");
|
|
8030
8351
|
for (const row of rows)
|
|
8031
8352
|
await this.painter.prepareRow?.(row);
|
|
8032
|
-
await this.accept({ rows: projected, height, count: rows.length, completed: rows });
|
|
8353
|
+
await this.accept({ rows: projected, height, count: rows.length, completed: rows, exhaustedBands: projected.map(() => false) });
|
|
8033
8354
|
}
|
|
8034
8355
|
async keptRows(rows, allowFirstFragment = false) {
|
|
8035
8356
|
const height = rows.reduce((sum, row) => sum + row.height, 0), fits = height <= this.painter.continuationCapacity + .001;
|
|
@@ -8043,6 +8364,8 @@ class PdfTableBandFlow {
|
|
|
8043
8364
|
return;
|
|
8044
8365
|
for (let band = 0; band < this.layout.bands.length; band++) {
|
|
8045
8366
|
checkAbort(this.layout.settings.options.signal);
|
|
8367
|
+
if (!this.firstWindow && this.entries.length > 0 && this.entries.every(entry => entry.exhaustedBands[band]))
|
|
8368
|
+
continue;
|
|
8046
8369
|
await this.painter.paint(band, this.headings[band], this.entries.flatMap(entry => entry.rows[band]), this.firstWindow ? this.caption : this.continuation, this.firstWindow, band === 0);
|
|
8047
8370
|
}
|
|
8048
8371
|
for (const entry of this.entries)
|
|
@@ -8056,11 +8379,11 @@ class PdfTableBandFlow {
|
|
|
8056
8379
|
}
|
|
8057
8380
|
}
|
|
8058
8381
|
const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
|
|
8059
|
-
_modules.set("
|
|
8382
|
+
_modules.set("67ad5f4adbd6bc0dddafe5cf82638d46d150237f4ff0bee15c0ace652d5095f4", _exports);
|
|
8060
8383
|
return _exports;
|
|
8061
8384
|
})();
|
|
8062
8385
|
|
|
8063
|
-
const
|
|
8386
|
+
const _m75 = _modules.get("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff") ?? (() => {
|
|
8064
8387
|
/** @internal Source-cell identities survive page fragments and horizontal band projections.
|
|
8065
8388
|
* Only column headers and still-owned row objects remain reachable from this table owner. */
|
|
8066
8389
|
class PdfTableStructure {
|
|
@@ -8070,6 +8393,8 @@ class PdfTableStructure {
|
|
|
8070
8393
|
cells = new WeakMap();
|
|
8071
8394
|
rows = new WeakMap();
|
|
8072
8395
|
columnHeaders = [];
|
|
8396
|
+
/** Ordinary cells without row headers share immutable dictionary references, bounded by column count. */
|
|
8397
|
+
ordinaryAttributes = [];
|
|
8073
8398
|
headerCount = 0;
|
|
8074
8399
|
headersPrepared = false;
|
|
8075
8400
|
constructor(structure, table, headers) {
|
|
@@ -8110,19 +8435,30 @@ class PdfTableStructure {
|
|
|
8110
8435
|
return row.cells.map(cell => this.cells.get(cell));
|
|
8111
8436
|
const rowId = this.structure.element("TR", parent);
|
|
8112
8437
|
this.rows.set(row, rowId);
|
|
8113
|
-
const
|
|
8114
|
-
|
|
8115
|
-
//
|
|
8438
|
+
const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
|
|
8439
|
+
// Allocate in source order, then resolve every row header before associating even earlier data cells.
|
|
8440
|
+
// Generated summary labels override detail roles so numeric subtotal cells never become row headers.
|
|
8441
|
+
const ids = row.cells.map((cell, index) => {
|
|
8442
|
+
const id = this.structure.element(headers[index] ? "TH" : "TD", rowId);
|
|
8443
|
+
this.cells.set(cell, id);
|
|
8444
|
+
return id;
|
|
8445
|
+
});
|
|
8446
|
+
const rowHeaders = [];
|
|
8447
|
+
for (let index = 0; index < ids.length; index++)
|
|
8448
|
+
if (headers[index])
|
|
8449
|
+
rowHeaders.push(await this.structure.identifier(ids[index]));
|
|
8116
8450
|
for (let index = 0; index < row.cells.length; index++) {
|
|
8117
|
-
const cell = row.cells[index]
|
|
8451
|
+
const cell = row.cells[index];
|
|
8452
|
+
if (!rowHeaders.length && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
|
|
8453
|
+
const attributes = this.ordinaryAttributes[cell.first] ??=
|
|
8454
|
+
await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
|
|
8455
|
+
this.structure.setAttributes(ids[index], attributes);
|
|
8456
|
+
continue;
|
|
8457
|
+
}
|
|
8118
8458
|
const associations = this.associations(cell);
|
|
8119
|
-
if (
|
|
8120
|
-
associations.push(
|
|
8121
|
-
|
|
8122
|
-
this.cells.set(cell, id);
|
|
8123
|
-
ids.push(id);
|
|
8124
|
-
if (isRowHeader)
|
|
8125
|
-
rowHeaderIdentifier = await this.structure.identifier(id);
|
|
8459
|
+
if (!headers[index])
|
|
8460
|
+
associations.push(...rowHeaders);
|
|
8461
|
+
this.structure.setAttributes(ids[index], this.attributes(cell, associations, headers[index] ? "Row" : undefined));
|
|
8126
8462
|
}
|
|
8127
8463
|
return ids;
|
|
8128
8464
|
}
|
|
@@ -8148,17 +8484,20 @@ class PdfTableStructure {
|
|
|
8148
8484
|
return [...headers].sort((left, right) => left.order - right.order).map(header => header.identifier);
|
|
8149
8485
|
}
|
|
8150
8486
|
attributes(cell, headers, scope) {
|
|
8151
|
-
return " /A
|
|
8487
|
+
return " /A " + this.attributeDictionary(cell, headers, scope);
|
|
8488
|
+
}
|
|
8489
|
+
attributeDictionary(cell, headers, scope) {
|
|
8490
|
+
return "<< /O /Table" + (scope === undefined ? "" : " /Scope /" + scope) +
|
|
8152
8491
|
(cell.span > 1 ? " /ColSpan " + cell.span : "") + ((cell.rowSpan ?? 1) > 1 ? " /RowSpan " + cell.rowSpan : "") +
|
|
8153
8492
|
(headers.length ? " /Headers [" + headers.map(id => "(" + id + ")").join(" ") + "]" : "") + " >>";
|
|
8154
8493
|
}
|
|
8155
8494
|
}
|
|
8156
8495
|
const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
|
|
8157
|
-
_modules.set("
|
|
8496
|
+
_modules.set("b52424ed74721dce3a2621456888fe1c6af0490627063e56f690df9abcb1dfff", _exports);
|
|
8158
8497
|
return _exports;
|
|
8159
8498
|
})();
|
|
8160
8499
|
|
|
8161
|
-
const
|
|
8500
|
+
const _m76 = _modules.get("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170") ?? (() => {
|
|
8162
8501
|
const { OfficeIMOError } = _m2;
|
|
8163
8502
|
|
|
8164
8503
|
const { pdfNumber, unicodeHex } = _m59;
|
|
@@ -8200,11 +8539,11 @@ function linkAnnotation(link, x, bottom, width, height, maxBytes, structParent,
|
|
|
8200
8539
|
(link.tooltip === undefined ? "" : " /Contents <feff" + unicodeHex(link.tooltip) + ">") + " >>";
|
|
8201
8540
|
}
|
|
8202
8541
|
const _exports = Object.freeze({ linkAnnotation: linkAnnotation });
|
|
8203
|
-
_modules.set("
|
|
8542
|
+
_modules.set("09c712096a1028af340e275d5a273e870546413797e71ed709657ad0482ea170", _exports);
|
|
8204
8543
|
return _exports;
|
|
8205
8544
|
})();
|
|
8206
8545
|
|
|
8207
|
-
const
|
|
8546
|
+
const _m77 = _modules.get("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f") ?? (() => {
|
|
8208
8547
|
const { OfficeIMOError } = _m2;
|
|
8209
8548
|
|
|
8210
8549
|
const { unicodeHex } = _m59;
|
|
@@ -8249,11 +8588,11 @@ function captureSection(block, settings) {
|
|
|
8249
8588
|
...(pageNumbers === undefined ? {} : { pageNumbers }) });
|
|
8250
8589
|
}
|
|
8251
8590
|
const _exports = Object.freeze({ captureBookmark: captureBookmark, captureSection: captureSection });
|
|
8252
|
-
_modules.set("
|
|
8591
|
+
_modules.set("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f", _exports);
|
|
8253
8592
|
return _exports;
|
|
8254
8593
|
})();
|
|
8255
8594
|
|
|
8256
|
-
const
|
|
8595
|
+
const _m78 = _modules.get("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052") ?? (() => {
|
|
8257
8596
|
const { settings } = _m55;
|
|
8258
8597
|
|
|
8259
8598
|
/** @internal Every section derives from captured document defaults, never the preceding section. */
|
|
@@ -8268,11 +8607,11 @@ function sectionSettings(base, section) {
|
|
|
8268
8607
|
return { ...base, page: derived.page, margins: derived.margins, options };
|
|
8269
8608
|
}
|
|
8270
8609
|
const _exports = Object.freeze({ sectionSettings: sectionSettings });
|
|
8271
|
-
_modules.set("
|
|
8610
|
+
_modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052", _exports);
|
|
8272
8611
|
return _exports;
|
|
8273
8612
|
})();
|
|
8274
8613
|
|
|
8275
|
-
const
|
|
8614
|
+
const _m73 = _modules.get("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410") ?? (() => {
|
|
8276
8615
|
const { OfficeIMOError } = _m2;
|
|
8277
8616
|
|
|
8278
8617
|
const { checkAbort } = _m4;
|
|
@@ -8281,19 +8620,19 @@ const { pdfNumber } = _m59;
|
|
|
8281
8620
|
|
|
8282
8621
|
const { color } = _m55;
|
|
8283
8622
|
|
|
8284
|
-
const { PdfTableBandFlow } =
|
|
8623
|
+
const { PdfTableBandFlow } = _m74;
|
|
8285
8624
|
|
|
8286
|
-
const { PdfTableStructure } =
|
|
8625
|
+
const { PdfTableStructure } = _m75;
|
|
8287
8626
|
|
|
8288
|
-
const { wrapText, wrapTextCooperatively, synchronousText } =
|
|
8627
|
+
const { wrapText, wrapTextCooperatively, synchronousText, pdfBudgetText } = _m69;
|
|
8289
8628
|
|
|
8290
|
-
const { linkAnnotation } =
|
|
8629
|
+
const { linkAnnotation } = _m76;
|
|
8291
8630
|
|
|
8292
8631
|
const { unicodeHex } = _m59;
|
|
8293
8632
|
|
|
8294
|
-
const { captureSection, captureBookmark } =
|
|
8633
|
+
const { captureSection, captureBookmark } = _m77;
|
|
8295
8634
|
|
|
8296
|
-
const { sectionSettings } =
|
|
8635
|
+
const { sectionSettings } = _m78;
|
|
8297
8636
|
|
|
8298
8637
|
/** @internal One page of drawing commands and O(page count) references, never the complete report body. */
|
|
8299
8638
|
class PdfPages {
|
|
@@ -8431,8 +8770,9 @@ class PdfPages {
|
|
|
8431
8770
|
const lineActualText = !this.structure && line.actualText !== undefined && line.actualText.length > 0;
|
|
8432
8771
|
if (lineActualText)
|
|
8433
8772
|
this.add("/Span << /ActualText <FEFF" + unicodeHex(line.actualText) + "> >> BDC\n");
|
|
8434
|
-
|
|
8773
|
+
let marks;
|
|
8435
8774
|
if (line.actualText !== undefined && this.structure && element !== undefined) {
|
|
8775
|
+
marks = new Map();
|
|
8436
8776
|
// Allocate MCIDs/Link children in logical order, then paint the independently positioned visual order.
|
|
8437
8777
|
for (const segment of [...line.segments].sort((a, b) => (a.logicalStart ?? 0) - (b.logicalStart ?? 0))) {
|
|
8438
8778
|
const owner = segment.link ? this.structure.link(element, segment.link) : element;
|
|
@@ -8440,7 +8780,7 @@ class PdfPages {
|
|
|
8440
8780
|
}
|
|
8441
8781
|
}
|
|
8442
8782
|
for (const segment of line.segments) {
|
|
8443
|
-
const registered = marks
|
|
8783
|
+
const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
|
|
8444
8784
|
if (segment.glyphs) {
|
|
8445
8785
|
const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
|
|
8446
8786
|
let cursor = x, command = "q " + this.rgb(segment.color ?? "111827") + " rg " + this.rgb(segment.color ?? "111827") + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
|
|
@@ -8474,7 +8814,7 @@ class PdfPages {
|
|
|
8474
8814
|
decoration(text, x, y, width) {
|
|
8475
8815
|
if (!text)
|
|
8476
8816
|
return;
|
|
8477
|
-
this.settings.budget.cell(text);
|
|
8817
|
+
this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
|
|
8478
8818
|
const font = this.fonts.select(), lines = wrapText(text, font, this.settings.fontSize, width, this.settings.limits.maxCellCharacters, 1, false);
|
|
8479
8819
|
this.text(lines[0].text, font, this.settings.fontSize, x, y);
|
|
8480
8820
|
}
|
|
@@ -8535,9 +8875,7 @@ class PdfPages {
|
|
|
8535
8875
|
}
|
|
8536
8876
|
const headers = preparedHeadings ?? (tableHeadings && this.layout ? this.activeHeadings ??= await this.layout.headers() : []), headerHeight = headers.reduce((n, h) => n + h.height, 0), continuation = tableHeadings && this.layout ? this.continuationCaption : undefined;
|
|
8537
8877
|
if (continuation?.lines.length) {
|
|
8538
|
-
if (this.continuationCaptionPaints++
|
|
8539
|
-
this.settings.budget.cell(continuation.text.text);
|
|
8540
|
-
else
|
|
8878
|
+
if (this.continuationCaptionPaints++ === 0)
|
|
8541
8879
|
this.tableCaptionOwner = this.captionAnnotations(continuation, this.tableCaptionOwner);
|
|
8542
8880
|
await this.paragraphs([continuation], headerHeight + lineHeight + this.settings.padding * 2, true, { artifact: true, ...(this.tableCaptionOwner === undefined ? {} : { annotationParent: this.tableCaptionOwner }) });
|
|
8543
8881
|
}
|
|
@@ -8655,7 +8993,7 @@ class PdfPages {
|
|
|
8655
8993
|
async paragraph(text, style = {}, size = this.settings.fontSize, paginate = true, headingLevel) {
|
|
8656
8994
|
await this.ensureStarted();
|
|
8657
8995
|
const { margins, page, limits } = this.settings, font = this.fonts.select(style.bold, style.italic), lineHeight = font.lineHeight(size);
|
|
8658
|
-
this.settings.budget.cell(text);
|
|
8996
|
+
this.settings.budget.cell(pdfBudgetText(text, this.settings.budget));
|
|
8659
8997
|
const lines = await wrapTextCooperatively(text, font, size, page.width - margins.left - margins.right, limits.maxCellCharacters, limits.maxRowLines, true, this.settings.options.signal);
|
|
8660
8998
|
if (lineHeight > page.height - margins.top - margins.bottom)
|
|
8661
8999
|
throw new RangeError("PDF page cannot fit a paragraph line at the selected font metrics.");
|
|
@@ -8698,6 +9036,8 @@ class PdfPages {
|
|
|
8698
9036
|
if (keepTogether && visible.length)
|
|
8699
9037
|
await this.reserveSpace(visible.reduce((height, paragraph) => height + paragraph.height, 0) + reservations.at(-1), "Kept PDF paragraph group");
|
|
8700
9038
|
for (const [index, paragraph] of visible.entries()) {
|
|
9039
|
+
if (paragraph.budgetOnPaint)
|
|
9040
|
+
this.settings.budget.cell(pdfBudgetText(paragraph.text.text, this.settings.budget));
|
|
8701
9041
|
if (paragraph.keepTogether || paragraph.keepWithNext)
|
|
8702
9042
|
await this.reserveSpace(paragraph.height + reservations[index], "Kept PDF paragraph chain");
|
|
8703
9043
|
const { margins, page } = this.settings;
|
|
@@ -8750,10 +9090,11 @@ class PdfPages {
|
|
|
8750
9090
|
/** The generated summary label is a row heading; no localized text/style inference is used. */
|
|
8751
9091
|
summary(row) { this.summaryRows.add(row); }
|
|
8752
9092
|
/** Begin an independent table on the current page, retaining its headings on continuation pages.
|
|
8753
|
-
* Group context uses captionArtifact: it stays visually complete without duplicating logical headings.
|
|
8754
|
-
|
|
9093
|
+
* Group context uses captionArtifact: it stays visually complete without duplicating logical headings.
|
|
9094
|
+
* An already-painted opening path only suppresses its artifact caption on that existing page. */
|
|
9095
|
+
async beginTable(layout, preparedHeadings, minimumDataHeight = layout.lineHeight + this.settings.padding * 2, caption, continuationCaption, headingsOnNewPageOnly = false, captionArtifact = false, openingContextAlreadyPainted = false) {
|
|
8755
9096
|
if (layout.bands)
|
|
8756
|
-
return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact);
|
|
9097
|
+
return this.beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuationCaption, captionArtifact, openingContextAlreadyPainted);
|
|
8757
9098
|
await this.ensureStarted();
|
|
8758
9099
|
this.layout = layout;
|
|
8759
9100
|
this.paintedHeaderCells = new WeakSet();
|
|
@@ -8767,7 +9108,7 @@ class PdfPages {
|
|
|
8767
9108
|
// Its own headings remain available when it moves or splits onto a fresh page.
|
|
8768
9109
|
const initialHeadings = headingsOnNewPageOnly && this.bodyAdded && !this.structure ? [] : headings;
|
|
8769
9110
|
const height = initialHeadings.reduce((n, row) => n + row.height, 0);
|
|
8770
|
-
if (caption) {
|
|
9111
|
+
if (caption && !(captionArtifact && openingContextAlreadyPainted)) {
|
|
8771
9112
|
await this.reserveSpace(caption.height + height + minimumDataHeight, "Kept PDF table caption and first data fragment");
|
|
8772
9113
|
this.tableCaptionOwner = captionArtifact ? this.captionAnnotations(caption)
|
|
8773
9114
|
: caption.lines.length ? this.structure?.element("Caption", this.tableElement) : undefined;
|
|
@@ -8789,7 +9130,7 @@ class PdfPages {
|
|
|
8789
9130
|
this.dataTop = this.y;
|
|
8790
9131
|
}
|
|
8791
9132
|
/** Bind the bounded logical-window owner to the existing physical page painter. */
|
|
8792
|
-
async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact) {
|
|
9133
|
+
async beginBands(layout, preparedHeadings, minimumDataHeight, caption, continuation, captionArtifact, openingContextAlreadyPainted) {
|
|
8793
9134
|
await this.ensureStarted();
|
|
8794
9135
|
const logicalHeadings = preparedHeadings ?? await layout.headers(), headings = await layout.bandRows(logicalHeadings, true);
|
|
8795
9136
|
const headerHeight = headings[0].reduce((sum, row) => sum + row.height, 0), { page, margins, padding } = this.settings;
|
|
@@ -8798,13 +9139,15 @@ class PdfPages {
|
|
|
8798
9139
|
const continuationCapacity = page.height - margins.top - margins.bottom - headerHeight - (continuation?.height ?? 0);
|
|
8799
9140
|
if (continuationCapacity + .001 < layout.lineHeight + padding * 2)
|
|
8800
9141
|
throw new RangeError("PDF band headings and continuation context leave no room for a data line.");
|
|
8801
|
-
|
|
9142
|
+
let openingContextPainted = captionArtifact && openingContextAlreadyPainted;
|
|
9143
|
+
if (this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0) + .001 < minimum) {
|
|
8802
9144
|
await this.pageBreak();
|
|
8803
|
-
|
|
8804
|
-
|
|
9145
|
+
openingContextPainted = false;
|
|
9146
|
+
}
|
|
9147
|
+
const firstCapacity = this.y - margins.bottom - headerHeight - (openingContextPainted ? 0 : caption?.height ?? 0);
|
|
8805
9148
|
if (firstCapacity + .001 < minimum)
|
|
8806
9149
|
throw new RangeError("PDF band caption and headings leave no room for a data line.");
|
|
8807
|
-
let
|
|
9150
|
+
let continuationPaints = 0;
|
|
8808
9151
|
this.tableElement = this.structure?.element("Table", this.groupParent);
|
|
8809
9152
|
this.paintedHeaderCells = new WeakSet();
|
|
8810
9153
|
let captionElement = this.structure && caption?.lines.length ? captionArtifact ? this.captionAnnotations(caption)
|
|
@@ -8818,21 +9161,16 @@ class PdfPages {
|
|
|
8818
9161
|
this.bandFlow = new PdfTableBandFlow(layout, headings, { firstCapacity, firstFullCapacity, continuationCapacity,
|
|
8819
9162
|
prepareRow: async (row) => { await this.tableStructure?.prepareHeaders(); await this.rowElements(row); },
|
|
8820
9163
|
completeRow: async (row) => { await this.tableStructure?.completeRow(row.source ?? row); },
|
|
8821
|
-
moveFirstToFreshPage: async () => { await this.pageBreak();
|
|
9164
|
+
moveFirstToFreshPage: async () => { await this.pageBreak(); openingContextPainted = false; },
|
|
8822
9165
|
paint: async (band, headers, rows, currentCaption, firstWindow, firstBand) => {
|
|
8823
9166
|
if (!(firstWindow && firstBand))
|
|
8824
9167
|
await this.pageBreak();
|
|
8825
|
-
if (firstWindow && !firstBand)
|
|
8826
|
-
this.y -= initialOffset;
|
|
8827
9168
|
const frame = layout.bands[band];
|
|
8828
9169
|
this.layout = { lefts: frame.lefts, lineHeight: layout.lineHeight, headers: async () => headers };
|
|
8829
9170
|
this.bandCellBudget = true;
|
|
8830
9171
|
try {
|
|
8831
|
-
if (currentCaption?.lines.length) {
|
|
8832
|
-
|
|
8833
|
-
if (paints > 0)
|
|
8834
|
-
this.settings.budget.cell(currentCaption.text.text);
|
|
8835
|
-
if (!firstWindow && paints === 0)
|
|
9172
|
+
if (currentCaption?.lines.length && !(firstWindow && firstBand && openingContextPainted)) {
|
|
9173
|
+
if (!firstWindow && continuationPaints++ === 0)
|
|
8836
9174
|
captionElement = this.captionAnnotations(currentCaption, captionElement);
|
|
8837
9175
|
const annotationParent = captionElement;
|
|
8838
9176
|
await this.paragraphs([currentCaption], headerHeight + minimum, true, firstWindow && firstBand && !captionArtifact ? { role: "Caption", keepOpen: true, ...(captionElement === undefined ? {} : { owner: captionElement }) }
|
|
@@ -8936,7 +9274,7 @@ class PdfPages {
|
|
|
8936
9274
|
this.annotations = [];
|
|
8937
9275
|
this.commandBytes = 0;
|
|
8938
9276
|
this.current = 0;
|
|
8939
|
-
await this.objects.
|
|
9277
|
+
await this.objects.flushBytes();
|
|
8940
9278
|
}
|
|
8941
9279
|
async finish() {
|
|
8942
9280
|
if (this.bandFlow) {
|
|
@@ -8964,11 +9302,11 @@ class PdfPages {
|
|
|
8964
9302
|
}
|
|
8965
9303
|
}
|
|
8966
9304
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
8967
|
-
_modules.set("
|
|
9305
|
+
_modules.set("ce2a4bebe6ca61c77a6a974bd91981622b1f263d4e56e6b8466af41419151410", _exports);
|
|
8968
9306
|
return _exports;
|
|
8969
9307
|
})();
|
|
8970
9308
|
|
|
8971
|
-
const
|
|
9309
|
+
const _m80 = _modules.get("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887") ?? (() => {
|
|
8972
9310
|
/** @internal Incremental PDF number tree: at most 64 entries/children per retained level. */
|
|
8973
9311
|
class PdfParentTree {
|
|
8974
9312
|
objects;
|
|
@@ -9031,15 +9369,38 @@ _modules.set("7a58e8ccb5164de51db14e39ca9695af6487c354df909509f0ae6bfac8ae3887",
|
|
|
9031
9369
|
return _exports;
|
|
9032
9370
|
})();
|
|
9033
9371
|
|
|
9034
|
-
const
|
|
9372
|
+
const _m79 = _modules.get("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0") ?? (() => {
|
|
9035
9373
|
const { OfficeIMOError } = _m2;
|
|
9036
9374
|
|
|
9037
9375
|
const { checkAbort } = _m4;
|
|
9038
9376
|
|
|
9039
9377
|
const { unicodeHex } = _m59;
|
|
9040
9378
|
|
|
9041
|
-
const { PdfParentTree } =
|
|
9379
|
+
const { PdfParentTree } = _m80;
|
|
9042
9380
|
|
|
9381
|
+
/** Same-page marked content uses integer K; cross-page MCR and annotation OBJR stay explicit. */
|
|
9382
|
+
function structureChild(child) {
|
|
9383
|
+
return typeof child === "number" ? (child < 0 ? -child - 1 + " " : child + " 0 R ") : child + " ";
|
|
9384
|
+
}
|
|
9385
|
+
function structurePrefix(element) {
|
|
9386
|
+
return "<< /Type /StructElem /S /" + element.role + " /P " + element.parent + " 0 R" +
|
|
9387
|
+
(element.markedPage === undefined ? "" : " /Pg " + element.markedPage + " 0 R") +
|
|
9388
|
+
(element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
|
|
9389
|
+
}
|
|
9390
|
+
/** Keep the same bounded small-object representation for both completion paths. */
|
|
9391
|
+
function compactStructureBody(element, prefix) {
|
|
9392
|
+
const remaining = 32768 - prefix.length - element.attributes.length - 4;
|
|
9393
|
+
if (remaining < 0)
|
|
9394
|
+
return undefined;
|
|
9395
|
+
let children = "";
|
|
9396
|
+
for (const child of element.children) {
|
|
9397
|
+
const token = structureChild(child);
|
|
9398
|
+
if (children.length + token.length > remaining)
|
|
9399
|
+
return undefined;
|
|
9400
|
+
children += token;
|
|
9401
|
+
}
|
|
9402
|
+
return prefix + children + "]" + element.attributes + " >>";
|
|
9403
|
+
}
|
|
9043
9404
|
/** A sorted name tree retains only a small open leaf and branch at each level. */
|
|
9044
9405
|
class PdfStructureIds {
|
|
9045
9406
|
objects;
|
|
@@ -9129,7 +9490,7 @@ class PdfStructure {
|
|
|
9129
9490
|
checkAbort(this.settings.options.signal);
|
|
9130
9491
|
if (++this.allocated > this.settings.limits.maxStructureElements)
|
|
9131
9492
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxStructureElements exceeded.");
|
|
9132
|
-
const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes
|
|
9493
|
+
const id = this.objects.reserve(), element = { id, parent, role, children: [], attributes };
|
|
9133
9494
|
this.elements.set(id, element);
|
|
9134
9495
|
const owner = this.elements.get(parent);
|
|
9135
9496
|
// A continuation-only linked caption is discovered during painting, after rows may exist.
|
|
@@ -9140,6 +9501,20 @@ class PdfStructure {
|
|
|
9140
9501
|
owner?.children.push(id);
|
|
9141
9502
|
return id;
|
|
9142
9503
|
}
|
|
9504
|
+
/** Attach resolved table associations while a source-ordered logical element is still open. */
|
|
9505
|
+
setAttributes(elementId, attributes) {
|
|
9506
|
+
const element = this.elements.get(elementId);
|
|
9507
|
+
if (!element)
|
|
9508
|
+
throw new Error("PDF structure attributes require an open logical owner.");
|
|
9509
|
+
element.attributes = attributes;
|
|
9510
|
+
}
|
|
9511
|
+
/** Write one immutable attribute dictionary. Its caller owns the bounded scope of reference reuse. */
|
|
9512
|
+
async attributeReference(dictionary) {
|
|
9513
|
+
checkAbort(this.settings.options.signal);
|
|
9514
|
+
const id = this.objects.reserve();
|
|
9515
|
+
await this.objects.object(id, dictionary);
|
|
9516
|
+
return " /A " + id + " 0 R";
|
|
9517
|
+
}
|
|
9143
9518
|
/** Flat visual sections share the same logical Document and cumulative resource policy. */
|
|
9144
9519
|
async beginSection() {
|
|
9145
9520
|
await this.complete(this.section);
|
|
@@ -9173,7 +9548,8 @@ class PdfStructure {
|
|
|
9173
9548
|
return existing;
|
|
9174
9549
|
const id = this.element("Link", parent, alternativeText === undefined ? "" : " /Alt <feff" + unicodeHex(alternativeText) + ">");
|
|
9175
9550
|
parents.set(parent, id);
|
|
9176
|
-
this.elements.get(parent)
|
|
9551
|
+
const owner = this.elements.get(parent);
|
|
9552
|
+
(owner.linkIdentities ??= []).push(identity);
|
|
9177
9553
|
return id;
|
|
9178
9554
|
}
|
|
9179
9555
|
/** Associate a native annotation in both directions: OBJR child and annotation ParentTree entry. */
|
|
@@ -9196,7 +9572,9 @@ class PdfStructure {
|
|
|
9196
9572
|
throw new Error("Marked content requires an open logical owner.");
|
|
9197
9573
|
const mcid = this.pageParents.length;
|
|
9198
9574
|
this.pageParents.push(elementId);
|
|
9199
|
-
element.
|
|
9575
|
+
element.markedPage ??= this.pageId;
|
|
9576
|
+
element.children.push(element.markedPage === this.pageId ? -(mcid + 1) :
|
|
9577
|
+
"<< /Type /MCR /Pg " + this.pageId + " 0 R /MCID " + mcid + " >>");
|
|
9200
9578
|
return "/" + element.role + " << /MCID " + mcid + (actualText === undefined ? "" : " /ActualText <FEFF" + unicodeHex(actualText) + ">") + " >> BDC\n";
|
|
9201
9579
|
}
|
|
9202
9580
|
get pageDictionary() { return " /StructParents " + this.pageKey + " /Tabs /S"; }
|
|
@@ -9220,37 +9598,49 @@ class PdfStructure {
|
|
|
9220
9598
|
if (!element)
|
|
9221
9599
|
return;
|
|
9222
9600
|
for (const child of element.children)
|
|
9223
|
-
if (typeof child === "number" && this.
|
|
9601
|
+
if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
|
|
9224
9602
|
await this.complete(child);
|
|
9225
9603
|
checkAbort(this.settings.options.signal);
|
|
9226
|
-
const prefix =
|
|
9227
|
-
(element.identifier === undefined ? "" : " /ID (" + element.identifier + ")") + " /K [";
|
|
9228
|
-
const remaining = 32768 - prefix.length - element.attributes.length - 4;
|
|
9229
|
-
let children = "", small = remaining >= 0;
|
|
9230
|
-
if (small)
|
|
9231
|
-
for (const child of element.children) {
|
|
9232
|
-
const token = typeof child === "number" ? child + " 0 R " : child + " ";
|
|
9233
|
-
if (children.length + token.length > remaining) {
|
|
9234
|
-
small = false;
|
|
9235
|
-
break;
|
|
9236
|
-
}
|
|
9237
|
-
children += token;
|
|
9238
|
-
}
|
|
9604
|
+
const prefix = structurePrefix(element), body = compactStructureBody(element, prefix);
|
|
9239
9605
|
// Most table cells/rows fit in one encoding. Large parents and alternatives remain streamed.
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9606
|
+
if (body !== undefined) {
|
|
9607
|
+
if (!this.objects.tryCompactObject(id, body))
|
|
9608
|
+
await this.objects.compactObject(id, body);
|
|
9609
|
+
}
|
|
9610
|
+
else
|
|
9611
|
+
await this.objects.object(id, this.body(element, prefix));
|
|
9612
|
+
this.releaseElement(element);
|
|
9613
|
+
}
|
|
9614
|
+
/** Close already-bufferable children without creating an async chain per leaf. A false result
|
|
9615
|
+
* leaves the current owner open for the existing awaited flush or ordinary-object path. */
|
|
9616
|
+
completeBuffered(id) {
|
|
9617
|
+
const element = this.elements.get(id);
|
|
9618
|
+
if (!element)
|
|
9619
|
+
return true;
|
|
9620
|
+
for (const child of element.children)
|
|
9621
|
+
if (typeof child === "number" && child > 0 && !this.completeBuffered(child))
|
|
9622
|
+
return false;
|
|
9623
|
+
checkAbort(this.settings.options.signal);
|
|
9624
|
+
const body = compactStructureBody(element, structurePrefix(element));
|
|
9625
|
+
if (body === undefined || !this.objects.tryCompactObject(id, body))
|
|
9626
|
+
return false;
|
|
9627
|
+
this.releaseElement(element);
|
|
9628
|
+
return true;
|
|
9629
|
+
}
|
|
9630
|
+
releaseElement(element) {
|
|
9631
|
+
if (element.linkIdentities)
|
|
9632
|
+
for (const identity of element.linkIdentities) {
|
|
9633
|
+
const parents = this.links.get(identity);
|
|
9634
|
+
parents?.delete(element.id);
|
|
9635
|
+
if (!parents?.size)
|
|
9636
|
+
this.links.delete(identity);
|
|
9637
|
+
}
|
|
9638
|
+
this.elements.delete(element.id);
|
|
9639
|
+
}
|
|
9640
|
+
*body(element, prefix) {
|
|
9641
|
+
yield prefix;
|
|
9252
9642
|
for (const child of element.children)
|
|
9253
|
-
yield
|
|
9643
|
+
yield structureChild(child);
|
|
9254
9644
|
yield "]" + element.attributes + " >>";
|
|
9255
9645
|
}
|
|
9256
9646
|
async completeRow(cells) {
|
|
@@ -9287,11 +9677,11 @@ function graphicAlternative(value, settings) {
|
|
|
9287
9677
|
return alternativeText;
|
|
9288
9678
|
}
|
|
9289
9679
|
const _exports = Object.freeze({ PdfStructure: PdfStructure, graphicAlternative: graphicAlternative });
|
|
9290
|
-
_modules.set("
|
|
9680
|
+
_modules.set("1c1828a3d6dfc2edda674566203e7aa8e97c984114b7928df13cb373859977d0", _exports);
|
|
9291
9681
|
return _exports;
|
|
9292
9682
|
})();
|
|
9293
9683
|
|
|
9294
|
-
const
|
|
9684
|
+
const _m81 = _modules.get("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea") ?? (() => {
|
|
9295
9685
|
const { OfficeIMOError } = _m2;
|
|
9296
9686
|
|
|
9297
9687
|
const { checkAbort } = _m4;
|
|
@@ -9351,22 +9741,22 @@ class PdfOutlines {
|
|
|
9351
9741
|
}
|
|
9352
9742
|
}
|
|
9353
9743
|
const _exports = Object.freeze({ PdfOutlines: PdfOutlines });
|
|
9354
|
-
_modules.set("
|
|
9744
|
+
_modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea", _exports);
|
|
9355
9745
|
return _exports;
|
|
9356
9746
|
})();
|
|
9357
9747
|
|
|
9358
|
-
const _m58 = _modules.get("
|
|
9748
|
+
const _m58 = _modules.get("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9") ?? (() => {
|
|
9359
9749
|
const { PdfObjects, unicodeHex } = _m59;
|
|
9360
9750
|
|
|
9361
|
-
const { PdfFontResources } =
|
|
9751
|
+
const { PdfFontResources } = _m61;
|
|
9362
9752
|
|
|
9363
|
-
const { PdfTableLayout } =
|
|
9753
|
+
const { PdfTableLayout } = _m68;
|
|
9364
9754
|
|
|
9365
|
-
const { PdfPages } =
|
|
9755
|
+
const { PdfPages } = _m73;
|
|
9366
9756
|
|
|
9367
|
-
const { PdfStructure } =
|
|
9757
|
+
const { PdfStructure } = _m79;
|
|
9368
9758
|
|
|
9369
|
-
const { PdfOutlines } =
|
|
9759
|
+
const { PdfOutlines } = _m81;
|
|
9370
9760
|
|
|
9371
9761
|
/** One resource/catalog owner shared by table convenience exports and composed documents. */
|
|
9372
9762
|
class PdfWriteSession {
|
|
@@ -9383,7 +9773,7 @@ class PdfWriteSession {
|
|
|
9383
9773
|
info;
|
|
9384
9774
|
constructor(sink, settings, table = false) {
|
|
9385
9775
|
this.settings = settings;
|
|
9386
|
-
this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes);
|
|
9776
|
+
this.objects = new PdfObjects(sink, settings.options.signal, settings.budget.limits.maxOutputBytes, settings.options.compression !== false);
|
|
9387
9777
|
this.root = this.objects.reserve();
|
|
9388
9778
|
this.parent = this.objects.reserve();
|
|
9389
9779
|
this.resources = this.objects.reserve();
|
|
@@ -9418,11 +9808,11 @@ class PdfWriteSession {
|
|
|
9418
9808
|
}
|
|
9419
9809
|
}
|
|
9420
9810
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
9421
|
-
_modules.set("
|
|
9811
|
+
_modules.set("6f13eca1cc6a3dee16e260ffb7ee38115cc2390084e9b156f0a90915fa5b18b9", _exports);
|
|
9422
9812
|
return _exports;
|
|
9423
9813
|
})();
|
|
9424
9814
|
|
|
9425
|
-
const _m54 = _modules.get("
|
|
9815
|
+
const _m54 = _modules.get("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2") ?? (() => {
|
|
9426
9816
|
const { BlobByteSink, withDestination } = _m3;
|
|
9427
9817
|
|
|
9428
9818
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
|
|
@@ -9487,11 +9877,11 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
9487
9877
|
});
|
|
9488
9878
|
}
|
|
9489
9879
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
9490
|
-
_modules.set("
|
|
9880
|
+
_modules.set("4a658d1639cc333dc8b174a84d2d80a7e20bec2f0e86409d00c3f77199e2eda2", _exports);
|
|
9491
9881
|
return _exports;
|
|
9492
9882
|
})();
|
|
9493
9883
|
|
|
9494
|
-
const
|
|
9884
|
+
const _m85 = _modules.get("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6") ?? (() => {
|
|
9495
9885
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
9496
9886
|
|
|
9497
9887
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m4;
|
|
@@ -9755,16 +10145,16 @@ function paeth(left, up, upperLeft) {
|
|
|
9755
10145
|
return a <= b && a <= c ? left : b <= c ? up : upperLeft;
|
|
9756
10146
|
}
|
|
9757
10147
|
const _exports = Object.freeze({ pngPixels: pngPixels });
|
|
9758
|
-
_modules.set("
|
|
10148
|
+
_modules.set("749d1ec5422c0087787f525ef42e3b8d3a94d2b70eb5e42d2e3723a870777ad6", _exports);
|
|
9759
10149
|
return _exports;
|
|
9760
10150
|
})();
|
|
9761
10151
|
|
|
9762
|
-
const
|
|
10152
|
+
const _m84 = _modules.get("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21") ?? (() => {
|
|
9763
10153
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
9764
10154
|
|
|
9765
10155
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
9766
10156
|
|
|
9767
|
-
const { pngPixels } =
|
|
10157
|
+
const { pngPixels } = _m85;
|
|
9768
10158
|
|
|
9769
10159
|
/** Shared document image resources; source objects are captured on first consumption. */
|
|
9770
10160
|
class PdfDocumentImages {
|
|
@@ -9889,11 +10279,11 @@ function jpegSize(bytes) {
|
|
|
9889
10279
|
throw new TypeError("JPEG image has no complete frame and scan.");
|
|
9890
10280
|
}
|
|
9891
10281
|
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages });
|
|
9892
|
-
_modules.set("
|
|
10282
|
+
_modules.set("7dca2d9ca5c43893abdaf86df5b1bcb1f3de3d5d33532d082fdfe04711999d21", _exports);
|
|
9893
10283
|
return _exports;
|
|
9894
10284
|
})();
|
|
9895
10285
|
|
|
9896
|
-
const
|
|
10286
|
+
const _m86 = _modules.get("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6") ?? (() => {
|
|
9897
10287
|
const { OfficeIMOError } = _m2;
|
|
9898
10288
|
|
|
9899
10289
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -9976,11 +10366,11 @@ async function vectorCommands(block, settings, used) {
|
|
|
9976
10366
|
commands.join("") + (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
9977
10367
|
}
|
|
9978
10368
|
const _exports = Object.freeze({ vectorCommands: vectorCommands });
|
|
9979
|
-
_modules.set("
|
|
10369
|
+
_modules.set("3290c84fdf80725af802f497d947bc088aa8d93d9db0a33f6f829f9153aa6fd6", _exports);
|
|
9980
10370
|
return _exports;
|
|
9981
10371
|
})();
|
|
9982
10372
|
|
|
9983
|
-
const
|
|
10373
|
+
const _m87 = _modules.get("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7") ?? (() => {
|
|
9984
10374
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
9985
10375
|
|
|
9986
10376
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
@@ -10223,25 +10613,27 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
10223
10613
|
return { width: captured.width, height: captured.height, content: fragments.join(""), commands: captured.commands, elements: captured.elements };
|
|
10224
10614
|
}
|
|
10225
10615
|
const _exports = Object.freeze({ checkDrawingBlock: checkDrawingBlock, prepareDrawing: prepareDrawing });
|
|
10226
|
-
_modules.set("
|
|
10616
|
+
_modules.set("da9ad00f94b9ae28e2e3de796928ff0c4eab1d73382b1441e7d779fad4278ef7", _exports);
|
|
10227
10617
|
return _exports;
|
|
10228
10618
|
})();
|
|
10229
10619
|
|
|
10230
|
-
const
|
|
10620
|
+
const _m88 = _modules.get("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88") ?? (() => {
|
|
10231
10621
|
const { OfficeIMOError } = _m2;
|
|
10232
10622
|
|
|
10233
|
-
const { capturePdfText, wrapPdfText } =
|
|
10623
|
+
const { capturePdfText, wrapPdfText } = _m70;
|
|
10234
10624
|
|
|
10235
10625
|
const { positive } = _m55;
|
|
10236
10626
|
|
|
10237
10627
|
const { resolveParagraphStyle } = _m56;
|
|
10238
10628
|
|
|
10239
|
-
const { captureBookmark } =
|
|
10629
|
+
const { captureBookmark } = _m77;
|
|
10240
10630
|
|
|
10241
10631
|
const { captureFields } = _m10;
|
|
10242
10632
|
|
|
10633
|
+
const { pdfBudgetText } = _m69;
|
|
10634
|
+
|
|
10243
10635
|
/** @internal Copy public paragraph input before any cooperative layout or source enumeration. */
|
|
10244
|
-
function captureParagraph(block, settings, fonts) {
|
|
10636
|
+
function captureParagraph(block, settings, fonts, budgetOnPaint = false) {
|
|
10245
10637
|
if (!block || block.kind !== "paragraph")
|
|
10246
10638
|
throw new TypeError("PDF paragraph groups accept paragraph blocks only.");
|
|
10247
10639
|
const { text, headingLevel, presentation: inputStyle, fontSize, keepTogether, keepWithNext, spaceBefore, spaceAfter, style: styleName, bookmark: inputBookmark } = block;
|
|
@@ -10254,7 +10646,8 @@ function captureParagraph(block, settings, fonts) {
|
|
|
10254
10646
|
}, settings.paragraphStyles);
|
|
10255
10647
|
const style = resolved.presentation ?? Object.freeze({}), size = positive(resolved.fontSize ?? settings.fontSize, "Paragraph font size", 144);
|
|
10256
10648
|
const bookmark = captureBookmark(inputBookmark, settings);
|
|
10257
|
-
return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false), style, size,
|
|
10649
|
+
return Object.freeze({ text: capturePdfText(text, style, settings, fonts, false, !budgetOnPaint), style, size,
|
|
10650
|
+
...(budgetOnPaint ? { budgetOnPaint: true } : {}),
|
|
10258
10651
|
...(headingLevel === undefined ? {} : { headingLevel }), ...(bookmark === undefined ? {} : { bookmark }),
|
|
10259
10652
|
keepTogether: resolved.keepTogether ?? false, keepWithNext: resolved.keepWithNext ?? false,
|
|
10260
10653
|
spaceBefore: resolved.spaceBefore ?? 0, spaceAfter: resolved.spaceAfter ?? 8 });
|
|
@@ -10265,13 +10658,16 @@ function captureCaption(caption, settings, fonts) {
|
|
|
10265
10658
|
Object.keys(caption).some(key => !["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"].includes(key)))
|
|
10266
10659
|
throw new TypeError("PDF captions support text, style, fontSize, presentation, spaceBefore and spaceAfter.");
|
|
10267
10660
|
return captureParagraph({ ...captureFields(caption, ["text", "style", "fontSize", "presentation", "spaceBefore", "spaceAfter"]),
|
|
10268
|
-
kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts);
|
|
10661
|
+
kind: "paragraph", keepTogether: true, keepWithNext: true }, settings, fonts, true);
|
|
10269
10662
|
}
|
|
10270
10663
|
/** @internal Layout is bounded by the same per-cell text and wrapped-line limits as table cells. */
|
|
10271
10664
|
async function prepareParagraph(captured, settings, fonts, width = settings.page.width - settings.margins.left - settings.margins.right) {
|
|
10272
10665
|
if (!captured.text.text)
|
|
10273
10666
|
return { ...captured, lines: [], height: 0, firstHeight: 0 };
|
|
10274
|
-
|
|
10667
|
+
if (!captured.budgetOnPaint) {
|
|
10668
|
+
const budgetText = pdfBudgetText(captured.text.text, settings.budget);
|
|
10669
|
+
settings.budget.cell(budgetText, budgetText.length);
|
|
10670
|
+
}
|
|
10275
10671
|
const lines = await wrapPdfText(captured.text, fonts, captured.size, positive(width, "Paragraph width"), settings);
|
|
10276
10672
|
return { ...captured, lines, height: captured.spaceBefore + lines.reduce((height, line) => height + line.lineHeight, 0) + captured.spaceAfter,
|
|
10277
10673
|
firstHeight: captured.spaceBefore + lines[0].lineHeight };
|
|
@@ -10301,14 +10697,14 @@ function paragraphStartHeight(paragraphs) {
|
|
|
10301
10697
|
return required;
|
|
10302
10698
|
}
|
|
10303
10699
|
const _exports = Object.freeze({ captureParagraph: captureParagraph, captureCaption: captureCaption, prepareParagraph: prepareParagraph, checkParagraphBuffer: checkParagraphBuffer, paragraphStartHeight: paragraphStartHeight });
|
|
10304
|
-
_modules.set("
|
|
10700
|
+
_modules.set("5e4503b77b357ee6d9fad1f52690085b0f0b140cd3b550b63c5100ed95a92f88", _exports);
|
|
10305
10701
|
return _exports;
|
|
10306
10702
|
})();
|
|
10307
10703
|
|
|
10308
|
-
const
|
|
10309
|
-
const { capturePdfText, wrapPdfText } =
|
|
10704
|
+
const _m89 = _modules.get("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7") ?? (() => {
|
|
10705
|
+
const { capturePdfText, wrapPdfText } = _m70;
|
|
10310
10706
|
|
|
10311
|
-
const { captureParagraph, prepareParagraph } =
|
|
10707
|
+
const { captureParagraph, prepareParagraph } = _m88;
|
|
10312
10708
|
|
|
10313
10709
|
const { resolveParagraphStyle } = _m56;
|
|
10314
10710
|
|
|
@@ -10359,11 +10755,11 @@ async function prepareListItem(item, index, options, settings, fonts) {
|
|
|
10359
10755
|
height: paragraph.height + lineHeight - first.lineHeight, firstHeight: paragraph.spaceBefore + lineHeight } };
|
|
10360
10756
|
}
|
|
10361
10757
|
const _exports = Object.freeze({ captureListOptions: captureListOptions, prepareListItem: prepareListItem });
|
|
10362
|
-
_modules.set("
|
|
10758
|
+
_modules.set("1d57c429705ae0cbc14d98dcfef4c8a6c2df06f391c8f58e99cacb02f2d1cbc7", _exports);
|
|
10363
10759
|
return _exports;
|
|
10364
10760
|
})();
|
|
10365
10761
|
|
|
10366
|
-
const
|
|
10762
|
+
const _m91 = _modules.get("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343") ?? (() => {
|
|
10367
10763
|
const { assertGroupedReportSource } = _m8;
|
|
10368
10764
|
|
|
10369
10765
|
const { captureFields } = _m10;
|
|
@@ -10409,26 +10805,26 @@ function captureGroupedPdfTableOptions(configuration) {
|
|
|
10409
10805
|
...(captured.footerPresentation === undefined ? {} : { footerPresentation: presentation(captured.footerPresentation) }) });
|
|
10410
10806
|
}
|
|
10411
10807
|
const _exports = Object.freeze({ groupedPdfLabelFields: groupedPdfLabelFields, groupedPdfTableFields: groupedPdfTableFields, pdfGroupedTable: pdfGroupedTable, captureGroupedPdfTableOptions: captureGroupedPdfTableOptions });
|
|
10412
|
-
_modules.set("
|
|
10808
|
+
_modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343", _exports);
|
|
10413
10809
|
return _exports;
|
|
10414
10810
|
})();
|
|
10415
10811
|
|
|
10416
|
-
const
|
|
10812
|
+
const _m90 = _modules.get("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715") ?? (() => {
|
|
10417
10813
|
const { assertGroupedReportSource, groupedReportOperation } = _m8;
|
|
10418
10814
|
|
|
10419
10815
|
const { consumeRows } = _m4;
|
|
10420
10816
|
|
|
10421
10817
|
const { ExportCell } = _m5;
|
|
10422
10818
|
|
|
10423
|
-
const { captureGroupedPdfTableOptions } =
|
|
10819
|
+
const { captureGroupedPdfTableOptions } = _m91;
|
|
10424
10820
|
|
|
10425
10821
|
const { settings } = _m55;
|
|
10426
10822
|
|
|
10427
|
-
const { PdfTableLayout } =
|
|
10823
|
+
const { PdfTableLayout } = _m68;
|
|
10428
10824
|
|
|
10429
|
-
const { captureCaption, captureParagraph, prepareParagraph } =
|
|
10825
|
+
const { captureCaption, captureParagraph, prepareParagraph } = _m88;
|
|
10430
10826
|
|
|
10431
|
-
const { synchronousText } =
|
|
10827
|
+
const { synchronousText } = _m69;
|
|
10432
10828
|
|
|
10433
10829
|
/** @internal Render one analytical source in the existing document session. Retain one detail row and
|
|
10434
10830
|
* at most four closing subtotals. All captions, rows, pages, bytes and fonts use the document owners. */
|
|
@@ -10457,10 +10853,44 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10457
10853
|
const continuationLabels = new WeakMap();
|
|
10458
10854
|
let pending;
|
|
10459
10855
|
const closing = [];
|
|
10460
|
-
const
|
|
10856
|
+
const aggregatePositions = report.columns.flatMap((column, index) => Object.hasOwn(report.totals, column.key) ? [index] : []);
|
|
10857
|
+
const summaryValues = (label, values, positions) => Object.freeze([
|
|
10461
10858
|
new ExportCell(label, { text: label, presentation: table.options.footerPresentation }),
|
|
10462
|
-
...values.map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
|
|
10859
|
+
...(positions ? positions.map(index => values[index]) : values).map(value => new ExportCell(value, { presentation: table.options.footerPresentation }))
|
|
10463
10860
|
]);
|
|
10861
|
+
// Independent summaries have no detail values in non-aggregate columns. Project their
|
|
10862
|
+
// declared operations, including zero/null results, rather than emitting label-only bands.
|
|
10863
|
+
// Keep callback positions in the original source model after this physical projection.
|
|
10864
|
+
const summaryLayouts = new Map();
|
|
10865
|
+
const summaryLayout = (grand) => {
|
|
10866
|
+
const existing = summaryLayouts.get(grand);
|
|
10867
|
+
if (existing)
|
|
10868
|
+
return existing;
|
|
10869
|
+
const positions = [0, ...aggregatePositions.map(index => index + 1)];
|
|
10870
|
+
const projected = positions.map(position => {
|
|
10871
|
+
const column = columns[position];
|
|
10872
|
+
if (!grand)
|
|
10873
|
+
return column;
|
|
10874
|
+
const { groups: _groups, ...leaf } = column;
|
|
10875
|
+
return leaf;
|
|
10876
|
+
});
|
|
10877
|
+
const originalPosition = (position) => {
|
|
10878
|
+
const columnIndex = positions[position.columnIndex];
|
|
10879
|
+
return { ...position, columnIndex, column: columns[columnIndex] };
|
|
10880
|
+
};
|
|
10881
|
+
const repeatColumns = positions.flatMap((position, index) => position === 0 || table.repeatedColumns.includes(position) ? [index] : []);
|
|
10882
|
+
const wideTable = table.options.wideTable;
|
|
10883
|
+
const projectedSettings = { ...sharedTable,
|
|
10884
|
+
repeatedColumns: Object.freeze(repeatColumns), options: { ...table.options, columns: projected,
|
|
10885
|
+
...(table.options.columnWidths === undefined ? {} : { columnWidths: positions.map(position => table.options.columnWidths[position]) }),
|
|
10886
|
+
...(typeof wideTable !== "object" ? {} : { wideTable: { ...wideTable, repeatColumns } }),
|
|
10887
|
+
...(table.options.formatValue === undefined ? {} : { formatValue: (value, position) => table.options.formatValue(value, originalPosition(position)) }),
|
|
10888
|
+
...(table.options.formatRuns === undefined ? {} : { formatRuns: (value, position) => table.options.formatRuns(value, originalPosition(position)) })
|
|
10889
|
+
} };
|
|
10890
|
+
const projectedLayout = new PdfTableLayout(projectedSettings, fonts);
|
|
10891
|
+
summaryLayouts.set(grand, projectedLayout);
|
|
10892
|
+
return projectedLayout;
|
|
10893
|
+
};
|
|
10464
10894
|
const prepareGroupContext = async () => {
|
|
10465
10895
|
const caption = await prepareParagraph(captureCaption({ text: path.map(group => group.label).join("\n"),
|
|
10466
10896
|
presentation: { bold: true }, spaceAfter: 4 }, pages.settings, fonts), pages.settings, fonts);
|
|
@@ -10523,26 +10953,46 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10523
10953
|
...(group.label.trim() ? { bookmark: { title: group.label, level: (groupHeadingLevel + group.level) } } : {})
|
|
10524
10954
|
}, pages.settings, fonts), pages.settings, fonts));
|
|
10525
10955
|
const groupHeight = groupHeadings.reduce((height, heading) => height + heading.height, 0);
|
|
10526
|
-
|
|
10527
|
-
|
|
10956
|
+
// Newly opened semantic headings already paint the end of this path. Only the open
|
|
10957
|
+
// ancestor prefix needs an artifact here; later physical bands still paint the full path.
|
|
10958
|
+
const ancestorCaption = semantic && semanticDepth > 0 ? await prepareParagraph(captureCaption({
|
|
10959
|
+
text: path.slice(0, semanticDepth).map(group => group.label).join("\n"), presentation: { bold: true }, spaceAfter: 4
|
|
10960
|
+
}, pages.settings, fonts), pages.settings, fonts) : undefined;
|
|
10961
|
+
const openingHeight = semantic ? (ancestorCaption?.height ?? 0) + groupHeight : caption.height;
|
|
10962
|
+
await context.flushParagraphs(openingHeight + headingHeight + minimum);
|
|
10963
|
+
if (ancestorCaption)
|
|
10964
|
+
await pages.paragraphs([ancestorCaption], groupHeight + headingHeight + minimum, true, { artifact: true });
|
|
10965
|
+
let followingHeight = groupHeight + (semantic ? 0 : caption.height) + headingHeight + minimum;
|
|
10528
10966
|
for (const heading of groupHeadings) {
|
|
10529
10967
|
followingHeight -= heading.height;
|
|
10530
10968
|
await pages.beginGroup(semanticDepth++, heading, followingHeight);
|
|
10531
10969
|
}
|
|
10532
|
-
await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic);
|
|
10970
|
+
await pages.beginTable(layout, headings, minimum, caption, continuation, false, semantic, semantic);
|
|
10533
10971
|
started = true;
|
|
10534
10972
|
firstFragment = (caption?.lines.length ?? 0) > 0 || groupHeadings.some(heading => heading.lines.length > 0);
|
|
10535
10973
|
};
|
|
10536
|
-
const semanticSubtotal = async (row, level) => {
|
|
10974
|
+
const semanticSubtotal = async (row, level, values) => {
|
|
10975
|
+
if (level === report.groupBy.length - 1) {
|
|
10976
|
+
// A leaf's own subtotal shares its detail table and header identities. Keep the last
|
|
10977
|
+
// detail/summary bundle when it fits; the existing flow owns continuation and limits.
|
|
10978
|
+
pages.summary(row);
|
|
10979
|
+
closing.push(row);
|
|
10980
|
+
await finishLeaf();
|
|
10981
|
+
await pages.endGroup(level);
|
|
10982
|
+
semanticDepth = level;
|
|
10983
|
+
path = path.slice(0, level);
|
|
10984
|
+
return;
|
|
10985
|
+
}
|
|
10537
10986
|
await finishLeaf();
|
|
10538
10987
|
const { caption, continuation } = await prepareGroupContext();
|
|
10539
|
-
const
|
|
10540
|
-
await
|
|
10988
|
+
const projected = summaryLayout(false), summaryHeadings = await projected.headers();
|
|
10989
|
+
const summaryRow = await projected.data(values, 0, true), minimum = projected.minimumRowHeight(summaryRow);
|
|
10990
|
+
await context.flushParagraphs(caption.height + await projected.blockHeight(summaryHeadings) + minimum);
|
|
10541
10991
|
// An ancestor subtotal belongs to that ancestor's section, never the final child's table.
|
|
10542
10992
|
// Its own visible column headings keep the separate logical summary table truthful.
|
|
10543
|
-
await pages.beginTable(
|
|
10544
|
-
pages.summary(
|
|
10545
|
-
await pages.row(
|
|
10993
|
+
await pages.beginTable(projected, summaryHeadings, minimum, caption, continuation, false, true);
|
|
10994
|
+
pages.summary(summaryRow);
|
|
10995
|
+
await pages.row(summaryRow, caption.lines.length > 0 || summaryHeadings.length > 0);
|
|
10546
10996
|
await pages.endTable();
|
|
10547
10997
|
await pages.endGroup(level);
|
|
10548
10998
|
semanticDepth = level;
|
|
@@ -10552,25 +11002,19 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10552
11002
|
await finishLeaf();
|
|
10553
11003
|
if (!includeGrandTotal && summary.rows !== 0)
|
|
10554
11004
|
return;
|
|
10555
|
-
const
|
|
10556
|
-
const { groups: _groups, ...leaf } = column;
|
|
10557
|
-
return leaf;
|
|
10558
|
-
});
|
|
10559
|
-
const completeTable = settings({ ...table.options, columns: completeColumns,
|
|
10560
|
-
includeHeader: input.includeHeader ?? true });
|
|
10561
|
-
const completeLayout = summary.rows === 0 ? layout : new PdfTableLayout({ ...completeTable, budget: prepared.budget }, fonts);
|
|
11005
|
+
const completeLayout = summary.rows === 0 ? layout : summaryLayout(true);
|
|
10562
11006
|
const completeHeadings = summary.rows === 0 ? headings : await completeLayout.headers();
|
|
10563
11007
|
rowIndex = -1;
|
|
10564
11008
|
let total;
|
|
10565
11009
|
if (includeGrandTotal) {
|
|
10566
11010
|
context.acceptRow(false);
|
|
10567
|
-
total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals), 0, true);
|
|
11011
|
+
total = await completeLayout.data(summaryValues(synchronousText(grandTotalLabel(summary), "grandTotalLabel"), summary.totals, summary.rows === 0 ? undefined : aggregatePositions), 0, true);
|
|
10568
11012
|
}
|
|
10569
11013
|
if (!completeHeadings.length && !total)
|
|
10570
11014
|
return;
|
|
10571
11015
|
const minimum = total ? completeLayout.minimumRowHeight(total) : 0;
|
|
10572
11016
|
await context.flushParagraphs(await completeLayout.blockHeight(completeHeadings) + minimum);
|
|
10573
|
-
await pages.beginTable(completeLayout, completeHeadings, minimum
|
|
11017
|
+
await pages.beginTable(completeLayout, completeHeadings, minimum);
|
|
10574
11018
|
if (total) {
|
|
10575
11019
|
if (semantic)
|
|
10576
11020
|
pages.summary(total);
|
|
@@ -10598,9 +11042,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10598
11042
|
case "groupEnd": {
|
|
10599
11043
|
rowIndex = -1;
|
|
10600
11044
|
context.acceptRow(false);
|
|
10601
|
-
const
|
|
11045
|
+
const separate = semantic && event.level !== report.groupBy.length - 1;
|
|
11046
|
+
const values = summaryValues(synchronousText(subtotalLabel(event), "subtotalLabel"), event.totals, separate ? aggregatePositions : undefined);
|
|
11047
|
+
const row = separate ? undefined : await layout.data(values, 0, true);
|
|
10602
11048
|
if (semantic)
|
|
10603
|
-
await semanticSubtotal(row, event.level);
|
|
11049
|
+
await semanticSubtotal(row, event.level, values);
|
|
10604
11050
|
else
|
|
10605
11051
|
closing.push(row);
|
|
10606
11052
|
break;
|
|
@@ -10617,11 +11063,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
10617
11063
|
}
|
|
10618
11064
|
}
|
|
10619
11065
|
const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
|
|
10620
|
-
_modules.set("
|
|
11066
|
+
_modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715", _exports);
|
|
10621
11067
|
return _exports;
|
|
10622
11068
|
})();
|
|
10623
11069
|
|
|
10624
|
-
const
|
|
11070
|
+
const _m83 = _modules.get("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223") ?? (() => {
|
|
10625
11071
|
const { BlobByteSink, withDestination } = _m3;
|
|
10626
11072
|
|
|
10627
11073
|
const { OfficeIMOError } = _m2;
|
|
@@ -10638,25 +11084,25 @@ const { settings, captureWideTable } = _m55;
|
|
|
10638
11084
|
|
|
10639
11085
|
const { pdfNumber: n } = _m59;
|
|
10640
11086
|
|
|
10641
|
-
const { PdfTableLayout } =
|
|
11087
|
+
const { PdfTableLayout } = _m68;
|
|
10642
11088
|
|
|
10643
11089
|
const { PdfWriteSession } = _m58;
|
|
10644
11090
|
|
|
10645
|
-
const { PdfDocumentImages } =
|
|
11091
|
+
const { PdfDocumentImages } = _m84;
|
|
10646
11092
|
|
|
10647
|
-
const { vectorCommands } =
|
|
11093
|
+
const { vectorCommands } = _m86;
|
|
10648
11094
|
|
|
10649
|
-
const { graphicAlternative } =
|
|
11095
|
+
const { graphicAlternative } = _m79;
|
|
10650
11096
|
|
|
10651
|
-
const { checkDrawingBlock, prepareDrawing } =
|
|
11097
|
+
const { checkDrawingBlock, prepareDrawing } = _m87;
|
|
10652
11098
|
|
|
10653
|
-
const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } =
|
|
11099
|
+
const { captureParagraph, captureCaption, prepareParagraph, checkParagraphBuffer, paragraphStartHeight } = _m88;
|
|
10654
11100
|
|
|
10655
|
-
const { captureListOptions, prepareListItem } =
|
|
11101
|
+
const { captureListOptions, prepareListItem } = _m89;
|
|
10656
11102
|
|
|
10657
|
-
const { captureSection } =
|
|
11103
|
+
const { captureSection } = _m77;
|
|
10658
11104
|
|
|
10659
|
-
const { renderGroupedPdfTable } =
|
|
11105
|
+
const { renderGroupedPdfTable } = _m90;
|
|
10660
11106
|
|
|
10661
11107
|
const tableOptionFields = ["columns", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "columnWidths", "wideTable", "formatValue", "formatRuns"];
|
|
10662
11108
|
/** Capture typed columns for a single-use table source in a composed document. */
|
|
@@ -10911,22 +11357,22 @@ function captureTableOptions(options) {
|
|
|
10911
11357
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
10912
11358
|
}
|
|
10913
11359
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
10914
|
-
_modules.set("
|
|
11360
|
+
_modules.set("67060b0c8b6d3f6a6d9d53d41dd780ee99ffdae0ed0f90004ac675d382a80223", _exports);
|
|
10915
11361
|
return _exports;
|
|
10916
11362
|
})();
|
|
10917
11363
|
|
|
10918
|
-
const
|
|
11364
|
+
const _m82 = _modules.get("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557") ?? (() => {
|
|
10919
11365
|
const { assertGroupedReportSource } = _m8;
|
|
10920
11366
|
|
|
10921
11367
|
const { BlobByteSink } = _m3;
|
|
10922
11368
|
|
|
10923
|
-
const { writePdfDocumentTo } =
|
|
11369
|
+
const { writePdfDocumentTo } = _m83;
|
|
10924
11370
|
|
|
10925
11371
|
const { pdfOptionFields } = _m55;
|
|
10926
11372
|
|
|
10927
11373
|
const { captureFields } = _m10;
|
|
10928
11374
|
|
|
10929
|
-
const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } =
|
|
11375
|
+
const { pdfGroupedTable, groupedPdfLabelFields, groupedPdfTableFields } = _m91;
|
|
10930
11376
|
|
|
10931
11377
|
|
|
10932
11378
|
|
|
@@ -10960,15 +11406,15 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
10960
11406
|
delete documentOptions.footer;
|
|
10961
11407
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
10962
11408
|
}
|
|
10963
|
-
const _exports = Object.freeze({ pdfGroupedTable:
|
|
10964
|
-
_modules.set("
|
|
11409
|
+
const _exports = Object.freeze({ pdfGroupedTable: _m91.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
11410
|
+
_modules.set("91d1ab43a388d5d7a78db095e27ed8b0f6d28004358cbf296ac818479c58c557", _exports);
|
|
10965
11411
|
return _exports;
|
|
10966
11412
|
})();
|
|
10967
11413
|
|
|
10968
|
-
const
|
|
10969
|
-
const { fontProgram } =
|
|
11414
|
+
const _m92 = _modules.get("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86") ?? (() => {
|
|
11415
|
+
const { fontProgram } = _m62;
|
|
10970
11416
|
|
|
10971
|
-
const { resolveScalar, selectFont, validateFonts } =
|
|
11417
|
+
const { resolveScalar, selectFont, validateFonts } = _m66;
|
|
10972
11418
|
|
|
10973
11419
|
/**
|
|
10974
11420
|
* Check one text run against the writer's selected font and scalar-layout rules.
|
|
@@ -11001,21 +11447,21 @@ function preflightPdfText(text, options = {}) {
|
|
|
11001
11447
|
return { supported: true };
|
|
11002
11448
|
}
|
|
11003
11449
|
const _exports = Object.freeze({ preflightPdfText: preflightPdfText });
|
|
11004
|
-
_modules.set("
|
|
11450
|
+
_modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86", _exports);
|
|
11005
11451
|
return _exports;
|
|
11006
11452
|
})();
|
|
11007
11453
|
|
|
11008
|
-
const _m53 = _modules.get("
|
|
11454
|
+
const _m53 = _modules.get("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c") ?? (() => {
|
|
11009
11455
|
|
|
11010
|
-
const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf:
|
|
11011
|
-
_modules.set("
|
|
11456
|
+
const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m83.writePdfDocument, writePdfDocumentTo: _m83.writePdfDocumentTo, pdfTable: _m83.pdfTable, PdfFont: _m62.PdfFont, preflightPdfText: _m92.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
|
|
11457
|
+
_modules.set("dcf6840f5eda4f8535cb4e226425587c2ae436c0eebfbd746aa0bc8a7acb6c4c", _exports);
|
|
11012
11458
|
return _exports;
|
|
11013
11459
|
})();
|
|
11014
11460
|
|
|
11015
|
-
const _m0 = _modules.get("
|
|
11461
|
+
const _m0 = _modules.get("2326f5920286bdb2ad00162f44943363623b3dd7175dc21d18d864aa4b52e4fc") ?? (() => {
|
|
11016
11462
|
|
|
11017
|
-
const _exports = Object.freeze({ core: _m1, zip: _m14, xml: _m17, opc: _m18, xlsx: _m21, csv: _m49, pdf: _m53, Workbook: _m21.Workbook, Worksheet: _m21.Worksheet, Cell: _m21.Cell, FormulaCell: _m21.FormulaCell, StyleRegistry: _m21.StyleRegistry, NumberFormats: _m21.NumberFormats, writeXlsx: _m21.writeXlsx, writeXlsxTo: _m21.writeXlsxTo, writeCsv: _m49.writeCsv, writeCsvTo: _m49.writeCsvTo, createGroupedReport: _m8.createGroupedReport, writeGroupedXlsx: _m47.writeGroupedXlsx, writeGroupedXlsxTo: _m47.writeGroupedXlsxTo, addGroupedXlsx: _m47.addGroupedXlsx, writeGroupedPdf:
|
|
11018
|
-
_modules.set("
|
|
11463
|
+
const _exports = Object.freeze({ core: _m1, zip: _m14, xml: _m17, opc: _m18, xlsx: _m21, csv: _m49, pdf: _m53, Workbook: _m21.Workbook, Worksheet: _m21.Worksheet, Cell: _m21.Cell, FormulaCell: _m21.FormulaCell, StyleRegistry: _m21.StyleRegistry, NumberFormats: _m21.NumberFormats, writeXlsx: _m21.writeXlsx, writeXlsxTo: _m21.writeXlsxTo, writeCsv: _m49.writeCsv, writeCsvTo: _m49.writeCsvTo, createGroupedReport: _m8.createGroupedReport, writeGroupedXlsx: _m47.writeGroupedXlsx, writeGroupedXlsxTo: _m47.writeGroupedXlsxTo, addGroupedXlsx: _m47.addGroupedXlsx, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, writePdf: _m53.writePdf, writePdfTo: _m53.writePdfTo, writePdfDocument: _m53.writePdfDocument, writePdfDocumentTo: _m53.writePdfDocumentTo, pdfTable: _m53.pdfTable, PdfFont: _m53.PdfFont, preflightPdfText: _m53.preflightPdfText, OfficeIMOError: _m1.OfficeIMOError, NotSupportedError: _m1.NotSupportedError, detectFeatures: _m1.detectFeatures, saveBlob: _m1.saveBlob, ExportCell: _m1.ExportCell });
|
|
11464
|
+
_modules.set("2326f5920286bdb2ad00162f44943363623b3dd7175dc21d18d864aa4b52e4fc", _exports);
|
|
11019
11465
|
return _exports;
|
|
11020
11466
|
})();
|
|
11021
11467
|
Object.assign(officeimo, _m0);
|