open-agreements 0.3.0 → 0.4.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.
- package/content/templates/closing-checklist/template.docx +0 -0
- package/dist/core/checklist/docx-import.d.ts +50 -0
- package/dist/core/checklist/docx-import.d.ts.map +1 -0
- package/dist/core/checklist/docx-import.js +613 -0
- package/dist/core/checklist/docx-import.js.map +1 -0
- package/dist/core/checklist/docx-table-helpers.d.ts +33 -0
- package/dist/core/checklist/docx-table-helpers.d.ts.map +1 -0
- package/dist/core/checklist/docx-table-helpers.js +154 -0
- package/dist/core/checklist/docx-table-helpers.js.map +1 -0
- package/dist/core/checklist/format-checklist-docx.d.ts.map +1 -1
- package/dist/core/checklist/format-checklist-docx.js +37 -88
- package/dist/core/checklist/format-checklist-docx.js.map +1 -1
- package/dist/core/checklist/index.d.ts +15 -12
- package/dist/core/checklist/index.d.ts.map +1 -1
- package/dist/core/checklist/index.js +48 -30
- package/dist/core/checklist/index.js.map +1 -1
- package/dist/core/checklist/status-labels.d.ts +6 -0
- package/dist/core/checklist/status-labels.d.ts.map +1 -1
- package/dist/core/checklist/status-labels.js +8 -0
- package/dist/core/checklist/status-labels.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts +218 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.js +869 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts +96 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js +347 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts +2 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js +188 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts +41 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js +85 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts +64 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js +985 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts +111 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js +469 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts +277 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js +2279 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts +59 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js +209 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts +69 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js +910 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts +26 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js +153 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts +63 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js +254 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts +64 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js +616 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts +65 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js +95 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts +51 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js +83 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts +40 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js +135 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts +28 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js +110 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts +3 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.js +21 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.d.ts +296 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.js +122 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts +144 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.js +291 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts +120 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.js +338 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/index.d.ts +177 -0
- package/node_modules/@usejunior/docx-core/dist/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/index.js +55 -0
- package/node_modules/@usejunior/docx-core/dist/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts +6 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js +30 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts +211 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.js +391 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.d.ts +136 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.js +446 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts +30 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js +241 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts +12 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js +248 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts +88 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.js +703 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts +186 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.js +555 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts +97 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js +749 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts +94 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js +219 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts +7 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.js +10 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts +50 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js +340 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts +37 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js +552 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts +43 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js +291 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.js +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts +53 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.js +178 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js +57 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts +31 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.js +223 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts +23 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js +243 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts +91 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js +108 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js +182 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts +18 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js +190 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js +371 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts +7 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js +24 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts +17 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js +58 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js +94 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts +36 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.js +205 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts +54 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.js +205 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts +30 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.js +461 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts +24 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js +147 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts +5 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.js +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts +25 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.js +78 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts +94 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js +169 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts +149 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js +224 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts +136 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js +7 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts +31 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js +110 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js.map +1 -0
- package/node_modules/@usejunior/docx-core/package.json +26 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +38 -0
- package/node_modules/diff-match-patch/LICENSE +202 -0
- package/node_modules/diff-match-patch/README.md +94 -0
- package/node_modules/diff-match-patch/index.js +2218 -0
- package/node_modules/diff-match-patch/package.json +22 -0
- package/node_modules/immediate/LICENSE.txt +20 -0
- package/node_modules/immediate/README.md +93 -0
- package/node_modules/immediate/dist/immediate.js +75 -0
- package/node_modules/immediate/dist/immediate.min.js +1 -0
- package/node_modules/immediate/lib/browser.js +69 -0
- package/node_modules/immediate/lib/index.js +73 -0
- package/node_modules/immediate/package.json +42 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +60 -0
- package/node_modules/isarray/component.json +19 -0
- package/node_modules/isarray/index.js +5 -0
- package/node_modules/isarray/package.json +45 -0
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jszip/.codeclimate.yml +16 -0
- package/node_modules/jszip/.editorconfig +8 -0
- package/node_modules/jszip/.eslintrc.js +43 -0
- package/node_modules/jszip/.github/workflows/pr.yaml +58 -0
- package/node_modules/jszip/.jekyll-metadata +0 -0
- package/node_modules/jszip/.travis.yml +17 -0
- package/node_modules/jszip/CHANGES.md +204 -0
- package/node_modules/jszip/LICENSE.markdown +651 -0
- package/node_modules/jszip/README.markdown +33 -0
- package/node_modules/jszip/deps.js +37 -0
- package/node_modules/jszip/dist/jszip.js +11577 -0
- package/node_modules/jszip/dist/jszip.min.js +13 -0
- package/node_modules/jszip/graph.svg +601 -0
- package/node_modules/jszip/index.d.ts +330 -0
- package/node_modules/jszip/lib/base64.js +106 -0
- package/node_modules/jszip/lib/compressedObject.js +74 -0
- package/node_modules/jszip/lib/compressions.js +14 -0
- package/node_modules/jszip/lib/crc32.js +77 -0
- package/node_modules/jszip/lib/defaults.js +11 -0
- package/node_modules/jszip/lib/external.js +18 -0
- package/node_modules/jszip/lib/flate.js +85 -0
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
- package/node_modules/jszip/lib/generate/index.js +57 -0
- package/node_modules/jszip/lib/index.js +55 -0
- package/node_modules/jszip/lib/license_header.js +11 -0
- package/node_modules/jszip/lib/load.js +88 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
- package/node_modules/jszip/lib/nodejsUtils.js +57 -0
- package/node_modules/jszip/lib/object.js +384 -0
- package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
- package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
- package/node_modules/jszip/lib/reader/DataReader.js +116 -0
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
- package/node_modules/jszip/lib/reader/StringReader.js +38 -0
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
- package/node_modules/jszip/lib/reader/readerFor.js +28 -0
- package/node_modules/jszip/lib/signature.js +7 -0
- package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
- package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
- package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
- package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
- package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
- package/node_modules/jszip/lib/support.js +38 -0
- package/node_modules/jszip/lib/utf8.js +275 -0
- package/node_modules/jszip/lib/utils.js +501 -0
- package/node_modules/jszip/lib/zipEntries.js +261 -0
- package/node_modules/jszip/lib/zipEntry.js +293 -0
- package/node_modules/jszip/lib/zipObject.js +133 -0
- package/node_modules/jszip/package.json +67 -0
- package/node_modules/jszip/sponsors.md +21 -0
- package/node_modules/jszip/tsconfig.json +101 -0
- package/node_modules/jszip/vendor/FileSaver.js +247 -0
- package/node_modules/lie/README.md +62 -0
- package/node_modules/lie/dist/lie.js +350 -0
- package/node_modules/lie/dist/lie.min.js +1 -0
- package/node_modules/lie/dist/lie.polyfill.js +358 -0
- package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
- package/node_modules/lie/lib/browser.js +273 -0
- package/node_modules/lie/lib/index.js +298 -0
- package/node_modules/lie/license.md +7 -0
- package/node_modules/lie/lie.d.ts +244 -0
- package/node_modules/lie/package.json +69 -0
- package/node_modules/lie/polyfill.js +4 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +191 -0
- package/node_modules/pako/dist/pako.js +6818 -0
- package/node_modules/pako/dist/pako.min.js +1 -0
- package/node_modules/pako/dist/pako_deflate.js +3997 -0
- package/node_modules/pako/dist/pako_deflate.min.js +1 -0
- package/node_modules/pako/dist/pako_inflate.js +3300 -0
- package/node_modules/pako/dist/pako_inflate.min.js +1 -0
- package/node_modules/pako/index.js +14 -0
- package/node_modules/pako/lib/deflate.js +400 -0
- package/node_modules/pako/lib/inflate.js +423 -0
- package/node_modules/pako/lib/utils/common.js +105 -0
- package/node_modules/pako/lib/utils/strings.js +187 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +1874 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +345 -0
- package/node_modules/pako/lib/zlib/inflate.js +1556 -0
- package/node_modules/pako/lib/zlib/inftrees.js +343 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1222 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +44 -0
- package/node_modules/process-nextick-args/index.js +45 -0
- package/node_modules/process-nextick-args/license.md +19 -0
- package/node_modules/process-nextick-args/package.json +25 -0
- package/node_modules/process-nextick-args/readme.md +18 -0
- package/node_modules/readable-stream/.travis.yml +34 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +58 -0
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
- package/node_modules/readable-stream/duplex-browser.js +1 -0
- package/node_modules/readable-stream/duplex.js +1 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +52 -0
- package/node_modules/readable-stream/passthrough.js +1 -0
- package/node_modules/readable-stream/readable-browser.js +7 -0
- package/node_modules/readable-stream/readable.js +19 -0
- package/node_modules/readable-stream/transform.js +1 -0
- package/node_modules/readable-stream/writable-browser.js +1 -0
- package/node_modules/readable-stream/writable.js +8 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/setimmediate/LICENSE.txt +20 -0
- package/node_modules/setimmediate/package.json +30 -0
- package/node_modules/setimmediate/setImmediate.js +186 -0
- package/node_modules/string_decoder/.travis.yml +50 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +31 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +27 -0
- package/package.json +9 -4
- package/packages/docx-core/node_modules/@xmldom/xmldom/CHANGELOG.md +468 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/LICENSE +8 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/SECURITY.md +50 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/index.d.ts +43 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +2 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/conventions.js +203 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom-parser.js +322 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom.js +1879 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/entities.js +2166 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/index.js +4 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/sax.js +662 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/package.json +71 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/readme.md +356 -0
package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track Changes Acceptor/Rejector (AST-based)
|
|
3
|
+
*
|
|
4
|
+
* AST-based utilities to accept or reject all track changes in a document.
|
|
5
|
+
* Replaces the regex-based implementation for better reliability with nested structures.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Accept all track changes in document XML (AST-based).
|
|
9
|
+
*
|
|
10
|
+
* - Removes w:del elements entirely (deleted content disappears)
|
|
11
|
+
* - Unwraps w:ins elements (inserted content becomes normal)
|
|
12
|
+
* - Handles w:moveFrom (remove) and w:moveTo (unwrap)
|
|
13
|
+
* - Removes format change tracking elements
|
|
14
|
+
*
|
|
15
|
+
* @param documentXml - The document.xml content with track changes
|
|
16
|
+
* @returns Document XML with all changes accepted
|
|
17
|
+
*/
|
|
18
|
+
export declare function acceptAllChanges(documentXml: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Reject all track changes in document XML (AST-based).
|
|
21
|
+
*
|
|
22
|
+
* - Removes w:ins elements entirely (inserted content disappears)
|
|
23
|
+
* - Unwraps w:del elements and converts w:delText to w:t
|
|
24
|
+
* - Handles w:moveFrom (unwrap) and w:moveTo (remove)
|
|
25
|
+
* - Removes format change tracking elements
|
|
26
|
+
*
|
|
27
|
+
* @param documentXml - The document.xml content with track changes
|
|
28
|
+
* @returns Document XML with all changes rejected
|
|
29
|
+
*/
|
|
30
|
+
export declare function rejectAllChanges(documentXml: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Extract plain text content from document XML (AST-based).
|
|
33
|
+
*
|
|
34
|
+
* @param documentXml - The document.xml content
|
|
35
|
+
* @returns Plain text content
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractTextContent(documentXml: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Extract text in document order, respecting paragraph breaks (AST-based).
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractTextWithParagraphs(documentXml: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Normalize text for comparison (handles whitespace differences).
|
|
44
|
+
*
|
|
45
|
+
* Performs the following normalization:
|
|
46
|
+
* - Convert CRLF and CR to LF
|
|
47
|
+
* - Convert tabs to spaces
|
|
48
|
+
* - Collapse multiple spaces to single space
|
|
49
|
+
* - Strip trailing spaces from each line
|
|
50
|
+
* - Collapse multiple newlines to single newline
|
|
51
|
+
* - Trim leading/trailing whitespace
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeText(text: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Compare two texts and return detailed differences.
|
|
56
|
+
*/
|
|
57
|
+
export declare function compareTexts(expected: string, actual: string): {
|
|
58
|
+
identical: boolean;
|
|
59
|
+
normalizedIdentical: boolean;
|
|
60
|
+
expectedLength: number;
|
|
61
|
+
actualLength: number;
|
|
62
|
+
differences: string[];
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=trackChangesAcceptorAst.d.ts.map
|
package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackChangesAcceptorAst.d.ts","sourceRoot":"","sources":["../../../src/baselines/atomizer/trackChangesAcceptorAst.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+VH;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0I5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2G5D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqB9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA4BrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUlD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb;IACD,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAmCA"}
|
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track Changes Acceptor/Rejector (AST-based)
|
|
3
|
+
*
|
|
4
|
+
* AST-based utilities to accept or reject all track changes in a document.
|
|
5
|
+
* Replaces the regex-based implementation for better reliability with nested structures.
|
|
6
|
+
*/
|
|
7
|
+
import { parseDocumentXml, serializeToXml } from './xmlToWmlElement.js';
|
|
8
|
+
import { removeAllByTagName, unwrapAllByTagName, findAllByTagName, renameElement, insertChildAt, childElements, getLeafText, NODE_TYPE, } from '../../primitives/index.js';
|
|
9
|
+
/** xmldom does not implement parentElement; use parentNode with an Element guard. */
|
|
10
|
+
function parentElement(node) {
|
|
11
|
+
const p = node.parentNode;
|
|
12
|
+
return p && p.nodeType === NODE_TYPE.ELEMENT ? p : undefined;
|
|
13
|
+
}
|
|
14
|
+
function getParagraphPPr(p) {
|
|
15
|
+
return childElements(p).find((c) => c.tagName === 'w:pPr');
|
|
16
|
+
}
|
|
17
|
+
function paragraphHasParaMarker(p, tagName) {
|
|
18
|
+
const pPr = getParagraphPPr(p);
|
|
19
|
+
if (!pPr)
|
|
20
|
+
return false;
|
|
21
|
+
return findAllByTagName(pPr, tagName).length > 0;
|
|
22
|
+
}
|
|
23
|
+
function removeParaMarkers(root) {
|
|
24
|
+
// Remove paragraph-level revision markers (<w:ins/> / <w:del/>) that live under <w:pPr>.
|
|
25
|
+
for (const p of findAllByTagName(root, 'w:p')) {
|
|
26
|
+
const pPr = getParagraphPPr(p);
|
|
27
|
+
if (!pPr)
|
|
28
|
+
continue;
|
|
29
|
+
const markers = [
|
|
30
|
+
...findAllByTagName(pPr, 'w:ins'),
|
|
31
|
+
...findAllByTagName(pPr, 'w:del'),
|
|
32
|
+
];
|
|
33
|
+
for (const m of markers) {
|
|
34
|
+
if (m.parentNode)
|
|
35
|
+
m.parentNode.removeChild(m);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function findContainingParagraph(node) {
|
|
40
|
+
let current = node;
|
|
41
|
+
while (current) {
|
|
42
|
+
if (current.tagName === 'w:p') {
|
|
43
|
+
return current;
|
|
44
|
+
}
|
|
45
|
+
current = parentElement(current);
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
function findNeighborParagraphOutsideRemoval(paragraph, paragraphsToRemove, direction) {
|
|
50
|
+
const parent = parentElement(paragraph);
|
|
51
|
+
if (!parent) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const siblings = childElements(parent);
|
|
55
|
+
const paragraphIndex = siblings.indexOf(paragraph);
|
|
56
|
+
if (paragraphIndex < 0) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const step = direction === 'previous' ? -1 : 1;
|
|
60
|
+
for (let i = paragraphIndex + step; i >= 0 && i < siblings.length; i += step) {
|
|
61
|
+
const sibling = siblings[i];
|
|
62
|
+
if (sibling?.tagName !== 'w:p') {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (paragraphsToRemove.has(sibling)) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
return sibling;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Tag names that represent visible content inside a w:r element.
|
|
74
|
+
* A run containing at least one of these is considered substantive (non-empty).
|
|
75
|
+
*/
|
|
76
|
+
const RUN_VISIBLE_CONTENT_TAGS = new Set([
|
|
77
|
+
'w:t', 'w:tab', 'w:br', 'w:cr', 'w:drawing', 'w:object', 'w:pict',
|
|
78
|
+
'w:sym', 'w:fldChar', 'w:instrText',
|
|
79
|
+
]);
|
|
80
|
+
/**
|
|
81
|
+
* Returns true if a w:r element contains at least one visible content child.
|
|
82
|
+
* Empty runs (containing only w:rPr or nothing) return false.
|
|
83
|
+
*/
|
|
84
|
+
function runHasVisibleContent(run) {
|
|
85
|
+
for (let i = 0; i < run.childNodes.length; i++) {
|
|
86
|
+
const child = run.childNodes[i];
|
|
87
|
+
if (child.nodeType === NODE_TYPE.ELEMENT && RUN_VISIBLE_CONTENT_TAGS.has(child.tagName)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
function paragraphContentStartIndex(paragraph) {
|
|
94
|
+
const children = childElements(paragraph);
|
|
95
|
+
let idx = 0;
|
|
96
|
+
while (idx < children.length && children[idx]?.tagName === 'w:pPr') {
|
|
97
|
+
idx++;
|
|
98
|
+
}
|
|
99
|
+
return idx;
|
|
100
|
+
}
|
|
101
|
+
function moveBookmarkMarker(marker, targetParagraph, position) {
|
|
102
|
+
if (marker.tagName === 'w:bookmarkStart') {
|
|
103
|
+
const markerId = marker.getAttribute('w:id');
|
|
104
|
+
const markerName = marker.getAttribute('w:name');
|
|
105
|
+
for (const existing of findAllByTagName(targetParagraph, 'w:bookmarkStart')) {
|
|
106
|
+
if (markerId && existing.getAttribute('w:id') === markerId) {
|
|
107
|
+
if (marker.parentNode)
|
|
108
|
+
marker.parentNode.removeChild(marker);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (markerName && existing.getAttribute('w:name') === markerName) {
|
|
112
|
+
if (marker.parentNode)
|
|
113
|
+
marker.parentNode.removeChild(marker);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (marker.tagName === 'w:bookmarkEnd') {
|
|
119
|
+
const markerId = marker.getAttribute('w:id');
|
|
120
|
+
if (markerId) {
|
|
121
|
+
for (const existing of findAllByTagName(targetParagraph, 'w:bookmarkEnd')) {
|
|
122
|
+
if (existing.getAttribute('w:id') === markerId) {
|
|
123
|
+
if (marker.parentNode)
|
|
124
|
+
marker.parentNode.removeChild(marker);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (marker.parentNode) {
|
|
131
|
+
marker.parentNode.removeChild(marker);
|
|
132
|
+
}
|
|
133
|
+
if (position === 'start') {
|
|
134
|
+
insertChildAt(targetParagraph, marker, paragraphContentStartIndex(targetParagraph));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
targetParagraph.appendChild(marker);
|
|
138
|
+
}
|
|
139
|
+
function collectBookmarksById(nodes) {
|
|
140
|
+
const byId = new Map();
|
|
141
|
+
for (const node of nodes) {
|
|
142
|
+
const id = node.getAttribute('w:id');
|
|
143
|
+
if (!id) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const existing = byId.get(id);
|
|
147
|
+
if (existing) {
|
|
148
|
+
existing.push(node);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
byId.set(id, [node]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return byId;
|
|
155
|
+
}
|
|
156
|
+
function hasCounterpartOutsideRemovedParagraphs(counterpartNodes, paragraphsToRemove, sourceParagraph) {
|
|
157
|
+
if (!counterpartNodes || counterpartNodes.length === 0) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
for (const node of counterpartNodes) {
|
|
161
|
+
if (!node.parentNode) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const nodeParagraph = findContainingParagraph(node);
|
|
165
|
+
if (!nodeParagraph || nodeParagraph === sourceParagraph) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (!paragraphsToRemove.has(nodeParagraph)) {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
function collectReferencedBookmarkNamesOutsideRemovedParagraphs(root, paragraphsToRemove) {
|
|
175
|
+
const names = new Set();
|
|
176
|
+
const refRegex = /\b(?:PAGEREF|REF)\s+([^\s\\]+)/g;
|
|
177
|
+
for (const instrText of findAllByTagName(root, 'w:instrText')) {
|
|
178
|
+
const paragraph = findContainingParagraph(instrText);
|
|
179
|
+
if (paragraph && paragraphsToRemove.has(paragraph)) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const text = getLeafText(instrText) ?? '';
|
|
183
|
+
for (const match of text.matchAll(refRegex)) {
|
|
184
|
+
const name = match[1]?.trim();
|
|
185
|
+
if (name) {
|
|
186
|
+
names.add(name);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return names;
|
|
191
|
+
}
|
|
192
|
+
function getBookmarkNameForId(startsById, id) {
|
|
193
|
+
const starts = startsById.get(id);
|
|
194
|
+
if (!starts)
|
|
195
|
+
return undefined;
|
|
196
|
+
for (const start of starts) {
|
|
197
|
+
const name = start.getAttribute('w:name');
|
|
198
|
+
if (name)
|
|
199
|
+
return name;
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Preserve bookmark markers that span outside paragraphs being removed during Reject All.
|
|
205
|
+
*
|
|
206
|
+
* Inserted paragraphs are removed wholesale. If they contain a bookmark boundary whose
|
|
207
|
+
* counterpart sits in a kept paragraph, dropping that boundary corrupts bookmark pairing.
|
|
208
|
+
* Move those boundary markers into adjacent kept paragraphs before removal.
|
|
209
|
+
*/
|
|
210
|
+
function preserveCrossParagraphBookmarksForReject(root, paragraphsToRemove) {
|
|
211
|
+
if (paragraphsToRemove.size === 0) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const startsById = collectBookmarksById(findAllByTagName(root, 'w:bookmarkStart'));
|
|
215
|
+
const endsById = collectBookmarksById(findAllByTagName(root, 'w:bookmarkEnd'));
|
|
216
|
+
const referencedNamesOutsideRemoved = collectReferencedBookmarkNamesOutsideRemovedParagraphs(root, paragraphsToRemove);
|
|
217
|
+
for (const paragraph of paragraphsToRemove) {
|
|
218
|
+
const startTarget = findNeighborParagraphOutsideRemoval(paragraph, paragraphsToRemove, 'next') ??
|
|
219
|
+
findNeighborParagraphOutsideRemoval(paragraph, paragraphsToRemove, 'previous');
|
|
220
|
+
const endTarget = findNeighborParagraphOutsideRemoval(paragraph, paragraphsToRemove, 'previous') ??
|
|
221
|
+
findNeighborParagraphOutsideRemoval(paragraph, paragraphsToRemove, 'next');
|
|
222
|
+
if (!startTarget && !endTarget) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
for (const start of findAllByTagName(paragraph, 'w:bookmarkStart')) {
|
|
226
|
+
if (!start.parentNode || !startTarget) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const id = start.getAttribute('w:id');
|
|
230
|
+
if (!id) {
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const startName = start.getAttribute('w:name');
|
|
234
|
+
const hasDuplicateStartOutside = hasCounterpartOutsideRemovedParagraphs(startsById.get(id), paragraphsToRemove, paragraph);
|
|
235
|
+
if (hasDuplicateStartOutside) {
|
|
236
|
+
// A surviving start marker with this ID already exists outside removed
|
|
237
|
+
// paragraphs. Moving this marker would create duplicate starts after
|
|
238
|
+
// Reject All.
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const hasCounterpartOutside = hasCounterpartOutsideRemovedParagraphs(endsById.get(id), paragraphsToRemove, paragraph);
|
|
242
|
+
const referencedOutside = startName ? referencedNamesOutsideRemoved.has(startName) : false;
|
|
243
|
+
if (!hasCounterpartOutside && !referencedOutside) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
moveBookmarkMarker(start, startTarget, 'start');
|
|
247
|
+
}
|
|
248
|
+
for (const end of findAllByTagName(paragraph, 'w:bookmarkEnd')) {
|
|
249
|
+
if (!end.parentNode || !endTarget) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
const id = end.getAttribute('w:id');
|
|
253
|
+
if (!id) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const hasDuplicateEndOutside = hasCounterpartOutsideRemovedParagraphs(endsById.get(id), paragraphsToRemove, paragraph);
|
|
257
|
+
if (hasDuplicateEndOutside) {
|
|
258
|
+
// A surviving end marker with this ID already exists outside removed
|
|
259
|
+
// paragraphs. Moving this marker would create duplicate ends after
|
|
260
|
+
// Reject All.
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const hasCounterpartOutside = hasCounterpartOutsideRemovedParagraphs(startsById.get(id), paragraphsToRemove, paragraph);
|
|
264
|
+
const pairedName = getBookmarkNameForId(startsById, id);
|
|
265
|
+
const referencedOutside = pairedName ? referencedNamesOutsideRemoved.has(pairedName) : false;
|
|
266
|
+
if (!hasCounterpartOutside && !referencedOutside) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
moveBookmarkMarker(end, endTarget, 'end');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Accept all track changes in document XML (AST-based).
|
|
275
|
+
*
|
|
276
|
+
* - Removes w:del elements entirely (deleted content disappears)
|
|
277
|
+
* - Unwraps w:ins elements (inserted content becomes normal)
|
|
278
|
+
* - Handles w:moveFrom (remove) and w:moveTo (unwrap)
|
|
279
|
+
* - Removes format change tracking elements
|
|
280
|
+
*
|
|
281
|
+
* @param documentXml - The document.xml content with track changes
|
|
282
|
+
* @returns Document XML with all changes accepted
|
|
283
|
+
*/
|
|
284
|
+
export function acceptAllChanges(documentXml) {
|
|
285
|
+
const root = parseDocumentXml(documentXml);
|
|
286
|
+
// First, find paragraphs that ONLY contain w:del or w:moveFrom content (no w:ins, no regular w:r)
|
|
287
|
+
// These paragraphs should be removed entirely when accepting
|
|
288
|
+
const paragraphsToRemove = new Set();
|
|
289
|
+
// Paragraph-level deletion markers (Aspose/Word encode deleted paragraphs via <w:pPr><w:rPr><w:del .../></w:rPr>)
|
|
290
|
+
// should remove the paragraph on Accept All.
|
|
291
|
+
for (const p of findAllByTagName(root, 'w:p')) {
|
|
292
|
+
if (paragraphHasParaMarker(p, 'w:del')) {
|
|
293
|
+
paragraphsToRemove.add(p);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// Check w:del elements
|
|
297
|
+
for (const del of findAllByTagName(root, 'w:del')) {
|
|
298
|
+
// Walk up to find containing w:p
|
|
299
|
+
let p;
|
|
300
|
+
let current = parentElement(del);
|
|
301
|
+
while (current) {
|
|
302
|
+
if (current.tagName === 'w:p') {
|
|
303
|
+
p = current;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
current = parentElement(current);
|
|
307
|
+
}
|
|
308
|
+
if (p) {
|
|
309
|
+
// Check if this paragraph has any w:ins elements (should keep those)
|
|
310
|
+
const insElements = findAllByTagName(p, 'w:ins');
|
|
311
|
+
if (insElements.length > 0) {
|
|
312
|
+
continue; // Paragraph has inserted content, don't remove it
|
|
313
|
+
}
|
|
314
|
+
// Check if this paragraph has any w:r elements outside of w:del
|
|
315
|
+
// If the only content is inside w:del, we can remove the paragraph
|
|
316
|
+
let hasContentOutsideDel = false;
|
|
317
|
+
for (const child of childElements(p)) {
|
|
318
|
+
if (child.tagName === 'w:r') {
|
|
319
|
+
hasContentOutsideDel = true;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
if (child.tagName !== 'w:del' && child.tagName !== 'w:pPr' &&
|
|
323
|
+
child.tagName !== 'w:moveFromRangeStart' && child.tagName !== 'w:moveFromRangeEnd') {
|
|
324
|
+
// Check if this non-del child has w:r descendants
|
|
325
|
+
const runsInChild = findAllByTagName(child, 'w:r');
|
|
326
|
+
if (runsInChild.length > 0) {
|
|
327
|
+
hasContentOutsideDel = true;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (!hasContentOutsideDel) {
|
|
333
|
+
paragraphsToRemove.add(p);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Also check w:moveFrom elements (moved-away content, also removed when accepting)
|
|
338
|
+
for (const moveFrom of findAllByTagName(root, 'w:moveFrom')) {
|
|
339
|
+
// Walk up to find containing w:p
|
|
340
|
+
let p;
|
|
341
|
+
let current = parentElement(moveFrom);
|
|
342
|
+
while (current) {
|
|
343
|
+
if (current.tagName === 'w:p') {
|
|
344
|
+
p = current;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
current = parentElement(current);
|
|
348
|
+
}
|
|
349
|
+
if (p && !paragraphsToRemove.has(p)) {
|
|
350
|
+
// Check if this paragraph has any w:ins or w:moveTo elements (should keep those)
|
|
351
|
+
const insElements = findAllByTagName(p, 'w:ins');
|
|
352
|
+
const moveToElements = findAllByTagName(p, 'w:moveTo');
|
|
353
|
+
if (insElements.length > 0 || moveToElements.length > 0) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
// Check if this paragraph has any w:r elements outside of w:del/w:moveFrom
|
|
357
|
+
let hasContentOutsideRemoved = false;
|
|
358
|
+
for (const child of childElements(p)) {
|
|
359
|
+
if (child.tagName === 'w:r') {
|
|
360
|
+
hasContentOutsideRemoved = true;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
if (child.tagName !== 'w:del' && child.tagName !== 'w:moveFrom' &&
|
|
364
|
+
child.tagName !== 'w:pPr' &&
|
|
365
|
+
child.tagName !== 'w:moveFromRangeStart' && child.tagName !== 'w:moveFromRangeEnd') {
|
|
366
|
+
const runsInChild = findAllByTagName(child, 'w:r');
|
|
367
|
+
if (runsInChild.length > 0) {
|
|
368
|
+
hasContentOutsideRemoved = true;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (!hasContentOutsideRemoved) {
|
|
374
|
+
paragraphsToRemove.add(p);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Remove w:del elements entirely (deleted content disappears)
|
|
379
|
+
removeAllByTagName(root, 'w:del');
|
|
380
|
+
// Remove w:moveFrom elements entirely
|
|
381
|
+
removeAllByTagName(root, 'w:moveFrom');
|
|
382
|
+
// Remove move range markers
|
|
383
|
+
removeAllByTagName(root, 'w:moveFromRangeStart');
|
|
384
|
+
removeAllByTagName(root, 'w:moveFromRangeEnd');
|
|
385
|
+
removeAllByTagName(root, 'w:moveToRangeStart');
|
|
386
|
+
removeAllByTagName(root, 'w:moveToRangeEnd');
|
|
387
|
+
// Unwrap w:ins elements (keep content, remove wrapper)
|
|
388
|
+
unwrapAllByTagName(root, 'w:ins');
|
|
389
|
+
// Unwrap w:moveTo elements
|
|
390
|
+
unwrapAllByTagName(root, 'w:moveTo');
|
|
391
|
+
// Remove format change tracking
|
|
392
|
+
removeAllByTagName(root, 'w:rPrChange');
|
|
393
|
+
removeAllByTagName(root, 'w:pPrChange');
|
|
394
|
+
// Strip paragraph-level markers now that changes are accepted.
|
|
395
|
+
removeParaMarkers(root);
|
|
396
|
+
// Remove paragraphs that ONLY had w:del content (now empty after removal)
|
|
397
|
+
for (const p of paragraphsToRemove) {
|
|
398
|
+
if (p.parentNode) {
|
|
399
|
+
p.parentNode.removeChild(p);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return serializeToXml(root);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Reject all track changes in document XML (AST-based).
|
|
406
|
+
*
|
|
407
|
+
* - Removes w:ins elements entirely (inserted content disappears)
|
|
408
|
+
* - Unwraps w:del elements and converts w:delText to w:t
|
|
409
|
+
* - Handles w:moveFrom (unwrap) and w:moveTo (remove)
|
|
410
|
+
* - Removes format change tracking elements
|
|
411
|
+
*
|
|
412
|
+
* @param documentXml - The document.xml content with track changes
|
|
413
|
+
* @returns Document XML with all changes rejected
|
|
414
|
+
*/
|
|
415
|
+
export function rejectAllChanges(documentXml) {
|
|
416
|
+
const root = parseDocumentXml(documentXml);
|
|
417
|
+
// Step 1: Find paragraphs where w:ins is the ONLY substantive content
|
|
418
|
+
// (no w:del, no w:r outside track changes)
|
|
419
|
+
const paragraphsToRemove = new Set();
|
|
420
|
+
// Paragraph-level insertion markers (Aspose/Word encode inserted paragraphs via <w:pPr><w:rPr><w:ins .../></w:rPr>)
|
|
421
|
+
// should remove the paragraph on Reject All.
|
|
422
|
+
for (const p of findAllByTagName(root, 'w:p')) {
|
|
423
|
+
if (paragraphHasParaMarker(p, 'w:ins')) {
|
|
424
|
+
paragraphsToRemove.add(p);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// Also check paragraphs where ALL substantive content is inside w:ins and/or
|
|
428
|
+
// w:moveTo wrappers (no bare w:r, no w:del, no w:moveFrom). These paragraphs
|
|
429
|
+
// should be removed on reject even without an explicit PPR-INS paragraph marker.
|
|
430
|
+
// This handles the inplace modifier's no-op wrapParagraphAsInserted (which omits
|
|
431
|
+
// PPR-INS for Google Docs compatibility).
|
|
432
|
+
for (const p of findAllByTagName(root, 'w:p')) {
|
|
433
|
+
if (paragraphsToRemove.has(p))
|
|
434
|
+
continue;
|
|
435
|
+
// Must have at least one w:ins or w:moveTo
|
|
436
|
+
const insEls = findAllByTagName(p, 'w:ins');
|
|
437
|
+
const moveToEls = findAllByTagName(p, 'w:moveTo');
|
|
438
|
+
if (insEls.length === 0 && moveToEls.length === 0)
|
|
439
|
+
continue;
|
|
440
|
+
// Skip if paragraph has deleted/moveFrom content (those survive reject)
|
|
441
|
+
const dels = findAllByTagName(p, 'w:del');
|
|
442
|
+
const moveFroms = findAllByTagName(p, 'w:moveFrom');
|
|
443
|
+
if (dels.length > 0 || moveFroms.length > 0)
|
|
444
|
+
continue;
|
|
445
|
+
// Check if this paragraph has any w:r elements with visible content
|
|
446
|
+
// outside of w:ins/w:moveTo. Empty w:r shells (no w:t, w:tab, w:br, etc.)
|
|
447
|
+
// should NOT count as substantive content — they are artifacts that would
|
|
448
|
+
// otherwise prevent paragraph removal, leaving ghost paragraphs after reject.
|
|
449
|
+
let hasContentOutsideRemoved = false;
|
|
450
|
+
for (const child of childElements(p)) {
|
|
451
|
+
if (child.tagName === 'w:r') {
|
|
452
|
+
if (runHasVisibleContent(child)) {
|
|
453
|
+
hasContentOutsideRemoved = true;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
if (child.tagName !== 'w:ins' && child.tagName !== 'w:moveTo' &&
|
|
459
|
+
child.tagName !== 'w:pPr' &&
|
|
460
|
+
child.tagName !== 'w:moveToRangeStart' && child.tagName !== 'w:moveToRangeEnd' &&
|
|
461
|
+
child.tagName !== 'w:bookmarkStart' && child.tagName !== 'w:bookmarkEnd') {
|
|
462
|
+
const runsInChild = findAllByTagName(child, 'w:r');
|
|
463
|
+
if (runsInChild.some(runHasVisibleContent)) {
|
|
464
|
+
hasContentOutsideRemoved = true;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if (!hasContentOutsideRemoved) {
|
|
470
|
+
paragraphsToRemove.add(p);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
preserveCrossParagraphBookmarksForReject(root, paragraphsToRemove);
|
|
474
|
+
// Step 2: Remove w:ins elements entirely (inserted content disappears)
|
|
475
|
+
removeAllByTagName(root, 'w:ins');
|
|
476
|
+
// Step 3: Remove paragraphs that ONLY had w:ins content
|
|
477
|
+
for (const p of paragraphsToRemove) {
|
|
478
|
+
if (p.parentNode) {
|
|
479
|
+
p.parentNode.removeChild(p);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Remove w:moveTo elements entirely
|
|
483
|
+
removeAllByTagName(root, 'w:moveTo');
|
|
484
|
+
// Remove move range markers
|
|
485
|
+
removeAllByTagName(root, 'w:moveFromRangeStart');
|
|
486
|
+
removeAllByTagName(root, 'w:moveFromRangeEnd');
|
|
487
|
+
removeAllByTagName(root, 'w:moveToRangeStart');
|
|
488
|
+
removeAllByTagName(root, 'w:moveToRangeEnd');
|
|
489
|
+
// Unwrap w:del elements (keep content, remove wrapper)
|
|
490
|
+
unwrapAllByTagName(root, 'w:del');
|
|
491
|
+
// Unwrap w:moveFrom elements
|
|
492
|
+
unwrapAllByTagName(root, 'w:moveFrom');
|
|
493
|
+
// Convert w:delText to w:t
|
|
494
|
+
for (const delText of findAllByTagName(root, 'w:delText')) {
|
|
495
|
+
renameElement(delText, 'w:t');
|
|
496
|
+
}
|
|
497
|
+
// Convert w:delInstrText to w:instrText
|
|
498
|
+
for (const delInstrText of findAllByTagName(root, 'w:delInstrText')) {
|
|
499
|
+
renameElement(delInstrText, 'w:instrText');
|
|
500
|
+
}
|
|
501
|
+
// Remove format change tracking
|
|
502
|
+
removeAllByTagName(root, 'w:rPrChange');
|
|
503
|
+
removeAllByTagName(root, 'w:pPrChange');
|
|
504
|
+
// Strip paragraph-level markers now that changes are rejected.
|
|
505
|
+
removeParaMarkers(root);
|
|
506
|
+
return serializeToXml(root);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Extract plain text content from document XML (AST-based).
|
|
510
|
+
*
|
|
511
|
+
* @param documentXml - The document.xml content
|
|
512
|
+
* @returns Plain text content
|
|
513
|
+
*/
|
|
514
|
+
export function extractTextContent(documentXml) {
|
|
515
|
+
const root = parseDocumentXml(documentXml);
|
|
516
|
+
const texts = [];
|
|
517
|
+
// Extract text from w:t elements
|
|
518
|
+
for (const t of findAllByTagName(root, 'w:t')) {
|
|
519
|
+
const text = getLeafText(t) ?? '';
|
|
520
|
+
if (text) {
|
|
521
|
+
texts.push(text);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
// Also extract from w:delText (for rejected changes before conversion)
|
|
525
|
+
for (const delText of findAllByTagName(root, 'w:delText')) {
|
|
526
|
+
const text = getLeafText(delText) ?? '';
|
|
527
|
+
if (text) {
|
|
528
|
+
texts.push(text);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return texts.join('');
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Extract text in document order, respecting paragraph breaks (AST-based).
|
|
535
|
+
*/
|
|
536
|
+
export function extractTextWithParagraphs(documentXml) {
|
|
537
|
+
const root = parseDocumentXml(documentXml);
|
|
538
|
+
const paragraphs = [];
|
|
539
|
+
// Find all paragraphs
|
|
540
|
+
for (const p of findAllByTagName(root, 'w:p')) {
|
|
541
|
+
const texts = [];
|
|
542
|
+
// Extract text from w:t elements within this paragraph
|
|
543
|
+
for (const t of findAllByTagName(p, 'w:t')) {
|
|
544
|
+
const text = getLeafText(t) ?? '';
|
|
545
|
+
if (text) {
|
|
546
|
+
texts.push(text);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
// Also check w:delText
|
|
550
|
+
for (const delText of findAllByTagName(p, 'w:delText')) {
|
|
551
|
+
const text = getLeafText(delText) ?? '';
|
|
552
|
+
if (text) {
|
|
553
|
+
texts.push(text);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
paragraphs.push(texts.join(''));
|
|
557
|
+
}
|
|
558
|
+
return paragraphs.join('\n');
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Normalize text for comparison (handles whitespace differences).
|
|
562
|
+
*
|
|
563
|
+
* Performs the following normalization:
|
|
564
|
+
* - Convert CRLF and CR to LF
|
|
565
|
+
* - Convert tabs to spaces
|
|
566
|
+
* - Collapse multiple spaces to single space
|
|
567
|
+
* - Strip trailing spaces from each line
|
|
568
|
+
* - Collapse multiple newlines to single newline
|
|
569
|
+
* - Trim leading/trailing whitespace
|
|
570
|
+
*/
|
|
571
|
+
export function normalizeText(text) {
|
|
572
|
+
return text
|
|
573
|
+
.replace(/\r\n/g, '\n')
|
|
574
|
+
.replace(/\r/g, '\n')
|
|
575
|
+
.replace(/\t/g, ' ')
|
|
576
|
+
.replace(/ +/g, ' ')
|
|
577
|
+
.replace(/ \n/g, '\n') // Strip trailing spaces from lines
|
|
578
|
+
.replace(/\n /g, '\n') // Strip leading spaces from lines
|
|
579
|
+
.replace(/\n+/g, '\n')
|
|
580
|
+
.trim();
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Compare two texts and return detailed differences.
|
|
584
|
+
*/
|
|
585
|
+
export function compareTexts(expected, actual) {
|
|
586
|
+
const normalizedExpected = normalizeText(expected);
|
|
587
|
+
const normalizedActual = normalizeText(actual);
|
|
588
|
+
const differences = [];
|
|
589
|
+
if (expected !== actual) {
|
|
590
|
+
// Find first difference
|
|
591
|
+
let firstDiff = 0;
|
|
592
|
+
while (firstDiff < expected.length && firstDiff < actual.length) {
|
|
593
|
+
if (expected[firstDiff] !== actual[firstDiff]) {
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
firstDiff++;
|
|
597
|
+
}
|
|
598
|
+
if (firstDiff < expected.length || firstDiff < actual.length) {
|
|
599
|
+
const context = 50;
|
|
600
|
+
const start = Math.max(0, firstDiff - context);
|
|
601
|
+
const expectedSnippet = expected.slice(start, firstDiff + context);
|
|
602
|
+
const actualSnippet = actual.slice(start, firstDiff + context);
|
|
603
|
+
differences.push(`First difference at position ${firstDiff}:`);
|
|
604
|
+
differences.push(` Expected: "...${expectedSnippet}..."`);
|
|
605
|
+
differences.push(` Actual: "...${actualSnippet}..."`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
identical: expected === actual,
|
|
610
|
+
normalizedIdentical: normalizedExpected === normalizedActual,
|
|
611
|
+
expectedLength: expected.length,
|
|
612
|
+
actualLength: actual.length,
|
|
613
|
+
differences,
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
//# sourceMappingURL=trackChangesAcceptorAst.js.map
|