@deepgram/sdk 3.3.4 → 3.4.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 (300) hide show
  1. package/README.md +129 -9
  2. package/dist/main/DeepgramClient.d.ts +65 -12
  3. package/dist/main/DeepgramClient.d.ts.map +1 -1
  4. package/dist/main/DeepgramClient.js +73 -18
  5. package/dist/main/DeepgramClient.js.map +1 -1
  6. package/dist/main/index.d.ts +13 -4
  7. package/dist/main/index.d.ts.map +1 -1
  8. package/dist/main/index.js +18 -8
  9. package/dist/main/index.js.map +1 -1
  10. package/dist/main/lib/constants.d.ts +16 -7
  11. package/dist/main/lib/constants.d.ts.map +1 -1
  12. package/dist/main/lib/constants.js +26 -9
  13. package/dist/main/lib/constants.js.map +1 -1
  14. package/dist/main/lib/enums/LiveConnectionState.d.ts +5 -0
  15. package/dist/main/lib/enums/LiveConnectionState.d.ts.map +1 -1
  16. package/dist/main/lib/enums/LiveConnectionState.js +5 -0
  17. package/dist/main/lib/enums/LiveConnectionState.js.map +1 -1
  18. package/dist/main/lib/enums/LiveTranscriptionEvents.d.ts +24 -3
  19. package/dist/main/lib/enums/LiveTranscriptionEvents.d.ts.map +1 -1
  20. package/dist/main/lib/enums/LiveTranscriptionEvents.js +23 -2
  21. package/dist/main/lib/enums/LiveTranscriptionEvents.js.map +1 -1
  22. package/dist/main/lib/enums/index.d.ts +2 -2
  23. package/dist/main/lib/enums/index.d.ts.map +1 -1
  24. package/dist/main/lib/enums/index.js +16 -5
  25. package/dist/main/lib/enums/index.js.map +1 -1
  26. package/dist/main/lib/fetch.d.ts +19 -1
  27. package/dist/main/lib/fetch.d.ts.map +1 -1
  28. package/dist/main/lib/fetch.js +19 -1
  29. package/dist/main/lib/fetch.js.map +1 -1
  30. package/dist/main/lib/helpers.d.ts +9 -5
  31. package/dist/main/lib/helpers.d.ts.map +1 -1
  32. package/dist/main/lib/helpers.js +82 -7
  33. package/dist/main/lib/helpers.js.map +1 -1
  34. package/dist/main/lib/types/CreateProjectKeySchema.d.ts +0 -1
  35. package/dist/main/lib/types/CreateProjectKeySchema.d.ts.map +1 -1
  36. package/dist/main/lib/types/DeepgramClientOptions.d.ts +75 -8
  37. package/dist/main/lib/types/DeepgramClientOptions.d.ts.map +1 -1
  38. package/dist/main/lib/types/Fetch.d.ts +3 -13
  39. package/dist/main/lib/types/Fetch.d.ts.map +1 -1
  40. package/dist/main/lib/types/LiveConfigOptions.d.ts +6 -3
  41. package/dist/main/lib/types/LiveConfigOptions.d.ts.map +1 -1
  42. package/dist/main/lib/types/SyncPrerecordedResponse.d.ts +1 -0
  43. package/dist/main/lib/types/SyncPrerecordedResponse.d.ts.map +1 -1
  44. package/dist/main/lib/types/TranscriptionSchema.d.ts +0 -1
  45. package/dist/main/lib/types/TranscriptionSchema.d.ts.map +1 -1
  46. package/dist/main/lib/types/UpdateProjectMemberScopeSchema.d.ts +1 -1
  47. package/dist/main/lib/types/UpdateProjectMemberScopeSchema.d.ts.map +1 -1
  48. package/dist/main/lib/types/UpdateProjectSchema.d.ts +0 -1
  49. package/dist/main/lib/types/UpdateProjectSchema.d.ts.map +1 -1
  50. package/dist/main/lib/types/index.d.ts +39 -39
  51. package/dist/main/lib/types/index.d.ts.map +1 -1
  52. package/dist/main/lib/types/index.js +53 -0
  53. package/dist/main/lib/types/index.js.map +1 -1
  54. package/dist/main/lib/version.d.ts +1 -1
  55. package/dist/main/lib/version.js +1 -1
  56. package/dist/main/packages/AbstractClient.d.ts +63 -10
  57. package/dist/main/packages/AbstractClient.d.ts.map +1 -1
  58. package/dist/main/packages/AbstractClient.js +103 -50
  59. package/dist/main/packages/AbstractClient.js.map +1 -1
  60. package/dist/main/packages/AbstractLiveClient.d.ts +114 -0
  61. package/dist/main/packages/AbstractLiveClient.d.ts.map +1 -0
  62. package/dist/main/packages/AbstractLiveClient.js +238 -0
  63. package/dist/main/packages/AbstractLiveClient.js.map +1 -0
  64. package/dist/main/packages/AbstractRestClient.d.ts +105 -0
  65. package/dist/main/packages/AbstractRestClient.d.ts.map +1 -0
  66. package/dist/main/packages/AbstractRestClient.js +185 -0
  67. package/dist/main/packages/AbstractRestClient.js.map +1 -0
  68. package/dist/main/packages/ListenClient.d.ts +21 -4
  69. package/dist/main/packages/ListenClient.d.ts.map +1 -1
  70. package/dist/main/packages/ListenClient.js +25 -5
  71. package/dist/main/packages/ListenClient.js.map +1 -1
  72. package/dist/main/packages/ListenLiveClient.d.ts +58 -0
  73. package/dist/main/packages/ListenLiveClient.d.ts.map +1 -0
  74. package/dist/main/packages/ListenLiveClient.js +119 -0
  75. package/dist/main/packages/ListenLiveClient.js.map +1 -0
  76. package/dist/main/packages/ListenRestClient.d.ts +57 -0
  77. package/dist/main/packages/ListenRestClient.d.ts.map +1 -0
  78. package/dist/main/packages/ListenRestClient.js +167 -0
  79. package/dist/main/packages/ListenRestClient.js.map +1 -0
  80. package/dist/main/packages/ManageRestClient.d.ts +286 -0
  81. package/dist/main/packages/ManageRestClient.d.ts.map +1 -0
  82. package/dist/main/packages/ManageRestClient.js +628 -0
  83. package/dist/main/packages/ManageRestClient.js.map +1 -0
  84. package/dist/main/packages/ReadRestClient.d.ts +57 -0
  85. package/dist/main/packages/ReadRestClient.d.ts.map +1 -0
  86. package/dist/main/packages/ReadRestClient.js +165 -0
  87. package/dist/main/packages/ReadRestClient.js.map +1 -0
  88. package/dist/main/packages/SelfHostedRestClient.d.ts +47 -0
  89. package/dist/main/packages/SelfHostedRestClient.d.ts.map +1 -0
  90. package/dist/main/packages/SelfHostedRestClient.js +120 -0
  91. package/dist/main/packages/SelfHostedRestClient.js.map +1 -0
  92. package/dist/main/packages/SpeakRestClient.d.ts +36 -0
  93. package/dist/main/packages/SpeakRestClient.d.ts.map +1 -0
  94. package/dist/main/packages/SpeakRestClient.js +84 -0
  95. package/dist/main/packages/SpeakRestClient.js.map +1 -0
  96. package/dist/main/packages/index.d.ts +10 -8
  97. package/dist/main/packages/index.d.ts.map +1 -1
  98. package/dist/main/packages/index.js +24 -17
  99. package/dist/main/packages/index.js.map +1 -1
  100. package/dist/module/DeepgramClient.d.ts +65 -12
  101. package/dist/module/DeepgramClient.d.ts.map +1 -1
  102. package/dist/module/DeepgramClient.js +72 -17
  103. package/dist/module/DeepgramClient.js.map +1 -1
  104. package/dist/module/index.d.ts +13 -4
  105. package/dist/module/index.d.ts.map +1 -1
  106. package/dist/module/index.js +18 -8
  107. package/dist/module/index.js.map +1 -1
  108. package/dist/module/lib/constants.d.ts +16 -7
  109. package/dist/module/lib/constants.d.ts.map +1 -1
  110. package/dist/module/lib/constants.js +26 -9
  111. package/dist/module/lib/constants.js.map +1 -1
  112. package/dist/module/lib/enums/LiveConnectionState.d.ts +5 -0
  113. package/dist/module/lib/enums/LiveConnectionState.d.ts.map +1 -1
  114. package/dist/module/lib/enums/LiveConnectionState.js +5 -0
  115. package/dist/module/lib/enums/LiveConnectionState.js.map +1 -1
  116. package/dist/module/lib/enums/LiveTranscriptionEvents.d.ts +24 -3
  117. package/dist/module/lib/enums/LiveTranscriptionEvents.d.ts.map +1 -1
  118. package/dist/module/lib/enums/LiveTranscriptionEvents.js +23 -2
  119. package/dist/module/lib/enums/LiveTranscriptionEvents.js.map +1 -1
  120. package/dist/module/lib/enums/index.d.ts +2 -2
  121. package/dist/module/lib/enums/index.d.ts.map +1 -1
  122. package/dist/module/lib/enums/index.js +2 -2
  123. package/dist/module/lib/enums/index.js.map +1 -1
  124. package/dist/module/lib/fetch.d.ts +19 -1
  125. package/dist/module/lib/fetch.d.ts.map +1 -1
  126. package/dist/module/lib/fetch.js +19 -1
  127. package/dist/module/lib/fetch.js.map +1 -1
  128. package/dist/module/lib/helpers.d.ts +9 -5
  129. package/dist/module/lib/helpers.d.ts.map +1 -1
  130. package/dist/module/lib/helpers.js +75 -4
  131. package/dist/module/lib/helpers.js.map +1 -1
  132. package/dist/module/lib/types/CreateProjectKeySchema.d.ts +0 -1
  133. package/dist/module/lib/types/CreateProjectKeySchema.d.ts.map +1 -1
  134. package/dist/module/lib/types/DeepgramClientOptions.d.ts +75 -8
  135. package/dist/module/lib/types/DeepgramClientOptions.d.ts.map +1 -1
  136. package/dist/module/lib/types/Fetch.d.ts +3 -13
  137. package/dist/module/lib/types/Fetch.d.ts.map +1 -1
  138. package/dist/module/lib/types/LiveConfigOptions.d.ts +6 -3
  139. package/dist/module/lib/types/LiveConfigOptions.d.ts.map +1 -1
  140. package/dist/module/lib/types/SyncPrerecordedResponse.d.ts +1 -0
  141. package/dist/module/lib/types/SyncPrerecordedResponse.d.ts.map +1 -1
  142. package/dist/module/lib/types/TranscriptionSchema.d.ts +0 -1
  143. package/dist/module/lib/types/TranscriptionSchema.d.ts.map +1 -1
  144. package/dist/module/lib/types/UpdateProjectMemberScopeSchema.d.ts +1 -1
  145. package/dist/module/lib/types/UpdateProjectMemberScopeSchema.d.ts.map +1 -1
  146. package/dist/module/lib/types/UpdateProjectSchema.d.ts +0 -1
  147. package/dist/module/lib/types/UpdateProjectSchema.d.ts.map +1 -1
  148. package/dist/module/lib/types/index.d.ts +39 -39
  149. package/dist/module/lib/types/index.d.ts.map +1 -1
  150. package/dist/module/lib/types/index.js +39 -1
  151. package/dist/module/lib/types/index.js.map +1 -1
  152. package/dist/module/lib/version.d.ts +1 -1
  153. package/dist/module/lib/version.js +1 -1
  154. package/dist/module/packages/AbstractClient.d.ts +63 -10
  155. package/dist/module/packages/AbstractClient.d.ts.map +1 -1
  156. package/dist/module/packages/AbstractClient.js +99 -50
  157. package/dist/module/packages/AbstractClient.js.map +1 -1
  158. package/dist/module/packages/AbstractLiveClient.d.ts +114 -0
  159. package/dist/module/packages/AbstractLiveClient.d.ts.map +1 -0
  160. package/dist/module/packages/AbstractLiveClient.js +211 -0
  161. package/dist/module/packages/AbstractLiveClient.js.map +1 -0
  162. package/dist/module/packages/AbstractRestClient.d.ts +105 -0
  163. package/dist/module/packages/AbstractRestClient.d.ts.map +1 -0
  164. package/dist/module/packages/AbstractRestClient.js +178 -0
  165. package/dist/module/packages/AbstractRestClient.js.map +1 -0
  166. package/dist/module/packages/ListenClient.d.ts +21 -4
  167. package/dist/module/packages/ListenClient.d.ts.map +1 -1
  168. package/dist/module/packages/ListenClient.js +25 -5
  169. package/dist/module/packages/ListenClient.js.map +1 -1
  170. package/dist/module/packages/ListenLiveClient.d.ts +58 -0
  171. package/dist/module/packages/ListenLiveClient.d.ts.map +1 -0
  172. package/dist/module/packages/ListenLiveClient.js +115 -0
  173. package/dist/module/packages/ListenLiveClient.js.map +1 -0
  174. package/dist/module/packages/ListenRestClient.d.ts +57 -0
  175. package/dist/module/packages/ListenRestClient.d.ts.map +1 -0
  176. package/dist/module/packages/ListenRestClient.js +163 -0
  177. package/dist/module/packages/ListenRestClient.js.map +1 -0
  178. package/dist/module/packages/ManageRestClient.d.ts +286 -0
  179. package/dist/module/packages/ManageRestClient.d.ts.map +1 -0
  180. package/dist/module/packages/ManageRestClient.js +624 -0
  181. package/dist/module/packages/ManageRestClient.js.map +1 -0
  182. package/dist/module/packages/ReadRestClient.d.ts +57 -0
  183. package/dist/module/packages/ReadRestClient.d.ts.map +1 -0
  184. package/dist/module/packages/ReadRestClient.js +161 -0
  185. package/dist/module/packages/ReadRestClient.js.map +1 -0
  186. package/dist/module/packages/SelfHostedRestClient.d.ts +47 -0
  187. package/dist/module/packages/SelfHostedRestClient.d.ts.map +1 -0
  188. package/dist/module/packages/SelfHostedRestClient.js +116 -0
  189. package/dist/module/packages/SelfHostedRestClient.js.map +1 -0
  190. package/dist/module/packages/SpeakRestClient.d.ts +36 -0
  191. package/dist/module/packages/SpeakRestClient.d.ts.map +1 -0
  192. package/dist/module/packages/SpeakRestClient.js +80 -0
  193. package/dist/module/packages/SpeakRestClient.js.map +1 -0
  194. package/dist/module/packages/index.d.ts +10 -8
  195. package/dist/module/packages/index.d.ts.map +1 -1
  196. package/dist/module/packages/index.js +10 -8
  197. package/dist/module/packages/index.js.map +1 -1
  198. package/dist/umd/deepgram.js +1 -1
  199. package/package.json +8 -6
  200. package/src/DeepgramClient.ts +81 -17
  201. package/src/index.ts +32 -7
  202. package/src/lib/constants.ts +33 -13
  203. package/src/lib/enums/LiveConnectionState.ts +11 -4
  204. package/src/lib/enums/LiveTranscriptionEvents.ts +27 -4
  205. package/src/lib/enums/index.ts +2 -2
  206. package/src/lib/fetch.ts +22 -2
  207. package/src/lib/helpers.ts +98 -9
  208. package/src/lib/types/CreateProjectKeySchema.ts +0 -1
  209. package/src/lib/types/DeepgramClientOptions.ts +75 -11
  210. package/src/lib/types/Fetch.ts +2 -24
  211. package/src/lib/types/LiveConfigOptions.ts +7 -3
  212. package/src/lib/types/SyncPrerecordedResponse.ts +1 -0
  213. package/src/lib/types/TranscriptionSchema.ts +0 -2
  214. package/src/lib/types/UpdateProjectMemberScopeSchema.ts +1 -1
  215. package/src/lib/types/UpdateProjectSchema.ts +0 -1
  216. package/src/lib/types/index.ts +39 -54
  217. package/src/lib/version.ts +1 -1
  218. package/src/packages/AbstractClient.ts +129 -61
  219. package/src/packages/AbstractLiveClient.ts +280 -0
  220. package/src/packages/AbstractRestClient.ts +221 -0
  221. package/src/packages/ListenClient.ts +26 -5
  222. package/src/packages/ListenLiveClient.ts +133 -0
  223. package/src/packages/ListenRestClient.ts +201 -0
  224. package/src/packages/ManageRestClient.ts +760 -0
  225. package/src/packages/ReadRestClient.ts +200 -0
  226. package/src/packages/SelfHostedRestClient.ts +134 -0
  227. package/src/packages/SpeakRestClient.ts +79 -0
  228. package/src/packages/index.ts +10 -8
  229. package/dist/main/packages/AbstractRestfulClient.d.ts +0 -26
  230. package/dist/main/packages/AbstractRestfulClient.d.ts.map +0 -1
  231. package/dist/main/packages/AbstractRestfulClient.js +0 -118
  232. package/dist/main/packages/AbstractRestfulClient.js.map +0 -1
  233. package/dist/main/packages/AbstractWsClient.d.ts +0 -10
  234. package/dist/main/packages/AbstractWsClient.d.ts.map +0 -1
  235. package/dist/main/packages/AbstractWsClient.js +0 -33
  236. package/dist/main/packages/AbstractWsClient.js.map +0 -1
  237. package/dist/main/packages/LiveClient.d.ts +0 -28
  238. package/dist/main/packages/LiveClient.d.ts.map +0 -1
  239. package/dist/main/packages/LiveClient.js +0 -110
  240. package/dist/main/packages/LiveClient.js.map +0 -1
  241. package/dist/main/packages/ManageClient.d.ts +0 -97
  242. package/dist/main/packages/ManageClient.d.ts.map +0 -1
  243. package/dist/main/packages/ManageClient.js +0 -463
  244. package/dist/main/packages/ManageClient.js.map +0 -1
  245. package/dist/main/packages/OnPremClient.d.ts +0 -21
  246. package/dist/main/packages/OnPremClient.d.ts.map +0 -1
  247. package/dist/main/packages/OnPremClient.js +0 -99
  248. package/dist/main/packages/OnPremClient.js.map +0 -1
  249. package/dist/main/packages/PrerecordedClient.d.ts +0 -10
  250. package/dist/main/packages/PrerecordedClient.d.ts.map +0 -1
  251. package/dist/main/packages/PrerecordedClient.js +0 -125
  252. package/dist/main/packages/PrerecordedClient.js.map +0 -1
  253. package/dist/main/packages/ReadClient.d.ts +0 -10
  254. package/dist/main/packages/ReadClient.d.ts.map +0 -1
  255. package/dist/main/packages/ReadClient.js +0 -123
  256. package/dist/main/packages/ReadClient.js.map +0 -1
  257. package/dist/main/packages/SpeakClient.d.ts +0 -12
  258. package/dist/main/packages/SpeakClient.d.ts.map +0 -1
  259. package/dist/main/packages/SpeakClient.js +0 -57
  260. package/dist/main/packages/SpeakClient.js.map +0 -1
  261. package/dist/module/packages/AbstractRestfulClient.d.ts +0 -26
  262. package/dist/module/packages/AbstractRestfulClient.d.ts.map +0 -1
  263. package/dist/module/packages/AbstractRestfulClient.js +0 -114
  264. package/dist/module/packages/AbstractRestfulClient.js.map +0 -1
  265. package/dist/module/packages/AbstractWsClient.d.ts +0 -10
  266. package/dist/module/packages/AbstractWsClient.d.ts.map +0 -1
  267. package/dist/module/packages/AbstractWsClient.js +0 -29
  268. package/dist/module/packages/AbstractWsClient.js.map +0 -1
  269. package/dist/module/packages/LiveClient.d.ts +0 -28
  270. package/dist/module/packages/LiveClient.d.ts.map +0 -1
  271. package/dist/module/packages/LiveClient.js +0 -106
  272. package/dist/module/packages/LiveClient.js.map +0 -1
  273. package/dist/module/packages/ManageClient.d.ts +0 -97
  274. package/dist/module/packages/ManageClient.d.ts.map +0 -1
  275. package/dist/module/packages/ManageClient.js +0 -459
  276. package/dist/module/packages/ManageClient.js.map +0 -1
  277. package/dist/module/packages/OnPremClient.d.ts +0 -21
  278. package/dist/module/packages/OnPremClient.d.ts.map +0 -1
  279. package/dist/module/packages/OnPremClient.js +0 -95
  280. package/dist/module/packages/OnPremClient.js.map +0 -1
  281. package/dist/module/packages/PrerecordedClient.d.ts +0 -10
  282. package/dist/module/packages/PrerecordedClient.d.ts.map +0 -1
  283. package/dist/module/packages/PrerecordedClient.js +0 -121
  284. package/dist/module/packages/PrerecordedClient.js.map +0 -1
  285. package/dist/module/packages/ReadClient.d.ts +0 -10
  286. package/dist/module/packages/ReadClient.d.ts.map +0 -1
  287. package/dist/module/packages/ReadClient.js +0 -119
  288. package/dist/module/packages/ReadClient.js.map +0 -1
  289. package/dist/module/packages/SpeakClient.d.ts +0 -12
  290. package/dist/module/packages/SpeakClient.d.ts.map +0 -1
  291. package/dist/module/packages/SpeakClient.js +0 -53
  292. package/dist/module/packages/SpeakClient.js.map +0 -1
  293. package/src/packages/AbstractRestfulClient.ts +0 -160
  294. package/src/packages/AbstractWsClient.ts +0 -42
  295. package/src/packages/LiveClient.ts +0 -140
  296. package/src/packages/ManageClient.ts +0 -584
  297. package/src/packages/OnPremClient.ts +0 -113
  298. package/src/packages/PrerecordedClient.ts +0 -162
  299. package/src/packages/ReadClient.ts +0 -161
  300. package/src/packages/SpeakClient.ts +0 -50
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.deepgram=t():e.deepgram=t()}(self,(()=>(()=>{var e={993:(e,t,r)=>{"use strict";function n(e){return"transcriptionData"in e}r.r(t),r.d(t,{AssemblyAiConverter:()=>d,DeepgramConverter:()=>l,chunkArray:()=>u,isConverter:()=>n,secondsToTimestamp:()=>c,srt:()=>v,webvtt:()=>f});var i=r(484),s=r.n(i),o=r(576),a=r.n(o);function c(e,t="HH:mm:ss.SSS"){return s()(1e3*e).utc().format(t)}function u(e,t){const r=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);r.push(i)}return r}s().extend(a());class l{constructor(e){this.transcriptionData=e}getLines(e=8){const{results:t}=this.transcriptionData;let r=[];if(t.utterances)t.utterances.forEach((t=>{t.words.length>e?r.push(...u(t.words,e)):r.push(t.words)}));else{const n=t.channels[0].alternatives[0].words,i="speaker"in n[0];let s=[],o=0;n.forEach((t=>{var n;i&&t.speaker!==o&&(r.push(s),s=[]),s.length===e&&(r.push(s),s=[]),i&&(o=null!==(n=t.speaker)&&void 0!==n?n:0),s.push(t)})),r.push(s)}return r}getHeaders(){var e,t,r,n,i,s,o,a;const c=[];return c.push("NOTE"),c.push("Transcription provided by Deepgram"),(null===(e=this.transcriptionData.metadata)||void 0===e?void 0:e.request_id)&&c.push(`Request Id: ${null===(t=this.transcriptionData.metadata)||void 0===t?void 0:t.request_id}`),(null===(r=this.transcriptionData.metadata)||void 0===r?void 0:r.created)&&c.push(`Created: ${null===(n=this.transcriptionData.metadata)||void 0===n?void 0:n.created}`),(null===(i=this.transcriptionData.metadata)||void 0===i?void 0:i.duration)&&c.push(`Duration: ${null===(s=this.transcriptionData.metadata)||void 0===s?void 0:s.duration}`),(null===(o=this.transcriptionData.metadata)||void 0===o?void 0:o.channels)&&c.push(`Channels: ${null===(a=this.transcriptionData.metadata)||void 0===a?void 0:a.channels}`),c}}const h=e=>({word:e.text,start:e.start,end:e.end,confidence:e.confidence,punctuated_word:e.text,speaker:e.speaker});class d{constructor(e){this.transcriptionData=e}getLines(e=8){const t=this.transcriptionData;let r=[];return t.utterances?t.utterances.forEach((t=>{t.words.length>e?r.push(...u(t.words.map((e=>h(e))),e)):r.push(t.words.map((e=>h(e))))})):r.push(...u(t.words.map((e=>h(e))),e)),r}getHeaders(){const e=[];return e.push("NOTE"),e.push("Transcription provided by Assembly AI"),this.transcriptionData.id&&e.push(`Id: ${this.transcriptionData.id}`),this.transcriptionData.audio_duration&&e.push(`Duration: ${this.transcriptionData.audio_duration}`),e}}const p=e=>n(e)?e:new l(e),f=(e,t=8)=>{const r=[];let n=p(e);r.push("WEBVTT"),r.push(""),n.getHeaders&&r.push(n.getHeaders().join("\n")),n.getHeaders&&r.push("");const i=n.getLines(t),s="speaker"in i[0][0];return i.forEach((e=>{const t=e[0],n=e[e.length-1];r.push(`${c(t.start)} --\x3e ${c(n.end)}`);const i=e.map((e=>{var t;return null!==(t=e.punctuated_word)&&void 0!==t?t:e.word})).join(" "),o=s?`<v Speaker ${t.speaker}>`:"";r.push(`${o}${i}`),r.push("")})),r.join("\n")},v=(e,t=8)=>{const r=[];let n=p(e).getLines(t);const i="speaker"in n[0][0];let s,o=1;return n.forEach((e=>{r.push((o++).toString());const t=e[0],n=e[e.length-1];r.push(`${c(t.start,"HH:mm:ss,SSS")} --\x3e ${c(n.end,"HH:mm:ss,SSS")}`);const a=e.map((e=>{var t;return null!==(t=e.punctuated_word)&&void 0!==t?t:e.word})).join(" "),u=i&&s!==t.speaker?`[Speaker ${t.speaker}]\n`:"";r.push(`${u}${a}`),r.push(""),s=t.speaker})),r.join("\n")}},98:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,o="ArrayBuffer"in e;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function v(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var e,t,r,n=p(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=f(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=u(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},d.prototype.delete=function(e){delete this.map[u(e)]},d.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},d.prototype.set=function(e,t){this.map[u(e)]=l(t)},d.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),h(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),h(e)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var r,n,i=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];_.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function O(e,r){return new Promise((function(n,s){var o=new b(e,r);if(o.signal&&o.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}O.polyfill=!0,e.fetch||(e.fetch=O,e.Headers=d,e.Request=b,e.Response=_),t.Headers=d,t.Request=b,t.Response=_,t.fetch=O,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},484:function(e){e.exports=function(){"use strict";var e=6e4,t=36e5,r="millisecond",n="second",i="minute",s="hour",o="day",a="week",c="month",u="quarter",l="year",h="date",d="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},y=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},m={s:y,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+y(n,2,"0")+":"+y(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,c),s=r-i<0,o=t.clone().add(n+(s?-1:1),c);return+(-(n+(r-i)/(s?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:l,w:a,d:o,D:h,h:s,m:i,s:n,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},g="en",b={};b[g]=v;var w="$isDayjsObject",_=function(e){return e instanceof D||!(!e||!e[w])},E=function e(t,r,n){var i;if(!t)return g;if("string"==typeof t){var s=t.toLowerCase();b[s]&&(i=s),r&&(b[s]=r,i=s);var o=t.split("-");if(!i&&o.length>1)return e(o[0])}else{var a=t.name;b[a]=t,i=a}return!n&&i&&(g=i),i||!n&&g},O=function(e,t){if(_(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new D(r)},j=m;j.l=E,j.i=_,j.w=function(e,t){return O(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var D=function(){function v(e){this.$L=E(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var y=v.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(j.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(p);if(n){var i=n[2]-1||0,s=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return j},y.isValid=function(){return!(this.$d.toString()===d)},y.isSame=function(e,t){var r=O(e);return this.startOf(t)<=r&&r<=this.endOf(t)},y.isAfter=function(e,t){return O(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<O(e)},y.$g=function(e,t,r){return j.u(e)?this[t]:this.set(r,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var r=this,u=!!j.u(t)||t,d=j.p(e),p=function(e,t){var n=j.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return u?n:n.endOf(o)},f=function(e,t){return j.w(r.toDate()[e].apply(r.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},v=this.$W,y=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(d){case l:return u?p(1,0):p(31,11);case c:return u?p(1,y):p(0,y+1);case a:var b=this.$locale().weekStart||0,w=(v<b?v+7:v)-b;return p(u?m-w:m+(6-w),y);case o:case h:return f(g+"Hours",0);case s:return f(g+"Minutes",1);case i:return f(g+"Seconds",2);case n:return f(g+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var a,u=j.p(e),d="set"+(this.$u?"UTC":""),p=(a={},a[o]=d+"Date",a[h]=d+"Date",a[c]=d+"Month",a[l]=d+"FullYear",a[s]=d+"Hours",a[i]=d+"Minutes",a[n]=d+"Seconds",a[r]=d+"Milliseconds",a)[u],f=u===o?this.$D+(t-this.$W):t;if(u===c||u===l){var v=this.clone().set(h,1);v.$d[p](f),v.init(),this.$d=v.set(h,Math.min(this.$D,v.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[j.p(e)]()},y.add=function(r,u){var h,d=this;r=Number(r);var p=j.p(u),f=function(e){var t=O(d);return j.w(t.date(t.date()+Math.round(e*r)),d)};if(p===c)return this.set(c,this.$M+r);if(p===l)return this.set(l,this.$y+r);if(p===o)return f(1);if(p===a)return f(7);var v=(h={},h[i]=e,h[s]=t,h[n]=1e3,h)[p]||1,y=this.$d.getTime()+r*v;return j.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||d;var n=e||"YYYY-MM-DDTHH:mm:ssZ",i=j.z(this),s=this.$H,o=this.$m,a=this.$M,c=r.weekdays,u=r.months,l=r.meridiem,h=function(e,r,i,s){return e&&(e[r]||e(t,n))||i[r].slice(0,s)},p=function(e){return j.s(s%12||12,e,"0")},v=l||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(f,(function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return j.s(t.$y,4,"0");case"M":return a+1;case"MM":return j.s(a+1,2,"0");case"MMM":return h(r.monthsShort,a,u,3);case"MMMM":return h(u,a);case"D":return t.$D;case"DD":return j.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(r.weekdaysMin,t.$W,c,2);case"ddd":return h(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return j.s(s,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return v(s,o,!0);case"A":return v(s,o,!1);case"m":return String(o);case"mm":return j.s(o,2,"0");case"s":return String(t.$s);case"ss":return j.s(t.$s,2,"0");case"SSS":return j.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,h,d){var p,f=this,v=j.p(h),y=O(r),m=(y.utcOffset()-this.utcOffset())*e,g=this-y,b=function(){return j.m(f,y)};switch(v){case l:p=b()/12;break;case c:p=b();break;case u:p=b()/3;break;case a:p=(g-m)/6048e5;break;case o:p=(g-m)/864e5;break;case s:p=g/t;break;case i:p=g/e;break;case n:p=g/1e3;break;default:p=g}return d?p:j.a(p)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return b[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=E(e,t,!0);return n&&(r.$L=n),r},y.clone=function(){return j.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},v}(),S=D.prototype;return O.prototype=S,[["$ms",r],["$s",n],["$m",i],["$H",s],["$W",o],["$M",c],["$y",l],["$D",h]].forEach((function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),O.extend=function(e,t){return e.$i||(e(t,D,O),e.$i=!0),O},O.locale=E,O.isDayjs=_,O.unix=function(e){return O(1e3*e)},O.en=b[g],O.Ls=b,O.p={},O}()},576:function(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,i,s){var o=i.prototype;s.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var r=s(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},o.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var a=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),a.call(this,e)};var c=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var u=o.utcOffset;o.utcOffset=function(n,i){var s=this.$utils().u;if(s(n))return this.$u?0:s(this.$offset)?u.call(this):this.$offset;if("string"==typeof n&&(n=function(e){void 0===e&&(e="");var n=e.match(t);if(!n)return null;var i=(""+n[0]).match(r)||["-",0,0],s=i[0],o=60*+i[1]+ +i[2];return 0===o?0:"+"===s?o:-o}(n),null===n))return this;var o=Math.abs(n)<=16?60*n:n,a=this;if(i)return a.$offset=o,a.$u=0===n,a;if(0!==n){var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(o+c,e)).$offset=o,a.$x.$localOffset=c}else a=this.utc();return a};var l=o.format;o.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return l.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var h=o.toDate;o.toDate=function(e){return"s"===e&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var d=o.diff;o.diff=function(e,t,r){if(e&&this.$u===e.$u)return d.call(this,e,t,r);var n=this.local(),i=s(e).local();return d.call(n,i,t,r)}}}()},996:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function i(e,t,r){return e.concat(t).map((function(e){return n(e,r)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||i,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=n;var u=Array.isArray(r);return u===Array.isArray(e)?u?c.arrayMerge(e,r,c):function(e,t,r){var i={};return r.isMergeableObject(e)&&s(e).forEach((function(t){i[t]=n(e[t],r)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&r.isMergeableObject(t[s])?i[s]=function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a}(s,r)(e[s],t[s],r):i[s]=n(t[s],r))})),i}(e,r,c):n(r,c)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return a(e,r,t)}),{})};var c=a;e.exports=c},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,s),n(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):f(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){n.once&&e.removeEventListener(t,i),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=f(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},274:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(752),i=r(910),s=r(685),o=r(412),a=r(581),c=r(693),u=r(733);class l extends i.AbstractClient{get listen(){return new s.ListenClient(this.key,this.options)}get manage(){return new o.ManageClient(this.key,this.options)}get onprem(){return new a.OnPremClient(this.key,this.options)}get read(){return new c.ReadClient(this.key,this.options)}get speak(){return new u.SpeakClient(this.key,this.options)}get transcription(){throw new n.DeepgramVersionError}get projects(){throw new n.DeepgramVersionError}get keys(){throw new n.DeepgramVersionError}get members(){throw new n.DeepgramVersionError}get scopes(){throw new n.DeepgramVersionError}get invitation(){throw new n.DeepgramVersionError}get usage(){throw new n.DeepgramVersionError}get billing(){throw new n.DeepgramVersionError}}t.default=l},341:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.srt=t.webvtt=t.Deepgram=t.DeepgramClient=t.createClient=void 0;const o=s(r(274));t.DeepgramClient=o.default;const a=r(752);t.Deepgram=class{constructor(e,t,r){throw this.apiKey=e,this.apiUrl=t,this.requireSSL=r,new a.DeepgramVersionError}},t.createClient=(e,t={})=>new o.default(e,t),i(r(458),t),i(r(475),t),i(r(57),t),i(r(678),t),i(r(752),t),i(r(610),t);var c=r(993);Object.defineProperty(t,"webvtt",{enumerable:!0,get:function(){return c.webvtt}}),Object.defineProperty(t,"srt",{enumerable:!0,get:function(){return c.srt}})},678:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_OPTIONS=t.DEFAULT_FETCH_OPTIONS=t.DEFAULT_GLOBAL_OPTIONS=t.DEFAULT_URL=t.DEFAULT_HEADERS=t.NODE_VERSION=void 0;const i=r(610),s=r(506);t.NODE_VERSION="undefined"==typeof process?"Unknown":(null===(n=null===process||void 0===process?void 0:process.versions)||void 0===n?void 0:n.node)||"Unknown",t.DEFAULT_HEADERS={"Content-Type":"application/json","X-Client-Info":`@deepgram/sdk; ${(0,i.isBrowser)()?"browser":"server"}; v${s.version}`,"User-Agent":`@deepgram/sdk/${s.version} ${(0,i.isBrowser)()?"javascript":`node/${t.NODE_VERSION}`}`},t.DEFAULT_URL="https://api.deepgram.com",t.DEFAULT_GLOBAL_OPTIONS={url:t.DEFAULT_URL},t.DEFAULT_FETCH_OPTIONS={headers:t.DEFAULT_HEADERS},t.DEFAULT_OPTIONS={global:t.DEFAULT_GLOBAL_OPTIONS,fetch:t.DEFAULT_FETCH_OPTIONS}},615:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveConnectionState=void 0,(r=t.LiveConnectionState||(t.LiveConnectionState={}))[r.CONNECTING=0]="CONNECTING",r[r.OPEN=1]="OPEN",r[r.CLOSING=2]="CLOSING",r[r.CLOSED=3]="CLOSED"},178:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveTranscriptionEvents=void 0,(r=t.LiveTranscriptionEvents||(t.LiveTranscriptionEvents={})).Open="open",r.Close="close",r.Transcript="Results",r.Metadata="Metadata",r.Error="error",r.Warning="warning",r.UtteranceEnd="UtteranceEnd",r.SpeechStarted="SpeechStarted"},57:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LiveTranscriptionEvents=t.LiveConnectionState=void 0;var n=r(615);Object.defineProperty(t,"LiveConnectionState",{enumerable:!0,get:function(){return n.LiveConnectionState}});var i=r(178);Object.defineProperty(t,"LiveTranscriptionEvents",{enumerable:!0,get:function(){return i.LiveTranscriptionEvents}})},752:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeepgramVersionError=t.DeepgramUnknownError=t.DeepgramApiError=t.isDeepgramError=t.DeepgramError=void 0;class r extends Error{constructor(e){super(e),this.__dgError=!0,this.name="DeepgramError"}}t.DeepgramError=r,t.isDeepgramError=function(e){return"object"==typeof e&&null!==e&&"__dgError"in e},t.DeepgramApiError=class extends r{constructor(e,t){super(e),this.name="DeepgramApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}},t.DeepgramUnknownError=class extends r{constructor(e,t){super(e),this.name="DeepgramUnknownError",this.originalError=t}},t.DeepgramVersionError=class extends r{constructor(){super("You are attempting to use an old format for a newer SDK version. Read more here: https://dpgr.am/js-v3"),this.name="DeepgramVersionError"}}},716:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveResponse=t.fetchWithAuth=t.resolveFetch=void 0;const c=a(r(98)),u=r(610);t.resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?c.default:fetch),(...e)=>t(...e)},t.fetchWithAuth=(e,r)=>{const n=(0,t.resolveFetch)(r),i=(0,u.resolveHeadersConstructor)();return(t,r)=>o(void 0,void 0,void 0,(function*(){let s=new i(null==r?void 0:r.headers);return s.has("Authorization")||s.set("Authorization",`Token ${e}`),n(t,Object.assign(Object.assign({},r),{headers:s}))}))},t.resolveResponse=()=>o(void 0,void 0,void 0,(function*(){return"undefined"==typeof Response?(yield Promise.resolve().then((()=>s(r(98))))).Response:Response}))},610:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CallbackUrl=t.isFileSource=t.isTextSource=t.isUrlSource=t.resolveHeadersConstructor=t.appendSearchParams=t.applySettingDefaults=t.isServer=t.isBrowser=t.stripTrailingSlash=void 0;const i=r(98),s=n(r(996));t.stripTrailingSlash=function(e){return e.replace(/\/$/,"")},t.isBrowser=()=>"undefined"!=typeof window,t.isServer=()=>"undefined"!=typeof process,t.applySettingDefaults=function(e,t){return(0,s.default)(t,e)},t.appendSearchParams=function(e,t){Object.keys(t).forEach((r=>{Array.isArray(t[r])?t[r].forEach((t=>{e.append(r,String(t))})):e.append(r,String(t[r]))}))},t.resolveHeadersConstructor=()=>"undefined"==typeof Headers?i.Headers:Headers,t.isUrlSource=e=>!!e.url,t.isTextSource=e=>!!e.text,t.isFileSource=e=>!(!a(e)&&!o(e));const o=e=>!!e,a=e=>!!e;class c extends URL{constructor(){super(...arguments),this.callbackUrl=!0}}t.CallbackUrl=c},475:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractClient=void 0;const n=r(678),i=r(752),s=r(610);t.AbstractClient=class{constructor(e,t){var r,o;if(this.key=e,this.options=t,this.key=e,e||(this.key=process.env.DEEPGRAM_API_KEY),!this.key)throw new i.DeepgramError("A deepgram API key is required");if(this.options=(0,s.applySettingDefaults)(t,n.DEFAULT_OPTIONS),!(null===(r=this.options.global)||void 0===r?void 0:r.url))throw new i.DeepgramError(`An API URL is required. It should be set to ${n.DEFAULT_URL} by default. No idea what happened!`);let a,c=this.options.global.url;if(c.startsWith("http")||c.startsWith("ws")||console.warn("The base URL provided does not begin with http, https, ws, or wss and will default to https as standard."),null===(o=this.options.restProxy)||void 0===o?void 0:o.url){if("proxy"!==this.key)throw new i.DeepgramError('Do not attempt to pass any other API key than the string "proxy" when making proxied REST requests. Please ensure your proxy application is responsible for writing our API key to the Authorization header.');a=this.options.restProxy.url,a.startsWith("http")||a.startsWith("ws")||console.warn("The proxy URL provided does not begin with http, https, ws, or wss and will default to https as standard."),c=a}this.baseUrl=this.resolveBaseUrl(c)}resolveBaseUrl(e){return/^https?:\/\//i.test(e)||(e="https://"+e),new URL((0,s.stripTrailingSlash)(e))}willProxy(){var e;return!!(null===(e=this.options.restProxy)||void 0===e?void 0:e.url)}}},207:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractRestfulClient=void 0;const i=r(752),s=r(716),o=r(910),a=r(610);class c extends o.AbstractClient{constructor(e,t){if(super(e,t),this.key=e,this.options=t,(0,a.isBrowser)()&&!this._willProxy())throw new i.DeepgramError("Due to CORS we are unable to support REST-based API calls to our API from the browser. Please consider using a proxy, and including a `restProxy: { url: ''}` in your Deepgram client options.");this.fetch=(0,s.fetchWithAuth)(this.key,t._experimentalCustomFetch)}_getErrorMessage(e){return e.msg||e.message||e.error_description||e.error||JSON.stringify(e)}handleError(e,t){return n(this,void 0,void 0,(function*(){const r=yield(0,s.resolveResponse)();e instanceof r?e.json().then((r=>{t(new i.DeepgramApiError(this._getErrorMessage(r),e.status||500))})).catch((e=>{t(new i.DeepgramUnknownError(this._getErrorMessage(e),e))})):t(new i.DeepgramUnknownError(this._getErrorMessage(e),e))}))}_getRequestParams(e,t,r,n){var i,s,o;const a=Object.assign(Object.assign({},null===(i=this.options)||void 0===i?void 0:i.fetch),{method:e,headers:Object.assign(Object.assign({},null===(o=null===(s=this.options)||void 0===s?void 0:s.fetch)||void 0===o?void 0:o.headers),t)||{}});return"GET"===e?a:(a.body=n,a.duplex="half",Object.assign(Object.assign({},a),r))}_handleRequest(e,t,r,i,s,o){return n(this,void 0,void 0,(function*(){return new Promise(((n,a)=>{e(r,this._getRequestParams(t,i,s,o)).then((e=>{if(!e.ok)throw e;return e.json()})).then((e=>n(e))).catch((e=>this.handleError(e,a)))}))}))}_handleRawRequest(e,t,r,i,s,o){return n(this,void 0,void 0,(function*(){return new Promise(((n,a)=>{e(r,this._getRequestParams(t,i,s,o)).then((e=>{if(!e.ok)throw e;return e})).then((e=>n(e))).catch((e=>this.handleError(e,a)))}))}))}get(e,t,r,i){return n(this,void 0,void 0,(function*(){return this._handleRequest(e,"GET",t,r,i)}))}post(e,t,r,i,s){return n(this,void 0,void 0,(function*(){return this._handleRequest(e,"POST",t,i,s,r)}))}put(e,t,r,i,s){return n(this,void 0,void 0,(function*(){return this._handleRequest(e,"PUT",t,i,s,r)}))}patch(e,t,r,i,s){return n(this,void 0,void 0,(function*(){return this._handleRequest(e,"PATCH",t,i,s,r)}))}delete(e,t,r,i){return n(this,void 0,void 0,(function*(){return this._handleRequest(e,"DELETE",t,r,i)}))}_willProxy(){var e;return!!(null===(e=this.options.restProxy)||void 0===e?void 0:e.url)}}t.AbstractRestfulClient=c},898:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractWsClient=void 0;const n=r(187),i=r(678),s=r(610);class o extends n.EventEmitter{constructor(e,t=i.DEFAULT_OPTIONS){var r;if(super(),this.key=e,this.options=t,this.key=e,e||(this.key=process.env.DEEPGRAM_API_KEY),!this.key)throw new Error("A deepgram API key is required");if(this.options=(0,s.applySettingDefaults)(t,i.DEFAULT_OPTIONS),!(null===(r=this.options.global)||void 0===r?void 0:r.url))throw new Error(`An API URL is required. It should be set to ${i.DEFAULT_URL} by default. No idea what happened!`);let n=this.options.global.url;/^https?:\/\//i.test(n)||(n="https://"+n),this.baseUrl=new URL((0,s.stripTrailingSlash)(n)),this.baseUrl.protocol=this.baseUrl.protocol.toLowerCase().replace(/(http)(s)?/gi,"ws$2")}}t.AbstractWsClient=o},685:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListenClient=void 0;const n=r(910),i=r(118),s=r(524);class o extends n.AbstractClient{get prerecorded(){return new s.PrerecordedClient(this.key,this.options)}live(e,t="v1/listen"){return new i.LiveClient(this.key,this.options,e,t)}}t.ListenClient=o},118:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LiveClient=void 0;const n=r(898),i=r(610),s=r(752),o=r(678),a=r(57),c=r(840);class u extends n.AbstractWsClient{constructor(e,t=o.DEFAULT_OPTIONS,r={},n="v1/listen"){super(e,t),this.key=e,this.options=t,this.transcriptionOptions=r;const s=new URL(n,this.baseUrl);s.protocol=s.protocol.toLowerCase().replace(/(http)(s)?/gi,"ws$2"),(0,i.appendSearchParams)(s.searchParams,this.transcriptionOptions),this._socket=new c.w3cwebsocket(s.toString(),["token",this.key]),this._socket.onopen=()=>{this.emit(a.LiveTranscriptionEvents.Open,this)},this._socket.onclose=e=>{this.emit(a.LiveTranscriptionEvents.Close,e)},this._socket.onerror=e=>{this.emit(a.LiveTranscriptionEvents.Error,e)},this._socket.onmessage=e=>{try{const t=JSON.parse(e.data.toString());t.type===a.LiveTranscriptionEvents.Metadata&&this.emit(a.LiveTranscriptionEvents.Metadata,t),t.type===a.LiveTranscriptionEvents.Transcript&&this.emit(a.LiveTranscriptionEvents.Transcript,t),t.type===a.LiveTranscriptionEvents.UtteranceEnd&&this.emit(a.LiveTranscriptionEvents.UtteranceEnd,t),t.type===a.LiveTranscriptionEvents.SpeechStarted&&this.emit(a.LiveTranscriptionEvents.SpeechStarted,t)}catch(t){this.emit(a.LiveTranscriptionEvents.Error,{event:e,message:"Unable to parse `data` as JSON.",error:t})}}}configure(e){this._socket.send(JSON.stringify({type:"Configure",processors:e}))}keepAlive(){this._socket.send(JSON.stringify({type:"KeepAlive"}))}getReadyState(){return this._socket.readyState}send(e){if(this._socket.readyState!==a.LiveConnectionState.OPEN)throw new s.DeepgramError("Could not send. Connection not open.");if("string"==typeof e)this._socket.send(e);else if(e instanceof Blob)this._socket.send(e);else{const t=e;t.byteLength>0?this._socket.send(t):this.emit(a.LiveTranscriptionEvents.Warning,"Zero-byte detected, skipping. Send `CloseStream` if trying to close the connection.")}}finish(){this._socket.send(JSON.stringify({type:"CloseStream"}))}}t.LiveClient=u},412:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ManageClient=void 0;const i=r(207),s=r(752),o=r(610);class a extends i.AbstractRestfulClient{getTokenDetails(e="v1/auth/token"){return n(this,void 0,void 0,(function*(){try{const t=new URL(this.baseUrl);return t.pathname=e,{result:yield this.get(this.fetch,t),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjects(e="v1/projects"){return n(this,void 0,void 0,(function*(){try{const t=new URL(this.baseUrl);return t.pathname=e,{result:yield this.get(this.fetch,t),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProject(e,t="v1/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}updateProject(e,t,r="v1/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);n.pathname=r.replace(/:projectId/,e);const i=JSON.stringify(t);return{result:yield this.patch(this.fetch,n,i),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProject(e,t="v1/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),yield this.delete(this.fetch,r),{error:null}}catch(e){if((0,s.isDeepgramError)(e))return{error:e};throw e}}))}getProjectKeys(e,t="v1/projects/:projectId/keys"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectKey(e,t,r="v1/projects/:projectId/keys/:keyId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:keyId/,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}createProjectKey(e,t,r="v1/projects/:projectId/keys"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);n.pathname=r.replace(/:projectId/,e);const i=JSON.stringify(t);return{result:yield this.post(this.fetch,n,i),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProjectKey(e,t,r="v1/projects/:projectId/keys/:keyId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:keyId/,t),yield this.delete(this.fetch,n),{error:null}}catch(e){if((0,s.isDeepgramError)(e))return{error:e};throw e}}))}getProjectMembers(e,t="v1/projects/:projectId/members"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}removeProjectMember(e,t,r="v1/projects/:projectId/members/:memberId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:memberId/,t),yield this.delete(this.fetch,n),{error:null}}catch(e){if((0,s.isDeepgramError)(e))return{error:e};throw e}}))}getProjectMemberScopes(e,t,r="v1/projects/:projectId/members/:memberId/scopes"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:memberId/,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}updateProjectMemberScope(e,t,r,i="v1/projects/:projectId/members/:memberId/scopes"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);n.pathname=i.replace(/:projectId/,e).replace(/:memberId/,t);const s=JSON.stringify(r);return{result:yield this.put(this.fetch,n,s),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectInvites(e,t="v1/projects/:projectId/invites"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}sendProjectInvite(e,t,r="v1/projects/:projectId/invites"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);n.pathname=r.replace(/:projectId/,e);const i=JSON.stringify(t);return{result:yield this.post(this.fetch,n,i),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProjectInvite(e,t,r="v1/projects/:projectId/invites/:email"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:email/,t),yield this.delete(this.fetch,n),{error:null}}catch(e){if((0,s.isDeepgramError)(e))return{error:e};throw e}}))}leaveProject(e,t="v1/projects/:projectId/leave"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.delete(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageRequests(e,t,r="v1/projects/:projectId/requests"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e),(0,o.appendSearchParams)(n.searchParams,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageRequest(e,t,r="v1/projects/:projectId/requests/:requestId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:requestId/,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageSummary(e,t,r="v1/projects/:projectId/usage"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e),(0,o.appendSearchParams)(n.searchParams,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageFields(e,t,r="v1/projects/:projectId/usage/fields"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e),(0,o.appendSearchParams)(n.searchParams,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectBalances(e,t="v1/projects/:projectId/balances"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectBalance(e,t,r="v1/projects/:projectId/balances/:balanceId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:balanceId/,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.ManageClient=a},581:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OnPremClient=void 0;const i=r(207),s=r(752);class o extends i.AbstractRestfulClient{listCredentials(e,t="v1/projects/:projectId/onprem/distribution/credentials"){return n(this,void 0,void 0,(function*(){try{const r=new URL(this.baseUrl);return r.pathname=t.replace(/:projectId/,e),{result:yield this.get(this.fetch,r),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getCredentials(e,t,r="v1/projects/:projectId/onprem/distribution/credentials/:credentialsId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:credentialsId/,t),{result:yield this.get(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}createCredentials(e,t,r="v1/projects/:projectId/onprem/distribution/credentials"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);n.pathname=r.replace(/:projectId/,e);const i=JSON.stringify(t);return{result:yield this.post(this.fetch,n,i),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteCredentials(e,t,r="v1/projects/:projectId/onprem/distribution/credentials/:credentialsId"){return n(this,void 0,void 0,(function*(){try{const n=new URL(this.baseUrl);return n.pathname=r.replace(/:projectId/,e).replace(/:credentialsId/,t),{result:yield this.delete(this.fetch,n),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.OnPremClient=o},524:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PrerecordedClient=void 0;const i=r(207),s=r(610),o=r(752);class a extends i.AbstractRestfulClient{transcribeUrl(e,t,r="v1/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isUrlSource)(e))throw new o.DeepgramError("Unknown transcription source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new o.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `transcribeUrlCallback` or `transcribeFileCallback` instead.");const i=Object.assign({},t),a=new URL(r,this.baseUrl);return(0,s.appendSearchParams)(a.searchParams,i),{result:yield this.post(this.fetch,a,n),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeFile(e,t,r="v1/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isFileSource)(e))throw new o.DeepgramError("Unknown transcription source type");if(n=e,void 0!==t&&"callback"in t)throw new o.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `transcribeUrlCallback` or `transcribeFileCallback` instead.");const i=Object.assign({},t),a=new URL(r,this.baseUrl);return(0,s.appendSearchParams)(a.searchParams,i),{result:yield this.post(this.fetch,a,n,{"Content-Type":"deepgram/audio+video"}),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeUrlCallback(e,t,r,i="v1/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isUrlSource)(e))throw new o.DeepgramError("Unknown transcription source type");n=JSON.stringify(e);const a=Object.assign(Object.assign({},r),{callback:t.toString()}),c=new URL(i,this.baseUrl);return(0,s.appendSearchParams)(c.searchParams,a),{result:yield this.post(this.fetch,c,n),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeFileCallback(e,t,r,i="v1/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isFileSource)(e))throw new o.DeepgramError("Unknown transcription source type");n=e;const a=Object.assign(Object.assign({},r),{callback:t.toString()}),c=new URL(i,this.baseUrl);return(0,s.appendSearchParams)(c.searchParams,a),{result:yield this.post(this.fetch,c,n,{"Content-Type":"deepgram/audio+video"}),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.PrerecordedClient=a},693:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ReadClient=void 0;const i=r(207),s=r(610),o=r(752);class a extends i.AbstractRestfulClient{analyzeUrl(e,t,r="v1/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isUrlSource)(e))throw new o.DeepgramError("Unknown source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new o.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `analyzeUrlCallback` or `analyzeTextCallback` instead.");const i=Object.assign({},t),a=new URL(r,this.baseUrl);return(0,s.appendSearchParams)(a.searchParams,i),{result:yield this.post(this.fetch,a,n),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeText(e,t,r="v1/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isTextSource)(e))throw new o.DeepgramError("Unknown source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new o.DeepgramError("Callback cannot be provided as an option to a synchronous requests. Use `analyzeUrlCallback` or `analyzeTextCallback` instead.");const i=Object.assign({},t),a=new URL(r,this.baseUrl);return(0,s.appendSearchParams)(a.searchParams,i),{result:yield this.post(this.fetch,a,n),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeUrlCallback(e,t,r,i="v1/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isUrlSource)(e))throw new o.DeepgramError("Unknown source type");n=JSON.stringify(e);const a=Object.assign(Object.assign({},r),{callback:t.toString()}),c=new URL(i,this.baseUrl);return(0,s.appendSearchParams)(c.searchParams,a),{result:yield this.post(this.fetch,c,n),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeTextCallback(e,t,r,i="v1/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isTextSource)(e))throw new o.DeepgramError("Unknown source type");n=JSON.stringify(e);const a=Object.assign(Object.assign({},r),{callback:t.toString()}),c=new URL(i,this.baseUrl);return(0,s.appendSearchParams)(c.searchParams,a),{result:yield this.post(this.fetch,c,n,{"Content-Type":"deepgram/audio+video"}),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.ReadClient=a},733:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SpeakClient=void 0;const i=r(207),s=r(752),o=r(610);class a extends i.AbstractRestfulClient{request(e,t,r="v1/speak"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isTextSource)(e))throw new s.DeepgramError("Unknown transcription source type");n=JSON.stringify(e);const i=Object.assign({model:"aura-asteria-en"},t),a=new URL(r,this.baseUrl);return(0,o.appendSearchParams)(a.searchParams,i),this.result=yield this._handleRawRequest(this.fetch,"POST",a,{},{},n),this}catch(e){throw e}}))}getStream(){return n(this,void 0,void 0,(function*(){if(!this.result)throw new s.DeepgramUnknownError("Tried to get stream before making request","");return this.result.body}))}getHeaders(){return n(this,void 0,void 0,(function*(){if(!this.result)throw new s.DeepgramUnknownError("Tried to get headers before making request","");return this.result.headers}))}}t.SpeakClient=a},458:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrerecordedClient=t.OnPremClient=t.ManageClient=t.LiveClient=t.ListenClient=t.AbstractWsClient=t.AbstractRestfulClient=t.AbstractClient=void 0;var n=r(910);Object.defineProperty(t,"AbstractClient",{enumerable:!0,get:function(){return n.AbstractClient}});var i=r(207);Object.defineProperty(t,"AbstractRestfulClient",{enumerable:!0,get:function(){return i.AbstractRestfulClient}});var s=r(898);Object.defineProperty(t,"AbstractWsClient",{enumerable:!0,get:function(){return s.AbstractWsClient}});var o=r(685);Object.defineProperty(t,"ListenClient",{enumerable:!0,get:function(){return o.ListenClient}});var a=r(118);Object.defineProperty(t,"LiveClient",{enumerable:!0,get:function(){return a.LiveClient}});var c=r(412);Object.defineProperty(t,"ManageClient",{enumerable:!0,get:function(){return c.ManageClient}});var u=r(581);Object.defineProperty(t,"OnPremClient",{enumerable:!0,get:function(){return u.OnPremClient}});var l=r(524);Object.defineProperty(t,"PrerecordedClient",{enumerable:!0,get:function(){return l.PrerecordedClient}})},840:(e,t,r)=>{var n;if("object"==typeof globalThis)n=globalThis;else try{n=r(544)}catch(e){}finally{if(n||"undefined"==typeof window||(n=window),!n)throw new Error("Could not determine global this")}var i=n.WebSocket||n.MozWebSocket,s=r(387);function o(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(o,e,{get:function(){return i[e]}})})),e.exports={w3cwebsocket:i?o:null,version:s}},387:(e,t,r)=>{e.exports=r(794).version},544:e=>{var t=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return t()}try{return __global__||t()}finally{delete Object.prototype.__global__}}()},794:e=>{"use strict";e.exports={version:"1.0.35"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(341)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.deepgram=t():e.deepgram=t()}(self,(()=>(()=>{var e={5993:(e,t,r)=>{"use strict";function n(e){return"transcriptionData"in e}r.r(t),r.d(t,{AssemblyAiConverter:()=>h,DeepgramConverter:()=>l,chunkArray:()=>c,isConverter:()=>n,secondsToTimestamp:()=>u,srt:()=>v,webvtt:()=>p});var o=r(7484),s=r.n(o),i=r(4576),a=r.n(i);function u(e,t="HH:mm:ss.SSS"){return s()(1e3*e).utc().format(t)}function c(e,t){const r=[];for(let n=0;n<e.length;n+=t){const o=e.slice(n,n+t);r.push(o)}return r}s().extend(a());class l{constructor(e){this.transcriptionData=e}getLines(e=8){const{results:t}=this.transcriptionData;let r=[];if(t.utterances)t.utterances.forEach((t=>{t.words.length>e?r.push(...c(t.words,e)):r.push(t.words)}));else{const n=t.channels[0].alternatives[0].words,o="speaker"in n[0];let s=[],i=0;n.forEach((t=>{var n;o&&t.speaker!==i&&(r.push(s),s=[]),s.length===e&&(r.push(s),s=[]),o&&(i=null!==(n=t.speaker)&&void 0!==n?n:0),s.push(t)})),r.push(s)}return r}getHeaders(){var e,t,r,n,o,s,i,a;const u=[];return u.push("NOTE"),u.push("Transcription provided by Deepgram"),(null===(e=this.transcriptionData.metadata)||void 0===e?void 0:e.request_id)&&u.push(`Request Id: ${null===(t=this.transcriptionData.metadata)||void 0===t?void 0:t.request_id}`),(null===(r=this.transcriptionData.metadata)||void 0===r?void 0:r.created)&&u.push(`Created: ${null===(n=this.transcriptionData.metadata)||void 0===n?void 0:n.created}`),(null===(o=this.transcriptionData.metadata)||void 0===o?void 0:o.duration)&&u.push(`Duration: ${null===(s=this.transcriptionData.metadata)||void 0===s?void 0:s.duration}`),(null===(i=this.transcriptionData.metadata)||void 0===i?void 0:i.channels)&&u.push(`Channels: ${null===(a=this.transcriptionData.metadata)||void 0===a?void 0:a.channels}`),u}}const d=e=>({word:e.text,start:e.start,end:e.end,confidence:e.confidence,punctuated_word:e.text,speaker:e.speaker});class h{constructor(e){this.transcriptionData=e}getLines(e=8){const t=this.transcriptionData;let r=[];return t.utterances?t.utterances.forEach((t=>{t.words.length>e?r.push(...c(t.words.map((e=>d(e))),e)):r.push(t.words.map((e=>d(e))))})):r.push(...c(t.words.map((e=>d(e))),e)),r}getHeaders(){const e=[];return e.push("NOTE"),e.push("Transcription provided by Assembly AI"),this.transcriptionData.id&&e.push(`Id: ${this.transcriptionData.id}`),this.transcriptionData.audio_duration&&e.push(`Duration: ${this.transcriptionData.audio_duration}`),e}}const f=e=>n(e)?e:new l(e),p=(e,t=8)=>{const r=[];let n=f(e);r.push("WEBVTT"),r.push(""),n.getHeaders&&r.push(n.getHeaders().join("\n")),n.getHeaders&&r.push("");const o=n.getLines(t),s="speaker"in o[0][0];return o.forEach((e=>{const t=e[0],n=e[e.length-1];r.push(`${u(t.start)} --\x3e ${u(n.end)}`);const o=e.map((e=>{var t;return null!==(t=e.punctuated_word)&&void 0!==t?t:e.word})).join(" "),i=s?`<v Speaker ${t.speaker}>`:"";r.push(`${i}${o}`),r.push("")})),r.join("\n")},v=(e,t=8)=>{const r=[];let n=f(e).getLines(t);const o="speaker"in n[0][0];let s,i=1;return n.forEach((e=>{r.push((i++).toString());const t=e[0],n=e[e.length-1];r.push(`${u(t.start,"HH:mm:ss,SSS")} --\x3e ${u(n.end,"HH:mm:ss,SSS")}`);const a=e.map((e=>{var t;return null!==(t=e.punctuated_word)&&void 0!==t?t:e.word})).join(" "),c=o&&s!==t.speaker?`[Speaker ${t.speaker}]\n`:"";r.push(`${c}${a}`),r.push(""),s=t.speaker})),r.join("\n")}},4098:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,i="ArrayBuffer"in e;if(i)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function v(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var e,t,r,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=p(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(e,t){e=c(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},h.prototype.delete=function(e){delete this.map[c(e)]},h.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},h.prototype.set=function(e,t){this.map[c(e)]=l(t)},h.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),d(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),d(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),d(e)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(e,t){var r,n,o=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new h(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},g.call(m.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var O=[301,302,303,307,308];w.redirect=function(e,t){if(-1===O.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function j(e,r){return new Promise((function(n,s){var i=new m(e,r);if(i.signal&&i.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new w(o,r))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},a.open(i.method,i.url,!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),i.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&i.signal.removeEventListener("abort",u)}),a.send(void 0===i._bodyInit?null:i._bodyInit)}))}j.polyfill=!0,e.fetch||(e.fetch=j,e.Headers=h,e.Request=m,e.Response=w),t.Headers=h,t.Request=m,t.Response=w,t.fetch=j,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t},7484:function(e){e.exports=function(){"use strict";var e=6e4,t=36e5,r="millisecond",n="second",o="minute",s="hour",i="day",a="week",u="month",c="quarter",l="year",d="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},y=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},g={s:y,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),o=r%60;return(t<=0?"+":"-")+y(n,2,"0")+":"+y(o,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),o=t.clone().add(n,u),s=r-o<0,i=t.clone().add(n+(s?-1:1),u);return+(-(n+(r-o)/(s?o-i:i-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:u,y:l,w:a,d:i,D:d,h:s,m:o,s:n,ms:r,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",m={};m[b]=v;var _="$isDayjsObject",w=function(e){return e instanceof S||!(!e||!e[_])},O=function e(t,r,n){var o;if(!t)return b;if("string"==typeof t){var s=t.toLowerCase();m[s]&&(o=s),r&&(m[s]=r,o=s);var i=t.split("-");if(!o&&i.length>1)return e(i[0])}else{var a=t.name;m[a]=t,o=a}return!n&&o&&(b=o),o||!n&&b},j=function(e,t){if(w(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new S(r)},E=g;E.l=O,E.i=w,E.w=function(e,t){return j(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var S=function(){function v(e){this.$L=O(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[_]=!0}var y=v.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(E.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(f);if(n){var o=n[2]-1||0,s=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],o,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)):new Date(n[1],o,n[3]||1,n[4]||0,n[5]||0,n[6]||0,s)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return E},y.isValid=function(){return!(this.$d.toString()===h)},y.isSame=function(e,t){var r=j(e);return this.startOf(t)<=r&&r<=this.endOf(t)},y.isAfter=function(e,t){return j(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<j(e)},y.$g=function(e,t,r){return E.u(e)?this[t]:this.set(r,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var r=this,c=!!E.u(t)||t,h=E.p(e),f=function(e,t){var n=E.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return c?n:n.endOf(i)},p=function(e,t){return E.w(r.toDate()[e].apply(r.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},v=this.$W,y=this.$M,g=this.$D,b="set"+(this.$u?"UTC":"");switch(h){case l:return c?f(1,0):f(31,11);case u:return c?f(1,y):f(0,y+1);case a:var m=this.$locale().weekStart||0,_=(v<m?v+7:v)-m;return f(c?g-_:g+(6-_),y);case i:case d:return p(b+"Hours",0);case s:return p(b+"Minutes",1);case o:return p(b+"Seconds",2);case n:return p(b+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var a,c=E.p(e),h="set"+(this.$u?"UTC":""),f=(a={},a[i]=h+"Date",a[d]=h+"Date",a[u]=h+"Month",a[l]=h+"FullYear",a[s]=h+"Hours",a[o]=h+"Minutes",a[n]=h+"Seconds",a[r]=h+"Milliseconds",a)[c],p=c===i?this.$D+(t-this.$W):t;if(c===u||c===l){var v=this.clone().set(d,1);v.$d[f](p),v.init(),this.$d=v.set(d,Math.min(this.$D,v.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[E.p(e)]()},y.add=function(r,c){var d,h=this;r=Number(r);var f=E.p(c),p=function(e){var t=j(h);return E.w(t.date(t.date()+Math.round(e*r)),h)};if(f===u)return this.set(u,this.$M+r);if(f===l)return this.set(l,this.$y+r);if(f===i)return p(1);if(f===a)return p(7);var v=(d={},d[o]=e,d[s]=t,d[n]=1e3,d)[f]||1,y=this.$d.getTime()+r*v;return E.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||h;var n=e||"YYYY-MM-DDTHH:mm:ssZ",o=E.z(this),s=this.$H,i=this.$m,a=this.$M,u=r.weekdays,c=r.months,l=r.meridiem,d=function(e,r,o,s){return e&&(e[r]||e(t,n))||o[r].slice(0,s)},f=function(e){return E.s(s%12||12,e,"0")},v=l||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(p,(function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return E.s(t.$y,4,"0");case"M":return a+1;case"MM":return E.s(a+1,2,"0");case"MMM":return d(r.monthsShort,a,c,3);case"MMMM":return d(c,a);case"D":return t.$D;case"DD":return E.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(r.weekdaysMin,t.$W,u,2);case"ddd":return d(r.weekdaysShort,t.$W,u,3);case"dddd":return u[t.$W];case"H":return String(s);case"HH":return E.s(s,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return v(s,i,!0);case"A":return v(s,i,!1);case"m":return String(i);case"mm":return E.s(i,2,"0");case"s":return String(t.$s);case"ss":return E.s(t.$s,2,"0");case"SSS":return E.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,d,h){var f,p=this,v=E.p(d),y=j(r),g=(y.utcOffset()-this.utcOffset())*e,b=this-y,m=function(){return E.m(p,y)};switch(v){case l:f=m()/12;break;case u:f=m();break;case c:f=m()/3;break;case a:f=(b-g)/6048e5;break;case i:f=(b-g)/864e5;break;case s:f=b/t;break;case o:f=b/e;break;case n:f=b/1e3;break;default:f=b}return h?f:E.a(f)},y.daysInMonth=function(){return this.endOf(u).$D},y.$locale=function(){return m[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=O(e,t,!0);return n&&(r.$L=n),r},y.clone=function(){return E.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},v}(),D=S.prototype;return j.prototype=D,[["$ms",r],["$s",n],["$m",o],["$H",s],["$W",i],["$M",u],["$y",l],["$D",d]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),j.extend=function(e,t){return e.$i||(e(t,S,j),e.$i=!0),j},j.locale=O,j.isDayjs=w,j.unix=function(e){return j(1e3*e)},j.en=m[b],j.Ls=m,j.p={},j}()},4576:function(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,s){var i=o.prototype;s.utc=function(e){return new o({date:e,utc:!0,args:arguments})},i.utc=function(t){var r=s(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},i.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var a=i.parse;i.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),a.call(this,e)};var u=i.init;i.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else u.call(this)};var c=i.utcOffset;i.utcOffset=function(n,o){var s=this.$utils().u;if(s(n))return this.$u?0:s(this.$offset)?c.call(this):this.$offset;if("string"==typeof n&&(n=function(e){void 0===e&&(e="");var n=e.match(t);if(!n)return null;var o=(""+n[0]).match(r)||["-",0,0],s=o[0],i=60*+o[1]+ +o[2];return 0===i?0:"+"===s?i:-i}(n),null===n))return this;var i=Math.abs(n)<=16?60*n:n,a=this;if(o)return a.$offset=i,a.$u=0===n,a;if(0!==n){var u=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(i+u,e)).$offset=i,a.$x.$localOffset=u}else a=this.utc();return a};var l=i.format;i.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return l.call(this,t)},i.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var d=i.toDate;i.toDate=function(e){return"s"===e&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var h=i.diff;i.diff=function(e,t,r){if(e&&this.$u===e.$u)return h.call(this,e,t,r);var n=this.local(),o=s(e).local();return h.call(n,o,t,r)}}}()},9996:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function o(e,t,r){return e.concat(t).map((function(e){return n(e,r)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function a(e,r,u){(u=u||{}).arrayMerge=u.arrayMerge||o,u.isMergeableObject=u.isMergeableObject||t,u.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(r);return c===Array.isArray(e)?c?u.arrayMerge(e,r,u):function(e,t,r){var o={};return r.isMergeableObject(e)&&s(e).forEach((function(t){o[t]=n(e[t],r)})),s(t).forEach((function(s){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(i(e,s)&&r.isMergeableObject(t[s])?o[s]=function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a}(s,r)(e[s],t[s],r):o[s]=n(t[s],r))})),o}(e,r,u):n(r,u)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return a(e,r,t)}),{})};var u=a;e.exports=u},7187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,s),n(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,o)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,s,i,c;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),i=s[t]),void 0===i)i=s[t]=r,++e._eventsCount;else if("function"==typeof i?i=s[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=u(e))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function h(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):p(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(s){n.once&&e.removeEventListener(t,o),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var u=s[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var c=u.length,l=p(u,c);for(r=0;r<c;++r)n(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return c(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return c(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,o,s,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(o=s[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},5274:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8752),o=r(8458);class s extends o.AbstractClient{get listen(){return new o.ListenClient(this.options)}get manage(){return new o.ManageClient(this.options)}get onprem(){return this.selfhosted}get selfhosted(){return new o.SelfHostedRestClient(this.options)}get read(){return new o.ReadClient(this.options)}get speak(){return new o.SpeakClient(this.options)}get transcription(){throw new n.DeepgramVersionError}get projects(){throw new n.DeepgramVersionError}get keys(){throw new n.DeepgramVersionError}get members(){throw new n.DeepgramVersionError}get scopes(){throw new n.DeepgramVersionError}get invitation(){throw new n.DeepgramVersionError}get usage(){throw new n.DeepgramVersionError}get billing(){throw new n.DeepgramVersionError}}t.default=s},341:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.srt=t.webvtt=t.Deepgram=t.DeepgramClient=t.createClient=void 0;const i=r(8752),a=s(r(5274));t.DeepgramClient=a.default,t.Deepgram=class{constructor(e,t,r){throw this.apiKey=e,this.apiUrl=t,this.requireSSL=r,new i.DeepgramVersionError}},t.createClient=function(e,t){let r={};return"string"==typeof e||"function"==typeof e?("object"==typeof t&&(r=t),r.key=e):"object"==typeof e&&(r=e),new a.default(r)},o(r(8458),t),o(r(6475),t),o(r(57),t),o(r(4678),t),o(r(8752),t),o(r(610),t);var u=r(5993);Object.defineProperty(t,"webvtt",{enumerable:!0,get:function(){return u.webvtt}}),Object.defineProperty(t,"srt",{enumerable:!0,get:function(){return u.srt}})},4678:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONNECTION_STATE=t.SOCKET_STATES=t.DEFAULT_OPTIONS=t.DEFAULT_GLOBAL_OPTIONS=t.DEFAULT_URL=t.DEFAULT_HEADERS=t.BROWSER_AGENT=t.NODE_VERSION=void 0;const n=r(610),o=r(1506);var s,i;t.NODE_VERSION="undefined"!=typeof process&&process.versions&&process.versions.node?process.versions.node:"unknown",t.BROWSER_AGENT="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:"unknown",t.DEFAULT_HEADERS={"Content-Type":"application/json","X-Client-Info":`@deepgram/sdk; ${(0,n.isBrowser)()?"browser":"server"}; v${o.version}`,"User-Agent":`@deepgram/sdk/${o.version} ${(0,n.isBrowser)()?`javascript ${t.BROWSER_AGENT}`:`node/${t.NODE_VERSION}`}`},t.DEFAULT_URL="https://api.deepgram.com",t.DEFAULT_GLOBAL_OPTIONS={fetch:{options:{url:t.DEFAULT_URL,headers:t.DEFAULT_HEADERS}},websocket:{options:{url:(0,n.convertProtocolToWs)(t.DEFAULT_URL),_nodeOnlyHeaders:t.DEFAULT_HEADERS}}},t.DEFAULT_OPTIONS={global:t.DEFAULT_GLOBAL_OPTIONS},(i=t.SOCKET_STATES||(t.SOCKET_STATES={}))[i.connecting=0]="connecting",i[i.open=1]="open",i[i.closing=2]="closing",i[i.closed=3]="closed",(s=t.CONNECTION_STATE||(t.CONNECTION_STATE={})).Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"},4615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LiveConnectionState=void 0;const n=r(4678);var o;(o=t.LiveConnectionState||(t.LiveConnectionState={}))[o.CONNECTING=n.SOCKET_STATES.connecting]="CONNECTING",o[o.OPEN=n.SOCKET_STATES.open]="OPEN",o[o.CLOSING=n.SOCKET_STATES.closing]="CLOSING",o[o.CLOSED=n.SOCKET_STATES.closed]="CLOSED"},3178:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveTranscriptionEvents=void 0,(r=t.LiveTranscriptionEvents||(t.LiveTranscriptionEvents={})).Open="open",r.Close="close",r.Error="error",r.Transcript="Results",r.Metadata="Metadata",r.UtteranceEnd="UtteranceEnd",r.SpeechStarted="SpeechStarted",r.Unhandled="Unhandled"},57:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(4615),t),o(r(3178),t)},8752:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeepgramVersionError=t.DeepgramUnknownError=t.DeepgramApiError=t.isDeepgramError=t.DeepgramError=void 0;class r extends Error{constructor(e){super(e),this.__dgError=!0,this.name="DeepgramError"}}t.DeepgramError=r,t.isDeepgramError=function(e){return"object"==typeof e&&null!==e&&"__dgError"in e},t.DeepgramApiError=class extends r{constructor(e,t){super(e),this.name="DeepgramApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}},t.DeepgramUnknownError=class extends r{constructor(e,t){super(e),this.name="DeepgramUnknownError",this.originalError=t}},t.DeepgramVersionError=class extends r{constructor(){super("You are attempting to use an old format for a newer SDK version. Read more here: https://dpgr.am/js-v3"),this.name="DeepgramVersionError"}}},8716:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveResponse=t.fetchWithAuth=t.resolveFetch=void 0;const u=r(610),c=a(r(4098));t.resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?c.default:fetch),(...e)=>t(...e)},t.fetchWithAuth=(e,r)=>{const n=(0,t.resolveFetch)(r),o=(0,u.resolveHeadersConstructor)();return(t,r)=>i(void 0,void 0,void 0,(function*(){let s=new o(null==r?void 0:r.headers);return s.has("Authorization")||s.set("Authorization",`Token ${e}`),n(t,Object.assign(Object.assign({},r),{headers:s}))}))},t.resolveResponse=()=>i(void 0,void 0,void 0,(function*(){return"undefined"==typeof Response?(yield Promise.resolve().then((()=>s(r(4098))))).Response:Response}))},610:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.convertLegacyOptions=t.isDeepgramClientOptions=t.isLiveSchema=t.buildRequestUrl=t.convertProtocolToWs=t.CallbackUrl=t.isFileSource=t.isTextSource=t.isUrlSource=t.resolveHeadersConstructor=t.appendSearchParams=t.applyDefaults=t.isBrowser=t.stripTrailingSlash=void 0;const o=r(4098),s=n(r(9996));function i(e,t){Object.keys(t).forEach((r=>{Array.isArray(t[r])?t[r].forEach((t=>{e.append(r,String(t))})):e.append(r,String(t[r]))}))}t.stripTrailingSlash=function(e){return e.replace(/\/$/,"")},t.isBrowser=function(){return"undefined"!=typeof window&&void 0!==window.document},t.applyDefaults=function(e={},t={}){return(0,s.default)(t,e)},t.appendSearchParams=i,t.resolveHeadersConstructor=()=>"undefined"==typeof Headers?o.Headers:Headers,t.isUrlSource=e=>!!e.url,t.isTextSource=e=>!!e.text,t.isFileSource=e=>!(!u(e)&&!a(e));const a=e=>!!e,u=e=>!!e;class c extends URL{constructor(){super(...arguments),this.callbackUrl=!0}}t.CallbackUrl=c,t.convertProtocolToWs=e=>e.toLowerCase().replace(/^http/,"ws"),t.buildRequestUrl=(e,t,r)=>{const n=new URL(e,t);return i(n.searchParams,r),n},t.isLiveSchema=function(e){return e&&void 0!==e.interim_results},t.isDeepgramClientOptions=function(e){return e&&void 0!==e.global},t.convertLegacyOptions=e=>{var t,r,n,o,i,a;const u={};return e._experimentalCustomFetch&&(u.global={fetch:{client:e._experimentalCustomFetch}}),(null===(t=(e=(0,s.default)(e,u)).restProxy)||void 0===t?void 0:t.url)&&(u.global={fetch:{options:{proxy:{url:null===(r=e.restProxy)||void 0===r?void 0:r.url}}}}),(null===(n=(e=(0,s.default)(e,u)).global)||void 0===n?void 0:n.url)&&(u.global={fetch:{options:{url:e.global.url}},websocket:{options:{url:e.global.url}}}),(null===(o=(e=(0,s.default)(e,u)).global)||void 0===o?void 0:o.headers)&&(u.global={fetch:{options:{headers:null===(i=e.global)||void 0===i?void 0:i.headers}},websocket:{options:{_nodeOnlyHeaders:null===(a=e.global)||void 0===a?void 0:a.headers}}}),(0,s.default)(e,u)}},5245:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2760:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6871:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6898:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9890:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8816:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7273:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7775:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9880:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1285:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8137:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9535:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6674:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},549:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7030:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},178:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5623:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},493:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5310:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4587:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},13:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9628:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},285:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3513:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7975:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2181:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8084:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8953:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4634:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},627:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8064:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7091:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},578:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2206:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6475:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5245),t),o(r(2760),t),o(r(6871),t),o(r(6898),t),o(r(9890),t),o(r(8816),t),o(r(7273),t),o(r(7775),t),o(r(9880),t),o(r(1285),t),o(r(8137),t),o(r(9535),t),o(r(6674),t),o(r(9796),t),o(r(549),t),o(r(7030),t),o(r(13),t),o(r(178),t),o(r(5623),t),o(r(493),t),o(r(1117),t),o(r(5310),t),o(r(4587),t),o(r(5619),t),o(r(5640),t),o(r(9628),t),o(r(285),t),o(r(3513),t),o(r(7975),t),o(r(2181),t),o(r(8084),t),o(r(8953),t),o(r(4634),t),o(r(288),t),o(r(627),t),o(r(8064),t),o(r(7091),t),o(r(578),t),o(r(2206),t)},1506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},7910:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractClient=t.noop=void 0;const o=n(r(7187)),s=r(4678),i=r(8752),a=r(610);t.noop=()=>{};class u extends o.default{constructor(e){let r;if(super(),this.factory=void 0,this.namespace="global",this.version="v1",this.baseUrl=s.DEFAULT_URL,this.logger=t.noop,"function"==typeof e.key?(this.factory=e.key,r=this.factory()):r=e.key,r||(r=process.env.DEEPGRAM_API_KEY),!r)throw new i.DeepgramError("A deepgram API key is required.");this.key=r,e=(0,a.convertLegacyOptions)(e),this.options=(0,a.applyDefaults)(e,s.DEFAULT_OPTIONS)}v(e="v1"){return this.version=e,this}get namespaceOptions(){const e=(0,a.applyDefaults)(this.options[this.namespace],this.options.global);return Object.assign(Object.assign({},e),{key:this.key})}getRequestUrl(e,t={version:this.version},r){t.version=this.version,e=e.replace(/:(\w+)/g,(function(e,r){return t[r]}));const n=new URL(e,this.baseUrl);return r&&(0,a.appendSearchParams)(n.searchParams,r),n}log(e,t,r){this.logger(e,t,r)}}t.AbstractClient=u},8403:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractWsClient=t.AbstractLiveClient=void 0;const a=r(7910),u=r(4678),c="undefined"!=typeof WebSocket;class l extends a.AbstractClient{constructor(e){super(e),this.conn=null,this.sendBuffer=[],this.reconnect=a.noop;const{key:t,websocket:{options:r,client:n}}=this.namespaceOptions;this.proxy?this.baseUrl=r.proxy.url:this.baseUrl=r.url,this.transport=n||null,r._nodeOnlyHeaders?this.headers=r._nodeOnlyHeaders:this.headers={},"Authorization"in this.headers||(this.headers.Authorization=`Token ${t}`)}connect(e,t){if(this.conn)return;this.reconnect=(r=e)=>{this.connect(r,t)};const n=this.getRequestUrl(t,{},e);if(this.transport)this.conn=new this.transport(n,void 0,{headers:this.headers});else{if(c)return this.conn=new WebSocket(n,["token",this.namespaceOptions.key]),void this.setupConnection();this.conn=new d(n,void 0,{close:()=>{this.conn=null}}),Promise.resolve().then((()=>s(r(7026)))).then((({default:e})=>{this.conn=new e(n,void 0,{headers:this.headers}),this.setupConnection()}))}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this.conn=null)}connectionState(){switch(this.conn&&this.conn.readyState){case u.SOCKET_STATES.connecting:return u.CONNECTION_STATE.Connecting;case u.SOCKET_STATES.open:return u.CONNECTION_STATE.Open;case u.SOCKET_STATES.closing:return u.CONNECTION_STATE.Closing;default:return u.CONNECTION_STATE.Closed}}getReadyState(){var e,t;return null!==(t=null===(e=this.conn)||void 0===e?void 0:e.readyState)&&void 0!==t?t:u.SOCKET_STATES.closed}isConnected(){return this.connectionState()===u.CONNECTION_STATE.Open}send(e){const t=()=>i(this,void 0,void 0,(function*(){var t;if(e instanceof Blob){if(0===e.size)return void this.log("warn","skipping `send` for zero-byte blob",e);e=yield e.arrayBuffer()}"string"==typeof e||0!==e.byteLength?null===(t=this.conn)||void 0===t||t.send(e):this.log("warn","skipping `send` for zero-byte blob",e)}));this.isConnected()?t():this.sendBuffer.push(t)}get proxy(){var e;return"proxy"===this.key&&!!(null===(e=this.namespaceOptions.websocket.options.proxy)||void 0===e?void 0:e.url)}}t.AbstractLiveClient=l,t.AbstractWsClient=l;class d{constructor(e,t,r){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=u.SOCKET_STATES.connecting,this.send=()=>{},this.url=null,this.url=e.toString(),this.close=r.close}}},5462:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractRestfulClient=t.AbstractRestClient=void 0;const s=r(8752),i=r(8716),a=r(7910),u=r(610),c=o(r(9996));class l extends a.AbstractClient{constructor(e){if(super(e),(0,u.isBrowser)()&&!this.proxy)throw new s.DeepgramError("Due to CORS we are unable to support REST-based API calls to our API from the browser. Please consider using a proxy: https://dpgr.am/js-proxy for more information.");this.fetch=(0,i.fetchWithAuth)(this.key,this.namespaceOptions.fetch.client),this.proxy?this.baseUrl=this.namespaceOptions.fetch.options.proxy.url:this.baseUrl=this.namespaceOptions.fetch.options.url}_getErrorMessage(e){return e.msg||e.message||e.error_description||e.error||JSON.stringify(e)}_handleError(e,t){return n(this,void 0,void 0,(function*(){const r=yield(0,i.resolveResponse)();e instanceof r?e.json().then((r=>{t(new s.DeepgramApiError(this._getErrorMessage(r),e.status||500))})).catch((e=>{t(new s.DeepgramUnknownError(this._getErrorMessage(e),e))})):t(new s.DeepgramUnknownError(this._getErrorMessage(e),e))}))}_getRequestOptions(e,t,r){let n={method:e};return n="GET"===e||"DELETE"===e?Object.assign(Object.assign({},n),t):Object.assign(Object.assign({duplex:"half",body:t},n),r),(0,c.default)(this.namespaceOptions.fetch.options,n,{clone:!1})}_handleRequest(e,t,r,o){return n(this,void 0,void 0,(function*(){return new Promise(((n,s)=>{(0,this.fetch)(t,this._getRequestOptions(e,r,o)).then((e=>{if(!e.ok)throw e;n(e)})).catch((e=>this._handleError(e,s)))}))}))}get(e,t){return n(this,void 0,void 0,(function*(){return this._handleRequest("GET",e,t)}))}post(e,t,r){return n(this,void 0,void 0,(function*(){return this._handleRequest("POST",e,t,r)}))}put(e,t,r){return n(this,void 0,void 0,(function*(){return this._handleRequest("PUT",e,t,r)}))}patch(e,t,r){return n(this,void 0,void 0,(function*(){return this._handleRequest("PATCH",e,t,r)}))}delete(e,t){return n(this,void 0,void 0,(function*(){return this._handleRequest("DELETE",e,t)}))}get proxy(){var e;return"proxy"===this.key&&!!(null===(e=this.namespaceOptions.fetch.options.proxy)||void 0===e?void 0:e.url)}}t.AbstractRestClient=l,t.AbstractRestfulClient=l},5685:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListenClient=void 0;const n=r(7910),o=r(5669),s=r(3914);class i extends n.AbstractClient{constructor(){super(...arguments),this.namespace="listen"}get prerecorded(){return new s.ListenRestClient(this.options)}live(e={},t=":version/listen"){return new o.ListenLiveClient(this.options,e,t)}}t.ListenClient=i},5669:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Liveclient=t.ListenLiveClient=void 0;const n=r(8403),o=r(57);class s extends n.AbstractLiveClient{constructor(e,t={},r=":version/listen"){super(e),this.namespace="listen",this.connect(t,r)}setupConnection(){this.conn&&(this.conn.onopen=()=>{this.emit(o.LiveTranscriptionEvents.Open,this)},this.conn.onclose=e=>{this.emit(o.LiveTranscriptionEvents.Close,e)},this.conn.onerror=e=>{this.emit(o.LiveTranscriptionEvents.Error,e)},this.conn.onmessage=e=>{try{const t=JSON.parse(e.data.toString());t.type===o.LiveTranscriptionEvents.Metadata?this.emit(o.LiveTranscriptionEvents.Metadata,t):t.type===o.LiveTranscriptionEvents.Transcript?this.emit(o.LiveTranscriptionEvents.Transcript,t):t.type===o.LiveTranscriptionEvents.UtteranceEnd?this.emit(o.LiveTranscriptionEvents.UtteranceEnd,t):t.type===o.LiveTranscriptionEvents.SpeechStarted?this.emit(o.LiveTranscriptionEvents.SpeechStarted,t):this.emit(o.LiveTranscriptionEvents.Unhandled,t)}catch(t){this.emit(o.LiveTranscriptionEvents.Error,{event:e,message:"Unable to parse `data` as JSON.",error:t})}})}configure(e){this.send(JSON.stringify({type:"Configure",processors:e}))}keepAlive(){this.send(JSON.stringify({type:"KeepAlive"}))}finish(){this.requestClose()}requestClose(){this.send(JSON.stringify({type:"CloseStream"}))}}t.ListenLiveClient=s,t.Liveclient=s},3914:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PrerecordedClient=t.ListenRestClient=void 0;const o=r(610),s=r(8752),i=r(5462);class a extends i.AbstractRestClient{constructor(){super(...arguments),this.namespace="listen"}transcribeUrl(e,t,r=":version/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isUrlSource)(e))throw new s.DeepgramError("Unknown transcription source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new s.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `transcribeUrlCallback` or `transcribeFileCallback` instead.");const i=this.getRequestUrl(r,{},Object.assign({},t));return{result:yield this.post(i,n).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeFile(e,t,r=":version/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isFileSource)(e))throw new s.DeepgramError("Unknown transcription source type");if(n=e,void 0!==t&&"callback"in t)throw new s.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `transcribeUrlCallback` or `transcribeFileCallback` instead.");const i=this.getRequestUrl(r,{},Object.assign({},t));return{result:yield this.post(i,n,{headers:{"Content-Type":"deepgram/audio+video"}}).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeUrlCallback(e,t,r,i=":version/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isUrlSource)(e))throw new s.DeepgramError("Unknown transcription source type");n=JSON.stringify(e);const a=this.getRequestUrl(i,{},Object.assign(Object.assign({},r),{callback:t.toString()}));return{result:yield this.post(a,n).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}transcribeFileCallback(e,t,r,i=":version/listen"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isFileSource)(e))throw new s.DeepgramError("Unknown transcription source type");n=e;const a=this.getRequestUrl(i,{},Object.assign(Object.assign({},r),{callback:t.toString()}));return{result:yield this.post(a,n,{headers:{"Content-Type":"deepgram/audio+video"}}).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.ListenRestClient=a,t.PrerecordedClient=a},4522:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ManageClient=t.ManageRestClient=void 0;const o=r(8752),s=r(5462);class i extends s.AbstractRestClient{constructor(){super(...arguments),this.namespace="manage"}getTokenDetails(e=":version/auth/token"){return n(this,void 0,void 0,(function*(){try{const t=this.getRequestUrl(e);return{result:yield this.get(t).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjects(e=":version/projects"){return n(this,void 0,void 0,(function*(){try{const t=this.getRequestUrl(e);return{result:yield this.get(t).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProject(e,t=":version/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}updateProject(e,t,r=":version/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t),o=JSON.stringify(t);return{result:yield this.patch(n,o).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProject(e,t=":version/projects/:projectId"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return yield this.delete(r),{error:null}}catch(e){if((0,o.isDeepgramError)(e))return{error:e};throw e}}))}getProjectKeys(e,t=":version/projects/:projectId/keys"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectKey(e,t,r=":version/projects/:projectId/keys/:keyId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,keyId:t});return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}createProjectKey(e,t,r=":version/projects/:projectId/keys"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t),o=JSON.stringify(t);return{result:yield this.post(n,o).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProjectKey(e,t,r=":version/projects/:projectId/keys/:keyId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,keyId:t});return yield this.delete(n),{error:null}}catch(e){if((0,o.isDeepgramError)(e))return{error:e};throw e}}))}getProjectMembers(e,t=":version/projects/:projectId/members"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}removeProjectMember(e,t,r=":version/projects/:projectId/members/:memberId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,memberId:t});return yield this.delete(n),{error:null}}catch(e){if((0,o.isDeepgramError)(e))return{error:e};throw e}}))}getProjectMemberScopes(e,t,r=":version/projects/:projectId/members/:memberId/scopes"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,memberId:t});return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}updateProjectMemberScope(e,t,r,s=":version/projects/:projectId/members/:memberId/scopes"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(s,{projectId:e,memberId:t},r),o=JSON.stringify(r);return{result:yield this.put(n,o).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectInvites(e,t=":version/projects/:projectId/invites"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}sendProjectInvite(e,t,r=":version/projects/:projectId/invites"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t),o=JSON.stringify(t);return{result:yield this.post(n,o).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteProjectInvite(e,t,r=":version/projects/:projectId/invites/:email"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,email:t});return yield this.delete(n).then((e=>e.json())),{error:null}}catch(e){if((0,o.isDeepgramError)(e))return{error:e};throw e}}))}leaveProject(e,t=":version/projects/:projectId/leave"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.delete(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageRequests(e,t,r=":version/projects/:projectId/requests"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t);return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageRequest(e,t,r=":version/projects/:projectId/requests/:requestId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,requestId:t});return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageSummary(e,t,r=":version/projects/:projectId/usage"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t);return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectUsageFields(e,t,r=":version/projects/:projectId/usage/fields"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e},t);return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectBalances(e,t=":version/projects/:projectId/balances"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getProjectBalance(e,t,r=":version/projects/:projectId/balances/:balanceId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,balanceId:t});return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.ManageRestClient=i,t.ManageClient=i},9766:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ReadClient=t.ReadRestClient=void 0;const o=r(610),s=r(8752),i=r(5462);class a extends i.AbstractRestClient{constructor(){super(...arguments),this.namespace="read"}analyzeUrl(e,t,r=":version/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isUrlSource)(e))throw new s.DeepgramError("Unknown source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new s.DeepgramError("Callback cannot be provided as an option to a synchronous transcription. Use `analyzeUrlCallback` or `analyzeTextCallback` instead.");const i=this.getRequestUrl(r,{},Object.assign({},t));return{result:yield this.post(i,n).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeText(e,t,r=":version/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isTextSource)(e))throw new s.DeepgramError("Unknown source type");if(n=JSON.stringify(e),void 0!==t&&"callback"in t)throw new s.DeepgramError("Callback cannot be provided as an option to a synchronous requests. Use `analyzeUrlCallback` or `analyzeTextCallback` instead.");const i=this.getRequestUrl(r,{},Object.assign({},t));return{result:yield this.post(i,n).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeUrlCallback(e,t,r,i=":version/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isUrlSource)(e))throw new s.DeepgramError("Unknown source type");n=JSON.stringify(e);const a=this.getRequestUrl(i,{},Object.assign(Object.assign({},r),{callback:t.toString()}));return{result:yield this.post(a,n).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}analyzeTextCallback(e,t,r,i=":version/read"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,o.isTextSource)(e))throw new s.DeepgramError("Unknown source type");n=JSON.stringify(e);const a=this.getRequestUrl(i,{},Object.assign(Object.assign({},r),{callback:t.toString()}));return{result:yield this.post(a,n,{headers:{"Content-Type":"deepgram/audio+video"}}).then((e=>e.json())),error:null}}catch(e){if((0,s.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.ReadRestClient=a,t.ReadClient=a},2164:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OnPremClient=t.SelfHostedRestClient=void 0;const o=r(8752),s=r(5462);class i extends s.AbstractRestClient{constructor(){super(...arguments),this.namespace="selfhosted"}listCredentials(e,t=":version/projects/:projectId/onprem/distribution/credentials"){return n(this,void 0,void 0,(function*(){try{const r=this.getRequestUrl(t,{projectId:e});return{result:yield this.get(r).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}getCredentials(e,t,r=":version/projects/:projectId/onprem/distribution/credentials/:credentialsId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,credentialsId:t});return{result:yield this.get(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}createCredentials(e,t,r=":version/projects/:projectId/onprem/distribution/credentials"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e}),o=JSON.stringify(t);return{result:yield this.post(n,o).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}deleteCredentials(e,t,r=":version/projects/:projectId/onprem/distribution/credentials/:credentialsId"){return n(this,void 0,void 0,(function*(){try{const n=this.getRequestUrl(r,{projectId:e,credentialsId:t});return{result:yield this.delete(n).then((e=>e.json())),error:null}}catch(e){if((0,o.isDeepgramError)(e))return{result:null,error:e};throw e}}))}}t.SelfHostedRestClient=i,t.OnPremClient=i},9111:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SpeakClient=t.SpeakRestClient=void 0;const o=r(8752),s=r(610),i=r(5462);class a extends i.AbstractRestClient{constructor(){super(...arguments),this.namespace="speak"}request(e,t,r=":version/speak"){return n(this,void 0,void 0,(function*(){try{let n;if(!(0,s.isTextSource)(e))throw new o.DeepgramError("Unknown transcription source type");n=JSON.stringify(e);const i=this.getRequestUrl(r,{},Object.assign({model:"aura-asteria-en"},t));return this.result=yield this.post(i,n,{headers:{Accept:"audio/*","Content-Type":"application/json"}}),this}catch(e){throw e}}))}getStream(){return n(this,void 0,void 0,(function*(){if(!this.result)throw new o.DeepgramUnknownError("Tried to get stream before making request","");return this.result.body}))}getHeaders(){return n(this,void 0,void 0,(function*(){if(!this.result)throw new o.DeepgramUnknownError("Tried to get headers before making request","");return this.result.headers}))}}t.SpeakRestClient=a,t.SpeakClient=a},8458:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(7910),t),o(r(8403),t),o(r(5462),t),o(r(5685),t),o(r(5669),t),o(r(3914),t),o(r(4522),t),o(r(9766),t),o(r(2164),t),o(r(9111),t)},7026:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(341)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepgram/sdk",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "Isomorphic Javascript client for Deepgram",
5
5
  "keywords": [
6
6
  "javascript",
@@ -45,18 +45,17 @@
45
45
  "build:module": "tsc -p tsconfig.module.json",
46
46
  "build:umd": "webpack --mode=production",
47
47
  "watch": "nodemon -e ts --watch src --exec \"npm run build\"",
48
- "test": "mocha -r ts-node/register test/*test.ts test/**/*test.ts --insect --timeout 5000 || :",
48
+ "test": "mocha -r ts-node/register test/*test.ts test/**/*test.ts --inspect --exit",
49
49
  "test:coverage": "nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test",
50
- "docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts",
51
- "docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals"
50
+ "docs": "typedoc --entryPoints src/index.ts --out docs/ --includes src/packages/**/*.ts --emit none",
51
+ "docs:json": "typedoc --entryPoints src/index.ts --includes src/packages/**/*.ts --json docs/spec.json --emit none"
52
52
  },
53
53
  "dependencies": {
54
54
  "@deepgram/captions": "^1.1.1",
55
- "@types/websocket": "^1.0.9",
56
55
  "cross-fetch": "^3.1.5",
57
56
  "deepmerge": "^4.3.1",
58
57
  "events": "^3.3.0",
59
- "websocket": "^1.0.34"
58
+ "ws": "^8.17.0"
60
59
  },
61
60
  "devDependencies": {
62
61
  "@commitlint/cli": "^17.6.7",
@@ -65,6 +64,8 @@
65
64
  "@flydotio/dockerfile": "^0.4.10",
66
65
  "@types/chai": "^4.3.5",
67
66
  "@types/mocha": "^9.1.1",
67
+ "@types/sinon": "^17.0.3",
68
+ "@types/ws": "^8.5.10",
68
69
  "chai": "^4.3.7",
69
70
  "cross-env": "^7.0.3",
70
71
  "husky": "^4.3.0",
@@ -76,6 +77,7 @@
76
77
  "pretty-quick": "^3.1.3",
77
78
  "rimraf": "^3.0.2",
78
79
  "semantic-release-plugin-update-version-in-files": "^1.1.0",
80
+ "sinon": "^17.0.1",
79
81
  "ts-loader": "^8.0.11",
80
82
  "ts-node": "^10.9.1",
81
83
  "typedoc": "^0.22.16",
@@ -1,71 +1,135 @@
1
1
  import { DeepgramVersionError } from "./lib/errors";
2
- import { AbstractClient } from "./packages/AbstractClient";
3
- import { ListenClient } from "./packages/ListenClient";
4
- import { ManageClient } from "./packages/ManageClient";
5
- import { OnPremClient } from "./packages/OnPremClient";
6
- import { ReadClient } from "./packages/ReadClient";
7
- import { SpeakClient } from "./packages/SpeakClient";
2
+ import {
3
+ AbstractClient,
4
+ ListenClient,
5
+ ManageClient,
6
+ ReadClient,
7
+ OnPremClient,
8
+ SelfHostedRestClient,
9
+ SpeakClient,
10
+ } from "./packages";
8
11
 
9
12
  /**
10
- * Deepgram Client.
13
+ * The DeepgramClient class provides access to various Deepgram API clients, including ListenClient, ManageClient, SelfHostedRestClient, ReadClient, and SpeakClient.
11
14
  *
12
- * An isomorphic Javascript client for interacting with the Deepgram API.
13
- * @see https://developers.deepgram.com/docs/js-sdk
15
+ * @see https://github.com/deepgram/deepgram-js-sdk
14
16
  */
15
17
  export default class DeepgramClient extends AbstractClient {
18
+ /**
19
+ * Returns a new instance of the ListenClient, which provides access to the Deepgram API's listening functionality.
20
+ *
21
+ * @returns {ListenClient} A new instance of the ListenClient.
22
+ */
16
23
  get listen(): ListenClient {
17
- return new ListenClient(this.key, this.options);
24
+ return new ListenClient(this.options);
18
25
  }
19
26
 
27
+ /**
28
+ * Returns a new instance of the ManageClient, which provides access to the Deepgram API's management functionality.
29
+ *
30
+ * @returns {ManageClient} A new instance of the ManageClient.
31
+ */
20
32
  get manage(): ManageClient {
21
- return new ManageClient(this.key, this.options);
33
+ return new ManageClient(this.options);
22
34
  }
23
35
 
36
+ /**
37
+ * Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
38
+ *
39
+ * @returns {OnPremClient} A new instance of the SelfHostedRestClient named as OnPremClient.
40
+ * @deprecated use selfhosted() instead
41
+ */
24
42
  get onprem(): OnPremClient {
25
- return new OnPremClient(this.key, this.options);
43
+ return this.selfhosted;
26
44
  }
27
45
 
46
+ /**
47
+ * Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
48
+ *
49
+ * @returns {SelfHostedRestClient} A new instance of the SelfHostedRestClient.
50
+ */
51
+ get selfhosted(): SelfHostedRestClient {
52
+ return new SelfHostedRestClient(this.options);
53
+ }
54
+
55
+ /**
56
+ * Returns a new instance of the ReadClient, which provides access to the Deepgram API's reading functionality.
57
+ *
58
+ * @returns {ReadClient} A new instance of the ReadClient.
59
+ */
28
60
  get read(): ReadClient {
29
- return new ReadClient(this.key, this.options);
61
+ return new ReadClient(this.options);
30
62
  }
31
63
 
64
+ /**
65
+ * Returns a new instance of the SpeakClient, which provides access to the Deepgram API's speaking functionality.
66
+ *
67
+ * @returns {SpeakClient} A new instance of the SpeakClient.
68
+ */
32
69
  get speak(): SpeakClient {
33
- return new SpeakClient(this.key, this.options);
70
+ return new SpeakClient(this.options);
34
71
  }
35
72
 
36
73
  /**
37
- * Major version fallback errors are below
38
- *
39
- * @see https://developers.deepgram.com/docs/js-sdk-v2-to-v3-migration-guide
74
+ * @deprecated
75
+ * @see https://dpgr.am/js-v3
40
76
  */
41
77
  get transcription(): any {
42
78
  throw new DeepgramVersionError();
43
79
  }
44
80
 
81
+ /**
82
+ * @deprecated
83
+ * @see https://dpgr.am/js-v3
84
+ */
45
85
  get projects(): any {
46
86
  throw new DeepgramVersionError();
47
87
  }
48
88
 
89
+ /**
90
+ * @deprecated
91
+ * @see https://dpgr.am/js-v3
92
+ */
49
93
  get keys(): any {
50
94
  throw new DeepgramVersionError();
51
95
  }
52
96
 
97
+ /**
98
+ * @deprecated
99
+ * @see https://dpgr.am/js-v3
100
+ */
53
101
  get members(): any {
54
102
  throw new DeepgramVersionError();
55
103
  }
56
104
 
105
+ /**
106
+ * @deprecated
107
+ * @see https://dpgr.am/js-v3
108
+ */
57
109
  get scopes(): any {
58
110
  throw new DeepgramVersionError();
59
111
  }
60
112
 
113
+ /**
114
+ * @deprecated
115
+ * @see https://dpgr.am/js-v3
116
+ */
61
117
  get invitation(): any {
62
118
  throw new DeepgramVersionError();
63
119
  }
64
120
 
121
+ /**
122
+ * @deprecated
123
+ * @see https://dpgr.am/js-v3
124
+ */
65
125
  get usage(): any {
66
126
  throw new DeepgramVersionError();
67
127
  }
68
128
 
129
+ /**
130
+ * @deprecated
131
+ * @see https://dpgr.am/js-v3
132
+ */
69
133
  get billing(): any {
70
134
  throw new DeepgramVersionError();
71
135
  }
package/src/index.ts CHANGED
@@ -1,9 +1,12 @@
1
- import DeepgramClient from "./DeepgramClient";
1
+ import { DeepgramClientOptions, IKeyFactory } from "./lib/types/DeepgramClientOptions";
2
2
  import { DeepgramVersionError } from "./lib/errors";
3
- import type { DeepgramClientOptions } from "./lib/types";
3
+ import DeepgramClient from "./DeepgramClient";
4
4
 
5
5
  /**
6
- * Major version fallback error
6
+ * This class is deprecated and should not be used. It throws a `DeepgramVersionError` when instantiated.
7
+ *
8
+ * @deprecated
9
+ * @see https://dpgr.am/js-v3
7
10
  */
8
11
  class Deepgram {
9
12
  constructor(protected apiKey: string, protected apiUrl?: string, protected requireSSL?: boolean) {
@@ -12,11 +15,33 @@ class Deepgram {
12
15
  }
13
16
 
14
17
  /**
15
- * Creates a new Deepgram Client.
18
+ * Creates a new Deepgram client instance.
19
+ *
20
+ * @param {DeepgramClientArgs} args - Arguments to pass to the Deepgram client constructor.
21
+ * @returns A new Deepgram client instance.
16
22
  */
17
- const createClient = (apiKey: string, options: DeepgramClientOptions = {}): DeepgramClient => {
18
- return new DeepgramClient(apiKey, options);
19
- };
23
+ function createClient(): DeepgramClient;
24
+ function createClient(key?: string | IKeyFactory): DeepgramClient;
25
+ function createClient(options?: DeepgramClientOptions): DeepgramClient;
26
+ function createClient(key?: string | IKeyFactory, options?: DeepgramClientOptions): DeepgramClient;
27
+ function createClient(
28
+ keyOrOptions?: string | IKeyFactory | DeepgramClientOptions,
29
+ options?: DeepgramClientOptions
30
+ ): DeepgramClient {
31
+ let resolvedOptions: DeepgramClientOptions = {};
32
+
33
+ if (typeof keyOrOptions === "string" || typeof keyOrOptions === "function") {
34
+ if (typeof options === "object") {
35
+ resolvedOptions = options;
36
+ }
37
+
38
+ resolvedOptions.key = keyOrOptions;
39
+ } else if (typeof keyOrOptions === "object") {
40
+ resolvedOptions = keyOrOptions;
41
+ }
42
+
43
+ return new DeepgramClient(resolvedOptions);
44
+ }
20
45
 
21
46
  export { createClient, DeepgramClient, Deepgram };
22
47