@kvman/kvvideo 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/api.d.ts +105 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2 -0
- package/dist/api.js.map +1 -0
- package/dist/brand/brand.d.ts +17 -0
- package/dist/brand/brand.d.ts.map +1 -0
- package/dist/brand/brand.js +44 -0
- package/dist/brand/brand.js.map +1 -0
- package/dist/browser/channels.d.ts +6 -0
- package/dist/browser/channels.d.ts.map +1 -0
- package/dist/browser/channels.js +5 -0
- package/dist/browser/channels.js.map +1 -0
- package/dist/browser/launch.d.ts +6 -0
- package/dist/browser/launch.d.ts.map +1 -0
- package/dist/browser/launch.js +14 -0
- package/dist/browser/launch.js.map +1 -0
- package/dist/browser/start-browser.d.ts +5 -0
- package/dist/browser/start-browser.d.ts.map +1 -0
- package/dist/browser/start-browser.js +17 -0
- package/dist/browser/start-browser.js.map +1 -0
- package/dist/compose/ass-file.d.ts +17 -0
- package/dist/compose/ass-file.d.ts.map +1 -0
- package/dist/compose/ass-file.js +65 -0
- package/dist/compose/ass-file.js.map +1 -0
- package/dist/compose/background.d.ts +23 -0
- package/dist/compose/background.d.ts.map +1 -0
- package/dist/compose/background.js +31 -0
- package/dist/compose/background.js.map +1 -0
- package/dist/compose/camera.d.ts +32 -0
- package/dist/compose/camera.d.ts.map +1 -0
- package/dist/compose/camera.js +98 -0
- package/dist/compose/camera.js.map +1 -0
- package/dist/compose/caption-font.d.ts +8 -0
- package/dist/compose/caption-font.d.ts.map +1 -0
- package/dist/compose/caption-font.js +24 -0
- package/dist/compose/caption-font.js.map +1 -0
- package/dist/compose/compose-drawing.d.ts +19 -0
- package/dist/compose/compose-drawing.d.ts.map +1 -0
- package/dist/compose/compose-drawing.js +38 -0
- package/dist/compose/compose-drawing.js.map +1 -0
- package/dist/compose/compose-input.d.ts +187 -0
- package/dist/compose/compose-input.d.ts.map +1 -0
- package/dist/compose/compose-input.js +76 -0
- package/dist/compose/compose-input.js.map +1 -0
- package/dist/compose/compose-plan.d.ts +36 -0
- package/dist/compose/compose-plan.d.ts.map +1 -0
- package/dist/compose/compose-plan.js +55 -0
- package/dist/compose/compose-plan.js.map +1 -0
- package/dist/compose/compose-size.d.ts +50 -0
- package/dist/compose/compose-size.d.ts.map +1 -0
- package/dist/compose/compose-size.js +72 -0
- package/dist/compose/compose-size.js.map +1 -0
- package/dist/compose/drawn-images.d.ts +19 -0
- package/dist/compose/drawn-images.d.ts.map +1 -0
- package/dist/compose/drawn-images.js +75 -0
- package/dist/compose/drawn-images.js.map +1 -0
- package/dist/compose/final-pass.d.ts +34 -0
- package/dist/compose/final-pass.d.ts.map +1 -0
- package/dist/compose/final-pass.js +106 -0
- package/dist/compose/final-pass.js.map +1 -0
- package/dist/compose/frame-layout.d.ts +30 -0
- package/dist/compose/frame-layout.d.ts.map +1 -0
- package/dist/compose/frame-layout.js +33 -0
- package/dist/compose/frame-layout.js.map +1 -0
- package/dist/compose/overlays.d.ts +20 -0
- package/dist/compose/overlays.d.ts.map +1 -0
- package/dist/compose/overlays.js +30 -0
- package/dist/compose/overlays.js.map +1 -0
- package/dist/compose/page-again.d.ts +26 -0
- package/dist/compose/page-again.d.ts.map +1 -0
- package/dist/compose/page-again.js +50 -0
- package/dist/compose/page-again.js.map +1 -0
- package/dist/compose/player-copies.d.ts +10 -0
- package/dist/compose/player-copies.d.ts.map +1 -0
- package/dist/compose/player-copies.js +34 -0
- package/dist/compose/player-copies.js.map +1 -0
- package/dist/compose/register-compose.d.ts +3 -0
- package/dist/compose/register-compose.d.ts.map +1 -0
- package/dist/compose/register-compose.js +151 -0
- package/dist/compose/register-compose.js.map +1 -0
- package/dist/compose/render.d.ts +25 -0
- package/dist/compose/render.d.ts.map +1 -0
- package/dist/compose/render.js +61 -0
- package/dist/compose/render.js.map +1 -0
- package/dist/compose/scene-args.d.ts +37 -0
- package/dist/compose/scene-args.d.ts.map +1 -0
- package/dist/compose/scene-args.js +103 -0
- package/dist/compose/scene-args.js.map +1 -0
- package/dist/compose/scene-look.d.ts +31 -0
- package/dist/compose/scene-look.d.ts.map +1 -0
- package/dist/compose/scene-look.js +46 -0
- package/dist/compose/scene-look.js.map +1 -0
- package/dist/compose/scene-plan.d.ts +26 -0
- package/dist/compose/scene-plan.d.ts.map +1 -0
- package/dist/compose/scene-plan.js +34 -0
- package/dist/compose/scene-plan.js.map +1 -0
- package/dist/compose/sound-effects.d.ts +23 -0
- package/dist/compose/sound-effects.d.ts.map +1 -0
- package/dist/compose/sound-effects.js +40 -0
- package/dist/compose/sound-effects.js.map +1 -0
- package/dist/compose/srt.d.ts +3 -0
- package/dist/compose/srt.d.ts.map +1 -0
- package/dist/compose/srt.js +10 -0
- package/dist/compose/srt.js.map +1 -0
- package/dist/compose/transitions.d.ts +16 -0
- package/dist/compose/transitions.d.ts.map +1 -0
- package/dist/compose/transitions.js +38 -0
- package/dist/compose/transitions.js.map +1 -0
- package/dist/connector.d.ts +132 -0
- package/dist/connector.d.ts.map +1 -0
- package/dist/connector.js +63 -0
- package/dist/connector.js.map +1 -0
- package/dist/files/answer-path.d.ts +3 -0
- package/dist/files/answer-path.d.ts.map +1 -0
- package/dist/files/answer-path.js +6 -0
- package/dist/files/answer-path.js.map +1 -0
- package/dist/files/place-output.d.ts +8 -0
- package/dist/files/place-output.d.ts.map +1 -0
- package/dist/files/place-output.js +24 -0
- package/dist/files/place-output.js.map +1 -0
- package/dist/files/sidecar.d.ts +209 -0
- package/dist/files/sidecar.d.ts.map +1 -0
- package/dist/files/sidecar.js +66 -0
- package/dist/files/sidecar.js.map +1 -0
- package/dist/files/workspace-paths.d.ts +7 -0
- package/dist/files/workspace-paths.d.ts.map +1 -0
- package/dist/files/workspace-paths.js +48 -0
- package/dist/files/workspace-paths.js.map +1 -0
- package/dist/fonts/bundled-fonts.d.ts +10 -0
- package/dist/fonts/bundled-fonts.d.ts.map +1 -0
- package/dist/fonts/bundled-fonts.js +10 -0
- package/dist/fonts/bundled-fonts.js.map +1 -0
- package/dist/fonts/font-family.d.ts +2 -0
- package/dist/fonts/font-family.d.ts.map +1 -0
- package/dist/fonts/font-family.js +43 -0
- package/dist/fonts/font-family.js.map +1 -0
- package/dist/fonts/register-fonts.d.ts +3 -0
- package/dist/fonts/register-fonts.d.ts.map +1 -0
- package/dist/fonts/register-fonts.js +12 -0
- package/dist/fonts/register-fonts.js.map +1 -0
- package/dist/guide.d.ts +3 -0
- package/dist/guide.d.ts.map +1 -0
- package/dist/guide.js +6 -0
- package/dist/guide.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/narration/alignment.d.ts +15 -0
- package/dist/narration/alignment.d.ts.map +1 -0
- package/dist/narration/alignment.js +21 -0
- package/dist/narration/alignment.js.map +1 -0
- package/dist/narration/captions.d.ts +28 -0
- package/dist/narration/captions.d.ts.map +1 -0
- package/dist/narration/captions.js +70 -0
- package/dist/narration/captions.js.map +1 -0
- package/dist/narration/join-args.d.ts +3 -0
- package/dist/narration/join-args.d.ts.map +1 -0
- package/dist/narration/join-args.js +19 -0
- package/dist/narration/join-args.js.map +1 -0
- package/dist/narration/narration-cache.d.ts +25 -0
- package/dist/narration/narration-cache.d.ts.map +1 -0
- package/dist/narration/narration-cache.js +36 -0
- package/dist/narration/narration-cache.js.map +1 -0
- package/dist/narration/piper.d.ts +4 -0
- package/dist/narration/piper.d.ts.map +1 -0
- package/dist/narration/piper.js +13 -0
- package/dist/narration/piper.js.map +1 -0
- package/dist/narration/pronunciations.d.ts +11 -0
- package/dist/narration/pronunciations.d.ts.map +1 -0
- package/dist/narration/pronunciations.js +40 -0
- package/dist/narration/pronunciations.js.map +1 -0
- package/dist/narration/register-narration.d.ts +25 -0
- package/dist/narration/register-narration.d.ts.map +1 -0
- package/dist/narration/register-narration.js +103 -0
- package/dist/narration/register-narration.js.map +1 -0
- package/dist/narration/register-voice.d.ts +27 -0
- package/dist/narration/register-voice.d.ts.map +1 -0
- package/dist/narration/register-voice.js +82 -0
- package/dist/narration/register-voice.js.map +1 -0
- package/dist/narration/sentence-speaker.d.ts +35 -0
- package/dist/narration/sentence-speaker.d.ts.map +1 -0
- package/dist/narration/sentence-speaker.js +44 -0
- package/dist/narration/sentence-speaker.js.map +1 -0
- package/dist/narration/speech-services.d.ts +39 -0
- package/dist/narration/speech-services.d.ts.map +1 -0
- package/dist/narration/speech-services.js +67 -0
- package/dist/narration/speech-services.js.map +1 -0
- package/dist/narration/voice-args.d.ts +3 -0
- package/dist/narration/voice-args.d.ts.map +1 -0
- package/dist/narration/voice-args.js +10 -0
- package/dist/narration/voice-args.js.map +1 -0
- package/dist/problems.d.ts +12 -0
- package/dist/problems.d.ts.map +1 -0
- package/dist/problems.js +19 -0
- package/dist/problems.js.map +1 -0
- package/dist/programs/kill-tree.d.ts +16 -0
- package/dist/programs/kill-tree.d.ts.map +1 -0
- package/dist/programs/kill-tree.js +28 -0
- package/dist/programs/kill-tree.js.map +1 -0
- package/dist/programs/media-duration.d.ts +22 -0
- package/dist/programs/media-duration.d.ts.map +1 -0
- package/dist/programs/media-duration.js +23 -0
- package/dist/programs/media-duration.js.map +1 -0
- package/dist/programs/piped-program.d.ts +7 -0
- package/dist/programs/piped-program.d.ts.map +1 -0
- package/dist/programs/piped-program.js +45 -0
- package/dist/programs/piped-program.js.map +1 -0
- package/dist/programs/programs.d.ts +6 -0
- package/dist/programs/programs.d.ts.map +1 -0
- package/dist/programs/programs.js +6 -0
- package/dist/programs/programs.js.map +1 -0
- package/dist/programs/run-program.d.ts +23 -0
- package/dist/programs/run-program.d.ts.map +1 -0
- package/dist/programs/run-program.js +47 -0
- package/dist/programs/run-program.js.map +1 -0
- package/dist/record/address.d.ts +5 -0
- package/dist/record/address.d.ts.map +1 -0
- package/dist/record/address.js +26 -0
- package/dist/record/address.js.map +1 -0
- package/dist/record/cursor-script.d.ts +3 -0
- package/dist/record/cursor-script.d.ts.map +1 -0
- package/dist/record/cursor-script.js +59 -0
- package/dist/record/cursor-script.js.map +1 -0
- package/dist/record/encoder-args.d.ts +3 -0
- package/dist/record/encoder-args.d.ts.map +1 -0
- package/dist/record/encoder-args.js +13 -0
- package/dist/record/encoder-args.js.map +1 -0
- package/dist/record/frame-writer.d.ts +8 -0
- package/dist/record/frame-writer.d.ts.map +1 -0
- package/dist/record/frame-writer.js +30 -0
- package/dist/record/frame-writer.js.map +1 -0
- package/dist/record/motion.d.ts +19 -0
- package/dist/record/motion.d.ts.map +1 -0
- package/dist/record/motion.js +59 -0
- package/dist/record/motion.js.map +1 -0
- package/dist/record/narration-cues.d.ts +14 -0
- package/dist/record/narration-cues.d.ts.map +1 -0
- package/dist/record/narration-cues.js +12 -0
- package/dist/record/narration-cues.js.map +1 -0
- package/dist/record/own-port.d.ts +2 -0
- package/dist/record/own-port.d.ts.map +1 -0
- package/dist/record/own-port.js +23 -0
- package/dist/record/own-port.js.map +1 -0
- package/dist/record/page-ready.d.ts +4 -0
- package/dist/record/page-ready.d.ts.map +1 -0
- package/dist/record/page-ready.js +15 -0
- package/dist/record/page-ready.js.map +1 -0
- package/dist/record/page-route.d.ts +13 -0
- package/dist/record/page-route.d.ts.map +1 -0
- package/dist/record/page-route.js +64 -0
- package/dist/record/page-route.js.map +1 -0
- package/dist/record/pointer.d.ts +8 -0
- package/dist/record/pointer.d.ts.map +1 -0
- package/dist/record/pointer.js +24 -0
- package/dist/record/pointer.js.map +1 -0
- package/dist/record/recorder.d.ts +34 -0
- package/dist/record/recorder.d.ts.map +1 -0
- package/dist/record/recorder.js +99 -0
- package/dist/record/recorder.js.map +1 -0
- package/dist/record/register-record.d.ts +3 -0
- package/dist/record/register-record.d.ts.map +1 -0
- package/dist/record/register-record.js +83 -0
- package/dist/record/register-record.js.map +1 -0
- package/dist/record/run-step.d.ts +20 -0
- package/dist/record/run-step.d.ts.map +1 -0
- package/dist/record/run-step.js +69 -0
- package/dist/record/run-step.js.map +1 -0
- package/dist/record/screencast.d.ts +9 -0
- package/dist/record/screencast.d.ts.map +1 -0
- package/dist/record/screencast.js +38 -0
- package/dist/record/screencast.js.map +1 -0
- package/dist/record/steps.d.ts +124 -0
- package/dist/record/steps.d.ts.map +1 -0
- package/dist/record/steps.js +47 -0
- package/dist/record/steps.js.map +1 -0
- package/dist/register-with-kvcoder.d.ts +3 -0
- package/dist/register-with-kvcoder.d.ts.map +1 -0
- package/dist/register-with-kvcoder.js +15 -0
- package/dist/register-with-kvcoder.js.map +1 -0
- package/dist/review/analysis.d.ts +19 -0
- package/dist/review/analysis.d.ts.map +1 -0
- package/dist/review/analysis.js +36 -0
- package/dist/review/analysis.js.map +1 -0
- package/dist/review/frames.d.ts +9 -0
- package/dist/review/frames.d.ts.map +1 -0
- package/dist/review/frames.js +28 -0
- package/dist/review/frames.js.map +1 -0
- package/dist/review/register-review.d.ts +24 -0
- package/dist/review/register-review.d.ts.map +1 -0
- package/dist/review/register-review.js +81 -0
- package/dist/review/register-review.js.map +1 -0
- package/dist/review/sheet-args.d.ts +11 -0
- package/dist/review/sheet-args.d.ts.map +1 -0
- package/dist/review/sheet-args.js +24 -0
- package/dist/review/sheet-args.js.map +1 -0
- package/dist/settings.d.ts +33 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +29 -0
- package/dist/settings.js.map +1 -0
- package/dist/setup/browser-readiness.d.ts +14 -0
- package/dist/setup/browser-readiness.d.ts.map +1 -0
- package/dist/setup/browser-readiness.js +16 -0
- package/dist/setup/browser-readiness.js.map +1 -0
- package/dist/setup/ffmpeg-readiness.d.ts +19 -0
- package/dist/setup/ffmpeg-readiness.d.ts.map +1 -0
- package/dist/setup/ffmpeg-readiness.js +33 -0
- package/dist/setup/ffmpeg-readiness.js.map +1 -0
- package/dist/setup/narration-readiness.d.ts +21 -0
- package/dist/setup/narration-readiness.d.ts.map +1 -0
- package/dist/setup/narration-readiness.js +18 -0
- package/dist/setup/narration-readiness.js.map +1 -0
- package/dist/setup/register-setup.d.ts +3 -0
- package/dist/setup/register-setup.d.ts.map +1 -0
- package/dist/setup/register-setup.js +51 -0
- package/dist/setup/register-setup.js.map +1 -0
- package/dist/ui.d.ts +3 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +26 -0
- package/dist/ui.js.map +1 -0
- package/dist/video-start.d.ts +3 -0
- package/dist/video-start.d.ts.map +1 -0
- package/dist/video-start.js +28 -0
- package/dist/video-start.js.map +1 -0
- package/dist/web/components/player.css +2 -0
- package/dist/web/components/player.js +55 -0
- package/docs/guide.md +28 -0
- package/fonts/Amiri-Bold.ttf +0 -0
- package/fonts/IBMPlexSansArabic-Bold.ttf +0 -0
- package/fonts/Lato-Bold.ttf +0 -0
- package/fonts/OFL-Amiri.txt +94 -0
- package/fonts/OFL-IBMPlexSansArabic.txt +93 -0
- package/fonts/OFL-Lato.txt +93 -0
- package/fonts/OFL-Poppins.txt +93 -0
- package/fonts/Poppins-Bold.ttf +0 -0
- package/locales/ar.json +48 -0
- package/locales/en.json +48 -0
- package/package.json +73 -3
- package/sounds/SOURCES.md +13 -0
- package/sounds/click.wav +0 -0
- package/sounds/keys.wav +0 -0
- package/sounds/pop.wav +0 -0
- package/sounds/whoosh.wav +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z } from '@kvman/sdk';
|
|
2
|
+
export declare const sidecarCaptionSchema: z.ZodObject<{
|
|
3
|
+
text: z.ZodString;
|
|
4
|
+
startMs: z.ZodNumber;
|
|
5
|
+
endMs: z.ZodNumber;
|
|
6
|
+
words: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
startMs: z.ZodNumber;
|
|
9
|
+
endMs: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const recordingSidecarSchema: z.ZodObject<{
|
|
13
|
+
kind: z.ZodEnum<{
|
|
14
|
+
page: "page";
|
|
15
|
+
site: "site";
|
|
16
|
+
}>;
|
|
17
|
+
source: z.ZodString;
|
|
18
|
+
width: z.ZodNumber;
|
|
19
|
+
height: z.ZodNumber;
|
|
20
|
+
device: z.ZodEnum<{
|
|
21
|
+
phone: "phone";
|
|
22
|
+
desktop: "desktop";
|
|
23
|
+
}>;
|
|
24
|
+
scale: z.ZodLiteral<2>;
|
|
25
|
+
durationMs: z.ZodNumber;
|
|
26
|
+
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
do: z.ZodLiteral<"goto">;
|
|
28
|
+
url: z.ZodString;
|
|
29
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
do: z.ZodLiteral<"click">;
|
|
32
|
+
target: z.ZodString;
|
|
33
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
34
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
+
do: z.ZodLiteral<"type">;
|
|
36
|
+
target: z.ZodString;
|
|
37
|
+
text: z.ZodString;
|
|
38
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
39
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
40
|
+
do: z.ZodLiteral<"press">;
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
do: z.ZodLiteral<"hover">;
|
|
45
|
+
target: z.ZodString;
|
|
46
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
do: z.ZodLiteral<"scroll">;
|
|
49
|
+
pixels: z.ZodNumber;
|
|
50
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
51
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
52
|
+
do: z.ZodLiteral<"wait">;
|
|
53
|
+
ms: z.ZodNumber;
|
|
54
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
55
|
+
do: z.ZodLiteral<"waitFor">;
|
|
56
|
+
target: z.ZodString;
|
|
57
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
58
|
+
}, z.core.$strict>], "do">>;
|
|
59
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
60
|
+
do: z.ZodString;
|
|
61
|
+
atMs: z.ZodNumber;
|
|
62
|
+
actMs: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
endMs: z.ZodNumber;
|
|
64
|
+
box: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
x: z.ZodNumber;
|
|
66
|
+
y: z.ZodNumber;
|
|
67
|
+
width: z.ZodNumber;
|
|
68
|
+
height: z.ZodNumber;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const narrationSidecarSchema: z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"narration">;
|
|
74
|
+
durationMs: z.ZodNumber;
|
|
75
|
+
captions: z.ZodArray<z.ZodObject<{
|
|
76
|
+
text: z.ZodString;
|
|
77
|
+
startMs: z.ZodNumber;
|
|
78
|
+
endMs: z.ZodNumber;
|
|
79
|
+
words: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
|
|
80
|
+
text: z.ZodString;
|
|
81
|
+
startMs: z.ZodNumber;
|
|
82
|
+
endMs: z.ZodNumber;
|
|
83
|
+
}, z.core.$strip>>>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export declare const videoSidecarSchema: z.ZodObject<{
|
|
87
|
+
kind: z.ZodLiteral<"video">;
|
|
88
|
+
durationMs: z.ZodNumber;
|
|
89
|
+
width: z.ZodNumber;
|
|
90
|
+
height: z.ZodNumber;
|
|
91
|
+
scenes: z.ZodArray<z.ZodObject<{
|
|
92
|
+
startMs: z.ZodNumber;
|
|
93
|
+
endMs: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
captions: z.ZodArray<z.ZodObject<{
|
|
96
|
+
text: z.ZodString;
|
|
97
|
+
startMs: z.ZodNumber;
|
|
98
|
+
endMs: z.ZodNumber;
|
|
99
|
+
words: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
|
|
100
|
+
text: z.ZodString;
|
|
101
|
+
startMs: z.ZodNumber;
|
|
102
|
+
endMs: z.ZodNumber;
|
|
103
|
+
}, z.core.$strip>>>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
declare const sidecarSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
107
|
+
kind: z.ZodEnum<{
|
|
108
|
+
page: "page";
|
|
109
|
+
site: "site";
|
|
110
|
+
}>;
|
|
111
|
+
source: z.ZodString;
|
|
112
|
+
width: z.ZodNumber;
|
|
113
|
+
height: z.ZodNumber;
|
|
114
|
+
device: z.ZodEnum<{
|
|
115
|
+
phone: "phone";
|
|
116
|
+
desktop: "desktop";
|
|
117
|
+
}>;
|
|
118
|
+
scale: z.ZodLiteral<2>;
|
|
119
|
+
durationMs: z.ZodNumber;
|
|
120
|
+
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
121
|
+
do: z.ZodLiteral<"goto">;
|
|
122
|
+
url: z.ZodString;
|
|
123
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
124
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
125
|
+
do: z.ZodLiteral<"click">;
|
|
126
|
+
target: z.ZodString;
|
|
127
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
128
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
129
|
+
do: z.ZodLiteral<"type">;
|
|
130
|
+
target: z.ZodString;
|
|
131
|
+
text: z.ZodString;
|
|
132
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
do: z.ZodLiteral<"press">;
|
|
135
|
+
key: z.ZodString;
|
|
136
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
137
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
138
|
+
do: z.ZodLiteral<"hover">;
|
|
139
|
+
target: z.ZodString;
|
|
140
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
141
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
142
|
+
do: z.ZodLiteral<"scroll">;
|
|
143
|
+
pixels: z.ZodNumber;
|
|
144
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
146
|
+
do: z.ZodLiteral<"wait">;
|
|
147
|
+
ms: z.ZodNumber;
|
|
148
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
149
|
+
do: z.ZodLiteral<"waitFor">;
|
|
150
|
+
target: z.ZodString;
|
|
151
|
+
atLine: z.ZodExactOptional<z.ZodNumber>;
|
|
152
|
+
}, z.core.$strict>], "do">>;
|
|
153
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
154
|
+
do: z.ZodString;
|
|
155
|
+
atMs: z.ZodNumber;
|
|
156
|
+
actMs: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
endMs: z.ZodNumber;
|
|
158
|
+
box: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
x: z.ZodNumber;
|
|
160
|
+
y: z.ZodNumber;
|
|
161
|
+
width: z.ZodNumber;
|
|
162
|
+
height: z.ZodNumber;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
kind: z.ZodLiteral<"narration">;
|
|
167
|
+
durationMs: z.ZodNumber;
|
|
168
|
+
captions: z.ZodArray<z.ZodObject<{
|
|
169
|
+
text: z.ZodString;
|
|
170
|
+
startMs: z.ZodNumber;
|
|
171
|
+
endMs: z.ZodNumber;
|
|
172
|
+
words: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
|
|
173
|
+
text: z.ZodString;
|
|
174
|
+
startMs: z.ZodNumber;
|
|
175
|
+
endMs: z.ZodNumber;
|
|
176
|
+
}, z.core.$strip>>>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
kind: z.ZodLiteral<"video">;
|
|
180
|
+
durationMs: z.ZodNumber;
|
|
181
|
+
width: z.ZodNumber;
|
|
182
|
+
height: z.ZodNumber;
|
|
183
|
+
scenes: z.ZodArray<z.ZodObject<{
|
|
184
|
+
startMs: z.ZodNumber;
|
|
185
|
+
endMs: z.ZodNumber;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
captions: z.ZodArray<z.ZodObject<{
|
|
188
|
+
text: z.ZodString;
|
|
189
|
+
startMs: z.ZodNumber;
|
|
190
|
+
endMs: z.ZodNumber;
|
|
191
|
+
words: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
|
|
192
|
+
text: z.ZodString;
|
|
193
|
+
startMs: z.ZodNumber;
|
|
194
|
+
endMs: z.ZodNumber;
|
|
195
|
+
}, z.core.$strip>>>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>], "kind">;
|
|
198
|
+
/** What a sidecar holds. */
|
|
199
|
+
export type Sidecar = z.output<typeof sidecarSchema>;
|
|
200
|
+
/** The sidecar's path beside a file. */
|
|
201
|
+
export declare function sidecarPath(file: string): string;
|
|
202
|
+
/** The sidecar beside an output; an existing one is replaced only with `replace` (plan 16 §16.3). */
|
|
203
|
+
export declare function sidecarOutputPath(output: string, replace: boolean, shown: string): string;
|
|
204
|
+
/** The sidecar beside `file`, or `undefined` when it is missing or invalid. */
|
|
205
|
+
export declare function readSidecar(file: string): Sidecar | undefined;
|
|
206
|
+
/** Writes a sidecar into a work folder, to be placed beside its output; answers its path there. */
|
|
207
|
+
export declare function writeSidecar(folder: string, sidecar: Sidecar): string;
|
|
208
|
+
export {};
|
|
209
|
+
//# sourceMappingURL=sidecar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/files/sidecar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAS/B,eAAO,MAAM,oBAAoB;;;;;;;;;iBAA6J,CAAC;AAE/L,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;iBAAkI,CAAC;AAEtK,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;iBAO7B,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAqG,CAAC;AAEzH,4BAA4B;AAC5B,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wCAAwC;AACxC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzF;AAWD,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAK7D;AAED,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAIrE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { z } from '@kvman/sdk';
|
|
4
|
+
import { invalid } from "../problems.js";
|
|
5
|
+
import { actionSchema, stepSchema } from "../record/steps.js";
|
|
6
|
+
// The sidecar beside an output, `<file>.kvvideo.json` (plan 16 §16.3; ADR 0115, 31): what a later command needs from
|
|
7
|
+
// it, so the agent copies no numbers between calls. It is validated when read; a missing or invalid one is absent.
|
|
8
|
+
const wordSchema = z.object({ text: z.string(), startMs: z.number().int().nonnegative(), endMs: z.number().int().nonnegative() });
|
|
9
|
+
export const sidecarCaptionSchema = z.object({ text: z.string(), startMs: z.number().int().nonnegative(), endMs: z.number().int().nonnegative(), words: z.array(wordSchema).exactOptional() });
|
|
10
|
+
export const recordingSidecarSchema = z.object({
|
|
11
|
+
kind: z.enum(['site', 'page']),
|
|
12
|
+
source: z.string(),
|
|
13
|
+
width: z.number().int().positive(),
|
|
14
|
+
height: z.number().int().positive(),
|
|
15
|
+
device: z.enum(['desktop', 'phone']),
|
|
16
|
+
scale: z.literal(2),
|
|
17
|
+
durationMs: z.number().int().nonnegative(),
|
|
18
|
+
steps: z.array(stepSchema),
|
|
19
|
+
actions: z.array(actionSchema),
|
|
20
|
+
});
|
|
21
|
+
export const narrationSidecarSchema = z.object({ kind: z.literal('narration'), durationMs: z.number().int().nonnegative(), captions: z.array(sidecarCaptionSchema) });
|
|
22
|
+
export const videoSidecarSchema = z.object({
|
|
23
|
+
kind: z.literal('video'),
|
|
24
|
+
durationMs: z.number().int().nonnegative(),
|
|
25
|
+
width: z.number().int().positive(),
|
|
26
|
+
height: z.number().int().positive(),
|
|
27
|
+
scenes: z.array(z.object({ startMs: z.number().int().nonnegative(), endMs: z.number().int().nonnegative() })),
|
|
28
|
+
captions: z.array(sidecarCaptionSchema),
|
|
29
|
+
});
|
|
30
|
+
const sidecarSchema = z.discriminatedUnion('kind', [recordingSidecarSchema, narrationSidecarSchema, videoSidecarSchema]);
|
|
31
|
+
/** The sidecar's path beside a file. */
|
|
32
|
+
export function sidecarPath(file) {
|
|
33
|
+
return `${file}.kvvideo.json`;
|
|
34
|
+
}
|
|
35
|
+
/** The sidecar beside an output; an existing one is replaced only with `replace` (plan 16 §16.3). */
|
|
36
|
+
export function sidecarOutputPath(output, replace, shown) {
|
|
37
|
+
const beside = sidecarPath(output);
|
|
38
|
+
if (existsSync(beside) && !replace)
|
|
39
|
+
throw invalid(`${sidecarPath(shown)} exists; set replace to true to write over it.`, { path: sidecarPath(shown) });
|
|
40
|
+
return beside;
|
|
41
|
+
}
|
|
42
|
+
function parsed(text) {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(text);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof SyntaxError)
|
|
48
|
+
return undefined;
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** The sidecar beside `file`, or `undefined` when it is missing or invalid. */
|
|
53
|
+
export function readSidecar(file) {
|
|
54
|
+
const beside = sidecarPath(file);
|
|
55
|
+
if (!existsSync(beside))
|
|
56
|
+
return undefined;
|
|
57
|
+
const result = sidecarSchema.safeParse(parsed(readFileSync(beside, 'utf8')));
|
|
58
|
+
return result.success ? result.data : undefined;
|
|
59
|
+
}
|
|
60
|
+
/** Writes a sidecar into a work folder, to be placed beside its output; answers its path there. */
|
|
61
|
+
export function writeSidecar(folder, sidecar) {
|
|
62
|
+
const made = path.join(folder, 'sidecar.json');
|
|
63
|
+
writeFileSync(made, `${JSON.stringify(sidecar, null, 2)}\n`);
|
|
64
|
+
return made;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=sidecar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar.js","sourceRoot":"","sources":["../../src/files/sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,E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,CAAC;AAClD,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAgB;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC/C,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A path of the workspace, made absolute; one that leaves it fails `VALIDATION_FAILED`. */
|
|
2
|
+
export declare function workspacePath(root: string, file: string): string;
|
|
3
|
+
/** An existing input file of one of the extensions. */
|
|
4
|
+
export declare function inputPath(root: string, file: string, extensions: readonly string[]): string;
|
|
5
|
+
/** An output file with the extension, its folders made; an existing one only with `replace`. */
|
|
6
|
+
export declare function outputPath(root: string, file: string, extension: string, replace: boolean): string;
|
|
7
|
+
//# sourceMappingURL=workspace-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-paths.d.ts","sourceRoot":"","sources":["../../src/files/workspace-paths.ts"],"names":[],"mappings":"AAmBA,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhE;AAMD,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAK3F;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAMlG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, realpathSync, statSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { invalid, notFound } from "../problems.js";
|
|
4
|
+
// Where kvvideo reads and writes (plan 16 §16.3): every path is inside the workspace folder, through `..` and symlinks
|
|
5
|
+
// alike. An input must exist; an output has its command's extension and is replaced only when asked.
|
|
6
|
+
function inside(root, candidate) {
|
|
7
|
+
const relative = path.relative(root, candidate);
|
|
8
|
+
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
9
|
+
}
|
|
10
|
+
// The real path of the nearest part of `absolute` that exists, so a symlink anywhere along it is followed.
|
|
11
|
+
function realOfNearest(absolute) {
|
|
12
|
+
let existing = absolute;
|
|
13
|
+
while (!existsSync(existing))
|
|
14
|
+
existing = path.dirname(existing);
|
|
15
|
+
return path.join(realpathSync(existing), path.relative(existing, absolute));
|
|
16
|
+
}
|
|
17
|
+
/** A path of the workspace, made absolute; one that leaves it fails `VALIDATION_FAILED`. */
|
|
18
|
+
export function workspacePath(root, file) {
|
|
19
|
+
if (file.trim() === '')
|
|
20
|
+
throw invalid('The path is empty.', { path: file });
|
|
21
|
+
const absolute = path.resolve(root, file);
|
|
22
|
+
if (!inside(root, absolute) || !inside(realpathSync(root), realOfNearest(absolute)))
|
|
23
|
+
throw invalid(`${file} is outside the workspace folder.`, { path: file });
|
|
24
|
+
return absolute;
|
|
25
|
+
}
|
|
26
|
+
function hasExtension(file, extensions) {
|
|
27
|
+
return extensions.includes(path.extname(file).toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
/** An existing input file of one of the extensions. */
|
|
30
|
+
export function inputPath(root, file, extensions) {
|
|
31
|
+
const absolute = workspacePath(root, file);
|
|
32
|
+
if (!hasExtension(file, extensions))
|
|
33
|
+
throw invalid(`${file} isn't one of ${extensions.join(', ')}.`, { path: file, extensions: [...extensions] });
|
|
34
|
+
if (!existsSync(absolute) || !statSync(absolute).isFile())
|
|
35
|
+
throw notFound(`${file} doesn't exist.`, { path: file });
|
|
36
|
+
return absolute;
|
|
37
|
+
}
|
|
38
|
+
/** An output file with the extension, its folders made; an existing one only with `replace`. */
|
|
39
|
+
export function outputPath(root, file, extension, replace) {
|
|
40
|
+
const absolute = workspacePath(root, file);
|
|
41
|
+
if (!hasExtension(file, [extension]))
|
|
42
|
+
throw invalid(`${file} must end with ${extension}.`, { path: file, extension });
|
|
43
|
+
if (existsSync(absolute) && !replace)
|
|
44
|
+
throw invalid(`${file} exists; set replace to true to write over it.`, { path: file });
|
|
45
|
+
mkdirSync(path.dirname(absolute), { recursive: true });
|
|
46
|
+
return absolute;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=workspace-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-paths.js","sourceRoot":"","sources":["../../src/files/workspace-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEnD,uHAAuH;AACvH,qGAAqG;AAErG,SAAS,MAAM,CAAC,IAAY,EAAE,SAAiB;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,2GAA2G;AAC3G,SAAS,aAAa,CAAC,QAAgB;IACrC,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC,IAAI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,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;QAAE,MAAM,QAAQ,CAAC,GAAG,IAAI,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACpH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,SAAiB,EAAE,OAAgB;IACxF,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC;QAAE,MAAM,OAAO,CAAC,GAAG,IAAI,kBAAkB,SAAS,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACtH,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO;QAAE,MAAM,OAAO,CAAC,GAAG,IAAI,gDAAgD,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7H,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type FontScript = 'latin' | 'arabic';
|
|
2
|
+
export type BundledFont = {
|
|
3
|
+
name: string;
|
|
4
|
+
file: string;
|
|
5
|
+
scripts: FontScript[];
|
|
6
|
+
};
|
|
7
|
+
export declare const bundledFonts: readonly BundledFont[];
|
|
8
|
+
/** The folder that holds the bundled fonts, from the source and the build alike. */
|
|
9
|
+
export declare const fontsFolder: string;
|
|
10
|
+
//# sourceMappingURL=bundled-fonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.d.ts","sourceRoot":"","sources":["../../src/fonts/bundled-fonts.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAEhF,eAAO,MAAM,YAAY,EAAE,SAAS,WAAW,EAK9C,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,WAAW,QAA0D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
export const bundledFonts = [
|
|
3
|
+
{ name: 'Amiri', file: 'Amiri-Bold.ttf', scripts: ['arabic', 'latin'] },
|
|
4
|
+
{ name: 'IBM Plex Sans Arabic', file: 'IBMPlexSansArabic-Bold.ttf', scripts: ['arabic', 'latin'] },
|
|
5
|
+
{ name: 'Lato', file: 'Lato-Bold.ttf', scripts: ['latin'] },
|
|
6
|
+
{ name: 'Poppins', file: 'Poppins-Bold.ttf', scripts: ['latin'] },
|
|
7
|
+
];
|
|
8
|
+
/** The folder that holds the bundled fonts, from the source and the build alike. */
|
|
9
|
+
export const fontsFolder = fileURLToPath(new URL('../../fonts/', import.meta.url));
|
|
10
|
+
//# sourceMappingURL=bundled-fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.js","sourceRoot":"","sources":["../../src/fonts/bundled-fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAQzC,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;IACvE,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;IAClG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;IAC3D,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;CAClE,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-family.d.ts","sourceRoot":"","sources":["../../src/fonts/font-family.ts"],"names":[],"mappings":"AAoCA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAS7D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { invalid } from "../problems.js";
|
|
2
|
+
function nameTableOffset(font) {
|
|
3
|
+
if (font.length < 12)
|
|
4
|
+
return undefined;
|
|
5
|
+
const version = font.readUInt32BE(0);
|
|
6
|
+
if (version !== 0x00010000 && version !== 0x4f54544f && version !== 0x74727565)
|
|
7
|
+
return undefined;
|
|
8
|
+
const tables = font.readUInt16BE(4);
|
|
9
|
+
for (let index = 0; index < tables; index += 1) {
|
|
10
|
+
const at = 12 + index * 16;
|
|
11
|
+
if (at + 16 > font.length)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (font.toString('latin1', at, at + 4) === 'name')
|
|
14
|
+
return font.readUInt32BE(at + 8);
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
function recordsOf(font, table) {
|
|
19
|
+
const count = font.readUInt16BE(table + 2);
|
|
20
|
+
const strings = table + font.readUInt16BE(table + 4);
|
|
21
|
+
const records = Array.from({ length: count }, (_, index) => {
|
|
22
|
+
const at = table + 6 + index * 12;
|
|
23
|
+
return { platform: font.readUInt16BE(at), encoding: font.readUInt16BE(at + 2), language: font.readUInt16BE(at + 4), nameId: font.readUInt16BE(at + 6), length: font.readUInt16BE(at + 8), offset: font.readUInt16BE(at + 10) };
|
|
24
|
+
});
|
|
25
|
+
return { records, strings };
|
|
26
|
+
}
|
|
27
|
+
function decode(font, strings, record) {
|
|
28
|
+
const bytes = font.subarray(strings + record.offset, strings + record.offset + record.length);
|
|
29
|
+
return record.platform === 3 ? Buffer.from(bytes).swap16().toString('utf16le') : bytes.toString('latin1');
|
|
30
|
+
}
|
|
31
|
+
export function fontFamily(font, file) {
|
|
32
|
+
const table = nameTableOffset(font);
|
|
33
|
+
if (table === undefined || table + 6 > font.length)
|
|
34
|
+
throw invalid(`${file} isn't a TrueType or OpenType font.`, { path: file });
|
|
35
|
+
const { records, strings } = recordsOf(font, table);
|
|
36
|
+
const families = records.filter((record) => record.nameId === 1);
|
|
37
|
+
const windows = families.filter((record) => record.platform === 3 && (record.encoding === 1 || record.encoding === 10));
|
|
38
|
+
const chosen = windows.find((record) => record.language === 0x409) ?? windows[0] ?? families.find((record) => record.platform === 1 && record.encoding === 0);
|
|
39
|
+
if (chosen === undefined || strings + chosen.offset + chosen.length > font.length)
|
|
40
|
+
throw invalid(`${file} has no family name.`, { path: file });
|
|
41
|
+
return decode(font, strings, chosen);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=font-family.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-family.js","sourceRoot":"","sources":["../../src/fonts/font-family.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQzC,SAAS,eAAe,CAAC,IAAY;IACnC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACrC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C,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC;IACxH,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC;IAC9J,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;QAAE,MAAM,OAAO,CAAC,GAAG,IAAI,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAChJ,OAAO,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-fonts.d.ts","sourceRoot":"","sources":["../../src/fonts/register-fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAGzC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAQ5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from '@kvman/sdk';
|
|
2
|
+
import { bundledFonts } from "./bundled-fonts.js";
|
|
3
|
+
export function registerFonts(ctx) {
|
|
4
|
+
ctx.registerQuery('kvvideo.font.list', {
|
|
5
|
+
description: 'Lists the fonts bundled for captions, with the scripts each one writes.',
|
|
6
|
+
input: z.object({}),
|
|
7
|
+
output: z.array(z.object({ name: z.string(), scripts: z.array(z.enum(['latin', 'arabic'])) })),
|
|
8
|
+
public: true,
|
|
9
|
+
handle: () => bundledFonts.map(({ name, scripts }) => ({ name, scripts })),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=register-fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-fonts.js","sourceRoot":"","sources":["../../src/fonts/register-fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAY,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,aAAa,CAAC,GAAQ;IACpC,GAAG,CAAC,aAAa,CAAC,mBAAmB,EAAE;QACrC,WAAW,EAAE,yEAAyE;QACtF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9F,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;KAC3E,CAAC,CAAC;AACL,CAAC"}
|
package/dist/guide.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../src/guide.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
|
package/dist/guide.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
/** The guide `/video` puts in a chat's prompt (plan 16 §16.1), from `docs/guide.md`. */
|
|
3
|
+
export function readGuide() {
|
|
4
|
+
return readFileSync(new URL('../docs/guide.md', import.meta.url), 'utf8');
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=guide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.js","sourceRoot":"","sources":["../src/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wFAAwF;AACxF,MAAM,UAAU,SAAS;IACvB,OAAO,YAAY,CAAC,IAAI,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AActC,YAAY,EAAE,MAAM,UAAU,CAAC;yBAKf,KAAK,GAAG,KAAG,IAAI;AAA/B,wBAaE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { registerBrand } from "./brand/brand.js";
|
|
2
|
+
import { registerCompose } from "./compose/register-compose.js";
|
|
3
|
+
import { registerFonts } from "./fonts/register-fonts.js";
|
|
4
|
+
import { registerNarration } from "./narration/register-narration.js";
|
|
5
|
+
import { registerVoice } from "./narration/register-voice.js";
|
|
6
|
+
import { registerRecord } from "./record/register-record.js";
|
|
7
|
+
import { registerReview } from "./review/register-review.js";
|
|
8
|
+
import { registerWithKvcoder } from "./register-with-kvcoder.js";
|
|
9
|
+
import { registerSettings } from "./settings.js";
|
|
10
|
+
import { registerSetup } from "./setup/register-setup.js";
|
|
11
|
+
import { registerUi } from "./ui.js";
|
|
12
|
+
import { registerVideoStart } from "./video-start.js";
|
|
13
|
+
// kvvideo (plan 16): makes any kind of video, recorded in the installed browser, narrated, and captioned. It
|
|
14
|
+
// has no loop of its own; it extends kvcoder with the `video` connector and its guide, which a chat has once the
|
|
15
|
+
// person runs `/video` in it (ADR 0107).
|
|
16
|
+
export default (ctx) => {
|
|
17
|
+
registerSettings(ctx);
|
|
18
|
+
registerBrand(ctx);
|
|
19
|
+
registerUi(ctx);
|
|
20
|
+
registerSetup(ctx);
|
|
21
|
+
registerFonts(ctx);
|
|
22
|
+
registerRecord(ctx);
|
|
23
|
+
registerNarration(ctx);
|
|
24
|
+
registerVoice(ctx);
|
|
25
|
+
registerCompose(ctx);
|
|
26
|
+
registerReview(ctx);
|
|
27
|
+
registerVideoStart(ctx);
|
|
28
|
+
registerWithKvcoder(ctx);
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAItD,6GAA6G;AAC7G,iHAAiH;AACjH,yCAAyC;AACzC,eAAe,CAAC,GAAQ,EAAQ,EAAE;IAChC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACtB,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,UAAU,CAAC,GAAG,CAAC,CAAC;IAChB,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,cAAc,CAAC,GAAG,CAAC,CAAC;IACpB,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACvB,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,eAAe,CAAC,GAAG,CAAC,CAAC;IACrB,cAAc,CAAC,GAAG,CAAC,CAAC;IACpB,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACxB,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from '@kvman/sdk';
|
|
2
|
+
export declare const alignmentSchema: z.ZodObject<{
|
|
3
|
+
startsMs: z.ZodArray<z.ZodNumber>;
|
|
4
|
+
endsMs: z.ZodArray<z.ZodNumber>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
/** When each spoken character starts and ends, in ms from the sentence's start. */
|
|
7
|
+
export type Alignment = z.output<typeof alignmentSchema>;
|
|
8
|
+
export declare const elevenLabsAlignmentSchema: z.ZodObject<{
|
|
9
|
+
characters: z.ZodArray<z.ZodString>;
|
|
10
|
+
character_start_times_seconds: z.ZodArray<z.ZodNumber>;
|
|
11
|
+
character_end_times_seconds: z.ZodArray<z.ZodNumber>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/** The alignment of `spoken`; one whose characters aren't the text fails `kvvideo/NARRATION_FAILED`. */
|
|
14
|
+
export declare function alignmentOf(answer: z.output<typeof elevenLabsAlignmentSchema>, spoken: string): Alignment;
|
|
15
|
+
//# sourceMappingURL=alignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.d.ts","sourceRoot":"","sources":["../../src/narration/alignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAM/B,eAAO,MAAM,eAAe;;;iBAAmH,CAAC;AAEhJ,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAEzD,eAAO,MAAM,yBAAyB;;;;iBAIpC,CAAC;AAIH,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAOzG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from '@kvman/sdk';
|
|
2
|
+
import { kvvideoProblem } from "../problems.js";
|
|
3
|
+
// ElevenLabs's character times (plan 16 §16.6; ADR 0115, 17): each character of the text it was sent, by code point,
|
|
4
|
+
// with when it starts and ends, kept in whole milliseconds.
|
|
5
|
+
export const alignmentSchema = z.object({ startsMs: z.array(z.number().int().nonnegative()), endsMs: z.array(z.number().int().nonnegative()) });
|
|
6
|
+
export const elevenLabsAlignmentSchema = z.object({
|
|
7
|
+
characters: z.array(z.string()),
|
|
8
|
+
character_start_times_seconds: z.array(z.number()),
|
|
9
|
+
character_end_times_seconds: z.array(z.number()),
|
|
10
|
+
});
|
|
11
|
+
const ms = (seconds) => Math.max(0, Math.round(seconds * 1000));
|
|
12
|
+
/** The alignment of `spoken`; one whose characters aren't the text fails `kvvideo/NARRATION_FAILED`. */
|
|
13
|
+
export function alignmentOf(answer, spoken) {
|
|
14
|
+
const { characters, character_start_times_seconds: starts, character_end_times_seconds: ends } = answer;
|
|
15
|
+
if (characters.join('') !== spoken || [...spoken].length !== characters.length || starts.length !== characters.length || ends.length !== characters.length) {
|
|
16
|
+
const reason = "ElevenLabs's character times don't match the text it was sent";
|
|
17
|
+
throw kvvideoProblem('NARRATION_FAILED', reason, { service: 'elevenlabs', reason });
|
|
18
|
+
}
|
|
19
|
+
return { startsMs: starts.map(ms), endsMs: ends.map(ms) };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=alignment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.js","sourceRoot":"","sources":["../../src/narration/alignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,qHAAqH;AACrH,4DAA4D;AAE5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;AAKhJ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/B,6BAA6B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClD,2BAA2B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,EAAE,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;AAEhF,wGAAwG;AACxG,MAAM,UAAU,WAAW,CAAC,MAAkD,EAAE,MAAc;IAC5F,MAAM,EAAE,UAAU,EAAE,6BAA6B,EAAE,MAAM,EAAE,2BAA2B,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;QAC3J,MAAM,MAAM,GAAG,+DAA+D,CAAC;QAC/E,MAAM,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Alignment } from './alignment.ts';
|
|
2
|
+
import type { Spoken } from './pronunciations.ts';
|
|
3
|
+
export type Word = {
|
|
4
|
+
text: string;
|
|
5
|
+
startMs: number;
|
|
6
|
+
endMs: number;
|
|
7
|
+
};
|
|
8
|
+
export type Caption = {
|
|
9
|
+
text: string;
|
|
10
|
+
startMs: number;
|
|
11
|
+
endMs: number;
|
|
12
|
+
words?: Word[];
|
|
13
|
+
};
|
|
14
|
+
/** The text's sentences, in order: cut at line breaks and after `.`, `!`, `?`, `؟`, and `…` followed by a space. */
|
|
15
|
+
export declare function sentencesOf(text: string): string[];
|
|
16
|
+
/** A sentence's caption lines: whole words, each line as long as it can be up to 42 characters. */
|
|
17
|
+
export declare function linesOf(sentence: string): string[];
|
|
18
|
+
/** One sentence's place in the narration: its audio from `startMs` for `durationMs`, and its character times. */
|
|
19
|
+
export type PlacedSentence = {
|
|
20
|
+
text: string;
|
|
21
|
+
spoken: Spoken;
|
|
22
|
+
startMs: number;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
alignment: Alignment | null;
|
|
25
|
+
};
|
|
26
|
+
/** The captions of placed sentences over a narration of `durationMs`: each line ends where the next starts. */
|
|
27
|
+
export declare function captionsOf(sentences: readonly PlacedSentence[], durationMs: number): Caption[];
|
|
28
|
+
//# sourceMappingURL=captions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captions.d.ts","sourceRoot":"","sources":["../../src/narration/captions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMlD,MAAM,MAAM,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC;AAMvF,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMlD;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAclD;AAED,iHAAiH;AACjH,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,CAAC;AAwChI,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,EAAE,CAG9F"}
|