allyhub 0.16.0 → 0.17.1
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/CHANGELOG.md +13 -0
- package/dist/commands/inspect/index.js +1 -1
- package/dist/commands/inspect/uses.js +3 -0
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/place.js +2 -0
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/content.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/dist/imports.d.ts +17 -0
- package/dist/node_modules/@allyhub/build/dist/imports.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/index.d.ts +2 -1
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/kind-build.d.ts +19 -3
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/uses.d.ts +27 -6
- package/dist/node_modules/@allyhub/build/dist/uses.js +1 -1
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +40 -40
- package/dist/node_modules/@allyhub/doc/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/markdown.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/parse.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +26 -26
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +15 -3
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +40 -7
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +4 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/stage.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +3 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.d.ts +9 -0
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +51 -10
- package/dist/node_modules/@allyhub/piece/dist/source.js +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/digest.js +1 -1
- package/dist/node_modules/@allyhub/project/dist/part-keys.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +0 -6
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +39 -0
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +3 -0
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +30 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +6 -0
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/compose.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/embed.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/film.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/piece.js +2 -2
- package/dist/node_modules/@allyhub/runtime/dist/player/player.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/components.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/build.js +2 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-pptx.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/evaluate.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/component.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/item.js +2 -0
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +5 -5
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/install.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +19 -19
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +3 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +13 -13
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-B1AxOB-Y.js → abnfDiagram-WEYOIA3C-CHNpVSPv.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-C-7xKJ2Z.js → architecture-WOLXFQ4H-gPsJqQwV.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-CyWb8_iD.js → architectureDiagram-ZHVYKT53-CEIDcC6r.js} +1 -1
- package/editor-web/assets/{article-qt4W_BKH.js → article-BHTjq0_Y.js} +1 -1
- package/editor-web/assets/{article-CTKW7Eo0.js → article-DfELjJ2o.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-uii4-7Ix.js → blockDiagram-RJAE7QA3-CUzEGVet.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-BtL5Z-wF.js → c4Diagram-XDPPPE54-CB94NR9s.js} +1 -1
- package/editor-web/assets/calc-worker-BdHh5LXM.js +45 -0
- package/editor-web/assets/channel-DCDCx5Es.js +1 -0
- package/editor-web/assets/{chart-file-HE-uXGmJ.js → chart-file-CfbWK9l1.js} +1 -1
- package/editor-web/assets/{chunk-2E7WHVMD-BJjuZYBs.js → chunk-2E7WHVMD-DFYo_Boi.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-nzPdUHaI.js → chunk-4EMNKR2T-CLLjmweX.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-CH52E3Nl.js → chunk-55XCU76K-CkwQ_3m1.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-Ba4LNKCV.js → chunk-7S6XSTFO-V-AvHpAB.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-Co9SmoqD.js → chunk-AQDTSKZB-PjHyYpb8.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-BHRvxRGi.js → chunk-DSNLSHJZ-QaczBS3J.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-F5Wd8ETY.js → chunk-HAGFOTED-aLaQB5Xu.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-C_E0__p9.js → chunk-HNE4Q36P-De3ftDQR.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-BvrtbbWm.js → chunk-NQOKRVIF-CrhVQyvP.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-D0HTPXRF.js → chunk-UHW7PFBP-BFmZ5ZLn.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-B9hF2YMk.js → chunk-VQ5W62QI-CzppUHLA.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-D7N3o-Ub.js → chunk-WQQL4CDK-BrAU7V6v.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-XaLSrI_W.js → chunk-YZO67HFG-BSiF71qj.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-sXc6qmw-.js → chunk-ZAUX2LTX-BJc4r5b1.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-B0X6sNMX.js → chunk-ZCHMQSOR-CkGTuehB.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-CjXVvOUp.js → classDiagram-v2-4MYWR3UA-Byxc7J88.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-PQ9VyM9v.js → cynefin-EF2NZ3EQ-BSxkVbdf.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-KXuXFAhX.js → cynefinDiagram-WF24UDRP-IkCgARNs.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-CBTyfYD5.js → dagre-NK4GIZVX-9PgeH6nY.js} +1 -1
- package/editor-web/assets/deck-tTzKONci.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-CsVO64Bf.js → diagram-CBK3MWTC-DRzeg3Ds.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-fzbUm1St.js → diagram-I5XIIV2D-B_zeKMN6.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-up6ihgN5.js → diagram-ODIL2UCW-FFm0O8SN.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-T6hVBoCD.js → diagram-PFBEJUXE-DrtCT8OA.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-BDntFeuR.js → diagram-RJA3I4VV-DtxJ3V0q.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Dv1-mqbf.js → diagram-TYUNFSNR-DmxF_8H_.js} +1 -1
- package/editor-web/assets/dist-BEpzsYn_.js +6 -0
- package/editor-web/assets/dist-BUD4ywMB.js +18 -0
- package/editor-web/assets/{dist-aTV6Rwon.js → dist-C21CkR7Z.js} +132 -131
- package/editor-web/assets/{dist-DhMagA-B.js → dist-C56mWAec.js} +1 -1
- package/editor-web/assets/{dist-B-lYrbqX.js → dist-CAb3W9_P.js} +1 -1
- package/editor-web/assets/{dist-Bfs4cZI_.js → dist-CEknsRDd.js} +1 -1
- package/editor-web/assets/{dist-C66KgS8g.js → dist-CbZAznNW.js} +2 -2
- package/editor-web/assets/{dist-Ba5Kv4A-.js → dist-DDzjbKIg.js} +1 -1
- package/editor-web/assets/{dist-CWXGbcPB.js → dist-DaEbElXI.js} +1 -1
- package/editor-web/assets/{dist-_ooK0TT9.js → dist-Dr3o4vee.js} +1 -1
- package/editor-web/assets/{dist-mrWPE-br.js → dist-JLyDtl9X.js} +1 -1
- package/editor-web/assets/{dist-BW8IR8bR.js → dist-PBbWAsrV.js} +3 -3
- package/editor-web/assets/{dist-CBeeIAlh.js → dist-ZZlQa66J.js} +1 -1
- package/editor-web/assets/{dist-CHKVUdcE.js → dist-bQKpw3Zz.js} +5 -5
- package/editor-web/assets/dist-d4dayaWE.js +17 -0
- package/editor-web/assets/{docx-draw-CeiLkccT.js → docx-draw-9Q_fArBC.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-CZzljBYN.js → ebnfDiagram-V4P3TTPT-DSX1Aoty.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-6vNb82av.js → elk-QONTBCTQ-C7gy9q56.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-B8smxURG.js → erDiagram-KYQIGQAA-CKx_HoY4.js} +1 -1
- package/editor-web/assets/esm-BZb5QMQf.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-CngIhoUF.js → eventmodeling-K75KTNOO-DL4HvSrd.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-BUnRtJ8q.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-BtzqHUiP.js → ganttDiagram-R7GPNTJY-N-AP4slN.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-DOOpoQDh.js → gitGraph-VSP46ZUC-BKRGJKWm.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-Cu4T8UUo.js → gitGraphDiagram-PDYL7XHY-ClwL7w2_.js} +1 -1
- package/editor-web/assets/index-BedbINE5.css +2 -0
- package/editor-web/assets/index-DG2nHq4D.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-CiNozx0c.js → info-OHQRW6UA-DpcY8t23.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-A3mxzTmc.js → infoDiagram-MVDRKAX5-ChtmtWni.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-CIbVgY0Z.js → ishikawaDiagram-HPEHV2GE-BZNTuG_F.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BwPXFmyS.js → journeyDiagram-BOSHW7O7-C3uVmZbL.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-biRlEeb1.js → kanban-definition-FNSA4HC5-puEhftGG.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-ikwPmNne.js → mermaid-parser.core-Bw8re-WE.js} +3 -3
- package/editor-web/assets/{mermaid.core-B4GR7QVa.js → mermaid.core-Cc2GIqBr.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-BN8aiUmO.js → mindmap-definition-6OY57UG3-C6MUl_S_.js} +1 -1
- package/editor-web/assets/{packet-JDAUHWVQ-DWesZv6p.js → packet-JDAUHWVQ-C75RnvC5.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-Bh3QEAL_.js → pegDiagram-ECIUJNBX-ChjmsdV4.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-DT1ANL51.js → pie-XZMESJXO-BaKxJQpj.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-xXxgiv6O.js → pieDiagram-GNMPY74T-CT2ez8pr.js} +1 -1
- package/editor-web/assets/{props-form-BwZY8ZWd.js → props-form-D5oKHfpk.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-BGzRd8iZ.js → quadrantDiagram-D57K4MC3-BJItlTfk.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-C-rmMB0D.js → radar-ABXABTNO-DnLzBlTo.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-CvLOq2i8.js → railroad-I3PHUGI6-D5hj6Yv3.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-DMsb025s.js → railroad-abnf-LNEFI6M7-DUZlZoPu.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-5bvVcIvh.js → railroad-ebnf-DWYD2UWJ-CDyyDC6d.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-LKZ9-9ja.js → railroad-peg-JR7BVNR7-CC3ImNnT.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-DVBhzkmC.js → railroadDiagram-Y72NRBL7-Bjw-8Se5.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-B5RyzWna.js → requirementDiagram-EQYSW5RA-CDFnuEIO.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-BvOJG-gB.js → sankeyDiagram-SY24JHO5-CQPVLY1w.js} +1 -1
- package/editor-web/assets/{schemas-BmdNnDyt.js → schemas-moE_A7Nj.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-BI7-Daqy.js → sequenceDiagram-BLEHNHQU-BQzuLmBX.js} +1 -1
- package/editor-web/assets/{session-D8E3nUwU.js → session-s1I85rox.js} +1 -1
- package/editor-web/assets/{slides-bj0WJT_G.js → slides-oQ_C0SVJ.js} +1 -1
- package/editor-web/assets/snapshots-BPJKywuN.js +1 -0
- package/editor-web/assets/{split-BrF9ECYb.js → split-7CVjIkSU.js} +1 -1
- package/editor-web/assets/square-arrow-out-up-right-DF5dvsSp.js +1 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-C01p8WHX.js → stateDiagram-v2-A6IESKWZ-DOuageUf.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-B00P2SqG.js → swimlanes-B3ENRKFQ-CXKkok7X.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-C3Car2M0.js +8 -0
- package/editor-web/assets/{tabs-CloHB5Z4.js → tabs-CiF1N-pL.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-BIBoOYJY.js → timeline-definition-JXYKGLGB-DgAjAeZp.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-CL6DL8V0.js → treeView-D4JQ5SDB-C0Xvnhck.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-CPLGr0WY.js → treemap-SAJKECNS-aXfKAeSX.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-L03lK2bO.js → usecaseDiagram-WPOLBNNX-CvUlBa-L.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-B5tKKP_-.js → vennDiagram-Q3Y3IDCW-qMJ1iCxs.js} +1 -1
- package/editor-web/assets/{video-BWUznyLR.js → video-DQrjo1TI.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-vsBpXT56.js → wardley-7MLQ67FV-DEdnH0by.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-CMCnVUgh.js → wardleyDiagram-IVAIDKWA-Bt-B2hQ5.js} +1 -1
- package/editor-web/assets/workbook-FSSUiIp9.js +45 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-C9XkBiEO.js → xychartDiagram-4URNHDU4-DV4bSzTb.js} +1 -1
- package/editor-web/index.html +3 -3
- package/package.json +2 -2
- package/editor-web/assets/calc-worker-jImBXoeb.js +0 -45
- package/editor-web/assets/channel-dEO-yacZ.js +0 -1
- package/editor-web/assets/deck-C-p17098.js +0 -1
- package/editor-web/assets/dist-B94TkgAP.js +0 -18
- package/editor-web/assets/dist-DxcrMrCR.js +0 -6
- package/editor-web/assets/dist-DzjSp2i2.js +0 -17
- package/editor-web/assets/esm-CNi9O1ya.js +0 -21
- package/editor-web/assets/flowDiagram-IUGLLWBU-CL0AVU4Y.js +0 -1
- package/editor-web/assets/index-BCjGdcPh.js +0 -28
- package/editor-web/assets/index-D9ng69En.css +0 -2
- package/editor-web/assets/snapshots-CuflsO8Q.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-ChmNuO4G.js +0 -8
- package/editor-web/assets/workbook-C1QR6Cts.js +0 -45
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{CAPS as ze,colorOfFile as de,groupLevels as Ae,SHOW_JUMPS as Te,showJumpOf as je,slideLinkOf as Ee,UNDERLINES as Fe}from"@allyhub/formats";import{readMarks as Ne,markRuns as Le}from"@allyhub/piece";import{chartOfFile as Me}from"@allyhub/chart";import{AUTOSHAPE_STYLE as R,SHADOW_DEFAULTS as I,PATTERN_DEFAULTS as se,TILE_DEFAULTS as W,INNER_SHADOW_DEFAULTS as H,GLOW_DEFAULTS as q,REFLECTION_DEFAULTS as X,CONNECTOR_STYLE as fe,DRAWN_TEXTBOX_FRAME as ce,TEXT_FALLBACK as ue,TEXT_INSETS as B,isConnectorGeometry as Ce,placeholderFrame as Pe,styleKindOf as Re}from"./office.js";import{resolveAnimation as De,resolveTransition as Ue,unitsAcross as Ie,EFFECT_OPTIONS as We,TRANSITION_OPTIONS as He}from"./animation.js";import{glued as Ge}from"./connect.js";import{pathSteps as Xe}from"./path.js";import{CHART_AXIS_WORDS as Be}from"./script.js";import{cellLook as Ke,tableStyleOf as Q}from"./table-style.js";import{masterPlaceholder as Je}from"./placeholders.js";import{DECK_FONTS as Ye,OFFICE_THEME as Ve,themeOver as Ze}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const l=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?l.pop():l.push(r));return l.join("/")}const pe={left:0,top:0,width:0,height:0};function qe(i,t){const l={...i.color_map,...t.color_map};return Object.keys(l).length>0?{color_map:l}:{}}const K=()=>Array.from({length:9},()=>({...ue,font:{...ue.font},margin_left:0}));export function levelsOver(i,...t){return i.map((l,r)=>{let o={...l,font:{...l.font}};for(const y of t){const a=y?.[r];a&&(o={...o,...a.alignment===void 0?{}:{alignment:a.alignment},...a.line_spacing===void 0?{}:{line_spacing:a.line_spacing},...a.space_before===void 0?{}:{space_before:a.space_before},...a.space_after===void 0?{}:{space_after:a.space_after},...a.margin_left===void 0?{}:{margin_left:a.margin_left},...a.indent===void 0?{}:{indent:a.indent},font:{...o.font,...a.font}},a.numbered!==void 0&&(o.numbered=a.numbered,delete o.bullet),a.bullet===null?(delete o.bullet,delete o.numbered):a.bullet!==void 0?(delete o.numbered,o.bullet={char:a.bullet,...a.bullet_font===void 0?{}:{font:a.bullet_font}}):a.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:a.bullet_font}),o=bulletLookOver(o,a))}return o})}export function bulletLookOver(i,t){const l={...i};return t.bullet_color===null?delete l.bullet_color:t.bullet_color!==void 0&&(l.bullet_color=t.bullet_color),t.bullet_size===null?delete l.bullet_size:t.bullet_size!==void 0&&(l.bullet_size=t.bullet_size),t.start_at!==void 0&&(l.start_at=t.start_at),l}function ee(i,...t){const l=t.filter(o=>o!==void 0),r=o=>{for(let y=l.length-1;y>=0;y--){const a=l[y]?.[o];if(a!==void 0)return a}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,orientation:r("orientation")??"horz",auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??B.left,top:r("margin_top")??B.top,right:r("margin_right")??B.right,bottom:r("margin_bottom")??B.bottom}}}const he={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(K(),i.text_styles.other);function ne(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,t.levels)}}function Qe(i,t,...l){return{...ee(Pe(t),...l),levels:levelsOver(K(),i.text_styles[Re(t)],...l.map(r=>r?.levels))}}const en=Array.from({length:9},()=>({font:{color:R.font_color}})),me={vertical_anchor:R.vertical_anchor};function _e(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,en,t.levels)}}const J=i=>{const t={...i};return delete t.paragraphs,t},Y=i=>({paragraphs:[],levels:[],...i}),C=i=>i==="none"?null:colorOfFile(i),nn=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,tn=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="([^"\n]*)"/gu,V=57344,on=256,ge="",rn=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const spaceOfFile=i=>typeof i=="number"?S(i):{lines:i.lines},colorOfFile=i=>de(i)??"dk1";function te(i){const{shadow:t,gradient:l,inner_shadow:r,glow:o,reflection:y}=i;return{...r?{inner_shadow:{color:r.color===void 0?H.color:colorOfFile(r.color),blur:r.blur===void 0?H.blur:S(r.blur),distance:r.distance===void 0?H.distance:S(r.distance),angle:r.angle??H.angle,transparency:r.transparency??H.transparency}}:{},...o?{glow:{color:o.color===void 0?q.color:colorOfFile(o.color),size:o.size===void 0?q.size:S(o.size),transparency:o.transparency??q.transparency}}:{},...i.soft_edges===void 0?{}:{soft_edges:S(i.soft_edges)},...y?{reflection:{transparency:y.transparency??X.transparency,size:y.size??X.size,distance:y.distance===void 0?X.distance:S(y.distance),blur:y.blur===void 0?X.blur:S(y.blur)}}:{},...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...l?{gradient:{angle:l.angle??0,...l.path===void 0?{}:{path:l.path},...l.focus===void 0?{}:{focus:{left:l.focus.left??.5,top:l.focus.top??.5,right:l.focus.right??.5,bottom:l.focus.bottom??.5}},stops:l.stops.map(a=>({at:a.at,color:colorOfFile(a.color),...a.transparency===void 0?{}:{transparency:a.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?I.color:colorOfFile(t.color),blur:t.blur===void 0?I.blur:S(t.blur),distance:t.distance===void 0?I.distance:S(t.distance),angle:t.angle??I.angle,transparency:t.transparency??I.transparency}}:{}}}const an=i=>({...i.tile?{tile:{...i.tile}}:{},...i.transparency===void 0?{}:{transparency:i.transparency}});function be(i,t){const{pattern:l,picture_fill:r}=i;return{...l?{pattern:{preset:l.preset,fg:colorOfFile(l.fg??se.fg),bg:colorOfFile(l.bg??se.bg)}}:{},...r?{picture_fill:{path:joinPath(t,r.path),...r.tile?{tile:{scale_x:r.tile.scale_x??W.scale_x,scale_y:r.tile.scale_y??W.scale_y,offset_x:r.tile.x===void 0?W.offset_x:S(r.tile.x),offset_y:r.tile.y===void 0?W.offset_y:S(r.tile.y),align:r.tile.align??W.align}}:{},...r.transparency===void 0?{}:{transparency:r.transparency}}}:{}}}function ye(i,t,l=[]){const r=Q(i.style);return{...i,rows:i.rows.map((o,y)=>({height:o.height,cells:o.cells.map((a,E)=>{const N=l[y],v=r?Ke(r,i,y,E,i.rows.length,i.columns.length,y+(a.span_height??1)-1,E+(a.span_width??1)-1):void 0,F=ne(t,a.text),L=v&&(v.bold!==void 0||v.text!==void 0)?{...F,levels:F.levels.map(P=>({...P,font:{...P.font,...v.bold===void 0?{}:{bold:v.bold},...v.text===void 0?{}:{color:v.text}}}))}:F;return{...a,text:{paragraphs:a.text.paragraphs,style:Z({...L,auto_size:"shape"},N),own:J(a.text),empty:!1},...N?{fileText:N}:{}}})}))}}function Z(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},...t.orientation===void 0?{}:{orientation:t.orientation},levels:i.levels.map(l=>{const r={...l.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.caps===void 0?{}:{caps:t.caps},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...l,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:spaceOfFile(t.space_before)},...t.space_after===void 0?{}:{space_after:spaceOfFile(t.space_after)}};return t.bullet_color!==void 0&&(o.bullet_color=colorOfFile(t.bullet_color)),t.bullet_size!==void 0&&(o.bullet_size=t.bullet_size),t.start_at!==void 0&&(o.start_at=t.start_at),t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&l.margin_left===0?{...o,margin_left:$e,indent:-$e}:o})}:i}function ln(i,t){if(!t)return[...i];const l=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,t.bullet_color!==void 0&&delete o.bullet_color,t.bullet_size!==void 0&&delete o.bullet_size,t.start_at!==void 0&&delete o.start_at,l&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}const dn=i=>Fe.includes(i),sn=i=>ze.includes(i);function fn(i){const t={};for(const[,l,r=""]of i.matchAll(tn))if(l==="font")t.name=r.trim();else if(l==="link")t.link=r.trim();else if(l==="highlight")t.highlight=r.trim().toUpperCase();else if(l==="bold")t.bold=r.trim()!=="false";else if(l==="italic")t.italic=r.trim()!=="false";else if(l==="strike"){const o=r.trim();t.strike=o==="dblStrike"?o:o!=="false"}else if(l==="underline"){const o=r.trim();t.underline=dn(o)&&o!=="sng"?o:o!=="false"}else if(l==="caps"){const o=r.trim();sn(o)&&(t.caps=o)}else if(l==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=S(o))}else if(l==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else if(l==="spacing"){const o=Number(r);Number.isFinite(o)&&(t.spacing=S(o))}else{const o=de(r.trim());o!==void 0&&(t.color=o)}return t}const $e=342900;export function paragraphsOfWords(i,t=0,l=Ye.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],y=r.replace(nn,(v,F,L)=>(o.push(fn(F)),`${String.fromCharCode(V+o.length-1)}${L}${ge}`)),a=Ne(y);let E;const N=Le(a.text,a.marks).flatMap(v=>{const F=v.kinds.includes("code"),L={...v.kinds.includes("strong")?{bold:!0}:{},...v.kinds.includes("em")?{italic:!0}:{},...F?{name:l}:{}};return[...v.text.matchAll(rn)].flatMap(P=>{const D=P[0],U=D.charCodeAt(0);if(D===ge)return E=void 0,[];if(U>=V&&U<V+on)return E=o[U-V],[];const G={...E,...L};return[{text:D,...Object.keys(G).length>0?{font:G}:{},...F?{code:!0}:{}}]})});return{runs:N.length>0?N:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,l))}const ke=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),cn=new Set(["dt","ftr","sldNum"]),we=i=>({...i.locked?{locked:!0}:{},...i.link===void 0?{}:{link:i.link},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function xe(i,t,l){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&te({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(l,t.picture))}const un=i=>{const t=Q(i.style);return{...t?{style:t.id}:{},...i.first_row===void 0?{}:{first_row:i.first_row},...i.last_row===void 0?{}:{last_row:i.last_row},...i.first_col===void 0?{}:{first_col:i.first_col},...i.last_col===void 0?{}:{last_col:i.last_col},...i.horz_banding===void 0?{}:{horz_banding:i.horz_banding},...i.vert_banding===void 0?{}:{vert_banding:i.vert_banding}}},Se=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:l,words:r,prefix:o,base:y}=i,a=[],E=Ze(i.theme??Ve,t.theme),N=new Map;for(const e of t.masters)for(const n of e.layouts)N.set(n.name,{layout:n,master:e});const v=[],F=(e,n,s)=>{const h=He[n.type];return n.direction!==void 0&&!h.directions.includes(n.direction)&&a.push({slide:e,path:`${s}.transition.direction`,message:h.directions.length===0?`A ${n.type} transition has no direction (${n.direction}).`:`A ${n.type} transition goes ${h.directions.join(", ")}, not ${n.direction}.`}),n.through_black===!0&&!h.throughBlack&&a.push({slide:e,path:`${s}.transition.through_black`,message:`A ${n.type} transition does not go through black: only a fade, a cut and a reveal do.`}),Ue(n)},L=(e,n,s)=>({name:e.name,kind:e.kind,frame:{...e.frame??pe},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?_e(s,e.text):ne(s,e.text),own:J(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.pattern?{pattern:e.pattern}:{},...e.picture_fill?{picture_fill:{...an(e.picture_fill),path:joinPath(e.picture_fill.base,e.picture_fill.path)}}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.inner_shadow?{inner_shadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.soft_edges===void 0?{}:{soft_edges:e.soft_edges},...e.reflection?{reflection:e.reflection}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:ye(e.table,s)}:{},...e.chart?{chart:e.chart}:{},...e.link===void 0?{}:{link:e.link},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster},...e.media.playback?{playback:e.media.playback}:{}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const s=e.placeholder?.type??"body",h=Je(n,s),g=e.frame??h?.frame??pe;return{name:e.name,kind:"placeholder",frame:{...g},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Qe(n,s,h?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!h?"layout":"master"},text:{from:"layout"}}}},D=(e,n,s,h)=>{const g=t.components[e];if(!g){a.push({...s,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const $ of Object.keys(n??{}))Object.hasOwn(g.props,$)||a.push({...s,message:`Component ${e} has no prop ${$} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...h===void 0?{}:{dur:h}}},U=(e,n,s,h,g)=>{const $={slide:h,shape:e,path:s};if(!n.frame){a.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const T=ke(n.frame),u={frame:{from:"slide",path:`${s}.frame`}},x={name:e,frame:T,level:"slide",...n.fill===void 0?{}:{fill:C(n.fill)},...te(n),...be(n,y),...n.line===void 0?{}:{line:C(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_cap===void 0?{}:{line_cap:n.line_cap},...n.line_join===void 0?{}:{line_join:n.line_join},...n.line_compound===void 0?{}:{line_compound:n.line_compound},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...we(n)};if(n.textbox)return{...x,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`),0,E.fonts.code),style:Z(ne(g,Y(ce)),n.text),own:J(Y(ce)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...u,text:{from:"slide",path:`${s}.text`}}};if(n.picture!==void 0){const p=Se(n.crop);return{...x,kind:"picture",media:{path:joinPath(y,n.picture),...p?{crop:p}:{}},sources:{...u,media:{from:"slide",path:`${s}.picture`}}}}if(n.movie!==void 0)return{...x,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster},...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.movie`}}};if(n.audio!==void 0)return{...x,kind:"audio",media:{path:joinPath(y,n.audio),...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.audio`}}};if(n.chart){const p=`${o}.${h}.${e}`,j=c=>typeof c=="string"?c:void 0,w=Object.fromEntries(Be.flatMap(c=>{const d=j(r(`${p}.${c}`));return d===void 0?[]:[[c,d]]})),O=Me(n.chart,{title:j(r(p))??j(r(`${p}.title`)),axisTitles:w,base:y,rows:c=>i.data?.(c),problem:c=>{a.push({...$,message:`Chart ${e}: ${c}`})}});return O?{...x,kind:"chart",chart:O,sources:u}:void 0}if(n.table){const p=n.table;p.style!==void 0&&!Q(p.style)&&a.push({...$,message:`Table ${e}'s style ${p.style} is none of PowerPoint's built-in table styles: name one as its gallery does (Medium Style 2 - Accent 1, Light Style 1, No Style, Table Grid) or by its id.`});const j=T.width/p.columns.reduce((f,m)=>f+m,0),w=T.height/p.rows.reduce((f,m)=>f+m.height,0),O=r(`${o}.${h}.${e}`),c=Array.isArray(O)?O:[],d=new Map;for(const f of p.merged??[]){const m=f.rows??1,_=f.columns??1;for(let k=f.row;k<f.row+m;k++)for(let z=f.column;z<f.column+_;z++)d.set(`${String(k)},${String(z)}`,"under");d.set(`${String(f.row)},${String(f.column)}`,{w:_,h:m})}return c.length>p.rows.length&&a.push({...$,message:`Table ${e} has ${String(p.rows.length)} rows and its words ${String(c.length)}.`}),{...x,kind:"table",table:ye({...un(p),columns:p.columns.map(f=>Math.round(f*j)),rows:p.rows.map((f,m)=>{const _=c[m],k=Array.isArray(_)?_:_===void 0?[]:[_];return{height:Math.round(f.height*w),cells:p.columns.map((z,M)=>{const A=d.get(`${String(m)},${String(M)}`);return{text:{levels:[],paragraphs:A==="under"?[]:paragraphsOfWords(k[M],0,E.fonts.code)},...A==="under"?{spanned:!0}:{},...A!==void 0&&A!=="under"&&A.w>1?{span_width:A.w}:{},...A!==void 0&&A!=="under"&&A.h>1?{span_height:A.h}:{},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}})}})},g,p.rows.map(f=>f.text)),sources:u}}const b=n.path&&Xe(n.path.d);if(n.path&&!b){a.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&b){const p=!n.path&&Ce(n.geometry);return{...x,kind:"autoshape",...n.path&&b?{path:{w:n.path.w,h:n.path.h,steps:b}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...p?{line:n.line===void 0?fe.line:C(n.line),line_width:n.line_width===void 0?fe.line_width:S(n.line_width)}:{fill:n.fill===void 0?R.fill:C(n.fill),line:n.line===void 0?R.line:C(n.line),line_width:n.line_width===void 0?R.line_width:S(n.line_width)},...n.text&&!p?{fileText:{...n.text}}:{},...p?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`)).map(j=>n.text?.align===void 0?{alignment:R.alignment,...j}:j),style:Z(_e(g,Y(me)),n.text),own:J(Y(me)),empty:!1}},sources:{...u,fill:{from:"slide",path:`${s}.fill`}}}}if(n.component!==void 0){const p=D(n.component,n.props,$,n.dur);return p?{...x,kind:"component",component:p,sources:u}:void 0}},G=(e,n,s)=>{if(n.frame&&(e.frame=ke(n.frame),e.sources.frame={from:"slide",path:`${s}.frame`}),Object.assign(e,we(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=Z(e.text.style,n.text),e.text.paragraphs=ln(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${s}.text`}),n.line!==void 0&&(e.line=C(n.line),e.sources.line={from:"slide",path:`${s}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_cap!==void 0&&(e.line_cap=n.line_cap),n.line_join!==void 0&&(e.line_join=n.line_join),n.line_compound!==void 0&&(e.line_compound=n.line_compound),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),(n.fill!==void 0||n.gradient!==void 0||n.pattern!==void 0||n.picture_fill!==void 0)&&(delete e.gradient,delete e.pattern,delete e.picture_fill),n.fill!==void 0&&(e.fill=C(n.fill),e.sources.fill={from:"slide",path:`${s}.fill`}),Object.assign(e,te(n),be(n,y)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const h=Se(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...h?{crop:h}:{},...n.poster===void 0?{}:{poster:n.poster},...n.playback&&n.movie!==void 0?{playback:n.playback}:{}},e.sources.media={from:"slide",path:`${s}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}else n.playback&&e.media&&(e.kind==="movie"||e.kind==="audio")&&(e.media={...e.media,playback:{...e.media.playback,...n.playback}})},ie=(e,n,s,h,g)=>{const $=N.get(n);if(!$){a.push({slide:e,path:`slides.${String(s)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...N.keys()].join(", ")||"none"}).`});return}const{layout:T,master:u}=$,x=[...(T.display_master_shapes===!1?[]:u.shapes).filter(p=>p.kind!=="placeholder").map(p=>L(p,"master",u)),...T.shapes.filter(p=>p.kind!=="placeholder").map(p=>L(p,"layout",u))],b=T.shapes.filter(p=>p.kind==="placeholder").map((p,j)=>({shape:P(p,u),order:j}));return{slide:{id:e,layout:T.name,master:u.name,hidden:h,background:T.background??u.background,...qe(u,T),shapes:x,animations:[],file:{index:s,...g===void 0?{}:{generate:g}}},placed:b,master:u}},oe=(e,n,s)=>{if(!n)return;const h=T=>{const u=n[T];if(u===void 0)return e.connect?.[T];const x=u==="none"?void 0:s(u.shape);return u==="none"||x===void 0?void 0:{shape:x,site:u.site}},g=h("begin"),$=h("end");g||$?e.connect={...g?{begin:g}:{},...$?{end:$}:{}}:delete e.connect},re=(e,n,s,h,g,$,T,u,x,b=()=>{})=>{const p=new Set(s.map(c=>c.shape.name));let j=s.length;for(const[c,d]of Object.entries(h??{})){const f=$(c);if(f===void 0)continue;const m=`${g}.shapes.${c}`,_=d.textbox!==void 0||d.geometry!==void 0||d.path!==void 0||d.table!==void 0||d.chart!==void 0||d.component!==void 0||d.audio!==void 0||(d.picture!==void 0||d.movie!==void 0)&&!p.has(f),k=s.find(M=>M.shape.name===f);if(k&&!_){G(k.shape,d,m),oe(k.shape,d.connect,$),k.shown=!0,d.z!==void 0&&(k.z=d.z);continue}if(k){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has a ${k.shape.kind} ${f} already: a shape of its own needs another name.`});continue}if(!_){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has no shape ${f} to change (its layout's placeholders and its own shapes are ${[...p].join(", ")||"none"}).`});continue}const z=U(f,d,m,e.id,n);z&&oe(z,d.connect,$),z&&(s.push({shape:z,order:j++,...d.z===void 0?{}:{z:d.z}}),p.add(f))}const w=s.filter(c=>c.shown===!0||!cn.has(c.shape.placeholder?.type??"")||T(c.shape)!==void 0);s.splice(0,s.length,...w),s.sort((c,d)=>(c.z??0)-(d.z??0)||c.order-d.order);const O=(c,d)=>{const f=_=>{const k=_.shape.group;return k===void 0?void 0:Ae(k)[d]},m=new Map(c.flatMap((_,k)=>{const z=f(_);return z===void 0?[]:[[z,k]]}));return c.flatMap((_,k)=>{const z=f(_);return z===void 0?[_]:m.get(z)===k?O(c.filter(M=>f(M)===z),d+1):[]})};s.splice(0,s.length,...O(s,0));for(const c of s){const d=b(c.shape);d!==void 0&&(c.shape.alt=d);const f=c.shape.text;if(c.shape.kind==="placeholder"&&f){const m=T(c.shape);f.paragraphs=paragraphsOfWords(m,0,E.fonts.code),f.empty=f.paragraphs.length===0||f.paragraphs.every(_=>_.runs.every(k=>k.text===""))}}e.shapes.push(...s.map(c=>c.shape));for(const c of e.shapes){const d=c.connect;if(!d)continue;const f=Ge(c,m=>e.shapes.find(_=>_.name===m&&_.level===c.level&&_!==c));c.frame=f.frame,f.flip?c.flip=f.flip:delete c.flip;for(const m of f.lost){const _=d[m];_&&c.level==="slide"&&a.push({slide:e.id,shape:c.name,message:`Connector ${c.name}'s ${m} is glued to site ${String(_.site)} of ${_.shape}, which slide ${e.id} has not: it stays where it is.`})}}u!==void 0&&u.trim()!==""&&(e.notes=u);for(const[c,d]of(x??[]).entries()){const f=$(d.shape);if(f===void 0)continue;const m={slide:e.id,shape:f,path:`${g}.animations.${String(c)}`},_=e.shapes.find(A=>A.name===f&&A.level==="slide");if(!_){a.push({...m,message:`Slide ${e.id} has no shape ${f} to animate (it has ${e.shapes.filter(A=>A.level==="slide").map(A=>A.name).join(", ")}).`});continue}if(d.paragraph!==void 0&&d.paragraph>=(_.text?.paragraphs.length??0)){a.push({...m,message:`Shape ${f} has no paragraph ${String(d.paragraph)} to animate (it has ${String(_.text?.paragraphs.length??0)}).`});continue}const k=We[d.effect];d.direction!==void 0&&!k.directions.includes(d.direction)&&a.push({...m,path:`${m.path}.direction`,message:k.directions.length===0?`${f}'s ${d.effect} has no direction (${d.direction}).`:`${f}'s ${d.effect} goes ${k.directions.join(", ")}, not ${d.direction}.`}),d.amount!==void 0&&k.amount===void 0?a.push({...m,path:`${m.path}.amount`,message:`${f}'s ${d.effect} has no amount: only a Grow/Shrink, a spin and a Transparency do.`}):d.effect==="transparency"&&(d.amount??0)>1&&a.push({...m,path:`${m.path}.amount`,message:`${f}'s transparency is a share, at most 1 (it is ${String(d.amount)}).`}),d.animate_text!==void 0&&!_.text&&a.push({...m,path:`${m.path}.animate_text`,message:`${f} has no text to animate by ${d.animate_text}: it plays as one.`});const z=d.animate_text,M=De({...d,shape:f,..._.text?{}:{animate_text:void 0}},z===void 0?1:(d.paragraph===void 0?_.text?.paragraphs??[]:[_.text?.paragraphs[d.paragraph]]).reduce((A,ve)=>A+Ie(ve?.runs.map(Oe=>Oe.text)??[],z).length,0));M?e.animations.push(M):a.push({...m,message:`The animation of ${f} needs a path that starts with M and says only M, L and C, absolute.`})}},ae=new Set;l.slides.forEach((e,n)=>{const s=`slides.${String(n)}`;if(e.layout!==void 0){const u=ie(e.id,e.layout,n,e.hidden===!0);if(!u)return;const x=r(`${o}.${e.id}.notes`);e.transition&&(u.slide.transition=F(e.id,e.transition,s)),e.advance_after!==void 0&&(u.slide.advance=e.advance_after),e.section!==void 0&&(u.slide.section=e.section),xe(u.slide,e.background,y),re(u.slide,u.master,u.placed,e.shapes,s,b=>b,b=>r(`${o}.${e.id}.${b.name}`),typeof x=="string"?x:void 0,e.animations,b=>{const p=r(`${o}.${e.id}.alt.${b.name}`);return typeof p=="string"?p:void 0}),v.push(u.slide),ae.add(e.id);return}const h=e.generate??"",g=t.generators[h];if(g===void 0){a.push({slide:e.id,path:`${s}.generate`,message:`There is no generator ${h} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(g)){a.push({slide:e.id,path:`${s}.generate`,message:`Generator ${h} threw: ${g.error}`,...g.stack===void 0?{}:{stack:g.stack}});return}const $=g,T=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const u of $){const x=`${e.id}/${u.id}`,b=ie(x,u.layout,n,T.has(u.id),h);if(!b)continue;for(const w of u.shapes){const O=w.placeholder?b.placed.find(c=>c.shape.placeholder?.idx===w.placeholder?.idx):void 0;if(O)w.frame&&(O.shape.frame={...w.frame}),O.shape.sources.frame={from:"code"},O.shown=!0;else{const c=L(w,"layout",b.master);b.placed.push({shape:{...c,level:"slide",sources:{frame:{from:"code"}}},order:b.placed.length})}}const p=`${u.id}/`,j=u.transition??(u===$[0]?e.transition:void 0);xe(b.slide,e.background,y),j&&(b.slide.transition=F(b.slide.id,j,s)),u===$[0]&&e.section!==void 0&&(b.slide.section=e.section),re(b.slide,b.master,b.placed,e.shapes,s,w=>w.startsWith(p)?w.slice(p.length):void 0,w=>{const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];return O===void 0?void 0:O.map(c=>c.runs.map(d=>d.text).join(""))},u.notes,[...(u.animations??[]).map(w=>({...w,shape:`${p}${w.shape}`})),...e.animations??[]]);for(const w of b.slide.shapes){const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];O&&w.text&&(w.text.paragraphs=O,w.text.empty=!1)}v.push(b.slide),ae.add(x)}for(const u of Object.keys(e.shapes??{})){const[x]=u.split("/");x!==void 0&&!$.some(b=>b.id===x)&&a.push({slide:e.id,path:`${s}.shapes.${u}`,message:`Generator ${h} makes no slide ${x}: ${u} changes nothing.`})}});const le=new Set(v.map(e=>e.id));for(const e of v)for(const n of e.shapes){if(n.level!=="slide")continue;const s=[...n.link===void 0?[]:[n.link],...(n.text?.paragraphs??[]).flatMap(h=>h.runs.flatMap(g=>g.font?.link===void 0?[]:[g.font.link]))];for(const h of new Set(s)){const g=Ee(h);(g!==void 0?!le.has(g):h.startsWith("ppaction://")&&je(h)===void 0)&&a.push({slide:e.id,shape:n.name,message:g!==void 0?`Shape ${n.name} links to slide ${g}, which the deck has not (it has ${[...le].join(", ")}).`:`Shape ${n.name} links to ${h}: a show jump is ppaction://hlinkshowjump?jump= and ${Te.join(", ")}.`})}}return v.forEach((e,n)=>{for(const s of e.shapes)s.placeholder?.type==="sldNum"&&s.text&&(s.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],s.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:v},problems:a}}
|
|
2
|
+
import{CAPS as Ae,colorOfFile as fe,groupLevels as ze,SHOW_JUMPS as Te,showJumpOf as je,slideLinkOf as Ee,UNDERLINES as Fe}from"@allyhub/formats";import{readMarks as Ne,markRuns as Me}from"@allyhub/piece";import{shownPath as Le}from"@allyhub/formats";import{chartOfFile as Ce}from"@allyhub/chart";import{AUTOSHAPE_STYLE as D,SHADOW_DEFAULTS as W,PATTERN_DEFAULTS as ce,TILE_DEFAULTS as H,INNER_SHADOW_DEFAULTS as G,GLOW_DEFAULTS as ee,REFLECTION_DEFAULTS as K,CONNECTOR_STYLE as ue,DRAWN_TEXTBOX_FRAME as pe,TEXT_FALLBACK as he,TEXT_INSETS as J,isConnectorGeometry as Pe,placeholderFrame as Re,styleKindOf as De}from"./office.js";import{resolveAnimation as Ue,resolveTransition as Ie,unitsAcross as We,EFFECT_OPTIONS as He,TRANSITION_OPTIONS as Ge}from"./animation.js";import{glued as Xe}from"./connect.js";import{pathSteps as Be}from"./path.js";import{CHART_AXIS_WORDS as Ke}from"./script.js";import{cellLook as Je,tableStyleOf as ne}from"./table-style.js";import{masterPlaceholder as Ye}from"./placeholders.js";import{DECK_FONTS as Ve,OFFICE_THEME as Ze,themeOver as qe}from"./theme.js";import{Pt as v}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const d=[];for(const a of[...i.split("/"),...t.split("/")])a===""||a==="."||(a===".."?d.pop():d.push(a));return d.join("/")}const me={left:0,top:0,width:0,height:0};function Qe(i,t){const d={...i.color_map,...t.color_map};return Object.keys(d).length>0?{color_map:d}:{}}const Y=()=>Array.from({length:9},()=>({...he,font:{...he.font},margin_left:0}));export function levelsOver(i,...t){return i.map((d,a)=>{let o={...d,font:{...d.font}};for(const g of t){const r=g?.[a];r&&(o={...o,...r.alignment===void 0?{}:{alignment:r.alignment},...r.line_spacing===void 0?{}:{line_spacing:r.line_spacing},...r.space_before===void 0?{}:{space_before:r.space_before},...r.space_after===void 0?{}:{space_after:r.space_after},...r.margin_left===void 0?{}:{margin_left:r.margin_left},...r.indent===void 0?{}:{indent:r.indent},font:{...o.font,...r.font}},r.numbered!==void 0&&(o.numbered=r.numbered,delete o.bullet),r.bullet===null?(delete o.bullet,delete o.numbered):r.bullet!==void 0?(delete o.numbered,o.bullet={char:r.bullet,...r.bullet_font===void 0?{}:{font:r.bullet_font}}):r.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:r.bullet_font}),o=bulletLookOver(o,r))}return o})}export function bulletLookOver(i,t){const d={...i};return t.bullet_color===null?delete d.bullet_color:t.bullet_color!==void 0&&(d.bullet_color=t.bullet_color),t.bullet_size===null?delete d.bullet_size:t.bullet_size!==void 0&&(d.bullet_size=t.bullet_size),t.start_at!==void 0&&(d.start_at=t.start_at),d}function te(i,...t){const d=t.filter(o=>o!==void 0),a=o=>{for(let g=d.length-1;g>=0;g--){const r=d[g]?.[o];if(r!==void 0)return r}};return{vertical_anchor:a("vertical_anchor")??i.vertical_anchor,orientation:a("orientation")??"horz",auto_size:a("auto_size")??i.auto_size,word_wrap:a("word_wrap")??i.word_wrap,margins:{left:a("margin_left")??J.left,top:a("margin_top")??J.top,right:a("margin_right")??J.right,bottom:a("margin_bottom")??J.bottom}}}const _e={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(Y(),i.text_styles.other);function ie(i,t){return{...te(_e,t),levels:levelsOver(Y(),i.text_styles.other,t.levels)}}function en(i,t,...d){return{...te(Re(t),...d),levels:levelsOver(Y(),i.text_styles[De(t)],...d.map(a=>a?.levels))}}const nn=Array.from({length:9},()=>({font:{color:D.font_color}})),ge={vertical_anchor:D.vertical_anchor};function be(i,t){return{...te(_e,t),levels:levelsOver(Y(),i.text_styles.other,nn,t.levels)}}const V=i=>{const t={...i};return delete t.paragraphs,t},Z=i=>({paragraphs:[],levels:[],...i}),P=i=>i==="none"?null:colorOfFile(i),tn=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,on=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="([^"\n]*)"/gu,q=57344,an=256,ye="",rn=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const spaceOfFile=i=>typeof i=="number"?v(i):{lines:i.lines},colorOfFile=i=>fe(i)??"dk1";function oe(i){const{shadow:t,gradient:d,inner_shadow:a,glow:o,reflection:g}=i;return{...a?{inner_shadow:{color:a.color===void 0?G.color:colorOfFile(a.color),blur:a.blur===void 0?G.blur:v(a.blur),distance:a.distance===void 0?G.distance:v(a.distance),angle:a.angle??G.angle,transparency:a.transparency??G.transparency}}:{},...o?{glow:{color:o.color===void 0?ee.color:colorOfFile(o.color),size:o.size===void 0?ee.size:v(o.size),transparency:o.transparency??ee.transparency}}:{},...i.soft_edges===void 0?{}:{soft_edges:v(i.soft_edges)},...g?{reflection:{transparency:g.transparency??K.transparency,size:g.size??K.size,distance:g.distance===void 0?K.distance:v(g.distance),blur:g.blur===void 0?K.blur:v(g.blur)}}:{},...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...d?{gradient:{angle:d.angle??0,...d.path===void 0?{}:{path:d.path},...d.focus===void 0?{}:{focus:{left:d.focus.left??.5,top:d.focus.top??.5,right:d.focus.right??.5,bottom:d.focus.bottom??.5}},stops:d.stops.map(r=>({at:r.at,color:colorOfFile(r.color),...r.transparency===void 0?{}:{transparency:r.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?W.color:colorOfFile(t.color),blur:t.blur===void 0?W.blur:v(t.blur),distance:t.distance===void 0?W.distance:v(t.distance),angle:t.angle??W.angle,transparency:t.transparency??W.transparency}}:{}}}const dn=i=>({...i.tile?{tile:{...i.tile}}:{},...i.transparency===void 0?{}:{transparency:i.transparency}});function $e(i,t){const{pattern:d,picture_fill:a}=i;return{...d?{pattern:{preset:d.preset,fg:colorOfFile(d.fg??ce.fg),bg:colorOfFile(d.bg??ce.bg)}}:{},...a?{picture_fill:{path:joinPath(t,a.path),...a.tile?{tile:{scale_x:a.tile.scale_x??H.scale_x,scale_y:a.tile.scale_y??H.scale_y,offset_x:a.tile.x===void 0?H.offset_x:v(a.tile.x),offset_y:a.tile.y===void 0?H.offset_y:v(a.tile.y),align:a.tile.align??H.align}}:{},...a.transparency===void 0?{}:{transparency:a.transparency}}}:{}}}function ke(i,t,d=[]){const a=ne(i.style);return{...i,rows:i.rows.map((o,g)=>({height:o.height,cells:o.cells.map((r,j)=>{const N=d[g],_=a?Je(a,i,g,j,i.rows.length,i.columns.length,g+(r.span_height??1)-1,j+(r.span_width??1)-1):void 0,E=ie(t,r.text),C=_&&(_.bold!==void 0||_.text!==void 0)?{...E,levels:E.levels.map(R=>({...R,font:{...R.font,..._.bold===void 0?{}:{bold:_.bold},..._.text===void 0?{}:{color:_.text}}}))}:E;return{...r,text:{paragraphs:r.text.paragraphs,style:Q({...C,auto_size:"shape"},N),own:V(r.text),empty:!1},...N?{fileText:N}:{}}})}))}}function Q(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},...t.orientation===void 0?{}:{orientation:t.orientation},levels:i.levels.map(d=>{const a={...d.font,...t.size===void 0?{}:{size:v(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.caps===void 0?{}:{caps:t.caps},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(a.color=colorOfFile(t.color));const o={...d,font:a,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:spaceOfFile(t.space_before)},...t.space_after===void 0?{}:{space_after:spaceOfFile(t.space_after)}};return t.bullet_color!==void 0&&(o.bullet_color=colorOfFile(t.bullet_color)),t.bullet_size!==void 0&&(o.bullet_size=t.bullet_size),t.start_at!==void 0&&(o.start_at=t.start_at),t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&d.margin_left===0?{...o,margin_left:we,indent:-we}:o})}:i}function ln(i,t){if(!t)return[...i];const d=t.numbered!==void 0||t.bullet!==void 0;return i.map(a=>{const o={...a};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,t.bullet_color!==void 0&&delete o.bullet_color,t.bullet_size!==void 0&&delete o.bullet_size,t.start_at!==void 0&&delete o.start_at,d&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}const sn=i=>Fe.includes(i),fn=i=>Ae.includes(i);function cn(i){const t={};for(const[,d,a=""]of i.matchAll(on))if(d==="font")t.name=a.trim();else if(d==="link")t.link=a.trim();else if(d==="highlight")t.highlight=a.trim().toUpperCase();else if(d==="bold")t.bold=a.trim()!=="false";else if(d==="italic")t.italic=a.trim()!=="false";else if(d==="strike"){const o=a.trim();t.strike=o==="dblStrike"?o:o!=="false"}else if(d==="underline"){const o=a.trim();t.underline=sn(o)&&o!=="sng"?o:o!=="false"}else if(d==="caps"){const o=a.trim();fn(o)&&(t.caps=o)}else if(d==="size"){const o=Number(a);Number.isFinite(o)&&o>0&&(t.size=v(o))}else if(d==="baseline"){const o=Number(a);Number.isFinite(o)&&(t.baseline=o)}else if(d==="spacing"){const o=Number(a);Number.isFinite(o)&&(t.spacing=v(o))}else{const o=fe(a.trim());o!==void 0&&(t.color=o)}return t}const we=342900;export function paragraphsOfWords(i,t=0,d=Ve.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(a=>{const o=[],g=a.replace(tn,(_,E,C)=>(o.push(cn(E)),`${String.fromCharCode(q+o.length-1)}${C}${ye}`)),r=Ne(g);let j;const N=Me(r.text,r.marks).flatMap(_=>{const E=_.kinds.includes("code"),C={..._.kinds.includes("strong")?{bold:!0}:{},..._.kinds.includes("em")?{italic:!0}:{},...E?{name:d}:{}};return[..._.text.matchAll(rn)].flatMap(R=>{const U=R[0],I=U.charCodeAt(0);if(U===ye)return j=void 0,[];if(I>=q&&I<q+an)return j=o[I-q],[];const X={...j,...C};return[{text:U,...Object.keys(X).length>0?{font:X}:{},...E?{code:!0}:{}}]})});return{runs:N.length>0?N:[{text:""}],level:t}}):i.flatMap(a=>paragraphsOfWords(a,Array.isArray(a)?Math.min(t+1,8):t,d))}const xe=i=>({left:v(i.x),top:v(i.y),width:v(i.w),height:v(i.h)}),un=new Set(["dt","ftr","sldNum"]),Se=i=>({...i.locked?{locked:!0}:{},...i.link===void 0?{}:{link:i.link},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function Oe(i,t,d){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const a=t.gradient&&oe({gradient:t.gradient}).gradient;a&&(i.background_gradient=a),t.picture!==void 0&&(i.background_picture=joinPath(d,t.picture))}function pn(i,t,d){if(i.data===void 0)return;let a;try{const _=t(Le(i.data));a=Array.isArray(_)?_:t(i.data)}catch(_){d(`${i.data} cannot be read: ${_ instanceof Error?_.message:String(_)}`);return}if(!Array.isArray(a)||a.length===0){d(`${i.data} holds no rows.`);return}const o=a,g=Object.keys(o[0]??{}),r=i.fields??g,j=r.filter(_=>!g.includes(_));if(j.length>0){d(`${i.data} has no column ${j.join(", ")} (it has ${g.join(", ")}).`);return}const N=_=>typeof _=="string"||typeof _=="number"||typeof _=="boolean"?String(_):"";return[...i.head===!1?[]:[[...r]],...o.map(_=>r.map(E=>N(_[E])))]}const hn=i=>{const t=ne(i.style);return{...t?{style:t.id}:{},...i.first_row===void 0?{}:{first_row:i.first_row},...i.last_row===void 0?{}:{last_row:i.last_row},...i.first_col===void 0?{}:{first_col:i.first_col},...i.last_col===void 0?{}:{last_col:i.last_col},...i.horz_banding===void 0?{}:{horz_banding:i.horz_banding},...i.vert_banding===void 0?{}:{vert_banding:i.vert_banding}}},ve=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:d,words:a,prefix:o,base:g}=i,r=[],j=qe(i.theme??Ze,t.theme),N=new Map;for(const e of t.masters)for(const n of e.layouts)N.set(n.name,{layout:n,master:e});const _=[],E=(e,n,l)=>{const m=Ge[n.type];return n.direction!==void 0&&!m.directions.includes(n.direction)&&r.push({slide:e,path:`${l}.transition.direction`,message:m.directions.length===0?`A ${n.type} transition has no direction (${n.direction}).`:`A ${n.type} transition goes ${m.directions.join(", ")}, not ${n.direction}.`}),n.through_black===!0&&!m.throughBlack&&r.push({slide:e,path:`${l}.transition.through_black`,message:`A ${n.type} transition does not go through black: only a fade, a cut and a reveal do.`}),Ie(n)},C=(e,n,l)=>({name:e.name,kind:e.kind,frame:{...e.frame??me},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?be(l,e.text):ie(l,e.text),own:V(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.pattern?{pattern:e.pattern}:{},...e.picture_fill?{picture_fill:{...dn(e.picture_fill),path:joinPath(e.picture_fill.base,e.picture_fill.path)}}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.inner_shadow?{inner_shadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.soft_edges===void 0?{}:{soft_edges:e.soft_edges},...e.reflection?{reflection:e.reflection}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:ke(e.table,l)}:{},...e.chart?{chart:e.chart}:{},...e.link===void 0?{}:{link:e.link},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster},...e.media.playback?{playback:e.media.playback}:{}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),R=(e,n)=>{const l=e.placeholder?.type??"body",m=Ye(n,l),b=e.frame??m?.frame??me;return{name:e.name,kind:"placeholder",frame:{...b},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:en(n,l,m?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!m?"layout":"master"},text:{from:"layout"}}}},U=(e,n,l,m)=>{const b=t.components[e];if(!b){r.push({...l,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const w of Object.keys(n??{}))Object.hasOwn(b.props,w)||r.push({...l,message:`Component ${e} has no prop ${w} a person sets (it has ${Object.keys(b.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...m===void 0?{}:{dur:m}}},I=(e,n,l,m,b)=>{const w={slide:m,shape:e,path:l};if(!n.frame){r.push({...w,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const z=xe(n.frame),c={frame:{from:"slide",path:`${l}.frame`}},S={name:e,frame:z,level:"slide",...n.fill===void 0?{}:{fill:P(n.fill)},...oe(n),...$e(n,g),...n.line===void 0?{}:{line:P(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_cap===void 0?{}:{line_cap:n.line_cap},...n.line_join===void 0?{}:{line_join:n.line_join},...n.line_compound===void 0?{}:{line_compound:n.line_compound},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...Se(n)};if(n.textbox)return{...S,kind:"textbox",text:{paragraphs:paragraphsOfWords(a(`${o}.${m}.${e}`),0,j.fonts.code),style:Q(ie(b,Z(pe)),n.text),own:V(Z(pe)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...c,text:{from:"slide",path:`${l}.text`}}};if(n.picture!==void 0){const u=ve(n.crop);return{...S,kind:"picture",media:{path:joinPath(g,n.picture),...u?{crop:u}:{}},sources:{...c,media:{from:"slide",path:`${l}.picture`}}}}if(n.item!==void 0)return{...S,kind:"item",item:{path:joinPath(g,n.item),...n.playback?{playback:n.playback}:{}},sources:{...c,media:{from:"slide",path:`${l}.item`}}};if(n.movie!==void 0)return{...S,kind:"movie",media:{path:joinPath(g,n.movie),...n.poster===void 0?{}:{poster:n.poster},...n.playback?{playback:n.playback}:{}},sources:{...c,media:{from:"slide",path:`${l}.movie`}}};if(n.audio!==void 0)return{...S,kind:"audio",media:{path:joinPath(g,n.audio),...n.playback?{playback:n.playback}:{}},sources:{...c,media:{from:"slide",path:`${l}.audio`}}};if(n.chart){const u=`${o}.${m}.${e}`,A=p=>typeof p=="string"?p:void 0,x=Object.fromEntries(Ke.flatMap(p=>{const s=A(a(`${u}.${p}`));return s===void 0?[]:[[p,s]]})),T=Ce(n.chart,{title:A(a(u))??A(a(`${u}.title`)),axisTitles:x,base:g,rows:p=>i.data?.(p),problem:p=>{r.push({...w,message:`Chart ${e}: ${p}`})}});return T?{...S,kind:"chart",chart:T,sources:c}:void 0}if(n.table){const u=n.table;u.style!==void 0&&!ne(u.style)&&r.push({...w,message:`Table ${e}'s style ${u.style} is none of PowerPoint's built-in table styles: name one as its gallery does (Medium Style 2 - Accent 1, Light Style 1, No Style, Table Grid) or by its id.`});const A=u.data===void 0?void 0:pn(u,f=>i.data?.(f),f=>{r.push({...w,message:`Table ${e}: ${f}`})});if(u.data!==void 0&&A===void 0)return;const x=A===void 0?u.rows:A.map((f,y)=>u.rows[Math.min(y,u.rows.length-1)]??u.rows[0]),T=z.width/u.columns.reduce((f,y)=>f+y,0),p=z.height/x.reduce((f,y)=>f+(y?.height??0),0),s=a(`${o}.${m}.${e}`),h=A??(Array.isArray(s)?s:[]),k=new Map;for(const f of u.merged??[]){const y=f.rows??1,O=f.columns??1;for(let M=f.row;M<f.row+y;M++)for(let F=f.column;F<f.column+O;F++)k.set(`${String(M)},${String(F)}`,"under");k.set(`${String(f.row)},${String(f.column)}`,{w:O,h:y})}return A===void 0&&h.length>u.rows.length&&r.push({...w,message:`Table ${e} has ${String(u.rows.length)} rows and its words ${String(h.length)}.`}),{...S,kind:"table",table:ke({...hn(u),columns:u.columns.map(f=>Math.round(f*T)),rows:x.flatMap((f,y)=>{if(!f)return[];const O=h[y],M=Array.isArray(O)?O:O===void 0?[]:[O];return{height:Math.round(f.height*p),cells:u.columns.map((F,B)=>{const L=k.get(`${String(y)},${String(B)}`);return{text:{levels:[],paragraphs:L==="under"?[]:paragraphsOfWords(M[B],0,j.fonts.code)},...L==="under"?{spanned:!0}:{},...L!==void 0&&L!=="under"&&L.w>1?{span_width:L.w}:{},...L!==void 0&&L!=="under"&&L.h>1?{span_height:L.h}:{},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:v(1)}}}}})}})},b,x.map(f=>f?.text)),sources:c}}const $=n.path&&Be(n.path.d);if(n.path&&!$){r.push({...w,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&$){const u=!n.path&&Pe(n.geometry);return{...S,kind:"autoshape",...n.path&&$?{path:{w:n.path.w,h:n.path.h,steps:$}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...u?{line:n.line===void 0?ue.line:P(n.line),line_width:n.line_width===void 0?ue.line_width:v(n.line_width)}:{fill:n.fill===void 0?D.fill:P(n.fill),line:n.line===void 0?D.line:P(n.line),line_width:n.line_width===void 0?D.line_width:v(n.line_width)},...n.text&&!u?{fileText:{...n.text}}:{},...u?{}:{text:{paragraphs:paragraphsOfWords(a(`${o}.${m}.${e}`)).map(A=>n.text?.align===void 0?{alignment:D.alignment,...A}:A),style:Q(be(b,Z(ge)),n.text),own:V(Z(ge)),empty:!1}},sources:{...c,fill:{from:"slide",path:`${l}.fill`}}}}if(n.component!==void 0){const u=U(n.component,n.props,w,n.dur);return u?{...S,kind:"component",component:u,sources:c}:void 0}},X=(e,n,l)=>{if(n.frame&&(e.frame=xe(n.frame),e.sources.frame={from:"slide",path:`${l}.frame`}),Object.assign(e,Se(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=Q(e.text.style,n.text),e.text.paragraphs=ln(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${l}.text`}),n.line!==void 0&&(e.line=P(n.line),e.sources.line={from:"slide",path:`${l}.line`}),n.line_width!==void 0&&(e.line_width=v(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_cap!==void 0&&(e.line_cap=n.line_cap),n.line_join!==void 0&&(e.line_join=n.line_join),n.line_compound!==void 0&&(e.line_compound=n.line_compound),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),(n.fill!==void 0||n.gradient!==void 0||n.pattern!==void 0||n.picture_fill!==void 0)&&(delete e.gradient,delete e.pattern,delete e.picture_fill),n.fill!==void 0&&(e.fill=P(n.fill),e.sources.fill={from:"slide",path:`${l}.fill`}),Object.assign(e,oe(n),$e(n,g)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const m=ve(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(g,n.picture??n.movie??""),...m?{crop:m}:{},...n.poster===void 0?{}:{poster:n.poster},...n.playback&&n.movie!==void 0?{playback:n.playback}:{}},e.sources.media={from:"slide",path:`${l}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}else n.playback&&e.media&&(e.kind==="movie"||e.kind==="audio")&&(e.media={...e.media,playback:{...e.media.playback,...n.playback}})},ae=(e,n,l,m,b)=>{const w=N.get(n);if(!w){r.push({slide:e,path:`slides.${String(l)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...N.keys()].join(", ")||"none"}).`});return}const{layout:z,master:c}=w,S=[...(z.display_master_shapes===!1?[]:c.shapes).filter(u=>u.kind!=="placeholder").map(u=>C(u,"master",c)),...z.shapes.filter(u=>u.kind!=="placeholder").map(u=>C(u,"layout",c))],$=z.shapes.filter(u=>u.kind==="placeholder").map((u,A)=>({shape:R(u,c),order:A}));return{slide:{id:e,layout:z.name,master:c.name,hidden:m,background:z.background??c.background,...Qe(c,z),shapes:S,animations:[],file:{index:l,...b===void 0?{}:{generate:b}}},placed:$,master:c}},re=(e,n,l)=>{if(!n)return;const m=z=>{const c=n[z];if(c===void 0)return e.connect?.[z];const S=c==="none"?void 0:l(c.shape);return c==="none"||S===void 0?void 0:{shape:S,site:c.site}},b=m("begin"),w=m("end");b||w?e.connect={...b?{begin:b}:{},...w?{end:w}:{}}:delete e.connect},de=(e,n,l,m,b,w,z,c,S,$=()=>{})=>{const u=new Set(l.map(p=>p.shape.name));let A=l.length;for(const[p,s]of Object.entries(m??{})){const h=w(p);if(h===void 0)continue;const k=`${b}.shapes.${p}`,f=s.textbox!==void 0||s.geometry!==void 0||s.path!==void 0||s.table!==void 0||s.chart!==void 0||s.component!==void 0||s.audio!==void 0||s.item!==void 0||(s.picture!==void 0||s.movie!==void 0)&&!u.has(h),y=l.find(M=>M.shape.name===h);if(y&&!f){X(y.shape,s,k),re(y.shape,s.connect,w),y.shown=!0,s.z!==void 0&&(y.z=s.z);continue}if(y){r.push({slide:e.id,shape:h,path:k,message:`Slide ${e.id} has a ${y.shape.kind} ${h} already: a shape of its own needs another name.`});continue}if(!f){r.push({slide:e.id,shape:h,path:k,message:`Slide ${e.id} has no shape ${h} to change (its layout's placeholders and its own shapes are ${[...u].join(", ")||"none"}).`});continue}const O=I(h,s,k,e.id,n);O&&re(O,s.connect,w),O&&(l.push({shape:O,order:A++,...s.z===void 0?{}:{z:s.z}}),u.add(h))}const x=l.filter(p=>p.shown===!0||!un.has(p.shape.placeholder?.type??"")||z(p.shape)!==void 0);l.splice(0,l.length,...x),l.sort((p,s)=>(p.z??0)-(s.z??0)||p.order-s.order);const T=(p,s)=>{const h=f=>{const y=f.shape.group;return y===void 0?void 0:ze(y)[s]},k=new Map(p.flatMap((f,y)=>{const O=h(f);return O===void 0?[]:[[O,y]]}));return p.flatMap((f,y)=>{const O=h(f);return O===void 0?[f]:k.get(O)===y?T(p.filter(M=>h(M)===O),s+1):[]})};l.splice(0,l.length,...T(l,0));for(const p of l){const s=$(p.shape);s!==void 0&&(p.shape.alt=s);const h=p.shape.text;if(p.shape.kind==="placeholder"&&h){const k=z(p.shape);h.paragraphs=paragraphsOfWords(k,0,j.fonts.code),h.empty=h.paragraphs.length===0||h.paragraphs.every(f=>f.runs.every(y=>y.text===""))}}e.shapes.push(...l.map(p=>p.shape));for(const p of e.shapes){const s=p.connect;if(!s)continue;const h=Xe(p,k=>e.shapes.find(f=>f.name===k&&f.level===p.level&&f!==p));p.frame=h.frame,h.flip?p.flip=h.flip:delete p.flip;for(const k of h.lost){const f=s[k];f&&p.level==="slide"&&r.push({slide:e.id,shape:p.name,message:`Connector ${p.name}'s ${k} is glued to site ${String(f.site)} of ${f.shape}, which slide ${e.id} has not: it stays where it is.`})}}c!==void 0&&c.trim()!==""&&(e.notes=c);for(const[p,s]of(S??[]).entries()){const h=w(s.shape);if(h===void 0)continue;const k={slide:e.id,shape:h,path:`${b}.animations.${String(p)}`},f=e.shapes.find(F=>F.name===h&&F.level==="slide");if(!f){r.push({...k,message:`Slide ${e.id} has no shape ${h} to animate (it has ${e.shapes.filter(F=>F.level==="slide").map(F=>F.name).join(", ")}).`});continue}if(s.paragraph!==void 0&&s.paragraph>=(f.text?.paragraphs.length??0)){r.push({...k,message:`Shape ${h} has no paragraph ${String(s.paragraph)} to animate (it has ${String(f.text?.paragraphs.length??0)}).`});continue}const y=He[s.effect];s.direction!==void 0&&!y.directions.includes(s.direction)&&r.push({...k,path:`${k.path}.direction`,message:y.directions.length===0?`${h}'s ${s.effect} has no direction (${s.direction}).`:`${h}'s ${s.effect} goes ${y.directions.join(", ")}, not ${s.direction}.`}),s.amount!==void 0&&y.amount===void 0?r.push({...k,path:`${k.path}.amount`,message:`${h}'s ${s.effect} has no amount: only a Grow/Shrink, a spin and a Transparency do.`}):s.effect==="transparency"&&(s.amount??0)>1&&r.push({...k,path:`${k.path}.amount`,message:`${h}'s transparency is a share, at most 1 (it is ${String(s.amount)}).`}),s.animate_text!==void 0&&!f.text&&r.push({...k,path:`${k.path}.animate_text`,message:`${h} has no text to animate by ${s.animate_text}: it plays as one.`});const O=s.animate_text,M=Ue({...s,shape:h,...f.text?{}:{animate_text:void 0}},O===void 0?1:(s.paragraph===void 0?f.text?.paragraphs??[]:[f.text?.paragraphs[s.paragraph]]).reduce((F,B)=>F+We(B?.runs.map(L=>L.text)??[],O).length,0));M?e.animations.push(M):r.push({...k,message:`The animation of ${h} needs a path that starts with M and says only M, L and C, absolute.`})}},le=new Set;d.slides.forEach((e,n)=>{const l=`slides.${String(n)}`;if(e.layout!==void 0){const c=ae(e.id,e.layout,n,e.hidden===!0);if(!c)return;const S=a(`${o}.${e.id}.notes`);e.transition&&(c.slide.transition=E(e.id,e.transition,l)),e.advance_after!==void 0&&(c.slide.advance=e.advance_after),e.section!==void 0&&(c.slide.section=e.section),Oe(c.slide,e.background,g),de(c.slide,c.master,c.placed,e.shapes,l,$=>$,$=>a(`${o}.${e.id}.${$.name}`),typeof S=="string"?S:void 0,e.animations,$=>{const u=a(`${o}.${e.id}.alt.${$.name}`);return typeof u=="string"?u:void 0}),_.push(c.slide),le.add(e.id);return}const m=e.generate??"",b=t.generators[m];if(b===void 0){r.push({slide:e.id,path:`${l}.generate`,message:`There is no generator ${m} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(b)){r.push({slide:e.id,path:`${l}.generate`,message:`Generator ${m} threw: ${b.error}`,...b.stack===void 0?{}:{stack:b.stack}});return}const w=b,z=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const c of w){const S=`${e.id}/${c.id}`,$=ae(S,c.layout,n,z.has(c.id),m);if(!$)continue;for(const x of c.shapes){const T=x.placeholder?$.placed.find(p=>p.shape.placeholder?.idx===x.placeholder?.idx):void 0;if(T)x.frame&&(T.shape.frame={...x.frame}),T.shape.sources.frame={from:"code"},T.shown=!0;else{const p=C(x,"layout",$.master);$.placed.push({shape:{...p,level:"slide",sources:{frame:{from:"code"}}},order:$.placed.length})}}const u=`${c.id}/`,A=c.transition??(c===w[0]?e.transition:void 0);Oe($.slide,e.background,g),A&&($.slide.transition=E($.slide.id,A,l)),c===w[0]&&e.section!==void 0&&($.slide.section=e.section),de($.slide,$.master,$.placed,e.shapes,l,x=>x.startsWith(u)?x.slice(u.length):void 0,x=>{const T=x.placeholder===void 0?void 0:c.text[x.placeholder.idx];return T===void 0?void 0:T.map(p=>p.runs.map(s=>s.text).join(""))},c.notes,[...(c.animations??[]).map(x=>({...x,shape:`${u}${x.shape}`})),...e.animations??[]]);for(const x of $.slide.shapes){const T=x.placeholder===void 0?void 0:c.text[x.placeholder.idx];T&&x.text&&(x.text.paragraphs=T,x.text.empty=!1)}_.push($.slide),le.add(S)}for(const c of Object.keys(e.shapes??{})){const[S]=c.split("/");S!==void 0&&!w.some($=>$.id===S)&&r.push({slide:e.id,path:`${l}.shapes.${c}`,message:`Generator ${m} makes no slide ${S}: ${c} changes nothing.`})}});const se=new Set(_.map(e=>e.id));for(const e of _)for(const n of e.shapes){if(n.level!=="slide")continue;const l=[...n.link===void 0?[]:[n.link],...(n.text?.paragraphs??[]).flatMap(m=>m.runs.flatMap(b=>b.font?.link===void 0?[]:[b.font.link]))];for(const m of new Set(l)){const b=Ee(m);(b!==void 0?!se.has(b):m.startsWith("ppaction://")&&je(m)===void 0)&&r.push({slide:e.id,shape:n.name,message:b!==void 0?`Shape ${n.name} links to slide ${b}, which the deck has not (it has ${[...se].join(", ")}).`:`Shape ${n.name} links to ${m}: a show jump is ppaction://hlinkshowjump?jump= and ${Te.join(", ")}.`})}}return _.forEach((e,n)=>{for(const l of e.shapes)l.placeholder?.type==="sldNum"&&l.text&&(l.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],l.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:j,slides:_},problems:r}}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFile as
|
|
2
|
+
import{readFile as I}from"node:fs/promises";import{join as N,posix as f}from"node:path";import{problem as y}from"@allyhub/diagnostics";import{besideModule as K,deckReferences as U,loadFailure as D,mergeScript as B,messagePrefix as H,nodeStackPlace as M,parseComponentRef as L,pieceLocales as W,readScripts as G,referenceModule as J,resolveDims as Q,resolveMatrix as V,stageName as X}from"@allyhub/build";import{USE_FORMS as j,shownOf as Y}from"@allyhub/formats";import{checkDeck as Z,readSlidesFile as ee}from"@allyhub/slides-core";import{deckOf as te}from"./deck-info.js";export const DECK_DPI=144;const A=914400;export const deckFormat=([t,s])=>`${String(Math.round(t/A*DECK_DPI))}x${String(Math.round(s/A*DECK_DPI))}`;export async function readDeck(t,s){const r=[],i=t.id,u=s.claim(i,t.entry);if(u!==void 0)return r.push(y("AK-B001",`${t.entry} and ${u} both have the piece id ${i}.`,{where:{file:t.entry}})),{problems:r};const d=await s.meta.request({type:"run",module:K(import.meta.url,"evaluate"),file:t.entry,input:{files:!0}});if(r.push(...d.problems),!d.ok)return d.error!=="timeout"&&r.push(D(t.entry,d.error??"",M(d.stack,s.root))),{problems:r};const{slides:n,script:k}=d.value;if(n===void 0||k===void 0)return r.push(y("AK-M011",`The deck ${i} names no ${n===void 0?"slides":"script"}: presentation({ slides: "./${f.basename(i)}.yaml", script: "./${f.basename(i)}.{locale}.yaml" }, …) names its slides' file and its script, a file per language, from its module's folder.`,{piece:i,where:{file:t.entry}})),{problems:r};const w=[{path:n,role:"slides"},{path:k,role:"script"}],v=await G(s.root,s.files,k,i);r.push(...v.problems),r.push(...B(s.messages,i,v.scripts));const O=W(s.messages,v.scripts),$=e=>({file:n,...e===void 0?{}:{line:e}});let p,b=()=>{},c;try{c=await I(N(s.root,n),"utf8")}catch{r.push(y("AK-M011",`The deck ${i} names ${n} for its slides, which is not there: write it, its slides listed each on one of ${f.basename(t.entry)}'s layouts (slides: [{ id: cover, layout: Title Slide }]).`,{piece:i,where:{file:n}}))}const m=c===void 0?void 0:ee(c);if(m){b=m.readable?.lineOf??m.lineOf;for(const e of m.problems)r.push(y("AK-M011",`${n}: ${e.message}`,{piece:i,where:$(e.line)}));p=m.readable?.file}const T=r.length,_={slides:p,words:Object.fromEntries(O.map(e=>[e,s.messages.messages[e]??{}])),prefix:H(i),tables:Object.fromEntries(Object.entries(s.lent).map(([e,o])=>[e,o.value])),shown:Object.fromEntries(Object.entries(s.lent).flatMap(([e,o])=>o.shown===void 0?[]:[[e,o.shown]]))},h=await s.meta.request({type:"run",module:K(import.meta.url,"evaluate"),file:t.entry,input:_});if(r.push(...h.problems),!h.ok)return h.error!=="timeout"&&r.push(D(t.entry,h.error??"",M(h.stack,s.root))),{problems:r,files:w};const a=h.value,P=e=>{const o=M(e.stack,s.root);return o?{file:o.file,line:o.line}:$(e.path===void 0?void 0:b(e.path))};for(const e of[...a.problems,...Z(a.resolved,{mediaKind:o=>s.media[o]?.kind})])r.push(y("AK-M011",e.stack===void 0?`${n}: ${e.message}`:e.message,{piece:i,...e.slide===void 0?{}:{part:e.slide},where:P(e)}));if(a.resolved.slides.length===0)return r.length===T&&m?.file&&r.push(y("AK-K003",m.file.slides.length===0?`The deck has no slides: ${n} lists none (slides: [{ id: cover, layout: Title Slide }]).`:`The deck has no slides: ${n} lists only generators, and they made none.`,{piece:i,where:$(b("slides"))})),{problems:r,files:w};const x=Q(void 0,{locales:O}),R=await V({root:s.root,piece:i,file:t.entry,dims:x,matrix:void 0,files:[]}),S=deckFormat(a.size),F={id:i,idFrom:"path",kind:t.kind,dir:t.dir,file:t.entry,place:i,...a.title===void 0?{}:{title:a.title},format:S,formatEntry:S,dims:x,combos:R.combos,options:{},meta:{},script:k,info:{slides:n,...p?{file:p}:{},size:a.size,layouts:a.layouts,components:a.components,generators:a.generators,code:a.code,data:a.data},loads:{kindData:{slides:p??{slides:[]},slidesFile:n,code:a.code}},counts:{value:p??null}},z=f.dirname(n)===f.dirname(t.entry),C=e=>{const o=/[\w#./-]/u;for(let l=z?c?.indexOf(e)??-1:-1;c!==void 0&&l>=0;){const g=c[l-1]??" ",q=c[l+e.length]??" ";if(!o.test(g)&&!o.test(q))return{from:n,line:c.slice(0,l).split(`
|
|
3
|
+
`).length};l=c.indexOf(e,l+1)}return{}},E=[...Object.keys(a.data).filter(e=>e.includes("#")&&Y(e)===void 0).map(e=>({of:e,...C(e),types:[j.data],role:"data"})),...a.resolved.slides.flatMap(e=>e.shapes.flatMap(o=>{if(o.kind!=="item"||!o.item)return[];const l=f.relative(f.dirname(n),o.item.path),g=b(o.sources.media?.path??"");return[{of:l.startsWith(".")?l:`./${l}`,from:n,...g===void 0?{}:{line:g},types:[j.live,"wav"],madeFor:["pptx"],role:"item"}]}))];return{problems:r,files:w,...E.length>0?{uses:E}:{},piece:F,stage:se(F,n)}}function se(t,s){const r=f.dirname(t.file),i=U(te(t)?.file).flatMap(u=>{const d=J(r,u),n=L(u);return d!==void 0&&n?[{of:u,module:d,name:n.name}]:[]});return{name:X(t.id),module:t.file,of:s,components:i}}const re={read:readDeck,onStage:!0,checks:[import.meta.resolve("@allyhub/slides-core"),import.meta.resolve("@allyhub/video-measure"),import.meta.resolve("@allyhub/video-core")],still:async(t,s,r)=>new(await import("@allyhub/video-measure")).OpenedFilm(t).still(s,r.format===void 0?{}:{format:r.format}),checkPiece:async t=>(await import("./check.js")).checkDeck(t),ready:async(t,s)=>(await import("./export.js")).deckReady(t,s),render:async(t,s)=>(await import("./export.js")).renderDeck(s)};export default re;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{execFile as
|
|
2
|
+
import{execFile as R}from"node:child_process";import{mkdir as W,mkdtemp as U,readFile as O,rm as V,writeFile as P}from"node:fs/promises";import{tmpdir as $}from"node:os";import{dirname as X,join as d}from"node:path";import{promisify as Y}from"node:util";import{cropImage as j,ffmpegOf as B,ffprobeOf as Z,finalStill as K,readPng as L,writePng as T}from"@allyhub/render";import{clockOf as tt,DECK_FPS as et,componentSeconds as it}from"@allyhub/slides-core";import{filesOf as nt,picturedShapes as ot,writePptx as at}from"@allyhub/slides-pptx";import{deckFonts as rt}from"./deck-fonts.js";const F=Y(R),st=60;function ct(i,r){const a=i.playback?.trim,n=a?.end??r;if(n!==void 0)return Math.min(st,Math.max(0,n-(a?.start??0)))}const w=et/2;async function ft(i){const r=await U(d($(),"allyhub-deck-movie-"));try{await Promise.all(i.map((n,m)=>P(d(r,`${String(m).padStart(5,"0")}.png`),n)));const a=d(r,"movie.mp4");return await F(await B(),["-y","-loglevel","error","-framerate",String(w),"-i",d(r,"%05d.png"),"-vf","pad=ceil(iw/2)*2:ceil(ih/2)*2","-c:v","libx264","-crf","18","-pix_fmt","yuv420p","-movflags","+faststart",a]),new Uint8Array(await O(a))}finally{await V(r,{recursive:!0,force:!0})}}async function dt(i,r,a){const n=await U(d($(),"allyhub-deck-sound-"));try{const m=d(n,"picture.mp4"),c=d(n,"movie.mp4");return await P(m,i),await F(await B(),["-y","-loglevel","error","-i",m,...a.loop?["-stream_loop","-1"]:[],"-ss",String(a.from),"-i",r,"-map","0:v","-map","1:a","-c:v","copy","-c:a","aac","-b:a","192k","-t",String(a.seconds),"-movflags","+faststart",c]),new Uint8Array(await O(c))}finally{await V(n,{recursive:!0,force:!0})}}async function mt(i){return await i.graphics().deck?.()}export async function renderDeckPptx(i,r,a={}){const n=await mt(i);if(!n)return;const m=a.only===void 0?void 0:n.slides[a.only];if(a.only!==void 0&&!m)return;const c=m?{...n,slides:[{...m,hidden:!1}]}:n,u=i.graphics(),p=u.timeline.width/c.width,h=new Map,S=ot(c);for(const t of new Set(S.map(o=>o.slide))){const o=u.timeline.parts.find(f=>f.key===t);if(!o)continue;const e=L(await K(u,o.still,{target:i.target,look:i.look,media:i.media}));for(const f of S.filter(l=>l.slide===t)){const l=j(e,[f.frame.left*p,f.frame.top*p,f.frame.width*p,f.frame.height*p]);l&&h.set(f.key,T(l))}}const b=new Map;for(const t of S){const o=c.slides.find(s=>s.id===t.slide),e=o?.shapes.find(s=>s.name===t.shape),f=u.timeline.parts.find(s=>s.key===t.slide),l=e?.component?it(e.component):e?.kind==="item"&&e.item?ct(e.item,n.items?.[e.item.path]):void 0;if(!o||!f||!e||l===void 0)continue;const J=[t.frame.left*p,t.frame.top*p,t.frame.width*p,t.frame.height*p],x=tt(o,n.slides[0]?.id===o.id),E=f.start+(e.kind==="item"?x.playsAt:x.comesOn)(e.name),I=async s=>{const k=L(await K(u,s,{target:i.target,look:i.look,media:i.media})),C=j(k,J);return C?T(C):void 0},y=await I(E),A=h.get(t.key);if(!y||!A||Buffer.compare(y,A)===0)continue;const g=[y],Q=Math.ceil(l*w);for(let s=1;s<Q;s++){const k=await I(E+s/w);k&&g.push(k)}const D=await ft(g),z=e.kind==="item"&&e.item?a.sound?.(e.item.path):void 0;b.set(t.key,{bytes:z===void 0||!e.item?D:await dt(D,z,{from:e.item.playback?.trim?.start??0,seconds:g.length/w,loop:e.item.playback?.loop===!0}),seconds:g.length/w}),h.set(t.key,y)}const _=new Map;for(const t of nt(c))try{_.set(t,await O(d(i.prepared.root,t)))}catch{}const M=new Map,v=[],q=await Z();for(const t of new Set(c.slides.flatMap(o=>o.shapes.flatMap(e=>(e.kind==="movie"||e.kind==="audio")&&e.media?[e.media.path]:[])))){const o=await F(q,["-v","error","-show_entries","format=duration","-of","csv=p=0",d(i.prepared.root,t)]).then(e=>Number(e.stdout.trim()),()=>Number.NaN);Number.isFinite(o)&&o>0?M.set(t,o):v.push(`${t}: its length could not be measured, so it plays on a click in PowerPoint`)}const N=u.timeline.parts[0]?.title,{fonts:G,left:H}=await rt(c,i.prepared.root,i.prepared.config);return await W(X(r),{recursive:!0}),await P(r,at({deck:c,file:t=>_.get(t),pictures:h,...b.size>0?{movies:b}:{},...M.size>0?{lengths:M}:{},fonts:G,...N===void 0?{}:{title:N},left:t=>v.push(t)})),{files:[r],fontsLeft:H,missing:v}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readFileSync as j}from"node:fs";import{join as
|
|
3
|
-
`)[0]??""}`,{where:{file:
|
|
2
|
+
import{readFileSync as j}from"node:fs";import{join as k,posix as v}from"node:path";import{deckReferences as $,parseCsv as S,parseData as x,plain as N}from"@allyhub/build";import{problem as J}from"@allyhub/diagnostics";import{framedComponent as C,parseComponentRef as D}from"@allyhub/piece";import{shownOf as E}from"@allyhub/formats";import{deckCode as M,evaluateDeck as P,isDeck as R,joinPath as p,resolveDeck as _}from"@allyhub/slides-core";function z(i){const m=Object.keys(i),h=d=>{const o=i[d];if(typeof o=="string")return o;if(typeof o=="object"&&o!==null&&"display"in o)return String(o.display);const r=`${d}.`,a=[...new Set(m.filter(s=>s.startsWith(r)).map(s=>s.slice(r.length).split(".")[0]).filter(s=>s!==void 0&&/^\d+$/u.test(s)))].sort((s,u)=>Number(s)-Number(u));if(a.length!==0)return a.map(s=>h(`${d}.${s}`)).filter(s=>s!==void 0)};return h}const A=async i=>{const{file:m}=i,d=(await i.import(m)).default;if(!R(d))throw new Error("The default export is not a deck: a deck's module exports presentation({ slides, script }, (prs) => { … }) from @allyhub/sdk/slides");const o=v.dirname(m);if(i.input?.files===!0){const{slides:e,script:t}=d.options;return{...e===void 0?{}:{slides:p(o,e)},...t===void 0?{}:{script:p(o,t)}}}const r=i.input,a=await i.guarded(()=>Promise.resolve(P(d)));for(const e of $(r.slides)){if(Object.hasOwn(a.components,e))continue;const t=D(e);if(!t)continue;const n=p(o,t.path);let c;try{c=await i.load(n)}catch(f){i.report(J("AK-M011",`${e}: ${n} could not be loaded: ${(f instanceof Error?f.message:String(f)).split(`
|
|
3
|
+
`)[0]??""}`,{where:{file:n}}));continue}const l=Object.hasOwn(c,t.name)?C(e,c[t.name]):void 0;l&&(a.components[e]=l)}const s={},u=e=>{if(Object.hasOwn(s,e))return s[e];const t=E(e);if(t!==void 0){const l=p(o,t),f=Object.hasOwn(r.shown??{},l)?r.shown?.[l]:void 0;return s[e]=f,f}const n=p(o,e);let c;if(n.includes("#")){if(!Object.hasOwn(r.tables,n))throw new Error(`${n} is not a table of a sheet.`);c=r.tables[n]}else{const l=j(k(i.root,n),"utf8");c=/\.csv$/iu.test(n)?S(l):x(n,l)}return s[e]=c,c},b=await i.guarded(()=>Promise.resolve(M(a,u))),g=Object.keys(r.words);let O;const w=new Map;for(const e of g.length>0?g:[""]){const t=_({code:b,file:r.slides??{slides:[]},words:z(r.words[e]??{}),prefix:r.prefix,base:o,data:u});O??=t.deck;for(const n of t.problems){const c=JSON.stringify([n.path,n.slide,n.shape,n.message]),l=w.get(c);l?l.langs.push(e):w.set(c,{...n,langs:[e]})}}const y=[...w.values()].map(({langs:e,...t})=>e.length===g.length||g.length<=1?t:{...t,message:`${t.message} (in ${e.join(", ")})`});return{...d.options.title===void 0?{}:{title:d.options.title},size:[a.slide_width,a.slide_height],layouts:a.masters.flatMap(e=>e.layouts.map(t=>t.name)),components:Object.fromEntries(Object.entries(a.components).map(([e,t])=>[e,N(t.props,e,[])])),generators:Object.keys(a.generators),code:b,data:JSON.parse(JSON.stringify(s)),resolved:JSON.parse(JSON.stringify(O)),problems:y}};export default A;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{mkdir as
|
|
2
|
+
import{mkdir as h}from"node:fs/promises";import{dirname as w}from"node:path";import{RenderError as p,renderStills as y,requireTools as x}from"@allyhub/render";import{OpenedFilm as b}from"@allyhub/video-measure";import{renderDeckPptx as S}from"./deck-pptx.js";import{deckOf as l}from"./deck-info.js";const O=["pdf","pptx","png"];function P(e){const t=e.piece.title;return typeof t=="string"?t:t===void 0?void 0:t[e.target.combo.lang??""]??Object.values(t)[0]}export async function deckReady(e,t){const i=t.codec;await x(e,typeof i=="string"?i:void 0)}async function $(e,t,i,n){const o=n.params;if(t==="pptx"&&l(e.piece)&&o.pptx!=="picture"){const s=o.slide,d=n.prepared.items.find(c=>c.id===e.piece.place),f=await S(e,i,{...typeof s=="number"?{only:s}:{},sound:c=>{const m=d?.uses?.find(u=>u.file==="wav"&&n.prepared.items.find(g=>g.id===u.item)?.entry===c);return m===void 0?void 0:n.made(m.of)}});if(f)return n.onProgress?.(1),{type:t,...f};if(typeof s=="number")throw new p("no-slide",`${e.target.piece} has no slide ${String(s)} to write alone.`)}if(!O.includes(t))throw new p("unknown-type",`A deck is not made into ${t}: pdf, png or pptx.`);const r=P(e),a=await y(e,t,{out:i,...o.steps===!0?{steps:!0}:{},...l(e.piece)&&(t==="png"||t==="pptx")?{stills:s=>e.partStills(s.map(d=>({part:d.part.key,step:d.step,width:e.timeline.width,format:"png"})))}:{},...r===void 0?{}:{title:r}});return n.onProgress?.(1),{type:t,files:a.files??[a.out]}}export async function renderDeck(e){if(!e.version)throw new Error("A deck's files are made from a version.");const t=new b(e.version),i=[];for(const n of e.types){const o=e.out(n);await h(w(o),{recursive:!0});try{i.push(await $(t,n,o,e))}catch(r){if(e.signal?.aborted||!(r instanceof p))throw r;i.push({type:n,failure:{code:r.code,message:r.message,...r.hint?{hint:r.hint}:{}}})}}return i}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createHash as ge}from"node:crypto";import{zipSync as Ae}from"fflate";import{AUTOSHAPE_STYLE as Ne,colorOfFile as xe,spaceOfFile as ye,CONNECTOR_STYLE as Fe,isConnectorGeometry as re,joinPath as ne,placeholderFrame as ze,plainLevels as He,Pt as Ue,DEFAULT_TABLE_STYLE as Ge,TABLE_STYLES as Xe}from"@allyhub/slides-core";import{AUDIO_ICON as Ye}from"./audio-icon.js";import{chartBook as Je,chartXml as We}from"./charts.js";import{asFace as Ze,fontInfo as qe,eotOf as Ke}from"./fonts.js";import{NO_PARAGRAPHS as Ve,shapeXml as _e,treeXml as de}from"./shapes.js";import{bodyOfStyle as Qe,bodyProps as ie,bodyUnder as se,LINK as et,SLIDE_LINK as tt,SLIDE_NUMBER as nt,levelOf as be,listStyle as F,txBody as Y}from"./text.js";import{tableStyleXml as it}from"./table-styles.js";import{themeXml as Se}from"./theme.js";import{timingXml as at,transitionXml as ot}from"./timing.js";import{HEAD as v,NS as rt,PML as j,color as dt,el as i,esc as st,fill as ke,gradientFill as lt,unesc as we}from"./xml.js";const q={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",emf:"image/x-emf",wmf:"image/x-wmf"},$e={mp4:"video/mp4",m4v:"video/mp4",mov:"video/quicktime"},ve={mp3:"audio/mpeg",m4a:"audio/mp4",wav:"audio/wav",aac:"audio/aac"},M=e=>(e.split(".").pop()??"").toLowerCase(),pt=[["regular","p:regular","Regular"],["bold","p:bold","Bold"],["italic","p:italic","Italic"],["boldItalic","p:boldItalic","Bold Italic"]],c={hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",package:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",font:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",core:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",app:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",slideMaster:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster",slideLayout:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",slide:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",notesMaster:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster",notesSlide:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",video:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video",audio:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio",media:"http://schemas.microsoft.com/office/2007/relationships/media",presProps:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps",viewProps:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps",tableStyles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"},k={chart:"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",workbook:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",presentation:"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",slideMaster:"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",slideLayout:"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",slide:"application/vnd.openxmlformats-officedocument.presentationml.slide+xml",theme:"application/vnd.openxmlformats-officedocument.theme+xml",notesMaster:"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml",notesSlide:"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",presProps:"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml",viewProps:"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml",tableStyles:"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",core:"application/vnd.openxmlformats-package.core-properties+xml",app:"application/vnd.openxmlformats-officedocument.extended-properties+xml"};class R{list=[];linked(t,o){return t.replaceAll(new RegExp(`r:id="${et}([^"]*)"`,"gu"),(n,d)=>`r:id="${this.add(c.hyperlink,we(d),!0)}"`).replaceAll(new RegExp(`r:id="${tt}([^"]*)"`,"gu"),(n,d)=>{const r=o?.(we(d));return`r:id="${r===void 0?"":this.add(c.slide,r)}"`})}add(t,o,n=!1){const d=this.list.find(s=>s.type===t&&s.target===o);if(d)return d.id;const r=`rId${String(this.list.length+1)}`;return this.list.push({id:r,type:t,target:o,...n?{external:n}:{}}),r}xml(){return v+i("Relationships",{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},...this.list.map(t=>i("Relationship",{Id:t.id,Type:t.type,Target:t.target,TargetMode:t.external?"External":void 0})))}}class ct{list=[];add(t,o){return this.list.push({chart:t,frame:o}),`../charts/chart${String(this.list.length)}.xml`}}class mt{parts=new Map;byHash=new Map;add(t,o,n,d){const r=ge("sha256").update(t).digest("hex"),s=this.byHash.get(`${n}:${r}`);if(s)return s;const l=d?.split("/").pop()?.replace(/\.[^.]*$/u,"").replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,""),f=l===void 0||l===""?void 0:l;let g=`${f??`${n}${String(this.parts.size+1)}`}.${o}`;for(let P=2;this.parts.has(`ppt/media/${g}`);P++)g=`${f??n}-${String(P)}.${o}`;return this.parts.set(`ppt/media/${g}`,t),this.byHash.set(`${n}:${r}`,`../media/${g}`),`../media/${g}`}}function Me(e){return e.kind==="component"||e.kind==="movie"||e.kind==="audio"?!1:e.kind==="picture"?q[M(e.media?.path??"")]!==void 0:!0}function le(e){return e.kind==="component"||e.kind==="movie"?!0:e.kind==="picture"?q[M(e.media?.path??"")]===void 0:!1}export function picturedShapes(e){return e.slides.flatMap(t=>t.shapes.filter(o=>le(o)).map(o=>({key:`${t.id}/${o.name}`,slide:t.id,shape:o.name,frame:o.frame})))}export function filesOf(e){const t=new Set;for(const o of e.masters)for(const n of[...o.shapes,...o.layouts.flatMap(d=>d.shapes)])n.media&&Me(n)&&t.add(ne(n.media.base,n.media.path)),n.picture_fill&&t.add(ne(n.picture_fill.base,n.picture_fill.path));for(const o of e.slides){o.background_picture!==void 0&&t.add(o.background_picture);for(const n of o.shapes)n.media&&(n.kind==="picture"||n.kind==="movie"||n.kind==="audio")&&t.add(n.media.path),n.picture_fill&&t.add(n.picture_fill.path)}return[...t].sort()}const ft=i("p:nvGrpSpPr",{},i("p:cNvPr",{id:1,name:""}),i("p:cNvGrpSpPr"),i("p:nvPr")),ut=i("p:grpSpPr",{},i("a:xfrm",{},i("a:off",{x:0,y:0}),i("a:ext",{cx:0,cy:0}),i("a:chOff",{x:0,y:0}),i("a:chExt",{cx:0,cy:0}))),K=e=>i("p:spTree",{},ft,ut,...e),pe={bg1:"lt1",tx1:"dk1",bg2:"lt2",tx2:"dk2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink"},ae=e=>i("p:bg",{},i("p:bgPr",{},i("a:solidFill",{},dt(e)),i("a:effectLst")));function ht(e,t,o){if(e.background_picture!==void 0){const n=o(e.background_picture);if(n!==void 0)return i("p:bg",{},i("p:bgPr",{},i("a:blipFill",{dpi:0,rotWithShape:1},i("a:blip",{"r:embed":n}),i("a:srcRect"),i("a:stretch",{},i("a:fillRect"))),i("a:effectLst")))}return e.background_gradient?i("p:bg",{},i("p:bgPr",{},lt(e.background_gradient),i("a:effectLst"))):ce(e.background,t)?"":ae(e.background)}const ce=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Pe(e){return{...e.inner_shadow?{innerShadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.reflection?{reflection:e.reflection}:{},...e.soft_edges===void 0?{}:{softEdges:e.soft_edges},...e.pattern?{pattern:e.pattern}:{},...e.fill_transparency===void 0?{}:{fillTransparency:e.fill_transparency,...e.fill===void 0?{}:{fill:e.fill}},...e.gradient?{gradient:e.gradient}:{},...e.shadow===void 0?{}:{shadow:e.shadow}}}function Le(e,t,o,n,d){if(!e)return{};const r=n(e.path);return!r||q[M(e.path)]===void 0?(d(`${e.path} ${r?"is of a kind PowerPoint does not read":"is not in the project"}, so the file leaves the shape's picture fill out`),{}):{pictureFill:{image:t.add(c.image,o.add(r,M(e.path),"image",e.path)),...e.tile?{tile:e.tile}:{},...e.transparency===void 0?{}:{transparency:e.transparency}}}}function oe(e){const t=o=>({...e.fill===void 0||"fill"in o&&ce(e.fill,o.fill)?{}:{fill:e.fill},...e.line===void 0||ce(e.line,o.line)?{}:{line:e.line},...e.line_width===void 0||e.line_width===o.line_width?{}:{lineWidth:e.line_width}});return e.kind==="autoshape"?re(e.geometry)?{style:"connector",...t(Fe)}:{style:"shape",...t(Ne)}:{...e.kind==="textbox"?{fill:e.fill??null}:e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{lineWidth:e.line_width}}}const gt=(e,t)=>Array.from({length:Math.max(e.length,t.length)},(o,n)=>{const d=e[n]??{},r=t[n]??{},s={...d.font,...r.font};return{...d,...r,...Object.keys(s).length>0?{font:s}:{}}});function Ee(e,t,o,n,d,r,s,l){const f=n!==void 0&&d!==void 0&&JSON.stringify(n.text_styles.other)!==JSON.stringify(d.text_styles.other);return Y("p:txBody",ie(se(t,l),s,e==="autoshape"?{rtlCol:0}:{}),F(f?gt(n.text_styles.other,t.levels):t.levels),o,r,l)}const xt="{2D5ABB26-0587-4C30-8999-92F81FD0307C}",yt=[["left","a:lnL"],["right","a:lnR"],["top","a:lnT"],["bottom","a:lnB"]];function Ie(e,t){const o=new Map;return e.rows.forEach((n,d)=>{n.cells.forEach((r,s)=>{if(!r.spanned)for(let l=0;l<(r.span_height??1);l++)for(let f=0;f<(r.span_width??1);f++)(l>0||f>0)&&o.set(`${String(d+l)},${String(s+f)}`,{row:d,col:s})})}),i("a:tbl",{},i("a:tblPr",{firstRow:e.first_row?1:void 0,firstCol:e.first_col?1:void 0,lastRow:e.last_row?1:void 0,lastCol:e.last_col?1:void 0,bandRow:e.horz_banding?1:void 0,bandCol:e.vert_banding?1:void 0},i("a:tableStyleId",{},e.style??xt)),i("a:tblGrid",{},...e.columns.map(n=>i("a:gridCol",{w:n}))),...e.rows.map((n,d)=>i("a:tr",{h:n.height},...n.cells.map((r,s)=>{const l=r.text.own??r.text,f=Ce(r.fileText,r.text.style),g=r.spanned?o.get(`${String(d)},${String(s)}`):void 0;return i("a:tc",{gridSpan:r.span_width,rowSpan:r.span_height,hMerge:g&&s>g.col?1:void 0,vMerge:g&&d>g.row?1:void 0},Y("a:txBody",i("a:bodyPr"),i("a:lstStyle"),r.text.paragraphs,t,f),i("a:tcPr",{marL:l.margin_left,marR:l.margin_right,marT:l.margin_top,marB:l.margin_bottom,anchor:se(l,f).vertical_anchor},...yt.map(([P,z])=>{const H=r.borders?.[P];return H?i(z,{w:H.width},ke(H.color)):""}),r.fill===void 0?"":ke(r.fill)))}))))}const me=e=>e.group===void 0?{}:{group:e.group},V=e=>({...e.line_dash===void 0?{}:{lineDash:e.line_dash},...e.line_cap===void 0?{}:{lineCap:e.line_cap},...e.line_join===void 0?{}:{lineJoin:e.line_join},...e.line_compound===void 0?{}:{lineCompound:e.line_compound},...e.line_begin===void 0?{}:{lineBegin:e.line_begin},...e.line_end===void 0?{}:{lineEnd:e.line_end},...e.line_begin_size===void 0?{}:{lineBeginSize:e.line_begin_size},...e.line_end_size===void 0?{}:{lineEndSize:e.line_end_size}});function fe(e,t,o){return e.map(n=>{const d=n.kind==="cxn"?t.get(n.id)?.connect:void 0;if(!d)return n;const r=f=>{const g=f&&o(f.shape);return f&&g!==void 0?{id:g,idx:f.site}:void 0},s=r(d.begin),l=r(d.end);return s||l?{...n,connect:{...s?{begin:s}:{},...l?{end:l}:{}}}:n})}const Te=e=>new Map(e.map((t,o)=>[o+2,t])),De=e=>t=>e.find(o=>o.name===t)?.id;function Oe(e,t,o,n,d,r,s){const l={...Pe(e),...Le(e.picture_fill&&{...e.picture_fill,path:ne(e.picture_fill.base,e.picture_fill.path)},o,n,d,f=>{s.left(`${s.where} › ${e.name}: ${f}`)}),id:t,name:e.name,...e.frame?{frame:e.frame}:{},...e.rotation===void 0?{}:{rotation:e.rotation},...e.flip?{flip:e.flip}:{}};if(e.kind==="placeholder"&&e.placeholder){const f=s.on==="master"?{...ze(e.placeholder.type),...e.text}:e.text;return{...l,kind:"sp",placeholder:{...e.placeholder},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{lineWidth:e.line_width},...V(e),...e.fill===void 0&&e.line===void 0?{}:{geometry:e.geometry??"rect"},text:Y("p:txBody",f?ie(f):i("a:bodyPr"),F(f?.levels??[]),e.placeholder.type==="sldNum"?nt:Ve,r)}}if(Me(e)){if(e.table)return{...l,kind:"table",table:Ie(e.table,r)};if(e.kind==="picture"&&e.media){const f=ne(e.media.base,e.media.path),g=d(f);if(!g){s.left(`${s.where} › ${e.name}: ${f} is not in the project, so the file leaves the picture out`);return}return{...l,kind:"pic",picture:{image:o.add(c.image,n.add(g,M(e.media.path),"image",e.media.path))},descr:e.media.path.split("/").pop()??""}}return!e.path&&re(e.geometry)?{...l,kind:"cxn",geometry:e.geometry??"line",...e.adjustments?{adjustments:e.adjustments}:{},...oe(e),...V(e)}:{...l,kind:"sp",...e.kind==="textbox"?{textbox:!0}:{},...e.path?{path:e.path}:{geometry:e.geometry??"rect"},...e.adjustments?{adjustments:e.adjustments}:{},...oe(e),...V(e),...e.text?{text:Ee(e.kind,e.text,e.text.paragraphs,s.master,s.first,r)}:{}}}}function Ce(e,t){if(!e)return;const o=e.numbered!==void 0||e.bullet!==void 0&&e.bullet!==!1;return{font:{...e.size===void 0?{}:{size:Ue(e.size)},...e.bold===void 0?{}:{bold:e.bold},...e.italic===void 0?{}:{italic:e.italic},...e.underline===void 0?{}:{underline:e.underline},...e.strike===void 0?{}:{strike:e.strike},...e.caps===void 0?{}:{caps:e.caps},...e.font===void 0?{}:{name:e.font},...e.color===void 0?{}:{color:xe(e.color)}},paragraph:{...e.align===void 0?{}:{alignment:e.align},...e.line_spacing===void 0?{}:{line_spacing:{lines:e.line_spacing}},...e.space_before===void 0?{}:{space_before:ye(e.space_before)},...e.space_after===void 0?{}:{space_after:ye(e.space_after)},...e.bullet_color===void 0?{}:{bullet_color:xe(e.bullet_color)},...e.bullet_size===void 0?{}:{bullet_size:e.bullet_size},...e.start_at===void 0?{}:{start_at:e.start_at},...e.numbered!==void 0?{numbered:e.numbered}:e.bullet===void 0?{}:{bullet:e.bullet===!1?null:e.bullet}},...o&&t?{levels:t.levels.map(n=>({margin_left:n.margin_left,indent:n.indent}))}:{},...e.anchor===void 0?{}:{anchor:e.anchor},...e.orientation===void 0?{}:{orientation:e.orientation}}}function _t(e,t,o,n,d,r,s,l,f){const g=`${e.id}/${t.name}`,P=r.deck.fitted[g];if(t.level!=="slide"&&!le(t))return;const z=t.level==="slide"&&t.placeholder?{placeholder:{...t.placeholder}}:{},Q=!t.placeholder||t.sources.frame.from==="slide"||t.sources.frame.from==="code"?{frame:t.frame}:{},w={...Pe(t),...Le(t.picture_fill,n,d,r.file,u=>{r.left?.(`slide ${e.id} › ${t.name}: ${u}`)}),id:o,name:t.name,...z,...Q,...t.rotation===void 0?{}:{rotation:t.rotation},...t.flip?{flip:t.flip}:{},...t.alt===void 0?{}:{descr:t.alt},...t.locked?{locked:!0}:{},...t.link===void 0?{}:{link:t.link}},J=()=>{const u=r.pictures.get(g);return u?{image:n.add(c.image,d.add(u,"png","image"))}:void 0};if(t.table)return{...w,kind:"table",table:Ie(t.table,s)};if(t.chart)return{...w,frame:t.frame,kind:"chart",chart:n.add(c.chart,f.add(t.chart,t.frame))};const B=u=>r.left?.(`${g}: ${u}`);if(t.kind==="audio"&&t.media){const u=ve[M(t.media.path)]!==void 0,I=u?r.file(t.media.path):void 0;if(!I){B(u?`${t.media.path} is not in the project, so the file leaves the sound out`:`${t.media.path} is a sound PowerPoint does not play, so the file leaves it out`);return}const T=d.add(I,M(t.media.path),"media",t.media.path),D=t.media.playback;return l.push({spid:o,name:t.name,playback:D,sound:!0}),{...w,frame:t.frame,kind:"pic",picture:{image:n.add(c.image,d.add(Ye,"png","image"))},video:{link:n.add(c.audio,T),media:n.add(c.media,T),sound:!0,...D?.trim?{trim:D.trim}:{}}}}if(t.kind==="movie"&&t.media){const u=J(),I=$e[M(t.media.path)]!==void 0,T=I?r.file(t.media.path):void 0;if(!u){B("no picture of the video was drawn, so the file leaves it out");return}if(!T)return B(I?`${t.media.path} is not in the project, so the file holds the video's picture alone`:`${t.media.path} is a video PowerPoint does not play, so the file holds its picture alone`),{...w,frame:t.frame,kind:"pic",picture:u};const D=d.add(T,M(t.media.path),"media",t.media.path),E=t.media.playback;return l.push({spid:o,name:t.name,playback:E}),{...w,frame:t.frame,kind:"pic",picture:{image:u.image},video:{link:n.add(c.video,D),media:n.add(c.media,D),...E?.trim?{trim:E.trim}:{}}}}if(le(t)){const u=J(),I=r.movies?.get(g);if(u&&I){const T=d.add(I.bytes,"mp4","media");return l.push({spid:o,name:t.name}),{...w,frame:t.frame,kind:"pic",picture:{image:u.image},video:{link:n.add(c.video,T),media:n.add(c.media,T)}}}return u||B("no picture of it was drawn, so the file leaves it out"),u?{...w,frame:t.frame,kind:"pic",picture:u}:void 0}if(t.kind==="picture"&&t.media){const u=r.file(t.media.path);if(!u){B(`${t.media.path} is not in the project, so the file leaves the picture out`);return}return{...w,kind:"pic",picture:{image:n.add(c.image,d.add(u,M(t.media.path),"image",t.media.path)),...t.media.crop?{crop:t.media.crop}:{}},descr:t.alt??t.media.path.split("/").pop()??""}}if(!t.path&&re(t.geometry))return{...w,kind:"cxn",geometry:t.geometry??"line",...t.adjustments?{adjustments:t.adjustments}:{},...oe(t),...V(t)};const L=t.text,ee=r.deck.masters.find(u=>u.name===e.master),U=Ce(t.fileText,L?.style),W=L?t.placeholder?Y("p:txBody",ie(se({},U),P),i("a:lstStyle"),L.paragraphs,s,U):L.own?Ee(t.kind,L.own,L.paragraphs,ee,r.deck.masters[0],s,P,U):Y("p:txBody",ie(Qe(L.style),P),F(L.style.levels.map(be)),L.paragraphs,s):void 0,Z=t.sources.frame.from==="code",te=t.fill!==void 0&&(Z||t.sources.fill?.from==="slide"),A=t.line!==void 0&&(Z||t.sources.line?.from==="slide");return{...w,kind:"sp",...t.kind==="textbox"?{textbox:!0}:{},...t.path?{path:t.path}:!t.placeholder||te||A?{geometry:t.geometry??"rect"}:{},...t.adjustments?{adjustments:t.adjustments}:{},...V(t),...t.placeholder?{...te?{fill:t.fill}:{},...A?{line:t.line}:{},...t.line_width===void 0?{}:{lineWidth:t.line_width}}:oe(t),...W?{text:W}:{}}}const bt={cx:6858e3,cy:9144e3};function je(e,t){const o=_e({id:2,name:"Slide Image Placeholder 1",kind:"sp",placeholder:{type:"sldImg",idx:2},...e===void 0?{frame:{left:1143e3,top:685800,width:4572e3,height:3429e3}}:{}}),n=_e({id:3,name:"Notes Placeholder 2",kind:"sp",placeholder:{type:"body",idx:3,sz:"quarter"},...e===void 0?{frame:{left:685800,top:4343400,width:5486400,height:4114800}}:{},text:Y("p:txBody",i("a:bodyPr"),i("a:lstStyle"),(e??"").split(`
|
|
3
|
-
`).map(d=>({runs:[{text:d}],level:0})),t)});return[o,n]}export function pptxParts(e){const{deck:t}=e,o=t.lang?.split("-").map((a,m)=>m===0?a.toLowerCase():a.toUpperCase()).join("-"),n=new Map,d=new mt,r=new ct,s=[],l=new R,f=[],g=new Map;let P=2147483648;const z=a=>{const m=t.slides.findIndex(x=>x.id===a);return m<0?void 0:`../slides/slide${String(m+1)}.xml`};t.masters.forEach((a,m)=>{const x=m+1,$=P++,y=`ppt/slideMasters/slideMaster${String(x)}.xml`,_=`ppt/theme/theme${String(x)}.xml`;n.set(_,
|
|
2
|
+
import{createHash as ge}from"node:crypto";import{zipSync as Ae}from"fflate";import{AUTOSHAPE_STYLE as Ne,colorOfFile as xe,spaceOfFile as ye,CONNECTOR_STYLE as Fe,isConnectorGeometry as re,joinPath as ne,placeholderFrame as ze,plainLevels as He,Pt as Ue,DEFAULT_TABLE_STYLE as Ge,TABLE_STYLES as Xe}from"@allyhub/slides-core";import{AUDIO_ICON as Ye}from"./audio-icon.js";import{chartBook as Je,chartXml as We}from"./charts.js";import{asFace as Ze,fontInfo as qe,eotOf as Ke}from"./fonts.js";import{NO_PARAGRAPHS as Ve,shapeXml as _e,treeXml as de}from"./shapes.js";import{bodyOfStyle as Qe,bodyProps as ie,bodyUnder as se,LINK as et,SLIDE_LINK as tt,SLIDE_NUMBER as nt,levelOf as be,listStyle as F,txBody as Y}from"./text.js";import{tableStyleXml as it}from"./table-styles.js";import{themeXml as ke}from"./theme.js";import{timingXml as at,transitionXml as ot}from"./timing.js";import{HEAD as v,NS as rt,PML as j,color as dt,el as i,esc as st,fill as Se,gradientFill as lt,unesc as we}from"./xml.js";const q={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",emf:"image/x-emf",wmf:"image/x-wmf"},$e={mp4:"video/mp4",m4v:"video/mp4",mov:"video/quicktime"},ve={mp3:"audio/mpeg",m4a:"audio/mp4",wav:"audio/wav",aac:"audio/aac"},M=e=>(e.split(".").pop()??"").toLowerCase(),pt=[["regular","p:regular","Regular"],["bold","p:bold","Bold"],["italic","p:italic","Italic"],["boldItalic","p:boldItalic","Bold Italic"]],c={hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",package:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",font:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",core:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",app:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",slideMaster:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster",slideLayout:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",slide:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",notesMaster:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster",notesSlide:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",video:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video",audio:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio",media:"http://schemas.microsoft.com/office/2007/relationships/media",presProps:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps",viewProps:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps",tableStyles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"},S={chart:"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",workbook:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",presentation:"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",slideMaster:"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",slideLayout:"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",slide:"application/vnd.openxmlformats-officedocument.presentationml.slide+xml",theme:"application/vnd.openxmlformats-officedocument.theme+xml",notesMaster:"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml",notesSlide:"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",presProps:"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml",viewProps:"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml",tableStyles:"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",core:"application/vnd.openxmlformats-package.core-properties+xml",app:"application/vnd.openxmlformats-officedocument.extended-properties+xml"};class R{list=[];linked(t,o){return t.replaceAll(new RegExp(`r:id="${et}([^"]*)"`,"gu"),(n,d)=>`r:id="${this.add(c.hyperlink,we(d),!0)}"`).replaceAll(new RegExp(`r:id="${tt}([^"]*)"`,"gu"),(n,d)=>{const r=o?.(we(d));return`r:id="${r===void 0?"":this.add(c.slide,r)}"`})}add(t,o,n=!1){const d=this.list.find(s=>s.type===t&&s.target===o);if(d)return d.id;const r=`rId${String(this.list.length+1)}`;return this.list.push({id:r,type:t,target:o,...n?{external:n}:{}}),r}xml(){return v+i("Relationships",{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},...this.list.map(t=>i("Relationship",{Id:t.id,Type:t.type,Target:t.target,TargetMode:t.external?"External":void 0})))}}class ct{list=[];add(t,o){return this.list.push({chart:t,frame:o}),`../charts/chart${String(this.list.length)}.xml`}}class mt{parts=new Map;byHash=new Map;add(t,o,n,d){const r=ge("sha256").update(t).digest("hex"),s=this.byHash.get(`${n}:${r}`);if(s)return s;const l=d?.split("/").pop()?.replace(/\.[^.]*$/u,"").replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,""),f=l===void 0||l===""?void 0:l;let g=`${f??`${n}${String(this.parts.size+1)}`}.${o}`;for(let P=2;this.parts.has(`ppt/media/${g}`);P++)g=`${f??n}-${String(P)}.${o}`;return this.parts.set(`ppt/media/${g}`,t),this.byHash.set(`${n}:${r}`,`../media/${g}`),`../media/${g}`}}function Me(e){return e.kind==="component"||e.kind==="movie"||e.kind==="audio"||e.kind==="item"?!1:e.kind==="picture"?q[M(e.media?.path??"")]!==void 0:!0}function le(e){return e.kind==="component"||e.kind==="movie"||e.kind==="item"?!0:e.kind==="picture"?q[M(e.media?.path??"")]===void 0:!1}export function picturedShapes(e){return e.slides.flatMap(t=>t.shapes.filter(o=>le(o)).map(o=>({key:`${t.id}/${o.name}`,slide:t.id,shape:o.name,frame:o.frame})))}export function filesOf(e){const t=new Set;for(const o of e.masters)for(const n of[...o.shapes,...o.layouts.flatMap(d=>d.shapes)])n.media&&Me(n)&&t.add(ne(n.media.base,n.media.path)),n.picture_fill&&t.add(ne(n.picture_fill.base,n.picture_fill.path));for(const o of e.slides){o.background_picture!==void 0&&t.add(o.background_picture);for(const n of o.shapes)n.media&&(n.kind==="picture"||n.kind==="movie"||n.kind==="audio")&&t.add(n.media.path),n.picture_fill&&t.add(n.picture_fill.path)}return[...t].sort()}const ft=i("p:nvGrpSpPr",{},i("p:cNvPr",{id:1,name:""}),i("p:cNvGrpSpPr"),i("p:nvPr")),ut=i("p:grpSpPr",{},i("a:xfrm",{},i("a:off",{x:0,y:0}),i("a:ext",{cx:0,cy:0}),i("a:chOff",{x:0,y:0}),i("a:chExt",{cx:0,cy:0}))),K=e=>i("p:spTree",{},ft,ut,...e),pe={bg1:"lt1",tx1:"dk1",bg2:"lt2",tx2:"dk2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink"},ae=e=>i("p:bg",{},i("p:bgPr",{},i("a:solidFill",{},dt(e)),i("a:effectLst")));function ht(e,t,o){if(e.background_picture!==void 0){const n=o(e.background_picture);if(n!==void 0)return i("p:bg",{},i("p:bgPr",{},i("a:blipFill",{dpi:0,rotWithShape:1},i("a:blip",{"r:embed":n}),i("a:srcRect"),i("a:stretch",{},i("a:fillRect"))),i("a:effectLst")))}return e.background_gradient?i("p:bg",{},i("p:bgPr",{},lt(e.background_gradient),i("a:effectLst"))):ce(e.background,t)?"":ae(e.background)}const ce=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Pe(e){return{...e.inner_shadow?{innerShadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.reflection?{reflection:e.reflection}:{},...e.soft_edges===void 0?{}:{softEdges:e.soft_edges},...e.pattern?{pattern:e.pattern}:{},...e.fill_transparency===void 0?{}:{fillTransparency:e.fill_transparency,...e.fill===void 0?{}:{fill:e.fill}},...e.gradient?{gradient:e.gradient}:{},...e.shadow===void 0?{}:{shadow:e.shadow}}}function Le(e,t,o,n,d){if(!e)return{};const r=n(e.path);return!r||q[M(e.path)]===void 0?(d(`${e.path} ${r?"is of a kind PowerPoint does not read":"is not in the project"}, so the file leaves the shape's picture fill out`),{}):{pictureFill:{image:t.add(c.image,o.add(r,M(e.path),"image",e.path)),...e.tile?{tile:e.tile}:{},...e.transparency===void 0?{}:{transparency:e.transparency}}}}function oe(e){const t=o=>({...e.fill===void 0||"fill"in o&&ce(e.fill,o.fill)?{}:{fill:e.fill},...e.line===void 0||ce(e.line,o.line)?{}:{line:e.line},...e.line_width===void 0||e.line_width===o.line_width?{}:{lineWidth:e.line_width}});return e.kind==="autoshape"?re(e.geometry)?{style:"connector",...t(Fe)}:{style:"shape",...t(Ne)}:{...e.kind==="textbox"?{fill:e.fill??null}:e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{lineWidth:e.line_width}}}const gt=(e,t)=>Array.from({length:Math.max(e.length,t.length)},(o,n)=>{const d=e[n]??{},r=t[n]??{},s={...d.font,...r.font};return{...d,...r,...Object.keys(s).length>0?{font:s}:{}}});function Ee(e,t,o,n,d,r,s,l){const f=n!==void 0&&d!==void 0&&JSON.stringify(n.text_styles.other)!==JSON.stringify(d.text_styles.other);return Y("p:txBody",ie(se(t,l),s,e==="autoshape"?{rtlCol:0}:{}),F(f?gt(n.text_styles.other,t.levels):t.levels),o,r,l)}const xt="{2D5ABB26-0587-4C30-8999-92F81FD0307C}",yt=[["left","a:lnL"],["right","a:lnR"],["top","a:lnT"],["bottom","a:lnB"]];function Ie(e,t){const o=new Map;return e.rows.forEach((n,d)=>{n.cells.forEach((r,s)=>{if(!r.spanned)for(let l=0;l<(r.span_height??1);l++)for(let f=0;f<(r.span_width??1);f++)(l>0||f>0)&&o.set(`${String(d+l)},${String(s+f)}`,{row:d,col:s})})}),i("a:tbl",{},i("a:tblPr",{firstRow:e.first_row?1:void 0,firstCol:e.first_col?1:void 0,lastRow:e.last_row?1:void 0,lastCol:e.last_col?1:void 0,bandRow:e.horz_banding?1:void 0,bandCol:e.vert_banding?1:void 0},i("a:tableStyleId",{},e.style??xt)),i("a:tblGrid",{},...e.columns.map(n=>i("a:gridCol",{w:n}))),...e.rows.map((n,d)=>i("a:tr",{h:n.height},...n.cells.map((r,s)=>{const l=r.text.own??r.text,f=Ce(r.fileText,r.text.style),g=r.spanned?o.get(`${String(d)},${String(s)}`):void 0;return i("a:tc",{gridSpan:r.span_width,rowSpan:r.span_height,hMerge:g&&s>g.col?1:void 0,vMerge:g&&d>g.row?1:void 0},Y("a:txBody",i("a:bodyPr"),i("a:lstStyle"),r.text.paragraphs,t,f),i("a:tcPr",{marL:l.margin_left,marR:l.margin_right,marT:l.margin_top,marB:l.margin_bottom,anchor:se(l,f).vertical_anchor},...yt.map(([P,z])=>{const H=r.borders?.[P];return H?i(z,{w:H.width},Se(H.color)):""}),r.fill===void 0?"":Se(r.fill)))}))))}const me=e=>e.group===void 0?{}:{group:e.group},V=e=>({...e.line_dash===void 0?{}:{lineDash:e.line_dash},...e.line_cap===void 0?{}:{lineCap:e.line_cap},...e.line_join===void 0?{}:{lineJoin:e.line_join},...e.line_compound===void 0?{}:{lineCompound:e.line_compound},...e.line_begin===void 0?{}:{lineBegin:e.line_begin},...e.line_end===void 0?{}:{lineEnd:e.line_end},...e.line_begin_size===void 0?{}:{lineBeginSize:e.line_begin_size},...e.line_end_size===void 0?{}:{lineEndSize:e.line_end_size}});function fe(e,t,o){return e.map(n=>{const d=n.kind==="cxn"?t.get(n.id)?.connect:void 0;if(!d)return n;const r=f=>{const g=f&&o(f.shape);return f&&g!==void 0?{id:g,idx:f.site}:void 0},s=r(d.begin),l=r(d.end);return s||l?{...n,connect:{...s?{begin:s}:{},...l?{end:l}:{}}}:n})}const Te=e=>new Map(e.map((t,o)=>[o+2,t])),De=e=>t=>e.find(o=>o.name===t)?.id;function Oe(e,t,o,n,d,r,s){const l={...Pe(e),...Le(e.picture_fill&&{...e.picture_fill,path:ne(e.picture_fill.base,e.picture_fill.path)},o,n,d,f=>{s.left(`${s.where} › ${e.name}: ${f}`)}),id:t,name:e.name,...e.frame?{frame:e.frame}:{},...e.rotation===void 0?{}:{rotation:e.rotation},...e.flip?{flip:e.flip}:{}};if(e.kind==="placeholder"&&e.placeholder){const f=s.on==="master"?{...ze(e.placeholder.type),...e.text}:e.text;return{...l,kind:"sp",placeholder:{...e.placeholder},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{lineWidth:e.line_width},...V(e),...e.fill===void 0&&e.line===void 0?{}:{geometry:e.geometry??"rect"},text:Y("p:txBody",f?ie(f):i("a:bodyPr"),F(f?.levels??[]),e.placeholder.type==="sldNum"?nt:Ve,r)}}if(Me(e)){if(e.table)return{...l,kind:"table",table:Ie(e.table,r)};if(e.kind==="picture"&&e.media){const f=ne(e.media.base,e.media.path),g=d(f);if(!g){s.left(`${s.where} › ${e.name}: ${f} is not in the project, so the file leaves the picture out`);return}return{...l,kind:"pic",picture:{image:o.add(c.image,n.add(g,M(e.media.path),"image",e.media.path))},descr:e.media.path.split("/").pop()??""}}return!e.path&&re(e.geometry)?{...l,kind:"cxn",geometry:e.geometry??"line",...e.adjustments?{adjustments:e.adjustments}:{},...oe(e),...V(e)}:{...l,kind:"sp",...e.kind==="textbox"?{textbox:!0}:{},...e.path?{path:e.path}:{geometry:e.geometry??"rect"},...e.adjustments?{adjustments:e.adjustments}:{},...oe(e),...V(e),...e.text?{text:Ee(e.kind,e.text,e.text.paragraphs,s.master,s.first,r)}:{}}}}function Ce(e,t){if(!e)return;const o=e.numbered!==void 0||e.bullet!==void 0&&e.bullet!==!1;return{font:{...e.size===void 0?{}:{size:Ue(e.size)},...e.bold===void 0?{}:{bold:e.bold},...e.italic===void 0?{}:{italic:e.italic},...e.underline===void 0?{}:{underline:e.underline},...e.strike===void 0?{}:{strike:e.strike},...e.caps===void 0?{}:{caps:e.caps},...e.font===void 0?{}:{name:e.font},...e.color===void 0?{}:{color:xe(e.color)}},paragraph:{...e.align===void 0?{}:{alignment:e.align},...e.line_spacing===void 0?{}:{line_spacing:{lines:e.line_spacing}},...e.space_before===void 0?{}:{space_before:ye(e.space_before)},...e.space_after===void 0?{}:{space_after:ye(e.space_after)},...e.bullet_color===void 0?{}:{bullet_color:xe(e.bullet_color)},...e.bullet_size===void 0?{}:{bullet_size:e.bullet_size},...e.start_at===void 0?{}:{start_at:e.start_at},...e.numbered!==void 0?{numbered:e.numbered}:e.bullet===void 0?{}:{bullet:e.bullet===!1?null:e.bullet}},...o&&t?{levels:t.levels.map(n=>({margin_left:n.margin_left,indent:n.indent}))}:{},...e.anchor===void 0?{}:{anchor:e.anchor},...e.orientation===void 0?{}:{orientation:e.orientation}}}function _t(e,t,o,n,d,r,s,l,f){const g=`${e.id}/${t.name}`,P=r.deck.fitted[g];if(t.level!=="slide"&&!le(t))return;const z=t.level==="slide"&&t.placeholder?{placeholder:{...t.placeholder}}:{},Q=!t.placeholder||t.sources.frame.from==="slide"||t.sources.frame.from==="code"?{frame:t.frame}:{},w={...Pe(t),...Le(t.picture_fill,n,d,r.file,u=>{r.left?.(`slide ${e.id} › ${t.name}: ${u}`)}),id:o,name:t.name,...z,...Q,...t.rotation===void 0?{}:{rotation:t.rotation},...t.flip?{flip:t.flip}:{},...t.alt===void 0?{}:{descr:t.alt},...t.locked?{locked:!0}:{},...t.link===void 0?{}:{link:t.link}},J=()=>{const u=r.pictures.get(g);return u?{image:n.add(c.image,d.add(u,"png","image"))}:void 0};if(t.table)return{...w,kind:"table",table:Ie(t.table,s)};if(t.chart)return{...w,frame:t.frame,kind:"chart",chart:n.add(c.chart,f.add(t.chart,t.frame))};const B=u=>r.left?.(`${g}: ${u}`);if(t.kind==="audio"&&t.media){const u=ve[M(t.media.path)]!==void 0,I=u?r.file(t.media.path):void 0;if(!I){B(u?`${t.media.path} is not in the project, so the file leaves the sound out`:`${t.media.path} is a sound PowerPoint does not play, so the file leaves it out`);return}const T=d.add(I,M(t.media.path),"media",t.media.path),D=t.media.playback;return l.push({spid:o,name:t.name,playback:D,sound:!0}),{...w,frame:t.frame,kind:"pic",picture:{image:n.add(c.image,d.add(Ye,"png","image"))},video:{link:n.add(c.audio,T),media:n.add(c.media,T),sound:!0,...D?.trim?{trim:D.trim}:{}}}}if(t.kind==="movie"&&t.media){const u=J(),I=$e[M(t.media.path)]!==void 0,T=I?r.file(t.media.path):void 0;if(!u){B("no picture of the video was drawn, so the file leaves it out");return}if(!T)return B(I?`${t.media.path} is not in the project, so the file holds the video's picture alone`:`${t.media.path} is a video PowerPoint does not play, so the file holds its picture alone`),{...w,frame:t.frame,kind:"pic",picture:u};const D=d.add(T,M(t.media.path),"media",t.media.path),E=t.media.playback;return l.push({spid:o,name:t.name,playback:E}),{...w,frame:t.frame,kind:"pic",picture:{image:u.image},video:{link:n.add(c.video,D),media:n.add(c.media,D),...E?.trim?{trim:E.trim}:{}}}}if(le(t)){const u=J(),I=r.movies?.get(g);if(u&&I){const T=d.add(I.bytes,"mp4","media");return l.push({spid:o,name:t.name}),{...w,frame:t.frame,kind:"pic",picture:{image:u.image},video:{link:n.add(c.video,T),media:n.add(c.media,T)}}}return u||B("no picture of it was drawn, so the file leaves it out"),u?{...w,frame:t.frame,kind:"pic",picture:u}:void 0}if(t.kind==="picture"&&t.media){const u=r.file(t.media.path);if(!u){B(`${t.media.path} is not in the project, so the file leaves the picture out`);return}return{...w,kind:"pic",picture:{image:n.add(c.image,d.add(u,M(t.media.path),"image",t.media.path)),...t.media.crop?{crop:t.media.crop}:{}},descr:t.alt??t.media.path.split("/").pop()??""}}if(!t.path&&re(t.geometry))return{...w,kind:"cxn",geometry:t.geometry??"line",...t.adjustments?{adjustments:t.adjustments}:{},...oe(t),...V(t)};const L=t.text,ee=r.deck.masters.find(u=>u.name===e.master),U=Ce(t.fileText,L?.style),W=L?t.placeholder?Y("p:txBody",ie(se({},U),P),i("a:lstStyle"),L.paragraphs,s,U):L.own?Ee(t.kind,L.own,L.paragraphs,ee,r.deck.masters[0],s,P,U):Y("p:txBody",ie(Qe(L.style),P),F(L.style.levels.map(be)),L.paragraphs,s):void 0,Z=t.sources.frame.from==="code",te=t.fill!==void 0&&(Z||t.sources.fill?.from==="slide"),A=t.line!==void 0&&(Z||t.sources.line?.from==="slide");return{...w,kind:"sp",...t.kind==="textbox"?{textbox:!0}:{},...t.path?{path:t.path}:!t.placeholder||te||A?{geometry:t.geometry??"rect"}:{},...t.adjustments?{adjustments:t.adjustments}:{},...V(t),...t.placeholder?{...te?{fill:t.fill}:{},...A?{line:t.line}:{},...t.line_width===void 0?{}:{lineWidth:t.line_width}}:oe(t),...W?{text:W}:{}}}const bt={cx:6858e3,cy:9144e3};function je(e,t){const o=_e({id:2,name:"Slide Image Placeholder 1",kind:"sp",placeholder:{type:"sldImg",idx:2},...e===void 0?{frame:{left:1143e3,top:685800,width:4572e3,height:3429e3}}:{}}),n=_e({id:3,name:"Notes Placeholder 2",kind:"sp",placeholder:{type:"body",idx:3,sz:"quarter"},...e===void 0?{frame:{left:685800,top:4343400,width:5486400,height:4114800}}:{},text:Y("p:txBody",i("a:bodyPr"),i("a:lstStyle"),(e??"").split(`
|
|
3
|
+
`).map(d=>({runs:[{text:d}],level:0})),t)});return[o,n]}export function pptxParts(e){const{deck:t}=e,o=t.lang?.split("-").map((a,m)=>m===0?a.toLowerCase():a.toUpperCase()).join("-"),n=new Map,d=new mt,r=new ct,s=[],l=new R,f=[],g=new Map;let P=2147483648;const z=a=>{const m=t.slides.findIndex(x=>x.id===a);return m<0?void 0:`../slides/slide${String(m+1)}.xml`};t.masters.forEach((a,m)=>{const x=m+1,$=P++,y=`ppt/slideMasters/slideMaster${String(x)}.xml`,_=`ppt/theme/theme${String(x)}.xml`;n.set(_,ke(t.theme)),s.push([_,S.theme]);const k=new R,C=[];a.layouts.forEach(b=>{const N=g.size+1,p=`ppt/slideLayouts/slideLayout${String(N)}.xml`;g.set(b,p);const h=new R;h.add(c.slideMaster,`../slideMasters/slideMaster${String(x)}.xml`);const O=b.shapes.flatMap((ue,Re)=>{const he=Oe(ue,Re+2,h,d,e.file,o,{master:a,first:e.deck.masters[0],on:"layout",where:`layout "${b.name}"`,left:Be=>e.left?.(Be)});return he?[{...he,...me(ue)}]:[]});n.set(p,v+i("p:sldLayout",{...j,...b.display_master_shapes===!1?{showMasterSp:0}:{},preserve:1},i("p:cSld",{name:b.name},b.background===void 0?"":ae(b.background),h.linked(K(de(fe(O,Te(b.shapes),De(O)))),z)),i("p:clrMapOvr",{},b.color_map&&Object.keys(b.color_map).length>0?i("a:overrideClrMapping",{...pe,...a.color_map,...b.color_map}):i("a:masterClrMapping")))),n.set(`ppt/slideLayouts/_rels/slideLayout${String(N)}.xml.rels`,h.xml()),s.push([p,S.slideLayout]),C.push(i("p:sldLayoutId",{id:P++,"r:id":k.add(c.slideLayout,`../slideLayouts/slideLayout${String(N)}.xml`)}))}),k.add(c.theme,`../theme/theme${String(x)}.xml`);const G=a.shapes.flatMap((b,N)=>{const p=Oe(b,N+2,k,d,e.file,o,{master:a,first:e.deck.masters[0],on:"master",where:`master "${a.name}"`,left:h=>e.left?.(h)});return p?[{...p,...me(b)}]:[]}),X=a.text_styles;n.set(y,v+i("p:sldMaster",j,i("p:cSld",{name:a.name},ae(a.background),k.linked(K(de(fe(G,Te(a.shapes),De(G)))),z)),i("p:clrMap",{...pe,...a.color_map}),i("p:sldLayoutIdLst",{},...C),i("p:txStyles",{},F(X.title,"p:titleStyle"),F(X.body,"p:bodyStyle"),F(X.other,"p:otherStyle")))),n.set(`ppt/slideMasters/_rels/slideMaster${String(x)}.xml.rels`,k.xml()),s.push([y,S.slideMaster]),f.push(i("p:sldMasterId",{id:$,"r:id":l.add(c.slideMaster,`slideMasters/slideMaster${String(x)}.xml`)}))});const H=t.slides.some(a=>a.notes!==void 0),Q=`ppt/theme/theme${String(t.masters.length+1)}.xml`;let w="";if(H){n.set(Q,ke(t.theme)),s.push([Q,S.theme]);const a=new R;a.add(c.theme,`../theme/theme${String(t.masters.length+1)}.xml`),n.set("ppt/notesMasters/notesMaster1.xml",v+i("p:notesMaster",j,i("p:cSld",{},ae("lt1"),K(je(void 0,o))),i("p:clrMap",pe))),n.set("ppt/notesMasters/_rels/notesMaster1.xml.rels",a.xml()),s.push(["ppt/notesMasters/notesMaster1.xml",S.notesMaster]),w=l.add(c.notesMaster,"notesMasters/notesMaster1.xml")}const J=[],B=new Map(t.masters.flatMap(a=>a.layouts.map(m=>[m.name,m]))),L=a=>{const m=new Set,x=t.slides[a];for(const[$,y]of[[t.slides[a-1],x],[x,t.slides[a+1]]])if($&&y&&y.transition?.type==="morph")for(const _ of $.shapes)_.level==="slide"&&y.shapes.some(k=>k.name===_.name)&&m.add(_.name);return m};t.slides.forEach((a,m)=>{const x=m+1,$=`ppt/slides/slide${String(x)}.xml`,y=new R,_=B.get(a.layout),k=_?g.get(_):void 0;k&&y.add(c.slideLayout,`../${k.slice(4)}`);const C=[],G=new Map,X=new Map;let b=1;const N=a.shapes.flatMap(p=>{const h=_t(a,p,++b,y,d,e,o,C,r);if(!h)return b--,[];G.set(p.name,h.id),X.set(h.id,p);const O=L(m).has(p.name)?{name:`!!${h.name}`}:{};return[{...h,...me(p),...O}]});if(a.notes!==void 0){const p=`ppt/notesSlides/notesSlide${String(x)}.xml`,h=new R;h.add(c.notesMaster,"../notesMasters/notesMaster1.xml"),h.add(c.slide,`../slides/slide${String(x)}.xml`),n.set(p,v+i("p:notes",j,i("p:cSld",{},K(je(a.notes,o))),i("p:clrMapOvr",{},i("a:masterClrMapping")))),n.set(`ppt/notesSlides/_rels/notesSlide${String(x)}.xml.rels`,h.xml()),s.push([p,S.notesSlide]),y.add(c.notesSlide,`../notesSlides/notesSlide${String(x)}.xml`)}n.set($,v+i("p:sld",{...j,show:a.hidden?0:void 0},i("p:cSld",{name:a.id},ht(a,_?.background??t.masters.find(p=>p.name===a.master)?.background,p=>{const h=e.file(p);if(h&&q[M(p)]!==void 0)return y.add(c.image,d.add(h,M(p),"image",p));e.left?.(`${a.id}: its background picture ${p} ${h?"is of a kind PowerPoint does not read":"is not in the project"}, so the slide has its layout's background`)}),y.linked(K(de(fe(N,X,p=>G.get(p)))),p=>{const h=t.slides.findIndex(O=>O.id===p);return h<0?void 0:`slide${String(h+1)}.xml`})),i("p:clrMapOvr",{},i("a:masterClrMapping")),ot(a.transition,a.advance),at(a.animations,C,p=>G.get(p),p=>a.shapes.find(h=>h.name===p)?.text!==void 0,t,new Map(a.shapes.flatMap(p=>{const h=e.movies?.get(`${a.id}/${p.name}`),O=(p.kind==="movie"||p.kind==="audio")&&p.media?e.lengths?.get(p.media.path):h?.seconds;return O===void 0?[]:[[p.name,O]]}))))),n.set(`ppt/slides/_rels/slide${String(x)}.xml.rels`,y.xml()),s.push([$,S.slide]),J.push(i("p:sldId",{id:256+m,"r:id":l.add(c.slide,`slides/slide${String(x)}.xml`)}))}),l.add(c.theme,"theme/theme1.xml"),l.add(c.presProps,"presProps.xml"),l.add(c.viewProps,"viewProps.xml"),l.add(c.tableStyles,"tableStyles.xml");const ee=new Map;let U=0;const W=(e.fonts??[]).flatMap(a=>{const m=pt.flatMap(([x,$,y])=>{const _=a[x]&&Ze(a[x],a.typeface,y),k=_&&qe(_);if(!_||!k)return[];const C=`fonts/font${String(++U)}.fntdata`;return ee.set(`ppt/${C}`,Ke(_,k,a.typeface,y)),[i($,{"r:id":l.add(c.font,C)})]});return m.length===0?[]:[i("p:embeddedFont",{},i("p:font",{typeface:a.typeface}),...m)]}),Z=W.length===0?"":i("p:embeddedFontLst",{},...W);n.set("ppt/presentation.xml",v+i("p:presentation",{...j,...Z===""?{}:{embedTrueTypeFonts:1},saveSubsetFonts:1},i("p:sldMasterIdLst",{},...f),w===""?"":i("p:notesMasterIdLst",{},i("p:notesMasterId",{"r:id":w})),i("p:sldIdLst",{},...J),i("p:sldSz",{cx:t.width,cy:t.height}),i("p:notesSz",bt),Z,e.deck.masters[0]?F(He(e.deck.masters[0]).map(be),"p:defaultTextStyle"):"",sectionsXml(t.slides))),n.set("ppt/_rels/presentation.xml.rels",l.xml()),s.push(["ppt/presentation.xml",S.presentation]),n.set("ppt/presProps.xml",v+i("p:presentationPr",j)),n.set("ppt/viewProps.xml",v+i("p:viewPr",j));const te=new Set([...t.slides.flatMap(a=>a.shapes),...e.deck.masters.flatMap(a=>[...a.shapes,...a.layouts.flatMap(m=>m.shapes)])].flatMap(a=>a.table?.style===void 0?[]:[a.table.style]));n.set("ppt/tableStyles.xml",v+i("a:tblStyleLst",{"xmlns:a":"http://schemas.openxmlformats.org/drawingml/2006/main",def:Ge},...Xe.filter(a=>te.has(a.id)).map(it))),s.push(["ppt/presProps.xml",S.presProps]),s.push(["ppt/viewProps.xml",S.viewProps]),s.push(["ppt/tableStyles.xml",S.tableStyles]),n.set("docProps/core.xml",v+i("cp:coreProperties",{"xmlns:cp":"http://schemas.openxmlformats.org/package/2006/metadata/core-properties","xmlns:dc":"http://purl.org/dc/elements/1.1/"},e.title===void 0?"":`<dc:title>${st(e.title)}</dc:title>`)),n.set("docProps/app.xml",v+i("Properties",{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},i("Application",{},"AllyHub"),i("Slides",{},String(t.slides.length)),i("Notes",{},String(t.slides.filter(a=>a.notes!==void 0).length)),i("HiddenSlides",{},String(t.slides.filter(a=>a.hidden).length)))),s.push(["docProps/core.xml",S.core]),s.push(["docProps/app.xml",S.app]);const A=new R;A.add(c.officeDocument,"ppt/presentation.xml"),A.add(c.core,"docProps/core.xml"),A.add(c.app,"docProps/app.xml");const u=new Map;r.list.forEach(({chart:a,frame:m},x)=>{const $=String(x+1),y=`ppt/charts/chart${$}.xml`,_=new R,k=`Microsoft_Excel_Sheet${$}.xlsx`;u.set(`ppt/embeddings/${k}`,Je(a)),n.set(y,We(a,m,_.add(c.package,`../embeddings/${k}`))),n.set(`ppt/charts/_rels/chart${$}.xml.rels`,_.xml()),s.push([y,S.chart])});const I=new Set([...d.parts.keys(),...u.keys()].map(M)),T=v+i("Types",{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},i("Default",{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}),i("Default",{Extension:"xml",ContentType:"application/xml"}),U>0?i("Default",{Extension:"fntdata",ContentType:"application/x-fontdata"}):"",...[...I].sort().map(a=>i("Default",{Extension:a,ContentType:a==="xlsx"?S.workbook:q[a]??$e[a]??ve[a]??"application/octet-stream"})),...s.map(([a,m])=>i("Override",{PartName:`/${a}`,ContentType:m}))),D=new TextEncoder,E=new Map;E.set("[Content_Types].xml",D.encode(T)),E.set("_rels/.rels",D.encode(A.xml()));for(const[a,m]of n)E.set(a,D.encode(m));for(const[a,m]of d.parts)E.set(a,m);for(const[a,m]of u)E.set(a,m);for(const[a,m]of ee)E.set(a,m);return E}const kt=new Date(1980,0,1);export function writePptx(e){const t={};for(const[o,n]of pptxParts(e))t[o]=[n,{level:/\.(png|jpe?g|gif|mp4|m4v|mov)$/u.test(o)?0:6,mtime:kt}];return Ae(t)}const St="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}";function wt(e,t){const o=ge("sha256").update(`${String(e)}:${t}`).digest("hex").toUpperCase();return`{${o.slice(0,8)}-${o.slice(8,12)}-4${o.slice(13,16)}-8${o.slice(17,20)}-${o.slice(20,32)}}`}export function sectionsXml(e){if(!e.some(o=>o.section!==void 0))return"";const t=[];return e.forEach((o,n)=>{(o.section!==void 0||t.length===0)&&t.push({name:o.section??"Default Section",ids:[]}),t.at(-1)?.ids.push(256+n)}),i("p:extLst",{},i("p:ext",{uri:St},i("p14:sectionLst",{"xmlns:p14":rt.p14},...t.map((o,n)=>i("p14:section",{name:o.name,id:wt(n,o.name)},i("p14:sldIdLst",{},...o.ids.map(d=>i("p14:sldId",{id:d}))))))))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{consoleAt as
|
|
2
|
+
import{consoleAt as l}from"@allyhub/piece/page";import{createEnv as v}from"@allyhub/image-draw/env";import{loadTextFonts as O}from"@allyhub/image-draw/fonts";import{pictureWaiter as S}from"@allyhub/image-draw/pictures";import{themeOver as $}from"@allyhub/slides-core";import{CLEAN_LOOK as E,SEEK_LIMIT as j,isGraphicLayer as C,lookCss as M,readPropsText as T}from"@allyhub/piece";import{themeCss as L}from"./draw.js";import{drawItemAlone as A,itemOfReference as I}from"./item.js";import{importDeck as P,loadStyles as K,lookTheme as N,moduleComponents as _,stageContext as D}from"./load.js";async function F(t){if(t.kind==="slides"){const n=await P(t);return{components:n.components,...n.theme===void 0?{}:{theme:n.theme}}}await K(t);const p=await import(t.module);return{components:_(p)}}export async function componentStage(t,p,n){const w=v(t,p,void 0,t.kind==="slides"?"slides":void 0),m=await F(t),u=t.looks?.clean??E,x={...M(u),...L($(N(t),m.theme))};document.documentElement.style.background="transparent",document.body.style.background="transparent";let h=[],d;const c=()=>{d?.out.dispose(),d=void 0;for(const e of h)l({phase:"mount",layer:e.layer.component},()=>{e.layer.unmount?.(e.el,e.layer.props,e.ctx)});h=[],n.replaceChildren()};return{async draw(e){if(!Object.hasOwn(m.components,e.name)&&I(t,e.name)){const o=JSON.stringify([e.name,e.width,e.height,e.t]);if(d?.asked===o)return{label:e.name,props:{}};Object.assign(n.style,{position:"relative",width:`${String(e.width)}px`,height:`${String(e.height)}px`,overflow:"hidden",background:"transparent"});const i=document.createElement("div");Object.assign(i.style,{position:"absolute",inset:"0px",visibility:"hidden"}),n.append(i);let r;try{r=await A(t,p,i,{of:e.name,width:e.width,height:e.height,t:Math.max(0,e.t)})}catch(s){throw i.remove(),s}return c(),n.append(i),i.style.visibility="",d={out:r,el:i,asked:o},{label:e.name,props:{}}}c();const a=m.components[e.name];if(!a)throw new Error(`There is no component ${e.name} in ${t.file} (it has ${Object.keys(m.components).join(", ")||"none"}).`);Object.assign(n.style,{position:"relative",width:`${String(e.width)}px`,height:`${String(e.height)}px`,overflow:"hidden",background:"transparent"});for(const[o,i]of Object.entries(x))n.style.setProperty(o,i);let y=e.props;if(t.kind==="doc"){const o=T(a,e.props);if(o.problems.length>0)throw new Error(o.problems.join("; "));y=o.props}const b=[],k=l({phase:"build"},()=>a.layers(y,{width:e.width,height:e.height,slide:""}));for(const[o,i]of k.entries()){if(!C(i))throw new Error(`${e.name}'s layers: item ${String(o+1)} is not a graphic layer (custom() or a component).`);const r=i,s=document.createElement("div");Object.assign(s.style,{position:"absolute",inset:"0px"}),n.append(s);const f=D({look:u,width:e.width,height:e.height,start:0,end:Math.max(e.t,0)+1,combo:w.combo,format:`${String(Math.round(e.width))}x${String(Math.round(e.height))}`,asset:g=>w.log.asset(g),wait:g=>b.push(g),report:()=>{}});h.push({layer:r,el:s,ctx:f}),l({phase:"mount",layer:r.component,index:o},()=>{r.mount(s,r.props,f)}),l({phase:"render",layer:r.component,index:o},()=>{r.render(s,Math.max(0,e.t),r.props,f)})}return await O(n),await Promise.all(b),await S(n)(j*1e3),{...a.label===void 0?{}:{label:a.label},props:a.props}},dispose:c}}
|