@dxos/plugin-transcription 0.8.4-main.2e9d522 → 0.8.4-main.3eb6e50203

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 (242) hide show
  1. package/dist/lib/browser/TranscriptContainer-MV3JBKLS.mjs +12 -0
  2. package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs +19 -0
  3. package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs.map +7 -0
  4. package/dist/lib/browser/blueprints/index.mjs +9 -0
  5. package/dist/lib/browser/chunk-AV44VISC.mjs +148 -0
  6. package/dist/lib/browser/chunk-AV44VISC.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
  8. package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  10. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-5KPYIC3N.mjs → chunk-K3JJ46VV.mjs} +359 -424
  12. package/dist/lib/browser/chunk-K3JJ46VV.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-Q5OC3WVG.mjs +72 -0
  14. package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-4FJIYH7T.mjs → chunk-RUKY36XW.mjs} +2 -2
  16. package/dist/lib/browser/{chunk-FFEPEPCU.mjs → chunk-TKFU53OZ.mjs} +64 -99
  17. package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +7 -0
  18. package/dist/lib/browser/index.mjs +63 -70
  19. package/dist/lib/browser/index.mjs.map +4 -4
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs +22 -0
  22. package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs.map +7 -0
  23. package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs +35 -0
  24. package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs.map +7 -0
  25. package/dist/lib/browser/{transcriber-PXT4QBFY.mjs → transcriber-SLVQP76E.mjs} +17 -13
  26. package/dist/lib/browser/transcriber-SLVQP76E.mjs.map +7 -0
  27. package/dist/lib/browser/types/index.mjs +8 -8
  28. package/dist/lib/node-esm/{TranscriptContainer-VBAOM5DG.mjs → TranscriptContainer-7M43UAZ2.mjs} +5 -4
  29. package/dist/lib/node-esm/TranscriptContainer-7M43UAZ2.mjs.map +7 -0
  30. package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs +20 -0
  31. package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs.map +7 -0
  32. package/dist/lib/node-esm/blueprints/index.mjs +10 -0
  33. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  34. package/dist/lib/node-esm/chunk-4BFY6P2D.mjs +73 -0
  35. package/dist/lib/node-esm/chunk-4BFY6P2D.mjs.map +7 -0
  36. package/dist/lib/node-esm/{chunk-HT3W7LDP.mjs → chunk-EPC27WWV.mjs} +64 -99
  37. package/dist/lib/node-esm/chunk-EPC27WWV.mjs.map +7 -0
  38. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  39. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  40. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +37 -0
  41. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
  42. package/dist/lib/node-esm/{chunk-Y2B4HWSS.mjs → chunk-SNZAN34I.mjs} +2 -2
  43. package/dist/lib/node-esm/{chunk-TJKAO7VR.mjs → chunk-TIUYXGQN.mjs} +359 -424
  44. package/dist/lib/node-esm/chunk-TIUYXGQN.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-TTJBW7CY.mjs +149 -0
  46. package/dist/lib/node-esm/chunk-TTJBW7CY.mjs.map +7 -0
  47. package/dist/lib/node-esm/index.mjs +63 -70
  48. package/dist/lib/node-esm/index.mjs.map +4 -4
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs +23 -0
  51. package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs.map +7 -0
  52. package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs +36 -0
  53. package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs.map +7 -0
  54. package/dist/lib/node-esm/{transcriber-YUTEVANE.mjs → transcriber-BO2N3UQ4.mjs} +17 -13
  55. package/dist/lib/node-esm/transcriber-BO2N3UQ4.mjs.map +7 -0
  56. package/dist/lib/node-esm/types/index.mjs +8 -8
  57. package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
  58. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  59. package/dist/types/src/blueprints/index.d.ts +2 -0
  60. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  61. package/dist/types/src/blueprints/transcription-blueprint.d.ts +21 -0
  62. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
  63. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
  64. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
  66. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/index.d.ts +4 -4
  68. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/operation-handler/index.d.ts +3 -0
  70. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +5 -0
  72. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  74. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  76. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  78. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  80. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/transcriber/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/transcriber/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/transcriber/transcriber.d.ts +9 -0
  84. package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +1 -0
  85. package/dist/types/src/components/Transcript/Transcript.d.ts +7 -10
  86. package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
  87. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +34 -18
  88. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +12 -12
  90. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
  91. package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
  92. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
  93. package/dist/types/src/components/TranscriptContainer.d.ts +4 -6
  94. package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
  95. package/dist/types/src/components/index.d.ts +1 -1
  96. package/dist/types/src/components/index.d.ts.map +1 -1
  97. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +8 -7
  98. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
  100. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
  101. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +10 -9
  102. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
  104. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
  105. package/dist/types/src/functions/index.d.ts +3 -0
  106. package/dist/types/src/functions/index.d.ts.map +1 -0
  107. package/dist/types/src/functions/open.d.ts +11 -0
  108. package/dist/types/src/functions/open.d.ts.map +1 -0
  109. package/dist/types/src/functions/summarize.d.ts +11 -0
  110. package/dist/types/src/functions/summarize.d.ts.map +1 -0
  111. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  112. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
  113. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  114. package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
  115. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  116. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  117. package/dist/types/src/index.d.ts +1 -1
  118. package/dist/types/src/index.d.ts.map +1 -1
  119. package/dist/types/src/meta.d.ts +2 -3
  120. package/dist/types/src/meta.d.ts.map +1 -1
  121. package/dist/types/src/segments-normalization/message-normalizer.d.ts +5 -5
  122. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
  123. package/dist/types/src/segments-normalization/normalization.d.ts +503 -398
  124. package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
  125. package/dist/types/src/segments-normalization/utils.d.ts +2 -2
  126. package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
  127. package/dist/types/src/testing/testing.d.ts +11 -11
  128. package/dist/types/src/testing/testing.d.ts.map +1 -1
  129. package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
  130. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  131. package/dist/types/src/transcriber/transcriber.d.ts +4 -4
  132. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  133. package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
  134. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  135. package/dist/types/src/types/TranscriptAction.d.ts +25 -0
  136. package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
  137. package/dist/types/src/types/capabilities.d.ts +18 -0
  138. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  139. package/dist/types/src/types/index.d.ts +3 -1
  140. package/dist/types/src/types/index.d.ts.map +1 -1
  141. package/dist/types/src/types/types.d.ts +0 -26
  142. package/dist/types/src/types/types.d.ts.map +1 -1
  143. package/dist/types/src/util/index.d.ts +1 -0
  144. package/dist/types/src/util/index.d.ts.map +1 -1
  145. package/dist/types/src/util/render-byline.d.ts +4 -0
  146. package/dist/types/src/util/render-byline.d.ts.map +1 -0
  147. package/dist/types/tsconfig.tsbuildinfo +1 -1
  148. package/package.json +86 -70
  149. package/src/TranscriptionPlugin.tsx +39 -57
  150. package/src/blueprints/index.ts +5 -0
  151. package/src/blueprints/transcription-blueprint.ts +25 -0
  152. package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
  153. package/src/capabilities/blueprint-definition/index.ts +7 -0
  154. package/src/capabilities/index.ts +4 -7
  155. package/src/capabilities/operation-handler/index.ts +7 -0
  156. package/src/capabilities/operation-handler/operation-handler.ts +25 -0
  157. package/src/capabilities/operation-resolver/index.ts +7 -0
  158. package/src/capabilities/operation-resolver/operation-resolver.ts +25 -0
  159. package/src/capabilities/react-surface/index.ts +7 -0
  160. package/src/capabilities/react-surface/react-surface.tsx +28 -0
  161. package/src/capabilities/transcriber/index.ts +7 -0
  162. package/src/capabilities/transcriber/transcriber.ts +85 -0
  163. package/src/components/Transcript/Transcript.stories.tsx +59 -55
  164. package/src/components/Transcript/Transcript.tsx +25 -59
  165. package/src/components/Transcript/deprecated/OldTranscript.tsx +11 -11
  166. package/src/components/Transcript/transcript-extension.ts +11 -44
  167. package/src/components/TranscriptContainer.tsx +17 -18
  168. package/src/components/stories/FileTranscription.stories.tsx +65 -58
  169. package/src/components/stories/KeyWordRecognition.stories.tsx +17 -13
  170. package/src/components/stories/MicrophoneTranscription.stories.tsx +79 -79
  171. package/src/components/stories/TranscriptionStory.tsx +14 -14
  172. package/src/functions/index.ts +6 -0
  173. package/src/functions/open.ts +37 -0
  174. package/src/functions/summarize.ts +103 -0
  175. package/src/hooks/useAudioFile.ts +49 -53
  176. package/src/hooks/useQueueModelAdapter.ts +1 -1
  177. package/src/hooks/useTranscriber.ts +8 -3
  178. package/src/hooks/useVoiceInput.ts +4 -3
  179. package/src/index.ts +1 -1
  180. package/src/meta.ts +9 -6
  181. package/src/model/model.test.ts +21 -15
  182. package/src/segments-normalization/message-normalizer.ts +19 -14
  183. package/src/segments-normalization/normalization.test.ts +10 -15
  184. package/src/segments-normalization/normalization.ts +43 -42
  185. package/src/segments-normalization/utils.ts +2 -2
  186. package/src/testing/testing.ts +35 -25
  187. package/src/transcriber/media-stream-recorder.ts +4 -4
  188. package/src/transcriber/transcriber.browser.test.ts +6 -5
  189. package/src/transcriber/transcriber.ts +8 -7
  190. package/src/transcriber/transcription-manager.ts +37 -52
  191. package/src/types/TranscriptAction.ts +32 -0
  192. package/src/types/capabilities.ts +33 -0
  193. package/src/types/index.ts +3 -1
  194. package/src/types/types.ts +0 -23
  195. package/src/util/index.ts +1 -0
  196. package/src/util/render-byline.ts +33 -0
  197. package/dist/lib/browser/TranscriptContainer-6WCKCXQ6.mjs +0 -11
  198. package/dist/lib/browser/chunk-5KPYIC3N.mjs.map +0 -7
  199. package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
  200. package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
  201. package/dist/lib/browser/chunk-FFEPEPCU.mjs.map +0 -7
  202. package/dist/lib/browser/chunk-R7INNNUQ.mjs +0 -55
  203. package/dist/lib/browser/chunk-R7INNNUQ.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-U6QBOGTN.mjs +0 -16
  205. package/dist/lib/browser/chunk-U6QBOGTN.mjs.map +0 -7
  206. package/dist/lib/browser/intent-resolver-3O33MMP5.mjs +0 -30
  207. package/dist/lib/browser/intent-resolver-3O33MMP5.mjs.map +0 -7
  208. package/dist/lib/browser/react-surface-E5D5AE3F.mjs +0 -34
  209. package/dist/lib/browser/react-surface-E5D5AE3F.mjs.map +0 -7
  210. package/dist/lib/browser/transcriber-PXT4QBFY.mjs.map +0 -7
  211. package/dist/lib/node-esm/chunk-HT3W7LDP.mjs.map +0 -7
  212. package/dist/lib/node-esm/chunk-RHF2ALML.mjs +0 -17
  213. package/dist/lib/node-esm/chunk-RHF2ALML.mjs.map +0 -7
  214. package/dist/lib/node-esm/chunk-TJKAO7VR.mjs.map +0 -7
  215. package/dist/lib/node-esm/chunk-U65ZWK3L.mjs +0 -56
  216. package/dist/lib/node-esm/chunk-U65ZWK3L.mjs.map +0 -7
  217. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
  218. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
  219. package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs +0 -31
  220. package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs.map +0 -7
  221. package/dist/lib/node-esm/react-surface-QRDJOHN5.mjs +0 -35
  222. package/dist/lib/node-esm/react-surface-QRDJOHN5.mjs.map +0 -7
  223. package/dist/lib/node-esm/transcriber-YUTEVANE.mjs.map +0 -7
  224. package/dist/types/src/capabilities/capabilities.d.ts +0 -17
  225. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  226. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  227. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  228. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  229. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  230. package/dist/types/src/capabilities/transcriber.d.ts +0 -8
  231. package/dist/types/src/capabilities/transcriber.d.ts.map +0 -1
  232. package/dist/types/src/types/schema.d.ts +0 -41
  233. package/dist/types/src/types/schema.d.ts.map +0 -1
  234. package/src/capabilities/capabilities.ts +0 -33
  235. package/src/capabilities/intent-resolver.ts +0 -24
  236. package/src/capabilities/react-surface.tsx +0 -22
  237. package/src/capabilities/transcriber.ts +0 -76
  238. package/src/types/schema.ts +0 -41
  239. /package/dist/lib/browser/{TranscriptContainer-6WCKCXQ6.mjs.map → TranscriptContainer-MV3JBKLS.mjs.map} +0 -0
  240. /package/dist/lib/{node-esm/TranscriptContainer-VBAOM5DG.mjs.map → browser/blueprints/index.mjs.map} +0 -0
  241. /package/dist/lib/browser/{chunk-4FJIYH7T.mjs.map → chunk-RUKY36XW.mjs.map} +0 -0
  242. /package/dist/lib/node-esm/{chunk-Y2B4HWSS.mjs.map → chunk-SNZAN34I.mjs.map} +0 -0
@@ -1,37 +1,145 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ renderByline
4
+ } from "./chunk-NVM2QUMX.mjs";
2
5
  import {
3
6
  TranscriptionCapabilities
4
- } from "./chunk-RHF2ALML.mjs";
7
+ } from "./chunk-4BFY6P2D.mjs";
5
8
 
6
9
  // src/components/TranscriptContainer.tsx
7
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
8
10
  import React2 from "react";
9
- import { fullyQualifiedId, getSpace } from "@dxos/client/echo";
11
+ import { Obj } from "@dxos/echo";
10
12
  import { useMembers, useQueue } from "@dxos/react-client/echo";
11
- import { StackItem } from "@dxos/react-ui-stack";
13
+ import { Layout } from "@dxos/react-ui";
12
14
 
13
- // src/components/Transcript/Transcript.tsx
14
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
15
- import React from "react";
16
- import { IconButton, useThemeContext } from "@dxos/react-ui";
17
- import { createBasicExtensions, createMarkdownExtensions, createRenderer, createThemeExtensions, decorateMarkdown, editorWidth, preview, useTextEditor } from "@dxos/react-ui-editor";
18
- import { mx } from "@dxos/react-ui-theme";
19
- import { isNotFalsy } from "@dxos/util";
15
+ // src/hooks/useAudioFile.ts
16
+ import { useEffect, useState } from "react";
17
+ import { scheduleTask } from "@dxos/async";
18
+ import { Context } from "@dxos/context";
19
+ import { log } from "@dxos/log";
20
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
21
+ var useAudioFile = (audioUrl, constraints) => {
22
+ const [{ audio, stream, track }, setStream] = useState({});
23
+ useEffect(() => {
24
+ const ctx = new Context(void 0, {
25
+ F: __dxlog_file,
26
+ L: 20
27
+ });
28
+ scheduleTask(ctx, async () => {
29
+ try {
30
+ const response = await fetch(audioUrl);
31
+ const blob = await response.blob();
32
+ const objectUrl = URL.createObjectURL(blob);
33
+ ctx.onDispose(() => {
34
+ URL.revokeObjectURL(objectUrl);
35
+ });
36
+ const audio2 = new Audio();
37
+ audio2.src = objectUrl;
38
+ await new Promise((resolve, reject) => {
39
+ audio2.addEventListener("error", (err) => {
40
+ log.error("error", {
41
+ err
42
+ }, {
43
+ F: __dxlog_file,
44
+ L: 39,
45
+ S: void 0,
46
+ C: (f, a) => f(...a)
47
+ });
48
+ reject(err);
49
+ }, {
50
+ once: true
51
+ });
52
+ audio2.addEventListener("canplay", async () => {
53
+ resolve();
54
+ }, {
55
+ once: true
56
+ });
57
+ audio2.load();
58
+ });
59
+ const audioCtx = new AudioContext();
60
+ if (audioCtx.state === "suspended") {
61
+ await audioCtx.resume();
62
+ }
63
+ const destination = audioCtx.createMediaStreamDestination();
64
+ destination.channelCount = 1;
65
+ const source = audioCtx.createMediaElementSource(audio2);
66
+ source.connect(destination);
67
+ const track2 = destination.stream.getAudioTracks()[0];
68
+ if (constraints) {
69
+ await track2.applyConstraints(constraints).catch((err) => log.catch(err, void 0, {
70
+ F: __dxlog_file,
71
+ L: 68,
72
+ S: void 0,
73
+ C: (f, a) => f(...a)
74
+ }));
75
+ }
76
+ setStream({
77
+ audio: audio2,
78
+ stream: destination.stream,
79
+ track: destination.stream.getAudioTracks()[0]
80
+ });
81
+ } catch (err) {
82
+ log.catch(err, void 0, {
83
+ F: __dxlog_file,
84
+ L: 78,
85
+ S: void 0,
86
+ C: (f, a) => f(...a)
87
+ });
88
+ }
89
+ });
90
+ return () => {
91
+ void ctx.dispose();
92
+ };
93
+ }, [
94
+ audioUrl
95
+ ]);
96
+ return {
97
+ audio,
98
+ stream,
99
+ track
100
+ };
101
+ };
20
102
 
21
- // src/components/Transcript/transcript-extension.ts
22
- import { RangeSetBuilder } from "@codemirror/state";
23
- import { EditorView, GutterMarker, ViewPlugin, gutter } from "@codemirror/view";
24
- import { format } from "date-fns/format";
25
- import { intervalToDuration } from "date-fns/intervalToDuration";
26
- import { addEventListener, combine } from "@dxos/async";
103
+ // src/hooks/useAudioTrack.ts
104
+ import { useEffect as useEffect2, useState as useState2 } from "react";
105
+ var useAudioTrack = (active, constraints) => {
106
+ const [track, setTrack] = useState2();
107
+ useEffect2(() => {
108
+ if (!active) {
109
+ track?.stop();
110
+ setTrack(void 0);
111
+ return;
112
+ }
113
+ const initAudio = async () => {
114
+ const audio = new Audio();
115
+ audio.srcObject = await navigator.mediaDevices.getUserMedia({
116
+ audio: constraints ?? true
117
+ });
118
+ const [track2] = audio.srcObject.getAudioTracks();
119
+ if (track2) {
120
+ setTrack(track2);
121
+ }
122
+ };
123
+ if (active) {
124
+ void initAudio();
125
+ }
126
+ }, [
127
+ active
128
+ ]);
129
+ return track;
130
+ };
131
+
132
+ // src/hooks/useQueueModelAdapter.ts
133
+ import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
27
134
 
28
135
  // src/model/model.ts
29
136
  import { Text } from "@codemirror/state";
30
137
  import { Event } from "@dxos/async";
31
138
  import { invariant } from "@dxos/invariant";
32
- import { log } from "@dxos/log";
33
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
139
+ import { log as log2 } from "@dxos/log";
140
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
34
141
  var DocumentAdapter = class {
142
+ _view;
35
143
  constructor(_view) {
36
144
  this._view = _view;
37
145
  }
@@ -40,13 +148,13 @@ var DocumentAdapter = class {
40
148
  return this._view.state.doc.lines - 1;
41
149
  }
42
150
  replaceLines(from, remove, insert) {
43
- log("replaceLines", {
151
+ log2("replaceLines", {
44
152
  count: this._view.state.doc.lines,
45
153
  from,
46
154
  remove,
47
155
  insert
48
156
  }, {
49
- F: __dxlog_file,
157
+ F: __dxlog_file2,
50
158
  L: 39,
51
159
  S: this,
52
160
  C: (f, a) => f(...a)
@@ -68,13 +176,19 @@ var DocumentAdapter = class {
68
176
  }
69
177
  };
70
178
  var SerializationModel = class {
179
+ _renderer;
180
+ /** Ordered set of chunks. */
181
+ _chunks = [];
182
+ /** Map of chunk IDs to their current line counts. */
183
+ _chunkLineCounts = /* @__PURE__ */ new Map();
184
+ /** Map of line numbers to chunk IDs. */
185
+ _lineToChunk = /* @__PURE__ */ new Map();
186
+ /** Track chunk changes since last sync. */
187
+ _changes = [];
188
+ /** Emits when the document is updated. */
189
+ update = new Event();
71
190
  constructor(_renderer, initialChunks = []) {
72
191
  this._renderer = _renderer;
73
- this._chunks = [];
74
- this._chunkLineCounts = /* @__PURE__ */ new Map();
75
- this._lineToChunk = /* @__PURE__ */ new Map();
76
- this._changes = [];
77
- this.update = new Event();
78
192
  initialChunks.forEach((chunk) => {
79
193
  this.appendChunk(chunk);
80
194
  });
@@ -121,7 +235,7 @@ var SerializationModel = class {
121
235
  updateChunk(chunk) {
122
236
  const index = this._chunks.findIndex((c) => c.id === chunk.id);
123
237
  invariant(index !== -1, void 0, {
124
- F: __dxlog_file,
238
+ F: __dxlog_file2,
125
239
  L: 147,
126
240
  S: this,
127
241
  A: [
@@ -141,7 +255,7 @@ var SerializationModel = class {
141
255
  deleteBlock(id) {
142
256
  const index = this._chunks.findIndex((c) => c.id === id);
143
257
  invariant(index !== -1, void 0, {
144
- F: __dxlog_file,
258
+ F: __dxlog_file2,
145
259
  L: 156,
146
260
  S: this,
147
261
  A: [
@@ -162,10 +276,10 @@ var SerializationModel = class {
162
276
  * Syncs the tracked changes with the ChunkDocument.
163
277
  */
164
278
  sync(document2) {
165
- log("sync", {
279
+ log2("sync", {
166
280
  changes: this._changes
167
281
  }, {
168
- F: __dxlog_file,
282
+ F: __dxlog_file2,
169
283
  L: 167,
170
284
  S: this,
171
285
  C: (f, a) => f(...a)
@@ -218,361 +332,7 @@ var SerializationModel = class {
218
332
  }
219
333
  };
220
334
 
221
- // src/components/Transcript/transcript-extension.ts
222
- var transcript = ({ model, started, renderButton }) => {
223
- return [
224
- // Show timestamps in the gutter.
225
- gutter({
226
- class: "cm-timestamp-gutter",
227
- lineMarkerChange: (update) => update.docChanged || update.viewportChanged,
228
- markers: (view) => {
229
- const start = getStartTime(started, model.chunks[0]);
230
- const builder = new RangeSetBuilder();
231
- for (const { from, to } of view.visibleRanges) {
232
- let line = view.state.doc.lineAt(from);
233
- while (line.from <= to) {
234
- const block = model.getChunkAtLine(line.number)?.blocks[0];
235
- const timestamp = block?._tag === "transcript" && block.started;
236
- if (timestamp) {
237
- builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
238
- }
239
- if (line.to + 1 > view.state.doc.length) {
240
- break;
241
- }
242
- line = view.state.doc.lineAt(line.to + 1);
243
- }
244
- }
245
- return builder.finish();
246
- }
247
- }),
248
- // Listen for model updates.
249
- ViewPlugin.fromClass(class {
250
- constructor(view) {
251
- this._initialized = false;
252
- this._adapter = new DocumentAdapter(view);
253
- const scroller = view.scrollDOM;
254
- let isAutoScrolling = false;
255
- let hasScrolled = false;
256
- let timeout;
257
- const scrollToBottom = (smooth = false) => {
258
- scroller.style.scrollBehavior = smooth ? "smooth" : "";
259
- scroller.classList.add("cm-hide-scrollbar");
260
- isAutoScrolling = true;
261
- clearTimeout(timeout);
262
- timeout = setTimeout(() => {
263
- this._controls?.classList.add("opacity-0");
264
- scroller.classList.remove("cm-hide-scrollbar");
265
- isAutoScrolling = false;
266
- }, 500);
267
- view.dispatch({
268
- effects: EditorView.scrollIntoView(view.state.doc.length, {
269
- y: "end"
270
- })
271
- });
272
- };
273
- if (renderButton) {
274
- this._controls = document.createElement("div");
275
- this._controls.classList.add("cm-controls", "transition-opacity", "duration-300", "opacity-0");
276
- view.dom.appendChild(this._controls);
277
- renderButton(this._controls, {
278
- onClick: () => {
279
- scrollToBottom(false);
280
- }
281
- }, view);
282
- }
283
- this._cleanup = combine(addEventListener(view.scrollDOM, "scroll", () => {
284
- if (!isAutoScrolling) {
285
- hasScrolled = true;
286
- this._controls?.classList.remove("opacity-0");
287
- }
288
- }), model.update.on(() => {
289
- const autoScroll = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight === 0 || !hasScrolled;
290
- model.sync(this._adapter);
291
- if (autoScroll) {
292
- scrollToBottom(true);
293
- }
294
- }));
295
- }
296
- update(update) {
297
- if (!this._initialized) {
298
- this._initialized = true;
299
- setTimeout(() => {
300
- model.sync(this._adapter);
301
- });
302
- }
303
- }
304
- destroy() {
305
- this._controls?.remove();
306
- this._cleanup();
307
- }
308
- }),
309
- EditorView.theme({
310
- ".cm-scroller": {
311
- overflowY: "scroll"
312
- },
313
- ".cm-hide-scrollbar": {
314
- scrollbarWidth: "none",
315
- "-ms-overflow-style": "none"
316
- },
317
- ".cm-hide-scrollbar::-webkit-scrollbar": {
318
- display: "none"
319
- },
320
- ".cm-controls": {
321
- position: "absolute",
322
- bottom: "0.5rem",
323
- right: "0.5rem",
324
- zIndex: 1e3
325
- },
326
- ".cm-line": {
327
- paddingRight: "1rem"
328
- },
329
- ".cm-timestamp-gutter": {
330
- width: "6rem",
331
- paddingRight: "1rem"
332
- },
333
- ".cm-timestamp-gutter > .cm-gutterElement > div": {
334
- display: "inline-flex",
335
- textAlign: "right",
336
- padding: "3px"
337
- }
338
- })
339
- ];
340
- };
341
- var TimestampMarker = class extends GutterMarker {
342
- constructor(_line, _timestamp, _started) {
343
- super(), this._line = _line, this._timestamp = _timestamp, this._started = _started;
344
- }
345
- eq(other) {
346
- return other._timestamp === this._timestamp;
347
- }
348
- toDOM(view) {
349
- const el = document.createElement("div");
350
- el.className = "text-sm text-subdued hover:bg-hoverSurface cursor-pointer";
351
- el.textContent = formatTimestamp(this._timestamp, this._started);
352
- el.onclick = () => {
353
- const pos = view.state.doc.line(this._line).from;
354
- view.dispatch({
355
- effects: EditorView.scrollIntoView(pos, {
356
- y: "start"
357
- })
358
- });
359
- };
360
- return el;
361
- }
362
- };
363
- var getStartTime = (started, message) => {
364
- if (started) {
365
- return started;
366
- }
367
- if (message?.blocks[0]?._tag === "transcript" && message.blocks[0].started) {
368
- return new Date(message.blocks[0].started);
369
- }
370
- return void 0;
371
- };
372
- var formatTimestamp = (timestamp, relative) => {
373
- if (relative) {
374
- const pad = (n = 0) => String(n).padStart(2, "0");
375
- const { hours, minutes, seconds } = intervalToDuration({
376
- start: relative,
377
- end: timestamp
378
- });
379
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
380
- } else {
381
- return format(timestamp, "HH:mm:ss");
382
- }
383
- };
384
-
385
- // src/components/Transcript/Transcript.tsx
386
- var renderMarkdown = (identities) => (message, index, debug = false) => {
387
- if (message.sender.role === "assistant") {
388
- return [
389
- message.blocks.find((block) => block._tag === "transcript")?.text ?? "",
390
- ""
391
- ];
392
- }
393
- const identity = identities.find((identity2) => identity2.did === message.sender.identityDid);
394
- const name = identity?.profile?.displayName ?? message.sender.contact?.target?.fullName ?? message.sender.name ?? message.sender.email ?? message.sender.identityDid;
395
- const blocks = message.blocks.filter((block) => block._tag === "transcript");
396
- return [
397
- `###### ${name}` + (debug ? ` [${index}]:${message.id}` : ""),
398
- blocks.map((block) => block.text.trim()).join(" "),
399
- ""
400
- ];
401
- };
402
- var Transcript = ({ classNames, transcript: object, space, model, attendableId, ignoreAttention }) => {
403
- var _effect = _useSignals();
404
- try {
405
- const { themeMode } = useThemeContext();
406
- const { parentRef } = useTextEditor(() => {
407
- return {
408
- extensions: [
409
- createBasicExtensions({
410
- readOnly: true,
411
- lineWrapping: true
412
- }),
413
- createMarkdownExtensions({
414
- themeMode
415
- }),
416
- createThemeExtensions({
417
- themeMode
418
- }),
419
- decorateMarkdown(),
420
- space && preview(),
421
- transcript({
422
- model,
423
- started: object?.started ? new Date(object.started) : void 0,
424
- renderButton: createRenderer(({ onClick }) => /* @__PURE__ */ React.createElement(IconButton, {
425
- icon: "ph--arrow-line-down--regular",
426
- iconOnly: true,
427
- label: "Scroll to bottom",
428
- onClick
429
- }))
430
- })
431
- ].filter(isNotFalsy)
432
- };
433
- }, [
434
- space,
435
- model
436
- ]);
437
- return /* @__PURE__ */ React.createElement("div", {
438
- ref: parentRef,
439
- className: mx("flex grow overflow-hidden", editorWidth, classNames),
440
- "data-popover-collision-boundary": true
441
- });
442
- } finally {
443
- _effect.f();
444
- }
445
- };
446
-
447
- // src/hooks/useAudioFile.ts
448
- import { useEffect, useState } from "react";
449
- import { scheduleTask } from "@dxos/async";
450
- import { Context } from "@dxos/context";
451
- import { log as log2 } from "@dxos/log";
452
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
453
- var useAudioFile = (audioUrl, constraints) => {
454
- const [{ audio, stream, track }, setStream] = useState({});
455
- useEffect(() => {
456
- const ctx = new Context(void 0, {
457
- F: __dxlog_file2,
458
- L: 20
459
- });
460
- scheduleTask(ctx, async () => {
461
- const response = await fetch(audioUrl);
462
- const blob = await response.blob();
463
- const objectUrl = URL.createObjectURL(blob);
464
- ctx.onDispose(() => {
465
- URL.revokeObjectURL(objectUrl);
466
- });
467
- const audio2 = new Audio();
468
- audio2.src = objectUrl;
469
- await new Promise((resolve, reject) => {
470
- audio2.addEventListener("error", (err) => {
471
- log2.error("error", {
472
- err
473
- }, {
474
- F: __dxlog_file2,
475
- L: 37,
476
- S: void 0,
477
- C: (f, a) => f(...a)
478
- });
479
- reject(err);
480
- }, {
481
- once: true
482
- });
483
- audio2.addEventListener("canplay", async () => {
484
- log2.info("starting...", void 0, {
485
- F: __dxlog_file2,
486
- L: 45,
487
- S: void 0,
488
- C: (f, a) => f(...a)
489
- });
490
- try {
491
- await audio2.play();
492
- resolve();
493
- } catch (playError) {
494
- log2.error("Play failed", {
495
- playError
496
- }, {
497
- F: __dxlog_file2,
498
- L: 51,
499
- S: void 0,
500
- C: (f, a) => f(...a)
501
- });
502
- resolve();
503
- }
504
- }, {
505
- once: true
506
- });
507
- audio2.load();
508
- });
509
- const audioCtx = new AudioContext();
510
- if (audioCtx.state === "suspended") {
511
- await audioCtx.resume();
512
- }
513
- const destination = audioCtx.createMediaStreamDestination();
514
- destination.channelCount = 1;
515
- const source = audioCtx.createMediaElementSource(audio2);
516
- source.connect(destination);
517
- const track2 = destination.stream.getAudioTracks()[0];
518
- if (constraints) {
519
- await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, {
520
- F: __dxlog_file2,
521
- L: 75,
522
- S: void 0,
523
- C: (f, a) => f(...a)
524
- }));
525
- }
526
- setStream({
527
- audio: audio2,
528
- stream: destination.stream,
529
- track: destination.stream.getAudioTracks()[0]
530
- });
531
- });
532
- return () => {
533
- void ctx.dispose();
534
- };
535
- }, [
536
- audioUrl
537
- ]);
538
- return {
539
- audio,
540
- stream,
541
- track
542
- };
543
- };
544
-
545
- // src/hooks/useAudioTrack.ts
546
- import { useEffect as useEffect2, useState as useState2 } from "react";
547
- var useAudioTrack = (active, constraints) => {
548
- const [track, setTrack] = useState2();
549
- useEffect2(() => {
550
- if (!active) {
551
- track?.stop();
552
- setTrack(void 0);
553
- return;
554
- }
555
- const initAudio = async () => {
556
- const audio = new Audio();
557
- audio.srcObject = await navigator.mediaDevices.getUserMedia({
558
- audio: constraints ?? true
559
- });
560
- const [track2] = audio.srcObject.getAudioTracks();
561
- if (track2) {
562
- setTrack(track2);
563
- }
564
- };
565
- if (active) {
566
- void initAudio();
567
- }
568
- }, [
569
- active
570
- ]);
571
- return track;
572
- };
573
-
574
335
  // src/hooks/useQueueModelAdapter.ts
575
- import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
576
336
  var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
577
337
  const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
578
338
  queue
@@ -622,15 +382,7 @@ var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
622
382
 
623
383
  // src/hooks/useTranscriber.ts
624
384
  import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
625
- import { useCapabilities } from "@dxos/app-framework";
626
-
627
- // src/capabilities/index.ts
628
- import { lazy } from "@dxos/app-framework";
629
- var IntentResolver = lazy(() => import("./intent-resolver-YMN5SXNC.mjs"));
630
- var ReactSurface = lazy(() => import("./react-surface-QRDJOHN5.mjs"));
631
- var Transcriber = lazy(() => import("./transcriber-YUTEVANE.mjs"));
632
-
633
- // src/hooks/useTranscriber.ts
385
+ import { useCapabilities } from "@dxos/app-framework/ui";
634
386
  var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments }) => {
635
387
  const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
636
388
  const transcriber = useMemo2(() => {
@@ -661,7 +413,7 @@ var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onS
661
413
  };
662
414
 
663
415
  // src/hooks/useVoiceInput.ts
664
- import { useState as useState4, useEffect as useEffect5, useCallback } from "react";
416
+ import { useCallback, useEffect as useEffect5, useState as useState4 } from "react";
665
417
  import { scheduleMicroTask } from "@dxos/async";
666
418
  import { Context as Context2 } from "@dxos/context";
667
419
  import { log as log3 } from "@dxos/log";
@@ -683,14 +435,14 @@ var useVoiceInput = ({ active, onUpdate }) => {
683
435
  useEffect5(() => {
684
436
  const ctx = new Context2(void 0, {
685
437
  F: __dxlog_file3,
686
- L: 43
438
+ L: 44
687
439
  });
688
440
  scheduleMicroTask(ctx, async () => {
689
441
  if (active && transcriber) {
690
442
  await transcriber.open();
691
443
  log3.info("starting...", void 0, {
692
444
  F: __dxlog_file3,
693
- L: 47,
445
+ L: 48,
694
446
  S: void 0,
695
447
  C: (f, a) => f(...a)
696
448
  });
@@ -702,7 +454,7 @@ var useVoiceInput = ({ active, onUpdate }) => {
702
454
  await transcriber?.close();
703
455
  log3.info("stopped", void 0, {
704
456
  F: __dxlog_file3,
705
- L: 54,
457
+ L: 55,
706
458
  S: void 0,
707
459
  C: (f, a) => f(...a)
708
460
  });
@@ -722,43 +474,226 @@ var useVoiceInput = ({ active, onUpdate }) => {
722
474
  };
723
475
  };
724
476
 
725
- // src/components/TranscriptContainer.tsx
726
- var TranscriptionContainer = ({ transcript: transcript2 }) => {
727
- var _effect = _useSignals2();
728
- try {
729
- const attendableId = fullyQualifiedId(transcript2);
730
- const space = getSpace(transcript2);
731
- const members = useMembers(space?.key).map((member) => member.identity);
732
- const queue = useQueue(transcript2.queue.dxn, {
733
- pollInterval: 1e3
477
+ // src/components/Transcript/Transcript.tsx
478
+ import React from "react";
479
+ import { useThemeContext } from "@dxos/react-ui";
480
+ import { useTextEditor } from "@dxos/react-ui-editor";
481
+ import { autoScroll, createBasicExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown, editorSlots, preview } from "@dxos/ui-editor";
482
+ import { mx } from "@dxos/ui-theme";
483
+ import { isTruthy } from "@dxos/util";
484
+
485
+ // src/components/Transcript/transcript-extension.ts
486
+ import { RangeSetBuilder } from "@codemirror/state";
487
+ import { EditorView, GutterMarker, ViewPlugin, gutter } from "@codemirror/view";
488
+ import { format } from "date-fns/format";
489
+ import { intervalToDuration } from "date-fns/intervalToDuration";
490
+ import { addEventListener, combine } from "@dxos/async";
491
+ var transcript = ({ model, started }) => {
492
+ return [
493
+ // Show timestamps in the gutter.
494
+ gutter({
495
+ class: "cm-timestamp-gutter",
496
+ lineMarkerChange: (update) => update.docChanged || update.viewportChanged,
497
+ markers: (view) => {
498
+ const start = getStartTime(started, model.chunks[0]);
499
+ const builder = new RangeSetBuilder();
500
+ for (const { from, to } of view.visibleRanges) {
501
+ let line = view.state.doc.lineAt(from);
502
+ while (line.from <= to) {
503
+ const block = model.getChunkAtLine(line.number)?.blocks[0];
504
+ const timestamp = block?._tag === "transcript" && block.started;
505
+ if (timestamp) {
506
+ builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
507
+ }
508
+ if (line.to + 1 > view.state.doc.length) {
509
+ break;
510
+ }
511
+ line = view.state.doc.lineAt(line.to + 1);
512
+ }
513
+ }
514
+ return builder.finish();
515
+ }
516
+ }),
517
+ // Listen for model updates.
518
+ ViewPlugin.fromClass(class {
519
+ _controls;
520
+ _cleanup;
521
+ _adapter;
522
+ _initialized = false;
523
+ constructor(view) {
524
+ this._adapter = new DocumentAdapter(view);
525
+ const scroller = view.scrollDOM;
526
+ let isAutoScrolling = false;
527
+ let hasScrolled = false;
528
+ let timeout;
529
+ const scrollToBottom = (smooth = false) => {
530
+ scroller.style.scrollBehavior = smooth ? "smooth" : "";
531
+ scroller.classList.add("cm-hide-scrollbar");
532
+ isAutoScrolling = true;
533
+ clearTimeout(timeout);
534
+ timeout = setTimeout(() => {
535
+ this._controls?.classList.add("opacity-0");
536
+ scroller.classList.remove("cm-hide-scrollbar");
537
+ isAutoScrolling = false;
538
+ }, 500);
539
+ view.dispatch({
540
+ effects: EditorView.scrollIntoView(view.state.doc.length, {
541
+ y: "end"
542
+ })
543
+ });
544
+ };
545
+ this._cleanup = combine(addEventListener(view.scrollDOM, "scroll", () => {
546
+ if (!isAutoScrolling) {
547
+ hasScrolled = true;
548
+ this._controls?.classList.remove("opacity-0");
549
+ }
550
+ }), model.update.on(() => {
551
+ const autoScroll2 = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight === 0 || !hasScrolled;
552
+ model.sync(this._adapter);
553
+ if (autoScroll2) {
554
+ scrollToBottom(true);
555
+ }
556
+ }));
557
+ }
558
+ update(_update) {
559
+ if (!this._initialized) {
560
+ this._initialized = true;
561
+ setTimeout(() => {
562
+ model.sync(this._adapter);
563
+ });
564
+ }
565
+ }
566
+ destroy() {
567
+ this._controls?.remove();
568
+ this._cleanup();
569
+ }
570
+ }),
571
+ EditorView.theme({
572
+ ".cm-gutters": {
573
+ backgroundColor: "var(--dx-baseSurface)"
574
+ },
575
+ ".cm-timestamp-gutter": {
576
+ width: "6rem",
577
+ paddingLeft: "0.5rem",
578
+ paddingRight: "1rem"
579
+ },
580
+ ".cm-timestamp-gutter > .cm-gutterElement > div": {
581
+ display: "inline-flex",
582
+ textAlign: "right",
583
+ padding: "3px"
584
+ }
585
+ })
586
+ ];
587
+ };
588
+ var TimestampMarker = class extends GutterMarker {
589
+ _line;
590
+ _timestamp;
591
+ _started;
592
+ constructor(_line, _timestamp, _started) {
593
+ super(), this._line = _line, this._timestamp = _timestamp, this._started = _started;
594
+ }
595
+ eq(other) {
596
+ return this._timestamp === other._timestamp;
597
+ }
598
+ toDOM(view) {
599
+ const el = document.createElement("div");
600
+ el.className = "text-sm text-subdued hover:bg-hoverSurface cursor-pointer";
601
+ el.textContent = formatTimestamp(this._timestamp, this._started);
602
+ el.onclick = () => {
603
+ const pos = view.state.doc.line(this._line).from;
604
+ view.dispatch({
605
+ effects: EditorView.scrollIntoView(pos, {
606
+ y: "start"
607
+ })
608
+ });
609
+ };
610
+ return el;
611
+ }
612
+ };
613
+ var getStartTime = (started, message) => {
614
+ if (started) {
615
+ return started;
616
+ }
617
+ if (message?.blocks[0]?._tag === "transcript" && message.blocks[0].started) {
618
+ return new Date(message.blocks[0].started);
619
+ }
620
+ return void 0;
621
+ };
622
+ var formatTimestamp = (timestamp, relative) => {
623
+ if (relative) {
624
+ const pad = (n = 0) => String(n).padStart(2, "0");
625
+ const { hours, minutes, seconds } = intervalToDuration({
626
+ start: relative,
627
+ end: timestamp
734
628
  });
735
- const model = useQueueModelAdapter(renderMarkdown(members), queue);
736
- return /* @__PURE__ */ React2.createElement(StackItem.Content, {
737
- classNames: "container-max-width pli-2"
738
- }, /* @__PURE__ */ React2.createElement(Transcript, {
739
- attendableId,
740
- space,
741
- model,
742
- transcript: transcript2
743
- }));
744
- } finally {
745
- _effect.f();
629
+ return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
630
+ } else {
631
+ return format(timestamp, "HH:mm:ss");
746
632
  }
747
633
  };
634
+
635
+ // src/components/Transcript/Transcript.tsx
636
+ var TranscriptView = ({ classNames, transcript: object, model }) => {
637
+ const { themeMode } = useThemeContext();
638
+ const { parentRef } = useTextEditor(() => {
639
+ return {
640
+ extensions: [
641
+ createBasicExtensions({
642
+ readOnly: true,
643
+ lineWrapping: true,
644
+ search: true
645
+ }),
646
+ createMarkdownExtensions(),
647
+ createThemeExtensions({
648
+ themeMode,
649
+ slots: editorSlots
650
+ }),
651
+ decorateMarkdown(),
652
+ preview(),
653
+ transcript({
654
+ model,
655
+ started: object?.started ? new Date(object.started) : void 0
656
+ }),
657
+ autoScroll()
658
+ ].filter(isTruthy)
659
+ };
660
+ }, [
661
+ model
662
+ ]);
663
+ return /* @__PURE__ */ React.createElement("div", {
664
+ ref: parentRef,
665
+ className: mx("flex grow overflow-hidden container-max-width", classNames),
666
+ "data-popover-collision-boundary": true
667
+ });
668
+ };
669
+
670
+ // src/components/TranscriptContainer.tsx
671
+ var TranscriptionContainer = ({ role, subject: transcript2 }) => {
672
+ const attendableId = Obj.getDXN(transcript2).toString();
673
+ const db = Obj.getDatabase(transcript2);
674
+ const members = useMembers(db?.spaceId).map((member) => member.identity);
675
+ const queue = useQueue(transcript2.queue.dxn, {
676
+ pollInterval: 1e3
677
+ });
678
+ const model = useQueueModelAdapter(renderByline(members), queue);
679
+ return /* @__PURE__ */ React2.createElement(Layout.Main, {
680
+ role
681
+ }, /* @__PURE__ */ React2.createElement(TranscriptView, {
682
+ attendableId,
683
+ model,
684
+ transcript: transcript2
685
+ }));
686
+ };
748
687
  var TranscriptContainer_default = TranscriptionContainer;
749
688
 
750
689
  export {
751
- renderMarkdown,
752
- Transcript,
690
+ TranscriptView,
753
691
  useAudioFile,
754
692
  useAudioTrack,
755
693
  useQueueModelAdapter,
756
694
  useTranscriber,
757
695
  useVoiceInput,
758
696
  TranscriptionContainer,
759
- TranscriptContainer_default,
760
- IntentResolver,
761
- ReactSurface,
762
- Transcriber
697
+ TranscriptContainer_default
763
698
  };
764
- //# sourceMappingURL=chunk-TJKAO7VR.mjs.map
699
+ //# sourceMappingURL=chunk-TIUYXGQN.mjs.map