@allyhub/sdk 0.8.0 → 0.9.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 +11 -0
- package/NOTICE +46 -49
- package/dist/dom.d.ts +1 -209
- package/dist/dom.js +1 -1
- package/dist/image.d.ts +2 -0
- package/dist/image.js +2 -0
- package/dist/index.d.ts +1 -21
- package/dist/index.js +1 -1
- package/dist/media.d.ts +1 -5
- package/dist/media.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/levels.d.ts +4 -5
- package/dist/node_modules/@allyhub/audio/dist/levels.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.d.ts +1 -6
- package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.js +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.d.ts +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/LICENSE +241 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/fact.d.ts +37 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/fact.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/index.d.ts +4 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +43 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.d.ts +30 -0
- package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +2 -0
- package/dist/node_modules/@allyhub/diagnostics/package.json +14 -0
- package/dist/node_modules/@allyhub/formats/dist/contributed.d.ts +126 -0
- package/dist/node_modules/@allyhub/formats/dist/contributed.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +7 -12
- package/dist/node_modules/@allyhub/formats/dist/data/reference.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/script.d.ts +9 -4
- package/dist/node_modules/@allyhub/formats/dist/data/script.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +20 -82
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +96 -8
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.d.ts +2 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/extension.d.ts +91 -0
- package/dist/node_modules/@allyhub/formats/dist/extension.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/files.d.ts +51 -0
- package/dist/node_modules/@allyhub/formats/dist/files.js +2 -0
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +5 -1
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +226 -90
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +7 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +46 -42
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-draw/dist/context.d.ts +5 -0
- package/dist/node_modules/@allyhub/image-draw/dist/context.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/contrast.d.ts +13 -0
- package/dist/node_modules/@allyhub/image-draw/dist/contrast.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/env.d.ts +112 -0
- package/dist/node_modules/@allyhub/image-draw/dist/env.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/errors.d.ts +20 -0
- package/dist/node_modules/@allyhub/image-draw/dist/errors.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.d.ts +110 -0
- package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/guards.d.ts +32 -0
- package/dist/node_modules/@allyhub/image-draw/dist/guards.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/hash.d.ts +3 -0
- package/dist/node_modules/@allyhub/image-draw/dist/hash.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.d.ts +113 -0
- package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +3 -0
- package/dist/node_modules/@allyhub/image-draw/dist/layer-style.d.ts +151 -0
- package/dist/node_modules/@allyhub/image-draw/dist/layer-style.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/paint.d.ts +29 -0
- package/dist/node_modules/@allyhub/image-draw/dist/paint.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/pictures.d.ts +39 -0
- package/dist/node_modules/@allyhub/image-draw/dist/pictures.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/plan.d.ts +52 -0
- package/dist/node_modules/@allyhub/image-draw/dist/plan.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/reads.d.ts +145 -0
- package/dist/node_modules/@allyhub/image-draw/dist/reads.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/shape-path.d.ts +26 -0
- package/dist/node_modules/@allyhub/image-draw/dist/shape-path.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/stage.d.ts +56 -0
- package/dist/node_modules/@allyhub/image-draw/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/styles.d.ts +35 -0
- package/dist/node_modules/@allyhub/image-draw/dist/styles.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/dist/tone.d.ts +53 -0
- package/dist/node_modules/@allyhub/image-draw/dist/tone.js +2 -0
- package/dist/node_modules/@allyhub/image-draw/package.json +14 -0
- package/dist/node_modules/@allyhub/image-measure/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-measure/dist/contrast.d.ts +43 -0
- package/dist/node_modules/@allyhub/image-measure/dist/contrast.js +2 -0
- package/dist/node_modules/@allyhub/image-measure/dist/layout.d.ts +186 -0
- package/dist/node_modules/@allyhub/image-measure/dist/layout.js +5 -0
- package/dist/node_modules/@allyhub/image-measure/package.json +14 -0
- package/dist/node_modules/@allyhub/image-sdk/LICENSE +241 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.d.ts +13 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.js +2 -0
- package/dist/{define.d.ts → node_modules/@allyhub/image-sdk/dist/define.d.ts} +21 -4
- package/dist/node_modules/@allyhub/image-sdk/dist/define.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/dom.d.ts +210 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/dom.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/fill.d.ts +21 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/fill.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/group.d.ts +17 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/group.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.d.ts +166 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/media.d.ts +6 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/media.js +2 -0
- package/dist/{messages.d.ts → node_modules/@allyhub/image-sdk/dist/messages.d.ts} +1 -1
- package/dist/node_modules/@allyhub/image-sdk/dist/picture.d.ts +59 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/picture.js +2 -0
- package/dist/{props.d.ts → node_modules/@allyhub/image-sdk/dist/props.d.ts} +4 -4
- package/dist/node_modules/@allyhub/image-sdk/dist/shape.d.ts +34 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/shape.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/stack.d.ts +16 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/stack.js +2 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.d.ts +38 -0
- package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.js +2 -0
- package/dist/{written.js → node_modules/@allyhub/image-sdk/dist/written.js} +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +19 -0
- package/dist/node_modules/@allyhub/measure/LICENSE +241 -0
- package/dist/node_modules/@allyhub/measure/dist/compare.d.ts +195 -0
- package/dist/node_modules/@allyhub/measure/dist/compare.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/grain.d.ts +8 -0
- package/dist/node_modules/@allyhub/measure/dist/grain.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/image.d.ts +16 -0
- package/dist/node_modules/@allyhub/measure/dist/image.js +2 -0
- package/dist/node_modules/@allyhub/measure/dist/index.d.ts +4 -0
- package/dist/node_modules/@allyhub/measure/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/measure/package.json +13 -0
- package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.d.ts +4 -1
- package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.d.ts +15 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/LICENSE +241 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.d.ts +1 -9
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/context.d.ts +39 -0
- package/dist/node_modules/@allyhub/piece/dist/context.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.d.ts +2 -2
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/export.d.ts +27 -10
- package/dist/node_modules/@allyhub/piece/dist/export.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/formats.d.ts +12 -68
- package/dist/node_modules/@allyhub/piece/dist/formats.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +104 -0
- package/dist/node_modules/@allyhub/piece/dist/index.d.ts +26 -0
- package/dist/node_modules/@allyhub/piece/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layer-style.d.ts +1558 -0
- package/dist/node_modules/@allyhub/piece/dist/layer-style.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +389 -0
- package/dist/node_modules/@allyhub/piece/dist/layer.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +421 -0
- package/dist/node_modules/@allyhub/piece/dist/layout.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.d.ts +1 -1
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.d.ts +39 -9
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.js +1 -1
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.d.ts +6 -0
- package/dist/node_modules/@allyhub/piece/dist/names.d.ts +26 -0
- package/dist/node_modules/@allyhub/piece/dist/names.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/console.d.ts +21 -0
- package/dist/node_modules/@allyhub/piece/dist/page/console.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +3 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +4 -0
- package/dist/node_modules/@allyhub/piece/dist/page/locate.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/picture.d.ts +62 -0
- package/dist/node_modules/@allyhub/piece/dist/picture.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/piece.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/piece.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/script.d.ts +9 -4
- package/dist/node_modules/@allyhub/piece/dist/script.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +131 -0
- package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +285 -0
- package/dist/node_modules/@allyhub/piece/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/version.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/version.js +2 -0
- package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.d.ts +1 -20
- package/dist/node_modules/@allyhub/piece/package.json +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +139 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/app.d.ts +3 -10
- package/dist/node_modules/@allyhub/protocol/dist/app.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +12 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +232 -132
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/files.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +22 -9
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/image.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/image.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +5 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +98 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +273 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +26 -0
- package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/peer.d.ts +59 -0
- package/dist/node_modules/@allyhub/protocol/dist/peer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.d.ts +21 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +125 -0
- package/dist/node_modules/@allyhub/protocol/dist/presence.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/registry.d.ts +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shape.d.ts +35 -0
- package/dist/node_modules/@allyhub/protocol/dist/shape.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +2 -8
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +70 -40
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +224 -177
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/bundled.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/declared.d.ts +14 -0
- package/dist/node_modules/@allyhub/runtimes/dist/declared.js +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.d.ts +15 -0
- package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.js +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +2 -0
- package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.d.ts +1 -0
- package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +1 -1
- package/dist/node_modules/@allyhub/runtimes/manifest.json +0 -82
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/define.d.ts +2 -0
- package/dist/node_modules/@allyhub/scenery/dist/define.js +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/code.d.ts +4 -4
- package/dist/node_modules/@allyhub/sheet/dist/api/code.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +15 -11
- package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/server.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.d.ts +5 -0
- package/dist/node_modules/@allyhub/sheet/dist/file.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/generated.d.ts +5 -19
- package/dist/node_modules/@allyhub/sheet/dist/generated.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/import.d.ts +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +3 -4
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +76 -1
- package/dist/node_modules/@allyhub/sheet/dist/patch.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/patch.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/sdk.d.ts +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/sdk.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +6 -6
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +5 -1
- package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +23 -7
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +44 -4
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +18 -1
- package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/code.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/connect.d.ts +62 -0
- package/dist/node_modules/@allyhub/slides-core/dist/connect.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +208 -0
- package/dist/node_modules/@allyhub/slides-core/dist/fact.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +4 -4
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.d.ts +4 -2
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/merge.d.ts +5 -5
- package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +19 -2
- package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/path.d.ts +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +17 -10
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +18 -0
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +2 -0
- package/dist/node_modules/@allyhub/slides-core/dist/stage.d.ts +28 -11
- package/dist/node_modules/@allyhub/slides-core/dist/units.d.ts +3 -6
- package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +5 -1
- package/dist/node_modules/@allyhub/video-core/dist/audio-types.d.ts +1 -2
- package/dist/node_modules/@allyhub/video-core/dist/captions.d.ts +1 -10
- package/dist/node_modules/@allyhub/video-core/dist/captions.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/check.d.ts +62 -0
- package/dist/node_modules/@allyhub/video-core/dist/check.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/cut-report.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/cut-report.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/edits.d.ts +3 -3
- package/dist/node_modules/@allyhub/video-core/dist/edits.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/fact.d.ts +21 -762
- package/dist/node_modules/@allyhub/video-core/dist/fact.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.d.ts +3 -2
- package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/index.d.ts +3 -17
- package/dist/node_modules/@allyhub/video-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/measure.d.ts +72 -423
- package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -4
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.d.ts +44 -0
- package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/motion.d.ts +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +22 -430
- package/dist/node_modules/@allyhub/video-core/dist/piece.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/placement.d.ts +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +6 -12
- package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/script-edit.d.ts +11 -6
- package/dist/node_modules/@allyhub/video-core/dist/script-edit.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/seams.d.ts +2 -3
- package/dist/node_modules/@allyhub/video-core/dist/sound-under.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/sound-under.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/speech.d.ts +2 -4
- package/dist/node_modules/@allyhub/video-core/dist/speech.js +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/stage.d.ts +52 -0
- package/dist/node_modules/@allyhub/video-core/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +18 -136
- package/dist/node_modules/@allyhub/video-core/dist/timeline.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/timing.d.ts +3 -3
- package/dist/node_modules/@allyhub/video-core/dist/timing.js +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/transcript.d.ts +2 -2
- package/dist/node_modules/@allyhub/video-core/dist/transcript.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/LICENSE +241 -0
- package/dist/node_modules/@allyhub/video-sdk/NOTICE +118 -0
- package/dist/{free.d.ts → node_modules/@allyhub/video-sdk/dist/free.d.ts} +14 -10
- package/dist/node_modules/@allyhub/video-sdk/dist/free.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/index.d.ts +28 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/index.js +2 -0
- package/dist/{input.d.ts → node_modules/@allyhub/video-sdk/dist/input.d.ts} +76 -22
- package/dist/node_modules/@allyhub/video-sdk/dist/input.js +2 -0
- package/dist/{module.d.ts → node_modules/@allyhub/video-sdk/dist/module.d.ts} +6 -4
- package/dist/node_modules/@allyhub/video-sdk/dist/module.js +2 -0
- package/dist/{parts.d.ts → node_modules/@allyhub/video-sdk/dist/parts.d.ts} +15 -6
- package/dist/node_modules/@allyhub/video-sdk/dist/parts.js +2 -0
- package/dist/{piece.d.ts → node_modules/@allyhub/video-sdk/dist/piece.d.ts} +26 -16
- package/dist/node_modules/@allyhub/video-sdk/dist/piece.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/route.d.ts +46 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/route.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/scenery.d.ts +2 -0
- package/dist/node_modules/@allyhub/video-sdk/dist/scenery.js +2 -0
- package/dist/node_modules/@allyhub/video-sdk/package.json +19 -0
- package/dist/scenery.d.ts +1 -1
- package/dist/scenery.js +1 -1
- package/dist/sheets.d.ts +1 -1
- package/dist/sheets.js +1 -1
- package/dist/slides.d.ts +1 -9
- package/dist/slides.js +1 -1
- package/docs/README.md +8 -6
- package/docs/batches.md +5 -5
- package/docs/contract.md +2 -2
- package/docs/defaults.md +278 -20
- package/docs/docs.md +77 -63
- package/docs/footage.md +7 -7
- package/docs/image.md +165 -0
- package/docs/layers.md +22 -13
- package/docs/modeling.md +4 -4
- package/docs/pictures.md +65 -0
- package/docs/project.md +51 -31
- package/docs/scenery.md +11 -11
- package/docs/sheets.md +26 -25
- package/docs/slides.md +73 -65
- package/docs/sound.md +3 -3
- package/docs/speech.md +8 -8
- package/docs/video.md +16 -13
- package/docs/websites.md +4 -4
- package/package.json +7 -2
- package/dist/define.js +0 -2
- package/dist/free.js +0 -2
- package/dist/input.js +0 -2
- package/dist/module.js +0 -2
- package/dist/node_modules/@allyhub/formats/dist/data/comments.d.ts +0 -94
- package/dist/node_modules/@allyhub/formats/dist/data/comments.js +0 -2
- package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package-lock.json +0 -227
- package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package.json +0 -8
- package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package-lock.json +0 -105
- package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package.json +0 -8
- package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package-lock.json +0 -128
- package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package.json +0 -9
- package/dist/node_modules/@allyhub/video-core/dist/export.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/formats.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/gen.d.ts +0 -37
- package/dist/node_modules/@allyhub/video-core/dist/problem.d.ts +0 -278
- package/dist/node_modules/@allyhub/video-core/dist/problem.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/script.js +0 -2
- package/dist/node_modules/@allyhub/video-core/dist/source.d.ts +0 -7
- package/dist/parts.js +0 -2
- package/dist/piece.js +0 -2
- /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.js +0 -0
- /package/dist/{fit.d.ts → node_modules/@allyhub/image-sdk/dist/fit.d.ts} +0 -0
- /package/dist/{fit.js → node_modules/@allyhub/image-sdk/dist/fit.js} +0 -0
- /package/dist/{messages.js → node_modules/@allyhub/image-sdk/dist/messages.js} +0 -0
- /package/dist/{props.js → node_modules/@allyhub/image-sdk/dist/props.js} +0 -0
- /package/dist/{text.d.ts → node_modules/@allyhub/image-sdk/dist/text.d.ts} +0 -0
- /package/dist/{text.js → node_modules/@allyhub/image-sdk/dist/text.js} +0 -0
- /package/dist/{written.d.ts → node_modules/@allyhub/image-sdk/dist/written.d.ts} +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/gen.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/source.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.js +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.d.ts +0 -0
- /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.js +0 -0
- /package/dist/{anim.d.ts → node_modules/@allyhub/video-sdk/dist/anim.d.ts} +0 -0
- /package/dist/{anim.js → node_modules/@allyhub/video-sdk/dist/anim.js} +0 -0
- /package/dist/{noise.d.ts → node_modules/@allyhub/video-sdk/dist/noise.d.ts} +0 -0
- /package/dist/{noise.js → node_modules/@allyhub/video-sdk/dist/noise.js} +0 -0
- /package/dist/{paths.d.ts → node_modules/@allyhub/video-sdk/dist/paths.d.ts} +0 -0
- /package/dist/{paths.js → node_modules/@allyhub/video-sdk/dist/paths.js} +0 -0
- /package/dist/{phone.d.ts → node_modules/@allyhub/video-sdk/dist/phone.d.ts} +0 -0
- /package/dist/{phone.js → node_modules/@allyhub/video-sdk/dist/phone.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{colorOfFile as Q}from"@allyhub/formats";import{readMarks as ge,markRuns as _e}from"@allyhub/video-core";import{chartOfFile as be}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ee,DRAWN_TEXTBOX_FRAME as ne,TEXT_FALLBACK as te,TEXT_INSETS as W,isConnectorGeometry as ye,placeholderFrame as $e,styleKindOf as xe}from"./office.js";import{resolveAnimation as we,resolveTransition as ie}from"./animation.js";import{pathSteps as ke}from"./path.js";import{masterPlaceholder as ve}from"./placeholders.js";import{DECK_FONTS as Se,OFFICE_THEME as Ae,themeOver as Oe}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=i===""?[]:i.split("/");for(const o of t.split("/"))o===""||o==="."||(o===".."?u.pop():u.push(o));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...te,font:{...te.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,o)=>{let r={...u,font:{...u.font}};for(const y of t){const l=y?.[o];l&&(r={...r,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...r.font,...l.font}},l.numbered!==void 0&&(r.numbered=l.numbered,delete r.bullet),l.bullet===null?(delete r.bullet,delete r.numbered):l.bullet!==void 0?(delete r.numbered,r.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&r.bullet&&(r.bullet={...r.bullet,font:l.bullet_font}))}return r})}function I(i,...t){const u=t.filter(r=>r!==void 0),o=r=>{for(let y=u.length-1;y>=0;y--){const l=u[y]?.[r];if(l!==void 0)return l}};return{vertical_anchor:o("vertical_anchor")??i.vertical_anchor,auto_size:o("auto_size")??i.auto_size,word_wrap:o("word_wrap")??i.word_wrap,margins:{left:o("margin_left")??W.left,top:o("margin_top")??W.top,right:o("margin_right")??W.right,bottom:o("margin_bottom")??W.bottom}}}const oe={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function Te(i,t,...u){return{...I($e(t),...u),levels:levelsOver(U(),i.text_styles[xe(t)],...u.map(o=>o?.levels))}}const je=Array.from({length:9},()=>({font:{color:C.font_color}})),ae={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,je,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),z=i=>i==="none"?null:colorOfFile(i),Ee=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Fe=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Ne=256,de="",ze=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>Q(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(o=>({at:o.at,color:colorOfFile(o.color),...o.transparency===void 0?{}:{transparency:o.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:S(t.blur),distance:t.distance===void 0?H.distance:S(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function se(i,t,u=[]){return{...i,rows:i.rows.map((o,r)=>({height:o.height,cells:o.cells.map(y=>{const l=u[r];return{...y,text:{paragraphs:y.text.paragraphs,style:B({...V(t,y.text),auto_size:"shape"},l),own:X(y.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const o={...u.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(o.color=colorOfFile(t.color));const r={...u,font:o,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:S(t.space_before)},...t.space_after===void 0?{}:{space_after:S(t.space_after)}};return t.numbered!==void 0?(r.numbered=t.numbered,delete r.bullet):t.bullet===!1?(delete r.bullet,delete r.numbered):t.bullet!==void 0&&(r.bullet={char:t.bullet},delete r.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...r,margin_left:fe,indent:-fe}:r})}:i}function Me(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(o=>{const r={...o};return t.align!==void 0&&delete r.alignment,t.line_spacing!==void 0&&delete r.line_spacing,t.space_before!==void 0&&delete r.space_before,t.space_after!==void 0&&delete r.space_after,u&&(delete r.bullet,delete r.bullet_font,delete r.numbered),r})}function Ce(i){const t={};for(const[,u,o=""]of i.matchAll(Fe))if(u==="font")t.name=o.trim();else if(u==="link")t.link=o.trim();else if(u==="highlight")t.highlight=o.trim().toUpperCase();else if(u==="bold")t.bold=o.trim()!=="false";else if(u==="italic")t.italic=o.trim()!=="false";else if(u==="strike")t.strike=o.trim()!=="false";else if(u==="underline")t.underline=o.trim()!=="false";else if(u==="size"){const r=Number(o);Number.isFinite(r)&&r>0&&(t.size=S(r))}else if(u==="baseline"){const r=Number(o);Number.isFinite(r)&&(t.baseline=r)}else{const r=Q(o.trim());r!==void 0&&(t.color=r)}return t}const fe=342900;export function paragraphsOfWords(i,t=0,u=Se.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(o=>{const r=[],y=o.replace(Ee,(T,N,P)=>(r.push(Ce(N)),`${String.fromCharCode(K+r.length-1)}${P}${de}`)),l=ge(y);let F;const M=_e(l.text,l.marks).flatMap(T=>{const N=T.kinds.includes("code"),P={...T.kinds.includes("strong")?{bold:!0}:{},...T.kinds.includes("em")?{italic:!0}:{},...N?{name:u}:{}};return[...T.text.matchAll(ze)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===de)return F=void 0,[];if(R>=K&&R<K+Ne)return F=r[R-K],[];const D={...F,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...N?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(o=>paragraphsOfWords(o,Array.isArray(o)?Math.min(t+1,8):t,u))}const ue=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),Pe=new Set(["dt","ftr","sldNum"]),ce=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function pe(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const o=t.gradient&&Z({gradient:t.gradient}).gradient;o&&(i.background_gradient=o),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const he=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:o,prefix:r,base:y}=i,l=[],F=Oe(i.theme??Ae,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const T=[],N=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow?{shadow:e.shadow}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:se(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",g=ve(n,a),_=e.frame??g?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Te(n,a,g?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!g?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a)=>{const g=t.components[e];if(!g){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in slides.ts (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const _ of Object.keys(n??{}))Object.hasOwn(g.props,_)||l.push({...a,message:`Component ${e} has no prop ${_} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},L=(e,n,a,g,_)=>{const $={slide:g,shape:e,path:a};if(!n.frame){l.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ue(n.frame),d={frame:{from:"slide",path:`${a}.frame`}},b={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:z(n.fill)},...Z(n),...n.line===void 0?{}:{line:z(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group},...ce(n)};if(n.textbox)return{...b,kind:"textbox",text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`),0,F.fonts.code),style:B(V(_,G(ne)),n.text),own:X(G(ne)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...d,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const s=he(n.crop);return{...b,kind:"picture",media:{path:joinPath(y,n.picture),...s?{crop:s}:{}},sources:{...d,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...b,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...d,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const s=o(`${r}.${g}.${e}`),k=be(n.chart,{title:typeof s=="string"?s:void 0,base:y,rows:m=>i.data?.(m),problem:m=>{l.push({...$,message:`Chart ${e}: ${m}`})}});return k?{...b,kind:"chart",chart:k,sources:d}:void 0}if(n.table){const s=n.table,k=w.width/s.columns.reduce((f,c)=>f+c,0),m=w.height/s.rows.reduce((f,c)=>f+c.height,0),x=o(`${r}.${g}.${e}`),O=Array.isArray(x)?x:[];return O.length>s.rows.length&&l.push({...$,message:`Table ${e} has ${String(s.rows.length)} rows and its words ${String(O.length)}.`}),{...b,kind:"table",table:se({columns:s.columns.map(f=>Math.round(f*k)),rows:s.rows.map((f,c)=>{const p=O[c],v=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(f.height*m),cells:s.columns.map((j,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(v[A],0,F.fonts.code)},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}))}})},_,s.rows.map(f=>f.text)),sources:d}}const h=n.path&&ke(n.path.d);if(n.path&&!h){l.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const s=!n.path&&ye(n.geometry);return{...b,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...s?{line:n.line===void 0?ee.line:z(n.line),line_width:n.line_width===void 0?ee.line_width:S(n.line_width)}:{fill:n.fill===void 0?C.fill:z(n.fill),line:n.line===void 0?C.line:z(n.line),line_width:n.line_width===void 0?C.line_width:S(n.line_width)},...n.text&&!s?{fileText:{...n.text}}:{},...s?{}:{text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`)).map(k=>n.text?.align===void 0?{alignment:C.alignment,...k}:k),style:B(le(_,G(ae)),n.text),own:X(G(ae)),empty:!1}},sources:{...d,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const s=Y(n.component,n.props,$);return s?{...b,kind:"component",component:s,sources:d}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ue(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,ce(n)),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Me(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=z(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=z(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const g=he(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...g?{crop:g}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,g,_)=>{const $=M.get(n);if(!$){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:d}=$,b=[...(w.display_master_shapes===!1?[]:d.shapes).filter(s=>s.kind!=="placeholder").map(s=>N(s,"master",d)),...w.shapes.filter(s=>s.kind!=="placeholder").map(s=>N(s,"layout",d))],h=w.shapes.filter(s=>s.kind==="placeholder").map((s,k)=>({shape:P(s,d),order:k}));return{slide:{id:e,layout:w.name,master:d.name,hidden:g,background:w.background??d.background,shapes:b,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:d}},q=(e,n,a,g,_,$,w,d,b,h=()=>{})=>{const s=new Set(a.map(f=>f.shape.name));let k=a.length;for(const[f,c]of Object.entries(g??{})){const p=$(f);if(p===void 0)continue;const v=`${_}.shapes.${f}`,j=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!s.has(p),A=a.find(me=>me.shape.name===p);if(A&&!j){R(A.shape,c,v),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!j){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...s].join(", ")||"none"}).`});continue}const E=L(p,c,v,e.id,n);E&&(a.push({shape:E,order:k++,...c.z===void 0?{}:{z:c.z}}),s.add(p))}const m=a.filter(f=>f.shown===!0||!Pe.has(f.shape.placeholder?.type??"")||w(f.shape)!==void 0);a.splice(0,a.length,...m),a.sort((f,c)=>(f.z??0)-(c.z??0)||f.order-c.order);const x=new Map(a.flatMap((f,c)=>f.shape.group===void 0?[]:[[f.shape.group,c]])),O=a.flatMap((f,c)=>{const p=f.shape.group;return p===void 0?[f]:x.get(p)===c?a.filter(v=>v.shape.group===p):[]});a.splice(0,a.length,...O);for(const f of a){const c=h(f.shape);c!==void 0&&(f.shape.alt=c);const p=f.shape.text;if(f.shape.kind==="placeholder"&&p){const v=w(f.shape);p.paragraphs=paragraphsOfWords(v,0,F.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(j=>j.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(f=>f.shape)),d!==void 0&&d.trim()!==""&&(e.notes=d);for(const[f,c]of(b??[]).entries()){const p=$(c.shape);if(p===void 0)continue;const v={slide:e.id,shape:p,path:`${_}.animations.${String(f)}`},j=e.shapes.find(E=>E.name===p&&E.level==="slide");if(!j){l.push({...v,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(E=>E.level==="slide").map(E=>E.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(j.text?.paragraphs.length??0)){l.push({...v,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(j.text?.paragraphs.length??0)}).`});continue}const A=we({...c,shape:p});A?e.animations.push(A):l.push({...v,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},J=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const d=D(e.id,e.layout,n,e.hidden===!0);if(!d)return;const b=o(`${r}.${e.id}.notes`);e.transition&&(d.slide.transition=ie(e.transition)),e.advance_after!==void 0&&(d.slide.advance=e.advance_after),pe(d.slide,e.background,y),q(d.slide,d.master,d.placed,e.shapes,a,h=>h,h=>o(`${r}.${e.id}.${h.name}`),typeof b=="string"?b:void 0,e.animations,h=>{const s=o(`${r}.${e.id}.alt.${h.name}`);return typeof s=="string"?s:void 0}),T.push(d.slide),J.add(e.id);return}const g=e.generate??"",_=t.generators[g];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${g} in slides.ts (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${g} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const $=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const d of $){const b=`${e.id}/${d.id}`,h=D(b,d.layout,n,w.has(d.id),g);if(!h)continue;for(const m of d.shapes){const x=m.placeholder?h.placed.find(O=>O.shape.placeholder?.idx===m.placeholder?.idx):void 0;if(x)m.frame&&(x.shape.frame={...m.frame}),x.shape.sources.frame={from:"code"},x.shown=!0;else{const O=N(m,"layout",h.master);h.placed.push({shape:{...O,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const s=`${d.id}/`,k=d.transition??(d===$[0]?e.transition:void 0);pe(h.slide,e.background,y),k&&(h.slide.transition=ie(k)),q(h.slide,h.master,h.placed,e.shapes,a,m=>m.startsWith(s)?m.slice(s.length):void 0,m=>{const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];return x===void 0?void 0:x.map(O=>O.runs.map(f=>f.text).join(""))},d.notes,[...(d.animations??[]).map(m=>({...m,shape:`${s}${m.shape}`})),...e.animations??[]]);for(const m of h.slide.shapes){const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];x&&m.text&&(m.text.paragraphs=x,m.text.empty=!1)}T.push(h.slide),J.add(b)}for(const d of Object.keys(e.shapes??{})){const[b]=d.split("/");b!==void 0&&!$.some(h=>h.id===b)&&l.push({slide:e.id,path:`${a}.shapes.${d}`,message:`Generator ${g} makes no slide ${b}: ${d} changes nothing.`})}}),T.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:F,slides:T},problems:l}}
|
|
2
|
+
import{colorOfFile as ee}from"@allyhub/formats";import{readMarks as _e,markRuns as be}from"@allyhub/piece";import{chartOfFile as ye}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ne,DRAWN_TEXTBOX_FRAME as te,TEXT_FALLBACK as ie,TEXT_INSETS as W,isConnectorGeometry as $e,placeholderFrame as xe,styleKindOf as we}from"./office.js";import{resolveAnimation as ke,resolveTransition as oe}from"./animation.js";import{glued as ve}from"./connect.js";import{pathSteps as Se}from"./path.js";import{masterPlaceholder as Ae}from"./placeholders.js";import{DECK_FONTS as Oe,OFFICE_THEME as Te,themeOver as je}from"./theme.js";import{Pt as O}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=i===""?[]:i.split("/");for(const r of t.split("/"))r===""||r==="."||(r===".."?u.pop():u.push(r));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...ie,font:{...ie.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,r)=>{let o={...u,font:{...u.font}};for(const $ of t){const l=$?.[r];l&&(o={...o,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...o.font,...l.font}},l.numbered!==void 0&&(o.numbered=l.numbered,delete o.bullet),l.bullet===null?(delete o.bullet,delete o.numbered):l.bullet!==void 0?(delete o.numbered,o.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:l.bullet_font}))}return o})}function I(i,...t){const u=t.filter(o=>o!==void 0),r=o=>{for(let $=u.length-1;$>=0;$--){const l=u[$]?.[o];if(l!==void 0)return l}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??W.left,top:r("margin_top")??W.top,right:r("margin_right")??W.right,bottom:r("margin_bottom")??W.bottom}}}const ae={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function Ee(i,t,...u){return{...I(xe(t),...u),levels:levelsOver(U(),i.text_styles[we(t)],...u.map(r=>r?.levels))}}const Fe=Array.from({length:9},()=>({font:{color:C.font_color}})),de={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,Fe,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),z=i=>i==="none"?null:colorOfFile(i),Ne=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,ze=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Me=256,se="",Ce=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>ee(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(r=>({at:r.at,color:colorOfFile(r.color),...r.transparency===void 0?{}:{transparency:r.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:O(t.blur),distance:t.distance===void 0?H.distance:O(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function fe(i,t,u=[]){return{...i,rows:i.rows.map((r,o)=>({height:r.height,cells:r.cells.map($=>{const l=u[o];return{...$,text:{paragraphs:$.text.paragraphs,style:B({...V(t,$.text),auto_size:"shape"},l),own:X($.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const r={...u.font,...t.size===void 0?{}:{size:O(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...u,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:O(t.space_before)},...t.space_after===void 0?{}:{space_after:O(t.space_after)}};return t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...o,margin_left:ue,indent:-ue}:o})}:i}function Pe(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,u&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}function Le(i){const t={};for(const[,u,r=""]of i.matchAll(ze))if(u==="font")t.name=r.trim();else if(u==="link")t.link=r.trim();else if(u==="highlight")t.highlight=r.trim().toUpperCase();else if(u==="bold")t.bold=r.trim()!=="false";else if(u==="italic")t.italic=r.trim()!=="false";else if(u==="strike")t.strike=r.trim()!=="false";else if(u==="underline")t.underline=r.trim()!=="false";else if(u==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=O(o))}else if(u==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else{const o=ee(r.trim());o!==void 0&&(t.color=o)}return t}const ue=342900;export function paragraphsOfWords(i,t=0,u=Oe.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],$=r.replace(Ne,(E,N,P)=>(o.push(Le(N)),`${String.fromCharCode(K+o.length-1)}${P}${se}`)),l=_e($);let F;const M=be(l.text,l.marks).flatMap(E=>{const N=E.kinds.includes("code"),P={...E.kinds.includes("strong")?{bold:!0}:{},...E.kinds.includes("em")?{italic:!0}:{},...N?{name:u}:{}};return[...E.text.matchAll(Ce)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===se)return F=void 0,[];if(R>=K&&R<K+Me)return F=o[R-K],[];const D={...F,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...N?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,u))}const ce=i=>({left:O(i.x),top:O(i.y),width:O(i.w),height:O(i.h)}),Re=new Set(["dt","ftr","sldNum"]),pe=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function he(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&Z({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const me=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:r,prefix:o,base:$}=i,l=[],F=je(i.theme??Te,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const E=[],N=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow?{shadow:e.shadow}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:fe(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",m=Ae(n,a),_=e.frame??m?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Ee(n,a,m?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!m?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a,m)=>{const _=t.components[e];if(!_){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const b of Object.keys(n??{}))Object.hasOwn(_.props,b)||l.push({...a,message:`Component ${e} has no prop ${b} a person sets (it has ${Object.keys(_.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...m===void 0?{}:{dur:m}}},L=(e,n,a,m,_)=>{const b={slide:m,shape:e,path:a};if(!n.frame){l.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ce(n.frame),s={frame:{from:"slide",path:`${a}.frame`}},y={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:z(n.fill)},...Z(n),...n.line===void 0?{}:{line:z(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group},...pe(n)};if(n.textbox)return{...y,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`),0,F.fonts.code),style:B(V(_,G(te)),n.text),own:X(G(te)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...s,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const f=me(n.crop);return{...y,kind:"picture",media:{path:joinPath($,n.picture),...f?{crop:f}:{}},sources:{...s,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...y,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...s,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const f=r(`${o}.${m}.${e}`),S=ye(n.chart,{title:typeof f=="string"?f:void 0,base:$,rows:g=>i.data?.(g),problem:g=>{l.push({...b,message:`Chart ${e}: ${g}`})}});return S?{...y,kind:"chart",chart:S,sources:s}:void 0}if(n.table){const f=n.table,S=w.width/f.columns.reduce((d,c)=>d+c,0),g=w.height/f.rows.reduce((d,c)=>d+c.height,0),v=r(`${o}.${m}.${e}`),T=Array.isArray(v)?v:[];return T.length>f.rows.length&&l.push({...b,message:`Table ${e} has ${String(f.rows.length)} rows and its words ${String(T.length)}.`}),{...y,kind:"table",table:fe({columns:f.columns.map(d=>Math.round(d*S)),rows:f.rows.map((d,c)=>{const p=T[c],x=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(d.height*g),cells:f.columns.map((k,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(x[A],0,F.fonts.code)},...d.fill===void 0?{}:{fill:colorOfFile(d.fill)},...d.line===void 0?{}:{borders:{bottom:{color:colorOfFile(d.line),width:O(1)}}}}))}})},_,f.rows.map(d=>d.text)),sources:s}}const h=n.path&&Se(n.path.d);if(n.path&&!h){l.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const f=!n.path&&$e(n.geometry);return{...y,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...f?{line:n.line===void 0?ne.line:z(n.line),line_width:n.line_width===void 0?ne.line_width:O(n.line_width)}:{fill:n.fill===void 0?C.fill:z(n.fill),line:n.line===void 0?C.line:z(n.line),line_width:n.line_width===void 0?C.line_width:O(n.line_width)},...n.text&&!f?{fileText:{...n.text}}:{},...f?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`)).map(S=>n.text?.align===void 0?{alignment:C.alignment,...S}:S),style:B(le(_,G(de)),n.text),own:X(G(de)),empty:!1}},sources:{...s,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const f=Y(n.component,n.props,b,n.dur);return f?{...y,kind:"component",component:f,sources:s}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ce(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,pe(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Pe(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=z(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=O(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=z(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const m=me(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...m?{crop:m}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,m,_)=>{const b=M.get(n);if(!b){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:s}=b,y=[...(w.display_master_shapes===!1?[]:s.shapes).filter(f=>f.kind!=="placeholder").map(f=>N(f,"master",s)),...w.shapes.filter(f=>f.kind!=="placeholder").map(f=>N(f,"layout",s))],h=w.shapes.filter(f=>f.kind==="placeholder").map((f,S)=>({shape:P(f,s),order:S}));return{slide:{id:e,layout:w.name,master:s.name,hidden:m,background:w.background??s.background,shapes:y,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:s}},q=(e,n,a)=>{if(!n)return;const m=w=>{const s=n[w];if(s===void 0)return e.connect?.[w];const y=s==="none"?void 0:a(s.shape);return s==="none"||y===void 0?void 0:{shape:y,site:s.site}},_=m("begin"),b=m("end");_||b?e.connect={..._?{begin:_}:{},...b?{end:b}:{}}:delete e.connect},J=(e,n,a,m,_,b,w,s,y,h=()=>{})=>{const f=new Set(a.map(d=>d.shape.name));let S=a.length;for(const[d,c]of Object.entries(m??{})){const p=b(d);if(p===void 0)continue;const x=`${_}.shapes.${d}`,k=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!f.has(p),A=a.find(ge=>ge.shape.name===p);if(A&&!k){R(A.shape,c,x),q(A.shape,c.connect,b),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!k){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...f].join(", ")||"none"}).`});continue}const j=L(p,c,x,e.id,n);j&&q(j,c.connect,b),j&&(a.push({shape:j,order:S++,...c.z===void 0?{}:{z:c.z}}),f.add(p))}const g=a.filter(d=>d.shown===!0||!Re.has(d.shape.placeholder?.type??"")||w(d.shape)!==void 0);a.splice(0,a.length,...g),a.sort((d,c)=>(d.z??0)-(c.z??0)||d.order-c.order);const v=new Map(a.flatMap((d,c)=>d.shape.group===void 0?[]:[[d.shape.group,c]])),T=a.flatMap((d,c)=>{const p=d.shape.group;return p===void 0?[d]:v.get(p)===c?a.filter(x=>x.shape.group===p):[]});a.splice(0,a.length,...T);for(const d of a){const c=h(d.shape);c!==void 0&&(d.shape.alt=c);const p=d.shape.text;if(d.shape.kind==="placeholder"&&p){const x=w(d.shape);p.paragraphs=paragraphsOfWords(x,0,F.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(k=>k.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(d=>d.shape));for(const d of e.shapes){const c=d.connect;if(!c)continue;const p=ve(d,x=>e.shapes.find(k=>k.name===x&&k.level===d.level&&k!==d));d.frame=p.frame,p.flip?d.flip=p.flip:delete d.flip;for(const x of p.lost){const k=c[x];k&&d.level==="slide"&&l.push({slide:e.id,shape:d.name,message:`Connector ${d.name}'s ${x} is glued to site ${String(k.site)} of ${k.shape}, which slide ${e.id} has not: it stays where it is.`})}}s!==void 0&&s.trim()!==""&&(e.notes=s);for(const[d,c]of(y??[]).entries()){const p=b(c.shape);if(p===void 0)continue;const x={slide:e.id,shape:p,path:`${_}.animations.${String(d)}`},k=e.shapes.find(j=>j.name===p&&j.level==="slide");if(!k){l.push({...x,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(j=>j.level==="slide").map(j=>j.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(k.text?.paragraphs.length??0)){l.push({...x,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(k.text?.paragraphs.length??0)}).`});continue}const A=ke({...c,shape:p});A?e.animations.push(A):l.push({...x,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Q=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const s=D(e.id,e.layout,n,e.hidden===!0);if(!s)return;const y=r(`${o}.${e.id}.notes`);e.transition&&(s.slide.transition=oe(e.transition)),e.advance_after!==void 0&&(s.slide.advance=e.advance_after),he(s.slide,e.background,$),J(s.slide,s.master,s.placed,e.shapes,a,h=>h,h=>r(`${o}.${e.id}.${h.name}`),typeof y=="string"?y:void 0,e.animations,h=>{const f=r(`${o}.${e.id}.alt.${h.name}`);return typeof f=="string"?f:void 0}),E.push(s.slide),Q.add(e.id);return}const m=e.generate??"",_=t.generators[m];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${m} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${m} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const b=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const s of b){const y=`${e.id}/${s.id}`,h=D(y,s.layout,n,w.has(s.id),m);if(!h)continue;for(const g of s.shapes){const v=g.placeholder?h.placed.find(T=>T.shape.placeholder?.idx===g.placeholder?.idx):void 0;if(v)g.frame&&(v.shape.frame={...g.frame}),v.shape.sources.frame={from:"code"},v.shown=!0;else{const T=N(g,"layout",h.master);h.placed.push({shape:{...T,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const f=`${s.id}/`,S=s.transition??(s===b[0]?e.transition:void 0);he(h.slide,e.background,$),S&&(h.slide.transition=oe(S)),J(h.slide,h.master,h.placed,e.shapes,a,g=>g.startsWith(f)?g.slice(f.length):void 0,g=>{const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];return v===void 0?void 0:v.map(T=>T.runs.map(d=>d.text).join(""))},s.notes,[...(s.animations??[]).map(g=>({...g,shape:`${f}${g.shape}`})),...e.animations??[]]);for(const g of h.slide.shapes){const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];v&&g.text&&(g.text.paragraphs=v,g.text.empty=!1)}E.push(h.slide),Q.add(y)}for(const s of Object.keys(e.shapes??{})){const[y]=s.split("/");y!==void 0&&!b.some(h=>h.id===y)&&l.push({slide:e.id,path:`${a}.shapes.${s}`,message:`Generator ${m} makes no slide ${y}: ${s} changes nothing.`})}}),E.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:F,slides:E},problems:l}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { presentationFor } from "./index.js";
|
|
2
|
+
/** python-pptx's length functions: each gives a Length, a number of EMU that says itself in other units (`Pt(12).pt`, `.inches`, `.cm`, `.mm`, `.emu`). */
|
|
3
|
+
export declare const Emu: (n: number) => import("./units.js").LengthValue, Inches: (n: number) => import("./units.js").LengthValue, Pt: (n: number) => import("./units.js").LengthValue, Cm: (n: number) => import("./units.js").LengthValue, Mm: (n: number) => import("./units.js").LengthValue, Centipoints: (n: number) => import("./units.js").LengthValue;
|
|
4
|
+
export { RGBColor, MSO_ANCHOR, CategoryChartData, MSO_ARROWHEAD, XL_CHART_TYPE, XL_LABEL_POSITION, XL_LEGEND_POSITION, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_FILL, MSO_LINE, MSO_SHAPE, MSO_SHAPE_TYPE, MSO_THEME_COLOR, PP_ALIGN, PP_PLACEHOLDER, THEME_FONT, SLIDE_SIZES, presentationFor, isDeck, type Anchor, type AutoSize, type Background, type ColorFormat, type ComponentContext, type ComponentInput, type Deck, type FillFormat, type Font, type GeneratedSlide, type Generator, type Length, type LengthValue, type LineFormat, type ListLevel, type ListStyle, type Paragraph, type Placeholders, type PlaceholderType, type Presentation, type PresentationOptions, type PropSpec, type Run, type Shape, type ShapeCollection, type ShapeType, type SlideLayout, type SlideLayouts, type SlideMaster, type SlideMasters, type SlideSizeName, type TextFrame, type TextStyles, type ThemeInput, } from "./index.js";
|
|
5
|
+
/**
|
|
6
|
+
* A deck: the default export of a deck's module. Its function makes
|
|
7
|
+
* the presentation's slide masters, layouts, components and generators;
|
|
8
|
+
* its slides are in the slides file it names (`slides: "./q3.yaml"`), their
|
|
9
|
+
* words in its script (`script: "./q3.{locale}.yaml"`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const presentation: (options: import("./api.js").PresentationOptions | ((prs: import("./api.js").Presentation) => void), build?: (prs: import("./api.js").Presentation) => void) => import("./api.js").Deck;
|
|
12
|
+
/** presentation() made for a module (`{ file }`, a project path): what the build gives the file that imports this entry. */
|
|
13
|
+
export declare const slidesFor: (module: {
|
|
14
|
+
file: string;
|
|
15
|
+
}) => {
|
|
16
|
+
presentation: ReturnType<typeof presentationFor>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{LENGTH_UNITS as O,presentationFor as _}from"./index.js";export const{Emu,Inches,Pt,Cm,Mm,Centipoints}=O;export{RGBColor,MSO_ANCHOR,CategoryChartData,MSO_ARROWHEAD,XL_CHART_TYPE,XL_LABEL_POSITION,XL_LEGEND_POSITION,MSO_AUTO_SIZE,MSO_CONNECTOR,MSO_FILL,MSO_LINE,MSO_SHAPE,MSO_SHAPE_TYPE,MSO_THEME_COLOR,PP_ALIGN,PP_PLACEHOLDER,THEME_FONT,SLIDE_SIZES,presentationFor,isDeck}from"./index.js";export const presentation=_(""),slidesFor=t=>({presentation:_(t.file)});
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
+
import type { ComponentAt } from "@allyhub/piece";
|
|
1
2
|
import type { DeckCode } from "./code.js";
|
|
2
|
-
import type {
|
|
3
|
+
import type { DrawnDeck } from "./model.js";
|
|
4
|
+
import type { ResolvedDeck, ResolvedSlide } from "./resolve.js";
|
|
3
5
|
import type { Theme } from "./theme.js";
|
|
4
|
-
/** A component drawn alone, on a transparent page of its frame's size. */
|
|
5
|
-
export
|
|
6
|
-
name: string;
|
|
7
|
-
props: Record<string, unknown>;
|
|
8
|
-
/** Its frame, in the stage's pixels. */
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
/** Seconds since it came on: what moves in it has settled by its slide's still. */
|
|
12
|
-
t: number;
|
|
13
|
-
}
|
|
6
|
+
/** A component drawn alone, on a transparent page of its frame's size (the stage's). */
|
|
7
|
+
export type { ComponentAt };
|
|
14
8
|
/** The editor to a frame. */
|
|
15
9
|
export type DeckHostCommand =
|
|
16
10
|
/** The code host: the deck's code as data (asked any time after the frame is made). */
|
|
@@ -58,4 +52,27 @@ export type DeckHostMessage =
|
|
|
58
52
|
type: "error";
|
|
59
53
|
message: string;
|
|
60
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* What a deck's output answers on the stage beyond what every piece does
|
|
57
|
+
* (@allyhub/piece's StageOutput), called by name where a host knows it
|
|
58
|
+
* has a deck: what its PowerPoint file is written from, and a deck
|
|
59
|
+
* resolved again drawn in place.
|
|
60
|
+
*/
|
|
61
|
+
export interface DeckOutput {
|
|
62
|
+
/** The deck as it was drawn: every slide drawn for it, with the share autofit shrank each text to. */
|
|
63
|
+
deck(): Promise<DrawnDeck<ResolvedSlide, Theme>>;
|
|
64
|
+
/**
|
|
65
|
+
* A deck resolved again for the same code, and media it shows that the
|
|
66
|
+
* stage was not given: the slides whose identity changed are drawn
|
|
67
|
+
* again in place, the rest kept as drawn. `reload`: the slides' timing
|
|
68
|
+
* changed, which the stage does not take in place (nothing changed).
|
|
69
|
+
*/
|
|
70
|
+
update(deck: ResolvedDeck, media?: Readonly<Record<string, {
|
|
71
|
+
url: string;
|
|
72
|
+
duration?: number;
|
|
73
|
+
}>>): Promise<{
|
|
74
|
+
redrawn: string[];
|
|
75
|
+
reload?: true;
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
61
78
|
//# sourceMappingURL=stage.d.ts.map
|
|
@@ -37,14 +37,14 @@ export declare const Pt: (n: number) => Length;
|
|
|
37
37
|
export declare const Cm: (n: number) => Length;
|
|
38
38
|
export declare const Mm: (n: number) => Length;
|
|
39
39
|
export declare const Centipoints: (n: number) => Length;
|
|
40
|
-
/** A length in points: slides
|
|
40
|
+
/** A length in points: the slides file's unit. */
|
|
41
41
|
export declare const toPt: (emu: Length) => number;
|
|
42
42
|
/**
|
|
43
43
|
* Slide sizes by name, in EMU (width × height). `16:9`, `16:10` and `4:3`
|
|
44
44
|
* are PowerPoint's own (`16:9` is its Widescreen, 13.333 × 7.5 in); `a4`
|
|
45
45
|
* and `letter` are the paper's own size, for a deck printed edge to edge
|
|
46
|
-
* (PowerPoint's "A4 Paper" slide is 27.52 × 19.05 cm, inside the paper)
|
|
47
|
-
*
|
|
46
|
+
* (PowerPoint's "A4 Paper" slide is 27.52 × 19.05 cm, inside the paper).
|
|
47
|
+
* A carousel is an image's boards, not a deck (docs/design/images.md, 5).
|
|
48
48
|
*/
|
|
49
49
|
export declare const SLIDE_SIZES: {
|
|
50
50
|
readonly "16:9": readonly [number, number];
|
|
@@ -54,9 +54,6 @@ export declare const SLIDE_SIZES: {
|
|
|
54
54
|
readonly "a4-portrait": readonly [number, number];
|
|
55
55
|
readonly letter: readonly [number, number];
|
|
56
56
|
readonly "letter-portrait": readonly [number, number];
|
|
57
|
-
readonly "1:1": readonly [number, number];
|
|
58
|
-
readonly "4:5": readonly [number, number];
|
|
59
|
-
readonly "9:16": readonly [number, number];
|
|
60
57
|
};
|
|
61
58
|
export type SlideSizeName = keyof typeof SLIDE_SIZES;
|
|
62
59
|
//# sourceMappingURL=units.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
class o extends Number{get emu(){return this.valueOf()}get inches(){return this.valueOf()/EMU_PER_INCH}get cm(){return this.valueOf()/EMU_PER_CM}get mm(){return this.valueOf()/EMU_PER_MM}get pt(){return this.valueOf()/EMU_PER_PT}get centipoints(){return Math.trunc(this.valueOf()/EMU_PER_CENTIPOINT)}get twips(){return Math.trunc(this.valueOf()/(EMU_PER_PT/20))}}const r=new Map;export function length(t){const n=Math.trunc(t);let e=r.get(n);return e||(e=new o(n),r.set(n,e)),e}export const lengthOr=t=>t===void 0?void 0:length(t),held=t=>t instanceof Number||t instanceof String?t.valueOf():t,LENGTH_UNITS={Emu:t=>length(t),Inches:t=>length(t*EMU_PER_INCH),Pt:t=>length(t*EMU_PER_PT),Cm:t=>length(t*EMU_PER_CM),Mm:t=>length(t*EMU_PER_MM),Centipoints:t=>length(t*EMU_PER_CENTIPOINT)},EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*EMU_PER_INCH),Pt=t=>Math.trunc(t*EMU_PER_PT),Cm=t=>Math.trunc(t*EMU_PER_CM),Mm=t=>Math.trunc(t*EMU_PER_MM),Centipoints=t=>Math.trunc(t*EMU_PER_CENTIPOINT),toPt=t=>Math.round(t/EMU_PER_PT*100)/100,SLIDE_SIZES={"16:9":[Emu(12192e3),Emu(6858e3)],"16:10":[Emu(9144e3),Emu(5715e3)],"4:3":[Emu(9144e3),Emu(6858e3)],a4:[Mm(297),Mm(210)],"a4-portrait":[Mm(210),Mm(297)],letter:[Inches(11),Inches(8.5)],"letter-portrait":[Inches(8.5),Inches(11)]
|
|
2
|
+
class o extends Number{get emu(){return this.valueOf()}get inches(){return this.valueOf()/EMU_PER_INCH}get cm(){return this.valueOf()/EMU_PER_CM}get mm(){return this.valueOf()/EMU_PER_MM}get pt(){return this.valueOf()/EMU_PER_PT}get centipoints(){return Math.trunc(this.valueOf()/EMU_PER_CENTIPOINT)}get twips(){return Math.trunc(this.valueOf()/(EMU_PER_PT/20))}}const r=new Map;export function length(t){const n=Math.trunc(t);let e=r.get(n);return e||(e=new o(n),r.set(n,e)),e}export const lengthOr=t=>t===void 0?void 0:length(t),held=t=>t instanceof Number||t instanceof String?t.valueOf():t,LENGTH_UNITS={Emu:t=>length(t),Inches:t=>length(t*EMU_PER_INCH),Pt:t=>length(t*EMU_PER_PT),Cm:t=>length(t*EMU_PER_CM),Mm:t=>length(t*EMU_PER_MM),Centipoints:t=>length(t*EMU_PER_CENTIPOINT)},EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*EMU_PER_INCH),Pt=t=>Math.trunc(t*EMU_PER_PT),Cm=t=>Math.trunc(t*EMU_PER_CM),Mm=t=>Math.trunc(t*EMU_PER_MM),Centipoints=t=>Math.trunc(t*EMU_PER_CENTIPOINT),toPt=t=>Math.round(t/EMU_PER_PT*100)/100,SLIDE_SIZES={"16:9":[Emu(12192e3),Emu(6858e3)],"16:10":[Emu(9144e3),Emu(5715e3)],"4:3":[Emu(9144e3),Emu(6858e3)],a4:[Mm(297),Mm(210)],"a4-portrait":[Mm(210),Mm(297)],letter:[Inches(11),Inches(8.5)],"letter-portrait":[Inches(8.5),Inches(11)]};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/slides-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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
|
+
"./sdk": {
|
|
11
|
+
"types": "./dist/sdk.d.ts",
|
|
12
|
+
"default": "./dist/sdk.js"
|
|
9
13
|
}
|
|
10
14
|
},
|
|
11
15
|
"sideEffects": false,
|
|
@@ -51,8 +51,7 @@ export interface MixLevels {
|
|
|
51
51
|
}
|
|
52
52
|
export interface MasterOptions {
|
|
53
53
|
/**
|
|
54
|
-
* Integrated loudness, LUFS (-70 to 0); default the
|
|
55
|
-
* else -14. false keeps the mix's own level (peaks still limited).
|
|
54
|
+
* Integrated loudness, LUFS (-70 to 0); default -14. false keeps the mix's own level (peaks still limited).
|
|
56
55
|
*/
|
|
57
56
|
lufs?: number | false;
|
|
58
57
|
/** True-peak ceiling, dBTP (-9 to 0); default -3 (AAC overshoots up to about 2 dB). */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Word } from "
|
|
2
|
-
import type { CaptionOptions, CaptionTrackCue, CaptionWord } from "./piece.js";
|
|
1
|
+
import type { CaptionLine, Word, CaptionOptions, CaptionTrackCue, CaptionWord } from "@allyhub/piece";
|
|
3
2
|
import type { PartText, Timeline } from "./timeline.js";
|
|
4
3
|
export interface CaptionCue {
|
|
5
4
|
start: number;
|
|
@@ -7,14 +6,6 @@ export interface CaptionCue {
|
|
|
7
6
|
text: string;
|
|
8
7
|
part: string;
|
|
9
8
|
}
|
|
10
|
-
export interface CaptionLine {
|
|
11
|
-
part: string;
|
|
12
|
-
/** The line as shown, and as spoken. */
|
|
13
|
-
shown: string;
|
|
14
|
-
spoken: string;
|
|
15
|
-
/** The part's words on the film's clock. */
|
|
16
|
-
words: readonly Word[];
|
|
17
|
-
}
|
|
18
9
|
export interface CaptionInput {
|
|
19
10
|
/** Voiced parts in order. */
|
|
20
11
|
lines: CaptionLine[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{changesOf as K}from"
|
|
2
|
+
import{changesOf as K}from"@allyhub/piece";import{normText as p,joinWords as V,ScriptAlignment as v,WordStream as F}from"@allyhub/piece";import{speechWords as D}from"./speech.js";export const CAPTION_CUE_DEFAULTS={maxChars:42,maxCharsCjk:16,minSeconds:.8,maxSeconds:6,gapFrames:2};export function speechLines(c,s,i){return c.parts.flatMap(r=>{const o=r.speech,h=o?i[o.file]?.words:void 0;if(!o||!h?.length)return[];const a=D(h,o);if(a.length===0)return[];const n=s.find(t=>t.key===r.key),e=n?.spoken??V(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(c,s){const i=(o,h)=>p(o.slice(0,h)).length,r=[[0,0]];for(const o of K(c,s))r.push([i(c,o.at),i(s,o.into)]),r.push([i(c,o.at+o.removed),i(s,o.into+o.inserted)]);return r.push([p(c).length,p(s).length]),o=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(o>e&&h<r.length-1)continue;if(e<=a)return o<=a?n:t;const u=Math.max(0,Math.min(1,(o-a)/(e-a)));return n+(t-n)*u}return 0}}const b=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,G=/[。!?!?…]|\.(?=\s|$)/u,J=/[,、;:,;:—]/u,H=/[,、;:。,;:.\s]+$/u,P=(c,s)=>/[.,:;]/u.test(c[s]??"")&&/[0-9A-Za-z]/u.test(c[s+1]??"");export function keptSpans(c,s){const i=[],r=U(c).map(o=>({...o,n:p(o.w)}));for(const o of s){const h=p(o);if(!h)continue;if(b.test(o)){const n=[];Array.from(c).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(c);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],g=n[t+h.length-1];u!==void 0&&g!==void 0&&i.push([u,g+1])}continue}const a=o.split(/\s+/u).map(p).filter(Boolean);for(let n=0;n+a.length<=r.length;n++)if(a.every((e,t)=>r[n+t]?.n===e)){const e=r[n],t=r[n+a.length-1];e&&t&&i.push([e.from,t.to])}}return i}const _=(c,s)=>c.some(([i,r])=>s>i&&s<r);export function splitLine(c,s=b.test(c)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,i=[]){const r=[],o=(a,n)=>{const e=c.slice(a,n),t=e.length-e.trimStart().length,u=e.trim();u&&r.push({text:u,from:a+t,to:a+t+u.length})},h=(a,n,e)=>{const t=c.slice(a,n);if(Array.from(t.trim()).length<=s){o(a,n);return}const g=e===0?G:e===1?J:void 0;if(g){let f=-1;for(let k=1;k<t.length-1;k++)g.test(t[k]??"")&&!P(t,k)&&!_(i,a+k+1)&&(f<0||Math.abs(k-t.length/2)<Math.abs(f-t.length/2))&&(f=k);if(f<0){h(a,n,e+1);return}h(a,a+f+1,e),h(a+f+1,n,e);return}const w=Math.floor(t.length/2),C=f=>f>0&&f<t.length&&!_(i,a+f);let x=-1;if(!b.test(t)){for(let f=w;f>0&&x<0;f--)t[f]===" "&&C(f)&&(x=f);for(let f=w;f<t.length&&x<0;f++)t[f]===" "&&C(f)&&(x=f)}for(let f=0;f<=t.length&&x<0;f++)C(w-f)?x=w-f:C(w+f)&&(x=w+f);if(x<0){o(a,n);return}h(a,a+x,e),h(a+x,n,e)};return h(0,c.length,0),r}export function captionCues(c,s={}){const{lines:i,fps:r}=c,o={...CAPTION_CUE_DEFAULTS,...s},h=[];for(const t of i){if(t.words.length===0)continue;const u=t.words,g=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[g.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((g.lines[0]?.length??0)===0)continue;const f=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),k=b.test(t.shown)?o.maxCharsCjk:o.maxChars;for(const M of splitLine(t.shown,k)){const l=Math.round(f(p(t.shown.slice(0,M.from)).length)),d=Math.round(f(p(t.shown.slice(0,M.to)).length)),S=w(l,!1),A=w(Math.max(l,d-1),!0),T=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");T&&h.push({start:S,end:Math.max(A,S),text:T,part:t.part})}}const a=1/r,n=t=>Math.round(t*r)/r,e=h.map(t=>({...t,start:n(t.start),end:n(t.end)}));for(let t=0;t<e.length;t++){const u=e[t];if(!u)continue;const g=e[t+1],w=g?g.start-o.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+o.minSeconds),u.start+o.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(c,s){return s===void 0?captionCues(c):wordCues(c.lines,{...s,fps:c.fps}).map(i=>({start:i.start,end:i.end,text:i.text,part:i.part}))}function U(c){const s=[],i=/\S+/gu;for(let r=i.exec(c);r;r=i.exec(c))s.push({w:r[0],from:r.index,to:r.index+r[0].length});return s}export function wordCues(c,s){const{fps:i}=s,r=[];for(const n of c){if(n.words.length===0)continue;const e=n.words,t=new v(new F(e),[n.spoken]);if((t.lines[0]?.length??0)===0)continue;const g=(l,d)=>{const S=e[t.wordAtChar(0,l)];return S?d?S.end:S.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),x=(l,d)=>{const S=Math.round(C(p(n.shown.slice(0,l)).length)),A=Math.round(C(p(n.shown.slice(0,d)).length));return[g(S,!1),g(Math.max(S,A-1),!0)]},f=b.test(n.shown),k=s.maxChars??(f?16:32),M=keptSpans(n.shown,s.keep??[]);for(const l of splitLine(n.shown,k,M)){const d=(f?[{w:l.text,from:l.from,to:l.to}]:U(n.shown.slice(l.from,l.to)).map(m=>({w:m.w,from:m.from+l.from,to:m.to+l.from}))).filter(m=>p(m.w)!=="");if(d.length===0)continue;const S=s.maxWords&&s.maxWords>0?s.maxWords:d.length,A=Math.ceil(d.length/S),T=Math.ceil(d.length/A),O=[];d.forEach((m,L)=>{const W=d[L-1],j=O.at(-1);j&&W&&_(M,Math.ceil((W.to+m.from)/2))?j.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>T&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const L=m.map(E=>{const[N,B]=x(E.from,E.to);return{text:E.w,start:N,end:Math.max(B,N)}}),W=L[0],j=L.at(-1);if(!W||!j)continue;const z=m.map(E=>E.w).join(f?"":" ").replace(f?H:/[,;:]+$/u,"");r.push({start:W.start,end:j.end,text:z,part:n.part,words:L})}}}const o=n=>Math.round(n*i)/i,h=1/i,a=r.map(n=>({...n,start:o(n.start),end:o(n.end)}));for(let n=0;n<a.length;n++){const e=a[n];if(!e)continue;const t=a[n+1],u=t?.part===e.part;t&&u&&t.start-e.end<(s.close??.4)&&(e.end=t.start),e.end=Math.max(e.end,e.start+Math.min(.5,6*h)),t&&e.end>t.start&&(e.end=t.start),e.end<=e.start&&(e.end=e.start+h)}return a}export function cuesIn(c,s,i){const r=o=>Math.round(o*1e6)/1e6;return c.filter(o=>o.end>s&&o.start<i).map(o=>({start:r(Math.max(o.start,s)-s),end:r(Math.min(o.end,i)-s),text:o.text,words:o.words.map(h=>({text:h.text,start:r(h.start-s),end:r(h.end-s)}))}))}const y=(c,s)=>{const i=Math.round(c*1e3),r=Math.floor(i/36e5),o=Math.floor(i/6e4)%60,h=Math.floor(i/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(o)}:${a(h)}${s}${a(i%1e3,3)}`};export function toSrt(c){return c.map((s,i)=>`${String(i+1)}
|
|
3
3
|
${y(s.start,",")} --> ${y(s.end,",")}
|
|
4
4
|
${s.text}
|
|
5
5
|
`).join(`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Combo, Target } from "@allyhub/piece";
|
|
2
|
+
import type { GeneratedUse } from "./fact.js";
|
|
3
|
+
import type { Timeline } from "./timeline.js";
|
|
4
|
+
import type { Reads } from "@allyhub/piece";
|
|
5
|
+
export interface FilmResult extends Target {
|
|
6
|
+
/** Its film's plan; absent when it did not load. */
|
|
7
|
+
timeline?: Timeline;
|
|
8
|
+
/** What it read while it loaded and drew its stills. */
|
|
9
|
+
reads?: Reads;
|
|
10
|
+
/** What it was built from; absent when it did not load. */
|
|
11
|
+
digest?: string;
|
|
12
|
+
}
|
|
13
|
+
/** A media file a part shows, plays or reads, in seconds from the part's start. */
|
|
14
|
+
export interface PlanUse {
|
|
15
|
+
file: string;
|
|
16
|
+
as: GeneratedUse["as"];
|
|
17
|
+
from: number;
|
|
18
|
+
/** Absent for a placed sound: it plays for its file's length. */
|
|
19
|
+
to?: number;
|
|
20
|
+
}
|
|
21
|
+
/** One part of a combo's plan. */
|
|
22
|
+
export interface PlanPart {
|
|
23
|
+
key: string;
|
|
24
|
+
slot?: string;
|
|
25
|
+
/** Seconds it lasts. */
|
|
26
|
+
dur: number;
|
|
27
|
+
/** Where its speech comes from: the take's file and stretch (seconds of the file). */
|
|
28
|
+
speech?: {
|
|
29
|
+
file: string;
|
|
30
|
+
from: number;
|
|
31
|
+
dur: number;
|
|
32
|
+
};
|
|
33
|
+
/** The media it uses: its footage, speech and placed sounds, and what its layers read. */
|
|
34
|
+
uses: PlanUse[];
|
|
35
|
+
}
|
|
36
|
+
export interface ComboPlan {
|
|
37
|
+
piece: string;
|
|
38
|
+
output: string;
|
|
39
|
+
combo: Combo;
|
|
40
|
+
/** The combo's id (pieces with slots). */
|
|
41
|
+
id?: string;
|
|
42
|
+
format: string;
|
|
43
|
+
duration: number;
|
|
44
|
+
parts: PlanPart[];
|
|
45
|
+
/** Media its parts read (for provenance flags). */
|
|
46
|
+
media: string[];
|
|
47
|
+
/** Put together from other combos' parts: it was not loaded. */
|
|
48
|
+
estimated: boolean;
|
|
49
|
+
/** Its music, when it has some: the file, where it starts, whether it loops. */
|
|
50
|
+
music?: string;
|
|
51
|
+
musicFrom?: number;
|
|
52
|
+
musicLoop?: true;
|
|
53
|
+
/**
|
|
54
|
+
* Seconds of the film its music plays when it is put together from
|
|
55
|
+
* stretches (`music.play`) or ends on a bar (`music.end`); absent: the
|
|
56
|
+
* file from `musicFrom` to its end.
|
|
57
|
+
*/
|
|
58
|
+
musicLength?: number;
|
|
59
|
+
/** The loudness the mix levels speech to (video({ mix }).speech), when not the default. */
|
|
60
|
+
speechLevel?: number;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EditList, type EditRange, type EditedSpeech, type KeptRange, type SoundCut } from "./edits.js";
|
|
2
|
-
import type { Word } from "
|
|
2
|
+
import type { Word } from "@allyhub/piece";
|
|
3
3
|
import { type Join } from "./transcript.js";
|
|
4
|
-
import { type RoomLevel, type VoiceFrames } from "
|
|
4
|
+
import { type RoomLevel, type VoiceFrames } from "@allyhub/piece";
|
|
5
5
|
export interface CutReportOptions {
|
|
6
6
|
/** Words [from, to] of the take (default every word). */
|
|
7
7
|
from?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{applyEdits as E,editedLength as P,PAD_AFTER as T,PAD_BEFORE as _,speechPads as j}from"./edits.js";import{JOIN_NEAR as q,joinsOf as x,takeLevels as B}from"./transcript.js";import{matchRoom as g,ROOM_MATCH as v,roomTone as I}from"
|
|
2
|
+
import{applyEdits as E,editedLength as P,PAD_AFTER as T,PAD_BEFORE as _,speechPads as j}from"./edits.js";import{JOIN_NEAR as q,joinsOf as x,takeLevels as B}from"./transcript.js";import{matchRoom as g,ROOM_MATCH as v,roomTone as I}from"@allyhub/piece";import{joinWords as y}from"@allyhub/piece";const A=o=>Math.round(o*1e3)/1e3;export function cutReport(o,e,a,c={}){const r=Math.max(0,o.length-1),d=Math.min(c.from??0,r),s=Math.min(c.to??r,r),p=c.fps??30,i=c.duration??o.at(-1)?.end??0,n=E(o,e,d,s,{levels:a,fps:p}),m=o[d],u=o[s],l=m&&u?u.end-m.start:0,h=P(n.ranges),M=[];for(const t of n.removed){const f=M.at(-1);f?.to===t-1?f.to=t:M.push({from:t,to:t})}const O=t=>e.maxPause===void 0?t:Math.min(t,e.maxPause/2),k={before:O(e.pad?.before??_),after:O(e.pad?.after??T)},W=M.map(t=>({...t,start:o[t.from]?.start??0,end:o[t.to]?.end??0,text:y(o.slice(t.from,t.to+1))})),R=c.quiet??(a?B(a).threshold:-60),b=c.near??q;return{from:d,to:s,fps:p,pad:k,padGiven:e.pad?.before!==void 0||e.pad?.after!==void 0,kept:n.ranges,removed:W,sounds:n.sounds,soundsUnused:(e.sounds??[]).filter(t=>!n.sounds.some(f=>f.from<t.to&&f.to>t.from)),inWord:n.inWord,inWordUnplaced:(e.inWord??[]).filter(t=>!n.inWord.some(f=>f.from<t.to+.05&&f.to>t.from-.05)),pauses:n.pauses,lost:n.lost,seconds:{before:A(l),after:A(h),removed:A(l-h)},roomTone:a?D(o,n,a,i):null,joins:x(o,n,a,R,b),quietBelow:a?R:null,near:b}}function D(o,e,a,c){const r=I(a),d=e.kept[0],s=e.kept.at(-1);if(!r||d===void 0||s===void 0)return null;const p=j(o,d,s,c,a),i=e.ranges[0]?.from??o[d]?.start??0,n=e.ranges.at(-1)?.to??o[s]?.end??0,m=i>(o[d]?.start??0)+1e-6?0:p.padIn,u=n<(o[s]?.end??0)-1e-6?0:p.padOut,l={from:r.from,to:Math.min(r.to,r.from+v.near)},h=g(a,l,{from:i-m,to:i-m+Math.min(m,v.near)}),M=g(a,l,{from:n+u-Math.min(u,v.near),to:n+u});return{...r,level:h.level,lead:{word:d,pad:m,...h},tail:{word:s,pad:u,...M}}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Word } from "
|
|
2
|
-
import { type VoiceFrames } from "
|
|
3
|
-
import { WordStream } from "
|
|
1
|
+
import type { Word } from "@allyhub/piece";
|
|
2
|
+
import { type VoiceFrames } from "@allyhub/piece";
|
|
3
|
+
import { WordStream } from "@allyhub/piece";
|
|
4
4
|
/** Words removed: indices into the take's words file, inclusive, with their text. */
|
|
5
5
|
export interface EditRange {
|
|
6
6
|
from: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{PAD_MAX as X}from"@allyhub/formats";import{quietest as Y}from"
|
|
2
|
+
import{PAD_MAX as X}from"@allyhub/formats";import{quietest as Y}from"@allyhub/piece";import{joinWords as Z,normText as w,WordStream as z}from"@allyhub/piece";export const PAD_BEFORE=.12,PAD_AFTER=.08;const $=.04,R=.04,A=e=>Math.round(e*1e3)/1e3,T=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0;export function parseEditList(e){if(typeof e!="object"||e===null||Array.isArray(e))return"an edits file is a JSON object: { version: 1, remove, sounds, inWord, maxPause, pad }";const t=e;if(t.version!==1)return"version is 1";for(const o of["take","$schema"])if(t[o]!==void 0&&typeof t[o]!="string")return`${o} is a string`;const s=Object.keys(t).filter(o=>!["version","remove","sounds","inWord","maxPause","pad","take","$schema"].includes(o));if(s.length>0)return`unknown field${s.length>1?"s":""} ${s.join(", ")} (an edits file has version, remove, sounds, inWord, maxPause, pad and take)`;const f={};if(t.remove!==void 0){if(!Array.isArray(t.remove))return"remove is a list of { from, to, text }";const o=[];for(const[i,k]of t.remove.entries()){const u=k,M=u?.from,m=u?.to,p=u?.text;if(typeof M!="number"||typeof m!="number"||!Number.isInteger(M)||!Number.isInteger(m)||M<0||m<M||p!==void 0&&typeof p!="string")return`remove[${String(i)}] is not { from, to, text } with word indices from ≤ to`;o.push({from:M,to:m,...p===void 0?{}:{text:p}})}f.remove=o}for(const o of["sounds","inWord"]){if(t[o]===void 0)continue;if(!Array.isArray(t[o]))return`${o} is a list of { from, to } in seconds of the take`;const i=[];for(const[k,u]of t[o].entries()){const M=u,m=M?.from,p=M?.to;if(!T(m)||!T(p)||p<=m)return`${o}[${String(k)}] is not { from, to } in seconds with from < to`;i.push({from:m,to:p})}f[o]=i}const a=t.maxPause;if(a!==void 0){if(typeof a!="number"||!Number.isFinite(a)||a<.05||a>10)return"maxPause is seconds, from 0.05 to 10";f.maxPause=a}const r=t.pad;if(r!==void 0){const o=r,i=typeof r=="object"&&o!==null&&!Array.isArray(r),k=i?Object.keys(o).filter(p=>p!=="before"&&p!=="after"):[],u=p=>p===void 0||T(p)&&p<=X;if(!i||k.length>0||!u(o.before)||!u(o.after))return`pad is { before, after }: seconds of silence kept before and after each cut, each from 0 to ${String(X)}`;const M=o.before,m=o.after;f.pad={...M===void 0?{}:{before:M},...m===void 0?{}:{after:m}}}return f}export function rangeText(e,t,s){return Z(e.slice(t,s+1))}export function locateRange(e,t,s=new z(e)){const f=t.from>=0&&t.to<e.length&&t.to>=t.from;if(t.text===void 0)return f?{from:t.from,to:t.to}:void 0;const a=w(t.text);if(a==="")return f?{from:t.from,to:t.to}:void 0;if(f&&w(rangeText(e,t.from,t.to))===a)return{from:t.from,to:t.to};let r;for(let o=1;;o++){const i=s.span(a,0,e.length-1,o);if(!i)break;w(rangeText(e,i.first,i.last))===a&&(!r||Math.abs(i.first-t.from)<Math.abs(r.from-t.from))&&(r={from:i.first,to:i.last})}return r}export function removedWords(e,t,s=new z(e)){const f=new Set,a=[];for(const r of t?.remove??[]){const o=locateRange(e,r,s);if(!o){a.push(r);continue}for(let i=o.from;i<=o.to;i++)f.add(i)}return{cut:f,lost:a}}export function snapCut(e,t,s,f){const a=Math.min(Math.max(t,s),f);return e?Y(e,a,Math.max(s,a-$),Math.min(f,a+$)):a}const tt=.5,ot=.6;export function speechPads(e,t,s,f,a){const r=e[t],o=e[s]??r;if(!r||!o)return{padIn:0,padOut:0};const i=r.start,k=e[t-1]?.end??0,u=e[s+1]?.start??f??o.end+.4,M=Math.max(0,Math.min((i-k)/2,i)),m=Math.max(0,(u-o.end)/2),p=snapCut(a,i-Math.min(tt,M),i-M,i),g=snapCut(a,o.end+Math.min(ot,m),o.end,o.end+m);return{padIn:A(Math.max(0,i-p)),padOut:A(Math.max(0,g-o.end))}}export function applyEdits(e,t,s=0,f=e.length-1,a={}){const{levels:r,fps:o}=a,{cut:i,lost:k}=removedWords(e,t),u=[];for(let n=s;n<=f;n++)i.has(n)||u.push(n);const M=[...i].filter(n=>n>=s&&n<=f).sort((n,c)=>n-c),m=t?.maxPause,p=[],g=[],y=n=>e[n]??{text:"",start:0,end:0};if(u.length===0)return{ranges:[],words:[],kept:u,removed:M,sounds:[],inWord:[],pauses:p,lost:k};const _=[],j=new Map;for(const n of t?.sounds??[])for(let c=0;c<u.length-1;c++){const h=y(u[c]??0),l=y(u[c+1]??0),b=Math.max(n.from,h.end),x=Math.min(n.to,l.start);if(x-b<.01)continue;const d=j.get(c)??[];d.push({start:b,end:x}),j.set(c,d),_.push({from:A(b),to:A(x)})}const F=y(u[0]??0);let O=F.start,W=F.start;const B=t?.pad?.before??PAD_BEFORE,C=t?.pad?.after??PAD_AFTER,H=m===void 0?B:Math.min(B,m/2),K=m===void 0?C:Math.min(C,m/2);for(let n=0;n<u.length-1;n++){const c=u[n]??0,h=u[n+1]??0,l=y(c),b=y(h),x=[];for(let v=c+1;v<h;v++)x.push({start:y(v).start,end:y(v).end});x.push(...j.get(n)??[]),x.sort((v,P)=>v.start-P.start);const d=x[0],N=x.at(-1);if(!d||!N){const v=b.start-l.end;if(m!==void 0&&v>m){const P=snapCut(r,l.end+m/2,l.end,b.start),S=snapCut(r,b.start-m/2,P,b.start);S-P>=R&&(p.push({after:c,was:A(v),now:m}),g.push({from:O,to:P,lo:W,hi:S}),O=S,W=P)}continue}const J=Math.max(0,d.start-l.end),q=Math.max(0,b.start-N.end),U=snapCut(r,l.end+Math.min(H,J/2),l.end,l.end+J/2),V=snapCut(r,b.start-Math.min(K,q/2),b.start-q/2,b.start);g.push({from:O,to:U,lo:W,hi:d.start}),O=Math.max(V,U),W=Math.min(O,N.end)}const D=y(u.at(-1)??0);g.push({from:O,to:D.end,lo:W,hi:D.end});const L=[];for(const n of t?.inWord??[]){const c=(n.from+n.to)/2,h=snapCut(r,n.from,n.from-$,c),l=snapCut(r,n.to,c,n.to+$);if(l-h<R)continue;let b=!1;for(let x=0;x<g.length;x++){const d=g[x];!d||h>=d.to||l<=d.from||(b=!0,h>d.from&&l<d.to?(g.splice(x,1,{from:d.from,to:h,lo:d.lo,hi:h},{from:l,to:d.to,lo:l,hi:d.hi}),x++):h<=d.from&&l>=d.to?(g.splice(x,1),x--):h<=d.from?(d.from=l,d.lo=l):(d.to=h,d.hi=h))}b&&L.push({from:A(h),to:A(l),words:u.filter(x=>y(x).start<l&&y(x).end>h)})}o!==void 0&&o>0&&g.forEach((n,c)=>{if(c>0){const h=Math.floor(n.from*o+1e-6)/o;h>=n.lo-1e-9&&(n.from=h)}if(c<g.length-1){const h=Math.ceil(n.to*o-1e-6)/o;h<=n.hi+1e-9&&(n.to=h)}});const E=[];for(const n of g){const c=E.at(-1);c&&n.from-c.to<R?c.to=Math.max(c.to,n.to):E.push({from:n.from,to:n.to})}const I=E.map(n=>({from:A(n.from),to:A(n.to)})),Q=editedLength(I),G=n=>A(Math.min(Q,Math.max(0,toEdited(I,n))));return{ranges:I,words:u.map(n=>{const c=y(n);return{text:c.text,start:G(c.start),end:G(c.end)}}),kept:u,removed:M,sounds:_,inWord:L,pauses:p,lost:k}}export function editedLength(e){return e.reduce((t,s)=>t+(s.to-s.from),0)}export function toEdited(e,t){let s=0;const f=e[0];if(!f)return t;if(t<=f.from)return t-f.from;for(const r of e){if(t<r.from)return s;if(t<=r.to)return s+(t-r.from);s+=r.to-r.from}const a=e.at(-1)??f;return s+(t-a.to)}export function fromEdited(e,t){const s=e[0];if(!s)return t;if(t<=0)return s.from+t;let f=0;for(const r of e){const o=r.to-r.from;if(t<f+o)return r.from+(t-f);f+=o}return(e.at(-1)??s).to+(t-f)}
|