ooxml-core 1.19.2 → 1.21.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 +47 -1
- package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-DNSXWTQV.cjs} +3 -3
- package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FSKKPZZC.mjs} +3 -3
- package/dist/PptxHandler-H7MEWJJJ.mjs +4 -0
- package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-7TSENZTX.mjs} +2 -2
- package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-A5NI35VN.cjs} +5 -5
- package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-RIJWQSEU.mjs} +3 -3
- package/dist/automation/docx-forms.d.ts +26 -0
- package/dist/automation/docx-forms.d.ts.map +1 -0
- package/dist/automation/index.cjs +6280 -2506
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +6277 -2507
- package/dist/automation/xlsx-read.d.ts +56 -0
- package/dist/automation/xlsx-read.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +105 -4
- package/dist/automation/xlsx.d.ts.map +1 -1
- package/dist/chart/axis-range.d.ts.map +1 -1
- package/dist/chart/bubble-radius.d.ts +0 -5
- package/dist/chart/bubble-radius.d.ts.map +1 -1
- package/dist/chart/extent.d.ts +9 -0
- package/dist/chart/extent.d.ts.map +1 -0
- package/dist/chart/histogram-binning.d.ts.map +1 -1
- package/dist/chart/index.cjs +56 -18
- package/dist/chart/index.mjs +56 -18
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-legend.d.ts.map +1 -1
- package/dist/chart/render/chart-view-ex.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/trendline-fit.d.ts.map +1 -1
- package/dist/{chunk-NYTR4UZ5.cjs → chunk-4LZIUJI3.cjs} +52 -12
- package/dist/{chunk-SLNQNVQM.mjs → chunk-4QPOJCJG.mjs} +45 -8
- package/dist/{chunk-XTSHZGSM.mjs → chunk-6IIMI5RS.mjs} +52 -12
- package/dist/{chunk-TJPUAUWL.mjs → chunk-BA7Z6ATM.mjs} +9 -195
- package/dist/{chunk-JUABSM7C.mjs → chunk-DLFMCZZT.mjs} +1 -1
- package/dist/{chunk-M4XLF4R7.mjs → chunk-GBKBR4CX.mjs} +20 -8
- package/dist/{chunk-R5FIHHGB.cjs → chunk-HL3FBJ6X.cjs} +1648 -1205
- package/dist/{chunk-ZJ2OKIJN.mjs → chunk-LF5E5ZOH.mjs} +642 -199
- package/dist/{chunk-4FTUAD2B.mjs → chunk-Q5PKBQXH.mjs} +766 -202
- package/dist/{chunk-M6GDBVQ7.mjs → chunk-VQF6HQEE.mjs} +1 -1
- package/dist/collab/embedding.d.ts +103 -0
- package/dist/collab/embedding.d.ts.map +1 -0
- package/dist/collab/index.cjs +450 -342
- package/dist/collab/index.d.ts +1 -0
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.mjs +443 -343
- package/dist/color/theme-palette.d.ts +5 -1
- package/dist/color/theme-palette.d.ts.map +1 -1
- package/dist/crypto/index.cjs +27 -2
- package/dist/crypto/index.mjs +27 -2
- package/dist/diagram/index.cjs +31 -3
- package/dist/diagram/index.mjs +31 -3
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +7 -1
- package/dist/docx/cell-blocks.d.ts.map +1 -1
- package/dist/docx/content-control-edit.d.ts +14 -0
- package/dist/docx/content-control-edit.d.ts.map +1 -1
- package/dist/docx/content-control-model.d.ts +8 -0
- package/dist/docx/content-control-model.d.ts.map +1 -1
- package/dist/docx/content-control-values.d.ts +20 -0
- package/dist/docx/content-control-values.d.ts.map +1 -0
- package/dist/docx/content-control.d.ts +7 -1
- package/dist/docx/content-control.d.ts.map +1 -1
- package/dist/docx/element-order.d.ts +10 -5
- package/dist/docx/element-order.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +3861 -1379
- package/dist/docx/embedded.mjs +3861 -1379
- package/dist/docx/field-instruction.d.ts +22 -0
- package/dist/docx/field-instruction.d.ts.map +1 -0
- package/dist/docx/form-field-model.d.ts +48 -0
- package/dist/docx/form-field-model.d.ts.map +1 -0
- package/dist/docx/form-fields.d.ts +31 -0
- package/dist/docx/form-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-fields.d.ts +61 -0
- package/dist/docx/form-fill-fields.d.ts.map +1 -0
- package/dist/docx/form-fill-labels.d.ts +8 -0
- package/dist/docx/form-fill-labels.d.ts.map +1 -0
- package/dist/docx/form-fill-sites.d.ts +59 -0
- package/dist/docx/form-fill-sites.d.ts.map +1 -0
- package/dist/docx/form-fill-values.d.ts +28 -0
- package/dist/docx/form-fill-values.d.ts.map +1 -0
- package/dist/docx/form-fill-write.d.ts +26 -0
- package/dist/docx/form-fill-write.d.ts.map +1 -0
- package/dist/docx/glossary.d.ts +15 -0
- package/dist/docx/glossary.d.ts.map +1 -0
- package/dist/docx/index.cjs +5929 -3153
- package/dist/docx/index.d.ts +7 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +5913 -3154
- package/dist/docx/inline-annotations.d.ts +21 -0
- package/dist/docx/inline-annotations.d.ts.map +1 -0
- package/dist/docx/inline-container-markers.d.ts +14 -0
- package/dist/docx/inline-container-markers.d.ts.map +1 -0
- package/dist/docx/inline-containers.d.ts +54 -0
- package/dist/docx/inline-containers.d.ts.map +1 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts +15 -0
- package/dist/docx/inline-form-field-bookmarks.d.ts.map +1 -0
- package/dist/docx/inline-marker-positions.d.ts +15 -0
- package/dist/docx/inline-marker-positions.d.ts.map +1 -0
- package/dist/docx/inline-markers.d.ts +63 -0
- package/dist/docx/inline-markers.d.ts.map +1 -0
- package/dist/docx/inline-slots.d.ts +24 -0
- package/dist/docx/inline-slots.d.ts.map +1 -0
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1176 -563
- package/dist/docx/layout/index.d.ts +2 -1
- package/dist/docx/layout/index.d.ts.map +1 -1
- package/dist/docx/layout/index.mjs +1175 -564
- package/dist/docx/layout/input.d.ts +5 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/page-style-refs.d.ts +21 -0
- package/dist/docx/layout/page-style-refs.d.ts.map +1 -0
- package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +1 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/tab-stops.d.ts +8 -1
- package/dist/docx/layout/tab-stops.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +3969 -1487
- package/dist/docx/load/index.mjs +3969 -1487
- package/dist/docx/model-run.d.ts +24 -2
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +5 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/parse-warnings.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/run-segmentation.d.ts +11 -0
- package/dist/docx/run-segmentation.d.ts.map +1 -0
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +5 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts +4 -2
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +9 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/special-characters.d.ts +34 -0
- package/dist/docx/special-characters.d.ts.map +1 -0
- package/dist/docx/style-ref-fields.d.ts +40 -0
- package/dist/docx/style-ref-fields.d.ts.map +1 -0
- package/dist/docx/style-ref.d.ts +85 -0
- package/dist/docx/style-ref.d.ts.map +1 -0
- package/dist/docx/table-model.d.ts +2 -2
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/break-note-schema.d.ts.map +1 -1
- package/dist/docx/ui/content-control-commands.d.ts +20 -8
- package/dist/docx/ui/content-control-commands.d.ts.map +1 -1
- package/dist/docx/ui/content-control-guard.d.ts +4 -1
- package/dist/docx/ui/content-control-guard.d.ts.map +1 -1
- package/dist/docx/ui/content-control-paste.d.ts +23 -0
- package/dist/docx/ui/content-control-paste.d.ts.map +1 -0
- package/dist/docx/ui/content-control-rows.d.ts +15 -0
- package/dist/docx/ui/content-control-rows.d.ts.map +1 -0
- package/dist/docx/ui/content-control-sources.d.ts +12 -0
- package/dist/docx/ui/content-control-sources.d.ts.map +1 -0
- package/dist/docx/ui/content-control-spans.d.ts +29 -6
- package/dist/docx/ui/content-control-spans.d.ts.map +1 -1
- package/dist/docx/ui/content-control-temporary.d.ts +10 -0
- package/dist/docx/ui/content-control-temporary.d.ts.map +1 -0
- package/dist/docx/ui/form-field-commands.d.ts +41 -0
- package/dist/docx/ui/form-field-commands.d.ts.map +1 -0
- package/dist/docx/ui/form-field-guard.d.ts +24 -0
- package/dist/docx/ui/form-field-guard.d.ts.map +1 -0
- package/dist/docx/ui/form-text-blank.d.ts +18 -0
- package/dist/docx/ui/form-text-blank.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +9276 -7132
- package/dist/docx/ui/index.d.ts +5 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +9259 -7137
- package/dist/docx/ui/positional-tab-input.d.ts +7 -0
- package/dist/docx/ui/positional-tab-input.d.ts.map +1 -0
- package/dist/docx/ui/run-compare.d.ts.map +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts.map +1 -1
- package/dist/docx/ui/schema-marks.d.ts +1 -1
- package/dist/docx/ui/schema-marks.d.ts.map +1 -1
- package/dist/docx/ui/symbol-font.d.ts +4 -0
- package/dist/docx/ui/symbol-font.d.ts.map +1 -0
- package/dist/docx/ui/yjs-collaboration.d.ts +12 -1
- package/dist/docx/ui/yjs-collaboration.d.ts.map +1 -1
- package/dist/docx/write-block-placement.d.ts +7 -0
- package/dist/docx/write-block-placement.d.ts.map +1 -1
- package/dist/docx/write-content-control.d.ts +6 -0
- package/dist/docx/write-content-control.d.ts.map +1 -1
- package/dist/docx/write-header-footer.d.ts +6 -2
- package/dist/docx/write-header-footer.d.ts.map +1 -1
- package/dist/docx/write-inline.d.ts +12 -16
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-paragraph.d.ts.map +1 -1
- package/dist/docx/write-revisions.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-section-properties.d.ts +5 -0
- package/dist/docx/write-section-properties.d.ts.map +1 -0
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/docx/write-table-controls.d.ts +15 -0
- package/dist/docx/write-table-controls.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/docx/write.d.ts.map +1 -1
- package/dist/docx/xml.d.ts +6 -0
- package/dist/docx/xml.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +31 -3
- package/dist/drawingml/index.mjs +31 -3
- package/dist/index.cjs +102 -26
- package/dist/index.mjs +102 -26
- package/dist/math/index.cjs +27 -2
- package/dist/math/index.mjs +27 -2
- package/dist/opc/index.cjs +51 -11
- package/dist/opc/index.mjs +51 -11
- package/dist/opc/zip-folders.d.ts +11 -0
- package/dist/opc/zip-folders.d.ts.map +1 -0
- package/dist/opc/zip-limits.d.ts +9 -0
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +995 -462
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CPhsd7Df.d.ts} +7580 -7507
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-Q5mM8kIR.d.ts} +2 -2
- package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-Q5mM8kIR.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +770 -238
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.cjs +12 -3
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +1099 -628
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/signature-node/index.cjs +20 -8
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/teams/index.cjs +105 -70
- package/dist/teams/index.mjs +105 -70
- package/dist/text/text-diff.d.ts +15 -0
- package/dist/text/text-diff.d.ts.map +1 -0
- package/dist/visio/index.cjs +220 -46
- package/dist/visio/index.mjs +220 -46
- package/dist/visio/ui/contract.d.ts +8 -2
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +227 -50
- package/dist/visio/ui/index.mjs +227 -50
- package/dist/xlsx/collab/index.cjs +8 -3
- package/dist/xlsx/collab/index.mjs +8 -3
- package/dist/xlsx/compare/cells.d.ts +22 -0
- package/dist/xlsx/compare/cells.d.ts.map +1 -0
- package/dist/xlsx/compare/compare.d.ts +12 -0
- package/dist/xlsx/compare/compare.d.ts.map +1 -0
- package/dist/xlsx/compare/conditional.d.ts +7 -0
- package/dist/xlsx/compare/conditional.d.ts.map +1 -0
- package/dist/xlsx/compare/format-key.d.ts +34 -0
- package/dist/xlsx/compare/format-key.d.ts.map +1 -0
- package/dist/xlsx/compare/group.d.ts +8 -0
- package/dist/xlsx/compare/group.d.ts.map +1 -0
- package/dist/xlsx/compare/index.d.ts +5 -0
- package/dist/xlsx/compare/index.d.ts.map +1 -0
- package/dist/xlsx/compare/rich-text.d.ts +7 -0
- package/dist/xlsx/compare/rich-text.d.ts.map +1 -0
- package/dist/xlsx/compare/sheets.d.ts +22 -0
- package/dist/xlsx/compare/sheets.d.ts.map +1 -0
- package/dist/xlsx/compare/structure.d.ts +11 -0
- package/dist/xlsx/compare/structure.d.ts.map +1 -0
- package/dist/xlsx/compare/text.d.ts +8 -0
- package/dist/xlsx/compare/text.d.ts.map +1 -0
- package/dist/xlsx/compare/types.d.ts +173 -0
- package/dist/xlsx/compare/types.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-html.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-text.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/clone-cell.d.ts +9 -0
- package/dist/xlsx/edit/clone-cell.d.ts.map +1 -0
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/history-rows.d.ts +7 -0
- package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +19 -4
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/outline.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/edit/timelines.d.ts.map +1 -1
- package/dist/xlsx/formula/change-areas.d.ts +9 -0
- package/dist/xlsx/formula/change-areas.d.ts.map +1 -0
- package/dist/xlsx/formula/engine-prepare.d.ts +8 -0
- package/dist/xlsx/formula/engine-prepare.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/spill.d.ts +5 -1
- package/dist/xlsx/formula/spill.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +2551 -1208
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +2544 -1209
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/navigate.d.ts.map +1 -1
- package/dist/xlsx/layout/style-view.d.ts +5 -0
- package/dist/xlsx/layout/style-view.d.ts.map +1 -1
- package/dist/xlsx/load/csv-dates.d.ts +22 -0
- package/dist/xlsx/load/csv-dates.d.ts.map +1 -0
- package/dist/xlsx/load/csv-import.d.ts +64 -0
- package/dist/xlsx/load/csv-import.d.ts.map +1 -0
- package/dist/xlsx/load/csv-separators.d.ts +13 -0
- package/dist/xlsx/load/csv-separators.d.ts.map +1 -0
- package/dist/xlsx/load/csv-traits.d.ts +20 -0
- package/dist/xlsx/load/csv-traits.d.ts.map +1 -0
- package/dist/xlsx/load/csv.d.ts +8 -4
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/detect.d.ts +13 -0
- package/dist/xlsx/load/detect.d.ts.map +1 -1
- package/dist/xlsx/load/errors.d.ts +1 -0
- package/dist/xlsx/load/errors.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +598 -98
- package/dist/xlsx/load/index.d.ts +3 -1
- package/dist/xlsx/load/index.d.ts.map +1 -1
- package/dist/xlsx/load/index.mjs +597 -99
- package/dist/xlsx/numfmt/format.d.ts +8 -0
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input-date.d.ts +2 -0
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/groups.d.ts.map +1 -1
- package/dist/xlsx/read/index.d.ts +2 -1
- package/dist/xlsx/read/index.d.ts.map +1 -1
- package/dist/xlsx/read/limits.d.ts +50 -0
- package/dist/xlsx/read/limits.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts +11 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/package.d.ts +5 -23
- package/dist/xlsx/read/package.d.ts.map +1 -1
- package/dist/xlsx/read/shared-strings.d.ts +2 -2
- package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts +2 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/stable-key.d.ts +3 -0
- package/dist/xlsx/stable-key.d.ts.map +1 -0
- package/dist/xlsx/styles.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +795 -388
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +795 -389
- package/dist/xlsx/ui/selection-format.d.ts +13 -0
- package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xml/index.cjs +57 -3
- package/dist/xml/index.mjs +57 -4
- package/dist/xml/lite.d.ts.map +1 -1
- package/dist/xml/xml.d.ts +11 -1
- package/dist/xml/xml.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
- package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
package/dist/pptx/index.cjs
CHANGED
|
@@ -4696,13 +4696,14 @@ var init_SlideBuilder = __esm({
|
|
|
4696
4696
|
"pptx/core/builders/sdk/SlideBuilder.ts"() {
|
|
4697
4697
|
init_ElementFactory();
|
|
4698
4698
|
exports.SlideBuilder = class {
|
|
4699
|
-
slide;
|
|
4700
4699
|
/**
|
|
4701
4700
|
* @param slideNumber - 1-based slide number.
|
|
4702
4701
|
* @param layoutPath - Optional layout archive path.
|
|
4703
4702
|
* @param layoutName - Optional layout display name.
|
|
4703
|
+
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
4704
4704
|
*/
|
|
4705
|
-
constructor(slideNumber, layoutPath, layoutName) {
|
|
4705
|
+
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
4706
|
+
this.handler = handler;
|
|
4706
4707
|
this.slide = {
|
|
4707
4708
|
id: `slide${slideNumber}`,
|
|
4708
4709
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -4712,11 +4713,52 @@ var init_SlideBuilder = __esm({
|
|
|
4712
4713
|
layoutName: layoutName ?? "Title Slide"
|
|
4713
4714
|
};
|
|
4714
4715
|
}
|
|
4716
|
+
handler;
|
|
4717
|
+
slide;
|
|
4715
4718
|
/** Add a text box to the slide. */
|
|
4716
4719
|
addText(text2, options) {
|
|
4717
4720
|
this.slide.elements.push(createTextElement(text2, options));
|
|
4718
4721
|
return this;
|
|
4719
4722
|
}
|
|
4723
|
+
/**
|
|
4724
|
+
* Fill a layout placeholder, inheriting its frame and text styles.
|
|
4725
|
+
*
|
|
4726
|
+
* Unlike addText, this writes a real p:ph binding, not a free text box.
|
|
4727
|
+
* Use idx to select repeated slots (for example, Two Content's 1 and 2).
|
|
4728
|
+
* Explicit frame fields override the layout; all other fields inherit.
|
|
4729
|
+
* A standalone builder requires the fourth constructor argument (a loaded
|
|
4730
|
+
* handler), even with an explicit frame, so text styles resolve consistently.
|
|
4731
|
+
* Missing slots without a complete frame throw instead of creating a text box.
|
|
4732
|
+
* Master frames requiring compatible-role fallback are materialized locally
|
|
4733
|
+
* for new content only, keeping existing-deck loading unchanged.
|
|
4734
|
+
*
|
|
4735
|
+
* @example
|
|
4736
|
+
* ```ts
|
|
4737
|
+
* createSlide('Title Slide')
|
|
4738
|
+
* .addPlaceholder('ctrTitle', 'Quarterly review')
|
|
4739
|
+
* .addPlaceholder('subTitle', 'October 2026');
|
|
4740
|
+
* createSlide('Two Content').addPlaceholder('body', 'Right column', { idx: 2 });
|
|
4741
|
+
* ```
|
|
4742
|
+
*/
|
|
4743
|
+
addPlaceholder(type, text2, options = {}) {
|
|
4744
|
+
const input = createTextElement(text2);
|
|
4745
|
+
const context = `Slide ${this.slide.slideNumber} (${this.slide.id}), placeholder ${type} idx=${options.idx ?? "auto"}, layout ${this.slide.layoutName} (${this.slide.layoutPath})`;
|
|
4746
|
+
try {
|
|
4747
|
+
if (!this.handler) {
|
|
4748
|
+
throw new Error(
|
|
4749
|
+
"addPlaceholder requires a loaded handler as the fourth SlideBuilder constructor argument"
|
|
4750
|
+
);
|
|
4751
|
+
}
|
|
4752
|
+
this.slide.elements.push(
|
|
4753
|
+
this.handler.createPlaceholderElement(this.slide.layoutPath, input, type, options)
|
|
4754
|
+
);
|
|
4755
|
+
} catch (error) {
|
|
4756
|
+
throw new Error(`${context}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
4757
|
+
cause: error
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
return this;
|
|
4761
|
+
}
|
|
4720
4762
|
/** Add a shape to the slide. */
|
|
4721
4763
|
addShape(shapeType, options) {
|
|
4722
4764
|
this.slide.elements.push(createShapeElement(shapeType, options));
|
|
@@ -4956,6 +4998,478 @@ var init_SlideBuilder = __esm({
|
|
|
4956
4998
|
};
|
|
4957
4999
|
}
|
|
4958
5000
|
});
|
|
5001
|
+
function isSafePartName(name) {
|
|
5002
|
+
if (name.includes("\0") || name.includes("\\")) return false;
|
|
5003
|
+
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
5004
|
+
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
5005
|
+
if (body.startsWith("/")) return false;
|
|
5006
|
+
return !body.split("/").some((segment) => segment === "..");
|
|
5007
|
+
}
|
|
5008
|
+
function declaredEntrySize(entry2) {
|
|
5009
|
+
const data = entry2._data;
|
|
5010
|
+
const size = Number(data?.uncompressedSize ?? 0);
|
|
5011
|
+
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
5012
|
+
}
|
|
5013
|
+
function resolveLimits(limits) {
|
|
5014
|
+
const create = limits.createError;
|
|
5015
|
+
return {
|
|
5016
|
+
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
5017
|
+
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
5018
|
+
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
5019
|
+
label: limits.label ?? "ZIP",
|
|
5020
|
+
fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
5021
|
+
};
|
|
5022
|
+
}
|
|
5023
|
+
function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
5024
|
+
const r = resolveLimits(limits);
|
|
5025
|
+
const declared = declaredEntrySize(entry2);
|
|
5026
|
+
return new Promise((resolvePromise, reject) => {
|
|
5027
|
+
const chunks = [];
|
|
5028
|
+
let size = 0;
|
|
5029
|
+
let done = false;
|
|
5030
|
+
const stream = entry2.internalStream("uint8array");
|
|
5031
|
+
const abort = (error) => {
|
|
5032
|
+
if (done) return;
|
|
5033
|
+
done = true;
|
|
5034
|
+
stream.pause();
|
|
5035
|
+
chunks.length = 0;
|
|
5036
|
+
reject(error);
|
|
5037
|
+
};
|
|
5038
|
+
stream.on("data", (chunk2) => {
|
|
5039
|
+
if (done) return;
|
|
5040
|
+
size += chunk2.byteLength;
|
|
5041
|
+
if (size > declared || size > r.maxEntryBytes)
|
|
5042
|
+
return abort(
|
|
5043
|
+
r.fail(
|
|
5044
|
+
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
5045
|
+
r.maxEntryBytes,
|
|
5046
|
+
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
5047
|
+
)
|
|
5048
|
+
);
|
|
5049
|
+
if (alreadyRead + size > r.maxTotalBytes)
|
|
5050
|
+
return abort(
|
|
5051
|
+
r.fail(
|
|
5052
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
5053
|
+
r.maxTotalBytes,
|
|
5054
|
+
"maxTotalBytes"
|
|
5055
|
+
)
|
|
5056
|
+
);
|
|
5057
|
+
chunks.push(chunk2);
|
|
5058
|
+
});
|
|
5059
|
+
stream.on("error", (error) => abort(error));
|
|
5060
|
+
stream.on("end", () => {
|
|
5061
|
+
if (done) return;
|
|
5062
|
+
done = true;
|
|
5063
|
+
if (chunks.length === 1 && chunks[0]) return resolvePromise(chunks[0]);
|
|
5064
|
+
const out = new Uint8Array(size);
|
|
5065
|
+
let offset = 0;
|
|
5066
|
+
for (const chunk2 of chunks) {
|
|
5067
|
+
out.set(chunk2, offset);
|
|
5068
|
+
offset += chunk2.byteLength;
|
|
5069
|
+
}
|
|
5070
|
+
resolvePromise(out);
|
|
5071
|
+
});
|
|
5072
|
+
stream.resume();
|
|
5073
|
+
});
|
|
5074
|
+
}
|
|
5075
|
+
function toBase64(bytes) {
|
|
5076
|
+
let binary = "";
|
|
5077
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
5078
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
5079
|
+
return btoa(binary);
|
|
5080
|
+
}
|
|
5081
|
+
function guardZip(zip, limits = {}) {
|
|
5082
|
+
const r = resolveLimits(limits);
|
|
5083
|
+
const entries = Object.values(zip.files);
|
|
5084
|
+
if (entries.length > r.maxEntries)
|
|
5085
|
+
throw r.fail(
|
|
5086
|
+
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
5087
|
+
r.maxEntries,
|
|
5088
|
+
"maxEntries"
|
|
5089
|
+
);
|
|
5090
|
+
let declared = 0;
|
|
5091
|
+
for (const entry2 of entries) {
|
|
5092
|
+
const original = entry2.unsafeOriginalName;
|
|
5093
|
+
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
5094
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
5095
|
+
if (entry2.dir) continue;
|
|
5096
|
+
const size = declaredEntrySize(entry2);
|
|
5097
|
+
if (size > r.maxEntryBytes)
|
|
5098
|
+
throw r.fail(
|
|
5099
|
+
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
5100
|
+
r.maxEntryBytes,
|
|
5101
|
+
"maxEntryBytes"
|
|
5102
|
+
);
|
|
5103
|
+
declared += size;
|
|
5104
|
+
}
|
|
5105
|
+
if (declared > r.maxTotalBytes)
|
|
5106
|
+
throw r.fail(
|
|
5107
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
5108
|
+
r.maxTotalBytes,
|
|
5109
|
+
"maxTotalBytes"
|
|
5110
|
+
);
|
|
5111
|
+
const produced = /* @__PURE__ */ new Map();
|
|
5112
|
+
let total = 0;
|
|
5113
|
+
for (const entry2 of entries) {
|
|
5114
|
+
if (entry2.dir) continue;
|
|
5115
|
+
const inflateOriginal = entry2.async.bind(entry2);
|
|
5116
|
+
entry2.async = async (type, onUpdate) => {
|
|
5117
|
+
const previous = produced.get(entry2.name) ?? 0;
|
|
5118
|
+
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
5119
|
+
if (bytes.byteLength > previous) {
|
|
5120
|
+
total += bytes.byteLength - previous;
|
|
5121
|
+
produced.set(entry2.name, bytes.byteLength);
|
|
5122
|
+
}
|
|
5123
|
+
switch (type) {
|
|
5124
|
+
case "uint8array":
|
|
5125
|
+
return bytes;
|
|
5126
|
+
case "string":
|
|
5127
|
+
case "text":
|
|
5128
|
+
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
5129
|
+
case "arraybuffer":
|
|
5130
|
+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
5131
|
+
case "base64":
|
|
5132
|
+
return toBase64(bytes);
|
|
5133
|
+
default:
|
|
5134
|
+
return inflateOriginal(type, onUpdate);
|
|
5135
|
+
}
|
|
5136
|
+
};
|
|
5137
|
+
}
|
|
5138
|
+
return zip;
|
|
5139
|
+
}
|
|
5140
|
+
async function openZip(input, limits = {}) {
|
|
5141
|
+
const r = resolveLimits(limits);
|
|
5142
|
+
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
5143
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
5144
|
+
if (bytes.byteLength > maxInput)
|
|
5145
|
+
throw r.fail(
|
|
5146
|
+
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
5147
|
+
maxInput,
|
|
5148
|
+
"maxInputBytes"
|
|
5149
|
+
);
|
|
5150
|
+
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
5151
|
+
}
|
|
5152
|
+
var DEFAULT_ZIP_LIMITS, ZipLimitError, mib;
|
|
5153
|
+
var init_zip_limits = __esm({
|
|
5154
|
+
"opc/zip-limits.ts"() {
|
|
5155
|
+
DEFAULT_ZIP_LIMITS = {
|
|
5156
|
+
maxInputBytes: 100 * 1024 * 1024,
|
|
5157
|
+
maxEntries: 1e4,
|
|
5158
|
+
maxEntryBytes: 100 * 1024 * 1024,
|
|
5159
|
+
maxTotalBytes: 100 * 1024 * 1024
|
|
5160
|
+
};
|
|
5161
|
+
ZipLimitError = class extends Error {
|
|
5162
|
+
code = "ZIP_BOMB";
|
|
5163
|
+
limit;
|
|
5164
|
+
/** The check that failed (absent when the error was built without one). */
|
|
5165
|
+
kind;
|
|
5166
|
+
constructor(message, details) {
|
|
5167
|
+
super(message);
|
|
5168
|
+
this.name = "ZipLimitError";
|
|
5169
|
+
this.limit = details.limit;
|
|
5170
|
+
this.kind = details.kind;
|
|
5171
|
+
}
|
|
5172
|
+
};
|
|
5173
|
+
mib = (bytes) => Math.round(bytes / 1048576);
|
|
5174
|
+
}
|
|
5175
|
+
});
|
|
5176
|
+
|
|
5177
|
+
// pptx/core/core/types.ts
|
|
5178
|
+
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = void 0; exports.MAX_ZIP_ENTRY_COUNT = void 0; exports.ZipBombError = void 0;
|
|
5179
|
+
var init_types2 = __esm({
|
|
5180
|
+
"pptx/core/core/types.ts"() {
|
|
5181
|
+
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
5182
|
+
exports.MAX_ZIP_ENTRY_COUNT = 65536;
|
|
5183
|
+
exports.ZipBombError = class extends Error {
|
|
5184
|
+
code = "ZIP_BOMB";
|
|
5185
|
+
uncompressedBytes;
|
|
5186
|
+
limit;
|
|
5187
|
+
entryCount;
|
|
5188
|
+
constructor(message, details) {
|
|
5189
|
+
super(message);
|
|
5190
|
+
this.name = "ZipBombError";
|
|
5191
|
+
this.uncompressedBytes = details.uncompressedBytes;
|
|
5192
|
+
this.limit = details.limit;
|
|
5193
|
+
this.entryCount = details.entryCount;
|
|
5194
|
+
}
|
|
5195
|
+
};
|
|
5196
|
+
}
|
|
5197
|
+
});
|
|
5198
|
+
|
|
5199
|
+
// pptx/core/utils/zip-open.ts
|
|
5200
|
+
function openPptxZip(bytes) {
|
|
5201
|
+
return openZip(bytes, {
|
|
5202
|
+
label: "PPTX",
|
|
5203
|
+
maxInputBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
5204
|
+
maxEntries: exports.MAX_ZIP_ENTRY_COUNT,
|
|
5205
|
+
maxEntryBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
5206
|
+
maxTotalBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
5207
|
+
createError
|
|
5208
|
+
});
|
|
5209
|
+
}
|
|
5210
|
+
function openNestedZip(bytes) {
|
|
5211
|
+
return openZip(bytes, { label: "Embedded", createError });
|
|
5212
|
+
}
|
|
5213
|
+
var createError;
|
|
5214
|
+
var init_zip_open = __esm({
|
|
5215
|
+
"pptx/core/utils/zip-open.ts"() {
|
|
5216
|
+
init_zip_limits();
|
|
5217
|
+
init_types2();
|
|
5218
|
+
createError = (message, details) => new exports.ZipBombError(message, details);
|
|
5219
|
+
}
|
|
5220
|
+
});
|
|
5221
|
+
|
|
5222
|
+
// pptx/core/builders/sdk/layout-operations.ts
|
|
5223
|
+
function pxToEmu(px3) {
|
|
5224
|
+
return Math.round(px3 * EMU_PER_PIXEL2);
|
|
5225
|
+
}
|
|
5226
|
+
function placeholderSpXml(ph, shapeId) {
|
|
5227
|
+
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
5228
|
+
const x = pxToEmu(ph.x);
|
|
5229
|
+
const y = pxToEmu(ph.y);
|
|
5230
|
+
const cx = pxToEmu(ph.width);
|
|
5231
|
+
const cy = pxToEmu(ph.height);
|
|
5232
|
+
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
5233
|
+
return ` <p:sp>
|
|
5234
|
+
<p:nvSpPr>
|
|
5235
|
+
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
5236
|
+
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
5237
|
+
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
5238
|
+
</p:nvSpPr>
|
|
5239
|
+
<p:spPr>
|
|
5240
|
+
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
5241
|
+
</p:spPr>
|
|
5242
|
+
<p:txBody>
|
|
5243
|
+
<a:bodyPr/>
|
|
5244
|
+
<a:lstStyle/>
|
|
5245
|
+
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
5246
|
+
</p:txBody>
|
|
5247
|
+
</p:sp>`;
|
|
5248
|
+
}
|
|
5249
|
+
function normalizeSrgbHex(color2) {
|
|
5250
|
+
if (!color2) {
|
|
5251
|
+
return void 0;
|
|
5252
|
+
}
|
|
5253
|
+
const raw = color2.trim().replace(/^#/, "").toUpperCase();
|
|
5254
|
+
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
5255
|
+
return raw;
|
|
5256
|
+
}
|
|
5257
|
+
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
5258
|
+
return raw.replace(/./g, (ch) => ch + ch);
|
|
5259
|
+
}
|
|
5260
|
+
return void 0;
|
|
5261
|
+
}
|
|
5262
|
+
function generateLayoutXml(definition) {
|
|
5263
|
+
const layoutType = definition.type ?? "obj";
|
|
5264
|
+
const placeholders = definition.placeholders ?? [];
|
|
5265
|
+
const phShapes = placeholders.map((ph, i2) => placeholderSpXml(ph, i2 + 2)).join("\n");
|
|
5266
|
+
let bgXml = "";
|
|
5267
|
+
const hex3 = normalizeSrgbHex(definition.backgroundColor);
|
|
5268
|
+
if (hex3) {
|
|
5269
|
+
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
5270
|
+
`;
|
|
5271
|
+
}
|
|
5272
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
5273
|
+
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
5274
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
5275
|
+
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
5276
|
+
type="${escAttr(layoutType)}" preserve="1">
|
|
5277
|
+
<p:cSld name="${escAttr(definition.name)}">
|
|
5278
|
+
${bgXml} <p:spTree>
|
|
5279
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
5280
|
+
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
5281
|
+
${phShapes}
|
|
5282
|
+
</p:spTree>
|
|
5283
|
+
</p:cSld>
|
|
5284
|
+
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
5285
|
+
</p:sldLayout>`;
|
|
5286
|
+
}
|
|
5287
|
+
function layoutRelsXml(masterIndex = 1) {
|
|
5288
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
5289
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
5290
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster${masterIndex}.xml"/>
|
|
5291
|
+
</Relationships>`;
|
|
5292
|
+
}
|
|
5293
|
+
function countExistingLayouts(zip) {
|
|
5294
|
+
let count = 0;
|
|
5295
|
+
zip.forEach((relativePath) => {
|
|
5296
|
+
if (/^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(relativePath)) {
|
|
5297
|
+
count++;
|
|
5298
|
+
}
|
|
5299
|
+
});
|
|
5300
|
+
return count;
|
|
5301
|
+
}
|
|
5302
|
+
async function addLayoutToSlideMaster(zip, layoutIndex2, masterIndex = 1) {
|
|
5303
|
+
const masterRelsPath = `ppt/slideMasters/_rels/slideMaster${masterIndex}.xml.rels`;
|
|
5304
|
+
const masterRelsContent = await zip.file(masterRelsPath)?.async("string");
|
|
5305
|
+
if (!masterRelsContent) {
|
|
5306
|
+
throw new Error(`Slide master rels not found at ${masterRelsPath}`);
|
|
5307
|
+
}
|
|
5308
|
+
const rIdMatches = [...masterRelsContent.matchAll(/rId(\d+)/g)];
|
|
5309
|
+
const maxRId = rIdMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 0);
|
|
5310
|
+
const newRId = `rId${maxRId + 1}`;
|
|
5311
|
+
const newRel = ` <Relationship Id="${newRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout${layoutIndex2}.xml"/>`;
|
|
5312
|
+
const updatedRels = masterRelsContent.replace("</Relationships>", `${newRel}
|
|
5313
|
+
</Relationships>`);
|
|
5314
|
+
zip.file(masterRelsPath, updatedRels);
|
|
5315
|
+
const masterPath = `ppt/slideMasters/slideMaster${masterIndex}.xml`;
|
|
5316
|
+
const masterContent = await zip.file(masterPath)?.async("string");
|
|
5317
|
+
if (!masterContent) {
|
|
5318
|
+
throw new Error(`Slide master not found at ${masterPath}`);
|
|
5319
|
+
}
|
|
5320
|
+
const idMatches = [...masterContent.matchAll(/sldLayoutId\s+id="(\d+)"/g)];
|
|
5321
|
+
const maxLayoutId = idMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 2147483648);
|
|
5322
|
+
const newLayoutId = maxLayoutId + 1;
|
|
5323
|
+
const newLayoutIdEntry = ` <p:sldLayoutId id="${newLayoutId}" r:id="${newRId}"/>`;
|
|
5324
|
+
const updatedMaster = masterContent.replace(
|
|
5325
|
+
"</p:sldLayoutIdLst>",
|
|
5326
|
+
`${newLayoutIdEntry}
|
|
5327
|
+
</p:sldLayoutIdLst>`
|
|
5328
|
+
);
|
|
5329
|
+
zip.file(masterPath, updatedMaster);
|
|
5330
|
+
}
|
|
5331
|
+
async function addLayoutContentType(zip, layoutIndex2) {
|
|
5332
|
+
const ctPath = "[Content_Types].xml";
|
|
5333
|
+
const ctContent = await zip.file(ctPath)?.async("string");
|
|
5334
|
+
if (!ctContent) {
|
|
5335
|
+
throw new Error("Content types file not found");
|
|
5336
|
+
}
|
|
5337
|
+
const override = ` <Override PartName="/ppt/slideLayouts/slideLayout${layoutIndex2}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
|
|
5338
|
+
const updatedCt = ctContent.replace("</Types>", `${override}
|
|
5339
|
+
</Types>`);
|
|
5340
|
+
zip.file(ctPath, updatedCt);
|
|
5341
|
+
}
|
|
5342
|
+
async function createLayout(handler, data, definition, masterIndex = 1) {
|
|
5343
|
+
const bytes = await handler.save(data.slides);
|
|
5344
|
+
const zip = await openPptxZip(bytes);
|
|
5345
|
+
const existingCount = countExistingLayouts(zip);
|
|
5346
|
+
const newIndex = existingCount + 1;
|
|
5347
|
+
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
5348
|
+
zip.file(layoutPath, generateLayoutXml(definition));
|
|
5349
|
+
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
5350
|
+
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
5351
|
+
await addLayoutContentType(zip, newIndex);
|
|
5352
|
+
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
5353
|
+
const newHandler = new exports.PptxHandler();
|
|
5354
|
+
const newData = await newHandler.load(updatedBuffer);
|
|
5355
|
+
return {
|
|
5356
|
+
layoutPath,
|
|
5357
|
+
layoutName: definition.name,
|
|
5358
|
+
handler: newHandler,
|
|
5359
|
+
data: newData
|
|
5360
|
+
};
|
|
5361
|
+
}
|
|
5362
|
+
async function createLayouts(handler, data, definitions, masterIndex = 1) {
|
|
5363
|
+
if (definitions.length === 0) {
|
|
5364
|
+
return { layoutPaths: [], handler, data };
|
|
5365
|
+
}
|
|
5366
|
+
const bytes = await handler.save(data.slides);
|
|
5367
|
+
const zip = await openPptxZip(bytes);
|
|
5368
|
+
const existingCount = countExistingLayouts(zip);
|
|
5369
|
+
const layoutPaths = [];
|
|
5370
|
+
for (let i2 = 0; i2 < definitions.length; i2++) {
|
|
5371
|
+
const def = definitions[i2];
|
|
5372
|
+
const newIndex = existingCount + i2 + 1;
|
|
5373
|
+
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
5374
|
+
zip.file(layoutPath, generateLayoutXml(def));
|
|
5375
|
+
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
5376
|
+
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
5377
|
+
await addLayoutContentType(zip, newIndex);
|
|
5378
|
+
layoutPaths.push(layoutPath);
|
|
5379
|
+
}
|
|
5380
|
+
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
5381
|
+
const newHandler = new exports.PptxHandler();
|
|
5382
|
+
const newData = await newHandler.load(updatedBuffer);
|
|
5383
|
+
return { layoutPaths, handler: newHandler, data: newData };
|
|
5384
|
+
}
|
|
5385
|
+
function findLayoutByName(data, name) {
|
|
5386
|
+
const lowerName = name.toLowerCase();
|
|
5387
|
+
const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
|
|
5388
|
+
if (fromOptions) {
|
|
5389
|
+
return fromOptions;
|
|
5390
|
+
}
|
|
5391
|
+
if (data.slideMasters) {
|
|
5392
|
+
for (const master of data.slideMasters) {
|
|
5393
|
+
const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
|
|
5394
|
+
if (layout) {
|
|
5395
|
+
return { path: layout.path, name: layout.name ?? name };
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
return void 0;
|
|
5400
|
+
}
|
|
5401
|
+
function findLayoutByType(data, type) {
|
|
5402
|
+
const fromOptions = data.layoutOptions?.find((l) => l.type === type);
|
|
5403
|
+
if (fromOptions) {
|
|
5404
|
+
return fromOptions;
|
|
5405
|
+
}
|
|
5406
|
+
return void 0;
|
|
5407
|
+
}
|
|
5408
|
+
var EMU_PER_PIXEL2;
|
|
5409
|
+
var init_layout_operations = __esm({
|
|
5410
|
+
"pptx/core/builders/sdk/layout-operations.ts"() {
|
|
5411
|
+
init_zip_open();
|
|
5412
|
+
init_xml_utils();
|
|
5413
|
+
init_PptxHandler();
|
|
5414
|
+
EMU_PER_PIXEL2 = 9525;
|
|
5415
|
+
}
|
|
5416
|
+
});
|
|
5417
|
+
|
|
5418
|
+
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
5419
|
+
function standardLayoutPlaceholders(type, width, height) {
|
|
5420
|
+
if (type === "blank") return [];
|
|
5421
|
+
const box = (type2, idx, x, y, w, h2) => ({
|
|
5422
|
+
type: type2,
|
|
5423
|
+
idx,
|
|
5424
|
+
x: x * width,
|
|
5425
|
+
y: y * height,
|
|
5426
|
+
width: w * width,
|
|
5427
|
+
height: h2 * height
|
|
5428
|
+
});
|
|
5429
|
+
const title = box("title", 0, 0.05, 0.04, 0.9, 0.15);
|
|
5430
|
+
const content2 = box("obj", 1, 0.05, 0.23, 0.9, 0.64);
|
|
5431
|
+
let slots;
|
|
5432
|
+
switch (type) {
|
|
5433
|
+
case "title":
|
|
5434
|
+
slots = [
|
|
5435
|
+
box("ctrTitle", 0, 0.08, 0.24, 0.84, 0.22),
|
|
5436
|
+
box("subTitle", 1, 0.12, 0.49, 0.76, 0.2)
|
|
5437
|
+
];
|
|
5438
|
+
break;
|
|
5439
|
+
case "secHead":
|
|
5440
|
+
slots = [box("title", 0, 0.05, 0.37, 0.9, 0.2), box("body", 1, 0.05, 0.6, 0.9, 0.23)];
|
|
5441
|
+
break;
|
|
5442
|
+
case "twoObj":
|
|
5443
|
+
case "twoTxTwoObj":
|
|
5444
|
+
slots = [title, box("obj", 1, 0.05, 0.27, 0.43, 0.6), box("obj", 2, 0.52, 0.27, 0.43, 0.6)];
|
|
5445
|
+
if (type === "twoTxTwoObj")
|
|
5446
|
+
slots.push(box("body", 3, 0.05, 0.2, 0.43, 0.07), box("body", 4, 0.52, 0.2, 0.43, 0.07));
|
|
5447
|
+
break;
|
|
5448
|
+
case "titleOnly":
|
|
5449
|
+
slots = [title];
|
|
5450
|
+
break;
|
|
5451
|
+
case "objTx":
|
|
5452
|
+
case "picTx":
|
|
5453
|
+
slots = [
|
|
5454
|
+
title,
|
|
5455
|
+
box(type === "picTx" ? "pic" : "obj", 1, 0.36, 0.23, 0.59, 0.64),
|
|
5456
|
+
box("body", 2, 0.05, 0.23, 0.27, 0.64)
|
|
5457
|
+
];
|
|
5458
|
+
break;
|
|
5459
|
+
default:
|
|
5460
|
+
slots = [title, content2];
|
|
5461
|
+
}
|
|
5462
|
+
return [
|
|
5463
|
+
...slots,
|
|
5464
|
+
box("dt", 10, 0.05, 0.92, 0.25, 0.04),
|
|
5465
|
+
box("ftr", 11, 0.33, 0.92, 0.34, 0.04),
|
|
5466
|
+
box("sldNum", 12, 0.75, 0.92, 0.2, 0.04)
|
|
5467
|
+
];
|
|
5468
|
+
}
|
|
5469
|
+
var init_standard_layout_placeholders = __esm({
|
|
5470
|
+
"pptx/core/builders/sdk/standard-layout-placeholders.ts"() {
|
|
5471
|
+
}
|
|
5472
|
+
});
|
|
4959
5473
|
|
|
4960
5474
|
// pptx/core/builders/sdk/PresentationBuilder.ts
|
|
4961
5475
|
var PresentationBuilder_exports = {};
|
|
@@ -4964,7 +5478,7 @@ __export(PresentationBuilder_exports, {
|
|
|
4964
5478
|
STANDARD_LAYOUTS: () => STANDARD_LAYOUTS,
|
|
4965
5479
|
buildBlankPresentationArchive: () => buildBlankPresentationArchive
|
|
4966
5480
|
});
|
|
4967
|
-
function
|
|
5481
|
+
function normalizeSrgbHex2(color2) {
|
|
4968
5482
|
if (!color2) {
|
|
4969
5483
|
return void 0;
|
|
4970
5484
|
}
|
|
@@ -4980,7 +5494,7 @@ function normalizeSrgbHex(color2) {
|
|
|
4980
5494
|
function resolveThemeColors(overrides28) {
|
|
4981
5495
|
const resolved = {};
|
|
4982
5496
|
for (const [key2, fallback] of Object.entries(DEFAULT_COLORS)) {
|
|
4983
|
-
resolved[key2] =
|
|
5497
|
+
resolved[key2] = normalizeSrgbHex2(overrides28?.[key2]) ?? normalizeSrgbHex2(fallback) ?? "000000";
|
|
4984
5498
|
}
|
|
4985
5499
|
return resolved;
|
|
4986
5500
|
}
|
|
@@ -5120,21 +5634,6 @@ ${layoutRels}
|
|
|
5120
5634
|
<Relationship Id="rId${layoutCount + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
|
|
5121
5635
|
</Relationships>`;
|
|
5122
5636
|
}
|
|
5123
|
-
function slideLayoutXml(name, layoutType) {
|
|
5124
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
5125
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
5126
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
5127
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
5128
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
5129
|
-
<p:cSld name="${escAttr(name)}">
|
|
5130
|
-
<p:spTree>
|
|
5131
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
5132
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
5133
|
-
</p:spTree>
|
|
5134
|
-
</p:cSld>
|
|
5135
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
5136
|
-
</p:sldLayout>`;
|
|
5137
|
-
}
|
|
5138
5637
|
function slideLayoutRelsXml() {
|
|
5139
5638
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
5140
5639
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
@@ -5283,7 +5782,14 @@ async function buildBlankPresentationArchive(options) {
|
|
|
5283
5782
|
zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
|
|
5284
5783
|
for (let i2 = 0; i2 < layoutCount; i2++) {
|
|
5285
5784
|
const layout = STANDARD_LAYOUTS[i2];
|
|
5286
|
-
zip.file(
|
|
5785
|
+
zip.file(
|
|
5786
|
+
`ppt/slideLayouts/slideLayout${i2 + 1}.xml`,
|
|
5787
|
+
generateLayoutXml({
|
|
5788
|
+
name: layout.name,
|
|
5789
|
+
type: layout.type,
|
|
5790
|
+
placeholders: standardLayoutPlaceholders(layout.type, width / 9525, height / 9525)
|
|
5791
|
+
})
|
|
5792
|
+
);
|
|
5287
5793
|
zip.file(`ppt/slideLayouts/_rels/slideLayout${i2 + 1}.xml.rels`, slideLayoutRelsXml());
|
|
5288
5794
|
}
|
|
5289
5795
|
for (let i2 = 0; i2 < initialSlideCount; i2++) {
|
|
@@ -5304,6 +5810,8 @@ var init_PresentationBuilder = __esm({
|
|
|
5304
5810
|
init_xml_utils();
|
|
5305
5811
|
init_PptxHandler();
|
|
5306
5812
|
init_SlideBuilder();
|
|
5813
|
+
init_layout_operations();
|
|
5814
|
+
init_standard_layout_placeholders();
|
|
5307
5815
|
DEFAULT_WIDTH = 12192e3;
|
|
5308
5816
|
DEFAULT_HEIGHT = 6858e3;
|
|
5309
5817
|
DEFAULT_COLORS = {
|
|
@@ -5361,7 +5869,7 @@ var init_PresentationBuilder = __esm({
|
|
|
5361
5869
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
5362
5870
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
5363
5871
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
5364
|
-
return new exports.SlideBuilder(slideNum, layoutPath, resolvedName);
|
|
5872
|
+
return new exports.SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
5365
5873
|
};
|
|
5366
5874
|
return { handler, data, createSlide };
|
|
5367
5875
|
}
|
|
@@ -16309,7 +16817,7 @@ function getShapeType(shapeType) {
|
|
|
16309
16817
|
if (normalized === "downarrow") {
|
|
16310
16818
|
return "downArrow";
|
|
16311
16819
|
}
|
|
16312
|
-
if (normalized.includes("connector")) {
|
|
16820
|
+
if (normalized.includes("connector") && !normalized.startsWith("flowchart")) {
|
|
16313
16821
|
return "connector";
|
|
16314
16822
|
}
|
|
16315
16823
|
if (exports.PRESET_SHAPE_CLIP_PATHS[normalized] !== void 0) {
|
|
@@ -22935,214 +23443,6 @@ var init_ole_embedded_replace = __esm({
|
|
|
22935
23443
|
CONTENTS_STREAM2 = "CONTENTS";
|
|
22936
23444
|
}
|
|
22937
23445
|
});
|
|
22938
|
-
function isSafePartName(name) {
|
|
22939
|
-
if (name.includes("\0") || name.includes("\\")) return false;
|
|
22940
|
-
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
22941
|
-
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
22942
|
-
if (body.startsWith("/")) return false;
|
|
22943
|
-
return !body.split("/").some((segment) => segment === "..");
|
|
22944
|
-
}
|
|
22945
|
-
function declaredEntrySize(entry2) {
|
|
22946
|
-
const data = entry2._data;
|
|
22947
|
-
const size = Number(data?.uncompressedSize ?? 0);
|
|
22948
|
-
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
22949
|
-
}
|
|
22950
|
-
function resolveLimits(limits) {
|
|
22951
|
-
const create = limits.createError;
|
|
22952
|
-
return {
|
|
22953
|
-
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
22954
|
-
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
22955
|
-
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
22956
|
-
label: limits.label ?? "ZIP",
|
|
22957
|
-
fail: (message, limit) => create ? create(message, { limit }) : new ZipLimitError(message, { limit })
|
|
22958
|
-
};
|
|
22959
|
-
}
|
|
22960
|
-
function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
22961
|
-
const r = resolveLimits(limits);
|
|
22962
|
-
const declared = declaredEntrySize(entry2);
|
|
22963
|
-
return new Promise((resolvePromise, reject) => {
|
|
22964
|
-
const chunks = [];
|
|
22965
|
-
let size = 0;
|
|
22966
|
-
let done = false;
|
|
22967
|
-
const stream = entry2.internalStream("uint8array");
|
|
22968
|
-
const abort = (error) => {
|
|
22969
|
-
if (done) return;
|
|
22970
|
-
done = true;
|
|
22971
|
-
stream.pause();
|
|
22972
|
-
chunks.length = 0;
|
|
22973
|
-
reject(error);
|
|
22974
|
-
};
|
|
22975
|
-
stream.on("data", (chunk2) => {
|
|
22976
|
-
if (done) return;
|
|
22977
|
-
size += chunk2.byteLength;
|
|
22978
|
-
if (size > declared || size > r.maxEntryBytes)
|
|
22979
|
-
return abort(
|
|
22980
|
-
r.fail(`${r.label} part ${entry2.name} inflates past its declared size`, r.maxEntryBytes)
|
|
22981
|
-
);
|
|
22982
|
-
if (alreadyRead + size > r.maxTotalBytes)
|
|
22983
|
-
return abort(
|
|
22984
|
-
r.fail(
|
|
22985
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
22986
|
-
r.maxTotalBytes
|
|
22987
|
-
)
|
|
22988
|
-
);
|
|
22989
|
-
chunks.push(chunk2);
|
|
22990
|
-
});
|
|
22991
|
-
stream.on("error", (error) => abort(error));
|
|
22992
|
-
stream.on("end", () => {
|
|
22993
|
-
if (done) return;
|
|
22994
|
-
done = true;
|
|
22995
|
-
if (chunks.length === 1 && chunks[0]) return resolvePromise(chunks[0]);
|
|
22996
|
-
const out = new Uint8Array(size);
|
|
22997
|
-
let offset = 0;
|
|
22998
|
-
for (const chunk2 of chunks) {
|
|
22999
|
-
out.set(chunk2, offset);
|
|
23000
|
-
offset += chunk2.byteLength;
|
|
23001
|
-
}
|
|
23002
|
-
resolvePromise(out);
|
|
23003
|
-
});
|
|
23004
|
-
stream.resume();
|
|
23005
|
-
});
|
|
23006
|
-
}
|
|
23007
|
-
function toBase64(bytes) {
|
|
23008
|
-
let binary = "";
|
|
23009
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
23010
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
23011
|
-
return btoa(binary);
|
|
23012
|
-
}
|
|
23013
|
-
function guardZip(zip, limits = {}) {
|
|
23014
|
-
const r = resolveLimits(limits);
|
|
23015
|
-
const entries = Object.values(zip.files);
|
|
23016
|
-
if (entries.length > r.maxEntries)
|
|
23017
|
-
throw r.fail(
|
|
23018
|
-
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
23019
|
-
r.maxEntries
|
|
23020
|
-
);
|
|
23021
|
-
let declared = 0;
|
|
23022
|
-
for (const entry2 of entries) {
|
|
23023
|
-
const original = entry2.unsafeOriginalName;
|
|
23024
|
-
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
23025
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries);
|
|
23026
|
-
if (entry2.dir) continue;
|
|
23027
|
-
const size = declaredEntrySize(entry2);
|
|
23028
|
-
if (size > r.maxEntryBytes)
|
|
23029
|
-
throw r.fail(
|
|
23030
|
-
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
23031
|
-
r.maxEntryBytes
|
|
23032
|
-
);
|
|
23033
|
-
declared += size;
|
|
23034
|
-
}
|
|
23035
|
-
if (declared > r.maxTotalBytes)
|
|
23036
|
-
throw r.fail(
|
|
23037
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
23038
|
-
r.maxTotalBytes
|
|
23039
|
-
);
|
|
23040
|
-
const produced = /* @__PURE__ */ new Map();
|
|
23041
|
-
let total = 0;
|
|
23042
|
-
for (const entry2 of entries) {
|
|
23043
|
-
if (entry2.dir) continue;
|
|
23044
|
-
const inflateOriginal = entry2.async.bind(entry2);
|
|
23045
|
-
entry2.async = async (type, onUpdate) => {
|
|
23046
|
-
const previous = produced.get(entry2.name) ?? 0;
|
|
23047
|
-
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
23048
|
-
if (bytes.byteLength > previous) {
|
|
23049
|
-
total += bytes.byteLength - previous;
|
|
23050
|
-
produced.set(entry2.name, bytes.byteLength);
|
|
23051
|
-
}
|
|
23052
|
-
switch (type) {
|
|
23053
|
-
case "uint8array":
|
|
23054
|
-
return bytes;
|
|
23055
|
-
case "string":
|
|
23056
|
-
case "text":
|
|
23057
|
-
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
23058
|
-
case "arraybuffer":
|
|
23059
|
-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
23060
|
-
case "base64":
|
|
23061
|
-
return toBase64(bytes);
|
|
23062
|
-
default:
|
|
23063
|
-
return inflateOriginal(type, onUpdate);
|
|
23064
|
-
}
|
|
23065
|
-
};
|
|
23066
|
-
}
|
|
23067
|
-
return zip;
|
|
23068
|
-
}
|
|
23069
|
-
async function openZip(input, limits = {}) {
|
|
23070
|
-
const r = resolveLimits(limits);
|
|
23071
|
-
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
23072
|
-
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
23073
|
-
if (bytes.byteLength > maxInput)
|
|
23074
|
-
throw r.fail(
|
|
23075
|
-
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
23076
|
-
maxInput
|
|
23077
|
-
);
|
|
23078
|
-
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
23079
|
-
}
|
|
23080
|
-
var DEFAULT_ZIP_LIMITS, ZipLimitError, mib;
|
|
23081
|
-
var init_zip_limits = __esm({
|
|
23082
|
-
"opc/zip-limits.ts"() {
|
|
23083
|
-
DEFAULT_ZIP_LIMITS = {
|
|
23084
|
-
maxInputBytes: 100 * 1024 * 1024,
|
|
23085
|
-
maxEntries: 1e4,
|
|
23086
|
-
maxEntryBytes: 100 * 1024 * 1024,
|
|
23087
|
-
maxTotalBytes: 100 * 1024 * 1024
|
|
23088
|
-
};
|
|
23089
|
-
ZipLimitError = class extends Error {
|
|
23090
|
-
code = "ZIP_BOMB";
|
|
23091
|
-
limit;
|
|
23092
|
-
constructor(message, details) {
|
|
23093
|
-
super(message);
|
|
23094
|
-
this.name = "ZipLimitError";
|
|
23095
|
-
this.limit = details.limit;
|
|
23096
|
-
}
|
|
23097
|
-
};
|
|
23098
|
-
mib = (bytes) => Math.round(bytes / 1048576);
|
|
23099
|
-
}
|
|
23100
|
-
});
|
|
23101
|
-
|
|
23102
|
-
// pptx/core/core/types.ts
|
|
23103
|
-
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = void 0; exports.MAX_ZIP_ENTRY_COUNT = void 0; exports.ZipBombError = void 0;
|
|
23104
|
-
var init_types2 = __esm({
|
|
23105
|
-
"pptx/core/core/types.ts"() {
|
|
23106
|
-
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
23107
|
-
exports.MAX_ZIP_ENTRY_COUNT = 65536;
|
|
23108
|
-
exports.ZipBombError = class extends Error {
|
|
23109
|
-
code = "ZIP_BOMB";
|
|
23110
|
-
uncompressedBytes;
|
|
23111
|
-
limit;
|
|
23112
|
-
entryCount;
|
|
23113
|
-
constructor(message, details) {
|
|
23114
|
-
super(message);
|
|
23115
|
-
this.name = "ZipBombError";
|
|
23116
|
-
this.uncompressedBytes = details.uncompressedBytes;
|
|
23117
|
-
this.limit = details.limit;
|
|
23118
|
-
this.entryCount = details.entryCount;
|
|
23119
|
-
}
|
|
23120
|
-
};
|
|
23121
|
-
}
|
|
23122
|
-
});
|
|
23123
|
-
|
|
23124
|
-
// pptx/core/utils/zip-open.ts
|
|
23125
|
-
function openPptxZip(bytes) {
|
|
23126
|
-
return openZip(bytes, {
|
|
23127
|
-
label: "PPTX",
|
|
23128
|
-
maxInputBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
23129
|
-
maxEntries: exports.MAX_ZIP_ENTRY_COUNT,
|
|
23130
|
-
maxEntryBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
23131
|
-
maxTotalBytes: exports.DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
23132
|
-
createError
|
|
23133
|
-
});
|
|
23134
|
-
}
|
|
23135
|
-
function openNestedZip(bytes) {
|
|
23136
|
-
return openZip(bytes, { label: "Embedded", createError });
|
|
23137
|
-
}
|
|
23138
|
-
var createError;
|
|
23139
|
-
var init_zip_open = __esm({
|
|
23140
|
-
"pptx/core/utils/zip-open.ts"() {
|
|
23141
|
-
init_zip_limits();
|
|
23142
|
-
init_types2();
|
|
23143
|
-
createError = (message, details) => new exports.ZipBombError(message, details);
|
|
23144
|
-
}
|
|
23145
|
-
});
|
|
23146
23446
|
|
|
23147
23447
|
// pptx/core/utils/ole-payload-kind.ts
|
|
23148
23448
|
function isZipMagic(bytes) {
|
|
@@ -45304,9 +45604,18 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
45304
45604
|
continue;
|
|
45305
45605
|
}
|
|
45306
45606
|
nodes++;
|
|
45307
|
-
if (nodes > maxNodes)
|
|
45607
|
+
if (nodes > maxNodes)
|
|
45608
|
+
throw new XmlLimitError(
|
|
45609
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
45610
|
+
"maxNodes",
|
|
45611
|
+
maxNodes
|
|
45612
|
+
);
|
|
45308
45613
|
if (!selfClosing && ++depth > maxDepth2)
|
|
45309
|
-
throw new
|
|
45614
|
+
throw new XmlLimitError(
|
|
45615
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth2}`,
|
|
45616
|
+
"maxDepth",
|
|
45617
|
+
maxDepth2
|
|
45618
|
+
);
|
|
45310
45619
|
}
|
|
45311
45620
|
}
|
|
45312
45621
|
function parseXml(xml, options = {}) {
|
|
@@ -45330,6 +45639,7 @@ function parseXml(xml, options = {}) {
|
|
|
45330
45639
|
}
|
|
45331
45640
|
if (parseError || !parsed.documentElement)
|
|
45332
45641
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
45642
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
45333
45643
|
return parsed;
|
|
45334
45644
|
}
|
|
45335
45645
|
function named(element, local, ns, lenient = true) {
|
|
@@ -45339,7 +45649,7 @@ function named(element, local, ns, lenient = true) {
|
|
|
45339
45649
|
function attr(element, local, ns, prefix) {
|
|
45340
45650
|
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix}:${local}`) ?? void 0;
|
|
45341
45651
|
}
|
|
45342
|
-
var DEFAULT_XML_LIMITS, TAG_RE, MARKUP_SKIPS, buildXml, isElement, elements, children2, first, relAttr;
|
|
45652
|
+
var DEFAULT_XML_LIMITS, XmlLimitError, TAG_RE, MARKUP_SKIPS, CRLF_DECLARATION, crlfDeclarations, buildXml, isElement, elements, children2, first, relAttr;
|
|
45343
45653
|
var init_xml = __esm({
|
|
45344
45654
|
"xml/xml.ts"() {
|
|
45345
45655
|
init_namespaces();
|
|
@@ -45347,13 +45657,31 @@ var init_xml = __esm({
|
|
|
45347
45657
|
maxDepth: 512,
|
|
45348
45658
|
maxNodes: 5e6
|
|
45349
45659
|
};
|
|
45660
|
+
XmlLimitError = class extends Error {
|
|
45661
|
+
code = "xml-limit";
|
|
45662
|
+
/** The limit that was exceeded. */
|
|
45663
|
+
limit;
|
|
45664
|
+
/** Its value: the largest depth or element count allowed. */
|
|
45665
|
+
maximum;
|
|
45666
|
+
constructor(message, limit, maximum) {
|
|
45667
|
+
super(message);
|
|
45668
|
+
this.name = "XmlLimitError";
|
|
45669
|
+
this.limit = limit;
|
|
45670
|
+
this.maximum = maximum;
|
|
45671
|
+
}
|
|
45672
|
+
};
|
|
45350
45673
|
TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
45351
45674
|
MARKUP_SKIPS = [
|
|
45352
45675
|
["<!--", "-->"],
|
|
45353
45676
|
["<![CDATA[", "]]>"],
|
|
45354
45677
|
["<?", "?>"]
|
|
45355
45678
|
];
|
|
45356
|
-
|
|
45679
|
+
CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
45680
|
+
crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
45681
|
+
buildXml = (node) => {
|
|
45682
|
+
const xml = new xmldom.XMLSerializer().serializeToString(node);
|
|
45683
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
45684
|
+
};
|
|
45357
45685
|
isElement = (node) => node.nodeType === 1;
|
|
45358
45686
|
elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
45359
45687
|
children2 = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
@@ -59273,17 +59601,24 @@ var init_zoom_utils = __esm({
|
|
|
59273
59601
|
function stripFontStyleSuffix(fontName) {
|
|
59274
59602
|
let name = fontName.trim();
|
|
59275
59603
|
let stripped = false;
|
|
59276
|
-
|
|
59604
|
+
let previous = "";
|
|
59605
|
+
let tokens = 0;
|
|
59606
|
+
for (; ; ) {
|
|
59277
59607
|
const idx = name.lastIndexOf(" ");
|
|
59278
59608
|
if (idx <= 0) {
|
|
59279
59609
|
break;
|
|
59280
59610
|
}
|
|
59281
59611
|
const token2 = name.slice(idx + 1).toLowerCase().replace(/-/g, "");
|
|
59282
|
-
|
|
59612
|
+
const prefix = FONT_WEIGHT_PREFIX_TOKENS.has(token2) && FONT_PREFIXED_WEIGHT_TOKENS.has(previous);
|
|
59613
|
+
if (!prefix && (tokens >= 2 || !FONT_STYLE_SUFFIX_TOKENS.has(token2))) {
|
|
59283
59614
|
break;
|
|
59284
59615
|
}
|
|
59285
59616
|
name = name.slice(0, idx).trim();
|
|
59286
59617
|
stripped = true;
|
|
59618
|
+
previous = prefix ? "" : token2;
|
|
59619
|
+
if (!prefix) {
|
|
59620
|
+
tokens++;
|
|
59621
|
+
}
|
|
59287
59622
|
}
|
|
59288
59623
|
return stripped && name.length > 0 ? name : void 0;
|
|
59289
59624
|
}
|
|
@@ -59383,7 +59718,7 @@ function quoteFontName(name) {
|
|
|
59383
59718
|
}
|
|
59384
59719
|
return `"${trimmed2}"`;
|
|
59385
59720
|
}
|
|
59386
|
-
exports.FONT_SUBSTITUTION_MAP = void 0; var FONT_STYLE_SUFFIX_TOKENS; exports.PANOSE_FAMILY_MAP = void 0; exports.PANOSE_SANS_SERIF_STYLES = void 0; exports.PANOSE_MONOSPACE_PROPORTION = void 0; exports.PANOSE_WEIGHT_MAP = void 0; var GENERIC_FAMILY_CONCRETE_FONTS, CSS_GENERIC_FAMILIES;
|
|
59721
|
+
exports.FONT_SUBSTITUTION_MAP = void 0; var FONT_STYLE_SUFFIX_TOKENS, FONT_WEIGHT_PREFIX_TOKENS, FONT_PREFIXED_WEIGHT_TOKENS; exports.PANOSE_FAMILY_MAP = void 0; exports.PANOSE_SANS_SERIF_STYLES = void 0; exports.PANOSE_MONOSPACE_PROPORTION = void 0; exports.PANOSE_WEIGHT_MAP = void 0; var GENERIC_FAMILY_CONCRETE_FONTS, CSS_GENERIC_FAMILIES;
|
|
59387
59722
|
var init_font_substitution = __esm({
|
|
59388
59723
|
"pptx/core/utils/font-substitution.ts"() {
|
|
59389
59724
|
exports.FONT_SUBSTITUTION_MAP = {
|
|
@@ -59571,6 +59906,8 @@ var init_font_substitution = __esm({
|
|
|
59571
59906
|
"italic",
|
|
59572
59907
|
"oblique"
|
|
59573
59908
|
]);
|
|
59909
|
+
FONT_WEIGHT_PREFIX_TOKENS = /* @__PURE__ */ new Set(["semi", "demi", "extra", "ultra"]);
|
|
59910
|
+
FONT_PREFIXED_WEIGHT_TOKENS = /* @__PURE__ */ new Set(["bold", "light", "black"]);
|
|
59574
59911
|
exports.PANOSE_FAMILY_MAP = {
|
|
59575
59912
|
0: "sans-serif",
|
|
59576
59913
|
// Any — default to sans-serif
|
|
@@ -74610,6 +74947,165 @@ var init_inherited_shape_transform = __esm({
|
|
|
74610
74947
|
}
|
|
74611
74948
|
});
|
|
74612
74949
|
|
|
74950
|
+
// pptx/core/utils/placeholder-xml.ts
|
|
74951
|
+
function findNonVisualProps(rawXml) {
|
|
74952
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
74953
|
+
const parent = rawXml[container2];
|
|
74954
|
+
const nvPr = parent?.["p:nvPr"];
|
|
74955
|
+
if (nvPr) {
|
|
74956
|
+
return nvPr;
|
|
74957
|
+
}
|
|
74958
|
+
}
|
|
74959
|
+
return void 0;
|
|
74960
|
+
}
|
|
74961
|
+
function retargetPlaceholder(rawXml, target) {
|
|
74962
|
+
const nvPr = findNonVisualProps(rawXml);
|
|
74963
|
+
if (!nvPr) {
|
|
74964
|
+
return;
|
|
74965
|
+
}
|
|
74966
|
+
const ph = nvPr["p:ph"] ?? {};
|
|
74967
|
+
nvPr["p:ph"] = ph;
|
|
74968
|
+
if (target.type) {
|
|
74969
|
+
ph["@_type"] = target.type;
|
|
74970
|
+
} else {
|
|
74971
|
+
delete ph["@_type"];
|
|
74972
|
+
}
|
|
74973
|
+
if (target.idx !== void 0) {
|
|
74974
|
+
ph["@_idx"] = target.idx;
|
|
74975
|
+
} else {
|
|
74976
|
+
delete ph["@_idx"];
|
|
74977
|
+
}
|
|
74978
|
+
}
|
|
74979
|
+
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
74980
|
+
const spPr = rawXml["p:spPr"];
|
|
74981
|
+
if (!spPr) {
|
|
74982
|
+
return;
|
|
74983
|
+
}
|
|
74984
|
+
const xfrm = spPr["a:xfrm"] ?? {};
|
|
74985
|
+
spPr["a:xfrm"] = xfrm;
|
|
74986
|
+
const off = xfrm["a:off"] ?? {};
|
|
74987
|
+
xfrm["a:off"] = off;
|
|
74988
|
+
off["@_x"] = String(xEmu);
|
|
74989
|
+
off["@_y"] = String(yEmu);
|
|
74990
|
+
const ext = xfrm["a:ext"] ?? {};
|
|
74991
|
+
xfrm["a:ext"] = ext;
|
|
74992
|
+
ext["@_cx"] = String(cxEmu);
|
|
74993
|
+
ext["@_cy"] = String(cyEmu);
|
|
74994
|
+
}
|
|
74995
|
+
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
74996
|
+
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
74997
|
+
return null;
|
|
74998
|
+
}
|
|
74999
|
+
const phNode = {};
|
|
75000
|
+
if (target.type) {
|
|
75001
|
+
phNode["@_type"] = target.type;
|
|
75002
|
+
}
|
|
75003
|
+
if (target.idx !== void 0) {
|
|
75004
|
+
phNode["@_idx"] = target.idx;
|
|
75005
|
+
}
|
|
75006
|
+
const rawXml = {
|
|
75007
|
+
"p:nvSpPr": {
|
|
75008
|
+
"p:cNvPr": {
|
|
75009
|
+
"@_id": uniqueId,
|
|
75010
|
+
"@_name": `Placeholder ${target.type || "content"}`
|
|
75011
|
+
},
|
|
75012
|
+
"p:cNvSpPr": {
|
|
75013
|
+
"a:spLocks": { "@_noGrp": "1" }
|
|
75014
|
+
},
|
|
75015
|
+
"p:nvPr": {
|
|
75016
|
+
"p:ph": phNode
|
|
75017
|
+
}
|
|
75018
|
+
},
|
|
75019
|
+
"p:spPr": {
|
|
75020
|
+
"a:xfrm": {
|
|
75021
|
+
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
75022
|
+
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
75023
|
+
}
|
|
75024
|
+
},
|
|
75025
|
+
"p:txBody": {
|
|
75026
|
+
"a:bodyPr": {},
|
|
75027
|
+
"a:lstStyle": {},
|
|
75028
|
+
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
75029
|
+
}
|
|
75030
|
+
};
|
|
75031
|
+
return {
|
|
75032
|
+
type: "text",
|
|
75033
|
+
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
75034
|
+
x: Math.round(xEmu / exports.EMU_PER_PX),
|
|
75035
|
+
y: Math.round(yEmu / exports.EMU_PER_PX),
|
|
75036
|
+
width: Math.round(cxEmu / exports.EMU_PER_PX),
|
|
75037
|
+
height: Math.round(cyEmu / exports.EMU_PER_PX),
|
|
75038
|
+
text: "",
|
|
75039
|
+
rawXml
|
|
75040
|
+
};
|
|
75041
|
+
}
|
|
75042
|
+
var init_placeholder_xml = __esm({
|
|
75043
|
+
"pptx/core/utils/placeholder-xml.ts"() {
|
|
75044
|
+
init_constants2();
|
|
75045
|
+
}
|
|
75046
|
+
});
|
|
75047
|
+
|
|
75048
|
+
// pptx/core/core/runtime/save-geometry-validation.ts
|
|
75049
|
+
function omitsInheritedFrame(element) {
|
|
75050
|
+
if (!["text", "shape", "picture", "media"].includes(element.type) || !element.rawXml)
|
|
75051
|
+
return false;
|
|
75052
|
+
if (!xmlHasChild(findNonVisualProps(element.rawXml), "p:ph")) return false;
|
|
75053
|
+
if (xmlHasChild(xmlChild(element.rawXml, "p:spPr"), "a:xfrm") || xmlHasChild(element.rawXml, "p:xfrm"))
|
|
75054
|
+
return false;
|
|
75055
|
+
const baseline = element.inheritedTransform;
|
|
75056
|
+
if (!baseline) return FRAME_FIELDS.every((key2) => element[key2] === void 0);
|
|
75057
|
+
return FRAME_FIELDS.every(
|
|
75058
|
+
(key2) => Number.isFinite(baseline[key2]) && (element[key2] === void 0 || element[key2] === baseline[key2])
|
|
75059
|
+
) && ["rotation", "skewX", "skewY", "flipHorizontal", "flipVertical"].every(
|
|
75060
|
+
(key2) => (element[key2] ?? 0) === (baseline[key2] ?? 0)
|
|
75061
|
+
);
|
|
75062
|
+
}
|
|
75063
|
+
function validateElementGeometry(element, context, emuPerPx = 9525) {
|
|
75064
|
+
const inherited = omitsInheritedFrame(element);
|
|
75065
|
+
const record2 = element;
|
|
75066
|
+
const fields = [...inherited ? [] : FRAME_FIELDS, ...OPTIONAL_FIELDS];
|
|
75067
|
+
for (const field of fields) {
|
|
75068
|
+
const value = record2[field];
|
|
75069
|
+
if (OPTIONAL_FIELDS.includes(field) && value === void 0) continue;
|
|
75070
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(value * emuPerPx)) {
|
|
75071
|
+
throw new Error(
|
|
75072
|
+
`${context}: element '${element.id}' (${element.name ?? "unnamed"}, type=${element.type}) has invalid ${field}=${String(value)}; expected a finite number`
|
|
75073
|
+
);
|
|
75074
|
+
}
|
|
75075
|
+
}
|
|
75076
|
+
if (element.type === "group") {
|
|
75077
|
+
for (const child32 of element.children) validateElementGeometry(child32, context, emuPerPx);
|
|
75078
|
+
}
|
|
75079
|
+
}
|
|
75080
|
+
function validateSlideGeometry(slides) {
|
|
75081
|
+
for (const slide of slides) {
|
|
75082
|
+
for (const element of slide.elements) {
|
|
75083
|
+
validateElementGeometry(element, `Slide ${slide.slideNumber} (${slide.id})`);
|
|
75084
|
+
}
|
|
75085
|
+
}
|
|
75086
|
+
}
|
|
75087
|
+
var FRAME_FIELDS, OPTIONAL_FIELDS;
|
|
75088
|
+
var init_save_geometry_validation = __esm({
|
|
75089
|
+
"pptx/core/core/runtime/save-geometry-validation.ts"() {
|
|
75090
|
+
init_placeholder_xml();
|
|
75091
|
+
init_xml_access();
|
|
75092
|
+
FRAME_FIELDS = ["x", "y", "width", "height"];
|
|
75093
|
+
OPTIONAL_FIELDS = [
|
|
75094
|
+
"xEmu",
|
|
75095
|
+
"yEmu",
|
|
75096
|
+
"widthEmu",
|
|
75097
|
+
"heightEmu",
|
|
75098
|
+
"rotation",
|
|
75099
|
+
"skewX",
|
|
75100
|
+
"skewY",
|
|
75101
|
+
"chOffXEmu",
|
|
75102
|
+
"chOffYEmu",
|
|
75103
|
+
"chExtWidthEmu",
|
|
75104
|
+
"chExtHeightEmu"
|
|
75105
|
+
];
|
|
75106
|
+
}
|
|
75107
|
+
});
|
|
75108
|
+
|
|
74613
75109
|
// pptx/core/core/builders/PptxElementTransformUpdater.ts
|
|
74614
75110
|
exports.PptxElementTransformUpdater = void 0;
|
|
74615
75111
|
var init_PptxElementTransformUpdater = __esm({
|
|
@@ -74619,6 +75115,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
74619
75115
|
init_xml_access();
|
|
74620
75116
|
init_group_tight_rewrap();
|
|
74621
75117
|
init_inherited_shape_transform();
|
|
75118
|
+
init_save_geometry_validation();
|
|
74622
75119
|
exports.PptxElementTransformUpdater = class {
|
|
74623
75120
|
applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
|
|
74624
75121
|
const transform7 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"] || // A group's child geometry uses a different frame from the load-time baseline.
|
|
@@ -74626,6 +75123,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
74626
75123
|
if (!transform7) {
|
|
74627
75124
|
return;
|
|
74628
75125
|
}
|
|
75126
|
+
validateElementGeometry(element, "Transform writer", emuPerPx);
|
|
74629
75127
|
if (!transform7["a:off"]) {
|
|
74630
75128
|
transform7["a:off"] = {};
|
|
74631
75129
|
}
|
|
@@ -77660,7 +78158,7 @@ function parseBorderSide(side) {
|
|
|
77660
78158
|
}
|
|
77661
78159
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
77662
78160
|
if (widthEmu > 0) {
|
|
77663
|
-
border.width = Math.max(1, Math.round(widthEmu /
|
|
78161
|
+
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL3));
|
|
77664
78162
|
has2 = true;
|
|
77665
78163
|
}
|
|
77666
78164
|
const prstDash = ln["a:prstDash"];
|
|
@@ -77717,12 +78215,12 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
77717
78215
|
if (bevel2) {
|
|
77718
78216
|
const bevelWidth = parseInt(String(bevel2["@_w"] || "0"), 10);
|
|
77719
78217
|
if (bevelWidth > 0) {
|
|
77720
|
-
cell3D.bevelWidth = Math.round(bevelWidth /
|
|
78218
|
+
cell3D.bevelWidth = Math.round(bevelWidth / EMU_PER_PIXEL3);
|
|
77721
78219
|
hasStyle = true;
|
|
77722
78220
|
}
|
|
77723
78221
|
const bevelHeight = parseInt(String(bevel2["@_h"] || "0"), 10);
|
|
77724
78222
|
if (bevelHeight > 0) {
|
|
77725
|
-
cell3D.bevelHeight = Math.round(bevelHeight /
|
|
78223
|
+
cell3D.bevelHeight = Math.round(bevelHeight / EMU_PER_PIXEL3);
|
|
77726
78224
|
hasStyle = true;
|
|
77727
78225
|
}
|
|
77728
78226
|
const bevelPreset = String(bevel2["@_prst"] || "").trim();
|
|
@@ -77746,11 +78244,11 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
77746
78244
|
}
|
|
77747
78245
|
return hasStyle ? cell3D : void 0;
|
|
77748
78246
|
}
|
|
77749
|
-
var
|
|
78247
|
+
var EMU_PER_PIXEL3, BORDER_SIDES;
|
|
77750
78248
|
var init_table_style_border_parse = __esm({
|
|
77751
78249
|
"pptx/core/core/runtime/table-style-border-parse.ts"() {
|
|
77752
78250
|
init_color_primitives();
|
|
77753
|
-
|
|
78251
|
+
EMU_PER_PIXEL3 = 9525;
|
|
77754
78252
|
BORDER_SIDES = [
|
|
77755
78253
|
"left",
|
|
77756
78254
|
"right",
|
|
@@ -107323,6 +107821,80 @@ var init_factories = __esm({
|
|
|
107323
107821
|
}
|
|
107324
107822
|
});
|
|
107325
107823
|
|
|
107824
|
+
// pptx/core/utils/placeholder-remap.ts
|
|
107825
|
+
function placeholderContentRole(type) {
|
|
107826
|
+
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
107827
|
+
if (TITLE_ROLE.has(declared)) {
|
|
107828
|
+
return "title";
|
|
107829
|
+
}
|
|
107830
|
+
if (CONTENT_ROLE.has(declared)) {
|
|
107831
|
+
return "content";
|
|
107832
|
+
}
|
|
107833
|
+
return declared;
|
|
107834
|
+
}
|
|
107835
|
+
function preferredPlaceholderTypes(element) {
|
|
107836
|
+
switch (element.type) {
|
|
107837
|
+
case "image":
|
|
107838
|
+
case "picture":
|
|
107839
|
+
return ["pic", "obj", "body"];
|
|
107840
|
+
case "chart":
|
|
107841
|
+
return ["chart", "obj", "body"];
|
|
107842
|
+
case "table":
|
|
107843
|
+
return ["tbl", "obj", "body"];
|
|
107844
|
+
case "media":
|
|
107845
|
+
case "model3d":
|
|
107846
|
+
return ["media", "pic", "obj", "body"];
|
|
107847
|
+
case "smartArt":
|
|
107848
|
+
return ["dgm", "obj", "body"];
|
|
107849
|
+
case "text":
|
|
107850
|
+
return ["body", "subtitle", "obj"];
|
|
107851
|
+
default:
|
|
107852
|
+
return ["obj", "body"];
|
|
107853
|
+
}
|
|
107854
|
+
}
|
|
107855
|
+
function scorePlaceholderMatch(element, source, target) {
|
|
107856
|
+
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
107857
|
+
return -1;
|
|
107858
|
+
}
|
|
107859
|
+
const sourceType = normalizeType(source.type);
|
|
107860
|
+
const targetType = normalizeType(target.type);
|
|
107861
|
+
let score = 1;
|
|
107862
|
+
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
107863
|
+
score += 100;
|
|
107864
|
+
}
|
|
107865
|
+
if (sourceType === targetType) {
|
|
107866
|
+
score += 50;
|
|
107867
|
+
}
|
|
107868
|
+
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
107869
|
+
if (preferred >= 0) {
|
|
107870
|
+
score += 30 - preferred * 5;
|
|
107871
|
+
}
|
|
107872
|
+
if (targetType === "obj") {
|
|
107873
|
+
score += 10;
|
|
107874
|
+
}
|
|
107875
|
+
return score;
|
|
107876
|
+
}
|
|
107877
|
+
function normalizeType(type) {
|
|
107878
|
+
return (type ?? "").trim().toLowerCase() || "body";
|
|
107879
|
+
}
|
|
107880
|
+
var TITLE_ROLE, CONTENT_ROLE;
|
|
107881
|
+
var init_placeholder_remap = __esm({
|
|
107882
|
+
"pptx/core/utils/placeholder-remap.ts"() {
|
|
107883
|
+
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
107884
|
+
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
107885
|
+
"body",
|
|
107886
|
+
"obj",
|
|
107887
|
+
"subtitle",
|
|
107888
|
+
"pic",
|
|
107889
|
+
"chart",
|
|
107890
|
+
"tbl",
|
|
107891
|
+
"media",
|
|
107892
|
+
"clipart",
|
|
107893
|
+
"dgm"
|
|
107894
|
+
]);
|
|
107895
|
+
}
|
|
107896
|
+
});
|
|
107897
|
+
|
|
107326
107898
|
// pptx/core/core/runtime/master-save-helpers.ts
|
|
107327
107899
|
function applyHeaderFooterFlagsToNode(root, flags) {
|
|
107328
107900
|
if (!flags || Object.keys(flags).length === 0) {
|
|
@@ -126916,178 +127488,6 @@ var init_chart_user_shapes_serializer = __esm({
|
|
|
126916
127488
|
}
|
|
126917
127489
|
});
|
|
126918
127490
|
|
|
126919
|
-
// pptx/core/utils/placeholder-remap.ts
|
|
126920
|
-
function placeholderContentRole(type) {
|
|
126921
|
-
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
126922
|
-
if (TITLE_ROLE.has(declared)) {
|
|
126923
|
-
return "title";
|
|
126924
|
-
}
|
|
126925
|
-
if (CONTENT_ROLE.has(declared)) {
|
|
126926
|
-
return "content";
|
|
126927
|
-
}
|
|
126928
|
-
return declared;
|
|
126929
|
-
}
|
|
126930
|
-
function preferredPlaceholderTypes(element) {
|
|
126931
|
-
switch (element.type) {
|
|
126932
|
-
case "image":
|
|
126933
|
-
case "picture":
|
|
126934
|
-
return ["pic", "obj", "body"];
|
|
126935
|
-
case "chart":
|
|
126936
|
-
return ["chart", "obj", "body"];
|
|
126937
|
-
case "table":
|
|
126938
|
-
return ["tbl", "obj", "body"];
|
|
126939
|
-
case "media":
|
|
126940
|
-
case "model3d":
|
|
126941
|
-
return ["media", "pic", "obj", "body"];
|
|
126942
|
-
case "smartArt":
|
|
126943
|
-
return ["dgm", "obj", "body"];
|
|
126944
|
-
case "text":
|
|
126945
|
-
return ["body", "subtitle", "obj"];
|
|
126946
|
-
default:
|
|
126947
|
-
return ["obj", "body"];
|
|
126948
|
-
}
|
|
126949
|
-
}
|
|
126950
|
-
function scorePlaceholderMatch(element, source, target) {
|
|
126951
|
-
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
126952
|
-
return -1;
|
|
126953
|
-
}
|
|
126954
|
-
const sourceType = normalizeType(source.type);
|
|
126955
|
-
const targetType = normalizeType(target.type);
|
|
126956
|
-
let score = 1;
|
|
126957
|
-
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
126958
|
-
score += 100;
|
|
126959
|
-
}
|
|
126960
|
-
if (sourceType === targetType) {
|
|
126961
|
-
score += 50;
|
|
126962
|
-
}
|
|
126963
|
-
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
126964
|
-
if (preferred >= 0) {
|
|
126965
|
-
score += 30 - preferred * 5;
|
|
126966
|
-
}
|
|
126967
|
-
if (targetType === "obj") {
|
|
126968
|
-
score += 10;
|
|
126969
|
-
}
|
|
126970
|
-
return score;
|
|
126971
|
-
}
|
|
126972
|
-
function normalizeType(type) {
|
|
126973
|
-
return (type ?? "").trim().toLowerCase() || "body";
|
|
126974
|
-
}
|
|
126975
|
-
var TITLE_ROLE, CONTENT_ROLE;
|
|
126976
|
-
var init_placeholder_remap = __esm({
|
|
126977
|
-
"pptx/core/utils/placeholder-remap.ts"() {
|
|
126978
|
-
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
126979
|
-
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
126980
|
-
"body",
|
|
126981
|
-
"obj",
|
|
126982
|
-
"subtitle",
|
|
126983
|
-
"pic",
|
|
126984
|
-
"chart",
|
|
126985
|
-
"tbl",
|
|
126986
|
-
"media",
|
|
126987
|
-
"clipart",
|
|
126988
|
-
"dgm"
|
|
126989
|
-
]);
|
|
126990
|
-
}
|
|
126991
|
-
});
|
|
126992
|
-
|
|
126993
|
-
// pptx/core/utils/placeholder-xml.ts
|
|
126994
|
-
function findNonVisualProps(rawXml) {
|
|
126995
|
-
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
126996
|
-
const parent = rawXml[container2];
|
|
126997
|
-
const nvPr = parent?.["p:nvPr"];
|
|
126998
|
-
if (nvPr) {
|
|
126999
|
-
return nvPr;
|
|
127000
|
-
}
|
|
127001
|
-
}
|
|
127002
|
-
return void 0;
|
|
127003
|
-
}
|
|
127004
|
-
function retargetPlaceholder(rawXml, target) {
|
|
127005
|
-
const nvPr = findNonVisualProps(rawXml);
|
|
127006
|
-
if (!nvPr) {
|
|
127007
|
-
return;
|
|
127008
|
-
}
|
|
127009
|
-
const ph = nvPr["p:ph"] ?? {};
|
|
127010
|
-
nvPr["p:ph"] = ph;
|
|
127011
|
-
if (target.type) {
|
|
127012
|
-
ph["@_type"] = target.type;
|
|
127013
|
-
} else {
|
|
127014
|
-
delete ph["@_type"];
|
|
127015
|
-
}
|
|
127016
|
-
if (target.idx !== void 0) {
|
|
127017
|
-
ph["@_idx"] = target.idx;
|
|
127018
|
-
} else {
|
|
127019
|
-
delete ph["@_idx"];
|
|
127020
|
-
}
|
|
127021
|
-
}
|
|
127022
|
-
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
127023
|
-
const spPr = rawXml["p:spPr"];
|
|
127024
|
-
if (!spPr) {
|
|
127025
|
-
return;
|
|
127026
|
-
}
|
|
127027
|
-
const xfrm = spPr["a:xfrm"] ?? {};
|
|
127028
|
-
spPr["a:xfrm"] = xfrm;
|
|
127029
|
-
const off = xfrm["a:off"] ?? {};
|
|
127030
|
-
xfrm["a:off"] = off;
|
|
127031
|
-
off["@_x"] = String(xEmu);
|
|
127032
|
-
off["@_y"] = String(yEmu);
|
|
127033
|
-
const ext = xfrm["a:ext"] ?? {};
|
|
127034
|
-
xfrm["a:ext"] = ext;
|
|
127035
|
-
ext["@_cx"] = String(cxEmu);
|
|
127036
|
-
ext["@_cy"] = String(cyEmu);
|
|
127037
|
-
}
|
|
127038
|
-
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
127039
|
-
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
127040
|
-
return null;
|
|
127041
|
-
}
|
|
127042
|
-
const phNode = {};
|
|
127043
|
-
if (target.type) {
|
|
127044
|
-
phNode["@_type"] = target.type;
|
|
127045
|
-
}
|
|
127046
|
-
if (target.idx !== void 0) {
|
|
127047
|
-
phNode["@_idx"] = target.idx;
|
|
127048
|
-
}
|
|
127049
|
-
const rawXml = {
|
|
127050
|
-
"p:nvSpPr": {
|
|
127051
|
-
"p:cNvPr": {
|
|
127052
|
-
"@_id": uniqueId,
|
|
127053
|
-
"@_name": `Placeholder ${target.type || "content"}`
|
|
127054
|
-
},
|
|
127055
|
-
"p:cNvSpPr": {
|
|
127056
|
-
"a:spLocks": { "@_noGrp": "1" }
|
|
127057
|
-
},
|
|
127058
|
-
"p:nvPr": {
|
|
127059
|
-
"p:ph": phNode
|
|
127060
|
-
}
|
|
127061
|
-
},
|
|
127062
|
-
"p:spPr": {
|
|
127063
|
-
"a:xfrm": {
|
|
127064
|
-
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
127065
|
-
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
127066
|
-
}
|
|
127067
|
-
},
|
|
127068
|
-
"p:txBody": {
|
|
127069
|
-
"a:bodyPr": {},
|
|
127070
|
-
"a:lstStyle": {},
|
|
127071
|
-
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
127072
|
-
}
|
|
127073
|
-
};
|
|
127074
|
-
return {
|
|
127075
|
-
type: "text",
|
|
127076
|
-
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
127077
|
-
x: Math.round(xEmu / exports.EMU_PER_PX),
|
|
127078
|
-
y: Math.round(yEmu / exports.EMU_PER_PX),
|
|
127079
|
-
width: Math.round(cxEmu / exports.EMU_PER_PX),
|
|
127080
|
-
height: Math.round(cyEmu / exports.EMU_PER_PX),
|
|
127081
|
-
text: "",
|
|
127082
|
-
rawXml
|
|
127083
|
-
};
|
|
127084
|
-
}
|
|
127085
|
-
var init_placeholder_xml = __esm({
|
|
127086
|
-
"pptx/core/utils/placeholder-xml.ts"() {
|
|
127087
|
-
init_constants2();
|
|
127088
|
-
}
|
|
127089
|
-
});
|
|
127090
|
-
|
|
127091
127491
|
// pptx/core/utils/text-fill-blip.ts
|
|
127092
127492
|
function resolveTextFillBlip(blipFill, lookupTarget, resolveArchivePath, allowExternal) {
|
|
127093
127493
|
const blip = blipFill["a:blip"];
|
|
@@ -146991,8 +147391,8 @@ function mergeBorderSideXml(border, existingSide) {
|
|
|
146991
147391
|
const ln = ensureChild2(existing, "a:ln");
|
|
146992
147392
|
if (border.width !== void 0) {
|
|
146993
147393
|
const currentEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
146994
|
-
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu /
|
|
146995
|
-
ln["@_w"] = String(Math.round(border.width *
|
|
147394
|
+
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu / EMU_PER_PIXEL4)) !== border.width) {
|
|
147395
|
+
ln["@_w"] = String(Math.round(border.width * EMU_PER_PIXEL4));
|
|
146996
147396
|
}
|
|
146997
147397
|
}
|
|
146998
147398
|
if (border.dash) {
|
|
@@ -147048,10 +147448,10 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
147048
147448
|
if (cell3D.bevelWidth !== void 0 || cell3D.bevelHeight !== void 0 || cell3D.bevelPreset !== void 0) {
|
|
147049
147449
|
const bevel2 = {};
|
|
147050
147450
|
if (cell3D.bevelWidth !== void 0) {
|
|
147051
|
-
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth *
|
|
147451
|
+
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth * EMU_PER_PIXEL4));
|
|
147052
147452
|
}
|
|
147053
147453
|
if (cell3D.bevelHeight !== void 0) {
|
|
147054
|
-
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight *
|
|
147454
|
+
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight * EMU_PER_PIXEL4));
|
|
147055
147455
|
}
|
|
147056
147456
|
if (cell3D.bevelPreset) {
|
|
147057
147457
|
bevel2["@_prst"] = cell3D.bevelPreset;
|
|
@@ -147070,12 +147470,12 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
147070
147470
|
}
|
|
147071
147471
|
tcStyle["a:cell3D"] = node;
|
|
147072
147472
|
}
|
|
147073
|
-
var
|
|
147473
|
+
var EMU_PER_PIXEL4, BORDER_SIDE_ORDER, LN_CHILD_ORDER, LN_FILL_KEYS;
|
|
147074
147474
|
var init_table_style_border_write = __esm({
|
|
147075
147475
|
"pptx/core/core/runtime/table-style-border-write.ts"() {
|
|
147076
147476
|
init_xml_reorder();
|
|
147077
147477
|
init_table_style_xml_helpers();
|
|
147078
|
-
|
|
147478
|
+
EMU_PER_PIXEL4 = 9525;
|
|
147079
147479
|
BORDER_SIDE_ORDER = [
|
|
147080
147480
|
"a:left",
|
|
147081
147481
|
"a:right",
|
|
@@ -148013,6 +148413,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
148013
148413
|
init_header_footer_parts();
|
|
148014
148414
|
init_pptx_print_properties();
|
|
148015
148415
|
init_PptxHandlerRuntimeSaveStructuralIds();
|
|
148416
|
+
init_save_geometry_validation();
|
|
148016
148417
|
PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime53 {
|
|
148017
148418
|
/**
|
|
148018
148419
|
* Resolve the effective conformance class for this save operation.
|
|
@@ -148027,6 +148428,19 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
148027
148428
|
return this.isStrictOoxml ? "strict" : "transitional";
|
|
148028
148429
|
}
|
|
148029
148430
|
async save(slides, options) {
|
|
148431
|
+
validateSlideGeometry(slides);
|
|
148432
|
+
const templates = [
|
|
148433
|
+
...options?.slideMasters ?? [],
|
|
148434
|
+
...options?.slideLayouts ?? [],
|
|
148435
|
+
...options?.slideMasters?.flatMap((master) => master.layouts ?? []) ?? [],
|
|
148436
|
+
...options?.notesMaster ? [options.notesMaster] : [],
|
|
148437
|
+
...options?.handoutMaster ? [options.handoutMaster] : []
|
|
148438
|
+
];
|
|
148439
|
+
for (const template of templates) {
|
|
148440
|
+
for (const element of template.elements ?? []) {
|
|
148441
|
+
validateElementGeometry(element, `Template (${template.path})`);
|
|
148442
|
+
}
|
|
148443
|
+
}
|
|
148030
148444
|
if (options?.outputFormat === "ppt") {
|
|
148031
148445
|
return this.saveAsLegacyPpt(
|
|
148032
148446
|
slides,
|
|
@@ -148994,8 +149408,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
148994
149408
|
return this.scanPlaceholderBuckets(spTree, (info) => info?.type === type);
|
|
148995
149409
|
}
|
|
148996
149410
|
/** The layout and master counterparts of a placeholder, unmerged. */
|
|
148997
|
-
findPlaceholderContexts(slidePath, expected) {
|
|
148998
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
149411
|
+
findPlaceholderContexts(slidePath, expected, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
148999
149412
|
if (!layoutPath) {
|
|
149000
149413
|
return {};
|
|
149001
149414
|
}
|
|
@@ -149007,10 +149420,11 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
149007
149420
|
const master = this.findPlaceholderInShapeTree(masterSpTree, expected) ?? this.findSingletonPlaceholderInShapeTree(masterSpTree, expected);
|
|
149008
149421
|
return { layout, master };
|
|
149009
149422
|
}
|
|
149010
|
-
findPlaceholderContext(slidePath, expected) {
|
|
149423
|
+
findPlaceholderContext(slidePath, expected, layoutPath) {
|
|
149011
149424
|
const { layout: layoutContext, master: masterContext } = this.findPlaceholderContexts(
|
|
149012
149425
|
slidePath,
|
|
149013
|
-
expected
|
|
149426
|
+
expected,
|
|
149427
|
+
layoutPath
|
|
149014
149428
|
);
|
|
149015
149429
|
if (!layoutContext) {
|
|
149016
149430
|
return masterContext;
|
|
@@ -149036,8 +149450,8 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
149036
149450
|
* a master `p:sp`), so the layout keeps winning exactly as it does when
|
|
149037
149451
|
* both are shapes.
|
|
149038
149452
|
*/
|
|
149039
|
-
findPlaceholderNode(slidePath, expected) {
|
|
149040
|
-
const { layout, master } = this.findPlaceholderContexts(slidePath, expected);
|
|
149453
|
+
findPlaceholderNode(slidePath, expected, layoutPath) {
|
|
149454
|
+
const { layout, master } = this.findPlaceholderContexts(slidePath, expected, layoutPath);
|
|
149041
149455
|
const firstNode2 = (context) => context?.shape ?? context?.picture ?? context?.graphicFrame;
|
|
149042
149456
|
const layoutNode = firstNode2(layout);
|
|
149043
149457
|
const masterNode = firstNode2(master);
|
|
@@ -149078,8 +149492,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
149078
149492
|
* reference. Checks the layout cache first, then the master cache, and
|
|
149079
149493
|
* merges them so that layout values take priority over master values.
|
|
149080
149494
|
*/
|
|
149081
|
-
lookupPlaceholderDefaults(slidePath, phInfo) {
|
|
149082
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
149495
|
+
lookupPlaceholderDefaults(slidePath, phInfo, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
149083
149496
|
if (!layoutPath) {
|
|
149084
149497
|
return void 0;
|
|
149085
149498
|
}
|
|
@@ -149623,6 +150036,7 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
|
|
|
149623
150036
|
var PptxHandlerRuntime61;
|
|
149624
150037
|
var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
149625
150038
|
"pptx/core/core/runtime/PptxHandlerRuntimeShapeImageFill.ts"() {
|
|
150039
|
+
init_group_parsing_helpers();
|
|
149626
150040
|
init_xml_access();
|
|
149627
150041
|
init_group_shape_geometry();
|
|
149628
150042
|
init_PptxHandlerRuntimeGeometryParsing();
|
|
@@ -149794,6 +150208,53 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
|
149794
150208
|
return null;
|
|
149795
150209
|
}
|
|
149796
150210
|
}
|
|
150211
|
+
/**
|
|
150212
|
+
* A text-bearing shape whose picture fill is inherited from its layout or
|
|
150213
|
+
* master placeholder (`a:blipFill` absent from its own `spPr`) gets
|
|
150214
|
+
* `fillMode: 'image'` from the merged properties but no image: the blip's
|
|
150215
|
+
* relationship id belongs to the part that authored it, not the slide.
|
|
150216
|
+
* Resolve it against the layout's, then the master's, relationships.
|
|
150217
|
+
*/
|
|
150218
|
+
async resolveInheritedFillImage(element, shape, slidePath) {
|
|
150219
|
+
const style = element?.shapeStyle;
|
|
150220
|
+
if (!element || !style || style.fillMode !== "image" || style.fillImageUrl) {
|
|
150221
|
+
return;
|
|
150222
|
+
}
|
|
150223
|
+
const placeholderInfo = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
150224
|
+
const inherited = placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
150225
|
+
const effectiveSpPr = this.mergeXmlObjects(
|
|
150226
|
+
inherited?.shape?.["p:spPr"],
|
|
150227
|
+
xmlChild(shape, "p:spPr")
|
|
150228
|
+
);
|
|
150229
|
+
const blipFill = effectiveSpPr?.["a:blipFill"];
|
|
150230
|
+
const blip = blipFill?.["a:blip"];
|
|
150231
|
+
const relId = String(blip?.["@_r:embed"] ?? blip?.["@_r:link"] ?? "");
|
|
150232
|
+
if (!relId) {
|
|
150233
|
+
return;
|
|
150234
|
+
}
|
|
150235
|
+
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
150236
|
+
const masterPath = layoutPath ? this.resolveMasterPathForLayout(layoutPath) : void 0;
|
|
150237
|
+
for (const partPath of [layoutPath, masterPath]) {
|
|
150238
|
+
if (!partPath || !this.slideRelsMap.get(partPath)?.has(relId)) {
|
|
150239
|
+
continue;
|
|
150240
|
+
}
|
|
150241
|
+
const fill = await resolveGroupFillImagePure(
|
|
150242
|
+
this,
|
|
150243
|
+
blipFill,
|
|
150244
|
+
partPath
|
|
150245
|
+
);
|
|
150246
|
+
if (fill) {
|
|
150247
|
+
const isUrl = /^(?:data:|blob:|https?:)/u.test(fill.fillImageUrl);
|
|
150248
|
+
const decoded = isUrl ? void 0 : await this.getImageData(fill.fillImageUrl);
|
|
150249
|
+
style.fillImageUrl = decoded ?? fill.fillImageUrl;
|
|
150250
|
+
style.fillImageMode = fill.fillImageMode;
|
|
150251
|
+
if (element.type === "text") {
|
|
150252
|
+
element.type = "shape";
|
|
150253
|
+
}
|
|
150254
|
+
}
|
|
150255
|
+
return;
|
|
150256
|
+
}
|
|
150257
|
+
}
|
|
149797
150258
|
textVerticalAlignFromDrawingValue(value) {
|
|
149798
150259
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
149799
150260
|
if (normalized.length === 0) {
|
|
@@ -151258,14 +151719,14 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
151258
151719
|
init_element_paragraph_geometry();
|
|
151259
151720
|
init_PptxHandlerRuntimeShapeParagraphContentParsing();
|
|
151260
151721
|
PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime66 {
|
|
151261
|
-
parseShape(shape, id, slidePath) {
|
|
151722
|
+
parseShape(shape, id, slidePath, layoutPath) {
|
|
151262
151723
|
try {
|
|
151263
151724
|
const spPr = shape["p:spPr"];
|
|
151264
151725
|
const slideRelationshipMap = slidePath ? this.slideRelsMap.get(slidePath) : void 0;
|
|
151265
151726
|
const placeholderInfo = this.extractPlaceholderInfo(
|
|
151266
151727
|
shape?.["p:nvSpPr"]?.["p:nvPr"]
|
|
151267
151728
|
);
|
|
151268
|
-
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
151729
|
+
const inheritedPlaceholder = (slidePath || layoutPath) && placeholderInfo ? this.findPlaceholderContext(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
151269
151730
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
151270
151731
|
const effectiveSpPr = spPr ? {
|
|
151271
151732
|
...spPr,
|
|
@@ -151391,7 +151852,7 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
151391
151852
|
);
|
|
151392
151853
|
const linkedTxbxId = bodyPropResult.linkedTxbxId;
|
|
151393
151854
|
const linkedTxbxSeq = bodyPropResult.linkedTxbxSeq;
|
|
151394
|
-
const phDefaults = slidePath && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath, placeholderInfo) : void 0;
|
|
151855
|
+
const phDefaults = (slidePath || layoutPath) && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
151395
151856
|
if (phDefaults) {
|
|
151396
151857
|
this.applyPlaceholderBodyDefaults(textStyle, phDefaults);
|
|
151397
151858
|
}
|
|
@@ -152268,7 +152729,9 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
152268
152729
|
slidePath
|
|
152269
152730
|
);
|
|
152270
152731
|
}
|
|
152271
|
-
|
|
152732
|
+
const parsed = this.parseShape(node, `${idPrefix}shape-${indexInType}`, slidePath);
|
|
152733
|
+
await this.resolveInheritedFillImage(parsed, node, slidePath);
|
|
152734
|
+
return parsed;
|
|
152272
152735
|
}
|
|
152273
152736
|
case "p:pic":
|
|
152274
152737
|
return this.parsePicture(node, `${idPrefix}pic-${indexInType}`, slidePath);
|
|
@@ -160754,14 +161217,199 @@ var init_PptxHandlerRuntimeBackgroundStyles = __esm({
|
|
|
160754
161217
|
};
|
|
160755
161218
|
}
|
|
160756
161219
|
});
|
|
161220
|
+
|
|
161221
|
+
// pptx/core/core/runtime/sdk-placeholder.ts
|
|
161222
|
+
function selectTextPlaceholder(input, type, options, slots) {
|
|
161223
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(type.toLowerCase())) {
|
|
161224
|
+
throw new Error(`Unsupported text placeholder type: ${type}`);
|
|
161225
|
+
}
|
|
161226
|
+
if (options.idx !== void 0 && (!Number.isInteger(options.idx) || options.idx < 0 || options.idx > 4294967295)) {
|
|
161227
|
+
throw new Error("Placeholder idx must be an unsigned 32-bit integer");
|
|
161228
|
+
}
|
|
161229
|
+
const source = {
|
|
161230
|
+
type: type.toLowerCase(),
|
|
161231
|
+
...options.idx !== void 0 ? { idx: String(options.idx) } : {}
|
|
161232
|
+
};
|
|
161233
|
+
let best;
|
|
161234
|
+
let bestScore = 0;
|
|
161235
|
+
for (const slot of slots) {
|
|
161236
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(slot.phInfo.type ?? "obj")) continue;
|
|
161237
|
+
if (source.idx !== void 0 && source.idx !== (slot.phInfo.idx ?? "0")) continue;
|
|
161238
|
+
const score = scorePlaceholderMatch(input, source, slot.phInfo);
|
|
161239
|
+
if (score > bestScore) {
|
|
161240
|
+
best = slot;
|
|
161241
|
+
bestScore = score;
|
|
161242
|
+
}
|
|
161243
|
+
}
|
|
161244
|
+
return best ? { type: canonicalPlaceholderType(best.phInfo.type ?? "obj"), idx: best.phInfo.idx } : { type: canonicalPlaceholderType(source.type), idx: source.idx };
|
|
161245
|
+
}
|
|
161246
|
+
function withoutFallbackLanguage(properties) {
|
|
161247
|
+
const { "@_lang": language, ...rest } = properties;
|
|
161248
|
+
if (language !== "en-US") return properties;
|
|
161249
|
+
const keys = Object.keys(rest);
|
|
161250
|
+
return keys.length === 0 || keys.length === 1 && rest["@_dirty"] === "0" ? void 0 : rest;
|
|
161251
|
+
}
|
|
161252
|
+
function stripFallbackLanguage(node, key2) {
|
|
161253
|
+
const properties = node[key2];
|
|
161254
|
+
if (!properties || typeof properties !== "object") return node;
|
|
161255
|
+
const next = withoutFallbackLanguage(properties);
|
|
161256
|
+
if (next === properties) return node;
|
|
161257
|
+
const result = {};
|
|
161258
|
+
for (const [name, value] of Object.entries(node)) {
|
|
161259
|
+
if (name !== key2) result[name] = value;
|
|
161260
|
+
else if (next) result[name] = next;
|
|
161261
|
+
}
|
|
161262
|
+
return result;
|
|
161263
|
+
}
|
|
161264
|
+
function withoutFallbackLanguages(paragraphs) {
|
|
161265
|
+
return paragraphs.map((paragraph) => {
|
|
161266
|
+
const next = { ...stripFallbackLanguage(paragraph, "a:endParaRPr") };
|
|
161267
|
+
for (const child32 of ["a:r", "a:br", "a:fld"]) {
|
|
161268
|
+
const nodes = next[child32];
|
|
161269
|
+
if (nodes === void 0) continue;
|
|
161270
|
+
next[child32] = Array.isArray(nodes) ? nodes.map((node) => stripFallbackLanguage(node, "a:rPr")) : stripFallbackLanguage(nodes, "a:rPr");
|
|
161271
|
+
}
|
|
161272
|
+
return next;
|
|
161273
|
+
});
|
|
161274
|
+
}
|
|
161275
|
+
function placeholderShape2(identity, paragraphs) {
|
|
161276
|
+
paragraphs = withoutFallbackLanguages(paragraphs);
|
|
161277
|
+
return {
|
|
161278
|
+
"p:nvSpPr": {
|
|
161279
|
+
"p:cNvPr": { "@_id": "2", "@_name": `Placeholder ${identity.type}` },
|
|
161280
|
+
"p:cNvSpPr": { "a:spLocks": { "@_noGrp": "1" } },
|
|
161281
|
+
"p:nvPr": {
|
|
161282
|
+
"p:ph": {
|
|
161283
|
+
"@_type": identity.type,
|
|
161284
|
+
...identity.idx !== void 0 ? { "@_idx": identity.idx } : {}
|
|
161285
|
+
}
|
|
161286
|
+
}
|
|
161287
|
+
},
|
|
161288
|
+
"p:spPr": {},
|
|
161289
|
+
"p:txBody": { "a:bodyPr": {}, "a:lstStyle": {}, "a:p": paragraphs }
|
|
161290
|
+
};
|
|
161291
|
+
}
|
|
161292
|
+
function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeFrame = false) {
|
|
161293
|
+
for (const key2 of ["x", "y", "width", "height"]) {
|
|
161294
|
+
if (options[key2] !== void 0 && !Number.isFinite(options[key2])) {
|
|
161295
|
+
throw new Error(`Invalid placeholder frame for ${key2}: expected a finite number`);
|
|
161296
|
+
}
|
|
161297
|
+
}
|
|
161298
|
+
const off = xmlPath(inherited, "p:spPr", "a:xfrm", "a:off");
|
|
161299
|
+
const ext = xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext");
|
|
161300
|
+
const frame2 = {
|
|
161301
|
+
x: options.x ?? (off?.["@_x"] !== void 0 ? Number(off["@_x"]) / emuPerPx : void 0),
|
|
161302
|
+
y: options.y ?? (off?.["@_y"] !== void 0 ? Number(off["@_y"]) / emuPerPx : void 0),
|
|
161303
|
+
width: options.width ?? (ext?.["@_cx"] !== void 0 ? Number(ext["@_cx"]) / emuPerPx : void 0),
|
|
161304
|
+
height: options.height ?? (ext?.["@_cy"] !== void 0 ? Number(ext["@_cy"]) / emuPerPx : void 0)
|
|
161305
|
+
};
|
|
161306
|
+
for (const [key2, value] of Object.entries(frame2)) {
|
|
161307
|
+
if (!Number.isFinite(value)) {
|
|
161308
|
+
throw new Error(
|
|
161309
|
+
`No matching placeholder frame for ${key2}; supply a complete explicit frame or choose a layout containing this slot`
|
|
161310
|
+
);
|
|
161311
|
+
}
|
|
161312
|
+
}
|
|
161313
|
+
if (materializeFrame || ["x", "y", "width", "height"].some((key2) => options[key2] !== void 0)) {
|
|
161314
|
+
setRawXmlTransform(
|
|
161315
|
+
shape,
|
|
161316
|
+
...["x", "y", "width", "height"].map(
|
|
161317
|
+
(key2) => Math.round(frame2[key2] * emuPerPx)
|
|
161318
|
+
)
|
|
161319
|
+
);
|
|
161320
|
+
}
|
|
161321
|
+
}
|
|
161322
|
+
var TEXT_PLACEHOLDER_TYPES;
|
|
161323
|
+
var init_sdk_placeholder = __esm({
|
|
161324
|
+
"pptx/core/core/runtime/sdk-placeholder.ts"() {
|
|
161325
|
+
init_placeholder_remap();
|
|
161326
|
+
init_placeholder_xml();
|
|
161327
|
+
init_placeholder_validation();
|
|
161328
|
+
init_xml_access();
|
|
161329
|
+
TEXT_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
|
|
161330
|
+
"title",
|
|
161331
|
+
"ctrtitle",
|
|
161332
|
+
"subtitle",
|
|
161333
|
+
"body",
|
|
161334
|
+
"obj",
|
|
161335
|
+
"dt",
|
|
161336
|
+
"ftr",
|
|
161337
|
+
"hdr",
|
|
161338
|
+
"sldnum"
|
|
161339
|
+
]);
|
|
161340
|
+
}
|
|
161341
|
+
});
|
|
161342
|
+
|
|
161343
|
+
// pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
|
|
160757
161344
|
var PptxHandlerRuntime103;
|
|
161345
|
+
var init_PptxHandlerRuntimeSdkPlaceholders = __esm({
|
|
161346
|
+
"pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts"() {
|
|
161347
|
+
init_placeholder_remap();
|
|
161348
|
+
init_xml_access();
|
|
161349
|
+
init_PptxHandlerRuntimeBackgroundStyles();
|
|
161350
|
+
init_sdk_placeholder();
|
|
161351
|
+
PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
|
|
161352
|
+
createPlaceholderElement(layoutPath, input, type, options) {
|
|
161353
|
+
if (input.type !== "text") throw new Error("Placeholder input must be text");
|
|
161354
|
+
const layout = this.layoutXmlMap.get(layoutPath);
|
|
161355
|
+
if (!layout) throw new Error(`Unknown layout: ${layoutPath}`);
|
|
161356
|
+
const identity = selectTextPlaceholder(
|
|
161357
|
+
input,
|
|
161358
|
+
type,
|
|
161359
|
+
options,
|
|
161360
|
+
this.extractLayoutPlaceholders(layout, layoutPath)
|
|
161361
|
+
);
|
|
161362
|
+
const shape = placeholderShape2(
|
|
161363
|
+
identity,
|
|
161364
|
+
this.createParagraphsFromTextContent(input.text, void 0, input.textSegments)
|
|
161365
|
+
);
|
|
161366
|
+
const inherited = this.findPlaceholderNode(
|
|
161367
|
+
"",
|
|
161368
|
+
{ type: identity.type.toLowerCase(), idx: identity.idx },
|
|
161369
|
+
layoutPath
|
|
161370
|
+
);
|
|
161371
|
+
const fallback = this.sdkMasterFrame(layoutPath, identity.type, identity.idx, inherited);
|
|
161372
|
+
applyPlaceholderFrame(
|
|
161373
|
+
shape,
|
|
161374
|
+
fallback ?? inherited,
|
|
161375
|
+
options,
|
|
161376
|
+
_PptxHandlerRuntime.EMU_PER_PX,
|
|
161377
|
+
fallback !== void 0
|
|
161378
|
+
);
|
|
161379
|
+
const element = this.parseShape(shape, input.id, void 0, layoutPath);
|
|
161380
|
+
if (!element) throw new Error("Unable to resolve placeholder content");
|
|
161381
|
+
if ((element.type === "text" || element.type === "shape") && !element.textStyle && element.textSegments?.[0]?.style) {
|
|
161382
|
+
element.textStyle = { ...element.textSegments[0].style };
|
|
161383
|
+
}
|
|
161384
|
+
return element;
|
|
161385
|
+
}
|
|
161386
|
+
sdkMasterFrame(layoutPath, type, idx, inherited) {
|
|
161387
|
+
if (!inherited) return void 0;
|
|
161388
|
+
if (xmlPath(inherited, "p:spPr", "a:xfrm", "a:off") && xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext"))
|
|
161389
|
+
return void 0;
|
|
161390
|
+
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
161391
|
+
const tree = masterPath ? xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree") : void 0;
|
|
161392
|
+
const role = placeholderContentRole(type.toLowerCase());
|
|
161393
|
+
const candidates = this.ensureArray(tree?.["p:sp"]).filter((shape) => {
|
|
161394
|
+
const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
161395
|
+
return info && placeholderContentRole(info.type) === role;
|
|
161396
|
+
});
|
|
161397
|
+
const master = candidates.find(
|
|
161398
|
+
(shape) => this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"))?.idx === idx
|
|
161399
|
+
) ?? candidates[0];
|
|
161400
|
+
return master ? this.mergeXmlObjects(master, inherited) : void 0;
|
|
161401
|
+
}
|
|
161402
|
+
};
|
|
161403
|
+
}
|
|
161404
|
+
});
|
|
161405
|
+
var PptxHandlerRuntime104;
|
|
160758
161406
|
var init_PptxHandlerRuntimeImplementation = __esm({
|
|
160759
161407
|
"pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts"() {
|
|
160760
161408
|
init_PptxElementXmlBuilder();
|
|
160761
161409
|
init_builders();
|
|
160762
161410
|
init_factories();
|
|
160763
|
-
|
|
160764
|
-
|
|
161411
|
+
init_PptxHandlerRuntimeSdkPlaceholders();
|
|
161412
|
+
PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
|
|
160765
161413
|
constructor(dependencyFactory = new exports.PptxRuntimeDependencyFactory()) {
|
|
160766
161414
|
super();
|
|
160767
161415
|
this.dependencyFactory = dependencyFactory;
|
|
@@ -160905,7 +161553,7 @@ exports.PptxHandlerRuntime = void 0;
|
|
|
160905
161553
|
var init_PptxHandlerRuntime = __esm({
|
|
160906
161554
|
"pptx/core/core/PptxHandlerRuntime.ts"() {
|
|
160907
161555
|
init_PptxHandlerRuntimeImplementation();
|
|
160908
|
-
exports.PptxHandlerRuntime = class extends
|
|
161556
|
+
exports.PptxHandlerRuntime = class extends PptxHandlerRuntime104 {
|
|
160909
161557
|
};
|
|
160910
161558
|
}
|
|
160911
161559
|
});
|
|
@@ -163669,7 +164317,7 @@ function slideMasterXml2(deck, ctx) {
|
|
|
163669
164317
|
</p:txStyles>
|
|
163670
164318
|
</p:sldMaster>`;
|
|
163671
164319
|
}
|
|
163672
|
-
function
|
|
164320
|
+
function slideLayoutXml() {
|
|
163673
164321
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
163674
164322
|
<p:sldLayout ${XMLNS2} type="blank" preserve="1">
|
|
163675
164323
|
<p:cSld name="Blank">
|
|
@@ -163989,7 +164637,7 @@ async function buildPptxPackage(deck) {
|
|
|
163989
164637
|
${masterRels.join("\n")}
|
|
163990
164638
|
</Relationships>`
|
|
163991
164639
|
);
|
|
163992
|
-
zip.file("ppt/slideLayouts/slideLayout1.xml",
|
|
164640
|
+
zip.file("ppt/slideLayouts/slideLayout1.xml", slideLayoutXml());
|
|
163993
164641
|
zip.file(
|
|
163994
164642
|
"ppt/slideLayouts/_rels/slideLayout1.xml.rels",
|
|
163995
164643
|
`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -164207,6 +164855,13 @@ var init_PptxHandlerCore = __esm({
|
|
|
164207
164855
|
getLayoutOptions() {
|
|
164208
164856
|
return this.runtime.getLayoutOptions();
|
|
164209
164857
|
}
|
|
164858
|
+
/** Resolve a text placeholder in this loaded deck, preserving layout inheritance. */
|
|
164859
|
+
createPlaceholderElement(layoutPath, input, type, options = {}) {
|
|
164860
|
+
if (!this.runtime.createPlaceholderElement) {
|
|
164861
|
+
throw new Error("This runtime does not support creating layout placeholders");
|
|
164862
|
+
}
|
|
164863
|
+
return this.runtime.createPlaceholderElement(layoutPath, input, type, options);
|
|
164864
|
+
}
|
|
164210
164865
|
/**
|
|
164211
164866
|
* Build the artwork thumbnails backing the New Slide / Layout galleries.
|
|
164212
164867
|
*
|
|
@@ -166292,7 +166947,9 @@ var Presentation = class _Presentation {
|
|
|
166292
166947
|
data,
|
|
166293
166948
|
createSlide: (layoutName) => {
|
|
166294
166949
|
const slideNum = data.slides.length + 1;
|
|
166295
|
-
|
|
166950
|
+
const layouts = handler.getLayoutOptions();
|
|
166951
|
+
const layout = layouts.find((item) => item.name === layoutName) ?? layouts.find((item) => item.name === "Blank") ?? layouts[0];
|
|
166952
|
+
return new exports.SlideBuilder(slideNum, layout?.path, layout?.name ?? layoutName, handler);
|
|
166296
166953
|
}
|
|
166297
166954
|
});
|
|
166298
166955
|
}
|
|
@@ -167419,199 +168076,12 @@ function addChartUserShapeGroupChild(element, groupPath, child32) {
|
|
|
167419
168076
|
});
|
|
167420
168077
|
}
|
|
167421
168078
|
|
|
167422
|
-
// pptx/core/builders/sdk/
|
|
167423
|
-
|
|
167424
|
-
init_xml_utils();
|
|
167425
|
-
init_PptxHandler();
|
|
167426
|
-
var EMU_PER_PIXEL4 = 9525;
|
|
167427
|
-
function pxToEmu(px3) {
|
|
167428
|
-
return Math.round(px3 * EMU_PER_PIXEL4);
|
|
167429
|
-
}
|
|
167430
|
-
function placeholderSpXml(ph, shapeId) {
|
|
167431
|
-
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
167432
|
-
const x = pxToEmu(ph.x);
|
|
167433
|
-
const y = pxToEmu(ph.y);
|
|
167434
|
-
const cx = pxToEmu(ph.width);
|
|
167435
|
-
const cy = pxToEmu(ph.height);
|
|
167436
|
-
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
167437
|
-
return ` <p:sp>
|
|
167438
|
-
<p:nvSpPr>
|
|
167439
|
-
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
167440
|
-
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
167441
|
-
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
167442
|
-
</p:nvSpPr>
|
|
167443
|
-
<p:spPr>
|
|
167444
|
-
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
167445
|
-
</p:spPr>
|
|
167446
|
-
<p:txBody>
|
|
167447
|
-
<a:bodyPr/>
|
|
167448
|
-
<a:lstStyle/>
|
|
167449
|
-
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
167450
|
-
</p:txBody>
|
|
167451
|
-
</p:sp>`;
|
|
167452
|
-
}
|
|
167453
|
-
function normalizeSrgbHex2(color2) {
|
|
167454
|
-
if (!color2) {
|
|
167455
|
-
return void 0;
|
|
167456
|
-
}
|
|
167457
|
-
const raw = color2.trim().replace(/^#/, "").toUpperCase();
|
|
167458
|
-
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
167459
|
-
return raw;
|
|
167460
|
-
}
|
|
167461
|
-
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
167462
|
-
return raw.replace(/./g, (ch) => ch + ch);
|
|
167463
|
-
}
|
|
167464
|
-
return void 0;
|
|
167465
|
-
}
|
|
167466
|
-
function generateLayoutXml(definition) {
|
|
167467
|
-
const layoutType = definition.type ?? "obj";
|
|
167468
|
-
const placeholders = definition.placeholders ?? [];
|
|
167469
|
-
const phShapes = placeholders.map((ph, i2) => placeholderSpXml(ph, i2 + 2)).join("\n");
|
|
167470
|
-
let bgXml = "";
|
|
167471
|
-
const hex3 = normalizeSrgbHex2(definition.backgroundColor);
|
|
167472
|
-
if (hex3) {
|
|
167473
|
-
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
167474
|
-
`;
|
|
167475
|
-
}
|
|
167476
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
167477
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
167478
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
167479
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
167480
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
167481
|
-
<p:cSld name="${escAttr(definition.name)}">
|
|
167482
|
-
${bgXml} <p:spTree>
|
|
167483
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
167484
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
167485
|
-
${phShapes}
|
|
167486
|
-
</p:spTree>
|
|
167487
|
-
</p:cSld>
|
|
167488
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
167489
|
-
</p:sldLayout>`;
|
|
167490
|
-
}
|
|
167491
|
-
function layoutRelsXml(masterIndex = 1) {
|
|
167492
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
167493
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
167494
|
-
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster${masterIndex}.xml"/>
|
|
167495
|
-
</Relationships>`;
|
|
167496
|
-
}
|
|
167497
|
-
function countExistingLayouts(zip) {
|
|
167498
|
-
let count = 0;
|
|
167499
|
-
zip.forEach((relativePath) => {
|
|
167500
|
-
if (/^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(relativePath)) {
|
|
167501
|
-
count++;
|
|
167502
|
-
}
|
|
167503
|
-
});
|
|
167504
|
-
return count;
|
|
167505
|
-
}
|
|
167506
|
-
async function addLayoutToSlideMaster(zip, layoutIndex2, masterIndex = 1) {
|
|
167507
|
-
const masterRelsPath = `ppt/slideMasters/_rels/slideMaster${masterIndex}.xml.rels`;
|
|
167508
|
-
const masterRelsContent = await zip.file(masterRelsPath)?.async("string");
|
|
167509
|
-
if (!masterRelsContent) {
|
|
167510
|
-
throw new Error(`Slide master rels not found at ${masterRelsPath}`);
|
|
167511
|
-
}
|
|
167512
|
-
const rIdMatches = [...masterRelsContent.matchAll(/rId(\d+)/g)];
|
|
167513
|
-
const maxRId = rIdMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 0);
|
|
167514
|
-
const newRId = `rId${maxRId + 1}`;
|
|
167515
|
-
const newRel = ` <Relationship Id="${newRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout${layoutIndex2}.xml"/>`;
|
|
167516
|
-
const updatedRels = masterRelsContent.replace("</Relationships>", `${newRel}
|
|
167517
|
-
</Relationships>`);
|
|
167518
|
-
zip.file(masterRelsPath, updatedRels);
|
|
167519
|
-
const masterPath = `ppt/slideMasters/slideMaster${masterIndex}.xml`;
|
|
167520
|
-
const masterContent = await zip.file(masterPath)?.async("string");
|
|
167521
|
-
if (!masterContent) {
|
|
167522
|
-
throw new Error(`Slide master not found at ${masterPath}`);
|
|
167523
|
-
}
|
|
167524
|
-
const idMatches = [...masterContent.matchAll(/sldLayoutId\s+id="(\d+)"/g)];
|
|
167525
|
-
const maxLayoutId = idMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 2147483648);
|
|
167526
|
-
const newLayoutId = maxLayoutId + 1;
|
|
167527
|
-
const newLayoutIdEntry = ` <p:sldLayoutId id="${newLayoutId}" r:id="${newRId}"/>`;
|
|
167528
|
-
const updatedMaster = masterContent.replace(
|
|
167529
|
-
"</p:sldLayoutIdLst>",
|
|
167530
|
-
`${newLayoutIdEntry}
|
|
167531
|
-
</p:sldLayoutIdLst>`
|
|
167532
|
-
);
|
|
167533
|
-
zip.file(masterPath, updatedMaster);
|
|
167534
|
-
}
|
|
167535
|
-
async function addLayoutContentType(zip, layoutIndex2) {
|
|
167536
|
-
const ctPath = "[Content_Types].xml";
|
|
167537
|
-
const ctContent = await zip.file(ctPath)?.async("string");
|
|
167538
|
-
if (!ctContent) {
|
|
167539
|
-
throw new Error("Content types file not found");
|
|
167540
|
-
}
|
|
167541
|
-
const override = ` <Override PartName="/ppt/slideLayouts/slideLayout${layoutIndex2}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
|
|
167542
|
-
const updatedCt = ctContent.replace("</Types>", `${override}
|
|
167543
|
-
</Types>`);
|
|
167544
|
-
zip.file(ctPath, updatedCt);
|
|
167545
|
-
}
|
|
167546
|
-
async function createLayout(handler, data, definition, masterIndex = 1) {
|
|
167547
|
-
const bytes = await handler.save(data.slides);
|
|
167548
|
-
const zip = await openPptxZip(bytes);
|
|
167549
|
-
const existingCount = countExistingLayouts(zip);
|
|
167550
|
-
const newIndex = existingCount + 1;
|
|
167551
|
-
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
167552
|
-
zip.file(layoutPath, generateLayoutXml(definition));
|
|
167553
|
-
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
167554
|
-
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
167555
|
-
await addLayoutContentType(zip, newIndex);
|
|
167556
|
-
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
167557
|
-
const newHandler = new exports.PptxHandler();
|
|
167558
|
-
const newData = await newHandler.load(updatedBuffer);
|
|
167559
|
-
return {
|
|
167560
|
-
layoutPath,
|
|
167561
|
-
layoutName: definition.name,
|
|
167562
|
-
handler: newHandler,
|
|
167563
|
-
data: newData
|
|
167564
|
-
};
|
|
167565
|
-
}
|
|
167566
|
-
async function createLayouts(handler, data, definitions, masterIndex = 1) {
|
|
167567
|
-
if (definitions.length === 0) {
|
|
167568
|
-
return { layoutPaths: [], handler, data };
|
|
167569
|
-
}
|
|
167570
|
-
const bytes = await handler.save(data.slides);
|
|
167571
|
-
const zip = await openPptxZip(bytes);
|
|
167572
|
-
const existingCount = countExistingLayouts(zip);
|
|
167573
|
-
const layoutPaths = [];
|
|
167574
|
-
for (let i2 = 0; i2 < definitions.length; i2++) {
|
|
167575
|
-
const def = definitions[i2];
|
|
167576
|
-
const newIndex = existingCount + i2 + 1;
|
|
167577
|
-
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
167578
|
-
zip.file(layoutPath, generateLayoutXml(def));
|
|
167579
|
-
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
167580
|
-
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
167581
|
-
await addLayoutContentType(zip, newIndex);
|
|
167582
|
-
layoutPaths.push(layoutPath);
|
|
167583
|
-
}
|
|
167584
|
-
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
167585
|
-
const newHandler = new exports.PptxHandler();
|
|
167586
|
-
const newData = await newHandler.load(updatedBuffer);
|
|
167587
|
-
return { layoutPaths, handler: newHandler, data: newData };
|
|
167588
|
-
}
|
|
167589
|
-
function findLayoutByName(data, name) {
|
|
167590
|
-
const lowerName = name.toLowerCase();
|
|
167591
|
-
const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
|
|
167592
|
-
if (fromOptions) {
|
|
167593
|
-
return fromOptions;
|
|
167594
|
-
}
|
|
167595
|
-
if (data.slideMasters) {
|
|
167596
|
-
for (const master of data.slideMasters) {
|
|
167597
|
-
const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
|
|
167598
|
-
if (layout) {
|
|
167599
|
-
return { path: layout.path, name: layout.name ?? name };
|
|
167600
|
-
}
|
|
167601
|
-
}
|
|
167602
|
-
}
|
|
167603
|
-
return void 0;
|
|
167604
|
-
}
|
|
167605
|
-
function findLayoutByType(data, type) {
|
|
167606
|
-
const fromOptions = data.layoutOptions?.find((l) => l.type === type);
|
|
167607
|
-
if (fromOptions) {
|
|
167608
|
-
return fromOptions;
|
|
167609
|
-
}
|
|
167610
|
-
return void 0;
|
|
167611
|
-
}
|
|
168079
|
+
// pptx/core/builders/sdk/index.ts
|
|
168080
|
+
init_layout_operations();
|
|
167612
168081
|
|
|
167613
168082
|
// pptx/core/builders/sdk/master-layout-crud-layout.ts
|
|
167614
168083
|
init_PptxHandler();
|
|
168084
|
+
init_layout_operations();
|
|
167615
168085
|
|
|
167616
168086
|
// pptx/core/builders/sdk/master-layout-crud-lookup.ts
|
|
167617
168087
|
var NOT_FOUND = { ok: false, reason: "notFound" };
|
|
@@ -167915,6 +168385,7 @@ async function insertLayout(handler, data, masterId, definition) {
|
|
|
167915
168385
|
|
|
167916
168386
|
// pptx/core/builders/sdk/master-layout-crud-master.ts
|
|
167917
168387
|
init_PptxHandler();
|
|
168388
|
+
init_layout_operations();
|
|
167918
168389
|
init_PresentationBuilder();
|
|
167919
168390
|
async function duplicateSlideMaster(handler, data, masterId) {
|
|
167920
168391
|
const source = findMaster(data, masterId);
|