@a3s-lab/office 0.11.0 → 0.13.0

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 (122) hide show
  1. package/README.md +121 -6
  2. package/dist/0~1403.js +20 -12
  3. package/dist/0~2805.js +241 -241
  4. package/dist/0~4980.js +1 -1
  5. package/dist/0~5050.js +1 -20
  6. package/dist/0~5093.js +547 -547
  7. package/dist/0~7048.js +31 -29
  8. package/dist/0~document-editor.js +694 -90
  9. package/dist/0~pdf-viewer.js +41 -10
  10. package/dist/0~presentation-editor.js +8 -6
  11. package/dist/0~spreadsheet-editor.js +4272 -2753
  12. package/dist/0~work-document-import-worker-client.js +237 -0
  13. package/dist/0~work-docx-export.js +1 -1
  14. package/dist/0~work-docx-import.js +3 -3
  15. package/dist/0~work-docx-large-document-import.js +559 -0
  16. package/dist/0~work-office-diagnostics.js +51 -35
  17. package/dist/0~work-pptx-import.js +2 -2
  18. package/dist/4104.js +4127 -3037
  19. package/dist/432.js +51 -7
  20. package/dist/4476.js +280 -69
  21. package/dist/5184.js +24 -2
  22. package/dist/{8928.js → 6282.js} +2338 -93
  23. package/dist/8715.js +1201 -1156
  24. package/dist/9356.js +128 -8
  25. package/dist/core.d.ts +1 -0
  26. package/dist/core.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
  29. package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
  30. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
  31. package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
  32. package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
  33. package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
  34. package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
  35. package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
  36. package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
  37. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +14 -0
  38. package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
  39. package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
  40. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
  41. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +159 -0
  42. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +8 -4
  43. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -1
  44. package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
  45. package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
  46. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
  47. package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
  48. package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
  49. package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
  50. package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +2 -1
  51. package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
  52. package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
  53. package/dist/internal/features/work/spreadsheet-sparse.d.ts +10 -0
  54. package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
  55. package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
  56. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  57. package/dist/internal/features/work/work-document-file-io.d.ts +2 -1
  58. package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
  59. package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
  60. package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
  61. package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
  62. package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
  63. package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
  64. package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
  65. package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
  66. package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
  67. package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
  68. package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
  69. package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
  70. package/dist/internal/features/work/work-document-model.d.ts +18 -2
  71. package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
  72. package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
  73. package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
  74. package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
  75. package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
  76. package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
  77. package/dist/internal/features/work/work-docx-import.d.ts +2 -1
  78. package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
  79. package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
  80. package/dist/internal/features/work/work-file-data.d.ts +7 -1
  81. package/dist/internal/features/work/work-file-import.d.ts +33 -0
  82. package/dist/internal/features/work/work-file-io.d.ts +5 -4
  83. package/dist/internal/features/work/work-file-kind.d.ts +5 -0
  84. package/dist/internal/features/work/work-markdown-file-io.d.ts +2 -1
  85. package/dist/internal/features/work/work-office-diagnostics.d.ts +12 -2
  86. package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
  87. package/dist/internal/features/work/work-pptx-import.d.ts +1 -1
  88. package/dist/internal/features/work/work-presentation-file-io.d.ts +2 -1
  89. package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
  90. package/dist/internal/features/work/work-repository.d.ts +1 -0
  91. package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
  92. package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
  93. package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
  94. package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
  95. package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
  96. package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
  97. package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
  98. package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
  99. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
  100. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
  101. package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
  102. package/dist/internal/features/work/work-spreadsheet-protection.d.ts +2 -0
  103. package/dist/internal/features/work/work-types.d.ts +22 -0
  104. package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
  105. package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
  106. package/dist/internal/features/work/work-xlsx-interop.d.ts +8 -17
  107. package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
  108. package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
  109. package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
  110. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +12 -0
  111. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
  112. package/dist/office-kernel.wasm +0 -0
  113. package/dist/office-kernel.worker.js +31 -29
  114. package/dist/react.d.ts +7 -1
  115. package/dist/styles.css +440 -3
  116. package/dist/work-document-import.worker.js +558 -0
  117. package/dist/work-spreadsheet-import.worker.js +24745 -0
  118. package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
  119. package/dist/work-spreadsheet-package-scan.worker.js +4157 -0
  120. package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
  121. package/docs/latest/en/browser-editor-architecture.md +351 -15
  122. package/package.json +26 -4
@@ -1,12 +1,19 @@
1
- import { descendants, directChildren, directChild, OoxmlPackage, attribute, firstDescendant, contentTypeForPart } from "./5184.js";
2
- import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, isDocumentParagraphArtBorderStyle, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./8928.js";
1
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
2
+ import { contentTypeForPart, directChildren, OoxmlPackage, parseXml, firstDescendant, descendants, directChild, xmlContainsAnyElement, attribute } from "./5184.js";
3
+ import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, isDocumentParagraphArtBorderStyle, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./6282.js";
3
4
  import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~5093.js";
4
5
  import { normalizeDocumentHref } from "./0~work-document-links.js";
5
6
  import { xmlAttributeLocalName, parseDocxParagraphDefaultCollapsed, readDocxBibliography, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, createDocxThemeResolver } from "./0~2805.js";
6
- import { isSupportedXlsxCombinationChartNodes, MAX_XLSX_WORKSHEET_IMAGE_BYTES, inspectXlsxPivotTables, isSupportedXlsxWorksheetImageContentType, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, isEditableXlsxPaperSizeCode, diagnoseXlsxProtection, xlsxChartSeriesFormattingShapeProperties } from "./4104.js";
7
+ import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary, xlsxChartSeriesFormattingShapeProperties, MAX_XLSX_WORKSHEET_IMAGE_BYTES, isSupportedXlsxWorksheetImageContentType, xlsxWorksheetCellEntries, diagnoseXlsxProtection, isEditableXlsxPaperSizeCode, isSupportedXlsxCombinationChartNodes } from "./4104.js";
7
8
  import { spreadsheetConditionalComparisonNeedsUpperValue, isSpreadsheetConditionalIconSetName, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconSetCount } from "./4476.js";
8
9
  import { formulaHasStructuredReference, formulaHasExternalReference, parseSpreadsheetPrintTitles, volatileSpreadsheetFormulaFunctions, stripSpreadsheetSheetQualifier } from "./8715.js";
9
10
  import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
11
+ var work_office_diagnostics_namespaceObject = {};
12
+ __webpack_require__.r(work_office_diagnostics_namespaceObject);
13
+ __webpack_require__.d(work_office_diagnostics_namespaceObject, {
14
+ analyzeDocxCompatibility: ()=>analyzeDocxCompatibility,
15
+ analyzeSpreadsheetCompatibility: ()=>analyzeSpreadsheetCompatibility
16
+ });
10
17
  async function diagnoseDocxBookmarksAndLinks(archive, document) {
11
18
  const starts = descendants(document, 'bookmarkStart');
12
19
  const ends = descendants(document, 'bookmarkEnd');
@@ -1496,8 +1503,8 @@ function hasAdvancedDataBarVisuals(element) {
1496
1503
  'axisColor'
1497
1504
  ].some((name)=>descendants(element, name).length > 0);
1498
1505
  }
1499
- async function diagnoseXlsxFormulas(archive) {
1500
- const features = await readXlsxFormulaFeaturesFromPackage(archive);
1506
+ async function diagnoseXlsxFormulas(archive, importedFeatures, worksheetScans) {
1507
+ const features = importedFeatures ?? await readXlsxFormulaFeaturesFromPackage(archive, worksheetScans);
1501
1508
  const formulas = Array.from(features.sheets.entries()).flatMap(([sheetName, sheet])=>sheet.formulas.map((formula)=>({
1502
1509
  ...formula,
1503
1510
  sheetName
@@ -1608,8 +1615,8 @@ function work_xlsx_page_setup_diagnostics_issue(code, feature, message, severity
1608
1615
  severity
1609
1616
  };
1610
1617
  }
1611
- async function diagnoseXlsxPivots(archive) {
1612
- const inspection = await inspectXlsxPivotTables(archive);
1618
+ async function diagnoseXlsxPivots(archive, importedInspection) {
1619
+ const inspection = importedInspection ?? await inspectXlsxPivotTables(archive);
1613
1620
  const issues = [];
1614
1621
  if (inspection.tables.length) issues.push({
1615
1622
  code: 'xlsx.pivots',
@@ -1626,14 +1633,28 @@ async function diagnoseXlsxPivots(archive) {
1626
1633
  });
1627
1634
  return issues;
1628
1635
  }
1629
- async function analyzeDocxCompatibility(file, messages) {
1636
+ const XLSX_DIAGNOSTIC_WORKSHEET_ELEMENTS = [
1637
+ 'conditionalFormatting',
1638
+ 'dataValidation',
1639
+ 'sheetProtection',
1640
+ 'protectedRange',
1641
+ 'pageSetup',
1642
+ 'pageMargins',
1643
+ 'printOptions',
1644
+ 'headerFooter',
1645
+ 'pageSetUpPr',
1646
+ 'rowBreaks',
1647
+ 'colBreaks'
1648
+ ];
1649
+ async function analyzeDocxCompatibility(file, messages, sourcePackage) {
1630
1650
  const issues = [
1631
1651
  work_office_diagnostics_issue('docx.page-layout', 'Page layout', 'Per-section paper size, orientation, exact native page margins, one-to-six equal or custom-width columns, section breaks, and explicit page breaks are preserved; exact pagination and line wrapping may normalize.'),
1632
1652
  work_office_diagnostics_issue('docx.package-state', 'OOXML package state', 'Source-backed export retains safe source-only parts byte-for-byte and reconnects their content types and relationships. Passive relationship-free extensions in settings XML, uniquely matched style or numbering identities, stable picture drawings, unchanged native-identity paragraphs, stable table, row, or cell scopes, and uniquely matched footnote, endnote, comment, or comment-thread records are preserved against the final package graph. Text-stable direct, supported-hyperlink-wrapped, and eligible static-content-control note and comment runs retain paragraph, table, wrapper, run, and run-property metadata; native note tables and DrawingML pictures remain editable, note image relationships and media targets are repaired and validated, bounded structured OMML equations remain atomically updateable in supported Word stories, uniquely matched table-bearing rich-text controls are reconstructed, safe web, mail, and internal note/comment links are rebound to collision-free final relationship IDs, and content-control ID collisions are rewritten. Native note, comment, and note-picture identities survive reorderings, comment durable IDs are rebound to regenerated paragraph IDs, and eligible source font-table metadata is retained. Generated Word semantics remain authoritative; source-only, changed-text or table structure, malformed, duplicate or cross-kind, active, unsupported wrappers, mixed-semantic, unsafe relationship-bound, legacy VML, non-picture drawings, or unsupported rich content may normalize.', 'info')
1633
1653
  ];
1634
1654
  for (const message of messages)issues.push(work_office_diagnostics_issue(`docx.converter.${message.type}`, 'Document conversion', message.message, 'error' === message.type ? 'error' : 'warning'));
1635
1655
  try {
1636
- const archive = await OoxmlPackage.load(await file.arrayBuffer());
1656
+ const archive = void 0 === sourcePackage ? await OoxmlPackage.load(await file.arrayBuffer()) : sourcePackage;
1657
+ if (!archive) throw new Error('The DOCX package could not be loaded.');
1637
1658
  const packagePaths = archive.paths('');
1638
1659
  const normalizedPackagePaths = packagePaths.map((path)=>path.toLowerCase());
1639
1660
  const document = archive.has('word/document.xml') ? await archive.xml('word/document.xml') : null;
@@ -1723,7 +1744,7 @@ async function analyzeDocxCompatibility(file, messages) {
1723
1744
  }
1724
1745
  return report(file, 'DOCX', issues);
1725
1746
  }
1726
- async function analyzeSpreadsheetCompatibility(file, extension, workbook) {
1747
+ async function analyzeSpreadsheetCompatibility(file, extension, workbook, sourcePackage, worksheetSummaries, importedMetadata) {
1727
1748
  if ('csv' === extension) return null;
1728
1749
  const sourceFormat = extension.toUpperCase();
1729
1750
  const issues = [];
@@ -1744,46 +1765,37 @@ async function analyzeSpreadsheetCompatibility(file, extension, workbook) {
1744
1765
  if (validPrintTitles.length < printTitles.length) issues.push(work_office_diagnostics_issue('sheet.print-titles.invalid', 'Print titles', 'One or more malformed print-title definitions remain in the original workbook only.'));
1745
1766
  for (const [index, name] of workbook.SheetNames.entries()){
1746
1767
  const worksheet = workbook.Sheets[name];
1747
- inspectWorksheetModel(worksheet, name, issues, 'xlsx' === extension);
1768
+ inspectWorksheetModel(worksheet, name, issues, 'xlsx' === extension, worksheetSummaries?.get(name));
1748
1769
  if ((workbook.Workbook?.Sheets?.[index]?.Hidden ?? 0) > 0) issues.push(work_office_diagnostics_issue('sheet.hidden', 'Hidden worksheets', 'Hidden worksheet state is preserved but can be changed by the editor.', 'info', name));
1749
1770
  }
1750
1771
  if ('xlsx' === extension) try {
1751
- const archive = await OoxmlPackage.load(await file.arrayBuffer());
1752
- await inspectXlsxPackage(archive, issues);
1772
+ const archive = void 0 === sourcePackage ? await OoxmlPackage.load(await file.arrayBuffer()) : sourcePackage;
1773
+ if (!archive) throw new Error('The XLSX package could not be loaded.');
1774
+ await inspectXlsxPackage(archive, issues, importedMetadata);
1753
1775
  } catch {
1754
1776
  issues.push(work_office_diagnostics_issue('xlsx.inspect', 'Package inspection', 'Some XLSX features could not be inspected before conversion.'));
1755
1777
  }
1756
1778
  return issues.length ? report(file, sourceFormat, deduplicate(issues)) : null;
1757
1779
  }
1758
- function inspectWorksheetModel(worksheet, name, issues, nativeXlsxFormulaInspection) {
1780
+ function inspectWorksheetModel(worksheet, name, issues, nativeXlsxFormulaInspection, importedSummary) {
1759
1781
  if (!worksheet) return;
1760
1782
  if (worksheet['!autofilter']) issues.push(work_office_diagnostics_issue('sheet.filter', 'Filters', 'The auto-filter range and hidden rows are preserved; advanced active criteria may be normalized.', 'info', name));
1761
- let hasComments = false;
1762
- let hasCommentThreads = false;
1763
- let hasLinks = false;
1764
- let hasArrayFormulas = false;
1765
- let hasRichText = false;
1766
- for (const [address, cell] of Object.entries(worksheet)){
1767
- if (address.startsWith('!') || !cell || 'object' != typeof cell) continue;
1768
- const source = cell;
1769
- if (source.c?.length) {
1770
- hasComments = true;
1771
- if (source.c.length > 1 || source.c.some((comment)=>comment.T)) hasCommentThreads = true;
1772
- }
1773
- if (source.l?.Target) hasLinks = true;
1774
- if (source.F) hasArrayFormulas = true;
1775
- if (source.r) hasRichText = true;
1776
- }
1783
+ const { hasArrayFormulas, hasComments, hasCommentThreads, hasLinks, hasRichText } = importedSummary ?? summarizeSpreadsheetWorksheet(worksheet);
1777
1784
  if (hasComments) issues.push(work_office_diagnostics_issue('sheet.comments', 'Cell comments', 'Plain-text cell comments and one author are preserved and editable through the spreadsheet comment tools.', 'info', name));
1778
1785
  if (hasCommentThreads) issues.push(work_office_diagnostics_issue('sheet.comment-threads', 'Comment threads', 'Multiple comment blocks and threaded replies are flattened into one editable legacy comment.', 'warning', name));
1779
1786
  if (hasLinks) issues.push(work_office_diagnostics_issue('sheet.links', 'Cell hyperlinks', 'Web and in-workbook hyperlinks are preserved; advanced screen tips may be normalized.', 'info', name));
1780
1787
  if (hasArrayFormulas && !nativeXlsxFormulaInspection) issues.push(work_office_diagnostics_issue('sheet.array-formula', 'Array formulas', 'Array-formula ranges may be recalculated as ordinary formulas.', 'warning', name));
1781
1788
  if (hasRichText) issues.push(work_office_diagnostics_issue('sheet.rich-text', 'Rich cell text', 'Rich text inside a cell is converted to uniform text.', 'warning', name));
1782
1789
  }
1783
- async function inspectXlsxPackage(archive, issues) {
1790
+ function summarizeSpreadsheetWorksheet(worksheet) {
1791
+ const summary = emptySpreadsheetWorksheetCompatibilitySummary();
1792
+ for (const { cell } of xlsxWorksheetCellEntries(worksheet))updateSpreadsheetWorksheetCompatibilitySummary(summary, cell);
1793
+ return summary;
1794
+ }
1795
+ async function inspectXlsxPackage(archive, issues, importedMetadata) {
1784
1796
  issues.push(...await diagnoseXlsxCharts(archive));
1785
- issues.push(...await diagnoseXlsxFormulas(archive));
1786
- issues.push(...await diagnoseXlsxPivots(archive));
1797
+ issues.push(...await diagnoseXlsxFormulas(archive, importedMetadata?.formulaFeatures, importedMetadata?.worksheetScans));
1798
+ issues.push(...await diagnoseXlsxPivots(archive, importedMetadata?.pivotFeatures));
1787
1799
  const drawingParts = archive.paths('xl/drawings/').filter((path)=>/^xl\/drawings\/drawing\d+\.xml$/i.test(path));
1788
1800
  let preservedImages = 0;
1789
1801
  let hasUnsupportedImages = false;
@@ -1835,7 +1847,11 @@ async function inspectXlsxPackage(archive, issues) {
1835
1847
  }
1836
1848
  for (const part of archive.paths('xl/worksheets/')){
1837
1849
  if (!part.endsWith('.xml')) continue;
1838
- const worksheet = await archive.xml(part);
1850
+ const scan = importedMetadata?.worksheetScans?.[part];
1851
+ if (scan && !scan.hasDiagnosticFeatures) continue;
1852
+ const source = await archive.text(part);
1853
+ if (!scan && !xmlContainsAnyElement(source, XLSX_DIAGNOSTIC_WORKSHEET_ELEMENTS)) continue;
1854
+ const worksheet = parseXml(source, part);
1839
1855
  if (descendants(worksheet, 'conditionalFormatting').length) for (const diagnostic of diagnoseXlsxConditionalFormatting(worksheet, styles))issues.push(work_office_diagnostics_issue(diagnostic.code, 'Conditional formatting', diagnostic.message, diagnostic.severity));
1840
1856
  if (descendants(worksheet, 'dataValidation').length) issues.push(work_office_diagnostics_issue('xlsx.validation', 'Data validation', 'Common list, numeric, date, and text-length rules are editable; custom formulas and very large ranges may be normalized.', 'info'));
1841
1857
  if (descendants(worksheet, 'sheetProtection').length || descendants(worksheet, 'protectedRange').length) for (const diagnostic of diagnoseXlsxProtection(worksheet, styles))issues.push(work_office_diagnostics_issue(diagnostic.code, 'Sheet protection', diagnostic.message, diagnostic.severity));
@@ -1872,4 +1888,4 @@ function deduplicate(issues) {
1872
1888
  return true;
1873
1889
  });
1874
1890
  }
1875
- export { analyzeDocxCompatibility, analyzeSpreadsheetCompatibility };
1891
+ export { work_office_diagnostics_namespaceObject };
@@ -478,8 +478,8 @@ const EMU_PER_INCH = 914400;
478
478
  const DEFAULT_SLIDE_WIDTH = 13.333;
479
479
  const DEFAULT_SLIDE_HEIGHT = 7.5;
480
480
  const MAX_EMBEDDED_IMAGE_BYTES = 11534336;
481
- async function importPptxPresentation(file) {
482
- const archive = await OoxmlPackage.load(await file.arrayBuffer());
481
+ async function importPptxPresentation(file, sourceBytes) {
482
+ const archive = await OoxmlPackage.load(sourceBytes ?? await file.arrayBuffer());
483
483
  if (!archive.has('ppt/presentation.xml')) throw new Error('The selected file is not a valid PPTX presentation.');
484
484
  const presentation = await archive.xml('ppt/presentation.xml');
485
485
  const presentationRelationships = await archive.relationships('ppt/presentation.xml');