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
|
@@ -4180,13 +4180,14 @@ var init_SlideBuilder = __esm({
|
|
|
4180
4180
|
"pptx/core/builders/sdk/SlideBuilder.ts"() {
|
|
4181
4181
|
init_ElementFactory();
|
|
4182
4182
|
SlideBuilder = class {
|
|
4183
|
-
slide;
|
|
4184
4183
|
/**
|
|
4185
4184
|
* @param slideNumber - 1-based slide number.
|
|
4186
4185
|
* @param layoutPath - Optional layout archive path.
|
|
4187
4186
|
* @param layoutName - Optional layout display name.
|
|
4187
|
+
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
4188
4188
|
*/
|
|
4189
|
-
constructor(slideNumber, layoutPath, layoutName) {
|
|
4189
|
+
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
4190
|
+
this.handler = handler;
|
|
4190
4191
|
this.slide = {
|
|
4191
4192
|
id: `slide${slideNumber}`,
|
|
4192
4193
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -4196,11 +4197,52 @@ var init_SlideBuilder = __esm({
|
|
|
4196
4197
|
layoutName: layoutName ?? "Title Slide"
|
|
4197
4198
|
};
|
|
4198
4199
|
}
|
|
4200
|
+
handler;
|
|
4201
|
+
slide;
|
|
4199
4202
|
/** Add a text box to the slide. */
|
|
4200
4203
|
addText(text2, options) {
|
|
4201
4204
|
this.slide.elements.push(createTextElement(text2, options));
|
|
4202
4205
|
return this;
|
|
4203
4206
|
}
|
|
4207
|
+
/**
|
|
4208
|
+
* Fill a layout placeholder, inheriting its frame and text styles.
|
|
4209
|
+
*
|
|
4210
|
+
* Unlike addText, this writes a real p:ph binding, not a free text box.
|
|
4211
|
+
* Use idx to select repeated slots (for example, Two Content's 1 and 2).
|
|
4212
|
+
* Explicit frame fields override the layout; all other fields inherit.
|
|
4213
|
+
* A standalone builder requires the fourth constructor argument (a loaded
|
|
4214
|
+
* handler), even with an explicit frame, so text styles resolve consistently.
|
|
4215
|
+
* Missing slots without a complete frame throw instead of creating a text box.
|
|
4216
|
+
* Master frames requiring compatible-role fallback are materialized locally
|
|
4217
|
+
* for new content only, keeping existing-deck loading unchanged.
|
|
4218
|
+
*
|
|
4219
|
+
* @example
|
|
4220
|
+
* ```ts
|
|
4221
|
+
* createSlide('Title Slide')
|
|
4222
|
+
* .addPlaceholder('ctrTitle', 'Quarterly review')
|
|
4223
|
+
* .addPlaceholder('subTitle', 'October 2026');
|
|
4224
|
+
* createSlide('Two Content').addPlaceholder('body', 'Right column', { idx: 2 });
|
|
4225
|
+
* ```
|
|
4226
|
+
*/
|
|
4227
|
+
addPlaceholder(type, text2, options = {}) {
|
|
4228
|
+
const input = createTextElement(text2);
|
|
4229
|
+
const context = `Slide ${this.slide.slideNumber} (${this.slide.id}), placeholder ${type} idx=${options.idx ?? "auto"}, layout ${this.slide.layoutName} (${this.slide.layoutPath})`;
|
|
4230
|
+
try {
|
|
4231
|
+
if (!this.handler) {
|
|
4232
|
+
throw new Error(
|
|
4233
|
+
"addPlaceholder requires a loaded handler as the fourth SlideBuilder constructor argument"
|
|
4234
|
+
);
|
|
4235
|
+
}
|
|
4236
|
+
this.slide.elements.push(
|
|
4237
|
+
this.handler.createPlaceholderElement(this.slide.layoutPath, input, type, options)
|
|
4238
|
+
);
|
|
4239
|
+
} catch (error) {
|
|
4240
|
+
throw new Error(`${context}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
4241
|
+
cause: error
|
|
4242
|
+
});
|
|
4243
|
+
}
|
|
4244
|
+
return this;
|
|
4245
|
+
}
|
|
4204
4246
|
/** Add a shape to the slide. */
|
|
4205
4247
|
addShape(shapeType, options) {
|
|
4206
4248
|
this.slide.elements.push(createShapeElement(shapeType, options));
|
|
@@ -4440,6 +4482,254 @@ var init_SlideBuilder = __esm({
|
|
|
4440
4482
|
};
|
|
4441
4483
|
}
|
|
4442
4484
|
});
|
|
4485
|
+
function isSafePartName(name) {
|
|
4486
|
+
if (name.includes("\0") || name.includes("\\")) return false;
|
|
4487
|
+
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
4488
|
+
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
4489
|
+
if (body.startsWith("/")) return false;
|
|
4490
|
+
return !body.split("/").some((segment) => segment === "..");
|
|
4491
|
+
}
|
|
4492
|
+
function declaredEntrySize(entry2) {
|
|
4493
|
+
const data = entry2._data;
|
|
4494
|
+
const size = Number(data?.uncompressedSize ?? 0);
|
|
4495
|
+
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
4496
|
+
}
|
|
4497
|
+
function resolveLimits(limits) {
|
|
4498
|
+
const create = limits.createError;
|
|
4499
|
+
return {
|
|
4500
|
+
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
4501
|
+
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
4502
|
+
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
4503
|
+
label: limits.label ?? "ZIP",
|
|
4504
|
+
fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
4505
|
+
};
|
|
4506
|
+
}
|
|
4507
|
+
function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
4508
|
+
const r = resolveLimits(limits);
|
|
4509
|
+
const declared = declaredEntrySize(entry2);
|
|
4510
|
+
return new Promise((resolvePromise, reject) => {
|
|
4511
|
+
const chunks = [];
|
|
4512
|
+
let size = 0;
|
|
4513
|
+
let done = false;
|
|
4514
|
+
const stream = entry2.internalStream("uint8array");
|
|
4515
|
+
const abort = (error) => {
|
|
4516
|
+
if (done) return;
|
|
4517
|
+
done = true;
|
|
4518
|
+
stream.pause();
|
|
4519
|
+
chunks.length = 0;
|
|
4520
|
+
reject(error);
|
|
4521
|
+
};
|
|
4522
|
+
stream.on("data", (chunk2) => {
|
|
4523
|
+
if (done) return;
|
|
4524
|
+
size += chunk2.byteLength;
|
|
4525
|
+
if (size > declared || size > r.maxEntryBytes)
|
|
4526
|
+
return abort(
|
|
4527
|
+
r.fail(
|
|
4528
|
+
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
4529
|
+
r.maxEntryBytes,
|
|
4530
|
+
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
4531
|
+
)
|
|
4532
|
+
);
|
|
4533
|
+
if (alreadyRead + size > r.maxTotalBytes)
|
|
4534
|
+
return abort(
|
|
4535
|
+
r.fail(
|
|
4536
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4537
|
+
r.maxTotalBytes,
|
|
4538
|
+
"maxTotalBytes"
|
|
4539
|
+
)
|
|
4540
|
+
);
|
|
4541
|
+
chunks.push(chunk2);
|
|
4542
|
+
});
|
|
4543
|
+
stream.on("error", (error) => abort(error));
|
|
4544
|
+
stream.on("end", () => {
|
|
4545
|
+
if (done) return;
|
|
4546
|
+
done = true;
|
|
4547
|
+
if (chunks.length === 1 && chunks[0]) return resolvePromise(chunks[0]);
|
|
4548
|
+
const out = new Uint8Array(size);
|
|
4549
|
+
let offset = 0;
|
|
4550
|
+
for (const chunk2 of chunks) {
|
|
4551
|
+
out.set(chunk2, offset);
|
|
4552
|
+
offset += chunk2.byteLength;
|
|
4553
|
+
}
|
|
4554
|
+
resolvePromise(out);
|
|
4555
|
+
});
|
|
4556
|
+
stream.resume();
|
|
4557
|
+
});
|
|
4558
|
+
}
|
|
4559
|
+
function toBase64(bytes) {
|
|
4560
|
+
let binary = "";
|
|
4561
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
4562
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
4563
|
+
return btoa(binary);
|
|
4564
|
+
}
|
|
4565
|
+
function guardZip(zip, limits = {}) {
|
|
4566
|
+
const r = resolveLimits(limits);
|
|
4567
|
+
const entries = Object.values(zip.files);
|
|
4568
|
+
if (entries.length > r.maxEntries)
|
|
4569
|
+
throw r.fail(
|
|
4570
|
+
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
4571
|
+
r.maxEntries,
|
|
4572
|
+
"maxEntries"
|
|
4573
|
+
);
|
|
4574
|
+
let declared = 0;
|
|
4575
|
+
for (const entry2 of entries) {
|
|
4576
|
+
const original = entry2.unsafeOriginalName;
|
|
4577
|
+
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
4578
|
+
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
|
|
4579
|
+
if (entry2.dir) continue;
|
|
4580
|
+
const size = declaredEntrySize(entry2);
|
|
4581
|
+
if (size > r.maxEntryBytes)
|
|
4582
|
+
throw r.fail(
|
|
4583
|
+
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
4584
|
+
r.maxEntryBytes,
|
|
4585
|
+
"maxEntryBytes"
|
|
4586
|
+
);
|
|
4587
|
+
declared += size;
|
|
4588
|
+
}
|
|
4589
|
+
if (declared > r.maxTotalBytes)
|
|
4590
|
+
throw r.fail(
|
|
4591
|
+
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4592
|
+
r.maxTotalBytes,
|
|
4593
|
+
"maxTotalBytes"
|
|
4594
|
+
);
|
|
4595
|
+
const produced = /* @__PURE__ */ new Map();
|
|
4596
|
+
let total = 0;
|
|
4597
|
+
for (const entry2 of entries) {
|
|
4598
|
+
if (entry2.dir) continue;
|
|
4599
|
+
const inflateOriginal = entry2.async.bind(entry2);
|
|
4600
|
+
entry2.async = async (type, onUpdate) => {
|
|
4601
|
+
const previous = produced.get(entry2.name) ?? 0;
|
|
4602
|
+
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
4603
|
+
if (bytes.byteLength > previous) {
|
|
4604
|
+
total += bytes.byteLength - previous;
|
|
4605
|
+
produced.set(entry2.name, bytes.byteLength);
|
|
4606
|
+
}
|
|
4607
|
+
switch (type) {
|
|
4608
|
+
case "uint8array":
|
|
4609
|
+
return bytes;
|
|
4610
|
+
case "string":
|
|
4611
|
+
case "text":
|
|
4612
|
+
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
4613
|
+
case "arraybuffer":
|
|
4614
|
+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
4615
|
+
case "base64":
|
|
4616
|
+
return toBase64(bytes);
|
|
4617
|
+
default:
|
|
4618
|
+
return inflateOriginal(type, onUpdate);
|
|
4619
|
+
}
|
|
4620
|
+
};
|
|
4621
|
+
}
|
|
4622
|
+
return zip;
|
|
4623
|
+
}
|
|
4624
|
+
async function openZip(input, limits = {}) {
|
|
4625
|
+
const r = resolveLimits(limits);
|
|
4626
|
+
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
4627
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
4628
|
+
if (bytes.byteLength > maxInput)
|
|
4629
|
+
throw r.fail(
|
|
4630
|
+
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
4631
|
+
maxInput,
|
|
4632
|
+
"maxInputBytes"
|
|
4633
|
+
);
|
|
4634
|
+
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
4635
|
+
}
|
|
4636
|
+
var DEFAULT_ZIP_LIMITS, ZipLimitError, mib;
|
|
4637
|
+
var init_zip_limits = __esm({
|
|
4638
|
+
"opc/zip-limits.ts"() {
|
|
4639
|
+
DEFAULT_ZIP_LIMITS = {
|
|
4640
|
+
maxInputBytes: 100 * 1024 * 1024,
|
|
4641
|
+
maxEntries: 1e4,
|
|
4642
|
+
maxEntryBytes: 100 * 1024 * 1024,
|
|
4643
|
+
maxTotalBytes: 100 * 1024 * 1024
|
|
4644
|
+
};
|
|
4645
|
+
ZipLimitError = class extends Error {
|
|
4646
|
+
code = "ZIP_BOMB";
|
|
4647
|
+
limit;
|
|
4648
|
+
/** The check that failed (absent when the error was built without one). */
|
|
4649
|
+
kind;
|
|
4650
|
+
constructor(message, details) {
|
|
4651
|
+
super(message);
|
|
4652
|
+
this.name = "ZipLimitError";
|
|
4653
|
+
this.limit = details.limit;
|
|
4654
|
+
this.kind = details.kind;
|
|
4655
|
+
}
|
|
4656
|
+
};
|
|
4657
|
+
mib = (bytes) => Math.round(bytes / 1048576);
|
|
4658
|
+
}
|
|
4659
|
+
});
|
|
4660
|
+
|
|
4661
|
+
// pptx/core/core/types.ts
|
|
4662
|
+
var DEFAULT_MAX_UNCOMPRESSED_BYTES, MAX_ZIP_ENTRY_COUNT, ZipBombError;
|
|
4663
|
+
var init_types2 = __esm({
|
|
4664
|
+
"pptx/core/core/types.ts"() {
|
|
4665
|
+
DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
4666
|
+
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
4667
|
+
ZipBombError = class extends Error {
|
|
4668
|
+
code = "ZIP_BOMB";
|
|
4669
|
+
uncompressedBytes;
|
|
4670
|
+
limit;
|
|
4671
|
+
entryCount;
|
|
4672
|
+
constructor(message, details) {
|
|
4673
|
+
super(message);
|
|
4674
|
+
this.name = "ZipBombError";
|
|
4675
|
+
this.uncompressedBytes = details.uncompressedBytes;
|
|
4676
|
+
this.limit = details.limit;
|
|
4677
|
+
this.entryCount = details.entryCount;
|
|
4678
|
+
}
|
|
4679
|
+
};
|
|
4680
|
+
}
|
|
4681
|
+
});
|
|
4682
|
+
|
|
4683
|
+
// pptx/core/utils/zip-open.ts
|
|
4684
|
+
function openPptxZip(bytes) {
|
|
4685
|
+
return openZip(bytes, {
|
|
4686
|
+
label: "PPTX",
|
|
4687
|
+
maxInputBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
4688
|
+
maxEntries: MAX_ZIP_ENTRY_COUNT,
|
|
4689
|
+
maxEntryBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
4690
|
+
maxTotalBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
4691
|
+
createError
|
|
4692
|
+
});
|
|
4693
|
+
}
|
|
4694
|
+
function openNestedZip(bytes) {
|
|
4695
|
+
return openZip(bytes, { label: "Embedded", createError });
|
|
4696
|
+
}
|
|
4697
|
+
var createError;
|
|
4698
|
+
var init_zip_open = __esm({
|
|
4699
|
+
"pptx/core/utils/zip-open.ts"() {
|
|
4700
|
+
init_zip_limits();
|
|
4701
|
+
init_types2();
|
|
4702
|
+
createError = (message, details) => new ZipBombError(message, details);
|
|
4703
|
+
}
|
|
4704
|
+
});
|
|
4705
|
+
|
|
4706
|
+
// pptx/core/builders/sdk/layout-operations.ts
|
|
4707
|
+
function pxToEmu(px2) {
|
|
4708
|
+
return Math.round(px2 * EMU_PER_PIXEL2);
|
|
4709
|
+
}
|
|
4710
|
+
function placeholderSpXml(ph, shapeId) {
|
|
4711
|
+
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
4712
|
+
const x = pxToEmu(ph.x);
|
|
4713
|
+
const y = pxToEmu(ph.y);
|
|
4714
|
+
const cx = pxToEmu(ph.width);
|
|
4715
|
+
const cy = pxToEmu(ph.height);
|
|
4716
|
+
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
4717
|
+
return ` <p:sp>
|
|
4718
|
+
<p:nvSpPr>
|
|
4719
|
+
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
4720
|
+
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
4721
|
+
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
4722
|
+
</p:nvSpPr>
|
|
4723
|
+
<p:spPr>
|
|
4724
|
+
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
4725
|
+
</p:spPr>
|
|
4726
|
+
<p:txBody>
|
|
4727
|
+
<a:bodyPr/>
|
|
4728
|
+
<a:lstStyle/>
|
|
4729
|
+
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
4730
|
+
</p:txBody>
|
|
4731
|
+
</p:sp>`;
|
|
4732
|
+
}
|
|
4443
4733
|
function normalizeSrgbHex(color2) {
|
|
4444
4734
|
if (!color2) {
|
|
4445
4735
|
return void 0;
|
|
@@ -4453,10 +4743,134 @@ function normalizeSrgbHex(color2) {
|
|
|
4453
4743
|
}
|
|
4454
4744
|
return void 0;
|
|
4455
4745
|
}
|
|
4746
|
+
function generateLayoutXml(definition) {
|
|
4747
|
+
const layoutType = definition.type ?? "obj";
|
|
4748
|
+
const placeholders = definition.placeholders ?? [];
|
|
4749
|
+
const phShapes = placeholders.map((ph, i2) => placeholderSpXml(ph, i2 + 2)).join("\n");
|
|
4750
|
+
let bgXml = "";
|
|
4751
|
+
const hex3 = normalizeSrgbHex(definition.backgroundColor);
|
|
4752
|
+
if (hex3) {
|
|
4753
|
+
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
4754
|
+
`;
|
|
4755
|
+
}
|
|
4756
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4757
|
+
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
4758
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
4759
|
+
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
4760
|
+
type="${escAttr(layoutType)}" preserve="1">
|
|
4761
|
+
<p:cSld name="${escAttr(definition.name)}">
|
|
4762
|
+
${bgXml} <p:spTree>
|
|
4763
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
4764
|
+
<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>
|
|
4765
|
+
${phShapes}
|
|
4766
|
+
</p:spTree>
|
|
4767
|
+
</p:cSld>
|
|
4768
|
+
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
4769
|
+
</p:sldLayout>`;
|
|
4770
|
+
}
|
|
4771
|
+
function findLayoutByName(data, name) {
|
|
4772
|
+
const lowerName = name.toLowerCase();
|
|
4773
|
+
const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
|
|
4774
|
+
if (fromOptions) {
|
|
4775
|
+
return fromOptions;
|
|
4776
|
+
}
|
|
4777
|
+
if (data.slideMasters) {
|
|
4778
|
+
for (const master of data.slideMasters) {
|
|
4779
|
+
const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
|
|
4780
|
+
if (layout) {
|
|
4781
|
+
return { path: layout.path, name: layout.name ?? name };
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
return void 0;
|
|
4786
|
+
}
|
|
4787
|
+
function findLayoutByType(data, type) {
|
|
4788
|
+
const fromOptions = data.layoutOptions?.find((l) => l.type === type);
|
|
4789
|
+
if (fromOptions) {
|
|
4790
|
+
return fromOptions;
|
|
4791
|
+
}
|
|
4792
|
+
return void 0;
|
|
4793
|
+
}
|
|
4794
|
+
var EMU_PER_PIXEL2;
|
|
4795
|
+
var init_layout_operations = __esm({
|
|
4796
|
+
"pptx/core/builders/sdk/layout-operations.ts"() {
|
|
4797
|
+
init_xml_utils();
|
|
4798
|
+
EMU_PER_PIXEL2 = 9525;
|
|
4799
|
+
}
|
|
4800
|
+
});
|
|
4801
|
+
|
|
4802
|
+
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
4803
|
+
function standardLayoutPlaceholders(type, width, height) {
|
|
4804
|
+
if (type === "blank") return [];
|
|
4805
|
+
const box = (type2, idx, x, y, w, h2) => ({
|
|
4806
|
+
type: type2,
|
|
4807
|
+
idx,
|
|
4808
|
+
x: x * width,
|
|
4809
|
+
y: y * height,
|
|
4810
|
+
width: w * width,
|
|
4811
|
+
height: h2 * height
|
|
4812
|
+
});
|
|
4813
|
+
const title = box("title", 0, 0.05, 0.04, 0.9, 0.15);
|
|
4814
|
+
const content2 = box("obj", 1, 0.05, 0.23, 0.9, 0.64);
|
|
4815
|
+
let slots;
|
|
4816
|
+
switch (type) {
|
|
4817
|
+
case "title":
|
|
4818
|
+
slots = [
|
|
4819
|
+
box("ctrTitle", 0, 0.08, 0.24, 0.84, 0.22),
|
|
4820
|
+
box("subTitle", 1, 0.12, 0.49, 0.76, 0.2)
|
|
4821
|
+
];
|
|
4822
|
+
break;
|
|
4823
|
+
case "secHead":
|
|
4824
|
+
slots = [box("title", 0, 0.05, 0.37, 0.9, 0.2), box("body", 1, 0.05, 0.6, 0.9, 0.23)];
|
|
4825
|
+
break;
|
|
4826
|
+
case "twoObj":
|
|
4827
|
+
case "twoTxTwoObj":
|
|
4828
|
+
slots = [title, box("obj", 1, 0.05, 0.27, 0.43, 0.6), box("obj", 2, 0.52, 0.27, 0.43, 0.6)];
|
|
4829
|
+
if (type === "twoTxTwoObj")
|
|
4830
|
+
slots.push(box("body", 3, 0.05, 0.2, 0.43, 0.07), box("body", 4, 0.52, 0.2, 0.43, 0.07));
|
|
4831
|
+
break;
|
|
4832
|
+
case "titleOnly":
|
|
4833
|
+
slots = [title];
|
|
4834
|
+
break;
|
|
4835
|
+
case "objTx":
|
|
4836
|
+
case "picTx":
|
|
4837
|
+
slots = [
|
|
4838
|
+
title,
|
|
4839
|
+
box(type === "picTx" ? "pic" : "obj", 1, 0.36, 0.23, 0.59, 0.64),
|
|
4840
|
+
box("body", 2, 0.05, 0.23, 0.27, 0.64)
|
|
4841
|
+
];
|
|
4842
|
+
break;
|
|
4843
|
+
default:
|
|
4844
|
+
slots = [title, content2];
|
|
4845
|
+
}
|
|
4846
|
+
return [
|
|
4847
|
+
...slots,
|
|
4848
|
+
box("dt", 10, 0.05, 0.92, 0.25, 0.04),
|
|
4849
|
+
box("ftr", 11, 0.33, 0.92, 0.34, 0.04),
|
|
4850
|
+
box("sldNum", 12, 0.75, 0.92, 0.2, 0.04)
|
|
4851
|
+
];
|
|
4852
|
+
}
|
|
4853
|
+
var init_standard_layout_placeholders = __esm({
|
|
4854
|
+
"pptx/core/builders/sdk/standard-layout-placeholders.ts"() {
|
|
4855
|
+
}
|
|
4856
|
+
});
|
|
4857
|
+
function normalizeSrgbHex2(color2) {
|
|
4858
|
+
if (!color2) {
|
|
4859
|
+
return void 0;
|
|
4860
|
+
}
|
|
4861
|
+
const raw = color2.trim().replace(/^#/, "").toUpperCase();
|
|
4862
|
+
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
4863
|
+
return raw;
|
|
4864
|
+
}
|
|
4865
|
+
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
4866
|
+
return raw.replace(/./g, (ch) => ch + ch);
|
|
4867
|
+
}
|
|
4868
|
+
return void 0;
|
|
4869
|
+
}
|
|
4456
4870
|
function resolveThemeColors(overrides) {
|
|
4457
4871
|
const resolved = {};
|
|
4458
4872
|
for (const [key2, fallback] of Object.entries(DEFAULT_COLORS)) {
|
|
4459
|
-
resolved[key2] =
|
|
4873
|
+
resolved[key2] = normalizeSrgbHex2(overrides?.[key2]) ?? normalizeSrgbHex2(fallback) ?? "000000";
|
|
4460
4874
|
}
|
|
4461
4875
|
return resolved;
|
|
4462
4876
|
}
|
|
@@ -4596,21 +5010,6 @@ ${layoutRels}
|
|
|
4596
5010
|
<Relationship Id="rId${layoutCount + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
|
|
4597
5011
|
</Relationships>`;
|
|
4598
5012
|
}
|
|
4599
|
-
function slideLayoutXml(name, layoutType) {
|
|
4600
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4601
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
4602
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
4603
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
4604
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
4605
|
-
<p:cSld name="${escAttr(name)}">
|
|
4606
|
-
<p:spTree>
|
|
4607
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
4608
|
-
<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>
|
|
4609
|
-
</p:spTree>
|
|
4610
|
-
</p:cSld>
|
|
4611
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
4612
|
-
</p:sldLayout>`;
|
|
4613
|
-
}
|
|
4614
5013
|
function slideLayoutRelsXml() {
|
|
4615
5014
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4616
5015
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
@@ -4759,7 +5158,14 @@ async function buildBlankPresentationArchive(options) {
|
|
|
4759
5158
|
zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
|
|
4760
5159
|
for (let i2 = 0; i2 < layoutCount; i2++) {
|
|
4761
5160
|
const layout = STANDARD_LAYOUTS[i2];
|
|
4762
|
-
zip.file(
|
|
5161
|
+
zip.file(
|
|
5162
|
+
`ppt/slideLayouts/slideLayout${i2 + 1}.xml`,
|
|
5163
|
+
generateLayoutXml({
|
|
5164
|
+
name: layout.name,
|
|
5165
|
+
type: layout.type,
|
|
5166
|
+
placeholders: standardLayoutPlaceholders(layout.type, width / 9525, height / 9525)
|
|
5167
|
+
})
|
|
5168
|
+
);
|
|
4763
5169
|
zip.file(`ppt/slideLayouts/_rels/slideLayout${i2 + 1}.xml.rels`, slideLayoutRelsXml());
|
|
4764
5170
|
}
|
|
4765
5171
|
for (let i2 = 0; i2 < initialSlideCount; i2++) {
|
|
@@ -4780,6 +5186,8 @@ var init_PresentationBuilder = __esm({
|
|
|
4780
5186
|
init_xml_utils();
|
|
4781
5187
|
init_PptxHandler();
|
|
4782
5188
|
init_SlideBuilder();
|
|
5189
|
+
init_layout_operations();
|
|
5190
|
+
init_standard_layout_placeholders();
|
|
4783
5191
|
DEFAULT_WIDTH = 12192e3;
|
|
4784
5192
|
DEFAULT_HEIGHT = 6858e3;
|
|
4785
5193
|
DEFAULT_COLORS = {
|
|
@@ -4837,7 +5245,7 @@ var init_PresentationBuilder = __esm({
|
|
|
4837
5245
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
4838
5246
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
4839
5247
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
4840
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName);
|
|
5248
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
4841
5249
|
};
|
|
4842
5250
|
return { handler, data, createSlide };
|
|
4843
5251
|
}
|
|
@@ -14718,7 +15126,7 @@ function getShapeType(shapeType) {
|
|
|
14718
15126
|
if (normalized === "downarrow") {
|
|
14719
15127
|
return "downArrow";
|
|
14720
15128
|
}
|
|
14721
|
-
if (normalized.includes("connector")) {
|
|
15129
|
+
if (normalized.includes("connector") && !normalized.startsWith("flowchart")) {
|
|
14722
15130
|
return "connector";
|
|
14723
15131
|
}
|
|
14724
15132
|
if (PRESET_SHAPE_CLIP_PATHS[normalized] !== void 0) {
|
|
@@ -17239,214 +17647,6 @@ var init_ole_embedded_replace = __esm({
|
|
|
17239
17647
|
CONTENTS_STREAM2 = "CONTENTS";
|
|
17240
17648
|
}
|
|
17241
17649
|
});
|
|
17242
|
-
function isSafePartName(name) {
|
|
17243
|
-
if (name.includes("\0") || name.includes("\\")) return false;
|
|
17244
|
-
if (/^[A-Za-z]:/u.test(name)) return false;
|
|
17245
|
-
const body = name.startsWith("/") ? name.slice(1) : name;
|
|
17246
|
-
if (body.startsWith("/")) return false;
|
|
17247
|
-
return !body.split("/").some((segment) => segment === "..");
|
|
17248
|
-
}
|
|
17249
|
-
function declaredEntrySize(entry2) {
|
|
17250
|
-
const data = entry2._data;
|
|
17251
|
-
const size = Number(data?.uncompressedSize ?? 0);
|
|
17252
|
-
return Number.isFinite(size) && size > 0 ? size : 0;
|
|
17253
|
-
}
|
|
17254
|
-
function resolveLimits(limits) {
|
|
17255
|
-
const create = limits.createError;
|
|
17256
|
-
return {
|
|
17257
|
-
maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
|
|
17258
|
-
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
17259
|
-
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
17260
|
-
label: limits.label ?? "ZIP",
|
|
17261
|
-
fail: (message, limit) => create ? create(message, { limit }) : new ZipLimitError(message, { limit })
|
|
17262
|
-
};
|
|
17263
|
-
}
|
|
17264
|
-
function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
17265
|
-
const r = resolveLimits(limits);
|
|
17266
|
-
const declared = declaredEntrySize(entry2);
|
|
17267
|
-
return new Promise((resolvePromise, reject) => {
|
|
17268
|
-
const chunks = [];
|
|
17269
|
-
let size = 0;
|
|
17270
|
-
let done = false;
|
|
17271
|
-
const stream = entry2.internalStream("uint8array");
|
|
17272
|
-
const abort = (error) => {
|
|
17273
|
-
if (done) return;
|
|
17274
|
-
done = true;
|
|
17275
|
-
stream.pause();
|
|
17276
|
-
chunks.length = 0;
|
|
17277
|
-
reject(error);
|
|
17278
|
-
};
|
|
17279
|
-
stream.on("data", (chunk2) => {
|
|
17280
|
-
if (done) return;
|
|
17281
|
-
size += chunk2.byteLength;
|
|
17282
|
-
if (size > declared || size > r.maxEntryBytes)
|
|
17283
|
-
return abort(
|
|
17284
|
-
r.fail(`${r.label} part ${entry2.name} inflates past its declared size`, r.maxEntryBytes)
|
|
17285
|
-
);
|
|
17286
|
-
if (alreadyRead + size > r.maxTotalBytes)
|
|
17287
|
-
return abort(
|
|
17288
|
-
r.fail(
|
|
17289
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
17290
|
-
r.maxTotalBytes
|
|
17291
|
-
)
|
|
17292
|
-
);
|
|
17293
|
-
chunks.push(chunk2);
|
|
17294
|
-
});
|
|
17295
|
-
stream.on("error", (error) => abort(error));
|
|
17296
|
-
stream.on("end", () => {
|
|
17297
|
-
if (done) return;
|
|
17298
|
-
done = true;
|
|
17299
|
-
if (chunks.length === 1 && chunks[0]) return resolvePromise(chunks[0]);
|
|
17300
|
-
const out = new Uint8Array(size);
|
|
17301
|
-
let offset = 0;
|
|
17302
|
-
for (const chunk2 of chunks) {
|
|
17303
|
-
out.set(chunk2, offset);
|
|
17304
|
-
offset += chunk2.byteLength;
|
|
17305
|
-
}
|
|
17306
|
-
resolvePromise(out);
|
|
17307
|
-
});
|
|
17308
|
-
stream.resume();
|
|
17309
|
-
});
|
|
17310
|
-
}
|
|
17311
|
-
function toBase64(bytes) {
|
|
17312
|
-
let binary = "";
|
|
17313
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768)
|
|
17314
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
17315
|
-
return btoa(binary);
|
|
17316
|
-
}
|
|
17317
|
-
function guardZip(zip, limits = {}) {
|
|
17318
|
-
const r = resolveLimits(limits);
|
|
17319
|
-
const entries = Object.values(zip.files);
|
|
17320
|
-
if (entries.length > r.maxEntries)
|
|
17321
|
-
throw r.fail(
|
|
17322
|
-
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
17323
|
-
r.maxEntries
|
|
17324
|
-
);
|
|
17325
|
-
let declared = 0;
|
|
17326
|
-
for (const entry2 of entries) {
|
|
17327
|
-
const original = entry2.unsafeOriginalName;
|
|
17328
|
-
if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
|
|
17329
|
-
throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries);
|
|
17330
|
-
if (entry2.dir) continue;
|
|
17331
|
-
const size = declaredEntrySize(entry2);
|
|
17332
|
-
if (size > r.maxEntryBytes)
|
|
17333
|
-
throw r.fail(
|
|
17334
|
-
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
17335
|
-
r.maxEntryBytes
|
|
17336
|
-
);
|
|
17337
|
-
declared += size;
|
|
17338
|
-
}
|
|
17339
|
-
if (declared > r.maxTotalBytes)
|
|
17340
|
-
throw r.fail(
|
|
17341
|
-
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
17342
|
-
r.maxTotalBytes
|
|
17343
|
-
);
|
|
17344
|
-
const produced = /* @__PURE__ */ new Map();
|
|
17345
|
-
let total = 0;
|
|
17346
|
-
for (const entry2 of entries) {
|
|
17347
|
-
if (entry2.dir) continue;
|
|
17348
|
-
const inflateOriginal = entry2.async.bind(entry2);
|
|
17349
|
-
entry2.async = async (type, onUpdate) => {
|
|
17350
|
-
const previous = produced.get(entry2.name) ?? 0;
|
|
17351
|
-
const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
|
|
17352
|
-
if (bytes.byteLength > previous) {
|
|
17353
|
-
total += bytes.byteLength - previous;
|
|
17354
|
-
produced.set(entry2.name, bytes.byteLength);
|
|
17355
|
-
}
|
|
17356
|
-
switch (type) {
|
|
17357
|
-
case "uint8array":
|
|
17358
|
-
return bytes;
|
|
17359
|
-
case "string":
|
|
17360
|
-
case "text":
|
|
17361
|
-
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
17362
|
-
case "arraybuffer":
|
|
17363
|
-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
17364
|
-
case "base64":
|
|
17365
|
-
return toBase64(bytes);
|
|
17366
|
-
default:
|
|
17367
|
-
return inflateOriginal(type, onUpdate);
|
|
17368
|
-
}
|
|
17369
|
-
};
|
|
17370
|
-
}
|
|
17371
|
-
return zip;
|
|
17372
|
-
}
|
|
17373
|
-
async function openZip(input, limits = {}) {
|
|
17374
|
-
const r = resolveLimits(limits);
|
|
17375
|
-
const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
|
|
17376
|
-
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
17377
|
-
if (bytes.byteLength > maxInput)
|
|
17378
|
-
throw r.fail(
|
|
17379
|
-
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
17380
|
-
maxInput
|
|
17381
|
-
);
|
|
17382
|
-
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
17383
|
-
}
|
|
17384
|
-
var DEFAULT_ZIP_LIMITS, ZipLimitError, mib;
|
|
17385
|
-
var init_zip_limits = __esm({
|
|
17386
|
-
"opc/zip-limits.ts"() {
|
|
17387
|
-
DEFAULT_ZIP_LIMITS = {
|
|
17388
|
-
maxInputBytes: 100 * 1024 * 1024,
|
|
17389
|
-
maxEntries: 1e4,
|
|
17390
|
-
maxEntryBytes: 100 * 1024 * 1024,
|
|
17391
|
-
maxTotalBytes: 100 * 1024 * 1024
|
|
17392
|
-
};
|
|
17393
|
-
ZipLimitError = class extends Error {
|
|
17394
|
-
code = "ZIP_BOMB";
|
|
17395
|
-
limit;
|
|
17396
|
-
constructor(message, details) {
|
|
17397
|
-
super(message);
|
|
17398
|
-
this.name = "ZipLimitError";
|
|
17399
|
-
this.limit = details.limit;
|
|
17400
|
-
}
|
|
17401
|
-
};
|
|
17402
|
-
mib = (bytes) => Math.round(bytes / 1048576);
|
|
17403
|
-
}
|
|
17404
|
-
});
|
|
17405
|
-
|
|
17406
|
-
// pptx/core/core/types.ts
|
|
17407
|
-
var DEFAULT_MAX_UNCOMPRESSED_BYTES, MAX_ZIP_ENTRY_COUNT, ZipBombError;
|
|
17408
|
-
var init_types2 = __esm({
|
|
17409
|
-
"pptx/core/core/types.ts"() {
|
|
17410
|
-
DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
17411
|
-
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
17412
|
-
ZipBombError = class extends Error {
|
|
17413
|
-
code = "ZIP_BOMB";
|
|
17414
|
-
uncompressedBytes;
|
|
17415
|
-
limit;
|
|
17416
|
-
entryCount;
|
|
17417
|
-
constructor(message, details) {
|
|
17418
|
-
super(message);
|
|
17419
|
-
this.name = "ZipBombError";
|
|
17420
|
-
this.uncompressedBytes = details.uncompressedBytes;
|
|
17421
|
-
this.limit = details.limit;
|
|
17422
|
-
this.entryCount = details.entryCount;
|
|
17423
|
-
}
|
|
17424
|
-
};
|
|
17425
|
-
}
|
|
17426
|
-
});
|
|
17427
|
-
|
|
17428
|
-
// pptx/core/utils/zip-open.ts
|
|
17429
|
-
function openPptxZip(bytes) {
|
|
17430
|
-
return openZip(bytes, {
|
|
17431
|
-
label: "PPTX",
|
|
17432
|
-
maxInputBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
17433
|
-
maxEntries: MAX_ZIP_ENTRY_COUNT,
|
|
17434
|
-
maxEntryBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
17435
|
-
maxTotalBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
17436
|
-
createError
|
|
17437
|
-
});
|
|
17438
|
-
}
|
|
17439
|
-
function openNestedZip(bytes) {
|
|
17440
|
-
return openZip(bytes, { label: "Embedded", createError });
|
|
17441
|
-
}
|
|
17442
|
-
var createError;
|
|
17443
|
-
var init_zip_open = __esm({
|
|
17444
|
-
"pptx/core/utils/zip-open.ts"() {
|
|
17445
|
-
init_zip_limits();
|
|
17446
|
-
init_types2();
|
|
17447
|
-
createError = (message, details) => new ZipBombError(message, details);
|
|
17448
|
-
}
|
|
17449
|
-
});
|
|
17450
17650
|
|
|
17451
17651
|
// pptx/core/utils/ole-payload-kind.ts
|
|
17452
17652
|
function isZipMagic(bytes) {
|
|
@@ -39397,9 +39597,18 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
39397
39597
|
continue;
|
|
39398
39598
|
}
|
|
39399
39599
|
nodes++;
|
|
39400
|
-
if (nodes > maxNodes)
|
|
39600
|
+
if (nodes > maxNodes)
|
|
39601
|
+
throw new XmlLimitError(
|
|
39602
|
+
`${label} XML exceeds the limit of ${maxNodes} elements`,
|
|
39603
|
+
"maxNodes",
|
|
39604
|
+
maxNodes
|
|
39605
|
+
);
|
|
39401
39606
|
if (!selfClosing && ++depth > maxDepth2)
|
|
39402
|
-
throw new
|
|
39607
|
+
throw new XmlLimitError(
|
|
39608
|
+
`${label} XML exceeds the nesting depth limit of ${maxDepth2}`,
|
|
39609
|
+
"maxDepth",
|
|
39610
|
+
maxDepth2
|
|
39611
|
+
);
|
|
39403
39612
|
}
|
|
39404
39613
|
}
|
|
39405
39614
|
function parseXml(xml, options = {}) {
|
|
@@ -39423,6 +39632,7 @@ function parseXml(xml, options = {}) {
|
|
|
39423
39632
|
}
|
|
39424
39633
|
if (parseError || !parsed.documentElement)
|
|
39425
39634
|
throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
|
|
39635
|
+
if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
|
|
39426
39636
|
return parsed;
|
|
39427
39637
|
}
|
|
39428
39638
|
function named(element, local, ns, lenient = true) {
|
|
@@ -39432,7 +39642,7 @@ function named(element, local, ns, lenient = true) {
|
|
|
39432
39642
|
function attr(element, local, ns, prefix) {
|
|
39433
39643
|
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix}:${local}`) ?? void 0;
|
|
39434
39644
|
}
|
|
39435
|
-
var DEFAULT_XML_LIMITS, TAG_RE, MARKUP_SKIPS, buildXml, isElement, elements, children2, first, relAttr;
|
|
39645
|
+
var DEFAULT_XML_LIMITS, XmlLimitError, TAG_RE, MARKUP_SKIPS, CRLF_DECLARATION, crlfDeclarations, buildXml, isElement, elements, children2, first, relAttr;
|
|
39436
39646
|
var init_xml = __esm({
|
|
39437
39647
|
"xml/xml.ts"() {
|
|
39438
39648
|
init_namespaces();
|
|
@@ -39440,13 +39650,31 @@ var init_xml = __esm({
|
|
|
39440
39650
|
maxDepth: 512,
|
|
39441
39651
|
maxNodes: 5e6
|
|
39442
39652
|
};
|
|
39653
|
+
XmlLimitError = class extends Error {
|
|
39654
|
+
code = "xml-limit";
|
|
39655
|
+
/** The limit that was exceeded. */
|
|
39656
|
+
limit;
|
|
39657
|
+
/** Its value: the largest depth or element count allowed. */
|
|
39658
|
+
maximum;
|
|
39659
|
+
constructor(message, limit, maximum) {
|
|
39660
|
+
super(message);
|
|
39661
|
+
this.name = "XmlLimitError";
|
|
39662
|
+
this.limit = limit;
|
|
39663
|
+
this.maximum = maximum;
|
|
39664
|
+
}
|
|
39665
|
+
};
|
|
39443
39666
|
TAG_RE = /<(\/?)([^\s\/><]+)(?:\s+[^\s=\/><]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*\s*(\/?)>/y;
|
|
39444
39667
|
MARKUP_SKIPS = [
|
|
39445
39668
|
["<!--", "-->"],
|
|
39446
39669
|
["<![CDATA[", "]]>"],
|
|
39447
39670
|
["<?", "?>"]
|
|
39448
39671
|
];
|
|
39449
|
-
|
|
39672
|
+
CRLF_DECLARATION = /^<\?xml[^>]*\?>\r\n/;
|
|
39673
|
+
crlfDeclarations = /* @__PURE__ */ new WeakSet();
|
|
39674
|
+
buildXml = (node) => {
|
|
39675
|
+
const xml = new xmldom.XMLSerializer().serializeToString(node);
|
|
39676
|
+
return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
|
|
39677
|
+
};
|
|
39450
39678
|
isElement = (node) => node.nodeType === 1;
|
|
39451
39679
|
elements = (parent) => Array.from(parent.childNodes).filter(isElement);
|
|
39452
39680
|
children2 = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
@@ -51053,17 +51281,24 @@ var init_body_properties_parser = __esm({
|
|
|
51053
51281
|
function stripFontStyleSuffix(fontName) {
|
|
51054
51282
|
let name = fontName.trim();
|
|
51055
51283
|
let stripped = false;
|
|
51056
|
-
|
|
51284
|
+
let previous = "";
|
|
51285
|
+
let tokens = 0;
|
|
51286
|
+
for (; ; ) {
|
|
51057
51287
|
const idx = name.lastIndexOf(" ");
|
|
51058
51288
|
if (idx <= 0) {
|
|
51059
51289
|
break;
|
|
51060
51290
|
}
|
|
51061
51291
|
const token2 = name.slice(idx + 1).toLowerCase().replace(/-/g, "");
|
|
51062
|
-
|
|
51292
|
+
const prefix = FONT_WEIGHT_PREFIX_TOKENS.has(token2) && FONT_PREFIXED_WEIGHT_TOKENS.has(previous);
|
|
51293
|
+
if (!prefix && (tokens >= 2 || !FONT_STYLE_SUFFIX_TOKENS.has(token2))) {
|
|
51063
51294
|
break;
|
|
51064
51295
|
}
|
|
51065
51296
|
name = name.slice(0, idx).trim();
|
|
51066
51297
|
stripped = true;
|
|
51298
|
+
previous = prefix ? "" : token2;
|
|
51299
|
+
if (!prefix) {
|
|
51300
|
+
tokens++;
|
|
51301
|
+
}
|
|
51067
51302
|
}
|
|
51068
51303
|
return stripped && name.length > 0 ? name : void 0;
|
|
51069
51304
|
}
|
|
@@ -51104,7 +51339,7 @@ function quoteFontName(name) {
|
|
|
51104
51339
|
}
|
|
51105
51340
|
return `"${trimmed2}"`;
|
|
51106
51341
|
}
|
|
51107
|
-
var FONT_SUBSTITUTION_MAP, FONT_STYLE_SUFFIX_TOKENS, CSS_GENERIC_FAMILIES;
|
|
51342
|
+
var FONT_SUBSTITUTION_MAP, FONT_STYLE_SUFFIX_TOKENS, FONT_WEIGHT_PREFIX_TOKENS, FONT_PREFIXED_WEIGHT_TOKENS, CSS_GENERIC_FAMILIES;
|
|
51108
51343
|
var init_font_substitution = __esm({
|
|
51109
51344
|
"pptx/core/utils/font-substitution.ts"() {
|
|
51110
51345
|
FONT_SUBSTITUTION_MAP = {
|
|
@@ -51292,6 +51527,8 @@ var init_font_substitution = __esm({
|
|
|
51292
51527
|
"italic",
|
|
51293
51528
|
"oblique"
|
|
51294
51529
|
]);
|
|
51530
|
+
FONT_WEIGHT_PREFIX_TOKENS = /* @__PURE__ */ new Set(["semi", "demi", "extra", "ultra"]);
|
|
51531
|
+
FONT_PREFIXED_WEIGHT_TOKENS = /* @__PURE__ */ new Set(["bold", "light", "black"]);
|
|
51295
51532
|
CSS_GENERIC_FAMILIES = /* @__PURE__ */ new Set([
|
|
51296
51533
|
"serif",
|
|
51297
51534
|
"sans-serif",
|
|
@@ -61672,6 +61909,165 @@ var init_inherited_shape_transform = __esm({
|
|
|
61672
61909
|
}
|
|
61673
61910
|
});
|
|
61674
61911
|
|
|
61912
|
+
// pptx/core/utils/placeholder-xml.ts
|
|
61913
|
+
function findNonVisualProps(rawXml) {
|
|
61914
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
61915
|
+
const parent = rawXml[container2];
|
|
61916
|
+
const nvPr = parent?.["p:nvPr"];
|
|
61917
|
+
if (nvPr) {
|
|
61918
|
+
return nvPr;
|
|
61919
|
+
}
|
|
61920
|
+
}
|
|
61921
|
+
return void 0;
|
|
61922
|
+
}
|
|
61923
|
+
function retargetPlaceholder(rawXml, target) {
|
|
61924
|
+
const nvPr = findNonVisualProps(rawXml);
|
|
61925
|
+
if (!nvPr) {
|
|
61926
|
+
return;
|
|
61927
|
+
}
|
|
61928
|
+
const ph = nvPr["p:ph"] ?? {};
|
|
61929
|
+
nvPr["p:ph"] = ph;
|
|
61930
|
+
if (target.type) {
|
|
61931
|
+
ph["@_type"] = target.type;
|
|
61932
|
+
} else {
|
|
61933
|
+
delete ph["@_type"];
|
|
61934
|
+
}
|
|
61935
|
+
if (target.idx !== void 0) {
|
|
61936
|
+
ph["@_idx"] = target.idx;
|
|
61937
|
+
} else {
|
|
61938
|
+
delete ph["@_idx"];
|
|
61939
|
+
}
|
|
61940
|
+
}
|
|
61941
|
+
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
61942
|
+
const spPr = rawXml["p:spPr"];
|
|
61943
|
+
if (!spPr) {
|
|
61944
|
+
return;
|
|
61945
|
+
}
|
|
61946
|
+
const xfrm = spPr["a:xfrm"] ?? {};
|
|
61947
|
+
spPr["a:xfrm"] = xfrm;
|
|
61948
|
+
const off = xfrm["a:off"] ?? {};
|
|
61949
|
+
xfrm["a:off"] = off;
|
|
61950
|
+
off["@_x"] = String(xEmu);
|
|
61951
|
+
off["@_y"] = String(yEmu);
|
|
61952
|
+
const ext = xfrm["a:ext"] ?? {};
|
|
61953
|
+
xfrm["a:ext"] = ext;
|
|
61954
|
+
ext["@_cx"] = String(cxEmu);
|
|
61955
|
+
ext["@_cy"] = String(cyEmu);
|
|
61956
|
+
}
|
|
61957
|
+
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
61958
|
+
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
61959
|
+
return null;
|
|
61960
|
+
}
|
|
61961
|
+
const phNode = {};
|
|
61962
|
+
if (target.type) {
|
|
61963
|
+
phNode["@_type"] = target.type;
|
|
61964
|
+
}
|
|
61965
|
+
if (target.idx !== void 0) {
|
|
61966
|
+
phNode["@_idx"] = target.idx;
|
|
61967
|
+
}
|
|
61968
|
+
const rawXml = {
|
|
61969
|
+
"p:nvSpPr": {
|
|
61970
|
+
"p:cNvPr": {
|
|
61971
|
+
"@_id": uniqueId,
|
|
61972
|
+
"@_name": `Placeholder ${target.type || "content"}`
|
|
61973
|
+
},
|
|
61974
|
+
"p:cNvSpPr": {
|
|
61975
|
+
"a:spLocks": { "@_noGrp": "1" }
|
|
61976
|
+
},
|
|
61977
|
+
"p:nvPr": {
|
|
61978
|
+
"p:ph": phNode
|
|
61979
|
+
}
|
|
61980
|
+
},
|
|
61981
|
+
"p:spPr": {
|
|
61982
|
+
"a:xfrm": {
|
|
61983
|
+
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
61984
|
+
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
61985
|
+
}
|
|
61986
|
+
},
|
|
61987
|
+
"p:txBody": {
|
|
61988
|
+
"a:bodyPr": {},
|
|
61989
|
+
"a:lstStyle": {},
|
|
61990
|
+
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
61991
|
+
}
|
|
61992
|
+
};
|
|
61993
|
+
return {
|
|
61994
|
+
type: "text",
|
|
61995
|
+
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
61996
|
+
x: Math.round(xEmu / EMU_PER_PX),
|
|
61997
|
+
y: Math.round(yEmu / EMU_PER_PX),
|
|
61998
|
+
width: Math.round(cxEmu / EMU_PER_PX),
|
|
61999
|
+
height: Math.round(cyEmu / EMU_PER_PX),
|
|
62000
|
+
text: "",
|
|
62001
|
+
rawXml
|
|
62002
|
+
};
|
|
62003
|
+
}
|
|
62004
|
+
var init_placeholder_xml = __esm({
|
|
62005
|
+
"pptx/core/utils/placeholder-xml.ts"() {
|
|
62006
|
+
init_constants2();
|
|
62007
|
+
}
|
|
62008
|
+
});
|
|
62009
|
+
|
|
62010
|
+
// pptx/core/core/runtime/save-geometry-validation.ts
|
|
62011
|
+
function omitsInheritedFrame(element) {
|
|
62012
|
+
if (!["text", "shape", "picture", "media"].includes(element.type) || !element.rawXml)
|
|
62013
|
+
return false;
|
|
62014
|
+
if (!xmlHasChild(findNonVisualProps(element.rawXml), "p:ph")) return false;
|
|
62015
|
+
if (xmlHasChild(xmlChild(element.rawXml, "p:spPr"), "a:xfrm") || xmlHasChild(element.rawXml, "p:xfrm"))
|
|
62016
|
+
return false;
|
|
62017
|
+
const baseline = element.inheritedTransform;
|
|
62018
|
+
if (!baseline) return FRAME_FIELDS.every((key2) => element[key2] === void 0);
|
|
62019
|
+
return FRAME_FIELDS.every(
|
|
62020
|
+
(key2) => Number.isFinite(baseline[key2]) && (element[key2] === void 0 || element[key2] === baseline[key2])
|
|
62021
|
+
) && ["rotation", "skewX", "skewY", "flipHorizontal", "flipVertical"].every(
|
|
62022
|
+
(key2) => (element[key2] ?? 0) === (baseline[key2] ?? 0)
|
|
62023
|
+
);
|
|
62024
|
+
}
|
|
62025
|
+
function validateElementGeometry(element, context, emuPerPx = 9525) {
|
|
62026
|
+
const inherited = omitsInheritedFrame(element);
|
|
62027
|
+
const record2 = element;
|
|
62028
|
+
const fields = [...inherited ? [] : FRAME_FIELDS, ...OPTIONAL_FIELDS];
|
|
62029
|
+
for (const field of fields) {
|
|
62030
|
+
const value = record2[field];
|
|
62031
|
+
if (OPTIONAL_FIELDS.includes(field) && value === void 0) continue;
|
|
62032
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(value * emuPerPx)) {
|
|
62033
|
+
throw new Error(
|
|
62034
|
+
`${context}: element '${element.id}' (${element.name ?? "unnamed"}, type=${element.type}) has invalid ${field}=${String(value)}; expected a finite number`
|
|
62035
|
+
);
|
|
62036
|
+
}
|
|
62037
|
+
}
|
|
62038
|
+
if (element.type === "group") {
|
|
62039
|
+
for (const child31 of element.children) validateElementGeometry(child31, context, emuPerPx);
|
|
62040
|
+
}
|
|
62041
|
+
}
|
|
62042
|
+
function validateSlideGeometry(slides) {
|
|
62043
|
+
for (const slide of slides) {
|
|
62044
|
+
for (const element of slide.elements) {
|
|
62045
|
+
validateElementGeometry(element, `Slide ${slide.slideNumber} (${slide.id})`);
|
|
62046
|
+
}
|
|
62047
|
+
}
|
|
62048
|
+
}
|
|
62049
|
+
var FRAME_FIELDS, OPTIONAL_FIELDS;
|
|
62050
|
+
var init_save_geometry_validation = __esm({
|
|
62051
|
+
"pptx/core/core/runtime/save-geometry-validation.ts"() {
|
|
62052
|
+
init_placeholder_xml();
|
|
62053
|
+
init_xml_access();
|
|
62054
|
+
FRAME_FIELDS = ["x", "y", "width", "height"];
|
|
62055
|
+
OPTIONAL_FIELDS = [
|
|
62056
|
+
"xEmu",
|
|
62057
|
+
"yEmu",
|
|
62058
|
+
"widthEmu",
|
|
62059
|
+
"heightEmu",
|
|
62060
|
+
"rotation",
|
|
62061
|
+
"skewX",
|
|
62062
|
+
"skewY",
|
|
62063
|
+
"chOffXEmu",
|
|
62064
|
+
"chOffYEmu",
|
|
62065
|
+
"chExtWidthEmu",
|
|
62066
|
+
"chExtHeightEmu"
|
|
62067
|
+
];
|
|
62068
|
+
}
|
|
62069
|
+
});
|
|
62070
|
+
|
|
61675
62071
|
// pptx/core/core/builders/PptxElementTransformUpdater.ts
|
|
61676
62072
|
var PptxElementTransformUpdater;
|
|
61677
62073
|
var init_PptxElementTransformUpdater = __esm({
|
|
@@ -61681,6 +62077,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
61681
62077
|
init_xml_access();
|
|
61682
62078
|
init_group_tight_rewrap();
|
|
61683
62079
|
init_inherited_shape_transform();
|
|
62080
|
+
init_save_geometry_validation();
|
|
61684
62081
|
PptxElementTransformUpdater = class {
|
|
61685
62082
|
applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
|
|
61686
62083
|
const transform7 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"] || // A group's child geometry uses a different frame from the load-time baseline.
|
|
@@ -61688,6 +62085,7 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
61688
62085
|
if (!transform7) {
|
|
61689
62086
|
return;
|
|
61690
62087
|
}
|
|
62088
|
+
validateElementGeometry(element, "Transform writer", emuPerPx);
|
|
61691
62089
|
if (!transform7["a:off"]) {
|
|
61692
62090
|
transform7["a:off"] = {};
|
|
61693
62091
|
}
|
|
@@ -64722,7 +65120,7 @@ function parseBorderSide(side) {
|
|
|
64722
65120
|
}
|
|
64723
65121
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
64724
65122
|
if (widthEmu > 0) {
|
|
64725
|
-
border.width = Math.max(1, Math.round(widthEmu /
|
|
65123
|
+
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL3));
|
|
64726
65124
|
has2 = true;
|
|
64727
65125
|
}
|
|
64728
65126
|
const prstDash = ln["a:prstDash"];
|
|
@@ -64779,12 +65177,12 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
64779
65177
|
if (bevel2) {
|
|
64780
65178
|
const bevelWidth = parseInt(String(bevel2["@_w"] || "0"), 10);
|
|
64781
65179
|
if (bevelWidth > 0) {
|
|
64782
|
-
cell3D.bevelWidth = Math.round(bevelWidth /
|
|
65180
|
+
cell3D.bevelWidth = Math.round(bevelWidth / EMU_PER_PIXEL3);
|
|
64783
65181
|
hasStyle = true;
|
|
64784
65182
|
}
|
|
64785
65183
|
const bevelHeight = parseInt(String(bevel2["@_h"] || "0"), 10);
|
|
64786
65184
|
if (bevelHeight > 0) {
|
|
64787
|
-
cell3D.bevelHeight = Math.round(bevelHeight /
|
|
65185
|
+
cell3D.bevelHeight = Math.round(bevelHeight / EMU_PER_PIXEL3);
|
|
64788
65186
|
hasStyle = true;
|
|
64789
65187
|
}
|
|
64790
65188
|
const bevelPreset = String(bevel2["@_prst"] || "").trim();
|
|
@@ -64808,11 +65206,11 @@ function parseTableStyleSectionCell3D(tcStyle) {
|
|
|
64808
65206
|
}
|
|
64809
65207
|
return hasStyle ? cell3D : void 0;
|
|
64810
65208
|
}
|
|
64811
|
-
var
|
|
65209
|
+
var EMU_PER_PIXEL3, BORDER_SIDES;
|
|
64812
65210
|
var init_table_style_border_parse = __esm({
|
|
64813
65211
|
"pptx/core/core/runtime/table-style-border-parse.ts"() {
|
|
64814
65212
|
init_color_primitives();
|
|
64815
|
-
|
|
65213
|
+
EMU_PER_PIXEL3 = 9525;
|
|
64816
65214
|
BORDER_SIDES = [
|
|
64817
65215
|
"left",
|
|
64818
65216
|
"right",
|
|
@@ -93865,6 +94263,80 @@ var init_factories = __esm({
|
|
|
93865
94263
|
}
|
|
93866
94264
|
});
|
|
93867
94265
|
|
|
94266
|
+
// pptx/core/utils/placeholder-remap.ts
|
|
94267
|
+
function placeholderContentRole(type) {
|
|
94268
|
+
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
94269
|
+
if (TITLE_ROLE.has(declared)) {
|
|
94270
|
+
return "title";
|
|
94271
|
+
}
|
|
94272
|
+
if (CONTENT_ROLE.has(declared)) {
|
|
94273
|
+
return "content";
|
|
94274
|
+
}
|
|
94275
|
+
return declared;
|
|
94276
|
+
}
|
|
94277
|
+
function preferredPlaceholderTypes(element) {
|
|
94278
|
+
switch (element.type) {
|
|
94279
|
+
case "image":
|
|
94280
|
+
case "picture":
|
|
94281
|
+
return ["pic", "obj", "body"];
|
|
94282
|
+
case "chart":
|
|
94283
|
+
return ["chart", "obj", "body"];
|
|
94284
|
+
case "table":
|
|
94285
|
+
return ["tbl", "obj", "body"];
|
|
94286
|
+
case "media":
|
|
94287
|
+
case "model3d":
|
|
94288
|
+
return ["media", "pic", "obj", "body"];
|
|
94289
|
+
case "smartArt":
|
|
94290
|
+
return ["dgm", "obj", "body"];
|
|
94291
|
+
case "text":
|
|
94292
|
+
return ["body", "subtitle", "obj"];
|
|
94293
|
+
default:
|
|
94294
|
+
return ["obj", "body"];
|
|
94295
|
+
}
|
|
94296
|
+
}
|
|
94297
|
+
function scorePlaceholderMatch(element, source, target) {
|
|
94298
|
+
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
94299
|
+
return -1;
|
|
94300
|
+
}
|
|
94301
|
+
const sourceType = normalizeType(source.type);
|
|
94302
|
+
const targetType = normalizeType(target.type);
|
|
94303
|
+
let score = 1;
|
|
94304
|
+
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
94305
|
+
score += 100;
|
|
94306
|
+
}
|
|
94307
|
+
if (sourceType === targetType) {
|
|
94308
|
+
score += 50;
|
|
94309
|
+
}
|
|
94310
|
+
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
94311
|
+
if (preferred >= 0) {
|
|
94312
|
+
score += 30 - preferred * 5;
|
|
94313
|
+
}
|
|
94314
|
+
if (targetType === "obj") {
|
|
94315
|
+
score += 10;
|
|
94316
|
+
}
|
|
94317
|
+
return score;
|
|
94318
|
+
}
|
|
94319
|
+
function normalizeType(type) {
|
|
94320
|
+
return (type ?? "").trim().toLowerCase() || "body";
|
|
94321
|
+
}
|
|
94322
|
+
var TITLE_ROLE, CONTENT_ROLE;
|
|
94323
|
+
var init_placeholder_remap = __esm({
|
|
94324
|
+
"pptx/core/utils/placeholder-remap.ts"() {
|
|
94325
|
+
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
94326
|
+
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
94327
|
+
"body",
|
|
94328
|
+
"obj",
|
|
94329
|
+
"subtitle",
|
|
94330
|
+
"pic",
|
|
94331
|
+
"chart",
|
|
94332
|
+
"tbl",
|
|
94333
|
+
"media",
|
|
94334
|
+
"clipart",
|
|
94335
|
+
"dgm"
|
|
94336
|
+
]);
|
|
94337
|
+
}
|
|
94338
|
+
});
|
|
94339
|
+
|
|
93868
94340
|
// pptx/core/core/runtime/master-save-helpers.ts
|
|
93869
94341
|
function applyHeaderFooterFlagsToNode(root, flags) {
|
|
93870
94342
|
if (!flags || Object.keys(flags).length === 0) {
|
|
@@ -113444,178 +113916,6 @@ var init_chart_user_shapes_serializer = __esm({
|
|
|
113444
113916
|
}
|
|
113445
113917
|
});
|
|
113446
113918
|
|
|
113447
|
-
// pptx/core/utils/placeholder-remap.ts
|
|
113448
|
-
function placeholderContentRole(type) {
|
|
113449
|
-
const declared = (type ?? "").trim().toLowerCase() || "body";
|
|
113450
|
-
if (TITLE_ROLE.has(declared)) {
|
|
113451
|
-
return "title";
|
|
113452
|
-
}
|
|
113453
|
-
if (CONTENT_ROLE.has(declared)) {
|
|
113454
|
-
return "content";
|
|
113455
|
-
}
|
|
113456
|
-
return declared;
|
|
113457
|
-
}
|
|
113458
|
-
function preferredPlaceholderTypes(element) {
|
|
113459
|
-
switch (element.type) {
|
|
113460
|
-
case "image":
|
|
113461
|
-
case "picture":
|
|
113462
|
-
return ["pic", "obj", "body"];
|
|
113463
|
-
case "chart":
|
|
113464
|
-
return ["chart", "obj", "body"];
|
|
113465
|
-
case "table":
|
|
113466
|
-
return ["tbl", "obj", "body"];
|
|
113467
|
-
case "media":
|
|
113468
|
-
case "model3d":
|
|
113469
|
-
return ["media", "pic", "obj", "body"];
|
|
113470
|
-
case "smartArt":
|
|
113471
|
-
return ["dgm", "obj", "body"];
|
|
113472
|
-
case "text":
|
|
113473
|
-
return ["body", "subtitle", "obj"];
|
|
113474
|
-
default:
|
|
113475
|
-
return ["obj", "body"];
|
|
113476
|
-
}
|
|
113477
|
-
}
|
|
113478
|
-
function scorePlaceholderMatch(element, source, target) {
|
|
113479
|
-
if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
|
|
113480
|
-
return -1;
|
|
113481
|
-
}
|
|
113482
|
-
const sourceType = normalizeType(source.type);
|
|
113483
|
-
const targetType = normalizeType(target.type);
|
|
113484
|
-
let score = 1;
|
|
113485
|
-
if (source.idx !== void 0 && source.idx === target.idx) {
|
|
113486
|
-
score += 100;
|
|
113487
|
-
}
|
|
113488
|
-
if (sourceType === targetType) {
|
|
113489
|
-
score += 50;
|
|
113490
|
-
}
|
|
113491
|
-
const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
|
|
113492
|
-
if (preferred >= 0) {
|
|
113493
|
-
score += 30 - preferred * 5;
|
|
113494
|
-
}
|
|
113495
|
-
if (targetType === "obj") {
|
|
113496
|
-
score += 10;
|
|
113497
|
-
}
|
|
113498
|
-
return score;
|
|
113499
|
-
}
|
|
113500
|
-
function normalizeType(type) {
|
|
113501
|
-
return (type ?? "").trim().toLowerCase() || "body";
|
|
113502
|
-
}
|
|
113503
|
-
var TITLE_ROLE, CONTENT_ROLE;
|
|
113504
|
-
var init_placeholder_remap = __esm({
|
|
113505
|
-
"pptx/core/utils/placeholder-remap.ts"() {
|
|
113506
|
-
TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
|
|
113507
|
-
CONTENT_ROLE = /* @__PURE__ */ new Set([
|
|
113508
|
-
"body",
|
|
113509
|
-
"obj",
|
|
113510
|
-
"subtitle",
|
|
113511
|
-
"pic",
|
|
113512
|
-
"chart",
|
|
113513
|
-
"tbl",
|
|
113514
|
-
"media",
|
|
113515
|
-
"clipart",
|
|
113516
|
-
"dgm"
|
|
113517
|
-
]);
|
|
113518
|
-
}
|
|
113519
|
-
});
|
|
113520
|
-
|
|
113521
|
-
// pptx/core/utils/placeholder-xml.ts
|
|
113522
|
-
function findNonVisualProps(rawXml) {
|
|
113523
|
-
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
113524
|
-
const parent = rawXml[container2];
|
|
113525
|
-
const nvPr = parent?.["p:nvPr"];
|
|
113526
|
-
if (nvPr) {
|
|
113527
|
-
return nvPr;
|
|
113528
|
-
}
|
|
113529
|
-
}
|
|
113530
|
-
return void 0;
|
|
113531
|
-
}
|
|
113532
|
-
function retargetPlaceholder(rawXml, target) {
|
|
113533
|
-
const nvPr = findNonVisualProps(rawXml);
|
|
113534
|
-
if (!nvPr) {
|
|
113535
|
-
return;
|
|
113536
|
-
}
|
|
113537
|
-
const ph = nvPr["p:ph"] ?? {};
|
|
113538
|
-
nvPr["p:ph"] = ph;
|
|
113539
|
-
if (target.type) {
|
|
113540
|
-
ph["@_type"] = target.type;
|
|
113541
|
-
} else {
|
|
113542
|
-
delete ph["@_type"];
|
|
113543
|
-
}
|
|
113544
|
-
if (target.idx !== void 0) {
|
|
113545
|
-
ph["@_idx"] = target.idx;
|
|
113546
|
-
} else {
|
|
113547
|
-
delete ph["@_idx"];
|
|
113548
|
-
}
|
|
113549
|
-
}
|
|
113550
|
-
function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
|
|
113551
|
-
const spPr = rawXml["p:spPr"];
|
|
113552
|
-
if (!spPr) {
|
|
113553
|
-
return;
|
|
113554
|
-
}
|
|
113555
|
-
const xfrm = spPr["a:xfrm"] ?? {};
|
|
113556
|
-
spPr["a:xfrm"] = xfrm;
|
|
113557
|
-
const off = xfrm["a:off"] ?? {};
|
|
113558
|
-
xfrm["a:off"] = off;
|
|
113559
|
-
off["@_x"] = String(xEmu);
|
|
113560
|
-
off["@_y"] = String(yEmu);
|
|
113561
|
-
const ext = xfrm["a:ext"] ?? {};
|
|
113562
|
-
xfrm["a:ext"] = ext;
|
|
113563
|
-
ext["@_cx"] = String(cxEmu);
|
|
113564
|
-
ext["@_cy"] = String(cyEmu);
|
|
113565
|
-
}
|
|
113566
|
-
function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
|
|
113567
|
-
if (cxEmu <= 0 || cyEmu <= 0) {
|
|
113568
|
-
return null;
|
|
113569
|
-
}
|
|
113570
|
-
const phNode = {};
|
|
113571
|
-
if (target.type) {
|
|
113572
|
-
phNode["@_type"] = target.type;
|
|
113573
|
-
}
|
|
113574
|
-
if (target.idx !== void 0) {
|
|
113575
|
-
phNode["@_idx"] = target.idx;
|
|
113576
|
-
}
|
|
113577
|
-
const rawXml = {
|
|
113578
|
-
"p:nvSpPr": {
|
|
113579
|
-
"p:cNvPr": {
|
|
113580
|
-
"@_id": uniqueId,
|
|
113581
|
-
"@_name": `Placeholder ${target.type || "content"}`
|
|
113582
|
-
},
|
|
113583
|
-
"p:cNvSpPr": {
|
|
113584
|
-
"a:spLocks": { "@_noGrp": "1" }
|
|
113585
|
-
},
|
|
113586
|
-
"p:nvPr": {
|
|
113587
|
-
"p:ph": phNode
|
|
113588
|
-
}
|
|
113589
|
-
},
|
|
113590
|
-
"p:spPr": {
|
|
113591
|
-
"a:xfrm": {
|
|
113592
|
-
"a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
|
|
113593
|
-
"a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
|
|
113594
|
-
}
|
|
113595
|
-
},
|
|
113596
|
-
"p:txBody": {
|
|
113597
|
-
"a:bodyPr": {},
|
|
113598
|
-
"a:lstStyle": {},
|
|
113599
|
-
"a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
|
|
113600
|
-
}
|
|
113601
|
-
};
|
|
113602
|
-
return {
|
|
113603
|
-
type: "text",
|
|
113604
|
-
id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
|
|
113605
|
-
x: Math.round(xEmu / EMU_PER_PX),
|
|
113606
|
-
y: Math.round(yEmu / EMU_PER_PX),
|
|
113607
|
-
width: Math.round(cxEmu / EMU_PER_PX),
|
|
113608
|
-
height: Math.round(cyEmu / EMU_PER_PX),
|
|
113609
|
-
text: "",
|
|
113610
|
-
rawXml
|
|
113611
|
-
};
|
|
113612
|
-
}
|
|
113613
|
-
var init_placeholder_xml = __esm({
|
|
113614
|
-
"pptx/core/utils/placeholder-xml.ts"() {
|
|
113615
|
-
init_constants2();
|
|
113616
|
-
}
|
|
113617
|
-
});
|
|
113618
|
-
|
|
113619
113919
|
// pptx/core/utils/text-fill-blip.ts
|
|
113620
113920
|
function resolveTextFillBlip(blipFill, lookupTarget, resolveArchivePath, allowExternal) {
|
|
113621
113921
|
const blip = blipFill["a:blip"];
|
|
@@ -133180,8 +133480,8 @@ function mergeBorderSideXml(border, existingSide) {
|
|
|
133180
133480
|
const ln = ensureChild2(existing, "a:ln");
|
|
133181
133481
|
if (border.width !== void 0) {
|
|
133182
133482
|
const currentEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
133183
|
-
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu /
|
|
133184
|
-
ln["@_w"] = String(Math.round(border.width *
|
|
133483
|
+
if (currentEmu <= 0 || Math.max(1, Math.round(currentEmu / EMU_PER_PIXEL4)) !== border.width) {
|
|
133484
|
+
ln["@_w"] = String(Math.round(border.width * EMU_PER_PIXEL4));
|
|
133185
133485
|
}
|
|
133186
133486
|
}
|
|
133187
133487
|
if (border.dash) {
|
|
@@ -133237,10 +133537,10 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
133237
133537
|
if (cell3D.bevelWidth !== void 0 || cell3D.bevelHeight !== void 0 || cell3D.bevelPreset !== void 0) {
|
|
133238
133538
|
const bevel2 = {};
|
|
133239
133539
|
if (cell3D.bevelWidth !== void 0) {
|
|
133240
|
-
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth *
|
|
133540
|
+
bevel2["@_w"] = String(Math.round(cell3D.bevelWidth * EMU_PER_PIXEL4));
|
|
133241
133541
|
}
|
|
133242
133542
|
if (cell3D.bevelHeight !== void 0) {
|
|
133243
|
-
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight *
|
|
133543
|
+
bevel2["@_h"] = String(Math.round(cell3D.bevelHeight * EMU_PER_PIXEL4));
|
|
133244
133544
|
}
|
|
133245
133545
|
if (cell3D.bevelPreset) {
|
|
133246
133546
|
bevel2["@_prst"] = cell3D.bevelPreset;
|
|
@@ -133259,12 +133559,12 @@ function writeTableStyleSectionCell3D(section, cell3D) {
|
|
|
133259
133559
|
}
|
|
133260
133560
|
tcStyle["a:cell3D"] = node;
|
|
133261
133561
|
}
|
|
133262
|
-
var
|
|
133562
|
+
var EMU_PER_PIXEL4, BORDER_SIDE_ORDER, LN_CHILD_ORDER, LN_FILL_KEYS;
|
|
133263
133563
|
var init_table_style_border_write = __esm({
|
|
133264
133564
|
"pptx/core/core/runtime/table-style-border-write.ts"() {
|
|
133265
133565
|
init_xml_reorder();
|
|
133266
133566
|
init_table_style_xml_helpers();
|
|
133267
|
-
|
|
133567
|
+
EMU_PER_PIXEL4 = 9525;
|
|
133268
133568
|
BORDER_SIDE_ORDER = [
|
|
133269
133569
|
"a:left",
|
|
133270
133570
|
"a:right",
|
|
@@ -134202,6 +134502,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
134202
134502
|
init_header_footer_parts();
|
|
134203
134503
|
init_pptx_print_properties();
|
|
134204
134504
|
init_PptxHandlerRuntimeSaveStructuralIds();
|
|
134505
|
+
init_save_geometry_validation();
|
|
134205
134506
|
PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime53 {
|
|
134206
134507
|
/**
|
|
134207
134508
|
* Resolve the effective conformance class for this save operation.
|
|
@@ -134216,6 +134517,19 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
|
|
|
134216
134517
|
return this.isStrictOoxml ? "strict" : "transitional";
|
|
134217
134518
|
}
|
|
134218
134519
|
async save(slides, options) {
|
|
134520
|
+
validateSlideGeometry(slides);
|
|
134521
|
+
const templates = [
|
|
134522
|
+
...options?.slideMasters ?? [],
|
|
134523
|
+
...options?.slideLayouts ?? [],
|
|
134524
|
+
...options?.slideMasters?.flatMap((master) => master.layouts ?? []) ?? [],
|
|
134525
|
+
...options?.notesMaster ? [options.notesMaster] : [],
|
|
134526
|
+
...options?.handoutMaster ? [options.handoutMaster] : []
|
|
134527
|
+
];
|
|
134528
|
+
for (const template of templates) {
|
|
134529
|
+
for (const element of template.elements ?? []) {
|
|
134530
|
+
validateElementGeometry(element, `Template (${template.path})`);
|
|
134531
|
+
}
|
|
134532
|
+
}
|
|
134219
134533
|
if (options?.outputFormat === "ppt") {
|
|
134220
134534
|
return this.saveAsLegacyPpt(
|
|
134221
134535
|
slides,
|
|
@@ -135183,8 +135497,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
135183
135497
|
return this.scanPlaceholderBuckets(spTree, (info) => info?.type === type);
|
|
135184
135498
|
}
|
|
135185
135499
|
/** The layout and master counterparts of a placeholder, unmerged. */
|
|
135186
|
-
findPlaceholderContexts(slidePath, expected) {
|
|
135187
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
135500
|
+
findPlaceholderContexts(slidePath, expected, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
135188
135501
|
if (!layoutPath) {
|
|
135189
135502
|
return {};
|
|
135190
135503
|
}
|
|
@@ -135196,10 +135509,11 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
135196
135509
|
const master = this.findPlaceholderInShapeTree(masterSpTree, expected) ?? this.findSingletonPlaceholderInShapeTree(masterSpTree, expected);
|
|
135197
135510
|
return { layout, master };
|
|
135198
135511
|
}
|
|
135199
|
-
findPlaceholderContext(slidePath, expected) {
|
|
135512
|
+
findPlaceholderContext(slidePath, expected, layoutPath) {
|
|
135200
135513
|
const { layout: layoutContext, master: masterContext } = this.findPlaceholderContexts(
|
|
135201
135514
|
slidePath,
|
|
135202
|
-
expected
|
|
135515
|
+
expected,
|
|
135516
|
+
layoutPath
|
|
135203
135517
|
);
|
|
135204
135518
|
if (!layoutContext) {
|
|
135205
135519
|
return masterContext;
|
|
@@ -135225,8 +135539,8 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
135225
135539
|
* a master `p:sp`), so the layout keeps winning exactly as it does when
|
|
135226
135540
|
* both are shapes.
|
|
135227
135541
|
*/
|
|
135228
|
-
findPlaceholderNode(slidePath, expected) {
|
|
135229
|
-
const { layout, master } = this.findPlaceholderContexts(slidePath, expected);
|
|
135542
|
+
findPlaceholderNode(slidePath, expected, layoutPath) {
|
|
135543
|
+
const { layout, master } = this.findPlaceholderContexts(slidePath, expected, layoutPath);
|
|
135230
135544
|
const firstNode2 = (context) => context?.shape ?? context?.picture ?? context?.graphicFrame;
|
|
135231
135545
|
const layoutNode = firstNode2(layout);
|
|
135232
135546
|
const masterNode = firstNode2(master);
|
|
@@ -135267,8 +135581,7 @@ var init_PptxHandlerRuntimePlaceholderLookup = __esm({
|
|
|
135267
135581
|
* reference. Checks the layout cache first, then the master cache, and
|
|
135268
135582
|
* merges them so that layout values take priority over master values.
|
|
135269
135583
|
*/
|
|
135270
|
-
lookupPlaceholderDefaults(slidePath, phInfo) {
|
|
135271
|
-
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
135584
|
+
lookupPlaceholderDefaults(slidePath, phInfo, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
|
|
135272
135585
|
if (!layoutPath) {
|
|
135273
135586
|
return void 0;
|
|
135274
135587
|
}
|
|
@@ -135812,6 +136125,7 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
|
|
|
135812
136125
|
var PptxHandlerRuntime61;
|
|
135813
136126
|
var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
135814
136127
|
"pptx/core/core/runtime/PptxHandlerRuntimeShapeImageFill.ts"() {
|
|
136128
|
+
init_group_parsing_helpers();
|
|
135815
136129
|
init_xml_access();
|
|
135816
136130
|
init_group_shape_geometry();
|
|
135817
136131
|
init_PptxHandlerRuntimeGeometryParsing();
|
|
@@ -135983,6 +136297,53 @@ var init_PptxHandlerRuntimeShapeImageFill = __esm({
|
|
|
135983
136297
|
return null;
|
|
135984
136298
|
}
|
|
135985
136299
|
}
|
|
136300
|
+
/**
|
|
136301
|
+
* A text-bearing shape whose picture fill is inherited from its layout or
|
|
136302
|
+
* master placeholder (`a:blipFill` absent from its own `spPr`) gets
|
|
136303
|
+
* `fillMode: 'image'` from the merged properties but no image: the blip's
|
|
136304
|
+
* relationship id belongs to the part that authored it, not the slide.
|
|
136305
|
+
* Resolve it against the layout's, then the master's, relationships.
|
|
136306
|
+
*/
|
|
136307
|
+
async resolveInheritedFillImage(element, shape, slidePath) {
|
|
136308
|
+
const style = element?.shapeStyle;
|
|
136309
|
+
if (!element || !style || style.fillMode !== "image" || style.fillImageUrl) {
|
|
136310
|
+
return;
|
|
136311
|
+
}
|
|
136312
|
+
const placeholderInfo = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
136313
|
+
const inherited = placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
136314
|
+
const effectiveSpPr = this.mergeXmlObjects(
|
|
136315
|
+
inherited?.shape?.["p:spPr"],
|
|
136316
|
+
xmlChild(shape, "p:spPr")
|
|
136317
|
+
);
|
|
136318
|
+
const blipFill = effectiveSpPr?.["a:blipFill"];
|
|
136319
|
+
const blip = blipFill?.["a:blip"];
|
|
136320
|
+
const relId = String(blip?.["@_r:embed"] ?? blip?.["@_r:link"] ?? "");
|
|
136321
|
+
if (!relId) {
|
|
136322
|
+
return;
|
|
136323
|
+
}
|
|
136324
|
+
const layoutPath = this.resolveLayoutPathForSlide(slidePath);
|
|
136325
|
+
const masterPath = layoutPath ? this.resolveMasterPathForLayout(layoutPath) : void 0;
|
|
136326
|
+
for (const partPath of [layoutPath, masterPath]) {
|
|
136327
|
+
if (!partPath || !this.slideRelsMap.get(partPath)?.has(relId)) {
|
|
136328
|
+
continue;
|
|
136329
|
+
}
|
|
136330
|
+
const fill = await resolveGroupFillImagePure(
|
|
136331
|
+
this,
|
|
136332
|
+
blipFill,
|
|
136333
|
+
partPath
|
|
136334
|
+
);
|
|
136335
|
+
if (fill) {
|
|
136336
|
+
const isUrl = /^(?:data:|blob:|https?:)/u.test(fill.fillImageUrl);
|
|
136337
|
+
const decoded = isUrl ? void 0 : await this.getImageData(fill.fillImageUrl);
|
|
136338
|
+
style.fillImageUrl = decoded ?? fill.fillImageUrl;
|
|
136339
|
+
style.fillImageMode = fill.fillImageMode;
|
|
136340
|
+
if (element.type === "text") {
|
|
136341
|
+
element.type = "shape";
|
|
136342
|
+
}
|
|
136343
|
+
}
|
|
136344
|
+
return;
|
|
136345
|
+
}
|
|
136346
|
+
}
|
|
135986
136347
|
textVerticalAlignFromDrawingValue(value) {
|
|
135987
136348
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
135988
136349
|
if (normalized.length === 0) {
|
|
@@ -137447,14 +137808,14 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
137447
137808
|
init_element_paragraph_geometry();
|
|
137448
137809
|
init_PptxHandlerRuntimeShapeParagraphContentParsing();
|
|
137449
137810
|
PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime66 {
|
|
137450
|
-
parseShape(shape, id, slidePath) {
|
|
137811
|
+
parseShape(shape, id, slidePath, layoutPath) {
|
|
137451
137812
|
try {
|
|
137452
137813
|
const spPr = shape["p:spPr"];
|
|
137453
137814
|
const slideRelationshipMap = slidePath ? this.slideRelsMap.get(slidePath) : void 0;
|
|
137454
137815
|
const placeholderInfo = this.extractPlaceholderInfo(
|
|
137455
137816
|
shape?.["p:nvSpPr"]?.["p:nvPr"]
|
|
137456
137817
|
);
|
|
137457
|
-
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
137818
|
+
const inheritedPlaceholder = (slidePath || layoutPath) && placeholderInfo ? this.findPlaceholderContext(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
137458
137819
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
137459
137820
|
const effectiveSpPr = spPr ? {
|
|
137460
137821
|
...spPr,
|
|
@@ -137580,7 +137941,7 @@ var init_PptxHandlerRuntimeShapeParsing = __esm({
|
|
|
137580
137941
|
);
|
|
137581
137942
|
const linkedTxbxId = bodyPropResult.linkedTxbxId;
|
|
137582
137943
|
const linkedTxbxSeq = bodyPropResult.linkedTxbxSeq;
|
|
137583
|
-
const phDefaults = slidePath && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath, placeholderInfo) : void 0;
|
|
137944
|
+
const phDefaults = (slidePath || layoutPath) && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
|
|
137584
137945
|
if (phDefaults) {
|
|
137585
137946
|
this.applyPlaceholderBodyDefaults(textStyle, phDefaults);
|
|
137586
137947
|
}
|
|
@@ -138457,7 +138818,9 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
138457
138818
|
slidePath
|
|
138458
138819
|
);
|
|
138459
138820
|
}
|
|
138460
|
-
|
|
138821
|
+
const parsed = this.parseShape(node, `${idPrefix}shape-${indexInType}`, slidePath);
|
|
138822
|
+
await this.resolveInheritedFillImage(parsed, node, slidePath);
|
|
138823
|
+
return parsed;
|
|
138461
138824
|
}
|
|
138462
138825
|
case "p:pic":
|
|
138463
138826
|
return this.parsePicture(node, `${idPrefix}pic-${indexInType}`, slidePath);
|
|
@@ -146943,14 +147306,199 @@ var init_PptxHandlerRuntimeBackgroundStyles = __esm({
|
|
|
146943
147306
|
};
|
|
146944
147307
|
}
|
|
146945
147308
|
});
|
|
147309
|
+
|
|
147310
|
+
// pptx/core/core/runtime/sdk-placeholder.ts
|
|
147311
|
+
function selectTextPlaceholder(input, type, options, slots) {
|
|
147312
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(type.toLowerCase())) {
|
|
147313
|
+
throw new Error(`Unsupported text placeholder type: ${type}`);
|
|
147314
|
+
}
|
|
147315
|
+
if (options.idx !== void 0 && (!Number.isInteger(options.idx) || options.idx < 0 || options.idx > 4294967295)) {
|
|
147316
|
+
throw new Error("Placeholder idx must be an unsigned 32-bit integer");
|
|
147317
|
+
}
|
|
147318
|
+
const source = {
|
|
147319
|
+
type: type.toLowerCase(),
|
|
147320
|
+
...options.idx !== void 0 ? { idx: String(options.idx) } : {}
|
|
147321
|
+
};
|
|
147322
|
+
let best;
|
|
147323
|
+
let bestScore = 0;
|
|
147324
|
+
for (const slot of slots) {
|
|
147325
|
+
if (!TEXT_PLACEHOLDER_TYPES.has(slot.phInfo.type ?? "obj")) continue;
|
|
147326
|
+
if (source.idx !== void 0 && source.idx !== (slot.phInfo.idx ?? "0")) continue;
|
|
147327
|
+
const score = scorePlaceholderMatch(input, source, slot.phInfo);
|
|
147328
|
+
if (score > bestScore) {
|
|
147329
|
+
best = slot;
|
|
147330
|
+
bestScore = score;
|
|
147331
|
+
}
|
|
147332
|
+
}
|
|
147333
|
+
return best ? { type: canonicalPlaceholderType(best.phInfo.type ?? "obj"), idx: best.phInfo.idx } : { type: canonicalPlaceholderType(source.type), idx: source.idx };
|
|
147334
|
+
}
|
|
147335
|
+
function withoutFallbackLanguage(properties) {
|
|
147336
|
+
const { "@_lang": language, ...rest } = properties;
|
|
147337
|
+
if (language !== "en-US") return properties;
|
|
147338
|
+
const keys = Object.keys(rest);
|
|
147339
|
+
return keys.length === 0 || keys.length === 1 && rest["@_dirty"] === "0" ? void 0 : rest;
|
|
147340
|
+
}
|
|
147341
|
+
function stripFallbackLanguage(node, key2) {
|
|
147342
|
+
const properties = node[key2];
|
|
147343
|
+
if (!properties || typeof properties !== "object") return node;
|
|
147344
|
+
const next = withoutFallbackLanguage(properties);
|
|
147345
|
+
if (next === properties) return node;
|
|
147346
|
+
const result = {};
|
|
147347
|
+
for (const [name, value] of Object.entries(node)) {
|
|
147348
|
+
if (name !== key2) result[name] = value;
|
|
147349
|
+
else if (next) result[name] = next;
|
|
147350
|
+
}
|
|
147351
|
+
return result;
|
|
147352
|
+
}
|
|
147353
|
+
function withoutFallbackLanguages(paragraphs) {
|
|
147354
|
+
return paragraphs.map((paragraph) => {
|
|
147355
|
+
const next = { ...stripFallbackLanguage(paragraph, "a:endParaRPr") };
|
|
147356
|
+
for (const child31 of ["a:r", "a:br", "a:fld"]) {
|
|
147357
|
+
const nodes = next[child31];
|
|
147358
|
+
if (nodes === void 0) continue;
|
|
147359
|
+
next[child31] = Array.isArray(nodes) ? nodes.map((node) => stripFallbackLanguage(node, "a:rPr")) : stripFallbackLanguage(nodes, "a:rPr");
|
|
147360
|
+
}
|
|
147361
|
+
return next;
|
|
147362
|
+
});
|
|
147363
|
+
}
|
|
147364
|
+
function placeholderShape2(identity, paragraphs) {
|
|
147365
|
+
paragraphs = withoutFallbackLanguages(paragraphs);
|
|
147366
|
+
return {
|
|
147367
|
+
"p:nvSpPr": {
|
|
147368
|
+
"p:cNvPr": { "@_id": "2", "@_name": `Placeholder ${identity.type}` },
|
|
147369
|
+
"p:cNvSpPr": { "a:spLocks": { "@_noGrp": "1" } },
|
|
147370
|
+
"p:nvPr": {
|
|
147371
|
+
"p:ph": {
|
|
147372
|
+
"@_type": identity.type,
|
|
147373
|
+
...identity.idx !== void 0 ? { "@_idx": identity.idx } : {}
|
|
147374
|
+
}
|
|
147375
|
+
}
|
|
147376
|
+
},
|
|
147377
|
+
"p:spPr": {},
|
|
147378
|
+
"p:txBody": { "a:bodyPr": {}, "a:lstStyle": {}, "a:p": paragraphs }
|
|
147379
|
+
};
|
|
147380
|
+
}
|
|
147381
|
+
function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeFrame = false) {
|
|
147382
|
+
for (const key2 of ["x", "y", "width", "height"]) {
|
|
147383
|
+
if (options[key2] !== void 0 && !Number.isFinite(options[key2])) {
|
|
147384
|
+
throw new Error(`Invalid placeholder frame for ${key2}: expected a finite number`);
|
|
147385
|
+
}
|
|
147386
|
+
}
|
|
147387
|
+
const off = xmlPath(inherited, "p:spPr", "a:xfrm", "a:off");
|
|
147388
|
+
const ext = xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext");
|
|
147389
|
+
const frame2 = {
|
|
147390
|
+
x: options.x ?? (off?.["@_x"] !== void 0 ? Number(off["@_x"]) / emuPerPx : void 0),
|
|
147391
|
+
y: options.y ?? (off?.["@_y"] !== void 0 ? Number(off["@_y"]) / emuPerPx : void 0),
|
|
147392
|
+
width: options.width ?? (ext?.["@_cx"] !== void 0 ? Number(ext["@_cx"]) / emuPerPx : void 0),
|
|
147393
|
+
height: options.height ?? (ext?.["@_cy"] !== void 0 ? Number(ext["@_cy"]) / emuPerPx : void 0)
|
|
147394
|
+
};
|
|
147395
|
+
for (const [key2, value] of Object.entries(frame2)) {
|
|
147396
|
+
if (!Number.isFinite(value)) {
|
|
147397
|
+
throw new Error(
|
|
147398
|
+
`No matching placeholder frame for ${key2}; supply a complete explicit frame or choose a layout containing this slot`
|
|
147399
|
+
);
|
|
147400
|
+
}
|
|
147401
|
+
}
|
|
147402
|
+
if (materializeFrame || ["x", "y", "width", "height"].some((key2) => options[key2] !== void 0)) {
|
|
147403
|
+
setRawXmlTransform(
|
|
147404
|
+
shape,
|
|
147405
|
+
...["x", "y", "width", "height"].map(
|
|
147406
|
+
(key2) => Math.round(frame2[key2] * emuPerPx)
|
|
147407
|
+
)
|
|
147408
|
+
);
|
|
147409
|
+
}
|
|
147410
|
+
}
|
|
147411
|
+
var TEXT_PLACEHOLDER_TYPES;
|
|
147412
|
+
var init_sdk_placeholder = __esm({
|
|
147413
|
+
"pptx/core/core/runtime/sdk-placeholder.ts"() {
|
|
147414
|
+
init_placeholder_remap();
|
|
147415
|
+
init_placeholder_xml();
|
|
147416
|
+
init_placeholder_validation();
|
|
147417
|
+
init_xml_access();
|
|
147418
|
+
TEXT_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
|
|
147419
|
+
"title",
|
|
147420
|
+
"ctrtitle",
|
|
147421
|
+
"subtitle",
|
|
147422
|
+
"body",
|
|
147423
|
+
"obj",
|
|
147424
|
+
"dt",
|
|
147425
|
+
"ftr",
|
|
147426
|
+
"hdr",
|
|
147427
|
+
"sldnum"
|
|
147428
|
+
]);
|
|
147429
|
+
}
|
|
147430
|
+
});
|
|
147431
|
+
|
|
147432
|
+
// pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
|
|
146946
147433
|
var PptxHandlerRuntime103;
|
|
147434
|
+
var init_PptxHandlerRuntimeSdkPlaceholders = __esm({
|
|
147435
|
+
"pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts"() {
|
|
147436
|
+
init_placeholder_remap();
|
|
147437
|
+
init_xml_access();
|
|
147438
|
+
init_PptxHandlerRuntimeBackgroundStyles();
|
|
147439
|
+
init_sdk_placeholder();
|
|
147440
|
+
PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
|
|
147441
|
+
createPlaceholderElement(layoutPath, input, type, options) {
|
|
147442
|
+
if (input.type !== "text") throw new Error("Placeholder input must be text");
|
|
147443
|
+
const layout = this.layoutXmlMap.get(layoutPath);
|
|
147444
|
+
if (!layout) throw new Error(`Unknown layout: ${layoutPath}`);
|
|
147445
|
+
const identity = selectTextPlaceholder(
|
|
147446
|
+
input,
|
|
147447
|
+
type,
|
|
147448
|
+
options,
|
|
147449
|
+
this.extractLayoutPlaceholders(layout, layoutPath)
|
|
147450
|
+
);
|
|
147451
|
+
const shape = placeholderShape2(
|
|
147452
|
+
identity,
|
|
147453
|
+
this.createParagraphsFromTextContent(input.text, void 0, input.textSegments)
|
|
147454
|
+
);
|
|
147455
|
+
const inherited = this.findPlaceholderNode(
|
|
147456
|
+
"",
|
|
147457
|
+
{ type: identity.type.toLowerCase(), idx: identity.idx },
|
|
147458
|
+
layoutPath
|
|
147459
|
+
);
|
|
147460
|
+
const fallback = this.sdkMasterFrame(layoutPath, identity.type, identity.idx, inherited);
|
|
147461
|
+
applyPlaceholderFrame(
|
|
147462
|
+
shape,
|
|
147463
|
+
fallback ?? inherited,
|
|
147464
|
+
options,
|
|
147465
|
+
_PptxHandlerRuntime.EMU_PER_PX,
|
|
147466
|
+
fallback !== void 0
|
|
147467
|
+
);
|
|
147468
|
+
const element = this.parseShape(shape, input.id, void 0, layoutPath);
|
|
147469
|
+
if (!element) throw new Error("Unable to resolve placeholder content");
|
|
147470
|
+
if ((element.type === "text" || element.type === "shape") && !element.textStyle && element.textSegments?.[0]?.style) {
|
|
147471
|
+
element.textStyle = { ...element.textSegments[0].style };
|
|
147472
|
+
}
|
|
147473
|
+
return element;
|
|
147474
|
+
}
|
|
147475
|
+
sdkMasterFrame(layoutPath, type, idx, inherited) {
|
|
147476
|
+
if (!inherited) return void 0;
|
|
147477
|
+
if (xmlPath(inherited, "p:spPr", "a:xfrm", "a:off") && xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext"))
|
|
147478
|
+
return void 0;
|
|
147479
|
+
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
147480
|
+
const tree = masterPath ? xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree") : void 0;
|
|
147481
|
+
const role = placeholderContentRole(type.toLowerCase());
|
|
147482
|
+
const candidates = this.ensureArray(tree?.["p:sp"]).filter((shape) => {
|
|
147483
|
+
const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
|
|
147484
|
+
return info && placeholderContentRole(info.type) === role;
|
|
147485
|
+
});
|
|
147486
|
+
const master = candidates.find(
|
|
147487
|
+
(shape) => this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"))?.idx === idx
|
|
147488
|
+
) ?? candidates[0];
|
|
147489
|
+
return master ? this.mergeXmlObjects(master, inherited) : void 0;
|
|
147490
|
+
}
|
|
147491
|
+
};
|
|
147492
|
+
}
|
|
147493
|
+
});
|
|
147494
|
+
var PptxHandlerRuntime104;
|
|
146947
147495
|
var init_PptxHandlerRuntimeImplementation = __esm({
|
|
146948
147496
|
"pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts"() {
|
|
146949
147497
|
init_PptxElementXmlBuilder();
|
|
146950
147498
|
init_builders();
|
|
146951
147499
|
init_factories();
|
|
146952
|
-
|
|
146953
|
-
|
|
147500
|
+
init_PptxHandlerRuntimeSdkPlaceholders();
|
|
147501
|
+
PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
|
|
146954
147502
|
constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
|
|
146955
147503
|
super();
|
|
146956
147504
|
this.dependencyFactory = dependencyFactory;
|
|
@@ -147090,11 +147638,11 @@ var init_PptxHandlerRuntimeImplementation = __esm({
|
|
|
147090
147638
|
});
|
|
147091
147639
|
|
|
147092
147640
|
// pptx/core/core/PptxHandlerRuntime.ts
|
|
147093
|
-
var
|
|
147641
|
+
var PptxHandlerRuntime105;
|
|
147094
147642
|
var init_PptxHandlerRuntime = __esm({
|
|
147095
147643
|
"pptx/core/core/PptxHandlerRuntime.ts"() {
|
|
147096
147644
|
init_PptxHandlerRuntimeImplementation();
|
|
147097
|
-
|
|
147645
|
+
PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
|
|
147098
147646
|
};
|
|
147099
147647
|
}
|
|
147100
147648
|
});
|
|
@@ -147104,7 +147652,7 @@ var createDefaultPptxHandlerRuntime;
|
|
|
147104
147652
|
var init_PptxHandlerRuntimeFactory = __esm({
|
|
147105
147653
|
"pptx/core/core/PptxHandlerRuntimeFactory.ts"() {
|
|
147106
147654
|
init_PptxHandlerRuntime();
|
|
147107
|
-
createDefaultPptxHandlerRuntime = () => new
|
|
147655
|
+
createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
|
|
147108
147656
|
}
|
|
147109
147657
|
});
|
|
147110
147658
|
|
|
@@ -149741,7 +150289,7 @@ function slideMasterXml2(deck, ctx) {
|
|
|
149741
150289
|
</p:txStyles>
|
|
149742
150290
|
</p:sldMaster>`;
|
|
149743
150291
|
}
|
|
149744
|
-
function
|
|
150292
|
+
function slideLayoutXml() {
|
|
149745
150293
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
149746
150294
|
<p:sldLayout ${XMLNS2} type="blank" preserve="1">
|
|
149747
150295
|
<p:cSld name="Blank">
|
|
@@ -150061,7 +150609,7 @@ async function buildPptxPackage(deck) {
|
|
|
150061
150609
|
${masterRels.join("\n")}
|
|
150062
150610
|
</Relationships>`
|
|
150063
150611
|
);
|
|
150064
|
-
zip.file("ppt/slideLayouts/slideLayout1.xml",
|
|
150612
|
+
zip.file("ppt/slideLayouts/slideLayout1.xml", slideLayoutXml());
|
|
150065
150613
|
zip.file(
|
|
150066
150614
|
"ppt/slideLayouts/_rels/slideLayout1.xml.rels",
|
|
150067
150615
|
`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -150278,6 +150826,13 @@ var init_PptxHandlerCore = __esm({
|
|
|
150278
150826
|
getLayoutOptions() {
|
|
150279
150827
|
return this.runtime.getLayoutOptions();
|
|
150280
150828
|
}
|
|
150829
|
+
/** Resolve a text placeholder in this loaded deck, preserving layout inheritance. */
|
|
150830
|
+
createPlaceholderElement(layoutPath, input, type, options = {}) {
|
|
150831
|
+
if (!this.runtime.createPlaceholderElement) {
|
|
150832
|
+
throw new Error("This runtime does not support creating layout placeholders");
|
|
150833
|
+
}
|
|
150834
|
+
return this.runtime.createPlaceholderElement(layoutPath, input, type, options);
|
|
150835
|
+
}
|
|
150281
150836
|
/**
|
|
150282
150837
|
* Build the artwork thumbnails backing the New Slide / Layout galleries.
|
|
150283
150838
|
*
|
|
@@ -152071,30 +152626,8 @@ function removeChartUserShape(element, index) {
|
|
|
152071
152626
|
element.chartData.userShapes = shapes.filter((_, i2) => i2 !== index);
|
|
152072
152627
|
}
|
|
152073
152628
|
|
|
152074
|
-
// pptx/core/builders/sdk/
|
|
152075
|
-
|
|
152076
|
-
const lowerName = name.toLowerCase();
|
|
152077
|
-
const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
|
|
152078
|
-
if (fromOptions) {
|
|
152079
|
-
return fromOptions;
|
|
152080
|
-
}
|
|
152081
|
-
if (data.slideMasters) {
|
|
152082
|
-
for (const master of data.slideMasters) {
|
|
152083
|
-
const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
|
|
152084
|
-
if (layout) {
|
|
152085
|
-
return { path: layout.path, name: layout.name ?? name };
|
|
152086
|
-
}
|
|
152087
|
-
}
|
|
152088
|
-
}
|
|
152089
|
-
return void 0;
|
|
152090
|
-
}
|
|
152091
|
-
function findLayoutByType(data, type) {
|
|
152092
|
-
const fromOptions = data.layoutOptions?.find((l) => l.type === type);
|
|
152093
|
-
if (fromOptions) {
|
|
152094
|
-
return fromOptions;
|
|
152095
|
-
}
|
|
152096
|
-
return void 0;
|
|
152097
|
-
}
|
|
152629
|
+
// pptx/core/builders/sdk/index.ts
|
|
152630
|
+
init_layout_operations();
|
|
152098
152631
|
|
|
152099
152632
|
// pptx/core/builders/sdk/shape-operations.ts
|
|
152100
152633
|
function replaceShapeGeometry(element, newShapeType, adjustments) {
|