@celljs/ta-web 4.27.0 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-role.d.ts +9 -4
- package/esm/browser/assistant/assistant-role.js +17 -5
- package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-util.js +12 -1
- package/esm/browser/assistant/assistant-thread.js +15 -2
- package/esm/browser/assistant/assistant-view.js +4 -1
- package/esm/browser/assistant/assistant.d.ts +2 -1
- package/esm/browser/assistant/assistant.js +9 -7
- package/esm/browser/assistant/call-conversing.d.ts +45 -0
- package/esm/browser/assistant/call-conversing.js +91 -0
- package/esm/browser/assistant/call-face.d.ts +13 -0
- package/esm/browser/assistant/call-face.js +81 -0
- package/esm/browser/assistant/call-keeper.d.ts +8 -4
- package/esm/browser/assistant/call-keeper.js +32 -11
- package/esm/browser/assistant/call-partnering.d.ts +37 -0
- package/esm/browser/assistant/call-partnering.js +79 -0
- package/esm/browser/assistant/call-scenes.d.ts +26 -0
- package/esm/browser/assistant/call-scenes.js +85 -0
- package/esm/browser/assistant/call-screen.d.ts +3 -0
- package/esm/browser/assistant/call-screen.js +15 -0
- package/esm/browser/assistant/mic-sense.d.ts +31 -0
- package/esm/browser/assistant/mic-sense.js +119 -0
- package/esm/browser/assistant/noise-gate.d.ts +32 -0
- package/esm/browser/assistant/noise-gate.js +66 -0
- package/esm/browser/assistant/pcm-util.d.ts +10 -0
- package/esm/browser/assistant/pcm-util.js +55 -0
- package/esm/browser/assistant/read-aloud.d.ts +2 -1
- package/esm/browser/assistant/realtime-voice-protocol.d.ts +84 -0
- package/esm/browser/assistant/realtime-voice-protocol.js +40 -0
- package/esm/browser/assistant/realtime-voice.d.ts +50 -62
- package/esm/browser/assistant/realtime-voice.js +213 -134
- package/esm/browser/assistant/spoken-timeline.d.ts +27 -0
- package/esm/browser/assistant/spoken-timeline.js +49 -0
- package/esm/browser/assistant/voice-call-bar.d.ts +9 -2
- package/esm/browser/assistant/voice-call-bar.js +81 -31
- package/esm/browser/assistant/voice-call-protocol.d.ts +61 -4
- package/esm/browser/assistant/voice-call.d.ts +16 -23
- package/esm/browser/assistant/voice-call.js +134 -117
- package/esm/browser/assistant/voice-reading.d.ts +83 -0
- package/esm/browser/assistant/voice-reading.js +150 -0
- package/esm/browser/avatar/dino-talk.d.ts +15 -0
- package/esm/browser/avatar/dino-talk.js +34 -0
- package/esm/browser/chat/chat-protocol.d.ts +2 -0
- package/esm/browser/chat/chat-shown.d.ts +3 -1
- package/esm/browser/chat/chat-shown.js +25 -3
- package/esm/browser/chat/chat.d.ts +5 -1
- package/esm/browser/chat/chat.js +32 -16
- package/esm/browser/components/account-menu.d.ts +6 -16
- package/esm/browser/components/account-menu.js +47 -101
- package/esm/browser/components/app-contexts.js +3 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box-protocol.d.ts +2 -0
- package/esm/browser/components/composer-box.js +20 -1
- package/esm/browser/components/composer-emoji.d.ts +22 -0
- package/esm/browser/components/composer-emoji.js +50 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
- package/esm/browser/components/conversation-scroll-util.js +21 -0
- package/esm/browser/components/conversation-scroll.js +10 -11
- package/esm/browser/components/discover-view.d.ts +4 -3
- package/esm/browser/components/discover-view.js +5 -4
- package/esm/browser/components/emoji-panel.d.ts +22 -0
- package/esm/browser/components/emoji-panel.js +54 -0
- package/esm/browser/components/gallery.js +28 -7
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-pull.d.ts +64 -0
- package/esm/browser/components/image-pull.js +202 -0
- package/esm/browser/components/kept-call-bar.js +2 -1
- package/esm/browser/components/lightbox.d.ts +1 -1
- package/esm/browser/components/lightbox.js +57 -2
- package/esm/browser/components/markdown.d.ts +8 -1
- package/esm/browser/components/markdown.js +12 -4
- package/esm/browser/components/me-rows.d.ts +24 -0
- package/esm/browser/components/me-rows.js +19 -0
- package/esm/browser/components/me-view.d.ts +2 -1
- package/esm/browser/components/me-view.js +3 -2
- package/esm/browser/components/message-list.js +47 -7
- package/esm/browser/components/message-steps.js +13 -0
- package/esm/browser/components/nav-places.js +1 -1
- package/esm/browser/components/partner-row.js +2 -1
- package/esm/browser/components/relay-services.d.ts +9 -3
- package/esm/browser/components/relay-services.js +73 -35
- package/esm/browser/components/session-view.js +4 -2
- package/esm/browser/components/settings-choices.js +3 -0
- package/esm/browser/components/settings-controls.d.ts +13 -0
- package/esm/browser/components/settings-controls.js +19 -0
- package/esm/browser/components/settings-more.d.ts +1 -1
- package/esm/browser/components/settings-more.js +28 -39
- package/esm/browser/components/settings-parts.d.ts +4 -2
- package/esm/browser/components/settings-parts.js +16 -9
- package/esm/browser/components/settings-view.js +2 -6
- package/esm/browser/components/ta-avatar.d.ts +15 -1
- package/esm/browser/components/ta-avatar.js +38 -5
- package/esm/browser/components/voice-services.js +6 -1
- package/esm/browser/components/web-composer.d.ts +1 -1
- package/esm/browser/components/web-composer.js +2 -2
- package/esm/browser/device/file-save.d.ts +31 -0
- package/esm/browser/device/file-save.js +80 -0
- package/esm/browser/extension/extension-view.d.ts +2 -0
- package/esm/browser/extension/extension-view.js +2 -0
- package/esm/browser/extension/web-api-call.d.ts +109 -2
- package/esm/browser/extension/web-api-components.d.ts +4 -0
- package/esm/browser/extension/web-api-contributions.d.ts +14 -14
- package/esm/browser/extension/web-api-desktop.d.ts +16 -1
- package/esm/browser/extension/web-api-desktop.js +1 -0
- package/esm/browser/extension/web-api-partners.d.ts +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +8 -10
- package/esm/browser/extension/web-extension-code.d.ts +15 -8
- package/esm/browser/extension/web-extension-code.js +25 -27
- package/esm/browser/extension/web-extension-context.js +4 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +10 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extension-run.d.ts +4 -2
- package/esm/browser/extension/web-extension-run.js +10 -4
- package/esm/browser/extension/web-extensions-running.js +7 -6
- package/esm/browser/extension/web-pages.d.ts +2 -0
- package/esm/browser/extension/web-pages.js +2 -0
- package/esm/browser/i18n/en/account.d.ts +202 -0
- package/esm/browser/i18n/en/account.js +205 -0
- package/esm/browser/i18n/en/assistant.d.ts +129 -0
- package/esm/browser/i18n/en/assistant.js +130 -0
- package/esm/browser/i18n/en/call.d.ts +86 -0
- package/esm/browser/i18n/en/call.js +87 -0
- package/esm/browser/i18n/en/chat.d.ts +213 -0
- package/esm/browser/i18n/en/chat.js +214 -0
- package/esm/browser/i18n/en/common.d.ts +99 -0
- package/esm/browser/i18n/en/common.js +101 -0
- package/esm/browser/i18n/en/console.d.ts +230 -0
- package/esm/browser/i18n/en/console.js +232 -0
- package/esm/browser/i18n/en/discover.d.ts +117 -0
- package/esm/browser/i18n/en/discover.js +119 -0
- package/esm/browser/i18n/en/service.d.ts +242 -0
- package/esm/browser/i18n/en/service.js +245 -0
- package/esm/browser/i18n/en/settings.d.ts +213 -0
- package/esm/browser/i18n/en/settings.js +214 -0
- package/esm/browser/i18n/en/tools.d.ts +85 -0
- package/esm/browser/i18n/en/tools.js +87 -0
- package/esm/browser/i18n/ja/account.d.ts +2 -0
- package/esm/browser/i18n/ja/account.js +202 -0
- package/esm/browser/i18n/ja/assistant.d.ts +2 -0
- package/esm/browser/i18n/ja/assistant.js +129 -0
- package/esm/browser/i18n/ja/call.d.ts +2 -0
- package/esm/browser/i18n/ja/call.js +86 -0
- package/esm/browser/i18n/ja/chat.d.ts +2 -0
- package/esm/browser/i18n/ja/chat.js +213 -0
- package/esm/browser/i18n/ja/common.d.ts +2 -0
- package/esm/browser/i18n/ja/common.js +99 -0
- package/esm/browser/i18n/ja/console.d.ts +2 -0
- package/esm/browser/i18n/ja/console.js +230 -0
- package/esm/browser/i18n/ja/discover.d.ts +2 -0
- package/esm/browser/i18n/ja/discover.js +117 -0
- package/esm/browser/i18n/ja/service.d.ts +2 -0
- package/esm/browser/i18n/ja/service.js +242 -0
- package/esm/browser/i18n/ja/settings.d.ts +2 -0
- package/esm/browser/i18n/ja/settings.js +213 -0
- package/esm/browser/i18n/ja/tools.d.ts +2 -0
- package/esm/browser/i18n/ja/tools.js +85 -0
- package/esm/browser/i18n/locales.d.ts +1150 -1131
- package/esm/browser/i18n/messages-ja.js +20 -1567
- package/esm/browser/i18n/messages-zh-tw.d.ts +0 -1
- package/esm/browser/i18n/messages-zh-tw.js +20 -1568
- package/esm/browser/i18n/messages.d.ts +1153 -1131
- package/esm/browser/i18n/messages.js +44 -3145
- package/esm/browser/i18n/zh/account.d.ts +2 -0
- package/esm/browser/i18n/zh/account.js +203 -0
- package/esm/browser/i18n/zh/assistant.d.ts +2 -0
- package/esm/browser/i18n/zh/assistant.js +129 -0
- package/esm/browser/i18n/zh/call.d.ts +2 -0
- package/esm/browser/i18n/zh/call.js +86 -0
- package/esm/browser/i18n/zh/chat.d.ts +2 -0
- package/esm/browser/i18n/zh/chat.js +213 -0
- package/esm/browser/i18n/zh/common.d.ts +2 -0
- package/esm/browser/i18n/zh/common.js +99 -0
- package/esm/browser/i18n/zh/console.d.ts +2 -0
- package/esm/browser/i18n/zh/console.js +230 -0
- package/esm/browser/i18n/zh/discover.d.ts +2 -0
- package/esm/browser/i18n/zh/discover.js +117 -0
- package/esm/browser/i18n/zh/service.d.ts +2 -0
- package/esm/browser/i18n/zh/service.js +242 -0
- package/esm/browser/i18n/zh/settings.d.ts +2 -0
- package/esm/browser/i18n/zh/settings.js +213 -0
- package/esm/browser/i18n/zh/tools.d.ts +2 -0
- package/esm/browser/i18n/zh/tools.js +86 -0
- package/esm/browser/i18n/zh-tw/account.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/account.js +202 -0
- package/esm/browser/i18n/zh-tw/assistant.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/assistant.js +129 -0
- package/esm/browser/i18n/zh-tw/call.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/call.js +86 -0
- package/esm/browser/i18n/zh-tw/chat.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +213 -0
- package/esm/browser/i18n/zh-tw/common.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/common.js +99 -0
- package/esm/browser/i18n/zh-tw/console.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/console.js +230 -0
- package/esm/browser/i18n/zh-tw/discover.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +117 -0
- package/esm/browser/i18n/zh-tw/service.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/service.js +242 -0
- package/esm/browser/i18n/zh-tw/settings.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/settings.js +213 -0
- package/esm/browser/i18n/zh-tw/tools.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/tools.js +85 -0
- package/esm/browser/markdown/code-renderers.d.ts +2 -0
- package/esm/browser/markdown/code-renderers.js +2 -0
- package/esm/browser/offline/device-values.d.ts +4 -0
- package/esm/browser/offline/device-values.js +10 -0
- package/esm/browser/pwa/page-build.d.ts +15 -0
- package/esm/browser/pwa/page-build.js +45 -0
- package/esm/browser/screen/page-answers.d.ts +2 -1
- package/esm/browser/screen/page-answers.js +7 -4
- package/esm/browser/settings/settings-protocol.d.ts +4 -0
- package/esm/browser/settings/settings-protocol.js +4 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +3 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +1 -1
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +17 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +11 -1
- package/esm/browser/style/device.js +1 -0
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +1 -1
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +135 -57
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +0 -7
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +8 -0
- package/esm/browser/style/video-call.d.ts +2 -0
- package/esm/browser/style/video-call.js +63 -0
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/call-transcript.d.ts +16 -0
- package/esm/browser/util/call-transcript.js +110 -0
- package/esm/browser/util/desktop.d.ts +10 -1
- package/esm/browser/util/desktop.js +10 -0
- package/esm/browser/util/image-pull.d.ts +61 -0
- package/esm/browser/util/image-pull.js +88 -0
- package/esm/browser/util/process.d.ts +6 -0
- package/esm/browser/util/process.js +18 -5
- package/esm/browser/util/spoken.d.ts +3 -3
- package/esm/browser/util/spoken.js +4 -4
- package/esm/browser/video-call/call-camera.d.ts +59 -0
- package/esm/browser/video-call/call-camera.js +188 -0
- package/esm/browser/video-call/call-people.d.ts +21 -0
- package/esm/browser/video-call/call-people.js +29 -0
- package/esm/browser/video-call/call-window.d.ts +19 -0
- package/esm/browser/video-call/call-window.js +80 -0
- package/esm/browser/video-call/clip-plan.d.ts +56 -0
- package/esm/browser/video-call/clip-plan.js +76 -0
- package/esm/browser/video-call/face-camera.d.ts +93 -0
- package/esm/browser/video-call/face-camera.js +192 -0
- package/esm/browser/video-call/face-files.d.ts +69 -0
- package/esm/browser/video-call/face-files.js +132 -0
- package/esm/browser/video-call/face-moves.d.ts +68 -0
- package/esm/browser/video-call/face-moves.js +180 -0
- package/esm/browser/video-call/face-stage.d.ts +139 -0
- package/esm/browser/video-call/face-stage.js +219 -0
- package/esm/browser/video-call/mouth-layer.d.ts +81 -0
- package/esm/browser/video-call/mouth-layer.js +241 -0
- package/esm/browser/video-call/video-call-view.d.ts +19 -0
- package/esm/browser/video-call/video-call-view.js +254 -0
- package/esm/browser/video-call/video-face.d.ts +19 -0
- package/esm/browser/video-call/video-face.js +471 -0
- package/esm/browser/workbench-hosts.d.ts +1 -0
- package/esm/browser/workbench-protocol.d.ts +2 -0
- package/esm/browser/workbench-util.d.ts +5 -0
- package/esm/browser/workbench-util.js +18 -0
- package/esm/browser/workbench.d.ts +14 -0
- package/esm/browser/workbench.js +73 -6
- package/lib/browser/assistant/assistant-role.d.ts +9 -4
- package/lib/browser/assistant/assistant-role.js +17 -5
- package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-util.js +11 -0
- package/lib/browser/assistant/assistant-thread.js +15 -2
- package/lib/browser/assistant/assistant-view.js +3 -0
- package/lib/browser/assistant/assistant.d.ts +2 -1
- package/lib/browser/assistant/assistant.js +9 -7
- package/lib/browser/assistant/call-conversing.d.ts +46 -0
- package/lib/browser/assistant/call-conversing.js +96 -0
- package/lib/browser/assistant/call-face.d.ts +14 -0
- package/lib/browser/assistant/call-face.js +117 -0
- package/lib/browser/assistant/call-keeper.d.ts +8 -4
- package/lib/browser/assistant/call-keeper.js +32 -11
- package/lib/browser/assistant/call-partnering.d.ts +38 -0
- package/lib/browser/assistant/call-partnering.js +83 -0
- package/lib/browser/assistant/call-scenes.d.ts +27 -0
- package/lib/browser/assistant/call-scenes.js +88 -0
- package/lib/browser/assistant/call-screen.d.ts +3 -0
- package/lib/browser/assistant/call-screen.js +15 -0
- package/lib/browser/assistant/mic-sense.d.ts +32 -0
- package/lib/browser/assistant/mic-sense.js +123 -0
- package/lib/browser/assistant/noise-gate.d.ts +33 -0
- package/lib/browser/assistant/noise-gate.js +71 -0
- package/lib/browser/assistant/pcm-util.d.ts +11 -0
- package/lib/browser/assistant/pcm-util.js +58 -0
- package/lib/browser/assistant/read-aloud.d.ts +2 -1
- package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
- package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
- package/lib/browser/assistant/realtime-voice.d.ts +50 -62
- package/lib/browser/assistant/realtime-voice.js +217 -138
- package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
- package/lib/browser/assistant/spoken-timeline.js +53 -0
- package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
- package/lib/browser/assistant/voice-call-bar.js +81 -30
- package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
- package/lib/browser/assistant/voice-call.d.ts +16 -23
- package/lib/browser/assistant/voice-call.js +134 -117
- package/lib/browser/assistant/voice-reading.d.ts +84 -0
- package/lib/browser/assistant/voice-reading.js +156 -0
- package/lib/browser/avatar/dino-talk.d.ts +16 -0
- package/lib/browser/avatar/dino-talk.js +37 -0
- package/lib/browser/chat/chat-protocol.d.ts +2 -0
- package/lib/browser/chat/chat-shown.d.ts +3 -1
- package/lib/browser/chat/chat-shown.js +25 -3
- package/lib/browser/chat/chat.d.ts +5 -1
- package/lib/browser/chat/chat.js +32 -16
- package/lib/browser/components/account-menu.d.ts +6 -16
- package/lib/browser/components/account-menu.js +45 -99
- package/lib/browser/components/app-contexts.js +2 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box-protocol.d.ts +2 -0
- package/lib/browser/components/composer-box.js +20 -1
- package/lib/browser/components/composer-emoji.d.ts +23 -0
- package/lib/browser/components/composer-emoji.js +87 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
- package/lib/browser/components/conversation-scroll-util.js +21 -0
- package/lib/browser/components/conversation-scroll.js +10 -11
- package/lib/browser/components/discover-view.d.ts +4 -3
- package/lib/browser/components/discover-view.js +5 -4
- package/lib/browser/components/emoji-panel.d.ts +23 -0
- package/lib/browser/components/emoji-panel.js +90 -0
- package/lib/browser/components/gallery.js +28 -7
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-pull.d.ts +65 -0
- package/lib/browser/components/image-pull.js +206 -0
- package/lib/browser/components/kept-call-bar.js +2 -1
- package/lib/browser/components/lightbox.d.ts +1 -1
- package/lib/browser/components/lightbox.js +57 -2
- package/lib/browser/components/markdown.d.ts +8 -1
- package/lib/browser/components/markdown.js +11 -3
- package/lib/browser/components/me-rows.d.ts +25 -0
- package/lib/browser/components/me-rows.js +22 -0
- package/lib/browser/components/me-view.d.ts +2 -1
- package/lib/browser/components/me-view.js +3 -2
- package/lib/browser/components/message-list.js +46 -6
- package/lib/browser/components/message-steps.js +13 -0
- package/lib/browser/components/nav-places.js +1 -1
- package/lib/browser/components/partner-row.js +2 -1
- package/lib/browser/components/relay-services.d.ts +9 -3
- package/lib/browser/components/relay-services.js +71 -33
- package/lib/browser/components/session-view.js +3 -1
- package/lib/browser/components/settings-choices.js +3 -0
- package/lib/browser/components/settings-controls.d.ts +13 -0
- package/lib/browser/components/settings-controls.js +19 -0
- package/lib/browser/components/settings-more.d.ts +1 -1
- package/lib/browser/components/settings-more.js +27 -38
- package/lib/browser/components/settings-parts.d.ts +4 -2
- package/lib/browser/components/settings-parts.js +15 -8
- package/lib/browser/components/settings-view.js +2 -6
- package/lib/browser/components/ta-avatar.d.ts +15 -1
- package/lib/browser/components/ta-avatar.js +38 -5
- package/lib/browser/components/voice-services.js +5 -0
- package/lib/browser/components/web-composer.d.ts +1 -1
- package/lib/browser/components/web-composer.js +2 -2
- package/lib/browser/device/file-save.d.ts +32 -0
- package/lib/browser/device/file-save.js +83 -0
- package/lib/browser/extension/extension-view.d.ts +2 -0
- package/lib/browser/extension/extension-view.js +3 -1
- package/lib/browser/extension/web-api-call.d.ts +109 -2
- package/lib/browser/extension/web-api-components.d.ts +4 -0
- package/lib/browser/extension/web-api-contributions.d.ts +14 -14
- package/lib/browser/extension/web-api-desktop.d.ts +16 -1
- package/lib/browser/extension/web-api-desktop.js +1 -0
- package/lib/browser/extension/web-api-partners.d.ts +2 -0
- package/lib/browser/extension/web-extension-api.d.ts +8 -10
- package/lib/browser/extension/web-extension-code.d.ts +15 -8
- package/lib/browser/extension/web-extension-code.js +25 -27
- package/lib/browser/extension/web-extension-context.js +4 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +10 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extension-run.d.ts +4 -2
- package/lib/browser/extension/web-extension-run.js +10 -4
- package/lib/browser/extension/web-extensions-running.js +7 -6
- package/lib/browser/extension/web-pages.d.ts +2 -0
- package/lib/browser/extension/web-pages.js +2 -0
- package/lib/browser/i18n/en/account.d.ts +203 -0
- package/lib/browser/i18n/en/account.js +208 -0
- package/lib/browser/i18n/en/assistant.d.ts +130 -0
- package/lib/browser/i18n/en/assistant.js +133 -0
- package/lib/browser/i18n/en/call.d.ts +87 -0
- package/lib/browser/i18n/en/call.js +90 -0
- package/lib/browser/i18n/en/chat.d.ts +214 -0
- package/lib/browser/i18n/en/chat.js +217 -0
- package/lib/browser/i18n/en/common.d.ts +100 -0
- package/lib/browser/i18n/en/common.js +104 -0
- package/lib/browser/i18n/en/console.d.ts +231 -0
- package/lib/browser/i18n/en/console.js +235 -0
- package/lib/browser/i18n/en/discover.d.ts +118 -0
- package/lib/browser/i18n/en/discover.js +122 -0
- package/lib/browser/i18n/en/service.d.ts +243 -0
- package/lib/browser/i18n/en/service.js +248 -0
- package/lib/browser/i18n/en/settings.d.ts +214 -0
- package/lib/browser/i18n/en/settings.js +217 -0
- package/lib/browser/i18n/en/tools.d.ts +86 -0
- package/lib/browser/i18n/en/tools.js +90 -0
- package/lib/browser/i18n/ja/account.d.ts +3 -0
- package/lib/browser/i18n/ja/account.js +205 -0
- package/lib/browser/i18n/ja/assistant.d.ts +3 -0
- package/lib/browser/i18n/ja/assistant.js +132 -0
- package/lib/browser/i18n/ja/call.d.ts +3 -0
- package/lib/browser/i18n/ja/call.js +89 -0
- package/lib/browser/i18n/ja/chat.d.ts +3 -0
- package/lib/browser/i18n/ja/chat.js +216 -0
- package/lib/browser/i18n/ja/common.d.ts +3 -0
- package/lib/browser/i18n/ja/common.js +102 -0
- package/lib/browser/i18n/ja/console.d.ts +3 -0
- package/lib/browser/i18n/ja/console.js +233 -0
- package/lib/browser/i18n/ja/discover.d.ts +3 -0
- package/lib/browser/i18n/ja/discover.js +120 -0
- package/lib/browser/i18n/ja/service.d.ts +3 -0
- package/lib/browser/i18n/ja/service.js +245 -0
- package/lib/browser/i18n/ja/settings.d.ts +3 -0
- package/lib/browser/i18n/ja/settings.js +216 -0
- package/lib/browser/i18n/ja/tools.d.ts +3 -0
- package/lib/browser/i18n/ja/tools.js +88 -0
- package/lib/browser/i18n/locales.d.ts +1150 -1131
- package/lib/browser/i18n/messages-ja.js +20 -1567
- package/lib/browser/i18n/messages-zh-tw.d.ts +0 -1
- package/lib/browser/i18n/messages-zh-tw.js +20 -1568
- package/lib/browser/i18n/messages.d.ts +1153 -1131
- package/lib/browser/i18n/messages.js +44 -3145
- package/lib/browser/i18n/zh/account.d.ts +3 -0
- package/lib/browser/i18n/zh/account.js +206 -0
- package/lib/browser/i18n/zh/assistant.d.ts +3 -0
- package/lib/browser/i18n/zh/assistant.js +132 -0
- package/lib/browser/i18n/zh/call.d.ts +3 -0
- package/lib/browser/i18n/zh/call.js +89 -0
- package/lib/browser/i18n/zh/chat.d.ts +3 -0
- package/lib/browser/i18n/zh/chat.js +216 -0
- package/lib/browser/i18n/zh/common.d.ts +3 -0
- package/lib/browser/i18n/zh/common.js +102 -0
- package/lib/browser/i18n/zh/console.d.ts +3 -0
- package/lib/browser/i18n/zh/console.js +233 -0
- package/lib/browser/i18n/zh/discover.d.ts +3 -0
- package/lib/browser/i18n/zh/discover.js +120 -0
- package/lib/browser/i18n/zh/service.d.ts +3 -0
- package/lib/browser/i18n/zh/service.js +245 -0
- package/lib/browser/i18n/zh/settings.d.ts +3 -0
- package/lib/browser/i18n/zh/settings.js +216 -0
- package/lib/browser/i18n/zh/tools.d.ts +3 -0
- package/lib/browser/i18n/zh/tools.js +89 -0
- package/lib/browser/i18n/zh-tw/account.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/account.js +205 -0
- package/lib/browser/i18n/zh-tw/assistant.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/assistant.js +132 -0
- package/lib/browser/i18n/zh-tw/call.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/call.js +89 -0
- package/lib/browser/i18n/zh-tw/chat.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/chat.js +216 -0
- package/lib/browser/i18n/zh-tw/common.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/common.js +102 -0
- package/lib/browser/i18n/zh-tw/console.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/console.js +233 -0
- package/lib/browser/i18n/zh-tw/discover.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/discover.js +120 -0
- package/lib/browser/i18n/zh-tw/service.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/service.js +245 -0
- package/lib/browser/i18n/zh-tw/settings.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/settings.js +216 -0
- package/lib/browser/i18n/zh-tw/tools.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/tools.js +88 -0
- package/lib/browser/markdown/code-renderers.d.ts +2 -0
- package/lib/browser/markdown/code-renderers.js +3 -1
- package/lib/browser/offline/device-values.d.ts +4 -0
- package/lib/browser/offline/device-values.js +10 -0
- package/lib/browser/pwa/page-build.d.ts +16 -0
- package/lib/browser/pwa/page-build.js +48 -0
- package/lib/browser/screen/page-answers.d.ts +2 -1
- package/lib/browser/screen/page-answers.js +7 -4
- package/lib/browser/settings/settings-protocol.d.ts +4 -0
- package/lib/browser/settings/settings-protocol.js +4 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +3 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +1 -1
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +17 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +11 -1
- package/lib/browser/style/device.js +1 -0
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +1 -1
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +135 -57
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +0 -7
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +8 -0
- package/lib/browser/style/video-call.d.ts +3 -0
- package/lib/browser/style/video-call.js +66 -0
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/call-transcript.d.ts +17 -0
- package/lib/browser/util/call-transcript.js +113 -0
- package/lib/browser/util/desktop.d.ts +10 -1
- package/lib/browser/util/desktop.js +10 -0
- package/lib/browser/util/image-pull.d.ts +62 -0
- package/lib/browser/util/image-pull.js +91 -0
- package/lib/browser/util/process.d.ts +6 -0
- package/lib/browser/util/process.js +17 -4
- package/lib/browser/util/spoken.d.ts +3 -3
- package/lib/browser/util/spoken.js +4 -4
- package/lib/browser/video-call/call-camera.d.ts +60 -0
- package/lib/browser/video-call/call-camera.js +192 -0
- package/lib/browser/video-call/call-people.d.ts +22 -0
- package/lib/browser/video-call/call-people.js +32 -0
- package/lib/browser/video-call/call-window.d.ts +20 -0
- package/lib/browser/video-call/call-window.js +83 -0
- package/lib/browser/video-call/clip-plan.d.ts +57 -0
- package/lib/browser/video-call/clip-plan.js +80 -0
- package/lib/browser/video-call/face-camera.d.ts +94 -0
- package/lib/browser/video-call/face-camera.js +197 -0
- package/lib/browser/video-call/face-files.d.ts +70 -0
- package/lib/browser/video-call/face-files.js +137 -0
- package/lib/browser/video-call/face-moves.d.ts +69 -0
- package/lib/browser/video-call/face-moves.js +184 -0
- package/lib/browser/video-call/face-stage.d.ts +140 -0
- package/lib/browser/video-call/face-stage.js +223 -0
- package/lib/browser/video-call/mouth-layer.d.ts +82 -0
- package/lib/browser/video-call/mouth-layer.js +245 -0
- package/lib/browser/video-call/video-call-view.d.ts +20 -0
- package/lib/browser/video-call/video-call-view.js +290 -0
- package/lib/browser/video-call/video-face.d.ts +20 -0
- package/lib/browser/video-call/video-face.js +507 -0
- package/lib/browser/workbench-hosts.d.ts +1 -0
- package/lib/browser/workbench-protocol.d.ts +2 -0
- package/lib/browser/workbench-util.d.ts +5 -0
- package/lib/browser/workbench-util.js +18 -0
- package/lib/browser/workbench.d.ts +14 -0
- package/lib/browser/workbench.js +71 -4
- package/package.json +7 -7
- package/public/faces/README.md +40 -0
- package/public/faces/blonde/clap.mp4 +0 -0
- package/public/faces/blonde/dance.mp4 +0 -0
- package/public/faces/blonde/face.jpg +0 -0
- package/public/faces/blonde/happy.mp4 +0 -0
- package/public/faces/blonde/heart.mp4 +0 -0
- package/public/faces/blonde/idle-1.mp4 +0 -0
- package/public/faces/blonde/idle-2.mp4 +0 -0
- package/public/faces/blonde/idle-3.mp4 +0 -0
- package/public/faces/blonde/laugh.mp4 +0 -0
- package/public/faces/blonde/listening.mp4 +0 -0
- package/public/faces/blonde/poster.jpg +0 -0
- package/public/faces/blonde/shy.mp4 +0 -0
- package/public/faces/blonde/sorry.mp4 +0 -0
- package/public/faces/blonde/stretch.mp4 +0 -0
- package/public/faces/blonde/surprised.mp4 +0 -0
- package/public/faces/blonde/talk-1.mp4 +0 -0
- package/public/faces/blonde/talk-2.mp4 +0 -0
- package/public/faces/blonde/think-2.mp4 +0 -0
- package/public/faces/blonde/thinking.mp4 +0 -0
- package/public/faces/blonde/wave.mp4 +0 -0
- package/public/faces/clap.mp4 +0 -0
- package/public/faces/dance.mp4 +0 -0
- package/public/faces/face.jpg +0 -0
- package/public/faces/framing.json +1 -0
- package/public/faces/happy.mp4 +0 -0
- package/public/faces/heart.mp4 +0 -0
- package/public/faces/idle-1.mp4 +0 -0
- package/public/faces/idle-2.mp4 +0 -0
- package/public/faces/idle-3.mp4 +0 -0
- package/public/faces/laugh.mp4 +0 -0
- package/public/faces/lips.json +1 -0
- package/public/faces/listening.mp4 +0 -0
- package/public/faces/poster.jpg +0 -0
- package/public/faces/shy.mp4 +0 -0
- package/public/faces/sorry.mp4 +0 -0
- package/public/faces/stretch.mp4 +0 -0
- package/public/faces/surprised.mp4 +0 -0
- package/public/faces/talk-1.mp4 +0 -0
- package/public/faces/talk-2.mp4 +0 -0
- package/public/faces/think-2.mp4 +0 -0
- package/public/faces/thinking.mp4 +0 -0
- package/public/faces/wave.mp4 +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camera on the person of a video call (docs/design/ta-call.md 12): which part of a clip's frame the view shows. As
|
|
3
|
+
* she sits (and speaks) it is the close-up the view always had, the frame filling it with her face a third from the top;
|
|
4
|
+
* as she stands up and moves (a dance, a stretch), it draws back to keep her head, her arms and her body in the view,
|
|
5
|
+
* by the box of her body in each moment of the clip, then comes back as she sits again, her head kept under what the
|
|
6
|
+
* view lays over its top (the title). A view the shape of none of the frames shows the rest of the frame on a blurred
|
|
7
|
+
* room (the bars), never her cut off.
|
|
8
|
+
*/
|
|
9
|
+
export var FaceCamera;
|
|
10
|
+
(function (FaceCamera) {
|
|
11
|
+
/** Room kept above her head, of the frame's height. */
|
|
12
|
+
FaceCamera.HEADROOM = 0.03;
|
|
13
|
+
/** How far her head rises above where it is as she sits before the camera has drawn back all the way, of the frame's height. */
|
|
14
|
+
FaceCamera.RISE = 0.1;
|
|
15
|
+
/** Where her face is in the close-up, from the top (as object-position: 50% 30%). */
|
|
16
|
+
const FACE = 0.3;
|
|
17
|
+
/** The close-up of `rest` in a view of `aspect` (width / height): it fills the view, cut at the sides or below. */
|
|
18
|
+
function close(aspect, rest) {
|
|
19
|
+
if (aspect < rest.w / rest.h) {
|
|
20
|
+
const w = rest.h * aspect;
|
|
21
|
+
return { x: rest.x + (rest.w - w) / 2, y: rest.y, w, h: rest.h };
|
|
22
|
+
}
|
|
23
|
+
const h = rest.w / aspect;
|
|
24
|
+
return { x: rest.x, y: rest.y + (rest.h - h) * FACE, w: rest.w, h };
|
|
25
|
+
}
|
|
26
|
+
FaceCamera.close = close;
|
|
27
|
+
/** The box of her body at `seconds` into the clip, between the two samples around it. */
|
|
28
|
+
function body(framing, seconds) {
|
|
29
|
+
const { body } = framing;
|
|
30
|
+
const at = Math.max(0, Math.min(body.length - 1, seconds * framing.fps));
|
|
31
|
+
const before = body[Math.floor(at)];
|
|
32
|
+
const after = body[Math.min(body.length - 1, Math.floor(at) + 1)];
|
|
33
|
+
const part = at - Math.floor(at);
|
|
34
|
+
return before.map((value, k) => value + (after[k] - value) * part);
|
|
35
|
+
}
|
|
36
|
+
FaceCamera.body = body;
|
|
37
|
+
/**
|
|
38
|
+
* What the camera shows of a frame of `size` at `seconds` into its clip, in a view of `aspect`: the close-up, or for a
|
|
39
|
+
* clip with a framing, as much more as her body takes, the more the higher she rose from her seat, her head under the
|
|
40
|
+
* share `clear` of the view's height at its top.
|
|
41
|
+
*/
|
|
42
|
+
function aim(aspect, size, framing, seconds, clear = 0) {
|
|
43
|
+
var _a;
|
|
44
|
+
const near = close(aspect, (_a = framing === null || framing === void 0 ? void 0 : framing.rest) !== null && _a !== void 0 ? _a : { x: 0, y: 0, w: size.w, h: size.h });
|
|
45
|
+
if (!(framing === null || framing === void 0 ? void 0 : framing.body.length)) {
|
|
46
|
+
return near;
|
|
47
|
+
}
|
|
48
|
+
const [x1, y1, x2] = body(framing, seconds);
|
|
49
|
+
// How far she rose from her seat, or (a person whose hair is high as she sits) how near her head is to leaving
|
|
50
|
+
// the picture of her seated: all the way back once it does.
|
|
51
|
+
const lift = FaceCamera.RISE * size.h;
|
|
52
|
+
const rose = Math.max(0, Math.min(1, Math.max((framing.body[0][1] - y1) / lift, (framing.rest.y + lift / 2 - y1) / (lift / 2))));
|
|
53
|
+
if (!rose) {
|
|
54
|
+
return near;
|
|
55
|
+
}
|
|
56
|
+
const head = Math.max(0, y1 - FaceCamera.HEADROOM * size.h);
|
|
57
|
+
const top = near.y + rose * (Math.min(near.y, head) - near.y);
|
|
58
|
+
const left = near.x + rose * (Math.min(near.x, Math.max(0, x1)) - near.x);
|
|
59
|
+
const right = near.x + near.w + rose * (Math.max(near.x + near.w, Math.min(size.w, x2)) - near.x - near.w);
|
|
60
|
+
const bottom = near.y + near.h;
|
|
61
|
+
const free = rose * Math.max(0, Math.min(0.4, clear));
|
|
62
|
+
let w = right - left;
|
|
63
|
+
let h = (bottom - top) / (1 - free);
|
|
64
|
+
if (w / h < aspect) {
|
|
65
|
+
w = h * aspect;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
h = w / aspect;
|
|
69
|
+
}
|
|
70
|
+
// Her head below what is laid over the top of the view, though the frame has nothing more above her.
|
|
71
|
+
const highest = top - free * h;
|
|
72
|
+
return { x: within(size.w, w, (left + right - w) / 2), y: Math.min(highest, within(size.h, h, highest)), w, h };
|
|
73
|
+
}
|
|
74
|
+
FaceCamera.aim = aim;
|
|
75
|
+
/** Where `camera` puts its clip in a view `width` wide. */
|
|
76
|
+
function place(camera, width) {
|
|
77
|
+
const scale = width / camera.w;
|
|
78
|
+
return { scale, left: -camera.x * scale, top: -camera.y * scale };
|
|
79
|
+
}
|
|
80
|
+
FaceCamera.place = place;
|
|
81
|
+
/** Where a span of `size` starts on a side of `length`: inside it, or as much over either end when larger. */
|
|
82
|
+
function within(length, size, at) {
|
|
83
|
+
return size >= length ? (length - size) / 2 : Math.max(0, Math.min(length - size, at));
|
|
84
|
+
}
|
|
85
|
+
})(FaceCamera || (FaceCamera = {}));
|
|
86
|
+
/**
|
|
87
|
+
* The camera moving to where it aims, as one who films does: it eases there (a time constant of `tau` seconds), and
|
|
88
|
+
* jumps only when what it films is another clip, frame or view, where nothing was shown before to move from.
|
|
89
|
+
*/
|
|
90
|
+
export class CameraMotion {
|
|
91
|
+
constructor(tau = 0.3) {
|
|
92
|
+
this.tau = tau;
|
|
93
|
+
}
|
|
94
|
+
/** The camera `seconds` after the last step, aiming at `aim` in what `key` names (the clip, its size and the view). */
|
|
95
|
+
follow(key, aim, seconds) {
|
|
96
|
+
const now = this.now;
|
|
97
|
+
if (!now || key !== this.key) {
|
|
98
|
+
this.key = key;
|
|
99
|
+
this.now = { ...aim };
|
|
100
|
+
return this.now;
|
|
101
|
+
}
|
|
102
|
+
const part = 1 - Math.exp(-Math.max(0, seconds) / this.tau);
|
|
103
|
+
this.now = {
|
|
104
|
+
x: now.x + (aim.x - now.x) * part,
|
|
105
|
+
y: now.y + (aim.y - now.y) * part,
|
|
106
|
+
w: now.w + (aim.w - now.w) * part,
|
|
107
|
+
h: now.h + (aim.h - now.h) * part,
|
|
108
|
+
};
|
|
109
|
+
return this.now;
|
|
110
|
+
}
|
|
111
|
+
/** Where it is now, if it filmed anything yet. */
|
|
112
|
+
current() {
|
|
113
|
+
return this.now;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The cameras of the two layers of video (FaceCamera): each frame, each layer is placed as its camera aims at the
|
|
118
|
+
* moment of its clip, the camera easing there (CameraMotion). The layers keep the size of their clip's frame and are
|
|
119
|
+
* only moved and scaled (a transform), so that nothing is laid out again as they move.
|
|
120
|
+
*/
|
|
121
|
+
export class FaceCameras {
|
|
122
|
+
constructor(faces, videos, box,
|
|
123
|
+
/** How much of the top of the view, in pixels, has something laid over it (the title of the call). */
|
|
124
|
+
clear = () => 0) {
|
|
125
|
+
this.faces = faces;
|
|
126
|
+
this.videos = videos;
|
|
127
|
+
this.clear = clear;
|
|
128
|
+
this.width = 0;
|
|
129
|
+
this.height = 0;
|
|
130
|
+
this.motions = videos.map(() => new CameraMotion());
|
|
131
|
+
this.placed = videos.map(() => undefined);
|
|
132
|
+
const view = box === null || box === void 0 ? void 0 : box.ownerDocument.defaultView;
|
|
133
|
+
if (box && (view === null || view === void 0 ? void 0 : view.ResizeObserver)) {
|
|
134
|
+
this.observer = new view.ResizeObserver(() => this.measure(box));
|
|
135
|
+
this.observer.observe(box);
|
|
136
|
+
}
|
|
137
|
+
if (box) {
|
|
138
|
+
this.measure(box);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
measure(box) {
|
|
142
|
+
this.width = box.clientWidth;
|
|
143
|
+
this.height = box.clientHeight;
|
|
144
|
+
}
|
|
145
|
+
/** A frame at `time` (ms): each layer that plays a clip, named in `names`, placed where its camera is. */
|
|
146
|
+
frame(time, names) {
|
|
147
|
+
const seconds = this.last === undefined ? 0 : (time - this.last) / 1000;
|
|
148
|
+
this.last = time;
|
|
149
|
+
if (!this.width || !this.height) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const aspect = this.width / this.height;
|
|
153
|
+
this.videos.forEach((video, index) => {
|
|
154
|
+
const clip = names[index];
|
|
155
|
+
const size = { w: video.videoWidth, h: video.videoHeight };
|
|
156
|
+
if (!clip || !size.w || !size.h) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const aim = FaceCamera.aim(aspect, size, this.faces.framing(clip), video.currentTime, this.clear() / this.height);
|
|
160
|
+
const camera = this.motions[index].follow(`${clip} ${size.w}x${size.h} ${aspect.toFixed(3)}`, aim, seconds);
|
|
161
|
+
const { scale, left, top } = FaceCamera.place(camera, this.width);
|
|
162
|
+
const style = video.style;
|
|
163
|
+
const sized = `${size.w}x${size.h}`;
|
|
164
|
+
if (this.placed[index] !== sized) {
|
|
165
|
+
this.placed[index] = sized;
|
|
166
|
+
style.width = `${size.w}px`;
|
|
167
|
+
style.height = `${size.h}px`;
|
|
168
|
+
style.right = 'auto';
|
|
169
|
+
style.bottom = 'auto';
|
|
170
|
+
style.objectFit = 'fill';
|
|
171
|
+
style.transformOrigin = '0 0';
|
|
172
|
+
}
|
|
173
|
+
style.transform = `translate3d(${left.toFixed(2)}px, ${top.toFixed(2)}px, 0) scale(${scale.toFixed(5)})`;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/** Where the clip of `video` goes in a view `width` wide (a canvas over it, in its pixels); undefined before it is placed. */
|
|
177
|
+
place(video, width) {
|
|
178
|
+
var _a;
|
|
179
|
+
const camera = (_a = this.motions[this.videos.indexOf(video)]) === null || _a === void 0 ? void 0 : _a.current();
|
|
180
|
+
return camera && FaceCamera.place(camera, width);
|
|
181
|
+
}
|
|
182
|
+
close() {
|
|
183
|
+
var _a;
|
|
184
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
185
|
+
for (const video of this.videos) {
|
|
186
|
+
for (const key of ['width', 'height', 'right', 'bottom', 'object-fit', 'transform-origin', 'transform']) {
|
|
187
|
+
video.style.removeProperty(key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=face-camera.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ClipFraming } from './face-camera.js';
|
|
2
|
+
/** A URL of the page's own, from the document a video call draws in (its window is about:blank). */
|
|
3
|
+
export declare function faceUrl(path: string, doc: Document): string;
|
|
4
|
+
/**
|
|
5
|
+
* The files of the person of a video call (faces/README.md), as they are now: their names stay the same from one Ta to
|
|
6
|
+
* the next while the files of the server are kept a year, so each is asked again once a page (a 304 when unchanged)
|
|
7
|
+
* and played from its copy in memory. A clip a cache kept from a Ta before would show another person than the one the
|
|
8
|
+
* mouth is drawn for. With where her face is in each frame (lips.json), the frames of the clips without a mouth, and
|
|
9
|
+
* how the clips she stands up in are framed (framing.json). Of one person of those Ta has (CallPeople): her files are in
|
|
10
|
+
* a directory of her own (`blonde/`), the first person's at the top; the clips are named here as the first person's are
|
|
11
|
+
* (`talk-1`), and `full` gives the name of the file, as lips.json and the mouth know it (`blonde/talk-1`).
|
|
12
|
+
*/
|
|
13
|
+
export declare class FaceFiles {
|
|
14
|
+
protected readonly base: string;
|
|
15
|
+
/** The directory of the person in faces/ (`blonde/`), `''` for the first. */
|
|
16
|
+
readonly person: string;
|
|
17
|
+
protected static current?: FaceFiles;
|
|
18
|
+
/** The URL each file plays from: its copy in memory, else its own. */
|
|
19
|
+
protected readonly urls: Map<string, string>;
|
|
20
|
+
protected faceBoxes: Record<string, number[][]>;
|
|
21
|
+
/** The frames of the clips no mouth is drawn on (lips.json `plain`). */
|
|
22
|
+
protected plainFrames: Record<string, number>;
|
|
23
|
+
protected framings: Record<string, ClipFraming>;
|
|
24
|
+
loaded: boolean;
|
|
25
|
+
readonly ready: Promise<void>;
|
|
26
|
+
protected constructor(base: string,
|
|
27
|
+
/** The directory of the person in faces/ (`blonde/`), `''` for the first. */
|
|
28
|
+
person: string);
|
|
29
|
+
/** The files of a person (CallPeople.dir) for the page, loaded once (again as the person changes). */
|
|
30
|
+
static of(doc: Document, person?: string): FaceFiles;
|
|
31
|
+
static poster(doc: Document, person?: string): string;
|
|
32
|
+
/** The name of a clip of this person as lips.json and the mouth know it; one of the user's (`own:…`) as it is. */
|
|
33
|
+
full(clip: string): string;
|
|
34
|
+
/** Where her face is (x1, y1, x2, y2) in each frame of a clip; undefined for a clip lips.json does not have. */
|
|
35
|
+
boxes(clip: string): readonly number[][] | undefined;
|
|
36
|
+
/** The frames of a clip; undefined for one lips.json does not have. */
|
|
37
|
+
frames(clip: string): number | undefined;
|
|
38
|
+
/** How a clip she stands up in is framed (FaceCamera); undefined for the others, framed as they are. */
|
|
39
|
+
framing(clip: string): ClipFraming | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* A clip of the user's (WebCallMove), played from its URL as Ta's own are: its frames, where her face is in each,
|
|
42
|
+
* and how it is framed as she stands up.
|
|
43
|
+
*/
|
|
44
|
+
add(clip: string, file: {
|
|
45
|
+
url: string;
|
|
46
|
+
frames: number;
|
|
47
|
+
boxes?: number[][];
|
|
48
|
+
framing?: {
|
|
49
|
+
rest: number[];
|
|
50
|
+
body: number[][];
|
|
51
|
+
fps: number;
|
|
52
|
+
};
|
|
53
|
+
}): void;
|
|
54
|
+
clip(name: string): string;
|
|
55
|
+
protected load(): Promise<void>;
|
|
56
|
+
/** The framings of framing.json, those whole. */
|
|
57
|
+
static framings(file: FramingFile | undefined): Record<string, ClipFraming>;
|
|
58
|
+
/** The file as the server has it now. */
|
|
59
|
+
protected fresh(file: string): Promise<Response>;
|
|
60
|
+
}
|
|
61
|
+
/** faces/framing.json: of each clip she stands up in, where the picture of the others is (x, y, width, height) and her body. */
|
|
62
|
+
export interface FramingFile {
|
|
63
|
+
fps?: number;
|
|
64
|
+
clips?: Record<string, {
|
|
65
|
+
rest?: number[];
|
|
66
|
+
body?: number[][];
|
|
67
|
+
back?: number;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** The picture shown until a clip plays (faces/README.md), of a person (CallPeople). */
|
|
2
|
+
const POSTER = 'poster.jpg';
|
|
3
|
+
/** A URL of the page's own, from the document a video call draws in (its window is about:blank). */
|
|
4
|
+
export function faceUrl(path, doc) {
|
|
5
|
+
return new URL(path, doc.baseURI === 'about:blank' ? document.baseURI : doc.baseURI).href;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The files of the person of a video call (faces/README.md), as they are now: their names stay the same from one Ta to
|
|
9
|
+
* the next while the files of the server are kept a year, so each is asked again once a page (a 304 when unchanged)
|
|
10
|
+
* and played from its copy in memory. A clip a cache kept from a Ta before would show another person than the one the
|
|
11
|
+
* mouth is drawn for. With where her face is in each frame (lips.json), the frames of the clips without a mouth, and
|
|
12
|
+
* how the clips she stands up in are framed (framing.json). Of one person of those Ta has (CallPeople): her files are in
|
|
13
|
+
* a directory of her own (`blonde/`), the first person's at the top; the clips are named here as the first person's are
|
|
14
|
+
* (`talk-1`), and `full` gives the name of the file, as lips.json and the mouth know it (`blonde/talk-1`).
|
|
15
|
+
*/
|
|
16
|
+
export class FaceFiles {
|
|
17
|
+
constructor(base,
|
|
18
|
+
/** The directory of the person in faces/ (`blonde/`), `''` for the first. */
|
|
19
|
+
person) {
|
|
20
|
+
this.base = base;
|
|
21
|
+
this.person = person;
|
|
22
|
+
/** The URL each file plays from: its copy in memory, else its own. */
|
|
23
|
+
this.urls = new Map();
|
|
24
|
+
this.faceBoxes = {};
|
|
25
|
+
/** The frames of the clips no mouth is drawn on (lips.json `plain`). */
|
|
26
|
+
this.plainFrames = {};
|
|
27
|
+
this.framings = {};
|
|
28
|
+
this.loaded = false;
|
|
29
|
+
this.ready = this.load().finally(() => {
|
|
30
|
+
this.loaded = true;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** The files of a person (CallPeople.dir) for the page, loaded once (again as the person changes). */
|
|
34
|
+
static of(doc, person = '') {
|
|
35
|
+
var _a;
|
|
36
|
+
const base = faceUrl('faces/', doc);
|
|
37
|
+
if (((_a = FaceFiles.current) === null || _a === void 0 ? void 0 : _a.base) !== base || FaceFiles.current.person !== person) {
|
|
38
|
+
FaceFiles.current = new FaceFiles(base, person);
|
|
39
|
+
}
|
|
40
|
+
return FaceFiles.current;
|
|
41
|
+
}
|
|
42
|
+
static poster(doc, person = '') {
|
|
43
|
+
var _a;
|
|
44
|
+
const current = FaceFiles.current;
|
|
45
|
+
return (_a = ((current === null || current === void 0 ? void 0 : current.person) === person ? current.urls.get(`${person}${POSTER}`) : undefined)) !== null && _a !== void 0 ? _a : faceUrl(`faces/${person}${POSTER}`, doc);
|
|
46
|
+
}
|
|
47
|
+
/** The name of a clip of this person as lips.json and the mouth know it; one of the user's (`own:…`) as it is. */
|
|
48
|
+
full(clip) {
|
|
49
|
+
return clip.includes(':') ? clip : `${this.person}${clip}`;
|
|
50
|
+
}
|
|
51
|
+
/** Where her face is (x1, y1, x2, y2) in each frame of a clip; undefined for a clip lips.json does not have. */
|
|
52
|
+
boxes(clip) {
|
|
53
|
+
return this.faceBoxes[this.full(clip)];
|
|
54
|
+
}
|
|
55
|
+
/** The frames of a clip; undefined for one lips.json does not have. */
|
|
56
|
+
frames(clip) {
|
|
57
|
+
var _a;
|
|
58
|
+
var _b;
|
|
59
|
+
return (_b = (_a = this.faceBoxes[this.full(clip)]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : this.plainFrames[this.full(clip)];
|
|
60
|
+
}
|
|
61
|
+
/** How a clip she stands up in is framed (FaceCamera); undefined for the others, framed as they are. */
|
|
62
|
+
framing(clip) {
|
|
63
|
+
return this.framings[this.full(clip)];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A clip of the user's (WebCallMove), played from its URL as Ta's own are: its frames, where her face is in each,
|
|
67
|
+
* and how it is framed as she stands up.
|
|
68
|
+
*/
|
|
69
|
+
add(clip, file) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
this.urls.set(`${clip}.mp4`, file.url);
|
|
72
|
+
if ((_a = file.boxes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
73
|
+
this.faceBoxes[clip] = file.boxes;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.plainFrames[clip] = file.frames;
|
|
77
|
+
}
|
|
78
|
+
Object.assign(this.framings, FaceFiles.framings({ fps: (_b = file.framing) === null || _b === void 0 ? void 0 : _b.fps, clips: file.framing ? { [clip]: file.framing } : {} }));
|
|
79
|
+
}
|
|
80
|
+
clip(name) {
|
|
81
|
+
var _a;
|
|
82
|
+
const file = `${this.full(name)}.mp4`;
|
|
83
|
+
return (_a = this.urls.get(file)) !== null && _a !== void 0 ? _a : new URL(file, this.base).href;
|
|
84
|
+
}
|
|
85
|
+
async load() {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const [lips, framing] = await Promise.all([
|
|
88
|
+
this.fresh('lips.json')
|
|
89
|
+
.then(response => response.json())
|
|
90
|
+
.catch(() => undefined),
|
|
91
|
+
this.fresh('framing.json')
|
|
92
|
+
.then(response => response.json())
|
|
93
|
+
.catch(() => undefined),
|
|
94
|
+
]);
|
|
95
|
+
this.framings = FaceFiles.framings(framing);
|
|
96
|
+
this.faceBoxes = (_a = lips === null || lips === void 0 ? void 0 : lips.clips) !== null && _a !== void 0 ? _a : {};
|
|
97
|
+
this.plainFrames = (_b = lips === null || lips === void 0 ? void 0 : lips.plain) !== null && _b !== void 0 ? _b : {};
|
|
98
|
+
// Of this person alone: the others' clips are not fetched.
|
|
99
|
+
const mine = (clip) => (this.person ? clip.startsWith(this.person) : !clip.includes('/'));
|
|
100
|
+
const clips = [...Object.keys(this.faceBoxes), ...Object.keys(this.plainFrames)].filter(mine);
|
|
101
|
+
const files = [`${this.person}${POSTER}`, ...clips.map(clip => `${clip}.mp4`)];
|
|
102
|
+
await Promise.all(files.map(file => this.fresh(file)
|
|
103
|
+
.then(response => response.blob())
|
|
104
|
+
.then(blob => this.urls.set(file, URL.createObjectURL(blob)))
|
|
105
|
+
.catch(() => undefined)));
|
|
106
|
+
}
|
|
107
|
+
/** The framings of framing.json, those whole. */
|
|
108
|
+
static framings(file) {
|
|
109
|
+
var _a;
|
|
110
|
+
const framings = {};
|
|
111
|
+
for (const [clip, { rest, body, back }] of Object.entries((_a = file === null || file === void 0 ? void 0 : file.clips) !== null && _a !== void 0 ? _a : {})) {
|
|
112
|
+
if ((rest === null || rest === void 0 ? void 0 : rest.length) === 4 && (body === null || body === void 0 ? void 0 : body.length) && (file === null || file === void 0 ? void 0 : file.fps)) {
|
|
113
|
+
framings[clip] = {
|
|
114
|
+
rest: { x: rest[0], y: rest[1], w: rest[2], h: rest[3] },
|
|
115
|
+
body,
|
|
116
|
+
fps: file.fps,
|
|
117
|
+
...(typeof back === 'number' ? { back } : {}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return framings;
|
|
122
|
+
}
|
|
123
|
+
/** The file as the server has it now. */
|
|
124
|
+
async fresh(file) {
|
|
125
|
+
const response = await fetch(new URL(file, this.base).href, { cache: 'no-cache' });
|
|
126
|
+
if (!response.ok) {
|
|
127
|
+
throw new Error(`${file}: ${response.status}`);
|
|
128
|
+
}
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=face-files.js.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type TaCallOwnMove } from '@celljs/ta-protocol';
|
|
2
|
+
import type { CallPhase, CallReading } from '../assistant/voice-call-protocol.js';
|
|
3
|
+
import type { WebCallMove } from '../extension/web-api-call.js';
|
|
4
|
+
/** A state of the call, each with clips played at random, never the same twice in a row (loops). */
|
|
5
|
+
export type LoopKind = 'listening' | 'thinking' | 'speaking';
|
|
6
|
+
/** A move: a clip that plays once, as she says one of its words (`say`), or once she said it, as she listens (`after`). */
|
|
7
|
+
export interface FaceMove {
|
|
8
|
+
name: string;
|
|
9
|
+
when: 'say' | 'after';
|
|
10
|
+
clip: string;
|
|
11
|
+
/** Whether a sentence brings it. */
|
|
12
|
+
words: RegExp;
|
|
13
|
+
/** A few of its words, told to Ta (TaCallScene.moves): of the user's moves; Ta's own are told by TaCallMoves. */
|
|
14
|
+
told: string[];
|
|
15
|
+
/** The user's own (WebCallMoves). */
|
|
16
|
+
own?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What the person of a video call can do, in one place (docs/design/ta-call.md 16): the clips of each state of the call
|
|
20
|
+
* and the moves a sentence brings, Ta's own and the user's (WebCallMoves) before them. Both ways Ta answers (its own
|
|
21
|
+
* front, a voice service answering by itself) end in what she says, so a move is brought by the words said, and Ta is
|
|
22
|
+
* told which moves there are and their words (TaCallScene.moves). A clip of the user's that cannot play gives way to
|
|
23
|
+
* Ta's own.
|
|
24
|
+
*/
|
|
25
|
+
export declare class FaceMoves {
|
|
26
|
+
protected own: FaceMove[];
|
|
27
|
+
protected readonly ownLoops: Record<LoopKind, string[]>;
|
|
28
|
+
/** The user's clips that could not play, and why. */
|
|
29
|
+
protected readonly broken: Map<string, string>;
|
|
30
|
+
/** The state of the call as clips play it. */
|
|
31
|
+
static kind(phase: CallPhase, paused: boolean): LoopKind;
|
|
32
|
+
/** The clip name of a move of the user's, apart from those of Ta's own. */
|
|
33
|
+
static ownClip(name: string): string;
|
|
34
|
+
/** The user's moves (WebCallMoves), as a call begins. */
|
|
35
|
+
use(moves: readonly WebCallMove[]): void;
|
|
36
|
+
/** Words as a test of a sentence: any of them in it, whatever their case. */
|
|
37
|
+
static wordsOf(words: readonly string[]): RegExp;
|
|
38
|
+
/** The moves that may play now, the user's first; one of Ta's own named as one of the user's gives way to it. */
|
|
39
|
+
moves(): FaceMove[];
|
|
40
|
+
/**
|
|
41
|
+
* The move a sentence she says brings as she says it: one of the user's by its words, else the move it names
|
|
42
|
+
* (TaCallMoves: "给你比个心"), else its look ("谢谢你"); undefined for none.
|
|
43
|
+
*/
|
|
44
|
+
said(words: string | undefined): FaceMove | undefined;
|
|
45
|
+
/** What she stands up to do once she said a sentence (she dances when she says she will); undefined for nothing. */
|
|
46
|
+
after(words: string | undefined): FaceMove | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* A move begins at this second of a reading: the sentence heard then asks for one (the user's, or one TaCallMoves
|
|
49
|
+
* names), not played yet. The clip of speaking playing then gives way, so that she makes it as she says it.
|
|
50
|
+
*/
|
|
51
|
+
cue(reading: Pick<CallReading, 'pieces' | 'pieceAt'> | undefined, seconds: number, used: ReadonlySet<number>): boolean;
|
|
52
|
+
/** The move a clip plays; undefined for a clip of a state. */
|
|
53
|
+
of(clip: string | undefined): FaceMove | undefined;
|
|
54
|
+
/** The clips of a state: the user's when they gave some that play, else Ta's own. */
|
|
55
|
+
loops(kind: LoopKind): readonly string[];
|
|
56
|
+
/** The next clip of a state, at random but never the one just played where it has others. */
|
|
57
|
+
loop(kind: LoopKind, last: string | undefined, random?: () => number): string;
|
|
58
|
+
/**
|
|
59
|
+
* The clip that begins at a second of a reading, after `last`: the move of a sentence heard since the clip before
|
|
60
|
+
* began, each sentence once (`used`), the user's own first, else the latest; else another clip of speaking. A clip
|
|
61
|
+
* plays whole (the mouth is drawn for its frames ahead), so a sentence said in its middle shows at its end.
|
|
62
|
+
*/
|
|
63
|
+
at(reading: Pick<CallReading, 'pieces' | 'pieceAt'> | undefined, seconds: number, last: string | undefined, used: Set<number>): string;
|
|
64
|
+
/** A clip could not play: true when it was the user's, which then gives way to Ta's own. */
|
|
65
|
+
fail(clip: string, reason: string): boolean;
|
|
66
|
+
/** The moves of the user's Ta is told of (TaCallScene.moves), beside her own (TaCallMoves). */
|
|
67
|
+
told(): TaCallOwnMove[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { TaCallMoves } from '@celljs/ta-protocol';
|
|
2
|
+
/** The clips of each state, of Ta's own (public/faces, README.md there). */
|
|
3
|
+
const LOOPS = {
|
|
4
|
+
listening: ['listening', 'idle-1', 'idle-2', 'idle-3'],
|
|
5
|
+
thinking: ['thinking', 'think-2'],
|
|
6
|
+
speaking: ['talk-1', 'talk-2', 'idle-1', 'listening'],
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Ta's own moves: the looks of what she says, by its words, in the order they are tried (sorrow first); and those she
|
|
10
|
+
* stands up for, brought by TaCallMoves.named as the moves she is asked for (wave, heart, clap, laugh too).
|
|
11
|
+
*/
|
|
12
|
+
const BUILT_IN = [
|
|
13
|
+
move('sorry', 'say', /抱歉|对不起|不好意思|遗憾|可惜|失败了|出错|没做成|糟糕|對不起|ごめん|すみません|残念|\b(?:sorry|unfortunately|afraid|failed)\b/i, [
|
|
14
|
+
'抱歉',
|
|
15
|
+
'sorry',
|
|
16
|
+
]),
|
|
17
|
+
move('laugh', 'say', /哈哈|嘿嘿|笑死|好好笑|太好笑|逗死|ハハ|笑える|\b(?:haha\w*|lol|hilarious|funny)\b/i, ['哈哈', 'haha']),
|
|
18
|
+
move('surprised', 'say', /哇|天哪|天啊|真的吗|竟然|居然|没想到|わあ|まさか|\b(?:wow|really\?|no way|amazing|incredible)\b/i, ['哇', 'wow']),
|
|
19
|
+
move('clap', 'say', /恭喜|太棒了|真棒|好厉害|太厉害|干得漂亮|好样的|太強|おめでとう|すごい|\b(?:congrat\w*|bravo|well done|awesome)\b/i, [
|
|
20
|
+
'恭喜',
|
|
21
|
+
'congrats',
|
|
22
|
+
]),
|
|
23
|
+
move('heart', 'say', /爱你|喜欢你|比心|么么|谢谢你|感谢你|謝謝你|大好き|ありがとう|\b(?:love you|thank you|thanks)\b/i, ['谢谢你', 'thank you']),
|
|
24
|
+
move('shy', 'say', /过奖|過獎|哪里哪里|害羞|不好意思啦|夸得|照れ|\b(?:flattered|you're too kind|blush\w*)\b/i, ['过奖', 'flattered']),
|
|
25
|
+
move('wave', 'say', /你好|您好|嗨|哈喽|早上好|下午好|晚上好|再见|拜拜|回头见|こんにちは|おはよう|こんばんは|またね|さようなら|\b(?:hello|hi|hey|bye|goodbye|see you)\b/i, ['你好', '再见', 'hello']),
|
|
26
|
+
move('happy', 'say', /太好了|好开心|开心|高兴|很棒|成功了|搞定|嬉しい|やった|\b(?:great|glad|yay|done!)\b/i, ['太好了', 'great']),
|
|
27
|
+
move('dance', 'after', /(?!)/, []),
|
|
28
|
+
move('stretch', 'after', /(?!)/, []),
|
|
29
|
+
];
|
|
30
|
+
/** A sentence that says she cannot, or will not: no move of the user's that she would stand up for. */
|
|
31
|
+
const NOT_AFTER = /不会|不能|没法|没办法|做不了|跳不了|不行|不太方便|できない|無理|\b(?:can'?t|cannot|unable|won'?t|not able)\b/i;
|
|
32
|
+
function move(name, when, words, told) {
|
|
33
|
+
return { name, when, clip: name, words, told };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What the person of a video call can do, in one place (docs/design/ta-call.md 16): the clips of each state of the call
|
|
37
|
+
* and the moves a sentence brings, Ta's own and the user's (WebCallMoves) before them. Both ways Ta answers (its own
|
|
38
|
+
* front, a voice service answering by itself) end in what she says, so a move is brought by the words said, and Ta is
|
|
39
|
+
* told which moves there are and their words (TaCallScene.moves). A clip of the user's that cannot play gives way to
|
|
40
|
+
* Ta's own.
|
|
41
|
+
*/
|
|
42
|
+
export class FaceMoves {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.own = [];
|
|
45
|
+
this.ownLoops = { listening: [], thinking: [], speaking: [] };
|
|
46
|
+
/** The user's clips that could not play, and why. */
|
|
47
|
+
this.broken = new Map();
|
|
48
|
+
}
|
|
49
|
+
/** The state of the call as clips play it. */
|
|
50
|
+
static kind(phase, paused) {
|
|
51
|
+
if (paused) {
|
|
52
|
+
return 'listening';
|
|
53
|
+
}
|
|
54
|
+
return phase === 'thinking' ? 'thinking' : phase === 'speaking' ? 'speaking' : 'listening';
|
|
55
|
+
}
|
|
56
|
+
/** The clip name of a move of the user's, apart from those of Ta's own. */
|
|
57
|
+
static ownClip(name) {
|
|
58
|
+
return `own:${name}`;
|
|
59
|
+
}
|
|
60
|
+
/** The user's moves (WebCallMoves), as a call begins. */
|
|
61
|
+
use(moves) {
|
|
62
|
+
var _a;
|
|
63
|
+
this.own = [];
|
|
64
|
+
for (const loop of Object.values(this.ownLoops)) {
|
|
65
|
+
loop.length = 0;
|
|
66
|
+
}
|
|
67
|
+
for (const given of moves) {
|
|
68
|
+
const clip = FaceMoves.ownClip(given.name);
|
|
69
|
+
if (given.kind === 'say' || given.kind === 'after') {
|
|
70
|
+
const words = ((_a = given.words) !== null && _a !== void 0 ? _a : []).map(word => word.trim()).filter(Boolean);
|
|
71
|
+
// In place of one of Ta's own without words of its own: brought by that one's words.
|
|
72
|
+
const same = BUILT_IN.find(move => move.name === given.name && move.when === given.kind);
|
|
73
|
+
if (words.length) {
|
|
74
|
+
this.own.push({ name: given.name, when: given.kind, clip, words: FaceMoves.wordsOf(words), told: words.slice(0, 3), own: true });
|
|
75
|
+
}
|
|
76
|
+
else if (same) {
|
|
77
|
+
this.own.push({ ...same, clip, own: true });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (given.kind in this.ownLoops) {
|
|
81
|
+
this.ownLoops[given.kind].push(clip);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Words as a test of a sentence: any of them in it, whatever their case. */
|
|
86
|
+
static wordsOf(words) {
|
|
87
|
+
return new RegExp(words.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'i');
|
|
88
|
+
}
|
|
89
|
+
/** The moves that may play now, the user's first; one of Ta's own named as one of the user's gives way to it. */
|
|
90
|
+
moves() {
|
|
91
|
+
const own = this.own.filter(move => !this.broken.has(move.clip));
|
|
92
|
+
const names = new Set(own.map(move => move.name));
|
|
93
|
+
return [...own, ...BUILT_IN.filter(move => !names.has(move.name))];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The move a sentence she says brings as she says it: one of the user's by its words, else the move it names
|
|
97
|
+
* (TaCallMoves: "给你比个心"), else its look ("谢谢你"); undefined for none.
|
|
98
|
+
*/
|
|
99
|
+
said(words) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (!words) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const moves = this.moves();
|
|
105
|
+
const named = TaCallMoves.named(words);
|
|
106
|
+
return ((_b = (_a = moves.find(move => move.own && move.when === 'say' && move.words.test(words))) !== null && _a !== void 0 ? _a : (named && !TaCallMoves.standing(named) ? moves.find(move => move.name === named) : undefined)) !== null && _b !== void 0 ? _b : moves.find(move => move.when === 'say' && move.words.test(words)));
|
|
107
|
+
}
|
|
108
|
+
/** What she stands up to do once she said a sentence (she dances when she says she will); undefined for nothing. */
|
|
109
|
+
after(words) {
|
|
110
|
+
var _a;
|
|
111
|
+
if (!words) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const moves = this.moves();
|
|
115
|
+
const named = TaCallMoves.named(words);
|
|
116
|
+
return ((_a = (NOT_AFTER.test(words) ? undefined : moves.find(move => move.own && move.when === 'after' && move.words.test(words)))) !== null && _a !== void 0 ? _a : (TaCallMoves.standing(named) ? moves.find(move => move.name === named) : undefined));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A move begins at this second of a reading: the sentence heard then asks for one (the user's, or one TaCallMoves
|
|
120
|
+
* names), not played yet. The clip of speaking playing then gives way, so that she makes it as she says it.
|
|
121
|
+
*/
|
|
122
|
+
cue(reading, seconds, used) {
|
|
123
|
+
const piece = reading === null || reading === void 0 ? void 0 : reading.pieceAt(seconds);
|
|
124
|
+
if (piece === undefined || used.has(piece)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const words = reading === null || reading === void 0 ? void 0 : reading.pieces[piece];
|
|
128
|
+
const named = TaCallMoves.named(words);
|
|
129
|
+
return (!!named && !TaCallMoves.standing(named)) || this.own.some(move => move.when === 'say' && !!words && move.words.test(words));
|
|
130
|
+
}
|
|
131
|
+
/** The move a clip plays; undefined for a clip of a state. */
|
|
132
|
+
of(clip) {
|
|
133
|
+
return clip === undefined ? undefined : this.moves().find(move => move.clip === clip);
|
|
134
|
+
}
|
|
135
|
+
/** The clips of a state: the user's when they gave some that play, else Ta's own. */
|
|
136
|
+
loops(kind) {
|
|
137
|
+
const own = this.ownLoops[kind].filter(clip => !this.broken.has(clip));
|
|
138
|
+
return own.length ? own : LOOPS[kind];
|
|
139
|
+
}
|
|
140
|
+
/** The next clip of a state, at random but never the one just played where it has others. */
|
|
141
|
+
loop(kind, last, random = Math.random) {
|
|
142
|
+
const all = this.loops(kind);
|
|
143
|
+
const others = all.filter(clip => clip !== last);
|
|
144
|
+
const from = others.length ? others : all;
|
|
145
|
+
return from[Math.floor(random() * from.length) % from.length];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The clip that begins at a second of a reading, after `last`: the move of a sentence heard since the clip before
|
|
149
|
+
* began, each sentence once (`used`), the user's own first, else the latest; else another clip of speaking. A clip
|
|
150
|
+
* plays whole (the mouth is drawn for its frames ahead), so a sentence said in its middle shows at its end.
|
|
151
|
+
*/
|
|
152
|
+
at(reading, seconds, last, used) {
|
|
153
|
+
var _a;
|
|
154
|
+
const piece = reading === null || reading === void 0 ? void 0 : reading.pieceAt(seconds);
|
|
155
|
+
let chosen;
|
|
156
|
+
for (let k = piece !== null && piece !== void 0 ? piece : -1; k >= 0 && !used.has(k); k--) {
|
|
157
|
+
used.add(k);
|
|
158
|
+
const move = this.said(reading === null || reading === void 0 ? void 0 : reading.pieces[k]);
|
|
159
|
+
if (move && (!chosen || (move.own && !chosen.own))) {
|
|
160
|
+
chosen = move;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return (_a = chosen === null || chosen === void 0 ? void 0 : chosen.clip) !== null && _a !== void 0 ? _a : this.loop('speaking', last);
|
|
164
|
+
}
|
|
165
|
+
/** A clip could not play: true when it was the user's, which then gives way to Ta's own. */
|
|
166
|
+
fail(clip, reason) {
|
|
167
|
+
if (!clip.startsWith('own:') || this.broken.has(clip)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
this.broken.set(clip, reason);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
/** The moves of the user's Ta is told of (TaCallScene.moves), beside her own (TaCallMoves). */
|
|
174
|
+
told() {
|
|
175
|
+
return this.moves()
|
|
176
|
+
.filter(move => move.own && move.told.length)
|
|
177
|
+
.map(move => ({ name: move.name, ...(move.when === 'after' ? { after: true } : {}), words: move.told }));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=face-moves.js.map
|