allyhub 0.15.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/commands/add.js +1 -1
- package/dist/commands/cloud-tools.js +1 -1
- package/dist/commands/dev.js +6 -2
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/inspect/common.js +3 -3
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/inspect/index.js +1 -1
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/inspect/uses.js +3 -0
- package/dist/commands/mail.js +6 -6
- package/dist/commands/render.js +1 -1
- package/dist/main.js +8 -8
- package/dist/node_modules/@allyhub/3d-extension/dist/cli/scenery-text.js +2 -2
- 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/file-check.d.ts +2 -2
- 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 +3 -2
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.d.ts +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.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/dist/work.d.ts +9 -1
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- 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-extension/skills/allyhub/references/canvas.md +2 -2
- 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/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.d.ts +12 -3
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.js +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/deletion.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/inputs.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -2
- 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/dist/inspect.js +1 -1
- 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/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +70 -11
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +15 -4
- package/dist/node_modules/@allyhub/formats/dist/layout.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/dist/index.js +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/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/workspace.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +3 -3
- 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/dist/load.js +2 -2
- 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-extension/skills/allyhub/references/linkedin.md +1 -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/LICENSE +241 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/data/leads.csv +5 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +19 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/briefs/launch.docx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/decks/pitch.pptx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/data/plans.xlsx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +10 -0
- package/dist/node_modules/@allyhub/office-extension/package.json +124 -0
- 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 +53 -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 +10 -11
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/blobs.d.ts +9 -0
- package/dist/node_modules/@allyhub/protocol/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.d.ts +77 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +39 -9
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +15 -15
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +441 -5
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +4 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +5 -5
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +45 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.d.ts +134 -0
- package/dist/node_modules/@allyhub/protocol/dist/paywall.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/dist/purposes.d.ts +47 -0
- package/dist/node_modules/@allyhub/protocol/dist/purposes.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +52 -5
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.d.ts +34 -0
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/sites.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +21 -52
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.d.ts +264 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.d.ts +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.d.ts +97 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +3 -2
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +26 -20
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/turns.d.ts +71 -0
- package/dist/node_modules/@allyhub/protocol/dist/turns.js +2 -0
- 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/dist/index.js +4 -4
- 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/dist/cli/sheet.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +3 -3
- 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/cli/slides.js +2 -2
- 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 +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/audio-icon.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +5 -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/dist/slide-css.js +20 -0
- 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/dist/runtime/stage.html +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.js +2 -2
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +20 -20
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/doc.js +17 -2
- package/dist/node_modules/@allyhub/telemetry/dist/level.js +2 -2
- package/dist/node_modules/@allyhub/telemetry/dist/levels.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/scrub.js +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/markup.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/archive/assets.zip +0 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/markup.json +10 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +35 -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/dist/cli/reference-text.js +3 -3
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -2
- 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-extension/skills/allyhub/references/x.md +1 -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 -12
- package/dist/project.js +1 -1
- package/dist/telemetry.js +3 -3
- package/dist/text/console-text.js +2 -2
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-9z0ZEYUq.js → abnfDiagram-WEYOIA3C-CHNpVSPv.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-ELMO_PA6.js → architecture-WOLXFQ4H-gPsJqQwV.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-C0yuCWU3.js → architectureDiagram-ZHVYKT53-CEIDcC6r.js} +1 -1
- package/editor-web/assets/arrow-down-B8VUPCGi.js +1 -0
- package/editor-web/assets/arrow-up-Ds4juY8X.js +1 -0
- package/editor-web/assets/article-BHTjq0_Y.js +3 -0
- package/editor-web/assets/article-DfELjJ2o.js +7 -0
- package/editor-web/assets/{audio-lines-1s1eRs4Q.js → audio-lines-PZj77e7t.js} +1 -1
- package/editor-web/assets/bar-button-J9vbfzTx.js +1 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-vi6JOg4o.js → blockDiagram-RJAE7QA3-CUzEGVet.js} +4 -4
- package/editor-web/assets/browser-C1XuTMlp.js +1 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-Agf_H8uS.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-amT4lgX3.js +2 -0
- package/editor-web/assets/chart-file-CfbWK9l1.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-CJmeYOSo.js → chart-no-axes-column-Be0lFcGF.js} +1 -1
- package/editor-web/assets/{chunk-2E7WHVMD-XalaZaha.js → chunk-2E7WHVMD-DFYo_Boi.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-DUlRZkCS.js → chunk-4EMNKR2T-CLLjmweX.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-DTa7whGr.js → chunk-55XCU76K-CkwQ_3m1.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-85zCPzj0.js → chunk-7S6XSTFO-V-AvHpAB.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-CWBseIyh.js → chunk-AQDTSKZB-PjHyYpb8.js} +1 -1
- package/editor-web/assets/chunk-DSNLSHJZ-QaczBS3J.js +127 -0
- package/editor-web/assets/{chunk-HAGFOTED-DFWda2Rk.js → chunk-HAGFOTED-aLaQB5Xu.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-aXibFitC.js → chunk-HNE4Q36P-De3ftDQR.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CtJUuFdN.js → chunk-NQOKRVIF-CrhVQyvP.js} +17 -17
- package/editor-web/assets/{chunk-UHW7PFBP-B6QKSKWE.js → chunk-UHW7PFBP-BFmZ5ZLn.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-CF6Al55P.js → chunk-VQ5W62QI-CzppUHLA.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-w2TKLkyw.js → chunk-WQQL4CDK-BrAU7V6v.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-DVGOATM3.js → chunk-YZO67HFG-BSiF71qj.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-Cq7MMjDP.js → chunk-ZAUX2LTX-BJc4r5b1.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-GMW_lBh4.js → chunk-ZCHMQSOR-CkGTuehB.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-C7AK5Bkj.js → classDiagram-v2-4MYWR3UA-Byxc7J88.js} +7 -7
- package/editor-web/assets/code-CD-CbJG9.js +1 -0
- package/editor-web/assets/collaborator-BU4qU7O3.js +1 -0
- package/editor-web/assets/{copy-DvOiv9Ra.js → copy-CuJSs0nI.js} +1 -1
- package/editor-web/assets/{createLucideIcon-REX213UO.js → createLucideIcon-lm_6n8YT.js} +1 -1
- package/editor-web/assets/csv-Bwre9FdI.js +11 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-ZnDieQsN.js → cynefin-EF2NZ3EQ-BSxkVbdf.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-BrukKIBF.js → cynefinDiagram-WF24UDRP-IkCgARNs.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-DfO0S2p_.js → dagre-NK4GIZVX-9PgeH6nY.js} +1 -1
- package/editor-web/assets/deck-tTzKONci.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-D43RLesi.js → diagram-CBK3MWTC-DRzeg3Ds.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-bA1B1QQG.js → diagram-I5XIIV2D-B_zeKMN6.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-DAdXBD2K.js → diagram-ODIL2UCW-FFm0O8SN.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-C_KyEaws.js → diagram-PFBEJUXE-DrtCT8OA.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-oXTtENF7.js → diagram-RJA3I4VV-DtxJ3V0q.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Czupe6mO.js → diagram-TYUNFSNR-DmxF_8H_.js} +16 -16
- package/editor-web/assets/dist-BEpzsYn_.js +6 -0
- package/editor-web/assets/dist-BUD4ywMB.js +18 -0
- package/editor-web/assets/{dist-BrGYx10E.js → dist-Bd8IxQPP.js} +1 -1
- package/editor-web/assets/dist-C21CkR7Z.js +531 -0
- package/editor-web/assets/dist-C56mWAec.js +5 -0
- package/editor-web/assets/dist-CAb3W9_P.js +43 -0
- package/editor-web/assets/dist-CEknsRDd.js +24 -0
- package/editor-web/assets/dist-CbZAznNW.js +19 -0
- package/editor-web/assets/{dist-2lNSE-G_.js → dist-D3C6FyrO.js} +1 -1
- package/editor-web/assets/dist-DDzjbKIg.js +4 -0
- package/editor-web/assets/dist-DaEbElXI.js +3 -0
- package/editor-web/assets/dist-Dr3o4vee.js +1 -0
- package/editor-web/assets/{dist-BtRMClDw.js → dist-DruvDNQe.js} +1 -1
- package/editor-web/assets/dist-JLyDtl9X.js +1 -0
- package/editor-web/assets/dist-PBbWAsrV.js +17 -0
- package/editor-web/assets/dist-ZZlQa66J.js +1 -0
- package/editor-web/assets/dist-bQKpw3Zz.js +16 -0
- package/editor-web/assets/dist-d4dayaWE.js +17 -0
- package/editor-web/assets/docx-draw-9Q_fArBC.js +4 -0
- package/editor-web/assets/docx-preview-pcg9ioe3.js +21 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BOhNZmtp.js → ebnfDiagram-V4P3TTPT-DSX1Aoty.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-DoZH3OoE.js → elk-QONTBCTQ-C7gy9q56.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bv0KDJi4.js → erDiagram-KYQIGQAA-CKx_HoY4.js} +2 -2
- package/editor-web/assets/esm-BZb5QMQf.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-C-_xzqfj.js → eventmodeling-K75KTNOO-DL4HvSrd.js} +1 -1
- package/editor-web/assets/{file-exclamation-point-C_fX4fpI.js → file-exclamation-point-_L3ElCJ5.js} +1 -1
- package/editor-web/assets/file-question-mark-DlIjUK37.js +1 -0
- package/editor-web/assets/flowDiagram-IUGLLWBU-BUnRtJ8q.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CAuJlaZX.js → ganttDiagram-R7GPNTJY-N-AP4slN.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-Dx2xLi5C.js → gitGraph-VSP46ZUC-BKRGJKWm.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DHsk_UOT.js → gitGraphDiagram-PDYL7XHY-ClwL7w2_.js} +1 -1
- package/editor-web/assets/{group-pebHQTdP.js → group-BdrTp7gi.js} +1 -1
- package/editor-web/assets/hint-rlht0uxG.js +1 -0
- package/editor-web/assets/index-BedbINE5.css +2 -0
- package/editor-web/assets/index-DG2nHq4D.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-CnKQHx5m.js → info-OHQRW6UA-DpcY8t23.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-ibAVFw_2.js → infoDiagram-MVDRKAX5-ChtmtWni.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-C1OCHt3y.js → ishikawaDiagram-HPEHV2GE-BZNTuG_F.js} +1 -1
- package/editor-web/assets/iso-ahTwmFwH.js +56 -0
- package/editor-web/assets/{italic-CtlNOXN9.js → italic-zw4_eUNF.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BDdqMOM1.js → journeyDiagram-BOSHW7O7-C3uVmZbL.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-CSAS_zGn.js → kanban-definition-FNSA4HC5-puEhftGG.js} +4 -4
- package/editor-web/assets/{link-CW2KxKT_.js → link-DopSU3aa.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-DTLyYXbn.js → mermaid-parser.core-Bw8re-WE.js} +3 -3
- package/editor-web/assets/mermaid.core-Cc2GIqBr.js +44 -0
- package/editor-web/assets/{mindmap-definition-6OY57UG3-DSWHcglH.js → mindmap-definition-6OY57UG3-C6MUl_S_.js} +3 -3
- package/editor-web/assets/minus-CbPnUIOy.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-_k1BF29s.js → packet-JDAUHWVQ-C75RnvC5.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-B22YyWAa.js → pegDiagram-ECIUJNBX-ChjmsdV4.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-CSwV32hj.js → pie-XZMESJXO-BaKxJQpj.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-rSFNeWnq.js → pieDiagram-GNMPY74T-CT2ez8pr.js} +1 -1
- package/editor-web/assets/progress-CwKcXARv.js +6 -0
- package/editor-web/assets/props-form-D5oKHfpk.js +1 -0
- package/editor-web/assets/purify.es-B9ve_eFf.js +3 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-Xrntfg4j.js → quadrantDiagram-D57K4MC3-BJItlTfk.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-Dwq5qiNw.js → radar-ABXABTNO-DnLzBlTo.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-sIUGWcZh.js → railroad-I3PHUGI6-D5hj6Yv3.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-1rWlT9BX.js → railroad-abnf-LNEFI6M7-DUZlZoPu.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DWdkzEHc.js → railroad-ebnf-DWYD2UWJ-CDyyDC6d.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CME0JBbV.js → railroad-peg-JR7BVNR7-CC3ImNnT.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-Ch4BpP22.js → railroadDiagram-Y72NRBL7-Bjw-8Se5.js} +1 -1
- package/editor-web/assets/{react-Bk7NnOLX.js → react-Edyoga_4.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-CgE-x3wN.js → requirementDiagram-EQYSW5RA-CDFnuEIO.js} +1 -1
- package/editor-web/assets/row-C_svyL8o.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-DBf4G6n3.js → sankeyDiagram-SY24JHO5-CQPVLY1w.js} +1 -1
- package/editor-web/assets/schemas-moE_A7Nj.js +1 -0
- package/editor-web/assets/{scissors-BURkYWPv.js → scissors-B_xOiUhd.js} +1 -1
- package/editor-web/assets/{search-jKDvFIEU.js → search-Ba2BbT6T.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-Bz07CoUS.js → sequenceDiagram-BLEHNHQU-BQzuLmBX.js} +1 -1
- package/editor-web/assets/{session-CUCSWPTE.js → session-s1I85rox.js} +1 -1
- package/editor-web/assets/{sigma-CY2Chbro.js → sigma-DSUsJhMn.js} +1 -1
- package/editor-web/assets/slides-oQ_C0SVJ.js +1 -0
- package/editor-web/assets/snapshots-BPJKywuN.js +1 -0
- package/editor-web/assets/{sound-DUCxe9eC.js → sound-bTlco_K3.js} +1 -1
- package/editor-web/assets/split-7CVjIkSU.js +3 -0
- package/editor-web/assets/square-arrow-out-up-right-DF5dvsSp.js +1 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DuqAmDPP.js → stateDiagram-v2-A6IESKWZ-DOuageUf.js} +7 -7
- package/editor-web/assets/{sticky-note-C5qUDHhC.js → sticky-note-BdkIu5_D.js} +1 -1
- package/editor-web/assets/{strikethrough-DP-7tMz0.js → strikethrough-BwXWi4zg.js} +1 -1
- package/editor-web/assets/surface-DtCjIlrq.js +1 -0
- package/editor-web/assets/svg-CWIBMIQ9.js +1 -0
- package/editor-web/assets/swatch-DhztHwPU.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-C7sOL6rB.js → swimlanes-B3ENRKFQ-CXKkok7X.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-C3Car2M0.js +8 -0
- package/editor-web/assets/switch-8MU4Nfxe.js +1 -0
- package/editor-web/assets/{syntax-DSsHrzWF.js → syntax-CU_WPKxt.js} +1 -1
- package/editor-web/assets/{table-CTjNpE4W.js → table-DRbddzx0.js} +1 -1
- package/editor-web/assets/tabs-CiF1N-pL.js +1 -0
- package/editor-web/assets/tag-CIfWT8B_.js +1 -0
- package/editor-web/assets/text-align-start-Cic2-TLh.js +1 -0
- package/editor-web/assets/textarea-D7TnPwv1.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-CaLYz9mc.js → timeline-definition-JXYKGLGB-DgAjAeZp.js} +3 -3
- package/editor-web/assets/{treeView-D4JQ5SDB-D1P1Kyxc.js → treeView-D4JQ5SDB-C0Xvnhck.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-2YaFL53t.js → treemap-SAJKECNS-aXfKAeSX.js} +1 -1
- package/editor-web/assets/{undo-2-DUGGyBdX.js → undo-2-C47jrRp5.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-uYdbUhUS.js → usecaseDiagram-WPOLBNNX-CvUlBa-L.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DHepmX4t.js → vennDiagram-Q3Y3IDCW-qMJ1iCxs.js} +3 -3
- package/editor-web/assets/{video-Xl-OaXRc.js → video-DQrjo1TI.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-Dx0MOPV1.js → wardley-7MLQ67FV-DEdnH0by.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BX8ElwDW.js → wardleyDiagram-IVAIDKWA-Bt-B2hQ5.js} +1 -1
- package/editor-web/assets/{whole-word-6DliXke2.js → whole-word-D3ZAtnkw.js} +1 -1
- package/editor-web/assets/{words-B2FXYyeZ.js → words-0Ww2RyT4.js} +1 -1
- package/editor-web/assets/{words-DFIhHhHF.js → words-XlXG79Ur.js} +1 -1
- package/editor-web/assets/workbook-FSSUiIp9.js +45 -0
- package/editor-web/assets/x-DlhyIKuu.js +41 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DoWQRJUS.js → xychartDiagram-4URNHDU4-DV4bSzTb.js} +1 -1
- package/editor-web/assets/{zoom-in-C4lxmIDE.js → zoom-in-PgsC94hP.js} +1 -1
- package/editor-web/index.html +8 -6
- package/package.json +2 -2
- package/editor-web/assets/arrow-down-DzZjFrBL.js +0 -1
- package/editor-web/assets/arrow-up-hdmh9LVD.js +0 -1
- package/editor-web/assets/article-DHFgHYjv.js +0 -3
- package/editor-web/assets/article-Dt9id9Y9.js +0 -7
- package/editor-web/assets/button-BVQH7zxz.js +0 -41
- package/editor-web/assets/calc-worker-jImBXoeb.js +0 -45
- package/editor-web/assets/channel-Dkg198L0.js +0 -1
- package/editor-web/assets/chart-BC3kUUDD.js +0 -2
- package/editor-web/assets/chunk-DSNLSHJZ-BFnyvrWg.js +0 -129
- package/editor-web/assets/code-BID_OoRp.js +0 -1
- package/editor-web/assets/collaborator-2qfw-8OJ.js +0 -1
- package/editor-web/assets/dist-5HNrQ9AU.js +0 -45
- package/editor-web/assets/dist-BPecIPz6.js +0 -530
- package/editor-web/assets/dist-BXJKASX4.js +0 -24
- package/editor-web/assets/dist-BeDRTqQ8.js +0 -38
- package/editor-web/assets/dist-BlL-4sl3.js +0 -43
- package/editor-web/assets/dist-BuqBg8k8.js +0 -1
- package/editor-web/assets/dist-BwW08gSh.js +0 -1
- package/editor-web/assets/dist-C30Thvb3.js +0 -1
- package/editor-web/assets/dist-Cj5AmpVb.js +0 -5
- package/editor-web/assets/dist-CjjnDOa8.js +0 -3
- package/editor-web/assets/dist-D7ur8721.js +0 -6
- package/editor-web/assets/dist-DOHhp09C.js +0 -4
- package/editor-web/assets/dist-LhFEYZza.js +0 -16
- package/editor-web/assets/flowDiagram-IUGLLWBU-C7ZmHJZW.js +0 -1
- package/editor-web/assets/hint-mQB8slJ2.js +0 -1
- package/editor-web/assets/index-BGAXezRR.js +0 -28
- package/editor-web/assets/index-Br4a-QEv.css +0 -2
- package/editor-web/assets/mermaid.core-B8478wZ1.js +0 -44
- package/editor-web/assets/minus-D1tgAHbU.js +0 -1
- package/editor-web/assets/progress-udl4pNsP.js +0 -6
- package/editor-web/assets/props-form-B6mYjTgZ.js +0 -1
- package/editor-web/assets/row-dgHEAE7h.js +0 -1
- package/editor-web/assets/schemas-B89k2jEC.js +0 -1
- package/editor-web/assets/slides-BdaWgL_N.js +0 -1
- package/editor-web/assets/snapshots-CTS2iez5.js +0 -56
- package/editor-web/assets/split-mDSkdQkd.js +0 -3
- package/editor-web/assets/surface-D9qJjJQL.js +0 -1
- package/editor-web/assets/svg-nJtFNJ-7.js +0 -1
- package/editor-web/assets/swatch-S8YuBYyj.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CQ2aWYP-.js +0 -8
- package/editor-web/assets/switch-D5kPl2jO.js +0 -1
- package/editor-web/assets/tabs-C0AHyuE5.js +0 -1
- package/editor-web/assets/textarea-mzr9Kfuf.js +0 -1
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/slides-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./tools": {
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
"name": "slides import",
|
|
219
|
-
"summary": "Makes a deck of a PowerPoint file: its masters and layouts as the deck's module, its slides and its words and notes as the files the module names, its pictures and videos beside them, listed in allyhub.yaml;
|
|
219
|
+
"summary": "Makes a deck of a PowerPoint file: its masters and layouts as the deck's module, its slides and its words and notes as the files the module names, its pictures and videos beside them, listed in allyhub.yaml; lists each difference from the file; writes new files alone (--to names another module)",
|
|
220
220
|
"work": "decks",
|
|
221
221
|
"module": "./dist/cli/index.js"
|
|
222
222
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export const AUDIO_ICON=Uint8Array.from(
|
|
2
|
+
export const AUDIO_ICON=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAACXElEQVR42u2dwXGEMAxFtwNK2BIoISXkzIkSKIESKMElUAIlUAIlUAKBGcgkOyTIxqwEvMO/7IExeli2ZUn7yLLsgfSEEQAAAAQAACAAAAABAAAIAABAAAAAAgAAEAC+lY6qRw2z6vk3ALxBn6P6H8Zf1CtDcLMuDaBcMfzwMhO0jL+MwV0RQPLicv6TpvEXVVcCMLmVVmj8wYDxF+VXAPCXv7cAwG2MI2hNOpO/1wSQC8fSnhGAj7+3PAOC1oOz+XvtNUD6oaRnABDi77UBJMIPprUOoIxgeK1taCr8cHKLAPb6ewsAJhWCcXXz+5oBEMPfWwEwqRGMrbQCIJa/twTgKZwF6gDKgwyvDUD6brkWgCP8/REAXGgYYX7Hfs+OSBp/t6xYh6v8wFmQ+gBID/TXlgC4SPcLyZ7T8Z7T3pkBuFixHGGYovMBMFwcgNu7dVzRR6gbuhsAib/u5y2mL4Ru47kFAOSxnJBrxmrjmQ0A5JuMXhJGWDlseo/1jgCksZwi4Lne68BdAUh8dsiOqPE9Fd8ZgOSa8Rl5HSgB8Ft9FiGm7+HaagD4nQmqyOeBBgB+bqiJDKAFgJ/BugN2QgDYYzAAAAAAAAAAizAA2IZyEOMgRiiCYBzBOMLRXMhwIcOVJJfyXMqTlkJiVqzELFITlVMTSc5VTs4lPV05PZ0CDQMFGpQoXaBEiSI9I0V6lKlSqE2hNq0KaNZBsw7a1dCwiYZNtCyjaR9N+2hbSeNWGrfSupjm3TTvpn09f+AAAABgBAAAAAEAAAgAAEAAAAACAAAQAACAAHALfQGGT9bymuye2AAAAABJRU5ErkJggg=="),A=>A.charCodeAt(0));
|
|
@@ -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,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/slides-pptx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"default": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./read": {
|
|
11
|
+
"types": "./dist/read/index.d.ts",
|
|
12
|
+
"default": "./dist/read/index.js"
|
|
9
13
|
}
|
|
10
14
|
},
|
|
11
15
|
"sideEffects": false,
|
|
@@ -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}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{adjustmentDefaults as Q,cellLook as X,chartDrawing as tt,colorRgb as et,CONNECTOR_STYLE as nt,DECK_FONTS as it,EMU_PER_PT as k,Inches as ot,isConnectorGeometry as rt,LINE_DEFAULTS as $,mappedColors as st,Pt as at,bulletLookOver as lt,numberText as dt,runLang as ct,SINGLE_SPACING as E,spaceLength as I,PATTERN_CELL as j,patternPath as ut,tableStyleOf as ft}from"@allyhub/slides-core";import{presetOutline as H}from"@allyhub/ooxml/geometry";export const SHAPE_ATTR="data-ak-shape",LINE_WIDTH=at(.75);export{E as SINGLE_SPACING};export const MIN_FONT_SCALE=.25;export function themeCss(e){const t={};for(const[i,o]of Object.entries(e.colors))t[`--ak-theme-${i}`]=o;return t["--ak-theme-major"]=v(e.fonts.major,O),t["--ak-theme-minor"]=v(e.fonts.minor,O),t["--ak-theme-major-ea"]=v(e.fonts.major_east_asian,M),t["--ak-theme-minor-ea"]=v(e.fonts.minor_east_asian,M),t}const M='"Noto Sans SC", sans-serif',O=`"${it.minor}", ${M}`,v=(e,t)=>e.includes(",")||e.includes('"')?e:`"${e}", ${t}`;export const colorCss=(e,t)=>e==null?"transparent":et(e,t);const
|
|
3
|
-
`),n)){if(!f.ea){m.append(f.text);continue}const b=document.createElement("span");b.style.fontFamily=S,b.textContent=f.text,m.append(b)}p.append(m)}e.append(p)})}export const isCjk=e=>e!==void 0&&/^(zh|ja|ko)(-|$)/iu.test(e);function A(e,t,i,o,r){const{style:n}=e,s=n.auto_size==="shape"&&n.orientation==="horz",l=document.createElement("div");l.dataset.akText="",l.dataset.akAutofit=n.auto_size,n.orientation!=="horz"&&(l.dataset.akOrientation=n.orientation);const c=s?void 0:r;Object.assign(l.style,{position:s?"relative":"absolute",inset:s?"auto":c?`${String(c.top)}px calc(100% - ${String(c.right)}px) calc(100% - ${String(c.bottom)}px) ${String(c.left)}px`:"0px",minHeight:c?`${String(c.bottom-c.top)}px`:"100%",display:"flex",flexDirection:"column",justifyContent:pt[n.vertical_anchor],padding:`${String(n.margins.top*t)}px ${String(n.margins.right*t)}px ${String(n.margins.bottom*t)}px ${String(n.margins.left*t)}px`,whiteSpace:n.word_wrap?"pre-wrap":"pre",overflowWrap:"break-word",boxSizing:"border-box",...orientationCss(n.orientation)});const u=document.createElement("div");if(u.dataset.akBody="",l.append(u),xt(u,e,t,i,o),!n.word_wrap){Object.assign(u.style,{display:"flex",flexDirection:"column"});for(const p of u.children){if(!(p instanceof HTMLElement))continue;const d=p.style.textAlign;Object.assign(p.style,{inlineSize:"max-content",minInlineSize:"100%",boxSizing:"border-box",alignSelf:d==="center"?"center":d==="end"?"flex-end":"flex-start"})}}return i!==void 0&&(l.lang=i),isCjk(i)&&(l.dataset.akCjk=""),l}export function orientationCss(e){switch(e){case"horz":return{writingMode:"horizontal-tb",textOrientation:"mixed"};case"vert":return{writingMode:"sideways-rl",textOrientation:"mixed"};case"vert270":return{writingMode:"sideways-lr",textOrientation:"mixed"};case"eaVert":return{writingMode:"vertical-rl",textOrientation:"mixed"};case"wordArtVert":return{writingMode:"vertical-lr",textOrientation:"upright"};case"wordArtVertRtl":return{writingMode:"vertical-rl",textOrientation:"upright"};case"mongolianVert":return{writingMode:"vertical-lr",textOrientation:"mixed"}}}export function fitText(e){const t=e.querySelector("[data-ak-body]");if(!t||e.dataset.akAutofit!=="text")return 1;const i=e.dataset.akOrientation!==void 0,o=getComputedStyle(e),r=i?e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight):e.clientHeight-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom),n=c=>(e.style.setProperty("--ak-fit",String(c)),hangLabels(e),(i?t.scrollWidth:t.scrollHeight)<=r+.5);if(n(1))return delete e.dataset.akFontScale,1;let s=MIN_FONT_SCALE,l=1;if(!n(s))return e.dataset.akFontScale=s.toFixed(2),s;for(;l-s>.01;){const c=(s+l)/2;n(c)?s=c:l=c}return n(s),e.dataset.akFontScale=s.toFixed(2),s}function C(e,t,i,o){const r=e.split(" "),n=[],s=l=>{const c=Number(r[l]),u=Number(r[l+1]);return[o?.h?t-c:c,o?.v?i-u:u]};for(let l=0;l<r.length;){const c=r[l++];c==="M"||c==="L"?(n.push({op:c,at:[s(l)]}),l+=2):c==="C"?(n.push({op:c,at:[s(l),s(l+2),s(l+4)]}),l+=6):c==="Z"&&n.push({op:c})}return n}const N=e=>e.map(t=>t.op==="Z"?"Z":`${t.op}${t.at.map(([i,o])=>`${String(i)} ${String(o)}`).join(" ")}`).join(" ");function wt(e,t){const i=e.flatMap(n=>n.op==="Z"?[]:n.at),o=t?[...i].reverse():i,r=o[0];if(r)for(const n of o.slice(1)){const s=Math.hypot(r[0]-n[0],r[1]-n[1]);if(s>1e-6)return{at:r,out:[(r[0]-n[0])/s,(r[1]-n[1])/s]}}}function vt(e,t,i,o){const r=e.filter(l=>l.op!=="Z"),n=t?r[r.length-1]:r[0];if(!n)return;const s=t?n.at.slice(n.op==="C"?-2:-1):[...n.at,...r[1]?.op==="C"?r[1].at.slice(0,1):[]];for(const l of s)l[0]+=i,l[1]+=o}function $t(e,t,i,o,r){if(t.line===null)return;const n=t.frame.width*i,s=t.frame.height*i,l=(H(t.geometry??"line",n,s,t.adjustments)?.paths??[]).filter(m=>m.stroke).map(m=>C(m.d,n,s,t.flip)),c=l[0],u=l[l.length-1];if(!c||!u)return;const p="http://www.w3.org/2000/svg",d=document.createElementNS(p,"svg");d.setAttribute("width",String(Math.max(n,1))),d.setAttribute("height",String(Math.max(s,1))),Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"});const a=colorCss(t.line??nt.line,r),g=U(t,c,u,o,i,a);for(const m of l){const S=document.createElementNS(p,"path");S.setAttribute("d",N(m)),S.setAttribute("fill","none"),D(S,t,a,o),d.append(S),G(d,S,t,o,!1)}d.append(...g),e.append(d)}const At={flat:"butt",rnd:"round",sq:"square"};function D(e,t,i,o){e.setAttribute("stroke",i),e.setAttribute("stroke-width",String(o)),e.setAttribute("stroke-linecap",At[t.line_cap??$.cap]);const r=t.line_join??$.join;e.setAttribute("stroke-linejoin",r),r==="miter"&&e.setAttribute("stroke-miterlimit","8");const n=Et(t.line_dash,o,t.line_cap);n&&e.setAttribute("stroke-dasharray",n)}const P={dbl:[1/3,1/3,1/3],thickThin:[.6,.2,.2],thinThick:[.2,.2,.6],tri:[1/6,1/6,2/6,1/6,1/6]};let _t=0;function G(e,t,i,o,r){const n=i.line_compound;if(n===void 0||n==="sng")return;const s=t.getAttribute("d")??"",l="http://www.w3.org/2000/svg",c=!r&&(n==="thickThin"||n==="thinThick")?P.dbl:P[n],u=`ak-compound-${String(_t++)}`,p=document.createElementNS(l,"defs"),d=document.createElementNS(l,"mask");d.id=u,d.setAttribute("maskUnits","userSpaceOnUse");for(const[f,b]of Object.entries({x:"-100000",y:"-100000",width:"200000",height:"200000"}))d.setAttribute(f,b);const a=(f,b,h)=>{if(f<=0)return;const y=document.createElementNS(l,"path");y.setAttribute("d",s),y.setAttribute("fill","none"),y.setAttribute("stroke",b),y.setAttribute("stroke-width",String(f*2)),y.setAttribute("stroke-linejoin",t.getAttribute("stroke-linejoin")??$.join),y.setAttribute("stroke-linecap",t.getAttribute("stroke-linecap")??"butt"),h.append(y)},g=[.5];for(const f of c)g.push((g[g.length-1]??0)-f);const m=c.flatMap((f,b)=>b%2===1?[[g[b+1]??0,g[b]??0]]:[]);if(a(o/2,"white",d),m.every(([f,b])=>m.some(([h,y])=>Math.abs(h+b)<1e-6&&Math.abs(y+f)<1e-6)))for(const[f,b]of m)b>0&&(a(b*o,"black",d),a(Math.max(0,f)*o,"white",d));else{const f=document.createElementNS(l,"clipPath");f.id=`${u}-in`;const b=document.createElementNS(l,"path");b.setAttribute("d",s),b.setAttribute("clip-rule","evenodd"),f.append(b),p.append(f);for(const[h,y]of m)if(h>=0){a(y*o,"black",d),a(h*o,"white",d);const x=document.createElementNS(l,"g");x.setAttribute("clip-path",`url(#${f.id})`),a(o/2,"white",x),d.append(x)}else{const x=document.createElementNS(l,"g");x.setAttribute("clip-path",`url(#${f.id})`),a(-h*o,"black",x),a(Math.max(0,-y)*o,"white",x),d.append(x)}}p.append(d),e.insertBefore(p,e.firstChild),t.setAttribute("mask",`url(#${u})`)}const kt={sysDash:[3,1],sysDot:[1,1],dash:[4,3],dashDot:[4,3,1,3],lgDash:[8,3],lgDashDot:[8,3,1,3],lgDashDotDot:[8,3,1,3,1,3],dot:[1,3],sysDashDot:[3,1,1,1],sysDashDotDot:[3,1,1,1,1,1]},Et=(e,t,i="flat")=>e&&kt[e]?.map((o,r)=>String((i==="flat"?o:r%2===0?Math.max(.001,o-1):o+1)*t)).join(" "),jt=25200,W={sm:2,med:3,lg:5};function U(e,t,i,o,r,n,s={begin:!0,end:!0}){const l=Math.max(o,jt*r),c=[];for(const[u,p,d,a,g]of[[e.line_begin,e.line_begin_size,t,!1,s.begin],[e.line_end,e.line_end_size,i,!0,s.end]]){if(!g||u===void 0||u==="none")continue;const m=wt(d,a);if(!m)continue;const S=u==="arrow"?.5:0,f=l*(W[p?.len??"med"]+S),b=l*(W[p?.w??"med"]+S);c.push(Mt(u,m.at,m.out,f,b,o,n)),u!=="arrow"&&vt(d,a,-m.out[0]*f/2,-m.out[1]*f/2)}return c}function Mt(e,[t,i],[o,r],n,s,l,c){const u="http://www.w3.org/2000/svg",p=(m,S)=>`${String(t-o*m-r*S)},${String(i-r*m+o*S)}`;if(e==="oval"){const m=document.createElementNS(u,"ellipse");return m.setAttribute("cx",String(t)),m.setAttribute("cy",String(i)),m.setAttribute("rx",String(n/2)),m.setAttribute("ry",String(s/2)),m.setAttribute("transform",`rotate(${String(Math.atan2(r,o)*180/Math.PI)} ${String(t)} ${String(i)})`),m.setAttribute("fill",c),m}const d=e==="arrow",a=document.createElementNS(u,d?"polyline":"polygon"),g={triangle:[p(0,0),p(n,s/2),p(n,-s/2)],stealth:[p(0,0),p(n,s/2),p(n*.7,0),p(n,-s/2)],diamond:[p(-n/2,0),p(0,s/2),p(n/2,0),p(0,-s/2)],arrow:[p(n,s/2),p(0,0),p(n,-s/2)]}[e];return a.setAttribute("points",g.join(" ")),d?(a.setAttribute("fill","none"),a.setAttribute("stroke",c),a.setAttribute("stroke-width",String(l))):a.setAttribute("fill",c),a}function Z(e,t,i,o,r,n){const s=t.frame.width*o,l=t.frame.height*o,c="http://www.w3.org/2000/svg",u=document.createElementNS(c,"svg");u.setAttribute("width",String(Math.max(s,1))),u.setAttribute("height",String(Math.max(l,1))),Object.assign(u.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"}),z(u,t);let p=colorCss(t.fill,n);if(t.gradient){const f=`ak-gradient-${String(Dt++)}`;u.append(zt(c,f,t.gradient,t.frame,n)),p=`url(#${f})`}const d=i.map(f=>f.d),a=[],g=i.flatMap((f,b)=>f.stroke?[b]:[]),m=g[0],S=g[g.length-1];if(t.line!==void 0&&t.line!==null&&m!==void 0&&S!==void 0&&((t.line_begin??"none")!=="none"||(t.line_end??"none")!=="none")){const f=C(d[m]??"",s,l,void 0),b=m===S?f:C(d[S]??"",s,l,void 0),h=y=>y.at(-1)?.op!=="Z";a.push(...U(t,f,b,r,o,colorCss(t.line,n),{begin:h(f),end:h(b)})),d[m]=N(f),d[S]=N(b)}i.forEach((f,b)=>{const h=document.createElementNS(c,"path");if(h.setAttribute("d",d[b]??f.d),h.setAttribute("fill-rule","evenodd"),h.setAttribute("fill",f.fill==="none"||t.fill===null||t.fill===void 0?f.fill==="none"||!t.gradient?"none":p:f.fill==="norm"?p:Ot[f.fill](colorCss(t.fill,n))),t.fill_transparency!==void 0&&h.setAttribute("fill-opacity",String(1-t.fill_transparency)),f.stroke&&t.line!==void 0&&t.line!==null){const y=d[b]??f.d;if(t.line_compound!==void 0&&t.line_compound!=="sng"){u.append(h);const x=document.createElementNS(c,"path");x.setAttribute("d",y),x.setAttribute("fill","none"),D(x,t,colorCss(t.line,n),r),u.append(x),G(u,x,t,r,/Z\s*$/u.test(y.trim()));return}D(h,t,colorCss(t.line,n),r)}u.append(h)}),u.append(...a),e.append(u)}const Ot={darken:e=>`color-mix(in srgb, ${e} 60%, black)`,darkenLess:e=>`color-mix(in srgb, ${e} 80%, black)`,lighten:e=>`color-mix(in srgb, ${e} 60%, white)`,lightenLess:e=>`color-mix(in srgb, ${e} 80%, white)`};function V(e,t){const i=e.path;if(!i)return[];const o=i.w===0?0:e.frame.width*t/i.w,r=i.h===0?0:e.frame.height*t/i.h;return[{d:i.steps.map(s=>s.op==="close"?"Z":s.op==="move"?`M ${String(s.x*o)} ${String(s.y*r)}`:s.op==="line"?`L ${String(s.x*o)} ${String(s.y*r)}`:`C ${String(s.x1*o)} ${String(s.y1*r)} ${String(s.x2*o)} ${String(s.y2*r)} ${String(s.x*o)} ${String(s.y*r)}`).join(" "),fill:"norm",stroke:!0}]}function z(e,t){!t.flip?.h&&!t.flip?.v||(e.style.transform=`scale(${t.flip.h?"-1":"1"}, ${t.flip.v?"-1":"1"})`)}const Ct={tl:[0,0],t:[50,0],tr:[100,0],l:[0,50],ctr:[50,50],r:[100,50],bl:[0,100],b:[50,100],br:[100,100]},q=e=>e.picture_fill!==void 0||e.pattern!==void 0||e.gradient?.path!==void 0;function K(e,t,i,o,r){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0px",overflow:"hidden",pointerEvents:"none"}),r!==void 0&&(n.style.clipPath=`path(evenodd, "${r}")`),z(n,e);const s=e.picture_fill;if(s){const c=JSON.stringify(o(s.path));s.transparency!==void 0&&(n.style.opacity=String(1-s.transparency));const u=s.tile,p=document.createElement("img");if(p.alt="",p.src=o(s.path),Object.assign(p.style,{position:"absolute",inset:"0px",width:"100%",height:"100%",maxWidth:"none",objectFit:"fill",...u?{visibility:"hidden"}:{}}),n.append(p),u){const d=j*t*u.scale_x,a=j*t*u.scale_y,[g,m]=Ct[u.align],S=document.createElement("div");Object.assign(S.style,{position:"absolute",left:"0px",top:"0px",width:`${String(e.frame.width*t/d)}px`,height:`${String(e.frame.height*t/a)}px`,transform:`scale(${String(d)}, ${String(a)})`,transformOrigin:"0 0",background:`url(${c}) calc(${String(g)}% + ${String(u.offset_x*t/d)}px) calc(${String(m)}% + ${String(u.offset_y*t/a)}px) / auto repeat`}),n.append(S)}return n}if(!e.pattern&&e.gradient)return n.style.background=T(e.gradient,i),n;const l=e.pattern;if(l){const c=`<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" shape-rendering="crispEdges"><rect width="8" height="8" fill="${colorCss(l.bg,i)}"/><path d="${ut(l.preset)}" fill="${colorCss(l.fg,i)}"/></svg>`,u=8*j*t;n.style.background=`url("data:image/svg+xml,${encodeURIComponent(c)}") 0 0 / ${String(u)}px ${String(u)}px repeat`,n.style.imageRendering="pixelated"}return n}const Nt=new Set(["rect","roundRect","ellipse"]),L=(e,t,i)=>t===void 0||t===0?colorCss(e,i):`color-mix(in srgb, ${colorCss(e,i)} ${String((1-t)*100)}%, transparent)`,T=(e,t)=>{const i=e.stops.map(l=>`${L(l.color,l.transparency,t)} ${String(l.at*100)}%`).join(", ");if(e.path===void 0)return`linear-gradient(${String(e.angle+90)}deg, ${i})`;const o=e.focus??{left:.5,top:.5,right:.5,bottom:.5},r=(o.left+1-o.right)/2*100,n=(o.top+1-o.bottom)/2*100;return`radial-gradient(${e.path==="circle"?"circle farthest-corner":"farthest-side"} at ${String(r)}% ${String(n)}%, ${i})`},J=(e,t)=>e.gradient?T(e.gradient,t):e.fill===null||e.fill===void 0?"transparent":L(e.fill,e.fill_transparency,t);let Dt=0;function zt(e,t,i,o,r){const n=document.createElementNS(e,"linearGradient");n.id=t;const s=i.angle*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=(Math.abs(o.width*l)+Math.abs(o.height*c))/Math.max(o.width,o.height,1)/2;n.setAttribute("x1",String(.5-l*u)),n.setAttribute("y1",String(.5-c*u)),n.setAttribute("x2",String(.5+l*u)),n.setAttribute("y2",String(.5+c*u));for(const p of i.stops){const d=document.createElementNS(e,"stop");d.setAttribute("offset",String(p.at)),d.setAttribute("stop-color",colorCss(p.color,r)),p.transparency!==void 0&&d.setAttribute("stop-opacity",String(1-p.transparency)),n.append(d)}return n}let Lt=0;function Tt(e,t,i,o){const r=[],n="http://www.w3.org/2000/svg",s=[],l=t.frame.width*i,c=t.frame.height*i,u=(t.line_width??LINE_WIDTH)*i*5,p=(f,b)=>{const h=document.createElementNS(n,"filter");h.id=`ak-effect-${String(Lt++)}`;const y=b+u;for(const[x,_]of Object.entries({filterUnits:"userSpaceOnUse",x:String(-y),y:String(-y),width:String(l+2*y),height:String(c+2*y),"color-interpolation-filters":"sRGB"}))h.setAttribute(x,_);f(h),s.push(h),r.push(`url(#${h.id})`)},d=(f,b,h)=>{const y=document.createElementNS(n,b);for(const[x,_]of Object.entries(h))y.setAttribute(x,_);return f.append(y),y};if(t.soft_edges!==void 0&&t.soft_edges>0){const f=t.soft_edges*i;p(b=>{d(b,"feMorphology",{in:"SourceAlpha",operator:"erode",radius:String(f/2),result:"in"}),d(b,"feGaussianBlur",{in:"in",stdDeviation:String(f/4),result:"soft"}),d(b,"feComposite",{in:"SourceGraphic",in2:"soft",operator:"in"})},f)}const a=t.inner_shadow;if(a){const f=a.angle*Math.PI/180,b=a.distance*i;p(h=>{const y=d(h,"feComponentTransfer",{in:"SourceAlpha",result:"out"});d(y,"feFuncA",{type:"table",tableValues:"1 0"}),d(h,"feGaussianBlur",{in:"out",stdDeviation:String(a.blur*i/2),result:"blur"}),d(h,"feOffset",{in:"blur",dx:String(b*Math.cos(f)),dy:String(b*Math.sin(f)),result:"moved"}),d(h,"feFlood",{"flood-color":colorCss(a.color,o),"flood-opacity":String(1-a.transparency),result:"ink"}),d(h,"feComposite",{in:"ink",in2:"moved",operator:"in",result:"shadow"}),d(h,"feComposite",{in:"shadow",in2:"SourceAlpha",operator:"in",result:"inside"});const x=d(h,"feMerge",{});d(x,"feMergeNode",{in:"SourceGraphic"}),d(x,"feMergeNode",{in:"inside"})},(a.blur*2+a.distance)*i)}const g=t.shadow,m=t.glow&&t.glow.size>0?t.glow:void 0;if(g&&!m){const f=g.angle*Math.PI/180,b=g.distance*i;r.push(`drop-shadow(${String(b*Math.cos(f))}px ${String(b*Math.sin(f))}px ${String(g.blur*i)}px ${L(g.color,g.transparency,o)})`)}if(m){const f=m.size*i;p(b=>{d(b,"feMorphology",{in:"SourceAlpha",operator:"dilate",radius:String(f/2),result:"wide"}),d(b,"feGaussianBlur",{in:"wide",stdDeviation:String(f/4),result:"halo"}),d(b,"feFlood",{"flood-color":colorCss(m.color,o),"flood-opacity":String(1-m.transparency),result:"ink"}),d(b,"feComposite",{in:"ink",in2:"halo",operator:"in",result:"glow"});const h=d(b,"feMerge",{});if(g){const y=g.angle*Math.PI/180,x=g.distance*i;d(b,"feGaussianBlur",{in:"SourceAlpha",stdDeviation:String(g.blur*i/2),result:"cast"}),d(b,"feOffset",{in:"cast",dx:String(x*Math.cos(y)),dy:String(x*Math.sin(y)),result:"moved"}),d(b,"feFlood",{"flood-color":colorCss(g.color,o),"flood-opacity":String(1-g.transparency),result:"dark"}),d(b,"feComposite",{in:"dark",in2:"moved",operator:"in",result:"shadow"}),b.append(h),d(h,"feMergeNode",{in:"shadow"})}d(h,"feMergeNode",{in:"glow"}),d(h,"feMergeNode",{in:"SourceGraphic"})},Math.max(f*2,g?(g.blur*1.5+g.distance)*i:0))}if(s.length>0){const f=document.createElementNS(n,"svg");f.setAttribute("width","0"),f.setAttribute("height","0"),Object.assign(f.style,{position:"absolute"}),f.setAttribute("aria-hidden","true"),f.append(...s),e.append(f)}r.length>0&&(e.style.filter=r.join(" "));const S=t.reflection;S&&e.style.setProperty("-webkit-box-reflect",`below ${String(S.distance*i)}px linear-gradient(to bottom, transparent ${String((1-S.size)*100)}%, rgba(0, 0, 0, ${String(1-S.transparency)}))`)}function Ft(e,t,i){const o=t.geometry??"rect",r=t.frame.width*i,n=t.frame.height*i;o==="roundRect"?e.style.borderRadius=`${String(Math.min(r,n)*Math.min(.5,Math.max(0,t.adjustments?.[0]??Q("roundRect")[0]??0)))}px`:o==="ellipse"&&(e.style.borderRadius="50%")}const It={left:"borderLeft",right:"borderRight",top:"borderTop",bottom:"borderBottom"},Y="http://www.w3.org/2000/svg";function Ht(e,t,i,o,r){const n=i.width/k,s=i.height/k,l=o*k,c=tt(t,n,s),u=document.createElementNS(Y,"svg");u.setAttribute("viewBox",`0 0 ${String(n)} ${String(s)}`),u.setAttribute("width","100%"),u.setAttribute("height","100%"),Object.assign(u.style,{position:"absolute",inset:"0px",overflow:"visible"});const p=(a,g)=>{const m=document.createElementNS(Y,a);for(const[S,f]of Object.entries(g))m.setAttribute(S,String(f));u.append(m)},d=a=>{p("path",{d:a.d,fill:a.fill===void 0?"none":colorCss(a.fill,r),stroke:a.width>0?colorCss(a.color,r):"none","stroke-width":a.width,"stroke-linejoin":"round"})};for(const a of[...c.grid,...c.shapes])d(a);for(const a of[...c.boxes,...c.keys])p("rect",{x:a.x,y:a.y,width:a.width,height:a.height,fill:colorCss(a.color,r)});for(const a of[...c.axes,...c.lines])d(a);for(const a of c.dots)p("circle",{cx:a.x,cy:a.y,r:a.r,fill:colorCss(a.color,r)});e.append(u);for(const a of c.words){const g=document.createElement("div");g.textContent=a.text,Object.assign(g.style,{position:"absolute",left:`${String(a.x*l)}px`,top:`${String(a.y*l)}px`,transform:`translate(${{start:"0",middle:"-50%",end:"-100%"}[a.anchor]}, -50%)${a.rotate===void 0?"":` rotate(${String(a.rotate)}deg)`}`,transformOrigin:`${{start:"0%",middle:"50%",end:"100%"}[a.anchor]} 50%`,fontSize:`${String(a.size*l)}px`,lineHeight:"1",whiteSpace:"nowrap",color:colorCss(a.color,r),fontFamily:"var(--ak-theme-minor)"}),e.append(g)}}function Rt(e,t,i,o,r){const n=ft(t.style),s=document.createElement("table");n?.background!==void 0&&(s.style.background=colorCss(n.background,r)),Object.assign(s.style,{borderCollapse:"collapse",tableLayout:"fixed",width:`${String(t.columns.reduce((c,u)=>c+u,0)*i)}px`});const l=document.createElement("colgroup");for(const c of t.columns){const u=document.createElement("col");u.style.width=`${String(c*i)}px`,l.append(u)}s.append(l);for(const[c,u]of t.rows.entries()){const p=document.createElement("tr");p.style.height=`${String(u.height*i)}px`;for(const[d,a]of u.cells.entries()){if(a.spanned)continue;const g=document.createElement("td");g.dataset.akCell=`${String(c)},${String(d)}`,a.span_width&&(g.colSpan=a.span_width),a.span_height&&(g.rowSpan=a.span_height),g.style.padding="0px",g.style.verticalAlign={t:"top",ctr:"middle",b:"bottom"}[a.text.style.vertical_anchor];const m=n?X(n,t,c,d,t.rows.length,t.columns.length,c+(a.span_height??1)-1,d+(a.span_width??1)-1):void 0,S=a.fill!==void 0?a.fill:m?.fill;S!==void 0&&(g.style.background=colorCss(S,r));for(const[b,h]of Object.entries(It)){const y=b,x=a.borders?.[y]??m?.borders[y];x&&(g.style[h]=`${String(x.width*i)}px solid ${colorCss(x.color,r)}`)}const f=A(a.text,i,o,r);f.style.minHeight="0px",g.append(f),p.append(g)}s.append(p)}e.style.height="auto",e.append(s)}export function drawShape(e,t,i){const{k:o,colors:r}=i;if(t.kind==="placeholder"&&t.text?.empty===!0&&!i.editing)return;const n=document.createElement("div");n.setAttribute(SHAPE_ATTR,`${e}/${t.name}`);const{left:s,top:l,width:c,height:u}=t.frame;Object.assign(n.style,{position:"absolute",left:`${String(s*o)}px`,top:`${String(l*o)}px`,width:`${String(c*o)}px`,height:`${String(u*o)}px`}),t.rotation!==void 0&&(n.style.transform=`rotate(${String(t.rotation)}deg)`);const p=(t.line_width??LINE_WIDTH)*o;if(t.chart)Ht(n,t.chart,t.frame,o,r);else if(t.table)return Rt(n,t.table,o,i.lang,r),n;Tt(n,t,o,r),t.alt!==void 0&&n.setAttribute("aria-label",t.alt);let d;if(t.kind==="autoshape"){if(!t.path&&rt(t.geometry))return $t(n,t,o,p,r),n;const a=t.path?void 0:H(t.geometry??"rect",t.frame.width*o,t.frame.height*o,t.adjustments),g=t.line!==void 0&&t.line!==null&&(t.line_dash!==void 0&&t.line_dash!=="solid"||t.line_compound!==void 0&&t.line_compound!=="sng"||t.line_join!==void 0&&t.line_join!==$.join);if(q(t)){const S=t.path?V(t,o):a?.paths??[],f=S.filter(h=>h.fill!=="none").map(h=>h.d).join(" ");n.append(K(t,o,r,i.url,f));const b={...t,fill:null};return delete b.gradient,Z(n,b,S,o,p,r),t.text&&n.append(A(t.text,o,i.lang,r,a?.text)),n}const m=t.path?V(t,o):Nt.has(t.geometry??"rect")&&!g?void 0:a?.paths;if(m)return Z(n,t,m,o,p,r),t.text&&n.append(A(t.text,o,i.lang,r,a?.text)),n;n.style.background=J(t,r),Ft(n,t,o),d=a?.text}else q(t)?n.append(K(t,o,r,i.url,void 0)):(t.fill!==void 0||t.gradient)&&(n.style.background=J(t,r));if(t.line!==void 0&&t.line!==null&&(n.style.outline=`${String(p)}px ${t.line_dash===void 0||t.line_dash==="solid"?"solid":"dashed"} ${colorCss(t.line,r)}`,n.style.outlineOffset=`${String(-p/2)}px`),t.text?.style.auto_size==="shape"&&t.text.style.orientation==="horz"&&(n.style.height="auto",n.style.minHeight="0px"),t.kind==="picture"&&t.media){n.style.overflow="hidden";const a=document.createElement("img");a.alt=t.alt??"",a.src=i.url(t.media.path),z(a,t);const g=t.media.crop??{left:0,top:0,right:0,bottom:0},m=1-g.left-g.right,S=1-g.top-g.bottom;Object.assign(a.style,{position:"absolute",width:`${String(100/m)}%`,height:`${String(100/S)}%`,left:`${String(-g.left/m*100)}%`,top:`${String(-g.top/S*100)}%`,maxWidth:"none"}),t.flip&&(a.style.transformOrigin=`${String(50/m-g.left/m*100)}% ${String(50/S-g.top/S*100)}%`),n.append(a)}else if(t.kind==="movie"&&t.media&&!i.playing&&i.poster!==!0)n.dataset.akFilm="";else if(t.kind==="movie"&&t.media){const a=document.createElement("video");a.src=i.url(t.media.path),a.muted=!0,a.playsInline=!0,a.preload="auto",t.media.poster!==void 0&&(a.currentTime=t.media.poster),Object.assign(a.style,{width:"100%",height:"100%",objectFit:"fill",...i.playing?{}:{pointerEvents:"none"}}),n.append(a)}if(t.kind==="audio"&&t.media&&(!i.editing&&t.media.playback?.hide===!0&&(n.style.visibility="hidden"),n.append(Bt()),i.playing)){const a=document.createElement("audio");a.src=i.url(t.media.path),a.preload="auto",n.append(a)}return t.text&&n.append(A(t.text,o,i.lang,r,d)),n}const F="http://www.w3.org/2000/svg";function Bt(){const e=document.createElementNS(F,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","#595959"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linejoin","round"),Object.assign(e.style,{width:"100%",height:"100%",display:"block"});const t=document.createElementNS(F,"polygon");t.setAttribute("points","11 5 6 9 2 9 2 15 6 15 11 19 11 5"),t.setAttribute("fill","#595959"),e.append(t);for(const i of["M15.54 8.46a5 5 0 0 1 0 7.07","M19.07 4.93a10 10 0 0 1 0 14.14"]){const o=document.createElementNS(F,"path");o.setAttribute("d",i),e.append(o)}return e}export function slideBackgroundCss(e,t,i){return e.background_picture!==void 0?`${colorCss(e.background,t)} url(${JSON.stringify(i(e.background_picture))}) center / 100% 100% no-repeat`:e.background_gradient?T(e.background_gradient,t):colorCss(e.background,t)}export function drawSlide(e,t){const i=document.createElement("div");i.dataset.akSlide=e.id;const o={...t,colors:st(t.colors,e.color_map)};Object.assign(i.style,{position:"absolute",inset:"0px",background:slideBackgroundCss(e,o.colors,t.url),overflow:"hidden"});for(const r of e.shapes){const n=drawShape(e.id,r,o);n&&i.append(n)}return i}
|
|
2
|
+
import{adjustmentDefaults as Q,cellLook as X,chartDrawing as tt,colorRgb as et,CONNECTOR_STYLE as nt,DECK_FONTS as it,EMU_PER_PT as k,Inches as ot,isConnectorGeometry as rt,LINE_DEFAULTS as $,mappedColors as st,Pt as at,bulletLookOver as lt,numberText as dt,runLang as ct,SINGLE_SPACING as E,spaceLength as I,PATTERN_CELL as j,patternPath as ut,tableStyleOf as ft}from"@allyhub/slides-core";import{presetOutline as H}from"@allyhub/ooxml/geometry";export{SLIDE_CSS,slideStyle}from"./slide-css.js";export const SHAPE_ATTR="data-ak-shape",LINE_WIDTH=at(.75);export{E as SINGLE_SPACING};export const MIN_FONT_SCALE=.25;export function themeCss(e){const t={};for(const[i,o]of Object.entries(e.colors))t[`--ak-theme-${i}`]=o;return t["--ak-theme-major"]=v(e.fonts.major,O),t["--ak-theme-minor"]=v(e.fonts.minor,O),t["--ak-theme-major-ea"]=v(e.fonts.major_east_asian,M),t["--ak-theme-minor-ea"]=v(e.fonts.minor_east_asian,M),t}const M='"Noto Sans SC", sans-serif',O=`"${it.minor}", ${M}`,v=(e,t)=>e.includes(",")||e.includes('"')?e:`"${e}", ${t}`;export const colorCss=(e,t)=>e==null?"transparent":et(e,t);const B=e=>e===void 0?void 0:e==="+mj-lt"?"var(--ak-theme-major)":e==="+mn-lt"?"var(--ak-theme-minor)":v(e,O),gt={l:"start",ctr:"center",r:"end",just:"justify"},pt={t:"flex-start",ctr:"center",b:"flex-end"},mt=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\u2E80-\u2FDF\u3000-\u303F\uFF00-\uFFEF]/u,bt=/[\u2018\u2019\u201C\u201D\u2026\u2014\u2013\u2025\u00B7]/u;export function eastAsianRuns(e,t){const i=[];for(const o of e){const r=mt.test(o)||t&&bt.test(o),n=i.at(-1);n?.ea===r?n.text+=o:i.push({text:o,ea:r})}return i}const ht=e=>!e.startsWith("#")&&!e.startsWith("ppaction:"),w=e=>`calc(${String(e)}px * var(--ak-fit, 1))`;function R(e,t,i,o){if(!t)return;const r=B(t.name);r&&(e.style.fontFamily=r),t.size!==void 0&&(e.style.fontSize=w(t.size*i)),t.bold!==void 0&&(e.style.fontWeight=t.bold?"700":"400"),t.italic!==void 0&&(e.style.fontStyle=t.italic?"italic":"normal"),(t.underline!==void 0||t.strike!==void 0||t.link)&&Object.assign(e.style,decorationCss(t)),t.caps!==void 0&&Object.assign(e.style,capsCss(t.caps)),t.highlight!==void 0&&(e.style.backgroundColor=t.highlight),t.baseline!==void 0&&t.baseline!==0&&(e.style.fontSize=t.size===void 0?"0.66em":w(t.size*i*.66),e.style.verticalAlign=`${String(t.baseline/.66)}em`),t.spacing!==void 0&&(e.style.letterSpacing=w(t.spacing*i)),t.link!==void 0?e.style.color=colorCss("hlink",o):t.color!==void 0&&(e.style.color=colorCss(t.color,o))}const St={sng:{style:"solid"},dbl:{style:"double"},heavy:{style:"solid",heavy:!0},dotted:{style:"dotted"},dottedHeavy:{style:"dotted",heavy:!0},dash:{style:"dashed"},dashHeavy:{style:"dashed",heavy:!0},dashLong:{style:"dashed"},dashLongHeavy:{style:"dashed",heavy:!0},dotDash:{style:"dashed"},dotDashHeavy:{style:"dashed",heavy:!0},dotDotDash:{style:"dashed"},dotDotDashHeavy:{style:"dashed",heavy:!0},wavy:{style:"wavy"},wavyHeavy:{style:"wavy",heavy:!0},wavyDbl:{style:"wavy"},words:{style:"solid"}};export function decorationCss(e){const t=typeof e.underline=="string"?e.underline:e.underline===!0||e.link!==void 0?"sng":void 0,i=e.strike===!0?"sngStrike":e.strike===!1?void 0:e.strike,o=t?St[t]:{style:i==="dblStrike"?"double":"solid"};return{textDecorationLine:[t?"underline":"",i?"line-through":""].filter(r=>r!=="").join(" ")||"none",textDecorationStyle:o.style,textDecorationThickness:"heavy"in o?"0.1em":"auto"}}export const capsCss=e=>({textTransform:e==="all"?"uppercase":"none",fontVariantCaps:e==="small"?"small-caps":"normal"});function yt(){if(document.adoptedStyleSheets.some(t=>t.allyhubBullets))return;const e=new CSSStyleSheet;e.replaceSync("[data-ak-bullet]::before{content:attr(data-ak-bullet)}"),Object.assign(e,{allyhubBullets:!0}),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]}export function paragraphStyle(e,t){const i=t[e.level]??t[0];if(!i)throw new Error("A text style has nine levels.");return lt({...i,...e.alignment===void 0?{}:{alignment:e.alignment},...e.line_spacing===void 0?{}:{line_spacing:e.line_spacing},...e.space_before===void 0?{}:{space_before:e.space_before},...e.space_after===void 0?{}:{space_after:e.space_after},...e.margin_left===void 0?{}:{margin_left:e.margin_left},...e.indent===void 0?{}:{indent:e.indent},...e.numbered===void 0?{}:{numbered:e.numbered},font:{...i.font,...e.font}},e)}export function paragraphLabels(e,t){const i=[];return e.map(o=>{if(!o.runs.some(n=>n.text!==""&&n.text!=="\v"))return;const r=paragraphStyle(o,t);return i.length=o.level+1,r.numbered===void 0?i[o.level]=0:i[o.level]=i[o.level]?(i[o.level]??0)+1:r.start_at??1,r.numbered===void 0?r.bullet?.char:dt(r.numbered,i[o.level]??1)})}export function paragraphElement(e,t,i,o,r,n){const s=paragraphStyle(e,i),l=document.createElement("div");l.dataset.akParagraph=String(t),l.dataset.akLevel=String(e.level);const c=e.runs.map(a=>a.font?.size??s.font.size),u=(c.length>0?Math.max(...c):s.font.size)*r,p="lines"in s.line_spacing?String(s.line_spacing.lines*E):w(s.line_spacing.fixed*r),d=o!==void 0;if(Object.assign(l.style,{position:"relative",textAlign:gt[s.alignment],paddingInlineStart:`${String(s.margin_left*r)}px`,textIndent:d?"0px":`${String(s.indent*r)}px`,marginBlockStart:t===0?"0px":w(I(s.space_before,u/r)*r),marginBlockEnd:w(I(s.space_after,u/r)*r),lineHeight:p,fontSize:w(u),minBlockSize:"lines"in s.line_spacing?w(u*s.line_spacing.lines*E):p}),R(l,s.font,r,n),l.style.fontSize=w(u),o!==void 0){yt();const a=document.createElement("span");Object.assign(a.style,{position:"absolute",insetInlineStart:`${String((s.margin_left+s.indent)*r)}px`,textIndent:"0px"}),a.dataset.akLabel=String((s.margin_left+s.indent)*r),a.dataset.akMargin=String(s.margin_left*r),a.dataset.akTab=String(DEFAULT_TAB_STOP*r);const g=document.createElement("span");g.dataset.akBullet=o;const m=s.numbered===void 0?s.bullet?.font:void 0,S=(e.runs[0]?.font?.size??s.font.size)*r;Object.assign(g.style,{lineHeight:"0",...m===void 0?{}:{fontFamily:B(m)},...s.bullet_size===void 0?{}:{fontSize:w(S*s.bullet_size)},...s.bullet_color===void 0?{}:{color:colorCss(s.bullet_color,n)}}),a.append(g),l.append(a)}return l}export const DEFAULT_TAB_STOP=ot(1);export function hangLabels(e){for(const t of e.querySelectorAll("[data-ak-label]")){const i=t.parentElement,o=t.firstElementChild;if(!i||!(o instanceof HTMLElement))continue;const r=Number(t.dataset.akLabel),n=Number(t.dataset.akMargin),s=Number(t.dataset.akTab),l=getComputedStyle(i).writingMode.startsWith("vertical"),c=r+(l?o.offsetHeight:o.offsetWidth);i.style.textIndent=c<=n+.5||!(s>0)?"0px":`${String((Math.floor(c/s)+1)*s-n)}px`}}export const exactSpacing=(e,t)=>!("lines"in paragraphStyle(e,t).line_spacing);export function runElement(e,t,i,o=!1,r){const n=document.createElement("span");R(n,e.font,t,i);const s=e.text===void 0?r:ct(e.text,r);return s!==void 0&&s!==r&&(n.lang=s),o&&(n.style.lineHeight="0"),e.font?.link!==void 0&&ht(e.font.link)&&(n.dataset.akLink=e.font.link),n}export function eastAsianFace(e,t){return`var(--ak-theme-${(e.font?.name??t)==="+mj-lt"?"major":"minor"}-ea)`}function xt(e,t,i,o,r){const n=isCjk(o);e.replaceChildren();const s=t.paragraphs.length>0?t.paragraphs:[{runs:[],level:0}],l=paragraphLabels(s,t.style.levels);s.forEach((c,u)=>{const p=paragraphElement(c,u,t.style.levels,l[u],i,r),d=paragraphStyle(c,t.style.levels).font.name,a=exactSpacing(c,t.style.levels);for(const g of c.runs){const m=runElement(g,i,r,a,o),S=eastAsianFace(g,d);for(const f of eastAsianRuns(g.text.replaceAll("\v",`
|
|
3
|
+
`),n)){if(!f.ea){m.append(f.text);continue}const b=document.createElement("span");b.style.fontFamily=S,b.textContent=f.text,m.append(b)}p.append(m)}e.append(p)})}export const isCjk=e=>e!==void 0&&/^(zh|ja|ko)(-|$)/iu.test(e);function A(e,t,i,o,r){const{style:n}=e,s=n.auto_size==="shape"&&n.orientation==="horz",l=document.createElement("div");l.dataset.akText="",l.dataset.akAutofit=n.auto_size,n.orientation!=="horz"&&(l.dataset.akOrientation=n.orientation);const c=s?void 0:r;Object.assign(l.style,{position:s?"relative":"absolute",inset:s?"auto":c?`${String(c.top)}px calc(100% - ${String(c.right)}px) calc(100% - ${String(c.bottom)}px) ${String(c.left)}px`:"0px",minHeight:c?`${String(c.bottom-c.top)}px`:"100%",display:"flex",flexDirection:"column",justifyContent:pt[n.vertical_anchor],padding:`${String(n.margins.top*t)}px ${String(n.margins.right*t)}px ${String(n.margins.bottom*t)}px ${String(n.margins.left*t)}px`,whiteSpace:n.word_wrap?"pre-wrap":"pre",overflowWrap:"break-word",boxSizing:"border-box",...orientationCss(n.orientation)});const u=document.createElement("div");if(u.dataset.akBody="",l.append(u),xt(u,e,t,i,o),!n.word_wrap){Object.assign(u.style,{display:"flex",flexDirection:"column"});for(const p of u.children){if(!(p instanceof HTMLElement))continue;const d=p.style.textAlign;Object.assign(p.style,{inlineSize:"max-content",minInlineSize:"100%",boxSizing:"border-box",alignSelf:d==="center"?"center":d==="end"?"flex-end":"flex-start"})}}return i!==void 0&&(l.lang=i),isCjk(i)&&(l.dataset.akCjk=""),l}export function orientationCss(e){switch(e){case"horz":return{writingMode:"horizontal-tb",textOrientation:"mixed"};case"vert":return{writingMode:"sideways-rl",textOrientation:"mixed"};case"vert270":return{writingMode:"sideways-lr",textOrientation:"mixed"};case"eaVert":return{writingMode:"vertical-rl",textOrientation:"mixed"};case"wordArtVert":return{writingMode:"vertical-lr",textOrientation:"upright"};case"wordArtVertRtl":return{writingMode:"vertical-rl",textOrientation:"upright"};case"mongolianVert":return{writingMode:"vertical-lr",textOrientation:"mixed"}}}export function fitText(e){const t=e.querySelector("[data-ak-body]");if(!t||e.dataset.akAutofit!=="text")return 1;const i=e.dataset.akOrientation!==void 0,o=getComputedStyle(e),r=i?e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight):e.clientHeight-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom),n=c=>(e.style.setProperty("--ak-fit",String(c)),hangLabels(e),(i?t.scrollWidth:t.scrollHeight)<=r+.5);if(n(1))return delete e.dataset.akFontScale,1;let s=MIN_FONT_SCALE,l=1;if(!n(s))return e.dataset.akFontScale=s.toFixed(2),s;for(;l-s>.01;){const c=(s+l)/2;n(c)?s=c:l=c}return n(s),e.dataset.akFontScale=s.toFixed(2),s}function C(e,t,i,o){const r=e.split(" "),n=[],s=l=>{const c=Number(r[l]),u=Number(r[l+1]);return[o?.h?t-c:c,o?.v?i-u:u]};for(let l=0;l<r.length;){const c=r[l++];c==="M"||c==="L"?(n.push({op:c,at:[s(l)]}),l+=2):c==="C"?(n.push({op:c,at:[s(l),s(l+2),s(l+4)]}),l+=6):c==="Z"&&n.push({op:c})}return n}const N=e=>e.map(t=>t.op==="Z"?"Z":`${t.op}${t.at.map(([i,o])=>`${String(i)} ${String(o)}`).join(" ")}`).join(" ");function wt(e,t){const i=e.flatMap(n=>n.op==="Z"?[]:n.at),o=t?[...i].reverse():i,r=o[0];if(r)for(const n of o.slice(1)){const s=Math.hypot(r[0]-n[0],r[1]-n[1]);if(s>1e-6)return{at:r,out:[(r[0]-n[0])/s,(r[1]-n[1])/s]}}}function vt(e,t,i,o){const r=e.filter(l=>l.op!=="Z"),n=t?r[r.length-1]:r[0];if(!n)return;const s=t?n.at.slice(n.op==="C"?-2:-1):[...n.at,...r[1]?.op==="C"?r[1].at.slice(0,1):[]];for(const l of s)l[0]+=i,l[1]+=o}function $t(e,t,i,o,r){if(t.line===null)return;const n=t.frame.width*i,s=t.frame.height*i,l=(H(t.geometry??"line",n,s,t.adjustments)?.paths??[]).filter(m=>m.stroke).map(m=>C(m.d,n,s,t.flip)),c=l[0],u=l[l.length-1];if(!c||!u)return;const p="http://www.w3.org/2000/svg",d=document.createElementNS(p,"svg");d.setAttribute("width",String(Math.max(n,1))),d.setAttribute("height",String(Math.max(s,1))),Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"});const a=colorCss(t.line??nt.line,r),g=U(t,c,u,o,i,a);for(const m of l){const S=document.createElementNS(p,"path");S.setAttribute("d",N(m)),S.setAttribute("fill","none"),D(S,t,a,o),d.append(S),G(d,S,t,o,!1)}d.append(...g),e.append(d)}const At={flat:"butt",rnd:"round",sq:"square"};function D(e,t,i,o){e.setAttribute("stroke",i),e.setAttribute("stroke-width",String(o)),e.setAttribute("stroke-linecap",At[t.line_cap??$.cap]);const r=t.line_join??$.join;e.setAttribute("stroke-linejoin",r),r==="miter"&&e.setAttribute("stroke-miterlimit","8");const n=Et(t.line_dash,o,t.line_cap);n&&e.setAttribute("stroke-dasharray",n)}const P={dbl:[1/3,1/3,1/3],thickThin:[.6,.2,.2],thinThick:[.2,.2,.6],tri:[1/6,1/6,2/6,1/6,1/6]};let _t=0;function G(e,t,i,o,r){const n=i.line_compound;if(n===void 0||n==="sng")return;const s=t.getAttribute("d")??"",l="http://www.w3.org/2000/svg",c=!r&&(n==="thickThin"||n==="thinThick")?P.dbl:P[n],u=`ak-compound-${String(_t++)}`,p=document.createElementNS(l,"defs"),d=document.createElementNS(l,"mask");d.id=u,d.setAttribute("maskUnits","userSpaceOnUse");for(const[f,b]of Object.entries({x:"-100000",y:"-100000",width:"200000",height:"200000"}))d.setAttribute(f,b);const a=(f,b,h)=>{if(f<=0)return;const y=document.createElementNS(l,"path");y.setAttribute("d",s),y.setAttribute("fill","none"),y.setAttribute("stroke",b),y.setAttribute("stroke-width",String(f*2)),y.setAttribute("stroke-linejoin",t.getAttribute("stroke-linejoin")??$.join),y.setAttribute("stroke-linecap",t.getAttribute("stroke-linecap")??"butt"),h.append(y)},g=[.5];for(const f of c)g.push((g[g.length-1]??0)-f);const m=c.flatMap((f,b)=>b%2===1?[[g[b+1]??0,g[b]??0]]:[]);if(a(o/2,"white",d),m.every(([f,b])=>m.some(([h,y])=>Math.abs(h+b)<1e-6&&Math.abs(y+f)<1e-6)))for(const[f,b]of m)b>0&&(a(b*o,"black",d),a(Math.max(0,f)*o,"white",d));else{const f=document.createElementNS(l,"clipPath");f.id=`${u}-in`;const b=document.createElementNS(l,"path");b.setAttribute("d",s),b.setAttribute("clip-rule","evenodd"),f.append(b),p.append(f);for(const[h,y]of m)if(h>=0){a(y*o,"black",d),a(h*o,"white",d);const x=document.createElementNS(l,"g");x.setAttribute("clip-path",`url(#${f.id})`),a(o/2,"white",x),d.append(x)}else{const x=document.createElementNS(l,"g");x.setAttribute("clip-path",`url(#${f.id})`),a(-h*o,"black",x),a(Math.max(0,-y)*o,"white",x),d.append(x)}}p.append(d),e.insertBefore(p,e.firstChild),t.setAttribute("mask",`url(#${u})`)}const kt={sysDash:[3,1],sysDot:[1,1],dash:[4,3],dashDot:[4,3,1,3],lgDash:[8,3],lgDashDot:[8,3,1,3],lgDashDotDot:[8,3,1,3,1,3],dot:[1,3],sysDashDot:[3,1,1,1],sysDashDotDot:[3,1,1,1,1,1]},Et=(e,t,i="flat")=>e&&kt[e]?.map((o,r)=>String((i==="flat"?o:r%2===0?Math.max(.001,o-1):o+1)*t)).join(" "),jt=25200,W={sm:2,med:3,lg:5};function U(e,t,i,o,r,n,s={begin:!0,end:!0}){const l=Math.max(o,jt*r),c=[];for(const[u,p,d,a,g]of[[e.line_begin,e.line_begin_size,t,!1,s.begin],[e.line_end,e.line_end_size,i,!0,s.end]]){if(!g||u===void 0||u==="none")continue;const m=wt(d,a);if(!m)continue;const S=u==="arrow"?.5:0,f=l*(W[p?.len??"med"]+S),b=l*(W[p?.w??"med"]+S);c.push(Mt(u,m.at,m.out,f,b,o,n)),u!=="arrow"&&vt(d,a,-m.out[0]*f/2,-m.out[1]*f/2)}return c}function Mt(e,[t,i],[o,r],n,s,l,c){const u="http://www.w3.org/2000/svg",p=(m,S)=>`${String(t-o*m-r*S)},${String(i-r*m+o*S)}`;if(e==="oval"){const m=document.createElementNS(u,"ellipse");return m.setAttribute("cx",String(t)),m.setAttribute("cy",String(i)),m.setAttribute("rx",String(n/2)),m.setAttribute("ry",String(s/2)),m.setAttribute("transform",`rotate(${String(Math.atan2(r,o)*180/Math.PI)} ${String(t)} ${String(i)})`),m.setAttribute("fill",c),m}const d=e==="arrow",a=document.createElementNS(u,d?"polyline":"polygon"),g={triangle:[p(0,0),p(n,s/2),p(n,-s/2)],stealth:[p(0,0),p(n,s/2),p(n*.7,0),p(n,-s/2)],diamond:[p(-n/2,0),p(0,s/2),p(n/2,0),p(0,-s/2)],arrow:[p(n,s/2),p(0,0),p(n,-s/2)]}[e];return a.setAttribute("points",g.join(" ")),d?(a.setAttribute("fill","none"),a.setAttribute("stroke",c),a.setAttribute("stroke-width",String(l))):a.setAttribute("fill",c),a}function Z(e,t,i,o,r,n){const s=t.frame.width*o,l=t.frame.height*o,c="http://www.w3.org/2000/svg",u=document.createElementNS(c,"svg");u.setAttribute("width",String(Math.max(s,1))),u.setAttribute("height",String(Math.max(l,1))),Object.assign(u.style,{position:"absolute",left:"0px",top:"0px",overflow:"visible"}),z(u,t);let p=colorCss(t.fill,n);if(t.gradient){const f=`ak-gradient-${String(Dt++)}`;u.append(zt(c,f,t.gradient,t.frame,n)),p=`url(#${f})`}const d=i.map(f=>f.d),a=[],g=i.flatMap((f,b)=>f.stroke?[b]:[]),m=g[0],S=g[g.length-1];if(t.line!==void 0&&t.line!==null&&m!==void 0&&S!==void 0&&((t.line_begin??"none")!=="none"||(t.line_end??"none")!=="none")){const f=C(d[m]??"",s,l,void 0),b=m===S?f:C(d[S]??"",s,l,void 0),h=y=>y.at(-1)?.op!=="Z";a.push(...U(t,f,b,r,o,colorCss(t.line,n),{begin:h(f),end:h(b)})),d[m]=N(f),d[S]=N(b)}i.forEach((f,b)=>{const h=document.createElementNS(c,"path");if(h.setAttribute("d",d[b]??f.d),h.setAttribute("fill-rule","evenodd"),h.setAttribute("fill",f.fill==="none"||t.fill===null||t.fill===void 0?f.fill==="none"||!t.gradient?"none":p:f.fill==="norm"?p:Ot[f.fill](colorCss(t.fill,n))),t.fill_transparency!==void 0&&h.setAttribute("fill-opacity",String(1-t.fill_transparency)),f.stroke&&t.line!==void 0&&t.line!==null){const y=d[b]??f.d;if(t.line_compound!==void 0&&t.line_compound!=="sng"){u.append(h);const x=document.createElementNS(c,"path");x.setAttribute("d",y),x.setAttribute("fill","none"),D(x,t,colorCss(t.line,n),r),u.append(x),G(u,x,t,r,/Z\s*$/u.test(y.trim()));return}D(h,t,colorCss(t.line,n),r)}u.append(h)}),u.append(...a),e.append(u)}const Ot={darken:e=>`color-mix(in srgb, ${e} 60%, black)`,darkenLess:e=>`color-mix(in srgb, ${e} 80%, black)`,lighten:e=>`color-mix(in srgb, ${e} 60%, white)`,lightenLess:e=>`color-mix(in srgb, ${e} 80%, white)`};function V(e,t){const i=e.path;if(!i)return[];const o=i.w===0?0:e.frame.width*t/i.w,r=i.h===0?0:e.frame.height*t/i.h;return[{d:i.steps.map(s=>s.op==="close"?"Z":s.op==="move"?`M ${String(s.x*o)} ${String(s.y*r)}`:s.op==="line"?`L ${String(s.x*o)} ${String(s.y*r)}`:`C ${String(s.x1*o)} ${String(s.y1*r)} ${String(s.x2*o)} ${String(s.y2*r)} ${String(s.x*o)} ${String(s.y*r)}`).join(" "),fill:"norm",stroke:!0}]}function z(e,t){!t.flip?.h&&!t.flip?.v||(e.style.transform=`scale(${t.flip.h?"-1":"1"}, ${t.flip.v?"-1":"1"})`)}const Ct={tl:[0,0],t:[50,0],tr:[100,0],l:[0,50],ctr:[50,50],r:[100,50],bl:[0,100],b:[50,100],br:[100,100]},q=e=>e.picture_fill!==void 0||e.pattern!==void 0||e.gradient?.path!==void 0;function K(e,t,i,o,r){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0px",overflow:"hidden",pointerEvents:"none"}),r!==void 0&&(n.style.clipPath=`path(evenodd, "${r}")`),z(n,e);const s=e.picture_fill;if(s){const c=JSON.stringify(o(s.path));s.transparency!==void 0&&(n.style.opacity=String(1-s.transparency));const u=s.tile,p=document.createElement("img");if(p.alt="",p.src=o(s.path),Object.assign(p.style,{position:"absolute",inset:"0px",width:"100%",height:"100%",maxWidth:"none",objectFit:"fill",...u?{visibility:"hidden"}:{}}),n.append(p),u){const d=j*t*u.scale_x,a=j*t*u.scale_y,[g,m]=Ct[u.align],S=document.createElement("div");Object.assign(S.style,{position:"absolute",left:"0px",top:"0px",width:`${String(e.frame.width*t/d)}px`,height:`${String(e.frame.height*t/a)}px`,transform:`scale(${String(d)}, ${String(a)})`,transformOrigin:"0 0",background:`url(${c}) calc(${String(g)}% + ${String(u.offset_x*t/d)}px) calc(${String(m)}% + ${String(u.offset_y*t/a)}px) / auto repeat`}),n.append(S)}return n}if(!e.pattern&&e.gradient)return n.style.background=T(e.gradient,i),n;const l=e.pattern;if(l){const c=`<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" shape-rendering="crispEdges"><rect width="8" height="8" fill="${colorCss(l.bg,i)}"/><path d="${ut(l.preset)}" fill="${colorCss(l.fg,i)}"/></svg>`,u=8*j*t;n.style.background=`url("data:image/svg+xml,${encodeURIComponent(c)}") 0 0 / ${String(u)}px ${String(u)}px repeat`,n.style.imageRendering="pixelated"}return n}const Nt=new Set(["rect","roundRect","ellipse"]),L=(e,t,i)=>t===void 0||t===0?colorCss(e,i):`color-mix(in srgb, ${colorCss(e,i)} ${String((1-t)*100)}%, transparent)`,T=(e,t)=>{const i=e.stops.map(l=>`${L(l.color,l.transparency,t)} ${String(l.at*100)}%`).join(", ");if(e.path===void 0)return`linear-gradient(${String(e.angle+90)}deg, ${i})`;const o=e.focus??{left:.5,top:.5,right:.5,bottom:.5},r=(o.left+1-o.right)/2*100,n=(o.top+1-o.bottom)/2*100;return`radial-gradient(${e.path==="circle"?"circle farthest-corner":"farthest-side"} at ${String(r)}% ${String(n)}%, ${i})`},J=(e,t)=>e.gradient?T(e.gradient,t):e.fill===null||e.fill===void 0?"transparent":L(e.fill,e.fill_transparency,t);let Dt=0;function zt(e,t,i,o,r){const n=document.createElementNS(e,"linearGradient");n.id=t;const s=i.angle*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=(Math.abs(o.width*l)+Math.abs(o.height*c))/Math.max(o.width,o.height,1)/2;n.setAttribute("x1",String(.5-l*u)),n.setAttribute("y1",String(.5-c*u)),n.setAttribute("x2",String(.5+l*u)),n.setAttribute("y2",String(.5+c*u));for(const p of i.stops){const d=document.createElementNS(e,"stop");d.setAttribute("offset",String(p.at)),d.setAttribute("stop-color",colorCss(p.color,r)),p.transparency!==void 0&&d.setAttribute("stop-opacity",String(1-p.transparency)),n.append(d)}return n}let Lt=0;function Tt(e,t,i,o){const r=[],n="http://www.w3.org/2000/svg",s=[],l=t.frame.width*i,c=t.frame.height*i,u=(t.line_width??LINE_WIDTH)*i*5,p=(f,b)=>{const h=document.createElementNS(n,"filter");h.id=`ak-effect-${String(Lt++)}`;const y=b+u;for(const[x,_]of Object.entries({filterUnits:"userSpaceOnUse",x:String(-y),y:String(-y),width:String(l+2*y),height:String(c+2*y),"color-interpolation-filters":"sRGB"}))h.setAttribute(x,_);f(h),s.push(h),r.push(`url(#${h.id})`)},d=(f,b,h)=>{const y=document.createElementNS(n,b);for(const[x,_]of Object.entries(h))y.setAttribute(x,_);return f.append(y),y};if(t.soft_edges!==void 0&&t.soft_edges>0){const f=t.soft_edges*i;p(b=>{d(b,"feMorphology",{in:"SourceAlpha",operator:"erode",radius:String(f/2),result:"in"}),d(b,"feGaussianBlur",{in:"in",stdDeviation:String(f/4),result:"soft"}),d(b,"feComposite",{in:"SourceGraphic",in2:"soft",operator:"in"})},f)}const a=t.inner_shadow;if(a){const f=a.angle*Math.PI/180,b=a.distance*i;p(h=>{const y=d(h,"feComponentTransfer",{in:"SourceAlpha",result:"out"});d(y,"feFuncA",{type:"table",tableValues:"1 0"}),d(h,"feGaussianBlur",{in:"out",stdDeviation:String(a.blur*i/2),result:"blur"}),d(h,"feOffset",{in:"blur",dx:String(b*Math.cos(f)),dy:String(b*Math.sin(f)),result:"moved"}),d(h,"feFlood",{"flood-color":colorCss(a.color,o),"flood-opacity":String(1-a.transparency),result:"ink"}),d(h,"feComposite",{in:"ink",in2:"moved",operator:"in",result:"shadow"}),d(h,"feComposite",{in:"shadow",in2:"SourceAlpha",operator:"in",result:"inside"});const x=d(h,"feMerge",{});d(x,"feMergeNode",{in:"SourceGraphic"}),d(x,"feMergeNode",{in:"inside"})},(a.blur*2+a.distance)*i)}const g=t.shadow,m=t.glow&&t.glow.size>0?t.glow:void 0;if(g&&!m){const f=g.angle*Math.PI/180,b=g.distance*i;r.push(`drop-shadow(${String(b*Math.cos(f))}px ${String(b*Math.sin(f))}px ${String(g.blur*i)}px ${L(g.color,g.transparency,o)})`)}if(m){const f=m.size*i;p(b=>{d(b,"feMorphology",{in:"SourceAlpha",operator:"dilate",radius:String(f/2),result:"wide"}),d(b,"feGaussianBlur",{in:"wide",stdDeviation:String(f/4),result:"halo"}),d(b,"feFlood",{"flood-color":colorCss(m.color,o),"flood-opacity":String(1-m.transparency),result:"ink"}),d(b,"feComposite",{in:"ink",in2:"halo",operator:"in",result:"glow"});const h=d(b,"feMerge",{});if(g){const y=g.angle*Math.PI/180,x=g.distance*i;d(b,"feGaussianBlur",{in:"SourceAlpha",stdDeviation:String(g.blur*i/2),result:"cast"}),d(b,"feOffset",{in:"cast",dx:String(x*Math.cos(y)),dy:String(x*Math.sin(y)),result:"moved"}),d(b,"feFlood",{"flood-color":colorCss(g.color,o),"flood-opacity":String(1-g.transparency),result:"dark"}),d(b,"feComposite",{in:"dark",in2:"moved",operator:"in",result:"shadow"}),b.append(h),d(h,"feMergeNode",{in:"shadow"})}d(h,"feMergeNode",{in:"glow"}),d(h,"feMergeNode",{in:"SourceGraphic"})},Math.max(f*2,g?(g.blur*1.5+g.distance)*i:0))}if(s.length>0){const f=document.createElementNS(n,"svg");f.setAttribute("width","0"),f.setAttribute("height","0"),Object.assign(f.style,{position:"absolute"}),f.setAttribute("aria-hidden","true"),f.append(...s),e.append(f)}r.length>0&&(e.style.filter=r.join(" "));const S=t.reflection;S&&e.style.setProperty("-webkit-box-reflect",`below ${String(S.distance*i)}px linear-gradient(to bottom, transparent ${String((1-S.size)*100)}%, rgba(0, 0, 0, ${String(1-S.transparency)}))`)}function Ft(e,t,i){const o=t.geometry??"rect",r=t.frame.width*i,n=t.frame.height*i;o==="roundRect"?e.style.borderRadius=`${String(Math.min(r,n)*Math.min(.5,Math.max(0,t.adjustments?.[0]??Q("roundRect")[0]??0)))}px`:o==="ellipse"&&(e.style.borderRadius="50%")}const It={left:"borderLeft",right:"borderRight",top:"borderTop",bottom:"borderBottom"},Y="http://www.w3.org/2000/svg";function Ht(e,t,i,o,r){const n=i.width/k,s=i.height/k,l=o*k,c=tt(t,n,s),u=document.createElementNS(Y,"svg");u.setAttribute("viewBox",`0 0 ${String(n)} ${String(s)}`),u.setAttribute("width","100%"),u.setAttribute("height","100%"),Object.assign(u.style,{position:"absolute",inset:"0px",overflow:"visible"});const p=(a,g)=>{const m=document.createElementNS(Y,a);for(const[S,f]of Object.entries(g))m.setAttribute(S,String(f));u.append(m)},d=a=>{p("path",{d:a.d,fill:a.fill===void 0?"none":colorCss(a.fill,r),stroke:a.width>0?colorCss(a.color,r):"none","stroke-width":a.width,"stroke-linejoin":"round"})};for(const a of[...c.grid,...c.shapes])d(a);for(const a of[...c.boxes,...c.keys])p("rect",{x:a.x,y:a.y,width:a.width,height:a.height,fill:colorCss(a.color,r)});for(const a of[...c.axes,...c.lines])d(a);for(const a of c.dots)p("circle",{cx:a.x,cy:a.y,r:a.r,fill:colorCss(a.color,r)});e.append(u);for(const a of c.words){const g=document.createElement("div");g.textContent=a.text,Object.assign(g.style,{position:"absolute",left:`${String(a.x*l)}px`,top:`${String(a.y*l)}px`,transform:`translate(${{start:"0",middle:"-50%",end:"-100%"}[a.anchor]}, -50%)${a.rotate===void 0?"":` rotate(${String(a.rotate)}deg)`}`,transformOrigin:`${{start:"0%",middle:"50%",end:"100%"}[a.anchor]} 50%`,fontSize:`${String(a.size*l)}px`,lineHeight:"1",whiteSpace:"nowrap",color:colorCss(a.color,r),fontFamily:"var(--ak-theme-minor)"}),e.append(g)}}function Bt(e,t,i,o,r){const n=ft(t.style),s=document.createElement("table");n?.background!==void 0&&(s.style.background=colorCss(n.background,r)),Object.assign(s.style,{borderCollapse:"collapse",tableLayout:"fixed",width:`${String(t.columns.reduce((c,u)=>c+u,0)*i)}px`});const l=document.createElement("colgroup");for(const c of t.columns){const u=document.createElement("col");u.style.width=`${String(c*i)}px`,l.append(u)}s.append(l);for(const[c,u]of t.rows.entries()){const p=document.createElement("tr");p.style.height=`${String(u.height*i)}px`;for(const[d,a]of u.cells.entries()){if(a.spanned)continue;const g=document.createElement("td");g.dataset.akCell=`${String(c)},${String(d)}`,a.span_width&&(g.colSpan=a.span_width),a.span_height&&(g.rowSpan=a.span_height),g.style.padding="0px",g.style.verticalAlign={t:"top",ctr:"middle",b:"bottom"}[a.text.style.vertical_anchor];const m=n?X(n,t,c,d,t.rows.length,t.columns.length,c+(a.span_height??1)-1,d+(a.span_width??1)-1):void 0,S=a.fill!==void 0?a.fill:m?.fill;S!==void 0&&(g.style.background=colorCss(S,r));for(const[b,h]of Object.entries(It)){const y=b,x=a.borders?.[y]??m?.borders[y];x&&(g.style[h]=`${String(x.width*i)}px solid ${colorCss(x.color,r)}`)}const f=A(a.text,i,o,r);f.style.minHeight="0px",g.append(f),p.append(g)}s.append(p)}e.style.height="auto",e.append(s)}export function drawShape(e,t,i){const{k:o,colors:r}=i;if(t.kind==="placeholder"&&t.text?.empty===!0&&!i.editing)return;const n=document.createElement("div");n.setAttribute(SHAPE_ATTR,`${e}/${t.name}`);const{left:s,top:l,width:c,height:u}=t.frame;Object.assign(n.style,{position:"absolute",left:`${String(s*o)}px`,top:`${String(l*o)}px`,width:`${String(c*o)}px`,height:`${String(u*o)}px`}),t.rotation!==void 0&&(n.style.transform=`rotate(${String(t.rotation)}deg)`);const p=(t.line_width??LINE_WIDTH)*o;if(t.chart)Ht(n,t.chart,t.frame,o,r);else if(t.table)return Bt(n,t.table,o,i.lang,r),n;Tt(n,t,o,r),t.alt!==void 0&&n.setAttribute("aria-label",t.alt);let d;if(t.kind==="autoshape"){if(!t.path&&rt(t.geometry))return $t(n,t,o,p,r),n;const a=t.path?void 0:H(t.geometry??"rect",t.frame.width*o,t.frame.height*o,t.adjustments),g=t.line!==void 0&&t.line!==null&&(t.line_dash!==void 0&&t.line_dash!=="solid"||t.line_compound!==void 0&&t.line_compound!=="sng"||t.line_join!==void 0&&t.line_join!==$.join);if(q(t)){const S=t.path?V(t,o):a?.paths??[],f=S.filter(h=>h.fill!=="none").map(h=>h.d).join(" ");n.append(K(t,o,r,i.url,f));const b={...t,fill:null};return delete b.gradient,Z(n,b,S,o,p,r),t.text&&n.append(A(t.text,o,i.lang,r,a?.text)),n}const m=t.path?V(t,o):Nt.has(t.geometry??"rect")&&!g?void 0:a?.paths;if(m)return Z(n,t,m,o,p,r),t.text&&n.append(A(t.text,o,i.lang,r,a?.text)),n;n.style.background=J(t,r),Ft(n,t,o),d=a?.text}else q(t)?n.append(K(t,o,r,i.url,void 0)):(t.fill!==void 0||t.gradient)&&(n.style.background=J(t,r));if(t.line!==void 0&&t.line!==null&&(n.style.outline=`${String(p)}px ${t.line_dash===void 0||t.line_dash==="solid"?"solid":"dashed"} ${colorCss(t.line,r)}`,n.style.outlineOffset=`${String(-p/2)}px`),t.text?.style.auto_size==="shape"&&t.text.style.orientation==="horz"&&(n.style.height="auto",n.style.minHeight="0px"),t.kind==="picture"&&t.media){n.style.overflow="hidden";const a=document.createElement("img");a.alt=t.alt??"",a.src=i.url(t.media.path),z(a,t);const g=t.media.crop??{left:0,top:0,right:0,bottom:0},m=1-g.left-g.right,S=1-g.top-g.bottom;Object.assign(a.style,{position:"absolute",width:`${String(100/m)}%`,height:`${String(100/S)}%`,left:`${String(-g.left/m*100)}%`,top:`${String(-g.top/S*100)}%`,maxWidth:"none"}),t.flip&&(a.style.transformOrigin=`${String(50/m-g.left/m*100)}% ${String(50/S-g.top/S*100)}%`),n.append(a)}else if(t.kind==="movie"&&t.media&&!i.playing&&i.poster!==!0)n.dataset.akFilm="";else if(t.kind==="movie"&&t.media){const a=document.createElement("video");a.src=i.url(t.media.path),a.muted=!0,a.playsInline=!0,a.preload="auto",t.media.poster!==void 0&&(a.currentTime=t.media.poster),Object.assign(a.style,{width:"100%",height:"100%",objectFit:"fill",...i.playing?{}:{pointerEvents:"none"}}),n.append(a)}if(t.kind==="item"&&t.item&&(n.dataset.akItem=t.item.path,i.editing)){const a=document.createElement("div");a.textContent=t.item.path,Object.assign(a.style,{position:"absolute",inset:"0px",display:"grid",placeItems:"center",padding:`${String(8*o)}px`,font:`${String(Math.max(10,14*o))}px/1.3 system-ui, sans-serif`,color:"#595959",background:"rgba(127, 127, 127, 0.12)",overflowWrap:"anywhere",textAlign:"center"}),n.append(a)}if(t.kind==="audio"&&t.media&&(!i.editing&&t.media.playback?.hide===!0&&(n.style.visibility="hidden"),n.append(Rt()),i.playing)){const a=document.createElement("audio");a.src=i.url(t.media.path),a.preload="auto",n.append(a)}return t.text&&n.append(A(t.text,o,i.lang,r,d)),n}const F="http://www.w3.org/2000/svg";function Rt(){const e=document.createElementNS(F,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.setAttribute("stroke","#595959"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linejoin","round"),Object.assign(e.style,{width:"100%",height:"100%",display:"block"});const t=document.createElementNS(F,"polygon");t.setAttribute("points","11 5 6 9 2 9 2 15 6 15 11 19 11 5"),t.setAttribute("fill","#595959"),e.append(t);for(const i of["M15.54 8.46a5 5 0 0 1 0 7.07","M19.07 4.93a10 10 0 0 1 0 14.14"]){const o=document.createElementNS(F,"path");o.setAttribute("d",i),e.append(o)}return e}export function slideBackgroundCss(e,t,i){return e.background_picture!==void 0?`${colorCss(e.background,t)} url(${JSON.stringify(i(e.background_picture))}) center / 100% 100% no-repeat`:e.background_gradient?T(e.background_gradient,t):colorCss(e.background,t)}export function drawSlide(e,t){const i=document.createElement("div");i.dataset.akSlide=e.id;const o={...t,colors:st(t.colors,e.color_map)};Object.assign(i.style,{position:"absolute",inset:"0px",background:slideBackgroundCss(e,o.colors,t.url),overflow:"hidden"});for(const r of e.shapes){const n=drawShape(e.id,r,o);n&&i.append(n)}return i}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{LAYER_BRAND as k,itemSource as b}from"@allyhub/piece";import{placePlan as $}from"@allyhub/audio";import{runtimeOf as g}from"@allyhub/piece/page";const y=1/30,w=(i,o)=>Object.fromEntries(Object.entries(i).map(([t,e])=>{const n=o[t];return[t,n!==void 0&&e.includes(n)?n:e[0]??""]}));export function itemTime(i,o,t){const e=t.playback?.trim?.start??0,r=Math.min(o,t.playback?.trim?.end??o)-e,d=Math.max(0,i-t.delay);return r<=0?Math.max(0,Math.min(e,o-y)):t.playback?.loop===!0?e+d%r:e+Math.min(d,r-y)}export function itemLayer(i){const{source:o,options:t,shape:e}=i;let n,r=0;return{[k]:"graphic",component:`item:${e.path}`,props:{of:e.path},mount(d,p,s){const a=Object.entries(o.pieces??{}).find(([,u])=>u.file===e.path),c=a?b(o,a[0]):void 0,m=a?.[1].kind===void 0?void 0:g(a[1].kind);if(!a||!c||!m){a&&s.report?.({code:"AK-M016",message:c?`${e.path} is a ${a[1].kind??"kind"} the stage has no runtime for.`:`${e.path} is not one the build gave ${o.piece} to draw live.`});return}const l=document.createElement("div");Object.assign(l.style,{position:"absolute",left:"0px",top:"0px",transformOrigin:"0 0"}),d.style.overflow="hidden",d.append(l),s.wait((async()=>{const u=await m(c,{combo:w(a[1].dims,s.combo),purpose:t.purpose,inside:o.piece},l);await u.ready();const f=u.summary().timeline;r=f.duration,i.lengths.set(e.path,r),i.drawn.set(e.path,u);const h=Math.min(s.dims.width/f.width,s.dims.height/f.height);l.style.transform=`translate(${String((s.dims.width-f.width*h)/2)}px, ${String((s.dims.height-f.height*h)/2)}px) scale(${String(h)})`,n=u})())},render(d,p,s,a){n&&a.wait(n.seek(itemTime(p,r,e)))},unmount(){n&&(i.kept.set(e.path,{reads:n.summary().reads,problems:n.problems()}),i.drawn.delete(e.path)),n?.dispose(),n=void 0}}}export function itemOfReference(i,o){const t=o.indexOf("#"),e=t<0?o:o.slice(0,t),n=t<0?"":o.slice(t+1),r=e.startsWith("/")?[]:i.file.split("/").slice(0,-1);for(const s of e.split("/"))s===".."?r.pop():s!=="."&&s!==""&&r.push(s);const d=r.join("/"),p=Object.entries(i.pieces??{}).find(([,s])=>s.file===d&&s.module!==void 0);if(p)return{id:p[0],path:d,...n===""?{}:{part:n}}}function x(i,o,t){const e=i.summary().timeline.parts,n=/^\d+$/u.test(o??"")?Number(o)-1:-1,r=o===void 0?e[0]:e.find(d=>d.key===o)??e[n];if(o!==void 0&&!r)throw new Error(`${o} is no part of the item (it has ${e.map(d=>d.key).join(", ")}).`);return r?t>0?r.start+t:r.still:t}export async function drawItemAlone(i,o,t,e){const n=itemOfReference(i,e.of),r=n?b(i,n.id):void 0,d=n?i.pieces?.[n.id]?.kind:void 0,p=d===void 0?void 0:g(d);if(!n||!r||!p)throw new Error(`${e.of} names no item the build gave ${i.piece} to draw (AK-M016).`);const s=document.createElement("div");Object.assign(s.style,{position:"absolute",left:"0px",top:"0px",transformOrigin:"0 0"}),t.append(s);const a=await p(r,{combo:w(i.pieces?.[n.id]?.dims??{},o.combo),purpose:o.purpose,inside:i.piece},s);await a.ready();const c=a.summary().timeline,m=Math.min(e.width/c.width,e.height/c.height);return s.style.transform=`translate(${String((e.width-c.width*m)/2)}px, ${String((e.height-c.height*m)/2)}px) scale(${String(m)})`,await a.seek(x(a,n.part,e.t)),a}export function itemsRead(i,o){const t=new Map(o);for(const[e,n]of i)t.set(e,{reads:n.summary().reads,problems:n.problems()});return[...t].map(([e,n])=>({path:e,...n}))}export async function itemSounds(i){const o=new Map;for(const t of new Set(i.items.map(e=>e.path))){const e=Object.entries(i.source.pieces??{}).find(([,p])=>p.file===t),n=e?b(i.source,e[0]):void 0,r=e?.[1].kind===void 0?void 0:g(e[1].kind);if(!e||!n||!r){o.set(t,void 0);continue}const d=document.createElement("div");Object.assign(d.style,{position:"absolute",left:"0px",top:"0px",visibility:"hidden",pointerEvents:"none"}),document.body.append(d);try{const p=await r(n,{combo:w(e[1].dims,i.options.combo),purpose:i.options.purpose,inside:i.source.piece},d);await p.ready();const s=p.mixPlan;o.set(t,typeof s=="function"?s.call(p):void 0),p.dispose()}finally{d.remove()}}return i.items.flatMap(t=>{const e=o.get(t.path);return e?[$(e,{at:t.at,...t.begin===void 0?{}:{begin:t.begin},...t.end===void 0?{}:{end:t.end},loop:t.loop,until:t.until})]:[]})}
|