@celljs/ta-web 4.27.0 → 4.28.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 (264) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +9 -4
  2. package/esm/browser/assistant/assistant-role.js +17 -5
  3. package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
  4. package/esm/browser/assistant/assistant-task-util.js +12 -1
  5. package/esm/browser/assistant/assistant-view.js +4 -1
  6. package/esm/browser/assistant/assistant.d.ts +2 -1
  7. package/esm/browser/assistant/assistant.js +9 -7
  8. package/esm/browser/assistant/call-conversing.d.ts +45 -0
  9. package/esm/browser/assistant/call-conversing.js +91 -0
  10. package/esm/browser/assistant/call-face.d.ts +13 -0
  11. package/esm/browser/assistant/call-face.js +81 -0
  12. package/esm/browser/assistant/call-keeper.d.ts +8 -4
  13. package/esm/browser/assistant/call-keeper.js +32 -11
  14. package/esm/browser/assistant/call-partnering.d.ts +37 -0
  15. package/esm/browser/assistant/call-partnering.js +79 -0
  16. package/esm/browser/assistant/call-scenes.d.ts +25 -0
  17. package/esm/browser/assistant/call-scenes.js +82 -0
  18. package/esm/browser/assistant/call-screen.d.ts +3 -0
  19. package/esm/browser/assistant/call-screen.js +15 -0
  20. package/esm/browser/assistant/mic-sense.d.ts +31 -0
  21. package/esm/browser/assistant/mic-sense.js +119 -0
  22. package/esm/browser/assistant/noise-gate.d.ts +32 -0
  23. package/esm/browser/assistant/noise-gate.js +66 -0
  24. package/esm/browser/assistant/pcm-util.d.ts +10 -0
  25. package/esm/browser/assistant/pcm-util.js +55 -0
  26. package/esm/browser/assistant/read-aloud.d.ts +2 -1
  27. package/esm/browser/assistant/realtime-voice-protocol.d.ts +84 -0
  28. package/esm/browser/assistant/realtime-voice-protocol.js +40 -0
  29. package/esm/browser/assistant/realtime-voice.d.ts +50 -62
  30. package/esm/browser/assistant/realtime-voice.js +213 -134
  31. package/esm/browser/assistant/spoken-timeline.d.ts +27 -0
  32. package/esm/browser/assistant/spoken-timeline.js +49 -0
  33. package/esm/browser/assistant/voice-call-bar.d.ts +9 -2
  34. package/esm/browser/assistant/voice-call-bar.js +81 -31
  35. package/esm/browser/assistant/voice-call-protocol.d.ts +61 -4
  36. package/esm/browser/assistant/voice-call.d.ts +16 -23
  37. package/esm/browser/assistant/voice-call.js +134 -117
  38. package/esm/browser/assistant/voice-reading.d.ts +83 -0
  39. package/esm/browser/assistant/voice-reading.js +150 -0
  40. package/esm/browser/avatar/dino-talk.d.ts +15 -0
  41. package/esm/browser/avatar/dino-talk.js +34 -0
  42. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  43. package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
  44. package/esm/browser/components/conversation-scroll-util.js +21 -0
  45. package/esm/browser/components/conversation-scroll.js +10 -11
  46. package/esm/browser/components/gallery.js +28 -7
  47. package/esm/browser/components/host-view.d.ts +1 -1
  48. package/esm/browser/components/image-pull.d.ts +64 -0
  49. package/esm/browser/components/image-pull.js +202 -0
  50. package/esm/browser/components/kept-call-bar.js +2 -1
  51. package/esm/browser/components/lightbox.d.ts +1 -1
  52. package/esm/browser/components/lightbox.js +57 -2
  53. package/esm/browser/components/markdown.d.ts +3 -1
  54. package/esm/browser/components/markdown.js +8 -4
  55. package/esm/browser/components/partner-row.js +2 -1
  56. package/esm/browser/components/relay-services.d.ts +9 -3
  57. package/esm/browser/components/relay-services.js +73 -35
  58. package/esm/browser/components/session-view.js +4 -2
  59. package/esm/browser/components/settings-parts.js +2 -0
  60. package/esm/browser/components/ta-avatar.d.ts +15 -1
  61. package/esm/browser/components/ta-avatar.js +38 -5
  62. package/esm/browser/components/voice-services.js +6 -1
  63. package/esm/browser/extension/web-api-call.d.ts +64 -2
  64. package/esm/browser/extension/web-api-contributions.d.ts +1 -0
  65. package/esm/browser/extension/web-api-partners.d.ts +2 -0
  66. package/esm/browser/extension/web-extension-api.d.ts +6 -6
  67. package/esm/browser/extension/web-extension-context.js +1 -0
  68. package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
  69. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  70. package/esm/browser/extension/web-extension-run.js +2 -0
  71. package/esm/browser/i18n/locales.d.ts +24 -5
  72. package/esm/browser/i18n/messages-ja.js +25 -6
  73. package/esm/browser/i18n/messages-zh-tw.js +25 -6
  74. package/esm/browser/i18n/messages.d.ts +23 -4
  75. package/esm/browser/i18n/messages.js +50 -12
  76. package/esm/browser/markdown/code-renderers.d.ts +2 -0
  77. package/esm/browser/markdown/code-renderers.js +2 -0
  78. package/esm/browser/screen/page-answers.d.ts +2 -1
  79. package/esm/browser/screen/page-answers.js +7 -4
  80. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  81. package/esm/browser/settings/settings-protocol.js +2 -0
  82. package/esm/browser/style/chat-list.d.ts +1 -1
  83. package/esm/browser/style/chat-list.js +1 -1
  84. package/esm/browser/style/conversation.d.ts +1 -1
  85. package/esm/browser/style/conversation.js +6 -1
  86. package/esm/browser/style/device.js +1 -0
  87. package/esm/browser/style/dialogs.d.ts +1 -1
  88. package/esm/browser/style/dialogs.js +1 -1
  89. package/esm/browser/style/layout.d.ts +1 -1
  90. package/esm/browser/style/layout.js +135 -57
  91. package/esm/browser/style/shell.d.ts +1 -1
  92. package/esm/browser/style/shell.js +8 -0
  93. package/esm/browser/style/video-call.d.ts +2 -0
  94. package/esm/browser/style/video-call.js +52 -0
  95. package/esm/browser/style.js +2 -0
  96. package/esm/browser/util/desktop.d.ts +10 -1
  97. package/esm/browser/util/desktop.js +10 -0
  98. package/esm/browser/util/image-pull.d.ts +61 -0
  99. package/esm/browser/util/image-pull.js +88 -0
  100. package/esm/browser/util/spoken.d.ts +3 -3
  101. package/esm/browser/util/spoken.js +4 -4
  102. package/esm/browser/video-call/call-camera.d.ts +59 -0
  103. package/esm/browser/video-call/call-camera.js +188 -0
  104. package/esm/browser/video-call/call-window.d.ts +19 -0
  105. package/esm/browser/video-call/call-window.js +80 -0
  106. package/esm/browser/video-call/clip-plan.d.ts +47 -0
  107. package/esm/browser/video-call/clip-plan.js +60 -0
  108. package/esm/browser/video-call/face-clips.d.ts +33 -0
  109. package/esm/browser/video-call/face-clips.js +93 -0
  110. package/esm/browser/video-call/face-files.d.ts +31 -0
  111. package/esm/browser/video-call/face-files.js +77 -0
  112. package/esm/browser/video-call/video-call-view.d.ts +19 -0
  113. package/esm/browser/video-call/video-call-view.js +214 -0
  114. package/esm/browser/video-call/video-face.d.ts +13 -0
  115. package/esm/browser/video-call/video-face.js +497 -0
  116. package/esm/browser/workbench-hosts.d.ts +1 -0
  117. package/esm/browser/workbench-protocol.d.ts +2 -0
  118. package/esm/browser/workbench-util.d.ts +5 -0
  119. package/esm/browser/workbench-util.js +18 -0
  120. package/esm/browser/workbench.d.ts +6 -0
  121. package/esm/browser/workbench.js +36 -5
  122. package/lib/browser/assistant/assistant-role.d.ts +9 -4
  123. package/lib/browser/assistant/assistant-role.js +17 -5
  124. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  125. package/lib/browser/assistant/assistant-task-util.js +11 -0
  126. package/lib/browser/assistant/assistant-view.js +3 -0
  127. package/lib/browser/assistant/assistant.d.ts +2 -1
  128. package/lib/browser/assistant/assistant.js +9 -7
  129. package/lib/browser/assistant/call-conversing.d.ts +46 -0
  130. package/lib/browser/assistant/call-conversing.js +96 -0
  131. package/lib/browser/assistant/call-face.d.ts +14 -0
  132. package/lib/browser/assistant/call-face.js +117 -0
  133. package/lib/browser/assistant/call-keeper.d.ts +8 -4
  134. package/lib/browser/assistant/call-keeper.js +32 -11
  135. package/lib/browser/assistant/call-partnering.d.ts +38 -0
  136. package/lib/browser/assistant/call-partnering.js +83 -0
  137. package/lib/browser/assistant/call-scenes.d.ts +26 -0
  138. package/lib/browser/assistant/call-scenes.js +85 -0
  139. package/lib/browser/assistant/call-screen.d.ts +3 -0
  140. package/lib/browser/assistant/call-screen.js +15 -0
  141. package/lib/browser/assistant/mic-sense.d.ts +32 -0
  142. package/lib/browser/assistant/mic-sense.js +123 -0
  143. package/lib/browser/assistant/noise-gate.d.ts +33 -0
  144. package/lib/browser/assistant/noise-gate.js +71 -0
  145. package/lib/browser/assistant/pcm-util.d.ts +11 -0
  146. package/lib/browser/assistant/pcm-util.js +58 -0
  147. package/lib/browser/assistant/read-aloud.d.ts +2 -1
  148. package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
  149. package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
  150. package/lib/browser/assistant/realtime-voice.d.ts +50 -62
  151. package/lib/browser/assistant/realtime-voice.js +217 -138
  152. package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
  153. package/lib/browser/assistant/spoken-timeline.js +53 -0
  154. package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
  155. package/lib/browser/assistant/voice-call-bar.js +81 -30
  156. package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
  157. package/lib/browser/assistant/voice-call.d.ts +16 -23
  158. package/lib/browser/assistant/voice-call.js +134 -117
  159. package/lib/browser/assistant/voice-reading.d.ts +84 -0
  160. package/lib/browser/assistant/voice-reading.js +156 -0
  161. package/lib/browser/avatar/dino-talk.d.ts +16 -0
  162. package/lib/browser/avatar/dino-talk.js +37 -0
  163. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  164. package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
  165. package/lib/browser/components/conversation-scroll-util.js +21 -0
  166. package/lib/browser/components/conversation-scroll.js +10 -11
  167. package/lib/browser/components/gallery.js +28 -7
  168. package/lib/browser/components/host-view.d.ts +1 -1
  169. package/lib/browser/components/image-pull.d.ts +65 -0
  170. package/lib/browser/components/image-pull.js +206 -0
  171. package/lib/browser/components/kept-call-bar.js +2 -1
  172. package/lib/browser/components/lightbox.d.ts +1 -1
  173. package/lib/browser/components/lightbox.js +57 -2
  174. package/lib/browser/components/markdown.d.ts +3 -1
  175. package/lib/browser/components/markdown.js +7 -3
  176. package/lib/browser/components/partner-row.js +2 -1
  177. package/lib/browser/components/relay-services.d.ts +9 -3
  178. package/lib/browser/components/relay-services.js +71 -33
  179. package/lib/browser/components/session-view.js +3 -1
  180. package/lib/browser/components/settings-parts.js +2 -0
  181. package/lib/browser/components/ta-avatar.d.ts +15 -1
  182. package/lib/browser/components/ta-avatar.js +38 -5
  183. package/lib/browser/components/voice-services.js +5 -0
  184. package/lib/browser/extension/web-api-call.d.ts +64 -2
  185. package/lib/browser/extension/web-api-contributions.d.ts +1 -0
  186. package/lib/browser/extension/web-api-partners.d.ts +2 -0
  187. package/lib/browser/extension/web-extension-api.d.ts +6 -6
  188. package/lib/browser/extension/web-extension-context.js +1 -0
  189. package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
  190. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  191. package/lib/browser/extension/web-extension-run.js +2 -0
  192. package/lib/browser/i18n/locales.d.ts +24 -5
  193. package/lib/browser/i18n/messages-ja.js +25 -6
  194. package/lib/browser/i18n/messages-zh-tw.js +25 -6
  195. package/lib/browser/i18n/messages.d.ts +23 -4
  196. package/lib/browser/i18n/messages.js +50 -12
  197. package/lib/browser/markdown/code-renderers.d.ts +2 -0
  198. package/lib/browser/markdown/code-renderers.js +3 -1
  199. package/lib/browser/screen/page-answers.d.ts +2 -1
  200. package/lib/browser/screen/page-answers.js +7 -4
  201. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  202. package/lib/browser/settings/settings-protocol.js +2 -0
  203. package/lib/browser/style/chat-list.d.ts +1 -1
  204. package/lib/browser/style/chat-list.js +1 -1
  205. package/lib/browser/style/conversation.d.ts +1 -1
  206. package/lib/browser/style/conversation.js +6 -1
  207. package/lib/browser/style/device.js +1 -0
  208. package/lib/browser/style/dialogs.d.ts +1 -1
  209. package/lib/browser/style/dialogs.js +1 -1
  210. package/lib/browser/style/layout.d.ts +1 -1
  211. package/lib/browser/style/layout.js +135 -57
  212. package/lib/browser/style/shell.d.ts +1 -1
  213. package/lib/browser/style/shell.js +8 -0
  214. package/lib/browser/style/video-call.d.ts +3 -0
  215. package/lib/browser/style/video-call.js +55 -0
  216. package/lib/browser/style.js +2 -0
  217. package/lib/browser/util/desktop.d.ts +10 -1
  218. package/lib/browser/util/desktop.js +10 -0
  219. package/lib/browser/util/image-pull.d.ts +62 -0
  220. package/lib/browser/util/image-pull.js +91 -0
  221. package/lib/browser/util/spoken.d.ts +3 -3
  222. package/lib/browser/util/spoken.js +4 -4
  223. package/lib/browser/video-call/call-camera.d.ts +60 -0
  224. package/lib/browser/video-call/call-camera.js +192 -0
  225. package/lib/browser/video-call/call-window.d.ts +20 -0
  226. package/lib/browser/video-call/call-window.js +83 -0
  227. package/lib/browser/video-call/clip-plan.d.ts +48 -0
  228. package/lib/browser/video-call/clip-plan.js +64 -0
  229. package/lib/browser/video-call/face-clips.d.ts +34 -0
  230. package/lib/browser/video-call/face-clips.js +96 -0
  231. package/lib/browser/video-call/face-files.d.ts +32 -0
  232. package/lib/browser/video-call/face-files.js +82 -0
  233. package/lib/browser/video-call/video-call-view.d.ts +20 -0
  234. package/lib/browser/video-call/video-call-view.js +250 -0
  235. package/lib/browser/video-call/video-face.d.ts +14 -0
  236. package/lib/browser/video-call/video-face.js +533 -0
  237. package/lib/browser/workbench-hosts.d.ts +1 -0
  238. package/lib/browser/workbench-protocol.d.ts +2 -0
  239. package/lib/browser/workbench-util.d.ts +5 -0
  240. package/lib/browser/workbench-util.js +18 -0
  241. package/lib/browser/workbench.d.ts +6 -0
  242. package/lib/browser/workbench.js +35 -4
  243. package/package.json +7 -7
  244. package/public/faces/README.md +27 -0
  245. package/public/faces/clap.mp4 +0 -0
  246. package/public/faces/dance.mp4 +0 -0
  247. package/public/faces/happy.mp4 +0 -0
  248. package/public/faces/heart.mp4 +0 -0
  249. package/public/faces/idle-1.mp4 +0 -0
  250. package/public/faces/idle-2.mp4 +0 -0
  251. package/public/faces/idle-3.mp4 +0 -0
  252. package/public/faces/laugh.mp4 +0 -0
  253. package/public/faces/lips.json +1 -0
  254. package/public/faces/listening.mp4 +0 -0
  255. package/public/faces/poster.jpg +0 -0
  256. package/public/faces/shy.mp4 +0 -0
  257. package/public/faces/sorry.mp4 +0 -0
  258. package/public/faces/stretch.mp4 +0 -0
  259. package/public/faces/surprised.mp4 +0 -0
  260. package/public/faces/talk-1.mp4 +0 -0
  261. package/public/faces/talk-2.mp4 +0 -0
  262. package/public/faces/think-2.mp4 +0 -0
  263. package/public/faces/thinking.mp4 +0 -0
  264. package/public/faces/wave.mp4 +0 -0
@@ -39,24 +39,60 @@ const React = __importStar(require("react"));
39
39
  const back_stack_1 = require("../device/back-stack");
40
40
  const use_t_1 = require("../i18n/use-t");
41
41
  const icon_1 = require("./icon");
42
+ const image_pull_1 = require("./image-pull");
42
43
  const image_viewer_1 = require("./image-viewer");
43
44
  /**
44
45
  * An image over the page, to look at closely (ImageViewer): pinched, zoomed, dragged, and with `onPrevious` /
45
46
  * `onNext` the images beside it, by its side buttons, ← → and a finger that swipes it (`previousSrc` / `nextSrc`
46
47
  * in sight as it does, as the viewers of pictures of a phone). A click or tap beside it,
47
- * its close button or Escape closes it. In the top layer, so no container clips it; the touches in it are its
48
+ * its close button, Escape, back or a finger that pulls it down closes it, shrinking back onto its thumbnail (ImagePull). In the top layer, so no container clips it; the touches in it are its
48
49
  * own, never a swipe of a sheet under it.
49
50
  */
50
51
  function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, }) {
51
52
  const t = (0, use_t_1.useT)();
52
53
  const dialog = React.useRef(null);
54
+ /** What opened it (the thumbnail tapped): the picture goes back there first, of those that show the same. */
55
+ const opener = React.useRef(null);
53
56
  React.useEffect(() => {
54
57
  var _a, _b;
58
+ opener.current = document.activeElement;
55
59
  (_b = (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.showModal) === null || _b === void 0 ? void 0 : _b.call(_a);
56
60
  }, []);
57
- const close = () => { var _a; return (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.close(); };
61
+ const pull = React.useRef(undefined);
62
+ // It shrinks back onto its thumbnail, then closes.
63
+ const close = () => { var _a; return (pull.current ? pull.current.leave() : (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.close()); };
58
64
  (0, back_stack_1.useBackLayer)(true, close);
65
+ const shade = React.useRef(null);
66
+ const shown = React.useRef(src);
67
+ shown.current = src;
68
+ React.useEffect(() => {
69
+ const box = dialog.current;
70
+ const viewport = box === null || box === void 0 ? void 0 : box.querySelector('.ta-zoom-viewport');
71
+ const image = viewport === null || viewport === void 0 ? void 0 : viewport.querySelector('img');
72
+ if (!box || !viewport || !image || !shade.current) {
73
+ return;
74
+ }
75
+ const controller = new image_pull_1.ImagePull(viewport, image, shade.current, {
76
+ origin: () => LightboxUtil.thumbnail(shown.current, box, opener.current),
77
+ pulling: pulling => box.toggleAttribute('data-pulling', pulling),
78
+ close: () => box.close(),
79
+ });
80
+ pull.current = controller;
81
+ // Escape shrinks it back too.
82
+ const onCancel = (event) => {
83
+ event.preventDefault();
84
+ controller.leave();
85
+ };
86
+ box.addEventListener('cancel', onCancel);
87
+ const detach = controller.attach();
88
+ return () => {
89
+ box.removeEventListener('cancel', onCancel);
90
+ detach();
91
+ pull.current = undefined;
92
+ };
93
+ }, []);
59
94
  return (React.createElement("dialog", { ref: dialog, className: "ta-lightbox", onClose: onClose, onTouchStart: event => event.stopPropagation() },
95
+ React.createElement("div", { ref: shade, className: "ta-lightbox-shade" }),
60
96
  React.createElement(image_viewer_1.ImageViewer, { src: src, alt: alt, onBackground: close, onPrevious: onPrevious, onNext: onNext, previousSrc: previousSrc, nextSrc: nextSrc, autoFocus: true }),
61
97
  (caption || count) && (React.createElement("div", { className: "ta-lightbox-caption" },
62
98
  caption && React.createElement("span", { className: "ta-lightbox-words" }, caption),
@@ -64,4 +100,23 @@ function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previ
64
100
  React.createElement("button", { type: "button", className: "ta-lightbox-close", title: t('ta.close'), "aria-label": t('ta.close'), onClick: close },
65
101
  React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 18 }))));
66
102
  }
103
+ var LightboxUtil;
104
+ (function (LightboxUtil) {
105
+ /** The picture `src` small on the page, in sight (the thumbnail it was opened from, in `opener` first), out of `lightbox`. */
106
+ function thumbnail(src, lightbox, opener) {
107
+ var _a;
108
+ const url = new URL(src, location.href).href;
109
+ for (const image of [...((_a = opener === null || opener === void 0 ? void 0 : opener.querySelectorAll('img')) !== null && _a !== void 0 ? _a : []), ...document.images]) {
110
+ if (lightbox.contains(image) || (image.currentSrc || image.src) !== url) {
111
+ continue;
112
+ }
113
+ const rect = image.getBoundingClientRect();
114
+ if (rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.top < window.innerHeight && rect.right > 0 && rect.left < window.innerWidth) {
115
+ return image;
116
+ }
117
+ }
118
+ return undefined;
119
+ }
120
+ LightboxUtil.thumbnail = thumbnail;
121
+ })(LightboxUtil || (LightboxUtil = {}));
67
122
  //# sourceMappingURL=lightbox.js.map
@@ -6,9 +6,11 @@ export declare function CodeBlock({ code }: {
6
6
  /**
7
7
  * Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
8
8
  * `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
9
+ * `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
9
10
  */
10
- export declare function Markdown({ text, streaming }: {
11
+ export declare function Markdown({ text, streaming, inline }: {
11
12
  text: string;
12
13
  streaming?: boolean;
14
+ inline?: boolean;
13
15
  }): React.JSX.Element;
14
16
  //# sourceMappingURL=markdown.d.ts.map
@@ -118,6 +118,7 @@ function CodeView({ language, code, closed }) {
118
118
  const Renderer = React.useContext(code_renderers_1.CodeRenderers)[language.trim().toLowerCase()];
119
119
  const send = React.useContext(code_renderers_1.CodeReply);
120
120
  const answer = React.useContext(code_renderers_1.CodeAnswer);
121
+ const embedded = React.useContext(code_renderers_1.CodeEmbedded);
121
122
  // What a reply holds for the ear alone (SpokenReply) is heard, not shown.
122
123
  if (language.trim().toLowerCase() === spoken_1.SpokenReply.LANGUAGE) {
123
124
  return null;
@@ -125,7 +126,8 @@ function CodeView({ language, code, closed }) {
125
126
  const plain = React.createElement(CodeBlock, { code: code, language: language });
126
127
  if (Renderer) {
127
128
  return (React.createElement(CodeBoundary, { retry: closed, fallback: plain },
128
- React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer })));
129
+ React.createElement(code_renderers_1.CodeEmbedded.Provider, { value: true }, embedded ? (React.createElement("div", { className: "ta-code-embedded" },
130
+ React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer, embedded: true }))) : (React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer })))));
129
131
  }
130
132
  if (mermaid_1.MermaidUtil.isDiagram(language, code)) {
131
133
  return React.createElement(mermaid_view_1.MermaidView, { code: code, fallback: plain });
@@ -187,8 +189,10 @@ const MarkdownBody = React.memo(function MarkdownBody({ text, streaming }) {
187
189
  /**
188
190
  * Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
189
191
  * `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
192
+ * `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
190
193
  */
191
- function Markdown({ text, streaming = false }) {
192
- return React.createElement(MarkdownBody, { text: text, streaming: streaming });
194
+ function Markdown({ text, streaming = false, inline = false }) {
195
+ return inline ? (React.createElement("span", { className: "ta-markdown ta-markdown-inline" },
196
+ React.createElement(Text, { text: text }))) : (React.createElement(MarkdownBody, { text: text, streaming: streaming }));
193
197
  }
194
198
  //# sourceMappingURL=markdown.js.map
@@ -53,6 +53,7 @@ const swipe_row_1 = require("./swipe-row");
53
53
  */
54
54
  function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
55
55
  var _a, _b;
56
+ var _c;
56
57
  const t = (0, use_t_1.useT)();
57
58
  const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
58
59
  const [opening, setOpening] = React.useState(false);
@@ -91,6 +92,6 @@ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
91
92
  React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
92
93
  partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
93
94
  React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks })),
94
- React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
95
+ React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: (_c = partner.label) !== null && _c !== void 0 ? _c : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
95
96
  }
96
97
  //# sourceMappingURL=partner-row.js.map
@@ -1,4 +1,4 @@
1
- import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelayTypeInfo } from '@celljs/ta-protocol';
1
+ import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelays, TaRelayTypeInfo } from '@celljs/ta-protocol';
2
2
  import { type LucideIcon } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useT } from '../i18n/use-t';
@@ -11,14 +11,20 @@ export declare namespace RelayServicesUtil {
11
11
  function serves(service: TaRelayService, feature: TaRelayFeature): boolean;
12
12
  /** The icon of a service: the official relay, a relay, a folder, a store by the icon its package gave its type. */
13
13
  function icon(service: TaRelayService, types?: readonly TaRelayTypeInfo[]): LucideIcon;
14
+ /** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
15
+ function routes(relays: TaRelays): string[];
16
+ /** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
17
+ function withDirect(relays: TaRelays, ids: readonly string[], on?: boolean): string[];
18
+ /** The ways with the one at `index` tried one earlier. */
19
+ function earlier(routes: readonly string[], index: number): string[];
14
20
  /** What a deployment is called: its name, else the host of the address it was joined by. */
15
21
  function deploymentName(deployment: TaJoinedDeployment): string;
16
22
  function host(url: string): string;
17
23
  /** A name for the cloud workspace of a deployment's gateway (ta://<name>): its first label, as TaLocation takes it. */
18
24
  function cloudName(gateway: string): string;
19
25
  function iconNamed(name: string | undefined): LucideIcon;
20
- /** What a relay shows under its name: where it is, whether it answers, what it keeps. */
21
- function line(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
26
+ /** Where a relay is and whether it answers, short enough for a phone beside its controls. */
27
+ function brief(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
22
28
  }
23
29
  /**
24
30
  * The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
@@ -42,8 +42,13 @@ const use_t_1 = require("../i18n/use-t");
42
42
  const icon_1 = require("./icon");
43
43
  const remote_hosts_1 = require("./remote-hosts");
44
44
  const settings_controls_1 = require("./settings-controls");
45
- /** The features that go through a relay, in the order the settings list them; where sync goes is chosen in its own settings (ta-sync). */
46
- const FEATURES = ['devices', 'share', 'rooms'];
45
+ /** In `use.devices`, the direct connection of a phone to this computer (DIRECT_ROUTE of ta-relay). */
46
+ const DIRECT = 'direct';
47
+ /**
48
+ * The features that go through one relay, in the order the settings list them, after the ways of the phones
49
+ * (DeviceRoutes); where sync goes is chosen in its own settings (ta-sync).
50
+ */
51
+ const FEATURES = ['share', 'rooms'];
47
52
  var RelayServicesUtil;
48
53
  (function (RelayServicesUtil) {
49
54
  /** What a service is called: the official relay, its name, else its host or its folder. */
@@ -83,6 +88,30 @@ var RelayServicesUtil;
83
88
  return iconNamed((_a = types.find(each => each.type === service.type)) === null || _a === void 0 ? void 0 : _a.icon);
84
89
  }
85
90
  RelayServicesUtil.icon = icon;
91
+ /** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
92
+ function routes(relays) {
93
+ var _a;
94
+ const listed = ((_a = relays.routes) === null || _a === void 0 ? void 0 : _a.length) ? relays.routes : [relays.use.devices];
95
+ return listed.filter(id => relays.relays.some(relay => relay.id === id && relay.type === 'ta-relay'));
96
+ }
97
+ RelayServicesUtil.routes = routes;
98
+ /** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
99
+ function withDirect(relays, ids, on) {
100
+ var _a;
101
+ var _b;
102
+ if (on === void 0) { on = (_b = (_a = relays.direct) === null || _a === void 0 ? void 0 : _a.on) !== null && _b !== void 0 ? _b : false; }
103
+ return [...(on ? [DIRECT] : []), ...ids.filter(id => id !== DIRECT)];
104
+ }
105
+ RelayServicesUtil.withDirect = withDirect;
106
+ /** The ways with the one at `index` tried one earlier. */
107
+ function earlier(routes, index) {
108
+ const next = [...routes];
109
+ if (index > 0 && index < next.length) {
110
+ [next[index - 1], next[index]] = [next[index], next[index - 1]];
111
+ }
112
+ return next;
113
+ }
114
+ RelayServicesUtil.earlier = earlier;
86
115
  /** What a deployment is called: its name, else the host of the address it was joined by. */
87
116
  function deploymentName(deployment) {
88
117
  var _a;
@@ -112,38 +141,20 @@ var RelayServicesUtil;
112
141
  return name === 'Database' ? lucide_react_1.Database : name === 'GitBranch' ? lucide_react_1.GitBranch : name === 'HardDrive' ? lucide_react_1.HardDrive : name === 'Server' ? lucide_react_1.Server : lucide_react_1.Cloud;
113
142
  }
114
143
  RelayServicesUtil.iconNamed = iconNamed;
115
- /** What a relay shows under its name: where it is, whether it answers, what it keeps. */
116
- function line(service, probe, t) {
117
- var _a, _b;
144
+ /** Where a relay is and whether it answers, short enough for a phone beside its controls. */
145
+ function brief(service, probe, t) {
118
146
  const host = where(service);
119
- if (service.type === 'folder') {
120
- return probe && !probe.online ? `${host} · ${(_a = probe.error) !== null && _a !== void 0 ? _a : t('ta.relays.offline')}` : `${host} · ${t('ta.relays.folderOnly')}`;
121
- }
122
- if (service.type !== 'ta-relay') {
123
- if (service.unavailable) {
124
- return `${service.type} · ${t('ta.relays.unavailable')}`;
125
- }
126
- if (probe && !probe.online) {
127
- return `${host} · ${(_b = probe.error) !== null && _b !== void 0 ? _b : t('ta.relays.offline')}`;
128
- }
129
- return [host, (probe === null || probe === void 0 ? void 0 : probe.ms) !== undefined ? t('ta.relays.online', { ms: probe.ms }) : undefined, t('ta.relays.storeOnly')].filter(Boolean).join(' · ');
130
- }
131
147
  if (!probe) {
132
148
  return host;
133
149
  }
134
150
  if (!probe.online) {
135
151
  return `${host} · ${t('ta.relays.offline')}`;
136
152
  }
137
- const parts = [host, probe.ms !== undefined ? t('ta.relays.online', { ms: probe.ms }) : t('ta.relays.onlineNoTime')];
138
- if (probe.persistent === false) {
139
- parts.push(t('ta.relays.memory'));
140
- }
141
- if (probe.limits && !probe.legacy) {
142
- parts.push(t('ta.relays.limits', { members: probe.limits.hubMembers, state: Math.round(probe.limits.hubStateBytes / 1024 / 1024) }));
143
- }
144
- return parts.join(' · ');
153
+ const answers = probe.ms !== undefined ? t('ta.relays.online', { ms: probe.ms }) : t('ta.relays.onlineNoTime');
154
+ // A relay that keeps group chats in memory loses them when it restarts: worth saying.
155
+ return [host, answers, probe.persistent === false ? t('ta.relays.memory') : undefined].filter(Boolean).join(' · ');
145
156
  }
146
- RelayServicesUtil.line = line;
157
+ RelayServicesUtil.brief = brief;
147
158
  })(RelayServicesUtil || (exports.RelayServicesUtil = RelayServicesUtil = {}));
148
159
  /**
149
160
  * The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
@@ -203,10 +214,7 @@ function RelayServices() {
203
214
  if (!relays) {
204
215
  return null;
205
216
  }
206
- const used = new Set(Object.values(relays.use));
207
- const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
208
- // Folders and stores are places of sync, chosen and removed there.
209
- const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
217
+ const used = new Set([...Object.values(relays.use), ...((_a = relays.routes) !== null && _a !== void 0 ? _a : [])]);
210
218
  return (React.createElement(React.Fragment, null,
211
219
  React.createElement(Deployment, { relays: relays, changed: listed => {
212
220
  var _a;
@@ -221,9 +229,9 @@ function RelayServices() {
221
229
  React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
222
230
  .filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
223
231
  .map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
224
- shown.map(relay => { var _a; return (React.createElement(settings_controls_1.Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
225
- React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
226
- RelayServicesUtil.line(relay, probes[relay.id], t)) }, !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id) && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.relays.remove', { name: RelayServicesUtil.label(relay, t) }), disabled: busy !== undefined, onClick: () => void run(relay.id, () => bench.relay.removeRelay(relay.id)) })))); }),
232
+ React.createElement(DeviceRoutes, { relays: relays, probes: probes, busy: busy !== undefined, chooseWays: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', ids))), choose: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', RelayServicesUtil.withDirect(relays, ids)))), remove: relay => !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id)
233
+ ? () => void run(relay.id, () => bench.relay.removeRelay(relay.id))
234
+ : undefined }),
227
235
  React.createElement(settings_controls_1.Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
228
236
  React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
229
237
  event.preventDefault();
@@ -237,6 +245,36 @@ function RelayServices() {
237
245
  React.createElement(settings_controls_1.Row, { icon: lucide_react_1.RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
238
246
  React.createElement(settings_controls_1.Row, { icon: lucide_react_1.FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
239
247
  }
248
+ /**
249
+ * The relays, as the ways of the phones to this computer (docs/design/ta-relays.md 12): each relay a row with whether it
250
+ * answers, on or off for phones and moved earlier by its arrow, the phones trying them in that order and keeping the first
251
+ * that connects; one stays on. A relay nothing uses can be removed. Folders and stores are places of sync, listed there.
252
+ */
253
+ function DeviceRoutes({ relays, probes, busy, choose, chooseWays, remove, }) {
254
+ const t = (0, use_t_1.useT)();
255
+ const routes = RelayServicesUtil.routes(relays);
256
+ const all = relays.relays.filter(relay => relay.type === 'ta-relay');
257
+ const ordered = [...routes.flatMap(id => all.filter(relay => relay.id === id)), ...all.filter(relay => !routes.includes(relay.id))];
258
+ return (React.createElement(React.Fragment, null,
259
+ React.createElement(settings_controls_1.Row, { label: t('ta.relays.feature.devices'), description: t('ta.relays.feature.devicesHint') }),
260
+ relays.direct && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Zap, label: t('ta.relays.direct'), description: relays.direct.available ? t('ta.relays.directHint') : t('ta.relays.directUnavailable') },
261
+ React.createElement(settings_controls_1.Switch, { checked: relays.direct.on && relays.direct.available, label: t('ta.relays.direct'), disabled: busy || !relays.direct.available, onChange: on => chooseWays(RelayServicesUtil.withDirect(relays, routes, on)) }))),
262
+ ordered.map(relay => {
263
+ var _a;
264
+ const at = routes.indexOf(relay.id);
265
+ const name = RelayServicesUtil.label(relay, t);
266
+ const removing = remove(relay);
267
+ return (React.createElement(settings_controls_1.Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, relays.types), label: name, description: React.createElement("span", { className: "ta-remote-state" },
268
+ React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
269
+ [
270
+ at >= 0 ? t('ta.relays.routeAt', { n: at + 1 }) : t('ta.relays.routeOff'),
271
+ RelayServicesUtil.brief(relay, probes[relay.id], t),
272
+ ].join(' · ')) },
273
+ removing && React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.relays.remove', { name }), disabled: busy, onClick: removing }),
274
+ at > 0 && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.ArrowUp, label: t('ta.relays.routeUp', { name }), disabled: busy, onClick: () => choose(RelayServicesUtil.earlier(routes, at)) })),
275
+ React.createElement(settings_controls_1.Switch, { checked: at >= 0, label: t('ta.relays.routeUse', { name }), disabled: busy || (at >= 0 && routes.length === 1), onChange: on => choose(on ? [...routes, relay.id] : routes.filter(id => id !== relay.id)) })));
276
+ })));
277
+ }
240
278
  /**
241
279
  * A deployment of Ta, inside a company or outside it (docs/design/ta-deploy.md 8): joined by the address of any of its
242
280
  * services, its relay is the default of what is new, and its gateway gives a Ta in the cloud to open, or its sandbox as a
@@ -38,6 +38,7 @@ const react_1 = require("@celljs/react");
38
38
  const ta_protocol_1 = require("@celljs/ta-protocol");
39
39
  const lucide_react_1 = require("lucide-react");
40
40
  const React = __importStar(require("react"));
41
+ const call_face_1 = require("../assistant/call-face");
41
42
  const voice_call_bar_1 = require("../assistant/voice-call-bar");
42
43
  const device_1 = require("../device/device");
43
44
  const drafts_protocol_1 = require("../drafts/drafts-protocol");
@@ -358,7 +359,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
358
359
  disabled: nothingSaid,
359
360
  run: () => setFinding(count => count + 1),
360
361
  },
361
- ...(callable ? [(0, voice_call_bar_1.callAction)(callState, call, t)] : []),
362
+ ...(callable ? [(0, voice_call_bar_1.callAction)(callState, call, t), (0, voice_call_bar_1.videoCallAction)(callState, call, t)] : []),
362
363
  ],
363
364
  ...addons.actions,
364
365
  ], [actions, addons.actions, t, nothingSaid, callable, callState, call]);
@@ -380,6 +381,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
380
381
  info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, message_1.MessageUtil.shortPath(info.cwd)))),
381
382
  React.createElement(people_1.PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
382
383
  trailing)),
384
+ React.createElement(call_face_1.CallFace, { state: callState, call: call }),
383
385
  finding > 0 && React.createElement(conversation_find_1.ConversationFind, { store: store, state: state, rows: rows, scroller: scroller, focusKey: finding, onClose: closeFind }),
384
386
  React.createElement("div", { className: "ta-scroll ta-conversation", ref: scroller },
385
387
  React.createElement("div", { className: "ta-thread" },
@@ -163,6 +163,8 @@ function useParts(scope, onScope, onClose, onDialog) {
163
163
  React.createElement(settings_controls_1.Switch, { label: t('ta.settings.speakTalk'), checked: settings.speakTalk, onChange: speakTalk => store.update({ speakTalk }) }))),
164
164
  (0, settings_controls_1.row)('callCaptions', [t('ta.settings.callCaptions'), t('ta.settings.callCaptionsHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.callCaptions'), description: t('ta.settings.callCaptionsHint') },
165
165
  React.createElement(settings_controls_1.Switch, { label: t('ta.settings.callCaptions'), checked: settings.callCaptions, onChange: callCaptions => store.update({ callCaptions }) }))),
166
+ (0, settings_controls_1.row)('callFace', [t('ta.settings.callFace'), t('ta.settings.callFaceHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.callFace'), description: t('ta.settings.callFaceHint') },
167
+ React.createElement(settings_controls_1.Switch, { label: t('ta.settings.callFace'), checked: settings.callFace, onChange: callFace => store.update({ callFace }) }))),
166
168
  ...(voice_1.Voice.canSpeak()
167
169
  ? [
168
170
  (0, settings_controls_1.row)('voiceName', [t('ta.settings.voiceName'), t('ta.settings.voiceNameHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.voiceName'), description: t('ta.settings.voiceNameHint'), stacked: true },
@@ -2,6 +2,16 @@ import * as React from 'react';
2
2
  import { type Mood } from '../avatar/dino-avatar';
3
3
  import { type Gait } from '../avatar/dino-motion';
4
4
  import { type SpeciesId } from '../avatar/dino-species';
5
+ /**
6
+ * What moves a close-up in a call (the face of a call): the mouth by the sound that plays while it speaks, a nod as the
7
+ * user's words come.
8
+ */
9
+ export interface DinoTalk {
10
+ /** How loud what plays now is (RMS, 0 to 1); undefined when nothing tells, and the mouth moves by itself. */
11
+ level?(): number | undefined;
12
+ /** Changes as the user's words come: it nods (once in a while). */
13
+ nods?: number;
14
+ }
5
15
  /** The kind of dinosaur ta is and how it walks, as the user picked them for the double; the logo walking until then. */
6
16
  export interface DinoLook {
7
17
  species: SpeciesId;
@@ -26,10 +36,14 @@ export declare function TaAvatar({ mood, size, mark, className, roam, species, g
26
36
  * A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
27
37
  * account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
28
38
  */
29
- export declare function DinoFace({ mood, size, species, className }: {
39
+ export declare function DinoFace({ mood, size, species, className, talk, fill, }: {
30
40
  mood?: Mood;
31
41
  size?: number;
32
42
  species?: SpeciesId;
33
43
  className?: string;
44
+ /** In a call: its mouth moves by the sound it plays, it nods to the words it hears. */
45
+ talk?: DinoTalk;
46
+ /** As large as its box, which the styles size; `size` says how large it is drawn at most. */
47
+ fill?: boolean;
34
48
  }): React.JSX.Element;
35
49
  //# sourceMappingURL=ta-avatar.d.ts.map
@@ -40,6 +40,7 @@ const React = __importStar(require("react"));
40
40
  const dino_avatar_1 = require("../avatar/dino-avatar");
41
41
  const dino_motion_1 = require("../avatar/dino-motion");
42
42
  const dino_species_1 = require("../avatar/dino-species");
43
+ const dino_talk_1 = require("../avatar/dino-talk");
43
44
  const scroll_rest_1 = require("../util/scroll-rest");
44
45
  let next = 0;
45
46
  /** How long a change of mood takes to blend into the new motion, in seconds. */
@@ -52,6 +53,8 @@ const FINE = 48;
52
53
  const BOX_MS = 200;
53
54
  /** The whole dinosaur's viewBox: its left and top edge, and its width. */
54
55
  const WHOLE = [-8, -8, 272];
56
+ /** How long after a nod a close-up nods again, however often the words it hears come, in seconds. */
57
+ const NOD_GAP = 1.4;
55
58
  exports.DinoLook = React.createContext({ species: dino_species_1.DinoSpecies.DEFAULT, gait: 'walk' });
56
59
  /** One loop of animation frames for every ta on the page; only those on screen move, and none when motion is reduced. */
57
60
  const players = new Set();
@@ -116,6 +119,9 @@ function draw(player, now) {
116
119
  player.last = now;
117
120
  const since = (now - player.poked) / 1000;
118
121
  // A close-up only tilts its head toward the pointer, and laughs when poked; the whole dinosaur roars.
122
+ if (player.face && player.talk) {
123
+ pose = talking(player, pose, now, dt);
124
+ }
119
125
  pose = player.face
120
126
  ? dino_motion_1.DinoMotion.tickle(dino_motion_1.DinoMotion.look(pose, { ...look, weight: look.weight * 0.5 }), since)
121
127
  : dino_motion_1.DinoMotion.poke(dino_motion_1.DinoMotion.look(pose, look), since);
@@ -166,6 +172,27 @@ function draw(player, now) {
166
172
  svg.classList.toggle('ta-dino-poked', since >= 0 && since < dino_motion_1.POKE);
167
173
  }
168
174
  }
175
+ /** A close-up in a call: its mouth by the sound it plays as it speaks, a nod to the words it hears. */
176
+ function talking(player, pose, now, dt) {
177
+ var _a;
178
+ const talk = player.talk;
179
+ const level = player.mood === 'speaking' ? (_a = talk === null || talk === void 0 ? void 0 : talk.level) === null || _a === void 0 ? void 0 : _a.call(talk) : undefined;
180
+ let posed = pose;
181
+ if (level !== undefined) {
182
+ player.open = dino_talk_1.DinoTalkMotion.mouth(player.open, level, dt);
183
+ posed = dino_talk_1.DinoTalkMotion.speak(posed, player.open);
184
+ }
185
+ else {
186
+ player.open = 0;
187
+ }
188
+ if ((talk === null || talk === void 0 ? void 0 : talk.nods) !== player.nods) {
189
+ player.nods = talk === null || talk === void 0 ? void 0 : talk.nods;
190
+ if (player.mood === 'listening' && (now - player.nodded) / 1000 >= NOD_GAP) {
191
+ player.nodded = now;
192
+ }
193
+ }
194
+ return dino_talk_1.DinoTalkMotion.nod(posed, (now - player.nodded) / 1000);
195
+ }
169
196
  function tick(now) {
170
197
  loop = 0;
171
198
  if (document.documentElement.hasAttribute('data-reduce-motion')) {
@@ -233,7 +260,7 @@ function start(player) {
233
260
  };
234
261
  }
235
262
  /** Plays the drawing in `svg`: its markup (which changes with the mood and the kind only) and the frames that move what is in it. */
236
- function usePlayer(svg, { mood, size, roam, species, gait, face }) {
263
+ function usePlayer(svg, { mood, size, roam, species, gait, face, talk }) {
237
264
  const id = React.useMemo(() => `ta-${++next}`, []);
238
265
  const player = React.useRef(undefined);
239
266
  const detail = size >= FINE;
@@ -255,6 +282,7 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
255
282
  const view = face ? species.face : WHOLE;
256
283
  if (current) {
257
284
  current.svg = element;
285
+ current.talk = talk;
258
286
  current.fine = size >= FINE;
259
287
  current.view = view;
260
288
  if (current.species !== species) {
@@ -287,10 +315,14 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
287
315
  look: { x: 0, y: 0, weight: 0 },
288
316
  last: now,
289
317
  poked: -Infinity,
318
+ talk,
319
+ open: 0,
320
+ nods: talk === null || talk === void 0 ? void 0 : talk.nods,
321
+ nodded: -Infinity,
290
322
  boxedAt: -Infinity,
291
323
  parts: new Map(),
292
324
  };
293
- }, [mood, roam, size, species, gait, face]);
325
+ }, [mood, roam, size, species, gait, face, talk]);
294
326
  React.useEffect(() => {
295
327
  const current = player.current;
296
328
  return current ? start(current) : undefined;
@@ -322,12 +354,13 @@ function TaAvatar({ mood = 'idle', size = 40, mark, className = '', roam = false
322
354
  * A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
323
355
  * account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
324
356
  */
325
- function DinoFace({ mood = 'idle', size = 32, species, className = '' }) {
357
+ function DinoFace({ mood = 'idle', size = 32, species, className = '', talk, fill = false, }) {
326
358
  const look = React.useContext(exports.DinoLook);
327
359
  const kind = dino_species_1.DinoSpecies.of(species !== null && species !== void 0 ? species : look.species);
328
360
  const svgRef = React.useRef(null);
329
- const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true });
330
- return (React.createElement("span", { className: `ta-dino-face ${className}`, style: { width: size, height: size, '--ta-dino': kind.colors.skin } },
361
+ const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true, talk });
362
+ const box = fill ? {} : { width: size, height: size };
363
+ return (React.createElement("span", { className: `ta-dino-face ${className}`, style: { ...box, ['--ta-dino']: kind.colors.skin } },
331
364
  React.createElement("svg", { ref: svgRef, className: `ta-avatar ta-avatar-${mood}`, width: size, height: size, viewBox: dino_avatar_1.DinoAvatar.faceBox(kind), "aria-hidden": "true",
332
365
  // biome-ignore lint/security/noDangerouslySetInnerHtml: markup made here from constants, nothing from outside
333
366
  dangerouslySetInnerHTML: { __html: markup } })));
@@ -47,6 +47,7 @@ const settings_controls_1 = require("./settings-controls");
47
47
  * to use it; the types packages registered, each with a form to add one. Keys are typed here and never shown again.
48
48
  */
49
49
  function VoiceServices() {
50
+ var _a;
50
51
  const t = (0, use_t_1.useT)();
51
52
  const language = (0, use_t_1.useLanguage)();
52
53
  const [workbench, bench] = (0, hooks_1.useWorkbench)();
@@ -78,6 +79,8 @@ function VoiceServices() {
78
79
  }
79
80
  const title = (type, fallback) => (type && ta_protocol_1.TaPackageTextUtil.pick(type.title, language)) || fallback;
80
81
  const typeOf = (name) => voices.types.find(type => type.type === name);
82
+ const inUse = voices.services.find(service => service.id === voices.use);
83
+ const thinks = !!inUse && !!((_a = typeOf(inUse.type)) === null || _a === void 0 ? void 0 : _a.thinks);
81
84
  const chosen = (id) => voices.use === id ? (React.createElement(icon_1.Icon, { icon: lucide_react_1.Check, size: 18, className: "ta-setting-check" })) : (React.createElement("button", { type: "button", className: "ta-button", disabled: busy !== undefined, onClick: () => void run('use', () => bench.voice.chooseVoice(id !== null && id !== void 0 ? id : null)) }, t('ta.voices.use')));
82
85
  return (React.createElement(React.Fragment, null,
83
86
  React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Smartphone, label: t('ta.voices.device'), description: t('ta.voices.deviceHint') }, chosen(undefined)),
@@ -97,6 +100,8 @@ function VoiceServices() {
97
100
  await read();
98
101
  } })))));
99
102
  }),
103
+ thinks && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.BrainCircuit, label: t('ta.voices.brain'), description: t('ta.voices.brainHint') },
104
+ React.createElement(settings_controls_1.Switch, { checked: voices.brain === 'service', label: t('ta.voices.brain'), onChange: on => run('brain', () => bench.voice.setBrain(on ? 'service' : 'ta')) }))),
100
105
  voices.use && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Hand, label: t('ta.voices.cutIn'), description: t('ta.voices.cutInHint') },
101
106
  React.createElement(settings_controls_1.Switch, { checked: !voices.bargeIn.tap, label: t('ta.voices.cutIn'), onChange: on => run('bargeIn', () => bench.voice.setBargeIn({ tap: !on })) }))),
102
107
  voices.use && !voices.bargeIn.tap && (React.createElement(BargeInRow, { bargeIn: voices.bargeIn, onChange: bargeIn => void run('bargeIn', () => bench.voice.setBargeIn(bargeIn)) })),