@evotecit/officeimo 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +43 -49
  2. package/bundles/officeimo-canopyx.js +1047 -193
  3. package/bundles/officeimo-canopyx.mjs +958 -111
  4. package/bundles/officeimo-csv.js +18 -15
  5. package/bundles/officeimo-csv.mjs +16 -13
  6. package/bundles/officeimo-datatables.js +249 -153
  7. package/bundles/officeimo-datatables.mjs +169 -73
  8. package/bundles/officeimo-pdf.js +151 -67
  9. package/bundles/officeimo-pdf.mjs +127 -43
  10. package/bundles/officeimo-xlsx.js +78 -69
  11. package/bundles/officeimo-xlsx.mjs +26 -17
  12. package/bundles/officeimo.js +249 -153
  13. package/bundles/officeimo.mjs +169 -73
  14. package/dist/csv/index.js +16 -13
  15. package/dist/integrations/canopyx/diagnostics.d.ts +3 -0
  16. package/dist/integrations/canopyx/diagnostics.js +17 -0
  17. package/dist/integrations/canopyx/grouping.d.ts +6 -0
  18. package/dist/integrations/canopyx/grouping.js +188 -0
  19. package/dist/integrations/canopyx/index.d.ts +2 -2
  20. package/dist/integrations/canopyx/index.js +72 -15
  21. package/dist/integrations/canopyx/metadata.d.ts +4 -0
  22. package/dist/integrations/canopyx/metadata.js +51 -0
  23. package/dist/integrations/canopyx/presentation.d.ts +8 -0
  24. package/dist/integrations/canopyx/presentation.js +40 -0
  25. package/dist/integrations/canopyx/rule-predicates.d.ts +3 -0
  26. package/dist/integrations/canopyx/rule-predicates.js +110 -0
  27. package/dist/integrations/canopyx/rules.d.ts +6 -0
  28. package/dist/integrations/canopyx/rules.js +176 -0
  29. package/dist/integrations/canopyx/source.js +24 -22
  30. package/dist/integrations/canopyx/types.d.ts +89 -8
  31. package/dist/integrations/canopyx/workbook.d.ts +6 -0
  32. package/dist/integrations/canopyx/workbook.js +52 -0
  33. package/dist/opc/index.js +14 -9
  34. package/dist/pdf/font-resources.js +33 -14
  35. package/dist/pdf/pages.js +63 -16
  36. package/dist/pdf/table-band-flow.js +7 -2
  37. package/dist/pdf/table-band-plan.js +9 -1
  38. package/dist/pdf/table-layout.js +6 -2
  39. package/dist/pdf/table-structure.js +9 -8
  40. package/dist/xlsx/workbook.js +7 -4
  41. package/dist/xlsx/worksheet.js +2 -1
  42. package/dist/xml/index.js +3 -3
  43. package/package.json +1 -1
@@ -455,12 +455,14 @@ _modules.set("8ece66b561682170c879991995105163f4c484c8355d5e451fc6f52a9fbc3f82",
455
455
  return _exports;
456
456
  })();
457
457
 
458
- const _m11 = _modules.get("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364") ?? (() => {
458
+ const _m11 = _modules.get("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585") ?? (() => {
459
459
  const { OfficeIMOError } = _m3;
460
460
 
461
461
  const { ChunkedTextSink } = _m5;
462
462
 
463
463
  const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
464
+ const xmlEscapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
465
+ "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
464
466
  /** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
465
467
  function cleanXml(value, policy = "strip") {
466
468
  if (policy !== "strip" && policy !== "reject")
@@ -472,9 +474,7 @@ function cleanXml(value, policy = "strip") {
472
474
  }
473
475
  /** Escape data, including whitespace that XML parsers otherwise normalize. */
474
476
  function escapeXml(value, policy = "strip") {
475
- const escapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
476
- "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
477
- return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
477
+ return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
478
478
  }
479
479
  /** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
480
480
  function escapeOoxmlAttribute(value, policy = "strip") {
@@ -533,7 +533,7 @@ class XmlWriter {
533
533
  throw new OfficeIMOError("INVALID_STATE", "XML writer is closed."); }
534
534
  }
535
535
  const _exports = Object.freeze({ xmlDeclaration: xmlDeclaration, cleanXml: cleanXml, escapeXml: escapeXml, escapeOoxmlAttribute: escapeOoxmlAttribute, validateXmlName: validateXmlName, XmlWriter: XmlWriter });
536
- _modules.set("2b85e926659d505b8142c9f8a4d8faf64a695a97dea19022031415c30e63d364", _exports);
536
+ _modules.set("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585", _exports);
537
537
  return _exports;
538
538
  })();
539
539
 
@@ -559,7 +559,7 @@ _modules.set("501f5fccaecb27d9e514b74cf64893649e50616692250593d120ca315b510c04",
559
559
  return _exports;
560
560
  })();
561
561
 
562
- const _m10 = _modules.get("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0") ?? (() => {
562
+ const _m10 = _modules.get("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a") ?? (() => {
563
563
  const { escapeXml, xmlDeclaration } = _m11;
564
564
 
565
565
  const { isDate } = _m12;
@@ -581,7 +581,7 @@ function appPropertiesXml(properties = {}, policy = "strip") {
581
581
  '<Application>' + escapeXml(properties.application ?? "OfficeIMO", policy) + '</Application><Company>' + escapeXml(properties.company ?? "", policy) + '</Company></Properties>';
582
582
  }
583
583
  const _exports = Object.freeze({ corePropertiesXml: corePropertiesXml, appPropertiesXml: appPropertiesXml });
584
- _modules.set("cd6fbdc4df9506c140f11083b3740d048b39c012670222001051b552dbc7bfb0", _exports);
584
+ _modules.set("56b2057461a668e8c90abd1fbf4f13ff93efd9854e590c82a195799f0f842c2a", _exports);
585
585
  return _exports;
586
586
  })();
587
587
 
@@ -1000,7 +1000,7 @@ _modules.set("699a019e0c3f317a62bf3a6e59b76b6cf1645908b0f1b1f157c18f4d4f368dfb",
1000
1000
  return _exports;
1001
1001
  })();
1002
1002
 
1003
- const _m8 = _modules.get("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f") ?? (() => {
1003
+ const _m8 = _modules.get("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5") ?? (() => {
1004
1004
 
1005
1005
 
1006
1006
 
@@ -1099,8 +1099,11 @@ class OpcPackage {
1099
1099
  return uri;
1100
1100
  }
1101
1101
  addPart(part) {
1102
- const uri = this.reserve(part.uri, part.contentType);
1103
- this.parts.set(uri.toLowerCase(), { ...part, uri, data: part.data instanceof Uint8Array ? new Uint8Array(part.data) : part.data });
1102
+ const { uri: requestedUri, contentType, data } = part;
1103
+ // Structural accessors and byte ownership are captured before reserving metadata.
1104
+ const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
1105
+ const uri = this.reserve(requestedUri, contentType);
1106
+ this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
1104
1107
  }
1105
1108
  /** @internal */
1106
1109
  addPrepared(uri, type, prepared) {
@@ -1125,17 +1128,19 @@ class OpcPackage {
1125
1128
  checkAbort(this.options.signal);
1126
1129
  this.open();
1127
1130
  source = source === "/" ? source : partUri(source);
1128
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(relationship.id))
1131
+ const { id, type, target: requestedTarget, external } = relationship;
1132
+ this.open();
1133
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
1129
1134
  throw new TypeError("Relationship id must be an XML ID.");
1130
- if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(relationship.type))
1135
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
1131
1136
  throw new TypeError("Relationship type must be an absolute URI.");
1132
- const target = relationship.external ? relationship.target : partUri(relationship.target);
1133
- if (relationship.external && (!target || /[\u0000-\u0020]/.test(target)))
1137
+ const target = external ? requestedTarget : partUri(requestedTarget);
1138
+ if (external && (!target || /[\u0000-\u0020]/.test(target)))
1134
1139
  throw new TypeError("Invalid external relationship target.");
1135
1140
  const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
1136
- if (list.has(relationship.id))
1137
- throw new TypeError("Duplicate relationship id: " + relationship.id);
1138
- list.set(relationship.id, { ...relationship, target });
1141
+ if (list.has(id))
1142
+ throw new TypeError("Duplicate relationship id: " + id);
1143
+ list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
1139
1144
  this.relationships.set(key, list);
1140
1145
  }
1141
1146
  setProperties(core = {}, app = {}) {
@@ -1245,7 +1250,7 @@ class OpcPackage {
1245
1250
  }
1246
1251
  }
1247
1252
  const _exports = Object.freeze({ partUri: _m9.partUri, relationshipPartUri: _m9.relationshipPartUri, relativePartTarget: _m9.relativePartTarget, corePropertiesXml: _m10.corePropertiesXml, appPropertiesXml: _m10.appPropertiesXml, relationshipsNamespace: relationshipsNamespace, officeRelationshipsNamespace: officeRelationshipsNamespace, contentTypesNamespace: contentTypesNamespace, relationshipTypes: relationshipTypes, ContentTypes: ContentTypes, OpcPackage: OpcPackage });
1248
- _modules.set("3bedb42cf4cced6fffb6c1b9e798b93ccb70159cf6cfc582237e723187cc465f", _exports);
1253
+ _modules.set("4d4856357f94ecbeea67d111ff5e97f916ccc6be6aaefde219d461c6ad10a8c5", _exports);
1249
1254
  return _exports;
1250
1255
  })();
1251
1256
 
@@ -1261,7 +1266,7 @@ _modules.set("204def412284dfb11df9aececd57c8c0455db2927ebdb483dd255e7b29f6f359",
1261
1266
  return _exports;
1262
1267
  })();
1263
1268
 
1264
- const _m18 = _modules.get("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae") ?? (() => {
1269
+ const _m18 = _modules.get("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148") ?? (() => {
1265
1270
  const { OfficeIMOError } = _m3;
1266
1271
 
1267
1272
  const { cleanXml, escapeOoxmlAttribute } = _m11;
@@ -1368,11 +1373,11 @@ function differentialXml(style, policy, numberFormat) {
1368
1373
  return xml;
1369
1374
  }
1370
1375
  const _exports = Object.freeze({ fields: fields, optionalBoolean: optionalBoolean, DifferentialStyles: DifferentialStyles, differentialXml: differentialXml });
1371
- _modules.set("2c814aac0c36fa7d9a1fb54d327695a3655309ef22db0c10974813f8f9d4d6ae", _exports);
1376
+ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148", _exports);
1372
1377
  return _exports;
1373
1378
  })();
1374
1379
 
1375
- const _m16 = _modules.get("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e") ?? (() => {
1380
+ const _m16 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
1376
1381
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m11;
1377
1382
 
1378
1383
  const { OfficeIMOError } = _m3;
@@ -1582,7 +1587,7 @@ class StyleRegistry {
1582
1587
  }
1583
1588
  }
1584
1589
  const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1585
- _modules.set("a4ad9a4388ed41b6b7ce4f5a20c44598082db5adc307e96d12de2840e9508d7e", _exports);
1590
+ _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
1586
1591
  return _exports;
1587
1592
  })();
1588
1593
 
@@ -1673,7 +1678,7 @@ _modules.set("732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5",
1673
1678
  return _exports;
1674
1679
  })();
1675
1680
 
1676
- const _m22 = _modules.get("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429") ?? (() => {
1681
+ const _m22 = _modules.get("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93") ?? (() => {
1677
1682
  const { NotSupportedError } = _m3;
1678
1683
 
1679
1684
  const { cleanXml, escapeXml } = _m11;
@@ -1781,7 +1786,7 @@ function formulaXml(cell) {
1781
1786
  return "<f>" + escapeXml(cell.formula, "reject") + "</f><v>" + (cell.cachedValue ?? "") + "</v>";
1782
1787
  }
1783
1788
  const _exports = Object.freeze({ FormulaCell: FormulaCell, isSubtotalFormula: isSubtotalFormula, formulaXml: formulaXml });
1784
- _modules.set("bf52f9d5aae9685c7fc71f3e5d6cf248beef190df1f28f89d27617e1c2023429", _exports);
1789
+ _modules.set("f1de2157d2aefa347a314940eb7f89c16545e11f69923920e605409433742f93", _exports);
1785
1790
  return _exports;
1786
1791
  })();
1787
1792
 
@@ -1807,7 +1812,7 @@ _modules.set("e95bb0e3f342d1379b67a3d541fa808e06361da8460169a6aec152ee7deb69b2",
1807
1812
  return _exports;
1808
1813
  })();
1809
1814
 
1810
- const _m19 = _modules.get("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed") ?? (() => {
1815
+ const _m19 = _modules.get("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4") ?? (() => {
1811
1816
  const { cleanXml, escapeXml } = _m11;
1812
1817
 
1813
1818
  const { assertExportValue, assertScalar } = _m20;
@@ -1900,7 +1905,7 @@ function excelDate(date, mode) {
1900
1905
  return (time - Date.UTC(1899, 11, 31)) / 86400000 + (time >= Date.UTC(1900, 2, 1) ? 1 : 0);
1901
1906
  }
1902
1907
  const _exports = Object.freeze({ Cell: Cell, assertXlsxValue: assertXlsxValue, copyValue: copyValue, cellText: cellText, inlineText: inlineText, columnName: columnName, sheetName: sheetName, excelDate: excelDate });
1903
- _modules.set("597ac0803c83556e97bf37d53e2a3aef4351032669f740ebcf8a06369bf940ed", _exports);
1908
+ _modules.set("4bce839e90e3ef590aa1b224ffd9c4bdf24d7639b93bdf879f9a0d79de4cd0e4", _exports);
1904
1909
  return _exports;
1905
1910
  })();
1906
1911
 
@@ -2057,7 +2062,7 @@ _modules.set("d56b24243cff6f3552a2f7b45521af4491494375ec76117e9ac1ebb047ce02da",
2057
2062
  return _exports;
2058
2063
  })();
2059
2064
 
2060
- const _m28 = _modules.get("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622") ?? (() => {
2065
+ const _m28 = _modules.get("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5") ?? (() => {
2061
2066
  const { ChunkedTextSink } = _m5;
2062
2067
 
2063
2068
  const { escapeXml, xmlDeclaration } = _m11;
@@ -2166,11 +2171,11 @@ async function writeChartXml(chart, destination, policy, signal) {
2166
2171
  await text.close();
2167
2172
  }
2168
2173
  const _exports = Object.freeze({ chartNamespace: chartNamespace, chartContentType: chartContentType, chartAnchorXml: chartAnchorXml, writeChartXml: writeChartXml });
2169
- _modules.set("abbe9e1ad9c0a68c86d0f20348fd324b7eef48b857c0bd9aa04e8959a7e70622", _exports);
2174
+ _modules.set("84c16159c55cf4c0af5d3c67510302694946ae99c6c685fc09314069ee3da5c5", _exports);
2170
2175
  return _exports;
2171
2176
  })();
2172
2177
 
2173
- const _m27 = _modules.get("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8") ?? (() => {
2178
+ const _m27 = _modules.get("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4") ?? (() => {
2174
2179
  const { cleanXml, escapeXml, escapeOoxmlAttribute, xmlDeclaration } = _m11;
2175
2180
 
2176
2181
  const { copyExportLink } = _m21;
@@ -2244,11 +2249,11 @@ function drawingXml(images, policy, charts = []) {
2244
2249
  }
2245
2250
  const drawingContentType = "application/vnd.openxmlformats-officedocument.drawing+xml";
2246
2251
  const _exports = Object.freeze({ copyDrawingAnchor: copyDrawingAnchor, cellPosition: cellPosition, copyHyperlink: copyHyperlink, copyImage: copyImage, hyperlinksXml: hyperlinksXml, drawingXml: drawingXml, drawingContentType: drawingContentType });
2247
- _modules.set("0afdc9d464a68ac5ace8863d7c6e25862748c96faa03ed7b8e46402515a552b8", _exports);
2252
+ _modules.set("9d4496a1ff3d58ac0b9dcd7304e6861184df30700c344329157899639df7b5e4", _exports);
2248
2253
  return _exports;
2249
2254
  })();
2250
2255
 
2251
- const _m30 = _modules.get("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a") ?? (() => {
2256
+ const _m30 = _modules.get("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc") ?? (() => {
2252
2257
  const { OfficeIMOError } = _m3;
2253
2258
 
2254
2259
  const { cellPosition } = _m27;
@@ -2349,7 +2354,7 @@ class MergeRegions {
2349
2354
  throw new RangeError("Merged ranges must stay within exported rows."); }
2350
2355
  }
2351
2356
  const _exports = Object.freeze({ MergeRegions: MergeRegions });
2352
- _modules.set("e2e414a8ba22e778a769375327988cd080347bbbc863673a702e1dcfa6e9112a", _exports);
2357
+ _modules.set("4c91e257806f805b473340527db7ce3404c98ac27db0a775ff047dc3dded10cc", _exports);
2353
2358
  return _exports;
2354
2359
  })();
2355
2360
 
@@ -2401,7 +2406,7 @@ _modules.set("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b",
2401
2406
  return _exports;
2402
2407
  })();
2403
2408
 
2404
- const _m32 = _modules.get("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292") ?? (() => {
2409
+ const _m32 = _modules.get("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360") ?? (() => {
2405
2410
  const { ExportCell } = _m20;
2406
2411
 
2407
2412
  const { tableSpans } = _m25;
@@ -2434,11 +2439,11 @@ class StructuredRows {
2434
2439
  }
2435
2440
  }
2436
2441
  const _exports = Object.freeze({ StructuredRows: StructuredRows });
2437
- _modules.set("ac538bedcdc7144616b2777232e7049d2fd6449a087017fd9c10d31e0f86b292", _exports);
2442
+ _modules.set("47efdc8f108b0e995accdd63fd1addea0e4de507010cbf0975417e7151636360", _exports);
2438
2443
  return _exports;
2439
2444
  })();
2440
2445
 
2441
- const _m29 = _modules.get("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5") ?? (() => {
2446
+ const _m29 = _modules.get("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81") ?? (() => {
2442
2447
  const { ExportCell } = _m20;
2443
2448
 
2444
2449
  const { isDate } = _m12;
@@ -2635,11 +2640,11 @@ function printXml(options, policy) {
2635
2640
  (options.footer === undefined ? "" : '<oddFooter>' + escapeOoxmlAttribute("&C" + options.footer.replace(/&/g, "&&"), policy) + '</oddFooter>') + '</headerFooter>' : "");
2636
2641
  }
2637
2642
  const _exports = Object.freeze({ ComputedTotal: ComputedTotal, ReportLayout: ReportLayout, totalFormula: totalFormula, printXml: printXml });
2638
- _modules.set("47c0c236e4ae7b71726d1d7ebe0d2df8f0eb9204b3865adf34b5163f720d4bd5", _exports);
2643
+ _modules.set("23615ba776e7025e5e40cde325ad13799a7eeae6c88cb2ed74395222f91e6a81", _exports);
2639
2644
  return _exports;
2640
2645
  })();
2641
2646
 
2642
- const _m34 = _modules.get("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732") ?? (() => {
2647
+ const _m34 = _modules.get("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491") ?? (() => {
2643
2648
  const { columnName } = _m19;
2644
2649
 
2645
2650
  /** @internal Data-column selectors use stable keys or one-based worksheet columns. */
@@ -2666,11 +2671,11 @@ function qualifiedCell(sheetName, column, row) {
2666
2671
  return qualifiedColumnRange(sheetName, column, row, 1).split(":")[0];
2667
2672
  }
2668
2673
  const _exports = Object.freeze({ resolveDataColumn: resolveDataColumn, qualifiedColumnRange: qualifiedColumnRange, qualifiedCell: qualifiedCell });
2669
- _modules.set("93ad877d48a12898018a8842f86e9c1a073ae9d16e4ddbdf0de422fdb7567732", _exports);
2674
+ _modules.set("7845d79cd22590bbefc767802abfe3f805e8f68807521cef8d07ecc42db0b491", _exports);
2670
2675
  return _exports;
2671
2676
  })();
2672
2677
 
2673
- const _m35 = _modules.get("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad") ?? (() => {
2678
+ const _m35 = _modules.get("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35") ?? (() => {
2674
2679
  const { OfficeIMOError } = _m3;
2675
2680
 
2676
2681
  const { columnName } = _m19;
@@ -2713,11 +2718,11 @@ function dataRowReference(firstColumn, lastColumn, headerRows, dataRows, ranges)
2713
2718
  return reference || undefined;
2714
2719
  }
2715
2720
  const _exports = Object.freeze({ retainDataRowRanges: retainDataRowRanges, dataRowRanges: dataRowRanges, dataRowCount: dataRowCount, dataRowReference: dataRowReference });
2716
- _modules.set("e988da1cd05e9b574b66f0b3e28e40168bcc06e9ec1cdb023e42f358770b7fad", _exports);
2721
+ _modules.set("4892a7dafefc4d82567cd2bd4cc8da5470cee4dbf546e6473f782f44bd4bbe35", _exports);
2717
2722
  return _exports;
2718
2723
  })();
2719
2724
 
2720
- const _m33 = _modules.get("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6") ?? (() => {
2725
+ const _m33 = _modules.get("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118") ?? (() => {
2721
2726
  const { cleanXml, escapeXml, escapeOoxmlAttribute } = _m11;
2722
2727
 
2723
2728
  const { cellPosition } = _m27;
@@ -2883,11 +2888,11 @@ class ConditionalFormats {
2883
2888
  }
2884
2889
  }
2885
2890
  const _exports = Object.freeze({ prepareConditionalFormats: prepareConditionalFormats, ConditionalFormats: ConditionalFormats });
2886
- _modules.set("f1cb0c25677191521382757695257e846c3da2c5657cd5b640aea352094162e6", _exports);
2891
+ _modules.set("736b2b2fc3489642263dbaf677544e8a270eea6b8efb0cc26c67346e66cab118", _exports);
2887
2892
  return _exports;
2888
2893
  })();
2889
2894
 
2890
- const _m36 = _modules.get("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257") ?? (() => {
2895
+ const _m36 = _modules.get("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61") ?? (() => {
2891
2896
  const { OfficeIMOError } = _m3;
2892
2897
 
2893
2898
  const { checkAbort } = _m2;
@@ -2987,11 +2992,11 @@ function* dataValidationsXml(prepared, headerRows, dataRows, ranges) {
2987
2992
  yield '</dataValidations>';
2988
2993
  }
2989
2994
  const _exports = Object.freeze({ prepareDataValidations: prepareDataValidations, dataValidationsXml: dataValidationsXml });
2990
- _modules.set("cf47c14a3d20ea8306932e3174606385830dd257bdb9ffac8c5114724b4d9257", _exports);
2995
+ _modules.set("860c88d97ba76e8713c14d56967152e369d2f08f50ffada68827a9c220881c61", _exports);
2991
2996
  return _exports;
2992
2997
  })();
2993
2998
 
2994
- const _m26 = _modules.get("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4") ?? (() => {
2999
+ const _m26 = _modules.get("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4") ?? (() => {
2995
3000
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m2;
2996
3001
 
2997
3002
  const { ChunkedTextSink, BlobByteSink } = _m5;
@@ -3271,7 +3276,8 @@ class Worksheet {
3271
3276
  });
3272
3277
  const originalCharacters = typeof value === "string" ? value.length : 0;
3273
3278
  let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
3274
- if (type === "string" && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3279
+ // Cleaning removes characters; ordinary strings cannot cross Excel's limit.
3280
+ if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3275
3281
  const cell = col.letter + row;
3276
3282
  if (link || this.linkedCells.has(cell))
3277
3283
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
@@ -3713,11 +3719,11 @@ class Worksheet {
3713
3719
  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); }
3714
3720
  }
3715
3721
  const _exports = Object.freeze({ Worksheet: Worksheet });
3716
- _modules.set("03e235a81010f60bce2d7cc02a313dd95b5b2b77d09535b160ae02a3556c55b4", _exports);
3722
+ _modules.set("b99287e3e329b75007119103112a699c368d8237b37fa79e083b0014a21952e4", _exports);
3717
3723
  return _exports;
3718
3724
  })();
3719
3725
 
3720
- const _m37 = _modules.get("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0") ?? (() => {
3726
+ const _m37 = _modules.get("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a") ?? (() => {
3721
3727
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m11;
3722
3728
 
3723
3729
  const { cellText, columnName } = _m19;
@@ -3760,11 +3766,11 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
3760
3766
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
3761
3767
  }
3762
3768
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
3763
- _modules.set("69b817e85a5cf991b2c75390de7cfb5657f53786c2bf2221e310d489f4e50fa0", _exports);
3769
+ _modules.set("7f1b6bb321e8055ba5269c0fe0933cf02f9a4ce269d3b8e4a64cc63d8398954a", _exports);
3764
3770
  return _exports;
3765
3771
  })();
3766
3772
 
3767
- const _m38 = _modules.get("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb") ?? (() => {
3773
+ const _m38 = _modules.get("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92") ?? (() => {
3768
3774
  const { OfficeIMOError } = _m3;
3769
3775
 
3770
3776
  const { cleanXml } = _m11;
@@ -3828,7 +3834,7 @@ function* splitText(text) {
3828
3834
  }
3829
3835
  }
3830
3836
  const _exports = Object.freeze({ TextOverflow: TextOverflow, clipText: clipText });
3831
- _modules.set("326038be5df97f3a5a5909d06720e4b63162b0f69961c79600f915e768bd41fb", _exports);
3837
+ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92", _exports);
3832
3838
  return _exports;
3833
3839
  })();
3834
3840
 
@@ -3855,7 +3861,7 @@ _modules.set("e00bc0213b723678d050e3e1f11b39ed3d6b0b0fd6a39b403beb1a6bef69e282",
3855
3861
  return _exports;
3856
3862
  })();
3857
3863
 
3858
- const _m41 = _modules.get("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc") ?? (() => {
3864
+ const _m41 = _modules.get("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494") ?? (() => {
3859
3865
  const { checkAbort } = _m2;
3860
3866
 
3861
3867
  const { NotSupportedError, OfficeIMOError } = _m3;
@@ -3983,11 +3989,11 @@ function prepareChartBinding(input, descriptor, budgets, signal, type = "columnC
3983
3989
  }, finish });
3984
3990
  }
3985
3991
  const _exports = Object.freeze({ captureChartRange: captureChartRange, prepareChartBinding: prepareChartBinding });
3986
- _modules.set("5fcd8ab43752d758bd1b311eae9378643c828dfca1de2875b2bd5f16fc8b4abc", _exports);
3992
+ _modules.set("35db01801a6b2e3e0c5acd7493e56f04b5b41b1d57afa8be28b8358378ad6494", _exports);
3987
3993
  return _exports;
3988
3994
  })();
3989
3995
 
3990
- const _m40 = _modules.get("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76") ?? (() => {
3996
+ const _m40 = _modules.get("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219") ?? (() => {
3991
3997
  const { checkAbort } = _m2;
3992
3998
 
3993
3999
  const { NotSupportedError, OfficeIMOError } = _m3;
@@ -4154,11 +4160,11 @@ function prepareChart(input, policy, availablePoints, availableText, signal, res
4154
4160
  points, textCharacters });
4155
4161
  }
4156
4162
  const _exports = Object.freeze({ prepareChart: prepareChart });
4157
- _modules.set("28c1f1e37db546192ff92887f5cf59224cf6b98370eb79848e428946a7000e76", _exports);
4163
+ _modules.set("6ff482aba6cf0b524cf20f6a4f8af16b842a49f36448b14e73beaf838885d219", _exports);
4158
4164
  return _exports;
4159
4165
  })();
4160
4166
 
4161
- const _m1 = _modules.get("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c") ?? (() => {
4167
+ const _m1 = _modules.get("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681") ?? (() => {
4162
4168
  const { beginTask, checkAbort, pause, taskYieldDue } = _m2;
4163
4169
 
4164
4170
  const { OfficeIMOError } = _m3;
@@ -4497,12 +4503,15 @@ class Workbook {
4497
4503
  });
4498
4504
  }
4499
4505
  addPart(part) {
4506
+ this.assertOpen();
4507
+ const { uri, contentType, data, relationship } = part;
4508
+ const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
4500
4509
  this.assertOpen();
4501
4510
  // Reserve now so collisions and invalid names fail at the call site.
4502
- this.package.addPart(part);
4503
- if (part.relationship) {
4504
- const { source, ...rel } = part.relationship;
4505
- this.package.addRelationship(source ?? "/xl/workbook.xml", { ...rel, target: part.uri });
4511
+ this.package.addPart({ uri, contentType, data });
4512
+ if (capturedRelationship) {
4513
+ const { source, id, type } = capturedRelationship;
4514
+ this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
4506
4515
  }
4507
4516
  }
4508
4517
  /** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
@@ -4633,7 +4642,7 @@ class Workbook {
4633
4642
  }
4634
4643
  }
4635
4644
  const _exports = Object.freeze({ Workbook: Workbook });
4636
- _modules.set("982718d202723335e72aab0c32adf982f3bdaba804612744478ab794f3c9386c", _exports);
4645
+ _modules.set("0f11efc0d52501e827898643b33f7fa42365115a892aa801634ecea3f3603681", _exports);
4637
4646
  return _exports;
4638
4647
  })();
4639
4648
 
@@ -4690,7 +4699,7 @@ _modules.set("89111eab1f3857529c2d0cd849f16598097e62bd73841211b9c66ccc7b1b7ca2",
4690
4699
  return _exports;
4691
4700
  })();
4692
4701
 
4693
- const _m42 = _modules.get("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339") ?? (() => {
4702
+ const _m42 = _modules.get("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308") ?? (() => {
4694
4703
  const { withDestination } = _m5;
4695
4704
 
4696
4705
  const { copyColumns } = _m24;
@@ -4745,7 +4754,7 @@ async function writeXlsxTo(rows, destination, configuration) {
4745
4754
  });
4746
4755
  }
4747
4756
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
4748
- _modules.set("59ef9ad8736be48605a1d5005a096b977be8e44c0d2a4249345127b2b7f81339", _exports);
4757
+ _modules.set("8d425cd3abec2c5e0140f71239bbeacbae0e57524ed70a8e545f80286c4a1308", _exports);
4749
4758
  return _exports;
4750
4759
  })();
4751
4760
 
@@ -5015,7 +5024,7 @@ _modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0",
5015
5024
  return _exports;
5016
5025
  })();
5017
5026
 
5018
- const _m46 = _modules.get("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b") ?? (() => {
5027
+ const _m46 = _modules.get("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f") ?? (() => {
5019
5028
  const { assertGroupedReportSource } = _m45;
5020
5029
 
5021
5030
  const { captureFields } = _m7;
@@ -5104,11 +5113,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5104
5113
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5105
5114
  }
5106
5115
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5107
- _modules.set("de7c4720443cbafe0e11a1142f952c4977c47158c42f0a20704db65e3a19bf8b", _exports);
5116
+ _modules.set("02f1b8fe9368420b22d79efc01f2b37794fc40aaf8150161b3b7623fcdc0d71f", _exports);
5108
5117
  return _exports;
5109
5118
  })();
5110
5119
 
5111
- const _m44 = _modules.get("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0") ?? (() => {
5120
+ const _m44 = _modules.get("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e") ?? (() => {
5112
5121
  const { groupedReportOperation } = _m45;
5113
5122
 
5114
5123
  const { checkAbort, withAbort } = _m2;
@@ -5281,7 +5290,7 @@ async function writeGroupedXlsxTo(report, destination, options) {
5281
5290
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5282
5291
  }
5283
5292
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5284
- _modules.set("50d544d4c980d1a8f6a81b2d3e376bf92bed5c415a275b6eacacdb86b15d57b0", _exports);
5293
+ _modules.set("6b646c4d57b8f8f452eaa7e61d2935bab09681aceb6064b8600bf73ca10b8f4e", _exports);
5285
5294
  return _exports;
5286
5295
  })();
5287
5296
 
@@ -5334,10 +5343,10 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
5334
5343
  return _exports;
5335
5344
  })();
5336
5345
 
5337
- const _m0 = _modules.get("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e") ?? (() => {
5346
+ const _m0 = _modules.get("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195") ?? (() => {
5338
5347
 
5339
5348
  const _exports = Object.freeze({ Workbook: _m1.Workbook, writeXlsx: _m42.writeXlsx, writeXlsxTo: _m42.writeXlsxTo, writeGroupedXlsx: _m44.writeGroupedXlsx, writeGroupedXlsxTo: _m44.writeGroupedXlsxTo, addGroupedXlsx: _m44.addGroupedXlsx, createGroupedReport: _m45.createGroupedReport, Worksheet: _m26.Worksheet, Cell: _m19.Cell, FormulaCell: _m22.FormulaCell, StyleRegistry: _m16.StyleRegistry, NumberFormats: _m16.NumberFormats, saveBlob: _m47.saveBlob, ExportCell: _m20.ExportCell });
5340
- _modules.set("d494060a59e45633a76ad2e4aeb08b6ffbc730ce6c4d50686aa4e3a51ad0ed6e", _exports);
5349
+ _modules.set("9fbdb5c6f6af75d87ac6cb47771fe48fa6527be2cb7d16dbad56e4213e2f7195", _exports);
5341
5350
  return _exports;
5342
5351
  })();
5343
5352
  Object.assign(officeimo, _m0, { core: _m47, zip: _m13, xml: _m11, opc: _m8, xlsx: _m0 });
@@ -448,6 +448,8 @@ const { OfficeIMOError } = _m3;
448
448
  const { ChunkedTextSink } = _m5;
449
449
 
450
450
  const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
451
+ const xmlEscapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
452
+ "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
451
453
  /** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
452
454
  function cleanXml(value, policy = "strip") {
453
455
  if (policy !== "strip" && policy !== "reject")
@@ -459,9 +461,7 @@ function cleanXml(value, policy = "strip") {
459
461
  }
460
462
  /** Escape data, including whitespace that XML parsers otherwise normalize. */
461
463
  function escapeXml(value, policy = "strip") {
462
- const escapes = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;",
463
- "\r": "&#13;", "\n": "&#10;", "\t": "&#9;" };
464
- return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
464
+ return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
465
465
  }
466
466
  /** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
467
467
  function escapeOoxmlAttribute(value, policy = "strip") {
@@ -1080,8 +1080,11 @@ class OpcPackage {
1080
1080
  return uri;
1081
1081
  }
1082
1082
  addPart(part) {
1083
- const uri = this.reserve(part.uri, part.contentType);
1084
- this.parts.set(uri.toLowerCase(), { ...part, uri, data: part.data instanceof Uint8Array ? new Uint8Array(part.data) : part.data });
1083
+ const { uri: requestedUri, contentType, data } = part;
1084
+ // Structural accessors and byte ownership are captured before reserving metadata.
1085
+ const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
1086
+ const uri = this.reserve(requestedUri, contentType);
1087
+ this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
1085
1088
  }
1086
1089
  /** @internal */
1087
1090
  addPrepared(uri, type, prepared) {
@@ -1106,17 +1109,19 @@ class OpcPackage {
1106
1109
  checkAbort(this.options.signal);
1107
1110
  this.open();
1108
1111
  source = source === "/" ? source : partUri(source);
1109
- if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(relationship.id))
1112
+ const { id, type, target: requestedTarget, external } = relationship;
1113
+ this.open();
1114
+ if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
1110
1115
  throw new TypeError("Relationship id must be an XML ID.");
1111
- if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(relationship.type))
1116
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
1112
1117
  throw new TypeError("Relationship type must be an absolute URI.");
1113
- const target = relationship.external ? relationship.target : partUri(relationship.target);
1114
- if (relationship.external && (!target || /[\u0000-\u0020]/.test(target)))
1118
+ const target = external ? requestedTarget : partUri(requestedTarget);
1119
+ if (external && (!target || /[\u0000-\u0020]/.test(target)))
1115
1120
  throw new TypeError("Invalid external relationship target.");
1116
1121
  const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
1117
- if (list.has(relationship.id))
1118
- throw new TypeError("Duplicate relationship id: " + relationship.id);
1119
- list.set(relationship.id, { ...relationship, target });
1122
+ if (list.has(id))
1123
+ throw new TypeError("Duplicate relationship id: " + id);
1124
+ list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
1120
1125
  this.relationships.set(key, list);
1121
1126
  }
1122
1127
  setProperties(core = {}, app = {}) {
@@ -3231,7 +3236,8 @@ class Worksheet {
3231
3236
  });
3232
3237
  const originalCharacters = typeof value === "string" ? value.length : 0;
3233
3238
  let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
3234
- if (type === "string" && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3239
+ // Cleaning removes characters; ordinary strings cannot cross Excel's limit.
3240
+ if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
3235
3241
  const cell = col.letter + row;
3236
3242
  if (link || this.linkedCells.has(cell))
3237
3243
  throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
@@ -4451,12 +4457,15 @@ class Workbook {
4451
4457
  });
4452
4458
  }
4453
4459
  addPart(part) {
4460
+ this.assertOpen();
4461
+ const { uri, contentType, data, relationship } = part;
4462
+ const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
4454
4463
  this.assertOpen();
4455
4464
  // Reserve now so collisions and invalid names fail at the call site.
4456
- this.package.addPart(part);
4457
- if (part.relationship) {
4458
- const { source, ...rel } = part.relationship;
4459
- this.package.addRelationship(source ?? "/xl/workbook.xml", { ...rel, target: part.uri });
4465
+ this.package.addPart({ uri, contentType, data });
4466
+ if (capturedRelationship) {
4467
+ const { source, id, type } = capturedRelationship;
4468
+ this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
4460
4469
  }
4461
4470
  }
4462
4471
  /** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */