ooxml-core 1.37.0 → 1.38.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/README.md +7 -0
- package/dist/automation/index.cjs +207 -207
- package/dist/automation/index.mjs +207 -207
- package/dist/{chunk-M2DFN3SP.mjs → chunk-XBIZIBTJ.mjs} +507 -10
- package/dist/collab/merge-values.d.ts +14 -0
- package/dist/collab/merge-values.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +476 -474
- package/dist/docx/embedded.mjs +476 -474
- package/dist/docx/index.cjs +1075 -719
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +1075 -720
- package/dist/docx/layout/index.cjs +4 -0
- package/dist/docx/layout/index.mjs +4 -0
- package/dist/docx/load/index.cjs +164 -164
- package/dist/docx/load/index.mjs +164 -164
- package/dist/docx/merge-snapshots.d.ts +9 -0
- package/dist/docx/merge-snapshots.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +155 -155
- package/dist/docx/ui/index.mjs +155 -155
- package/dist/embedding/index.cjs +207 -0
- package/dist/embedding/index.d.ts +3 -0
- package/dist/embedding/index.d.ts.map +1 -1
- package/dist/embedding/index.mjs +205 -1
- package/dist/embedding/onedrive/client.d.ts +4 -0
- package/dist/embedding/onedrive/client.d.ts.map +1 -0
- package/dist/embedding/onedrive/index.cjs +617 -0
- package/dist/embedding/onedrive/index.d.ts +6 -0
- package/dist/embedding/onedrive/index.d.ts.map +1 -0
- package/dist/embedding/onedrive/index.mjs +611 -0
- package/dist/embedding/onedrive/metadata.d.ts +6 -0
- package/dist/embedding/onedrive/metadata.d.ts.map +1 -0
- package/dist/embedding/onedrive/requests.d.ts +8 -0
- package/dist/embedding/onedrive/requests.d.ts.map +1 -0
- package/dist/embedding/onedrive/session.d.ts +4 -0
- package/dist/embedding/onedrive/session.d.ts.map +1 -0
- package/dist/embedding/onedrive/transport.d.ts +9 -0
- package/dist/embedding/onedrive/transport.d.ts.map +1 -0
- package/dist/embedding/onedrive/types.d.ts +86 -0
- package/dist/embedding/onedrive/types.d.ts.map +1 -0
- package/dist/embedding/onedrive/upload.d.ts +3 -0
- package/dist/embedding/onedrive/upload.d.ts.map +1 -0
- package/dist/embedding/storage-merge.d.ts +8 -0
- package/dist/embedding/storage-merge.d.ts.map +1 -0
- package/dist/embedding/storage-session.d.ts +7 -0
- package/dist/embedding/storage-session.d.ts.map +1 -0
- package/dist/embedding/versioned-storage.d.ts +67 -0
- package/dist/embedding/versioned-storage.d.ts.map +1 -0
- package/dist/index.cjs +1013 -340
- package/dist/index.mjs +1013 -340
- package/dist/opc/index.cjs +680 -216
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +680 -217
- package/dist/opc/merge-snapshots.d.ts +26 -0
- package/dist/opc/merge-snapshots.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +20 -6
- package/dist/pptx/automation/index.d.ts +8 -17
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +1 -1
- package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/chart-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/chart-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/element-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/element-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/export-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/export-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/geometry-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/geometry-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/index.d.ts +1 -3
- package/dist/pptx/automation/schemas/index.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/json-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/json-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/layout-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/layout-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/lock-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/lock-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/metadata-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/metadata-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/ole-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/ole-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/presentation-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/presentation-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/section-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/section-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/slide-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/slide-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/smartart-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/smartart-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/table-style-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/table-style-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/template-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/template-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/theme-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/theme-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/validation-schemas.d.ts +1 -3
- package/dist/pptx/automation/schemas/validation-schemas.d.ts.map +1 -1
- package/dist/pptx/chunks/{collaboration-text-codec-Du_XeE_i.d.ts → collaboration-text-codec-1VmwD3yq.d.ts} +1 -3
- package/dist/pptx/chunks/collaboration-text-codec-1VmwD3yq.d.ts.map +1 -0
- package/dist/pptx/chunks/{collaboration-text-merge-DWWWdT_t.d.ts → collaboration-text-merge-B-tth-0W.d.ts} +2 -4
- package/dist/pptx/chunks/collaboration-text-merge-B-tth-0W.d.ts.map +1 -0
- package/dist/pptx/chunks/{collaboration-text-positions-MMT3GkZi.d.ts → collaboration-text-positions-D-1Jo1Fz.d.ts} +1 -3
- package/dist/pptx/chunks/collaboration-text-positions-D-1Jo1Fz.d.ts.map +1 -0
- package/dist/pptx/chunks/{collaboration-text-session-D0NOLQk7.d.ts → collaboration-text-session-CWHTaWF4.d.ts} +4 -6
- package/dist/pptx/chunks/collaboration-text-session-CWHTaWF4.d.ts.map +1 -0
- package/dist/pptx/chunks/{collaboration-text-session-delta-CzJGrTKJ.d.ts → collaboration-text-session-delta-Dxzybssp.d.ts} +2 -4
- package/dist/pptx/chunks/collaboration-text-session-delta-Dxzybssp.d.ts.map +1 -0
- package/dist/pptx/chunks/{color-ref-DT599vEx.d.ts → color-ref-CwUQoKPJ.d.ts} +1 -3
- package/dist/pptx/chunks/color-ref-CwUQoKPJ.d.ts.map +1 -0
- package/dist/pptx/chunks/{elements-f3UbFph-.d.ts → elements-DheCTwi0.d.ts} +4 -54
- package/dist/pptx/chunks/elements-DheCTwi0.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-Bp-1pGo1.d.ts → index-B4ofjG6_.d.ts} +6 -384
- package/dist/pptx/chunks/index-B4ofjG6_.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BnH2QjYm.d.ts → index-Jcce8TlI.d.ts} +5 -37
- package/dist/pptx/chunks/index-Jcce8TlI.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-pLLN4OTz.d.ts → index-bgj0Ztnq.d.ts} +23 -543
- package/dist/pptx/chunks/index-bgj0Ztnq.d.ts.map +1 -0
- package/dist/pptx/chunks/{inspection-status-DjiWd_Aa.d.ts → inspection-status-TKac7eqb.d.ts} +1 -13
- package/dist/pptx/chunks/inspection-status-TKac7eqb.d.ts.map +1 -0
- package/dist/pptx/chunks/{schemas-fuDGetRe.d.ts → schemas-LHsDbVOw.d.ts} +1 -29
- package/dist/pptx/chunks/schemas-LHsDbVOw.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-CmOrPLLQ.d.ts → smart-art-DB37AsFP.d.ts} +2 -46
- package/dist/pptx/chunks/smart-art-DB37AsFP.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-D5sgspO6.d.ts → text-operations-CdgEnFuK.d.ts} +4 -32
- package/dist/pptx/chunks/text-operations-CdgEnFuK.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-P9xVnXXf.d.ts → text-t_wJ2OwM.d.ts} +2 -12
- package/dist/pptx/chunks/text-t_wJ2OwM.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +20 -6
- package/dist/pptx/cli/index.d.ts +1 -3
- package/dist/pptx/cli/index.d.ts.map +1 -1
- package/dist/pptx/converter/index.cjs +7 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/editor/ai/table-merge.d.ts +0 -2
- package/dist/pptx/editor/ai/table-merge.d.ts.map +1 -1
- package/dist/pptx/editor/loader/element-patch-walker.d.ts +0 -2
- package/dist/pptx/editor/loader/element-patch-walker.d.ts.map +1 -1
- package/dist/pptx/editor/loader/is-external-url.d.ts +0 -2
- package/dist/pptx/editor/loader/is-external-url.d.ts.map +1 -1
- package/dist/pptx/editor/loader/lazy-image-resolution.d.ts +0 -2
- package/dist/pptx/editor/loader/lazy-image-resolution.d.ts.map +1 -1
- package/dist/pptx/editor/loader/load-content-helpers.d.ts +0 -2
- package/dist/pptx/editor/loader/load-content-helpers.d.ts.map +1 -1
- package/dist/pptx/editor/loader/table-style-image-paths.d.ts +0 -2
- package/dist/pptx/editor/loader/table-style-image-paths.d.ts.map +1 -1
- package/dist/pptx/editor/loader/text-fill-image-paths.d.ts +0 -2
- package/dist/pptx/editor/loader/text-fill-image-paths.d.ts.map +1 -1
- package/dist/pptx/editor/render/bullet-list.d.ts +0 -2
- package/dist/pptx/editor/render/bullet-list.d.ts.map +1 -1
- package/dist/pptx/editor/render/bullet-toggle.d.ts +0 -2
- package/dist/pptx/editor/render/bullet-toggle.d.ts.map +1 -1
- package/dist/pptx/editor/render/chart-user-shape-edit.d.ts +0 -2
- package/dist/pptx/editor/render/chart-user-shape-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/clone.d.ts +0 -2
- package/dist/pptx/editor/render/clone.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-active-session.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-active-session.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-departure.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-departure.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-live-patch-target.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-load-origin.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-load-origin.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-reconcile.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.d.ts +4 -8
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-codec.d.ts +1 -1
- package/dist/pptx/editor/render/collaboration-text-lease.d.ts +0 -2
- package/dist/pptx/editor/render/collaboration-text-lease.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-merge.d.ts +1 -1
- package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts +2 -4
- package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-positions.d.ts +1 -1
- package/dist/pptx/editor/render/collaboration-text-projection.d.ts +1 -3
- package/dist/pptx/editor/render/collaboration-text-projection.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-session-apply.d.ts +3 -5
- package/dist/pptx/editor/render/collaboration-text-session-apply.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-session-delta.d.ts +1 -1
- package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts +1 -3
- package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-text-session.d.ts +1 -1
- package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts +2 -4
- package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts.map +1 -1
- package/dist/pptx/editor/render/custom-show-operations.d.ts +0 -2
- package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/deck-save-encryption.d.ts +0 -2
- package/dist/pptx/editor/render/deck-save-encryption.d.ts.map +1 -1
- package/dist/pptx/editor/render/editor-history.d.ts +0 -2
- package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
- package/dist/pptx/editor/render/editor-mutations.d.ts +0 -2
- package/dist/pptx/editor/render/editor-mutations.d.ts.map +1 -1
- package/dist/pptx/editor/render/element-locks.d.ts +0 -2
- package/dist/pptx/editor/render/element-locks.d.ts.map +1 -1
- package/dist/pptx/editor/render/element-operations.d.ts +0 -2
- package/dist/pptx/editor/render/element-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/element.d.ts +0 -2
- package/dist/pptx/editor/render/element.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.d.ts +2 -4
- package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
- package/dist/pptx/editor/render/font-family-update.d.ts +1 -3
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -1
- package/dist/pptx/editor/render/group-drill.d.ts +0 -2
- package/dist/pptx/editor/render/group-drill.d.ts.map +1 -1
- package/dist/pptx/editor/render/inline-list-body.d.ts +0 -2
- package/dist/pptx/editor/render/inline-list-body.d.ts.map +1 -1
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -3
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-empty-paragraph.d.ts +0 -2
- package/dist/pptx/editor/render/remap-empty-paragraph.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-paragraph-sources.d.ts +0 -2
- package/dist/pptx/editor/render/remap-paragraph-sources.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text-bullets.d.ts +0 -2
- package/dist/pptx/editor/render/remap-text-bullets.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text.d.ts +0 -2
- package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
- package/dist/pptx/editor/render/schema-label-keys.d.ts +0 -2
- package/dist/pptx/editor/render/schema-label-keys.d.ts.map +1 -1
- package/dist/pptx/editor/render/section-operations.d.ts +0 -2
- package/dist/pptx/editor/render/section-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-background-patch.d.ts +0 -2
- package/dist/pptx/editor/render/slide-background-patch.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-operations.d.ts +0 -2
- package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-search.d.ts +0 -2
- package/dist/pptx/editor/render/slide-search.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-size-rescale.d.ts +0 -2
- package/dist/pptx/editor/render/slide-size-rescale.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-transition-edits.d.ts +0 -2
- package/dist/pptx/editor/render/slide-transition-edits.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.d.ts +0 -2
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-merge.d.ts +0 -2
- package/dist/pptx/editor/render/table-cell-merge.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.d.ts +0 -2
- package/dist/pptx/editor/render/table-data-grid-ops.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-layout.d.ts +0 -2
- package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-merge.d.ts +0 -2
- package/dist/pptx/editor/render/table-merge.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-style-editor-descriptor.d.ts +0 -2
- package/dist/pptx/editor/render/table-style-editor-descriptor.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-style-editor-edit.d.ts +0 -2
- package/dist/pptx/editor/render/table-style-editor-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-style-editor-parts.d.ts +0 -2
- package/dist/pptx/editor/render/table-style-editor-parts.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-style-map-edits.d.ts +0 -2
- package/dist/pptx/editor/render/table-style-map-edits.d.ts.map +1 -1
- package/dist/pptx/editor/render/template-editing.d.ts +0 -2
- package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
- package/dist/pptx/editor/render/text-content-style.d.ts +1 -3
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -4
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -1
- package/dist/pptx/editor/render/text-segment-paragraph-break.d.ts +0 -2
- package/dist/pptx/editor/render/text-segment-paragraph-break.d.ts.map +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +2 -4
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -1
- package/dist/pptx/editor/render/text-theme.d.ts +0 -2
- package/dist/pptx/editor/render/text-theme.d.ts.map +1 -1
- package/dist/pptx/editor/render/theme-editor-model.d.ts +0 -2
- package/dist/pptx/editor/render/theme-editor-model.d.ts.map +1 -1
- package/dist/pptx/editor/render/theme-editor-presets.d.ts +0 -2
- package/dist/pptx/editor/render/theme-editor-presets.d.ts.map +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -3
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -1
- package/dist/pptx/index.cjs +1687 -1159
- package/dist/pptx/index.d.ts +10 -10
- package/dist/pptx/index.mjs +1 -1
- package/dist/pptx/node/index.d.ts +1 -3
- package/dist/pptx/node/index.d.ts.map +1 -1
- package/dist/pptx/signature-node/index.d.ts +1 -21
- package/dist/pptx/signature-node/index.d.ts.map +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -7
- package/dist/pptx/smartart-layouts/index.d.ts.map +1 -1
- package/dist/pptx/ui/index.d.ts +1 -9
- package/dist/pptx/ui/index.d.ts.map +1 -1
- package/dist/teams/index.cjs +215 -201
- package/dist/teams/index.mjs +215 -201
- package/dist/text/index.cjs +193 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +193 -1
- package/dist/text/merge-three-way.d.ts +9 -0
- package/dist/text/merge-three-way.d.ts.map +1 -0
- package/dist/visio/collab/index.cjs +226 -7
- package/dist/visio/collab/index.d.ts +1 -0
- package/dist/visio/collab/index.d.ts.map +1 -1
- package/dist/visio/collab/index.mjs +225 -7
- package/dist/visio/collab/merge-snapshots.d.ts +14 -0
- package/dist/visio/collab/merge-snapshots.d.ts.map +1 -0
- package/dist/visio/index.cjs +9 -9
- package/dist/visio/index.mjs +9 -9
- package/dist/visio/ui/index.cjs +9 -9
- package/dist/visio/ui/index.mjs +9 -9
- package/dist/xlsx/collab/index.cjs +49966 -507
- package/dist/xlsx/collab/index.d.ts +1 -0
- package/dist/xlsx/collab/index.d.ts.map +1 -1
- package/dist/xlsx/collab/index.mjs +49961 -507
- package/dist/xlsx/collab/merge-residual.d.ts +16 -0
- package/dist/xlsx/collab/merge-residual.d.ts.map +1 -0
- package/dist/xlsx/collab/merge-snapshots.d.ts +8 -0
- package/dist/xlsx/collab/merge-snapshots.d.ts.map +1 -0
- package/dist/xlsx/index.cjs +202 -202
- package/dist/xlsx/index.mjs +202 -202
- package/dist/xlsx/load/index.cjs +155 -155
- package/dist/xlsx/load/index.mjs +155 -155
- package/dist/xlsx/ui/index.cjs +202 -202
- package/dist/xlsx/ui/index.mjs +202 -202
- package/dist/xml/index.cjs +390 -22
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.d.ts.map +1 -1
- package/dist/xml/index.mjs +390 -23
- package/dist/xml/merge-three-way.d.ts +16 -0
- package/dist/xml/merge-three-way.d.ts.map +1 -0
- package/package.json +13 -8
- package/dist/pptx/chunks/collaboration-text-codec-Du_XeE_i.d.ts.map +0 -1
- package/dist/pptx/chunks/collaboration-text-merge-DWWWdT_t.d.ts.map +0 -1
- package/dist/pptx/chunks/collaboration-text-positions-MMT3GkZi.d.ts.map +0 -1
- package/dist/pptx/chunks/collaboration-text-session-D0NOLQk7.d.ts.map +0 -1
- package/dist/pptx/chunks/collaboration-text-session-delta-CzJGrTKJ.d.ts.map +0 -1
- package/dist/pptx/chunks/color-ref-DT599vEx.d.ts.map +0 -1
- package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BnH2QjYm.d.ts.map +0 -1
- package/dist/pptx/chunks/index-Bp-1pGo1.d.ts.map +0 -1
- package/dist/pptx/chunks/index-pLLN4OTz.d.ts.map +0 -1
- package/dist/pptx/chunks/inspection-status-DjiWd_Aa.d.ts.map +0 -1
- package/dist/pptx/chunks/schemas-fuDGetRe.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +0 -1
- package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-D5sgspO6.d.ts.map +0 -1
package/dist/xml/index.cjs
CHANGED
|
@@ -115,28 +115,28 @@ var MARKUP_SKIPS = [
|
|
|
115
115
|
["<![CDATA[", "]]>"],
|
|
116
116
|
["<?", "?>"]
|
|
117
117
|
];
|
|
118
|
-
function checkXmlLimits(
|
|
118
|
+
function checkXmlLimits(xml2, label, limits = {}) {
|
|
119
119
|
const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
|
|
120
120
|
const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
|
|
121
121
|
let depth = 0;
|
|
122
122
|
let nodes = 0;
|
|
123
|
-
let at =
|
|
123
|
+
let at = xml2.indexOf("<");
|
|
124
124
|
while (at !== -1) {
|
|
125
|
-
const skip = MARKUP_SKIPS.find(([open]) =>
|
|
125
|
+
const skip = MARKUP_SKIPS.find(([open]) => xml2.startsWith(open, at));
|
|
126
126
|
if (skip) {
|
|
127
|
-
const end =
|
|
127
|
+
const end = xml2.indexOf(skip[1], at + skip[0].length);
|
|
128
128
|
if (end === -1) return;
|
|
129
|
-
at =
|
|
129
|
+
at = xml2.indexOf("<", end + skip[1].length);
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
132
132
|
TAG_RE.lastIndex = at;
|
|
133
|
-
const match = TAG_RE.exec(
|
|
133
|
+
const match = TAG_RE.exec(xml2);
|
|
134
134
|
if (!match) {
|
|
135
|
-
at =
|
|
135
|
+
at = xml2.indexOf("<", at + 1);
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
138
|
const [, closing, , selfClosing] = match;
|
|
139
|
-
at =
|
|
139
|
+
at = xml2.indexOf("<", at + match[0].length);
|
|
140
140
|
if (closing) {
|
|
141
141
|
depth--;
|
|
142
142
|
continue;
|
|
@@ -158,11 +158,11 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
158
158
|
}
|
|
159
159
|
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
160
160
|
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
161
|
-
function parseXml(
|
|
161
|
+
function parseXml(xml2, options = {}) {
|
|
162
162
|
const label = options.label ?? "OOXML";
|
|
163
|
-
if (/<!DOCTYPE|<!ENTITY/i.test(
|
|
163
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(xml2))
|
|
164
164
|
throw new Error(`${label} XML with DTD or entity declarations is not supported`);
|
|
165
|
-
checkXmlLimits(
|
|
165
|
+
checkXmlLimits(xml2, label, options.limits);
|
|
166
166
|
let parseError = "";
|
|
167
167
|
let parsed;
|
|
168
168
|
try {
|
|
@@ -170,7 +170,7 @@ function parseXml(xml, options = {}) {
|
|
|
170
170
|
onError: (level, message) => {
|
|
171
171
|
if (level !== "warning" || options.warningsAsErrors) parseError = message;
|
|
172
172
|
}
|
|
173
|
-
}).parseFromString(
|
|
173
|
+
}).parseFromString(xml2, "application/xml");
|
|
174
174
|
} catch (error) {
|
|
175
175
|
throw new Error(
|
|
176
176
|
`Invalid ${label} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -179,12 +179,12 @@ function parseXml(xml, options = {}) {
|
|
|
179
179
|
}
|
|
180
180
|
if (parseError || !parsed.documentElement)
|
|
181
181
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
182
|
-
if (CRLF_DECLARATION.test(
|
|
182
|
+
if (CRLF_DECLARATION.test(xml2)) crlfDeclarations.add(parsed);
|
|
183
183
|
return parsed;
|
|
184
184
|
}
|
|
185
185
|
var buildXml = (node) => {
|
|
186
|
-
const
|
|
187
|
-
return crlfDeclarations.has(node) ?
|
|
186
|
+
const xml2 = new xmldom.XMLSerializer().serializeToString(node);
|
|
187
|
+
return crlfDeclarations.has(node) ? xml2.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml2;
|
|
188
188
|
};
|
|
189
189
|
var isElement = (node) => node.nodeType === 1;
|
|
190
190
|
var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
@@ -201,6 +201,373 @@ function attr(element, local, ns, prefix) {
|
|
|
201
201
|
}
|
|
202
202
|
var relAttr = (element, local) => attr(element, local, NS.r, "r");
|
|
203
203
|
|
|
204
|
+
// text/text-diff.ts
|
|
205
|
+
var isLowSurrogate = (text, at) => {
|
|
206
|
+
const code = text.charCodeAt(at);
|
|
207
|
+
return code >= 56320 && code <= 57343;
|
|
208
|
+
};
|
|
209
|
+
function shortestEdit(n, m, same, maxEdits) {
|
|
210
|
+
const max = Math.min(n + m, maxEdits);
|
|
211
|
+
const offset = max + 1;
|
|
212
|
+
const v = new Int32Array(2 * max + 3);
|
|
213
|
+
const trace = [];
|
|
214
|
+
for (let d = 0; d <= max; d++) {
|
|
215
|
+
for (let k = -d; k <= d; k += 2) {
|
|
216
|
+
const down = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1];
|
|
217
|
+
let x = down ? v[offset + k + 1] : v[offset + k - 1] + 1;
|
|
218
|
+
let y = x - k;
|
|
219
|
+
while (x < n && y < m && same(x, y)) {
|
|
220
|
+
x++;
|
|
221
|
+
y++;
|
|
222
|
+
}
|
|
223
|
+
v[offset + k] = x;
|
|
224
|
+
if (x >= n && y >= m) return backtrack(trace, n, m, d);
|
|
225
|
+
}
|
|
226
|
+
trace.push(v.slice(offset - d, offset + d + 1));
|
|
227
|
+
}
|
|
228
|
+
return void 0;
|
|
229
|
+
}
|
|
230
|
+
function backtrack(trace, n, m, d) {
|
|
231
|
+
const edits = [];
|
|
232
|
+
let x = n;
|
|
233
|
+
let y = m;
|
|
234
|
+
for (let step = d; step > 0; step--) {
|
|
235
|
+
const previous = trace[step - 1];
|
|
236
|
+
const at = (k2) => previous[k2 + step - 1];
|
|
237
|
+
const k = x - y;
|
|
238
|
+
const down = k === -step || k !== step && at(k - 1) < at(k + 1);
|
|
239
|
+
const before = down ? k + 1 : k - 1;
|
|
240
|
+
const startX = at(before);
|
|
241
|
+
const startY = startX - before;
|
|
242
|
+
edits.push(down ? [startX, startY, true] : [startX, startY, false]);
|
|
243
|
+
x = startX;
|
|
244
|
+
y = startY;
|
|
245
|
+
}
|
|
246
|
+
return edits.reverse();
|
|
247
|
+
}
|
|
248
|
+
function changesOf(edits) {
|
|
249
|
+
const changes = [];
|
|
250
|
+
for (const [x, y, inserts] of edits) {
|
|
251
|
+
const last = changes.at(-1);
|
|
252
|
+
if (last && last.fromEnd === x && last.toEnd === y) {
|
|
253
|
+
if (inserts) last.toEnd++;
|
|
254
|
+
else last.fromEnd++;
|
|
255
|
+
} else
|
|
256
|
+
changes.push({
|
|
257
|
+
fromStart: x,
|
|
258
|
+
fromEnd: inserts ? x : x + 1,
|
|
259
|
+
toStart: y,
|
|
260
|
+
toEnd: inserts ? y + 1 : y
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return changes;
|
|
264
|
+
}
|
|
265
|
+
function characterChanges(a, b, maxEdits) {
|
|
266
|
+
const edits = shortestEdit(
|
|
267
|
+
a.length,
|
|
268
|
+
b.length,
|
|
269
|
+
(x, y) => a.charCodeAt(x) === b.charCodeAt(y),
|
|
270
|
+
maxEdits
|
|
271
|
+
);
|
|
272
|
+
return edits && changesOf(edits);
|
|
273
|
+
}
|
|
274
|
+
var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
|
|
275
|
+
function tokensOf(text, ids) {
|
|
276
|
+
const tokens = [];
|
|
277
|
+
const starts = [];
|
|
278
|
+
for (const match of text.matchAll(TOKEN)) {
|
|
279
|
+
let id = ids.get(match[0]);
|
|
280
|
+
if (id === void 0) ids.set(match[0], id = ids.size);
|
|
281
|
+
tokens.push(id);
|
|
282
|
+
starts.push(match.index);
|
|
283
|
+
}
|
|
284
|
+
starts.push(text.length);
|
|
285
|
+
return { tokens, starts };
|
|
286
|
+
}
|
|
287
|
+
function tokenChanges(a, b, maxEdits) {
|
|
288
|
+
const ids = /* @__PURE__ */ new Map();
|
|
289
|
+
const from = tokensOf(a, ids);
|
|
290
|
+
const to = tokensOf(b, ids);
|
|
291
|
+
const edits = shortestEdit(
|
|
292
|
+
from.tokens.length,
|
|
293
|
+
to.tokens.length,
|
|
294
|
+
(x, y) => from.tokens[x] === to.tokens[y],
|
|
295
|
+
maxEdits
|
|
296
|
+
);
|
|
297
|
+
if (!edits) return void 0;
|
|
298
|
+
let budget = maxEdits;
|
|
299
|
+
return changesOf(edits).flatMap((stretch) => {
|
|
300
|
+
const change = {
|
|
301
|
+
fromStart: from.starts[stretch.fromStart],
|
|
302
|
+
fromEnd: from.starts[stretch.fromEnd],
|
|
303
|
+
toStart: to.starts[stretch.toStart],
|
|
304
|
+
toEnd: to.starts[stretch.toEnd]
|
|
305
|
+
};
|
|
306
|
+
const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
|
|
307
|
+
a.slice(change.fromStart, change.fromEnd),
|
|
308
|
+
b.slice(change.toStart, change.toEnd),
|
|
309
|
+
budget
|
|
310
|
+
) : void 0;
|
|
311
|
+
if (!inner) return [change];
|
|
312
|
+
for (const found of inner)
|
|
313
|
+
budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
|
|
314
|
+
return inner.map((found) => ({
|
|
315
|
+
fromStart: found.fromStart + change.fromStart,
|
|
316
|
+
fromEnd: found.fromEnd + change.fromStart,
|
|
317
|
+
toStart: found.toStart + change.toStart,
|
|
318
|
+
toEnd: found.toEnd + change.toStart
|
|
319
|
+
}));
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function diffText(from, to, maxEdits = 500) {
|
|
323
|
+
let start = 0;
|
|
324
|
+
while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
|
|
325
|
+
start++;
|
|
326
|
+
let end = 0;
|
|
327
|
+
while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
|
|
328
|
+
end++;
|
|
329
|
+
const a = from.slice(start, from.length - end);
|
|
330
|
+
const b = to.slice(start, to.length - end);
|
|
331
|
+
if (!a.length && !b.length) return [];
|
|
332
|
+
const found = a.length && b.length ? characterChanges(a, b, maxEdits) ?? tokenChanges(a, b, maxEdits) : void 0;
|
|
333
|
+
const changes = found ?? [{ fromStart: 0, fromEnd: a.length, toStart: 0, toEnd: b.length }];
|
|
334
|
+
const result = [];
|
|
335
|
+
for (const change of changes) {
|
|
336
|
+
const placed = {
|
|
337
|
+
fromStart: change.fromStart + start,
|
|
338
|
+
fromEnd: change.fromEnd + start,
|
|
339
|
+
toStart: change.toStart + start,
|
|
340
|
+
toEnd: change.toEnd + start
|
|
341
|
+
};
|
|
342
|
+
if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
|
|
343
|
+
placed.fromStart--;
|
|
344
|
+
placed.toStart--;
|
|
345
|
+
}
|
|
346
|
+
if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
|
|
347
|
+
placed.fromEnd++;
|
|
348
|
+
placed.toEnd++;
|
|
349
|
+
}
|
|
350
|
+
const last = result.at(-1);
|
|
351
|
+
if (last && placed.fromStart <= last.fromEnd) {
|
|
352
|
+
last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
|
|
353
|
+
last.toEnd = Math.max(last.toEnd, placed.toEnd);
|
|
354
|
+
} else result.push(placed);
|
|
355
|
+
}
|
|
356
|
+
return result;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// text/merge-three-way.ts
|
|
360
|
+
function mergeTextThreeWay(base, local, remote) {
|
|
361
|
+
if (local === remote || base === remote) return { status: "merged", text: local };
|
|
362
|
+
if (base === local) return { status: "merged", text: remote };
|
|
363
|
+
if (Math.max(base.length, local.length, remote.length) > 1e6)
|
|
364
|
+
return { status: "unresolved" };
|
|
365
|
+
const changes = (value) => diffText(base, value).map((change) => ({
|
|
366
|
+
start: change.fromStart,
|
|
367
|
+
end: change.fromEnd,
|
|
368
|
+
text: value.slice(change.toStart, change.toEnd)
|
|
369
|
+
}));
|
|
370
|
+
const edits = changes(local);
|
|
371
|
+
for (const next of changes(remote)) {
|
|
372
|
+
if (edits.some(
|
|
373
|
+
(edit) => edit.start === next.start && edit.end === next.end && edit.text === next.text
|
|
374
|
+
))
|
|
375
|
+
continue;
|
|
376
|
+
if (edits.some((edit) => {
|
|
377
|
+
if (edit.start === edit.end && next.start === next.end) return false;
|
|
378
|
+
if (edit.start === edit.end) return edit.start > next.start && edit.start < next.end;
|
|
379
|
+
if (next.start === next.end) return next.start > edit.start && next.start < edit.end;
|
|
380
|
+
return edit.start < next.end && next.start < edit.end;
|
|
381
|
+
}))
|
|
382
|
+
return { status: "unresolved" };
|
|
383
|
+
edits.push(next);
|
|
384
|
+
}
|
|
385
|
+
edits.sort(
|
|
386
|
+
(a, b) => a.start - b.start || a.end - b.end || (a.text < b.text ? -1 : a.text > b.text ? 1 : 0)
|
|
387
|
+
);
|
|
388
|
+
let text = "", cursor = 0;
|
|
389
|
+
for (const edit of edits) {
|
|
390
|
+
text += base.slice(cursor, edit.start) + edit.text;
|
|
391
|
+
cursor = edit.end;
|
|
392
|
+
}
|
|
393
|
+
return { status: "merged", text: text + base.slice(cursor) };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// xml/merge-three-way.ts
|
|
397
|
+
var tag = (node) => `${node.namespaceURI ?? ""}|${node.localName ?? node.tagName}`;
|
|
398
|
+
var xml = (node) => node ? buildXml(node) : void 0;
|
|
399
|
+
function childrenByKey(parent, options, repeated) {
|
|
400
|
+
const result = /* @__PURE__ */ new Map();
|
|
401
|
+
const counts = /* @__PURE__ */ new Map();
|
|
402
|
+
for (const child of elements(parent)) {
|
|
403
|
+
const name = tag(child), explicit = options.keyElement?.(child, parent);
|
|
404
|
+
const index = counts.get(name) ?? 0;
|
|
405
|
+
counts.set(name, index + 1);
|
|
406
|
+
if (!explicit && repeated.has(name) && !options.allowPositional?.(parent))
|
|
407
|
+
throw new Error("Ambiguous repeated elements");
|
|
408
|
+
const key = explicit ? `${name}@${explicit}` : `${name}#${index}`;
|
|
409
|
+
if (result.has(key)) throw new Error("Duplicate element identity");
|
|
410
|
+
result.set(key, child);
|
|
411
|
+
}
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
function orderKeys(base, local, remote) {
|
|
415
|
+
const same = (a, b) => a.length === b.length && a.every((key, index) => key === b[index]);
|
|
416
|
+
if (same(base, local)) return [...remote];
|
|
417
|
+
if (same(base, remote) || same(local, remote)) return [...local];
|
|
418
|
+
const keys = [.../* @__PURE__ */ new Set([...remote, ...local])].sort();
|
|
419
|
+
const edges = new Map(keys.map((key) => [key, /* @__PURE__ */ new Set()]));
|
|
420
|
+
const degree = new Map(keys.map((key) => [key, 0]));
|
|
421
|
+
for (const sequence of [local, remote])
|
|
422
|
+
for (let i = 1; i < sequence.length; i++) {
|
|
423
|
+
const previous = sequence[i - 1], next = sequence[i];
|
|
424
|
+
if (!edges.get(previous).has(next)) {
|
|
425
|
+
edges.get(previous).add(next);
|
|
426
|
+
degree.set(next, degree.get(next) + 1);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const out = [];
|
|
430
|
+
const ready = keys.filter((key) => degree.get(key) === 0);
|
|
431
|
+
while (ready.length) {
|
|
432
|
+
const next = ready.sort().shift();
|
|
433
|
+
out.push(next);
|
|
434
|
+
for (const key of edges.get(next)) {
|
|
435
|
+
degree.set(key, degree.get(key) - 1);
|
|
436
|
+
if (degree.get(key) === 0) ready.push(key);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return out.length === keys.length ? out : void 0;
|
|
440
|
+
}
|
|
441
|
+
function mergeXmlThreeWay(baseXml, localXml, remoteXml, options = {}) {
|
|
442
|
+
if (localXml === remoteXml || baseXml === remoteXml) return { status: "merged", xml: localXml };
|
|
443
|
+
if (baseXml === localXml) return { status: "merged", xml: remoteXml };
|
|
444
|
+
const issues = [];
|
|
445
|
+
try {
|
|
446
|
+
let merge2 = function(b, l, r, path) {
|
|
447
|
+
const bx = xml(b), lx = xml(l), rx = xml(r);
|
|
448
|
+
if (lx === rx || bx === rx) return l ? copy(l) : void 0;
|
|
449
|
+
if (bx === lx) return r ? copy(r) : void 0;
|
|
450
|
+
if (!b && l && r && tag(l) === tag(r) && !elements(l).length && !elements(r).length) {
|
|
451
|
+
const resolved = options.resolveText?.(r, l, r);
|
|
452
|
+
if (resolved !== void 0) {
|
|
453
|
+
const node = copy(r);
|
|
454
|
+
node.textContent = resolved;
|
|
455
|
+
return node;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (!b || !l || !r || tag(b) !== tag(l) || tag(b) !== tag(r)) {
|
|
459
|
+
issues.push(`${path}: overlapping structural changes`);
|
|
460
|
+
return void 0;
|
|
461
|
+
}
|
|
462
|
+
const out = remote.createElementNS(r.namespaceURI, r.tagName);
|
|
463
|
+
const attrs = (node) => new Map(
|
|
464
|
+
Array.from(node.attributes).map((a) => [
|
|
465
|
+
`${a.namespaceURI ?? ""}|${a.localName ?? a.name}`,
|
|
466
|
+
a
|
|
467
|
+
])
|
|
468
|
+
);
|
|
469
|
+
const ba = attrs(b), la = attrs(l), ra = attrs(r);
|
|
470
|
+
for (const key of /* @__PURE__ */ new Set([...ba.keys(), ...la.keys(), ...ra.keys()])) {
|
|
471
|
+
const old = ba.get(key)?.value, left = la.get(key)?.value, right = ra.get(key)?.value;
|
|
472
|
+
const value = left === right || right === old ? left : left === old ? right : void 0;
|
|
473
|
+
if (left !== right && left !== old && right !== old) {
|
|
474
|
+
issues.push(`${path}: overlapping attribute ${key}`);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
const source = ra.get(key) ?? la.get(key) ?? ba.get(key);
|
|
478
|
+
if (value !== void 0) out.setAttributeNS(source.namespaceURI, source.name, value);
|
|
479
|
+
}
|
|
480
|
+
const lists = [b, l, r].map(elements);
|
|
481
|
+
if (lists.every((list) => list.length === 0)) {
|
|
482
|
+
if ([b, l, r].some(
|
|
483
|
+
(node) => Array.from(node.childNodes).some(
|
|
484
|
+
(child) => child.nodeType !== 3 && child.nodeType !== 4
|
|
485
|
+
)
|
|
486
|
+
)) {
|
|
487
|
+
issues.push(`${path}: non-text leaf content requires explicit preservation`);
|
|
488
|
+
return void 0;
|
|
489
|
+
}
|
|
490
|
+
const texts = [b, l, r].map((node) => node.textContent ?? "");
|
|
491
|
+
const override = options.resolveText?.(b, l, r);
|
|
492
|
+
const value = override !== void 0 ? { status: "merged", text: override } : texts[1] === texts[2] || texts[0] === texts[2] ? { status: "merged", text: texts[1] } : texts[0] === texts[1] ? { status: "merged", text: texts[2] } : options.allowText?.(b) ? mergeTextThreeWay(texts[0], texts[1], texts[2]) : { status: "unresolved" };
|
|
493
|
+
if (value.status !== "merged") issues.push(`${path}: overlapping text changes`);
|
|
494
|
+
else if (value.text) out.appendChild(remote.createTextNode(value.text));
|
|
495
|
+
return out;
|
|
496
|
+
}
|
|
497
|
+
if ([b, l, r].some(
|
|
498
|
+
(node) => Array.from(node.childNodes).some(
|
|
499
|
+
(child) => child.nodeType !== 1 && (child.nodeType !== 3 || Boolean(child.textContent?.trim()))
|
|
500
|
+
)
|
|
501
|
+
)) {
|
|
502
|
+
issues.push(`${path}: mixed content cannot be matched safely`);
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
506
|
+
const groups = lists.map((list) => {
|
|
507
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
508
|
+
for (const child of list) {
|
|
509
|
+
const name = tag(child), group = grouped.get(name) ?? [];
|
|
510
|
+
group.push(child);
|
|
511
|
+
grouped.set(name, group);
|
|
512
|
+
if (group.length > 1) repeated.add(name);
|
|
513
|
+
}
|
|
514
|
+
return grouped;
|
|
515
|
+
});
|
|
516
|
+
for (const name of repeated) {
|
|
517
|
+
const rows = groups.map((group) => group.get(name) ?? []);
|
|
518
|
+
if (rows.some((row) => row.some((child) => options.keyElement?.(child, b) !== void 0)))
|
|
519
|
+
continue;
|
|
520
|
+
if (rows.some((row) => row.length !== rows[0].length)) {
|
|
521
|
+
issues.push(`${path}: unkeyed structural changes`);
|
|
522
|
+
return void 0;
|
|
523
|
+
}
|
|
524
|
+
const before = rows[0].map((child) => buildXml(child));
|
|
525
|
+
const known = new Set(before);
|
|
526
|
+
for (const row of rows.slice(1))
|
|
527
|
+
if (row.some((child, i) => {
|
|
528
|
+
const value = buildXml(child);
|
|
529
|
+
return before[i] !== value && known.has(value);
|
|
530
|
+
})) {
|
|
531
|
+
issues.push(`${path}: reordered unkeyed elements`);
|
|
532
|
+
return void 0;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
let maps;
|
|
536
|
+
try {
|
|
537
|
+
maps = [b, l, r].map((parent) => childrenByKey(parent, options, repeated));
|
|
538
|
+
} catch {
|
|
539
|
+
issues.push(`${path}: ambiguous element identities`);
|
|
540
|
+
return void 0;
|
|
541
|
+
}
|
|
542
|
+
const [bm, lm, rm] = maps;
|
|
543
|
+
const merged = /* @__PURE__ */ new Map();
|
|
544
|
+
for (const key of /* @__PURE__ */ new Set([...bm.keys(), ...lm.keys(), ...rm.keys()])) {
|
|
545
|
+
const node = merge2(bm.get(key), lm.get(key), rm.get(key), `${path}/${key}`);
|
|
546
|
+
if (node) merged.set(key, node);
|
|
547
|
+
}
|
|
548
|
+
const surviving = (map) => [...map.keys()].filter((key) => merged.has(key));
|
|
549
|
+
const order = orderKeys(surviving(bm), surviving(lm), surviving(rm));
|
|
550
|
+
if (!order) {
|
|
551
|
+
issues.push(`${path}: incompatible element order`);
|
|
552
|
+
return void 0;
|
|
553
|
+
}
|
|
554
|
+
for (const key of order) out.appendChild(merged.get(key));
|
|
555
|
+
return out;
|
|
556
|
+
};
|
|
557
|
+
var merge = merge2;
|
|
558
|
+
const base = parseXml(baseXml, { warningsAsErrors: true });
|
|
559
|
+
const local = parseXml(localXml, { warningsAsErrors: true });
|
|
560
|
+
const remote = parseXml(remoteXml, { warningsAsErrors: true });
|
|
561
|
+
const copy = (node) => remote.importNode(node, true);
|
|
562
|
+
const root = merge2(base.documentElement, local.documentElement, remote.documentElement, "root");
|
|
563
|
+
if (!root || issues.length) return { status: "unresolved", issues };
|
|
564
|
+
remote.replaceChild(root, remote.documentElement);
|
|
565
|
+
return { status: "merged", xml: buildXml(remote) };
|
|
566
|
+
} catch {
|
|
567
|
+
return { status: "unresolved", issues: ["Invalid or unsupported XML input"] };
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
204
571
|
// xml/lite.ts
|
|
205
572
|
var LiteElement = class {
|
|
206
573
|
constructor(tagName, localName, namespaceURI) {
|
|
@@ -268,22 +635,22 @@ function decode(text) {
|
|
|
268
635
|
return ampersands === found ? out : void 0;
|
|
269
636
|
}
|
|
270
637
|
var isSpace = (code) => code === 32 || code === 9 || code === 10 || code === 13;
|
|
271
|
-
var hasLineEnds = (
|
|
638
|
+
var hasLineEnds = (xml2) => xml2.includes("\r") || xml2.includes("\x85") || xml2.includes("\u2028") || xml2.includes("\u2029");
|
|
272
639
|
var LiteDeclinedError = class extends Error {
|
|
273
640
|
constructor() {
|
|
274
641
|
super("The XML fragment needs the full parser");
|
|
275
642
|
this.name = "LiteDeclinedError";
|
|
276
643
|
}
|
|
277
644
|
};
|
|
278
|
-
function parseLiteFragment(
|
|
279
|
-
const nodes = topLevelNodes(
|
|
645
|
+
function parseLiteFragment(xml2, container, namespaces) {
|
|
646
|
+
const nodes = topLevelNodes(xml2, namespaces);
|
|
280
647
|
for (let next = nodes.next(); ; next = nodes.next()) {
|
|
281
648
|
if (next.done) return next.value ? container : void 0;
|
|
282
649
|
container.childNodes.push(next.value);
|
|
283
650
|
}
|
|
284
651
|
}
|
|
285
|
-
function* liteChildElements(
|
|
286
|
-
const nodes = topLevelNodes(
|
|
652
|
+
function* liteChildElements(xml2, namespaces) {
|
|
653
|
+
const nodes = topLevelNodes(xml2, namespaces);
|
|
287
654
|
for (let next = nodes.next(); ; next = nodes.next()) {
|
|
288
655
|
if (next.done) {
|
|
289
656
|
if (next.value) return;
|
|
@@ -292,8 +659,8 @@ function* liteChildElements(xml, namespaces) {
|
|
|
292
659
|
if (typeof next.value !== "string") yield next.value.asElement();
|
|
293
660
|
}
|
|
294
661
|
}
|
|
295
|
-
function* topLevelNodes(
|
|
296
|
-
const source = hasLineEnds(
|
|
662
|
+
function* topLevelNodes(xml2, namespaces) {
|
|
663
|
+
const source = hasLineEnds(xml2) ? xml2.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n") : xml2;
|
|
297
664
|
const root = new LiteElement("", "", null);
|
|
298
665
|
const level = root.childNodes;
|
|
299
666
|
const stack = [root];
|
|
@@ -438,6 +805,7 @@ exports.first = first;
|
|
|
438
805
|
exports.isElement = isElement;
|
|
439
806
|
exports.liteChildElements = liteChildElements;
|
|
440
807
|
exports.makeNS = makeNS;
|
|
808
|
+
exports.mergeXmlThreeWay = mergeXmlThreeWay;
|
|
441
809
|
exports.named = named;
|
|
442
810
|
exports.parseLiteFragment = parseLiteFragment;
|
|
443
811
|
exports.parseXml = parseXml;
|
package/dist/xml/index.d.ts
CHANGED
package/dist/xml/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../xml/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../xml/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|