@celljs/ta-web 4.28.0 → 4.30.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.
Files changed (437) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-thread.js +15 -2
  4. package/esm/browser/assistant/call-scenes.d.ts +5 -4
  5. package/esm/browser/assistant/call-scenes.js +10 -7
  6. package/esm/browser/chat/chat-protocol.d.ts +2 -0
  7. package/esm/browser/chat/chat-shown.d.ts +3 -1
  8. package/esm/browser/chat/chat-shown.js +25 -3
  9. package/esm/browser/chat/chat-view.js +1 -1
  10. package/esm/browser/chat/chat.d.ts +5 -1
  11. package/esm/browser/chat/chat.js +32 -16
  12. package/esm/browser/components/account-menu.d.ts +6 -16
  13. package/esm/browser/components/account-menu.js +47 -101
  14. package/esm/browser/components/app-contexts.js +7 -4
  15. package/esm/browser/components/app-nav.js +4 -4
  16. package/esm/browser/components/chat-list-row.js +7 -2
  17. package/esm/browser/components/chat-tag.d.ts +20 -0
  18. package/esm/browser/components/chat-tag.js +103 -0
  19. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  20. package/esm/browser/components/composer-box-protocol.d.ts +2 -0
  21. package/esm/browser/components/composer-box.js +20 -1
  22. package/esm/browser/components/composer-emoji.d.ts +22 -0
  23. package/esm/browser/components/composer-emoji.js +50 -0
  24. package/esm/browser/components/custom-host.js +1 -1
  25. package/esm/browser/components/discover-view.d.ts +4 -3
  26. package/esm/browser/components/discover-view.js +5 -4
  27. package/esm/browser/components/editor-area.js +1 -1
  28. package/esm/browser/components/emoji-panel.d.ts +22 -0
  29. package/esm/browser/components/emoji-panel.js +54 -0
  30. package/esm/browser/components/host-view.d.ts +1 -1
  31. package/esm/browser/components/launcher-surface.js +1 -1
  32. package/esm/browser/components/markdown.d.ts +6 -1
  33. package/esm/browser/components/markdown.js +6 -2
  34. package/esm/browser/components/me-rows.d.ts +24 -0
  35. package/esm/browser/components/me-rows.js +19 -0
  36. package/esm/browser/components/me-view.d.ts +2 -1
  37. package/esm/browser/components/me-view.js +3 -2
  38. package/esm/browser/components/message-list.js +47 -7
  39. package/esm/browser/components/message-steps.js +13 -0
  40. package/esm/browser/components/nav-places.js +1 -1
  41. package/esm/browser/components/session-view.js +6 -1
  42. package/esm/browser/components/settings-choices.js +3 -0
  43. package/esm/browser/components/settings-controls.d.ts +13 -0
  44. package/esm/browser/components/settings-controls.js +19 -0
  45. package/esm/browser/components/settings-more.d.ts +1 -1
  46. package/esm/browser/components/settings-more.js +28 -39
  47. package/esm/browser/components/settings-parts.d.ts +4 -2
  48. package/esm/browser/components/settings-parts.js +14 -9
  49. package/esm/browser/components/settings-view.js +2 -6
  50. package/esm/browser/components/web-composer.d.ts +1 -1
  51. package/esm/browser/components/web-composer.js +2 -2
  52. package/esm/browser/device/file-save.d.ts +31 -0
  53. package/esm/browser/device/file-save.js +80 -0
  54. package/esm/browser/extension/extension-view.d.ts +9 -0
  55. package/esm/browser/extension/extension-view.js +7 -0
  56. package/esm/browser/extension/icons.js +2 -1
  57. package/esm/browser/extension/web-api-call.d.ts +45 -0
  58. package/esm/browser/extension/web-api-chats.d.ts +29 -0
  59. package/esm/browser/extension/web-api-components.d.ts +4 -0
  60. package/esm/browser/extension/web-api-contributions.d.ts +13 -14
  61. package/esm/browser/extension/web-api-desktop.d.ts +16 -1
  62. package/esm/browser/extension/web-api-desktop.js +1 -0
  63. package/esm/browser/extension/web-extension-api.d.ts +9 -12
  64. package/esm/browser/extension/web-extension-code.d.ts +15 -8
  65. package/esm/browser/extension/web-extension-code.js +25 -27
  66. package/esm/browser/extension/web-extension-context.js +4 -0
  67. package/esm/browser/extension/web-extension-protocol.d.ts +15 -1
  68. package/esm/browser/extension/web-extension-protocol.js +2 -0
  69. package/esm/browser/extension/web-extension-run.d.ts +4 -2
  70. package/esm/browser/extension/web-extension-run.js +10 -4
  71. package/esm/browser/extension/web-extensions-running.d.ts +3 -0
  72. package/esm/browser/extension/web-extensions-running.js +20 -7
  73. package/esm/browser/extension/web-extensions.js +5 -1
  74. package/esm/browser/extension/web-metrics.d.ts +32 -0
  75. package/esm/browser/extension/web-metrics.js +98 -0
  76. package/esm/browser/extension/web-pages.d.ts +2 -0
  77. package/esm/browser/extension/web-pages.js +2 -0
  78. package/esm/browser/i18n/en/account.d.ts +202 -0
  79. package/esm/browser/i18n/en/account.js +205 -0
  80. package/esm/browser/i18n/en/assistant.d.ts +129 -0
  81. package/esm/browser/i18n/en/assistant.js +130 -0
  82. package/esm/browser/i18n/en/call.d.ts +86 -0
  83. package/esm/browser/i18n/en/call.js +87 -0
  84. package/esm/browser/i18n/en/chat.d.ts +213 -0
  85. package/esm/browser/i18n/en/chat.js +214 -0
  86. package/esm/browser/i18n/en/common.d.ts +99 -0
  87. package/esm/browser/i18n/en/common.js +101 -0
  88. package/esm/browser/i18n/en/console.d.ts +230 -0
  89. package/esm/browser/i18n/en/console.js +232 -0
  90. package/esm/browser/i18n/en/discover.d.ts +117 -0
  91. package/esm/browser/i18n/en/discover.js +119 -0
  92. package/esm/browser/i18n/en/service.d.ts +242 -0
  93. package/esm/browser/i18n/en/service.js +245 -0
  94. package/esm/browser/i18n/en/settings.d.ts +213 -0
  95. package/esm/browser/i18n/en/settings.js +214 -0
  96. package/esm/browser/i18n/en/tools.d.ts +85 -0
  97. package/esm/browser/i18n/en/tools.js +87 -0
  98. package/esm/browser/i18n/ja/account.d.ts +2 -0
  99. package/esm/browser/i18n/ja/account.js +202 -0
  100. package/esm/browser/i18n/ja/assistant.d.ts +2 -0
  101. package/esm/browser/i18n/ja/assistant.js +129 -0
  102. package/esm/browser/i18n/ja/call.d.ts +2 -0
  103. package/esm/browser/i18n/ja/call.js +86 -0
  104. package/esm/browser/i18n/ja/chat.d.ts +2 -0
  105. package/esm/browser/i18n/ja/chat.js +213 -0
  106. package/esm/browser/i18n/ja/common.d.ts +2 -0
  107. package/esm/browser/i18n/ja/common.js +99 -0
  108. package/esm/browser/i18n/ja/console.d.ts +2 -0
  109. package/esm/browser/i18n/ja/console.js +230 -0
  110. package/esm/browser/i18n/ja/discover.d.ts +2 -0
  111. package/esm/browser/i18n/ja/discover.js +117 -0
  112. package/esm/browser/i18n/ja/service.d.ts +2 -0
  113. package/esm/browser/i18n/ja/service.js +242 -0
  114. package/esm/browser/i18n/ja/settings.d.ts +2 -0
  115. package/esm/browser/i18n/ja/settings.js +213 -0
  116. package/esm/browser/i18n/ja/tools.d.ts +2 -0
  117. package/esm/browser/i18n/ja/tools.js +85 -0
  118. package/esm/browser/i18n/locales.d.ts +1136 -1136
  119. package/esm/browser/i18n/messages-ja.js +20 -1586
  120. package/esm/browser/i18n/messages-zh-tw.d.ts +0 -1
  121. package/esm/browser/i18n/messages-zh-tw.js +20 -1587
  122. package/esm/browser/i18n/messages.d.ts +1139 -1136
  123. package/esm/browser/i18n/messages.js +44 -3183
  124. package/esm/browser/i18n/zh/account.d.ts +2 -0
  125. package/esm/browser/i18n/zh/account.js +203 -0
  126. package/esm/browser/i18n/zh/assistant.d.ts +2 -0
  127. package/esm/browser/i18n/zh/assistant.js +129 -0
  128. package/esm/browser/i18n/zh/call.d.ts +2 -0
  129. package/esm/browser/i18n/zh/call.js +86 -0
  130. package/esm/browser/i18n/zh/chat.d.ts +2 -0
  131. package/esm/browser/i18n/zh/chat.js +213 -0
  132. package/esm/browser/i18n/zh/common.d.ts +2 -0
  133. package/esm/browser/i18n/zh/common.js +99 -0
  134. package/esm/browser/i18n/zh/console.d.ts +2 -0
  135. package/esm/browser/i18n/zh/console.js +230 -0
  136. package/esm/browser/i18n/zh/discover.d.ts +2 -0
  137. package/esm/browser/i18n/zh/discover.js +117 -0
  138. package/esm/browser/i18n/zh/service.d.ts +2 -0
  139. package/esm/browser/i18n/zh/service.js +242 -0
  140. package/esm/browser/i18n/zh/settings.d.ts +2 -0
  141. package/esm/browser/i18n/zh/settings.js +213 -0
  142. package/esm/browser/i18n/zh/tools.d.ts +2 -0
  143. package/esm/browser/i18n/zh/tools.js +86 -0
  144. package/esm/browser/i18n/zh-tw/account.d.ts +2 -0
  145. package/esm/browser/i18n/zh-tw/account.js +202 -0
  146. package/esm/browser/i18n/zh-tw/assistant.d.ts +2 -0
  147. package/esm/browser/i18n/zh-tw/assistant.js +129 -0
  148. package/esm/browser/i18n/zh-tw/call.d.ts +2 -0
  149. package/esm/browser/i18n/zh-tw/call.js +86 -0
  150. package/esm/browser/i18n/zh-tw/chat.d.ts +2 -0
  151. package/esm/browser/i18n/zh-tw/chat.js +213 -0
  152. package/esm/browser/i18n/zh-tw/common.d.ts +2 -0
  153. package/esm/browser/i18n/zh-tw/common.js +99 -0
  154. package/esm/browser/i18n/zh-tw/console.d.ts +2 -0
  155. package/esm/browser/i18n/zh-tw/console.js +230 -0
  156. package/esm/browser/i18n/zh-tw/discover.d.ts +2 -0
  157. package/esm/browser/i18n/zh-tw/discover.js +117 -0
  158. package/esm/browser/i18n/zh-tw/service.d.ts +2 -0
  159. package/esm/browser/i18n/zh-tw/service.js +242 -0
  160. package/esm/browser/i18n/zh-tw/settings.d.ts +2 -0
  161. package/esm/browser/i18n/zh-tw/settings.js +213 -0
  162. package/esm/browser/i18n/zh-tw/tools.d.ts +2 -0
  163. package/esm/browser/i18n/zh-tw/tools.js +85 -0
  164. package/esm/browser/offline/device-values.d.ts +4 -0
  165. package/esm/browser/offline/device-values.js +10 -0
  166. package/esm/browser/pwa/page-build.d.ts +15 -0
  167. package/esm/browser/pwa/page-build.js +45 -0
  168. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  169. package/esm/browser/settings/settings-protocol.js +2 -0
  170. package/esm/browser/style/base.d.ts +1 -1
  171. package/esm/browser/style/base.js +3 -0
  172. package/esm/browser/style/chat-list.d.ts +1 -1
  173. package/esm/browser/style/chat-list.js +6 -0
  174. package/esm/browser/style/conversation-column.d.ts +1 -1
  175. package/esm/browser/style/conversation-column.js +17 -0
  176. package/esm/browser/style/conversation.d.ts +1 -1
  177. package/esm/browser/style/conversation.js +5 -0
  178. package/esm/browser/style/pages.d.ts +1 -1
  179. package/esm/browser/style/pages.js +0 -7
  180. package/esm/browser/style/video-call.d.ts +1 -1
  181. package/esm/browser/style/video-call.js +15 -4
  182. package/esm/browser/util/call-transcript.d.ts +16 -0
  183. package/esm/browser/util/call-transcript.js +110 -0
  184. package/esm/browser/util/process.d.ts +6 -0
  185. package/esm/browser/util/process.js +18 -5
  186. package/esm/browser/video-call/call-people.d.ts +21 -0
  187. package/esm/browser/video-call/call-people.js +29 -0
  188. package/esm/browser/video-call/clip-plan.d.ts +11 -2
  189. package/esm/browser/video-call/clip-plan.js +19 -3
  190. package/esm/browser/video-call/face-camera.d.ts +93 -0
  191. package/esm/browser/video-call/face-camera.js +192 -0
  192. package/esm/browser/video-call/face-files.d.ts +43 -5
  193. package/esm/browser/video-call/face-files.js +73 -18
  194. package/esm/browser/video-call/face-moves.d.ts +68 -0
  195. package/esm/browser/video-call/face-moves.js +180 -0
  196. package/esm/browser/video-call/face-stage.d.ts +139 -0
  197. package/esm/browser/video-call/face-stage.js +219 -0
  198. package/esm/browser/video-call/mouth-layer.d.ts +81 -0
  199. package/esm/browser/video-call/mouth-layer.js +241 -0
  200. package/esm/browser/video-call/video-call-view.js +44 -4
  201. package/esm/browser/video-call/video-face.d.ts +11 -5
  202. package/esm/browser/video-call/video-face.js +302 -328
  203. package/esm/browser/workbench.d.ts +8 -0
  204. package/esm/browser/workbench.js +37 -1
  205. package/lib/browser/assistant/assistant-thread.js +15 -2
  206. package/lib/browser/assistant/call-scenes.d.ts +5 -4
  207. package/lib/browser/assistant/call-scenes.js +10 -7
  208. package/lib/browser/chat/chat-protocol.d.ts +2 -0
  209. package/lib/browser/chat/chat-shown.d.ts +3 -1
  210. package/lib/browser/chat/chat-shown.js +25 -3
  211. package/lib/browser/chat/chat-view.js +1 -1
  212. package/lib/browser/chat/chat.d.ts +5 -1
  213. package/lib/browser/chat/chat.js +32 -16
  214. package/lib/browser/components/account-menu.d.ts +6 -16
  215. package/lib/browser/components/account-menu.js +45 -99
  216. package/lib/browser/components/app-contexts.js +6 -3
  217. package/lib/browser/components/app-nav.js +4 -4
  218. package/lib/browser/components/chat-list-row.js +7 -2
  219. package/lib/browser/components/chat-tag.d.ts +21 -0
  220. package/lib/browser/components/chat-tag.js +142 -0
  221. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  222. package/lib/browser/components/composer-box-protocol.d.ts +2 -0
  223. package/lib/browser/components/composer-box.js +20 -1
  224. package/lib/browser/components/composer-emoji.d.ts +23 -0
  225. package/lib/browser/components/composer-emoji.js +87 -0
  226. package/lib/browser/components/custom-host.js +1 -1
  227. package/lib/browser/components/discover-view.d.ts +4 -3
  228. package/lib/browser/components/discover-view.js +5 -4
  229. package/lib/browser/components/editor-area.js +1 -1
  230. package/lib/browser/components/emoji-panel.d.ts +23 -0
  231. package/lib/browser/components/emoji-panel.js +90 -0
  232. package/lib/browser/components/host-view.d.ts +1 -1
  233. package/lib/browser/components/launcher-surface.js +1 -1
  234. package/lib/browser/components/markdown.d.ts +6 -1
  235. package/lib/browser/components/markdown.js +6 -2
  236. package/lib/browser/components/me-rows.d.ts +25 -0
  237. package/lib/browser/components/me-rows.js +22 -0
  238. package/lib/browser/components/me-view.d.ts +2 -1
  239. package/lib/browser/components/me-view.js +3 -2
  240. package/lib/browser/components/message-list.js +46 -6
  241. package/lib/browser/components/message-steps.js +13 -0
  242. package/lib/browser/components/nav-places.js +1 -1
  243. package/lib/browser/components/session-view.js +6 -1
  244. package/lib/browser/components/settings-choices.js +3 -0
  245. package/lib/browser/components/settings-controls.d.ts +13 -0
  246. package/lib/browser/components/settings-controls.js +19 -0
  247. package/lib/browser/components/settings-more.d.ts +1 -1
  248. package/lib/browser/components/settings-more.js +27 -38
  249. package/lib/browser/components/settings-parts.d.ts +4 -2
  250. package/lib/browser/components/settings-parts.js +13 -8
  251. package/lib/browser/components/settings-view.js +2 -6
  252. package/lib/browser/components/web-composer.d.ts +1 -1
  253. package/lib/browser/components/web-composer.js +2 -2
  254. package/lib/browser/device/file-save.d.ts +32 -0
  255. package/lib/browser/device/file-save.js +83 -0
  256. package/lib/browser/extension/extension-view.d.ts +9 -0
  257. package/lib/browser/extension/extension-view.js +8 -1
  258. package/lib/browser/extension/icons.js +1 -0
  259. package/lib/browser/extension/web-api-call.d.ts +45 -0
  260. package/lib/browser/extension/web-api-chats.d.ts +29 -0
  261. package/lib/browser/extension/web-api-components.d.ts +4 -0
  262. package/lib/browser/extension/web-api-contributions.d.ts +13 -14
  263. package/lib/browser/extension/web-api-desktop.d.ts +16 -1
  264. package/lib/browser/extension/web-api-desktop.js +1 -0
  265. package/lib/browser/extension/web-extension-api.d.ts +9 -12
  266. package/lib/browser/extension/web-extension-code.d.ts +15 -8
  267. package/lib/browser/extension/web-extension-code.js +25 -27
  268. package/lib/browser/extension/web-extension-context.js +4 -0
  269. package/lib/browser/extension/web-extension-protocol.d.ts +15 -1
  270. package/lib/browser/extension/web-extension-protocol.js +2 -0
  271. package/lib/browser/extension/web-extension-run.d.ts +4 -2
  272. package/lib/browser/extension/web-extension-run.js +10 -4
  273. package/lib/browser/extension/web-extensions-running.d.ts +3 -0
  274. package/lib/browser/extension/web-extensions-running.js +20 -7
  275. package/lib/browser/extension/web-extensions.js +5 -1
  276. package/lib/browser/extension/web-metrics.d.ts +33 -0
  277. package/lib/browser/extension/web-metrics.js +102 -0
  278. package/lib/browser/extension/web-pages.d.ts +2 -0
  279. package/lib/browser/extension/web-pages.js +2 -0
  280. package/lib/browser/i18n/en/account.d.ts +203 -0
  281. package/lib/browser/i18n/en/account.js +208 -0
  282. package/lib/browser/i18n/en/assistant.d.ts +130 -0
  283. package/lib/browser/i18n/en/assistant.js +133 -0
  284. package/lib/browser/i18n/en/call.d.ts +87 -0
  285. package/lib/browser/i18n/en/call.js +90 -0
  286. package/lib/browser/i18n/en/chat.d.ts +214 -0
  287. package/lib/browser/i18n/en/chat.js +217 -0
  288. package/lib/browser/i18n/en/common.d.ts +100 -0
  289. package/lib/browser/i18n/en/common.js +104 -0
  290. package/lib/browser/i18n/en/console.d.ts +231 -0
  291. package/lib/browser/i18n/en/console.js +235 -0
  292. package/lib/browser/i18n/en/discover.d.ts +118 -0
  293. package/lib/browser/i18n/en/discover.js +122 -0
  294. package/lib/browser/i18n/en/service.d.ts +243 -0
  295. package/lib/browser/i18n/en/service.js +248 -0
  296. package/lib/browser/i18n/en/settings.d.ts +214 -0
  297. package/lib/browser/i18n/en/settings.js +217 -0
  298. package/lib/browser/i18n/en/tools.d.ts +86 -0
  299. package/lib/browser/i18n/en/tools.js +90 -0
  300. package/lib/browser/i18n/ja/account.d.ts +3 -0
  301. package/lib/browser/i18n/ja/account.js +205 -0
  302. package/lib/browser/i18n/ja/assistant.d.ts +3 -0
  303. package/lib/browser/i18n/ja/assistant.js +132 -0
  304. package/lib/browser/i18n/ja/call.d.ts +3 -0
  305. package/lib/browser/i18n/ja/call.js +89 -0
  306. package/lib/browser/i18n/ja/chat.d.ts +3 -0
  307. package/lib/browser/i18n/ja/chat.js +216 -0
  308. package/lib/browser/i18n/ja/common.d.ts +3 -0
  309. package/lib/browser/i18n/ja/common.js +102 -0
  310. package/lib/browser/i18n/ja/console.d.ts +3 -0
  311. package/lib/browser/i18n/ja/console.js +233 -0
  312. package/lib/browser/i18n/ja/discover.d.ts +3 -0
  313. package/lib/browser/i18n/ja/discover.js +120 -0
  314. package/lib/browser/i18n/ja/service.d.ts +3 -0
  315. package/lib/browser/i18n/ja/service.js +245 -0
  316. package/lib/browser/i18n/ja/settings.d.ts +3 -0
  317. package/lib/browser/i18n/ja/settings.js +216 -0
  318. package/lib/browser/i18n/ja/tools.d.ts +3 -0
  319. package/lib/browser/i18n/ja/tools.js +88 -0
  320. package/lib/browser/i18n/locales.d.ts +1136 -1136
  321. package/lib/browser/i18n/messages-ja.js +20 -1586
  322. package/lib/browser/i18n/messages-zh-tw.d.ts +0 -1
  323. package/lib/browser/i18n/messages-zh-tw.js +20 -1587
  324. package/lib/browser/i18n/messages.d.ts +1139 -1136
  325. package/lib/browser/i18n/messages.js +44 -3183
  326. package/lib/browser/i18n/zh/account.d.ts +3 -0
  327. package/lib/browser/i18n/zh/account.js +206 -0
  328. package/lib/browser/i18n/zh/assistant.d.ts +3 -0
  329. package/lib/browser/i18n/zh/assistant.js +132 -0
  330. package/lib/browser/i18n/zh/call.d.ts +3 -0
  331. package/lib/browser/i18n/zh/call.js +89 -0
  332. package/lib/browser/i18n/zh/chat.d.ts +3 -0
  333. package/lib/browser/i18n/zh/chat.js +216 -0
  334. package/lib/browser/i18n/zh/common.d.ts +3 -0
  335. package/lib/browser/i18n/zh/common.js +102 -0
  336. package/lib/browser/i18n/zh/console.d.ts +3 -0
  337. package/lib/browser/i18n/zh/console.js +233 -0
  338. package/lib/browser/i18n/zh/discover.d.ts +3 -0
  339. package/lib/browser/i18n/zh/discover.js +120 -0
  340. package/lib/browser/i18n/zh/service.d.ts +3 -0
  341. package/lib/browser/i18n/zh/service.js +245 -0
  342. package/lib/browser/i18n/zh/settings.d.ts +3 -0
  343. package/lib/browser/i18n/zh/settings.js +216 -0
  344. package/lib/browser/i18n/zh/tools.d.ts +3 -0
  345. package/lib/browser/i18n/zh/tools.js +89 -0
  346. package/lib/browser/i18n/zh-tw/account.d.ts +3 -0
  347. package/lib/browser/i18n/zh-tw/account.js +205 -0
  348. package/lib/browser/i18n/zh-tw/assistant.d.ts +3 -0
  349. package/lib/browser/i18n/zh-tw/assistant.js +132 -0
  350. package/lib/browser/i18n/zh-tw/call.d.ts +3 -0
  351. package/lib/browser/i18n/zh-tw/call.js +89 -0
  352. package/lib/browser/i18n/zh-tw/chat.d.ts +3 -0
  353. package/lib/browser/i18n/zh-tw/chat.js +216 -0
  354. package/lib/browser/i18n/zh-tw/common.d.ts +3 -0
  355. package/lib/browser/i18n/zh-tw/common.js +102 -0
  356. package/lib/browser/i18n/zh-tw/console.d.ts +3 -0
  357. package/lib/browser/i18n/zh-tw/console.js +233 -0
  358. package/lib/browser/i18n/zh-tw/discover.d.ts +3 -0
  359. package/lib/browser/i18n/zh-tw/discover.js +120 -0
  360. package/lib/browser/i18n/zh-tw/service.d.ts +3 -0
  361. package/lib/browser/i18n/zh-tw/service.js +245 -0
  362. package/lib/browser/i18n/zh-tw/settings.d.ts +3 -0
  363. package/lib/browser/i18n/zh-tw/settings.js +216 -0
  364. package/lib/browser/i18n/zh-tw/tools.d.ts +3 -0
  365. package/lib/browser/i18n/zh-tw/tools.js +88 -0
  366. package/lib/browser/offline/device-values.d.ts +4 -0
  367. package/lib/browser/offline/device-values.js +10 -0
  368. package/lib/browser/pwa/page-build.d.ts +16 -0
  369. package/lib/browser/pwa/page-build.js +48 -0
  370. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  371. package/lib/browser/settings/settings-protocol.js +2 -0
  372. package/lib/browser/style/base.d.ts +1 -1
  373. package/lib/browser/style/base.js +3 -0
  374. package/lib/browser/style/chat-list.d.ts +1 -1
  375. package/lib/browser/style/chat-list.js +6 -0
  376. package/lib/browser/style/conversation-column.d.ts +1 -1
  377. package/lib/browser/style/conversation-column.js +17 -0
  378. package/lib/browser/style/conversation.d.ts +1 -1
  379. package/lib/browser/style/conversation.js +5 -0
  380. package/lib/browser/style/pages.d.ts +1 -1
  381. package/lib/browser/style/pages.js +0 -7
  382. package/lib/browser/style/video-call.d.ts +1 -1
  383. package/lib/browser/style/video-call.js +15 -4
  384. package/lib/browser/util/call-transcript.d.ts +17 -0
  385. package/lib/browser/util/call-transcript.js +113 -0
  386. package/lib/browser/util/process.d.ts +6 -0
  387. package/lib/browser/util/process.js +17 -4
  388. package/lib/browser/video-call/call-people.d.ts +22 -0
  389. package/lib/browser/video-call/call-people.js +32 -0
  390. package/lib/browser/video-call/clip-plan.d.ts +11 -2
  391. package/lib/browser/video-call/clip-plan.js +19 -3
  392. package/lib/browser/video-call/face-camera.d.ts +94 -0
  393. package/lib/browser/video-call/face-camera.js +197 -0
  394. package/lib/browser/video-call/face-files.d.ts +43 -5
  395. package/lib/browser/video-call/face-files.js +73 -18
  396. package/lib/browser/video-call/face-moves.d.ts +69 -0
  397. package/lib/browser/video-call/face-moves.js +184 -0
  398. package/lib/browser/video-call/face-stage.d.ts +140 -0
  399. package/lib/browser/video-call/face-stage.js +223 -0
  400. package/lib/browser/video-call/mouth-layer.d.ts +82 -0
  401. package/lib/browser/video-call/mouth-layer.js +245 -0
  402. package/lib/browser/video-call/video-call-view.js +44 -4
  403. package/lib/browser/video-call/video-face.d.ts +11 -5
  404. package/lib/browser/video-call/video-face.js +302 -328
  405. package/lib/browser/workbench.d.ts +8 -0
  406. package/lib/browser/workbench.js +36 -0
  407. package/package.json +7 -7
  408. package/public/faces/README.md +17 -4
  409. package/public/faces/blonde/clap.mp4 +0 -0
  410. package/public/faces/blonde/dance.mp4 +0 -0
  411. package/public/faces/blonde/face.jpg +0 -0
  412. package/public/faces/blonde/happy.mp4 +0 -0
  413. package/public/faces/blonde/heart.mp4 +0 -0
  414. package/public/faces/blonde/idle-1.mp4 +0 -0
  415. package/public/faces/blonde/idle-2.mp4 +0 -0
  416. package/public/faces/blonde/idle-3.mp4 +0 -0
  417. package/public/faces/blonde/laugh.mp4 +0 -0
  418. package/public/faces/blonde/listening.mp4 +0 -0
  419. package/public/faces/blonde/poster.jpg +0 -0
  420. package/public/faces/blonde/shy.mp4 +0 -0
  421. package/public/faces/blonde/sorry.mp4 +0 -0
  422. package/public/faces/blonde/stretch.mp4 +0 -0
  423. package/public/faces/blonde/surprised.mp4 +0 -0
  424. package/public/faces/blonde/talk-1.mp4 +0 -0
  425. package/public/faces/blonde/talk-2.mp4 +0 -0
  426. package/public/faces/blonde/think-2.mp4 +0 -0
  427. package/public/faces/blonde/thinking.mp4 +0 -0
  428. package/public/faces/blonde/wave.mp4 +0 -0
  429. package/public/faces/dance.mp4 +0 -0
  430. package/public/faces/face.jpg +0 -0
  431. package/public/faces/framing.json +1 -0
  432. package/public/faces/lips.json +1 -1
  433. package/public/faces/stretch.mp4 +0 -0
  434. package/esm/browser/video-call/face-clips.d.ts +0 -33
  435. package/esm/browser/video-call/face-clips.js +0 -93
  436. package/lib/browser/video-call/face-clips.d.ts +0 -34
  437. package/lib/browser/video-call/face-clips.js +0 -96
@@ -35,38 +35,47 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.VideoFace = VideoFace;
37
37
  const React = __importStar(require("react"));
38
+ const call_scenes_1 = require("../assistant/call-scenes");
38
39
  const hooks_1 = require("../hooks");
40
+ const turn_end_1 = require("../util/turn-end");
41
+ const call_people_1 = require("./call-people");
39
42
  const clip_plan_1 = require("./clip-plan");
40
- const face_clips_1 = require("./face-clips");
43
+ const face_camera_1 = require("./face-camera");
41
44
  const face_files_1 = require("./face-files");
42
- /** How often the face looks at the call (its phase), in ms. */
43
- const TICK_MS = 80;
44
- /** How fast she goes back to the sofa from a dance or a stretch, as the call goes on. */
45
- const HURRY_RATE = 2.5;
46
- /** How much longer a reading may wait while the mouth starts, at most, in ms. */
47
- const STARTING_MS = 6000;
45
+ const face_moves_1 = require("./face-moves");
46
+ const face_stage_1 = require("./face-stage");
47
+ const mouth_layer_1 = require("./mouth-layer");
48
+ /** How long a move she said she would make (a dance) may wait for her to listen, in ms: then it is let go. */
49
+ const COMING_MS = 20000;
50
+ /** How fast she goes back to rest from a move (a heart, a dance), as the call goes on: faster than this looked hurried. */
51
+ const HURRY_RATE = 1.5;
48
52
  /** How long the sound may not go on before the clip holds still too, in ms (the clock of sound moves in steps). */
49
53
  const STILL_MS = 120;
50
54
  /** The frames of a clip when faces/lips.json does not say (5 s and a sixth at 24 fps). */
51
55
  const FRAMES = 124;
52
- /** How many frames the clip shown may be from the one a mouth was drawn for, laid over it moved with the face. */
53
- const NEAR_FRAMES = 3;
56
+ /** How long before a clip ends the next is chosen and loaded behind it, in seconds. */
57
+ const AHEAD_S = 1;
54
58
  /**
55
- * The person of a video call: two layers of video, the one in front playing, the other taking over with a short fade
56
- * when the clip changes. As Ta reads with a voice service, the clip is the one its ClipPlan has for that moment of the
57
- * sound, and the mouth an extension draws for that moment is laid over it (MouthLayer); otherwise clips play by the
58
- * state of the call.
59
+ * The person of a video call (docs/design/ta-call.md 12, 15, 16): two layers of video (FaceStage), the next clip decoded
60
+ * behind and fading in over the one shown once its first frame is on the screen. What plays is decided in one place,
61
+ * each frame: as Ta reads with a voice service, the clip its ClipPlan has for that moment of the sound, the mouth an
62
+ * extension draws for it laid over it (MouthLayer); otherwise the clips of the state of the call, and the moves of
63
+ * what she says (FaceMoves, the user's own first). Each layer shows the part of its clip its camera aims at
64
+ * (FaceCameras): her face close as she sits, all of her as she stands up and moves.
59
65
  */
60
- function VideoFace({ call, onReady, onFailed }) {
66
+ function VideoFace({ call, person = '', clear = 0, onReady, onFailed, }) {
61
67
  var _a;
62
68
  var _b;
63
69
  const layers = [React.useRef(null), React.useRef(null)];
64
70
  const box = React.useRef(null);
65
71
  const canvas = React.useRef(null);
66
- const [front, setFront] = React.useState(0);
67
- const [{ callMouth }] = (0, hooks_1.useWebExtensions)();
72
+ const [{ callMouth, callMoves }] = (0, hooks_1.useWebExtensions)();
68
73
  const mouth = React.useRef(callMouth);
69
74
  mouth.current = callMouth;
75
+ const sources = React.useRef(callMoves);
76
+ sources.current = callMoves;
77
+ const clearing = React.useRef(clear);
78
+ clearing.current = clear;
70
79
  // biome-ignore lint/correctness/useExhaustiveDependencies: the layers are refs, set up once a call
71
80
  React.useEffect(() => {
72
81
  var _a;
@@ -78,89 +87,165 @@ function VideoFace({ call, onReady, onFailed }) {
78
87
  return;
79
88
  }
80
89
  let gone = false;
81
- let shown = 0;
82
- let kind;
83
90
  let ready = false;
84
- const faces = face_files_1.FaceFiles.of(doc);
91
+ let started = false;
92
+ const faces = face_files_1.FaceFiles.of(doc, call_people_1.CallPeople.dir(person));
93
+ const book = new face_moves_1.FaceMoves();
94
+ const stage = new face_stage_1.FaceStage(videos, clip => faces.clip(clip), () => view.performance.now(), {
95
+ shown: () => {
96
+ if (!ready) {
97
+ ready = true;
98
+ onReady();
99
+ }
100
+ },
101
+ failed: (clip, error) => { var _a; return fail(clip, String((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error)); },
102
+ });
103
+ const playing = () => {
104
+ const { video, clip } = stage.playing();
105
+ return { video: video, clip };
106
+ };
107
+ const cameras = new face_camera_1.FaceCameras(faces, videos, box.current, () => clearing.current);
85
108
  const frames = (clip) => { var _a; return (_a = faces.frames(clip)) !== null && _a !== void 0 ? _a : FRAMES; };
86
- // The clip each layer plays, by name, and the one the layer behind is loading to come in front.
87
- const names = [undefined, undefined];
88
- let loading;
109
+ // The state whose clips play, or the move that plays, and the clip asked for last.
110
+ let loop;
111
+ let move;
89
112
  let last;
90
- // The sentence whose look played (moodFor), and whether that clip is over: once a sentence.
91
- let moodFor;
92
- let moodDone = false;
93
- // What she said she would do (FaceClips.show), and the sentence that said it: it plays once she listens.
113
+ // Whether the clip of the move is over.
114
+ let moveDone = false;
115
+ // The sentences of this answer whose move played, by the plan of a reading or by what she says: each plays once,
116
+ // though the sentence is still the one heard as the reading ends. Forgotten as Ta thinks of the next answer.
117
+ const moved = new Set();
118
+ // What she said she would do (FaceMoves.after), and the sentence that said it: it plays once she listens.
94
119
  let coming;
95
120
  let comingFor;
121
+ let comingAt = 0;
122
+ // The reading whose plan shows the move playing, and whether she listened since it began (wentOn).
123
+ let plannedSay;
124
+ let settled = false;
125
+ /** A move plays, not over yet: it plays to its end, unless the call goes on (hurrying). */
126
+ const moving = () => !!move && !moveDone;
127
+ /**
128
+ * The user says something: words, not a sound alone ("嗯") nor a word of the echo of her voice, which the
129
+ * service hears now and then and never makes a turn of.
130
+ */
131
+ const userSpoke = () => {
132
+ const heard = call.state.heard;
133
+ return turn_end_1.TurnEnd.words(heard) >= 2 && !turn_end_1.TurnEnd.sounds(heard);
134
+ };
135
+ /**
136
+ * The call went on since the move began: the user speaks, or Ta speaks again after she listened. Not Ta thinking
137
+ * of news of the work, which it often answers with nothing.
138
+ */
139
+ const wentOn = () => {
140
+ if (userSpoke()) {
141
+ return true;
142
+ }
143
+ if (call.state.phase === 'speaking') {
144
+ return settled;
145
+ }
146
+ settled = true;
147
+ return false;
148
+ };
149
+ // The next clip of a state, chosen as the clip shown nears its end and loaded behind it.
150
+ let upcoming;
96
151
  const words = () => {
97
152
  const reading = call.state.reading;
98
153
  return reading === null || reading === void 0 ? void 0 : reading.pieces[reading.at];
99
154
  };
155
+ /** A reading of a voice service waits to begin (its hold): what plays goes on until its sound does. */
156
+ const holding = () => {
157
+ const reading = call.sounds.nowReading();
158
+ return !!reading && !call.state.paused && call.state.phase === 'speaking' && reading.now() < 0;
159
+ };
160
+ /** What should play now; undefined to go on with what plays. */
100
161
  const wanted = () => {
101
- const { phase, paused } = call.state;
102
- const plain = face_clips_1.FaceClips.kind(phase, !!paused);
162
+ const plain = face_moves_1.FaceMoves.kind(call.state.phase, !!call.state.paused);
103
163
  if (plain === 'listening') {
104
164
  // What she said she would do, once she said it; then it plays to its end, unless Ta thinks or speaks.
105
165
  if (coming) {
106
166
  return coming;
107
167
  }
108
- return face_clips_1.FaceClips.isShow(kind) && !moodDone ? kind : plain;
168
+ return moving() ? move : plain;
109
169
  }
110
170
  if (plain !== 'speaking') {
111
171
  return plain;
112
172
  }
173
+ if (holding()) {
174
+ return undefined;
175
+ }
176
+ if (moving() && (move === null || move === void 0 ? void 0 : move.when) === 'say') {
177
+ return move;
178
+ }
179
+ // The move a sentence asks for, else its look, as she says it (FaceMoves.said).
113
180
  const said = words();
114
- const mood = face_clips_1.FaceClips.mood(said);
115
- return mood && (moodFor !== said || (kind === mood && !moodDone)) ? mood : 'speaking';
181
+ const look = book.said(said);
182
+ return look && said !== undefined && !moved.has(said) ? look : 'speaking';
183
+ };
184
+ /** How long `clip` from `at` fades in over what shows: short at a seam, longer the farther her pose. */
185
+ const blend = (clip, at) => {
186
+ var _a, _b;
187
+ const { video, clip: from } = playing();
188
+ if (!from || !ready) {
189
+ return face_stage_1.SEAM_MS;
190
+ }
191
+ const frame = Math.round(video.currentTime * clip_plan_1.CLIP_FPS);
192
+ const to = Math.round(at * clip_plan_1.CLIP_FPS);
193
+ const seam = face_stage_1.FaceBlend.seated(frame, frames(from)) && face_stage_1.FaceBlend.seated(to, frames(clip));
194
+ return face_stage_1.FaceBlend.ms((_a = faces.boxes(from)) === null || _a === void 0 ? void 0 : _a[Math.min(frame, frames(from) - 1)], (_b = faces.boxes(clip)) === null || _b === void 0 ? void 0 : _b[to], seam);
116
195
  };
117
- /** Plays `clip` in the layer behind from `at` seconds, which comes in front once it plays. */
118
196
  const show = (clip, at = 0) => {
119
- const back = 1 - shown;
120
- const video = videos[back];
121
197
  last = clip;
122
- names[back] = clip;
123
- loading = clip;
124
- video.dataset.clip = clip;
125
- const src = faces.clip(clip);
126
- if (video.src !== src) {
127
- video.src = src;
128
- }
129
- video.currentTime = at;
130
- video.playbackRate = 1;
131
- void video.play().then(() => {
132
- if (names[back] !== clip || gone) {
133
- return;
134
- }
135
- loading = undefined;
136
- shown = back;
137
- setFront(back);
138
- videos[1 - back].pause();
139
- if (!ready) {
140
- ready = true;
141
- onReady();
142
- }
143
- }, () => {
144
- // Another clip took the layer meanwhile (its load stopped this one): not a failure.
145
- if (names[back] !== clip || gone) {
146
- return;
147
- }
148
- loading = undefined;
149
- if (!ready) {
150
- onFailed();
151
- }
152
- });
198
+ stage.show(clip, at, blend(clip, at));
153
199
  };
154
200
  const play = (next) => {
155
- if (next !== kind && (face_clips_1.FaceClips.isMood(next) || face_clips_1.FaceClips.isShow(next))) {
156
- moodFor = words();
157
- moodDone = false;
201
+ var _a;
202
+ if (typeof next === 'string') {
203
+ plannedSay = undefined;
204
+ move = undefined;
205
+ loop = next;
206
+ // Never the clip asked for last: asked again, the stage keeps it as it is, and one that ended stays still.
207
+ const clip = (upcoming === null || upcoming === void 0 ? void 0 : upcoming.loop) === next && upcoming.clip !== stage.wanted ? upcoming.clip : book.loop(next, (_a = stage.wanted) !== null && _a !== void 0 ? _a : last);
208
+ upcoming = undefined;
209
+ show(clip);
210
+ return;
211
+ }
212
+ if (next !== move) {
213
+ const said = words();
214
+ if (said !== undefined) {
215
+ moved.add(said);
216
+ }
217
+ moveDone = false;
218
+ settled = false;
158
219
  }
220
+ plannedSay = undefined;
159
221
  if (next === coming) {
160
222
  coming = undefined;
161
223
  }
162
- kind = next;
163
- show(face_clips_1.FaceClips.next(next, last));
224
+ move = next;
225
+ loop = undefined;
226
+ upcoming = undefined;
227
+ show(next.clip);
228
+ };
229
+ /** A clip could not play: one of the user's gives way to Ta's own, and the extension that gave it is told why. */
230
+ const fail = (clip, reason) => {
231
+ var _a;
232
+ var _b;
233
+ if (!book.fail(clip, reason)) {
234
+ if (!ready) {
235
+ onFailed();
236
+ }
237
+ return false;
238
+ }
239
+ const name = clip.slice(clip.indexOf(':') + 1);
240
+ for (const source of sources.current) {
241
+ (_a = source.failed) === null || _a === void 0 ? void 0 : _a.call(source, name, reason);
242
+ }
243
+ call_scenes_1.CallScenes.show(call, { moves: book.told() });
244
+ move = undefined;
245
+ loop = undefined;
246
+ upcoming = undefined;
247
+ play((_b = wanted()) !== null && _b !== void 0 ? _b : face_moves_1.FaceMoves.kind(call.state.phase, !!call.state.paused));
248
+ return true;
164
249
  };
165
250
  // The plans of the readings, by their say: which clip shows at each moment of their sound.
166
251
  const plans = new Map();
@@ -168,10 +253,11 @@ function VideoFace({ call, onReady, onFailed }) {
168
253
  let plan = plans.get(say);
169
254
  if (!plan) {
170
255
  const used = new Set();
171
- plan = new clip_plan_1.ClipPlan(frames, (seconds, before) => {
256
+ const of = () => {
172
257
  const reading = call.sounds.nowReading();
173
- return face_clips_1.FaceClips.at((reading === null || reading === void 0 ? void 0 : reading.say) === say ? reading : undefined, seconds, before !== null && before !== void 0 ? before : last, used);
174
- });
258
+ return (reading === null || reading === void 0 ? void 0 : reading.say) === say ? reading : undefined;
259
+ };
260
+ plan = new clip_plan_1.ClipPlan(frames, (seconds, before) => book.at(of(), seconds, before !== null && before !== void 0 ? before : last, used), seconds => book.cue(of(), seconds, used), clip => !!book.of(clip));
175
261
  plans.set(say, plan);
176
262
  for (const old of plans.keys()) {
177
263
  if (old < say - 1) {
@@ -187,76 +273,154 @@ function VideoFace({ call, onReady, onFailed }) {
187
273
  return reading && !call.state.paused && call.state.phase === 'speaking' && reading.now() >= 0 ? reading : undefined;
188
274
  };
189
275
  const ended = (event) => {
190
- if (event.target !== videos[shown]) {
276
+ var _a, _b;
277
+ if (event.target !== playing().video) {
191
278
  return;
192
279
  }
193
- if (face_clips_1.FaceClips.isMood(kind) || face_clips_1.FaceClips.isShow(kind)) {
194
- moodDone = true;
280
+ if (move) {
281
+ moveDone = true;
195
282
  }
196
283
  if (!driving()) {
197
- play(wanted());
284
+ play((_b = (_a = wanted()) !== null && _a !== void 0 ? _a : loop) !== null && _b !== void 0 ? _b : 'listening');
198
285
  }
199
286
  };
200
287
  /**
201
- * She stood up to dance or stretch and the call goes on (the user speaks, Ta thinks or answers): she hurries
202
- * back to the sofa, its end, rather than the clip cutting away; true while she does.
288
+ * A move plays on its own, past the sentence that named it (a heart takes its time, a dance is 10 s), true while
289
+ * it does: to its end, which is her at rest again. When the call goes on (the user speaks, Ta speaks again) she
290
+ * hurries there rather than the clip cutting away: from a dance or a stretch she first goes to where she sits
291
+ * down again (ClipFraming.back, faded into as any change of clip), then fast. While the plan of the reading that
292
+ * named it shows it, the plan keeps it on the clock of the sound instead.
203
293
  */
204
294
  const hurrying = () => {
205
- const video = videos[shown];
206
- if (!face_clips_1.FaceClips.isShow(kind) || moodDone || names[shown] !== kind || video.ended) {
295
+ var _a, _b;
296
+ const { video, clip } = playing();
297
+ if (!moving() || !move || clip !== move.clip || video.ended) {
298
+ return false;
299
+ }
300
+ if (plannedSay !== undefined && ((_a = driving()) === null || _a === void 0 ? void 0 : _a.say) === plannedSay) {
207
301
  return false;
208
302
  }
209
- if (call.state.phase !== 'listening' || call.state.heard.trim()) {
210
- video.playbackRate = HURRY_RATE;
303
+ if (call.state.paused !== video.paused) {
304
+ void (call.state.paused ? video.pause() : video.play().catch(() => undefined));
305
+ }
306
+ if (!wentOn()) {
307
+ video.playbackRate = 1;
308
+ return true;
211
309
  }
310
+ const back = move.when === 'after' ? (_b = faces.framing(move.clip)) === null || _b === void 0 ? void 0 : _b.back : undefined;
311
+ if (back !== undefined && video.currentTime < back) {
312
+ if (stage.wanted === move.clip && !stage.jumping(back)) {
313
+ stage.show(move.clip, back, blend(move.clip, back), true);
314
+ }
315
+ return true;
316
+ }
317
+ video.playbackRate = HURRY_RATE;
212
318
  return true;
213
319
  };
214
- const failed = () => !ready && onFailed();
215
- for (const video of videos) {
216
- video.addEventListener('ended', ended);
217
- video.addEventListener('error', failed);
218
- }
219
- // The clips as they are now, not as a cache kept them from a Ta before (faces/README.md); then the face moves.
220
- void faces.ready.then(() => !gone && play(wanted()));
221
- const timer = setInterval(() => {
320
+ /** What plays, by the state of the call and what she says: asked each frame, so that one place decides. */
321
+ const decide = () => {
322
+ var _a, _b;
323
+ if (call.state.phase === 'thinking') {
324
+ moved.clear();
325
+ }
222
326
  const said = call.state.phase === 'speaking' ? words() : undefined;
223
- const then = face_clips_1.FaceClips.show(said);
327
+ const then = book.after(said);
224
328
  if (then && said !== comingFor) {
225
329
  comingFor = said;
226
330
  coming = then;
331
+ comingAt = Date.now();
332
+ }
333
+ // The user spoke before she stood up, or it waited too long: what she said she would do is let go.
334
+ if (coming && (userSpoke() || Date.now() - comingAt > COMING_MS)) {
335
+ coming = undefined;
227
336
  }
228
- if (!faces.loaded || hurrying() || driving()) {
337
+ if (!started || hurrying() || driving()) {
229
338
  return;
230
339
  }
231
340
  const next = wanted();
232
- if (next !== kind) {
341
+ if (next !== undefined && next !== (move !== null && move !== void 0 ? move : loop)) {
233
342
  play(next);
234
343
  }
344
+ const { video, clip } = playing();
345
+ // What plays ended and nothing comes after it (an end missed): the next clip, rather than a picture held still.
346
+ if (clip && video.ended && stage.wanted === clip && !stage.busy()) {
347
+ if (move) {
348
+ moveDone = true;
349
+ }
350
+ play((_b = (_a = wanted()) !== null && _a !== void 0 ? _a : loop) !== null && _b !== void 0 ? _b : 'listening');
351
+ return;
352
+ }
353
+ // The clip after this one, chosen and decoded behind it as it nears its end: it comes in at once. Only once
354
+ // the clip asked for is the one that plays: chosen while it loads, it would be of the clip before.
355
+ if (clip && clip === stage.wanted && !upcoming && video.duration - video.currentTime < AHEAD_S) {
356
+ const after = face_moves_1.FaceMoves.kind(call.state.phase, !!call.state.paused);
357
+ upcoming = { loop: after, clip: book.loop(after, clip) };
358
+ stage.prime(upcoming.clip);
359
+ }
235
360
  // Paused (the page hidden), it holds still; it moves again as the call does.
236
- const now = videos[shown];
237
- if (call.state.paused && !now.paused) {
238
- now.pause();
361
+ if (call.state.paused && !video.paused) {
362
+ video.pause();
239
363
  }
240
- else if (!call.state.paused && now.paused && ready && names[shown]) {
241
- void now.play().catch(() => undefined);
364
+ else if (!call.state.paused && video.paused && ready && clip && !video.ended) {
365
+ void video.play().catch(() => undefined);
366
+ }
367
+ };
368
+ const failed = (event) => {
369
+ const clip = event.target.dataset.clip;
370
+ if (!clip || !fail(clip, 'decode')) {
371
+ if (!ready) {
372
+ onFailed();
373
+ }
242
374
  }
243
- }, TICK_MS);
244
- const layer = new MouthLayer(call, planOf, canvas.current, view, faces, () => {
375
+ };
376
+ for (const video of videos) {
377
+ video.addEventListener('ended', ended);
378
+ video.addEventListener('error', failed);
379
+ }
380
+ // The clips as they are now (faces/README.md) and the user's own; then the face moves, and Ta knows its moves.
381
+ void (async () => {
382
+ var _a;
383
+ await faces.ready;
384
+ // The user's moves are made from the first person's picture (@celljs/ta-moves): hers alone.
385
+ const lists = faces.person ? [] : await Promise.all(sources.current.map(source => source.moves().catch(() => [])));
386
+ const own = lists.flat();
387
+ for (const given of own) {
388
+ faces.add(face_moves_1.FaceMoves.ownClip(given.name), given);
389
+ }
390
+ book.use(own);
391
+ if (gone) {
392
+ return;
393
+ }
394
+ started = true;
395
+ call_scenes_1.CallScenes.show(call, { moves: book.told() });
396
+ play((_a = wanted()) !== null && _a !== void 0 ? _a : 'listening');
397
+ })();
398
+ const layer = new mouth_layer_1.MouthLayer(call, planOf, canvas.current, view, faces, (video, width) => cameras.place(video, width), () => {
245
399
  const reading = driving();
246
- const clip = names[shown];
247
- return reading && clip ? { reading, video: videos[shown], clip } : undefined;
400
+ const { video, clip } = playing();
401
+ const under = stage.under();
402
+ return reading && clip ? { reading, video, clip, under: under && { video: under.video, alpha: under.alpha } } : undefined;
248
403
  });
249
404
  void layer.open(mouth.current);
250
405
  layer.watch(videos);
251
- // Each frame: the clip of the moment of the sound, kept on its clock, and the mouth drawn for it.
406
+ // Each frame: the fade goes on, the cameras aim, what plays is decided; as Ta reads, the clip of the moment of
407
+ // the sound, kept on its clock, and the mouth drawn for it.
252
408
  let held;
253
409
  let heldAt = 0;
254
- let frame = view.requestAnimationFrame(function tick() {
410
+ let frame = view.requestAnimationFrame(function tick(time) {
255
411
  if (gone) {
256
412
  return;
257
413
  }
258
414
  frame = view.requestAnimationFrame(tick);
415
+ stage.frame();
416
+ cameras.frame(time, stage.names);
417
+ decide();
259
418
  const reading = driving();
419
+ // The reading that drives the clip now, for checks of the call (and anyone curious).
420
+ const drives = reading ? String(reading.say) : '';
421
+ if (box.current && box.current.dataset.reading !== drives) {
422
+ box.current.dataset.reading = drives;
423
+ }
260
424
  if (!reading) {
261
425
  layer.clear();
262
426
  held = undefined;
@@ -267,7 +431,7 @@ function VideoFace({ call, onReady, onFailed }) {
267
431
  }
268
432
  return;
269
433
  }
270
- if (!faces.loaded) {
434
+ if (!started) {
271
435
  return;
272
436
  }
273
437
  const seconds = reading.now();
@@ -275,15 +439,26 @@ function VideoFace({ call, onReady, onFailed }) {
275
439
  layer.follow(reading, seconds);
276
440
  return;
277
441
  }
278
- const at = planOf(reading.say).at(seconds);
279
- const video = videos[shown];
280
- if (names[shown] !== at.clip) {
281
- if (loading !== at.clip) {
282
- kind = 'speaking';
283
- show(at.clip, at.frame / clip_plan_1.CLIP_FPS);
442
+ const plan = planOf(reading.say);
443
+ const at = plan.at(seconds);
444
+ const { video, clip } = playing();
445
+ if (stage.wanted !== at.clip) {
446
+ // A move of the plan (FaceMoves.at): it plays whole, past the end of the reading.
447
+ const next = book.of(at.clip);
448
+ if (next && next !== move) {
449
+ // The sentences heard up to now: the move is of one of them (FaceMoves.at looks back), none plays again.
450
+ for (let k = reading.pieceAt(seconds); k >= 0; k--) {
451
+ moved.add(reading.pieces[k]);
452
+ }
453
+ moveDone = false;
454
+ settled = false;
284
455
  }
456
+ move = next;
457
+ loop = next ? undefined : 'speaking';
458
+ plannedSay = reading.say;
459
+ show(at.clip, at.frame / clip_plan_1.CLIP_FPS);
285
460
  }
286
- else {
461
+ else if (clip === at.clip) {
287
462
  // The sound stopped short (what comes next is late): she holds still until it goes on.
288
463
  const time = view.performance.now();
289
464
  if (seconds !== held) {
@@ -295,18 +470,25 @@ function VideoFace({ call, onReady, onFailed }) {
295
470
  void (still ? video.pause() : video.play().catch(() => undefined));
296
471
  }
297
472
  const sync = clip_plan_1.ClipSync.step(at.frame / clip_plan_1.CLIP_FPS, video.currentTime);
298
- if (sync.seek !== undefined) {
473
+ // Never a seek while the clip fades in (it would show a frame of before as it decodes): it catches up.
474
+ if (sync.seek !== undefined && !stage.under()) {
299
475
  video.currentTime = sync.seek;
300
476
  }
301
- video.playbackRate = sync.rate;
477
+ video.playbackRate = sync.seek !== undefined && stage.under() ? 1.25 : sync.rate;
478
+ }
479
+ // The clip that comes next in the plan, decoded behind ahead of its moment.
480
+ const ahead = plan.at(seconds + AHEAD_S);
481
+ if (ahead.clip !== at.clip) {
482
+ stage.prime(ahead.clip);
302
483
  }
303
484
  layer.follow(reading, seconds);
304
485
  });
305
486
  return () => {
306
487
  gone = true;
488
+ stage.close();
307
489
  view.cancelAnimationFrame(frame);
490
+ cameras.close();
308
491
  layer.close();
309
- clearInterval(timer);
310
492
  for (const video of videos) {
311
493
  video.removeEventListener('ended', ended);
312
494
  video.removeEventListener('error', failed);
@@ -315,219 +497,11 @@ function VideoFace({ call, onReady, onFailed }) {
315
497
  video.load();
316
498
  }
317
499
  };
318
- }, [call]);
319
- const poster = face_files_1.FaceFiles.poster((_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document);
500
+ }, [call, person]);
501
+ const poster = face_files_1.FaceFiles.poster((_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document, call_people_1.CallPeople.dir(person));
320
502
  return (React.createElement("div", { ref: box, className: "ta-video-clips" },
321
- layers.map((layer, index) => (React.createElement("video", {
322
- // biome-ignore lint/suspicious/noArrayIndexKey: two fixed layers
323
- key: index, ref: layer, className: `ta-video-clip${front === index ? ' ta-front' : ''}`, poster: poster, muted: true, playsInline: true, preload: "auto", disablePictureInPicture: true }))),
503
+ React.createElement("img", { className: "ta-video-backdrop", src: poster, alt: "", "aria-hidden": true, draggable: false }),
504
+ layers.map((layer, index) => (React.createElement("video", { key: index, ref: layer, className: "ta-video-clip", poster: poster, muted: true, playsInline: true, preload: "auto", disablePictureInPicture: true }))),
324
505
  React.createElement("canvas", { ref: canvas, className: "ta-video-mouth" })));
325
506
  }
326
- /**
327
- * The mouth an extension draws for what Ta reads (WebCallMouth), laid over the clip: told the sound of each reading as
328
- * it comes with the frame of the clip at each moment of it (ClipPlan), it gives that frame's lower face drawn again
329
- * for that sound. As each frame of the clip is shown (requestVideoFrameCallback), that frame and the mouth of that
330
- * moment of the sound are drawn together, the mouth moved with her face when it was drawn for a frame near it: the
331
- * clip and the sound keep their own clocks a little apart. The reading waits for it as long as it asks (holdMs).
332
- */
333
- class MouthLayer {
334
- constructor(call, planOf, canvas, view, faces, showing) {
335
- this.call = call;
336
- this.planOf = planOf;
337
- this.canvas = canvas;
338
- this.view = view;
339
- this.faces = faces;
340
- this.showing = showing;
341
- this.closed = false;
342
- /** Of each reading: the seconds of its sound that came, and the slots told. */
343
- this.sounds = new Map();
344
- this.atSlot = -1;
345
- /** The canvas shows the frames of the clip now, not the layers of video under it. */
346
- this.drawing = false;
347
- }
348
- async open(mouth) {
349
- var _a;
350
- const session = await (mouth === null || mouth === void 0 ? void 0 : mouth.open().catch(() => undefined));
351
- if (!session) {
352
- return;
353
- }
354
- if (this.closed) {
355
- session.close();
356
- return;
357
- }
358
- this.session = session;
359
- this.missed = (_a = this.call.sounds.nowReading()) === null || _a === void 0 ? void 0 : _a.say;
360
- this.call.sounds.hold(session.holdMs);
361
- this.offSound = this.call.sounds.on((say, pcm, rate) => this.sound(say, pcm, rate));
362
- }
363
- sound(say, pcm, rate) {
364
- var _a;
365
- var _b, _c;
366
- const session = this.session;
367
- if (!session || say === this.missed) {
368
- return;
369
- }
370
- if (!this.sounds.has(say)) {
371
- // A reading begins: it waits as long as the mouth asks, more while the mouth starts.
372
- this.call.sounds.hold(session.holdMs + Math.min(STARTING_MS, (_b = (_a = session.readyIn) === null || _a === void 0 ? void 0 : _a.call(session)) !== null && _b !== void 0 ? _b : 0));
373
- }
374
- const heard = (_c = this.sounds.get(say)) !== null && _c !== void 0 ? _c : { seconds: 0, told: 0 };
375
- this.sounds.set(say, heard);
376
- for (const old of this.sounds.keys()) {
377
- if (old < say - 1) {
378
- this.sounds.delete(old);
379
- }
380
- }
381
- if (pcm) {
382
- heard.seconds += pcm.byteLength / 2 / rate;
383
- }
384
- const upto = pcm ? Math.floor(heard.seconds * session.fps) : Math.ceil(heard.seconds * session.fps);
385
- const plan = this.planOf(say);
386
- const slots = [];
387
- for (let slot = heard.told; slot < upto; slot++) {
388
- const { clip, frame } = plan.at(slot / session.fps);
389
- slots.push([clip, frame]);
390
- }
391
- const first = heard.told;
392
- heard.told = Math.max(heard.told, upto);
393
- session.sound(say, pcm, rate, slots, first);
394
- }
395
- /** The reading plays at `seconds` of its sound: the extension knows what it need not draw any more. */
396
- follow(reading, seconds) {
397
- const session = this.session;
398
- if (!session) {
399
- return;
400
- }
401
- if (this.say !== undefined && this.say !== reading.say) {
402
- session.cut(this.say);
403
- }
404
- this.say = reading.say;
405
- const slot = Math.floor(seconds * session.fps);
406
- if (slot !== this.atSlot) {
407
- this.atSlot = slot;
408
- session.at(reading.say, slot);
409
- }
410
- }
411
- /** Draws as each frame of the layers of video is shown, the one in front. */
412
- watch(videos) {
413
- const offs = videos.map(video => {
414
- if (typeof video.requestVideoFrameCallback !== 'function') {
415
- return () => undefined;
416
- }
417
- const shown = (_now, frame) => {
418
- handle = video.requestVideoFrameCallback(shown);
419
- this.shown(video, frame.mediaTime);
420
- };
421
- let handle = video.requestVideoFrameCallback(shown);
422
- return () => video.cancelVideoFrameCallback(handle);
423
- });
424
- this.offFrames = () => {
425
- for (const off of offs) {
426
- off();
427
- }
428
- };
429
- }
430
- /** A frame of `video` is shown, `mediaTime` into its clip: it is drawn, with the mouth of the moment over it. */
431
- shown(video, mediaTime) {
432
- var _a, _b, _c;
433
- const session = this.session;
434
- const canvas = this.canvas;
435
- const now = this.showing();
436
- if (!session || !canvas || !now || now.video !== video || !video.videoWidth) {
437
- return;
438
- }
439
- const context = this.fit(canvas);
440
- if (!context) {
441
- return;
442
- }
443
- const width = canvas.width;
444
- const height = canvas.height;
445
- const scale = Math.max(width / video.videoWidth, height / video.videoHeight);
446
- const left = (width - video.videoWidth * scale) * 0.5;
447
- const top = (height - video.videoHeight * scale) * 0.3;
448
- context.drawImage(video, left, top, video.videoWidth * scale, video.videoHeight * scale);
449
- this.drawing = true;
450
- const shownFrame = Math.round(mediaTime * clip_plan_1.CLIP_FPS);
451
- const drawn = this.nearest(session, now.reading.say, Math.floor(now.reading.now() * session.fps), now.clip, shownFrame);
452
- const at = this.place(drawn, now.clip, shownFrame);
453
- if (drawn && at) {
454
- context.drawImage(drawn.image, left + at[0] * scale, top + at[1] * scale, at[2] * scale, at[3] * scale);
455
- }
456
- // How many frames showed while Ta read, and how many with her mouth: read by checks of the call (and by anyone curious).
457
- canvas.dataset.frames = String(Number((_a = canvas.dataset.frames) !== null && _a !== void 0 ? _a : 0) + 1);
458
- canvas.dataset.mouths = String(Number((_b = canvas.dataset.mouths) !== null && _b !== void 0 ? _b : 0) + (drawn && at ? 1 : 0));
459
- if (drawn && at) {
460
- canvas.dataset.apart = String(Number((_c = canvas.dataset.apart) !== null && _c !== void 0 ? _c : 0) + Math.abs(drawn.frame - shownFrame));
461
- }
462
- }
463
- /**
464
- * The mouth of the moment of the sound, or of the slot just before or after it if that one was drawn for a frame
465
- * nearer the one shown (the frame comes to the screen a little after its moment): a mouth a slot early or late is
466
- * not seen, one laid over a frame it was not drawn for is.
467
- */
468
- nearest(session, say, slot, clip, frame) {
469
- let best;
470
- for (const near of [slot, slot - 1, slot + 1]) {
471
- const drawn = session.frame(say, near);
472
- if ((drawn === null || drawn === void 0 ? void 0 : drawn.clip) === clip && (!best || Math.abs(drawn.frame - frame) < Math.abs(best.frame - frame))) {
473
- best = drawn;
474
- }
475
- }
476
- return best !== null && best !== void 0 ? best : session.frame(say, slot);
477
- }
478
- /**
479
- * Where the mouth drawn goes over `frame` of `clip`: its place in the frame it was drawn for, moved and scaled as her
480
- * face is from that frame to this one; undefined when it is of another clip, or of a frame too far.
481
- */
482
- place(drawn, clip, frame) {
483
- if (!drawn || drawn.clip !== clip || Math.abs(drawn.frame - frame) > NEAR_FRAMES) {
484
- return undefined;
485
- }
486
- const boxes = this.faces.boxes(clip);
487
- const from = boxes === null || boxes === void 0 ? void 0 : boxes[drawn.frame];
488
- const to = boxes === null || boxes === void 0 ? void 0 : boxes[Math.min(frame, boxes.length - 1)];
489
- const [x, y, w, h] = drawn.box;
490
- if (!from || !to || drawn.frame === frame) {
491
- return [x, y, w, h];
492
- }
493
- const sx = (to[2] - to[0]) / Math.max(1, from[2] - from[0]);
494
- const sy = (to[3] - to[1]) / Math.max(1, from[3] - from[1]);
495
- return [to[0] + (x - from[0]) * sx, to[1] + (y - from[1]) * sy, w * sx, h * sy];
496
- }
497
- /** Nothing over the clip: Ta is not reading with its voice service now. */
498
- clear() {
499
- var _a;
500
- if (this.say !== undefined) {
501
- (_a = this.session) === null || _a === void 0 ? void 0 : _a.cut(this.say);
502
- this.say = undefined;
503
- this.atSlot = -1;
504
- }
505
- if (this.drawing && this.canvas) {
506
- this.drawing = false;
507
- this.fit(this.canvas);
508
- }
509
- }
510
- /** The canvas the size it shows at, cleared. */
511
- fit(canvas) {
512
- const ratio = Math.min(2, this.view.devicePixelRatio || 1);
513
- const width = Math.round(canvas.clientWidth * ratio);
514
- const height = Math.round(canvas.clientHeight * ratio);
515
- if (canvas.width !== width || canvas.height !== height) {
516
- canvas.width = width;
517
- canvas.height = height;
518
- }
519
- const context = canvas.getContext('2d');
520
- context === null || context === void 0 ? void 0 : context.clearRect(0, 0, width, height);
521
- return context;
522
- }
523
- close() {
524
- var _a, _b, _c;
525
- this.closed = true;
526
- (_a = this.offSound) === null || _a === void 0 ? void 0 : _a.call(this);
527
- (_b = this.offFrames) === null || _b === void 0 ? void 0 : _b.call(this);
528
- (_c = this.session) === null || _c === void 0 ? void 0 : _c.close();
529
- this.session = undefined;
530
- this.call.sounds.hold(0);
531
- }
532
- }
533
507
  //# sourceMappingURL=video-face.js.map