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/docx/index.mjs
CHANGED
|
@@ -2,6 +2,198 @@ import { XMLSerializer, DOMParser } from '@xmldom/xmldom';
|
|
|
2
2
|
import JSZip from 'jszip';
|
|
3
3
|
import { Inflate } from 'fflate';
|
|
4
4
|
|
|
5
|
+
// text/text-diff.ts
|
|
6
|
+
var isLowSurrogate = (text2, at) => {
|
|
7
|
+
const code = text2.charCodeAt(at);
|
|
8
|
+
return code >= 56320 && code <= 57343;
|
|
9
|
+
};
|
|
10
|
+
function shortestEdit(n2, m, same6, maxEdits) {
|
|
11
|
+
const max = Math.min(n2 + m, maxEdits);
|
|
12
|
+
const offset = max + 1;
|
|
13
|
+
const v = new Int32Array(2 * max + 3);
|
|
14
|
+
const trace = [];
|
|
15
|
+
for (let d = 0; d <= max; d++) {
|
|
16
|
+
for (let k = -d; k <= d; k += 2) {
|
|
17
|
+
const down = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1];
|
|
18
|
+
let x = down ? v[offset + k + 1] : v[offset + k - 1] + 1;
|
|
19
|
+
let y = x - k;
|
|
20
|
+
while (x < n2 && y < m && same6(x, y)) {
|
|
21
|
+
x++;
|
|
22
|
+
y++;
|
|
23
|
+
}
|
|
24
|
+
v[offset + k] = x;
|
|
25
|
+
if (x >= n2 && y >= m) return backtrack(trace, n2, m, d);
|
|
26
|
+
}
|
|
27
|
+
trace.push(v.slice(offset - d, offset + d + 1));
|
|
28
|
+
}
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
function backtrack(trace, n2, m, d) {
|
|
32
|
+
const edits = [];
|
|
33
|
+
let x = n2;
|
|
34
|
+
let y = m;
|
|
35
|
+
for (let step = d; step > 0; step--) {
|
|
36
|
+
const previous = trace[step - 1];
|
|
37
|
+
const at = (k2) => previous[k2 + step - 1];
|
|
38
|
+
const k = x - y;
|
|
39
|
+
const down = k === -step || k !== step && at(k - 1) < at(k + 1);
|
|
40
|
+
const before = down ? k + 1 : k - 1;
|
|
41
|
+
const startX = at(before);
|
|
42
|
+
const startY = startX - before;
|
|
43
|
+
edits.push(down ? [startX, startY, true] : [startX, startY, false]);
|
|
44
|
+
x = startX;
|
|
45
|
+
y = startY;
|
|
46
|
+
}
|
|
47
|
+
return edits.reverse();
|
|
48
|
+
}
|
|
49
|
+
function changesOf(edits) {
|
|
50
|
+
const changes = [];
|
|
51
|
+
for (const [x, y, inserts] of edits) {
|
|
52
|
+
const last = changes.at(-1);
|
|
53
|
+
if (last && last.fromEnd === x && last.toEnd === y) {
|
|
54
|
+
if (inserts) last.toEnd++;
|
|
55
|
+
else last.fromEnd++;
|
|
56
|
+
} else
|
|
57
|
+
changes.push({
|
|
58
|
+
fromStart: x,
|
|
59
|
+
fromEnd: inserts ? x : x + 1,
|
|
60
|
+
toStart: y,
|
|
61
|
+
toEnd: inserts ? y + 1 : y
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return changes;
|
|
65
|
+
}
|
|
66
|
+
function characterChanges(a2, b, maxEdits) {
|
|
67
|
+
const edits = shortestEdit(
|
|
68
|
+
a2.length,
|
|
69
|
+
b.length,
|
|
70
|
+
(x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
|
|
71
|
+
maxEdits
|
|
72
|
+
);
|
|
73
|
+
return edits && changesOf(edits);
|
|
74
|
+
}
|
|
75
|
+
var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
|
|
76
|
+
function tokensOf(text2, ids) {
|
|
77
|
+
const tokens = [];
|
|
78
|
+
const starts = [];
|
|
79
|
+
for (const match of text2.matchAll(TOKEN)) {
|
|
80
|
+
let id = ids.get(match[0]);
|
|
81
|
+
if (id === void 0) ids.set(match[0], id = ids.size);
|
|
82
|
+
tokens.push(id);
|
|
83
|
+
starts.push(match.index);
|
|
84
|
+
}
|
|
85
|
+
starts.push(text2.length);
|
|
86
|
+
return { tokens, starts };
|
|
87
|
+
}
|
|
88
|
+
function tokenChanges(a2, b, maxEdits) {
|
|
89
|
+
const ids = /* @__PURE__ */ new Map();
|
|
90
|
+
const from = tokensOf(a2, ids);
|
|
91
|
+
const to = tokensOf(b, ids);
|
|
92
|
+
const edits = shortestEdit(
|
|
93
|
+
from.tokens.length,
|
|
94
|
+
to.tokens.length,
|
|
95
|
+
(x, y) => from.tokens[x] === to.tokens[y],
|
|
96
|
+
maxEdits
|
|
97
|
+
);
|
|
98
|
+
if (!edits) return void 0;
|
|
99
|
+
let budget = maxEdits;
|
|
100
|
+
return changesOf(edits).flatMap((stretch) => {
|
|
101
|
+
const change = {
|
|
102
|
+
fromStart: from.starts[stretch.fromStart],
|
|
103
|
+
fromEnd: from.starts[stretch.fromEnd],
|
|
104
|
+
toStart: to.starts[stretch.toStart],
|
|
105
|
+
toEnd: to.starts[stretch.toEnd]
|
|
106
|
+
};
|
|
107
|
+
const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
|
|
108
|
+
a2.slice(change.fromStart, change.fromEnd),
|
|
109
|
+
b.slice(change.toStart, change.toEnd),
|
|
110
|
+
budget
|
|
111
|
+
) : void 0;
|
|
112
|
+
if (!inner) return [change];
|
|
113
|
+
for (const found of inner)
|
|
114
|
+
budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
|
|
115
|
+
return inner.map((found) => ({
|
|
116
|
+
fromStart: found.fromStart + change.fromStart,
|
|
117
|
+
fromEnd: found.fromEnd + change.fromStart,
|
|
118
|
+
toStart: found.toStart + change.toStart,
|
|
119
|
+
toEnd: found.toEnd + change.toStart
|
|
120
|
+
}));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function diffText(from, to, maxEdits = 500) {
|
|
124
|
+
let start = 0;
|
|
125
|
+
while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
|
|
126
|
+
start++;
|
|
127
|
+
let end = 0;
|
|
128
|
+
while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
|
|
129
|
+
end++;
|
|
130
|
+
const a2 = from.slice(start, from.length - end);
|
|
131
|
+
const b = to.slice(start, to.length - end);
|
|
132
|
+
if (!a2.length && !b.length) return [];
|
|
133
|
+
const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
|
|
134
|
+
const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
|
|
135
|
+
const result = [];
|
|
136
|
+
for (const change of changes) {
|
|
137
|
+
const placed = {
|
|
138
|
+
fromStart: change.fromStart + start,
|
|
139
|
+
fromEnd: change.fromEnd + start,
|
|
140
|
+
toStart: change.toStart + start,
|
|
141
|
+
toEnd: change.toEnd + start
|
|
142
|
+
};
|
|
143
|
+
if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
|
|
144
|
+
placed.fromStart--;
|
|
145
|
+
placed.toStart--;
|
|
146
|
+
}
|
|
147
|
+
if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
|
|
148
|
+
placed.fromEnd++;
|
|
149
|
+
placed.toEnd++;
|
|
150
|
+
}
|
|
151
|
+
const last = result.at(-1);
|
|
152
|
+
if (last && placed.fromStart <= last.fromEnd) {
|
|
153
|
+
last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
|
|
154
|
+
last.toEnd = Math.max(last.toEnd, placed.toEnd);
|
|
155
|
+
} else result.push(placed);
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// text/merge-three-way.ts
|
|
161
|
+
function mergeTextThreeWay(base, local, remote) {
|
|
162
|
+
if (local === remote || base === remote) return { status: "merged", text: local };
|
|
163
|
+
if (base === local) return { status: "merged", text: remote };
|
|
164
|
+
if (Math.max(base.length, local.length, remote.length) > 1e6)
|
|
165
|
+
return { status: "unresolved" };
|
|
166
|
+
const changes = (value) => diffText(base, value).map((change) => ({
|
|
167
|
+
start: change.fromStart,
|
|
168
|
+
end: change.fromEnd,
|
|
169
|
+
text: value.slice(change.toStart, change.toEnd)
|
|
170
|
+
}));
|
|
171
|
+
const edits = changes(local);
|
|
172
|
+
for (const next of changes(remote)) {
|
|
173
|
+
if (edits.some(
|
|
174
|
+
(edit) => edit.start === next.start && edit.end === next.end && edit.text === next.text
|
|
175
|
+
))
|
|
176
|
+
continue;
|
|
177
|
+
if (edits.some((edit) => {
|
|
178
|
+
if (edit.start === edit.end && next.start === next.end) return false;
|
|
179
|
+
if (edit.start === edit.end) return edit.start > next.start && edit.start < next.end;
|
|
180
|
+
if (next.start === next.end) return next.start > edit.start && next.start < edit.end;
|
|
181
|
+
return edit.start < next.end && next.start < edit.end;
|
|
182
|
+
}))
|
|
183
|
+
return { status: "unresolved" };
|
|
184
|
+
edits.push(next);
|
|
185
|
+
}
|
|
186
|
+
edits.sort(
|
|
187
|
+
(a2, b) => a2.start - b.start || a2.end - b.end || (a2.text < b.text ? -1 : a2.text > b.text ? 1 : 0)
|
|
188
|
+
);
|
|
189
|
+
let text2 = "", cursor = 0;
|
|
190
|
+
for (const edit of edits) {
|
|
191
|
+
text2 += base.slice(cursor, edit.start) + edit.text;
|
|
192
|
+
cursor = edit.end;
|
|
193
|
+
}
|
|
194
|
+
return { status: "merged", text: text2 + base.slice(cursor) };
|
|
195
|
+
}
|
|
196
|
+
|
|
5
197
|
// xml/namespaces.ts
|
|
6
198
|
var NS = {
|
|
7
199
|
/** WordprocessingML main. */
|
|
@@ -71,6 +263,8 @@ var NS = {
|
|
|
71
263
|
/** XML itself (`xml:space`). */
|
|
72
264
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
73
265
|
};
|
|
266
|
+
|
|
267
|
+
// xml/xml.ts
|
|
74
268
|
var DEFAULT_XML_LIMITS = {
|
|
75
269
|
maxDepth: 512,
|
|
76
270
|
maxNodes: 5e6
|
|
@@ -94,28 +288,28 @@ var MARKUP_SKIPS = [
|
|
|
94
288
|
["<![CDATA[", "]]>"],
|
|
95
289
|
["<?", "?>"]
|
|
96
290
|
];
|
|
97
|
-
function checkXmlLimits(
|
|
291
|
+
function checkXmlLimits(xml2, label, limits = {}) {
|
|
98
292
|
const maxDepth2 = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
|
|
99
293
|
const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
|
|
100
294
|
let depth = 0;
|
|
101
295
|
let nodes = 0;
|
|
102
|
-
let at =
|
|
296
|
+
let at = xml2.indexOf("<");
|
|
103
297
|
while (at !== -1) {
|
|
104
|
-
const skip = MARKUP_SKIPS.find(([open]) =>
|
|
298
|
+
const skip = MARKUP_SKIPS.find(([open]) => xml2.startsWith(open, at));
|
|
105
299
|
if (skip) {
|
|
106
|
-
const end =
|
|
300
|
+
const end = xml2.indexOf(skip[1], at + skip[0].length);
|
|
107
301
|
if (end === -1) return;
|
|
108
|
-
at =
|
|
302
|
+
at = xml2.indexOf("<", end + skip[1].length);
|
|
109
303
|
continue;
|
|
110
304
|
}
|
|
111
305
|
TAG_RE.lastIndex = at;
|
|
112
|
-
const match = TAG_RE.exec(
|
|
306
|
+
const match = TAG_RE.exec(xml2);
|
|
113
307
|
if (!match) {
|
|
114
|
-
at =
|
|
308
|
+
at = xml2.indexOf("<", at + 1);
|
|
115
309
|
continue;
|
|
116
310
|
}
|
|
117
311
|
const [, closing, , selfClosing] = match;
|
|
118
|
-
at =
|
|
312
|
+
at = xml2.indexOf("<", at + match[0].length);
|
|
119
313
|
if (closing) {
|
|
120
314
|
depth--;
|
|
121
315
|
continue;
|
|
@@ -137,11 +331,11 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
137
331
|
}
|
|
138
332
|
var CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
139
333
|
var crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
140
|
-
function parseXml(
|
|
334
|
+
function parseXml(xml2, options2 = {}) {
|
|
141
335
|
const label = options2.label ?? "OOXML";
|
|
142
|
-
if (/<!DOCTYPE|<!ENTITY/i.test(
|
|
336
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(xml2))
|
|
143
337
|
throw new Error(`${label} XML with DTD or entity declarations is not supported`);
|
|
144
|
-
checkXmlLimits(
|
|
338
|
+
checkXmlLimits(xml2, label, options2.limits);
|
|
145
339
|
let parseError = "";
|
|
146
340
|
let parsed;
|
|
147
341
|
try {
|
|
@@ -149,7 +343,7 @@ function parseXml(xml, options2 = {}) {
|
|
|
149
343
|
onError: (level4, message) => {
|
|
150
344
|
if (level4 !== "warning" || options2.warningsAsErrors) parseError = message;
|
|
151
345
|
}
|
|
152
|
-
}).parseFromString(
|
|
346
|
+
}).parseFromString(xml2, "application/xml");
|
|
153
347
|
} catch (error) {
|
|
154
348
|
throw new Error(
|
|
155
349
|
`Invalid ${label} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -158,12 +352,12 @@ function parseXml(xml, options2 = {}) {
|
|
|
158
352
|
}
|
|
159
353
|
if (parseError || !parsed.documentElement)
|
|
160
354
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
161
|
-
if (CRLF_DECLARATION.test(
|
|
355
|
+
if (CRLF_DECLARATION.test(xml2)) crlfDeclarations.add(parsed);
|
|
162
356
|
return parsed;
|
|
163
357
|
}
|
|
164
358
|
var buildXml = (node) => {
|
|
165
|
-
const
|
|
166
|
-
return crlfDeclarations.has(node) ?
|
|
359
|
+
const xml2 = new XMLSerializer().serializeToString(node);
|
|
360
|
+
return crlfDeclarations.has(node) ? xml2.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml2;
|
|
167
361
|
};
|
|
168
362
|
var isElement = (node) => node.nodeType === 1;
|
|
169
363
|
var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
@@ -180,11 +374,597 @@ function attr(element4, local, ns, prefix2) {
|
|
|
180
374
|
}
|
|
181
375
|
var relAttr = (element4, local) => attr(element4, local, NS.r, "r");
|
|
182
376
|
|
|
377
|
+
// xml/merge-three-way.ts
|
|
378
|
+
var tag = (node) => `${node.namespaceURI ?? ""}|${node.localName ?? node.tagName}`;
|
|
379
|
+
var xml = (node) => node ? buildXml(node) : void 0;
|
|
380
|
+
function childrenByKey(parent, options2, repeated) {
|
|
381
|
+
const result = /* @__PURE__ */ new Map();
|
|
382
|
+
const counts = /* @__PURE__ */ new Map();
|
|
383
|
+
for (const child7 of elements(parent)) {
|
|
384
|
+
const name = tag(child7), explicit = options2.keyElement?.(child7, parent);
|
|
385
|
+
const index = counts.get(name) ?? 0;
|
|
386
|
+
counts.set(name, index + 1);
|
|
387
|
+
if (!explicit && repeated.has(name) && !options2.allowPositional?.(parent))
|
|
388
|
+
throw new Error("Ambiguous repeated elements");
|
|
389
|
+
const key = explicit ? `${name}@${explicit}` : `${name}#${index}`;
|
|
390
|
+
if (result.has(key)) throw new Error("Duplicate element identity");
|
|
391
|
+
result.set(key, child7);
|
|
392
|
+
}
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
function orderKeys(base, local, remote) {
|
|
396
|
+
const same6 = (a2, b) => a2.length === b.length && a2.every((key, index) => key === b[index]);
|
|
397
|
+
if (same6(base, local)) return [...remote];
|
|
398
|
+
if (same6(base, remote) || same6(local, remote)) return [...local];
|
|
399
|
+
const keys = [.../* @__PURE__ */ new Set([...remote, ...local])].sort();
|
|
400
|
+
const edges = new Map(keys.map((key) => [key, /* @__PURE__ */ new Set()]));
|
|
401
|
+
const degree = new Map(keys.map((key) => [key, 0]));
|
|
402
|
+
for (const sequence of [local, remote])
|
|
403
|
+
for (let i2 = 1; i2 < sequence.length; i2++) {
|
|
404
|
+
const previous = sequence[i2 - 1], next = sequence[i2];
|
|
405
|
+
if (!edges.get(previous).has(next)) {
|
|
406
|
+
edges.get(previous).add(next);
|
|
407
|
+
degree.set(next, degree.get(next) + 1);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const out = [];
|
|
411
|
+
const ready = keys.filter((key) => degree.get(key) === 0);
|
|
412
|
+
while (ready.length) {
|
|
413
|
+
const next = ready.sort().shift();
|
|
414
|
+
out.push(next);
|
|
415
|
+
for (const key of edges.get(next)) {
|
|
416
|
+
degree.set(key, degree.get(key) - 1);
|
|
417
|
+
if (degree.get(key) === 0) ready.push(key);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return out.length === keys.length ? out : void 0;
|
|
421
|
+
}
|
|
422
|
+
function mergeXmlThreeWay(baseXml, localXml, remoteXml, options2 = {}) {
|
|
423
|
+
if (localXml === remoteXml || baseXml === remoteXml) return { status: "merged", xml: localXml };
|
|
424
|
+
if (baseXml === localXml) return { status: "merged", xml: remoteXml };
|
|
425
|
+
const issues = [];
|
|
426
|
+
try {
|
|
427
|
+
let merge2 = function(b, l, r, path3) {
|
|
428
|
+
const bx = xml(b), lx = xml(l), rx = xml(r);
|
|
429
|
+
if (lx === rx || bx === rx) return l ? copy(l) : void 0;
|
|
430
|
+
if (bx === lx) return r ? copy(r) : void 0;
|
|
431
|
+
if (!b && l && r && tag(l) === tag(r) && !elements(l).length && !elements(r).length) {
|
|
432
|
+
const resolved = options2.resolveText?.(r, l, r);
|
|
433
|
+
if (resolved !== void 0) {
|
|
434
|
+
const node = copy(r);
|
|
435
|
+
node.textContent = resolved;
|
|
436
|
+
return node;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (!b || !l || !r || tag(b) !== tag(l) || tag(b) !== tag(r)) {
|
|
440
|
+
issues.push(`${path3}: overlapping structural changes`);
|
|
441
|
+
return void 0;
|
|
442
|
+
}
|
|
443
|
+
const out = remote.createElementNS(r.namespaceURI, r.tagName);
|
|
444
|
+
const attrs3 = (node) => new Map(
|
|
445
|
+
Array.from(node.attributes).map((a2) => [
|
|
446
|
+
`${a2.namespaceURI ?? ""}|${a2.localName ?? a2.name}`,
|
|
447
|
+
a2
|
|
448
|
+
])
|
|
449
|
+
);
|
|
450
|
+
const ba = attrs3(b), la = attrs3(l), ra = attrs3(r);
|
|
451
|
+
for (const key of /* @__PURE__ */ new Set([...ba.keys(), ...la.keys(), ...ra.keys()])) {
|
|
452
|
+
const old = ba.get(key)?.value, left = la.get(key)?.value, right = ra.get(key)?.value;
|
|
453
|
+
const value = left === right || right === old ? left : left === old ? right : void 0;
|
|
454
|
+
if (left !== right && left !== old && right !== old) {
|
|
455
|
+
issues.push(`${path3}: overlapping attribute ${key}`);
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
const source2 = ra.get(key) ?? la.get(key) ?? ba.get(key);
|
|
459
|
+
if (value !== void 0) out.setAttributeNS(source2.namespaceURI, source2.name, value);
|
|
460
|
+
}
|
|
461
|
+
const lists = [b, l, r].map(elements);
|
|
462
|
+
if (lists.every((list2) => list2.length === 0)) {
|
|
463
|
+
if ([b, l, r].some(
|
|
464
|
+
(node) => Array.from(node.childNodes).some(
|
|
465
|
+
(child7) => child7.nodeType !== 3 && child7.nodeType !== 4
|
|
466
|
+
)
|
|
467
|
+
)) {
|
|
468
|
+
issues.push(`${path3}: non-text leaf content requires explicit preservation`);
|
|
469
|
+
return void 0;
|
|
470
|
+
}
|
|
471
|
+
const texts = [b, l, r].map((node) => node.textContent ?? "");
|
|
472
|
+
const override = options2.resolveText?.(b, l, r);
|
|
473
|
+
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] } : options2.allowText?.(b) ? mergeTextThreeWay(texts[0], texts[1], texts[2]) : { status: "unresolved" };
|
|
474
|
+
if (value.status !== "merged") issues.push(`${path3}: overlapping text changes`);
|
|
475
|
+
else if (value.text) out.appendChild(remote.createTextNode(value.text));
|
|
476
|
+
return out;
|
|
477
|
+
}
|
|
478
|
+
if ([b, l, r].some(
|
|
479
|
+
(node) => Array.from(node.childNodes).some(
|
|
480
|
+
(child7) => child7.nodeType !== 1 && (child7.nodeType !== 3 || Boolean(child7.textContent?.trim()))
|
|
481
|
+
)
|
|
482
|
+
)) {
|
|
483
|
+
issues.push(`${path3}: mixed content cannot be matched safely`);
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
487
|
+
const groups = lists.map((list2) => {
|
|
488
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
489
|
+
for (const child7 of list2) {
|
|
490
|
+
const name = tag(child7), group3 = grouped.get(name) ?? [];
|
|
491
|
+
group3.push(child7);
|
|
492
|
+
grouped.set(name, group3);
|
|
493
|
+
if (group3.length > 1) repeated.add(name);
|
|
494
|
+
}
|
|
495
|
+
return grouped;
|
|
496
|
+
});
|
|
497
|
+
for (const name of repeated) {
|
|
498
|
+
const rows2 = groups.map((group3) => group3.get(name) ?? []);
|
|
499
|
+
if (rows2.some((row) => row.some((child7) => options2.keyElement?.(child7, b) !== void 0)))
|
|
500
|
+
continue;
|
|
501
|
+
if (rows2.some((row) => row.length !== rows2[0].length)) {
|
|
502
|
+
issues.push(`${path3}: unkeyed structural changes`);
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
const before = rows2[0].map((child7) => buildXml(child7));
|
|
506
|
+
const known = new Set(before);
|
|
507
|
+
for (const row of rows2.slice(1))
|
|
508
|
+
if (row.some((child7, i2) => {
|
|
509
|
+
const value = buildXml(child7);
|
|
510
|
+
return before[i2] !== value && known.has(value);
|
|
511
|
+
})) {
|
|
512
|
+
issues.push(`${path3}: reordered unkeyed elements`);
|
|
513
|
+
return void 0;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
let maps;
|
|
517
|
+
try {
|
|
518
|
+
maps = [b, l, r].map((parent) => childrenByKey(parent, options2, repeated));
|
|
519
|
+
} catch {
|
|
520
|
+
issues.push(`${path3}: ambiguous element identities`);
|
|
521
|
+
return void 0;
|
|
522
|
+
}
|
|
523
|
+
const [bm, lm, rm] = maps;
|
|
524
|
+
const merged = /* @__PURE__ */ new Map();
|
|
525
|
+
for (const key of /* @__PURE__ */ new Set([...bm.keys(), ...lm.keys(), ...rm.keys()])) {
|
|
526
|
+
const node = merge2(bm.get(key), lm.get(key), rm.get(key), `${path3}/${key}`);
|
|
527
|
+
if (node) merged.set(key, node);
|
|
528
|
+
}
|
|
529
|
+
const surviving = (map) => [...map.keys()].filter((key) => merged.has(key));
|
|
530
|
+
const order = orderKeys(surviving(bm), surviving(lm), surviving(rm));
|
|
531
|
+
if (!order) {
|
|
532
|
+
issues.push(`${path3}: incompatible element order`);
|
|
533
|
+
return void 0;
|
|
534
|
+
}
|
|
535
|
+
for (const key of order) out.appendChild(merged.get(key));
|
|
536
|
+
return out;
|
|
537
|
+
};
|
|
538
|
+
var merge = merge2;
|
|
539
|
+
const base = parseXml(baseXml, { warningsAsErrors: true });
|
|
540
|
+
const local = parseXml(localXml, { warningsAsErrors: true });
|
|
541
|
+
const remote = parseXml(remoteXml, { warningsAsErrors: true });
|
|
542
|
+
const copy = (node) => remote.importNode(node, true);
|
|
543
|
+
const root = merge2(base.documentElement, local.documentElement, remote.documentElement, "root");
|
|
544
|
+
if (!root || issues.length) return { status: "unresolved", issues };
|
|
545
|
+
remote.replaceChild(root, remote.documentElement);
|
|
546
|
+
return { status: "merged", xml: buildXml(remote) };
|
|
547
|
+
} catch {
|
|
548
|
+
return { status: "unresolved", issues: ["Invalid or unsupported XML input"] };
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
var DEFAULT_ZIP_LIMITS = {
|
|
552
|
+
maxInputBytes: 100 * 1024 * 1024,
|
|
553
|
+
maxEntries: 1e4,
|
|
554
|
+
maxEntryBytes: 100 * 1024 * 1024,
|
|
555
|
+
maxTotalBytes: 100 * 1024 * 1024
|
|
556
|
+
};
|
|
557
|
+
var ZipLimitError = class extends Error {
|
|
558
|
+
code = "ZIP_BOMB";
|
|
559
|
+
limit;
|
|
560
|
+
/** The check that failed (absent when the error was built without one). */
|
|
561
|
+
kind;
|
|
562
|
+
/** The observed value, when known (a lower bound for a size found while inflating). */
|
|
563
|
+
actual;
|
|
564
|
+
constructor(message, details) {
|
|
565
|
+
super(message);
|
|
566
|
+
this.name = "ZipLimitError";
|
|
567
|
+
this.limit = details.limit;
|
|
568
|
+
this.kind = details.kind;
|
|
569
|
+
this.actual = details.actual;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
var mib = (bytes) => Math.round(bytes / 1048576);
|
|
573
|
+
function isSafePartName(name) {
|
|
574
|
+
if (name.includes("\0") || name.includes("\\")) return false;
|
|
575
|
+
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
576
|
+
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
577
|
+
if (body.startsWith("/")) return false;
|
|
578
|
+
return !body.split("/").some((segment2) => segment2 === "..");
|
|
579
|
+
}
|
|
580
|
+
function declaredEntrySize(entry2) {
|
|
581
|
+
const data = entry2._data;
|
|
582
|
+
const size = Number(data?.uncompressedSize ?? 0);
|
|
583
|
+
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
584
|
+
}
|
|
585
|
+
function resolveLimits(limits) {
|
|
586
|
+
const create2 = limits.createError;
|
|
587
|
+
return {
|
|
588
|
+
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
589
|
+
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
590
|
+
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
591
|
+
label: limits.label ?? "ZIP",
|
|
592
|
+
fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
async function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
596
|
+
const chunks = [];
|
|
597
|
+
let size = 0;
|
|
598
|
+
for await (const chunk of streamEntryGuarded(entry2, alreadyRead, limits)) {
|
|
599
|
+
chunks.push(chunk);
|
|
600
|
+
size += chunk.byteLength;
|
|
601
|
+
}
|
|
602
|
+
if (chunks.length === 1 && chunks[0]) return chunks[0];
|
|
603
|
+
const out = new Uint8Array(size);
|
|
604
|
+
let offset = 0;
|
|
605
|
+
for (const chunk of chunks) {
|
|
606
|
+
out.set(chunk, offset);
|
|
607
|
+
offset += chunk.byteLength;
|
|
608
|
+
}
|
|
609
|
+
return out;
|
|
610
|
+
}
|
|
611
|
+
var AHEAD = 8;
|
|
612
|
+
async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
613
|
+
const r = resolveLimits(limits);
|
|
614
|
+
const declared = declaredEntrySize(entry2);
|
|
615
|
+
const stream = entry2.internalStream("uint8array");
|
|
616
|
+
const queue = [];
|
|
617
|
+
let size = 0;
|
|
618
|
+
let ended = false;
|
|
619
|
+
let stopped = false;
|
|
620
|
+
let failure;
|
|
621
|
+
let paused = false;
|
|
622
|
+
let wake;
|
|
623
|
+
const pause = () => {
|
|
624
|
+
paused = true;
|
|
625
|
+
stream.pause();
|
|
626
|
+
};
|
|
627
|
+
const resume = () => {
|
|
628
|
+
if (!paused || stopped) return;
|
|
629
|
+
paused = false;
|
|
630
|
+
stream.resume();
|
|
631
|
+
};
|
|
632
|
+
const fail = (error) => {
|
|
633
|
+
failure ??= error;
|
|
634
|
+
stopped = true;
|
|
635
|
+
queue.length = 0;
|
|
636
|
+
pause();
|
|
637
|
+
wake?.();
|
|
638
|
+
};
|
|
639
|
+
stream.on("data", (chunk) => {
|
|
640
|
+
if (stopped) return pause();
|
|
641
|
+
size += chunk.byteLength;
|
|
642
|
+
if (size > declared || size > r.maxEntryBytes)
|
|
643
|
+
return fail(
|
|
644
|
+
r.fail(
|
|
645
|
+
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
646
|
+
r.maxEntryBytes,
|
|
647
|
+
size > declared ? "declaredSize" : "maxEntryBytes",
|
|
648
|
+
size
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
if (alreadyRead + size > r.maxTotalBytes)
|
|
652
|
+
return fail(
|
|
653
|
+
r.fail(
|
|
654
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
655
|
+
r.maxTotalBytes,
|
|
656
|
+
"maxTotalBytes",
|
|
657
|
+
alreadyRead + size
|
|
658
|
+
)
|
|
659
|
+
);
|
|
660
|
+
queue.push(chunk);
|
|
661
|
+
if (queue.length >= AHEAD) pause();
|
|
662
|
+
wake?.();
|
|
663
|
+
});
|
|
664
|
+
stream.on("error", (error) => fail(error));
|
|
665
|
+
stream.on("end", () => {
|
|
666
|
+
ended = true;
|
|
667
|
+
wake?.();
|
|
668
|
+
});
|
|
669
|
+
stream.resume();
|
|
670
|
+
try {
|
|
671
|
+
for (; ; ) {
|
|
672
|
+
if (failure) throw failure;
|
|
673
|
+
const chunk = queue.shift();
|
|
674
|
+
if (chunk) {
|
|
675
|
+
if (queue.length < AHEAD / 2) resume();
|
|
676
|
+
yield chunk;
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
if (ended) return;
|
|
680
|
+
await new Promise((resolve) => {
|
|
681
|
+
wake = resolve;
|
|
682
|
+
resume();
|
|
683
|
+
});
|
|
684
|
+
wake = void 0;
|
|
685
|
+
}
|
|
686
|
+
} finally {
|
|
687
|
+
stopped = true;
|
|
688
|
+
if (!ended) pause();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function toBase64(bytes) {
|
|
692
|
+
let binary = "";
|
|
693
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
694
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
695
|
+
return btoa(binary);
|
|
696
|
+
}
|
|
697
|
+
function guardZip(zip, limits = {}) {
|
|
698
|
+
const r = resolveLimits(limits);
|
|
699
|
+
const entries = Object.values(zip.files);
|
|
700
|
+
if (entries.length > r.maxEntries)
|
|
701
|
+
throw r.fail(
|
|
702
|
+
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
703
|
+
r.maxEntries,
|
|
704
|
+
"maxEntries",
|
|
705
|
+
entries.length
|
|
706
|
+
);
|
|
707
|
+
let declared = 0;
|
|
708
|
+
for (const entry2 of entries) {
|
|
709
|
+
const original = entry2.unsafeOriginalName;
|
|
710
|
+
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
711
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
712
|
+
if (entry2.dir) continue;
|
|
713
|
+
const size = declaredEntrySize(entry2);
|
|
714
|
+
if (size > r.maxEntryBytes)
|
|
715
|
+
throw r.fail(
|
|
716
|
+
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
717
|
+
r.maxEntryBytes,
|
|
718
|
+
"maxEntryBytes",
|
|
719
|
+
size
|
|
720
|
+
);
|
|
721
|
+
declared += size;
|
|
722
|
+
}
|
|
723
|
+
if (declared > r.maxTotalBytes)
|
|
724
|
+
throw r.fail(
|
|
725
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
726
|
+
r.maxTotalBytes,
|
|
727
|
+
"maxTotalBytes",
|
|
728
|
+
declared
|
|
729
|
+
);
|
|
730
|
+
const produced = /* @__PURE__ */ new Map();
|
|
731
|
+
let total = 0;
|
|
732
|
+
for (const entry2 of entries) {
|
|
733
|
+
if (entry2.dir) continue;
|
|
734
|
+
const inflateOriginal = entry2.async.bind(entry2);
|
|
735
|
+
entry2.async = async (type, onUpdate) => {
|
|
736
|
+
const previous = produced.get(entry2.name) ?? 0;
|
|
737
|
+
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
738
|
+
if (bytes.byteLength > previous) {
|
|
739
|
+
total += bytes.byteLength - previous;
|
|
740
|
+
produced.set(entry2.name, bytes.byteLength);
|
|
741
|
+
}
|
|
742
|
+
switch (type) {
|
|
743
|
+
case "uint8array":
|
|
744
|
+
return bytes;
|
|
745
|
+
case "string":
|
|
746
|
+
case "text":
|
|
747
|
+
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
748
|
+
case "arraybuffer":
|
|
749
|
+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
750
|
+
case "base64":
|
|
751
|
+
return toBase64(bytes);
|
|
752
|
+
default:
|
|
753
|
+
return inflateOriginal(type, onUpdate);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
return zip;
|
|
758
|
+
}
|
|
759
|
+
async function openZip(input, limits = {}) {
|
|
760
|
+
const r = resolveLimits(limits);
|
|
761
|
+
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
762
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
763
|
+
if (bytes.byteLength > maxInput)
|
|
764
|
+
throw r.fail(
|
|
765
|
+
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
766
|
+
maxInput,
|
|
767
|
+
"maxInputBytes",
|
|
768
|
+
bytes.byteLength
|
|
769
|
+
);
|
|
770
|
+
return guardZip(await JSZip.loadAsync(bytes), limits);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// opc/relationships.ts
|
|
774
|
+
function parseRelationships(xml2) {
|
|
775
|
+
const map = /* @__PURE__ */ new Map();
|
|
776
|
+
if (!xml2) return map;
|
|
777
|
+
const root = parseXml(xml2).documentElement;
|
|
778
|
+
for (const node of elements(root)) {
|
|
779
|
+
if (node.localName !== "Relationship") continue;
|
|
780
|
+
const id = node.getAttribute("Id");
|
|
781
|
+
const target = node.getAttribute("Target");
|
|
782
|
+
if (!id || target == null) continue;
|
|
783
|
+
map.set(id, {
|
|
784
|
+
id,
|
|
785
|
+
type: node.getAttribute("Type") ?? "",
|
|
786
|
+
target,
|
|
787
|
+
mode: node.getAttribute("TargetMode") === "External" ? "External" : "Internal"
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
return map;
|
|
791
|
+
}
|
|
792
|
+
var escapeAttr = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
793
|
+
function buildRelationshipsXml(relationships) {
|
|
794
|
+
const items = Array.from(relationships).map(([id, rel]) => {
|
|
795
|
+
const mode = rel.mode === "External" ? ' TargetMode="External"' : "";
|
|
796
|
+
return `<Relationship Id="${escapeAttr(id)}" Type="${escapeAttr(rel.type)}" Target="${escapeAttr(rel.target)}"${mode}/>`;
|
|
797
|
+
}).join("");
|
|
798
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NS.rels}">${items}</Relationships>`;
|
|
799
|
+
}
|
|
800
|
+
function resolvePartPath(basePart, target) {
|
|
801
|
+
if (target.startsWith("/")) return target.slice(1);
|
|
802
|
+
const baseDir = basePart.slice(0, basePart.lastIndexOf("/") + 1);
|
|
803
|
+
const resolved = [];
|
|
804
|
+
for (const segment2 of `${baseDir}${target}`.split("/")) {
|
|
805
|
+
if (segment2 === "." || segment2 === "") continue;
|
|
806
|
+
if (segment2 === "..") resolved.pop();
|
|
807
|
+
else resolved.push(segment2);
|
|
808
|
+
}
|
|
809
|
+
return resolved.join("/");
|
|
810
|
+
}
|
|
811
|
+
function relationshipsPartFor(partName) {
|
|
812
|
+
const slash = partName.lastIndexOf("/");
|
|
813
|
+
return `${partName.slice(0, slash + 1)}_rels/${partName.slice(slash + 1)}.rels`;
|
|
814
|
+
}
|
|
815
|
+
function nextRelationshipId(used) {
|
|
816
|
+
let index = 1;
|
|
817
|
+
while (used.has(`rId${index}`)) index++;
|
|
818
|
+
return `rId${index}`;
|
|
819
|
+
}
|
|
820
|
+
var getRelationshipId = (element4) => relAttr(element4, "id") || void 0;
|
|
821
|
+
|
|
822
|
+
// opc/merge-snapshots.ts
|
|
823
|
+
var equal = (a2, b) => a2 === b || Boolean(a2 && b && a2.length === b.length && a2.every((value, index) => value === b[index]));
|
|
824
|
+
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
825
|
+
var encoder = new TextEncoder();
|
|
826
|
+
function mergeManifest(input) {
|
|
827
|
+
const { path: path3, base, local, remote } = input;
|
|
828
|
+
if (!base || !local || !remote) return void 0;
|
|
829
|
+
if (!path3.endsWith(".rels") && path3 !== "[Content_Types].xml" && path3 !== "docProps/core.xml")
|
|
830
|
+
return void 0;
|
|
831
|
+
try {
|
|
832
|
+
const result = mergeXmlThreeWay(
|
|
833
|
+
decoder.decode(base),
|
|
834
|
+
decoder.decode(local),
|
|
835
|
+
decoder.decode(remote),
|
|
836
|
+
{
|
|
837
|
+
keyElement: (element4) => {
|
|
838
|
+
const attribute2 = element4.localName === "Relationship" ? "Id" : element4.localName === "Override" ? "PartName" : element4.localName === "Default" ? "Extension" : void 0;
|
|
839
|
+
return attribute2 ? element4.getAttribute(attribute2) ?? void 0 : void 0;
|
|
840
|
+
},
|
|
841
|
+
resolveText: (_b, _l, r) => path3 === "docProps/core.xml" && (r.namespaceURI === "http://purl.org/dc/terms/" && r.localName === "modified" || r.namespaceURI === "http://schemas.openxmlformats.org/package/2006/metadata/core-properties" && r.localName === "lastModifiedBy") ? r.textContent ?? "" : void 0
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
return result.status === "merged" ? { status: "merged", bytes: encoder.encode(result.xml) } : result;
|
|
845
|
+
} catch {
|
|
846
|
+
return { status: "unresolved", issues: [`${path3}: invalid metadata XML`] };
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
async function mergeOpcSnapshots(baseBytes, localBytes, remoteBytes, options2 = {}) {
|
|
850
|
+
if (equal(localBytes, remoteBytes) || equal(baseBytes, remoteBytes))
|
|
851
|
+
return { status: "merged", bytes: localBytes.slice() };
|
|
852
|
+
if (equal(baseBytes, localBytes)) return { status: "merged", bytes: remoteBytes.slice() };
|
|
853
|
+
try {
|
|
854
|
+
const [base, local, remote] = await Promise.all([
|
|
855
|
+
openZip(baseBytes, { label: "Merge" }),
|
|
856
|
+
openZip(localBytes, { label: "Merge" }),
|
|
857
|
+
openZip(remoteBytes, { label: "Merge" })
|
|
858
|
+
]);
|
|
859
|
+
const paths = [
|
|
860
|
+
...new Set(
|
|
861
|
+
[base, local, remote].flatMap(
|
|
862
|
+
(zip) => Object.keys(zip.files).filter((path3) => !zip.files[path3].dir)
|
|
863
|
+
)
|
|
864
|
+
)
|
|
865
|
+
].sort();
|
|
866
|
+
if (paths.some((path3) => path3.startsWith("_xmlsignatures/")))
|
|
867
|
+
return {
|
|
868
|
+
status: "unresolved",
|
|
869
|
+
issues: ["Signed packages require explicit signature handling before merging"]
|
|
870
|
+
};
|
|
871
|
+
const issues = [];
|
|
872
|
+
for (const path3 of paths) {
|
|
873
|
+
const [b, l, r] = await Promise.all(
|
|
874
|
+
[base, local, remote].map((zip) => zip.file(path3)?.async("uint8array"))
|
|
875
|
+
);
|
|
876
|
+
let chosen;
|
|
877
|
+
if (equal(l, r) || equal(b, r)) chosen = l;
|
|
878
|
+
else if (equal(b, l)) chosen = r;
|
|
879
|
+
else {
|
|
880
|
+
const input = {
|
|
881
|
+
path: path3,
|
|
882
|
+
...b ? { base: b } : {},
|
|
883
|
+
...l ? { local: l } : {},
|
|
884
|
+
...r ? { remote: r } : {}
|
|
885
|
+
};
|
|
886
|
+
const result = mergeManifest(input) ?? await options2.mergePart?.(input);
|
|
887
|
+
if (!result || result.status === "unresolved") {
|
|
888
|
+
issues.push(...result?.issues ?? [`${path3}: both versions changed the same part`]);
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
chosen = result.bytes;
|
|
892
|
+
}
|
|
893
|
+
if (chosen) remote.file(path3, chosen);
|
|
894
|
+
else remote.remove(path3);
|
|
895
|
+
}
|
|
896
|
+
if (issues.length) return { status: "unresolved", issues };
|
|
897
|
+
for (const path3 of Object.keys(remote.files).filter((name) => name.endsWith(".rels"))) {
|
|
898
|
+
const source2 = path3 === "_rels/.rels" ? "" : path3.replace(/(^|\/)_rels\/([^/]+)\.rels$/u, "$1$2");
|
|
899
|
+
for (const relation2 of parseRelationships(
|
|
900
|
+
await remote.file(path3).async("string")
|
|
901
|
+
).values()) {
|
|
902
|
+
if (relation2.mode === "External") continue;
|
|
903
|
+
const target = resolvePartPath(source2, relation2.target.split("#")[0] ?? "");
|
|
904
|
+
if (!remote.file(target) && !remote.file(decodeURIComponent(target)))
|
|
905
|
+
issues.push(`${path3}: merged relationship target is missing`);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
if (issues.length) return { status: "unresolved", issues };
|
|
909
|
+
return {
|
|
910
|
+
status: "merged",
|
|
911
|
+
bytes: await remote.generateAsync({ type: "uint8array", compression: "DEFLATE" })
|
|
912
|
+
};
|
|
913
|
+
} catch {
|
|
914
|
+
return { status: "unresolved", issues: ["Invalid or oversized Office package"] };
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// docx/merge-snapshots.ts
|
|
919
|
+
var WORD_2010 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
920
|
+
var TEXT_PART = /^word\/(?:document|header\d*|footer\d*|footnotes|endnotes|comments|styles)\.xml$/u;
|
|
921
|
+
var POSITIONAL = /* @__PURE__ */ new Set(["body", "p", "r", "hyperlink", "sdtContent", "tbl", "tr", "tc"]);
|
|
922
|
+
var IDS = {
|
|
923
|
+
comment: "id",
|
|
924
|
+
footnote: "id",
|
|
925
|
+
endnote: "id",
|
|
926
|
+
style: "styleId"
|
|
927
|
+
};
|
|
928
|
+
function keyElement(element4) {
|
|
929
|
+
if (element4.namespaceURI !== NS.w) return void 0;
|
|
930
|
+
if (element4.localName === "p") {
|
|
931
|
+
const id2 = element4.getAttributeNS(WORD_2010, "paraId");
|
|
932
|
+
return id2 ? `paragraph:${id2}` : void 0;
|
|
933
|
+
}
|
|
934
|
+
const attribute2 = IDS[element4.localName];
|
|
935
|
+
if (!attribute2) return void 0;
|
|
936
|
+
const id = element4.getAttributeNS(NS.w, attribute2);
|
|
937
|
+
return id ? `${element4.localName}:${id}` : void 0;
|
|
938
|
+
}
|
|
939
|
+
function mergeDocxSnapshots(base, local, remote) {
|
|
940
|
+
return mergeOpcSnapshots(base, local, remote, {
|
|
941
|
+
async mergePart(input) {
|
|
942
|
+
if (!TEXT_PART.test(input.path) || !input.base || !input.local || !input.remote)
|
|
943
|
+
return {
|
|
944
|
+
status: "unresolved",
|
|
945
|
+
issues: [`Concurrent unsupported DOCX part: ${input.path}`]
|
|
946
|
+
};
|
|
947
|
+
const decoder2 = new TextDecoder();
|
|
948
|
+
const result = mergeXmlThreeWay(
|
|
949
|
+
decoder2.decode(input.base),
|
|
950
|
+
decoder2.decode(input.local),
|
|
951
|
+
decoder2.decode(input.remote),
|
|
952
|
+
{
|
|
953
|
+
keyElement,
|
|
954
|
+
allowPositional: (parent) => parent.namespaceURI === NS.w && POSITIONAL.has(parent.localName),
|
|
955
|
+
allowText: (element4) => (element4.namespaceURI === NS.w || element4.namespaceURI === NS.a) && element4.localName === "t"
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
return result.status === "merged" ? { status: "merged", bytes: new TextEncoder().encode(result.xml) } : { status: "unresolved", issues: result.issues.map((issue) => `${input.path}: ${issue}`) };
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
183
963
|
// docx/xml.ts
|
|
184
964
|
var WORD_NS = NS.w;
|
|
185
965
|
var WORD_DATE_UTC_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
|
|
186
966
|
var REL_NS = NS.r;
|
|
187
|
-
var parseXml2 = (
|
|
967
|
+
var parseXml2 = (xml2) => parseXml(xml2, { label: "DOCX" });
|
|
188
968
|
var named2 = (element4, local) => named(element4, local, WORD_NS);
|
|
189
969
|
var children2 = (parent, local) => children(parent, local, WORD_NS);
|
|
190
970
|
var first2 = (parent, local) => first(parent, local, WORD_NS);
|
|
@@ -968,8 +1748,8 @@ function styleElements(document) {
|
|
|
968
1748
|
(element4) => named2(element4, "style") && (getW(element4, "type") === "character" || getW(element4, "type") === "paragraph")
|
|
969
1749
|
);
|
|
970
1750
|
}
|
|
971
|
-
function parseRunStyleCatalog(
|
|
972
|
-
const document = parseXml2(
|
|
1751
|
+
function parseRunStyleCatalog(xml2) {
|
|
1752
|
+
const document = parseXml2(xml2);
|
|
973
1753
|
const defaults = first2(first2(document.documentElement, "docDefaults"), "rPrDefault");
|
|
974
1754
|
const styles = /* @__PURE__ */ Object.create(null);
|
|
975
1755
|
for (const element4 of styleElements(document)) {
|
|
@@ -1162,20 +1942,20 @@ function parseFormatting(pPr) {
|
|
|
1162
1942
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") result.lineSpacingRule = rule;
|
|
1163
1943
|
else if (line4 !== void 0) result.lineSpacingRule = "auto";
|
|
1164
1944
|
const ind = first2(pPr, "ind");
|
|
1165
|
-
for (const [
|
|
1945
|
+
for (const [xml2, key] of [
|
|
1166
1946
|
["left", "indentLeftTwips"],
|
|
1167
1947
|
["right", "indentRightTwips"],
|
|
1168
1948
|
["start", "indentStartTwips"],
|
|
1169
1949
|
["end", "indentEndTwips"]
|
|
1170
1950
|
]) {
|
|
1171
|
-
const value = signedTwipValue(getW(ind,
|
|
1951
|
+
const value = signedTwipValue(getW(ind, xml2));
|
|
1172
1952
|
if (value !== void 0) result[key] = value;
|
|
1173
1953
|
}
|
|
1174
|
-
for (const [
|
|
1954
|
+
for (const [xml2, key] of [
|
|
1175
1955
|
["firstLine", "firstLineTwips"],
|
|
1176
1956
|
["hanging", "hangingTwips"]
|
|
1177
1957
|
]) {
|
|
1178
|
-
const value = twipValue(getW(ind,
|
|
1958
|
+
const value = twipValue(getW(ind, xml2));
|
|
1179
1959
|
if (value !== void 0) result[key] = value;
|
|
1180
1960
|
}
|
|
1181
1961
|
return result;
|
|
@@ -1192,8 +1972,8 @@ function styleElements2(document) {
|
|
|
1192
1972
|
(element4) => named2(element4, "style") && getW(element4, "type") === "paragraph"
|
|
1193
1973
|
);
|
|
1194
1974
|
}
|
|
1195
|
-
function parseParagraphStyleCatalog(
|
|
1196
|
-
const document = parseXml2(
|
|
1975
|
+
function parseParagraphStyleCatalog(xml2) {
|
|
1976
|
+
const document = parseXml2(xml2);
|
|
1197
1977
|
const defaults = first2(first2(document.documentElement, "docDefaults"), "pPrDefault");
|
|
1198
1978
|
const pDefaults = first2(defaults, "pPr");
|
|
1199
1979
|
const styles = /* @__PURE__ */ Object.create(null);
|
|
@@ -1330,8 +2110,8 @@ function conditionalFormatting(block) {
|
|
|
1330
2110
|
if (Object.keys(run2).length) result.run = run2;
|
|
1331
2111
|
return result;
|
|
1332
2112
|
}
|
|
1333
|
-
function parseTableStyleCatalog(
|
|
1334
|
-
const document = parseXml2(
|
|
2113
|
+
function parseTableStyleCatalog(xml2) {
|
|
2114
|
+
const document = parseXml2(xml2);
|
|
1335
2115
|
const styles = /* @__PURE__ */ Object.create(null);
|
|
1336
2116
|
for (const element4 of tableStyleElements(document)) {
|
|
1337
2117
|
const id = getW(element4, "styleId");
|
|
@@ -2971,24 +3751,24 @@ function drawingPatternPictureXml(fill) {
|
|
|
2971
3751
|
if (!fill.preset && !fill.sourceXml) throw new Error("A DrawingML pattern needs a preset");
|
|
2972
3752
|
if (before?.kind !== "pattern" || before.preset !== fill.preset)
|
|
2973
3753
|
root.setAttribute("prst", fill.preset);
|
|
2974
|
-
for (const [key,
|
|
3754
|
+
for (const [key, tag2] of [
|
|
2975
3755
|
["foreground", "fgClr"],
|
|
2976
3756
|
["background", "bgClr"]
|
|
2977
3757
|
]) {
|
|
2978
3758
|
const color = fill[key];
|
|
2979
3759
|
if (before?.kind === "pattern" && JSON.stringify(before[key]) === JSON.stringify(color))
|
|
2980
3760
|
continue;
|
|
2981
|
-
const old = first(root,
|
|
3761
|
+
const old = first(root, tag2, NS.a);
|
|
2982
3762
|
if (!color) {
|
|
2983
3763
|
if (old) root.removeChild(old);
|
|
2984
3764
|
continue;
|
|
2985
3765
|
}
|
|
2986
|
-
const node = old ?? doc.createElementNS(NS.a, `a:${
|
|
3766
|
+
const node = old ?? doc.createElementNS(NS.a, `a:${tag2}`);
|
|
2987
3767
|
patchDrawingColorIn(node, color);
|
|
2988
3768
|
if (!old)
|
|
2989
3769
|
root.insertBefore(
|
|
2990
3770
|
node,
|
|
2991
|
-
|
|
3771
|
+
tag2 === "fgClr" ? first(root, "bgClr", NS.a) ?? root.firstChild : first(root, "extLst", NS.a) ?? null
|
|
2992
3772
|
);
|
|
2993
3773
|
}
|
|
2994
3774
|
} else {
|
|
@@ -3027,9 +3807,9 @@ function drawingPatternPictureXml(fill) {
|
|
|
3027
3807
|
}
|
|
3028
3808
|
|
|
3029
3809
|
// drawingml/write-fill.ts
|
|
3030
|
-
function setDrawingFillXml(properties,
|
|
3810
|
+
function setDrawingFillXml(properties, xml2) {
|
|
3031
3811
|
const doc = properties.ownerDocument;
|
|
3032
|
-
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${
|
|
3812
|
+
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml2}</w>`);
|
|
3033
3813
|
const fill = elements(wrapper.documentElement)[0];
|
|
3034
3814
|
const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
|
|
3035
3815
|
if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
|
|
@@ -3057,7 +3837,7 @@ function drawingFillXml(fill) {
|
|
|
3057
3837
|
const root = doc.documentElement;
|
|
3058
3838
|
if (root.namespaceURI !== NS.a || root.localName !== "gradFill")
|
|
3059
3839
|
throw new Error("Invalid gradient source XML");
|
|
3060
|
-
const fragment2 = (
|
|
3840
|
+
const fragment2 = (xml2) => doc.importNode(elements(parseXml(`<w xmlns:a="${NS.a}">${xml2}</w>`).documentElement)[0], true);
|
|
3061
3841
|
let list2 = first(root, "gsLst", NS.a);
|
|
3062
3842
|
if (!list2) {
|
|
3063
3843
|
list2 = doc.createElementNS(NS.a, "a:gsLst");
|
|
@@ -3136,8 +3916,8 @@ var ORDER = [
|
|
|
3136
3916
|
"extLst"
|
|
3137
3917
|
];
|
|
3138
3918
|
var same = (a2, b) => JSON.stringify(a2) === JSON.stringify(b);
|
|
3139
|
-
function importXml(host,
|
|
3140
|
-
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${
|
|
3919
|
+
function importXml(host, xml2) {
|
|
3920
|
+
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml2}</w>`);
|
|
3141
3921
|
return host.ownerDocument.importNode(elements(wrapper.documentElement)[0], true);
|
|
3142
3922
|
}
|
|
3143
3923
|
function dropDrawingDeclarations(node) {
|
|
@@ -3178,10 +3958,10 @@ function patchDrawingLine(ln, line4) {
|
|
|
3178
3958
|
const solid = first(ln, "solidFill", NS.a);
|
|
3179
3959
|
if (solid && line4.fill?.kind === "solid") patchDrawingColorIn(solid, line4.fill.color);
|
|
3180
3960
|
else {
|
|
3181
|
-
const
|
|
3182
|
-
if (
|
|
3183
|
-
if (
|
|
3184
|
-
const child7 = importXml(ln,
|
|
3961
|
+
const xml2 = line4.fill && drawingFillXml(line4.fill);
|
|
3962
|
+
if (xml2 || !line4.fill) remove(ln, FILLS);
|
|
3963
|
+
if (xml2) {
|
|
3964
|
+
const child7 = importXml(ln, xml2);
|
|
3185
3965
|
dropDrawingDeclarations(child7);
|
|
3186
3966
|
insert(ln, child7);
|
|
3187
3967
|
}
|
|
@@ -3269,7 +4049,7 @@ var KINDS = {
|
|
|
3269
4049
|
reflection: "reflection",
|
|
3270
4050
|
fillOverlay: "fillOverlay"
|
|
3271
4051
|
};
|
|
3272
|
-
var TAGS = Object.fromEntries(Object.entries(KINDS).map(([
|
|
4052
|
+
var TAGS = Object.fromEntries(Object.entries(KINDS).map(([tag2, kind]) => [kind, tag2]));
|
|
3273
4053
|
var GEOMETRY = { blurRadiusEmu: "blurRad", distanceEmu: "dist", directionAngle: "dir" };
|
|
3274
4054
|
var TRANSFORM = { scaleX: "sx", scaleY: "sy", skewXAngle: "kx", skewYAngle: "ky" };
|
|
3275
4055
|
var NUMBERS = {
|
|
@@ -3303,8 +4083,8 @@ var BOOLEANS = {
|
|
|
3303
4083
|
};
|
|
3304
4084
|
var COLORED = /* @__PURE__ */ new Set(["outerShadow", "innerShadow", "presetShadow", "glow"]);
|
|
3305
4085
|
var same2 = (a2, b) => JSON.stringify(a2) === JSON.stringify(b);
|
|
3306
|
-
function fragment(
|
|
3307
|
-
return elements(parseXml(`<w xmlns:a="${NS.a}">${
|
|
4086
|
+
function fragment(xml2) {
|
|
4087
|
+
return elements(parseXml(`<w xmlns:a="${NS.a}">${xml2}</w>`).documentElement)[0];
|
|
3308
4088
|
}
|
|
3309
4089
|
function parseDrawingEffect(node) {
|
|
3310
4090
|
const sourceXml = buildXml(node);
|
|
@@ -3378,12 +4158,12 @@ function drawingEffectXml(effect) {
|
|
|
3378
4158
|
}
|
|
3379
4159
|
}
|
|
3380
4160
|
if (effect.kind === "fillOverlay" && changed("fill")) {
|
|
3381
|
-
const
|
|
3382
|
-
if (effect.fill && !
|
|
3383
|
-
if (
|
|
4161
|
+
const xml2 = effect.fill && drawingFillXml(effect.fill);
|
|
4162
|
+
if (effect.fill && !xml2) throw new Error("Cannot author this DrawingML effect fill");
|
|
4163
|
+
if (xml2 || !effect.fill) {
|
|
3384
4164
|
const fill = fillElementOf(root);
|
|
3385
4165
|
if (fill) root.removeChild(fill);
|
|
3386
|
-
if (
|
|
4166
|
+
if (xml2) root.insertBefore(doc.importNode(fragment(xml2), true), root.firstChild);
|
|
3387
4167
|
}
|
|
3388
4168
|
}
|
|
3389
4169
|
return buildXml(doc);
|
|
@@ -3603,8 +4383,8 @@ function fontSetOf(collection) {
|
|
|
3603
4383
|
...complexScript ? { complexScript } : {}
|
|
3604
4384
|
};
|
|
3605
4385
|
}
|
|
3606
|
-
function parseTheme2(
|
|
3607
|
-
const theme = parseTheme(parseXml2(
|
|
4386
|
+
function parseTheme2(xml2) {
|
|
4387
|
+
const theme = parseTheme(parseXml2(xml2));
|
|
3608
4388
|
const colors = {};
|
|
3609
4389
|
for (const slot2 of THEME_COLOR_SLOTS) {
|
|
3610
4390
|
const value = themeSlotHex(theme.colorScheme.colors[slot2]);
|
|
@@ -3633,8 +4413,8 @@ var TOKEN_TO_SLOT = {
|
|
|
3633
4413
|
hyperlink: "hlink",
|
|
3634
4414
|
followedHyperlink: "folHlink"
|
|
3635
4415
|
};
|
|
3636
|
-
function parseColorSchemeMapping(
|
|
3637
|
-
const document = parseXml2(
|
|
4416
|
+
function parseColorSchemeMapping(xml2) {
|
|
4417
|
+
const document = parseXml2(xml2);
|
|
3638
4418
|
const mapping = Array.from(document.getElementsByTagNameNS(WORD_NS, "clrSchemeMapping"))[0];
|
|
3639
4419
|
const result = {};
|
|
3640
4420
|
if (!mapping) return result;
|
|
@@ -3723,62 +4503,13 @@ var RELATIONSHIP_TYPES = {
|
|
|
3723
4503
|
diagramColors: `${BASE}/diagramColors`,
|
|
3724
4504
|
diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"};
|
|
3725
4505
|
|
|
3726
|
-
// opc/relationships.ts
|
|
3727
|
-
function parseRelationships(xml) {
|
|
3728
|
-
const map = /* @__PURE__ */ new Map();
|
|
3729
|
-
if (!xml) return map;
|
|
3730
|
-
const root = parseXml(xml).documentElement;
|
|
3731
|
-
for (const node of elements(root)) {
|
|
3732
|
-
if (node.localName !== "Relationship") continue;
|
|
3733
|
-
const id = node.getAttribute("Id");
|
|
3734
|
-
const target = node.getAttribute("Target");
|
|
3735
|
-
if (!id || target == null) continue;
|
|
3736
|
-
map.set(id, {
|
|
3737
|
-
id,
|
|
3738
|
-
type: node.getAttribute("Type") ?? "",
|
|
3739
|
-
target,
|
|
3740
|
-
mode: node.getAttribute("TargetMode") === "External" ? "External" : "Internal"
|
|
3741
|
-
});
|
|
3742
|
-
}
|
|
3743
|
-
return map;
|
|
3744
|
-
}
|
|
3745
|
-
var escapeAttr = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
3746
|
-
function buildRelationshipsXml(relationships) {
|
|
3747
|
-
const items = Array.from(relationships).map(([id, rel]) => {
|
|
3748
|
-
const mode = rel.mode === "External" ? ' TargetMode="External"' : "";
|
|
3749
|
-
return `<Relationship Id="${escapeAttr(id)}" Type="${escapeAttr(rel.type)}" Target="${escapeAttr(rel.target)}"${mode}/>`;
|
|
3750
|
-
}).join("");
|
|
3751
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NS.rels}">${items}</Relationships>`;
|
|
3752
|
-
}
|
|
3753
|
-
function resolvePartPath(basePart, target) {
|
|
3754
|
-
if (target.startsWith("/")) return target.slice(1);
|
|
3755
|
-
const baseDir = basePart.slice(0, basePart.lastIndexOf("/") + 1);
|
|
3756
|
-
const resolved = [];
|
|
3757
|
-
for (const segment2 of `${baseDir}${target}`.split("/")) {
|
|
3758
|
-
if (segment2 === "." || segment2 === "") continue;
|
|
3759
|
-
if (segment2 === "..") resolved.pop();
|
|
3760
|
-
else resolved.push(segment2);
|
|
3761
|
-
}
|
|
3762
|
-
return resolved.join("/");
|
|
3763
|
-
}
|
|
3764
|
-
function relationshipsPartFor(partName) {
|
|
3765
|
-
const slash = partName.lastIndexOf("/");
|
|
3766
|
-
return `${partName.slice(0, slash + 1)}_rels/${partName.slice(slash + 1)}.rels`;
|
|
3767
|
-
}
|
|
3768
|
-
function nextRelationshipId(used) {
|
|
3769
|
-
let index = 1;
|
|
3770
|
-
while (used.has(`rId${index}`)) index++;
|
|
3771
|
-
return `rId${index}`;
|
|
3772
|
-
}
|
|
3773
|
-
var getRelationshipId = (element4) => relAttr(element4, "id") || void 0;
|
|
3774
|
-
|
|
3775
4506
|
// opc/content-types.ts
|
|
3776
4507
|
var escapeAttr2 = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
3777
|
-
function parseContentTypes(
|
|
4508
|
+
function parseContentTypes(xml2) {
|
|
3778
4509
|
const defaults = /* @__PURE__ */ new Map();
|
|
3779
4510
|
const overrides = /* @__PURE__ */ new Map();
|
|
3780
|
-
if (!
|
|
3781
|
-
for (const node of elements(parseXml(
|
|
4511
|
+
if (!xml2) return { defaults, overrides };
|
|
4512
|
+
for (const node of elements(parseXml(xml2).documentElement)) {
|
|
3782
4513
|
const contentType = node.getAttribute("ContentType");
|
|
3783
4514
|
if (!contentType) continue;
|
|
3784
4515
|
if (node.localName === "Default") {
|
|
@@ -3807,9 +4538,9 @@ function buildContentTypesXml(types) {
|
|
|
3807
4538
|
).join("");
|
|
3808
4539
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${NS.contentTypes}">${defaults}${overrides}</Types>`;
|
|
3809
4540
|
}
|
|
3810
|
-
function ensureContentTypeDefault(
|
|
3811
|
-
const types = parseContentTypes(
|
|
3812
|
-
if (types.defaults.has(extension.toLowerCase())) return
|
|
4541
|
+
function ensureContentTypeDefault(xml2, extension, contentType) {
|
|
4542
|
+
const types = parseContentTypes(xml2);
|
|
4543
|
+
if (types.defaults.has(extension.toLowerCase())) return xml2 ?? buildContentTypesXml(types);
|
|
3813
4544
|
types.defaults.set(extension.toLowerCase(), contentType);
|
|
3814
4545
|
return buildContentTypesXml(types);
|
|
3815
4546
|
}
|
|
@@ -3819,35 +4550,35 @@ var CONTENT_TYPES_PATH = "[Content_Types].xml";
|
|
|
3819
4550
|
var XML_DECLARATION = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
3820
4551
|
var EMPTY_TYPES = `${XML_DECLARATION}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"></Types>`;
|
|
3821
4552
|
var EMPTY_RELS = `${XML_DECLARATION}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;
|
|
3822
|
-
function attr2(
|
|
4553
|
+
function attr2(tag2, name) {
|
|
3823
4554
|
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3824
|
-
const match = new RegExp(`(?<=[\\s<])${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(
|
|
4555
|
+
const match = new RegExp(`(?<=[\\s<])${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(tag2);
|
|
3825
4556
|
return match ? match[1] ?? match[2] : void 0;
|
|
3826
4557
|
}
|
|
3827
4558
|
async function ensureContentTypeOverride(zip, partName, contentType) {
|
|
3828
|
-
const
|
|
4559
|
+
const xml2 = await zip.file(CONTENT_TYPES_PATH)?.async("string") ?? EMPTY_TYPES;
|
|
3829
4560
|
const target = `/${partName}`;
|
|
3830
|
-
for (const
|
|
3831
|
-
if (attr2(
|
|
4561
|
+
for (const tag2 of xml2.match(/<Override\b[^>]*\/>/g) ?? [])
|
|
4562
|
+
if (attr2(tag2, "PartName") === target) return;
|
|
3832
4563
|
const insertion = `<Override PartName="${target}" ContentType="${contentType}"/>`;
|
|
3833
|
-
zip.file(CONTENT_TYPES_PATH,
|
|
4564
|
+
zip.file(CONTENT_TYPES_PATH, xml2.replace("</Types>", `${insertion}</Types>`));
|
|
3834
4565
|
}
|
|
3835
4566
|
async function removeContentTypeOverride(zip, partName) {
|
|
3836
|
-
const
|
|
3837
|
-
if (!
|
|
4567
|
+
const xml2 = await zip.file(CONTENT_TYPES_PATH)?.async("string");
|
|
4568
|
+
if (!xml2) return;
|
|
3838
4569
|
const target = `/${partName}`;
|
|
3839
|
-
const
|
|
4570
|
+
const tag2 = (xml2.match(/<Override\b[^>]*\/>/g) ?? []).find(
|
|
3840
4571
|
(candidate) => attr2(candidate, "PartName") === target
|
|
3841
4572
|
);
|
|
3842
|
-
if (
|
|
4573
|
+
if (tag2) zip.file(CONTENT_TYPES_PATH, xml2.replace(tag2, ""));
|
|
3843
4574
|
}
|
|
3844
4575
|
async function ensureRelationship(zip, relsPath, type, target) {
|
|
3845
|
-
const
|
|
4576
|
+
const xml2 = await zip.file(relsPath)?.async("string") ?? EMPTY_RELS;
|
|
3846
4577
|
const used = /* @__PURE__ */ new Set();
|
|
3847
|
-
for (const
|
|
3848
|
-
const id2 = attr2(
|
|
4578
|
+
for (const tag2 of xml2.match(/<Relationship\b[^>]*\/>/g) ?? []) {
|
|
4579
|
+
const id2 = attr2(tag2, "Id");
|
|
3849
4580
|
if (id2) used.add(id2);
|
|
3850
|
-
if (id2 && attr2(
|
|
4581
|
+
if (id2 && attr2(tag2, "Type") === type && attr2(tag2, "Target") === target) return id2;
|
|
3851
4582
|
}
|
|
3852
4583
|
const highest = Math.max(
|
|
3853
4584
|
0,
|
|
@@ -3856,7 +4587,7 @@ async function ensureRelationship(zip, relsPath, type, target) {
|
|
|
3856
4587
|
let id = `rId${highest + 1}`;
|
|
3857
4588
|
if (used.has(id)) id = nextRelationshipId(used);
|
|
3858
4589
|
const insertion = `<Relationship Id="${id}" Type="${type}" Target="${target}"/>`;
|
|
3859
|
-
zip.file(relsPath,
|
|
4590
|
+
zip.file(relsPath, xml2.replace("</Relationships>", `${insertion}</Relationships>`));
|
|
3860
4591
|
return id;
|
|
3861
4592
|
}
|
|
3862
4593
|
|
|
@@ -3868,234 +4599,13 @@ function isSafeHyperlinkHref(href) {
|
|
|
3868
4599
|
}
|
|
3869
4600
|
var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
3870
4601
|
/* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
3871
|
-
var DEFAULT_ZIP_LIMITS = {
|
|
3872
|
-
maxInputBytes: 100 * 1024 * 1024,
|
|
3873
|
-
maxEntries: 1e4,
|
|
3874
|
-
maxEntryBytes: 100 * 1024 * 1024,
|
|
3875
|
-
maxTotalBytes: 100 * 1024 * 1024
|
|
3876
|
-
};
|
|
3877
|
-
var ZipLimitError = class extends Error {
|
|
3878
|
-
code = "ZIP_BOMB";
|
|
3879
|
-
limit;
|
|
3880
|
-
/** The check that failed (absent when the error was built without one). */
|
|
3881
|
-
kind;
|
|
3882
|
-
/** The observed value, when known (a lower bound for a size found while inflating). */
|
|
3883
|
-
actual;
|
|
3884
|
-
constructor(message, details) {
|
|
3885
|
-
super(message);
|
|
3886
|
-
this.name = "ZipLimitError";
|
|
3887
|
-
this.limit = details.limit;
|
|
3888
|
-
this.kind = details.kind;
|
|
3889
|
-
this.actual = details.actual;
|
|
3890
|
-
}
|
|
3891
|
-
};
|
|
3892
|
-
var mib = (bytes) => Math.round(bytes / 1048576);
|
|
3893
|
-
function isSafePartName(name) {
|
|
3894
|
-
if (name.includes("\0") || name.includes("\\")) return false;
|
|
3895
|
-
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
3896
|
-
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
3897
|
-
if (body.startsWith("/")) return false;
|
|
3898
|
-
return !body.split("/").some((segment2) => segment2 === "..");
|
|
3899
|
-
}
|
|
3900
|
-
function declaredEntrySize(entry2) {
|
|
3901
|
-
const data = entry2._data;
|
|
3902
|
-
const size = Number(data?.uncompressedSize ?? 0);
|
|
3903
|
-
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
3904
|
-
}
|
|
3905
|
-
function resolveLimits(limits) {
|
|
3906
|
-
const create2 = limits.createError;
|
|
3907
|
-
return {
|
|
3908
|
-
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
3909
|
-
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
3910
|
-
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
3911
|
-
label: limits.label ?? "ZIP",
|
|
3912
|
-
fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
|
|
3913
|
-
};
|
|
3914
|
-
}
|
|
3915
|
-
async function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
3916
|
-
const chunks = [];
|
|
3917
|
-
let size = 0;
|
|
3918
|
-
for await (const chunk of streamEntryGuarded(entry2, alreadyRead, limits)) {
|
|
3919
|
-
chunks.push(chunk);
|
|
3920
|
-
size += chunk.byteLength;
|
|
3921
|
-
}
|
|
3922
|
-
if (chunks.length === 1 && chunks[0]) return chunks[0];
|
|
3923
|
-
const out = new Uint8Array(size);
|
|
3924
|
-
let offset = 0;
|
|
3925
|
-
for (const chunk of chunks) {
|
|
3926
|
-
out.set(chunk, offset);
|
|
3927
|
-
offset += chunk.byteLength;
|
|
3928
|
-
}
|
|
3929
|
-
return out;
|
|
3930
|
-
}
|
|
3931
|
-
var AHEAD = 8;
|
|
3932
|
-
async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
3933
|
-
const r = resolveLimits(limits);
|
|
3934
|
-
const declared = declaredEntrySize(entry2);
|
|
3935
|
-
const stream = entry2.internalStream("uint8array");
|
|
3936
|
-
const queue = [];
|
|
3937
|
-
let size = 0;
|
|
3938
|
-
let ended = false;
|
|
3939
|
-
let stopped = false;
|
|
3940
|
-
let failure;
|
|
3941
|
-
let paused = false;
|
|
3942
|
-
let wake;
|
|
3943
|
-
const pause = () => {
|
|
3944
|
-
paused = true;
|
|
3945
|
-
stream.pause();
|
|
3946
|
-
};
|
|
3947
|
-
const resume = () => {
|
|
3948
|
-
if (!paused || stopped) return;
|
|
3949
|
-
paused = false;
|
|
3950
|
-
stream.resume();
|
|
3951
|
-
};
|
|
3952
|
-
const fail = (error) => {
|
|
3953
|
-
failure ??= error;
|
|
3954
|
-
stopped = true;
|
|
3955
|
-
queue.length = 0;
|
|
3956
|
-
pause();
|
|
3957
|
-
wake?.();
|
|
3958
|
-
};
|
|
3959
|
-
stream.on("data", (chunk) => {
|
|
3960
|
-
if (stopped) return pause();
|
|
3961
|
-
size += chunk.byteLength;
|
|
3962
|
-
if (size > declared || size > r.maxEntryBytes)
|
|
3963
|
-
return fail(
|
|
3964
|
-
r.fail(
|
|
3965
|
-
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
3966
|
-
r.maxEntryBytes,
|
|
3967
|
-
size > declared ? "declaredSize" : "maxEntryBytes",
|
|
3968
|
-
size
|
|
3969
|
-
)
|
|
3970
|
-
);
|
|
3971
|
-
if (alreadyRead + size > r.maxTotalBytes)
|
|
3972
|
-
return fail(
|
|
3973
|
-
r.fail(
|
|
3974
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
3975
|
-
r.maxTotalBytes,
|
|
3976
|
-
"maxTotalBytes",
|
|
3977
|
-
alreadyRead + size
|
|
3978
|
-
)
|
|
3979
|
-
);
|
|
3980
|
-
queue.push(chunk);
|
|
3981
|
-
if (queue.length >= AHEAD) pause();
|
|
3982
|
-
wake?.();
|
|
3983
|
-
});
|
|
3984
|
-
stream.on("error", (error) => fail(error));
|
|
3985
|
-
stream.on("end", () => {
|
|
3986
|
-
ended = true;
|
|
3987
|
-
wake?.();
|
|
3988
|
-
});
|
|
3989
|
-
stream.resume();
|
|
3990
|
-
try {
|
|
3991
|
-
for (; ; ) {
|
|
3992
|
-
if (failure) throw failure;
|
|
3993
|
-
const chunk = queue.shift();
|
|
3994
|
-
if (chunk) {
|
|
3995
|
-
if (queue.length < AHEAD / 2) resume();
|
|
3996
|
-
yield chunk;
|
|
3997
|
-
continue;
|
|
3998
|
-
}
|
|
3999
|
-
if (ended) return;
|
|
4000
|
-
await new Promise((resolve) => {
|
|
4001
|
-
wake = resolve;
|
|
4002
|
-
resume();
|
|
4003
|
-
});
|
|
4004
|
-
wake = void 0;
|
|
4005
|
-
}
|
|
4006
|
-
} finally {
|
|
4007
|
-
stopped = true;
|
|
4008
|
-
if (!ended) pause();
|
|
4009
|
-
}
|
|
4010
|
-
}
|
|
4011
|
-
function toBase64(bytes) {
|
|
4012
|
-
let binary = "";
|
|
4013
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
4014
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
4015
|
-
return btoa(binary);
|
|
4016
|
-
}
|
|
4017
|
-
function guardZip(zip, limits = {}) {
|
|
4018
|
-
const r = resolveLimits(limits);
|
|
4019
|
-
const entries = Object.values(zip.files);
|
|
4020
|
-
if (entries.length > r.maxEntries)
|
|
4021
|
-
throw r.fail(
|
|
4022
|
-
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
4023
|
-
r.maxEntries,
|
|
4024
|
-
"maxEntries",
|
|
4025
|
-
entries.length
|
|
4026
|
-
);
|
|
4027
|
-
let declared = 0;
|
|
4028
|
-
for (const entry2 of entries) {
|
|
4029
|
-
const original = entry2.unsafeOriginalName;
|
|
4030
|
-
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
4031
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
4032
|
-
if (entry2.dir) continue;
|
|
4033
|
-
const size = declaredEntrySize(entry2);
|
|
4034
|
-
if (size > r.maxEntryBytes)
|
|
4035
|
-
throw r.fail(
|
|
4036
|
-
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
4037
|
-
r.maxEntryBytes,
|
|
4038
|
-
"maxEntryBytes",
|
|
4039
|
-
size
|
|
4040
|
-
);
|
|
4041
|
-
declared += size;
|
|
4042
|
-
}
|
|
4043
|
-
if (declared > r.maxTotalBytes)
|
|
4044
|
-
throw r.fail(
|
|
4045
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4046
|
-
r.maxTotalBytes,
|
|
4047
|
-
"maxTotalBytes",
|
|
4048
|
-
declared
|
|
4049
|
-
);
|
|
4050
|
-
const produced = /* @__PURE__ */ new Map();
|
|
4051
|
-
let total = 0;
|
|
4052
|
-
for (const entry2 of entries) {
|
|
4053
|
-
if (entry2.dir) continue;
|
|
4054
|
-
const inflateOriginal = entry2.async.bind(entry2);
|
|
4055
|
-
entry2.async = async (type, onUpdate) => {
|
|
4056
|
-
const previous = produced.get(entry2.name) ?? 0;
|
|
4057
|
-
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
4058
|
-
if (bytes.byteLength > previous) {
|
|
4059
|
-
total += bytes.byteLength - previous;
|
|
4060
|
-
produced.set(entry2.name, bytes.byteLength);
|
|
4061
|
-
}
|
|
4062
|
-
switch (type) {
|
|
4063
|
-
case "uint8array":
|
|
4064
|
-
return bytes;
|
|
4065
|
-
case "string":
|
|
4066
|
-
case "text":
|
|
4067
|
-
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
4068
|
-
case "arraybuffer":
|
|
4069
|
-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
4070
|
-
case "base64":
|
|
4071
|
-
return toBase64(bytes);
|
|
4072
|
-
default:
|
|
4073
|
-
return inflateOriginal(type, onUpdate);
|
|
4074
|
-
}
|
|
4075
|
-
};
|
|
4076
|
-
}
|
|
4077
|
-
return zip;
|
|
4078
|
-
}
|
|
4079
|
-
async function openZip(input, limits = {}) {
|
|
4080
|
-
const r = resolveLimits(limits);
|
|
4081
|
-
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
4082
|
-
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
4083
|
-
if (bytes.byteLength > maxInput)
|
|
4084
|
-
throw r.fail(
|
|
4085
|
-
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
4086
|
-
maxInput,
|
|
4087
|
-
"maxInputBytes",
|
|
4088
|
-
bytes.byteLength
|
|
4089
|
-
);
|
|
4090
|
-
return guardZip(await JSZip.loadAsync(bytes), limits);
|
|
4091
|
-
}
|
|
4092
4602
|
|
|
4093
4603
|
// opc/properties/patch.ts
|
|
4094
4604
|
var XMLNS3 = "http://www.w3.org/2000/xmlns/";
|
|
4095
|
-
function tagEnd(
|
|
4605
|
+
function tagEnd(xml2, from) {
|
|
4096
4606
|
let quote = "";
|
|
4097
|
-
for (let i2 = from + 1; i2 <
|
|
4098
|
-
const ch =
|
|
4607
|
+
for (let i2 = from + 1; i2 < xml2.length; i2++) {
|
|
4608
|
+
const ch = xml2[i2];
|
|
4099
4609
|
if (quote) {
|
|
4100
4610
|
if (ch === quote) quote = "";
|
|
4101
4611
|
} else if (ch === '"' || ch === "'") quote = ch;
|
|
@@ -4103,24 +4613,24 @@ function tagEnd(xml, from) {
|
|
|
4103
4613
|
}
|
|
4104
4614
|
throw new Error("Unterminated tag in property part");
|
|
4105
4615
|
}
|
|
4106
|
-
function skipMarkup(
|
|
4107
|
-
if (
|
|
4108
|
-
if (
|
|
4109
|
-
if (
|
|
4616
|
+
function skipMarkup(xml2, at) {
|
|
4617
|
+
if (xml2.startsWith("<!--", at)) return xml2.indexOf("-->", at) + 3;
|
|
4618
|
+
if (xml2.startsWith("<![CDATA[", at)) return xml2.indexOf("]]>", at) + 3;
|
|
4619
|
+
if (xml2.startsWith("<?", at)) return xml2.indexOf("?>", at) + 2;
|
|
4110
4620
|
return void 0;
|
|
4111
4621
|
}
|
|
4112
|
-
function scan(
|
|
4622
|
+
function scan(xml2) {
|
|
4113
4623
|
let i2 = 0;
|
|
4114
4624
|
let rootStart = -1;
|
|
4115
4625
|
while (rootStart < 0) {
|
|
4116
|
-
const lt =
|
|
4626
|
+
const lt = xml2.indexOf("<", i2);
|
|
4117
4627
|
if (lt < 0) throw new Error("Property part has no root element");
|
|
4118
|
-
const skipped = skipMarkup(
|
|
4628
|
+
const skipped = skipMarkup(xml2, lt);
|
|
4119
4629
|
if (skipped !== void 0) i2 = skipped;
|
|
4120
4630
|
else rootStart = lt;
|
|
4121
4631
|
}
|
|
4122
|
-
const openEnd = tagEnd(
|
|
4123
|
-
if (
|
|
4632
|
+
const openEnd = tagEnd(xml2, rootStart);
|
|
4633
|
+
if (xml2[openEnd - 2] === "/") {
|
|
4124
4634
|
const root = {
|
|
4125
4635
|
start: rootStart,
|
|
4126
4636
|
openEnd,
|
|
@@ -4135,16 +4645,16 @@ function scan(xml) {
|
|
|
4135
4645
|
let child7;
|
|
4136
4646
|
i2 = openEnd;
|
|
4137
4647
|
for (; ; ) {
|
|
4138
|
-
const lt =
|
|
4648
|
+
const lt = xml2.indexOf("<", i2);
|
|
4139
4649
|
if (lt < 0) throw new Error("Property part root is not closed");
|
|
4140
|
-
const skipped = skipMarkup(
|
|
4650
|
+
const skipped = skipMarkup(xml2, lt);
|
|
4141
4651
|
if (skipped !== void 0) {
|
|
4142
4652
|
i2 = skipped;
|
|
4143
4653
|
continue;
|
|
4144
4654
|
}
|
|
4145
|
-
const end = tagEnd(
|
|
4655
|
+
const end = tagEnd(xml2, lt);
|
|
4146
4656
|
i2 = end;
|
|
4147
|
-
if (
|
|
4657
|
+
if (xml2[lt + 1] === "/") {
|
|
4148
4658
|
if (depth === 0) {
|
|
4149
4659
|
const root = { start: rootStart, openEnd, closeStart: lt, end, selfClosing: false };
|
|
4150
4660
|
return { root, children: children3 };
|
|
@@ -4152,7 +4662,7 @@ function scan(xml) {
|
|
|
4152
4662
|
depth--;
|
|
4153
4663
|
if (depth === 0 && child7)
|
|
4154
4664
|
children3.push({ ...child7, closeStart: lt, end, selfClosing: false });
|
|
4155
|
-
} else if (
|
|
4665
|
+
} else if (xml2[end - 2] === "/") {
|
|
4156
4666
|
if (depth === 0)
|
|
4157
4667
|
children3.push({ start: lt, openEnd: end, closeStart: end, end, selfClosing: true });
|
|
4158
4668
|
} else {
|
|
@@ -4162,11 +4672,11 @@ function scan(xml) {
|
|
|
4162
4672
|
}
|
|
4163
4673
|
}
|
|
4164
4674
|
var escapeText = (text2) => text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\r/g, "
");
|
|
4165
|
-
var qualifiedName = (
|
|
4675
|
+
var qualifiedName = (xml2, span) => /^<([^\s/>]+)/.exec(xml2.slice(span.start, span.openEnd))?.[1] ?? "";
|
|
4166
4676
|
var PartPatch = class {
|
|
4167
|
-
constructor(
|
|
4168
|
-
this.xml =
|
|
4169
|
-
const { root, children: children3 } = scan(
|
|
4677
|
+
constructor(xml2, rootElement) {
|
|
4678
|
+
this.xml = xml2;
|
|
4679
|
+
const { root, children: children3 } = scan(xml2);
|
|
4170
4680
|
const kids = elements(rootElement);
|
|
4171
4681
|
if (kids.length !== children3.length) throw new Error("Property part markup is not supported");
|
|
4172
4682
|
kids.forEach((kid, index) => this.spans.set(kid, children3[index]));
|
|
@@ -4281,10 +4791,10 @@ var FIELDS = [
|
|
|
4281
4791
|
FIELDS.map(([field]) => field);
|
|
4282
4792
|
var EMPTY_CORE = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4283
4793
|
<cp:coreProperties xmlns:cp="${NS.cp}" xmlns:dc="${NS.dc}" xmlns:dcterms="${NS.dcterms}" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="${XSI}"/>`;
|
|
4284
|
-
function parseCoreProperties(
|
|
4794
|
+
function parseCoreProperties(xml2) {
|
|
4285
4795
|
const out = {};
|
|
4286
|
-
if (!
|
|
4287
|
-
const root = parseXml(
|
|
4796
|
+
if (!xml2) return out;
|
|
4797
|
+
const root = parseXml(xml2, { label: "core properties" }).documentElement;
|
|
4288
4798
|
for (const [field, prefix2] of FIELDS) {
|
|
4289
4799
|
const text2 = first(root, field, NS[prefix2])?.textContent ?? "";
|
|
4290
4800
|
if (text2 !== "") out[field] = text2;
|
|
@@ -4293,9 +4803,9 @@ function parseCoreProperties(xml) {
|
|
|
4293
4803
|
}
|
|
4294
4804
|
var formatW3cdtf = (date) => date.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
4295
4805
|
function writeCoreProperties(props, sourceXml) {
|
|
4296
|
-
const
|
|
4297
|
-
const root = parseXml(
|
|
4298
|
-
const patch = new PartPatch(
|
|
4806
|
+
const xml2 = sourceXml ?? EMPTY_CORE;
|
|
4807
|
+
const root = parseXml(xml2, { label: "core properties" }).documentElement;
|
|
4808
|
+
const patch = new PartPatch(xml2, root);
|
|
4299
4809
|
for (const [field, prefix2, isDate] of FIELDS) {
|
|
4300
4810
|
const ns = NS[prefix2];
|
|
4301
4811
|
const value = props[field];
|
|
@@ -4432,8 +4942,8 @@ var PREFIX = {
|
|
|
4432
4942
|
};
|
|
4433
4943
|
var CORE_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
4434
4944
|
var CORE_REL = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
|
4435
|
-
function parseCoreProperties2(
|
|
4436
|
-
const root = parseXml2(
|
|
4945
|
+
function parseCoreProperties2(xml2) {
|
|
4946
|
+
const root = parseXml2(xml2).documentElement;
|
|
4437
4947
|
const result = {};
|
|
4438
4948
|
for (const field of PROPERTY_FIELDS) {
|
|
4439
4949
|
const element4 = child(root, field);
|
|
@@ -5107,8 +5617,8 @@ function parseContentControl(sdt, level4) {
|
|
|
5107
5617
|
};
|
|
5108
5618
|
const alias = getW(first2(sdtPr, "alias"), "val");
|
|
5109
5619
|
if (alias !== void 0) control.alias = alias;
|
|
5110
|
-
const
|
|
5111
|
-
if (
|
|
5620
|
+
const tag2 = getW(first2(sdtPr, "tag"), "val");
|
|
5621
|
+
if (tag2 !== void 0) control.tag = tag2;
|
|
5112
5622
|
const lock = getW(first2(sdtPr, "lock"), "val");
|
|
5113
5623
|
if (lock === "sdtLocked" || lock === "contentLocked" || lock === "sdtContentLocked")
|
|
5114
5624
|
control.lock = lock;
|
|
@@ -5411,21 +5921,21 @@ function onlyProperties(sdtPr) {
|
|
|
5411
5921
|
const value = (local) => children2(sdtPr, local).map((child7) => getW(child7, "val"));
|
|
5412
5922
|
return value("id").every((id) => validId(id) !== void 0) && value("lock").every((lock) => lock === "unlocked" || validLock(lock) !== void 0);
|
|
5413
5923
|
}
|
|
5414
|
-
function verbatimProperties(doc,
|
|
5415
|
-
if (!
|
|
5924
|
+
function verbatimProperties(doc, xml2) {
|
|
5925
|
+
if (!xml2) return void 0;
|
|
5416
5926
|
let root;
|
|
5417
5927
|
try {
|
|
5418
|
-
root = parseXml2(
|
|
5928
|
+
root = parseXml2(xml2).documentElement;
|
|
5419
5929
|
} catch {
|
|
5420
5930
|
return void 0;
|
|
5421
5931
|
}
|
|
5422
5932
|
return root?.localName === "sdtPr" && root.namespaceURI === WORD_NS && onlyProperties(root) ? importElement(doc, root) : void 0;
|
|
5423
5933
|
}
|
|
5424
|
-
function verbatimEndProperties(doc,
|
|
5425
|
-
if (!
|
|
5934
|
+
function verbatimEndProperties(doc, xml2) {
|
|
5935
|
+
if (!xml2) return void 0;
|
|
5426
5936
|
let root;
|
|
5427
5937
|
try {
|
|
5428
|
-
root = parseXml2(
|
|
5938
|
+
root = parseXml2(xml2).documentElement;
|
|
5429
5939
|
} catch {
|
|
5430
5940
|
return void 0;
|
|
5431
5941
|
}
|
|
@@ -5994,8 +6504,8 @@ async function commentHexIds(zip) {
|
|
|
5994
6504
|
const used = /* @__PURE__ */ new Set();
|
|
5995
6505
|
for (const file of Object.values(zip.files)) {
|
|
5996
6506
|
if (!file.name.startsWith("word/") || !file.name.endsWith(".xml")) continue;
|
|
5997
|
-
const
|
|
5998
|
-
for (const match of
|
|
6507
|
+
const xml2 = await file.async("string");
|
|
6508
|
+
for (const match of xml2.matchAll(
|
|
5999
6509
|
/\b(?:[\w.-]+:)?(?:paraId|durableId)\s*=\s*["']([\dA-Fa-f]{8})["']/g
|
|
6000
6510
|
))
|
|
6001
6511
|
used.add(match[1].toUpperCase());
|
|
@@ -6027,9 +6537,9 @@ async function patchCommentAnchors(zip, ids, comments) {
|
|
|
6027
6537
|
const byId = new Map(comments.map((comment) => [ids.get(comment.id), comment]));
|
|
6028
6538
|
for (const file of Object.values(zip.files)) {
|
|
6029
6539
|
if (!file.name.startsWith("word/") || !file.name.endsWith(".xml")) continue;
|
|
6030
|
-
const
|
|
6031
|
-
if (!/commentRangeStart|commentRangeEnd|commentReference/.test(
|
|
6032
|
-
const doc = parseXml2(
|
|
6540
|
+
const xml2 = await file.async("string");
|
|
6541
|
+
if (!/commentRangeStart|commentRangeEnd|commentReference/.test(xml2)) continue;
|
|
6542
|
+
const doc = parseXml2(xml2);
|
|
6033
6543
|
let changed = false;
|
|
6034
6544
|
const anchors = /* @__PURE__ */ new Map();
|
|
6035
6545
|
for (const name of ["commentRangeStart", "commentRangeEnd", "commentReference"]) {
|
|
@@ -6148,161 +6658,6 @@ function patchCommentMetadata(parts, identities) {
|
|
|
6148
6658
|
return result;
|
|
6149
6659
|
}
|
|
6150
6660
|
|
|
6151
|
-
// text/text-diff.ts
|
|
6152
|
-
var isLowSurrogate = (text2, at) => {
|
|
6153
|
-
const code = text2.charCodeAt(at);
|
|
6154
|
-
return code >= 56320 && code <= 57343;
|
|
6155
|
-
};
|
|
6156
|
-
function shortestEdit(n2, m, same6, maxEdits) {
|
|
6157
|
-
const max = Math.min(n2 + m, maxEdits);
|
|
6158
|
-
const offset = max + 1;
|
|
6159
|
-
const v = new Int32Array(2 * max + 3);
|
|
6160
|
-
const trace = [];
|
|
6161
|
-
for (let d = 0; d <= max; d++) {
|
|
6162
|
-
for (let k = -d; k <= d; k += 2) {
|
|
6163
|
-
const down = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1];
|
|
6164
|
-
let x = down ? v[offset + k + 1] : v[offset + k - 1] + 1;
|
|
6165
|
-
let y = x - k;
|
|
6166
|
-
while (x < n2 && y < m && same6(x, y)) {
|
|
6167
|
-
x++;
|
|
6168
|
-
y++;
|
|
6169
|
-
}
|
|
6170
|
-
v[offset + k] = x;
|
|
6171
|
-
if (x >= n2 && y >= m) return backtrack(trace, n2, m, d);
|
|
6172
|
-
}
|
|
6173
|
-
trace.push(v.slice(offset - d, offset + d + 1));
|
|
6174
|
-
}
|
|
6175
|
-
return void 0;
|
|
6176
|
-
}
|
|
6177
|
-
function backtrack(trace, n2, m, d) {
|
|
6178
|
-
const edits = [];
|
|
6179
|
-
let x = n2;
|
|
6180
|
-
let y = m;
|
|
6181
|
-
for (let step = d; step > 0; step--) {
|
|
6182
|
-
const previous = trace[step - 1];
|
|
6183
|
-
const at = (k2) => previous[k2 + step - 1];
|
|
6184
|
-
const k = x - y;
|
|
6185
|
-
const down = k === -step || k !== step && at(k - 1) < at(k + 1);
|
|
6186
|
-
const before = down ? k + 1 : k - 1;
|
|
6187
|
-
const startX = at(before);
|
|
6188
|
-
const startY = startX - before;
|
|
6189
|
-
edits.push(down ? [startX, startY, true] : [startX, startY, false]);
|
|
6190
|
-
x = startX;
|
|
6191
|
-
y = startY;
|
|
6192
|
-
}
|
|
6193
|
-
return edits.reverse();
|
|
6194
|
-
}
|
|
6195
|
-
function changesOf(edits) {
|
|
6196
|
-
const changes = [];
|
|
6197
|
-
for (const [x, y, inserts] of edits) {
|
|
6198
|
-
const last = changes.at(-1);
|
|
6199
|
-
if (last && last.fromEnd === x && last.toEnd === y) {
|
|
6200
|
-
if (inserts) last.toEnd++;
|
|
6201
|
-
else last.fromEnd++;
|
|
6202
|
-
} else
|
|
6203
|
-
changes.push({
|
|
6204
|
-
fromStart: x,
|
|
6205
|
-
fromEnd: inserts ? x : x + 1,
|
|
6206
|
-
toStart: y,
|
|
6207
|
-
toEnd: inserts ? y + 1 : y
|
|
6208
|
-
});
|
|
6209
|
-
}
|
|
6210
|
-
return changes;
|
|
6211
|
-
}
|
|
6212
|
-
function characterChanges(a2, b, maxEdits) {
|
|
6213
|
-
const edits = shortestEdit(
|
|
6214
|
-
a2.length,
|
|
6215
|
-
b.length,
|
|
6216
|
-
(x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
|
|
6217
|
-
maxEdits
|
|
6218
|
-
);
|
|
6219
|
-
return edits && changesOf(edits);
|
|
6220
|
-
}
|
|
6221
|
-
var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
|
|
6222
|
-
function tokensOf(text2, ids) {
|
|
6223
|
-
const tokens = [];
|
|
6224
|
-
const starts = [];
|
|
6225
|
-
for (const match of text2.matchAll(TOKEN)) {
|
|
6226
|
-
let id = ids.get(match[0]);
|
|
6227
|
-
if (id === void 0) ids.set(match[0], id = ids.size);
|
|
6228
|
-
tokens.push(id);
|
|
6229
|
-
starts.push(match.index);
|
|
6230
|
-
}
|
|
6231
|
-
starts.push(text2.length);
|
|
6232
|
-
return { tokens, starts };
|
|
6233
|
-
}
|
|
6234
|
-
function tokenChanges(a2, b, maxEdits) {
|
|
6235
|
-
const ids = /* @__PURE__ */ new Map();
|
|
6236
|
-
const from = tokensOf(a2, ids);
|
|
6237
|
-
const to = tokensOf(b, ids);
|
|
6238
|
-
const edits = shortestEdit(
|
|
6239
|
-
from.tokens.length,
|
|
6240
|
-
to.tokens.length,
|
|
6241
|
-
(x, y) => from.tokens[x] === to.tokens[y],
|
|
6242
|
-
maxEdits
|
|
6243
|
-
);
|
|
6244
|
-
if (!edits) return void 0;
|
|
6245
|
-
let budget = maxEdits;
|
|
6246
|
-
return changesOf(edits).flatMap((stretch) => {
|
|
6247
|
-
const change = {
|
|
6248
|
-
fromStart: from.starts[stretch.fromStart],
|
|
6249
|
-
fromEnd: from.starts[stretch.fromEnd],
|
|
6250
|
-
toStart: to.starts[stretch.toStart],
|
|
6251
|
-
toEnd: to.starts[stretch.toEnd]
|
|
6252
|
-
};
|
|
6253
|
-
const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
|
|
6254
|
-
a2.slice(change.fromStart, change.fromEnd),
|
|
6255
|
-
b.slice(change.toStart, change.toEnd),
|
|
6256
|
-
budget
|
|
6257
|
-
) : void 0;
|
|
6258
|
-
if (!inner) return [change];
|
|
6259
|
-
for (const found of inner)
|
|
6260
|
-
budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
|
|
6261
|
-
return inner.map((found) => ({
|
|
6262
|
-
fromStart: found.fromStart + change.fromStart,
|
|
6263
|
-
fromEnd: found.fromEnd + change.fromStart,
|
|
6264
|
-
toStart: found.toStart + change.toStart,
|
|
6265
|
-
toEnd: found.toEnd + change.toStart
|
|
6266
|
-
}));
|
|
6267
|
-
});
|
|
6268
|
-
}
|
|
6269
|
-
function diffText(from, to, maxEdits = 500) {
|
|
6270
|
-
let start = 0;
|
|
6271
|
-
while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
|
|
6272
|
-
start++;
|
|
6273
|
-
let end = 0;
|
|
6274
|
-
while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
|
|
6275
|
-
end++;
|
|
6276
|
-
const a2 = from.slice(start, from.length - end);
|
|
6277
|
-
const b = to.slice(start, to.length - end);
|
|
6278
|
-
if (!a2.length && !b.length) return [];
|
|
6279
|
-
const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
|
|
6280
|
-
const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
|
|
6281
|
-
const result = [];
|
|
6282
|
-
for (const change of changes) {
|
|
6283
|
-
const placed = {
|
|
6284
|
-
fromStart: change.fromStart + start,
|
|
6285
|
-
fromEnd: change.fromEnd + start,
|
|
6286
|
-
toStart: change.toStart + start,
|
|
6287
|
-
toEnd: change.toEnd + start
|
|
6288
|
-
};
|
|
6289
|
-
if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
|
|
6290
|
-
placed.fromStart--;
|
|
6291
|
-
placed.toStart--;
|
|
6292
|
-
}
|
|
6293
|
-
if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
|
|
6294
|
-
placed.fromEnd++;
|
|
6295
|
-
placed.toEnd++;
|
|
6296
|
-
}
|
|
6297
|
-
const last = result.at(-1);
|
|
6298
|
-
if (last && placed.fromStart <= last.fromEnd) {
|
|
6299
|
-
last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
|
|
6300
|
-
last.toEnd = Math.max(last.toEnd, placed.toEnd);
|
|
6301
|
-
} else result.push(placed);
|
|
6302
|
-
}
|
|
6303
|
-
return result;
|
|
6304
|
-
}
|
|
6305
|
-
|
|
6306
6661
|
// docx/write-run-extra.ts
|
|
6307
6662
|
function setAttribute2(element4, local, value) {
|
|
6308
6663
|
element4.setAttributeNS(WORD_NS, `w:${local}`, value);
|
|
@@ -7138,8 +7493,8 @@ function resolveDrawingOuterShadow(effect, theme) {
|
|
|
7138
7493
|
dy: Math.sin(angle) * distance
|
|
7139
7494
|
};
|
|
7140
7495
|
}
|
|
7141
|
-
function resolveDrawingShadowXml(
|
|
7142
|
-
return
|
|
7496
|
+
function resolveDrawingShadowXml(xml2, theme) {
|
|
7497
|
+
return xml2 ? resolveDrawingShadow(parseXml(xml2).documentElement, theme) : void 0;
|
|
7143
7498
|
}
|
|
7144
7499
|
function svgDropShadowElement(s, format) {
|
|
7145
7500
|
const num2 = format.number;
|
|
@@ -7860,20 +8215,20 @@ function dropRedundantDeclarations(element4) {
|
|
|
7860
8215
|
if (element4.getAttribute("xmlns:r") === NS.r) element4.removeAttribute("xmlns:r");
|
|
7861
8216
|
for (const child7 of elements(element4)) dropRedundantDeclarations(child7);
|
|
7862
8217
|
}
|
|
7863
|
-
function importDrawingXml(doc,
|
|
7864
|
-
const wrapper = parseXml(`<w xmlns:a="${NS.a}" xmlns:r="${NS.r}">${
|
|
8218
|
+
function importDrawingXml(doc, xml2) {
|
|
8219
|
+
const wrapper = parseXml(`<w xmlns:a="${NS.a}" xmlns:r="${NS.r}">${xml2}</w>`).documentElement;
|
|
7865
8220
|
const node = elements(wrapper)[0];
|
|
7866
8221
|
if (!node) throw new Error("Empty DrawingML fragment");
|
|
7867
8222
|
const imported = doc.importNode(node, true);
|
|
7868
8223
|
dropRedundantDeclarations(imported);
|
|
7869
8224
|
return imported;
|
|
7870
8225
|
}
|
|
7871
|
-
function keptChildName(
|
|
7872
|
-
const match = /^\s*<(?:[\w.-]+:)?([\w.-]+)/u.exec(
|
|
8226
|
+
function keptChildName(xml2) {
|
|
8227
|
+
const match = /^\s*<(?:[\w.-]+:)?([\w.-]+)/u.exec(xml2);
|
|
7873
8228
|
return match?.[1] ?? "";
|
|
7874
8229
|
}
|
|
7875
|
-
function keptChildren(doc,
|
|
7876
|
-
return (
|
|
8230
|
+
function keptChildren(doc, xml2) {
|
|
8231
|
+
return (xml2 ?? []).map((value) => ({
|
|
7877
8232
|
name: keptChildName(value),
|
|
7878
8233
|
node: importDrawingXml(doc, value)
|
|
7879
8234
|
}));
|
|
@@ -7940,7 +8295,7 @@ function writeHyperlink(doc, local, link) {
|
|
|
7940
8295
|
setBoolean(element4, "history", link.history);
|
|
7941
8296
|
setBoolean(element4, "highlightClick", link.highlightClick);
|
|
7942
8297
|
setBoolean(element4, "endSnd", link.endSound);
|
|
7943
|
-
for (const
|
|
8298
|
+
for (const xml2 of link.extraXml ?? []) element4.appendChild(importDrawingXml(doc, xml2));
|
|
7944
8299
|
return element4;
|
|
7945
8300
|
}
|
|
7946
8301
|
function setAttributes(element4, value) {
|
|
@@ -7965,9 +8320,9 @@ function setAttributes(element4, value) {
|
|
|
7965
8320
|
setValue(element4, "bmk", value.bookmark);
|
|
7966
8321
|
}
|
|
7967
8322
|
function fillChild(doc, fill) {
|
|
7968
|
-
const
|
|
7969
|
-
if (!
|
|
7970
|
-
const node = importDrawingXml(doc,
|
|
8323
|
+
const xml2 = fill ? drawingFillXml(fill) : void 0;
|
|
8324
|
+
if (!xml2) return void 0;
|
|
8325
|
+
const node = importDrawingXml(doc, xml2);
|
|
7971
8326
|
return { name: node.localName, node };
|
|
7972
8327
|
}
|
|
7973
8328
|
function modelledChildren(doc, value) {
|
|
@@ -8188,9 +8543,9 @@ function semantics(value) {
|
|
|
8188
8543
|
Object.fromEntries(Object.entries(value).filter(([key]) => key !== "sourceXml"))
|
|
8189
8544
|
);
|
|
8190
8545
|
}
|
|
8191
|
-
function source(doc, name,
|
|
8192
|
-
if (!
|
|
8193
|
-
const element4 = parseXml(
|
|
8546
|
+
function source(doc, name, xml2) {
|
|
8547
|
+
if (!xml2) return doc.createElementNS(NS.a, `a:${name}`);
|
|
8548
|
+
const element4 = parseXml(xml2).documentElement;
|
|
8194
8549
|
if (element4.namespaceURI !== NS.a || element4.localName !== name)
|
|
8195
8550
|
throw new Error(`Invalid ${name} source`);
|
|
8196
8551
|
return doc.importNode(element4, true);
|
|
@@ -18007,10 +18362,10 @@ function parseAttributes(source2) {
|
|
|
18007
18362
|
}
|
|
18008
18363
|
return attrs3;
|
|
18009
18364
|
}
|
|
18010
|
-
function tagEnd2(
|
|
18365
|
+
function tagEnd2(xml2, from) {
|
|
18011
18366
|
let quote = "";
|
|
18012
|
-
for (let i2 = from; i2 <
|
|
18013
|
-
const ch =
|
|
18367
|
+
for (let i2 = from; i2 < xml2.length; i2++) {
|
|
18368
|
+
const ch = xml2[i2];
|
|
18014
18369
|
if (quote) {
|
|
18015
18370
|
if (ch === quote) {
|
|
18016
18371
|
quote = "";
|
|
@@ -18023,27 +18378,27 @@ function tagEnd2(xml, from) {
|
|
|
18023
18378
|
}
|
|
18024
18379
|
return -1;
|
|
18025
18380
|
}
|
|
18026
|
-
function parseOrderedXml(
|
|
18381
|
+
function parseOrderedXml(xml2) {
|
|
18027
18382
|
const root = { name: "#document", attrs: {}, children: [] };
|
|
18028
18383
|
const stack = [root];
|
|
18029
|
-
let i2 =
|
|
18030
|
-
while (i2 >= 0 && i2 <
|
|
18031
|
-
if (
|
|
18032
|
-
const close =
|
|
18033
|
-
i2 = close < 0 ? -1 :
|
|
18384
|
+
let i2 = xml2.indexOf("<");
|
|
18385
|
+
while (i2 >= 0 && i2 < xml2.length) {
|
|
18386
|
+
if (xml2.startsWith("<!--", i2)) {
|
|
18387
|
+
const close = xml2.indexOf("-->", i2 + 4);
|
|
18388
|
+
i2 = close < 0 ? -1 : xml2.indexOf("<", close + 3);
|
|
18034
18389
|
continue;
|
|
18035
18390
|
}
|
|
18036
|
-
if (
|
|
18037
|
-
const close =
|
|
18038
|
-
i2 = close < 0 ? -1 :
|
|
18391
|
+
if (xml2.startsWith("<![CDATA[", i2)) {
|
|
18392
|
+
const close = xml2.indexOf("]]>", i2 + 9);
|
|
18393
|
+
i2 = close < 0 ? -1 : xml2.indexOf("<", close + 3);
|
|
18039
18394
|
continue;
|
|
18040
18395
|
}
|
|
18041
|
-
const end = tagEnd2(
|
|
18396
|
+
const end = tagEnd2(xml2, i2 + 1);
|
|
18042
18397
|
if (end < 0) {
|
|
18043
18398
|
break;
|
|
18044
18399
|
}
|
|
18045
|
-
const next =
|
|
18046
|
-
const first3 =
|
|
18400
|
+
const next = xml2.indexOf("<", end + 1);
|
|
18401
|
+
const first3 = xml2[i2 + 1];
|
|
18047
18402
|
if (first3 === "?" || first3 === "!") {
|
|
18048
18403
|
i2 = next;
|
|
18049
18404
|
continue;
|
|
@@ -18051,11 +18406,11 @@ function parseOrderedXml(xml) {
|
|
|
18051
18406
|
const closing = first3 === "/";
|
|
18052
18407
|
let cursor = closing ? i2 + 2 : i2 + 1;
|
|
18053
18408
|
const nameStart = cursor;
|
|
18054
|
-
while (cursor < end && isNameChar(
|
|
18409
|
+
while (cursor < end && isNameChar(xml2[cursor])) {
|
|
18055
18410
|
cursor++;
|
|
18056
18411
|
}
|
|
18057
|
-
const
|
|
18058
|
-
if (!
|
|
18412
|
+
const tag2 = xml2.slice(nameStart, cursor);
|
|
18413
|
+
if (!tag2) {
|
|
18059
18414
|
i2 = next;
|
|
18060
18415
|
continue;
|
|
18061
18416
|
}
|
|
@@ -18066,10 +18421,10 @@ function parseOrderedXml(xml) {
|
|
|
18066
18421
|
i2 = next;
|
|
18067
18422
|
continue;
|
|
18068
18423
|
}
|
|
18069
|
-
const selfClosing =
|
|
18424
|
+
const selfClosing = xml2[end - 1] === "/";
|
|
18070
18425
|
const element4 = {
|
|
18071
|
-
name: localName(
|
|
18072
|
-
attrs: parseAttributes(
|
|
18426
|
+
name: localName(tag2),
|
|
18427
|
+
attrs: parseAttributes(xml2.slice(cursor, selfClosing ? end - 1 : end)),
|
|
18073
18428
|
children: []
|
|
18074
18429
|
};
|
|
18075
18430
|
stack[stack.length - 1].children.push(element4);
|
|
@@ -18279,8 +18634,8 @@ function parseStatement(element4, state) {
|
|
|
18279
18634
|
return void 0;
|
|
18280
18635
|
}
|
|
18281
18636
|
}
|
|
18282
|
-
function parseLayoutDefinitionXml(
|
|
18283
|
-
const document = parseOrderedXml(
|
|
18637
|
+
function parseLayoutDefinitionXml(xml2) {
|
|
18638
|
+
const document = parseOrderedXml(xml2);
|
|
18284
18639
|
const layoutDef = document?.name === "layoutDef" ? document : findOrderedDescendant(document, "layoutDef");
|
|
18285
18640
|
const rootElement = layoutDef?.children.find((child7) => child7.name === "layoutNode");
|
|
18286
18641
|
if (!layoutDef || !rootElement) {
|
|
@@ -24152,12 +24507,12 @@ function writeDiagramFormatDefinition(source2, change) {
|
|
|
24152
24507
|
return buildXml(doc);
|
|
24153
24508
|
}
|
|
24154
24509
|
function formatDiagramSource(source2, change) {
|
|
24155
|
-
const
|
|
24510
|
+
const xml2 = writeDiagramFormatDefinition(
|
|
24156
24511
|
change.kind === "colors" ? source2?.colorsXml : source2?.quickStyleXml,
|
|
24157
24512
|
change
|
|
24158
24513
|
);
|
|
24159
24514
|
const id = `urn:ooxml-core/${change.kind}/${change.value}`;
|
|
24160
|
-
return change.kind === "colors" ? { source: { ...source2, colorsXml:
|
|
24515
|
+
return change.kind === "colors" ? { source: { ...source2, colorsXml: xml2 }, colorsId: id } : { source: { ...source2, quickStyleXml: xml2 }, quickStyleId: id };
|
|
24161
24516
|
}
|
|
24162
24517
|
|
|
24163
24518
|
// diagram/write/data-edit.ts
|
|
@@ -24263,9 +24618,9 @@ function dropDrawingExtension(model) {
|
|
|
24263
24618
|
if (ext.getAttribute("uri") === DSP_EXT_URI) extLst.removeChild(ext);
|
|
24264
24619
|
if (elements(extLst).length === 0) model.removeChild(extLst);
|
|
24265
24620
|
}
|
|
24266
|
-
function writeEditedDiagramData(
|
|
24621
|
+
function writeEditedDiagramData(xml2, nodes, options2 = {}) {
|
|
24267
24622
|
const createModelId = options2.createModelId ?? createOfficeGuid;
|
|
24268
|
-
const doc = parseXml(
|
|
24623
|
+
const doc = parseXml(xml2, { label: "diagram data" });
|
|
24269
24624
|
const model = doc.documentElement;
|
|
24270
24625
|
const ptLst = child4(model, "ptLst");
|
|
24271
24626
|
if (!ptLst) throw new Error("The diagram data part has no point list.");
|
|
@@ -24703,8 +25058,8 @@ function sha256(data) {
|
|
|
24703
25058
|
// diagram/cache-metadata.ts
|
|
24704
25059
|
var GENERATED_DIAGRAM_CACHE_NS = "urn:ooxml-core:diagram:generated-cache";
|
|
24705
25060
|
var GENERATED_DIAGRAM_CACHE_NOTICE = "Generated SmartArt preview; not native Office layout.";
|
|
24706
|
-
var generatedDrawingDigest = (
|
|
24707
|
-
sha256(new TextEncoder().encode(
|
|
25061
|
+
var generatedDrawingDigest = (xml2) => Array.from(
|
|
25062
|
+
sha256(new TextEncoder().encode(xml2)),
|
|
24708
25063
|
(byte) => byte.toString(16).padStart(2, "0")
|
|
24709
25064
|
).join("");
|
|
24710
25065
|
var DEFAULT_GENERATED_DIAGRAM_SCHEME = {
|
|
@@ -25355,26 +25710,26 @@ function diagramLayoutData(input) {
|
|
|
25355
25710
|
const branch = first(vars, "hierBranch", NS.dgm)?.getAttribute("val");
|
|
25356
25711
|
if (branch === "std" || branch === "init" || branch === "l" || branch === "r" || branch === "hang")
|
|
25357
25712
|
values.hierarchyBranch = branch;
|
|
25358
|
-
for (const [
|
|
25713
|
+
for (const [tag2, key] of [
|
|
25359
25714
|
["chMax", "childMax"],
|
|
25360
25715
|
["chPref", "childPreferred"]
|
|
25361
25716
|
]) {
|
|
25362
|
-
const raw2 = first(vars,
|
|
25717
|
+
const raw2 = first(vars, tag2, NS.dgm)?.getAttribute("val");
|
|
25363
25718
|
if (raw2 && Number.isFinite(Number(raw2))) values[key] = Number(raw2);
|
|
25364
25719
|
}
|
|
25365
|
-
for (const [
|
|
25720
|
+
for (const [tag2, key] of [
|
|
25366
25721
|
["orgChart", "orgChart"],
|
|
25367
25722
|
["bulletEnabled", "bulletEnabled"]
|
|
25368
25723
|
]) {
|
|
25369
|
-
const raw2 = first(vars,
|
|
25724
|
+
const raw2 = first(vars, tag2, NS.dgm)?.getAttribute("val");
|
|
25370
25725
|
if (raw2) values[key] = raw2 === "1" || raw2 === "true";
|
|
25371
25726
|
}
|
|
25372
|
-
for (const [
|
|
25727
|
+
for (const [tag2, key] of [
|
|
25373
25728
|
["animLvl", "animationLevel"],
|
|
25374
25729
|
["animOne", "animateOne"],
|
|
25375
25730
|
["resizeHandles", "resizeHandles"]
|
|
25376
25731
|
]) {
|
|
25377
|
-
const raw2 = first(vars,
|
|
25732
|
+
const raw2 = first(vars, tag2, NS.dgm)?.getAttribute("val");
|
|
25378
25733
|
if (raw2) values[key] = raw2;
|
|
25379
25734
|
}
|
|
25380
25735
|
data.presLayoutVars = values;
|
|
@@ -25551,8 +25906,8 @@ function add2(parent, namespace, name, attrs3 = {}) {
|
|
|
25551
25906
|
parent.appendChild(child7);
|
|
25552
25907
|
return child7;
|
|
25553
25908
|
}
|
|
25554
|
-
function withDiagramDrawingRelationship(
|
|
25555
|
-
const doc = parseXml(
|
|
25909
|
+
function withDiagramDrawingRelationship(xml2, relationshipId) {
|
|
25910
|
+
const doc = parseXml(xml2);
|
|
25556
25911
|
const model = doc.documentElement;
|
|
25557
25912
|
let extension = descendants(model, "dataModelExt").find((node) => node.namespaceURI === DSP2);
|
|
25558
25913
|
if (!extension) {
|
|
@@ -25912,8 +26267,8 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
25912
26267
|
const part = paths[name];
|
|
25913
26268
|
if (!part) return void 0;
|
|
25914
26269
|
try {
|
|
25915
|
-
const
|
|
25916
|
-
if (
|
|
26270
|
+
const xml2 = await host.readText(part);
|
|
26271
|
+
if (xml2 === void 0) {
|
|
25917
26272
|
issues.push({
|
|
25918
26273
|
code: "DIAGRAM_PART_MISSING",
|
|
25919
26274
|
message: `Part ${part} is not in the package.`,
|
|
@@ -25921,11 +26276,11 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
25921
26276
|
});
|
|
25922
26277
|
return void 0;
|
|
25923
26278
|
}
|
|
25924
|
-
if (name === "layout") layoutSource.layoutXml =
|
|
25925
|
-
if (name === "data") layoutSource.dataXml =
|
|
25926
|
-
if (name === "colors") layoutSource.colorsXml =
|
|
25927
|
-
if (name === "quickStyle") layoutSource.quickStyleXml =
|
|
25928
|
-
return parse(
|
|
26279
|
+
if (name === "layout") layoutSource.layoutXml = xml2;
|
|
26280
|
+
if (name === "data") layoutSource.dataXml = xml2;
|
|
26281
|
+
if (name === "colors") layoutSource.colorsXml = xml2;
|
|
26282
|
+
if (name === "quickStyle") layoutSource.quickStyleXml = xml2;
|
|
26283
|
+
return parse(xml2, part);
|
|
25929
26284
|
} catch (error) {
|
|
25930
26285
|
issues.push({
|
|
25931
26286
|
code: "DIAGRAM_PART_UNREADABLE",
|
|
@@ -25935,11 +26290,11 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
25935
26290
|
return void 0;
|
|
25936
26291
|
}
|
|
25937
26292
|
};
|
|
25938
|
-
const data = await read("data", (
|
|
26293
|
+
const data = await read("data", (xml2, part) => parseDiagramDataModel(xml2, part));
|
|
25939
26294
|
if (data) issues.push(...data.issues);
|
|
25940
|
-
const layout2 = await read("layout", (
|
|
25941
|
-
const colors = await read("colors", (
|
|
25942
|
-
const quickStyle = await read("quickStyle", (
|
|
26295
|
+
const layout2 = await read("layout", (xml2) => parseDiagramLayoutSummary(xml2));
|
|
26296
|
+
const colors = await read("colors", (xml2) => parseDiagramColors(xml2));
|
|
26297
|
+
const quickStyle = await read("quickStyle", (xml2) => parseDiagramQuickStyle(xml2));
|
|
25943
26298
|
let drawingResolution;
|
|
25944
26299
|
try {
|
|
25945
26300
|
drawingResolution = await resolveDiagramDrawingPart(
|
|
@@ -25958,11 +26313,11 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
25958
26313
|
let generatedCache = false;
|
|
25959
26314
|
if (drawingResolution) {
|
|
25960
26315
|
paths.drawing = drawingResolution.path;
|
|
25961
|
-
drawing = await read("drawing", (
|
|
26316
|
+
drawing = await read("drawing", (xml2, part) => {
|
|
25962
26317
|
generatedCache = Boolean(
|
|
25963
|
-
data?.generatedCacheDigest && data.generatedCacheDigest === generatedDrawingDigest(
|
|
26318
|
+
data?.generatedCacheDigest && data.generatedCacheDigest === generatedDrawingDigest(xml2)
|
|
25964
26319
|
);
|
|
25965
|
-
return parseDiagramDrawing(
|
|
26320
|
+
return parseDiagramDrawing(xml2, part);
|
|
25966
26321
|
});
|
|
25967
26322
|
if (drawing) {
|
|
25968
26323
|
try {
|
|
@@ -26120,10 +26475,10 @@ async function resolveDiagramParts(diagram, readText) {
|
|
|
26120
26475
|
resolvePath: resolvePartPath,
|
|
26121
26476
|
readText,
|
|
26122
26477
|
readRelationshipEntries: async (relsPart) => {
|
|
26123
|
-
const
|
|
26124
|
-
if (!
|
|
26478
|
+
const xml2 = await readText(relsPart);
|
|
26479
|
+
if (!xml2) return void 0;
|
|
26125
26480
|
try {
|
|
26126
|
-
return [...parseRelationships(
|
|
26481
|
+
return [...parseRelationships(xml2).values()].map(({ id, type, target, mode }) => ({
|
|
26127
26482
|
id,
|
|
26128
26483
|
type,
|
|
26129
26484
|
target,
|
|
@@ -27413,8 +27768,8 @@ function chartPaletteSeriesColor(palette, i2, n2, scheme2) {
|
|
|
27413
27768
|
|
|
27414
27769
|
// chart/color-style.ts
|
|
27415
27770
|
var CHART_COLOR_STYLE_NS = "http://schemas.microsoft.com/office/drawing/2012/chartStyle";
|
|
27416
|
-
function chartColorStyleId(
|
|
27417
|
-
const root = parseXml(
|
|
27771
|
+
function chartColorStyleId(xml2) {
|
|
27772
|
+
const root = parseXml(xml2).documentElement;
|
|
27418
27773
|
if (root.localName !== "colorStyle" || root.namespaceURI !== CHART_COLOR_STYLE_NS)
|
|
27419
27774
|
return void 0;
|
|
27420
27775
|
const value = root.getAttribute("id");
|
|
@@ -27572,22 +27927,22 @@ function readChartManualLayoutValues(value) {
|
|
|
27572
27927
|
};
|
|
27573
27928
|
const target = enumeration("layoutTarget", ["inner", "outer"]);
|
|
27574
27929
|
if (target) result.layoutTarget = target;
|
|
27575
|
-
for (const [
|
|
27930
|
+
for (const [xml2, key] of [
|
|
27576
27931
|
["xMode", "xMode"],
|
|
27577
27932
|
["yMode", "yMode"],
|
|
27578
27933
|
["wMode", "widthMode"],
|
|
27579
27934
|
["hMode", "heightMode"]
|
|
27580
27935
|
]) {
|
|
27581
|
-
const mode = enumeration(
|
|
27936
|
+
const mode = enumeration(xml2, ["edge", "factor"]);
|
|
27582
27937
|
if (mode) result[key] = mode;
|
|
27583
27938
|
}
|
|
27584
|
-
for (const [
|
|
27939
|
+
for (const [xml2, key] of [
|
|
27585
27940
|
["x", "x"],
|
|
27586
27941
|
["y", "y"],
|
|
27587
27942
|
["w", "width"],
|
|
27588
27943
|
["h", "height"]
|
|
27589
27944
|
]) {
|
|
27590
|
-
const raw2 = value(
|
|
27945
|
+
const raw2 = value(xml2);
|
|
27591
27946
|
if (typeof raw2 !== "string" && typeof raw2 !== "number" || typeof raw2 === "string" && !raw2.trim())
|
|
27592
27947
|
continue;
|
|
27593
27948
|
const number2 = Number(raw2);
|
|
@@ -27838,12 +28193,12 @@ var CHART_ROOT_BINDINGS = /* @__PURE__ */ new Map([
|
|
|
27838
28193
|
["r", NS.r]
|
|
27839
28194
|
]);
|
|
27840
28195
|
var DECLARATION = / xmlns:([A-Za-z_][\w.-]*)="([^"]*)"/g;
|
|
27841
|
-
function stripDeclarations(
|
|
28196
|
+
function stripDeclarations(xml2, bindings) {
|
|
27842
28197
|
const conflicting = /* @__PURE__ */ new Set();
|
|
27843
|
-
for (const [, prefix2, uri] of
|
|
28198
|
+
for (const [, prefix2, uri] of xml2.matchAll(DECLARATION))
|
|
27844
28199
|
if (prefix2 !== void 0 && bindings.has(prefix2) && bindings.get(prefix2) !== uri)
|
|
27845
28200
|
conflicting.add(prefix2);
|
|
27846
|
-
return
|
|
28201
|
+
return xml2.replace(
|
|
27847
28202
|
DECLARATION,
|
|
27848
28203
|
(match, prefix2, uri) => bindings.get(prefix2) === uri && !conflicting.has(prefix2) ? "" : match
|
|
27849
28204
|
);
|
|
@@ -28197,7 +28552,7 @@ function valXml(local, value) {
|
|
|
28197
28552
|
return `<c:${local} val="${text2}"/>`;
|
|
28198
28553
|
}
|
|
28199
28554
|
var elementXml = (local, content, attributes2 = "") => content ? `<c:${local}${attributes2}>${content}</c:${local}>` : `<c:${local}${attributes2}/>`;
|
|
28200
|
-
var raw = (context,
|
|
28555
|
+
var raw = (context, xml2) => xml2 ? stripDeclarations(xml2, context.bindings) : "";
|
|
28201
28556
|
function sameValue(left, right) {
|
|
28202
28557
|
if (left === right) return true;
|
|
28203
28558
|
if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
|
|
@@ -28881,7 +29236,7 @@ function writeTextBody(body) {
|
|
|
28881
29236
|
|
|
28882
29237
|
// chart/write-shape.ts
|
|
28883
29238
|
var ROOT_DECLARATIONS = [...CHART_ROOT_BINDINGS].map(([prefix2, uri]) => ` xmlns:${prefix2}="${uri}"`).join("");
|
|
28884
|
-
var wrap = (local,
|
|
29239
|
+
var wrap = (local, xml2) => parseXml(`<c:${local}${ROOT_DECLARATIONS}>${xml2}</c:${local}>`, { label: "Chart" }).documentElement;
|
|
28885
29240
|
function chartFillXml(fill) {
|
|
28886
29241
|
return drawingFillXml(fill);
|
|
28887
29242
|
}
|
|
@@ -28891,8 +29246,8 @@ var firstOf = (parent, names) => elements(parent).find((node) => node.namespaceU
|
|
|
28891
29246
|
function patchShape(root, shape2, read) {
|
|
28892
29247
|
const doc = root.ownerDocument;
|
|
28893
29248
|
if (!sameValue(read.fill, shape2.fill)) {
|
|
28894
|
-
const
|
|
28895
|
-
if (
|
|
29249
|
+
const xml2 = shape2.fill && chartFillXml(shape2.fill);
|
|
29250
|
+
if (xml2) setDrawingFillXml(root, xml2);
|
|
28896
29251
|
else if (!shape2.fill)
|
|
28897
29252
|
for (let fill = fillElementOf(root); fill; fill = fillElementOf(root)) root.removeChild(fill);
|
|
28898
29253
|
}
|
|
@@ -28977,12 +29332,12 @@ function numberFormatXml(format) {
|
|
|
28977
29332
|
const linked = format.sourceLinked === void 0 ? "" : ` sourceLinked="${format.sourceLinked ? 1 : 0}"`;
|
|
28978
29333
|
return `<c:numFmt formatCode="${escapeAttribute(format.formatCode)}"${linked}/>`;
|
|
28979
29334
|
}
|
|
28980
|
-
function chartTextBodyFromXml(
|
|
28981
|
-
const body = parseDrawingTextBody(wrap("rich",
|
|
29335
|
+
function chartTextBodyFromXml(xml2) {
|
|
29336
|
+
const body = parseDrawingTextBody(wrap("rich", xml2)) ?? {
|
|
28982
29337
|
paragraphs: [],
|
|
28983
29338
|
text: ""
|
|
28984
29339
|
};
|
|
28985
|
-
body.sourceXml =
|
|
29340
|
+
body.sourceXml = xml2;
|
|
28986
29341
|
return body;
|
|
28987
29342
|
}
|
|
28988
29343
|
|
|
@@ -30066,9 +30421,9 @@ var CHART_EX_ROOT_DECLARATIONS = [
|
|
|
30066
30421
|
{ prefix: "a", uri: NS.a },
|
|
30067
30422
|
{ prefix: "r", uri: NS.r }
|
|
30068
30423
|
];
|
|
30069
|
-
function chartExWriteOptionsOf(
|
|
30070
|
-
const declarationBreak = /^<\?xml[^>]*\?>(\r\n|\n)?/.exec(
|
|
30071
|
-
return { declarationBreak, .../<[^<>]*\s\/>/.test(
|
|
30424
|
+
function chartExWriteOptionsOf(xml2) {
|
|
30425
|
+
const declarationBreak = /^<\?xml[^>]*\?>(\r\n|\n)?/.exec(xml2)?.[1] ?? "";
|
|
30426
|
+
return { declarationBreak, .../<[^<>]*\s\/>/.test(xml2) ? { emptyElementSpace: true } : {} };
|
|
30072
30427
|
}
|
|
30073
30428
|
function writeChartExSpace(space, options2 = {}) {
|
|
30074
30429
|
const bindings = /* @__PURE__ */ new Map();
|
|
@@ -30107,9 +30462,9 @@ function writeChartExSpace(space, options2 = {}) {
|
|
|
30107
30462
|
);
|
|
30108
30463
|
const userShapes = space.userShapesRelId === void 0 ? "" : `<c:userShapes${attributes([["r:id", space.userShapesRelId]])}/>`;
|
|
30109
30464
|
const body = chartDataXml(context, space.chartData) + chart + shapeXml(context, space.spPr) + textBodyXml2(context, space.txPr) + raw(context, space.colorMapOverrideXml) + raw(context, space.formatOverridesXml) + raw(context, space.printSettingsXml) + userShapes + raw(context, space.extLst);
|
|
30110
|
-
let
|
|
30111
|
-
if (options2.emptyElementSpace)
|
|
30112
|
-
return
|
|
30465
|
+
let xml2 = `${DECLARATION3}${options2.declarationBreak ?? ""}<cx:chartSpace${declarations}>${body}</cx:chartSpace>`;
|
|
30466
|
+
if (options2.emptyElementSpace) xml2 = xml2.replace(/\/>/g, " />");
|
|
30467
|
+
return xml2;
|
|
30113
30468
|
}
|
|
30114
30469
|
|
|
30115
30470
|
// chart/data-sheet.ts
|
|
@@ -31083,17 +31438,17 @@ async function syncWorksheetTables(zip, sheetPath, doc, writes, shared) {
|
|
|
31083
31438
|
for (const rel of rels.values()) {
|
|
31084
31439
|
if (rel.mode === "External" || !rel.type.endsWith("/table")) continue;
|
|
31085
31440
|
const path3 = resolvePartPath(sheetPath, rel.target);
|
|
31086
|
-
const
|
|
31087
|
-
if (!
|
|
31088
|
-
const tableDoc = parseXml(
|
|
31441
|
+
const xml2 = await zip.file(path3)?.async("string");
|
|
31442
|
+
if (!xml2) continue;
|
|
31443
|
+
const tableDoc = parseXml(xml2, { label: "Table" });
|
|
31089
31444
|
const table = tableDoc.documentElement;
|
|
31090
31445
|
if (table && syncTable(table, doc, values, shared)) zip.file(path3, buildXml(tableDoc));
|
|
31091
31446
|
}
|
|
31092
31447
|
}
|
|
31093
31448
|
async function sharedStringTexts(zip) {
|
|
31094
|
-
const
|
|
31095
|
-
if (!
|
|
31096
|
-
return childrenNamed(parseXml(
|
|
31449
|
+
const xml2 = await zip.file("xl/sharedStrings.xml")?.async("string");
|
|
31450
|
+
if (!xml2) return [];
|
|
31451
|
+
return childrenNamed(parseXml(xml2).documentElement ?? void 0, "si").map((item2) => {
|
|
31097
31452
|
const direct = childNamed(item2, "t");
|
|
31098
31453
|
if (direct) return direct.textContent ?? "";
|
|
31099
31454
|
return childrenNamed(item2, "r").map((run2) => childNamed(run2, "t")?.textContent ?? "").join("");
|
|
@@ -31171,8 +31526,8 @@ async function validateAtomicChartWorkbookWrites(zip, paths, writes, requireCurr
|
|
|
31171
31526
|
unsupported("rich worksheet strings require source-workbook editing");
|
|
31172
31527
|
if (requireCurrentValues) {
|
|
31173
31528
|
const current = text2 ? childNamed(text2, "t")?.textContent ?? void 0 : childNamed(cell2, "v")?.textContent ?? void 0;
|
|
31174
|
-
const
|
|
31175
|
-
if (!
|
|
31529
|
+
const equal2 = write.isNumeric ? current !== void 0 && Number(current) === Number(value) : current === value;
|
|
31530
|
+
if (!equal2) unsupported("the workbook and chart caches disagree");
|
|
31176
31531
|
}
|
|
31177
31532
|
if (write.isNumeric && !Number.isFinite(Number(value)))
|
|
31178
31533
|
unsupported("a numeric cache value is not finite");
|
|
@@ -31375,9 +31730,9 @@ async function appendChartWorkbookSheet(bytes, rowsForName, options2 = {}) {
|
|
|
31375
31730
|
// chart/ex/workbook.ts
|
|
31376
31731
|
async function appendChartExWorkbookData(bytes, before, after) {
|
|
31377
31732
|
const zip = await openEmbeddedPackage(bytes);
|
|
31378
|
-
const
|
|
31379
|
-
if (!
|
|
31380
|
-
const root = parseXml(
|
|
31733
|
+
const xml2 = await zip.file("xl/workbook.xml")?.async("string");
|
|
31734
|
+
if (!xml2) throw new Error("The chart workbook is missing.");
|
|
31735
|
+
const root = parseXml(xml2).documentElement;
|
|
31381
31736
|
const defined = first(root, "definedNames", NS.x);
|
|
31382
31737
|
const names = defined ? children(defined, "definedName", NS.x) : [];
|
|
31383
31738
|
const resolve = (name) => names.find(
|
|
@@ -33612,9 +33967,9 @@ function schemaPosition(node, end) {
|
|
|
33612
33967
|
}
|
|
33613
33968
|
return end === "mid" ? { kind: "percent", value: 50 } : { kind: end };
|
|
33614
33969
|
}
|
|
33615
|
-
function parseRegionValueColorPositions(
|
|
33616
|
-
if (!
|
|
33617
|
-
const root = parseXml(`<cx:root xmlns:cx="${NS.cx}">${
|
|
33970
|
+
function parseRegionValueColorPositions(xml2) {
|
|
33971
|
+
if (!xml2) return void 0;
|
|
33972
|
+
const root = parseXml(`<cx:root xmlns:cx="${NS.cx}">${xml2}</cx:root>`).documentElement;
|
|
33618
33973
|
const positions = first(root, "valueColorPositions", NS.cx);
|
|
33619
33974
|
if (!positions) return void 0;
|
|
33620
33975
|
const count = positions.getAttribute("count");
|
|
@@ -33640,8 +33995,8 @@ function parseRegionValueColorPositions(xml) {
|
|
|
33640
33995
|
// chart/region-map/value-colors.ts
|
|
33641
33996
|
function resolveRegionValueColors(options2, color) {
|
|
33642
33997
|
const result = { ...options2 };
|
|
33643
|
-
const
|
|
33644
|
-
const root = parseXml(
|
|
33998
|
+
const xml2 = `<cx:root xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">${options2.valueColorsXml ?? ""}${options2.valueColorPositionsXml ?? ""}</cx:root>`;
|
|
33999
|
+
const root = parseXml(xml2).documentElement;
|
|
33645
34000
|
if (options2.valueColorsXml) {
|
|
33646
34001
|
const colors = Array.from(root.getElementsByTagName("*")).flatMap((node) => {
|
|
33647
34002
|
const c2 = color(parseDrawingColorIn(node));
|
|
@@ -35381,14 +35736,14 @@ function inflateGeoCache(binary, maxOutputBytes = LIMIT) {
|
|
|
35381
35736
|
}
|
|
35382
35737
|
return new TextDecoder("utf-8", { fatal: true }).decode(out);
|
|
35383
35738
|
}
|
|
35384
|
-
function readGeographyCache(
|
|
35739
|
+
function readGeographyCache(xml2, pointLimit = 1e6) {
|
|
35385
35740
|
const result = { regions: [], issues: [] };
|
|
35386
|
-
if (!
|
|
35741
|
+
if (!xml2) return result;
|
|
35387
35742
|
try {
|
|
35388
35743
|
if (!Number.isSafeInteger(pointLimit) || pointLimit < 1 || pointLimit > 1e6)
|
|
35389
35744
|
throw new Error("Invalid geography point limit.");
|
|
35390
|
-
if (
|
|
35391
|
-
let root = parseXml(`<cx:root xmlns:cx="${CX}">${
|
|
35745
|
+
if (xml2.length > LIMIT) throw new Error("Geography cache input limit exceeded.");
|
|
35746
|
+
let root = parseXml(`<cx:root xmlns:cx="${CX}">${xml2}</cx:root>`).documentElement;
|
|
35392
35747
|
const binary = elements2(root, "binary")[0];
|
|
35393
35748
|
if (binary) root = parseXml(inflateGeoCache(binary.textContent ?? "")).documentElement;
|
|
35394
35749
|
let points3 = 0;
|
|
@@ -37750,15 +38105,15 @@ function parseChartGraphic(graphicData, docPr, rels, isAnchor) {
|
|
|
37750
38105
|
async function resolveChartPart(chart, readText) {
|
|
37751
38106
|
if (!chart.partName) return;
|
|
37752
38107
|
try {
|
|
37753
|
-
const
|
|
37754
|
-
if (
|
|
38108
|
+
const xml2 = await readText(chart.partName);
|
|
38109
|
+
if (xml2 === void 0) {
|
|
37755
38110
|
chart.issues.push({
|
|
37756
38111
|
code: "CHART_PART_MISSING",
|
|
37757
38112
|
message: `The chart part ${chart.partName} is not in the package.`
|
|
37758
38113
|
});
|
|
37759
38114
|
return;
|
|
37760
38115
|
}
|
|
37761
|
-
const root = parseXml(
|
|
38116
|
+
const root = parseXml(xml2, { label: "Chart part" }).documentElement;
|
|
37762
38117
|
const extended = chartExSummary(root);
|
|
37763
38118
|
if (extended) {
|
|
37764
38119
|
const parsed = parseChartExSpace(root);
|
|
@@ -38035,8 +38390,8 @@ function dropDeclarations(element4) {
|
|
|
38035
38390
|
for (const node of Array.from(element4.childNodes))
|
|
38036
38391
|
if (node.nodeType === 1) dropDeclarations(node);
|
|
38037
38392
|
}
|
|
38038
|
-
function importFragment(doc,
|
|
38039
|
-
const wrapper = parseXml(`<w xmlns:a="${A_NS2}">${
|
|
38393
|
+
function importFragment(doc, xml2) {
|
|
38394
|
+
const wrapper = parseXml(`<w xmlns:a="${A_NS2}">${xml2}</w>`).documentElement;
|
|
38040
38395
|
return Array.from(wrapper.childNodes).filter((node) => node.nodeType === 1).map((node) => {
|
|
38041
38396
|
const imported = doc.importNode(node, true);
|
|
38042
38397
|
dropDeclarations(imported);
|
|
@@ -38142,8 +38497,8 @@ function geometry(doc, spec) {
|
|
|
38142
38497
|
add3(avLst, attrs2(el2(doc, A_NS2, "a:gd"), { name, fmla: `val ${Math.round(value)}` }));
|
|
38143
38498
|
const nodes = spec.customGeometryXml ? importFragment(doc, spec.customGeometryXml) : [add3(prst, avLst)];
|
|
38144
38499
|
if (spec.fill) {
|
|
38145
|
-
const
|
|
38146
|
-
if (
|
|
38500
|
+
const xml2 = drawingFillXml(spec.fill);
|
|
38501
|
+
if (xml2) nodes.push(...importFragment(doc, xml2));
|
|
38147
38502
|
}
|
|
38148
38503
|
if (spec.line) nodes.push(...importFragment(doc, drawingLineXml(spec.line)));
|
|
38149
38504
|
return nodes;
|
|
@@ -38464,8 +38819,8 @@ var DocPrIdAllocator = class {
|
|
|
38464
38819
|
this.reserve(Number(node.getAttribute("id")));
|
|
38465
38820
|
}
|
|
38466
38821
|
/** Reserves every `docPr` id found in serialized XML. */
|
|
38467
|
-
reserveFromXml(
|
|
38468
|
-
for (const match of
|
|
38822
|
+
reserveFromXml(xml2) {
|
|
38823
|
+
for (const match of xml2.matchAll(DOC_PR_ID)) this.reserve(Number(match[1]));
|
|
38469
38824
|
}
|
|
38470
38825
|
/** Reserves the ids of every XML part in a package (document, headers, footers, notes...). */
|
|
38471
38826
|
async reserveFromPackage(zip) {
|
|
@@ -38865,9 +39220,9 @@ function insertedDiagramDataXml(diagram, createModelId = createOfficeGuid) {
|
|
|
38865
39220
|
}
|
|
38866
39221
|
async function dropDrawingPart(zip, relId, partName, ownerPart = HOST_PART) {
|
|
38867
39222
|
const relsPath = relationshipsPartFor2(ownerPart);
|
|
38868
|
-
const
|
|
38869
|
-
if (
|
|
38870
|
-
const document = parseXml(
|
|
39223
|
+
const xml2 = await zip.file(relsPath)?.async("string");
|
|
39224
|
+
if (xml2) {
|
|
39225
|
+
const document = parseXml(xml2);
|
|
38871
39226
|
const entry2 = elements(document.documentElement).find(
|
|
38872
39227
|
(node) => node.namespaceURI === NS.rels && node.getAttribute("Id") === relId && node.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
|
|
38873
39228
|
);
|
|
@@ -38903,8 +39258,8 @@ async function applyDiagramEdits(zip, blocks, baseBlocks, pendingMedia) {
|
|
|
38903
39258
|
if (!relaid && !reformatted && JSON.stringify(nodesOf(diagram)) === JSON.stringify(nodesOf(original)))
|
|
38904
39259
|
continue;
|
|
38905
39260
|
done.add(partName);
|
|
38906
|
-
const
|
|
38907
|
-
if (
|
|
39261
|
+
const xml2 = await zip.file(partName)?.async("string");
|
|
39262
|
+
if (xml2 === void 0) continue;
|
|
38908
39263
|
const drawing = original.parts.drawing;
|
|
38909
39264
|
const layoutPart = diagram.parts.layout?.partName;
|
|
38910
39265
|
const definition = layoutPart ? pendingMedia?.get(layoutPart) : void 0;
|
|
@@ -38913,16 +39268,16 @@ async function applyDiagramEdits(zip, blocks, baseBlocks, pendingMedia) {
|
|
|
38913
39268
|
"The new SmartArt layout definition is missing; the layout cannot be changed."
|
|
38914
39269
|
);
|
|
38915
39270
|
if (relaid && layoutPart && definition) zip.file(layoutPart, definition.bytes);
|
|
38916
|
-
for (const [key,
|
|
39271
|
+
for (const [key, xml3] of [
|
|
38917
39272
|
["colors", diagram.layoutSource?.colorsXml],
|
|
38918
39273
|
["quickStyle", diagram.layoutSource?.quickStyleXml]
|
|
38919
39274
|
]) {
|
|
38920
39275
|
const name = diagram.parts[key]?.partName;
|
|
38921
|
-
if (reformatted && name &&
|
|
39276
|
+
if (reformatted && name && xml3) zip.file(name, xml3);
|
|
38922
39277
|
}
|
|
38923
39278
|
zip.file(
|
|
38924
39279
|
partName,
|
|
38925
|
-
writeEditedDiagramData(
|
|
39280
|
+
writeEditedDiagramData(xml2, nodesOf(diagram), {
|
|
38926
39281
|
dropDrawingLink: true,
|
|
38927
39282
|
...diagram.colorsId ? { colorsId: diagram.colorsId } : {},
|
|
38928
39283
|
...diagram.quickStyleId ? { quickStyleId: diagram.quickStyleId } : {},
|
|
@@ -39228,8 +39583,8 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
39228
39583
|
}
|
|
39229
39584
|
|
|
39230
39585
|
// docx/revision-properties.ts
|
|
39231
|
-
function parsePropertiesSnapshot(
|
|
39232
|
-
const element4 = parseXml2(
|
|
39586
|
+
function parsePropertiesSnapshot(xml2, local) {
|
|
39587
|
+
const element4 = parseXml2(xml2).documentElement;
|
|
39233
39588
|
if (!named2(element4, local))
|
|
39234
39589
|
throw new Error(`A formatting revision snapshot must contain Word ${local} properties.`);
|
|
39235
39590
|
return element4;
|
|
@@ -39283,10 +39638,10 @@ function writeFormatRevision(doc, props, revision, local) {
|
|
|
39283
39638
|
const original = first2(props, `${local}Change`);
|
|
39284
39639
|
removeChildren2(props, `${local}Change`);
|
|
39285
39640
|
if (!revision) return;
|
|
39286
|
-
const
|
|
39287
|
-
if (!
|
|
39641
|
+
const xml2 = local === "rPr" ? revision.previousRunPropertiesXml : revision.previousParagraphPropertiesXml;
|
|
39642
|
+
if (!xml2)
|
|
39288
39643
|
throw new Error(`Cannot write a formatting revision without its prior ${local} snapshot.`);
|
|
39289
|
-
const previous = parsePropertiesSnapshot(
|
|
39644
|
+
const previous = parsePropertiesSnapshot(xml2, local);
|
|
39290
39645
|
const change = original ?? makeW(doc, `${local}Change`);
|
|
39291
39646
|
removeChildren2(change, local);
|
|
39292
39647
|
writeRevisionMetadata(change, revision);
|
|
@@ -39469,21 +39824,21 @@ function runPropertiesHaveUnknownContent(properties) {
|
|
|
39469
39824
|
}
|
|
39470
39825
|
|
|
39471
39826
|
// docx/restore-run-format.ts
|
|
39472
|
-
function parseRunPropertiesSnapshot(
|
|
39473
|
-
return parsePropertiesSnapshot(
|
|
39827
|
+
function parseRunPropertiesSnapshot(xml2) {
|
|
39828
|
+
return parsePropertiesSnapshot(xml2, "rPr");
|
|
39474
39829
|
}
|
|
39475
39830
|
function restoreRunFormatting(run2) {
|
|
39476
39831
|
const nested = run2.formatRevision;
|
|
39477
|
-
const
|
|
39478
|
-
if (!
|
|
39832
|
+
const xml2 = (nested ?? run2.revision)?.previousRunPropertiesXml;
|
|
39833
|
+
if (!xml2)
|
|
39479
39834
|
throw new Error(
|
|
39480
39835
|
"Cannot reject a formatting revision without its prior run-properties snapshot."
|
|
39481
39836
|
);
|
|
39482
|
-
const snapshot2 = parseRunPropertiesSnapshot(
|
|
39837
|
+
const snapshot2 = parseRunPropertiesSnapshot(xml2);
|
|
39483
39838
|
const previous = parseDirectRunProperties(snapshot2);
|
|
39484
39839
|
for (const key of DIRECT_RUN_PROPERTY_KEYS) delete run2[key];
|
|
39485
39840
|
Object.assign(run2, previous);
|
|
39486
|
-
run2.restoredRunPropertiesXml =
|
|
39841
|
+
run2.restoredRunPropertiesXml = xml2;
|
|
39487
39842
|
if (runPropertiesHaveUnknownContent(snapshot2)) run2.sourceRunPropertiesXml = buildXml(snapshot2);
|
|
39488
39843
|
else delete run2.sourceRunPropertiesXml;
|
|
39489
39844
|
if (nested) delete run2.formatRevision;
|
|
@@ -40093,7 +40448,7 @@ async function applyComments(zip, comments) {
|
|
|
40093
40448
|
parts.comments.xml && before === after ? parts.comments.xml : after
|
|
40094
40449
|
);
|
|
40095
40450
|
const metadata = patchCommentMetadata(parts, identities);
|
|
40096
|
-
for (const [path3,
|
|
40451
|
+
for (const [path3, xml2] of metadata) zip.file(path3, xml2);
|
|
40097
40452
|
for (const kind of Object.keys(COMMENT_PARTS)) {
|
|
40098
40453
|
const part = parts[kind];
|
|
40099
40454
|
if (kind !== "comments" && !metadata.has(part.path)) continue;
|
|
@@ -40229,8 +40584,8 @@ var BORDER_ORDER = ["top", "left", "bottom", "right", "insideH", "insideV"];
|
|
|
40229
40584
|
function setW2(element4, name, value) {
|
|
40230
40585
|
element4.setAttributeNS(WORD_NS, `w:${name}`, value);
|
|
40231
40586
|
}
|
|
40232
|
-
function buildBorders(doc, borders,
|
|
40233
|
-
const element4 = makeW(doc,
|
|
40587
|
+
function buildBorders(doc, borders, tag2) {
|
|
40588
|
+
const element4 = makeW(doc, tag2);
|
|
40234
40589
|
for (const side of BORDER_ORDER) {
|
|
40235
40590
|
const value = borders[side];
|
|
40236
40591
|
if (!value) continue;
|
|
@@ -40244,8 +40599,8 @@ function buildBorders(doc, borders, tag) {
|
|
|
40244
40599
|
}
|
|
40245
40600
|
return element4;
|
|
40246
40601
|
}
|
|
40247
|
-
function buildMargins(doc, margins,
|
|
40248
|
-
const element4 = makeW(doc,
|
|
40602
|
+
function buildMargins(doc, margins, tag2) {
|
|
40603
|
+
const element4 = makeW(doc, tag2);
|
|
40249
40604
|
for (const side of ["top", "left", "bottom", "right"]) {
|
|
40250
40605
|
const value = margins[side];
|
|
40251
40606
|
if (value === void 0) continue;
|
|
@@ -43586,8 +43941,8 @@ function parseNum(element4) {
|
|
|
43586
43941
|
...Object.keys(levelOverrides).length ? { levelOverrides } : {}
|
|
43587
43942
|
};
|
|
43588
43943
|
}
|
|
43589
|
-
function parseNumberingCatalog(
|
|
43590
|
-
const document = parseXml2(
|
|
43944
|
+
function parseNumberingCatalog(xml2, relationships) {
|
|
43945
|
+
const document = parseXml2(xml2);
|
|
43591
43946
|
const root = document.documentElement;
|
|
43592
43947
|
const abstractNums = dictionary();
|
|
43593
43948
|
const warnings = [];
|
|
@@ -44007,13 +44362,13 @@ async function createHeaderFooterParts(zip, model, base, docPrIds) {
|
|
|
44007
44362
|
const content = (model.sections ?? []).flatMap((section) => Object.values(section[kind] ?? {})).find((content2) => content2?.partName === partName);
|
|
44008
44363
|
const source2 = content?.sourcePartName && zip.file(content.sourcePartName);
|
|
44009
44364
|
if (source2) {
|
|
44010
|
-
const
|
|
44365
|
+
const xml2 = await source2.async("string");
|
|
44011
44366
|
zip.file(
|
|
44012
44367
|
partName,
|
|
44013
|
-
docPrIds ?
|
|
44368
|
+
docPrIds ? xml2.replace(
|
|
44014
44369
|
/(<(?:[\w.-]+:)?docPr\b[^>]*?\sid\s*=\s*["'])\d+(["'])/g,
|
|
44015
44370
|
(_match, start, end) => `${start}${docPrIds.next()}${end}`
|
|
44016
|
-
) :
|
|
44371
|
+
) : xml2
|
|
44017
44372
|
);
|
|
44018
44373
|
const rels = zip.file(relationshipsPartFor2(content.sourcePartName));
|
|
44019
44374
|
if (rels) zip.file(relationshipsPartFor2(partName), await rels.async("uint8array"));
|
|
@@ -44085,8 +44440,8 @@ var PARTS = {
|
|
|
44085
44440
|
var WORD_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
44086
44441
|
var RELATIONSHIPS2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
44087
44442
|
function emptyNotesPart(kind) {
|
|
44088
|
-
const
|
|
44089
|
-
const separator = (type, id, mark) => `<${
|
|
44443
|
+
const tag2 = `w:${kind}`;
|
|
44444
|
+
const separator = (type, id, mark) => `<${tag2} w:type="${type}" w:id="${id}"><w:p><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/></w:pPr><w:r><w:${mark}/></w:r></w:p></${tag2}>`;
|
|
44090
44445
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${kind}s xmlns:w="${WORD_NS3}">${separator("separator", "-1", "separator")}${separator("continuationSeparator", "0", "continuationSeparator")}</w:${kind}s>`;
|
|
44091
44446
|
}
|
|
44092
44447
|
async function createNotesPart(zip, kind) {
|
|
@@ -46088,13 +46443,13 @@ var SETTINGS_ORDER = [
|
|
|
46088
46443
|
"decimalSymbol",
|
|
46089
46444
|
"listSeparator"
|
|
46090
46445
|
];
|
|
46091
|
-
function parseTrackChangesSetting(
|
|
46092
|
-
const root = parseXml2(
|
|
46446
|
+
function parseTrackChangesSetting(xml2) {
|
|
46447
|
+
const root = parseXml2(xml2).documentElement;
|
|
46093
46448
|
if (!root) return false;
|
|
46094
46449
|
return onOffElement(children2(root, "trackRevisions")[0] ?? children2(root, "trackChanges")[0]) === true;
|
|
46095
46450
|
}
|
|
46096
|
-
function parseFormSettings(
|
|
46097
|
-
const root = parseXml2(
|
|
46451
|
+
function parseFormSettings(xml2) {
|
|
46452
|
+
const root = parseXml2(xml2).documentElement;
|
|
46098
46453
|
if (!root) return {};
|
|
46099
46454
|
const protect = children2(root, "documentProtection")[0];
|
|
46100
46455
|
const edit = protect && getW(protect, "edit");
|
|
@@ -46116,8 +46471,8 @@ function parseFormSettings(xml) {
|
|
|
46116
46471
|
}
|
|
46117
46472
|
};
|
|
46118
46473
|
}
|
|
46119
|
-
function parseReviewPreferences(
|
|
46120
|
-
const root = parseXml2(
|
|
46474
|
+
function parseReviewPreferences(xml2) {
|
|
46475
|
+
const root = parseXml2(xml2).documentElement;
|
|
46121
46476
|
return {
|
|
46122
46477
|
trackFormatting: onOffElement(children2(root, "doNotTrackFormatting")[0]) !== true,
|
|
46123
46478
|
trackMoves: onOffElement(children2(root, "doNotTrackMoves")[0]) !== true
|
|
@@ -46126,8 +46481,8 @@ function parseReviewPreferences(xml) {
|
|
|
46126
46481
|
async function applySettingsFlag(zip, name, enabled2) {
|
|
46127
46482
|
const file = zip.file(SETTINGS_PATH);
|
|
46128
46483
|
if (!file && !enabled2) return;
|
|
46129
|
-
const
|
|
46130
|
-
const doc = parseXml2(
|
|
46484
|
+
const xml2 = await file?.async("string") ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS}"></w:settings>`;
|
|
46485
|
+
const doc = parseXml2(xml2);
|
|
46131
46486
|
const root = doc.documentElement;
|
|
46132
46487
|
for (const element4 of children2(root, name)) root.removeChild(element4);
|
|
46133
46488
|
if (enabled2) {
|
|
@@ -47198,9 +47553,9 @@ function numberRevisionIds(model, reservedMax = -1) {
|
|
|
47198
47553
|
});
|
|
47199
47554
|
return mapDocumentParagraphs(model, paragraph2);
|
|
47200
47555
|
}
|
|
47201
|
-
function maxWordId(
|
|
47556
|
+
function maxWordId(xml2) {
|
|
47202
47557
|
let max = -1;
|
|
47203
|
-
for (const match of
|
|
47558
|
+
for (const match of xml2?.matchAll(/\bw:id="(\d{1,9})"/g) ?? [])
|
|
47204
47559
|
max = Math.max(max, Number(match[1]));
|
|
47205
47560
|
return max;
|
|
47206
47561
|
}
|
|
@@ -48048,12 +48403,12 @@ function parseRawSections(body, blocks) {
|
|
|
48048
48403
|
|
|
48049
48404
|
// docx/notes.ts
|
|
48050
48405
|
var skippedTypes = /* @__PURE__ */ new Set(["separator", "continuationSeparator"]);
|
|
48051
|
-
function parseNotesPart(
|
|
48052
|
-
const document = parseXml2(
|
|
48053
|
-
const
|
|
48406
|
+
function parseNotesPart(xml2, kind, parseBlocks) {
|
|
48407
|
+
const document = parseXml2(xml2);
|
|
48408
|
+
const tag2 = kind === "footnote" ? "footnote" : "endnote";
|
|
48054
48409
|
const idPrefix = kind === "footnote" ? "fn" : "en";
|
|
48055
48410
|
const notes = [];
|
|
48056
|
-
for (const element4 of children2(document.documentElement,
|
|
48411
|
+
for (const element4 of children2(document.documentElement, tag2)) {
|
|
48057
48412
|
const type = getW(element4, "type");
|
|
48058
48413
|
if (type && skippedTypes.has(type)) continue;
|
|
48059
48414
|
const id = getW(element4, "id");
|
|
@@ -48062,8 +48417,8 @@ function parseNotesPart(xml, kind, parseBlocks) {
|
|
|
48062
48417
|
}
|
|
48063
48418
|
return notes;
|
|
48064
48419
|
}
|
|
48065
|
-
function parseFootnoteSeparators(
|
|
48066
|
-
const root = parseXml2(
|
|
48420
|
+
function parseFootnoteSeparators(xml2, parseBlocks) {
|
|
48421
|
+
const root = parseXml2(xml2).documentElement;
|
|
48067
48422
|
const result = {};
|
|
48068
48423
|
for (const element4 of children2(root, "footnote")) {
|
|
48069
48424
|
const type = getW(element4, "type");
|
|
@@ -48168,9 +48523,9 @@ var FIELD_MARKUP = /<w:(?:fldSimple|instrText|fldChar)\b/;
|
|
|
48168
48523
|
async function readPart(zip, path3) {
|
|
48169
48524
|
return zip.file(path3)?.async("string");
|
|
48170
48525
|
}
|
|
48171
|
-
function parseSettings(
|
|
48172
|
-
if (!
|
|
48173
|
-
const root = parseXml2(
|
|
48526
|
+
function parseSettings(xml2) {
|
|
48527
|
+
if (!xml2) return { evenAndOddHeaders: false, autoHyphenation: false };
|
|
48528
|
+
const root = parseXml2(xml2).documentElement;
|
|
48174
48529
|
const compatibility = (first2(root, "compat") ? children2(first2(root, "compat"), "compatSetting") : []).find(
|
|
48175
48530
|
(setting) => getW(setting, "name") === "compatibilityMode" && getW(setting, "uri") === "http://schemas.microsoft.com/office/word"
|
|
48176
48531
|
);
|
|
@@ -48203,11 +48558,11 @@ async function resolveSlots(zip, relationships, refs, cache, fieldMarkup, drawin
|
|
|
48203
48558
|
const path3 = resolvePartPath("word/document.xml", relationship2.target);
|
|
48204
48559
|
let blocks = cache.get(path3);
|
|
48205
48560
|
if (!blocks) {
|
|
48206
|
-
const
|
|
48207
|
-
if (
|
|
48208
|
-
if (FIELD_MARKUP.test(
|
|
48561
|
+
const xml2 = await readPart(zip, path3);
|
|
48562
|
+
if (xml2 === void 0) continue;
|
|
48563
|
+
if (FIELD_MARKUP.test(xml2)) fieldMarkup.seen = true;
|
|
48209
48564
|
const context = await partContext(zip, path3, drawings);
|
|
48210
|
-
const root = parseXml2(
|
|
48565
|
+
const root = parseXml2(xml2).documentElement;
|
|
48211
48566
|
blocks = withParseWarnings(
|
|
48212
48567
|
sink2,
|
|
48213
48568
|
() => parseBlocksFromContainer(root, `${path3.replace(/[^a-z0-9]+/gi, "")}-`, context)
|
|
@@ -48282,9 +48637,9 @@ async function parseDocumentParts(zip, body, blocks, drawings) {
|
|
|
48282
48637
|
|
|
48283
48638
|
// docx/glossary.ts
|
|
48284
48639
|
var GLOSSARY_DOCUMENT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
|
|
48285
|
-
function parseGlossaryTexts(
|
|
48640
|
+
function parseGlossaryTexts(xml2) {
|
|
48286
48641
|
const texts = /* @__PURE__ */ new Map();
|
|
48287
|
-
const parts = first2(parseXml2(
|
|
48642
|
+
const parts = first2(parseXml2(xml2).documentElement, "docParts");
|
|
48288
48643
|
for (const part of parts ? children2(parts, "docPart") : []) {
|
|
48289
48644
|
const name = getW(first2(first2(part, "docPartPr"), "name"), "val");
|
|
48290
48645
|
const paragraph2 = first2(first2(part, "docPartBody"), "p");
|
|
@@ -48878,12 +49233,12 @@ var PARAGRAPH_FORMAT_KEYS = [
|
|
|
48878
49233
|
"shadingFill"
|
|
48879
49234
|
];
|
|
48880
49235
|
function restoreParagraphFormatting(paragraph2) {
|
|
48881
|
-
const
|
|
48882
|
-
if (!
|
|
49236
|
+
const xml2 = paragraph2.formatRevision?.previousParagraphPropertiesXml;
|
|
49237
|
+
if (!xml2)
|
|
48883
49238
|
throw new Error(
|
|
48884
49239
|
"Cannot reject a paragraph formatting revision without its prior properties snapshot."
|
|
48885
49240
|
);
|
|
48886
|
-
const properties = parsePropertiesSnapshot(
|
|
49241
|
+
const properties = parsePropertiesSnapshot(xml2, "pPr");
|
|
48887
49242
|
if (paragraph2.sourceParagraphPropertiesXml) {
|
|
48888
49243
|
const current = parsePropertiesSnapshot(paragraph2.sourceParagraphPropertiesXml, "pPr");
|
|
48889
49244
|
for (const name of ["rPr", "sectPr"]) {
|
|
@@ -49602,9 +49957,9 @@ function siteIds(sites) {
|
|
|
49602
49957
|
return uniqueName(name) ? `field:${name}` : `field#${legacy.indexOf(site) + 1}`;
|
|
49603
49958
|
}
|
|
49604
49959
|
const id = ownId(site);
|
|
49605
|
-
const
|
|
49960
|
+
const tag2 = site.control.tag;
|
|
49606
49961
|
if (uniqueId(id)) return `control:${id}`;
|
|
49607
|
-
if (uniqueTag(
|
|
49962
|
+
if (uniqueTag(tag2)) return `tag:${tag2}`;
|
|
49608
49963
|
return `control#${controls.indexOf(site) + 1}`;
|
|
49609
49964
|
});
|
|
49610
49965
|
}
|
|
@@ -50823,4 +51178,4 @@ function shapeSvg(spec, widthPx, heightPx, theme) {
|
|
|
50823
51178
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${round2(w)}" height="${round2(h2)}" viewBox="0 0 ${round2(w)} ${round2(h2)}" style="overflow:visible" role="img" aria-label="${label}"><g${transform7 ? ` transform="${escapeXml(transform7)}"` : ""}>${paths}${text2}</g></svg>`;
|
|
50824
51179
|
}
|
|
50825
51180
|
|
|
50826
|
-
export { CHART_GRAPHIC_URI, CHART_NOTICE, DEFAULT_DRAWN_SHAPE, DEFAULT_SHAPE_FILL, DEFAULT_SHAPE_LINE, DEFAULT_SHAPE_LINE_EMU, DEFAULT_STYLES_XML, DEFAULT_TABLE_BORDERS, DEFAULT_TOC_INSTRUCTION, DIAGRAM_GRAPHIC_URI, DocxModelValidationError, EMPTY_FIGURES_TEXT, EMPTY_TOC_TEXT, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, LIGATURE_VALUES, NEW_CHART_SIZE_PX, PAGE_SIZES, PAGE_SIZE_OPTIONS, PIXELS_PER_INCH, PROPERTY_FIELDS, SHAPE_PALETTE, SHAPE_PALETTE_NAMES, ST_AlgClass, ST_AlgType, ST_AnnotationVMerge, ST_Border, ST_BrClear, ST_BrType, ST_CalendarType, ST_CaptionPos, ST_ChapterSep, ST_CharacterSpacing, ST_CombineBrackets, ST_ConformanceClass, ST_CryptProv, ST_Direction, ST_DisplacedByCustomXml, ST_DocGrid, ST_DocPartBehavior, ST_DocPartGallery, ST_DocPartType, ST_DocProtect, ST_DropCap, ST_EdGrp, ST_EdnPos, ST_Em, ST_FFTextType, ST_FldCharType, ST_FontFamily, ST_FrameLayout, ST_FrameScrollbar, ST_FtnEdn, ST_FtnPos, ST_HAnchor, ST_HdrFtr, ST_HeightRule, ST_HexColorAuto, ST_HighlightColor, ST_Hint, ST_InfoTextType, ST_Jc, ST_JcTable, ST_LevelSuffix, ST_LineNumberRestart, ST_LineSpacingRule, ST_Lock, ST_MailMergeDest, ST_MailMergeDocType, ST_MailMergeOdsoFMDFieldType, ST_MailMergeSourceType, ST_Merge, ST_MultiLevelType, ST_NumberFormat, ST_ObjectDrawAspect, ST_ObjectUpdateMode, ST_OnOff1, ST_PTabAlignment, ST_PTabLeader, ST_PTabRelativeTo, ST_PageBorderDisplay, ST_PageBorderOffset, ST_PageBorderZOrder, ST_PageOrientation, ST_Pitch, ST_Proof, ST_ProofErr, ST_RelFromH, ST_RelFromV, ST_RestartNumber, ST_RubyAlign, ST_SchemeColorVal, ST_SdtDateMappingType, ST_SectionMark, ST_Shd, ST_StyleSort, ST_StyleType, ST_TabJc, ST_TabTlc, ST_TargetScreenSz, ST_TblLayoutType, ST_TblOverlap, ST_TblStyleOverrideType, ST_TblWidth, ST_TextAlignment, ST_TextDirection, ST_TextEffect, ST_TextboxTightWrap, ST_Theme, ST_ThemeColor, ST_TrueFalse, ST_TrueFalseBlank, ST_Underline, ST_VAnchor, ST_VerticalAlignRun, ST_VerticalJc, ST_View, ST_WmlColorSchemeIndex, ST_Wrap, ST_XAlign, ST_YAlign, ST_Zoom, TWIPS_PER_INCH, TWIPS_PER_POINT, WORD, WORD_HIGHLIGHT_TOKENS, WORD_UNDERLINE_TOKENS, acceptAllRevisions, acceptRevision, afterEdit, alignFromJustification, applyDocxChartDataSheetEdits, applyDocxChartExDataSheetEdits, applyPageSetup, applyThemeShade, applyThemeTint, assertValidDocumentModel, bodyStyleRefResult, buildTableOfContents, canDeleteControl, canEditControlContent, captionParagraphs, cellSourceBlocks, changeColumnGap, changeColumnWidth, changeDocxDiagramLayout, chartsIn, checkboxState, columnPreset, columnTextWidth, computeListLabels, controlDate, createDocument, createDocxDiagram, createListDefinition, createPictureBulletList, createProtectionPassword, dateFieldResult, datePicture, defaultPlaceholder, defaultStyleCatalogs, diagramColorTheme, diagramsIn, displayListLabel, documentDrawingBlocks, documentStats, docxChartDataSheet, docxChartExDataSheet, docxChartPaint, editDocxChart, editDocxChartEx, editDocxDiagram, eighthPoints, eighthPointsFromPoints, eighthPointsToPoints, emu, emuFromPixels, emuToPixels, enforceProtection, ensureListDefinition, enumValue, equalColumnDraft, fieldName, fieldResultRun, fillFormFields, findRevision, findTableOfContents, formCheckboxChecked, formDropDownIndex, formFieldDisplayText, formFieldOfRun, formatDocxDiagram, formatListNumber, formatNoteNumber, formatWordDate, fullDateOf, halfPoints, halfPointsFromPoints, halfPointsToPoints, headingLevel, headingListLevels, insertedDiagramPartNames, isCaptionOf, isDirectionalPreset, isDocxChartEditable, isDocxChartExEditable, isFieldLocked, isHeadingListKind, isLigatures, isLinePreset, isNewDocxChart, isRunHiddenForReview, isStAlgClass, isStAlgType, isStAnnotationVMerge, isStBorder, isStBrClear, isStBrType, isStCalendarType, isStCaptionPos, isStChapterSep, isStCharacterSpacing, isStCombineBrackets, isStConformanceClass, isStCryptProv, isStDirection, isStDisplacedByCustomXml, isStDocGrid, isStDocPartBehavior, isStDocPartGallery, isStDocPartType, isStDocProtect, isStDropCap, isStEdGrp, isStEdnPos, isStEm, isStFFTextType, isStFldCharType, isStFontFamily, isStFrameLayout, isStFrameScrollbar, isStFtnEdn, isStFtnPos, isStHAnchor, isStHdrFtr, isStHeightRule, isStHexColorAuto, isStHighlightColor, isStHint, isStInfoTextType, isStJc, isStJcTable, isStLevelSuffix, isStLineNumberRestart, isStLineSpacingRule, isStLock, isStMailMergeDest, isStMailMergeDocType, isStMailMergeOdsoFMDFieldType, isStMailMergeSourceType, isStMerge, isStMultiLevelType, isStNumberFormat, isStObjectDrawAspect, isStObjectUpdateMode, isStOnOff1, isStPTabAlignment, isStPTabLeader, isStPTabRelativeTo, isStPageBorderDisplay, isStPageBorderOffset, isStPageBorderZOrder, isStPageOrientation, isStPitch, isStProof, isStProofErr, isStRelFromH, isStRelFromV, isStRestartNumber, isStRubyAlign, isStSchemeColorVal, isStSdtDateMappingType, isStSectionMark, isStShd, isStStyleSort, isStStyleType, isStTabJc, isStTabTlc, isStTargetScreenSz, isStTblLayoutType, isStTblOverlap, isStTblStyleOverrideType, isStTblWidth, isStTextAlignment, isStTextDirection, isStTextEffect, isStTextboxTightWrap, isStTheme, isStThemeColor, isStTrueFalse, isStTrueFalseBlank, isStUnderline, isStVAnchor, isStVerticalAlignRun, isStVerticalJc, isStView, isStWmlColorSchemeIndex, isStWrap, isStXAlign, isStYAlign, isStZoom, isThemeColorToken, isValidLanguageTag, isWordHighlightToken, isWordUnderlineStyle, lineSpacingLabel, lineSpacingOptions, lineSpacingValue, linkStylesToList, listFormFields, listRevisions, loadDocx, newChartImage, newDocxChart, newShape, numberNotesInOrder, onOffAttribute, onOffElement, pageSizeOf, paragraphTwipsFromAttrs, parseColorSchemeMapping, parseContentControl, parseEighthPoints, parseHalfPoints, parseHexColor, parseInteger, parseJustification, parseLineSpacingValue, parseNumberingCatalog, parseOnOff, parseParagraphStyleCatalog, parseRgbColor, parseRunStyleCatalog, parseSignedHalfPoints, parseSignedTwips, parseStyleReference, parseTableStyleCatalog, parseTextScale, parseTheme2 as parseTheme, parseTintShade, parseTwips, parseUnsignedInteger, pictureBulletSizePt, placeholderTextOf, plainText2 as plainText, presetOf, readColumnDraft, readPageSetup, refreshStyleRefFields, rejectAllRevisions, rejectRevision, removedByEdit, reportParseWarning, resolveCellVisuals, resolveDiagramColor, resolveNumberingLevel, resolveParagraphFormatting, resolveParagraphNumbering, resolveRunFormatting, resolveStyleNumbering, resolveTableStyleFormatting, resolveThemeColorReference, resolveThemeColorToken, reviewDocumentFormatting, reviewFormattingWarnings, reviewParagraphFormatting, reviewRunFormatting, roundEighthPoints, roundEmu, roundHalfPoints, roundSignedTwips, roundTwips, saveDocx, sectionLayoutJson, sectionsFromLayout, sectionsOf, selectFormDropDownEntry, selectListItem, setColumns, setControlDate, setFormCheckbox, setLineNumbering, setListStartOverride, setMargins, setOrientation, setPageNumbering, setPageSize, setTitlePage, setVerticalAlign, shapeAppearance, shapeColorCss, shapeSvg, shapeTextColor, signedTwips, signedTwipsAttr, signedTwipsFromPixels, signedTwipsFromPoints, styleRefSource, tableOfFiguresInstruction, themeCatalogColorScheme, tocBookmarks, tocCaptionLabel, tocEntries, tocHyperlinks, tocLevels, toggleCheckbox, transformCase, treeOrderDiagramNodes, twips, twipsAttr, twipsFromInches, twipsFromPixels, twipsFromPoints, twipsToInches, twipsToPixels, twipsToPoints, unequalColumnPreset, universalMeasureToTwips, updateTableOfContents, validColumnDraft, validateDocumentModel, validatePageSetup, verifyProtectionPassword, withDiagramNodes, withFieldCodeFormatting, withParseWarnings, withSection, withTocBookmarks, withValue };
|
|
51181
|
+
export { CHART_GRAPHIC_URI, CHART_NOTICE, DEFAULT_DRAWN_SHAPE, DEFAULT_SHAPE_FILL, DEFAULT_SHAPE_LINE, DEFAULT_SHAPE_LINE_EMU, DEFAULT_STYLES_XML, DEFAULT_TABLE_BORDERS, DEFAULT_TOC_INSTRUCTION, DIAGRAM_GRAPHIC_URI, DocxModelValidationError, EMPTY_FIGURES_TEXT, EMPTY_TOC_TEXT, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, LIGATURE_VALUES, NEW_CHART_SIZE_PX, PAGE_SIZES, PAGE_SIZE_OPTIONS, PIXELS_PER_INCH, PROPERTY_FIELDS, SHAPE_PALETTE, SHAPE_PALETTE_NAMES, ST_AlgClass, ST_AlgType, ST_AnnotationVMerge, ST_Border, ST_BrClear, ST_BrType, ST_CalendarType, ST_CaptionPos, ST_ChapterSep, ST_CharacterSpacing, ST_CombineBrackets, ST_ConformanceClass, ST_CryptProv, ST_Direction, ST_DisplacedByCustomXml, ST_DocGrid, ST_DocPartBehavior, ST_DocPartGallery, ST_DocPartType, ST_DocProtect, ST_DropCap, ST_EdGrp, ST_EdnPos, ST_Em, ST_FFTextType, ST_FldCharType, ST_FontFamily, ST_FrameLayout, ST_FrameScrollbar, ST_FtnEdn, ST_FtnPos, ST_HAnchor, ST_HdrFtr, ST_HeightRule, ST_HexColorAuto, ST_HighlightColor, ST_Hint, ST_InfoTextType, ST_Jc, ST_JcTable, ST_LevelSuffix, ST_LineNumberRestart, ST_LineSpacingRule, ST_Lock, ST_MailMergeDest, ST_MailMergeDocType, ST_MailMergeOdsoFMDFieldType, ST_MailMergeSourceType, ST_Merge, ST_MultiLevelType, ST_NumberFormat, ST_ObjectDrawAspect, ST_ObjectUpdateMode, ST_OnOff1, ST_PTabAlignment, ST_PTabLeader, ST_PTabRelativeTo, ST_PageBorderDisplay, ST_PageBorderOffset, ST_PageBorderZOrder, ST_PageOrientation, ST_Pitch, ST_Proof, ST_ProofErr, ST_RelFromH, ST_RelFromV, ST_RestartNumber, ST_RubyAlign, ST_SchemeColorVal, ST_SdtDateMappingType, ST_SectionMark, ST_Shd, ST_StyleSort, ST_StyleType, ST_TabJc, ST_TabTlc, ST_TargetScreenSz, ST_TblLayoutType, ST_TblOverlap, ST_TblStyleOverrideType, ST_TblWidth, ST_TextAlignment, ST_TextDirection, ST_TextEffect, ST_TextboxTightWrap, ST_Theme, ST_ThemeColor, ST_TrueFalse, ST_TrueFalseBlank, ST_Underline, ST_VAnchor, ST_VerticalAlignRun, ST_VerticalJc, ST_View, ST_WmlColorSchemeIndex, ST_Wrap, ST_XAlign, ST_YAlign, ST_Zoom, TWIPS_PER_INCH, TWIPS_PER_POINT, WORD, WORD_HIGHLIGHT_TOKENS, WORD_UNDERLINE_TOKENS, acceptAllRevisions, acceptRevision, afterEdit, alignFromJustification, applyDocxChartDataSheetEdits, applyDocxChartExDataSheetEdits, applyPageSetup, applyThemeShade, applyThemeTint, assertValidDocumentModel, bodyStyleRefResult, buildTableOfContents, canDeleteControl, canEditControlContent, captionParagraphs, cellSourceBlocks, changeColumnGap, changeColumnWidth, changeDocxDiagramLayout, chartsIn, checkboxState, columnPreset, columnTextWidth, computeListLabels, controlDate, createDocument, createDocxDiagram, createListDefinition, createPictureBulletList, createProtectionPassword, dateFieldResult, datePicture, defaultPlaceholder, defaultStyleCatalogs, diagramColorTheme, diagramsIn, displayListLabel, documentDrawingBlocks, documentStats, docxChartDataSheet, docxChartExDataSheet, docxChartPaint, editDocxChart, editDocxChartEx, editDocxDiagram, eighthPoints, eighthPointsFromPoints, eighthPointsToPoints, emu, emuFromPixels, emuToPixels, enforceProtection, ensureListDefinition, enumValue, equalColumnDraft, fieldName, fieldResultRun, fillFormFields, findRevision, findTableOfContents, formCheckboxChecked, formDropDownIndex, formFieldDisplayText, formFieldOfRun, formatDocxDiagram, formatListNumber, formatNoteNumber, formatWordDate, fullDateOf, halfPoints, halfPointsFromPoints, halfPointsToPoints, headingLevel, headingListLevels, insertedDiagramPartNames, isCaptionOf, isDirectionalPreset, isDocxChartEditable, isDocxChartExEditable, isFieldLocked, isHeadingListKind, isLigatures, isLinePreset, isNewDocxChart, isRunHiddenForReview, isStAlgClass, isStAlgType, isStAnnotationVMerge, isStBorder, isStBrClear, isStBrType, isStCalendarType, isStCaptionPos, isStChapterSep, isStCharacterSpacing, isStCombineBrackets, isStConformanceClass, isStCryptProv, isStDirection, isStDisplacedByCustomXml, isStDocGrid, isStDocPartBehavior, isStDocPartGallery, isStDocPartType, isStDocProtect, isStDropCap, isStEdGrp, isStEdnPos, isStEm, isStFFTextType, isStFldCharType, isStFontFamily, isStFrameLayout, isStFrameScrollbar, isStFtnEdn, isStFtnPos, isStHAnchor, isStHdrFtr, isStHeightRule, isStHexColorAuto, isStHighlightColor, isStHint, isStInfoTextType, isStJc, isStJcTable, isStLevelSuffix, isStLineNumberRestart, isStLineSpacingRule, isStLock, isStMailMergeDest, isStMailMergeDocType, isStMailMergeOdsoFMDFieldType, isStMailMergeSourceType, isStMerge, isStMultiLevelType, isStNumberFormat, isStObjectDrawAspect, isStObjectUpdateMode, isStOnOff1, isStPTabAlignment, isStPTabLeader, isStPTabRelativeTo, isStPageBorderDisplay, isStPageBorderOffset, isStPageBorderZOrder, isStPageOrientation, isStPitch, isStProof, isStProofErr, isStRelFromH, isStRelFromV, isStRestartNumber, isStRubyAlign, isStSchemeColorVal, isStSdtDateMappingType, isStSectionMark, isStShd, isStStyleSort, isStStyleType, isStTabJc, isStTabTlc, isStTargetScreenSz, isStTblLayoutType, isStTblOverlap, isStTblStyleOverrideType, isStTblWidth, isStTextAlignment, isStTextDirection, isStTextEffect, isStTextboxTightWrap, isStTheme, isStThemeColor, isStTrueFalse, isStTrueFalseBlank, isStUnderline, isStVAnchor, isStVerticalAlignRun, isStVerticalJc, isStView, isStWmlColorSchemeIndex, isStWrap, isStXAlign, isStYAlign, isStZoom, isThemeColorToken, isValidLanguageTag, isWordHighlightToken, isWordUnderlineStyle, lineSpacingLabel, lineSpacingOptions, lineSpacingValue, linkStylesToList, listFormFields, listRevisions, loadDocx, mergeDocxSnapshots, newChartImage, newDocxChart, newShape, numberNotesInOrder, onOffAttribute, onOffElement, pageSizeOf, paragraphTwipsFromAttrs, parseColorSchemeMapping, parseContentControl, parseEighthPoints, parseHalfPoints, parseHexColor, parseInteger, parseJustification, parseLineSpacingValue, parseNumberingCatalog, parseOnOff, parseParagraphStyleCatalog, parseRgbColor, parseRunStyleCatalog, parseSignedHalfPoints, parseSignedTwips, parseStyleReference, parseTableStyleCatalog, parseTextScale, parseTheme2 as parseTheme, parseTintShade, parseTwips, parseUnsignedInteger, pictureBulletSizePt, placeholderTextOf, plainText2 as plainText, presetOf, readColumnDraft, readPageSetup, refreshStyleRefFields, rejectAllRevisions, rejectRevision, removedByEdit, reportParseWarning, resolveCellVisuals, resolveDiagramColor, resolveNumberingLevel, resolveParagraphFormatting, resolveParagraphNumbering, resolveRunFormatting, resolveStyleNumbering, resolveTableStyleFormatting, resolveThemeColorReference, resolveThemeColorToken, reviewDocumentFormatting, reviewFormattingWarnings, reviewParagraphFormatting, reviewRunFormatting, roundEighthPoints, roundEmu, roundHalfPoints, roundSignedTwips, roundTwips, saveDocx, sectionLayoutJson, sectionsFromLayout, sectionsOf, selectFormDropDownEntry, selectListItem, setColumns, setControlDate, setFormCheckbox, setLineNumbering, setListStartOverride, setMargins, setOrientation, setPageNumbering, setPageSize, setTitlePage, setVerticalAlign, shapeAppearance, shapeColorCss, shapeSvg, shapeTextColor, signedTwips, signedTwipsAttr, signedTwipsFromPixels, signedTwipsFromPoints, styleRefSource, tableOfFiguresInstruction, themeCatalogColorScheme, tocBookmarks, tocCaptionLabel, tocEntries, tocHyperlinks, tocLevels, toggleCheckbox, transformCase, treeOrderDiagramNodes, twips, twipsAttr, twipsFromInches, twipsFromPixels, twipsFromPoints, twipsToInches, twipsToPixels, twipsToPoints, unequalColumnPreset, universalMeasureToTwips, updateTableOfContents, validColumnDraft, validateDocumentModel, validatePageSetup, verifyProtectionPassword, withDiagramNodes, withFieldCodeFormatting, withParseWarnings, withSection, withTocBookmarks, withValue };
|